diff --git a/CodeLite/CodeLite.project b/CodeLite/CodeLite.project index 4e91a2fcea..bd9a1921bf 100644 --- a/CodeLite/CodeLite.project +++ b/CodeLite/CodeLite.project @@ -239,6 +239,6 @@ - + diff --git a/File2Hex/File2Hex.project b/File2Hex/File2Hex.project index ac79afbd3d..d6310ae53a 100644 --- a/File2Hex/File2Hex.project +++ b/File2Hex/File2Hex.project @@ -12,21 +12,21 @@ - + - - - - - - + + + + + + - - + + @@ -35,23 +35,21 @@ - + - - - - + + + + None - + - - - - + + diff --git a/InnoSetup/lite_editor.iss b/InnoSetup/lite_editor.iss index 191881ff3d..83bceabf45 100644 --- a/InnoSetup/lite_editor.iss +++ b/InnoSetup/lite_editor.iss @@ -33,7 +33,7 @@ Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescrip [Files] Source: "C:\Development\C++\codelite\trunk\Runtime\CodeLite.exe"; DestDir: "{app}"; Flags: ignoreversion; Components: Editor Source: "C:\Development\C++\codelite\trunk\LICENSE"; DestDir: "{app}"; Flags: ignoreversion; Components: Editor -Source: "C:\wxWidgets-2.8.7\lib\gcc_dll\wxmsw28u_gcc_custom.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Editor +Source: "C:\wxWidgets-2.8.10\lib\gcc_dll\wxmsw28u_gcc_custom.dll"; DestDir: "{app}"; Flags: ignoreversion; Components: Editor Source: "C:\Development\C++\codelite\trunk\InnoSetup\license.txt"; DestDir: "{app}"; Flags: ignoreversion ; Components: Editor Source: "C:\Program Files\CodeLite\common.tags"; DestDir: "{app}"; Flags: onlyifdoesntexist; Components: Editor Source: "C:\Development\C++\codelite\trunk\sdk\wxconfig\wx-config.exe"; DestDir: "{app}"; Components: Editor diff --git a/LiteEditor/aboutdlg.cpp b/LiteEditor/aboutdlg.cpp index a570c8fca5..c5a8ec313c 100644 --- a/LiteEditor/aboutdlg.cpp +++ b/LiteEditor/aboutdlg.cpp @@ -1,25 +1,25 @@ ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // -// copyright : (C) 2008 by Eran Ifrah -// file name : aboutdlg.cpp -// +// copyright : (C) 2008 by Eran Ifrah +// file name : aboutdlg.cpp +// // ------------------------------------------------------------------------- -// A -// _____ _ _ _ _ -// / __ \ | | | | (_) | -// | / \/ ___ __| | ___| | _| |_ ___ -// | | / _ \ / _ |/ _ \ | | | __/ _ ) -// | \__/\ (_) | (_| | __/ |___| | || __/ -// \____/\___/ \__,_|\___\_____/_|\__\___| -// -// F i l e -// -// 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. -// +// A +// _____ _ _ _ _ +// / __ \ | | | | (_) | +// | / \/ ___ __| | ___| | _| |_ ___ +// | | / _ \ / _ |/ _ \ | | | __/ _ ) +// | \__/\ (_) | (_| | __/ |___| | || __/ +// \____/\___/ \__,_|\___\_____/_|\__\___| +// +// F i l e +// +// 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. +// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// @@ -27,13 +27,14 @@ #include #include "aboutdlg.h" #include "contributers.h" +#include "windowattrmanager.h" static void DrawBitmap( wxBitmap& bitmap, const wxString &mainTitle) { wxMemoryDC dcMem; dcMem.SelectObject(bitmap); - + //write the main title wxCoord w, h; wxFont font = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); @@ -43,15 +44,15 @@ static void DrawBitmap( wxBitmap& bitmap, const wxString &mainTitle) dcMem.SetFont(font); dcMem.GetMultiLineTextExtent(mainTitle, &w, &h); wxCoord bmpW = bitmap.GetWidth(); - - //draw shadow + + //draw shadow dcMem.SetTextForeground(wxT("LIGHT GRAY")); - + dcMem.DrawText(mainTitle, bmpW - w - 9, 11); - //draw the text + //draw the text dcMem.SetTextForeground(wxT("BLACK")); dcMem.SetFont(font); - + //draw the main title wxCoord textX = bmpW - w - 10; wxCoord textY = 10; @@ -69,9 +70,17 @@ AboutDlg::AboutDlg( wxWindow* parent, const wxString &mainTitle ) // set the page content m_htmlWin3->SetPage(wxString::FromUTF8(about_hex)); m_buttonOk->SetFocus(); - GetSizer()->Fit(this); + GetSizer()->Fit(this); + + WindowAttrManager::Load(this, wxT("AboutDialog"), NULL); } +AboutDlg::~AboutDlg() +{ + WindowAttrManager::Save(this, wxT("AboutDialog"), NULL); +} + + void AboutDlg::SetInfo(const wxString& info) { m_staticTextInformation->SetLabel(info); diff --git a/LiteEditor/aboutdlg.h b/LiteEditor/aboutdlg.h index 1637b84104..1d8a79dc05 100644 --- a/LiteEditor/aboutdlg.h +++ b/LiteEditor/aboutdlg.h @@ -1,25 +1,25 @@ ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // -// copyright : (C) 2008 by Eran Ifrah -// file name : aboutdlg.h -// +// copyright : (C) 2008 by Eran Ifrah +// file name : aboutdlg.h +// // ------------------------------------------------------------------------- -// A -// _____ _ _ _ _ -// / __ \ | | | | (_) | -// | / \/ ___ __| | ___| | _| |_ ___ -// | | / _ \ / _ |/ _ \ | | | __/ _ ) -// | \__/\ (_) | (_| | __/ |___| | || __/ -// \____/\___/ \__,_|\___\_____/_|\__\___| -// -// F i l e -// -// 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. -// +// A +// _____ _ _ _ _ +// / __ \ | | | | (_) | +// | / \/ ___ __| | ___| | _| |_ ___ +// | | / _ \ / _ |/ _ \ | | | __/ _ ) +// | \__/\ (_) | (_| | __/ |___| | || __/ +// \____/\___/ \__,_|\___\_____/_|\__\___| +// +// F i l e +// +// 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. +// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// @@ -40,7 +40,8 @@ class AboutDlg : public AboutDlgBase wxBitmap m_bmp; public: /** Constructor */ - AboutDlg( wxWindow* parent, const wxString &mainTitle ); + AboutDlg( wxWindow* parent, const wxString &mainTitle ); + virtual ~AboutDlg(); void SetInfo(const wxString &info); wxString GetInfo() const; }; diff --git a/LiteEditor/buidltab.cpp b/LiteEditor/buidltab.cpp index 94fbfa5b47..2de47227c1 100644 --- a/LiteEditor/buidltab.cpp +++ b/LiteEditor/buidltab.cpp @@ -168,7 +168,9 @@ void BuildTab::Clear() Frame::Get()->GetOutputPane()->GetErrorsTab()->ClearLines(); LEditor *editor = Frame::Get()->GetMainBook()->GetActiveEditor(); if ( editor ) { - editor->DelAllCompilerMarkers(); + editor->AnnotationClearAll(); + editor->AnnotationSetVisible(0); // Hidden + editor->Refresh(); } } @@ -313,7 +315,10 @@ void BuildTab::MarkEditor ( LEditor *editor ) { if ( !editor ) return; - editor->DelAllCompilerMarkers(); + + editor->AnnotationClearAll(); + editor->AnnotationSetVisible(2); // Visible with box around it + std::pair::iterator, std::multimap::iterator> iters = m_fileMap.equal_range(editor->GetFileName().GetFullPath()); std::multimap::iterator b = iters.first; @@ -321,15 +326,25 @@ void BuildTab::MarkEditor ( LEditor *editor ) if (b == m_fileMap.end()) return; for (; b != e; b++ ) { + std::map::iterator i = m_lineInfo.find ( b->second ) ; + if ( i == m_lineInfo.end() ) continue; // safety check -- should not normally happen - if ( i->second.linecolor == wxSCI_LEX_GCC_ERROR ) { - editor->SetErrorMarker ( i->second.linenum ); - } else if ( i->second.linecolor == wxSCI_LEX_GCC_WARNING ) { - editor->SetWarningMarker ( i->second.linenum ); + + if ( i->second.linecolor == wxSCI_LEX_GCC_ERROR || i->second.linecolor == wxSCI_LEX_GCC_WARNING ) { + + wxMemoryBuffer style_bytes; + int line_number = i->second.linenum; + wxString tip = GetBuildToolTip(editor->GetFileName().GetFullPath(), line_number, style_bytes); + + editor->AnnotationSetText (line_number, tip); + editor->AnnotationSetStyles(line_number, style_bytes ); + } + } + editor->Refresh(); } void BuildTab::OnClearAll ( wxCommandEvent &e ) @@ -513,7 +528,7 @@ void BuildTab::OnMouseDClick ( wxScintillaEvent &e ) PERF_END(); } -wxString BuildTab::GetBuildToolTip(const wxString& fileName, int lineno) +wxString BuildTab::GetBuildToolTip(const wxString& fileName, int lineno, wxMemoryBuffer &styleBits) { std::pair::iterator, std::multimap::iterator> iters = m_fileMap.equal_range(fileName); @@ -524,17 +539,28 @@ wxString BuildTab::GetBuildToolTip(const wxString& fileName, int lineno) if(i1 == m_fileMap.end()) return wxEmptyString; - wxString tip; + wxString tip(wxT("\n ")); + styleBits.AppendByte((char)eAnnotationStyleError); + styleBits.AppendByte((char)eAnnotationStyleError); for ( ; i1 != i2; i1++ ) { std::map::iterator i = m_lineInfo.find ( i1->second ) ; - if ( i != m_lineInfo.end() && i->second.linenum == lineno && - (i->second.linecolor == wxSCI_LEX_GCC_ERROR || i->second.linecolor == wxSCI_LEX_GCC_WARNING )) { + if ( i != m_lineInfo.end() && i->second.linenum == lineno && (i->second.linecolor == wxSCI_LEX_GCC_ERROR || i->second.linecolor == wxSCI_LEX_GCC_WARNING )) { wxString text = i->second.linetext.Mid(i->second.filestart+i->second.filelen); if (!text.IsEmpty() && text[0] == wxT(':')) { text.erase(0, 1); } - tip << text.Trim(false).Trim() << wxT("\n"); + + wxString tmpTip (text.Trim(false).Trim() << wxT("\n ")); + + for(size_t j=0; jsecond.linecolor == wxSCI_LEX_GCC_WARNING ) { + styleBits.AppendByte((char)eAnnotationStyleWarning); + } else { + styleBits.AppendByte((char)eAnnotationStyleError); + } + } + tip << tmpTip; } } - return tip.Trim(false).Trim(); + return tip ; } diff --git a/LiteEditor/buidltab.h b/LiteEditor/buidltab.h index dab2336ef3..af426777fd 100644 --- a/LiteEditor/buidltab.h +++ b/LiteEditor/buidltab.h @@ -107,7 +107,7 @@ class BuildTab : public OutputTabWindow BuildTab(wxWindow *parent, wxWindowID id, const wxString &name); ~BuildTab(); - wxString GetBuildToolTip(const wxString &fileName, int lineno); + wxString GetBuildToolTip(const wxString &fileName, int lineno, wxMemoryBuffer &styleBits); }; #endif // __buidltab__ diff --git a/LiteEditor/cl_editor.cpp b/LiteEditor/cl_editor.cpp index c86167fe5e..6143baf8de 100644 --- a/LiteEditor/cl_editor.cpp +++ b/LiteEditor/cl_editor.cpp @@ -24,6 +24,7 @@ ////////////////////////////////////////////////////////////////////////////// #include "cl_editor.h" +#include "buildtabsettingsdata.h" #include "jobqueue.h" #include "stringhighlighterjob.h" #include "job.h" @@ -312,7 +313,7 @@ void LEditor::SetProperties() SetMarginType(NUMBER_MARGIN_ID, wxSCI_MARGIN_NUMBER); // line number margin displays every thing but folding, bookmarks and breakpoint - SetMarginMask(NUMBER_MARGIN_ID, ~(mmt_folds | mmt_bookmarks | mmt_indicator | mmt_compiler | mmt_all_breakpoints)); + SetMarginMask(NUMBER_MARGIN_ID, ~(mmt_folds | mmt_bookmarks | mmt_indicator | mmt_all_breakpoints)); // Separators SetMarginType(SYMBOLS_MARGIN_SEP_ID, wxSCI_MARGIN_FORE); @@ -511,6 +512,20 @@ void LEditor::SetProperties() IndicatorSetStyle(MATCH_INDICATOR, wxSCI_INDIC_BOX); IndicatorSetForeground(MATCH_INDICATOR, wxT("GREY")); + // Error + wxFont guiFont = wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); + BuildTabSettingsData cmpColoursOptions; + EditorConfigST::Get()->ReadObject ( wxT ( "build_tab_settings" ), &cmpColoursOptions); + + StyleSetBackground(eAnnotationStyleError, DrawingUtils::LightColour(cmpColoursOptions.GetErrorColour(), 9.0)); + StyleSetForeground(eAnnotationStyleError, cmpColoursOptions.GetErrorColour()); + StyleSetFont(eAnnotationStyleError, guiFont); + + // Warning + StyleSetBackground(eAnnotationStyleWarning, DrawingUtils::LightColour(cmpColoursOptions.GetErrorColour(), 9.0)); + StyleSetForeground(eAnnotationStyleWarning, cmpColoursOptions.GetWarnColour()); + StyleSetFont(eAnnotationStyleWarning, guiFont); + CmdKeyClear(wxT('L'), wxSCI_SCMOD_CTRL); // clear Ctrl+D because we use it for something else } @@ -531,6 +546,8 @@ void LEditor::OnSavePoint(wxScintillaEvent &event) void LEditor::OnCharAdded(wxScintillaEvent& event) { + static wxChar s_lastCharEntered = 0; + int pos = GetCurrentPos(); // get the word and select it in the completion box @@ -594,7 +611,7 @@ void LEditor::OnCharAdded(wxScintillaEvent& event) // fall through... case '\n': { // incase ENTER was hit between {} - if ( GetCharAt (PositionBefore( PositionBefore(pos) )) == wxT('{') ) { + if ( GetCharAt (PositionBefore( PositionBefore(pos) )) == wxT('{') && s_lastCharEntered == wxT('{') ) { matchChar = '}'; InsertText(pos, matchChar); BeginUndoAction(); @@ -643,6 +660,7 @@ void LEditor::OnCharAdded(wxScintillaEvent& event) m_context->OnUserTypedXChars(GetWordAtCaret()); } } + s_lastCharEntered = event.GetKey(); event.Skip(); } @@ -1019,9 +1037,6 @@ void LEditor::OnDwellStart(wxScintillaEvent & event) tooltip = ManagerST::Get()->GetBreakpointsMgr()->GetTooltip(fname, line+1); type = ct_breakpoint; - } else if (MarkerGet(line) & mmt_compiler) { - tooltip = Frame::Get()->GetOutputPane()->GetBuildTab()->GetBuildToolTip(fname, line); - type = ct_compiler_msg; } if (! tooltip.IsEmpty()) { @@ -2371,8 +2386,8 @@ void LEditor::SetErrorMarker(int lineno) void LEditor::DelAllCompilerMarkers() { - MarkerDeleteAll(smt_warning); - MarkerDeleteAll(smt_error); +// MarkerDeleteAll(smt_warning); +// MarkerDeleteAll(smt_error); } // Maybe one day we'll display multiple bps differently diff --git a/LiteEditor/cl_editor.h b/LiteEditor/cl_editor.h index f3b36400ae..c3fbd67d1d 100644 --- a/LiteEditor/cl_editor.h +++ b/LiteEditor/cl_editor.h @@ -44,6 +44,10 @@ class wxFindReplaceDialog; class CCBox; +enum sci_annotation_styles { + eAnnotationStyleError = 128, eAnnotationStyleWarning +}; + // NB The following are sci markers, which are zero based. So smt_bookmark is actually the eighth of them (important when masking it!) // If you add another type here, watch out for smt_LAST_BP_TYPE; and you need also to add to the enum 'marker_mask_type' below // The higher the value, the nearer the top of the pecking order displaywise. So keep the most important breakpoint at the top i.e. smt_breakpoint, @@ -57,7 +61,7 @@ enum sci_marker_types { smt_bookmark=7, smt_FIRST_BP_TYPE=8, smt_cond_bp_disable // 0x7f00 is binary 111111100000000 and masks all the 7 current breakpoint types. If you add others, change it enum marker_mask_type { mmt_folds=wxSCI_MASK_FOLDERS, mmt_bookmarks=128, mmt_FIRST_BP_TYPE=0x100, mmt_cond_bp_disabled=mmt_FIRST_BP_TYPE, mmt_bp_cmdlist_disabled=0x200, mmt_bp_disabled=0x400, mmt_bp_ignored=0x800, mmt_cond_bp=0x1000,mmt_bp_cmdlist=0x2000, mmt_breakpoint=0x4000, mmt_LAST_BP_TYPE=mmt_breakpoint, mmt_all_breakpoints=0x7f00, mmt_indicator=0x8000, - mmt_compiler=0x30000 /* masks compiler errors/warnings */ + /* masks compiler errors/warnings */ }; enum calltip_type { ct_function_hover, ct_debugger, ct_function_proto, ct_breakpoint, ct_compiler_msg, ct_none}; diff --git a/LiteEditor/context_base.cpp b/LiteEditor/context_base.cpp index b47ae52c85..38962a65e5 100644 --- a/LiteEditor/context_base.cpp +++ b/LiteEditor/context_base.cpp @@ -73,6 +73,8 @@ void ContextBase::DoApplySettings(LexerConfPtr lexPtr) #else rCtrl.IndicatorSetStyle(1, wxSCI_INDIC_ROUNDBOX); rCtrl.IndicatorSetStyle(2, wxSCI_INDIC_ROUNDBOX); + rCtrl.IndicatorSetAlpha(1, 70); + rCtrl.IndicatorSetAlpha(2, 70); #endif bool tooltip(false); diff --git a/LiteEditor/context_cpp.cpp b/LiteEditor/context_cpp.cpp index ed8bd70edd..614e9267f4 100644 --- a/LiteEditor/context_cpp.cpp +++ b/LiteEditor/context_cpp.cpp @@ -1141,7 +1141,8 @@ void ContextCpp::OnGenerateSettersGetters(wxCommandEvent &event) return; TagEntryPtr tag = classtags.at(0); - if (editor.GetFileName() != tag->GetFile()) { + if (tag->GetFile().CmpNoCase(editor.GetFileName().GetFullPath()) != 0) { + wxString msg; msg << wxT("This file does not seem to contain the declaration for '") << tag->GetName() << wxT("'\n"); msg << wxT("The declaration of '") << tag->GetName() << wxT("' is located at '") << tag->GetFile() << wxT("'\n"); @@ -2143,7 +2144,7 @@ void ContextCpp::ReplaceInFiles ( const wxString &word, std::list &li file_name = token.getFilename(); } LEditor *editor = Frame::Get()->GetMainBook()->OpenFile(token.getFilename(), wxEmptyString, 0); - if (editor != NULL && editor->GetFileName() == wxFileName(token.getFilename())) { + if (editor != NULL && (editor->GetFileName().GetFullPath().CmpNoCase(token.getFilename()) == 0) ) { editor->SetSelection ( token.getOffset(), token.getOffset()+token.getName().Len() ); if ( editor->GetSelectionStart() != editor->GetSelectionEnd() ) { editor->ReplaceSelection ( word ); diff --git a/LiteEditor/contributers.h b/LiteEditor/contributers.h index 6ade64d258..d5213db612 100644 --- a/LiteEditor/contributers.h +++ b/LiteEditor/contributers.h @@ -1,28 +1,3 @@ -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// -// -// copyright : (C) 2008 by Eran Ifrah -// file name : contributers.h -// -// ------------------------------------------------------------------------- -// A -// _____ _ _ _ _ -// / __ \ | | | | (_) | -// | / \/ ___ __| | ___| | _| |_ ___ -// | | / _ \ / _ |/ _ \ | | | __/ _ ) -// | \__/\ (_) | (_| | __/ |___| | || __/ -// \____/\___/ \__,_|\___\_____/_|\__\___| -// -// F i l e -// -// 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. -// -////////////////////////////////////////////////////////////////////////////// -////////////////////////////////////////////////////////////////////////////// - const char about_hex [] ={ 0x3C,0x68,0x74,0x6D,0x6C,0x3E,0x0D,0x0A,0x3C,0x62,0x6F,0x64,0x79,0x3E, 0x0D,0x0A,0x3C,0x74,0x61,0x62,0x6C,0x65,0x20,0x77,0x69,0x64,0x74,0x68, @@ -41,50 +16,51 @@ const char about_hex [] ={ 0x69,0x6E,0x20,0x61,0x6E,0x64,0x20,0x63,0x6F,0x72,0x65,0x20,0x64,0x65, 0x76,0x65,0x6C,0x6F,0x70,0x65,0x72,0x2E,0x3C,0x2F,0x74,0x64,0x3E,0x3C, 0x2F,0x74,0x72,0x3E,0x0D,0x0A,0x3C,0x74,0x72,0x3E,0x3C,0x74,0x64,0x20, - 0x76,0x61,0x6C,0x69,0x67,0x6E,0x3D,0x74,0x6F,0x70,0x3E,0x53,0x63,0x6F, - 0x74,0x74,0x20,0x44,0x6F,0x6C,0x69,0x6D,0x3C,0x2F,0x74,0x64,0x3E,0x3C, - 0x74,0x64,0x20,0x76,0x61,0x6C,0x69,0x67,0x6E,0x3D,0x74,0x6F,0x70,0x3E, - 0x43,0x6F,0x72,0x65,0x20,0x64,0x65,0x76,0x65,0x6C,0x6F,0x70,0x65,0x72, - 0x2E,0x3C,0x2F,0x74,0x64,0x3E,0x3C,0x2F,0x74,0x72,0x3E,0x0D,0x0A,0x3C, - 0x74,0x72,0x3E,0x3C,0x74,0x64,0x20,0x76,0x61,0x6C,0x69,0x67,0x6E,0x3D, - 0x74,0x6F,0x70,0x3E,0x20,0x26,0x6E,0x62,0x73,0x70,0x20,0x3C,0x2F,0x74, - 0x64,0x3E,0x3C,0x2F,0x74,0x72,0x3E,0x0D,0x0A,0x3C,0x74,0x72,0x3E,0x3C, - 0x74,0x64,0x20,0x76,0x61,0x6C,0x69,0x67,0x6E,0x3D,0x74,0x6F,0x70,0x20, - 0x63,0x6F,0x6C,0x73,0x70,0x61,0x6E,0x3D,0x32,0x20,0x62,0x67,0x63,0x6F, - 0x6C,0x6F,0x72,0x3D,0x22,0x4C,0x49,0x47,0x48,0x54,0x20,0x42,0x4C,0x55, - 0x45,0x22,0x3E,0x3C,0x73,0x74,0x72,0x6F,0x6E,0x67,0x3E,0x43,0x6F,0x6E, - 0x74,0x72,0x69,0x62,0x75,0x74,0x65,0x72,0x73,0x20,0x2F,0x20,0x53,0x70, - 0x65,0x63,0x69,0x61,0x6C,0x20,0x74,0x68,0x61,0x6E,0x6B,0x73,0x3C,0x2F, - 0x73,0x74,0x72,0x6F,0x6E,0x67,0x3E,0x3C,0x2F,0x74,0x64,0x3E,0x3C,0x2F, - 0x74,0x72,0x3E,0x0D,0x0A,0x3C,0x74,0x72,0x3E,0x3C,0x74,0x64,0x20,0x76, - 0x61,0x6C,0x69,0x67,0x6E,0x3D,0x74,0x6F,0x70,0x3E,0x44,0x61,0x76,0x69, - 0x64,0x20,0x48,0x61,0x72,0x74,0x3C,0x2F,0x74,0x64,0x3E,0x3C,0x74,0x64, - 0x20,0x76,0x61,0x6C,0x69,0x67,0x6E,0x3D,0x74,0x6F,0x70,0x3E,0x4C,0x69, - 0x6E,0x75,0x78,0x20,0x36,0x34,0x62,0x69,0x74,0x2C,0x20,0x72,0x70,0x6D, - 0x20,0x70,0x61,0x63,0x6B,0x61,0x67,0x69,0x6E,0x67,0x2C,0x20,0x70,0x61, - 0x74,0x63,0x68,0x65,0x73,0x3C,0x2F,0x74,0x64,0x3E,0x3C,0x2F,0x74,0x72, - 0x3E,0x0D,0x0A,0x3C,0x74,0x72,0x3E,0x3C,0x74,0x64,0x20,0x76,0x61,0x6C, - 0x69,0x67,0x6E,0x3D,0x74,0x6F,0x70,0x3E,0x46,0x72,0x61,0x6E,0x6B,0x20, - 0x4C,0x69,0x63,0x68,0x74,0x6E,0x65,0x72,0x3C,0x2F,0x74,0x64,0x3E,0x3C, - 0x74,0x64,0x20,0x76,0x61,0x6C,0x69,0x67,0x6E,0x3D,0x74,0x6F,0x70,0x3E, - 0x53,0x6E,0x69,0x70,0x57,0x69,0x7A,0x20,0x70,0x6C,0x75,0x67,0x69,0x6E, - 0x20,0x64,0x65,0x76,0x65,0x6C,0x6F,0x70,0x65,0x72,0x3C,0x2F,0x74,0x64, - 0x3E,0x3C,0x2F,0x74,0x72,0x3E,0x0D,0x0A,0x3C,0x74,0x72,0x3E,0x3C,0x74, - 0x64,0x20,0x76,0x61,0x6C,0x69,0x67,0x6E,0x3D,0x74,0x6F,0x70,0x3E,0x4A, - 0x61,0x63,0x65,0x6B,0x20,0x4B,0x75,0x63,0x68,0x61,0x72,0x73,0x6B,0x69, - 0x3C,0x2F,0x74,0x64,0x3E,0x3C,0x74,0x64,0x20,0x76,0x61,0x6C,0x69,0x67, - 0x6E,0x3D,0x74,0x6F,0x70,0x3E,0x55,0x6E,0x69,0x63,0x6F,0x64,0x65,0x20, - 0x61,0x6E,0x64,0x20,0x4D,0x75,0x6C,0x74,0x69,0x62,0x79,0x74,0x65,0x20, - 0x73,0x75,0x70,0x70,0x6F,0x72,0x74,0x3C,0x2F,0x74,0x64,0x3E,0x3C,0x2F, - 0x74,0x72,0x3E,0x0D,0x0A,0x3C,0x74,0x72,0x3E,0x3C,0x74,0x64,0x20,0x76, - 0x61,0x6C,0x69,0x67,0x6E,0x3D,0x74,0x6F,0x70,0x3E,0x4D,0x61,0x72,0x69, - 0x61,0x6E,0x6E,0x65,0x20,0x47,0x61,0x67,0x6E,0x6F,0x6E,0x3C,0x2F,0x74, - 0x64,0x3E,0x3C,0x74,0x64,0x20,0x76,0x61,0x6C,0x69,0x67,0x6E,0x3D,0x74, - 0x6F,0x70,0x3E,0x4D,0x61,0x63,0x20,0x50,0x50,0x43,0x20,0x70,0x61,0x63, - 0x6B,0x61,0x67,0x69,0x6E,0x67,0x20,0x61,0x6E,0x64,0x20,0x69,0x6E,0x69, - 0x74,0x69,0x61,0x6C,0x20,0x70,0x6F,0x72,0x74,0x65,0x72,0x20,0x74,0x6F, - 0x20,0x4D,0x61,0x63,0x20,0x4F,0x53,0x20,0x58,0x3C,0x2F,0x74,0x64,0x3E, - 0x3C,0x2F,0x74,0x72,0x3E,0x0D,0x0A,0x3C,0x2F,0x74,0x61,0x62,0x6C,0x65, - 0x3E,0x0D,0x0A,0x3C,0x2F,0x62,0x6F,0x64,0x79,0x3E,0x0D,0x0A,0x3C,0x2F, - 0x68,0x74,0x6D,0x6C,0x3E,0x0D,0x0A, + 0x76,0x61,0x6C,0x69,0x67,0x6E,0x3D,0x74,0x6F,0x70,0x3E,0x20,0x26,0x6E, + 0x62,0x73,0x70,0x20,0x3C,0x2F,0x74,0x64,0x3E,0x3C,0x2F,0x74,0x72,0x3E, + 0x0D,0x0A,0x3C,0x74,0x72,0x3E,0x3C,0x74,0x64,0x20,0x76,0x61,0x6C,0x69, + 0x67,0x6E,0x3D,0x74,0x6F,0x70,0x20,0x63,0x6F,0x6C,0x73,0x70,0x61,0x6E, + 0x3D,0x32,0x20,0x62,0x67,0x63,0x6F,0x6C,0x6F,0x72,0x3D,0x22,0x4C,0x49, + 0x47,0x48,0x54,0x20,0x42,0x4C,0x55,0x45,0x22,0x3E,0x3C,0x73,0x74,0x72, + 0x6F,0x6E,0x67,0x3E,0x43,0x6F,0x6E,0x74,0x72,0x69,0x62,0x75,0x74,0x65, + 0x72,0x73,0x20,0x2F,0x20,0x53,0x70,0x65,0x63,0x69,0x61,0x6C,0x20,0x74, + 0x68,0x61,0x6E,0x6B,0x73,0x3C,0x2F,0x73,0x74,0x72,0x6F,0x6E,0x67,0x3E, + 0x3C,0x2F,0x74,0x64,0x3E,0x3C,0x2F,0x74,0x72,0x3E,0x0D,0x0A,0x3C,0x74, + 0x72,0x3E,0x3C,0x74,0x64,0x20,0x76,0x61,0x6C,0x69,0x67,0x6E,0x3D,0x74, + 0x6F,0x70,0x3E,0x44,0x61,0x76,0x69,0x64,0x20,0x48,0x61,0x72,0x74,0x3C, + 0x2F,0x74,0x64,0x3E,0x3C,0x74,0x64,0x20,0x76,0x61,0x6C,0x69,0x67,0x6E, + 0x3D,0x74,0x6F,0x70,0x3E,0x4C,0x69,0x6E,0x75,0x78,0x20,0x36,0x34,0x62, + 0x69,0x74,0x2C,0x20,0x72,0x70,0x6D,0x20,0x70,0x61,0x63,0x6B,0x61,0x67, + 0x69,0x6E,0x67,0x2C,0x20,0x70,0x61,0x74,0x63,0x68,0x65,0x73,0x3C,0x2F, + 0x74,0x64,0x3E,0x3C,0x2F,0x74,0x72,0x3E,0x0D,0x0A,0x3C,0x74,0x72,0x3E, + 0x3C,0x74,0x64,0x20,0x76,0x61,0x6C,0x69,0x67,0x6E,0x3D,0x74,0x6F,0x70, + 0x3E,0x46,0x72,0x61,0x6E,0x6B,0x20,0x4C,0x69,0x63,0x68,0x74,0x6E,0x65, + 0x72,0x3C,0x2F,0x74,0x64,0x3E,0x3C,0x74,0x64,0x20,0x76,0x61,0x6C,0x69, + 0x67,0x6E,0x3D,0x74,0x6F,0x70,0x3E,0x53,0x6E,0x69,0x70,0x57,0x69,0x7A, + 0x20,0x70,0x6C,0x75,0x67,0x69,0x6E,0x20,0x64,0x65,0x76,0x65,0x6C,0x6F, + 0x70,0x65,0x72,0x3C,0x2F,0x74,0x64,0x3E,0x3C,0x2F,0x74,0x72,0x3E,0x0D, + 0x0A,0x3C,0x74,0x72,0x3E,0x3C,0x74,0x64,0x20,0x76,0x61,0x6C,0x69,0x67, + 0x6E,0x3D,0x74,0x6F,0x70,0x3E,0x4A,0x61,0x63,0x65,0x6B,0x20,0x4B,0x75, + 0x63,0x68,0x61,0x72,0x73,0x6B,0x69,0x3C,0x2F,0x74,0x64,0x3E,0x3C,0x74, + 0x64,0x20,0x76,0x61,0x6C,0x69,0x67,0x6E,0x3D,0x74,0x6F,0x70,0x3E,0x55, + 0x6E,0x69,0x63,0x6F,0x64,0x65,0x20,0x61,0x6E,0x64,0x20,0x4D,0x75,0x6C, + 0x74,0x69,0x62,0x79,0x74,0x65,0x20,0x73,0x75,0x70,0x70,0x6F,0x72,0x74, + 0x3C,0x2F,0x74,0x64,0x3E,0x3C,0x2F,0x74,0x72,0x3E,0x0D,0x0A,0x3C,0x74, + 0x72,0x3E,0x3C,0x74,0x64,0x20,0x76,0x61,0x6C,0x69,0x67,0x6E,0x3D,0x74, + 0x6F,0x70,0x3E,0x4D,0x61,0x72,0x69,0x61,0x6E,0x6E,0x65,0x20,0x47,0x61, + 0x67,0x6E,0x6F,0x6E,0x3C,0x2F,0x74,0x64,0x3E,0x3C,0x74,0x64,0x20,0x76, + 0x61,0x6C,0x69,0x67,0x6E,0x3D,0x74,0x6F,0x70,0x3E,0x4D,0x61,0x63,0x20, + 0x50,0x50,0x43,0x20,0x70,0x61,0x63,0x6B,0x61,0x67,0x69,0x6E,0x67,0x20, + 0x61,0x6E,0x64,0x20,0x69,0x6E,0x69,0x74,0x69,0x61,0x6C,0x20,0x70,0x6F, + 0x72,0x74,0x65,0x72,0x20,0x74,0x6F,0x20,0x4D,0x61,0x63,0x20,0x4F,0x53, + 0x20,0x58,0x3C,0x2F,0x74,0x64,0x3E,0x3C,0x2F,0x74,0x72,0x3E,0x0D,0x0A, + 0x3C,0x74,0x72,0x3E,0x3C,0x74,0x64,0x20,0x76,0x61,0x6C,0x69,0x67,0x6E, + 0x3D,0x74,0x6F,0x70,0x3E,0x53,0x63,0x6F,0x74,0x74,0x20,0x44,0x6F,0x6C, + 0x69,0x6D,0x3C,0x2F,0x74,0x64,0x3E,0x3C,0x74,0x64,0x20,0x76,0x61,0x6C, + 0x69,0x67,0x6E,0x3D,0x74,0x6F,0x70,0x3E,0x56,0x61,0x72,0x69,0x6F,0x75, + 0x73,0x20,0x69,0x6D,0x70,0x72,0x6F,0x76,0x65,0x6D,0x65,0x6E,0x74,0x73, + 0x20,0x2F,0x20,0x62,0x75,0x67,0x20,0x66,0x69,0x78,0x65,0x73,0x3C,0x2F, + 0x74,0x64,0x3E,0x3C,0x2F,0x74,0x72,0x3E,0x0D,0x0A,0x3C,0x2F,0x74,0x61, + 0x62,0x6C,0x65,0x3E,0x0D,0x0A,0x3C,0x2F,0x62,0x6F,0x64,0x79,0x3E,0x0D, + 0x0A,0x3C,0x2F,0x68,0x74,0x6D,0x6C,0x3E,0x0D,0x0A, 0x00}; diff --git a/LiteEditor/cpp_symbol_tree.cpp b/LiteEditor/cpp_symbol_tree.cpp index 6ed5db69a8..11c6d033e6 100644 --- a/LiteEditor/cpp_symbol_tree.cpp +++ b/LiteEditor/cpp_symbol_tree.cpp @@ -160,7 +160,7 @@ bool CppSymbolTree::DoItemActivated(wxTreeItemId item, wxEvent &event, bool noti FindAndSelect(editor, pattern, GetItemText(item)); } } - + // post an event that an item was activated if ( notify ) { wxCommandEvent e(wxEVT_CMD_CPP_SYMBOL_ITEM_SELECTED); diff --git a/LiteEditor/filedroptarget.cpp b/LiteEditor/filedroptarget.cpp index 4a9f7fe1d7..e8bf134395 100644 --- a/LiteEditor/filedroptarget.cpp +++ b/LiteEditor/filedroptarget.cpp @@ -1,25 +1,25 @@ ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // -// copyright : (C) 2008 by Eran Ifrah -// file name : filedroptarget.cpp -// +// copyright : (C) 2008 by Eran Ifrah +// file name : filedroptarget.cpp +// // ------------------------------------------------------------------------- -// A -// _____ _ _ _ _ -// / __ \ | | | | (_) | -// | / \/ ___ __| | ___| | _| |_ ___ -// | | / _ \ / _ |/ _ \ | | | __/ _ ) -// | \__/\ (_) | (_| | __/ |___| | || __/ -// \____/\___/ \__,_|\___\_____/_|\__\___| -// -// F i l e -// -// 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. -// +// A +// _____ _ _ _ _ +// / __ \ | | | | (_) | +// | / \/ ___ __| | ___| | _| |_ ___ +// | | / _ \ / _ |/ _ \ | | | __/ _ ) +// | \__/\ (_) | (_| | __/ |___| | || __/ +// \____/\___/ \__,_|\___\_____/_|\__\___| +// +// F i l e +// +// 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. +// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// #include "filedroptarget.h" @@ -42,5 +42,5 @@ bool FileDropTarget::OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &file Frame::Get()->GetMainBook()->OpenFile(filenames.Item(i)); } return true; -} +} diff --git a/LiteEditor/fileview.cpp b/LiteEditor/fileview.cpp index db704910b8..153a20d926 100644 --- a/LiteEditor/fileview.cpp +++ b/LiteEditor/fileview.cpp @@ -121,20 +121,16 @@ FileViewTree::FileViewTree( wxWindow *parent, const wxWindowID id, const wxPoint { Create( parent, id, pos, size, style ); - -// SetBackgroundColour(*wxBLACK); -// SetForegroundColour(wxT("GREY")); - // Initialise images map wxImageList *images = new wxImageList( 16, 16, true ); - images->Add( wxXmlResource::Get()->LoadBitmap( wxT( "project" ) ) ); //0 - images->Add( wxXmlResource::Get()->LoadBitmap( wxT( "folder" ) ) ); //1 - images->Add( wxXmlResource::Get()->LoadBitmap( wxT( "page_white_c" ) ) ); //2 - images->Add( wxXmlResource::Get()->LoadBitmap( wxT( "page_white_cplusplus" ) ) ); //3 - images->Add( wxXmlResource::Get()->LoadBitmap( wxT( "page_white_h" ) ) ); //4 - images->Add( wxXmlResource::Get()->LoadBitmap( wxT( "page_white_text" ) ) ); //5 - images->Add( wxXmlResource::Get()->LoadBitmap( wxT( "workspace" ) ) ); //6 - images->Add( wxXmlResource::Get()->LoadBitmap( wxT( "wxfb" ) ) ); //7 + images->Add( wxXmlResource::Get()->LoadBitmap( wxT( "project" ) ) ); //0 + images->Add( wxXmlResource::Get()->LoadBitmap( wxT( "folder" ) ) ); //1 + images->Add( wxXmlResource::Get()->LoadBitmap( wxT( "page_white_c" ) ) ); //2 + images->Add( wxXmlResource::Get()->LoadBitmap( wxT( "page_white_cplusplus" ) ) ); //3 + images->Add( wxXmlResource::Get()->LoadBitmap( wxT( "page_white_h" ) ) ); //4 + images->Add( wxXmlResource::Get()->LoadBitmap( wxT( "page_white_text" ) ) ); //5 + images->Add( wxXmlResource::Get()->LoadBitmap( wxT( "workspace" ) ) ); //6 + images->Add( wxXmlResource::Get()->LoadBitmap( wxT( "formbuilder" ) ) ); //7 AssignImageList( images ); Connect( GetId(), wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, wxTreeEventHandler( FileViewTree::OnPopupMenu ) ); @@ -1206,7 +1202,7 @@ wxTreeItemId FileViewTree::FindItemByPath(wxTreeItemId &parent, const wxString & FilewViewTreeItemData *childData = static_cast( GetItemData( child ) ); wxFileName fn(childData->GetData().GetFile()); fn.MakeAbsolute( projectPath ); - if (fn == fileName) { + if (fn.GetFullPath().CmpNoCase(fileName) == 0) { return child; } diff --git a/LiteEditor/mainbook.cpp b/LiteEditor/mainbook.cpp index 1dffdd2c7d..fca4ebf530 100644 --- a/LiteEditor/mainbook.cpp +++ b/LiteEditor/mainbook.cpp @@ -327,12 +327,13 @@ LEditor *MainBook::FindEditor(const wxString &fileName) { for (size_t i = 0; i < m_book->GetPageCount(); i++) { LEditor *editor = dynamic_cast(m_book->GetPage(i)); - if (editor && editor->GetFileName() == fileName) + if (editor && editor->GetFileName().GetFullPath().CmpNoCase(fileName) == 0) return editor; } + for (std::set::iterator i = m_detachedTabs.begin(); i != m_detachedTabs.end(); i++) { LEditor *editor = dynamic_cast(*i); - if (editor && editor->GetFileName() == fileName) + if (editor && editor->GetFileName().GetFullPath().CmpNoCase(fileName) == 0) return editor; } return NULL; @@ -342,7 +343,7 @@ wxWindow *MainBook::FindPage(const wxString &text) { for (size_t i = 0; i < m_book->GetPageCount(); i++) { LEditor *editor = dynamic_cast(m_book->GetPage(i)); - if (editor && editor->GetFileName() == text) { + if (editor && editor->GetFileName().GetFullPath().CmpNoCase(text) == 0) { return editor; } diff --git a/LiteEditor/manager.cpp b/LiteEditor/manager.cpp index 5c10aaa06c..0bf8a1b386 100644 --- a/LiteEditor/manager.cpp +++ b/LiteEditor/manager.cpp @@ -530,7 +530,7 @@ wxFileName Manager::FindFile ( const wxArrayString& files, const wxFileName &fn for ( size_t i=0; i< files.GetCount(); i++ ) { wxFileName tmpFileName ( files.Item ( i ) ); - if ( tmpFileName == fn ) { + if ( tmpFileName.GetFullPath().CmpNoCase(fn.GetFullPath()) == 0 ) { wxFileName tt ( tmpFileName ); if ( tt.MakeAbsolute() ) { return tt; @@ -895,7 +895,8 @@ wxString Manager::GetProjectNameByFile ( const wxString &fullPathFileName ) proj->GetFiles ( files, true ); for ( size_t xx=0; xxGetName(); } } @@ -1922,7 +1923,7 @@ void Manager::DbgMarkDebuggerLine ( const wxString &fileName, int lineno ) //try to open the file wxFileName fn ( fileName ); LEditor *editor = Frame::Get()->GetMainBook()->GetActiveEditor(); - if ( editor && editor->GetFileName() == fn ) { + if ( editor && editor->GetFileName().GetFullPath().CmpNoCase(fn.GetFullPath()) == 0 ) { editor->HighlightLine ( lineno ); editor->GotoLine ( lineno-1 ); editor->EnsureVisible ( lineno-1 ); diff --git a/LiteEditor/outputtabwindow.cpp b/LiteEditor/outputtabwindow.cpp index 9ac2342663..59c308a990 100644 --- a/LiteEditor/outputtabwindow.cpp +++ b/LiteEditor/outputtabwindow.cpp @@ -98,6 +98,9 @@ void OutputTabWindow::InitStyle(wxScintilla *sci, int lexer, bool folding) sci->IndicatorSetUnder(1, true); sci->IndicatorSetUnder(2, true); + sci->IndicatorSetAlpha(1, 70); + sci->IndicatorSetAlpha(2, 70); + sci->SetHotspotActiveUnderline (true); sci->SetHotspotActiveForeground(true, wxT("BLUE")); diff --git a/LiteEditor/res/about_img.png b/LiteEditor/res/about_img.png index d3c1aebca5..6ad943086b 100644 Binary files a/LiteEditor/res/about_img.png and b/LiteEditor/res/about_img.png differ diff --git a/LiteEditor/res/conflict.png b/LiteEditor/res/conflict.png new file mode 100644 index 0000000000..7809ec268f Binary files /dev/null and b/LiteEditor/res/conflict.png differ diff --git a/LiteEditor/res/folder.png b/LiteEditor/res/folder.png index 3c2aa228e4..4fdde10f27 100644 Binary files a/LiteEditor/res/folder.png and b/LiteEditor/res/folder.png differ diff --git a/LiteEditor/res/folder_development.png b/LiteEditor/res/folder_development.png new file mode 100644 index 0000000000..7f3e89f537 Binary files /dev/null and b/LiteEditor/res/folder_development.png differ diff --git a/LiteEditor/res/folder_home.png b/LiteEditor/res/folder_home.png new file mode 100644 index 0000000000..223782439b Binary files /dev/null and b/LiteEditor/res/folder_home.png differ diff --git a/LiteEditor/res/mimetype/application_x_compressed_tar.png b/LiteEditor/res/mimetype/application_x_compressed_tar.png new file mode 100644 index 0000000000..a61d005051 Binary files /dev/null and b/LiteEditor/res/mimetype/application_x_compressed_tar.png differ diff --git a/LiteEditor/res/mimetype/application_x_ms_dos_executable.png b/LiteEditor/res/mimetype/application_x_ms_dos_executable.png new file mode 100644 index 0000000000..282117cf49 Binary files /dev/null and b/LiteEditor/res/mimetype/application_x_ms_dos_executable.png differ diff --git a/LiteEditor/res/mimetype/application_x_mswinurl.png b/LiteEditor/res/mimetype/application_x_mswinurl.png new file mode 100644 index 0000000000..cc2f1bf9f9 Binary files /dev/null and b/LiteEditor/res/mimetype/application_x_mswinurl.png differ diff --git a/LiteEditor/res/mimetype/application_x_php.png b/LiteEditor/res/mimetype/application_x_php.png new file mode 100644 index 0000000000..d73934befd Binary files /dev/null and b/LiteEditor/res/mimetype/application_x_php.png differ diff --git a/LiteEditor/res/mimetype/application_x_sharedlib.png b/LiteEditor/res/mimetype/application_x_sharedlib.png new file mode 100644 index 0000000000..0a90cf06b5 Binary files /dev/null and b/LiteEditor/res/mimetype/application_x_sharedlib.png differ diff --git a/LiteEditor/res/mimetype/formbuilder.png b/LiteEditor/res/mimetype/formbuilder.png new file mode 100644 index 0000000000..5cc3940828 Binary files /dev/null and b/LiteEditor/res/mimetype/formbuilder.png differ diff --git a/LiteEditor/res/mimetype/image_x_xpixmap.png b/LiteEditor/res/mimetype/image_x_xpixmap.png new file mode 100644 index 0000000000..8c7cbad8da Binary files /dev/null and b/LiteEditor/res/mimetype/image_x_xpixmap.png differ diff --git a/LiteEditor/res/mimetype/make.png b/LiteEditor/res/mimetype/make.png new file mode 100644 index 0000000000..a886401df0 Binary files /dev/null and b/LiteEditor/res/mimetype/make.png differ diff --git a/LiteEditor/res/mimetype/page_white_c.png b/LiteEditor/res/mimetype/page_white_c.png new file mode 100644 index 0000000000..c037ed9a62 Binary files /dev/null and b/LiteEditor/res/mimetype/page_white_c.png differ diff --git a/LiteEditor/res/mimetype/page_white_cplusplus.png b/LiteEditor/res/mimetype/page_white_cplusplus.png new file mode 100644 index 0000000000..7988e073ef Binary files /dev/null and b/LiteEditor/res/mimetype/page_white_cplusplus.png differ diff --git a/LiteEditor/res/mimetype/page_white_h.png b/LiteEditor/res/mimetype/page_white_h.png new file mode 100644 index 0000000000..da5e3da334 Binary files /dev/null and b/LiteEditor/res/mimetype/page_white_h.png differ diff --git a/LiteEditor/res/mimetype/page_white_text.png b/LiteEditor/res/mimetype/page_white_text.png new file mode 100644 index 0000000000..6d35fa24d1 Binary files /dev/null and b/LiteEditor/res/mimetype/page_white_text.png differ diff --git a/LiteEditor/res/mimetype/shellscript.png b/LiteEditor/res/mimetype/shellscript.png new file mode 100644 index 0000000000..890949b04a Binary files /dev/null and b/LiteEditor/res/mimetype/shellscript.png differ diff --git a/LiteEditor/res/mimetype/xml.png b/LiteEditor/res/mimetype/xml.png new file mode 100644 index 0000000000..208bf4370e Binary files /dev/null and b/LiteEditor/res/mimetype/xml.png differ diff --git a/LiteEditor/res/page_white_c.png b/LiteEditor/res/page_white_c.png index 34a05cccf0..c037ed9a62 100644 Binary files a/LiteEditor/res/page_white_c.png and b/LiteEditor/res/page_white_c.png differ diff --git a/LiteEditor/res/page_white_cplusplus.png b/LiteEditor/res/page_white_cplusplus.png index a87cf847cb..7988e073ef 100644 Binary files a/LiteEditor/res/page_white_cplusplus.png and b/LiteEditor/res/page_white_cplusplus.png differ diff --git a/LiteEditor/res/page_white_h.png b/LiteEditor/res/page_white_h.png index e902abb076..da5e3da334 100644 Binary files a/LiteEditor/res/page_white_h.png and b/LiteEditor/res/page_white_h.png differ diff --git a/LiteEditor/res/page_white_text.png b/LiteEditor/res/page_white_text.png index 4e62ebec97..6d35fa24d1 100644 Binary files a/LiteEditor/res/page_white_text.png and b/LiteEditor/res/page_white_text.png differ diff --git a/LiteEditor/res/wxfb.png b/LiteEditor/res/wxfb.png index 3f684b2347..5cc3940828 100644 Binary files a/LiteEditor/res/wxfb.png and b/LiteEditor/res/wxfb.png differ diff --git a/LiteEditor/resources.cpp b/LiteEditor/resources.cpp index 9a283252a1..b435544e1f 100644 --- a/LiteEditor/resources.cpp +++ b/LiteEditor/resources.cpp @@ -13,8 +13,8 @@ #include #include - #define XRC_ADD_FILE(name, data, size, mime) \ - wxMemoryFSHandler::AddFile(name, data, size) +#define XRC_ADD_FILE(name, data, size, mime) \ + wxMemoryFSHandler::AddFile(name, data, size) static size_t xml_res_size_0 = 3490; static unsigned char xml_res_file_0[] = { @@ -742,41 +742,9 @@ static unsigned char xml_res_file_7[] = { 248,207,127,171,84,42,29,188,215,214,113,209,212,220,252,248,119,239,39, 93,137,112,58,239,185,57,208,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_8 = 610; +static size_t xml_res_size_8 = 544; static unsigned char xml_res_file_8[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, -0,31,243,255,97,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, -68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,11,19,0, -0,11,19,1,0,154,156,24,0,0,0,7,116,73,77,69,7,216,9,22,10,41,48,37,211, -116,65,0,0,1,226,73,68,65,84,56,203,141,146,63,107,84,65,20,197,127,179, -59,134,196,196,213,20,145,176,137,152,168,177,81,92,86,66,26,177,177,80, -44,196,74,33,173,141,126,2,11,63,128,32,88,248,57,210,104,147,34,176,141, -160,224,31,130,16,221,160,104,34,232,139,132,16,37,174,236,123,111,254, -94,139,167,137,62,92,147,3,195,61,51,247,158,115,103,184,163,40,97,250, -222,59,105,78,214,112,33,226,131,224,130,224,162,208,53,158,133,91,199, -84,185,94,151,15,206,78,12,113,227,252,8,155,105,32,117,17,227,34,198,71, -50,27,104,223,89,146,228,238,25,245,95,3,93,81,28,236,19,82,43,84,4,250, -20,244,75,202,64,53,101,76,39,36,187,221,96,163,235,73,58,129,247,223,28, -131,90,49,26,151,153,81,215,232,63,96,184,60,11,92,31,21,34,16,161,179, -158,161,231,167,234,82,159,24,65,188,135,24,185,223,217,196,248,17,190, -166,129,213,60,176,209,121,195,133,75,13,180,174,131,95,129,192,246,18, -191,134,62,218,156,226,212,149,139,176,254,9,156,165,170,171,116,93,32, -181,129,204,6,172,143,16,143,128,28,6,42,160,170,160,10,138,50,104,53,80, -131,227,13,8,1,156,35,100,158,23,73,78,215,6,50,27,201,109,4,219,2,25,7, -179,8,106,26,212,9,176,159,33,125,142,150,100,21,62,182,97,249,37,140,159, -228,118,237,53,79,23,219,132,165,103,204,125,159,100,248,220,91,8,82,116, -116,91,224,91,224,90,224,139,103,104,178,31,96,12,36,43,240,161,77,195, -207,209,48,57,62,51,12,61,233,112,250,42,224,199,64,153,66,228,40,226,182, -65,8,96,13,88,91,68,103,11,67,107,1,152,185,137,218,122,181,38,251,7,191, -236,8,127,137,243,12,116,200,13,242,248,17,42,207,118,76,172,197,229,150, -16,139,209,30,106,162,64,248,23,20,192,195,225,125,197,108,137,16,35,68, -200,157,48,107,249,243,215,73,47,253,94,33,15,230,69,74,92,202,137,191, -146,229,216,131,247,20,176,7,46,189,186,238,106,252,123,255,19,225,90,82, -210,150,193,110,91,0,0,0,0,73,69,78,68,174,66,96,130}; - -static size_t xml_res_size_9 = 544; -static unsigned char xml_res_file_9[] = { -137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,1,231,73,68,65,84,56,141,165,83,177,106,84,81,16,61, 115,239,125,240,132,4,209,108,147,136,16,99,111,185,250,1,26,27,243,13, 150,65,72,99,225,159,248,3,66,216,47,48,85,126,192,50,85,138,88,88,134, @@ -804,8 +772,8 @@ static unsigned char xml_res_file_9[] = { 216,119,254,7,60,27,154,173,220,74,141,252,0,0,0,0,73,69,78,68,174,66,96, 130}; -static size_t xml_res_size_10 = 3376; -static unsigned char xml_res_file_10[] = { +static size_t xml_res_size_9 = 3376; +static unsigned char xml_res_file_9[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -971,8 +939,8 @@ static unsigned char xml_res_file_10[] = { 12,234,225,136,98,179,19,190,223,39,170,255,176,73,127,224,231,0,36,115, 89,158,5,126,136,96,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_11 = 3651; -static unsigned char xml_res_file_11[] = { +static size_t xml_res_size_10 = 3651; +static unsigned char xml_res_file_10[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -1152,8 +1120,8 @@ static unsigned char xml_res_file_11[] = { 163,255,99,219,213,79,12,195,240,125,61,126,169,167,38,24,252,254,239,1, 0,85,142,151,88,77,177,193,143,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_12 = 593; -static unsigned char xml_res_file_12[] = { +static size_t xml_res_size_11 = 593; +static unsigned char xml_res_file_11[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, 68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,11,19,0, @@ -1183,2359 +1151,2346 @@ static unsigned char xml_res_file_12[] = { 99,28,197,241,64,10,161,146,42,98,164,16,3,64,61,123,120,93,240,191,234, 23,207,55,164,65,190,27,85,130,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_13 = 47800; -static unsigned char xml_res_file_13[] = { +static size_t xml_res_size_12 = 47458; +static unsigned char xml_res_file_12[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,1,148,0,0,1,144,8,6,0, 0,0,137,84,150,182,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75, 71,68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,18,116, -0,0,18,116,1,222,102,31,120,0,0,0,7,116,73,77,69,7,216,10,1,5,27,31,226, -64,79,162,0,0,32,0,73,68,65,84,120,218,236,189,119,152,92,103,125,47,254, -153,57,211,251,108,215,22,105,119,213,37,100,89,238,114,193,21,28,76,113, -18,140,41,190,56,128,195,77,66,202,77,30,200,77,114,159,0,63,114,67,8,36, -23,48,9,221,64,192,198,6,27,91,182,133,109,217,178,44,89,182,122,245,170, -175,180,189,205,150,233,125,206,204,57,191,63,86,239,241,59,103,206,153, -153,93,205,174,141,243,253,60,207,60,43,237,204,206,105,239,251,253,124, -251,215,32,203,178,12,2,129,64,32,16,46,17,70,186,5,4,2,129,64,32,66,33, -16,8,4,2,17,10,129,64,32,16,136,80,8,4,2,129,64,32,66,33,16,8,4,2,17,10, -129,64,32,16,136,80,8,4,2,129,64,132,66,32,16,8,4,2,17,10,129,64,32,16, -136,80,8,4,2,129,64,132,66,32,16,8,4,34,20,2,129,64,32,16,136,80,8,4,2, -129,64,132,66,32,16,8,4,34,20,2,129,64,32,16,136,80,8,4,2,129,64,132,66, -32,16,8,4,34,20,2,129,64,32,16,161,16,8,4,2,129,64,132,66,32,16,8,4,34, -20,2,129,64,32,16,161,16,8,4,2,129,8,133,64,32,16,8,4,34,20,2,129,64,32, -16,161,16,8,4,2,129,8,133,64,32,16,8,68,40,4,2,129,64,32,16,161,16,8,4, -2,129,8,133,64,32,16,8,68,40,4,2,129,64,32,16,161,16,8,4,2,129,8,133,64, -32,16,8,68,40,4,2,129,64,32,66,33,16,8,4,2,129,8,133,64,32,16,8,68,40,4, -2,129,64,32,66,33,16,8,4,2,17,10,129,64,32,16,8,68,40,4,2,129,64,32,66, -33,16,8,4,2,17,10,129,64,32,16,136,80,8,4,2,129,64,32,66,33,16,8,4,2,17, -10,129,64,32,16,136,80,8,4,2,129,64,32,66,33,16,8,4,2,17,10,129,64,32,16, -136,80,8,4,2,129,64,132,66,32,16,8,4,2,17,10,129,64,32,16,136,80,8,4,2, -129,64,132,66,32,16,8,4,34,20,2,129,64,32,16,136,80,8,4,2,129,64,132,66, -32,16,8,4,34,20,2,129,64,32,16,161,16,8,4,2,129,64,132,66,32,16,8,4,34, -20,2,129,64,32,16,161,16,8,4,2,129,64,132,66,32,16,8,4,34,20,2,129,64,32, -16,161,16,8,4,2,129,8,133,64,32,16,8,4,34,20,2,129,64,32,16,161,16,8,4, -2,129,8,133,64,32,16,8,68,40,4,2,129,64,32,16,161,16,8,4,2,129,8,133,64, -32,16,8,68,40,4,2,129,64,32,66,33,16,8,4,2,129,8,133,64,32,16,8,68,40,4, -2,129,64,32,66,33,16,8,4,2,129,8,133,64,32,16,8,68,40,4,2,129,64,32,66, -33,16,8,4,2,17,10,129,64,32,16,8,68,40,4,2,129,64,32,66,33,16,8,4,2,17, -10,129,64,32,16,136,80,8,4,2,129,64,32,66,33,16,8,4,2,17,10,129,64,32,16, -136,80,8,4,2,129,64,132,66,183,128,64,32,16,8,68,40,4,2,129,64,32,66,33, -16,8,4,2,17,10,129,64,32,16,8,68,40,4,2,129,64,32,66,33,16,8,4,2,17,10, -129,64,32,16,136,80,8,4,2,129,64,32,66,33,16,8,4,2,17,10,129,64,32,16,136, -80,8,4,2,129,64,132,66,32,16,8,4,2,17,10,129,64,32,16,136,80,8,4,2,129, -64,132,66,32,16,8,4,2,17,10,129,64,32,16,136,80,8,4,2,129,64,132,66,32, -16,8,4,34,20,2,129,64,32,16,136,80,8,4,2,129,64,132,66,32,16,8,4,34,20, -2,129,64,32,16,161,16,8,4,2,129,64,132,66,32,16,8,4,34,20,2,129,64,32,16, -161,16,8,4,2,129,8,133,64,32,16,8,4,34,20,2,129,64,32,16,161,16,8,4,2,129, -8,133,64,32,16,8,4,0,128,137,110,193,127,95,136,162,136,29,59,118,224,201, -39,159,68,58,149,194,170,213,171,113,207,61,247,96,229,202,149,48,26,141, -16,4,129,110,18,129,64,32,66,121,187,97,98,98,2,178,44,3,178,12,0,104,110, -105,153,147,192,46,20,10,200,100,50,176,88,44,151,44,236,143,30,57,130, -71,31,125,20,129,64,160,232,247,189,231,206,33,24,12,194,231,243,193,96, -48,192,104,52,194,110,183,195,110,183,195,108,54,211,67,36,16,8,101,97, -144,229,139,18,142,80,21,166,167,167,17,10,133,144,74,38,49,61,61,141,233, -233,105,12,13,15,35,30,139,97,100,100,164,38,199,232,232,232,64,67,99,35, -86,173,92,9,159,223,143,182,182,54,116,119,119,107,146,76,44,22,131,32, -8,176,88,44,16,4,65,151,108,68,81,196,195,15,63,140,87,118,236,208,60,166, -213,106,197,7,62,248,65,172,91,183,78,33,19,65,16,96,50,153,96,54,155,225, -112,56,224,241,120,104,1,16,8,4,34,148,106,17,14,135,49,50,50,130,64,32, -128,224,204,12,70,70,71,113,190,183,23,233,116,250,109,113,126,118,187, -29,27,54,108,192,234,213,171,177,124,249,114,172,88,185,178,236,231,143, -29,61,138,173,91,183,162,183,183,87,247,51,183,222,118,27,214,172,89,3, -139,197,2,89,150,97,48,24,20,50,177,88,44,176,88,44,176,90,173,10,169,252, -174,185,194,100,73,68,62,57,10,20,146,144,114,145,217,133,111,52,3,38,15, -96,246,193,226,92,2,0,200,100,50,136,70,163,202,53,11,130,0,179,217,76, -174,63,2,129,8,165,50,6,7,7,49,58,58,138,179,103,206,224,200,145,35,136, -199,227,191,179,215,210,209,209,129,213,107,214,224,178,13,27,96,177,90, -177,119,239,94,236,217,179,7,133,124,190,226,223,254,197,95,254,37,4,65, -64,48,24,4,0,24,141,70,133,76,172,86,43,236,118,59,108,54,27,172,86,43, -234,234,234,224,116,58,223,246,247,35,159,26,69,97,226,25,32,121,186,170, -207,75,150,165,144,189,155,97,112,173,66,52,81,64,78,44,20,89,105,14,135, -227,119,226,186,231,10,113,102,79,49,249,94,20,7,133,244,36,178,142,107, -224,244,182,40,107,98,49,136,149,63,31,118,46,178,12,200,82,26,121,217, -2,131,231,42,8,130,160,144,253,165,34,219,243,231,250,231,210,248,49,136, -182,119,1,128,226,5,32,5,131,8,69,193,240,240,48,78,159,62,141,151,183, -111,47,137,31,252,119,199,109,183,223,142,155,111,190,25,211,211,211,24, -30,30,134,209,104,132,205,102,131,221,110,135,219,237,70,123,123,59,90, -91,91,149,207,247,245,245,33,157,78,195,96,48,96,205,154,53,111,155,77, -150,143,247,33,63,242,51,24,242,225,249,127,135,99,19,242,254,247,34,48, -147,86,200,149,119,253,57,157,206,119,140,80,41,39,80,163,117,127,1,209, -224,81,92,160,188,114,241,86,156,143,232,190,9,17,243,141,69,4,103,183, -219,47,233,121,148,59,94,202,251,97,196,176,92,217,7,188,213,74,208,198, -59,62,40,127,244,200,17,236,220,181,11,39,122,122,144,175,66,91,255,239, -138,87,118,236,192,43,59,118,224,186,235,174,195,205,183,220,130,100,50, -137,68,34,129,238,238,110,44,93,186,20,178,44,227,212,169,83,248,205,19, -79,224,252,249,243,69,127,251,192,3,15,96,221,250,245,69,66,231,173,216, -116,217,190,7,129,100,47,12,151,186,41,82,199,96,74,29,67,139,247,67,24, -141,53,32,37,205,146,137,197,98,65,46,151,67,42,149,130,219,237,126,71, -90,44,60,50,217,44,50,133,164,66,40,217,108,22,233,116,26,118,187,253,45, -113,125,22,10,50,226,153,184,114,62,38,147,73,121,30,62,159,175,230,68, -39,230,11,72,100,18,88,182,108,25,164,130,136,92,106,10,5,17,144,178,6, -24,46,46,178,66,46,142,92,38,5,147,103,21,185,72,223,169,132,114,244,200, -17,188,190,103,15,14,30,56,240,150,159,75,67,99,35,172,22,11,124,126,191, -18,155,176,219,108,80,86,36,191,128,69,17,233,84,10,209,104,20,19,129,0, -164,66,97,209,207,119,255,254,253,216,191,127,63,218,218,218,240,137,251, -238,131,213,106,197,43,175,188,130,199,127,253,107,221,56,210,200,232,40, -150,117,118,66,16,4,100,179,89,36,147,73,216,108,182,69,21,58,217,83,127, -15,20,106,235,178,180,69,159,197,50,235,122,244,37,54,32,146,20,96,179, -217,20,215,95,62,159,71,42,149,66,93,93,221,59,86,128,36,19,73,36,197,60, -12,6,131,98,161,89,173,86,72,146,4,0,240,251,253,139,75,40,146,132,88,44, -166,236,35,118,62,86,171,21,225,112,24,126,191,191,166,164,146,19,243,136, -197,98,40,20,10,72,13,63,9,75,252,53,229,61,230,214,49,2,48,186,110,68, -40,223,160,88,77,139,97,201,17,161,44,48,6,7,7,177,245,217,103,113,96,129, -73,164,101,201,18,248,124,62,88,45,22,184,220,110,24,141,70,24,141,70,228, -243,121,228,114,57,100,50,25,228,243,121,68,34,17,72,146,4,89,150,145,19, -69,76,77,77,129,247,46,26,46,18,10,255,147,127,117,116,116,192,227,241, -192,229,114,193,100,50,65,150,101,164,211,105,140,141,141,33,48,49,177, -224,247,115,108,108,12,255,246,141,111,84,252,220,138,21,43,208,217,217, -137,120,60,94,228,26,42,20,10,200,231,243,240,249,124,11,110,173,44,4,153, -48,152,179,167,208,109,143,224,141,248,70,132,211,179,174,15,135,195,129, -124,62,143,66,161,128,66,161,128,250,250,250,119,164,27,36,145,76,34,154, -122,211,237,199,136,148,17,138,32,8,139,154,249,151,207,23,16,14,135,21, -130,99,130,187,80,40,64,150,101,68,34,145,154,62,139,92,86,68,52,26,69, -38,147,65,185,200,64,94,146,17,143,199,149,216,78,38,147,65,42,149,130, -197,98,89,148,245,79,132,82,67,28,60,120,16,143,60,242,8,66,23,3,202,181, -64,91,91,27,154,91,90,96,183,217,96,182,88,144,207,231,145,205,102,49,51, -51,131,116,58,141,80,40,4,73,146,20,194,96,63,213,47,0,154,11,81,143,68, -216,139,185,23,146,201,164,230,123,27,46,187,12,62,159,15,217,108,22,195, -195,195,139,66,48,106,92,183,121,51,218,218,218,224,116,58,145,207,231, -17,141,70,21,183,16,211,98,217,38,95,72,45,62,115,246,43,48,20,22,54,153, -194,146,31,195,218,230,102,188,114,194,5,135,211,133,92,46,7,81,20,81,40, -20,32,73,18,130,193,224,59,146,84,226,241,36,194,177,60,140,70,35,44,22, -11,236,118,187,66,38,70,163,17,201,100,114,81,221,155,98,94,70,40,20,130, -193,96,128,197,98,129,205,102,67,62,159,47,202,76,76,36,18,53,179,156,178, -98,30,209,104,26,137,68,2,150,139,215,173,105,57,229,101,37,125,159,207, -140,100,10,199,66,184,227,136,80,106,185,176,68,17,207,62,243,12,182,108, -217,114,201,223,101,181,90,209,213,221,141,250,186,58,24,140,70,4,131,65, -68,163,81,140,141,141,193,96,48,192,239,247,195,225,112,160,174,174,14, -203,151,47,135,203,229,82,124,200,0,224,112,56,224,112,56,116,54,100,28, -153,76,6,192,108,58,114,161,80,64,52,26,69,44,22,67,50,153,68,56,28,70, -52,26,69,52,26,69,62,159,87,8,131,109,16,173,87,161,80,192,228,228,36,166, -166,166,148,227,92,121,213,85,176,219,108,232,235,235,195,196,2,147,139, -211,229,194,77,55,221,132,124,62,143,100,50,137,108,54,91,180,137,248,77, -206,11,158,133,208,100,115,19,219,96,200,77,85,252,156,4,43,198,179,235, -48,26,52,226,194,96,4,201,116,22,14,155,9,43,151,249,176,162,37,131,6,211, -217,138,223,225,18,143,226,178,174,27,113,240,108,8,185,92,78,209,212,217, -117,190,19,73,37,145,72,32,18,201,40,177,49,22,131,100,22,139,217,108,174, -169,0,175,232,242,42,72,138,133,194,210,216,37,73,42,58,159,76,38,3,81, -20,171,126,14,146,115,163,162,0,22,100,160,32,201,144,37,25,146,36,35,154, -200,35,30,143,95,84,28,202,88,78,133,89,203,137,119,195,177,125,192,172, -167,90,187,227,136,80,106,128,64,32,128,167,183,108,193,235,175,191,126, -73,223,179,124,249,114,180,119,116,32,47,138,24,27,31,71,38,147,65,54,151, -131,221,110,199,166,77,155,176,100,201,18,180,183,183,163,177,177,17,162, -40,34,22,139,33,147,201,32,30,143,35,153,76,34,149,74,97,108,108,12,169, -84,106,86,75,206,100,116,227,11,14,135,3,86,171,21,0,224,118,187,225,241, -120,208,220,220,172,248,88,157,78,167,242,153,169,169,41,68,34,17,76,76, -76,32,24,12,98,96,96,64,209,200,120,203,134,135,44,203,24,29,29,85,44,165, -171,174,190,26,249,124,30,199,143,29,91,24,109,253,162,59,107,106,106,10, -102,179,185,200,42,177,219,237,69,26,35,243,41,51,243,191,214,27,74,158, -126,161,226,103,38,114,155,240,212,171,65,4,38,123,21,97,195,54,250,158, -131,179,130,228,214,27,55,226,174,171,101,120,12,125,101,191,171,213,122, -2,217,76,155,98,157,168,93,152,161,80,8,13,13,13,239,152,152,74,34,153, -66,36,50,171,121,219,108,54,69,120,51,161,41,138,226,156,5,248,165,89,40, -179,130,155,39,56,131,193,80,180,6,153,235,185,218,243,17,27,63,134,104, -52,138,68,34,129,120,60,174,40,124,137,68,2,233,244,172,242,48,251,172, -203,16,138,40,33,20,10,41,138,149,205,102,43,89,35,11,17,227,33,66,153, -39,98,177,24,254,243,63,255,19,167,79,157,154,215,223,27,5,1,27,54,108, -128,223,239,71,56,28,134,40,138,176,88,44,232,234,234,194,31,126,248,195, -104,104,104,128,40,138,136,68,34,72,167,211,152,153,153,193,177,99,199, -48,49,49,129,153,153,153,69,187,78,65,16,208,222,222,14,167,211,137,174, -174,46,172,92,185,18,162,40,98,104,104,8,67,67,67,72,38,147,37,100,194, -136,132,189,134,134,134,144,207,231,241,174,13,27,224,116,58,113,248,240, -225,170,106,81,170,69,56,28,198,217,179,103,113,213,85,87,225,240,225,195, -74,80,212,110,183,35,151,203,65,146,164,162,160,169,215,235,85,172,181, -90,166,92,102,251,127,4,160,252,117,189,17,186,22,79,191,116,22,169,84, -10,233,116,90,17,14,204,178,96,4,253,242,171,71,113,230,124,51,254,215, -39,54,160,206,112,66,159,76,17,197,101,43,86,225,181,163,65,197,245,195, -19,167,32,8,136,197,98,139,30,172,158,179,155,48,147,65,161,80,168,152, -165,150,72,38,21,87,142,40,138,69,174,38,187,221,14,81,20,33,138,34,140, -198,197,233,49,91,40,204,186,150,88,74,59,0,152,76,38,216,108,182,34,55, -100,46,151,171,58,3,143,9,125,73,146,20,23,85,62,159,135,40,138,200,229, -114,202,154,150,164,242,49,20,158,80,216,189,97,223,205,72,37,20,10,193, -229,114,189,163,210,206,127,167,8,37,22,139,225,7,63,248,1,122,222,120, -99,94,36,114,245,213,87,195,97,183,35,155,203,161,177,177,17,43,87,174, -68,87,87,23,188,94,47,98,177,24,166,166,166,48,56,56,136,237,219,183,99, -122,122,90,17,18,111,5,156,78,39,76,38,19,34,145,8,34,145,8,66,161,80,81, -48,180,187,187,27,211,211,211,69,164,194,147,137,122,51,4,2,1,228,114,57, -172,92,185,18,38,65,192,201,147,39,107,118,174,35,195,195,72,36,18,248, -216,199,62,134,51,103,206,96,96,96,64,217,120,118,187,29,77,77,77,88,182, -108,25,234,235,235,21,205,125,106,106,10,146,36,193,235,245,214,70,75,75, -148,95,19,163,153,77,120,106,219,105,36,18,9,164,82,41,78,211,124,211,122, -98,196,103,48,24,48,57,21,196,182,35,107,240,161,43,151,193,101,24,210, -253,222,118,239,172,155,146,239,38,160,126,149,8,156,244,52,100,49,2,136, -81,72,133,12,12,6,35,100,147,15,70,179,11,102,215,82,0,64,50,153,68,46, -151,83,136,137,21,209,205,7,249,196,32,228,124,12,178,24,3,140,54,24,204, -62,24,172,77,48,154,157,152,156,156,82,132,92,37,161,155,201,100,145,72, -36,148,164,16,179,217,12,187,221,142,108,54,11,131,193,128,230,230,230, -34,242,20,83,19,64,118,26,146,24,187,72,182,70,192,236,135,209,209,6,147, -101,214,229,57,57,57,169,212,115,240,66,221,98,177,84,60,159,130,36,33, -145,72,192,104,52,162,80,40,40,150,83,54,155,85,220,144,140,80,170,133, -223,239,215,84,0,182,111,223,142,83,167,78,149,88,162,90,48,59,154,241, -167,127,250,63,20,98,157,11,89,48,66,174,246,111,242,169,0,228,236,84,213, -247,120,177,139,49,223,182,132,242,31,223,249,206,188,50,182,214,173,91, -135,150,37,75,224,116,58,177,124,249,114,44,95,190,28,126,191,31,145,72, -4,129,64,0,135,14,29,194,224,224,32,162,209,232,130,158,191,209,104,132, -195,225,128,205,102,131,201,100,130,32,8,111,250,106,47,54,122,100,27,33, -30,143,35,145,72,40,194,132,189,216,66,227,133,31,211,248,21,31,48,71,40, -140,76,68,81,68,54,155,69,54,155,197,228,228,36,50,153,12,110,188,233,38, -188,113,252,120,205,186,1,132,67,33,124,255,123,223,195,109,183,223,142, -79,125,234,83,88,182,108,25,44,22,139,162,1,143,142,142,98,215,174,93,216, -254,210,75,138,59,240,129,7,30,192,154,181,107,149,202,115,155,205,54,175, -133,158,155,46,239,242,140,203,75,241,139,223,14,34,22,139,33,149,74,33, -155,205,162,112,49,5,155,39,1,179,217,12,147,201,164,8,130,195,71,142,225, -246,91,254,28,174,196,119,245,5,144,48,0,147,224,65,34,145,40,113,249,49, -55,41,0,100,131,71,33,207,108,135,33,59,92,234,170,99,207,14,64,22,128, -36,248,97,168,123,15,4,235,10,132,195,121,37,115,144,165,160,186,92,174, -138,228,146,79,12,162,16,120,10,72,245,233,30,79,116,108,128,219,127,11, -38,195,2,228,42,170,117,50,153,44,82,169,20,204,102,179,18,183,200,229, -114,88,177,98,5,214,173,91,7,0,72,205,28,135,33,244,50,140,153,1,221,227, -22,46,190,36,91,23,220,245,119,33,154,241,33,155,205,41,235,154,145,85, -37,66,145,36,9,233,116,90,249,59,118,62,188,27,147,143,107,85,101,173,157, -255,38,100,89,2,235,219,58,187,71,129,107,90,68,56,141,203,176,251,80,229, -254,124,222,236,171,72,156,57,9,118,75,13,134,217,127,206,42,46,179,191, -48,224,205,74,1,197,115,45,3,178,224,64,196,241,251,69,207,91,237,30,22, -195,61,40,204,188,12,67,186,175,170,123,236,105,248,0,34,25,15,114,57,81, -145,31,172,40,119,190,123,238,119,150,80,182,109,219,134,95,61,246,216, -156,138,16,173,86,43,174,184,226,10,52,55,55,99,233,178,101,88,181,106, -21,60,30,15,38,38,38,208,211,211,131,254,254,126,132,66,161,154,156,31, -11,202,179,135,194,8,130,9,174,120,60,142,64,32,80,164,121,168,127,50,161, -198,55,95,228,255,207,255,228,201,133,189,88,128,158,183,82,212,166,58, -35,148,116,58,141,116,58,141,158,158,30,212,213,215,163,163,163,3,167,79, -159,174,217,243,98,5,145,213,146,44,19,80,162,40,42,5,130,115,181,88,164, -233,109,101,197,225,27,35,13,8,134,70,144,74,165,148,52,110,150,106,202, -132,63,123,49,237,205,96,48,64,146,36,156,60,59,8,111,71,19,108,178,118, -176,223,104,40,96,73,147,7,253,195,97,37,248,42,73,18,54,111,222,124,81, -192,190,1,67,224,49,24,165,120,213,5,150,198,66,24,152,126,28,70,152,80, -223,244,113,76,39,253,200,138,50,76,38,19,178,217,172,18,131,210,187,87, -217,254,31,85,180,216,0,192,152,58,1,99,234,4,26,189,239,195,72,172,173, -50,113,95,92,71,146,36,41,196,251,193,15,126,16,45,45,45,136,4,122,96,155, -250,9,4,84,191,79,141,153,1,96,236,187,240,216,214,34,110,189,17,51,49, -147,178,158,237,118,123,229,231,46,205,158,19,179,220,153,242,196,18,36, -248,108,75,102,193,84,130,33,221,167,251,156,44,166,206,170,220,121,102, -67,2,102,36,222,148,238,60,159,85,40,37,43,152,90,145,148,147,138,108,200, -102,179,104,111,111,159,189,255,145,51,144,135,127,0,32,95,253,90,202,12, -0,163,255,1,175,181,11,9,199,157,152,137,9,69,9,11,102,179,121,65,139,114, -223,54,132,114,234,212,41,124,251,219,223,70,250,98,160,187,26,172,95,183, -14,173,237,237,240,249,124,184,250,234,171,209,218,218,138,201,201,73,156, -58,117,10,189,189,189,243,38,17,118,211,45,22,139,34,248,166,167,167,49, -49,49,161,164,242,178,141,160,245,147,5,13,121,77,83,253,226,137,67,235, -197,191,167,101,185,48,82,225,227,40,106,11,133,37,11,164,211,105,216,108, -54,36,147,73,68,163,81,220,118,251,237,85,147,64,173,112,217,198,141,112, -56,157,72,38,147,138,86,159,207,231,145,207,231,225,241,120,230,180,192, -203,181,85,73,201,45,120,110,199,137,34,50,97,150,137,197,98,81,178,242, -88,91,126,139,197,2,147,201,244,38,161,156,60,137,37,174,101,104,114,249, -32,201,128,36,203,128,244,166,140,48,0,240,184,140,10,113,155,76,38,124, -224,3,31,152,245,194,93,248,41,204,169,35,243,190,71,6,228,97,158,122,24, -141,150,78,76,201,55,33,28,53,43,217,115,172,74,159,93,3,187,95,153,243, -223,212,212,92,203,42,96,209,23,208,230,188,17,192,166,10,238,152,217,0, -183,44,203,112,56,28,184,247,222,123,209,208,80,143,72,239,207,225,200, -30,154,191,208,201,156,129,47,115,30,57,219,135,49,22,52,43,153,141,146, -84,94,250,202,23,93,68,130,32,40,107,135,89,37,234,212,253,223,21,72,50, -148,56,149,217,108,198,250,245,235,1,0,233,193,135,97,140,237,159,247,247, -10,217,1,120,178,15,65,116,124,24,227,97,187,146,72,193,100,90,34,145,64, -93,93,93,205,147,41,222,22,132,242,208,143,127,140,93,187,118,85,29,27, -217,188,121,51,156,78,39,150,46,93,138,203,46,187,12,30,143,7,67,67,67, -120,252,241,199,231,213,66,158,221,216,116,58,141,193,193,65,12,12,12,40, -25,45,234,23,155,71,162,38,16,254,223,60,145,240,63,121,114,208,35,20,102, -173,148,35,23,246,157,124,214,151,150,149,146,201,100,148,34,43,38,72,19, -137,4,142,29,59,134,15,126,232,67,120,254,249,231,107,26,176,215,195,242, -139,46,146,68,34,129,92,46,167,100,227,176,238,198,177,88,76,137,35,85, -244,57,39,134,202,190,63,20,109,69,34,57,162,144,9,211,174,153,32,118,187, -221,112,185,92,112,185,92,74,118,29,115,233,72,146,4,81,20,177,255,84,26, -169,212,108,37,124,50,153,68,58,157,70,54,155,85,44,29,22,120,53,26,141, -184,243,206,59,103,221,108,103,190,13,139,120,190,38,247,203,156,27,68, -179,33,140,132,124,59,34,17,139,98,9,49,171,74,113,171,13,61,50,103,50, -97,176,39,95,71,240,130,13,174,114,247,250,98,198,148,193,96,192,221,119, -223,141,101,203,150,34,216,251,43,120,197,67,151,124,141,6,228,209,148, -125,6,211,242,29,152,14,207,238,157,66,94,44,79,40,146,172,40,8,60,145, -168,9,165,150,80,190,111,161,56,74,150,17,14,135,97,50,153,176,106,213, -170,89,197,100,240,215,48,95,2,153,240,247,184,62,253,44,194,134,247,96, -38,98,85,58,61,216,108,54,20,10,5,204,204,204,212,60,243,236,45,37,148, -83,167,78,225,223,190,241,141,170,220,91,70,65,192,245,215,95,15,139,197, -130,246,246,118,220,116,211,77,48,26,141,56,115,230,12,122,122,122,48,61, -61,61,39,11,196,239,247,35,22,139,225,220,185,115,120,237,181,215,74,226, -22,252,32,43,53,65,148,35,17,61,50,153,139,117,82,238,165,101,169,104,185, -190,88,134,10,179,82,24,169,48,205,252,240,225,195,120,255,93,119,225,185, -26,147,138,213,106,197,242,21,43,224,114,185,32,8,2,156,78,39,12,6,3,226, -241,56,242,249,188,146,82,201,132,61,179,180,82,169,84,85,254,93,57,209, -91,246,253,222,161,164,146,202,202,167,185,218,237,118,184,92,46,120,60, -30,120,189,94,197,236,183,217,108,37,132,146,201,100,148,180,110,102,29, -100,50,25,69,91,103,218,228,45,183,220,130,230,230,38,132,122,127,1,103, -141,200,68,217,152,114,20,93,246,195,216,55,179,6,169,148,77,121,118,236, -121,167,103,122,96,140,238,187,52,247,109,234,229,138,46,47,81,20,177,98, -197,10,220,124,243,205,152,232,123,13,141,226,190,154,93,163,65,206,160, -219,123,30,131,99,141,23,45,214,92,217,153,228,242,69,34,97,207,74,171, -160,152,223,11,151,26,43,96,251,105,246,123,23,134,81,36,25,136,68,34,240, -249,124,179,174,196,177,125,176,199,118,215,240,30,167,209,97,127,3,131, -227,43,148,117,196,58,61,176,251,87,87,87,87,51,82,121,203,8,165,90,171, -132,17,137,199,227,65,103,103,39,54,109,218,4,147,201,164,16,65,170,74, -23,153,209,104,68,125,125,61,130,193,32,118,239,222,141,108,54,91,148,81, -163,37,240,213,36,163,38,9,61,162,41,71,38,122,196,162,71,48,90,191,215, -114,125,177,13,192,54,129,218,245,197,22,18,19,76,54,155,13,39,78,158,196, -39,63,249,73,60,252,240,195,53,35,149,107,174,189,22,123,246,236,129,219, -237,86,132,182,211,233,84,210,138,89,54,14,95,221,204,174,145,185,51,202, -110,192,196,233,242,241,147,211,35,74,202,38,0,37,75,142,89,39,94,175,23, -62,159,79,113,179,49,66,49,26,141,37,132,194,92,4,86,171,85,201,20,99,86, -74,125,125,61,174,188,242,74,4,71,143,194,155,169,156,60,146,69,19,18,82, -11,50,121,19,4,99,1,46,33,10,39,70,97,48,232,223,119,75,97,24,235,91,219, -176,251,212,172,251,206,233,116,42,254,117,67,224,23,21,143,153,135,3,41, -180,33,145,115,2,50,224,182,68,225,54,12,84,47,236,46,174,163,143,127,252, -227,8,5,167,209,144,222,130,114,55,191,0,39,38,243,27,48,30,50,32,153,46, -160,206,13,44,173,79,194,43,235,167,251,59,10,231,176,188,181,30,131,211, -49,20,242,133,178,132,130,10,93,41,138,44,138,26,160,32,73,138,18,81,238, -91,199,83,221,56,112,86,86,20,24,131,1,48,155,77,48,155,76,48,91,4,152, -5,1,102,179,9,70,227,236,122,55,94,92,247,48,0,5,201,128,72,36,130,203, -47,191,28,153,116,18,182,224,175,202,63,19,88,49,45,93,142,177,144,9,241, -164,136,58,55,208,86,151,70,29,244,211,221,109,133,33,172,106,93,138,131, -103,103,227,188,11,89,35,179,232,132,210,219,219,139,127,249,234,87,171, -178,74,174,186,234,42,248,252,126,116,119,119,99,243,230,205,200,229,114, -56,125,250,52,14,30,60,88,53,145,52,52,52,32,149,74,225,240,225,195,8,4, -2,138,128,87,7,194,181,132,183,154,92,88,96,82,47,19,75,203,154,169,68, -46,106,242,42,23,156,215,11,212,243,86,10,11,72,242,150,10,179,74,216,139, -111,114,216,211,211,131,251,239,191,31,63,251,233,79,107,242,124,79,244, -244,160,185,185,25,227,227,227,69,185,252,124,13,136,214,0,47,233,226,230, -173,184,168,51,250,46,205,100,161,1,99,19,67,10,97,177,99,216,108,179,154, -153,203,229,82,138,75,189,94,111,137,133,34,203,178,210,102,135,89,39,204, -221,196,210,101,69,113,214,45,115,253,245,215,3,178,4,103,236,153,178,167, -27,199,42,28,27,174,195,177,211,19,200,100,38,139,234,37,58,90,155,241, -135,119,44,67,19,246,234,175,95,236,131,219,122,53,166,67,179,89,129,126, -191,31,177,209,221,176,74,229,7,190,141,228,174,193,182,189,65,76,205,132, -144,203,5,20,141,116,237,202,46,124,240,70,31,252,114,229,194,215,156,152, -71,75,75,11,54,110,220,136,145,19,191,132,167,12,249,165,208,137,231,143, -121,48,26,24,87,44,68,118,157,247,127,236,131,88,101,126,65,151,60,59,93, -23,112,114,96,249,108,65,98,5,11,101,33,221,91,37,132,114,49,27,115,246, -120,250,159,11,39,109,248,254,207,30,87,172,39,179,217,172,172,57,86,184, -204,246,27,239,210,230,215,103,103,103,39,194,67,187,224,41,147,228,144, -50,116,98,219,113,31,134,199,39,148,12,81,118,143,63,250,7,119,97,173,107, -55,204,134,132,230,223,46,177,156,68,46,211,86,212,229,1,120,179,253,19, -107,157,116,169,86,221,162,18,202,207,127,254,115,108,127,233,165,138,159, -107,89,178,4,151,95,126,57,36,73,194,123,222,243,30,52,55,55,227,228,201, -147,216,181,107,151,178,161,203,193,233,116,194,106,181,226,216,177,99, -216,177,99,135,34,120,217,13,211,139,93,176,135,173,21,199,40,151,125,165, -22,240,229,44,24,61,34,210,122,85,122,79,77,40,188,185,207,130,244,44,8, -199,103,54,241,175,104,52,170,88,19,181,72,41,142,68,34,232,234,238,198, -233,211,167,139,26,40,242,245,31,44,64,168,78,245,44,84,209,93,217,80,70, -144,230,100,151,226,234,226,3,241,252,230,102,215,202,10,204,180,8,133, -89,38,234,46,0,188,43,109,237,218,181,72,204,156,134,91,142,232,158,79, -84,94,141,95,237,42,32,18,29,80,226,48,124,15,176,211,231,226,232,237,27, -195,223,254,233,239,97,137,188,77,247,123,214,181,139,216,50,16,67,125, -125,253,236,125,139,190,82,246,30,157,140,92,135,173,175,244,33,153,44, -118,255,201,178,140,67,199,122,49,48,92,135,63,191,239,122,52,72,123,203, -91,56,249,60,174,184,226,74,4,103,166,209,36,235,127,54,35,215,225,233, -131,54,12,140,140,149,8,58,73,146,240,189,135,158,198,223,254,229,199,209, -94,120,92,59,158,99,152,66,131,119,85,197,58,48,89,70,9,153,44,36,169,228, -11,178,82,4,90,238,56,146,252,102,29,24,91,227,234,52,126,22,243,228,93, -211,44,174,186,102,205,26,0,50,92,201,109,101,44,220,58,108,61,236,64,255, -208,152,82,114,192,223,227,135,126,241,44,62,255,87,127,132,101,133,95, -106,91,187,8,99,69,251,114,28,58,21,42,217,143,76,166,212,162,69,210,162, -16,138,40,138,248,210,23,191,88,85,192,252,230,91,110,65,46,151,67,103, -103,39,54,111,222,140,72,36,130,39,159,124,18,195,195,195,101,255,206,237, -118,195,108,54,35,16,8,96,223,190,125,200,100,50,69,36,194,79,223,227,73, -131,9,14,38,60,216,191,121,130,41,23,199,208,115,131,149,123,233,125,182, -18,17,105,253,13,223,231,139,183,82,100,121,54,237,180,80,40,20,93,15,179, -8,248,235,27,24,24,192,71,238,189,23,63,253,201,79,106,242,188,143,29,61, -138,101,203,150,97,96,96,160,168,167,23,115,63,241,49,148,90,102,230,100, -11,230,18,43,136,145,23,235,18,172,229,250,99,150,39,35,53,81,20,139,214, -9,251,123,182,137,89,12,198,48,186,179,172,107,226,201,215,11,152,154,14, -150,144,9,187,86,22,11,216,219,19,197,123,55,116,195,141,126,205,239,106, -180,156,71,44,58,91,143,18,14,77,193,81,208,143,23,134,164,85,120,234,197, -179,74,50,1,95,208,201,214,204,212,244,12,6,35,29,112,187,188,176,26,163, -101,3,210,155,54,109,66,100,102,184,108,240,254,141,137,46,156,238,61,83, -82,96,200,63,211,131,61,99,112,173,127,23,124,208,46,176,93,82,87,64,161, -80,161,176,88,94,100,11,37,159,87,58,13,87,58,148,94,19,88,131,193,128, -235,175,191,190,200,35,194,246,173,40,138,56,119,238,28,154,155,155,17, -154,28,132,23,250,202,82,79,160,27,167,207,157,43,33,19,254,184,135,223, -24,132,123,195,21,168,147,143,106,126,71,147,111,182,27,136,122,204,55, -123,37,18,137,75,110,246,185,224,132,114,244,232,81,124,231,193,7,43,186, -184,156,78,39,110,188,233,38,196,227,113,220,117,215,93,232,234,234,194, -209,163,71,177,123,247,238,178,154,43,171,9,121,225,133,23,20,13,129,101, -226,104,5,195,181,132,171,250,197,147,75,53,129,113,45,97,175,14,216,107, -165,22,151,203,18,171,244,57,254,167,186,199,23,219,108,130,32,40,89,78, -106,43,140,127,69,163,81,116,119,119,67,48,153,106,22,75,89,182,108,25, -78,157,58,165,220,119,190,8,141,183,74,248,23,19,68,243,54,187,47,10,28, -182,153,213,205,250,248,23,179,208,88,218,240,155,169,171,82,137,155,145, -89,41,76,88,54,55,55,35,149,140,192,44,14,234,158,202,80,106,3,70,198,206, -23,89,9,108,29,171,45,213,211,103,206,226,221,55,124,2,238,152,118,65,165, -197,152,196,154,229,109,168,171,171,67,38,30,128,163,204,45,56,51,230,66, -44,118,161,168,160,147,145,9,191,142,142,191,113,2,29,183,223,142,230,220, -83,101,52,111,25,75,151,46,69,62,184,23,122,193,141,140,236,197,111,119, -156,66,44,150,80,158,47,123,182,252,122,238,239,31,192,245,87,223,5,164, -180,9,197,103,9,87,36,8,102,9,44,86,106,112,190,32,41,46,175,106,122,104, -240,26,63,191,231,62,243,153,207,96,124,248,220,197,189,202,91,128,57,52, -123,210,168,175,175,135,148,25,213,39,54,217,138,231,119,158,69,44,22,47, -90,75,234,123,124,226,196,9,220,112,205,189,64,74,135,80,172,99,138,23, -130,31,243,205,214,183,197,98,185,228,102,159,11,74,40,213,6,222,215,175, -91,135,198,230,102,24,12,6,124,226,19,159,128,197,98,193,214,173,91,209, -219,219,91,209,173,181,107,215,46,165,21,6,115,93,232,89,36,106,18,225, -131,174,90,164,162,151,194,91,13,145,232,9,126,173,255,207,229,119,252, -239,121,45,72,75,99,82,47,56,61,55,154,193,96,64,54,155,197,205,55,223, -92,179,250,148,230,230,102,60,246,216,99,69,66,140,29,63,151,203,161,167, -167,167,100,4,0,35,154,249,18,138,96,40,20,9,51,70,40,122,202,3,255,124, -89,1,27,59,62,191,126,248,102,136,204,66,145,178,33,148,59,203,243,163, -162,210,72,148,89,9,188,86,200,175,175,76,38,3,155,171,1,136,233,127,95, -107,227,172,149,36,167,206,151,21,60,59,246,156,67,34,145,40,169,193,225, -201,213,108,54,99,106,106,10,86,239,7,129,50,201,145,22,179,5,75,150,44, -65,48,168,239,29,8,75,239,194,7,63,212,81,244,44,249,117,201,158,189,205, -102,131,221,221,12,232,132,62,125,230,113,36,42,213,161,232,88,40,11,69, -46,146,36,43,45,133,42,37,121,49,133,132,61,91,190,231,25,0,212,71,190, -163,45,199,218,91,96,110,106,66,122,84,63,177,35,136,77,120,255,7,186,139, -220,199,90,247,216,96,48,192,83,183,84,247,30,59,133,25,88,205,214,162, -90,48,181,146,197,92,124,243,221,131,11,70,40,255,244,149,175,148,37,4, -134,91,110,189,21,201,100,18,43,87,174,196,141,55,222,136,169,169,41,108, -217,178,69,183,40,209,227,241,64,150,101,108,223,190,189,40,8,166,142,81, -168,221,90,106,34,225,53,84,254,223,122,214,201,92,136,164,28,25,168,93, -84,229,126,167,126,95,239,255,188,134,196,54,24,95,244,168,94,120,234,243, -5,102,219,165,172,95,191,190,102,132,178,115,79,240,243,39,0,0,32,0,73, -68,65,84,231,78,244,247,23,187,112,12,220,121,58,157,78,172,94,179,6,78, -167,83,217,40,133,66,1,233,116,122,222,38,183,93,136,22,109,54,61,165,66, -207,109,201,4,3,115,153,241,235,201,108,54,43,62,113,167,211,9,67,114,176, -188,101,126,98,168,168,126,5,128,114,14,76,208,88,173,86,133,204,210,233, -44,44,168,135,21,218,115,125,124,78,25,94,175,23,242,140,126,177,110,60, -223,140,209,177,211,10,153,48,43,149,159,34,200,138,57,13,6,3,28,46,95, -89,66,113,187,221,40,20,242,240,64,95,123,118,24,67,104,247,249,52,229, -173,241,162,70,62,187,254,18,200,5,199,244,51,145,140,49,132,179,201,138, -38,168,186,189,202,66,90,42,5,121,54,235,175,82,150,23,91,55,76,22,49,139, -152,47,64,45,7,151,203,5,73,188,160,127,111,12,49,180,121,99,179,69,182, -101,239,49,144,152,60,84,214,130,109,91,226,195,233,222,113,101,29,166, -82,41,56,157,78,197,141,150,191,232,230,155,111,37,253,130,16,202,23,62, -255,121,4,2,129,242,15,64,16,112,251,237,183,35,26,141,226,238,187,239, -198,210,165,75,113,236,216,49,236,222,189,91,51,56,103,54,155,225,114,185, -240,242,203,47,43,197,86,106,34,169,100,141,104,189,120,11,69,29,59,81, -103,118,241,5,133,115,33,18,61,146,224,73,64,239,103,181,159,81,155,222, -236,39,79,42,122,231,198,8,165,179,179,179,166,254,231,254,190,242,69,119, -221,203,151,43,153,96,236,158,87,110,117,111,130,94,151,97,151,41,8,147, -73,40,10,142,106,89,100,122,53,69,236,126,105,145,191,58,25,66,46,147,109, -150,145,253,152,156,14,41,155,148,215,92,237,118,187,146,74,205,50,201, -20,159,186,165,11,214,156,54,161,184,173,23,123,88,73,250,12,16,205,58, -145,74,165,148,99,242,253,161,88,150,27,223,95,78,146,100,20,96,135,80, -198,119,159,74,165,224,48,234,187,65,189,134,51,240,202,103,116,93,144, -115,114,49,137,153,10,46,47,232,198,221,22,130,88,228,194,155,105,202,144, -101,221,148,105,195,69,66,97,49,91,86,248,90,13,161,176,175,180,202,250, -242,210,131,211,240,72,167,107,114,143,151,52,121,112,180,167,31,86,171, -21,233,116,90,41,126,230,123,162,49,146,121,91,16,202,231,254,236,207,148, -202,231,114,100,114,235,173,183,34,157,78,227,51,159,249,12,0,96,235,214, -173,184,112,225,130,174,251,228,248,241,227,24,30,30,174,72,36,122,36,194, -251,205,171,33,18,181,240,81,147,200,92,44,146,106,9,67,139,36,180,72,163, -154,207,240,150,10,79,44,90,86,14,11,70,47,102,219,117,227,197,248,14,235, -47,196,223,247,114,173,238,101,199,90,24,82,250,57,247,151,191,107,57,14, -28,57,83,100,165,148,179,36,203,61,31,230,198,224,251,182,189,217,246,94, -223,61,147,151,173,69,129,83,245,172,113,150,105,198,42,245,153,63,219, -32,88,42,6,126,141,82,94,55,158,145,202,26,148,184,9,63,116,138,205,221, -97,217,109,44,240,106,52,26,145,23,154,32,20,134,116,181,238,197,132,36, -137,149,66,100,243,106,0,57,111,66,129,92,85,7,114,131,193,88,226,86,228, -83,213,223,78,176,91,140,37,233,252,234,6,155,213,100,91,46,10,161,124, -246,179,159,173,216,139,203,106,181,98,243,245,215,67,150,101,220,127,255, -253,72,165,82,120,234,169,167,52,83,86,27,26,26,48,60,60,140,103,159,125, -182,168,117,137,218,21,193,94,124,167,78,62,16,171,101,149,104,249,209, -203,53,98,44,23,203,168,214,205,53,23,50,208,251,253,92,62,163,118,129, -241,166,57,47,32,249,20,227,197,128,219,227,193,181,215,94,139,84,42,165, -155,232,160,231,250,146,173,141,48,148,89,98,215,108,108,87,8,101,62,224, -159,165,90,251,149,47,182,201,200,231,243,48,150,139,160,200,80,54,40,179, -20,120,193,206,42,246,93,46,23,172,86,171,66,54,134,68,121,1,158,78,167, -225,172,160,193,51,235,93,77,98,140,80,60,30,15,28,14,135,178,238,243,101, -214,80,62,47,46,174,180,203,167,43,73,248,146,216,201,130,90,41,92,146, -71,53,46,47,117,18,7,31,67,169,244,92,23,139,186,93,78,147,210,7,141,111, -174,201,94,124,113,244,124,226,40,53,35,148,47,124,254,243,85,145,201,117, -215,93,7,155,205,134,123,238,185,7,51,51,51,216,186,117,107,73,145,162, -209,104,132,199,227,193,139,47,190,8,73,146,202,166,254,50,34,225,45,17, -189,140,30,22,144,100,153,61,236,197,23,29,49,205,141,221,76,190,166,131, -61,4,62,70,161,142,69,48,65,52,151,152,199,92,132,221,124,133,36,79,42, -252,6,96,173,195,217,84,201,133,66,125,67,3,150,46,93,10,171,213,138,64, -32,128,137,137,9,120,189,94,221,44,58,45,215,87,161,80,0,156,107,128,176, -126,29,198,170,37,217,34,97,83,238,165,39,24,242,209,30,20,166,95,86,2, -193,69,129,205,124,26,249,166,251,0,83,157,238,57,8,134,92,81,61,12,159, -50,205,132,59,43,178,100,237,102,28,14,7,178,193,242,2,60,20,10,193,102, -208,23,80,54,243,236,26,101,22,53,239,102,227,11,59,25,161,216,237,118, -36,100,125,55,83,46,151,125,219,13,130,210,107,181,162,126,159,165,203, -215,234,152,213,236,49,117,34,7,35,150,74,86,87,34,145,128,77,246,194,98, -136,46,250,125,84,247,67,227,147,100,222,50,66,249,199,127,252,199,138, -49,19,171,213,138,107,175,187,14,246,139,93,75,71,70,70,240,194,11,47,32, -155,205,22,7,249,28,14,132,66,33,236,223,191,95,183,162,93,143,72,248,42, -112,22,244,84,7,220,217,139,249,177,89,96,52,149,74,33,28,14,99,106,114, -18,125,253,253,136,197,98,152,152,152,64,94,20,209,222,222,142,250,134, -6,116,117,117,161,181,181,21,46,215,108,1,29,27,118,165,149,69,197,52,83, -45,146,153,11,57,204,151,68,42,125,15,239,206,97,247,180,230,36,82,95,143, -241,137,9,196,227,113,12,13,15,163,175,175,15,62,159,15,126,191,95,73,237, -86,215,1,177,255,179,65,73,140,80,10,133,2,98,177,24,220,174,206,178,29, -193,155,172,125,184,108,253,114,156,233,29,46,26,60,198,94,90,27,136,191, -55,130,32,32,31,216,10,67,118,188,200,199,173,220,55,8,72,100,12,112,27, -245,67,159,118,99,8,62,175,11,147,83,193,162,121,20,124,230,15,95,11,195, -214,104,33,167,159,77,21,77,91,49,29,157,70,93,147,79,255,184,230,55,93, -108,124,218,52,243,233,243,199,101,115,117,204,133,64,89,173,123,102,38, -136,102,217,6,147,65,155,120,30,126,109,9,126,240,179,167,139,122,156,241, -241,3,22,179,225,219,219,176,110,4,172,19,118,38,147,193,170,85,171,240, -249,191,233,4,34,151,46,220,107,104,160,84,119,60,3,52,147,130,76,38,147, -146,68,164,123,12,201,136,233,233,105,52,25,155,96,145,181,9,229,151,123, -218,240,253,159,110,41,178,118,203,221,99,150,130,207,122,249,241,238,87, -65,8,40,110,86,189,146,3,182,223,230,35,19,46,153,80,30,250,241,143,49, -56,80,185,63,208,117,215,93,7,179,197,130,123,239,189,23,195,195,195,120, -254,249,231,75,170,222,155,155,155,177,119,239,94,4,131,65,221,74,118,61, -34,97,100,194,126,170,221,91,38,147,9,118,187,29,62,159,79,105,178,23,10, -6,177,231,245,215,177,115,231,206,178,69,151,231,207,151,166,106,118,118, -117,225,67,31,250,16,234,234,234,202,182,78,97,44,175,78,245,157,171,118, -84,43,98,225,191,75,77,42,11,97,149,108,121,250,105,197,221,194,250,138, -241,47,126,124,171,186,224,145,145,0,127,31,77,22,39,242,70,123,217,138, -249,143,190,111,45,190,124,110,168,100,146,37,255,226,201,133,89,112,22, -139,5,82,46,174,144,137,22,68,203,10,76,4,102,224,90,214,80,246,218,47, -91,187,12,47,6,166,21,107,65,75,115,101,47,159,207,135,66,62,15,33,63,161, -111,157,196,129,161,192,16,150,55,183,234,147,169,125,28,245,117,62,68, -99,9,69,99,214,74,82,177,90,173,104,106,106,66,54,147,170,184,78,250,250, -250,96,111,88,134,58,225,156,118,144,183,209,169,248,220,249,88,93,37,171, -80,237,109,152,29,33,96,156,243,190,80,107,218,236,223,85,181,241,169,18, -233,116,26,126,123,117,174,82,117,220,206,225,112,32,151,213,183,2,211, -146,11,195,195,195,240,180,183,193,45,159,215,185,199,142,162,58,62,89, -213,211,76,47,81,129,79,38,81,167,210,171,187,151,171,61,41,111,73,218, -240,158,61,123,170,170,51,121,247,205,55,163,32,73,248,163,79,124,2,35, -35,35,154,100,210,216,216,136,173,91,183,206,106,77,92,11,20,245,84,60, -126,134,57,79,38,188,117,194,119,137,101,108,238,243,249,96,179,217,144, -78,167,177,109,219,54,108,121,234,41,101,146,224,124,48,56,48,128,239,60, -248,32,58,58,58,112,215,251,223,15,191,223,95,82,101,207,94,90,129,78,45, -55,148,90,147,81,191,87,11,82,97,199,85,199,11,76,38,211,156,134,154,85, -11,94,152,51,194,224,253,182,234,121,22,229,32,8,2,194,225,48,44,190,219, -97,10,253,86,247,115,43,60,199,240,123,183,95,139,87,247,246,20,249,138, -249,23,59,62,123,30,44,219,42,59,254,120,217,115,136,22,218,17,8,4,176, -98,249,178,178,159,219,184,166,17,47,236,144,74,210,182,213,202,135,201, -100,66,99,99,35,196,76,176,108,211,203,129,209,24,78,247,78,226,214,155, -46,7,116,60,99,38,67,22,119,223,181,25,191,248,213,246,34,55,140,90,120, -91,44,22,212,215,215,35,23,61,91,86,0,24,12,6,156,61,123,22,93,55,117,162, -14,218,132,178,172,197,84,213,218,244,251,253,104,106,106,186,24,155,201, -23,53,48,101,175,106,166,72,105,197,255,248,23,91,79,44,57,65,79,48,138, -162,88,181,6,30,14,135,209,98,179,85,60,63,173,76,206,186,186,58,228,243, -89,221,251,92,144,4,92,184,112,1,171,59,175,0,116,38,23,175,235,200,21, -185,79,245,228,132,219,237,70,107,107,171,178,239,248,189,39,73,18,206, -159,63,15,73,146,74,188,54,90,196,50,95,204,155,80,38,38,38,240,253,239, -125,175,226,231,110,122,247,187,33,138,34,62,251,217,207,98,98,98,2,207, -61,247,92,9,153,212,215,215,227,233,167,159,46,17,196,234,108,45,222,2, -225,91,177,171,27,30,242,55,170,174,174,14,14,135,3,201,100,18,191,124, -228,17,108,223,190,189,166,130,115,100,100,4,143,62,250,40,62,252,225,15, -195,237,118,151,36,0,240,218,3,179,2,216,162,48,24,12,152,156,156,68,83, -83,83,69,97,170,69,64,181,32,22,182,128,204,102,243,156,102,113,87,11,245, -70,215,106,155,161,149,65,199,107,87,12,22,139,5,193,96,16,22,247,38,160, -12,161,0,192,31,108,206,98,58,188,18,67,195,227,202,244,74,102,21,177,255, -51,235,129,41,32,185,200,25,32,118,180,140,11,68,192,153,225,217,192,252, -208,240,56,186,12,45,176,232,164,123,174,111,25,66,99,131,31,145,104,162, -172,251,177,161,161,97,54,133,115,100,139,174,188,74,23,188,120,229,181, -55,16,10,71,96,48,185,117,9,5,0,110,185,220,134,199,158,52,149,93,39,29, -29,29,179,247,122,250,217,170,148,198,223,187,99,179,238,49,151,123,46, -224,178,13,107,113,226,228,89,93,45,93,16,4,220,127,255,253,104,106,108, -64,38,157,124,211,149,116,49,200,30,10,78,225,204,201,99,149,215,182,65, -219,255,175,22,158,44,139,41,153,76,194,233,116,150,144,138,40,206,182, -32,97,115,101,42,89,66,19,19,19,88,213,182,68,247,51,110,71,65,55,70,209, -221,221,141,92,58,164,43,104,227,25,43,142,29,219,143,15,220,245,30,93, -66,105,177,15,225,174,59,223,141,231,95,220,93,178,95,248,123,252,251,191, -255,251,88,183,110,45,82,137,88,177,203,78,6,82,233,4,94,219,249,28,142, -157,24,66,65,146,139,60,57,90,164,50,223,12,191,121,19,202,215,190,246, -181,138,159,185,230,218,107,33,138,34,254,248,143,255,24,147,147,147,120, -230,153,103,52,201,228,153,103,158,41,178,74,120,34,225,99,34,204,111,200, -255,228,201,132,119,111,89,173,86,248,253,126,24,141,70,188,244,226,139, -120,244,209,71,23,68,3,7,128,120,44,134,179,103,207,162,187,187,187,136, -228,120,247,141,114,195,85,164,50,60,60,130,134,134,6,93,11,69,29,119,169, -53,169,240,231,53,49,49,81,211,251,98,54,155,53,201,67,171,143,144,86,166, -151,58,235,140,253,62,24,205,161,206,113,21,204,169,195,186,199,118,25, -39,240,153,247,175,193,249,232,13,56,124,244,68,201,244,74,150,62,203,18, -3,50,51,71,96,24,47,223,113,57,36,111,68,255,240,12,178,217,44,246,237, -219,135,198,59,110,67,93,242,81,237,0,185,33,138,255,243,231,239,193,183, -126,182,15,177,88,188,68,248,1,64,107,107,235,108,55,236,153,19,16,202, -164,66,95,8,47,67,42,125,26,146,36,225,200,209,30,248,86,183,194,109,212, -118,203,53,153,207,225,255,254,195,3,248,234,183,30,45,209,224,1,160,171, -171,11,245,245,245,72,142,189,2,147,56,94,81,152,206,204,204,32,20,205, -161,221,102,130,81,163,30,197,104,204,227,239,254,236,189,248,244,95,247, -105,62,87,139,197,130,247,191,255,253,232,238,238,198,228,233,159,195,151, -63,88,242,29,62,0,238,149,107,97,172,176,174,189,245,29,120,234,169,167, -20,129,199,98,67,115,117,109,177,184,77,181,110,181,131,7,15,226,221,155, -63,173,75,170,237,182,62,188,107,221,10,244,94,24,46,186,231,27,55,110, -196,146,37,75,16,190,240,75,221,99,4,194,18,210,233,52,206,246,246,195, -223,236,133,77,208,142,163,252,207,143,172,193,190,3,61,72,166,82,154,153, -174,239,125,239,123,177,105,211,38,76,94,120,9,245,217,82,101,203,11,224, -174,43,90,112,226,172,9,86,193,172,200,40,62,89,73,157,69,187,104,132,242, -208,143,127,140,80,48,88,246,51,109,109,109,136,197,98,248,147,63,249,19, -4,131,65,77,50,105,104,104,192,150,45,91,52,45,18,45,34,97,1,40,53,153, -104,197,74,88,245,231,87,191,250,213,170,98,60,151,138,253,251,246,193, -239,247,43,69,65,90,141,0,121,82,96,141,44,37,89,210,172,252,213,43,64, -172,5,169,240,110,47,118,76,147,201,132,158,158,158,5,185,55,106,173,85, -171,110,136,183,76,249,64,182,154,160,88,39,215,140,243,38,152,82,199,97, -40,211,238,219,103,56,139,141,158,81,44,187,235,46,184,27,215,67,48,89, -21,139,196,100,50,33,151,73,65,140,93,128,24,124,17,66,166,252,128,172, -60,28,120,245,68,1,161,80,72,113,153,93,24,93,142,77,126,215,236,60,113, -45,65,99,222,135,255,253,217,155,145,52,175,195,228,212,140,226,150,104, -110,110,70,99,99,227,108,67,190,192,126,152,167,30,214,183,240,100,1,219, -94,27,82,238,227,51,207,60,131,43,254,225,143,225,150,159,212,253,155,119, -121,119,226,159,191,248,103,56,114,50,128,88,44,6,143,199,131,174,174,46, -92,126,249,229,176,219,237,136,141,239,131,53,248,100,85,2,85,150,101,60, -241,155,167,208,116,223,181,104,197,30,109,23,163,235,48,126,246,253,255, -139,87,247,95,192,233,51,103,144,76,38,81,87,87,135,77,155,54,225,182,219, -110,67,75,75,51,198,251,15,161,94,131,76,24,134,163,141,88,222,90,126,77, -183,9,251,144,153,60,7,192,0,163,1,144,12,6,164,13,64,198,8,24,13,128,209, -104,0,12,6,24,0,165,103,150,214,54,49,73,34,140,230,91,1,116,84,117,253, -67,67,67,48,217,26,116,9,197,104,204,227,79,239,187,9,135,207,223,136,153, -153,25,212,215,215,99,227,198,141,88,179,102,13,166,199,78,195,147,210, -239,212,124,110,32,8,81,20,241,236,179,91,177,226,79,239,70,7,180,173,198, -86,235,105,252,240,155,127,141,3,39,163,56,114,244,24,162,209,40,124,62, -31,174,185,230,26,220,113,199,29,104,104,168,71,96,168,7,117,153,109,186, -174,185,225,88,59,44,150,108,17,17,107,185,190,46,165,124,96,206,132,114, -234,212,169,138,113,19,167,211,137,134,198,70,220,117,215,93,112,185,92, -120,252,241,199,75,178,185,154,154,154,240,244,211,79,151,4,13,121,215, -22,35,15,150,145,197,19,138,150,139,75,16,4,37,215,127,106,106,10,95,254, -210,151,106,210,146,125,46,154,79,60,30,87,218,109,240,45,60,248,23,211, -220,79,156,56,49,27,144,213,104,120,167,22,194,181,116,127,169,45,33,38, -192,95,173,114,12,115,181,104,105,105,193,151,190,244,37,92,184,112,1,61, -61,61,37,189,142,202,245,214,98,77,63,213,96,93,127,3,193,36,218,234,62, -6,71,232,145,178,231,96,49,38,208,148,121,28,184,152,115,145,51,180,32, -45,216,32,20,130,16,228,56,170,213,195,206,132,222,133,51,189,125,69,243, -36,182,60,243,60,218,62,251,135,104,19,31,211,253,187,102,195,171,144,114, -123,224,171,223,4,201,214,5,193,2,8,210,24,82,99,135,97,77,31,135,185,80, -126,210,104,95,124,3,206,244,238,82,172,218,96,48,136,115,3,81,180,47,213, -182,24,20,87,148,240,52,252,27,175,64,222,117,19,108,174,6,8,130,17,217, -248,8,48,242,91,88,203,52,181,84,45,148,217,150,247,135,14,97,250,158,15, -162,181,76,79,143,21,230,103,209,112,67,39,222,123,219,253,112,249,218, -96,119,204,6,235,83,177,113,132,79,111,65,189,94,165,55,128,172,228,194, -185,193,24,86,172,47,191,158,173,198,36,172,208,104,207,194,106,15,231, -80,143,39,74,115,139,159,190,248,210,203,184,231,218,86,184,116,44,195, -54,225,53,120,86,45,69,236,178,119,195,108,245,194,128,44,38,207,252,26, -62,81,127,250,98,178,208,128,35,111,156,71,161,80,192,224,224,32,6,3,18, -218,154,244,159,107,167,249,101,52,110,108,194,117,87,125,4,46,223,50,56, -93,110,72,133,2,146,209,81,68,38,31,65,189,220,167,75,38,57,217,141,87, -14,4,52,251,23,242,138,220,162,19,202,183,191,253,237,138,159,185,226,202, -43,225,247,251,177,126,253,122,108,221,186,21,51,51,51,37,150,9,31,128, -87,147,9,79,36,108,110,5,79,40,234,241,172,188,121,109,183,219,49,49,49, -129,127,248,251,191,95,48,23,151,174,75,36,20,82,50,150,180,90,68,243,133, -152,67,67,67,72,165,211,104,106,110,46,105,229,206,19,9,223,57,88,237,166, -186,84,48,98,17,4,1,145,72,164,98,234,247,92,177,119,207,30,220,112,227, -141,184,243,206,59,241,169,79,125,10,77,77,77,8,6,131,136,199,227,56,126, -252,120,73,107,125,222,228,214,91,212,108,186,166,217,108,70,127,192,132, -229,190,119,195,158,170,126,100,170,69,14,0,115,92,22,147,226,187,240,212, -139,103,144,76,165,139,166,77,26,141,70,252,236,209,23,241,23,247,94,6, -159,172,111,221,25,141,121,212,201,135,128,244,33,96,14,114,44,90,88,138, -159,254,230,100,209,124,23,65,16,240,208,79,127,142,238,47,253,79,44,55, -62,87,246,239,235,112,20,72,28,133,142,1,85,17,121,206,194,254,234,215, -190,137,111,126,249,94,180,155,244,181,109,159,113,16,62,113,176,168,63, -88,53,13,60,78,206,172,70,118,1,226,119,229,144,74,103,171,34,84,182,231, -182,109,219,134,91,110,248,91,184,36,125,247,149,219,56,12,119,238,17,221, -88,72,137,114,62,217,142,116,250,188,178,158,30,252,143,239,161,253,43, -127,130,46,227,11,250,202,186,113,10,206,194,99,64,16,96,109,223,28,85, -41,68,107,144,202,140,148,157,12,91,105,239,213,156,80,158,121,230,153, -138,197,139,107,215,174,197,228,228,36,30,120,224,1,28,63,126,188,164,65, -164,205,102,195,190,125,251,32,138,98,201,16,35,158,76,92,46,87,209,75, -77,38,106,191,31,171,10,14,4,2,111,9,153,44,89,178,4,189,189,189,74,222, -185,186,61,52,19,154,14,135,3,217,108,22,61,61,179,62,115,171,197,166,116, -52,213,106,108,200,19,9,159,225,81,43,98,97,133,163,251,247,239,95,16,139, -237,229,237,219,75,44,211,117,235,215,195,239,247,35,157,78,235,54,218, -212,243,225,50,119,149,217,108,134,81,48,225,212,120,35,214,55,109,128, -61,119,98,65,158,107,68,234,196,207,158,29,69,36,26,83,138,21,89,209,160, -209,104,68,34,145,192,211,175,167,113,207,141,93,112,201,181,115,173,166, -164,6,60,182,35,143,112,52,166,140,150,101,46,63,179,217,140,111,255,96, -11,254,207,231,110,198,18,227,252,103,188,103,45,107,96,205,157,45,179, -54,222,84,112,18,137,4,126,248,216,17,124,225,190,78,120,141,131,53,187, -206,161,244,38,252,246,149,11,232,232,232,88,212,253,154,76,165,171,226, -19,182,223,242,249,60,30,125,98,27,254,234,15,59,224,50,140,92,242,241, -19,82,11,158,120,238,88,81,27,122,0,248,247,239,109,193,87,254,252,74,52, -8,167,106,118,173,35,153,77,216,246,218,112,73,210,68,185,161,125,243,197, -156,254,242,137,199,203,167,84,26,5,1,130,201,132,251,238,187,15,225,112, -24,59,119,150,14,32,74,165,82,152,152,152,208,116,117,169,43,122,89,171, -8,245,148,61,126,222,55,35,21,214,94,252,95,254,229,95,22,157,76,0,160, -181,173,13,225,112,24,209,104,20,177,88,12,137,68,66,25,114,196,15,102, -50,26,141,56,120,232,16,36,89,186,104,161,9,200,229,114,74,230,17,123,241, -253,117,244,178,163,46,165,200,75,221,222,254,249,231,159,95,148,251,52, -53,53,133,93,59,119,98,235,179,207,34,157,78,235,214,43,84,154,129,195, -200,26,130,21,7,7,219,17,20,110,169,249,185,142,164,55,224,135,79,71,49, -58,62,165,204,23,97,107,139,175,126,31,30,157,198,19,187,141,136,163,171, -54,194,78,106,197,35,187,172,56,213,59,164,204,176,87,87,218,11,130,9,63, -250,245,9,76,74,215,205,95,153,104,250,104,85,22,44,187,214,179,231,46, -224,199,207,70,16,47,180,214,228,58,251,83,87,226,225,173,3,138,213,183, -152,72,36,170,27,33,206,11,223,51,103,206,98,219,113,15,68,249,210,250, -115,229,101,11,182,29,117,33,20,126,83,89,96,207,55,30,79,224,219,191,236, -69,168,176,166,38,215,57,145,219,128,39,119,4,138,82,244,213,215,86,173, -50,87,83,66,121,232,199,63,174,248,153,205,215,93,135,206,206,78,116,118, -118,98,231,206,157,37,141,213,26,27,27,177,123,247,238,146,160,44,223,90, -155,185,185,24,169,176,127,171,173,19,62,110,194,30,248,175,126,245,171, -138,201,2,11,129,142,165,75,241,226,139,47,42,36,146,74,165,148,76,18,70, -38,117,117,117,112,187,221,184,112,161,175,164,53,63,75,103,229,255,134, -31,70,181,144,67,133,4,65,192,224,224,224,91,114,223,212,173,235,249,106, -246,114,132,226,116,58,139,154,240,25,77,54,188,126,74,198,153,248,187, -145,70,203,37,159,87,70,246,227,181,161,141,248,214,207,223,192,224,240, -120,209,24,93,181,112,103,10,80,36,158,195,127,189,88,192,249,228,13,40, -200,243,47,168,27,74,93,142,239,60,149,196,233,115,35,69,93,131,153,59, -151,237,11,143,199,3,163,96,198,207,159,237,195,80,238,134,185,17,137,44, -224,248,204,53,240,213,53,85,20,166,124,181,189,213,106,197,153,222,33, -252,219,163,51,232,141,95,1,73,154,159,224,201,202,94,28,152,184,18,255, -181,229,28,210,153,172,34,236,22,213,229,85,133,133,2,3,74,10,82,95,217, -125,4,191,124,189,17,9,185,125,94,199,205,73,14,252,182,103,25,94,220,117, -172,104,94,13,235,162,224,116,58,17,139,167,241,111,191,232,195,201,240, -213,144,228,249,221,99,81,118,160,39,120,53,30,218,50,140,112,52,81,50, -216,78,43,189,251,82,221,93,115,114,121,85,10,196,251,253,126,140,140,142, -226,147,247,223,143,19,39,78,148,84,158,219,108,54,236,222,189,187,100, -192,16,223,142,66,139,76,248,214,2,90,233,109,76,131,18,69,17,59,95,121, -101,209,133,162,213,106,69,50,145,192,212,212,20,60,30,143,166,133,225, -247,251,177,100,201,18,76,76,76,224,204,217,51,69,154,118,161,80,80,52, -95,246,160,103,91,139,23,207,228,96,154,76,113,199,219,249,199,77,120,237, -243,161,135,30,90,180,251,101,20,4,172,95,191,30,94,175,23,225,112,24,94, -175,87,179,227,105,185,22,218,130,32,40,153,116,44,72,159,205,102,113,162, -63,132,125,113,31,46,95,221,129,174,186,25,248,133,185,185,160,210,146, -31,125,225,78,252,102,219,89,76,205,28,40,42,10,99,207,65,61,163,158,205, -23,97,217,103,47,238,157,64,115,93,23,46,95,229,64,155,115,4,14,227,84, -85,155,127,36,185,26,175,31,15,227,196,217,19,69,147,15,89,141,16,63,71, -133,111,181,1,0,91,118,140,96,221,242,203,113,229,242,52,234,117,42,218, -25,98,249,86,236,56,225,198,209,83,167,240,212,139,127,135,127,186,175, -204,179,50,150,30,219,102,179,33,153,22,241,227,95,191,129,165,109,245, -184,227,186,86,44,245,140,193,41,76,87,229,198,235,143,44,195,75,123,134, -49,19,58,85,100,121,159,63,127,30,59,182,61,129,63,220,180,56,235,48,157, -201,225,239,254,174,252,245,179,189,200,63,119,171,213,138,179,23,198,240, -221,25,39,62,116,235,85,232,246,246,194,106,136,85,117,204,209,212,90,60, -246,226,56,206,93,56,82,228,234,98,223,207,20,36,22,39,124,226,133,179, -168,247,55,226,182,107,150,160,195,55,13,175,48,90,133,50,228,197,64,116, -57,94,57,16,192,88,224,68,73,191,65,181,91,93,171,158,101,193,9,229,167, -63,253,105,197,207,172,93,183,14,173,173,173,16,4,1,123,247,150,6,238,44, -22,11,166,166,166,148,32,186,86,111,35,22,120,231,3,241,204,50,97,177,8, -222,223,199,11,213,177,177,177,183,196,213,213,216,212,132,39,158,120,2, -46,151,171,200,154,96,27,197,239,247,99,221,186,117,136,70,163,56,116,184, -184,110,162,190,174,14,169,84,74,17,92,76,192,179,44,48,158,76,106,105, -161,240,238,174,64,32,80,243,180,234,250,134,6,88,204,102,56,46,206,252, -96,196,159,72,36,208,223,223,143,190,190,62,212,213,213,161,174,174,78, -179,130,157,221,199,114,213,204,78,231,236,236,15,54,235,131,255,142,189, -199,131,120,62,18,133,223,211,130,171,214,55,161,197,151,131,211,146,130, -67,136,195,33,132,103,53,197,130,3,89,217,133,100,222,139,241,136,29,189, -131,113,28,124,163,31,169,212,88,81,17,38,255,76,216,177,248,86,240,14, -135,163,136,80,178,217,44,194,137,20,182,238,158,68,58,37,162,187,99,57, -154,234,109,104,242,155,97,51,231,153,226,139,92,65,64,36,41,99,52,144, -194,185,254,0,194,145,99,69,117,42,188,43,68,125,108,54,75,133,77,40,205, -231,243,232,31,75,225,228,249,20,252,238,46,188,107,165,15,62,103,30,14, -83,22,70,163,140,76,222,130,72,82,192,153,254,24,14,30,187,0,131,241,205, -73,157,159,255,145,65,233,155,198,92,175,108,194,36,83,4,249,248,38,219, -139,130,32,32,20,205,226,209,231,206,35,151,203,161,179,99,9,86,117,250, -225,115,155,224,182,177,49,204,64,58,39,32,24,47,96,98,42,137,55,78,13, -67,146,195,69,107,144,23,110,7,143,15,226,208,27,179,169,221,172,80,81, -221,243,139,101,217,241,113,74,117,65,52,139,111,233,117,12,159,253,253, -105,24,141,70,252,239,159,152,148,243,81,119,225,149,164,3,74,175,63,190, -148,193,98,177,32,95,48,226,201,237,253,112,216,109,216,124,249,114,52, -121,11,240,90,227,240,8,147,176,8,179,238,180,84,193,143,233,116,51,38, -163,102,236,216,215,143,11,253,251,139,220,186,124,86,149,186,133,20,171, -87,203,229,243,120,102,231,48,50,153,12,154,234,155,176,186,187,1,245,94, -19,92,54,25,6,200,48,24,128,140,104,66,52,41,33,48,157,198,201,222,113, -36,146,199,203,54,175,213,171,1,91,52,11,165,210,20,191,142,165,75,113, -225,194,5,124,250,211,159,198,241,227,199,75,90,154,212,215,215,99,203, -150,45,154,174,46,53,161,240,65,120,62,155,139,79,107,83,15,68,146,101, -89,105,212,184,88,176,59,28,240,251,124,120,248,225,135,149,222,96,234, -193,77,141,141,141,184,245,214,91,145,203,229,112,232,240,225,210,194,69, -163,17,201,100,178,200,228,231,173,19,179,217,172,219,150,100,62,86,138, -150,117,178,101,203,150,154,222,151,206,206,78,124,243,91,223,42,137,139, -185,221,110,120,189,94,120,189,94,56,157,78,69,120,170,251,107,241,132, -194,6,111,233,89,41,110,183,91,179,71,23,187,190,72,52,138,167,95,62,87, -20,255,120,211,181,18,214,156,11,163,190,63,60,153,240,109,224,181,8,133, -181,252,224,51,15,7,198,162,56,217,59,174,8,106,173,49,185,188,230,200, -91,169,108,227,179,61,162,118,255,242,132,146,201,100,96,177,88,16,79,36, -240,210,158,97,37,126,199,4,48,239,194,18,132,226,245,195,11,103,38,232, -248,53,200,63,71,22,191,100,154,44,19,250,129,233,4,134,70,131,69,105,213, -234,89,246,90,53,85,234,134,138,140,232,248,142,193,188,224,227,173,55, -94,64,242,26,184,210,114,254,226,191,213,100,194,147,25,127,94,179,253, -196,12,69,247,66,61,133,145,39,84,70,66,175,236,31,86,72,143,61,231,89, -210,11,3,232,47,186,222,226,231,80,236,234,226,75,34,216,186,103,74,74, -58,157,70,52,145,194,171,7,6,138,154,61,150,27,158,167,238,58,193,203,93, -245,60,40,94,54,47,40,161,108,127,233,165,202,1,233,37,75,176,116,217,50, -228,243,121,28,57,114,164,212,47,60,52,164,8,1,189,64,60,159,26,220,209, -209,129,84,42,85,68,38,90,253,102,248,22,12,110,183,123,209,200,100,213, -170,85,216,185,107,23,78,159,62,173,60,124,126,116,176,217,108,70,119,119, -55,62,252,225,15,67,20,69,236,219,191,191,132,100,205,102,11,226,177,88, -209,84,63,182,120,25,177,240,62,207,133,176,78,166,167,167,177,231,245, -215,107,122,111,108,23,235,71,212,163,152,213,243,219,153,213,162,174,230, -230,173,187,74,126,117,167,211,169,8,105,173,153,230,124,151,95,62,57,130, -15,78,106,213,254,240,130,142,239,214,203,183,157,231,135,85,169,9,133, -31,133,192,174,159,105,216,122,199,231,123,188,241,2,64,221,242,158,159, -186,200,19,10,35,50,181,112,224,143,169,78,73,231,247,17,175,232,241,107, -68,143,80,152,6,205,136,159,197,0,121,129,170,87,216,171,110,173,163,94, -35,236,94,176,239,230,5,32,111,65,105,245,73,211,178,74,248,227,170,187, -2,243,3,244,212,235,81,109,157,242,181,111,140,112,242,249,124,81,92,151, -127,206,234,78,25,234,115,85,187,79,203,61,91,190,225,45,83,20,248,231, -202,43,8,90,107,152,143,83,243,110,83,158,84,244,106,191,106,74,40,143, -63,241,68,217,247,155,154,155,209,115,226,4,62,253,153,207,160,167,167, -71,179,128,113,231,206,157,69,90,91,57,119,23,11,114,102,179,185,146,192, -187,150,166,205,22,0,211,28,23,178,144,209,237,118,163,161,177,17,15,253, -228,39,138,224,80,119,60,118,56,28,216,188,121,51,238,189,247,94,36,147, -73,28,58,116,24,25,141,110,163,126,159,23,193,96,176,72,131,100,90,143, -154,76,244,252,187,151,106,157,60,248,224,131,53,191,71,108,236,128,122, -208,144,122,54,77,165,142,167,213,102,155,120,60,30,221,180,107,254,28, -82,169,84,201,168,83,53,89,171,155,101,242,174,14,181,5,205,172,104,166, -244,24,12,6,72,146,84,164,4,241,221,177,147,201,100,209,241,213,202,2,127, -221,234,186,42,158,80,248,152,34,47,212,179,217,108,9,137,49,225,195,23, -218,170,53,90,173,129,107,188,21,200,39,32,240,237,58,248,99,139,162,88, -146,84,242,166,219,72,42,201,44,82,223,99,190,124,128,165,70,243,223,173, -238,195,198,8,69,29,96,214,178,132,244,8,133,119,253,240,36,164,190,15, -252,61,224,93,94,236,250,89,155,120,126,109,171,91,198,171,239,187,150, -178,160,69,40,60,169,178,150,65,172,193,45,59,134,86,246,150,218,186,102, -49,48,222,93,203,135,19,216,126,156,239,216,223,170,9,101,120,120,184,98, -221,73,119,119,183,114,35,143,31,63,94,242,254,224,224,160,230,152,94,94, -8,171,91,170,72,146,4,131,209,128,76,38,163,184,147,148,12,21,174,221,56, -159,98,106,48,24,240,201,251,239,199,247,190,251,221,154,11,201,250,250, -122,52,52,54,226,177,199,30,195,244,244,180,194,230,188,43,130,105,172, -31,255,248,199,113,199,29,119,32,16,8,224,248,27,111,232,198,117,210,233, -12,18,137,132,178,57,216,124,16,163,209,168,217,3,236,82,234,78,212,4,108, -50,153,48,48,48,80,243,216,201,218,117,235,240,245,175,127,189,164,133, -142,58,62,166,158,5,162,103,133,86,67,40,130,32,160,174,174,174,40,115, -78,109,226,179,115,208,210,160,213,247,153,223,240,106,237,156,183,162, -249,244,117,166,77,178,89,31,90,93,178,153,32,96,130,70,75,16,240,173,105, -244,10,125,249,56,6,47,212,213,51,127,244,142,169,23,148,213,27,129,204, -206,133,15,202,179,99,179,88,135,150,208,231,5,170,218,82,209,106,231,207, -215,107,177,231,206,199,81,216,247,107,41,4,90,196,161,222,51,229,106,48, -180,44,54,45,43,151,239,210,171,182,208,120,121,160,94,103,252,121,242, -215,205,39,35,241,107,138,41,11,236,254,170,191,159,41,71,234,181,164,183, -142,213,137,79,188,114,194,136,208,237,118,215,100,152,90,89,66,209,170, -35,81,103,236,156,63,127,30,95,248,194,23,112,250,244,105,205,216,201,107, -175,189,86,98,218,242,45,232,213,205,30,89,135,94,159,215,139,179,103,207, -193,237,118,23,153,225,106,141,157,15,100,118,116,116,224,163,31,253,40, -126,243,228,147,40,212,32,64,223,218,218,10,155,221,142,95,253,234,87,8, -135,195,74,75,16,246,128,248,145,174,221,221,221,248,220,231,62,135,181, -107,215,226,236,217,179,56,215,123,30,122,131,67,237,118,59,198,198,70, -21,211,152,239,68,204,2,242,234,77,160,222,52,151,226,234,98,245,58,181, -206,222,218,183,111,95,137,246,197,107,69,172,166,136,253,212,203,226,211, -107,253,175,7,179,217,172,144,138,90,88,177,243,168,148,146,173,246,233, -151,107,5,164,38,67,38,148,24,161,232,213,88,241,199,87,19,154,214,196, -63,45,235,151,119,83,240,83,69,89,2,131,250,152,188,112,227,9,76,175,6, -65,45,120,181,102,184,176,99,243,36,202,2,250,252,53,242,2,149,63,46,111, -133,105,245,115,99,231,194,174,139,17,22,63,55,71,203,29,92,110,128,157, -150,245,171,118,147,105,181,56,210,186,7,60,233,177,115,100,202,175,122, -157,241,194,94,139,164,121,133,129,61,95,158,176,217,247,51,143,8,91,11, -124,54,169,158,114,162,94,199,90,107,152,41,196,181,176,78,42,123,176,56, -144,0,0,32,0,73,68,65,84,19,74,133,52,220,43,174,184,2,35,35,35,232,232, -232,192,238,221,187,53,114,189,83,74,60,64,175,238,68,107,131,2,128,203, -229,194,76,112,6,67,67,67,232,238,238,46,178,74,212,90,55,79,42,221,203, -151,227,254,251,239,199,133,11,23,112,240,192,129,18,23,92,53,110,173,165, -203,150,97,108,116,20,191,121,242,73,165,154,155,213,62,104,105,222,119, -223,125,55,62,241,137,79,64,20,69,236,223,191,31,147,83,229,83,69,5,163, -128,104,52,170,108,114,150,93,193,252,178,90,27,96,190,35,132,213,4,108, -52,26,241,240,195,15,87,180,60,231,19,87,250,198,55,190,81,228,239,86,207, -50,103,65,121,54,79,93,171,63,27,115,167,56,28,142,57,105,76,102,179,25, -13,13,13,8,133,66,69,93,88,121,97,206,52,92,182,9,181,90,222,240,202,15, -19,116,122,99,165,45,22,139,162,240,48,66,73,167,211,72,165,82,37,194,221, -225,112,148,104,216,90,110,27,45,197,75,237,110,97,194,151,5,199,89,12, -67,61,205,148,93,55,127,76,173,246,62,122,164,162,53,210,150,239,251,196, -4,30,179,82,248,76,49,117,214,158,154,80,180,202,7,248,196,27,94,89,212, -202,4,212,43,246,213,219,23,106,203,75,29,119,81,183,108,215,202,138,226, -199,135,243,164,151,207,231,139,132,188,122,157,241,22,138,186,131,134, -122,210,44,79,88,76,230,229,243,121,101,13,100,179,89,229,88,90,107,73, -77,40,188,181,171,229,126,102,123,179,86,208,37,148,193,193,193,138,105, -184,233,84,10,55,220,112,3,2,129,64,73,31,40,179,217,172,104,172,90,211, -234,180,134,99,169,53,62,163,193,136,161,225,97,100,115,34,86,175,90,133, -124,94,212,172,22,87,167,91,218,237,118,180,183,183,43,233,164,108,145, -23,10,5,165,58,219,0,192,124,209,242,201,102,179,24,31,31,199,169,83,167, -48,48,48,80,180,217,92,46,87,145,175,151,63,247,171,175,190,26,31,249,200, -71,176,126,253,122,244,247,247,227,204,217,179,21,239,153,217,108,193,153, -51,167,17,143,199,149,13,206,22,104,57,237,81,157,38,61,31,87,151,32,204, -14,243,169,38,209,98,46,104,111,111,199,225,195,135,97,183,219,75,130,152, -124,32,91,139,80,180,230,217,204,87,99,18,4,1,141,141,141,136,197,98,37, -230,190,90,195,229,179,201,180,44,20,45,43,131,255,105,183,219,225,241, -120,138,72,143,31,129,155,72,36,138,136,129,175,181,209,18,138,234,64,181, -186,3,55,255,98,179,232,249,228,4,81,20,145,72,36,20,50,99,215,173,214, -234,213,49,155,74,86,138,122,24,24,159,88,193,103,85,105,13,50,227,73,91, -207,181,199,238,145,58,158,198,214,173,86,38,224,92,134,178,105,17,138, -58,222,162,21,196,87,147,159,186,39,31,79,40,60,233,177,231,172,21,43,227, -9,133,39,21,245,116,89,94,89,96,50,203,98,177,64,20,69,101,95,149,35,88, -173,17,17,234,53,196,200,164,86,150,73,69,66,57,121,242,100,197,244,208, -99,199,143,227,142,247,188,7,253,253,253,165,65,103,191,31,241,120,188, -108,48,94,139,76,216,3,43,20,10,104,105,105,193,248,196,56,2,129,9,132, -66,65,92,125,213,85,48,153,76,72,38,147,37,45,223,217,162,86,187,16,18, -137,196,236,76,135,80,72,105,141,194,183,68,225,77,82,89,150,225,118,187, -117,167,220,177,115,95,183,110,29,238,185,231,30,92,121,229,149,152,153, -153,169,202,42,81,132,188,84,192,204,204,140,18,176,100,155,71,157,6,169, -246,241,106,45,248,106,73,133,29,39,147,201,224,255,253,251,191,215,60, -198,52,51,51,131,191,254,235,191,198,215,190,246,53,68,163,81,108,223,190, -29,175,190,250,170,34,92,213,5,171,140,80,180,186,70,59,157,206,75,214, -152,60,30,143,34,212,211,233,52,68,81,132,205,102,43,154,22,201,11,38,173, -184,130,154,84,248,151,207,231,43,235,142,51,155,205,240,251,253,176,219, -237,202,30,224,167,85,170,133,162,90,208,106,9,91,45,34,209,59,102,52,26, -85,142,169,69,158,106,66,169,148,118,202,214,160,186,111,30,219,167,124, -113,174,86,10,184,86,60,80,253,157,106,65,173,206,184,82,119,82,208,26, -249,48,31,82,209,243,4,232,101,164,241,86,13,155,114,90,110,42,105,37,65, -175,142,183,105,61,99,143,199,131,76,38,83,178,150,212,83,79,181,158,173, -250,88,204,109,239,114,185,46,57,69,120,78,132,242,82,5,45,182,101,201, -18,156,235,237,197,154,53,107,52,171,232,211,233,116,201,16,24,222,140, -215,114,31,240,139,42,159,207,163,171,171,19,227,19,179,237,162,115,185, -28,246,236,221,11,191,191,14,171,86,174,128,201,100,66,60,30,87,6,229,240, -218,12,159,87,207,220,13,124,53,58,219,160,122,233,141,90,154,162,205,102, -195,53,215,92,131,247,190,247,189,184,236,178,203,16,14,135,113,236,248, -113,140,141,141,235,198,74,74,82,106,173,86,188,246,218,107,72,167,211, -74,32,158,125,127,185,161,83,122,153,43,213,90,39,236,111,191,241,245,175, -47,72,22,92,38,147,81,90,243,216,237,118,108,188,252,114,252,211,63,253, -19,118,237,218,133,190,190,190,146,108,62,181,207,152,61,127,175,215,91, -179,57,224,76,192,186,92,46,197,13,165,22,114,106,129,174,85,27,193,94, -108,40,215,92,54,33,91,223,162,40,22,157,3,19,144,234,184,160,86,90,43, -63,238,122,46,199,100,2,72,139,76,212,153,81,122,217,81,252,123,234,118, -71,106,48,45,157,41,106,234,123,172,55,161,147,93,43,239,157,224,191,159, -185,133,211,233,116,73,90,249,92,9,165,18,177,104,185,204,216,123,236,220, -180,238,1,179,76,82,169,84,145,194,80,78,105,80,91,61,229,148,5,245,115, -229,239,177,158,181,86,139,181,84,83,66,169,212,219,105,106,106,10,43,87, -174,132,205,102,43,105,179,2,0,23,46,92,40,185,105,122,105,164,234,44,31, -246,64,93,174,210,38,108,225,112,8,7,14,30,132,217,108,193,234,85,171,208, -220,220,140,84,42,133,72,36,162,8,106,70,28,234,194,33,166,169,179,223, -233,101,139,240,90,162,207,231,195,13,55,220,128,247,189,239,125,104,108, -108,196,196,196,4,142,28,57,130,137,192,100,213,68,194,48,62,62,142,72, -36,82,68,108,108,97,106,85,253,170,3,134,213,146,138,122,163,9,130,128, -109,219,182,149,116,126,94,8,164,211,105,236,223,183,15,251,247,237,67, -125,67,3,214,173,91,135,72,36,162,57,210,153,87,46,42,105,253,151,66,44, -102,179,89,209,242,120,247,167,150,64,231,173,196,74,66,116,62,231,192, -187,69,216,218,227,133,141,186,67,245,188,235,129,46,238,47,62,190,193, -246,134,178,249,85,83,50,217,90,225,235,98,170,189,110,158,120,121,33,203, -143,231,213,58,110,165,235,100,239,121,60,158,34,50,102,53,74,229,106,149, -202,189,199,95,175,218,109,89,146,112,82,161,37,9,175,116,170,93,236,124, -189,145,218,226,97,69,177,243,85,82,180,226,52,234,122,20,117,6,221,66, -67,147,80,142,31,59,86,62,112,237,241,160,183,183,23,183,221,118,27,198, -198,198,52,138,246,204,24,25,25,41,50,17,181,124,134,122,41,163,236,1,228, -243,121,116,180,119,96,100,180,148,176,68,49,135,147,167,102,221,114,13, -245,13,88,214,185,12,173,173,173,72,38,147,202,92,18,150,77,194,54,22,91, -204,172,64,138,247,241,242,204,238,243,249,112,213,85,87,97,195,134,13, -88,181,106,149,66,6,39,79,158,66,34,57,191,225,18,86,139,5,123,247,238, -85,178,186,248,107,213,74,159,44,103,161,204,53,110,178,127,255,126,60, -242,240,195,88,108,4,103,102,176,122,245,106,68,163,81,205,252,127,118, -221,110,183,123,81,22,59,219,140,106,129,163,21,204,92,40,48,225,83,107, -223,117,181,130,126,177,48,151,44,189,185,94,203,98,172,149,75,189,215, -204,82,225,215,153,218,109,86,139,251,107,179,217,148,245,203,19,40,175, -24,44,228,122,174,138,80,14,31,62,92,246,143,218,218,218,48,62,62,142,182, -182,54,4,53,44,25,175,215,171,204,59,209,11,112,170,131,80,236,102,243, -254,83,81,20,209,217,217,169,73,40,69,62,252,224,12,102,130,179,67,188, -252,62,63,90,90,154,177,105,211,38,152,76,38,4,131,65,101,120,84,40,20, -66,44,22,83,44,19,0,240,249,124,240,120,60,240,249,124,104,111,111,71,75, -75,11,124,62,223,108,59,137,64,0,39,78,156,192,212,244,244,37,245,9,179, -88,172,216,186,245,89,36,18,137,34,43,137,17,158,58,163,71,175,46,99,46, -150,9,35,147,222,222,94,252,231,127,252,199,91,182,201,216,53,107,101,229, -48,146,124,171,4,132,90,43,39,16,222,206,132,90,110,13,243,86,165,222,251, -111,25,161,28,56,112,160,98,208,51,159,207,163,181,181,21,145,72,164,244, -75,85,166,180,94,17,147,150,38,206,15,145,154,21,142,18,154,155,154,49, -57,53,89,213,5,133,35,97,132,35,97,229,255,62,175,15,117,245,117,88,187, -118,45,92,46,151,82,52,196,142,81,40,20,148,148,210,76,38,139,254,254,254, -217,121,38,201,212,156,93,90,90,48,26,5,236,219,183,23,19,19,19,69,253, -145,24,153,240,105,169,122,133,126,229,82,135,181,200,68,146,36,37,198, -244,47,95,253,234,91,182,169,214,172,93,171,52,130,44,23,84,37,16,222,9, -16,69,81,71,6,44,172,149,240,118,82,136,52,9,69,237,194,210,66,62,159,71, -99,99,163,210,167,75,253,158,94,182,140,186,45,69,37,183,78,46,151,67,103, -231,50,76,77,79,205,75,0,69,162,17,68,162,145,183,236,6,15,244,247,225, -200,225,195,69,100,162,238,145,196,23,173,169,155,97,86,147,50,172,85,9, -31,8,4,240,197,47,126,177,230,29,152,87,175,94,13,163,209,136,72,36,130, -137,137,9,125,43,182,189,29,83,83,83,69,89,48,234,84,210,133,154,241,66, -248,239,141,209,209,209,162,125,193,203,146,190,190,62,220,112,195,236, -252,24,230,118,28,30,30,158,243,49,212,223,109,54,155,209,218,250,230,224, -177,88,44,166,36,38,85,138,139,105,197,160,245,142,83,233,247,122,48,24, -12,8,133,66,72,36,18,88,191,126,253,130,197,85,76,213,178,172,154,48,10, -133,2,4,65,64,44,86,58,11,32,155,205,150,248,204,249,140,41,189,102,129, -106,215,14,251,119,50,153,196,154,213,107,138,102,137,188,237,33,3,195, -195,67,216,186,117,107,89,50,81,183,212,208,202,120,43,151,50,172,229,230, -154,152,152,168,249,24,100,163,32,96,201,146,37,248,215,175,127,93,121, -158,151,93,118,25,174,185,230,26,248,253,126,229,252,82,169,20,166,167, -167,113,236,216,49,165,152,145,101,224,105,13,210,98,22,21,185,157,8,181, -194,31,253,209,31,233,190,215,221,221,141,245,235,215,67,150,101,56,157, -78,252,246,183,191,197,183,190,245,173,154,30,255,234,171,175,198,109,183, -221,134,141,27,55,42,157,130,249,84,99,166,60,178,53,255,169,79,125,106, -209,238,205,221,119,223,141,246,246,246,34,239,209,130,86,202,15,14,14, -86,252,35,38,12,212,1,109,134,84,42,165,155,30,199,231,67,171,243,186,249, -94,58,234,116,198,76,38,141,165,29,75,49,60,50,252,182,95,208,6,131,1,35, -163,35,248,205,111,126,83,52,215,130,159,188,167,110,213,175,110,212,166, -21,63,41,71,36,204,244,29,28,28,196,255,247,229,47,215,156,76,108,54,27, -190,251,221,239,22,53,31,28,24,24,192,232,232,104,73,6,23,235,34,160,206, -218,211,27,247,75,32,44,154,158,119,113,212,5,83,114,22,98,253,29,58,116, -8,135,14,29,2,0,220,119,223,125,184,254,250,235,139,202,2,178,217,172,146, -42,188,88,201,25,12,146,36,33,30,143,43,10,62,171,165,73,165,82,53,201, -180,44,33,148,241,241,241,170,4,166,36,73,8,4,2,154,129,32,81,20,53,139, -196,248,120,73,185,162,61,189,70,110,201,100,18,109,173,173,24,171,226, -28,223,42,24,5,1,175,237,222,141,215,46,182,162,225,83,144,213,29,63,213, -115,53,212,83,41,245,172,19,53,153,176,251,116,230,204,25,124,245,159,255, -185,230,215,212,212,212,132,31,254,240,135,37,49,48,173,185,10,234,190, -65,106,130,156,111,129,38,129,80,43,68,163,81,200,178,140,88,44,182,224, -10,205,47,127,249,75,60,247,220,115,248,155,191,249,27,101,134,13,243,64, -228,243,249,69,39,20,89,150,17,14,135,139,246,42,95,155,85,87,87,119,73, -164,82,66,40,125,125,125,21,255,136,85,200,14,13,13,193,235,245,98,122, -122,186,132,112,248,10,92,181,181,162,215,229,147,23,50,90,100,36,8,2,66, -161,16,150,180,180,96,66,213,234,229,237,130,159,62,244,144,226,195,229, -167,160,241,243,199,61,30,143,242,226,91,73,179,182,213,90,45,181,181,22, -6,179,126,12,6,3,182,109,219,86,243,212,96,139,197,2,151,219,141,31,253, -232,71,154,109,115,248,122,34,222,39,171,182,84,212,201,6,234,103,175,165, -148,16,8,11,133,112,56,12,73,146,20,75,101,161,17,137,68,240,229,47,127, -25,127,245,87,127,5,159,207,167,236,133,74,243,126,22,202,66,9,135,195, -69,138,31,63,126,60,145,72,192,239,247,215,142,80,78,159,58,85,53,211,13, -12,12,224,218,107,175,45,121,143,213,128,232,17,73,53,5,123,106,235,132, -23,84,227,227,227,104,104,108,68,48,24,66,45,50,177,46,217,42,49,26,113, -234,228,73,60,254,248,227,69,19,247,248,89,18,140,72,88,63,43,175,215,91, -212,113,87,107,152,88,37,235,132,205,77,249,215,127,253,215,170,159,91, -181,176,59,28,48,24,12,248,217,207,126,86,210,6,94,93,241,174,149,157,198, -183,170,225,199,214,242,159,209,234,240,90,13,10,133,2,38,38,38,148,166, -124,205,205,205,0,160,116,77,168,85,174,63,225,157,137,80,40,164,12,67, -91,76,151,235,119,190,243,29,124,238,115,159,83,246,203,91,69,40,161,80, -72,147,76,216,158,185,148,106,250,18,66,9,84,161,249,199,162,81,72,146, -132,3,7,14,224,206,59,239,44,121,223,102,179,105,90,39,229,26,209,169,201, -68,93,177,174,158,154,54,50,60,12,131,209,136,230,230,102,205,196,128,197, -128,193,96,68,40,20,196,35,15,63,140,169,169,169,34,63,41,47,76,89,99,68, -159,207,7,191,223,15,191,223,95,212,36,81,221,182,154,39,19,45,34,97,66, -115,102,102,6,255,250,181,175,85,245,204,230,2,183,219,141,169,233,105, -188,248,226,139,37,109,224,213,35,112,93,46,23,154,154,154,208,210,210, -2,191,223,15,81,20,17,14,135,149,241,189,252,125,208,75,58,168,86,240,63, -249,228,147,101,99,124,155,55,111,198,210,165,75,139,218,132,51,242,35, -16,180,8,69,43,6,188,144,248,175,255,250,47,220,123,239,189,176,217,108, -111,73,252,80,150,101,68,34,17,216,237,118,133,208,212,93,58,216,48,175, -154,16,74,85,38,99,36,2,73,146,48,58,58,170,235,146,209,234,150,171,231, -230,170,100,161,168,9,197,225,112,32,151,203,33,20,10,225,216,209,163,240, -122,189,104,111,239,64,78,20,33,73,11,207,250,70,163,128,254,190,11,120, -236,177,199,144,76,38,53,39,177,241,100,194,10,39,25,161,248,124,62,197, -66,225,201,68,47,85,152,15,96,179,223,239,223,191,31,63,248,254,247,107, -158,22,12,0,245,13,13,24,27,31,47,90,104,236,190,51,75,203,231,243,225, -166,155,110,194,157,119,222,137,246,246,118,100,50,25,36,147,73,69,235, -59,118,236,24,166,166,166,138,72,133,111,79,207,103,189,84,131,189,123, -247,86,76,24,25,24,24,128,223,239,47,82,68,178,217,44,18,137,68,77,251, -132,17,126,247,93,94,108,112,85,37,188,239,125,239,67,44,22,83,92,69,217, -108,86,145,87,126,191,31,86,171,85,81,164,206,157,59,87,113,141,166,82, -41,140,140,140,84,237,86,186,225,134,27,224,245,122,117,251,130,241,63, -121,249,89,172,248,190,169,160,231,243,121,165,216,152,41,192,234,190,134, -213,220,151,154,18,202,204,244,52,90,91,91,49,54,54,134,125,251,246,161, -189,189,93,137,27,0,80,218,152,107,89,36,213,118,206,213,26,242,195,2,72, -234,78,155,225,112,24,253,253,253,200,231,243,216,180,105,19,60,94,111, -209,116,186,90,185,181,98,209,40,14,28,56,128,221,187,119,35,159,207,151, -144,158,122,14,8,239,230,98,132,194,254,205,7,227,213,141,241,120,34,97, -63,153,27,45,153,76,226,193,7,31,172,185,139,139,199,224,192,0,214,175, -95,143,247,189,239,125,248,202,87,190,82,52,211,131,191,166,7,30,120,0, -35,35,35,216,178,101,75,73,199,233,134,134,6,116,117,117,33,20,10,149,204, -187,80,183,215,97,195,161,116,207,103,112,16,251,246,237,171,120,222,129, -64,0,225,112,184,104,244,41,235,62,80,40,20,148,115,39,252,247,70,36,18, -81,4,103,37,11,101,122,122,26,99,99,99,74,203,36,38,11,4,65,64,38,147,129, -32,8,24,27,27,83,100,193,39,63,249,73,108,219,182,173,36,174,204,99,199, -142,29,248,131,63,248,3,132,195,225,202,174,103,187,29,39,78,156,80,4,62, -239,161,224,67,2,229,188,62,106,79,15,43,238,230,235,194,212,105,252,172, -44,100,81,8,5,0,174,216,180,9,35,35,35,120,246,217,103,241,197,47,126,177, -136,80,216,192,33,61,87,151,150,133,162,38,19,246,224,88,109,133,217,108, -46,105,99,173,110,141,29,137,68,176,119,239,94,36,18,9,24,141,255,63,123, -111,30,29,213,117,101,15,239,26,84,165,42,213,172,210,132,4,146,144,64, -72,102,52,66,54,96,176,177,49,6,207,216,110,219,137,147,118,156,116,175, -142,227,184,135,181,146,78,247,151,196,113,251,183,58,78,103,116,183,211, -78,28,59,30,176,59,182,49,120,100,50,4,108,144,132,132,64,72,66,128,38, -36,33,52,75,85,165,82,205,115,125,127,72,247,230,214,173,87,131,64,6,28, -215,89,171,22,32,164,167,87,175,222,187,251,158,115,246,217,91,140,21,43, -86,32,43,43,11,202,140,12,132,195,152,81,246,34,22,137,224,118,187,209, -215,215,135,35,71,142,160,119,218,46,151,181,5,229,141,156,120,48,33,217, -9,111,46,165,209,104,98,150,128,248,107,65,178,18,177,88,140,83,167,78, -225,119,47,188,240,185,40,6,243,209,127,225,2,134,134,134,240,252,243,207, -227,169,167,158,18,124,111,0,176,125,251,118,225,77,135,201,132,96,48,136, -242,242,114,88,44,150,8,16,1,64,65,38,25,170,226,135,31,126,152,244,121, -19,6,15,63,56,170,80,40,40,85,244,82,154,142,169,248,226,135,195,225,160, -27,153,68,65,84,155,9,197,152,183,136,230,179,133,154,154,26,252,237,223, -254,45,254,231,127,254,39,238,241,45,22,75,82,25,115,56,28,134,221,110, -167,66,155,124,137,138,149,49,98,133,33,103,86,186,159,61,198,165,84,8, -17,147,153,148,151,79,215,0,205,102,51,206,159,63,79,5,23,129,169,30,74, -188,82,87,162,212,76,8,84,164,82,105,132,38,84,34,47,112,167,211,137,250, -250,122,106,201,233,243,249,144,149,149,133,162,162,34,164,167,167,195, -96,48,68,236,78,252,126,63,172,86,43,76,38,19,206,158,61,27,177,123,96, -229,82,88,98,1,239,223,205,91,222,198,179,189,229,253,185,121,70,23,59, -191,50,57,57,137,255,253,223,255,253,92,179,18,161,8,6,2,248,240,131,15, -240,189,239,125,15,219,182,109,139,114,170,76,166,180,208,212,212,132,27, -110,184,1,114,185,28,121,121,121,130,25,2,185,214,228,65,7,64,193,160,186, -186,122,70,101,61,159,207,7,171,213,26,81,118,20,50,58,226,205,177,82,241, -229,9,151,203,69,119,230,137,170,24,196,13,147,216,77,144,103,149,93,216, -249,205,224,129,3,7,240,189,239,125,15,207,62,251,108,204,227,30,62,124, -24,155,54,109,74,120,174,132,141,70,102,254,216,205,44,201,84,132,140,207, -248,209,11,222,202,152,119,223,228,157,43,47,246,217,136,2,148,162,226, -98,180,157,61,155,84,121,129,44,246,175,190,250,42,126,248,195,31,162,161, -161,33,98,49,76,196,232,74,22,61,201,7,72,16,89,72,247,159,151,200,39,187, -82,151,203,69,65,197,233,116,162,169,169,73,208,253,141,31,180,35,187,7, -33,182,154,144,251,36,187,208,178,187,120,182,121,205,251,167,243,205,105, -54,35,145,74,165,112,187,221,56,120,240,32,118,188,251,238,231,210,43,73, -54,62,61,116,8,119,223,125,55,106,107,107,35,230,80,146,9,183,219,141,154, -154,26,108,218,180,9,35,35,35,56,126,252,56,134,134,134,48,150,164,33,217, -76,35,63,63,31,215,93,119,29,220,110,55,38,38,38,232,238,142,253,140,67, -161,16,124,62,95,82,125,21,167,211,9,224,47,50,29,236,174,51,197,36,251, -226,5,113,104,141,53,148,205,7,201,100,72,165,132,237,59,176,148,121,242, -12,147,251,75,38,147,33,43,43,43,110,233,75,169,84,38,117,206,68,10,159, -151,191,231,133,118,99,169,107,240,254,78,236,250,200,175,69,100,13,157, -181,12,165,108,225,194,164,0,101,116,100,4,149,149,149,56,113,226,4,220, -110,55,118,239,222,141,37,75,150,96,100,100,4,147,147,147,81,89,74,188, -222,9,223,43,16,42,125,17,52,230,203,35,177,152,96,36,91,96,1,133,120,62, -11,57,217,9,105,75,9,129,9,111,205,202,10,59,178,128,194,191,216,15,80, -136,30,76,110,88,146,137,29,62,124,24,175,190,242,202,21,5,18,254,166,102, -55,7,51,89,72,221,110,247,140,202,86,151,18,135,15,31,134,76,38,67,126, -126,62,52,26,13,242,242,242,144,157,157,77,121,255,196,193,145,236,82,137, -131,29,155,57,181,182,182,226,248,241,227,130,53,238,235,174,187,14,5,5, -5,84,45,90,44,22,211,82,96,10,92,190,24,33,228,131,20,15,128,88,90,45,89, -99,88,234,60,25,222,37,128,18,12,6,113,246,236,89,124,253,235,95,199,175, -127,253,235,184,101,175,68,212,97,162,186,206,90,94,176,227,8,132,182,79, -214,163,88,253,20,182,130,195,186,230,10,73,62,41,20,138,217,1,148,96,48, -136,242,138,10,124,240,193,7,73,253,240,162,69,139,112,252,248,113,132, -66,33,52,55,55,99,233,210,165,72,75,75,131,215,235,197,162,69,139,208,211, -211,19,149,78,9,93,176,100,234,123,66,243,10,241,154,226,4,76,88,64,33, -165,47,214,152,134,220,88,172,225,146,208,241,133,20,147,217,236,132,21, -121,100,231,51,200,139,236,36,120,243,44,246,70,13,133,66,159,123,159,228, -154,197,139,241,222,123,239,225,129,7,30,64,119,119,55,92,211,59,240,120, -161,214,104,48,48,48,0,177,88,140,194,194,66,148,150,150,34,63,63,255,170, -93,48,124,62,31,237,121,181,180,180,208,175,235,245,122,204,155,55,15,197, -197,197,200,202,202,162,214,181,4,76,142,31,63,142,35,211,10,7,177,226, -216,177,99,152,152,152,192,194,133,11,233,195,77,220,250,148,74,101,170, -233,255,5,136,100,203,93,236,250,196,170,131,147,185,50,82,125,32,19,240, -100,67,17,8,4,224,243,249,176,106,213,170,184,199,110,111,111,79,216,199, -33,0,197,102,26,60,141,95,104,236,32,22,160,8,49,102,249,57,178,75,97,67, -74,121,228,158,59,119,46,36,82,41,130,73,236,140,27,142,29,195,35,143,60, -66,53,171,118,236,216,129,199,31,127,28,167,78,157,130,70,163,73,42,59, -73,4,36,108,214,194,211,227,132,0,133,69,95,98,151,73,192,132,100,40,62, -159,47,42,75,137,213,151,137,37,110,73,62,0,118,90,92,104,130,156,253,160, -216,122,37,235,163,45,18,137,112,178,177,17,47,189,244,210,231,6,36,153, -153,153,144,166,165,225,23,191,248,5,0,224,191,254,235,191,80,80,80,128, -251,239,191,31,94,143,71,80,113,85,44,145,96,233,146,37,144,201,229,88, -191,126,61,42,42,42,32,149,74,97,177,88,224,116,58,113,230,50,247,116,46, -53,38,38,38,48,49,49,65,65,70,165,82,97,205,154,53,208,233,116,248,228, -147,79,112,238,220,185,164,142,211,217,217,9,131,193,64,55,8,100,115,65, -178,221,84,211,255,234,47,123,37,171,35,199,150,212,217,153,42,149,74,21, -65,253,39,116,120,22,80,200,154,17,11,52,198,198,198,226,150,196,0,160, -160,160,0,191,253,237,111,35,74,172,236,218,193,3,8,89,35,249,74,79,117, -117,117,84,31,133,181,4,38,247,50,33,219,204,10,160,16,189,172,245,235, -215,227,211,67,135,146,58,64,83,83,19,110,187,237,54,28,62,124,24,161,80, -8,175,191,254,58,190,241,141,111,160,165,165,5,37,37,37,24,29,29,141,2, -147,120,34,129,66,101,47,33,80,225,27,78,252,64,161,66,161,160,0,194,190, -72,118,34,68,153,227,173,128,227,101,40,44,168,240,150,182,228,107,66,118, -190,108,185,203,239,247,227,232,209,163,216,190,125,123,66,203,229,75,137, -165,203,150,193,237,118,227,213,87,95,141,184,102,38,147,9,47,189,244,18, -36,18,9,202,203,203,81,85,85,69,41,223,164,111,176,113,227,70,44,88,176, -0,157,157,157,216,183,111,31,206,159,63,159,20,59,38,217,32,187,122,114, -93,200,231,204,91,244,146,44,146,124,54,100,215,70,62,59,135,195,65,73, -33,201,134,195,225,192,254,253,251,177,127,255,254,25,159,183,211,233,132, -203,229,138,184,223,88,177,193,20,168,92,189,49,83,63,30,190,164,206,14, -248,106,181,90,170,2,33,149,74,233,61,73,250,52,149,149,149,113,41,239, -14,71,124,7,216,218,218,90,90,122,141,229,137,20,235,239,60,120,221,112, -195,13,17,3,140,236,154,69,50,147,75,157,213,146,242,23,46,28,14,99,221, -186,117,232,191,112,33,169,29,91,48,16,128,109,114,18,155,55,111,198,225, -195,135,17,12,6,177,125,251,118,60,240,192,3,176,90,173,17,83,223,60,128, -240,205,112,22,56,120,111,100,30,84,226,165,115,100,65,39,192,193,150,185, -216,204,132,239,161,196,2,20,33,219,90,222,223,69,200,231,133,21,194,36, -58,93,18,137,4,22,179,25,31,239,218,133,79,15,29,250,92,123,36,10,165,18, -43,86,172,192,3,15,60,0,137,68,130,91,111,189,21,125,125,125,216,191,127, -63,170,171,171,169,17,151,68,34,65,127,127,63,6,7,7,49,111,222,60,60,242, -200,35,120,240,193,7,225,116,58,209,219,219,139,29,59,118,68,208,194,47, -22,56,212,106,53,21,229,35,2,162,124,233,128,189,161,217,251,34,16,8,80, -107,103,50,27,48,48,48,128,209,209,81,56,157,78,4,131,65,228,231,231,163, -180,180,20,121,121,121,80,42,149,116,70,105,182,163,168,168,8,35,35,35, -17,114,52,4,76,216,190,74,106,144,242,139,31,124,67,155,151,32,34,132,27, -82,246,34,128,66,104,190,172,71,138,80,36,170,72,156,63,127,62,41,5,248, -100,98,253,250,245,130,114,88,228,223,151,210,140,143,153,161,144,95,248, -200,215,190,134,255,120,250,233,164,14,50,60,60,12,143,215,139,111,125, -243,155,216,177,115,39,2,129,0,118,239,222,141,187,238,186,11,6,131,1,29, -29,29,17,32,34,244,226,51,21,30,68,132,120,214,188,0,37,15,42,172,169,19, -255,39,49,125,34,59,223,88,246,180,66,89,10,15,46,44,120,176,32,194,238, -2,194,225,48,58,59,59,177,115,231,206,203,66,255,93,184,112,33,242,230, -204,193,99,143,61,134,182,182,54,58,159,163,82,169,240,200,35,143,224,251, -223,255,62,84,42,21,76,38,19,157,154,85,40,20,168,168,168,128,201,100,194, -209,163,71,209,216,216,120,209,210,20,26,141,6,233,233,233,176,217,108, -24,26,26,66,122,122,58,178,179,179,177,112,225,66,204,153,51,7,50,153,12, -110,183,27,54,155,13,30,143,23,62,159,151,210,123,73,6,20,158,250,32,104, -253,58,39,39,7,50,153,12,37,165,165,144,203,228,80,40,166,30,108,179,217, -12,139,197,130,158,158,30,116,118,118,226,163,143,62,66,40,20,130,66,161, -64,81,81,17,42,42,42,160,213,106,49,49,49,65,89,91,23,27,115,230,204,153, -186,223,61,30,186,176,144,166,41,43,189,99,183,219,83,128,242,87,6,42,252, -238,158,244,71,9,233,134,16,53,8,139,48,45,45,45,97,175,241,82,166,210, -103,26,36,171,151,72,36,17,235,29,89,83,103,131,84,18,197,242,98,233,111, -127,251,232,163,216,246,250,235,201,213,167,45,22,188,255,193,7,120,244, -209,71,209,219,219,139,150,150,22,28,56,112,0,55,222,120,35,22,46,92,136, -193,193,193,136,129,68,118,81,231,155,246,137,4,3,133,64,70,72,76,146,255, -93,252,223,99,129,154,80,159,38,30,178,179,255,102,75,97,196,128,172,182, -182,22,111,253,233,79,73,205,247,204,70,86,146,101,52,98,205,218,181,216, -176,97,3,106,107,107,35,128,193,225,112,160,165,165,5,45,45,45,72,75,75, -163,131,150,228,102,58,125,250,116,92,7,185,120,145,157,157,13,177,88,140, -193,193,193,41,83,180,69,139,80,86,86,134,236,236,108,76,76,76,96,112,112, -16,35,35,35,56,215,221,3,151,203,133,112,120,182,116,148,166,50,157,130, -185,115,81,86,86,134,135,31,126,24,225,112,24,103,206,156,193,137,19,39, -80,91,91,75,107,223,75,150,44,129,74,165,194,232,232,232,140,75,100,5,5, -5,56,49,237,190,153,150,150,6,133,66,65,41,201,4,244,216,108,149,128,78, -42,190,216,96,194,62,255,188,251,44,217,48,146,166,56,89,59,201,70,243, -106,178,105,32,37,90,86,121,131,172,133,164,249,63,235,128,34,151,203,225, -118,187,225,114,185,176,124,249,242,164,1,133,148,191,94,127,237,53,204, -47,41,193,55,31,123,12,61,189,189,56,121,242,36,42,42,42,144,155,155,139, -201,201,73,90,114,34,175,88,70,82,177,26,248,4,68,120,112,225,179,21,82, -206,9,6,131,17,83,246,137,50,36,161,114,27,111,246,197,147,13,248,65,33, -183,219,141,83,45,45,248,248,227,143,209,217,217,121,89,111,26,159,207, -135,23,126,247,59,52,158,60,9,187,221,30,37,137,194,134,223,239,135,217, -108,134,249,18,250,55,10,133,2,58,157,14,38,147,9,105,105,105,88,178,100, -9,30,122,232,33,4,2,1,244,245,245,161,171,171,11,39,155,154,102,188,120, -207,44,194,112,56,166,74,7,127,169,55,139,145,153,105,196,195,15,63,140, -140,140,12,180,182,182,162,169,169,9,77,77,77,180,94,92,81,81,129,80,40, -148,244,76,76,70,70,6,74,75,75,81,87,87,71,7,121,89,55,78,82,131,246,249, -124,244,57,74,1,202,23,31,80,132,202,223,124,149,130,165,237,146,89,50, -182,39,120,53,132,221,110,135,76,38,131,223,239,143,208,242,74,75,75,163, -68,130,75,21,82,21,156,148,39,191,248,98,41,144,61,221,221,248,205,111, -126,131,107,87,174,196,29,119,220,129,112,56,140,190,190,62,42,214,231, -241,120,162,76,164,216,154,121,44,75,224,68,25,11,159,85,144,99,177,253, -26,30,64,132,202,109,241,50,34,242,226,41,192,46,151,11,167,91,91,81,93, -83,131,134,99,199,174,216,77,179,160,180,20,21,21,21,104,104,104,192,215, -190,246,53,10,174,179,29,89,89,89,112,187,221,176,90,173,180,79,19,8,4, -208,211,211,139,163,71,235,48,97,181,226,98,173,5,36,98,9,196,146,216,89, -170,223,231,7,18,60,167,225,112,8,54,187,13,54,251,148,18,181,86,171,197, -87,190,242,21,132,66,33,52,54,54,226,212,169,83,56,113,226,4,196,98,49, -138,139,139,145,157,157,141,161,161,161,184,187,180,142,142,14,104,181, -90,252,195,63,252,3,182,111,223,14,155,205,70,193,132,40,76,144,18,88,32, -16,160,3,105,169,249,148,191,30,96,225,213,63,132,88,155,36,210,210,210, -48,57,57,25,247,184,42,149,234,178,189,7,155,205,134,244,244,244,40,9,23, -2,134,179,113,191,70,1,10,89,32,51,50,50,46,57,5,58,217,216,136,147,141, -141,200,206,206,198,109,155,55,99,241,226,197,176,219,237,152,156,156,132, -199,227,137,146,103,39,139,125,44,55,199,88,224,18,43,107,33,37,60,22,88, -18,189,200,185,8,149,2,217,166,123,32,16,192,216,216,24,218,219,219,81, -83,93,125,217,51,145,88,209,222,222,142,123,239,189,23,29,29,29,248,254, -247,191,143,151,95,126,25,29,29,29,179,118,252,236,236,108,140,142,142, -34,20,10,225,142,59,238,160,194,160,77,77,77,24,29,27,79,178,140,37,130, -84,42,65,40,24,130,203,229,196,228,164,13,195,195,67,240,120,60,24,27,27, -131,215,235,21,220,76,176,159,15,145,114,201,204,204,164,58,105,242,244, -116,136,32,154,170,75,115,128,227,112,58,209,53,77,50,41,93,176,0,107,214, -172,193,201,147,39,81,83,83,131,246,246,118,180,181,181,97,222,188,121, -40,44,44,196,224,224,96,204,51,159,156,156,196,209,163,71,113,243,205,55, -99,114,114,18,181,181,181,112,187,221,112,187,221,81,180,244,64,32,0,143, -199,147,146,207,255,43,2,149,120,153,11,235,239,67,214,176,225,225,225, -248,155,167,4,139,183,74,165,66,102,102,230,140,54,213,241,50,20,146,157, -176,3,146,236,160,39,89,127,103,13,80,200,155,204,202,202,154,53,118,193, -216,216,24,222,216,182,109,234,97,46,45,197,77,27,54,208,193,48,151,203, -133,96,48,8,167,211,73,213,132,217,198,182,144,82,113,188,146,88,244,78, -53,28,243,134,136,229,109,206,107,118,145,223,107,183,219,209,213,213,133, -198,198,70,28,57,124,248,170,153,98,231,227,84,75,11,170,170,170,112,234, -212,41,188,244,210,75,120,226,137,39,208,218,218,122,201,64,114,246,236, -89,228,229,229,225,219,223,254,54,164,82,41,206,157,59,135,182,182,14,184, -220,241,27,221,98,145,100,42,99,176,217,208,211,211,141,211,167,79,83,158, -62,91,242,36,47,82,139,142,181,145,32,159,213,200,200,8,70,70,70,162,54, -0,26,141,6,229,229,229,48,26,179,160,80,164,195,239,15,34,24,250,203,103, -101,50,153,96,50,153,160,211,233,240,237,111,127,155,246,153,186,186,186, -208,222,222,142,202,202,74,100,100,100,196,45,5,118,118,118,66,44,22,227, -171,95,253,42,246,238,221,75,51,111,150,162,46,147,201,104,182,127,169, -94,221,169,184,186,128,132,7,21,22,92,216,221,127,188,146,51,144,152,94, -190,124,249,114,252,241,143,127,20,148,149,138,39,227,68,158,31,182,167, -236,114,185,232,250,78,216,106,60,152,16,50,193,172,2,74,86,86,22,0,96, -247,238,221,179,254,225,156,59,119,142,210,145,21,10,5,54,111,217,130,107, -175,189,22,6,131,1,98,177,152,214,165,9,221,55,150,22,88,44,181,226,120, -150,185,66,127,146,230,20,203,228,8,133,66,112,185,92,24,29,29,197,153, -211,167,113,170,181,21,189,61,61,151,165,169,62,91,113,221,117,215,225, -236,217,179,248,238,119,191,139,242,242,242,139,6,20,163,209,136,161,161, -33,184,92,46,252,224,7,63,128,92,46,71,123,123,59,134,134,134,17,8,6,226, -238,188,2,126,63,218,59,58,208,220,212,68,21,43,140,6,44,0,0,32,0,73,68, -65,84,160,201,53,78,79,79,79,232,228,25,107,35,17,107,195,64,254,30,10, -133,34,134,46,211,210,210,80,86,86,134,156,156,92,200,100,114,184,221,46, -64,4,120,188,94,156,235,238,70,73,73,9,42,43,43,241,206,59,239,96,108,108, -12,117,117,117,8,135,195,184,235,174,187,48,54,54,22,115,238,38,20,10,161, -161,161,1,27,55,110,196,233,211,167,233,0,173,199,227,161,37,81,98,91,157, -242,99,249,235,204,78,132,192,133,220,115,193,96,144,42,54,8,69,113,113, -113,82,122,94,124,121,158,44,254,60,201,137,124,47,251,236,176,76,46,137, -68,18,65,74,138,37,57,117,41,17,83,190,190,186,186,26,117,71,143,126,174, -31,146,219,237,198,251,239,189,135,247,223,123,15,0,96,200,204,68,213,170, -85,88,178,116,41,50,51,51,97,48,24,162,26,234,177,178,10,161,172,133,221, -45,8,205,174,136,197,98,154,29,141,143,143,163,255,194,5,180,181,183,227, -88,125,253,85,147,125,100,26,141,200,205,205,69,70,70,198,140,122,51,161, -80,8,223,253,238,119,113,235,173,183,98,207,158,61,51,254,189,106,181,26, -54,155,13,22,139,5,223,250,214,183,160,213,106,209,209,209,129,254,129, -65,4,2,254,152,165,44,32,140,115,93,93,168,169,169,161,169,53,153,203,16, -154,240,229,179,148,88,130,162,201,128,10,95,182,100,95,61,61,61,232,238, -238,70,56,28,198,252,146,18,204,155,59,15,129,224,212,44,146,195,233,132, -195,233,196,214,173,247,97,104,104,16,187,118,237,130,215,235,197,206,157, -59,177,116,233,82,204,157,59,55,110,182,210,212,212,132,121,243,230,81, -141,48,210,156,39,165,46,162,195,148,234,167,124,121,130,244,79,226,13, -1,207,159,63,63,105,48,19,34,5,241,253,155,120,25,10,171,72,44,84,125,153, -45,242,128,32,160,188,252,210,75,248,236,179,207,46,251,135,96,49,155,177, -111,223,62,236,219,183,47,226,235,115,231,206,69,94,94,30,138,139,139,161, -157,54,170,210,104,52,72,147,74,145,62,61,80,196,47,40,192,20,239,218,229, -114,193,231,243,193,102,179,193,106,181,194,106,181,194,98,177,96,116,100, -4,93,93,93,87,109,214,145,155,155,11,157,94,143,29,59,118,192,108,54,195, -104,52,226,145,175,126,21,205,205,205,9,127,246,154,197,139,209,216,216, -136,55,223,124,19,13,13,13,104,107,107,155,209,239,214,233,116,56,113,226, -4,190,243,157,239,96,201,146,37,56,115,230,76,92,166,150,84,34,197,216, -216,40,142,30,61,138,241,241,113,122,3,199,187,233,249,27,92,232,70,231, -37,37,146,17,23,229,137,22,66,100,140,145,225,97,12,77,247,73,150,45,91, -6,149,74,13,167,203,137,209,177,81,200,228,233,120,226,137,39,176,99,199, -14,12,14,14,226,244,233,211,232,233,233,193,221,119,223,29,183,124,113, -225,194,5,24,12,6,172,94,189,26,229,229,229,130,223,51,49,49,17,85,226, -32,246,213,164,12,145,42,141,253,117,100,51,82,169,20,71,19,108,200,147, -201,78,132,198,33,120,255,37,86,199,139,60,119,188,20,61,97,162,241,10, -195,172,72,45,41,55,207,26,160,52,55,55,227,185,223,252,230,170,235,13, -244,247,247,163,191,191,159,202,227,255,53,199,194,178,50,120,61,30,188, -253,206,59,244,115,32,158,40,47,189,252,50,254,241,31,255,49,102,230,40, -151,203,81,60,127,62,134,134,134,240,135,63,252,1,99,99,99,168,175,175, -79,250,119,235,245,122,180,180,180,64,175,215,227,185,231,158,131,197,98, -193,161,67,159,194,238,16,158,230,21,139,196,56,118,172,30,167,78,157,138, -80,4,16,2,17,254,197,14,132,198,219,61,17,165,133,68,128,34,164,194,192, -191,88,218,56,73,249,219,218,218,16,12,6,81,90,90,138,236,236,108,216,29, -14,12,12,14,226,158,123,238,65,119,119,55,14,29,58,4,175,215,139,183,222, -122,11,15,62,248,32,250,251,251,99,178,230,44,22,11,26,26,26,96,50,153, -232,20,127,60,98,139,68,34,193,202,149,43,145,151,151,7,185,92,78,223,47, -17,236,75,129,203,213,19,124,105,85,136,200,67,238,59,185,92,142,80,40, -132,87,95,125,53,238,49,147,165,235,243,244,100,34,245,195,42,153,147,18, -43,171,15,40,52,240,205,170,12,179,26,94,228,231,46,245,158,163,128,178, -115,199,14,188,255,254,251,169,59,231,10,197,53,139,23,163,185,185,25,47, -189,244,82,132,32,29,223,99,120,249,229,151,241,208,67,15,97,112,96,128, -206,92,168,53,26,204,159,63,31,245,245,245,200,205,205,197,191,253,219, -191,161,171,171,11,71,142,28,73,74,119,139,236,76,62,250,232,35,252,252, -231,63,71,73,73,9,26,27,79,98,100,116,84,144,181,21,14,135,113,240,207, -127,198,249,243,231,233,206,58,30,104,176,236,56,86,154,134,151,169,17, -122,191,201,56,124,38,2,19,2,36,188,219,39,91,127,30,26,26,194,133,11,23, -80,88,84,132,76,131,1,163,99,99,208,233,245,120,244,209,71,241,246,219, -111,195,235,245,226,163,143,62,194,77,55,221,68,69,71,133,130,52,252,147, -137,96,48,136,134,134,6,20,22,22,162,172,172,140,94,71,175,215,11,135,195, -65,101,245,83,101,178,171,15,76,120,16,33,47,210,60,223,183,111,31,172, -86,107,204,99,150,151,151,11,10,178,198,2,20,94,208,145,104,137,17,27,113, -33,181,97,161,198,60,47,29,195,254,220,165,200,214,71,0,74,109,109,109, -92,48,201,200,200,192,245,171,87,83,47,137,214,83,167,224,241,120,82,119, -218,37,134,90,163,65,81,81,17,234,234,234,240,252,243,207,11,74,60,240, -139,176,68,34,193,129,3,7,16,14,135,81,94,94,142,140,140,12,156,57,115, -6,30,143,135,42,8,215,215,215,83,91,129,68,161,213,106,81,95,95,15,133, -66,129,109,219,182,77,155,122,29,130,219,227,22,44,109,157,56,113,28,13, -13,13,244,193,137,7,26,66,122,103,188,230,89,60,64,73,214,50,58,25,64,33, -160,34,164,154,64,116,221,2,129,0,198,70,71,49,50,60,140,242,138,10,4,2, -65,76,88,39,241,232,163,143,98,251,246,237,240,122,189,168,175,175,199, -146,37,75,160,213,106,19,206,24,36,27,125,125,125,48,24,12,200,200,200, -136,176,70,32,154,80,164,151,152,138,43,15,44,177,202,170,228,223,10,133, -2,78,167,19,207,61,247,92,220,99,21,22,22,38,77,148,17,146,156,103,45,198, -249,44,133,47,21,199,242,140,98,21,209,103,21,80,94,250,195,31,98,126,195, -13,235,214,97,229,202,149,200,204,204,68,83,83,19,14,29,58,132,96,40,132, -37,75,151,34,24,8,160,189,163,3,161,89,24,217,255,178,69,86,118,54,222, -124,243,77,154,33,8,233,127,145,15,158,173,119,178,210,56,35,35,35,80,40, -20,120,242,201,39,177,97,195,6,140,143,143,227,253,247,223,199,208,208, -80,82,231,96,48,24,240,198,27,111,96,235,214,173,120,252,241,199,209,221, -221,141,174,115,221,8,70,177,183,68,176,77,78,226,157,119,222,6,128,40, -80,224,1,35,153,23,159,169,240,125,148,153,54,229,227,129,10,159,161,8, -1,9,175,247,214,211,221,13,153,76,134,133,11,23,97,100,116,20,95,249,202, -87,176,107,215,46,56,28,14,116,117,117,161,160,160,0,249,249,249,24,25, -25,153,149,251,97,124,124,28,94,175,55,130,22,74,206,219,98,177,192,104, -52,166,50,149,171,0,72,120,150,21,185,151,36,18,9,180,90,45,66,161,16,126, -242,147,159,196,173,12,72,165,82,180,183,183,39,181,225,35,131,179,124, -134,194,130,10,155,165,176,107,68,34,173,67,86,105,88,169,84,206,202,166, -69,202,82,206,216,40,41,41,193,250,27,111,196,245,215,95,143,140,140,12, -52,55,55,35,61,61,157,206,32,212,212,212,224,195,15,63,132,92,46,71,85, -85,21,60,110,55,186,186,186,82,119,95,178,11,200,216,24,130,193,96,68,90, -202,166,163,172,155,26,107,128,67,234,163,114,185,28,171,87,175,198,150, -45,91,32,18,137,80,95,95,143,150,150,150,164,165,229,85,42,21,182,109,219, -134,31,252,224,7,216,188,121,51,26,27,27,49,48,56,4,126,186,93,42,145,226, -192,159,15,160,163,189,61,2,8,120,128,72,36,229,47,4,38,66,170,204,201, -52,227,99,25,181,9,237,32,133,40,150,44,176,8,129,10,251,106,111,63,139, -178,178,50,12,143,140,224,246,219,239,192,167,159,30,130,205,102,163,228, -131,156,156,28,140,142,142,94,242,253,48,52,52,68,173,99,137,171,40,171, -96,108,179,217,82,146,248,87,32,138,139,139,161,211,233,32,147,201,160, -84,42,161,213,106,161,209,104,160,215,235,161,209,104,96,48,24,144,157, -157,13,141,70,3,155,205,134,167,158,122,42,161,79,208,198,141,27,81,87, -87,151,84,70,160,213,106,113,239,189,247,210,103,142,148,170,72,255,132, -117,108,100,253,150,248,103,134,60,71,30,143,7,129,64,32,170,25,63,91,155, -21,233,200,200,8,140,70,35,76,38,19,228,114,57,150,45,95,142,107,87,172, -192,138,107,175,69,70,70,6,156,78,39,118,236,216,129,190,190,62,0,83,147, -216,98,177,24,249,249,249,248,251,191,255,123,188,245,214,91,112,187,221, -120,250,233,167,241,181,71,30,73,221,129,73,6,47,210,70,24,24,196,188,71, -165,82,161,176,176,16,183,220,114,11,210,210,210,104,61,86,165,82,97,222, -188,121,116,48,244,220,185,115,168,174,174,78,90,69,55,45,45,13,78,167, -19,111,189,245,22,126,250,211,159,98,213,170,85,168,169,169,133,217,18, -221,32,12,5,131,120,237,141,55,168,38,21,155,137,176,6,99,108,54,197,255, -155,7,148,88,101,46,126,254,36,145,74,66,34,166,87,162,230,188,80,166,194, -102,40,100,14,202,239,247,227,194,133,11,208,233,116,176,217,108,184,241, -166,155,80,83,93,13,151,203,5,139,197,66,23,153,139,45,127,137,197,98,104, -181,90,232,116,58,140,142,142,82,7,72,86,30,131,44,18,41,73,252,203,31, -119,222,121,39,84,42,149,160,244,10,249,183,201,100,194,222,189,123,241, -250,235,175,39,220,208,101,101,101,161,187,187,59,105,226,147,207,231,195, -61,247,220,19,115,42,63,17,97,133,127,86,172,86,43,188,94,47,230,204,153, -19,49,40,28,156,165,42,147,52,63,63,31,255,248,79,255,4,155,205,134,252, -252,124,58,212,232,241,120,176,123,247,110,180,183,183,71,47,52,161,16, -85,164,221,178,101,11,30,121,228,17,28,63,126,252,75,121,195,233,116,58, -204,43,44,68,118,118,54,90,90,90,48,158,164,208,96,126,65,65,68,93,147, -100,38,164,46,154,151,151,135,167,158,122,10,50,153,12,231,207,159,199, -220,185,115,161,86,171,33,149,74,225,241,120,112,242,228,73,156,62,125, -58,161,65,79,68,207,70,173,198,185,115,231,112,252,248,113,60,251,236,179, -168,172,172,196,209,186,58,193,230,161,195,110,199,155,111,190,73,207,141, -79,147,249,58,44,239,86,201,103,41,108,191,37,22,144,240,15,7,121,24,98, -253,157,127,96,226,49,113,98,53,234,147,1,21,159,207,71,7,22,51,50,148, -184,241,198,27,81,91,91,11,143,199,131,209,209,81,148,149,149,1,64,82,160, -146,155,155,27,241,187,245,122,61,174,191,254,122,84,87,87,99,98,98,130, -14,196,9,245,211,82,146,248,151,63,254,233,159,254,105,86,143,183,106,213, -42,52,52,52,36,173,175,247,201,39,159,224,147,79,62,153,213,115,248,250, -215,191,142,236,236,108,250,236,136,197,98,184,221,110,186,65,188,228,30, -10,59,96,211,215,215,135,134,134,134,164,24,8,6,131,1,203,150,45,195,248, -248,56,181,169,252,107,15,165,82,137,194,162,34,136,68,34,116,116,116,224, -147,105,183,63,153,76,134,223,253,238,119,248,195,139,47,38,183,184,79, -155,242,136,197,98,90,23,85,169,84,208,104,52,208,233,116,184,251,238,187, -145,145,145,129,119,223,125,55,105,53,220,120,145,153,153,137,67,135,14, -225,194,133,11,120,230,153,103,80,85,85,133,218,218,218,104,48,9,3,102, -179,9,239,189,247,158,96,86,194,2,9,41,199,177,47,30,80,248,172,36,94,195, -61,22,80,196,154,70,78,84,6,75,212,95,97,123,43,44,176,196,2,21,159,207, -135,225,225,97,204,159,63,31,107,215,174,197,241,227,199,145,150,150,134, -238,238,110,172,89,179,6,167,78,157,138,187,211,203,206,206,198,27,111, -188,129,167,159,126,26,43,86,172,128,72,36,130,197,98,129,213,106,133,222, -96,64,169,88,130,214,214,83,180,110,78,30,112,159,207,23,1,120,169,6,253, -23,51,182,108,217,130,230,230,102,234,159,195,43,172,95,174,8,133,66,112, -187,221,116,243,66,202,195,147,147,147,151,76,29,150,2,160,55,233,175,126, -245,171,25,253,48,145,184,127,225,133,23,18,122,208,151,87,84,224,208,161, -67,40,44,44,196,156,57,115,160,84,42,167,252,66,38,39,49,49,49,65,7,188, -174,182,80,107,52,152,59,119,46,66,161,16,78,159,62,141,250,99,199,112, -240,208,161,40,213,81,0,56,116,232,16,230,204,153,147,84,83,60,211,104, -196,13,55,220,64,51,64,182,201,166,213,106,177,108,217,50,116,118,118,206, -10,152,100,103,103,227,221,119,223,133,221,110,199,119,190,243,29,172,95, -191,30,53,53,181,211,138,192,92,111,103,124,28,187,118,125,28,145,149,144, -23,11,36,108,159,135,237,245,176,96,194,91,32,243,158,49,66,170,210,66, -11,60,235,121,35,164,155,20,11,112,46,22,88,132,122,42,4,80,228,114,57, -6,7,7,145,155,155,139,107,175,189,22,167,79,159,70,90,90,26,26,26,26,112, -211,77,55,161,182,182,54,230,231,48,54,54,134,71,30,121,4,127,248,195,31, -240,216,99,223,196,132,213,26,65,203,182,217,109,112,58,157,81,54,214,172, -41,220,165,106,45,165,2,81,247,220,229,136,117,235,214,161,171,171,43,162, -156,73,60,232,47,119,4,131,65,170,49,39,147,201,34,64,229,82,9,32,17,239, -168,180,180,52,41,219,95,82,11,212,104,52,56,127,254,60,142,198,121,136, -0,96,85,85,21,222,127,255,125,116,118,118,226,236,217,179,17,31,42,89,100, -22,45,90,132,185,115,231,226,161,135,30,194,251,239,191,143,9,139,229,138, -222,116,75,150,46,69,119,119,55,246,236,217,3,191,223,31,193,146,224,167, -190,201,123,216,183,111,31,158,121,230,153,132,30,50,165,11,22,224,246, -219,111,71,102,102,38,106,106,106,81,93,125,36,130,185,97,52,26,97,52,26, -81,93,93,125,201,239,195,104,52,226,79,127,250,19,60,30,15,214,173,91,135, -251,238,187,15,39,78,156,16,236,153,184,156,46,236,221,187,135,250,99,179, -128,194,102,36,164,41,72,254,100,51,20,182,196,197,94,35,114,12,226,106, -231,243,249,96,181,90,225,114,185,225,241,184,49,49,49,1,127,32,56,221, -39,202,128,86,163,129,86,171,165,89,28,17,95,140,101,122,198,42,189,198, -203,92,18,1,11,217,181,241,160,34,147,201,40,168,200,100,50,88,44,22,100, -101,101,161,164,164,20,125,125,231,33,149,74,113,252,248,113,44,95,190, -60,174,154,129,201,100,66,122,122,58,60,30,119,148,116,208,240,208,144, -160,98,49,1,19,114,142,169,248,98,1,202,150,45,91,208,222,222,14,151,203, -21,49,172,76,158,133,43,145,161,88,173,86,90,109,32,226,144,228,121,185, -20,2,136,148,92,224,145,145,17,172,88,177,34,105,64,233,234,234,194,214, -173,91,227,50,26,196,18,9,214,172,89,131,7,31,124,16,165,165,165,216,182, -109,27,142,29,59,22,37,39,32,145,72,48,56,56,8,153,76,134,245,235,215,227, -236,116,38,144,76,61,90,163,213,2,0,188,211,74,175,108,120,60,158,184,195, -69,241,162,161,161,1,135,15,31,166,125,14,222,59,128,103,43,145,157,249, -127,255,247,127,227,158,187,239,198,145,35,71,4,143,91,84,92,140,59,238, -184,99,138,166,39,147,161,226,154,10,28,63,222,16,177,80,231,231,231,35, -16,8,92,178,143,59,161,5,7,131,65,228,228,228,224,251,223,255,62,122,123, -207,99,112,40,90,82,91,44,18,209,204,132,29,76,36,55,29,155,141,16,134, -9,1,21,66,89,100,75,100,228,24,164,156,71,6,246,46,92,184,128,174,115,221, -112,185,98,147,8,172,214,9,240,239,124,222,220,121,40,40,200,167,170,1, -188,78,17,123,47,177,2,121,66,165,51,161,6,62,145,237,102,7,212,8,176,16, -187,2,30,84,172,86,43,148,74,5,178,178,178,96,181,90,225,112,56,224,114, -185,144,149,149,133,241,241,241,152,15,243,154,53,107,240,243,159,255,28, -63,249,201,211,127,1,246,240,148,124,139,88,44,22,20,240,35,127,126,190, -70,101,95,142,32,247,200,231,189,152,151,150,150,162,180,180,20,103,207, -158,165,153,38,209,117,35,170,18,87,2,80,130,193,32,172,86,43,45,167,146, -77,10,121,166,72,191,240,98,250,41,82,114,129,129,169,166,45,121,104,18, -197,225,195,135,177,118,237,218,152,222,17,153,70,35,214,172,89,131,251, -239,191,31,125,125,125,24,24,24,192,29,119,220,129,150,150,22,202,108,226, -27,180,91,183,110,133,197,98,193,241,198,198,132,191,95,161,84,194,58,57, -137,87,95,123,77,80,44,141,231,98,255,244,167,63,133,221,110,199,129,233, -158,71,162,99,143,76,83,65,201,113,73,15,129,109,62,243,165,157,239,126, -247,187,216,177,99,7,142,214,213,97,245,234,213,56,214,208,64,103,116,74, -74,75,81,92,92,140,77,155,54,65,163,209,160,190,254,24,2,129,0,50,13,153, -81,84,91,171,213,138,19,39,78,92,114,153,235,213,87,95,165,11,209,191,255, -251,191,195,231,243,77,251,182,68,238,140,101,105,50,236,216,241,110,196, -2,205,203,60,16,32,81,169,84,244,79,182,220,197,107,3,177,220,118,167,211, -137,134,134,227,24,55,141,95,244,251,185,208,127,1,23,250,47,64,34,150, -160,172,108,33,149,134,103,127,159,208,128,164,208,110,148,204,241,176, -62,58,196,136,140,5,23,50,95,32,149,74,169,173,2,63,196,73,252,78,200,207, -140,140,140,96,195,134,13,248,240,195,15,99,190,151,209,209,81,44,93,186, -20,131,131,3,80,78,255,108,154,44,13,54,155,13,90,173,86,144,68,48,155, -138,176,95,246,72,75,75,131,88,44,198,199,31,127,140,162,162,162,89,61, -182,94,175,199,202,149,43,169,189,195,153,51,103,104,166,73,50,19,178,158, -248,253,126,188,251,238,187,87,4,80,38,39,39,35,192,132,220,231,50,153, -140,186,55,94,52,160,144,3,58,157,78,172,93,187,22,159,126,250,105,194, -31,92,191,126,61,158,123,238,57,220,127,223,125,81,89,201,242,101,203,224, -243,251,241,192,3,15,224,196,137,19,56,122,244,40,149,132,95,177,98,5,186, -186,186,34,38,173,201,124,197,205,55,223,60,165,173,148,4,165,174,172,172, -12,95,255,250,215,97,54,155,81,91,91,27,33,130,198,179,136,68,34,17,198, -198,198,144,147,147,147,212,69,41,41,41,193,147,79,62,137,255,252,207,255, -68,109,109,109,196,132,42,187,43,103,165,11,210,210,210,96,48,24,240,55, -127,243,32,250,250,206,163,173,173,13,229,229,229,200,207,207,71,118,118, -54,86,174,92,9,157,78,135,206,206,78,52,51,243,34,226,105,58,40,63,61,126, -225,194,5,84,84,84,192,227,241,96,114,114,146,238,148,125,62,31,149,92, -137,21,50,153,12,187,119,239,166,126,231,27,55,110,196,178,101,203,240, -233,167,159,70,73,206,139,197,18,212,215,215,209,25,8,246,198,226,135,168, -216,23,203,129,103,175,1,121,88,20,10,5,149,145,63,215,221,61,123,15,67, -40,136,179,109,109,72,75,147,97,225,130,82,88,173,214,152,131,147,100,55, -72,0,35,30,253,152,5,24,2,46,228,158,98,129,133,7,20,146,121,145,221,157, -88,44,134,197,98,65,97,97,33,165,218,11,197,178,101,203,240,194,11,47,224, -151,191,252,37,134,134,135,225,243,122,99,170,104,179,25,213,231,225,190, -249,215,20,30,143,7,63,250,209,143,224,247,251,225,245,122,169,157,57,145, -203,113,185,92,232,236,236,68,48,24,132,217,108,134,74,165,194,173,183, -222,26,33,247,78,24,120,108,185,145,221,120,8,169,98,135,195,97,56,157, -78,88,44,22,244,244,244,68,100,152,228,158,98,159,45,178,81,27,24,24,192, -214,173,91,169,109,6,249,221,36,19,102,253,74,200,57,16,202,178,144,204, -10,159,149,147,96,75,197,46,151,43,194,6,152,84,18,72,249,43,24,12,94,116, -38,76,1,133,120,96,39,139,216,139,22,45,194,254,253,251,177,123,207,30, -172,93,187,22,146,105,137,114,99,86,22,122,123,123,113,224,192,1,108,216, -176,1,53,53,53,17,233,254,166,77,155,48,52,52,20,49,17,46,147,201,144,159, -159,143,185,115,231,226,141,55,222,72,248,187,87,85,85,225,209,71,31,197, -216,216,24,110,189,245,86,180,180,180,208,250,55,11,82,236,5,239,239,239, -143,169,2,43,180,131,185,230,154,107,112,219,109,183,161,185,185,25,105, -105,105,116,87,78,38,83,217,69,149,188,7,171,213,10,136,166,24,85,143,61, -246,24,116,58,29,128,41,149,217,11,23,250,209,216,212,4,47,39,89,19,10, -5,177,98,197,10,244,246,246,70,201,73,251,253,126,74,37,14,6,131,208,235, -245,40,42,42,194,107,175,189,150,176,70,124,254,252,121,132,195,97,200, -100,50,124,251,219,223,70,103,103,39,108,246,104,145,71,167,195,129,161, -161,33,106,106,197,78,235,179,50,15,228,189,171,213,234,40,81,58,190,204, -165,84,42,225,241,120,112,228,72,13,220,30,215,231,178,112,248,253,62,156, -57,123,22,11,74,75,49,62,62,30,193,46,227,213,5,248,107,19,143,175,207, -250,71,196,2,150,88,194,151,228,235,118,187,29,139,23,47,142,11,40,227, -227,227,40,41,41,153,162,26,135,129,193,193,104,34,71,34,23,209,84,8,63, -187,101,101,101,212,25,214,108,54,195,231,243,193,235,245,98,114,114,18, -54,155,141,186,209,138,68,34,88,173,86,56,157,78,90,214,38,94,76,4,128, -136,105,26,59,100,202,102,241,236,26,35,212,167,227,165,79,248,225,101, -50,220,72,190,159,88,32,56,28,14,216,237,118,90,70,101,207,129,85,213,136, -37,91,207,247,18,133,206,129,148,114,89,224,100,5,84,47,9,80,136,151,188, -195,225,64,69,69,5,109,158,39,74,219,55,111,222,140,226,226,98,204,153, -51,7,121,121,121,48,153,76,40,46,46,134,209,104,196,7,31,124,128,149,43, -87,70,60,88,46,151,11,115,230,204,137,240,141,72,79,79,199,226,197,139, -97,181,90,113,54,193,148,233,210,101,203,176,117,235,86,216,237,118,252, -249,207,127,134,219,237,198,214,173,91,177,107,215,174,136,65,59,118,167, -42,145,72,112,254,252,121,202,189,142,23,115,231,206,69,69,69,5,218,218, -218,48,49,49,129,77,155,54,225,216,177,99,148,210,75,38,101,53,26,77,148, -48,27,0,232,117,58,140,140,140,160,41,9,153,121,18,115,230,204,161,238, -152,66,250,64,228,239,10,133,34,97,57,82,171,213,226,149,87,94,161,41,246, -157,119,222,137,172,172,44,180,158,62,29,245,189,114,153,28,251,63,249, -132,150,0,132,110,122,22,72,9,152,18,48,225,123,38,34,145,8,233,233,233, -240,122,189,56,120,232,211,56,190,41,179,23,93,231,206,33,47,55,15,38,211, -56,205,26,217,38,182,144,27,103,188,191,243,78,158,66,192,34,244,98,101, -195,237,118,59,221,76,196,139,27,111,188,17,63,251,217,207,240,228,147, -79,226,200,145,195,113,105,209,169,72,190,63,66,238,99,118,231,77,158,157, -80,40,20,49,235,195,110,8,88,64,225,21,126,249,198,181,144,34,118,172,77, -10,255,92,177,253,72,242,12,17,111,38,159,207,71,207,133,28,147,100,253, -228,28,216,175,243,190,38,66,247,246,229,12,41,139,236,164,33,179,114,229, -202,132,128,2,0,171,87,175,70,111,111,47,10,10,10,208,217,217,137,83,173, -173,84,52,50,55,55,23,7,15,30,196,125,247,221,23,1,40,30,143,7,155,55,111, -198,190,125,251,34,152,67,106,181,58,161,156,243,130,5,11,112,195,13,55, -64,173,86,227,131,15,62,160,138,175,139,23,47,198,193,131,7,35,250,27,236, -238,153,124,64,103,206,156,129,90,173,134,221,46,44,199,174,84,42,97,179, -219,161,86,171,233,57,47,94,188,24,173,173,173,84,221,147,204,137,104,181, -90,186,192,146,155,34,16,8,64,165,82,205,248,67,32,158,209,66,18,33,228, -6,10,135,195,80,42,149,49,207,253,47,13,109,43,253,12,136,69,109,103,103, -103,180,152,103,24,104,107,59,27,81,18,34,148,94,33,64,225,179,50,86,250, -154,125,136,69,34,17,234,234,235,47,11,152,144,24,30,25,70,186,92,14,179, -217,28,65,179,101,1,133,93,164,227,61,124,44,69,153,7,22,33,118,153,80, -207,142,28,39,145,44,139,197,98,129,70,163,193,235,175,191,14,183,219,13, -181,90,45,248,125,252,249,165,140,186,226,135,92,46,167,22,204,236,140, -23,217,20,16,87,88,54,219,32,247,46,1,148,41,38,222,84,115,154,148,158, -216,178,83,162,97,92,62,43,32,89,63,203,148,36,107,21,249,221,164,212,196, -155,207,145,247,195,158,3,127,63,38,82,148,16,58,151,68,51,98,151,4,40, -236,7,225,116,58,81,92,92,28,215,190,146,128,195,201,147,39,113,219,109, -183,97,148,155,151,240,7,2,216,186,117,43,118,238,220,137,85,171,86,69, -248,211,187,221,110,100,102,102,34,16,8,208,197,127,108,108,44,110,239, -164,164,164,4,157,93,93,248,230,183,190,133,35,71,142,192,194,208,138,109, -54,27,230,206,157,11,151,203,21,209,223,32,31,24,89,244,154,154,154,176, -241,214,91,169,67,36,27,243,230,205,131,78,175,199,235,175,191,142,242, -242,114,20,20,20,0,64,132,247,0,171,240,73,50,21,22,80,68,34,17,117,233, -155,105,154,206,14,213,241,116,81,114,83,104,52,26,116,199,233,71,100,100, -100,224,117,134,178,124,253,245,215,99,238,220,185,216,191,255,64,212,247, -166,167,203,113,225,194,5,202,133,103,201,7,124,35,158,109,198,11,249,40, -144,155,79,34,145,96,116,116,116,214,84,120,103,18,161,208,20,135,158,215, -193,98,173,158,217,135,159,253,186,208,226,205,131,16,219,99,137,37,131, -193,30,219,233,116,162,168,168,40,46,160,132,66,33,108,216,176,1,59,118, -236,128,66,161,72,170,135,194,146,6,82,33,28,10,133,2,46,151,139,246,242, -216,126,1,33,29,145,108,131,101,9,18,64,97,123,24,132,194,205,102,189,236, -253,20,207,99,158,205,148,120,63,120,222,24,139,52,203,9,16,178,195,196, -74,165,50,10,80,248,222,72,50,195,193,188,0,45,89,215,248,115,145,72,36, -144,203,229,151,14,40,228,131,176,219,237,168,170,170,74,10,80,174,187, -238,186,152,13,28,121,186,2,54,155,13,69,69,69,17,128,226,116,58,177,122, -245,106,212,213,213,81,196,116,56,28,232,61,127,30,18,169,52,10,88,174, -187,254,122,20,21,21,225,244,153,51,216,177,99,7,221,209,147,8,4,2,184, -245,214,91,113,224,192,129,136,5,144,0,11,145,103,6,166,134,203,182,220, -126,59,252,126,63,189,193,140,70,35,86,172,88,1,96,202,244,230,228,201, -147,88,181,106,21,186,187,187,97,177,88,144,151,151,71,175,143,16,117,150, -136,179,17,202,103,122,186,2,30,79,242,78,144,18,137,52,106,34,155,189, -137,201,141,160,213,106,227,46,80,100,87,78,22,183,45,91,182,224,194,133, -11,209,82,244,97,160,173,173,45,98,176,42,86,118,194,139,208,177,37,69, -54,53,39,199,104,239,232,184,34,139,136,207,239,131,78,167,195,240,240, -112,84,121,130,159,87,225,31,64,33,10,41,11,30,66,95,19,178,100,229,143, -55,111,222,60,28,75,64,127,207,204,204,196,109,183,221,70,169,156,94,174, -57,207,151,61,67,161,80,106,184,49,65,176,21,3,146,233,3,83,12,171,244, -244,116,74,223,37,128,194,222,23,164,74,192,106,185,145,103,145,45,67,243, -139,53,255,119,182,9,207,2,10,175,36,65,54,187,60,160,176,0,68,178,36,150, -32,32,116,111,198,42,117,9,157,19,191,113,228,65,229,98,165,236,165,252, -7,65,16,44,217,94,138,86,171,197,123,239,189,135,77,155,54,69,53,125,67, -161,32,54,109,218,132,143,62,250,8,203,150,45,139,0,40,135,195,1,185,92, -30,241,102,187,186,186,112,235,198,141,232,154,158,133,49,24,12,208,235, -245,88,187,118,45,74,74,74,32,147,201,176,109,219,54,252,243,63,255,115, -20,207,159,12,193,177,139,62,91,239,39,125,130,85,171,86,97,193,130,5,244, -166,242,122,189,176,219,237,56,127,254,60,198,77,38,172,91,191,30,191,254, -213,175,40,35,44,20,10,161,170,170,10,45,45,45,81,146,242,236,228,56,185, -49,92,46,23,230,207,47,78,170,100,24,177,32,78,239,134,200,139,45,219,176, -101,177,88,32,159,150,150,134,207,62,251,44,162,252,180,97,195,6,156,18, -240,92,80,40,20,24,25,25,137,224,227,243,59,23,22,56,99,129,9,217,213,145, -69,52,20,10,93,145,236,228,47,25,154,10,102,179,153,94,51,94,182,155,183, -71,229,51,144,88,187,59,33,192,97,169,199,108,22,73,238,25,191,223,159, -84,249,115,120,120,24,183,220,114,11,165,236,107,181,90,216,237,118,140, -142,142,226,252,249,243,130,211,251,14,135,131,62,171,169,16,14,157,78, -23,145,81,176,236,67,182,148,204,102,151,236,125,204,87,11,216,102,53,159, -65,10,101,40,108,137,73,72,50,158,237,61,146,123,41,24,12,70,128,9,41,187, -9,177,189,132,72,26,177,250,38,236,121,241,102,91,108,214,68,158,239,140, -140,140,139,222,176,72,133,250,8,94,175,23,46,151,11,139,23,47,78,184,48, -90,44,22,248,124,62,232,245,122,65,22,145,68,58,165,148,59,111,222,188, -40,64,89,182,108,25,90,91,91,35,62,36,183,199,131,202,202,74,40,20,10,20, -22,22,98,254,252,249,176,219,237,168,169,169,129,199,235,197,218,181,107, -209,211,211,3,189,94,31,65,159,53,153,76,88,185,114,37,122,122,122,162, -40,175,108,150,226,245,122,209,219,219,27,119,39,93,89,89,137,222,222,94, -164,165,165,193,239,247,79,249,215,115,181,70,33,119,66,137,68,2,191,223, -143,236,172,44,204,12,78,194,116,103,66,82,108,118,87,4,76,77,188,79,76, -76,196,108,202,27,12,6,42,167,16,10,133,112,195,13,55,64,46,151,195,100, -138,238,75,141,140,12,83,48,33,76,20,161,93,75,60,106,48,223,136,156,98, -165,93,89,235,232,80,56,68,75,161,252,60,13,59,185,79,108,3,72,54,199,131, -135,16,176,240,165,51,190,60,197,3,74,40,20,74,186,252,201,50,33,217,126, -97,121,121,57,140,70,35,134,134,134,232,134,131,44,64,22,139,5,58,157,46, -149,169,196,41,35,235,116,186,8,202,46,155,181,176,189,16,150,110,203,246, -50,121,149,130,68,243,64,66,128,194,123,193,11,25,230,145,251,137,252,78, -22,120,148,74,101,20,168,241,204,191,68,13,120,190,127,200,103,78,252,239, -211,104,52,151,222,148,103,119,175,14,135,131,202,75,84,86,86,38,28,178, -91,186,116,41,142,29,59,134,194,162,98,120,189,209,180,216,155,110,218, -128,221,187,119,211,25,20,246,141,178,156,111,242,161,45,93,186,20,26,141, -6,30,143,7,205,45,45,24,24,24,4,25,198,155,63,191,4,31,126,248,1,190,241, -141,111,68,61,136,243,230,205,67,95,95,159,96,170,73,202,82,118,187,29, -115,230,204,137,251,126,170,170,170,112,236,216,49,84,86,86,162,165,165, -5,102,179,153,106,79,9,213,73,249,114,10,0,40,21,10,184,220,238,36,225, -4,17,128,194,103,40,98,177,24,89,89,89,232,136,3,130,102,179,153,206,94, -132,195,97,44,94,188,24,253,253,253,81,102,89,74,165,18,141,39,78,208,93, -17,161,33,242,83,241,66,181,94,158,138,205,103,39,252,192,228,229,14,82, -54,226,237,78,217,41,254,64,32,16,1,136,177,118,155,66,101,141,120,95,231, -165,192,9,152,93,108,116,117,117,209,103,165,172,172,12,217,217,217,112, -185,92,17,96,22,12,6,161,211,233,82,10,196,113,74,95,122,189,30,147,147, -147,180,185,205,238,242,99,185,128,10,169,82,199,202,78,226,45,220,60,168, -176,27,80,178,38,177,247,136,223,239,135,221,110,167,82,63,228,124,227, -177,22,147,13,126,205,226,135,152,201,104,196,165,128,137,32,160,176,6, -74,30,143,7,57,57,57,80,40,20,49,61,180,129,41,102,209,241,227,199,81,89, -89,137,1,129,201,121,153,76,142,254,254,126,220,121,231,157,17,128,50,54, -54,134,178,178,50,116,119,119,211,244,82,42,149,226,212,169,83,152,51,103, -142,224,177,188,62,47,10,139,138,224,245,122,233,46,147,109,206,179,101, -0,114,1,89,36,158,82,247,77,23,92,76,104,233,68,165,70,115,115,51,182,110, -221,138,150,150,22,248,124,62,148,149,149,97,112,112,80,144,214,203,151, -65,236,118,59,138,138,103,86,246,98,27,128,124,170,93,90,90,10,153,76,134, -83,167,78,9,254,172,76,38,67,91,91,27,5,20,178,195,21,18,220,156,180,90, -35,174,91,44,22,138,144,54,87,44,138,34,89,220,46,150,25,50,91,225,118, -185,97,179,217,4,251,64,94,175,23,153,153,153,17,76,186,120,162,146,177, -202,93,66,95,103,179,29,246,122,206,214,245,232,232,232,64,71,71,7,150, -47,95,30,197,4,12,135,195,212,6,54,21,194,160,66,74,71,110,183,59,162,33, -31,171,247,32,212,187,226,51,210,120,37,39,190,199,70,158,25,214,67,72, -168,92,73,228,88,252,126,63,220,110,55,220,110,119,4,219,147,215,160,155, -41,160,176,96,199,150,191,228,114,57,84,42,213,236,56,54,10,125,81,173, -86,211,29,179,213,106,197,134,13,27,176,103,207,158,184,205,224,155,110, -186,9,61,61,61,144,167,43,34,20,84,1,32,16,244,227,238,187,239,198,246, -237,219,81,85,85,21,209,160,207,200,200,136,96,53,133,66,33,140,140,140, -160,170,170,74,16,80,0,96,233,146,37,216,181,107,23,182,108,217,130,147, -39,79,70,149,209,136,189,38,223,64,35,187,3,135,195,142,44,99,22,198,198, -199,98,44,238,94,148,148,148,96,120,120,152,50,223,84,42,85,148,49,147, -208,135,77,192,97,38,101,175,112,24,81,78,129,228,90,204,159,63,31,133, -133,133,56,115,230,76,76,229,97,189,94,15,167,211,73,119,230,34,145,8,165, -165,165,104,111,239,224,234,254,18,116,116,116,68,212,139,89,192,229,51, -20,182,222,43,212,131,16,122,176,36,18,169,128,133,240,229,137,222,222, -30,184,92,46,250,98,7,211,36,18,9,114,115,115,113,242,228,73,100,101,101, -65,175,215,71,76,198,199,218,173,10,53,231,249,50,24,191,136,16,80,153, -237,24,31,31,135,90,173,22,44,197,4,131,193,75,222,93,126,25,128,133,100, -178,108,185,147,95,220,121,203,104,246,185,79,184,160,78,127,238,60,165, -124,38,139,53,217,212,107,52,26,74,10,224,207,225,98,6,15,201,251,37,224, -225,188,79,0,0,32,0,73,68,65,84,207,59,57,175,217,236,197,73,99,93,124, -182,4,98,177,88,176,112,225,194,105,29,40,225,240,251,253,120,237,181,215, -240,227,31,255,56,138,66,76,22,77,66,71,102,1,101,108,108,12,6,131,1,78, -167,51,226,33,25,24,24,64,134,74,5,167,128,129,84,96,122,103,70,148,104, -217,139,75,166,202,249,135,142,60,244,18,137,100,218,76,108,78,76,64,33, -101,188,186,186,58,172,89,179,6,39,78,156,160,31,42,111,196,196,238,20, -217,29,128,195,225,128,65,159,9,203,132,57,233,114,13,11,86,139,23,47,198, -45,183,220,2,157,78,135,190,190,62,28,60,120,48,230,207,178,179,36,18,137, -132,46,152,54,219,100,84,57,83,168,73,199,126,214,66,44,20,190,204,21,171, -102,235,241,120,80,90,90,18,183,52,247,121,133,8,34,236,219,183,15,225, -112,152,130,8,233,69,1,64,121,121,57,60,30,15,254,248,199,63,226,107,95, -251,26,157,249,72,198,253,46,17,168,176,153,10,91,179,159,109,101,96,34, -153,65,178,88,254,190,147,72,36,169,76,37,137,32,139,124,162,255,191,26, -250,83,4,92,190,40,17,51,39,87,169,84,116,215,74,188,179,181,211,202,190, -177,110,246,13,27,54,224,245,215,95,71,90,154,76,232,137,199,109,155,55, -227,213,87,95,69,97,97,97,4,82,14,13,13,69,141,252,119,118,118,98,126,12, -25,152,112,56,140,117,235,214,97,215,174,93,88,178,100,73,196,255,13,13, -13,209,172,135,159,231,32,15,191,215,235,141,251,94,0,64,167,211,227,244, -233,211,180,223,50,62,62,46,120,220,88,116,66,135,195,129,249,243,139,147, -71,118,169,20,55,223,124,51,158,120,226,9,60,251,236,179,184,239,190,251, -96,181,90,241,246,219,111,99,231,206,157,113,23,167,201,201,201,8,182,86, -110,110,46,236,118,59,60,28,157,123,210,58,17,69,117,21,162,52,242,210, -37,66,153,9,95,34,32,229,129,44,163,81,248,243,255,156,163,163,163,29,38, -147,41,138,17,37,22,139,167,164,129,36,18,252,226,231,63,135,99,154,65, -197,46,204,66,247,74,162,122,121,172,146,9,185,182,132,208,49,155,33,149, -74,97,177,88,48,49,49,129,201,201,73,170,108,225,118,187,41,91,49,37,111, -159,138,43,25,49,243,242,140,140,12,74,237,85,40,20,152,152,152,192,202, -149,43,113,232,208,161,152,41,229,153,51,103,112,230,204,25,232,245,122, -172,91,191,62,138,145,20,10,133,17,8,4,208,214,214,134,220,220,92,140,141, -141,161,179,179,51,106,87,69,116,172,200,176,160,208,131,45,151,203,49, -52,52,4,163,209,200,253,142,16,22,46,92,136,83,167,78,9,210,254,200,194, -75,88,50,177,228,237,61,94,15,109,108,171,84,42,56,28,14,170,181,195,31, -151,95,128,200,14,117,98,194,146,112,90,90,42,145,66,165,202,192,129,3, -7,32,147,201,208,211,211,131,214,214,86,244,244,244,68,12,111,198,139,238, -238,238,8,15,242,156,156,156,104,143,249,48,48,56,56,72,23,60,161,114,151, -144,14,150,16,213,54,30,171,196,227,241,96,225,130,82,156,153,33,109,250, -82,119,238,191,255,253,239,35,134,177,194,225,48,210,210,210,112,239,189, -247,66,163,209,224,15,47,190,72,173,25,70,70,70,104,25,140,149,207,96,95, -124,169,32,86,150,34,4,46,100,103,121,177,214,9,177,130,16,101,88,246,31, -75,77,149,74,165,112,58,157,169,210,87,42,174,62,64,1,166,102,59,72,121, -71,169,84,210,38,250,216,216,24,45,81,169,166,173,108,235,234,234,112,238, -220,57,200,229,114,156,56,113,2,35,35,35,120,232,161,135,225,137,96,125, -133,113,199,157,119,226,229,151,94,130,78,167,163,18,201,177,24,17,189, -189,189,200,143,209,156,247,120,189,216,176,225,102,84,87,87,99,193,130, -5,17,205,126,175,215,27,181,83,229,75,95,110,183,27,215,84,84,160,246,232, -209,152,239,191,172,108,17,118,239,222,141,245,235,215,195,98,177,160,177, -177,145,94,147,88,96,66,22,21,194,34,74,147,74,161,81,107,96,179,219,162, -250,25,161,80,16,55,223,188,1,19,19,19,248,236,179,207,208,219,219,59,99, -149,79,153,76,134,177,177,49,186,200,72,36,18,104,52,154,40,18,133,74,173, -130,207,231,139,0,19,150,206,24,207,178,55,158,20,131,80,147,50,16,8,160, -180,164,20,231,186,207,125,238,55,176,207,235,195,15,254,245,95,163,140, -182,100,50,25,30,121,228,17,24,12,6,188,248,251,223,163,190,190,62,2,128, -60,30,79,196,207,240,20,112,161,94,73,60,158,127,116,47,73,2,147,201,52, -107,101,15,131,193,128,63,255,249,207,200,200,200,136,162,122,179,27,2, -183,219,157,2,148,84,92,125,37,47,146,117,176,180,91,226,251,64,202,70, -38,147,9,205,205,205,56,112,224,0,45,9,145,185,133,137,137,9,188,248,226, -239,49,62,54,6,169,68,138,52,105,26,210,166,119,80,114,185,156,154,20,241, -70,85,236,203,108,54,83,9,20,161,200,201,201,70,93,93,29,45,161,1,83,62, -32,117,117,117,17,77,53,158,169,65,50,160,68,252,237,116,69,58,250,251, -251,113,250,244,105,132,195,97,65,247,60,161,121,4,86,181,151,252,62,131, -222,0,69,250,212,124,135,207,235,197,187,219,223,193,178,165,75,209,215, -215,135,29,59,118,160,189,189,253,162,36,163,9,131,133,200,50,144,236,210, -207,53,16,9,11,75,104,98,150,0,9,15,42,188,130,169,80,153,75,8,84,68,34, -17,156,78,7,242,242,242,32,149,126,126,245,223,241,177,49,252,203,191,252, -51,149,222,39,47,131,193,128,127,249,151,127,65,113,113,49,222,122,235, -173,8,48,1,0,235,196,4,92,46,23,156,78,39,156,78,39,109,226,39,51,68,38, -148,45,11,125,77,34,145,36,100,249,101,102,102,226,211,79,63,69,91,91,27, -134,166,221,26,101,50,25,116,58,29,244,122,61,52,26,13,164,82,41,108,54, -27,172,86,43,108,54,27,28,14,71,196,121,19,230,18,59,183,52,219,165,182, -84,164,98,86,50,148,169,94,130,46,162,17,205,54,4,249,41,84,150,146,71, -22,32,214,99,155,44,174,25,25,25,81,147,217,124,51,152,52,132,237,118,59, -212,42,21,236,2,205,121,183,199,131,37,75,150,224,195,15,63,68,94,94,30, -228,114,57,246,239,223,15,169,84,42,232,202,199,158,151,72,36,130,221,110, -71,65,126,1,6,6,133,157,17,253,126,63,174,187,238,58,28,61,122,20,70,163, -49,74,2,35,214,177,89,54,133,92,46,135,199,227,129,197,98,129,201,100,194, -248,248,56,157,107,201,201,201,193,71,31,125,116,201,11,128,199,227,161, -217,9,97,121,5,184,33,67,187,205,22,213,116,102,41,226,188,66,179,208,188, -9,185,158,163,163,163,200,201,201,17,164,49,178,253,153,137,137,9,4,252, -126,232,245,58,76,76,76,73,251,207,70,248,253,126,236,217,189,59,66,97, -154,188,10,11,11,241,236,179,207,66,171,213,226,181,215,94,195,103,2,222, -62,98,137,4,14,135,35,74,9,150,237,179,9,233,115,37,218,128,144,107,64, -12,185,226,201,215,3,83,179,67,47,190,248,34,92,46,23,6,7,7,169,250,131, -72,36,66,102,102,38,178,178,178,80,92,92,12,169,84,138,195,135,15,67,171, -213,98,223,190,125,17,162,133,236,243,200,110,116,82,3,143,169,184,42,1, -133,12,188,4,2,1,65,105,112,2,38,46,151,43,202,78,50,214,174,150,109,92, -18,57,4,214,184,138,85,225,28,27,27,67,81,81,49,90,79,183,10,158,223,146, -37,75,240,202,43,175,32,61,61,29,45,45,45,212,3,36,22,107,135,101,55,217, -108,54,20,20,228,199,4,148,169,178,87,25,234,234,234,224,112,56,34,122, -61,66,199,36,191,143,128,171,144,175,8,41,199,133,195,97,212,214,214,198, -180,138,77,54,8,171,137,189,206,74,165,18,17,107,95,120,106,241,98,203, -86,66,150,198,188,15,124,44,153,146,55,223,120,3,247,220,115,15,138,138, -139,5,65,150,61,126,32,224,71,123,123,59,36,18,9,230,206,157,11,175,207, -143,80,232,34,26,199,97,192,110,183,225,131,15,62,192,225,195,135,169,46, -19,155,61,175,91,183,14,223,251,222,247,144,150,150,134,95,253,242,151, -104,111,111,23,60,212,20,3,206,22,197,114,99,229,56,72,233,149,165,151, -38,11,42,82,169,20,23,46,92,72,248,150,156,78,39,242,243,243,177,111,223, -62,136,68,98,24,141,70,10,4,34,177,24,102,179,25,163,163,99,83,243,8,161, -32,125,254,120,2,1,159,137,167,26,243,169,184,106,1,5,152,82,185,37,146, -207,124,115,155,236,194,149,74,101,4,160,176,139,174,80,166,192,171,219, -178,218,81,4,80,136,60,136,82,169,136,217,156,15,99,42,227,105,104,104, -160,199,227,101,81,248,5,146,109,188,58,157,78,104,181,58,76,78,90,5,203, -22,118,187,93,208,255,130,175,217,179,181,123,118,42,63,24,12,82,197,83, -178,16,144,107,119,240,224,65,220,124,243,205,49,7,22,147,137,96,48,8,143, -199,67,223,99,56,28,134,219,237,70,32,16,140,40,139,145,254,9,253,224,153, -9,89,190,244,24,175,212,5,0,107,214,174,197,51,207,60,131,39,159,124,18, -215,44,94,76,7,27,89,150,30,1,20,150,122,94,93,93,13,151,203,133,69,139, -22,33,43,43,11,105,105,83,147,235,177,50,151,112,40,12,183,199,141,211, -173,173,248,224,131,15,48,49,49,197,82,203,200,200,136,144,138,209,104, -52,120,242,201,39,113,207,61,247,96,104,104,8,191,255,253,239,113,33,78, -118,96,152,6,20,242,25,147,137,100,242,111,246,218,240,18,246,241,128,132, -221,44,85,87,87,39,204,252,181,90,45,250,251,251,225,157,38,175,120,56, -149,9,62,236,118,71,212,96,109,202,30,56,21,95,56,64,33,15,0,15,38,100, -119,199,42,98,242,13,106,94,247,136,125,240,248,178,23,251,34,11,91,40, -20,66,127,127,63,178,179,179,163,216,82,178,52,57,6,135,6,104,86,66,22, -7,246,197,219,194,178,3,122,83,181,126,39,84,25,25,16,139,128,96,40,132, -112,40,4,183,199,131,193,129,1,180,180,180,192,102,179,69,53,171,217,166, -53,239,35,192,126,31,16,169,11,36,84,38,172,171,171,67,101,101,37,218,218, -218,46,234,3,116,185,92,48,26,141,48,153,76,17,215,94,42,149,48,89,166, -52,42,147,226,173,108,99,249,34,240,139,104,40,20,162,206,151,207,63,255, -60,54,222,122,43,238,190,251,110,65,242,3,201,66,201,134,129,108,56,154, -154,154,96,179,217,96,183,219,225,245,122,81,88,88,136,236,236,108,250, -179,231,207,159,71,115,115,51,21,240,36,231,172,82,169,34,22,124,185,92, -142,107,174,185,6,79,61,245,20,242,242,242,112,248,240,97,108,219,182,45, -161,133,180,68,42,133,213,106,165,101,63,242,123,216,251,49,89,234,48,223, -95,145,72,36,48,155,205,49,135,80,233,189,43,147,161,178,178,18,227,51, -104,220,79,76,88,226,158,67,10,84,82,241,133,1,20,86,108,141,207,48,72, -99,144,215,235,143,37,103,192,74,71,199,146,118,102,29,212,188,94,47,130, -30,15,12,6,3,252,62,31,156,78,39,70,71,71,209,217,217,9,167,211,73,253, -203,9,160,176,162,144,188,22,21,187,104,178,114,224,129,64,0,22,139,133, -190,38,39,39,233,160,24,1,44,94,113,151,93,136,201,123,97,101,21,136,213, -40,251,222,217,133,86,46,151,195,229,114,161,173,173,13,249,249,249,112, -187,221,17,84,97,177,120,170,12,50,58,58,138,181,107,215,162,190,190,94, -112,66,182,168,168,8,99,99,99,127,17,216,228,24,94,34,145,36,74,22,130, -223,137,179,64,34,36,252,200,46,88,42,149,10,185,185,185,24,25,25,193,159, -15,28,64,71,123,59,190,241,216,99,116,98,159,117,150,99,85,94,89,186,43, -89,188,157,78,39,134,134,134,208,211,211,19,209,16,39,4,16,246,90,176,108, -44,189,94,143,191,251,187,191,195,230,205,155,97,181,90,241,139,95,252, -34,161,219,39,41,119,153,76,38,42,221,67,122,39,108,118,201,207,22,9,249, -147,8,149,114,9,0,199,83,149,32,225,243,249,176,96,193,2,28,62,124,36,233, -135,245,220,185,115,113,93,29,83,238,142,169,248,194,0,10,41,157,232,245, -122,88,167,245,160,216,197,130,149,7,136,92,204,68,81,222,14,60,40,241, -141,97,178,64,19,241,72,242,39,25,222,154,152,152,160,61,13,145,72,68,51, -35,2,40,66,126,37,188,255,57,1,20,194,222,34,117,120,214,200,70,44,22,211, -89,26,226,17,192,122,65,179,254,1,196,75,157,159,97,32,20,78,126,162,153, -188,223,229,203,151,195,100,50,97,120,120,24,86,171,21,26,141,6,10,133, -2,82,169,148,46,220,187,119,239,134,68,34,193,252,249,243,233,44,5,27,243, -231,207,143,240,221,176,217,108,145,77,89,81,56,98,225,17,2,147,68,189, -19,126,55,252,192,3,15,224,183,191,253,45,0,160,191,191,31,255,239,153, -103,80,94,81,129,175,126,245,171,200,200,200,152,50,76,155,190,23,216,178, -18,15,40,132,234,202,139,98,178,153,14,11,40,57,57,57,216,178,101,11,238, -186,235,46,72,36,18,124,246,217,103,120,119,251,246,184,90,115,108,84,92, -115,13,6,6,6,232,57,16,218,58,57,191,153,12,53,242,217,137,84,42,197,217, -179,103,19,102,39,36,211,115,187,221,112,240,243,66,177,30,84,201,84,95, -38,214,36,124,10,76,82,241,133,3,20,2,42,153,153,153,176,90,173,52,187, -96,105,150,66,25,138,144,97,16,187,184,178,252,127,222,5,144,5,20,226,164, -198,246,34,164,82,41,124,62,95,4,65,128,52,192,213,106,117,148,203,32,15, -40,164,15,65,102,109,8,99,134,100,101,228,216,36,251,32,86,184,172,31,52, -1,149,88,170,175,4,84,88,86,17,1,209,37,75,150,96,104,104,24,203,151,47, -167,96,37,18,137,168,209,153,201,100,194,55,191,249,45,188,252,242,75,184, -229,150,91,4,1,133,183,142,29,28,28,164,30,247,124,63,139,191,230,66,96, -146,104,120,49,24,12,162,164,180,52,234,235,109,103,207,226,199,63,250, -17,230,206,157,139,251,31,120,0,11,23,46,132,213,106,157,234,19,76,83,98, -121,64,33,180,103,86,24,147,95,216,229,114,57,150,45,91,134,155,111,190, -25,75,151,46,133,203,229,66,75,75,11,222,126,251,109,76,36,57,252,9,76, -13,195,142,143,143,195,110,183,211,114,23,41,63,9,129,88,50,96,194,90,242, -186,92,46,28,56,112,32,225,207,26,12,6,148,149,149,161,191,191,31,201,42, -52,59,157,142,152,194,128,66,217,103,42,82,241,133,0,20,178,208,102,101, -101,193,233,116,194,225,112,196,20,73,20,2,148,88,20,83,178,160,17,113, -66,242,80,184,221,110,56,28,142,168,94,4,41,49,16,64,19,42,121,177,62,232, -108,134,66,100,101,130,193,32,38,39,39,5,21,92,201,177,216,250,58,201,126, -212,106,117,148,197,48,169,239,199,10,141,70,67,153,101,44,160,120,60,30, -12,15,15,99,120,100,56,238,53,95,189,122,53,250,250,250,168,88,37,27,102, -179,25,121,121,121,212,111,126,120,120,56,234,92,98,249,52,176,22,168,60, -85,86,40,59,33,47,133,66,129,91,55,109,194,129,253,251,163,206,181,191, -191,31,207,253,230,55,244,188,215,173,95,143,165,75,151,194,237,118,99, -96,96,0,99,99,99,176,219,237,176,88,44,180,177,206,150,76,13,6,3,242,242, -242,144,159,159,143,130,130,2,148,148,148,0,0,6,6,6,240,206,59,239,96,255, -254,253,9,251,36,66,177,226,218,107,209,220,220,76,239,21,242,217,241,154, -88,177,148,135,133,64,133,181,227,221,185,115,103,82,2,130,114,185,28,85, -85,85,56,26,103,168,150,143,198,198,198,184,101,184,84,134,146,138,47,44, -160,144,32,37,37,94,17,147,15,86,33,147,127,24,8,40,176,61,14,30,188,216, -135,151,39,5,164,167,167,211,108,133,28,139,101,141,177,189,20,185,92,14, -173,86,75,51,9,114,108,171,213,26,113,108,210,227,96,235,233,108,121,143, -101,163,177,37,182,100,174,23,81,112,102,205,158,50,84,137,127,118,225, -194,50,28,56,176,31,247,222,123,47,26,27,27,163,202,39,183,221,118,27,118, -238,220,73,255,221,222,222,78,109,7,130,129,191,0,176,144,204,72,60,32, -137,5,42,129,64,0,55,222,120,163,32,160,176,81,87,87,135,186,186,58,0,83, -20,239,5,11,23,98,241,226,197,48,26,141,148,72,65,40,214,74,165,146,222, -47,118,187,29,227,227,227,24,25,25,65,125,125,61,142,214,214,38,93,214, -18,138,229,203,151,163,190,190,158,202,214,179,44,46,33,143,120,150,114, -30,11,76,88,86,215,39,159,124,146,84,169,139,124,62,78,167,19,19,214,228, -220,45,37,98,9,142,29,59,70,169,205,66,196,23,62,3,77,69,42,190,112,128, -194,46,250,201,14,82,241,128,147,204,205,175,209,104,34,166,210,9,16,145, -146,20,11,40,188,81,20,219,232,55,24,12,81,231,153,158,158,30,161,233,197, -246,56,132,142,205,54,231,9,61,120,38,82,23,108,118,103,179,217,16,12,6, -161,78,194,42,54,16,8,192,102,179,33,43,43,43,230,117,213,104,52,244,26, -53,54,54,226,142,59,238,196,185,238,115,112,186,156,17,96,17,11,84,102, -210,224,37,89,202,223,252,205,223,224,221,119,223,77,234,189,183,182,182, -162,181,181,21,239,77,3,31,45,1,101,102,66,175,211,193,110,183,39,189,40, -207,36,42,174,185,6,77,205,205,112,185,92,83,55,253,116,70,70,238,35,86, -130,134,37,39,8,73,218,179,165,46,114,45,235,235,235,113,250,244,233,164, -203,110,7,14,28,152,206,186,146,43,119,13,13,13,10,90,208,198,154,133,74, -69,42,174,84,92,118,71,164,120,34,124,241,66,175,215,211,172,32,35,35,3, -106,181,26,90,173,150,202,84,144,23,225,247,179,253,19,133,66,17,49,52, -198,7,1,21,146,217,168,213,106,104,52,154,136,227,147,227,18,51,35,98,43, -108,48,24,46,106,71,152,145,145,1,189,94,143,64,32,128,252,252,252,196, -63,32,2,110,185,101,35,234,235,235,5,65,197,225,112,224,246,219,111,167, -53,253,193,193,65,4,2,126,144,33,15,50,217,46,228,54,25,107,81,74,180,56, -133,66,33,44,94,178,36,170,135,51,211,176,152,205,232,238,238,254,92,192, -100,241,146,37,232,238,238,134,213,106,141,24,42,229,149,150,99,169,4,8, -105,152,177,96,114,252,248,241,8,53,136,68,81,80,80,128,193,193,65,188, -250,234,171,72,147,38,86,101,22,137,196,216,185,115,167,32,144,240,51,80, -66,118,182,169,72,197,95,53,160,92,74,16,125,35,210,31,33,139,62,89,248, -201,130,175,86,171,105,227,92,163,209,32,43,43,43,225,162,79,200,6,164, -68,198,130,138,70,163,137,58,174,74,165,138,11,82,201,4,201,156,146,5,36, -189,94,143,131,7,15,98,209,162,69,130,255,239,116,58,145,149,149,69,123, -77,123,247,238,69,65,193,20,88,169,213,234,168,222,213,197,236,110,133, -190,239,219,143,63,126,85,222,47,171,166,251,20,253,253,253,17,67,183,241, -60,96,88,210,6,79,159,38,101,87,242,181,166,166,38,28,57,114,100,70,231, -212,221,221,141,31,252,224,7,80,169,84,248,183,127,251,215,105,9,152,216, -143,161,221,102,131,217,108,22,212,138,139,85,186,76,149,188,82,145,2,148, -36,67,163,209,192,96,48,208,76,133,176,185,200,139,44,248,106,181,26,70, -163,241,162,202,81,153,153,153,52,19,33,141,125,210,220,87,171,213,212, -192,106,54,30,92,214,244,42,81,248,3,126,44,88,176,0,165,2,12,43,96,138, -192,112,227,141,55,82,64,25,31,31,71,111,79,207,20,185,32,134,229,237,76, -202,36,236,247,241,217,205,67,15,63,124,245,220,212,18,9,150,175,88,129, -93,187,118,193,225,112,80,98,5,91,18,101,149,25,88,117,6,194,216,227,7, -59,249,89,147,125,251,246,197,180,114,72,20,167,78,157,66,121,121,57,158, -121,230,25,252,234,151,191,196,254,79,246,65,46,147,11,166,165,31,127,252, -81,4,80,36,26,72,229,217,125,169,72,69,10,80,146,216,217,231,228,228,192, -96,48,68,100,16,164,60,101,52,26,161,215,235,47,58,123,32,243,54,89,89, -89,48,26,141,200,202,202,66,118,118,54,114,114,114,46,233,184,177,64,12, -64,82,101,47,169,68,138,13,27,54,196,181,151,29,24,24,192,61,247,220,67, -133,3,27,27,27,33,2,224,113,123,80,88,88,24,183,6,159,12,144,176,217,13, -187,83,206,204,204,196,253,15,60,112,197,239,141,69,229,229,200,204,204, -196,174,93,187,166,6,98,153,172,132,213,141,35,27,17,178,81,96,169,229, -236,28,84,196,245,159,166,168,239,216,177,35,161,146,112,162,176,217,108, -232,238,238,198,179,207,62,139,209,209,81,252,236,103,207,34,141,251,92, -205,38,19,186,187,187,35,128,132,85,133,230,125,107,82,128,146,138,20,160, -92,34,176,104,52,26,218,63,33,89,197,108,45,248,108,179,246,243,44,35,56, -157,78,228,79,59,67,198,60,23,177,24,46,151,19,55,221,116,83,148,28,59, -31,131,131,131,184,225,134,27,232,176,96,77,77,13,212,170,12,234,164,152, -172,246,147,144,103,58,223,216,103,103,136,84,42,21,238,190,231,158,43, -114,47,100,26,141,184,230,154,107,240,233,167,159,226,196,137,19,17,154, -105,100,222,133,0,9,217,128,144,23,63,87,68,22,103,246,189,74,165,82,76, -76,76,224,229,151,95,78,74,248,49,217,56,125,250,52,238,189,247,94,108, -220,184,17,63,254,241,143,97,54,155,33,194,212,239,124,231,157,183,35,100, -102,88,162,137,144,106,67,188,89,168,84,164,34,5,40,95,146,8,6,131,200, -205,205,141,153,37,136,197,18,140,143,143,227,238,187,239,70,83,83,19,90, -91,91,227,30,143,200,201,84,85,85,209,161,193,154,154,26,88,173,86,24,167, -123,44,66,179,65,66,179,66,66,217,10,15,40,252,206,249,158,123,239,133, -250,50,153,60,229,23,20,96,201,210,165,232,234,234,194,174,221,187,225, -118,187,105,159,131,21,46,37,64,162,211,233,232,139,39,111,16,201,31,2, -38,4,72,68,34,17,142,30,61,138,87,94,121,229,162,60,107,18,197,200,200, -8,116,58,29,126,248,195,31,226,119,47,188,128,157,59,119,224,88,125,61, -28,14,71,132,31,17,91,166,227,101,133,216,225,212,84,164,226,74,133,40, -156,82,148,187,226,65,6,68,199,199,199,209,221,211,195,101,73,82,76,78, -90,241,192,253,247,163,191,191,31,123,246,236,73,218,63,133,44,64,39,78, -156,136,232,49,177,125,39,86,81,128,93,160,216,178,15,47,242,201,14,153, -122,189,94,58,124,74,140,160,38,38,38,96,183,219,17,10,133,80,83,83,131, -208,231,32,167,190,176,172,12,34,145,8,251,247,239,167,215,131,55,55,99, -165,237,85,42,85,4,129,67,175,215,211,127,179,239,159,117,64,76,75,75,131, -195,225,192,246,237,219,49,49,49,113,89,238,133,107,174,185,6,63,249,201, -79,40,64,176,101,58,173,86,11,131,193,0,163,209,72,95,6,131,1,58,157,142, -146,68,82,25,74,42,82,128,242,37,15,143,199,3,179,217,12,137,68,130,134, -227,199,105,118,144,46,79,135,207,231,197,198,141,27,49,58,58,122,81,102, -92,74,165,18,21,21,21,216,179,103,15,210,211,211,41,123,141,176,214,120, -50,3,15,40,252,124,10,1,21,2,40,126,191,31,30,143,135,74,197,16,80,177, -88,44,116,17,150,165,165,161,187,167,7,35,195,195,151,150,141,228,231,35, -59,59,27,237,29,29,104,105,105,17,204,152,216,108,137,5,19,150,17,200,2, -9,171,122,32,147,201,144,145,145,65,189,233,155,154,154,240,217,103,159, -93,254,242,93,102,38,254,248,199,63,70,120,233,144,236,202,96,48,32,51, -51,147,130,9,91,234,205,201,201,73,61,76,169,184,162,33,77,93,130,43,31, -105,105,105,16,139,197,176,217,108,40,156,55,15,231,251,250,160,213,104, -161,209,168,177,108,217,50,244,246,246,98,223,190,125,23,229,236,232,114, -185,112,242,228,73,220,121,231,157,232,236,236,196,240,240,48,149,111,33, -42,3,236,139,29,160,139,215,172,39,3,160,161,80,136,102,3,66,199,154,152, -152,192,176,217,140,64,32,128,146,210,210,41,197,104,191,31,22,179,25,38, -147,137,14,27,242,32,56,39,63,159,42,55,79,90,173,56,115,246,44,14,78,179, -170,248,57,12,182,143,195,246,26,216,230,59,219,51,33,64,194,171,29,168, -213,106,136,197,98,12,14,14,226,227,143,63,22,60,183,203,21,236,156,12, -171,206,192,106,201,145,50,29,145,19,74,69,42,82,128,146,10,154,9,16,235, -226,220,156,28,20,22,22,34,55,55,23,39,78,156,64,77,77,205,37,185,240,133, -66,33,52,52,52,32,47,47,15,155,55,111,198,209,163,71,105,195,222,235,245, -82,205,50,191,223,47,152,153,144,65,57,33,218,49,107,65,192,219,208,242, -140,50,155,205,134,193,193,65,56,157,78,170,48,76,100,87,114,114,114,208, -223,223,15,167,211,137,112,56,140,230,105,247,77,246,247,242,50,49,44,144, -176,22,8,108,175,129,45,235,177,37,63,146,149,144,157,63,145,196,217,187, -119,47,134,134,134,174,40,144,180,180,180,68,40,54,144,247,68,40,206,228, -253,177,172,180,100,164,127,82,145,138,20,160,124,73,66,161,80,192,235, -245,66,42,149,194,235,245,194,104,52,226,147,79,62,73,90,210,35,153,24, -30,30,198,240,240,48,170,170,170,224,247,251,209,223,223,47,56,33,46,100, -221,44,36,205,34,22,139,169,18,51,175,181,38,52,136,199,102,17,46,151,43, -2,84,70,70,70,32,18,137,160,84,42,5,229,227,201,239,103,7,249,8,3,143,144, -1,120,13,55,66,9,102,231,136,8,144,232,116,58,100,102,102,34,61,61,29,14, -135,3,7,14,28,136,105,25,60,147,32,202,9,23,107,237,172,86,171,113,244, -232,209,40,87,74,182,41,207,106,211,165,178,147,84,164,0,37,21,130,128, -66,88,61,110,183,27,86,171,245,162,93,28,19,69,67,67,3,245,96,31,28,28, -132,203,229,138,219,47,137,165,247,197,2,134,84,42,141,9,4,108,22,67,22, -71,2,40,196,233,147,232,166,197,82,173,230,135,251,88,112,98,39,222,121, -81,80,126,71,159,153,153,137,172,172,44,122,189,15,30,60,136,230,230,230, -89,201,44,148,74,37,250,251,251,209,219,219,11,149,74,133,202,202,74,152, -102,224,200,168,215,235,241,226,139,47,70,92,83,182,31,196,190,82,217,73, -42,82,128,146,138,152,193,250,187,167,167,167,195,108,54,99,193,130,5,51, -218,53,139,197,98,168,84,42,184,221,110,40,20,10,234,155,46,20,78,167,19, -251,246,237,195,252,249,243,177,100,201,18,90,138,34,64,194,122,150,167, -165,165,81,197,101,118,66,94,8,84,200,207,243,217,9,203,186,82,42,149,17, -128,66,140,181,136,23,13,75,107,230,203,107,60,85,153,92,47,161,69,151, -93,124,179,179,179,97,52,26,161,84,42,97,183,219,177,127,255,254,132,244, -235,100,35,35,35,3,23,46,92,192,158,61,123,240,252,243,207,99,235,214,173, -8,4,2,216,179,103,15,250,251,251,177,114,229,74,132,66,33,56,28,142,184, -96,242,219,223,254,22,129,64,0,42,149,42,226,61,18,176,228,141,221,200, -236,79,42,82,145,2,148,84,8,150,59,124,62,31,228,114,57,236,118,251,140, -0,69,38,147,193,108,54,227,249,231,159,167,150,197,143,61,246,24,230,204, -153,19,183,252,210,211,211,131,158,158,30,172,88,177,2,37,37,37,48,155, -205,176,219,237,17,205,117,190,36,198,206,105,176,160,194,206,64,240,67, -129,252,60,5,11,38,241,0,133,7,38,33,64,97,39,199,89,93,46,181,90,141,220, -220,92,24,141,70,72,165,82,152,205,102,28,62,124,248,146,167,220,217,48, -26,141,120,239,189,247,208,215,215,135,64,32,128,210,210,82,116,116,116, -96,210,102,67,101,101,37,182,108,217,2,147,201,132,154,154,26,184,92,46, -20,20,20,64,163,209,208,107,44,149,74,225,247,251,241,179,159,253,12,18, -137,132,186,117,242,125,161,88,154,99,169,236,36,21,87,83,164,104,195,87, -89,140,143,143,195,237,118,195,229,114,97,114,114,18,54,155,13,167,78,157, -138,251,51,74,165,18,57,57,57,56,113,226,4,106,107,107,209,223,223,79,117, -171,148,74,37,30,127,252,113,4,2,1,154,129,196,139,107,175,189,22,139,22, -45,130,211,233,132,221,110,143,178,102,102,133,19,249,108,133,167,20,19, -135,77,2,26,30,143,39,226,69,250,39,172,83,35,235,252,201,103,64,66,37, -47,114,94,4,92,20,10,5,242,242,242,160,215,235,161,86,171,17,8,4,112,254, -252,121,84,87,87,83,139,130,217,8,141,70,67,217,96,4,4,21,10,5,26,26,26, -176,119,239,94,248,34,24,121,34,24,244,58,104,52,26,140,143,143,99,255, -254,253,104,106,106,66,101,101,37,154,155,155,209,217,217,25,49,132,169, -86,171,35,40,194,68,2,136,72,10,105,181,90,168,84,42,24,12,134,20,160,164, -34,5,40,169,136,29,126,191,31,22,139,5,70,163,17,141,141,141,112,187,221, -152,156,156,68,87,87,151,224,247,27,12,6,44,90,180,8,171,87,175,198,158, -61,123,209,217,217,129,23,94,120,33,98,38,35,61,61,29,133,133,133,184,255, -254,251,209,219,219,155,212,121,20,23,23,99,213,170,85,72,79,79,199,228, -228,36,101,131,241,62,244,44,235,138,4,63,252,72,230,85,8,120,16,144,33, -95,99,193,36,86,15,69,40,75,33,47,165,82,9,163,209,136,204,204,76,42,165, -63,58,58,138,206,206,78,180,182,182,194,231,243,205,94,74,47,149,66,161, -80,224,221,119,223,133,201,100,162,192,39,18,137,176,122,245,106,60,247, -220,115,216,247,201,39,241,30,57,232,117,58,40,149,10,252,232,71,63,66, -111,111,47,5,127,34,15,67,0,133,204,155,240,67,140,100,238,36,25,21,237, -84,164,34,85,242,250,18,7,113,138,148,72,36,56,119,238,28,150,45,91,6,143, -199,131,133,11,23,34,24,12,210,178,80,40,20,66,102,102,38,214,174,93,139, -96,48,136,79,63,251,12,254,128,31,58,157,158,74,113,176,115,25,86,171,21, -255,247,127,255,135,135,31,126,24,3,3,3,9,189,211,123,123,123,209,219,219, -11,137,68,130,149,43,87,162,172,172,12,98,177,24,46,151,11,78,167,147,30, -63,150,33,21,235,170,41,68,49,142,53,183,18,139,41,198,207,158,144,169, -113,173,86,11,165,82,137,96,48,8,179,217,140,230,230,230,89,7,17,182,188, -181,119,239,94,116,116,116,68,184,123,146,247,181,110,221,58,140,140,140, -36,56,74,24,19,214,9,76,88,39,240,196,119,159,196,15,255,191,127,167,224, -47,52,111,194,82,133,217,254,137,82,169,76,129,73,42,82,128,146,138,196, -65,202,24,123,118,239,134,195,225,192,154,53,107,208,213,213,5,167,211, -137,220,220,92,100,101,101,161,180,180,20,18,137,4,103,206,156,193,240, -240,8,130,161,169,57,21,185,252,47,178,33,66,125,133,189,123,247,226,174, -187,238,194,208,208,16,60,30,79,194,115,9,6,131,104,104,104,64,67,67,3, -84,42,21,86,172,88,129,194,194,66,234,3,79,94,100,97,21,106,218,3,136,152, -101,33,11,48,41,21,177,179,43,36,187,225,221,57,89,218,47,177,82,118,56, -28,24,30,30,198,185,115,231,208,209,209,113,73,179,58,241,34,61,61,29,54, -155,13,191,254,245,175,233,57,178,239,131,92,231,202,202,74,88,44,150,164, -143,27,10,5,41,248,179,86,210,172,18,50,171,53,150,98,118,165,34,5,40,169, -152,113,176,59,207,35,135,15,227,200,225,195,184,243,206,59,145,149,149, -133,27,110,184,1,3,3,3,56,115,230,12,198,77,230,105,87,198,191,4,105,124, -147,18,138,16,51,232,240,225,195,120,248,225,135,169,199,122,178,225,112, -56,80,93,93,141,234,234,106,200,100,50,148,149,149,161,184,184,24,217,217, -217,116,22,197,239,247,71,100,25,177,168,196,228,79,50,109,207,254,155, -12,244,145,247,64,36,217,157,78,39,198,199,199,209,222,222,142,142,142, -14,152,205,230,203,242,121,200,229,114,108,219,182,45,226,60,73,134,70, -168,202,70,163,17,243,231,207,159,145,123,35,201,72,121,6,28,171,183,198, -15,98,202,100,50,168,213,234,84,118,146,138,20,160,164,98,102,177,112,225, -66,116,118,118,2,0,118,237,218,133,111,60,246,24,28,14,7,206,196,97,41, -165,77,247,76,88,201,14,22,84,72,223,163,173,173,13,149,149,149,56,118, -236,216,69,157,155,207,231,163,30,241,36,230,207,159,15,163,209,136,236, -236,108,232,116,58,40,149,74,90,226,34,192,193,2,12,201,104,72,144,178, -23,105,224,143,141,141,193,106,181,98,112,112,16,3,3,3,159,75,25,43,153, -240,122,189,200,207,207,167,222,36,164,68,197,74,226,175,95,191,30,193, -96,16,214,73,219,140,55,15,108,25,80,168,228,197,14,50,202,229,242,84,118, -146,138,20,160,164,98,230,81,82,82,66,1,133,236,140,19,185,43,138,69,226, -136,82,23,209,180,34,139,18,209,13,11,6,131,88,176,96,193,69,3,138,80,16, -10,114,162,5,52,51,51,147,238,176,205,102,243,21,3,138,100,195,227,241, -224,43,95,249,10,254,227,63,254,35,34,131,82,40,20,84,120,242,166,155,110, -154,238,159,36,207,113,137,69,173,230,39,227,217,169,120,66,58,72,69,42, -82,128,146,138,25,69,97,81,81,196,191,147,17,135,12,35,28,97,13,203,106, -65,17,49,65,137,68,130,178,178,50,106,63,124,57,35,24,12,98,108,108,236, -11,247,89,216,108,54,44,94,188,24,231,206,157,163,61,15,2,40,249,249,249, -88,176,96,1,142,31,63,49,179,236,100,90,186,134,5,149,120,94,247,36,203, -76,69,42,174,214,72,25,108,93,197,49,191,184,56,226,223,110,183,59,161, -197,43,49,235,18,210,207,34,217,138,209,104,68,85,85,213,140,100,65,190, -236,17,10,133,112,231,157,119,82,138,47,91,82,220,176,97,3,124,62,31,70, -103,8,148,62,159,47,162,201,207,130,10,153,171,97,231,127,82,83,241,169, -72,1,74,42,46,58,230,112,62,243,100,232,15,136,95,246,202,47,40,136,40, -169,240,90,90,43,86,172,128,72,36,194,129,3,7,82,23,121,38,15,139,88,76, -251,65,164,60,149,145,145,129,202,202,74,12,12,12,98,38,229,46,0,152,156, -156,140,152,187,17,178,86,102,157,24,103,203,218,58,21,169,72,1,202,151, -52,114,115,115,233,223,189,30,15,108,54,27,52,154,248,117,244,188,220,220, -8,26,46,89,12,201,80,222,188,121,243,112,230,204,153,184,218,82,127,77, -32,96,52,26,161,213,106,209,223,223,143,98,46,235,155,73,56,157,78,84,86, -86,70,44,250,107,214,172,129,74,165,66,95,255,204,125,230,79,158,60,25, -37,241,207,15,111,146,191,95,137,242,100,42,82,49,211,72,245,80,174,226, -8,6,131,216,114,251,237,120,245,149,87,0,76,209,118,77,38,19,212,42,85, -92,225,71,157,78,79,25,83,252,14,56,51,51,19,34,145,8,117,172,174,38,9, -0,0,25,252,73,68,65,84,117,117,23,117,78,26,141,134,50,179,28,14,7,2,129, -192,85,119,221,180,90,45,164,82,41,134,135,135,113,236,216,49,140,143,143, -211,235,160,211,233,144,157,157,13,183,219,125,81,199,174,170,170,66,103, -103,39,68,34,17,50,50,50,176,113,227,70,244,247,15,192,57,83,112,14,3,173, -173,173,49,85,149,89,169,25,146,25,165,34,21,41,64,73,197,69,135,205,102, -195,245,215,95,79,1,101,112,104,8,38,147,9,197,197,197,24,140,99,2,165, -84,42,34,166,207,89,177,69,141,70,3,155,205,118,81,11,170,78,167,195,211, -79,63,77,107,250,122,189,30,203,150,45,67,97,97,33,50,51,51,161,80,40,232, -148,188,207,231,67,56,28,166,58,94,159,87,144,198,56,241,119,105,104,104, -128,195,225,160,239,151,85,45,94,178,100,9,246,238,221,139,39,158,120,130, -202,193,204,52,136,61,112,56,28,198,198,141,27,145,158,158,142,14,134,137, -151,108,132,66,65,140,140,140,64,169,84,70,105,149,177,47,246,235,169,72, -69,10,80,82,113,209,65,154,178,69,197,197,56,223,219,139,158,238,110,44, -94,188,24,75,151,46,141,159,217,132,166,36,65,88,231,68,146,165,164,165, -165,193,110,183,95,212,249,28,56,112,0,193,96,144,46,128,54,155,13,199, -143,31,199,169,83,167,34,154,200,108,169,134,157,156,223,180,105,19,10, -10,10,168,31,252,197,68,102,102,38,28,14,7,70,70,70,208,217,217,137,254, -254,254,8,211,47,242,39,57,71,214,191,229,185,231,158,195,139,47,190,136, -87,94,121,5,143,63,254,56,134,134,134,18,74,208,240,97,181,90,161,86,171, -33,18,137,80,94,94,142,238,238,110,120,60,51,7,103,139,197,18,5,34,236, -117,227,175,31,59,175,147,138,84,92,173,145,186,75,175,226,144,72,36,48, -153,76,120,240,193,7,255,82,41,9,135,169,150,86,188,221,111,85,85,85,132, -167,9,1,148,96,48,152,148,228,10,31,122,189,30,30,143,135,238,208,133,20, -128,89,209,72,118,49,36,231,61,60,60,28,209,19,154,105,164,167,167,227, -151,191,252,37,94,124,241,69,124,244,209,71,232,236,236,164,34,147,4,24, -120,239,21,50,36,88,92,92,12,181,90,141,242,138,10,172,94,189,26,111,190, -249,38,254,255,246,238,63,54,234,187,254,3,248,243,126,95,239,87,175,215, -31,252,118,165,165,69,41,235,220,226,12,81,70,34,42,51,76,40,13,8,204,63, -116,78,178,136,139,198,133,152,24,23,51,69,77,96,26,226,151,204,169,27, -40,100,115,38,102,75,116,139,225,71,217,216,198,198,32,35,192,24,172,219, -202,239,181,180,43,253,117,237,253,234,253,232,235,251,7,188,63,190,63, -159,187,182,87,160,168,227,249,72,46,218,222,237,238,115,71,243,126,222, -251,231,43,24,12,26,239,167,248,158,197,8,234,234,234,144,205,102,177,105, -211,38,180,183,183,95,211,123,57,113,226,68,222,201,201,250,205,26,202, -236,161,16,3,133,174,139,90,213,227,243,249,16,41,47,55,190,33,159,57,115, -6,83,167,76,25,243,191,173,171,171,51,133,144,186,169,111,198,19,17,10, -133,112,247,221,119,227,190,251,238,67,83,83,83,222,126,9,107,121,90,189, -82,162,190,151,34,157,78,95,215,198,60,143,199,99,170,71,159,205,102,141, -225,44,235,222,144,80,40,132,210,210,82,227,24,248,219,110,187,205,168, -65,178,100,201,18,84,87,87,99,255,254,253,184,116,233,18,170,170,170,38, -52,236,119,236,216,49,140,140,140,96,120,120,24,47,189,244,18,58,218,219, -225,113,187,17,10,134,224,245,142,61,121,110,179,217,1,1,94,125,245,213, -130,103,173,233,75,133,57,127,66,28,242,162,27,218,67,81,223,78,215,172, -89,131,103,159,125,22,173,173,173,240,251,253,152,162,5,138,211,225,128, -205,102,71,54,155,65,42,149,66,60,30,71,103,103,167,169,167,160,134,125, -122,122,122,224,245,122,225,112,56,138,58,199,203,239,247,67,68,48,111, -222,60,124,244,81,59,146,201,100,193,93,248,42,60,212,144,151,181,119,50, -50,50,130,193,193,193,235,106,28,109,54,27,210,233,52,92,46,151,241,126, -244,93,235,122,105,92,189,134,139,211,233,68,77,77,141,177,35,127,112,104, -8,171,87,175,198,203,47,191,140,142,142,14,116,116,116,96,225,194,133,176, -219,237,163,214,76,9,4,2,232,237,237,197,179,207,62,107,124,110,234,125, -117,118,118,34,22,139,193,235,245,26,159,117,32,16,128,205,102,67,42,149, -50,234,219,180,182,182,226,244,233,211,200,229,114,240,249,124,112,187, -221,166,207,79,189,7,235,181,51,80,136,129,66,55,68,73,73,9,210,233,52, -34,145,8,86,173,90,133,119,223,125,23,46,151,11,135,15,31,198,236,217,53, -232,232,104,199,177,99,199,48,52,52,132,100,50,137,76,38,3,17,129,211,233, -132,215,235,205,27,66,81,245,77,238,186,235,46,156,57,115,102,204,211,113, -221,110,55,18,137,4,126,248,195,31,226,232,209,163,200,100,51,40,45,13, -27,59,239,213,121,83,234,204,41,213,24,170,111,215,122,225,45,181,56,64, -5,228,181,156,12,172,134,182,212,177,241,170,87,162,142,120,215,15,81,212, -191,241,59,157,78,76,155,54,205,116,196,75,95,127,63,150,44,89,130,142, -142,14,236,223,191,31,7,14,28,64,44,22,67,67,67,3,166,78,157,106,44,211, -85,199,226,159,61,123,22,143,60,242,8,122,122,122,112,233,210,37,12,14, -14,26,239,207,122,58,114,54,155,69,87,87,23,98,177,24,6,7,7,49,52,52,132, -161,161,33,36,18,9,248,253,126,163,156,178,186,118,117,162,176,254,25,234, -115,81,12,20,98,160,208,13,11,148,120,60,14,151,203,133,72,36,130,59,239, -188,19,3,3,3,24,30,30,70,107,235,123,24,28,28,68,73,73,137,209,72,169,70, -87,133,135,222,200,59,157,78,52,52,52,192,102,179,225,226,197,139,184,237, -182,219,48,109,218,52,116,118,118,154,130,197,227,241,32,16,8,160,189,189, -29,143,60,242,8,218,218,218,112,169,179,235,234,55,117,191,233,0,195,80, -40,100,156,138,235,247,251,77,189,20,53,33,174,23,219,234,238,238,70,101, -101,101,17,117,67,242,169,185,31,21,38,42,216,130,193,32,66,161,16,66,161, -80,94,168,232,129,98,157,128,191,220,211,131,80,105,24,235,214,173,195, -211,79,63,13,175,215,139,174,174,46,156,59,119,14,217,108,22,211,166,77, -195,237,183,223,142,7,30,120,0,145,72,4,239,191,255,62,28,14,7,230,204, -153,131,19,39,78,228,77,250,235,11,1,212,144,160,207,231,51,94,215,229, -114,25,129,175,7,138,26,158,83,193,98,13,102,110,104,36,6,10,221,16,234, -84,91,85,107,94,53,162,106,73,176,94,155,195,227,241,152,2,69,31,82,81, -71,159,103,50,25,156,57,115,6,217,76,6,13,243,231,163,171,171,11,209,104, -212,40,17,28,143,199,17,141,70,241,143,127,252,3,117,117,117,24,28,28,196, -233,51,103,160,118,129,171,226,78,250,137,184,122,99,174,55,134,170,113, -85,61,148,76,38,131,222,222,94,204,158,61,251,154,2,165,179,179,211,212, -51,209,231,75,84,105,92,253,58,84,160,56,28,14,132,195,225,130,135,80,166, -82,73,124,212,222,142,166,230,102,56,108,54,44,92,184,208,8,174,92,46,135, -190,190,62,156,58,117,10,47,239,219,135,139,23,175,108,94,156,63,127,126, -222,196,185,190,48,65,133,158,190,81,209,227,241,152,230,125,212,239,84, -32,170,107,183,246,82,120,220,10,49,80,232,134,247,82,82,169,148,169,186, -97,161,161,31,181,226,73,253,94,205,45,232,195,41,34,130,178,178,50,252, -223,239,126,135,72,121,57,154,155,155,177,104,209,34,84,84,84,24,141,97, -60,30,199,230,205,155,209,217,217,137,225,116,218,92,223,221,110,55,198, -250,173,193,162,127,195,86,13,174,10,148,145,145,17,163,228,111,125,125, -253,53,109,172,188,120,241,98,222,42,46,21,40,225,112,216,84,111,93,29, -132,169,2,101,202,148,41,99,150,63,182,195,134,153,51,103,226,224,193,131, -198,190,159,209,36,83,41,211,138,54,107,141,123,251,213,67,31,245,211,131, -213,191,141,26,234,211,171,52,170,207,78,239,97,177,144,22,49,80,104,82, -168,85,64,122,153,92,53,196,162,23,122,74,167,211,198,55,96,117,136,161, -250,22,172,110,153,76,198,104,164,250,122,123,177,125,219,182,209,255,56, -92,46,184,45,195,45,54,216,76,39,225,170,155,30,46,170,65,84,147,243,192, -149,121,134,108,54,139,225,225,97,163,7,53,209,121,148,243,231,207,231, -157,160,172,230,32,244,85,93,193,96,48,175,167,228,114,185,144,28,99,185, -116,38,147,198,244,233,211,139,10,58,231,213,48,208,151,72,235,255,14,42, -72,213,48,159,10,82,53,143,164,7,138,94,3,69,125,126,234,218,75,75,75,249, -199,79,12,20,186,241,66,161,144,17,22,42,76,244,70,73,149,226,213,135,193, -244,3,33,213,36,181,205,102,43,122,47,136,234,121,232,4,98,90,133,164,111, -104,212,87,127,169,5,1,106,114,94,5,138,199,227,65,95,95,31,238,190,251, -110,28,58,116,168,248,63,84,167,19,29,29,29,198,234,40,235,62,19,21,42, -193,96,16,193,96,208,120,156,106,220,1,32,54,20,27,35,80,50,40,45,45,197, -251,173,173,227,94,203,199,221,221,70,152,168,30,162,94,207,68,189,174, -10,82,21,44,106,63,144,26,18,83,11,38,244,202,154,234,22,8,4,120,84,61, -49,80,104,114,168,121,128,145,145,17,211,216,188,10,140,76,38,99,244,96, -244,192,81,13,157,190,183,161,172,172,172,168,215,44,45,45,205,219,80,151, -203,229,242,190,157,91,55,232,169,134,85,213,94,209,119,237,187,92,46,36, -18,9,56,28,14,4,131,193,162,119,237,251,253,126,211,115,171,144,212,135, -222,244,155,26,118,211,175,191,127,148,37,193,87,62,95,39,162,209,40,46, -141,113,164,13,112,101,79,80,127,127,63,188,94,175,105,115,167,30,42,106, -190,202,186,108,90,95,9,166,254,253,244,18,192,234,166,134,241,136,24,40, -52,105,212,74,175,129,129,1,163,17,75,167,211,121,195,97,214,250,26,214, -221,235,197,42,43,43,195,229,203,151,97,179,217,33,242,239,121,20,253,56, -21,253,102,221,53,175,106,120,168,101,175,201,100,210,56,225,216,110,183, -163,190,190,30,201,100,18,231,206,157,27,245,108,177,112,56,140,222,222, -94,60,254,248,227,166,158,144,222,27,82,61,34,125,85,155,199,227,65,48, -24,52,53,236,185,92,225,131,44,93,78,23,202,203,35,198,164,251,88,106,106, -106,112,194,114,168,99,161,30,163,234,161,233,159,183,245,241,250,191,143, -254,121,113,222,132,24,40,116,211,66,165,178,178,18,241,120,28,177,88,12, -46,151,43,239,84,97,61,80,244,227,81,212,4,57,0,56,156,78,228,198,57,41, -216,237,118,99,96,96,0,62,159,15,241,120,204,212,115,81,147,255,250,77, -53,148,234,181,213,144,148,126,237,234,127,107,106,106,16,12,6,209,222, -222,142,64,32,96,244,62,108,54,27,98,177,24,98,177,24,134,135,135,209,208, -208,128,111,127,251,219,120,251,237,183,209,214,214,150,55,119,163,127, -179,215,119,154,171,5,2,197,126,166,181,181,181,56,120,240,224,184,143, -245,249,124,121,159,119,161,30,97,161,229,211,58,107,239,70,109,12,229, -17,43,196,64,161,155,78,13,237,164,82,41,164,211,105,12,15,15,155,234,159, -232,13,187,26,122,202,229,114,198,201,191,53,179,103,163,173,173,109,236, -23,17,65,52,26,133,199,237,66,60,254,239,95,7,2,1,244,245,245,229,157,19, -166,135,153,106,96,11,93,119,40,20,66,46,151,195,198,95,252,2,107,239,191, -31,75,151,46,5,112,229,116,229,92,46,135,80,40,132,242,242,114,164,211, -105,92,184,112,1,127,255,251,223,243,118,193,23,10,18,125,40,110,34,243, -15,35,50,130,138,138,10,28,57,50,126,9,223,206,174,46,83,111,176,80,143, -80,31,198,82,195,110,250,153,97,234,115,81,189,39,134,8,49,80,232,191,130, -250,166,174,232,43,167,10,53,84,106,143,197,180,233,211,199,13,148,68,50, -137,161,161,33,84,84,84,88,114,70,140,6,213,218,176,234,67,59,133,94,95, -253,174,171,179,19,201,100,210,88,162,235,112,58,49,191,161,1,101,145,8, -50,153,12,58,59,59,113,225,194,5,83,47,74,13,37,21,10,18,61,76,74,74,74, -38,212,72,187,156,206,43,187,225,207,156,25,243,113,51,103,206,196,201, -147,39,97,183,219,243,86,220,233,189,14,125,110,36,28,14,115,114,157,24, -40,244,191,105,188,134,84,53,110,181,181,181,120,253,181,215,198,124,236, -64,127,63,122,123,123,243,14,79,180,134,72,161,161,175,241,244,245,247, -155,159,51,155,29,247,88,123,125,72,203,26,36,227,157,204,123,246,236,217, -130,75,149,189,30,47,238,184,227,14,124,88,68,77,147,242,138,10,164,82, -41,184,221,110,83,128,2,40,88,207,68,13,99,17,49,80,232,19,173,152,249, -133,228,213,146,195,250,209,31,14,135,3,169,84,106,212,240,208,143,33,25, -43,220,122,123,122,38,124,205,214,227,221,173,59,213,213,66,129,66,103, -95,77,159,62,29,118,187,29,125,125,125,248,72,59,114,222,237,118,161,188, -188,28,187,118,237,26,243,181,103,204,156,137,215,95,127,189,96,144,88, -107,152,176,108,47,221,170,120,124,253,45,40,147,201,192,231,243,141,251, -184,222,158,30,36,147,73,68,175,150,27,118,58,28,216,187,103,143,113,108, -138,117,149,151,181,208,213,88,134,38,88,50,87,205,3,141,86,124,202,122, -13,5,191,61,93,29,14,171,173,169,49,30,23,12,133,16,141,70,199,28,238,242, -249,124,144,171,243,73,234,253,89,11,99,89,87,211,241,12,46,98,160,208, -45,33,151,203,193,225,112,160,190,190,126,220,199,198,98,49,180,190,247, -30,100,68,176,125,251,118,163,66,226,104,223,204,245,6,126,172,37,202,99, -157,114,92,72,36,18,185,174,247,172,95,91,34,145,64,85,101,37,66,161,16, -234,230,204,193,187,239,190,59,234,127,23,14,135,81,94,81,129,195,135,15, -231,157,217,165,15,191,89,23,5,240,132,96,186,21,113,200,235,22,164,54, -55,54,173,88,129,83,39,79,98,247,158,61,24,25,229,24,148,145,145,17,28, -57,114,4,29,29,29,198,188,128,181,186,160,117,46,99,178,234,160,23,170, -64,89,236,188,141,117,3,98,127,127,63,162,209,40,14,28,56,128,131,111,190, -89,176,87,50,175,161,1,167,78,157,194,7,71,142,24,43,178,212,146,96,125, -87,187,190,80,64,125,14,28,238,34,6,10,221,18,212,134,59,191,223,143,250, -185,115,81,22,137,160,175,175,15,221,221,221,198,89,91,174,171,223,178, -219,78,159,70,123,123,187,113,0,165,190,169,112,180,101,187,147,81,195, -35,116,117,239,139,58,28,83,223,11,98,221,133,62,90,136,122,60,30,99,82, -221,235,245,34,153,76,162,191,191,31,245,115,231,162,166,182,214,56,218, -38,30,143,227,189,247,222,195,193,131,7,145,201,100,140,112,208,79,112, -214,111,122,113,49,181,76,152,147,241,196,64,161,91,134,199,227,65,50,153, -52,78,188,85,223,186,227,241,56,250,250,250,16,141,70,145,72,36,144,78, -167,225,247,251,77,245,85,172,101,126,173,85,6,139,9,148,137,238,6,183, -219,237,200,100,50,166,35,102,244,205,133,197,132,74,73,73,9,18,137,132, -177,219,222,231,243,33,157,78,35,26,141,26,27,69,85,137,97,181,111,68,63, -206,198,90,195,68,157,14,108,173,97,82,204,252,20,17,3,133,62,49,212,46, -110,253,108,44,181,81,82,175,250,168,234,171,88,107,144,168,162,90,122, -65,43,61,84,198,251,134,94,81,94,62,225,235,213,3,69,63,108,177,152,48, -1,96,244,34,84,175,67,15,11,125,83,162,234,201,168,35,231,213,94,19,189, -66,100,161,162,88,234,184,21,30,157,66,12,20,186,165,168,198,79,13,255, -248,253,126,164,211,105,83,69,65,117,36,190,250,89,175,175,162,78,245,213, -191,161,171,6,59,16,8,140,59,127,82,53,101,202,132,175,89,245,74,10,109, -166,44,86,48,24,204,59,249,215,122,14,87,50,153,52,2,69,133,142,58,189, -89,47,138,165,122,41,234,253,171,225,48,238,124,39,6,10,221,82,212,4,123, -38,147,49,157,86,172,23,231,210,107,212,235,5,161,172,245,59,212,208,151, -234,161,20,243,13,125,162,181,62,138,9,144,98,150,43,123,189,94,132,66, -161,188,51,207,244,112,77,165,82,198,145,54,42,124,244,170,152,122,168, -90,3,149,167,4,19,3,133,110,73,126,191,31,201,100,210,168,73,175,215,81, -209,171,12,90,11,118,233,243,40,234,255,171,73,250,112,56,92,212,107,79, -164,4,176,221,225,192,217,179,103,77,251,78,172,123,80,244,189,40,227,157, -168,172,7,158,126,84,138,10,148,225,225,97,227,189,235,129,162,31,252,168, -127,6,234,253,23,251,222,137,24,40,244,137,236,165,148,150,150,154,190, -249,235,67,91,214,10,144,214,57,23,235,137,191,145,72,164,232,205,124,51, -102,204,192,247,214,175,199,133,11,23,240,193,7,31,20,220,88,88,87,87,135, -96,48,136,15,62,252,16,239,188,243,142,49,76,103,221,45,175,10,93,141,183, -177,209,26,42,14,135,3,3,3,3,121,129,162,138,149,169,185,26,21,180,214, -199,233,183,137,188,119,34,6,10,125,34,121,189,94,148,149,149,153,106,172, -168,64,81,19,210,214,6,85,47,116,229,118,187,225,243,249,16,10,133,38,52, -119,224,112,56,48,125,250,116,248,253,126,76,157,58,21,243,230,205,51,142, -172,239,233,233,65,71,71,7,14,29,62,140,84,42,133,92,46,103,90,137,86,104, -223,135,190,7,166,216,235,240,122,189,168,172,172,196,224,224,32,82,87, -235,196,23,154,248,47,116,154,176,94,155,37,18,137,112,222,132,136,129, -66,170,97,45,47,47,199,192,192,128,17,40,122,131,170,135,64,161,2,90,215, -178,170,201,227,241,32,145,72,152,86,86,13,14,14,34,26,141,26,199,216,171, -2,89,185,92,14,118,187,29,94,175,215,88,89,102,93,8,112,173,251,95,212, -38,207,76,38,131,88,44,102,4,152,62,113,175,7,138,126,172,10,139,97,17, -49,80,168,0,189,112,87,34,145,48,86,55,21,170,113,114,35,10,66,169,16,208, -231,101,10,45,91,86,117,94,84,93,23,181,100,183,208,254,143,235,217,161, -238,114,185,80,86,86,134,92,46,103,76,200,171,21,110,250,251,87,189,55, -110,92,36,98,160,208,56,212,234,173,92,46,135,76,38,147,87,95,197,90,167, -253,122,122,69,170,71,161,239,111,81,115,22,250,178,229,145,145,17,99,229, -153,90,178,91,90,90,106,236,129,209,123,41,215,59,143,225,112,56,140,207, -0,128,105,83,35,17,49,80,232,26,27,214,201,110,68,213,158,16,125,147,161, -90,0,160,246,131,168,121,28,181,202,76,95,178,171,246,128,168,64,241,249, -124,55,252,154,25,36,68,12,20,250,31,233,13,197,98,49,120,189,94,83,152, -168,224,208,151,45,219,108,182,188,225,49,235,57,90,156,207,32,98,160,208, -45,44,18,137,160,183,183,215,180,146,76,245,54,210,233,180,17,52,250,125, -42,84,244,85,95,92,105,69,244,159,103,147,137,158,93,65,116,131,101,50, -25,244,245,245,97,120,120,24,233,116,218,180,169,208,26,40,106,21,154,117, -217,46,247,128,16,49,80,136,0,92,153,252,86,251,65,244,48,209,151,45,171, -101,187,106,242,93,29,117,194,158,9,17,3,133,168,96,111,37,153,76,34,153, -76,142,90,191,93,13,121,177,87,66,196,64,33,42,186,215,162,122,40,234,124, -46,246,70,136,24,40,68,68,244,9,103,231,71,64,68,68,12,20,34,34,98,160, -16,17,17,3,133,136,136,136,129,66,68,68,12,20,34,34,98,160,16,17,17,3,133, -136,136,136,129,66,68,68,12,20,34,34,98,160,16,17,17,3,133,136,136,136, -129,66,68,68,12,20,34,34,98,160,16,17,17,49,80,136,136,136,129,66,68,68, -12,20,34,34,98,160,16,17,17,49,80,136,136,136,129,66,68,68,12,20,34,34, -98,160,16,17,17,49,80,136,136,136,129,66,68,68,12,20,34,34,98,160,16,17, -17,49,80,136,136,136,129,66,68,68,12,20,34,34,34,6,10,17,17,49,80,136,136, -136,129,66,68,68,12,20,34,34,34,6,10,17,17,49,80,136,136,136,129,66,68, -68,12,20,34,34,34,6,10,17,17,49,80,136,136,136,129,66,68,68,12,20,34,34, -34,6,10,17,17,49,80,136,136,136,129,66,68,68,196,64,33,34,34,6,10,17,17, -49,80,136,136,136,129,66,68,68,196,64,33,34,34,6,10,17,17,49,80,136,136, -136,129,66,68,68,196,64,33,34,34,6,10,17,17,49,80,136,136,136,129,66,68, -68,196,64,33,34,34,6,10,17,17,49,80,136,136,136,24,40,68,68,196,64,33,34, -34,6,10,17,17,49,80,136,136,136,24,40,68,68,196,64,33,34,34,6,10,17,17, -49,80,136,136,136,24,40,68,68,196,64,33,34,34,6,10,17,17,49,80,136,136, -136,24,40,68,68,196,64,33,34,34,6,10,17,17,17,3,133,136,136,24,40,68,68, -196,64,33,34,34,6,10,17,17,17,3,133,136,136,24,40,68,68,196,64,33,34,34, -6,10,17,17,17,3,133,136,136,24,40,68,68,196,64,33,162,9,121,250,233,167, -81,95,95,63,230,99,78,157,58,133,112,56,140,243,231,207,231,221,215,217, -217,137,229,203,151,195,239,247,163,180,180,20,223,249,206,119,76,247,175, -89,179,6,62,159,15,85,85,85,248,237,111,127,91,212,125,54,155,173,224,109, -52,147,113,13,187,118,237,66,125,125,61,92,46,23,230,206,157,139,61,123, -246,20,124,109,235,53,6,2,1,44,93,186,20,93,93,93,19,254,183,24,237,125, -63,255,252,243,147,254,119,96,179,217,176,98,197,10,227,231,13,27,54,32, -24,12,34,16,8,140,250,222,39,250,156,55,149,16,209,77,213,221,221,45,193, -96,80,158,120,226,137,113,31,123,239,189,247,202,210,165,75,243,126,223, -220,220,44,94,175,87,118,236,216,33,27,55,110,20,0,242,232,163,143,138, -136,200,134,13,27,196,225,112,200,246,237,219,101,221,186,117,2,64,14,28, -56,48,238,125,45,45,45,198,77,221,183,121,243,230,81,175,109,50,174,161, -170,170,74,102,205,154,37,207,63,255,188,204,156,57,83,166,76,153,82,240, -181,1,200,23,190,240,5,105,105,105,145,189,123,247,202,111,126,243,27,1, -32,15,61,244,208,132,255,61,244,231,210,111,221,221,221,147,254,183,0,64, -154,154,154,140,159,157,78,167,52,54,54,202,174,93,187,36,157,78,223,144, -231,188,153,24,40,68,55,217,79,127,250,83,113,56,28,18,139,197,68,68,36, -157,78,203,218,181,107,37,24,12,74,40,20,146,85,171,86,25,247,237,220,185, -83,0,200,209,163,71,77,207,177,109,219,54,121,234,169,167,76,141,200,218, -181,107,69,68,164,182,182,86,22,44,88,32,34,34,151,46,93,18,0,178,97,195, -134,113,239,83,90,91,91,165,164,164,68,190,245,173,111,141,249,62,38,227, -26,234,234,234,228,179,159,253,172,124,252,241,199,210,216,216,40,245,245, -245,163,54,154,203,150,45,147,100,50,41,137,68,66,94,121,229,21,1,32,63, -251,217,207,68,68,228,107,95,251,154,248,124,62,227,241,127,250,211,159, -4,128,236,218,181,107,212,231,26,171,129,94,188,120,177,204,154,53,75,170, -171,171,69,68,228,195,15,63,148,5,11,22,136,219,237,22,175,215,43,75,150, -44,145,190,190,62,227,241,247,223,127,191,44,93,186,84,60,30,143,220,126, -251,237,114,242,228,201,113,27,127,0,166,219,245,188,254,162,69,139,100, -217,178,101,226,241,120,228,206,59,239,148,214,214,86,6,10,209,39,209,252, -249,243,165,161,161,193,248,121,245,234,213,226,118,187,229,137,39,158, -144,167,158,122,74,156,78,167,252,224,7,63,16,17,145,182,182,54,83,67,89, -200,195,15,63,44,0,228,153,103,158,17,17,17,151,203,101,52,144,217,108, -86,0,200,234,213,171,199,189,79,89,188,120,177,148,149,149,73,50,153,44, -250,61,221,168,107,56,126,252,184,4,131,65,1,32,129,64,64,142,29,59,54, -106,67,108,189,213,214,214,26,223,234,95,122,233,37,1,32,219,182,109,19, -17,145,133,11,23,26,141,113,49,207,101,109,208,157,78,167,236,216,177,67, -118,239,222,109,124,41,104,108,108,148,23,94,120,65,54,109,218,36,0,100, -203,150,45,198,227,93,46,151,60,249,228,147,242,171,95,253,74,0,200,119, -191,251,221,113,3,165,165,165,197,212,91,186,158,215,119,187,221,242,199, -63,254,81,54,111,222,44,0,100,221,186,117,12,20,162,79,34,183,219,45,247, -222,123,175,241,115,32,16,144,175,126,245,171,198,207,217,108,54,175,209, -177,54,250,202,131,15,62,40,0,228,155,223,252,166,241,187,235,9,148,55, -223,124,83,0,200,99,143,61,54,102,195,59,89,215,240,245,175,127,93,42,43, -43,229,159,255,252,167,84,84,84,152,62,39,235,181,44,90,180,72,222,122, -235,45,121,227,141,55,100,231,206,157,226,247,251,101,249,242,229,198,99, -170,171,171,229,158,123,238,145,179,103,207,138,205,102,147,95,255,250, -215,227,62,151,126,179,14,137,89,253,235,95,255,146,71,31,125,84,22,47, -94,44,0,228,231,63,255,185,169,71,161,255,247,43,86,172,40,106,120,170, -208,112,213,141,120,253,230,230,230,155,242,183,237,228,244,40,209,77,94, -9,99,183,195,110,55,175,135,201,102,179,198,255,127,251,237,183,49,117, -234,84,84,87,87,27,191,243,120,60,121,207,211,212,212,132,23,95,124,17, -223,255,254,247,241,251,223,255,222,248,253,140,25,51,208,211,211,3,0,232, -238,238,6,0,124,234,83,159,26,247,62,0,216,185,115,39,0,224,129,7,30,200, -123,189,183,222,122,107,210,175,161,165,165,5,95,250,210,151,176,124,249, -114,124,238,115,159,195,254,253,251,71,253,28,203,202,202,176,96,193,2, -0,192,23,191,248,69,60,247,220,115,216,187,119,175,113,255,250,245,235, -241,147,159,252,4,27,55,110,132,195,225,192,131,15,62,88,212,115,21,82, -94,94,110,250,249,190,251,238,195,209,163,71,177,105,211,38,124,249,203, -95,198,43,175,188,130,43,109,247,21,193,96,208,58,87,125,93,127,51,215, -251,250,35,35,35,55,229,111,155,129,66,116,147,125,230,51,159,65,123,123, -187,169,113,120,225,133,23,176,117,235,86,248,253,126,172,95,191,30,43, -87,174,196,223,254,246,55,156,62,125,26,0,48,111,222,60,211,115,252,248, -199,63,198,139,47,190,136,123,238,185,7,205,205,205,216,183,111,31,170, -170,170,208,216,216,136,101,203,150,225,201,39,159,196,95,254,242,23,35, -4,154,154,154,0,96,204,251,0,224,181,215,94,67,117,117,181,41,204,20,107, -131,59,25,215,240,233,79,127,26,135,14,29,194,115,207,61,135,195,135,15, -231,189,111,221,229,203,151,177,111,223,62,0,192,249,243,231,241,198,27, -111,160,177,177,209,184,255,225,135,31,198,99,143,61,134,29,59,118,96,229, -202,149,152,58,117,106,81,207,165,204,153,51,199,248,28,172,95,0,94,125, -245,85,84,86,86,34,28,14,227,175,127,253,43,0,32,151,203,77,234,151,144, -255,228,235,115,149,23,209,127,169,141,27,55,138,195,225,48,126,78,167, -211,178,102,205,26,241,251,253,226,243,249,164,169,169,201,152,96,125,230, -153,103,4,128,156,56,113,194,244,28,94,175,55,111,204,95,31,42,89,187,118, -173,248,124,62,169,168,168,144,199,31,127,220,244,223,142,117,159,199,227, -145,175,124,229,43,69,189,143,201,184,134,227,199,143,203,93,119,221,37, -78,167,83,238,184,227,14,57,126,252,120,81,243,30,110,183,91,62,255,249, -207,231,77,126,127,227,27,223,16,0,178,103,207,158,49,39,221,11,221,126, -249,203,95,142,58,12,245,135,63,252,65,170,170,170,36,24,12,202,143,126, -244,35,153,53,107,150,172,92,185,178,232,97,172,137,14,121,77,214,235,223, -104,54,185,222,190,24,17,77,72,60,30,199,180,105,211,176,117,235,214,130, -67,75,186,149,43,87,34,30,143,99,247,238,221,252,224,38,224,220,185,115, -120,231,157,119,240,208,67,15,161,180,180,20,109,109,109,252,80,110,198, -112,46,63,2,162,155,203,239,247,99,203,150,45,216,178,101,203,152,143,107, -107,107,195,190,125,251,176,117,235,86,126,104,19,212,210,210,130,85,171, -86,33,28,14,227,207,127,254,51,63,144,155,132,61,20,34,34,98,15,133,136, -136,254,123,252,63,245,186,94,79,163,141,65,69,0,0,0,0,73,69,78,68,174, -66,96,130}; +0,0,18,116,1,222,102,31,120,0,0,0,7,116,73,77,69,7,217,8,30,9,40,17,65, +111,57,253,0,0,32,0,73,68,65,84,120,218,236,189,121,120,148,229,185,63, +254,153,204,62,147,153,73,38,43,9,132,53,32,4,148,69,41,106,171,21,44,109, +173,90,151,90,109,109,207,105,107,81,123,218,83,187,216,106,61,167,181, +87,237,233,117,218,218,69,219,83,91,183,186,213,42,184,32,184,32,130,136, +2,134,32,155,97,11,144,16,2,89,39,147,217,247,237,247,135,191,251,249,62, +243,102,182,144,73,64,123,127,174,43,87,2,153,204,188,239,243,62,207,253, +185,247,91,149,74,165,82,96,48,24,12,6,99,148,40,225,37,96,48,24,12,6,19, +10,131,193,96,48,152,80,24,12,6,131,193,132,194,96,48,24,12,6,19,10,131, +193,96,48,152,80,24,12,6,131,193,132,194,96,48,24,12,38,20,6,131,193,96, +48,152,80,24,12,6,131,193,132,194,96,48,24,12,38,20,6,131,193,96,48,161, +48,24,12,6,131,193,132,194,96,48,24,12,38,20,6,131,193,96,48,161,48,24, +12,6,131,193,132,194,96,48,24,12,38,20,6,131,193,96,48,161,48,24,12,6,131, +9,133,193,96,48,24,12,38,20,6,131,193,96,48,161,48,24,12,6,131,9,133,193, +96,48,24,76,40,12,6,131,193,96,48,161,48,24,12,6,131,9,133,193,96,48,24, +76,40,12,6,131,193,96,66,97,48,24,12,6,131,9,133,193,96,48,24,76,40,12, +6,131,193,96,66,97,48,24,12,6,131,9,133,193,96,48,24,76,40,12,6,131,193, +96,66,97,48,24,12,6,19,10,131,193,96,48,24,76,40,12,6,131,193,96,66,97, +48,24,12,6,19,10,131,193,96,48,152,80,24,12,6,131,193,96,66,97,48,24,12, +6,19,10,131,193,96,48,152,80,24,12,6,131,193,132,194,96,48,24,12,6,19,10, +131,193,96,48,152,80,24,12,6,131,193,132,194,96,48,24,12,6,19,10,131,193, +96,48,152,80,24,12,6,131,193,132,194,96,48,24,12,38,20,6,131,193,96,48, +152,80,24,12,6,131,193,132,194,96,48,24,12,38,20,6,131,193,96,48,161,48, +24,12,6,131,193,132,194,96,48,24,12,38,20,6,131,193,96,48,161,48,24,12, +6,131,9,133,193,96,48,24,12,38,20,6,131,193,96,48,161,48,24,12,6,131,9, +133,193,96,48,24,12,38,20,6,131,193,96,48,161,48,24,12,6,131,9,133,193, +96,48,24,76,40,12,6,131,193,96,48,161,48,24,12,6,131,9,133,193,96,48,24, +76,40,12,6,131,193,96,66,97,48,24,12,6,131,9,133,193,96,48,24,76,40,12, +6,131,193,96,66,97,48,24,12,6,19,10,131,193,96,48,24,76,40,12,6,131,193, +96,66,97,48,24,12,6,19,10,131,193,96,48,24,76,40,12,6,131,193,96,66,97, +48,24,12,6,19,10,131,193,96,48,152,80,24,12,6,131,193,96,66,97,48,24,12, +6,19,10,131,193,96,48,152,80,24,12,6,131,193,132,194,96,48,24,12,6,19,10, +131,193,96,48,152,80,24,12,6,131,193,132,194,96,48,24,12,38,20,94,2,6,131, +193,96,48,161,48,24,12,6,131,9,133,193,96,48,24,76,40,12,6,131,193,96,48, +161,48,24,12,6,131,9,133,193,96,48,24,76,40,12,6,131,193,96,66,97,48,24, +12,6,131,9,133,193,96,48,24,76,40,12,6,131,193,96,66,97,48,24,12,6,19,10, +131,193,96,48,24,76,40,12,6,131,193,96,66,97,48,24,12,6,19,10,131,193,96, +48,24,76,40,12,6,131,193,96,66,97,48,24,12,6,19,10,131,193,96,48,152,80, +24,12,6,131,193,96,66,97,48,24,12,6,19,10,131,193,96,48,152,80,24,12,6, +131,193,132,194,96,48,24,12,6,19,10,131,193,96,48,152,80,24,12,6,131,193, +132,194,96,48,24,12,38,20,6,131,193,96,48,152,80,24,12,6,131,193,132,194, +96,48,24,12,38,20,6,131,193,96,48,0,0,26,94,130,127,109,60,255,252,243, +88,185,114,37,66,161,16,166,79,159,142,111,126,243,155,104,106,106,226, +133,97,48,24,76,40,103,42,28,14,7,146,201,36,84,42,21,0,160,186,186,122, +196,239,145,74,165,196,223,143,6,205,205,205,120,228,145,71,208,223,223, +159,246,255,237,237,237,232,237,237,69,101,101,37,74,74,74,80,82,82,2,171, +213,10,173,86,203,15,144,193,96,48,161,20,27,110,183,27,253,253,253,112, +185,92,232,233,233,129,195,225,64,123,123,59,124,62,31,186,187,187,139, +242,25,245,245,245,176,219,237,152,55,111,30,42,43,43,49,99,198,12,76,153, +50,37,35,153,4,131,65,104,181,218,130,132,254,125,247,221,135,141,27,55, +102,252,157,86,171,197,213,87,95,141,73,147,38,193,237,118,67,165,82,65, +163,209,32,28,14,195,96,48,48,177,48,24,140,188,80,165,82,169,20,47,67, +186,128,110,107,107,67,103,103,39,28,14,7,58,59,59,209,222,222,142,80,40, +116,70,92,159,209,104,196,156,57,115,48,119,238,92,204,155,55,15,51,103, +206,204,107,141,60,251,236,179,104,111,111,207,250,154,101,203,150,97,222, +188,121,208,235,245,72,38,147,40,41,41,129,90,173,134,94,175,135,78,167, +131,217,108,134,201,100,66,105,105,41,76,38,211,135,242,185,134,195,97, +68,163,81,196,98,177,52,18,53,153,76,208,104,254,159,94,229,116,58,97,52, +26,97,52,26,139,98,13,50,24,76,40,255,34,232,234,234,194,145,35,71,176, +123,247,110,236,217,179,7,94,175,247,67,123,47,245,245,245,152,61,123,54, +22,47,94,12,163,209,136,245,235,215,99,203,150,45,40,228,241,222,126,251, +237,80,171,213,232,235,235,3,0,148,148,148,64,167,211,193,96,48,192,96, +48,160,180,180,20,70,163,17,102,179,25,117,117,117,31,10,65,27,143,199, +209,221,221,93,176,34,160,209,104,96,54,155,81,89,89,9,175,215,139,64,32, +0,173,86,11,141,70,3,173,86,11,155,205,246,145,36,152,161,161,161,180,127, +211,126,9,133,66,176,90,173,176,90,173,167,237,122,228,189,155,72,36,144, +74,165,80,93,93,93,212,231,112,232,208,161,172,191,179,217,108,176,217, +108,66,249,96,11,157,9,101,24,129,236,216,177,3,235,214,173,27,22,63,248, +87,199,178,101,203,112,249,229,151,163,187,187,27,109,109,109,80,171,213, +176,88,44,48,26,141,176,217,108,152,57,115,38,106,106,106,196,235,219,219, +219,225,247,251,81,82,82,130,121,243,230,157,49,247,17,137,68,112,226,196, +9,196,227,241,83,126,15,157,78,135,170,170,42,244,244,244,8,215,159,94, +175,255,72,186,254,114,9,212,138,138,10,164,82,41,164,82,41,104,52,26,24, +141,198,49,183,80,115,93,143,193,96,128,94,175,23,74,143,70,163,25,245, +243,200,245,121,116,175,102,179,153,93,190,76,40,255,207,229,179,118,237, +90,28,58,116,40,205,221,193,200,140,243,206,59,15,87,92,113,5,188,94,47, +60,30,15,154,154,154,48,109,218,52,0,64,107,107,43,30,126,248,97,28,59, +118,44,237,111,110,185,229,22,44,89,178,4,106,181,26,102,179,249,180,29, +188,174,174,46,4,131,193,162,189,159,209,104,132,203,229,66,42,149,130, +78,167,131,86,171,133,193,96,128,217,108,134,221,110,255,72,88,44,185,4, +170,86,171,69,60,30,135,74,165,130,90,173,134,86,171,133,94,175,135,197, +98,25,51,98,201,117,61,26,141,6,145,72,68,252,172,215,235,197,51,169,168, +168,24,147,207,11,133,66,66,97,10,135,195,31,8,77,233,185,71,34,17,4,2, +1,212,214,214,178,139,20,31,209,160,124,115,115,51,94,127,253,117,236,220, +185,243,180,95,139,221,110,135,78,167,67,121,121,185,216,164,6,131,1,106, +181,122,216,107,163,209,40,124,62,31,124,62,31,250,251,251,113,58,184,126, +199,142,29,216,177,99,7,106,107,107,241,173,111,125,11,102,179,25,47,189, +244,18,158,126,250,233,172,238,163,142,142,14,52,53,53,161,164,164,4,161, +80,72,184,143,198,51,222,114,244,232,209,81,89,37,153,16,10,133,96,50,153, +224,118,187,225,118,187,97,52,26,97,177,88,16,139,197,16,141,70,97,52,26, +81,86,86,246,145,21,14,62,159,15,193,96,80,184,253,116,58,29,98,177,24, +146,201,100,154,6,63,94,72,38,147,194,37,70,100,98,50,153,144,72,36,144, +76,38,81,85,85,85,116,107,215,233,116,2,0,142,31,63,158,117,255,27,12,6, +244,244,244,64,171,213,66,173,86,143,139,37,199,132,50,14,218,233,227,143, +63,142,29,59,118,140,233,231,212,212,212,8,87,144,213,106,133,74,165,130, +74,165,66,50,153,68,40,20,66,56,28,70,44,22,19,241,152,120,60,142,88,44, +134,129,129,129,52,130,80,106,51,114,96,88,165,82,161,190,190,30,86,171, +21,54,155,13,106,181,26,169,84,10,161,80,8,221,221,221,227,226,174,235, +235,235,195,221,119,223,157,247,117,83,167,78,197,236,217,179,225,114,185, +160,209,104,160,211,233,160,215,235,17,143,199,17,141,70,199,69,224,142, +5,153,200,66,204,102,179,193,237,118,35,16,8,32,20,10,161,180,180,84,60, +215,68,34,113,202,218,241,153,14,178,82,75,74,74,160,215,235,161,215,235, +81,90,90,138,68,34,33,44,152,241,180,70,233,28,169,84,42,232,116,58,24, +141,70,196,98,49,196,227,113,196,227,113,148,148,148,20,245,89,16,161,144, +219,47,27,18,137,4,2,129,0,52,26,13,84,42,149,136,61,234,116,186,143,180, +194,241,145,36,148,119,222,121,7,143,60,242,200,176,224,226,104,80,91,91, +139,154,154,26,152,205,102,104,52,26,36,18,9,132,66,33,56,157,78,132,195, +97,184,92,46,12,13,13,161,187,187,27,169,84,74,28,48,0,25,255,173,132,76, +38,106,181,26,42,149,42,205,29,167,209,104,16,141,70,17,12,6,5,121,16,225, +168,84,42,204,153,51,7,118,187,29,161,80,8,39,79,158,60,45,241,160,37,75, +150,160,161,161,1,102,179,89,28,60,141,70,3,147,201,4,189,94,15,163,209, +40,52,217,177,60,84,237,237,237,99,70,38,242,51,156,52,105,18,182,109,219, +6,155,205,134,80,40,36,200,146,62,251,163,72,42,30,143,7,14,135,67,100, +252,153,205,102,177,183,213,106,53,220,110,119,209,173,130,124,132,50,56, +56,40,146,70,104,239,209,51,40,118,156,39,18,137,96,104,104,8,67,67,67, +57,247,88,44,22,131,211,233,20,110,65,163,209,40,210,237,63,202,10,199, +71,138,80,30,125,244,81,172,94,189,122,212,239,163,213,106,49,121,242,100, +145,61,50,48,48,0,159,207,39,50,158,172,86,43,44,22,11,236,118,59,154,154, +154,96,54,155,197,191,1,192,98,177,100,205,132,33,173,22,0,250,251,251, +145,76,38,49,56,56,8,143,199,3,175,215,11,167,211,9,143,199,3,159,207,135, +120,60,46,200,133,54,175,236,22,139,197,98,130,136,250,251,251,133,41,14, +0,11,23,46,132,209,104,196,209,163,71,199,156,92,76,38,19,62,249,201,79, +34,26,141,194,239,247,35,20,10,65,173,86,139,128,105,48,24,132,197,98,17, +68,170,213,106,17,139,197,198,68,147,237,237,237,45,40,46,150,74,165,224, +118,187,49,48,48,128,142,142,14,120,189,94,152,76,38,76,159,62,29,13,13, +13,40,45,45,205,251,30,68,228,187,118,237,130,205,102,19,110,22,153,44, +63,106,130,195,227,241,192,233,116,166,89,157,180,47,41,166,20,12,6,199, +205,189,67,46,47,149,74,5,163,209,136,104,52,138,120,60,46,174,69,171,213, +34,16,8,140,232,122,12,6,131,176,50,232,123,50,153,68,60,30,71,32,16,128, +199,227,65,60,30,23,202,81,38,196,227,113,56,28,14,97,201,81,218,185,197, +98,17,127,59,158,196,203,132,82,32,156,78,39,30,126,248,97,108,221,186, +117,84,239,51,101,202,20,76,154,52,9,137,68,2,221,221,221,136,197,98,8, +135,195,48,153,76,56,255,252,243,209,208,208,128,153,51,103,10,97,225,245, +122,17,14,135,225,112,56,16,8,4,224,245,122,209,209,209,1,159,207,7,0,194, +21,146,9,165,165,165,98,211,150,149,149,193,110,183,163,190,190,94,4,54, +109,54,155,248,185,171,171,11,78,167,19,29,29,29,24,28,28,68,91,91,155, +112,37,229,66,119,119,55,226,241,56,82,169,20,22,46,92,136,88,44,134,214, +214,214,49,121,6,90,173,22,209,104,20,125,125,125,208,233,116,226,48,211, +65,146,5,172,90,173,134,223,239,135,90,173,30,19,97,75,235,159,11,110,183, +27,175,189,246,26,122,123,123,133,0,34,55,73,115,115,51,0,224,226,139,47, +198,37,151,92,146,151,244,202,202,202,16,141,70,225,116,58,17,141,70,211, +132,12,61,163,143,18,169,4,2,1,184,221,110,148,148,148,192,108,54,11,242, +38,197,193,96,48,140,88,128,143,214,98,112,56,28,105,169,220,180,39,117, +58,29,76,38,19,162,209,232,136,58,74,212,215,215,99,96,96,0,129,64,64,88, +35,110,183,27,30,143,71,184,176,233,108,21,98,57,201,100,34,123,42,0,252, +75,144,202,135,130,80,98,177,24,254,235,191,254,43,103,70,70,62,237,114, +238,220,185,40,47,47,135,203,229,66,44,22,131,94,175,199,212,169,83,177, +98,197,10,33,4,200,98,232,237,237,197,166,77,155,112,226,196,137,81,107, +252,35,249,123,173,86,139,134,134,6,145,166,59,103,206,28,196,98,49,28, +57,114,4,29,29,29,195,50,152,40,55,159,14,80,42,149,194,241,227,199,145, +76,38,49,123,246,108,152,205,102,236,220,185,179,168,193,125,143,199,131, +131,7,15,98,201,146,37,104,110,110,22,38,62,213,169,208,122,235,116,58, +132,66,33,84,86,86,10,193,94,76,215,87,87,87,87,78,173,17,248,32,89,96, +237,218,181,105,177,173,76,194,97,227,198,141,56,120,240,32,110,189,245, +86,145,150,154,109,31,205,154,53,11,91,183,110,21,194,149,90,212,80,49, +232,120,106,236,163,117,227,229,19,186,110,183,27,94,175,87,184,100,41, +62,224,247,251,133,91,103,60,99,40,201,100,82,164,170,235,116,58,65,110, +68,36,209,104,84,184,167,11,125,6,20,7,75,38,147,72,36,18,34,246,23,141, +70,69,49,44,253,62,219,122,37,18,9,244,247,247,139,212,114,131,193,128, +72,36,34,18,24,104,223,39,147,73,216,237,246,143,116,250,241,25,77,40,177, +88,12,119,223,125,55,246,237,219,119,74,36,178,104,209,34,88,173,86,132, +195,97,84,87,87,99,222,188,121,152,59,119,174,8,230,29,59,118,12,7,14,28, +192,254,253,251,209,215,215,119,90,211,138,173,86,43,212,106,181,208,146, +72,227,33,119,210,140,25,51,224,112,56,210,138,47,137,76,72,72,82,112,50, +30,143,163,191,191,31,241,120,28,211,167,79,135,86,171,197,193,131,7,139, +118,173,221,221,221,120,243,205,55,241,239,255,254,239,216,181,107,23,58, +58,58,196,193,179,88,44,152,48,97,2,102,207,158,45,220,130,94,175,23,39, +78,156,40,170,63,57,95,122,240,208,208,16,214,172,89,35,220,114,36,56,72, +144,146,123,145,44,139,129,129,1,108,218,180,9,203,150,45,203,121,224,171, +171,171,225,245,122,81,82,82,34,44,51,242,157,203,154,178,82,120,135,66, +33,68,34,17,65,130,244,183,68,96,244,26,42,166,28,77,10,106,36,18,17,66, +145,72,128,174,73,238,41,151,175,159,92,56,28,134,223,239,23,107,36,199, +7,74,74,74,48,117,234,212,180,123,141,199,227,34,190,36,43,73,178,75,152, +58,17,200,107,28,139,197,10,234,76,144,72,36,196,115,55,26,141,208,104, +52,8,6,131,8,6,131,98,125,99,177,216,136,8,197,100,50,161,161,161,97,216, +255,191,244,210,75,216,189,123,247,48,43,35,19,140,70,35,126,246,179,159, +141,155,34,224,247,251,11,94,227,241,38,175,51,150,80,238,185,231,158,83, +202,216,106,108,108,68,67,67,3,76,38,19,154,154,154,48,127,254,124,152, +76,38,4,131,65,28,59,118,12,27,54,108,16,174,164,177,4,165,52,82,108,161, +164,164,68,104,41,241,120,28,193,96,80,108,126,191,223,143,96,48,8,149, +74,37,82,15,93,46,23,180,90,173,248,63,18,130,148,126,44,111,176,100,50, +41,218,138,144,75,135,220,120,148,72,112,225,133,23,162,181,181,181,104, +221,0,92,46,23,254,248,199,63,98,217,178,101,248,222,247,190,55,172,5,204, +225,195,135,241,252,243,207,99,195,134,13,194,29,120,203,45,183,96,241, +226,197,163,174,60,151,227,71,217,20,145,103,158,121,70,144,73,56,28,78, +11,38,107,52,26,225,54,145,221,137,239,189,247,30,174,186,234,42,81,111, +144,205,133,169,209,104,224,247,251,211,72,33,24,12,166,185,73,201,117, +34,31,252,108,40,41,41,17,174,207,222,222,94,65,80,35,73,65,141,68,34,232, +235,235,203,217,25,192,96,48,192,98,177,136,189,159,143,80,66,161,144,72, +3,39,98,138,68,34,56,231,156,115,68,71,106,178,234,115,221,103,79,79,15, +128,15,10,70,109,54,91,154,139,88,173,86,35,145,72,192,104,52,230,117,9, +145,245,65,103,33,22,139,33,18,137,32,145,72,8,133,166,16,2,80,90,177,116, +46,233,123,42,149,194,204,153,51,161,211,233,240,214,91,111,21,244,252, +246,237,219,39,246,51,157,245,146,146,146,97,255,39,255,156,74,165,196, +51,214,104,52,89,235,184,124,62,31,28,14,71,193,107,108,183,219,197,26, +107,181,90,17,219,25,143,110,15,103,28,161,60,255,252,243,120,250,233,167, +71,100,45,104,181,90,156,123,238,185,168,169,169,65,99,99,35,22,45,90,4, +147,201,132,129,129,1,108,217,178,5,7,15,30,196,192,192,64,81,174,207,102, +179,193,104,52,10,147,59,149,74,33,26,141,138,195,231,245,122,49,48,48, +144,22,100,167,239,164,17,147,192,160,127,203,90,41,105,185,106,181,90, +152,246,244,30,26,141,38,109,99,202,174,0,178,76,136,88,2,129,0,140,70, +35,66,161,16,116,58,29,90,91,91,97,181,90,81,83,83,131,35,71,142,20,237, +121,109,220,184,49,107,195,201,97,155,77,163,129,215,235,133,86,171,69, +36,18,129,94,175,63,37,55,88,62,101,224,240,225,195,24,26,26,18,207,132, +246,146,78,167,19,153,64,212,167,140,200,133,4,214,123,239,189,135,166, +166,166,156,7,175,174,174,78,184,32,125,62,31,42,42,42,240,201,79,126,82, +16,201,72,247,90,50,153,132,203,229,130,199,227,65,89,89,25,124,62,31,220, +110,183,40,218,203,151,130,90,104,65,103,56,28,22,177,194,66,178,34,105, +47,209,30,87,169,84,248,218,215,190,134,170,170,42,244,247,247,195,227, +241,228,117,59,42,223,143,98,32,6,131,65,100,6,142,68,59,39,215,91,36,18, +73,179,196,72,177,162,239,35,185,166,108,30,14,181,90,157,177,94,44,211, +107,51,221,135,156,110,156,237,154,136,12,73,38,132,66,33,76,152,48,65, +88,246,125,125,125,35,190,159,190,190,62,81,11,54,52,52,36,100,76,32,16, +128,193,96,24,211,162,220,51,134,80,90,91,91,241,203,95,254,114,68,77,24, +27,27,27,49,121,242,100,216,237,118,124,234,83,159,66,77,77,13,156,78,39, +154,155,155,209,218,218,122,202,36,66,135,151,52,50,74,223,29,24,24,128, +223,239,23,194,145,54,19,249,208,229,255,215,235,245,105,36,34,147,130, +146,72,100,45,130,72,68,249,157,136,136,254,158,190,104,211,210,161,167, +162,187,210,210,82,132,195,97,225,14,8,6,131,240,251,253,240,122,189,88, +182,108,89,193,36,80,44,204,157,59,23,165,165,165,240,122,189,162,64,142, +92,20,149,149,149,35,218,224,185,82,56,227,241,56,94,123,237,181,97,100, +66,107,77,53,68,36,164,13,6,131,208,8,19,137,4,118,237,218,133,242,242, +114,216,108,54,33,12,200,85,70,207,155,210,133,163,209,40,116,58,29,174, +187,238,58,0,31,164,48,143,198,109,74,89,76,212,86,196,237,118,139,122, +11,74,134,32,45,159,214,139,220,141,35,117,23,22,210,163,43,30,143,35,28, +14,11,18,254,214,183,190,133,170,170,42,28,62,124,120,68,66,46,211,251, +6,131,65,232,116,58,244,247,247,23,36,180,105,237,73,248,146,155,87,142, +35,230,19,222,103,106,44,203,227,241,8,11,144,170,242,115,21,82,22,186, +198,62,159,15,90,173,22,14,135,67,184,98,13,6,131,72,105,30,139,4,146,51, +130,80,238,189,247,94,188,253,246,219,5,111,170,11,46,184,64,164,125,94, +124,241,197,48,155,205,104,111,111,199,154,53,107,208,217,217,57,226,207, +175,174,174,134,94,175,135,207,231,195,177,99,199,112,252,248,241,172,190, +118,114,69,200,191,35,211,93,38,16,249,255,100,18,33,43,131,52,18,178,70, +40,21,83,38,21,138,159,80,144,155,94,67,2,71,22,194,100,238,147,144,38, +43,37,28,14,139,102,135,70,163,17,62,159,15,187,118,237,194,21,87,92,129, +151,95,126,121,92,170,241,167,76,153,130,5,11,22,192,227,241,32,18,137, +192,96,48,8,191,57,0,12,14,14,22,76,42,185,220,81,192,7,73,16,126,191,95, +4,225,233,57,104,181,90,145,77,103,54,155,81,90,90,42,50,240,136,252,201, +202,123,239,189,247,224,245,122,5,17,211,123,145,118,76,177,4,149,74,133, +27,110,184,1,0,208,214,214,86,180,181,148,221,47,131,131,131,162,160,144, +214,140,44,149,147,39,79,142,152,76,100,77,246,232,209,163,121,93,135,36, +192,175,187,238,58,76,153,50,5,7,15,30,44,138,118,75,113,28,181,90,141, +129,129,129,140,150,119,166,235,33,151,150,28,51,164,103,67,150,122,49, +49,214,228,148,74,165,4,169,46,90,180,72,88,156,197,232,110,78,215,174, +211,233,224,112,56,68,147,87,147,201,4,139,197,50,38,233,204,167,149,80, +90,91,91,241,243,159,255,188,32,173,142,136,196,96,48,160,161,161,1,87, +95,125,53,128,15,90,133,52,55,55,139,186,145,66,45,16,234,42,219,214,214, +134,119,223,125,87,8,117,89,88,203,150,133,76,20,178,117,34,255,172,36, +26,249,253,232,255,50,185,180,168,194,156,8,67,105,189,200,255,71,69,102, +244,190,74,173,36,153,76,34,22,139,9,45,212,239,247,163,180,180,84,88,39, +38,147,9,94,175,23,45,45,45,184,252,242,203,139,78,42,90,173,22,211,167, +79,135,217,108,22,197,103,0,68,60,193,96,48,192,104,52,14,203,182,34,119, +79,62,228,139,1,117,116,116,12,11,12,147,150,111,52,26,81,90,90,138,178, +178,50,148,149,149,137,118,252,228,126,76,165,82,162,55,147,209,104,20, +117,8,129,64,64,184,87,228,231,254,185,207,125,14,53,53,53,56,124,248,240, +152,16,115,121,121,185,240,141,71,34,17,132,66,161,180,140,68,178,150,71, +163,197,230,19,224,241,120,28,117,117,117,248,220,231,62,87,52,50,145,81, +89,89,137,35,71,142,192,96,48,228,93,67,34,17,186,118,217,50,33,119,23, +61,159,98,128,206,211,88,22,206,38,18,9,56,28,14,84,85,85,161,166,166,6, +61,61,61,69,237,71,7,124,80,43,119,228,200,17,145,129,40,215,199,36,147, +201,180,166,175,31,90,66,41,212,42,33,34,41,43,43,195,204,153,51,113,201, +37,151,0,0,246,238,221,139,117,235,214,21,28,100,214,106,181,168,168,168, +128,211,233,196,150,45,91,210,154,222,201,86,2,9,125,217,183,158,141,96, +148,223,229,215,209,103,146,117,65,110,49,138,137,40,45,19,217,42,33,75, +133,92,92,212,183,136,136,71,182,118,72,3,167,205,73,90,155,217,108,70, +52,26,133,217,108,22,89,47,68,44,36,92,223,127,255,125,124,243,155,223, +196,195,15,63,92,52,129,248,177,143,125,12,91,183,110,133,197,98,17,2,155, +44,130,80,40,148,166,97,147,187,80,110,250,151,15,249,132,232,174,93,187, +210,4,0,101,186,200,100,82,81,81,33,90,147,155,76,38,177,254,148,220,16, +12,6,17,8,4,224,243,249,132,191,159,44,21,90,167,138,138,10,44,93,186,20, +157,157,157,5,105,177,137,68,66,36,74,200,133,160,185,254,54,149,74,97, +218,180,105,216,177,99,7,130,193,32,108,54,27,102,205,154,37,8,165,16,237, +151,10,244,0,136,216,209,72,132,93,44,22,195,45,183,220,2,151,203,5,181, +90,157,247,122,253,126,63,28,14,135,40,112,173,171,171,203,153,105,164, +82,169,48,117,234,84,244,244,244,228,21,220,167,195,149,69,25,109,201,100, +50,171,107,110,104,104,8,251,246,237,75,43,224,165,179,42,43,135,228,153, +160,223,211,251,14,13,13,225,227,31,255,184,88,191,124,207,52,16,8,192, +233,116,194,231,243,193,98,177,160,182,182,54,239,115,157,54,109,26,246, +236,217,35,44,93,217,141,75,132,246,161,36,148,182,182,54,220,117,215,93, +5,89,37,11,23,46,132,221,110,199,156,57,115,112,233,165,151,34,149,74,161, +165,165,5,155,54,109,42,152,72,106,106,106,16,10,133,176,99,199,14,244, +245,245,165,5,195,73,160,147,112,206,20,44,151,99,31,50,97,208,230,144, +191,147,176,151,243,228,41,189,148,54,146,146,64,228,223,19,161,16,137, +16,241,208,103,147,101,162,220,160,114,6,153,156,79,31,139,197,96,50,153, +68,32,54,24,12,138,248,1,37,22,180,180,180,96,197,138,21,120,240,193,7, +139,242,124,223,127,255,125,84,87,87,139,180,101,114,193,69,163,81,17,151, +144,215,139,92,96,100,89,229,75,115,204,37,116,34,145,8,6,6,6,210,172,19, +242,255,203,132,98,179,217,96,183,219,97,179,217,68,86,141,70,163,17,100, +28,137,68,224,243,249,68,225,166,223,239,23,89,51,244,222,203,150,45,43, +200,5,23,137,68,112,244,232,81,236,220,185,19,161,80,72,188,127,42,149, +66,125,125,61,62,255,249,207,11,215,95,38,80,202,239,224,224,160,176,80, +78,158,60,153,87,184,186,221,110,172,95,191,30,14,135,67,8,144,120,60,142, +57,115,230,96,249,242,229,5,17,75,44,22,67,77,77,13,22,44,88,128,61,123, +246,136,2,221,108,207,101,243,230,205,56,113,226,132,104,135,66,247,121, +211,77,55,193,110,183,103,189,230,218,218,90,180,181,181,229,93,75,186, +38,57,118,56,150,160,128,121,62,183,162,199,227,193,3,15,60,128,88,44,38, +206,39,237,57,178,8,40,35,80,62,187,116,174,205,102,51,102,206,156,137, +163,71,143,230,173,200,223,186,117,43,142,29,59,54,108,141,111,188,241, +70,212,212,212,100,181,206,108,54,27,194,225,176,176,180,201,117,72,125, +8,139,213,7,109,92,9,229,254,251,239,199,134,13,27,10,34,129,69,139,22, +33,22,139,225,134,27,110,64,85,85,21,118,239,222,141,53,107,214,20,228, +51,182,90,173,48,24,12,216,189,123,55,54,111,222,156,38,192,136,68,50,165, +143,42,127,166,7,79,2,63,147,187,138,72,131,200,129,72,67,14,160,19,209, +200,105,193,68,96,178,75,76,169,205,200,215,164,188,94,217,154,202,116, +232,200,125,163,215,235,17,137,68,96,52,26,17,12,6,69,241,149,201,100,130, +209,104,196,208,208,16,108,54,27,172,86,107,81,82,138,189,94,47,38,79,158, +140,131,7,15,138,202,116,217,21,65,201,7,180,177,73,136,23,74,40,249,52, +100,89,81,145,235,67,168,122,217,102,179,161,188,188,92,16,11,29,124,74, +95,37,43,130,200,132,218,213,123,189,94,68,163,81,97,73,45,89,178,4,93, +93,93,121,201,228,165,151,94,130,203,229,18,25,86,68,248,169,84,10,135, +14,29,194,209,163,71,113,251,237,183,231,20,214,211,166,77,195,129,3,7, +68,170,110,62,151,200,201,147,39,177,102,205,26,65,128,241,120,92,124,230, +206,157,59,209,209,209,145,183,136,147,246,209,162,69,139,224,118,187,115, +94,95,34,145,192,134,13,27,208,222,222,158,22,195,35,33,248,167,63,253, +9,63,249,201,79,178,102,116,169,84,42,84,85,85,21,228,90,82,18,201,88,146, +10,37,37,144,75,45,155,133,66,251,142,20,58,218,75,114,161,164,188,127, +19,137,132,72,123,214,104,52,152,63,127,126,26,89,102,251,140,77,155,54, +225,200,145,35,98,31,202,107,252,215,191,254,21,63,253,233,79,179,94,163, +74,165,194,244,233,211,209,220,220,44,8,69,169,44,23,99,230,203,184,17, +202,183,190,245,173,130,102,174,127,226,19,159,64,60,30,71,99,99,35,150, +45,91,6,175,215,139,71,31,125,52,231,8,91,224,131,182,24,58,157,14,61,61, +61,216,176,97,3,162,209,104,154,54,47,91,7,42,149,74,104,11,244,37,11,31, +217,189,68,174,39,165,85,33,255,31,101,105,201,169,134,68,8,202,74,106, +250,46,167,1,103,10,248,203,217,95,74,242,145,93,94,153,54,160,86,171,21, +51,60,168,43,0,17,9,89,40,212,66,95,173,86,227,208,161,67,248,210,151,190, +132,191,253,237,111,69,139,141,77,153,50,37,109,110,10,17,170,178,138,88, +206,164,42,134,123,66,22,74,244,76,137,64,201,245,70,196,98,177,88,132, +133,66,66,32,30,143,195,96,48,136,245,151,181,77,210,240,42,43,43,161,213, +106,115,106,212,169,84,10,175,189,246,26,28,14,7,194,225,176,176,78,72, +232,144,34,18,139,197,208,210,210,130,143,125,236,99,89,5,188,197,98,129, +207,231,19,53,28,185,72,53,20,10,225,133,23,94,72,75,38,144,215,68,163, +209,192,233,116,98,112,112,16,53,53,53,121,211,118,151,44,89,146,55,62, +121,244,232,81,236,223,191,95,16,137,28,60,39,65,249,238,187,239,98,241, +226,197,89,239,49,151,5,147,73,161,56,149,154,147,83,9,106,211,250,37,18, +137,17,11,91,58,95,23,94,120,161,144,39,242,255,71,163,81,28,56,112,0,117, +117,117,112,56,28,57,99,63,180,198,180,199,101,43,131,176,101,203,22,92, +112,193,5,89,175,211,110,183,11,165,145,20,93,146,113,90,173,22,67,67,67, +163,142,167,140,57,161,52,55,55,227,183,191,253,109,94,23,151,201,100,194, +39,62,241,9,248,124,62,92,127,253,245,152,54,109,26,154,155,155,177,110, +221,186,156,127,107,177,88,80,82,82,130,245,235,215,139,131,67,139,165, +180,22,148,22,8,45,38,253,76,193,91,114,47,17,153,200,243,213,149,150,131, +76,16,114,32,158,136,70,254,63,57,30,35,19,143,44,252,72,139,151,221,114, +202,236,177,66,54,54,89,47,114,5,55,145,10,221,47,253,191,211,233,196,188, +121,243,132,43,161,24,152,56,113,34,246,239,223,47,238,129,50,187,100,129, +163,172,25,136,70,163,163,110,91,162,236,175,69,207,201,108,54,11,98,144, +221,126,148,62,172,12,196,202,22,99,40,20,130,217,108,70,48,24,68,60,30, +199,164,73,147,210,136,33,155,95,157,82,63,149,130,93,169,32,180,182,182, +226,178,203,46,203,234,63,215,104,52,104,106,106,66,117,117,53,60,30,79, +206,251,63,118,236,24,2,129,0,2,129,128,16,58,148,177,72,123,175,164,164, +4,45,45,45,184,242,202,43,243,90,3,179,102,205,66,79,79,15,44,22,75,86, +45,254,149,87,94,129,207,231,27,70,38,114,22,228,161,67,135,176,116,233, +210,172,103,217,108,54,231,37,20,138,9,141,87,44,37,153,76,22,228,134,147, +33,43,143,116,86,111,187,237,54,244,244,244,32,149,74,165,101,179,37,18, +9,84,86,86,162,190,190,62,111,109,213,171,175,190,42,10,117,201,170,87, +174,241,158,61,123,112,233,165,151,102,93,227,210,210,82,209,255,142,148, +99,146,9,244,125,180,173,131,198,148,80,10,13,188,55,54,54,98,194,132,9, +80,171,213,248,238,119,191,11,147,201,132,103,158,121,38,103,131,67,114, +107,189,249,230,155,240,249,124,66,0,200,36,34,87,28,103,202,158,34,242, +32,45,149,72,132,4,45,105,241,202,32,57,9,3,138,115,200,194,129,132,185, +50,51,76,182,78,232,80,203,110,32,249,119,244,255,202,164,128,83,133,178, +222,133,214,69,38,172,80,40,132,165,75,151,22,173,62,165,174,174,14,235, +214,173,75,187,55,34,204,112,56,140,173,91,183,10,119,24,101,210,140,86, +227,44,41,41,17,154,171,76,8,178,197,73,214,10,29,34,34,86,121,173,200, +245,64,138,4,229,238,83,162,67,101,101,101,222,224,233,177,99,199,68,45, +12,185,77,100,203,82,126,38,225,112,88,100,228,101,67,85,85,21,172,86,43, +156,78,103,78,133,98,195,134,13,34,109,154,92,45,242,103,145,66,209,219, +219,139,234,234,234,156,193,125,157,78,135,250,250,122,12,14,14,230,180, +136,190,248,197,47,138,103,168,204,180,34,143,0,37,99,56,28,142,140,239, +67,221,131,243,17,138,236,50,28,107,183,87,34,145,24,102,245,230,218,123, +180,214,164,152,146,91,153,92,193,217,100,95,125,125,125,78,15,76,56,28, +198,117,215,93,39,146,70,178,173,177,74,165,66,109,109,45,78,156,56,145, +241,125,104,47,83,59,29,89,193,162,175,209,54,251,28,51,66,249,254,247, +191,159,215,77,5,0,23,93,116,17,252,126,63,206,62,251,108,44,95,190,28, +14,135,3,15,61,244,80,214,162,68,202,16,90,191,126,253,48,211,82,153,169, +69,2,95,14,136,17,145,208,67,151,27,186,201,35,69,201,114,81,186,193,100, +183,147,50,110,66,174,38,18,162,202,162,71,37,97,16,89,200,154,168,252, +187,98,66,142,183,100,114,115,4,131,65,44,92,184,176,104,132,178,113,227, +198,97,21,249,242,189,151,150,150,162,169,169,41,173,255,24,197,48,78,213, +143,43,187,83,228,108,26,89,65,80,198,200,50,173,133,44,128,233,103,34, +21,18,254,110,183,59,231,181,236,216,177,67,188,94,182,76,232,189,72,121, +161,189,228,243,249,114,54,108,180,90,173,168,172,172,20,105,196,217,4, +79,119,119,183,104,71,34,239,43,234,6,45,247,15,43,43,43,203,73,40,100, +149,228,114,139,233,116,186,172,193,92,121,223,3,31,140,27,200,246,94,212, +61,161,16,171,129,154,53,142,135,133,34,11,240,66,220,91,244,124,229,84, +245,66,20,62,82,130,178,157,221,138,138,138,140,247,172,92,227,99,199,142, +229,124,94,181,181,181,56,114,228,136,72,141,167,44,80,178,162,71,218,173, +121,92,8,101,197,138,21,121,187,236,170,84,42,44,91,182,12,46,151,11,223, +248,198,55,208,208,208,128,150,150,22,188,250,234,171,25,77,54,170,94,95, +191,126,189,208,100,148,36,146,203,165,149,41,134,32,183,182,80,106,172, +178,43,76,38,15,217,165,165,180,62,148,164,160,124,176,99,73,24,35,181, +86,148,215,17,12,6,49,103,206,156,162,125,14,117,62,206,133,153,51,103, +138,248,130,78,167,19,69,152,185,178,77,40,213,50,27,161,80,44,68,38,112, +217,189,72,74,134,220,113,32,31,1,83,209,163,108,245,230,18,126,137,68, +2,78,167,83,184,39,82,169,84,154,85,44,127,209,126,203,87,216,103,50,153, +242,238,27,175,215,139,96,48,40,52,120,153,20,73,91,166,47,154,23,159,79, +120,4,131,193,156,149,236,35,73,67,206,135,72,36,82,80,131,200,108,207, +107,44,8,133,246,114,33,239,79,114,134,72,165,80,66,145,9,97,172,215,184, +190,190,30,173,173,173,194,149,43,23,239,82,176,191,208,154,176,113,33, +148,175,124,229,43,121,179,133,84,42,21,150,46,93,138,80,40,132,187,238, +186,11,0,240,212,83,79,101,237,136,59,105,210,157,211,43,243,0,0,32,0,73, +68,65,84,36,236,220,185,19,239,190,251,174,32,23,153,68,100,23,142,236, +218,34,210,160,34,59,217,50,145,137,133,14,181,82,131,37,129,66,69,87,178, +15,90,233,162,146,181,234,209,186,168,198,26,42,149,106,152,128,74,38,147, +227,58,203,67,165,82,137,102,127,242,186,211,36,192,108,27,154,166,89,102, +195,217,103,159,141,247,222,123,111,152,59,145,222,59,153,76,166,213,242, +20,34,36,228,53,146,227,45,217,64,217,65,100,117,145,181,74,123,141,106, +116,108,54,91,90,122,120,33,117,30,185,126,31,8,4,68,186,56,237,71,153, +196,172,86,43,204,102,179,168,189,57,211,246,105,174,76,42,57,134,82,12, +247,104,177,247,178,44,51,100,226,206,22,123,58,93,160,88,38,165,28,147, +101,66,137,50,163,93,219,162,18,202,245,215,95,159,183,101,128,86,171,197, +249,231,159,15,0,184,227,142,59,224,245,122,241,183,191,253,45,163,11,161, +166,166,6,157,157,157,88,189,122,181,16,224,114,92,65,233,139,150,227,32, +178,134,64,68,98,54,155,133,233,47,167,133,202,129,107,165,191,63,83,172, +67,214,126,139,25,235,56,29,155,139,210,48,199,179,117,191,213,106,197, +226,197,139,225,247,251,197,115,80,62,203,108,174,47,157,78,151,147,80, +230,207,159,47,8,165,152,174,66,210,242,221,110,119,65,107,69,193,105,114, +101,144,59,213,108,54,195,108,54,139,180,101,147,201,36,6,51,229,178,190, +136,48,242,129,10,241,104,143,202,19,4,229,204,54,82,162,114,37,98,140, +245,104,229,145,18,74,38,65,151,111,220,246,104,173,236,66,215,64,150,79, +180,95,40,229,252,76,2,197,170,228,206,228,228,34,165,154,150,209,60,247, +162,17,202,138,21,43,10,34,147,37,75,150,160,180,180,20,183,222,122,43, +122,123,123,241,196,19,79,12,179,104,180,90,45,202,203,203,241,250,235, +175,139,244,215,76,61,177,148,150,8,185,173,40,232,74,15,148,126,38,205, +140,8,69,246,45,203,174,128,108,2,130,124,140,74,83,85,206,31,255,48,145, +10,9,203,120,60,62,230,67,161,104,82,165,217,108,70,111,111,47,186,187, +187,81,94,94,46,92,4,202,195,152,205,245,101,54,155,115,6,175,103,204,152, +49,76,163,151,187,208,82,224,62,151,240,9,4,2,34,16,173,20,98,241,120,28, +213,213,213,57,5,31,21,73,202,174,55,57,125,153,200,132,198,75,151,148, +148,20,228,210,234,233,233,201,233,254,48,24,12,136,199,227,195,210,228, +233,28,148,150,150,162,188,188,28,38,147,73,188,79,46,66,25,171,209,205, +197,20,248,153,136,228,116,88,47,202,114,0,82,80,11,89,63,183,219,61,170, +184,197,169,174,157,178,185,38,165,205,143,230,58,138,66,40,255,249,159, +255,153,55,102,66,100,98,177,88,112,235,173,183,162,189,189,29,207,62,251, +236,48,173,203,106,181,98,96,96,0,205,205,205,195,178,145,228,249,32,114, +160,157,130,141,212,94,68,167,211,193,106,181,166,5,34,149,238,173,178, +178,50,148,151,151,167,45,30,205,28,63,112,224,0,124,62,31,186,186,186, +16,143,199,49,117,234,84,84,85,85,97,206,156,57,152,58,117,42,202,202,202, +16,139,197,132,85,69,155,73,46,206,251,176,16,11,17,74,33,174,156,83,33, +145,238,238,110,248,253,126,116,118,118,226,216,177,99,162,176,80,182,50, +229,234,98,154,148,71,166,185,124,32,131,193,32,202,203,203,115,238,53, +171,213,138,185,115,231,226,224,193,131,105,135,133,70,246,202,19,250,178, +9,204,254,254,254,156,109,205,243,41,78,106,181,26,101,101,101,34,177,68, +142,239,209,94,44,45,45,21,132,66,194,61,151,32,164,145,180,153,134,65, +41,9,69,142,231,209,151,220,24,208,106,181,10,178,206,101,17,169,84,170, +188,181,99,107,215,174,77,235,178,64,103,142,218,238,144,107,153,206,3, +105,192,52,11,136,190,26,27,27,113,207,61,247,228,205,158,59,83,59,9,203, +110,112,185,11,71,190,88,4,141,33,79,38,147,89,201,231,229,151,95,78,171, +17,203,183,198,180,78,212,255,77,78,231,150,235,231,100,15,76,177,48,106, +66,185,247,222,123,243,6,95,129,15,10,164,244,122,61,110,189,245,86,28, +62,124,24,255,252,231,63,135,29,218,73,147,38,97,203,150,45,24,28,28,20, +86,137,50,166,145,141,72,44,22,139,208,196,148,181,6,50,137,84,85,85,137, +69,247,122,189,216,176,97,3,222,120,227,141,156,7,71,46,208,35,76,158,60, +25,95,252,226,23,69,113,24,5,226,168,181,182,124,189,103,58,228,120,81, +49,81,94,94,142,231,158,123,78,248,238,41,233,65,118,57,210,70,167,77,31, +137,68,96,50,153,114,102,124,229,115,13,125,254,243,159,23,241,56,185,74, +92,174,131,161,128,116,166,207,200,229,82,83,169,84,56,113,226,4,26,27, +27,115,214,132,204,155,55,15,235,215,175,23,150,12,145,138,156,73,72,22, +53,13,186,202,117,79,46,151,11,221,221,221,57,9,165,188,188,28,149,149, +149,112,187,221,105,25,117,20,159,161,51,161,215,235,115,190,143,140,189, +123,247,98,242,228,201,89,43,229,171,171,171,211,178,216,228,123,200,213, +30,133,220,197,178,210,56,26,225,38,23,141,210,51,46,214,158,246,249,124, +121,219,253,203,202,163,172,64,228,139,161,196,98,49,28,61,122,52,205,178, +206,228,250,87,174,177,156,48,144,109,141,137,220,228,216,155,44,79,101, +183,125,177,200,101,84,132,242,230,155,111,22,84,103,242,137,79,124,2,201, +100,18,223,253,238,119,209,222,222,158,145,76,106,107,107,177,122,245,106, +225,39,151,253,233,153,92,91,68,22,52,223,130,136,68,206,102,161,215,219, +108,182,52,247,201,115,207,61,135,85,171,86,141,170,69,244,241,227,199, +241,219,223,254,22,245,245,245,184,246,218,107,81,85,85,53,44,245,152,54, +193,153,78,42,100,165,140,149,95,156,90,192,144,112,151,219,173,200,254, +220,124,215,160,213,106,69,225,85,46,77,182,190,190,30,203,151,47,199,150, +45,91,196,103,80,149,187,60,132,76,206,42,162,103,84,72,59,149,174,174, +46,49,183,34,27,102,207,158,141,215,95,127,61,205,13,42,247,121,147,83, +146,39,76,152,144,55,46,211,211,211,131,253,251,247,227,242,203,47,207, +249,186,43,175,188,18,79,60,241,68,154,133,34,43,102,228,2,163,70,169,249, +44,173,189,123,247,162,190,190,62,235,107,38,77,154,84,208,62,176,90,173, +168,171,171,19,107,72,86,163,28,12,46,212,18,144,181,123,185,54,69,238, +12,28,8,4,78,57,83,73,9,135,195,81,144,75,152,8,82,73,184,249,18,45,218, +218,218,48,111,222,188,172,175,107,108,108,44,200,50,179,88,44,226,89,201, +22,57,41,79,237,237,237,136,199,227,105,227,129,41,19,86,142,7,143,38,22, +165,25,205,34,255,241,143,127,204,251,186,143,127,252,227,136,199,227,248, +201,79,126,130,174,174,46,60,245,212,83,195,200,164,166,166,6,107,214,172, +17,230,152,124,216,100,34,145,27,174,17,129,88,173,214,52,34,33,77,152, +254,134,166,159,165,82,41,60,248,224,131,88,191,126,125,81,3,208,221,221, +221,120,236,177,199,112,253,245,215,139,161,92,116,125,38,147,9,201,100, +82,92,79,38,23,152,211,233,28,215,236,170,108,40,52,189,241,84,8,69,89, +144,166,108,93,79,89,88,178,41,78,154,171,146,80,92,46,23,170,170,170,242, +186,70,150,47,95,142,193,193,65,156,60,121,82,152,254,225,112,24,62,159, +79,236,23,74,37,38,97,65,105,183,185,4,198,145,35,71,48,56,56,136,67,135, +14,101,125,166,0,48,125,250,244,180,86,23,217,180,89,18,200,185,44,228, +88,44,134,77,155,54,97,104,104,40,111,38,216,133,23,94,136,103,159,125, +54,103,140,103,36,29,139,155,155,155,197,0,177,108,218,243,217,103,159, +141,247,223,127,127,152,192,151,83,182,127,240,131,31,160,190,190,30,126, +191,127,152,86,125,242,228,73,236,220,185,51,239,160,45,250,189,172,157, +203,227,127,137,160,178,185,76,149,113,139,66,9,231,228,201,147,152,58, +117,106,214,223,231,122,159,121,243,230,229,204,122,245,122,189,216,181, +107,23,190,252,229,47,103,173,202,47,43,43,195,103,63,251,89,188,246,218, +107,195,136,85,94,227,47,125,233,75,184,224,130,11,68,213,189,188,206,110, +183,27,175,190,250,42,246,238,221,43,218,11,145,60,149,171,230,71,107,169, +156,50,161,252,232,71,63,202,251,154,69,139,22,33,30,143,227,174,187,238, +66,119,119,55,254,254,247,191,103,36,147,181,107,215,14,35,19,114,143,200, +100,66,3,146,232,103,202,152,33,255,176,28,43,49,24,12,194,76,125,225,133, +23,240,143,127,252,99,204,50,153,188,94,47,90,91,91,49,115,230,76,17,199, +161,205,93,90,90,42,14,64,38,1,116,232,208,33,92,120,225,133,103,132,165, +146,79,59,31,41,178,197,101,148,83,42,229,90,12,210,154,178,53,190,84,169, +84,232,239,239,23,153,96,217,160,215,235,241,165,47,125,9,131,131,131,216, +178,101,139,40,50,164,174,193,241,120,28,22,139,69,236,145,66,70,247,134, +66,33,28,61,122,20,161,80,8,111,188,241,6,174,186,234,170,172,194,93,163, +209,224,142,59,238,192,253,247,223,47,138,22,229,174,0,68,58,86,171,21, +67,67,67,57,91,124,156,56,113,2,161,80,8,201,100,18,155,55,111,206,217, +19,203,100,50,225,158,123,238,193,175,126,245,43,97,245,201,194,187,169, +169,9,86,171,21,189,189,189,121,181,94,154,213,49,56,56,8,187,221,158,81, +224,171,213,106,124,239,123,223,195,205,55,223,156,214,49,66,174,5,187, +242,202,43,49,101,202,20,236,223,191,63,227,123,232,245,122,156,125,246, +217,121,5,89,101,101,37,54,109,218,36,226,21,164,24,140,20,52,124,46,31, +161,208,250,180,180,180,96,249,242,229,57,173,175,217,179,103,163,189,189, +61,77,105,58,239,188,243,80,85,85,149,115,144,153,219,237,70,40,20,194, +206,157,59,49,99,198,140,172,207,245,107,95,251,26,182,111,223,46,170,220, +229,117,214,233,116,248,236,103,63,139,11,46,184,32,231,204,154,139,46, +186,8,173,173,173,25,91,16,201,29,66,198,157,80,238,189,247,222,188,51, +169,107,107,107,225,241,120,240,179,159,253,12,3,3,3,120,252,241,199,51, +146,201,234,213,171,135,145,9,5,207,41,62,66,150,135,156,71,79,150,137, +28,51,161,69,161,118,209,192,7,9,3,133,196,120,70,139,230,230,102,84,84, +84,192,235,245,194,102,179,165,117,166,149,53,10,217,18,112,58,157,103, +84,144,113,219,182,109,99,246,222,202,128,37,53,232,148,251,168,201,27, +58,219,166,46,41,41,65,60,30,23,85,222,185,214,207,96,48,160,182,182,22, +55,220,112,3,38,77,154,36,8,78,38,42,151,203,133,161,161,161,188,202,70, +42,149,194,246,237,219,225,116,58,17,141,70,49,56,56,136,99,199,142,161, +161,161,33,103,117,251,247,190,247,61,24,141,70,177,7,43,43,43,49,105,210, +36,97,57,15,12,12,228,61,75,212,161,187,164,164,4,171,87,175,198,146,37, +75,114,190,126,194,132,9,248,245,175,127,141,119,223,125,23,94,175,23,86, +171,21,103,157,117,22,46,186,232,34,104,181,90,244,244,244,140,168,179, +244,19,79,60,129,91,110,185,5,165,165,165,89,63,239,233,167,159,198,134, +13,27,176,127,255,126,132,66,33,216,237,118,44,90,180,8,87,95,125,181,72, +255,207,101,129,12,13,13,229,180,2,200,165,211,219,219,43,20,11,217,154, +149,53,107,121,239,100,218,71,133,186,116,200,141,214,217,217,41,154,131, +102,179,156,86,172,88,129,189,123,247,10,143,195,5,23,92,128,166,166,38, +56,28,142,156,238,188,182,182,54,68,163,81,188,248,226,139,184,253,246, +219,115,90,65,15,60,240,0,90,90,90,176,107,215,46,49,11,229,252,243,207, +199,117,215,93,7,187,221,142,147,39,79,230,180,96,105,250,39,181,93,145, +195,3,114,28,107,52,222,138,17,19,74,107,107,107,222,184,137,201,100,66, +85,85,21,110,184,225,6,148,149,149,225,254,251,239,31,150,205,85,87,87, +151,147,76,200,117,100,50,153,68,190,126,89,89,153,8,192,203,11,82,90,90, +42,216,218,98,177,64,165,82,97,104,104,8,223,253,238,119,139,210,146,125, +36,193,59,57,192,76,105,170,164,109,147,86,65,2,109,203,150,45,168,172, +172,204,184,209,79,71,134,88,177,231,204,215,213,213,225,231,63,255,57, +218,218,218,176,111,223,190,52,203,133,44,19,170,27,146,21,2,217,186,204, +36,164,3,129,0,78,158,60,137,138,138,138,188,174,47,74,161,165,254,70,212, +26,135,70,208,142,196,122,163,33,74,20,7,122,230,153,103,112,199,29,119, +228,252,187,210,210,82,36,18,9,76,154,52,9,90,173,86,88,175,157,157,157, +194,207,157,47,118,66,26,110,73,73,9,134,134,134,208,218,218,138,115,206, +57,39,167,128,54,153,76,184,240,194,11,81,94,94,46,20,44,183,219,13,151, +203,53,34,37,38,153,76,226,189,247,222,195,191,253,219,191,101,37,20,18, +246,151,93,118,25,174,186,234,42,84,87,87,195,108,54,35,145,72,192,229, +114,101,181,76,100,139,225,192,129,3,98,4,110,46,151,87,174,247,145,71, +39,23,66,22,35,193,202,149,43,241,233,79,127,58,171,5,65,181,85,164,245, +151,148,148,96,223,190,125,57,139,103,35,145,8,246,236,217,3,0,232,236, +236,196,241,227,199,49,99,198,140,172,247,88,86,86,134,139,47,190,24,203, +150,45,67,101,101,37,108,54,155,88,227,158,158,158,156,159,21,143,199,241, +230,155,111,166,197,77,232,12,210,151,156,109,121,202,138,227,72,255,224, +151,191,252,101,222,215,44,92,184,16,83,166,76,193,188,121,243,240,204, +51,207,12,75,243,36,55,23,9,23,57,86,66,100,66,149,196,101,101,101,176, +88,44,176,219,237,40,47,47,23,95,118,187,93,228,243,147,217,102,181,90, +161,82,169,224,112,56,176,98,197,138,113,37,19,210,178,250,251,251,209, +223,223,15,183,219,13,143,199,3,159,207,135,96,48,8,191,223,159,166,5,119, +117,117,33,16,8,192,108,54,15,75,161,148,83,253,198,11,193,96,48,111,234, +247,169,88,60,38,147,9,87,92,113,5,30,124,240,65,172,91,183,14,191,255, +253,239,113,243,205,55,99,226,196,137,105,177,46,217,82,201,230,238,34, +235,130,92,154,39,78,156,40,168,218,93,233,50,27,105,206,191,223,239,199, +234,213,171,225,243,249,68,199,87,82,24,254,239,255,254,47,111,64,89,142, +7,209,223,211,108,148,92,8,135,195,120,242,201,39,133,240,163,53,122,248, +225,135,11,26,19,107,48,24,16,10,133,48,48,48,128,238,238,238,17,91,196, +114,103,223,159,253,236,103,121,251,151,145,15,222,225,112,160,179,179, +19,39,78,156,128,223,239,207,27,27,233,234,234,42,120,98,103,49,247,251, +72,246,204,27,111,188,145,215,21,68,19,56,233,188,231,219,155,29,29,29, +105,138,246,31,255,248,71,209,13,56,215,103,168,213,106,184,92,174,180, +53,206,247,89,52,167,158,60,4,114,253,151,220,82,136,20,224,113,33,148, +167,158,122,42,111,102,84,99,99,35,122,123,123,177,98,197,10,236,216,177, +99,88,199,224,210,210,82,108,223,190,61,173,35,172,220,71,75,206,209,39, +82,33,18,177,90,173,98,116,43,229,240,203,254,64,114,35,221,122,235,173, +227,42,140,137,36,143,30,61,10,151,203,37,52,65,183,219,13,175,215,11,159, +207,39,134,29,145,96,33,247,18,245,212,161,96,34,245,212,25,111,82,145, +3,126,197,66,40,20,194,134,13,27,240,216,99,143,225,238,187,239,198,215, +191,254,117,220,127,255,253,104,105,105,129,221,110,23,85,196,114,81,88, +46,119,151,44,160,233,96,117,118,118,22,61,151,94,169,69,62,249,228,147, +226,25,210,243,33,107,210,239,247,227,149,87,94,41,122,49,93,44,22,195, +234,213,171,225,245,122,211,234,7,232,140,252,238,119,191,27,245,236,241, +124,235,38,91,204,126,191,31,143,62,250,232,136,219,185,231,131,211,233, +196,203,47,191,60,238,214,120,62,203,86,105,201,196,227,113,60,244,208, +67,69,203,134,140,68,34,88,189,122,181,232,166,64,114,225,247,191,255,125, +209,103,202,15,13,13,225,141,55,222,24,230,42,164,52,118,101,55,245,81, +237,169,145,154,125,249,152,92,163,209,224,59,223,249,14,220,110,55,94, +121,229,149,140,15,146,58,166,202,174,46,37,153,88,44,22,97,137,16,161, +148,149,149,161,172,172,76,196,81,50,85,183,255,240,135,63,28,119,50,1, +32,102,26,248,124,62,248,124,62,120,60,30,49,155,156,82,35,201,189,181, +113,227,198,180,64,61,101,33,201,95,52,209,112,188,72,133,44,198,177,70, +127,127,63,222,126,251,109,172,93,187,86,40,39,202,128,117,62,45,218,106, +181,166,181,43,105,109,109,29,147,53,114,58,157,120,236,177,199,208,215, +215,151,214,145,85,62,152,122,189,30,199,143,31,199,203,47,191,92,52,45, +59,18,137,224,133,23,94,192,161,67,135,68,161,34,105,144,228,234,213,104, +52,120,232,161,135,70,149,250,158,43,29,88,73,60,26,141,6,71,142,28,193, +19,79,60,81,180,251,116,58,157,120,230,153,103,242,118,46,24,11,20,210, +198,70,118,179,169,84,42,28,62,124,24,155,55,111,46,202,181,110,217,178, +5,46,151,43,77,177,214,104,52,240,122,189,120,224,129,7,138,70,220,94,175, +23,47,189,244,82,90,87,111,249,185,202,4,83,12,55,123,193,132,114,239,189, +247,230,125,205,249,231,159,143,25,51,102,96,250,244,233,88,181,106,213, +176,67,94,91,91,139,109,219,182,165,13,120,146,107,75,228,236,45,178,68, +200,237,101,54,155,197,239,228,98,69,121,17,238,191,255,254,188,1,206,177, +34,147,215,95,127,29,126,191,31,193,96,80,116,240,164,159,35,145,8,234, +234,234,160,213,106,113,248,240,225,97,174,37,34,33,154,93,46,255,93,33, +245,25,163,69,87,87,215,105,89,55,74,171,150,137,132,178,146,114,29,90, +185,168,149,58,35,52,55,55,163,183,183,183,40,107,149,72,36,176,127,255, +126,60,240,192,3,232,234,234,18,68,162,236,224,43,239,217,161,161,33,172, +92,185,18,125,125,125,163,58,152,78,167,19,143,60,242,8,142,28,57,34,62, +147,138,19,233,179,168,66,90,163,209,224,201,39,159,204,59,156,41,155,187, +165,144,62,83,114,237,138,70,163,193,209,163,71,241,192,3,15,136,224,248, +169,32,30,143,163,173,173,13,143,63,254,120,90,219,244,241,68,161,238,112, +217,122,214,233,116,216,180,105,19,214,172,89,115,202,10,76,60,30,199,59, +239,188,147,54,16,144,136,139,146,140,124,62,31,254,252,231,63,227,228, +201,147,163,186,199,99,199,142,225,177,199,30,131,199,227,73,59,87,114, +252,144,8,133,72,109,180,229,3,5,219,55,249,2,241,54,155,13,199,143,31, +199,15,127,248,67,236,216,177,3,157,157,157,195,92,93,239,188,243,78,218, +28,99,121,214,4,45,38,101,115,41,93,91,84,9,79,7,57,211,161,221,188,121, +243,184,11,69,42,182,235,235,235,19,45,89,228,194,185,100,50,137,170,170, +42,84,87,87,195,225,112,164,53,46,180,88,44,130,48,228,3,165,211,233,210, +252,230,26,141,102,76,251,42,253,246,183,191,29,183,245,82,169,84,152,61, +123,54,202,203,203,225,116,58,97,183,219,133,187,79,110,99,159,175,133, +118,89,89,153,152,164,72,61,170,14,28,56,0,175,215,139,115,206,57,7,19, +38,76,24,241,225,136,199,227,56,113,226,4,214,172,89,3,135,195,33,4,58, +105,145,114,219,31,185,245,133,94,175,23,61,194,222,120,227,13,212,214, +214,98,238,220,185,176,219,237,5,183,30,239,235,235,67,75,75,11,14,28,56, +32,246,14,245,85,146,93,19,178,139,151,220,19,47,189,244,18,230,206,157, +139,57,115,230,228,77,163,13,133,66,104,105,105,193,206,157,59,177,122, +245,106,252,224,7,63,200,235,113,32,50,33,175,128,223,239,199,227,143,63, +142,250,250,122,92,114,201,37,168,170,170,42,232,62,99,177,24,122,123,123, +177,97,195,6,184,92,174,180,148,230,142,142,14,60,247,220,115,184,248,226, +139,199,205,66,185,249,230,155,115,222,63,157,63,185,39,154,78,167,195, +161,67,135,208,215,215,135,203,47,191,28,181,181,181,121,99,68,4,151,203, +133,85,171,86,137,2,67,106,134,73,19,77,101,5,91,173,86,227,185,231,158, +19,129,248,186,186,186,130,214,56,30,143,163,191,191,31,111,190,249,38, +6,6,6,210,122,187,209,253,100,34,76,217,10,30,115,66,185,239,190,251,242, +190,166,169,169,73,100,178,100,202,22,210,104,52,112,56,28,105,214,9,253, +76,102,188,205,102,75,115,121,209,247,210,210,82,65,58,217,122,100,117, +117,117,157,22,87,87,85,85,21,86,174,92,9,139,197,34,178,127,228,89,233, +149,149,149,88,188,120,49,130,193,224,176,117,169,169,169,129,215,235,77, +171,20,166,116,90,163,209,152,54,231,124,172,200,196,233,116,22,61,173, +218,110,183,167,21,162,210,243,10,4,2,56,126,252,56,58,59,59,225,118,187, +5,153,208,87,52,26,45,184,61,57,117,238,141,197,98,40,45,45,77,19,194,91, +183,110,21,233,178,139,22,45,66,77,77,77,90,117,48,29,60,106,159,239,112, +56,112,236,216,49,180,180,180,164,205,48,81,54,119,148,137,132,172,104, +106,68,74,132,98,54,155,225,114,185,176,110,221,58,4,131,65,204,152,49, +3,85,85,85,40,47,47,79,107,95,18,139,197,224,245,122,209,219,219,139,131, +7,15,10,141,89,174,29,161,189,46,183,26,146,139,121,229,217,44,71,143,30, +69,107,107,43,202,203,203,49,107,214,44,81,100,75,46,52,191,223,143,163, +71,143,98,199,142,29,105,169,182,148,100,35,183,49,151,99,68,228,13,208, +235,245,34,91,140,8,148,172,178,104,52,138,201,147,39,99,230,204,153,34, +181,159,246,114,40,20,130,215,235,69,127,127,63,118,239,222,157,22,159, +81,206,173,105,110,110,70,115,115,179,80,160,50,245,252,162,103,44,187, +226,200,101,46,79,102,149,27,100,202,238,28,121,228,132,70,163,193,255, +254,239,255,166,9,99,250,76,202,230,163,247,83,246,2,140,199,227,88,189, +122,53,140,70,35,150,44,89,2,187,221,46,228,20,125,54,61,227,254,254,126, +188,245,214,91,66,201,150,239,91,78,72,146,71,82,211,62,141,197,98,120, +245,213,87,17,137,68,80,85,85,133,217,179,103,195,102,179,165,173,113,56, +28,22,74,237,190,125,251,16,12,6,211,146,79,100,101,148,148,34,57,187,75, +57,76,112,204,9,37,95,58,105,125,125,61,218,218,218,112,231,157,119,226, +173,183,222,26,150,169,80,83,83,131,23,95,124,49,163,187,64,182,78,136, +84,228,214,222,178,101,146,171,225,98,190,89,219,197,6,29,236,39,158,120, +66,248,242,149,117,22,181,181,181,184,246,218,107,17,139,197,210,226,38, +178,6,232,243,249,196,38,6,62,200,226,144,221,28,177,88,108,76,26,55,18, +30,126,248,225,162,190,223,228,201,147,241,231,63,255,89,88,90,114,67,66, +178,56,201,213,69,121,254,20,152,164,106,103,185,255,86,46,247,145,221, +110,23,175,39,203,80,118,35,120,189,94,172,93,187,86,180,94,81,186,15,229, +62,91,36,228,148,254,115,58,128,242,126,181,90,173,226,126,232,254,232, +0,7,131,193,180,65,75,237,237,237,216,183,111,159,168,75,146,221,121,153, +252,214,148,214,44,119,215,166,207,149,73,140,58,103,3,31,180,217,48,26, +141,8,6,131,240,122,189,120,243,205,55,133,197,71,85,228,242,61,41,131, +241,169,84,10,106,181,90,92,27,41,50,148,70,170,108,178,74,100,70,66,56, +28,14,163,191,191,95,40,117,178,123,69,57,120,46,147,162,41,207,53,146, +53,101,106,219,67,50,131,220,66,242,61,201,127,67,215,148,173,5,187,44, +100,169,35,116,38,237,93,238,129,37,91,165,50,169,208,239,227,241,56,54, +109,218,36,214,59,22,139,137,145,207,74,165,136,174,79,57,16,80,57,106, +131,202,32,128,15,82,160,137,76,189,94,47,54,111,222,156,166,120,209,53, +202,74,66,166,245,205,180,143,169,19,59,61,227,66,45,173,81,17,202,139, +47,190,152,247,77,234,234,234,48,117,234,84,196,98,177,140,197,113,114, +115,69,229,8,86,242,11,91,173,86,65,36,51,103,206,132,223,239,135,197,98, +73,139,181,228,18,46,54,155,109,220,200,100,250,244,233,120,235,173,183, +112,224,192,129,180,113,193,114,87,228,233,211,167,139,108,179,117,235, +214,13,35,89,189,94,15,151,203,133,64,32,144,38,60,163,209,40,44,22,75, +90,11,116,138,45,20,219,74,113,187,221,216,186,117,107,209,93,128,74,223, +172,220,70,135,52,73,18,52,228,211,37,1,164,108,165,157,235,158,85,42,21, +108,54,27,98,177,152,200,201,151,73,129,4,65,48,24,20,149,245,185,102,62, +200,251,75,118,117,144,134,74,196,40,103,31,202,117,7,201,100,82,16,12, +221,39,181,226,15,135,195,66,65,144,63,91,57,31,92,254,124,90,55,185,176, +151,62,159,246,29,237,153,72,36,2,159,207,39,62,211,227,241,64,173,86,11, +34,85,186,238,100,193,166,20,156,116,93,36,244,100,197,143,44,50,185,13, +10,37,44,4,131,193,52,203,34,211,26,43,199,96,43,71,81,200,113,209,100, +50,41,178,234,228,57,57,225,112,56,77,88,203,4,44,19,131,114,158,145,44, +116,149,243,140,148,61,221,228,102,140,180,15,228,234,114,34,224,68,34, +1,189,94,47,246,88,40,20,18,215,153,41,254,41,95,35,89,157,180,183,200, +242,32,33,79,214,12,17,138,78,167,67,32,16,16,214,164,236,146,205,182,198, +68,196,116,253,178,2,175,180,186,242,53,192,44,10,161,60,243,204,51,57, +127,95,81,81,129,125,251,246,225,206,59,239,196,150,45,91,50,22,48,174, +92,185,114,216,32,37,153,45,169,93,9,29,154,242,242,114,132,195,97,225, +55,46,164,21,124,89,89,25,172,86,235,152,214,158,208,181,61,244,208,67, +194,140,148,11,243,232,30,206,63,255,124,124,251,219,223,70,32,16,192,235, +175,191,158,49,99,163,162,162,2,14,135,3,193,96,80,196,79,116,58,29,76, +38,147,104,166,56,214,85,244,63,253,233,79,139,254,158,59,119,238,20,27, +89,94,27,101,195,78,121,44,129,156,251,46,31,252,66,82,24,169,111,154,146, +24,228,145,191,148,240,16,141,70,161,211,233,132,85,68,135,93,41,212,229, +235,162,61,88,90,90,154,150,48,98,177,88,132,133,66,110,189,84,42,37,18, +50,148,105,190,148,118,44,187,83,100,193,165,212,144,105,125,232,254,40, +41,133,44,60,89,139,165,225,72,74,87,6,245,38,147,133,187,172,149,203,25, +62,50,185,203,130,137,220,210,244,153,116,191,68,40,100,85,6,131,65,24, +141,198,180,41,128,178,165,169,36,109,57,179,137,206,56,173,85,38,66,33, +210,162,120,35,189,175,146,36,149,2,53,83,76,72,222,35,36,91,228,191,81, +94,175,236,110,36,33,76,68,149,76,38,97,50,153,16,10,133,224,243,249,160, +215,235,197,117,202,235,46,91,219,153,148,5,218,79,114,210,17,185,188,162, +209,168,232,65,71,65,123,90,151,76,107,172,188,191,76,174,90,138,61,210, +51,149,73,108,204,8,133,138,97,114,161,177,177,81,8,136,237,219,183,15, +251,125,123,123,251,176,105,102,178,198,71,55,70,238,45,179,217,44,54,61, +89,41,249,4,75,44,22,131,90,173,198,77,55,221,132,63,252,225,15,69,23,146, +118,187,29,118,187,93,20,105,202,174,28,242,45,211,65,191,241,198,27,113, +205,53,215,96,96,96,0,239,188,243,78,214,20,203,96,48,8,183,219,45,10,220, +84,42,149,8,210,105,52,26,97,153,100,11,166,141,22,29,29,29,69,143,157, +52,54,54,226,247,191,255,189,112,149,200,227,4,228,217,13,114,131,79,185, +151,23,237,15,210,254,10,205,150,82,54,215,164,90,22,189,94,15,183,219, +45,132,33,245,241,202,38,236,50,29,68,18,32,178,11,150,158,183,28,148,39, +43,139,238,81,174,70,38,97,64,153,127,114,39,5,165,59,74,246,113,147,107, +139,222,147,98,140,74,161,19,143,199,17,12,6,197,103,146,0,209,233,116, +8,6,131,34,238,64,26,173,76,220,242,88,107,165,165,68,49,10,165,75,134, +98,153,37,37,37,130,28,105,46,57,185,126,72,224,81,231,136,76,130,93,169, +165,19,169,200,100,69,100,25,10,133,16,8,4,210,186,83,231,106,141,159,201, +50,82,222,55,221,131,210,90,145,173,19,250,189,172,24,41,9,37,18,137,8, +66,165,162,70,153,84,101,55,167,220,131,75,22,242,20,59,166,231,77,150, +26,221,63,17,73,32,16,16,109,96,228,189,156,107,141,233,218,41,30,45,79, +12,37,146,178,219,237,69,145,1,57,165,20,181,147,207,229,114,56,124,248, +48,254,231,127,254,7,187,119,239,206,24,59,89,189,122,117,218,68,62,57, +40,79,204,44,31,80,131,193,128,100,50,137,242,242,114,236,220,185,19,149, +149,149,105,194,84,185,137,228,32,218,204,153,51,241,229,47,127,25,255, +252,231,63,139,146,43,94,83,83,3,131,193,128,103,159,125,22,78,167,51,45, +93,85,246,119,154,205,102,76,159,62,29,63,254,241,143,209,212,212,132,253, +251,247,99,207,158,61,89,5,162,197,98,193,177,99,199,16,12,6,133,80,163, +13,79,163,102,105,243,201,223,139,137,159,252,228,39,69,207,222,162,12, +54,217,239,78,177,38,122,206,244,172,73,56,210,151,108,234,211,223,143, +4,50,169,40,59,47,248,124,62,65,42,36,244,72,160,43,93,18,36,92,72,91,150, +91,0,145,203,75,78,97,39,119,39,185,188,200,61,35,255,189,94,175,71,32, +16,128,201,100,18,109,244,229,33,95,178,203,137,4,152,172,180,208,26,202, +93,182,101,141,50,22,139,193,96,48,32,24,12,138,207,244,122,189,48,153, +76,105,41,232,242,28,13,185,157,190,220,153,64,182,20,101,119,9,145,35, +141,15,38,11,142,238,193,108,54,167,185,190,72,123,38,23,99,166,207,149, +11,234,136,152,101,171,129,200,136,132,103,89,89,153,72,26,144,39,113,202, +4,144,141,84,228,120,21,125,62,9,109,250,204,108,231,76,110,21,68,235,43, +91,135,177,88,12,126,191,63,77,81,162,125,70,235,147,139,164,105,63,201, +22,32,201,74,178,200,136,176,2,129,128,112,123,145,171,83,94,15,165,82, +37,55,216,165,61,68,231,144,218,89,41,7,13,142,25,161,228,75,195,93,176, +96,1,186,187,187,81,95,95,159,177,218,149,42,62,149,227,93,73,216,200,51, +76,232,6,41,51,133,58,162,238,223,191,31,243,231,207,79,35,16,37,177,144, +182,153,72,36,208,212,212,132,21,43,86,224,192,129,3,216,190,125,251,136, +51,191,172,86,43,234,235,235,209,221,221,141,231,159,127,94,184,47,44,22, +139,208,84,228,235,47,45,45,197,85,87,93,133,219,110,187,13,177,88,12,111, +191,253,54,78,158,60,153,243,1,169,213,106,49,129,143,54,1,189,47,105,172, +114,197,120,177,9,229,254,251,239,31,85,65,92,182,184,210,31,254,240,7, +97,25,40,215,136,72,133,98,15,68,36,68,48,36,168,137,176,79,37,38,86,81, +81,145,54,217,83,158,142,72,26,52,9,59,114,213,208,62,34,23,38,9,24,57, +3,70,222,171,148,60,66,214,151,221,110,79,123,214,148,217,19,8,4,210,10, +118,233,179,201,37,68,159,159,105,111,208,250,201,193,112,217,194,147,133, +187,70,163,17,218,187,60,118,86,175,215,139,184,10,9,246,76,1,122,89,128, +203,241,11,57,144,75,105,173,178,80,37,193,72,113,2,57,91,143,146,1,168, +160,151,206,166,242,115,229,174,226,36,68,233,254,105,45,229,182,244,68, +196,178,171,71,206,154,82,90,35,217,206,158,108,145,80,171,31,229,57,163, +159,149,174,79,250,78,255,79,2,159,220,125,74,82,37,194,161,125,150,105, +111,17,145,200,202,130,76,216,52,116,46,20,10,9,197,136,148,132,66,215, +88,182,46,73,25,50,153,76,40,47,47,47,106,108,86,147,203,221,149,79,24, +135,66,33,124,252,227,31,135,211,233,28,214,250,92,167,211,225,221,119, +223,77,219,180,114,96,150,172,17,217,132,87,106,94,37,37,37,56,114,228, +8,162,209,40,22,44,88,144,54,149,77,182,88,72,211,164,133,53,155,205,152, +54,109,154,112,159,145,134,67,166,57,105,132,228,170,136,68,34,24,24,24, +64,107,107,43,218,219,219,211,124,170,164,133,82,101,182,236,79,93,184, +112,33,86,172,88,129,121,243,230,161,179,179,19,59,119,238,204,91,69,172, +215,235,177,103,207,30,120,60,30,177,209,136,104,163,209,168,200,24,82, +6,213,138,229,242,58,124,248,176,232,94,91,44,212,215,215,99,207,158,61, +226,112,146,153,77,130,144,132,33,145,9,245,103,35,18,161,47,217,252,62, +85,141,137,138,96,229,84,79,178,10,130,193,160,216,15,164,213,201,149,249, +36,36,73,208,144,251,72,238,122,77,2,157,20,160,76,73,9,21,21,21,48,26, +141,240,249,124,66,19,149,93,20,114,198,23,237,103,185,106,89,142,189,144, +176,165,198,146,58,157,110,88,125,14,89,79,228,110,161,51,70,251,137,4, +48,17,168,156,25,68,154,185,252,37,11,88,185,239,147,28,3,149,5,158,108, +73,200,223,229,192,180,82,123,206,52,133,85,25,47,149,199,5,147,171,75, +78,205,207,100,97,102,21,116,255,255,249,145,93,123,114,183,98,57,184,47, +255,13,205,51,146,83,148,229,180,100,34,62,185,64,147,200,132,132,189,50, +179,79,158,160,153,105,111,201,202,66,60,30,23,237,119,232,53,180,159,229, +225,100,114,185,130,172,12,200,163,167,229,76,189,209,158,179,17,19,74, +166,120,136,50,61,116,239,222,189,184,242,202,43,197,112,29,25,149,149, +149,240,249,124,105,121,225,36,104,228,248,137,28,139,160,3,76,15,189,161, +161,65,116,225,236,235,235,195,167,62,245,41,232,116,58,33,140,101,100, +170,178,214,104,52,24,28,28,196,224,224,32,92,46,23,188,94,47,60,30,15, +188,94,111,218,188,101,121,179,147,102,76,38,177,188,137,232,225,207,154, +53,11,95,253,234,87,241,137,79,124,2,78,167,83,88,37,133,32,149,74,161, +175,175,47,45,229,143,54,165,28,144,165,181,144,211,254,138,129,95,252, +226,23,69,119,159,57,157,78,220,126,251,237,248,211,159,254,4,167,211,137, +213,171,87,227,157,119,222,73,203,140,145,155,125,82,31,47,185,234,155, +94,87,86,86,54,106,141,73,171,213,162,170,170,10,193,96,16,62,159,79,88, +5,84,183,34,107,184,114,28,69,14,230,147,32,149,179,12,105,143,22,50,152, +137,132,188,219,237,22,214,2,185,220,104,175,42,235,109,100,215,139,50, +134,147,137,72,178,125,166,90,173,30,230,222,83,118,34,144,227,39,114,176, +90,153,37,69,255,150,71,92,171,213,234,52,129,71,181,34,36,244,41,109,86, +153,222,170,12,116,147,182,174,82,169,196,123,107,181,218,180,231,65,36, +34,79,247,36,175,4,189,174,80,247,182,210,229,37,91,36,202,123,86,106,250, +36,15,232,217,208,181,203,214,46,221,187,217,27,238,124,18,0,0,32,0,73, +68,65,84,108,22,132,162,140,147,101,219,91,217,158,49,41,40,148,149,73, +123,137,158,169,114,141,101,229,68,153,244,64,114,37,155,50,52,166,132, +146,169,15,151,140,9,19,38,224,208,161,67,88,188,120,49,158,127,254,249, +140,238,46,217,58,33,77,132,98,39,164,185,41,253,231,114,101,248,220,185, +115,69,49,80,36,18,193,203,47,191,140,154,154,26,204,159,63,31,102,179, +25,131,131,131,105,174,27,57,149,142,54,13,17,22,105,132,148,21,18,10,133, +132,139,73,169,229,208,102,147,91,235,27,141,70,44,90,180,8,215,92,115, +13,22,47,94,12,175,215,139,230,230,102,97,209,20,2,131,193,32,114,214,99, +177,88,154,22,33,251,148,229,32,117,49,170,87,9,223,255,254,247,199,36, +11,46,28,14,227,175,127,253,43,128,15,234,115,206,57,231,28,252,230,55, +191,193,107,175,189,134,142,142,142,97,217,124,228,226,148,103,218,208, +88,218,98,130,4,44,185,161,18,137,132,16,232,164,173,103,74,235,36,45,82, +86,42,200,69,112,42,22,147,236,10,35,109,158,246,29,21,68,202,238,21,218, +43,164,197,142,244,115,101,1,100,52,26,211,130,182,244,153,201,100,50,141, +68,228,100,8,165,203,149,8,36,211,62,164,51,77,215,72,49,155,76,247,41, +43,127,242,222,166,251,148,139,96,101,5,140,180,116,178,74,232,107,180, +13,57,101,229,65,57,65,84,249,179,178,48,86,222,99,116,157,30,143,39,109, +212,53,221,191,146,76,229,251,166,179,94,136,146,66,175,145,215,152,50, +72,51,37,120,20,99,47,21,141,80,242,245,118,234,237,237,197,140,25,51,160, +213,106,135,181,89,1,128,35,71,142,12,243,211,202,217,39,114,129,141,28, +236,150,31,88,166,188,232,254,254,126,188,254,250,235,208,235,245,152,63, +127,62,166,76,153,2,175,215,139,129,129,1,49,143,132,220,78,114,118,6,9, +16,210,134,104,68,40,9,20,217,237,33,107,44,118,187,29,23,94,120,33,110, +188,241,70,84,84,84,136,236,173,174,174,174,17,91,14,39,78,156,128,203, +229,18,196,166,172,232,37,95,45,185,44,148,166,245,104,240,252,243,207, +163,189,189,29,99,141,80,40,36,42,158,237,118,59,102,205,154,5,175,215, +155,166,229,43,253,198,148,117,50,86,144,181,60,154,214,71,90,175,220,215, +72,182,108,115,9,209,209,94,3,165,23,103,138,105,144,85,87,12,139,84,94, +83,82,182,148,45,126,242,21,12,159,42,137,103,114,89,157,202,231,146,210, +165,84,54,232,89,229,114,121,229,114,217,211,115,45,214,189,171,84,170, +52,229,129,246,152,220,1,131,10,61,137,196,108,54,219,41,125,54,173,113, +166,125,68,22,10,33,27,81,143,43,161,236,216,177,35,111,224,186,189,189, +29,151,92,114,9,186,186,186,134,101,119,233,116,58,116,119,119,139,32,31, +153,96,114,74,99,166,184,9,153,147,114,246,214,180,105,211,208,209,209, +49,236,26,34,145,136,112,203,77,152,48,1,77,77,77,152,49,99,6,220,110,55, +6,6,6,196,132,56,74,207,163,205,37,19,91,166,116,59,186,191,37,75,150,96, +241,226,197,88,176,96,1,128,15,6,224,108,223,190,93,204,132,24,233,3,210, +235,245,216,182,109,155,48,79,101,178,144,93,129,100,150,202,213,214,163, +21,106,111,191,253,54,30,127,252,113,140,55,134,134,134,112,214,89,103, +193,235,245,166,249,231,101,23,168,193,96,24,83,50,201,36,72,198,243,243, +178,9,31,89,240,142,215,125,203,150,196,120,221,231,88,125,174,178,16,49, +23,105,140,55,148,123,44,91,241,234,135,113,31,157,18,161,228,203,238,170, +174,174,70,119,119,55,166,78,157,138,190,190,190,97,191,47,47,47,23,69, +100,202,224,155,50,71,95,142,157,40,181,133,88,44,134,121,243,230,101,36, +20,165,181,68,221,79,171,171,171,49,105,210,36,92,114,201,37,208,233,116, +56,121,242,36,6,7,7,209,221,221,141,190,190,62,248,124,190,52,95,44,181, +196,175,168,168,64,99,99,35,38,79,158,44,44,163,206,206,78,108,221,186, +21,125,125,125,163,106,217,173,215,235,241,226,139,47,194,239,247,11,151, +155,82,43,85,18,173,236,34,28,13,218,218,218,10,234,20,61,86,32,23,155, +156,76,65,223,139,93,91,195,96,156,137,56,29,211,87,207,40,66,201,103,161, +80,187,139,134,134,6,12,14,14,102,20,160,114,95,43,153,84,40,32,47,231, +91,147,117,146,73,120,210,248,84,26,225,154,15,3,3,3,24,24,24,72,35,191, +170,170,42,44,92,184,80,140,16,54,24,12,105,149,195,52,183,36,20,10,161, +181,181,21,46,151,11,30,143,167,40,27,65,163,209,96,243,230,205,232,239, +239,79,35,19,202,101,167,53,33,23,144,156,70,73,22,202,169,34,22,139,225, +174,187,238,58,109,155,107,198,140,25,232,232,232,64,121,121,185,8,92,202, +254,239,177,110,203,207,96,48,206,0,66,41,164,70,129,4,61,197,74,148,238, +40,101,42,158,50,91,138,178,15,228,62,88,153,16,137,68,48,103,206,28,116, +119,119,159,82,43,18,37,193,140,183,86,113,240,224,65,236,218,181,107,88, +191,36,90,15,57,219,77,78,82,160,160,240,169,94,135,211,233,196,127,252, +199,127,20,189,3,243,140,25,51,160,82,169,68,23,213,108,168,173,173,197, +208,208,80,90,54,21,5,195,41,35,101,44,39,45,50,254,117,65,222,10,165,188, +8,135,195,120,255,253,247,113,213,85,87,165,157,113,101,201,195,169,122, +33,106,106,106,210,148,57,175,215,91,80,92,172,187,187,59,167,156,45,22, +250,251,251,225,245,122,113,254,249,231,143,89,92,229,148,212,95,57,14, +144,41,120,79,132,34,251,202,229,153,14,178,155,39,91,240,153,50,189,128, +15,178,85,22,46,92,152,54,75,228,76,71,42,149,66,123,123,123,90,193,103, +182,94,102,212,37,128,154,97,202,46,192,83,129,195,225,40,250,24,100,149, +74,133,154,154,154,180,214,54,243,231,207,199,185,231,158,155,86,105,27, +12,6,225,114,185,176,119,239,94,81,17,79,73,8,114,103,96,185,194,151,193, +40,38,174,188,242,202,172,191,155,54,109,26,46,188,240,66,36,18,9,76,152, +48,1,171,86,173,194,111,126,243,155,162,126,254,162,69,139,240,233,79,127, +26,23,93,116,145,232,18,76,61,202,180,90,237,176,96,60,17,220,120,224,242, +203,47,71,99,99,99,154,124,46,102,61,202,48,137,117,248,240,225,188,127, +68,110,11,185,210,88,70,32,16,24,54,131,128,210,228,40,243,138,200,68,110, +129,160,20,96,114,199,90,175,215,139,198,198,198,140,22,209,153,134,146, +146,18,116,118,118,226,197,23,95,76,27,241,73,41,131,114,119,0,170,26,167, +86,36,242,52,202,83,137,159,116,117,117,225,251,223,255,126,209,201,196, +104,52,226,161,135,30,18,247,167,213,106,113,228,200,17,28,63,126,92,36, +19,40,171,127,149,113,49,34,22,217,58,97,66,97,140,183,162,71,19,46,39, +76,152,80,84,11,128,176,115,231,78,236,220,185,19,191,250,213,175,240,149, +175,124,5,151,94,122,41,66,161,144,200,48,165,206,193,99,81,88,88,200,253, +15,13,13,165,121,74,104,238,75,49,146,85,134,17,74,166,20,224,108,164,210, +217,217,153,113,65,228,34,61,185,80,139,2,240,36,48,137,44,178,94,156,212, +245,85,163,209,192,227,241,96,202,148,41,5,95,227,233,128,86,171,197,27, +111,188,129,45,91,182,8,225,43,103,155,201,205,18,169,225,160,220,20,78, +110,43,61,82,236,223,191,191,232,61,186,128,15,226,80,52,55,69,182,44,229, +98,63,229,255,203,149,191,153,26,241,49,145,48,78,23,6,7,7,145,76,38,49, +105,210,164,49,223,135,79,61,245,20,94,126,249,101,220,121,231,157,98,64, +25,157,149,104,52,138,9,19,38,156,150,251,167,78,214,84,55,99,48,24,144, +72,36,70,93,11,54,140,80,14,30,60,88,144,208,76,36,18,104,107,107,67,121, +121,121,198,76,47,89,51,149,59,125,202,85,167,153,134,253,100,250,44,98, +117,181,90,141,254,254,254,17,5,233,199,27,15,62,248,160,32,60,57,21,90, +46,236,163,158,86,84,53,46,183,66,39,225,60,82,205,229,249,231,159,47,122, +106,176,86,171,133,197,98,17,100,146,169,29,61,165,59,203,221,98,229,25, +26,114,21,48,89,166,178,181,202,113,20,198,120,99,96,96,0,201,100,18,30, +143,103,92,20,27,183,219,141,59,239,188,19,183,221,118,27,170,171,171,197, +121,72,165,82,227,78,40,177,88,12,125,125,125,162,209,36,85,245,83,131, +218,96,48,56,170,52,228,97,132,178,111,223,190,130,45,20,170,69,81,146, +144,108,161,40,155,204,201,241,146,76,125,113,148,2,45,30,143,11,55,25, +245,160,233,234,234,66,93,93,29,122,122,122,206,136,148,60,173,86,139,247, +222,123,15,43,87,174,76,35,84,42,84,84,54,66,164,158,86,68,36,52,159,128, +130,241,35,117,117,253,248,199,63,198,161,67,135,138,122,79,20,180,35,146, +82,182,204,161,138,119,185,93,59,145,138,178,230,136,186,154,146,69,67, +90,154,220,54,125,164,232,237,237,21,93,110,139,93,97,207,248,215,176,80, +104,84,238,120,225,190,251,238,195,119,190,243,29,225,133,72,36,18,152, +53,107,214,184,223,191,211,233,20,178,148,200,68,158,156,89,84,66,201,149, +185,67,112,185,92,72,38,147,104,105,105,193,23,190,240,133,97,191,167,110, +161,202,209,158,202,222,65,133,20,252,200,65,108,106,255,109,48,24,112, +244,232,81,0,192,196,137,19,133,79,244,116,109,206,39,159,124,82,100,146, +201,238,61,114,109,201,29,117,173,86,43,42,43,43,81,81,81,33,134,130,101, +106,73,94,8,188,94,47,126,248,195,31,22,244,204,70,2,171,213,138,254,254, +126,209,68,146,172,11,34,19,186,15,234,9,84,85,85,133,186,186,58,49,35, +126,104,104,72,212,33,209,223,81,204,72,233,6,27,201,216,209,199,31,127, +60,103,140,239,210,75,47,197,89,103,157,149,54,87,228,84,171,145,25,31, +93,56,157,78,49,188,107,188,83,215,31,123,236,49,124,225,11,95,128,209, +104,44,202,136,141,145,130,98,72,84,216,77,50,150,188,11,212,68,245,84, +73,229,148,210,136,104,126,123,119,119,119,214,195,170,28,104,67,238,31, +217,143,94,72,90,44,141,211,148,25,149,58,109,14,14,14,98,219,182,109,168, +172,172,196,164,73,147,50,142,220,28,11,104,52,26,28,56,112,0,43,87,174, +20,169,129,114,67,63,185,109,58,105,231,36,132,171,171,171,81,81,81,129, +242,242,114,84,86,86,138,233,127,114,48,190,16,188,253,246,219,184,239, +190,251,138,158,22,12,124,80,152,74,169,140,178,203,142,44,19,178,176,46, +186,232,34,124,241,139,95,20,102,187,215,235,21,193,199,205,155,55,163, +167,167,71,108,84,217,77,38,23,109,210,144,168,124,216,180,105,83,222,132, +145,195,135,15,163,186,186,58,77,219,162,0,40,91,49,12,130,195,225,16,22, +74,62,44,95,190,92,20,231,186,92,46,68,163,81,33,211,172,86,43,244,122, +61,42,42,42,16,141,70,113,248,240,225,188,67,235,252,126,63,142,31,63,94, +240,126,92,178,100,9,172,86,107,90,66,11,65,25,82,200,167,156,147,44,245, +122,189,162,151,32,117,171,136,70,163,34,235,146,218,228,143,27,161,12, +13,13,161,190,190,30,39,78,156,192,27,111,188,49,44,80,94,90,90,42,4,145, +252,93,102,67,18,86,133,186,148,226,241,184,104,242,72,105,167,212,8,114, +96,96,0,109,109,109,136,199,227,56,239,188,243,96,183,219,135,117,17,46, +134,91,107,104,104,8,239,190,251,46,54,111,222,156,230,214,83,90,37,228, +6,34,235,196,98,177,136,169,143,244,69,19,211,228,161,58,133,144,73,42, +149,194,29,119,220,81,116,23,151,140,227,199,143,227,172,179,206,194,103, +62,243,25,220,125,247,221,105,177,19,106,61,111,177,88,112,219,109,183, +161,187,187,27,79,61,245,212,48,183,103,77,77,13,26,27,27,225,112,56,134, +117,79,166,231,79,153,130,249,54,111,87,87,87,65,45,247,187,186,186,48, +48,48,32,230,119,208,1,34,109,204,110,183,159,182,118,28,140,51,7,94,175, +87,140,49,200,151,229,229,112,56,208,215,215,151,214,139,140,206,123,40, +20,130,70,163,65,111,111,175,80,148,191,250,213,175,98,221,186,117,112, +56,28,57,149,163,171,175,190,26,78,167,51,239,181,154,76,38,28,58,116,72, +92,43,93,47,101,198,42,251,1,42,251,11,202,163,141,229,66,106,146,169,209, +104,84,188,55,213,140,141,70,110,158,114,25,54,205,0,121,249,229,151,241, +203,95,254,50,141,80,168,187,37,45,190,60,39,92,238,96,74,55,89,136,48, +39,1,68,194,129,198,154,202,35,70,189,94,47,182,110,221,10,159,207,7,181, +90,141,5,11,22,160,178,178,18,229,229,229,35,154,157,64,215,237,243,249, +208,217,217,137,109,219,182,165,165,43,203,51,191,229,12,46,153,80,200, +29,36,15,149,42,47,47,135,221,110,71,101,101,101,90,49,163,178,41,102,54, +236,222,189,27,191,251,221,239,198,164,99,176,18,221,221,221,232,233,233, +193,95,254,242,23,252,247,127,255,119,154,149,65,132,2,0,127,249,203,95, +50,254,125,127,127,63,82,169,20,206,57,231,28,12,14,14,138,231,78,26,22, +5,235,11,73,85,124,244,209,71,71,164,236,208,140,25,179,217,140,96,48,40, +98,88,42,149,74,88,141,140,127,93,208,216,138,66,172,123,154,231,78,221, +29,148,67,216,72,134,81,83,198,45,91,182,224,27,223,248,6,126,247,187,223, +229,148,55,14,135,3,70,163,177,32,5,146,8,80,86,98,149,45,156,232,26,70, +226,66,150,101,93,209,188,55,202,255,48,26,141,5,85,202,211,98,56,28,14, +28,58,116,8,102,179,25,129,64,64,8,11,153,68,228,26,140,76,102,90,161,22, +130,78,167,131,217,108,22,228,162,252,189,92,129,30,12,6,209,220,220,44, +134,221,132,195,97,212,212,212,96,226,196,137,48,24,12,168,170,170,74,219, +80,177,88,12,110,183,27,46,151,11,251,247,239,79,43,216,148,219,194,40, +91,197,80,16,139,102,128,43,133,46,245,10,163,193,82,228,50,34,11,166,144, +20,225,80,40,132,187,239,190,123,76,173,146,108,155,121,245,234,213,184, +227,142,59,240,216,99,143,13,155,9,159,15,3,3,3,104,110,110,198,167,63, +253,105,152,76,38,76,155,54,45,35,113,146,235,193,229,114,137,158,105,52, +47,101,245,234,213,35,114,235,133,66,33,12,13,13,165,101,213,145,41,47, +107,120,76,42,255,186,240,249,124,25,71,23,100,2,89,50,242,164,88,34,18, +185,139,186,172,24,191,242,202,43,184,235,174,187,114,206,30,218,178,101, +11,150,45,91,86,208,231,251,253,126,49,207,134,198,92,200,138,185,220,218, +42,147,101,34,207,190,81,122,10,40,227,76,110,149,53,26,130,25,70,40,19, +39,78,44,168,120,80,110,103,242,232,163,143,226,158,123,238,193,166,77, +155,196,34,144,240,165,155,162,139,206,231,231,43,132,196,148,160,44,48, +121,84,167,60,237,142,198,101,250,253,126,188,255,254,251,105,3,135,148, +174,49,250,153,62,75,30,195,43,167,1,83,6,19,125,167,207,147,167,19,18, +121,88,173,86,65,44,242,116,66,50,61,115,173,199,170,85,171,240,204,51, +207,140,73,172,164,80,108,220,184,17,151,93,118,25,90,90,90,242,102,230, +101,58,188,175,191,254,58,174,185,230,26,116,116,116,136,98,200,158,158, +158,49,185,214,105,211,166,225,179,159,253,44,60,30,15,6,6,6,68,92,71,30, +46,53,146,236,176,177,234,20,203,56,61,160,51,47,143,174,200,5,106,189, +79,51,92,72,56,203,103,62,83,1,175,209,104,68,85,85,85,78,215,87,161,74, +13,185,164,72,216,203,215,32,103,87,202,214,19,237,89,249,103,89,110,41, +83,255,105,74,40,205,144,42,26,161,52,53,53,21,68,40,253,253,253,248,216, +199,62,134,237,219,183,35,28,14,227,185,231,158,195,130,5,11,208,213,213, +5,143,199,35,210,78,229,1,81,74,159,223,72,65,193,125,165,185,70,230,167, +94,175,135,203,229,130,201,100,18,153,12,52,227,89,57,231,90,57,197,78, +30,220,35,191,55,189,191,210,212,37,50,160,77,69,41,181,148,181,69,243, +154,101,114,145,219,171,228,171,134,95,191,126,61,254,246,183,191,157,86, +34,81,30,44,165,86,54,18,141,112,188,218,231,191,242,202,43,216,176,97, +3,38,79,158,12,187,221,142,41,83,166,96,210,164,73,98,220,115,32,16,64, +56,28,134,199,227,17,135,212,106,181,166,221,207,158,61,123,176,121,243, +230,140,61,224,150,46,93,138,198,198,70,161,192,148,148,148,12,251,123, +198,153,13,249,236,231,139,161,200,83,16,73,169,84,38,153,40,21,195,88, +44,134,157,59,119,226,27,223,248,6,126,253,235,95,103,125,239,66,179,83, +101,25,32,143,81,39,153,163,108,215,164,244,6,145,7,71,158,5,69,95,114, +25,128,60,238,186,104,132,114,222,121,231,97,245,234,213,5,253,113,99,99, +35,182,111,223,142,68,34,129,189,123,247,98,193,130,5,208,233,116,8,4,2, +152,53,107,22,218,219,219,211,98,40,153,210,228,226,241,248,136,14,99,166, +215,202,139,172,215,235,225,243,249,196,140,109,143,199,35,8,133,76,87, +34,20,121,162,28,101,81,100,178,126,148,205,45,229,57,216,196,240,114,112, +157,186,26,147,53,66,147,9,229,120,73,54,161,60,214,113,146,217,179,103, +227,133,23,94,192,181,215,94,139,206,206,206,130,50,93,172,86,43,122,122, +122,160,86,171,49,113,226,68,204,154,53,11,83,167,78,61,99,5,70,36,18,17, +25,97,205,205,205,226,255,171,171,171,49,109,218,52,204,153,51,7,13,13, +13,98,116,45,61,135,173,91,183,226,213,87,95,205,249,222,111,190,249,38, +28,14,7,22,44,88,32,246,5,165,178,51,177,124,56,64,50,160,144,180,93,121, +240,30,157,91,18,196,164,32,82,125,149,220,78,40,28,14,99,233,210,165,57, +9,165,144,54,87,68,104,36,251,100,87,149,210,210,32,153,36,79,219,148,149, +112,114,151,41,251,8,18,41,209,125,140,6,195,8,229,172,179,206,202,42,252, +149,216,185,115,39,110,188,241,70,60,247,220,115,72,38,147,120,238,185, +231,240,157,239,124,7,45,45,45,176,217,108,105,190,189,76,115,156,79,21, +178,207,146,50,122,228,122,7,147,201,4,191,223,47,210,223,104,182,54,185, +190,100,11,133,72,133,54,154,50,45,79,102,124,250,92,90,124,121,234,36, +165,53,203,215,64,132,34,187,225,100,151,153,140,230,230,102,252,249,207, +127,30,51,34,161,12,39,106,132,247,235,95,255,26,13,13,13,184,230,154,107, +16,14,135,51,118,60,85,169,84,152,59,119,46,116,58,29,46,187,236,50,156, +119,222,121,0,62,72,126,112,187,221,104,109,109,253,80,9,18,234,60,77,36, +99,179,217,176,124,249,114,84,84,84,100,204,84,203,134,214,214,86,81,241, +76,110,7,179,217,140,68,34,193,65,255,15,153,251,43,31,232,188,210,185, +39,34,41,45,45,21,174,108,217,235,0,64,204,91,162,191,203,230,90,27,24, +24,200,217,105,24,0,166,76,153,130,199,30,123,108,152,236,163,194,96,74, +128,210,106,181,162,64,49,211,57,94,187,118,109,154,119,65,30,203,77,101, +11,164,12,23,149,80,220,110,55,150,46,93,138,141,27,55,22,244,6,187,119, +239,198,242,229,203,241,206,59,239,32,145,72,224,145,71,30,193,138,21,43, +208,220,220,140,25,51,102,136,106,118,153,76,40,59,75,246,81,159,138,251, +203,100,50,165,245,4,35,45,130,130,226,129,64,0,86,171,21,161,80,72,124, +209,136,224,72,36,34,126,166,84,57,89,27,144,107,100,232,51,104,206,11, +213,153,208,6,35,129,34,87,147,43,71,27,19,49,41,253,147,27,55,110,196, +147,79,62,153,119,228,242,104,48,119,238,92,132,66,33,252,253,239,127,79, +43,44,29,24,24,192,131,15,62,8,141,70,131,57,115,230,224,220,115,207,133, +201,100,18,247,109,181,90,241,249,207,127,30,77,77,77,216,191,127,63,158, +126,250,105,28,57,114,36,45,133,114,180,160,67,73,218,21,237,7,218,31,242, +119,249,217,36,18,9,168,84,42,81,233,235,247,251,69,82,72,161,240,120,60, +88,181,106,21,86,173,90,53,226,235,246,120,60,240,249,124,226,32,82,30, +63,7,253,63,28,68,50,210,244,88,185,177,45,41,175,20,23,165,46,16,36,176, +99,177,24,194,225,48,98,177,24,206,61,247,220,52,43,57,147,188,205,133, +119,222,121,39,173,104,58,95,50,83,182,88,223,224,224,32,62,249,201,79, +166,185,199,228,88,46,213,153,141,22,154,76,139,253,153,207,124,6,29,29, +29,56,118,236,88,65,38,153,207,231,195,242,229,203,177,109,219,54,36,18, +9,252,227,31,255,192,245,215,95,47,154,144,145,134,79,49,10,114,47,201, +153,19,167,26,244,84,102,95,69,34,17,132,66,33,232,245,122,81,8,25,12,6, +17,137,68,16,14,135,5,129,80,160,139,132,163,28,75,145,31,158,220,241,88, +110,63,47,147,138,28,156,147,199,248,202,38,170,44,96,2,129,0,30,121,228, +145,180,122,150,177,128,209,104,196,130,5,11,112,243,205,55,67,163,209, +224,202,43,175,196,209,163,71,177,110,221,58,188,245,214,91,66,163,209, +104,52,56,126,252,56,78,156,56,129,41,83,166,224,171,95,253,42,110,185, +229,22,132,66,33,236,219,183,15,15,61,244,208,168,27,114,82,203,153,68, +34,1,175,215,43,178,185,228,222,102,100,225,201,123,177,164,164,68,20,172, +14,12,12,32,18,137,160,167,167,7,39,78,156,64,95,95,31,28,14,7,188,94,47, +146,201,36,234,234,234,48,109,218,52,76,156,56,81,84,34,159,202,44,156, +124,152,57,115,38,78,158,60,41,148,7,147,201,148,166,133,150,148,148,48, +161,124,68,32,187,187,201,10,33,66,161,110,225,228,210,214,235,245,194, +187,19,12,6,17,143,199,81,95,95,159,243,253,243,41,146,199,143,31,207,91, +44,89,40,150,46,93,42,20,123,146,203,202,32,127,209,9,133,62,232,219,223, +254,54,110,191,253,246,130,222,164,191,191,31,209,104,20,55,221,116,19, +86,174,92,137,88,44,134,151,94,122,9,215,94,123,45,106,107,107,177,111, +223,62,161,17,200,36,66,255,30,105,28,37,19,169,80,17,27,21,24,82,118,70, +40,20,130,217,108,22,255,166,162,72,178,146,228,148,82,34,59,218,72,180, +248,114,51,75,249,187,28,88,39,13,69,78,193,83,22,43,182,181,181,225,145, +71,30,25,151,244,223,233,211,167,163,174,174,14,63,250,209,143,176,103, +207,30,172,95,191,30,30,143,7,54,155,13,95,251,218,215,240,139,95,252,2, +22,139,5,61,61,61,34,131,197,108,54,163,169,169,9,94,175,23,27,54,108,192, +150,45,91,78,153,240,40,142,228,245,122,113,226,196,9,148,150,150,162,166, +166,6,139,22,45,66,67,67,131,120,157,211,233,68,40,20,66,48,24,20,174,200, +112,56,60,140,84,52,26,13,26,26,26,160,211,233,48,119,238,92,161,81,89, +44,22,244,246,246,162,191,191,31,7,15,30,196,254,253,251,177,102,205,26, +81,179,212,208,208,128,166,166,38,148,149,149,97,104,104,104,212,46,197, +41,83,166,160,187,187,91,52,214,163,107,32,165,168,164,164,4,6,131,1,110, +183,251,180,207,174,103,20,7,178,219,43,83,166,20,41,69,20,127,72,165,82, +194,146,153,56,113,98,206,247,46,166,181,95,136,101,70,178,86,174,186,39, +55,89,81,38,212,102,50,237,116,58,29,18,137,4,190,254,245,175,227,239,127, +255,123,65,111,228,114,185,176,106,213,42,220,116,211,77,56,124,248,48, +246,238,221,139,181,107,215,98,249,242,229,152,51,103,14,142,31,63,46,234, +0,72,160,147,0,161,7,53,218,27,146,137,69,246,19,202,241,18,250,89,206, +242,160,84,82,18,94,74,97,38,103,120,201,153,30,114,107,122,202,225,38, +55,24,33,22,139,97,253,250,245,120,226,137,39,10,170,239,41,134,85,98,183, +219,177,116,233,82,92,113,197,21,195,136,193,227,241,160,185,185,25,205, +205,205,208,233,116,40,47,47,135,205,102,19,166,244,182,109,219,78,217, +26,169,171,171,19,214,78,32,16,192,130,5,11,176,112,225,66,216,237,118, +4,131,65,28,57,114,4,157,157,157,216,183,111,95,94,83,127,36,72,165,82, +40,47,47,199,140,25,51,176,96,193,2,220,114,203,45,0,128,237,219,183,163, +165,165,5,91,182,108,17,135,127,254,252,249,176,88,44,232,235,235,27,177, +139,108,202,148,41,104,105,105,17,231,36,24,12,138,34,57,0,66,131,61,213, +241,3,140,51,211,66,81,86,154,147,7,66,46,100,150,221,220,84,0,41,215,139, +252,127,236,125,121,116,91,229,181,253,150,172,209,178,102,91,114,236,12, +38,206,128,19,59,113,18,2,25,9,129,12,76,121,9,133,5,101,108,75,75,233, +162,180,208,2,237,235,131,245,86,223,175,143,66,91,224,181,172,50,133,146, +23,134,150,41,33,132,204,243,224,12,198,113,226,36,142,157,193,118,98,203, +241,108,75,178,230,201,210,239,143,188,243,245,187,178,44,203,67,32,133, +123,214,242,114,98,203,210,213,213,189,223,254,206,57,251,236,125,37,132, +199,227,97,108,71,169,84,42,88,23,169,220,60,212,53,184,23,160,104,52,26, +184,92,46,120,189,94,44,88,176,32,101,64,161,27,251,157,119,222,193,152, +49,99,240,211,159,254,20,167,79,159,198,161,67,135,48,117,234,84,228,230, +230,50,209,64,202,22,136,29,51,28,89,74,34,96,161,225,37,98,116,80,3,158, +50,17,158,229,69,117,121,170,215,211,2,75,165,58,158,4,192,147,12,168,49, +22,95,226,40,45,45,197,199,31,127,140,186,186,186,175,244,162,9,4,2,120, +243,205,55,113,252,248,113,116,119,119,39,109,52,135,66,33,180,181,181, +13,73,92,146,210,254,214,214,86,40,20,10,204,154,53,139,45,232,103,207, +158,197,241,227,199,225,116,58,5,89,199,229,184,233,9,160,248,247,146,157, +157,141,31,254,240,135,208,235,245,56,124,248,48,202,203,203,81,81,81,193, +174,143,169,83,167,34,18,137,164,60,19,99,48,24,24,179,145,202,171,116, +173,40,20,10,104,181,90,70,0,9,4,2,67,150,2,23,227,202,136,248,190,5,109, +126,121,77,58,218,68,200,229,114,193,70,244,74,2,148,238,238,110,86,170, +167,210,62,145,154,168,85,48,212,235,85,150,104,49,166,23,52,153,76,131, +122,210,134,134,6,188,240,194,11,152,58,117,42,190,251,221,239,34,26,141, +162,182,182,22,10,133,130,221,104,212,95,240,249,124,44,245,34,163,151, +225,26,34,227,63,244,112,56,12,133,66,193,152,92,212,199,225,251,58,169, +60,31,149,192,18,105,111,149,150,150,98,219,182,109,56,122,244,232,215, +118,209,228,231,231,163,160,160,0,165,165,165,120,224,129,7,216,123,31, +238,200,206,206,102,83,233,60,136,84,86,86,98,231,206,157,104,107,107,27, +244,231,216,159,10,113,32,16,72,233,185,157,78,39,3,26,179,217,140,159, +252,228,39,136,68,34,216,183,111,31,42,43,43,81,90,90,10,153,76,134,171, +174,186,10,89,89,89,104,106,106,74,122,174,142,31,63,14,163,209,136,159, +253,236,103,120,247,221,119,225,118,187,217,241,170,213,106,70,87,39,38, +225,112,220,160,98,92,153,217,10,177,172,120,246,103,252,196,188,92,46, +239,55,19,215,233,116,95,217,241,211,140,30,181,29,168,148,23,8,4,32,151, +203,47,15,160,16,106,81,93,120,40,113,226,196,9,156,56,113,2,86,171,21, +183,220,114,11,230,205,155,135,142,142,14,216,237,118,4,131,65,65,61,91, +34,145,176,197,62,126,242,116,184,178,22,250,30,47,187,16,79,23,78,244, +190,19,77,144,182,181,181,161,188,188,28,59,119,238,252,202,51,145,190, +162,182,182,22,43,86,172,192,153,51,103,240,212,83,79,225,253,247,223,199, +241,227,199,135,237,249,201,135,38,22,139,225,193,7,31,196,136,17,35,208, +210,210,130,146,146,18,129,233,89,178,207,46,22,139,65,165,82,33,28,14, +195,237,118,195,233,116,162,185,185,25,129,64,0,29,29,29,76,209,149,7,24, +250,156,40,84,42,21,83,110,38,193,77,250,124,18,1,142,203,229,194,137,19, +39,0,92,210,161,187,249,230,155,177,111,223,62,28,56,112,0,213,213,213, +0,46,169,68,228,231,231,39,45,249,57,28,14,236,216,177,3,75,151,46,133, +211,233,196,129,3,7,4,131,179,68,252,8,4,2,140,129,38,78,217,127,51,130, +207,54,120,182,100,34,249,19,90,67,250,51,2,236,175,42,147,145,145,193, +54,246,201,174,163,84,50,33,151,203,37,152,250,39,166,87,48,24,20,200,217, +95,22,64,49,24,12,176,217,108,195,242,65,180,181,181,97,245,234,213,88, +189,122,53,174,186,234,42,44,93,186,20,51,102,204,128,76,38,131,219,237, +102,19,236,212,239,224,217,81,60,139,107,184,51,23,2,150,68,220,237,68, +31,116,56,28,198,169,83,167,176,127,255,126,236,223,191,255,138,153,98, +143,143,83,167,78,97,246,236,217,168,168,168,192,235,175,191,142,159,255, +252,231,40,47,47,31,50,144,156,58,117,10,163,71,143,198,111,127,251,91, +200,229,114,156,56,113,2,101,101,101,41,247,34,220,110,55,206,156,57,131, +211,167,79,35,20,10,49,42,38,125,241,140,154,68,202,169,212,151,160,210, +100,71,71,7,58,58,58,122,109,0,116,58,29,38,78,156,136,236,236,108,182, +35,227,111,150,150,150,22,180,180,180,192,108,54,227,233,167,159,198,214, +173,91,113,244,232,81,38,13,115,205,53,215,64,163,209,36,45,5,86,86,86, +66,46,151,227,251,223,255,62,214,174,93,11,191,223,15,143,199,3,173,86, +139,96,48,200,174,105,187,221,46,74,231,127,131,128,132,31,127,144,74,165, +125,10,50,210,117,219,31,67,203,106,181,38,253,125,81,81,17,222,121,231, +29,1,203,140,136,0,212,187,225,117,12,121,121,24,90,203,105,189,163,30, +46,95,162,227,85,219,169,82,51,148,117,86,214,87,173,24,0,254,254,247,191, +15,251,135,115,225,194,5,188,249,230,155,0,46,53,144,111,189,245,86,204, +159,63,31,35,70,140,96,146,208,212,247,8,6,131,2,209,50,126,87,16,95,207, +76,53,248,242,90,178,191,15,135,195,104,108,108,68,121,121,57,202,203,203, +209,208,208,240,149,52,213,135,43,102,204,152,129,83,167,78,225,201,39, +159,196,181,215,94,59,104,64,177,90,173,140,213,244,242,203,47,35,61,61, +29,101,101,101,176,217,108,73,25,42,100,214,83,89,89,137,147,39,79,194, +235,245,178,20,155,192,129,191,248,121,27,0,254,70,160,155,51,21,185,30, +250,76,35,145,8,170,170,170,80,85,85,197,110,160,201,147,39,99,196,136, +17,80,42,149,240,120,60,144,72,36,8,4,2,168,172,172,68,65,65,1,230,207, +159,143,85,171,86,161,171,171,11,135,15,31,6,0,44,91,182,12,205,205,205, +125,190,207,112,56,140,61,123,246,224,246,219,111,71,121,121,57,163,168, +187,221,110,54,204,74,139,143,8,42,255,218,193,131,6,175,164,206,79,164, +243,215,41,125,79,86,185,184,234,170,171,82,42,121,241,37,122,10,234,253, +210,53,207,175,97,68,93,142,255,25,245,131,169,135,29,10,133,4,242,83,195, +17,125,222,165,59,119,238,100,55,214,229,10,191,223,143,181,107,215,98, +237,218,181,0,46,77,115,207,154,53,11,215,93,119,29,178,179,179,123,249, +45,39,202,8,146,157,136,68,89,6,63,172,200,63,175,205,102,195,217,179,103, +81,89,89,137,178,178,178,43,38,251,48,153,76,176,90,173,72,79,79,31,80, +111,38,22,139,225,241,199,31,199,242,229,203,177,102,205,154,1,191,174, +193,96,128,211,233,132,221,110,199,175,127,253,107,152,76,38,84,84,84,160, +174,174,174,207,5,150,46,226,170,170,42,148,149,149,9,178,191,120,17,61, +126,71,21,191,89,224,179,21,254,102,232,171,156,198,103,40,252,77,199,255, +252,236,217,179,140,174,61,97,194,4,140,25,51,6,177,88,140,149,94,93,46, +23,30,124,240,65,156,63,127,30,95,124,241,5,194,225,48,62,249,228,19,20, +21,21,33,47,47,47,105,182,114,232,208,33,228,231,231,35,28,14,195,231,243, +177,185,167,175,218,13,80,140,43,39,36,18,9,188,94,111,210,107,32,47,47, +47,229,231,138,191,7,226,203,108,60,173,57,81,134,18,175,146,78,217,14, +239,89,117,217,0,229,165,151,94,194,254,253,251,191,242,15,193,110,183, +99,243,230,205,189,244,148,114,115,115,145,157,157,141,137,19,39,50,251, +92,179,217,44,152,246,236,11,176,72,130,197,110,183,163,179,179,19,157, +157,157,104,111,111,71,107,107,43,234,234,234,174,216,172,195,106,181,66, +171,213,98,221,186,117,232,232,232,64,86,86,22,238,187,239,190,148,228, +78,10,10,10,112,236,216,49,236,216,177,3,37,37,37,168,168,168,24,208,107, +91,44,22,28,57,114,4,79,63,253,52,138,139,139,81,89,89,137,189,123,247, +246,201,212,82,40,20,104,106,106,194,161,67,135,208,209,209,193,46,124, +82,22,224,129,131,55,6,226,233,216,252,205,16,79,211,142,119,255,140,191, +248,249,217,38,126,210,158,152,44,188,219,93,79,79,15,26,27,27,89,57,247, +154,107,174,129,94,175,103,243,50,26,141,6,191,254,245,175,241,191,255, +251,191,104,110,110,70,117,117,53,26,26,26,112,199,29,119,36,101,204,213, +213,213,193,98,177,96,209,162,69,152,60,121,114,194,199,36,98,125,209,198, +101,184,123,134,98,124,189,96,2,160,95,93,184,84,27,224,68,6,226,135,170, +105,192,146,167,169,243,82,81,241,155,49,222,70,157,166,227,137,250,28, +207,90,29,54,64,57,114,228,8,94,124,241,197,43,174,55,208,212,212,132,166, +166,166,175,149,61,245,85,69,126,126,62,2,129,0,62,254,248,99,182,219,150, +201,100,232,238,238,198,59,239,188,131,39,158,120,162,207,204,81,46,151, +99,204,152,49,104,109,109,197,231,159,127,14,155,205,134,221,187,119,15, +8,72,42,42,42,96,177,88,240,193,7,31,160,163,163,3,155,55,111,238,147,169, +34,149,74,113,240,224,65,156,58,117,170,207,82,22,223,19,137,31,16,227, +119,87,4,42,84,38,34,33,59,222,63,39,94,65,53,62,75,225,41,225,4,44,212, +24,167,223,243,20,242,88,44,198,236,12,10,10,10,144,147,147,131,238,238, +110,212,214,214,226,222,123,239,197,233,211,167,177,99,199,14,132,66,33, +124,240,193,7,184,251,238,187,97,179,217,250,188,63,218,219,219,177,107, +215,46,180,180,180,224,194,133,11,253,178,198,228,114,57,230,205,155,135, +209,163,71,67,163,209,176,243,36,138,76,94,121,17,95,110,2,32,80,39,167, +107,140,31,127,88,185,114,101,210,231,76,197,177,145,54,108,148,225,243, +126,68,212,71,33,165,142,100,25,63,129,10,201,82,241,178,43,68,37,30,142, +44,133,61,195,170,85,171,82,86,25,22,99,248,163,160,160,0,39,78,156,192, +219,111,191,205,64,132,223,185,211,78,125,229,202,149,184,251,238,187,209, +220,220,140,238,238,110,0,151,154,208,99,198,140,65,89,90,58,11,203,0,0, +32,0,73,68,65,84,89,25,114,114,114,240,202,43,175,160,170,170,10,155,54, +109,74,105,18,151,118,61,235,215,175,199,27,111,188,129,137,19,39,226,224, +193,131,125,54,20,163,209,40,118,236,216,1,155,205,150,80,137,153,167,82, +242,42,173,252,14,139,30,67,255,166,155,134,178,17,186,65,248,140,37,81, +185,43,190,188,197,131,5,169,33,240,243,69,4,48,196,118,137,70,163,8,6, +131,176,217,108,184,112,225,2,174,186,234,42,100,103,103,227,226,197,139, +200,204,204,196,79,126,242,19,172,94,189,26,129,64,0,235,215,175,199,141, +55,222,8,191,223,207,40,195,241,49,144,185,30,234,193,228,231,231,99,250, +244,233,80,171,213,144,201,100,240,122,189,80,42,149,204,245,83,140,175, +55,226,253,146,232,255,52,111,66,215,18,95,98,93,187,118,109,82,202,240, +196,137,19,83,38,61,241,226,148,188,8,46,93,31,52,192,77,89,72,252,12,12, +109,206,232,57,120,3,64,94,126,127,56,40,204,50,224,146,36,119,50,48,73, +79,79,199,236,217,179,153,4,124,117,117,245,101,29,84,251,182,132,78,167, +195,200,145,35,81,86,86,134,87,95,125,149,165,157,124,125,147,22,99,74, +77,165,82,41,118,239,222,141,104,52,138,130,130,2,164,167,167,163,186,186, +26,126,191,31,175,189,246,26,38,76,152,128,93,187,118,161,164,164,36,165, +76,211,104,52,162,172,172,12,106,181,26,219,182,109,131,203,229,194,250, +245,235,19,50,183,20,10,5,14,30,60,136,35,71,142,244,226,222,199,51,77, +18,73,253,83,122,206,139,236,241,146,218,148,157,16,40,17,32,241,22,8,137, +210,114,158,161,66,255,230,181,217,72,5,33,22,139,9,188,185,233,139,23, +118,108,105,105,65,83,83,19,102,204,152,193,6,63,31,125,244,81,166,116, +112,248,240,97,76,154,52,9,70,163,49,101,63,139,254,162,174,174,14,86,171, +21,58,157,78,96,137,16,137,68,224,247,251,197,134,254,21,8,44,52,106,16, +63,215,70,236,209,151,94,122,41,233,115,141,25,51,6,167,78,157,74,25,80, +120,253,64,2,4,2,21,242,51,161,44,131,238,27,62,179,231,149,134,249,233, +126,42,129,209,61,56,44,128,242,218,107,175,245,249,128,185,115,231,98, +222,188,121,200,205,205,197,190,125,251,176,99,199,14,244,244,244,96,210, +164,73,8,135,195,168,173,173,29,242,188,202,183,49,204,102,51,222,123,239, +61,118,193,240,101,30,74,67,105,97,161,26,41,223,104,163,221,176,90,173, +198,47,126,241,11,220,121,231,157,104,105,105,25,144,144,163,197,98,193, +123,239,189,135,229,203,151,227,63,255,243,63,25,41,33,62,171,33,1,208, +15,63,252,16,192,37,118,30,101,21,241,214,203,188,48,38,255,94,8,20,249, +139,151,126,78,143,165,172,140,52,145,40,51,73,149,229,197,15,169,82,166, +2,92,242,71,161,155,159,50,18,98,200,144,252,4,175,224,16,141,70,81,93, +93,13,149,74,133,194,194,66,52,54,54,226,7,63,248,1,62,250,232,35,248,253, +126,156,63,127,30,57,57,57,24,51,102,204,176,81,235,105,14,135,108,16,52, +26,141,128,217,35,130,202,215,95,238,162,235,138,47,175,210,117,68,165, +74,0,248,241,143,127,156,180,25,47,147,201,112,246,236,217,148,214,205, +248,193,73,190,68,69,18,250,241,190,44,188,240,35,175,196,78,21,0,94,37, +157,214,152,225,26,176,148,81,234,29,31,121,121,121,88,178,100,9,110,187, +237,54,72,36,18,28,57,114,4,26,141,6,79,63,253,52,228,114,57,54,111,222, +140,141,27,55,66,161,80,96,198,140,25,240,251,253,41,169,19,139,241,207, +250,41,165,204,212,56,163,5,55,158,103,78,233,44,175,34,160,86,171,49,123, +246,108,252,224,7,63,128,68,34,193,246,237,219,113,248,240,225,148,197, +230,244,122,61,86,175,94,141,231,158,123,14,119,222,121,39,202,202,202, +80,83,83,211,107,247,175,80,40,176,105,211,38,156,59,119,78,144,54,147, +201,79,50,16,161,139,149,64,132,111,38,210,191,121,32,226,135,79,105,87, +197,207,0,240,116,205,68,96,194,215,185,121,15,121,94,130,135,202,97,188, +64,40,205,141,144,10,117,40,20,98,62,58,21,21,21,40,46,46,70,83,83,19,238, +185,231,30,108,216,176,1,46,151,11,29,29,29,144,72,36,24,53,106,84,191, +195,107,169,4,249,98,144,154,4,191,3,166,207,91,44,127,125,245,49,102,204, +24,150,57,146,11,171,193,96,64,102,102,38,140,70,35,172,86,43,70,141,26, +197,12,253,30,123,236,49,70,87,239,43,110,188,241,70,86,21,72,229,62,93, +190,124,57,187,223,50,50,50,152,42,55,111,228,71,243,40,241,172,173,248, +30,164,215,235,69,40,20,18,176,46,135,226,162,219,11,80,218,219,219,97, +50,153,96,183,219,33,151,203,49,101,202,20,204,155,55,15,55,222,120,35, +227,51,175,90,181,138,241,169,73,11,41,55,55,23,143,60,242,8,254,241,143, +127,192,231,243,225,213,87,95,197,191,253,219,191,137,87,96,138,193,167, +151,180,107,32,7,53,82,176,29,61,122,52,150,44,89,2,165,82,201,100,174, +181,90,45,38,78,156,136,105,211,166,1,184,52,96,183,121,243,230,148,85, +116,21,10,5,124,62,31,62,252,240,67,188,242,202,43,88,184,112,33,118,237, +218,149,80,42,37,26,141,226,173,183,222,98,11,44,159,149,80,189,63,158, +109,66,86,162,4,140,244,190,40,203,226,179,19,190,145,200,55,16,121,214, +9,221,20,124,61,56,213,44,133,74,19,84,246,162,223,83,54,194,255,142,31, +70,36,224,33,223,156,186,186,58,152,205,102,56,28,14,220,118,219,109,216, +186,117,43,124,62,31,28,14,7,116,58,221,144,202,95,114,185,156,45,82,173, +173,173,130,154,60,255,24,143,199,35,2,202,215,16,247,221,119,31,140,70, +163,224,179,224,229,223,101,50,25,46,94,188,136,125,251,246,97,213,170, +85,253,82,197,179,178,178,80,95,95,159,50,165,60,20,10,225,190,251,238, +19,200,204,243,128,193,179,3,9,52,250,42,213,69,163,81,180,183,183,195, +239,247,35,63,63,159,61,150,87,33,30,50,160,88,44,22,252,246,183,191,69, +71,71,7,198,143,31,47,144,220,94,179,102,77,66,202,105,56,28,102,101,149, +155,111,190,25,63,255,249,207,113,240,224,193,111,109,31,100,244,232,209, +200,206,206,70,69,69,69,202,204,141,156,156,28,129,214,24,191,251,48,24, +12,176,90,173,120,245,213,87,161,86,171,81,85,85,133,113,227,198,193,104, +52,66,165,82,193,237,118,99,247,238,221,40,47,47,103,141,249,84,194,96, +48,160,166,166,6,71,142,28,193,255,252,207,255,224,134,27,110,192,206,157, +59,19,122,134,184,221,110,188,247,222,123,172,159,67,139,63,101,29,4,32, +4,30,84,166,225,189,170,201,120,140,87,225,77,212,107,137,31,104,140,207, +74,226,7,180,232,70,74,22,188,156,14,239,191,67,187,126,202,78,120,245, +105,222,222,128,192,133,50,22,175,215,11,175,215,139,140,140,12,220,122, +235,173,216,177,99,7,252,126,63,154,154,154,80,84,84,4,32,53,143,240,209, +163,71,11,136,1,89,89,89,184,229,150,91,176,126,253,122,116,117,117,49, +113,65,2,79,222,208,77,148,196,255,234,227,71,63,250,209,176,62,223,180, +105,211,112,244,232,209,148,205,189,118,236,216,129,29,59,118,12,235,49, +60,248,224,131,24,53,106,20,187,191,34,145,8,92,46,215,176,148,85,101,84, +222,162,33,27,155,205,150,178,54,149,197,98,193,236,217,179,209,209,209, +193,172,101,191,233,145,158,158,142,220,220,92,164,165,165,225,236,217, +179,216,178,101,11,128,75,51,23,239,189,247,30,94,125,245,213,148,158,135, +24,22,228,60,73,89,137,193,96,128,94,175,199,157,119,222,9,157,78,135,215, +94,123,45,101,53,220,100,97,181,90,177,107,215,46,216,108,54,252,233,79, +127,234,19,76,98,177,24,58,59,59,241,217,103,159,245,153,149,240,110,149, +241,54,162,4,42,148,149,16,176,196,251,97,243,198,101,137,202,90,60,120, +240,255,143,7,146,190,188,28,120,77,165,68,186,109,4,34,4,54,129,64,128, +245,87,104,130,152,244,185,200,87,39,28,14,163,161,161,1,147,38,77,194, +226,197,139,81,82,82,2,153,76,134,211,167,79,227,166,155,110,194,145,35, +71,146,18,33,114,114,114,176,122,245,106,252,225,15,127,192,245,215,95, +207,74,159,173,173,173,200,204,204,132,84,42,101,186,107,116,142,213,106, +53,252,126,63,203,248,196,248,215,141,37,75,150,48,111,40,114,28,253,58, +102,143,168,39,74,250,93,161,80,8,26,141,6,93,93,93,67,6,21,193,221,249, +236,179,207,14,232,143,125,62,31,102,206,156,137,23,95,124,177,223,6,211, +248,241,227,177,127,255,126,140,30,61,26,57,57,57,80,171,213,144,74,165, +204,74,245,114,121,169,15,71,6,146,147,147,131,72,36,130,51,103,206,224, +240,225,195,112,187,221,44,187,160,6,50,0,124,241,197,23,176,90,173,41, +209,70,173,86,43,22,44,88,192,134,229,168,111,162,211,233,160,213,106,113, +253,245,215,163,162,162,98,88,192,36,39,39,7,107,214,172,129,211,233,196, +99,143,61,134,69,139,22,97,215,174,93,9,51,147,246,246,118,108,216,176, +65,144,149,240,153,8,101,83,196,44,225,13,134,8,92,8,72,120,7,75,98,119, +245,37,247,159,40,11,166,190,7,15,54,244,127,2,151,190,180,216,120,16,226, +83,249,120,113,80,122,29,242,0,34,115,182,64,32,0,133,66,193,254,173,82, +169,16,10,133,160,84,42,209,208,208,128,209,163,71,99,206,156,57,40,43, +43,131,66,161,192,254,253,251,113,219,109,183,97,219,182,109,125,30,75, +115,115,51,30,120,224,1,252,229,47,127,65,56,28,238,117,157,184,221,110, +120,60,30,200,229,114,120,189,94,168,84,42,6,100,116,156,162,216,228,208, +35,209,70,230,114,199,236,217,179,81,87,87,39,80,80,24,174,190,197,64,35, +20,10,49,75,9,114,182,29,46,2,136,224,29,21,20,20,36,157,6,230,35,59,59, +27,38,147,9,54,155,13,135,14,29,74,250,216,233,211,167,99,253,250,245,56, +115,230,12,155,244,230,173,40,165,82,41,38,77,154,132,145,35,71,226,193, +7,31,196,39,159,124,50,108,148,204,193,198,164,73,147,80,95,95,143,13,27, +54,32,20,10,177,99,141,151,60,224,203,53,59,119,238,196,243,207,63,223, +175,135,76,94,94,30,238,187,239,62,100,102,102,98,239,222,189,40,41,41, +97,141,53,181,90,141,172,172,44,152,205,102,172,95,191,126,88,50,19,234, +115,205,155,55,15,143,60,242,8,14,29,58,148,16,244,188,94,47,54,111,222, +204,24,101,137,40,191,116,140,4,34,188,107,97,60,137,128,254,142,60,23, +226,65,164,171,171,11,94,175,23,110,183,27,237,237,237,12,44,116,58,29, +76,38,19,44,22,11,27,248,243,249,124,76,15,140,7,151,120,185,240,84,130, +7,25,94,222,159,132,73,35,145,8,148,74,37,130,193,32,203,90,72,81,88,161, +80,32,20,10,161,165,165,5,57,57,57,152,52,105,18,106,107,107,161,84,42, +177,119,239,94,204,158,61,59,169,100,81,71,71,7,212,106,53,60,30,79,47, +112,160,161,73,146,190,167,215,39,218,51,129,138,56,244,56,180,224,85,24, +190,170,204,164,166,166,6,94,175,151,45,218,60,9,229,235,200,80,236,118, +187,192,128,144,18,2,50,142,27,108,191,78,198,223,220,215,95,127,125,202, +128,114,238,220,57,220,127,255,253,204,193,174,175,15,110,206,156,57,120, +252,241,199,81,88,88,136,191,253,237,111,40,45,45,101,128,194,115,166,27, +27,27,161,80,40,112,219,109,183,225,232,209,163,41,137,25,90,173,86,100, +100,100,0,0,99,198,240,225,247,251,7,157,249,28,61,122,148,77,153,243,222, +7,180,227,142,167,190,82,105,231,229,151,95,198,242,229,203,81,82,82,146, +240,121,199,140,25,131,123,238,185,135,241,198,11,11,11,81,94,94,46,152, +128,37,219,208,161,82,82,45,22,11,222,127,255,125,68,34,17,140,24,49,2, +175,188,242,10,206,157,59,135,11,23,46,244,218,229,74,165,82,108,216,176, +129,149,225,18,49,183,50,50,50,4,44,19,163,209,200,202,93,196,74,163,76, +134,47,147,241,55,142,205,102,195,137,19,39,250,28,12,4,128,206,206,78, +156,63,127,190,87,134,59,126,252,120,40,20,10,116,118,118,178,155,146,7, +62,202,86,6,122,163,242,138,214,84,10,35,38,26,129,12,101,89,60,176,116, +116,116,64,171,213,34,39,39,7,93,93,93,232,238,238,134,199,227,65,118,118, +54,90,91,91,251,204,188,230,205,155,135,255,254,239,255,198,139,47,190, +200,128,61,22,139,161,169,169,9,18,137,68,48,55,67,160,66,215,182,215,235, +21,251,40,67,140,180,180,180,175,36,211,203,207,207,71,126,126,62,206,156, +57,195,40,233,124,102,50,156,222,79,3,137,104,52,138,174,174,46,230,221, +195,175,155,52,88,59,100,64,1,128,204,204,76,182,51,235,47,246,237,219, +135,27,110,184,161,79,170,176,201,100,194,220,185,115,241,200,35,143,160, +174,174,14,231,207,159,199,109,183,221,134,147,39,79,178,5,140,95,16,164, +82,41,86,172,88,1,187,221,158,146,196,138,90,173,102,114,36,60,251,129, +31,136,163,133,81,42,149,226,133,23,94,64,119,119,55,118,238,220,153,210, +115,183,180,180,176,197,134,31,196,211,104,52,189,40,177,212,103,120,250, +233,167,241,254,251,239,163,180,180,20,179,103,207,70,105,105,41,67,254, +188,188,60,140,27,55,14,247,220,115,15,76,38,19,182,109,219,134,96,48,136, +204,204,76,65,211,154,24,93,3,145,76,233,171,204,181,106,213,42,70,159, +125,254,249,231,225,247,251,113,242,228,201,94,23,177,82,169,196,135,31, +126,216,75,46,133,202,93,124,159,68,163,209,176,178,156,78,167,99,172,52, +106,198,243,141,119,170,249,199,98,49,236,221,187,151,157,211,193,68,77, +77,13,106,106,106,32,147,201,80,92,92,12,149,74,197,152,137,244,186,196, +16,27,44,176,196,27,178,209,53,74,160,74,37,47,42,69,169,84,42,198,190, +34,215,207,198,198,70,44,95,190,28,239,190,251,110,159,175,211,216,216, +136,226,226,98,156,63,127,30,6,131,1,225,112,24,42,149,10,221,221,221,48, +24,12,236,51,227,153,105,212,255,17,99,232,65,215,197,154,53,107,82,22, +104,76,53,12,6,3,166,79,159,14,153,76,134,186,186,186,94,96,194,15,25,70, +34,145,164,51,128,151,179,228,69,190,61,188,188,19,191,121,164,141,212, +160,1,37,45,45,13,221,221,221,88,178,100,9,54,108,216,208,239,31,46,88, +176,0,47,189,244,18,190,243,157,239,244,186,41,167,76,153,130,80,40,132, +71,30,121,4,37,37,37,216,181,107,23,83,98,157,54,109,26,206,157,59,39,152, +0,167,90,253,157,119,222,137,242,242,242,148,6,126,198,141,27,135,95,254, +242,151,112,56,28,216,189,123,55,203,32,120,42,42,95,43,109,109,109,69, +110,110,110,74,39,37,47,47,15,255,254,239,255,142,223,252,230,55,40,41, +41,233,53,31,66,58,56,84,222,161,137,111,171,213,138,135,30,122,8,103,206, +156,65,117,117,53,174,190,250,106,140,28,57,18,57,57,57,184,233,166,155, +96,48,24,80,89,89,137,3,7,14,48,208,38,193,54,126,38,67,165,82,161,174, +174,14,83,167,78,133,223,239,135,195,225,16,148,97,18,245,62,226,1,98,211, +166,77,108,119,123,211,77,55,97,218,180,105,216,188,121,115,175,57,21,153, +76,134,125,251,246,33,22,139,177,247,193,79,230,210,251,164,1,42,189,94, +207,192,132,122,62,116,110,40,91,163,44,7,184,68,107,78,69,208,50,213,136, +68,34,40,47,47,135,82,169,68,81,81,17,58,59,59,89,70,68,96,79,139,254,64, +202,96,137,22,157,68,192,66,55,154,82,169,132,215,235,101,148,94,158,203, +223,214,214,134,252,252,252,164,196,150,41,83,166,224,245,215,95,199,95, +255,250,87,52,52,52,48,229,137,68,215,62,239,176,199,207,218,136,145,56, +254,235,191,254,139,81,190,221,110,55,252,126,63,251,114,187,221,168,173, +173,133,76,38,131,195,225,128,86,171,197,141,55,222,200,250,123,188,230, +91,252,52,60,173,111,68,213,229,149,124,123,122,122,224,243,249,224,114, +185,24,45,152,39,125,240,64,66,107,158,90,173,134,205,102,195,29,119,220, +193,178,38,162,181,211,162,207,63,15,29,3,173,107,137,196,32,121,33,213, +190,174,107,159,207,199,230,174,248,202,11,145,81,122,122,122,6,157,9,51, +64,33,47,249,162,162,162,148,0,101,242,228,201,216,186,117,43,182,108,217, +130,217,179,103,67,42,149,66,163,209,192,98,177,160,182,182,22,187,119, +239,70,73,73,9,182,110,221,42,72,247,151,44,89,130,230,230,102,193,228, +52,205,181,228,230,230,226,47,127,249,75,191,175,61,125,250,116,252,234, +87,191,66,99,99,35,110,186,233,38,28,61,122,20,61,61,61,2,137,18,42,185, +80,175,166,161,161,129,205,110,244,123,82,100,50,76,155,54,13,183,220,114, +11,142,31,63,14,153,76,198,122,6,84,222,225,117,116,8,4,218,219,219,33, +149,74,49,98,196,8,44,93,186,148,201,239,183,180,180,224,204,153,51,108, +26,58,126,177,40,42,42,66,67,67,3,99,125,208,197,208,211,211,195,152,95, +61,61,61,176,90,173,184,250,234,171,241,135,63,252,161,223,197,176,190, +190,30,209,104,20,10,133,2,207,61,247,28,206,158,61,155,80,91,168,187,187, +27,109,109,109,2,251,82,190,255,193,131,9,49,208,40,51,33,118,90,252,140, +9,69,95,18,46,195,17,193,96,16,229,229,229,152,58,117,42,154,154,154,160, +86,171,217,192,150,86,171,101,13,246,161,128,74,95,192,194,103,193,129, +64,160,151,0,102,119,119,55,174,187,238,186,164,128,210,218,218,138,177, +99,199,194,110,183,35,22,139,37,44,111,242,141,82,49,59,73,61,102,204,152, +1,167,211,137,246,246,118,180,183,183,51,151,88,187,221,14,183,219,13,173, +86,203,166,219,29,14,7,219,16,16,160,80,31,203,227,241,48,214,31,45,246, +252,32,50,191,121,77,150,245,242,162,141,116,143,100,100,100,176,251,139, +255,188,67,161,16,220,110,55,243,213,241,251,253,240,122,189,108,115,72, +242,46,188,232,35,63,203,21,79,179,143,7,24,126,118,44,28,14,51,198,25, +253,155,230,184,6,187,113,145,241,55,142,74,165,66,87,87,23,166,79,159, +142,99,199,142,37,253,195,198,198,70,76,155,54,13,55,223,124,51,10,11,11, +153,47,183,203,229,194,169,83,167,88,51,120,230,204,153,130,27,203,231, +243,33,39,39,7,62,159,143,237,38,213,106,53,10,11,11,225,243,249,152,103, +69,95,81,88,88,136,135,31,126,24,14,135,3,235,214,173,131,219,237,198,157, +119,222,137,13,27,54,8,230,36,248,70,178,68,34,193,197,139,23,83,202,80, +114,115,115,49,125,250,116,156,56,113,2,237,237,237,88,186,116,41,14,29, +58,196,22,118,42,247,240,77,232,244,244,116,182,120,101,102,102,162,161, +161,1,7,14,28,72,249,67,24,53,106,20,155,148,230,245,168,168,1,75,246,200, +100,215,153,44,140,70,35,86,173,90,197,202,37,183,222,122,43,172,86,107, +66,226,132,74,165,194,230,205,155,123,185,98,210,185,35,224,228,193,132, +0,133,126,199,43,161,242,55,214,154,53,107,82,158,218,31,74,156,56,113, +2,99,198,140,65,75,75,139,96,177,8,135,195,208,106,181,108,49,30,42,229, +54,30,88,120,10,180,199,227,97,228,3,169,84,10,135,195,129,236,236,236, +148,178,252,255,247,255,254,31,158,120,226,9,236,219,183,175,215,206,50, +222,3,67,140,20,23,53,174,108,75,27,29,141,70,35,80,73,160,221,126,188, +143,8,101,36,100,35,77,85,1,218,185,243,253,95,62,67,72,164,49,23,191,200, +211,241,80,70,175,211,233,216,102,140,178,207,96,48,152,208,104,78,161, +80,176,65,220,100,199,240,181,159,251,248,102,85,56,28,198,194,133,11,251, +5,20,224,146,206,87,93,93,29,198,141,27,135,138,138,10,120,189,94,230,47, +146,155,155,139,93,187,118,225,129,7,30,16,0,138,199,227,193,210,165,75, +177,109,219,54,193,201,213,106,181,253,214,216,175,186,234,42,44,94,188, +24,153,153,153,120,251,237,183,89,99,183,176,176,16,59,119,238,100,96,66, +139,60,95,70,74,75,75,195,151,95,126,9,157,78,215,103,163,62,61,61,29,110, +183,155,13,0,82,38,118,242,228,73,214,116,38,48,209,233,116,12,96,136,193, +20,137,68,6,149,38,90,44,22,1,152,240,169,103,79,79,15,164,82,41,98,177, +24,180,90,45,155,152,239,43,28,14,7,251,12,100,50,25,126,246,179,159,161, +178,178,178,151,239,11,73,183,243,32,192,247,16,120,249,23,2,17,254,59, +205,153,208,108,10,127,51,109,223,190,253,43,1,19,138,134,134,6,168,84, +42,116,116,116,32,16,8,176,154,53,101,120,116,140,195,193,170,137,31,204, +164,157,174,215,235,21,148,30,162,209,104,191,178,44,118,187,29,6,131,1, +239,190,251,46,124,62,31,3,192,68,11,164,24,169,135,90,173,134,215,235, +21,44,220,68,116,160,74,73,36,18,233,213,51,228,123,12,60,9,131,31,126, +229,215,74,126,66,61,81,137,41,94,253,129,151,143,167,114,57,221,71,180, +241,241,249,124,2,221,45,202,40,248,53,129,39,20,240,215,70,50,123,135, +248,99,225,133,90,233,103,180,33,226,61,136,134,4,40,244,65,56,157,78,76, +152,48,1,231,206,157,75,250,199,62,159,15,199,143,31,199,93,119,221,133, +139,23,47,246,106,252,172,88,177,2,239,191,255,62,102,207,158,45,120,46, +191,223,15,163,209,136,88,44,38,40,23,245,231,110,118,225,194,5,76,152, +48,1,159,125,246,153,160,143,224,112,56,144,151,151,7,143,199,131,140,140, +12,214,60,231,37,157,211,210,210,80,94,94,142,197,139,23,51,135,200,248, +204,196,104,52,98,245,234,213,152,52,105,18,198,140,25,195,118,241,241, +114,209,36,183,161,215,235,97,52,26,217,69,33,145,72,6,37,178,70,141,228, +120,193,194,96,48,200,84,103,129,75,252,112,26,124,75,20,58,157,78,208, +12,190,238,186,235,144,155,155,155,144,49,167,86,171,89,153,45,62,59,161, +11,157,102,77,52,26,77,47,48,161,175,248,69,186,171,171,139,177,176,190, +202,136,197,98,104,111,111,103,106,194,241,190,40,180,123,27,46,170,38, +129,10,1,74,252,188,139,195,225,192,248,241,227,147,2,74,56,28,198,252, +249,243,177,110,221,58,168,84,42,182,88,244,213,67,225,77,195,196,232,59, +168,20,77,247,46,245,34,164,82,41,3,9,254,186,80,42,149,236,62,224,55,116, +193,96,144,13,183,242,139,121,178,12,50,30,100,120,226,17,127,223,208,70, +135,54,59,180,9,161,249,35,162,238,43,20,10,193,49,36,90,35,147,101,178, +60,192,240,224,201,151,179,105,173,164,30,104,90,90,26,52,26,205,208,1, +133,62,136,142,142,14,44,89,178,164,95,64,241,120,60,152,57,115,38,124, +62,95,194,223,103,100,100,192,227,241,160,160,160,64,240,92,46,151,11,243, +231,207,71,73,73,9,59,225,46,151,11,85,85,85,44,237,228,227,154,107,174, +193,132,9,19,112,250,244,105,188,253,246,219,189,6,111,194,225,48,110,184, +225,6,236,221,187,87,96,62,195,239,0,232,132,183,182,182,226,182,219,110, +99,165,35,181,90,13,139,197,130,133,11,23,2,184,68,89,61,122,244,40,230, +207,159,143,234,234,106,216,237,118,86,190,224,47,6,2,19,106,74,211,5,64, +140,157,129,200,251,211,0,29,93,196,36,251,193,179,135,200,157,50,217,160, +35,45,56,116,129,174,88,177,2,54,155,173,87,31,163,175,236,132,250,79,4, +200,148,157,80,35,158,63,167,137,192,4,192,215,102,130,22,12,6,97,54,155, +209,216,216,200,36,84,232,125,241,142,119,195,233,140,200,131,72,124,201, +33,45,45,13,227,199,143,239,151,173,103,181,90,177,120,241,98,68,34,17, +86,51,143,87,181,165,207,150,22,52,113,184,49,181,123,138,38,193,249,217, +15,82,30,224,63,39,133,66,193,192,133,74,94,212,20,143,70,163,140,17,69, +96,78,207,151,104,17,167,235,141,250,183,244,252,68,20,137,87,146,224,251, +142,225,112,88,192,32,165,126,96,32,16,72,120,12,169,102,17,137,142,137, +142,135,238,107,218,56,146,84,210,96,55,94,189,114,105,234,248,219,237, +246,148,122,41,70,163,17,31,124,240,1,150,45,91,214,171,233,27,137,68,112, +203,45,183,224,131,15,62,192,140,25,51,4,160,210,221,221,45,168,107,75, +36,18,156,57,115,6,183,220,114,11,170,171,171,1,92,162,30,155,205,102,220, +122,235,173,200,207,207,135,66,161,192,234,213,171,241,235,95,255,186,151, +189,166,209,104,100,31,6,207,194,162,172,130,118,33,11,23,46,68,81,81,17, +187,112,252,126,63,156,78,39,78,157,58,133,150,150,22,44,89,178,4,47,188, +240,2,203,80,194,225,48,174,189,246,90,84,86,86,10,104,180,148,50,18,192, +80,38,228,118,187,49,101,202,148,164,243,57,125,237,86,137,138,202,239, +136,104,138,219,106,181,2,64,159,115,66,10,133,2,123,246,236,17,12,140, +222,117,215,93,9,231,97,50,50,50,208,218,218,138,180,180,52,214,104,164, +191,225,101,177,9,56,233,98,35,137,236,190,192,132,0,249,235,10,189,94, +143,227,199,143,179,13,9,245,159,248,137,125,137,68,50,236,18,38,241,253, +35,106,234,166,50,113,108,179,217,176,108,217,50,152,76,38,200,229,114, +88,44,22,56,157,78,212,215,215,163,166,166,134,129,35,125,5,2,1,216,237, +118,81,206,190,159,32,34,11,237,232,211,210,210,24,211,139,154,206,188, +215,14,129,10,245,46,249,243,77,158,57,244,251,190,34,126,67,65,95,188, +7,16,111,136,197,187,155,146,40,104,122,122,58,203,82,8,252,72,176,52,149, +99,72,229,184,8,224,100,50,25,91,43,121,165,139,161,204,57,201,18,149,77, +104,122,121,214,172,89,253,2,10,149,170,178,178,178,18,178,136,228,114, +57,92,46,23,198,143,31,223,11,80,166,76,153,130,147,39,79,10,24,5,110,183, +27,115,230,204,129,70,163,193,196,137,19,49,97,194,4,248,124,62,236,218, +181,11,129,64,0,115,230,204,65,117,117,53,44,22,139,160,236,213,214,214, +134,226,226,98,212,215,215,51,132,229,53,178,168,121,236,245,122,113,246, +236,217,164,59,233,25,51,102,224,212,169,83,172,118,105,48,24,4,3,116,180, +72,209,7,195,47,88,225,112,56,101,122,50,31,126,191,159,253,61,159,106, +243,37,57,151,203,213,103,83,222,106,181,194,227,241,64,169,84,162,167, +167,7,115,231,206,101,231,37,209,34,70,187,49,158,126,72,239,135,64,153, +192,152,223,185,36,3,147,175,59,98,177,24,19,203,140,247,127,224,167,247, +7,203,177,239,111,23,72,64,165,209,104,224,245,122,83,46,27,240,76,72,138, +201,147,39,163,184,184,24,35,71,142,68,109,109,45,66,161,16,124,62,31,43, +223,138,66,145,253,135,217,108,102,25,59,17,118,136,177,197,83,177,169, +2,192,111,8,248,242,51,1,19,149,81,251,90,208,121,35,56,2,41,126,163,198, +179,79,249,217,41,190,194,16,8,4,216,58,160,82,169,24,152,208,177,196,59, +70,198,3,70,50,64,225,13,252,168,63,67,101,65,250,78,106,225,195,6,40,252, +252,65,123,123,59,22,44,88,192,24,40,125,69,81,81,17,246,236,217,131,113, +227,198,37,164,197,46,90,180,8,159,126,250,41,102,206,156,41,240,10,160, +55,202,251,85,200,100,50,204,153,51,7,153,153,153,240,122,189,40,45,45, +69,93,93,29,75,241,169,135,242,232,163,143,246,186,17,243,243,243,113,241, +226,69,65,179,141,79,29,169,180,54,126,252,248,164,239,103,214,172,89,216, +183,111,31,230,205,155,135,210,210,82,70,171,229,41,120,116,33,82,109,146, +62,4,250,25,45,42,3,41,217,208,142,40,61,61,93,208,88,78,75,75,67,110,110, +110,66,229,103,138,214,214,86,40,20,10,118,193,21,23,23,195,102,179,245, +106,142,235,116,58,28,62,124,152,189,23,122,126,2,20,190,89,72,160,194, +155,247,92,201,178,31,164,81,68,159,63,221,180,25,25,25,108,49,166,89,155, +203,241,62,104,163,49,28,242,40,85,85,85,236,94,41,46,46,70,118,118,54, +163,183,82,41,172,167,167,71,204,84,250,137,172,172,44,116,117,117,9,26, +236,241,141,237,120,217,119,30,116,40,155,33,58,113,42,25,74,188,204,60, +101,33,60,168,244,229,111,227,116,58,25,179,76,165,82,177,242,27,63,143, +50,152,62,26,47,127,207,247,118,248,254,142,193,96,24,242,117,155,144,62, +194,47,28,185,185,185,208,106,181,73,165,50,236,118,59,142,29,59,134,27, +110,184,1,181,181,181,9,159,175,169,169,9,247,222,123,175,0,80,154,155, +155,49,97,194,4,54,1,77,0,112,232,208,33,140,29,59,150,61,23,95,47,14,4, +2,24,57,114,36,130,193,160,64,135,137,26,161,137,212,106,137,237,69,139, +73,122,122,58,164,82,105,159,31,140,94,175,71,101,101,37,30,126,248,97, +148,150,150,34,24,12,98,226,196,137,2,106,47,125,208,241,190,21,209,104, +20,78,167,19,147,39,79,30,80,217,139,178,18,210,214,33,48,9,133,66,76,30, +189,47,205,52,165,82,201,12,176,40,219,43,44,44,76,40,165,223,222,222,46, +232,83,197,131,9,159,213,241,131,130,124,243,240,74,13,175,215,11,151,203, +197,118,128,110,183,27,58,157,14,30,143,7,26,141,6,185,185,185,236,134, +188,28,89,10,93,3,84,166,28,174,32,34,198,236,217,179,123,57,78,70,163, +81,100,102,102,138,61,149,126,50,21,224,18,137,136,74,94,137,202,65,241, +27,97,146,193,225,103,129,232,241,137,230,52,120,127,17,158,246,203,103, +72,252,208,111,95,165,58,202,146,92,46,151,192,106,129,63,134,129,206,137, +36,58,54,202,144,134,211,188,77,214,215,155,162,122,99,87,87,23,150,45, +91,134,127,252,227,31,73,235,255,215,95,127,61,78,157,58,197,40,112,241, +191,95,177,98,5,254,246,183,191,97,238,220,185,130,210,23,81,250,232,164, +69,163,81,52,54,54,98,241,226,197,9,193,9,184,212,164,255,228,147,79,176, +98,197,10,129,15,75,119,119,55,138,138,138,152,189,102,252,133,67,64,105, +183,219,145,147,147,211,139,153,198,47,238,121,121,121,168,171,171,99,153, +134,94,175,71,67,67,3,227,178,211,177,82,58,76,108,31,250,251,129,148,189, +168,110,203,75,167,211,110,100,242,228,201,24,59,118,44,142,31,63,222,103, +67,222,98,177,176,18,30,165,179,211,166,77,235,197,238,146,201,100,168, +170,170,66,90,90,154,224,130,228,75,118,241,61,168,120,182,92,42,205,208, +175,146,50,204,71,109,109,45,147,66,9,4,2,240,249,124,240,120,60,208,233, +116,72,75,75,131,197,98,193,193,131,7,49,106,212,40,100,101,101,13,107, +131,62,254,60,95,14,176,106,105,105,129,209,104,100,217,172,78,167,99,77, +122,163,209,40,138,70,246,19,180,97,26,104,25,149,170,39,169,92,215,180, +145,160,12,96,176,215,151,92,46,103,64,152,232,24,6,51,120,72,235,19,101, +72,151,229,218,79,118,98,52,26,13,124,62,31,218,218,218,80,84,84,148,84, +66,163,167,167,7,171,86,173,194,239,127,255,251,132,11,117,44,22,131,207, +231,195,196,137,19,5,128,66,55,9,201,116,135,66,33,166,131,99,48,24,18, +246,101,104,177,165,122,31,159,165,232,245,122,65,253,147,103,202,16,189, +206,110,183,35,47,47,175,79,64,1,46,25,225,236,219,183,15,55,221,116,19, +246,237,219,199,154,115,188,101,44,101,17,252,206,133,74,97,110,183,187, +87,159,39,89,80,58,77,207,87,92,92,140,239,126,247,187,72,79,79,135,205, +102,195,231,159,127,222,239,133,66,223,45,22,11,210,211,211,123,53,200, +73,72,147,167,25,242,77,107,154,59,225,233,194,188,242,112,42,125,160,41, +83,166,164,36,236,121,57,98,251,246,237,44,171,227,231,7,168,140,25,139, +197,240,250,235,175,227,225,135,31,102,59,193,225,102,126,241,207,57,220, +65,146,25,122,189,94,80,186,161,251,203,98,177,136,153,202,101,42,99,82, +79,246,219,122,12,41,151,214,250,250,133,201,100,98,172,4,153,76,198,230, +52,250,10,151,203,133,5,11,22,96,229,202,149,2,143,16,254,164,44,95,190, +28,111,188,241,6,242,243,243,25,10,43,149,74,180,183,183,247,226,120,159, +56,113,2,147,38,77,234,115,71,191,112,225,66,124,250,233,167,152,49,99, +134,224,119,77,77,77,200,200,200,96,160,194,239,250,169,110,234,245,122, +145,149,149,213,111,154,124,250,244,105,38,30,215,218,218,138,140,140,12, +246,92,212,171,32,32,32,112,225,203,111,83,166,76,25,208,142,100,193,130, +5,120,226,137,39,240,206,59,239,224,225,135,31,70,107,107,43,222,126,251, +109,188,245,214,91,73,141,155,248,97,199,180,180,52,152,205,102,214,143, +225,163,163,163,67,96,72,21,63,200,72,59,23,222,3,126,32,50,219,177,88, +12,217,217,217,9,63,255,203,29,85,85,85,104,107,107,19,204,243,80,217,226, +246,219,111,7,0,60,249,228,147,112,187,221,184,120,241,162,192,153,145, +247,28,25,174,5,224,114,152,97,73,165,82,116,116,116,160,171,171,11,93, +93,93,112,56,28,112,58,157,240,120,60,240,122,189,253,14,189,138,33,198, +229,14,89,178,155,130,178,20,242,127,184,254,250,235,251,244,232,200,200, +200,64,85,85,21,78,158,60,9,173,86,139,69,139,22,245,98,36,209,162,123, +234,212,41,140,24,49,2,173,173,173,168,168,168,232,53,33,44,145,72,152, +249,75,95,189,14,149,74,133,230,230,230,94,18,23,225,112,24,19,38,76,192, +201,147,39,5,190,225,60,183,95,42,149,162,165,165,37,105,6,17,8,4,80,80, +80,128,154,154,26,232,245,122,116,119,119,179,236,129,183,135,37,29,28, +30,12,137,57,213,210,210,210,239,180,180,66,161,128,78,167,99,51,56,103, +207,158,197,193,131,7,113,250,244,233,148,179,155,218,218,90,193,160,22, +49,194,226,23,123,178,109,38,49,59,170,239,242,10,3,52,127,194,243,209, +7,82,74,9,4,2,40,42,42,250,74,179,20,175,215,139,55,222,120,67,80,110,141, +197,98,144,201,100,248,209,143,126,4,157,78,135,23,94,120,129,41,99,55, +55,55,51,97,71,146,82,225,141,186,134,35,99,145,72,36,195,190,192,19,157, +159,7,63,94,25,250,114,49,216,196,16,99,200,128,66,187,116,42,241,104,181, +90,92,188,120,17,197,197,197,104,110,110,70,119,119,55,162,209,40,107,224, +30,56,112,0,53,53,53,80,42,149,56,118,236,24,218,219,219,113,255,253,247, +11,118,201,18,137,4,43,86,172,192,235,175,191,206,20,86,105,17,224,41,119, +68,241,173,170,170,18,52,231,227,23,174,197,139,23,99,203,150,45,152,60, +121,178,160,217,207,151,59,104,241,167,18,21,213,14,253,126,63,174,189, +246,90,108,220,184,177,207,247,95,88,88,136,207,63,255,28,11,22,44,128, +82,169,24,161,141,172,0,0,32,0,73,68,65,84,196,145,35,71,88,207,135,192, +49,126,87,75,165,36,98,121,40,149,202,132,165,59,154,178,190,235,174,187, +208,214,214,134,181,107,215,226,220,185,115,3,22,83,164,12,143,142,71,42, +149,194,96,48,244,242,154,55,26,141,8,133,66,172,127,194,203,48,240,220, +116,98,197,241,18,35,169,102,39,60,168,247,87,34,29,174,8,4,2,248,197,47, +126,193,206,55,149,30,85,42,21,30,127,252,113,152,205,102,252,238,119,191, +195,145,35,71,216,223,120,60,30,248,253,126,230,202,72,172,47,210,75,162, +18,224,80,65,101,40,114,253,241,155,14,171,213,138,29,59,118,32,61,61,157, +41,76,240,179,80,228,109,49,92,222,224,98,136,49,172,37,47,254,98,230,167, +195,105,1,37,25,245,19,39,78,96,203,150,45,232,236,236,100,162,129,233, +233,233,112,185,92,120,227,141,55,208,220,220,204,22,43,133,66,1,135,195, +1,133,66,193,192,132,247,207,160,233,77,186,193,73,6,188,175,176,90,173, +248,242,203,47,81,80,80,192,126,150,147,147,195,76,188,136,234,199,75,112, +16,203,33,149,6,91,122,122,58,26,27,27,25,93,55,145,23,57,255,51,122,12, +209,5,105,129,74,75,75,131,213,106,101,94,34,129,64,0,127,255,251,223,49, +111,222,60,84,85,85,225,205,55,223,100,90,104,3,13,181,90,45,240,53,160, +108,49,94,162,129,192,134,64,155,168,146,124,137,43,222,215,100,160,205, +101,94,112,207,233,116,34,47,47,111,88,217,78,241,209,220,220,140,159,253, +236,103,136,197,98,236,58,85,42,149,48,153,76,248,207,255,252,79,76,152, +48,1,175,190,250,170,0,76,168,68,216,221,221,141,238,238,110,56,157,78, +102,65,77,90,116,137,202,133,131,137,47,191,252,50,233,239,173,86,43,219, +136,145,99,165,82,169,132,197,98,129,197,98,97,52,206,238,238,110,216,237, +118,184,92,46,120,60,30,4,2,1,184,92,46,230,98,73,4,26,94,60,80,12,49,174, +184,12,5,0,51,0,34,230,12,129,10,95,230,145,201,100,108,199,23,31,135,15, +31,238,101,137,170,209,104,4,131,130,36,65,64,128,66,95,74,165,18,93,93, +93,172,228,20,31,126,191,31,133,133,133,120,239,189,247,144,147,147,3,149, +74,133,237,219,183,51,174,126,162,197,142,231,138,59,157,78,140,29,59,182, +151,59,32,69,48,24,196,140,25,51,80,86,86,150,80,13,152,151,194,224,235, +220,244,26,209,104,20,233,233,233,240,251,253,104,107,107,67,71,71,7,90, +90,90,152,253,230,232,209,163,241,246,219,111,15,153,21,69,165,69,234,137, +16,144,198,47,162,52,25,79,89,20,159,157,16,168,144,235,98,178,82,87,71, +71,71,175,30,20,15,168,4,88,29,29,29,8,6,131,176,90,173,104,107,107,27, +182,134,113,36,18,193,250,245,235,241,249,231,159,179,107,133,192,36,47, +47,15,43,87,174,132,217,108,198,75,47,189,132,253,251,247,247,190,232,255, +111,30,137,151,100,33,206,63,17,44,72,40,117,40,229,163,100,242,245,192, +165,161,211,79,63,253,20,78,167,19,181,181,181,2,151,199,236,236,108,228, +230,230,98,202,148,41,144,72,36,88,183,110,29,244,122,61,182,109,219,198, +20,21,2,129,128,128,28,18,95,122,21,67,140,43,14,80,8,84,120,9,136,120, +213,75,222,59,35,254,130,230,23,145,120,97,181,120,19,39,190,126,79,11, +92,83,83,19,10,10,10,88,214,17,31,215,92,115,13,86,174,92,9,181,90,141, +83,167,78,49,191,0,122,93,30,64,232,59,189,118,87,87,23,198,143,31,223, +39,160,0,151,134,202,202,202,202,122,249,44,243,178,212,188,146,167,84, +42,101,146,9,188,32,156,86,171,133,215,235,133,209,104,100,55,254,134,13, +27,208,209,209,49,44,101,31,42,243,0,232,213,147,34,225,68,2,17,190,92, +70,231,159,38,101,169,22,159,140,169,244,231,63,255,25,15,61,244,16,38, +78,156,216,43,11,226,207,59,205,100,84,84,84,64,161,80,96,244,232,209,2, +230,213,64,34,22,139,193,237,118,99,237,218,181,216,189,123,55,59,183,74, +165,146,49,210,230,205,155,135,63,254,241,143,144,203,229,248,229,47,127, +217,39,237,156,47,65,82,89,146,159,55,224,63,203,193,2,74,42,246,205,62, +159,15,22,139,5,37,37,37,144,72,36,2,66,131,84,42,69,91,91,27,182,108,217, +2,143,199,131,72,36,34,32,133,208,189,72,244,117,58,167,116,109,137,108, +47,49,174,88,64,33,97,66,94,197,149,82,107,146,51,161,12,134,79,185,227, +47,234,120,64,161,44,133,164,61,120,155,217,244,244,116,230,98,166,215, +235,251,108,206,199,98,49,164,167,167,227,200,145,35,76,47,135,111,84,198, +155,219,240,214,195,192,37,169,23,163,209,8,135,195,145,176,220,71,195, +146,241,160,65,128,194,235,1,209,34,71,211,230,118,187,157,73,168,211,78, +146,206,95,90,90,26,54,111,222,140,155,111,190,121,192,186,95,124,144,120, +29,9,83,146,147,32,159,161,208,176,36,127,14,149,74,37,211,25,138,47,61, +82,83,186,175,69,233,166,155,110,194,51,207,60,131,103,158,121,6,179,102, +205,98,11,25,45,116,192,63,53,131,72,214,161,171,171,11,181,181,181,8,4, +2,152,48,97,2,114,114,114,216,68,112,95,175,19,141,70,225,247,251,81,81, +81,129,207,63,255,28,14,135,3,82,169,20,90,173,86,96,203,108,48,24,240, +228,147,79,226,123,223,251,30,108,54,27,94,120,225,5,150,81,38,138,172, +172,44,193,231,77,146,28,116,94,136,16,162,82,169,6,189,56,247,103,82,103, +177,88,16,14,135,209,212,212,196,50,204,254,202,108,148,165,211,253,199, +11,72,138,153,137,24,255,50,128,66,187,58,94,211,134,215,179,34,13,24,94, +13,147,7,14,158,43,207,171,165,146,156,52,175,31,69,207,69,77,209,158,158, +30,156,57,115,6,185,185,185,189,216,82,74,165,18,141,141,141,172,134,78, +187,107,94,250,153,202,105,252,239,121,99,26,210,68,34,198,15,45,208,231, +207,159,199,137,19,39,224,118,187,217,194,197,151,233,120,103,72,202,208, +120,186,168,68,34,129,201,100,66,36,18,97,170,193,252,141,79,192,182,119, +239,94,204,157,59,55,169,172,74,178,112,185,92,200,204,204,68,103,103,167, +160,95,17,159,137,240,229,48,222,113,142,122,41,116,142,232,125,37,107, +198,95,119,221,117,0,128,63,253,233,79,88,180,104,17,126,248,195,31,178, +97,187,248,247,72,160,69,108,193,72,36,130,19,39,78,160,164,164,4,110,183, +27,129,64,0,99,198,140,65,86,86,22,235,77,217,108,54,28,63,126,188,23,161, +131,228,115,232,220,145,49,219,75,47,189,132,209,163,71,99,227,198,141, +120,251,237,183,251,93,92,105,22,137,178,58,254,122,230,155,243,244,53, +208,44,197,229,114,37,85,133,166,44,104,209,162,69,253,62,46,190,108,217, +23,240,242,223,197,16,227,138,7,20,224,159,98,107,124,89,128,36,46,104, +230,131,134,255,232,198,229,203,33,241,211,157,180,144,17,168,208,206,158, +234,248,196,132,34,201,4,171,213,138,64,32,192,102,9,206,157,59,7,159,207, +7,181,90,45,176,0,230,181,114,120,9,123,50,221,34,58,50,45,24,196,4,107, +107,107,99,126,30,46,151,139,89,255,146,157,44,45,186,164,94,204,255,140, +22,185,120,199,61,147,201,196,128,145,202,18,252,48,161,207,231,67,69,69, +5,242,242,242,224,243,249,4,84,97,185,92,142,172,172,44,52,55,55,99,241, +226,197,216,187,119,111,194,89,137,188,188,60,180,181,181,177,207,38,190, +185,207,103,27,188,156,59,29,63,15,152,252,87,95,161,209,104,88,95,100, +231,206,157,56,125,250,52,158,124,242,73,100,101,101,161,187,187,91,224, +87,77,195,88,244,51,254,218,144,203,229,240,122,189,104,107,107,67,93,93, +29,187,134,194,225,48,147,125,225,23,96,58,39,50,153,12,102,179,25,143, +60,242,8,238,187,239,62,216,237,118,252,234,87,191,234,215,237,19,184,52, +248,218,209,209,1,191,223,207,20,104,53,26,13,59,31,26,141,70,160,218,48, +152,120,255,253,247,83,234,3,77,158,60,185,151,106,118,178,72,36,69,196, +151,117,175,4,199,62,49,68,64,25,80,100,101,101,9,68,207,120,202,34,47, +243,204,47,4,180,144,198,151,203,168,100,196,3,10,1,12,237,10,121,115,161, +64,32,0,135,195,1,187,221,206,244,153,226,235,198,212,160,37,71,69,170, +175,147,241,22,61,55,101,27,4,44,100,34,69,165,27,122,62,158,239,79,254, +1,241,125,30,250,157,94,175,79,88,46,52,26,141,189,234,243,116,44,227,199, +143,71,107,107,43,108,54,27,28,14,7,12,6,3,43,233,24,12,6,228,230,230,98, +211,166,77,144,203,229,24,55,110,92,66,249,250,177,99,199,10,136,15,78, +167,83,176,171,142,47,95,145,226,40,157,123,162,9,243,217,91,127,101,158, +251,239,191,31,175,188,242,10,128,75,195,164,207,60,243,12,198,143,31,143, +159,254,244,167,208,235,245,176,217,108,2,240,32,144,231,55,36,244,250, +30,143,71,160,97,70,153,76,162,93,189,197,98,193,237,183,223,142,239,127, +255,251,144,203,229,88,183,110,29,62,250,232,163,94,142,148,125,69,97,97, +33,26,26,26,216,113,17,141,156,192,100,168,38,86,85,85,85,41,101,29,212, +147,116,56,28,41,149,212,168,159,216,215,192,164,216,51,17,227,95,18,80, +40,83,161,236,132,118,160,188,88,93,95,59,50,42,69,208,98,65,139,23,191, +40,243,11,27,61,150,254,77,62,225,180,232,208,226,72,128,66,101,46,181, +90,13,163,209,40,176,175,229,51,21,18,69,163,5,143,168,183,252,204,10,129, +1,185,187,197,219,226,210,23,61,111,50,251,77,185,92,142,204,204,76,86, +94,226,203,113,51,103,206,68,75,75,11,22,44,88,208,203,237,177,171,171, +11,205,205,205,120,244,209,71,241,198,27,111,96,249,242,229,9,1,133,36, +85,40,26,27,27,19,106,170,197,207,249,240,50,214,180,192,211,255,251,139, +226,226,226,94,63,171,169,169,193,147,79,62,137,220,220,92,60,248,224,131, +152,54,109,26,58,59,59,89,38,201,31,19,189,38,205,130,240,132,15,42,157, +209,231,163,84,42,81,88,88,136,101,203,150,97,214,172,89,8,135,195,40,41, +41,193,187,239,190,155,176,247,213,87,200,229,114,180,182,182,50,67,56, +2,93,42,5,242,210,224,131,141,79,63,253,180,223,199,88,44,22,76,153,50, +5,231,206,157,75,25,8,28,14,7,59,190,248,146,30,95,9,72,228,109,46,134, +24,87,52,160,80,79,133,154,203,137,20,49,249,50,5,175,144,25,95,246,138, +111,148,83,31,133,34,28,14,195,110,183,51,153,19,126,230,131,192,135,178, +35,126,174,34,35,35,67,224,54,72,222,239,42,149,138,149,161,104,209,166, +26,63,239,57,64,187,118,234,9,208,110,90,173,86,195,100,50,9,172,51,233, +57,251,91,204,178,178,178,4,189,39,181,90,141,88,44,134,243,231,207,179, +93,115,95,49,107,214,44,156,61,123,54,161,44,126,87,87,23,70,140,24,1,143, +199,3,224,146,162,112,60,160,240,62,13,252,28,10,245,13,8,76,82,45,155, +104,52,26,44,90,180,8,59,119,238,236,245,187,166,166,38,188,248,226,139, +0,46,41,228,222,124,243,205,152,59,119,46,60,30,15,106,107,107,209,220, +220,12,135,195,129,174,174,46,6,172,84,238,138,197,98,48,153,76,200,205, +205,197,152,49,99,48,110,220,56,76,158,60,25,0,80,95,95,143,183,222,122, +11,155,55,111,30,84,19,122,198,140,25,56,126,252,56,43,143,210,38,132,31, +80,29,202,130,252,218,107,175,165,36,223,162,82,169,176,112,225,194,132, +231,174,175,56,114,228,136,192,181,81,204,80,196,248,70,1,10,93,196,137, +20,49,19,165,247,84,182,162,210,23,191,163,74,38,235,44,151,203,97,50,153, +224,112,56,152,79,1,223,88,38,135,67,2,55,126,16,147,236,45,201,7,93,163, +209,244,154,34,142,255,63,95,58,163,231,230,203,54,52,156,72,32,69,229, +180,84,110,104,137,68,194,140,200,168,204,23,137,68,96,48,24,250,5,148, +194,194,66,108,220,184,17,119,223,125,183,64,97,153,64,119,233,210,165, +88,183,110,29,123,15,101,101,101,204,118,128,167,120,243,190,46,188,55, +8,149,0,83,201,80,104,206,101,197,138,21,253,46,138,252,28,210,164,73,147, +80,80,80,128,89,179,102,97,228,200,145,12,180,73,182,159,15,159,207,135, +198,198,70,52,54,54,98,231,206,157,56,116,232,80,202,101,173,68,81,84,84, +132,210,210,82,65,233,145,50,19,158,30,204,11,103,14,164,39,241,217,103, +159,165,220,96,143,197,98,108,54,41,149,235,70,38,147,225,200,145,35,108, +147,192,131,10,223,19,139,207,86,196,16,227,95,10,80,226,23,203,190,134, +225,134,170,144,41,151,203,89,115,156,7,34,162,120,210,144,33,245,39,40, +115,160,242,84,95,96,210,23,168,240,30,1,84,83,39,240,34,179,46,122,94, +106,246,15,38,187,235,236,236,100,101,188,254,34,24,12,194,237,118,99,212, +168,81,9,127,31,141,70,217,243,196,98,49,28,58,116,8,247,222,123,47,42, +43,43,225,114,185,4,59,111,42,185,81,47,133,22,165,129,82,100,53,26,13, +238,185,231,30,124,252,241,199,41,61,190,186,186,26,213,213,213,88,187, +118,173,224,231,148,241,209,34,59,220,113,245,213,87,163,178,178,82,0,72, +241,34,153,148,129,82,182,70,101,209,84,202,127,251,247,239,79,234,0,26, +127,206,182,108,217,130,171,175,190,58,229,115,221,208,208,32,32,117,36, +202,74,136,181,40,210,135,197,248,70,0,202,229,142,248,69,155,140,178,2, +129,0,235,207,240,83,207,188,173,37,185,145,37,11,30,84,104,215,76,70,70, +252,142,150,118,213,36,83,50,88,221,36,62,91,25,61,122,116,74,143,95,178, +100,9,118,239,222,141,236,236,108,193,84,53,112,105,70,225,214,91,111,197, +134,13,27,208,211,211,131,230,230,102,1,185,96,196,136,17,104,105,105,233, +181,8,209,57,227,203,93,169,46,116,209,104,20,179,102,205,194,150,45,91, +122,137,81,14,36,236,118,251,101,83,202,45,40,40,64,93,93,29,123,126,158, +18,205,207,65,81,198,72,160,194,15,173,38,139,131,7,15,98,219,182,109,41, +31,207,152,49,99,176,110,221,58,188,249,230,155,184,235,174,187,82,82,73, +248,236,179,207,18,210,241,105,243,67,159,35,159,169,136,33,198,215,17, +255,82,87,95,122,122,58,50,51,51,161,215,235,97,52,26,97,48,24,96,54,155, +97,54,155,145,153,153,137,204,204,76,152,76,38,152,76,38,86,146,202,204, +204,76,217,123,219,108,54,51,118,152,209,104,100,207,107,54,155,217,207, +72,211,140,126,63,212,72,213,119,28,0,50,51,51,177,125,251,246,132,13,113, +42,19,89,173,86,214,103,250,232,163,143,152,22,26,111,61,64,32,194,47,152, +3,233,159,196,47,178,79,61,245,212,21,121,189,76,159,62,29,101,101,101, +104,108,108,20,232,157,17,203,142,151,237,167,141,7,245,116,168,191,148, +44,202,202,202,6,68,251,165,44,237,185,231,158,131,90,173,198,83,79,61, +197,250,94,125,133,219,237,70,103,103,167,0,80,248,254,23,63,184,59,144, +207,80,12,49,190,213,25,10,159,61,88,173,86,116,117,117,177,30,68,188,251, +96,162,230,254,64,202,81,180,56,147,93,104,52,26,101,19,241,195,105,151, +73,199,75,139,124,127,12,163,96,48,136,252,252,124,76,159,62,29,91,183, +110,77,184,248,44,88,176,0,27,54,108,64,36,18,129,221,110,71,117,117,53, +147,206,225,131,50,186,84,118,225,125,129,10,53,242,1,224,190,251,238,75, +234,234,249,85,134,68,34,65,97,97,33,54,109,218,196,62,63,222,227,155,159, +121,34,186,56,245,241,168,140,217,223,112,231,218,181,107,113,236,216,177, +65,29,95,89,89,25,38,77,154,132,69,139,22,225,185,231,158,195,220,185,115, +241,157,239,124,167,215,164,124,44,22,99,118,17,124,38,201,15,233,198,15, +218,94,14,31,22,49,196,248,70,102,40,241,217,132,213,106,133,197,98,97, +217,201,136,17,35,144,157,157,141,172,172,172,33,47,250,233,233,233,48, +155,205,200,202,202,130,213,106,69,86,86,22,204,102,243,101,115,76,35,35, +175,100,161,80,40,112,243,205,55,39,85,240,173,175,175,199,178,101,203, +216,76,7,41,237,250,124,62,140,27,55,46,161,144,165,68,34,25,48,93,150, +47,147,201,100,50,88,173,86,220,125,247,221,95,251,117,49,110,220,56,152, +76,38,108,222,188,89,160,220,192,83,202,181,90,173,64,65,155,136,22,212, +123,35,240,233,11,104,87,173,90,53,104,48,161,112,58,157,168,174,174,198, +203,47,191,140,182,182,54,252,238,119,191,235,245,185,118,118,118,162,166, +166,70,48,193,79,96,66,165,87,94,13,130,122,127,98,136,33,2,202,16,118, +248,52,19,18,63,169,254,175,18,177,88,12,227,199,143,239,247,125,186,92, +46,220,122,235,173,73,61,92,128,75,180,221,235,175,191,158,153,128,237, +217,179,7,6,131,129,77,158,147,212,200,112,156,123,94,218,70,171,213,98, +217,178,101,95,203,57,52,153,76,40,40,40,64,73,73,9,142,30,61,42,96,27, +210,162,203,207,15,81,105,211,96,48,176,89,37,94,1,33,81,118,226,243,249, +240,251,223,255,190,95,21,225,129,196,209,163,71,113,215,93,119,97,225, +194,133,248,205,111,126,195,196,66,229,114,57,62,250,232,35,150,41,209, +121,230,137,32,25,25,25,76,32,147,192,69,164,15,139,33,2,202,183,60,34, +145,8,204,102,115,159,245,111,153,76,134,230,230,102,60,252,240,195,40, +43,43,235,215,13,145,252,60,174,185,230,26,102,117,187,115,231,78,216,237, +118,214,99,225,7,249,168,252,69,187,249,84,152,66,252,236,10,239,246,168, +86,171,177,98,197,138,94,67,154,151,43,178,179,179,49,105,210,36,212,214, +214,98,211,166,77,240,122,189,172,68,201,235,136,105,181,90,24,12,6,232, +116,58,24,141,70,152,76,38,246,127,202,78,120,150,87,60,160,236,217,179, +7,207,63,255,252,160,60,107,250,11,155,205,134,204,204,76,60,247,220,115, +248,235,95,255,138,143,63,254,24,251,247,239,23,232,200,241,82,66,60,152, +208,255,7,234,93,35,134,24,151,35,36,49,145,103,120,69,100,40,118,187,29, +23,47,94,20,56,79,210,238,218,110,183,227,199,63,254,49,206,157,59,135, +15,63,252,48,101,255,20,82,8,56,122,244,40,219,149,83,207,128,22,88,34, +27,144,57,90,70,70,6,43,167,244,23,225,112,24,126,191,159,249,153,219,237, +118,116,118,118,162,179,179,19,221,221,221,136,197,98,56,112,224,192,101, +161,178,230,231,231,67,34,145,96,231,206,157,2,58,45,149,241,226,23,98, +154,75,210,233,116,140,184,97,50,153,96,54,155,5,100,11,94,138,134,222, +227,235,175,191,158,178,29,243,80,99,250,244,233,120,246,217,103,5,138, +217,68,127,39,0,204,204,204,132,197,98,193,136,17,35,96,177,88,96,54,155, +97,50,153,48,98,196,8,241,102,18,227,107,13,153,120,10,174,0,84,255,63, +241,200,145,35,71,226,244,233,211,44,83,160,193,202,31,255,248,199,176, +217,108,3,2,19,0,140,202,123,255,253,247,99,205,154,53,240,251,253,204, +173,146,230,107,72,129,128,196,28,227,149,12,250,203,82,34,145,8,43,197, +240,126,29,129,64,0,93,93,93,152,54,109,26,84,42,21,234,234,234,134,60, +99,66,253,177,218,218,90,86,246,227,153,77,60,181,155,183,198,205,200,200, +96,96,66,32,74,64,194,235,189,17,133,152,162,172,172,140,53,197,191,170, +56,118,236,24,30,123,236,49,252,237,111,127,131,76,38,99,101,56,222,222, +129,222,11,79,44,184,156,206,152,98,136,33,2,202,191,32,168,116,118,118, +98,226,196,137,56,125,250,52,204,102,51,244,122,61,102,205,154,133,115, +231,206,97,205,154,53,131,114,118,116,185,92,56,116,232,16,238,190,251, +110,84,85,85,161,161,161,129,237,222,73,212,147,116,180,200,87,101,32,146, +237,241,110,135,193,96,16,193,96,16,38,147,9,209,104,20,157,157,157,104, +106,106,66,56,28,70,94,94,30,76,38,19,147,211,113,56,28,76,87,139,143,244, +244,116,88,44,22,214,32,119,185,92,56,115,230,12,246,236,217,211,11,208, +18,1,9,189,63,26,64,205,200,200,96,165,46,190,236,165,215,235,89,79,133, +30,11,92,242,130,127,239,189,247,134,52,91,51,212,224,53,223,18,177,210, +8,36,9,112,250,147,254,17,67,12,17,80,190,69,65,101,26,151,203,133,81,163, +70,97,210,164,73,48,155,205,56,116,232,16,182,111,223,158,146,70,84,178, +210,212,158,61,123,48,122,244,104,220,117,215,93,216,177,99,7,130,193,32, +19,108,36,65,76,50,150,162,217,134,84,64,133,30,163,86,171,5,90,104,188, +139,32,1,166,219,237,70,107,107,43,243,65,167,215,37,21,225,139,23,47,194, +235,245,246,153,37,241,134,102,188,144,37,111,35,64,64,66,205,107,234,145, +208,34,76,77,120,90,140,105,118,9,184,212,116,255,251,223,255,142,250,250, +250,175,237,58,144,203,229,204,27,135,102,77,232,189,208,241,83,79,136, +50,43,177,25,47,134,8,40,98,8,66,167,211,193,235,245,66,161,80,32,16,8, +192,108,54,227,179,207,62,75,89,210,35,149,176,217,108,176,217,108,88,184, +112,33,130,193,32,234,234,234,224,247,251,5,44,33,175,215,43,152,47,73, +21,84,34,145,8,243,165,1,254,217,216,167,73,110,90,252,249,76,194,239,247, +179,62,76,123,123,59,155,243,1,144,208,59,135,178,17,162,44,83,143,65,173, +86,11,236,150,137,5,69,148,96,234,143,80,70,162,213,106,25,229,156,0,119, +253,250,245,131,54,57,227,195,98,177,64,42,149,246,82,50,72,53,50,50,50, +112,248,240,97,86,130,35,38,93,188,210,53,13,97,138,217,137,24,34,160,136, +145,112,81,38,233,15,143,199,3,151,203,133,147,39,79,94,150,215,218,179, +103,15,116,58,29,110,189,245,86,212,214,214,194,227,241,8,64,132,24,78, +188,144,98,127,59,96,178,203,141,111,192,83,54,65,125,22,181,90,13,183, +219,13,191,223,15,191,223,143,80,40,132,244,244,116,86,118,3,144,208,11, +133,23,109,164,89,12,2,19,158,86,75,196,2,190,231,64,63,75,79,79,71,118, +118,54,147,186,9,135,195,216,182,109,155,192,75,102,40,159,95,122,122,58, +234,235,235,97,179,217,144,145,145,129,25,51,102,12,168,111,100,177,88, +240,198,27,111,176,115,22,111,24,71,239,137,8,20,4,42,98,118,34,134,8,40, +98,244,10,222,10,185,165,165,5,133,133,133,3,218,53,83,83,217,231,243,33, +61,61,29,78,167,179,207,199,186,92,46,124,244,209,71,40,40,40,192,181,215, +94,139,250,250,122,129,12,8,111,134,70,172,167,100,217,10,137,131,38,58, +38,222,38,153,118,218,30,143,7,62,159,143,105,177,241,214,4,188,119,14, +61,55,191,200,242,12,40,94,62,133,167,210,106,52,26,166,4,173,86,171,49, +114,228,72,1,144,108,220,184,177,95,250,245,64,178,203,250,250,122,108, +221,186,21,111,191,253,54,50,51,51,17,10,133,240,241,199,31,163,181,181, +21,197,197,197,136,197,98,204,19,190,47,48,249,243,159,255,140,104,52,10, +141,70,35,200,230,168,39,68,153,10,127,46,197,236,68,12,17,80,196,72,24, +36,145,162,86,171,209,221,221,141,162,162,162,148,1,69,169,84,162,179,179, +19,175,190,250,42,162,209,40,84,42,21,190,247,189,239,97,228,200,145,73, +203,47,167,79,159,198,233,211,167,49,103,206,28,20,21,21,161,185,185,25, +118,187,157,153,141,209,2,173,84,42,17,14,135,147,2,75,162,159,199,151, +185,180,90,45,156,78,39,52,26,13,2,129,0,203,82,120,131,173,68,158,31,148, +37,241,30,46,124,127,129,102,72,180,90,45,91,120,245,122,61,198,142,29, +203,52,215,92,46,23,118,236,216,49,228,41,119,62,172,86,43,214,173,91,135, +250,250,122,132,195,97,76,157,58,21,71,142,28,129,211,233,196,220,185,115, +145,147,147,131,150,150,22,236,222,189,27,129,64,0,185,185,185,48,26,141, +112,56,28,236,124,134,195,97,60,255,252,243,44,35,225,205,230,232,61,146, +216,41,159,129,137,217,137,24,87,90,136,115,40,87,88,56,157,78,184,92,46, +184,221,110,54,219,81,86,86,214,239,14,57,59,59,27,165,165,165,40,45,45, +69,67,67,131,192,214,246,209,71,31,69,79,79,79,74,172,165,185,115,231,98, +230,204,153,112,56,28,112,58,157,12,76,248,221,49,223,176,143,7,17,242, +197,33,64,162,230,127,32,16,96,165,46,210,73,227,1,133,254,134,232,204, +60,9,129,178,31,190,124,150,200,190,152,134,24,199,142,29,139,172,172,44, +214,143,57,123,246,44,182,110,221,58,172,179,36,6,131,1,141,141,141,216, +178,101,11,203,176,212,106,53,106,106,106,176,118,237,90,4,131,65,193,57, +177,90,173,48,155,205,184,120,241,34,54,108,216,128,138,138,10,92,115,205, +53,56,121,242,36,78,159,62,205,50,17,202,172,120,106,51,73,255,16,109,154, +196,74,115,114,114,68,64,17,67,4,20,49,146,71,87,87,23,204,102,51,74,74, +74,224,247,251,209,217,217,217,107,224,145,47,149,76,157,58,21,55,220,112, +3,214,174,93,139,202,202,74,188,254,250,235,189,74,38,99,199,142,197,157, +119,222,137,115,231,206,165,116,12,19,38,76,192,162,69,139,160,209,104, +208,222,222,142,96,48,200,22,109,106,226,43,149,202,62,75,93,100,7,77,180, +100,146,129,9,6,131,12,76,136,89,70,154,91,4,44,137,156,61,121,251,100, +190,33,79,89,73,78,78,14,70,140,24,193,168,191,109,109,109,56,122,244,40, +202,203,203,5,139,251,80,131,202,138,159,124,242,137,64,5,88,42,149,98, +238,220,185,248,224,131,15,146,138,100,18,184,164,167,167,227,169,167,158, +194,133,11,23,152,193,23,149,237,136,218,76,195,151,86,171,149,129,10,175, +126,61,28,106,215,98,136,33,150,188,190,225,65,178,37,213,213,213,152,51, +103,14,60,30,15,138,138,138,208,211,211,195,100,216,163,209,40,178,178, +178,176,108,217,50,68,34,17,108,217,178,133,205,127,208,174,157,74,40,106, +181,26,118,187,29,31,124,240,1,238,189,247,94,216,108,182,126,105,200,231, +206,157,195,185,115,231,32,151,203,49,111,222,60,76,159,62,29,50,153,12, +78,167,19,221,221,221,172,33,174,80,40,16,10,133,4,58,106,188,89,23,9,45, +242,206,144,84,62,163,44,134,47,117,17,221,152,111,240,243,138,200,84,230, +49,155,205,200,201,201,129,209,104,100,128,214,213,213,133,189,123,247, +14,59,136,240,229,173,173,91,183,10,134,79,121,21,224,249,243,231,195,102, +179,37,223,193,73,36,44,83,250,197,47,126,129,103,158,121,134,61,71,34, +50,1,13,49,242,165,46,162,67,139,33,134,8,40,98,164,180,11,6,128,77,155, +54,193,229,114,97,201,146,37,168,172,172,132,199,227,65,110,110,46,70,142, +28,137,226,226,98,72,36,18,148,149,149,161,190,190,158,49,163,168,231,65, +25,4,121,125,80,99,119,211,166,77,184,227,142,59,208,216,216,216,175,23, +7,240,207,25,150,61,123,246,64,175,215,99,246,236,217,152,52,105,18,27, +138,12,133,66,240,122,189,12,44,250,242,166,231,23,77,26,160,36,102,20, +53,226,9,76,122,122,122,32,149,74,217,123,146,74,165,48,26,141,48,26,141, +140,173,69,199,118,225,194,5,84,86,86,162,178,178,114,72,179,58,201,34, +35,35,3,78,167,19,47,191,252,50,3,189,248,57,24,165,82,137,27,110,184,97, +64,116,97,82,25,160,207,138,134,48,233,61,106,52,26,246,158,105,182,134, +215,28,19,67,12,17,80,196,24,80,148,148,148,160,164,164,4,203,150,45,131, +197,98,193,178,101,203,112,238,220,57,28,56,112,0,109,109,109,189,166,231, +169,196,197,171,48,243,198,81,50,153,12,59,119,238,196,195,15,63,140,221, +187,119,15,104,17,238,238,238,198,214,173,91,177,117,235,86,40,149,74,20, +21,21,97,242,228,201,24,53,106,20,155,150,167,108,131,23,158,140,151,198, +231,39,220,35,145,136,192,142,151,167,0,19,24,242,224,214,212,212,132,250, +250,122,156,60,121,242,178,216,5,247,5,240,239,191,255,190,32,43,225,207, +181,70,163,65,102,102,38,38,78,156,136,237,219,183,15,248,185,105,34,158, +64,132,128,197,96,48,176,108,133,36,246,197,185,19,49,68,64,17,99,80,145, +159,159,207,164,210,55,108,216,128,71,30,121,4,46,151,43,41,221,149,0,36, +94,161,150,22,105,42,207,84,84,84,96,254,252,249,216,189,123,247,160,142, +45,24,12,162,188,188,92,112,44,5,5,5,200,206,206,198,168,81,163,144,153, +153,9,157,78,55,168,157,116,56,28,134,219,237,70,99,99,35,218,219,219,209, +208,208,128,243,231,207,95,150,50,86,170,199,147,155,155,139,154,154,26, +129,219,35,77,229,103,100,100,224,250,235,175,7,0,116,116,116,12,168,81, +78,165,64,94,158,158,164,98,168,57,79,175,65,217,167,216,136,23,67,4,20, +49,6,28,87,95,125,181,192,123,35,21,123,87,98,119,241,14,132,252,4,57,25, +49,133,195,97,20,23,23,15,26,80,18,5,81,144,251,219,145,103,101,101,177, +172,164,173,173,237,107,3,138,84,195,227,241,224,129,7,30,192,179,207,62, +203,202,121,116,78,105,241,191,253,246,219,97,179,217,6,12,38,241,50,50, +60,85,152,178,21,126,147,144,170,157,181,24,98,136,128,34,134,32,198,141, +27,215,43,43,72,37,8,52,120,115,38,114,40,84,169,84,144,74,165,40,46,46, +254,90,26,187,225,112,24,205,205,205,255,114,159,133,195,225,64,113,113, +49,35,42,40,149,74,214,235,200,201,201,193,228,201,147,81,82,82,50,176, +155,79,38,99,101,52,126,190,134,192,138,244,198,168,111,162,213,106,197, +155,66,140,43,58,68,131,173,43,56,138,138,138,4,255,247,251,253,253,90, +188,134,66,33,140,24,49,130,105,104,209,100,57,47,231,110,181,90,177,104, +209,34,52,53,53,137,39,121,0,64,120,251,237,183,179,243,73,205,120,173, +86,139,165,75,151,2,64,191,12,175,248,8,4,2,130,254,18,81,163,9,176,120, +233,21,106,218,139,33,134,8,40,98,12,42,72,188,144,207,80,226,101,73,18, +133,213,106,101,37,21,2,21,94,100,112,193,130,5,0,128,79,62,249,68,60,201, +3,8,154,185,161,5,159,74,139,55,221,116,19,206,157,59,55,224,222,134,221, +110,103,234,204,244,252,60,205,154,103,128,37,178,36,22,67,12,17,80,196, +24,80,16,56,208,46,217,110,183,247,203,242,201,201,201,97,195,129,252,44, +135,84,42,133,70,163,65,94,94,30,202,202,202,146,106,75,125,83,66,46,151, +195,106,181,194,104,52,162,169,169,9,19,38,76,24,244,115,185,92,46,92,115, +205,53,130,153,154,121,243,230,65,173,86,163,182,182,118,192,207,71,18, +48,241,44,56,94,138,159,20,2,196,185,19,49,254,21,66,220,246,92,225,177, +124,249,114,172,92,185,18,192,37,218,110,83,83,19,244,122,61,28,14,71,159, +127,99,50,153,208,211,211,195,178,25,2,22,169,84,138,236,236,108,0,24,116, +51,222,96,48,48,119,64,210,163,186,210,194,104,52,66,161,80,160,169,169, +9,135,15,31,70,123,123,59,147,115,209,233,116,200,201,201,129,219,237,30, +212,115,95,123,237,181,56,123,246,44,128,75,243,41,247,221,119,31,108,54, +91,82,33,206,68,17,139,197,112,226,196,9,193,207,168,76,73,154,101,148, +17,81,25,76,12,49,68,64,17,99,208,225,243,249,112,219,109,183,49,64,105, +108,108,68,75,75,11,10,10,10,146,154,64,233,116,58,54,44,200,103,41,209, +104,20,38,147,9,62,159,111,80,11,170,197,98,193,179,207,62,203,118,208, +38,147,9,83,166,76,193,232,209,163,145,153,153,9,181,90,13,169,84,202,36, +87,98,177,24,194,225,48,188,94,239,101,59,71,52,163,17,141,70,81,87,87, +135,99,199,142,49,205,50,218,249,211,247,169,83,167,98,251,246,237,248, +233,79,127,202,134,50,7,26,42,149,138,253,123,241,226,197,144,203,229,131, +82,45,142,197,98,104,107,107,19,88,14,199,151,188,6,226,73,35,134,24,34, +160,136,145,52,104,230,96,204,152,49,104,104,104,64,67,67,3,218,219,219, +49,111,222,188,164,127,23,141,70,33,147,201,152,80,35,15,44,114,185,28, +157,157,157,131,58,158,109,219,182,161,167,167,7,161,80,8,18,137,4,78,167, +19,95,126,249,37,78,158,60,41,104,34,83,57,136,118,221,180,48,46,93,186, +20,87,93,117,21,74,75,75,7,125,78,172,86,43,60,30,15,90,90,90,80,83,83, +35,104,132,243,180,234,248,69,25,0,62,252,240,67,252,246,183,191,197,170, +85,171,240,216,99,143,49,107,226,129,132,195,225,128,94,175,7,0,204,156, +57,19,85,85,85,8,4,2,3,126,31,93,93,93,255,188,9,255,111,54,136,154,253, +4,216,244,51,113,238,68,140,127,149,16,123,40,87,112,72,36,18,116,116,116, +224,225,135,31,22,252,220,237,118,67,169,84,246,249,119,145,72,4,211,167, +79,103,147,234,252,180,122,52,26,133,223,239,31,84,118,66,22,193,252,162, +77,59,234,254,192,4,0,154,154,154,152,39,201,96,34,35,35,3,127,252,227, +31,241,250,235,175,227,139,47,190,192,217,179,103,153,235,35,127,76,212, +200,38,229,94,157,78,135,177,99,199,66,46,151,99,250,244,233,152,53,107, +22,254,241,143,127,48,109,172,129,68,56,28,198,248,241,227,17,14,135,241, +31,255,241,31,131,234,157,0,64,69,69,5,107,240,19,136,240,255,39,75,104, +250,183,24,98,136,128,34,198,176,132,70,163,97,141,120,135,195,129,19,39, +78,96,212,168,81,73,255,102,226,196,137,130,140,133,47,179,12,116,199,107, +48,24,176,96,193,2,220,114,203,45,88,177,98,5,107,24,243,19,249,52,201, +77,131,120,52,233,77,94,37,42,149,10,161,80,8,70,163,113,208,231,65,46, +151,195,227,241,48,63,250,120,32,33,16,49,24,12,204,59,94,175,215,195,96, +48,32,55,55,151,169,30,47,91,182,12,163,71,143,198,254,253,251,209,216, +216,136,156,156,156,1,1,235,177,99,199,88,57,111,221,186,117,176,217,108, +108,232,144,47,137,37,43,119,237,217,179,71,112,30,73,22,135,87,136,166, +126,74,127,84,113,49,196,16,75,94,98,164,134,248,255,183,251,127,232,161, +135,176,106,213,42,84,87,87,67,167,211,9,118,250,164,192,27,12,6,225,245, +122,225,243,249,208,212,212,36,144,123,167,104,109,109,101,226,145,169, +148,123,136,93,84,92,92,140,186,186,58,248,124,62,38,97,207,75,143,240, +122,97,124,115,153,22,80,224,210,196,249,80,22,71,185,92,142,80,40,196, +72,1,252,60,8,129,26,29,23,205,111,208,34,61,126,252,120,150,153,57,157, +78,60,248,224,131,248,226,139,47,208,214,214,134,237,219,183,99,222,188, +121,80,40,20,125,122,166,232,245,122,116,118,118,98,245,234,213,76,180, +146,136,15,77,77,77,112,185,92,44,67,147,72,36,208,210,166,214,186,0,0, +24,166,73,68,65,84,104,52,144,72,36,8,4,2,240,122,189,240,251,253,56,115, +230,12,106,106,106,152,43,35,1,32,47,145,67,211,241,4,194,244,222,196,16, +67,4,20,49,134,28,58,157,14,129,64,0,86,171,21,223,253,238,119,81,94,94, +142,180,180,52,236,220,185,19,5,5,5,56,127,254,60,142,29,59,198,118,238, +212,104,166,137,107,222,50,151,36,67,236,118,59,230,205,155,135,170,170, +170,164,166,83,74,165,18,30,143,7,191,251,221,239,112,240,224,65,38,143, +79,11,33,129,137,78,167,19,168,28,211,107,198,151,225,136,105,150,42,152, +197,7,13,2,82,47,40,94,79,139,68,21,9,216,104,246,70,38,147,97,244,232, +209,2,165,129,246,246,118,220,113,199,29,184,112,225,2,118,239,222,141, +3,7,14,192,231,243,225,234,171,175,70,78,78,14,27,34,12,133,66,232,236, +236,68,109,109,45,94,120,225,5,116,116,116,160,173,173,13,46,151,139,1, +53,41,16,19,112,6,131,65,116,119,119,195,235,245,194,237,118,195,237,118, +195,229,114,193,239,247,179,18,155,84,42,101,32,194,43,9,19,152,80,31,69, +236,161,136,33,2,138,24,195,22,84,2,145,203,229,176,88,44,152,51,103,14, +218,219,219,17,8,4,112,236,216,49,116,119,119,179,29,172,76,38,99,106,191, +228,87,194,79,90,43,20,10,204,156,57,19,105,105,105,56,123,246,44,198,141, +27,135,145,35,71,226,226,197,139,2,96,33,47,246,250,250,122,188,252,242, +203,168,170,170,66,125,125,61,36,18,9,43,101,241,96,66,18,33,148,33,168, +213,106,65,150,66,202,195,193,96,16,141,141,141,24,49,98,196,128,167,202, +1,176,12,131,102,106,226,245,180,180,90,45,91,156,121,81,76,137,68,130, +188,188,188,94,3,161,45,45,45,48,24,12,120,252,241,199,241,215,191,254, +21,106,181,154,137,81,70,34,17,88,173,86,20,23,23,227,87,191,250,21,204, +102,51,42,42,42,32,147,201,144,159,159,143,83,167,78,49,122,47,1,11,29, +151,82,169,68,79,79,15,3,117,122,93,242,142,1,192,68,38,233,220,233,116, +58,230,123,194,103,91,226,64,163,24,34,160,136,49,172,161,209,104,216,238, +54,24,12,66,171,213,10,118,197,188,176,32,237,252,105,134,129,22,255,244, +244,116,246,251,163,71,143,162,167,167,7,215,94,123,45,26,26,26,96,183, +219,97,48,24,216,142,218,229,114,161,180,180,20,19,39,78,68,103,103,39, +170,171,171,217,46,153,47,47,241,139,56,45,136,180,200,211,66,155,150,150, +198,134,44,73,199,107,194,132,9,131,2,148,230,230,102,198,220,162,178,22, +239,110,152,145,145,1,189,94,207,252,67,168,100,36,147,201,96,177,88,18, +250,191,4,2,1,156,63,127,30,223,249,206,119,144,150,150,134,229,203,151, +195,231,243,177,172,170,165,165,5,135,15,31,198,166,77,155,152,84,77,65, +65,1,203,194,248,185,17,165,82,201,192,37,35,35,163,23,115,139,44,142,201, +124,76,46,151,51,98,128,209,104,100,202,194,90,173,150,109,2,68,169,122, +49,68,64,17,99,88,131,118,219,225,112,24,25,25,25,8,135,195,108,145,38, +117,97,183,219,205,30,211,211,211,131,180,180,52,129,28,58,237,130,123, +122,122,96,177,88,240,135,63,252,1,27,55,110,196,221,119,223,141,21,43, +86,32,43,43,139,189,94,44,22,195,207,127,254,115,102,253,203,151,167,200, +36,139,87,49,38,38,21,45,230,124,102,68,115,41,145,72,132,121,204,207,152, +49,3,59,119,238,28,240,121,104,106,106,98,25,0,95,34,162,69,56,51,51,147, +53,226,169,116,68,101,191,17,35,70,176,129,196,68,145,150,150,134,113,227, +198,97,227,198,141,108,238,39,89,166,196,91,16,211,119,30,84,162,209,40, +235,131,120,189,94,132,66,33,6,40,244,122,252,231,163,215,235,97,50,153, +24,168,80,79,74,44,119,137,33,2,138,24,151,37,75,33,207,117,106,10,19,152, +208,2,27,8,4,88,163,152,183,219,165,108,34,61,61,29,225,112,152,73,160, +219,237,118,188,249,230,155,120,243,205,55,251,44,183,37,26,170,35,176, +160,30,5,45,220,148,25,80,118,192,83,136,201,124,139,250,32,131,233,163, +92,184,112,129,237,220,249,76,137,50,36,189,94,15,179,217,204,50,39,58, +54,162,221,38,163,75,135,195,97,140,29,59,54,37,160,227,101,230,41,11,225, +25,91,68,26,232,233,233,97,106,193,193,96,144,149,254,128,127,178,210,84, +42,21,163,55,235,245,122,24,141,70,246,55,162,103,188,24,34,160,136,113, +217,178,20,126,135,203,51,156,84,42,21,107,200,211,239,105,23,204,75,215, +211,12,201,85,87,93,149,210,107,170,213,234,132,37,23,122,77,234,239,240, +126,43,124,214,64,191,167,210,92,36,18,129,223,239,71,107,107,43,174,191, +254,122,236,218,181,43,229,247,47,151,203,97,179,217,160,211,233,152,122, +50,81,148,169,100,164,215,235,161,211,233,144,153,153,153,208,42,55,153, +92,77,48,24,132,90,173,198,169,83,167,250,61,150,246,246,118,198,158,163, +233,118,202,78,200,110,153,74,95,244,222,105,248,145,207,80,232,113,148, +213,81,105,210,96,48,12,137,94,45,134,24,34,160,136,209,111,24,12,6,86, +206,162,6,176,66,161,64,32,16,96,37,37,222,135,157,202,42,60,149,150,172, +129,83,9,90,188,249,8,133,66,130,201,110,50,156,162,126,9,1,12,45,248,52, +152,71,101,47,165,82,137,238,238,110,200,100,50,24,12,134,148,53,176,136, +189,197,251,133,80,6,66,192,66,229,46,234,27,197,55,181,249,233,244,68, +37,47,191,223,223,175,173,112,122,122,58,92,46,23,43,71,81,31,133,206,3, +129,10,159,25,209,96,41,79,10,160,191,161,243,69,223,9,28,69,185,21,49, +68,64,17,227,178,135,217,108,134,211,233,20,148,155,34,145,8,66,161,16, +43,33,241,62,237,252,4,54,245,52,82,13,163,209,136,198,198,198,132,139, +47,47,96,200,151,130,120,130,0,233,125,209,99,72,45,153,30,59,121,242,100, +248,253,126,212,212,212,244,169,45,102,177,88,208,214,214,134,63,254,241, +143,140,78,75,37,55,250,63,245,152,136,105,70,11,51,255,218,4,134,137,66, +169,84,194,98,177,36,237,177,80,140,25,51,6,167,78,157,98,10,4,124,6,149, +8,240,248,25,32,94,85,152,164,97,168,44,72,160,18,127,204,98,136,33,2,138, +24,151,61,83,137,197,98,176,219,237,80,169,84,44,67,33,101,97,10,30,64, +84,42,21,99,23,209,14,185,63,95,21,133,66,129,182,182,182,94,153,132,94, +175,103,205,255,248,231,224,253,87,116,58,157,96,113,148,203,229,48,153, +76,240,122,189,200,203,203,131,193,96,64,77,77,13,154,155,155,89,9,72,34, +145,192,235,245,194,229,114,33,16,8,96,228,200,145,120,226,137,39,112,228, +200,17,212,214,214,10,202,74,4,42,241,25,75,70,70,198,128,22,102,133,66, +129,169,83,167,98,227,198,141,41,149,30,169,79,69,196,8,30,80,249,217,24, +2,253,190,50,34,26,130,148,203,229,208,235,245,34,144,136,33,2,138,24,95, +79,72,36,18,214,180,37,69,95,162,18,211,14,152,22,46,141,70,3,153,76,134, +72,36,194,148,127,243,242,242,112,225,194,133,126,95,199,225,112,176,38, +51,133,90,173,70,40,20,98,0,22,141,70,123,13,247,81,166,18,31,114,185,156, +145,2,126,249,203,95,226,193,7,31,196,247,190,247,61,0,151,72,2,161,80, +8,102,179,153,189,183,170,170,42,188,245,214,91,44,11,225,203,67,68,11, +230,179,21,234,75,12,100,113,142,68,34,208,233,116,56,124,248,112,191,143, +109,109,109,21,0,105,124,25,139,142,141,40,219,148,165,240,154,97,116,94, +68,0,17,67,4,20,49,174,184,224,23,233,84,31,55,114,228,200,126,1,197,231, +243,161,187,187,91,96,242,69,139,40,237,206,121,7,201,120,163,168,100,11, +102,75,75,11,252,126,63,86,174,92,137,149,43,87,66,34,145,160,176,176,16, +70,163,17,61,61,61,184,120,241,34,108,54,155,96,193,230,37,85,168,31,68, +25,10,79,83,30,168,25,149,66,161,128,203,229,66,67,67,67,210,199,229,230, +230,226,204,153,51,12,132,40,75,137,47,99,73,165,82,150,45,137,76,45,49, +68,64,17,227,27,31,5,5,5,40,41,41,73,250,24,151,203,133,150,150,22,102, +202,69,65,59,116,254,139,128,38,30,84,250,138,248,230,119,44,22,67,101, +101,101,191,11,63,101,38,241,246,184,124,239,38,81,102,84,95,95,47,152, +84,167,80,169,84,152,63,127,62,115,79,76,22,38,147,9,30,143,135,1,91,124, +118,194,251,205,167,165,165,137,46,139,98,136,128,34,198,183,35,82,89,236, +252,126,63,156,78,167,64,178,94,161,80,176,254,73,162,224,153,77,201,162, +185,185,121,80,153,24,239,17,194,127,231,23,242,68,153,81,94,94,30,164, +82,41,154,155,155,113,254,252,121,1,160,232,116,58,172,93,187,54,233,107, +103,103,103,227,208,161,67,189,126,78,236,46,98,125,241,211,241,34,83,75, +140,111,91,136,242,245,223,210,208,106,181,253,62,198,110,183,35,16,8,176, +134,188,66,161,192,198,141,27,5,217,5,175,42,60,144,158,0,185,42,14,4,76, +120,64,225,233,202,252,235,38,3,50,185,92,14,173,86,139,201,147,39,51,224, +51,153,76,240,251,253,73,203,93,68,179,230,105,199,164,2,205,3,25,101,77, +137,196,49,197,16,67,4,20,49,190,185,169,233,255,137,28,246,23,110,183, +27,21,21,21,136,70,163,120,235,173,183,152,158,21,95,102,162,133,157,22, +125,154,145,73,22,201,84,142,19,197,112,104,90,17,8,184,92,46,228,228,228, +192,104,52,98,234,212,169,9,51,15,62,147,51,26,141,56,114,228,8,3,49,122, +159,4,30,241,116,102,162,14,139,33,134,8,40,98,124,43,194,98,177,224,161, +135,30,194,237,183,223,222,111,102,113,228,200,17,188,246,218,107,76,186, +36,94,199,138,111,150,19,211,233,114,184,12,18,155,140,122,56,188,148,73, +170,32,74,199,237,114,185,208,222,222,142,141,27,55,98,205,154,53,9,179, +146,233,211,167,35,28,14,163,188,188,92,48,157,207,75,172,240,62,38,188, +100,126,170,195,163,98,136,241,141,218,168,138,167,224,219,155,161,104, +52,26,20,22,22,194,108,54,163,179,179,147,49,175,120,191,145,218,218,90, +102,214,197,207,123,208,78,156,22,82,98,93,17,152,12,247,14,93,171,213, +50,115,45,126,6,38,126,192,48,89,168,213,106,120,189,94,54,4,233,247,251, +209,222,222,142,130,130,2,228,231,231,179,190,144,203,229,194,153,51,103, +80,90,90,138,158,158,30,100,100,100,8,178,50,50,197,162,137,124,254,156, +196,15,51,138,33,134,8,40,98,124,227,131,84,120,121,144,80,171,213,112, +185,92,112,56,28,112,187,221,76,31,140,22,84,218,141,211,194,25,111,243, +203,107,124,245,7,40,244,156,169,134,68,34,17,136,99,18,101,151,0,133,40, +204,201,178,45,222,9,145,178,136,140,140,12,56,157,78,120,60,30,184,221, +110,248,124,62,4,2,1,118,252,60,45,90,34,145,8,180,209,72,230,197,104,52, +50,129,71,26,232,20,67,12,17,80,196,248,86,1,10,149,169,72,96,49,35,35, +3,126,191,159,233,129,145,97,23,32,148,91,167,5,149,132,32,201,211,131, +60,87,82,145,93,143,167,34,247,23,42,149,10,225,112,152,129,10,137,77,134, +195,97,132,195,225,148,179,20,122,15,90,237,255,111,239,94,99,163,42,26, +48,142,63,59,221,109,233,150,109,105,41,173,165,34,22,40,6,98,130,168,220, +34,151,244,11,6,195,69,163,18,63,161,81,20,193,112,81,9,34,18,162,145,196, +0,65,171,24,163,126,32,70,98,33,42,18,18,3,132,75,80,196,75,4,4,12,22,11, +8,165,64,106,90,12,151,216,238,173,221,121,63,152,57,239,110,111,180,72, +65,229,255,75,26,219,157,179,103,135,211,122,158,51,103,230,204,132,218, +156,185,217,5,105,36,18,81,32,16,240,110,179,185,227,145,158,158,158,50, +51,112,242,236,192,46,112,25,221,5,2,5,55,21,119,181,221,114,114,69,119, +130,117,51,21,187,147,174,235,123,112,45,19,183,134,135,155,229,55,57,92, +58,211,129,222,191,127,255,46,215,57,185,101,226,66,165,179,65,226,244, +234,213,75,241,120,60,37,40,146,23,237,10,4,2,106,108,108,84,52,26,245, +194,213,125,134,235,47,114,51,2,231,228,228,120,255,117,45,181,206,60,96, +10,16,40,248,207,113,235,213,187,245,58,90,46,218,245,231,159,127,182,90, +11,62,121,137,90,55,187,175,251,222,245,35,116,102,248,112,242,130,94,157, +225,78,254,93,233,132,111,79,126,126,190,23,40,110,216,179,107,157,184, +185,209,220,151,91,105,50,121,90,21,55,77,127,110,110,174,178,179,179,189, +69,177,220,45,47,128,64,193,77,199,181,56,66,161,144,119,162,118,147,21, +186,78,103,55,103,151,235,108,119,39,83,183,166,188,187,253,227,182,239, +236,21,122,117,117,117,151,90,83,110,251,228,225,202,201,35,202,220,107, +157,105,177,248,124,62,21,20,20,120,223,251,253,126,53,52,52,120,129,17, +14,135,83,214,151,73,36,18,41,203,1,184,213,47,93,171,206,133,9,173,19, +16,40,184,169,245,238,221,219,91,171,68,250,255,173,174,134,134,6,111,133, +69,119,21,159,188,42,97,242,18,188,46,100,186,50,111,213,192,129,3,53,127, +254,124,157,56,113,66,71,142,28,105,243,193,194,146,146,18,101,103,103, +235,248,241,227,250,249,231,159,189,62,159,228,21,19,93,0,186,86,81,103, +135,43,251,124,62,21,22,22,234,143,63,254,240,246,231,70,127,185,165,138, +221,146,0,46,80,146,135,72,187,101,149,221,113,96,206,46,128,64,129,254, +186,253,228,78,152,238,42,221,173,16,233,102,16,118,87,242,45,87,106,236, +217,179,167,119,114,237,138,180,180,52,13,28,56,80,161,80,72,197,197,197, +170,173,173,213,165,75,151,20,143,199,85,87,87,167,218,218,90,237,223,191, +95,141,141,141,106,110,110,246,250,46,220,231,186,186,184,185,188,220,51, +49,93,125,254,165,119,239,222,222,112,226,112,56,172,140,140,12,175,163, +223,205,251,213,214,250,50,89,89,89,94,184,210,50,1,8,20,180,56,177,186, +214,137,59,97,186,171,115,231,90,46,8,149,149,149,229,173,124,232,134,226, +94,188,120,81,23,46,92,240,250,110,66,161,144,183,132,176,91,13,209,61, +3,226,6,18,36,207,54,124,181,79,168,187,125,53,54,54,170,161,161,193,27, +61,150,72,36,82,38,147,116,183,215,218,90,60,12,0,129,130,36,110,225,46, +247,240,96,83,83,147,215,121,237,166,29,113,173,129,191,187,32,148,235, +191,113,51,6,103,102,102,42,59,59,91,141,141,141,222,103,187,97,203,238, +118,92,242,144,229,80,40,228,141,54,75,126,208,242,239,60,161,238,130,197, +90,235,245,163,72,242,2,205,213,129,167,224,1,2,5,157,224,243,249,82,110, +225,180,156,162,253,90,114,79,157,55,54,54,42,20,10,41,28,14,43,55,55,215, +187,197,214,114,216,178,107,25,101,103,103,43,47,47,207,11,150,228,39,213, +175,213,49,112,225,2,128,64,193,53,12,152,238,146,151,151,167,88,44,166, +236,236,108,175,223,194,77,1,239,70,91,185,145,86,201,15,86,246,236,217, +83,189,122,245,82,175,94,189,188,254,27,247,124,12,0,2,5,55,105,88,185, +144,200,201,201,241,90,38,238,22,88,60,30,87,52,26,77,121,221,77,109,226, +134,236,186,97,187,238,246,25,0,2,5,55,169,150,195,109,93,235,36,24,12, +42,18,137,180,26,20,224,58,225,221,220,89,238,25,16,134,237,2,4,10,144, +18,6,129,64,64,209,104,84,145,72,36,101,86,97,119,43,204,117,188,187,78, +125,194,4,248,7,221,117,176,93,157,12,9,232,38,110,216,110,56,28,246,134, +236,182,28,20,144,60,61,190,123,176,18,0,129,2,180,41,30,143,235,242,229, +203,173,22,208,74,94,143,132,254,18,128,64,1,0,252,71,177,4,48,0,128,64, +1,0,16,40,0,0,2,5,0,0,2,5,0,64,160,0,0,8,20,0,0,129,2,0,0,129,2,0,32,80, +0,0,4,10,0,128,64,1,0,128,64,1,0,16,40,0,0,2,5,0,0,2,5,0,64,160,0,0,8,20, +0,0,129,2,0,0,129,2,0,32,80,0,0,4,10,0,128,64,1,0,128,64,1,0,16,40,0,0, +2,5,0,64,160,0,0,64,160,0,0,8,20,0,0,129,2,0,0,129,2,0,32,80,0,0,4,10,0, +128,64,1,0,128,64,1,0,16,40,0,0,2,5,0,64,160,0,0,64,160,0,0,8,20,0,0,129, +2,0,32,80,0,0,32,80,0,0,4,10,0,128,64,1,0,128,64,1,0,16,40,0,0,2,5,0,64, +160,0,0,64,160,0,0,8,20,0,0,129,2,0,32,80,0,0,32,80,0,0,4,10,0,128,64,1, +0,16,40,0,0,16,40,0,0,2,5,0,64,160,0,0,64,160,0,0,8,20,0,0,129,2,0,32,80, +0,0,32,80,0,0,4,10,0,128,64,1,0,16,40,0,0,16,40,0,0,2,5,0,64,160,0,0,8, +20,0,0,8,20,0,0,129,2,0,32,80,0,0,32,80,0,0,221,193,207,33,0,164,72,36, +162,47,190,248,66,62,159,79,143,62,250,168,252,254,246,255,215,136,199, +227,250,252,243,207,37,73,15,63,252,176,210,211,211,219,221,54,26,141,234, +220,185,115,202,204,204,84,81,81,81,171,114,107,173,106,106,106,148,158, +158,126,85,229,87,163,187,235,212,220,220,172,154,154,26,245,236,217,83, +125,250,244,105,247,120,111,220,184,81,57,57,57,154,60,121,242,127,246, +239,42,145,72,104,215,174,93,58,125,250,180,138,139,139,53,105,210,164, +46,255,93,254,171,142,147,5,96,231,204,153,99,141,49,118,205,154,53,157, +218,126,245,234,213,214,24,99,23,44,88,208,238,54,143,63,254,184,77,79, +79,183,198,24,107,140,177,67,135,14,181,135,14,29,242,202,119,238,220,105, +251,245,235,231,149,223,117,215,93,182,170,170,170,83,229,71,143,30,245, +94,111,249,117,230,204,153,27,82,39,107,173,173,168,168,176,5,5,5,94,249, +248,241,227,237,185,115,231,90,213,163,182,182,214,26,99,236,144,33,67, +174,201,239,47,16,8,180,58,14,195,135,15,191,46,127,59,27,54,108,104,245, +217,27,54,108,176,214,90,59,123,246,108,107,140,177,193,96,208,222,115, +207,61,93,222,247,181,62,78,221,141,64,193,77,239,208,161,67,54,45,45,205, +78,156,56,177,85,89,60,30,183,149,149,149,182,178,178,210,198,227,241,148, +178,178,178,50,235,247,251,237,209,163,71,219,220,111,89,89,153,157,61, +123,182,125,251,237,183,237,232,209,163,173,49,198,142,27,55,206,90,107, +109,56,28,182,125,250,244,177,198,24,187,106,213,42,59,119,238,220,46,149, +215,213,213,217,197,139,23,123,95,79,62,249,164,53,198,216,64,32,96,207, +159,63,223,238,191,181,59,235,116,244,232,81,27,8,4,108,126,126,190,221, +186,117,171,93,180,104,145,53,198,216,105,211,166,117,120,162,76,36,18, +182,178,178,210,214,214,214,122,229,209,104,212,134,195,97,155,72,36,188, +215,34,145,136,141,68,34,29,6,202,115,207,61,103,23,46,92,104,23,46,92, +104,223,122,235,45,175,222,209,104,212,251,125,54,53,53,121,159,81,85,85, +101,15,30,60,216,42,132,147,223,83,85,85,213,97,72,31,59,118,204,150,151, +151,123,97,82,94,94,110,143,29,59,102,163,209,168,189,229,150,91,108,102, +102,166,61,127,254,188,141,68,34,93,174,75,203,64,185,82,93,8,20,224,6, +115,87,145,187,119,239,78,121,125,237,218,181,54,63,63,223,59,81,228,231, +231,219,250,250,122,175,124,251,246,237,214,24,99,159,127,254,249,54,247, +27,14,135,189,239,191,250,234,43,107,140,177,131,6,13,178,214,90,187,107, +215,174,148,171,232,88,44,102,131,193,160,53,198,216,243,231,207,95,177, +188,165,153,51,103,90,99,140,125,246,217,103,59,252,183,118,103,157,222, +127,255,125,107,140,177,211,167,79,183,214,90,219,216,216,104,253,126,191, +237,209,163,71,171,48,118,39,202,194,194,66,59,108,216,48,107,140,177,126, +191,223,190,251,238,187,214,90,107,103,204,152,97,141,49,118,237,218,181, +214,90,107,143,28,57,98,141,49,118,204,152,49,29,6,74,85,85,149,173,175, +175,183,245,245,245,182,161,161,193,251,156,1,3,6,216,89,179,102,217,30, +61,122,216,109,219,182,217,166,166,38,155,145,145,145,210,170,24,57,114, +164,173,175,175,247,222,83,84,84,228,133,174,49,198,174,88,177,162,195, +227,234,182,115,199,120,220,184,113,41,251,95,186,116,233,117,169,203,141, +68,167,60,110,122,123,246,236,81,40,20,210,248,241,227,189,215,14,30,60, +168,167,159,126,90,146,180,105,211,38,237,222,189,91,19,38,76,80,44,22, +243,182,41,43,43,83,48,24,212,158,61,123,218,220,111,143,30,61,188,239, +183,110,221,42,73,154,56,113,162,36,233,220,185,115,146,164,226,226,98, +73,82,32,16,80,97,97,161,36,169,166,166,230,138,229,201,14,28,56,160,143, +62,250,72,217,217,217,122,237,181,215,36,73,39,79,158,212,198,141,27,189, +175,239,191,255,190,219,235,212,187,119,111,175,62,199,142,29,83,93,93, +157,2,129,128,98,177,152,46,93,186,212,230,49,106,110,110,214,146,37,75, +84,94,94,174,68,34,161,151,95,126,89,225,112,88,51,103,206,148,36,125,252, +241,199,146,164,138,138,10,73,210,172,89,179,58,252,93,14,25,50,68,133, +133,133,42,44,44,212,235,175,191,238,189,94,83,83,163,159,126,250,73,247, +221,119,159,66,161,144,124,62,159,86,174,92,169,131,7,15,234,240,225,195, +154,54,109,154,246,239,223,175,245,235,215,123,239,105,104,104,208,35,143, +60,162,197,139,23,75,146,202,203,203,187,244,119,181,106,213,42,101,101, +101,201,24,163,45,91,182,104,202,148,41,55,172,46,116,202,3,215,201,153, +51,103,84,82,82,34,99,254,127,125,181,109,219,54,89,107,245,196,19,79,104, +234,212,169,146,148,18,56,146,228,247,251,213,191,127,127,157,61,123,182, +195,253,175,91,183,78,171,87,175,214,224,193,131,181,124,249,242,148,50, +159,207,215,225,123,175,84,46,73,11,22,44,80,34,145,208,146,37,75,84,80, +80,32,73,218,177,99,135,230,204,153,227,109,51,117,234,84,109,218,180,169, +91,235,52,101,202,20,141,24,49,66,251,246,237,211,144,33,67,20,12,6,21, +141,70,149,150,150,166,80,40,212,230,123,250,244,233,163,233,211,167,75, +146,62,252,240,67,85,86,86,234,196,137,19,26,55,110,156,238,184,227,14, +125,243,205,55,58,121,242,164,54,108,216,160,220,220,92,111,219,246,44, +93,186,84,193,96,80,146,52,122,244,104,239,245,210,210,82,253,248,227,143, +41,219,102,101,101,105,225,194,133,58,113,226,132,126,255,253,119,73,210, +229,203,151,189,242,226,226,98,189,248,226,139,106,110,110,214,202,149, +43,219,13,197,246,140,26,53,74,126,191,95,62,159,79,247,223,127,191,247, +25,55,162,46,4,10,112,157,24,99,148,72,36,90,141,100,234,140,230,230,230, +148,32,106,185,143,55,222,120,67,203,150,45,211,240,225,195,181,121,243, +102,229,230,230,166,92,229,187,48,138,197,98,222,137,164,95,191,126,186, +112,225,66,135,229,78,69,69,133,190,251,238,59,149,148,148,104,222,188, +121,222,235,15,61,244,144,134,13,27,230,253,156,151,151,215,237,117,202, +200,200,208,222,189,123,245,237,183,223,170,161,161,65,62,159,79,147,39, +79,214,136,17,35,58,28,9,151,60,250,44,185,21,245,212,83,79,105,209,162, +69,154,51,103,142,170,171,171,53,127,254,124,101,102,102,118,184,143,185, +115,231,42,63,63,223,251,217,213,175,165,79,62,249,68,207,60,243,140,198, +142,29,171,119,222,121,71,95,127,253,181,222,124,243,205,54,183,77,75,75, +83,32,16,232,244,223,68,87,253,147,234,66,160,0,127,83,73,73,137,142,31, +63,174,120,60,174,64,32,32,73,154,52,105,146,150,45,91,166,143,62,250,72, +195,135,15,87,97,97,161,222,123,239,61,173,89,179,70,125,251,246,149,244, +215,144,206,234,234,106,221,125,247,221,109,238,247,193,7,31,212,151,95, +126,169,96,48,168,177,99,199,106,205,154,53,222,137,114,204,152,49,202, +203,203,211,225,195,135,181,106,213,42,157,62,125,90,209,104,84,163,70, +141,82,126,126,254,21,203,221,109,16,119,11,100,197,138,21,202,200,200, +240,62,187,160,160,192,107,173,92,207,58,85,84,84,40,43,43,75,181,181,181, +90,185,114,165,36,233,165,151,94,106,247,216,95,190,124,89,59,118,236,208, +222,189,123,245,219,111,191,169,180,180,84,131,6,13,146,36,205,152,49,67, +75,151,46,213,142,29,59,58,117,187,75,146,94,125,245,85,47,116,138,139, +139,245,216,99,143,181,185,221,169,83,167,188,214,194,128,1,3,188,91,106, +87,227,248,241,227,218,178,101,139,247,243,7,31,124,160,7,30,120,64,165, +165,165,157,122,255,181,172,203,13,71,151,44,110,118,110,52,210,230,205, +155,83,94,95,183,110,157,237,219,183,175,215,17,90,84,84,148,210,33,254, +217,103,159,89,99,140,93,182,108,89,219,29,148,237,12,235,221,185,115,167, +215,169,95,84,84,148,50,132,247,151,95,126,73,233,244,239,168,252,149,87, +94,241,134,230,118,186,211,180,155,235,52,102,204,24,175,172,180,180,212, +126,250,233,167,29,14,135,205,201,201,177,57,57,57,214,24,99,75,74,74,236, +254,253,251,83,182,155,62,125,186,53,198,216,178,178,178,171,26,54,220, +222,176,219,83,167,78,217,219,111,191,221,171,195,132,9,19,172,49,198,46, +95,190,188,205,247,100,102,102,218,204,204,204,46,15,27,206,205,205,181, +129,64,160,195,33,192,215,178,46,55,154,207,254,83,219,78,192,117,114,234, +212,41,13,29,58,84,119,222,121,167,126,248,225,7,165,165,165,165,220,182, +58,123,246,172,18,137,132,250,245,235,231,221,222,106,106,106,210,200,145, +35,85,85,85,165,170,170,42,221,122,235,173,87,245,217,205,205,205,170,174, +174,86,32,16,208,109,183,221,214,229,242,238,240,119,234,116,241,226,69, +213,215,215,43,59,59,219,235,176,191,146,88,44,166,250,250,122,21,21,21, +181,186,125,56,105,210,36,109,223,190,93,235,215,175,191,98,255,73,87,197, +227,113,213,212,212,168,184,184,56,101,176,194,141,240,79,170,11,45,20, +224,111,90,190,124,185,53,198,216,23,94,120,161,83,219,207,155,55,239,31, +61,124,243,191,224,215,95,127,181,105,105,105,182,168,168,200,198,98,49, +14,200,191,0,45,20,64,127,77,145,177,111,223,62,89,107,117,239,189,247, +94,113,234,149,3,7,14,200,231,243,105,228,200,145,157,26,137,133,174,171, +171,171,211,201,147,39,149,151,151,167,193,131,7,115,64,254,5,8,20,0,192, +53,193,131,141,0,0,2,5,0,64,160,0,0,8,20,0,0,8,20,0,0,129,2,0,32,80,0,0, +4,10,0,0,4,10,0,224,186,249,31,206,193,175,27,66,23,59,87,0,0,0,0,73,69, +78,68,174,66,96,130}; -static size_t xml_res_size_14 = 720; -static unsigned char xml_res_file_14[] = { +static size_t xml_res_size_13 = 720; +static unsigned char xml_res_file_13[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, 116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, @@ -3572,8 +3527,8 @@ static unsigned char xml_res_file_14[] = { 195,73,210,141,231,239,216,212,128,254,155,88,219,10,51,245,250,119,224, 151,0,3,0,73,108,255,70,11,2,77,132,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_15 = 343; -static unsigned char xml_res_file_15[] = { +static size_t xml_res_size_14 = 343; +static unsigned char xml_res_file_14[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,4,0,0, 0,181,250,55,234,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, 116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, @@ -3592,8 +3547,8 @@ static unsigned char xml_res_file_15[] = { 204,244,11,73,138,20,0,0,74,61,15,164,165,85,127,138,0,0,0,0,73,69,78,68, 174,66,96,130}; -static size_t xml_res_size_16 = 612; -static unsigned char xml_res_file_16[] = { +static size_t xml_res_size_15 = 612; +static unsigned char xml_res_file_15[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, 116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, @@ -3624,8 +3579,8 @@ static unsigned char xml_res_file_16[] = { 14,93,233,89,93,122,211,8,238,78,187,94,78,93,184,53,80,190,244,66,74,58, 126,3,149,204,48,103,29,102,159,90,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_17 = 741; -static unsigned char xml_res_file_17[] = { +static size_t xml_res_size_16 = 741; +static unsigned char xml_res_file_16[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, 116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, @@ -3663,8 +3618,8 @@ static unsigned char xml_res_file_17[] = { 188,52,141,34,13,227,222,239,247,155,231,210,140,208,246,13,152,31,55,146, 252,22,96,0,250,23,250,89,72,171,80,164,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_18 = 735; -static unsigned char xml_res_file_18[] = { +static size_t xml_res_size_17 = 735; +static unsigned char xml_res_file_17[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, 116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, @@ -3702,8 +3657,8 @@ static unsigned char xml_res_file_18[] = { 230,186,210,35,180,99,13,230,135,181,36,127,4,24,0,102,248,243,212,92,203, 78,83,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_19 = 622; -static unsigned char xml_res_file_19[] = { +static size_t xml_res_size_18 = 622; +static unsigned char xml_res_file_18[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, 68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,11,19,0, @@ -3734,8 +3689,8 @@ static unsigned char xml_res_file_19[] = { 131,219,43,92,67,51,214,168,1,183,24,251,0,166,27,177,223,175,90,235,36, 254,1,254,15,231,231,104,170,7,155,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_20 = 637; -static unsigned char xml_res_file_20[] = { +static size_t xml_res_size_19 = 637; +static unsigned char xml_res_file_19[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, 68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,11,19,0, @@ -3767,8 +3722,8 @@ static unsigned char xml_res_file_20[] = { 216,51,34,118,152,136,125,32,98,224,97,193,171,55,239,162,30,125,145,124, 49,74,88,3,141,58,197,31,222,122,32,138,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_21 = 646; -static unsigned char xml_res_file_21[] = { +static size_t xml_res_size_20 = 646; +static unsigned char xml_res_file_20[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, 68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,11,19,0, @@ -3801,8 +3756,8 @@ static unsigned char xml_res_file_21[] = { 233,94,208,163,35,144,47,4,9,255,0,40,93,199,115,184,226,222,190,0,0,0, 0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_22 = 518; -static unsigned char xml_res_file_22[] = { +static size_t xml_res_size_21 = 518; +static unsigned char xml_res_file_21[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, 116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, @@ -3828,8 +3783,8 @@ static unsigned char xml_res_file_22[] = { 144,116,2,177,154,25,35,78,33,26,65,161,202,140,108,13,35,165,217,25,32, 192,0,17,230,128,36,111,223,157,67,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_23 = 1000; -static unsigned char xml_res_file_23[] = { +static size_t xml_res_size_22 = 1000; +static unsigned char xml_res_file_22[] = { 47,42,32,88,80,77,32,42,47,13,10,115,116,97,116,105,99,32,99,111,110,115, 116,32,99,104,97,114,32,42,101,110,117,109,101,101,95,120,112,109,91,93, 32,61,32,123,13,10,47,42,32,99,111,108,117,109,110,115,32,114,111,119,115, @@ -3874,8 +3829,8 @@ static unsigned char xml_res_file_23[] = { 32,32,32,32,32,32,32,32,32,32,34,44,13,10,34,32,32,32,32,32,32,32,32,32, 32,32,32,32,32,32,32,34,13,10,125,59,13,10}; -static size_t xml_res_size_24 = 670; -static unsigned char xml_res_file_24[] = { +static size_t xml_res_size_23 = 670; +static unsigned char xml_res_file_23[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, 116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, @@ -3910,8 +3865,8 @@ static unsigned char xml_res_file_24[] = { 39,6,155,8,26,40,14,214,253,35,192,0,231,226,246,206,35,110,198,207,0,0, 0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_25 = 549; -static unsigned char xml_res_file_25[] = { +static size_t xml_res_size_24 = 549; +static unsigned char xml_res_file_24[] = { 47,42,32,88,80,77,32,42,47,13,10,115,116,97,116,105,99,32,99,111,110,115, 116,32,99,104,97,114,32,42,105,109,97,103,101,95,120,112,109,91,93,32,61, 32,123,13,10,47,42,32,119,105,100,116,104,32,104,101,105,103,104,116,32, @@ -3938,49 +3893,42 @@ static unsigned char xml_res_file_25[] = { 88,88,88,88,88,88,88,88,88,34,44,13,10,34,88,88,88,88,88,88,88,88,88,88, 88,88,88,88,88,88,34,13,10,125,59,13,10}; -static size_t xml_res_size_26 = 795; -static unsigned char xml_res_file_26[] = { +static size_t xml_res_size_25 = 649; +static unsigned char xml_res_file_25[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, -0,31,243,255,97,0,0,0,43,116,69,88,116,67,114,101,97,116,105,111,110,32, -84,105,109,101,0,68,105,32,49,56,32,70,101,98,32,50,48,48,51,32,50,50,58, -49,56,58,49,56,32,43,48,49,48,48,192,42,207,180,0,0,0,7,116,73,77,69,7, -211,2,18,23,42,28,186,173,45,199,0,0,0,9,112,72,89,115,0,0,11,18,0,0,11, -18,1,210,221,126,252,0,0,0,4,103,65,77,65,0,0,177,143,11,252,97,5,0,0,2, -115,73,68,65,84,120,218,165,147,59,104,84,81,16,134,255,115,119,207,221, -187,107,178,185,228,129,10,33,10,129,96,68,83,136,81,68,132,20,22,22,90, -88,5,44,4,203,104,33,46,129,20,193,70,144,84,10,10,10,1,17,31,141,168,101, -42,193,34,88,248,150,16,67,82,152,37,201,26,214,108,30,119,111,246,238, -125,63,142,115,179,184,236,34,169,50,112,138,225,204,124,103,230,159,57, -192,30,141,53,58,107,111,193,215,32,143,43,109,222,128,8,208,27,4,56,28, -186,112,92,7,235,65,176,175,100,252,246,102,46,220,246,71,119,5,204,78, -226,228,241,203,248,10,85,5,18,29,128,148,133,169,13,32,63,253,93,172,46, -44,67,43,85,217,65,21,93,231,239,96,243,95,78,178,17,192,3,68,214,60,160, -200,58,161,117,72,41,160,108,181,66,251,53,199,168,34,112,14,161,21,97, -54,230,52,1,42,33,2,189,2,164,40,145,81,109,220,2,130,200,0,147,106,126, -139,2,255,226,61,56,187,2,92,23,190,97,0,190,95,243,101,30,87,96,192,34, -144,227,82,71,193,206,235,226,63,128,152,128,244,41,131,51,73,142,43,6, -85,224,208,27,73,186,225,116,180,205,42,42,4,181,9,226,218,112,230,30,33, -115,236,6,172,38,17,231,223,75,159,251,14,169,167,18,182,134,21,210,96, -113,105,167,26,180,182,0,203,133,52,137,103,163,239,52,112,116,16,48,183, -224,147,86,63,138,139,120,49,52,134,199,59,148,226,52,202,194,101,66,136, -126,33,162,33,225,231,207,137,231,183,16,229,134,33,190,188,102,34,20,93, -116,151,17,182,14,225,233,7,162,159,83,61,209,147,17,182,81,111,193,40, -192,108,103,66,229,169,5,72,221,171,248,246,161,27,50,3,235,239,5,6,79, -80,203,139,20,171,238,135,210,121,21,31,39,167,88,105,165,0,73,130,94,7, -108,111,195,220,216,162,209,147,151,245,2,18,209,7,45,17,218,169,133,106, -161,166,154,82,44,33,217,51,75,129,171,224,52,37,2,104,117,64,185,10,51, -185,89,83,221,117,109,225,217,78,172,58,235,160,241,173,211,227,241,24, -83,50,221,203,6,28,15,240,66,32,140,26,0,204,197,179,165,60,142,40,25,164, -179,109,228,154,21,17,82,80,68,193,127,214,106,123,161,208,73,4,101,81, -53,193,130,8,113,133,243,77,171,252,110,28,157,186,133,17,211,199,245,180, -204,178,44,20,19,109,42,52,211,66,46,161,160,55,158,136,224,89,177,146, -175,196,11,117,191,123,29,99,103,95,34,108,250,11,177,189,201,129,87,117, -164,175,61,69,37,246,239,62,128,212,53,131,75,137,52,110,146,24,125,45, -28,163,195,15,241,106,175,191,184,110,127,1,232,120,24,169,145,10,79,3, -0,0,0,0,73,69,78,68,174,66,96,130}; +0,31,243,255,97,0,0,0,4,115,66,73,84,8,8,8,8,124,8,100,136,0,0,0,9,112, +72,89,115,0,0,1,187,0,0,1,187,1,58,236,227,226,0,0,0,25,116,69,88,116,83, +111,102,116,119,97,114,101,0,119,119,119,46,105,110,107,115,99,97,112,101, +46,111,114,103,155,238,60,26,0,0,2,6,73,68,65,84,56,141,165,147,79,72,20, +113,20,199,63,239,55,191,217,153,157,102,182,117,77,179,130,32,144,77,212, +178,91,132,20,132,151,138,40,234,16,117,242,16,33,25,84,215,186,86,151, +14,66,167,232,20,225,33,130,78,65,16,145,21,101,4,6,146,80,135,140,200, +80,65,211,82,106,103,149,217,153,249,117,82,83,183,40,124,240,46,239,251, +222,151,239,251,39,198,24,214,98,26,160,247,213,204,93,173,204,73,0,3,83, +63,203,28,239,234,40,244,255,11,129,24,99,184,245,116,170,63,163,105,95, +8,166,70,72,210,191,43,75,82,121,120,182,99,195,97,233,190,253,233,114, +28,39,23,140,73,235,255,71,186,136,250,170,181,117,67,207,150,237,46,91, +103,242,242,59,90,137,216,178,62,66,3,35,51,17,226,20,86,17,24,67,190,84, +54,93,218,247,188,146,165,150,128,86,127,148,189,77,62,19,99,99,244,245, +15,224,199,89,226,154,54,212,198,182,42,109,80,210,190,231,134,130,129, +104,150,220,183,151,76,126,30,70,53,157,34,168,169,163,210,220,141,43,22, +136,172,42,6,48,72,168,130,172,46,121,174,194,177,225,208,190,22,198,77, +145,155,143,199,249,94,138,153,28,188,135,231,42,60,71,86,187,171,8,178, +186,36,215,159,204,63,136,227,244,128,49,198,78,226,8,75,103,0,152,30,25, +226,76,123,142,59,125,111,201,53,29,171,50,68,169,104,173,30,105,223,181, +194,168,146,42,99,4,28,103,49,97,235,246,93,244,222,191,196,14,127,128, +143,95,178,228,139,7,87,16,160,50,182,21,106,223,147,112,110,94,41,170, +92,100,126,103,39,51,239,6,169,11,123,136,26,26,89,87,87,92,182,199,172, +43,161,10,28,202,158,35,226,185,138,149,190,121,91,11,163,178,159,218,92, +74,60,116,5,215,78,151,112,71,36,112,40,235,145,137,31,161,101,103,168, +166,0,96,83,251,121,62,188,24,166,185,48,202,251,231,61,212,238,190,184, +216,195,244,108,24,10,224,1,123,128,108,85,6,160,181,88,223,216,121,180, +225,90,224,105,125,238,234,224,137,36,33,1,230,128,215,218,24,83,6,250, +254,84,188,96,167,143,20,222,100,130,66,38,142,205,179,101,195,92,235,59, +255,2,240,138,183,135,205,242,179,133,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_27 = 688; -static unsigned char xml_res_file_27[] = { +static size_t xml_res_size_26 = 688; +static unsigned char xml_res_file_26[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,43,116,69,88,116,67,114,101,97,116,105,111,110,32, 84,105,109,101,0,68,105,32,49,56,32,70,101,98,32,50,48,48,51,32,50,49,58, @@ -4015,8 +3963,8 @@ static unsigned char xml_res_file_27[] = { 197,156,60,95,243,50,249,128,255,95,191,0,245,142,251,88,112,106,209,242, 0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_28 = 514; -static unsigned char xml_res_file_28[] = { +static size_t xml_res_size_27 = 514; +static unsigned char xml_res_file_27[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, 116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, @@ -4043,8 +3991,8 @@ static unsigned char xml_res_file_28[] = { 20,70,145,95,1,6,0,60,10,174,84,253,86,25,93,0,0,0,0,73,69,78,68,174,66, 96,130}; -static size_t xml_res_size_29 = 713; -static unsigned char xml_res_file_29[] = { +static size_t xml_res_size_28 = 713; +static unsigned char xml_res_file_28[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, 116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, @@ -4081,8 +4029,8 @@ static unsigned char xml_res_file_29[] = { 32,177,182,238,95,1,6,0,177,199,15,69,241,57,108,150,0,0,0,0,73,69,78,68, 174,66,96,130}; -static size_t xml_res_size_30 = 705; -static unsigned char xml_res_file_30[] = { +static size_t xml_res_size_29 = 705; +static unsigned char xml_res_file_29[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,43,116,69,88,116,67,114,101,97,116,105,111,110,32, 84,105,109,101,0,77,111,32,50,52,32,70,101,98,32,50,48,48,51,32,49,55,58, @@ -4118,204 +4066,58 @@ static unsigned char xml_res_file_30[] = { 196,182,183,241,127,163,217,42,88,252,1,243,93,220,79,105,182,126,216,0, 0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_31 = 741; -static unsigned char xml_res_file_31[] = { -137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, -0,31,243,255,97,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, -68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,11,18,0, -0,11,18,1,210,221,126,252,0,0,0,7,116,73,77,69,7,216,3,13,15,17,21,178, -43,22,41,0,0,2,101,73,68,65,84,56,203,173,211,61,72,85,113,24,199,241,239, -255,220,123,238,185,222,124,185,190,33,130,145,100,153,81,68,67,132,22, -13,13,213,16,77,74,67,67,80,67,96,139,36,66,131,75,155,77,185,68,80,208, -11,181,4,53,56,53,4,6,26,66,33,74,17,24,70,154,168,233,189,122,223,239, -57,247,188,252,255,247,156,6,73,188,133,83,61,219,51,252,62,195,143,231, -129,127,28,81,177,221,90,215,15,27,169,225,150,184,126,76,150,131,14,71, -170,118,199,86,142,43,213,134,46,85,114,105,197,249,100,143,157,29,218, -29,184,62,127,162,175,175,115,122,127,61,196,67,80,167,195,70,202,102,108, -106,41,248,182,176,137,157,46,8,76,163,153,201,243,169,223,145,112,5,224, -248,254,235,185,18,24,209,45,218,208,56,93,72,240,121,102,89,32,20,120, -94,192,98,201,218,25,169,4,130,130,194,44,128,103,131,16,96,71,176,204, -18,248,30,148,21,248,134,100,181,215,217,29,48,235,36,89,7,98,30,136,0, -244,8,102,222,6,41,65,41,112,13,11,8,254,2,130,17,180,217,106,122,106,163, -93,87,142,78,191,199,117,91,65,119,65,119,49,243,69,240,20,20,5,120,9,135, -71,196,184,65,169,162,196,185,113,237,227,161,125,241,147,154,151,225,241, -196,25,238,76,94,101,53,125,28,246,8,200,101,96,45,67,199,197,89,218,123, -223,144,204,167,164,169,252,217,228,207,204,115,187,95,61,16,0,107,19,100, -91,187,69,156,72,39,80,7,43,69,198,31,126,13,6,178,23,68,203,145,83,92, -190,185,136,71,137,84,94,1,161,96,124,250,11,83,227,243,105,238,210,28, -6,40,46,99,53,136,32,174,27,243,104,109,53,124,120,215,134,103,33,14,116, -207,176,183,103,147,197,239,53,52,196,27,57,216,212,74,255,253,167,194, -76,216,160,200,109,119,144,207,99,109,166,33,20,134,90,79,33,165,68,73, -72,120,62,153,165,12,53,161,34,213,235,73,210,109,5,204,85,123,43,37,201, -108,3,89,19,43,156,130,136,14,174,107,7,158,237,160,60,196,146,83,196,79, -123,212,135,34,84,71,34,40,61,10,62,32,129,242,14,64,184,60,251,177,64, -87,52,70,85,109,29,194,181,10,129,31,128,155,150,228,164,36,21,21,24,70, -136,82,89,11,40,35,80,128,98,174,226,148,223,14,211,148,43,209,111,73,110, -86,69,68,109,163,10,70,206,181,147,33,197,32,97,58,168,130,154,88,52,40, -46,58,16,230,30,27,220,230,5,101,241,231,119,189,26,68,55,115,84,93,123, -66,1,128,81,52,86,184,132,100,0,141,78,52,134,24,229,37,255,107,126,1,216, -134,35,14,171,220,211,236,0,0,0,0,73,69,78,68,174,66,96,130}; - -static size_t xml_res_size_32 = 626; -static unsigned char xml_res_file_32[] = { -137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, -0,31,243,255,97,0,0,2,57,73,68,65,84,56,141,125,147,203,107,83,65,20,198, -191,153,59,121,52,109,111,233,75,180,86,11,190,136,171,90,234,90,220,168, -43,221,41,5,209,165,75,55,5,253,47,132,42,130,127,129,116,33,138,11,81, -187,209,69,23,10,5,139,98,155,130,149,90,49,196,214,52,185,55,143,155,185, -51,115,142,139,152,144,74,154,217,205,153,57,191,243,157,243,205,8,34,70, -175,245,244,227,230,144,146,114,44,165,228,145,254,116,98,50,149,240,166, -152,229,233,149,31,165,212,252,165,51,183,84,183,164,165,181,252,252,169, -67,254,149,254,164,55,113,117,250,248,120,82,201,145,148,242,84,24,19,202, -154,160,60,137,237,10,109,3,64,87,192,201,241,193,155,39,198,6,102,58,99, -229,134,69,174,104,225,103,20,210,196,168,105,215,0,0,217,13,208,176,174, -6,0,196,205,246,34,109,240,232,125,17,53,195,168,197,140,74,76,168,199, -205,179,174,10,220,127,115,137,28,1,96,52,12,67,74,134,39,24,145,233,1, -176,142,208,82,32,133,104,199,181,99,176,97,72,38,104,67,61,0,29,10,136, -25,173,173,54,132,152,28,4,17,34,221,3,160,173,99,0,96,98,144,4,184,53, -139,152,96,137,161,36,227,79,104,15,6,48,179,215,170,238,65,180,98,8,234, -22,66,72,68,134,17,132,14,64,23,23,110,47,188,190,51,115,108,244,156,177, -205,11,206,17,26,198,193,17,227,219,175,6,118,67,139,239,5,141,216,118, -0,252,236,156,231,103,231,146,153,201,203,106,160,47,117,113,48,157,200, -196,142,160,29,33,212,77,169,55,102,210,32,34,108,21,98,68,145,3,217,253, -46,248,0,70,32,164,142,141,243,8,64,85,219,246,59,80,82,64,74,129,98,153, -1,233,160,148,0,192,201,206,22,42,255,96,71,29,81,31,17,181,147,91,14,248, -169,4,132,16,176,198,161,84,50,245,189,32,185,214,86,16,230,22,173,159, -157,171,128,105,42,161,188,97,37,37,136,129,98,77,99,175,170,97,137,182, -62,172,255,92,41,149,71,47,172,127,138,151,227,64,127,101,150,79,246,13, -49,204,45,230,189,244,192,234,219,151,239,30,63,120,243,249,213,70,33,120, -177,249,59,188,235,152,103,159,47,111,156,189,127,237,252,117,99,81,140, -118,130,85,157,127,182,176,179,52,157,7,0,113,208,119,222,173,54,144,43, -4,0,128,225,76,18,217,195,67,24,159,189,55,193,54,174,151,191,60,44,3,128, -16,192,95,51,173,68,130,10,33,137,220,0,0,0,0,73,69,78,68,174,66,96,130}; - -static size_t xml_res_size_33 = 587; -static unsigned char xml_res_file_33[] = { -137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, -0,31,243,255,97,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, -116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, -97,103,101,82,101,97,100,121,113,201,101,60,0,0,1,221,73,68,65,84,56,203, -141,147,75,75,227,96,20,134,157,249,29,10,194,236,220,73,7,93,186,116,214, -94,182,138,3,130,130,184,82,156,89,138,160,85,177,56,76,162,86,55,42,130, -218,129,202,160,48,94,16,17,116,225,74,69,81,84,42,82,135,166,73,83,147, -38,189,165,173,190,126,231,27,19,83,47,163,129,135,92,223,39,231,156,228, -43,1,80,66,176,173,148,225,97,84,189,65,57,227,163,147,115,9,60,217,108, -86,207,231,243,183,133,66,1,47,193,238,67,16,132,31,110,137,91,80,69,225, -100,50,137,84,42,229,144,72,36,160,105,26,100,89,230,18,73,146,32,138,162, -35,177,195,31,72,64,15,100,50,25,88,150,197,247,132,105,154,208,117,29, -138,162,112,65,58,157,6,189,196,239,247,255,147,144,160,206,123,254,169, -182,107,115,198,183,44,195,183,28,197,252,86,12,123,167,58,23,80,192,48, -12,196,98,177,103,45,241,153,212,15,93,122,250,130,242,141,176,166,98,252, -143,2,97,69,198,240,239,40,6,3,18,88,75,188,111,187,21,85,85,121,37,145, -72,228,81,208,44,134,3,254,13,21,95,186,183,151,108,243,220,186,130,158, -217,191,208,12,171,72,66,149,208,60,226,241,248,163,160,127,73,198,8,43, -189,178,97,226,187,187,188,32,107,131,4,116,108,75,168,29,154,9,137,28, -65,223,47,9,253,193,40,42,106,7,58,94,251,124,68,46,151,227,195,37,9,225, -8,218,38,195,33,47,19,84,54,6,4,119,192,59,115,141,163,11,211,57,167,42, -72,64,80,53,142,160,166,243,164,167,119,49,130,175,63,67,198,113,200,132, -150,176,48,48,125,141,246,177,43,28,158,25,60,72,80,5,4,133,139,4,244,25, -171,91,14,190,53,249,46,140,206,169,48,90,197,43,180,140,94,98,97,85,126, -22,118,83,36,176,127,164,221,3,13,59,251,90,81,239,182,228,41,47,10,216, -197,187,255,13,242,9,183,142,224,65,242,153,13,40,69,55,222,19,102,207, -154,124,245,186,4,101,36,121,199,114,182,161,165,95,118,15,78,190,230,162, -107,41,55,70,0,0,0,0,73,69,78,68,174,66,96,130}; - -static size_t xml_res_size_34 = 621; -static unsigned char xml_res_file_34[] = { -137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, -0,31,243,255,97,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, -116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, -97,103,101,82,101,97,100,121,113,201,101,60,0,0,1,255,73,68,65,84,56,203, -141,147,205,107,19,81,20,197,171,127,135,5,193,93,119,37,82,151,46,235, -90,235,86,169,32,40,72,87,74,219,149,74,161,141,138,81,113,70,141,110,140, -72,171,17,83,66,5,109,139,136,80,65,55,181,11,177,69,73,73,167,154,249, -140,243,149,201,204,36,169,199,119,159,206,100,210,70,218,129,195,188,153, -247,238,111,238,185,119,110,15,128,30,18,187,14,48,165,152,6,118,209,65, -166,253,113,92,2,144,10,130,192,106,54,155,91,173,86,11,221,196,246,33, -8,194,157,36,36,9,24,160,224,90,173,6,207,243,98,217,182,13,211,52,161, -170,42,135,200,178,12,81,20,99,72,20,188,143,0,116,192,247,125,132,97,200, -239,36,215,117,97,89,22,52,77,227,128,122,189,14,250,72,54,155,253,11,33, -192,241,244,183,67,131,23,223,230,50,115,42,50,115,10,102,222,233,248,180, -106,113,0,5,56,142,3,93,215,119,88,226,53,57,113,125,61,53,81,80,127,9, -243,6,238,191,214,32,188,82,113,163,168,224,90,94,6,179,196,125,71,86,12, -195,224,153,84,42,149,54,224,180,40,229,179,139,6,142,93,122,63,27,145, -159,46,104,24,125,242,3,186,25,160,248,209,224,16,219,169,225,229,146,194, -235,81,173,86,219,128,201,89,21,55,89,234,253,67,15,198,147,233,21,152, -13,165,26,224,202,180,196,51,177,92,31,151,167,55,120,77,200,82,12,152, -120,33,99,178,160,160,111,112,234,66,18,112,171,248,19,99,185,114,87,173, -73,118,27,112,238,161,84,74,51,64,255,201,188,144,4,164,115,155,88,94,115, -120,6,244,236,214,67,182,222,224,29,34,75,49,224,232,200,215,209,171,207, -43,56,115,183,228,124,41,185,48,237,16,83,143,55,113,254,94,25,203,171, -54,175,1,89,240,252,144,173,117,30,220,1,160,54,30,25,94,25,59,149,249, -238,140,60,146,112,86,44,99,248,246,58,158,189,81,121,32,169,209,104,236, -80,7,32,250,145,62,172,152,88,250,108,118,244,58,130,108,87,87,0,123,249, -251,127,115,208,69,91,49,224,31,228,48,43,144,71,27,123,9,102,103,93,62, -189,9,64,47,65,246,48,206,145,104,244,123,255,0,61,247,217,210,167,139, -213,231,0,0,0,0,73,69,78,68,174,66,96,130}; - -static size_t xml_res_size_35 = 603; -static unsigned char xml_res_file_35[] = { +static size_t xml_res_size_30 = 545; +static unsigned char xml_res_file_30[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, -0,31,243,255,97,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, -116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, -97,103,101,82,101,97,100,121,113,201,101,60,0,0,1,237,73,68,65,84,56,203, -141,147,75,75,220,80,20,199,181,223,192,189,3,253,14,202,124,129,82,55, -133,66,55,110,68,232,182,48,203,66,17,169,82,209,58,11,17,212,12,116,68, -161,160,160,214,71,41,138,138,5,177,32,142,207,133,160,125,104,17,84,38, -49,201,164,121,103,158,246,223,123,110,205,37,197,72,13,252,8,201,61,231, -119,207,57,112,234,0,212,17,236,105,100,52,49,146,255,225,33,227,129,200, -139,8,154,74,165,146,85,173,86,175,107,181,26,226,96,231,144,36,105,40, -42,137,10,146,148,236,121,30,124,223,23,216,182,13,211,52,161,170,42,151, -40,138,130,76,38,35,36,97,114,61,9,40,160,88,44,162,92,46,243,55,225,186, -46,44,203,130,166,105,92,16,4,1,232,146,108,54,251,87,18,10,90,82,82,106, -245,216,195,251,45,11,167,138,47,36,148,224,56,14,116,93,191,213,18,159, -73,40,120,244,98,36,53,190,105,49,129,141,195,139,128,7,176,150,120,223, -97,43,133,66,129,87,34,203,242,109,1,125,140,109,154,188,130,133,61,11, -115,59,38,102,115,38,76,183,44,36,84,9,205,195,48,140,120,193,187,141,95, -152,200,89,144,214,13,244,47,105,24,90,43,64,90,214,69,37,212,14,205,132, -68,177,130,225,207,6,70,24,95,142,29,236,255,244,240,246,147,134,158,121, -133,7,87,42,21,62,23,146,16,177,130,193,21,29,3,236,198,253,83,15,123,39, -46,222,44,168,232,158,86,196,60,72,64,80,53,66,208,154,185,76,15,172,234, -72,62,31,239,72,47,170,72,47,234,60,121,247,187,139,174,217,43,188,158, -202,243,100,170,128,160,228,127,4,237,163,249,15,131,76,240,180,255,96, -157,74,238,253,168,226,213,148,140,151,147,121,116,206,200,232,152,150, -49,191,161,11,65,136,16,60,233,59,107,104,233,58,121,156,104,110,123,182, -251,131,221,252,205,197,206,87,7,219,4,155,69,238,200,198,249,85,192,171, -136,18,59,3,246,243,247,93,123,16,195,181,16,220,72,154,217,128,124,58, -184,79,50,139,117,249,246,70,4,9,146,220,99,157,67,104,245,19,127,0,89, -147,194,83,251,77,141,110,0,0,0,0,73,69,78,68,174,66,96,130}; +0,31,243,255,97,0,0,0,4,115,66,73,84,8,8,8,8,124,8,100,136,0,0,0,9,112, +72,89,115,0,0,1,187,0,0,1,187,1,58,236,227,226,0,0,0,25,116,69,88,116,83, +111,102,116,119,97,114,101,0,119,119,119,46,105,110,107,115,99,97,112,101, +46,111,114,103,155,238,60,26,0,0,1,158,73,68,65,84,56,141,165,147,63,111, +19,65,20,196,127,179,251,238,206,127,33,1,228,2,129,76,65,67,69,36,10,132, +40,211,82,81,81,211,88,84,244,124,11,202,212,20,124,2,90,36,164,32,16,18, +31,0,80,2,20,8,130,45,72,204,157,99,240,221,46,5,142,108,147,200,16,101, +170,167,221,121,163,217,55,111,21,99,228,36,48,128,71,207,191,63,54,23, +239,0,68,232,255,24,113,187,183,126,102,243,127,4,20,99,100,227,105,127, +51,53,110,30,28,134,40,170,176,220,89,21,244,228,222,250,185,91,186,187, +177,245,64,148,247,67,12,157,227,88,119,114,95,35,246,208,118,199,214,75, +124,178,226,116,156,118,8,145,149,73,21,123,182,218,110,230,94,192,17,2, +157,83,30,1,59,195,234,240,101,132,42,146,219,233,102,173,16,139,239,77, +77,172,93,52,46,119,60,78,176,221,175,120,253,177,228,103,25,255,210,80, +97,237,186,229,33,86,48,141,179,123,214,115,173,107,212,19,225,4,18,172, +117,141,43,231,141,87,239,39,108,245,167,110,36,156,124,110,205,6,121,89, +74,7,235,176,147,7,86,155,194,107,38,224,4,205,20,62,13,3,181,76,211,126, +201,140,220,90,53,95,252,154,4,23,227,108,8,153,137,212,196,231,189,192, +32,15,92,189,96,132,8,141,108,198,145,112,105,226,11,107,53,84,236,143, +157,99,110,35,19,47,234,9,236,141,3,111,250,21,215,47,25,101,88,20,64,114, +245,154,10,107,103,140,20,165,249,24,182,191,5,82,131,98,2,141,154,227, +237,32,48,169,254,212,115,80,43,99,100,31,190,12,11,159,164,204,59,120, +153,47,38,246,236,221,225,20,145,24,236,22,133,128,6,112,3,168,31,65,91, +134,125,224,133,78,250,27,221,191,41,203,241,27,35,191,152,22,126,165,13, +36,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_36 = 551; -static unsigned char xml_res_file_36[] = { +static size_t xml_res_size_31 = 385; +static unsigned char xml_res_file_31[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, -0,31,243,255,97,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, -68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,11,19,0, -0,11,19,1,0,154,156,24,0,0,0,7,116,73,77,69,7,216,3,17,15,31,22,175,110, -130,58,0,0,1,167,73,68,65,84,56,203,141,147,49,143,218,64,16,133,223,56, -112,210,41,29,41,40,46,72,20,52,80,33,5,146,50,29,255,239,126,5,66,226, -23,92,159,34,74,73,68,69,21,26,18,9,136,100,97,179,236,204,188,20,103,54, -54,119,138,178,210,200,94,107,223,183,111,223,120,133,36,68,228,61,128, -46,128,55,248,247,248,5,224,7,73,79,95,72,2,192,135,203,229,242,91,85,77, -85,121,91,102,198,16,2,231,243,249,35,128,62,128,140,228,179,182,2,124, -84,85,43,138,130,101,89,166,58,157,78,204,243,156,135,195,129,170,202,253, -126,207,197,98,209,128,0,128,84,0,134,16,24,99,100,8,129,33,132,4,56,30, -143,52,51,158,207,103,22,69,193,229,114,249,8,160,79,18,82,1,166,170,250, -213,221,177,90,173,16,99,76,101,102,80,85,204,102,179,250,145,209,106,181, -62,1,248,214,186,102,33,34,200,178,12,227,241,56,45,116,119,152,25,204, -12,121,158,167,121,167,211,73,25,182,110,99,94,175,215,80,85,152,25,98, -140,80,213,36,116,119,76,167,211,228,162,1,168,218,137,209,104,212,152, -187,59,220,29,36,97,102,201,237,11,128,136,128,36,54,155,77,178,237,238, -80,85,92,91,38,34,152,76,38,0,128,217,253,253,187,167,178,108,58,0,128, -193,96,208,0,94,159,238,142,118,187,157,118,126,43,210,126,53,131,237,118, -155,118,191,150,153,165,144,135,195,33,0,224,75,8,251,87,143,208,235,245, -210,123,221,89,213,186,191,255,180,89,124,225,64,68,176,219,237,82,88,102, -214,0,101,89,134,126,191,223,112,92,7,16,128,116,187,221,134,131,186,59, -198,216,16,127,127,120,96,198,231,149,110,102,37,0,175,139,110,91,140,16, -234,122,171,59,248,121,119,119,247,25,64,134,255,27,86,93,109,252,1,60, -89,113,107,57,235,254,63,0,0,0,0,73,69,78,68,174,66,96,130}; +0,31,243,255,97,0,0,0,4,115,66,73,84,8,8,8,8,124,8,100,136,0,0,0,9,112, +72,89,115,0,0,1,187,0,0,1,187,1,58,236,227,226,0,0,0,25,116,69,88,116,83, +111,102,116,119,97,114,101,0,119,119,119,46,105,110,107,115,99,97,112,101, +46,111,114,103,155,238,60,26,0,0,0,254,73,68,65,84,56,141,165,147,49,74, +4,65,16,69,95,85,87,247,184,139,224,38,154,9,30,66,16,175,32,27,25,121, +131,13,205,4,61,131,27,120,4,35,79,160,136,169,130,153,232,29,140,220,116, +122,71,103,123,166,205,4,19,177,103,127,254,127,189,42,234,75,206,153,117, +100,0,47,15,231,55,166,118,2,208,195,226,235,115,121,124,48,157,63,253, +59,64,186,180,43,170,0,56,216,222,168,170,199,215,251,179,63,141,169,239, +111,247,143,46,167,114,119,61,187,16,250,83,200,59,101,240,242,145,209, +43,91,188,191,205,204,108,34,34,69,246,156,243,36,165,52,179,202,187,218, +153,131,194,0,114,198,73,174,45,84,62,170,42,3,8,80,147,104,33,132,186, +112,246,143,12,106,171,188,175,251,220,15,201,16,85,173,45,4,31,187,46, +105,233,59,9,168,115,22,173,26,109,198,213,170,213,1,4,234,125,136,54,222, +218,91,174,82,59,104,5,111,97,105,77,75,244,126,68,105,37,68,160,105,187, +40,192,24,56,4,70,133,4,13,240,44,235,182,113,200,241,126,233,27,81,98, +87,31,74,147,58,41,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_37 = 655; -static unsigned char xml_res_file_37[] = { +static size_t xml_res_size_32 = 655; +static unsigned char xml_res_file_32[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, 116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, @@ -4349,8 +4151,8 @@ static unsigned char xml_res_file_37[] = { 133,99,188,108,253,6,114,187,164,199,219,237,190,20,0,0,0,0,73,69,78,68, 174,66,96,130}; -static size_t xml_res_size_38 = 792; -static unsigned char xml_res_file_38[] = { +static size_t xml_res_size_33 = 792; +static unsigned char xml_res_file_33[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,43,116,69,88,116,67,114,101,97,116,105,111,110,32, 84,105,109,101,0,68,105,32,51,48,32,83,101,112,32,50,48,48,51,32,50,51, @@ -4390,8 +4192,8 @@ static unsigned char xml_res_file_38[] = { 19,58,221,192,171,43,64,104,219,254,222,191,141,62,42,191,243,181,250,120, 0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_39 = 512; -static unsigned char xml_res_file_39[] = { +static size_t xml_res_size_34 = 512; +static unsigned char xml_res_file_34[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,4,0,0, 0,181,250,55,234,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, 116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, @@ -4417,8 +4219,8 @@ static unsigned char xml_res_file_39[] = { 171,222,105,235,182,187,156,255,174,249,107,62,175,71,106,151,220,255,206, 253,13,9,136,93,8,242,153,238,134,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_40 = 3562; -static unsigned char xml_res_file_40[] = { +static size_t xml_res_size_35 = 3562; +static unsigned char xml_res_file_35[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -4594,8 +4396,8 @@ static unsigned char xml_res_file_40[] = { 163,250,140,49,116,148,175,138,192,159,255,14,0,133,61,138,66,189,249,108, 251,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_41 = 675; -static unsigned char xml_res_file_41[] = { +static size_t xml_res_size_36 = 675; +static unsigned char xml_res_file_36[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, 116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, @@ -4629,8 +4431,8 @@ static unsigned char xml_res_file_41[] = { 104,176,7,163,31,71,225,159,223,207,0,55,150,161,246,116,59,244,7,169,146, 115,193,212,214,167,43,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_42 = 444; -static unsigned char xml_res_file_42[] = { +static size_t xml_res_size_37 = 444; +static unsigned char xml_res_file_37[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, 116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, @@ -4654,8 +4456,8 @@ static unsigned char xml_res_file_42[] = { 239,33,205,130,15,118,205,227,18,99,124,149,175,0,0,0,0,73,69,78,68,174, 66,96,130}; -static size_t xml_res_size_43 = 631; -static unsigned char xml_res_file_43[] = { +static size_t xml_res_size_38 = 631; +static unsigned char xml_res_file_38[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, 116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, @@ -4688,8 +4490,8 @@ static unsigned char xml_res_file_43[] = { 223,248,19,19,249,133,146,234,21,229,237,0,0,0,0,73,69,78,68,174,66,96, 130}; -static size_t xml_res_size_44 = 3265; -static unsigned char xml_res_file_44[] = { +static size_t xml_res_size_39 = 3265; +static unsigned char xml_res_file_39[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -4850,8 +4652,8 @@ static unsigned char xml_res_file_44[] = { 179,85,213,239,175,54,53,242,218,239,252,123,0,13,49,44,139,229,229,191, 123,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_45 = 3424; -static unsigned char xml_res_file_45[] = { +static size_t xml_res_size_40 = 3424; +static unsigned char xml_res_file_40[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -5020,8 +4822,8 @@ static unsigned char xml_res_file_45[] = { 111,156,127,14,0,197,187,19,120,112,84,231,143,0,0,0,0,73,69,78,68,174, 66,96,130}; -static size_t xml_res_size_46 = 56752; -static unsigned char xml_res_file_46[] = { +static size_t xml_res_size_41 = 56752; +static unsigned char xml_res_file_41[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,199,0,0,1,90,8,6,0, 0,0,170,138,73,239,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75, 71,68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,14,196, @@ -7828,8 +7630,8 @@ static unsigned char xml_res_file_46[] = { 56,46,235,178,46,198,113,89,151,245,17,235,255,3,170,68,49,97,147,119,15, 95,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_47 = 3692; -static unsigned char xml_res_file_47[] = { +static size_t xml_res_size_42 = 3692; +static unsigned char xml_res_file_42[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -8011,8 +7813,8 @@ static unsigned char xml_res_file_47[] = { 255,250,107,0,227,81,135,82,1,246,232,87,0,0,0,0,73,69,78,68,174,66,96, 130}; -static size_t xml_res_size_48 = 894; -static unsigned char xml_res_file_48[] = { +static size_t xml_res_size_43 = 894; +static unsigned char xml_res_file_43[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,43,116,69,88,116,67,114,101,97,116,105,111,110,32, 84,105,109,101,0,70,114,32,49,50,32,68,101,122,32,50,48,48,51,32,50,49, @@ -8057,8 +7859,8 @@ static unsigned char xml_res_file_48[] = { 15,250,23,121,158,31,145,101,185,91,201,66,112,183,9,222,86,191,1,216,18, 102,195,252,90,176,179,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_49 = 3553; -static unsigned char xml_res_file_49[] = { +static size_t xml_res_size_44 = 3553; +static unsigned char xml_res_file_44[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -8233,8 +8035,8 @@ static unsigned char xml_res_file_49[] = { 198,12,50,153,76,0,108,3,15,128,240,48,225,255,14,0,236,234,131,23,133, 156,177,149,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_50 = 3479; -static unsigned char xml_res_file_50[] = { +static size_t xml_res_size_45 = 3479; +static unsigned char xml_res_file_45[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -8405,8 +8207,8 @@ static unsigned char xml_res_file_50[] = { 183,253,159,245,129,20,72,128,16,144,69,189,1,94,3,151,139,236,0,254,27, 0,117,73,16,195,100,100,116,215,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_51 = 887; -static unsigned char xml_res_file_51[] = { +static size_t xml_res_size_46 = 887; +static unsigned char xml_res_file_46[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,42,116,69,88,116,67,114,101,97,116,105,111,110,32, 84,105,109,101,0,83,111,32,52,32,74,97,110,32,50,48,48,52,32,49,57,58,48, @@ -8451,8 +8253,8 @@ static unsigned char xml_res_file_51[] = { 246,229,127,169,223,158,105,64,153,156,76,148,88,0,0,0,0,73,69,78,68,174, 66,96,130}; -static size_t xml_res_size_52 = 681; -static unsigned char xml_res_file_52[] = { +static size_t xml_res_size_47 = 681; +static unsigned char xml_res_file_47[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,45,116,69,88,116,67,114,101,97,116,105,111,110,32, 84,105,109,101,0,106,101,117,46,32,53,32,100,233,99,46,32,50,48,48,50,32, @@ -8487,8 +8289,8 @@ static unsigned char xml_res_file_52[] = { 176,179,179,225,180,177,182,84,197,149,216,134,17,0,0,4,223,217,134,133, 215,167,132,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_53 = 524; -static unsigned char xml_res_file_53[] = { +static size_t xml_res_size_48 = 524; +static unsigned char xml_res_file_48[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, 116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, @@ -8515,8 +8317,8 @@ static unsigned char xml_res_file_53[] = { 253,235,84,209,163,80,121,119,156,202,124,203,84,234,141,137,43,20,200, 31,250,21,35,123,224,34,87,98,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_54 = 745; -static unsigned char xml_res_file_54[] = { +static size_t xml_res_size_49 = 745; +static unsigned char xml_res_file_49[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,42,116,69,88,116,67,114,101,97,116,105,111,110,32, 84,105,109,101,0,68,111,32,56,32,74,97,110,32,50,48,48,52,32,49,49,58,49, @@ -8553,8 +8355,8 @@ static unsigned char xml_res_file_54[] = { 11,81,220,131,231,176,95,142,23,47,100,51,120,121,203,69,243,160,63,248, 159,241,23,68,229,79,41,23,72,123,24,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_55 = 62919; -static unsigned char xml_res_file_55[] = { +static size_t xml_res_size_50 = 62919; +static unsigned char xml_res_file_50[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,242,0,0,1,242,8,2,0, 0,0,94,125,4,71,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,0,7,116,73,77,69,7,215,11,11,18,54,5,133,234,34,195,0,0,0,7,116,69, @@ -11636,8 +11438,8 @@ static unsigned char xml_res_file_55[] = { 5,2,19,226,127,88,68,206,162,106,244,2,253,0,0,0,0,73,69,78,68,174,66,96, 130}; -static size_t xml_res_size_56 = 3129; -static unsigned char xml_res_file_56[] = { +static size_t xml_res_size_51 = 3129; +static unsigned char xml_res_file_51[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,48,0,0,0,48,8,6,0,0, 0,87,2,249,135,0,0,0,43,116,69,88,116,67,114,101,97,116,105,111,110,32, 84,105,109,101,0,77,105,32,50,54,32,70,101,98,32,50,48,48,51,32,49,48,58, @@ -11792,8 +11594,8 @@ static unsigned char xml_res_file_56[] = { 45,143,32,4,10,144,196,106,134,97,255,216,220,124,207,153,47,26,211,231, 42,255,1,197,242,58,57,228,221,196,12,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_57 = 3445; -static unsigned char xml_res_file_57[] = { +static size_t xml_res_size_52 = 3445; +static unsigned char xml_res_file_52[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -11963,8 +11765,8 @@ static unsigned char xml_res_file_57[] = { 106,201,100,50,28,0,252,25,0,39,105,40,55,164,45,1,11,0,0,0,0,73,69,78, 68,174,66,96,130}; -static size_t xml_res_size_58 = 683; -static unsigned char xml_res_file_58[] = { +static size_t xml_res_size_53 = 683; +static unsigned char xml_res_file_53[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, 116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, @@ -11999,8 +11801,8 @@ static unsigned char xml_res_file_58[] = { 126,53,218,173,70,43,215,81,216,108,156,127,2,159,164,108,180,35,52,212, 126,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_59 = 704; -static unsigned char xml_res_file_59[] = { +static size_t xml_res_size_54 = 704; +static unsigned char xml_res_file_54[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, 116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, @@ -12036,8 +11838,8 @@ static unsigned char xml_res_file_59[] = { 199,17,4,250,21,150,233,108,21,203,106,24,63,6,144,255,125,231,159,170, 154,75,27,99,123,197,90,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_60 = 639; -static unsigned char xml_res_file_60[] = { +static size_t xml_res_size_55 = 639; +static unsigned char xml_res_file_55[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, 116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, @@ -12070,8 +11872,8 @@ static unsigned char xml_res_file_60[] = { 73,14,172,255,2,12,0,63,205,231,104,37,153,30,32,0,0,0,0,73,69,78,68,174, 66,96,130}; -static size_t xml_res_size_61 = 7960; -static unsigned char xml_res_file_61[] = { +static size_t xml_res_size_56 = 7960; +static unsigned char xml_res_file_56[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,1,231,0,0,0,66,8,2,0, 0,0,226,201,137,234,0,0,0,9,112,72,89,115,0,0,14,196,0,0,14,196,1,149,43, 14,27,0,0,0,7,116,73,77,69,7,215,12,11,20,30,26,227,18,33,62,0,0,0,7,116, @@ -12461,8 +12263,8 @@ static unsigned char xml_res_file_61[] = { 91,91,163,209,104,70,18,255,13,1,101,50,84,72,18,31,168,0,0,0,0,73,69,78, 68,174,66,96,130}; -static size_t xml_res_size_62 = 6936; -static unsigned char xml_res_file_62[] = { +static size_t xml_res_size_57 = 6936; +static unsigned char xml_res_file_57[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,1,231,0,0,0,32,8,2,0, 0,0,167,245,39,187,0,0,0,9,112,72,89,115,0,0,14,196,0,0,14,196,1,149,43, 14,27,0,0,0,7,116,73,77,69,7,215,12,23,13,52,14,159,155,73,179,0,0,0,7, @@ -12801,8 +12603,8 @@ static unsigned char xml_res_file_62[] = { 34,41,233,142,30,237,0,192,255,3,111,169,68,2,248,173,80,128,0,0,0,0,73, 69,78,68,174,66,96,130}; -static size_t xml_res_size_63 = 3617; -static unsigned char xml_res_file_63[] = { +static size_t xml_res_size_58 = 3617; +static unsigned char xml_res_file_58[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -12980,8 +12782,8 @@ static unsigned char xml_res_file_63[] = { 118,51,58,203,40,241,116,77,194,19,101,3,174,31,163,90,235,224,223,1,0, 79,122,110,117,131,22,65,139,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_64 = 761; -static unsigned char xml_res_file_64[] = { +static size_t xml_res_size_59 = 761; +static unsigned char xml_res_file_59[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,4,115,66,73,84,8,8,8,8,124,8,100,136,0,0,0,9,112, 72,89,115,0,0,1,187,0,0,1,187,1,58,236,227,226,0,0,0,25,116,69,88,116,83, @@ -13020,8 +12822,8 @@ static unsigned char xml_res_file_64[] = { 140,249,243,23,177,87,216,253,35,48,36,45,0,0,0,0,73,69,78,68,174,66,96, 130}; -static size_t xml_res_size_65 = 418; -static unsigned char xml_res_file_65[] = { +static size_t xml_res_size_60 = 418; +static unsigned char xml_res_file_60[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,6,98,75,71,68,0,190,0,190,0,190,181,173,64,155,0, 0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24,0,0,0,7,116,73,77, @@ -13042,57 +12844,637 @@ static unsigned char xml_res_file_65[] = { 75,96,137,242,24,32,65,246,238,23,214,30,191,236,253,143,250,4,75,21,73, 91,156,122,54,46,0,0,0,0,73,69,78,68,174,66,96,130,10,32,9,32,32,9,32,10}; -static size_t xml_res_size_66 = 650; -static unsigned char xml_res_file_66[] = { -137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, -0,224,119,61,248,0,0,2,81,73,68,65,84,72,137,213,150,177,79,21,65,16,198, -127,179,187,239,65,3,39,137,13,209,4,197,88,144,152,24,80,99,4,108,44,108, -44,161,246,127,240,143,176,182,176,55,26,59,163,38,82,217,216,80,96,34, -193,196,74,27,144,40,248,4,18,20,98,144,119,183,59,99,113,247,158,47,128, -20,15,40,156,100,50,59,151,205,247,237,204,119,59,119,98,102,156,164,185, -19,69,7,194,131,71,207,31,175,172,52,110,23,69,42,146,41,166,74,82,197, -20,84,149,164,101,133,73,21,51,5,64,196,225,164,35,58,193,123,71,111,189, -142,153,129,64,45,132,218,185,161,179,51,97,189,177,54,113,119,250,206, -224,110,179,32,166,68,17,19,49,38,98,82,98,76,164,164,196,164,164,84,174, -17,240,206,225,189,195,59,71,8,158,177,75,195,124,90,92,229,242,200,121, -150,190,52,24,30,26,100,181,177,193,179,87,175,39,93,140,205,35,139,240, -225,227,50,0,159,191,126,7,96,185,138,88,34,136,115,140,92,56,131,15,1, -51,99,107,107,155,236,84,134,28,10,41,237,112,208,62,17,161,200,115,68, -164,20,57,4,143,247,158,16,2,75,75,139,4,95,230,222,123,156,115,32,210, -206,75,255,219,34,119,128,139,8,226,74,234,176,151,93,85,247,157,198,203, -225,245,28,102,251,8,58,161,94,190,219,0,192,188,48,117,229,244,241,16, -20,49,242,118,110,142,164,202,118,184,8,64,108,198,174,192,15,36,16,224, -198,248,56,0,243,47,230,201,178,140,157,120,140,45,234,180,123,83,215,186, -6,254,39,65,234,16,249,216,52,104,205,59,51,40,242,188,157,111,87,100,197, -238,17,53,48,12,235,136,11,239,23,40,242,156,31,223,2,253,89,198,78,209, -173,6,174,106,145,89,219,157,115,140,141,142,2,112,189,235,115,183,76,9, -24,168,25,98,86,77,66,65,171,30,205,44,108,150,219,156,48,125,245,40,247, -160,179,2,145,182,40,109,13,126,23,93,215,208,22,217,170,10,68,132,217, -217,89,76,141,205,159,125,244,103,253,252,202,143,116,15,74,80,231,28,102, -198,228,228,4,173,129,113,171,123,220,202,28,193,123,47,141,181,117,84, -203,59,208,250,138,169,42,170,86,186,149,235,122,232,161,30,234,213,0,244, -244,212,234,36,43,240,98,212,66,13,179,68,175,235,163,105,59,152,37,156, -32,33,55,158,222,127,248,228,102,140,154,172,234,151,97,165,12,70,249,250, -90,149,83,93,16,17,130,247,41,198,228,247,62,243,120,51,73,193,123,31,6, -6,178,55,242,223,255,85,252,1,24,65,56,54,40,27,151,24,0,0,0,0,73,69,78, -68,174,66,96,130}; +static size_t xml_res_size_61 = 674; +static unsigned char xml_res_file_61[] = { +137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, +0,31,243,255,97,0,0,2,105,73,68,65,84,56,141,117,147,77,75,84,97,24,134, +175,247,125,207,153,51,51,157,113,156,208,25,199,49,83,81,27,149,198,178, +212,252,92,88,80,139,192,8,23,129,148,132,68,212,50,8,2,151,213,50,68,92, +246,19,90,244,11,42,136,54,109,138,130,40,162,84,164,114,44,53,63,102,212, +57,31,243,182,209,48,115,30,184,118,207,125,115,193,195,35,238,182,80,114, +142,247,52,156,94,93,89,203,61,121,190,252,169,212,142,44,29,199,238,233, +60,250,162,179,61,245,20,16,165,11,228,78,205,62,26,155,35,19,141,233,26, +187,171,191,57,221,221,100,142,199,130,112,16,165,12,82,189,231,78,221, +243,54,215,145,114,139,209,225,166,71,64,248,64,3,165,96,63,205,173,21, +15,147,201,56,185,197,31,120,11,243,100,58,170,202,218,234,2,119,214,92, +216,207,65,6,45,221,131,237,99,110,238,23,234,228,53,188,230,17,228,86, +150,171,151,235,238,3,135,255,51,112,10,176,139,50,4,45,237,201,201,84, +194,194,207,253,38,156,30,197,108,29,199,207,254,36,221,24,224,66,38,240, +192,209,176,151,253,6,131,125,189,45,231,253,245,101,112,54,128,34,90,11, +114,179,171,136,153,15,140,246,135,110,1,245,255,94,97,207,100,58,82,83, +149,229,32,221,60,97,182,145,194,66,20,61,182,191,121,232,53,205,145,26, +151,75,25,99,50,105,195,46,127,11,236,50,53,210,215,93,119,194,112,87,56, +20,112,176,215,179,8,92,164,178,136,149,65,209,4,10,5,198,134,236,97,160, +107,55,103,236,154,244,116,37,167,226,81,31,150,22,49,86,179,136,188,198, +121,220,0,110,145,64,92,64,0,112,32,81,163,25,74,27,211,175,191,120,221, +139,27,32,195,38,36,19,230,237,51,153,104,181,156,123,139,185,178,128,8, +135,208,181,49,212,141,25,212,205,143,232,84,20,34,17,16,10,92,151,43,3, +161,46,224,34,128,26,140,99,15,180,153,207,26,205,172,82,5,15,17,139,64, +52,142,136,148,35,131,17,228,242,27,68,126,22,76,11,60,23,10,46,225,40, +228,127,251,61,239,191,235,105,117,189,195,156,56,219,224,12,133,130,32, +42,45,72,36,160,170,14,146,173,160,151,193,91,133,72,5,4,4,40,15,156,60, +184,14,199,170,141,216,171,89,99,222,88,23,33,231,229,156,94,18,158,239, +91,33,45,101,112,73,98,229,133,8,126,213,90,89,32,132,239,59,14,122,123, +27,191,176,41,108,60,75,185,190,52,203,12,21,45,15,71,69,218,38,26,144, +212,250,30,30,160,53,32,52,66,130,16,59,95,168,65,23,65,250,160,235,109, +66,97,19,3,129,120,183,194,231,63,138,62,220,101,241,3,240,147,0,0,0,0, +73,69,78,68,174,66,96,130}; -static size_t xml_res_size_67 = 1441; -static unsigned char xml_res_file_67[] = { -137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, -0,224,119,61,248,0,0,5,104,73,68,65,84,72,137,157,149,123,108,84,85,30, -199,63,247,222,121,79,59,157,87,31,67,165,165,60,2,168,96,45,82,160,165, -176,130,45,34,106,180,212,7,3,24,212,108,118,217,138,15,2,155,64,182,162, -137,174,201,186,21,43,62,163,6,196,250,136,161,248,0,223,132,10,68,131, -232,80,75,133,210,98,133,22,218,105,103,104,203,208,105,59,157,153,123, -143,127,232,104,41,110,33,251,77,110,206,201,239,124,207,247,147,243,187, -39,57,210,227,155,30,3,160,184,164,132,135,215,172,65,167,211,225,93,225, -101,226,248,9,36,228,93,185,146,145,90,117,207,189,196,53,141,104,52,38, -37,106,185,185,215,136,145,62,249,183,241,86,64,0,127,185,40,105,116,109, -40,40,156,213,90,56,119,150,86,88,56,251,67,96,236,69,128,250,31,234,168, -255,161,46,37,247,218,107,120,227,237,183,106,1,239,101,4,143,3,158,47, -47,255,251,191,231,207,159,55,118,124,78,14,209,72,100,129,197,108,10,55, -55,29,103,248,167,76,157,50,5,224,72,203,79,45,99,138,75,74,102,184,220, +static size_t xml_res_size_62 = 625; +static unsigned char xml_res_file_62[] = { +137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, +0,31,243,255,97,0,0,0,4,115,66,73,84,8,8,8,8,124,8,100,136,0,0,0,9,112, +72,89,115,0,0,1,187,0,0,1,187,1,58,236,227,226,0,0,0,25,116,69,88,116,83, +111,102,116,119,97,114,101,0,119,119,119,46,105,110,107,115,99,97,112,101, +46,111,114,103,155,238,60,26,0,0,1,238,73,68,65,84,56,141,149,147,63,104, +20,65,20,198,127,239,205,92,254,72,130,193,194,196,38,130,164,48,69,68, +72,161,216,216,40,8,41,68,147,78,108,44,82,217,217,216,219,88,91,104,163, +88,88,9,81,184,20,98,113,86,54,49,22,158,94,48,22,70,12,54,81,34,200,133, +189,219,189,219,217,103,145,117,242,231,52,224,7,3,179,236,188,223,247, +189,55,140,152,25,34,114,28,152,230,255,244,193,204,62,251,242,99,58,77, +179,103,157,78,134,136,34,2,34,130,108,111,144,125,149,222,123,42,149,202, +44,16,1,100,89,70,210,74,80,117,56,167,17,176,103,149,103,69,118,144,17, +32,42,56,231,80,85,190,37,194,221,119,5,245,159,70,51,51,38,70,148,91,167, +43,92,28,247,61,0,141,27,17,84,149,102,87,184,242,50,80,223,52,110,78,85, +184,119,126,128,209,65,225,198,171,140,165,31,22,77,122,19,148,128,167, +107,198,175,204,120,62,51,200,217,49,135,168,50,115,162,159,199,31,59,140, +15,123,156,115,255,104,161,4,172,53,115,188,194,153,49,143,58,69,203,254, +231,167,6,98,225,129,0,167,229,33,85,92,25,53,222,200,95,180,211,140,8, +42,194,201,17,37,47,96,105,35,196,194,220,132,219,175,19,150,55,242,30, +88,4,72,233,116,125,178,159,209,67,194,124,173,197,195,149,140,197,47,93, +174,189,104,242,104,37,165,149,247,38,136,45,32,130,168,50,236,149,218, +236,97,238,188,105,115,255,125,202,102,187,96,242,136,231,201,165,33,206, +29,45,104,181,90,244,245,245,89,239,12,118,165,56,54,164,60,184,48,20,227, +134,16,216,218,218,98,125,253,59,222,123,234,245,250,91,96,21,0,51,3,184, +154,101,153,181,219,109,235,116,58,214,237,118,45,207,115,11,33,88,8,193, +146,36,177,70,163,97,73,146,88,181,90,253,10,156,2,196,204,246,14,113,191, +68,4,51,35,207,183,135,87,171,213,214,231,230,230,46,3,13,43,157,99,130, +60,132,30,231,162,40,44,132,96,105,154,22,11,11,11,203,187,157,255,44,41, +159,243,68,249,243,32,173,2,159,162,115,169,223,246,29,234,98,221,146,156, +119,0,0,0,0,73,69,78,68,174,66,96,130}; + +static size_t xml_res_size_63 = 672; +static unsigned char xml_res_file_63[] = { +137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, +0,31,243,255,97,0,0,0,4,115,66,73,84,8,8,8,8,124,8,100,136,0,0,0,9,112, +72,89,115,0,0,1,187,0,0,1,187,1,58,236,227,226,0,0,0,25,116,69,88,116,83, +111,102,116,119,97,114,101,0,119,119,119,46,105,110,107,115,99,97,112,101, +46,111,114,103,155,238,60,26,0,0,2,29,73,68,65,84,56,141,149,147,193,107, +19,65,20,198,191,55,155,128,45,10,162,212,30,84,170,226,69,132,30,236,193, +139,158,164,168,180,80,90,115,17,68,61,232,201,131,244,228,255,80,65,241, +164,103,15,130,166,45,141,173,72,107,244,82,17,27,111,134,144,64,84,170, +81,170,151,88,72,118,179,179,187,179,159,135,108,54,217,70,4,31,60,120, +195,204,247,123,111,190,97,132,36,68,100,4,192,24,254,47,62,146,252,148, +138,22,99,174,171,23,60,79,67,68,65,4,16,17,72,187,128,236,80,166,82,41, +164,211,233,75,0,98,0,180,214,176,29,27,74,89,176,44,21,3,18,25,157,21, +233,34,99,128,40,129,101,89,80,74,181,83,4,162,84,66,220,17,246,2,84,92, +136,128,18,98,177,118,31,179,31,206,226,202,250,49,220,222,56,131,183,191, +22,96,41,5,203,178,48,157,31,2,20,161,148,234,7,136,8,94,252,120,132,231, +181,135,200,28,157,197,221,211,121,156,59,120,25,15,74,183,176,105,151, +48,181,182,31,0,48,189,118,32,49,1,72,2,192,140,227,56,188,186,122,146, +115,133,155,108,54,155,116,28,135,45,215,101,109,187,74,207,243,232,121, +30,199,151,6,232,251,62,141,49,4,48,67,178,199,3,17,212,189,45,12,15,30, +233,250,160,20,134,7,71,98,31,94,78,54,250,222,178,123,25,17,12,237,58, +140,45,231,75,44,22,17,148,126,191,131,97,0,17,193,197,149,61,8,97,254, +110,162,0,56,127,232,26,214,127,46,98,245,251,99,124,107,86,240,236,243, +61,220,121,63,129,202,118,1,23,150,119,3,0,38,86,246,38,71,232,120,224, +106,205,166,221,228,147,242,28,175,191,26,229,228,242,62,222,120,125,138, +111,106,79,25,134,33,125,223,231,248,210,0,27,141,6,181,214,97,199,131, +24,160,181,166,227,56,212,90,211,247,125,6,65,64,99,76,44,174,215,235,44, +151,203,172,86,171,204,102,179,27,0,78,244,1,90,173,22,61,207,75,0,140, +49,180,109,155,197,98,145,182,109,51,151,203,109,2,24,5,32,36,147,38,238, +12,17,1,73,4,65,219,196,124,62,255,53,147,201,76,1,40,50,234,28,79,16,24, +211,215,57,12,67,26,99,232,186,110,56,63,63,95,232,237,220,73,137,190,243, +241,104,243,95,81,6,80,137,59,71,241,7,28,152,90,249,152,21,25,66,0,0,0, +0,73,69,78,68,174,66,96,130}; + +static size_t xml_res_size_64 = 548; +static unsigned char xml_res_file_64[] = { +137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, +0,31,243,255,97,0,0,0,4,115,66,73,84,8,8,8,8,124,8,100,136,0,0,0,9,112, +72,89,115,0,0,1,187,0,0,1,187,1,58,236,227,226,0,0,0,25,116,69,88,116,83, +111,102,116,119,97,114,101,0,119,119,119,46,105,110,107,115,99,97,112,101, +46,111,114,103,155,238,60,26,0,0,1,161,73,68,65,84,56,141,149,147,189,138, +20,65,20,133,191,83,213,51,171,27,136,63,15,176,137,32,136,108,178,15,97, +178,176,162,243,6,190,137,129,136,193,38,251,6,198,99,48,129,96,48,137, +96,164,201,104,35,171,96,224,36,226,6,98,48,244,78,119,79,87,95,131,174, +237,237,158,86,193,11,23,110,87,213,253,206,233,91,148,204,12,73,123,192, +1,255,23,31,205,236,107,18,63,14,242,188,120,89,150,5,146,67,2,73,168,41, +208,86,103,146,36,140,70,163,71,64,11,160,40,10,178,243,12,231,60,222,187, +22,208,203,120,86,186,68,182,0,57,225,189,199,57,215,164,132,156,235,53, +95,52,118,1,174,45,164,203,102,231,88,221,120,66,249,236,13,222,185,38, +189,199,121,223,138,12,29,68,128,143,128,118,205,251,198,77,71,253,143, +14,180,229,0,32,124,58,227,215,254,49,63,247,158,82,190,254,130,235,252, +210,95,1,234,2,62,124,231,218,243,67,116,107,151,243,147,183,131,230,30, +0,169,153,67,4,1,236,220,191,195,149,195,187,92,61,186,71,149,254,232,221, +200,208,65,215,69,60,224,175,239,54,245,200,19,206,86,3,245,222,16,145, +88,61,120,129,36,110,190,122,220,172,237,36,61,197,60,207,9,33,48,30,143, +109,120,11,29,106,87,73,18,117,93,83,81,179,92,46,73,146,132,197,98,241, +30,56,5,192,204,0,30,22,69,97,235,245,218,202,178,180,205,102,99,85,85, +89,8,193,66,8,150,101,153,165,105,106,89,150,217,108,54,251,6,236,3,50, +179,254,16,183,67,18,102,70,85,85,72,98,62,159,47,39,147,201,17,144,90, +84,110,29,84,33,12,148,235,186,182,16,130,229,121,94,79,167,211,119,93, +229,139,84,124,206,183,227,230,191,226,20,248,220,42,199,248,13,95,198, +189,161,61,78,40,59,0,0,0,0,73,69,78,68,174,66,96,130}; + +static size_t xml_res_size_65 = 650; +static unsigned char xml_res_file_65[] = { +137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, +0,31,243,255,97,0,0,0,4,115,66,73,84,8,8,8,8,124,8,100,136,0,0,0,9,112, +72,89,115,0,0,1,187,0,0,1,187,1,58,236,227,226,0,0,0,25,116,69,88,116,83, +111,102,116,119,97,114,101,0,119,119,119,46,105,110,107,115,99,97,112,101, +46,111,114,103,155,238,60,26,0,0,2,7,73,68,65,84,56,141,149,147,205,106, +20,65,20,133,191,123,171,123,122,226,116,126,116,17,23,51,6,68,131,46,36, +59,119,34,190,130,250,18,62,130,193,69,4,125,21,17,23,66,30,66,220,39,32, +110,2,9,249,25,195,152,81,72,247,116,79,255,76,93,23,153,201,100,156,184, +240,192,165,168,130,115,238,57,183,170,196,204,16,145,251,192,6,255,135, +93,51,219,11,198,155,141,94,175,247,217,155,161,170,168,42,34,50,83,192, +229,170,170,44,198,241,75,96,79,39,114,222,96,48,24,252,179,157,136,32, +112,89,19,76,28,224,156,130,25,222,132,227,195,35,204,192,188,167,185,208, +100,84,143,112,129,99,229,230,45,226,86,139,64,117,94,64,199,135,141,208, +209,233,180,113,170,52,162,136,98,56,164,209,104,16,132,33,101,81,208,8, +29,234,220,188,128,136,176,188,178,66,237,225,248,184,75,24,6,196,241,34, +105,146,208,138,91,148,101,137,121,163,221,233,176,16,78,29,232,85,7,195, +225,16,85,197,5,1,46,8,72,146,132,178,44,73,206,19,84,149,59,107,107,4, +193,101,207,191,34,136,128,25,205,208,177,126,239,46,121,158,19,199,49, +102,134,115,14,51,163,40,10,16,135,200,117,17,84,241,102,212,30,14,247, +247,49,51,154,11,77,194,48,36,77,82,162,168,129,170,178,186,122,155,40, +146,107,4,128,192,57,162,208,241,240,193,250,244,234,174,121,7,87,49,157, +134,8,75,75,75,168,42,89,150,205,144,171,170,66,68,200,178,140,170,170, +200,243,161,1,126,238,22,210,52,229,70,188,204,207,254,111,122,253,95,248, +122,68,212,140,168,235,154,228,60,225,172,127,70,187,221,102,123,123,251, +43,176,51,227,64,0,51,3,32,77,83,202,97,65,43,142,25,164,3,84,149,31,167, +167,60,123,250,132,15,159,62,126,127,179,249,250,21,112,0,83,210,139,44, +207,173,219,237,90,89,150,86,85,149,213,117,109,163,209,200,188,247,214, +239,247,109,103,119,215,54,223,110,125,3,30,3,106,102,23,220,177,192,243, +44,207,125,81,20,86,85,213,140,128,153,217,201,73,215,111,189,123,255,5, +120,116,149,108,102,200,248,59,119,198,202,243,99,190,128,31,103,62,176, +73,206,49,254,0,61,39,6,79,174,139,88,136,0,0,0,0,73,69,78,68,174,66,96, +130}; + +static size_t xml_res_size_66 = 743; +static unsigned char xml_res_file_66[] = { +137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, +0,31,243,255,97,0,0,0,4,115,66,73,84,8,8,8,8,124,8,100,136,0,0,0,9,112, +72,89,115,0,0,1,187,0,0,1,187,1,58,236,227,226,0,0,0,25,116,69,88,116,83, +111,102,116,119,97,114,101,0,119,119,119,46,105,110,107,115,99,97,112,101, +46,111,114,103,155,238,60,26,0,0,2,100,73,68,65,84,120,218,165,147,205, +75,84,81,24,198,159,115,103,198,102,70,29,29,25,103,156,41,173,20,49,51, +52,90,36,20,45,218,68,27,151,237,139,86,45,250,3,90,137,237,218,70,219, +160,254,129,8,164,15,201,141,68,65,26,150,129,18,82,193,64,5,78,142,54, +115,207,204,189,231,235,158,94,110,114,108,97,139,232,7,15,15,92,206,251, +222,231,125,239,61,204,90,139,255,33,137,191,49,55,231,109,156,68,114,29, +192,149,13,104,204,206,70,56,0,151,224,225,220,181,244,200,212,164,223, +95,200,39,69,40,16,134,33,180,222,133,84,10,30,235,65,182,51,131,76,58, +131,106,245,107,243,243,234,114,241,230,221,167,2,132,135,61,138,199,134, +222,149,75,133,164,86,26,74,43,42,214,144,130,195,168,54,53,145,144,242, +247,179,209,209,227,185,108,185,242,24,132,107,240,228,254,173,27,3,149, +202,9,69,197,154,138,149,212,241,155,69,187,142,144,212,104,114,240,86, +11,65,16,66,8,137,233,233,233,203,15,238,92,157,113,59,168,148,10,195,41, +27,250,33,231,86,106,205,140,50,48,90,163,163,115,32,155,78,48,38,182,77, +171,237,251,144,237,6,118,182,140,69,100,208,223,157,63,7,96,62,110,192, +188,36,79,103,210,221,248,3,99,34,212,26,219,72,120,12,229,82,71,183,209, +18,70,145,246,92,120,8,221,8,154,89,142,63,208,198,64,81,130,118,16,129, +98,192,70,134,20,193,218,200,57,137,187,17,180,82,254,151,106,3,181,157, +6,182,119,154,200,231,186,80,232,203,225,251,86,29,168,214,160,164,68,95, +79,6,181,31,187,104,114,142,124,87,6,131,149,146,239,18,8,25,241,98,161, +7,99,195,135,49,191,184,130,137,177,33,60,95,90,69,195,111,97,124,164,140, +35,165,94,20,251,186,96,173,193,250,230,55,148,251,115,0,99,190,75,160, +148,244,133,244,200,53,234,148,64,73,133,209,163,37,188,253,240,9,74,132, +120,180,176,140,75,231,39,240,108,105,13,51,23,39,177,85,111,210,226,179, +251,35,112,222,14,210,41,70,77,25,238,221,190,14,173,37,78,143,15,98,106, +172,130,200,24,156,61,53,68,174,113,225,204,48,34,218,129,33,5,202,4,110, +132,23,175,87,88,252,231,41,9,19,75,128,182,77,82,251,50,198,21,107,19, +225,213,251,205,67,174,193,194,226,154,106,241,32,254,246,145,177,160,179, +116,152,193,34,1,235,81,200,68,138,60,21,59,200,133,48,120,249,230,163, +118,119,129,162,247,246,230,58,103,0,48,196,24,28,132,187,77,6,182,217, +10,231,169,246,167,187,76,140,192,63,96,9,16,191,0,100,58,117,67,48,81, +51,243,0,0,0,0,73,69,78,68,174,66,96,130}; + +static size_t xml_res_size_67 = 821; +static unsigned char xml_res_file_67[] = { +137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, +0,31,243,255,97,0,0,0,4,115,66,73,84,8,8,8,8,124,8,100,136,0,0,0,9,112, +72,89,115,0,0,1,187,0,0,1,187,1,58,236,227,226,0,0,0,25,116,69,88,116,83, +111,102,116,119,97,114,101,0,119,119,119,46,105,110,107,115,99,97,112,101, +46,111,114,103,155,238,60,26,0,0,2,178,73,68,65,84,120,218,117,83,77,79, +19,97,16,158,237,110,63,72,41,173,197,130,61,16,18,129,131,196,24,138,137, +23,77,104,253,3,234,1,77,61,153,244,194,209,11,129,104,122,80,46,165,7, +131,9,28,32,134,131,156,36,198,104,194,149,132,136,33,193,132,106,34,144, +30,4,202,71,91,160,244,35,173,208,118,219,93,156,231,53,91,61,224,36,147, +121,179,251,206,51,243,60,51,175,116,126,126,78,23,217,212,212,84,176,187, +187,59,140,243,206,206,78,100,104,104,232,45,93,96,38,250,199,134,135,135, +175,24,231,150,150,150,199,129,64,224,26,188,185,185,57,120,209,29,88,163, +131,153,153,153,23,3,3,3,207,19,137,196,119,89,150,107,157,157,157,55,189, +94,175,25,255,82,169,84,125,123,123,251,171,205,102,179,119,116,116,92, +95,90,90,138,134,66,161,103,13,128,112,56,124,105,112,112,48,211,222,222, +46,155,76,38,130,195,52,77,19,81,81,20,194,61,195,15,15,15,181,249,249, +121,207,216,216,88,190,209,193,220,220,220,55,191,223,223,103,177,88,168, +92,46,3,4,81,36,112,229,70,4,232,242,242,242,143,96,48,120,67,128,27,92, +42,149,74,169,90,173,210,217,217,25,73,146,132,170,141,202,181,90,77,120, +189,94,39,93,215,233,244,244,244,151,145,39,59,157,206,96,60,30,127,213, +213,213,117,167,169,169,73,102,32,145,116,124,124,172,174,173,173,125,218, +219,219,139,91,173,214,171,118,187,93,65,1,116,197,247,188,43,43,43,254, +197,197,69,93,49,155,205,79,123,123,123,111,161,117,160,35,25,113,99,99, +227,3,143,78,168,63,59,59,251,174,181,181,245,161,209,93,91,91,155,226, +118,187,239,174,174,174,186,20,110,75,82,85,149,96,172,62,0,192,19,32,85, +214,229,190,195,225,120,226,114,185,250,143,142,142,144,140,234,84,44,22, +5,37,46,238,148,162,209,232,35,190,20,226,241,4,60,30,143,194,38,0,74,165, +82,117,97,97,65,101,186,14,36,66,106,137,36,252,51,244,64,39,105,76,193, +216,188,47,62,159,239,54,115,37,112,197,20,38,94,79,80,127,191,143,50,153, +12,52,33,139,197,74,201,131,36,241,98,225,27,128,242,198,38,34,193,6,48, +240,132,101,179,89,166,163,83,42,157,162,124,33,79,170,90,163,88,44,70, +38,217,132,41,16,104,67,43,1,48,50,50,114,185,167,167,167,143,53,0,47,193, +147,41,17,38,146,59,201,82,169,88,162,10,171,175,107,58,199,10,241,182, +138,59,40,40,0,198,199,199,79,214,215,215,95,114,235,218,214,214,86,108, +115,115,243,115,161,80,168,131,93,25,32,185,28,29,36,147,196,98,82,58,157, +22,201,252,255,239,91,48,108,116,116,212,29,137,68,114,56,79,79,79,127, +220,223,223,191,183,187,155,248,35,159,132,213,214,33,34,4,68,132,136,63, +255,251,156,39,39,39,31,48,157,55,252,164,93,188,35,117,118,141,57,131, +22,68,134,99,87,222,255,6,129,62,148,253,161,228,14,253,0,0,0,0,73,69,78, +68,174,66,96,130}; + +static size_t xml_res_size_68 = 597; +static unsigned char xml_res_file_68[] = { +137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, +0,31,243,255,97,0,0,0,4,115,66,73,84,8,8,8,8,124,8,100,136,0,0,0,9,112, +72,89,115,0,0,1,187,0,0,1,187,1,58,236,227,226,0,0,0,25,116,69,88,116,83, +111,102,116,119,97,114,101,0,119,119,119,46,105,110,107,115,99,97,112,101, +46,111,114,103,155,238,60,26,0,0,1,210,73,68,65,84,120,218,149,147,177, +142,218,80,16,69,175,109,232,248,7,10,34,209,69,8,255,2,125,36,98,162,165, +166,167,135,54,91,65,205,63,80,144,130,158,134,2,138,77,3,65,40,145,214, +17,164,2,68,5,200,198,54,224,201,204,91,189,245,46,150,34,101,164,171,121, +24,221,115,103,30,216,32,34,24,134,145,7,96,227,255,234,7,123,221,12,94, +202,14,130,240,91,20,133,12,51,89,16,168,18,164,223,57,51,153,12,178,217, +236,103,0,175,0,132,97,8,207,247,96,154,22,44,203,20,115,90,144,82,240, +4,6,253,208,52,216,104,49,192,124,145,24,184,39,102,101,76,1,76,125,96, +131,24,19,49,108,189,94,195,226,179,72,193,89,58,36,5,16,234,118,187,197, +111,215,69,196,235,28,143,71,212,28,7,183,56,86,166,253,126,15,247,249, +25,231,243,57,189,130,6,212,31,30,80,169,84,48,30,143,209,104,52,228,153, +130,20,139,69,204,231,115,216,182,141,201,100,130,78,167,147,158,32,138, +34,28,14,7,124,125,124,68,161,80,192,116,58,85,144,118,187,141,205,102, +131,213,106,133,110,183,139,82,169,4,215,117,211,128,229,114,169,126,137, +47,181,26,114,185,28,46,151,11,202,229,50,102,179,25,242,249,60,60,207, +67,181,90,133,239,251,168,215,235,120,45,34,146,86,237,245,122,212,106, +181,136,119,36,6,17,79,68,215,235,85,169,223,239,83,179,217,164,56,142, +233,118,187,169,46,30,246,38,128,128,77,158,239,83,16,4,202,204,19,136, +89,27,212,103,78,167,211,233,36,1,177,6,36,151,168,101,24,41,49,4,108,196, +110,183,147,127,161,172,245,29,192,207,119,43,48,85,198,79,165,139,120, +127,90,44,22,170,15,135,195,53,128,143,146,37,94,19,186,56,233,174,36,93, +5,48,76,157,71,163,209,31,199,113,62,1,88,16,215,187,9,174,156,116,151, +172,47,77,238,37,30,12,6,79,111,147,181,244,235,252,65,125,249,239,146, +157,127,233,100,93,127,1,128,105,83,176,4,248,205,20,0,0,0,0,73,69,78,68, +174,66,96,130}; + +static size_t xml_res_size_69 = 1854; +static unsigned char xml_res_file_69[] = { +137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,16,6,0, +0,0,79,99,35,34,0,0,0,9,112,72,89,115,0,0,55,92,0,0,55,92,1,203,199,164, +185,0,0,0,9,118,112,65,103,0,0,0,16,0,0,0,16,0,92,198,173,195,0,0,0,6,98, +75,71,68,255,255,255,255,255,255,9,88,247,220,0,0,6,155,73,68,65,84,120, +218,29,208,123,112,142,103,26,199,241,239,117,63,207,235,61,37,41,173,9, +54,82,135,145,65,178,146,148,149,174,100,149,97,117,235,208,150,162,14, +203,134,216,29,171,20,171,182,204,206,110,79,106,66,73,135,182,106,85,83, +139,105,67,200,34,205,148,236,178,36,34,172,104,99,52,14,21,146,144,172, +67,144,136,196,155,247,205,147,231,185,247,105,239,207,252,254,184,102, +174,223,253,199,101,78,154,62,105,242,164,41,208,56,170,113,116,227,232, +192,152,25,183,103,116,159,49,98,80,187,111,179,239,115,223,103,146,237, +52,234,59,186,134,29,242,111,74,201,231,105,198,200,40,25,137,35,67,73, +33,21,72,34,153,33,224,230,105,23,196,146,224,82,84,83,226,186,169,190, +86,59,213,78,230,135,39,133,39,134,39,234,191,228,245,200,139,202,139,186, +226,141,45,139,61,25,123,50,116,220,76,191,152,126,59,221,129,107,41,215, +236,107,129,254,231,95,58,255,242,242,151,11,78,52,7,227,130,18,108,247, +29,97,22,253,240,58,45,234,132,24,34,44,147,68,117,85,85,19,150,62,92,112, +33,87,228,123,249,30,248,72,242,37,31,100,61,179,92,62,252,164,184,126, +175,62,51,138,140,34,117,36,180,244,113,255,199,253,195,103,170,126,86, +117,176,234,96,122,215,1,3,7,12,25,48,164,10,83,93,81,215,85,13,16,161, +131,78,53,169,75,86,151,183,186,76,241,182,120,227,189,99,188,113,158,108, +106,41,163,144,37,106,136,90,160,22,240,148,44,147,157,178,19,212,104,185, +32,23,64,98,69,68,129,164,75,130,36,0,251,220,11,141,2,186,226,115,197, +25,235,84,142,202,33,219,94,213,57,172,115,168,190,76,37,215,185,174,158, +80,9,106,144,26,196,46,147,2,138,216,13,178,74,150,200,107,228,169,82,213, +160,214,234,99,146,39,35,229,0,112,139,43,92,213,217,50,92,12,215,38,149, +40,150,132,9,203,76,233,38,93,65,252,18,146,86,144,100,233,45,189,64,150, +202,8,121,22,31,125,233,65,79,183,183,85,77,87,211,4,245,140,26,172,18, +245,27,114,71,78,200,9,198,74,156,196,75,60,152,178,64,254,40,243,128,185, +76,113,197,73,142,252,74,50,100,181,233,53,218,12,197,41,189,137,163,148, +202,106,117,86,14,200,126,182,40,212,223,213,118,144,36,119,107,44,168, +114,85,164,202,65,46,203,105,41,3,86,241,58,11,129,26,174,112,81,22,43, +191,123,225,235,110,239,93,181,87,237,149,213,108,225,158,43,142,20,82, +221,212,153,206,24,103,156,147,10,246,61,187,205,174,68,123,230,154,191, +244,108,65,55,221,109,190,216,116,9,30,229,61,154,220,82,10,49,231,163, +157,152,122,8,52,5,236,192,44,8,173,13,85,135,182,130,157,237,28,177,221, +153,47,245,107,172,5,239,61,223,44,111,54,232,26,231,178,190,14,61,106, +122,52,246,60,12,170,143,234,166,158,70,235,245,122,163,94,131,166,130, +51,84,130,169,51,116,186,78,5,221,170,155,117,45,168,90,213,168,190,1,203, +182,58,172,125,224,172,113,222,119,242,64,38,171,181,226,206,183,90,110, +171,255,153,16,204,14,222,140,202,128,206,72,231,128,206,175,128,239,232, +96,29,120,223,246,158,243,238,130,240,184,200,159,194,237,208,20,215,220, +171,105,51,68,63,138,26,17,125,24,236,136,29,111,31,1,253,174,254,192,89, +9,166,58,171,74,212,37,80,203,213,98,53,15,248,53,159,235,62,208,237,207, +221,234,187,189,4,222,53,222,4,239,22,8,174,9,188,16,104,0,115,177,177, +193,236,14,190,221,190,127,248,250,0,255,148,2,169,0,189,214,25,225,76, +4,51,215,51,195,179,9,60,247,187,244,238,114,16,2,201,254,176,255,45,96, +32,217,44,3,213,170,98,212,119,8,31,178,65,154,192,36,137,84,158,1,74,56, +67,25,200,81,181,75,21,0,247,232,171,251,130,255,136,111,189,175,28,156, +20,167,213,185,2,186,76,87,233,61,208,145,210,145,217,145,14,170,214,40, +52,246,131,113,95,57,234,121,240,255,214,247,172,255,35,176,54,90,13,86, +20,78,176,62,106,87,212,72,8,229,62,94,23,138,80,35,119,165,69,146,244, +109,249,80,178,229,83,148,201,44,166,51,19,136,208,206,45,144,195,12,102, +54,24,253,204,231,204,66,184,81,88,151,82,91,5,209,79,68,87,199,204,133, +142,106,235,81,199,14,80,221,165,78,252,224,31,19,136,11,228,129,252,64, +156,44,135,206,28,251,129,221,6,145,252,72,91,120,38,65,110,234,75,250, +63,224,187,227,155,232,63,229,92,210,227,244,27,58,32,99,57,207,85,202, +193,228,16,251,201,3,126,193,48,18,64,78,75,177,156,6,98,244,13,206,67, +224,55,1,35,120,2,130,43,163,222,140,50,193,95,229,196,58,227,193,236,109, +76,51,22,129,42,83,27,212,18,176,254,218,57,205,250,6,109,191,216,249,106, +231,66,196,206,176,255,96,123,185,24,158,28,201,136,172,4,171,143,245,113, +231,183,12,109,117,90,251,182,30,179,151,60,136,126,16,184,111,114,220, +148,7,242,88,4,84,80,249,213,0,68,23,235,127,233,247,144,168,21,81,227, +163,114,33,102,103,204,194,152,69,192,235,132,9,130,76,151,225,242,55,224, +109,60,60,5,250,107,61,79,47,69,91,61,172,52,43,19,121,184,242,97,221,195, +169,52,133,139,194,163,34,245,118,102,100,107,216,137,44,51,40,237,90,186, +187,116,197,142,194,125,69,251,246,238,203,191,28,210,63,61,60,38,123,217, +206,54,160,150,115,84,232,107,76,32,131,231,244,28,189,75,239,214,159,128, +117,200,58,106,237,210,61,85,181,171,86,250,74,162,107,48,97,213,75,245, +84,189,208,86,134,149,110,101,16,12,213,134,58,66,167,168,107,222,212,92, +208,92,105,191,25,61,62,58,57,186,171,177,174,164,123,137,81,18,218,191, +45,43,63,107,79,86,241,138,98,0,112,14,120,44,207,67,79,19,31,155,52,115, +147,122,224,52,205,60,148,44,85,109,56,134,35,237,134,54,235,205,122,48, +98,244,86,189,93,238,202,6,217,40,27,169,35,137,129,164,0,109,180,16,1, +169,148,111,165,2,156,144,91,139,213,123,156,27,78,196,41,54,102,150,190, +87,154,89,58,124,255,11,179,19,103,39,207,30,154,53,8,0,194,7,82,55,164, +126,144,154,131,221,239,64,191,226,126,199,48,204,246,129,237,73,237,73, +208,209,189,227,201,142,39,237,138,71,239,180,76,104,153,240,160,156,247, +245,98,189,216,183,205,185,231,220,116,63,77,83,175,168,169,106,170,12, +147,115,82,33,103,177,152,194,43,76,37,108,253,96,93,182,170,244,227,182, +231,219,38,183,253,206,179,182,98,126,197,139,21,25,95,124,153,153,152, +153,156,249,243,213,77,0,16,217,156,118,60,237,112,90,1,15,211,106,211, +26,210,238,97,196,183,197,183,196,223,197,52,115,23,228,206,201,157,3,237, +95,180,239,104,223,81,211,171,225,211,134,229,13,203,71,247,53,151,154, +139,204,69,124,165,231,235,44,157,69,21,242,147,69,28,228,144,75,244,70, +157,163,115,168,53,94,253,145,172,179,55,219,159,184,41,172,52,43,125,149, +237,117,239,0,64,103,69,102,105,230,201,204,227,220,79,59,149,86,150,86, +78,215,224,127,93,21,120,26,15,253,8,235,255,57,11,234,152,189,21,134,126, +0,0,0,34,122,84,88,116,83,111,102,116,119,97,114,101,0,0,120,218,43,47, +47,215,203,204,203,46,78,78,44,72,213,203,47,74,7,0,54,216,6,88,16,83,202, +92,0,0,0,0,73,69,78,68,174,66,96,130}; + +static size_t xml_res_size_70 = 720; +static unsigned char xml_res_file_70[] = { +137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, +0,31,243,255,97,0,0,0,4,115,66,73,84,8,8,8,8,124,8,100,136,0,0,0,9,112, +72,89,115,0,0,1,187,0,0,1,187,1,58,236,227,226,0,0,0,25,116,69,88,116,83, +111,102,116,119,97,114,101,0,119,119,119,46,105,110,107,115,99,97,112,101, +46,111,114,103,155,238,60,26,0,0,2,77,73,68,65,84,120,218,149,147,189,107, +83,81,24,135,159,115,115,115,111,146,218,36,213,126,88,141,173,109,162, +168,212,128,164,88,40,5,5,197,161,66,135,214,15,20,157,236,226,224,228, +226,234,228,31,224,36,142,130,46,17,113,171,180,34,29,84,168,162,160,96, +99,80,208,6,90,173,134,104,107,154,251,125,188,105,155,148,210,32,248,192, +143,151,3,231,125,222,247,12,71,72,41,17,66,116,3,25,254,143,119,126,239, +39,149,53,50,134,97,62,180,44,19,33,20,63,84,165,171,161,90,217,140,170, +170,4,131,193,49,160,46,192,52,77,142,157,188,75,230,231,99,244,192,103, +242,214,9,218,191,153,132,83,221,216,59,114,236,143,127,64,251,157,32,215, +116,145,91,247,46,80,67,97,29,161,8,210,222,11,68,124,9,218,2,196,93,147, +144,101,208,103,7,8,180,72,212,116,130,228,200,65,58,188,60,2,182,10,20, +33,112,183,75,138,173,205,24,126,93,82,245,53,49,26,57,67,80,233,77,161, +238,142,49,212,111,162,120,110,131,13,132,160,216,222,71,105,62,201,84, +185,19,205,114,170,239,164,201,81,184,150,31,70,45,31,101,186,244,139,66, +162,31,37,20,106,44,248,30,59,77,116,57,206,208,204,30,34,43,54,203,93, +97,60,4,157,81,149,203,55,91,233,217,55,204,163,185,20,66,40,141,5,193, +72,19,43,131,7,136,58,101,18,124,97,206,210,201,54,63,71,95,20,44,141,239, +196,120,19,160,176,188,13,33,216,42,64,8,180,112,144,98,215,113,42,167, +186,41,30,41,113,37,148,39,16,173,80,184,30,225,65,108,158,251,63,147,232, +97,125,211,6,106,189,31,124,129,142,173,72,114,153,27,252,120,219,203,228, +202,43,246,14,94,229,118,37,137,237,122,104,145,250,229,13,193,230,13,52, +156,128,4,215,102,64,153,32,54,112,152,175,187,14,81,54,61,116,54,112,28, +91,54,220,64,247,5,174,10,214,194,71,22,22,22,249,211,217,129,173,4,125, +49,72,207,161,77,45,49,212,163,50,53,241,242,53,48,91,19,212,209,35,58, +142,37,209,122,251,241,186,166,241,84,173,62,185,197,45,114,231,82,23,79, +38,159,21,70,207,157,25,7,114,91,158,48,150,86,113,164,178,126,12,249,17, +72,41,177,44,139,86,199,99,114,234,233,220,249,179,99,35,192,123,233,3, +192,122,29,117,92,87,218,182,45,29,199,145,174,235,174,198,243,188,213, +106,24,134,151,205,102,103,128,52,32,170,61,181,212,190,115,10,72,243,111, +102,129,92,109,114,141,191,63,50,244,146,208,89,162,221,0,0,0,0,73,69,78, +68,174,66,96,130}; + +static size_t xml_res_size_71 = 563; +static unsigned char xml_res_file_71[] = { +137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, +0,31,243,255,97,0,0,0,4,115,66,73,84,8,8,8,8,124,8,100,136,0,0,0,9,112, +72,89,115,0,0,1,187,0,0,1,187,1,58,236,227,226,0,0,0,25,116,69,88,116,83, +111,102,116,119,97,114,101,0,119,119,119,46,105,110,107,115,99,97,112,101, +46,111,114,103,155,238,60,26,0,0,1,176,73,68,65,84,56,141,149,147,49,142, +218,64,20,134,191,55,246,24,110,145,38,237,110,179,157,145,184,66,164,4, +137,150,130,3,184,224,24,244,156,1,137,128,160,230,4,14,80,132,98,83,68, +34,41,169,145,3,198,30,94,138,53,3,44,187,145,242,164,39,121,198,254,191, +255,215,188,177,168,42,34,242,1,120,226,255,234,187,170,254,12,171,197, +211,225,144,127,61,30,115,68,12,34,32,34,200,203,3,242,74,25,134,33,214, +218,47,128,7,144,231,57,217,159,12,99,2,130,192,120,192,77,87,223,138,92, +144,30,32,70,8,130,0,99,204,75,139,32,198,220,136,207,194,55,1,70,132,199, +135,135,179,197,93,108,192,195,55,155,205,101,207,39,168,168,147,201,132, +70,28,115,189,31,4,1,214,90,172,181,212,106,181,155,4,183,0,17,250,253, +62,189,94,143,241,120,76,179,217,244,162,90,173,70,189,94,199,90,251,62, +192,136,144,166,41,237,118,155,52,77,25,14,135,94,20,69,145,135,221,76, +228,42,43,81,20,17,199,49,73,146,0,208,233,116,176,214,222,30,110,117,176, +247,83,0,162,40,34,73,18,6,131,1,203,229,18,99,12,81,20,177,90,173,188, +160,209,104,188,159,192,90,75,183,219,245,135,102,140,33,8,2,226,56,246, +206,214,90,138,162,208,55,19,44,22,11,31,247,250,2,57,231,216,237,118,108, +183,91,194,48,100,54,155,125,3,158,1,80,85,128,207,121,158,235,126,191, +215,227,241,168,69,81,104,89,150,234,156,83,231,156,102,89,166,235,245, +90,179,44,211,233,116,250,11,120,4,68,85,47,83,64,238,175,142,136,160,170, +148,101,137,136,48,159,207,127,183,90,173,79,192,90,43,103,159,160,116, +238,206,249,116,58,169,115,78,15,135,195,105,52,26,165,215,206,231,150, +234,119,254,88,189,252,87,61,3,63,188,115,85,127,1,148,24,195,12,193,108, +182,40,0,0,0,0,73,69,78,68,174,66,96,130}; + +static size_t xml_res_size_72 = 572; +static unsigned char xml_res_file_72[] = { +137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, +0,31,243,255,97,0,0,0,4,115,66,73,84,8,8,8,8,124,8,100,136,0,0,0,9,112, +72,89,115,0,0,1,187,0,0,1,187,1,58,236,227,226,0,0,0,25,116,69,88,116,83, +111,102,116,119,97,114,101,0,119,119,119,46,105,110,107,115,99,97,112,101, +46,111,114,103,155,238,60,26,0,0,1,185,73,68,65,84,56,141,149,147,49,139, +212,80,20,133,191,123,95,102,23,113,11,65,80,176,80,208,173,183,112,11, +183,179,181,82,88,7,27,75,127,146,149,181,149,48,91,12,182,99,97,37,56, +8,163,35,172,133,136,138,197,78,107,72,38,47,201,123,215,34,201,236,100, +102,21,188,112,32,33,239,124,231,188,151,68,204,12,17,185,5,28,242,127, +243,201,204,190,38,237,205,97,81,248,147,178,244,136,40,34,32,34,72,115, +129,108,56,147,36,97,48,24,60,6,86,0,188,247,100,121,134,170,195,57,93, +1,122,106,215,138,156,35,87,0,81,193,57,135,170,54,18,65,84,123,230,206, +120,33,64,69,206,205,173,68,164,1,109,108,71,85,47,104,208,2,92,103,94, +107,209,65,186,117,235,13,116,19,192,217,111,170,23,111,27,80,25,241,207, +223,160,170,248,151,239,96,145,110,1,122,13,226,171,41,100,37,59,15,14, +80,85,226,183,51,220,141,43,136,8,59,71,119,200,79,166,232,229,93,246,158, +221,223,110,128,8,32,136,40,234,154,109,84,159,127,225,110,95,107,18,19, +135,133,136,149,245,95,26,0,187,79,143,96,145,226,95,207,24,236,95,167, +250,248,147,75,15,239,34,34,44,199,31,216,123,114,15,119,243,106,255,163, +48,51,128,227,194,123,203,242,220,138,162,176,178,44,173,170,42,171,235, +218,66,8,22,99,180,170,170,44,207,115,75,211,212,188,247,17,56,54,179,126, +131,238,93,111,42,132,64,154,166,44,22,11,146,36,97,54,155,77,129,211,94, +3,239,189,45,151,203,173,244,16,130,101,89,102,243,249,220,178,44,179,241, +120,252,29,56,0,196,204,54,15,177,63,34,130,153,81,215,205,193,77,38,147, +31,195,225,240,17,48,183,54,121,213,160,14,97,43,57,198,104,33,4,43,138, +34,142,70,163,247,235,201,157,164,253,157,247,219,135,255,154,83,224,203, +42,185,157,63,83,241,253,31,62,79,218,54,0,0,0,0,73,69,78,68,174,66,96, +130}; + +static size_t xml_res_size_73 = 722; +static unsigned char xml_res_file_73[] = { +137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, +0,31,243,255,97,0,0,0,4,115,66,73,84,8,8,8,8,124,8,100,136,0,0,0,9,112, +72,89,115,0,0,1,187,0,0,1,187,1,58,236,227,226,0,0,0,25,116,69,88,116,83, +111,102,116,119,97,114,101,0,119,119,119,46,105,110,107,115,99,97,112,101, +46,111,114,103,155,238,60,26,0,0,2,79,73,68,65,84,120,218,149,146,77,79, +19,81,20,134,159,206,76,97,144,214,34,20,172,5,44,248,65,64,80,64,49,174, +76,32,196,96,98,92,201,202,149,63,199,127,224,218,157,113,225,210,4,19, +99,4,66,52,128,137,149,40,74,12,2,210,226,52,181,182,25,238,180,157,143, +235,76,176,21,165,46,124,147,55,115,39,119,206,51,239,57,57,33,41,37,161, +80,72,3,34,252,159,76,191,214,209,56,80,143,97,24,155,158,148,40,138,18, +56,128,254,97,160,254,12,238,163,145,72,63,240,165,6,192,147,212,149,207, +11,86,222,100,216,51,4,158,235,145,76,182,112,99,122,16,189,73,59,0,241, +91,117,128,170,42,0,44,189,218,33,95,176,241,90,117,22,54,13,98,209,48, +235,89,147,151,171,89,238,221,185,200,232,72,119,61,9,128,2,212,99,109, +111,253,224,221,90,142,228,112,15,122,42,65,199,196,25,68,91,148,143,194, +97,203,148,220,127,48,143,85,182,81,84,245,40,32,160,206,47,237,208,222, +215,73,247,233,118,218,58,143,211,159,138,147,11,169,88,186,78,222,178, +41,56,26,143,158,164,81,21,165,113,130,149,213,109,140,170,67,113,223,161, +82,177,41,89,21,92,9,14,10,85,233,17,239,233,226,131,223,22,141,102,32, +61,137,89,172,242,236,245,46,250,201,118,74,82,33,155,19,200,138,131,235, +184,193,189,111,59,0,54,158,129,22,214,232,77,181,81,249,110,242,244,197, +6,185,221,34,177,144,135,83,20,132,68,5,219,79,181,182,252,153,174,88,24, +165,81,11,1,243,234,120,18,76,129,200,22,73,181,104,92,63,31,231,246,196, +105,206,37,162,40,86,153,72,179,202,173,233,97,164,148,71,1,248,177,102, +103,199,152,188,148,64,87,224,249,194,39,186,90,53,134,123,162,52,185,46, +205,199,84,238,222,28,100,100,228,20,229,114,153,154,106,171,220,183,47, +196,166,226,67,130,120,15,31,191,101,37,179,207,181,241,94,182,51,69,178, +25,131,233,11,29,140,13,197,8,190,207,102,247,222,79,77,77,142,249,103, +187,14,16,62,160,182,198,162,234,178,225,3,230,151,215,41,11,147,43,163, +3,196,195,38,67,3,103,89,92,92,52,102,102,102,250,253,58,1,80,235,167,79, +88,150,244,163,201,106,181,42,109,219,150,174,235,74,207,243,164,227,56, +178,84,42,201,116,58,45,231,230,230,190,197,98,177,19,65,77,205,218,161, +69,170,251,176,126,37,164,80,40,172,251,127,190,236,191,91,192,145,25,232, +64,130,127,75,2,95,165,148,46,127,233,39,76,96,41,157,161,183,243,24,0, +0,0,0,73,69,78,68,174,66,96,130}; + +static size_t xml_res_size_74 = 663; +static unsigned char xml_res_file_74[] = { +137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, +0,31,243,255,97,0,0,0,4,115,66,73,84,8,8,8,8,124,8,100,136,0,0,0,9,112, +72,89,115,0,0,1,187,0,0,1,187,1,58,236,227,226,0,0,0,25,116,69,88,116,83, +111,102,116,119,97,114,101,0,119,119,119,46,105,110,107,115,99,97,112,101, +46,111,114,103,155,238,60,26,0,0,2,20,73,68,65,84,56,141,149,147,193,75, +27,65,24,197,127,51,217,37,19,214,93,21,3,57,120,232,37,1,15,18,16,105, +47,189,73,193,123,251,71,122,234,191,16,234,45,17,241,208,34,246,144,38, +193,32,232,54,135,16,178,179,155,221,236,124,189,36,169,26,41,244,193,199, +48,135,247,190,55,239,49,74,68,80,74,189,3,78,249,63,124,23,145,190,183, +186,156,198,113,252,213,137,160,181,70,107,141,82,234,197,0,155,83,107, +77,184,179,243,5,232,235,181,92,233,4,231,28,163,225,144,212,90,122,221, +46,0,203,162,216,144,21,108,102,141,181,3,82,155,48,30,143,9,130,128,253, +253,125,218,237,54,191,250,125,140,49,36,73,194,241,241,49,172,69,148,218, +22,80,74,209,106,181,72,211,148,241,120,76,165,82,161,209,104,32,34,76, +38,19,116,165,178,217,172,180,222,22,112,34,76,167,83,68,132,56,142,49, +198,16,134,33,198,24,166,211,41,54,73,136,162,232,69,22,0,27,169,106,181, +74,158,231,12,6,3,222,127,248,64,154,166,148,101,73,150,101,28,30,30,210, +233,116,94,4,186,37,176,44,10,68,4,207,243,232,117,187,204,102,51,68,132, +197,98,193,104,52,162,94,175,115,125,125,205,237,237,237,219,25,44,203, +146,60,207,9,130,128,106,181,74,163,209,192,247,125,226,56,166,86,171,161, +181,38,138,34,140,49,204,102,179,109,7,190,231,225,121,30,65,16,16,69,17, +190,239,227,156,35,138,34,30,31,31,57,56,56,192,90,139,181,22,223,247,223, +200,192,24,22,139,5,79,79,79,136,8,247,247,247,104,173,121,120,120,32,12, +67,230,243,57,195,225,144,56,142,201,243,124,251,9,97,24,114,114,114,66, +150,101,220,220,220,176,187,187,75,179,217,164,213,106,209,233,116,152, +207,231,236,237,237,81,175,215,25,12,134,19,224,14,0,17,1,248,108,173,149, +44,203,36,207,115,41,138,66,150,203,165,148,101,41,206,57,185,186,186,146, +139,139,11,73,146,68,190,93,94,38,64,27,80,34,242,215,1,175,234,89,87,230, +156,227,232,232,136,90,173,70,175,215,75,206,207,207,63,2,63,100,181,217, +123,77,120,221,243,234,183,98,173,253,125,118,118,246,233,57,153,181,13, +165,84,115,101,235,95,184,3,126,62,39,3,252,1,217,225,10,185,26,200,210, +115,0,0,0,0,73,69,78,68,174,66,96,130}; + +static size_t xml_res_size_75 = 605; +static unsigned char xml_res_file_75[] = { +137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, +0,31,243,255,97,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, +68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,11,19,0, +0,11,19,1,0,154,156,24,0,0,0,7,116,73,77,69,7,217,8,31,13,20,16,250,46, +191,45,0,0,1,221,73,68,65,84,56,203,141,145,63,79,84,81,16,197,127,247, +237,125,239,237,219,37,186,17,92,179,40,132,64,164,209,196,16,21,131,90, +110,161,133,198,198,68,43,75,19,45,172,44,44,253,6,216,104,163,54,54,90, +240,5,40,109,44,36,187,161,245,79,8,89,65,80,99,4,53,139,251,238,204,88, +136,65,86,87,56,201,100,206,100,238,57,247,230,92,71,55,110,54,95,146,22, +155,160,49,134,199,44,198,17,99,82,102,250,216,185,238,227,254,47,131,56, +110,48,60,248,152,188,51,128,133,18,121,72,81,73,145,144,113,99,174,197, +253,19,67,255,55,48,2,225,219,26,106,37,130,41,22,58,124,125,187,193,143, +149,54,107,186,180,243,11,34,170,228,28,194,244,48,98,223,105,92,91,105, +221,121,126,47,235,35,69,129,219,188,71,0,133,245,85,50,63,211,199,210, +129,189,124,196,240,14,162,51,203,11,77,6,42,41,166,253,160,163,228,159, +170,213,113,230,19,207,50,194,24,1,126,151,180,57,232,107,253,188,158,26, +97,22,97,24,72,40,120,15,157,50,98,37,76,51,72,18,235,208,2,62,32,40,1, +33,7,4,52,39,245,146,179,142,50,143,163,128,18,35,249,24,65,39,49,45,163, +150,65,86,140,160,142,240,14,225,56,129,57,2,111,16,134,98,207,41,95,44, +48,10,28,65,57,137,240,234,238,179,139,179,143,152,170,157,102,113,240, +233,190,11,67,251,199,95,4,2,14,3,132,10,66,29,161,78,0,103,224,26,35,44, +78,212,120,8,92,65,41,2,49,70,49,8,233,147,38,123,142,62,128,137,243,44, +249,136,5,132,179,228,91,25,124,94,5,239,140,2,70,10,36,64,138,145,96,155, +29,152,188,142,251,210,196,74,101,6,255,12,16,129,141,54,120,85,82,51,46, +57,200,208,45,147,60,144,136,254,250,217,202,4,142,30,112,0,51,125,116, +80,112,17,145,131,8,133,141,128,187,218,217,38,180,94,250,221,194,184,108, +183,186,184,117,47,182,47,187,251,191,121,79,1,187,224,214,235,214,157, +141,55,231,159,211,206,255,117,93,144,8,34,0,0,0,0,73,69,78,68,174,66,96, +130}; + +static size_t xml_res_size_76 = 650; +static unsigned char xml_res_file_76[] = { +137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, +0,224,119,61,248,0,0,2,81,73,68,65,84,72,137,213,150,177,79,21,65,16,198, +127,179,187,239,65,3,39,137,13,209,4,197,88,144,152,24,80,99,4,108,44,108, +44,161,246,127,240,143,176,182,176,55,26,59,163,38,82,217,216,80,96,34, +193,196,74,27,144,40,248,4,18,20,98,144,119,183,59,99,113,247,158,47,128, +20,15,40,156,100,50,59,151,205,247,237,204,119,59,119,98,102,156,164,185, +19,69,7,194,131,71,207,31,175,172,52,110,23,69,42,146,41,166,74,82,197, +20,84,149,164,101,133,73,21,51,5,64,196,225,164,35,58,193,123,71,111,189, +142,153,129,64,45,132,218,185,161,179,51,97,189,177,54,113,119,250,206, +224,110,179,32,166,68,17,19,49,38,98,82,98,76,164,164,196,164,164,84,174, +17,240,206,225,189,195,59,71,8,158,177,75,195,124,90,92,229,242,200,121, +150,190,52,24,30,26,100,181,177,193,179,87,175,39,93,140,205,35,139,240, +225,227,50,0,159,191,126,7,96,185,138,88,34,136,115,140,92,56,131,15,1, +51,99,107,107,155,236,84,134,28,10,41,237,112,208,62,17,161,200,115,68, +164,20,57,4,143,247,158,16,2,75,75,139,4,95,230,222,123,156,115,32,210, +206,75,255,219,34,119,128,139,8,226,74,234,176,151,93,85,247,157,198,203, +225,245,28,102,251,8,58,161,94,190,219,0,192,188,48,117,229,244,241,16, +20,49,242,118,110,142,164,202,118,184,8,64,108,198,174,192,15,36,16,224, +198,248,56,0,243,47,230,201,178,140,157,120,140,45,234,180,123,83,215,186, +6,254,39,65,234,16,249,216,52,104,205,59,51,40,242,188,157,111,87,100,197, +238,17,53,48,12,235,136,11,239,23,40,242,156,31,223,2,253,89,198,78,209, +173,6,174,106,145,89,219,157,115,140,141,142,2,112,189,235,115,183,76,9, +24,168,25,98,86,77,66,65,171,30,205,44,108,150,219,156,48,125,245,40,247, +160,179,2,145,182,40,109,13,126,23,93,215,208,22,217,170,10,68,132,217, +217,89,76,141,205,159,125,244,103,253,252,202,143,116,15,74,80,231,28,102, +198,228,228,4,173,129,113,171,123,220,202,28,193,123,47,141,181,117,84, +203,59,208,250,138,169,42,170,86,186,149,235,122,232,161,30,234,213,0,244, +244,212,234,36,43,240,98,212,66,13,179,68,175,235,163,105,59,152,37,156, +32,33,55,158,222,127,248,228,102,140,154,172,234,151,97,165,12,70,249,250, +90,149,83,93,16,17,130,247,41,198,228,247,62,243,120,51,73,193,123,31,6, +6,178,55,242,223,255,85,252,1,24,65,56,54,40,27,151,24,0,0,0,0,73,69,78, +68,174,66,96,130}; + +static size_t xml_res_size_77 = 1441; +static unsigned char xml_res_file_77[] = { +137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, +0,224,119,61,248,0,0,5,104,73,68,65,84,72,137,157,149,123,108,84,85,30, +199,63,247,222,121,79,59,157,87,31,67,165,165,60,2,168,96,45,82,160,165, +176,130,45,34,106,180,212,7,3,24,212,108,118,217,138,15,2,155,64,182,162, +137,174,201,186,21,43,62,163,6,196,250,136,161,248,0,223,132,10,68,131, +232,80,75,133,210,98,133,22,218,105,103,104,203,208,105,59,157,153,123, +143,127,232,104,41,110,33,251,77,110,206,201,239,124,207,247,147,243,187, +39,57,210,227,155,30,3,160,184,164,132,135,215,172,65,167,211,225,93,225, +101,226,248,9,36,228,93,185,146,145,90,117,207,189,196,53,141,104,52,38, +37,106,185,185,215,136,145,62,249,183,241,86,64,0,127,185,40,105,116,109, +40,40,156,213,90,56,119,150,86,88,56,251,67,96,236,69,128,250,31,234,168, +255,161,46,37,247,218,107,120,227,237,183,106,1,239,101,4,143,3,158,47, +47,255,251,191,231,207,159,55,118,124,78,14,209,72,100,129,197,108,10,55, +55,29,103,248,167,76,157,50,5,224,72,203,79,45,99,138,75,74,102,184,220, 169,75,7,6,194,79,59,29,206,88,34,109,105,105,41,53,239,191,63,28,80,180, 99,103,205,102,171,217,196,241,198,70,182,110,219,118,200,100,182,140,239, 13,4,146,35,209,232,171,192,206,132,81,55,108,211,223,30,41,127,160,233, @@ -13151,8 +13533,8 @@ static unsigned char xml_res_file_67[] = { 104,50,202,50,66,19,254,56,218,5,245,95,0,139,190,34,253,5,135,60,70,0, 0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_68 = 1535; -static unsigned char xml_res_file_68[] = { +static size_t xml_res_size_78 = 1535; +static unsigned char xml_res_file_78[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,5,198,73,68,65,84,72,137,141,85,91,108,84,85,20,93, 231,49,119,238,60,238,109,75,71,135,233,67,90,121,4,218,210,66,169,148, @@ -13229,8 +13611,8 @@ static unsigned char xml_res_file_68[] = { 154,76,147,82,202,123,255,7,247,47,167,133,32,16,88,94,2,114,0,0,0,0,73, 69,78,68,174,66,96,130}; -static size_t xml_res_size_69 = 1613; -static unsigned char xml_res_file_69[] = { +static size_t xml_res_size_79 = 1613; +static unsigned char xml_res_file_79[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,6,20,73,68,65,84,72,137,133,150,93,108,20,215,25,134, 159,115,206,204,236,238,120,215,94,219,113,8,144,24,22,136,1,139,22,90, @@ -13311,8 +13693,8 @@ static unsigned char xml_res_file_69[] = { 223,223,190,253,142,215,150,255,0,214,238,196,55,88,39,81,13,0,0,0,0,73, 69,78,68,174,66,96,130}; -static size_t xml_res_size_70 = 1021; -static unsigned char xml_res_file_70[] = { +static size_t xml_res_size_80 = 1021; +static unsigned char xml_res_file_80[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,3,196,73,68,65,84,72,137,165,150,203,139,28,85,20, 198,127,183,170,186,167,31,147,54,142,163,81,12,81,18,200,195,188,52,162, @@ -13364,8 +13746,8 @@ static unsigned char xml_res_file_70[] = { 180,185,255,243,219,178,120,109,222,247,86,21,141,211,153,223,191,202,86, 218,254,5,146,137,160,153,55,29,158,147,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_71 = 1387; -static unsigned char xml_res_file_71[] = { +static size_t xml_res_size_81 = 1387; +static unsigned char xml_res_file_81[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,5,50,73,68,65,84,72,137,165,213,91,108,92,71,25,192, 241,255,156,235,222,236,245,218,235,107,176,29,39,165,141,99,80,49,145, @@ -13436,8 +13818,8 @@ static unsigned char xml_res_file_71[] = { 232,116,247,112,233,193,209,237,35,251,111,5,248,39,68,83,179,103,45,179, 228,235,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_72 = 1351; -static unsigned char xml_res_file_72[] = { +static size_t xml_res_size_82 = 1351; +static unsigned char xml_res_file_82[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,5,14,73,68,65,84,72,137,141,149,207,143,28,71,25,134, 159,170,254,53,51,59,251,123,118,179,179,182,19,219,36,78,198,177,76,76, @@ -13505,8 +13887,8 @@ static unsigned char xml_res_file_72[] = { 2,164,251,102,76,253,120,236,197,2,0,1,28,80,1,229,222,252,140,224,127, 1,119,50,232,229,4,159,129,227,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_73 = 1264; -static unsigned char xml_res_file_73[] = { +static size_t xml_res_size_83 = 1264; +static unsigned char xml_res_file_83[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,4,183,73,68,65,84,72,137,149,148,203,79,93,85,20,135, 191,189,247,125,150,75,105,47,180,2,154,24,91,18,18,27,235,171,45,85,169, @@ -13570,8 +13952,8 @@ static unsigned char xml_res_file_73[] = { 147,112,128,93,33,105,222,50,177,41,20,54,198,223,184,252,254,212,64,227, 112,233,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_74 = 876; -static unsigned char xml_res_file_74[] = { +static size_t xml_res_size_84 = 876; +static unsigned char xml_res_file_84[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,3,51,73,68,65,84,72,137,181,149,75,76,19,81,20,134, 239,189,165,157,185,243,104,167,47,10,109,33,84,44,5,141,8,136,21,133,88, @@ -13615,8 +13997,8 @@ static unsigned char xml_res_file_74[] = { 246,186,132,49,86,49,26,141,25,99,66,162,211,209,49,0,136,110,40,96,53, 250,3,182,172,2,112,190,22,130,190,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_75 = 784; -static unsigned char xml_res_file_75[] = { +static size_t xml_res_size_85 = 784; +static unsigned char xml_res_file_85[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,2,215,73,68,65,84,72,137,165,85,77,79,219,64,20,156, 125,78,8,20,90,21,164,222,145,26,218,222,56,20,1,237,63,224,71,113,236, @@ -13656,8 +14038,8 @@ static unsigned char xml_res_file_75[] = { 230,231,231,87,235,245,122,189,213,106,93,48,115,83,70,61,171,239,225,31, 208,143,130,239,12,29,142,98,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_76 = 1073; -static unsigned char xml_res_file_76[] = { +static size_t xml_res_size_86 = 1073; +static unsigned char xml_res_file_86[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,3,248,73,68,65,84,72,137,141,148,95,136,212,85,20, 199,63,247,254,126,51,59,59,142,233,182,138,174,134,86,43,217,154,139,253, @@ -13712,8 +14094,8 @@ static unsigned char xml_res_file_76[] = { 139,197,99,0,255,1,154,99,8,57,153,132,38,85,0,0,0,0,73,69,78,68,174,66, 96,130}; -static size_t xml_res_size_77 = 1395; -static unsigned char xml_res_file_77[] = { +static size_t xml_res_size_87 = 1395; +static unsigned char xml_res_file_87[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,5,58,73,68,65,84,72,137,141,149,203,143,28,87,21,198, 127,231,222,91,93,93,213,221,211,221,51,147,153,113,98,141,109,97,8,146, @@ -13784,8 +14166,8 @@ static unsigned char xml_res_file_77[] = { 153,226,157,181,62,118,145,255,47,236,128,136,22,16,150,28,174,0,0,0,0, 73,69,78,68,174,66,96,130}; -static size_t xml_res_size_78 = 1363; -static unsigned char xml_res_file_78[] = { +static size_t xml_res_size_88 = 1363; +static unsigned char xml_res_file_88[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,5,26,73,68,65,84,72,137,133,149,203,111,93,71,25,192, 127,223,204,156,115,238,251,157,216,233,181,211,86,118,147,56,137,82,68, @@ -13854,8 +14236,8 @@ static unsigned char xml_res_file_78[] = { 225,204,226,105,202,181,50,86,57,156,1,60,135,0,226,243,63,47,250,255,150, 255,0,181,23,55,72,168,81,70,216,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_79 = 1155; -static unsigned char xml_res_file_79[] = { +static size_t xml_res_size_89 = 1155; +static unsigned char xml_res_file_89[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,4,74,73,68,65,84,72,137,173,148,93,108,20,85,20,199, 127,247,206,236,116,246,163,59,219,237,23,84,104,107,45,212,22,105,41,32, @@ -13914,8 +14296,8 @@ static unsigned char xml_res_file_79[] = { 43,131,41,229,1,252,3,30,188,97,109,235,41,88,189,0,0,0,0,73,69,78,68,174, 66,96,130}; -static size_t xml_res_size_80 = 1605; -static unsigned char xml_res_file_80[] = { +static size_t xml_res_size_90 = 1605; +static unsigned char xml_res_file_90[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,22,0,0,0,22,8,6,0,0, 0,196,180,108,59,0,0,6,12,73,68,65,84,120,218,117,149,9,80,83,87,24,133, 127,4,100,171,168,224,130,32,34,117,1,151,201,72,113,235,74,177,118,106, @@ -13997,8 +14379,8 @@ static unsigned char xml_res_file_80[] = { 114,255,228,252,1,144,84,9,87,144,77,161,244,0,0,0,0,73,69,78,68,174,66, 96,130}; -static size_t xml_res_size_81 = 1667; -static unsigned char xml_res_file_81[] = { +static size_t xml_res_size_91 = 1667; +static unsigned char xml_res_file_91[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,6,74,73,68,65,84,72,137,117,150,105,108,84,215,21, 199,127,247,190,55,251,230,241,100,112,109,192,91,216,151,24,74,65,160, @@ -14083,8 +14465,8 @@ static unsigned char xml_res_file_81[] = { 206,244,255,74,24,231,27,106,141,149,170,0,0,0,0,73,69,78,68,174,66,96, 130}; -static size_t xml_res_size_82 = 347; -static unsigned char xml_res_file_82[] = { +static size_t xml_res_size_92 = 347; +static unsigned char xml_res_file_92[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,1,34,73,68,65,84,72,137,181,150,65,174,131,48,12,68, 199,166,72,92,14,14,203,134,61,135,202,134,198,249,155,111,148,166,147, @@ -14103,8 +14485,8 @@ static unsigned char xml_res_file_82[] = { 175,255,85,52,27,237,27,246,7,83,200,247,201,63,145,191,196,0,0,0,0,73, 69,78,68,174,66,96,130}; -static size_t xml_res_size_83 = 1428; -static unsigned char xml_res_file_83[] = { +static size_t xml_res_size_93 = 1428; +static unsigned char xml_res_file_93[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,5,91,73,68,65,84,72,137,157,148,203,143,29,71,25,197, 127,85,253,184,207,153,185,241,216,51,19,99,3,22,198,88,4,153,4,33,145, @@ -14176,8 +14558,8 @@ static unsigned char xml_res_file_83[] = { 96,8,56,128,245,245,117,254,13,251,38,133,42,145,10,134,39,0,0,0,0,73,69, 78,68,174,66,96,130}; -static size_t xml_res_size_84 = 970; -static unsigned char xml_res_file_84[] = { +static size_t xml_res_size_94 = 970; +static unsigned char xml_res_file_94[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,3,145,73,68,65,84,72,137,157,148,203,139,28,85,20, 198,127,231,222,238,169,158,164,199,196,113,66,156,24,8,154,224,34,146, @@ -14227,8 +14609,8 @@ static unsigned char xml_res_file_84[] = { 118,206,63,0,31,128,244,63,38,255,0,189,195,168,22,42,193,211,163,0,0,0, 0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_85 = 1455; -static unsigned char xml_res_file_85[] = { +static size_t xml_res_size_95 = 1455; +static unsigned char xml_res_file_95[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,3,0,0, 0,215,169,205,202,0,0,3,0,80,76,84,69,0,0,0,128,0,0,0,128,0,128,128,0,0, 0,128,128,0,128,0,128,128,192,192,192,192,220,192,166,202,240,0,0,0,0,0, @@ -14286,8 +14668,8 @@ static unsigned char xml_res_file_85[] = { 206,169,219,253,0,34,114,235,26,76,191,236,97,186,71,30,173,57,109,236, 2,134,169,26,64,30,137,104,190,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_86 = 1597; -static unsigned char xml_res_file_86[] = { +static size_t xml_res_size_96 = 1597; +static unsigned char xml_res_file_96[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,6,4,73,68,65,84,72,137,149,149,123,108,150,87,29,199, 63,231,185,188,207,123,239,149,94,222,182,244,182,182,86,64,39,117,23,98, @@ -14367,8 +14749,8 @@ static unsigned char xml_res_file_86[] = { 212,222,120,213,52,90,82,156,253,215,5,234,52,157,180,162,112,51,34,63, 94,255,1,47,201,188,241,243,150,3,243,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_87 = 1432; -static unsigned char xml_res_file_87[] = { +static size_t xml_res_size_97 = 1432; +static unsigned char xml_res_file_97[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,5,95,73,68,65,84,120,218,205,150,123,76,83,103,24, 198,29,152,133,136,40,58,93,132,57,182,160,66,108,32,32,24,96,12,21,229, @@ -14440,8 +14822,8 @@ static unsigned char xml_res_file_87[] = { 48,247,242,224,225,29,32,47,39,158,0,91,89,7,72,247,156,238,77,140,61,155, 167,181,127,3,206,9,28,183,14,15,59,151,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_88 = 1345; -static unsigned char xml_res_file_88[] = { +static size_t xml_res_size_98 = 1345; +static unsigned char xml_res_file_98[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,0,43,116,69,88,116,67,114,101,97,116,105,111,110,32, 84,105,109,101,0,83,111,32,50,56,32,68,101,122,32,50,48,48,51,32,49,57, @@ -14508,8 +14890,8 @@ static unsigned char xml_res_file_88[] = { 127,99,121,52,26,109,2,141,23,145,75,254,79,224,231,110,127,2,154,182,229, 168,238,223,11,59,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_89 = 1229; -static unsigned char xml_res_file_89[] = { +static size_t xml_res_size_99 = 1229; +static unsigned char xml_res_file_99[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,4,148,73,68,65,84,72,137,141,150,203,111,85,85,20, 198,127,107,159,115,47,229,246,69,105,27,110,185,148,150,90,121,24,148, @@ -14571,8 +14953,8 @@ static unsigned char xml_res_file_89[] = { 222,175,252,191,24,134,76,78,68,163,58,246,16,192,234,234,234,110,0,252, 11,226,113,105,244,162,127,88,205,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_90 = 1581; -static unsigned char xml_res_file_90[] = { +static size_t xml_res_size_100 = 1581; +static unsigned char xml_res_file_100[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,5,244,73,68,65,84,72,137,141,149,123,108,149,119,25, 199,63,191,247,125,207,253,210,203,169,231,148,210,11,87,211,201,194,168, @@ -14652,8 +15034,8 @@ static unsigned char xml_res_file_90[] = { 28,180,241,67,226,252,207,128,127,1,238,178,9,22,222,6,142,239,0,0,0,0, 73,69,78,68,174,66,96,130}; -static size_t xml_res_size_91 = 1618; -static unsigned char xml_res_file_91[] = { +static size_t xml_res_size_101 = 1618; +static unsigned char xml_res_file_101[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,0,42,116,69,88,116,67,114,101,97,116,105,111,110,32, 84,105,109,101,0,70,114,32,56,32,65,117,103,32,50,48,48,51,32,49,50,58, @@ -14734,8 +15116,8 @@ static unsigned char xml_res_file_91[] = { 49,246,96,226,191,224,188,148,241,15,81,36,199,113,168,252,75,132,0,0,0, 0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_92 = 1600; -static unsigned char xml_res_file_92[] = { +static size_t xml_res_size_102 = 1600; +static unsigned char xml_res_file_102[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,0,42,116,69,88,116,67,114,101,97,116,105,111,110,32, 84,105,109,101,0,70,114,32,56,32,65,117,103,32,50,48,48,51,32,49,50,58, @@ -14815,8 +15197,8 @@ static unsigned char xml_res_file_92[] = { 159,215,31,226,164,169,192,188,186,0,153,0,0,0,0,73,69,78,68,174,66,96, 130}; -static size_t xml_res_size_93 = 1051; -static unsigned char xml_res_file_93[] = { +static size_t xml_res_size_103 = 1051; +static unsigned char xml_res_file_103[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,3,226,73,68,65,84,72,137,149,149,201,111,28,69,20, 135,191,218,186,199,219,56,118,44,79,236,128,229,216,135,144,5,133,27,72, @@ -14870,8 +15252,8 @@ static unsigned char xml_res_file_93[] = { 187,37,248,7,136,126,190,62,214,237,108,78,0,0,0,0,73,69,78,68,174,66,96, 130}; -static size_t xml_res_size_94 = 1136; -static unsigned char xml_res_file_94[] = { +static size_t xml_res_size_104 = 1136; +static unsigned char xml_res_file_104[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,4,55,73,68,65,84,72,137,237,149,93,108,83,117,24,198, 159,255,57,167,167,167,61,221,233,119,187,178,174,237,216,128,45,72,194, @@ -14929,8 +15311,8 @@ static unsigned char xml_res_file_94[] = { 95,109,26,118,255,148,254,195,15,231,95,3,248,13,125,198,218,111,204,167, 100,148,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_95 = 1042; -static unsigned char xml_res_file_95[] = { +static size_t xml_res_size_105 = 1042; +static unsigned char xml_res_file_105[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,3,217,73,68,65,84,72,137,173,148,109,76,91,85,24,199, 255,247,150,214,210,82,236,202,192,137,67,32,46,10,193,189,40,108,81,23, @@ -14983,8 +15365,8 @@ static unsigned char xml_res_file_95[] = { 99,48,24,94,137,90,7,75,165,127,1,28,245,114,167,199,223,211,46,0,0,0,0, 73,69,78,68,174,66,96,130}; -static size_t xml_res_size_96 = 1060; -static unsigned char xml_res_file_96[] = { +static size_t xml_res_size_106 = 1060; +static unsigned char xml_res_file_106[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,3,235,73,68,65,84,72,137,165,150,223,107,20,87,20, 199,63,119,118,55,219,117,53,26,173,209,88,43,49,169,21,196,66,91,169,72, @@ -15038,8 +15420,8 @@ static unsigned char xml_res_file_96[] = { 139,26,53,194,95,238,252,108,151,175,253,13,46,235,39,209,84,139,215,54, 0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_97 = 1304; -static unsigned char xml_res_file_97[] = { +static size_t xml_res_size_107 = 1304; +static unsigned char xml_res_file_107[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,0,4,103,65,77,65,0,0,175,200,55,5,138,233,0,0,0,25, 116,69,88,116,83,111,102,116,119,97,114,101,0,65,100,111,98,101,32,73,109, @@ -15105,8 +15487,8 @@ static unsigned char xml_res_file_97[] = { 242,185,194,49,199,207,157,63,91,154,122,254,159,0,3,0,231,195,138,67,73, 226,228,15,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_98 = 1046; -static unsigned char xml_res_file_98[] = { +static size_t xml_res_size_108 = 1046; +static unsigned char xml_res_file_108[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,3,221,73,68,65,84,72,137,141,149,223,107,92,85,16, 199,63,115,206,185,155,221,166,205,175,141,107,109,176,149,40,86,250,203, @@ -15160,8 +15542,8 @@ static unsigned char xml_res_file_98[] = { 135,82,179,17,182,151,148,255,0,250,27,66,145,188,185,81,236,0,0,0,0,73, 69,78,68,174,66,96,130}; -static size_t xml_res_size_99 = 1055; -static unsigned char xml_res_file_99[] = { +static size_t xml_res_size_109 = 1055; +static unsigned char xml_res_file_109[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,3,230,73,68,65,84,72,137,141,148,205,110,85,85,20, 199,127,107,239,115,90,110,91,218,210,150,166,210,72,77,67,66,131,64,76, @@ -15215,8 +15597,8 @@ static unsigned char xml_res_file_99[] = { 52,142,56,42,181,141,57,123,201,254,3,252,130,60,1,189,90,102,230,0,0,0, 0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_100 = 1510; -static unsigned char xml_res_file_100[] = { +static size_t xml_res_size_110 = 1510; +static unsigned char xml_res_file_110[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,5,173,73,68,65,84,72,137,141,150,109,140,84,87,25, 199,127,231,220,123,103,238,188,238,204,190,117,119,217,93,96,187,236,74, @@ -15293,8 +15675,8 @@ static unsigned char xml_res_file_100[] = { 169,219,173,253,31,151,169,176,141,218,30,108,211,0,0,0,0,73,69,78,68,174, 66,96,130}; -static size_t xml_res_size_101 = 1759; -static unsigned char xml_res_file_101[] = { +static size_t xml_res_size_111 = 1759; +static unsigned char xml_res_file_111[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,6,166,73,68,65,84,120,218,165,150,11,80,149,199,25, 134,127,77,38,17,17,47,220,196,115,196,11,130,226,5,17,10,38,20,3,42,245, @@ -15383,8 +15765,8 @@ static unsigned char xml_res_file_101[] = { 189,242,47,51,165,69,159,12,127,147,26,255,15,119,77,151,39,146,238,48, 214,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_102 = 1316; -static unsigned char xml_res_file_102[] = { +static size_t xml_res_size_112 = 1316; +static unsigned char xml_res_file_112[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,4,235,73,68,65,84,72,137,141,150,109,108,84,85,26, 128,159,115,238,189,211,59,51,119,166,51,5,74,91,104,145,90,10,70,80,179, @@ -15451,8 +15833,8 @@ static unsigned char xml_res_file_102[] = { 87,42,13,201,238,173,233,179,173,253,25,145,180,96,102,170,35,60,27,0,0, 0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_103 = 1528; -static unsigned char xml_res_file_103[] = { +static size_t xml_res_size_113 = 1528; +static unsigned char xml_res_file_113[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,5,191,73,68,65,84,72,137,141,150,109,140,92,85,25, 199,127,231,190,204,222,153,185,51,59,179,221,93,246,189,116,217,110,69, @@ -15530,8 +15912,8 @@ static unsigned char xml_res_file_103[] = { 236,203,92,111,239,127,0,47,28,209,136,136,133,235,226,0,0,0,0,73,69,78, 68,174,66,96,130}; -static size_t xml_res_size_104 = 741; -static unsigned char xml_res_file_104[] = { +static size_t xml_res_size_114 = 741; +static unsigned char xml_res_file_114[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,2,172,73,68,65,84,120,218,237,149,75,76,19,65,24,199, 33,169,145,32,80,172,45,22,23,202,163,44,45,244,69,67,105,49,45,45,132, @@ -15569,8 +15951,8 @@ static unsigned char xml_res_file_104[] = { 19,142,23,228,181,236,128,146,202,98,244,201,29,27,126,17,243,101,218,168, 92,191,0,183,96,17,141,7,40,45,86,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_105 = 733; -static unsigned char xml_res_file_105[] = { +static size_t xml_res_size_115 = 733; +static unsigned char xml_res_file_115[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,2,164,73,68,65,84,120,218,99,96,24,5,20,2,22,32,110, 7,226,231,64,92,135,36,14,98,191,0,226,46,32,102,165,196,130,102,32,254, @@ -15607,8 +15989,8 @@ static unsigned char xml_res_file_105[] = { 160,122,37,12,44,92,152,193,113,34,33,241,171,90,76,236,57,165,230,1,0, 34,72,18,70,202,150,34,141,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_106 = 645; -static unsigned char xml_res_file_106[] = { +static size_t xml_res_size_116 = 645; +static unsigned char xml_res_file_116[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,2,76,73,68,65,84,120,218,99,96,24,5,20,2,22,32,110, 7,226,231,64,92,135,36,14,98,191,0,226,46,32,102,165,196,130,102,32,254, @@ -15641,8 +16023,8 @@ static unsigned char xml_res_file_106[] = { 223,132,54,134,131,45,0,166,121,131,28,49,96,186,199,109,56,0,189,144,255, 225,162,220,100,224,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_107 = 1279; -static unsigned char xml_res_file_107[] = { +static size_t xml_res_size_117 = 1279; +static unsigned char xml_res_file_117[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,4,198,73,68,65,84,120,218,221,84,107,76,147,103,20, 102,127,150,232,244,215,150,161,83,71,147,141,197,9,3,5,164,32,182,148, @@ -15707,8 +16089,8 @@ static unsigned char xml_res_file_107[] = { 34,130,131,159,251,19,173,74,154,35,111,149,1,82,0,0,0,0,73,69,78,68,174, 66,96,130}; -static size_t xml_res_size_108 = 1250; -static unsigned char xml_res_file_108[] = { +static size_t xml_res_size_118 = 1250; +static unsigned char xml_res_file_118[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,4,169,73,68,65,84,120,218,221,149,125,76,212,117,28, 199,253,219,13,41,195,6,242,116,138,136,10,66,76,33,76,61,48,192,104,247, @@ -15771,8 +16153,8 @@ static unsigned char xml_res_file_108[] = { 68,162,250,23,69,162,109,204,214,239,118,127,5,166,232,158,119,93,196,182, 196,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_109 = 1216; -static unsigned char xml_res_file_109[] = { +static size_t xml_res_size_119 = 1216; +static unsigned char xml_res_file_119[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,4,135,73,68,65,84,120,218,221,149,89,76,84,103,24, 134,185,51,33,33,26,139,194,8,3,51,128,35,198,104,26,18,43,3,134,176,53, @@ -15834,8 +16216,8 @@ static unsigned char xml_res_file_109[] = { 177,26,255,79,157,69,188,157,159,192,74,242,0,0,0,0,73,69,78,68,174,66, 96,130}; -static size_t xml_res_size_110 = 1599; -static unsigned char xml_res_file_110[] = { +static size_t xml_res_size_120 = 1599; +static unsigned char xml_res_file_120[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, 68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,10,240,0, @@ -15916,8 +16298,8 @@ static unsigned char xml_res_file_110[] = { 221,252,191,245,119,65,46,42,38,225,66,19,131,0,0,0,0,73,69,78,68,174,66, 96,130}; -static size_t xml_res_size_111 = 1602; -static unsigned char xml_res_file_111[] = { +static size_t xml_res_size_121 = 1602; +static unsigned char xml_res_file_121[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,0,42,116,69,88,116,67,114,101,97,116,105,111,110,32, 84,105,109,101,0,70,114,32,57,32,74,97,110,32,50,48,48,52,32,48,48,58,49, @@ -15997,8 +16379,8 @@ static unsigned char xml_res_file_111[] = { 152,147,113,133,158,207,30,215,230,127,130,63,0,104,13,82,3,7,95,47,134, 0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_112 = 1089; -static unsigned char xml_res_file_112[] = { +static size_t xml_res_size_122 = 1089; +static unsigned char xml_res_file_122[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, 68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,10,240,0, @@ -16053,8 +16435,8 @@ static unsigned char xml_res_file_112[] = { 43,227,237,142,216,232,149,233,58,234,242,247,181,135,253,3,203,50,147, 100,183,187,84,212,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_113 = 1057; -static unsigned char xml_res_file_113[] = { +static size_t xml_res_size_123 = 1057; +static unsigned char xml_res_file_123[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,3,232,73,68,65,84,72,137,173,148,95,76,91,85,28,199, 191,183,189,180,80,88,219,91,7,210,102,110,12,38,133,152,72,235,50,255, @@ -16108,8 +16490,8 @@ static unsigned char xml_res_file_113[] = { 107,10,128,254,3,121,78,40,115,80,87,129,63,0,0,0,0,73,69,78,68,174,66, 96,130}; -static size_t xml_res_size_114 = 1566; -static unsigned char xml_res_file_114[] = { +static size_t xml_res_size_124 = 1566; +static unsigned char xml_res_file_124[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,24,0,0,0,24,8,6,0,0, 0,224,119,61,248,0,0,5,229,73,68,65,84,72,137,125,149,121,140,149,87,21, 192,127,247,126,203,219,190,183,205,188,89,88,134,97,134,173,45,42,206, @@ -16188,8 +16570,8 @@ static unsigned char xml_res_file_114[] = { 126,81,78,201,126,169,221,234,252,255,1,92,191,178,62,219,85,42,35,0,0, 0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_115 = 3177; -static unsigned char xml_res_file_115[] = { +static size_t xml_res_size_125 = 3177; +static unsigned char xml_res_file_125[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -16346,8 +16728,8 @@ static unsigned char xml_res_file_115[] = { 117,254,59,0,154,157,180,83,196,103,183,19,0,0,0,0,73,69,78,68,174,66,96, 130}; -static size_t xml_res_size_116 = 3664; -static unsigned char xml_res_file_116[] = { +static size_t xml_res_size_126 = 3664; +static unsigned char xml_res_file_126[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -16528,8 +16910,8 @@ static unsigned char xml_res_file_116[] = { 159,148,63,215,41,98,224,159,1,0,45,4,122,10,208,42,180,158,0,0,0,0,73, 69,78,68,174,66,96,130}; -static size_t xml_res_size_117 = 3572; -static unsigned char xml_res_file_117[] = { +static size_t xml_res_size_127 = 3572; +static unsigned char xml_res_file_127[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -16705,8 +17087,8 @@ static unsigned char xml_res_file_117[] = { 82,36,18,89,137,68,34,43,28,199,245,182,195,253,55,0,235,12,32,181,63,194, 72,200,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_118 = 870; -static unsigned char xml_res_file_118[] = { +static size_t xml_res_size_128 = 870; +static unsigned char xml_res_file_128[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,3,45,73,68,65,84,56,141,101,147,75,104,84,103,28,197, 127,223,119,239,188,147,153,233,116,154,71,235,24,13,173,150,216,74,241, @@ -16751,8 +17133,8 @@ static unsigned char xml_res_file_118[] = { 249,192,207,181,218,246,173,250,127,1,137,5,123,205,63,249,203,49,0,0,0, 0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_119 = 626; -static unsigned char xml_res_file_119[] = { +static size_t xml_res_size_129 = 626; +static unsigned char xml_res_file_129[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,2,57,73,68,65,84,56,141,125,147,203,107,83,65,20,198, 191,153,59,121,52,109,111,233,75,180,86,11,190,136,171,90,234,90,220,168, @@ -16784,8 +17166,8 @@ static unsigned char xml_res_file_119[] = { 4,0,128,225,76,18,217,195,67,24,159,189,55,193,54,174,151,191,60,44,3,128, 16,192,95,51,173,68,130,10,33,137,220,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_120 = 3498; -static unsigned char xml_res_file_120[] = { +static size_t xml_res_size_130 = 3498; +static unsigned char xml_res_file_130[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -16957,8 +17339,8 @@ static unsigned char xml_res_file_120[] = { 200,29,165,41,241,63,249,31,126,15,0,158,170,158,59,85,250,179,97,0,0,0, 0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_121 = 3497; -static unsigned char xml_res_file_121[] = { +static size_t xml_res_size_131 = 3497; +static unsigned char xml_res_file_131[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -17131,8 +17513,8 @@ static unsigned char xml_res_file_121[] = { 86,217,13,252,51,0,174,95,60,47,158,61,240,253,0,0,0,0,73,69,78,68,174, 66,96,130}; -static size_t xml_res_size_122 = 3538; -static unsigned char xml_res_file_122[] = { +static size_t xml_res_size_132 = 3538; +static unsigned char xml_res_file_132[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -17306,8 +17688,8 @@ static unsigned char xml_res_file_122[] = { 126,24,134,225,204,214,161,28,80,4,74,64,30,208,91,186,0,9,208,218,98,250, 239,0,205,114,115,111,142,163,221,230,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_123 = 3500; -static unsigned char xml_res_file_123[] = { +static size_t xml_res_size_133 = 3500; +static unsigned char xml_res_file_133[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -17479,8 +17861,8 @@ static unsigned char xml_res_file_123[] = { 143,252,242,65,8,254,95,148,144,109,132,144,19,0,34,191,251,63,7,0,58,62, 52,15,149,142,57,94,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_124 = 3356; -static unsigned char xml_res_file_124[] = { +static size_t xml_res_size_134 = 3356; +static unsigned char xml_res_file_134[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -17645,8 +18027,8 @@ static unsigned char xml_res_file_124[] = { 79,106,237,78,199,115,93,215,175,29,31,247,184,3,127,7,0,52,145,234,55, 25,75,41,47,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_125 = 3529; -static unsigned char xml_res_file_125[] = { +static size_t xml_res_size_135 = 3529; +static unsigned char xml_res_file_135[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -17820,8 +18202,8 @@ static unsigned char xml_res_file_125[] = { 113,28,93,94,91,219,158,155,155,123,240,223,1,0,43,233,147,212,90,1,172, 210,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_126 = 3532; -static unsigned char xml_res_file_126[] = { +static size_t xml_res_size_136 = 3532; +static unsigned char xml_res_file_136[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -17995,8 +18377,8 @@ static unsigned char xml_res_file_126[] = { 73,74,129,11,4,209,61,131,190,15,205,86,192,255,3,0,13,158,75,74,247,188, 20,215,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_127 = 3503; -static unsigned char xml_res_file_127[] = { +static size_t xml_res_size_137 = 3503; +static unsigned char xml_res_file_137[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -18169,8 +18551,8 @@ static unsigned char xml_res_file_127[] = { 153,172,181,252,31,253,51,0,16,76,38,2,101,42,184,61,0,0,0,0,73,69,78,68, 174,66,96,130}; -static size_t xml_res_size_128 = 673; -static unsigned char xml_res_file_128[] = { +static size_t xml_res_size_138 = 673; +static unsigned char xml_res_file_138[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,2,104,73,68,65,84,56,141,125,146,189,79,147,81,20,198, 127,247,125,233,11,88,10,20,249,8,31,1,83,141,8,209,32,56,160,14,138,162, @@ -18205,8 +18587,8 @@ static unsigned char xml_res_file_128[] = { 97,75,81,173,21,159,59,31,72,236,15,136,157,103,155,78,15,41,158,0,0,0, 0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_129 = 734; -static unsigned char xml_res_file_129[] = { +static size_t xml_res_size_139 = 734; +static unsigned char xml_res_file_139[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,2,165,73,68,65,84,120,218,125,147,111,72,147,65,28, 199,127,186,9,70,212,86,42,69,101,32,20,73,41,56,36,68,50,3,65,233,69,224, @@ -18244,8 +18626,8 @@ static unsigned char xml_res_file_129[] = { 45,107,140,162,61,100,186,225,251,255,170,253,11,30,31,23,81,83,145,18, 32,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_130 = 3714; -static unsigned char xml_res_file_130[] = { +static size_t xml_res_size_140 = 3714; +static unsigned char xml_res_file_140[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -18428,8 +18810,8 @@ static unsigned char xml_res_file_130[] = { 102,107,141,15,71,159,167,148,174,18,2,252,55,0,242,240,196,248,156,254, 5,97,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_131 = 3057; -static unsigned char xml_res_file_131[] = { +static size_t xml_res_size_141 = 3057; +static unsigned char xml_res_file_141[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -18580,8 +18962,8 @@ static unsigned char xml_res_file_131[] = { 148,82,250,182,243,223,0,205,161,248,164,173,174,169,116,0,0,0,0,73,69, 78,68,174,66,96,130}; -static size_t xml_res_size_132 = 3548; -static unsigned char xml_res_file_132[] = { +static size_t xml_res_size_142 = 3548; +static unsigned char xml_res_file_142[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -18756,8 +19138,8 @@ static unsigned char xml_res_file_132[] = { 55,54,54,38,166,166,166,142,230,19,192,36,208,4,124,32,59,44,232,0,67,128, 255,6,0,41,184,191,216,7,8,223,253,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_133 = 3319; -static unsigned char xml_res_file_133[] = { +static size_t xml_res_size_143 = 3319; +static unsigned char xml_res_file_143[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -18920,8 +19302,8 @@ static unsigned char xml_res_file_133[] = { 178,200,57,32,25,46,53,136,33,156,83,110,100,229,188,250,61,0,151,80,85, 17,221,189,97,232,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_134 = 1241; -static unsigned char xml_res_file_134[] = { +static size_t xml_res_size_144 = 1241; +static unsigned char xml_res_file_144[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,3,0,0, 0,40,45,15,83,0,0,0,21,116,69,88,116,67,114,101,97,116,105,111,110,32,84, 105,109,101,0,7,210,11,5,15,3,38,244,81,164,212,0,0,0,7,116,73,77,69,7, @@ -18970,8 +19352,8 @@ static unsigned char xml_res_file_134[] = { 217,199,231,38,96,218,127,204,5,93,229,97,0,0,0,0,73,69,78,68,174,66,96, 130}; -static size_t xml_res_size_135 = 878; -static unsigned char xml_res_file_135[] = { +static size_t xml_res_size_145 = 878; +static unsigned char xml_res_file_145[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,3,53,73,68,65,84,56,141,77,147,75,76,92,85,0,134,191, 115,238,157,153,59,67,103,24,198,10,210,10,76,177,68,48,20,84,250,176,197, @@ -19016,8 +19398,8 @@ static unsigned char xml_res_file_135[] = { 5,130,126,48,213,117,186,101,254,5,32,249,104,181,137,157,173,158,0,0,0, 0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_136 = 767; -static unsigned char xml_res_file_136[] = { +static size_t xml_res_size_146 = 767; +static unsigned char xml_res_file_146[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,2,198,73,68,65,84,120,218,99,96,160,37,152,62,253,184, 194,140,5,199,78,22,230,79,107,157,53,123,219,219,250,250,57,42,120,53, @@ -19058,8 +19440,8 @@ static unsigned char xml_res_file_136[] = { 144,248,50,144,60,0,221,94,126,61,62,40,152,159,0,0,0,0,73,69,78,68,174, 66,96,130}; -static size_t xml_res_size_137 = 779; -static unsigned char xml_res_file_137[] = { +static size_t xml_res_size_147 = 779; +static unsigned char xml_res_file_147[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,43,116,69,88,116,67,114,101,97,116,105,111,110,32, 84,105,109,101,0,83,111,32,50,56,32,68,101,122,32,50,48,48,51,32,49,57, @@ -19099,8 +19481,8 @@ static unsigned char xml_res_file_137[] = { 215,45,32,51,148,36,141,212,0,0,147,211,234,203,48,157,83,243,0,0,0,0,73, 69,78,68,174,66,96,130}; -static size_t xml_res_size_138 = 733; -static unsigned char xml_res_file_138[] = { +static size_t xml_res_size_148 = 733; +static unsigned char xml_res_file_148[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, 68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,11,19,0, @@ -19137,8 +19519,8 @@ static unsigned char xml_res_file_138[] = { 136,72,227,71,215,67,42,34,8,136,235,186,7,142,227,120,191,1,151,107,57, 36,89,38,145,120,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_139 = 3597; -static unsigned char xml_res_file_139[] = { +static size_t xml_res_size_149 = 3597; +static unsigned char xml_res_file_149[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -19315,8 +19697,8 @@ static unsigned char xml_res_file_139[] = { 220,14,60,175,170,82,10,79,4,3,100,51,153,154,31,203,229,93,219,249,255, 14,0,58,41,144,134,156,12,91,154,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_140 = 914; -static unsigned char xml_res_file_140[] = { +static size_t xml_res_size_150 = 914; +static unsigned char xml_res_file_150[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,42,116,69,88,116,67,114,101,97,116,105,111,110,32, 84,105,109,101,0,83,111,32,52,32,74,97,110,32,50,48,48,52,32,49,57,58,48, @@ -19362,8 +19744,8 @@ static unsigned char xml_res_file_140[] = { 204,138,133,225,119,245,87,245,157,187,253,193,59,240,11,104,163,88,164, 175,2,87,204,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_141 = 894; -static unsigned char xml_res_file_141[] = { +static size_t xml_res_size_151 = 894; +static unsigned char xml_res_file_151[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,42,116,69,88,116,67,114,101,97,116,105,111,110,32, 84,105,109,101,0,83,111,32,52,32,74,97,110,32,50,48,48,52,32,49,57,58,48, @@ -19408,8 +19790,8 @@ static unsigned char xml_res_file_141[] = { 8,112,130,45,64,121,163,12,201,233,95,58,235,159,28,143,223,53,88,65,169, 133,139,130,106,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_142 = 729; -static unsigned char xml_res_file_142[] = { +static size_t xml_res_size_152 = 729; +static unsigned char xml_res_file_152[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,2,160,73,68,65,84,56,141,93,211,205,111,84,85,24,199, 241,239,115,206,185,231,222,123,166,204,116,90,199,132,164,100,68,250,34, @@ -19447,8 +19829,8 @@ static unsigned char xml_res_file_142[] = { 68,241,235,253,38,255,1,91,98,225,179,192,183,94,105,0,0,0,0,73,69,78,68, 174,66,96,130}; -static size_t xml_res_size_143 = 3481; -static unsigned char xml_res_file_143[] = { +static size_t xml_res_size_153 = 3481; +static unsigned char xml_res_file_153[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -19620,8 +20002,8 @@ static unsigned char xml_res_file_143[] = { 228,191,191,241,247,0,32,191,47,133,90,129,111,9,0,0,0,0,73,69,78,68,174, 66,96,130}; -static size_t xml_res_size_144 = 3321; -static unsigned char xml_res_file_144[] = { +static size_t xml_res_size_154 = 3321; +static unsigned char xml_res_file_154[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -19785,8 +20167,8 @@ static unsigned char xml_res_file_144[] = { 200,252,53,0,4,47,133,233,161,207,37,213,0,0,0,0,73,69,78,68,174,66,96, 130}; -static size_t xml_res_size_145 = 627; -static unsigned char xml_res_file_145[] = { +static size_t xml_res_size_155 = 627; +static unsigned char xml_res_file_155[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,2,58,73,68,65,84,56,141,133,146,77,75,84,81,0,134,159, 115,63,102,52,10,51,27,135,84,16,138,22,65,33,45,180,136,106,145,66,193, @@ -19819,8 +20201,8 @@ static unsigned char xml_res_file_145[] = { 220,109,158,253,3,93,142,49,114,166,179,64,128,0,0,0,0,73,69,78,68,174, 66,96,130}; -static size_t xml_res_size_146 = 917; -static unsigned char xml_res_file_146[] = { +static size_t xml_res_size_156 = 917; +static unsigned char xml_res_file_156[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, 68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,11,19,0, @@ -19867,8 +20249,8 @@ static unsigned char xml_res_file_146[] = { 39,231,175,119,254,6,13,152,157,228,7,86,27,0,0,0,0,0,73,69,78,68,174,66, 96,130}; -static size_t xml_res_size_147 = 3416; -static unsigned char xml_res_file_147[] = { +static size_t xml_res_size_157 = 3416; +static unsigned char xml_res_file_157[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -20037,8 +20419,8 @@ static unsigned char xml_res_file_147[] = { 119,112,248,103,0,122,89,22,115,241,208,62,8,0,0,0,0,73,69,78,68,174,66, 96,130}; -static size_t xml_res_size_148 = 3416; -static unsigned char xml_res_file_148[] = { +static size_t xml_res_size_158 = 3416; +static unsigned char xml_res_file_158[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -20207,8 +20589,8 @@ static unsigned char xml_res_file_148[] = { 224,245,205,59,172,33,252,59,0,150,90,55,64,152,183,172,247,0,0,0,0,73, 69,78,68,174,66,96,130}; -static size_t xml_res_size_149 = 3638; -static unsigned char xml_res_file_149[] = { +static size_t xml_res_size_159 = 3638; +static unsigned char xml_res_file_159[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -20388,8 +20770,8 @@ static unsigned char xml_res_file_149[] = { 251,46,60,212,174,7,255,12,0,109,178,105,24,153,112,202,26,0,0,0,0,73,69, 78,68,174,66,96,130}; -static size_t xml_res_size_150 = 898; -static unsigned char xml_res_file_150[] = { +static size_t xml_res_size_160 = 898; +static unsigned char xml_res_file_160[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,3,73,73,68,65,84,120,218,133,147,15,76,212,85,28,192, 223,42,34,163,32,28,141,70,39,201,196,200,9,37,29,71,6,3,153,70,40,117, @@ -20436,8 +20818,8 @@ static unsigned char xml_res_file_150[] = { 23,188,178,208,39,252,23,98,111,36,184,212,235,88,204,0,0,0,0,73,69,78, 68,174,66,96,130}; -static size_t xml_res_size_151 = 3589; -static unsigned char xml_res_file_151[] = { +static size_t xml_res_size_161 = 3589; +static unsigned char xml_res_file_161[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -20614,8 +20996,8 @@ static unsigned char xml_res_file_151[] = { 171,48,25,118,173,1,16,130,255,6,0,37,40,77,179,16,173,251,96,0,0,0,0,73, 69,78,68,174,66,96,130}; -static size_t xml_res_size_152 = 3661; -static unsigned char xml_res_file_152[] = { +static size_t xml_res_size_162 = 3661; +static unsigned char xml_res_file_162[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -20796,8 +21178,8 @@ static unsigned char xml_res_file_152[] = { 113,47,166,68,113,14,143,65,8,254,29,0,250,249,144,17,223,227,177,29,0, 0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_153 = 416; -static unsigned char xml_res_file_153[] = { +static size_t xml_res_size_163 = 416; +static unsigned char xml_res_file_163[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,1,103,73,68,65,84,120,218,99,96,24,172,192,19,136,31, 3,113,9,16,151,2,241,83,32,246,33,197,0,144,230,207,64,204,8,197,32,246, @@ -20819,8 +21201,8 @@ static unsigned char xml_res_file_153[] = { 5,24,136,47,128,129,24,73,180,1,157,175,50,80,162,145,36,0,243,10,177,154, 1,197,12,167,40,229,119,150,173,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_154 = 418; -static unsigned char xml_res_file_154[] = { +static size_t xml_res_size_164 = 418; +static unsigned char xml_res_file_164[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,1,105,73,68,65,84,120,218,99,96,24,172,192,19,136,31, 3,113,9,16,151,2,241,83,32,246,33,197,0,144,230,207,64,204,8,197,32,246, @@ -20842,8 +21224,8 @@ static unsigned char xml_res_file_154[] = { 84,52,30,2,26,2,162,201,202,65,200,9,137,88,61,0,166,250,162,56,97,21,12, 77,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_155 = 411; -static unsigned char xml_res_file_155[] = { +static size_t xml_res_size_165 = 411; +static unsigned char xml_res_file_165[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,1,98,73,68,65,84,120,218,99,96,24,172,192,19,136,31, 3,113,9,16,151,2,241,83,32,246,33,197,0,144,230,207,64,204,8,197,32,246, @@ -20865,8 +21247,8 @@ static unsigned char xml_res_file_155[] = { 1,189,76,137,255,250,217,18,24,1,7,0,92,33,145,101,187,113,10,195,0,0,0, 0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_156 = 854; -static unsigned char xml_res_file_156[] = { +static size_t xml_res_size_166 = 854; +static unsigned char xml_res_file_166[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,3,29,73,68,65,84,120,218,141,147,93,72,147,81,24,199, 189,12,52,44,112,78,221,92,211,173,77,87,126,244,165,21,137,218,7,209,136, @@ -20910,8 +21292,8 @@ static unsigned char xml_res_file_156[] = { 25,233,236,106,78,147,170,152,150,73,98,139,255,0,210,253,89,143,10,247, 12,107,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_157 = 821; -static unsigned char xml_res_file_157[] = { +static size_t xml_res_size_167 = 821; +static unsigned char xml_res_file_167[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,2,252,73,68,65,84,120,218,141,147,109,72,83,97,20,199, 253,174,180,32,117,97,95,202,233,102,33,22,6,77,44,34,2,43,205,200,44,163, @@ -20953,8 +21335,8 @@ static unsigned char xml_res_file_157[] = { 110,51,94,186,212,118,209,104,140,58,201,173,74,45,209,168,21,237,47,21, 167,109,111,34,144,29,1,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_158 = 806; -static unsigned char xml_res_file_158[] = { +static size_t xml_res_size_168 = 806; +static unsigned char xml_res_file_168[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,2,237,73,68,65,84,120,218,141,146,75,76,19,81,20,134, 89,243,72,35,1,74,10,155,42,148,38,40,186,99,3,43,54,184,193,8,86,118,10, @@ -20995,8 +21377,8 @@ static unsigned char xml_res_file_158[] = { 231,246,145,145,5,155,205,54,91,81,81,161,87,243,127,1,102,233,136,211, 176,128,135,51,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_159 = 969; -static unsigned char xml_res_file_159[] = { +static size_t xml_res_size_169 = 969; +static unsigned char xml_res_file_169[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, 68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,10,240,0, @@ -21045,8 +21427,8 @@ static unsigned char xml_res_file_159[] = { 95,84,190,255,244,227,85,184,112,28,65,252,15,127,1,38,45,76,178,153,198, 223,212,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_160 = 894; -static unsigned char xml_res_file_160[] = { +static size_t xml_res_size_170 = 894; +static unsigned char xml_res_file_170[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,42,116,69,88,116,67,114,101,97,116,105,111,110,32, 84,105,109,101,0,70,114,32,57,32,74,97,110,32,50,48,48,52,32,48,48,58,49, @@ -21091,8 +21473,8 @@ static unsigned char xml_res_file_160[] = { 0,199,113,239,254,247,7,103,216,119,56,78,44,233,53,64,55,155,0,0,0,0,73, 69,78,68,174,66,96,130}; -static size_t xml_res_size_161 = 589; -static unsigned char xml_res_file_161[] = { +static size_t xml_res_size_171 = 589; +static unsigned char xml_res_file_171[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,43,116,69,88,116,67,114,101,97,116,105,111,110,32, 84,105,109,101,0,77,111,32,49,55,32,70,101,98,32,50,48,48,51,32,49,56,58, @@ -21122,8 +21504,8 @@ static unsigned char xml_res_file_161[] = { 249,27,230,97,254,125,162,129,181,239,131,254,23,124,0,39,57,137,112,18, 125,249,136,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_162 = 680; -static unsigned char xml_res_file_162[] = { +static size_t xml_res_size_172 = 680; +static unsigned char xml_res_file_172[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, 68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,11,19,0, @@ -21158,8 +21540,8 @@ static unsigned char xml_res_file_162[] = { 38,0,10,64,251,5,81,215,37,31,141,239,182,164,0,0,0,0,73,69,78,68,174,66, 96,130}; -static size_t xml_res_size_163 = 3618; -static unsigned char xml_res_file_163[] = { +static size_t xml_res_size_173 = 3618; +static unsigned char xml_res_file_173[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,9,112,72,89,115,0,0,11,19,0,0,11,19,1,0,154,156,24, 0,0,10,79,105,67,67,80,80,104,111,116,111,115,104,111,112,32,73,67,67,32, @@ -21337,386 +21719,83 @@ static unsigned char xml_res_file_163[] = { 205,83,169,55,40,20,217,184,61,145,157,41,92,51,143,169,133,229,220,127, 6,0,96,206,107,68,194,186,229,33,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_164 = 836; -static unsigned char xml_res_file_164[] = { -137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, -0,31,243,255,97,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, -68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,11,18,0, -0,11,18,1,210,221,126,252,0,0,0,7,116,73,77,69,7,216,3,13,15,38,14,168, -73,127,241,0,0,2,196,73,68,65,84,56,203,165,211,79,108,20,101,24,199,241, -239,188,59,51,187,93,97,41,81,18,54,24,171,177,32,145,130,144,96,171,1, -19,72,208,72,98,34,61,145,192,157,216,120,49,145,64,2,122,225,162,198,244, -168,65,225,132,137,26,67,52,36,92,60,24,163,72,226,127,107,169,173,134, -133,180,180,93,246,79,119,118,153,233,204,188,239,204,59,243,122,168,154, -18,131,23,159,219,239,240,124,14,207,31,248,159,101,173,14,141,139,56,13, -220,211,165,117,201,14,163,121,84,107,30,206,20,82,73,90,90,223,215,12, -230,147,137,231,95,79,143,223,19,152,124,143,221,219,71,249,129,254,126, -40,220,15,162,66,232,237,224,198,87,63,153,133,153,89,188,230,178,85,237, -103,195,129,51,44,253,221,99,175,6,28,77,30,77,67,201,237,129,213,67,20, -161,27,173,197,187,62,101,25,13,142,131,241,234,132,171,123,238,2,252,12, -221,243,161,88,4,203,2,39,2,157,7,88,98,37,175,41,145,190,48,142,188,39, -160,20,105,16,64,154,174,100,215,129,110,20,16,69,32,21,8,77,8,152,127, -1,230,13,196,183,101,158,182,29,142,4,62,72,9,182,13,142,13,222,210,50, -126,0,113,4,42,70,78,189,67,121,232,101,162,187,134,56,253,133,253,93,181, -52,50,220,190,172,104,255,218,37,125,160,66,182,53,195,41,94,99,246,86, -9,175,25,179,101,4,30,127,18,194,14,169,163,249,185,94,227,194,190,147, -188,139,86,74,252,246,214,176,92,60,56,98,90,135,14,152,240,234,215,230, -143,103,247,154,111,158,120,204,156,63,188,211,124,255,137,48,153,217,96, -140,41,155,184,135,73,122,27,243,107,151,31,202,207,143,89,109,0,241,251, -185,115,47,86,62,23,78,165,208,199,250,215,222,164,239,169,61,108,58,243, -54,69,219,97,96,202,103,115,117,59,162,214,134,165,181,148,214,189,196, -143,31,219,86,237,234,45,75,8,211,3,16,201,149,43,71,11,8,192,194,114,93, -12,96,185,46,150,129,2,22,181,139,5,130,121,72,167,155,152,217,73,194,246, -2,78,17,132,192,3,16,221,153,153,141,82,103,38,84,9,153,92,217,80,174,20, -105,158,147,99,104,252,82,103,169,3,237,30,116,26,1,50,1,149,64,150,255, -5,148,7,7,27,113,148,36,119,66,105,230,79,189,10,64,237,228,43,168,52,37, -73,51,220,71,170,116,58,224,121,208,174,119,205,114,8,81,4,90,51,189,2, -236,223,255,145,31,39,241,114,152,250,98,120,111,42,39,38,168,60,179,15, -149,104,41,165,142,205,128,104,46,46,66,171,5,245,57,159,72,97,220,2,227, -67,17,39,0,196,182,99,199,62,139,134,134,46,220,137,226,172,127,112,115, -222,183,107,151,89,63,184,85,133,113,42,221,221,35,239,151,158,59,248,96, -107,129,67,179,115,124,57,119,221,175,175,41,112,228,240,56,199,247,124, -64,246,207,29,104,165,196,228,217,179,163,183,47,93,58,234,223,188,89,45, -15,12,220,222,52,58,250,225,206,177,177,79,237,98,49,255,175,119,254,19, -128,17,96,29,57,6,41,204,0,0,0,0,73,69,78,68,174,66,96,130}; - -static size_t xml_res_size_165 = 834; -static unsigned char xml_res_file_165[] = { -137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, -0,31,243,255,97,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, -68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,11,18,0, -0,11,18,1,210,221,126,252,0,0,0,7,116,73,77,69,7,216,3,13,15,37,13,26,109, -125,136,0,0,2,194,73,68,65,84,56,203,165,147,93,136,84,101,0,134,159,239, -155,115,102,102,87,221,157,213,221,88,9,162,216,218,196,108,47,90,205,36, -132,172,32,3,111,42,84,116,175,172,136,100,161,20,23,19,68,4,189,40,8,111, -210,214,31,40,42,8,164,63,189,217,203,162,66,41,209,84,54,217,136,54,218, -230,232,184,179,115,206,236,52,231,156,111,207,207,55,231,235,98,17,118, -17,233,162,247,238,185,120,159,139,23,94,248,159,17,11,97,250,43,236,105, -242,7,139,157,201,128,209,244,105,205,131,173,152,40,142,152,209,122,73, -213,119,146,235,155,15,165,35,247,20,140,159,102,237,227,47,113,153,82, -9,114,43,64,118,16,214,7,248,243,135,95,204,205,223,166,168,87,3,177,178, -68,207,243,71,112,239,116,172,133,2,91,147,169,9,40,230,27,32,26,200,2, -204,170,101,212,255,184,33,140,6,219,198,212,43,132,11,59,139,4,205,22, -186,209,132,66,1,132,0,91,129,206,124,132,156,231,165,69,210,45,199,136, -238,41,136,99,82,223,135,52,157,231,188,13,179,202,71,41,136,98,144,154, -16,48,119,9,204,187,200,159,219,217,96,217,236,244,155,16,69,96,89,96,91, -80,119,3,154,62,204,41,136,231,136,110,124,72,251,154,97,212,162,17,39, -190,95,126,197,201,247,13,158,30,191,204,108,12,105,19,94,238,26,224,73, -51,197,218,87,167,56,245,218,114,250,215,195,234,117,16,122,164,182,230, -106,101,146,207,158,121,135,81,225,120,229,206,209,111,159,112,29,219,181, -84,36,81,115,160,66,240,195,140,75,35,9,215,191,41,48,184,181,27,73,72, -244,143,34,71,175,249,253,66,158,75,99,142,247,250,73,211,35,143,95,56, -176,231,47,92,169,19,200,116,134,201,50,90,45,184,184,55,224,235,107,31, -83,233,30,68,78,214,192,93,70,177,243,77,174,156,181,196,228,197,178,144, -210,52,0,172,159,156,115,67,93,29,243,211,164,26,100,214,206,119,195,30, -181,160,202,209,177,183,104,107,229,120,118,19,20,43,85,172,7,198,9,107, -55,177,11,32,37,117,0,137,145,93,95,236,80,114,247,250,79,232,202,63,196, -185,93,46,110,88,229,197,19,253,168,56,97,58,140,112,61,168,53,192,155, -246,137,18,136,19,104,101,243,2,235,190,226,234,64,138,220,138,77,125,219, -196,115,15,239,160,22,220,102,203,232,163,168,40,65,107,65,135,44,226,121, -115,20,11,144,211,179,38,8,17,58,3,173,153,0,144,189,75,30,249,124,223, -249,173,169,37,243,132,73,192,230,227,253,198,15,19,226,68,100,81,106,178, -237,189,143,53,110,221,130,153,25,168,252,221,68,197,152,124,142,99,107, -20,251,1,132,227,149,75,175,156,121,122,108,213,202,85,235,102,252,42,19, -149,95,209,26,145,164,66,116,183,221,127,237,252,238,47,95,248,241,240, -83,27,115,109,188,141,161,127,169,205,200,246,15,56,187,232,146,142,87, -46,189,241,233,208,123,61,123,101,165,123,143,12,74,195,242,246,174,143, -134,222,119,188,114,233,191,238,252,47,200,62,73,248,198,189,190,99,0,0, -0,0,73,69,78,68,174,66,96,130}; - -static size_t xml_res_size_166 = 674; -static unsigned char xml_res_file_166[] = { -137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, -0,31,243,255,97,0,0,2,105,73,68,65,84,56,141,117,147,77,75,84,97,24,134, -175,247,125,207,153,51,51,157,113,156,208,25,199,49,83,81,27,149,198,178, -212,252,92,88,80,139,192,8,23,129,148,132,68,212,50,8,2,151,213,50,68,92, -246,19,90,244,11,42,136,54,109,138,130,40,162,84,164,114,44,53,63,102,212, -57,31,243,182,209,48,115,30,184,118,207,125,115,193,195,35,238,182,80,114, -142,247,52,156,94,93,89,203,61,121,190,252,169,212,142,44,29,199,238,233, -60,250,162,179,61,245,20,16,165,11,228,78,205,62,26,155,35,19,141,233,26, -187,171,191,57,221,221,100,142,199,130,112,16,165,12,82,189,231,78,221, -243,54,215,145,114,139,209,225,166,71,64,248,64,3,165,96,63,205,173,21, -15,147,201,56,185,197,31,120,11,243,100,58,170,202,218,234,2,119,214,92, -216,207,65,6,45,221,131,237,99,110,238,23,234,228,53,188,230,17,228,86, -150,171,151,235,238,3,135,255,51,112,10,176,139,50,4,45,237,201,201,84, -194,194,207,253,38,156,30,197,108,29,199,207,254,36,221,24,224,66,38,240, -192,209,176,151,253,6,131,125,189,45,231,253,245,101,112,54,128,34,90,11, -114,179,171,136,153,15,140,246,135,110,1,245,255,94,97,207,100,58,82,83, -149,229,32,221,60,97,182,145,194,66,20,61,182,191,121,232,53,205,145,26, -151,75,25,99,50,105,195,46,127,11,236,50,53,210,215,93,119,194,112,87,56, -20,112,176,215,179,8,92,164,178,136,149,65,209,4,10,5,198,134,236,97,160, -107,55,103,236,154,244,116,37,167,226,81,31,150,22,49,86,179,136,188,198, -121,220,0,110,145,64,92,64,0,112,32,81,163,25,74,27,211,175,191,120,221, -139,27,32,195,38,36,19,230,237,51,153,104,181,156,123,139,185,178,128,8, -135,208,181,49,212,141,25,212,205,143,232,84,20,34,17,16,10,92,151,43,3, -161,46,224,34,128,26,140,99,15,180,153,207,26,205,172,82,5,15,17,139,64, -52,142,136,148,35,131,17,228,242,27,68,126,22,76,11,60,23,10,46,225,40, -228,127,251,61,239,191,235,105,117,189,195,156,56,219,224,12,133,130,32, -42,45,72,36,160,170,14,146,173,160,151,193,91,133,72,5,4,4,40,15,156,60, -184,14,199,170,141,216,171,89,99,222,88,23,33,231,229,156,94,18,158,239, -91,33,45,101,112,73,98,229,133,8,126,213,90,89,32,132,239,59,14,122,123, -27,191,176,41,108,60,75,185,190,52,203,12,21,45,15,71,69,218,38,26,144, -212,250,30,30,160,53,32,52,66,130,16,59,95,168,65,23,65,250,160,235,109, -66,97,19,3,129,120,183,194,231,63,138,62,220,101,241,3,240,147,0,0,0,0, -73,69,78,68,174,66,96,130}; - -static size_t xml_res_size_167 = 843; -static unsigned char xml_res_file_167[] = { +static size_t xml_res_size_174 = 502; +static unsigned char xml_res_file_174[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, 68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,11,18,0, -0,11,18,1,210,221,126,252,0,0,0,7,116,73,77,69,7,216,3,13,15,38,56,103, -243,234,104,0,0,2,203,73,68,65,84,56,203,165,211,79,104,28,101,24,199,241, -239,59,217,153,217,164,105,119,91,172,38,88,104,48,177,68,26,106,107,219, -20,209,128,241,32,136,151,132,198,66,219,83,61,4,226,73,105,181,162,165, -120,83,10,5,65,144,82,122,170,160,32,69,91,176,193,75,168,24,170,72,52, -68,91,182,164,166,219,98,146,253,147,236,31,118,51,59,243,206,188,239,204, -235,33,40,6,169,151,62,183,231,240,251,28,126,60,15,60,226,136,13,219,219, -69,251,25,183,242,193,19,89,123,143,138,77,175,84,186,71,6,90,134,74,175, -216,74,151,31,44,202,185,224,234,240,169,135,3,111,204,31,24,27,219,53, -243,212,86,200,182,65,198,134,149,74,192,213,155,15,204,221,123,171,4,213, -166,192,115,183,243,195,43,149,191,35,169,13,128,76,146,43,57,31,220,244, -58,237,90,188,208,44,241,219,175,127,10,132,134,40,50,228,253,214,191,35, -27,1,211,212,120,77,136,2,16,2,2,135,150,231,67,18,65,172,33,113,21,75, -135,229,195,1,47,163,168,75,232,136,64,24,176,29,188,70,0,74,129,214,16, -186,45,192,252,7,48,31,97,205,118,242,252,150,116,255,177,129,153,105,194, -176,27,236,16,236,16,175,177,6,145,134,53,1,81,73,114,145,14,198,241,55, -148,152,155,74,253,220,157,62,52,184,122,61,100,225,151,152,92,122,63,147, -217,49,110,120,143,97,234,53,40,212,232,125,109,150,158,195,147,148,27, -21,229,233,100,182,188,92,187,28,76,232,207,132,14,67,107,254,147,33,63, -251,189,112,109,119,51,155,222,57,203,210,135,239,81,93,173,50,249,108, -63,63,13,62,199,235,111,230,137,240,169,52,52,208,102,166,102,110,113,115, -106,190,202,199,108,111,59,210,213,53,146,249,246,214,209,140,219,46,54, -159,61,135,115,112,144,246,93,3,212,191,187,206,182,165,2,153,19,9,203, -170,68,42,73,211,179,173,155,51,151,190,18,247,110,151,4,138,2,63,242,105, -42,154,158,62,222,134,5,8,132,227,96,0,225,56,8,3,194,8,156,43,21,110,143, -148,233,44,150,169,238,104,226,45,5,235,205,41,106,0,169,250,157,59,93, -217,108,187,177,194,8,71,74,82,64,18,134,232,36,65,153,132,214,220,125, -22,134,2,58,29,7,109,167,33,1,20,16,175,3,86,71,95,95,41,240,163,168,209, -146,102,241,253,147,0,44,156,126,11,169,20,74,197,180,122,30,231,143,74, -157,92,181,66,174,184,98,136,1,9,104,114,235,192,240,240,151,205,32,10, -188,150,106,90,131,47,42,57,55,199,150,161,151,8,35,45,117,168,131,217, -94,171,108,138,6,89,214,44,47,214,32,198,96,115,158,22,239,2,88,187,199, -199,191,241,7,6,46,55,252,32,206,246,61,157,180,239,219,103,182,246,245, -135,94,160,228,166,253,135,46,30,120,249,213,29,120,140,80,224,198,90,94, -22,176,56,198,121,78,241,57,241,63,119,160,195,208,250,253,194,133,209, -226,181,107,199,155,249,124,119,199,206,157,197,39,71,71,191,216,59,49, -241,117,202,117,147,255,123,231,191,0,70,225,97,171,69,1,238,253,0,0,0, +0,11,18,1,210,221,126,252,0,0,0,7,116,73,77,69,7,216,3,13,15,29,54,188, +249,40,87,0,0,1,118,73,68,65,84,56,203,237,146,187,75,66,113,28,197,191, +223,159,38,247,90,225,141,44,140,168,37,226,86,52,38,66,17,17,209,107,11, +122,32,57,229,208,34,129,81,68,91,131,75,212,16,65,53,4,65,209,99,104,40, +151,92,106,204,37,2,161,192,193,161,225,26,134,143,91,145,122,127,250,187, +175,254,2,117,143,206,126,62,156,195,57,0,255,250,43,74,202,146,99,35,188, +184,229,222,131,196,192,30,100,123,67,248,22,184,90,12,37,101,73,48,12, +227,171,154,23,147,178,228,8,70,6,175,77,238,221,67,75,64,40,5,66,41,32, +45,33,121,94,43,115,54,171,13,171,1,44,117,67,233,205,79,140,206,233,58, +160,170,1,106,26,160,170,34,121,92,201,243,225,151,115,221,53,210,98,127, +186,137,61,84,76,48,124,192,39,26,28,212,101,24,0,170,10,136,122,61,137, +248,115,246,108,33,13,99,251,34,163,138,53,39,237,20,219,43,1,8,152,164, +233,214,171,52,6,61,167,141,78,174,203,114,231,207,218,115,197,52,76,30, +138,140,150,25,42,140,10,213,42,144,86,174,175,64,208,98,142,118,45,192, +133,55,206,203,197,12,76,31,137,101,165,196,64,211,16,235,144,255,169,10, +112,213,119,95,174,133,231,85,43,177,65,145,21,96,226,64,100,121,133,33, +99,72,152,106,226,84,255,204,69,173,21,132,217,227,161,187,158,182,30,119, +38,159,134,120,234,21,52,13,144,169,136,78,190,61,118,191,30,29,239,104, +238,252,174,245,3,97,249,204,183,221,178,74,82,206,32,41,8,1,242,177,116, +226,219,77,202,146,80,235,67,191,178,206,158,158,181,247,215,159,0,0,0, 0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_168 = 835; -static unsigned char xml_res_file_168[] = { +static size_t xml_res_size_175 = 485; +static unsigned char xml_res_file_175[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, 68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,11,18,0, -0,11,18,1,210,221,126,252,0,0,0,7,116,73,77,69,7,216,3,13,15,39,37,29,238, -183,240,0,0,2,195,73,68,65,84,56,203,165,211,77,104,92,85,24,198,241,255, -57,153,59,55,198,210,76,210,68,27,234,162,54,54,38,181,184,80,75,149,210, -69,16,180,168,187,212,66,205,170,46,10,177,139,54,24,68,208,77,87,45,136, -40,180,4,91,240,163,130,32,90,72,54,117,23,17,109,81,140,166,74,32,216, -54,13,97,110,219,201,77,238,205,199,204,185,31,115,238,153,123,186,8,130, -131,20,23,190,187,119,241,252,22,15,239,11,255,115,68,211,54,90,113,6,220, -224,189,71,75,206,211,89,195,246,166,153,217,153,38,38,173,103,102,217, -201,140,191,232,165,127,36,147,131,99,15,6,222,188,241,220,225,195,125, -211,187,58,160,212,2,237,14,44,7,9,147,215,22,237,205,219,43,36,97,85,160, -220,110,126,124,41,248,59,82,104,2,210,60,191,60,23,131,219,186,73,187, -146,3,213,37,254,252,189,44,16,6,180,182,44,196,209,63,35,205,128,173,26, -84,21,116,2,66,64,82,36,82,49,228,26,26,6,114,55,227,206,80,250,96,64,181, -103,172,165,208,166,65,88,112,138,168,141,4,178,12,140,129,186,27,1,246, -95,128,61,131,156,217,194,11,91,91,251,223,216,59,253,19,245,122,15,56, -117,112,234,168,141,26,104,3,53,1,122,41,229,34,109,28,39,110,42,113,238, -135,206,223,188,98,239,179,23,102,167,89,142,11,172,172,150,104,215,239, -243,151,119,144,197,79,246,210,185,111,130,222,87,103,216,57,244,29,254, -70,144,41,147,207,248,119,87,191,76,70,204,184,240,194,114,251,248,212, -51,129,231,4,133,56,21,196,137,32,142,45,74,89,126,25,211,28,186,112,134, -35,111,45,160,137,9,54,12,208,98,167,166,103,185,54,117,35,228,44,221,133, -115,87,223,61,85,38,144,104,200,141,197,230,150,134,145,92,29,173,113,249, -250,103,236,25,248,149,133,121,69,103,105,27,187,187,122,24,57,255,185, -80,75,9,24,214,1,10,63,123,19,195,29,91,55,171,201,12,200,188,141,239,79, -132,172,40,159,211,87,78,162,27,69,6,6,183,179,165,226,19,62,86,69,221, -73,54,155,203,88,5,144,88,217,241,205,209,88,142,236,255,130,142,226,227, -76,28,11,8,34,159,87,206,247,17,215,53,181,40,98,62,12,153,95,91,231,182, -31,64,14,100,64,99,19,40,60,210,186,71,73,209,178,109,176,247,136,120,241, -137,163,172,168,10,175,141,63,73,156,106,140,17,72,225,114,43,88,195,117, -91,136,27,210,210,64,96,0,195,28,128,220,254,240,238,175,222,158,124,61, -43,200,34,145,86,28,58,215,103,107,145,38,213,34,215,153,205,119,237,120, -106,221,86,44,169,111,184,235,173,66,3,139,195,135,68,188,3,32,188,176, -92,26,186,120,224,74,127,79,255,190,229,154,207,220,189,89,140,65,232,76, -136,174,135,118,92,191,52,242,237,203,251,63,126,254,32,25,39,145,244,33, -25,227,35,190,110,58,64,47,44,151,142,95,26,62,219,61,42,239,117,157,146, -170,116,66,86,142,125,58,252,129,23,150,75,255,245,206,247,1,142,34,94, -5,189,192,84,154,0,0,0,0,73,69,78,68,174,66,96,130}; +0,11,18,1,210,221,126,252,0,0,0,7,116,73,77,69,7,216,3,13,15,31,15,209, +202,194,221,0,0,1,101,73,68,65,84,56,203,237,210,191,75,66,81,28,5,240, +239,189,234,211,132,116,76,73,112,80,65,80,48,23,7,121,139,130,63,182,144, +6,33,7,55,193,217,193,191,34,66,112,112,112,169,193,54,171,81,161,22,17, +9,68,33,66,105,17,7,73,35,204,31,249,124,247,122,159,247,53,180,191,246, +232,236,231,3,7,14,192,127,254,64,16,0,0,35,4,191,86,171,167,82,179,153, +145,198,99,155,193,225,152,29,38,147,53,95,46,119,103,48,153,184,166,160, +80,138,159,178,217,139,137,40,206,223,227,241,165,212,110,179,161,40,46, +59,62,223,252,33,157,190,100,132,96,77,224,165,92,78,77,68,113,254,21,139, +45,88,183,171,114,206,249,166,211,81,123,129,192,226,209,227,153,247,74, +165,51,173,62,222,181,90,25,61,198,58,140,16,32,65,248,217,37,8,128,0,0, +35,164,251,104,52,206,53,129,197,112,104,163,138,162,74,187,29,236,9,1, +0,0,78,41,40,156,195,94,85,213,207,193,192,174,9,152,221,238,153,68,41, +90,203,50,188,21,139,43,0,128,81,161,176,34,140,193,78,81,144,197,235,157, +105,3,145,200,205,138,144,253,154,16,128,112,88,144,251,125,100,137,70, +5,153,49,144,25,83,143,18,137,154,38,224,203,229,110,183,126,255,245,114, +187,229,86,151,11,31,4,131,170,213,229,194,27,74,65,8,133,174,2,249,124, +253,215,31,40,148,226,231,74,37,53,189,191,207,172,71,35,187,217,233,156, +30,167,82,181,147,124,190,174,55,26,53,127,240,13,44,239,164,46,170,244, +5,121,0,0,0,0,73,69,78,68,174,66,96,130}; -static size_t xml_res_size_169 = 760; -static unsigned char xml_res_file_169[] = { -137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, -0,31,243,255,97,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, -68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,11,19,0, -0,11,19,1,0,154,156,24,0,0,0,7,116,73,77,69,7,216,3,17,15,32,19,135,218, -92,137,0,0,2,120,73,68,65,84,56,203,125,147,207,75,84,81,20,199,63,239, -249,242,199,4,102,34,36,24,140,67,130,89,16,3,142,69,137,212,202,168,69, -84,96,129,184,105,215,58,104,85,11,241,63,200,63,160,69,132,63,112,104, -23,84,171,8,68,162,22,134,228,224,34,146,113,81,68,163,233,232,204,189, -239,221,115,79,139,244,21,83,116,224,187,184,220,251,253,242,189,231,156, -111,192,175,58,14,28,3,154,248,127,125,3,202,128,111,188,24,140,227,248, -135,115,78,156,115,218,8,17,81,107,173,206,206,206,62,2,122,129,176,81, -224,172,115,78,106,181,154,214,235,245,20,123,123,123,90,173,86,117,115, -115,83,157,115,90,169,84,116,126,126,254,47,145,96,95,64,173,181,154,36, -137,90,107,213,90,155,10,108,109,109,169,136,168,49,70,107,181,154,22,139, -197,3,17,130,125,12,57,231,222,122,239,89,89,89,33,73,146,20,34,130,115, -142,209,209,81,0,84,21,128,40,138,206,1,239,162,212,70,16,16,134,33,249, -124,62,125,232,189,71,68,16,17,170,213,106,122,238,236,236,76,255,30,53, -54,99,117,117,21,231,28,34,66,146,36,56,231,82,162,247,158,161,161,161, -212,69,42,208,218,218,26,238,124,250,196,183,98,17,91,42,209,214,223,79, -247,216,24,71,78,156,72,157,168,42,34,146,186,77,157,207,205,204,52,53, -45,44,60,185,96,204,248,161,150,22,50,247,239,83,158,156,100,123,123,27, -127,235,22,45,151,46,161,170,168,42,65,16,80,40,20,0,184,156,201,92,125, -85,175,191,224,195,244,244,205,245,225,225,237,234,245,235,154,188,127, -175,34,162,187,75,75,186,60,60,172,111,10,5,173,172,173,169,115,78,227, -56,214,63,235,70,38,115,13,8,34,89,92,28,63,20,134,97,24,4,4,205,205,191, -108,53,55,163,222,163,206,241,241,241,99,142,78,76,164,77,30,24,24,0,96, -209,218,10,64,180,85,42,117,119,28,62,172,181,56,38,50,134,8,240,214,162, -128,134,33,102,109,141,243,39,79,30,140,238,247,78,139,36,0,97,166,175, -239,235,158,181,65,213,24,190,76,77,1,240,249,225,67,106,113,140,141,99, -218,250,251,217,216,216,160,92,46,179,190,190,254,87,56,194,150,139,23, -231,126,24,227,119,140,129,193,65,204,242,50,237,35,35,196,34,88,239,57, -117,231,14,217,108,150,108,54,203,241,238,238,70,190,134,103,238,222,125, -246,185,183,247,249,142,49,218,158,203,209,154,207,211,158,203,177,27,199, -228,238,221,75,71,25,4,1,88,251,39,89,14,86,153,142,142,142,236,228,216, -216,237,174,82,233,138,45,151,187,162,158,158,239,149,211,167,95,62,120, -250,244,117,221,24,255,143,88,203,126,180,55,126,2,54,15,162,148,194,161, -131,18,0,0,0,0,73,69,78,68,174,66,96,130}; - -static size_t xml_res_size_170 = 793; -static unsigned char xml_res_file_170[] = { -137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, -0,31,243,255,97,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, -68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,11,19,0, -0,11,19,1,0,154,156,24,0,0,0,7,116,73,77,69,7,216,3,17,15,31,58,157,182, -238,217,0,0,2,153,73,68,65,84,56,203,125,147,207,107,148,71,24,199,63,51, -190,107,213,85,19,162,104,10,202,134,212,30,162,198,4,146,85,60,228,80, -132,45,68,131,208,6,169,250,15,120,81,108,33,160,232,77,136,103,45,20,61, -169,7,89,2,65,5,197,134,210,22,74,17,163,34,88,183,164,245,82,138,235,143, -54,113,19,229,221,125,119,103,231,199,227,193,248,162,219,226,3,223,195, -48,51,159,249,206,243,229,81,188,169,13,192,122,96,9,31,174,89,224,49,16, -90,55,6,154,205,230,75,231,156,119,206,73,171,188,247,98,140,145,98,177, -120,6,232,2,116,43,96,187,115,206,39,73,34,245,122,61,85,173,86,147,56, -142,101,126,126,94,156,115,82,169,84,100,98,98,226,63,16,181,8,16,99,140, -88,107,197,24,35,198,152,20,176,176,176,32,222,123,105,52,26,146,36,137, -76,78,78,190,133,160,22,149,119,206,221,9,33,80,42,149,176,214,166,242, -222,227,156,163,80,40,0,32,34,0,68,81,180,3,184,23,165,54,148,66,107,77, -127,127,127,122,48,132,128,247,30,239,61,113,28,167,235,142,142,142,244, -239,81,107,51,102,102,102,112,206,225,189,199,90,139,115,46,189,24,66,32, -159,207,167,46,82,192,64,126,96,229,143,143,174,112,126,250,56,175,204, -2,202,174,230,240,208,105,134,251,190,68,107,141,115,14,17,193,123,159, -186,77,157,255,254,87,169,253,216,84,97,170,253,227,218,142,164,17,168, -214,60,245,186,144,52,132,219,95,199,60,124,240,16,17,65,68,80,74,49,56, -56,8,192,231,43,86,12,255,80,175,79,69,151,126,27,63,26,117,60,223,226, -252,42,66,120,67,23,224,215,35,47,184,242,224,18,31,233,54,70,182,125,65, -8,129,76,38,147,190,156,85,42,3,16,77,63,189,118,32,187,10,141,23,154,86, -208,97,57,63,29,122,194,92,245,95,78,221,60,74,198,175,101,83,166,39,109, -114,79,79,15,0,183,140,169,0,48,244,109,118,174,97,19,249,254,207,139,114, -176,184,89,26,54,145,167,47,255,150,190,241,149,210,125,34,35,27,199,178, -98,173,21,107,173,188,91,192,118,64,69,235,150,109,174,106,181,100,205, -103,159,236,83,187,54,237,103,174,250,156,145,115,189,36,141,38,214,194, -234,165,107,40,151,203,136,8,90,107,186,186,186,222,75,77,119,102,63,189, -252,205,213,81,23,233,165,212,154,85,134,191,219,74,181,110,48,77,193,216, -192,201,145,113,114,185,28,185,92,142,13,157,157,173,169,139,42,87,30,183, -239,61,187,243,151,190,238,222,109,179,213,89,254,120,86,194,58,193,52, -97,168,187,64,241,208,53,180,210,40,165,8,113,76,212,214,246,54,202,65, -224,190,2,24,253,106,116,139,238,55,99,63,63,187,177,91,20,89,103,72,118, -109,220,51,245,228,250,63,23,238,78,223,139,255,103,172,253,226,104,151, -95,3,56,220,163,74,31,151,249,249,0,0,0,0,73,69,78,68,174,66,96,130}; - -static size_t xml_res_size_171 = 831; -static unsigned char xml_res_file_171[] = { +static size_t xml_res_size_176 = 401; +static unsigned char xml_res_file_176[] = { 137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, 0,31,243,255,97,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, 68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,11,19,0, -0,11,19,1,0,154,156,24,0,0,0,7,116,73,77,69,7,216,3,17,16,54,7,150,226, -217,110,0,0,2,191,73,68,65,84,56,203,133,146,77,104,92,101,20,134,159,239, -155,155,59,201,180,205,212,218,74,250,131,19,76,164,136,197,54,11,169,177, -171,162,168,160,80,2,234,38,88,220,180,161,184,172,232,46,27,165,32,226, -66,75,105,161,1,65,170,182,80,34,221,73,41,88,136,32,162,132,160,198,182, -152,196,177,210,52,173,137,51,115,211,153,123,191,251,253,28,23,211,145, -8,161,158,221,251,30,206,195,203,203,81,252,207,156,251,110,174,28,105, -189,181,24,233,237,27,186,187,118,21,187,10,21,17,253,248,143,127,212,138, -111,191,176,251,141,104,189,163,175,127,185,117,124,240,145,222,23,55,196, -133,29,165,56,218,22,71,122,75,49,42,68,73,30,168,155,64,84,208,220,92, -13,55,1,214,5,12,108,219,52,250,216,214,141,67,107,189,122,230,184,190, -226,232,45,69,116,7,161,105,124,6,160,215,3,100,206,55,1,130,8,0,169,177, -156,188,186,66,211,10,205,92,88,205,3,173,188,189,91,55,129,15,242,31,157, -250,0,8,153,21,180,22,10,74,72,237,3,0,206,7,58,9,180,82,255,250,198,11, -98,5,45,1,99,195,3,0,107,18,4,17,58,210,216,64,30,60,42,4,82,179,6,96,179, -76,223,152,152,56,212,188,124,121,180,89,173,246,229,159,124,176,187,241, -214,24,165,71,251,9,5,141,116,186,200,3,46,8,145,22,150,19,7,128,118,198, -232,233,177,177,15,55,159,63,63,209,159,101,207,239,63,125,122,255,195, -63,207,60,244,219,225,195,204,127,126,14,238,31,139,8,141,150,163,101,60, -119,18,79,35,241,109,192,245,179,103,15,237,156,159,127,179,220,211,163, -183,156,56,81,238,25,30,46,84,222,127,175,16,107,205,242,169,83,212,230, -230,200,172,199,7,97,238,86,198,95,137,99,97,201,144,187,251,128,124,106, -106,52,210,186,160,149,66,197,49,34,162,84,28,163,0,36,240,251,133,11,0, -188,62,212,77,8,129,234,82,78,154,122,130,107,39,211,181,107,215,250,50, -235,88,53,185,246,89,214,46,206,24,108,8,120,129,229,233,105,34,173,208, -90,177,82,23,108,238,9,65,0,137,1,116,105,112,112,169,149,27,146,52,229, -207,119,222,189,7,80,29,31,199,88,75,238,44,229,167,246,2,208,91,236,66, -41,133,179,158,90,205,182,254,110,196,191,182,1,7,15,126,217,200,50,159, -100,25,234,217,225,174,108,102,134,77,7,14,144,90,71,106,29,242,220,43, -204,46,214,171,159,126,51,123,177,86,55,119,127,152,74,39,167,175,52,62, -154,255,62,61,2,160,159,60,122,244,171,214,158,61,159,37,105,203,109,30, -24,80,61,67,67,178,177,210,31,146,230,61,171,95,122,249,170,237,219,245, -244,228,183,55,158,24,127,245,153,215,172,99,37,189,219,152,49,139,23,63, -94,190,178,111,17,104,119,229,140,209,63,157,57,51,114,251,210,165,209, -100,97,97,123,169,82,185,189,115,100,228,139,125,199,142,77,70,197,98,232, -60,85,121,239,241,29,226,242,86,50,123,178,222,241,254,1,250,67,122,99, -222,219,11,95,0,0,0,0,73,69,78,68,174,66,96,130}; - -static size_t xml_res_size_172 = 837; -static unsigned char xml_res_file_172[] = { -137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,16,0,0,0,16,8,6,0,0, -0,31,243,255,97,0,0,0,1,115,82,71,66,0,174,206,28,233,0,0,0,6,98,75,71, -68,0,255,0,255,0,255,160,189,167,147,0,0,0,9,112,72,89,115,0,0,11,19,0, -0,11,19,1,0,154,156,24,0,0,0,7,116,73,77,69,7,216,3,17,16,53,41,97,25,135, -98,0,0,2,197,73,68,65,84,56,203,133,146,95,136,148,85,24,135,159,115,230, -219,153,193,109,103,167,156,93,74,2,169,93,137,204,165,4,101,195,110,148, -160,173,132,174,82,178,165,162,162,8,66,24,217,8,235,162,160,32,132,10, -9,3,233,66,74,170,155,178,213,11,89,186,216,40,74,16,81,76,34,163,63,6, -54,163,187,182,187,227,206,191,239,251,230,124,231,59,231,237,98,92,89, -97,177,247,238,253,29,206,243,62,188,188,138,255,169,47,78,94,232,15,180, -46,229,2,125,71,111,190,231,206,92,79,102,173,136,94,119,230,159,197,220, -107,143,220,243,76,176,210,167,111,127,189,60,49,60,88,24,235,205,102,214, -172,202,6,3,217,64,223,150,11,50,65,51,241,212,141,39,200,104,42,45,95, -1,88,17,48,52,208,55,126,119,233,150,141,203,179,122,39,229,247,90,74,97, -85,64,222,11,161,113,29,0,189,18,160,147,186,16,192,139,0,16,27,203,129, -31,106,132,86,8,19,161,149,120,162,164,251,182,162,129,243,114,67,31,59, -15,8,29,43,104,45,100,148,16,219,155,0,82,231,89,50,208,74,93,207,141,19, -196,10,90,60,198,250,155,0,150,25,120,17,150,90,99,61,137,119,40,239,137, -77,23,160,1,170,181,74,255,235,199,158,126,123,243,126,254,220,180,159, -249,242,55,35,155,142,255,242,53,206,57,20,130,44,237,34,241,52,195,148, -208,56,22,154,105,215,160,90,171,244,151,167,182,124,37,249,75,163,165, -18,58,142,209,214,44,102,223,153,126,150,71,55,52,113,215,166,139,8,141, -40,69,41,77,108,133,70,211,117,1,7,78,236,45,75,254,210,168,235,154,33, -94,7,10,173,127,220,61,207,228,185,195,4,20,216,124,215,118,156,23,46,92, -238,80,44,100,153,107,164,36,105,23,160,79,86,143,142,199,29,116,199,160, -172,69,245,208,23,124,247,202,85,174,70,11,188,59,181,135,247,166,222,4, -96,231,198,60,222,123,46,94,73,136,99,135,79,229,218,14,68,223,122,244, -169,168,175,60,250,89,223,234,220,80,112,252,197,217,204,66,248,47,219, -15,110,32,50,134,185,230,21,2,173,208,90,81,171,11,54,113,120,47,128,100, -1,130,193,252,250,182,86,153,213,219,134,118,170,135,135,119,229,231,219, -179,60,241,201,8,81,39,33,181,80,204,15,2,80,200,245,160,148,194,218,148, -86,75,162,122,51,251,27,128,190,189,119,221,151,19,199,118,216,64,103,9, -147,54,99,31,175,151,86,100,48,70,48,214,243,220,67,111,112,126,166,126, -241,211,239,207,31,89,172,155,185,211,63,197,147,103,167,27,31,254,125, -42,126,9,64,239,29,219,247,193,169,191,126,62,243,194,231,143,217,93,135, -182,217,70,59,246,97,228,36,54,94,214,22,71,42,91,134,31,223,58,121,226, -143,123,223,122,242,193,29,54,165,22,207,53,206,153,153,35,31,45,76,63, -48,115,253,88,170,181,74,241,229,195,227,251,6,246,232,153,82,89,183,139, -175,234,217,231,15,141,191,95,173,85,138,203,15,172,255,254,137,53,133, -251,118,223,144,253,7,193,149,108,94,246,204,139,93,0,0,0,0,73,69,78,68, -174,66,96,130}; +0,11,19,1,0,154,156,24,0,0,0,7,116,73,77,69,7,217,8,31,6,43,21,222,207, +142,127,0,0,1,17,73,68,65,84,56,203,237,142,177,74,195,80,24,70,207,77, +123,99,26,237,45,81,74,8,116,80,233,34,190,67,210,58,57,57,56,249,2,130, +116,43,46,234,146,214,81,196,81,28,28,4,31,194,205,234,155,180,147,1,81, +40,5,147,38,77,227,214,65,172,166,155,131,223,248,243,127,231,59,240,159, +63,152,254,97,197,123,105,169,157,188,255,197,175,7,103,53,244,167,80,0, +30,23,95,111,43,239,254,160,62,60,170,51,13,78,202,205,133,1,227,27,189, +183,87,35,219,95,39,27,223,202,167,60,29,109,182,222,85,13,185,17,123,186, +5,161,14,114,51,113,131,203,223,45,102,0,103,59,244,69,21,161,41,72,75, +32,108,132,181,21,249,185,0,253,115,213,144,118,226,97,130,81,1,115,13, +88,1,105,39,110,112,245,179,69,17,192,169,133,29,145,34,152,192,113,75, +176,84,2,226,12,145,34,44,39,242,129,222,92,131,65,91,53,101,33,113,25, +1,239,112,119,157,113,209,201,224,13,24,130,212,18,55,56,83,115,45,196, +199,169,241,160,87,19,151,50,176,140,136,1,221,0,38,25,132,8,70,16,191, +234,207,102,55,218,253,14,240,9,98,242,76,49,228,70,246,254,0,0,0,0,73, +69,78,68,174,66,96,130}; -static size_t xml_res_size_173 = 16226; -static unsigned char xml_res_file_173[] = { +static size_t xml_res_size_177 = 16487; +static unsigned char xml_res_file_177[] = { 60,63,120,109,108,32,118,101,114,115,105,111,110,61,34,49,46,48,34,32,101, 110,99,111,100,105,110,103,61,34,85,84,70,45,56,34,63,62,10,60,114,101, 115,111,117,114,99,101,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97, @@ -21757,355 +21836,410 @@ static unsigned char xml_res_file_173[] = { 99,101,115,46,99,112,112,36,114,101,115,95,99,117,98,101,115,95,121,101, 108,108,111,119,95,112,111,112,117,112,46,112,110,103,60,47,111,98,106, 101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61, -34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,119,120,102, -98,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115, -95,119,120,102,98,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32, -60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116, -109,97,112,34,32,110,97,109,101,61,34,116,97,98,34,62,114,101,115,111,117, -114,99,101,115,46,99,112,112,36,114,101,115,95,116,97,98,46,112,110,103, +34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,116,97,98,34, +62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,116, +97,98,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98, +106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112, +34,32,110,97,109,101,61,34,116,111,100,111,34,62,114,101,115,111,117,114, +99,101,115,46,99,112,112,36,114,101,115,95,116,111,100,111,46,112,110,103, 60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99, 108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101, -61,34,116,111,100,111,34,62,114,101,115,111,117,114,99,101,115,46,99,112, -112,36,114,101,115,95,116,111,100,111,46,112,110,103,60,47,111,98,106,101, +61,34,109,101,109,111,114,121,95,118,105,101,119,34,62,114,101,115,111, +117,114,99,101,115,46,99,112,112,36,114,101,115,95,109,101,109,111,114, +121,95,118,105,101,119,46,112,110,103,60,47,111,98,106,101,99,116,62,10, +32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105, +116,109,97,112,34,32,110,97,109,101,61,34,99,112,112,95,107,101,121,119, +111,114,100,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114, +101,115,95,99,112,112,95,98,108,117,101,46,112,110,103,60,47,111,98,106, +101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61, +34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,65,98,111,117, +116,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115, +95,97,98,111,117,116,95,105,109,103,46,112,110,103,60,47,111,98,106,101, 99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34, -119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,109,101,109,111, -114,121,95,118,105,101,119,34,62,114,101,115,111,117,114,99,101,115,46, -99,112,112,36,114,101,115,95,109,101,109,111,114,121,95,118,105,101,119, +119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,109,101,109,98, +101,114,95,112,117,98,108,105,99,34,62,114,101,115,111,117,114,99,101,115, +46,99,112,112,36,114,101,115,95,109,101,109,98,101,114,95,112,117,98,108, +105,99,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98, +106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112, +34,32,110,97,109,101,61,34,108,105,110,107,95,101,100,105,116,111,114,34, +62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,108, +105,110,107,95,101,100,105,116,111,114,46,112,110,103,60,47,111,98,106, +101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61, +34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,102,105,108, +101,95,101,120,112,108,111,114,101,114,34,62,114,101,115,111,117,114,99, +101,115,46,99,112,112,36,114,101,115,95,102,105,108,101,95,101,120,112, +108,111,114,101,114,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32, +32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116, +109,97,112,34,32,110,97,109,101,61,34,109,101,109,98,101,114,95,112,114, +111,116,101,99,116,101,100,34,62,114,101,115,111,117,114,99,101,115,46, +99,112,112,36,114,101,115,95,109,101,109,98,101,114,95,112,114,111,116, +101,99,116,101,100,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32, +32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116, +109,97,112,34,32,110,97,109,101,61,34,109,101,109,98,101,114,95,112,114, +105,118,97,116,101,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112, +36,114,101,115,95,109,101,109,98,101,114,95,112,114,105,118,97,116,101, 46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101, 99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110, -97,109,101,61,34,99,112,112,95,107,101,121,119,111,114,100,34,62,114,101, -115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,99,112,112,95, -98,108,117,101,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60, -111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109, -97,112,34,32,110,97,109,101,61,34,65,98,111,117,116,34,62,114,101,115,111, -117,114,99,101,115,46,99,112,112,36,114,101,115,95,97,98,111,117,116,95, -105,109,103,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111, +97,109,101,61,34,102,117,110,99,95,112,117,98,108,105,99,34,62,114,101, +115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,102,117,110, +99,95,112,117,98,108,105,99,46,112,110,103,60,47,111,98,106,101,99,116, +62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120, +66,105,116,109,97,112,34,32,110,97,109,101,61,34,102,117,110,99,95,112, +114,111,116,101,99,116,101,100,34,62,114,101,115,111,117,114,99,101,115, +46,99,112,112,36,114,101,115,95,102,117,110,99,95,112,114,111,116,101,99, +116,101,100,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111, 98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97, -112,34,32,110,97,109,101,61,34,109,101,109,98,101,114,95,112,117,98,108, -105,99,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101, -115,95,109,101,109,98,101,114,95,112,117,98,108,105,99,46,112,110,103,60, -47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108, -97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61, -34,108,105,110,107,95,101,100,105,116,111,114,34,62,114,101,115,111,117, -114,99,101,115,46,99,112,112,36,114,101,115,95,108,105,110,107,95,101,100, -105,116,111,114,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32, -60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116, -109,97,112,34,32,110,97,109,101,61,34,102,105,108,101,95,101,120,112,108, -111,114,101,114,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112, -36,114,101,115,95,102,105,108,101,95,101,120,112,108,111,114,101,114,46, -112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99, -116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110, -97,109,101,61,34,109,101,109,98,101,114,95,112,114,111,116,101,99,116,101, -100,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115, -95,109,101,109,98,101,114,95,112,114,111,116,101,99,116,101,100,46,112, +112,34,32,110,97,109,101,61,34,102,117,110,99,95,112,114,105,118,97,116, +101,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115, +95,102,117,110,99,95,112,114,105,118,97,116,101,46,112,110,103,60,47,111, +98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115, +115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,101, +110,117,109,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114, +101,115,95,101,110,117,109,46,112,110,103,60,47,111,98,106,101,99,116,62, +10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66, +105,116,109,97,112,34,32,110,97,109,101,61,34,101,110,117,109,101,114,97, +116,111,114,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114, +101,115,95,101,110,117,109,101,101,46,120,112,109,60,47,111,98,106,101, +99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34, +119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,99,108,97,115, +115,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115, +95,99,108,97,115,115,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32, +32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116, +109,97,112,34,32,110,97,109,101,61,34,116,121,112,101,100,101,102,34,62, +114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,116, +121,112,101,100,101,102,46,120,112,109,60,47,111,98,106,101,99,116,62,10, +32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105, +116,109,97,112,34,32,110,97,109,101,61,34,112,114,111,106,101,99,116,34, +62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,102, +111,108,100,101,114,95,100,101,118,101,108,111,112,109,101,110,116,46,112, 110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116, 32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109, -101,61,34,109,101,109,98,101,114,95,112,114,105,118,97,116,101,34,62,114, -101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,109,101, -109,98,101,114,95,112,114,105,118,97,116,101,46,112,110,103,60,47,111,98, -106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115, -61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,102,117, -110,99,95,112,117,98,108,105,99,34,62,114,101,115,111,117,114,99,101,115, -46,99,112,112,36,114,101,115,95,102,117,110,99,95,112,117,98,108,105,99, +101,61,34,103,108,111,98,97,108,115,34,62,114,101,115,111,117,114,99,101, +115,46,99,112,112,36,114,101,115,95,99,117,98,101,95,103,114,101,101,110, 46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101, 99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110, -97,109,101,61,34,102,117,110,99,95,112,114,111,116,101,99,116,101,100,34, -62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,102, -117,110,99,95,112,114,111,116,101,99,116,101,100,46,112,110,103,60,47,111, -98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115, -115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,102, -117,110,99,95,112,114,105,118,97,116,101,34,62,114,101,115,111,117,114, -99,101,115,46,99,112,112,36,114,101,115,95,102,117,110,99,95,112,114,105, -118,97,116,101,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60, -111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109, -97,112,34,32,110,97,109,101,61,34,101,110,117,109,34,62,114,101,115,111, -117,114,99,101,115,46,99,112,112,36,114,101,115,95,101,110,117,109,46,112, -110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116, -32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109, -101,61,34,101,110,117,109,101,114,97,116,111,114,34,62,114,101,115,111, -117,114,99,101,115,46,99,112,112,36,114,101,115,95,101,110,117,109,101, -101,46,120,112,109,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106, -101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34, -32,110,97,109,101,61,34,99,108,97,115,115,34,62,114,101,115,111,117,114, -99,101,115,46,99,112,112,36,114,101,115,95,99,108,97,115,115,46,112,110, -103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32, -99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109, -101,61,34,116,121,112,101,100,101,102,34,62,114,101,115,111,117,114,99, -101,115,46,99,112,112,36,114,101,115,95,116,121,112,101,100,101,102,46, -120,112,109,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99, -116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110, -97,109,101,61,34,112,114,111,106,101,99,116,34,62,114,101,115,111,117,114, -99,101,115,46,99,112,112,36,114,101,115,95,99,117,98,101,115,95,121,101, -108,108,111,119,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32, -60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116, -109,97,112,34,32,110,97,109,101,61,34,103,108,111,98,97,108,115,34,62,114, -101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,99,117,98, -101,95,103,114,101,101,110,46,112,110,103,60,47,111,98,106,101,99,116,62, -10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66, -105,116,109,97,112,34,32,110,97,109,101,61,34,110,97,109,101,115,112,97, -99,101,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101, -115,95,110,97,109,101,115,112,97,99,101,46,112,110,103,60,47,111,98,106, -101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61, -34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,115,116,114, -117,99,116,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114, -101,115,95,98,117,116,95,103,114,101,101,110,95,115,46,112,110,103,60,47, -111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97, -115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34, -98,111,111,107,109,97,114,107,95,98,108,117,101,34,62,114,101,115,111,117, -114,99,101,115,46,99,112,112,36,114,101,115,95,109,101,100,105,97,95,115, -116,111,112,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111, +97,109,101,61,34,110,97,109,101,115,112,97,99,101,34,62,114,101,115,111, +117,114,99,101,115,46,99,112,112,36,114,101,115,95,110,97,109,101,115,112, +97,99,101,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111, 98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97, -112,34,32,110,97,109,101,61,34,119,111,114,107,115,112,97,99,101,34,62, -114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,99,117, -98,101,115,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111, +112,34,32,110,97,109,101,61,34,115,116,114,117,99,116,34,62,114,101,115, +111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,98,117,116,95,103, +114,101,101,110,95,115,46,112,110,103,60,47,111,98,106,101,99,116,62,10, +32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105, +116,109,97,112,34,32,110,97,109,101,61,34,98,111,111,107,109,97,114,107, +95,98,108,117,101,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112, +36,114,101,115,95,109,101,100,105,97,95,115,116,111,112,46,112,110,103, +60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99, +108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101, +61,34,119,111,114,107,115,112,97,99,101,34,62,114,101,115,111,117,114,99, +101,115,46,99,112,112,36,114,101,115,95,102,111,108,100,101,114,95,104, +111,109,101,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111, 98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97, 112,34,32,110,97,109,101,61,34,102,111,108,100,101,114,34,62,114,101,115, 111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,102,111,108,100, 101,114,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98, 106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112, -34,32,110,97,109,101,61,34,112,97,103,101,95,119,104,105,116,101,95,99, +34,32,110,97,109,101,61,34,99,114,111,115,115,34,62,114,101,115,111,117, +114,99,101,115,46,99,112,112,36,114,101,115,95,99,114,111,115,115,46,112, +110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116, +32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109, +101,61,34,100,111,99,117,109,101,110,116,95,100,101,108,101,116,101,34, +62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,99, +108,101,97,110,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60, +111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109, +97,112,34,32,110,97,109,101,61,34,98,117,105,108,100,34,62,114,101,115, +111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,99,111,103,46,112, +110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116, +32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109, +101,61,34,102,105,110,100,95,114,101,115,117,108,116,115,34,62,114,101, +115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,112,97,103,101, +95,102,105,110,100,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32, +32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116, +109,97,112,34,32,110,97,109,101,61,34,102,105,108,101,95,118,105,101,119, 34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95, -112,97,103,101,95,119,104,105,116,101,95,99,46,112,110,103,60,47,111,98, +102,111,108,100,101,114,95,116,97,98,108,101,46,112,110,103,60,47,111,98, 106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115, -61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,112,97,103, -101,95,119,104,105,116,101,95,99,112,108,117,115,112,108,117,115,34,62, -114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,112, -97,103,101,95,119,104,105,116,101,95,99,112,108,117,115,112,108,117,115, +61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,99,108,97, +115,115,95,118,105,101,119,34,62,114,101,115,111,117,114,99,101,115,46, +99,112,112,36,114,101,115,95,99,104,97,114,116,95,111,114,103,97,110,105, +115,97,116,105,111,110,46,112,110,103,60,47,111,98,106,101,99,116,62,10, +32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105, +116,109,97,112,34,32,110,97,109,101,61,34,112,97,103,101,95,111,112,101, +110,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115, +95,102,111,108,100,101,114,46,112,110,103,60,47,111,98,106,101,99,116,62, +10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66, +105,116,109,97,112,34,32,110,97,109,101,61,34,119,111,114,100,95,119,114, +97,112,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101, +115,95,119,114,97,112,95,97,114,114,111,119,46,112,110,103,60,47,111,98, +106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115, +61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,111,117, +116,112,117,116,95,119,105,110,34,62,114,101,115,111,117,114,99,101,115, +46,99,112,112,36,114,101,115,95,111,117,116,112,117,116,95,119,105,110, +46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101, +99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110, +97,109,101,61,34,100,101,98,117,103,95,119,105,110,100,111,119,34,62,114, +101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,100,101, +98,117,103,95,119,105,110,100,111,119,115,46,112,110,103,60,47,111,98,106, +101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61, +34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,115,121,109, +95,119,105,122,95,98,109,112,34,62,114,101,115,111,117,114,99,101,115,46, +99,112,112,36,114,101,115,95,115,121,109,95,119,105,122,95,98,109,112,46, +112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99, +116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110, +97,109,101,61,34,100,101,98,117,103,103,101,114,95,116,97,98,34,62,114, +101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,98,117,103, 46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101, 99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110, -97,109,101,61,34,112,97,103,101,95,119,104,105,116,101,95,104,34,62,114, -101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,112,97,103, -101,95,119,104,105,116,101,95,104,46,112,110,103,60,47,111,98,106,101,99, +97,109,101,61,34,104,101,108,112,95,105,99,111,110,34,62,114,101,115,111, +117,114,99,101,115,46,99,112,112,36,114,101,115,95,104,101,108,112,46,112, +110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116, +32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109, +101,61,34,115,118,110,95,114,101,112,111,34,62,114,101,115,111,117,114, +99,101,115,46,99,112,112,36,114,101,115,95,115,118,110,95,114,101,112,111, +46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101, +99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110, +97,109,101,61,34,100,111,99,117,109,101,110,116,95,114,111,111,116,34,62, +114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,100, +114,105,118,101,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32, +60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116, +109,97,112,34,32,110,97,109,101,61,34,108,111,99,97,108,115,95,118,105, +101,119,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101, +115,95,108,111,99,97,108,115,95,118,105,101,119,46,112,110,103,60,47,111, +98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115, +115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,119, +97,116,99,104,101,115,34,62,114,101,115,111,117,114,99,101,115,46,99,112, +112,36,114,101,115,95,119,97,116,99,104,101,115,46,112,110,103,60,47,111, +98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115, +115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,102, +114,97,109,101,115,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112, +36,114,101,115,95,102,114,97,109,101,115,46,112,110,103,60,47,111,98,106, +101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61, +34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,98,114,101, +97,107,112,111,105,110,116,34,62,114,101,115,111,117,114,99,101,115,46, +99,112,112,36,114,101,115,95,98,114,101,97,107,112,111,105,110,116,46,112, +110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116, +32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109, +101,61,34,110,101,119,95,112,108,117,103,105,110,95,119,105,122,95,98,109, +112,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115, +95,112,117,122,122,108,101,46,112,110,103,60,47,111,98,106,101,99,116,62, +10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66, +105,116,109,97,112,34,32,110,97,109,101,61,34,113,117,101,115,116,105,111, +110,95,97,110,100,95,97,110,115,119,101,114,34,62,114,101,115,111,117,114, +99,101,115,46,99,112,112,36,114,101,115,95,113,117,101,115,116,105,111, +110,95,97,110,100,95,97,110,115,119,101,114,46,112,110,103,60,47,111,98, +106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115, +61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,99,115,99, +111,112,101,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114, +101,115,95,107,115,116,97,114,115,46,112,110,103,60,47,111,98,106,101,99, 116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, -120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,112,97,103,101,95, -119,104,105,116,101,95,116,101,120,116,34,62,114,101,115,111,117,114,99, -101,115,46,99,112,112,36,114,101,115,95,112,97,103,101,95,119,104,105,116, -101,95,116,101,120,116,46,112,110,103,60,47,111,98,106,101,99,116,62,10, +120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,116,104,114,101,97, +100,115,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101, +115,95,116,104,114,101,97,100,115,46,112,110,103,60,47,111,98,106,101,99, +116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, +120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,111,112,101,110,101, +100,95,119,105,110,100,111,119,115,34,62,114,101,115,111,117,114,99,101, +115,46,99,112,112,36,114,101,115,95,112,105,99,116,117,114,101,115,46,112, +110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116, +32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109, +101,61,34,116,101,120,116,95,111,107,34,62,114,101,115,111,117,114,99,101, +115,46,99,112,112,36,114,101,115,95,112,97,103,101,95,103,114,101,101,110, +46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101, +99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110, +97,109,101,61,34,110,101,119,95,99,108,97,115,115,95,116,105,116,108,101, +34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95, +110,101,119,95,99,108,97,115,115,46,112,110,103,60,47,111,98,106,101,99, +116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, +120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,119,120,95,112,114, +111,106,101,99,116,95,104,101,97,100,101,114,34,62,114,101,115,111,117, +114,99,101,115,46,99,112,112,36,114,101,115,95,119,120,112,114,111,106, +101,99,116,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111, +98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97, +112,34,32,110,97,109,101,61,34,99,111,108,111,117,114,105,115,101,34,62, +114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,99,111, +108,111,114,105,122,101,46,112,110,103,60,47,111,98,106,101,99,116,62,10, 32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105, -116,109,97,112,34,32,110,97,109,101,61,34,99,114,111,115,115,34,62,114, -101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,99,114,111, -115,115,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98, -106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112, -34,32,110,97,109,101,61,34,100,111,99,117,109,101,110,116,95,100,101,108, -101,116,101,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114, -101,115,95,99,108,101,97,110,46,112,110,103,60,47,111,98,106,101,99,116, +116,109,97,112,34,32,110,97,109,101,61,34,99,111,108,108,97,112,115,101, +34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95, +99,111,108,108,97,112,115,101,46,112,110,103,60,47,111,98,106,101,99,116, 62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120, -66,105,116,109,97,112,34,32,110,97,109,101,61,34,98,117,105,108,100,34, -62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,99, -111,103,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98, -106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112, -34,32,110,97,109,101,61,34,102,105,110,100,95,114,101,115,117,108,116,115, +66,105,116,109,97,112,34,32,110,97,109,101,61,34,103,111,104,111,109,101, 34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95, -112,97,103,101,95,102,105,110,100,46,112,110,103,60,47,111,98,106,101,99, -116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, -120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,102,105,108,101,95, -118,105,101,119,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112, -36,114,101,115,95,102,111,108,100,101,114,95,116,97,98,108,101,46,112,110, -103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32, -99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109, -101,61,34,99,108,97,115,115,95,118,105,101,119,34,62,114,101,115,111,117, -114,99,101,115,46,99,112,112,36,114,101,115,95,99,104,97,114,116,95,111, -114,103,97,110,105,115,97,116,105,111,110,46,112,110,103,60,47,111,98,106, +103,111,104,111,109,101,46,112,110,103,60,47,111,98,106,101,99,116,62,10, +32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105, +116,109,97,112,34,32,110,97,109,101,61,34,112,114,111,106,101,99,116,95, +99,111,110,102,108,105,99,116,34,62,114,101,115,111,117,114,99,101,115, +46,99,112,112,36,114,101,115,95,101,114,114,111,114,46,112,110,103,60,47, +111,98,106,101,99,116,62,10,32,32,60,33,45,45,32,77,105,109,101,116,121, +112,101,32,45,45,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115, +115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,112, +97,103,101,95,119,104,105,116,101,95,99,34,62,114,101,115,111,117,114,99, +101,115,46,99,112,112,36,114,101,115,95,109,105,109,101,116,121,112,101, +95,112,97,103,101,95,119,104,105,116,101,95,99,46,112,110,103,60,47,111, +98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115, +115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,112, +97,103,101,95,119,104,105,116,101,95,99,112,108,117,115,112,108,117,115, +34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95, +109,105,109,101,116,121,112,101,95,112,97,103,101,95,119,104,105,116,101, +95,99,112,108,117,115,112,108,117,115,46,112,110,103,60,47,111,98,106,101, +99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34, +119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,112,97,103,101, +95,119,104,105,116,101,95,104,34,62,114,101,115,111,117,114,99,101,115, +46,99,112,112,36,114,101,115,95,109,105,109,101,116,121,112,101,95,112, +97,103,101,95,119,104,105,116,101,95,104,46,112,110,103,60,47,111,98,106, 101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61, 34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,112,97,103, -101,95,111,112,101,110,34,62,114,101,115,111,117,114,99,101,115,46,99,112, -112,36,114,101,115,95,102,111,108,100,101,114,46,112,110,103,60,47,111, -98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115, -115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,119, -111,114,100,95,119,114,97,112,34,62,114,101,115,111,117,114,99,101,115, -46,99,112,112,36,114,101,115,95,119,114,97,112,95,97,114,114,111,119,46, +101,95,119,104,105,116,101,95,116,101,120,116,34,62,114,101,115,111,117, +114,99,101,115,46,99,112,112,36,114,101,115,95,109,105,109,101,116,121, +112,101,95,112,97,103,101,95,119,104,105,116,101,95,116,101,120,116,46, 112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99, 116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110, -97,109,101,61,34,111,117,116,112,117,116,95,119,105,110,34,62,114,101,115, -111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,111,117,116,112, -117,116,95,119,105,110,46,112,110,103,60,47,111,98,106,101,99,116,62,10, -32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105, -116,109,97,112,34,32,110,97,109,101,61,34,100,101,98,117,103,95,119,105, -110,100,111,119,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112, -36,114,101,115,95,100,101,98,117,103,95,119,105,110,100,111,119,115,46, -112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99, -116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110, -97,109,101,61,34,115,121,109,95,119,105,122,95,98,109,112,34,62,114,101, -115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,115,121,109, -95,119,105,122,95,98,109,112,46,112,110,103,60,47,111,98,106,101,99,116, -62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120, -66,105,116,109,97,112,34,32,110,97,109,101,61,34,100,101,98,117,103,103, -101,114,95,116,97,98,34,62,114,101,115,111,117,114,99,101,115,46,99,112, -112,36,114,101,115,95,98,117,103,46,112,110,103,60,47,111,98,106,101,99, -116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, -120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,104,101,108,112,95, -105,99,111,110,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36, -114,101,115,95,104,101,108,112,46,112,110,103,60,47,111,98,106,101,99,116, -62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120, -66,105,116,109,97,112,34,32,110,97,109,101,61,34,115,118,110,95,114,101, -112,111,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101, -115,95,115,118,110,95,114,101,112,111,46,112,110,103,60,47,111,98,106,101, -99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34, -119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,100,111,99,117, -109,101,110,116,95,114,111,111,116,34,62,114,101,115,111,117,114,99,101, -115,46,99,112,112,36,114,101,115,95,100,114,105,118,101,46,112,110,103, -60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99, -108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101, -61,34,108,111,99,97,108,115,95,118,105,101,119,34,62,114,101,115,111,117, -114,99,101,115,46,99,112,112,36,114,101,115,95,108,111,99,97,108,115,95, -118,105,101,119,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32, -60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116, -109,97,112,34,32,110,97,109,101,61,34,119,97,116,99,104,101,115,34,62,114, -101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,119,97,116, -99,104,101,115,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60, -111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109, -97,112,34,32,110,97,109,101,61,34,102,114,97,109,101,115,34,62,114,101, -115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,102,114,97,109, -101,115,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98, -106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112, -34,32,110,97,109,101,61,34,98,114,101,97,107,112,111,105,110,116,34,62, -114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,98,114, -101,97,107,112,111,105,110,116,46,112,110,103,60,47,111,98,106,101,99,116, -62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120, -66,105,116,109,97,112,34,32,110,97,109,101,61,34,110,101,119,95,112,108, -117,103,105,110,95,119,105,122,95,98,109,112,34,62,114,101,115,111,117, -114,99,101,115,46,99,112,112,36,114,101,115,95,112,117,122,122,108,101, +97,109,101,61,34,99,111,109,112,114,101,115,115,101,100,95,102,105,108, +101,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115, +95,109,105,109,101,116,121,112,101,95,97,112,112,108,105,99,97,116,105, +111,110,95,120,95,99,111,109,112,114,101,115,115,101,100,95,116,97,114, 46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101, 99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110, -97,109,101,61,34,113,117,101,115,116,105,111,110,95,97,110,100,95,97,110, -115,119,101,114,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112, -36,114,101,115,95,113,117,101,115,116,105,111,110,95,97,110,100,95,97,110, -115,119,101,114,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32, -60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116, -109,97,112,34,32,110,97,109,101,61,34,99,115,99,111,112,101,34,62,114,101, -115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,107,115,116, -97,114,115,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111, -98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97, -112,34,32,110,97,109,101,61,34,116,104,114,101,97,100,115,34,62,114,101, -115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,116,104,114, -101,97,100,115,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60, -111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109, -97,112,34,32,110,97,109,101,61,34,111,112,101,110,101,100,95,119,105,110, -100,111,119,115,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112, -36,114,101,115,95,112,105,99,116,117,114,101,115,46,112,110,103,60,47,111, -98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115, -115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,116, -101,120,116,95,111,107,34,62,114,101,115,111,117,114,99,101,115,46,99,112, -112,36,114,101,115,95,112,97,103,101,95,103,114,101,101,110,46,112,110, +97,109,101,61,34,101,120,101,99,117,116,97,98,108,101,34,62,114,101,115, +111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,109,105,109,101, +116,121,112,101,95,97,112,112,108,105,99,97,116,105,111,110,95,120,95,109, +115,95,100,111,115,95,101,120,101,99,117,116,97,98,108,101,46,112,110,103, +60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99, +108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101, +61,34,102,105,108,101,95,112,104,112,34,62,114,101,115,111,117,114,99,101, +115,46,99,112,112,36,114,101,115,95,109,105,109,101,116,121,112,101,95, +97,112,112,108,105,99,97,116,105,111,110,95,120,95,112,104,112,46,112,110, 103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32, 99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109, -101,61,34,110,101,119,95,99,108,97,115,115,95,116,105,116,108,101,34,62, -114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,110, -101,119,95,99,108,97,115,115,46,112,110,103,60,47,111,98,106,101,99,116, +101,61,34,115,104,97,114,101,100,95,108,105,98,114,97,114,121,34,62,114, +101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,109,105, +109,101,116,121,112,101,95,97,112,112,108,105,99,97,116,105,111,110,95, +120,95,115,104,97,114,101,100,108,105,98,46,112,110,103,60,47,111,98,106, +101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61, +34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,112,105,120, +109,97,112,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114, +101,115,95,109,105,109,101,116,121,112,101,95,105,109,97,103,101,95,120, +95,120,112,105,120,109,97,112,46,112,110,103,60,47,111,98,106,101,99,116, 62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120, -66,105,116,109,97,112,34,32,110,97,109,101,61,34,119,120,95,112,114,111, -106,101,99,116,95,104,101,97,100,101,114,34,62,114,101,115,111,117,114, -99,101,115,46,99,112,112,36,114,101,115,95,119,120,112,114,111,106,101, -99,116,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98, -106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112, -34,32,110,97,109,101,61,34,99,111,108,111,117,114,105,115,101,34,62,114, -101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,99,111,108, -111,114,105,122,101,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32, -32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116, -109,97,112,34,32,110,97,109,101,61,34,99,111,108,108,97,112,115,101,34, -62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,99, -111,108,108,97,112,115,101,46,112,110,103,60,47,111,98,106,101,99,116,62, -10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66, -105,116,109,97,112,34,32,110,97,109,101,61,34,103,111,104,111,109,101,34, -62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,103, -111,104,111,109,101,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32, -32,60,33,45,45,10,9,9,84,111,111,108,98,97,114,32,98,105,116,109,97,112, -115,32,40,50,52,120,50,52,41,10,9,45,45,62,10,32,32,60,111,98,106,101,99, -116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110, -97,109,101,61,34,111,117,116,108,105,110,101,50,52,34,62,114,101,115,111, -117,114,99,101,115,46,99,112,112,36,114,101,115,95,50,52,95,116,101,120, -116,95,116,114,101,101,46,112,110,103,60,47,111,98,106,101,99,116,62,10, +66,105,116,109,97,112,34,32,110,97,109,101,61,34,115,104,101,108,108,115, +99,114,105,112,116,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112, +36,114,101,115,95,109,105,109,101,116,121,112,101,95,115,104,101,108,108, +115,99,114,105,112,116,46,112,110,103,60,47,111,98,106,101,99,116,62,10, 32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105, -116,109,97,112,34,32,110,97,109,101,61,34,99,111,110,102,105,103,117,114, -101,95,101,120,116,95,116,111,111,108,115,50,52,34,62,114,101,115,111,117, -114,99,101,115,46,99,112,112,36,114,101,115,95,50,52,95,101,120,116,101, -114,110,97,108,95,116,111,111,108,115,50,52,46,112,110,103,60,47,111,98, -106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115, -61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,101,120, -116,95,116,111,111,108,95,100,101,102,97,117,108,116,50,52,34,62,114,101, -115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,50,52,95,103, -101,97,114,50,52,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32, -60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116, -109,97,112,34,32,110,97,109,101,61,34,115,116,111,112,95,101,120,116,101, -114,110,97,108,95,116,111,111,108,50,52,34,62,114,101,115,111,117,114,99, -101,115,46,99,112,112,36,114,101,115,95,50,52,95,115,116,111,112,95,101, -120,116,101,114,110,97,108,95,116,111,111,108,46,112,110,103,60,47,111, +116,109,97,112,34,32,110,97,109,101,61,34,102,105,108,101,95,120,109,108, +34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95, +109,105,109,101,116,121,112,101,95,120,109,108,46,112,110,103,60,47,111, 98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115, 115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,102, -111,108,100,101,114,50,52,34,62,114,101,115,111,117,114,99,101,115,46,99, -112,112,36,114,101,115,95,50,52,95,102,111,108,100,101,114,50,52,46,112, -110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116, -32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109, -101,61,34,114,101,102,114,101,115,104,50,52,34,62,114,101,115,111,117,114, -99,101,115,46,99,112,112,36,114,101,115,95,50,52,95,114,101,102,114,101, -115,104,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98, -106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112, -34,32,110,97,109,101,61,34,114,101,108,111,97,100,50,52,34,62,114,101,115, -111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,50,52,95,114,101, -118,101,114,116,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32, -60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116, -109,97,112,34,32,110,97,109,101,61,34,115,97,118,101,95,97,115,50,52,34, -62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,50, -52,95,115,97,118,101,95,97,115,46,112,110,103,60,47,111,98,106,101,99,116, +105,108,101,95,104,116,109,108,34,62,114,101,115,111,117,114,99,101,115, +46,99,112,112,36,114,101,115,95,109,105,109,101,116,121,112,101,95,97,112, +112,108,105,99,97,116,105,111,110,95,120,95,109,115,119,105,110,117,114, +108,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106, +101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34, +32,110,97,109,101,61,34,109,97,107,101,102,105,108,101,34,62,114,101,115, +111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,109,105,109,101, +116,121,112,101,95,109,97,107,101,46,112,110,103,60,47,111,98,106,101,99, +116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, +120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,102,111,114,109,98, +117,105,108,100,101,114,34,62,114,101,115,111,117,114,99,101,115,46,99, +112,112,36,114,101,115,95,109,105,109,101,116,121,112,101,95,102,111,114, +109,98,117,105,108,100,101,114,46,112,110,103,60,47,111,98,106,101,99,116, +62,10,32,32,60,33,45,45,10,9,9,84,111,111,108,98,97,114,32,98,105,116,109, +97,112,115,32,40,50,52,120,50,52,41,10,9,45,45,62,10,32,32,60,111,98,106, +101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34, +32,110,97,109,101,61,34,111,117,116,108,105,110,101,50,52,34,62,114,101, +115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,50,52,95,116, +101,120,116,95,116,114,101,101,46,112,110,103,60,47,111,98,106,101,99,116, 62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120, -66,105,116,109,97,112,34,32,110,97,109,101,61,34,99,117,116,50,52,34,62, +66,105,116,109,97,112,34,32,110,97,109,101,61,34,99,111,110,102,105,103, +117,114,101,95,101,120,116,95,116,111,111,108,115,50,52,34,62,114,101,115, +111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,50,52,95,101,120, +116,101,114,110,97,108,95,116,111,111,108,115,50,52,46,112,110,103,60,47, +111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97, +115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34, +101,120,116,95,116,111,111,108,95,100,101,102,97,117,108,116,50,52,34,62, 114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,50,52, -95,99,117,116,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60, -111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109, -97,112,34,32,110,97,109,101,61,34,99,111,112,121,50,52,34,62,114,101,115, -111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,50,52,95,99,111, -112,121,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98, -106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112, -34,32,110,97,109,101,61,34,112,97,115,116,101,50,52,34,62,114,101,115,111, -117,114,99,101,115,46,99,112,112,36,114,101,115,95,50,52,95,112,97,115, -116,101,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98, -106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112, -34,32,110,97,109,101,61,34,117,110,100,111,50,52,34,62,114,101,115,111, -117,114,99,101,115,46,99,112,112,36,114,101,115,95,50,52,95,117,110,100, -111,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106, -101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34, -32,110,97,109,101,61,34,114,101,100,111,50,52,34,62,114,101,115,111,117, -114,99,101,115,46,99,112,112,36,114,101,115,95,50,52,95,114,101,100,111, +95,103,101,97,114,50,52,46,112,110,103,60,47,111,98,106,101,99,116,62,10, +32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105, +116,109,97,112,34,32,110,97,109,101,61,34,115,116,111,112,95,101,120,116, +101,114,110,97,108,95,116,111,111,108,50,52,34,62,114,101,115,111,117,114, +99,101,115,46,99,112,112,36,114,101,115,95,50,52,95,115,116,111,112,95, +101,120,116,101,114,110,97,108,95,116,111,111,108,46,112,110,103,60,47, +111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97, +115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34, +102,111,108,100,101,114,50,52,34,62,114,101,115,111,117,114,99,101,115, +46,99,112,112,36,114,101,115,95,50,52,95,102,111,108,100,101,114,50,52, 46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101, 99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110, -97,109,101,61,34,98,111,111,107,109,97,114,107,50,52,34,62,114,101,115, -111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,50,52,95,98,111, -111,107,109,97,114,107,46,112,110,103,60,47,111,98,106,101,99,116,62,10, -32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105, -116,109,97,112,34,32,110,97,109,101,61,34,99,108,97,115,115,50,52,34,62, +97,109,101,61,34,114,101,102,114,101,115,104,50,52,34,62,114,101,115,111, +117,114,99,101,115,46,99,112,112,36,114,101,115,95,50,52,95,114,101,102, +114,101,115,104,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32, +60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116, +109,97,112,34,32,110,97,109,101,61,34,114,101,108,111,97,100,50,52,34,62, 114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,50,52, -95,99,108,97,115,115,50,52,46,112,110,103,60,47,111,98,106,101,99,116,62, +95,114,101,118,101,114,116,46,112,110,103,60,47,111,98,106,101,99,116,62, 10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66, -105,116,109,97,112,34,32,110,97,109,101,61,34,112,97,103,101,95,99,108, -111,115,101,50,52,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112, -36,114,101,115,95,50,52,95,102,105,108,101,99,108,111,115,101,46,112,110, -103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32, -99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109, -101,61,34,112,97,103,101,95,110,101,119,50,52,34,62,114,101,115,111,117, -114,99,101,115,46,99,112,112,36,114,101,115,95,50,52,95,102,105,108,101, -110,101,119,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111, -98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97, -112,34,32,110,97,109,101,61,34,115,97,118,101,95,97,108,108,50,52,34,62, +105,116,109,97,112,34,32,110,97,109,101,61,34,115,97,118,101,95,97,115, +50,52,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101, +115,95,50,52,95,115,97,118,101,95,97,115,46,112,110,103,60,47,111,98,106, +101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61, +34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,99,117,116, +50,52,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101, +115,95,50,52,95,99,117,116,46,112,110,103,60,47,111,98,106,101,99,116,62, +10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66, +105,116,109,97,112,34,32,110,97,109,101,61,34,99,111,112,121,50,52,34,62, 114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,50,52, -95,115,97,118,101,95,97,108,108,46,112,110,103,60,47,111,98,106,101,99, +95,99,111,112,121,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32, +60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116, +109,97,112,34,32,110,97,109,101,61,34,112,97,115,116,101,50,52,34,62,114, +101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,50,52,95, +112,97,115,116,101,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32, +32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116, +109,97,112,34,32,110,97,109,101,61,34,117,110,100,111,50,52,34,62,114,101, +115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,50,52,95,117, +110,100,111,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111, +98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97, +112,34,32,110,97,109,101,61,34,114,101,100,111,50,52,34,62,114,101,115, +111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,50,52,95,114,101, +100,111,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98, +106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112, +34,32,110,97,109,101,61,34,98,111,111,107,109,97,114,107,50,52,34,62,114, +101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,50,52,95, +98,111,111,107,109,97,114,107,46,112,110,103,60,47,111,98,106,101,99,116, +62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120, +66,105,116,109,97,112,34,32,110,97,109,101,61,34,99,108,97,115,115,50,52, +34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95, +50,52,95,99,108,97,115,115,50,52,46,112,110,103,60,47,111,98,106,101,99, 116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, 120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,112,97,103,101,95, -115,97,118,101,50,52,34,62,114,101,115,111,117,114,99,101,115,46,99,112, -112,36,114,101,115,95,50,52,95,112,97,103,101,95,115,97,118,101,46,112, -110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116, -32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109, -101,61,34,110,101,119,95,119,120,95,112,114,111,106,101,99,116,50,52,34, -62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,50, -52,95,119,120,50,52,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32, +99,108,111,115,101,50,52,34,62,114,101,115,111,117,114,99,101,115,46,99, +112,112,36,114,101,115,95,50,52,95,102,105,108,101,99,108,111,115,101,46, +112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99, +116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110, +97,109,101,61,34,112,97,103,101,95,110,101,119,50,52,34,62,114,101,115, +111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,50,52,95,102,105, +108,101,110,101,119,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32, 32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116, -109,97,112,34,32,110,97,109,101,61,34,112,108,117,103,105,110,50,52,34, -62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,50, -52,95,112,108,117,103,105,110,50,52,46,112,110,103,60,47,111,98,106,101, +109,97,112,34,32,110,97,109,101,61,34,115,97,118,101,95,97,108,108,50,52, +34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95, +50,52,95,115,97,118,101,95,97,108,108,46,112,110,103,60,47,111,98,106,101, 99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34, -119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,99,111,100,101, -95,102,111,114,109,97,116,95,111,112,116,105,111,110,115,50,52,34,62,114, -101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,50,52,95, -115,105,103,110,97,116,117,114,101,46,112,110,103,60,47,111,98,106,101, +119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,112,97,103,101, +95,115,97,118,101,50,52,34,62,114,101,115,111,117,114,99,101,115,46,99, +112,112,36,114,101,115,95,50,52,95,112,97,103,101,95,115,97,118,101,46, +112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99, +116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110, +97,109,101,61,34,110,101,119,95,119,120,95,112,114,111,106,101,99,116,50, +52,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115, +95,50,52,95,119,120,50,52,46,112,110,103,60,47,111,98,106,101,99,116,62, +10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66, +105,116,109,97,112,34,32,110,97,109,101,61,34,112,108,117,103,105,110,50, +52,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115, +95,50,52,95,112,108,117,103,105,110,50,52,46,112,110,103,60,47,111,98,106, +101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61, +34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,99,111,100, +101,95,102,111,114,109,97,116,95,111,112,116,105,111,110,115,50,52,34,62, +114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,50,52, +95,115,105,103,110,97,116,117,114,101,46,112,110,103,60,47,111,98,106,101, 99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34, 119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,99,111,100,101, 95,102,111,114,109,97,116,50,52,34,62,114,101,115,111,117,114,99,101,115, @@ -22463,64 +22597,21 @@ static unsigned char xml_res_file_173[] = { 110,105,116,95,116,101,115,116,49,54,34,62,114,101,115,111,117,114,99,101, 115,46,99,112,112,36,114,101,115,95,49,54,95,114,117,110,95,117,110,105, 116,95,116,101,115,116,46,112,110,103,60,47,111,98,106,101,99,116,62,10, -32,32,60,33,45,45,32,83,118,110,32,105,99,111,110,115,32,45,45,62,10,32, -32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116, -109,97,112,34,32,110,97,109,101,61,34,112,114,111,106,101,99,116,95,109, -111,100,105,102,105,101,100,34,62,114,101,115,111,117,114,99,101,115,46, -99,112,112,36,114,101,115,95,99,117,98,101,115,95,121,101,108,108,111,119, -95,109,111,100,105,102,105,101,100,46,112,110,103,60,47,111,98,106,101, -99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34, -119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,112,114,111,106, -101,99,116,95,111,107,34,62,114,101,115,111,117,114,99,101,115,46,99,112, -112,36,114,101,115,95,99,117,98,101,115,95,121,101,108,108,111,119,95,111, -107,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106, -101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34, -32,110,97,109,101,61,34,112,114,111,106,101,99,116,95,99,111,110,102,108, -105,99,116,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114, -101,115,95,101,114,114,111,114,46,112,110,103,60,47,111,98,106,101,99,116, -62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120, -66,105,116,109,97,112,34,32,110,97,109,101,61,34,119,111,114,107,115,112, -97,99,101,95,109,111,100,105,102,105,101,100,34,62,114,101,115,111,117, -114,99,101,115,46,99,112,112,36,114,101,115,95,99,117,98,101,115,95,109, -111,100,105,102,105,101,100,46,112,110,103,60,47,111,98,106,101,99,116, -62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120, -66,105,116,109,97,112,34,32,110,97,109,101,61,34,119,111,114,107,115,112, -97,99,101,95,111,107,34,62,114,101,115,111,117,114,99,101,115,46,99,112, -112,36,114,101,115,95,99,117,98,101,115,95,111,107,46,112,110,103,60,47, -111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97, -115,115,61,34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34, -119,111,114,107,115,112,97,99,101,95,99,111,110,102,108,105,99,116,34,62, -114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95,101, -114,114,111,114,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32, -60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116, -109,97,112,34,32,110,97,109,101,61,34,112,97,103,101,95,109,111,100,105, -102,105,101,100,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112, -36,114,101,115,95,112,97,103,101,95,119,104,105,116,101,95,116,101,120, -116,95,109,111,100,105,102,105,101,100,46,112,110,103,60,47,111,98,106, -101,99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61, -34,119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,112,97,103, -101,95,111,107,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36, -114,101,115,95,112,97,103,101,95,119,104,105,116,101,95,116,101,120,116, -95,111,107,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111, -98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97, -112,34,32,110,97,109,101,61,34,112,97,103,101,95,99,111,110,102,108,105, -99,116,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101, -115,95,101,114,114,111,114,46,112,110,103,60,47,111,98,106,101,99,116,62, +32,32,60,33,45,45,32,79,118,101,114,108,97,121,32,105,99,111,110,115,32, +45,45,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119, +120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,111,118,101,114,108, +97,121,95,111,107,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112, +36,114,101,115,95,111,107,46,112,110,103,60,47,111,98,106,101,99,116,62, 10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66, -105,116,109,97,112,34,32,110,97,109,101,61,34,102,111,108,100,101,114,95, -109,111,100,105,102,105,101,100,34,62,114,101,115,111,117,114,99,101,115, -46,99,112,112,36,114,101,115,95,102,111,108,100,101,114,95,109,111,100, -105,102,105,101,100,46,112,110,103,60,47,111,98,106,101,99,116,62,10,32, -32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34,119,120,66,105,116, -109,97,112,34,32,110,97,109,101,61,34,102,111,108,100,101,114,95,111,107, -34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115,95, -102,111,108,100,101,114,95,111,107,46,112,110,103,60,47,111,98,106,101, -99,116,62,10,32,32,60,111,98,106,101,99,116,32,99,108,97,115,115,61,34, -119,120,66,105,116,109,97,112,34,32,110,97,109,101,61,34,102,111,108,100, -101,114,95,99,111,110,102,108,105,99,116,34,62,114,101,115,111,117,114, -99,101,115,46,99,112,112,36,114,101,115,95,101,114,114,111,114,46,112,110, -103,60,47,111,98,106,101,99,116,62,10,60,47,114,101,115,111,117,114,99, -101,62,10}; +105,116,109,97,112,34,32,110,97,109,101,61,34,111,118,101,114,108,97,121, +95,109,111,100,105,102,105,101,100,34,62,114,101,115,111,117,114,99,101, +115,46,99,112,112,36,114,101,115,95,109,111,100,105,102,105,101,100,46, +112,110,103,60,47,111,98,106,101,99,116,62,10,32,32,60,111,98,106,101,99, +116,32,99,108,97,115,115,61,34,119,120,66,105,116,109,97,112,34,32,110, +97,109,101,61,34,111,118,101,114,108,97,121,95,99,111,110,102,108,105,99, +116,34,62,114,101,115,111,117,114,99,101,115,46,99,112,112,36,114,101,115, +95,99,111,110,102,108,105,99,116,46,112,110,103,60,47,111,98,106,101,99, +116,62,10,60,47,114,101,115,111,117,114,99,101,62,10}; void InitXmlResource() { @@ -22543,171 +22634,175 @@ void InitXmlResource() XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_close_panel_push.png"), xml_res_file_5, xml_res_size_5, _T("image/png")); XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_cubes_yellow_preferences.png"), xml_res_file_6, xml_res_size_6, _T("image/png")); XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_cubes_yellow_popup.png"), xml_res_file_7, xml_res_size_7, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_wxfb.png"), xml_res_file_8, xml_res_size_8, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_tab.png"), xml_res_file_9, xml_res_size_9, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_todo.png"), xml_res_file_10, xml_res_size_10, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_memory_view.png"), xml_res_file_11, xml_res_size_11, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_cpp_blue.png"), xml_res_file_12, xml_res_size_12, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_about_img.png"), xml_res_file_13, xml_res_size_13, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_member_public.png"), xml_res_file_14, xml_res_size_14, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_link_editor.png"), xml_res_file_15, xml_res_size_15, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_file_explorer.png"), xml_res_file_16, xml_res_size_16, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_member_protected.png"), xml_res_file_17, xml_res_size_17, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_member_private.png"), xml_res_file_18, xml_res_size_18, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_func_public.png"), xml_res_file_19, xml_res_size_19, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_func_protected.png"), xml_res_file_20, xml_res_size_20, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_func_private.png"), xml_res_file_21, xml_res_size_21, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_enum.png"), xml_res_file_22, xml_res_size_22, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_enumee.xpm"), xml_res_file_23, xml_res_size_23, _T("")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_class.png"), xml_res_file_24, xml_res_size_24, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_typedef.xpm"), xml_res_file_25, xml_res_size_25, _T("")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_cubes_yellow.png"), xml_res_file_26, xml_res_size_26, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_cube_green.png"), xml_res_file_27, xml_res_size_27, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_namespace.png"), xml_res_file_28, xml_res_size_28, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_but_green_s.png"), xml_res_file_29, xml_res_size_29, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_media_stop.png"), xml_res_file_30, xml_res_size_30, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_cubes.png"), xml_res_file_31, xml_res_size_31, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_folder.png"), xml_res_file_32, xml_res_size_32, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_page_white_c.png"), xml_res_file_33, xml_res_size_33, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_page_white_cplusplus.png"), xml_res_file_34, xml_res_size_34, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_page_white_h.png"), xml_res_file_35, xml_res_size_35, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_page_white_text.png"), xml_res_file_36, xml_res_size_36, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_cross.png"), xml_res_file_37, xml_res_size_37, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_clean.png"), xml_res_file_38, xml_res_size_38, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_cog.png"), xml_res_file_39, xml_res_size_39, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_page_find.png"), xml_res_file_40, xml_res_size_40, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_folder_table.png"), xml_res_file_41, xml_res_size_41, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_chart_organisation.png"), xml_res_file_42, xml_res_size_42, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_wrap_arrow.png"), xml_res_file_43, xml_res_size_43, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_output_win.png"), xml_res_file_44, xml_res_size_44, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_debug_windows.png"), xml_res_file_45, xml_res_size_45, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_sym_wiz_bmp.png"), xml_res_file_46, xml_res_size_46, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_bug.png"), xml_res_file_47, xml_res_size_47, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_help.png"), xml_res_file_48, xml_res_size_48, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_svn_repo.png"), xml_res_file_49, xml_res_size_49, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_drive.png"), xml_res_file_50, xml_res_size_50, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_locals_view.png"), xml_res_file_51, xml_res_size_51, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_watches.png"), xml_res_file_52, xml_res_size_52, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_frames.png"), xml_res_file_53, xml_res_size_53, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_breakpoint.png"), xml_res_file_54, xml_res_size_54, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_puzzle.png"), xml_res_file_55, xml_res_size_55, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_question_and_answer.png"), xml_res_file_56, xml_res_size_56, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_kstars.png"), xml_res_file_57, xml_res_size_57, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_threads.png"), xml_res_file_58, xml_res_size_58, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_pictures.png"), xml_res_file_59, xml_res_size_59, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_page_green.png"), xml_res_file_60, xml_res_size_60, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_new_class.png"), xml_res_file_61, xml_res_size_61, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_wxproject.png"), xml_res_file_62, xml_res_size_62, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_colorize.png"), xml_res_file_63, xml_res_size_63, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_collapse.png"), xml_res_file_64, xml_res_size_64, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_gohome.png"), xml_res_file_65, xml_res_size_65, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_text_tree.png"), xml_res_file_66, xml_res_size_66, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_external_tools24.png"), xml_res_file_67, xml_res_size_67, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_gear24.png"), xml_res_file_68, xml_res_size_68, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_stop_external_tool.png"), xml_res_file_69, xml_res_size_69, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_folder24.png"), xml_res_file_70, xml_res_size_70, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_refresh.png"), xml_res_file_71, xml_res_size_71, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_revert.png"), xml_res_file_72, xml_res_size_72, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_save_as.png"), xml_res_file_73, xml_res_size_73, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_cut.png"), xml_res_file_74, xml_res_size_74, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_copy.png"), xml_res_file_75, xml_res_size_75, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_paste.png"), xml_res_file_76, xml_res_size_76, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_undo.png"), xml_res_file_77, xml_res_size_77, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_redo.png"), xml_res_file_78, xml_res_size_78, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_bookmark.png"), xml_res_file_79, xml_res_size_79, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_class24.png"), xml_res_file_80, xml_res_size_80, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_fileclose.png"), xml_res_file_81, xml_res_size_81, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_filenew.png"), xml_res_file_82, xml_res_size_82, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_save_all.png"), xml_res_file_83, xml_res_size_83, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_page_save.png"), xml_res_file_84, xml_res_size_84, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_wx24.png"), xml_res_file_85, xml_res_size_85, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_plugin24.png"), xml_res_file_86, xml_res_size_86, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_signature.png"), xml_res_file_87, xml_res_size_87, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_magic-wand2.png"), xml_res_file_88, xml_res_size_88, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_hammer.png"), xml_res_file_89, xml_res_size_89, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_stop.png"), xml_res_file_90, xml_res_size_90, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_gear_run.png"), xml_res_file_91, xml_res_size_91, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_gear_stop.png"), xml_res_file_92, xml_res_size_92, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_garbage.png"), xml_res_file_93, xml_res_size_93, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_find.png"), xml_res_file_94, xml_res_size_94, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_search.png"), xml_res_file_95, xml_res_size_95, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_open_resource.png"), xml_res_file_96, xml_res_size_96, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_open_type.png"), xml_res_file_97, xml_res_size_97, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_next.png"), xml_res_file_98, xml_res_size_98, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_previous.png"), xml_res_file_99, xml_res_size_99, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_debugger_start.png"), xml_res_file_100, xml_res_size_100, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_debugger_restart.png"), xml_res_file_101, xml_res_size_101, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_debugger_stop.png"), xml_res_file_102, xml_res_size_102, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_debugger_pause.png"), xml_res_file_103, xml_res_size_103, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_debugger_stepin.png"), xml_res_file_104, xml_res_size_104, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_debugger_stepout.png"), xml_res_file_105, xml_res_size_105, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_debugger_next.png"), xml_res_file_106, xml_res_size_106, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_func_find24.png"), xml_res_file_107, xml_res_size_107, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_func_calling24.png"), xml_res_file_108, xml_res_size_108, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_func_called24.png"), xml_res_file_109, xml_res_size_109, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_ref_analyzer24.png"), xml_res_file_110, xml_res_size_110, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_ref_anaylzer_settings24.png"), xml_res_file_111, xml_res_size_111, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_arrow_green_right24.png"), xml_res_file_112, xml_res_size_112, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_highlight.png"), xml_res_file_113, xml_res_size_113, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_run_unit_test.png"), xml_res_file_114, xml_res_size_114, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_text_tree.png"), xml_res_file_115, xml_res_size_115, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_external_tools16.png"), xml_res_file_116, xml_res_size_116, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_gear16.png"), xml_res_file_117, xml_res_size_117, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_stop_external_tool.png"), xml_res_file_118, xml_res_size_118, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_folder24.png"), xml_res_file_119, xml_res_size_119, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_refresh.png"), xml_res_file_120, xml_res_size_120, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_revert.png"), xml_res_file_121, xml_res_size_121, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_save_as.png"), xml_res_file_122, xml_res_size_122, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_cut.png"), xml_res_file_123, xml_res_size_123, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_copy.png"), xml_res_file_124, xml_res_size_124, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_paste.png"), xml_res_file_125, xml_res_size_125, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_undo.png"), xml_res_file_126, xml_res_size_126, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_redo.png"), xml_res_file_127, xml_res_size_127, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_bookmark.png"), xml_res_file_128, xml_res_size_128, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_class24.png"), xml_res_file_129, xml_res_size_129, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_fileclose.png"), xml_res_file_130, xml_res_size_130, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_filenew.png"), xml_res_file_131, xml_res_size_131, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_save_all.png"), xml_res_file_132, xml_res_size_132, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_page_save.png"), xml_res_file_133, xml_res_size_133, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_wx24.png"), xml_res_file_134, xml_res_size_134, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_plugin24.png"), xml_res_file_135, xml_res_size_135, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_signature.png"), xml_res_file_136, xml_res_size_136, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_magic-wand2.png"), xml_res_file_137, xml_res_size_137, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_hammer.png"), xml_res_file_138, xml_res_size_138, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_stop.png"), xml_res_file_139, xml_res_size_139, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_gear_run.png"), xml_res_file_140, xml_res_size_140, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_gear_stop.png"), xml_res_file_141, xml_res_size_141, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_garbage.png"), xml_res_file_142, xml_res_size_142, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_find.png"), xml_res_file_143, xml_res_size_143, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_search.png"), xml_res_file_144, xml_res_size_144, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_open_resource.png"), xml_res_file_145, xml_res_size_145, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_open_type.png"), xml_res_file_146, xml_res_size_146, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_next.png"), xml_res_file_147, xml_res_size_147, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_previous.png"), xml_res_file_148, xml_res_size_148, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_debugger_start.png"), xml_res_file_149, xml_res_size_149, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_debugger_restart.png"), xml_res_file_150, xml_res_size_150, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_debugger_stop.png"), xml_res_file_151, xml_res_size_151, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_debugger_pause.png"), xml_res_file_152, xml_res_size_152, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_debugger_stepin.png"), xml_res_file_153, xml_res_size_153, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_debugger_stepout.png"), xml_res_file_154, xml_res_size_154, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_debugger_next.png"), xml_res_file_155, xml_res_size_155, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_func_find24.png"), xml_res_file_156, xml_res_size_156, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_func_calling24.png"), xml_res_file_157, xml_res_size_157, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_func_called24.png"), xml_res_file_158, xml_res_size_158, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_ref_analyzer24.png"), xml_res_file_159, xml_res_size_159, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_ref_anaylzer_settings24.png"), xml_res_file_160, xml_res_size_160, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_arrow_right_green16.png"), xml_res_file_161, xml_res_size_161, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_highlight.png"), xml_res_file_162, xml_res_size_162, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_run_unit_test.png"), xml_res_file_163, xml_res_size_163, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_cubes_yellow_modified.png"), xml_res_file_164, xml_res_size_164, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_cubes_yellow_ok.png"), xml_res_file_165, xml_res_size_165, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_error.png"), xml_res_file_166, xml_res_size_166, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_cubes_modified.png"), xml_res_file_167, xml_res_size_167, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_cubes_ok.png"), xml_res_file_168, xml_res_size_168, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_page_white_text_modified.png"), xml_res_file_169, xml_res_size_169, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_page_white_text_ok.png"), xml_res_file_170, xml_res_size_170, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_folder_modified.png"), xml_res_file_171, xml_res_size_171, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_folder_ok.png"), xml_res_file_172, xml_res_size_172, _T("image/png")); - XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$._resources.xrc"), xml_res_file_173, xml_res_size_173, _T("text/xml")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_tab.png"), xml_res_file_8, xml_res_size_8, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_todo.png"), xml_res_file_9, xml_res_size_9, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_memory_view.png"), xml_res_file_10, xml_res_size_10, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_cpp_blue.png"), xml_res_file_11, xml_res_size_11, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_about_img.png"), xml_res_file_12, xml_res_size_12, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_member_public.png"), xml_res_file_13, xml_res_size_13, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_link_editor.png"), xml_res_file_14, xml_res_size_14, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_file_explorer.png"), xml_res_file_15, xml_res_size_15, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_member_protected.png"), xml_res_file_16, xml_res_size_16, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_member_private.png"), xml_res_file_17, xml_res_size_17, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_func_public.png"), xml_res_file_18, xml_res_size_18, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_func_protected.png"), xml_res_file_19, xml_res_size_19, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_func_private.png"), xml_res_file_20, xml_res_size_20, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_enum.png"), xml_res_file_21, xml_res_size_21, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_enumee.xpm"), xml_res_file_22, xml_res_size_22, _T("")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_class.png"), xml_res_file_23, xml_res_size_23, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_typedef.xpm"), xml_res_file_24, xml_res_size_24, _T("")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_folder_development.png"), xml_res_file_25, xml_res_size_25, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_cube_green.png"), xml_res_file_26, xml_res_size_26, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_namespace.png"), xml_res_file_27, xml_res_size_27, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_but_green_s.png"), xml_res_file_28, xml_res_size_28, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_media_stop.png"), xml_res_file_29, xml_res_size_29, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_folder_home.png"), xml_res_file_30, xml_res_size_30, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_folder.png"), xml_res_file_31, xml_res_size_31, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_cross.png"), xml_res_file_32, xml_res_size_32, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_clean.png"), xml_res_file_33, xml_res_size_33, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_cog.png"), xml_res_file_34, xml_res_size_34, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_page_find.png"), xml_res_file_35, xml_res_size_35, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_folder_table.png"), xml_res_file_36, xml_res_size_36, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_chart_organisation.png"), xml_res_file_37, xml_res_size_37, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_wrap_arrow.png"), xml_res_file_38, xml_res_size_38, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_output_win.png"), xml_res_file_39, xml_res_size_39, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_debug_windows.png"), xml_res_file_40, xml_res_size_40, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_sym_wiz_bmp.png"), xml_res_file_41, xml_res_size_41, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_bug.png"), xml_res_file_42, xml_res_size_42, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_help.png"), xml_res_file_43, xml_res_size_43, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_svn_repo.png"), xml_res_file_44, xml_res_size_44, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_drive.png"), xml_res_file_45, xml_res_size_45, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_locals_view.png"), xml_res_file_46, xml_res_size_46, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_watches.png"), xml_res_file_47, xml_res_size_47, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_frames.png"), xml_res_file_48, xml_res_size_48, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_breakpoint.png"), xml_res_file_49, xml_res_size_49, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_puzzle.png"), xml_res_file_50, xml_res_size_50, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_question_and_answer.png"), xml_res_file_51, xml_res_size_51, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_kstars.png"), xml_res_file_52, xml_res_size_52, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_threads.png"), xml_res_file_53, xml_res_size_53, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_pictures.png"), xml_res_file_54, xml_res_size_54, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_page_green.png"), xml_res_file_55, xml_res_size_55, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_new_class.png"), xml_res_file_56, xml_res_size_56, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_wxproject.png"), xml_res_file_57, xml_res_size_57, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_colorize.png"), xml_res_file_58, xml_res_size_58, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_collapse.png"), xml_res_file_59, xml_res_size_59, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_gohome.png"), xml_res_file_60, xml_res_size_60, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_error.png"), xml_res_file_61, xml_res_size_61, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_mimetype_page_white_c.png"), xml_res_file_62, xml_res_size_62, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_mimetype_page_white_cplusplus.png"), xml_res_file_63, xml_res_size_63, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_mimetype_page_white_h.png"), xml_res_file_64, xml_res_size_64, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_mimetype_page_white_text.png"), xml_res_file_65, xml_res_size_65, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_mimetype_application_x_compressed_tar.png"), xml_res_file_66, xml_res_size_66, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_mimetype_application_x_ms_dos_executable.png"), xml_res_file_67, xml_res_size_67, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_mimetype_application_x_php.png"), xml_res_file_68, xml_res_size_68, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_mimetype_application_x_sharedlib.png"), xml_res_file_69, xml_res_size_69, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_mimetype_image_x_xpixmap.png"), xml_res_file_70, xml_res_size_70, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_mimetype_shellscript.png"), xml_res_file_71, xml_res_size_71, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_mimetype_xml.png"), xml_res_file_72, xml_res_size_72, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_mimetype_application_x_mswinurl.png"), xml_res_file_73, xml_res_size_73, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_mimetype_make.png"), xml_res_file_74, xml_res_size_74, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_mimetype_formbuilder.png"), xml_res_file_75, xml_res_size_75, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_text_tree.png"), xml_res_file_76, xml_res_size_76, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_external_tools24.png"), xml_res_file_77, xml_res_size_77, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_gear24.png"), xml_res_file_78, xml_res_size_78, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_stop_external_tool.png"), xml_res_file_79, xml_res_size_79, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_folder24.png"), xml_res_file_80, xml_res_size_80, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_refresh.png"), xml_res_file_81, xml_res_size_81, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_revert.png"), xml_res_file_82, xml_res_size_82, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_save_as.png"), xml_res_file_83, xml_res_size_83, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_cut.png"), xml_res_file_84, xml_res_size_84, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_copy.png"), xml_res_file_85, xml_res_size_85, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_paste.png"), xml_res_file_86, xml_res_size_86, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_undo.png"), xml_res_file_87, xml_res_size_87, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_redo.png"), xml_res_file_88, xml_res_size_88, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_bookmark.png"), xml_res_file_89, xml_res_size_89, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_class24.png"), xml_res_file_90, xml_res_size_90, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_fileclose.png"), xml_res_file_91, xml_res_size_91, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_filenew.png"), xml_res_file_92, xml_res_size_92, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_save_all.png"), xml_res_file_93, xml_res_size_93, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_page_save.png"), xml_res_file_94, xml_res_size_94, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_wx24.png"), xml_res_file_95, xml_res_size_95, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_plugin24.png"), xml_res_file_96, xml_res_size_96, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_signature.png"), xml_res_file_97, xml_res_size_97, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_magic-wand2.png"), xml_res_file_98, xml_res_size_98, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_hammer.png"), xml_res_file_99, xml_res_size_99, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_stop.png"), xml_res_file_100, xml_res_size_100, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_gear_run.png"), xml_res_file_101, xml_res_size_101, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_gear_stop.png"), xml_res_file_102, xml_res_size_102, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_garbage.png"), xml_res_file_103, xml_res_size_103, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_find.png"), xml_res_file_104, xml_res_size_104, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_search.png"), xml_res_file_105, xml_res_size_105, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_open_resource.png"), xml_res_file_106, xml_res_size_106, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_open_type.png"), xml_res_file_107, xml_res_size_107, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_next.png"), xml_res_file_108, xml_res_size_108, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_previous.png"), xml_res_file_109, xml_res_size_109, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_debugger_start.png"), xml_res_file_110, xml_res_size_110, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_debugger_restart.png"), xml_res_file_111, xml_res_size_111, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_debugger_stop.png"), xml_res_file_112, xml_res_size_112, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_debugger_pause.png"), xml_res_file_113, xml_res_size_113, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_debugger_stepin.png"), xml_res_file_114, xml_res_size_114, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_debugger_stepout.png"), xml_res_file_115, xml_res_size_115, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_debugger_next.png"), xml_res_file_116, xml_res_size_116, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_func_find24.png"), xml_res_file_117, xml_res_size_117, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_func_calling24.png"), xml_res_file_118, xml_res_size_118, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_func_called24.png"), xml_res_file_119, xml_res_size_119, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_ref_analyzer24.png"), xml_res_file_120, xml_res_size_120, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_ref_anaylzer_settings24.png"), xml_res_file_121, xml_res_size_121, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_arrow_green_right24.png"), xml_res_file_122, xml_res_size_122, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_highlight.png"), xml_res_file_123, xml_res_size_123, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_24_run_unit_test.png"), xml_res_file_124, xml_res_size_124, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_text_tree.png"), xml_res_file_125, xml_res_size_125, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_external_tools16.png"), xml_res_file_126, xml_res_size_126, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_gear16.png"), xml_res_file_127, xml_res_size_127, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_stop_external_tool.png"), xml_res_file_128, xml_res_size_128, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_folder24.png"), xml_res_file_129, xml_res_size_129, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_refresh.png"), xml_res_file_130, xml_res_size_130, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_revert.png"), xml_res_file_131, xml_res_size_131, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_save_as.png"), xml_res_file_132, xml_res_size_132, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_cut.png"), xml_res_file_133, xml_res_size_133, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_copy.png"), xml_res_file_134, xml_res_size_134, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_paste.png"), xml_res_file_135, xml_res_size_135, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_undo.png"), xml_res_file_136, xml_res_size_136, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_redo.png"), xml_res_file_137, xml_res_size_137, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_bookmark.png"), xml_res_file_138, xml_res_size_138, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_class24.png"), xml_res_file_139, xml_res_size_139, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_fileclose.png"), xml_res_file_140, xml_res_size_140, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_filenew.png"), xml_res_file_141, xml_res_size_141, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_save_all.png"), xml_res_file_142, xml_res_size_142, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_page_save.png"), xml_res_file_143, xml_res_size_143, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_wx24.png"), xml_res_file_144, xml_res_size_144, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_plugin24.png"), xml_res_file_145, xml_res_size_145, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_signature.png"), xml_res_file_146, xml_res_size_146, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_magic-wand2.png"), xml_res_file_147, xml_res_size_147, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_hammer.png"), xml_res_file_148, xml_res_size_148, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_stop.png"), xml_res_file_149, xml_res_size_149, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_gear_run.png"), xml_res_file_150, xml_res_size_150, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_gear_stop.png"), xml_res_file_151, xml_res_size_151, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_garbage.png"), xml_res_file_152, xml_res_size_152, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_find.png"), xml_res_file_153, xml_res_size_153, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_search.png"), xml_res_file_154, xml_res_size_154, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_open_resource.png"), xml_res_file_155, xml_res_size_155, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_open_type.png"), xml_res_file_156, xml_res_size_156, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_next.png"), xml_res_file_157, xml_res_size_157, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_previous.png"), xml_res_file_158, xml_res_size_158, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_debugger_start.png"), xml_res_file_159, xml_res_size_159, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_debugger_restart.png"), xml_res_file_160, xml_res_size_160, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_debugger_stop.png"), xml_res_file_161, xml_res_size_161, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_debugger_pause.png"), xml_res_file_162, xml_res_size_162, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_debugger_stepin.png"), xml_res_file_163, xml_res_size_163, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_debugger_stepout.png"), xml_res_file_164, xml_res_size_164, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_debugger_next.png"), xml_res_file_165, xml_res_size_165, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_func_find24.png"), xml_res_file_166, xml_res_size_166, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_func_calling24.png"), xml_res_file_167, xml_res_size_167, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_func_called24.png"), xml_res_file_168, xml_res_size_168, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_ref_analyzer24.png"), xml_res_file_169, xml_res_size_169, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_ref_anaylzer_settings24.png"), xml_res_file_170, xml_res_size_170, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_arrow_right_green16.png"), xml_res_file_171, xml_res_size_171, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_highlight.png"), xml_res_file_172, xml_res_size_172, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_16_run_unit_test.png"), xml_res_file_173, xml_res_size_173, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_ok.png"), xml_res_file_174, xml_res_size_174, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_modified.png"), xml_res_file_175, xml_res_size_175, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$res_conflict.png"), xml_res_file_176, xml_res_size_176, _T("image/png")); + XRC_ADD_FILE(wxT("XRC_resource/resources.cpp$._resources.xrc"), xml_res_file_177, xml_res_size_177, _T("text/xml")); wxXmlResource::Get()->Load(wxT("memory:XRC_resource/resources.cpp$._resources.xrc")); } diff --git a/LiteEditor/resources.xrc b/LiteEditor/resources.xrc index 99c9ffba11..d238cac6bb 100644 --- a/LiteEditor/resources.xrc +++ b/LiteEditor/resources.xrc @@ -7,7 +7,6 @@ res/close_panel_push.png res/cubes_yellow_preferences.png res/cubes_yellow_popup.png - res/wxfb.png res/tab.png res/todo.png res/memory_view.png @@ -25,18 +24,14 @@ res/enumee.xpm res/class.png res/typedef.xpm - res/cubes_yellow.png + res/folder_development.png res/cube_green.png res/namespace.png res/but_green_s.png res/media_stop.png - res/cubes.png + res/folder_home.png res/folder.png - res/page_white_c.png - res/page_white_cplusplus.png - res/page_white_h.png - res/page_white_text.png - res/cross.png + res/cross.png res/clean.png res/cog.png res/page_find.png @@ -66,6 +61,23 @@ res/colorize.png res/collapse.png res/gohome.png + res/error.png + + + res/mimetype/page_white_c.png + res/mimetype/page_white_cplusplus.png + res/mimetype/page_white_h.png + res/mimetype/page_white_text.png + res/mimetype/application_x_compressed_tar.png + res/mimetype/application_x_ms_dos_executable.png + res/mimetype/application_x_php.png + res/mimetype/application_x_sharedlib.png + res/mimetype/image_x_xpixmap.png + res/mimetype/shellscript.png + res/mimetype/xml.png + res/mimetype/application_x_mswinurl.png + res/mimetype/make.png + res/mimetype/formbuilder.png - res/cubes_yellow_modified.png - res/cubes_yellow_ok.png - res/error.png - - res/cubes_modified.png - res/cubes_ok.png - res/error.png - - res/page_white_text_modified.png - res/page_white_text_ok.png - res/error.png - - res/folder_modified.png - res/folder_ok.png - res/error.png + + res/ok.png + res/modified.png + res/conflict.png diff --git a/Plugin/overlaytool.cpp b/Plugin/overlaytool.cpp new file mode 100644 index 0000000000..97d7fdf037 --- /dev/null +++ b/Plugin/overlaytool.cpp @@ -0,0 +1,94 @@ +#include +#include "overlaytool.h" +#include +#include + +wxBitmap OverlayTool::ms_bmpOK; +wxBitmap OverlayTool::ms_bmpConflict; +wxBitmap OverlayTool::ms_bmpModified; + +OverlayTool::OverlayTool() +{ + ms_bmpOK = wxXmlResource::Get()->LoadBitmap(wxT("overlay_ok")); + ms_bmpModified = wxXmlResource::Get()->LoadBitmap(wxT("overlay_modified")); + ms_bmpConflict = wxXmlResource::Get()->LoadBitmap(wxT("overlay_conflict")); +} + +OverlayTool::~OverlayTool() +{ +} + +wxBitmap OverlayTool::AddConflictIcon(wxBitmap& bmp) +{ + wxMemoryDC dcMem; + +#if defined(__WXGTK__)|| defined(__WXMAC__) + wxColour col = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); + wxBitmap bitmap(16, 16); + dcMem.SelectObject(bitmap); + dcMem.SetPen( wxPen(col) ); + dcMem.SetBrush( wxBrush(col) ); + dcMem.DrawRectangle(wxPoint(0, 0), wxSize(16, 16)); + dcMem.DrawBitmap(bmp, wxPoint(0, 0), true); +#else + wxBitmap bitmap(bmp); + dcMem.SelectObject(bitmap); +#endif + + dcMem.DrawBitmap(ms_bmpConflict, wxPoint(0, 0), true); + dcMem.SelectObject(wxNullBitmap); + + return bitmap; +} + +wxBitmap OverlayTool::AddModifiedIcon(wxBitmap& bmp) +{ + wxMemoryDC dcMem; + +#if defined(__WXGTK__)|| defined(__WXMAC__) + wxColour col = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); + wxBitmap bitmap(16, 16); + dcMem.SelectObject(bitmap); + dcMem.SetPen( wxPen(col) ); + dcMem.SetBrush( wxBrush(col) ); + dcMem.DrawRectangle(wxPoint(0, 0), wxSize(16, 16)); + dcMem.DrawBitmap(bmp, wxPoint(0, 0), true); +#else + wxBitmap bitmap(bmp); + dcMem.SelectObject(bitmap); +#endif + + dcMem.DrawBitmap(ms_bmpModified, wxPoint(0, 0), true); + dcMem.SelectObject(wxNullBitmap); + + return bitmap; +} + +wxBitmap OverlayTool::AddOKIcon(wxBitmap& bmp) +{ + wxMemoryDC dcMem; + +#if defined(__WXGTK__)|| defined(__WXMAC__) + wxColour col = wxSystemSettings::GetColour(wxSYS_COLOUR_WINDOW); + wxBitmap bitmap(16, 16); + dcMem.SelectObject(bitmap); + dcMem.SetPen( wxPen(col) ); + dcMem.SetBrush( wxBrush(col) ); + dcMem.DrawRectangle(wxPoint(0, 0), wxSize(16, 16)); + dcMem.DrawBitmap(bmp, wxPoint(0, 0), true); +#else + wxBitmap bitmap(bmp); + dcMem.SelectObject(bitmap); +#endif + + dcMem.DrawBitmap(ms_bmpOK, wxPoint(0, 0), true); + dcMem.SelectObject(wxNullBitmap); + + return bitmap; +} + +OverlayTool& OverlayTool::Get() +{ + static OverlayTool theTool; + return theTool; +} diff --git a/Plugin/overlaytool.h b/Plugin/overlaytool.h new file mode 100644 index 0000000000..85007b1f6a --- /dev/null +++ b/Plugin/overlaytool.h @@ -0,0 +1,30 @@ +#ifndef __overlaytool__ +#define __overlaytool__ + +#include + +/** + * @class OverlayTool a simple tool which allows creating new images with overlay icons + * @author eran + * @date 08/31/09 + * @file overlaytool.h + * @brief + */ +class OverlayTool { + + static wxBitmap ms_bmpOK; + static wxBitmap ms_bmpConflict; + static wxBitmap ms_bmpModified; + +private: + OverlayTool(); + virtual ~OverlayTool(); + +public: + static OverlayTool& Get(); + + wxBitmap AddOKIcon (wxBitmap& bmp); + wxBitmap AddConflictIcon(wxBitmap& bmp); + wxBitmap AddModifiedIcon(wxBitmap& bmp); +}; +#endif // __overlaytool__ diff --git a/Plugin/plugin_sdk.project b/Plugin/plugin_sdk.project index a01ac9a18b..1adb974a63 100644 --- a/Plugin/plugin_sdk.project +++ b/Plugin/plugin_sdk.project @@ -346,5 +346,9 @@ + + + + diff --git a/Plugin/project.cpp b/Plugin/project.cpp index 05460c0692..303d6f9cc6 100644 --- a/Plugin/project.cpp +++ b/Plugin/project.cpp @@ -184,7 +184,7 @@ bool Project::IsFileExist(const wxString &fileName) GetFiles(files); for (size_t i=0; i::const_iterator iter = _cache.find(fullpath.GetFullPath()); if (iter != _cache.end()) { @@ -437,8 +437,8 @@ wxTreeItemId wxVirtualDirTreeCtrl::GetItemByFullPath(const wxFileName &fullpath, #endif wxTreeItemId id = DoFindItemByPath(fullpath, scandirs); - -#ifdef __WXMSW__ + +#ifdef __WXMSW__ if (scandirs && id.IsOk()) { _cache[fullpath.GetFullPath()] = id.m_pItem; } @@ -458,13 +458,13 @@ wxTreeItemId wxVirtualDirTreeCtrl::ExpandToPath(const wxFileName &path) EnsureVisible(item); SendCmdEvent(wxEVT_FILE_EXP_REFRESHED); } - return item; + return item; } wxTreeItemId wxVirtualDirTreeCtrl::DoFindItemByPath(const wxFileName &path, bool scandirs) { PERF_FUNCTION(); - + wxString volume = path.HasVolume() ? path.GetVolume()+wxT(":\\") : wxString(wxT("/")); // look for volume @@ -476,7 +476,7 @@ wxTreeItemId wxVirtualDirTreeCtrl::DoFindItemByPath(const wxFileName &path, bool } curr = GetRootItem(); } - + // look for directories in the path wxFileName seekpath; if (path.HasVolume()) { @@ -556,10 +556,10 @@ bool wxVirtualDirTreeCtrl::IsFileNode(const wxTreeItemId &id) /** Appends subdirs up until root. This is done by finding the root first and going back down to the original caller. This is faster because no copying takes place */ -void wxVirtualDirTreeCtrl::AppendPathRecursively(VdtcTreeItemBase *b, wxFileName &dir, bool useRoot) +void wxVirtualDirTreeCtrl::AppendPathRecursively(VdtcTreeItemBase *b, wxFileName &dir, bool useRoot) { - wxCHECK2(b, return); - + wxCHECK2(b, return); + VdtcTreeItemBase *parent = GetParent(b); if(parent) AppendPathRecursively(parent, dir, useRoot); @@ -570,7 +570,7 @@ void wxVirtualDirTreeCtrl::AppendPathRecursively(VdtcTreeItemBase *b, wxFileName dir.AssignDir(b->GetName()); return; } - + // now we are unwinding the other way around if(b->IsDir()) dir.AppendDir(b->GetName()); @@ -582,7 +582,7 @@ void wxVirtualDirTreeCtrl::AppendPathRecursively(VdtcTreeItemBase *b, wxFileName void wxVirtualDirTreeCtrl::OnExpanding(wxTreeEvent &event) { - + // check for collapsing item, and scan from there wxTreeItemId item = event.GetItem(); if(item.IsOk()) @@ -628,12 +628,22 @@ VdtcTreeItemBase *wxVirtualDirTreeCtrl::AddDirItem(const wxString &name) void wxVirtualDirTreeCtrl::OnAssignIcons(wxImageList &icons) { - icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("document_root"))); - icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("folder"))); - icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("page_white_text"))); - icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("page_white_cplusplus"))); - icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("page_white_c"))); - icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("page_white_h"))); + icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("document_root"))); //0 + icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("folder"))); //1 + icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("page_white_text"))); //2 + icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("page_white_cplusplus")));//3 + icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("page_white_c"))); //4 + icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("page_white_h"))); //5 + icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("executable"))); //6 + icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("file_php"))); //7 + icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("shared_library"))); //8 + icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("pixmap"))); //9 + icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("shellscript"))); //10 + icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("compressed_file"))); //11 + icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("file_xml"))); //12 + icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("file_html"))); //13 + icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("makefile"))); //14 + icons.Add(wxXmlResource::Get()->LoadBitmap(wxT("formbuilder"))); //15 } VdtcTreeItemBase *wxVirtualDirTreeCtrl::OnCreateTreeItem(int type, const wxString &name) diff --git a/Plugin/virtualdirtreectrl.h b/Plugin/virtualdirtreectrl.h index b2d0f5eb59..be91e2f62b 100644 --- a/Plugin/virtualdirtreectrl.h +++ b/Plugin/virtualdirtreectrl.h @@ -1,25 +1,25 @@ ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// // -// copyright : (C) 2008 by Eran Ifrah -// file name : virtualdirtreectrl.h -// +// copyright : (C) 2008 by Eran Ifrah +// file name : virtualdirtreectrl.h +// // ------------------------------------------------------------------------- -// A -// _____ _ _ _ _ -// / __ \ | | | | (_) | -// | / \/ ___ __| | ___| | _| |_ ___ -// | | / _ \ / _ |/ _ \ | | | __/ _ ) -// | \__/\ (_) | (_| | __/ |___| | || __/ -// \____/\___/ \__,_|\___\_____/_|\__\___| -// -// F i l e -// -// 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. -// +// A +// _____ _ _ _ _ +// / __ \ | | | | (_) | +// | / \/ ___ __| | ___| | _| |_ ___ +// | | / _ \ / _ |/ _ \ | | | __/ _ ) +// | \__/\ (_) | (_| | __/ |___| | || __/ +// \____/\___/ \__,_|\___\_____/_|\__\___| +// +// F i l e +// +// 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. +// ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////// @@ -104,6 +104,7 @@ class VdtcTreeItemBase : public wxTreeItemData protected: wxString _name; int _type; + std::map _imgIdx; public: /** Default constructor. Pass the parent of this node as a VdtcTreeItemBase object, the type @@ -129,6 +130,59 @@ class VdtcTreeItemBase : public wxTreeItemData : _name(name) , _type(type) { + _imgIdx[wxT("cpp")] = 3; + _imgIdx[wxT("cxx")] = 3; + _imgIdx[wxT("cc")] = 3; + _imgIdx[wxT("c++")] = 3; + _imgIdx[wxT("c")] = 4; + _imgIdx[wxT("h++")] = 5; + _imgIdx[wxT("hpp")] = 5; + _imgIdx[wxT("h")] = 5; + + // executable + _imgIdx[wxT("exe")] = 6; + + // shared libraris / static libraries + _imgIdx[wxT("php")] = 7; + + // shared libraris / static libraries + _imgIdx[wxT("dylib")] = 8; + _imgIdx[wxT("dll")] = 8; + _imgIdx[wxT("so")] = 8; + _imgIdx[wxT("lib")] = 8; + _imgIdx[wxT("a")] = 8; + + // images + _imgIdx[wxT("png")] = 9; + _imgIdx[wxT("bmp")] = 9; + _imgIdx[wxT("gif")] = 9; + _imgIdx[wxT("xpm")] = 9; + + // scripts + _imgIdx[wxT("sh")] = 10; + _imgIdx[wxT("bat")] = 10; + + // compressed files + _imgIdx[wxT("zip")] = 11; + _imgIdx[wxT("gz")] = 11; + _imgIdx[wxT("tgz")] = 11; + _imgIdx[wxT("tar")] = 11; + _imgIdx[wxT("jar")] = 11; + + // XML files + _imgIdx[wxT("xml")] = 12; + _imgIdx[wxT("xrc")] = 12; + + // HTML files + _imgIdx[wxT("html")] = 13; + _imgIdx[wxT("htm")] = 13; + + // Makefile + _imgIdx[wxT("mk")] = 14; + _imgIdx[wxT("makefile")] = 14; + + // formbuilder files + _imgIdx[wxT("fbp")] = 15; }; /** Default destructor */ @@ -166,15 +220,16 @@ class VdtcTreeItemBase : public wxTreeItemData if(_type == VDTC_TI_FILE){ //return icon id based on the file extension wxString ext = _name.AfterLast(wxT('.')); - if(ext.CmpNoCase(wxT("cpp")) == 0){return 3;} - if(ext.CmpNoCase(wxT("cxx")) == 0){return 3;} - if(ext.CmpNoCase(wxT("cc")) == 0){return 3;} - if(ext.CmpNoCase(wxT("c++")) == 0){return 3;} - if(ext.CmpNoCase(wxT("c")) == 0){return 4;} - if(ext.CmpNoCase(wxT("h++")) == 0){return 5;} - if(ext.CmpNoCase(wxT("hpp")) == 0){return 5;} - if(ext.CmpNoCase(wxT("h")) == 0){return 5;} - return VDTC_ICON_FILE; + ext.MakeLower(); + + std::map::const_iterator iter = _imgIdx.find(ext); + if( iter != _imgIdx.end() ) { + return iter->second; + } else if(_name.CmpNoCase(wxT("makefile")) == 0) { + return 14; + } else { + return VDTC_ICON_FILE; + } } return -1; }; @@ -264,7 +319,7 @@ class wxVirtualDirTreeCtrl : public wxTreeCtrl void SwapItem(VdtcTreeItemBaseArray &items, int a, int b); wxTreeItemId DoFindItemByPath(const wxFileName &path, bool scandirs = true); - + // -- event handlers -- void OnExpanding(wxTreeEvent &event); @@ -272,7 +327,7 @@ class wxVirtualDirTreeCtrl : public wxTreeCtrl protected: /** Inherited virtual function for SortChildren */ int OnCompareItems(const wxTreeItemId& item1, const wxTreeItemId& item2); - + /** * Delete all children of item and rebuild it from disk */ @@ -362,14 +417,14 @@ class wxVirtualDirTreeCtrl : public wxTreeCtrl of every newly created instance of the (inherited) VdtcTreeItemBase class. */ VdtcTreeItemBase *AddDirItem(const wxString &name); - /** Returns parent of the passed VdtcItemBase object. It will fetch the wxTreeItemId of this parent, + /** Returns parent of the passed VdtcItemBase object. It will fetch the wxTreeItemId of this parent, and return the VdtcTreeItemBase parent associated with it. If the associated item is nil, there is no parent, this is most likely the root else an assertion failure occurs */ VdtcTreeItemBase *GetParent(VdtcTreeItemBase *item) const { if(!item){ return NULL; } - + wxTreeItemId p = GetItemParent(item->GetId()); if(p.IsOk()){ return (VdtcTreeItemBase *)GetItemData(p); @@ -381,12 +436,12 @@ class wxVirtualDirTreeCtrl : public wxTreeCtrl /** * \brief find item which holds fullpath * \param fullpath fullpath to search - * \param scandirs whether to search the actual file system (true) + * \param scandirs whether to search the actual file system (true) * or just search the already-loaded tree (false) * \return tree item or invalid incase no match found */ wxTreeItemId GetItemByFullPath(const wxFileName &fullpath, bool scandirs = true); - + // --- handlers --- /** This handler is called when the SetRootPath function is called. This call causes a re-initialisation of @@ -480,7 +535,7 @@ class wxVirtualDirTreeCtrl : public wxTreeCtrl handler, subsequent calls to OnAddFile, OnAddDirectory will be made for every file and directory encountered in this level to be scanned. NOTE: When this scan is veto'd there will be no call to OnDirectoryScanEnd because there was no scan. Also OnAddedItems is not called */ - + virtual bool OnDirectoryScanBegin(const wxFileName &path); /** This handler is called when all files and all directories are scanned in the current dir and iterated in @@ -489,7 +544,7 @@ class wxVirtualDirTreeCtrl : public wxTreeCtrl contains the pointer array of all the items that are in the list, and the path parameter contains the current path investigated. NOTE: If you want to delete an item from the array, delete it with delete operator and remove the pointer from the list. */ - + virtual void OnDirectoryScanEnd(VdtcTreeItemBaseArray &items, const wxFileName &path); /** This handler is called the very moment after all items are added to the tree control. The parent parameter diff --git a/QmakePlugin/qmakeplugin.cpp b/QmakePlugin/qmakeplugin.cpp index 1d7954f1eb..3b6ada3202 100644 --- a/QmakePlugin/qmakeplugin.cpp +++ b/QmakePlugin/qmakeplugin.cpp @@ -317,6 +317,7 @@ void QMakePlugin::OnGetBuildCommand(wxCommandEvent& event) return; } + // we avoid calling event.Skip() to override the default build system by this one event.SetString( DoGetBuildCommand(project, config, event.GetInt() == 1) ); } diff --git a/Runtime/File2Hex.exe b/Runtime/File2Hex.exe index 424a0a57fe..0119dd9b9b 100644 Binary files a/Runtime/File2Hex.exe and b/Runtime/File2Hex.exe differ diff --git a/Runtime/images/splashscreen.png b/Runtime/images/splashscreen.png index d3c1aebca5..6ad943086b 100644 Binary files a/Runtime/images/splashscreen.png and b/Runtime/images/splashscreen.png differ diff --git a/Runtime/le_exec.exe b/Runtime/le_exec.exe index 05d708dcc9..128477ec75 100644 Binary files a/Runtime/le_exec.exe and b/Runtime/le_exec.exe differ diff --git a/Runtime/makedir.exe b/Runtime/makedir.exe index e5c86b077a..fbcb0a8b54 100644 Binary files a/Runtime/makedir.exe and b/Runtime/makedir.exe differ diff --git a/Runtime/pack_wx.bat b/Runtime/pack_wx.bat index 86c8993db1..868500d240 100644 --- a/Runtime/pack_wx.bat +++ b/Runtime/pack_wx.bat @@ -1,5 +1,5 @@ @echo off -if not exist wxWidgets-2.8.7 mkdir wxWidgets-2.8.7 -xcopy C:\wxWidgets-2.8.7\lib\gcc_dll\* "wxWidgets-2.8.7\lib\gcc_dll\" /E /I /H /Y -xcopy C:\wxWidgets-2.8.7\include\* "wxWidgets-2.8.7\include\" /E /I /H /Y -xcopy C:\wxWidgets-2.8.7\build\msw\config.gcc "wxWidgets-2.8.7\build\msw\config.gcc" /Y +if not exist wxWidgets-2.8.10 mkdir wxWidgets-2.8.10 +xcopy C:\wxWidgets-2.8.10\lib\gcc_dll\* "wxWidgets-2.8.10\lib\gcc_dll\" /E /I /H /Y +xcopy C:\wxWidgets-2.8.10\include\* "wxWidgets-2.8.10\include\" /E /I /H /Y +xcopy C:\wxWidgets-2.8.10\build\msw\config.gcc "wxWidgets-2.8.10\build\msw\config.gcc" /Y diff --git a/Runtime/update.bat b/Runtime/update.bat index 9fb84ea8dd..7a4d255677 100644 --- a/Runtime/update.bat +++ b/Runtime/update.bat @@ -22,5 +22,5 @@ copy CodeLite.exe "%ProgramFiles%\CodeLite\" /Y copy patch.exe "%ProgramFiles%\CodeLite\" /Y copy astyle.sample "%ProgramFiles%\CodeLite\" /Y copy ..\sdk\wxconfig\wx-config.exe "%ProgramFiles%\CodeLite\" /Y -copy ..\sdk\curl\lib\libcurl-4.dll "%ProgramFiles%\CodeLite\" /Y -copy ..\sdk\curl\lib\libcurl-4.dll . /Y +:: copy ..\sdk\curl\lib\libcurl-4.dll "%ProgramFiles%\CodeLite\" /Y +:: copy ..\sdk\curl\lib\libcurl-4.dll . /Y diff --git a/Subversion/subversion.cpp b/Subversion/subversion.cpp index c7038217e5..120f9b372d 100644 --- a/Subversion/subversion.cpp +++ b/Subversion/subversion.cpp @@ -52,6 +52,7 @@ #include "dirsaver.h" #include #include "custom_tabcontainer.h" +#include "overlaytool.h" int ProjectConflictIconId = wxNOT_FOUND; int ProjectModifiedIconId = wxNOT_FOUND; @@ -192,32 +193,41 @@ SubversionPlugin::SubversionPlugin(IManager *manager) //IMPORTANT! //note that the order the images are added is important !! //do not change it - ProjectOkIconId = tree->GetImageList()->Add(wxXmlResource::Get()->LoadBitmap(wxT("project_ok"))); - ProjectModifiedIconId = tree->GetImageList()->Add(wxXmlResource::Get()->LoadBitmap(wxT("project_modified"))); - ProjectConflictIconId = tree->GetImageList()->Add(wxXmlResource::Get()->LoadBitmap(wxT("project_conflict"))); - WorkspaceOkIconId = tree->GetImageList()->Add(wxXmlResource::Get()->LoadBitmap(wxT("workspace_ok"))); - WorkspaceModifiedIconId = tree->GetImageList()->Add(wxXmlResource::Get()->LoadBitmap(wxT("workspace_modified"))); - WorkspaceConflictIconId = tree->GetImageList()->Add(wxXmlResource::Get()->LoadBitmap(wxT("workspace_conflict"))); - FileOkIconId = tree->GetImageList()->Add(wxXmlResource::Get()->LoadBitmap(wxT("page_ok"))); - FileModifiedIconId = tree->GetImageList()->Add(wxXmlResource::Get()->LoadBitmap(wxT("page_modified"))); - FileConflictIconId = tree->GetImageList()->Add(wxXmlResource::Get()->LoadBitmap(wxT("page_conflict"))); + // User the OverlayTool to add overlay icons on top of the base images + wxBitmap base_icon; + base_icon = wxXmlResource::Get()->LoadBitmap(wxT("project")); - FolderOkIconId = tree->GetImageList()->Add(wxXmlResource::Get()->LoadBitmap(wxT("folder_ok"))); - FolderModifiedIconId = tree->GetImageList()->Add(wxXmlResource::Get()->LoadBitmap(wxT("folder_modified"))); - FolderConflictIconId = tree->GetImageList()->Add(wxXmlResource::Get()->LoadBitmap(wxT("folder_conflict"))); + ProjectOkIconId = tree->GetImageList()->Add( OverlayTool::Get().AddOKIcon( base_icon ) ); + ProjectModifiedIconId = tree->GetImageList()->Add( OverlayTool::Get().AddModifiedIcon( base_icon ) ); + ProjectConflictIconId = tree->GetImageList()->Add( OverlayTool::Get().AddConflictIcon( base_icon ) ); + + base_icon = wxXmlResource::Get()->LoadBitmap(wxT("workspace")); + + WorkspaceOkIconId = tree->GetImageList()->Add( OverlayTool::Get().AddOKIcon( base_icon ) ); + WorkspaceModifiedIconId = tree->GetImageList()->Add( OverlayTool::Get().AddModifiedIcon( base_icon ) ); + WorkspaceConflictIconId = tree->GetImageList()->Add( OverlayTool::Get().AddConflictIcon( base_icon ) ); + + base_icon = wxXmlResource::Get()->LoadBitmap(wxT("page_white_text")); + + FileOkIconId = tree->GetImageList()->Add( OverlayTool::Get().AddOKIcon( base_icon ) ); + FileModifiedIconId = tree->GetImageList()->Add( OverlayTool::Get().AddModifiedIcon( base_icon ) ); + FileConflictIconId = tree->GetImageList()->Add( OverlayTool::Get().AddConflictIcon( base_icon ) ); + + base_icon = wxXmlResource::Get()->LoadBitmap(wxT("folder")); + + FolderOkIconId = tree->GetImageList()->Add( OverlayTool::Get().AddOKIcon( base_icon ) ); + FolderModifiedIconId = tree->GetImageList()->Add( OverlayTool::Get().AddModifiedIcon( base_icon ) ); + FolderConflictIconId = tree->GetImageList()->Add( OverlayTool::Get().AddConflictIcon( base_icon ) ); // wxFormBuilder support - wxBitmap wxfb_ok, wxfb_modified, wxfb_conflict; + base_icon = wxXmlResource::Get()->LoadBitmap(wxT("formbuilder")); - wxfb_ok = LoadBitmapFile(wxT("wxfb_ok.png")); - wxfb_modified = LoadBitmapFile(wxT("wxfb_modified.png")); - wxfb_conflict = LoadBitmapFile(wxT("wxfb_conflict.png")); + wxFBOkIconId = tree->GetImageList()->Add( OverlayTool::Get().AddOKIcon( base_icon ) ); + wxFBModifiedIconId = tree->GetImageList()->Add( OverlayTool::Get().AddModifiedIcon( base_icon ) ); + wxFBConflictIconId = tree->GetImageList()->Add( OverlayTool::Get().AddConflictIcon( base_icon ) ); - wxFBConflictIconId = tree->GetImageList()->Add(wxfb_conflict); - wxFBOkIconId = tree->GetImageList()->Add(wxfb_ok); - wxFBModifiedIconId = tree->GetImageList()->Add(wxfb_modified); } } @@ -438,6 +448,7 @@ void SubversionPlugin::OnRevertFile(wxCommandEvent &e) IEditor *editor = m_mgr->GetActiveEditor(); if (editor) { m_svn->RevertFile(editor->GetFileName(), new RevertPostCmdAction(m_mgr)); + DoRefreshIcons(); } } @@ -453,6 +464,7 @@ void SubversionPlugin::OnRevert(wxCommandEvent &e) VALIDATE_SVNPATH(); wxUnusedVar(e); m_svn->Revert(); + DoRefreshIcons(); } void SubversionPlugin::OnShowSvnStatus_FileExplorer(wxCommandEvent &event) diff --git a/SymbolView/symbolview.cpp b/SymbolView/symbolview.cpp index e8aa22137b..8bc87d380d 100644 --- a/SymbolView/symbolview.cpp +++ b/SymbolView/symbolview.cpp @@ -452,7 +452,7 @@ void SymbolViewPlugin::GetFiles(const wxFileName &path, std::multimap + diff --git a/about.html b/about.html index 4e710ea6c8..eedd8dd7a3 100644 --- a/about.html +++ b/about.html @@ -3,13 +3,13 @@ - +
Developers
Eran IfrahProject admin and core developer.
Scott DolimCore developer.
 
Contributers / Special thanks
David HartLinux 64bit, rpm packaging, patches
Frank LichtnerSnipWiz plugin developer
Jacek KucharskiUnicode and Multibyte support
Marianne GagnonMac PPC packaging and initial porter to Mac OS X
Scott DolimVarious improvements / bug fixes
diff --git a/le_exec/le_exec.project b/le_exec/le_exec.project index 9db62fe0e3..f91020e1b8 100644 --- a/le_exec/le_exec.project +++ b/le_exec/le_exec.project @@ -14,18 +14,16 @@ - - - - + + + + None - + - - - - + + @@ -38,20 +36,19 @@ - - - - + + + + None - + - - - - + + + diff --git a/sdk/wxscintilla/include/wx/wxscintilla.h b/sdk/wxscintilla/include/wx/wxscintilla.h index 4ca3d7e479..5115ebcf4e 100644 --- a/sdk/wxscintilla/include/wx/wxscintilla.h +++ b/sdk/wxscintilla/include/wx/wxscintilla.h @@ -3357,20 +3357,31 @@ class WXDLLIMPEXP_SCI wxScintilla : public wxControl { // Returns the current UseAntiAliasing setting. bool GetUseAntiAliasing(); - // ERAN IFRAH + // [PATCH] Starts void SetScrollWidthTracking(bool tracking); bool GetScrollWidthTracking(); - + // Modern indicators - void SetIndicatorCurrent(int indicator); - int GetIndicatorCurrent(); - int IndicatorValueAt(int indicator, int position); - void IndicatorFillRange(int position, int len); - void IndicatorClearRange(int position, int len); - int IndicatorStart(int indicator, int position); - int IndicatorEnd(int indicator, int position); - void IndicatorSetUnder(int indicator, bool under); - // ERAN IFRAH - END + void SetIndicatorCurrent(int indicator); + int GetIndicatorCurrent(); + int IndicatorValueAt(int indicator, int position); + void IndicatorFillRange(int position, int len); + void IndicatorClearRange(int position, int len); + int IndicatorStart(int indicator, int position); + int IndicatorEnd(int indicator, int position); + void IndicatorSetUnder(int indicator, bool under); + void IndicatorSetAlpha(int indicatorNumber, int alpha); + int IndicatorGetAlpha(int indicatorNumber); + void AnnotationSetText(int line, const wxString &text); + wxString AnnotationGetText(int line); + void AnnotationSetStyle(int line, int style); + int AnnotationGetStyle(int line); + void AnnotationClearAll(); + void AnnotationSetVisible(int visible); + bool AnnotationGetVisible(); + void AnnotationSetStyleOffset(int style); + void AnnotationSetStyles(int line, const wxMemoryBuffer &styles); + // [PATCH] END #if wxCHECK_VERSION(2, 5, 0) // The following methods are nearly equivallent to their similarly named diff --git a/sdk/wxscintilla/src/PlatWX.cpp b/sdk/wxscintilla/src/PlatWX.cpp index eb34e14752..454e0a00ba 100644 --- a/sdk/wxscintilla/src/PlatWX.cpp +++ b/sdk/wxscintilla/src/PlatWX.cpp @@ -126,7 +126,7 @@ void Palette::Allocate(Window &) Font::Font() { - id = 0; + fid = 0; ascent = 0; } @@ -155,15 +155,15 @@ void Font::Create (const char *faceName, int characterSet, int size, sci2wx(faceName), encoding); font->SetNoAntiAliasing (!extraFontFlag); - id = font; + fid = font; } void Font::Release() { - if (id) - delete (wxFont*)id; - id = 0; + if (fid) + delete (wxFont*)fid; + fid = 0; } //---------------------------------------------------------------------- @@ -290,12 +290,20 @@ bool SurfaceImpl::Initialised() void SurfaceImpl::PenColour(ColourAllocated fore) { - hdc->SetPen(wxPen(wxColourFromCA(fore), 1, wxSOLID)); + if( fore.AsLong() == -1 ) { + hdc->SetPen( *wxTRANSPARENT_PEN ); + } else { + hdc->SetPen(wxPen(wxColourFromCA(fore), 1, wxSOLID)); + } } void SurfaceImpl::BrushColour(ColourAllocated back) { - hdc->SetBrush(wxBrush(wxColourFromCA(back), wxSOLID)); + if( back.AsLong() == -1 ) { + hdc->SetBrush( *wxTRANSPARENT_BRUSH ); + } else { + hdc->SetBrush(wxBrush(wxColourFromCA(back), wxSOLID)); + } } void SurfaceImpl::SetFont(Font &font_) @@ -700,29 +708,29 @@ Window::~Window() void Window::Destroy() { - if (id) { + if (wid) { Show(false); - GETWIN(id)->Destroy(); + GETWIN(wid)->Destroy(); } - id = 0; + wid = 0; } bool Window::HasFocus() { - return wxWindow::FindFocus() == GETWIN(id); + return wxWindow::FindFocus() == GETWIN(wid); } PRectangle Window::GetPosition() { - if (! id) return PRectangle(); - wxRect rc(GETWIN(id)->GetPosition(), GETWIN(id)->GetSize()); + if (! wid) return PRectangle(); + wxRect rc(GETWIN(wid)->GetPosition(), GETWIN(wid)->GetSize()); return PRectangleFromwxRect(rc); } void Window::SetPosition(PRectangle rc) { wxRect r = wxRectFromPRectangle(rc); - GETWIN(id)->SetSize(r); + GETWIN(wid)->SetSize(r); } void Window::SetPositionRelative(PRectangle rc, Window) @@ -732,30 +740,30 @@ void Window::SetPositionRelative(PRectangle rc, Window) PRectangle Window::GetClientPosition() { - if (! id) return PRectangle(); - wxSize sz = GETWIN(id)->GetClientSize(); + if (! wid) return PRectangle(); + wxSize sz = GETWIN(wid)->GetClientSize(); return PRectangle(0, 0, sz.x, sz.y); } void Window::Show(bool show) { - GETWIN(id)->Show(show); + GETWIN(wid)->Show(show); } void Window::InvalidateAll() { - GETWIN(id)->Refresh(false); + GETWIN(wid)->Refresh(false); } void Window::InvalidateRectangle(PRectangle rc) { wxRect r = wxRectFromPRectangle(rc); - GETWIN(id)->Refresh(false, &r); + GETWIN(wid)->Refresh(false, &r); } void Window::SetFont(Font &font) { - GETWIN(id)->SetFont(*((wxFont*)font.GetID())); + GETWIN(wid)->SetFont(*((wxFont*)font.GetID())); } void Window::SetCursor(Cursor curs) @@ -799,7 +807,7 @@ void Window::SetCursor(Cursor curs) wxCursor wc = wxCursor(cursorId) ; #endif if (curs != cursorLast) { - GETWIN(id)->SetCursor(wc); + GETWIN(wid)->SetCursor(wc); cursorLast = curs; } } @@ -807,7 +815,7 @@ void Window::SetCursor(Cursor curs) void Window::SetTitle (const char *s) { - GETWIN(id)->SetLabel (sci2wx(s)); + GETWIN(wid)->SetLabel (sci2wx(s)); } PRectangle Window::GetMonitorRect(Point pt) @@ -1185,7 +1193,7 @@ ListBoxImpl::~ListBoxImpl() { void ListBoxImpl::SetFont(Font &font) { - GETLB(id)->SetFont(*((wxFont*)font.GetID())); + GETLB(wid)->SetFont(*((wxFont*)font.GetID())); } @@ -1194,8 +1202,8 @@ void ListBoxImpl::Create (Window &parent, int ctrlID, Point location_, lineHeight = lineHeight_; unicodeMode = unicodeMode_; maxStrWidth = 0; - id = new wxSCIListBoxWin (GETWIN(parent.GetID()), ctrlID, location_); - if (imgList != NULL) GETLB(id)->SetImageList (imgList, wxIMAGE_LIST_SMALL); + wid = new wxSCIListBoxWin (GETWIN(parent.GetID()), ctrlID, location_); + if (imgList != NULL) GETLB(wid)->SetImageList (imgList, wxIMAGE_LIST_SMALL); } @@ -1223,15 +1231,15 @@ PRectangle ListBoxImpl::GetDesiredRect() { // give it a default if there are no lines, and/or add a bit more if (maxw == 0) maxw = 100; maxw += aveCharWidth * 3 + - GETLBW(id)->IconWidth() + wxSystemSettings::GetMetric(wxSYS_VSCROLL_X); + GETLBW(wid)->IconWidth() + wxSystemSettings::GetMetric(wxSYS_VSCROLL_X); if (maxw > 600) maxw = 600; // estimate a desired height - int count = GETLB(id)->GetItemCount(); + int count = GETLB(wid)->GetItemCount(); if (count) { wxRect rect; - GETLB(id)->GetItemRect(0, rect); + GETLB(wid)->GetItemRect(0, rect); maxh = count * rect.GetHeight(); if (maxh > 140) // TODO: Use desiredVisibleRows?? maxh = 140; @@ -1252,12 +1260,12 @@ PRectangle ListBoxImpl::GetDesiredRect() { int ListBoxImpl::CaretFromEdge() { - return 4 + GETLBW(id)->IconWidth(); + return 4 + GETLBW(wid)->IconWidth(); } void ListBoxImpl::Clear() { - GETLB(id)->DeleteAllItems(); + GETLB(wid)->DeleteAllItems(); } @@ -1265,20 +1273,20 @@ void ListBoxImpl::Append(char *s, int type) { Append(sci2wx(s), type); } void ListBoxImpl::Append(const wxString& text, int type) { - long count = GETLB(id)->GetItemCount(); - long itemID = GETLB(id)->InsertItem(count, wxEmptyString); - GETLB(id)->SetItem(itemID, 1, text); + long count = GETLB(wid)->GetItemCount(); + long itemID = GETLB(wid)->InsertItem(count, wxEmptyString); + GETLB(wid)->SetItem(itemID, 1, text); maxStrWidth = wxMax(maxStrWidth, text.length()); if (type != -1) { wxCHECK_RET(imgTypeMap, wxT("Unexpected NULL imgTypeMap")); long idx = imgTypeMap->Item(type); - GETLB(id)->SetItemImage(itemID, idx, idx); + GETLB(wid)->SetItemImage(itemID, idx, idx); } } int ListBoxImpl::Length() { - return GETLB(id)->GetItemCount(); + return GETLB(wid)->GetItemCount(); } @@ -1288,13 +1296,13 @@ void ListBoxImpl::Select(int n) { n = 0; select = false; } - GETLB(id)->Focus(n); - GETLB(id)->Select(n, select); + GETLB(wid)->Focus(n); + GETLB(wid)->Select(n, select); } int ListBoxImpl::GetSelection() { - return GETLB(id)->GetFirstSelected(); + return GETLB(wid)->GetFirstSelected(); } @@ -1309,7 +1317,7 @@ void ListBoxImpl::GetValue(int n, char *value, int len) { item.SetId(n); item.SetColumn(1); item.SetMask(wxLIST_MASK_TEXT); - GETLB(id)->GetItem(item); + GETLB(wid)->GetItem(item); strncpy(value, wx2sci(item.GetText()), len); value[len-1] = '\0'; } @@ -1346,16 +1354,16 @@ void ListBoxImpl::ClearRegisteredImages() { delete imgTypeMap; imgTypeMap = NULL; } - if (id) GETLB(id)->SetImageList(NULL, wxIMAGE_LIST_SMALL); + if (wid) GETLB(wid)->SetImageList(NULL, wxIMAGE_LIST_SMALL); } void ListBoxImpl::SetDoubleClickAction(CallBackAction action, void *data) { - GETLBW(id)->SetDoubleClickAction(action, data); + GETLBW(wid)->SetDoubleClickAction(action, data); } void ListBoxImpl::SetList(const char* list, char separator, char typesep) { - GETLB(id)->Freeze(); + GETLB(wid)->Freeze(); Clear(); wxStringTokenizer tkzr(sci2wx(list), (wxChar)separator); while (tkzr.HasMoreTokens()) { @@ -1368,7 +1376,7 @@ void ListBoxImpl::SetList(const char* list, char separator, char typesep) { } Append (token, (int)type); } - GETLB(id)->Thaw(); + GETLB(wid)->Thaw(); } @@ -1388,26 +1396,26 @@ namespace Scintilla { //---------------------------------------------------------------------- -Menu::Menu() : id(0) +Menu::Menu() : mid(0) { } void Menu::CreatePopUp() { Destroy(); - id = new wxMenu(); + mid = new wxMenu(); } void Menu::Destroy() { - if (id) - delete (wxMenu*)id; - id = 0; + if (mid) + delete (wxMenu*)mid; + mid = 0; } void Menu::Show(Point pt, Window &w) { - GETWIN(w.GetID())->PopupMenu((wxMenu*)id, pt.x - 4, pt.y); + GETWIN(w.GetID())->PopupMenu((wxMenu*)mid, pt.x - 4, pt.y); Destroy(); } diff --git a/sdk/wxscintilla/src/ScintillaWX.cpp b/sdk/wxscintilla/src/ScintillaWX.cpp index 7eb1c39b0b..2d20f81799 100644 --- a/sdk/wxscintilla/src/ScintillaWX.cpp +++ b/sdk/wxscintilla/src/ScintillaWX.cpp @@ -308,15 +308,12 @@ void ScintillaWX::DoStartDrag() { if (dragText.Length()) { wxDropSource source(sci); wxTextDataObject data(dragText); - wxDragResult result; - source.SetData(data); - dropWentOutside = true; + inDragDrop = ddDragging; - result = source.DoDragDrop(wxDrag_DefaultMove); - if (result == wxDragMove && dropWentOutside) ClearSelection(); - inDragDrop = ddNone; // [CHANGED] - SetDragPosition (invalidPosition); + source.DoDragDrop(wxDrag_DefaultMove); + inDragDrop = ddNone; + SetDragPosition (SelectionPosition(invalidPosition)); } pdoc->EndUndoAction(); #endif @@ -489,7 +486,7 @@ void ScintillaWX::CancelModes() { void ScintillaWX::Copy() { - if (currentPos != anchor) { + if ( !sel.Empty() ) { SelectionText st; CopySelectionRange(&st); #ifdef __WXGTK__ @@ -510,27 +507,51 @@ void ScintillaWX::Paste() { #if wxUSE_DATAOBJ wxTextDataObject data; - bool gotData = false; + wxString textString; + + wxWX2MBbuf buf; + int len = 0; + bool rectangular = false; if (wxTheClipboard->Open()) { wxTheClipboard->UsePrimarySelection(false); - gotData = wxTheClipboard->GetData(data); + wxCustomDataObject selData(wxDataFormat(wxString(wxT("application/x-cbrectdata")))); + bool gotRectData = wxTheClipboard->GetData(selData); + + if (gotRectData && selData.GetSize()>1) { + const char* rectBuf = (const char*)selData.GetData(); + rectangular = rectBuf[0] == (char)1; + len = selData.GetDataSize()-1; + char* buffer = new char[len]; + memcpy (buffer, rectBuf+1, len); + textString = sci2wx(buffer, len); + delete [] buffer; + } else { + bool gotData = wxTheClipboard->GetData(data); + if (gotData) { + textString = wxTextBuffer::Translate (data.GetText(), + wxConvertEOLMode(pdoc->eolMode)); + } + } + data.SetText(wxEmptyString); // free the data object content wxTheClipboard->Close(); } - if (gotData) { - wxString text = wxTextBuffer::Translate(data.GetText(), - wxConvertEOLMode(pdoc->eolMode)); - wxWX2MBbuf buf = (wxWX2MBbuf) wx2sci (text); -#if wxUSE_UNICODE - // free up the old character buffer in case the text is real big - data.SetText(wxEmptyString); - text = wxEmptyString; -#endif - int len = strlen(buf); - pdoc->InsertString(currentPos, buf, len); - SetEmptySelection(currentPos + len); + buf = (wxWX2MBbuf)wx2sci(textString); + len = strlen(buf); + int newPos = 0; + int caretMain = sel.MainCaret(); + if (rectangular) { + SelectionPosition selStart = sel.Range(sel.Main()).Start(); + int newLine = pdoc->LineFromPosition (caretMain) + wxCountLines (buf, pdoc->eolMode); + int newCol = pdoc->GetColumn(caretMain); + PasteRectangular (selStart, buf, len); + newPos = pdoc->FindColumn (newLine, newCol); + } else { + pdoc->InsertString (caretMain, buf, len); + newPos = caretMain + len; } + SetEmptySelection (newPos); #endif // wxUSE_DATAOBJ pdoc->EndUndoAction(); @@ -540,17 +561,27 @@ void ScintillaWX::Paste() { void ScintillaWX::CopyToClipboard (const SelectionText& st) { - wxString textToCopy(wxEmptyString); #if wxUSE_CLIPBOARD if (wxTheClipboard->Open()) { wxTheClipboard->UsePrimarySelection(false); - textToCopy = wxTextBuffer::Translate(sci2wx(st.s, st.len-1)); - if (!wxTheClipboard->SetData(new wxTextDataObject(textToCopy))) { - //wxPrintf(wxT("Failed to insert data %s to clipboard"), textToCopy.GetData()); - } + wxString text = wxTextBuffer::Translate (sci2wx(st.s, st.len-1)); + + // composite object will hold "plain text" for pasting in other programs and a custom + // object for local use that remembers what kind of selection was made (stream or + // rectangular). + wxDataObjectComposite* obj = new wxDataObjectComposite(); + wxCustomDataObject* rectData = new wxCustomDataObject (wxDataFormat(wxString(wxT("application/x-cbrectdata")))); + + char* buffer = new char[st.len+1]; + buffer[0] = (st.rectangular)? (char)1 : (char)0; + memcpy (buffer+1, st.s, st.len); + rectData->SetData (st.len+1, buffer); + delete [] buffer; + + obj->Add (rectData, true); + obj->Add (new wxTextDataObject (text)); + wxTheClipboard->SetData (obj); wxTheClipboard->Close(); - }else{ - wxPrintf(wxT("Failed to open the clipboard")); } #else wxUnusedVar(st); @@ -632,7 +663,7 @@ void ScintillaWX::UpdateSystemCaret() { DestroySystemCaret(); CreateSystemCaret(); } - Point pos = LocationFromPosition(currentPos); + Point pos = LocationFromPosition(sel.MainCaret()); #if wxCHECK_VERSION(2, 5, 0) ::SetCaretPos(pos.x, pos.y); #endif @@ -719,7 +750,7 @@ long ScintillaWX::WndProc(unsigned int iMessage, unsigned long wParam, long lPar pt.y += vs.lineHeight; int ctStyle = ct.UseStyleCallTip() ? STYLE_CALLTIP : STYLE_DEFAULT; - PRectangle rc = ct.CallTipStart(currentPos, pt, + PRectangle rc = ct.CallTipStart(sel.MainCaret(), pt, defn, vs.styles[ctStyle].fontName, vs.styles[ctStyle].sizeZoomed, @@ -893,7 +924,7 @@ void ScintillaWX::DoLeftButtonUp(Point pt, unsigned int curTime, bool ctrl) { #if wxUSE_DRAG_AND_DROP if (startDragTimer->IsRunning()) { startDragTimer->Stop(); - SetDragPosition(invalidPosition); + SetDragPosition(SelectionPosition(invalidPosition)); SetEmptySelection(PositionFromLocation(pt)); ShowCaretAtCurrentPosition(); } @@ -909,7 +940,7 @@ void ScintillaWX::DoMiddleButtonUp(Point pt) { // Set the current position to the mouse click point and // then paste in the PRIMARY selection, if any. wxGTK only. int newPos = PositionFromLocation(pt); - MovePositionTo(newPos, noSel, true); + MovePositionTo(newPos, Selection::noSel, true); pdoc->BeginUndoAction(); wxTextDataObject data; @@ -926,8 +957,8 @@ void ScintillaWX::DoMiddleButtonUp(Point pt) { data.SetText(wxEmptyString); // free the data object content wxWX2MBbuf buf = (wxWX2MBbuf)wx2sci(text); int len = strlen(buf); - pdoc->InsertString(currentPos, buf, len); - SetEmptySelection(currentPos + len); + pdoc->InsertString(sel.MainCaret(), buf, len); + SetEmptySelection(sel.MainCaret() + len); } pdoc->EndUndoAction(); NotifyChange(); @@ -1068,7 +1099,7 @@ void ScintillaWX::DoOnIdle(wxIdleEvent& evt) { #if wxUSE_DRAG_AND_DROP bool ScintillaWX::DoDropText(long x, long y, const wxString& data) { - SetDragPosition(invalidPosition); + SetDragPosition(SelectionPosition(invalidPosition)); wxString text = wxTextBuffer::Translate (data, wxConvertEOLMode(pdoc->eolMode)); @@ -1084,7 +1115,7 @@ bool ScintillaWX::DoDropText(long x, long y, const wxString& data) { dragResult = evt.GetDragResult(); if (dragResult == wxDragMove || dragResult == wxDragCopy) { - DropAt(evt.GetPosition(), + DropAt( SelectionPosition(evt.GetPosition()), wx2sci(evt.GetDragText()), dragResult == wxDragMove, dragRectangle); @@ -1101,7 +1132,7 @@ wxDragResult ScintillaWX::DoDragEnter(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxDragResult ScintillaWX::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) { - SetDragPosition(PositionFromLocation(Point(x, y))); + SetDragPosition(SelectionPosition( PositionFromLocation(Point(x, y)) ) ); // Send an event to allow the drag result to be changed wxScintillaEvent evt(wxEVT_SCI_DRAG_OVER, sci->GetId()); @@ -1118,7 +1149,7 @@ wxDragResult ScintillaWX::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) { void ScintillaWX::DoDragLeave() { - SetDragPosition(invalidPosition); + SetDragPosition(SelectionPosition(invalidPosition)); } #endif //---------------------------------------------------------------------- diff --git a/sdk/wxscintilla/src/ScintillaWX.h b/sdk/wxscintilla/src/ScintillaWX.h index 706d33a832..2aef4a5736 100644 --- a/sdk/wxscintilla/src/ScintillaWX.h +++ b/sdk/wxscintilla/src/ScintillaWX.h @@ -17,6 +17,7 @@ #ifndef __ScintillaWX_h__ #define __ScintillaWX_h__ // [CHANGED] BEGIN +#include #include #include #include @@ -47,9 +48,11 @@ #include "CharClassify.h" #include "Decoration.h" #include "Document.h" +#include "Selection.h" #include "PositionCache.h" #include "Editor.h" #include "SString.h" +#include "PropSetSimple.h" #include "ScintillaBase.h" #include #include diff --git a/sdk/wxscintilla/src/scintilla/include/Face.py b/sdk/wxscintilla/src/scintilla/include/Face.py index 59ada3dce3..52c9b8d0c1 100644 --- a/sdk/wxscintilla/src/scintilla/include/Face.py +++ b/sdk/wxscintilla/src/scintilla/include/Face.py @@ -1,107 +1,110 @@ -# Module for reading and parsing Scintilla.iface file -import string - -def sanitiseLine(line): - if line[-1:] == '\n': line = line[:-1] - if string.find(line, "##") != -1: - line = line[:string.find(line, "##")] - line = string.strip(line) - return line - -def decodeFunction(featureVal): - retType, rest = string.split(featureVal, " ", 1) - nameIdent, params = string.split(rest, "(") - name, value = string.split(nameIdent, "=") - params, rest = string.split(params, ")") - param1, param2 = string.split(params, ",")[0:2] - return retType, name, value, param1, param2 - -def decodeEvent(featureVal): - retType, rest = string.split(featureVal, " ", 1) - nameIdent, params = string.split(rest, "(") - name, value = string.split(nameIdent, "=") - return retType, name, value - -def decodeParam(p): - param = string.strip(p) - type = "" - name = "" - value = "" - if " " in param: - type, nv = string.split(param, " ") - if "=" in nv: - name, value = string.split(nv, "=") - else: - name = nv - return type, name, value - -class Face: - - def __init__(self): - self.order = [] - self.features = {} - self.values = {} - self.events = {} - - def ReadFromFile(self, name): - currentCategory = "" - currentComment = [] - currentCommentFinished = 0 - file = open(name) - for line in file.readlines(): - line = sanitiseLine(line) - if line: - if line[0] == "#": - if line[1] == " ": - if currentCommentFinished: - currentComment = [] - currentCommentFinished = 0 - currentComment.append(line[2:]) - else: - currentCommentFinished = 1 - featureType, featureVal = string.split(line, " ", 1) - if featureType in ["fun", "get", "set"]: - retType, name, value, param1, param2 = decodeFunction(featureVal) - p1 = decodeParam(param1) - p2 = decodeParam(param2) - self.features[name] = { - "FeatureType": featureType, - "ReturnType": retType, - "Value": value, - "Param1Type": p1[0], "Param1Name": p1[1], "Param1Value": p1[2], - "Param2Type": p2[0], "Param2Name": p2[1], "Param2Value": p2[2], - "Category": currentCategory, "Comment": currentComment - } - if self.values.has_key(value): - raise "Duplicate value " + value + " " + name - self.values[value] = 1 - self.order.append(name) - elif featureType == "evt": - retType, name, value = decodeEvent(featureVal) - self.features[name] = { - "FeatureType": featureType, - "ReturnType": retType, - "Value": value, - "Category": currentCategory, "Comment": currentComment - } - if self.events.has_key(value): - raise "Duplicate event " + value + " " + name - self.events[value] = 1 - self.order.append(name) - elif featureType == "cat": - currentCategory = featureVal - elif featureType == "val": - name, value = string.split(featureVal, "=", 1) - self.features[name] = { - "FeatureType": featureType, - "Category": currentCategory, - "Value": value } - self.order.append(name) - elif featureType == "enu" or featureType == "lex": - name, value = string.split(featureVal, "=", 1) - self.features[name] = { - "FeatureType": featureType, - "Category": currentCategory, - "Value": value } - self.order.append(name) - +# Module for reading and parsing Scintilla.iface file + +def sanitiseLine(line): + if line[-1:] == '\n': line = line[:-1] + if line.find("##") != -1: + line = line[:line.find("##")] + line = line.strip() + return line + +def decodeFunction(featureVal): + retType, rest = featureVal.split(" ", 1) + nameIdent, params = rest.split("(") + name, value = nameIdent.split("=") + params, rest = params.split(")") + param1, param2 = params.split(",")[0:2] + return retType, name, value, param1, param2 + +def decodeEvent(featureVal): + retType, rest = featureVal.split(" ", 1) + nameIdent, params = rest.split("(") + name, value = nameIdent.split("=") + return retType, name, value + +def decodeParam(p): + param = p.strip() + type = "" + name = "" + value = "" + if " " in param: + type, nv = param.split(" ") + if "=" in nv: + name, value = nv.split("=") + else: + name = nv + return type, name, value + +class Face: + + def __init__(self): + self.order = [] + self.features = {} + self.values = {} + self.events = {} + + def ReadFromFile(self, name): + currentCategory = "" + currentComment = [] + currentCommentFinished = 0 + file = open(name) + for line in file.readlines(): + line = sanitiseLine(line) + if line: + if line[0] == "#": + if line[1] == " ": + if currentCommentFinished: + currentComment = [] + currentCommentFinished = 0 + currentComment.append(line[2:]) + else: + currentCommentFinished = 1 + featureType, featureVal = line.split(" ", 1) + if featureType in ["fun", "get", "set"]: + retType, name, value, param1, param2 = decodeFunction(featureVal) + p1 = decodeParam(param1) + p2 = decodeParam(param2) + self.features[name] = { + "FeatureType": featureType, + "ReturnType": retType, + "Value": value, + "Param1Type": p1[0], "Param1Name": p1[1], "Param1Value": p1[2], + "Param2Type": p2[0], "Param2Name": p2[1], "Param2Value": p2[2], + "Category": currentCategory, "Comment": currentComment + } + if value in self.values: + raise "Duplicate value " + value + " " + name + self.values[value] = 1 + self.order.append(name) + elif featureType == "evt": + retType, name, value = decodeEvent(featureVal) + self.features[name] = { + "FeatureType": featureType, + "ReturnType": retType, + "Value": value, + "Category": currentCategory, "Comment": currentComment + } + if value in self.events: + raise "Duplicate event " + value + " " + name + self.events[value] = 1 + self.order.append(name) + elif featureType == "cat": + currentCategory = featureVal + elif featureType == "val": + try: + name, value = featureVal.split("=", 1) + except ValueError: + print("Failure %s" % featureVal) + raise + self.features[name] = { + "FeatureType": featureType, + "Category": currentCategory, + "Value": value } + self.order.append(name) + elif featureType == "enu" or featureType == "lex": + name, value = featureVal.split("=", 1) + self.features[name] = { + "FeatureType": featureType, + "Category": currentCategory, + "Value": value } + self.order.append(name) + diff --git a/sdk/wxscintilla/src/scintilla/include/HFacer.py b/sdk/wxscintilla/src/scintilla/include/HFacer.py index eacffe5630..62a8273263 100644 --- a/sdk/wxscintilla/src/scintilla/include/HFacer.py +++ b/sdk/wxscintilla/src/scintilla/include/HFacer.py @@ -1,76 +1,75 @@ -# HFacer.py - regenerate the Scintilla.h and SciLexer.h files from the Scintilla.iface interface -# definition file. -# The header files are copied to a temporary file apart from the section between a //++Autogenerated -# comment and a //--Autogenerated comment which is generated by the printHFile and printLexHFile -# functions. After the temporary file is created, it is copied back to the original file name. - -import string -import sys -import os -import Face - -def Contains(s,sub): - return string.find(s, sub) != -1 - -def printLexHFile(f,out): - for name in f.order: - v = f.features[name] - if v["FeatureType"] in ["val"]: - if Contains(name, "SCE_") or Contains(name, "SCLEX_"): - out.write("#define " + name + " " + v["Value"] + "\n") - -def printHFile(f,out): - for name in f.order: - v = f.features[name] - if v["Category"] != "Deprecated": - if v["FeatureType"] in ["fun", "get", "set"]: - featureDefineName = "SCI_" + string.upper(name) - out.write("#define " + featureDefineName + " " + v["Value"] + "\n") - elif v["FeatureType"] in ["evt"]: - featureDefineName = "SCN_" + string.upper(name) - out.write("#define " + featureDefineName + " " + v["Value"] + "\n") - elif v["FeatureType"] in ["val"]: - if not (Contains(name, "SCE_") or Contains(name, "SCLEX_")): - out.write("#define " + name + " " + v["Value"] + "\n") - -def CopyWithInsertion(input, output, genfn, definition): - copying = 1 - for line in input.readlines(): - if copying: - output.write(line) - if Contains(line, "//++Autogenerated"): - copying = 0 - genfn(definition, output) - if Contains(line, "//--Autogenerated"): - copying = 1 - output.write(line) - -def contents(filename): - f = file(filename) - t = f.read() - f.close() - return t - -def Regenerate(filename, genfn, definition): - inText = contents(filename) - tempname = "HFacer.tmp" - out = open(tempname,"w") - hfile = open(filename) - CopyWithInsertion(hfile, out, genfn, definition) - out.close() - hfile.close() - outText = contents(tempname) - if inText == outText: - os.unlink(tempname) - else: - os.unlink(filename) - os.rename(tempname, filename) - -f = Face.Face() -try: - f.ReadFromFile("Scintilla.iface") - Regenerate("Scintilla.h", printHFile, f) - Regenerate("SciLexer.h", printLexHFile, f) - print "Maximum ID is", max([x for x in f.values if int(x) < 3000]) -except: - raise +# HFacer.py - regenerate the Scintilla.h and SciLexer.h files from the Scintilla.iface interface +# definition file. +# The header files are copied to a temporary file apart from the section between a /* ++Autogenerated*/ +# comment and a /* --Autogenerated*/ comment which is generated by the printHFile and printLexHFile +# functions. After the temporary file is created, it is copied back to the original file name. + +import sys +import os +import Face + +def Contains(s,sub): + return s.find(sub) != -1 + +def printLexHFile(f,out): + for name in f.order: + v = f.features[name] + if v["FeatureType"] in ["val"]: + if Contains(name, "SCE_") or Contains(name, "SCLEX_"): + out.write("#define " + name + " " + v["Value"] + "\n") + +def printHFile(f,out): + for name in f.order: + v = f.features[name] + if v["Category"] != "Deprecated": + if v["FeatureType"] in ["fun", "get", "set"]: + featureDefineName = "SCI_" + name.upper() + out.write("#define " + featureDefineName + " " + v["Value"] + "\n") + elif v["FeatureType"] in ["evt"]: + featureDefineName = "SCN_" + name.upper() + out.write("#define " + featureDefineName + " " + v["Value"] + "\n") + elif v["FeatureType"] in ["val"]: + if not (Contains(name, "SCE_") or Contains(name, "SCLEX_")): + out.write("#define " + name + " " + v["Value"] + "\n") + +def CopyWithInsertion(input, output, genfn, definition): + copying = 1 + for line in input.readlines(): + if copying: + output.write(line) + if Contains(line, "/* ++Autogenerated"): + copying = 0 + genfn(definition, output) + if Contains(line, "/* --Autogenerated"): + copying = 1 + output.write(line) + +def contents(filename): + f = open(filename) + t = f.read() + f.close() + return t + +def Regenerate(filename, genfn, definition): + inText = contents(filename) + tempname = "HFacer.tmp" + out = open(tempname,"w") + hfile = open(filename) + CopyWithInsertion(hfile, out, genfn, definition) + out.close() + hfile.close() + outText = contents(tempname) + if inText == outText: + os.unlink(tempname) + else: + os.unlink(filename) + os.rename(tempname, filename) + +f = Face.Face() +try: + f.ReadFromFile("Scintilla.iface") + Regenerate("Scintilla.h", printHFile, f) + Regenerate("SciLexer.h", printLexHFile, f) + print("Maximum ID is %s" % max([x for x in f.values if int(x) < 3000])) +except: + raise diff --git a/sdk/wxscintilla/src/scintilla/include/KeyWords.h b/sdk/wxscintilla/src/scintilla/include/KeyWords.h index b9f88ac0b5..5593b7d091 100644 --- a/sdk/wxscintilla/src/scintilla/include/KeyWords.h +++ b/sdk/wxscintilla/src/scintilla/include/KeyWords.h @@ -1,90 +1,113 @@ -// Scintilla source code edit control -/** @file KeyWords.h - ** Colourise for particular languages. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle, - WordList *keywordlists[], Accessor &styler); - -/** - * A LexerModule is responsible for lexing and folding a particular language. - * The class maintains a list of LexerModules which can be searched to find a - * module appropriate to a particular language. - */ -class LexerModule { -protected: - const LexerModule *next; - int language; - LexerFunction fnLexer; - LexerFunction fnFolder; - const char * const * wordListDescriptions; - int styleBits; - - static const LexerModule *base; - static int nextLanguage; - -public: - const char *languageName; - LexerModule(int language_, - LexerFunction fnLexer_, - const char *languageName_=0, - LexerFunction fnFolder_=0, - const char * const wordListDescriptions_[] = NULL, - int styleBits_=5); - virtual ~LexerModule() { - } - int GetLanguage() const { return language; } - - // -1 is returned if no WordList information is available - int GetNumWordLists() const; - const char *GetWordListDescription(int index) const; - - int GetStyleBitsNeeded() const; - - virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle, - WordList *keywordlists[], Accessor &styler) const; - virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle, - WordList *keywordlists[], Accessor &styler) const; - static const LexerModule *Find(int language); - static const LexerModule *Find(const char *languageName); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -/** - * Check if a character is a space. - * This is ASCII specific but is safe with chars >= 0x80. - */ -inline bool isspacechar(unsigned char ch) { - return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); -} - -inline bool iswordchar(char ch) { - return isascii(ch) && (isalnum(ch) || ch == '.' || ch == '_'); -} - -inline bool iswordstart(char ch) { - return isascii(ch) && (isalnum(ch) || ch == '_'); -} - -inline bool isoperator(char ch) { - if (isascii(ch) && isalnum(ch)) - return false; - // '.' left out as it is used to make up numbers - if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || - ch == '(' || ch == ')' || ch == '-' || ch == '+' || - ch == '=' || ch == '|' || ch == '{' || ch == '}' || - ch == '[' || ch == ']' || ch == ':' || ch == ';' || - ch == '<' || ch == '>' || ch == ',' || ch == '/' || - ch == '?' || ch == '!' || ch == '.' || ch == '~') - return true; - return false; -} +// Scintilla source code edit control +/** @file KeyWords.h + ** Colourise for particular languages. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +/** + */ +class WordList { +public: + // Each word contains at least one character - a empty word acts as sentinel at the end. + char **words; + char *list; + int len; + bool onlyLineEnds; ///< Delimited by any white space or only line ends + bool sorted; + int starts[256]; + WordList(bool onlyLineEnds_ = false) : + words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_), + sorted(false) + {} + ~WordList() { Clear(); } + operator bool() { return len ? true : false; } + void Clear(); + void Set(const char *s); + bool InList(const char *s); + bool InListAbbreviated(const char *s, const char marker); +}; + +typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle, + WordList *keywordlists[], Accessor &styler); + +/** + * A LexerModule is responsible for lexing and folding a particular language. + * The class maintains a list of LexerModules which can be searched to find a + * module appropriate to a particular language. + */ +class LexerModule { +protected: + const LexerModule *next; + int language; + LexerFunction fnLexer; + LexerFunction fnFolder; + const char * const * wordListDescriptions; + int styleBits; + + static const LexerModule *base; + static int nextLanguage; + +public: + const char *languageName; + LexerModule(int language_, + LexerFunction fnLexer_, + const char *languageName_=0, + LexerFunction fnFolder_=0, + const char * const wordListDescriptions_[] = NULL, + int styleBits_=5); + virtual ~LexerModule() { + } + int GetLanguage() const { return language; } + + // -1 is returned if no WordList information is available + int GetNumWordLists() const; + const char *GetWordListDescription(int index) const; + + int GetStyleBitsNeeded() const; + + virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle, + WordList *keywordlists[], Accessor &styler) const; + virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle, + WordList *keywordlists[], Accessor &styler) const; + static const LexerModule *Find(int language); + static const LexerModule *Find(const char *languageName); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +/** + * Check if a character is a space. + * This is ASCII specific but is safe with chars >= 0x80. + */ +inline bool isspacechar(unsigned char ch) { + return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); +} + +inline bool iswordchar(char ch) { + return isascii(ch) && (isalnum(ch) || ch == '.' || ch == '_'); +} + +inline bool iswordstart(char ch) { + return isascii(ch) && (isalnum(ch) || ch == '_'); +} + +inline bool isoperator(char ch) { + if (isascii(ch) && isalnum(ch)) + return false; + // '.' left out as it is used to make up numbers + if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || + ch == '(' || ch == ')' || ch == '-' || ch == '+' || + ch == '=' || ch == '|' || ch == '{' || ch == '}' || + ch == '[' || ch == ']' || ch == ':' || ch == ';' || + ch == '<' || ch == '>' || ch == ',' || ch == '/' || + ch == '?' || ch == '!' || ch == '.' || ch == '~') + return true; + return false; +} diff --git a/sdk/wxscintilla/src/scintilla/include/Platform.h b/sdk/wxscintilla/src/scintilla/include/Platform.h index bfac74b6b7..1d4df48846 100644 --- a/sdk/wxscintilla/src/scintilla/include/Platform.h +++ b/sdk/wxscintilla/src/scintilla/include/Platform.h @@ -1,555 +1,556 @@ -// Scintilla source code edit control -/** @file Platform.h - ** Interface to platform facilities. Also includes some basic utilities. - ** Implemented in PlatGTK.cxx for GTK+/Linux, PlatWin.cxx for Windows, and PlatWX.cxx for wxWindows. - **/ -// Copyright 1998-2003 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef PLATFORM_H -#define PLATFORM_H - -// PLAT_GTK = GTK+ on Linux or Win32 -// PLAT_GTK_WIN32 is defined additionally when running PLAT_GTK under Win32 -// PLAT_WIN = Win32 API on Win32 OS -// PLAT_WX is wxWindows on any supported platform - -#define PLAT_GTK 0 -#define PLAT_GTK_WIN32 0 -#define PLAT_MACOSX 0 -#define PLAT_WIN 0 -#define PLAT_WX 0 -#define PLAT_FOX 0 - -#if defined(FOX) -#undef PLAT_FOX -#define PLAT_FOX 1 - -#elif defined(__WX__) -#undef PLAT_WX -#define PLAT_WX 1 - -#elif defined(GTK) -#undef PLAT_GTK -#define PLAT_GTK 1 - -#if defined(__WIN32__) || defined(_MSC_VER) -#undef PLAT_GTK_WIN32 -#define PLAT_GTK_WIN32 1 -#endif - -#elif defined(MACOSX) -#undef PLAT_MACOSX -#define PLAT_MACOSX 1 - -#else -#undef PLAT_WIN -#define PLAT_WIN 1 - -#endif - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -// Underlying the implementation of the platform classes are platform specific types. -// Sometimes these need to be passed around by client code so they are defined here - -typedef void *FontID; -typedef void *SurfaceID; -typedef void *WindowID; -typedef void *MenuID; -typedef void *TickerID; -typedef void *Function; -typedef void *IdlerID; - -/** - * A geometric point class. - * Point is exactly the same as the Win32 POINT and GTK+ GdkPoint so can be used interchangeably. - */ -class Point { -public: - int x; - int y; - - explicit Point(int x_=0, int y_=0) : x(x_), y(y_) { - } - - // Other automatically defined methods (assignment, copy constructor, destructor) are fine - - static Point FromLong(long lpoint); -}; - -/** - * A geometric rectangle class. - * PRectangle is exactly the same as the Win32 RECT so can be used interchangeably. - * PRectangles contain their top and left sides, but not their right and bottom sides. - */ -class PRectangle { -public: - int left; - int top; - int right; - int bottom; - - PRectangle(int left_=0, int top_=0, int right_=0, int bottom_ = 0) : - left(left_), top(top_), right(right_), bottom(bottom_) { - } - - // Other automatically defined methods (assignment, copy constructor, destructor) are fine - - bool operator==(PRectangle &rc) { - return (rc.left == left) && (rc.right == right) && - (rc.top == top) && (rc.bottom == bottom); - } - bool Contains(Point pt) { - return (pt.x >= left) && (pt.x <= right) && - (pt.y >= top) && (pt.y <= bottom); - } - bool Contains(PRectangle rc) { - return (rc.left >= left) && (rc.right <= right) && - (rc.top >= top) && (rc.bottom <= bottom); - } - bool Intersects(PRectangle other) { - return (right > other.left) && (left < other.right) && - (bottom > other.top) && (top < other.bottom); - } - void Move(int xDelta, int yDelta) { - left += xDelta; - top += yDelta; - right += xDelta; - bottom += yDelta; - } - int Width() { return right - left; } - int Height() { return bottom - top; } - bool Empty() { - return (Height() <= 0) || (Width() <= 0); - } -}; - -/** - * In some circumstances, including Win32 in paletted mode and GTK+, each colour - * must be allocated before use. The desired colours are held in the ColourDesired class, - * and after allocation the allocation entry is stored in the ColourAllocated class. In other - * circumstances, such as Win32 in true colour mode, the allocation process just copies - * the RGB values from the desired to the allocated class. - * As each desired colour requires allocation before it can be used, the ColourPair class - * holds both a ColourDesired and a ColourAllocated - * The Palette class is responsible for managing the palette of colours which contains a - * list of ColourPair objects and performs the allocation. - */ - -/** - * Holds a desired RGB colour. - */ -class ColourDesired { - long co; -public: - ColourDesired(long lcol=0) { - co = lcol; - } - - ColourDesired(unsigned int red, unsigned int green, unsigned int blue) { - Set(red, green, blue); - } - - bool operator==(const ColourDesired &other) const { - return co == other.co; - } - - void Set(long lcol) { - co = lcol; - } - - void Set(unsigned int red, unsigned int green, unsigned int blue) { - co = red | (green << 8) | (blue << 16); - } - - static inline unsigned int ValueOfHex(const char ch) { - if (ch >= '0' && ch <= '9') - return ch - '0'; - else if (ch >= 'A' && ch <= 'F') - return ch - 'A' + 10; - else if (ch >= 'a' && ch <= 'f') - return ch - 'a' + 10; - else - return 0; - } - - void Set(const char *val) { - if (*val == '#') { - val++; - } - unsigned int r = ValueOfHex(val[0]) * 16 + ValueOfHex(val[1]); - unsigned int g = ValueOfHex(val[2]) * 16 + ValueOfHex(val[3]); - unsigned int b = ValueOfHex(val[4]) * 16 + ValueOfHex(val[5]); - Set(r, g, b); - } - - long AsLong() const { - return co; - } - - unsigned int GetRed() { - return co & 0xff; - } - - unsigned int GetGreen() { - return (co >> 8) & 0xff; - } - - unsigned int GetBlue() { - return (co >> 16) & 0xff; - } -}; - -/** - * Holds an allocated RGB colour which may be an approximation to the desired colour. - */ -class ColourAllocated { - long coAllocated; - -public: - - ColourAllocated(long lcol=0) { - coAllocated = lcol; - } - - void Set(long lcol) { - coAllocated = lcol; - } - - long AsLong() const { - return coAllocated; - } -}; - -/** - * Colour pairs hold a desired colour and an allocated colour. - */ -struct ColourPair { - ColourDesired desired; - ColourAllocated allocated; - - ColourPair(ColourDesired desired_=ColourDesired(0,0,0)) { - desired = desired_; - allocated.Set(desired.AsLong()); - } - void Copy() { - allocated.Set(desired.AsLong()); - } -}; - -class Window; // Forward declaration for Palette - -/** - * Colour palette management. - */ -class Palette { - int used; - int size; - ColourPair *entries; -#if PLAT_GTK - void *allocatedPalette; // GdkColor * - int allocatedLen; -#endif - // Private so Palette objects can not be copied - Palette(const Palette &) {} - Palette &operator=(const Palette &) { return *this; } -public: -#if PLAT_WIN - void *hpal; -#endif - bool allowRealization; - - Palette(); - ~Palette(); - - void Release(); - - /** - * This method either adds a colour to the list of wanted colours (want==true) - * or retrieves the allocated colour back to the ColourPair. - * This is one method to make it easier to keep the code for wanting and retrieving in sync. - */ - void WantFind(ColourPair &cp, bool want); - - void Allocate(Window &w); -}; - -/** - * Font management. - */ -class Font { -protected: - FontID id; -#if PLAT_WX - int ascent; -#endif - // Private so Font objects can not be copied - Font(const Font &) {} - Font &operator=(const Font &) { id=0; return *this; } -public: - Font(); - virtual ~Font(); - - virtual void Create(const char *faceName, int characterSet, int size, - bool bold, bool italic, bool extraFontFlag=false); - virtual void Release(); - - FontID GetID() { return id; } - // Alias another font - caller guarantees not to Release - void SetID(FontID id_) { id = id_; } - friend class Surface; - friend class SurfaceImpl; -}; - -/** - * A surface abstracts a place to draw. - */ -class Surface { -private: - // Private so Surface objects can not be copied - Surface(const Surface &) {} - Surface &operator=(const Surface &) { return *this; } -public: - Surface() {}; - virtual ~Surface() {}; - static Surface *Allocate(); - - virtual void Init(WindowID wid)=0; - virtual void Init(SurfaceID sid, WindowID wid)=0; - virtual void InitPixMap(int width, int height, Surface *surface_, WindowID wid)=0; - - virtual void Release()=0; - virtual bool Initialised()=0; - virtual void PenColour(ColourAllocated fore)=0; - virtual int LogPixelsY()=0; - virtual int DeviceHeightFont(int points)=0; - virtual void MoveTo(int x_, int y_)=0; - virtual void LineTo(int x_, int y_)=0; - virtual void Polygon(Point *pts, int npts, ColourAllocated fore, ColourAllocated back)=0; - virtual void RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0; - virtual void FillRectangle(PRectangle rc, ColourAllocated back)=0; - virtual void FillRectangle(PRectangle rc, Surface &surfacePattern)=0; - virtual void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0; - virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, - ColourAllocated outline, int alphaOutline, int flags)=0; - virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0; - virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0; - - virtual void DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back)=0; - virtual void DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back)=0; - virtual void DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore)=0; - virtual void MeasureWidths(Font &font_, const char *s, int len, int *positions)=0; - virtual int WidthText(Font &font_, const char *s, int len)=0; - virtual int WidthChar(Font &font_, char ch)=0; - virtual int Ascent(Font &font_)=0; - virtual int Descent(Font &font_)=0; - virtual int InternalLeading(Font &font_)=0; - virtual int ExternalLeading(Font &font_)=0; - virtual int Height(Font &font_)=0; - virtual int AverageCharWidth(Font &font_)=0; - - virtual int SetPalette(Palette *pal, bool inBackGround)=0; - virtual void SetClip(PRectangle rc)=0; - virtual void FlushCachedState()=0; - - virtual void SetUnicodeMode(bool unicodeMode_)=0; - virtual void SetDBCSMode(int codePage)=0; -}; - -/** - * A simple callback action passing one piece of untyped user data. - */ -typedef void (*CallBackAction)(void*); - -/** - * Class to hide the details of window manipulation. - * Does not own the window which will normally have a longer life than this object. - */ -class Window { -protected: - WindowID id; -#if PLAT_MACOSX - void *windowRef; - void *control; -#endif -public: - Window() : id(0), cursorLast(cursorInvalid) { -#if PLAT_MACOSX - windowRef = 0; - control = 0; -#endif - } - Window(const Window &source) : id(source.id), cursorLast(cursorInvalid) { -#if PLAT_MACOSX - windowRef = 0; - control = 0; -#endif - } - virtual ~Window(); - Window &operator=(WindowID id_) { - id = id_; - return *this; - } - WindowID GetID() const { return id; } - bool Created() const { return id != 0; } - void Destroy(); - bool HasFocus(); - PRectangle GetPosition(); - void SetPosition(PRectangle rc); - void SetPositionRelative(PRectangle rc, Window relativeTo); - PRectangle GetClientPosition(); - void Show(bool show=true); - void InvalidateAll(); - void InvalidateRectangle(PRectangle rc); - virtual void SetFont(Font &font); - enum Cursor { cursorInvalid, cursorText, cursorArrow, cursorUp, cursorWait, cursorHoriz, cursorVert, cursorReverseArrow, cursorHand }; - void SetCursor(Cursor curs); - void SetTitle(const char *s); - PRectangle GetMonitorRect(Point pt); -#if PLAT_MACOSX - void SetWindow(void *ref) { windowRef = ref; }; - void SetControl(void *_control) { control = _control; }; -#endif -private: - Cursor cursorLast; -}; - -/** - * Listbox management. - */ - -class ListBox : public Window { -public: - ListBox(); - virtual ~ListBox(); - static ListBox *Allocate(); - - virtual void SetFont(Font &font)=0; - virtual void Create(Window &parent, int ctrlID, Point location, int lineHeight_, bool unicodeMode_)=0; - virtual void SetAverageCharWidth(int width)=0; - virtual void SetVisibleRows(int rows)=0; - virtual int GetVisibleRows() const=0; - virtual PRectangle GetDesiredRect()=0; - virtual int CaretFromEdge()=0; - virtual void Clear()=0; - virtual void Append(char *s, int type = -1)=0; - virtual int Length()=0; - virtual void Select(int n)=0; - virtual int GetSelection()=0; - virtual int Find(const char *prefix)=0; - virtual void GetValue(int n, char *value, int len)=0; - virtual void RegisterImage(int type, const char *xpm_data)=0; - virtual void ClearRegisteredImages()=0; - virtual void SetDoubleClickAction(CallBackAction, void *)=0; - virtual void SetList(const char* list, char separator, char typesep)=0; -}; - -/** - * Menu management. - */ -class Menu { - MenuID id; -public: - Menu(); - MenuID GetID() { return id; } - void CreatePopUp(); - void Destroy(); - void Show(Point pt, Window &w); -}; - -class ElapsedTime { - long bigBit; - long littleBit; -public: - ElapsedTime(); - double Duration(bool reset=false); -}; - -/** - * Dynamic Library (DLL/SO/...) loading - */ -class DynamicLibrary { -public: - virtual ~DynamicLibrary() {}; - - /// @return Pointer to function "name", or NULL on failure. - virtual Function FindFunction(const char *name) = 0; - - /// @return true if the library was loaded successfully. - virtual bool IsValid() = 0; - - /// @return An instance of a DynamicLibrary subclass with "modulePath" loaded. - static DynamicLibrary *Load(const char *modulePath); -}; - -/** - * Platform class used to retrieve system wide parameters such as double click speed - * and chrome colour. Not a creatable object, more of a module with several functions. - */ -class Platform { - // Private so Platform objects can not be copied - Platform(const Platform &) {} - Platform &operator=(const Platform &) { return *this; } -public: - // Should be private because no new Platforms are ever created - // but gcc warns about this - Platform() {} - ~Platform() {} - static ColourDesired Chrome(); - static ColourDesired ChromeHighlight(); - static const char *DefaultFont(); - static int DefaultFontSize(); - static unsigned int DoubleClickTime(); - static bool MouseButtonBounce(); - static void DebugDisplay(const char *s); - static bool IsKeyDown(int key); - static long SendScintilla( - WindowID w, unsigned int msg, unsigned long wParam=0, long lParam=0); - static long SendScintillaPointer( - WindowID w, unsigned int msg, unsigned long wParam=0, void *lParam=0); - static bool IsDBCSLeadByte(int codePage, char ch); - static int DBCSCharLength(int codePage, const char *s); - static int DBCSCharMaxLength(); - - // These are utility functions not really tied to a platform - static int Minimum(int a, int b); - static int Maximum(int a, int b); - // Next three assume 16 bit shorts and 32 bit longs - static long LongFromTwoShorts(short a,short b) { - return (a) | ((b) << 16); - } - static short HighShortFromLong(long x) { - return static_cast(x >> 16); - } - static short LowShortFromLong(long x) { - return static_cast(x & 0xffff); - } - static void DebugPrintf(const char *format, ...); - static bool ShowAssertionPopUps(bool assertionPopUps_); - static void Assert(const char *c, const char *file, int line); - static int Clamp(int val, int minVal, int maxVal); -}; - -#ifdef NDEBUG -#define PLATFORM_ASSERT(c) ((void)0) -#else -#ifdef SCI_NAMESPACE -#define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Scintilla::Platform::Assert(#c, __FILE__, __LINE__)) -#else -#define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Platform::Assert(#c, __FILE__, __LINE__)) -#endif -#endif - -#ifdef SCI_NAMESPACE -} -#endif - -// Shut up annoying Visual C++ warnings: -#ifdef _MSC_VER -#pragma warning(disable: 4244 4309 4514 4710) -#endif - -#endif +// Scintilla source code edit control +/** @file Platform.h + ** Interface to platform facilities. Also includes some basic utilities. + ** Implemented in PlatGTK.cxx for GTK+/Linux, PlatWin.cxx for Windows, and PlatWX.cxx for wxWindows. + **/ +// Copyright 1998-2009 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef PLATFORM_H +#define PLATFORM_H + +// PLAT_GTK = GTK+ on Linux or Win32 +// PLAT_GTK_WIN32 is defined additionally when running PLAT_GTK under Win32 +// PLAT_WIN = Win32 API on Win32 OS +// PLAT_WX is wxWindows on any supported platform + +#define PLAT_GTK 0 +#define PLAT_GTK_WIN32 0 +#define PLAT_MACOSX 0 +#define PLAT_WIN 0 +#define PLAT_WX 0 +#define PLAT_FOX 0 + +#if defined(FOX) +#undef PLAT_FOX +#define PLAT_FOX 1 + +#elif defined(__WX__) +#undef PLAT_WX +#define PLAT_WX 1 + +#elif defined(GTK) +#undef PLAT_GTK +#define PLAT_GTK 1 + +#if defined(__WIN32__) || defined(_MSC_VER) +#undef PLAT_GTK_WIN32 +#define PLAT_GTK_WIN32 1 +#endif + +#elif defined(__APPLE__) + +#undef PLAT_MACOSX +#define PLAT_MACOSX 1 + +#else +#undef PLAT_WIN +#define PLAT_WIN 1 + +#endif + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +// Underlying the implementation of the platform classes are platform specific types. +// Sometimes these need to be passed around by client code so they are defined here + +typedef void *FontID; +typedef void *SurfaceID; +typedef void *WindowID; +typedef void *MenuID; +typedef void *TickerID; +typedef void *Function; +typedef void *IdlerID; + +/** + * A geometric point class. + * Point is exactly the same as the Win32 POINT and GTK+ GdkPoint so can be used interchangeably. + */ +class Point { +public: + int x; + int y; + + explicit Point(int x_=0, int y_=0) : x(x_), y(y_) { + } + + // Other automatically defined methods (assignment, copy constructor, destructor) are fine + + static Point FromLong(long lpoint); +}; + +/** + * A geometric rectangle class. + * PRectangle is exactly the same as the Win32 RECT so can be used interchangeably. + * PRectangles contain their top and left sides, but not their right and bottom sides. + */ +class PRectangle { +public: + int left; + int top; + int right; + int bottom; + + PRectangle(int left_=0, int top_=0, int right_=0, int bottom_ = 0) : + left(left_), top(top_), right(right_), bottom(bottom_) { + } + + // Other automatically defined methods (assignment, copy constructor, destructor) are fine + + bool operator==(PRectangle &rc) { + return (rc.left == left) && (rc.right == right) && + (rc.top == top) && (rc.bottom == bottom); + } + bool Contains(Point pt) { + return (pt.x >= left) && (pt.x <= right) && + (pt.y >= top) && (pt.y <= bottom); + } + bool Contains(PRectangle rc) { + return (rc.left >= left) && (rc.right <= right) && + (rc.top >= top) && (rc.bottom <= bottom); + } + bool Intersects(PRectangle other) { + return (right > other.left) && (left < other.right) && + (bottom > other.top) && (top < other.bottom); + } + void Move(int xDelta, int yDelta) { + left += xDelta; + top += yDelta; + right += xDelta; + bottom += yDelta; + } + int Width() { return right - left; } + int Height() { return bottom - top; } + bool Empty() { + return (Height() <= 0) || (Width() <= 0); + } +}; + +/** + * In some circumstances, including Win32 in paletted mode and GTK+, each colour + * must be allocated before use. The desired colours are held in the ColourDesired class, + * and after allocation the allocation entry is stored in the ColourAllocated class. In other + * circumstances, such as Win32 in true colour mode, the allocation process just copies + * the RGB values from the desired to the allocated class. + * As each desired colour requires allocation before it can be used, the ColourPair class + * holds both a ColourDesired and a ColourAllocated + * The Palette class is responsible for managing the palette of colours which contains a + * list of ColourPair objects and performs the allocation. + */ + +/** + * Holds a desired RGB colour. + */ +class ColourDesired { + long co; +public: + ColourDesired(long lcol=0) { + co = lcol; + } + + ColourDesired(unsigned int red, unsigned int green, unsigned int blue) { + Set(red, green, blue); + } + + bool operator==(const ColourDesired &other) const { + return co == other.co; + } + + void Set(long lcol) { + co = lcol; + } + + void Set(unsigned int red, unsigned int green, unsigned int blue) { + co = red | (green << 8) | (blue << 16); + } + + static inline unsigned int ValueOfHex(const char ch) { + if (ch >= '0' && ch <= '9') + return ch - '0'; + else if (ch >= 'A' && ch <= 'F') + return ch - 'A' + 10; + else if (ch >= 'a' && ch <= 'f') + return ch - 'a' + 10; + else + return 0; + } + + void Set(const char *val) { + if (*val == '#') { + val++; + } + unsigned int r = ValueOfHex(val[0]) * 16 + ValueOfHex(val[1]); + unsigned int g = ValueOfHex(val[2]) * 16 + ValueOfHex(val[3]); + unsigned int b = ValueOfHex(val[4]) * 16 + ValueOfHex(val[5]); + Set(r, g, b); + } + + long AsLong() const { + return co; + } + + unsigned int GetRed() { + return co & 0xff; + } + + unsigned int GetGreen() { + return (co >> 8) & 0xff; + } + + unsigned int GetBlue() { + return (co >> 16) & 0xff; + } +}; + +/** + * Holds an allocated RGB colour which may be an approximation to the desired colour. + */ +class ColourAllocated { + long coAllocated; + +public: + + ColourAllocated(long lcol=0) { + coAllocated = lcol; + } + + void Set(long lcol) { + coAllocated = lcol; + } + + long AsLong() const { + return coAllocated; + } +}; + +/** + * Colour pairs hold a desired colour and an allocated colour. + */ +struct ColourPair { + ColourDesired desired; + ColourAllocated allocated; + + ColourPair(ColourDesired desired_=ColourDesired(0,0,0)) { + desired = desired_; + allocated.Set(desired.AsLong()); + } + void Copy() { + allocated.Set(desired.AsLong()); + } +}; + +class Window; // Forward declaration for Palette + +/** + * Colour palette management. + */ +class Palette { + int used; + int size; + ColourPair *entries; +#if PLAT_GTK + void *allocatedPalette; // GdkColor * + int allocatedLen; +#endif + // Private so Palette objects can not be copied + Palette(const Palette &) {} + Palette &operator=(const Palette &) { return *this; } +public: +#if PLAT_WIN + void *hpal; +#endif + bool allowRealization; + + Palette(); + ~Palette(); + + void Release(); + + /** + * This method either adds a colour to the list of wanted colours (want==true) + * or retrieves the allocated colour back to the ColourPair. + * This is one method to make it easier to keep the code for wanting and retrieving in sync. + */ + void WantFind(ColourPair &cp, bool want); + + void Allocate(Window &w); +}; + +/** + * Font management. + */ +class Font { +protected: + FontID fid; +#if PLAT_WX + int ascent; +#endif + // Private so Font objects can not be copied + Font(const Font &) {} + Font &operator=(const Font &) { fid=0; return *this; } +public: + Font(); + virtual ~Font(); + + virtual void Create(const char *faceName, int characterSet, int size, + bool bold, bool italic, bool extraFontFlag=false); + virtual void Release(); + + FontID GetID() { return fid; } + // Alias another font - caller guarantees not to Release + void SetID(FontID fid_) { fid = fid_; } + friend class Surface; + friend class SurfaceImpl; +}; + +/** + * A surface abstracts a place to draw. + */ +class Surface { +private: + // Private so Surface objects can not be copied + Surface(const Surface &) {} + Surface &operator=(const Surface &) { return *this; } +public: + Surface() {}; + virtual ~Surface() {}; + static Surface *Allocate(); + + virtual void Init(WindowID wid)=0; + virtual void Init(SurfaceID sid, WindowID wid)=0; + virtual void InitPixMap(int width, int height, Surface *surface_, WindowID wid)=0; + + virtual void Release()=0; + virtual bool Initialised()=0; + virtual void PenColour(ColourAllocated fore)=0; + virtual int LogPixelsY()=0; + virtual int DeviceHeightFont(int points)=0; + virtual void MoveTo(int x_, int y_)=0; + virtual void LineTo(int x_, int y_)=0; + virtual void Polygon(Point *pts, int npts, ColourAllocated fore, ColourAllocated back)=0; + virtual void RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0; + virtual void FillRectangle(PRectangle rc, ColourAllocated back)=0; + virtual void FillRectangle(PRectangle rc, Surface &surfacePattern)=0; + virtual void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0; + virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill, + ColourAllocated outline, int alphaOutline, int flags)=0; + virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0; + virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0; + + virtual void DrawTextNoClip(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back)=0; + virtual void DrawTextClipped(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore, ColourAllocated back)=0; + virtual void DrawTextTransparent(PRectangle rc, Font &font_, int ybase, const char *s, int len, ColourAllocated fore)=0; + virtual void MeasureWidths(Font &font_, const char *s, int len, int *positions)=0; + virtual int WidthText(Font &font_, const char *s, int len)=0; + virtual int WidthChar(Font &font_, char ch)=0; + virtual int Ascent(Font &font_)=0; + virtual int Descent(Font &font_)=0; + virtual int InternalLeading(Font &font_)=0; + virtual int ExternalLeading(Font &font_)=0; + virtual int Height(Font &font_)=0; + virtual int AverageCharWidth(Font &font_)=0; + + virtual int SetPalette(Palette *pal, bool inBackGround)=0; + virtual void SetClip(PRectangle rc)=0; + virtual void FlushCachedState()=0; + + virtual void SetUnicodeMode(bool unicodeMode_)=0; + virtual void SetDBCSMode(int codePage)=0; +}; + +/** + * A simple callback action passing one piece of untyped user data. + */ +typedef void (*CallBackAction)(void*); + +/** + * Class to hide the details of window manipulation. + * Does not own the window which will normally have a longer life than this object. + */ +class Window { +protected: + WindowID wid; +#if PLAT_MACOSX + void *windowRef; + void *control; +#endif +public: + Window() : wid(0), cursorLast(cursorInvalid) { +#if PLAT_MACOSX + windowRef = 0; + control = 0; +#endif + } + Window(const Window &source) : wid(source.wid), cursorLast(cursorInvalid) { +#if PLAT_MACOSX + windowRef = 0; + control = 0; +#endif + } + virtual ~Window(); + Window &operator=(WindowID wid_) { + wid = wid_; + return *this; + } + WindowID GetID() const { return wid; } + bool Created() const { return wid != 0; } + void Destroy(); + bool HasFocus(); + PRectangle GetPosition(); + void SetPosition(PRectangle rc); + void SetPositionRelative(PRectangle rc, Window relativeTo); + PRectangle GetClientPosition(); + void Show(bool show=true); + void InvalidateAll(); + void InvalidateRectangle(PRectangle rc); + virtual void SetFont(Font &font); + enum Cursor { cursorInvalid, cursorText, cursorArrow, cursorUp, cursorWait, cursorHoriz, cursorVert, cursorReverseArrow, cursorHand }; + void SetCursor(Cursor curs); + void SetTitle(const char *s); + PRectangle GetMonitorRect(Point pt); +#if PLAT_MACOSX + void SetWindow(void *ref) { windowRef = ref; }; + void SetControl(void *_control) { control = _control; }; +#endif +private: + Cursor cursorLast; +}; + +/** + * Listbox management. + */ + +class ListBox : public Window { +public: + ListBox(); + virtual ~ListBox(); + static ListBox *Allocate(); + + virtual void SetFont(Font &font)=0; + virtual void Create(Window &parent, int ctrlID, Point location, int lineHeight_, bool unicodeMode_)=0; + virtual void SetAverageCharWidth(int width)=0; + virtual void SetVisibleRows(int rows)=0; + virtual int GetVisibleRows() const=0; + virtual PRectangle GetDesiredRect()=0; + virtual int CaretFromEdge()=0; + virtual void Clear()=0; + virtual void Append(char *s, int type = -1)=0; + virtual int Length()=0; + virtual void Select(int n)=0; + virtual int GetSelection()=0; + virtual int Find(const char *prefix)=0; + virtual void GetValue(int n, char *value, int len)=0; + virtual void RegisterImage(int type, const char *xpm_data)=0; + virtual void ClearRegisteredImages()=0; + virtual void SetDoubleClickAction(CallBackAction, void *)=0; + virtual void SetList(const char* list, char separator, char typesep)=0; +}; + +/** + * Menu management. + */ +class Menu { + MenuID mid; +public: + Menu(); + MenuID GetID() { return mid; } + void CreatePopUp(); + void Destroy(); + void Show(Point pt, Window &w); +}; + +class ElapsedTime { + long bigBit; + long littleBit; +public: + ElapsedTime(); + double Duration(bool reset=false); +}; + +/** + * Dynamic Library (DLL/SO/...) loading + */ +class DynamicLibrary { +public: + virtual ~DynamicLibrary() {}; + + /// @return Pointer to function "name", or NULL on failure. + virtual Function FindFunction(const char *name) = 0; + + /// @return true if the library was loaded successfully. + virtual bool IsValid() = 0; + + /// @return An instance of a DynamicLibrary subclass with "modulePath" loaded. + static DynamicLibrary *Load(const char *modulePath); +}; + +/** + * Platform class used to retrieve system wide parameters such as double click speed + * and chrome colour. Not a creatable object, more of a module with several functions. + */ +class Platform { + // Private so Platform objects can not be copied + Platform(const Platform &) {} + Platform &operator=(const Platform &) { return *this; } +public: + // Should be private because no new Platforms are ever created + // but gcc warns about this + Platform() {} + ~Platform() {} + static ColourDesired Chrome(); + static ColourDesired ChromeHighlight(); + static const char *DefaultFont(); + static int DefaultFontSize(); + static unsigned int DoubleClickTime(); + static bool MouseButtonBounce(); + static void DebugDisplay(const char *s); + static bool IsKeyDown(int key); + static long SendScintilla( + WindowID w, unsigned int msg, unsigned long wParam=0, long lParam=0); + static long SendScintillaPointer( + WindowID w, unsigned int msg, unsigned long wParam=0, void *lParam=0); + static bool IsDBCSLeadByte(int codePage, char ch); + static int DBCSCharLength(int codePage, const char *s); + static int DBCSCharMaxLength(); + + // These are utility functions not really tied to a platform + static int Minimum(int a, int b); + static int Maximum(int a, int b); + // Next three assume 16 bit shorts and 32 bit longs + static long LongFromTwoShorts(short a,short b) { + return (a) | ((b) << 16); + } + static short HighShortFromLong(long x) { + return static_cast(x >> 16); + } + static short LowShortFromLong(long x) { + return static_cast(x & 0xffff); + } + static void DebugPrintf(const char *format, ...); + static bool ShowAssertionPopUps(bool assertionPopUps_); + static void Assert(const char *c, const char *file, int line); + static int Clamp(int val, int minVal, int maxVal); +}; + +#ifdef NDEBUG +#define PLATFORM_ASSERT(c) ((void)0) +#else +#ifdef SCI_NAMESPACE +#define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Scintilla::Platform::Assert(#c, __FILE__, __LINE__)) +#else +#define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Platform::Assert(#c, __FILE__, __LINE__)) +#endif +#endif + +#ifdef SCI_NAMESPACE +} +#endif + +// Shut up annoying Visual C++ warnings: +#ifdef _MSC_VER +#pragma warning(disable: 4244 4309 4514 4710) +#endif + +#endif diff --git a/sdk/wxscintilla/src/scintilla/include/PropSet.h b/sdk/wxscintilla/src/scintilla/include/PropSet.h index 488d3bbfee..c95202174f 100644 --- a/sdk/wxscintilla/src/scintilla/include/PropSet.h +++ b/sdk/wxscintilla/src/scintilla/include/PropSet.h @@ -1,104 +1,26 @@ -// Scintilla source code edit control -/** @file PropSet.h - ** A Java style properties file module. - **/ -// Copyright 1998-2002 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef PROPSET_H -#define PROPSET_H -#include "SString.h" - -bool EqualCaseInsensitive(const char *a, const char *b); - -bool isprefix(const char *target, const char *prefix); - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -struct Property { - unsigned int hash; - char *key; - char *val; - Property *next; - Property() : hash(0), key(0), val(0), next(0) {} -}; - -/** - */ -class PropSet { -protected: - enum { hashRoots=31 }; - Property *props[hashRoots]; - Property *enumnext; - int enumhash; - static unsigned int HashString(const char *s, size_t len) { - unsigned int ret = 0; - while (len--) { - ret <<= 4; - ret ^= *s; - s++; - } - return ret; - } - -public: - PropSet *superPS; - PropSet(); - ~PropSet(); - void Set(const char *key, const char *val, int lenKey=-1, int lenVal=-1); - void Set(const char *keyVal); - void Unset(const char *key, int lenKey=-1); - void SetMultiple(const char *s); - SString Get(const char *key) const; - SString GetExpanded(const char *key) const; - SString Expand(const char *withVars, int maxExpands=100) const; - int GetInt(const char *key, int defaultValue=0) const; - void Clear(); - char *ToString() const; // Caller must delete[] the return value - -private: - // copy-value semantics not implemented - PropSet(const PropSet ©); - void operator=(const PropSet &assign); -}; - -/** - */ -class WordList { -public: - // Each word contains at least one character - a empty word acts as sentinel at the end. - char **words; - char *list; - int len; - bool onlyLineEnds; ///< Delimited by any white space or only line ends - bool sorted; - int starts[256]; - WordList(bool onlyLineEnds_ = false) : - words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_), - sorted(false) - {} - ~WordList() { Clear(); } - operator bool() { return len ? true : false; } - void Clear(); - void Set(const char *s); - bool InList(const char *s); - bool InListAbbreviated(const char *s, const char marker); -}; - -inline bool IsAlphabetic(unsigned int ch) { - return ((ch >= 'A') && (ch <= 'Z')) || ((ch >= 'a') && (ch <= 'z')); -} - -#ifdef SCI_NAMESPACE -} -#endif - -#ifdef _MSC_VER -// Visual C++ doesn't like the private copy idiom for disabling -// the default copy constructor and operator=, but it's fine. -#pragma warning(disable: 4511 4512) -#endif - -#endif +// Scintilla source code edit control +/** @file PropSet.h + ** An interface to the methods needed for access to property sets inside lexers. + **/ +// Copyright 1998-2009 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef PROPSET_H +#define PROPSET_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +class PropertyGet { +public: + virtual char *ToString() const=0; // Caller must delete[] the return value + virtual int GetInt(const char *key, int defaultValue=0) const=0; + virtual ~PropertyGet() {} +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/sdk/wxscintilla/src/scintilla/include/SciLexer.h b/sdk/wxscintilla/src/scintilla/include/SciLexer.h index 1d3831de87..e8636e594b 100644 --- a/sdk/wxscintilla/src/scintilla/include/SciLexer.h +++ b/sdk/wxscintilla/src/scintilla/include/SciLexer.h @@ -2,18 +2,18 @@ /** @file SciLexer.h ** Interface to the added lexer functions in the SciLexer version of the edit control. **/ -// Copyright 1998-2002 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. +/* Copyright 1998-2002 by Neil Hodgson + * The License.txt file describes the conditions under which this software may be distributed. */ -// Most of this file is automatically generated from the Scintilla.iface interface definition -// file which contains any comments about the definitions. HFacer.py does the generation. +/* Most of this file is automatically generated from the Scintilla.iface interface definition + * file which contains any comments about the definitions. HFacer.py does the generation. */ #ifndef SCILEXER_H #define SCILEXER_H -// SciLexer features - not in standard Scintilla +/* SciLexer features - not in standard Scintilla */ -//++Autogenerated -- start of section automatically generated from Scintilla.iface +/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ #define SCLEX_CONTAINER 0 #define SCLEX_NULL 1 #define SCLEX_PYTHON 2 @@ -101,6 +101,15 @@ #define SCLEX_R 86 #define SCLEX_MAGIK 87 #define SCLEX_POWERSHELL 88 +#define SCLEX_MYSQL 89 +#define SCLEX_PO 90 +#define SCLEX_TAL 91 +#define SCLEX_COBOL 92 +#define SCLEX_TACL 93 +#define SCLEX_SORCUS 94 +#define SCLEX_POWERPRO 95 +#define SCLEX_NIMROD 96 +#define SCLEX_SML 97 //Eran - START #define SCLEX_GCC 150 @@ -165,7 +174,6 @@ #define SCE_C_COMMENTDOCKEYWORD 17 #define SCE_C_COMMENTDOCKEYWORDERROR 18 #define SCE_C_GLOBALCLASS 19 - #define SCE_D_DEFAULT 0 #define SCE_D_COMMENT 1 #define SCE_D_COMMENTLINE 2 @@ -184,6 +192,11 @@ #define SCE_D_COMMENTLINEDOC 15 #define SCE_D_COMMENTDOCKEYWORD 16 #define SCE_D_COMMENTDOCKEYWORDERROR 17 +#define SCE_D_STRINGB 18 +#define SCE_D_STRINGR 19 +#define SCE_D_WORD5 20 +#define SCE_D_WORD6 21 +#define SCE_D_WORD7 22 #define SCE_TCL_DEFAULT 0 #define SCE_TCL_COMMENT 1 #define SCE_TCL_COMMENTLINE 2 @@ -480,6 +493,7 @@ #define SCE_DIFF_POSITION 4 #define SCE_DIFF_DELETED 5 #define SCE_DIFF_ADDED 6 +#define SCE_DIFF_CHANGED 7 #define SCE_CONF_DEFAULT 0 #define SCE_CONF_COMMENT 1 #define SCE_CONF_NUMBER 2 @@ -644,6 +658,11 @@ #define SCE_CSS_SINGLESTRING 14 #define SCE_CSS_IDENTIFIER2 15 #define SCE_CSS_ATTRIBUTE 16 +#define SCE_CSS_IDENTIFIER3 17 +#define SCE_CSS_PSEUDOELEMENT 18 +#define SCE_CSS_EXTENDED_IDENTIFIER 19 +#define SCE_CSS_EXTENDED_PSEUDOCLASS 20 +#define SCE_CSS_EXTENDED_PSEUDOELEMENT 21 #define SCE_POV_DEFAULT 0 #define SCE_POV_COMMENT 1 #define SCE_POV_COMMENTLINE 2 @@ -946,6 +965,7 @@ #define SCE_CAML_OPERATOR 7 #define SCE_CAML_NUMBER 8 #define SCE_CAML_CHAR 9 +#define SCE_CAML_WHITE 10 #define SCE_CAML_STRING 11 #define SCE_CAML_COMMENT 12 #define SCE_CAML_COMMENT1 13 @@ -1104,6 +1124,7 @@ #define SCE_INNO_SECTION 4 #define SCE_INNO_PREPROC 5 #define SCE_INNO_PREPROC_INLINE 6 +#define SCE_INNO_INLINE_EXPANSION 6 #define SCE_INNO_COMMENT_PASCAL 7 #define SCE_INNO_KEYWORD_PASCAL 8 #define SCE_INNO_KEYWORD_USER 9 @@ -1261,8 +1282,94 @@ #define SCE_POWERSHELL_KEYWORD 8 #define SCE_POWERSHELL_CMDLET 9 #define SCE_POWERSHELL_ALIAS 10 -#define SCLEX_ASP 29 -#define SCLEX_PHP 30 -//--Autogenerated -- end of section automatically generated from Scintilla.iface +#define SCE_MYSQL_DEFAULT 0 +#define SCE_MYSQL_COMMENT 1 +#define SCE_MYSQL_COMMENTLINE 2 +#define SCE_MYSQL_VARIABLE 3 +#define SCE_MYSQL_SYSTEMVARIABLE 4 +#define SCE_MYSQL_KNOWNSYSTEMVARIABLE 5 +#define SCE_MYSQL_NUMBER 6 +#define SCE_MYSQL_MAJORKEYWORD 7 +#define SCE_MYSQL_KEYWORD 8 +#define SCE_MYSQL_DATABASEOBJECT 9 +#define SCE_MYSQL_PROCEDUREKEYWORD 10 +#define SCE_MYSQL_STRING 11 +#define SCE_MYSQL_SQSTRING 12 +#define SCE_MYSQL_DQSTRING 13 +#define SCE_MYSQL_OPERATOR 14 +#define SCE_MYSQL_FUNCTION 15 +#define SCE_MYSQL_IDENTIFIER 16 +#define SCE_MYSQL_QUOTEDIDENTIFIER 17 +#define SCE_MYSQL_USER1 18 +#define SCE_MYSQL_USER2 19 +#define SCE_MYSQL_USER3 20 +#define SCE_MYSQL_HIDDENCOMMAND 21 +#define SCE_PO_DEFAULT 0 +#define SCE_PO_COMMENT 1 +#define SCE_PO_MSGID 2 +#define SCE_PO_MSGID_TEXT 3 +#define SCE_PO_MSGSTR 4 +#define SCE_PO_MSGSTR_TEXT 5 +#define SCE_PO_MSGCTXT 6 +#define SCE_PO_MSGCTXT_TEXT 7 +#define SCE_PO_FUZZY 8 +#define SCE_PAS_DEFAULT 0 +#define SCE_PAS_IDENTIFIER 1 +#define SCE_PAS_COMMENT 2 +#define SCE_PAS_COMMENT2 3 +#define SCE_PAS_COMMENTLINE 4 +#define SCE_PAS_PREPROCESSOR 5 +#define SCE_PAS_PREPROCESSOR2 6 +#define SCE_PAS_NUMBER 7 +#define SCE_PAS_HEXNUMBER 8 +#define SCE_PAS_WORD 9 +#define SCE_PAS_STRING 10 +#define SCE_PAS_STRINGEOL 11 +#define SCE_PAS_CHARACTER 12 +#define SCE_PAS_OPERATOR 13 +#define SCE_PAS_ASM 14 +#define SCE_SORCUS_DEFAULT 0 +#define SCE_SORCUS_COMMAND 1 +#define SCE_SORCUS_PARAMETER 2 +#define SCE_SORCUS_COMMENTLINE 3 +#define SCE_SORCUS_STRING 4 +#define SCE_SORCUS_STRINGEOL 5 +#define SCE_SORCUS_IDENTIFIER 6 +#define SCE_SORCUS_OPERATOR 7 +#define SCE_SORCUS_NUMBER 8 +#define SCE_SORCUS_CONSTANT 9 +#define SCE_POWERPRO_DEFAULT 0 +#define SCE_POWERPRO_COMMENTBLOCK 1 +#define SCE_POWERPRO_COMMENTLINE 2 +#define SCE_POWERPRO_NUMBER 3 +#define SCE_POWERPRO_WORD 4 +#define SCE_POWERPRO_WORD2 5 +#define SCE_POWERPRO_WORD3 6 +#define SCE_POWERPRO_WORD4 7 +#define SCE_POWERPRO_DOUBLEQUOTEDSTRING 8 +#define SCE_POWERPRO_SINGLEQUOTEDSTRING 9 +#define SCE_POWERPRO_LINECONTINUE 10 +#define SCE_POWERPRO_OPERATOR 11 +#define SCE_POWERPRO_IDENTIFIER 12 +#define SCE_POWERPRO_STRINGEOL 13 +#define SCE_POWERPRO_VERBATIM 14 +#define SCE_POWERPRO_ALTQUOTE 15 +#define SCE_POWERPRO_FUNCTION 16 +#define SCE_SML_DEFAULT 0 +#define SCE_SML_IDENTIFIER 1 +#define SCE_SML_TAGNAME 2 +#define SCE_SML_KEYWORD 3 +#define SCE_SML_KEYWORD2 4 +#define SCE_SML_KEYWORD3 5 +#define SCE_SML_LINENUM 6 +#define SCE_SML_OPERATOR 7 +#define SCE_SML_NUMBER 8 +#define SCE_SML_CHAR 9 +#define SCE_SML_STRING 11 +#define SCE_SML_COMMENT 12 +#define SCE_SML_COMMENT1 13 +#define SCE_SML_COMMENT2 14 +#define SCE_SML_COMMENT3 15 +/* --Autogenerated -- end of section automatically generated from Scintilla.iface */ #endif diff --git a/sdk/wxscintilla/src/scintilla/include/Scintilla.h b/sdk/wxscintilla/src/scintilla/include/Scintilla.h index db043ea14b..7eafe822ce 100644 --- a/sdk/wxscintilla/src/scintilla/include/Scintilla.h +++ b/sdk/wxscintilla/src/scintilla/include/Scintilla.h @@ -1,850 +1,943 @@ -// Scintilla source code edit control -/** @file Scintilla.h - ** Interface to the edit control. - **/ -// Copyright 1998-2003 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -// Most of this file is automatically generated from the Scintilla.iface interface definition -// file which contains any comments about the definitions. HFacer.py does the generation. - -#ifndef SCINTILLA_H -#define SCINTILLA_H - -#if LCCWIN -typedef BOOL bool; -#endif - -#if PLAT_WIN -// Return false on failure: -bool Scintilla_RegisterClasses(void *hInstance); -bool Scintilla_ReleaseResources(); -#endif -int Scintilla_LinkLexers(); - -// Here should be placed typedefs for uptr_t, an unsigned integer type large enough to -// hold a pointer and sptr_t, a signed integer large enough to hold a pointer. -// May need to be changed for 64 bit platforms. -#if _MSC_VER >= 1300 -#include -#endif -#ifdef MAXULONG_PTR -typedef ULONG_PTR uptr_t; -typedef LONG_PTR sptr_t; -#else -typedef unsigned long uptr_t; -typedef long sptr_t; -#endif - -typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam); - -//++Autogenerated -- start of section automatically generated from Scintilla.iface -#define INVALID_POSITION -1 -#define SCI_START 2000 -#define SCI_OPTIONAL_START 3000 -#define SCI_LEXER_START 4000 -#define SCI_ADDTEXT 2001 -#define SCI_ADDSTYLEDTEXT 2002 -#define SCI_INSERTTEXT 2003 -#define SCI_CLEARALL 2004 -#define SCI_CLEARDOCUMENTSTYLE 2005 -#define SCI_GETLENGTH 2006 -#define SCI_GETCHARAT 2007 -#define SCI_GETCURRENTPOS 2008 -#define SCI_GETANCHOR 2009 -#define SCI_GETSTYLEAT 2010 -#define SCI_REDO 2011 -#define SCI_SETUNDOCOLLECTION 2012 -#define SCI_SELECTALL 2013 -#define SCI_SETSAVEPOINT 2014 -#define SCI_GETSTYLEDTEXT 2015 -#define SCI_CANREDO 2016 -#define SCI_MARKERLINEFROMHANDLE 2017 -#define SCI_MARKERDELETEHANDLE 2018 -#define SCI_GETUNDOCOLLECTION 2019 -#define SCWS_INVISIBLE 0 -#define SCWS_VISIBLEALWAYS 1 -#define SCWS_VISIBLEAFTERINDENT 2 -#define SCI_GETVIEWWS 2020 -#define SCI_SETVIEWWS 2021 -#define SCI_POSITIONFROMPOINT 2022 -#define SCI_POSITIONFROMPOINTCLOSE 2023 -#define SCI_GOTOLINE 2024 -#define SCI_GOTOPOS 2025 -#define SCI_SETANCHOR 2026 -#define SCI_GETCURLINE 2027 -#define SCI_GETENDSTYLED 2028 -#define SC_EOL_CRLF 0 -#define SC_EOL_CR 1 -#define SC_EOL_LF 2 -#define SCI_CONVERTEOLS 2029 -#define SCI_GETEOLMODE 2030 -#define SCI_SETEOLMODE 2031 -#define SCI_STARTSTYLING 2032 -#define SCI_SETSTYLING 2033 -#define SCI_GETBUFFEREDDRAW 2034 -#define SCI_SETBUFFEREDDRAW 2035 -#define SCI_SETTABWIDTH 2036 -#define SCI_GETTABWIDTH 2121 -#define SC_CP_UTF8 65001 -#define SC_CP_DBCS 1 -#define SCI_SETCODEPAGE 2037 -#define SCI_SETUSEPALETTE 2039 -#define MARKER_MAX 31 -#define SC_MARK_CIRCLE 0 -#define SC_MARK_ROUNDRECT 1 -#define SC_MARK_ARROW 2 -#define SC_MARK_SMALLRECT 3 -#define SC_MARK_SHORTARROW 4 -#define SC_MARK_EMPTY 5 -#define SC_MARK_ARROWDOWN 6 -#define SC_MARK_MINUS 7 -#define SC_MARK_PLUS 8 -#define SC_MARK_VLINE 9 -#define SC_MARK_LCORNER 10 -#define SC_MARK_TCORNER 11 -#define SC_MARK_BOXPLUS 12 -#define SC_MARK_BOXPLUSCONNECTED 13 -#define SC_MARK_BOXMINUS 14 -#define SC_MARK_BOXMINUSCONNECTED 15 -#define SC_MARK_LCORNERCURVE 16 -#define SC_MARK_TCORNERCURVE 17 -#define SC_MARK_CIRCLEPLUS 18 -#define SC_MARK_CIRCLEPLUSCONNECTED 19 -#define SC_MARK_CIRCLEMINUS 20 -#define SC_MARK_CIRCLEMINUSCONNECTED 21 -#define SC_MARK_BACKGROUND 22 -#define SC_MARK_DOTDOTDOT 23 -#define SC_MARK_ARROWS 24 -#define SC_MARK_PIXMAP 25 -#define SC_MARK_FULLRECT 26 -#define SC_MARK_LEFTRECT 27 -#define SC_MARK_ARROW_IN_BOX 100 -#define SC_MARK_ARROWDOWN_IN_BOX 101 -#define SC_MARK_FULLRECT_TAIL 102 -#define SC_MARK_PLUS_IN_BOX 103 -#define SC_MARK_MINUS_IN_BOX 104 - -#define SC_MARK_CHARACTER 10000 -#define SC_MARKNUM_FOLDEREND 25 -#define SC_MARKNUM_FOLDEROPENMID 26 -#define SC_MARKNUM_FOLDERMIDTAIL 27 -#define SC_MARKNUM_FOLDERTAIL 28 -#define SC_MARKNUM_FOLDERSUB 29 -#define SC_MARKNUM_FOLDER 30 -#define SC_MARKNUM_FOLDEROPEN 31 -#define SC_MASK_FOLDERS 0xFE000000 -#define SCI_MARKERDEFINE 2040 -#define SCI_MARKERSETFORE 2041 -#define SCI_MARKERSETBACK 2042 -#define SCI_MARKERADD 2043 -#define SCI_MARKERDELETE 2044 -#define SCI_MARKERDELETEALL 2045 -#define SCI_MARKERGET 2046 -#define SCI_MARKERNEXT 2047 -#define SCI_MARKERPREVIOUS 2048 -#define SCI_MARKERDEFINEPIXMAP 2049 -#define SCI_MARKERADDSET 2466 -#define SCI_MARKERSETALPHA 2476 -#define SC_MARGIN_SYMBOL 0 -#define SC_MARGIN_NUMBER 1 -#define SC_MARGIN_BACK 2 -#define SC_MARGIN_FORE 3 -#define SCI_SETMARGINTYPEN 2240 -#define SCI_GETMARGINTYPEN 2241 -#define SCI_SETMARGINWIDTHN 2242 -#define SCI_GETMARGINWIDTHN 2243 -#define SCI_SETMARGINMASKN 2244 -#define SCI_GETMARGINMASKN 2245 -#define SCI_SETMARGINSENSITIVEN 2246 -#define SCI_GETMARGINSENSITIVEN 2247 -#define STYLE_DEFAULT 32 -#define STYLE_LINENUMBER 33 -#define STYLE_BRACELIGHT 34 -#define STYLE_BRACEBAD 35 -#define STYLE_CONTROLCHAR 36 -#define STYLE_INDENTGUIDE 37 -#define STYLE_CALLTIP 38 -#define STYLE_LASTPREDEFINED 39 -#define STYLE_MAX 255 -#define SC_CHARSET_ANSI 0 -#define SC_CHARSET_DEFAULT 1 -#define SC_CHARSET_BALTIC 186 -#define SC_CHARSET_CHINESEBIG5 136 -#define SC_CHARSET_EASTEUROPE 238 -#define SC_CHARSET_GB2312 134 -#define SC_CHARSET_GREEK 161 -#define SC_CHARSET_HANGUL 129 -#define SC_CHARSET_MAC 77 -#define SC_CHARSET_OEM 255 -#define SC_CHARSET_RUSSIAN 204 -#define SC_CHARSET_CYRILLIC 1251 -#define SC_CHARSET_SHIFTJIS 128 -#define SC_CHARSET_SYMBOL 2 -#define SC_CHARSET_TURKISH 162 -#define SC_CHARSET_JOHAB 130 -#define SC_CHARSET_HEBREW 177 -#define SC_CHARSET_ARABIC 178 -#define SC_CHARSET_VIETNAMESE 163 -#define SC_CHARSET_THAI 222 -#define SC_CHARSET_8859_15 1000 -#define SCI_STYLECLEARALL 2050 -#define SCI_STYLESETFORE 2051 -#define SCI_STYLESETBACK 2052 -#define SCI_STYLESETBOLD 2053 -#define SCI_STYLESETITALIC 2054 -#define SCI_STYLESETSIZE 2055 -#define SCI_STYLESETFONT 2056 -#define SCI_STYLESETEOLFILLED 2057 -#define SCI_STYLERESETDEFAULT 2058 -#define SCI_STYLESETUNDERLINE 2059 -#define SC_CASE_MIXED 0 -#define SC_CASE_UPPER 1 -#define SC_CASE_LOWER 2 -#define SCI_STYLEGETFORE 2481 -#define SCI_STYLEGETBACK 2482 -#define SCI_STYLEGETBOLD 2483 -#define SCI_STYLEGETITALIC 2484 -#define SCI_STYLEGETSIZE 2485 -#define SCI_STYLEGETFONT 2486 -#define SCI_STYLEGETEOLFILLED 2487 -#define SCI_STYLEGETUNDERLINE 2488 -#define SCI_STYLEGETCASE 2489 -#define SCI_STYLEGETCHARACTERSET 2490 -#define SCI_STYLEGETVISIBLE 2491 -#define SCI_STYLEGETCHANGEABLE 2492 -#define SCI_STYLEGETHOTSPOT 2493 -#define SCI_STYLESETCASE 2060 -#define SCI_STYLESETCHARACTERSET 2066 -#define SCI_STYLESETHOTSPOT 2409 -#define SCI_SETSELFORE 2067 -#define SCI_SETSELBACK 2068 -#define SCI_GETSELALPHA 2477 -#define SCI_SETSELALPHA 2478 -#define SCI_GETSELEOLFILLED 2479 -#define SCI_SETSELEOLFILLED 2480 -#define SCI_SETCARETFORE 2069 -#define SCI_ASSIGNCMDKEY 2070 -#define SCI_CLEARCMDKEY 2071 -#define SCI_CLEARALLCMDKEYS 2072 -#define SCI_SETSTYLINGEX 2073 -#define SCI_STYLESETVISIBLE 2074 -#define SCI_GETCARETPERIOD 2075 -#define SCI_SETCARETPERIOD 2076 -#define SCI_SETWORDCHARS 2077 -#define SCI_BEGINUNDOACTION 2078 -#define SCI_ENDUNDOACTION 2079 -#define INDIC_PLAIN 0 -#define INDIC_SQUIGGLE 1 -#define INDIC_TT 2 -#define INDIC_DIAGONAL 3 -#define INDIC_STRIKE 4 -#define INDIC_HIDDEN 5 -#define INDIC_BOX 6 -#define INDIC_ROUNDBOX 7 -#define INDIC_MAX 31 -#define INDIC_CONTAINER 8 -#define INDIC0_MASK 0x20 -#define INDIC1_MASK 0x40 -#define INDIC2_MASK 0x80 -#define INDICS_MASK 0xE0 -#define SCI_INDICSETSTYLE 2080 -#define SCI_INDICGETSTYLE 2081 -#define SCI_INDICSETFORE 2082 -#define SCI_INDICGETFORE 2083 -#define SCI_INDICSETUNDER 2510 -#define SCI_INDICGETUNDER 2511 -#define SCI_SETWHITESPACEFORE 2084 -#define SCI_SETWHITESPACEBACK 2085 -#define SCI_SETSTYLEBITS 2090 -#define SCI_GETSTYLEBITS 2091 -#define SCI_SETLINESTATE 2092 -#define SCI_GETLINESTATE 2093 -#define SCI_GETMAXLINESTATE 2094 -#define SCI_GETCARETLINEVISIBLE 2095 -#define SCI_SETCARETLINEVISIBLE 2096 -#define SCI_GETCARETLINEBACK 2097 -#define SCI_SETCARETLINEBACK 2098 -#define SCI_STYLESETCHANGEABLE 2099 -#define SCI_AUTOCSHOW 2100 -#define SCI_AUTOCCANCEL 2101 -#define SCI_AUTOCACTIVE 2102 -#define SCI_AUTOCPOSSTART 2103 -#define SCI_AUTOCCOMPLETE 2104 -#define SCI_AUTOCSTOPS 2105 -#define SCI_AUTOCSETSEPARATOR 2106 -#define SCI_AUTOCGETSEPARATOR 2107 -#define SCI_AUTOCSELECT 2108 -#define SCI_AUTOCSETCANCELATSTART 2110 -#define SCI_AUTOCGETCANCELATSTART 2111 -#define SCI_AUTOCSETFILLUPS 2112 -#define SCI_AUTOCSETCHOOSESINGLE 2113 -#define SCI_AUTOCGETCHOOSESINGLE 2114 -#define SCI_AUTOCSETIGNORECASE 2115 -#define SCI_AUTOCGETIGNORECASE 2116 -#define SCI_USERLISTSHOW 2117 -#define SCI_AUTOCSETAUTOHIDE 2118 -#define SCI_AUTOCGETAUTOHIDE 2119 -#define SCI_AUTOCSETDROPRESTOFWORD 2270 -#define SCI_AUTOCGETDROPRESTOFWORD 2271 -#define SCI_REGISTERIMAGE 2405 -#define SCI_CLEARREGISTEREDIMAGES 2408 -#define SCI_AUTOCGETTYPESEPARATOR 2285 -#define SCI_AUTOCSETTYPESEPARATOR 2286 -#define SCI_AUTOCSETMAXWIDTH 2208 -#define SCI_AUTOCGETMAXWIDTH 2209 -#define SCI_AUTOCSETMAXHEIGHT 2210 -#define SCI_AUTOCGETMAXHEIGHT 2211 -#define SCI_SETINDENT 2122 -#define SCI_GETINDENT 2123 -#define SCI_SETUSETABS 2124 -#define SCI_GETUSETABS 2125 -#define SCI_SETLINEINDENTATION 2126 -#define SCI_GETLINEINDENTATION 2127 -#define SCI_GETLINEINDENTPOSITION 2128 -#define SCI_GETCOLUMN 2129 -#define SCI_SETHSCROLLBAR 2130 -#define SCI_GETHSCROLLBAR 2131 -#define SC_IV_NONE 0 -#define SC_IV_REAL 1 -#define SC_IV_LOOKFORWARD 2 -#define SC_IV_LOOKBOTH 3 -#define SCI_SETINDENTATIONGUIDES 2132 -#define SCI_GETINDENTATIONGUIDES 2133 -#define SCI_SETHIGHLIGHTGUIDE 2134 -#define SCI_GETHIGHLIGHTGUIDE 2135 -#define SCI_GETLINEENDPOSITION 2136 -#define SCI_GETCODEPAGE 2137 -#define SCI_GETCARETFORE 2138 -#define SCI_GETUSEPALETTE 2139 -#define SCI_GETREADONLY 2140 -#define SCI_SETCURRENTPOS 2141 -#define SCI_SETSELECTIONSTART 2142 -#define SCI_GETSELECTIONSTART 2143 -#define SCI_SETSELECTIONEND 2144 -#define SCI_GETSELECTIONEND 2145 -#define SCI_SETPRINTMAGNIFICATION 2146 -#define SCI_GETPRINTMAGNIFICATION 2147 -#define SC_PRINT_NORMAL 0 -#define SC_PRINT_INVERTLIGHT 1 -#define SC_PRINT_BLACKONWHITE 2 -#define SC_PRINT_COLOURONWHITE 3 -#define SC_PRINT_COLOURONWHITEDEFAULTBG 4 -#define SCI_SETPRINTCOLOURMODE 2148 -#define SCI_GETPRINTCOLOURMODE 2149 -#define SCFIND_WHOLEWORD 2 -#define SCFIND_MATCHCASE 4 -#define SCFIND_WORDSTART 0x00100000 -#define SCFIND_REGEXP 0x00200000 -#define SCFIND_POSIX 0x00400000 -#define SCI_FINDTEXT 2150 -#define SCI_FORMATRANGE 2151 -#define SCI_GETFIRSTVISIBLELINE 2152 -#define SCI_GETLINE 2153 -#define SCI_GETLINECOUNT 2154 -#define SCI_SETMARGINLEFT 2155 -#define SCI_GETMARGINLEFT 2156 -#define SCI_SETMARGINRIGHT 2157 -#define SCI_GETMARGINRIGHT 2158 -#define SCI_GETMODIFY 2159 -#define SCI_SETSEL 2160 -#define SCI_GETSELTEXT 2161 -#define SCI_GETTEXTRANGE 2162 -#define SCI_HIDESELECTION 2163 -#define SCI_POINTXFROMPOSITION 2164 -#define SCI_POINTYFROMPOSITION 2165 -#define SCI_LINEFROMPOSITION 2166 -#define SCI_POSITIONFROMLINE 2167 -#define SCI_LINESCROLL 2168 -#define SCI_SCROLLCARET 2169 -#define SCI_REPLACESEL 2170 -#define SCI_SETREADONLY 2171 -#define SCI_NULL 2172 -#define SCI_CANPASTE 2173 -#define SCI_CANUNDO 2174 -#define SCI_EMPTYUNDOBUFFER 2175 -#define SCI_UNDO 2176 -#define SCI_CUT 2177 -#define SCI_COPY 2178 -#define SCI_PASTE 2179 -#define SCI_CLEAR 2180 -#define SCI_SETTEXT 2181 -#define SCI_GETTEXT 2182 -#define SCI_GETTEXTLENGTH 2183 -#define SCI_GETDIRECTFUNCTION 2184 -#define SCI_GETDIRECTPOINTER 2185 -#define SCI_SETOVERTYPE 2186 -#define SCI_GETOVERTYPE 2187 -#define SCI_SETCARETWIDTH 2188 -#define SCI_GETCARETWIDTH 2189 -#define SCI_SETTARGETSTART 2190 -#define SCI_GETTARGETSTART 2191 -#define SCI_SETTARGETEND 2192 -#define SCI_GETTARGETEND 2193 -#define SCI_REPLACETARGET 2194 -#define SCI_REPLACETARGETRE 2195 -#define SCI_SEARCHINTARGET 2197 -#define SCI_SETSEARCHFLAGS 2198 -#define SCI_GETSEARCHFLAGS 2199 -#define SCI_CALLTIPSHOW 2200 -#define SCI_CALLTIPCANCEL 2201 -#define SCI_CALLTIPACTIVE 2202 -#define SCI_CALLTIPPOSSTART 2203 -#define SCI_CALLTIPSETHLT 2204 -#define SCI_CALLTIPSETBACK 2205 -#define SCI_CALLTIPSETFORE 2206 -#define SCI_CALLTIPSETFOREHLT 2207 -#define SCI_CALLTIPUSESTYLE 2212 -#define SCI_VISIBLEFROMDOCLINE 2220 -#define SCI_DOCLINEFROMVISIBLE 2221 -#define SCI_WRAPCOUNT 2235 -#define SC_FOLDLEVELBASE 0x400 -#define SC_FOLDLEVELWHITEFLAG 0x1000 -#define SC_FOLDLEVELHEADERFLAG 0x2000 -#define SC_FOLDLEVELBOXHEADERFLAG 0x4000 -#define SC_FOLDLEVELBOXFOOTERFLAG 0x8000 -#define SC_FOLDLEVELCONTRACTED 0x10000 -#define SC_FOLDLEVELUNINDENT 0x20000 -#define SC_FOLDLEVELNUMBERMASK 0x0FFF -#define SCI_SETFOLDLEVEL 2222 -#define SCI_GETFOLDLEVEL 2223 -#define SCI_GETLASTCHILD 2224 -#define SCI_GETFOLDPARENT 2225 -#define SCI_SHOWLINES 2226 -#define SCI_HIDELINES 2227 -#define SCI_GETLINEVISIBLE 2228 -#define SCI_SETFOLDEXPANDED 2229 -#define SCI_GETFOLDEXPANDED 2230 -#define SCI_TOGGLEFOLD 2231 -#define SCI_ENSUREVISIBLE 2232 -#define SC_FOLDFLAG_LINEBEFORE_EXPANDED 0x0002 -#define SC_FOLDFLAG_LINEBEFORE_CONTRACTED 0x0004 -#define SC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008 -#define SC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010 -#define SC_FOLDFLAG_LEVELNUMBERS 0x0040 -#define SC_FOLDFLAG_BOX 0x0001 -#define SCI_SETFOLDFLAGS 2233 -#define SCI_ENSUREVISIBLEENFORCEPOLICY 2234 -#define SCI_SETTABINDENTS 2260 -#define SCI_GETTABINDENTS 2261 -#define SCI_SETBACKSPACEUNINDENTS 2262 -#define SCI_GETBACKSPACEUNINDENTS 2263 -#define SC_TIME_FOREVER 10000000 -#define SCI_SETMOUSEDWELLTIME 2264 -#define SCI_GETMOUSEDWELLTIME 2265 -#define SCI_WORDSTARTPOSITION 2266 -#define SCI_WORDENDPOSITION 2267 -#define SC_WRAP_NONE 0 -#define SC_WRAP_WORD 1 -#define SC_WRAP_CHAR 2 -#define SCI_SETWRAPMODE 2268 -#define SCI_GETWRAPMODE 2269 -#define SC_WRAPVISUALFLAG_NONE 0x0000 -#define SC_WRAPVISUALFLAG_END 0x0001 -#define SC_WRAPVISUALFLAG_START 0x0002 -#define SCI_SETWRAPVISUALFLAGS 2460 -#define SCI_GETWRAPVISUALFLAGS 2461 -#define SC_WRAPVISUALFLAGLOC_DEFAULT 0x0000 -#define SC_WRAPVISUALFLAGLOC_END_BY_TEXT 0x0001 -#define SC_WRAPVISUALFLAGLOC_START_BY_TEXT 0x0002 -#define SCI_SETWRAPVISUALFLAGSLOCATION 2462 -#define SCI_GETWRAPVISUALFLAGSLOCATION 2463 -#define SCI_SETWRAPSTARTINDENT 2464 -#define SCI_GETWRAPSTARTINDENT 2465 -#define SC_CACHE_NONE 0 -#define SC_CACHE_CARET 1 -#define SC_CACHE_PAGE 2 -#define SC_CACHE_DOCUMENT 3 -#define SCI_SETLAYOUTCACHE 2272 -#define SCI_GETLAYOUTCACHE 2273 -#define SCI_SETSCROLLWIDTH 2274 -#define SCI_GETSCROLLWIDTH 2275 -#define SCI_SETSCROLLWIDTHTRACKING 2516 -#define SCI_GETSCROLLWIDTHTRACKING 2517 -#define SCI_TEXTWIDTH 2276 -#define SCI_SETENDATLASTLINE 2277 -#define SCI_GETENDATLASTLINE 2278 -#define SCI_TEXTHEIGHT 2279 -#define SCI_SETVSCROLLBAR 2280 -#define SCI_GETVSCROLLBAR 2281 -#define SCI_APPENDTEXT 2282 -#define SCI_GETTWOPHASEDRAW 2283 -#define SCI_SETTWOPHASEDRAW 2284 -#define SCI_TARGETFROMSELECTION 2287 -#define SCI_LINESJOIN 2288 -#define SCI_LINESSPLIT 2289 -#define SCI_SETFOLDMARGINCOLOUR 2290 -#define SCI_SETFOLDMARGINHICOLOUR 2291 -#define SCI_LINEDOWN 2300 -#define SCI_LINEDOWNEXTEND 2301 -#define SCI_LINEUP 2302 -#define SCI_LINEUPEXTEND 2303 -#define SCI_CHARLEFT 2304 -#define SCI_CHARLEFTEXTEND 2305 -#define SCI_CHARRIGHT 2306 -#define SCI_CHARRIGHTEXTEND 2307 -#define SCI_WORDLEFT 2308 -#define SCI_WORDLEFTEXTEND 2309 -#define SCI_WORDRIGHT 2310 -#define SCI_WORDRIGHTEXTEND 2311 -#define SCI_HOME 2312 -#define SCI_HOMEEXTEND 2313 -#define SCI_LINEEND 2314 -#define SCI_LINEENDEXTEND 2315 -#define SCI_DOCUMENTSTART 2316 -#define SCI_DOCUMENTSTARTEXTEND 2317 -#define SCI_DOCUMENTEND 2318 -#define SCI_DOCUMENTENDEXTEND 2319 -#define SCI_PAGEUP 2320 -#define SCI_PAGEUPEXTEND 2321 -#define SCI_PAGEDOWN 2322 -#define SCI_PAGEDOWNEXTEND 2323 -#define SCI_EDITTOGGLEOVERTYPE 2324 -#define SCI_CANCEL 2325 -#define SCI_DELETEBACK 2326 -#define SCI_TAB 2327 -#define SCI_BACKTAB 2328 -#define SCI_NEWLINE 2329 -#define SCI_FORMFEED 2330 -#define SCI_VCHOME 2331 -#define SCI_VCHOMEEXTEND 2332 -#define SCI_ZOOMIN 2333 -#define SCI_ZOOMOUT 2334 -#define SCI_DELWORDLEFT 2335 -#define SCI_DELWORDRIGHT 2336 -#define SCI_DELWORDRIGHTEND 2518 -#define SCI_LINECUT 2337 -#define SCI_LINEDELETE 2338 -#define SCI_LINETRANSPOSE 2339 -#define SCI_LINEDUPLICATE 2404 -#define SCI_LOWERCASE 2340 -#define SCI_UPPERCASE 2341 -#define SCI_LINESCROLLDOWN 2342 -#define SCI_LINESCROLLUP 2343 -#define SCI_DELETEBACKNOTLINE 2344 -#define SCI_HOMEDISPLAY 2345 -#define SCI_HOMEDISPLAYEXTEND 2346 -#define SCI_LINEENDDISPLAY 2347 -#define SCI_LINEENDDISPLAYEXTEND 2348 -#define SCI_HOMEWRAP 2349 -#define SCI_HOMEWRAPEXTEND 2450 -#define SCI_LINEENDWRAP 2451 -#define SCI_LINEENDWRAPEXTEND 2452 -#define SCI_VCHOMEWRAP 2453 -#define SCI_VCHOMEWRAPEXTEND 2454 -#define SCI_LINECOPY 2455 -#define SCI_MOVECARETINSIDEVIEW 2401 -#define SCI_LINELENGTH 2350 -#define SCI_BRACEHIGHLIGHT 2351 -#define SCI_BRACEBADLIGHT 2352 -#define SCI_BRACEMATCH 2353 -#define SCI_GETVIEWEOL 2355 -#define SCI_SETVIEWEOL 2356 -#define SCI_GETDOCPOINTER 2357 -#define SCI_SETDOCPOINTER 2358 -#define SCI_SETMODEVENTMASK 2359 -#define EDGE_NONE 0 -#define EDGE_LINE 1 -#define EDGE_BACKGROUND 2 -#define SCI_GETEDGECOLUMN 2360 -#define SCI_SETEDGECOLUMN 2361 -#define SCI_GETEDGEMODE 2362 -#define SCI_SETEDGEMODE 2363 -#define SCI_GETEDGECOLOUR 2364 -#define SCI_SETEDGECOLOUR 2365 -#define SCI_SEARCHANCHOR 2366 -#define SCI_SEARCHNEXT 2367 -#define SCI_SEARCHPREV 2368 -#define SCI_LINESONSCREEN 2370 -#define SCI_USEPOPUP 2371 -#define SCI_SELECTIONISRECTANGLE 2372 -#define SCI_SETZOOM 2373 -#define SCI_GETZOOM 2374 -#define SCI_CREATEDOCUMENT 2375 -#define SCI_ADDREFDOCUMENT 2376 -#define SCI_RELEASEDOCUMENT 2377 -#define SCI_GETMODEVENTMASK 2378 -#define SCI_SETFOCUS 2380 -#define SCI_GETFOCUS 2381 -#define SCI_SETSTATUS 2382 -#define SCI_GETSTATUS 2383 -#define SCI_SETMOUSEDOWNCAPTURES 2384 -#define SCI_GETMOUSEDOWNCAPTURES 2385 -#define SC_CURSORNORMAL -1 -#define SC_CURSORWAIT 4 -#define SCI_SETCURSOR 2386 -#define SCI_GETCURSOR 2387 -#define SCI_SETCONTROLCHARSYMBOL 2388 -#define SCI_GETCONTROLCHARSYMBOL 2389 -#define SCI_WORDPARTLEFT 2390 -#define SCI_WORDPARTLEFTEXTEND 2391 -#define SCI_WORDPARTRIGHT 2392 -#define SCI_WORDPARTRIGHTEXTEND 2393 -#define VISIBLE_SLOP 0x01 -#define VISIBLE_STRICT 0x04 -#define SCI_SETVISIBLEPOLICY 2394 -#define SCI_DELLINELEFT 2395 -#define SCI_DELLINERIGHT 2396 -#define SCI_SETXOFFSET 2397 -#define SCI_GETXOFFSET 2398 -#define SCI_CHOOSECARETX 2399 -#define SCI_GRABFOCUS 2400 -#define CARET_SLOP 0x01 -#define CARET_STRICT 0x04 -#define CARET_JUMPS 0x10 -#define CARET_EVEN 0x08 -#define SCI_SETXCARETPOLICY 2402 -#define SCI_SETYCARETPOLICY 2403 -#define SCI_SETPRINTWRAPMODE 2406 -#define SCI_GETPRINTWRAPMODE 2407 -#define SCI_SETHOTSPOTACTIVEFORE 2410 -#define SCI_GETHOTSPOTACTIVEFORE 2494 -#define SCI_SETHOTSPOTACTIVEBACK 2411 -#define SCI_GETHOTSPOTACTIVEBACK 2495 -#define SCI_SETHOTSPOTACTIVEUNDERLINE 2412 -#define SCI_GETHOTSPOTACTIVEUNDERLINE 2496 -#define SCI_SETHOTSPOTSINGLELINE 2421 -#define SCI_GETHOTSPOTSINGLELINE 2497 -#define SCI_PARADOWN 2413 -#define SCI_PARADOWNEXTEND 2414 -#define SCI_PARAUP 2415 -#define SCI_PARAUPEXTEND 2416 -#define SCI_POSITIONBEFORE 2417 -#define SCI_POSITIONAFTER 2418 -#define SCI_COPYRANGE 2419 -#define SCI_COPYTEXT 2420 -#define SC_SEL_STREAM 0 -#define SC_SEL_RECTANGLE 1 -#define SC_SEL_LINES 2 -#define SCI_SETSELECTIONMODE 2422 -#define SCI_GETSELECTIONMODE 2423 -#define SCI_GETLINESELSTARTPOSITION 2424 -#define SCI_GETLINESELENDPOSITION 2425 -#define SCI_LINEDOWNRECTEXTEND 2426 -#define SCI_LINEUPRECTEXTEND 2427 -#define SCI_CHARLEFTRECTEXTEND 2428 -#define SCI_CHARRIGHTRECTEXTEND 2429 -#define SCI_HOMERECTEXTEND 2430 -#define SCI_VCHOMERECTEXTEND 2431 -#define SCI_LINEENDRECTEXTEND 2432 -#define SCI_PAGEUPRECTEXTEND 2433 -#define SCI_PAGEDOWNRECTEXTEND 2434 -#define SCI_STUTTEREDPAGEUP 2435 -#define SCI_STUTTEREDPAGEUPEXTEND 2436 -#define SCI_STUTTEREDPAGEDOWN 2437 -#define SCI_STUTTEREDPAGEDOWNEXTEND 2438 -#define SCI_WORDLEFTEND 2439 -#define SCI_WORDLEFTENDEXTEND 2440 -#define SCI_WORDRIGHTEND 2441 -#define SCI_WORDRIGHTENDEXTEND 2442 -#define SCI_SETWHITESPACECHARS 2443 -#define SCI_SETCHARSDEFAULT 2444 -#define SCI_AUTOCGETCURRENT 2445 -#define SCI_ALLOCATE 2446 -#define SCI_TARGETASUTF8 2447 -#define SCI_SETLENGTHFORENCODE 2448 -#define SCI_ENCODEDFROMUTF8 2449 -#define SCI_FINDCOLUMN 2456 -#define SCI_GETCARETSTICKY 2457 -#define SCI_SETCARETSTICKY 2458 -#define SCI_TOGGLECARETSTICKY 2459 -#define SCI_SETPASTECONVERTENDINGS 2467 -#define SCI_GETPASTECONVERTENDINGS 2468 -#define SCI_SELECTIONDUPLICATE 2469 -#define SC_ALPHA_TRANSPARENT 0 -#define SC_ALPHA_OPAQUE 255 -#define SC_ALPHA_NOALPHA 256 -#define SCI_SETCARETLINEBACKALPHA 2470 -#define SCI_GETCARETLINEBACKALPHA 2471 -#define CARETSTYLE_INVISIBLE 0 -#define CARETSTYLE_LINE 1 -#define CARETSTYLE_BLOCK 2 -#define SCI_SETCARETSTYLE 2512 -#define SCI_GETCARETSTYLE 2513 -#define SCI_SETINDICATORCURRENT 2500 -#define SCI_GETINDICATORCURRENT 2501 -#define SCI_SETINDICATORVALUE 2502 -#define SCI_GETINDICATORVALUE 2503 -#define SCI_INDICATORFILLRANGE 2504 -#define SCI_INDICATORCLEARRANGE 2505 -#define SCI_INDICATORALLONFOR 2506 -#define SCI_INDICATORVALUEAT 2507 -#define SCI_INDICATORSTART 2508 -#define SCI_INDICATOREND 2509 -#define SCI_SETPOSITIONCACHE 2514 -#define SCI_GETPOSITIONCACHE 2515 -#define SCI_COPYALLOWLINE 2519 -#define SCI_STARTRECORD 3001 -#define SCI_STOPRECORD 3002 -#define SCI_SETLEXER 4001 -#define SCI_GETLEXER 4002 -#define SCI_COLOURISE 4003 -#define SCI_SETPROPERTY 4004 -#define KEYWORDSET_MAX 8 -#define SCI_SETKEYWORDS 4005 -#define SCI_SETLEXERLANGUAGE 4006 -#define SCI_LOADLEXERLIBRARY 4007 -#define SCI_GETPROPERTY 4008 -#define SCI_GETPROPERTYEXPANDED 4009 -#define SCI_GETPROPERTYINT 4010 -#define SCI_GETSTYLEBITSNEEDED 4011 -#define SC_MOD_INSERTTEXT 0x1 -#define SC_MOD_DELETETEXT 0x2 -#define SC_MOD_CHANGESTYLE 0x4 -#define SC_MOD_CHANGEFOLD 0x8 -#define SC_PERFORMED_USER 0x10 -#define SC_PERFORMED_UNDO 0x20 -#define SC_PERFORMED_REDO 0x40 -#define SC_MULTISTEPUNDOREDO 0x80 -#define SC_LASTSTEPINUNDOREDO 0x100 -#define SC_MOD_CHANGEMARKER 0x200 -#define SC_MOD_BEFOREINSERT 0x400 -#define SC_MOD_BEFOREDELETE 0x800 -#define SC_MULTILINEUNDOREDO 0x1000 -#define SC_STARTACTION 0x2000 -#define SC_MOD_CHANGEINDICATOR 0x4000 -#define SC_MOD_CHANGELINESTATE 0x8000 -#define SC_MODEVENTMASKALL 0xFFFF -#define SCEN_CHANGE 768 -#define SCEN_SETFOCUS 512 -#define SCEN_KILLFOCUS 256 -#define SCK_DOWN 300 -#define SCK_UP 301 -#define SCK_LEFT 302 -#define SCK_RIGHT 303 -#define SCK_HOME 304 -#define SCK_END 305 -#define SCK_PRIOR 306 -#define SCK_NEXT 307 -#define SCK_DELETE 308 -#define SCK_INSERT 309 -#define SCK_ESCAPE 7 -#define SCK_BACK 8 -#define SCK_TAB 9 -#define SCK_RETURN 13 -#define SCK_ADD 310 -#define SCK_SUBTRACT 311 -#define SCK_DIVIDE 312 -#define SCK_WIN 313 -#define SCK_RWIN 314 -#define SCK_MENU 315 -#define SCMOD_NORM 0 -#define SCMOD_SHIFT 1 -#define SCMOD_CTRL 2 -#define SCMOD_ALT 4 -#define SCN_STYLENEEDED 2000 -#define SCN_CHARADDED 2001 -#define SCN_SAVEPOINTREACHED 2002 -#define SCN_SAVEPOINTLEFT 2003 -#define SCN_MODIFYATTEMPTRO 2004 -#define SCN_KEY 2005 -#define SCN_DOUBLECLICK 2006 -#define SCN_UPDATEUI 2007 -#define SCN_MODIFIED 2008 -#define SCN_MACRORECORD 2009 -#define SCN_MARGINCLICK 2010 -#define SCN_NEEDSHOWN 2011 -#define SCN_PAINTED 2013 -#define SCN_USERLISTSELECTION 2014 -#define SCN_URIDROPPED 2015 -#define SCN_DWELLSTART 2016 -#define SCN_DWELLEND 2017 -#define SCN_ZOOM 2018 -#define SCN_HOTSPOTCLICK 2019 -#define SCN_HOTSPOTDOUBLECLICK 2020 -#define SCN_CALLTIPCLICK 2021 -#define SCN_AUTOCSELECTION 2022 -#define SCN_INDICATORCLICK 2023 -#define SCN_INDICATORRELEASE 2024 -//--Autogenerated -- end of section automatically generated from Scintilla.iface - -// These structures are defined to be exactly the same shape as the Win32 -// CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs. -// So older code that treats Scintilla as a RichEdit will work. - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -struct CharacterRange { - long cpMin; - long cpMax; -}; - -struct TextRange { - struct CharacterRange chrg; - char *lpstrText; -}; - -struct TextToFind { - struct CharacterRange chrg; - char *lpstrText; - struct CharacterRange chrgText; -}; - -#ifdef PLATFORM_H - -// This structure is used in printing and requires some of the graphics types -// from Platform.h. Not needed by most client code. - -struct RangeToFormat { - SurfaceID hdc; - SurfaceID hdcTarget; - PRectangle rc; - PRectangle rcPage; - CharacterRange chrg; -}; - -#endif - -struct NotifyHeader { - // Compatible with Windows NMHDR. - // hwndFrom is really an environment specific window handle or pointer - // but most clients of Scintilla.h do not have this type visible. - void *hwndFrom; - uptr_t idFrom; - unsigned int code; -}; - -struct SCNotification { - struct NotifyHeader nmhdr; - int position; // SCN_STYLENEEDED, SCN_MODIFIED, SCN_DWELLSTART, SCN_DWELLEND - int ch; // SCN_CHARADDED, SCN_KEY - int modifiers; // SCN_KEY - int modificationType; // SCN_MODIFIED - const char *text; // SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION - int length; // SCN_MODIFIED - int linesAdded; // SCN_MODIFIED - int message; // SCN_MACRORECORD - uptr_t wParam; // SCN_MACRORECORD - sptr_t lParam; // SCN_MACRORECORD - int line; // SCN_MODIFIED - int foldLevelNow; // SCN_MODIFIED - int foldLevelPrev; // SCN_MODIFIED - int margin; // SCN_MARGINCLICK - int listType; // SCN_USERLISTSELECTION - int x; // SCN_DWELLSTART, SCN_DWELLEND - int y; // SCN_DWELLSTART, SCN_DWELLEND -}; - -#ifdef SCI_NAMESPACE -} -#endif - -// Deprecation section listing all API features that are deprecated and will -// will be removed completely in a future version. -// To enable these features define INCLUDE_DEPRECATED_FEATURES - -#ifdef INCLUDE_DEPRECATED_FEATURES - -#define SCI_SETCARETPOLICY 2369 -#define CARET_CENTER 0x02 -#define CARET_XEVEN 0x08 -#define CARET_XJUMPS 0x10 - -#define SCN_POSCHANGED 2012 -#define SCN_CHECKBRACE 2007 - -#endif - -#endif +/* Scintilla source code edit control */ +/** @file Scintilla.h + ** Interface to the edit control. + **/ +/* Copyright 1998-2003 by Neil Hodgson + * The License.txt file describes the conditions under which this software may be distributed. */ + +/* Most of this file is automatically generated from the Scintilla.iface interface definition + * file which contains any comments about the definitions. HFacer.py does the generation. */ + +#ifndef SCINTILLA_H +#define SCINTILLA_H + +#if LCCWIN +typedef BOOL bool; +#endif + +#if PLAT_WIN +/* Return false on failure: */ +bool Scintilla_RegisterClasses(void *hInstance); +bool Scintilla_ReleaseResources(); +#endif +int Scintilla_LinkLexers(); + +/* Here should be placed typedefs for uptr_t, an unsigned integer type large enough to + * hold a pointer and sptr_t, a signed integer large enough to hold a pointer. + * May need to be changed for 64 bit platforms. */ +#if defined(_WIN32) +#include +#endif +#ifdef MAXULONG_PTR +typedef ULONG_PTR uptr_t; +typedef LONG_PTR sptr_t; +#else +typedef unsigned long uptr_t; +typedef long sptr_t; +#endif + +typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam); + +/* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ +#define INVALID_POSITION -1 +#define SCI_START 2000 +#define SCI_OPTIONAL_START 3000 +#define SCI_LEXER_START 4000 +#define SCI_ADDTEXT 2001 +#define SCI_ADDSTYLEDTEXT 2002 +#define SCI_INSERTTEXT 2003 +#define SCI_CLEARALL 2004 +#define SCI_CLEARDOCUMENTSTYLE 2005 +#define SCI_GETLENGTH 2006 +#define SCI_GETCHARAT 2007 +#define SCI_GETCURRENTPOS 2008 +#define SCI_GETANCHOR 2009 +#define SCI_GETSTYLEAT 2010 +#define SCI_REDO 2011 +#define SCI_SETUNDOCOLLECTION 2012 +#define SCI_SELECTALL 2013 +#define SCI_SETSAVEPOINT 2014 +#define SCI_GETSTYLEDTEXT 2015 +#define SCI_CANREDO 2016 +#define SCI_MARKERLINEFROMHANDLE 2017 +#define SCI_MARKERDELETEHANDLE 2018 +#define SCI_GETUNDOCOLLECTION 2019 +#define SCWS_INVISIBLE 0 +#define SCWS_VISIBLEALWAYS 1 +#define SCWS_VISIBLEAFTERINDENT 2 +#define SCI_GETVIEWWS 2020 +#define SCI_SETVIEWWS 2021 +#define SCI_POSITIONFROMPOINT 2022 +#define SCI_POSITIONFROMPOINTCLOSE 2023 +#define SCI_GOTOLINE 2024 +#define SCI_GOTOPOS 2025 +#define SCI_SETANCHOR 2026 +#define SCI_GETCURLINE 2027 +#define SCI_GETENDSTYLED 2028 +#define SC_EOL_CRLF 0 +#define SC_EOL_CR 1 +#define SC_EOL_LF 2 +#define SCI_CONVERTEOLS 2029 +#define SCI_GETEOLMODE 2030 +#define SCI_SETEOLMODE 2031 +#define SCI_STARTSTYLING 2032 +#define SCI_SETSTYLING 2033 +#define SCI_GETBUFFEREDDRAW 2034 +#define SCI_SETBUFFEREDDRAW 2035 +#define SCI_SETTABWIDTH 2036 +#define SCI_GETTABWIDTH 2121 +#define SC_CP_UTF8 65001 +#define SC_CP_DBCS 1 +#define SCI_SETCODEPAGE 2037 +#define SCI_SETUSEPALETTE 2039 +#define MARKER_MAX 31 +#define SC_MARK_CIRCLE 0 +#define SC_MARK_ROUNDRECT 1 +#define SC_MARK_ARROW 2 +#define SC_MARK_SMALLRECT 3 +#define SC_MARK_SHORTARROW 4 +#define SC_MARK_EMPTY 5 +#define SC_MARK_ARROWDOWN 6 +#define SC_MARK_MINUS 7 +#define SC_MARK_PLUS 8 +#define SC_MARK_VLINE 9 +#define SC_MARK_LCORNER 10 +#define SC_MARK_TCORNER 11 +#define SC_MARK_BOXPLUS 12 +#define SC_MARK_BOXPLUSCONNECTED 13 +#define SC_MARK_BOXMINUS 14 +#define SC_MARK_BOXMINUSCONNECTED 15 +#define SC_MARK_LCORNERCURVE 16 +#define SC_MARK_TCORNERCURVE 17 +#define SC_MARK_CIRCLEPLUS 18 +#define SC_MARK_CIRCLEPLUSCONNECTED 19 +#define SC_MARK_CIRCLEMINUS 20 +#define SC_MARK_CIRCLEMINUSCONNECTED 21 +#define SC_MARK_BACKGROUND 22 +#define SC_MARK_DOTDOTDOT 23 +#define SC_MARK_ARROWS 24 +#define SC_MARK_PIXMAP 25 +#define SC_MARK_FULLRECT 26 +#define SC_MARK_LEFTRECT 27 +#define SC_MARK_AVAILABLE 28 +#define SC_MARK_UNDERLINE 29 +#define SC_MARK_ARROW_IN_BOX 100 +#define SC_MARK_ARROWDOWN_IN_BOX 101 +#define SC_MARK_FULLRECT_TAIL 102 +#define SC_MARK_PLUS_IN_BOX 103 +#define SC_MARK_MINUS_IN_BOX 104 + +#define SC_MARK_CHARACTER 10000 +#define SC_MARKNUM_FOLDEREND 25 +#define SC_MARKNUM_FOLDEROPENMID 26 +#define SC_MARKNUM_FOLDERMIDTAIL 27 +#define SC_MARKNUM_FOLDERTAIL 28 +#define SC_MARKNUM_FOLDERSUB 29 +#define SC_MARKNUM_FOLDER 30 +#define SC_MARKNUM_FOLDEROPEN 31 +#define SC_MASK_FOLDERS 0xFE000000 +#define SCI_MARKERDEFINE 2040 +#define SCI_MARKERSETFORE 2041 +#define SCI_MARKERSETBACK 2042 +#define SCI_MARKERADD 2043 +#define SCI_MARKERDELETE 2044 +#define SCI_MARKERDELETEALL 2045 +#define SCI_MARKERGET 2046 +#define SCI_MARKERNEXT 2047 +#define SCI_MARKERPREVIOUS 2048 +#define SCI_MARKERDEFINEPIXMAP 2049 +#define SCI_MARKERADDSET 2466 +#define SCI_MARKERSETALPHA 2476 +#define SC_MARGIN_SYMBOL 0 +#define SC_MARGIN_NUMBER 1 +#define SC_MARGIN_BACK 2 +#define SC_MARGIN_FORE 3 +#define SC_MARGIN_TEXT 4 +#define SC_MARGIN_RTEXT 5 +#define SCI_SETMARGINTYPEN 2240 +#define SCI_GETMARGINTYPEN 2241 +#define SCI_SETMARGINWIDTHN 2242 +#define SCI_GETMARGINWIDTHN 2243 +#define SCI_SETMARGINMASKN 2244 +#define SCI_GETMARGINMASKN 2245 +#define SCI_SETMARGINSENSITIVEN 2246 +#define SCI_GETMARGINSENSITIVEN 2247 +#define STYLE_DEFAULT 32 +#define STYLE_LINENUMBER 33 +#define STYLE_BRACELIGHT 34 +#define STYLE_BRACEBAD 35 +#define STYLE_CONTROLCHAR 36 +#define STYLE_INDENTGUIDE 37 +#define STYLE_CALLTIP 38 +#define STYLE_LASTPREDEFINED 39 +#define STYLE_MAX 255 +#define SC_CHARSET_ANSI 0 +#define SC_CHARSET_DEFAULT 1 +#define SC_CHARSET_BALTIC 186 +#define SC_CHARSET_CHINESEBIG5 136 +#define SC_CHARSET_EASTEUROPE 238 +#define SC_CHARSET_GB2312 134 +#define SC_CHARSET_GREEK 161 +#define SC_CHARSET_HANGUL 129 +#define SC_CHARSET_MAC 77 +#define SC_CHARSET_OEM 255 +#define SC_CHARSET_RUSSIAN 204 +#define SC_CHARSET_CYRILLIC 1251 +#define SC_CHARSET_SHIFTJIS 128 +#define SC_CHARSET_SYMBOL 2 +#define SC_CHARSET_TURKISH 162 +#define SC_CHARSET_JOHAB 130 +#define SC_CHARSET_HEBREW 177 +#define SC_CHARSET_ARABIC 178 +#define SC_CHARSET_VIETNAMESE 163 +#define SC_CHARSET_THAI 222 +#define SC_CHARSET_8859_15 1000 +#define SCI_STYLECLEARALL 2050 +#define SCI_STYLESETFORE 2051 +#define SCI_STYLESETBACK 2052 +#define SCI_STYLESETBOLD 2053 +#define SCI_STYLESETITALIC 2054 +#define SCI_STYLESETSIZE 2055 +#define SCI_STYLESETFONT 2056 +#define SCI_STYLESETEOLFILLED 2057 +#define SCI_STYLERESETDEFAULT 2058 +#define SCI_STYLESETUNDERLINE 2059 +#define SC_CASE_MIXED 0 +#define SC_CASE_UPPER 1 +#define SC_CASE_LOWER 2 +#define SCI_STYLEGETFORE 2481 +#define SCI_STYLEGETBACK 2482 +#define SCI_STYLEGETBOLD 2483 +#define SCI_STYLEGETITALIC 2484 +#define SCI_STYLEGETSIZE 2485 +#define SCI_STYLEGETFONT 2486 +#define SCI_STYLEGETEOLFILLED 2487 +#define SCI_STYLEGETUNDERLINE 2488 +#define SCI_STYLEGETCASE 2489 +#define SCI_STYLEGETCHARACTERSET 2490 +#define SCI_STYLEGETVISIBLE 2491 +#define SCI_STYLEGETCHANGEABLE 2492 +#define SCI_STYLEGETHOTSPOT 2493 +#define SCI_STYLESETCASE 2060 +#define SCI_STYLESETCHARACTERSET 2066 +#define SCI_STYLESETHOTSPOT 2409 +#define SCI_SETSELFORE 2067 +#define SCI_SETSELBACK 2068 +#define SCI_GETSELALPHA 2477 +#define SCI_SETSELALPHA 2478 +#define SCI_GETSELEOLFILLED 2479 +#define SCI_SETSELEOLFILLED 2480 +#define SCI_SETCARETFORE 2069 +#define SCI_ASSIGNCMDKEY 2070 +#define SCI_CLEARCMDKEY 2071 +#define SCI_CLEARALLCMDKEYS 2072 +#define SCI_SETSTYLINGEX 2073 +#define SCI_STYLESETVISIBLE 2074 +#define SCI_GETCARETPERIOD 2075 +#define SCI_SETCARETPERIOD 2076 +#define SCI_SETWORDCHARS 2077 +#define SCI_BEGINUNDOACTION 2078 +#define SCI_ENDUNDOACTION 2079 +#define INDIC_PLAIN 0 +#define INDIC_SQUIGGLE 1 +#define INDIC_TT 2 +#define INDIC_DIAGONAL 3 +#define INDIC_STRIKE 4 +#define INDIC_HIDDEN 5 +#define INDIC_BOX 6 +#define INDIC_ROUNDBOX 7 +#define INDIC_MAX 31 +#define INDIC_CONTAINER 8 +#define INDIC0_MASK 0x20 +#define INDIC1_MASK 0x40 +#define INDIC2_MASK 0x80 +#define INDICS_MASK 0xE0 +#define SCI_INDICSETSTYLE 2080 +#define SCI_INDICGETSTYLE 2081 +#define SCI_INDICSETFORE 2082 +#define SCI_INDICGETFORE 2083 +#define SCI_INDICSETUNDER 2510 +#define SCI_INDICGETUNDER 2511 +#define SCI_SETWHITESPACEFORE 2084 +#define SCI_SETWHITESPACEBACK 2085 +#define SCI_SETSTYLEBITS 2090 +#define SCI_GETSTYLEBITS 2091 +#define SCI_SETLINESTATE 2092 +#define SCI_GETLINESTATE 2093 +#define SCI_GETMAXLINESTATE 2094 +#define SCI_GETCARETLINEVISIBLE 2095 +#define SCI_SETCARETLINEVISIBLE 2096 +#define SCI_GETCARETLINEBACK 2097 +#define SCI_SETCARETLINEBACK 2098 +#define SCI_STYLESETCHANGEABLE 2099 +#define SCI_AUTOCSHOW 2100 +#define SCI_AUTOCCANCEL 2101 +#define SCI_AUTOCACTIVE 2102 +#define SCI_AUTOCPOSSTART 2103 +#define SCI_AUTOCCOMPLETE 2104 +#define SCI_AUTOCSTOPS 2105 +#define SCI_AUTOCSETSEPARATOR 2106 +#define SCI_AUTOCGETSEPARATOR 2107 +#define SCI_AUTOCSELECT 2108 +#define SCI_AUTOCSETCANCELATSTART 2110 +#define SCI_AUTOCGETCANCELATSTART 2111 +#define SCI_AUTOCSETFILLUPS 2112 +#define SCI_AUTOCSETCHOOSESINGLE 2113 +#define SCI_AUTOCGETCHOOSESINGLE 2114 +#define SCI_AUTOCSETIGNORECASE 2115 +#define SCI_AUTOCGETIGNORECASE 2116 +#define SCI_USERLISTSHOW 2117 +#define SCI_AUTOCSETAUTOHIDE 2118 +#define SCI_AUTOCGETAUTOHIDE 2119 +#define SCI_AUTOCSETDROPRESTOFWORD 2270 +#define SCI_AUTOCGETDROPRESTOFWORD 2271 +#define SCI_REGISTERIMAGE 2405 +#define SCI_CLEARREGISTEREDIMAGES 2408 +#define SCI_AUTOCGETTYPESEPARATOR 2285 +#define SCI_AUTOCSETTYPESEPARATOR 2286 +#define SCI_AUTOCSETMAXWIDTH 2208 +#define SCI_AUTOCGETMAXWIDTH 2209 +#define SCI_AUTOCSETMAXHEIGHT 2210 +#define SCI_AUTOCGETMAXHEIGHT 2211 +#define SCI_SETINDENT 2122 +#define SCI_GETINDENT 2123 +#define SCI_SETUSETABS 2124 +#define SCI_GETUSETABS 2125 +#define SCI_SETLINEINDENTATION 2126 +#define SCI_GETLINEINDENTATION 2127 +#define SCI_GETLINEINDENTPOSITION 2128 +#define SCI_GETCOLUMN 2129 +#define SCI_SETHSCROLLBAR 2130 +#define SCI_GETHSCROLLBAR 2131 +#define SC_IV_NONE 0 +#define SC_IV_REAL 1 +#define SC_IV_LOOKFORWARD 2 +#define SC_IV_LOOKBOTH 3 +#define SCI_SETINDENTATIONGUIDES 2132 +#define SCI_GETINDENTATIONGUIDES 2133 +#define SCI_SETHIGHLIGHTGUIDE 2134 +#define SCI_GETHIGHLIGHTGUIDE 2135 +#define SCI_GETLINEENDPOSITION 2136 +#define SCI_GETCODEPAGE 2137 +#define SCI_GETCARETFORE 2138 +#define SCI_GETUSEPALETTE 2139 +#define SCI_GETREADONLY 2140 +#define SCI_SETCURRENTPOS 2141 +#define SCI_SETSELECTIONSTART 2142 +#define SCI_GETSELECTIONSTART 2143 +#define SCI_SETSELECTIONEND 2144 +#define SCI_GETSELECTIONEND 2145 +#define SCI_SETPRINTMAGNIFICATION 2146 +#define SCI_GETPRINTMAGNIFICATION 2147 +#define SC_PRINT_NORMAL 0 +#define SC_PRINT_INVERTLIGHT 1 +#define SC_PRINT_BLACKONWHITE 2 +#define SC_PRINT_COLOURONWHITE 3 +#define SC_PRINT_COLOURONWHITEDEFAULTBG 4 +#define SCI_SETPRINTCOLOURMODE 2148 +#define SCI_GETPRINTCOLOURMODE 2149 +#define SCFIND_WHOLEWORD 2 +#define SCFIND_MATCHCASE 4 +#define SCFIND_WORDSTART 0x00100000 +#define SCFIND_REGEXP 0x00200000 +#define SCFIND_POSIX 0x00400000 +#define SCI_FINDTEXT 2150 +#define SCI_FORMATRANGE 2151 +#define SCI_GETFIRSTVISIBLELINE 2152 +#define SCI_GETLINE 2153 +#define SCI_GETLINECOUNT 2154 +#define SCI_SETMARGINLEFT 2155 +#define SCI_GETMARGINLEFT 2156 +#define SCI_SETMARGINRIGHT 2157 +#define SCI_GETMARGINRIGHT 2158 +#define SCI_GETMODIFY 2159 +#define SCI_SETSEL 2160 +#define SCI_GETSELTEXT 2161 +#define SCI_GETTEXTRANGE 2162 +#define SCI_HIDESELECTION 2163 +#define SCI_POINTXFROMPOSITION 2164 +#define SCI_POINTYFROMPOSITION 2165 +#define SCI_LINEFROMPOSITION 2166 +#define SCI_POSITIONFROMLINE 2167 +#define SCI_LINESCROLL 2168 +#define SCI_SCROLLCARET 2169 +#define SCI_REPLACESEL 2170 +#define SCI_SETREADONLY 2171 +#define SCI_NULL 2172 +#define SCI_CANPASTE 2173 +#define SCI_CANUNDO 2174 +#define SCI_EMPTYUNDOBUFFER 2175 +#define SCI_UNDO 2176 +#define SCI_CUT 2177 +#define SCI_COPY 2178 +#define SCI_PASTE 2179 +#define SCI_CLEAR 2180 +#define SCI_SETTEXT 2181 +#define SCI_GETTEXT 2182 +#define SCI_GETTEXTLENGTH 2183 +#define SCI_GETDIRECTFUNCTION 2184 +#define SCI_GETDIRECTPOINTER 2185 +#define SCI_SETOVERTYPE 2186 +#define SCI_GETOVERTYPE 2187 +#define SCI_SETCARETWIDTH 2188 +#define SCI_GETCARETWIDTH 2189 +#define SCI_SETTARGETSTART 2190 +#define SCI_GETTARGETSTART 2191 +#define SCI_SETTARGETEND 2192 +#define SCI_GETTARGETEND 2193 +#define SCI_REPLACETARGET 2194 +#define SCI_REPLACETARGETRE 2195 +#define SCI_SEARCHINTARGET 2197 +#define SCI_SETSEARCHFLAGS 2198 +#define SCI_GETSEARCHFLAGS 2199 +#define SCI_CALLTIPSHOW 2200 +#define SCI_CALLTIPCANCEL 2201 +#define SCI_CALLTIPACTIVE 2202 +#define SCI_CALLTIPPOSSTART 2203 +#define SCI_CALLTIPSETHLT 2204 +#define SCI_CALLTIPSETBACK 2205 +#define SCI_CALLTIPSETFORE 2206 +#define SCI_CALLTIPSETFOREHLT 2207 +#define SCI_CALLTIPUSESTYLE 2212 +#define SCI_VISIBLEFROMDOCLINE 2220 +#define SCI_DOCLINEFROMVISIBLE 2221 +#define SCI_WRAPCOUNT 2235 +#define SC_FOLDLEVELBASE 0x400 +#define SC_FOLDLEVELWHITEFLAG 0x1000 +#define SC_FOLDLEVELHEADERFLAG 0x2000 +#define SC_FOLDLEVELNUMBERMASK 0x0FFF +#define SCI_SETFOLDLEVEL 2222 +#define SCI_GETFOLDLEVEL 2223 +#define SCI_GETLASTCHILD 2224 +#define SCI_GETFOLDPARENT 2225 +#define SCI_SHOWLINES 2226 +#define SCI_HIDELINES 2227 +#define SCI_GETLINEVISIBLE 2228 +#define SCI_SETFOLDEXPANDED 2229 +#define SCI_GETFOLDEXPANDED 2230 +#define SCI_TOGGLEFOLD 2231 +#define SCI_ENSUREVISIBLE 2232 +#define SC_FOLDFLAG_LINEBEFORE_EXPANDED 0x0002 +#define SC_FOLDFLAG_LINEBEFORE_CONTRACTED 0x0004 +#define SC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008 +#define SC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010 +#define SC_FOLDFLAG_LEVELNUMBERS 0x0040 +#define SCI_SETFOLDFLAGS 2233 +#define SCI_ENSUREVISIBLEENFORCEPOLICY 2234 +#define SCI_SETTABINDENTS 2260 +#define SCI_GETTABINDENTS 2261 +#define SCI_SETBACKSPACEUNINDENTS 2262 +#define SCI_GETBACKSPACEUNINDENTS 2263 +#define SC_TIME_FOREVER 10000000 +#define SCI_SETMOUSEDWELLTIME 2264 +#define SCI_GETMOUSEDWELLTIME 2265 +#define SCI_WORDSTARTPOSITION 2266 +#define SCI_WORDENDPOSITION 2267 +#define SC_WRAP_NONE 0 +#define SC_WRAP_WORD 1 +#define SC_WRAP_CHAR 2 +#define SCI_SETWRAPMODE 2268 +#define SCI_GETWRAPMODE 2269 +#define SC_WRAPVISUALFLAG_NONE 0x0000 +#define SC_WRAPVISUALFLAG_END 0x0001 +#define SC_WRAPVISUALFLAG_START 0x0002 +#define SCI_SETWRAPVISUALFLAGS 2460 +#define SCI_GETWRAPVISUALFLAGS 2461 +#define SC_WRAPVISUALFLAGLOC_DEFAULT 0x0000 +#define SC_WRAPVISUALFLAGLOC_END_BY_TEXT 0x0001 +#define SC_WRAPVISUALFLAGLOC_START_BY_TEXT 0x0002 +#define SCI_SETWRAPVISUALFLAGSLOCATION 2462 +#define SCI_GETWRAPVISUALFLAGSLOCATION 2463 +#define SCI_SETWRAPSTARTINDENT 2464 +#define SCI_GETWRAPSTARTINDENT 2465 +#define SC_WRAPINDENT_FIXED 0 +#define SC_WRAPINDENT_SAME 1 +#define SC_WRAPINDENT_INDENT 2 +#define SCI_SETWRAPINDENTMODE 2472 +#define SCI_GETWRAPINDENTMODE 2473 +#define SC_CACHE_NONE 0 +#define SC_CACHE_CARET 1 +#define SC_CACHE_PAGE 2 +#define SC_CACHE_DOCUMENT 3 +#define SCI_SETLAYOUTCACHE 2272 +#define SCI_GETLAYOUTCACHE 2273 +#define SCI_SETSCROLLWIDTH 2274 +#define SCI_GETSCROLLWIDTH 2275 +#define SCI_SETSCROLLWIDTHTRACKING 2516 +#define SCI_GETSCROLLWIDTHTRACKING 2517 +#define SCI_TEXTWIDTH 2276 +#define SCI_SETENDATLASTLINE 2277 +#define SCI_GETENDATLASTLINE 2278 +#define SCI_TEXTHEIGHT 2279 +#define SCI_SETVSCROLLBAR 2280 +#define SCI_GETVSCROLLBAR 2281 +#define SCI_APPENDTEXT 2282 +#define SCI_GETTWOPHASEDRAW 2283 +#define SCI_SETTWOPHASEDRAW 2284 +#define SCI_TARGETFROMSELECTION 2287 +#define SCI_LINESJOIN 2288 +#define SCI_LINESSPLIT 2289 +#define SCI_SETFOLDMARGINCOLOUR 2290 +#define SCI_SETFOLDMARGINHICOLOUR 2291 +#define SCI_LINEDOWN 2300 +#define SCI_LINEDOWNEXTEND 2301 +#define SCI_LINEUP 2302 +#define SCI_LINEUPEXTEND 2303 +#define SCI_CHARLEFT 2304 +#define SCI_CHARLEFTEXTEND 2305 +#define SCI_CHARRIGHT 2306 +#define SCI_CHARRIGHTEXTEND 2307 +#define SCI_WORDLEFT 2308 +#define SCI_WORDLEFTEXTEND 2309 +#define SCI_WORDRIGHT 2310 +#define SCI_WORDRIGHTEXTEND 2311 +#define SCI_HOME 2312 +#define SCI_HOMEEXTEND 2313 +#define SCI_LINEEND 2314 +#define SCI_LINEENDEXTEND 2315 +#define SCI_DOCUMENTSTART 2316 +#define SCI_DOCUMENTSTARTEXTEND 2317 +#define SCI_DOCUMENTEND 2318 +#define SCI_DOCUMENTENDEXTEND 2319 +#define SCI_PAGEUP 2320 +#define SCI_PAGEUPEXTEND 2321 +#define SCI_PAGEDOWN 2322 +#define SCI_PAGEDOWNEXTEND 2323 +#define SCI_EDITTOGGLEOVERTYPE 2324 +#define SCI_CANCEL 2325 +#define SCI_DELETEBACK 2326 +#define SCI_TAB 2327 +#define SCI_BACKTAB 2328 +#define SCI_NEWLINE 2329 +#define SCI_FORMFEED 2330 +#define SCI_VCHOME 2331 +#define SCI_VCHOMEEXTEND 2332 +#define SCI_ZOOMIN 2333 +#define SCI_ZOOMOUT 2334 +#define SCI_DELWORDLEFT 2335 +#define SCI_DELWORDRIGHT 2336 +#define SCI_DELWORDRIGHTEND 2518 +#define SCI_LINECUT 2337 +#define SCI_LINEDELETE 2338 +#define SCI_LINETRANSPOSE 2339 +#define SCI_LINEDUPLICATE 2404 +#define SCI_LOWERCASE 2340 +#define SCI_UPPERCASE 2341 +#define SCI_LINESCROLLDOWN 2342 +#define SCI_LINESCROLLUP 2343 +#define SCI_DELETEBACKNOTLINE 2344 +#define SCI_HOMEDISPLAY 2345 +#define SCI_HOMEDISPLAYEXTEND 2346 +#define SCI_LINEENDDISPLAY 2347 +#define SCI_LINEENDDISPLAYEXTEND 2348 +#define SCI_HOMEWRAP 2349 +#define SCI_HOMEWRAPEXTEND 2450 +#define SCI_LINEENDWRAP 2451 +#define SCI_LINEENDWRAPEXTEND 2452 +#define SCI_VCHOMEWRAP 2453 +#define SCI_VCHOMEWRAPEXTEND 2454 +#define SCI_LINECOPY 2455 +#define SCI_MOVECARETINSIDEVIEW 2401 +#define SCI_LINELENGTH 2350 +#define SCI_BRACEHIGHLIGHT 2351 +#define SCI_BRACEBADLIGHT 2352 +#define SCI_BRACEMATCH 2353 +#define SCI_GETVIEWEOL 2355 +#define SCI_SETVIEWEOL 2356 +#define SCI_GETDOCPOINTER 2357 +#define SCI_SETDOCPOINTER 2358 +#define SCI_SETMODEVENTMASK 2359 +#define EDGE_NONE 0 +#define EDGE_LINE 1 +#define EDGE_BACKGROUND 2 +#define SCI_GETEDGECOLUMN 2360 +#define SCI_SETEDGECOLUMN 2361 +#define SCI_GETEDGEMODE 2362 +#define SCI_SETEDGEMODE 2363 +#define SCI_GETEDGECOLOUR 2364 +#define SCI_SETEDGECOLOUR 2365 +#define SCI_SEARCHANCHOR 2366 +#define SCI_SEARCHNEXT 2367 +#define SCI_SEARCHPREV 2368 +#define SCI_LINESONSCREEN 2370 +#define SCI_USEPOPUP 2371 +#define SCI_SELECTIONISRECTANGLE 2372 +#define SCI_SETZOOM 2373 +#define SCI_GETZOOM 2374 +#define SCI_CREATEDOCUMENT 2375 +#define SCI_ADDREFDOCUMENT 2376 +#define SCI_RELEASEDOCUMENT 2377 +#define SCI_GETMODEVENTMASK 2378 +#define SCI_SETFOCUS 2380 +#define SCI_GETFOCUS 2381 +#define SC_STATUS_OK 0 +#define SC_STATUS_FAILURE 1 +#define SC_STATUS_BADALLOC 2 +#define SCI_SETSTATUS 2382 +#define SCI_GETSTATUS 2383 +#define SCI_SETMOUSEDOWNCAPTURES 2384 +#define SCI_GETMOUSEDOWNCAPTURES 2385 +#define SC_CURSORNORMAL -1 +#define SC_CURSORWAIT 4 +#define SCI_SETCURSOR 2386 +#define SCI_GETCURSOR 2387 +#define SCI_SETCONTROLCHARSYMBOL 2388 +#define SCI_GETCONTROLCHARSYMBOL 2389 +#define SCI_WORDPARTLEFT 2390 +#define SCI_WORDPARTLEFTEXTEND 2391 +#define SCI_WORDPARTRIGHT 2392 +#define SCI_WORDPARTRIGHTEXTEND 2393 +#define VISIBLE_SLOP 0x01 +#define VISIBLE_STRICT 0x04 +#define SCI_SETVISIBLEPOLICY 2394 +#define SCI_DELLINELEFT 2395 +#define SCI_DELLINERIGHT 2396 +#define SCI_SETXOFFSET 2397 +#define SCI_GETXOFFSET 2398 +#define SCI_CHOOSECARETX 2399 +#define SCI_GRABFOCUS 2400 +#define CARET_SLOP 0x01 +#define CARET_STRICT 0x04 +#define CARET_JUMPS 0x10 +#define CARET_EVEN 0x08 +#define SCI_SETXCARETPOLICY 2402 +#define SCI_SETYCARETPOLICY 2403 +#define SCI_SETPRINTWRAPMODE 2406 +#define SCI_GETPRINTWRAPMODE 2407 +#define SCI_SETHOTSPOTACTIVEFORE 2410 +#define SCI_GETHOTSPOTACTIVEFORE 2494 +#define SCI_SETHOTSPOTACTIVEBACK 2411 +#define SCI_GETHOTSPOTACTIVEBACK 2495 +#define SCI_SETHOTSPOTACTIVEUNDERLINE 2412 +#define SCI_GETHOTSPOTACTIVEUNDERLINE 2496 +#define SCI_SETHOTSPOTSINGLELINE 2421 +#define SCI_GETHOTSPOTSINGLELINE 2497 +#define SCI_PARADOWN 2413 +#define SCI_PARADOWNEXTEND 2414 +#define SCI_PARAUP 2415 +#define SCI_PARAUPEXTEND 2416 +#define SCI_POSITIONBEFORE 2417 +#define SCI_POSITIONAFTER 2418 +#define SCI_COPYRANGE 2419 +#define SCI_COPYTEXT 2420 +#define SC_SEL_STREAM 0 +#define SC_SEL_RECTANGLE 1 +#define SC_SEL_LINES 2 +#define SC_SEL_THIN 3 +#define SCI_SETSELECTIONMODE 2422 +#define SCI_GETSELECTIONMODE 2423 +#define SCI_GETLINESELSTARTPOSITION 2424 +#define SCI_GETLINESELENDPOSITION 2425 +#define SCI_LINEDOWNRECTEXTEND 2426 +#define SCI_LINEUPRECTEXTEND 2427 +#define SCI_CHARLEFTRECTEXTEND 2428 +#define SCI_CHARRIGHTRECTEXTEND 2429 +#define SCI_HOMERECTEXTEND 2430 +#define SCI_VCHOMERECTEXTEND 2431 +#define SCI_LINEENDRECTEXTEND 2432 +#define SCI_PAGEUPRECTEXTEND 2433 +#define SCI_PAGEDOWNRECTEXTEND 2434 +#define SCI_STUTTEREDPAGEUP 2435 +#define SCI_STUTTEREDPAGEUPEXTEND 2436 +#define SCI_STUTTEREDPAGEDOWN 2437 +#define SCI_STUTTEREDPAGEDOWNEXTEND 2438 +#define SCI_WORDLEFTEND 2439 +#define SCI_WORDLEFTENDEXTEND 2440 +#define SCI_WORDRIGHTEND 2441 +#define SCI_WORDRIGHTENDEXTEND 2442 +#define SCI_SETWHITESPACECHARS 2443 +#define SCI_SETCHARSDEFAULT 2444 +#define SCI_AUTOCGETCURRENT 2445 +#define SCI_ALLOCATE 2446 +#define SCI_TARGETASUTF8 2447 +#define SCI_SETLENGTHFORENCODE 2448 +#define SCI_ENCODEDFROMUTF8 2449 +#define SCI_FINDCOLUMN 2456 +#define SCI_GETCARETSTICKY 2457 +#define SCI_SETCARETSTICKY 2458 +#define SCI_TOGGLECARETSTICKY 2459 +#define SCI_SETPASTECONVERTENDINGS 2467 +#define SCI_GETPASTECONVERTENDINGS 2468 +#define SCI_SELECTIONDUPLICATE 2469 +#define SC_ALPHA_TRANSPARENT 0 +#define SC_ALPHA_OPAQUE 255 +#define SC_ALPHA_NOALPHA 256 +#define SCI_SETCARETLINEBACKALPHA 2470 +#define SCI_GETCARETLINEBACKALPHA 2471 +#define CARETSTYLE_INVISIBLE 0 +#define CARETSTYLE_LINE 1 +#define CARETSTYLE_BLOCK 2 +#define SCI_SETCARETSTYLE 2512 +#define SCI_GETCARETSTYLE 2513 +#define SCI_SETINDICATORCURRENT 2500 +#define SCI_GETINDICATORCURRENT 2501 +#define SCI_SETINDICATORVALUE 2502 +#define SCI_GETINDICATORVALUE 2503 +#define SCI_INDICATORFILLRANGE 2504 +#define SCI_INDICATORCLEARRANGE 2505 +#define SCI_INDICATORALLONFOR 2506 +#define SCI_INDICATORVALUEAT 2507 +#define SCI_INDICATORSTART 2508 +#define SCI_INDICATOREND 2509 +#define SCI_SETPOSITIONCACHE 2514 +#define SCI_GETPOSITIONCACHE 2515 +#define SCI_COPYALLOWLINE 2519 +#define SCI_GETCHARACTERPOINTER 2520 +#define SCI_SETKEYSUNICODE 2521 +#define SCI_GETKEYSUNICODE 2522 +#define SCI_INDICSETALPHA 2523 +#define SCI_INDICGETALPHA 2524 +#define SCI_SETEXTRAASCENT 2525 +#define SCI_GETEXTRAASCENT 2526 +#define SCI_SETEXTRADESCENT 2527 +#define SCI_GETEXTRADESCENT 2528 +#define SCI_MARKERSYMBOLDEFINED 2529 +#define SCI_MARGINSETTEXT 2530 +#define SCI_MARGINGETTEXT 2531 +#define SCI_MARGINSETSTYLE 2532 +#define SCI_MARGINGETSTYLE 2533 +#define SCI_MARGINSETSTYLES 2534 +#define SCI_MARGINGETSTYLES 2535 +#define SCI_MARGINTEXTCLEARALL 2536 +#define SCI_MARGINSETSTYLEOFFSET 2537 +#define SCI_MARGINGETSTYLEOFFSET 2538 +#define SCI_ANNOTATIONSETTEXT 2540 +#define SCI_ANNOTATIONGETTEXT 2541 +#define SCI_ANNOTATIONSETSTYLE 2542 +#define SCI_ANNOTATIONGETSTYLE 2543 +#define SCI_ANNOTATIONSETSTYLES 2544 +#define SCI_ANNOTATIONGETSTYLES 2545 +#define SCI_ANNOTATIONGETLINES 2546 +#define SCI_ANNOTATIONCLEARALL 2547 +#define ANNOTATION_HIDDEN 0 +#define ANNOTATION_STANDARD 1 +#define ANNOTATION_BOXED 2 +#define SCI_ANNOTATIONSETVISIBLE 2548 +#define SCI_ANNOTATIONGETVISIBLE 2549 +#define SCI_ANNOTATIONSETSTYLEOFFSET 2550 +#define SCI_ANNOTATIONGETSTYLEOFFSET 2551 +#define UNDO_MAY_COALESCE 1 +#define SCI_ADDUNDOACTION 2560 +#define SCI_CHARPOSITIONFROMPOINT 2561 +#define SCI_CHARPOSITIONFROMPOINTCLOSE 2562 +#define SCI_SETMULTIPLESELECTION 2563 +#define SCI_GETMULTIPLESELECTION 2564 +#define SCI_SETADDITIONALSELECTIONTYPING 2565 +#define SCI_GETADDITIONALSELECTIONTYPING 2566 +#define SCI_SETADDITIONALCARETSBLINK 2567 +#define SCI_GETADDITIONALCARETSBLINK 2568 +#define SCI_GETSELECTIONS 2570 +#define SCI_CLEARSELECTIONS 2571 +#define SCI_SETSELECTION 2572 +#define SCI_ADDSELECTION 2573 +#define SCI_SETMAINSELECTION 2574 +#define SCI_GETMAINSELECTION 2575 +#define SCI_SETSELECTIONNCARET 2576 +#define SCI_GETSELECTIONNCARET 2577 +#define SCI_SETSELECTIONNANCHOR 2578 +#define SCI_GETSELECTIONNANCHOR 2579 +#define SCI_SETSELECTIONNCARETVIRTUALSPACE 2580 +#define SCI_GETSELECTIONNCARETVIRTUALSPACE 2581 +#define SCI_SETSELECTIONNANCHORVIRTUALSPACE 2582 +#define SCI_GETSELECTIONNANCHORVIRTUALSPACE 2583 +#define SCI_SETSELECTIONNSTART 2584 +#define SCI_GETSELECTIONNSTART 2585 +#define SCI_SETSELECTIONNEND 2586 +#define SCI_GETSELECTIONNEND 2587 +#define SCI_SETRECTANGULARSELECTIONCARET 2588 +#define SCI_GETRECTANGULARSELECTIONCARET 2589 +#define SCI_SETRECTANGULARSELECTIONANCHOR 2590 +#define SCI_GETRECTANGULARSELECTIONANCHOR 2591 +#define SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE 2592 +#define SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE 2593 +#define SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE 2594 +#define SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE 2595 +#define SCVS_NONE 0 +#define SCVS_RECTANGULARSELECTION 1 +#define SCVS_USERACCESSIBLE 2 +#define SCI_SETVIRTUALSPACEOPTIONS 2596 +#define SCI_GETVIRTUALSPACEOPTIONS 2597 +#define SCI_SETRECTANGULARSELECTIONMODIFIER 2598 +#define SCI_GETRECTANGULARSELECTIONMODIFIER 2599 +#define SCI_SETADDITIONALSELFORE 2600 +#define SCI_SETADDITIONALSELBACK 2601 +#define SCI_SETADDITIONALSELALPHA 2602 +#define SCI_GETADDITIONALSELALPHA 2603 +#define SCI_SETADDITIONALCARETFORE 2604 +#define SCI_GETADDITIONALCARETFORE 2605 +#define SCI_ROTATESELECTION 2606 +#define SCI_SWAPMAINANCHORCARET 2607 +#define SCI_STARTRECORD 3001 +#define SCI_STOPRECORD 3002 +#define SCI_SETLEXER 4001 +#define SCI_GETLEXER 4002 +#define SCI_COLOURISE 4003 +#define SCI_SETPROPERTY 4004 +#define KEYWORDSET_MAX 8 +#define SCI_SETKEYWORDS 4005 +#define SCI_SETLEXERLANGUAGE 4006 +#define SCI_LOADLEXERLIBRARY 4007 +#define SCI_GETPROPERTY 4008 +#define SCI_GETPROPERTYEXPANDED 4009 +#define SCI_GETPROPERTYINT 4010 +#define SCI_GETSTYLEBITSNEEDED 4011 +#define SC_MOD_INSERTTEXT 0x1 +#define SC_MOD_DELETETEXT 0x2 +#define SC_MOD_CHANGESTYLE 0x4 +#define SC_MOD_CHANGEFOLD 0x8 +#define SC_PERFORMED_USER 0x10 +#define SC_PERFORMED_UNDO 0x20 +#define SC_PERFORMED_REDO 0x40 +#define SC_MULTISTEPUNDOREDO 0x80 +#define SC_LASTSTEPINUNDOREDO 0x100 +#define SC_MOD_CHANGEMARKER 0x200 +#define SC_MOD_BEFOREINSERT 0x400 +#define SC_MOD_BEFOREDELETE 0x800 +#define SC_MULTILINEUNDOREDO 0x1000 +#define SC_STARTACTION 0x2000 +#define SC_MOD_CHANGEINDICATOR 0x4000 +#define SC_MOD_CHANGELINESTATE 0x8000 +#define SC_MOD_CHANGEMARGIN 0x10000 +#define SC_MOD_CHANGEANNOTATION 0x20000 +#define SC_MOD_CONTAINER 0x40000 +#define SC_MODEVENTMASKALL 0x7FFFF +#define SCEN_CHANGE 768 +#define SCEN_SETFOCUS 512 +#define SCEN_KILLFOCUS 256 +#define SCK_DOWN 300 +#define SCK_UP 301 +#define SCK_LEFT 302 +#define SCK_RIGHT 303 +#define SCK_HOME 304 +#define SCK_END 305 +#define SCK_PRIOR 306 +#define SCK_NEXT 307 +#define SCK_DELETE 308 +#define SCK_INSERT 309 +#define SCK_ESCAPE 7 +#define SCK_BACK 8 +#define SCK_TAB 9 +#define SCK_RETURN 13 +#define SCK_ADD 310 +#define SCK_SUBTRACT 311 +#define SCK_DIVIDE 312 +#define SCK_WIN 313 +#define SCK_RWIN 314 +#define SCK_MENU 315 +#define SCMOD_NORM 0 +#define SCMOD_SHIFT 1 +#define SCMOD_CTRL 2 +#define SCMOD_ALT 4 +#define SCMOD_SUPER 8 +#define SCN_STYLENEEDED 2000 +#define SCN_CHARADDED 2001 +#define SCN_SAVEPOINTREACHED 2002 +#define SCN_SAVEPOINTLEFT 2003 +#define SCN_MODIFYATTEMPTRO 2004 +#define SCN_KEY 2005 +#define SCN_DOUBLECLICK 2006 +#define SCN_UPDATEUI 2007 +#define SCN_MODIFIED 2008 +#define SCN_MACRORECORD 2009 +#define SCN_MARGINCLICK 2010 +#define SCN_NEEDSHOWN 2011 +#define SCN_PAINTED 2013 +#define SCN_USERLISTSELECTION 2014 +#define SCN_URIDROPPED 2015 +#define SCN_DWELLSTART 2016 +#define SCN_DWELLEND 2017 +#define SCN_ZOOM 2018 +#define SCN_HOTSPOTCLICK 2019 +#define SCN_HOTSPOTDOUBLECLICK 2020 +#define SCN_CALLTIPCLICK 2021 +#define SCN_AUTOCSELECTION 2022 +#define SCN_INDICATORCLICK 2023 +#define SCN_INDICATORRELEASE 2024 +#define SCN_AUTOCCANCELLED 2025 +#define SCN_AUTOCCHARDELETED 2026 +/* --Autogenerated -- end of section automatically generated from Scintilla.iface */ + +/* These structures are defined to be exactly the same shape as the Win32 + * CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs. + * So older code that treats Scintilla as a RichEdit will work. */ + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +struct Sci_CharacterRange { + long cpMin; + long cpMax; +}; + +struct Sci_TextRange { + struct Sci_CharacterRange chrg; + char *lpstrText; +}; + +struct Sci_TextToFind { + struct Sci_CharacterRange chrg; + char *lpstrText; + struct Sci_CharacterRange chrgText; +}; + +#define CharacterRange Sci_CharacterRange +#define TextRange Sci_TextRange +#define TextToFind Sci_TextToFind + +#ifdef PLATFORM_H + +/* This structure is used in printing and requires some of the graphics types + * from Platform.h. Not needed by most client code. */ + +struct Sci_RangeToFormat { + SurfaceID hdc; + SurfaceID hdcTarget; + PRectangle rc; + PRectangle rcPage; + Sci_CharacterRange chrg; +}; + +#define RangeToFormat Sci_RangeToFormat + +#endif + +struct Sci_NotifyHeader { + /* Compatible with Windows NMHDR. + * hwndFrom is really an environment specific window handle or pointer + * but most clients of Scintilla.h do not have this type visible. */ + void *hwndFrom; + uptr_t idFrom; + unsigned int code; +}; + +#define NotifyHeader Sci_NotifyHeader + +struct SCNotification { + struct Sci_NotifyHeader nmhdr; + int position; /* SCN_STYLENEEDED, SCN_MODIFIED, SCN_DWELLSTART, SCN_DWELLEND */ + int ch; /* SCN_CHARADDED, SCN_KEY */ + int modifiers; /* SCN_KEY */ + int modificationType; /* SCN_MODIFIED */ + const char *text; /* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */ + int length; /* SCN_MODIFIED */ + int linesAdded; /* SCN_MODIFIED */ + int message; /* SCN_MACRORECORD */ + uptr_t wParam; /* SCN_MACRORECORD */ + sptr_t lParam; /* SCN_MACRORECORD */ + int line; /* SCN_MODIFIED */ + int foldLevelNow; /* SCN_MODIFIED */ + int foldLevelPrev; /* SCN_MODIFIED */ + int margin; /* SCN_MARGINCLICK */ + int listType; /* SCN_USERLISTSELECTION */ + int x; /* SCN_DWELLSTART, SCN_DWELLEND */ + int y; /* SCN_DWELLSTART, SCN_DWELLEND */ + int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */ + int annotationLinesAdded; /* SC_MOD_CHANGEANNOTATION */ +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/sdk/wxscintilla/src/scintilla/include/Scintilla.iface b/sdk/wxscintilla/src/scintilla/include/Scintilla.iface index 0a429bef59..d2682a18e5 100644 --- a/sdk/wxscintilla/src/scintilla/include/Scintilla.iface +++ b/sdk/wxscintilla/src/scintilla/include/Scintilla.iface @@ -1,3234 +1,3689 @@ -## First line may be used for shbang - -## This file defines the interface to Scintilla - -## Copyright 2000-2003 by Neil Hodgson -## The License.txt file describes the conditions under which this software may be distributed. - -## A line starting with ## is a pure comment and should be stripped by readers. -## A line starting with #! is for future shbang use -## A line starting with # followed by a space is a documentation comment and refers -## to the next feature definition. - -## Each feature is defined by a line starting with fun, get, set, val or evt. -## cat -> start a category -## fun -> a function -## get -> a property get function -## set -> a property set function -## val -> definition of a constant -## evt -> an event -## enu -> associate an enumeration with a set of vals with a prefix -## lex -> associate a lexer with the lexical classes it produces -## -## All other feature names should be ignored. They may be defined in the future. -## A property may have a set function, a get function or both. Each will have -## "Get" or "Set" in their names and the corresponding name will have the obvious switch. -## A property may be subscripted, in which case the first parameter is the subscript. -## fun, get, and set features have a strict syntax: -## [=,) -## where stands for white space. -## param may be empty (null value) or is [=] -## Additional white space is allowed between elements. -## The syntax for evt is [=[,]*]) -## Feature names that contain an underscore are defined by Windows, so in these -## cases, using the Windows definition is preferred where available. -## The feature numbers are stable so features will not be renumbered. -## Features may be removed but they will go through a period of deprecation -## before removal which is signalled by moving them into the Deprecated category. -## -## enu has the syntax enu=[]* where all the val -## features in this file starting with a given are considered part of the -## enumeration. -## -## lex has the syntax lex=[]* -## where name is a reasonably capitalised (Python, XML) identifier or UI name, -## lexerVal is the val used to specify the lexer, and the list of prefixes is similar -## to enu. The name may not be the same as that used within the lexer so the lexerVal -## should be used to tie these entities together. - -## Types: -## void -## int -## bool -> integer, 1=true, 0=false -## position -> integer position in a document -## colour -> colour integer containing red, green and blue bytes. -## string -> pointer to const character -## stringresult -> pointer to character, NULL-> return size of result -## cells -> pointer to array of cells, each cell containing a style byte and character byte -## textrange -> range of a min and a max position with an output string -## findtext -> searchrange, text -> foundposition -## keymod -> integer containing key in low half and modifiers in high half -## formatrange -## Types no longer used: -## findtextex -> searchrange -## charrange -> range of a min and a max position -## charrangeresult -> like charrange, but output param -## countedstring -## point -> x,y -## pointresult -> like point, but output param -## rectangle -> left,top,right,bottom -## Client code should ignore definitions containing types it does not understand, except -## for possibly #defining the constants - -## Line numbers and positions start at 0. -## String arguments may contain NUL ('\0') characters where the calls provide a length -## argument and retrieve NUL characters. All retrieved strings except for those retrieved -## by GetLine also have a NUL appended but client code should calculate the size that -## will be returned rather than relying upon the NUL whenever possible. Allow for the -## extra NUL character when allocating buffers. The size to allocate for a stringresult -## can be determined by calling with a NULL (0) pointer. - -cat Basics - -################################################ -## For Scintilla.h -val INVALID_POSITION=-1 -# Define start of Scintilla messages to be greater than all Windows edit (EM_*) messages -# as many EM_ messages can be used although that use is deprecated. -val SCI_START=2000 -val SCI_OPTIONAL_START=3000 -val SCI_LEXER_START=4000 - -# Add text to the document at current position. -fun void AddText=2001(int length, string text) - -# Add array of cells to document. -fun void AddStyledText=2002(int length, cells c) - -# Insert string at a position. -fun void InsertText=2003(position pos, string text) - -# Delete all text in the document. -fun void ClearAll=2004(,) - -# Set all style bytes to 0, remove all folding information. -fun void ClearDocumentStyle=2005(,) - -# Returns the number of characters in the document. -get int GetLength=2006(,) - -# Returns the character byte at the position. -get int GetCharAt=2007(position pos,) - -# Returns the position of the caret. -get position GetCurrentPos=2008(,) - -# Returns the position of the opposite end of the selection to the caret. -get position GetAnchor=2009(,) - -# Returns the style byte at the position. -get int GetStyleAt=2010(position pos,) - -# Redoes the next action on the undo history. -fun void Redo=2011(,) - -# Choose between collecting actions into the undo -# history and discarding them. -set void SetUndoCollection=2012(bool collectUndo,) - -# Select all the text in the document. -fun void SelectAll=2013(,) - -# Remember the current position in the undo history as the position -# at which the document was saved. -fun void SetSavePoint=2014(,) - -# Retrieve a buffer of cells. -# Returns the number of bytes in the buffer not including terminating NULs. -fun int GetStyledText=2015(, textrange tr) - -# Are there any redoable actions in the undo history? -fun bool CanRedo=2016(,) - -# Retrieve the line number at which a particular marker is located. -fun int MarkerLineFromHandle=2017(int handle,) - -# Delete a marker. -fun void MarkerDeleteHandle=2018(int handle,) - -# Is undo history being collected? -get bool GetUndoCollection=2019(,) - -enu WhiteSpace=SCWS_ -val SCWS_INVISIBLE=0 -val SCWS_VISIBLEALWAYS=1 -val SCWS_VISIBLEAFTERINDENT=2 - -# Are white space characters currently visible? -# Returns one of SCWS_* constants. -get int GetViewWS=2020(,) - -# Make white space characters invisible, always visible or visible outside indentation. -set void SetViewWS=2021(int viewWS,) - -# Find the position from a point within the window. -fun position PositionFromPoint=2022(int x, int y) - -# Find the position from a point within the window but return -# INVALID_POSITION if not close to text. -fun position PositionFromPointClose=2023(int x, int y) - -# Set caret to start of a line and ensure it is visible. -fun void GotoLine=2024(int line,) - -# Set caret to a position and ensure it is visible. -fun void GotoPos=2025(position pos,) - -# Set the selection anchor to a position. The anchor is the opposite -# end of the selection from the caret. -set void SetAnchor=2026(position posAnchor,) - -# Retrieve the text of the line containing the caret. -# Returns the index of the caret on the line. -fun int GetCurLine=2027(int length, stringresult text) - -# Retrieve the position of the last correctly styled character. -get position GetEndStyled=2028(,) - -enu EndOfLine=SC_EOL_ -val SC_EOL_CRLF=0 -val SC_EOL_CR=1 -val SC_EOL_LF=2 - -# Convert all line endings in the document to one mode. -fun void ConvertEOLs=2029(int eolMode,) - -# Retrieve the current end of line mode - one of CRLF, CR, or LF. -get int GetEOLMode=2030(,) - -# Set the current end of line mode. -set void SetEOLMode=2031(int eolMode,) - -# Set the current styling position to pos and the styling mask to mask. -# The styling mask can be used to protect some bits in each styling byte from modification. -fun void StartStyling=2032(position pos, int mask) - -# Change style from current styling position for length characters to a style -# and move the current styling position to after this newly styled segment. -fun void SetStyling=2033(int length, int style) - -# Is drawing done first into a buffer or direct to the screen? -get bool GetBufferedDraw=2034(,) - -# If drawing is buffered then each line of text is drawn into a bitmap buffer -# before drawing it to the screen to avoid flicker. -set void SetBufferedDraw=2035(bool buffered,) - -# Change the visible size of a tab to be a multiple of the width of a space character. -set void SetTabWidth=2036(int tabWidth,) - -# Retrieve the visible size of a tab. -get int GetTabWidth=2121(,) - -# The SC_CP_UTF8 value can be used to enter Unicode mode. -# This is the same value as CP_UTF8 in Windows -val SC_CP_UTF8=65001 - -# The SC_CP_DBCS value can be used to indicate a DBCS mode for GTK+. -val SC_CP_DBCS=1 - -# Set the code page used to interpret the bytes of the document as characters. -# The SC_CP_UTF8 value can be used to enter Unicode mode. -set void SetCodePage=2037(int codePage,) - -# In palette mode, Scintilla uses the environment's palette calls to display -# more colours. This may lead to ugly displays. -set void SetUsePalette=2039(bool usePalette,) - -enu MarkerSymbol=SC_MARK_ -val MARKER_MAX=31 -val SC_MARK_CIRCLE=0 -val SC_MARK_ROUNDRECT=1 -val SC_MARK_ARROW=2 -val SC_MARK_SMALLRECT=3 -val SC_MARK_SHORTARROW=4 -val SC_MARK_EMPTY=5 -val SC_MARK_ARROWDOWN=6 -val SC_MARK_MINUS=7 -val SC_MARK_PLUS=8 - -# Shapes used for outlining column. -val SC_MARK_VLINE=9 -val SC_MARK_LCORNER=10 -val SC_MARK_TCORNER=11 -val SC_MARK_BOXPLUS=12 -val SC_MARK_BOXPLUSCONNECTED=13 -val SC_MARK_BOXMINUS=14 -val SC_MARK_BOXMINUSCONNECTED=15 -val SC_MARK_LCORNERCURVE=16 -val SC_MARK_TCORNERCURVE=17 -val SC_MARK_CIRCLEPLUS=18 -val SC_MARK_CIRCLEPLUSCONNECTED=19 -val SC_MARK_CIRCLEMINUS=20 -val SC_MARK_CIRCLEMINUSCONNECTED=21 - -# Invisible mark that only sets the line background color. -val SC_MARK_BACKGROUND=22 -val SC_MARK_DOTDOTDOT=23 -val SC_MARK_ARROWS=24 -val SC_MARK_PIXMAP=25 -val SC_MARK_FULLRECT=26 - -val SC_MARK_CHARACTER=10000 - -enu MarkerOutline=SC_MARKNUM_ -# Markers used for outlining column. -val SC_MARKNUM_FOLDEREND=25 -val SC_MARKNUM_FOLDEROPENMID=26 -val SC_MARKNUM_FOLDERMIDTAIL=27 -val SC_MARKNUM_FOLDERTAIL=28 -val SC_MARKNUM_FOLDERSUB=29 -val SC_MARKNUM_FOLDER=30 -val SC_MARKNUM_FOLDEROPEN=31 - -val SC_MASK_FOLDERS=0xFE000000 - -# Set the symbol used for a particular marker number. -fun void MarkerDefine=2040(int markerNumber, int markerSymbol) - -# Set the foreground colour used for a particular marker number. -fun void MarkerSetFore=2041(int markerNumber, colour fore) - -# Set the background colour used for a particular marker number. -fun void MarkerSetBack=2042(int markerNumber, colour back) - -# Add a marker to a line, returning an ID which can be used to find or delete the marker. -fun int MarkerAdd=2043(int line, int markerNumber) - -# Delete a marker from a line. -fun void MarkerDelete=2044(int line, int markerNumber) - -# Delete all markers with a particular number from all lines. -fun void MarkerDeleteAll=2045(int markerNumber,) - -# Get a bit mask of all the markers set on a line. -fun int MarkerGet=2046(int line,) - -# Find the next line after lineStart that includes a marker in mask. -fun int MarkerNext=2047(int lineStart, int markerMask) - -# Find the previous line before lineStart that includes a marker in mask. -fun int MarkerPrevious=2048(int lineStart, int markerMask) - -# Define a marker from a pixmap. -fun void MarkerDefinePixmap=2049(int markerNumber, string pixmap) - -# Add a set of markers to a line. -fun void MarkerAddSet=2466(int line, int set) - -# Set the alpha used for a marker that is drawn in the text area, not the margin. -fun void MarkerSetAlpha=2476(int markerNumber, int alpha) - -enu MarginType=SC_MARGIN_ -val SC_MARGIN_SYMBOL=0 -val SC_MARGIN_NUMBER=1 -val SC_MARGIN_BACK=2 -val SC_MARGIN_FORE=3 - -# Set a margin to be either numeric or symbolic. -set void SetMarginTypeN=2240(int margin, int marginType) - -# Retrieve the type of a margin. -get int GetMarginTypeN=2241(int margin,) - -# Set the width of a margin to a width expressed in pixels. -set void SetMarginWidthN=2242(int margin, int pixelWidth) - -# Retrieve the width of a margin in pixels. -get int GetMarginWidthN=2243(int margin,) - -# Set a mask that determines which markers are displayed in a margin. -set void SetMarginMaskN=2244(int margin, int mask) - -# Retrieve the marker mask of a margin. -get int GetMarginMaskN=2245(int margin,) - -# Make a margin sensitive or insensitive to mouse clicks. -set void SetMarginSensitiveN=2246(int margin, bool sensitive) - -# Retrieve the mouse click sensitivity of a margin. -get bool GetMarginSensitiveN=2247(int margin,) - -# Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles. -# Style 39 is for future use. -enu StylesCommon=STYLE_ -val STYLE_DEFAULT=32 -val STYLE_LINENUMBER=33 -val STYLE_BRACELIGHT=34 -val STYLE_BRACEBAD=35 -val STYLE_CONTROLCHAR=36 -val STYLE_INDENTGUIDE=37 -val STYLE_CALLTIP=38 -val STYLE_LASTPREDEFINED=39 -val STYLE_MAX=127 - -# Character set identifiers are used in StyleSetCharacterSet. -# The values are the same as the Windows *_CHARSET values. -enu CharacterSet=SC_CHARSET_ -val SC_CHARSET_ANSI=0 -val SC_CHARSET_DEFAULT=1 -val SC_CHARSET_BALTIC=186 -val SC_CHARSET_CHINESEBIG5=136 -val SC_CHARSET_EASTEUROPE=238 -val SC_CHARSET_GB2312=134 -val SC_CHARSET_GREEK=161 -val SC_CHARSET_HANGUL=129 -val SC_CHARSET_MAC=77 -val SC_CHARSET_OEM=255 -val SC_CHARSET_RUSSIAN=204 -val SC_CHARSET_CYRILLIC=1251 -val SC_CHARSET_SHIFTJIS=128 -val SC_CHARSET_SYMBOL=2 -val SC_CHARSET_TURKISH=162 -val SC_CHARSET_JOHAB=130 -val SC_CHARSET_HEBREW=177 -val SC_CHARSET_ARABIC=178 -val SC_CHARSET_VIETNAMESE=163 -val SC_CHARSET_THAI=222 -val SC_CHARSET_8859_15=1000 - -# Clear all the styles and make equivalent to the global default style. -set void StyleClearAll=2050(,) - -# Set the foreground colour of a style. -set void StyleSetFore=2051(int style, colour fore) - -# Set the background colour of a style. -set void StyleSetBack=2052(int style, colour back) - -# Set a style to be bold or not. -set void StyleSetBold=2053(int style, bool bold) - -# Set a style to be italic or not. -set void StyleSetItalic=2054(int style, bool italic) - -# Set the size of characters of a style. -set void StyleSetSize=2055(int style, int sizePoints) - -# Set the font of a style. -set void StyleSetFont=2056(int style, string fontName) - -# Set a style to have its end of line filled or not. -set void StyleSetEOLFilled=2057(int style, bool filled) - -# Reset the default style to its state at startup -fun void StyleResetDefault=2058(,) - -# Set a style to be underlined or not. -set void StyleSetUnderline=2059(int style, bool underline) - -enu CaseVisible=SC_CASE_ -val SC_CASE_MIXED=0 -val SC_CASE_UPPER=1 -val SC_CASE_LOWER=2 - -# Get the foreground colour of a style. -get colour StyleGetFore=2481(int style,) - -# Get the background colour of a style. -get colour StyleGetBack=2482(int style,) - -# Get is a style bold or not. -get bool StyleGetBold=2483(int style,) - -# Get is a style italic or not. -get bool StyleGetItalic=2484(int style,) - -# Get the size of characters of a style. -get int StyleGetSize=2485(int style,) - -# Get the font of a style. -# Returns the length of the fontName -fun int StyleGetFont=2486(int style, stringresult fontName) - -# Get is a style to have its end of line filled or not. -get bool StyleGetEOLFilled=2487(int style,) - -# Get is a style underlined or not. -get bool StyleGetUnderline=2488(int style,) - -# Get is a style mixed case, or to force upper or lower case. -get int StyleGetCase=2489(int style,) - -# Get the character get of the font in a style. -get int StyleGetCharacterSet=2490(int style,) - -# Get is a style visible or not. -get bool StyleGetVisible=2491(int style,) - -# Get is a style changeable or not (read only). -# Experimental feature, currently buggy. -get bool StyleGetChangeable=2492(int style,) - -# Get is a style a hotspot or not. -get bool StyleGetHotSpot=2493(int style,) - -# Set a style to be mixed case, or to force upper or lower case. -set void StyleSetCase=2060(int style, int caseForce) - -# Set the character set of the font in a style. -set void StyleSetCharacterSet=2066(int style, int characterSet) - -# Set a style to be a hotspot or not. -set void StyleSetHotSpot=2409(int style, bool hotspot) - -# Set the foreground colour of the selection and whether to use this setting. -fun void SetSelFore=2067(bool useSetting, colour fore) - -# Set the background colour of the selection and whether to use this setting. -fun void SetSelBack=2068(bool useSetting, colour back) - -# Get the alpha of the selection. -get int GetSelAlpha=2477(,) - -# Set the alpha of the selection. -set void SetSelAlpha=2478(int alpha,) - -# Is the selection end of line filled? -get bool GetSelEOLFilled=2479(,) - -# Set the selection to have its end of line filled or not. -set void SetSelEOLFilled=2480(bool filled,) - -# Set the foreground colour of the caret. -set void SetCaretFore=2069(colour fore,) - -# When key+modifier combination km is pressed perform msg. -fun void AssignCmdKey=2070(keymod km, int msg) - -# When key+modifier combination km is pressed do nothing. -fun void ClearCmdKey=2071(keymod km,) - -# Drop all key mappings. -fun void ClearAllCmdKeys=2072(,) - -# Set the styles for a segment of the document. -fun void SetStylingEx=2073(int length, string styles) - -# Set a style to be visible or not. -set void StyleSetVisible=2074(int style, bool visible) - -# Get the time in milliseconds that the caret is on and off. -get int GetCaretPeriod=2075(,) - -# Get the time in milliseconds that the caret is on and off. 0 = steady on. -set void SetCaretPeriod=2076(int periodMilliseconds,) - -# Set the set of characters making up words for when moving or selecting by word. -# First sets deaults like SetCharsDefault. -set void SetWordChars=2077(, string characters) - -# Start a sequence of actions that is undone and redone as a unit. -# May be nested. -fun void BeginUndoAction=2078(,) - -# End a sequence of actions that is undone and redone as a unit. -fun void EndUndoAction=2079(,) - -# Indicator style enumeration and some constants -enu IndicatorStyle=INDIC_ -val INDIC_PLAIN=0 -val INDIC_SQUIGGLE=1 -val INDIC_TT=2 -val INDIC_DIAGONAL=3 -val INDIC_STRIKE=4 -val INDIC_HIDDEN=5 -val INDIC_BOX=6 -val INDIC_ROUNDBOX=7 -val INDIC_MAX=31 -val INDIC_CONTAINER=8 -val INDIC0_MASK=0x20 -val INDIC1_MASK=0x40 -val INDIC2_MASK=0x80 -val INDICS_MASK=0xE0 - -# Set an indicator to plain, squiggle or TT. -set void IndicSetStyle=2080(int indic, int style) - -# Retrieve the style of an indicator. -get int IndicGetStyle=2081(int indic,) - -# Set the foreground colour of an indicator. -set void IndicSetFore=2082(int indic, colour fore) - -# Retrieve the foreground colour of an indicator. -get colour IndicGetFore=2083(int indic,) - -# Set an indicator to draw under text or over(default). -set void IndicSetUnder=2510(int indic, bool under) - -# Retrieve whether indicator drawn under or over text. -get bool IndicGetUnder=2511(int indic,) - -# Set the foreground colour of all whitespace and whether to use this setting. -fun void SetWhitespaceFore=2084(bool useSetting, colour fore) - -# Set the background colour of all whitespace and whether to use this setting. -fun void SetWhitespaceBack=2085(bool useSetting, colour back) - -# Divide each styling byte into lexical class bits (default: 5) and indicator -# bits (default: 3). If a lexer requires more than 32 lexical states, then this -# is used to expand the possible states. -set void SetStyleBits=2090(int bits,) - -# Retrieve number of bits in style bytes used to hold the lexical state. -get int GetStyleBits=2091(,) - -# Used to hold extra styling information for each line. -set void SetLineState=2092(int line, int state) - -# Retrieve the extra styling information for a line. -get int GetLineState=2093(int line,) - -# Retrieve the last line number that has line state. -get int GetMaxLineState=2094(,) - -# Is the background of the line containing the caret in a different colour? -get bool GetCaretLineVisible=2095(,) - -# Display the background of the line containing the caret in a different colour. -set void SetCaretLineVisible=2096(bool show,) - -# Get the colour of the background of the line containing the caret. -get colour GetCaretLineBack=2097(,) - -# Set the colour of the background of the line containing the caret. -set void SetCaretLineBack=2098(colour back,) - -# Set a style to be changeable or not (read only). -# Experimental feature, currently buggy. -set void StyleSetChangeable=2099(int style, bool changeable) - -# Display a auto-completion list. -# The lenEntered parameter indicates how many characters before -# the caret should be used to provide context. -fun void AutoCShow=2100(int lenEntered, string itemList) - -# Remove the auto-completion list from the screen. -fun void AutoCCancel=2101(,) - -# Is there an auto-completion list visible? -fun bool AutoCActive=2102(,) - -# Retrieve the position of the caret when the auto-completion list was displayed. -fun position AutoCPosStart=2103(,) - -# User has selected an item so remove the list and insert the selection. -fun void AutoCComplete=2104(,) - -# Define a set of character that when typed cancel the auto-completion list. -fun void AutoCStops=2105(, string characterSet) - -# Change the separator character in the string setting up an auto-completion list. -# Default is space but can be changed if items contain space. -set void AutoCSetSeparator=2106(int separatorCharacter,) - -# Retrieve the auto-completion list separator character. -get int AutoCGetSeparator=2107(,) - -# Select the item in the auto-completion list that starts with a string. -fun void AutoCSelect=2108(, string text) - -# Should the auto-completion list be cancelled if the user backspaces to a -# position before where the box was created. -set void AutoCSetCancelAtStart=2110(bool cancel,) - -# Retrieve whether auto-completion cancelled by backspacing before start. -get bool AutoCGetCancelAtStart=2111(,) - -# Define a set of characters that when typed will cause the autocompletion to -# choose the selected item. -set void AutoCSetFillUps=2112(, string characterSet) - -# Should a single item auto-completion list automatically choose the item. -set void AutoCSetChooseSingle=2113(bool chooseSingle,) - -# Retrieve whether a single item auto-completion list automatically choose the item. -get bool AutoCGetChooseSingle=2114(,) - -# Set whether case is significant when performing auto-completion searches. -set void AutoCSetIgnoreCase=2115(bool ignoreCase,) - -# Retrieve state of ignore case flag. -get bool AutoCGetIgnoreCase=2116(,) - -# Display a list of strings and send notification when user chooses one. -fun void UserListShow=2117(int listType, string itemList) - -# Set whether or not autocompletion is hidden automatically when nothing matches. -set void AutoCSetAutoHide=2118(bool autoHide,) - -# Retrieve whether or not autocompletion is hidden automatically when nothing matches. -get bool AutoCGetAutoHide=2119(,) - -# Set whether or not autocompletion deletes any word characters -# after the inserted text upon completion. -set void AutoCSetDropRestOfWord=2270(bool dropRestOfWord,) - -# Retrieve whether or not autocompletion deletes any word characters -# after the inserted text upon completion. -get bool AutoCGetDropRestOfWord=2271(,) - -# Register an XPM image for use in autocompletion lists. -fun void RegisterImage=2405(int type, string xpmData) - -# Clear all the registered XPM images. -fun void ClearRegisteredImages=2408(,) - -# Retrieve the auto-completion list type-separator character. -get int AutoCGetTypeSeparator=2285(,) - -# Change the type-separator character in the string setting up an auto-completion list. -# Default is '?' but can be changed if items contain '?'. -set void AutoCSetTypeSeparator=2286(int separatorCharacter,) - -# Set the maximum width, in characters, of auto-completion and user lists. -# Set to 0 to autosize to fit longest item, which is the default. -set void AutoCSetMaxWidth=2208(int characterCount,) - -# Get the maximum width, in characters, of auto-completion and user lists. -get int AutoCGetMaxWidth=2209(,) - -# Set the maximum height, in rows, of auto-completion and user lists. -# The default is 5 rows. -set void AutoCSetMaxHeight=2210(int rowCount,) - -# Set the maximum height, in rows, of auto-completion and user lists. -get int AutoCGetMaxHeight=2211(,) - -# Set the number of spaces used for one level of indentation. -set void SetIndent=2122(int indentSize,) - -# Retrieve indentation size. -get int GetIndent=2123(,) - -# Indentation will only use space characters if useTabs is false, otherwise -# it will use a combination of tabs and spaces. -set void SetUseTabs=2124(bool useTabs,) - -# Retrieve whether tabs will be used in indentation. -get bool GetUseTabs=2125(,) - -# Change the indentation of a line to a number of columns. -set void SetLineIndentation=2126(int line, int indentSize) - -# Retrieve the number of columns that a line is indented. -get int GetLineIndentation=2127(int line,) - -# Retrieve the position before the first non indentation character on a line. -get position GetLineIndentPosition=2128(int line,) - -# Retrieve the column number of a position, taking tab width into account. -get int GetColumn=2129(position pos,) - -# Show or hide the horizontal scroll bar. -set void SetHScrollBar=2130(bool show,) - -# Is the horizontal scroll bar visible? -get bool GetHScrollBar=2131(,) - -# Show or hide indentation guides. -set void SetIndentationGuides=2132(bool show,) - -# Are the indentation guides visible? -get bool GetIndentationGuides=2133(,) - -# Set the highlighted indentation guide column. -# 0 = no highlighted guide. -set void SetHighlightGuide=2134(int column,) - -# Get the highlighted indentation guide column. -get int GetHighlightGuide=2135(,) - -# Get the position after the last visible characters on a line. -get int GetLineEndPosition=2136(int line,) - -# Get the code page used to interpret the bytes of the document as characters. -get int GetCodePage=2137(,) - -# Get the foreground colour of the caret. -get colour GetCaretFore=2138(,) - -# In palette mode? -get bool GetUsePalette=2139(,) - -# In read-only mode? -get bool GetReadOnly=2140(,) - -# Sets the position of the caret. -set void SetCurrentPos=2141(position pos,) - -# Sets the position that starts the selection - this becomes the anchor. -set void SetSelectionStart=2142(position pos,) - -# Returns the position at the start of the selection. -get position GetSelectionStart=2143(,) - -# Sets the position that ends the selection - this becomes the currentPosition. -set void SetSelectionEnd=2144(position pos,) - -# Returns the position at the end of the selection. -get position GetSelectionEnd=2145(,) - -# Sets the print magnification added to the point size of each style for printing. -set void SetPrintMagnification=2146(int magnification,) - -# Returns the print magnification. -get int GetPrintMagnification=2147(,) - -enu PrintOption=SC_PRINT_ -# PrintColourMode - use same colours as screen. -val SC_PRINT_NORMAL=0 -# PrintColourMode - invert the light value of each style for printing. -val SC_PRINT_INVERTLIGHT=1 -# PrintColourMode - force black text on white background for printing. -val SC_PRINT_BLACKONWHITE=2 -# PrintColourMode - text stays coloured, but all background is forced to be white for printing. -val SC_PRINT_COLOURONWHITE=3 -# PrintColourMode - only the default-background is forced to be white for printing. -val SC_PRINT_COLOURONWHITEDEFAULTBG=4 - -# Modify colours when printing for clearer printed text. -set void SetPrintColourMode=2148(int mode,) - -# Returns the print colour mode. -get int GetPrintColourMode=2149(,) - -enu FindOption=SCFIND_ -val SCFIND_WHOLEWORD=2 -val SCFIND_MATCHCASE=4 -val SCFIND_WORDSTART=0x00100000 -val SCFIND_REGEXP=0x00200000 -val SCFIND_POSIX=0x00400000 - -# Find some text in the document. -fun position FindText=2150(int flags, findtext ft) - -# On Windows, will draw the document into a display context such as a printer. -fun position FormatRange=2151(bool draw, formatrange fr) - -# Retrieve the display line at the top of the display. -get int GetFirstVisibleLine=2152(,) - -# Retrieve the contents of a line. -# Returns the length of the line. -fun int GetLine=2153(int line, stringresult text) - -# Returns the number of lines in the document. There is always at least one. -get int GetLineCount=2154(,) - -# Sets the size in pixels of the left margin. -set void SetMarginLeft=2155(, int pixelWidth) - -# Returns the size in pixels of the left margin. -get int GetMarginLeft=2156(,) - -# Sets the size in pixels of the right margin. -set void SetMarginRight=2157(, int pixelWidth) - -# Returns the size in pixels of the right margin. -get int GetMarginRight=2158(,) - -# Is the document different from when it was last saved? -get bool GetModify=2159(,) - -# Select a range of text. -fun void SetSel=2160(position start, position end) - -# Retrieve the selected text. -# Return the length of the text. -fun int GetSelText=2161(, stringresult text) - -# Retrieve a range of text. -# Return the length of the text. -fun int GetTextRange=2162(, textrange tr) - -# Draw the selection in normal style or with selection highlighted. -fun void HideSelection=2163(bool normal,) - -# Retrieve the x value of the point in the window where a position is displayed. -fun int PointXFromPosition=2164(, position pos) - -# Retrieve the y value of the point in the window where a position is displayed. -fun int PointYFromPosition=2165(, position pos) - -# Retrieve the line containing a position. -fun int LineFromPosition=2166(position pos,) - -# Retrieve the position at the start of a line. -fun position PositionFromLine=2167(int line,) - -# Scroll horizontally and vertically. -fun void LineScroll=2168(int columns, int lines) - -# Ensure the caret is visible. -fun void ScrollCaret=2169(,) - -# Replace the selected text with the argument text. -fun void ReplaceSel=2170(, string text) - -# Set to read only or read write. -set void SetReadOnly=2171(bool readOnly,) - -# Null operation. -fun void Null=2172(,) - -# Will a paste succeed? -fun bool CanPaste=2173(,) - -# Are there any undoable actions in the undo history? -fun bool CanUndo=2174(,) - -# Delete the undo history. -fun void EmptyUndoBuffer=2175(,) - -# Undo one action in the undo history. -fun void Undo=2176(,) - -# Cut the selection to the clipboard. -fun void Cut=2177(,) - -# Copy the selection to the clipboard. -fun void Copy=2178(,) - -# Paste the contents of the clipboard into the document replacing the selection. -fun void Paste=2179(,) - -# Clear the selection. -fun void Clear=2180(,) - -# Replace the contents of the document with the argument text. -fun void SetText=2181(, string text) - -# Retrieve all the text in the document. -# Returns number of characters retrieved. -fun int GetText=2182(int length, stringresult text) - -# Retrieve the number of characters in the document. -get int GetTextLength=2183(,) - -# Retrieve a pointer to a function that processes messages for this Scintilla. -get int GetDirectFunction=2184(,) - -# Retrieve a pointer value to use as the first argument when calling -# the function returned by GetDirectFunction. -get int GetDirectPointer=2185(,) - -# Set to overtype (true) or insert mode. -set void SetOvertype=2186(bool overtype,) - -# Returns true if overtype mode is active otherwise false is returned. -get bool GetOvertype=2187(,) - -# Set the width of the insert mode caret. -set void SetCaretWidth=2188(int pixelWidth,) - -# Returns the width of the insert mode caret. -get int GetCaretWidth=2189(,) - -# Sets the position that starts the target which is used for updating the -# document without affecting the scroll position. -set void SetTargetStart=2190(position pos,) - -# Get the position that starts the target. -get position GetTargetStart=2191(,) - -# Sets the position that ends the target which is used for updating the -# document without affecting the scroll position. -set void SetTargetEnd=2192(position pos,) - -# Get the position that ends the target. -get position GetTargetEnd=2193(,) - -# Replace the target text with the argument text. -# Text is counted so it can contain NULs. -# Returns the length of the replacement text. -fun int ReplaceTarget=2194(int length, string text) - -# Replace the target text with the argument text after \d processing. -# Text is counted so it can contain NULs. -# Looks for \d where d is between 1 and 9 and replaces these with the strings -# matched in the last search operation which were surrounded by \( and \). -# Returns the length of the replacement text including any change -# caused by processing the \d patterns. -fun int ReplaceTargetRE=2195(int length, string text) - -# Search for a counted string in the target and set the target to the found -# range. Text is counted so it can contain NULs. -# Returns length of range or -1 for failure in which case target is not moved. -fun int SearchInTarget=2197(int length, string text) - -# Set the search flags used by SearchInTarget. -set void SetSearchFlags=2198(int flags,) - -# Get the search flags used by SearchInTarget. -get int GetSearchFlags=2199(,) - -# Show a call tip containing a definition near position pos. -fun void CallTipShow=2200(position pos, string definition) - -# Remove the call tip from the screen. -fun void CallTipCancel=2201(,) - -# Is there an active call tip? -fun bool CallTipActive=2202(,) - -# Retrieve the position where the caret was before displaying the call tip. -fun position CallTipPosStart=2203(,) - -# Highlight a segment of the definition. -fun void CallTipSetHlt=2204(int start, int end) - -# Set the background colour for the call tip. -set void CallTipSetBack=2205(colour back,) - -# Set the foreground colour for the call tip. -set void CallTipSetFore=2206(colour fore,) - -# Set the foreground colour for the highlighted part of the call tip. -set void CallTipSetForeHlt=2207(colour fore,) - -# Enable use of STYLE_CALLTIP and set call tip tab size in pixels. -set void CallTipUseStyle=2212(int tabSize,) - -# Find the display line of a document line taking hidden lines into account. -fun int VisibleFromDocLine=2220(int line,) - -# Find the document line of a display line taking hidden lines into account. -fun int DocLineFromVisible=2221(int lineDisplay,) - -# The number of display lines needed to wrap a document line -fun int WrapCount=2235(int line,) - -enu FoldLevel=SC_FOLDLEVEL -val SC_FOLDLEVELBASE=0x400 -val SC_FOLDLEVELWHITEFLAG=0x1000 -val SC_FOLDLEVELHEADERFLAG=0x2000 -val SC_FOLDLEVELBOXHEADERFLAG=0x4000 -val SC_FOLDLEVELBOXFOOTERFLAG=0x8000 -val SC_FOLDLEVELCONTRACTED=0x10000 -val SC_FOLDLEVELUNINDENT=0x20000 -val SC_FOLDLEVELNUMBERMASK=0x0FFF - -# Set the fold level of a line. -# This encodes an integer level along with flags indicating whether the -# line is a header and whether it is effectively white space. -set void SetFoldLevel=2222(int line, int level) - -# Retrieve the fold level of a line. -get int GetFoldLevel=2223(int line,) - -# Find the last child line of a header line. -get int GetLastChild=2224(int line, int level) - -# Find the parent line of a child line. -get int GetFoldParent=2225(int line,) - -# Make a range of lines visible. -fun void ShowLines=2226(int lineStart, int lineEnd) - -# Make a range of lines invisible. -fun void HideLines=2227(int lineStart, int lineEnd) - -# Is a line visible? -get bool GetLineVisible=2228(int line,) - -# Show the children of a header line. -set void SetFoldExpanded=2229(int line, bool expanded) - -# Is a header line expanded? -get bool GetFoldExpanded=2230(int line,) - -# Switch a header line between expanded and contracted. -fun void ToggleFold=2231(int line,) - -# Ensure a particular line is visible by expanding any header line hiding it. -fun void EnsureVisible=2232(int line,) - -enu FoldFlag=SC_FOLDFLAG_ -val SC_FOLDFLAG_LINEBEFORE_EXPANDED=0x0002 -val SC_FOLDFLAG_LINEBEFORE_CONTRACTED=0x0004 -val SC_FOLDFLAG_LINEAFTER_EXPANDED=0x0008 -val SC_FOLDFLAG_LINEAFTER_CONTRACTED=0x0010 -val SC_FOLDFLAG_LEVELNUMBERS=0x0040 -val SC_FOLDFLAG_BOX=0x0001 - -# Set some style options for folding. -fun void SetFoldFlags=2233(int flags,) - -# Ensure a particular line is visible by expanding any header line hiding it. -# Use the currently set visibility policy to determine which range to display. -fun void EnsureVisibleEnforcePolicy=2234(int line,) - -# Sets whether a tab pressed when caret is within indentation indents. -set void SetTabIndents=2260(bool tabIndents,) - -# Does a tab pressed when caret is within indentation indent? -get bool GetTabIndents=2261(,) - -# Sets whether a backspace pressed when caret is within indentation unindents. -set void SetBackSpaceUnIndents=2262(bool bsUnIndents,) - -# Does a backspace pressed when caret is within indentation unindent? -get bool GetBackSpaceUnIndents=2263(,) - -val SC_TIME_FOREVER=10000000 - -# Sets the time the mouse must sit still to generate a mouse dwell event. -set void SetMouseDwellTime=2264(int periodMilliseconds,) - -# Retrieve the time the mouse must sit still to generate a mouse dwell event. -get int GetMouseDwellTime=2265(,) - -# Get position of start of word. -fun int WordStartPosition=2266(position pos, bool onlyWordCharacters) - -# Get position of end of word. -fun int WordEndPosition=2267(position pos, bool onlyWordCharacters) - -enu Wrap=SC_WRAP_ -val SC_WRAP_NONE=0 -val SC_WRAP_WORD=1 -val SC_WRAP_CHAR=2 - -# Sets whether text is word wrapped. -set void SetWrapMode=2268(int mode,) - -# Retrieve whether text is word wrapped. -get int GetWrapMode=2269(,) - -enu WrapVisualFlag=SC_WRAPVISUALFLAG_ -val SC_WRAPVISUALFLAG_NONE=0x0000 -val SC_WRAPVISUALFLAG_END=0x0001 -val SC_WRAPVISUALFLAG_START=0x0002 - -# Set the display mode of visual flags for wrapped lines. -set void SetWrapVisualFlags=2460(int wrapVisualFlags,) - -# Retrive the display mode of visual flags for wrapped lines. -get int GetWrapVisualFlags=2461(,) - -enu WrapVisualLocation=SC_WRAPVISUALFLAGLOC_ -val SC_WRAPVISUALFLAGLOC_DEFAULT=0x0000 -val SC_WRAPVISUALFLAGLOC_END_BY_TEXT=0x0001 -val SC_WRAPVISUALFLAGLOC_START_BY_TEXT=0x0002 - -# Set the location of visual flags for wrapped lines. -set void SetWrapVisualFlagsLocation=2462(int wrapVisualFlagsLocation,) - -# Retrive the location of visual flags for wrapped lines. -get int GetWrapVisualFlagsLocation=2463(,) - -# Set the start indent for wrapped lines. -set void SetWrapStartIndent=2464(int indent,) - -# Retrive the start indent for wrapped lines. -get int GetWrapStartIndent=2465(,) - -enu LineCache=SC_CACHE_ -val SC_CACHE_NONE=0 -val SC_CACHE_CARET=1 -val SC_CACHE_PAGE=2 -val SC_CACHE_DOCUMENT=3 - -# Sets the degree of caching of layout information. -set void SetLayoutCache=2272(int mode,) - -# Retrieve the degree of caching of layout information. -get int GetLayoutCache=2273(,) - -# Sets the document width assumed for scrolling. -set void SetScrollWidth=2274(int pixelWidth,) - -# Retrieve the document width assumed for scrolling. -get int GetScrollWidth=2275(,) - -# Measure the pixel width of some text in a particular style. -# NUL terminated text argument. -# Does not handle tab or control characters. -fun int TextWidth=2276(int style, string text) - -# Sets the scroll range so that maximum scroll position has -# the last line at the bottom of the view (default). -# Setting this to false allows scrolling one page below the last line. -set void SetEndAtLastLine=2277(bool endAtLastLine,) - -# Retrieve whether the maximum scroll position has the last -# line at the bottom of the view. -get bool GetEndAtLastLine=2278(,) - -# Retrieve the height of a particular line of text in pixels. -fun int TextHeight=2279(int line,) - -# Show or hide the vertical scroll bar. -set void SetVScrollBar=2280(bool show,) - -# Is the vertical scroll bar visible? -get bool GetVScrollBar=2281(,) - -# Append a string to the end of the document without changing the selection. -fun void AppendText=2282(int length, string text) - -# Is drawing done in two phases with backgrounds drawn before faoregrounds? -get bool GetTwoPhaseDraw=2283(,) - -# In twoPhaseDraw mode, drawing is performed in two phases, first the background -# and then the foreground. This avoids chopping off characters that overlap the next run. -set void SetTwoPhaseDraw=2284(bool twoPhase,) - -# Make the target range start and end be the same as the selection range start and end. -fun void TargetFromSelection=2287(,) - -# Join the lines in the target. -fun void LinesJoin=2288(,) - -# Split the lines in the target into lines that are less wide than pixelWidth -# where possible. -fun void LinesSplit=2289(int pixelWidth,) - -# Set the colours used as a chequerboard pattern in the fold margin -fun void SetFoldMarginColour=2290(bool useSetting, colour back) -fun void SetFoldMarginHiColour=2291(bool useSetting, colour fore) - -## New messages go here - -## Start of key messages -# Move caret down one line. -fun void LineDown=2300(,) - -# Move caret down one line extending selection to new caret position. -fun void LineDownExtend=2301(,) - -# Move caret up one line. -fun void LineUp=2302(,) - -# Move caret up one line extending selection to new caret position. -fun void LineUpExtend=2303(,) - -# Move caret left one character. -fun void CharLeft=2304(,) - -# Move caret left one character extending selection to new caret position. -fun void CharLeftExtend=2305(,) - -# Move caret right one character. -fun void CharRight=2306(,) - -# Move caret right one character extending selection to new caret position. -fun void CharRightExtend=2307(,) - -# Move caret left one word. -fun void WordLeft=2308(,) - -# Move caret left one word extending selection to new caret position. -fun void WordLeftExtend=2309(,) - -# Move caret right one word. -fun void WordRight=2310(,) - -# Move caret right one word extending selection to new caret position. -fun void WordRightExtend=2311(,) - -# Move caret to first position on line. -fun void Home=2312(,) - -# Move caret to first position on line extending selection to new caret position. -fun void HomeExtend=2313(,) - -# Move caret to last position on line. -fun void LineEnd=2314(,) - -# Move caret to last position on line extending selection to new caret position. -fun void LineEndExtend=2315(,) - -# Move caret to first position in document. -fun void DocumentStart=2316(,) - -# Move caret to first position in document extending selection to new caret position. -fun void DocumentStartExtend=2317(,) - -# Move caret to last position in document. -fun void DocumentEnd=2318(,) - -# Move caret to last position in document extending selection to new caret position. -fun void DocumentEndExtend=2319(,) - -# Move caret one page up. -fun void PageUp=2320(,) - -# Move caret one page up extending selection to new caret position. -fun void PageUpExtend=2321(,) - -# Move caret one page down. -fun void PageDown=2322(,) - -# Move caret one page down extending selection to new caret position. -fun void PageDownExtend=2323(,) - -# Switch from insert to overtype mode or the reverse. -fun void EditToggleOvertype=2324(,) - -# Cancel any modes such as call tip or auto-completion list display. -fun void Cancel=2325(,) - -# Delete the selection or if no selection, the character before the caret. -fun void DeleteBack=2326(,) - -# If selection is empty or all on one line replace the selection with a tab character. -# If more than one line selected, indent the lines. -fun void Tab=2327(,) - -# Dedent the selected lines. -fun void BackTab=2328(,) - -# Insert a new line, may use a CRLF, CR or LF depending on EOL mode. -fun void NewLine=2329(,) - -# Insert a Form Feed character. -fun void FormFeed=2330(,) - -# Move caret to before first visible character on line. -# If already there move to first character on line. -fun void VCHome=2331(,) - -# Like VCHome but extending selection to new caret position. -fun void VCHomeExtend=2332(,) - -# Magnify the displayed text by increasing the sizes by 1 point. -fun void ZoomIn=2333(,) - -# Make the displayed text smaller by decreasing the sizes by 1 point. -fun void ZoomOut=2334(,) - -# Delete the word to the left of the caret. -fun void DelWordLeft=2335(,) - -# Delete the word to the right of the caret. -fun void DelWordRight=2336(,) - -# Cut the line containing the caret. -fun void LineCut=2337(,) - -# Delete the line containing the caret. -fun void LineDelete=2338(,) - -# Switch the current line with the previous. -fun void LineTranspose=2339(,) - -# Duplicate the current line. -fun void LineDuplicate=2404(,) - -# Transform the selection to lower case. -fun void LowerCase=2340(,) - -# Transform the selection to upper case. -fun void UpperCase=2341(,) - -# Scroll the document down, keeping the caret visible. -fun void LineScrollDown=2342(,) - -# Scroll the document up, keeping the caret visible. -fun void LineScrollUp=2343(,) - -# Delete the selection or if no selection, the character before the caret. -# Will not delete the character before at the start of a line. -fun void DeleteBackNotLine=2344(,) - -# Move caret to first position on display line. -fun void HomeDisplay=2345(,) - -# Move caret to first position on display line extending selection to -# new caret position. -fun void HomeDisplayExtend=2346(,) - -# Move caret to last position on display line. -fun void LineEndDisplay=2347(,) - -# Move caret to last position on display line extending selection to new -# caret position. -fun void LineEndDisplayExtend=2348(,) - -# These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? -# except they behave differently when word-wrap is enabled: -# They go first to the start / end of the display line, like (Home|LineEnd)Display -# The difference is that, the cursor is already at the point, it goes on to the start -# or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. - -fun void HomeWrap=2349(,) -fun void HomeWrapExtend=2450(,) -fun void LineEndWrap=2451(,) -fun void LineEndWrapExtend=2452(,) -fun void VCHomeWrap=2453(,) -fun void VCHomeWrapExtend=2454(,) - -# Copy the line containing the caret. -fun void LineCopy=2455(,) - -# Move the caret inside current view if it's not there already. -fun void MoveCaretInsideView=2401(,) - -# How many characters are on a line, including end of line characters? -fun int LineLength=2350(int line,) - -# Highlight the characters at two positions. -fun void BraceHighlight=2351(position pos1, position pos2) - -# Highlight the character at a position indicating there is no matching brace. -fun void BraceBadLight=2352(position pos,) - -# Find the position of a matching brace or INVALID_POSITION if no match. -fun position BraceMatch=2353(position pos,) - -# Are the end of line characters visible? -get bool GetViewEOL=2355(,) - -# Make the end of line characters visible or invisible. -set void SetViewEOL=2356(bool visible,) - -# Retrieve a pointer to the document object. -get int GetDocPointer=2357(,) - -# Change the document object used. -set void SetDocPointer=2358(, int pointer) - -# Set which document modification events are sent to the container. -set void SetModEventMask=2359(int mask,) - -enu EdgeVisualStyle=EDGE_ -val EDGE_NONE=0 -val EDGE_LINE=1 -val EDGE_BACKGROUND=2 - -# Retrieve the column number which text should be kept within. -get int GetEdgeColumn=2360(,) - -# Set the column number of the edge. -# If text goes past the edge then it is highlighted. -set void SetEdgeColumn=2361(int column,) - -# Retrieve the edge highlight mode. -get int GetEdgeMode=2362(,) - -# The edge may be displayed by a line (EDGE_LINE) or by highlighting text that -# goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE). -set void SetEdgeMode=2363(int mode,) - -# Retrieve the colour used in edge indication. -get colour GetEdgeColour=2364(,) - -# Change the colour used in edge indication. -set void SetEdgeColour=2365(colour edgeColour,) - -# Sets the current caret position to be the search anchor. -fun void SearchAnchor=2366(,) - -# Find some text starting at the search anchor. -# Does not ensure the selection is visible. -fun int SearchNext=2367(int flags, string text) - -# Find some text starting at the search anchor and moving backwards. -# Does not ensure the selection is visible. -fun int SearchPrev=2368(int flags, string text) - -# Retrieves the number of lines completely visible. -get int LinesOnScreen=2370(,) - -# Set whether a pop up menu is displayed automatically when the user presses -# the wrong mouse button. -fun void UsePopUp=2371(bool allowPopUp,) - -# Is the selection rectangular? The alternative is the more common stream selection. -get bool SelectionIsRectangle=2372(,) - -# Set the zoom level. This number of points is added to the size of all fonts. -# It may be positive to magnify or negative to reduce. -set void SetZoom=2373(int zoom,) -# Retrieve the zoom level. -get int GetZoom=2374(,) - -# Create a new document object. -# Starts with reference count of 1 and not selected into editor. -fun int CreateDocument=2375(,) -# Extend life of document. -fun void AddRefDocument=2376(, int doc) -# Release a reference to the document, deleting document if it fades to black. -fun void ReleaseDocument=2377(, int doc) - -# Get which document modification events are sent to the container. -get int GetModEventMask=2378(,) - -# Change internal focus flag. -set void SetFocus=2380(bool focus,) -# Get internal focus flag. -get bool GetFocus=2381(,) - -# Change error status - 0 = OK. -set void SetStatus=2382(int statusCode,) -# Get error status. -get int GetStatus=2383(,) - -# Set whether the mouse is captured when its button is pressed. -set void SetMouseDownCaptures=2384(bool captures,) -# Get whether mouse gets captured. -get bool GetMouseDownCaptures=2385(,) - -enu CursorShape=SC_CURSOR -val SC_CURSORNORMAL=-1 -val SC_CURSORWAIT=4 -# Sets the cursor to one of the SC_CURSOR* values. -set void SetCursor=2386(int cursorType,) -# Get cursor type. -get int GetCursor=2387(,) - -# Change the way control characters are displayed: -# If symbol is < 32, keep the drawn way, else, use the given character. -set void SetControlCharSymbol=2388(int symbol,) -# Get the way control characters are displayed. -get int GetControlCharSymbol=2389(,) - -# Move to the previous change in capitalisation. -fun void WordPartLeft=2390(,) -# Move to the previous change in capitalisation extending selection -# to new caret position. -fun void WordPartLeftExtend=2391(,) -# Move to the change next in capitalisation. -fun void WordPartRight=2392(,) -# Move to the next change in capitalisation extending selection -# to new caret position. -fun void WordPartRightExtend=2393(,) - -# Constants for use with SetVisiblePolicy, similar to SetCaretPolicy. -val VISIBLE_SLOP=0x01 -val VISIBLE_STRICT=0x04 -# Set the way the display area is determined when a particular line -# is to be moved to by Find, FindNext, GotoLine, etc. -fun void SetVisiblePolicy=2394(int visiblePolicy, int visibleSlop) - -# Delete back from the current position to the start of the line. -fun void DelLineLeft=2395(,) - -# Delete forwards from the current position to the end of the line. -fun void DelLineRight=2396(,) - -# Get and Set the xOffset (ie, horizonal scroll position). -set void SetXOffset=2397(int newOffset,) -get int GetXOffset=2398(,) - -# Set the last x chosen value to be the caret x position. -fun void ChooseCaretX=2399(,) - -# Set the focus to this Scintilla widget. -fun void GrabFocus=2400(,) - -enu CaretPolicy = CARET_ -# Caret policy, used by SetXCaretPolicy and SetYCaretPolicy. -# If CARET_SLOP is set, we can define a slop value: caretSlop. -# This value defines an unwanted zone (UZ) where the caret is... unwanted. -# This zone is defined as a number of pixels near the vertical margins, -# and as a number of lines near the horizontal margins. -# By keeping the caret away from the edges, it is seen within its context, -# so it is likely that the identifier that the caret is on can be completely seen, -# and that the current line is seen with some of the lines following it which are -# often dependent on that line. -val CARET_SLOP=0x01 -# If CARET_STRICT is set, the policy is enforced... strictly. -# The caret is centred on the display if slop is not set, -# and cannot go in the UZ if slop is set. -val CARET_STRICT=0x04 -# If CARET_JUMPS is set, the display is moved more energetically -# so the caret can move in the same direction longer before the policy is applied again. -val CARET_JUMPS=0x10 -# If CARET_EVEN is not set, instead of having symmetrical UZs, -# the left and bottom UZs are extended up to right and top UZs respectively. -# This way, we favour the displaying of useful information: the begining of lines, -# where most code reside, and the lines after the caret, eg. the body of a function. -val CARET_EVEN=0x08 - -# Set the way the caret is kept visible when going sideway. -# The exclusion zone is given in pixels. -fun void SetXCaretPolicy=2402(int caretPolicy, int caretSlop) - -# Set the way the line the caret is on is kept visible. -# The exclusion zone is given in lines. -fun void SetYCaretPolicy=2403(int caretPolicy, int caretSlop) - -# Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE). -set void SetPrintWrapMode=2406(int mode,) - -# Is printing line wrapped? -get int GetPrintWrapMode=2407(,) - -# Set a fore colour for active hotspots. -set void SetHotspotActiveFore=2410(bool useSetting, colour fore) - -# Get the fore colour for active hotspots. -get colour GetHotspotActiveFore=2494(,) - -# Set a back colour for active hotspots. -set void SetHotspotActiveBack=2411(bool useSetting, colour back) - -# Get the back colour for active hotspots. -get colour GetHotspotActiveBack=2495(,) - -# Enable / Disable underlining active hotspots. -set void SetHotspotActiveUnderline=2412(bool underline,) - -# Get whether underlining for active hotspots. -get bool GetHotspotActiveUnderline=2496(,) - -# Limit hotspots to single line so hotspots on two lines don't merge. -set void SetHotspotSingleLine=2421(bool singleLine,) - -# Get the HotspotSingleLine property -get bool GetHotspotSingleLine=2497(,) - -# Move caret between paragraphs (delimited by empty lines). -fun void ParaDown=2413(,) -fun void ParaDownExtend=2414(,) -fun void ParaUp=2415(,) -fun void ParaUpExtend=2416(,) - -# Given a valid document position, return the previous position taking code -# page into account. Returns 0 if passed 0. -fun position PositionBefore=2417(position pos,) - -# Given a valid document position, return the next position taking code -# page into account. Maximum value returned is the last position in the document. -fun position PositionAfter=2418(position pos,) - -# Copy a range of text to the clipboard. Positions are clipped into the document. -fun void CopyRange=2419(position start, position end) - -# Copy argument text to the clipboard. -fun void CopyText=2420(int length, string text) - -enu SelectionMode=SC_SEL_ -val SC_SEL_STREAM=0 -val SC_SEL_RECTANGLE=1 -val SC_SEL_LINES=2 - -# Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE) or -# by lines (SC_SEL_LINES). -set void SetSelectionMode=2422(int mode,) - -# Get the mode of the current selection. -get int GetSelectionMode=2423(,) - -# Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line). -fun position GetLineSelStartPosition=2424(int line,) - -# Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line). -fun position GetLineSelEndPosition=2425(int line,) - -## RectExtended rectangular selection moves -# Move caret down one line, extending rectangular selection to new caret position. -fun void LineDownRectExtend=2426(,) - -# Move caret up one line, extending rectangular selection to new caret position. -fun void LineUpRectExtend=2427(,) - -# Move caret left one character, extending rectangular selection to new caret position. -fun void CharLeftRectExtend=2428(,) - -# Move caret right one character, extending rectangular selection to new caret position. -fun void CharRightRectExtend=2429(,) - -# Move caret to first position on line, extending rectangular selection to new caret position. -fun void HomeRectExtend=2430(,) - -# Move caret to before first visible character on line. -# If already there move to first character on line. -# In either case, extend rectangular selection to new caret position. -fun void VCHomeRectExtend=2431(,) - -# Move caret to last position on line, extending rectangular selection to new caret position. -fun void LineEndRectExtend=2432(,) - -# Move caret one page up, extending rectangular selection to new caret position. -fun void PageUpRectExtend=2433(,) - -# Move caret one page down, extending rectangular selection to new caret position. -fun void PageDownRectExtend=2434(,) - - -# Move caret to top of page, or one page up if already at top of page. -fun void StutteredPageUp=2435(,) - -# Move caret to top of page, or one page up if already at top of page, extending selection to new caret position. -fun void StutteredPageUpExtend=2436(,) - -# Move caret to bottom of page, or one page down if already at bottom of page. -fun void StutteredPageDown=2437(,) - -# Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position. -fun void StutteredPageDownExtend=2438(,) - - -# Move caret left one word, position cursor at end of word. -fun void WordLeftEnd=2439(,) - -# Move caret left one word, position cursor at end of word, extending selection to new caret position. -fun void WordLeftEndExtend=2440(,) - -# Move caret right one word, position cursor at end of word. -fun void WordRightEnd=2441(,) - -# Move caret right one word, position cursor at end of word, extending selection to new caret position. -fun void WordRightEndExtend=2442(,) - -# Set the set of characters making up whitespace for when moving or selecting by word. -# Should be called after SetWordChars. -set void SetWhitespaceChars=2443(, string characters) - -# Reset the set of characters for whitespace and word characters to the defaults. -fun void SetCharsDefault=2444(,) - -# Get currently selected item position in the auto-completion list -fun int AutoCGetCurrent=2445(,) - -# Enlarge the document to a particular size of text bytes. -fun void Allocate=2446(int bytes,) - -# Returns the target converted to UTF8. -# Return the length in bytes. -fun int TargetAsUTF8=2447(, stringresult s) - -# Set the length of the utf8 argument for calling EncodedFromUTF8. -# Set to -1 and the string will be measured to the first nul. -fun void SetLengthForEncode=2448(int bytes,) - -# Translates a UTF8 string into the document encoding. -# Return the length of the result in bytes. -# On error return 0. -fun int EncodedFromUTF8=2449(string utf8, stringresult encoded) - -# Find the position of a column on a line taking into account tabs and -# multi-byte characters. If beyond end of line, return line end position. -fun int FindColumn=2456(int line, int column) - -# Can the caret preferred x position only be changed by explicit movement commands? -get bool GetCaretSticky=2457(,) - -# Stop the caret preferred x position changing when the user types. -set void SetCaretSticky=2458(bool useCaretStickyBehaviour,) - -# Switch between sticky and non-sticky: meant to be bound to a key. -fun void ToggleCaretSticky=2459(,) - -# Enable/Disable convert-on-paste for line endings -set void SetPasteConvertEndings=2467(bool convert,) - -# Get convert-on-paste setting -get bool GetPasteConvertEndings=2468(,) - -# Duplicate the selection. If selection empty duplicate the line containing the caret. -fun void SelectionDuplicate=2469(,) - -val SC_ALPHA_TRANSPARENT=0 -val SC_ALPHA_OPAQUE=255 -val SC_ALPHA_NOALPHA=256 - -# Set background alpha of the caret line. -set void SetCaretLineBackAlpha=2470(int alpha,) - -# Get the background alpha of the caret line. -get int GetCaretLineBackAlpha=2471(,) - -enu CaretStyle=CARETSTYLE_ -val CARETSTYLE_INVISIBLE=0 -val CARETSTYLE_LINE=1 -val CARETSTYLE_BLOCK=2 - -# Set the style of the caret to be drawn. -set void SetCaretStyle=2512(int caretStyle,) - -# Returns the current style of the caret. -get int GetCaretStyle=2513(,) - -# Set the indicator used for IndicatorFillRange and IndicatorClearRange -set void SetIndicatorCurrent=2500(int indicator,) - -# Get the current indicator -get int GetIndicatorCurrent=2501(,) - -# Set the value used for IndicatorFillRange -set void SetIndicatorValue=2502(int value,) - -# Get the current indicator vaue -get int GetIndicatorValue=2503(,) - -# Turn a indicator on over a range. -fun void IndicatorFillRange=2504(int position, int fillLength) - -# Turn a indicator off over a range. -fun void IndicatorClearRange=2505(int position, int clearLength) - -# Are any indicators present at position? -fun int IndicatorAllOnFor=2506(int position,) - -# What value does a particular indicator have at at a position? -fun int IndicatorValueAt=2507(int indicator, int position) - -# Where does a particular indicator start? -fun int IndicatorStart=2508(int indicator, int position) - -# Where does a particular indicator end? -fun int IndicatorEnd=2509(int indicator, int position) - -# Set number of entries in position cache -set void SetPositionCache=2514(int size,) - -# How many entries are allocated to the position cache? -get int GetPositionCache=2515(,) - -# Start notifying the container of all key presses and commands. -fun void StartRecord=3001(,) - -# Stop notifying the container of all key presses and commands. -fun void StopRecord=3002(,) - -# Set the lexing language of the document. -set void SetLexer=4001(int lexer,) - -# Retrieve the lexing language of the document. -get int GetLexer=4002(,) - -# Colourise a segment of the document using the current lexing language. -fun void Colourise=4003(position start, position end) - -# Set up a value that may be used by a lexer for some optional feature. -set void SetProperty=4004(string key, string value) - -# Maximum value of keywordSet parameter of SetKeyWords. -val KEYWORDSET_MAX=8 - -# Set up the key words used by the lexer. -set void SetKeyWords=4005(int keywordSet, string keyWords) - -# Set the lexing language of the document based on string name. -set void SetLexerLanguage=4006(, string language) - -# Load a lexer library (dll / so). -fun void LoadLexerLibrary=4007(, string path) - -# Retrieve a "property" value previously set with SetProperty. -fun int GetProperty=4008(string key, stringresult buf) - -# Retrieve a "property" value previously set with SetProperty, -# with "$()" variable replacement on returned buffer. -fun int GetPropertyExpanded=4009(string key, stringresult buf) - -# Retrieve a "property" value previously set with SetProperty, -# interpreted as an int AFTER any "$()" variable replacement. -get int GetPropertyInt=4010(string key,) - -# Retrieve the number of bits the current lexer needs for styling. -get int GetStyleBitsNeeded=4011(,) - -# Notifications -# Type of modification and the action which caused the modification. -# These are defined as a bit mask to make it easy to specify which notifications are wanted. -# One bit is set from each of SC_MOD_* and SC_PERFORMED_*. -enu ModificationFlags=SC_MOD_ SC_PERFORMED_ SC_LAST -val SC_MOD_INSERTTEXT=0x1 -val SC_MOD_DELETETEXT=0x2 -val SC_MOD_CHANGESTYLE=0x4 -val SC_MOD_CHANGEFOLD=0x8 -val SC_PERFORMED_USER=0x10 -val SC_PERFORMED_UNDO=0x20 -val SC_PERFORMED_REDO=0x40 -val SC_MULTISTEPUNDOREDO=0x80 -val SC_LASTSTEPINUNDOREDO=0x100 -val SC_MOD_CHANGEMARKER=0x200 -val SC_MOD_BEFOREINSERT=0x400 -val SC_MOD_BEFOREDELETE=0x800 -val SC_MULTILINEUNDOREDO=0x1000 -val SC_STARTACTION=0x2000 -val SC_MOD_CHANGEINDICATOR=0x4000 -val SC_MODEVENTMASKALL=0x6FFF - -# For compatibility, these go through the COMMAND notification rather than NOTIFY -# and should have had exactly the same values as the EN_* constants. -# Unfortunately the SETFOCUS and KILLFOCUS are flipped over from EN_* -# As clients depend on these constants, this will not be changed. -val SCEN_CHANGE=768 -val SCEN_SETFOCUS=512 -val SCEN_KILLFOCUS=256 - -# Symbolic key codes and modifier flags. -# ASCII and other printable characters below 256. -# Extended keys above 300. - -enu Keys=SCK_ -val SCK_DOWN=300 -val SCK_UP=301 -val SCK_LEFT=302 -val SCK_RIGHT=303 -val SCK_HOME=304 -val SCK_END=305 -val SCK_PRIOR=306 -val SCK_NEXT=307 -val SCK_DELETE=308 -val SCK_INSERT=309 -val SCK_ESCAPE=7 -val SCK_BACK=8 -val SCK_TAB=9 -val SCK_RETURN=13 -val SCK_ADD=310 -val SCK_SUBTRACT=311 -val SCK_DIVIDE=312 -val SCK_WIN=313 -val SCK_RWIN=314 -val SCK_MENU=315 - -enu KeyMod=SCMOD_ -val SCMOD_NORM=0 -val SCMOD_SHIFT=1 -val SCMOD_CTRL=2 -val SCMOD_ALT=4 - -################################################ -# For SciLexer.h -enu Lexer=SCLEX_ -val SCLEX_CONTAINER=0 -val SCLEX_NULL=1 -val SCLEX_PYTHON=2 -val SCLEX_CPP=3 -val SCLEX_HTML=4 -val SCLEX_XML=5 -val SCLEX_PERL=6 -val SCLEX_SQL=7 -val SCLEX_VB=8 -val SCLEX_PROPERTIES=9 -val SCLEX_ERRORLIST=10 -val SCLEX_MAKEFILE=11 -val SCLEX_BATCH=12 -val SCLEX_XCODE=13 -val SCLEX_LATEX=14 -val SCLEX_LUA=15 -val SCLEX_DIFF=16 -val SCLEX_CONF=17 -val SCLEX_PASCAL=18 -val SCLEX_AVE=19 -val SCLEX_ADA=20 -val SCLEX_LISP=21 -val SCLEX_RUBY=22 -val SCLEX_EIFFEL=23 -val SCLEX_EIFFELKW=24 -val SCLEX_TCL=25 -val SCLEX_NNCRONTAB=26 -val SCLEX_BULLANT=27 -val SCLEX_VBSCRIPT=28 -val SCLEX_BAAN=31 -val SCLEX_MATLAB=32 -val SCLEX_SCRIPTOL=33 -val SCLEX_ASM=34 -val SCLEX_CPPNOCASE=35 -val SCLEX_FORTRAN=36 -val SCLEX_F77=37 -val SCLEX_CSS=38 -val SCLEX_POV=39 -val SCLEX_LOUT=40 -val SCLEX_ESCRIPT=41 -val SCLEX_PS=42 -val SCLEX_NSIS=43 -val SCLEX_MMIXAL=44 -val SCLEX_CLW=45 -val SCLEX_CLWNOCASE=46 -val SCLEX_LOT=47 -val SCLEX_YAML=48 -val SCLEX_TEX=49 -val SCLEX_METAPOST=50 -val SCLEX_POWERBASIC=51 -val SCLEX_FORTH=52 -val SCLEX_ERLANG=53 -val SCLEX_OCTAVE=54 -val SCLEX_MSSQL=55 -val SCLEX_VERILOG=56 -val SCLEX_KIX=57 -val SCLEX_GUI4CLI=58 -val SCLEX_SPECMAN=59 -val SCLEX_AU3=60 -val SCLEX_APDL=61 -val SCLEX_BASH=62 -val SCLEX_ASN1=63 -val SCLEX_VHDL=64 -val SCLEX_CAML=65 -val SCLEX_BLITZBASIC=66 -val SCLEX_PUREBASIC=67 -val SCLEX_HASKELL=68 -val SCLEX_PHPSCRIPT=69 -val SCLEX_TADS3=70 -val SCLEX_REBOL=71 -val SCLEX_SMALLTALK=72 -val SCLEX_FLAGSHIP=73 -val SCLEX_CSOUND=74 -val SCLEX_FREEBASIC=75 -val SCLEX_INNOSETUP=76 -val SCLEX_OPAL=77 -val SCLEX_SPICE=78 -val SCLEX_D=79 -val SCLEX_CMAKE=80 -val SCLEX_GAP=81 -val SCLEX_PLM=82 -val SCLEX_PROGRESS=83 - -# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a -# value assigned in sequence from SCLEX_AUTOMATIC+1. -val SCLEX_AUTOMATIC=1000 -# Lexical states for SCLEX_PYTHON -lex Python=SCLEX_PYTHON SCE_P_ -val SCE_P_DEFAULT=0 -val SCE_P_COMMENTLINE=1 -val SCE_P_NUMBER=2 -val SCE_P_STRING=3 -val SCE_P_CHARACTER=4 -val SCE_P_WORD=5 -val SCE_P_TRIPLE=6 -val SCE_P_TRIPLEDOUBLE=7 -val SCE_P_CLASSNAME=8 -val SCE_P_DEFNAME=9 -val SCE_P_OPERATOR=10 -val SCE_P_IDENTIFIER=11 -val SCE_P_COMMENTBLOCK=12 -val SCE_P_STRINGEOL=13 -val SCE_P_WORD2=14 -val SCE_P_DECORATOR=15 -# Lexical states for SCLEX_CPP -lex Cpp=SCLEX_CPP SCE_C_ -lex Pascal=SCLEX_PASCAL SCE_C_ -lex BullAnt=SCLEX_BULLANT SCE_C_ -val SCE_C_DEFAULT=0 -val SCE_C_COMMENT=1 -val SCE_C_COMMENTLINE=2 -val SCE_C_COMMENTDOC=3 -val SCE_C_NUMBER=4 -val SCE_C_WORD=5 -val SCE_C_STRING=6 -val SCE_C_CHARACTER=7 -val SCE_C_UUID=8 -val SCE_C_PREPROCESSOR=9 -val SCE_C_OPERATOR=10 -val SCE_C_IDENTIFIER=11 -val SCE_C_STRINGEOL=12 -val SCE_C_VERBATIM=13 -val SCE_C_REGEX=14 -val SCE_C_COMMENTLINEDOC=15 -val SCE_C_WORD2=16 -val SCE_C_COMMENTDOCKEYWORD=17 -val SCE_C_COMMENTDOCKEYWORDERROR=18 -val SCE_C_GLOBALCLASS=19 -# Lexical states for SCLEX_D -lex D=SCLEX_D SCE_D_ -val SCE_D_DEFAULT=0 -val SCE_D_COMMENT=1 -val SCE_D_COMMENTLINE=2 -val SCE_D_COMMENTDOC=3 -val SCE_D_COMMENTNESTED=4 -val SCE_D_NUMBER=5 -val SCE_D_WORD=6 -val SCE_D_WORD2=7 -val SCE_D_WORD3=8 -val SCE_D_TYPEDEF=9 -val SCE_D_STRING=10 -val SCE_D_STRINGEOL=11 -val SCE_D_CHARACTER=12 -val SCE_D_OPERATOR=13 -val SCE_D_IDENTIFIER=14 -val SCE_D_COMMENTLINEDOC=15 -val SCE_D_COMMENTDOCKEYWORD=16 -val SCE_D_COMMENTDOCKEYWORDERROR=17 -# Lexical states for SCLEX_TCL -lex TCL=SCLEX_TCL SCE_TCL_ -val SCE_TCL_DEFAULT=0 -val SCE_TCL_COMMENT=1 -val SCE_TCL_COMMENTLINE=2 -val SCE_TCL_NUMBER=3 -val SCE_TCL_WORD_IN_QUOTE=4 -val SCE_TCL_IN_QUOTE=5 -val SCE_TCL_OPERATOR=6 -val SCE_TCL_IDENTIFIER=7 -val SCE_TCL_SUBSTITUTION=8 -val SCE_TCL_SUB_BRACE=9 -val SCE_TCL_MODIFIER=10 -val SCE_TCL_EXPAND=11 -val SCE_TCL_WORD=12 -val SCE_TCL_WORD2=13 -val SCE_TCL_WORD3=14 -val SCE_TCL_WORD4=15 -val SCE_TCL_WORD5=16 -val SCE_TCL_WORD6=17 -val SCE_TCL_WORD7=18 -val SCE_TCL_WORD8=19 -val SCE_TCL_COMMENT_BOX=20 -val SCE_TCL_BLOCK_COMMENT=21 -# Lexical states for SCLEX_HTML, SCLEX_XML -lex HTML=SCLEX_HTML SCE_H -lex XML=SCLEX_XML SCE_H -lex ASP=SCLEX_ASP SCE_H -lex PHP=SCLEX_PHP SCE_H -val SCE_H_DEFAULT=0 -val SCE_H_TAG=1 -val SCE_H_TAGUNKNOWN=2 -val SCE_H_ATTRIBUTE=3 -val SCE_H_ATTRIBUTEUNKNOWN=4 -val SCE_H_NUMBER=5 -val SCE_H_DOUBLESTRING=6 -val SCE_H_SINGLESTRING=7 -val SCE_H_OTHER=8 -val SCE_H_COMMENT=9 -val SCE_H_ENTITY=10 -# XML and ASP -val SCE_H_TAGEND=11 -val SCE_H_XMLSTART=12 -val SCE_H_XMLEND=13 -val SCE_H_SCRIPT=14 -val SCE_H_ASP=15 -val SCE_H_ASPAT=16 -val SCE_H_CDATA=17 -val SCE_H_QUESTION=18 -# More HTML -val SCE_H_VALUE=19 -# X-Code -val SCE_H_XCCOMMENT=20 -# SGML -val SCE_H_SGML_DEFAULT=21 -val SCE_H_SGML_COMMAND=22 -val SCE_H_SGML_1ST_PARAM=23 -val SCE_H_SGML_DOUBLESTRING=24 -val SCE_H_SGML_SIMPLESTRING=25 -val SCE_H_SGML_ERROR=26 -val SCE_H_SGML_SPECIAL=27 -val SCE_H_SGML_ENTITY=28 -val SCE_H_SGML_COMMENT=29 -val SCE_H_SGML_1ST_PARAM_COMMENT=30 -val SCE_H_SGML_BLOCK_DEFAULT=31 -# Embedded Javascript -val SCE_HJ_START=40 -val SCE_HJ_DEFAULT=41 -val SCE_HJ_COMMENT=42 -val SCE_HJ_COMMENTLINE=43 -val SCE_HJ_COMMENTDOC=44 -val SCE_HJ_NUMBER=45 -val SCE_HJ_WORD=46 -val SCE_HJ_KEYWORD=47 -val SCE_HJ_DOUBLESTRING=48 -val SCE_HJ_SINGLESTRING=49 -val SCE_HJ_SYMBOLS=50 -val SCE_HJ_STRINGEOL=51 -val SCE_HJ_REGEX=52 -# ASP Javascript -val SCE_HJA_START=55 -val SCE_HJA_DEFAULT=56 -val SCE_HJA_COMMENT=57 -val SCE_HJA_COMMENTLINE=58 -val SCE_HJA_COMMENTDOC=59 -val SCE_HJA_NUMBER=60 -val SCE_HJA_WORD=61 -val SCE_HJA_KEYWORD=62 -val SCE_HJA_DOUBLESTRING=63 -val SCE_HJA_SINGLESTRING=64 -val SCE_HJA_SYMBOLS=65 -val SCE_HJA_STRINGEOL=66 -val SCE_HJA_REGEX=67 -# Embedded VBScript -val SCE_HB_START=70 -val SCE_HB_DEFAULT=71 -val SCE_HB_COMMENTLINE=72 -val SCE_HB_NUMBER=73 -val SCE_HB_WORD=74 -val SCE_HB_STRING=75 -val SCE_HB_IDENTIFIER=76 -val SCE_HB_STRINGEOL=77 -# ASP VBScript -val SCE_HBA_START=80 -val SCE_HBA_DEFAULT=81 -val SCE_HBA_COMMENTLINE=82 -val SCE_HBA_NUMBER=83 -val SCE_HBA_WORD=84 -val SCE_HBA_STRING=85 -val SCE_HBA_IDENTIFIER=86 -val SCE_HBA_STRINGEOL=87 -# Embedded Python -val SCE_HP_START=90 -val SCE_HP_DEFAULT=91 -val SCE_HP_COMMENTLINE=92 -val SCE_HP_NUMBER=93 -val SCE_HP_STRING=94 -val SCE_HP_CHARACTER=95 -val SCE_HP_WORD=96 -val SCE_HP_TRIPLE=97 -val SCE_HP_TRIPLEDOUBLE=98 -val SCE_HP_CLASSNAME=99 -val SCE_HP_DEFNAME=100 -val SCE_HP_OPERATOR=101 -val SCE_HP_IDENTIFIER=102 -# PHP -val SCE_HPHP_COMPLEX_VARIABLE=104 -# ASP Python -val SCE_HPA_START=105 -val SCE_HPA_DEFAULT=106 -val SCE_HPA_COMMENTLINE=107 -val SCE_HPA_NUMBER=108 -val SCE_HPA_STRING=109 -val SCE_HPA_CHARACTER=110 -val SCE_HPA_WORD=111 -val SCE_HPA_TRIPLE=112 -val SCE_HPA_TRIPLEDOUBLE=113 -val SCE_HPA_CLASSNAME=114 -val SCE_HPA_DEFNAME=115 -val SCE_HPA_OPERATOR=116 -val SCE_HPA_IDENTIFIER=117 -# PHP -val SCE_HPHP_DEFAULT=118 -val SCE_HPHP_HSTRING=119 -val SCE_HPHP_SIMPLESTRING=120 -val SCE_HPHP_WORD=121 -val SCE_HPHP_NUMBER=122 -val SCE_HPHP_VARIABLE=123 -val SCE_HPHP_COMMENT=124 -val SCE_HPHP_COMMENTLINE=125 -val SCE_HPHP_HSTRING_VARIABLE=126 -val SCE_HPHP_OPERATOR=127 -# Lexical states for SCLEX_PERL -lex Perl=SCLEX_PERL SCE_PL_ -val SCE_PL_DEFAULT=0 -val SCE_PL_ERROR=1 -val SCE_PL_COMMENTLINE=2 -val SCE_PL_POD=3 -val SCE_PL_NUMBER=4 -val SCE_PL_WORD=5 -val SCE_PL_STRING=6 -val SCE_PL_CHARACTER=7 -val SCE_PL_PUNCTUATION=8 -val SCE_PL_PREPROCESSOR=9 -val SCE_PL_OPERATOR=10 -val SCE_PL_IDENTIFIER=11 -val SCE_PL_SCALAR=12 -val SCE_PL_ARRAY=13 -val SCE_PL_HASH=14 -val SCE_PL_SYMBOLTABLE=15 -val SCE_PL_VARIABLE_INDEXER=16 -val SCE_PL_REGEX=17 -val SCE_PL_REGSUBST=18 -val SCE_PL_LONGQUOTE=19 -val SCE_PL_BACKTICKS=20 -val SCE_PL_DATASECTION=21 -val SCE_PL_HERE_DELIM=22 -val SCE_PL_HERE_Q=23 -val SCE_PL_HERE_QQ=24 -val SCE_PL_HERE_QX=25 -val SCE_PL_STRING_Q=26 -val SCE_PL_STRING_QQ=27 -val SCE_PL_STRING_QX=28 -val SCE_PL_STRING_QR=29 -val SCE_PL_STRING_QW=30 -val SCE_PL_POD_VERB=31 -# Lexical states for SCLEX_RUBY -lex Ruby=SCLEX_RUBY SCE_RB_ -val SCE_RB_DEFAULT=0 -val SCE_RB_ERROR=1 -val SCE_RB_COMMENTLINE=2 -val SCE_RB_POD=3 -val SCE_RB_NUMBER=4 -val SCE_RB_WORD=5 -val SCE_RB_STRING=6 -val SCE_RB_CHARACTER=7 -val SCE_RB_CLASSNAME=8 -val SCE_RB_DEFNAME=9 -val SCE_RB_OPERATOR=10 -val SCE_RB_IDENTIFIER=11 -val SCE_RB_REGEX=12 -val SCE_RB_GLOBAL=13 -val SCE_RB_SYMBOL=14 -val SCE_RB_MODULE_NAME=15 -val SCE_RB_INSTANCE_VAR=16 -val SCE_RB_CLASS_VAR=17 -val SCE_RB_BACKTICKS=18 -val SCE_RB_DATASECTION=19 -val SCE_RB_HERE_DELIM=20 -val SCE_RB_HERE_Q=21 -val SCE_RB_HERE_QQ=22 -val SCE_RB_HERE_QX=23 -val SCE_RB_STRING_Q=24 -val SCE_RB_STRING_QQ=25 -val SCE_RB_STRING_QX=26 -val SCE_RB_STRING_QR=27 -val SCE_RB_STRING_QW=28 -val SCE_RB_WORD_DEMOTED=29 -val SCE_RB_STDIN=30 -val SCE_RB_STDOUT=31 -val SCE_RB_STDERR=40 -val SCE_RB_UPPER_BOUND=41 -# Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC -lex VB=SCLEX_VB SCE_B_ -lex VBScript=SCLEX_VBSCRIPT SCE_B_ -lex PowerBasic=SCLEX_POWERBASIC SCE_B_ -val SCE_B_DEFAULT=0 -val SCE_B_COMMENT=1 -val SCE_B_NUMBER=2 -val SCE_B_KEYWORD=3 -val SCE_B_STRING=4 -val SCE_B_PREPROCESSOR=5 -val SCE_B_OPERATOR=6 -val SCE_B_IDENTIFIER=7 -val SCE_B_DATE=8 -val SCE_B_STRINGEOL=9 -val SCE_B_KEYWORD2=10 -val SCE_B_KEYWORD3=11 -val SCE_B_KEYWORD4=12 -val SCE_B_CONSTANT=13 -val SCE_B_ASM=14 -val SCE_B_LABEL=15 -val SCE_B_ERROR=16 -val SCE_B_HEXNUMBER=17 -val SCE_B_BINNUMBER=18 -# Lexical states for SCLEX_PROPERTIES -lex Properties=SCLEX_PROPERTIES SCE_PROPS_ -val SCE_PROPS_DEFAULT=0 -val SCE_PROPS_COMMENT=1 -val SCE_PROPS_SECTION=2 -val SCE_PROPS_ASSIGNMENT=3 -val SCE_PROPS_DEFVAL=4 -val SCE_PROPS_KEY=5 -# Lexical states for SCLEX_LATEX -lex LaTeX=SCLEX_LATEX SCE_L_ -val SCE_L_DEFAULT=0 -val SCE_L_COMMAND=1 -val SCE_L_TAG=2 -val SCE_L_MATH=3 -val SCE_L_COMMENT=4 -# Lexical states for SCLEX_LUA -lex Lua=SCLEX_LUA SCE_LUA_ -val SCE_LUA_DEFAULT=0 -val SCE_LUA_COMMENT=1 -val SCE_LUA_COMMENTLINE=2 -val SCE_LUA_COMMENTDOC=3 -val SCE_LUA_NUMBER=4 -val SCE_LUA_WORD=5 -val SCE_LUA_STRING=6 -val SCE_LUA_CHARACTER=7 -val SCE_LUA_LITERALSTRING=8 -val SCE_LUA_PREPROCESSOR=9 -val SCE_LUA_OPERATOR=10 -val SCE_LUA_IDENTIFIER=11 -val SCE_LUA_STRINGEOL=12 -val SCE_LUA_WORD2=13 -val SCE_LUA_WORD3=14 -val SCE_LUA_WORD4=15 -val SCE_LUA_WORD5=16 -val SCE_LUA_WORD6=17 -val SCE_LUA_WORD7=18 -val SCE_LUA_WORD8=19 -# Lexical states for SCLEX_ERRORLIST -lex ErrorList=SCLEX_ERRORLIST SCE_ERR_ -val SCE_ERR_DEFAULT=0 -val SCE_ERR_PYTHON=1 -val SCE_ERR_GCC=2 -val SCE_ERR_MS=3 -val SCE_ERR_CMD=4 -val SCE_ERR_BORLAND=5 -val SCE_ERR_PERL=6 -val SCE_ERR_NET=7 -val SCE_ERR_LUA=8 -val SCE_ERR_CTAG=9 -val SCE_ERR_DIFF_CHANGED=10 -val SCE_ERR_DIFF_ADDITION=11 -val SCE_ERR_DIFF_DELETION=12 -val SCE_ERR_DIFF_MESSAGE=13 -val SCE_ERR_PHP=14 -val SCE_ERR_ELF=15 -val SCE_ERR_IFC=16 -val SCE_ERR_IFORT=17 -val SCE_ERR_ABSF=18 -val SCE_ERR_TIDY=19 -val SCE_ERR_JAVA_STACK=20 -# Lexical states for SCLEX_BATCH -lex Batch=SCLEX_BATCH SCE_BAT_ -val SCE_BAT_DEFAULT=0 -val SCE_BAT_COMMENT=1 -val SCE_BAT_WORD=2 -val SCE_BAT_LABEL=3 -val SCE_BAT_HIDE=4 -val SCE_BAT_COMMAND=5 -val SCE_BAT_IDENTIFIER=6 -val SCE_BAT_OPERATOR=7 -# Lexical states for SCLEX_MAKEFILE -lex MakeFile=SCLEX_MAKEFILE SCE_MAKE_ -val SCE_MAKE_DEFAULT=0 -val SCE_MAKE_COMMENT=1 -val SCE_MAKE_PREPROCESSOR=2 -val SCE_MAKE_IDENTIFIER=3 -val SCE_MAKE_OPERATOR=4 -val SCE_MAKE_TARGET=5 -val SCE_MAKE_IDEOL=9 -# Lexical states for SCLEX_DIFF -lex Diff=SCLEX_DIFF SCE_DIFF_ -val SCE_DIFF_DEFAULT=0 -val SCE_DIFF_COMMENT=1 -val SCE_DIFF_COMMAND=2 -val SCE_DIFF_HEADER=3 -val SCE_DIFF_POSITION=4 -val SCE_DIFF_DELETED=5 -val SCE_DIFF_ADDED=6 -# Lexical states for SCLEX_CONF (Apache Configuration Files Lexer) -lex Conf=SCLEX_CONF SCE_CONF_ -val SCE_CONF_DEFAULT=0 -val SCE_CONF_COMMENT=1 -val SCE_CONF_NUMBER=2 -val SCE_CONF_IDENTIFIER=3 -val SCE_CONF_EXTENSION=4 -val SCE_CONF_PARAMETER=5 -val SCE_CONF_STRING=6 -val SCE_CONF_OPERATOR=7 -val SCE_CONF_IP=8 -val SCE_CONF_DIRECTIVE=9 -# Lexical states for SCLEX_AVE, Avenue -lex Avenue=SCLEX_AVE SCE_AVE_ -val SCE_AVE_DEFAULT=0 -val SCE_AVE_COMMENT=1 -val SCE_AVE_NUMBER=2 -val SCE_AVE_WORD=3 -val SCE_AVE_STRING=6 -val SCE_AVE_ENUM=7 -val SCE_AVE_STRINGEOL=8 -val SCE_AVE_IDENTIFIER=9 -val SCE_AVE_OPERATOR=10 -val SCE_AVE_WORD1=11 -val SCE_AVE_WORD2=12 -val SCE_AVE_WORD3=13 -val SCE_AVE_WORD4=14 -val SCE_AVE_WORD5=15 -val SCE_AVE_WORD6=16 -# Lexical states for SCLEX_ADA -lex Ada=SCLEX_ADA SCE_ADA_ -val SCE_ADA_DEFAULT=0 -val SCE_ADA_WORD=1 -val SCE_ADA_IDENTIFIER=2 -val SCE_ADA_NUMBER=3 -val SCE_ADA_DELIMITER=4 -val SCE_ADA_CHARACTER=5 -val SCE_ADA_CHARACTEREOL=6 -val SCE_ADA_STRING=7 -val SCE_ADA_STRINGEOL=8 -val SCE_ADA_LABEL=9 -val SCE_ADA_COMMENTLINE=10 -val SCE_ADA_ILLEGAL=11 -# Lexical states for SCLEX_BAAN -lex Baan=SCLEX_BAAN SCE_BAAN_ -val SCE_BAAN_DEFAULT=0 -val SCE_BAAN_COMMENT=1 -val SCE_BAAN_COMMENTDOC=2 -val SCE_BAAN_NUMBER=3 -val SCE_BAAN_WORD=4 -val SCE_BAAN_STRING=5 -val SCE_BAAN_PREPROCESSOR=6 -val SCE_BAAN_OPERATOR=7 -val SCE_BAAN_IDENTIFIER=8 -val SCE_BAAN_STRINGEOL=9 -val SCE_BAAN_WORD2=10 -# Lexical states for SCLEX_LISP -lex Lisp=SCLEX_LISP SCE_LISP_ -val SCE_LISP_DEFAULT=0 -val SCE_LISP_COMMENT=1 -val SCE_LISP_NUMBER=2 -val SCE_LISP_KEYWORD=3 -val SCE_LISP_KEYWORD_KW=4 -val SCE_LISP_SYMBOL=5 -val SCE_LISP_STRING=6 -val SCE_LISP_STRINGEOL=8 -val SCE_LISP_IDENTIFIER=9 -val SCE_LISP_OPERATOR=10 -val SCE_LISP_SPECIAL=11 -val SCE_LISP_MULTI_COMMENT=12 -# Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW -lex Eiffel=SCLEX_EIFFEL SCE_EIFFEL_ -lex EiffelKW=SCLEX_EIFFELKW SCE_EIFFEL_ -val SCE_EIFFEL_DEFAULT=0 -val SCE_EIFFEL_COMMENTLINE=1 -val SCE_EIFFEL_NUMBER=2 -val SCE_EIFFEL_WORD=3 -val SCE_EIFFEL_STRING=4 -val SCE_EIFFEL_CHARACTER=5 -val SCE_EIFFEL_OPERATOR=6 -val SCE_EIFFEL_IDENTIFIER=7 -val SCE_EIFFEL_STRINGEOL=8 -# Lexical states for SCLEX_NNCRONTAB (nnCron crontab Lexer) -lex NNCronTab=SCLEX_NNCRONTAB SCE_NNCRONTAB_ -val SCE_NNCRONTAB_DEFAULT=0 -val SCE_NNCRONTAB_COMMENT=1 -val SCE_NNCRONTAB_TASK=2 -val SCE_NNCRONTAB_SECTION=3 -val SCE_NNCRONTAB_KEYWORD=4 -val SCE_NNCRONTAB_MODIFIER=5 -val SCE_NNCRONTAB_ASTERISK=6 -val SCE_NNCRONTAB_NUMBER=7 -val SCE_NNCRONTAB_STRING=8 -val SCE_NNCRONTAB_ENVIRONMENT=9 -val SCE_NNCRONTAB_IDENTIFIER=10 -# Lexical states for SCLEX_FORTH (Forth Lexer) -lex Forth=SCLEX_FORTH SCE_FORTH_ -val SCE_FORTH_DEFAULT=0 -val SCE_FORTH_COMMENT=1 -val SCE_FORTH_COMMENT_ML=2 -val SCE_FORTH_IDENTIFIER=3 -val SCE_FORTH_CONTROL=4 -val SCE_FORTH_KEYWORD=5 -val SCE_FORTH_DEFWORD=6 -val SCE_FORTH_PREWORD1=7 -val SCE_FORTH_PREWORD2=8 -val SCE_FORTH_NUMBER=9 -val SCE_FORTH_STRING=10 -val SCE_FORTH_LOCALE=11 -# Lexical states for SCLEX_MATLAB -lex MatLab=SCLEX_MATLAB SCE_MATLAB_ -val SCE_MATLAB_DEFAULT=0 -val SCE_MATLAB_COMMENT=1 -val SCE_MATLAB_COMMAND=2 -val SCE_MATLAB_NUMBER=3 -val SCE_MATLAB_KEYWORD=4 -# single quoted string -val SCE_MATLAB_STRING=5 -val SCE_MATLAB_OPERATOR=6 -val SCE_MATLAB_IDENTIFIER=7 -val SCE_MATLAB_DOUBLEQUOTESTRING=8 -# Lexical states for SCLEX_SCRIPTOL -lex Sol=SCLEX_SCRIPTOL SCE_SCRIPTOL_ -val SCE_SCRIPTOL_DEFAULT=0 -val SCE_SCRIPTOL_WHITE=1 -val SCE_SCRIPTOL_COMMENTLINE=2 -val SCE_SCRIPTOL_PERSISTENT=3 -val SCE_SCRIPTOL_CSTYLE=4 -val SCE_SCRIPTOL_COMMENTBLOCK=5 -val SCE_SCRIPTOL_NUMBER=6 -val SCE_SCRIPTOL_STRING=7 -val SCE_SCRIPTOL_CHARACTER=8 -val SCE_SCRIPTOL_STRINGEOL=9 -val SCE_SCRIPTOL_KEYWORD=10 -val SCE_SCRIPTOL_OPERATOR=11 -val SCE_SCRIPTOL_IDENTIFIER=12 -val SCE_SCRIPTOL_TRIPLE=13 -val SCE_SCRIPTOL_CLASSNAME=14 -val SCE_SCRIPTOL_PREPROCESSOR=15 -# Lexical states for SCLEX_ASM -lex Asm=SCLEX_ASM SCE_ASM_ -val SCE_ASM_DEFAULT=0 -val SCE_ASM_COMMENT=1 -val SCE_ASM_NUMBER=2 -val SCE_ASM_STRING=3 -val SCE_ASM_OPERATOR=4 -val SCE_ASM_IDENTIFIER=5 -val SCE_ASM_CPUINSTRUCTION=6 -val SCE_ASM_MATHINSTRUCTION=7 -val SCE_ASM_REGISTER=8 -val SCE_ASM_DIRECTIVE=9 -val SCE_ASM_DIRECTIVEOPERAND=10 -val SCE_ASM_COMMENTBLOCK=11 -val SCE_ASM_CHARACTER=12 -val SCE_ASM_STRINGEOL=13 -val SCE_ASM_EXTINSTRUCTION=14 -# Lexical states for SCLEX_FORTRAN -lex Fortran=SCLEX_FORTRAN SCE_F_ -lex F77=SCLEX_F77 SCE_F_ -val SCE_F_DEFAULT=0 -val SCE_F_COMMENT=1 -val SCE_F_NUMBER=2 -val SCE_F_STRING1=3 -val SCE_F_STRING2=4 -val SCE_F_STRINGEOL=5 -val SCE_F_OPERATOR=6 -val SCE_F_IDENTIFIER=7 -val SCE_F_WORD=8 -val SCE_F_WORD2=9 -val SCE_F_WORD3=10 -val SCE_F_PREPROCESSOR=11 -val SCE_F_OPERATOR2=12 -val SCE_F_LABEL=13 -val SCE_F_CONTINUATION=14 -# Lexical states for SCLEX_CSS -lex CSS=SCLEX_CSS SCE_CSS_ -val SCE_CSS_DEFAULT=0 -val SCE_CSS_TAG=1 -val SCE_CSS_CLASS=2 -val SCE_CSS_PSEUDOCLASS=3 -val SCE_CSS_UNKNOWN_PSEUDOCLASS=4 -val SCE_CSS_OPERATOR=5 -val SCE_CSS_IDENTIFIER=6 -val SCE_CSS_UNKNOWN_IDENTIFIER=7 -val SCE_CSS_VALUE=8 -val SCE_CSS_COMMENT=9 -val SCE_CSS_ID=10 -val SCE_CSS_IMPORTANT=11 -val SCE_CSS_DIRECTIVE=12 -val SCE_CSS_DOUBLESTRING=13 -val SCE_CSS_SINGLESTRING=14 -val SCE_CSS_IDENTIFIER2=15 -val SCE_CSS_ATTRIBUTE=16 -# Lexical states for SCLEX_POV -lex POV=SCLEX_POV SCE_POV_ -val SCE_POV_DEFAULT=0 -val SCE_POV_COMMENT=1 -val SCE_POV_COMMENTLINE=2 -val SCE_POV_NUMBER=3 -val SCE_POV_OPERATOR=4 -val SCE_POV_IDENTIFIER=5 -val SCE_POV_STRING=6 -val SCE_POV_STRINGEOL=7 -val SCE_POV_DIRECTIVE=8 -val SCE_POV_BADDIRECTIVE=9 -val SCE_POV_WORD2=10 -val SCE_POV_WORD3=11 -val SCE_POV_WORD4=12 -val SCE_POV_WORD5=13 -val SCE_POV_WORD6=14 -val SCE_POV_WORD7=15 -val SCE_POV_WORD8=16 -# Lexical states for SCLEX_LOUT -lex LOUT=SCLEX_LOUT SCE_LOUT_ -val SCE_LOUT_DEFAULT=0 -val SCE_LOUT_COMMENT=1 -val SCE_LOUT_NUMBER=2 -val SCE_LOUT_WORD=3 -val SCE_LOUT_WORD2=4 -val SCE_LOUT_WORD3=5 -val SCE_LOUT_WORD4=6 -val SCE_LOUT_STRING=7 -val SCE_LOUT_OPERATOR=8 -val SCE_LOUT_IDENTIFIER=9 -val SCE_LOUT_STRINGEOL=10 -# Lexical states for SCLEX_ESCRIPT -lex ESCRIPT=SCLEX_ESCRIPT SCE_ESCRIPT_ -val SCE_ESCRIPT_DEFAULT=0 -val SCE_ESCRIPT_COMMENT=1 -val SCE_ESCRIPT_COMMENTLINE=2 -val SCE_ESCRIPT_COMMENTDOC=3 -val SCE_ESCRIPT_NUMBER=4 -val SCE_ESCRIPT_WORD=5 -val SCE_ESCRIPT_STRING=6 -val SCE_ESCRIPT_OPERATOR=7 -val SCE_ESCRIPT_IDENTIFIER=8 -val SCE_ESCRIPT_BRACE=9 -val SCE_ESCRIPT_WORD2=10 -val SCE_ESCRIPT_WORD3=11 -# Lexical states for SCLEX_PS -lex PS=SCLEX_PS SCE_PS_ -val SCE_PS_DEFAULT=0 -val SCE_PS_COMMENT=1 -val SCE_PS_DSC_COMMENT=2 -val SCE_PS_DSC_VALUE=3 -val SCE_PS_NUMBER=4 -val SCE_PS_NAME=5 -val SCE_PS_KEYWORD=6 -val SCE_PS_LITERAL=7 -val SCE_PS_IMMEVAL=8 -val SCE_PS_PAREN_ARRAY=9 -val SCE_PS_PAREN_DICT=10 -val SCE_PS_PAREN_PROC=11 -val SCE_PS_TEXT=12 -val SCE_PS_HEXSTRING=13 -val SCE_PS_BASE85STRING=14 -val SCE_PS_BADSTRINGCHAR=15 -# Lexical states for SCLEX_NSIS -lex NSIS=SCLEX_NSIS SCE_NSIS_ -val SCE_NSIS_DEFAULT=0 -val SCE_NSIS_COMMENT=1 -val SCE_NSIS_STRINGDQ=2 -val SCE_NSIS_STRINGLQ=3 -val SCE_NSIS_STRINGRQ=4 -val SCE_NSIS_FUNCTION=5 -val SCE_NSIS_VARIABLE=6 -val SCE_NSIS_LABEL=7 -val SCE_NSIS_USERDEFINED=8 -val SCE_NSIS_SECTIONDEF=9 -val SCE_NSIS_SUBSECTIONDEF=10 -val SCE_NSIS_IFDEFINEDEF=11 -val SCE_NSIS_MACRODEF=12 -val SCE_NSIS_STRINGVAR=13 -val SCE_NSIS_NUMBER=14 -val SCE_NSIS_SECTIONGROUP=15 -val SCE_NSIS_PAGEEX=16 -val SCE_NSIS_FUNCTIONDEF=17 -val SCE_NSIS_COMMENTBOX=18 -# Lexical states for SCLEX_MMIXAL -lex MMIXAL=SCLEX_MMIXAL SCE_MMIXAL_ -val SCE_MMIXAL_LEADWS=0 -val SCE_MMIXAL_COMMENT=1 -val SCE_MMIXAL_LABEL=2 -val SCE_MMIXAL_OPCODE=3 -val SCE_MMIXAL_OPCODE_PRE=4 -val SCE_MMIXAL_OPCODE_VALID=5 -val SCE_MMIXAL_OPCODE_UNKNOWN=6 -val SCE_MMIXAL_OPCODE_POST=7 -val SCE_MMIXAL_OPERANDS=8 -val SCE_MMIXAL_NUMBER=9 -val SCE_MMIXAL_REF=10 -val SCE_MMIXAL_CHAR=11 -val SCE_MMIXAL_STRING=12 -val SCE_MMIXAL_REGISTER=13 -val SCE_MMIXAL_HEX=14 -val SCE_MMIXAL_OPERATOR=15 -val SCE_MMIXAL_SYMBOL=16 -val SCE_MMIXAL_INCLUDE=17 -# Lexical states for SCLEX_CLW -lex Clarion=SCLEX_CLW SCE_CLW_ -val SCE_CLW_DEFAULT=0 -val SCE_CLW_LABEL=1 -val SCE_CLW_COMMENT=2 -val SCE_CLW_STRING=3 -val SCE_CLW_USER_IDENTIFIER=4 -val SCE_CLW_INTEGER_CONSTANT=5 -val SCE_CLW_REAL_CONSTANT=6 -val SCE_CLW_PICTURE_STRING=7 -val SCE_CLW_KEYWORD=8 -val SCE_CLW_COMPILER_DIRECTIVE=9 -val SCE_CLW_RUNTIME_EXPRESSIONS=10 -val SCE_CLW_BUILTIN_PROCEDURES_FUNCTION=11 -val SCE_CLW_STRUCTURE_DATA_TYPE=12 -val SCE_CLW_ATTRIBUTE=13 -val SCE_CLW_STANDARD_EQUATE=14 -val SCE_CLW_ERROR=15 -val SCE_CLW_DEPRECATED=16 -# Lexical states for SCLEX_LOT -lex LOT=SCLEX_LOT SCE_LOT_ -val SCE_LOT_DEFAULT=0 -val SCE_LOT_HEADER=1 -val SCE_LOT_BREAK=2 -val SCE_LOT_SET=3 -val SCE_LOT_PASS=4 -val SCE_LOT_FAIL=5 -val SCE_LOT_ABORT=6 -# Lexical states for SCLEX_YAML -lex YAML=SCLEX_YAML SCE_YAML_ -val SCE_YAML_DEFAULT=0 -val SCE_YAML_COMMENT=1 -val SCE_YAML_IDENTIFIER=2 -val SCE_YAML_KEYWORD=3 -val SCE_YAML_NUMBER=4 -val SCE_YAML_REFERENCE=5 -val SCE_YAML_DOCUMENT=6 -val SCE_YAML_TEXT=7 -val SCE_YAML_ERROR=8 -# Lexical states for SCLEX_TEX -lex TeX=SCLEX_TEX SCE_TEX_ -val SCE_TEX_DEFAULT=0 -val SCE_TEX_SPECIAL=1 -val SCE_TEX_GROUP=2 -val SCE_TEX_SYMBOL=3 -val SCE_TEX_COMMAND=4 -val SCE_TEX_TEXT=5 -lex Metapost=SCLEX_METAPOST SCE_METAPOST_ -val SCE_METAPOST_DEFAULT=0 -val SCE_METAPOST_SPECIAL=1 -val SCE_METAPOST_GROUP=2 -val SCE_METAPOST_SYMBOL=3 -val SCE_METAPOST_COMMAND=4 -val SCE_METAPOST_TEXT=5 -val SCE_METAPOST_EXTRA=6 -# Lexical states for SCLEX_ERLANG -lex Erlang=SCLEX_ERLANG SCE_ERLANG_ -val SCE_ERLANG_DEFAULT=0 -val SCE_ERLANG_COMMENT=1 -val SCE_ERLANG_VARIABLE=2 -val SCE_ERLANG_NUMBER=3 -val SCE_ERLANG_KEYWORD=4 -val SCE_ERLANG_STRING=5 -val SCE_ERLANG_OPERATOR=6 -val SCE_ERLANG_ATOM=7 -val SCE_ERLANG_FUNCTION_NAME=8 -val SCE_ERLANG_CHARACTER=9 -val SCE_ERLANG_MACRO=10 -val SCE_ERLANG_RECORD=11 -val SCE_ERLANG_SEPARATOR=12 -val SCE_ERLANG_NODE_NAME=13 -val SCE_ERLANG_UNKNOWN=31 -# Lexical states for SCLEX_OCTAVE are identical to MatLab -lex Octave=SCLEX_OCTAVE SCE_MATLAB_ -# Lexical states for SCLEX_MSSQL -lex MSSQL=SCLEX_MSSQL SCE_MSSQL_ -val SCE_MSSQL_DEFAULT=0 -val SCE_MSSQL_COMMENT=1 -val SCE_MSSQL_LINE_COMMENT=2 -val SCE_MSSQL_NUMBER=3 -val SCE_MSSQL_STRING=4 -val SCE_MSSQL_OPERATOR=5 -val SCE_MSSQL_IDENTIFIER=6 -val SCE_MSSQL_VARIABLE=7 -val SCE_MSSQL_COLUMN_NAME=8 -val SCE_MSSQL_STATEMENT=9 -val SCE_MSSQL_DATATYPE=10 -val SCE_MSSQL_SYSTABLE=11 -val SCE_MSSQL_GLOBAL_VARIABLE=12 -val SCE_MSSQL_FUNCTION=13 -val SCE_MSSQL_STORED_PROCEDURE=14 -val SCE_MSSQL_DEFAULT_PREF_DATATYPE=15 -val SCE_MSSQL_COLUMN_NAME_2=16 -# Lexical states for SCLEX_VERILOG -lex Verilog=SCLEX_VERILOG SCE_V_ -val SCE_V_DEFAULT=0 -val SCE_V_COMMENT=1 -val SCE_V_COMMENTLINE=2 -val SCE_V_COMMENTLINEBANG=3 -val SCE_V_NUMBER=4 -val SCE_V_WORD=5 -val SCE_V_STRING=6 -val SCE_V_WORD2=7 -val SCE_V_WORD3=8 -val SCE_V_PREPROCESSOR=9 -val SCE_V_OPERATOR=10 -val SCE_V_IDENTIFIER=11 -val SCE_V_STRINGEOL=12 -val SCE_V_USER=19 -# Lexical states for SCLEX_KIX -lex Kix=SCLEX_KIX SCE_KIX_ -val SCE_KIX_DEFAULT=0 -val SCE_KIX_COMMENT=1 -val SCE_KIX_STRING1=2 -val SCE_KIX_STRING2=3 -val SCE_KIX_NUMBER=4 -val SCE_KIX_VAR=5 -val SCE_KIX_MACRO=6 -val SCE_KIX_KEYWORD=7 -val SCE_KIX_FUNCTIONS=8 -val SCE_KIX_OPERATOR=9 -val SCE_KIX_IDENTIFIER=31 -# Lexical states for SCLEX_GUI4CLI -val SCE_GC_DEFAULT=0 -val SCE_GC_COMMENTLINE=1 -val SCE_GC_COMMENTBLOCK=2 -val SCE_GC_GLOBAL=3 -val SCE_GC_EVENT=4 -val SCE_GC_ATTRIBUTE=5 -val SCE_GC_CONTROL=6 -val SCE_GC_COMMAND=7 -val SCE_GC_STRING=8 -val SCE_GC_OPERATOR=9 -# Lexical states for SCLEX_SPECMAN -lex Specman=SCLEX_SPECMAN SCE_SN_ -val SCE_SN_DEFAULT=0 -val SCE_SN_CODE=1 -val SCE_SN_COMMENTLINE=2 -val SCE_SN_COMMENTLINEBANG=3 -val SCE_SN_NUMBER=4 -val SCE_SN_WORD=5 -val SCE_SN_STRING=6 -val SCE_SN_WORD2=7 -val SCE_SN_WORD3=8 -val SCE_SN_PREPROCESSOR=9 -val SCE_SN_OPERATOR=10 -val SCE_SN_IDENTIFIER=11 -val SCE_SN_STRINGEOL=12 -val SCE_SN_REGEXTAG=13 -val SCE_SN_SIGNAL=14 -val SCE_SN_USER=19 -# Lexical states for SCLEX_AU3 -lex Au3=SCLEX_AU3 SCE_AU3_ -val SCE_AU3_DEFAULT=0 -val SCE_AU3_COMMENT=1 -val SCE_AU3_COMMENTBLOCK=2 -val SCE_AU3_NUMBER=3 -val SCE_AU3_FUNCTION=4 -val SCE_AU3_KEYWORD=5 -val SCE_AU3_MACRO=6 -val SCE_AU3_STRING=7 -val SCE_AU3_OPERATOR=8 -val SCE_AU3_VARIABLE=9 -val SCE_AU3_SENT=10 -val SCE_AU3_PREPROCESSOR=11 -val SCE_AU3_SPECIAL=12 -val SCE_AU3_EXPAND=13 -val SCE_AU3_COMOBJ=14 -val SCE_AU3_UDF=15 -# Lexical states for SCLEX_APDL -lex APDL=SCLEX_APDL SCE_APDL_ -val SCE_APDL_DEFAULT=0 -val SCE_APDL_COMMENT=1 -val SCE_APDL_COMMENTBLOCK=2 -val SCE_APDL_NUMBER=3 -val SCE_APDL_STRING=4 -val SCE_APDL_OPERATOR=5 -val SCE_APDL_WORD=6 -val SCE_APDL_PROCESSOR=7 -val SCE_APDL_COMMAND=8 -val SCE_APDL_SLASHCOMMAND=9 -val SCE_APDL_STARCOMMAND=10 -val SCE_APDL_ARGUMENT=11 -val SCE_APDL_FUNCTION=12 -# Lexical states for SCLEX_BASH -lex Bash=SCLEX_BASH SCE_SH_ -val SCE_SH_DEFAULT=0 -val SCE_SH_ERROR=1 -val SCE_SH_COMMENTLINE=2 -val SCE_SH_NUMBER=3 -val SCE_SH_WORD=4 -val SCE_SH_STRING=5 -val SCE_SH_CHARACTER=6 -val SCE_SH_OPERATOR=7 -val SCE_SH_IDENTIFIER=8 -val SCE_SH_SCALAR=9 -val SCE_SH_PARAM=10 -val SCE_SH_BACKTICKS=11 -val SCE_SH_HERE_DELIM=12 -val SCE_SH_HERE_Q=13 -# Lexical states for SCLEX_ASN1 -lex Asn1=SCLEX_ASN1 SCE_ASN1_ -val SCE_ASN1_DEFAULT=0 -val SCE_ASN1_COMMENT=1 -val SCE_ASN1_IDENTIFIER=2 -val SCE_ASN1_STRING=3 -val SCE_ASN1_OID=4 -val SCE_ASN1_SCALAR=5 -val SCE_ASN1_KEYWORD=6 -val SCE_ASN1_ATTRIBUTE=7 -val SCE_ASN1_DESCRIPTOR=8 -val SCE_ASN1_TYPE=9 -val SCE_ASN1_OPERATOR=10 -# Lexical states for SCLEX_VHDL -lex VHDL=SCLEX_VHDL SCE_VHDL_ -val SCE_VHDL_DEFAULT=0 -val SCE_VHDL_COMMENT=1 -val SCE_VHDL_COMMENTLINEBANG=2 -val SCE_VHDL_NUMBER=3 -val SCE_VHDL_STRING=4 -val SCE_VHDL_OPERATOR=5 -val SCE_VHDL_IDENTIFIER=6 -val SCE_VHDL_STRINGEOL=7 -val SCE_VHDL_KEYWORD=8 -val SCE_VHDL_STDOPERATOR=9 -val SCE_VHDL_ATTRIBUTE=10 -val SCE_VHDL_STDFUNCTION=11 -val SCE_VHDL_STDPACKAGE=12 -val SCE_VHDL_STDTYPE=13 -val SCE_VHDL_USERWORD=14 -# Lexical states for SCLEX_CAML -lex Caml=SCLEX_CAML SCE_CAML_ -val SCE_CAML_DEFAULT=0 -val SCE_CAML_IDENTIFIER=1 -val SCE_CAML_TAGNAME=2 -val SCE_CAML_KEYWORD=3 -val SCE_CAML_KEYWORD2=4 -val SCE_CAML_KEYWORD3=5 -val SCE_CAML_LINENUM=6 -val SCE_CAML_OPERATOR=7 -val SCE_CAML_NUMBER=8 -val SCE_CAML_CHAR=9 -val SCE_CAML_STRING=11 -val SCE_CAML_COMMENT=12 -val SCE_CAML_COMMENT1=13 -val SCE_CAML_COMMENT2=14 -val SCE_CAML_COMMENT3=15 -# Lexical states for SCLEX_HASKELL -lex Haskell=SCLEX_HASKELL SCE_HA_ -val SCE_HA_DEFAULT=0 -val SCE_HA_IDENTIFIER=1 -val SCE_HA_KEYWORD=2 -val SCE_HA_NUMBER=3 -val SCE_HA_STRING=4 -val SCE_HA_CHARACTER=5 -val SCE_HA_CLASS=6 -val SCE_HA_MODULE=7 -val SCE_HA_CAPITAL=8 -val SCE_HA_DATA=9 -val SCE_HA_IMPORT=10 -val SCE_HA_OPERATOR=11 -val SCE_HA_INSTANCE=12 -val SCE_HA_COMMENTLINE=13 -val SCE_HA_COMMENTBLOCK=14 -val SCE_HA_COMMENTBLOCK2=15 -val SCE_HA_COMMENTBLOCK3=16 -# Lexical states of SCLEX_TADS3 -lex TADS3=SCLEX_TADS3 SCE_T3_ -val SCE_T3_DEFAULT=0 -val SCE_T3_X_DEFAULT=1 -val SCE_T3_PREPROCESSOR=2 -val SCE_T3_BLOCK_COMMENT=3 -val SCE_T3_LINE_COMMENT=4 -val SCE_T3_OPERATOR=5 -val SCE_T3_KEYWORD=6 -val SCE_T3_NUMBER=7 -val SCE_T3_IDENTIFIER=8 -val SCE_T3_S_STRING=9 -val SCE_T3_D_STRING=10 -val SCE_T3_X_STRING=11 -val SCE_T3_LIB_DIRECTIVE=12 -val SCE_T3_MSG_PARAM=13 -val SCE_T3_HTML_TAG=14 -val SCE_T3_HTML_DEFAULT=15 -val SCE_T3_HTML_STRING=16 -val SCE_T3_USER1=17 -val SCE_T3_USER2=18 -val SCE_T3_USER3=19 -val SCE_T3_BRACE=20 -# Lexical states for SCLEX_REBOL -lex Rebol=SCLEX_REBOL SCE_REBOL_ -val SCE_REBOL_DEFAULT=0 -val SCE_REBOL_COMMENTLINE=1 -val SCE_REBOL_COMMENTBLOCK=2 -val SCE_REBOL_PREFACE=3 -val SCE_REBOL_OPERATOR=4 -val SCE_REBOL_CHARACTER=5 -val SCE_REBOL_QUOTEDSTRING=6 -val SCE_REBOL_BRACEDSTRING=7 -val SCE_REBOL_NUMBER=8 -val SCE_REBOL_PAIR=9 -val SCE_REBOL_TUPLE=10 -val SCE_REBOL_BINARY=11 -val SCE_REBOL_MONEY=12 -val SCE_REBOL_ISSUE=13 -val SCE_REBOL_TAG=14 -val SCE_REBOL_FILE=15 -val SCE_REBOL_EMAIL=16 -val SCE_REBOL_URL=17 -val SCE_REBOL_DATE=18 -val SCE_REBOL_TIME=19 -val SCE_REBOL_IDENTIFIER=20 -val SCE_REBOL_WORD=21 -val SCE_REBOL_WORD2=22 -val SCE_REBOL_WORD3=23 -val SCE_REBOL_WORD4=24 -val SCE_REBOL_WORD5=25 -val SCE_REBOL_WORD6=26 -val SCE_REBOL_WORD7=27 -val SCE_REBOL_WORD8=28 -# Lexical states for SCLEX_SQL -lex SQL=SCLEX_SQL SCE_SQL_ -val SCE_SQL_DEFAULT=0 -val SCE_SQL_COMMENT=1 -val SCE_SQL_COMMENTLINE=2 -val SCE_SQL_COMMENTDOC=3 -val SCE_SQL_NUMBER=4 -val SCE_SQL_WORD=5 -val SCE_SQL_STRING=6 -val SCE_SQL_CHARACTER=7 -val SCE_SQL_SQLPLUS=8 -val SCE_SQL_SQLPLUS_PROMPT=9 -val SCE_SQL_OPERATOR=10 -val SCE_SQL_IDENTIFIER=11 -val SCE_SQL_SQLPLUS_COMMENT=13 -val SCE_SQL_COMMENTLINEDOC=15 -val SCE_SQL_WORD2=16 -val SCE_SQL_COMMENTDOCKEYWORD=17 -val SCE_SQL_COMMENTDOCKEYWORDERROR=18 -val SCE_SQL_USER1=19 -val SCE_SQL_USER2=20 -val SCE_SQL_USER3=21 -val SCE_SQL_USER4=22 -val SCE_SQL_QUOTEDIDENTIFIER=23 -# Lexical states for SCLEX_SMALLTALK -lex Smalltalk=SCLEX_SMALLTALK SCE_ST_ -val SCE_ST_DEFAULT=0 -val SCE_ST_STRING=1 -val SCE_ST_NUMBER=2 -val SCE_ST_COMMENT=3 -val SCE_ST_SYMBOL=4 -val SCE_ST_BINARY=5 -val SCE_ST_BOOL=6 -val SCE_ST_SELF=7 -val SCE_ST_SUPER=8 -val SCE_ST_NIL=9 -val SCE_ST_GLOBAL=10 -val SCE_ST_RETURN=11 -val SCE_ST_SPECIAL=12 -val SCE_ST_KWSEND=13 -val SCE_ST_ASSIGN=14 -val SCE_ST_CHARACTER=15 -val SCE_ST_SPEC_SEL=16 -# Lexical states for SCLEX_FLAGSHIP (clipper) -lex FlagShip=SCLEX_FLAGSHIP SCE_B_ -val SCE_FS_DEFAULT=0 -val SCE_FS_COMMENT=1 -val SCE_FS_COMMENTLINE=2 -val SCE_FS_COMMENTDOC=3 -val SCE_FS_COMMENTLINEDOC=4 -val SCE_FS_COMMENTDOCKEYWORD=5 -val SCE_FS_COMMENTDOCKEYWORDERROR=6 -val SCE_FS_KEYWORD=7 -val SCE_FS_KEYWORD2=8 -val SCE_FS_KEYWORD3=9 -val SCE_FS_KEYWORD4=10 -val SCE_FS_NUMBER=11 -val SCE_FS_STRING=12 -val SCE_FS_PREPROCESSOR=13 -val SCE_FS_OPERATOR=14 -val SCE_FS_IDENTIFIER=15 -val SCE_FS_DATE=16 -val SCE_FS_STRINGEOL=17 -val SCE_FS_CONSTANT=18 -val SCE_FS_ASM=19 -val SCE_FS_LABEL=20 -val SCE_FS_ERROR=21 -val SCE_FS_HEXNUMBER=22 -val SCE_FS_BINNUMBER=23 -# Lexical states for SCLEX_CSOUND -lex Csound=SCLEX_CSOUND SCE_CSOUND_ -val SCE_CSOUND_DEFAULT=0 -val SCE_CSOUND_COMMENT=1 -val SCE_CSOUND_NUMBER=2 -val SCE_CSOUND_OPERATOR=3 -val SCE_CSOUND_INSTR=4 -val SCE_CSOUND_IDENTIFIER=5 -val SCE_CSOUND_OPCODE=6 -val SCE_CSOUND_HEADERSTMT=7 -val SCE_CSOUND_USERKEYWORD=8 -val SCE_CSOUND_COMMENTBLOCK=9 -val SCE_CSOUND_PARAM=10 -val SCE_CSOUND_ARATE_VAR=11 -val SCE_CSOUND_KRATE_VAR=12 -val SCE_CSOUND_IRATE_VAR=13 -val SCE_CSOUND_GLOBAL_VAR=14 -val SCE_CSOUND_STRINGEOL=15 -# Lexical states for SCLEX_INNOSETUP -lex Inno=SCLEX_INNOSETUP SCE_INNO_ -val SCE_INNO_DEFAULT=0 -val SCE_INNO_COMMENT=1 -val SCE_INNO_KEYWORD=2 -val SCE_INNO_PARAMETER=3 -val SCE_INNO_SECTION=4 -val SCE_INNO_PREPROC=5 -val SCE_INNO_PREPROC_INLINE=6 -val SCE_INNO_COMMENT_PASCAL=7 -val SCE_INNO_KEYWORD_PASCAL=8 -val SCE_INNO_KEYWORD_USER=9 -val SCE_INNO_STRING_DOUBLE=10 -val SCE_INNO_STRING_SINGLE=11 -val SCE_INNO_IDENTIFIER=12 -# Lexical states for SCLEX_OPAL -lex Opal=SCLEX_OPAL SCE_OPAL_ -val SCE_OPAL_SPACE=0 -val SCE_OPAL_COMMENT_BLOCK=1 -val SCE_OPAL_COMMENT_LINE=2 -val SCE_OPAL_INTEGER=3 -val SCE_OPAL_KEYWORD=4 -val SCE_OPAL_SORT=5 -val SCE_OPAL_STRING=6 -val SCE_OPAL_PAR=7 -val SCE_OPAL_BOOL_CONST=8 -val SCE_OPAL_DEFAULT=32 -# Lexical states for SCLEX_SPICE -lex Spice=SCLEX_SPICE SCE_SPICE_ -val SCE_SPICE_DEFAULT=0 -val SCE_SPICE_IDENTIFIER=1 -val SCE_SPICE_KEYWORD=2 -val SCE_SPICE_KEYWORD2=3 -val SCE_SPICE_KEYWORD3=4 -val SCE_SPICE_NUMBER=5 -val SCE_SPICE_DELIMITER=6 -val SCE_SPICE_VALUE=7 -val SCE_SPICE_COMMENTLINE=8 -# Lexical states for SCLEX_CMAKE -lex CMAKE=SCLEX_CMAKE SCE_CMAKE_ -val SCE_CMAKE_DEFAULT=0 -val SCE_CMAKE_COMMENT=1 -val SCE_CMAKE_STRINGDQ=2 -val SCE_CMAKE_STRINGLQ=3 -val SCE_CMAKE_STRINGRQ=4 -val SCE_CMAKE_COMMANDS=5 -val SCE_CMAKE_PARAMETERS=6 -val SCE_CMAKE_VARIABLE=7 -val SCE_CMAKE_USERDEFINED=8 -val SCE_CMAKE_WHILEDEF=9 -val SCE_CMAKE_FOREACHDEF=10 -val SCE_CMAKE_IFDEFINEDEF=11 -val SCE_CMAKE_MACRODEF=12 -val SCE_CMAKE_STRINGVAR=13 -val SCE_CMAKE_NUMBER=14 -# Lexical states for SCLEX_GAP -lex Gap=SCLEX_GAP SCE_GAP_ -val SCE_GAP_DEFAULT=0 -val SCE_GAP_IDENTIFIER=1 -val SCE_GAP_KEYWORD=2 -val SCE_GAP_KEYWORD2=3 -val SCE_GAP_KEYWORD3=4 -val SCE_GAP_KEYWORD4=5 -val SCE_GAP_STRING=6 -val SCE_GAP_CHAR=7 -val SCE_GAP_OPERATOR=8 -val SCE_GAP_COMMENT=9 -val SCE_GAP_NUMBER=10 -val SCE_GAP_STRINGEOL=11 -# Lexical state for SCLEX_PLM -lex PLM=SCLEX_PLM SCE_PLM_ -val SCE_PLM_DEFAULT=0 -val SCE_PLM_COMMENT=1 -val SCE_PLM_STRING=2 -val SCE_PLM_NUMBER=3 -val SCE_PLM_IDENTIFIER=4 -val SCE_PLM_OPERATOR=5 -val SCE_PLM_CONTROL=6 -val SCE_PLM_KEYWORD=7 -lex Progress=SCLEX_PROGRESS SCE_4GL_ -val SCE_4GL_DEFAULT=0 -val SCE_4GL_NUMBER=1 -val SCE_4GL_WORD=2 -val SCE_4GL_STRING=3 -val SCE_4GL_CHARACTER=4 -val SCE_4GL_PREPROCESSOR=5 -val SCE_4GL_OPERATOR=6 -val SCE_4GL_IDENTIFIER=7 -val SCE_4GL_BLOCK=8 -val SCE_4GL_END=9 -val SCE_4GL_COMMENT1=10 -val SCE_4GL_COMMENT2=11 -val SCE_4GL_COMMENT3=12 -val SCE_4GL_COMMENT4=13 -val SCE_4GL_COMMENT5=14 -val SCE_4GL_COMMENT6=15 -val SCE_4GL_DEFAULT_=16 -val SCE_4GL_NUMBER_=17 -val SCE_4GL_WORD_=18 -val SCE_4GL_STRING_=19 -val SCE_4GL_CHARACTER_=20 -val SCE_4GL_PREPROCESSOR_=21 -val SCE_4GL_OPERATOR_=22 -val SCE_4GL_IDENTIFIER_=23 -val SCE_4GL_BLOCK_=24 -val SCE_4GL_END_=25 -val SCE_4GL_COMMENT1_=26 -val SCE_4GL_COMMENT2_=27 -val SCE_4GL_COMMENT3_=28 -val SCE_4GL_COMMENT4_=29 -val SCE_4GL_COMMENT5_=30 -val SCE_4GL_COMMENT6_=31 - -# Events - -evt void StyleNeeded=2000(int position) -evt void CharAdded=2001(int ch) -evt void SavePointReached=2002(void) -evt void SavePointLeft=2003(void) -evt void ModifyAttemptRO=2004(void) -# GTK+ Specific to work around focus and accelerator problems: -evt void Key=2005(int ch, int modifiers) -evt void DoubleClick=2006(void) -evt void UpdateUI=2007(void) -evt void Modified=2008(int position, int modificationType, string text, int length, int linesAdded, int line, int foldLevelNow, int foldLevelPrev) -evt void MacroRecord=2009(int message, int wParam, int lParam) -evt void MarginClick=2010(int modifiers, int position, int margin) -evt void NeedShown=2011(int position, int length) -evt void Painted=2013(void) -evt void UserListSelection=2014(int listType, string text) -evt void URIDropped=2015(string text) -evt void DwellStart=2016(int position) -evt void DwellEnd=2017(int position) -evt void Zoom=2018(void) -evt void HotSpotClick=2019(int modifiers, int position) -evt void HotSpotDoubleClick=2020(int modifiers, int position) -evt void CallTipClick=2021(int position) -evt void AutoCSelection=2022(string text) -evt void IndicatorClick=2023(int modifiers, int position) -evt void IndicatorRelease=2024(int modifiers, int position) - -cat Deprecated - -# CARET_POLICY changed in 1.47 -fun void SetCaretPolicy=2369(int caretPolicy, int caretSlop) -val CARET_CENTER=0x02 -val CARET_XEVEN=0x08 -val CARET_XJUMPS=0x10 - -# The old name for SCN_UPDATEUI -val SCN_CHECKBRACE=2007 -evt void PosChanged=2012(int position) - -# SCLEX_HTML should be used in preference to these. -val SCLEX_ASP=29 -val SCLEX_PHP=30 +## First line may be used for shbang + +## This file defines the interface to Scintilla + +## Copyright 2000-2003 by Neil Hodgson +## The License.txt file describes the conditions under which this software may be distributed. + +## A line starting with ## is a pure comment and should be stripped by readers. +## A line starting with #! is for future shbang use +## A line starting with # followed by a space is a documentation comment and refers +## to the next feature definition. + +## Each feature is defined by a line starting with fun, get, set, val or evt. +## cat -> start a category +## fun -> a function +## get -> a property get function +## set -> a property set function +## val -> definition of a constant +## evt -> an event +## enu -> associate an enumeration with a set of vals with a prefix +## lex -> associate a lexer with the lexical classes it produces +## +## All other feature names should be ignored. They may be defined in the future. +## A property may have a set function, a get function or both. Each will have +## "Get" or "Set" in their names and the corresponding name will have the obvious switch. +## A property may be subscripted, in which case the first parameter is the subscript. +## fun, get, and set features have a strict syntax: +## [=,) +## where stands for white space. +## param may be empty (null value) or is [=] +## Additional white space is allowed between elements. +## The syntax for evt is [=[,]*]) +## Feature names that contain an underscore are defined by Windows, so in these +## cases, using the Windows definition is preferred where available. +## The feature numbers are stable so features will not be renumbered. +## Features may be removed but they will go through a period of deprecation +## before removal which is signalled by moving them into the Deprecated category. +## +## enu has the syntax enu=[]* where all the val +## features in this file starting with a given are considered part of the +## enumeration. +## +## lex has the syntax lex=[]* +## where name is a reasonably capitalised (Python, XML) identifier or UI name, +## lexerVal is the val used to specify the lexer, and the list of prefixes is similar +## to enu. The name may not be the same as that used within the lexer so the lexerVal +## should be used to tie these entities together. + +## Types: +## void +## int +## bool -> integer, 1=true, 0=false +## position -> integer position in a document +## colour -> colour integer containing red, green and blue bytes. +## string -> pointer to const character +## stringresult -> pointer to character, NULL-> return size of result +## cells -> pointer to array of cells, each cell containing a style byte and character byte +## textrange -> range of a min and a max position with an output string +## findtext -> searchrange, text -> foundposition +## keymod -> integer containing key in low half and modifiers in high half +## formatrange +## Types no longer used: +## findtextex -> searchrange +## charrange -> range of a min and a max position +## charrangeresult -> like charrange, but output param +## countedstring +## point -> x,y +## pointresult -> like point, but output param +## rectangle -> left,top,right,bottom +## Client code should ignore definitions containing types it does not understand, except +## for possibly #defining the constants + +## Line numbers and positions start at 0. +## String arguments may contain NUL ('\0') characters where the calls provide a length +## argument and retrieve NUL characters. All retrieved strings except for those retrieved +## by GetLine also have a NUL appended but client code should calculate the size that +## will be returned rather than relying upon the NUL whenever possible. Allow for the +## extra NUL character when allocating buffers. The size to allocate for a stringresult +## can be determined by calling with a NULL (0) pointer. + +cat Basics + +################################################ +## For Scintilla.h +val INVALID_POSITION=-1 +# Define start of Scintilla messages to be greater than all Windows edit (EM_*) messages +# as many EM_ messages can be used although that use is deprecated. +val SCI_START=2000 +val SCI_OPTIONAL_START=3000 +val SCI_LEXER_START=4000 + +# Add text to the document at current position. +fun void AddText=2001(int length, string text) + +# Add array of cells to document. +fun void AddStyledText=2002(int length, cells c) + +# Insert string at a position. +fun void InsertText=2003(position pos, string text) + +# Delete all text in the document. +fun void ClearAll=2004(,) + +# Set all style bytes to 0, remove all folding information. +fun void ClearDocumentStyle=2005(,) + +# Returns the number of bytes in the document. +get int GetLength=2006(,) + +# Returns the character byte at the position. +get int GetCharAt=2007(position pos,) + +# Returns the position of the caret. +get position GetCurrentPos=2008(,) + +# Returns the position of the opposite end of the selection to the caret. +get position GetAnchor=2009(,) + +# Returns the style byte at the position. +get int GetStyleAt=2010(position pos,) + +# Redoes the next action on the undo history. +fun void Redo=2011(,) + +# Choose between collecting actions into the undo +# history and discarding them. +set void SetUndoCollection=2012(bool collectUndo,) + +# Select all the text in the document. +fun void SelectAll=2013(,) + +# Remember the current position in the undo history as the position +# at which the document was saved. +fun void SetSavePoint=2014(,) + +# Retrieve a buffer of cells. +# Returns the number of bytes in the buffer not including terminating NULs. +fun int GetStyledText=2015(, textrange tr) + +# Are there any redoable actions in the undo history? +fun bool CanRedo=2016(,) + +# Retrieve the line number at which a particular marker is located. +fun int MarkerLineFromHandle=2017(int handle,) + +# Delete a marker. +fun void MarkerDeleteHandle=2018(int handle,) + +# Is undo history being collected? +get bool GetUndoCollection=2019(,) + +enu WhiteSpace=SCWS_ +val SCWS_INVISIBLE=0 +val SCWS_VISIBLEALWAYS=1 +val SCWS_VISIBLEAFTERINDENT=2 + +# Are white space characters currently visible? +# Returns one of SCWS_* constants. +get int GetViewWS=2020(,) + +# Make white space characters invisible, always visible or visible outside indentation. +set void SetViewWS=2021(int viewWS,) + +# Find the position from a point within the window. +fun position PositionFromPoint=2022(int x, int y) + +# Find the position from a point within the window but return +# INVALID_POSITION if not close to text. +fun position PositionFromPointClose=2023(int x, int y) + +# Set caret to start of a line and ensure it is visible. +fun void GotoLine=2024(int line,) + +# Set caret to a position and ensure it is visible. +fun void GotoPos=2025(position pos,) + +# Set the selection anchor to a position. The anchor is the opposite +# end of the selection from the caret. +set void SetAnchor=2026(position posAnchor,) + +# Retrieve the text of the line containing the caret. +# Returns the index of the caret on the line. +fun int GetCurLine=2027(int length, stringresult text) + +# Retrieve the position of the last correctly styled character. +get position GetEndStyled=2028(,) + +enu EndOfLine=SC_EOL_ +val SC_EOL_CRLF=0 +val SC_EOL_CR=1 +val SC_EOL_LF=2 + +# Convert all line endings in the document to one mode. +fun void ConvertEOLs=2029(int eolMode,) + +# Retrieve the current end of line mode - one of CRLF, CR, or LF. +get int GetEOLMode=2030(,) + +# Set the current end of line mode. +set void SetEOLMode=2031(int eolMode,) + +# Set the current styling position to pos and the styling mask to mask. +# The styling mask can be used to protect some bits in each styling byte from modification. +fun void StartStyling=2032(position pos, int mask) + +# Change style from current styling position for length characters to a style +# and move the current styling position to after this newly styled segment. +fun void SetStyling=2033(int length, int style) + +# Is drawing done first into a buffer or direct to the screen? +get bool GetBufferedDraw=2034(,) + +# If drawing is buffered then each line of text is drawn into a bitmap buffer +# before drawing it to the screen to avoid flicker. +set void SetBufferedDraw=2035(bool buffered,) + +# Change the visible size of a tab to be a multiple of the width of a space character. +set void SetTabWidth=2036(int tabWidth,) + +# Retrieve the visible size of a tab. +get int GetTabWidth=2121(,) + +# The SC_CP_UTF8 value can be used to enter Unicode mode. +# This is the same value as CP_UTF8 in Windows +val SC_CP_UTF8=65001 + +# The SC_CP_DBCS value can be used to indicate a DBCS mode for GTK+. +val SC_CP_DBCS=1 + +# Set the code page used to interpret the bytes of the document as characters. +# The SC_CP_UTF8 value can be used to enter Unicode mode. +set void SetCodePage=2037(int codePage,) + +# In palette mode, Scintilla uses the environment's palette calls to display +# more colours. This may lead to ugly displays. +set void SetUsePalette=2039(bool usePalette,) + +enu MarkerSymbol=SC_MARK_ +val MARKER_MAX=31 +val SC_MARK_CIRCLE=0 +val SC_MARK_ROUNDRECT=1 +val SC_MARK_ARROW=2 +val SC_MARK_SMALLRECT=3 +val SC_MARK_SHORTARROW=4 +val SC_MARK_EMPTY=5 +val SC_MARK_ARROWDOWN=6 +val SC_MARK_MINUS=7 +val SC_MARK_PLUS=8 + +# Shapes used for outlining column. +val SC_MARK_VLINE=9 +val SC_MARK_LCORNER=10 +val SC_MARK_TCORNER=11 +val SC_MARK_BOXPLUS=12 +val SC_MARK_BOXPLUSCONNECTED=13 +val SC_MARK_BOXMINUS=14 +val SC_MARK_BOXMINUSCONNECTED=15 +val SC_MARK_LCORNERCURVE=16 +val SC_MARK_TCORNERCURVE=17 +val SC_MARK_CIRCLEPLUS=18 +val SC_MARK_CIRCLEPLUSCONNECTED=19 +val SC_MARK_CIRCLEMINUS=20 +val SC_MARK_CIRCLEMINUSCONNECTED=21 + +# Invisible mark that only sets the line background color. +val SC_MARK_BACKGROUND=22 +val SC_MARK_DOTDOTDOT=23 +val SC_MARK_ARROWS=24 +val SC_MARK_PIXMAP=25 +val SC_MARK_FULLRECT=26 +val SC_MARK_LEFTRECT=27 +val SC_MARK_AVAILABLE=28 +val SC_MARK_UNDERLINE=29 + +val SC_MARK_CHARACTER=10000 + +enu MarkerOutline=SC_MARKNUM_ +# Markers used for outlining column. +val SC_MARKNUM_FOLDEREND=25 +val SC_MARKNUM_FOLDEROPENMID=26 +val SC_MARKNUM_FOLDERMIDTAIL=27 +val SC_MARKNUM_FOLDERTAIL=28 +val SC_MARKNUM_FOLDERSUB=29 +val SC_MARKNUM_FOLDER=30 +val SC_MARKNUM_FOLDEROPEN=31 + +val SC_MASK_FOLDERS=0xFE000000 + +# Set the symbol used for a particular marker number. +fun void MarkerDefine=2040(int markerNumber, int markerSymbol) + +# Set the foreground colour used for a particular marker number. +fun void MarkerSetFore=2041(int markerNumber, colour fore) + +# Set the background colour used for a particular marker number. +fun void MarkerSetBack=2042(int markerNumber, colour back) + +# Add a marker to a line, returning an ID which can be used to find or delete the marker. +fun int MarkerAdd=2043(int line, int markerNumber) + +# Delete a marker from a line. +fun void MarkerDelete=2044(int line, int markerNumber) + +# Delete all markers with a particular number from all lines. +fun void MarkerDeleteAll=2045(int markerNumber,) + +# Get a bit mask of all the markers set on a line. +fun int MarkerGet=2046(int line,) + +# Find the next line after lineStart that includes a marker in mask. +fun int MarkerNext=2047(int lineStart, int markerMask) + +# Find the previous line before lineStart that includes a marker in mask. +fun int MarkerPrevious=2048(int lineStart, int markerMask) + +# Define a marker from a pixmap. +fun void MarkerDefinePixmap=2049(int markerNumber, string pixmap) + +# Add a set of markers to a line. +fun void MarkerAddSet=2466(int line, int set) + +# Set the alpha used for a marker that is drawn in the text area, not the margin. +fun void MarkerSetAlpha=2476(int markerNumber, int alpha) + +enu MarginType=SC_MARGIN_ +val SC_MARGIN_SYMBOL=0 +val SC_MARGIN_NUMBER=1 +val SC_MARGIN_BACK=2 +val SC_MARGIN_FORE=3 +val SC_MARGIN_TEXT=4 +val SC_MARGIN_RTEXT=5 + +# Set a margin to be either numeric or symbolic. +set void SetMarginTypeN=2240(int margin, int marginType) + +# Retrieve the type of a margin. +get int GetMarginTypeN=2241(int margin,) + +# Set the width of a margin to a width expressed in pixels. +set void SetMarginWidthN=2242(int margin, int pixelWidth) + +# Retrieve the width of a margin in pixels. +get int GetMarginWidthN=2243(int margin,) + +# Set a mask that determines which markers are displayed in a margin. +set void SetMarginMaskN=2244(int margin, int mask) + +# Retrieve the marker mask of a margin. +get int GetMarginMaskN=2245(int margin,) + +# Make a margin sensitive or insensitive to mouse clicks. +set void SetMarginSensitiveN=2246(int margin, bool sensitive) + +# Retrieve the mouse click sensitivity of a margin. +get bool GetMarginSensitiveN=2247(int margin,) + +# Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles. +# Style 39 is for future use. +enu StylesCommon=STYLE_ +val STYLE_DEFAULT=32 +val STYLE_LINENUMBER=33 +val STYLE_BRACELIGHT=34 +val STYLE_BRACEBAD=35 +val STYLE_CONTROLCHAR=36 +val STYLE_INDENTGUIDE=37 +val STYLE_CALLTIP=38 +val STYLE_LASTPREDEFINED=39 +val STYLE_MAX=255 + +# Character set identifiers are used in StyleSetCharacterSet. +# The values are the same as the Windows *_CHARSET values. +enu CharacterSet=SC_CHARSET_ +val SC_CHARSET_ANSI=0 +val SC_CHARSET_DEFAULT=1 +val SC_CHARSET_BALTIC=186 +val SC_CHARSET_CHINESEBIG5=136 +val SC_CHARSET_EASTEUROPE=238 +val SC_CHARSET_GB2312=134 +val SC_CHARSET_GREEK=161 +val SC_CHARSET_HANGUL=129 +val SC_CHARSET_MAC=77 +val SC_CHARSET_OEM=255 +val SC_CHARSET_RUSSIAN=204 +val SC_CHARSET_CYRILLIC=1251 +val SC_CHARSET_SHIFTJIS=128 +val SC_CHARSET_SYMBOL=2 +val SC_CHARSET_TURKISH=162 +val SC_CHARSET_JOHAB=130 +val SC_CHARSET_HEBREW=177 +val SC_CHARSET_ARABIC=178 +val SC_CHARSET_VIETNAMESE=163 +val SC_CHARSET_THAI=222 +val SC_CHARSET_8859_15=1000 + +# Clear all the styles and make equivalent to the global default style. +set void StyleClearAll=2050(,) + +# Set the foreground colour of a style. +set void StyleSetFore=2051(int style, colour fore) + +# Set the background colour of a style. +set void StyleSetBack=2052(int style, colour back) + +# Set a style to be bold or not. +set void StyleSetBold=2053(int style, bool bold) + +# Set a style to be italic or not. +set void StyleSetItalic=2054(int style, bool italic) + +# Set the size of characters of a style. +set void StyleSetSize=2055(int style, int sizePoints) + +# Set the font of a style. +set void StyleSetFont=2056(int style, string fontName) + +# Set a style to have its end of line filled or not. +set void StyleSetEOLFilled=2057(int style, bool filled) + +# Reset the default style to its state at startup +fun void StyleResetDefault=2058(,) + +# Set a style to be underlined or not. +set void StyleSetUnderline=2059(int style, bool underline) + +enu CaseVisible=SC_CASE_ +val SC_CASE_MIXED=0 +val SC_CASE_UPPER=1 +val SC_CASE_LOWER=2 + +# Get the foreground colour of a style. +get colour StyleGetFore=2481(int style,) + +# Get the background colour of a style. +get colour StyleGetBack=2482(int style,) + +# Get is a style bold or not. +get bool StyleGetBold=2483(int style,) + +# Get is a style italic or not. +get bool StyleGetItalic=2484(int style,) + +# Get the size of characters of a style. +get int StyleGetSize=2485(int style,) + +# Get the font of a style. +# Returns the length of the fontName +fun int StyleGetFont=2486(int style, stringresult fontName) + +# Get is a style to have its end of line filled or not. +get bool StyleGetEOLFilled=2487(int style,) + +# Get is a style underlined or not. +get bool StyleGetUnderline=2488(int style,) + +# Get is a style mixed case, or to force upper or lower case. +get int StyleGetCase=2489(int style,) + +# Get the character get of the font in a style. +get int StyleGetCharacterSet=2490(int style,) + +# Get is a style visible or not. +get bool StyleGetVisible=2491(int style,) + +# Get is a style changeable or not (read only). +# Experimental feature, currently buggy. +get bool StyleGetChangeable=2492(int style,) + +# Get is a style a hotspot or not. +get bool StyleGetHotSpot=2493(int style,) + +# Set a style to be mixed case, or to force upper or lower case. +set void StyleSetCase=2060(int style, int caseForce) + +# Set the character set of the font in a style. +set void StyleSetCharacterSet=2066(int style, int characterSet) + +# Set a style to be a hotspot or not. +set void StyleSetHotSpot=2409(int style, bool hotspot) + +# Set the foreground colour of the main and additional selections and whether to use this setting. +fun void SetSelFore=2067(bool useSetting, colour fore) + +# Set the background colour of the main and additional selections and whether to use this setting. +fun void SetSelBack=2068(bool useSetting, colour back) + +# Get the alpha of the selection. +get int GetSelAlpha=2477(,) + +# Set the alpha of the selection. +set void SetSelAlpha=2478(int alpha,) + +# Is the selection end of line filled? +get bool GetSelEOLFilled=2479(,) + +# Set the selection to have its end of line filled or not. +set void SetSelEOLFilled=2480(bool filled,) + +# Set the foreground colour of the caret. +set void SetCaretFore=2069(colour fore,) + +# When key+modifier combination km is pressed perform msg. +fun void AssignCmdKey=2070(keymod km, int msg) + +# When key+modifier combination km is pressed do nothing. +fun void ClearCmdKey=2071(keymod km,) + +# Drop all key mappings. +fun void ClearAllCmdKeys=2072(,) + +# Set the styles for a segment of the document. +fun void SetStylingEx=2073(int length, string styles) + +# Set a style to be visible or not. +set void StyleSetVisible=2074(int style, bool visible) + +# Get the time in milliseconds that the caret is on and off. +get int GetCaretPeriod=2075(,) + +# Get the time in milliseconds that the caret is on and off. 0 = steady on. +set void SetCaretPeriod=2076(int periodMilliseconds,) + +# Set the set of characters making up words for when moving or selecting by word. +# First sets defaults like SetCharsDefault. +set void SetWordChars=2077(, string characters) + +# Start a sequence of actions that is undone and redone as a unit. +# May be nested. +fun void BeginUndoAction=2078(,) + +# End a sequence of actions that is undone and redone as a unit. +fun void EndUndoAction=2079(,) + +# Indicator style enumeration and some constants +enu IndicatorStyle=INDIC_ +val INDIC_PLAIN=0 +val INDIC_SQUIGGLE=1 +val INDIC_TT=2 +val INDIC_DIAGONAL=3 +val INDIC_STRIKE=4 +val INDIC_HIDDEN=5 +val INDIC_BOX=6 +val INDIC_ROUNDBOX=7 +val INDIC_MAX=31 +val INDIC_CONTAINER=8 +val INDIC0_MASK=0x20 +val INDIC1_MASK=0x40 +val INDIC2_MASK=0x80 +val INDICS_MASK=0xE0 + +# Set an indicator to plain, squiggle or TT. +set void IndicSetStyle=2080(int indic, int style) + +# Retrieve the style of an indicator. +get int IndicGetStyle=2081(int indic,) + +# Set the foreground colour of an indicator. +set void IndicSetFore=2082(int indic, colour fore) + +# Retrieve the foreground colour of an indicator. +get colour IndicGetFore=2083(int indic,) + +# Set an indicator to draw under text or over(default). +set void IndicSetUnder=2510(int indic, bool under) + +# Retrieve whether indicator drawn under or over text. +get bool IndicGetUnder=2511(int indic,) + +# Set the foreground colour of all whitespace and whether to use this setting. +fun void SetWhitespaceFore=2084(bool useSetting, colour fore) + +# Set the background colour of all whitespace and whether to use this setting. +fun void SetWhitespaceBack=2085(bool useSetting, colour back) + +# Divide each styling byte into lexical class bits (default: 5) and indicator +# bits (default: 3). If a lexer requires more than 32 lexical states, then this +# is used to expand the possible states. +set void SetStyleBits=2090(int bits,) + +# Retrieve number of bits in style bytes used to hold the lexical state. +get int GetStyleBits=2091(,) + +# Used to hold extra styling information for each line. +set void SetLineState=2092(int line, int state) + +# Retrieve the extra styling information for a line. +get int GetLineState=2093(int line,) + +# Retrieve the last line number that has line state. +get int GetMaxLineState=2094(,) + +# Is the background of the line containing the caret in a different colour? +get bool GetCaretLineVisible=2095(,) + +# Display the background of the line containing the caret in a different colour. +set void SetCaretLineVisible=2096(bool show,) + +# Get the colour of the background of the line containing the caret. +get colour GetCaretLineBack=2097(,) + +# Set the colour of the background of the line containing the caret. +set void SetCaretLineBack=2098(colour back,) + +# Set a style to be changeable or not (read only). +# Experimental feature, currently buggy. +set void StyleSetChangeable=2099(int style, bool changeable) + +# Display a auto-completion list. +# The lenEntered parameter indicates how many characters before +# the caret should be used to provide context. +fun void AutoCShow=2100(int lenEntered, string itemList) + +# Remove the auto-completion list from the screen. +fun void AutoCCancel=2101(,) + +# Is there an auto-completion list visible? +fun bool AutoCActive=2102(,) + +# Retrieve the position of the caret when the auto-completion list was displayed. +fun position AutoCPosStart=2103(,) + +# User has selected an item so remove the list and insert the selection. +fun void AutoCComplete=2104(,) + +# Define a set of character that when typed cancel the auto-completion list. +fun void AutoCStops=2105(, string characterSet) + +# Change the separator character in the string setting up an auto-completion list. +# Default is space but can be changed if items contain space. +set void AutoCSetSeparator=2106(int separatorCharacter,) + +# Retrieve the auto-completion list separator character. +get int AutoCGetSeparator=2107(,) + +# Select the item in the auto-completion list that starts with a string. +fun void AutoCSelect=2108(, string text) + +# Should the auto-completion list be cancelled if the user backspaces to a +# position before where the box was created. +set void AutoCSetCancelAtStart=2110(bool cancel,) + +# Retrieve whether auto-completion cancelled by backspacing before start. +get bool AutoCGetCancelAtStart=2111(,) + +# Define a set of characters that when typed will cause the autocompletion to +# choose the selected item. +set void AutoCSetFillUps=2112(, string characterSet) + +# Should a single item auto-completion list automatically choose the item. +set void AutoCSetChooseSingle=2113(bool chooseSingle,) + +# Retrieve whether a single item auto-completion list automatically choose the item. +get bool AutoCGetChooseSingle=2114(,) + +# Set whether case is significant when performing auto-completion searches. +set void AutoCSetIgnoreCase=2115(bool ignoreCase,) + +# Retrieve state of ignore case flag. +get bool AutoCGetIgnoreCase=2116(,) + +# Display a list of strings and send notification when user chooses one. +fun void UserListShow=2117(int listType, string itemList) + +# Set whether or not autocompletion is hidden automatically when nothing matches. +set void AutoCSetAutoHide=2118(bool autoHide,) + +# Retrieve whether or not autocompletion is hidden automatically when nothing matches. +get bool AutoCGetAutoHide=2119(,) + +# Set whether or not autocompletion deletes any word characters +# after the inserted text upon completion. +set void AutoCSetDropRestOfWord=2270(bool dropRestOfWord,) + +# Retrieve whether or not autocompletion deletes any word characters +# after the inserted text upon completion. +get bool AutoCGetDropRestOfWord=2271(,) + +# Register an XPM image for use in autocompletion lists. +fun void RegisterImage=2405(int type, string xpmData) + +# Clear all the registered XPM images. +fun void ClearRegisteredImages=2408(,) + +# Retrieve the auto-completion list type-separator character. +get int AutoCGetTypeSeparator=2285(,) + +# Change the type-separator character in the string setting up an auto-completion list. +# Default is '?' but can be changed if items contain '?'. +set void AutoCSetTypeSeparator=2286(int separatorCharacter,) + +# Set the maximum width, in characters, of auto-completion and user lists. +# Set to 0 to autosize to fit longest item, which is the default. +set void AutoCSetMaxWidth=2208(int characterCount,) + +# Get the maximum width, in characters, of auto-completion and user lists. +get int AutoCGetMaxWidth=2209(,) + +# Set the maximum height, in rows, of auto-completion and user lists. +# The default is 5 rows. +set void AutoCSetMaxHeight=2210(int rowCount,) + +# Set the maximum height, in rows, of auto-completion and user lists. +get int AutoCGetMaxHeight=2211(,) + +# Set the number of spaces used for one level of indentation. +set void SetIndent=2122(int indentSize,) + +# Retrieve indentation size. +get int GetIndent=2123(,) + +# Indentation will only use space characters if useTabs is false, otherwise +# it will use a combination of tabs and spaces. +set void SetUseTabs=2124(bool useTabs,) + +# Retrieve whether tabs will be used in indentation. +get bool GetUseTabs=2125(,) + +# Change the indentation of a line to a number of columns. +set void SetLineIndentation=2126(int line, int indentSize) + +# Retrieve the number of columns that a line is indented. +get int GetLineIndentation=2127(int line,) + +# Retrieve the position before the first non indentation character on a line. +get position GetLineIndentPosition=2128(int line,) + +# Retrieve the column number of a position, taking tab width into account. +get int GetColumn=2129(position pos,) + +# Show or hide the horizontal scroll bar. +set void SetHScrollBar=2130(bool show,) + +# Is the horizontal scroll bar visible? +get bool GetHScrollBar=2131(,) + +enu IndentView=SC_IV_ +val SC_IV_NONE=0 +val SC_IV_REAL=1 +val SC_IV_LOOKFORWARD=2 +val SC_IV_LOOKBOTH=3 + +# Show or hide indentation guides. +set void SetIndentationGuides=2132(int indentView,) + +# Are the indentation guides visible? +get int GetIndentationGuides=2133(,) + +# Set the highlighted indentation guide column. +# 0 = no highlighted guide. +set void SetHighlightGuide=2134(int column,) + +# Get the highlighted indentation guide column. +get int GetHighlightGuide=2135(,) + +# Get the position after the last visible characters on a line. +get int GetLineEndPosition=2136(int line,) + +# Get the code page used to interpret the bytes of the document as characters. +get int GetCodePage=2137(,) + +# Get the foreground colour of the caret. +get colour GetCaretFore=2138(,) + +# In palette mode? +get bool GetUsePalette=2139(,) + +# In read-only mode? +get bool GetReadOnly=2140(,) + +# Sets the position of the caret. +set void SetCurrentPos=2141(position pos,) + +# Sets the position that starts the selection - this becomes the anchor. +set void SetSelectionStart=2142(position pos,) + +# Returns the position at the start of the selection. +get position GetSelectionStart=2143(,) + +# Sets the position that ends the selection - this becomes the currentPosition. +set void SetSelectionEnd=2144(position pos,) + +# Returns the position at the end of the selection. +get position GetSelectionEnd=2145(,) + +# Sets the print magnification added to the point size of each style for printing. +set void SetPrintMagnification=2146(int magnification,) + +# Returns the print magnification. +get int GetPrintMagnification=2147(,) + +enu PrintOption=SC_PRINT_ +# PrintColourMode - use same colours as screen. +val SC_PRINT_NORMAL=0 +# PrintColourMode - invert the light value of each style for printing. +val SC_PRINT_INVERTLIGHT=1 +# PrintColourMode - force black text on white background for printing. +val SC_PRINT_BLACKONWHITE=2 +# PrintColourMode - text stays coloured, but all background is forced to be white for printing. +val SC_PRINT_COLOURONWHITE=3 +# PrintColourMode - only the default-background is forced to be white for printing. +val SC_PRINT_COLOURONWHITEDEFAULTBG=4 + +# Modify colours when printing for clearer printed text. +set void SetPrintColourMode=2148(int mode,) + +# Returns the print colour mode. +get int GetPrintColourMode=2149(,) + +enu FindOption=SCFIND_ +val SCFIND_WHOLEWORD=2 +val SCFIND_MATCHCASE=4 +val SCFIND_WORDSTART=0x00100000 +val SCFIND_REGEXP=0x00200000 +val SCFIND_POSIX=0x00400000 + +# Find some text in the document. +fun position FindText=2150(int flags, findtext ft) + +# On Windows, will draw the document into a display context such as a printer. +fun position FormatRange=2151(bool draw, formatrange fr) + +# Retrieve the display line at the top of the display. +get int GetFirstVisibleLine=2152(,) + +# Retrieve the contents of a line. +# Returns the length of the line. +fun int GetLine=2153(int line, stringresult text) + +# Returns the number of lines in the document. There is always at least one. +get int GetLineCount=2154(,) + +# Sets the size in pixels of the left margin. +set void SetMarginLeft=2155(, int pixelWidth) + +# Returns the size in pixels of the left margin. +get int GetMarginLeft=2156(,) + +# Sets the size in pixels of the right margin. +set void SetMarginRight=2157(, int pixelWidth) + +# Returns the size in pixels of the right margin. +get int GetMarginRight=2158(,) + +# Is the document different from when it was last saved? +get bool GetModify=2159(,) + +# Select a range of text. +fun void SetSel=2160(position start, position end) + +# Retrieve the selected text. +# Return the length of the text. +fun int GetSelText=2161(, stringresult text) + +# Retrieve a range of text. +# Return the length of the text. +fun int GetTextRange=2162(, textrange tr) + +# Draw the selection in normal style or with selection highlighted. +fun void HideSelection=2163(bool normal,) + +# Retrieve the x value of the point in the window where a position is displayed. +fun int PointXFromPosition=2164(, position pos) + +# Retrieve the y value of the point in the window where a position is displayed. +fun int PointYFromPosition=2165(, position pos) + +# Retrieve the line containing a position. +fun int LineFromPosition=2166(position pos,) + +# Retrieve the position at the start of a line. +fun position PositionFromLine=2167(int line,) + +# Scroll horizontally and vertically. +fun void LineScroll=2168(int columns, int lines) + +# Ensure the caret is visible. +fun void ScrollCaret=2169(,) + +# Replace the selected text with the argument text. +fun void ReplaceSel=2170(, string text) + +# Set to read only or read write. +set void SetReadOnly=2171(bool readOnly,) + +# Null operation. +fun void Null=2172(,) + +# Will a paste succeed? +fun bool CanPaste=2173(,) + +# Are there any undoable actions in the undo history? +fun bool CanUndo=2174(,) + +# Delete the undo history. +fun void EmptyUndoBuffer=2175(,) + +# Undo one action in the undo history. +fun void Undo=2176(,) + +# Cut the selection to the clipboard. +fun void Cut=2177(,) + +# Copy the selection to the clipboard. +fun void Copy=2178(,) + +# Paste the contents of the clipboard into the document replacing the selection. +fun void Paste=2179(,) + +# Clear the selection. +fun void Clear=2180(,) + +# Replace the contents of the document with the argument text. +fun void SetText=2181(, string text) + +# Retrieve all the text in the document. +# Returns number of characters retrieved. +fun int GetText=2182(int length, stringresult text) + +# Retrieve the number of characters in the document. +get int GetTextLength=2183(,) + +# Retrieve a pointer to a function that processes messages for this Scintilla. +get int GetDirectFunction=2184(,) + +# Retrieve a pointer value to use as the first argument when calling +# the function returned by GetDirectFunction. +get int GetDirectPointer=2185(,) + +# Set to overtype (true) or insert mode. +set void SetOvertype=2186(bool overtype,) + +# Returns true if overtype mode is active otherwise false is returned. +get bool GetOvertype=2187(,) + +# Set the width of the insert mode caret. +set void SetCaretWidth=2188(int pixelWidth,) + +# Returns the width of the insert mode caret. +get int GetCaretWidth=2189(,) + +# Sets the position that starts the target which is used for updating the +# document without affecting the scroll position. +set void SetTargetStart=2190(position pos,) + +# Get the position that starts the target. +get position GetTargetStart=2191(,) + +# Sets the position that ends the target which is used for updating the +# document without affecting the scroll position. +set void SetTargetEnd=2192(position pos,) + +# Get the position that ends the target. +get position GetTargetEnd=2193(,) + +# Replace the target text with the argument text. +# Text is counted so it can contain NULs. +# Returns the length of the replacement text. +fun int ReplaceTarget=2194(int length, string text) + +# Replace the target text with the argument text after \d processing. +# Text is counted so it can contain NULs. +# Looks for \d where d is between 1 and 9 and replaces these with the strings +# matched in the last search operation which were surrounded by \( and \). +# Returns the length of the replacement text including any change +# caused by processing the \d patterns. +fun int ReplaceTargetRE=2195(int length, string text) + +# Search for a counted string in the target and set the target to the found +# range. Text is counted so it can contain NULs. +# Returns length of range or -1 for failure in which case target is not moved. +fun int SearchInTarget=2197(int length, string text) + +# Set the search flags used by SearchInTarget. +set void SetSearchFlags=2198(int flags,) + +# Get the search flags used by SearchInTarget. +get int GetSearchFlags=2199(,) + +# Show a call tip containing a definition near position pos. +fun void CallTipShow=2200(position pos, string definition) + +# Remove the call tip from the screen. +fun void CallTipCancel=2201(,) + +# Is there an active call tip? +fun bool CallTipActive=2202(,) + +# Retrieve the position where the caret was before displaying the call tip. +fun position CallTipPosStart=2203(,) + +# Highlight a segment of the definition. +fun void CallTipSetHlt=2204(int start, int end) + +# Set the background colour for the call tip. +set void CallTipSetBack=2205(colour back,) + +# Set the foreground colour for the call tip. +set void CallTipSetFore=2206(colour fore,) + +# Set the foreground colour for the highlighted part of the call tip. +set void CallTipSetForeHlt=2207(colour fore,) + +# Enable use of STYLE_CALLTIP and set call tip tab size in pixels. +set void CallTipUseStyle=2212(int tabSize,) + +# Find the display line of a document line taking hidden lines into account. +fun int VisibleFromDocLine=2220(int line,) + +# Find the document line of a display line taking hidden lines into account. +fun int DocLineFromVisible=2221(int lineDisplay,) + +# The number of display lines needed to wrap a document line +fun int WrapCount=2235(int line,) + +enu FoldLevel=SC_FOLDLEVEL +val SC_FOLDLEVELBASE=0x400 +val SC_FOLDLEVELWHITEFLAG=0x1000 +val SC_FOLDLEVELHEADERFLAG=0x2000 +val SC_FOLDLEVELNUMBERMASK=0x0FFF + +# Set the fold level of a line. +# This encodes an integer level along with flags indicating whether the +# line is a header and whether it is effectively white space. +set void SetFoldLevel=2222(int line, int level) + +# Retrieve the fold level of a line. +get int GetFoldLevel=2223(int line,) + +# Find the last child line of a header line. +get int GetLastChild=2224(int line, int level) + +# Find the parent line of a child line. +get int GetFoldParent=2225(int line,) + +# Make a range of lines visible. +fun void ShowLines=2226(int lineStart, int lineEnd) + +# Make a range of lines invisible. +fun void HideLines=2227(int lineStart, int lineEnd) + +# Is a line visible? +get bool GetLineVisible=2228(int line,) + +# Show the children of a header line. +set void SetFoldExpanded=2229(int line, bool expanded) + +# Is a header line expanded? +get bool GetFoldExpanded=2230(int line,) + +# Switch a header line between expanded and contracted. +fun void ToggleFold=2231(int line,) + +# Ensure a particular line is visible by expanding any header line hiding it. +fun void EnsureVisible=2232(int line,) + +enu FoldFlag=SC_FOLDFLAG_ +val SC_FOLDFLAG_LINEBEFORE_EXPANDED=0x0002 +val SC_FOLDFLAG_LINEBEFORE_CONTRACTED=0x0004 +val SC_FOLDFLAG_LINEAFTER_EXPANDED=0x0008 +val SC_FOLDFLAG_LINEAFTER_CONTRACTED=0x0010 +val SC_FOLDFLAG_LEVELNUMBERS=0x0040 + +# Set some style options for folding. +fun void SetFoldFlags=2233(int flags,) + +# Ensure a particular line is visible by expanding any header line hiding it. +# Use the currently set visibility policy to determine which range to display. +fun void EnsureVisibleEnforcePolicy=2234(int line,) + +# Sets whether a tab pressed when caret is within indentation indents. +set void SetTabIndents=2260(bool tabIndents,) + +# Does a tab pressed when caret is within indentation indent? +get bool GetTabIndents=2261(,) + +# Sets whether a backspace pressed when caret is within indentation unindents. +set void SetBackSpaceUnIndents=2262(bool bsUnIndents,) + +# Does a backspace pressed when caret is within indentation unindent? +get bool GetBackSpaceUnIndents=2263(,) + +val SC_TIME_FOREVER=10000000 + +# Sets the time the mouse must sit still to generate a mouse dwell event. +set void SetMouseDwellTime=2264(int periodMilliseconds,) + +# Retrieve the time the mouse must sit still to generate a mouse dwell event. +get int GetMouseDwellTime=2265(,) + +# Get position of start of word. +fun int WordStartPosition=2266(position pos, bool onlyWordCharacters) + +# Get position of end of word. +fun int WordEndPosition=2267(position pos, bool onlyWordCharacters) + +enu Wrap=SC_WRAP_ +val SC_WRAP_NONE=0 +val SC_WRAP_WORD=1 +val SC_WRAP_CHAR=2 + +# Sets whether text is word wrapped. +set void SetWrapMode=2268(int mode,) + +# Retrieve whether text is word wrapped. +get int GetWrapMode=2269(,) + +enu WrapVisualFlag=SC_WRAPVISUALFLAG_ +val SC_WRAPVISUALFLAG_NONE=0x0000 +val SC_WRAPVISUALFLAG_END=0x0001 +val SC_WRAPVISUALFLAG_START=0x0002 + +# Set the display mode of visual flags for wrapped lines. +set void SetWrapVisualFlags=2460(int wrapVisualFlags,) + +# Retrive the display mode of visual flags for wrapped lines. +get int GetWrapVisualFlags=2461(,) + +enu WrapVisualLocation=SC_WRAPVISUALFLAGLOC_ +val SC_WRAPVISUALFLAGLOC_DEFAULT=0x0000 +val SC_WRAPVISUALFLAGLOC_END_BY_TEXT=0x0001 +val SC_WRAPVISUALFLAGLOC_START_BY_TEXT=0x0002 + +# Set the location of visual flags for wrapped lines. +set void SetWrapVisualFlagsLocation=2462(int wrapVisualFlagsLocation,) + +# Retrive the location of visual flags for wrapped lines. +get int GetWrapVisualFlagsLocation=2463(,) + +# Set the start indent for wrapped lines. +set void SetWrapStartIndent=2464(int indent,) + +# Retrive the start indent for wrapped lines. +get int GetWrapStartIndent=2465(,) + +enu WrapIndentMode=SC_WRAPINDENT_ +val SC_WRAPINDENT_FIXED=0 +val SC_WRAPINDENT_SAME=1 +val SC_WRAPINDENT_INDENT=2 + +# Sets how wrapped sublines are placed. Default is fixed. +set void SetWrapIndentMode=2472(int mode,) + +# Retrieve how wrapped sublines are placed. Default is fixed. +get int GetWrapIndentMode=2473(,) + +enu LineCache=SC_CACHE_ +val SC_CACHE_NONE=0 +val SC_CACHE_CARET=1 +val SC_CACHE_PAGE=2 +val SC_CACHE_DOCUMENT=3 + +# Sets the degree of caching of layout information. +set void SetLayoutCache=2272(int mode,) + +# Retrieve the degree of caching of layout information. +get int GetLayoutCache=2273(,) + +# Sets the document width assumed for scrolling. +set void SetScrollWidth=2274(int pixelWidth,) + +# Retrieve the document width assumed for scrolling. +get int GetScrollWidth=2275(,) + +# Sets whether the maximum width line displayed is used to set scroll width. +set void SetScrollWidthTracking=2516(bool tracking,) + +# Retrieve whether the scroll width tracks wide lines. +get bool GetScrollWidthTracking=2517(,) + +# Measure the pixel width of some text in a particular style. +# NUL terminated text argument. +# Does not handle tab or control characters. +fun int TextWidth=2276(int style, string text) + +# Sets the scroll range so that maximum scroll position has +# the last line at the bottom of the view (default). +# Setting this to false allows scrolling one page below the last line. +set void SetEndAtLastLine=2277(bool endAtLastLine,) + +# Retrieve whether the maximum scroll position has the last +# line at the bottom of the view. +get bool GetEndAtLastLine=2278(,) + +# Retrieve the height of a particular line of text in pixels. +fun int TextHeight=2279(int line,) + +# Show or hide the vertical scroll bar. +set void SetVScrollBar=2280(bool show,) + +# Is the vertical scroll bar visible? +get bool GetVScrollBar=2281(,) + +# Append a string to the end of the document without changing the selection. +fun void AppendText=2282(int length, string text) + +# Is drawing done in two phases with backgrounds drawn before faoregrounds? +get bool GetTwoPhaseDraw=2283(,) + +# In twoPhaseDraw mode, drawing is performed in two phases, first the background +# and then the foreground. This avoids chopping off characters that overlap the next run. +set void SetTwoPhaseDraw=2284(bool twoPhase,) + +# Make the target range start and end be the same as the selection range start and end. +fun void TargetFromSelection=2287(,) + +# Join the lines in the target. +fun void LinesJoin=2288(,) + +# Split the lines in the target into lines that are less wide than pixelWidth +# where possible. +fun void LinesSplit=2289(int pixelWidth,) + +# Set the colours used as a chequerboard pattern in the fold margin +fun void SetFoldMarginColour=2290(bool useSetting, colour back) +fun void SetFoldMarginHiColour=2291(bool useSetting, colour fore) + +## New messages go here + +## Start of key messages +# Move caret down one line. +fun void LineDown=2300(,) + +# Move caret down one line extending selection to new caret position. +fun void LineDownExtend=2301(,) + +# Move caret up one line. +fun void LineUp=2302(,) + +# Move caret up one line extending selection to new caret position. +fun void LineUpExtend=2303(,) + +# Move caret left one character. +fun void CharLeft=2304(,) + +# Move caret left one character extending selection to new caret position. +fun void CharLeftExtend=2305(,) + +# Move caret right one character. +fun void CharRight=2306(,) + +# Move caret right one character extending selection to new caret position. +fun void CharRightExtend=2307(,) + +# Move caret left one word. +fun void WordLeft=2308(,) + +# Move caret left one word extending selection to new caret position. +fun void WordLeftExtend=2309(,) + +# Move caret right one word. +fun void WordRight=2310(,) + +# Move caret right one word extending selection to new caret position. +fun void WordRightExtend=2311(,) + +# Move caret to first position on line. +fun void Home=2312(,) + +# Move caret to first position on line extending selection to new caret position. +fun void HomeExtend=2313(,) + +# Move caret to last position on line. +fun void LineEnd=2314(,) + +# Move caret to last position on line extending selection to new caret position. +fun void LineEndExtend=2315(,) + +# Move caret to first position in document. +fun void DocumentStart=2316(,) + +# Move caret to first position in document extending selection to new caret position. +fun void DocumentStartExtend=2317(,) + +# Move caret to last position in document. +fun void DocumentEnd=2318(,) + +# Move caret to last position in document extending selection to new caret position. +fun void DocumentEndExtend=2319(,) + +# Move caret one page up. +fun void PageUp=2320(,) + +# Move caret one page up extending selection to new caret position. +fun void PageUpExtend=2321(,) + +# Move caret one page down. +fun void PageDown=2322(,) + +# Move caret one page down extending selection to new caret position. +fun void PageDownExtend=2323(,) + +# Switch from insert to overtype mode or the reverse. +fun void EditToggleOvertype=2324(,) + +# Cancel any modes such as call tip or auto-completion list display. +fun void Cancel=2325(,) + +# Delete the selection or if no selection, the character before the caret. +fun void DeleteBack=2326(,) + +# If selection is empty or all on one line replace the selection with a tab character. +# If more than one line selected, indent the lines. +fun void Tab=2327(,) + +# Dedent the selected lines. +fun void BackTab=2328(,) + +# Insert a new line, may use a CRLF, CR or LF depending on EOL mode. +fun void NewLine=2329(,) + +# Insert a Form Feed character. +fun void FormFeed=2330(,) + +# Move caret to before first visible character on line. +# If already there move to first character on line. +fun void VCHome=2331(,) + +# Like VCHome but extending selection to new caret position. +fun void VCHomeExtend=2332(,) + +# Magnify the displayed text by increasing the sizes by 1 point. +fun void ZoomIn=2333(,) + +# Make the displayed text smaller by decreasing the sizes by 1 point. +fun void ZoomOut=2334(,) + +# Delete the word to the left of the caret. +fun void DelWordLeft=2335(,) + +# Delete the word to the right of the caret. +fun void DelWordRight=2336(,) + +# Delete the word to the right of the caret, but not the trailing non-word characters. +fun void DelWordRightEnd=2518(,) + +# Cut the line containing the caret. +fun void LineCut=2337(,) + +# Delete the line containing the caret. +fun void LineDelete=2338(,) + +# Switch the current line with the previous. +fun void LineTranspose=2339(,) + +# Duplicate the current line. +fun void LineDuplicate=2404(,) + +# Transform the selection to lower case. +fun void LowerCase=2340(,) + +# Transform the selection to upper case. +fun void UpperCase=2341(,) + +# Scroll the document down, keeping the caret visible. +fun void LineScrollDown=2342(,) + +# Scroll the document up, keeping the caret visible. +fun void LineScrollUp=2343(,) + +# Delete the selection or if no selection, the character before the caret. +# Will not delete the character before at the start of a line. +fun void DeleteBackNotLine=2344(,) + +# Move caret to first position on display line. +fun void HomeDisplay=2345(,) + +# Move caret to first position on display line extending selection to +# new caret position. +fun void HomeDisplayExtend=2346(,) + +# Move caret to last position on display line. +fun void LineEndDisplay=2347(,) + +# Move caret to last position on display line extending selection to new +# caret position. +fun void LineEndDisplayExtend=2348(,) + +# These are like their namesakes Home(Extend)?, LineEnd(Extend)?, VCHome(Extend)? +# except they behave differently when word-wrap is enabled: +# They go first to the start / end of the display line, like (Home|LineEnd)Display +# The difference is that, the cursor is already at the point, it goes on to the start +# or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?. + +fun void HomeWrap=2349(,) +fun void HomeWrapExtend=2450(,) +fun void LineEndWrap=2451(,) +fun void LineEndWrapExtend=2452(,) +fun void VCHomeWrap=2453(,) +fun void VCHomeWrapExtend=2454(,) + +# Copy the line containing the caret. +fun void LineCopy=2455(,) + +# Move the caret inside current view if it's not there already. +fun void MoveCaretInsideView=2401(,) + +# How many characters are on a line, including end of line characters? +fun int LineLength=2350(int line,) + +# Highlight the characters at two positions. +fun void BraceHighlight=2351(position pos1, position pos2) + +# Highlight the character at a position indicating there is no matching brace. +fun void BraceBadLight=2352(position pos,) + +# Find the position of a matching brace or INVALID_POSITION if no match. +fun position BraceMatch=2353(position pos,) + +# Are the end of line characters visible? +get bool GetViewEOL=2355(,) + +# Make the end of line characters visible or invisible. +set void SetViewEOL=2356(bool visible,) + +# Retrieve a pointer to the document object. +get int GetDocPointer=2357(,) + +# Change the document object used. +set void SetDocPointer=2358(, int pointer) + +# Set which document modification events are sent to the container. +set void SetModEventMask=2359(int mask,) + +enu EdgeVisualStyle=EDGE_ +val EDGE_NONE=0 +val EDGE_LINE=1 +val EDGE_BACKGROUND=2 + +# Retrieve the column number which text should be kept within. +get int GetEdgeColumn=2360(,) + +# Set the column number of the edge. +# If text goes past the edge then it is highlighted. +set void SetEdgeColumn=2361(int column,) + +# Retrieve the edge highlight mode. +get int GetEdgeMode=2362(,) + +# The edge may be displayed by a line (EDGE_LINE) or by highlighting text that +# goes beyond it (EDGE_BACKGROUND) or not displayed at all (EDGE_NONE). +set void SetEdgeMode=2363(int mode,) + +# Retrieve the colour used in edge indication. +get colour GetEdgeColour=2364(,) + +# Change the colour used in edge indication. +set void SetEdgeColour=2365(colour edgeColour,) + +# Sets the current caret position to be the search anchor. +fun void SearchAnchor=2366(,) + +# Find some text starting at the search anchor. +# Does not ensure the selection is visible. +fun int SearchNext=2367(int flags, string text) + +# Find some text starting at the search anchor and moving backwards. +# Does not ensure the selection is visible. +fun int SearchPrev=2368(int flags, string text) + +# Retrieves the number of lines completely visible. +get int LinesOnScreen=2370(,) + +# Set whether a pop up menu is displayed automatically when the user presses +# the wrong mouse button. +fun void UsePopUp=2371(bool allowPopUp,) + +# Is the selection rectangular? The alternative is the more common stream selection. +get bool SelectionIsRectangle=2372(,) + +# Set the zoom level. This number of points is added to the size of all fonts. +# It may be positive to magnify or negative to reduce. +set void SetZoom=2373(int zoom,) +# Retrieve the zoom level. +get int GetZoom=2374(,) + +# Create a new document object. +# Starts with reference count of 1 and not selected into editor. +fun int CreateDocument=2375(,) +# Extend life of document. +fun void AddRefDocument=2376(, int doc) +# Release a reference to the document, deleting document if it fades to black. +fun void ReleaseDocument=2377(, int doc) + +# Get which document modification events are sent to the container. +get int GetModEventMask=2378(,) + +# Change internal focus flag. +set void SetFocus=2380(bool focus,) +# Get internal focus flag. +get bool GetFocus=2381(,) + +enu Status=SC_STATUS_ +val SC_STATUS_OK=0 +val SC_STATUS_FAILURE=1 +val SC_STATUS_BADALLOC=2 + +# Change error status - 0 = OK. +set void SetStatus=2382(int statusCode,) +# Get error status. +get int GetStatus=2383(,) + +# Set whether the mouse is captured when its button is pressed. +set void SetMouseDownCaptures=2384(bool captures,) +# Get whether mouse gets captured. +get bool GetMouseDownCaptures=2385(,) + +enu CursorShape=SC_CURSOR +val SC_CURSORNORMAL=-1 +val SC_CURSORWAIT=4 +# Sets the cursor to one of the SC_CURSOR* values. +set void SetCursor=2386(int cursorType,) +# Get cursor type. +get int GetCursor=2387(,) + +# Change the way control characters are displayed: +# If symbol is < 32, keep the drawn way, else, use the given character. +set void SetControlCharSymbol=2388(int symbol,) +# Get the way control characters are displayed. +get int GetControlCharSymbol=2389(,) + +# Move to the previous change in capitalisation. +fun void WordPartLeft=2390(,) +# Move to the previous change in capitalisation extending selection +# to new caret position. +fun void WordPartLeftExtend=2391(,) +# Move to the change next in capitalisation. +fun void WordPartRight=2392(,) +# Move to the next change in capitalisation extending selection +# to new caret position. +fun void WordPartRightExtend=2393(,) + +# Constants for use with SetVisiblePolicy, similar to SetCaretPolicy. +val VISIBLE_SLOP=0x01 +val VISIBLE_STRICT=0x04 +# Set the way the display area is determined when a particular line +# is to be moved to by Find, FindNext, GotoLine, etc. +fun void SetVisiblePolicy=2394(int visiblePolicy, int visibleSlop) + +# Delete back from the current position to the start of the line. +fun void DelLineLeft=2395(,) + +# Delete forwards from the current position to the end of the line. +fun void DelLineRight=2396(,) + +# Get and Set the xOffset (ie, horizonal scroll position). +set void SetXOffset=2397(int newOffset,) +get int GetXOffset=2398(,) + +# Set the last x chosen value to be the caret x position. +fun void ChooseCaretX=2399(,) + +# Set the focus to this Scintilla widget. +fun void GrabFocus=2400(,) + +enu CaretPolicy=CARET_ +# Caret policy, used by SetXCaretPolicy and SetYCaretPolicy. +# If CARET_SLOP is set, we can define a slop value: caretSlop. +# This value defines an unwanted zone (UZ) where the caret is... unwanted. +# This zone is defined as a number of pixels near the vertical margins, +# and as a number of lines near the horizontal margins. +# By keeping the caret away from the edges, it is seen within its context, +# so it is likely that the identifier that the caret is on can be completely seen, +# and that the current line is seen with some of the lines following it which are +# often dependent on that line. +val CARET_SLOP=0x01 +# If CARET_STRICT is set, the policy is enforced... strictly. +# The caret is centred on the display if slop is not set, +# and cannot go in the UZ if slop is set. +val CARET_STRICT=0x04 +# If CARET_JUMPS is set, the display is moved more energetically +# so the caret can move in the same direction longer before the policy is applied again. +val CARET_JUMPS=0x10 +# If CARET_EVEN is not set, instead of having symmetrical UZs, +# the left and bottom UZs are extended up to right and top UZs respectively. +# This way, we favour the displaying of useful information: the begining of lines, +# where most code reside, and the lines after the caret, eg. the body of a function. +val CARET_EVEN=0x08 + +# Set the way the caret is kept visible when going sideway. +# The exclusion zone is given in pixels. +fun void SetXCaretPolicy=2402(int caretPolicy, int caretSlop) + +# Set the way the line the caret is on is kept visible. +# The exclusion zone is given in lines. +fun void SetYCaretPolicy=2403(int caretPolicy, int caretSlop) + +# Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE). +set void SetPrintWrapMode=2406(int mode,) + +# Is printing line wrapped? +get int GetPrintWrapMode=2407(,) + +# Set a fore colour for active hotspots. +set void SetHotspotActiveFore=2410(bool useSetting, colour fore) + +# Get the fore colour for active hotspots. +get colour GetHotspotActiveFore=2494(,) + +# Set a back colour for active hotspots. +set void SetHotspotActiveBack=2411(bool useSetting, colour back) + +# Get the back colour for active hotspots. +get colour GetHotspotActiveBack=2495(,) + +# Enable / Disable underlining active hotspots. +set void SetHotspotActiveUnderline=2412(bool underline,) + +# Get whether underlining for active hotspots. +get bool GetHotspotActiveUnderline=2496(,) + +# Limit hotspots to single line so hotspots on two lines don't merge. +set void SetHotspotSingleLine=2421(bool singleLine,) + +# Get the HotspotSingleLine property +get bool GetHotspotSingleLine=2497(,) + +# Move caret between paragraphs (delimited by empty lines). +fun void ParaDown=2413(,) +fun void ParaDownExtend=2414(,) +fun void ParaUp=2415(,) +fun void ParaUpExtend=2416(,) + +# Given a valid document position, return the previous position taking code +# page into account. Returns 0 if passed 0. +fun position PositionBefore=2417(position pos,) + +# Given a valid document position, return the next position taking code +# page into account. Maximum value returned is the last position in the document. +fun position PositionAfter=2418(position pos,) + +# Copy a range of text to the clipboard. Positions are clipped into the document. +fun void CopyRange=2419(position start, position end) + +# Copy argument text to the clipboard. +fun void CopyText=2420(int length, string text) + +enu SelectionMode=SC_SEL_ +val SC_SEL_STREAM=0 +val SC_SEL_RECTANGLE=1 +val SC_SEL_LINES=2 +val SC_SEL_THIN=3 + +# Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or +# by lines (SC_SEL_LINES). +set void SetSelectionMode=2422(int mode,) + +# Get the mode of the current selection. +get int GetSelectionMode=2423(,) + +# Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line). +fun position GetLineSelStartPosition=2424(int line,) + +# Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line). +fun position GetLineSelEndPosition=2425(int line,) + +## RectExtended rectangular selection moves +# Move caret down one line, extending rectangular selection to new caret position. +fun void LineDownRectExtend=2426(,) + +# Move caret up one line, extending rectangular selection to new caret position. +fun void LineUpRectExtend=2427(,) + +# Move caret left one character, extending rectangular selection to new caret position. +fun void CharLeftRectExtend=2428(,) + +# Move caret right one character, extending rectangular selection to new caret position. +fun void CharRightRectExtend=2429(,) + +# Move caret to first position on line, extending rectangular selection to new caret position. +fun void HomeRectExtend=2430(,) + +# Move caret to before first visible character on line. +# If already there move to first character on line. +# In either case, extend rectangular selection to new caret position. +fun void VCHomeRectExtend=2431(,) + +# Move caret to last position on line, extending rectangular selection to new caret position. +fun void LineEndRectExtend=2432(,) + +# Move caret one page up, extending rectangular selection to new caret position. +fun void PageUpRectExtend=2433(,) + +# Move caret one page down, extending rectangular selection to new caret position. +fun void PageDownRectExtend=2434(,) + + +# Move caret to top of page, or one page up if already at top of page. +fun void StutteredPageUp=2435(,) + +# Move caret to top of page, or one page up if already at top of page, extending selection to new caret position. +fun void StutteredPageUpExtend=2436(,) + +# Move caret to bottom of page, or one page down if already at bottom of page. +fun void StutteredPageDown=2437(,) + +# Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position. +fun void StutteredPageDownExtend=2438(,) + + +# Move caret left one word, position cursor at end of word. +fun void WordLeftEnd=2439(,) + +# Move caret left one word, position cursor at end of word, extending selection to new caret position. +fun void WordLeftEndExtend=2440(,) + +# Move caret right one word, position cursor at end of word. +fun void WordRightEnd=2441(,) + +# Move caret right one word, position cursor at end of word, extending selection to new caret position. +fun void WordRightEndExtend=2442(,) + +# Set the set of characters making up whitespace for when moving or selecting by word. +# Should be called after SetWordChars. +set void SetWhitespaceChars=2443(, string characters) + +# Reset the set of characters for whitespace and word characters to the defaults. +fun void SetCharsDefault=2444(,) + +# Get currently selected item position in the auto-completion list +fun int AutoCGetCurrent=2445(,) + +# Enlarge the document to a particular size of text bytes. +fun void Allocate=2446(int bytes,) + +# Returns the target converted to UTF8. +# Return the length in bytes. +fun int TargetAsUTF8=2447(, stringresult s) + +# Set the length of the utf8 argument for calling EncodedFromUTF8. +# Set to -1 and the string will be measured to the first nul. +fun void SetLengthForEncode=2448(int bytes,) + +# Translates a UTF8 string into the document encoding. +# Return the length of the result in bytes. +# On error return 0. +fun int EncodedFromUTF8=2449(string utf8, stringresult encoded) + +# Find the position of a column on a line taking into account tabs and +# multi-byte characters. If beyond end of line, return line end position. +fun int FindColumn=2456(int line, int column) + +# Can the caret preferred x position only be changed by explicit movement commands? +get bool GetCaretSticky=2457(,) + +# Stop the caret preferred x position changing when the user types. +set void SetCaretSticky=2458(bool useCaretStickyBehaviour,) + +# Switch between sticky and non-sticky: meant to be bound to a key. +fun void ToggleCaretSticky=2459(,) + +# Enable/Disable convert-on-paste for line endings +set void SetPasteConvertEndings=2467(bool convert,) + +# Get convert-on-paste setting +get bool GetPasteConvertEndings=2468(,) + +# Duplicate the selection. If selection empty duplicate the line containing the caret. +fun void SelectionDuplicate=2469(,) + +val SC_ALPHA_TRANSPARENT=0 +val SC_ALPHA_OPAQUE=255 +val SC_ALPHA_NOALPHA=256 + +# Set background alpha of the caret line. +set void SetCaretLineBackAlpha=2470(int alpha,) + +# Get the background alpha of the caret line. +get int GetCaretLineBackAlpha=2471(,) + +enu CaretStyle=CARETSTYLE_ +val CARETSTYLE_INVISIBLE=0 +val CARETSTYLE_LINE=1 +val CARETSTYLE_BLOCK=2 + +# Set the style of the caret to be drawn. +set void SetCaretStyle=2512(int caretStyle,) + +# Returns the current style of the caret. +get int GetCaretStyle=2513(,) + +# Set the indicator used for IndicatorFillRange and IndicatorClearRange +set void SetIndicatorCurrent=2500(int indicator,) + +# Get the current indicator +get int GetIndicatorCurrent=2501(,) + +# Set the value used for IndicatorFillRange +set void SetIndicatorValue=2502(int value,) + +# Get the current indicator vaue +get int GetIndicatorValue=2503(,) + +# Turn a indicator on over a range. +fun void IndicatorFillRange=2504(int position, int fillLength) + +# Turn a indicator off over a range. +fun void IndicatorClearRange=2505(int position, int clearLength) + +# Are any indicators present at position? +fun int IndicatorAllOnFor=2506(int position,) + +# What value does a particular indicator have at at a position? +fun int IndicatorValueAt=2507(int indicator, int position) + +# Where does a particular indicator start? +fun int IndicatorStart=2508(int indicator, int position) + +# Where does a particular indicator end? +fun int IndicatorEnd=2509(int indicator, int position) + +# Set number of entries in position cache +set void SetPositionCache=2514(int size,) + +# How many entries are allocated to the position cache? +get int GetPositionCache=2515(,) + +# Copy the selection, if selection empty copy the line with the caret +fun void CopyAllowLine=2519(,) + +# Compact the document buffer and return a read-only pointer to the +# characters in the document. +get int GetCharacterPointer=2520(,) + +# Always interpret keyboard input as Unicode +set void SetKeysUnicode=2521(bool keysUnicode,) + +# Are keys always interpreted as Unicode? +get bool GetKeysUnicode=2522(,) + +# Set the alpha fill colour of the given indicator. +set void IndicSetAlpha=2523(int indicator, int alpha) + +# Get the alpha fill colour of the given indicator. +get int IndicGetAlpha=2524(int indicator,) + +# Set extra ascent for each line +set void SetExtraAscent=2525(int extraAscent,) + +# Get extra ascent for each line +get int GetExtraAscent=2526(,) + +# Set extra descent for each line +set void SetExtraDescent=2527(int extraDescent,) + +# Get extra descent for each line +get int GetExtraDescent=2528(,) + +# Which symbol was defined for markerNumber with MarkerDefine +fun int MarkerSymbolDefined=2529(int markerNumber,) + +# Set the text in the text margin for a line +set void MarginSetText=2530(int line, string text) + +# Get the text in the text margin for a line +get int MarginGetText=2531(int line, stringresult text) + +# Set the style number for the text margin for a line +set void MarginSetStyle=2532(int line, int style) + +# Get the style number for the text margin for a line +get int MarginGetStyle=2533(int line,) + +# Set the style in the text margin for a line +set void MarginSetStyles=2534(int line, string styles) + +# Get the styles in the text margin for a line +get int MarginGetStyles=2535(int line, stringresult styles) + +# Clear the margin text on all lines +fun void MarginTextClearAll=2536(,) + +# Get the start of the range of style numbers used for margin text +set void MarginSetStyleOffset=2537(int style,) + +# Get the start of the range of style numbers used for margin text +get int MarginGetStyleOffset=2538(,) + +# Set the annotation text for a line +set void AnnotationSetText=2540(int line, string text) + +# Get the annotation text for a line +get int AnnotationGetText=2541(int line, stringresult text) + +# Set the style number for the annotations for a line +set void AnnotationSetStyle=2542(int line, int style) + +# Get the style number for the annotations for a line +get int AnnotationGetStyle=2543(int line,) + +# Set the annotation styles for a line +set void AnnotationSetStyles=2544(int line, string styles) + +# Get the annotation styles for a line +get int AnnotationGetStyles=2545(int line, stringresult styles) + +# Get the number of annotation lines for a line +get int AnnotationGetLines=2546(int line,) + +# Clear the annotations from all lines +fun void AnnotationClearAll=2547(,) + +enu AnnotationVisible=ANNOTATION_ +val ANNOTATION_HIDDEN=0 +val ANNOTATION_STANDARD=1 +val ANNOTATION_BOXED=2 + +# Set the visibility for the annotations for a view +set void AnnotationSetVisible=2548(int visible,) + +# Get the visibility for the annotations for a view +get int AnnotationGetVisible=2549(,) + +# Get the start of the range of style numbers used for annotations +set void AnnotationSetStyleOffset=2550(int style,) + +# Get the start of the range of style numbers used for annotations +get int AnnotationGetStyleOffset=2551(,) + +val UNDO_MAY_COALESCE=1 + +# Add a container action to the undo stack +fun void AddUndoAction=2560(int token, int flags) + +# Find the position of a character from a point within the window. +fun position CharPositionFromPoint=2561(int x, int y) + +# Find the position of a character from a point within the window. +# Return INVALID_POSITION if not close to text. +fun position CharPositionFromPointClose=2562(int x, int y) + +# Set whether multiple selections can be made +set void SetMultipleSelection=2563(bool multipleSelection,) + +# Whether multiple selections can be made +get bool GetMultipleSelection=2564(,) + +# Set whether typing can be performed into multiple selections +set void SetAdditionalSelectionTyping=2565(bool additionalSelectionTyping,) + +# Whether typing can be performed into multiple selections +get bool GetAdditionalSelectionTyping=2566(,) + +# Set whether additional carets will blink +set void SetAdditionalCaretsBlink=2567(bool additionalCaretsBlink,) + +# Whether additional carets will blink +get bool GetAdditionalCaretsBlink=2568(,) + +# How many selections are there? +get int GetSelections=2570(,) + +# Clear selections to a single empty stream selection +fun void ClearSelections=2571(,) + +# Set a simple selection +fun int SetSelection=2572(int caret,int anchor) + +# Add a selection +fun int AddSelection=2573(int caret,int anchor) + +# Set the main selection +set void SetMainSelection=2574(int selection,) + +# Which selection is the main selection +get int GetMainSelection=2575(,) + +set void SetSelectionNCaret=2576(int selection, position pos) +get position GetSelectionNCaret=2577(int selection,) +set void SetSelectionNAnchor=2578(int selection, position posAnchor) +get position GetSelectionNAnchor=2579(int selection,) +set void SetSelectionNCaretVirtualSpace=2580(int selection, int space) +get int GetSelectionNCaretVirtualSpace=2581(int selection,) +set void SetSelectionNAnchorVirtualSpace=2582(int selection, int space) +get int GetSelectionNAnchorVirtualSpace=2583(int selection,) + +# Sets the position that starts the selection - this becomes the anchor. +set void SetSelectionNStart=2584(int selection, position pos) + +# Returns the position at the start of the selection. +get position GetSelectionNStart=2585(,) + +# Sets the position that ends the selection - this becomes the currentPosition. +set void SetSelectionNEnd=2586(int selection, position pos,) + +# Returns the position at the end of the selection. +get position GetSelectionNEnd=2587(,) + +set void SetRectangularSelectionCaret=2588(position pos,) +get position GetRectangularSelectionCaret=2589(,) +set void SetRectangularSelectionAnchor=2590(position posAnchor,) +get position GetRectangularSelectionAnchor=2591(,) +set void SetRectangularSelectionCaretVirtualSpace=2592(int space,) +get int GetRectangularSelectionCaretVirtualSpace=2593(,) +set void SetRectangularSelectionAnchorVirtualSpace=2594(int space,) +get int GetRectangularSelectionAnchorVirtualSpace=2595(,) + +enu VirtualSpace=SCVS_ +val SCVS_NONE=0 +val SCVS_RECTANGULARSELECTION=1 +val SCVS_USERACCESSIBLE=2 + +set void SetVirtualSpaceOptions=2596(int virtualSpaceOptions,) +get int GetVirtualSpaceOptions=2597(,) + +# On GTK+, allow selecting the modifier key to use for mouse-based +# rectangular selection. Often the window manager requires Alt+Mouse Drag +# for moving windows. +# Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER. + +set void SetRectangularSelectionModifier=2598(int modifier,) + +# Get the modifier key used for rectangular selection. +get int GetRectangularSelectionModifier=2599(,) + +# Set the foreground colour of additional selections. +# Must have previously called SetSelFore with non-zero first argument for this to have an effect. +set void SetAdditionalSelFore=2600(colour fore,) + +# Set the background colour of additional selections. +# Must have previously called SetSelBack with non-zero first argument for this to have an effect. +set void SetAdditionalSelBack=2601(colour back,) + +# Set the alpha of the selection. +set void SetAdditionalSelAlpha=2602(int alpha,) + +# Get the alpha of the selection. +get int GetAdditionalSelAlpha=2603(,) + +# Set the foreground colour of additional carets. +set void SetAdditionalCaretFore=2604(colour fore,) + +# Get the foreground colour of additional carets. +get colour GetAdditionalCaretFore=2605(,) + +# Set the main selection to the next selection. +fun void RotateSelection=2606(,) + +# Swap that caret and anchor of the main selection. +fun void SwapMainAnchorCaret=2607(,) + +# Start notifying the container of all key presses and commands. +fun void StartRecord=3001(,) + +# Stop notifying the container of all key presses and commands. +fun void StopRecord=3002(,) + +# Set the lexing language of the document. +set void SetLexer=4001(int lexer,) + +# Retrieve the lexing language of the document. +get int GetLexer=4002(,) + +# Colourise a segment of the document using the current lexing language. +fun void Colourise=4003(position start, position end) + +# Set up a value that may be used by a lexer for some optional feature. +set void SetProperty=4004(string key, string value) + +# Maximum value of keywordSet parameter of SetKeyWords. +val KEYWORDSET_MAX=8 + +# Set up the key words used by the lexer. +set void SetKeyWords=4005(int keywordSet, string keyWords) + +# Set the lexing language of the document based on string name. +set void SetLexerLanguage=4006(, string language) + +# Load a lexer library (dll / so). +fun void LoadLexerLibrary=4007(, string path) + +# Retrieve a "property" value previously set with SetProperty. +fun int GetProperty=4008(string key, stringresult buf) + +# Retrieve a "property" value previously set with SetProperty, +# with "$()" variable replacement on returned buffer. +fun int GetPropertyExpanded=4009(string key, stringresult buf) + +# Retrieve a "property" value previously set with SetProperty, +# interpreted as an int AFTER any "$()" variable replacement. +get int GetPropertyInt=4010(string key,) + +# Retrieve the number of bits the current lexer needs for styling. +get int GetStyleBitsNeeded=4011(,) + +# Notifications +# Type of modification and the action which caused the modification. +# These are defined as a bit mask to make it easy to specify which notifications are wanted. +# One bit is set from each of SC_MOD_* and SC_PERFORMED_*. +enu ModificationFlags=SC_MOD_ SC_PERFORMED_ SC_LAST +val SC_MOD_INSERTTEXT=0x1 +val SC_MOD_DELETETEXT=0x2 +val SC_MOD_CHANGESTYLE=0x4 +val SC_MOD_CHANGEFOLD=0x8 +val SC_PERFORMED_USER=0x10 +val SC_PERFORMED_UNDO=0x20 +val SC_PERFORMED_REDO=0x40 +val SC_MULTISTEPUNDOREDO=0x80 +val SC_LASTSTEPINUNDOREDO=0x100 +val SC_MOD_CHANGEMARKER=0x200 +val SC_MOD_BEFOREINSERT=0x400 +val SC_MOD_BEFOREDELETE=0x800 +val SC_MULTILINEUNDOREDO=0x1000 +val SC_STARTACTION=0x2000 +val SC_MOD_CHANGEINDICATOR=0x4000 +val SC_MOD_CHANGELINESTATE=0x8000 +val SC_MOD_CHANGEMARGIN=0x10000 +val SC_MOD_CHANGEANNOTATION=0x20000 +val SC_MOD_CONTAINER=0x40000 +val SC_MODEVENTMASKALL=0x7FFFF + +# For compatibility, these go through the COMMAND notification rather than NOTIFY +# and should have had exactly the same values as the EN_* constants. +# Unfortunately the SETFOCUS and KILLFOCUS are flipped over from EN_* +# As clients depend on these constants, this will not be changed. +val SCEN_CHANGE=768 +val SCEN_SETFOCUS=512 +val SCEN_KILLFOCUS=256 + +# Symbolic key codes and modifier flags. +# ASCII and other printable characters below 256. +# Extended keys above 300. + +enu Keys=SCK_ +val SCK_DOWN=300 +val SCK_UP=301 +val SCK_LEFT=302 +val SCK_RIGHT=303 +val SCK_HOME=304 +val SCK_END=305 +val SCK_PRIOR=306 +val SCK_NEXT=307 +val SCK_DELETE=308 +val SCK_INSERT=309 +val SCK_ESCAPE=7 +val SCK_BACK=8 +val SCK_TAB=9 +val SCK_RETURN=13 +val SCK_ADD=310 +val SCK_SUBTRACT=311 +val SCK_DIVIDE=312 +val SCK_WIN=313 +val SCK_RWIN=314 +val SCK_MENU=315 + +enu KeyMod=SCMOD_ +val SCMOD_NORM=0 +val SCMOD_SHIFT=1 +val SCMOD_CTRL=2 +val SCMOD_ALT=4 +val SCMOD_SUPER=8 + +################################################ +# For SciLexer.h +enu Lexer=SCLEX_ +val SCLEX_CONTAINER=0 +val SCLEX_NULL=1 +val SCLEX_PYTHON=2 +val SCLEX_CPP=3 +val SCLEX_HTML=4 +val SCLEX_XML=5 +val SCLEX_PERL=6 +val SCLEX_SQL=7 +val SCLEX_VB=8 +val SCLEX_PROPERTIES=9 +val SCLEX_ERRORLIST=10 +val SCLEX_MAKEFILE=11 +val SCLEX_BATCH=12 +val SCLEX_XCODE=13 +val SCLEX_LATEX=14 +val SCLEX_LUA=15 +val SCLEX_DIFF=16 +val SCLEX_CONF=17 +val SCLEX_PASCAL=18 +val SCLEX_AVE=19 +val SCLEX_ADA=20 +val SCLEX_LISP=21 +val SCLEX_RUBY=22 +val SCLEX_EIFFEL=23 +val SCLEX_EIFFELKW=24 +val SCLEX_TCL=25 +val SCLEX_NNCRONTAB=26 +val SCLEX_BULLANT=27 +val SCLEX_VBSCRIPT=28 +val SCLEX_BAAN=31 +val SCLEX_MATLAB=32 +val SCLEX_SCRIPTOL=33 +val SCLEX_ASM=34 +val SCLEX_CPPNOCASE=35 +val SCLEX_FORTRAN=36 +val SCLEX_F77=37 +val SCLEX_CSS=38 +val SCLEX_POV=39 +val SCLEX_LOUT=40 +val SCLEX_ESCRIPT=41 +val SCLEX_PS=42 +val SCLEX_NSIS=43 +val SCLEX_MMIXAL=44 +val SCLEX_CLW=45 +val SCLEX_CLWNOCASE=46 +val SCLEX_LOT=47 +val SCLEX_YAML=48 +val SCLEX_TEX=49 +val SCLEX_METAPOST=50 +val SCLEX_POWERBASIC=51 +val SCLEX_FORTH=52 +val SCLEX_ERLANG=53 +val SCLEX_OCTAVE=54 +val SCLEX_MSSQL=55 +val SCLEX_VERILOG=56 +val SCLEX_KIX=57 +val SCLEX_GUI4CLI=58 +val SCLEX_SPECMAN=59 +val SCLEX_AU3=60 +val SCLEX_APDL=61 +val SCLEX_BASH=62 +val SCLEX_ASN1=63 +val SCLEX_VHDL=64 +val SCLEX_CAML=65 +val SCLEX_BLITZBASIC=66 +val SCLEX_PUREBASIC=67 +val SCLEX_HASKELL=68 +val SCLEX_PHPSCRIPT=69 +val SCLEX_TADS3=70 +val SCLEX_REBOL=71 +val SCLEX_SMALLTALK=72 +val SCLEX_FLAGSHIP=73 +val SCLEX_CSOUND=74 +val SCLEX_FREEBASIC=75 +val SCLEX_INNOSETUP=76 +val SCLEX_OPAL=77 +val SCLEX_SPICE=78 +val SCLEX_D=79 +val SCLEX_CMAKE=80 +val SCLEX_GAP=81 +val SCLEX_PLM=82 +val SCLEX_PROGRESS=83 +val SCLEX_ABAQUS=84 +val SCLEX_ASYMPTOTE=85 +val SCLEX_R=86 +val SCLEX_MAGIK=87 +val SCLEX_POWERSHELL=88 +val SCLEX_MYSQL=89 +val SCLEX_PO=90 +val SCLEX_TAL=91 +val SCLEX_COBOL=92 +val SCLEX_TACL=93 +val SCLEX_SORCUS=94 +val SCLEX_POWERPRO=95 +val SCLEX_NIMROD=96 +val SCLEX_SML=97 + +# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a +# value assigned in sequence from SCLEX_AUTOMATIC+1. +val SCLEX_AUTOMATIC=1000 +# Lexical states for SCLEX_PYTHON +lex Python=SCLEX_PYTHON SCE_P_ +lex Nimrod=SCLEX_NIMROD SCE_P_ +val SCE_P_DEFAULT=0 +val SCE_P_COMMENTLINE=1 +val SCE_P_NUMBER=2 +val SCE_P_STRING=3 +val SCE_P_CHARACTER=4 +val SCE_P_WORD=5 +val SCE_P_TRIPLE=6 +val SCE_P_TRIPLEDOUBLE=7 +val SCE_P_CLASSNAME=8 +val SCE_P_DEFNAME=9 +val SCE_P_OPERATOR=10 +val SCE_P_IDENTIFIER=11 +val SCE_P_COMMENTBLOCK=12 +val SCE_P_STRINGEOL=13 +val SCE_P_WORD2=14 +val SCE_P_DECORATOR=15 +# Lexical states for SCLEX_CPP +lex Cpp=SCLEX_CPP SCE_C_ +lex BullAnt=SCLEX_BULLANT SCE_C_ +val SCE_C_DEFAULT=0 +val SCE_C_COMMENT=1 +val SCE_C_COMMENTLINE=2 +val SCE_C_COMMENTDOC=3 +val SCE_C_NUMBER=4 +val SCE_C_WORD=5 +val SCE_C_STRING=6 +val SCE_C_CHARACTER=7 +val SCE_C_UUID=8 +val SCE_C_PREPROCESSOR=9 +val SCE_C_OPERATOR=10 +val SCE_C_IDENTIFIER=11 +val SCE_C_STRINGEOL=12 +val SCE_C_VERBATIM=13 +val SCE_C_REGEX=14 +val SCE_C_COMMENTLINEDOC=15 +val SCE_C_WORD2=16 +val SCE_C_COMMENTDOCKEYWORD=17 +val SCE_C_COMMENTDOCKEYWORDERROR=18 +val SCE_C_GLOBALCLASS=19 +# Lexical states for SCLEX_D +lex D=SCLEX_D SCE_D_ +val SCE_D_DEFAULT=0 +val SCE_D_COMMENT=1 +val SCE_D_COMMENTLINE=2 +val SCE_D_COMMENTDOC=3 +val SCE_D_COMMENTNESTED=4 +val SCE_D_NUMBER=5 +val SCE_D_WORD=6 +val SCE_D_WORD2=7 +val SCE_D_WORD3=8 +val SCE_D_TYPEDEF=9 +val SCE_D_STRING=10 +val SCE_D_STRINGEOL=11 +val SCE_D_CHARACTER=12 +val SCE_D_OPERATOR=13 +val SCE_D_IDENTIFIER=14 +val SCE_D_COMMENTLINEDOC=15 +val SCE_D_COMMENTDOCKEYWORD=16 +val SCE_D_COMMENTDOCKEYWORDERROR=17 +val SCE_D_STRINGB=18 +val SCE_D_STRINGR=19 +val SCE_D_WORD5=20 +val SCE_D_WORD6=21 +val SCE_D_WORD7=22 +# Lexical states for SCLEX_TCL +lex TCL=SCLEX_TCL SCE_TCL_ +val SCE_TCL_DEFAULT=0 +val SCE_TCL_COMMENT=1 +val SCE_TCL_COMMENTLINE=2 +val SCE_TCL_NUMBER=3 +val SCE_TCL_WORD_IN_QUOTE=4 +val SCE_TCL_IN_QUOTE=5 +val SCE_TCL_OPERATOR=6 +val SCE_TCL_IDENTIFIER=7 +val SCE_TCL_SUBSTITUTION=8 +val SCE_TCL_SUB_BRACE=9 +val SCE_TCL_MODIFIER=10 +val SCE_TCL_EXPAND=11 +val SCE_TCL_WORD=12 +val SCE_TCL_WORD2=13 +val SCE_TCL_WORD3=14 +val SCE_TCL_WORD4=15 +val SCE_TCL_WORD5=16 +val SCE_TCL_WORD6=17 +val SCE_TCL_WORD7=18 +val SCE_TCL_WORD8=19 +val SCE_TCL_COMMENT_BOX=20 +val SCE_TCL_BLOCK_COMMENT=21 +# Lexical states for SCLEX_HTML, SCLEX_XML +lex HTML=SCLEX_HTML SCE_H +lex XML=SCLEX_XML SCE_H +lex ASP=SCLEX_ASP SCE_H +lex PHP=SCLEX_PHP SCE_H +val SCE_H_DEFAULT=0 +val SCE_H_TAG=1 +val SCE_H_TAGUNKNOWN=2 +val SCE_H_ATTRIBUTE=3 +val SCE_H_ATTRIBUTEUNKNOWN=4 +val SCE_H_NUMBER=5 +val SCE_H_DOUBLESTRING=6 +val SCE_H_SINGLESTRING=7 +val SCE_H_OTHER=8 +val SCE_H_COMMENT=9 +val SCE_H_ENTITY=10 +# XML and ASP +val SCE_H_TAGEND=11 +val SCE_H_XMLSTART=12 +val SCE_H_XMLEND=13 +val SCE_H_SCRIPT=14 +val SCE_H_ASP=15 +val SCE_H_ASPAT=16 +val SCE_H_CDATA=17 +val SCE_H_QUESTION=18 +# More HTML +val SCE_H_VALUE=19 +# X-Code +val SCE_H_XCCOMMENT=20 +# SGML +val SCE_H_SGML_DEFAULT=21 +val SCE_H_SGML_COMMAND=22 +val SCE_H_SGML_1ST_PARAM=23 +val SCE_H_SGML_DOUBLESTRING=24 +val SCE_H_SGML_SIMPLESTRING=25 +val SCE_H_SGML_ERROR=26 +val SCE_H_SGML_SPECIAL=27 +val SCE_H_SGML_ENTITY=28 +val SCE_H_SGML_COMMENT=29 +val SCE_H_SGML_1ST_PARAM_COMMENT=30 +val SCE_H_SGML_BLOCK_DEFAULT=31 +# Embedded Javascript +val SCE_HJ_START=40 +val SCE_HJ_DEFAULT=41 +val SCE_HJ_COMMENT=42 +val SCE_HJ_COMMENTLINE=43 +val SCE_HJ_COMMENTDOC=44 +val SCE_HJ_NUMBER=45 +val SCE_HJ_WORD=46 +val SCE_HJ_KEYWORD=47 +val SCE_HJ_DOUBLESTRING=48 +val SCE_HJ_SINGLESTRING=49 +val SCE_HJ_SYMBOLS=50 +val SCE_HJ_STRINGEOL=51 +val SCE_HJ_REGEX=52 +# ASP Javascript +val SCE_HJA_START=55 +val SCE_HJA_DEFAULT=56 +val SCE_HJA_COMMENT=57 +val SCE_HJA_COMMENTLINE=58 +val SCE_HJA_COMMENTDOC=59 +val SCE_HJA_NUMBER=60 +val SCE_HJA_WORD=61 +val SCE_HJA_KEYWORD=62 +val SCE_HJA_DOUBLESTRING=63 +val SCE_HJA_SINGLESTRING=64 +val SCE_HJA_SYMBOLS=65 +val SCE_HJA_STRINGEOL=66 +val SCE_HJA_REGEX=67 +# Embedded VBScript +val SCE_HB_START=70 +val SCE_HB_DEFAULT=71 +val SCE_HB_COMMENTLINE=72 +val SCE_HB_NUMBER=73 +val SCE_HB_WORD=74 +val SCE_HB_STRING=75 +val SCE_HB_IDENTIFIER=76 +val SCE_HB_STRINGEOL=77 +# ASP VBScript +val SCE_HBA_START=80 +val SCE_HBA_DEFAULT=81 +val SCE_HBA_COMMENTLINE=82 +val SCE_HBA_NUMBER=83 +val SCE_HBA_WORD=84 +val SCE_HBA_STRING=85 +val SCE_HBA_IDENTIFIER=86 +val SCE_HBA_STRINGEOL=87 +# Embedded Python +val SCE_HP_START=90 +val SCE_HP_DEFAULT=91 +val SCE_HP_COMMENTLINE=92 +val SCE_HP_NUMBER=93 +val SCE_HP_STRING=94 +val SCE_HP_CHARACTER=95 +val SCE_HP_WORD=96 +val SCE_HP_TRIPLE=97 +val SCE_HP_TRIPLEDOUBLE=98 +val SCE_HP_CLASSNAME=99 +val SCE_HP_DEFNAME=100 +val SCE_HP_OPERATOR=101 +val SCE_HP_IDENTIFIER=102 +# PHP +val SCE_HPHP_COMPLEX_VARIABLE=104 +# ASP Python +val SCE_HPA_START=105 +val SCE_HPA_DEFAULT=106 +val SCE_HPA_COMMENTLINE=107 +val SCE_HPA_NUMBER=108 +val SCE_HPA_STRING=109 +val SCE_HPA_CHARACTER=110 +val SCE_HPA_WORD=111 +val SCE_HPA_TRIPLE=112 +val SCE_HPA_TRIPLEDOUBLE=113 +val SCE_HPA_CLASSNAME=114 +val SCE_HPA_DEFNAME=115 +val SCE_HPA_OPERATOR=116 +val SCE_HPA_IDENTIFIER=117 +# PHP +val SCE_HPHP_DEFAULT=118 +val SCE_HPHP_HSTRING=119 +val SCE_HPHP_SIMPLESTRING=120 +val SCE_HPHP_WORD=121 +val SCE_HPHP_NUMBER=122 +val SCE_HPHP_VARIABLE=123 +val SCE_HPHP_COMMENT=124 +val SCE_HPHP_COMMENTLINE=125 +val SCE_HPHP_HSTRING_VARIABLE=126 +val SCE_HPHP_OPERATOR=127 +# Lexical states for SCLEX_PERL +lex Perl=SCLEX_PERL SCE_PL_ +val SCE_PL_DEFAULT=0 +val SCE_PL_ERROR=1 +val SCE_PL_COMMENTLINE=2 +val SCE_PL_POD=3 +val SCE_PL_NUMBER=4 +val SCE_PL_WORD=5 +val SCE_PL_STRING=6 +val SCE_PL_CHARACTER=7 +val SCE_PL_PUNCTUATION=8 +val SCE_PL_PREPROCESSOR=9 +val SCE_PL_OPERATOR=10 +val SCE_PL_IDENTIFIER=11 +val SCE_PL_SCALAR=12 +val SCE_PL_ARRAY=13 +val SCE_PL_HASH=14 +val SCE_PL_SYMBOLTABLE=15 +val SCE_PL_VARIABLE_INDEXER=16 +val SCE_PL_REGEX=17 +val SCE_PL_REGSUBST=18 +val SCE_PL_LONGQUOTE=19 +val SCE_PL_BACKTICKS=20 +val SCE_PL_DATASECTION=21 +val SCE_PL_HERE_DELIM=22 +val SCE_PL_HERE_Q=23 +val SCE_PL_HERE_QQ=24 +val SCE_PL_HERE_QX=25 +val SCE_PL_STRING_Q=26 +val SCE_PL_STRING_QQ=27 +val SCE_PL_STRING_QX=28 +val SCE_PL_STRING_QR=29 +val SCE_PL_STRING_QW=30 +val SCE_PL_POD_VERB=31 +val SCE_PL_SUB_PROTOTYPE=40 +val SCE_PL_FORMAT_IDENT=41 +val SCE_PL_FORMAT=42 +# Lexical states for SCLEX_RUBY +lex Ruby=SCLEX_RUBY SCE_RB_ +val SCE_RB_DEFAULT=0 +val SCE_RB_ERROR=1 +val SCE_RB_COMMENTLINE=2 +val SCE_RB_POD=3 +val SCE_RB_NUMBER=4 +val SCE_RB_WORD=5 +val SCE_RB_STRING=6 +val SCE_RB_CHARACTER=7 +val SCE_RB_CLASSNAME=8 +val SCE_RB_DEFNAME=9 +val SCE_RB_OPERATOR=10 +val SCE_RB_IDENTIFIER=11 +val SCE_RB_REGEX=12 +val SCE_RB_GLOBAL=13 +val SCE_RB_SYMBOL=14 +val SCE_RB_MODULE_NAME=15 +val SCE_RB_INSTANCE_VAR=16 +val SCE_RB_CLASS_VAR=17 +val SCE_RB_BACKTICKS=18 +val SCE_RB_DATASECTION=19 +val SCE_RB_HERE_DELIM=20 +val SCE_RB_HERE_Q=21 +val SCE_RB_HERE_QQ=22 +val SCE_RB_HERE_QX=23 +val SCE_RB_STRING_Q=24 +val SCE_RB_STRING_QQ=25 +val SCE_RB_STRING_QX=26 +val SCE_RB_STRING_QR=27 +val SCE_RB_STRING_QW=28 +val SCE_RB_WORD_DEMOTED=29 +val SCE_RB_STDIN=30 +val SCE_RB_STDOUT=31 +val SCE_RB_STDERR=40 +val SCE_RB_UPPER_BOUND=41 +# Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC +lex VB=SCLEX_VB SCE_B_ +lex VBScript=SCLEX_VBSCRIPT SCE_B_ +lex PowerBasic=SCLEX_POWERBASIC SCE_B_ +val SCE_B_DEFAULT=0 +val SCE_B_COMMENT=1 +val SCE_B_NUMBER=2 +val SCE_B_KEYWORD=3 +val SCE_B_STRING=4 +val SCE_B_PREPROCESSOR=5 +val SCE_B_OPERATOR=6 +val SCE_B_IDENTIFIER=7 +val SCE_B_DATE=8 +val SCE_B_STRINGEOL=9 +val SCE_B_KEYWORD2=10 +val SCE_B_KEYWORD3=11 +val SCE_B_KEYWORD4=12 +val SCE_B_CONSTANT=13 +val SCE_B_ASM=14 +val SCE_B_LABEL=15 +val SCE_B_ERROR=16 +val SCE_B_HEXNUMBER=17 +val SCE_B_BINNUMBER=18 +# Lexical states for SCLEX_PROPERTIES +lex Properties=SCLEX_PROPERTIES SCE_PROPS_ +val SCE_PROPS_DEFAULT=0 +val SCE_PROPS_COMMENT=1 +val SCE_PROPS_SECTION=2 +val SCE_PROPS_ASSIGNMENT=3 +val SCE_PROPS_DEFVAL=4 +val SCE_PROPS_KEY=5 +# Lexical states for SCLEX_LATEX +lex LaTeX=SCLEX_LATEX SCE_L_ +val SCE_L_DEFAULT=0 +val SCE_L_COMMAND=1 +val SCE_L_TAG=2 +val SCE_L_MATH=3 +val SCE_L_COMMENT=4 +# Lexical states for SCLEX_LUA +lex Lua=SCLEX_LUA SCE_LUA_ +val SCE_LUA_DEFAULT=0 +val SCE_LUA_COMMENT=1 +val SCE_LUA_COMMENTLINE=2 +val SCE_LUA_COMMENTDOC=3 +val SCE_LUA_NUMBER=4 +val SCE_LUA_WORD=5 +val SCE_LUA_STRING=6 +val SCE_LUA_CHARACTER=7 +val SCE_LUA_LITERALSTRING=8 +val SCE_LUA_PREPROCESSOR=9 +val SCE_LUA_OPERATOR=10 +val SCE_LUA_IDENTIFIER=11 +val SCE_LUA_STRINGEOL=12 +val SCE_LUA_WORD2=13 +val SCE_LUA_WORD3=14 +val SCE_LUA_WORD4=15 +val SCE_LUA_WORD5=16 +val SCE_LUA_WORD6=17 +val SCE_LUA_WORD7=18 +val SCE_LUA_WORD8=19 +# Lexical states for SCLEX_ERRORLIST +lex ErrorList=SCLEX_ERRORLIST SCE_ERR_ +val SCE_ERR_DEFAULT=0 +val SCE_ERR_PYTHON=1 +val SCE_ERR_GCC=2 +val SCE_ERR_MS=3 +val SCE_ERR_CMD=4 +val SCE_ERR_BORLAND=5 +val SCE_ERR_PERL=6 +val SCE_ERR_NET=7 +val SCE_ERR_LUA=8 +val SCE_ERR_CTAG=9 +val SCE_ERR_DIFF_CHANGED=10 +val SCE_ERR_DIFF_ADDITION=11 +val SCE_ERR_DIFF_DELETION=12 +val SCE_ERR_DIFF_MESSAGE=13 +val SCE_ERR_PHP=14 +val SCE_ERR_ELF=15 +val SCE_ERR_IFC=16 +val SCE_ERR_IFORT=17 +val SCE_ERR_ABSF=18 +val SCE_ERR_TIDY=19 +val SCE_ERR_JAVA_STACK=20 +val SCE_ERR_VALUE=21 +# Lexical states for SCLEX_BATCH +lex Batch=SCLEX_BATCH SCE_BAT_ +val SCE_BAT_DEFAULT=0 +val SCE_BAT_COMMENT=1 +val SCE_BAT_WORD=2 +val SCE_BAT_LABEL=3 +val SCE_BAT_HIDE=4 +val SCE_BAT_COMMAND=5 +val SCE_BAT_IDENTIFIER=6 +val SCE_BAT_OPERATOR=7 +# Lexical states for SCLEX_MAKEFILE +lex MakeFile=SCLEX_MAKEFILE SCE_MAKE_ +val SCE_MAKE_DEFAULT=0 +val SCE_MAKE_COMMENT=1 +val SCE_MAKE_PREPROCESSOR=2 +val SCE_MAKE_IDENTIFIER=3 +val SCE_MAKE_OPERATOR=4 +val SCE_MAKE_TARGET=5 +val SCE_MAKE_IDEOL=9 +# Lexical states for SCLEX_DIFF +lex Diff=SCLEX_DIFF SCE_DIFF_ +val SCE_DIFF_DEFAULT=0 +val SCE_DIFF_COMMENT=1 +val SCE_DIFF_COMMAND=2 +val SCE_DIFF_HEADER=3 +val SCE_DIFF_POSITION=4 +val SCE_DIFF_DELETED=5 +val SCE_DIFF_ADDED=6 +val SCE_DIFF_CHANGED=7 +# Lexical states for SCLEX_CONF (Apache Configuration Files Lexer) +lex Conf=SCLEX_CONF SCE_CONF_ +val SCE_CONF_DEFAULT=0 +val SCE_CONF_COMMENT=1 +val SCE_CONF_NUMBER=2 +val SCE_CONF_IDENTIFIER=3 +val SCE_CONF_EXTENSION=4 +val SCE_CONF_PARAMETER=5 +val SCE_CONF_STRING=6 +val SCE_CONF_OPERATOR=7 +val SCE_CONF_IP=8 +val SCE_CONF_DIRECTIVE=9 +# Lexical states for SCLEX_AVE, Avenue +lex Avenue=SCLEX_AVE SCE_AVE_ +val SCE_AVE_DEFAULT=0 +val SCE_AVE_COMMENT=1 +val SCE_AVE_NUMBER=2 +val SCE_AVE_WORD=3 +val SCE_AVE_STRING=6 +val SCE_AVE_ENUM=7 +val SCE_AVE_STRINGEOL=8 +val SCE_AVE_IDENTIFIER=9 +val SCE_AVE_OPERATOR=10 +val SCE_AVE_WORD1=11 +val SCE_AVE_WORD2=12 +val SCE_AVE_WORD3=13 +val SCE_AVE_WORD4=14 +val SCE_AVE_WORD5=15 +val SCE_AVE_WORD6=16 +# Lexical states for SCLEX_ADA +lex Ada=SCLEX_ADA SCE_ADA_ +val SCE_ADA_DEFAULT=0 +val SCE_ADA_WORD=1 +val SCE_ADA_IDENTIFIER=2 +val SCE_ADA_NUMBER=3 +val SCE_ADA_DELIMITER=4 +val SCE_ADA_CHARACTER=5 +val SCE_ADA_CHARACTEREOL=6 +val SCE_ADA_STRING=7 +val SCE_ADA_STRINGEOL=8 +val SCE_ADA_LABEL=9 +val SCE_ADA_COMMENTLINE=10 +val SCE_ADA_ILLEGAL=11 +# Lexical states for SCLEX_BAAN +lex Baan=SCLEX_BAAN SCE_BAAN_ +val SCE_BAAN_DEFAULT=0 +val SCE_BAAN_COMMENT=1 +val SCE_BAAN_COMMENTDOC=2 +val SCE_BAAN_NUMBER=3 +val SCE_BAAN_WORD=4 +val SCE_BAAN_STRING=5 +val SCE_BAAN_PREPROCESSOR=6 +val SCE_BAAN_OPERATOR=7 +val SCE_BAAN_IDENTIFIER=8 +val SCE_BAAN_STRINGEOL=9 +val SCE_BAAN_WORD2=10 +# Lexical states for SCLEX_LISP +lex Lisp=SCLEX_LISP SCE_LISP_ +val SCE_LISP_DEFAULT=0 +val SCE_LISP_COMMENT=1 +val SCE_LISP_NUMBER=2 +val SCE_LISP_KEYWORD=3 +val SCE_LISP_KEYWORD_KW=4 +val SCE_LISP_SYMBOL=5 +val SCE_LISP_STRING=6 +val SCE_LISP_STRINGEOL=8 +val SCE_LISP_IDENTIFIER=9 +val SCE_LISP_OPERATOR=10 +val SCE_LISP_SPECIAL=11 +val SCE_LISP_MULTI_COMMENT=12 +# Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW +lex Eiffel=SCLEX_EIFFEL SCE_EIFFEL_ +lex EiffelKW=SCLEX_EIFFELKW SCE_EIFFEL_ +val SCE_EIFFEL_DEFAULT=0 +val SCE_EIFFEL_COMMENTLINE=1 +val SCE_EIFFEL_NUMBER=2 +val SCE_EIFFEL_WORD=3 +val SCE_EIFFEL_STRING=4 +val SCE_EIFFEL_CHARACTER=5 +val SCE_EIFFEL_OPERATOR=6 +val SCE_EIFFEL_IDENTIFIER=7 +val SCE_EIFFEL_STRINGEOL=8 +# Lexical states for SCLEX_NNCRONTAB (nnCron crontab Lexer) +lex NNCronTab=SCLEX_NNCRONTAB SCE_NNCRONTAB_ +val SCE_NNCRONTAB_DEFAULT=0 +val SCE_NNCRONTAB_COMMENT=1 +val SCE_NNCRONTAB_TASK=2 +val SCE_NNCRONTAB_SECTION=3 +val SCE_NNCRONTAB_KEYWORD=4 +val SCE_NNCRONTAB_MODIFIER=5 +val SCE_NNCRONTAB_ASTERISK=6 +val SCE_NNCRONTAB_NUMBER=7 +val SCE_NNCRONTAB_STRING=8 +val SCE_NNCRONTAB_ENVIRONMENT=9 +val SCE_NNCRONTAB_IDENTIFIER=10 +# Lexical states for SCLEX_FORTH (Forth Lexer) +lex Forth=SCLEX_FORTH SCE_FORTH_ +val SCE_FORTH_DEFAULT=0 +val SCE_FORTH_COMMENT=1 +val SCE_FORTH_COMMENT_ML=2 +val SCE_FORTH_IDENTIFIER=3 +val SCE_FORTH_CONTROL=4 +val SCE_FORTH_KEYWORD=5 +val SCE_FORTH_DEFWORD=6 +val SCE_FORTH_PREWORD1=7 +val SCE_FORTH_PREWORD2=8 +val SCE_FORTH_NUMBER=9 +val SCE_FORTH_STRING=10 +val SCE_FORTH_LOCALE=11 +# Lexical states for SCLEX_MATLAB +lex MatLab=SCLEX_MATLAB SCE_MATLAB_ +val SCE_MATLAB_DEFAULT=0 +val SCE_MATLAB_COMMENT=1 +val SCE_MATLAB_COMMAND=2 +val SCE_MATLAB_NUMBER=3 +val SCE_MATLAB_KEYWORD=4 +# single quoted string +val SCE_MATLAB_STRING=5 +val SCE_MATLAB_OPERATOR=6 +val SCE_MATLAB_IDENTIFIER=7 +val SCE_MATLAB_DOUBLEQUOTESTRING=8 +# Lexical states for SCLEX_SCRIPTOL +lex Sol=SCLEX_SCRIPTOL SCE_SCRIPTOL_ +val SCE_SCRIPTOL_DEFAULT=0 +val SCE_SCRIPTOL_WHITE=1 +val SCE_SCRIPTOL_COMMENTLINE=2 +val SCE_SCRIPTOL_PERSISTENT=3 +val SCE_SCRIPTOL_CSTYLE=4 +val SCE_SCRIPTOL_COMMENTBLOCK=5 +val SCE_SCRIPTOL_NUMBER=6 +val SCE_SCRIPTOL_STRING=7 +val SCE_SCRIPTOL_CHARACTER=8 +val SCE_SCRIPTOL_STRINGEOL=9 +val SCE_SCRIPTOL_KEYWORD=10 +val SCE_SCRIPTOL_OPERATOR=11 +val SCE_SCRIPTOL_IDENTIFIER=12 +val SCE_SCRIPTOL_TRIPLE=13 +val SCE_SCRIPTOL_CLASSNAME=14 +val SCE_SCRIPTOL_PREPROCESSOR=15 +# Lexical states for SCLEX_ASM +lex Asm=SCLEX_ASM SCE_ASM_ +val SCE_ASM_DEFAULT=0 +val SCE_ASM_COMMENT=1 +val SCE_ASM_NUMBER=2 +val SCE_ASM_STRING=3 +val SCE_ASM_OPERATOR=4 +val SCE_ASM_IDENTIFIER=5 +val SCE_ASM_CPUINSTRUCTION=6 +val SCE_ASM_MATHINSTRUCTION=7 +val SCE_ASM_REGISTER=8 +val SCE_ASM_DIRECTIVE=9 +val SCE_ASM_DIRECTIVEOPERAND=10 +val SCE_ASM_COMMENTBLOCK=11 +val SCE_ASM_CHARACTER=12 +val SCE_ASM_STRINGEOL=13 +val SCE_ASM_EXTINSTRUCTION=14 +# Lexical states for SCLEX_FORTRAN +lex Fortran=SCLEX_FORTRAN SCE_F_ +lex F77=SCLEX_F77 SCE_F_ +val SCE_F_DEFAULT=0 +val SCE_F_COMMENT=1 +val SCE_F_NUMBER=2 +val SCE_F_STRING1=3 +val SCE_F_STRING2=4 +val SCE_F_STRINGEOL=5 +val SCE_F_OPERATOR=6 +val SCE_F_IDENTIFIER=7 +val SCE_F_WORD=8 +val SCE_F_WORD2=9 +val SCE_F_WORD3=10 +val SCE_F_PREPROCESSOR=11 +val SCE_F_OPERATOR2=12 +val SCE_F_LABEL=13 +val SCE_F_CONTINUATION=14 +# Lexical states for SCLEX_CSS +lex CSS=SCLEX_CSS SCE_CSS_ +val SCE_CSS_DEFAULT=0 +val SCE_CSS_TAG=1 +val SCE_CSS_CLASS=2 +val SCE_CSS_PSEUDOCLASS=3 +val SCE_CSS_UNKNOWN_PSEUDOCLASS=4 +val SCE_CSS_OPERATOR=5 +val SCE_CSS_IDENTIFIER=6 +val SCE_CSS_UNKNOWN_IDENTIFIER=7 +val SCE_CSS_VALUE=8 +val SCE_CSS_COMMENT=9 +val SCE_CSS_ID=10 +val SCE_CSS_IMPORTANT=11 +val SCE_CSS_DIRECTIVE=12 +val SCE_CSS_DOUBLESTRING=13 +val SCE_CSS_SINGLESTRING=14 +val SCE_CSS_IDENTIFIER2=15 +val SCE_CSS_ATTRIBUTE=16 +val SCE_CSS_IDENTIFIER3=17 +val SCE_CSS_PSEUDOELEMENT=18 +val SCE_CSS_EXTENDED_IDENTIFIER=19 +val SCE_CSS_EXTENDED_PSEUDOCLASS=20 +val SCE_CSS_EXTENDED_PSEUDOELEMENT=21 +# Lexical states for SCLEX_POV +lex POV=SCLEX_POV SCE_POV_ +val SCE_POV_DEFAULT=0 +val SCE_POV_COMMENT=1 +val SCE_POV_COMMENTLINE=2 +val SCE_POV_NUMBER=3 +val SCE_POV_OPERATOR=4 +val SCE_POV_IDENTIFIER=5 +val SCE_POV_STRING=6 +val SCE_POV_STRINGEOL=7 +val SCE_POV_DIRECTIVE=8 +val SCE_POV_BADDIRECTIVE=9 +val SCE_POV_WORD2=10 +val SCE_POV_WORD3=11 +val SCE_POV_WORD4=12 +val SCE_POV_WORD5=13 +val SCE_POV_WORD6=14 +val SCE_POV_WORD7=15 +val SCE_POV_WORD8=16 +# Lexical states for SCLEX_LOUT +lex LOUT=SCLEX_LOUT SCE_LOUT_ +val SCE_LOUT_DEFAULT=0 +val SCE_LOUT_COMMENT=1 +val SCE_LOUT_NUMBER=2 +val SCE_LOUT_WORD=3 +val SCE_LOUT_WORD2=4 +val SCE_LOUT_WORD3=5 +val SCE_LOUT_WORD4=6 +val SCE_LOUT_STRING=7 +val SCE_LOUT_OPERATOR=8 +val SCE_LOUT_IDENTIFIER=9 +val SCE_LOUT_STRINGEOL=10 +# Lexical states for SCLEX_ESCRIPT +lex ESCRIPT=SCLEX_ESCRIPT SCE_ESCRIPT_ +val SCE_ESCRIPT_DEFAULT=0 +val SCE_ESCRIPT_COMMENT=1 +val SCE_ESCRIPT_COMMENTLINE=2 +val SCE_ESCRIPT_COMMENTDOC=3 +val SCE_ESCRIPT_NUMBER=4 +val SCE_ESCRIPT_WORD=5 +val SCE_ESCRIPT_STRING=6 +val SCE_ESCRIPT_OPERATOR=7 +val SCE_ESCRIPT_IDENTIFIER=8 +val SCE_ESCRIPT_BRACE=9 +val SCE_ESCRIPT_WORD2=10 +val SCE_ESCRIPT_WORD3=11 +# Lexical states for SCLEX_PS +lex PS=SCLEX_PS SCE_PS_ +val SCE_PS_DEFAULT=0 +val SCE_PS_COMMENT=1 +val SCE_PS_DSC_COMMENT=2 +val SCE_PS_DSC_VALUE=3 +val SCE_PS_NUMBER=4 +val SCE_PS_NAME=5 +val SCE_PS_KEYWORD=6 +val SCE_PS_LITERAL=7 +val SCE_PS_IMMEVAL=8 +val SCE_PS_PAREN_ARRAY=9 +val SCE_PS_PAREN_DICT=10 +val SCE_PS_PAREN_PROC=11 +val SCE_PS_TEXT=12 +val SCE_PS_HEXSTRING=13 +val SCE_PS_BASE85STRING=14 +val SCE_PS_BADSTRINGCHAR=15 +# Lexical states for SCLEX_NSIS +lex NSIS=SCLEX_NSIS SCE_NSIS_ +val SCE_NSIS_DEFAULT=0 +val SCE_NSIS_COMMENT=1 +val SCE_NSIS_STRINGDQ=2 +val SCE_NSIS_STRINGLQ=3 +val SCE_NSIS_STRINGRQ=4 +val SCE_NSIS_FUNCTION=5 +val SCE_NSIS_VARIABLE=6 +val SCE_NSIS_LABEL=7 +val SCE_NSIS_USERDEFINED=8 +val SCE_NSIS_SECTIONDEF=9 +val SCE_NSIS_SUBSECTIONDEF=10 +val SCE_NSIS_IFDEFINEDEF=11 +val SCE_NSIS_MACRODEF=12 +val SCE_NSIS_STRINGVAR=13 +val SCE_NSIS_NUMBER=14 +val SCE_NSIS_SECTIONGROUP=15 +val SCE_NSIS_PAGEEX=16 +val SCE_NSIS_FUNCTIONDEF=17 +val SCE_NSIS_COMMENTBOX=18 +# Lexical states for SCLEX_MMIXAL +lex MMIXAL=SCLEX_MMIXAL SCE_MMIXAL_ +val SCE_MMIXAL_LEADWS=0 +val SCE_MMIXAL_COMMENT=1 +val SCE_MMIXAL_LABEL=2 +val SCE_MMIXAL_OPCODE=3 +val SCE_MMIXAL_OPCODE_PRE=4 +val SCE_MMIXAL_OPCODE_VALID=5 +val SCE_MMIXAL_OPCODE_UNKNOWN=6 +val SCE_MMIXAL_OPCODE_POST=7 +val SCE_MMIXAL_OPERANDS=8 +val SCE_MMIXAL_NUMBER=9 +val SCE_MMIXAL_REF=10 +val SCE_MMIXAL_CHAR=11 +val SCE_MMIXAL_STRING=12 +val SCE_MMIXAL_REGISTER=13 +val SCE_MMIXAL_HEX=14 +val SCE_MMIXAL_OPERATOR=15 +val SCE_MMIXAL_SYMBOL=16 +val SCE_MMIXAL_INCLUDE=17 +# Lexical states for SCLEX_CLW +lex Clarion=SCLEX_CLW SCE_CLW_ +val SCE_CLW_DEFAULT=0 +val SCE_CLW_LABEL=1 +val SCE_CLW_COMMENT=2 +val SCE_CLW_STRING=3 +val SCE_CLW_USER_IDENTIFIER=4 +val SCE_CLW_INTEGER_CONSTANT=5 +val SCE_CLW_REAL_CONSTANT=6 +val SCE_CLW_PICTURE_STRING=7 +val SCE_CLW_KEYWORD=8 +val SCE_CLW_COMPILER_DIRECTIVE=9 +val SCE_CLW_RUNTIME_EXPRESSIONS=10 +val SCE_CLW_BUILTIN_PROCEDURES_FUNCTION=11 +val SCE_CLW_STRUCTURE_DATA_TYPE=12 +val SCE_CLW_ATTRIBUTE=13 +val SCE_CLW_STANDARD_EQUATE=14 +val SCE_CLW_ERROR=15 +val SCE_CLW_DEPRECATED=16 +# Lexical states for SCLEX_LOT +lex LOT=SCLEX_LOT SCE_LOT_ +val SCE_LOT_DEFAULT=0 +val SCE_LOT_HEADER=1 +val SCE_LOT_BREAK=2 +val SCE_LOT_SET=3 +val SCE_LOT_PASS=4 +val SCE_LOT_FAIL=5 +val SCE_LOT_ABORT=6 +# Lexical states for SCLEX_YAML +lex YAML=SCLEX_YAML SCE_YAML_ +val SCE_YAML_DEFAULT=0 +val SCE_YAML_COMMENT=1 +val SCE_YAML_IDENTIFIER=2 +val SCE_YAML_KEYWORD=3 +val SCE_YAML_NUMBER=4 +val SCE_YAML_REFERENCE=5 +val SCE_YAML_DOCUMENT=6 +val SCE_YAML_TEXT=7 +val SCE_YAML_ERROR=8 +val SCE_YAML_OPERATOR=9 +# Lexical states for SCLEX_TEX +lex TeX=SCLEX_TEX SCE_TEX_ +val SCE_TEX_DEFAULT=0 +val SCE_TEX_SPECIAL=1 +val SCE_TEX_GROUP=2 +val SCE_TEX_SYMBOL=3 +val SCE_TEX_COMMAND=4 +val SCE_TEX_TEXT=5 +lex Metapost=SCLEX_METAPOST SCE_METAPOST_ +val SCE_METAPOST_DEFAULT=0 +val SCE_METAPOST_SPECIAL=1 +val SCE_METAPOST_GROUP=2 +val SCE_METAPOST_SYMBOL=3 +val SCE_METAPOST_COMMAND=4 +val SCE_METAPOST_TEXT=5 +val SCE_METAPOST_EXTRA=6 +# Lexical states for SCLEX_ERLANG +lex Erlang=SCLEX_ERLANG SCE_ERLANG_ +val SCE_ERLANG_DEFAULT=0 +val SCE_ERLANG_COMMENT=1 +val SCE_ERLANG_VARIABLE=2 +val SCE_ERLANG_NUMBER=3 +val SCE_ERLANG_KEYWORD=4 +val SCE_ERLANG_STRING=5 +val SCE_ERLANG_OPERATOR=6 +val SCE_ERLANG_ATOM=7 +val SCE_ERLANG_FUNCTION_NAME=8 +val SCE_ERLANG_CHARACTER=9 +val SCE_ERLANG_MACRO=10 +val SCE_ERLANG_RECORD=11 +val SCE_ERLANG_SEPARATOR=12 +val SCE_ERLANG_NODE_NAME=13 +val SCE_ERLANG_UNKNOWN=31 +# Lexical states for SCLEX_OCTAVE are identical to MatLab +lex Octave=SCLEX_OCTAVE SCE_MATLAB_ +# Lexical states for SCLEX_MSSQL +lex MSSQL=SCLEX_MSSQL SCE_MSSQL_ +val SCE_MSSQL_DEFAULT=0 +val SCE_MSSQL_COMMENT=1 +val SCE_MSSQL_LINE_COMMENT=2 +val SCE_MSSQL_NUMBER=3 +val SCE_MSSQL_STRING=4 +val SCE_MSSQL_OPERATOR=5 +val SCE_MSSQL_IDENTIFIER=6 +val SCE_MSSQL_VARIABLE=7 +val SCE_MSSQL_COLUMN_NAME=8 +val SCE_MSSQL_STATEMENT=9 +val SCE_MSSQL_DATATYPE=10 +val SCE_MSSQL_SYSTABLE=11 +val SCE_MSSQL_GLOBAL_VARIABLE=12 +val SCE_MSSQL_FUNCTION=13 +val SCE_MSSQL_STORED_PROCEDURE=14 +val SCE_MSSQL_DEFAULT_PREF_DATATYPE=15 +val SCE_MSSQL_COLUMN_NAME_2=16 +# Lexical states for SCLEX_VERILOG +lex Verilog=SCLEX_VERILOG SCE_V_ +val SCE_V_DEFAULT=0 +val SCE_V_COMMENT=1 +val SCE_V_COMMENTLINE=2 +val SCE_V_COMMENTLINEBANG=3 +val SCE_V_NUMBER=4 +val SCE_V_WORD=5 +val SCE_V_STRING=6 +val SCE_V_WORD2=7 +val SCE_V_WORD3=8 +val SCE_V_PREPROCESSOR=9 +val SCE_V_OPERATOR=10 +val SCE_V_IDENTIFIER=11 +val SCE_V_STRINGEOL=12 +val SCE_V_USER=19 +# Lexical states for SCLEX_KIX +lex Kix=SCLEX_KIX SCE_KIX_ +val SCE_KIX_DEFAULT=0 +val SCE_KIX_COMMENT=1 +val SCE_KIX_STRING1=2 +val SCE_KIX_STRING2=3 +val SCE_KIX_NUMBER=4 +val SCE_KIX_VAR=5 +val SCE_KIX_MACRO=6 +val SCE_KIX_KEYWORD=7 +val SCE_KIX_FUNCTIONS=8 +val SCE_KIX_OPERATOR=9 +val SCE_KIX_IDENTIFIER=31 +# Lexical states for SCLEX_GUI4CLI +val SCE_GC_DEFAULT=0 +val SCE_GC_COMMENTLINE=1 +val SCE_GC_COMMENTBLOCK=2 +val SCE_GC_GLOBAL=3 +val SCE_GC_EVENT=4 +val SCE_GC_ATTRIBUTE=5 +val SCE_GC_CONTROL=6 +val SCE_GC_COMMAND=7 +val SCE_GC_STRING=8 +val SCE_GC_OPERATOR=9 +# Lexical states for SCLEX_SPECMAN +lex Specman=SCLEX_SPECMAN SCE_SN_ +val SCE_SN_DEFAULT=0 +val SCE_SN_CODE=1 +val SCE_SN_COMMENTLINE=2 +val SCE_SN_COMMENTLINEBANG=3 +val SCE_SN_NUMBER=4 +val SCE_SN_WORD=5 +val SCE_SN_STRING=6 +val SCE_SN_WORD2=7 +val SCE_SN_WORD3=8 +val SCE_SN_PREPROCESSOR=9 +val SCE_SN_OPERATOR=10 +val SCE_SN_IDENTIFIER=11 +val SCE_SN_STRINGEOL=12 +val SCE_SN_REGEXTAG=13 +val SCE_SN_SIGNAL=14 +val SCE_SN_USER=19 +# Lexical states for SCLEX_AU3 +lex Au3=SCLEX_AU3 SCE_AU3_ +val SCE_AU3_DEFAULT=0 +val SCE_AU3_COMMENT=1 +val SCE_AU3_COMMENTBLOCK=2 +val SCE_AU3_NUMBER=3 +val SCE_AU3_FUNCTION=4 +val SCE_AU3_KEYWORD=5 +val SCE_AU3_MACRO=6 +val SCE_AU3_STRING=7 +val SCE_AU3_OPERATOR=8 +val SCE_AU3_VARIABLE=9 +val SCE_AU3_SENT=10 +val SCE_AU3_PREPROCESSOR=11 +val SCE_AU3_SPECIAL=12 +val SCE_AU3_EXPAND=13 +val SCE_AU3_COMOBJ=14 +val SCE_AU3_UDF=15 +# Lexical states for SCLEX_APDL +lex APDL=SCLEX_APDL SCE_APDL_ +val SCE_APDL_DEFAULT=0 +val SCE_APDL_COMMENT=1 +val SCE_APDL_COMMENTBLOCK=2 +val SCE_APDL_NUMBER=3 +val SCE_APDL_STRING=4 +val SCE_APDL_OPERATOR=5 +val SCE_APDL_WORD=6 +val SCE_APDL_PROCESSOR=7 +val SCE_APDL_COMMAND=8 +val SCE_APDL_SLASHCOMMAND=9 +val SCE_APDL_STARCOMMAND=10 +val SCE_APDL_ARGUMENT=11 +val SCE_APDL_FUNCTION=12 +# Lexical states for SCLEX_BASH +lex Bash=SCLEX_BASH SCE_SH_ +val SCE_SH_DEFAULT=0 +val SCE_SH_ERROR=1 +val SCE_SH_COMMENTLINE=2 +val SCE_SH_NUMBER=3 +val SCE_SH_WORD=4 +val SCE_SH_STRING=5 +val SCE_SH_CHARACTER=6 +val SCE_SH_OPERATOR=7 +val SCE_SH_IDENTIFIER=8 +val SCE_SH_SCALAR=9 +val SCE_SH_PARAM=10 +val SCE_SH_BACKTICKS=11 +val SCE_SH_HERE_DELIM=12 +val SCE_SH_HERE_Q=13 +# Lexical states for SCLEX_ASN1 +lex Asn1=SCLEX_ASN1 SCE_ASN1_ +val SCE_ASN1_DEFAULT=0 +val SCE_ASN1_COMMENT=1 +val SCE_ASN1_IDENTIFIER=2 +val SCE_ASN1_STRING=3 +val SCE_ASN1_OID=4 +val SCE_ASN1_SCALAR=5 +val SCE_ASN1_KEYWORD=6 +val SCE_ASN1_ATTRIBUTE=7 +val SCE_ASN1_DESCRIPTOR=8 +val SCE_ASN1_TYPE=9 +val SCE_ASN1_OPERATOR=10 +# Lexical states for SCLEX_VHDL +lex VHDL=SCLEX_VHDL SCE_VHDL_ +val SCE_VHDL_DEFAULT=0 +val SCE_VHDL_COMMENT=1 +val SCE_VHDL_COMMENTLINEBANG=2 +val SCE_VHDL_NUMBER=3 +val SCE_VHDL_STRING=4 +val SCE_VHDL_OPERATOR=5 +val SCE_VHDL_IDENTIFIER=6 +val SCE_VHDL_STRINGEOL=7 +val SCE_VHDL_KEYWORD=8 +val SCE_VHDL_STDOPERATOR=9 +val SCE_VHDL_ATTRIBUTE=10 +val SCE_VHDL_STDFUNCTION=11 +val SCE_VHDL_STDPACKAGE=12 +val SCE_VHDL_STDTYPE=13 +val SCE_VHDL_USERWORD=14 +# Lexical states for SCLEX_CAML +lex Caml=SCLEX_CAML SCE_CAML_ +val SCE_CAML_DEFAULT=0 +val SCE_CAML_IDENTIFIER=1 +val SCE_CAML_TAGNAME=2 +val SCE_CAML_KEYWORD=3 +val SCE_CAML_KEYWORD2=4 +val SCE_CAML_KEYWORD3=5 +val SCE_CAML_LINENUM=6 +val SCE_CAML_OPERATOR=7 +val SCE_CAML_NUMBER=8 +val SCE_CAML_CHAR=9 +val SCE_CAML_WHITE=10 +val SCE_CAML_STRING=11 +val SCE_CAML_COMMENT=12 +val SCE_CAML_COMMENT1=13 +val SCE_CAML_COMMENT2=14 +val SCE_CAML_COMMENT3=15 +# Lexical states for SCLEX_HASKELL +lex Haskell=SCLEX_HASKELL SCE_HA_ +val SCE_HA_DEFAULT=0 +val SCE_HA_IDENTIFIER=1 +val SCE_HA_KEYWORD=2 +val SCE_HA_NUMBER=3 +val SCE_HA_STRING=4 +val SCE_HA_CHARACTER=5 +val SCE_HA_CLASS=6 +val SCE_HA_MODULE=7 +val SCE_HA_CAPITAL=8 +val SCE_HA_DATA=9 +val SCE_HA_IMPORT=10 +val SCE_HA_OPERATOR=11 +val SCE_HA_INSTANCE=12 +val SCE_HA_COMMENTLINE=13 +val SCE_HA_COMMENTBLOCK=14 +val SCE_HA_COMMENTBLOCK2=15 +val SCE_HA_COMMENTBLOCK3=16 +# Lexical states of SCLEX_TADS3 +lex TADS3=SCLEX_TADS3 SCE_T3_ +val SCE_T3_DEFAULT=0 +val SCE_T3_X_DEFAULT=1 +val SCE_T3_PREPROCESSOR=2 +val SCE_T3_BLOCK_COMMENT=3 +val SCE_T3_LINE_COMMENT=4 +val SCE_T3_OPERATOR=5 +val SCE_T3_KEYWORD=6 +val SCE_T3_NUMBER=7 +val SCE_T3_IDENTIFIER=8 +val SCE_T3_S_STRING=9 +val SCE_T3_D_STRING=10 +val SCE_T3_X_STRING=11 +val SCE_T3_LIB_DIRECTIVE=12 +val SCE_T3_MSG_PARAM=13 +val SCE_T3_HTML_TAG=14 +val SCE_T3_HTML_DEFAULT=15 +val SCE_T3_HTML_STRING=16 +val SCE_T3_USER1=17 +val SCE_T3_USER2=18 +val SCE_T3_USER3=19 +val SCE_T3_BRACE=20 +# Lexical states for SCLEX_REBOL +lex Rebol=SCLEX_REBOL SCE_REBOL_ +val SCE_REBOL_DEFAULT=0 +val SCE_REBOL_COMMENTLINE=1 +val SCE_REBOL_COMMENTBLOCK=2 +val SCE_REBOL_PREFACE=3 +val SCE_REBOL_OPERATOR=4 +val SCE_REBOL_CHARACTER=5 +val SCE_REBOL_QUOTEDSTRING=6 +val SCE_REBOL_BRACEDSTRING=7 +val SCE_REBOL_NUMBER=8 +val SCE_REBOL_PAIR=9 +val SCE_REBOL_TUPLE=10 +val SCE_REBOL_BINARY=11 +val SCE_REBOL_MONEY=12 +val SCE_REBOL_ISSUE=13 +val SCE_REBOL_TAG=14 +val SCE_REBOL_FILE=15 +val SCE_REBOL_EMAIL=16 +val SCE_REBOL_URL=17 +val SCE_REBOL_DATE=18 +val SCE_REBOL_TIME=19 +val SCE_REBOL_IDENTIFIER=20 +val SCE_REBOL_WORD=21 +val SCE_REBOL_WORD2=22 +val SCE_REBOL_WORD3=23 +val SCE_REBOL_WORD4=24 +val SCE_REBOL_WORD5=25 +val SCE_REBOL_WORD6=26 +val SCE_REBOL_WORD7=27 +val SCE_REBOL_WORD8=28 +# Lexical states for SCLEX_SQL +lex SQL=SCLEX_SQL SCE_SQL_ +val SCE_SQL_DEFAULT=0 +val SCE_SQL_COMMENT=1 +val SCE_SQL_COMMENTLINE=2 +val SCE_SQL_COMMENTDOC=3 +val SCE_SQL_NUMBER=4 +val SCE_SQL_WORD=5 +val SCE_SQL_STRING=6 +val SCE_SQL_CHARACTER=7 +val SCE_SQL_SQLPLUS=8 +val SCE_SQL_SQLPLUS_PROMPT=9 +val SCE_SQL_OPERATOR=10 +val SCE_SQL_IDENTIFIER=11 +val SCE_SQL_SQLPLUS_COMMENT=13 +val SCE_SQL_COMMENTLINEDOC=15 +val SCE_SQL_WORD2=16 +val SCE_SQL_COMMENTDOCKEYWORD=17 +val SCE_SQL_COMMENTDOCKEYWORDERROR=18 +val SCE_SQL_USER1=19 +val SCE_SQL_USER2=20 +val SCE_SQL_USER3=21 +val SCE_SQL_USER4=22 +val SCE_SQL_QUOTEDIDENTIFIER=23 +# Lexical states for SCLEX_SMALLTALK +lex Smalltalk=SCLEX_SMALLTALK SCE_ST_ +val SCE_ST_DEFAULT=0 +val SCE_ST_STRING=1 +val SCE_ST_NUMBER=2 +val SCE_ST_COMMENT=3 +val SCE_ST_SYMBOL=4 +val SCE_ST_BINARY=5 +val SCE_ST_BOOL=6 +val SCE_ST_SELF=7 +val SCE_ST_SUPER=8 +val SCE_ST_NIL=9 +val SCE_ST_GLOBAL=10 +val SCE_ST_RETURN=11 +val SCE_ST_SPECIAL=12 +val SCE_ST_KWSEND=13 +val SCE_ST_ASSIGN=14 +val SCE_ST_CHARACTER=15 +val SCE_ST_SPEC_SEL=16 +# Lexical states for SCLEX_FLAGSHIP (clipper) +lex FlagShip=SCLEX_FLAGSHIP SCE_B_ +val SCE_FS_DEFAULT=0 +val SCE_FS_COMMENT=1 +val SCE_FS_COMMENTLINE=2 +val SCE_FS_COMMENTDOC=3 +val SCE_FS_COMMENTLINEDOC=4 +val SCE_FS_COMMENTDOCKEYWORD=5 +val SCE_FS_COMMENTDOCKEYWORDERROR=6 +val SCE_FS_KEYWORD=7 +val SCE_FS_KEYWORD2=8 +val SCE_FS_KEYWORD3=9 +val SCE_FS_KEYWORD4=10 +val SCE_FS_NUMBER=11 +val SCE_FS_STRING=12 +val SCE_FS_PREPROCESSOR=13 +val SCE_FS_OPERATOR=14 +val SCE_FS_IDENTIFIER=15 +val SCE_FS_DATE=16 +val SCE_FS_STRINGEOL=17 +val SCE_FS_CONSTANT=18 +val SCE_FS_ASM=19 +val SCE_FS_LABEL=20 +val SCE_FS_ERROR=21 +val SCE_FS_HEXNUMBER=22 +val SCE_FS_BINNUMBER=23 +# Lexical states for SCLEX_CSOUND +lex Csound=SCLEX_CSOUND SCE_CSOUND_ +val SCE_CSOUND_DEFAULT=0 +val SCE_CSOUND_COMMENT=1 +val SCE_CSOUND_NUMBER=2 +val SCE_CSOUND_OPERATOR=3 +val SCE_CSOUND_INSTR=4 +val SCE_CSOUND_IDENTIFIER=5 +val SCE_CSOUND_OPCODE=6 +val SCE_CSOUND_HEADERSTMT=7 +val SCE_CSOUND_USERKEYWORD=8 +val SCE_CSOUND_COMMENTBLOCK=9 +val SCE_CSOUND_PARAM=10 +val SCE_CSOUND_ARATE_VAR=11 +val SCE_CSOUND_KRATE_VAR=12 +val SCE_CSOUND_IRATE_VAR=13 +val SCE_CSOUND_GLOBAL_VAR=14 +val SCE_CSOUND_STRINGEOL=15 +# Lexical states for SCLEX_INNOSETUP +lex Inno=SCLEX_INNOSETUP SCE_INNO_ +val SCE_INNO_DEFAULT=0 +val SCE_INNO_COMMENT=1 +val SCE_INNO_KEYWORD=2 +val SCE_INNO_PARAMETER=3 +val SCE_INNO_SECTION=4 +val SCE_INNO_PREPROC=5 +val SCE_INNO_PREPROC_INLINE=6 +val SCE_INNO_INLINE_EXPANSION=6 +val SCE_INNO_COMMENT_PASCAL=7 +val SCE_INNO_KEYWORD_PASCAL=8 +val SCE_INNO_KEYWORD_USER=9 +val SCE_INNO_STRING_DOUBLE=10 +val SCE_INNO_STRING_SINGLE=11 +val SCE_INNO_IDENTIFIER=12 +# Lexical states for SCLEX_OPAL +lex Opal=SCLEX_OPAL SCE_OPAL_ +val SCE_OPAL_SPACE=0 +val SCE_OPAL_COMMENT_BLOCK=1 +val SCE_OPAL_COMMENT_LINE=2 +val SCE_OPAL_INTEGER=3 +val SCE_OPAL_KEYWORD=4 +val SCE_OPAL_SORT=5 +val SCE_OPAL_STRING=6 +val SCE_OPAL_PAR=7 +val SCE_OPAL_BOOL_CONST=8 +val SCE_OPAL_DEFAULT=32 +# Lexical states for SCLEX_SPICE +lex Spice=SCLEX_SPICE SCE_SPICE_ +val SCE_SPICE_DEFAULT=0 +val SCE_SPICE_IDENTIFIER=1 +val SCE_SPICE_KEYWORD=2 +val SCE_SPICE_KEYWORD2=3 +val SCE_SPICE_KEYWORD3=4 +val SCE_SPICE_NUMBER=5 +val SCE_SPICE_DELIMITER=6 +val SCE_SPICE_VALUE=7 +val SCE_SPICE_COMMENTLINE=8 +# Lexical states for SCLEX_CMAKE +lex CMAKE=SCLEX_CMAKE SCE_CMAKE_ +val SCE_CMAKE_DEFAULT=0 +val SCE_CMAKE_COMMENT=1 +val SCE_CMAKE_STRINGDQ=2 +val SCE_CMAKE_STRINGLQ=3 +val SCE_CMAKE_STRINGRQ=4 +val SCE_CMAKE_COMMANDS=5 +val SCE_CMAKE_PARAMETERS=6 +val SCE_CMAKE_VARIABLE=7 +val SCE_CMAKE_USERDEFINED=8 +val SCE_CMAKE_WHILEDEF=9 +val SCE_CMAKE_FOREACHDEF=10 +val SCE_CMAKE_IFDEFINEDEF=11 +val SCE_CMAKE_MACRODEF=12 +val SCE_CMAKE_STRINGVAR=13 +val SCE_CMAKE_NUMBER=14 +# Lexical states for SCLEX_GAP +lex Gap=SCLEX_GAP SCE_GAP_ +val SCE_GAP_DEFAULT=0 +val SCE_GAP_IDENTIFIER=1 +val SCE_GAP_KEYWORD=2 +val SCE_GAP_KEYWORD2=3 +val SCE_GAP_KEYWORD3=4 +val SCE_GAP_KEYWORD4=5 +val SCE_GAP_STRING=6 +val SCE_GAP_CHAR=7 +val SCE_GAP_OPERATOR=8 +val SCE_GAP_COMMENT=9 +val SCE_GAP_NUMBER=10 +val SCE_GAP_STRINGEOL=11 +# Lexical state for SCLEX_PLM +lex PLM=SCLEX_PLM SCE_PLM_ +val SCE_PLM_DEFAULT=0 +val SCE_PLM_COMMENT=1 +val SCE_PLM_STRING=2 +val SCE_PLM_NUMBER=3 +val SCE_PLM_IDENTIFIER=4 +val SCE_PLM_OPERATOR=5 +val SCE_PLM_CONTROL=6 +val SCE_PLM_KEYWORD=7 +# Lexical state for SCLEX_PROGRESS +lex Progress=SCLEX_PROGRESS SCE_4GL_ +val SCE_4GL_DEFAULT=0 +val SCE_4GL_NUMBER=1 +val SCE_4GL_WORD=2 +val SCE_4GL_STRING=3 +val SCE_4GL_CHARACTER=4 +val SCE_4GL_PREPROCESSOR=5 +val SCE_4GL_OPERATOR=6 +val SCE_4GL_IDENTIFIER=7 +val SCE_4GL_BLOCK=8 +val SCE_4GL_END=9 +val SCE_4GL_COMMENT1=10 +val SCE_4GL_COMMENT2=11 +val SCE_4GL_COMMENT3=12 +val SCE_4GL_COMMENT4=13 +val SCE_4GL_COMMENT5=14 +val SCE_4GL_COMMENT6=15 +val SCE_4GL_DEFAULT_=16 +val SCE_4GL_NUMBER_=17 +val SCE_4GL_WORD_=18 +val SCE_4GL_STRING_=19 +val SCE_4GL_CHARACTER_=20 +val SCE_4GL_PREPROCESSOR_=21 +val SCE_4GL_OPERATOR_=22 +val SCE_4GL_IDENTIFIER_=23 +val SCE_4GL_BLOCK_=24 +val SCE_4GL_END_=25 +val SCE_4GL_COMMENT1_=26 +val SCE_4GL_COMMENT2_=27 +val SCE_4GL_COMMENT3_=28 +val SCE_4GL_COMMENT4_=29 +val SCE_4GL_COMMENT5_=30 +val SCE_4GL_COMMENT6_=31 +# Lexical states for SCLEX_ABAQUS +lex ABAQUS=SCLEX_ABAQUS SCE_ABAQUS_ +val SCE_ABAQUS_DEFAULT=0 +val SCE_ABAQUS_COMMENT=1 +val SCE_ABAQUS_COMMENTBLOCK=2 +val SCE_ABAQUS_NUMBER=3 +val SCE_ABAQUS_STRING=4 +val SCE_ABAQUS_OPERATOR=5 +val SCE_ABAQUS_WORD=6 +val SCE_ABAQUS_PROCESSOR=7 +val SCE_ABAQUS_COMMAND=8 +val SCE_ABAQUS_SLASHCOMMAND=9 +val SCE_ABAQUS_STARCOMMAND=10 +val SCE_ABAQUS_ARGUMENT=11 +val SCE_ABAQUS_FUNCTION=12 +# Lexical states for SCLEX_ASYMPTOTE +lex Asymptote=SCLEX_ASYMPTOTE SCE_ASY_ +val SCE_ASY_DEFAULT=0 +val SCE_ASY_COMMENT=1 +val SCE_ASY_COMMENTLINE=2 +val SCE_ASY_NUMBER=3 +val SCE_ASY_WORD=4 +val SCE_ASY_STRING=5 +val SCE_ASY_CHARACTER=6 +val SCE_ASY_OPERATOR=7 +val SCE_ASY_IDENTIFIER=8 +val SCE_ASY_STRINGEOL=9 +val SCE_ASY_COMMENTLINEDOC=10 +val SCE_ASY_WORD2=11 +# Lexical states for SCLEX_R +lex R=SCLEX_R SCE_R_ +val SCE_R_DEFAULT=0 +val SCE_R_COMMENT=1 +val SCE_R_KWORD=2 +val SCE_R_BASEKWORD=3 +val SCE_R_OTHERKWORD=4 +val SCE_R_NUMBER=5 +val SCE_R_STRING=6 +val SCE_R_STRING2=7 +val SCE_R_OPERATOR=8 +val SCE_R_IDENTIFIER=9 +val SCE_R_INFIX=10 +val SCE_R_INFIXEOL=11 +# Lexical state for SCLEX_MAGIKSF +lex MagikSF=SCLEX_MAGIKSF SCE_MAGIK_ +val SCE_MAGIK_DEFAULT=0 +val SCE_MAGIK_COMMENT=1 +val SCE_MAGIK_HYPER_COMMENT=16 +val SCE_MAGIK_STRING=2 +val SCE_MAGIK_CHARACTER=3 +val SCE_MAGIK_NUMBER=4 +val SCE_MAGIK_IDENTIFIER=5 +val SCE_MAGIK_OPERATOR=6 +val SCE_MAGIK_FLOW=7 +val SCE_MAGIK_CONTAINER=8 +val SCE_MAGIK_BRACKET_BLOCK=9 +val SCE_MAGIK_BRACE_BLOCK=10 +val SCE_MAGIK_SQBRACKET_BLOCK=11 +val SCE_MAGIK_UNKNOWN_KEYWORD=12 +val SCE_MAGIK_KEYWORD=13 +val SCE_MAGIK_PRAGMA=14 +val SCE_MAGIK_SYMBOL=15 +# Lexical state for SCLEX_POWERSHELL +lex PowerShell=SCLEX_POWERSHELL SCE_POWERSHELL_ +val SCE_POWERSHELL_DEFAULT=0 +val SCE_POWERSHELL_COMMENT=1 +val SCE_POWERSHELL_STRING=2 +val SCE_POWERSHELL_CHARACTER=3 +val SCE_POWERSHELL_NUMBER=4 +val SCE_POWERSHELL_VARIABLE=5 +val SCE_POWERSHELL_OPERATOR=6 +val SCE_POWERSHELL_IDENTIFIER=7 +val SCE_POWERSHELL_KEYWORD=8 +val SCE_POWERSHELL_CMDLET=9 +val SCE_POWERSHELL_ALIAS=10 +# Lexical state for SCLEX_MYSQL +lex MySQL=SCLEX_MYSQL SCE_MYSQL_ +val SCE_MYSQL_DEFAULT=0 +val SCE_MYSQL_COMMENT=1 +val SCE_MYSQL_COMMENTLINE=2 +val SCE_MYSQL_VARIABLE=3 +val SCE_MYSQL_SYSTEMVARIABLE=4 +val SCE_MYSQL_KNOWNSYSTEMVARIABLE=5 +val SCE_MYSQL_NUMBER=6 +val SCE_MYSQL_MAJORKEYWORD=7 +val SCE_MYSQL_KEYWORD=8 +val SCE_MYSQL_DATABASEOBJECT=9 +val SCE_MYSQL_PROCEDUREKEYWORD=10 +val SCE_MYSQL_STRING=11 +val SCE_MYSQL_SQSTRING=12 +val SCE_MYSQL_DQSTRING=13 +val SCE_MYSQL_OPERATOR=14 +val SCE_MYSQL_FUNCTION=15 +val SCE_MYSQL_IDENTIFIER=16 +val SCE_MYSQL_QUOTEDIDENTIFIER=17 +val SCE_MYSQL_USER1=18 +val SCE_MYSQL_USER2=19 +val SCE_MYSQL_USER3=20 +val SCE_MYSQL_HIDDENCOMMAND=21 +# Lexical state for SCLEX_PO +lex Po=SCLEX_PO SCE_PO_ +val SCE_PO_DEFAULT=0 +val SCE_PO_COMMENT=1 +val SCE_PO_MSGID=2 +val SCE_PO_MSGID_TEXT=3 +val SCE_PO_MSGSTR=4 +val SCE_PO_MSGSTR_TEXT=5 +val SCE_PO_MSGCTXT=6 +val SCE_PO_MSGCTXT_TEXT=7 +val SCE_PO_FUZZY=8 +# Lexical states for SCLEX_PASCAL +lex Pascal=SCLEX_PASCAL SCE_PAS_ +val SCE_PAS_DEFAULT=0 +val SCE_PAS_IDENTIFIER=1 +val SCE_PAS_COMMENT=2 +val SCE_PAS_COMMENT2=3 +val SCE_PAS_COMMENTLINE=4 +val SCE_PAS_PREPROCESSOR=5 +val SCE_PAS_PREPROCESSOR2=6 +val SCE_PAS_NUMBER=7 +val SCE_PAS_HEXNUMBER=8 +val SCE_PAS_WORD=9 +val SCE_PAS_STRING=10 +val SCE_PAS_STRINGEOL=11 +val SCE_PAS_CHARACTER=12 +val SCE_PAS_OPERATOR=13 +val SCE_PAS_ASM=14 +# Lexical state for SCLEX_SORCUS +lex SORCUS=SCLEX_SORCUS SCE_SORCUS_ +val SCE_SORCUS_DEFAULT=0 +val SCE_SORCUS_COMMAND=1 +val SCE_SORCUS_PARAMETER=2 +val SCE_SORCUS_COMMENTLINE=3 +val SCE_SORCUS_STRING=4 +val SCE_SORCUS_STRINGEOL=5 +val SCE_SORCUS_IDENTIFIER=6 +val SCE_SORCUS_OPERATOR=7 +val SCE_SORCUS_NUMBER=8 +val SCE_SORCUS_CONSTANT=9 +# Lexical state for SCLEX_POWERPRO +lex PowerPro=SCLEX_POWERPRO SCE_POWERPRO_ +val SCE_POWERPRO_DEFAULT=0 +val SCE_POWERPRO_COMMENTBLOCK=1 +val SCE_POWERPRO_COMMENTLINE=2 +val SCE_POWERPRO_NUMBER=3 +val SCE_POWERPRO_WORD=4 +val SCE_POWERPRO_WORD2=5 +val SCE_POWERPRO_WORD3=6 +val SCE_POWERPRO_WORD4=7 +val SCE_POWERPRO_DOUBLEQUOTEDSTRING=8 +val SCE_POWERPRO_SINGLEQUOTEDSTRING=9 +val SCE_POWERPRO_LINECONTINUE=10 +val SCE_POWERPRO_OPERATOR=11 +val SCE_POWERPRO_IDENTIFIER=12 +val SCE_POWERPRO_STRINGEOL=13 +val SCE_POWERPRO_VERBATIM=14 +val SCE_POWERPRO_ALTQUOTE=15 +val SCE_POWERPRO_FUNCTION=16 +# Lexical states for SCLEX_SML +lex SML=SCLEX_SML SCE_SML_ +val SCE_SML_DEFAULT=0 +val SCE_SML_IDENTIFIER=1 +val SCE_SML_TAGNAME=2 +val SCE_SML_KEYWORD=3 +val SCE_SML_KEYWORD2=4 +val SCE_SML_KEYWORD3=5 +val SCE_SML_LINENUM=6 +val SCE_SML_OPERATOR=7 +val SCE_SML_NUMBER=8 +val SCE_SML_CHAR=9 +val SCE_SML_STRING=11 +val SCE_SML_COMMENT=12 +val SCE_SML_COMMENT1=13 +val SCE_SML_COMMENT2=14 +val SCE_SML_COMMENT3=15 + +# Events + +evt void StyleNeeded=2000(int position) +evt void CharAdded=2001(int ch) +evt void SavePointReached=2002(void) +evt void SavePointLeft=2003(void) +evt void ModifyAttemptRO=2004(void) +# GTK+ Specific to work around focus and accelerator problems: +evt void Key=2005(int ch, int modifiers) +evt void DoubleClick=2006(void) +evt void UpdateUI=2007(void) +evt void Modified=2008(int position, int modificationType, string text, int length, int linesAdded, int line, int foldLevelNow, int foldLevelPrev) +evt void MacroRecord=2009(int message, int wParam, int lParam) +evt void MarginClick=2010(int modifiers, int position, int margin) +evt void NeedShown=2011(int position, int length) +evt void Painted=2013(void) +evt void UserListSelection=2014(int listType, string text) +evt void URIDropped=2015(string text) +evt void DwellStart=2016(int position) +evt void DwellEnd=2017(int position) +evt void Zoom=2018(void) +evt void HotSpotClick=2019(int modifiers, int position) +evt void HotSpotDoubleClick=2020(int modifiers, int position) +evt void CallTipClick=2021(int position) +evt void AutoCSelection=2022(string text) +evt void IndicatorClick=2023(int modifiers, int position) +evt void IndicatorRelease=2024(int modifiers, int position) +evt void AutoCCancelled=2025(void) +evt void AutoCCharDeleted=2026(void) diff --git a/sdk/wxscintilla/src/scintilla/include/ScintillaWidget.h b/sdk/wxscintilla/src/scintilla/include/ScintillaWidget.h index d990952419..c60c4a21b9 100644 --- a/sdk/wxscintilla/src/scintilla/include/ScintillaWidget.h +++ b/sdk/wxscintilla/src/scintilla/include/ScintillaWidget.h @@ -1,59 +1,59 @@ -// Scintilla source code edit control -/** @file ScintillaWidget.h - ** Definition of Scintilla widget for GTK+. - ** Only needed by GTK+ code but is harmless on other platforms. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef SCINTILLAWIDGET_H -#define SCINTILLAWIDGET_H - -#if PLAT_GTK - -#ifdef __cplusplus -extern "C" { -#endif - -#define SCINTILLA(obj) GTK_CHECK_CAST (obj, scintilla_get_type (), ScintillaObject) -#define SCINTILLA_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, scintilla_get_type (), ScintillaClass) -#define IS_SCINTILLA(obj) GTK_CHECK_TYPE (obj, scintilla_get_type ()) - -typedef struct _ScintillaObject ScintillaObject; -typedef struct _ScintillaClass ScintillaClass; - -struct _ScintillaObject { - GtkContainer cont; - void *pscin; -}; - -struct _ScintillaClass { - GtkContainerClass parent_class; - - void (* command) (ScintillaObject *ttt); - void (* notify) (ScintillaObject *ttt); -}; - -#if GLIB_MAJOR_VERSION < 2 -GtkType scintilla_get_type (void); -#else -GType scintilla_get_type (void); -#endif -GtkWidget* scintilla_new (void); -void scintilla_set_id (ScintillaObject *sci, uptr_t id); -sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam); -void scintilla_release_resources(void); - -#if GTK_MAJOR_VERSION < 2 -#define SCINTILLA_NOTIFY "notify" -#else -#define SCINTILLA_NOTIFY "sci-notify" -#endif - -#ifdef __cplusplus -} -#endif - -#endif - -#endif +/* Scintilla source code edit control */ +/** @file ScintillaWidget.h + ** Definition of Scintilla widget for GTK+. + ** Only needed by GTK+ code but is harmless on other platforms. + **/ +/* Copyright 1998-2001 by Neil Hodgson + * The License.txt file describes the conditions under which this software may be distributed. */ + +#ifndef SCINTILLAWIDGET_H +#define SCINTILLAWIDGET_H + +#if PLAT_GTK + +#ifdef __cplusplus +extern "C" { +#endif + +#define SCINTILLA(obj) GTK_CHECK_CAST (obj, scintilla_get_type (), ScintillaObject) +#define SCINTILLA_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, scintilla_get_type (), ScintillaClass) +#define IS_SCINTILLA(obj) GTK_CHECK_TYPE (obj, scintilla_get_type ()) + +typedef struct _ScintillaObject ScintillaObject; +typedef struct _ScintillaClass ScintillaClass; + +struct _ScintillaObject { + GtkContainer cont; + void *pscin; +}; + +struct _ScintillaClass { + GtkContainerClass parent_class; + + void (* command) (ScintillaObject *ttt); + void (* notify) (ScintillaObject *ttt); +}; + +#if GLIB_MAJOR_VERSION < 2 +GtkType scintilla_get_type (void); +#else +GType scintilla_get_type (void); +#endif +GtkWidget* scintilla_new (void); +void scintilla_set_id (ScintillaObject *sci, uptr_t id); +sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam); +void scintilla_release_resources(void); + +#if GTK_MAJOR_VERSION < 2 +#define SCINTILLA_NOTIFY "notify" +#else +#define SCINTILLA_NOTIFY "sci-notify" +#endif + +#ifdef __cplusplus +} +#endif + +#endif + +#endif diff --git a/sdk/wxscintilla/src/scintilla/include/WindowAccessor.h b/sdk/wxscintilla/src/scintilla/include/WindowAccessor.h index 6724e8410b..6f265f6580 100644 --- a/sdk/wxscintilla/src/scintilla/include/WindowAccessor.h +++ b/sdk/wxscintilla/src/scintilla/include/WindowAccessor.h @@ -1,66 +1,67 @@ -// Scintilla source code edit control -/** @file WindowAccessor.h - ** Implementation of BufferAccess and StylingAccess on a Scintilla - ** rapid easy access to contents of a Scintilla. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -/** - */ -class WindowAccessor : public Accessor { - // Private so WindowAccessor objects can not be copied - WindowAccessor(const WindowAccessor &source) : Accessor(), props(source.props) {} - WindowAccessor &operator=(const WindowAccessor &) { return *this; } -protected: - WindowID id; - PropSet &props; - int lenDoc; - - char styleBuf[bufferSize]; - int validLen; - char chFlags; - char chWhile; - unsigned int startSeg; - - bool InternalIsLeadByte(char ch); - void Fill(int position); -public: - WindowAccessor(WindowID id_, PropSet &props_) : - Accessor(), id(id_), props(props_), - lenDoc(-1), validLen(0), chFlags(0), chWhile(0) { - } - ~WindowAccessor(); - bool Match(int pos, const char *s); - char StyleAt(int position); - int GetLine(int position); - int LineStart(int line); - int LevelAt(int line); - int Length(); - void Flush(); - int GetLineState(int line); - int SetLineState(int line, int state); - int GetPropertyInt(const char *key, int defaultValue=0) { - return props.GetInt(key, defaultValue); - } - char *GetProperties() { - return props.ToString(); - } - - void StartAt(unsigned int start, char chMask=31); - void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }; - unsigned int GetStartSegment() { return startSeg; } - void StartSegment(unsigned int pos); - void ColourTo(unsigned int pos, int chAttr); - void SetLevel(int line, int level); - int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); - void IndicatorFill(int start, int end, int indicator, int value); -}; - -#ifdef SCI_NAMESPACE -} -#endif +// Scintilla source code edit control +/** @file WindowAccessor.h + ** Implementation of BufferAccess and StylingAccess on a Scintilla + ** rapid easy access to contents of a Scintilla. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +/** + */ + +class WindowAccessor : public Accessor { + // Private so WindowAccessor objects can not be copied + WindowAccessor(const WindowAccessor &source) : Accessor(), props(source.props) {} + WindowAccessor &operator=(const WindowAccessor &) { return *this; } +protected: + WindowID id; + PropertyGet &props; + int lenDoc; + + char styleBuf[bufferSize]; + int validLen; + char chFlags; + char chWhile; + unsigned int startSeg; + + bool InternalIsLeadByte(char ch); + void Fill(int position); +public: + WindowAccessor(WindowID id_, PropertyGet &props_) : + Accessor(), id(id_), props(props_), + lenDoc(-1), validLen(0), chFlags(0), chWhile(0) { + } + ~WindowAccessor(); + bool Match(int pos, const char *s); + char StyleAt(int position); + int GetLine(int position); + int LineStart(int line); + int LevelAt(int line); + int Length(); + void Flush(); + int GetLineState(int line); + int SetLineState(int line, int state); + int GetPropertyInt(const char *key, int defaultValue=0) { + return props.GetInt(key, defaultValue); + } + char *GetProperties() { + return props.ToString(); + } + + void StartAt(unsigned int start, char chMask=31); + void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }; + unsigned int GetStartSegment() { return startSeg; } + void StartSegment(unsigned int pos); + void ColourTo(unsigned int pos, int chAttr); + void SetLevel(int line, int level); + int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); + void IndicatorFill(int start, int end, int indicator, int value); +}; + +#ifdef SCI_NAMESPACE +} +#endif diff --git a/sdk/wxscintilla/src/scintilla/src/AutoComplete.cxx b/sdk/wxscintilla/src/scintilla/src/AutoComplete.cxx index 0cd5b36e80..86c64df563 100644 --- a/sdk/wxscintilla/src/scintilla/src/AutoComplete.cxx +++ b/sdk/wxscintilla/src/scintilla/src/AutoComplete.cxx @@ -1,178 +1,178 @@ -// Scintilla source code edit control -/** @file AutoComplete.cxx - ** Defines the auto completion list box. - **/ -// Copyright 1998-2003 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include - -#include "Platform.h" - -#include "PropSet.h" -#include "AutoComplete.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -AutoComplete::AutoComplete() : - active(false), - separator(' '), - typesep('?'), - ignoreCase(false), - chooseSingle(false), - lb(0), - posStart(0), - startLen(0), - cancelAtStartPos(true), - autoHide(true), - dropRestOfWord(false) { - lb = ListBox::Allocate(); - stopChars[0] = '\0'; - fillUpChars[0] = '\0'; -} - -AutoComplete::~AutoComplete() { - if (lb) { - lb->Destroy(); - delete lb; - lb = 0; - } -} - -bool AutoComplete::Active() { - return active; -} - -void AutoComplete::Start(Window &parent, int ctrlID, - int position, Point location, int startLen_, - int lineHeight, bool unicodeMode) { - if (active) { - Cancel(); - } - lb->Create(parent, ctrlID, location, lineHeight, unicodeMode); - lb->Clear(); - active = true; - startLen = startLen_; - posStart = position; -} - -void AutoComplete::SetStopChars(const char *stopChars_) { - strncpy(stopChars, stopChars_, sizeof(stopChars)); - stopChars[sizeof(stopChars) - 1] = '\0'; -} - -bool AutoComplete::IsStopChar(char ch) { - return ch && strchr(stopChars, ch); -} - -void AutoComplete::SetFillUpChars(const char *fillUpChars_) { - strncpy(fillUpChars, fillUpChars_, sizeof(fillUpChars)); - fillUpChars[sizeof(fillUpChars) - 1] = '\0'; -} - -bool AutoComplete::IsFillUpChar(char ch) { - return ch && strchr(fillUpChars, ch); -} - -void AutoComplete::SetSeparator(char separator_) { - separator = separator_; -} - -char AutoComplete::GetSeparator() { - return separator; -} - -void AutoComplete::SetTypesep(char separator_) { - typesep = separator_; -} - -char AutoComplete::GetTypesep() { - return typesep; -} - -void AutoComplete::SetList(const char *list) { - lb->SetList(list, separator, typesep); -} - -void AutoComplete::Show(bool show) { - lb->Show(show); - if (show) - lb->Select(0); -} - -void AutoComplete::Cancel() { - if (lb->Created()) { - lb->Clear(); - lb->Destroy(); - active = false; - } -} - - -void AutoComplete::Move(int delta) { - int count = lb->Length(); - int current = lb->GetSelection(); - current += delta; - if (current >= count) - current = count - 1; - if (current < 0) - current = 0; - lb->Select(current); -} - -void AutoComplete::Select(const char *word) { - size_t lenWord = strlen(word); - int location = -1; - const int maxItemLen=1000; - char item[maxItemLen]; - int start = 0; // lower bound of the api array block to search - int end = lb->Length() - 1; // upper bound of the api array block to search - while ((start <= end) && (location == -1)) { // Binary searching loop - int pivot = (start + end) / 2; - lb->GetValue(pivot, item, maxItemLen); - int cond; - if (ignoreCase) - cond = CompareNCaseInsensitive(word, item, lenWord); - else - cond = strncmp(word, item, lenWord); - if (!cond) { - // Find first match - while (pivot > start) { - lb->GetValue(pivot-1, item, maxItemLen); - if (ignoreCase) - cond = CompareNCaseInsensitive(word, item, lenWord); - else - cond = strncmp(word, item, lenWord); - if (0 != cond) - break; - --pivot; - } - location = pivot; - if (ignoreCase) { - // Check for exact-case match - for (; pivot <= end; pivot++) { - lb->GetValue(pivot, item, maxItemLen); - if (!strncmp(word, item, lenWord)) { - location = pivot; - break; - } - if (CompareNCaseInsensitive(word, item, lenWord)) - break; - } - } - } else if (cond < 0) { - end = pivot - 1; - } else if (cond > 0) { - start = pivot + 1; - } - } - if (location == -1 && autoHide) - Cancel(); - else - lb->Select(location); -} - +// Scintilla source code edit control +/** @file AutoComplete.cxx + ** Defines the auto completion list box. + **/ +// Copyright 1998-2003 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include + +#include "Platform.h" + +#include "CharClassify.h" +#include "AutoComplete.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +AutoComplete::AutoComplete() : + active(false), + separator(' '), + typesep('?'), + ignoreCase(false), + chooseSingle(false), + lb(0), + posStart(0), + startLen(0), + cancelAtStartPos(true), + autoHide(true), + dropRestOfWord(false) { + lb = ListBox::Allocate(); + stopChars[0] = '\0'; + fillUpChars[0] = '\0'; +} + +AutoComplete::~AutoComplete() { + if (lb) { + lb->Destroy(); + delete lb; + lb = 0; + } +} + +bool AutoComplete::Active() { + return active; +} + +void AutoComplete::Start(Window &parent, int ctrlID, + int position, Point location, int startLen_, + int lineHeight, bool unicodeMode) { + if (active) { + Cancel(); + } + lb->Create(parent, ctrlID, location, lineHeight, unicodeMode); + lb->Clear(); + active = true; + startLen = startLen_; + posStart = position; +} + +void AutoComplete::SetStopChars(const char *stopChars_) { + strncpy(stopChars, stopChars_, sizeof(stopChars)); + stopChars[sizeof(stopChars) - 1] = '\0'; +} + +bool AutoComplete::IsStopChar(char ch) { + return ch && strchr(stopChars, ch); +} + +void AutoComplete::SetFillUpChars(const char *fillUpChars_) { + strncpy(fillUpChars, fillUpChars_, sizeof(fillUpChars)); + fillUpChars[sizeof(fillUpChars) - 1] = '\0'; +} + +bool AutoComplete::IsFillUpChar(char ch) { + return ch && strchr(fillUpChars, ch); +} + +void AutoComplete::SetSeparator(char separator_) { + separator = separator_; +} + +char AutoComplete::GetSeparator() { + return separator; +} + +void AutoComplete::SetTypesep(char separator_) { + typesep = separator_; +} + +char AutoComplete::GetTypesep() { + return typesep; +} + +void AutoComplete::SetList(const char *list) { + lb->SetList(list, separator, typesep); +} + +void AutoComplete::Show(bool show) { + lb->Show(show); + if (show) + lb->Select(0); +} + +void AutoComplete::Cancel() { + if (lb->Created()) { + lb->Clear(); + lb->Destroy(); + active = false; + } +} + + +void AutoComplete::Move(int delta) { + int count = lb->Length(); + int current = lb->GetSelection(); + current += delta; + if (current >= count) + current = count - 1; + if (current < 0) + current = 0; + lb->Select(current); +} + +void AutoComplete::Select(const char *word) { + size_t lenWord = strlen(word); + int location = -1; + const int maxItemLen=1000; + char item[maxItemLen]; + int start = 0; // lower bound of the api array block to search + int end = lb->Length() - 1; // upper bound of the api array block to search + while ((start <= end) && (location == -1)) { // Binary searching loop + int pivot = (start + end) / 2; + lb->GetValue(pivot, item, maxItemLen); + int cond; + if (ignoreCase) + cond = CompareNCaseInsensitive(word, item, lenWord); + else + cond = strncmp(word, item, lenWord); + if (!cond) { + // Find first match + while (pivot > start) { + lb->GetValue(pivot-1, item, maxItemLen); + if (ignoreCase) + cond = CompareNCaseInsensitive(word, item, lenWord); + else + cond = strncmp(word, item, lenWord); + if (0 != cond) + break; + --pivot; + } + location = pivot; + if (ignoreCase) { + // Check for exact-case match + for (; pivot <= end; pivot++) { + lb->GetValue(pivot, item, maxItemLen); + if (!strncmp(word, item, lenWord)) { + location = pivot; + break; + } + if (CompareNCaseInsensitive(word, item, lenWord)) + break; + } + } + } else if (cond < 0) { + end = pivot - 1; + } else if (cond > 0) { + start = pivot + 1; + } + } + if (location == -1 && autoHide) + Cancel(); + else + lb->Select(location); +} + diff --git a/sdk/wxscintilla/src/scintilla/src/AutoComplete.h b/sdk/wxscintilla/src/scintilla/src/AutoComplete.h index 0a38d80e2d..b10cdce82f 100644 --- a/sdk/wxscintilla/src/scintilla/src/AutoComplete.h +++ b/sdk/wxscintilla/src/scintilla/src/AutoComplete.h @@ -1,78 +1,78 @@ -// Scintilla source code edit control -/** @file AutoComplete.h - ** Defines the auto completion list box. - **/ -// Copyright 1998-2003 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef AUTOCOMPLETE_H -#define AUTOCOMPLETE_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -/** - */ -class AutoComplete { - bool active; - char stopChars[256]; - char fillUpChars[256]; - char separator; - char typesep; // Type seperator - -public: - bool ignoreCase; - bool chooseSingle; - ListBox *lb; - int posStart; - int startLen; - /// Should autocompletion be canceled if editor's currentPos <= startPos? - bool cancelAtStartPos; - bool autoHide; - bool dropRestOfWord; - - AutoComplete(); - ~AutoComplete(); - - /// Is the auto completion list displayed? - bool Active(); - - /// Display the auto completion list positioned to be near a character position - void Start(Window &parent, int ctrlID, int position, Point location, - int startLen_, int lineHeight, bool unicodeMode); - - /// The stop chars are characters which, when typed, cause the auto completion list to disappear - void SetStopChars(const char *stopChars_); - bool IsStopChar(char ch); - - /// The fillup chars are characters which, when typed, fill up the selected word - void SetFillUpChars(const char *fillUpChars_); - bool IsFillUpChar(char ch); - - /// The separator character is used when interpreting the list in SetList - void SetSeparator(char separator_); - char GetSeparator(); - - /// The typesep character is used for seperating the word from the type - void SetTypesep(char separator_); - char GetTypesep(); - - /// The list string contains a sequence of words separated by the separator character - void SetList(const char *list); - - void Show(bool show); - void Cancel(); - - /// Move the current list element by delta, scrolling appropriately - void Move(int delta); - - /// Select a list element that starts with word as the current element - void Select(const char *word); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif +// Scintilla source code edit control +/** @file AutoComplete.h + ** Defines the auto completion list box. + **/ +// Copyright 1998-2003 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef AUTOCOMPLETE_H +#define AUTOCOMPLETE_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +/** + */ +class AutoComplete { + bool active; + char stopChars[256]; + char fillUpChars[256]; + char separator; + char typesep; // Type seperator + +public: + bool ignoreCase; + bool chooseSingle; + ListBox *lb; + int posStart; + int startLen; + /// Should autocompletion be canceled if editor's currentPos <= startPos? + bool cancelAtStartPos; + bool autoHide; + bool dropRestOfWord; + + AutoComplete(); + ~AutoComplete(); + + /// Is the auto completion list displayed? + bool Active(); + + /// Display the auto completion list positioned to be near a character position + void Start(Window &parent, int ctrlID, int position, Point location, + int startLen_, int lineHeight, bool unicodeMode); + + /// The stop chars are characters which, when typed, cause the auto completion list to disappear + void SetStopChars(const char *stopChars_); + bool IsStopChar(char ch); + + /// The fillup chars are characters which, when typed, fill up the selected word + void SetFillUpChars(const char *fillUpChars_); + bool IsFillUpChar(char ch); + + /// The separator character is used when interpreting the list in SetList + void SetSeparator(char separator_); + char GetSeparator(); + + /// The typesep character is used for seperating the word from the type + void SetTypesep(char separator_); + char GetTypesep(); + + /// The list string contains a sequence of words separated by the separator character + void SetList(const char *list); + + void Show(bool show); + void Cancel(); + + /// Move the current list element by delta, scrolling appropriately + void Move(int delta); + + /// Select a list element that starts with word as the current element + void Select(const char *word); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/sdk/wxscintilla/src/scintilla/src/CallTip.cxx b/sdk/wxscintilla/src/scintilla/src/CallTip.cxx index 82d1227644..15bce03ec6 100644 --- a/sdk/wxscintilla/src/scintilla/src/CallTip.cxx +++ b/sdk/wxscintilla/src/scintilla/src/CallTip.cxx @@ -1,332 +1,326 @@ -// Scintilla source code edit control -/** @file CallTip.cxx - ** Code for displaying call tips. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include - -#include "Platform.h" - -#include "Scintilla.h" -#include "CallTip.h" -#include - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -static const int insetX = 5; // text inset in x from calltip border -static const int widthArrow = 14; - -CallTip::CallTip() { - wCallTip = 0; - inCallTipMode = false; - posStartCallTip = 0; - val = 0; - rectUp = PRectangle(0,0,0,0); - rectDown = PRectangle(0,0,0,0); - lineHeight = 1; - startHighlight = 0; - endHighlight = 0; - tabSize = 0; - useStyleCallTip = true; // for backwards compatibility - -#ifdef __APPLE__ - // proper apple colours for the default - colourBG.desired = ColourDesired(0xff, 0xff, 0xc6); - colourUnSel.desired = ColourDesired(0, 0, 0); -#else - colourBG.desired = ColourDesired(0xff, 0xff, 0xff); - colourUnSel.desired = ColourDesired(0x80, 0x80, 0x80); -#endif - colourSel.desired = ColourDesired(0, 0, 0x80); - colourShade.desired = ColourDesired(0, 0, 0); - colourLight.desired = ColourDesired(0xc0, 0xc0, 0xc0); -} - -CallTip::~CallTip() { - font.Release(); - wCallTip.Destroy(); - delete []val; - val = 0; -} - -void CallTip::RefreshColourPalette(Palette &pal, bool want) { - pal.WantFind(colourBG, want); - pal.WantFind(colourUnSel, want); - pal.WantFind(colourSel, want); - pal.WantFind(colourShade, want); - pal.WantFind(colourLight, want); -} - -// Although this test includes 0, we should never see a \0 character. -static bool IsArrowCharacter(char ch) { - return (ch == 0) || (ch == '\001') || (ch == '\002'); -} - -// We ignore tabs unless a tab width has been set. -bool CallTip::IsTabCharacter(char ch) { - return (tabSize > 0) && (ch == '\t'); -} - -int CallTip::NextTabPos(int x) { - if (tabSize > 0) { // paranoia... not called unless this is true - x -= insetX; // position relative to text - x = (x + tabSize) / tabSize; // tab "number" - return tabSize*x + insetX; // position of next tab - } else { - return x + 1; // arbitrary - } -} - -// Draw a section of the call tip that does not include \n in one colour. -// The text may include up to numEnds tabs or arrow characters. -void CallTip::DrawChunk(Surface *surface, int &x, const char *s, - int posStart, int posEnd, int ytext, PRectangle rcClient, - bool highlight, bool draw) { - s += posStart; - int len = posEnd - posStart; - - // Divide the text into sections that are all text, or that are - // single arrows or single tab characters (if tabSize > 0). - int maxEnd = 0; - const int numEnds = 10; - int ends[numEnds + 2]; - for (int i=0;i 0) - ends[maxEnd++] = i; - ends[maxEnd++] = i+1; - } - } - ends[maxEnd++] = len; - int startSeg = 0; - int xEnd; - for (int seg = 0; seg startSeg) { - if (IsArrowCharacter(s[startSeg])) { - bool upArrow = s[startSeg] == '\001'; - rcClient.left = x; - rcClient.right = rcClient.left + widthArrow; - if (draw) { - const int halfWidth = widthArrow / 2 - 3; - const int centreX = rcClient.left + widthArrow / 2 - 1; - const int centreY = (rcClient.top + rcClient.bottom) / 2; -// surface->FillRectangle(rcClient, colourBG.allocated); -// PRectangle rcClientInner(rcClient.left + 1, rcClient.top + 1, -// rcClient.right - 2, rcClient.bottom - 1); -// surface->FillRectangle(rcClientInner, colourUnSel.allocated); - - if (upArrow) { // Up arrow - Point pts[] = { - Point(centreX - halfWidth, centreY + halfWidth / 2), - Point(centreX + halfWidth, centreY + halfWidth / 2), - Point(centreX, centreY - halfWidth + halfWidth / 2), - }; - surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), - colourUnSel.allocated, colourUnSel.allocated); - } else { // Down arrow - Point pts[] = { - Point(centreX - halfWidth, centreY - halfWidth / 2), - Point(centreX + halfWidth, centreY - halfWidth / 2), - Point(centreX, centreY + halfWidth - halfWidth / 2), - }; - surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), - colourUnSel.allocated, colourUnSel.allocated); - } - } - xEnd = rcClient.right; - offsetMain = xEnd; - if (upArrow) { - rectUp = rcClient; - } else { - rectDown = rcClient; - } - } else if (IsTabCharacter(s[startSeg])) { - xEnd = NextTabPos(x); - } else { - ColourDesired hltBgCol((unsigned int)170, (unsigned int)255, (unsigned int)170); - xEnd = x + surface->WidthText(font, s + startSeg, endSeg - startSeg); - if (draw) { - rcClient.left = x; - rcClient.right = xEnd; - - PRectangle rr = rcClient; - rr.top += 1; - surface->DrawTextNoClip(rr, font, ytext, - s+startSeg, endSeg - startSeg, - highlight ? colourSel.allocated : colourUnSel.allocated, - highlight ? hltBgCol.AsLong() : colourBG.allocated); - } - } - x = xEnd; - startSeg = endSeg; - } - } -} - -int CallTip::PaintContents(Surface *surfaceWindow, bool draw) { - PRectangle rcClientPos = wCallTip.GetClientPosition(); - PRectangle rcClientSize(0, 0, rcClientPos.right - rcClientPos.left, - rcClientPos.bottom - rcClientPos.top); - PRectangle rcClient(1, 1, rcClientSize.right - 1, rcClientSize.bottom - 1); - - // To make a nice small call tip window, it is only sized to fit most normal characters without accents - int ascent = surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font); - - // For each line... - // Draw the definition in three parts: before highlight, highlighted, after highlight - int ytext = rcClient.top + ascent + 1; - rcClient.bottom = ytext + surfaceWindow->Descent(font) + 1; - char *chunkVal = val; - bool moreChunks = true; - int maxWidth = 0; - - while (moreChunks) { - char *chunkEnd = strchr(chunkVal, '\n'); - if (chunkEnd == NULL) { - chunkEnd = chunkVal + strlen(chunkVal); - moreChunks = false; - } - int chunkOffset = chunkVal - val; - int chunkLength = chunkEnd - chunkVal; - int chunkEndOffset = chunkOffset + chunkLength; - int thisStartHighlight = Platform::Maximum(startHighlight, chunkOffset); - thisStartHighlight = Platform::Minimum(thisStartHighlight, chunkEndOffset); - thisStartHighlight -= chunkOffset; - int thisEndHighlight = Platform::Maximum(endHighlight, chunkOffset); - thisEndHighlight = Platform::Minimum(thisEndHighlight, chunkEndOffset); - thisEndHighlight -= chunkOffset; - rcClient.top = ytext - ascent - 1; - - int x = insetX; // start each line at this inset - - DrawChunk(surfaceWindow, x, chunkVal, 0, thisStartHighlight, - ytext, rcClient, false, draw); - DrawChunk(surfaceWindow, x, chunkVal, thisStartHighlight, thisEndHighlight, - ytext, rcClient, true, draw); - DrawChunk(surfaceWindow, x, chunkVal, thisEndHighlight, chunkLength, - ytext, rcClient, false, draw); - - chunkVal = chunkEnd + 1; - ytext += lineHeight; - rcClient.bottom += lineHeight; - maxWidth = Platform::Maximum(maxWidth, x); - } - return maxWidth; -} - -void CallTip::PaintCT(Surface *surfaceWindow) { - if (!val) - return; - PRectangle rcClientPos = wCallTip.GetClientPosition(); - PRectangle rcClientSize(0, 0, rcClientPos.right - rcClientPos.left, - rcClientPos.bottom - rcClientPos.top); - PRectangle rcClient(1, 1, rcClientSize.right - 1, rcClientSize.bottom - 1); - - surfaceWindow->FillRectangle(rcClient, colourBG.allocated); - - offsetMain = insetX; // initial alignment assuming no arrows - PaintContents(surfaceWindow, true); - - // OSX doesn't put borders on "help tags" - // Draw a raised border around the edges of the window - surfaceWindow->MoveTo(0, rcClientSize.bottom - 1); - surfaceWindow->PenColour(colourLight.allocated); - surfaceWindow->LineTo(rcClientSize.right - 1, rcClientSize.bottom - 1); - surfaceWindow->LineTo(rcClientSize.right - 1, 0); - surfaceWindow->LineTo(0, 0); - surfaceWindow->LineTo(0, rcClientSize.bottom - 1); - -} - -void CallTip::MouseClick(Point pt) { - clickPlace = 0; - if (rectUp.Contains(pt)) - clickPlace = 1; - if (rectDown.Contains(pt)) - clickPlace = 2; -} - -PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn, - const char *faceName, int size, - int codePage_, int characterSet, Window &wParent) { - clickPlace = 0; - if (val) - delete []val; - val = new char[strlen(defn) + 1]; - if (!val) - return PRectangle(); - strcpy(val, defn); - codePage = codePage_; - Surface *surfaceMeasure = Surface::Allocate(); - if (!surfaceMeasure) - return PRectangle(); - surfaceMeasure->Init(wParent.GetID()); - surfaceMeasure->SetUnicodeMode(SC_CP_UTF8 == codePage); - surfaceMeasure->SetDBCSMode(codePage); - startHighlight = 0; - endHighlight = 0; - inCallTipMode = true; - posStartCallTip = pos; - int deviceHeight = surfaceMeasure->DeviceHeightFont(size); - font.Create(faceName, characterSet, deviceHeight, false, false); - // Look for multiple lines in the text - // Only support \n here - simply means container must avoid \r! - int numLines = 1; - const char *newline; - const char *look = val; - rectUp = PRectangle(0,0,0,0); - rectDown = PRectangle(0,0,0,0); - offsetMain = insetX; // changed to right edge of any arrows - int width = PaintContents(surfaceMeasure, false) + insetX; - while ((newline = strchr(look, '\n')) != NULL) { - look = newline + 1; - numLines++; - } - lineHeight = surfaceMeasure->Height(font); - - // Extra line for border and an empty line at top and bottom. The returned - // rectangle is aligned to the right edge of the last arrow encountered in - // the tip text, else to the tip text left edge. - int height = lineHeight * numLines - surfaceMeasure->InternalLeading(font) + 2 + 2; - delete surfaceMeasure; - return PRectangle(pt.x - offsetMain, pt.y + 1, pt.x + width - offsetMain, pt.y + 1 + height); -} - -void CallTip::CallTipCancel() { - inCallTipMode = false; - if (wCallTip.Created()) { - wCallTip.Destroy(); - } -} - -void CallTip::SetHighlight(int start, int end) { - // Avoid flashing by checking something has really changed - if ((start != startHighlight) || (end != endHighlight)) { - startHighlight = start; - endHighlight = end; - if (wCallTip.Created()) { - wCallTip.InvalidateAll(); - } - } -} - -// Set the tab size (sizes > 0 enable the use of tabs). This also enables the -// use of the STYLE_CALLTIP. -void CallTip::SetTabSize(int tabSz) { - tabSize = tabSz; - useStyleCallTip = true; -} - -// It might be better to have two access functions for this and to use -// them for all settings of colours. -void CallTip::SetForeBack(const ColourPair &fore, const ColourPair &back) { - colourBG = back; - colourUnSel = fore; -} +// Scintilla source code edit control +/** @file CallTip.cxx + ** Code for displaying call tips. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include + +#include "Platform.h" + +#include "Scintilla.h" +#include "CallTip.h" +#include + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static const int insetX = 5; // text inset in x from calltip border +static const int widthArrow = 14; + +CallTip::CallTip() { + wCallTip = 0; + inCallTipMode = false; + posStartCallTip = 0; + val = 0; + rectUp = PRectangle(0,0,0,0); + rectDown = PRectangle(0,0,0,0); + lineHeight = 1; + startHighlight = 0; + endHighlight = 0; + tabSize = 0; + useStyleCallTip = false; // for backwards compatibility + +#ifdef __APPLE__ + // proper apple colours for the default + colourBG.desired = ColourDesired(0xff, 0xff, 0xc6); + colourUnSel.desired = ColourDesired(0, 0, 0); +#else + colourBG.desired = ColourDesired(0xff, 0xff, 0xff); + colourUnSel.desired = ColourDesired(0x80, 0x80, 0x80); +#endif + colourSel.desired = ColourDesired(0, 0, 0x80); + colourShade.desired = ColourDesired(0, 0, 0); + colourLight.desired = ColourDesired(0xc0, 0xc0, 0xc0); +} + +CallTip::~CallTip() { + font.Release(); + wCallTip.Destroy(); + delete []val; + val = 0; +} + +void CallTip::RefreshColourPalette(Palette &pal, bool want) { + pal.WantFind(colourBG, want); + pal.WantFind(colourUnSel, want); + pal.WantFind(colourSel, want); + pal.WantFind(colourShade, want); + pal.WantFind(colourLight, want); +} + +// Although this test includes 0, we should never see a \0 character. +static bool IsArrowCharacter(char ch) { + return (ch == 0) || (ch == '\001') || (ch == '\002'); +} + +// We ignore tabs unless a tab width has been set. +bool CallTip::IsTabCharacter(char ch) { + return (tabSize > 0) && (ch == '\t'); +} + +int CallTip::NextTabPos(int x) { + if (tabSize > 0) { // paranoia... not called unless this is true + x -= insetX; // position relative to text + x = (x + tabSize) / tabSize; // tab "number" + return tabSize*x + insetX; // position of next tab + } else { + return x + 1; // arbitrary + } +} + +// Draw a section of the call tip that does not include \n in one colour. +// The text may include up to numEnds tabs or arrow characters. +void CallTip::DrawChunk(Surface *surface, int &x, const char *s, + int posStart, int posEnd, int ytext, PRectangle rcClient, + bool highlight, bool draw) { + s += posStart; + int len = posEnd - posStart; + + // Divide the text into sections that are all text, or that are + // single arrows or single tab characters (if tabSize > 0). + int maxEnd = 0; + const int numEnds = 10; + int ends[numEnds + 2]; + for (int i=0;i 0) + ends[maxEnd++] = i; + ends[maxEnd++] = i+1; + } + } + ends[maxEnd++] = len; + int startSeg = 0; + int xEnd; + for (int seg = 0; seg startSeg) { + if (IsArrowCharacter(s[startSeg])) { + bool upArrow = s[startSeg] == '\001'; + rcClient.left = x; + rcClient.right = rcClient.left + widthArrow; + if (draw) { + const int halfWidth = widthArrow / 2 - 3; + const int centreX = rcClient.left + widthArrow / 2 - 1; + const int centreY = (rcClient.top + rcClient.bottom) / 2; + surface->FillRectangle(rcClient, colourBG.allocated); + PRectangle rcClientInner(rcClient.left + 1, rcClient.top + 1, + rcClient.right - 2, rcClient.bottom - 1); + surface->FillRectangle(rcClientInner, colourUnSel.allocated); + + if (upArrow) { // Up arrow + Point pts[] = { + Point(centreX - halfWidth, centreY + halfWidth / 2), + Point(centreX + halfWidth, centreY + halfWidth / 2), + Point(centreX, centreY - halfWidth + halfWidth / 2), + }; + surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), + colourUnSel.allocated, colourUnSel.allocated); + } else { // Down arrow + Point pts[] = { + Point(centreX - halfWidth, centreY - halfWidth / 2), + Point(centreX + halfWidth, centreY - halfWidth / 2), + Point(centreX, centreY + halfWidth - halfWidth / 2), + }; + surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), + colourBG.allocated, colourBG.allocated); + } + } + xEnd = rcClient.right; + offsetMain = xEnd; + if (upArrow) { + rectUp = rcClient; + } else { + rectDown = rcClient; + } + } else if (IsTabCharacter(s[startSeg])) { + xEnd = NextTabPos(x); + } else { + xEnd = x + surface->WidthText(font, s + startSeg, endSeg - startSeg); + if (draw) { + rcClient.left = x; + rcClient.right = xEnd; + surface->DrawTextTransparent(rcClient, font, ytext, + s+startSeg, endSeg - startSeg, + highlight ? colourSel.allocated : colourUnSel.allocated); + } + } + x = xEnd; + startSeg = endSeg; + } + } +} + +int CallTip::PaintContents(Surface *surfaceWindow, bool draw) { + PRectangle rcClientPos = wCallTip.GetClientPosition(); + PRectangle rcClientSize(0, 0, rcClientPos.right - rcClientPos.left, + rcClientPos.bottom - rcClientPos.top); + PRectangle rcClient(1, 1, rcClientSize.right - 1, rcClientSize.bottom - 1); + + // To make a nice small call tip window, it is only sized to fit most normal characters without accents + int ascent = surfaceWindow->Ascent(font) - surfaceWindow->InternalLeading(font); + + // For each line... + // Draw the definition in three parts: before highlight, highlighted, after highlight + int ytext = rcClient.top + ascent + 1; + rcClient.bottom = ytext + surfaceWindow->Descent(font) + 1; + char *chunkVal = val; + bool moreChunks = true; + int maxWidth = 0; + + while (moreChunks) { + char *chunkEnd = strchr(chunkVal, '\n'); + if (chunkEnd == NULL) { + chunkEnd = chunkVal + strlen(chunkVal); + moreChunks = false; + } + int chunkOffset = chunkVal - val; + int chunkLength = chunkEnd - chunkVal; + int chunkEndOffset = chunkOffset + chunkLength; + int thisStartHighlight = Platform::Maximum(startHighlight, chunkOffset); + thisStartHighlight = Platform::Minimum(thisStartHighlight, chunkEndOffset); + thisStartHighlight -= chunkOffset; + int thisEndHighlight = Platform::Maximum(endHighlight, chunkOffset); + thisEndHighlight = Platform::Minimum(thisEndHighlight, chunkEndOffset); + thisEndHighlight -= chunkOffset; + rcClient.top = ytext - ascent - 1; + + int x = insetX; // start each line at this inset + + DrawChunk(surfaceWindow, x, chunkVal, 0, thisStartHighlight, + ytext, rcClient, false, draw); + DrawChunk(surfaceWindow, x, chunkVal, thisStartHighlight, thisEndHighlight, + ytext, rcClient, true, draw); + DrawChunk(surfaceWindow, x, chunkVal, thisEndHighlight, chunkLength, + ytext, rcClient, false, draw); + + chunkVal = chunkEnd + 1; + ytext += lineHeight; + rcClient.bottom += lineHeight; + maxWidth = Platform::Maximum(maxWidth, x); + } + return maxWidth; +} + +void CallTip::PaintCT(Surface *surfaceWindow) { + if (!val) + return; + PRectangle rcClientPos = wCallTip.GetClientPosition(); + PRectangle rcClientSize(0, 0, rcClientPos.right - rcClientPos.left, + rcClientPos.bottom - rcClientPos.top); + PRectangle rcClient(1, 1, rcClientSize.right - 1, rcClientSize.bottom - 1); + + surfaceWindow->FillRectangle(rcClient, colourBG.allocated); + + offsetMain = insetX; // initial alignment assuming no arrows + PaintContents(surfaceWindow, true); + + // OSX doesn't put borders on "help tags" + // Draw a raised border around the edges of the window + surfaceWindow->MoveTo(0, rcClientSize.bottom - 1); + surfaceWindow->PenColour(colourLight.allocated); + surfaceWindow->LineTo(rcClientSize.right - 1, rcClientSize.bottom - 1); + surfaceWindow->LineTo(rcClientSize.right - 1, 0); + surfaceWindow->LineTo(0, 0); + surfaceWindow->LineTo(0, rcClientSize.bottom - 1); + +} + +void CallTip::MouseClick(Point pt) { + clickPlace = 0; + if (rectUp.Contains(pt)) + clickPlace = 1; + if (rectDown.Contains(pt)) + clickPlace = 2; +} + +PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn, + const char *faceName, int size, + int codePage_, int characterSet, Window &wParent) { + clickPlace = 0; + if (val) + delete []val; + val = 0; + val = new char[strlen(defn) + 1]; + strcpy(val, defn); + codePage = codePage_; + Surface *surfaceMeasure = Surface::Allocate(); + if (!surfaceMeasure) + return PRectangle(); + surfaceMeasure->Init(wParent.GetID()); + surfaceMeasure->SetUnicodeMode(SC_CP_UTF8 == codePage); + surfaceMeasure->SetDBCSMode(codePage); + startHighlight = 0; + endHighlight = 0; + inCallTipMode = true; + posStartCallTip = pos; + int deviceHeight = surfaceMeasure->DeviceHeightFont(size); + font.Create(faceName, characterSet, deviceHeight, false, false); + // Look for multiple lines in the text + // Only support \n here - simply means container must avoid \r! + int numLines = 1; + const char *newline; + const char *look = val; + rectUp = PRectangle(0,0,0,0); + rectDown = PRectangle(0,0,0,0); + offsetMain = insetX; // changed to right edge of any arrows + int width = PaintContents(surfaceMeasure, false) + insetX; + while ((newline = strchr(look, '\n')) != NULL) { + look = newline + 1; + numLines++; + } + lineHeight = surfaceMeasure->Height(font); + + // Extra line for border and an empty line at top and bottom. The returned + // rectangle is aligned to the right edge of the last arrow encountered in + // the tip text, else to the tip text left edge. + int height = lineHeight * numLines - surfaceMeasure->InternalLeading(font) + 2 + 2; + delete surfaceMeasure; + return PRectangle(pt.x - offsetMain, pt.y + 1, pt.x + width - offsetMain, pt.y + 1 + height); +} + +void CallTip::CallTipCancel() { + inCallTipMode = false; + if (wCallTip.Created()) { + wCallTip.Destroy(); + } +} + +void CallTip::SetHighlight(int start, int end) { + // Avoid flashing by checking something has really changed + if ((start != startHighlight) || (end != endHighlight)) { + startHighlight = start; + endHighlight = end; + if (wCallTip.Created()) { + wCallTip.InvalidateAll(); + } + } +} + +// Set the tab size (sizes > 0 enable the use of tabs). This also enables the +// use of the STYLE_CALLTIP. +void CallTip::SetTabSize(int tabSz) { + tabSize = tabSz; + useStyleCallTip = true; +} + +// It might be better to have two access functions for this and to use +// them for all settings of colours. +void CallTip::SetForeBack(const ColourPair &fore, const ColourPair &back) { + colourBG = back; + colourUnSel = fore; +} diff --git a/sdk/wxscintilla/src/scintilla/src/CallTip.h b/sdk/wxscintilla/src/scintilla/src/CallTip.h index 52fddd133d..bdf1123c74 100644 --- a/sdk/wxscintilla/src/scintilla/src/CallTip.h +++ b/sdk/wxscintilla/src/scintilla/src/CallTip.h @@ -1,87 +1,87 @@ -// Scintilla source code edit control -/** @file CallTip.h - ** Interface to the call tip control. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef CALLTIP_H -#define CALLTIP_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -/** - */ -class CallTip { - int startHighlight; // character offset to start and... - int endHighlight; // ...end of highlighted text - char *val; - Font font; - PRectangle rectUp; // rectangle of last up angle in the tip - PRectangle rectDown; // rectangle of last down arrow in the tip - int lineHeight; // vertical line spacing - int offsetMain; // The alignment point of the call tip - int tabSize; // Tab size in pixels, <=0 no TAB expand - bool useStyleCallTip; // if true, STYLE_CALLTIP should be used - - // Private so CallTip objects can not be copied - CallTip(const CallTip &) {} - CallTip &operator=(const CallTip &) { return *this; } - void DrawChunk(Surface *surface, int &x, const char *s, - int posStart, int posEnd, int ytext, PRectangle rcClient, - bool highlight, bool draw); - int PaintContents(Surface *surfaceWindow, bool draw); - bool IsTabCharacter(char c); - int NextTabPos(int x); - -public: - Window wCallTip; - Window wDraw; - bool inCallTipMode; - int posStartCallTip; - ColourPair colourBG; - ColourPair colourUnSel; - ColourPair colourSel; - ColourPair colourShade; - ColourPair colourLight; - int codePage; - int clickPlace; - - CallTip(); - ~CallTip(); - - /// Claim or accept palette entries for the colours required to paint a calltip. - void RefreshColourPalette(Palette &pal, bool want); - - void PaintCT(Surface *surfaceWindow); - - void MouseClick(Point pt); - - /// Setup the calltip and return a rectangle of the area required. - PRectangle CallTipStart(int pos, Point pt, const char *defn, - const char *faceName, int size, int codePage_, - int characterSet, Window &wParent); - - void CallTipCancel(); - - /// Set a range of characters to be displayed in a highlight style. - /// Commonly used to highlight the current parameter. - void SetHighlight(int start, int end); - - /// Set the tab size in pixels for the call tip. 0 or -ve means no tab expand. - void SetTabSize(int tabSz); - - /// Used to determine which STYLE_xxxx to use for call tip information - bool UseStyleCallTip() const { return useStyleCallTip;} - - // Modify foreground and background colours - void SetForeBack(const ColourPair &fore, const ColourPair &back); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif +// Scintilla source code edit control +/** @file CallTip.h + ** Interface to the call tip control. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef CALLTIP_H +#define CALLTIP_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +/** + */ +class CallTip { + int startHighlight; // character offset to start and... + int endHighlight; // ...end of highlighted text + char *val; + Font font; + PRectangle rectUp; // rectangle of last up angle in the tip + PRectangle rectDown; // rectangle of last down arrow in the tip + int lineHeight; // vertical line spacing + int offsetMain; // The alignment point of the call tip + int tabSize; // Tab size in pixels, <=0 no TAB expand + bool useStyleCallTip; // if true, STYLE_CALLTIP should be used + + // Private so CallTip objects can not be copied + CallTip(const CallTip &) {} + CallTip &operator=(const CallTip &) { return *this; } + void DrawChunk(Surface *surface, int &x, const char *s, + int posStart, int posEnd, int ytext, PRectangle rcClient, + bool highlight, bool draw); + int PaintContents(Surface *surfaceWindow, bool draw); + bool IsTabCharacter(char c); + int NextTabPos(int x); + +public: + Window wCallTip; + Window wDraw; + bool inCallTipMode; + int posStartCallTip; + ColourPair colourBG; + ColourPair colourUnSel; + ColourPair colourSel; + ColourPair colourShade; + ColourPair colourLight; + int codePage; + int clickPlace; + + CallTip(); + ~CallTip(); + + /// Claim or accept palette entries for the colours required to paint a calltip. + void RefreshColourPalette(Palette &pal, bool want); + + void PaintCT(Surface *surfaceWindow); + + void MouseClick(Point pt); + + /// Setup the calltip and return a rectangle of the area required. + PRectangle CallTipStart(int pos, Point pt, const char *defn, + const char *faceName, int size, int codePage_, + int characterSet, Window &wParent); + + void CallTipCancel(); + + /// Set a range of characters to be displayed in a highlight style. + /// Commonly used to highlight the current parameter. + void SetHighlight(int start, int end); + + /// Set the tab size in pixels for the call tip. 0 or -ve means no tab expand. + void SetTabSize(int tabSz); + + /// Used to determine which STYLE_xxxx to use for call tip information + bool UseStyleCallTip() const { return useStyleCallTip;} + + // Modify foreground and background colours + void SetForeBack(const ColourPair &fore, const ColourPair &back); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/sdk/wxscintilla/src/scintilla/src/CellBuffer.cxx b/sdk/wxscintilla/src/scintilla/src/CellBuffer.cxx index 15ff9d2085..0868cf2513 100644 --- a/sdk/wxscintilla/src/scintilla/src/CellBuffer.cxx +++ b/sdk/wxscintilla/src/scintilla/src/CellBuffer.cxx @@ -1,935 +1,652 @@ -// Scintilla source code edit control -/** @file CellBuffer.cxx - ** Manages a buffer of cells. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include - -#include "Platform.h" - -#include "Scintilla.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "CellBuffer.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -MarkerHandleSet::MarkerHandleSet() { - root = 0; -} - -MarkerHandleSet::~MarkerHandleSet() { - MarkerHandleNumber *mhn = root; - while (mhn) { - MarkerHandleNumber *mhnToFree = mhn; - mhn = mhn->next; - delete mhnToFree; - } - root = 0; -} - -int MarkerHandleSet::Length() const { - int c = 0; - MarkerHandleNumber *mhn = root; - while (mhn) { - c++; - mhn = mhn->next; - } - return c; -} - -int MarkerHandleSet::NumberFromHandle(int handle) const { - MarkerHandleNumber *mhn = root; - while (mhn) { - if (mhn->handle == handle) { - return mhn->number; - } - mhn = mhn->next; - } - return - 1; -} - -int MarkerHandleSet::MarkValue() const { - unsigned int m = 0; - MarkerHandleNumber *mhn = root; - while (mhn) { - m |= (1 << mhn->number); - mhn = mhn->next; - } - return m; -} - -bool MarkerHandleSet::Contains(int handle) const { - MarkerHandleNumber *mhn = root; - while (mhn) { - if (mhn->handle == handle) { - return true; - } - mhn = mhn->next; - } - return false; -} - -bool MarkerHandleSet::InsertHandle(int handle, int markerNum) { - MarkerHandleNumber *mhn = new MarkerHandleNumber; - if (!mhn) - return false; - mhn->handle = handle; - mhn->number = markerNum; - mhn->next = root; - root = mhn; - return true; -} - -void MarkerHandleSet::RemoveHandle(int handle) { - MarkerHandleNumber **pmhn = &root; - while (*pmhn) { - MarkerHandleNumber *mhn = *pmhn; - if (mhn->handle == handle) { - *pmhn = mhn->next; - delete mhn; - return; - } - pmhn = &((*pmhn)->next); - } -} - -bool MarkerHandleSet::RemoveNumber(int markerNum) { - bool performedDeletion = false; - MarkerHandleNumber **pmhn = &root; - while (*pmhn) { - MarkerHandleNumber *mhn = *pmhn; - if (mhn->number == markerNum) { - *pmhn = mhn->next; - delete mhn; - performedDeletion = true; - } else { - pmhn = &((*pmhn)->next); - } - } - return performedDeletion; -} - -void MarkerHandleSet::CombineWith(MarkerHandleSet *other) { - MarkerHandleNumber **pmhn = &root; - while (*pmhn) { - pmhn = &((*pmhn)->next); - } - *pmhn = other->root; - other->root = 0; -} - -LineVector::LineVector() : starts(256) { - handleCurrent = 1; - - Init(); -} - -LineVector::~LineVector() { - starts.DeleteAll(); - for (int line = 0; line < markers.Length(); line++) { - delete markers[line]; - markers[line] = 0; - } - markers.DeleteAll(); - levels.DeleteAll(); -} - -void LineVector::Init() { - starts.DeleteAll(); - for (int line = 0; line < markers.Length(); line++) { - delete markers[line]; - markers[line] = 0; - } - markers.DeleteAll(); - levels.DeleteAll(); -} - -void LineVector::ExpandLevels(int sizeNew) { - levels.InsertValue(levels.Length(), sizeNew - levels.Length(), SC_FOLDLEVELBASE); -} - -void LineVector::ClearLevels() { - levels.DeleteAll(); -} - -int LineVector::SetLevel(int line, int level) { - int prev = 0; - if ((line >= 0) && (line < Lines())) { - if (!levels.Length()) { - ExpandLevels(Lines() + 1); - } - prev = levels[line]; - if (prev != level) { - levels[line] = level; - } - } - return prev; -} - -int LineVector::GetLevel(int line) { - if (levels.Length() && (line >= 0) && (line < Lines())) { - return levels[line]; - } else { - return SC_FOLDLEVELBASE; - } -} - -void LineVector::InsertText(int line, int delta) { - starts.InsertText(line, delta); -} - -void LineVector::InsertLine(int line, int position) { - starts.InsertPartition(line, position); - if (markers.Length()) { - markers.Insert(line, 0); - } - if (levels.Length()) { - int level = SC_FOLDLEVELBASE; - if ((line > 0) && (line < Lines())) { - level = levels[line-1] & ~SC_FOLDLEVELWHITEFLAG; - } - levels.InsertValue(line, 1, level); - } -} - -void LineVector::SetLineStart(int line, int position) { - starts.SetPartitionStartPosition(line, position); -} - -void LineVector::RemoveLine(int line) { - starts.RemovePartition(line); - // Retain the markers from the deleted line by oring them into the previous line - if (markers.Length()) { - if (line > 0) { - MergeMarkers(line - 1); - } - markers.Delete(line); - } - if (levels.Length()) { - // Move up following lines but merge header flag from this line - // to line before to avoid a temporary disappearence causing expansion. - int firstHeader = levels[line] & SC_FOLDLEVELHEADERFLAG; - levels.Delete(line); - if (line > 0) - levels[line-1] |= firstHeader; - } -} - -int LineVector::LineFromPosition(int pos) { - return starts.PartitionFromPosition(pos); -} - -int LineVector::MarkValue(int line) { - if (markers.Length() && markers[line]) - return markers[line]->MarkValue(); - else - return 0; -} - -int LineVector::AddMark(int line, int markerNum) { - handleCurrent++; - if (!markers.Length()) { - // No existing markers so allocate one element per line - markers.InsertValue(0, Lines(), 0); - } - if (!markers[line]) { - // Need new structure to hold marker handle - markers[line] = new MarkerHandleSet(); - if (!markers[line]) - return - 1; - } - markers[line]->InsertHandle(handleCurrent, markerNum); - - return handleCurrent; -} - -void LineVector::MergeMarkers(int pos) { - if (markers[pos + 1] != NULL) { - if (markers[pos] == NULL) - markers[pos] = new MarkerHandleSet; - markers[pos]->CombineWith(markers[pos + 1]); - delete markers[pos + 1]; - markers[pos + 1] = NULL; - } -} - -void LineVector::DeleteMark(int line, int markerNum, bool all) { - if (markers.Length() && markers[line]) { - if (markerNum == -1) { - delete markers[line]; - markers[line] = NULL; - } else { - bool performedDeletion = markers[line]->RemoveNumber(markerNum); - while (all && performedDeletion) { - performedDeletion = markers[line]->RemoveNumber(markerNum); - } - if (markers[line]->Length() == 0) { - delete markers[line]; - markers[line] = NULL; - } - } - } -} - -void LineVector::DeleteMarkFromHandle(int markerHandle) { - int line = LineFromHandle(markerHandle); - if (line >= 0) { - markers[line]->RemoveHandle(markerHandle); - if (markers[line]->Length() == 0) { - delete markers[line]; - markers[line] = NULL; - } - } -} - -int LineVector::LineFromHandle(int markerHandle) { - if (markers.Length()) { - for (int line = 0; line < Lines(); line++) { - if (markers[line]) { - if (markers[line]->Contains(markerHandle)) { - return line; - } - } - } - } - return -1; -} - -Action::Action() { - at = startAction; - position = 0; - data = 0; - lenData = 0; -} - -Action::~Action() { - Destroy(); -} - -void Action::Create(actionType at_, int position_, char *data_, int lenData_, bool mayCoalesce_) { - delete []data; - position = position_; - at = at_; - data = data_; - lenData = lenData_; - mayCoalesce = mayCoalesce_; -} - -void Action::Destroy() { - delete []data; - data = 0; -} - -void Action::Grab(Action *source) { - delete []data; - - position = source->position; - at = source->at; - data = source->data; - lenData = source->lenData; - mayCoalesce = source->mayCoalesce; - - // Ownership of source data transferred to this - source->position = 0; - source->at = startAction; - source->data = 0; - source->lenData = 0; - source->mayCoalesce = true; -} - -// The undo history stores a sequence of user operations that represent the user's view of the -// commands executed on the text. -// Each user operation contains a sequence of text insertion and text deletion actions. -// All the user operations are stored in a list of individual actions with 'start' actions used -// as delimiters between user operations. -// Initially there is one start action in the history. -// As each action is performed, it is recorded in the history. The action may either become -// part of the current user operation or may start a new user operation. If it is to be part of the -// current operation, then it overwrites the current last action. If it is to be part of a new -// operation, it is appended after the current last action. -// After writing the new action, a new start action is appended at the end of the history. -// The decision of whether to start a new user operation is based upon two factors. If a -// compound operation has been explicitly started by calling BeginUndoAction and no matching -// EndUndoAction (these calls nest) has been called, then the action is coalesced into the current -// operation. If there is no outstanding BeginUndoAction call then a new operation is started -// unless it looks as if the new action is caused by the user typing or deleting a stream of text. -// Sequences that look like typing or deletion are coalesced into a single user operation. - -UndoHistory::UndoHistory() { - - lenActions = 100; - actions = new Action[lenActions]; - maxAction = 0; - currentAction = 0; - undoSequenceDepth = 0; - savePoint = 0; - - actions[currentAction].Create(startAction); -} - -UndoHistory::~UndoHistory() { - delete []actions; - actions = 0; -} - -void UndoHistory::EnsureUndoRoom() { - // Have to test that there is room for 2 more actions in the array - // as two actions may be created by the calling function - if (currentAction >= (lenActions - 2)) { - // Run out of undo nodes so extend the array - int lenActionsNew = lenActions * 2; - Action *actionsNew = new Action[lenActionsNew]; - if (!actionsNew) - return; - for (int act = 0; act <= currentAction; act++) - actionsNew[act].Grab(&actions[act]); - delete []actions; - lenActions = lenActionsNew; - actions = actionsNew; - } -} - -void UndoHistory::AppendAction(actionType at, int position, char *data, int lengthData, - bool &startSequence) { - EnsureUndoRoom(); - //Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction); - //Platform::DebugPrintf("^ %d action %d %d\n", actions[currentAction - 1].at, - // actions[currentAction - 1].position, actions[currentAction - 1].lenData); - if (currentAction < savePoint) { - savePoint = -1; - } - int oldCurrentAction = currentAction; - if (currentAction >= 1) { - if (0 == undoSequenceDepth) { - // Top level actions may not always be coalesced - Action &actPrevious = actions[currentAction - 1]; - // See if current action can be coalesced into previous action - // Will work if both are inserts or deletes and position is same - if (at != actPrevious.at) { - currentAction++; - } else if (currentAction == savePoint) { - currentAction++; - } else if ((at == insertAction) && - (position != (actPrevious.position + actPrevious.lenData))) { - // Insertions must be immediately after to coalesce - currentAction++; - } else if (!actions[currentAction].mayCoalesce) { - // Not allowed to coalesce if this set - currentAction++; - } else if (at == removeAction) { - if ((lengthData == 1) || (lengthData == 2)){ - if ((position + lengthData) == actPrevious.position) { - ; // Backspace -> OK - } else if (position == actPrevious.position) { - ; // Delete -> OK - } else { - // Removals must be at same position to coalesce - currentAction++; - } - } else { - // Removals must be of one character to coalesce - currentAction++; - } - } else { - // Action coalesced. - } - - } else { - // Actions not at top level are always coalesced unless this is after return to top level - if (!actions[currentAction].mayCoalesce) - currentAction++; - } - } else { - currentAction++; - } - startSequence = oldCurrentAction != currentAction; - actions[currentAction].Create(at, position, data, lengthData); - currentAction++; - actions[currentAction].Create(startAction); - maxAction = currentAction; -} - -void UndoHistory::BeginUndoAction() { - EnsureUndoRoom(); - if (undoSequenceDepth == 0) { - if (actions[currentAction].at != startAction) { - currentAction++; - actions[currentAction].Create(startAction); - maxAction = currentAction; - } - actions[currentAction].mayCoalesce = false; - } - undoSequenceDepth++; -} - -void UndoHistory::EndUndoAction() { - PLATFORM_ASSERT(undoSequenceDepth > 0); - EnsureUndoRoom(); - undoSequenceDepth--; - if (0 == undoSequenceDepth) { - if (actions[currentAction].at != startAction) { - currentAction++; - actions[currentAction].Create(startAction); - maxAction = currentAction; - } - actions[currentAction].mayCoalesce = false; - } -} - -void UndoHistory::DropUndoSequence() { - undoSequenceDepth = 0; -} - -void UndoHistory::DeleteUndoHistory() { - for (int i = 1; i < maxAction; i++) - actions[i].Destroy(); - maxAction = 0; - currentAction = 0; - actions[currentAction].Create(startAction); - savePoint = 0; -} - -void UndoHistory::SetSavePoint() { - savePoint = currentAction; -} - -bool UndoHistory::IsSavePoint() const { - return savePoint == currentAction; -} - -bool UndoHistory::CanUndo() const { - return (currentAction > 0) && (maxAction > 0); -} - -int UndoHistory::StartUndo() { - // Drop any trailing startAction - if (actions[currentAction].at == startAction && currentAction > 0) - currentAction--; - - // Count the steps in this action - int act = currentAction; - while (actions[act].at != startAction && act > 0) { - act--; - } - return currentAction - act; -} - -const Action &UndoHistory::GetUndoStep() const { - return actions[currentAction]; -} - -void UndoHistory::CompletedUndoStep() { - currentAction--; -} - -bool UndoHistory::CanRedo() const { - return maxAction > currentAction; -} - -int UndoHistory::StartRedo() { - // Drop any leading startAction - if (actions[currentAction].at == startAction && currentAction < maxAction) - currentAction++; - - // Count the steps in this action - int act = currentAction; - while (actions[act].at != startAction && act < maxAction) { - act++; - } - return act - currentAction; -} - -const Action &UndoHistory::GetRedoStep() const { - return actions[currentAction]; -} - -void UndoHistory::CompletedRedoStep() { - currentAction++; -} - -CellBuffer::CellBuffer() { - readOnly = false; - collectingUndo = true; -} - -CellBuffer::~CellBuffer() { -} - -char CellBuffer::CharAt(int position) const { - return substance.ValueAt(position); -} - -void CellBuffer::GetCharRange(char *buffer, int position, int lengthRetrieve) { - if (lengthRetrieve < 0) - return; - if (position < 0) - return; - if ((position + lengthRetrieve) > substance.Length()) { - Platform::DebugPrintf("Bad GetCharRange %d for %d of %d\n", position, - lengthRetrieve, substance.Length()); - return; - } - - for (int i=0; i((curVal & ~mask) | styleValue)); - return true; - } else { - return false; - } -} - -bool CellBuffer::SetStyleFor(int position, int lengthStyle, char styleValue, char mask) { - bool changed = false; - PLATFORM_ASSERT(lengthStyle == 0 || - (lengthStyle > 0 && lengthStyle + position <= style.Length())); - while (lengthStyle--) { - char curVal = style.ValueAt(position); - if ((curVal & mask) != styleValue) { - style.SetValueAt(position, static_cast((curVal & ~mask) | styleValue)); - changed = true; - } - position++; - } - return changed; -} - -// The char* returned is to an allocation owned by the undo history -const char *CellBuffer::DeleteChars(int position, int deleteLength, bool &startSequence) { - // InsertString and DeleteChars are the bottleneck though which all changes occur - PLATFORM_ASSERT(deleteLength > 0); - char *data = 0; - if (!readOnly) { - if (collectingUndo) { - // Save into the undo/redo stack, but only the characters - not the formatting - data = new char[deleteLength]; - for (int i = 0; i < deleteLength; i++) { - data[i] = substance.ValueAt(position + i); - } - uh.AppendAction(removeAction, position, data, deleteLength, startSequence); - } - - BasicDeleteChars(position, deleteLength); - } - return data; -} - -int CellBuffer::Length() const { - return substance.Length(); -} - -void CellBuffer::Allocate(int newSize) { - substance.ReAllocate(newSize); - style.ReAllocate(newSize); -} - -int CellBuffer::Lines() const { - return lv.Lines(); -} - -int CellBuffer::LineStart(int line) const { - if (line < 0) - return 0; - else if (line >= Lines()) - return Length(); - else - return lv.LineStart(line); -} - -bool CellBuffer::IsReadOnly() { - return readOnly; -} - -void CellBuffer::SetReadOnly(bool set) { - readOnly = set; -} - -void CellBuffer::SetSavePoint() { - uh.SetSavePoint(); -} - -bool CellBuffer::IsSavePoint() { - return uh.IsSavePoint(); -} - -int CellBuffer::AddMark(int line, int markerNum) { - if ((line >= 0) && (line < Lines())) { - return lv.AddMark(line, markerNum); - } - return - 1; -} - -void CellBuffer::DeleteMark(int line, int markerNum) { - if ((line >= 0) && (line < Lines())) { - lv.DeleteMark(line, markerNum, false); - } -} - -void CellBuffer::DeleteMarkFromHandle(int markerHandle) { - lv.DeleteMarkFromHandle(markerHandle); -} - -int CellBuffer::GetMark(int line) { - if ((line >= 0) && (line < Lines())) - return lv.MarkValue(line); - return 0; -} - -void CellBuffer::DeleteAllMarks(int markerNum) { - for (int line = 0; line < Lines(); line++) { - lv.DeleteMark(line, markerNum, true); - } -} - -int CellBuffer::LineFromHandle(int markerHandle) { - return lv.LineFromHandle(markerHandle); -} - -// Without undo - -void CellBuffer::InsertLine(int line, int position) { - lv.InsertLine(line, position); - if (lineStates.Length()) { - lineStates.EnsureLength(line); - lineStates.Insert(line, 0); - } -} - -void CellBuffer::RemoveLine(int line) { - lv.RemoveLine(line); - if (lineStates.Length() > line) { - lineStates.Delete(line); - } -} - -void CellBuffer::BasicInsertString(int position, const char *s, int insertLength) { - if (insertLength == 0) - return; - PLATFORM_ASSERT(insertLength > 0); - - substance.InsertFromArray(position, s, 0, insertLength); - style.InsertValue(position, insertLength, 0); - - int lineInsert = lv.LineFromPosition(position) + 1; - // Point all the lines after the insertion point further along in the buffer - lv.InsertText(lineInsert-1, insertLength); - char chPrev = substance.ValueAt(position - 1); - char chAfter = substance.ValueAt(position + insertLength); - if (chPrev == '\r' && chAfter == '\n') { - // Splitting up a crlf pair at position - InsertLine(lineInsert, position); - lineInsert++; - } - char ch = ' '; - for (int i = 0; i < insertLength; i++) { - ch = s[i]; - if (ch == '\r') { - InsertLine(lineInsert, (position + i) + 1); - lineInsert++; - } else if (ch == '\n') { - if (chPrev == '\r') { - // Patch up what was end of line - lv.SetLineStart(lineInsert - 1, (position + i) + 1); - } else { - InsertLine(lineInsert, (position + i) + 1); - lineInsert++; - } - } - chPrev = ch; - } - // Joining two lines where last insertion is cr and following substance starts with lf - if (chAfter == '\n') { - if (ch == '\r') { - // End of line already in buffer so drop the newly created one - RemoveLine(lineInsert - 1); - } - } -} - -void CellBuffer::BasicDeleteChars(int position, int deleteLength) { - if (deleteLength == 0) - return; - - if ((position == 0) && (deleteLength == substance.Length())) { - // If whole buffer is being deleted, faster to reinitialise lines data - // than to delete each line. - lv.Init(); - } else { - // Have to fix up line positions before doing deletion as looking at text in buffer - // to work out which lines have been removed - - int lineRemove = lv.LineFromPosition(position) + 1; - lv.InsertText(lineRemove-1, - (deleteLength)); - char chPrev = substance.ValueAt(position - 1); - char chBefore = chPrev; - char chNext = substance.ValueAt(position); - bool ignoreNL = false; - if (chPrev == '\r' && chNext == '\n') { - // Move back one - lv.SetLineStart(lineRemove, position); - lineRemove++; - ignoreNL = true; // First \n is not real deletion - } - - char ch = chNext; - for (int i = 0; i < deleteLength; i++) { - chNext = substance.ValueAt(position + i + 1); - if (ch == '\r') { - if (chNext != '\n') { - RemoveLine(lineRemove); - } - } else if (ch == '\n') { - if (ignoreNL) { - ignoreNL = false; // Further \n are real deletions - } else { - RemoveLine(lineRemove); - } - } - - ch = chNext; - } - // May have to fix up end if last deletion causes cr to be next to lf - // or removes one of a crlf pair - char chAfter = substance.ValueAt(position + deleteLength); - if (chBefore == '\r' && chAfter == '\n') { - // Using lineRemove-1 as cr ended line before start of deletion - RemoveLine(lineRemove - 1); - lv.SetLineStart(lineRemove - 1, position + 1); - } - } - substance.DeleteRange(position, deleteLength); - style.DeleteRange(position, deleteLength); -} - -bool CellBuffer::SetUndoCollection(bool collectUndo) { - collectingUndo = collectUndo; - uh.DropUndoSequence(); - return collectingUndo; -} - -bool CellBuffer::IsCollectingUndo() { - return collectingUndo; -} - -void CellBuffer::BeginUndoAction() { - uh.BeginUndoAction(); -} - -void CellBuffer::EndUndoAction() { - uh.EndUndoAction(); -} - -void CellBuffer::DeleteUndoHistory() { - uh.DeleteUndoHistory(); -} - -bool CellBuffer::CanUndo() { - return uh.CanUndo(); -} - -int CellBuffer::StartUndo() { - return uh.StartUndo(); -} - -const Action &CellBuffer::GetUndoStep() const { - return uh.GetUndoStep(); -} - -void CellBuffer::PerformUndoStep() { - const Action &actionStep = uh.GetUndoStep(); - if (actionStep.at == insertAction) { - BasicDeleteChars(actionStep.position, actionStep.lenData); - } else if (actionStep.at == removeAction) { - BasicInsertString(actionStep.position, actionStep.data, actionStep.lenData); - } - uh.CompletedUndoStep(); -} - -bool CellBuffer::CanRedo() { - return uh.CanRedo(); -} - -int CellBuffer::StartRedo() { - return uh.StartRedo(); -} - -const Action &CellBuffer::GetRedoStep() const { - return uh.GetRedoStep(); -} - -void CellBuffer::PerformRedoStep() { - const Action &actionStep = uh.GetRedoStep(); - if (actionStep.at == insertAction) { - BasicInsertString(actionStep.position, actionStep.data, actionStep.lenData); - } else if (actionStep.at == removeAction) { - BasicDeleteChars(actionStep.position, actionStep.lenData); - } - uh.CompletedRedoStep(); -} - -int CellBuffer::SetLineState(int line, int state) { - lineStates.EnsureLength(line + 1); - int stateOld = lineStates[line]; - lineStates[line] = state; - return stateOld; -} - -int CellBuffer::GetLineState(int line) { - lineStates.EnsureLength(line + 1); - return lineStates[line]; -} - -int CellBuffer::GetMaxLineState() { - return lineStates.Length(); -} - -int CellBuffer::SetLevel(int line, int level) { - return lv.SetLevel(line, level); -} - -int CellBuffer::GetLevel(int line) { - return lv.GetLevel(line); -} - -void CellBuffer::ClearLevels() { - lv.ClearLevels(); -} +// Scintilla source code edit control +/** @file CellBuffer.cxx + ** Manages a buffer of cells. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include + +#include "Platform.h" + +#include "Scintilla.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "CellBuffer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +LineVector::LineVector() : starts(256), perLine(0) { + Init(); +} + +LineVector::~LineVector() { + starts.DeleteAll(); +} + +void LineVector::Init() { + starts.DeleteAll(); + if (perLine) { + perLine->Init(); + } +} + +void LineVector::SetPerLine(PerLine *pl) { + perLine = pl; +} + +void LineVector::InsertText(int line, int delta) { + starts.InsertText(line, delta); +} + +void LineVector::InsertLine(int line, int position) { + starts.InsertPartition(line, position); + if (perLine) { + perLine->InsertLine(line); + } +} + +void LineVector::SetLineStart(int line, int position) { + starts.SetPartitionStartPosition(line, position); +} + +void LineVector::RemoveLine(int line) { + starts.RemovePartition(line); + if (perLine) { + perLine->RemoveLine(line); + } +} + +int LineVector::LineFromPosition(int pos) const { + return starts.PartitionFromPosition(pos); +} + +Action::Action() { + at = startAction; + position = 0; + data = 0; + lenData = 0; +} + +Action::~Action() { + Destroy(); +} + +void Action::Create(actionType at_, int position_, char *data_, int lenData_, bool mayCoalesce_) { + delete []data; + position = position_; + at = at_; + data = data_; + lenData = lenData_; + mayCoalesce = mayCoalesce_; +} + +void Action::Destroy() { + delete []data; + data = 0; +} + +void Action::Grab(Action *source) { + delete []data; + + position = source->position; + at = source->at; + data = source->data; + lenData = source->lenData; + mayCoalesce = source->mayCoalesce; + + // Ownership of source data transferred to this + source->position = 0; + source->at = startAction; + source->data = 0; + source->lenData = 0; + source->mayCoalesce = true; +} + +// The undo history stores a sequence of user operations that represent the user's view of the +// commands executed on the text. +// Each user operation contains a sequence of text insertion and text deletion actions. +// All the user operations are stored in a list of individual actions with 'start' actions used +// as delimiters between user operations. +// Initially there is one start action in the history. +// As each action is performed, it is recorded in the history. The action may either become +// part of the current user operation or may start a new user operation. If it is to be part of the +// current operation, then it overwrites the current last action. If it is to be part of a new +// operation, it is appended after the current last action. +// After writing the new action, a new start action is appended at the end of the history. +// The decision of whether to start a new user operation is based upon two factors. If a +// compound operation has been explicitly started by calling BeginUndoAction and no matching +// EndUndoAction (these calls nest) has been called, then the action is coalesced into the current +// operation. If there is no outstanding BeginUndoAction call then a new operation is started +// unless it looks as if the new action is caused by the user typing or deleting a stream of text. +// Sequences that look like typing or deletion are coalesced into a single user operation. + +UndoHistory::UndoHistory() { + + lenActions = 100; + actions = new Action[lenActions]; + maxAction = 0; + currentAction = 0; + undoSequenceDepth = 0; + savePoint = 0; + + actions[currentAction].Create(startAction); +} + +UndoHistory::~UndoHistory() { + delete []actions; + actions = 0; +} + +void UndoHistory::EnsureUndoRoom() { + // Have to test that there is room for 2 more actions in the array + // as two actions may be created by the calling function + if (currentAction >= (lenActions - 2)) { + // Run out of undo nodes so extend the array + int lenActionsNew = lenActions * 2; + Action *actionsNew = new Action[lenActionsNew]; + for (int act = 0; act <= currentAction; act++) + actionsNew[act].Grab(&actions[act]); + delete []actions; + lenActions = lenActionsNew; + actions = actionsNew; + } +} + +void UndoHistory::AppendAction(actionType at, int position, char *data, int lengthData, + bool &startSequence, bool mayCoalesce) { + EnsureUndoRoom(); + //Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction); + //Platform::DebugPrintf("^ %d action %d %d\n", actions[currentAction - 1].at, + // actions[currentAction - 1].position, actions[currentAction - 1].lenData); + if (currentAction < savePoint) { + savePoint = -1; + } + int oldCurrentAction = currentAction; + if (currentAction >= 1) { + if (0 == undoSequenceDepth) { + // Top level actions may not always be coalesced + int targetAct = -1; + const Action *actPrevious = &(actions[currentAction + targetAct]); + // Container actions may forward the coalesce state of Scintilla Actions. + while ((actPrevious->at == containerAction) && actPrevious->mayCoalesce) { + targetAct--; + actPrevious = &(actions[currentAction + targetAct]); + } + // See if current action can be coalesced into previous action + // Will work if both are inserts or deletes and position is same + if (currentAction == savePoint) { + currentAction++; + } else if (!actions[currentAction].mayCoalesce) { + // Not allowed to coalesce if this set + currentAction++; + } else if (!mayCoalesce || !actPrevious->mayCoalesce) { + currentAction++; + } else if (at == containerAction || actions[currentAction].at == containerAction) { + ; // A coalescible containerAction + } else if ((at != actPrevious->at) && (actPrevious->at != startAction)) { + currentAction++; + } else if ((at == insertAction) && + (position != (actPrevious->position + actPrevious->lenData))) { + // Insertions must be immediately after to coalesce + currentAction++; + } else if (at == removeAction) { + if ((lengthData == 1) || (lengthData == 2)){ + if ((position + lengthData) == actPrevious->position) { + ; // Backspace -> OK + } else if (position == actPrevious->position) { + ; // Delete -> OK + } else { + // Removals must be at same position to coalesce + currentAction++; + } + } else { + // Removals must be of one character to coalesce + currentAction++; + } + } else { + // Action coalesced. + } + + } else { + // Actions not at top level are always coalesced unless this is after return to top level + if (!actions[currentAction].mayCoalesce) + currentAction++; + } + } else { + currentAction++; + } + startSequence = oldCurrentAction != currentAction; + actions[currentAction].Create(at, position, data, lengthData, mayCoalesce); + currentAction++; + actions[currentAction].Create(startAction); + maxAction = currentAction; +} + +void UndoHistory::BeginUndoAction() { + EnsureUndoRoom(); + if (undoSequenceDepth == 0) { + if (actions[currentAction].at != startAction) { + currentAction++; + actions[currentAction].Create(startAction); + maxAction = currentAction; + } + actions[currentAction].mayCoalesce = false; + } + undoSequenceDepth++; +} + +void UndoHistory::EndUndoAction() { + PLATFORM_ASSERT(undoSequenceDepth > 0); + EnsureUndoRoom(); + undoSequenceDepth--; + if (0 == undoSequenceDepth) { + if (actions[currentAction].at != startAction) { + currentAction++; + actions[currentAction].Create(startAction); + maxAction = currentAction; + } + actions[currentAction].mayCoalesce = false; + } +} + +void UndoHistory::DropUndoSequence() { + undoSequenceDepth = 0; +} + +void UndoHistory::DeleteUndoHistory() { + for (int i = 1; i < maxAction; i++) + actions[i].Destroy(); + maxAction = 0; + currentAction = 0; + actions[currentAction].Create(startAction); + savePoint = 0; +} + +void UndoHistory::SetSavePoint() { + savePoint = currentAction; +} + +bool UndoHistory::IsSavePoint() const { + return savePoint == currentAction; +} + +bool UndoHistory::CanUndo() const { + return (currentAction > 0) && (maxAction > 0); +} + +int UndoHistory::StartUndo() { + // Drop any trailing startAction + if (actions[currentAction].at == startAction && currentAction > 0) + currentAction--; + + // Count the steps in this action + int act = currentAction; + while (actions[act].at != startAction && act > 0) { + act--; + } + return currentAction - act; +} + +const Action &UndoHistory::GetUndoStep() const { + return actions[currentAction]; +} + +void UndoHistory::CompletedUndoStep() { + currentAction--; +} + +bool UndoHistory::CanRedo() const { + return maxAction > currentAction; +} + +int UndoHistory::StartRedo() { + // Drop any leading startAction + if (actions[currentAction].at == startAction && currentAction < maxAction) + currentAction++; + + // Count the steps in this action + int act = currentAction; + while (actions[act].at != startAction && act < maxAction) { + act++; + } + return act - currentAction; +} + +const Action &UndoHistory::GetRedoStep() const { + return actions[currentAction]; +} + +void UndoHistory::CompletedRedoStep() { + currentAction++; +} + +CellBuffer::CellBuffer() { + readOnly = false; + collectingUndo = true; +} + +CellBuffer::~CellBuffer() { +} + +char CellBuffer::CharAt(int position) const { + return substance.ValueAt(position); +} + +void CellBuffer::GetCharRange(char *buffer, int position, int lengthRetrieve) { + if (lengthRetrieve < 0) + return; + if (position < 0) + return; + if ((position + lengthRetrieve) > substance.Length()) { + Platform::DebugPrintf("Bad GetCharRange %d for %d of %d\n", position, + lengthRetrieve, substance.Length()); + return; + } + + for (int i=0; i((curVal & ~mask) | styleValue)); + return true; + } else { + return false; + } +} + +bool CellBuffer::SetStyleFor(int position, int lengthStyle, char styleValue, char mask) { + bool changed = false; + PLATFORM_ASSERT(lengthStyle == 0 || + (lengthStyle > 0 && lengthStyle + position <= style.Length())); + while (lengthStyle--) { + char curVal = style.ValueAt(position); + if ((curVal & mask) != styleValue) { + style.SetValueAt(position, static_cast((curVal & ~mask) | styleValue)); + changed = true; + } + position++; + } + return changed; +} + +// The char* returned is to an allocation owned by the undo history +const char *CellBuffer::DeleteChars(int position, int deleteLength, bool &startSequence) { + // InsertString and DeleteChars are the bottleneck though which all changes occur + PLATFORM_ASSERT(deleteLength > 0); + char *data = 0; + if (!readOnly) { + if (collectingUndo) { + // Save into the undo/redo stack, but only the characters - not the formatting + data = new char[deleteLength]; + for (int i = 0; i < deleteLength; i++) { + data[i] = substance.ValueAt(position + i); + } + uh.AppendAction(removeAction, position, data, deleteLength, startSequence); + } + + BasicDeleteChars(position, deleteLength); + } + return data; +} + +int CellBuffer::Length() const { + return substance.Length(); +} + +void CellBuffer::Allocate(int newSize) { + substance.ReAllocate(newSize); + style.ReAllocate(newSize); +} + +void CellBuffer::SetPerLine(PerLine *pl) { + lv.SetPerLine(pl); +} + +int CellBuffer::Lines() const { + return lv.Lines(); +} + +int CellBuffer::LineStart(int line) const { + if (line < 0) + return 0; + else if (line >= Lines()) + return Length(); + else + return lv.LineStart(line); +} + +bool CellBuffer::IsReadOnly() { + return readOnly; +} + +void CellBuffer::SetReadOnly(bool set) { + readOnly = set; +} + +void CellBuffer::SetSavePoint() { + uh.SetSavePoint(); +} + +bool CellBuffer::IsSavePoint() { + return uh.IsSavePoint(); +} + +// Without undo + +void CellBuffer::InsertLine(int line, int position) { + lv.InsertLine(line, position); +} + +void CellBuffer::RemoveLine(int line) { + lv.RemoveLine(line); +} + +void CellBuffer::BasicInsertString(int position, const char *s, int insertLength) { + if (insertLength == 0) + return; + PLATFORM_ASSERT(insertLength > 0); + + substance.InsertFromArray(position, s, 0, insertLength); + style.InsertValue(position, insertLength, 0); + + int lineInsert = lv.LineFromPosition(position) + 1; + // Point all the lines after the insertion point further along in the buffer + lv.InsertText(lineInsert-1, insertLength); + char chPrev = substance.ValueAt(position - 1); + char chAfter = substance.ValueAt(position + insertLength); + if (chPrev == '\r' && chAfter == '\n') { + // Splitting up a crlf pair at position + InsertLine(lineInsert, position); + lineInsert++; + } + char ch = ' '; + for (int i = 0; i < insertLength; i++) { + ch = s[i]; + if (ch == '\r') { + InsertLine(lineInsert, (position + i) + 1); + lineInsert++; + } else if (ch == '\n') { + if (chPrev == '\r') { + // Patch up what was end of line + lv.SetLineStart(lineInsert - 1, (position + i) + 1); + } else { + InsertLine(lineInsert, (position + i) + 1); + lineInsert++; + } + } + chPrev = ch; + } + // Joining two lines where last insertion is cr and following substance starts with lf + if (chAfter == '\n') { + if (ch == '\r') { + // End of line already in buffer so drop the newly created one + RemoveLine(lineInsert - 1); + } + } +} + +void CellBuffer::BasicDeleteChars(int position, int deleteLength) { + if (deleteLength == 0) + return; + + if ((position == 0) && (deleteLength == substance.Length())) { + // If whole buffer is being deleted, faster to reinitialise lines data + // than to delete each line. + lv.Init(); + } else { + // Have to fix up line positions before doing deletion as looking at text in buffer + // to work out which lines have been removed + + int lineRemove = lv.LineFromPosition(position) + 1; + lv.InsertText(lineRemove-1, - (deleteLength)); + char chPrev = substance.ValueAt(position - 1); + char chBefore = chPrev; + char chNext = substance.ValueAt(position); + bool ignoreNL = false; + if (chPrev == '\r' && chNext == '\n') { + // Move back one + lv.SetLineStart(lineRemove, position); + lineRemove++; + ignoreNL = true; // First \n is not real deletion + } + + char ch = chNext; + for (int i = 0; i < deleteLength; i++) { + chNext = substance.ValueAt(position + i + 1); + if (ch == '\r') { + if (chNext != '\n') { + RemoveLine(lineRemove); + } + } else if (ch == '\n') { + if (ignoreNL) { + ignoreNL = false; // Further \n are real deletions + } else { + RemoveLine(lineRemove); + } + } + + ch = chNext; + } + // May have to fix up end if last deletion causes cr to be next to lf + // or removes one of a crlf pair + char chAfter = substance.ValueAt(position + deleteLength); + if (chBefore == '\r' && chAfter == '\n') { + // Using lineRemove-1 as cr ended line before start of deletion + RemoveLine(lineRemove - 1); + lv.SetLineStart(lineRemove - 1, position + 1); + } + } + substance.DeleteRange(position, deleteLength); + style.DeleteRange(position, deleteLength); +} + +bool CellBuffer::SetUndoCollection(bool collectUndo) { + collectingUndo = collectUndo; + uh.DropUndoSequence(); + return collectingUndo; +} + +bool CellBuffer::IsCollectingUndo() { + return collectingUndo; +} + +void CellBuffer::BeginUndoAction() { + uh.BeginUndoAction(); +} + +void CellBuffer::EndUndoAction() { + uh.EndUndoAction(); +} + +void CellBuffer::AddUndoAction(int token, bool mayCoalesce) { + bool startSequence; + uh.AppendAction(containerAction, token, 0, 0, startSequence, mayCoalesce); +} + +void CellBuffer::DeleteUndoHistory() { + uh.DeleteUndoHistory(); +} + +bool CellBuffer::CanUndo() { + return uh.CanUndo(); +} + +int CellBuffer::StartUndo() { + return uh.StartUndo(); +} + +const Action &CellBuffer::GetUndoStep() const { + return uh.GetUndoStep(); +} + +void CellBuffer::PerformUndoStep() { + const Action &actionStep = uh.GetUndoStep(); + if (actionStep.at == insertAction) { + BasicDeleteChars(actionStep.position, actionStep.lenData); + } else if (actionStep.at == removeAction) { + BasicInsertString(actionStep.position, actionStep.data, actionStep.lenData); + } + uh.CompletedUndoStep(); +} + +bool CellBuffer::CanRedo() { + return uh.CanRedo(); +} + +int CellBuffer::StartRedo() { + return uh.StartRedo(); +} + +const Action &CellBuffer::GetRedoStep() const { + return uh.GetRedoStep(); +} + +void CellBuffer::PerformRedoStep() { + const Action &actionStep = uh.GetRedoStep(); + if (actionStep.at == insertAction) { + BasicInsertString(actionStep.position, actionStep.data, actionStep.lenData); + } else if (actionStep.at == removeAction) { + BasicDeleteChars(actionStep.position, actionStep.lenData); + } + uh.CompletedRedoStep(); +} + diff --git a/sdk/wxscintilla/src/scintilla/src/CellBuffer.h b/sdk/wxscintilla/src/scintilla/src/CellBuffer.h index 2a3038681a..3381c19c2c 100644 --- a/sdk/wxscintilla/src/scintilla/src/CellBuffer.h +++ b/sdk/wxscintilla/src/scintilla/src/CellBuffer.h @@ -1,241 +1,208 @@ -// Scintilla source code edit control -/** @file CellBuffer.h - ** Manages the text of the document. - **/ -// Copyright 1998-2004 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef CELLBUFFER_H -#define CELLBUFFER_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -/** - * This holds the marker identifier and the marker type to display. - * MarkerHandleNumbers are members of lists. - */ -struct MarkerHandleNumber { - int handle; - int number; - MarkerHandleNumber *next; -}; - -/** - * A marker handle set contains any number of MarkerHandleNumbers. - */ -class MarkerHandleSet { - MarkerHandleNumber *root; - -public: - MarkerHandleSet(); - ~MarkerHandleSet(); - int Length() const; - int NumberFromHandle(int handle) const; - int MarkValue() const; ///< Bit set of marker numbers. - bool Contains(int handle) const; - bool InsertHandle(int handle, int markerNum); - void RemoveHandle(int handle); - bool RemoveNumber(int markerNum); - void CombineWith(MarkerHandleSet *other); -}; - -/** - * The line vector contains information about each of the lines in a cell buffer. - */ -class LineVector { - - Partitioning starts; - SplitVector markers; - SplitVector levels; - /// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big. - int handleCurrent; - -public: - - LineVector(); - ~LineVector(); - void Init(); - - void ExpandLevels(int sizeNew=-1); - void ClearLevels(); - int SetLevel(int line, int level); - int GetLevel(int line); - - void InsertText(int line, int delta); - void InsertLine(int line, int position); - void SetLineStart(int line, int position); - void RemoveLine(int line); - int Lines() const { - return starts.Partitions(); - } - int LineFromPosition(int pos); - int LineStart(int line) const { - return starts.PositionFromPartition(line); - } - - int MarkValue(int line); - int AddMark(int line, int marker); - void MergeMarkers(int pos); - void DeleteMark(int line, int markerNum, bool all); - void DeleteMarkFromHandle(int markerHandle); - int LineFromHandle(int markerHandle); -}; - -enum actionType { insertAction, removeAction, startAction }; - -/** - * Actions are used to store all the information required to perform one undo/redo step. - */ -class Action { -public: - actionType at; - int position; - char *data; - int lenData; - bool mayCoalesce; - - Action(); - ~Action(); - void Create(actionType at_, int position_=0, char *data_=0, int lenData_=0, bool mayCoalesce_=true); - void Destroy(); - void Grab(Action *source); -}; - -/** - * - */ -class UndoHistory { - Action *actions; - int lenActions; - int maxAction; - int currentAction; - int undoSequenceDepth; - int savePoint; - - void EnsureUndoRoom(); - -public: - UndoHistory(); - ~UndoHistory(); - - void AppendAction(actionType at, int position, char *data, int length, bool &startSequence); - - void BeginUndoAction(); - void EndUndoAction(); - void DropUndoSequence(); - void DeleteUndoHistory(); - - /// The save point is a marker in the undo stack where the container has stated that - /// the buffer was saved. Undo and redo can move over the save point. - void SetSavePoint(); - bool IsSavePoint() const; - - /// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is - /// called that many times. Similarly for redo. - bool CanUndo() const; - int StartUndo(); - const Action &GetUndoStep() const; - void CompletedUndoStep(); - bool CanRedo() const; - int StartRedo(); - const Action &GetRedoStep() const; - void CompletedRedoStep(); -}; - -/** - * Holder for an expandable array of characters that supports undo and line markers. - * Based on article "Data Structures in a Bit-Mapped Text Editor" - * by Wilfred J. Hansen, Byte January 1987, page 183. - */ -class CellBuffer { -private: - SplitVector substance; - SplitVector style; - bool readOnly; - - bool collectingUndo; - UndoHistory uh; - - LineVector lv; - - SplitVector lineStates; - -public: - - CellBuffer(); - ~CellBuffer(); - - /// Retrieving positions outside the range of the buffer works and returns 0 - char CharAt(int position) const; - void GetCharRange(char *buffer, int position, int lengthRetrieve); - char StyleAt(int position); - - int Length() const; - void Allocate(int newSize); - int Lines() const; - int LineStart(int line) const; - int LineFromPosition(int pos) { return lv.LineFromPosition(pos); } - void InsertLine(int line, int position); - void RemoveLine(int line); - const char *InsertString(int position, const char *s, int insertLength, bool &startSequence); - - /// Setting styles for positions outside the range of the buffer is safe and has no effect. - /// @return true if the style of a character is changed. - bool SetStyleAt(int position, char styleValue, char mask='\377'); - bool SetStyleFor(int position, int length, char styleValue, char mask); - - const char *DeleteChars(int position, int deleteLength, bool &startSequence); - - bool IsReadOnly(); - void SetReadOnly(bool set); - - /// The save point is a marker in the undo stack where the container has stated that - /// the buffer was saved. Undo and redo can move over the save point. - void SetSavePoint(); - bool IsSavePoint(); - - /// Line marker functions - int AddMark(int line, int markerNum); - void DeleteMark(int line, int markerNum); - void DeleteMarkFromHandle(int markerHandle); - int GetMark(int line); - void DeleteAllMarks(int markerNum); - int LineFromHandle(int markerHandle); - - /// Actions without undo - void BasicInsertString(int position, const char *s, int insertLength); - void BasicDeleteChars(int position, int deleteLength); - - bool SetUndoCollection(bool collectUndo); - bool IsCollectingUndo(); - void BeginUndoAction(); - void EndUndoAction(); - void DeleteUndoHistory(); - - /// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is - /// called that many times. Similarly for redo. - bool CanUndo(); - int StartUndo(); - const Action &GetUndoStep() const; - void PerformUndoStep(); - bool CanRedo(); - int StartRedo(); - const Action &GetRedoStep() const; - void PerformRedoStep(); - - int SetLineState(int line, int state); - int GetLineState(int line); - int GetMaxLineState(); - - int SetLevel(int line, int level); - int GetLevel(int line); - void ClearLevels(); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif +// Scintilla source code edit control +/** @file CellBuffer.h + ** Manages the text of the document. + **/ +// Copyright 1998-2004 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef CELLBUFFER_H +#define CELLBUFFER_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +// Interface to per-line data that wants to see each line insertion and deletion +class PerLine { +public: + virtual ~PerLine() {} + virtual void Init()=0; + virtual void InsertLine(int)=0; + virtual void RemoveLine(int)=0; +}; + +/** + * The line vector contains information about each of the lines in a cell buffer. + */ +class LineVector { + + Partitioning starts; + PerLine *perLine; + +public: + + LineVector(); + ~LineVector(); + void Init(); + void SetPerLine(PerLine *pl); + + void InsertText(int line, int delta); + void InsertLine(int line, int position); + void SetLineStart(int line, int position); + void RemoveLine(int line); + int Lines() const { + return starts.Partitions(); + } + int LineFromPosition(int pos) const; + int LineStart(int line) const { + return starts.PositionFromPartition(line); + } + + int MarkValue(int line); + int AddMark(int line, int marker); + void MergeMarkers(int pos); + void DeleteMark(int line, int markerNum, bool all); + void DeleteMarkFromHandle(int markerHandle); + int LineFromHandle(int markerHandle); + + void ClearLevels(); + int SetLevel(int line, int level); + int GetLevel(int line); + + int SetLineState(int line, int state); + int GetLineState(int line); + int GetMaxLineState(); + +}; + +enum actionType { insertAction, removeAction, startAction, containerAction }; + +/** + * Actions are used to store all the information required to perform one undo/redo step. + */ +class Action { +public: + actionType at; + int position; + char *data; + int lenData; + bool mayCoalesce; + + Action(); + ~Action(); + void Create(actionType at_, int position_=0, char *data_=0, int lenData_=0, bool mayCoalesce_=true); + void Destroy(); + void Grab(Action *source); +}; + +/** + * + */ +class UndoHistory { + Action *actions; + int lenActions; + int maxAction; + int currentAction; + int undoSequenceDepth; + int savePoint; + + void EnsureUndoRoom(); + +public: + UndoHistory(); + ~UndoHistory(); + + void AppendAction(actionType at, int position, char *data, int length, bool &startSequence, bool mayCoalesce=true); + + void BeginUndoAction(); + void EndUndoAction(); + void DropUndoSequence(); + void DeleteUndoHistory(); + + /// The save point is a marker in the undo stack where the container has stated that + /// the buffer was saved. Undo and redo can move over the save point. + void SetSavePoint(); + bool IsSavePoint() const; + + /// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is + /// called that many times. Similarly for redo. + bool CanUndo() const; + int StartUndo(); + const Action &GetUndoStep() const; + void CompletedUndoStep(); + bool CanRedo() const; + int StartRedo(); + const Action &GetRedoStep() const; + void CompletedRedoStep(); +}; + +/** + * Holder for an expandable array of characters that supports undo and line markers. + * Based on article "Data Structures in a Bit-Mapped Text Editor" + * by Wilfred J. Hansen, Byte January 1987, page 183. + */ +class CellBuffer { +private: + SplitVector substance; + SplitVector style; + bool readOnly; + + bool collectingUndo; + UndoHistory uh; + + LineVector lv; + +public: + + CellBuffer(); + ~CellBuffer(); + + /// Retrieving positions outside the range of the buffer works and returns 0 + char CharAt(int position) const; + void GetCharRange(char *buffer, int position, int lengthRetrieve); + char StyleAt(int position); + const char *BufferPointer(); + + int Length() const; + void Allocate(int newSize); + void SetPerLine(PerLine *pl); + int Lines() const; + int LineStart(int line) const; + int LineFromPosition(int pos) const { return lv.LineFromPosition(pos); } + void InsertLine(int line, int position); + void RemoveLine(int line); + const char *InsertString(int position, const char *s, int insertLength, bool &startSequence); + + /// Setting styles for positions outside the range of the buffer is safe and has no effect. + /// @return true if the style of a character is changed. + bool SetStyleAt(int position, char styleValue, char mask='\377'); + bool SetStyleFor(int position, int length, char styleValue, char mask); + + const char *DeleteChars(int position, int deleteLength, bool &startSequence); + + bool IsReadOnly(); + void SetReadOnly(bool set); + + /// The save point is a marker in the undo stack where the container has stated that + /// the buffer was saved. Undo and redo can move over the save point. + void SetSavePoint(); + bool IsSavePoint(); + + /// Actions without undo + void BasicInsertString(int position, const char *s, int insertLength); + void BasicDeleteChars(int position, int deleteLength); + + bool SetUndoCollection(bool collectUndo); + bool IsCollectingUndo(); + void BeginUndoAction(); + void EndUndoAction(); + void AddUndoAction(int token, bool mayCoalesce); + void DeleteUndoHistory(); + + /// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is + /// called that many times. Similarly for redo. + bool CanUndo(); + int StartUndo(); + const Action &GetUndoStep() const; + void PerformUndoStep(); + bool CanRedo(); + int StartRedo(); + const Action &GetRedoStep() const; + void PerformRedoStep(); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/sdk/wxscintilla/src/scintilla/src/CharClassify.cxx b/sdk/wxscintilla/src/scintilla/src/CharClassify.cxx index 76eb905c79..bbd25a0f8d 100644 --- a/sdk/wxscintilla/src/scintilla/src/CharClassify.cxx +++ b/sdk/wxscintilla/src/scintilla/src/CharClassify.cxx @@ -1,43 +1,78 @@ -// Scintilla source code edit control -/** @file CharClassify.cxx - ** Character classifications used by Document and RESearch. - **/ -// Copyright 2006 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include - -#include "CharClassify.h" - -// Shut up annoying Visual C++ warnings: -#ifdef _MSC_VER -#pragma warning(disable: 4514) -#endif - -CharClassify::CharClassify() { - SetDefaultCharClasses(true); -} - -void CharClassify::SetDefaultCharClasses(bool includeWordClass) { - // Initialize all char classes to default values - for (int ch = 0; ch < 256; ch++) { - if (ch == '\r' || ch == '\n') - charClass[ch] = ccNewLine; - else if (ch < 0x20 || ch == ' ') - charClass[ch] = ccSpace; - else if (includeWordClass && (ch >= 0x80 || isalnum(ch) || ch == '_')) - charClass[ch] = ccWord; - else - charClass[ch] = ccPunctuation; - } -} - -void CharClassify::SetCharClasses(const unsigned char *chars, cc newCharClass) { - // Apply the newCharClass to the specifed chars - if (chars) { - while (*chars) { - charClass[*chars] = static_cast(newCharClass); - chars++; - } - } -} +// Scintilla source code edit control +/** @file CharClassify.cxx + ** Character classifications used by Document and RESearch. + **/ +// Copyright 2006 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include + +#include "CharClassify.h" + +// Shut up annoying Visual C++ warnings: +#ifdef _MSC_VER +#pragma warning(disable: 4514) +#endif + +CharClassify::CharClassify() { + SetDefaultCharClasses(true); +} + +void CharClassify::SetDefaultCharClasses(bool includeWordClass) { + // Initialize all char classes to default values + for (int ch = 0; ch < 256; ch++) { + if (ch == '\r' || ch == '\n') + charClass[ch] = ccNewLine; + else if (ch < 0x20 || ch == ' ') + charClass[ch] = ccSpace; + else if (includeWordClass && (ch >= 0x80 || isalnum(ch) || ch == '_')) + charClass[ch] = ccWord; + else + charClass[ch] = ccPunctuation; + } +} + +void CharClassify::SetCharClasses(const unsigned char *chars, cc newCharClass) { + // Apply the newCharClass to the specifed chars + if (chars) { + while (*chars) { + charClass[*chars] = static_cast(newCharClass); + chars++; + } + } +} + +int CompareCaseInsensitive(const char *a, const char *b) { + while (*a && *b) { + if (*a != *b) { + char upperA = MakeUpperCase(*a); + char upperB = MakeUpperCase(*b); + if (upperA != upperB) + return upperA - upperB; + } + a++; + b++; + } + // Either *a or *b is nul + return *a - *b; +} + +int CompareNCaseInsensitive(const char *a, const char *b, size_t len) { + while (*a && *b && len) { + if (*a != *b) { + char upperA = MakeUpperCase(*a); + char upperB = MakeUpperCase(*b); + if (upperA != upperB) + return upperA - upperB; + } + a++; + b++; + len--; + } + if (len == 0) + return 0; + else + // Either *a or *b is nul + return *a - *b; +} diff --git a/sdk/wxscintilla/src/scintilla/src/CharClassify.h b/sdk/wxscintilla/src/scintilla/src/CharClassify.h index d26f4b34bb..d746fe02dd 100644 --- a/sdk/wxscintilla/src/scintilla/src/CharClassify.h +++ b/sdk/wxscintilla/src/scintilla/src/CharClassify.h @@ -1,25 +1,37 @@ -// Scintilla source code edit control -/** @file CharClassify.h - ** Character classifications used by Document and RESearch. - **/ -// Copyright 2006 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef CHARCLASSIFY_H -#define CHARCLASSIFY_H - -class CharClassify { -public: - CharClassify(); - - enum cc { ccSpace, ccNewLine, ccWord, ccPunctuation }; - void SetDefaultCharClasses(bool includeWordClass); - void SetCharClasses(const unsigned char *chars, cc newCharClass); - cc GetClass(unsigned char ch) const { return static_cast(charClass[ch]);} - bool IsWord(unsigned char ch) const { return static_cast(charClass[ch]) == ccWord;} - -private: - enum { maxChar=256 }; - unsigned char charClass[maxChar]; // not type cc to save space -}; -#endif +// Scintilla source code edit control +/** @file CharClassify.h + ** Character classifications used by Document and RESearch. + **/ +// Copyright 2006-2009 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef CHARCLASSIFY_H +#define CHARCLASSIFY_H + +class CharClassify { +public: + CharClassify(); + + enum cc { ccSpace, ccNewLine, ccWord, ccPunctuation }; + void SetDefaultCharClasses(bool includeWordClass); + void SetCharClasses(const unsigned char *chars, cc newCharClass); + cc GetClass(unsigned char ch) const { return static_cast(charClass[ch]);} + bool IsWord(unsigned char ch) const { return static_cast(charClass[ch]) == ccWord;} + +private: + enum { maxChar=256 }; + unsigned char charClass[maxChar]; // not type cc to save space +}; + +// These functions are implemented because each platform calls them something different. +int CompareCaseInsensitive(const char *a, const char *b); +int CompareNCaseInsensitive(const char *a, const char *b, size_t len); + +inline char MakeUpperCase(char ch) { + if (ch < 'a' || ch > 'z') + return ch; + else + return static_cast(ch - 'a' + 'A'); +} + +#endif diff --git a/sdk/wxscintilla/src/scintilla/src/CharacterSet.h b/sdk/wxscintilla/src/scintilla/src/CharacterSet.h index 764ee64264..4e8ffbdf6f 100644 --- a/sdk/wxscintilla/src/scintilla/src/CharacterSet.h +++ b/sdk/wxscintilla/src/scintilla/src/CharacterSet.h @@ -1,58 +1,58 @@ -// Scintilla source code edit control -/** @file CharacterSet.h - ** Encapsulates a set of characters. Used to test if a character is within a set. - **/ -// Copyright 2007 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -class CharacterSet { - int size; - bool valueAfter; - bool *bset; -public: - enum setBase { - setNone=0, - setLower=1, - setUpper=2, - setDigits=4, - setAlpha=setLower|setUpper, - setAlphaNum=setAlpha|setDigits - }; - CharacterSet(setBase base=setNone, const char *initialSet="", int size_=0x80, bool valueAfter_=false) { - size = size_; - valueAfter = valueAfter_; - bset = new bool[size]; - for (int i=0; i < size; i++) { - bset[i] = false; - } - AddString(initialSet); - if (base & setLower) - AddString("abcdefghijklmnopqrstuvwxyz"); - if (base & setUpper) - AddString("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); - if (base & setDigits) - AddString("0123456789"); - } - ~CharacterSet() { - delete []bset; - bset = 0; - size = 0; - } - void Add(int val) { - PLATFORM_ASSERT(val >= 0); - PLATFORM_ASSERT(val < size); - bset[val] = true; - } - void AddString(const char *CharacterSet) { - for (const char *cp=CharacterSet; *cp; cp++) { - int val = static_cast(*cp); - PLATFORM_ASSERT(val >= 0); - PLATFORM_ASSERT(val < size); - bset[val] = true; - } - } - bool Contains(int val) const { - PLATFORM_ASSERT(val >= 0); - return (val < size) ? bset[val] : valueAfter; - } -}; +// Scintilla source code edit control +/** @file CharacterSet.h + ** Encapsulates a set of characters. Used to test if a character is within a set. + **/ +// Copyright 2007 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +class CharacterSet { + int size; + bool valueAfter; + bool *bset; +public: + enum setBase { + setNone=0, + setLower=1, + setUpper=2, + setDigits=4, + setAlpha=setLower|setUpper, + setAlphaNum=setAlpha|setDigits + }; + CharacterSet(setBase base=setNone, const char *initialSet="", int size_=0x80, bool valueAfter_=false) { + size = size_; + valueAfter = valueAfter_; + bset = new bool[size]; + for (int i=0; i < size; i++) { + bset[i] = false; + } + AddString(initialSet); + if (base & setLower) + AddString("abcdefghijklmnopqrstuvwxyz"); + if (base & setUpper) + AddString("ABCDEFGHIJKLMNOPQRSTUVWXYZ"); + if (base & setDigits) + AddString("0123456789"); + } + ~CharacterSet() { + delete []bset; + bset = 0; + size = 0; + } + void Add(int val) { + PLATFORM_ASSERT(val >= 0); + PLATFORM_ASSERT(val < size); + bset[val] = true; + } + void AddString(const char *CharacterSet) { + for (const char *cp=CharacterSet; *cp; cp++) { + int val = static_cast(*cp); + PLATFORM_ASSERT(val >= 0); + PLATFORM_ASSERT(val < size); + bset[val] = true; + } + } + bool Contains(int val) const { + PLATFORM_ASSERT(val >= 0); + return (val < size) ? bset[val] : valueAfter; + } +}; diff --git a/sdk/wxscintilla/src/scintilla/src/ContractionState.cxx b/sdk/wxscintilla/src/scintilla/src/ContractionState.cxx index d6a6be4b5d..08de5cf1f7 100644 --- a/sdk/wxscintilla/src/scintilla/src/ContractionState.cxx +++ b/sdk/wxscintilla/src/scintilla/src/ContractionState.cxx @@ -1,251 +1,251 @@ -// Scintilla source code edit control -/** @file ContractionState.cxx - ** Manages visibility of lines for folding and wrapping. - **/ -// Copyright 1998-2007 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include - -#include "Platform.h" - -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" -#include "ContractionState.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -ContractionState::ContractionState() : visible(0), expanded(0), heights(0), displayLines(0), linesInDocument(1) { - //InsertLine(0); -} - -ContractionState::~ContractionState() { - Clear(); -} - -void ContractionState::EnsureData() { - if (OneToOne()) { - visible = new RunStyles(); - expanded = new RunStyles(); - heights = new RunStyles(); - displayLines = new Partitioning(4); - InsertLines(0, linesInDocument); - } -} - -void ContractionState::Clear() { - delete visible; - visible = 0; - delete expanded; - expanded = 0; - delete heights; - heights = 0; - delete displayLines; - displayLines = 0; - linesInDocument = 1; -} - -int ContractionState::LinesInDoc() const { - if (OneToOne()) { - return linesInDocument; - } else { - return displayLines->Partitions() - 1; - } -} - -int ContractionState::LinesDisplayed() const { - if (OneToOne()) { - return linesInDocument; - } else { - return displayLines->PositionFromPartition(LinesInDoc()); - } -} - -int ContractionState::DisplayFromDoc(int lineDoc) const { - if (OneToOne()) { - return lineDoc; - } else { - if (lineDoc > displayLines->Partitions()) - lineDoc = displayLines->Partitions(); - return displayLines->PositionFromPartition(lineDoc); - } -} - -int ContractionState::DocFromDisplay(int lineDisplay) const { - if (OneToOne()) { - return lineDisplay; - } else { - if (lineDisplay <= 0) { - return 0; - } - if (lineDisplay > LinesDisplayed()) { - return displayLines->PartitionFromPosition(LinesDisplayed()); - } - int lineDoc = displayLines->PartitionFromPosition(lineDisplay); - PLATFORM_ASSERT(GetVisible(lineDoc)); - return lineDoc; - } -} - -void ContractionState::InsertLine(int lineDoc) { - if (OneToOne()) { - linesInDocument++; - } else { - visible->InsertSpace(lineDoc, 1); - visible->SetValueAt(lineDoc, 1); - expanded->InsertSpace(lineDoc, 1); - expanded->SetValueAt(lineDoc, 1); - heights->InsertSpace(lineDoc, 1); - heights->SetValueAt(lineDoc, 1); - int lineDisplay = DisplayFromDoc(lineDoc); - displayLines->InsertPartition(lineDoc, lineDisplay); - displayLines->InsertText(lineDoc, 1); - } -} - -void ContractionState::InsertLines(int lineDoc, int lineCount) { - for (int l = 0; l < lineCount; l++) { - InsertLine(lineDoc + l); - } - Check(); -} - -void ContractionState::DeleteLine(int lineDoc) { - if (OneToOne()) { - linesInDocument--; - } else { - if (GetVisible(lineDoc)) { - displayLines->InsertText(lineDoc, -heights->ValueAt(lineDoc)); - } - displayLines->RemovePartition(lineDoc); - visible->DeleteRange(lineDoc, 1); - expanded->DeleteRange(lineDoc, 1); - heights->DeleteRange(lineDoc, 1); - } -} - -void ContractionState::DeleteLines(int lineDoc, int lineCount) { - for (int l = 0; l < lineCount; l++) { - DeleteLine(lineDoc); - } - Check(); -} - -bool ContractionState::GetVisible(int lineDoc) const { - if (OneToOne()) { - return true; - } else { - if (lineDoc >= visible->Length()) - return true; - return visible->ValueAt(lineDoc) == 1; - } -} - -bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible_) { - if (OneToOne() && visible_) { - return false; - } else { - EnsureData(); - int delta = 0; - Check(); - if ((lineDocStart <= lineDocEnd) && (lineDocStart >= 0) && (lineDocEnd < LinesInDoc())) { - for (int line = lineDocStart; line <= lineDocEnd; line++) { - if (GetVisible(line) != visible_) { - int difference = visible_ ? heights->ValueAt(line) : -heights->ValueAt(line); - visible->SetValueAt(line, visible_ ? 1 : 0); - displayLines->InsertText(line, difference); - delta += difference; - } - } - } else { - return false; - } - Check(); - return delta != 0; - } -} - -bool ContractionState::GetExpanded(int lineDoc) const { - if (OneToOne()) { - return true; - } else { - Check(); - return expanded->ValueAt(lineDoc) == 1; - } -} - -bool ContractionState::SetExpanded(int lineDoc, bool expanded_) { - if (OneToOne() && expanded_) { - return false; - } else { - EnsureData(); - if (expanded_ != (expanded->ValueAt(lineDoc) == 1)) { - expanded->SetValueAt(lineDoc, expanded_ ? 1 : 0); - Check(); - return true; - } else { - Check(); - return false; - } - } -} - -int ContractionState::GetHeight(int lineDoc) const { - if (OneToOne()) { - return 1; - } else { - return heights->ValueAt(lineDoc); - } -} - -// Set the number of display lines needed for this line. -// Return true if this is a change. -bool ContractionState::SetHeight(int lineDoc, int height) { - if (OneToOne() && (height == 1)) { - return false; - } else { - EnsureData(); - if (GetHeight(lineDoc) != height) { - if (GetVisible(lineDoc)) { - displayLines->InsertText(lineDoc, height - GetHeight(lineDoc)); - } - heights->SetValueAt(lineDoc, height); - Check(); - return true; - } else { - Check(); - return false; - } - } -} - -void ContractionState::ShowAll() { - int lines = LinesInDoc(); - Clear(); - linesInDocument = lines; -} - -// Debugging checks - -void ContractionState::Check() const { -#ifdef CHECK_CORRECTNESS - for (int vline = 0;vline < LinesDisplayed(); vline++) { - const int lineDoc = DocFromDisplay(vline); - PLATFORM_ASSERT(GetVisible(lineDoc)); - } - for (int lineDoc = 0;lineDoc < LinesInDoc(); lineDoc++) { - const int displayThis = DisplayFromDoc(lineDoc); - const int displayNext = DisplayFromDoc(lineDoc + 1); - const int height = displayNext - displayThis; - PLATFORM_ASSERT(height >= 0); - if (GetVisible(lineDoc)) { - PLATFORM_ASSERT(GetHeight(lineDoc) == height); - } else { - PLATFORM_ASSERT(0 == height); - } - } -#endif -} +// Scintilla source code edit control +/** @file ContractionState.cxx + ** Manages visibility of lines for folding and wrapping. + **/ +// Copyright 1998-2007 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include + +#include "Platform.h" + +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" +#include "ContractionState.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +ContractionState::ContractionState() : visible(0), expanded(0), heights(0), displayLines(0), linesInDocument(1) { + //InsertLine(0); +} + +ContractionState::~ContractionState() { + Clear(); +} + +void ContractionState::EnsureData() { + if (OneToOne()) { + visible = new RunStyles(); + expanded = new RunStyles(); + heights = new RunStyles(); + displayLines = new Partitioning(4); + InsertLines(0, linesInDocument); + } +} + +void ContractionState::Clear() { + delete visible; + visible = 0; + delete expanded; + expanded = 0; + delete heights; + heights = 0; + delete displayLines; + displayLines = 0; + linesInDocument = 1; +} + +int ContractionState::LinesInDoc() const { + if (OneToOne()) { + return linesInDocument; + } else { + return displayLines->Partitions() - 1; + } +} + +int ContractionState::LinesDisplayed() const { + if (OneToOne()) { + return linesInDocument; + } else { + return displayLines->PositionFromPartition(LinesInDoc()); + } +} + +int ContractionState::DisplayFromDoc(int lineDoc) const { + if (OneToOne()) { + return lineDoc; + } else { + if (lineDoc > displayLines->Partitions()) + lineDoc = displayLines->Partitions(); + return displayLines->PositionFromPartition(lineDoc); + } +} + +int ContractionState::DocFromDisplay(int lineDisplay) const { + if (OneToOne()) { + return lineDisplay; + } else { + if (lineDisplay <= 0) { + return 0; + } + if (lineDisplay > LinesDisplayed()) { + return displayLines->PartitionFromPosition(LinesDisplayed()); + } + int lineDoc = displayLines->PartitionFromPosition(lineDisplay); + PLATFORM_ASSERT(GetVisible(lineDoc)); + return lineDoc; + } +} + +void ContractionState::InsertLine(int lineDoc) { + if (OneToOne()) { + linesInDocument++; + } else { + visible->InsertSpace(lineDoc, 1); + visible->SetValueAt(lineDoc, 1); + expanded->InsertSpace(lineDoc, 1); + expanded->SetValueAt(lineDoc, 1); + heights->InsertSpace(lineDoc, 1); + heights->SetValueAt(lineDoc, 1); + int lineDisplay = DisplayFromDoc(lineDoc); + displayLines->InsertPartition(lineDoc, lineDisplay); + displayLines->InsertText(lineDoc, 1); + } +} + +void ContractionState::InsertLines(int lineDoc, int lineCount) { + for (int l = 0; l < lineCount; l++) { + InsertLine(lineDoc + l); + } + Check(); +} + +void ContractionState::DeleteLine(int lineDoc) { + if (OneToOne()) { + linesInDocument--; + } else { + if (GetVisible(lineDoc)) { + displayLines->InsertText(lineDoc, -heights->ValueAt(lineDoc)); + } + displayLines->RemovePartition(lineDoc); + visible->DeleteRange(lineDoc, 1); + expanded->DeleteRange(lineDoc, 1); + heights->DeleteRange(lineDoc, 1); + } +} + +void ContractionState::DeleteLines(int lineDoc, int lineCount) { + for (int l = 0; l < lineCount; l++) { + DeleteLine(lineDoc); + } + Check(); +} + +bool ContractionState::GetVisible(int lineDoc) const { + if (OneToOne()) { + return true; + } else { + if (lineDoc >= visible->Length()) + return true; + return visible->ValueAt(lineDoc) == 1; + } +} + +bool ContractionState::SetVisible(int lineDocStart, int lineDocEnd, bool visible_) { + if (OneToOne() && visible_) { + return false; + } else { + EnsureData(); + int delta = 0; + Check(); + if ((lineDocStart <= lineDocEnd) && (lineDocStart >= 0) && (lineDocEnd < LinesInDoc())) { + for (int line = lineDocStart; line <= lineDocEnd; line++) { + if (GetVisible(line) != visible_) { + int difference = visible_ ? heights->ValueAt(line) : -heights->ValueAt(line); + visible->SetValueAt(line, visible_ ? 1 : 0); + displayLines->InsertText(line, difference); + delta += difference; + } + } + } else { + return false; + } + Check(); + return delta != 0; + } +} + +bool ContractionState::GetExpanded(int lineDoc) const { + if (OneToOne()) { + return true; + } else { + Check(); + return expanded->ValueAt(lineDoc) == 1; + } +} + +bool ContractionState::SetExpanded(int lineDoc, bool expanded_) { + if (OneToOne() && expanded_) { + return false; + } else { + EnsureData(); + if (expanded_ != (expanded->ValueAt(lineDoc) == 1)) { + expanded->SetValueAt(lineDoc, expanded_ ? 1 : 0); + Check(); + return true; + } else { + Check(); + return false; + } + } +} + +int ContractionState::GetHeight(int lineDoc) const { + if (OneToOne()) { + return 1; + } else { + return heights->ValueAt(lineDoc); + } +} + +// Set the number of display lines needed for this line. +// Return true if this is a change. +bool ContractionState::SetHeight(int lineDoc, int height) { + if (OneToOne() && (height == 1)) { + return false; + } else { + EnsureData(); + if (GetHeight(lineDoc) != height) { + if (GetVisible(lineDoc)) { + displayLines->InsertText(lineDoc, height - GetHeight(lineDoc)); + } + heights->SetValueAt(lineDoc, height); + Check(); + return true; + } else { + Check(); + return false; + } + } +} + +void ContractionState::ShowAll() { + int lines = LinesInDoc(); + Clear(); + linesInDocument = lines; +} + +// Debugging checks + +void ContractionState::Check() const { +#ifdef CHECK_CORRECTNESS + for (int vline = 0;vline < LinesDisplayed(); vline++) { + const int lineDoc = DocFromDisplay(vline); + PLATFORM_ASSERT(GetVisible(lineDoc)); + } + for (int lineDoc = 0;lineDoc < LinesInDoc(); lineDoc++) { + const int displayThis = DisplayFromDoc(lineDoc); + const int displayNext = DisplayFromDoc(lineDoc + 1); + const int height = displayNext - displayThis; + PLATFORM_ASSERT(height >= 0); + if (GetVisible(lineDoc)) { + PLATFORM_ASSERT(GetHeight(lineDoc) == height); + } else { + PLATFORM_ASSERT(0 == height); + } + } +#endif +} diff --git a/sdk/wxscintilla/src/scintilla/src/ContractionState.h b/sdk/wxscintilla/src/scintilla/src/ContractionState.h index 20a98564e1..ba62975128 100644 --- a/sdk/wxscintilla/src/scintilla/src/ContractionState.h +++ b/sdk/wxscintilla/src/scintilla/src/ContractionState.h @@ -1,66 +1,66 @@ -// Scintilla source code edit control -/** @file ContractionState.h - ** Manages visibility of lines for folding and wrapping. - **/ -// Copyright 1998-2007 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef CONTRACTIONSTATE_H -#define CONTRACTIONSTATE_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -/** - */ -class ContractionState { - // These contain 1 element for every document line. - RunStyles *visible; - RunStyles *expanded; - RunStyles *heights; - Partitioning *displayLines; - int linesInDocument; - - void EnsureData(); - - bool OneToOne() const { - // True when each document line is exactly one display line so need for - // complex data structures. - return visible == 0; - } - -public: - ContractionState(); - virtual ~ContractionState(); - - void Clear(); - - int LinesInDoc() const; - int LinesDisplayed() const; - int DisplayFromDoc(int lineDoc) const; - int DocFromDisplay(int lineDisplay) const; - - void InsertLine(int lineDoc); - void InsertLines(int lineDoc, int lineCount); - void DeleteLine(int lineDoc); - void DeleteLines(int lineDoc, int lineCount); - - bool GetVisible(int lineDoc) const; - bool SetVisible(int lineDocStart, int lineDocEnd, bool visible); - - bool GetExpanded(int lineDoc) const; - bool SetExpanded(int lineDoc, bool expanded); - - int GetHeight(int lineDoc) const; - bool SetHeight(int lineDoc, int height); - - void ShowAll(); - void Check() const; -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif +// Scintilla source code edit control +/** @file ContractionState.h + ** Manages visibility of lines for folding and wrapping. + **/ +// Copyright 1998-2007 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef CONTRACTIONSTATE_H +#define CONTRACTIONSTATE_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +/** + */ +class ContractionState { + // These contain 1 element for every document line. + RunStyles *visible; + RunStyles *expanded; + RunStyles *heights; + Partitioning *displayLines; + int linesInDocument; + + void EnsureData(); + + bool OneToOne() const { + // True when each document line is exactly one display line so need for + // complex data structures. + return visible == 0; + } + +public: + ContractionState(); + virtual ~ContractionState(); + + void Clear(); + + int LinesInDoc() const; + int LinesDisplayed() const; + int DisplayFromDoc(int lineDoc) const; + int DocFromDisplay(int lineDisplay) const; + + void InsertLine(int lineDoc); + void InsertLines(int lineDoc, int lineCount); + void DeleteLine(int lineDoc); + void DeleteLines(int lineDoc, int lineCount); + + bool GetVisible(int lineDoc) const; + bool SetVisible(int lineDocStart, int lineDocEnd, bool visible); + + bool GetExpanded(int lineDoc) const; + bool SetExpanded(int lineDoc, bool expanded); + + int GetHeight(int lineDoc) const; + bool SetHeight(int lineDoc, int height); + + void ShowAll(); + void Check() const; +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/sdk/wxscintilla/src/scintilla/src/Decoration.cxx b/sdk/wxscintilla/src/scintilla/src/Decoration.cxx index cb84e26d11..e4ac0e07c6 100644 --- a/sdk/wxscintilla/src/scintilla/src/Decoration.cxx +++ b/sdk/wxscintilla/src/scintilla/src/Decoration.cxx @@ -1,188 +1,188 @@ -/** @file Decoration.cxx - ** Visual elements added over text. - **/ -// Copyright 1998-2007 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include - -#include "Platform.h" - -#include "Scintilla.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" -#include "Decoration.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -Decoration::Decoration(int indicator_) : next(0), indicator(indicator_) { -} - -Decoration::~Decoration() { -} - -bool Decoration::Empty() { - return rs.starts->Partitions() == 1; -} - -DecorationList::DecorationList() : currentIndicator(0), currentValue(1), current(0), - lengthDocument(0), root(0), clickNotified(false) { -} - -DecorationList::~DecorationList() { - Decoration *deco = root; - while (deco) { - Decoration *decoNext = deco->next; - delete deco; - deco = decoNext; - } - root = 0; - current = 0; -} - -Decoration *DecorationList::DecorationFromIndicator(int indicator) { - for (Decoration *deco=root; deco; deco = deco->next) { - if (deco->indicator == indicator) { - return deco; - } - } - return 0; -} - -Decoration *DecorationList::Create(int indicator, int length) { - currentIndicator = indicator; - Decoration *decoNew = new Decoration(indicator); - decoNew->rs.InsertSpace(0, length); - - Decoration *decoPrev = 0; - Decoration *deco = root; - - while (deco && (deco->indicator < indicator)) { - decoPrev = deco; - deco = deco->next; - } - if (decoPrev == 0) { - decoNew->next = root; - root = decoNew; - } else { - decoNew->next = deco; - decoPrev->next = decoNew; - } - return decoNew; -} - -void DecorationList::Delete(int indicator) { - Decoration *decoToDelete = 0; - if (root) { - if (root->indicator == indicator) { - decoToDelete = root; - root = root->next; - } else { - Decoration *deco=root; - while (deco->next && !decoToDelete) { - if (deco->next && deco->next->indicator == indicator) { - decoToDelete = deco->next; - deco->next = decoToDelete->next; - } else { - deco = deco->next; - } - } - } - } - if (decoToDelete) { - delete decoToDelete; - current = 0; - } -} - -void DecorationList::SetCurrentIndicator(int indicator) { - currentIndicator = indicator; - current = DecorationFromIndicator(indicator); - currentValue = 1; -} - -void DecorationList::SetCurrentValue(int value) { - currentValue = value ? value : 1; -} - -bool DecorationList::FillRange(int &position, int value, int &fillLength) { - if (!current) { - current = DecorationFromIndicator(currentIndicator); - if (!current) { - current = Create(currentIndicator, lengthDocument); - } - } - bool changed = current->rs.FillRange(position, value, fillLength); - if (current->Empty()) { - Delete(currentIndicator); - } - return changed; -} - -void DecorationList::InsertSpace(int position, int insertLength) { - lengthDocument += insertLength; - for (Decoration *deco=root; deco; deco = deco->next) { - deco->rs.InsertSpace(position, insertLength); - } -} - -void DecorationList::DeleteRange(int position, int deleteLength) { - lengthDocument -= deleteLength; - Decoration *deco; - for (deco=root; deco; deco = deco->next) { - deco->rs.DeleteRange(position, deleteLength); - } - DeleteAnyEmpty(); -} - -void DecorationList::DeleteAnyEmpty() { - Decoration *deco = root; - while (deco) { - if (deco->Empty()) { - Delete(deco->indicator); - deco = root; - } else { - deco = deco->next; - } - } -} - -int DecorationList::AllOnFor(int position) { - int mask = 0; - for (Decoration *deco=root; deco; deco = deco->next) { - if (deco->rs.ValueAt(position)) { - mask |= 1 << deco->indicator; - } - } - return mask; -} - -int DecorationList::ValueAt(int indicator, int position) { - Decoration *deco = DecorationFromIndicator(indicator); - if (deco) { - return deco->rs.ValueAt(position); - } - return 0; -} - -int DecorationList::Start(int indicator, int position) { - Decoration *deco = DecorationFromIndicator(indicator); - if (deco) { - return deco->rs.StartRun(position); - } - return 0; -} - -int DecorationList::End(int indicator, int position) { - Decoration *deco = DecorationFromIndicator(indicator); - if (deco) { - return deco->rs.EndRun(position); - } - return 0; -} +/** @file Decoration.cxx + ** Visual elements added over text. + **/ +// Copyright 1998-2007 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include + +#include "Platform.h" + +#include "Scintilla.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" +#include "Decoration.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +Decoration::Decoration(int indicator_) : next(0), indicator(indicator_) { +} + +Decoration::~Decoration() { +} + +bool Decoration::Empty() { + return rs.starts->Partitions() == 1; +} + +DecorationList::DecorationList() : currentIndicator(0), currentValue(1), current(0), + lengthDocument(0), root(0), clickNotified(false) { +} + +DecorationList::~DecorationList() { + Decoration *deco = root; + while (deco) { + Decoration *decoNext = deco->next; + delete deco; + deco = decoNext; + } + root = 0; + current = 0; +} + +Decoration *DecorationList::DecorationFromIndicator(int indicator) { + for (Decoration *deco=root; deco; deco = deco->next) { + if (deco->indicator == indicator) { + return deco; + } + } + return 0; +} + +Decoration *DecorationList::Create(int indicator, int length) { + currentIndicator = indicator; + Decoration *decoNew = new Decoration(indicator); + decoNew->rs.InsertSpace(0, length); + + Decoration *decoPrev = 0; + Decoration *deco = root; + + while (deco && (deco->indicator < indicator)) { + decoPrev = deco; + deco = deco->next; + } + if (decoPrev == 0) { + decoNew->next = root; + root = decoNew; + } else { + decoNew->next = deco; + decoPrev->next = decoNew; + } + return decoNew; +} + +void DecorationList::Delete(int indicator) { + Decoration *decoToDelete = 0; + if (root) { + if (root->indicator == indicator) { + decoToDelete = root; + root = root->next; + } else { + Decoration *deco=root; + while (deco->next && !decoToDelete) { + if (deco->next && deco->next->indicator == indicator) { + decoToDelete = deco->next; + deco->next = decoToDelete->next; + } else { + deco = deco->next; + } + } + } + } + if (decoToDelete) { + delete decoToDelete; + current = 0; + } +} + +void DecorationList::SetCurrentIndicator(int indicator) { + currentIndicator = indicator; + current = DecorationFromIndicator(indicator); + currentValue = 1; +} + +void DecorationList::SetCurrentValue(int value) { + currentValue = value ? value : 1; +} + +bool DecorationList::FillRange(int &position, int value, int &fillLength) { + if (!current) { + current = DecorationFromIndicator(currentIndicator); + if (!current) { + current = Create(currentIndicator, lengthDocument); + } + } + bool changed = current->rs.FillRange(position, value, fillLength); + if (current->Empty()) { + Delete(currentIndicator); + } + return changed; +} + +void DecorationList::InsertSpace(int position, int insertLength) { + lengthDocument += insertLength; + for (Decoration *deco=root; deco; deco = deco->next) { + deco->rs.InsertSpace(position, insertLength); + } +} + +void DecorationList::DeleteRange(int position, int deleteLength) { + lengthDocument -= deleteLength; + Decoration *deco; + for (deco=root; deco; deco = deco->next) { + deco->rs.DeleteRange(position, deleteLength); + } + DeleteAnyEmpty(); +} + +void DecorationList::DeleteAnyEmpty() { + Decoration *deco = root; + while (deco) { + if (deco->Empty()) { + Delete(deco->indicator); + deco = root; + } else { + deco = deco->next; + } + } +} + +int DecorationList::AllOnFor(int position) { + int mask = 0; + for (Decoration *deco=root; deco; deco = deco->next) { + if (deco->rs.ValueAt(position)) { + mask |= 1 << deco->indicator; + } + } + return mask; +} + +int DecorationList::ValueAt(int indicator, int position) { + Decoration *deco = DecorationFromIndicator(indicator); + if (deco) { + return deco->rs.ValueAt(position); + } + return 0; +} + +int DecorationList::Start(int indicator, int position) { + Decoration *deco = DecorationFromIndicator(indicator); + if (deco) { + return deco->rs.StartRun(position); + } + return 0; +} + +int DecorationList::End(int indicator, int position) { + Decoration *deco = DecorationFromIndicator(indicator); + if (deco) { + return deco->rs.EndRun(position); + } + return 0; +} diff --git a/sdk/wxscintilla/src/scintilla/src/Decoration.h b/sdk/wxscintilla/src/scintilla/src/Decoration.h index 25c28e5c05..2809641afd 100644 --- a/sdk/wxscintilla/src/scintilla/src/Decoration.h +++ b/sdk/wxscintilla/src/scintilla/src/Decoration.h @@ -1,64 +1,64 @@ -/** @file Decoration.h - ** Visual elements added over text. - **/ -// Copyright 1998-2007 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef DECORATION_H -#define DECORATION_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -class Decoration { -public: - Decoration *next; - RunStyles rs; - int indicator; - - Decoration(int indicator_); - ~Decoration(); - - bool Empty(); -}; - -class DecorationList { - int currentIndicator; - int currentValue; - Decoration *current; - int lengthDocument; - Decoration *DecorationFromIndicator(int indicator); - Decoration *Create(int indicator, int length); - void Delete(int indicator); - void DeleteAnyEmpty(); -public: - Decoration *root; - bool clickNotified; - - DecorationList(); - ~DecorationList(); - - void SetCurrentIndicator(int indicator); - int GetCurrentIndicator() { return currentIndicator; } - - void SetCurrentValue(int value); - int GetCurrentValue() { return currentValue; } - - // Returns true if some values may have changed - bool FillRange(int &position, int value, int &fillLength); - - void InsertSpace(int position, int insertLength); - void DeleteRange(int position, int deleteLength); - - int AllOnFor(int position); - int ValueAt(int indicator, int position); - int Start(int indicator, int position); - int End(int indicator, int position); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif +/** @file Decoration.h + ** Visual elements added over text. + **/ +// Copyright 1998-2007 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef DECORATION_H +#define DECORATION_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +class Decoration { +public: + Decoration *next; + RunStyles rs; + int indicator; + + Decoration(int indicator_); + ~Decoration(); + + bool Empty(); +}; + +class DecorationList { + int currentIndicator; + int currentValue; + Decoration *current; + int lengthDocument; + Decoration *DecorationFromIndicator(int indicator); + Decoration *Create(int indicator, int length); + void Delete(int indicator); + void DeleteAnyEmpty(); +public: + Decoration *root; + bool clickNotified; + + DecorationList(); + ~DecorationList(); + + void SetCurrentIndicator(int indicator); + int GetCurrentIndicator() { return currentIndicator; } + + void SetCurrentValue(int value); + int GetCurrentValue() { return currentValue; } + + // Returns true if some values may have changed + bool FillRange(int &position, int value, int &fillLength); + + void InsertSpace(int position, int insertLength); + void DeleteRange(int position, int deleteLength); + + int AllOnFor(int position); + int ValueAt(int indicator, int position); + int Start(int indicator, int position); + int End(int indicator, int position); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/sdk/wxscintilla/src/scintilla/src/Document.cxx b/sdk/wxscintilla/src/scintilla/src/Document.cxx index 8af1bfe1b5..ab29c798a2 100644 --- a/sdk/wxscintilla/src/scintilla/src/Document.cxx +++ b/sdk/wxscintilla/src/scintilla/src/Document.cxx @@ -1,1632 +1,1813 @@ -// Scintilla source code edit control -/** @file Document.cxx - ** Text document that handles notifications, DBCS, styling, words and end of line. - **/ -// Copyright 1998-2003 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include - -#include "Platform.h" - -#include "Scintilla.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" -#include "CellBuffer.h" -#include "CharClassify.h" -#include "Decoration.h" -#include "Document.h" -#include "RESearch.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -// This is ASCII specific but is safe with chars >= 0x80 -static inline bool isspacechar(unsigned char ch) { - return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); -} - -static inline bool IsPunctuation(char ch) { - return isascii(ch) && ispunct(ch); -} - -static inline bool IsADigit(char ch) { - return isascii(ch) && isdigit(ch); -} - -static inline bool IsLowerCase(char ch) { - return isascii(ch) && islower(ch); -} - -static inline bool IsUpperCase(char ch) { - return isascii(ch) && isupper(ch); -} - -Document::Document() { - refCount = 0; -#ifdef unix - eolMode = SC_EOL_LF; -#else - eolMode = SC_EOL_CRLF; -#endif - dbcsCodePage = 0; - stylingBits = 5; - stylingBitsMask = 0x1F; - stylingMask = 0; - endStyled = 0; - styleClock = 0; - enteredModification = 0; - enteredStyling = 0; - enteredReadOnlyCount = 0; - tabInChars = 8; - indentInChars = 0; - actualIndentInChars = 8; - useTabs = true; - tabIndents = true; - backspaceUnindents = false; - watchers = 0; - lenWatchers = 0; - - matchesValid = false; - pre = 0; - substituted = 0; -} - -Document::~Document() { - for (int i = 0; i < lenWatchers; i++) { - watchers[i].watcher->NotifyDeleted(this, watchers[i].userData); - } - delete []watchers; - watchers = 0; - lenWatchers = 0; - delete pre; - pre = 0; - delete []substituted; - substituted = 0; -} - -// Increase reference count and return its previous value. -int Document::AddRef() { - return refCount++; -} - -// Decrease reference count and return its previous value. -// Delete the document if reference count reaches zero. -int Document::Release() { - int curRefCount = --refCount; - if (curRefCount == 0) - delete this; - return curRefCount; -} - -void Document::SetSavePoint() { - cb.SetSavePoint(); - NotifySavePoint(true); -} - -int Document::AddMark(int line, int markerNum) { - int prev = cb.AddMark(line, markerNum); - DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); - NotifyModified(mh); - return prev; -} - -void Document::AddMarkSet(int line, int valueSet) { - unsigned int m = valueSet; - for (int i = 0; m; i++, m >>= 1) - if (m & 1) - cb.AddMark(line, i); - DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); - NotifyModified(mh); -} - -void Document::DeleteMark(int line, int markerNum) { - cb.DeleteMark(line, markerNum); - DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); - NotifyModified(mh); -} - -void Document::DeleteMarkFromHandle(int markerHandle) { - cb.DeleteMarkFromHandle(markerHandle); - DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); - mh.line = -1; - NotifyModified(mh); -} - -void Document::DeleteAllMarks(int markerNum) { - cb.DeleteAllMarks(markerNum); - DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); - mh.line = -1; - NotifyModified(mh); -} - -int Document::LineStart(int line) const { - return cb.LineStart(line); -} - -int Document::LineEnd(int line) const { - if (line == LinesTotal() - 1) { - return LineStart(line + 1); - } else { - int position = LineStart(line + 1) - 1; - // When line terminator is CR+LF, may need to go back one more - if ((position > LineStart(line)) && (cb.CharAt(position - 1) == '\r')) { - position--; - } - return position; - } -} - -int Document::LineFromPosition(int pos) { - return cb.LineFromPosition(pos); -} - -int Document::LineEndPosition(int position) { - return LineEnd(LineFromPosition(position)); -} - -int Document::VCHomePosition(int position) { - int line = LineFromPosition(position); - int startPosition = LineStart(line); - int endLine = LineStart(line + 1) - 1; - int startText = startPosition; - while (startText < endLine && (cb.CharAt(startText) == ' ' || cb.CharAt(startText) == '\t' ) ) - startText++; - if (position == startText) - return startPosition; - else - return startText; -} - -int Document::SetLevel(int line, int level) { - int prev = cb.SetLevel(line, level); - if (prev != level) { - DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER, - LineStart(line), 0, 0, 0, line); - mh.foldLevelNow = level; - mh.foldLevelPrev = prev; - NotifyModified(mh); - } - return prev; -} - -static bool IsSubordinate(int levelStart, int levelTry) { - if (levelTry & SC_FOLDLEVELWHITEFLAG) - return true; - else - return (levelStart & SC_FOLDLEVELNUMBERMASK) < (levelTry & SC_FOLDLEVELNUMBERMASK); -} - -int Document::GetLastChild(int lineParent, int level) { - if (level == -1) - level = GetLevel(lineParent) & SC_FOLDLEVELNUMBERMASK; - int maxLine = LinesTotal(); - int lineMaxSubord = lineParent; - while (lineMaxSubord < maxLine - 1) { - EnsureStyledTo(LineStart(lineMaxSubord + 2)); - if (!IsSubordinate(level, GetLevel(lineMaxSubord + 1))) - break; - lineMaxSubord++; - } - if (lineMaxSubord > lineParent) { - if (level > (GetLevel(lineMaxSubord + 1) & SC_FOLDLEVELNUMBERMASK)) { - // Have chewed up some whitespace that belongs to a parent so seek back - if (GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG) { - lineMaxSubord--; - } - } - } - return lineMaxSubord; -} - -int Document::GetFoldParent(int line) { - int level = GetLevel(line) & SC_FOLDLEVELNUMBERMASK; - int lineLook = line - 1; - while ((lineLook > 0) && ( - (!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) || - ((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) >= level)) - ) { - lineLook--; - } - if ((GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG) && - ((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) < level)) { - return lineLook; - } else { - return -1; - } -} - -int Document::ClampPositionIntoDocument(int pos) { - return Platform::Clamp(pos, 0, Length()); -} - -bool Document::IsCrLf(int pos) { - if (pos < 0) - return false; - if (pos >= (Length() - 1)) - return false; - return (cb.CharAt(pos) == '\r') && (cb.CharAt(pos + 1) == '\n'); -} - -static const int maxBytesInDBCSCharacter=5; - -int Document::LenChar(int pos) { - if (pos < 0) { - return 1; - } else if (IsCrLf(pos)) { - return 2; - } else if (SC_CP_UTF8 == dbcsCodePage) { - unsigned char ch = static_cast(cb.CharAt(pos)); - if (ch < 0x80) - return 1; - int len = 2; - if (ch >= (0x80 + 0x40 + 0x20 + 0x10)) - len = 4; - else if (ch >= (0x80 + 0x40 + 0x20)) - len = 3; - int lengthDoc = Length(); - if ((pos + len) > lengthDoc) - return lengthDoc -pos; - else - return len; - } else if (dbcsCodePage) { - char mbstr[maxBytesInDBCSCharacter+1]; - int i; - for (i=0; i= 0x80) && (ch < (0x80 + 0x40)); -} - -static int BytesFromLead(int leadByte) { - if (leadByte > 0xF4) { - // Characters longer than 4 bytes not possible in current UTF-8 - return 0; - } else if (leadByte >= 0xF0) { - return 4; - } else if (leadByte >= 0xE0) { - return 3; - } else if (leadByte >= 0xC2) { - return 2; - } - return 0; -} - -bool Document::InGoodUTF8(int pos, int &start, int &end) { - int lead = pos; - while ((lead>0) && (pos-lead < 4) && IsTrailByte(static_cast(cb.CharAt(lead-1)))) - lead--; - start = 0; - if (lead > 0) { - start = lead-1; - } - int leadByte = static_cast(cb.CharAt(start)); - int bytes = BytesFromLead(leadByte); - if (bytes == 0) { - return false; - } else { - int trailBytes = bytes - 1; - int len = pos - lead + 1; - if (len > trailBytes) - // pos too far from lead - return false; - // Check that there are enough trails for this lead - int trail = pos + 1; - while ((trail-lead(cb.CharAt(trail)))) { - return false; - } - trail++; - } - end = start + bytes; - return true; - } -} - -// Normalise a position so that it is not halfway through a two byte character. -// This can occur in two situations - -// When lines are terminated with \r\n pairs which should be treated as one character. -// When displaying DBCS text such as Japanese. -// If moving, move the position in the indicated direction. -int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) { - //Platform::DebugPrintf("NoCRLF %d %d\n", pos, moveDir); - // If out of range, just return minimum/maximum value. - if (pos <= 0) - return 0; - if (pos >= Length()) - return Length(); - - // PLATFORM_ASSERT(pos > 0 && pos < Length()); - if (checkLineEnd && IsCrLf(pos - 1)) { - if (moveDir > 0) - return pos + 1; - else - return pos - 1; - } - - // Not between CR and LF - - if (dbcsCodePage) { - if (SC_CP_UTF8 == dbcsCodePage) { - unsigned char ch = static_cast(cb.CharAt(pos)); - int startUTF = pos; - int endUTF = pos; - if (IsTrailByte(ch) && InGoodUTF8(pos, startUTF, endUTF)) { - // ch is a trail byte within a UTF-8 character - if (moveDir > 0) - pos = endUTF; - else - pos = startUTF; - } - } else { - // Anchor DBCS calculations at start of line because start of line can - // not be a DBCS trail byte. - int posCheck = LineStart(LineFromPosition(pos)); - while (posCheck < pos) { - char mbstr[maxBytesInDBCSCharacter+1]; - int i; - for(i=0;i pos) { - if (moveDir > 0) { - return posCheck + mbsize; - } else { - return posCheck; - } - } - posCheck += mbsize; - } - } - } - - return pos; -} - -void Document::ModifiedAt(int pos) { - if (endStyled > pos) - endStyled = pos; -} - -void Document::CheckReadOnly() { - if (cb.IsReadOnly() && enteredReadOnlyCount == 0) { - enteredReadOnlyCount++; - NotifyModifyAttempt(); - enteredReadOnlyCount--; - } -} - -// Document only modified by gateways DeleteChars, InsertString, Undo, Redo, and SetStyleAt. -// SetStyleAt does not change the persistent state of a document - -bool Document::DeleteChars(int pos, int len) { - if (len == 0) - return false; - if ((pos + len) > Length()) - return false; - CheckReadOnly(); - if (enteredModification != 0) { - return false; - } else { - enteredModification++; - if (!cb.IsReadOnly()) { - NotifyModified( - DocModification( - SC_MOD_BEFOREDELETE | SC_PERFORMED_USER, - pos, len, - 0, 0)); - int prevLinesTotal = LinesTotal(); - bool startSavePoint = cb.IsSavePoint(); - bool startSequence = false; - const char *text = cb.DeleteChars(pos, len, startSequence); - if (startSavePoint && cb.IsCollectingUndo()) - NotifySavePoint(!startSavePoint); - if ((pos < Length()) || (pos == 0)) - ModifiedAt(pos); - else - ModifiedAt(pos-1); - NotifyModified( - DocModification( - SC_MOD_DELETETEXT | SC_PERFORMED_USER | (startSequence?SC_STARTACTION:0), - pos, len, - LinesTotal() - prevLinesTotal, text)); - } - enteredModification--; - } - return !cb.IsReadOnly(); -} - -/** - * Insert a string with a length. - */ -bool Document::InsertString(int position, const char *s, int insertLength) { - if (insertLength <= 0) { - return false; - } - CheckReadOnly(); - if (enteredModification != 0) { - return false; - } else { - enteredModification++; - if (!cb.IsReadOnly()) { - NotifyModified( - DocModification( - SC_MOD_BEFOREINSERT | SC_PERFORMED_USER, - position, insertLength, - 0, s)); - int prevLinesTotal = LinesTotal(); - bool startSavePoint = cb.IsSavePoint(); - bool startSequence = false; - const char *text = cb.InsertString(position, s, insertLength, startSequence); - if (startSavePoint && cb.IsCollectingUndo()) - NotifySavePoint(!startSavePoint); - ModifiedAt(position); - NotifyModified( - DocModification( - SC_MOD_INSERTTEXT | SC_PERFORMED_USER | (startSequence?SC_STARTACTION:0), - position, insertLength, - LinesTotal() - prevLinesTotal, text)); - } - enteredModification--; - } - return !cb.IsReadOnly(); -} - -int Document::Undo() { - int newPos = -1; - CheckReadOnly(); - if (enteredModification == 0) { - enteredModification++; - if (!cb.IsReadOnly()) { - bool startSavePoint = cb.IsSavePoint(); - bool multiLine = false; - int steps = cb.StartUndo(); - //Platform::DebugPrintf("Steps=%d\n", steps); - for (int step = 0; step < steps; step++) { - const int prevLinesTotal = LinesTotal(); - const Action &action = cb.GetUndoStep(); - if (action.at == removeAction) { - NotifyModified(DocModification( - SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action)); - } else { - NotifyModified(DocModification( - SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action)); - } - cb.PerformUndoStep(); - int cellPosition = action.position; - ModifiedAt(cellPosition); - newPos = cellPosition; - - int modFlags = SC_PERFORMED_UNDO; - // With undo, an insertion action becomes a deletion notification - if (action.at == removeAction) { - newPos += action.lenData; - modFlags |= SC_MOD_INSERTTEXT; - } else { - modFlags |= SC_MOD_DELETETEXT; - } - if (steps > 1) - modFlags |= SC_MULTISTEPUNDOREDO; - const int linesAdded = LinesTotal() - prevLinesTotal; - if (linesAdded != 0) - multiLine = true; - if (step == steps - 1) { - modFlags |= SC_LASTSTEPINUNDOREDO; - if (multiLine) - modFlags |= SC_MULTILINEUNDOREDO; - } - NotifyModified(DocModification(modFlags, cellPosition, action.lenData, - linesAdded, action.data)); - } - - bool endSavePoint = cb.IsSavePoint(); - if (startSavePoint != endSavePoint) - NotifySavePoint(endSavePoint); - } - enteredModification--; - } - return newPos; -} - -int Document::Redo() { - int newPos = -1; - CheckReadOnly(); - if (enteredModification == 0) { - enteredModification++; - if (!cb.IsReadOnly()) { - bool startSavePoint = cb.IsSavePoint(); - bool multiLine = false; - int steps = cb.StartRedo(); - for (int step = 0; step < steps; step++) { - const int prevLinesTotal = LinesTotal(); - const Action &action = cb.GetRedoStep(); - if (action.at == insertAction) { - NotifyModified(DocModification( - SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action)); - } else { - NotifyModified(DocModification( - SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action)); - } - cb.PerformRedoStep(); - ModifiedAt(action.position); - newPos = action.position; - - int modFlags = SC_PERFORMED_REDO; - if (action.at == insertAction) { - newPos += action.lenData; - modFlags |= SC_MOD_INSERTTEXT; - } else { - modFlags |= SC_MOD_DELETETEXT; - } - if (steps > 1) - modFlags |= SC_MULTISTEPUNDOREDO; - const int linesAdded = LinesTotal() - prevLinesTotal; - if (linesAdded != 0) - multiLine = true; - if (step == steps - 1) { - modFlags |= SC_LASTSTEPINUNDOREDO; - if (multiLine) - modFlags |= SC_MULTILINEUNDOREDO; - } - NotifyModified( - DocModification(modFlags, action.position, action.lenData, - linesAdded, action.data)); - } - - bool endSavePoint = cb.IsSavePoint(); - if (startSavePoint != endSavePoint) - NotifySavePoint(endSavePoint); - } - enteredModification--; - } - return newPos; -} - -/** - * Insert a single character. - */ -bool Document::InsertChar(int pos, char ch) { - char chs[1]; - chs[0] = ch; - return InsertString(pos, chs, 1); -} - -/** - * Insert a null terminated string. - */ -bool Document::InsertCString(int position, const char *s) { - return InsertString(position, s, strlen(s)); -} - -void Document::ChangeChar(int pos, char ch) { - DeleteChars(pos, 1); - InsertChar(pos, ch); -} - -void Document::DelChar(int pos) { - DeleteChars(pos, LenChar(pos)); -} - -void Document::DelCharBack(int pos) { - if (pos <= 0) { - return; - } else if (IsCrLf(pos - 2)) { - DeleteChars(pos - 2, 2); - } else if (dbcsCodePage) { - int startChar = MovePositionOutsideChar(pos - 1, -1, false); - DeleteChars(startChar, pos - startChar); - } else { - DeleteChars(pos - 1, 1); - } -} - -static bool isindentchar(char ch) { - return (ch == ' ') || (ch == '\t'); -} - -static int NextTab(int pos, int tabSize) { - return ((pos / tabSize) + 1) * tabSize; -} - -static void CreateIndentation(char *linebuf, int length, int indent, int tabSize, bool insertSpaces) { - length--; // ensure space for \0 - if (!insertSpaces) { - while ((indent >= tabSize) && (length > 0)) { - *linebuf++ = '\t'; - indent -= tabSize; - length--; - } - } - while ((indent > 0) && (length > 0)) { - *linebuf++ = ' '; - indent--; - length--; - } - *linebuf = '\0'; -} - -int Document::GetLineIndentation(int line) { - int indent = 0; - if ((line >= 0) && (line < LinesTotal())) { - int lineStart = LineStart(line); - int length = Length(); - for (int i = lineStart;i < length;i++) { - char ch = cb.CharAt(i); - if (ch == ' ') - indent++; - else if (ch == '\t') - indent = NextTab(indent, tabInChars); - else - return indent; - } - } - return indent; -} - -void Document::SetLineIndentation(int line, int indent) { - int indentOfLine = GetLineIndentation(line); - if (indent < 0) - indent = 0; - if (indent != indentOfLine) { - char linebuf[1000]; - CreateIndentation(linebuf, sizeof(linebuf), indent, tabInChars, !useTabs); - int thisLineStart = LineStart(line); - int indentPos = GetLineIndentPosition(line); - BeginUndoAction(); - DeleteChars(thisLineStart, indentPos - thisLineStart); - InsertCString(thisLineStart, linebuf); - EndUndoAction(); - } -} - -int Document::GetLineIndentPosition(int line) const { - if (line < 0) - return 0; - int pos = LineStart(line); - int length = Length(); - while ((pos < length) && isindentchar(cb.CharAt(pos))) { - pos++; - } - return pos; -} - -int Document::GetColumn(int pos) { - int column = 0; - int line = LineFromPosition(pos); - if ((line >= 0) && (line < LinesTotal())) { - for (int i = LineStart(line);i < pos;) { - char ch = cb.CharAt(i); - if (ch == '\t') { - column = NextTab(column, tabInChars); - i++; - } else if (ch == '\r') { - return column; - } else if (ch == '\n') { - return column; - } else if (i >= Length()) { - return column; - } else { - column++; - i = MovePositionOutsideChar(i + 1, 1, false); - } - } - } - return column; -} - -int Document::FindColumn(int line, int column) { - int position = LineStart(line); - int columnCurrent = 0; - if ((line >= 0) && (line < LinesTotal())) { - while ((columnCurrent < column) && (position < Length())) { - char ch = cb.CharAt(position); - if (ch == '\t') { - columnCurrent = NextTab(columnCurrent, tabInChars); - position++; - } else if (ch == '\r') { - return position; - } else if (ch == '\n') { - return position; - } else { - columnCurrent++; - position = MovePositionOutsideChar(position + 1, 1, false); - } - } - } - return position; -} - -void Document::Indent(bool forwards, int lineBottom, int lineTop) { - // Dedent - suck white space off the front of the line to dedent by equivalent of a tab - for (int line = lineBottom; line >= lineTop; line--) { - int indentOfLine = GetLineIndentation(line); - if (forwards) { - if (LineStart(line) < LineEnd(line)) { - SetLineIndentation(line, indentOfLine + IndentSize()); - } - } else { - SetLineIndentation(line, indentOfLine - IndentSize()); - } - } -} - -// Convert line endings for a piece of text to a particular mode. -// Stop at len or when a NUL is found. -// Caller must delete the returned pointer. -char *Document::TransformLineEnds(int *pLenOut, const char *s, size_t len, int eolMode) { - char *dest = new char[2 * len + 1]; - const char *sptr = s; - char *dptr = dest; - for (size_t i = 0; (i < len) && (*sptr != '\0'); i++) { - if (*sptr == '\n' || *sptr == '\r') { - if (eolMode == SC_EOL_CR) { - *dptr++ = '\r'; - } else if (eolMode == SC_EOL_LF) { - *dptr++ = '\n'; - } else { // eolMode == SC_EOL_CRLF - *dptr++ = '\r'; - *dptr++ = '\n'; - } - if ((*sptr == '\r') && (i+1 < len) && (*(sptr+1) == '\n')) { - i++; - sptr++; - } - sptr++; - } else { - *dptr++ = *sptr++; - } - } - *dptr++ = '\0'; - *pLenOut = (dptr - dest) - 1; - return dest; -} - -void Document::ConvertLineEnds(int eolModeSet) { - BeginUndoAction(); - - for (int pos = 0; pos < Length(); pos++) { - if (cb.CharAt(pos) == '\r') { - if (cb.CharAt(pos + 1) == '\n') { - // CRLF - if (eolModeSet == SC_EOL_CR) { - DeleteChars(pos + 1, 1); // Delete the LF - } else if (eolModeSet == SC_EOL_LF) { - DeleteChars(pos, 1); // Delete the CR - } else { - pos++; - } - } else { - // CR - if (eolModeSet == SC_EOL_CRLF) { - InsertString(pos + 1, "\n", 1); // Insert LF - pos++; - } else if (eolModeSet == SC_EOL_LF) { - InsertString(pos, "\n", 1); // Insert LF - DeleteChars(pos + 1, 1); // Delete CR - } - } - } else if (cb.CharAt(pos) == '\n') { - // LF - if (eolModeSet == SC_EOL_CRLF) { - InsertString(pos, "\r", 1); // Insert CR - pos++; - } else if (eolModeSet == SC_EOL_CR) { - InsertString(pos, "\r", 1); // Insert CR - DeleteChars(pos + 1, 1); // Delete LF - } - } - } - - EndUndoAction(); -} - -bool Document::IsWhiteLine(int line) const { - int currentChar = LineStart(line); - int endLine = LineEnd(line); - while (currentChar < endLine) { - if (cb.CharAt(currentChar) != ' ' && cb.CharAt(currentChar) != '\t') { - return false; - } - ++currentChar; - } - return true; -} - -int Document::ParaUp(int pos) { - int line = LineFromPosition(pos); - line--; - while (line >= 0 && IsWhiteLine(line)) { // skip empty lines - line--; - } - while (line >= 0 && !IsWhiteLine(line)) { // skip non-empty lines - line--; - } - line++; - return LineStart(line); -} - -int Document::ParaDown(int pos) { - int line = LineFromPosition(pos); - while (line < LinesTotal() && !IsWhiteLine(line)) { // skip non-empty lines - line++; - } - while (line < LinesTotal() && IsWhiteLine(line)) { // skip empty lines - line++; - } - if (line < LinesTotal()) - return LineStart(line); - else // end of a document - return LineEnd(line-1); -} - -CharClassify::cc Document::WordCharClass(unsigned char ch) { - if ((SC_CP_UTF8 == dbcsCodePage) && (ch >= 0x80)) - return CharClassify::ccWord; - return charClass.GetClass(ch); -} - -/** - * Used by commmands that want to select whole words. - * Finds the start of word at pos when delta < 0 or the end of the word when delta >= 0. - */ -int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) { - CharClassify::cc ccStart = CharClassify::ccWord; - if (delta < 0) { - if (!onlyWordCharacters) - ccStart = WordCharClass(cb.CharAt(pos-1)); - while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccStart)) - pos--; - } else { - if (!onlyWordCharacters && pos < Length()) - ccStart = WordCharClass(cb.CharAt(pos)); - while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart)) - pos++; - } - return MovePositionOutsideChar(pos, delta); -} - -/** - * Find the start of the next word in either a forward (delta >= 0) or backwards direction - * (delta < 0). - * This is looking for a transition between character classes although there is also some - * additional movement to transit white space. - * Used by cursor movement by word commands. - */ -int Document::NextWordStart(int pos, int delta) { - if (delta < 0) { - while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == CharClassify::ccSpace)) - pos--; - if (pos > 0) { - CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos-1)); - while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccStart)) { - pos--; - } - } - } else { - CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos)); - while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart)) - pos++; - while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == CharClassify::ccSpace)) - pos++; - } - return pos; -} - -/** - * Find the end of the next word in either a forward (delta >= 0) or backwards direction - * (delta < 0). - * This is looking for a transition between character classes although there is also some - * additional movement to transit white space. - * Used by cursor movement by word commands. - */ -int Document::NextWordEnd(int pos, int delta) { - if (delta < 0) { - if (pos > 0) { - CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos-1)); - if (ccStart != CharClassify::ccSpace) { - while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == ccStart) { - pos--; - } - } - while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == CharClassify::ccSpace) { - pos--; - } - } - } else { - while (pos < Length() && WordCharClass(cb.CharAt(pos)) == CharClassify::ccSpace) { - pos++; - } - if (pos < Length()) { - CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos)); - while (pos < Length() && WordCharClass(cb.CharAt(pos)) == ccStart) { - pos++; - } - } - } - return pos; -} - -/** - * Check that the character at the given position is a word or punctuation character and that - * the previous character is of a different character class. - */ -bool Document::IsWordStartAt(int pos) { - if (pos > 0) { - CharClassify::cc ccPos = WordCharClass(CharAt(pos)); - return (ccPos == CharClassify::ccWord || ccPos == CharClassify::ccPunctuation) && - (ccPos != WordCharClass(CharAt(pos - 1))); - } - return true; -} - -/** - * Check that the character at the given position is a word or punctuation character and that - * the next character is of a different character class. - */ -bool Document::IsWordEndAt(int pos) { - if (pos < Length()) { - CharClassify::cc ccPrev = WordCharClass(CharAt(pos-1)); - return (ccPrev == CharClassify::ccWord || ccPrev == CharClassify::ccPunctuation) && - (ccPrev != WordCharClass(CharAt(pos))); - } - return true; -} - -/** - * Check that the given range is has transitions between character classes at both - * ends and where the characters on the inside are word or punctuation characters. - */ -bool Document::IsWordAt(int start, int end) { - return IsWordStartAt(start) && IsWordEndAt(end); -} - -// The comparison and case changing functions here assume ASCII -// or extended ASCII such as the normal Windows code page. - -static inline char MakeUpperCase(char ch) { - if (ch < 'a' || ch > 'z') - return ch; - else - return static_cast(ch - 'a' + 'A'); -} - -static inline char MakeLowerCase(char ch) { - if (ch < 'A' || ch > 'Z') - return ch; - else - return static_cast(ch - 'A' + 'a'); -} - -// Define a way for the Regular Expression code to access the document -class DocumentIndexer : public CharacterIndexer { - Document *pdoc; - int end; -public: - DocumentIndexer(Document *pdoc_, int end_) : - pdoc(pdoc_), end(end_) { - } - - virtual ~DocumentIndexer() { - } - - virtual char CharAt(int index) { - if (index < 0 || index >= end) - return 0; - else - return pdoc->CharAt(index); - } -}; - -/** - * Find text in document, supporting both forward and backward - * searches (just pass minPos > maxPos to do a backward search) - * Has not been tested with backwards DBCS searches yet. - */ -long Document::FindText(int minPos, int maxPos, const char *s, - bool caseSensitive, bool word, bool wordStart, bool regExp, bool posix, - int *length) { - if (regExp) { - if (!pre) - pre = new RESearch(&charClass); - if (!pre) - return -1; - - int increment = (minPos <= maxPos) ? 1 : -1; - - int startPos = minPos; - int endPos = maxPos; - - // Range endpoints should not be inside DBCS characters, but just in case, move them. - startPos = MovePositionOutsideChar(startPos, 1, false); - endPos = MovePositionOutsideChar(endPos, 1, false); - - const char *errmsg = pre->Compile(s, *length, caseSensitive, posix); - if (errmsg) { - return -1; - } - // Find a variable in a property file: \$(\([A-Za-z0-9_.]+\)) - // Replace first '.' with '-' in each property file variable reference: - // Search: \$(\([A-Za-z0-9_-]+\)\.\([A-Za-z0-9_.]+\)) - // Replace: $(\1-\2) - int lineRangeStart = LineFromPosition(startPos); - int lineRangeEnd = LineFromPosition(endPos); - if ((increment == 1) && - (startPos >= LineEnd(lineRangeStart)) && - (lineRangeStart < lineRangeEnd)) { - // the start position is at end of line or between line end characters. - lineRangeStart++; - startPos = LineStart(lineRangeStart); - } - int pos = -1; - int lenRet = 0; - char searchEnd = s[*length - 1]; - int lineRangeBreak = lineRangeEnd + increment; - for (int line = lineRangeStart; line != lineRangeBreak; line += increment) { - int startOfLine = LineStart(line); - int endOfLine = LineEnd(line); - if (increment == 1) { - if (line == lineRangeStart) { - if ((startPos != startOfLine) && (s[0] == '^')) - continue; // Can't match start of line if start position after start of line - startOfLine = startPos; - } - if (line == lineRangeEnd) { - if ((endPos != endOfLine) && (searchEnd == '$')) - continue; // Can't match end of line if end position before end of line - endOfLine = endPos; - } - } else { - if (line == lineRangeEnd) { - if ((endPos != startOfLine) && (s[0] == '^')) - continue; // Can't match start of line if end position after start of line - startOfLine = endPos; - } - if (line == lineRangeStart) { - if ((startPos != endOfLine) && (searchEnd == '$')) - continue; // Can't match end of line if start position before end of line - endOfLine = startPos; - } - } - - DocumentIndexer di(this, endOfLine); - int success = pre->Execute(di, startOfLine, endOfLine); - if (success) { - pos = pre->bopat[0]; - lenRet = pre->eopat[0] - pre->bopat[0]; - if (increment == -1) { - // Check for the last match on this line. - int repetitions = 1000; // Break out of infinite loop - while (success && (pre->eopat[0] <= endOfLine) && (repetitions--)) { - success = pre->Execute(di, pos+1, endOfLine); - if (success) { - if (pre->eopat[0] <= minPos) { - pos = pre->bopat[0]; - lenRet = pre->eopat[0] - pre->bopat[0]; - } else { - success = 0; - } - } - } - } - break; - } - } - *length = lenRet; - return pos; - - } else { - - bool forward = minPos <= maxPos; - int increment = forward ? 1 : -1; - - // Range endpoints should not be inside DBCS characters, but just in case, move them. - int startPos = MovePositionOutsideChar(minPos, increment, false); - int endPos = MovePositionOutsideChar(maxPos, increment, false); - - // Compute actual search ranges needed - int lengthFind = *length; - if (lengthFind == -1) - lengthFind = static_cast(strlen(s)); - int endSearch = endPos; - if (startPos <= endPos) { - endSearch = endPos - lengthFind + 1; - } - //Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind); - char firstChar = s[0]; - if (!caseSensitive) - firstChar = static_cast(MakeUpperCase(firstChar)); - int pos = forward ? startPos : (startPos - 1); - while (forward ? (pos < endSearch) : (pos >= endSearch)) { - char ch = CharAt(pos); - if (caseSensitive) { - if (ch == firstChar) { - bool found = true; - if (pos + lengthFind > Platform::Maximum(startPos, endPos)) found = false; - for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) { - ch = CharAt(pos + posMatch); - if (ch != s[posMatch]) - found = false; - } - if (found) { - if ((!word && !wordStart) || - word && IsWordAt(pos, pos + lengthFind) || - wordStart && IsWordStartAt(pos)) - return pos; - } - } - } else { - if (MakeUpperCase(ch) == firstChar) { - bool found = true; - if (pos + lengthFind > Platform::Maximum(startPos, endPos)) found = false; - for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) { - ch = CharAt(pos + posMatch); - if (MakeUpperCase(ch) != MakeUpperCase(s[posMatch])) - found = false; - } - if (found) { - if ((!word && !wordStart) || - word && IsWordAt(pos, pos + lengthFind) || - wordStart && IsWordStartAt(pos)) - return pos; - } - } - } - pos += increment; - if (dbcsCodePage && (pos >= 0)) { - // Ensure trying to match from start of character - pos = MovePositionOutsideChar(pos, increment, false); - } - } - } - //Platform::DebugPrintf("Not found\n"); - return -1; -} - -const char *Document::SubstituteByPosition(const char *text, int *length) { - if (!pre) - return 0; - delete []substituted; - substituted = 0; - DocumentIndexer di(this, Length()); - if (!pre->GrabMatches(di)) - return 0; - unsigned int lenResult = 0; - for (int i = 0; i < *length; i++) { - if (text[i] == '\\') { - if (text[i + 1] >= '1' && text[i + 1] <= '9') { - unsigned int patNum = text[i + 1] - '0'; - lenResult += pre->eopat[patNum] - pre->bopat[patNum]; - i++; - } else { - switch (text[i + 1]) { - case 'a': - case 'b': - case 'f': - case 'n': - case 'r': - case 't': - case 'v': - i++; - } - lenResult++; - } - } else { - lenResult++; - } - } - substituted = new char[lenResult + 1]; - if (!substituted) - return 0; - char *o = substituted; - for (int j = 0; j < *length; j++) { - if (text[j] == '\\') { - if (text[j + 1] >= '1' && text[j + 1] <= '9') { - unsigned int patNum = text[j + 1] - '0'; - unsigned int len = pre->eopat[patNum] - pre->bopat[patNum]; - if (pre->pat[patNum]) // Will be null if try for a match that did not occur - memcpy(o, pre->pat[patNum], len); - o += len; - j++; - } else { - j++; - switch (text[j]) { - case 'a': - *o++ = '\a'; - break; - case 'b': - *o++ = '\b'; - break; - case 'f': - *o++ = '\f'; - break; - case 'n': - *o++ = '\n'; - break; - case 'r': - *o++ = '\r'; - break; - case 't': - *o++ = '\t'; - break; - case 'v': - *o++ = '\v'; - break; - default: - *o++ = '\\'; - j--; - } - } - } else { - *o++ = text[j]; - } - } - *o = '\0'; - *length = lenResult; - return substituted; -} - -int Document::LinesTotal() const { - return cb.Lines(); -} - -void Document::ChangeCase(Range r, bool makeUpperCase) { - for (int pos = r.start; pos < r.end;) { - int len = LenChar(pos); - if (len == 1) { - char ch = CharAt(pos); - if (makeUpperCase) { - if (IsLowerCase(ch)) { - ChangeChar(pos, static_cast(MakeUpperCase(ch))); - } - } else { - if (IsUpperCase(ch)) { - ChangeChar(pos, static_cast(MakeLowerCase(ch))); - } - } - } - pos += len; - } -} - -void Document::SetDefaultCharClasses(bool includeWordClass) { - charClass.SetDefaultCharClasses(includeWordClass); -} - -void Document::SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass) { - charClass.SetCharClasses(chars, newCharClass); -} - -void Document::SetStylingBits(int bits) { - stylingBits = bits; - stylingBitsMask = (1 << stylingBits) - 1; -} - -void Document::StartStyling(int position, char mask) { - stylingMask = mask; - endStyled = position; -} - -bool Document::SetStyleFor(int length, char style) { - if (enteredStyling != 0) { - return false; - } else { - enteredStyling++; - style &= stylingMask; - int prevEndStyled = endStyled; - if (cb.SetStyleFor(endStyled, length, style, stylingMask)) { - DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, - prevEndStyled, length); - NotifyModified(mh); - } - endStyled += length; - enteredStyling--; - return true; - } -} - -bool Document::SetStyles(int length, char *styles) { - if (enteredStyling != 0) { - return false; - } else { - enteredStyling++; - bool didChange = false; - int startMod = 0; - int endMod = 0; - for (int iPos = 0; iPos < length; iPos++, endStyled++) { - PLATFORM_ASSERT(endStyled < Length()); - if (cb.SetStyleAt(endStyled, styles[iPos], stylingMask)) { - if (!didChange) { - startMod = endStyled; - } - didChange = true; - endMod = endStyled; - } - } - if (didChange) { - DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, - startMod, endMod - startMod + 1); - NotifyModified(mh); - } - enteredStyling--; - return true; - } -} - -void Document::EnsureStyledTo(int pos) { - if ((enteredStyling == 0) && (pos > GetEndStyled())) { - IncrementStyleClock(); - // Ask the watchers to style, and stop as soon as one responds. - for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++) { - watchers[i].watcher->NotifyStyleNeeded(this, watchers[i].userData, pos); - } - } -} - -int Document::SetLineState(int line, int state) { - int statePrevious = cb.SetLineState(line, state); - if (state != statePrevious) { - DocModification mh(SC_MOD_CHANGELINESTATE, 0, 0, 0, 0, line); - NotifyModified(mh); - } - return statePrevious; -} - -void Document::IncrementStyleClock() { - styleClock = (styleClock + 1) % 0x100000; -} - -void Document::DecorationFillRange(int position, int value, int fillLength) { - if (decorations.FillRange(position, value, fillLength)) { - DocModification mh(SC_MOD_CHANGEINDICATOR | SC_PERFORMED_USER, - position, fillLength); - NotifyModified(mh); - } -} - -bool Document::AddWatcher(DocWatcher *watcher, void *userData) { - for (int i = 0; i < lenWatchers; i++) { - if ((watchers[i].watcher == watcher) && - (watchers[i].userData == userData)) - return false; - } - WatcherWithUserData *pwNew = new WatcherWithUserData[lenWatchers + 1]; - if (!pwNew) - return false; - for (int j = 0; j < lenWatchers; j++) - pwNew[j] = watchers[j]; - pwNew[lenWatchers].watcher = watcher; - pwNew[lenWatchers].userData = userData; - delete []watchers; - watchers = pwNew; - lenWatchers++; - return true; -} - -bool Document::RemoveWatcher(DocWatcher *watcher, void *userData) { - for (int i = 0; i < lenWatchers; i++) { - if ((watchers[i].watcher == watcher) && - (watchers[i].userData == userData)) { - if (lenWatchers == 1) { - delete []watchers; - watchers = 0; - lenWatchers = 0; - } else { - WatcherWithUserData *pwNew = new WatcherWithUserData[lenWatchers]; - if (!pwNew) - return false; - for (int j = 0; j < lenWatchers - 1; j++) { - pwNew[j] = (j < i) ? watchers[j] : watchers[j + 1]; - } - delete []watchers; - watchers = pwNew; - lenWatchers--; - } - return true; - } - } - return false; -} - -void Document::NotifyModifyAttempt() { - for (int i = 0; i < lenWatchers; i++) { - watchers[i].watcher->NotifyModifyAttempt(this, watchers[i].userData); - } -} - -void Document::NotifySavePoint(bool atSavePoint) { - for (int i = 0; i < lenWatchers; i++) { - watchers[i].watcher->NotifySavePoint(this, watchers[i].userData, atSavePoint); - } -} - -void Document::NotifyModified(DocModification mh) { - if (mh.modificationType & SC_MOD_INSERTTEXT) { - decorations.InsertSpace(mh.position, mh.length); - } else if (mh.modificationType & SC_MOD_DELETETEXT) { - decorations.DeleteRange(mh.position, mh.length); - } - for (int i = 0; i < lenWatchers; i++) { - watchers[i].watcher->NotifyModified(this, mh, watchers[i].userData); - } -} - -bool Document::IsWordPartSeparator(char ch) { - return (WordCharClass(ch) == CharClassify::ccWord) && IsPunctuation(ch); -} - -int Document::WordPartLeft(int pos) { - if (pos > 0) { - --pos; - char startChar = cb.CharAt(pos); - if (IsWordPartSeparator(startChar)) { - while (pos > 0 && IsWordPartSeparator(cb.CharAt(pos))) { - --pos; - } - } - if (pos > 0) { - startChar = cb.CharAt(pos); - --pos; - if (IsLowerCase(startChar)) { - while (pos > 0 && IsLowerCase(cb.CharAt(pos))) - --pos; - if (!IsUpperCase(cb.CharAt(pos)) && !IsLowerCase(cb.CharAt(pos))) - ++pos; - } else if (IsUpperCase(startChar)) { - while (pos > 0 && IsUpperCase(cb.CharAt(pos))) - --pos; - if (!IsUpperCase(cb.CharAt(pos))) - ++pos; - } else if (IsADigit(startChar)) { - while (pos > 0 && IsADigit(cb.CharAt(pos))) - --pos; - if (!IsADigit(cb.CharAt(pos))) - ++pos; - } else if (IsPunctuation(startChar)) { - while (pos > 0 && IsPunctuation(cb.CharAt(pos))) - --pos; - if (!IsPunctuation(cb.CharAt(pos))) - ++pos; - } else if (isspacechar(startChar)) { - while (pos > 0 && isspacechar(cb.CharAt(pos))) - --pos; - if (!isspacechar(cb.CharAt(pos))) - ++pos; - } else if (!isascii(startChar)) { - while (pos > 0 && !isascii(cb.CharAt(pos))) - --pos; - if (isascii(cb.CharAt(pos))) - ++pos; - } else { - ++pos; - } - } - } - return pos; -} - -int Document::WordPartRight(int pos) { - char startChar = cb.CharAt(pos); - int length = Length(); - if (IsWordPartSeparator(startChar)) { - while (pos < length && IsWordPartSeparator(cb.CharAt(pos))) - ++pos; - startChar = cb.CharAt(pos); - } - if (!isascii(startChar)) { - while (pos < length && !isascii(cb.CharAt(pos))) - ++pos; - } else if (IsLowerCase(startChar)) { - while (pos < length && IsLowerCase(cb.CharAt(pos))) - ++pos; - } else if (IsUpperCase(startChar)) { - if (IsLowerCase(cb.CharAt(pos + 1))) { - ++pos; - while (pos < length && IsLowerCase(cb.CharAt(pos))) - ++pos; - } else { - while (pos < length && IsUpperCase(cb.CharAt(pos))) - ++pos; - } - if (IsLowerCase(cb.CharAt(pos)) && IsUpperCase(cb.CharAt(pos - 1))) - --pos; - } else if (IsADigit(startChar)) { - while (pos < length && IsADigit(cb.CharAt(pos))) - ++pos; - } else if (IsPunctuation(startChar)) { - while (pos < length && IsPunctuation(cb.CharAt(pos))) - ++pos; - } else if (isspacechar(startChar)) { - while (pos < length && isspacechar(cb.CharAt(pos))) - ++pos; - } else { - ++pos; - } - return pos; -} - -bool IsLineEndChar(char c) { - return (c == '\n' || c == '\r'); -} - -int Document::ExtendStyleRange(int pos, int delta, bool singleLine) { - int sStart = cb.StyleAt(pos); - if (delta < 0) { - while (pos > 0 && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))) ) - pos--; - pos++; - } else { - while (pos < (Length()) && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))) ) - pos++; - } - return pos; -} - -static char BraceOpposite(char ch) { - switch (ch) { - case '(': - return ')'; - case ')': - return '('; - case '[': - return ']'; - case ']': - return '['; - case '{': - return '}'; - case '}': - return '{'; - case '<': - return '>'; - case '>': - return '<'; - default: - return '\0'; - } -} - -// TODO: should be able to extend styled region to find matching brace -int Document::BraceMatch(int position, int /*maxReStyle*/) { - char chBrace = CharAt(position); - char chSeek = BraceOpposite(chBrace); - if (chSeek == '\0') - return - 1; - char styBrace = static_cast(StyleAt(position) & stylingBitsMask); - int direction = -1; - if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<') - direction = 1; - int depth = 1; - position = position + direction; - while ((position >= 0) && (position < Length())) { - position = MovePositionOutsideChar(position, direction); - char chAtPos = CharAt(position); - char styAtPos = static_cast(StyleAt(position) & stylingBitsMask); - if ((position > GetEndStyled()) || (styAtPos == styBrace)) { - if (chAtPos == chBrace) - depth++; - if (chAtPos == chSeek) - depth--; - if (depth == 0) - return position; - } - position = position + direction; - } - return - 1; -} +// Scintilla source code edit control +/** @file Document.cxx + ** Text document that handles notifications, DBCS, styling, words and end of line. + **/ +// Copyright 1998-2003 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include + +#include "Platform.h" + +#include "Scintilla.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" +#include "CellBuffer.h" +#include "PerLine.h" +#include "CharClassify.h" +#include "Decoration.h" +#include "Document.h" +#include "RESearch.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +// This is ASCII specific but is safe with chars >= 0x80 +static inline bool isspacechar(unsigned char ch) { + return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); +} + +static inline bool IsPunctuation(char ch) { + return isascii(ch) && ispunct(ch); +} + +static inline bool IsADigit(char ch) { + return isascii(ch) && isdigit(ch); +} + +static inline bool IsLowerCase(char ch) { + return isascii(ch) && islower(ch); +} + +static inline bool IsUpperCase(char ch) { + return isascii(ch) && isupper(ch); +} + +Document::Document() { + refCount = 0; +#ifdef unix + eolMode = SC_EOL_LF; +#else + eolMode = SC_EOL_CRLF; +#endif + dbcsCodePage = 0; + stylingBits = 5; + stylingBitsMask = 0x1F; + stylingMask = 0; + endStyled = 0; + styleClock = 0; + enteredModification = 0; + enteredStyling = 0; + enteredReadOnlyCount = 0; + tabInChars = 8; + indentInChars = 0; + actualIndentInChars = 8; + useTabs = true; + tabIndents = true; + backspaceUnindents = false; + watchers = 0; + lenWatchers = 0; + + matchesValid = false; + regex = 0; + + perLineData[ldMarkers] = new LineMarkers(); + perLineData[ldLevels] = new LineLevels(); + perLineData[ldState] = new LineState(); + perLineData[ldMargin] = new LineAnnotation(); + perLineData[ldAnnotation] = new LineAnnotation(); + + cb.SetPerLine(this); +} + +Document::~Document() { + for (int i = 0; i < lenWatchers; i++) { + watchers[i].watcher->NotifyDeleted(this, watchers[i].userData); + } + delete []watchers; + for (int j=0; jInit(); + } +} + +void Document::InsertLine(int line) { + for (int j=0; jInsertLine(line); + } +} + +void Document::RemoveLine(int line) { + for (int j=0; jRemoveLine(line); + } +} + +// Increase reference count and return its previous value. +int Document::AddRef() { + return refCount++; +} + +// Decrease reference count and return its previous value. +// Delete the document if reference count reaches zero. +int Document::Release() { + int curRefCount = --refCount; + if (curRefCount == 0) + delete this; + return curRefCount; +} + +void Document::SetSavePoint() { + cb.SetSavePoint(); + NotifySavePoint(true); +} + +int Document::GetMark(int line) { + return static_cast(perLineData[ldMarkers])->MarkValue(line); +} + +int Document::AddMark(int line, int markerNum) { + if (line <= LinesTotal()) { + int prev = static_cast(perLineData[ldMarkers])-> + AddMark(line, markerNum, LinesTotal()); + DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); + NotifyModified(mh); + return prev; + } else { + return 0; + } +} + +void Document::AddMarkSet(int line, int valueSet) { + unsigned int m = valueSet; + for (int i = 0; m; i++, m >>= 1) + if (m & 1) + static_cast(perLineData[ldMarkers])-> + AddMark(line, i, LinesTotal()); + DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); + NotifyModified(mh); +} + +void Document::DeleteMark(int line, int markerNum) { + static_cast(perLineData[ldMarkers])->DeleteMark(line, markerNum, false); + DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); + NotifyModified(mh); +} + +void Document::DeleteMarkFromHandle(int markerHandle) { + static_cast(perLineData[ldMarkers])->DeleteMarkFromHandle(markerHandle); + DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); + mh.line = -1; + NotifyModified(mh); +} + +void Document::DeleteAllMarks(int markerNum) { + for (int line = 0; line < LinesTotal(); line++) { + static_cast(perLineData[ldMarkers])->DeleteMark(line, markerNum, true); + } + DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); + mh.line = -1; + NotifyModified(mh); +} + +int Document::LineFromHandle(int markerHandle) { + return static_cast(perLineData[ldMarkers])->LineFromHandle(markerHandle); +} + +int Document::LineStart(int line) const { + return cb.LineStart(line); +} + +int Document::LineEnd(int line) const { + if (line == LinesTotal() - 1) { + return LineStart(line + 1); + } else { + int position = LineStart(line + 1) - 1; + // When line terminator is CR+LF, may need to go back one more + if ((position > LineStart(line)) && (cb.CharAt(position - 1) == '\r')) { + position--; + } + return position; + } +} + +int Document::LineFromPosition(int pos) const { + return cb.LineFromPosition(pos); +} + +int Document::LineEndPosition(int position) const { + return LineEnd(LineFromPosition(position)); +} + +bool Document::IsLineEndPosition(int position) const { + return LineEnd(LineFromPosition(position)) == position; +} + +int Document::VCHomePosition(int position) const { + int line = LineFromPosition(position); + int startPosition = LineStart(line); + int endLine = LineEnd(line); + int startText = startPosition; + while (startText < endLine && (cb.CharAt(startText) == ' ' || cb.CharAt(startText) == '\t' ) ) + startText++; + if (position == startText) + return startPosition; + else + return startText; +} + +int Document::SetLevel(int line, int level) { + int prev = static_cast(perLineData[ldLevels])->SetLevel(line, level, LinesTotal()); + if (prev != level) { + DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER, + LineStart(line), 0, 0, 0, line); + mh.foldLevelNow = level; + mh.foldLevelPrev = prev; + NotifyModified(mh); + } + return prev; +} + +int Document::GetLevel(int line) { + return static_cast(perLineData[ldLevels])->GetLevel(line); +} + +void Document::ClearLevels() { + static_cast(perLineData[ldLevels])->ClearLevels(); +} + +static bool IsSubordinate(int levelStart, int levelTry) { + if (levelTry & SC_FOLDLEVELWHITEFLAG) + return true; + else + return (levelStart & SC_FOLDLEVELNUMBERMASK) < (levelTry & SC_FOLDLEVELNUMBERMASK); +} + +int Document::GetLastChild(int lineParent, int level) { + if (level == -1) + level = GetLevel(lineParent) & SC_FOLDLEVELNUMBERMASK; + int maxLine = LinesTotal(); + int lineMaxSubord = lineParent; + while (lineMaxSubord < maxLine - 1) { + EnsureStyledTo(LineStart(lineMaxSubord + 2)); + if (!IsSubordinate(level, GetLevel(lineMaxSubord + 1))) + break; + lineMaxSubord++; + } + if (lineMaxSubord > lineParent) { + if (level > (GetLevel(lineMaxSubord + 1) & SC_FOLDLEVELNUMBERMASK)) { + // Have chewed up some whitespace that belongs to a parent so seek back + if (GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG) { + lineMaxSubord--; + } + } + } + return lineMaxSubord; +} + +int Document::GetFoldParent(int line) { + int level = GetLevel(line) & SC_FOLDLEVELNUMBERMASK; + int lineLook = line - 1; + while ((lineLook > 0) && ( + (!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) || + ((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) >= level)) + ) { + lineLook--; + } + if ((GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG) && + ((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) < level)) { + return lineLook; + } else { + return -1; + } +} + +int Document::ClampPositionIntoDocument(int pos) { + return Platform::Clamp(pos, 0, Length()); +} + +bool Document::IsCrLf(int pos) { + if (pos < 0) + return false; + if (pos >= (Length() - 1)) + return false; + return (cb.CharAt(pos) == '\r') && (cb.CharAt(pos + 1) == '\n'); +} + +static const int maxBytesInDBCSCharacter=5; + +int Document::LenChar(int pos) { + if (pos < 0) { + return 1; + } else if (IsCrLf(pos)) { + return 2; + } else if (SC_CP_UTF8 == dbcsCodePage) { + unsigned char ch = static_cast(cb.CharAt(pos)); + if (ch < 0x80) + return 1; + int len = 2; + if (ch >= (0x80 + 0x40 + 0x20 + 0x10)) + len = 4; + else if (ch >= (0x80 + 0x40 + 0x20)) + len = 3; + int lengthDoc = Length(); + if ((pos + len) > lengthDoc) + return lengthDoc -pos; + else + return len; + } else if (dbcsCodePage) { + char mbstr[maxBytesInDBCSCharacter+1]; + int i; + for (i=0; i= 0x80) && (ch < (0x80 + 0x40)); +} + +static int BytesFromLead(int leadByte) { + if (leadByte > 0xF4) { + // Characters longer than 4 bytes not possible in current UTF-8 + return 0; + } else if (leadByte >= 0xF0) { + return 4; + } else if (leadByte >= 0xE0) { + return 3; + } else if (leadByte >= 0xC2) { + return 2; + } + return 0; +} + +bool Document::InGoodUTF8(int pos, int &start, int &end) { + int lead = pos; + while ((lead>0) && (pos-lead < 4) && IsTrailByte(static_cast(cb.CharAt(lead-1)))) + lead--; + start = 0; + if (lead > 0) { + start = lead-1; + } + int leadByte = static_cast(cb.CharAt(start)); + int bytes = BytesFromLead(leadByte); + if (bytes == 0) { + return false; + } else { + int trailBytes = bytes - 1; + int len = pos - lead + 1; + if (len > trailBytes) + // pos too far from lead + return false; + // Check that there are enough trails for this lead + int trail = pos + 1; + while ((trail-lead(cb.CharAt(trail)))) { + return false; + } + trail++; + } + end = start + bytes; + return true; + } +} + +// Normalise a position so that it is not halfway through a two byte character. +// This can occur in two situations - +// When lines are terminated with \r\n pairs which should be treated as one character. +// When displaying DBCS text such as Japanese. +// If moving, move the position in the indicated direction. +int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) { + //Platform::DebugPrintf("NoCRLF %d %d\n", pos, moveDir); + // If out of range, just return minimum/maximum value. + if (pos <= 0) + return 0; + if (pos >= Length()) + return Length(); + + // PLATFORM_ASSERT(pos > 0 && pos < Length()); + if (checkLineEnd && IsCrLf(pos - 1)) { + if (moveDir > 0) + return pos + 1; + else + return pos - 1; + } + + // Not between CR and LF + + if (dbcsCodePage) { + if (SC_CP_UTF8 == dbcsCodePage) { + unsigned char ch = static_cast(cb.CharAt(pos)); + int startUTF = pos; + int endUTF = pos; + if (IsTrailByte(ch) && InGoodUTF8(pos, startUTF, endUTF)) { + // ch is a trail byte within a UTF-8 character + if (moveDir > 0) + pos = endUTF; + else + pos = startUTF; + } + } else { + // Anchor DBCS calculations at start of line because start of line can + // not be a DBCS trail byte. + int posCheck = LineStart(LineFromPosition(pos)); + while (posCheck < pos) { + char mbstr[maxBytesInDBCSCharacter+1]; + int i; + for(i=0;i pos) { + if (moveDir > 0) { + return posCheck + mbsize; + } else { + return posCheck; + } + } + posCheck += mbsize; + } + } + } + + return pos; +} + +void Document::ModifiedAt(int pos) { + if (endStyled > pos) + endStyled = pos; +} + +void Document::CheckReadOnly() { + if (cb.IsReadOnly() && enteredReadOnlyCount == 0) { + enteredReadOnlyCount++; + NotifyModifyAttempt(); + enteredReadOnlyCount--; + } +} + +// Document only modified by gateways DeleteChars, InsertString, Undo, Redo, and SetStyleAt. +// SetStyleAt does not change the persistent state of a document + +bool Document::DeleteChars(int pos, int len) { + if (len == 0) + return false; + if ((pos + len) > Length()) + return false; + CheckReadOnly(); + if (enteredModification != 0) { + return false; + } else { + enteredModification++; + if (!cb.IsReadOnly()) { + NotifyModified( + DocModification( + SC_MOD_BEFOREDELETE | SC_PERFORMED_USER, + pos, len, + 0, 0)); + int prevLinesTotal = LinesTotal(); + bool startSavePoint = cb.IsSavePoint(); + bool startSequence = false; + const char *text = cb.DeleteChars(pos, len, startSequence); + if (startSavePoint && cb.IsCollectingUndo()) + NotifySavePoint(!startSavePoint); + if ((pos < Length()) || (pos == 0)) + ModifiedAt(pos); + else + ModifiedAt(pos-1); + NotifyModified( + DocModification( + SC_MOD_DELETETEXT | SC_PERFORMED_USER | (startSequence?SC_STARTACTION:0), + pos, len, + LinesTotal() - prevLinesTotal, text)); + } + enteredModification--; + } + return !cb.IsReadOnly(); +} + +/** + * Insert a string with a length. + */ +bool Document::InsertString(int position, const char *s, int insertLength) { + if (insertLength <= 0) { + return false; + } + CheckReadOnly(); + if (enteredModification != 0) { + return false; + } else { + enteredModification++; + if (!cb.IsReadOnly()) { + NotifyModified( + DocModification( + SC_MOD_BEFOREINSERT | SC_PERFORMED_USER, + position, insertLength, + 0, s)); + int prevLinesTotal = LinesTotal(); + bool startSavePoint = cb.IsSavePoint(); + bool startSequence = false; + const char *text = cb.InsertString(position, s, insertLength, startSequence); + if (startSavePoint && cb.IsCollectingUndo()) + NotifySavePoint(!startSavePoint); + ModifiedAt(position); + NotifyModified( + DocModification( + SC_MOD_INSERTTEXT | SC_PERFORMED_USER | (startSequence?SC_STARTACTION:0), + position, insertLength, + LinesTotal() - prevLinesTotal, text)); + } + enteredModification--; + } + return !cb.IsReadOnly(); +} + +int Document::Undo() { + int newPos = -1; + CheckReadOnly(); + if (enteredModification == 0) { + enteredModification++; + if (!cb.IsReadOnly()) { + bool startSavePoint = cb.IsSavePoint(); + bool multiLine = false; + int steps = cb.StartUndo(); + //Platform::DebugPrintf("Steps=%d\n", steps); + for (int step = 0; step < steps; step++) { + const int prevLinesTotal = LinesTotal(); + const Action &action = cb.GetUndoStep(); + if (action.at == removeAction) { + NotifyModified(DocModification( + SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action)); + } else if (action.at == containerAction) { + DocModification dm(SC_MOD_CONTAINER | SC_PERFORMED_UNDO); + dm.token = action.position; + NotifyModified(dm); + } else { + NotifyModified(DocModification( + SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action)); + } + cb.PerformUndoStep(); + int cellPosition = action.position; + if (action.at != containerAction) { + ModifiedAt(cellPosition); + newPos = cellPosition; + } + + int modFlags = SC_PERFORMED_UNDO; + // With undo, an insertion action becomes a deletion notification + if (action.at == removeAction) { + newPos += action.lenData; + modFlags |= SC_MOD_INSERTTEXT; + } else if (action.at == insertAction) { + modFlags |= SC_MOD_DELETETEXT; + } + if (steps > 1) + modFlags |= SC_MULTISTEPUNDOREDO; + const int linesAdded = LinesTotal() - prevLinesTotal; + if (linesAdded != 0) + multiLine = true; + if (step == steps - 1) { + modFlags |= SC_LASTSTEPINUNDOREDO; + if (multiLine) + modFlags |= SC_MULTILINEUNDOREDO; + } + NotifyModified(DocModification(modFlags, cellPosition, action.lenData, + linesAdded, action.data)); + } + + bool endSavePoint = cb.IsSavePoint(); + if (startSavePoint != endSavePoint) + NotifySavePoint(endSavePoint); + } + enteredModification--; + } + return newPos; +} + +int Document::Redo() { + int newPos = -1; + CheckReadOnly(); + if (enteredModification == 0) { + enteredModification++; + if (!cb.IsReadOnly()) { + bool startSavePoint = cb.IsSavePoint(); + bool multiLine = false; + int steps = cb.StartRedo(); + for (int step = 0; step < steps; step++) { + const int prevLinesTotal = LinesTotal(); + const Action &action = cb.GetRedoStep(); + if (action.at == insertAction) { + NotifyModified(DocModification( + SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action)); + } else if (action.at == containerAction) { + DocModification dm(SC_MOD_CONTAINER | SC_PERFORMED_REDO); + dm.token = action.position; + NotifyModified(dm); + } else { + NotifyModified(DocModification( + SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action)); + } + cb.PerformRedoStep(); + if (action.at != containerAction) { + ModifiedAt(action.position); + newPos = action.position; + } + + int modFlags = SC_PERFORMED_REDO; + if (action.at == insertAction) { + newPos += action.lenData; + modFlags |= SC_MOD_INSERTTEXT; + } else if (action.at == removeAction) { + modFlags |= SC_MOD_DELETETEXT; + } + if (steps > 1) + modFlags |= SC_MULTISTEPUNDOREDO; + const int linesAdded = LinesTotal() - prevLinesTotal; + if (linesAdded != 0) + multiLine = true; + if (step == steps - 1) { + modFlags |= SC_LASTSTEPINUNDOREDO; + if (multiLine) + modFlags |= SC_MULTILINEUNDOREDO; + } + NotifyModified( + DocModification(modFlags, action.position, action.lenData, + linesAdded, action.data)); + } + + bool endSavePoint = cb.IsSavePoint(); + if (startSavePoint != endSavePoint) + NotifySavePoint(endSavePoint); + } + enteredModification--; + } + return newPos; +} + +/** + * Insert a single character. + */ +bool Document::InsertChar(int pos, char ch) { + char chs[1]; + chs[0] = ch; + return InsertString(pos, chs, 1); +} + +/** + * Insert a null terminated string. + */ +bool Document::InsertCString(int position, const char *s) { + return InsertString(position, s, strlen(s)); +} + +void Document::ChangeChar(int pos, char ch) { + DeleteChars(pos, 1); + InsertChar(pos, ch); +} + +void Document::DelChar(int pos) { + DeleteChars(pos, LenChar(pos)); +} + +void Document::DelCharBack(int pos) { + if (pos <= 0) { + return; + } else if (IsCrLf(pos - 2)) { + DeleteChars(pos - 2, 2); + } else if (dbcsCodePage) { + int startChar = MovePositionOutsideChar(pos - 1, -1, false); + DeleteChars(startChar, pos - startChar); + } else { + DeleteChars(pos - 1, 1); + } +} + +static bool isindentchar(char ch) { + return (ch == ' ') || (ch == '\t'); +} + +static int NextTab(int pos, int tabSize) { + return ((pos / tabSize) + 1) * tabSize; +} + +static void CreateIndentation(char *linebuf, int length, int indent, int tabSize, bool insertSpaces) { + length--; // ensure space for \0 + if (!insertSpaces) { + while ((indent >= tabSize) && (length > 0)) { + *linebuf++ = '\t'; + indent -= tabSize; + length--; + } + } + while ((indent > 0) && (length > 0)) { + *linebuf++ = ' '; + indent--; + length--; + } + *linebuf = '\0'; +} + +int Document::GetLineIndentation(int line) { + int indent = 0; + if ((line >= 0) && (line < LinesTotal())) { + int lineStart = LineStart(line); + int length = Length(); + for (int i = lineStart;i < length;i++) { + char ch = cb.CharAt(i); + if (ch == ' ') + indent++; + else if (ch == '\t') + indent = NextTab(indent, tabInChars); + else + return indent; + } + } + return indent; +} + +void Document::SetLineIndentation(int line, int indent) { + int indentOfLine = GetLineIndentation(line); + if (indent < 0) + indent = 0; + if (indent != indentOfLine) { + char linebuf[1000]; + CreateIndentation(linebuf, sizeof(linebuf), indent, tabInChars, !useTabs); + int thisLineStart = LineStart(line); + int indentPos = GetLineIndentPosition(line); + UndoGroup ug(this); + DeleteChars(thisLineStart, indentPos - thisLineStart); + InsertCString(thisLineStart, linebuf); + } +} + +int Document::GetLineIndentPosition(int line) const { + if (line < 0) + return 0; + int pos = LineStart(line); + int length = Length(); + while ((pos < length) && isindentchar(cb.CharAt(pos))) { + pos++; + } + return pos; +} + +int Document::GetColumn(int pos) { + int column = 0; + int line = LineFromPosition(pos); + if ((line >= 0) && (line < LinesTotal())) { + for (int i = LineStart(line);i < pos;) { + char ch = cb.CharAt(i); + if (ch == '\t') { + column = NextTab(column, tabInChars); + i++; + } else if (ch == '\r') { + return column; + } else if (ch == '\n') { + return column; + } else if (i >= Length()) { + return column; + } else { + column++; + i = MovePositionOutsideChar(i + 1, 1, false); + } + } + } + return column; +} + +int Document::FindColumn(int line, int column) { + int position = LineStart(line); + int columnCurrent = 0; + if ((line >= 0) && (line < LinesTotal())) { + while ((columnCurrent < column) && (position < Length())) { + char ch = cb.CharAt(position); + if (ch == '\t') { + columnCurrent = NextTab(columnCurrent, tabInChars); + position++; + } else if (ch == '\r') { + return position; + } else if (ch == '\n') { + return position; + } else { + columnCurrent++; + position = MovePositionOutsideChar(position + 1, 1, false); + } + } + } + return position; +} + +void Document::Indent(bool forwards, int lineBottom, int lineTop) { + // Dedent - suck white space off the front of the line to dedent by equivalent of a tab + for (int line = lineBottom; line >= lineTop; line--) { + int indentOfLine = GetLineIndentation(line); + if (forwards) { + if (LineStart(line) < LineEnd(line)) { + SetLineIndentation(line, indentOfLine + IndentSize()); + } + } else { + SetLineIndentation(line, indentOfLine - IndentSize()); + } + } +} + +// Convert line endings for a piece of text to a particular mode. +// Stop at len or when a NUL is found. +// Caller must delete the returned pointer. +char *Document::TransformLineEnds(int *pLenOut, const char *s, size_t len, int eolMode) { + char *dest = new char[2 * len + 1]; + const char *sptr = s; + char *dptr = dest; + for (size_t i = 0; (i < len) && (*sptr != '\0'); i++) { + if (*sptr == '\n' || *sptr == '\r') { + if (eolMode == SC_EOL_CR) { + *dptr++ = '\r'; + } else if (eolMode == SC_EOL_LF) { + *dptr++ = '\n'; + } else { // eolMode == SC_EOL_CRLF + *dptr++ = '\r'; + *dptr++ = '\n'; + } + if ((*sptr == '\r') && (i+1 < len) && (*(sptr+1) == '\n')) { + i++; + sptr++; + } + sptr++; + } else { + *dptr++ = *sptr++; + } + } + *dptr++ = '\0'; + *pLenOut = (dptr - dest) - 1; + return dest; +} + +void Document::ConvertLineEnds(int eolModeSet) { + UndoGroup ug(this); + + for (int pos = 0; pos < Length(); pos++) { + if (cb.CharAt(pos) == '\r') { + if (cb.CharAt(pos + 1) == '\n') { + // CRLF + if (eolModeSet == SC_EOL_CR) { + DeleteChars(pos + 1, 1); // Delete the LF + } else if (eolModeSet == SC_EOL_LF) { + DeleteChars(pos, 1); // Delete the CR + } else { + pos++; + } + } else { + // CR + if (eolModeSet == SC_EOL_CRLF) { + InsertString(pos + 1, "\n", 1); // Insert LF + pos++; + } else if (eolModeSet == SC_EOL_LF) { + InsertString(pos, "\n", 1); // Insert LF + DeleteChars(pos + 1, 1); // Delete CR + } + } + } else if (cb.CharAt(pos) == '\n') { + // LF + if (eolModeSet == SC_EOL_CRLF) { + InsertString(pos, "\r", 1); // Insert CR + pos++; + } else if (eolModeSet == SC_EOL_CR) { + InsertString(pos, "\r", 1); // Insert CR + DeleteChars(pos + 1, 1); // Delete LF + } + } + } + +} + +bool Document::IsWhiteLine(int line) const { + int currentChar = LineStart(line); + int endLine = LineEnd(line); + while (currentChar < endLine) { + if (cb.CharAt(currentChar) != ' ' && cb.CharAt(currentChar) != '\t') { + return false; + } + ++currentChar; + } + return true; +} + +int Document::ParaUp(int pos) { + int line = LineFromPosition(pos); + line--; + while (line >= 0 && IsWhiteLine(line)) { // skip empty lines + line--; + } + while (line >= 0 && !IsWhiteLine(line)) { // skip non-empty lines + line--; + } + line++; + return LineStart(line); +} + +int Document::ParaDown(int pos) { + int line = LineFromPosition(pos); + while (line < LinesTotal() && !IsWhiteLine(line)) { // skip non-empty lines + line++; + } + while (line < LinesTotal() && IsWhiteLine(line)) { // skip empty lines + line++; + } + if (line < LinesTotal()) + return LineStart(line); + else // end of a document + return LineEnd(line-1); +} + +CharClassify::cc Document::WordCharClass(unsigned char ch) { + if ((SC_CP_UTF8 == dbcsCodePage) && (ch >= 0x80)) + return CharClassify::ccWord; + return charClass.GetClass(ch); +} + +/** + * Used by commmands that want to select whole words. + * Finds the start of word at pos when delta < 0 or the end of the word when delta >= 0. + */ +int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) { + CharClassify::cc ccStart = CharClassify::ccWord; + if (delta < 0) { + if (!onlyWordCharacters) + ccStart = WordCharClass(cb.CharAt(pos-1)); + while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccStart)) + pos--; + } else { + if (!onlyWordCharacters && pos < Length()) + ccStart = WordCharClass(cb.CharAt(pos)); + while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart)) + pos++; + } + return MovePositionOutsideChar(pos, delta); +} + +/** + * Find the start of the next word in either a forward (delta >= 0) or backwards direction + * (delta < 0). + * This is looking for a transition between character classes although there is also some + * additional movement to transit white space. + * Used by cursor movement by word commands. + */ +int Document::NextWordStart(int pos, int delta) { + if (delta < 0) { + while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == CharClassify::ccSpace)) + pos--; + if (pos > 0) { + CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos-1)); + while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccStart)) { + pos--; + } + } + } else { + CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos)); + while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart)) + pos++; + while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == CharClassify::ccSpace)) + pos++; + } + return pos; +} + +/** + * Find the end of the next word in either a forward (delta >= 0) or backwards direction + * (delta < 0). + * This is looking for a transition between character classes although there is also some + * additional movement to transit white space. + * Used by cursor movement by word commands. + */ +int Document::NextWordEnd(int pos, int delta) { + if (delta < 0) { + if (pos > 0) { + CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos-1)); + if (ccStart != CharClassify::ccSpace) { + while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == ccStart) { + pos--; + } + } + while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == CharClassify::ccSpace) { + pos--; + } + } + } else { + while (pos < Length() && WordCharClass(cb.CharAt(pos)) == CharClassify::ccSpace) { + pos++; + } + if (pos < Length()) { + CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos)); + while (pos < Length() && WordCharClass(cb.CharAt(pos)) == ccStart) { + pos++; + } + } + } + return pos; +} + +/** + * Check that the character at the given position is a word or punctuation character and that + * the previous character is of a different character class. + */ +bool Document::IsWordStartAt(int pos) { + if (pos > 0) { + CharClassify::cc ccPos = WordCharClass(CharAt(pos)); + return (ccPos == CharClassify::ccWord || ccPos == CharClassify::ccPunctuation) && + (ccPos != WordCharClass(CharAt(pos - 1))); + } + return true; +} + +/** + * Check that the character at the given position is a word or punctuation character and that + * the next character is of a different character class. + */ +bool Document::IsWordEndAt(int pos) { + if (pos < Length()) { + CharClassify::cc ccPrev = WordCharClass(CharAt(pos-1)); + return (ccPrev == CharClassify::ccWord || ccPrev == CharClassify::ccPunctuation) && + (ccPrev != WordCharClass(CharAt(pos))); + } + return true; +} + +/** + * Check that the given range is has transitions between character classes at both + * ends and where the characters on the inside are word or punctuation characters. + */ +bool Document::IsWordAt(int start, int end) { + return IsWordStartAt(start) && IsWordEndAt(end); +} + +static inline char MakeLowerCase(char ch) { + if (ch < 'A' || ch > 'Z') + return ch; + else + return static_cast(ch - 'A' + 'a'); +} + +/** + * Find text in document, supporting both forward and backward + * searches (just pass minPos > maxPos to do a backward search) + * Has not been tested with backwards DBCS searches yet. + */ +long Document::FindText(int minPos, int maxPos, const char *s, + bool caseSensitive, bool word, bool wordStart, bool regExp, int flags, + int *length) { + if (regExp) { + if (!regex) + regex = CreateRegexSearch(&charClass); + return regex->FindText(this, minPos, maxPos, s, caseSensitive, word, wordStart, flags, length); + } else { + + bool forward = minPos <= maxPos; + int increment = forward ? 1 : -1; + + // Range endpoints should not be inside DBCS characters, but just in case, move them. + int startPos = MovePositionOutsideChar(minPos, increment, false); + int endPos = MovePositionOutsideChar(maxPos, increment, false); + + // Compute actual search ranges needed + int lengthFind = *length; + if (lengthFind == -1) + lengthFind = static_cast(strlen(s)); + int endSearch = endPos; + if (startPos <= endPos) { + endSearch = endPos - lengthFind + 1; + } + //Platform::DebugPrintf("Find %d %d %s %d\n", startPos, endPos, ft->lpstrText, lengthFind); + char firstChar = s[0]; + if (!caseSensitive) + firstChar = static_cast(MakeUpperCase(firstChar)); + int pos = forward ? startPos : (startPos - 1); + while (forward ? (pos < endSearch) : (pos >= endSearch)) { + char ch = CharAt(pos); + if (caseSensitive) { + if (ch == firstChar) { + bool found = true; + if (pos + lengthFind > Platform::Maximum(startPos, endPos)) found = false; + for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) { + ch = CharAt(pos + posMatch); + if (ch != s[posMatch]) + found = false; + } + if (found) { + if ((!word && !wordStart) || + (word && IsWordAt(pos, pos + lengthFind)) || + (wordStart && IsWordStartAt(pos))) + return pos; + } + } + } else { + if (MakeUpperCase(ch) == firstChar) { + bool found = true; + if (pos + lengthFind > Platform::Maximum(startPos, endPos)) found = false; + for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) { + ch = CharAt(pos + posMatch); + if (MakeUpperCase(ch) != MakeUpperCase(s[posMatch])) + found = false; + } + if (found) { + if ((!word && !wordStart) || + (word && IsWordAt(pos, pos + lengthFind)) || + (wordStart && IsWordStartAt(pos))) + return pos; + } + } + } + pos += increment; + if (dbcsCodePage && (pos >= 0)) { + // Ensure trying to match from start of character + pos = MovePositionOutsideChar(pos, increment, false); + } + } + } + //Platform::DebugPrintf("Not found\n"); + return -1; +} + +const char *Document::SubstituteByPosition(const char *text, int *length) { + return regex->SubstituteByPosition(this, text, length); +} + +int Document::LinesTotal() const { + return cb.Lines(); +} + +void Document::ChangeCase(Range r, bool makeUpperCase) { + for (int pos = r.start; pos < r.end;) { + int len = LenChar(pos); + if (len == 1) { + char ch = CharAt(pos); + if (makeUpperCase) { + if (IsLowerCase(ch)) { + ChangeChar(pos, static_cast(MakeUpperCase(ch))); + } + } else { + if (IsUpperCase(ch)) { + ChangeChar(pos, static_cast(MakeLowerCase(ch))); + } + } + } + pos += len; + } +} + +void Document::SetDefaultCharClasses(bool includeWordClass) { + charClass.SetDefaultCharClasses(includeWordClass); +} + +void Document::SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass) { + charClass.SetCharClasses(chars, newCharClass); +} + +void Document::SetStylingBits(int bits) { + stylingBits = bits; + stylingBitsMask = (1 << stylingBits) - 1; +} + +void Document::StartStyling(int position, char mask) { + stylingMask = mask; + endStyled = position; +} + +bool Document::SetStyleFor(int length, char style) { + if (enteredStyling != 0) { + return false; + } else { + enteredStyling++; + style &= stylingMask; + int prevEndStyled = endStyled; + if (cb.SetStyleFor(endStyled, length, style, stylingMask)) { + DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, + prevEndStyled, length); + NotifyModified(mh); + } + endStyled += length; + enteredStyling--; + return true; + } +} + +bool Document::SetStyles(int length, const char *styles) { + if (enteredStyling != 0) { + return false; + } else { + enteredStyling++; + bool didChange = false; + int startMod = 0; + int endMod = 0; + for (int iPos = 0; iPos < length; iPos++, endStyled++) { + PLATFORM_ASSERT(endStyled < Length()); + if (cb.SetStyleAt(endStyled, styles[iPos], stylingMask)) { + if (!didChange) { + startMod = endStyled; + } + didChange = true; + endMod = endStyled; + } + } + if (didChange) { + DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER, + startMod, endMod - startMod + 1); + NotifyModified(mh); + } + enteredStyling--; + return true; + } +} + +void Document::EnsureStyledTo(int pos) { + if ((enteredStyling == 0) && (pos > GetEndStyled())) { + IncrementStyleClock(); + // Ask the watchers to style, and stop as soon as one responds. + for (int i = 0; pos > GetEndStyled() && i < lenWatchers; i++) { + watchers[i].watcher->NotifyStyleNeeded(this, watchers[i].userData, pos); + } + } +} + +int Document::SetLineState(int line, int state) { + int statePrevious = static_cast(perLineData[ldState])->SetLineState(line, state); + if (state != statePrevious) { + DocModification mh(SC_MOD_CHANGELINESTATE, 0, 0, 0, 0, line); + NotifyModified(mh); + } + return statePrevious; +} + +int Document::GetLineState(int line) { + return static_cast(perLineData[ldState])->GetLineState(line); +} + +int Document::GetMaxLineState() { + return static_cast(perLineData[ldState])->GetMaxLineState(); +} + +StyledText Document::MarginStyledText(int line) { + LineAnnotation *pla = static_cast(perLineData[ldMargin]); + return StyledText(pla->Length(line), pla->Text(line), + pla->MultipleStyles(line), pla->Style(line), pla->Styles(line)); +} + +void Document::MarginSetText(int line, const char *text) { + static_cast(perLineData[ldMargin])->SetText(line, text); + DocModification mh(SC_MOD_CHANGEMARGIN, LineStart(line), 0, 0, 0, line); + NotifyModified(mh); +} + +void Document::MarginSetStyle(int line, int style) { + static_cast(perLineData[ldMargin])->SetStyle(line, style); +} + +void Document::MarginSetStyles(int line, const unsigned char *styles) { + static_cast(perLineData[ldMargin])->SetStyles(line, styles); +} + +int Document::MarginLength(int line) const { + return static_cast(perLineData[ldMargin])->Length(line); +} + +void Document::MarginClearAll() { + int maxEditorLine = LinesTotal(); + for (int l=0;l(perLineData[ldMargin])->ClearAll(); +} + +bool Document::AnnotationAny() const { + return static_cast(perLineData[ldAnnotation])->AnySet(); +} + +StyledText Document::AnnotationStyledText(int line) { + LineAnnotation *pla = static_cast(perLineData[ldAnnotation]); + return StyledText(pla->Length(line), pla->Text(line), + pla->MultipleStyles(line), pla->Style(line), pla->Styles(line)); +} + +void Document::AnnotationSetText(int line, const char *text) { + const int linesBefore = AnnotationLines(line); + static_cast(perLineData[ldAnnotation])->SetText(line, text); + const int linesAfter = AnnotationLines(line); + DocModification mh(SC_MOD_CHANGEANNOTATION, LineStart(line), 0, 0, 0, line); + mh.annotationLinesAdded = linesAfter - linesBefore; + NotifyModified(mh); +} + +void Document::AnnotationSetStyle(int line, int style) { + static_cast(perLineData[ldAnnotation])->SetStyle(line, style); +} + +void Document::AnnotationSetStyles(int line, const unsigned char *styles) { + static_cast(perLineData[ldAnnotation])->SetStyles(line, styles); +} + +int Document::AnnotationLength(int line) const { + return static_cast(perLineData[ldAnnotation])->Length(line); +} + +int Document::AnnotationLines(int line) const { + return static_cast(perLineData[ldAnnotation])->Lines(line); +} + +void Document::AnnotationClearAll() { + int maxEditorLine = LinesTotal(); + for (int l=0;l(perLineData[ldAnnotation])->ClearAll(); +} + +void Document::IncrementStyleClock() { + styleClock = (styleClock + 1) % 0x100000; +} + +void Document::DecorationFillRange(int position, int value, int fillLength) { + if (decorations.FillRange(position, value, fillLength)) { + DocModification mh(SC_MOD_CHANGEINDICATOR | SC_PERFORMED_USER, + position, fillLength); + NotifyModified(mh); + } +} + +bool Document::AddWatcher(DocWatcher *watcher, void *userData) { + for (int i = 0; i < lenWatchers; i++) { + if ((watchers[i].watcher == watcher) && + (watchers[i].userData == userData)) + return false; + } + WatcherWithUserData *pwNew = new WatcherWithUserData[lenWatchers + 1]; + for (int j = 0; j < lenWatchers; j++) + pwNew[j] = watchers[j]; + pwNew[lenWatchers].watcher = watcher; + pwNew[lenWatchers].userData = userData; + delete []watchers; + watchers = pwNew; + lenWatchers++; + return true; +} + +bool Document::RemoveWatcher(DocWatcher *watcher, void *userData) { + for (int i = 0; i < lenWatchers; i++) { + if ((watchers[i].watcher == watcher) && + (watchers[i].userData == userData)) { + if (lenWatchers == 1) { + delete []watchers; + watchers = 0; + lenWatchers = 0; + } else { + WatcherWithUserData *pwNew = new WatcherWithUserData[lenWatchers]; + for (int j = 0; j < lenWatchers - 1; j++) { + pwNew[j] = (j < i) ? watchers[j] : watchers[j + 1]; + } + delete []watchers; + watchers = pwNew; + lenWatchers--; + } + return true; + } + } + return false; +} + +void Document::NotifyModifyAttempt() { + for (int i = 0; i < lenWatchers; i++) { + watchers[i].watcher->NotifyModifyAttempt(this, watchers[i].userData); + } +} + +void Document::NotifySavePoint(bool atSavePoint) { + for (int i = 0; i < lenWatchers; i++) { + watchers[i].watcher->NotifySavePoint(this, watchers[i].userData, atSavePoint); + } +} + +void Document::NotifyModified(DocModification mh) { + if (mh.modificationType & SC_MOD_INSERTTEXT) { + decorations.InsertSpace(mh.position, mh.length); + } else if (mh.modificationType & SC_MOD_DELETETEXT) { + decorations.DeleteRange(mh.position, mh.length); + } + for (int i = 0; i < lenWatchers; i++) { + watchers[i].watcher->NotifyModified(this, mh, watchers[i].userData); + } +} + +bool Document::IsWordPartSeparator(char ch) { + return (WordCharClass(ch) == CharClassify::ccWord) && IsPunctuation(ch); +} + +int Document::WordPartLeft(int pos) { + if (pos > 0) { + --pos; + char startChar = cb.CharAt(pos); + if (IsWordPartSeparator(startChar)) { + while (pos > 0 && IsWordPartSeparator(cb.CharAt(pos))) { + --pos; + } + } + if (pos > 0) { + startChar = cb.CharAt(pos); + --pos; + if (IsLowerCase(startChar)) { + while (pos > 0 && IsLowerCase(cb.CharAt(pos))) + --pos; + if (!IsUpperCase(cb.CharAt(pos)) && !IsLowerCase(cb.CharAt(pos))) + ++pos; + } else if (IsUpperCase(startChar)) { + while (pos > 0 && IsUpperCase(cb.CharAt(pos))) + --pos; + if (!IsUpperCase(cb.CharAt(pos))) + ++pos; + } else if (IsADigit(startChar)) { + while (pos > 0 && IsADigit(cb.CharAt(pos))) + --pos; + if (!IsADigit(cb.CharAt(pos))) + ++pos; + } else if (IsPunctuation(startChar)) { + while (pos > 0 && IsPunctuation(cb.CharAt(pos))) + --pos; + if (!IsPunctuation(cb.CharAt(pos))) + ++pos; + } else if (isspacechar(startChar)) { + while (pos > 0 && isspacechar(cb.CharAt(pos))) + --pos; + if (!isspacechar(cb.CharAt(pos))) + ++pos; + } else if (!isascii(startChar)) { + while (pos > 0 && !isascii(cb.CharAt(pos))) + --pos; + if (isascii(cb.CharAt(pos))) + ++pos; + } else { + ++pos; + } + } + } + return pos; +} + +int Document::WordPartRight(int pos) { + char startChar = cb.CharAt(pos); + int length = Length(); + if (IsWordPartSeparator(startChar)) { + while (pos < length && IsWordPartSeparator(cb.CharAt(pos))) + ++pos; + startChar = cb.CharAt(pos); + } + if (!isascii(startChar)) { + while (pos < length && !isascii(cb.CharAt(pos))) + ++pos; + } else if (IsLowerCase(startChar)) { + while (pos < length && IsLowerCase(cb.CharAt(pos))) + ++pos; + } else if (IsUpperCase(startChar)) { + if (IsLowerCase(cb.CharAt(pos + 1))) { + ++pos; + while (pos < length && IsLowerCase(cb.CharAt(pos))) + ++pos; + } else { + while (pos < length && IsUpperCase(cb.CharAt(pos))) + ++pos; + } + if (IsLowerCase(cb.CharAt(pos)) && IsUpperCase(cb.CharAt(pos - 1))) + --pos; + } else if (IsADigit(startChar)) { + while (pos < length && IsADigit(cb.CharAt(pos))) + ++pos; + } else if (IsPunctuation(startChar)) { + while (pos < length && IsPunctuation(cb.CharAt(pos))) + ++pos; + } else if (isspacechar(startChar)) { + while (pos < length && isspacechar(cb.CharAt(pos))) + ++pos; + } else { + ++pos; + } + return pos; +} + +bool IsLineEndChar(char c) { + return (c == '\n' || c == '\r'); +} + +int Document::ExtendStyleRange(int pos, int delta, bool singleLine) { + int sStart = cb.StyleAt(pos); + if (delta < 0) { + while (pos > 0 && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))) ) + pos--; + pos++; + } else { + while (pos < (Length()) && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))) ) + pos++; + } + return pos; +} + +static char BraceOpposite(char ch) { + switch (ch) { + case '(': + return ')'; + case ')': + return '('; + case '[': + return ']'; + case ']': + return '['; + case '{': + return '}'; + case '}': + return '{'; + case '<': + return '>'; + case '>': + return '<'; + default: + return '\0'; + } +} + +// TODO: should be able to extend styled region to find matching brace +int Document::BraceMatch(int position, int /*maxReStyle*/) { + char chBrace = CharAt(position); + char chSeek = BraceOpposite(chBrace); + if (chSeek == '\0') + return - 1; + char styBrace = static_cast(StyleAt(position) & stylingBitsMask); + int direction = -1; + if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<') + direction = 1; + int depth = 1; + position = position + direction; + while ((position >= 0) && (position < Length())) { + position = MovePositionOutsideChar(position, direction); + char chAtPos = CharAt(position); + char styAtPos = static_cast(StyleAt(position) & stylingBitsMask); + if ((position > GetEndStyled()) || (styAtPos == styBrace)) { + if (chAtPos == chBrace) + depth++; + if (chAtPos == chSeek) + depth--; + if (depth == 0) + return position; + } + position = position + direction; + } + return - 1; +} + +/** + * Implementation of RegexSearchBase for the default built-in regular expression engine + */ +class BuiltinRegex : public RegexSearchBase { +public: + BuiltinRegex(CharClassify *charClassTable) : search(charClassTable), substituted(NULL) {} + + virtual ~BuiltinRegex() { + delete substituted; + } + + virtual long FindText(Document *doc, int minPos, int maxPos, const char *s, + bool caseSensitive, bool word, bool wordStart, int flags, + int *length); + + virtual const char *SubstituteByPosition(Document* doc, const char *text, int *length); + +private: + RESearch search; + char *substituted; +}; + +// Define a way for the Regular Expression code to access the document +class DocumentIndexer : public CharacterIndexer { + Document *pdoc; + int end; +public: + DocumentIndexer(Document *pdoc_, int end_) : + pdoc(pdoc_), end(end_) { + } + + virtual ~DocumentIndexer() { + } + + virtual char CharAt(int index) { + if (index < 0 || index >= end) + return 0; + else + return pdoc->CharAt(index); + } +}; + +long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s, + bool caseSensitive, bool, bool, int flags, + int *length) { + bool posix = (flags & SCFIND_POSIX) != 0; + int increment = (minPos <= maxPos) ? 1 : -1; + + int startPos = minPos; + int endPos = maxPos; + + // Range endpoints should not be inside DBCS characters, but just in case, move them. + startPos = doc->MovePositionOutsideChar(startPos, 1, false); + endPos = doc->MovePositionOutsideChar(endPos, 1, false); + + const char *errmsg = search.Compile(s, *length, caseSensitive, posix); + if (errmsg) { + return -1; + } + // Find a variable in a property file: \$(\([A-Za-z0-9_.]+\)) + // Replace first '.' with '-' in each property file variable reference: + // Search: \$(\([A-Za-z0-9_-]+\)\.\([A-Za-z0-9_.]+\)) + // Replace: $(\1-\2) + int lineRangeStart = doc->LineFromPosition(startPos); + int lineRangeEnd = doc->LineFromPosition(endPos); + if ((increment == 1) && + (startPos >= doc->LineEnd(lineRangeStart)) && + (lineRangeStart < lineRangeEnd)) { + // the start position is at end of line or between line end characters. + lineRangeStart++; + startPos = doc->LineStart(lineRangeStart); + } + int pos = -1; + int lenRet = 0; + char searchEnd = s[*length - 1]; + int lineRangeBreak = lineRangeEnd + increment; + for (int line = lineRangeStart; line != lineRangeBreak; line += increment) { + int startOfLine = doc->LineStart(line); + int endOfLine = doc->LineEnd(line); + if (increment == 1) { + if (line == lineRangeStart) { + if ((startPos != startOfLine) && (s[0] == '^')) + continue; // Can't match start of line if start position after start of line + startOfLine = startPos; + } + if (line == lineRangeEnd) { + if ((endPos != endOfLine) && (searchEnd == '$')) + continue; // Can't match end of line if end position before end of line + endOfLine = endPos; + } + } else { + if (line == lineRangeEnd) { + if ((endPos != startOfLine) && (s[0] == '^')) + continue; // Can't match start of line if end position after start of line + startOfLine = endPos; + } + if (line == lineRangeStart) { + if ((startPos != endOfLine) && (searchEnd == '$')) + continue; // Can't match end of line if start position before end of line + endOfLine = startPos; + } + } + + DocumentIndexer di(doc, endOfLine); + int success = search.Execute(di, startOfLine, endOfLine); + if (success) { + pos = search.bopat[0]; + lenRet = search.eopat[0] - search.bopat[0]; + if (increment == -1) { + // Check for the last match on this line. + int repetitions = 1000; // Break out of infinite loop + while (success && (search.eopat[0] <= endOfLine) && (repetitions--)) { + success = search.Execute(di, pos+1, endOfLine); + if (success) { + if (search.eopat[0] <= minPos) { + pos = search.bopat[0]; + lenRet = search.eopat[0] - search.bopat[0]; + } else { + success = 0; + } + } + } + } + break; + } + } + *length = lenRet; + return pos; +} + +const char *BuiltinRegex::SubstituteByPosition(Document* doc, const char *text, int *length) { + delete []substituted; + substituted = 0; + DocumentIndexer di(doc, doc->Length()); + if (!search.GrabMatches(di)) + return 0; + unsigned int lenResult = 0; + for (int i = 0; i < *length; i++) { + if (text[i] == '\\') { + if (text[i + 1] >= '1' && text[i + 1] <= '9') { + unsigned int patNum = text[i + 1] - '0'; + lenResult += search.eopat[patNum] - search.bopat[patNum]; + i++; + } else { + switch (text[i + 1]) { + case 'a': + case 'b': + case 'f': + case 'n': + case 'r': + case 't': + case 'v': + i++; + } + lenResult++; + } + } else { + lenResult++; + } + } + substituted = new char[lenResult + 1]; + char *o = substituted; + for (int j = 0; j < *length; j++) { + if (text[j] == '\\') { + if (text[j + 1] >= '1' && text[j + 1] <= '9') { + unsigned int patNum = text[j + 1] - '0'; + unsigned int len = search.eopat[patNum] - search.bopat[patNum]; + if (search.pat[patNum]) // Will be null if try for a match that did not occur + memcpy(o, search.pat[patNum], len); + o += len; + j++; + } else { + j++; + switch (text[j]) { + case 'a': + *o++ = '\a'; + break; + case 'b': + *o++ = '\b'; + break; + case 'f': + *o++ = '\f'; + break; + case 'n': + *o++ = '\n'; + break; + case 'r': + *o++ = '\r'; + break; + case 't': + *o++ = '\t'; + break; + case 'v': + *o++ = '\v'; + break; + default: + *o++ = '\\'; + j--; + } + } + } else { + *o++ = text[j]; + } + } + *o = '\0'; + *length = lenResult; + return substituted; +} + +#ifndef SCI_OWNREGEX + +#ifdef SCI_NAMESPACE + +RegexSearchBase *Scintilla::CreateRegexSearch(CharClassify *charClassTable) { + return new BuiltinRegex(charClassTable); +} + +#else + +RegexSearchBase *CreateRegexSearch(CharClassify *charClassTable) { + return new BuiltinRegex(charClassTable); +} + +#endif + +#endif diff --git a/sdk/wxscintilla/src/scintilla/src/Document.h b/sdk/wxscintilla/src/scintilla/src/Document.h index 00433eda0a..240d59e390 100644 --- a/sdk/wxscintilla/src/scintilla/src/Document.h +++ b/sdk/wxscintilla/src/scintilla/src/Document.h @@ -1,316 +1,407 @@ -// Scintilla source code edit control -/** @file Document.h - ** Text document that handles notifications, DBCS, styling, words and end of line. - **/ -// Copyright 1998-2003 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef DOCUMENT_H -#define DOCUMENT_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -/** - * A Position is a position within a document between two characters or at the beginning or end. - * Sometimes used as a character index where it identifies the character after the position. - */ -typedef int Position; -const Position invalidPosition = -1; - -/** - * The range class represents a range of text in a document. - * The two values are not sorted as one end may be more significant than the other - * as is the case for the selection where the end position is the position of the caret. - * If either position is invalidPosition then the range is invalid and most operations will fail. - */ -class Range { -public: - Position start; - Position end; - - Range(Position pos=0) : - start(pos), end(pos) { - }; - Range(Position start_, Position end_) : - start(start_), end(end_) { - }; - - bool Valid() const { - return (start != invalidPosition) && (end != invalidPosition); - } - - // Is the position within the range? - bool Contains(Position pos) const { - if (start < end) { - return (pos >= start && pos <= end); - } else { - return (pos <= start && pos >= end); - } - } - - // Is the character after pos within the range? - bool ContainsCharacter(Position pos) const { - if (start < end) { - return (pos >= start && pos < end); - } else { - return (pos < start && pos >= end); - } - } - - bool Contains(Range other) const { - return Contains(other.start) && Contains(other.end); - } - - bool Overlaps(Range other) const { - return - Contains(other.start) || - Contains(other.end) || - other.Contains(start) || - other.Contains(end); - } -}; - -class DocWatcher; -class DocModification; -class RESearch; - -/** - */ -class Document { - -public: - /** Used to pair watcher pointer with user data. */ - class WatcherWithUserData { - public: - DocWatcher *watcher; - void *userData; - WatcherWithUserData() { - watcher = 0; - userData = 0; - } - }; - - enum charClassification { ccSpace, ccNewLine, ccWord, ccPunctuation }; - -private: - int refCount; - CellBuffer cb; - CharClassify charClass; - char stylingMask; - int endStyled; - int styleClock; - int enteredModification; - int enteredStyling; - int enteredReadOnlyCount; - - WatcherWithUserData *watchers; - int lenWatchers; - - bool matchesValid; - RESearch *pre; - char *substituted; - -public: - int stylingBits; - int stylingBitsMask; - - int eolMode; - /// Can also be SC_CP_UTF8 to enable UTF-8 mode - int dbcsCodePage; - int tabInChars; - int indentInChars; - int actualIndentInChars; - bool useTabs; - bool tabIndents; - bool backspaceUnindents; - - DecorationList decorations; - - Document(); - virtual ~Document(); - - int AddRef(); - int Release(); - - int LineFromPosition(int pos); - int ClampPositionIntoDocument(int pos); - bool IsCrLf(int pos); - int LenChar(int pos); - bool InGoodUTF8(int pos, int &start, int &end); - int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true); - - // Gateways to modifying document - void ModifiedAt(int pos); - void CheckReadOnly(); - bool DeleteChars(int pos, int len); - bool InsertString(int position, const char *s, int insertLength); - int Undo(); - int Redo(); - bool CanUndo() { return cb.CanUndo(); } - bool CanRedo() { return cb.CanRedo(); } - void DeleteUndoHistory() { cb.DeleteUndoHistory(); } - bool SetUndoCollection(bool collectUndo) { - return cb.SetUndoCollection(collectUndo); - } - bool IsCollectingUndo() { return cb.IsCollectingUndo(); } - void BeginUndoAction() { cb.BeginUndoAction(); } - void EndUndoAction() { cb.EndUndoAction(); } - void SetSavePoint(); - bool IsSavePoint() { return cb.IsSavePoint(); } - - int GetLineIndentation(int line); - void SetLineIndentation(int line, int indent); - int GetLineIndentPosition(int line) const; - int GetColumn(int position); - int FindColumn(int line, int column); - void Indent(bool forwards, int lineBottom, int lineTop); - static char *TransformLineEnds(int *pLenOut, const char *s, size_t len, int eolMode); - void ConvertLineEnds(int eolModeSet); - void SetReadOnly(bool set) { cb.SetReadOnly(set); } - bool IsReadOnly() { return cb.IsReadOnly(); } - - bool InsertChar(int pos, char ch); - bool InsertCString(int position, const char *s); - void ChangeChar(int pos, char ch); - void DelChar(int pos); - void DelCharBack(int pos); - - char CharAt(int position) { return cb.CharAt(position); } - void GetCharRange(char *buffer, int position, int lengthRetrieve) { - cb.GetCharRange(buffer, position, lengthRetrieve); - } - char StyleAt(int position) { return cb.StyleAt(position); } - int GetMark(int line) { return cb.GetMark(line); } - int AddMark(int line, int markerNum); - void AddMarkSet(int line, int valueSet); - void DeleteMark(int line, int markerNum); - void DeleteMarkFromHandle(int markerHandle); - void DeleteAllMarks(int markerNum); - int LineFromHandle(int markerHandle) { return cb.LineFromHandle(markerHandle); } - int LineStart(int line) const; - int LineEnd(int line) const; - int LineEndPosition(int position); - int VCHomePosition(int position); - - int SetLevel(int line, int level); - int GetLevel(int line) { return cb.GetLevel(line); } - void ClearLevels() { cb.ClearLevels(); } - int GetLastChild(int lineParent, int level=-1); - int GetFoldParent(int line); - - void Indent(bool forwards); - int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false); - int NextWordStart(int pos, int delta); - int NextWordEnd(int pos, int delta); - int Length() const { return cb.Length(); } - void Allocate(int newSize) { cb.Allocate(newSize); } - long FindText(int minPos, int maxPos, const char *s, - bool caseSensitive, bool word, bool wordStart, bool regExp, bool posix, int *length); - long FindText(int iMessage, unsigned long wParam, long lParam); - const char *SubstituteByPosition(const char *text, int *length); - int LinesTotal() const; - - void ChangeCase(Range r, bool makeUpperCase); - - void SetDefaultCharClasses(bool includeWordClass); - void SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass); - void SetStylingBits(int bits); - void StartStyling(int position, char mask); - bool SetStyleFor(int length, char style); - bool SetStyles(int length, char *styles); - int GetEndStyled() { return endStyled; } - void EnsureStyledTo(int pos); - int GetStyleClock() { return styleClock; } - void IncrementStyleClock(); - void DecorationFillRange(int position, int value, int fillLength); - - int SetLineState(int line, int state); - int GetLineState(int line) { return cb.GetLineState(line); } - int GetMaxLineState() { return cb.GetMaxLineState(); } - - bool AddWatcher(DocWatcher *watcher, void *userData); - bool RemoveWatcher(DocWatcher *watcher, void *userData); - const WatcherWithUserData *GetWatchers() const { return watchers; } - int GetLenWatchers() const { return lenWatchers; } - - bool IsWordPartSeparator(char ch); - int WordPartLeft(int pos); - int WordPartRight(int pos); - int ExtendStyleRange(int pos, int delta, bool singleLine = false); - bool IsWhiteLine(int line) const; - int ParaUp(int pos); - int ParaDown(int pos); - int IndentSize() { return actualIndentInChars; } - int BraceMatch(int position, int maxReStyle); - -private: - CharClassify::cc WordCharClass(unsigned char ch); - bool IsWordStartAt(int pos); - bool IsWordEndAt(int pos); - bool IsWordAt(int start, int end); - - void NotifyModifyAttempt(); - void NotifySavePoint(bool atSavePoint); - void NotifyModified(DocModification mh); -}; - -/** - * To optimise processing of document modifications by DocWatchers, a hint is passed indicating the - * scope of the change. - * If the DocWatcher is a document view then this can be used to optimise screen updating. - */ -class DocModification { -public: - int modificationType; - int position; - int length; - int linesAdded; /**< Negative if lines deleted. */ - const char *text; /**< Only valid for changes to text, not for changes to style. */ - int line; - int foldLevelNow; - int foldLevelPrev; - - DocModification(int modificationType_, int position_=0, int length_=0, - int linesAdded_=0, const char *text_=0, int line_=0) : - modificationType(modificationType_), - position(position_), - length(length_), - linesAdded(linesAdded_), - text(text_), - line(line_), - foldLevelNow(0), - foldLevelPrev(0) {} - - DocModification(int modificationType_, const Action &act, int linesAdded_=0) : - modificationType(modificationType_), - position(act.position), - length(act.lenData), - linesAdded(linesAdded_), - text(act.data), - line(0), - foldLevelNow(0), - foldLevelPrev(0) {} -}; - -/** - * A class that wants to receive notifications from a Document must be derived from DocWatcher - * and implement the notification methods. It can then be added to the watcher list with AddWatcher. - */ -class DocWatcher { -public: - virtual ~DocWatcher() {} - - virtual void NotifyModifyAttempt(Document *doc, void *userData) = 0; - virtual void NotifySavePoint(Document *doc, void *userData, bool atSavePoint) = 0; - virtual void NotifyModified(Document *doc, DocModification mh, void *userData) = 0; - virtual void NotifyDeleted(Document *doc, void *userData) = 0; - virtual void NotifyStyleNeeded(Document *doc, void *userData, int endPos) = 0; -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif +// Scintilla source code edit control +/** @file Document.h + ** Text document that handles notifications, DBCS, styling, words and end of line. + **/ +// Copyright 1998-2003 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef DOCUMENT_H +#define DOCUMENT_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +/** + * A Position is a position within a document between two characters or at the beginning or end. + * Sometimes used as a character index where it identifies the character after the position. + */ +typedef int Position; +const Position invalidPosition = -1; + +/** + * The range class represents a range of text in a document. + * The two values are not sorted as one end may be more significant than the other + * as is the case for the selection where the end position is the position of the caret. + * If either position is invalidPosition then the range is invalid and most operations will fail. + */ +class Range { +public: + Position start; + Position end; + + Range(Position pos=0) : + start(pos), end(pos) { + }; + Range(Position start_, Position end_) : + start(start_), end(end_) { + }; + + bool Valid() const { + return (start != invalidPosition) && (end != invalidPosition); + } + + // Is the position within the range? + bool Contains(Position pos) const { + if (start < end) { + return (pos >= start && pos <= end); + } else { + return (pos <= start && pos >= end); + } + } + + // Is the character after pos within the range? + bool ContainsCharacter(Position pos) const { + if (start < end) { + return (pos >= start && pos < end); + } else { + return (pos < start && pos >= end); + } + } + + bool Contains(Range other) const { + return Contains(other.start) && Contains(other.end); + } + + bool Overlaps(Range other) const { + return + Contains(other.start) || + Contains(other.end) || + other.Contains(start) || + other.Contains(end); + } +}; + +class DocWatcher; +class DocModification; +class Document; + +/** + * Interface class for regular expression searching + */ +class RegexSearchBase { +public: + virtual ~RegexSearchBase(){} + + virtual long FindText(Document* doc, int minPos, int maxPos, const char *s, + bool caseSensitive, bool word, bool wordStart, int flags, int *length) = 0; + + ///@return String with the substitutions, must remain valid until the next call or destruction + virtual const char *SubstituteByPosition(Document* doc, const char *text, int *length) = 0; +}; + +/// Factory function for RegexSearchBase +extern RegexSearchBase* CreateRegexSearch(CharClassify *charClassTable); + +struct StyledText { + size_t length; + const char *text; + bool multipleStyles; + size_t style; + const unsigned char *styles; + StyledText( size_t length_, const char *text_, bool multipleStyles_, int style_, const unsigned char *styles_) : + length(length_), text(text_), multipleStyles(multipleStyles_), style(style_), styles(styles_) { + } + // Return number of bytes from start to before '\n' or end of text. + // Return 1 when start is outside text + size_t LineLength(size_t start) const { + size_t cur = start; + while ((cur < length) && (text[cur] != '\n')) + cur++; + return cur-start; + } + size_t StyleAt(size_t i) const { + return multipleStyles ? styles[i] : style; + } +}; + +/** + */ +class Document : PerLine { + +public: + /** Used to pair watcher pointer with user data. */ + class WatcherWithUserData { + public: + DocWatcher *watcher; + void *userData; + WatcherWithUserData() { + watcher = 0; + userData = 0; + } + }; + + enum charClassification { ccSpace, ccNewLine, ccWord, ccPunctuation }; +private: + int refCount; + CellBuffer cb; + CharClassify charClass; + char stylingMask; + int endStyled; + int styleClock; + int enteredModification; + int enteredStyling; + int enteredReadOnlyCount; + + WatcherWithUserData *watchers; + int lenWatchers; + + // ldSize is not real data - it is for dimensions and loops + enum lineData { ldMarkers, ldLevels, ldState, ldMargin, ldAnnotation, ldSize }; + PerLine *perLineData[ldSize]; + + bool matchesValid; + RegexSearchBase* regex; + +public: + int stylingBits; + int stylingBitsMask; + + int eolMode; + /// Can also be SC_CP_UTF8 to enable UTF-8 mode + int dbcsCodePage; + int tabInChars; + int indentInChars; + int actualIndentInChars; + bool useTabs; + bool tabIndents; + bool backspaceUnindents; + + DecorationList decorations; + + Document(); + virtual ~Document(); + + int AddRef(); + int Release(); + + virtual void Init(); + virtual void InsertLine(int line); + virtual void RemoveLine(int line); + + int LineFromPosition(int pos) const; + int ClampPositionIntoDocument(int pos); + bool IsCrLf(int pos); + int LenChar(int pos); + bool InGoodUTF8(int pos, int &start, int &end); + int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true); + + // Gateways to modifying document + void ModifiedAt(int pos); + void CheckReadOnly(); + bool DeleteChars(int pos, int len); + bool InsertString(int position, const char *s, int insertLength); + int Undo(); + int Redo(); + bool CanUndo() { return cb.CanUndo(); } + bool CanRedo() { return cb.CanRedo(); } + void DeleteUndoHistory() { cb.DeleteUndoHistory(); } + bool SetUndoCollection(bool collectUndo) { + return cb.SetUndoCollection(collectUndo); + } + bool IsCollectingUndo() { return cb.IsCollectingUndo(); } + void BeginUndoAction() { cb.BeginUndoAction(); } + void EndUndoAction() { cb.EndUndoAction(); } + void AddUndoAction(int token, bool mayCoalesce) { cb.AddUndoAction(token, mayCoalesce); } + void SetSavePoint(); + bool IsSavePoint() { return cb.IsSavePoint(); } + const char *BufferPointer() { return cb.BufferPointer(); } + + int GetLineIndentation(int line); + void SetLineIndentation(int line, int indent); + int GetLineIndentPosition(int line) const; + int GetColumn(int position); + int FindColumn(int line, int column); + void Indent(bool forwards, int lineBottom, int lineTop); + static char *TransformLineEnds(int *pLenOut, const char *s, size_t len, int eolMode); + void ConvertLineEnds(int eolModeSet); + void SetReadOnly(bool set) { cb.SetReadOnly(set); } + bool IsReadOnly() { return cb.IsReadOnly(); } + + bool InsertChar(int pos, char ch); + bool InsertCString(int position, const char *s); + void ChangeChar(int pos, char ch); + void DelChar(int pos); + void DelCharBack(int pos); + + char CharAt(int position) { return cb.CharAt(position); } + void GetCharRange(char *buffer, int position, int lengthRetrieve) { + cb.GetCharRange(buffer, position, lengthRetrieve); + } + char StyleAt(int position) { return cb.StyleAt(position); } + int GetMark(int line); + int AddMark(int line, int markerNum); + void AddMarkSet(int line, int valueSet); + void DeleteMark(int line, int markerNum); + void DeleteMarkFromHandle(int markerHandle); + void DeleteAllMarks(int markerNum); + int LineFromHandle(int markerHandle); + int LineStart(int line) const; + int LineEnd(int line) const; + int LineEndPosition(int position) const; + bool IsLineEndPosition(int position) const; + int VCHomePosition(int position) const; + + int SetLevel(int line, int level); + int GetLevel(int line); + void ClearLevels(); + int GetLastChild(int lineParent, int level=-1); + int GetFoldParent(int line); + + void Indent(bool forwards); + int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false); + int NextWordStart(int pos, int delta); + int NextWordEnd(int pos, int delta); + int Length() const { return cb.Length(); } + void Allocate(int newSize) { cb.Allocate(newSize); } + long FindText(int minPos, int maxPos, const char *s, + bool caseSensitive, bool word, bool wordStart, bool regExp, int flags, int *length); + long FindText(int iMessage, unsigned long wParam, long lParam); + const char *SubstituteByPosition(const char *text, int *length); + int LinesTotal() const; + + void ChangeCase(Range r, bool makeUpperCase); + + void SetDefaultCharClasses(bool includeWordClass); + void SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass); + void SetStylingBits(int bits); + void StartStyling(int position, char mask); + bool SetStyleFor(int length, char style); + bool SetStyles(int length, const char *styles); + int GetEndStyled() { return endStyled; } + void EnsureStyledTo(int pos); + int GetStyleClock() { return styleClock; } + void IncrementStyleClock(); + void DecorationFillRange(int position, int value, int fillLength); + + int SetLineState(int line, int state); + int GetLineState(int line); + int GetMaxLineState(); + + StyledText MarginStyledText(int line); + void MarginSetStyle(int line, int style); + void MarginSetStyles(int line, const unsigned char *styles); + void MarginSetText(int line, const char *text); + int MarginLength(int line) const; + void MarginClearAll(); + + bool AnnotationAny() const; + StyledText AnnotationStyledText(int line); + void AnnotationSetText(int line, const char *text); + void AnnotationSetStyle(int line, int style); + void AnnotationSetStyles(int line, const unsigned char *styles); + int AnnotationLength(int line) const; + int AnnotationLines(int line) const; + void AnnotationClearAll(); + + bool AddWatcher(DocWatcher *watcher, void *userData); + bool RemoveWatcher(DocWatcher *watcher, void *userData); + const WatcherWithUserData *GetWatchers() const { return watchers; } + int GetLenWatchers() const { return lenWatchers; } + + bool IsWordPartSeparator(char ch); + int WordPartLeft(int pos); + int WordPartRight(int pos); + int ExtendStyleRange(int pos, int delta, bool singleLine = false); + bool IsWhiteLine(int line) const; + int ParaUp(int pos); + int ParaDown(int pos); + int IndentSize() { return actualIndentInChars; } + int BraceMatch(int position, int maxReStyle); + +private: + CharClassify::cc WordCharClass(unsigned char ch); + bool IsWordStartAt(int pos); + bool IsWordEndAt(int pos); + bool IsWordAt(int start, int end); + + void NotifyModifyAttempt(); + void NotifySavePoint(bool atSavePoint); + void NotifyModified(DocModification mh); +}; + +class UndoGroup { + Document *pdoc; + bool groupNeeded; +public: + UndoGroup(Document *pdoc_, bool groupNeeded_=true) : + pdoc(pdoc_), groupNeeded(groupNeeded_) { + if (groupNeeded) { + pdoc->BeginUndoAction(); + } + } + ~UndoGroup() { + if (groupNeeded) { + pdoc->EndUndoAction(); + } + } + bool Needed() const { + return groupNeeded; + } +}; + + +/** + * To optimise processing of document modifications by DocWatchers, a hint is passed indicating the + * scope of the change. + * If the DocWatcher is a document view then this can be used to optimise screen updating. + */ +class DocModification { +public: + int modificationType; + int position; + int length; + int linesAdded; /**< Negative if lines deleted. */ + const char *text; /**< Only valid for changes to text, not for changes to style. */ + int line; + int foldLevelNow; + int foldLevelPrev; + int annotationLinesAdded; + int token; + + DocModification(int modificationType_, int position_=0, int length_=0, + int linesAdded_=0, const char *text_=0, int line_=0) : + modificationType(modificationType_), + position(position_), + length(length_), + linesAdded(linesAdded_), + text(text_), + line(line_), + foldLevelNow(0), + foldLevelPrev(0), + annotationLinesAdded(0), + token(0) {} + + DocModification(int modificationType_, const Action &act, int linesAdded_=0) : + modificationType(modificationType_), + position(act.position), + length(act.lenData), + linesAdded(linesAdded_), + text(act.data), + line(0), + foldLevelNow(0), + foldLevelPrev(0), + annotationLinesAdded(0), + token(0) {} +}; + +/** + * A class that wants to receive notifications from a Document must be derived from DocWatcher + * and implement the notification methods. It can then be added to the watcher list with AddWatcher. + */ +class DocWatcher { +public: + virtual ~DocWatcher() {} + + virtual void NotifyModifyAttempt(Document *doc, void *userData) = 0; + virtual void NotifySavePoint(Document *doc, void *userData, bool atSavePoint) = 0; + virtual void NotifyModified(Document *doc, DocModification mh, void *userData) = 0; + virtual void NotifyDeleted(Document *doc, void *userData) = 0; + virtual void NotifyStyleNeeded(Document *doc, void *userData, int endPos) = 0; +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/sdk/wxscintilla/src/scintilla/src/DocumentAccessor.cxx b/sdk/wxscintilla/src/scintilla/src/DocumentAccessor.cxx index 7dd38fe96f..a25979dc2c 100644 --- a/sdk/wxscintilla/src/scintilla/src/DocumentAccessor.cxx +++ b/sdk/wxscintilla/src/scintilla/src/DocumentAccessor.cxx @@ -1,199 +1,199 @@ -// Scintilla source code edit control -/** @file DocumentAccessor.cxx - ** Rapid easy access to contents of a Scintilla. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include - -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "DocumentAccessor.h" -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" -#include "CellBuffer.h" -#include "Scintilla.h" -#include "CharClassify.h" -#include "Decoration.h" -#include "Document.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -DocumentAccessor::~DocumentAccessor() { -} - -bool DocumentAccessor::InternalIsLeadByte(char ch) { - if (SC_CP_UTF8 == codePage) - // For lexing, all characters >= 0x80 are treated the - // same so none is considered a lead byte. - return false; - else - return Platform::IsDBCSLeadByte(codePage, ch); -} - -void DocumentAccessor::Fill(int position) { - if (lenDoc == -1) - lenDoc = pdoc->Length(); - startPos = position - slopSize; - if (startPos + bufferSize > lenDoc) - startPos = lenDoc - bufferSize; - if (startPos < 0) - startPos = 0; - endPos = startPos + bufferSize; - if (endPos > lenDoc) - endPos = lenDoc; - - pdoc->GetCharRange(buf, startPos, endPos-startPos); - buf[endPos-startPos] = '\0'; -} - -bool DocumentAccessor::Match(int pos, const char *s) { - for (int i=0; *s; i++) { - if (*s != SafeGetCharAt(pos+i)) - return false; - s++; - } - return true; -} - -char DocumentAccessor::StyleAt(int position) { - // Mask off all bits which aren't in the 'mask'. - return static_cast(pdoc->StyleAt(position) & mask); -} - -int DocumentAccessor::GetLine(int position) { - return pdoc->LineFromPosition(position); -} - -int DocumentAccessor::LineStart(int line) { - return pdoc->LineStart(line); -} - -int DocumentAccessor::LevelAt(int line) { - return pdoc->GetLevel(line); -} - -int DocumentAccessor::Length() { - if (lenDoc == -1) - lenDoc = pdoc->Length(); - return lenDoc; -} - -int DocumentAccessor::GetLineState(int line) { - return pdoc->GetLineState(line); -} - -int DocumentAccessor::SetLineState(int line, int state) { - return pdoc->SetLineState(line, state); -} - -void DocumentAccessor::StartAt(unsigned int start, char chMask) { - // Store the mask specified for use with StyleAt. - mask = chMask; - pdoc->StartStyling(start, chMask); - startPosStyling = start; -} - -void DocumentAccessor::StartSegment(unsigned int pos) { - startSeg = pos; -} - -void DocumentAccessor::ColourTo(unsigned int pos, int chAttr) { - // Only perform styling if non empty range - if (pos != startSeg - 1) { - PLATFORM_ASSERT(pos >= startSeg); - if (pos < startSeg) { - return; - } - - if (validLen + (pos - startSeg + 1) >= bufferSize) - Flush(); - if (validLen + (pos - startSeg + 1) >= bufferSize) { - // Too big for buffer so send directly - pdoc->SetStyleFor(pos - startSeg + 1, static_cast(chAttr)); - } else { - if (chAttr != chWhile) - chFlags = 0; - chAttr |= chFlags; - for (unsigned int i = startSeg; i <= pos; i++) { - PLATFORM_ASSERT((startPosStyling + validLen) < Length()); - styleBuf[validLen++] = static_cast(chAttr); - } - } - } - startSeg = pos+1; -} - -void DocumentAccessor::SetLevel(int line, int level) { - pdoc->SetLevel(line, level); -} - -void DocumentAccessor::Flush() { - startPos = extremePosition; - lenDoc = -1; - if (validLen > 0) { - pdoc->SetStyles(validLen, styleBuf); - startPosStyling += validLen; - validLen = 0; - } -} - -int DocumentAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) { - int end = Length(); - int spaceFlags = 0; - - // Determines the indentation level of the current line and also checks for consistent - // indentation compared to the previous line. - // Indentation is judged consistent when the indentation whitespace of each line lines - // the same or the indentation of one line is a prefix of the other. - - int pos = LineStart(line); - char ch = (*this)[pos]; - int indent = 0; - bool inPrevPrefix = line > 0; - int posPrev = inPrevPrefix ? LineStart(line-1) : 0; - while ((ch == ' ' || ch == '\t') && (pos < end)) { - if (inPrevPrefix) { - char chPrev = (*this)[posPrev++]; - if (chPrev == ' ' || chPrev == '\t') { - if (chPrev != ch) - spaceFlags |= wsInconsistent; - } else { - inPrevPrefix = false; - } - } - if (ch == ' ') { - spaceFlags |= wsSpace; - indent++; - } else { // Tab - spaceFlags |= wsTab; - if (spaceFlags & wsSpace) - spaceFlags |= wsSpaceTab; - indent = (indent / 8 + 1) * 8; - } - ch = (*this)[++pos]; - } - - *flags = spaceFlags; - indent += SC_FOLDLEVELBASE; - // if completely empty line or the start of a comment... - if ((ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') || - (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) ) - return indent | SC_FOLDLEVELWHITEFLAG; - else - return indent; -} - -void DocumentAccessor::IndicatorFill(int start, int end, int indicator, int value) { - pdoc->decorations.SetCurrentIndicator(indicator); - pdoc->DecorationFillRange(start, value, end - start); -} +// Scintilla source code edit control +/** @file DocumentAccessor.cxx + ** Rapid easy access to contents of a Scintilla. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "DocumentAccessor.h" +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" +#include "CellBuffer.h" +#include "Scintilla.h" +#include "CharClassify.h" +#include "Decoration.h" +#include "Document.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +DocumentAccessor::~DocumentAccessor() { +} + +bool DocumentAccessor::InternalIsLeadByte(char ch) { + if (SC_CP_UTF8 == codePage) + // For lexing, all characters >= 0x80 are treated the + // same so none is considered a lead byte. + return false; + else + return Platform::IsDBCSLeadByte(codePage, ch); +} + +void DocumentAccessor::Fill(int position) { + if (lenDoc == -1) + lenDoc = pdoc->Length(); + startPos = position - slopSize; + if (startPos + bufferSize > lenDoc) + startPos = lenDoc - bufferSize; + if (startPos < 0) + startPos = 0; + endPos = startPos + bufferSize; + if (endPos > lenDoc) + endPos = lenDoc; + + pdoc->GetCharRange(buf, startPos, endPos-startPos); + buf[endPos-startPos] = '\0'; +} + +bool DocumentAccessor::Match(int pos, const char *s) { + for (int i=0; *s; i++) { + if (*s != SafeGetCharAt(pos+i)) + return false; + s++; + } + return true; +} + +char DocumentAccessor::StyleAt(int position) { + // Mask off all bits which aren't in the 'mask'. + return static_cast(pdoc->StyleAt(position) & mask); +} + +int DocumentAccessor::GetLine(int position) { + return pdoc->LineFromPosition(position); +} + +int DocumentAccessor::LineStart(int line) { + return pdoc->LineStart(line); +} + +int DocumentAccessor::LevelAt(int line) { + return pdoc->GetLevel(line); +} + +int DocumentAccessor::Length() { + if (lenDoc == -1) + lenDoc = pdoc->Length(); + return lenDoc; +} + +int DocumentAccessor::GetLineState(int line) { + return pdoc->GetLineState(line); +} + +int DocumentAccessor::SetLineState(int line, int state) { + return pdoc->SetLineState(line, state); +} + +void DocumentAccessor::StartAt(unsigned int start, char chMask) { + // Store the mask specified for use with StyleAt. + mask = chMask; + pdoc->StartStyling(start, chMask); + startPosStyling = start; +} + +void DocumentAccessor::StartSegment(unsigned int pos) { + startSeg = pos; +} + +void DocumentAccessor::ColourTo(unsigned int pos, int chAttr) { + // Only perform styling if non empty range + if (pos != startSeg - 1) { + PLATFORM_ASSERT(pos >= startSeg); + if (pos < startSeg) { + return; + } + + if (validLen + (pos - startSeg + 1) >= bufferSize) + Flush(); + if (validLen + (pos - startSeg + 1) >= bufferSize) { + // Too big for buffer so send directly + pdoc->SetStyleFor(pos - startSeg + 1, static_cast(chAttr)); + } else { + if (chAttr != chWhile) + chFlags = 0; + chAttr |= chFlags; + for (unsigned int i = startSeg; i <= pos; i++) { + PLATFORM_ASSERT((startPosStyling + validLen) < Length()); + styleBuf[validLen++] = static_cast(chAttr); + } + } + } + startSeg = pos+1; +} + +void DocumentAccessor::SetLevel(int line, int level) { + pdoc->SetLevel(line, level); +} + +void DocumentAccessor::Flush() { + startPos = extremePosition; + lenDoc = -1; + if (validLen > 0) { + pdoc->SetStyles(validLen, styleBuf); + startPosStyling += validLen; + validLen = 0; + } +} + +int DocumentAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) { + int end = Length(); + int spaceFlags = 0; + + // Determines the indentation level of the current line and also checks for consistent + // indentation compared to the previous line. + // Indentation is judged consistent when the indentation whitespace of each line lines + // the same or the indentation of one line is a prefix of the other. + + int pos = LineStart(line); + char ch = (*this)[pos]; + int indent = 0; + bool inPrevPrefix = line > 0; + int posPrev = inPrevPrefix ? LineStart(line-1) : 0; + while ((ch == ' ' || ch == '\t') && (pos < end)) { + if (inPrevPrefix) { + char chPrev = (*this)[posPrev++]; + if (chPrev == ' ' || chPrev == '\t') { + if (chPrev != ch) + spaceFlags |= wsInconsistent; + } else { + inPrevPrefix = false; + } + } + if (ch == ' ') { + spaceFlags |= wsSpace; + indent++; + } else { // Tab + spaceFlags |= wsTab; + if (spaceFlags & wsSpace) + spaceFlags |= wsSpaceTab; + indent = (indent / 8 + 1) * 8; + } + ch = (*this)[++pos]; + } + + *flags = spaceFlags; + indent += SC_FOLDLEVELBASE; + // if completely empty line or the start of a comment... + if ((ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') || + (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos)) ) + return indent | SC_FOLDLEVELWHITEFLAG; + else + return indent; +} + +void DocumentAccessor::IndicatorFill(int start, int end, int indicator, int value) { + pdoc->decorations.SetCurrentIndicator(indicator); + pdoc->DecorationFillRange(start, value, end - start); +} diff --git a/sdk/wxscintilla/src/scintilla/src/DocumentAccessor.h b/sdk/wxscintilla/src/scintilla/src/DocumentAccessor.h index 6f1ce541f8..92440428e3 100644 --- a/sdk/wxscintilla/src/scintilla/src/DocumentAccessor.h +++ b/sdk/wxscintilla/src/scintilla/src/DocumentAccessor.h @@ -1,76 +1,77 @@ -// Scintilla source code edit control -/** @file DocumentAccessor.h - ** Implementation of BufferAccess and StylingAccess on a Scintilla - ** rapid easy access to contents of a Scintilla. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -class Document; - -/** - */ -class DocumentAccessor : public Accessor { - // Private so DocumentAccessor objects can not be copied - DocumentAccessor(const DocumentAccessor &source) : Accessor(), props(source.props) {} - DocumentAccessor &operator=(const DocumentAccessor &) { return *this; } - -protected: - Document *pdoc; - PropSet &props; - WindowID id; - int lenDoc; - - char styleBuf[bufferSize]; - int validLen; - char chFlags; - char chWhile; - unsigned int startSeg; - int startPosStyling; - int mask; - - bool InternalIsLeadByte(char ch); - void Fill(int position); - -public: - DocumentAccessor(Document *pdoc_, PropSet &props_, WindowID id_=0) : - Accessor(), pdoc(pdoc_), props(props_), id(id_), - lenDoc(-1), validLen(0), chFlags(0), chWhile(0), - startSeg(0), startPosStyling(0), - mask(127) { // Initialize the mask to be big enough for any lexer. - } - ~DocumentAccessor(); - bool Match(int pos, const char *s); - char StyleAt(int position); - int GetLine(int position); - int LineStart(int line); - int LevelAt(int line); - int Length(); - void Flush(); - int GetLineState(int line); - int SetLineState(int line, int state); - int GetPropertyInt(const char *key, int defaultValue=0) { - return props.GetInt(key, defaultValue); - } - char *GetProperties() { - return props.ToString(); - } - WindowID GetWindow() { return id; } - - void StartAt(unsigned int start, char chMask=31); - void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }; - unsigned int GetStartSegment() { return startSeg; } - void StartSegment(unsigned int pos); - void ColourTo(unsigned int pos, int chAttr); - void SetLevel(int line, int level); - int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); - void IndicatorFill(int start, int end, int indicator, int value); -}; - -#ifdef SCI_NAMESPACE -} -#endif +// Scintilla source code edit control +/** @file DocumentAccessor.h + ** Implementation of BufferAccess and StylingAccess on a Scintilla + ** rapid easy access to contents of a Scintilla. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +class Document; + +/** + */ + +class DocumentAccessor : public Accessor { + // Private so DocumentAccessor objects can not be copied + DocumentAccessor(const DocumentAccessor &source) : Accessor(), props(source.props) {} + DocumentAccessor &operator=(const DocumentAccessor &) { return *this; } + +protected: + Document *pdoc; + PropertyGet &props; + WindowID id; + int lenDoc; + + char styleBuf[bufferSize]; + int validLen; + char chFlags; + char chWhile; + unsigned int startSeg; + int startPosStyling; + int mask; + + bool InternalIsLeadByte(char ch); + void Fill(int position); + +public: + DocumentAccessor(Document *pdoc_, PropertyGet &props_, WindowID id_=0) : + Accessor(), pdoc(pdoc_), props(props_), id(id_), + lenDoc(-1), validLen(0), chFlags(0), chWhile(0), + startSeg(0), startPosStyling(0), + mask(127) { // Initialize the mask to be big enough for any lexer. + } + ~DocumentAccessor(); + bool Match(int pos, const char *s); + char StyleAt(int position); + int GetLine(int position); + int LineStart(int line); + int LevelAt(int line); + int Length(); + void Flush(); + int GetLineState(int line); + int SetLineState(int line, int state); + int GetPropertyInt(const char *key, int defaultValue=0) { + return props.GetInt(key, defaultValue); + } + char *GetProperties() { + return props.ToString(); + } + WindowID GetWindow() { return id; } + + void StartAt(unsigned int start, char chMask=31); + void SetFlags(char chFlags_, char chWhile_) {chFlags = chFlags_; chWhile = chWhile_; }; + unsigned int GetStartSegment() { return startSeg; } + void StartSegment(unsigned int pos); + void ColourTo(unsigned int pos, int chAttr); + void SetLevel(int line, int level); + int IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); + void IndicatorFill(int start, int end, int indicator, int value); +}; + +#ifdef SCI_NAMESPACE +} +#endif diff --git a/sdk/wxscintilla/src/scintilla/src/Editor.cxx b/sdk/wxscintilla/src/scintilla/src/Editor.cxx index 4db752c13b..e1ea6ab61b 100644 --- a/sdk/wxscintilla/src/scintilla/src/Editor.cxx +++ b/sdk/wxscintilla/src/scintilla/src/Editor.cxx @@ -1,7598 +1,8358 @@ -// Scintilla source code edit control -/** @file Editor.cxx - ** Main code for the edit control. - **/ -// Copyright 1998-2004 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include - -#include "Platform.h" - -#ifndef PLAT_QT -#define INCLUDE_DEPRECATED_FEATURES -#endif -#include "Scintilla.h" - -#include "SplitVector.h" -#include "Partitioning.h" -#include "RunStyles.h" -#include "ContractionState.h" -#include "CellBuffer.h" -#include "KeyMap.h" -#include "Indicator.h" -#include "XPM.h" -#include "LineMarker.h" -#include "Style.h" -#include "ViewStyle.h" -#include "CharClassify.h" -#include "Decoration.h" -#include "Document.h" -#include "PositionCache.h" -#include "Editor.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -/* - return whether this modification represents an operation that - may reasonably be deferred (not done now OR [possibly] at all) -*/ -static bool CanDeferToLastStep(const DocModification& mh) { - if (mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) - return true; // CAN skip - if (!(mh.modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO))) - return false; // MUST do - if (mh.modificationType & SC_MULTISTEPUNDOREDO) - return true; // CAN skip - return false; // PRESUMABLY must do -} - -static bool CanEliminate(const DocModification& mh) { - return - (mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) != 0; -} - -/* - return whether this modification represents the FINAL step - in a [possibly lengthy] multi-step Undo/Redo sequence -*/ -static bool IsLastStep(const DocModification& mh) { - return - (mh.modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO)) != 0 - && (mh.modificationType & SC_MULTISTEPUNDOREDO) != 0 - && (mh.modificationType & SC_LASTSTEPINUNDOREDO) != 0 - && (mh.modificationType & SC_MULTILINEUNDOREDO) != 0; -} - -Caret::Caret() : - active(false), on(false), period(500) {} - -Timer::Timer() : - ticking(false), ticksToWait(0), tickerID(0) {} - -Idler::Idler() : - state(false), idlerID(0) {} - -static inline bool IsControlCharacter(int ch) { - // iscntrl returns true for lots of chars > 127 which are displayable - return ch >= 0 && ch < ' '; -} - -Editor::Editor() { - ctrlID = 0; - - stylesValid = false; - - printMagnification = 0; - printColourMode = SC_PRINT_NORMAL; - printWrapState = eWrapWord; - cursorMode = SC_CURSORNORMAL; - controlCharSymbol = 0; /* Draw the control characters */ - - hasFocus = false; - hideSelection = false; - inOverstrike = false; - errorStatus = 0; - mouseDownCaptures = true; - - bufferedDraw = true; - twoPhaseDraw = true; - - lastClickTime = 0; - dwellDelay = SC_TIME_FOREVER; - ticksToDwell = SC_TIME_FOREVER; - dwelling = false; - ptMouseLast.x = 0; - ptMouseLast.y = 0; - inDragDrop = ddNone; - dropWentOutside = false; - posDrag = invalidPosition; - posDrop = invalidPosition; - selectionType = selChar; - - lastXChosen = 0; - lineAnchor = 0; - originalAnchorPos = 0; - - selType = selStream; - moveExtendsSelection = false; - xStartSelect = 0; - xEndSelect = 0; - primarySelection = true; - - caretXPolicy = CARET_SLOP | CARET_EVEN; - caretXSlop = 50; - - caretYPolicy = CARET_EVEN; - caretYSlop = 0; - - searchAnchor = 0; - - xOffset = 0; - xCaretMargin = 50; - horizontalScrollBarVisible = true; - scrollWidth = 2000; - trackLineWidth = false; - lineWidthMaxSeen = 0; - verticalScrollBarVisible = true; - endAtLastLine = true; - caretSticky = false; - - pixmapLine = Surface::Allocate(); - pixmapSelMargin = Surface::Allocate(); - pixmapSelPattern = Surface::Allocate(); - pixmapIndentGuide = Surface::Allocate(); - pixmapIndentGuideHighlight = Surface::Allocate(); - - currentPos = 0; - anchor = 0; - - targetStart = 0; - targetEnd = 0; - searchFlags = 0; - - topLine = 0; - posTopLine = 0; - - lengthForEncode = -1; - - needUpdateUI = true; - braces[0] = invalidPosition; - braces[1] = invalidPosition; - bracesMatchStyle = STYLE_BRACEBAD; - highlightGuideColumn = 0; - - theEdge = 0; - - paintState = notPainting; - - modEventMask = SC_MODEVENTMASKALL; - - pdoc = new Document(); - pdoc->AddRef(); - pdoc->AddWatcher(this, 0); - - recordingMacro = false; - foldFlags = 0; - - wrapState = eWrapNone; - wrapWidth = LineLayout::wrapWidthInfinite; - wrapStart = wrapLineLarge; - wrapEnd = wrapLineLarge; - wrapVisualFlags = 0; - wrapVisualFlagsLocation = 0; - wrapVisualStartIndent = 0; - actualWrapVisualStartIndent = 0; - - convertPastes = true; - - hsStart = -1; - hsEnd = -1; - - llc.SetLevel(LineLayoutCache::llcCaret); - posCache.SetSize(0x400); -} - -Editor::~Editor() { - pdoc->RemoveWatcher(this, 0); - pdoc->Release(); - pdoc = 0; - DropGraphics(); - delete pixmapLine; - delete pixmapSelMargin; - delete pixmapSelPattern; - delete pixmapIndentGuide; - delete pixmapIndentGuideHighlight; -} - -void Editor::Finalise() { - SetIdle(false); - CancelModes(); -} - -void Editor::DropGraphics() { - pixmapLine->Release(); - pixmapSelMargin->Release(); - pixmapSelPattern->Release(); - pixmapIndentGuide->Release(); - pixmapIndentGuideHighlight->Release(); -} - -void Editor::InvalidateStyleData() { - stylesValid = false; - DropGraphics(); - palette.Release(); - llc.Invalidate(LineLayout::llInvalid); - posCache.Clear(); - if (selType == selRectangle) { - xStartSelect = XFromPosition(anchor); - xEndSelect = XFromPosition(currentPos); - } -} - -void Editor::InvalidateStyleRedraw() { - NeedWrapping(); - InvalidateStyleData(); - Redraw(); -} - -void Editor::RefreshColourPalette(Palette &pal, bool want) { - vs.RefreshColourPalette(pal, want); -} - -void Editor::RefreshStyleData() { - if (!stylesValid) { - stylesValid = true; - AutoSurface surface(this); - if (surface) { - vs.Refresh(*surface); - RefreshColourPalette(palette, true); - palette.Allocate(wMain); - RefreshColourPalette(palette, false); - } - SetScrollBars(); - } -} - -PRectangle Editor::GetClientRectangle() { - return wMain.GetClientPosition(); -} - -PRectangle Editor::GetTextRectangle() { - PRectangle rc = GetClientRectangle(); - rc.left += vs.fixedColumnWidth; - rc.right -= vs.rightMarginWidth; - return rc; -} - -int Editor::LinesOnScreen() { - PRectangle rcClient = GetClientRectangle(); - int htClient = rcClient.bottom - rcClient.top; - //Platform::DebugPrintf("lines on screen = %d\n", htClient / lineHeight + 1); - return htClient / vs.lineHeight; -} - -int Editor::LinesToScroll() { - int retVal = LinesOnScreen() - 1; - if (retVal < 1) - return 1; - else - return retVal; -} - -int Editor::MaxScrollPos() { - //Platform::DebugPrintf("Lines %d screen = %d maxScroll = %d\n", - //LinesTotal(), LinesOnScreen(), LinesTotal() - LinesOnScreen() + 1); - int retVal = cs.LinesDisplayed(); - if (endAtLastLine) { - retVal -= LinesOnScreen(); - } else { - retVal--; - } - if (retVal < 0) { - return 0; - } else { - return retVal; - } -} - -const char *ControlCharacterString(unsigned char ch) { - const char *reps[] = { - "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", - "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", - "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", - "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US" - }; - if (ch < (sizeof(reps) / sizeof(reps[0]))) { - return reps[ch]; - } else { - return "BAD"; - } -} - -/** - * Convenience class to ensure LineLayout objects are always disposed. - */ -class AutoLineLayout { - LineLayoutCache &llc; - LineLayout *ll; - AutoLineLayout &operator=(const AutoLineLayout &) { return * this; } -public: - AutoLineLayout(LineLayoutCache &llc_, LineLayout *ll_) : llc(llc_), ll(ll_) {} - ~AutoLineLayout() { - llc.Dispose(ll); - ll = 0; - } - LineLayout *operator->() const { - return ll; - } - operator LineLayout *() const { - return ll; - } - void Set(LineLayout *ll_) { - llc.Dispose(ll); - ll = ll_; - } -}; - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -/** - * Allows to iterate through the lines of a selection. - * Althought it can be called for a stream selection, in most cases - * it is inefficient and it should be used only for - * a rectangular or a line selection. - */ -class SelectionLineIterator { -private: - Editor *ed; - int line; ///< Current line within the iteration. - bool forward; ///< True if iterating by increasing line number, false otherwise. - int selStart, selEnd; ///< Positions of the start and end of the selection relative to the start of the document. - int minX, maxX; ///< Left and right of selection rectangle. - -public: - int lineStart, lineEnd; ///< Line numbers, first and last lines of the selection. - int startPos, endPos; ///< Positions of the beginning and end of the selection on the current line. - - void Reset() { - if (forward) { - line = lineStart; - } else { - line = lineEnd; - } - } - - SelectionLineIterator(Editor *ed_, bool forward_ = true) : line(0), startPos(0), endPos(0) { - ed = ed_; - forward = forward_; - selStart = ed->SelectionStart(); - selEnd = ed->SelectionEnd(); - lineStart = ed->pdoc->LineFromPosition(selStart); - lineEnd = ed->pdoc->LineFromPosition(selEnd); - // Left of rectangle - minX = Platform::Minimum(ed->xStartSelect, ed->xEndSelect); - // Right of rectangle - maxX = Platform::Maximum(ed->xStartSelect, ed->xEndSelect); - Reset(); - } - ~SelectionLineIterator() {} - - void SetAt(int line) { - if (line < lineStart || line > lineEnd) { - startPos = endPos = INVALID_POSITION; - } else { - if (ed->selType == ed->selRectangle) { - // Measure line and return character closest to minX - startPos = ed->PositionFromLineX(line, minX); - // Measure line and return character closest to maxX - endPos = ed->PositionFromLineX(line, maxX); - } else if (ed->selType == ed->selLines) { - startPos = ed->pdoc->LineStart(line); - endPos = ed->pdoc->LineStart(line + 1); - } else { // Stream selection, here only for completion - if (line == lineStart) { - startPos = selStart; - } else { - startPos = ed->pdoc->LineStart(line); - } - if (line == lineEnd) { - endPos = selEnd; - } else { - endPos = ed->pdoc->LineStart(line + 1); - } - } - } - } - bool Iterate() { - SetAt(line); - if (forward) { - line++; - } else { - line--; - } - return startPos != INVALID_POSITION; - } -}; - -#ifdef SCI_NAMESPACE -} -#endif - -Point Editor::LocationFromPosition(int pos) { - Point pt; - RefreshStyleData(); - if (pos == INVALID_POSITION) - return pt; - int line = pdoc->LineFromPosition(pos); - int lineVisible = cs.DisplayFromDoc(line); - //Platform::DebugPrintf("line=%d\n", line); - AutoSurface surface(this); - AutoLineLayout ll(llc, RetrieveLineLayout(line)); - if (surface && ll) { - // -1 because of adding in for visible lines in following loop. - pt.y = (lineVisible - topLine - 1) * vs.lineHeight; - pt.x = 0; - unsigned int posLineStart = pdoc->LineStart(line); - LayoutLine(line, surface, vs, ll, wrapWidth); - int posInLine = pos - posLineStart; - // In case of very long line put x at arbitrary large position - if (posInLine > ll->maxLineLength) { - pt.x = ll->positions[ll->maxLineLength] - ll->positions[ll->LineStart(ll->lines)]; - } - - for (int subLine = 0; subLine < ll->lines; subLine++) { - if ((posInLine >= ll->LineStart(subLine)) && (posInLine <= ll->LineStart(subLine + 1))) { - pt.x = ll->positions[posInLine] - ll->positions[ll->LineStart(subLine)]; - if (actualWrapVisualStartIndent != 0) { - int lineStart = ll->LineStart(subLine); - if (lineStart != 0) // Wrapped - pt.x += actualWrapVisualStartIndent * vs.aveCharWidth; - } - } - if (posInLine >= ll->LineStart(subLine)) { - pt.y += vs.lineHeight; - } - } - pt.x += vs.fixedColumnWidth - xOffset; - } - return pt; -} - -int Editor::XFromPosition(int pos) { - Point pt = LocationFromPosition(pos); - return pt.x - vs.fixedColumnWidth + xOffset; -} - -int Editor::LineFromLocation(Point pt) { - return cs.DocFromDisplay(pt.y / vs.lineHeight + topLine); -} - -void Editor::SetTopLine(int topLineNew) { - topLine = topLineNew; - posTopLine = pdoc->LineStart(cs.DocFromDisplay(topLine)); -} - -int Editor::PositionFromLocation(Point pt) { - RefreshStyleData(); - pt.x = pt.x - vs.fixedColumnWidth + xOffset; - int visibleLine = pt.y / vs.lineHeight + topLine; - if (pt.y < 0) { // Division rounds towards 0 - visibleLine = (pt.y - (vs.lineHeight - 1)) / vs.lineHeight + topLine; - } - if (visibleLine < 0) - visibleLine = 0; - int lineDoc = cs.DocFromDisplay(visibleLine); - if (lineDoc >= pdoc->LinesTotal()) - return pdoc->Length(); - unsigned int posLineStart = pdoc->LineStart(lineDoc); - int retVal = posLineStart; - AutoSurface surface(this); - AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc)); - if (surface && ll) { - LayoutLine(lineDoc, surface, vs, ll, wrapWidth); - int lineStartSet = cs.DisplayFromDoc(lineDoc); - int subLine = visibleLine - lineStartSet; - if (subLine < ll->lines) { - int lineStart = ll->LineStart(subLine); - int lineEnd = ll->LineLastVisible(subLine); - int subLineStart = ll->positions[lineStart]; - - if (actualWrapVisualStartIndent != 0) { - if (lineStart != 0) // Wrapped - pt.x -= actualWrapVisualStartIndent * vs.aveCharWidth; - } - int i = ll->FindBefore(pt.x + subLineStart, lineStart, lineEnd); - while (i < lineEnd) { - if ((pt.x + subLineStart) < ((ll->positions[i] + ll->positions[i + 1]) / 2)) { - return pdoc->MovePositionOutsideChar(i + posLineStart, 1); - } - i++; - } - return lineEnd + posLineStart; - } - retVal = ll->numCharsInLine + posLineStart; - } - return retVal; -} - -// Like PositionFromLocation but INVALID_POSITION returned when not near any text. -int Editor::PositionFromLocationClose(Point pt) { - RefreshStyleData(); - PRectangle rcClient = GetTextRectangle(); - if (!rcClient.Contains(pt)) - return INVALID_POSITION; - if (pt.x < vs.fixedColumnWidth) - return INVALID_POSITION; - if (pt.y < 0) - return INVALID_POSITION; - pt.x = pt.x - vs.fixedColumnWidth + xOffset; - int visibleLine = pt.y / vs.lineHeight + topLine; - if (pt.y < 0) { // Division rounds towards 0 - visibleLine = (pt.y - (vs.lineHeight - 1)) / vs.lineHeight + topLine; - } - int lineDoc = cs.DocFromDisplay(visibleLine); - if (lineDoc < 0) - return INVALID_POSITION; - if (lineDoc >= pdoc->LinesTotal()) - return INVALID_POSITION; - AutoSurface surface(this); - AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc)); - if (surface && ll) { - LayoutLine(lineDoc, surface, vs, ll, wrapWidth); - unsigned int posLineStart = pdoc->LineStart(lineDoc); - int lineStartSet = cs.DisplayFromDoc(lineDoc); - int subLine = visibleLine - lineStartSet; - if (subLine < ll->lines) { - int lineStart = ll->LineStart(subLine); - int lineEnd = ll->LineLastVisible(subLine); - int subLineStart = ll->positions[lineStart]; - - if (actualWrapVisualStartIndent != 0) { - if (lineStart != 0) // Wrapped - pt.x -= actualWrapVisualStartIndent * vs.aveCharWidth; - } - int i = ll->FindBefore(pt.x + subLineStart, lineStart, lineEnd); - while (i < lineEnd) { - if ((pt.x + subLineStart) < ((ll->positions[i] + ll->positions[i + 1]) / 2)) { - return pdoc->MovePositionOutsideChar(i + posLineStart, 1); - } - i++; - } - if (pt.x < (ll->positions[lineEnd] - subLineStart)) { - return pdoc->MovePositionOutsideChar(lineEnd + posLineStart, 1); - } - } - } - - return INVALID_POSITION; -} - -/** - * Find the document position corresponding to an x coordinate on a particular document line. - * Ensure is between whole characters when document is in multi-byte or UTF-8 mode. - */ -int Editor::PositionFromLineX(int lineDoc, int x) { - RefreshStyleData(); - if (lineDoc >= pdoc->LinesTotal()) - return pdoc->Length(); - //Platform::DebugPrintf("Position of (%d,%d) line = %d top=%d\n", pt.x, pt.y, line, topLine); - AutoSurface surface(this); - AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc)); - int retVal = 0; - if (surface && ll) { - unsigned int posLineStart = pdoc->LineStart(lineDoc); - LayoutLine(lineDoc, surface, vs, ll, wrapWidth); - retVal = ll->numCharsInLine + posLineStart; - int subLine = 0; - int lineStart = ll->LineStart(subLine); - int lineEnd = ll->LineLastVisible(subLine); - int subLineStart = ll->positions[lineStart]; - - if (actualWrapVisualStartIndent != 0) { - if (lineStart != 0) // Wrapped - x -= actualWrapVisualStartIndent * vs.aveCharWidth; - } - int i = ll->FindBefore(x + subLineStart, lineStart, lineEnd); - while (i < lineEnd) { - if ((x + subLineStart) < ((ll->positions[i] + ll->positions[i + 1]) / 2)) { - retVal = pdoc->MovePositionOutsideChar(i + posLineStart, 1); - break; - } - i++; - } - } - return retVal; -} - -/** - * If painting then abandon the painting because a wider redraw is needed. - * @return true if calling code should stop drawing. - */ -bool Editor::AbandonPaint() { - if ((paintState == painting) && !paintingAllText) { - paintState = paintAbandoned; - } - return paintState == paintAbandoned; -} - -void Editor::RedrawRect(PRectangle rc) { - //Platform::DebugPrintf("Redraw %0d,%0d - %0d,%0d\n", rc.left, rc.top, rc.right, rc.bottom); - - // Clip the redraw rectangle into the client area - PRectangle rcClient = GetClientRectangle(); - if (rc.top < rcClient.top) - rc.top = rcClient.top; - if (rc.bottom > rcClient.bottom) - rc.bottom = rcClient.bottom; - if (rc.left < rcClient.left) - rc.left = rcClient.left; - if (rc.right > rcClient.right) - rc.right = rcClient.right; - - if ((rc.bottom > rc.top) && (rc.right > rc.left)) { - wMain.InvalidateRectangle(rc); - } -} - -void Editor::Redraw() { - //Platform::DebugPrintf("Redraw all\n"); - PRectangle rcClient = GetClientRectangle(); - wMain.InvalidateRectangle(rcClient); - //wMain.InvalidateAll(); -} - -void Editor::RedrawSelMargin(int line) { - if (!AbandonPaint()) { - if (vs.maskInLine) { - Redraw(); - } else { - PRectangle rcSelMargin = GetClientRectangle(); - rcSelMargin.right = vs.fixedColumnWidth; - if (line != -1) { - int position = pdoc->LineStart(line); - PRectangle rcLine = RectangleFromRange(position, position); - rcSelMargin.top = rcLine.top; - rcSelMargin.bottom = rcLine.bottom; - } - wMain.InvalidateRectangle(rcSelMargin); - } - } -} - -PRectangle Editor::RectangleFromRange(int start, int end) { - int minPos = start; - if (minPos > end) - minPos = end; - int maxPos = start; - if (maxPos < end) - maxPos = end; - int minLine = cs.DisplayFromDoc(pdoc->LineFromPosition(minPos)); - int lineDocMax = pdoc->LineFromPosition(maxPos); - int maxLine = cs.DisplayFromDoc(lineDocMax) + cs.GetHeight(lineDocMax) - 1; - PRectangle rcClient = GetTextRectangle(); - PRectangle rc; - rc.left = vs.fixedColumnWidth; - rc.top = (minLine - topLine) * vs.lineHeight; - if (rc.top < 0) - rc.top = 0; - rc.right = rcClient.right; - rc.bottom = (maxLine - topLine + 1) * vs.lineHeight; - // Ensure PRectangle is within 16 bit space - rc.top = Platform::Clamp(rc.top, -32000, 32000); - rc.bottom = Platform::Clamp(rc.bottom, -32000, 32000); - - return rc; -} - -void Editor::InvalidateRange(int start, int end) { - RedrawRect(RectangleFromRange(start, end)); -} - -int Editor::CurrentPosition() { - return currentPos; -} - -bool Editor::SelectionEmpty() { - return anchor == currentPos; -} - -int Editor::SelectionStart() { - return Platform::Minimum(currentPos, anchor); -} - -int Editor::SelectionEnd() { - return Platform::Maximum(currentPos, anchor); -} - -void Editor::SetRectangularRange() { - if (selType == selRectangle) { - xStartSelect = XFromPosition(anchor); - xEndSelect = XFromPosition(currentPos); - } -} - -void Editor::InvalidateSelection(int currentPos_, int anchor_, bool invalidateWholeSelection) { - if (anchor != anchor_ || selType == selRectangle) { - invalidateWholeSelection = true; - } - int firstAffected = currentPos; - if (invalidateWholeSelection) { - if (firstAffected > anchor) - firstAffected = anchor; - if (firstAffected > anchor_) - firstAffected = anchor_; - } - if (firstAffected > currentPos_) - firstAffected = currentPos_; - int lastAffected = currentPos; - if (invalidateWholeSelection) { - if (lastAffected < anchor) - lastAffected = anchor; - if (lastAffected < anchor_) - lastAffected = anchor_; - } - if (lastAffected < (currentPos_ + 1)) // +1 ensures caret repainted - lastAffected = (currentPos_ + 1); - needUpdateUI = true; - InvalidateRange(firstAffected, lastAffected); -} - -void Editor::SetSelection(int currentPos_, int anchor_) { - currentPos_ = pdoc->ClampPositionIntoDocument(currentPos_); - anchor_ = pdoc->ClampPositionIntoDocument(anchor_); - if ((currentPos != currentPos_) || (anchor != anchor_)) { - InvalidateSelection(currentPos_, anchor_, true); - currentPos = currentPos_; - anchor = anchor_; - } - SetRectangularRange(); - ClaimSelection(); -} - -void Editor::SetSelection(int currentPos_) { - currentPos_ = pdoc->ClampPositionIntoDocument(currentPos_); - if (currentPos != currentPos_) { - InvalidateSelection(currentPos_, anchor, false); - currentPos = currentPos_; - } - SetRectangularRange(); - ClaimSelection(); -} - -void Editor::SetEmptySelection(int currentPos_) { - selType = selStream; - moveExtendsSelection = false; - SetSelection(currentPos_, currentPos_); -} - -bool Editor::RangeContainsProtected(int start, int end) const { - if (vs.ProtectionActive()) { - if (start > end) { - int t = start; - start = end; - end = t; - } - int mask = pdoc->stylingBitsMask; - for (int pos = start; pos < end; pos++) { - if (vs.styles[pdoc->StyleAt(pos) & mask].IsProtected()) - return true; - } - } - return false; -} - -bool Editor::SelectionContainsProtected() { - // DONE, but untested...: make support rectangular selection - bool scp = false; - if (selType == selStream) { - scp = RangeContainsProtected(anchor, currentPos); - } else { - SelectionLineIterator lineIterator(this); - while (lineIterator.Iterate()) { - if (RangeContainsProtected(lineIterator.startPos, lineIterator.endPos)) { - scp = true; - break; - } - } - } - return scp; -} - -/** - * Asks document to find a good position and then moves out of any invisible positions. - */ -int Editor::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) { - pos = pdoc->MovePositionOutsideChar(pos, moveDir, checkLineEnd); - if (vs.ProtectionActive()) { - int mask = pdoc->stylingBitsMask; - if (moveDir > 0) { - if ((pos > 0) && vs.styles[pdoc->StyleAt(pos - 1) & mask].IsProtected()) { - while ((pos < pdoc->Length()) && - (vs.styles[pdoc->StyleAt(pos) & mask].IsProtected())) - pos++; - } - } else if (moveDir < 0) { - if (vs.styles[pdoc->StyleAt(pos) & mask].IsProtected()) { - while ((pos > 0) && - (vs.styles[pdoc->StyleAt(pos - 1) & mask].IsProtected())) - pos--; - } - } - } - return pos; -} - -int Editor::MovePositionTo(int newPos, selTypes sel, bool ensureVisible) { - int delta = newPos - currentPos; - newPos = pdoc->ClampPositionIntoDocument(newPos); - newPos = MovePositionOutsideChar(newPos, delta); - if (sel != noSel) { - selType = sel; - } - if (sel != noSel || moveExtendsSelection) { - SetSelection(newPos); - } else { - SetEmptySelection(newPos); - } - ShowCaretAtCurrentPosition(); - if (ensureVisible) { - EnsureCaretVisible(); - } - NotifyMove(newPos); - return 0; -} - -int Editor::MovePositionSoVisible(int pos, int moveDir) { - pos = pdoc->ClampPositionIntoDocument(pos); - pos = MovePositionOutsideChar(pos, moveDir); - int lineDoc = pdoc->LineFromPosition(pos); - if (cs.GetVisible(lineDoc)) { - return pos; - } else { - int lineDisplay = cs.DisplayFromDoc(lineDoc); - if (moveDir > 0) { - // lineDisplay is already line before fold as lines in fold use display line of line after fold - lineDisplay = Platform::Clamp(lineDisplay, 0, cs.LinesDisplayed()); - return pdoc->LineStart(cs.DocFromDisplay(lineDisplay)); - } else { - lineDisplay = Platform::Clamp(lineDisplay - 1, 0, cs.LinesDisplayed()); - return pdoc->LineEnd(cs.DocFromDisplay(lineDisplay)); - } - } -} - -/** - * Choose the x position that the caret will try to stick to - * as it moves up and down. - */ -void Editor::SetLastXChosen() { - Point pt = LocationFromPosition(currentPos); - lastXChosen = pt.x; -} - -void Editor::ScrollTo(int line, bool moveThumb) { - int topLineNew = Platform::Clamp(line, 0, MaxScrollPos()); - if (topLineNew != topLine) { - // Try to optimise small scrolls - int linesToMove = topLine - topLineNew; - SetTopLine(topLineNew); - ShowCaretAtCurrentPosition(); - // Perform redraw rather than scroll if many lines would be redrawn anyway. -#ifndef UNDER_CE - if ((abs(linesToMove) <= 10) && (paintState == notPainting)) { - ScrollText(linesToMove); - } else { - Redraw(); - } -#else - Redraw(); -#endif - if (moveThumb) { - SetVerticalScrollPos(); - } - } -} - -void Editor::ScrollText(int /* linesToMove */) { - //Platform::DebugPrintf("Editor::ScrollText %d\n", linesToMove); - Redraw(); -} - -void Editor::HorizontalScrollTo(int xPos) { - //Platform::DebugPrintf("HorizontalScroll %d\n", xPos); - if (xPos < 0) - xPos = 0; - if ((wrapState == eWrapNone) && (xOffset != xPos)) { - xOffset = xPos; - SetHorizontalScrollPos(); - RedrawRect(GetClientRectangle()); - } -} - -void Editor::MoveCaretInsideView(bool ensureVisible) { - PRectangle rcClient = GetTextRectangle(); - Point pt = LocationFromPosition(currentPos); - if (pt.y < rcClient.top) { - MovePositionTo(PositionFromLocation( - Point(lastXChosen, rcClient.top)), - noSel, ensureVisible); - } else if ((pt.y + vs.lineHeight - 1) > rcClient.bottom) { - int yOfLastLineFullyDisplayed = rcClient.top + (LinesOnScreen() - 1) * vs.lineHeight; - MovePositionTo(PositionFromLocation( - Point(lastXChosen, rcClient.top + yOfLastLineFullyDisplayed)), - noSel, ensureVisible); - } -} - -int Editor::DisplayFromPosition(int pos) { - int lineDoc = pdoc->LineFromPosition(pos); - int lineDisplay = cs.DisplayFromDoc(lineDoc); - AutoSurface surface(this); - AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc)); - if (surface && ll) { - LayoutLine(lineDoc, surface, vs, ll, wrapWidth); - unsigned int posLineStart = pdoc->LineStart(lineDoc); - int posInLine = pos - posLineStart; - lineDisplay--; // To make up for first increment ahead. - for (int subLine = 0; subLine < ll->lines; subLine++) { - if (posInLine >= ll->LineStart(subLine)) { - lineDisplay++; - } - } - } - return lineDisplay; -} - -/** - * Ensure the caret is reasonably visible in context. - * -Caret policy in SciTE - -If slop is set, we can define a slop value. -This value defines an unwanted zone (UZ) where the caret is... unwanted. -This zone is defined as a number of pixels near the vertical margins, -and as a number of lines near the horizontal margins. -By keeping the caret away from the edges, it is seen within its context, -so it is likely that the identifier that the caret is on can be completely seen, -and that the current line is seen with some of the lines following it which are -often dependent on that line. - -If strict is set, the policy is enforced... strictly. -The caret is centred on the display if slop is not set, -and cannot go in the UZ if slop is set. - -If jumps is set, the display is moved more energetically -so the caret can move in the same direction longer before the policy is applied again. -'3UZ' notation is used to indicate three time the size of the UZ as a distance to the margin. - -If even is not set, instead of having symmetrical UZs, -the left and bottom UZs are extended up to right and top UZs respectively. -This way, we favour the displaying of useful information: the begining of lines, -where most code reside, and the lines after the caret, eg. the body of a function. - - | | | | | -slop | strict | jumps | even | Caret can go to the margin | When reaching limitÃ(caret going out of - | | | | | visibility or going into the UZ) display is... ------+--------+-------+------+--------------------------------------------+-------------------------------------------------------------- - 0 | 0 | 0 | 0 | Yes | moved to put caret on top/on right - 0 | 0 | 0 | 1 | Yes | moved by one position - 0 | 0 | 1 | 0 | Yes | moved to put caret on top/on right - 0 | 0 | 1 | 1 | Yes | centred on the caret - 0 | 1 | - | 0 | Caret is always on top/on right of display | - - 0 | 1 | - | 1 | No, caret is always centred | - - 1 | 0 | 0 | 0 | Yes | moved to put caret out of the asymmetrical UZ - 1 | 0 | 0 | 1 | Yes | moved to put caret out of the UZ - 1 | 0 | 1 | 0 | Yes | moved to put caret at 3UZ of the top or right margin - 1 | 0 | 1 | 1 | Yes | moved to put caret at 3UZ of the margin - 1 | 1 | - | 0 | Caret is always at UZ of top/right margin | - - 1 | 1 | 0 | 1 | No, kept out of UZ | moved by one position - 1 | 1 | 1 | 1 | No, kept out of UZ | moved to put caret at 3UZ of the margin -*/ -void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) { - //Platform::DebugPrintf("EnsureCaretVisible %d %s\n", xOffset, useMargin ? " margin" : " "); - PRectangle rcClient = GetTextRectangle(); - //int rcClientFullWidth = rcClient.Width(); - int posCaret = currentPos; - if (posDrag >= 0) { - posCaret = posDrag; - } - Point pt = LocationFromPosition(posCaret); - Point ptBottomCaret = pt; - ptBottomCaret.y += vs.lineHeight - 1; - int lineCaret = DisplayFromPosition(posCaret); - bool bSlop, bStrict, bJump, bEven; - - // Vertical positioning - if (vert && (pt.y < rcClient.top || ptBottomCaret.y > rcClient.bottom || (caretYPolicy & CARET_STRICT) != 0)) { - int linesOnScreen = LinesOnScreen(); - int halfScreen = Platform::Maximum(linesOnScreen - 1, 2) / 2; - int newTopLine = topLine; - bSlop = (caretYPolicy & CARET_SLOP) != 0; - bStrict = (caretYPolicy & CARET_STRICT) != 0; - bJump = (caretYPolicy & CARET_JUMPS) != 0; - bEven = (caretYPolicy & CARET_EVEN) != 0; - - // It should be possible to scroll the window to show the caret, - // but this fails to remove the caret on GTK+ - if (bSlop) { // A margin is defined - int yMoveT, yMoveB; - if (bStrict) { - int yMarginT, yMarginB; - if (!useMargin) { - // In drag mode, avoid moves - // otherwise, a double click will select several lines. - yMarginT = yMarginB = 0; - } else { - // yMarginT must equal to caretYSlop, with a minimum of 1 and - // a maximum of slightly less than half the heigth of the text area. - yMarginT = Platform::Clamp(caretYSlop, 1, halfScreen); - if (bEven) { - yMarginB = yMarginT; - } else { - yMarginB = linesOnScreen - yMarginT - 1; - } - } - yMoveT = yMarginT; - if (bEven) { - if (bJump) { - yMoveT = Platform::Clamp(caretYSlop * 3, 1, halfScreen); - } - yMoveB = yMoveT; - } else { - yMoveB = linesOnScreen - yMoveT - 1; - } - if (lineCaret < topLine + yMarginT) { - // Caret goes too high - newTopLine = lineCaret - yMoveT; - } else if (lineCaret > topLine + linesOnScreen - 1 - yMarginB) { - // Caret goes too low - newTopLine = lineCaret - linesOnScreen + 1 + yMoveB; - } - } else { // Not strict - yMoveT = bJump ? caretYSlop * 3 : caretYSlop; - yMoveT = Platform::Clamp(yMoveT, 1, halfScreen); - if (bEven) { - yMoveB = yMoveT; - } else { - yMoveB = linesOnScreen - yMoveT - 1; - } - if (lineCaret < topLine) { - // Caret goes too high - newTopLine = lineCaret - yMoveT; - } else if (lineCaret > topLine + linesOnScreen - 1) { - // Caret goes too low - newTopLine = lineCaret - linesOnScreen + 1 + yMoveB; - } - } - } else { // No slop - if (!bStrict && !bJump) { - // Minimal move - if (lineCaret < topLine) { - // Caret goes too high - newTopLine = lineCaret; - } else if (lineCaret > topLine + linesOnScreen - 1) { - // Caret goes too low - if (bEven) { - newTopLine = lineCaret - linesOnScreen + 1; - } else { - newTopLine = lineCaret; - } - } - } else { // Strict or going out of display - if (bEven) { - // Always center caret - newTopLine = lineCaret - halfScreen; - } else { - // Always put caret on top of display - newTopLine = lineCaret; - } - } - } - newTopLine = Platform::Clamp(newTopLine, 0, MaxScrollPos()); - if (newTopLine != topLine) { - Redraw(); - SetTopLine(newTopLine); - SetVerticalScrollPos(); - } - } - - // Horizontal positioning - if (horiz && (wrapState == eWrapNone)) { - int halfScreen = Platform::Maximum(rcClient.Width() - 4, 4) / 2; - int xOffsetNew = xOffset; - bSlop = (caretXPolicy & CARET_SLOP) != 0; - bStrict = (caretXPolicy & CARET_STRICT) != 0; - bJump = (caretXPolicy & CARET_JUMPS) != 0; - bEven = (caretXPolicy & CARET_EVEN) != 0; - - if (bSlop) { // A margin is defined - int xMoveL, xMoveR; - if (bStrict) { - int xMarginL, xMarginR; - if (!useMargin) { - // In drag mode, avoid moves unless very near of the margin - // otherwise, a simple click will select text. - xMarginL = xMarginR = 2; - } else { - // xMargin must equal to caretXSlop, with a minimum of 2 and - // a maximum of slightly less than half the width of the text area. - xMarginR = Platform::Clamp(caretXSlop, 2, halfScreen); - if (bEven) { - xMarginL = xMarginR; - } else { - xMarginL = rcClient.Width() - xMarginR - 4; - } - } - if (bJump && bEven) { - // Jump is used only in even mode - xMoveL = xMoveR = Platform::Clamp(caretXSlop * 3, 1, halfScreen); - } else { - xMoveL = xMoveR = 0; // Not used, avoid a warning - } - if (pt.x < rcClient.left + xMarginL) { - // Caret is on the left of the display - if (bJump && bEven) { - xOffsetNew -= xMoveL; - } else { - // Move just enough to allow to display the caret - xOffsetNew -= (rcClient.left + xMarginL) - pt.x; - } - } else if (pt.x >= rcClient.right - xMarginR) { - // Caret is on the right of the display - if (bJump && bEven) { - xOffsetNew += xMoveR; - } else { - // Move just enough to allow to display the caret - xOffsetNew += pt.x - (rcClient.right - xMarginR) + 1; - } - } - } else { // Not strict - xMoveR = bJump ? caretXSlop * 3 : caretXSlop; - xMoveR = Platform::Clamp(xMoveR, 1, halfScreen); - if (bEven) { - xMoveL = xMoveR; - } else { - xMoveL = rcClient.Width() - xMoveR - 4; - } - if (pt.x < rcClient.left) { - // Caret is on the left of the display - xOffsetNew -= xMoveL; - } else if (pt.x >= rcClient.right) { - // Caret is on the right of the display - xOffsetNew += xMoveR; - } - } - } else { // No slop - if (bStrict || - (bJump && (pt.x < rcClient.left || pt.x >= rcClient.right))) { - // Strict or going out of display - if (bEven) { - // Center caret - xOffsetNew += pt.x - rcClient.left - halfScreen; - } else { - // Put caret on right - xOffsetNew += pt.x - rcClient.right + 1; - } - } else { - // Move just enough to allow to display the caret - if (pt.x < rcClient.left) { - // Caret is on the left of the display - if (bEven) { - xOffsetNew -= rcClient.left - pt.x; - } else { - xOffsetNew += pt.x - rcClient.right + 1; - } - } else if (pt.x >= rcClient.right) { - // Caret is on the right of the display - xOffsetNew += pt.x - rcClient.right + 1; - } - } - } - // In case of a jump (find result) largely out of display, adjust the offset to display the caret - if (pt.x + xOffset < rcClient.left + xOffsetNew) { - xOffsetNew = pt.x + xOffset - rcClient.left; - } else if (pt.x + xOffset >= rcClient.right + xOffsetNew) { - xOffsetNew = pt.x + xOffset - rcClient.right + 1; - if (vs.caretStyle == CARETSTYLE_BLOCK) { - // Ensure we can see a good portion of the block caret - xOffsetNew += vs.aveCharWidth; - } - } - if (xOffsetNew < 0) { - xOffsetNew = 0; - } - if (xOffset != xOffsetNew) { - xOffset = xOffsetNew; - if (xOffsetNew > 0) { - PRectangle rcText = GetTextRectangle(); - if (horizontalScrollBarVisible && - rcText.Width() + xOffset > scrollWidth) { - scrollWidth = xOffset + rcText.Width(); - SetScrollBars(); - } - } - SetHorizontalScrollPos(); - Redraw(); - } - } - UpdateSystemCaret(); -} - -void Editor::ShowCaretAtCurrentPosition() { - if (hasFocus) { - caret.active = true; - caret.on = true; - SetTicking(true); - } else { - caret.active = false; - caret.on = false; - } - InvalidateCaret(); -} - -void Editor::DropCaret() { - caret.active = false; - InvalidateCaret(); -} - -void Editor::InvalidateCaret() { - if (posDrag >= 0) - InvalidateRange(posDrag, posDrag + 1); - else - InvalidateRange(currentPos, currentPos + 1); - UpdateSystemCaret(); -} - -void Editor::UpdateSystemCaret() { -} - -void Editor::NeedWrapping(int docLineStart, int docLineEnd) { - docLineStart = Platform::Clamp(docLineStart, 0, pdoc->LinesTotal()); - if (wrapStart > docLineStart) { - wrapStart = docLineStart; - llc.Invalidate(LineLayout::llPositions); - } - if (wrapEnd < docLineEnd) { - wrapEnd = docLineEnd; - } - wrapEnd = Platform::Clamp(wrapEnd, 0, pdoc->LinesTotal()); - // Wrap lines during idle. - if ((wrapState != eWrapNone) && (wrapEnd != wrapStart)) { - SetIdle(true); - } -} - -bool Editor::WrapOneLine(Surface *surface, int lineToWrap) { - AutoLineLayout ll(llc, RetrieveLineLayout(lineToWrap)); - int linesWrapped = 1; - if (ll) { - LayoutLine(lineToWrap, surface, vs, ll, wrapWidth); - linesWrapped = ll->lines; - } - return cs.SetHeight(lineToWrap, linesWrapped); -} - -// Check if wrapping needed and perform any needed wrapping. -// fullwrap: if true, all lines which need wrapping will be done, -// in this single call. -// priorityWrapLineStart: If greater than zero, all lines starting from -// here to 1 page + 100 lines past will be wrapped (even if there are -// more lines under wrapping process in idle). -// If it is neither fullwrap, nor priorityWrap, then 1 page + 100 lines will be -// wrapped, if there are any wrapping going on in idle. (Generally this -// condition is called only from idler). -// Return true if wrapping occurred. -bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) { - // If there are any pending wraps, do them during idle if possible. - int linesInOneCall = LinesOnScreen() + 100; - if (wrapState != eWrapNone) { - if (wrapStart < wrapEnd) { - if (!SetIdle(true)) { - // Idle processing not supported so full wrap required. - fullWrap = true; - } - } - if (!fullWrap && priorityWrapLineStart >= 0 && - // .. and if the paint window is outside pending wraps - (((priorityWrapLineStart + linesInOneCall) < wrapStart) || - (priorityWrapLineStart > wrapEnd))) { - // No priority wrap pending - return false; - } - } - int goodTopLine = topLine; - bool wrapOccurred = false; - if (wrapStart <= pdoc->LinesTotal()) { - if (wrapState == eWrapNone) { - if (wrapWidth != LineLayout::wrapWidthInfinite) { - wrapWidth = LineLayout::wrapWidthInfinite; - for (int lineDoc = 0; lineDoc < pdoc->LinesTotal(); lineDoc++) { - cs.SetHeight(lineDoc, 1); - } - wrapOccurred = true; - } - wrapStart = wrapLineLarge; - wrapEnd = wrapLineLarge; - } else { - if (wrapEnd >= pdoc->LinesTotal()) - wrapEnd = pdoc->LinesTotal(); - //ElapsedTime et; - int lineDocTop = cs.DocFromDisplay(topLine); - int subLineTop = topLine - cs.DisplayFromDoc(lineDocTop); - PRectangle rcTextArea = GetClientRectangle(); - rcTextArea.left = vs.fixedColumnWidth; - rcTextArea.right -= vs.rightMarginWidth; - wrapWidth = rcTextArea.Width(); - // Ensure all of the document is styled. - pdoc->EnsureStyledTo(pdoc->Length()); - RefreshStyleData(); - AutoSurface surface(this); - if (surface) { - bool priorityWrap = false; - int lastLineToWrap = wrapEnd; - int lineToWrap = wrapStart; - if (!fullWrap) { - if (priorityWrapLineStart >= 0) { - // This is a priority wrap. - lineToWrap = priorityWrapLineStart; - lastLineToWrap = priorityWrapLineStart + linesInOneCall; - priorityWrap = true; - } else { - // This is idle wrap. - lastLineToWrap = wrapStart + linesInOneCall; - } - if (lastLineToWrap >= wrapEnd) - lastLineToWrap = wrapEnd; - } // else do a fullWrap. - - // Platform::DebugPrintf("Wraplines: full = %d, priorityStart = %d (wrapping: %d to %d)\n", fullWrap, priorityWrapLineStart, lineToWrap, lastLineToWrap); - // Platform::DebugPrintf("Pending wraps: %d to %d\n", wrapStart, wrapEnd); - while (lineToWrap < lastLineToWrap) { - if (WrapOneLine(surface, lineToWrap)) { - wrapOccurred = true; - } - lineToWrap++; - } - if (!priorityWrap) - wrapStart = lineToWrap; - // If wrapping is done, bring it to resting position - if (wrapStart >= wrapEnd) { - wrapStart = wrapLineLarge; - wrapEnd = wrapLineLarge; - } - } - goodTopLine = cs.DisplayFromDoc(lineDocTop); - if (subLineTop < cs.GetHeight(lineDocTop)) - goodTopLine += subLineTop; - else - goodTopLine += cs.GetHeight(lineDocTop); - //double durWrap = et.Duration(true); - //Platform::DebugPrintf("Wrap:%9.6g \n", durWrap); - } - } - if (wrapOccurred) { - SetScrollBars(); - SetTopLine(Platform::Clamp(goodTopLine, 0, MaxScrollPos())); - SetVerticalScrollPos(); - } - return wrapOccurred; -} - -void Editor::LinesJoin() { - if (!RangeContainsProtected(targetStart, targetEnd)) { - pdoc->BeginUndoAction(); - bool prevNonWS = true; - for (int pos = targetStart; pos < targetEnd; pos++) { - if (IsEOLChar(pdoc->CharAt(pos))) { - targetEnd -= pdoc->LenChar(pos); - pdoc->DelChar(pos); - if (prevNonWS) { - // Ensure at least one space separating previous lines - pdoc->InsertChar(pos, ' '); - targetEnd++; - } - } else { - prevNonWS = pdoc->CharAt(pos) != ' '; - } - } - pdoc->EndUndoAction(); - } -} - -const char *Editor::StringFromEOLMode(int eolMode) { - if (eolMode == SC_EOL_CRLF) { - return "\r\n"; - } else if (eolMode == SC_EOL_CR) { - return "\r"; - } else { - return "\n"; - } -} - -void Editor::LinesSplit(int pixelWidth) { - if (!RangeContainsProtected(targetStart, targetEnd)) { - if (pixelWidth == 0) { - PRectangle rcText = GetTextRectangle(); - pixelWidth = rcText.Width(); - } - int lineStart = pdoc->LineFromPosition(targetStart); - int lineEnd = pdoc->LineFromPosition(targetEnd); - const char *eol = StringFromEOLMode(pdoc->eolMode); - pdoc->BeginUndoAction(); - for (int line = lineStart; line <= lineEnd; line++) { - AutoSurface surface(this); - AutoLineLayout ll(llc, RetrieveLineLayout(line)); - if (surface && ll) { - unsigned int posLineStart = pdoc->LineStart(line); - LayoutLine(line, surface, vs, ll, pixelWidth); - for (int subLine = 1; subLine < ll->lines; subLine++) { - pdoc->InsertCString(posLineStart + (subLine - 1) * strlen(eol) + - ll->LineStart(subLine), eol); - targetEnd += static_cast(strlen(eol)); - } - } - lineEnd = pdoc->LineFromPosition(targetEnd); - } - pdoc->EndUndoAction(); - } -} - -int Editor::SubstituteMarkerIfEmpty(int markerCheck, int markerDefault) { - if (vs.markers[markerCheck].markType == SC_MARK_EMPTY) - return markerDefault; - return markerCheck; -} - -// Avoid 64 bit compiler warnings. -// Scintilla does not support text buffers larger than 2**31 -static int istrlen(const char *s) { - return static_cast(strlen(s)); -} - -void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { - if (vs.fixedColumnWidth == 0) - return; - - PRectangle rcMargin = GetClientRectangle(); - rcMargin.right = vs.fixedColumnWidth; - - if (!rc.Intersects(rcMargin)) - return; - - Surface *surface; - if (bufferedDraw) { - surface = pixmapSelMargin; - } else { - surface = surfWindow; - } - - PRectangle rcSelMargin = rcMargin; - rcSelMargin.right = rcMargin.left; - - for (int margin = 0; margin < vs.margins; margin++) { - if (vs.ms[margin].width > 0) { - - rcSelMargin.left = rcSelMargin.right; - rcSelMargin.right = rcSelMargin.left + vs.ms[margin].width; - - if (vs.ms[margin].style != SC_MARGIN_NUMBER) { - /* alternate scheme: - if (vs.ms[margin].mask & SC_MASK_FOLDERS) - surface->FillRectangle(rcSelMargin, vs.styles[STYLE_DEFAULT].back.allocated); - else - // Required because of special way brush is created for selection margin - surface->FillRectangle(rcSelMargin, pixmapSelPattern); - */ - if (vs.ms[margin].mask & SC_MASK_FOLDERS) - // Required because of special way brush is created for selection margin - surface->FillRectangle(rcSelMargin, *pixmapSelPattern); - else { - ColourAllocated colour; - switch (vs.ms[margin].style) { - case SC_MARGIN_BACK: - colour = vs.styles[STYLE_DEFAULT].back.allocated; - break; - case SC_MARGIN_FORE: - colour = vs.styles[STYLE_DEFAULT].fore.allocated; - break; - default: - colour = vs.styles[STYLE_LINENUMBER].back.allocated; - break; - } - surface->FillRectangle(rcSelMargin, colour); - } - } else { - surface->FillRectangle(rcSelMargin, vs.styles[STYLE_LINENUMBER].back.allocated); - } - - int visibleLine = topLine; - int yposScreen = 0; - - // Work out whether the top line is whitespace located after a - // lessening of fold level which implies a 'fold tail' but which should not - // be displayed until the last of a sequence of whitespace. - bool needWhiteClosure = false; - int level = pdoc->GetLevel(cs.DocFromDisplay(topLine)); - if (level & SC_FOLDLEVELWHITEFLAG) { - int lineBack = cs.DocFromDisplay(topLine); - int levelPrev = level; - while ((lineBack > 0) && (levelPrev & SC_FOLDLEVELWHITEFLAG)) { - lineBack--; - levelPrev = pdoc->GetLevel(lineBack); - } - if (!(levelPrev & SC_FOLDLEVELHEADERFLAG)) { - if ((level & SC_FOLDLEVELNUMBERMASK) < (levelPrev & SC_FOLDLEVELNUMBERMASK)) - needWhiteClosure = true; - } - } - - // Old code does not know about new markers needed to distinguish all cases - int folderOpenMid = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEROPENMID, - SC_MARKNUM_FOLDEROPEN); - int folderEnd = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEREND, - SC_MARKNUM_FOLDER); - - while ((visibleLine < cs.LinesDisplayed()) && yposScreen < rcMargin.bottom) { - - PLATFORM_ASSERT(visibleLine < cs.LinesDisplayed()); - - int lineDoc = cs.DocFromDisplay(visibleLine); - PLATFORM_ASSERT(cs.GetVisible(lineDoc)); - bool firstSubLine = visibleLine == cs.DisplayFromDoc(lineDoc); - - // Decide which fold indicator should be displayed - level = pdoc->GetLevel(lineDoc); - int levelNext = pdoc->GetLevel(lineDoc + 1); - int marks = pdoc->GetMark(lineDoc); - if (!firstSubLine) - marks = 0; - int levelNum = level & SC_FOLDLEVELNUMBERMASK; - int levelNextNum = levelNext & SC_FOLDLEVELNUMBERMASK; - if (level & SC_FOLDLEVELHEADERFLAG) { - if (firstSubLine) { - if (cs.GetExpanded(lineDoc)) { - if (levelNum == SC_FOLDLEVELBASE) - marks |= 1 << SC_MARKNUM_FOLDEROPEN; - else - marks |= 1 << folderOpenMid; - } else { - if (levelNum == SC_FOLDLEVELBASE) - marks |= 1 << SC_MARKNUM_FOLDER; - else - marks |= 1 << folderEnd; - } - } else { - marks |= 1 << SC_MARKNUM_FOLDERSUB; - } - needWhiteClosure = false; - } else if (level & SC_FOLDLEVELWHITEFLAG) { - if (needWhiteClosure) { - if (levelNext & SC_FOLDLEVELWHITEFLAG) { - marks |= 1 << SC_MARKNUM_FOLDERSUB; - } else if (levelNum > SC_FOLDLEVELBASE) { - marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL; - needWhiteClosure = false; - } else { - marks |= 1 << SC_MARKNUM_FOLDERTAIL; - needWhiteClosure = false; - } - } else if (levelNum > SC_FOLDLEVELBASE) { - if (levelNextNum < levelNum) { - if (levelNextNum > SC_FOLDLEVELBASE) { - marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL; - } else { - marks |= 1 << SC_MARKNUM_FOLDERTAIL; - } - } else { - marks |= 1 << SC_MARKNUM_FOLDERSUB; - } - } - } else if (levelNum > SC_FOLDLEVELBASE) { - if (levelNextNum < levelNum) { - needWhiteClosure = false; - if (levelNext & SC_FOLDLEVELWHITEFLAG) { - marks |= 1 << SC_MARKNUM_FOLDERSUB; - needWhiteClosure = true; - } else if (levelNextNum > SC_FOLDLEVELBASE) { - marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL; - } else { - marks |= 1 << SC_MARKNUM_FOLDERTAIL; - } - } else { - marks |= 1 << SC_MARKNUM_FOLDERSUB; - } - } - - marks &= vs.ms[margin].mask; - PRectangle rcMarker = rcSelMargin; - rcMarker.top = yposScreen; - rcMarker.bottom = yposScreen + vs.lineHeight; - if (vs.ms[margin].style == SC_MARGIN_NUMBER) { - char number[100]; - number[0] = '\0'; - if (firstSubLine) - sprintf(number, "%d", lineDoc + 1); - if (foldFlags & SC_FOLDFLAG_LEVELNUMBERS) { - int lev = pdoc->GetLevel(lineDoc); - sprintf(number, "%c%c %03X %03X", - (lev & SC_FOLDLEVELHEADERFLAG) ? 'H' : '_', - (lev & SC_FOLDLEVELWHITEFLAG) ? 'W' : '_', - lev & SC_FOLDLEVELNUMBERMASK, - lev >> 16 - ); - } - PRectangle rcNumber = rcMarker; - // Right justify - int width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, istrlen(number)); - int xpos = rcNumber.right - width - 3; - rcNumber.left = xpos; - surface->DrawTextNoClip(rcNumber, vs.styles[STYLE_LINENUMBER].font, - rcNumber.top + vs.maxAscent, number, istrlen(number), - vs.styles[STYLE_LINENUMBER].fore.allocated, - vs.styles[STYLE_LINENUMBER].back.allocated); - } - - if (marks) { - for (int markBit = 0; (markBit < 32) && marks; markBit++) { - if (marks & 1) { - int lev = (pdoc->GetLevel(lineDoc) & SC_FOLDLEVELNUMBERMASK) - SC_FOLDLEVELBASE; - vs.markers[markBit].Draw(surface, rcMarker, vs.styles[STYLE_LINENUMBER].font, lev); - } - marks >>= 1; - } - } - - visibleLine++; - yposScreen += vs.lineHeight; - } - } - } - - PRectangle rcBlankMargin = rcMargin; - rcBlankMargin.left = rcSelMargin.right; - surface->FillRectangle(rcBlankMargin, vs.styles[STYLE_DEFAULT].back.allocated); - - if (bufferedDraw) { - surfWindow->Copy(rcMargin, Point(), *pixmapSelMargin); - } -} - -void DrawTabArrow(Surface *surface, PRectangle rcTab, int ymid) { - int ydiff = (rcTab.bottom - rcTab.top) / 2; - int xhead = rcTab.right - 1 - ydiff; - if (xhead <= rcTab.left) { - ydiff -= rcTab.left - xhead - 1; - xhead = rcTab.left - 1; - } - if ((rcTab.left + 2) < (rcTab.right - 1)) - surface->MoveTo(rcTab.left + 2, ymid); - else - surface->MoveTo(rcTab.right - 1, ymid); - surface->LineTo(rcTab.right - 1, ymid); - surface->LineTo(xhead, ymid - ydiff); - surface->MoveTo(rcTab.right - 1, ymid); - surface->LineTo(xhead, ymid + ydiff); -} - -LineLayout *Editor::RetrieveLineLayout(int lineNumber) { - int posLineStart = pdoc->LineStart(lineNumber); - int posLineEnd = pdoc->LineStart(lineNumber + 1); - PLATFORM_ASSERT(posLineEnd >= posLineStart); - int lineCaret = pdoc->LineFromPosition(currentPos); - return llc.Retrieve(lineNumber, lineCaret, - posLineEnd - posLineStart, pdoc->GetStyleClock(), - LinesOnScreen() + 1, pdoc->LinesTotal()); -} - -static bool GoodTrailByte(int v) { - return (v >= 0x80) && (v < 0xc0); -} - -bool BadUTF(const char *s, int len, int &trailBytes) { - if (trailBytes) { - trailBytes--; - return false; - } - const unsigned char *us = reinterpret_cast(s); - if (*us < 0x80) { - // Single bytes easy - return false; - } else if (*us > 0xF4) { - // Characters longer than 4 bytes not possible in current UTF-8 - return true; - } else if (*us >= 0xF0) { - // 4 bytes - if (len < 4) - return true; - if (GoodTrailByte(us[1]) && GoodTrailByte(us[2]) && GoodTrailByte(us[3])) { - trailBytes = 3; - return false; - } else { - return true; - } - } else if (*us >= 0xE0) { - // 3 bytes - if (len < 3) - return true; - if (GoodTrailByte(us[1]) && GoodTrailByte(us[2])) { - trailBytes = 2; - return false; - } else { - return true; - } - } else if (*us >= 0xC2) { - // 2 bytes - if (len < 2) - return true; - if (GoodTrailByte(us[1])) { - trailBytes = 1; - return false; - } else { - return true; - } - } else if (*us >= 0xC0) { - // Overlong encoding - return true; - } else { - // Trail byte - return true; - } -} - -/** - * Fill in the LineLayout data for the given line. - * Copy the given @a line and its styles from the document into local arrays. - * Also determine the x position at which each character starts. - */ -void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll, int width) { - if (!ll) - return; - - PLATFORM_ASSERT(line < pdoc->LinesTotal()); - PLATFORM_ASSERT(ll->chars != NULL); - int posLineStart = pdoc->LineStart(line); - int posLineEnd = pdoc->LineStart(line + 1); - // If the line is very long, limit the treatment to a length that should fit in the viewport - if (posLineEnd > (posLineStart + ll->maxLineLength)) { - posLineEnd = posLineStart + ll->maxLineLength; - } - if (ll->validity == LineLayout::llCheckTextAndStyle) { - int lineLength = posLineEnd - posLineStart; - if (!vstyle.viewEOL) { - int cid = posLineEnd - 1; - while ((cid > posLineStart) && IsEOLChar(pdoc->CharAt(cid))) { - cid--; - lineLength--; - } - } - if (lineLength == ll->numCharsInLine) { - // See if chars, styles, indicators, are all the same - bool allSame = true; - const int styleMask = pdoc->stylingBitsMask; - // Check base line layout - char styleByte = 0; - int numCharsInLine = 0; - while (numCharsInLine < lineLength) { - int charInDoc = numCharsInLine + posLineStart; - char chDoc = pdoc->CharAt(charInDoc); - styleByte = pdoc->StyleAt(charInDoc); - allSame = allSame && - (ll->styles[numCharsInLine] == static_cast(styleByte & styleMask)); - allSame = allSame && - (ll->indicators[numCharsInLine] == static_cast(styleByte & ~styleMask)); - if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseMixed) - allSame = allSame && - (ll->chars[numCharsInLine] == chDoc); - else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower) - allSame = allSame && - (ll->chars[numCharsInLine] == static_cast(tolower(chDoc))); - else // Style::caseUpper - allSame = allSame && - (ll->chars[numCharsInLine] == static_cast(toupper(chDoc))); - numCharsInLine++; - } - allSame = allSame && (ll->styles[numCharsInLine] == styleByte); // For eolFilled - if (allSame) { - ll->validity = LineLayout::llPositions; - } else { - ll->validity = LineLayout::llInvalid; - } - } else { - ll->validity = LineLayout::llInvalid; - } - } - if (ll->validity == LineLayout::llInvalid) { - ll->widthLine = LineLayout::wrapWidthInfinite; - ll->lines = 1; - int numCharsInLine = 0; - if (vstyle.edgeState == EDGE_BACKGROUND) { - ll->edgeColumn = pdoc->FindColumn(line, theEdge); - if (ll->edgeColumn >= posLineStart) { - ll->edgeColumn -= posLineStart; - } - } else { - ll->edgeColumn = -1; - } - - char styleByte = 0; - int styleMask = pdoc->stylingBitsMask; - ll->styleBitsSet = 0; - // Fill base line layout - for (int charInDoc = posLineStart; charInDoc < posLineEnd; charInDoc++) { - char chDoc = pdoc->CharAt(charInDoc); - styleByte = pdoc->StyleAt(charInDoc); - ll->styleBitsSet |= styleByte; - if (vstyle.viewEOL || (!IsEOLChar(chDoc))) { - ll->chars[numCharsInLine] = chDoc; - ll->styles[numCharsInLine] = static_cast(styleByte & styleMask); - ll->indicators[numCharsInLine] = static_cast(styleByte & ~styleMask); - if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseUpper) - ll->chars[numCharsInLine] = static_cast(toupper(chDoc)); - else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower) - ll->chars[numCharsInLine] = static_cast(tolower(chDoc)); - numCharsInLine++; - } - } - ll->xHighlightGuide = 0; - // Extra element at the end of the line to hold end x position and act as - ll->chars[numCharsInLine] = 0; // Also triggers processing in the loops as this is a control character - ll->styles[numCharsInLine] = styleByte; // For eolFilled - ll->indicators[numCharsInLine] = 0; - - // Layout the line, determining the position of each character, - // with an extra element at the end for the end of the line. - int startseg = 0; // Start of the current segment, in char. number - int startsegx = 0; // Start of the current segment, in pixels - ll->positions[0] = 0; - unsigned int tabWidth = vstyle.spaceWidth * pdoc->tabInChars; - bool lastSegItalics = false; - Font &ctrlCharsFont = vstyle.styles[STYLE_CONTROLCHAR].font; - - int ctrlCharWidth[32] = {0}; - bool isControlNext = IsControlCharacter(ll->chars[0]); - int trailBytes = 0; - bool isBadUTFNext = IsUnicodeMode() && BadUTF(ll->chars, numCharsInLine, trailBytes); - for (int charInLine = 0; charInLine < numCharsInLine; charInLine++) { - bool isControl = isControlNext; - isControlNext = IsControlCharacter(ll->chars[charInLine + 1]); - bool isBadUTF = isBadUTFNext; - isBadUTFNext = IsUnicodeMode() && BadUTF(ll->chars + charInLine + 1, numCharsInLine - charInLine - 1, trailBytes); - if ((ll->styles[charInLine] != ll->styles[charInLine + 1]) || - isControl || isControlNext || isBadUTF || isBadUTFNext) { - ll->positions[startseg] = 0; - if (vstyle.styles[ll->styles[charInLine]].visible) { - if (isControl) { - if (ll->chars[charInLine] == '\t') { - ll->positions[charInLine + 1] = ((((startsegx + 2) / - tabWidth) + 1) * tabWidth) - startsegx; - } else if (controlCharSymbol < 32) { - if (ctrlCharWidth[ll->chars[charInLine]] == 0) { - const char *ctrlChar = ControlCharacterString(ll->chars[charInLine]); - // +3 For a blank on front and rounded edge each side: - ctrlCharWidth[ll->chars[charInLine]] = - surface->WidthText(ctrlCharsFont, ctrlChar, istrlen(ctrlChar)) + 3; - } - ll->positions[charInLine + 1] = ctrlCharWidth[ll->chars[charInLine]]; - } else { - char cc[2] = { static_cast(controlCharSymbol), '\0' }; - surface->MeasureWidths(ctrlCharsFont, cc, 1, - ll->positions + startseg + 1); - } - lastSegItalics = false; - } else if (isBadUTF) { - char hexits[3]; - sprintf(hexits, "%2X", ll->chars[charInLine] & 0xff); - ll->positions[charInLine + 1] = - surface->WidthText(ctrlCharsFont, hexits, istrlen(hexits)) + 3; - } else { // Regular character - int lenSeg = charInLine - startseg + 1; - if ((lenSeg == 1) && (' ' == ll->chars[startseg])) { - lastSegItalics = false; - // Over half the segments are single characters and of these about half are space characters. - ll->positions[charInLine + 1] = vstyle.styles[ll->styles[charInLine]].spaceWidth; - } else { - lastSegItalics = vstyle.styles[ll->styles[charInLine]].italic; - posCache.MeasureWidths(surface, vstyle, ll->styles[charInLine], ll->chars + startseg, - lenSeg, ll->positions + startseg + 1); - } - } - } else { // invisible - for (int posToZero = startseg; posToZero <= (charInLine + 1); posToZero++) { - ll->positions[posToZero] = 0; - } - } - for (int posToIncrease = startseg; posToIncrease <= (charInLine + 1); posToIncrease++) { - ll->positions[posToIncrease] += startsegx; - } - startsegx = ll->positions[charInLine + 1]; - startseg = charInLine + 1; - } - } - // Small hack to make lines that end with italics not cut off the edge of the last character - if ((startseg > 0) && lastSegItalics) { - ll->positions[startseg] += 2; - } - ll->numCharsInLine = numCharsInLine; - ll->validity = LineLayout::llPositions; - } - // Hard to cope when too narrow, so just assume there is space - if (width < 20) { - width = 20; - } - if ((ll->validity == LineLayout::llPositions) || (ll->widthLine != width)) { - ll->widthLine = width; - if (width == LineLayout::wrapWidthInfinite) { - ll->lines = 1; - } else if (width > ll->positions[ll->numCharsInLine]) { - // Simple common case where line does not need wrapping. - ll->lines = 1; - } else { - if (wrapVisualFlags & SC_WRAPVISUALFLAG_END) { - width -= vstyle.aveCharWidth; // take into account the space for end wrap mark - } - ll->lines = 0; - // Calculate line start positions based upon width. - int lastGoodBreak = 0; - int lastLineStart = 0; - int startOffset = 0; - int p = 0; - while (p < ll->numCharsInLine) { - if ((ll->positions[p + 1] - startOffset) >= width) { - if (lastGoodBreak == lastLineStart) { - // Try moving to start of last character - if (p > 0) { - lastGoodBreak = pdoc->MovePositionOutsideChar(p + posLineStart, -1) - - posLineStart; - } - if (lastGoodBreak == lastLineStart) { - // Ensure at least one character on line. - lastGoodBreak = pdoc->MovePositionOutsideChar(lastGoodBreak + posLineStart + 1, 1) - - posLineStart; - } - } - lastLineStart = lastGoodBreak; - ll->lines++; - ll->SetLineStart(ll->lines, lastGoodBreak); - startOffset = ll->positions[lastGoodBreak]; - // take into account the space for start wrap mark and indent - startOffset -= actualWrapVisualStartIndent * vstyle.aveCharWidth; - p = lastGoodBreak + 1; - continue; - } - if (p > 0) { - if (wrapState == eWrapChar) { - lastGoodBreak = pdoc->MovePositionOutsideChar(p + posLineStart, -1) - - posLineStart; - p = pdoc->MovePositionOutsideChar(p + 1 + posLineStart, 1) - posLineStart; - continue; - } else if (ll->styles[p] != ll->styles[p - 1]) { - lastGoodBreak = p; - } else if (IsSpaceOrTab(ll->chars[p - 1]) && !IsSpaceOrTab(ll->chars[p])) { - lastGoodBreak = p; - } - } - p++; - } - ll->lines++; - } - ll->validity = LineLayout::llLines; - } -} - -ColourAllocated Editor::SelectionBackground(ViewStyle &vsDraw) { - return primarySelection ? vsDraw.selbackground.allocated : vsDraw.selbackground2.allocated; -} - -ColourAllocated Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackground, - ColourAllocated background, bool inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) { - if (inSelection) { - if (vsDraw.selbackset && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) { - return SelectionBackground(vsDraw); - } - } else { - if ((vsDraw.edgeState == EDGE_BACKGROUND) && - (i >= ll->edgeColumn) && - !IsEOLChar(ll->chars[i])) - return vsDraw.edgecolour.allocated; - if (inHotspot && vsDraw.hotspotBackgroundSet) - return vsDraw.hotspotBackground.allocated; - if (overrideBackground && (styleMain != STYLE_BRACELIGHT) && (styleMain != STYLE_BRACEBAD)) - return background; - } - return vsDraw.styles[styleMain].back.allocated; -} - -void Editor::DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight) { - Point from(0, ((lineVisible & 1) && (lineHeight & 1)) ? 1 : 0); - PRectangle rcCopyArea(start + 1, rcSegment.top, start + 2, rcSegment.bottom); - surface->Copy(rcCopyArea, from, - highlight ? *pixmapIndentGuideHighlight : *pixmapIndentGuide); -} - -void Editor::DrawWrapMarker(Surface *surface, PRectangle rcPlace, - bool isEndMarker, ColourAllocated wrapColour) { - surface->PenColour(wrapColour); - - enum { xa = 1 }; // gap before start - int w = rcPlace.right - rcPlace.left - xa - 1; - - bool xStraight = isEndMarker; // x-mirrored symbol for start marker - bool yStraight = true; - //bool yStraight= isEndMarker; // comment in for start marker y-mirrowed - - int x0 = xStraight ? rcPlace.left : rcPlace.right - 1; - int y0 = yStraight ? rcPlace.top : rcPlace.bottom - 1; - - int dy = (rcPlace.bottom - rcPlace.top) / 5; - int y = (rcPlace.bottom - rcPlace.top) / 2 + dy; - - struct Relative { - Surface *surface; - int xBase; - int xDir; - int yBase; - int yDir; - void MoveTo(int xRelative, int yRelative) { - surface->MoveTo(xBase + xDir * xRelative, yBase + yDir * yRelative); - } - void LineTo(int xRelative, int yRelative) { - surface->LineTo(xBase + xDir * xRelative, yBase + yDir * yRelative); - } - }; - Relative rel = {surface, x0, xStraight ? 1 : -1, y0, yStraight ? 1 : -1}; - - // arrow head - rel.MoveTo(xa, y); - rel.LineTo(xa + 2*w / 3, y - dy); - rel.MoveTo(xa, y); - rel.LineTo(xa + 2*w / 3, y + dy); - - // arrow body - rel.MoveTo(xa, y); - rel.LineTo(xa + w, y); - rel.LineTo(xa + w, y - 2 * dy); - rel.LineTo(xa - 1, // on windows lineto is exclusive endpoint, perhaps GTK not... - y - 2 * dy); -} - -static void SimpleAlphaRectangle(Surface *surface, PRectangle rc, ColourAllocated fill, int alpha) { - if (alpha != SC_ALPHA_NOALPHA) { - surface->AlphaRectangle(rc, 0, fill, alpha, fill, alpha, 0); - } -} - -void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll, - int line, int lineEnd, int xStart, int subLine, int subLineStart, - bool overrideBackground, ColourAllocated background, - bool drawWrapMarkEnd, ColourAllocated wrapColour) { - - int styleMask = pdoc->stylingBitsMask; - PRectangle rcSegment = rcLine; - - // Fill in a PRectangle representing the end of line characters - int xEol = ll->positions[lineEnd] - subLineStart; - rcSegment.left = xEol + xStart; - rcSegment.right = xEol + vsDraw.aveCharWidth + xStart; - int posLineEnd = pdoc->LineStart(line + 1); - bool eolInSelection = (subLine == (ll->lines - 1)) && - (posLineEnd > ll->selStart) && (posLineEnd <= ll->selEnd) && (ll->selStart != ll->selEnd); - - if (eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) { - surface->FillRectangle(rcSegment, SelectionBackground(vsDraw)); - } else { - if (overrideBackground) { - surface->FillRectangle(rcSegment, background); - } else { - surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated); - } - if (eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (vsDraw.selAlpha != SC_ALPHA_NOALPHA)) { - SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw), vsDraw.selAlpha); - } - } - - rcSegment.left = xEol + vsDraw.aveCharWidth + xStart; - rcSegment.right = rcLine.right; - if (overrideBackground) { - surface->FillRectangle(rcSegment, background); - } else if (vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].eolFilled) { - surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated); - } else { - surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back.allocated); - } - - if (vsDraw.selEOLFilled && eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) { - surface->FillRectangle(rcSegment, SelectionBackground(vsDraw)); - } else { - if (overrideBackground) { - surface->FillRectangle(rcSegment, background); - } else if (vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].eolFilled) { - surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated); - } else { - surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back.allocated); - } - if (vsDraw.selEOLFilled && eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (vsDraw.selAlpha != SC_ALPHA_NOALPHA)) { - SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw), vsDraw.selAlpha); - } - } - - if (drawWrapMarkEnd) { - PRectangle rcPlace = rcSegment; - - if (wrapVisualFlagsLocation & SC_WRAPVISUALFLAGLOC_END_BY_TEXT) { - rcPlace.left = xEol + xStart; - rcPlace.right = rcPlace.left + vsDraw.aveCharWidth; - } else { - // draw left of the right text margin, to avoid clipping by the current clip rect - rcPlace.right = rcLine.right - vs.rightMarginWidth; - rcPlace.left = rcPlace.right - vsDraw.aveCharWidth; - } - DrawWrapMarker(surface, rcPlace, true, wrapColour); - } -} - -void Editor::DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int xStart, - PRectangle rcLine, LineLayout *ll, int subLine, int lineEnd, bool under) { - // Draw decorators - const int posLineStart = pdoc->LineStart(line); - const int lineStart = ll->LineStart(subLine); - const int subLineStart = ll->positions[lineStart]; - const int posLineEnd = posLineStart + lineEnd; - - if (!under) { - // Draw indicators - // foreach indicator... - for (int indicnum = 0, mask = 1 << pdoc->stylingBits; mask < 0x100; indicnum++) { - if (!(mask & ll->styleBitsSet)) { - mask <<= 1; - continue; - } - int startPos = -1; - // foreach style pos in line... - for (int indicPos = lineStart; indicPos <= lineEnd; indicPos++) { - // look for starts... - if (startPos < 0) { - // NOT in indicator run, looking for START - if (indicPos < lineEnd && (ll->indicators[indicPos] & mask)) - startPos = indicPos; - } - // ... or ends - if (startPos >= 0) { - // IN indicator run, looking for END - if (indicPos >= lineEnd || !(ll->indicators[indicPos] & mask)) { - // AT end of indicator run, DRAW it! - PRectangle rcIndic( - ll->positions[startPos] + xStart - subLineStart, - rcLine.top + vsDraw.maxAscent, - ll->positions[indicPos] + xStart - subLineStart, - rcLine.top + vsDraw.maxAscent + 3); - vsDraw.indicators[indicnum].Draw(surface, rcIndic, rcLine); - // RESET control var - startPos = -1; - } - } - } - mask <<= 1; - } - } - - for (Decoration *deco = pdoc->decorations.root; deco; deco = deco->next) { - if (under == vsDraw.indicators[deco->indicator].under) { - int startPos = posLineStart + lineStart; - if (!deco->rs.ValueAt(startPos)) { - startPos = deco->rs.EndRun(startPos); - } - while ((startPos < posLineEnd) && (deco->rs.ValueAt(startPos))) { - int endPos = deco->rs.EndRun(startPos); - if (endPos > posLineEnd) - endPos = posLineEnd; - PRectangle rcIndic( - ll->positions[startPos - posLineStart] + xStart - subLineStart, - rcLine.top + vsDraw.maxAscent, - ll->positions[endPos - posLineStart] + xStart - subLineStart, - rcLine.top + vsDraw.maxAscent + 3); - vsDraw.indicators[deco->indicator].Draw(surface, rcIndic, rcLine); - startPos = deco->rs.EndRun(endPos); - } - } - } -} - -inline bool isWSvisible(bool inIndentation, WhiteSpaceVisibility wsv) -{ - return wsv == wsVisibleAlways || - wsv == wsIndentVisible && inIndentation || - wsv == wsVisibleAfterIndent && !inIndentation; -} - -void DrawTextBlob(Surface *surface, ViewStyle &vsDraw, PRectangle rcSegment, - const char *s, ColourAllocated textBack, ColourAllocated textFore, bool twoPhaseDraw) { - if (!twoPhaseDraw) { - surface->FillRectangle(rcSegment, textBack); - } - Font &ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font; - int normalCharHeight = surface->Ascent(ctrlCharsFont) - - surface->InternalLeading(ctrlCharsFont); - PRectangle rcCChar = rcSegment; - rcCChar.left = rcCChar.left + 1; - rcCChar.top = rcSegment.top + vsDraw.maxAscent - normalCharHeight; - rcCChar.bottom = rcSegment.top + vsDraw.maxAscent + 1; - PRectangle rcCentral = rcCChar; - rcCentral.top++; - rcCentral.bottom--; - surface->FillRectangle(rcCentral, textFore); - PRectangle rcChar = rcCChar; - rcChar.left++; - rcChar.right--; - surface->DrawTextClipped(rcChar, ctrlCharsFont, - rcSegment.top + vsDraw.maxAscent, s, istrlen(s), - textBack, textFore); -} - -void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart, - PRectangle rcLine, LineLayout *ll, int subLine) { - - PRectangle rcSegment = rcLine; - - // Using one font for all control characters so it can be controlled independently to ensure - // the box goes around the characters tightly. Seems to be no way to work out what height - // is taken by an individual character - internal leading gives varying results. - Font &ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font; - - // See if something overrides the line background color: Either if caret is on the line - // and background color is set for that, or if a marker is defined that forces its background - // color onto the line, or if a marker is defined but has no selection margin in which to - // display itself (as long as it's not an SC_MARK_EMPTY marker). These are checked in order - // with the earlier taking precedence. When multiple markers cause background override, - // the color for the highest numbered one is used. - bool overrideBackground = false; - ColourAllocated background; - if (caret.active && vsDraw.showCaretLineBackground && (vsDraw.caretLineAlpha == SC_ALPHA_NOALPHA) && ll->containsCaret) { - overrideBackground = true; - background = vsDraw.caretLineBackground.allocated; - } - if (!overrideBackground) { - int marks = pdoc->GetMark(line); - for (int markBit = 0; (markBit < 32) && marks; markBit++) { - if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) && - (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) { - background = vsDraw.markers[markBit].back.allocated; - overrideBackground = true; - } - marks >>= 1; - } - } - if (!overrideBackground) { - if (vsDraw.maskInLine) { - int marksMasked = pdoc->GetMark(line) & vsDraw.maskInLine; - if (marksMasked) { - for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) { - if ((marksMasked & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY) && - (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) { - overrideBackground = true; - background = vsDraw.markers[markBit].back.allocated; - } - marksMasked >>= 1; - } - } - } - } - - bool drawWhitespaceBackground = (vsDraw.viewWhitespace != wsInvisible) && - (!overrideBackground) && (vsDraw.whitespaceBackgroundSet); - - bool inIndentation = subLine == 0; // Do not handle indentation except on first subline. - int indentWidth = pdoc->IndentSize() * vsDraw.spaceWidth; - - int posLineStart = pdoc->LineStart(line); - - int startseg = ll->LineStart(subLine); - int subLineStart = ll->positions[startseg]; - int lineStart = 0; - int lineEnd = 0; - if (subLine < ll->lines) { - lineStart = ll->LineStart(subLine); - lineEnd = ll->LineStart(subLine + 1); - } - - ColourAllocated wrapColour = vsDraw.styles[STYLE_DEFAULT].fore.allocated; - if (vsDraw.whitespaceForegroundSet) - wrapColour = vsDraw.whitespaceForeground.allocated; - - bool drawWrapMarkEnd = false; - - if (wrapVisualFlags & SC_WRAPVISUALFLAG_END) { - if (subLine + 1 < ll->lines) { - drawWrapMarkEnd = ll->LineStart(subLine + 1) != 0; - } - } - - if (actualWrapVisualStartIndent != 0) { - - bool continuedWrapLine = false; - if (subLine < ll->lines) { - continuedWrapLine = ll->LineStart(subLine) != 0; - } - - if (continuedWrapLine) { - // draw continuation rect - PRectangle rcPlace = rcSegment; - - rcPlace.left = ll->positions[startseg] + xStart - subLineStart; - rcPlace.right = rcPlace.left + actualWrapVisualStartIndent * vsDraw.aveCharWidth; - - // default bgnd here.. - surface->FillRectangle(rcSegment, overrideBackground ? background : - vsDraw.styles[STYLE_DEFAULT].back.allocated); - - // main line style would be below but this would be inconsistent with end markers - // also would possibly not be the style at wrap point - //int styleMain = ll->styles[lineStart]; - //surface->FillRectangle(rcPlace, vsDraw.styles[styleMain].back.allocated); - - if (wrapVisualFlags & SC_WRAPVISUALFLAG_START) { - - if (wrapVisualFlagsLocation & SC_WRAPVISUALFLAGLOC_START_BY_TEXT) - rcPlace.left = rcPlace.right - vsDraw.aveCharWidth; - else - rcPlace.right = rcPlace.left + vsDraw.aveCharWidth; - - DrawWrapMarker(surface, rcPlace, false, wrapColour); - } - - xStart += actualWrapVisualStartIndent * vsDraw.aveCharWidth; - } - } - - // Does not take margin into account but not significant - int xStartVisible = subLineStart - xStart; - - BreakFinder bfBack(ll, lineStart, lineEnd, posLineStart, IsUnicodeMode(), xStartVisible); - int next = bfBack.First(); - - // Background drawing loop - while (twoPhaseDraw && (next < lineEnd)) { - - startseg = next; - next = bfBack.Next(); - int i = next - 1; - int iDoc = i + posLineStart; - - rcSegment.left = ll->positions[startseg] + xStart - subLineStart; - rcSegment.right = ll->positions[i + 1] + xStart - subLineStart; - // Only try to draw if really visible - enhances performance by not calling environment to - // draw strings that are completely past the right side of the window. - if ((rcSegment.left <= rcLine.right) && (rcSegment.right >= rcLine.left)) { - // Clip to line rectangle, since may have a huge position which will not work with some platforms - rcSegment.left = Platform::Maximum(rcSegment.left, rcLine.left); - rcSegment.right = Platform::Minimum(rcSegment.right, rcLine.right); - - int styleMain = ll->styles[i]; - bool inSelection = (iDoc >= ll->selStart) && (iDoc < ll->selEnd) && (ll->selStart != ll->selEnd); - bool inHotspot = (ll->hsStart != -1) && (iDoc >= ll->hsStart) && (iDoc < ll->hsEnd); - ColourAllocated textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, inHotspot, styleMain, i, ll); - if (ll->chars[i] == '\t') { - // Tab display - if (drawWhitespaceBackground && isWSvisible(inIndentation, vsDraw.viewWhitespace)) - textBack = vsDraw.whitespaceBackground.allocated; - surface->FillRectangle(rcSegment, textBack); - } else if (IsControlCharacter(ll->chars[i])) { - // Control character display - inIndentation = false; - surface->FillRectangle(rcSegment, textBack); - } else { - // Normal text display - surface->FillRectangle(rcSegment, textBack); - if (vsDraw.viewWhitespace != wsInvisible || - (inIndentation && vsDraw.viewIndentationGuides == ivReal)) { - for (int cpos = 0; cpos <= i - startseg; cpos++) { - if (ll->chars[cpos + startseg] == ' ') { - if (drawWhitespaceBackground && isWSvisible(inIndentation, vsDraw.viewWhitespace)) { - PRectangle rcSpace(ll->positions[cpos + startseg] + xStart - subLineStart, - rcSegment.top, - ll->positions[cpos + startseg + 1] + xStart - subLineStart, - rcSegment.bottom); - surface->FillRectangle(rcSpace, vsDraw.whitespaceBackground.allocated); - } - } else { - inIndentation = false; - } - } - } - } - } else if (rcSegment.left > rcLine.right) { - break; - } - } - - if (twoPhaseDraw) { - DrawEOL(surface, vsDraw, rcLine, ll, line, lineEnd, - xStart, subLine, subLineStart, overrideBackground, background, - drawWrapMarkEnd, wrapColour); - } - - DrawIndicators(surface, vsDraw, line, xStart, rcLine, ll, subLine, lineEnd, true); - - if (vsDraw.edgeState == EDGE_LINE) { - int edgeX = theEdge * vsDraw.spaceWidth; - rcSegment.left = edgeX + xStart; - rcSegment.right = rcSegment.left + 1; - surface->FillRectangle(rcSegment, vsDraw.edgecolour.allocated); - } - - inIndentation = subLine == 0; // Do not handle indentation except on first subline. - // Foreground drawing loop - BreakFinder bfFore(ll, lineStart, lineEnd, posLineStart, IsUnicodeMode(), xStartVisible); - next = bfFore.First(); - - while (next < lineEnd) { - - startseg = next; - next = bfFore.Next(); - int i = next - 1; - - int iDoc = i + posLineStart; - - rcSegment.left = ll->positions[startseg] + xStart - subLineStart; - rcSegment.right = ll->positions[i + 1] + xStart - subLineStart; - // Only try to draw if really visible - enhances performance by not calling environment to - // draw strings that are completely past the right side of the window. - if ((rcSegment.left <= rcLine.right) && (rcSegment.right >= rcLine.left)) { - int styleMain = ll->styles[i]; - ColourAllocated textFore = vsDraw.styles[styleMain].fore.allocated; - Font &textFont = vsDraw.styles[styleMain].font; - //hotspot foreground - if (ll->hsStart != -1 && iDoc >= ll->hsStart && iDoc < hsEnd) { - if (vsDraw.hotspotForegroundSet) - textFore = vsDraw.hotspotForeground.allocated; - } - bool inSelection = (iDoc >= ll->selStart) && (iDoc < ll->selEnd) && (ll->selStart != ll->selEnd); - if (inSelection && (vsDraw.selforeset)) { - textFore = vsDraw.selforeground.allocated; - } - bool inHotspot = (ll->hsStart != -1) && (iDoc >= ll->hsStart) && (iDoc < ll->hsEnd); - ColourAllocated textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, inHotspot, styleMain, i, ll); - if (ll->chars[i] == '\t') { - // Tab display - if (!twoPhaseDraw) { - if (drawWhitespaceBackground && isWSvisible(inIndentation, vsDraw.viewWhitespace)) - textBack = vsDraw.whitespaceBackground.allocated; - surface->FillRectangle(rcSegment, textBack); - } - if ((vsDraw.viewWhitespace != wsInvisible) || - (inIndentation && vsDraw.viewIndentationGuides != ivNone)) { - if (vsDraw.whitespaceForegroundSet) - textFore = vsDraw.whitespaceForeground.allocated; - surface->PenColour(textFore); - } - if (inIndentation && vsDraw.viewIndentationGuides == ivReal) { - for (int xIG = ll->positions[i] / indentWidth * indentWidth; xIG < ll->positions[i + 1]; xIG += indentWidth) { - if (xIG >= ll->positions[i] && xIG > 0) { - DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIG + xStart, rcSegment, - (ll->xHighlightGuide == xIG)); - } - } - } - if (vsDraw.viewWhitespace != wsInvisible) { - if (isWSvisible(inIndentation, vsDraw.viewWhitespace)) { - PRectangle rcTab(rcSegment.left + 1, rcSegment.top + 4, - rcSegment.right - 1, rcSegment.bottom - vsDraw.maxDescent); - DrawTabArrow(surface, rcTab, rcSegment.top + vsDraw.lineHeight / 2); - } - } - } else if (IsControlCharacter(ll->chars[i])) { - // Control character display - inIndentation = false; - if (controlCharSymbol < 32) { - // Draw the character - const char *ctrlChar = ControlCharacterString(ll->chars[i]); - DrawTextBlob(surface, vsDraw, rcSegment, ctrlChar, textBack, textFore, twoPhaseDraw); - } else { - char cc[2] = { static_cast(controlCharSymbol), '\0' }; - surface->DrawTextNoClip(rcSegment, ctrlCharsFont, - rcSegment.top + vsDraw.maxAscent, - cc, 1, textBack, textFore); - } - } else if ((i == startseg) && (static_cast(ll->chars[i]) >= 0x80) && IsUnicodeMode()) { - char hexits[3]; - sprintf(hexits, "%2X", ll->chars[i] & 0xff); - DrawTextBlob(surface, vsDraw, rcSegment, hexits, textBack, textFore, twoPhaseDraw); - } else { - // Normal text display - if (vsDraw.styles[styleMain].visible) { - if (twoPhaseDraw) { - surface->DrawTextTransparent(rcSegment, textFont, - rcSegment.top + vsDraw.maxAscent, ll->chars + startseg, - i - startseg + 1, textFore); - } else { - surface->DrawTextNoClip(rcSegment, textFont, - rcSegment.top + vsDraw.maxAscent, ll->chars + startseg, - i - startseg + 1, textFore, textBack); - } - } - if (vsDraw.viewWhitespace != wsInvisible || - (inIndentation && vsDraw.viewIndentationGuides != ivNone)) { - for (int cpos = 0; cpos <= i - startseg; cpos++) { - if (ll->chars[cpos + startseg] == ' ') { - if (vsDraw.viewWhitespace != wsInvisible) { - if (vsDraw.whitespaceForegroundSet) - textFore = vsDraw.whitespaceForeground.allocated; - if (isWSvisible(inIndentation, vsDraw.viewWhitespace)) { - int xmid = (ll->positions[cpos + startseg] + ll->positions[cpos + startseg + 1]) / 2; - if (!twoPhaseDraw && drawWhitespaceBackground) { - textBack = vsDraw.whitespaceBackground.allocated; - PRectangle rcSpace(ll->positions[cpos + startseg] + xStart - subLineStart, - rcSegment.top, - ll->positions[cpos + startseg + 1] + xStart - subLineStart, - rcSegment.bottom); - surface->FillRectangle(rcSpace, textBack); - } - PRectangle rcDot(xmid + xStart - subLineStart, rcSegment.top + vsDraw.lineHeight / 2, 0, 0); - rcDot.right = rcDot.left + 1; - rcDot.bottom = rcDot.top + 1; - surface->FillRectangle(rcDot, textFore); - } - } - if (inIndentation && vsDraw.viewIndentationGuides == ivReal) { - int startSpace = ll->positions[cpos + startseg]; - if (startSpace > 0 && (startSpace % indentWidth == 0)) { - DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, startSpace + xStart, rcSegment, - (ll->xHighlightGuide == ll->positions[cpos + startseg])); - } - } - } else { - inIndentation = false; - } - } - } - } - if (ll->hsStart != -1 && vsDraw.hotspotUnderline && iDoc >= ll->hsStart && iDoc < ll->hsEnd ) { - PRectangle rcUL = rcSegment; - rcUL.top = rcUL.top + vsDraw.maxAscent + 1; - rcUL.bottom = rcUL.top + 1; - if (vsDraw.hotspotForegroundSet) - surface->FillRectangle(rcUL, vsDraw.hotspotForeground.allocated); - else - surface->FillRectangle(rcUL, textFore); - } else if (vsDraw.styles[styleMain].underline) { - PRectangle rcUL = rcSegment; - rcUL.top = rcUL.top + vsDraw.maxAscent + 1; - rcUL.bottom = rcUL.top + 1; - surface->FillRectangle(rcUL, textFore); - } - } else if (rcSegment.left > rcLine.right) { - break; - } - } - if ((vsDraw.viewIndentationGuides == ivLookForward || vsDraw.viewIndentationGuides == ivLookBoth) - && (subLine == 0)) { - int indentSpace = pdoc->GetLineIndentation(line); - // Find the most recent line with some text - - int lineLastWithText = line; - while (lineLastWithText > 0 && pdoc->IsWhiteLine(lineLastWithText)) { - lineLastWithText--; - } - if (lineLastWithText < line) { - // This line is empty, so use indentation of last line with text - int indentLastWithText = pdoc->GetLineIndentation(lineLastWithText); - int isFoldHeader = pdoc->GetLevel(lineLastWithText) & SC_FOLDLEVELHEADERFLAG; - if (isFoldHeader) { - // Level is one more level than parent - indentLastWithText += pdoc->IndentSize(); - } - if (vsDraw.viewIndentationGuides == ivLookForward) { - // In viLookForward mode, previous line only used if it is a fold header - if (isFoldHeader) { - indentSpace = Platform::Maximum(indentSpace, indentLastWithText); - } - } else { // viLookBoth - indentSpace = Platform::Maximum(indentSpace, indentLastWithText); - } - } - - int lineNextWithText = line; - while (lineNextWithText < pdoc->LinesTotal() && pdoc->IsWhiteLine(lineNextWithText)) { - lineNextWithText++; - } - if (lineNextWithText > line) { - // This line is empty, so use indentation of last line with text - indentSpace = Platform::Maximum(indentSpace, - pdoc->GetLineIndentation(lineNextWithText)); - } - - for (int indentPos = pdoc->IndentSize(); indentPos < indentSpace; indentPos += pdoc->IndentSize()) { - int xIndent = indentPos * vsDraw.spaceWidth; - DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcSegment, - (ll->xHighlightGuide == xIndent)); - } - } - - DrawIndicators(surface, vsDraw, line, xStart, rcLine, ll, subLine, lineEnd, false); - - // End of the drawing of the current line - if (!twoPhaseDraw) { - DrawEOL(surface, vsDraw, rcLine, ll, line, lineEnd, - xStart, subLine, subLineStart, overrideBackground, background, - drawWrapMarkEnd, wrapColour); - } - if ((vsDraw.selAlpha != SC_ALPHA_NOALPHA) && (ll->selStart >= 0) && (ll->selEnd >= 0)) { - int startPosSel = (ll->selStart < posLineStart) ? posLineStart : ll->selStart; - int endPosSel = (ll->selEnd < (lineEnd + posLineStart)) ? ll->selEnd : (lineEnd + posLineStart); - if (startPosSel < endPosSel) { - rcSegment.left = xStart + ll->positions[startPosSel - posLineStart] - subLineStart; - rcSegment.right = xStart + ll->positions[endPosSel - posLineStart] - subLineStart; - rcSegment.left = Platform::Maximum(rcSegment.left, rcLine.left); - rcSegment.right = Platform::Minimum(rcSegment.right, rcLine.right); - SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw), vsDraw.selAlpha); - } - } - - // Draw any translucent whole line states - rcSegment.left = xStart; - rcSegment.right = rcLine.right - 1; - if (caret.active && vsDraw.showCaretLineBackground && ll->containsCaret) { - SimpleAlphaRectangle(surface, rcSegment, vsDraw.caretLineBackground.allocated, vsDraw.caretLineAlpha); - } - int marks = pdoc->GetMark(line); - for (int markBit = 0; (markBit < 32) && marks; markBit++) { - if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND)) { - SimpleAlphaRectangle(surface, rcSegment, vsDraw.markers[markBit].back.allocated, vsDraw.markers[markBit].alpha); - } - marks >>= 1; - } - if (vsDraw.maskInLine) { - int marksMasked = pdoc->GetMark(line) & vsDraw.maskInLine; - if (marksMasked) { - for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) { - if ((marksMasked & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY)) { - SimpleAlphaRectangle(surface, rcSegment, vsDraw.markers[markBit].back.allocated, vsDraw.markers[markBit].alpha); - } - marksMasked >>= 1; - } - } - } -} - -void Editor::DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine, int xStart, int offset, int posCaret, PRectangle rcCaret) { - - int lineStart = ll->LineStart(subLine); - int posBefore = posCaret; - int posAfter = MovePositionOutsideChar(posCaret + 1, 1); - int numCharsToDraw = posAfter - posCaret; - - // Work out where the starting and ending offsets are. We need to - // see if the previous character shares horizontal space, such as a - // glyph / combining character. If so we'll need to draw that too. - int offsetFirstChar = offset; - int offsetLastChar = offset + (posAfter - posCaret); - while ((offsetLastChar - numCharsToDraw) >= lineStart) { - if ((ll->positions[offsetLastChar] - ll->positions[offsetLastChar - numCharsToDraw]) > 0) { - // The char does not share horizontal space - break; - } - // Char shares horizontal space, update the numChars to draw - // Update posBefore to point to the prev char - posBefore = MovePositionOutsideChar(posBefore - 1, -1); - numCharsToDraw = posAfter - posBefore; - offsetFirstChar = offset - (posCaret - posBefore); - } - - // See if the next character shares horizontal space, if so we'll - // need to draw that too. - numCharsToDraw = offsetLastChar - offsetFirstChar; - while ((offsetLastChar < ll->LineStart(subLine + 1)) && (offsetLastChar <= ll->numCharsInLine)) { - // Update posAfter to point to the 2nd next char, this is where - // the next character ends, and 2nd next begins. We'll need - // to compare these two - posBefore = posAfter; - posAfter = MovePositionOutsideChar(posAfter + 1, 1); - offsetLastChar = offset + (posAfter - posCaret); - if ((ll->positions[offsetLastChar] - ll->positions[offsetLastChar - (posAfter - posBefore)]) > 0) { - // The char does not share horizontal space - break; - } - // Char shares horizontal space, update the numChars to draw - numCharsToDraw = offsetLastChar - offsetFirstChar; - } - - // We now know what to draw, update the caret drawing rectangle - rcCaret.left = ll->positions[offsetFirstChar] - ll->positions[ll->LineStart(subLine)] + xStart; - rcCaret.right = ll->positions[offsetFirstChar+numCharsToDraw] - ll->positions[ll->LineStart(subLine)] + xStart; - - // This character is where the caret block is, we override the colours - // (inversed) for drawing the caret here. - int styleMain = ll->styles[offsetFirstChar]; - surface->DrawTextClipped(rcCaret, vsDraw.styles[styleMain].font, - rcCaret.top + vsDraw.maxAscent, ll->chars + offsetFirstChar, - numCharsToDraw, vsDraw.styles[styleMain].back.allocated, - vsDraw.caretcolour.allocated); -} - -void Editor::RefreshPixMaps(Surface *surfaceWindow) { - if (!pixmapSelPattern->Initialised()) { - const int patternSize = 8; - pixmapSelPattern->InitPixMap(patternSize, patternSize, surfaceWindow, wMain.GetID()); - // This complex procedure is to reproduce the checkerboard dithered pattern used by windows - // for scroll bars and Visual Studio for its selection margin. The colour of this pattern is half - // way between the chrome colour and the chrome highlight colour making a nice transition - // between the window chrome and the content area. And it works in low colour depths. - PRectangle rcPattern(0, 0, patternSize, patternSize); - - // Initialize default colours based on the chrome colour scheme. Typically the highlight is white. - ColourAllocated colourFMFill = vs.selbar.allocated; - ColourAllocated colourFMStripes = vs.selbarlight.allocated; - - if (!(vs.selbarlight.desired == ColourDesired(0xff, 0xff, 0xff))) { - // User has chosen an unusual chrome colour scheme so just use the highlight edge colour. - // (Typically, the highlight colour is white.) - colourFMFill = vs.selbarlight.allocated; - } - - if (vs.foldmarginColourSet) { - // override default fold margin colour - colourFMFill = vs.foldmarginColour.allocated; - } - if (vs.foldmarginHighlightColourSet) { - // override default fold margin highlight colour - colourFMStripes = vs.foldmarginHighlightColour.allocated; - } - - pixmapSelPattern->FillRectangle(rcPattern, colourFMFill); - pixmapSelPattern->PenColour(colourFMStripes); - for (int stripe = 0; stripe < patternSize; stripe++) { - // Alternating 1 pixel stripes is same as checkerboard. - pixmapSelPattern->MoveTo(0, stripe * 2); - pixmapSelPattern->LineTo(patternSize, stripe * 2 - patternSize); - } - } - - if (!pixmapIndentGuide->Initialised()) { - // 1 extra pixel in height so can handle odd/even positions and so produce a continuous line - pixmapIndentGuide->InitPixMap(1, vs.lineHeight + 1, surfaceWindow, wMain.GetID()); - pixmapIndentGuideHighlight->InitPixMap(1, vs.lineHeight + 1, surfaceWindow, wMain.GetID()); - PRectangle rcIG(0, 0, 1, vs.lineHeight); - pixmapIndentGuide->FillRectangle(rcIG, vs.styles[STYLE_INDENTGUIDE].back.allocated); - pixmapIndentGuide->PenColour(vs.styles[STYLE_INDENTGUIDE].fore.allocated); - pixmapIndentGuideHighlight->FillRectangle(rcIG, vs.styles[STYLE_BRACELIGHT].back.allocated); - pixmapIndentGuideHighlight->PenColour(vs.styles[STYLE_BRACELIGHT].fore.allocated); - for (int stripe = 1; stripe < vs.lineHeight + 1; stripe += 2) { - pixmapIndentGuide->MoveTo(0, stripe); - pixmapIndentGuide->LineTo(2, stripe); - pixmapIndentGuideHighlight->MoveTo(0, stripe); - pixmapIndentGuideHighlight->LineTo(2, stripe); - } - } - - if (bufferedDraw) { - if (!pixmapLine->Initialised()) { - PRectangle rcClient = GetClientRectangle(); - pixmapLine->InitPixMap(rcClient.Width(), vs.lineHeight, - surfaceWindow, wMain.GetID()); - pixmapSelMargin->InitPixMap(vs.fixedColumnWidth, - rcClient.Height(), surfaceWindow, wMain.GetID()); - } - } -} - -void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { - //Platform::DebugPrintf("Paint:%1d (%3d,%3d) ... (%3d,%3d)\n", - // paintingAllText, rcArea.left, rcArea.top, rcArea.right, rcArea.bottom); - - pixmapLine->Release(); - RefreshStyleData(); - RefreshPixMaps(surfaceWindow); - - PRectangle rcClient = GetClientRectangle(); - //Platform::DebugPrintf("Client: (%3d,%3d) ... (%3d,%3d) %d\n", - // rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); - - surfaceWindow->SetPalette(&palette, true); - pixmapLine->SetPalette(&palette, !hasFocus); - - int screenLinePaintFirst = rcArea.top / vs.lineHeight; - // The area to be painted plus one extra line is styled. - // The extra line is to determine when a style change, such as starting a comment flows on to other lines. - int lineStyleLast = topLine + (rcArea.bottom - 1) / vs.lineHeight + 1; - //Platform::DebugPrintf("Paint lines = %d .. %d\n", topLine + screenLinePaintFirst, lineStyleLast); - int endPosPaint = pdoc->Length(); - if (lineStyleLast < cs.LinesDisplayed()) - endPosPaint = pdoc->LineStart(cs.DocFromDisplay(lineStyleLast + 1)); - - int xStart = vs.fixedColumnWidth - xOffset; - int ypos = 0; - if (!bufferedDraw) - ypos += screenLinePaintFirst * vs.lineHeight; - int yposScreen = screenLinePaintFirst * vs.lineHeight; - - // Ensure we are styled as far as we are painting. - pdoc->EnsureStyledTo(endPosPaint); - bool paintAbandonedByStyling = paintState == paintAbandoned; - if (needUpdateUI) { - // Deselect palette by selecting a temporary palette - Palette palTemp; - surfaceWindow->SetPalette(&palTemp, true); - - NotifyUpdateUI(); - needUpdateUI = false; - - RefreshStyleData(); - RefreshPixMaps(surfaceWindow); - surfaceWindow->SetPalette(&palette, true); - pixmapLine->SetPalette(&palette, !hasFocus); - } - - // Call priority lines wrap on a window of lines which are likely - // to rendered with the following paint (that is wrap the visible - // lines first). - int startLineToWrap = cs.DocFromDisplay(topLine) - 5; - if (startLineToWrap < 0) - startLineToWrap = -1; - if (WrapLines(false, startLineToWrap)) { - // The wrapping process has changed the height of some lines so - // abandon this paint for a complete repaint. - if (AbandonPaint()) { - return; - } - RefreshPixMaps(surfaceWindow); // In case pixmaps invalidated by scrollbar change - } - PLATFORM_ASSERT(pixmapSelPattern->Initialised()); - - PaintSelMargin(surfaceWindow, rcArea); - - PRectangle rcRightMargin = rcClient; - rcRightMargin.left = rcRightMargin.right - vs.rightMarginWidth; - if (rcArea.Intersects(rcRightMargin)) { - surfaceWindow->FillRectangle(rcRightMargin, vs.styles[STYLE_DEFAULT].back.allocated); - } - - if (paintState == paintAbandoned) { - // Either styling or NotifyUpdateUI noticed that painting is needed - // outside the current painting rectangle - //Platform::DebugPrintf("Abandoning paint\n"); - if (wrapState != eWrapNone) { - if (paintAbandonedByStyling) { - // Styling has spilled over a line end, such as occurs by starting a multiline - // comment. The width of subsequent text may have changed, so rewrap. - NeedWrapping(cs.DocFromDisplay(topLine)); - } - } - return; - } - //Platform::DebugPrintf("start display %d, offset = %d\n", pdoc->Length(), xOffset); - - // Do the painting - if (rcArea.right > vs.fixedColumnWidth) { - - Surface *surface = surfaceWindow; - if (bufferedDraw) { - surface = pixmapLine; - PLATFORM_ASSERT(pixmapLine->Initialised()); - } - surface->SetUnicodeMode(IsUnicodeMode()); - surface->SetDBCSMode(CodePage()); - - int visibleLine = topLine + screenLinePaintFirst; - - int posCaret = currentPos; - if (posDrag >= 0) - posCaret = posDrag; - int lineCaret = pdoc->LineFromPosition(posCaret); - - // Remove selection margin from drawing area so text will not be drawn - // on it in unbuffered mode. - PRectangle rcTextArea = rcClient; - rcTextArea.left = vs.fixedColumnWidth; - rcTextArea.right -= vs.rightMarginWidth; - surfaceWindow->SetClip(rcTextArea); - - // Loop on visible lines - //double durLayout = 0.0; - //double durPaint = 0.0; - //double durCopy = 0.0; - //ElapsedTime etWhole; - int lineDocPrevious = -1; // Used to avoid laying out one document line multiple times - AutoLineLayout ll(llc, 0); - SelectionLineIterator lineIterator(this); - while (visibleLine < cs.LinesDisplayed() && yposScreen < rcArea.bottom) { - - int lineDoc = cs.DocFromDisplay(visibleLine); - // Only visible lines should be handled by the code within the loop - PLATFORM_ASSERT(cs.GetVisible(lineDoc)); - int lineStartSet = cs.DisplayFromDoc(lineDoc); - int subLine = visibleLine - lineStartSet; - - // Copy this line and its styles from the document into local arrays - // and determine the x position at which each character starts. - //ElapsedTime et; - if (lineDoc != lineDocPrevious) { - ll.Set(0); - // For rectangular selection this accesses the layout cache so should be after layout returned. - lineIterator.SetAt(lineDoc); - ll.Set(RetrieveLineLayout(lineDoc)); - LayoutLine(lineDoc, surface, vs, ll, wrapWidth); - lineDocPrevious = lineDoc; - } - //durLayout += et.Duration(true); - - if (ll) { - if (selType == selStream) { - ll->selStart = SelectionStart(); - ll->selEnd = SelectionEnd(); - } else { - ll->selStart = lineIterator.startPos; - ll->selEnd = lineIterator.endPos; - } - ll->containsCaret = lineDoc == lineCaret; - if (hideSelection) { - ll->selStart = -1; - ll->selEnd = -1; - ll->containsCaret = false; - } - - GetHotSpotRange(ll->hsStart, ll->hsEnd); - - PRectangle rcLine = rcClient; - rcLine.top = ypos; - rcLine.bottom = ypos + vs.lineHeight; - - Range rangeLine(pdoc->LineStart(lineDoc), pdoc->LineStart(lineDoc + 1)); - // Highlight the current braces if any - ll->SetBracesHighlight(rangeLine, braces, static_cast(bracesMatchStyle), - highlightGuideColumn * vs.spaceWidth); - - // Draw the line - DrawLine(surface, vs, lineDoc, visibleLine, xStart, rcLine, ll, subLine); - //durPaint += et.Duration(true); - - // Restore the previous styles for the brace highlights in case layout is in cache. - ll->RestoreBracesHighlight(rangeLine, braces); - - bool expanded = cs.GetExpanded(lineDoc); - if ((foldFlags & SC_FOLDFLAG_BOX) == 0) { - // Paint the line above the fold - if ((expanded && (foldFlags & SC_FOLDFLAG_LINEBEFORE_EXPANDED)) - || - (!expanded && (foldFlags & SC_FOLDFLAG_LINEBEFORE_CONTRACTED))) { - if (pdoc->GetLevel(lineDoc) & SC_FOLDLEVELHEADERFLAG) { - PRectangle rcFoldLine = rcLine; - rcFoldLine.bottom = rcFoldLine.top + 1; - surface->FillRectangle(rcFoldLine, vs.styles[STYLE_DEFAULT].fore.allocated); - } - } - // Paint the line below the fold - if ((expanded && (foldFlags & SC_FOLDFLAG_LINEAFTER_EXPANDED)) - || - (!expanded && (foldFlags & SC_FOLDFLAG_LINEAFTER_CONTRACTED))) { - if (pdoc->GetLevel(lineDoc) & SC_FOLDLEVELHEADERFLAG) { - PRectangle rcFoldLine = rcLine; - rcFoldLine.top = rcFoldLine.bottom - 1; - surface->FillRectangle(rcFoldLine, vs.styles[STYLE_DEFAULT].fore.allocated); - } - } - } else { - int FoldLevelCurr = (pdoc->GetLevel(lineDoc) & SC_FOLDLEVELNUMBERMASK) - SC_FOLDLEVELBASE; - int FoldLevelPrev = (pdoc->GetLevel(lineDoc - 1) & SC_FOLDLEVELNUMBERMASK) - SC_FOLDLEVELBASE; - int FoldLevelFlags = (pdoc->GetLevel(lineDoc) & ~SC_FOLDLEVELNUMBERMASK) & ~(0xFFF0000); - int indentationStep = pdoc->IndentSize(); - // Draw line above fold - if ((FoldLevelPrev < FoldLevelCurr) - || - (FoldLevelFlags & SC_FOLDLEVELBOXHEADERFLAG - && - (pdoc->GetLevel(lineDoc - 1) & SC_FOLDLEVELBOXFOOTERFLAG) == 0)) { - PRectangle rcFoldLine = rcLine; - rcFoldLine.bottom = rcFoldLine.top + 1; - rcFoldLine.left += xStart + FoldLevelCurr * vs.spaceWidth * indentationStep - 1; - surface->FillRectangle(rcFoldLine, vs.styles[STYLE_DEFAULT].fore.allocated); - } - - // Line below the fold (or below a contracted fold) - if (FoldLevelFlags & SC_FOLDLEVELBOXFOOTERFLAG - || - (!expanded && (foldFlags & SC_FOLDFLAG_LINEAFTER_CONTRACTED))) { - PRectangle rcFoldLine = rcLine; - rcFoldLine.top = rcFoldLine.bottom - 1; - rcFoldLine.left += xStart + (FoldLevelCurr) * vs.spaceWidth * indentationStep - 1; - surface->FillRectangle(rcFoldLine, vs.styles[STYLE_DEFAULT].fore.allocated); - } - - PRectangle rcBoxLine = rcLine; - // Draw vertical line for every fold level - for (int i = 0; i <= FoldLevelCurr; i++) { - rcBoxLine.left = xStart + i * vs.spaceWidth * indentationStep - 1; - rcBoxLine.right = rcBoxLine.left + 1; - surface->FillRectangle(rcBoxLine, vs.styles[STYLE_DEFAULT].fore.allocated); - } - } - - // Draw the Caret - if (lineDoc == lineCaret) { - int offset = Platform::Minimum(posCaret - rangeLine.start, ll->maxLineLength); - if (ll->InLine(offset, subLine)) { - int xposCaret = ll->positions[offset] - ll->positions[ll->LineStart(subLine)] + xStart; - - if (actualWrapVisualStartIndent != 0) { - int lineStart = ll->LineStart(subLine); - if (lineStart != 0) // Wrapped - xposCaret += actualWrapVisualStartIndent * vs.aveCharWidth; - } - if ((xposCaret >= 0) && (vs.caretWidth > 0) && (vs.caretStyle != CARETSTYLE_INVISIBLE) && - ((posDrag >= 0) || (caret.active && caret.on))) { - bool caretAtEOF = false; - bool caretAtEOL = false; - bool drawBlockCaret = false; - int widthOverstrikeCaret; - int caretWidthOffset = 0; - PRectangle rcCaret = rcLine; - - if (posCaret == pdoc->Length()) { // At end of document - caretAtEOF = true; - widthOverstrikeCaret = vs.aveCharWidth; - } else if ((posCaret - rangeLine.start) >= ll->numCharsInLine) { // At end of line - caretAtEOL = true; - widthOverstrikeCaret = vs.aveCharWidth; - } else { - widthOverstrikeCaret = ll->positions[offset + 1] - ll->positions[offset]; - } - if (widthOverstrikeCaret < 3) // Make sure its visible - widthOverstrikeCaret = 3; - - if (offset > ll->LineStart(subLine)) - caretWidthOffset = 1; // Move back so overlaps both character cells. - if (posDrag >= 0) { - /* Dragging text, use a line caret */ - rcCaret.left = xposCaret - caretWidthOffset; - rcCaret.right = rcCaret.left + vs.caretWidth; - } else if (inOverstrike) { - /* Overstrike (insert mode), use a modified bar caret */ - rcCaret.top = rcCaret.bottom - 2; - rcCaret.left = xposCaret + 1; - rcCaret.right = rcCaret.left + widthOverstrikeCaret - 1; - } else if (vs.caretStyle == CARETSTYLE_BLOCK) { - /* Block caret */ - rcCaret.left = xposCaret; - if (!caretAtEOL && !caretAtEOF && (ll->chars[offset] != '\t') && !(IsControlCharacter(ll->chars[offset]))) { - drawBlockCaret = true; - rcCaret.right = xposCaret + widthOverstrikeCaret; - } else { - rcCaret.right = xposCaret + vs.aveCharWidth; - } - } else { - /* Line caret */ - rcCaret.left = xposCaret - caretWidthOffset; - rcCaret.right = rcCaret.left + vs.caretWidth; - } - if (drawBlockCaret) { - DrawBlockCaret(surface, vs, ll, subLine, xStart, offset, posCaret, rcCaret); - } else { - surface->FillRectangle(rcCaret, vs.caretcolour.allocated); - } - } - } - } - - if (bufferedDraw) { - Point from(vs.fixedColumnWidth, 0); - PRectangle rcCopyArea(vs.fixedColumnWidth, yposScreen, - rcClient.right, yposScreen + vs.lineHeight); - surfaceWindow->Copy(rcCopyArea, from, *pixmapLine); - } - //durCopy += et.Duration(true); - } - - if (!bufferedDraw) { - ypos += vs.lineHeight; - } - - yposScreen += vs.lineHeight; - visibleLine++; - - lineWidthMaxSeen = Platform::Maximum( - lineWidthMaxSeen, ll->positions[ll->numCharsInLine]); - //gdk_flush(); - } - ll.Set(0); - //if (durPaint < 0.00000001) - // durPaint = 0.00000001; - - // Right column limit indicator - PRectangle rcBeyondEOF = rcClient; - rcBeyondEOF.left = vs.fixedColumnWidth; - rcBeyondEOF.right = rcBeyondEOF.right; - rcBeyondEOF.top = (cs.LinesDisplayed() - topLine) * vs.lineHeight; - if (rcBeyondEOF.top < rcBeyondEOF.bottom) { - surfaceWindow->FillRectangle(rcBeyondEOF, vs.styles[STYLE_DEFAULT].back.allocated); - if (vs.edgeState == EDGE_LINE) { - int edgeX = theEdge * vs.spaceWidth; - rcBeyondEOF.left = edgeX + xStart; - rcBeyondEOF.right = rcBeyondEOF.left + 1; - surfaceWindow->FillRectangle(rcBeyondEOF, vs.edgecolour.allocated); - } - } - //Platform::DebugPrintf( - //"Layout:%9.6g Paint:%9.6g Ratio:%9.6g Copy:%9.6g Total:%9.6g\n", - //durLayout, durPaint, durLayout / durPaint, durCopy, etWhole.Duration()); - NotifyPainted(); - } -} - -// Space (3 space characters) between line numbers and text when printing. -#define lineNumberPrintSpace " " - -ColourDesired InvertedLight(ColourDesired orig) { - unsigned int r = orig.GetRed(); - unsigned int g = orig.GetGreen(); - unsigned int b = orig.GetBlue(); - unsigned int l = (r + g + b) / 3; // There is a better calculation for this that matches human eye - unsigned int il = 0xff - l; - if (l == 0) - return ColourDesired(0xff, 0xff, 0xff); - r = r * il / l; - g = g * il / l; - b = b * il / l; - return ColourDesired(Platform::Minimum(r, 0xff), Platform::Minimum(g, 0xff), Platform::Minimum(b, 0xff)); -} - -// This is mostly copied from the Paint method but with some things omitted -// such as the margin markers, line numbers, selection and caret -// Should be merged back into a combined Draw method. -long Editor::FormatRange(bool draw, RangeToFormat *pfr) { - if (!pfr) - return 0; - - AutoSurface surface(pfr->hdc, this); - if (!surface) - return 0; - AutoSurface surfaceMeasure(pfr->hdcTarget, this); - if (!surfaceMeasure) { - return 0; - } - - // Can't use measurements cached for screen - posCache.Clear(); - - ViewStyle vsPrint(vs); - - // Modify the view style for printing as do not normally want any of the transient features to be printed - // Printing supports only the line number margin. - int lineNumberIndex = -1; - for (int margin = 0; margin < ViewStyle::margins; margin++) { - if ((vsPrint.ms[margin].style == SC_MARGIN_NUMBER) && (vsPrint.ms[margin].width > 0)) { - lineNumberIndex = margin; - } else { - vsPrint.ms[margin].width = 0; - } - } - vsPrint.showMarkedLines = false; - vsPrint.fixedColumnWidth = 0; - vsPrint.zoomLevel = printMagnification; - vsPrint.viewIndentationGuides = ivNone; - // Don't show the selection when printing - vsPrint.selbackset = false; - vsPrint.selforeset = false; - vsPrint.selAlpha = SC_ALPHA_NOALPHA; - vsPrint.whitespaceBackgroundSet = false; - vsPrint.whitespaceForegroundSet = false; - vsPrint.showCaretLineBackground = false; - - // Set colours for printing according to users settings - for (size_t sty = 0;sty < vsPrint.stylesSize;sty++) { - if (printColourMode == SC_PRINT_INVERTLIGHT) { - vsPrint.styles[sty].fore.desired = InvertedLight(vsPrint.styles[sty].fore.desired); - vsPrint.styles[sty].back.desired = InvertedLight(vsPrint.styles[sty].back.desired); - } else if (printColourMode == SC_PRINT_BLACKONWHITE) { - vsPrint.styles[sty].fore.desired = ColourDesired(0, 0, 0); - vsPrint.styles[sty].back.desired = ColourDesired(0xff, 0xff, 0xff); - } else if (printColourMode == SC_PRINT_COLOURONWHITE) { - vsPrint.styles[sty].back.desired = ColourDesired(0xff, 0xff, 0xff); - } else if (printColourMode == SC_PRINT_COLOURONWHITEDEFAULTBG) { - if (sty <= STYLE_DEFAULT) { - vsPrint.styles[sty].back.desired = ColourDesired(0xff, 0xff, 0xff); - } - } - } - // White background for the line numbers - vsPrint.styles[STYLE_LINENUMBER].back.desired = ColourDesired(0xff, 0xff, 0xff); - - vsPrint.Refresh(*surfaceMeasure); - // Determining width must hapen after fonts have been realised in Refresh - int lineNumberWidth = 0; - if (lineNumberIndex >= 0) { - lineNumberWidth = surfaceMeasure->WidthText(vsPrint.styles[STYLE_LINENUMBER].font, - "99999" lineNumberPrintSpace, 5 + istrlen(lineNumberPrintSpace)); - vsPrint.ms[lineNumberIndex].width = lineNumberWidth; - vsPrint.Refresh(*surfaceMeasure); // Recalculate fixedColumnWidth - } - // Ensure colours are set up - vsPrint.RefreshColourPalette(palette, true); - vsPrint.RefreshColourPalette(palette, false); - - int linePrintStart = pdoc->LineFromPosition(pfr->chrg.cpMin); - int linePrintLast = linePrintStart + (pfr->rc.bottom - pfr->rc.top) / vsPrint.lineHeight - 1; - if (linePrintLast < linePrintStart) - linePrintLast = linePrintStart; - int linePrintMax = pdoc->LineFromPosition(pfr->chrg.cpMax); - if (linePrintLast > linePrintMax) - linePrintLast = linePrintMax; - //Platform::DebugPrintf("Formatting lines=[%0d,%0d,%0d] top=%0d bottom=%0d line=%0d %0d\n", - // linePrintStart, linePrintLast, linePrintMax, pfr->rc.top, pfr->rc.bottom, vsPrint.lineHeight, - // surfaceMeasure->Height(vsPrint.styles[STYLE_LINENUMBER].font)); - int endPosPrint = pdoc->Length(); - if (linePrintLast < pdoc->LinesTotal()) - endPosPrint = pdoc->LineStart(linePrintLast + 1); - - // Ensure we are styled to where we are formatting. - pdoc->EnsureStyledTo(endPosPrint); - - int xStart = vsPrint.fixedColumnWidth + pfr->rc.left; - int ypos = pfr->rc.top; - - int lineDoc = linePrintStart; - - int nPrintPos = pfr->chrg.cpMin; - int visibleLine = 0; - int widthPrint = pfr->rc.Width() - vsPrint.fixedColumnWidth; - if (printWrapState == eWrapNone) - widthPrint = LineLayout::wrapWidthInfinite; - - while (lineDoc <= linePrintLast && ypos < pfr->rc.bottom) { - - // When printing, the hdc and hdcTarget may be the same, so - // changing the state of surfaceMeasure may change the underlying - // state of surface. Therefore, any cached state is discarded before - // using each surface. - surfaceMeasure->FlushCachedState(); - - // Copy this line and its styles from the document into local arrays - // and determine the x position at which each character starts. - LineLayout ll(8000); - LayoutLine(lineDoc, surfaceMeasure, vsPrint, &ll, widthPrint); - - ll.selStart = -1; - ll.selEnd = -1; - ll.containsCaret = false; - - PRectangle rcLine; - rcLine.left = pfr->rc.left; - rcLine.top = ypos; - rcLine.right = pfr->rc.right - 1; - rcLine.bottom = ypos + vsPrint.lineHeight; - - // When document line is wrapped over multiple display lines, find where - // to start printing from to ensure a particular position is on the first - // line of the page. - if (visibleLine == 0) { - int startWithinLine = nPrintPos - pdoc->LineStart(lineDoc); - for (int iwl = 0; iwl < ll.lines - 1; iwl++) { - if (ll.LineStart(iwl) <= startWithinLine && ll.LineStart(iwl + 1) >= startWithinLine) { - visibleLine = -iwl; - } - } - - if (ll.lines > 1 && startWithinLine >= ll.LineStart(ll.lines - 1)) { - visibleLine = -(ll.lines - 1); - } - } - - if (draw && lineNumberWidth && - (ypos + vsPrint.lineHeight <= pfr->rc.bottom) && - (visibleLine >= 0)) { - char number[100]; - sprintf(number, "%d" lineNumberPrintSpace, lineDoc + 1); - PRectangle rcNumber = rcLine; - rcNumber.right = rcNumber.left + lineNumberWidth; - // Right justify - rcNumber.left = rcNumber.right - surfaceMeasure->WidthText( - vsPrint.styles[STYLE_LINENUMBER].font, number, istrlen(number)); - surface->FlushCachedState(); - surface->DrawTextNoClip(rcNumber, vsPrint.styles[STYLE_LINENUMBER].font, - ypos + vsPrint.maxAscent, number, istrlen(number), - vsPrint.styles[STYLE_LINENUMBER].fore.allocated, - vsPrint.styles[STYLE_LINENUMBER].back.allocated); - } - - // Draw the line - surface->FlushCachedState(); - - for (int iwl = 0; iwl < ll.lines; iwl++) { - if (ypos + vsPrint.lineHeight <= pfr->rc.bottom) { - if (visibleLine >= 0) { - if (draw) { - rcLine.top = ypos; - rcLine.bottom = ypos + vsPrint.lineHeight; - DrawLine(surface, vsPrint, lineDoc, visibleLine, xStart, rcLine, &ll, iwl); - } - ypos += vsPrint.lineHeight; - } - visibleLine++; - if (iwl == ll.lines - 1) - nPrintPos = pdoc->LineStart(lineDoc + 1); - else - nPrintPos += ll.LineStart(iwl + 1) - ll.LineStart(iwl); - } - } - - ++lineDoc; - } - - // Clear cache so measurements are not used for screen - posCache.Clear(); - - return nPrintPos; -} - -int Editor::TextWidth(int style, const char *text) { - RefreshStyleData(); - AutoSurface surface(this); - if (surface) { - return surface->WidthText(vs.styles[style].font, text, istrlen(text)); - } else { - return 1; - } -} - -// Empty method is overridden on GTK+ to show / hide scrollbars -void Editor::ReconfigureScrollBars() {} - -void Editor::SetScrollBars() { - RefreshStyleData(); - - int nMax = MaxScrollPos(); - int nPage = LinesOnScreen(); - bool modified = ModifyScrollBars(nMax + nPage - 1, nPage); - if (modified) { - DwellEnd(true); - } - - // TODO: ensure always showing as many lines as possible - // May not be, if, for example, window made larger - if (topLine > MaxScrollPos()) { - SetTopLine(Platform::Clamp(topLine, 0, MaxScrollPos())); - SetVerticalScrollPos(); - Redraw(); - } - if (modified) { - if (!AbandonPaint()) - Redraw(); - } - //Platform::DebugPrintf("end max = %d page = %d\n", nMax, nPage); -} - -void Editor::ChangeSize() { - DropGraphics(); - SetScrollBars(); - if (wrapState != eWrapNone) { - PRectangle rcTextArea = GetClientRectangle(); - rcTextArea.left = vs.fixedColumnWidth; - rcTextArea.right -= vs.rightMarginWidth; - if (wrapWidth != rcTextArea.Width()) { - NeedWrapping(); - Redraw(); - } - } -} - -void Editor::AddChar(char ch) { - char s[2]; - s[0] = ch; - s[1] = '\0'; - AddCharUTF(s, 1); -} - -// AddCharUTF inserts an array of bytes which may or may not be in UTF-8. -void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) { - bool wasSelection = currentPos != anchor; - ClearSelection(); - bool charReplaceAction = false; - if (inOverstrike && !wasSelection && !RangeContainsProtected(currentPos, currentPos + 1)) { - if (currentPos < (pdoc->Length())) { - if (!IsEOLChar(pdoc->CharAt(currentPos))) { - charReplaceAction = true; - pdoc->BeginUndoAction(); - pdoc->DelChar(currentPos); - } - } - } - if (pdoc->InsertString(currentPos, s, len)) { - SetEmptySelection(currentPos + len); - } - if (charReplaceAction) { - pdoc->EndUndoAction(); - } - // If in wrap mode rewrap current line so EnsureCaretVisible has accurate information - if (wrapState != eWrapNone) { - AutoSurface surface(this); - if (surface) { - WrapOneLine(surface, pdoc->LineFromPosition(currentPos)); - } - SetScrollBars(); - } - EnsureCaretVisible(); - // Avoid blinking during rapid typing: - ShowCaretAtCurrentPosition(); - if (!caretSticky) { - SetLastXChosen(); - } - - if (treatAsDBCS) { - NotifyChar((static_cast(s[0]) << 8) | - static_cast(s[1])); - } else { - int byte = static_cast(s[0]); - if ((byte < 0xC0) || (1 == len)) { - // Handles UTF-8 characters between 0x01 and 0x7F and single byte - // characters when not in UTF-8 mode. - // Also treats \0 and naked trail bytes 0x80 to 0xBF as valid - // characters representing themselves. - } else { - // Unroll 1 to 3 byte UTF-8 sequences. See reference data at: - // http://www.cl.cam.ac.uk/~mgk25/unicode.html - // http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt - if (byte < 0xE0) { - int byte2 = static_cast(s[1]); - if ((byte2 & 0xC0) == 0x80) { - // Two-byte-character lead-byte followed by a trail-byte. - byte = (((byte & 0x1F) << 6) | (byte2 & 0x3F)); - } - // A two-byte-character lead-byte not followed by trail-byte - // represents itself. - } else if (byte < 0xF0) { - int byte2 = static_cast(s[1]); - int byte3 = static_cast(s[2]); - if (((byte2 & 0xC0) == 0x80) && ((byte3 & 0xC0) == 0x80)) { - // Three-byte-character lead byte followed by two trail bytes. - byte = (((byte & 0x0F) << 12) | ((byte2 & 0x3F) << 6) | - (byte3 & 0x3F)); - } - // A three-byte-character lead-byte not followed by two trail-bytes - // represents itself. - } - } - NotifyChar(byte); - } -} - -void Editor::ClearSelection() { - if (!SelectionContainsProtected()) { - int startPos = SelectionStart(); - if (selType == selStream) { - unsigned int chars = SelectionEnd() - startPos; - if (0 != chars) { - pdoc->BeginUndoAction(); - pdoc->DeleteChars(startPos, chars); - pdoc->EndUndoAction(); - } - } else { - pdoc->BeginUndoAction(); - SelectionLineIterator lineIterator(this, false); - while (lineIterator.Iterate()) { - startPos = lineIterator.startPos; - unsigned int chars = lineIterator.endPos - startPos; - if (0 != chars) { - pdoc->DeleteChars(startPos, chars); - } - } - pdoc->EndUndoAction(); - selType = selStream; - } - SetEmptySelection(startPos); - } -} - -void Editor::ClearAll() { - pdoc->BeginUndoAction(); - if (0 != pdoc->Length()) { - pdoc->DeleteChars(0, pdoc->Length()); - } - if (!pdoc->IsReadOnly()) { - cs.Clear(); - } - pdoc->EndUndoAction(); - anchor = 0; - currentPos = 0; - SetTopLine(0); - SetVerticalScrollPos(); - InvalidateStyleRedraw(); -} - -void Editor::ClearDocumentStyle() { - pdoc->StartStyling(0, '\377'); - pdoc->SetStyleFor(pdoc->Length(), 0); - cs.ShowAll(); - pdoc->ClearLevels(); -} - -void Editor::CopyAllowLine() { - SelectionText selectedText; - CopySelectionRange(&selectedText, true); - CopyToClipboard(selectedText); -} - -void Editor::Cut() { - pdoc->CheckReadOnly(); - if (!pdoc->IsReadOnly() && !SelectionContainsProtected()) { - Copy(); - ClearSelection(); - } -} - -void Editor::PasteRectangular(int pos, const char *ptr, int len) { - if (pdoc->IsReadOnly() || SelectionContainsProtected()) { - return; - } - currentPos = pos; - int xInsert = XFromPosition(currentPos); - int line = pdoc->LineFromPosition(currentPos); - bool prevCr = false; - pdoc->BeginUndoAction(); - for (int i = 0; i < len; i++) { - if (IsEOLChar(ptr[i])) { - if ((ptr[i] == '\r') || (!prevCr)) - line++; - if (line >= pdoc->LinesTotal()) { - if (pdoc->eolMode != SC_EOL_LF) - pdoc->InsertChar(pdoc->Length(), '\r'); - if (pdoc->eolMode != SC_EOL_CR) - pdoc->InsertChar(pdoc->Length(), '\n'); - } - // Pad the end of lines with spaces if required - currentPos = PositionFromLineX(line, xInsert); - if ((XFromPosition(currentPos) < xInsert) && (i + 1 < len)) { - for (int i = 0; i < xInsert - XFromPosition(currentPos); i++) { - pdoc->InsertChar(currentPos, ' '); - currentPos++; - } - } - prevCr = ptr[i] == '\r'; - } else { - pdoc->InsertString(currentPos, ptr + i, 1); - currentPos++; - prevCr = false; - } - } - pdoc->EndUndoAction(); - SetEmptySelection(pos); -} - -bool Editor::CanPaste() { - return !pdoc->IsReadOnly() && !SelectionContainsProtected(); -} - -void Editor::Clear() { - if (currentPos == anchor) { - if (!RangeContainsProtected(currentPos, currentPos + 1)) { - DelChar(); - } - } else { - ClearSelection(); - } - SetEmptySelection(currentPos); -} - -void Editor::SelectAll() { - SetSelection(0, pdoc->Length()); - Redraw(); -} - -void Editor::Undo() { - if (pdoc->CanUndo()) { - InvalidateCaret(); - int newPos = pdoc->Undo(); - if (newPos >= 0) - SetEmptySelection(newPos); - EnsureCaretVisible(); - } -} - -void Editor::Redo() { - if (pdoc->CanRedo()) { - int newPos = pdoc->Redo(); - if (newPos >= 0) - SetEmptySelection(newPos); - EnsureCaretVisible(); - } -} - -void Editor::DelChar() { - if (!RangeContainsProtected(currentPos, currentPos + 1)) { - pdoc->DelChar(currentPos); - } - // Avoid blinking during rapid typing: - ShowCaretAtCurrentPosition(); -} - -void Editor::DelCharBack(bool allowLineStartDeletion) { - if (currentPos == anchor) { - if (!RangeContainsProtected(currentPos - 1, currentPos)) { - int lineCurrentPos = pdoc->LineFromPosition(currentPos); - if (allowLineStartDeletion || (pdoc->LineStart(lineCurrentPos) != currentPos)) { - if (pdoc->GetColumn(currentPos) <= pdoc->GetLineIndentation(lineCurrentPos) && - pdoc->GetColumn(currentPos) > 0 && pdoc->backspaceUnindents) { - pdoc->BeginUndoAction(); - int indentation = pdoc->GetLineIndentation(lineCurrentPos); - int indentationStep = pdoc->IndentSize(); - if (indentation % indentationStep == 0) { - pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationStep); - } else { - pdoc->SetLineIndentation(lineCurrentPos, indentation - (indentation % indentationStep)); - } - SetEmptySelection(pdoc->GetLineIndentPosition(lineCurrentPos)); - pdoc->EndUndoAction(); - } else { - pdoc->DelCharBack(currentPos); - } - } - } - } else { - ClearSelection(); - SetEmptySelection(currentPos); - } - // Avoid blinking during rapid typing: - ShowCaretAtCurrentPosition(); -} - -void Editor::NotifyFocus(bool) {} - -void Editor::NotifyStyleToNeeded(int endStyleNeeded) { - SCNotification scn = {0}; - scn.nmhdr.code = SCN_STYLENEEDED; - scn.position = endStyleNeeded; - NotifyParent(scn); -} - -void Editor::NotifyStyleNeeded(Document*, void *, int endStyleNeeded) { - NotifyStyleToNeeded(endStyleNeeded); -} - -void Editor::NotifyChar(int ch) { - SCNotification scn = {0}; - scn.nmhdr.code = SCN_CHARADDED; - scn.ch = ch; - NotifyParent(scn); - if (recordingMacro) { - char txt[2]; - txt[0] = static_cast(ch); - txt[1] = '\0'; - NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast(txt)); - } -} - -void Editor::NotifySavePoint(bool isSavePoint) { - SCNotification scn = {0}; - if (isSavePoint) { - scn.nmhdr.code = SCN_SAVEPOINTREACHED; - } else { - scn.nmhdr.code = SCN_SAVEPOINTLEFT; - } - NotifyParent(scn); -} - -void Editor::NotifyModifyAttempt() { - SCNotification scn = {0}; - scn.nmhdr.code = SCN_MODIFYATTEMPTRO; - NotifyParent(scn); -} - -void Editor::NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt) { - SCNotification scn = {0}; - scn.nmhdr.code = SCN_DOUBLECLICK; - scn.line = LineFromLocation(pt); - scn.position = PositionFromLocationClose(pt); - scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | - (alt ? SCI_ALT : 0); - NotifyParent(scn); -} - -void Editor::NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt) { - SCNotification scn = {0}; - scn.nmhdr.code = SCN_HOTSPOTDOUBLECLICK; - scn.position = position; - scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | - (alt ? SCI_ALT : 0); - NotifyParent(scn); -} - -void Editor::NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt) { - SCNotification scn = {0}; - scn.nmhdr.code = SCN_HOTSPOTCLICK; - scn.position = position; - scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | - (alt ? SCI_ALT : 0); - NotifyParent(scn); -} - -void Editor::NotifyUpdateUI() { - SCNotification scn = {0}; - scn.nmhdr.code = SCN_UPDATEUI; - NotifyParent(scn); -} - -void Editor::NotifyPainted() { - SCNotification scn = {0}; - scn.nmhdr.code = SCN_PAINTED; - NotifyParent(scn); -} - -void Editor::NotifyIndicatorClick(bool click, int position, bool shift, bool ctrl, bool alt) { - int mask = pdoc->decorations.AllOnFor(position); - if ((click && mask) || pdoc->decorations.clickNotified) { - SCNotification scn = {0}; - pdoc->decorations.clickNotified = click; - scn.nmhdr.code = click ? SCN_INDICATORCLICK : SCN_INDICATORRELEASE; - scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | (alt ? SCI_ALT : 0); - scn.position = position; - NotifyParent(scn); - } -} - -bool Editor::NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt) { - int marginClicked = -1; - int x = 0; - for (int margin = 0; margin < ViewStyle::margins; margin++) { - if ((pt.x > x) && (pt.x < x + vs.ms[margin].width)) - marginClicked = margin; - x += vs.ms[margin].width; - } - if ((marginClicked >= 0) && vs.ms[marginClicked].sensitive) { - SCNotification scn = {0}; - scn.nmhdr.code = SCN_MARGINCLICK; - scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | - (alt ? SCI_ALT : 0); - scn.position = pdoc->LineStart(LineFromLocation(pt)); - scn.margin = marginClicked; - NotifyParent(scn); - return true; - } else { - return false; - } -} - -void Editor::NotifyNeedShown(int pos, int len) { - SCNotification scn = {0}; - scn.nmhdr.code = SCN_NEEDSHOWN; - scn.position = pos; - scn.length = len; - NotifyParent(scn); -} - -void Editor::NotifyDwelling(Point pt, bool state) { - SCNotification scn = {0}; - scn.nmhdr.code = state ? SCN_DWELLSTART : SCN_DWELLEND; - scn.position = PositionFromLocationClose(pt); - scn.x = pt.x; - scn.y = pt.y; - NotifyParent(scn); -} - -void Editor::NotifyZoom() { - SCNotification scn = {0}; - scn.nmhdr.code = SCN_ZOOM; - NotifyParent(scn); -} - -// Notifications from document -void Editor::NotifyModifyAttempt(Document*, void *) { - //Platform::DebugPrintf("** Modify Attempt\n"); - NotifyModifyAttempt(); -} - -void Editor::NotifyMove(int position) { - SCNotification scn = {0}; - scn.nmhdr.code = SCN_POSCHANGED; - scn.position = position; - NotifyParent(scn); -} - -void Editor::NotifySavePoint(Document*, void *, bool atSavePoint) { - //Platform::DebugPrintf("** Save Point %s\n", atSavePoint ? "On" : "Off"); - NotifySavePoint(atSavePoint); -} - -void Editor::CheckModificationForWrap(DocModification mh) { - if (mh.modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) { - llc.Invalidate(LineLayout::llCheckTextAndStyle); - if (wrapState != eWrapNone) { - int lineDoc = pdoc->LineFromPosition(mh.position); - int lines = Platform::Maximum(0, mh.linesAdded); - NeedWrapping(lineDoc, lineDoc + lines + 1); - } - } -} - -// Move a position so it is still after the same character as before the insertion. -static inline int MovePositionForInsertion(int position, int startInsertion, int length) { - if (position > startInsertion) { - return position + length; - } - return position; -} - -// Move a position so it is still after the same character as before the deletion if that -// character is still present else after the previous surviving character. -static inline int MovePositionForDeletion(int position, int startDeletion, int length) { - if (position > startDeletion) { - int endDeletion = startDeletion + length; - if (position > endDeletion) { - return position - length; - } else { - return startDeletion; - } - } else { - return position; - } -} - -void Editor::NotifyModified(Document*, DocModification mh, void *) { - needUpdateUI = true; - if (paintState == painting) { - CheckForChangeOutsidePaint(Range(mh.position, mh.position + mh.length)); - } - if (mh.modificationType & SC_MOD_CHANGELINESTATE) { - if (paintState == painting) { - CheckForChangeOutsidePaint( - Range(pdoc->LineStart(mh.line), pdoc->LineStart(mh.line + 1))); - } else { - // Could check that change is before last visible line. - Redraw(); - } - } - if (mh.modificationType & (SC_MOD_CHANGESTYLE | SC_MOD_CHANGEINDICATOR)) { - if (mh.modificationType & SC_MOD_CHANGESTYLE) { - pdoc->IncrementStyleClock(); - } - if (paintState == notPainting) { - if (mh.position < pdoc->LineStart(topLine)) { - // Styling performed before this view - Redraw(); - } else { - InvalidateRange(mh.position, mh.position + mh.length); - } - } - if (mh.modificationType & SC_MOD_CHANGESTYLE) { - llc.Invalidate(LineLayout::llCheckTextAndStyle); - } - } else { - // Move selection and brace highlights - if (mh.modificationType & SC_MOD_INSERTTEXT) { - currentPos = MovePositionForInsertion(currentPos, mh.position, mh.length); - anchor = MovePositionForInsertion(anchor, mh.position, mh.length); - braces[0] = MovePositionForInsertion(braces[0], mh.position, mh.length); - braces[1] = MovePositionForInsertion(braces[1], mh.position, mh.length); - } else if (mh.modificationType & SC_MOD_DELETETEXT) { - currentPos = MovePositionForDeletion(currentPos, mh.position, mh.length); - anchor = MovePositionForDeletion(anchor, mh.position, mh.length); - braces[0] = MovePositionForDeletion(braces[0], mh.position, mh.length); - braces[1] = MovePositionForDeletion(braces[1], mh.position, mh.length); - } - if (cs.LinesDisplayed() < cs.LinesInDoc()) { - // Some lines are hidden so may need shown. - // TODO: check if the modified area is hidden. - if (mh.modificationType & SC_MOD_BEFOREINSERT) { - NotifyNeedShown(mh.position, 0); - } else if (mh.modificationType & SC_MOD_BEFOREDELETE) { - NotifyNeedShown(mh.position, mh.length); - } - } - if (mh.linesAdded != 0) { - // Update contraction state for inserted and removed lines - // lineOfPos should be calculated in context of state before modification, shouldn't it - int lineOfPos = pdoc->LineFromPosition(mh.position); - if (mh.linesAdded > 0) { - cs.InsertLines(lineOfPos, mh.linesAdded); - } else { - cs.DeleteLines(lineOfPos, -mh.linesAdded); - } - } - CheckModificationForWrap(mh); - if (mh.linesAdded != 0) { - // Avoid scrolling of display if change before current display - if (mh.position < posTopLine && !CanDeferToLastStep(mh)) { - int newTop = Platform::Clamp(topLine + mh.linesAdded, 0, MaxScrollPos()); - if (newTop != topLine) { - SetTopLine(newTop); - SetVerticalScrollPos(); - } - } - - //Platform::DebugPrintf("** %x Doc Changed\n", this); - // TODO: could invalidate from mh.startModification to end of screen - //InvalidateRange(mh.position, mh.position + mh.length); - if (paintState == notPainting && !CanDeferToLastStep(mh)) { - Redraw(); - } - } else { - //Platform::DebugPrintf("** %x Line Changed %d .. %d\n", this, - // mh.position, mh.position + mh.length); - if (paintState == notPainting && mh.length && !CanEliminate(mh)) { - InvalidateRange(mh.position, mh.position + mh.length); - } - } - } - - if (mh.linesAdded != 0 && !CanDeferToLastStep(mh)) { - SetScrollBars(); - } - - if (mh.modificationType & SC_MOD_CHANGEMARKER) { - if ((paintState == notPainting) || !PaintContainsMargin()) { - if (mh.modificationType & SC_MOD_CHANGEFOLD) { - // Fold changes can affect the drawing of following lines so redraw whole margin - RedrawSelMargin(); - } else { - RedrawSelMargin(mh.line); - } - } - } - - // NOW pay the piper WRT "deferred" visual updates - if (IsLastStep(mh)) { - SetScrollBars(); - Redraw(); - } - - // If client wants to see this modification - if (mh.modificationType & modEventMask) { - if ((mh.modificationType & (SC_MOD_CHANGESTYLE | SC_MOD_CHANGEINDICATOR)) == 0) { - // Real modification made to text of document. - NotifyChange(); // Send EN_CHANGE - } - - SCNotification scn = {0}; - scn.nmhdr.code = SCN_MODIFIED; - scn.position = mh.position; - scn.modificationType = mh.modificationType; - scn.text = mh.text; - scn.length = mh.length; - scn.linesAdded = mh.linesAdded; - scn.line = mh.line; - scn.foldLevelNow = mh.foldLevelNow; - scn.foldLevelPrev = mh.foldLevelPrev; - NotifyParent(scn); - } -} - -void Editor::NotifyDeleted(Document *, void *) { - /* Do nothing */ -} - -void Editor::NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { - - // Enumerates all macroable messages - switch (iMessage) { - case SCI_CUT: - case SCI_COPY: - case SCI_PASTE: - case SCI_CLEAR: - case SCI_REPLACESEL: - case SCI_ADDTEXT: - case SCI_INSERTTEXT: - case SCI_APPENDTEXT: - case SCI_CLEARALL: - case SCI_SELECTALL: - case SCI_GOTOLINE: - case SCI_GOTOPOS: - case SCI_SEARCHANCHOR: - case SCI_SEARCHNEXT: - case SCI_SEARCHPREV: - case SCI_LINEDOWN: - case SCI_LINEDOWNEXTEND: - case SCI_PARADOWN: - case SCI_PARADOWNEXTEND: - case SCI_LINEUP: - case SCI_LINEUPEXTEND: - case SCI_PARAUP: - case SCI_PARAUPEXTEND: - case SCI_CHARLEFT: - case SCI_CHARLEFTEXTEND: - case SCI_CHARRIGHT: - case SCI_CHARRIGHTEXTEND: - case SCI_WORDLEFT: - case SCI_WORDLEFTEXTEND: - case SCI_WORDRIGHT: - case SCI_WORDRIGHTEXTEND: - case SCI_WORDPARTLEFT: - case SCI_WORDPARTLEFTEXTEND: - case SCI_WORDPARTRIGHT: - case SCI_WORDPARTRIGHTEXTEND: - case SCI_WORDLEFTEND: - case SCI_WORDLEFTENDEXTEND: - case SCI_WORDRIGHTEND: - case SCI_WORDRIGHTENDEXTEND: - case SCI_HOME: - case SCI_HOMEEXTEND: - case SCI_LINEEND: - case SCI_LINEENDEXTEND: - case SCI_HOMEWRAP: - case SCI_HOMEWRAPEXTEND: - case SCI_LINEENDWRAP: - case SCI_LINEENDWRAPEXTEND: - case SCI_DOCUMENTSTART: - case SCI_DOCUMENTSTARTEXTEND: - case SCI_DOCUMENTEND: - case SCI_DOCUMENTENDEXTEND: - case SCI_STUTTEREDPAGEUP: - case SCI_STUTTEREDPAGEUPEXTEND: - case SCI_STUTTEREDPAGEDOWN: - case SCI_STUTTEREDPAGEDOWNEXTEND: - case SCI_PAGEUP: - case SCI_PAGEUPEXTEND: - case SCI_PAGEDOWN: - case SCI_PAGEDOWNEXTEND: - case SCI_EDITTOGGLEOVERTYPE: - case SCI_CANCEL: - case SCI_DELETEBACK: - case SCI_TAB: - case SCI_BACKTAB: - case SCI_FORMFEED: - case SCI_VCHOME: - case SCI_VCHOMEEXTEND: - case SCI_VCHOMEWRAP: - case SCI_VCHOMEWRAPEXTEND: - case SCI_DELWORDLEFT: - case SCI_DELWORDRIGHT: - case SCI_DELWORDRIGHTEND: - case SCI_DELLINELEFT: - case SCI_DELLINERIGHT: - case SCI_LINECOPY: - case SCI_LINECUT: - case SCI_LINEDELETE: - case SCI_LINETRANSPOSE: - case SCI_LINEDUPLICATE: - case SCI_LOWERCASE: - case SCI_UPPERCASE: - case SCI_LINESCROLLDOWN: - case SCI_LINESCROLLUP: - case SCI_DELETEBACKNOTLINE: - case SCI_HOMEDISPLAY: - case SCI_HOMEDISPLAYEXTEND: - case SCI_LINEENDDISPLAY: - case SCI_LINEENDDISPLAYEXTEND: - case SCI_SETSELECTIONMODE: - case SCI_LINEDOWNRECTEXTEND: - case SCI_LINEUPRECTEXTEND: - case SCI_CHARLEFTRECTEXTEND: - case SCI_CHARRIGHTRECTEXTEND: - case SCI_HOMERECTEXTEND: - case SCI_VCHOMERECTEXTEND: - case SCI_LINEENDRECTEXTEND: - case SCI_PAGEUPRECTEXTEND: - case SCI_PAGEDOWNRECTEXTEND: - case SCI_SELECTIONDUPLICATE: - case SCI_COPYALLOWLINE: - break; - - // Filter out all others like display changes. Also, newlines are redundant - // with char insert messages. - case SCI_NEWLINE: - default: - // printf("Filtered out %ld of macro recording\n", iMessage); - return ; - } - - // Send notification - SCNotification scn = {0}; - scn.nmhdr.code = SCN_MACRORECORD; - scn.message = iMessage; - scn.wParam = wParam; - scn.lParam = lParam; - NotifyParent(scn); -} - -/** - * Force scroll and keep position relative to top of window. - * - * If stuttered = true and not already at first/last row, move to first/last row of window. - * If stuttered = true and already at first/last row, scroll as normal. - */ -void Editor::PageMove(int direction, selTypes sel, bool stuttered) { - int topLineNew, newPos; - - // I consider only the caretYSlop, and ignore the caretYPolicy-- is that a problem? - int currentLine = pdoc->LineFromPosition(currentPos); - int topStutterLine = topLine + caretYSlop; - int bottomStutterLine = - pdoc->LineFromPosition(PositionFromLocation( - Point(lastXChosen, direction * vs.lineHeight * LinesToScroll()))) - - caretYSlop - 1; - - if (stuttered && (direction < 0 && currentLine > topStutterLine)) { - topLineNew = topLine; - newPos = PositionFromLocation(Point(lastXChosen, vs.lineHeight * caretYSlop)); - - } else if (stuttered && (direction > 0 && currentLine < bottomStutterLine)) { - topLineNew = topLine; - newPos = PositionFromLocation(Point(lastXChosen, vs.lineHeight * (LinesToScroll() - caretYSlop))); - - } else { - Point pt = LocationFromPosition(currentPos); - - topLineNew = Platform::Clamp( - topLine + direction * LinesToScroll(), 0, MaxScrollPos()); - newPos = PositionFromLocation( - Point(lastXChosen, pt.y + direction * (vs.lineHeight * LinesToScroll()))); - } - - if (topLineNew != topLine) { - SetTopLine(topLineNew); - MovePositionTo(newPos, sel); - Redraw(); - SetVerticalScrollPos(); - } else { - MovePositionTo(newPos, sel); - } -} - -void Editor::ChangeCaseOfSelection(bool makeUpperCase) { - pdoc->BeginUndoAction(); - int startCurrent = currentPos; - int startAnchor = anchor; - if (selType == selStream) { - pdoc->ChangeCase(Range(SelectionStart(), SelectionEnd()), - makeUpperCase); - SetSelection(startCurrent, startAnchor); - } else { - SelectionLineIterator lineIterator(this, false); - while (lineIterator.Iterate()) { - pdoc->ChangeCase( - Range(lineIterator.startPos, lineIterator.endPos), - makeUpperCase); - } - // Would be nicer to keep the rectangular selection but this is complex - SetEmptySelection(startCurrent); - } - pdoc->EndUndoAction(); -} - -void Editor::LineTranspose() { - int line = pdoc->LineFromPosition(currentPos); - if (line > 0) { - pdoc->BeginUndoAction(); - int startPrev = pdoc->LineStart(line - 1); - int endPrev = pdoc->LineEnd(line - 1); - int start = pdoc->LineStart(line); - int end = pdoc->LineEnd(line); - char *line1 = CopyRange(startPrev, endPrev); - int len1 = endPrev - startPrev; - char *line2 = CopyRange(start, end); - int len2 = end - start; - pdoc->DeleteChars(start, len2); - pdoc->DeleteChars(startPrev, len1); - pdoc->InsertString(startPrev, line2, len2); - pdoc->InsertString(start - len1 + len2, line1, len1); - MovePositionTo(start - len1 + len2); - delete []line1; - delete []line2; - pdoc->EndUndoAction(); - } -} - -void Editor::Duplicate(bool forLine) { - int start = SelectionStart(); - int end = SelectionEnd(); - if (start == end) { - forLine = true; - } - if (forLine) { - int line = pdoc->LineFromPosition(currentPos); - start = pdoc->LineStart(line); - end = pdoc->LineEnd(line); - } - char *text = CopyRange(start, end); - if (forLine) { - const char *eol = StringFromEOLMode(pdoc->eolMode); - pdoc->InsertCString(end, eol); - pdoc->InsertString(end + istrlen(eol), text, end - start); - } else { - pdoc->InsertString(end, text, end - start); - } - delete []text; -} - -void Editor::CancelModes() { - moveExtendsSelection = false; -} - -void Editor::NewLine() { - ClearSelection(); - const char *eol = "\n"; - if (pdoc->eolMode == SC_EOL_CRLF) { - eol = "\r\n"; - } else if (pdoc->eolMode == SC_EOL_CR) { - eol = "\r"; - } // else SC_EOL_LF -> "\n" already set - if (pdoc->InsertCString(currentPos, eol)) { - SetEmptySelection(currentPos + istrlen(eol)); - while (*eol) { - NotifyChar(*eol); - eol++; - } - } - SetLastXChosen(); - SetScrollBars(); - EnsureCaretVisible(); - // Avoid blinking during rapid typing: - ShowCaretAtCurrentPosition(); -} - -void Editor::CursorUpOrDown(int direction, selTypes sel) { - Point pt = LocationFromPosition(currentPos); - int posNew = PositionFromLocation( - Point(lastXChosen, pt.y + direction * vs.lineHeight)); - if (direction < 0) { - // Line wrapping may lead to a location on the same line, so - // seek back if that is the case. - // There is an equivalent case when moving down which skips - // over a line but as that does not trap the user it is fine. - Point ptNew = LocationFromPosition(posNew); - while ((posNew > 0) && (pt.y == ptNew.y)) { - posNew--; - ptNew = LocationFromPosition(posNew); - } - } - MovePositionTo(posNew, sel); -} - -void Editor::ParaUpOrDown(int direction, selTypes sel) { - int lineDoc, savedPos = currentPos; - do { - MovePositionTo(direction > 0 ? pdoc->ParaDown(currentPos) : pdoc->ParaUp(currentPos), sel); - lineDoc = pdoc->LineFromPosition(currentPos); - if (direction > 0) { - if (currentPos >= pdoc->Length() && !cs.GetVisible(lineDoc)) { - if (sel == noSel) { - MovePositionTo(pdoc->LineEndPosition(savedPos)); - } - break; - } - } - } while (!cs.GetVisible(lineDoc)); -} - -int Editor::StartEndDisplayLine(int pos, bool start) { - RefreshStyleData(); - int line = pdoc->LineFromPosition(pos); - AutoSurface surface(this); - AutoLineLayout ll(llc, RetrieveLineLayout(line)); - int posRet = INVALID_POSITION; - if (surface && ll) { - unsigned int posLineStart = pdoc->LineStart(line); - LayoutLine(line, surface, vs, ll, wrapWidth); - int posInLine = pos - posLineStart; - if (posInLine <= ll->maxLineLength) { - for (int subLine = 0; subLine < ll->lines; subLine++) { - if ((posInLine >= ll->LineStart(subLine)) && (posInLine <= ll->LineStart(subLine + 1))) { - if (start) { - posRet = ll->LineStart(subLine) + posLineStart; - } else { - if (subLine == ll->lines - 1) - posRet = ll->LineStart(subLine + 1) + posLineStart; - else - posRet = ll->LineStart(subLine + 1) + posLineStart - 1; - } - } - } - } - } - if (posRet == INVALID_POSITION) { - return pos; - } else { - return posRet; - } -} - -int Editor::KeyCommand(unsigned int iMessage) { - switch (iMessage) { - case SCI_LINEDOWN: - CursorUpOrDown(1); - break; - case SCI_LINEDOWNEXTEND: - CursorUpOrDown(1, selStream); - break; - case SCI_LINEDOWNRECTEXTEND: - CursorUpOrDown(1, selRectangle); - break; - case SCI_PARADOWN: - ParaUpOrDown(1); - break; - case SCI_PARADOWNEXTEND: - ParaUpOrDown(1, selStream); - break; - case SCI_LINESCROLLDOWN: - ScrollTo(topLine + 1); - MoveCaretInsideView(false); - break; - case SCI_LINEUP: - CursorUpOrDown(-1); - break; - case SCI_LINEUPEXTEND: - CursorUpOrDown(-1, selStream); - break; - case SCI_LINEUPRECTEXTEND: - CursorUpOrDown(-1, selRectangle); - break; - case SCI_PARAUP: - ParaUpOrDown(-1); - break; - case SCI_PARAUPEXTEND: - ParaUpOrDown(-1, selStream); - break; - case SCI_LINESCROLLUP: - ScrollTo(topLine - 1); - MoveCaretInsideView(false); - break; - case SCI_CHARLEFT: - if (SelectionEmpty() || moveExtendsSelection) { - MovePositionTo(MovePositionSoVisible(currentPos - 1, -1)); - } else { - MovePositionTo(SelectionStart()); - } - SetLastXChosen(); - break; - case SCI_CHARLEFTEXTEND: - MovePositionTo(MovePositionSoVisible(currentPos - 1, -1), selStream); - SetLastXChosen(); - break; - case SCI_CHARLEFTRECTEXTEND: - MovePositionTo(MovePositionSoVisible(currentPos - 1, -1), selRectangle); - SetLastXChosen(); - break; - case SCI_CHARRIGHT: - if (SelectionEmpty() || moveExtendsSelection) { - MovePositionTo(MovePositionSoVisible(currentPos + 1, 1)); - } else { - MovePositionTo(SelectionEnd()); - } - SetLastXChosen(); - break; - case SCI_CHARRIGHTEXTEND: - MovePositionTo(MovePositionSoVisible(currentPos + 1, 1), selStream); - SetLastXChosen(); - break; - case SCI_CHARRIGHTRECTEXTEND: - MovePositionTo(MovePositionSoVisible(currentPos + 1, 1), selRectangle); - SetLastXChosen(); - break; - case SCI_WORDLEFT: - MovePositionTo(MovePositionSoVisible(pdoc->NextWordStart(currentPos, -1), -1)); - SetLastXChosen(); - break; - case SCI_WORDLEFTEXTEND: - MovePositionTo(MovePositionSoVisible(pdoc->NextWordStart(currentPos, -1), -1), selStream); - SetLastXChosen(); - break; - case SCI_WORDRIGHT: - MovePositionTo(MovePositionSoVisible(pdoc->NextWordStart(currentPos, 1), 1)); - SetLastXChosen(); - break; - case SCI_WORDRIGHTEXTEND: - MovePositionTo(MovePositionSoVisible(pdoc->NextWordStart(currentPos, 1), 1), selStream); - SetLastXChosen(); - break; - - case SCI_WORDLEFTEND: - MovePositionTo(MovePositionSoVisible(pdoc->NextWordEnd(currentPos, -1), -1)); - SetLastXChosen(); - break; - case SCI_WORDLEFTENDEXTEND: - MovePositionTo(MovePositionSoVisible(pdoc->NextWordEnd(currentPos, -1), -1), selStream); - SetLastXChosen(); - break; - case SCI_WORDRIGHTEND: - MovePositionTo(MovePositionSoVisible(pdoc->NextWordEnd(currentPos, 1), 1)); - SetLastXChosen(); - break; - case SCI_WORDRIGHTENDEXTEND: - MovePositionTo(MovePositionSoVisible(pdoc->NextWordEnd(currentPos, 1), 1), selStream); - SetLastXChosen(); - break; - - case SCI_HOME: - MovePositionTo(pdoc->LineStart(pdoc->LineFromPosition(currentPos))); - SetLastXChosen(); - break; - case SCI_HOMEEXTEND: - MovePositionTo(pdoc->LineStart(pdoc->LineFromPosition(currentPos)), selStream); - SetLastXChosen(); - break; - case SCI_HOMERECTEXTEND: - MovePositionTo(pdoc->LineStart(pdoc->LineFromPosition(currentPos)), selRectangle); - SetLastXChosen(); - break; - case SCI_LINEEND: - MovePositionTo(pdoc->LineEndPosition(currentPos)); - SetLastXChosen(); - break; - case SCI_LINEENDEXTEND: - MovePositionTo(pdoc->LineEndPosition(currentPos), selStream); - SetLastXChosen(); - break; - case SCI_LINEENDRECTEXTEND: - MovePositionTo(pdoc->LineEndPosition(currentPos), selRectangle); - SetLastXChosen(); - break; - case SCI_HOMEWRAP: { - int homePos = MovePositionSoVisible(StartEndDisplayLine(currentPos, true), -1); - if (currentPos <= homePos) - homePos = pdoc->LineStart(pdoc->LineFromPosition(currentPos)); - MovePositionTo(homePos); - SetLastXChosen(); - } - break; - case SCI_HOMEWRAPEXTEND: { - int homePos = MovePositionSoVisible(StartEndDisplayLine(currentPos, true), -1); - if (currentPos <= homePos) - homePos = pdoc->LineStart(pdoc->LineFromPosition(currentPos)); - MovePositionTo(homePos, selStream); - SetLastXChosen(); - } - break; - case SCI_LINEENDWRAP: { - int endPos = MovePositionSoVisible(StartEndDisplayLine(currentPos, false), 1); - int realEndPos = pdoc->LineEndPosition(currentPos); - if (endPos > realEndPos // if moved past visible EOLs - || currentPos >= endPos) // if at end of display line already - endPos = realEndPos; - MovePositionTo(endPos); - SetLastXChosen(); - } - break; - case SCI_LINEENDWRAPEXTEND: { - int endPos = MovePositionSoVisible(StartEndDisplayLine(currentPos, false), 1); - int realEndPos = pdoc->LineEndPosition(currentPos); - if (endPos > realEndPos // if moved past visible EOLs - || currentPos >= endPos) // if at end of display line already - endPos = realEndPos; - MovePositionTo(endPos, selStream); - SetLastXChosen(); - } - break; - case SCI_DOCUMENTSTART: - MovePositionTo(0); - SetLastXChosen(); - break; - case SCI_DOCUMENTSTARTEXTEND: - MovePositionTo(0, selStream); - SetLastXChosen(); - break; - case SCI_DOCUMENTEND: - MovePositionTo(pdoc->Length()); - SetLastXChosen(); - break; - case SCI_DOCUMENTENDEXTEND: - MovePositionTo(pdoc->Length(), selStream); - SetLastXChosen(); - break; - case SCI_STUTTEREDPAGEUP: - PageMove(-1, noSel, true); - break; - case SCI_STUTTEREDPAGEUPEXTEND: - PageMove(-1, selStream, true); - break; - case SCI_STUTTEREDPAGEDOWN: - PageMove(1, noSel, true); - break; - case SCI_STUTTEREDPAGEDOWNEXTEND: - PageMove(1, selStream, true); - break; - case SCI_PAGEUP: - PageMove(-1); - break; - case SCI_PAGEUPEXTEND: - PageMove(-1, selStream); - break; - case SCI_PAGEUPRECTEXTEND: - PageMove(-1, selRectangle); - break; - case SCI_PAGEDOWN: - PageMove(1); - break; - case SCI_PAGEDOWNEXTEND: - PageMove(1, selStream); - break; - case SCI_PAGEDOWNRECTEXTEND: - PageMove(1, selRectangle); - break; - case SCI_EDITTOGGLEOVERTYPE: - inOverstrike = !inOverstrike; - DropCaret(); - ShowCaretAtCurrentPosition(); - NotifyUpdateUI(); - break; - case SCI_CANCEL: // Cancel any modes - handled in subclass - // Also unselect text - CancelModes(); - break; - case SCI_DELETEBACK: - DelCharBack(true); - if (!caretSticky) { - SetLastXChosen(); - } - EnsureCaretVisible(); - break; - case SCI_DELETEBACKNOTLINE: - DelCharBack(false); - if (!caretSticky) { - SetLastXChosen(); - } - EnsureCaretVisible(); - break; - case SCI_TAB: - Indent(true); - if (!caretSticky) { - SetLastXChosen(); - } - EnsureCaretVisible(); - break; - case SCI_BACKTAB: - Indent(false); - if (!caretSticky) { - SetLastXChosen(); - } - EnsureCaretVisible(); - break; - case SCI_NEWLINE: - NewLine(); - break; - case SCI_FORMFEED: - AddChar('\f'); - break; - case SCI_VCHOME: - MovePositionTo(pdoc->VCHomePosition(currentPos)); - SetLastXChosen(); - break; - case SCI_VCHOMEEXTEND: - MovePositionTo(pdoc->VCHomePosition(currentPos), selStream); - SetLastXChosen(); - break; - case SCI_VCHOMERECTEXTEND: - MovePositionTo(pdoc->VCHomePosition(currentPos), selRectangle); - SetLastXChosen(); - break; - case SCI_VCHOMEWRAP: { - int homePos = pdoc->VCHomePosition(currentPos); - int viewLineStart = MovePositionSoVisible(StartEndDisplayLine(currentPos, true), -1); - if ((viewLineStart < currentPos) && (viewLineStart > homePos)) - homePos = viewLineStart; - - MovePositionTo(homePos); - SetLastXChosen(); - } - break; - case SCI_VCHOMEWRAPEXTEND: { - int homePos = pdoc->VCHomePosition(currentPos); - int viewLineStart = MovePositionSoVisible(StartEndDisplayLine(currentPos, true), -1); - if ((viewLineStart < currentPos) && (viewLineStart > homePos)) - homePos = viewLineStart; - - MovePositionTo(homePos, selStream); - SetLastXChosen(); - } - break; - case SCI_ZOOMIN: - if (vs.zoomLevel < 20) { - vs.zoomLevel++; - InvalidateStyleRedraw(); - NotifyZoom(); - } - break; - case SCI_ZOOMOUT: - if (vs.zoomLevel > -10) { - vs.zoomLevel--; - InvalidateStyleRedraw(); - NotifyZoom(); - } - break; - case SCI_DELWORDLEFT: { - int startWord = pdoc->NextWordStart(currentPos, -1); - pdoc->DeleteChars(startWord, currentPos - startWord); - SetLastXChosen(); - } - break; - case SCI_DELWORDRIGHT: { - int endWord = pdoc->NextWordStart(currentPos, 1); - pdoc->DeleteChars(currentPos, endWord - currentPos); - } - break; - case SCI_DELWORDRIGHTEND: { - int endWord = pdoc->NextWordEnd(currentPos, 1); - pdoc->DeleteChars(currentPos, endWord - currentPos); - } - break; - case SCI_DELLINELEFT: { - int line = pdoc->LineFromPosition(currentPos); - int start = pdoc->LineStart(line); - pdoc->DeleteChars(start, currentPos - start); - SetLastXChosen(); - } - break; - case SCI_DELLINERIGHT: { - int line = pdoc->LineFromPosition(currentPos); - int end = pdoc->LineEnd(line); - pdoc->DeleteChars(currentPos, end - currentPos); - } - break; - case SCI_LINECOPY: { - int lineStart = pdoc->LineFromPosition(SelectionStart()); - int lineEnd = pdoc->LineFromPosition(SelectionEnd()); - CopyRangeToClipboard(pdoc->LineStart(lineStart), - pdoc->LineStart(lineEnd + 1)); - } - break; - case SCI_LINECUT: { - int lineStart = pdoc->LineFromPosition(SelectionStart()); - int lineEnd = pdoc->LineFromPosition(SelectionEnd()); - int start = pdoc->LineStart(lineStart); - int end = pdoc->LineStart(lineEnd + 1); - SetSelection(start, end); - Cut(); - SetLastXChosen(); - } - break; - case SCI_LINEDELETE: { - int line = pdoc->LineFromPosition(currentPos); - int start = pdoc->LineStart(line); - int end = pdoc->LineStart(line + 1); - pdoc->DeleteChars(start, end - start); - } - break; - case SCI_LINETRANSPOSE: - LineTranspose(); - break; - case SCI_LINEDUPLICATE: - Duplicate(true); - break; - case SCI_SELECTIONDUPLICATE: - Duplicate(false); - break; - case SCI_LOWERCASE: - ChangeCaseOfSelection(false); - break; - case SCI_UPPERCASE: - ChangeCaseOfSelection(true); - break; - case SCI_WORDPARTLEFT: - MovePositionTo(MovePositionSoVisible(pdoc->WordPartLeft(currentPos), -1)); - SetLastXChosen(); - break; - case SCI_WORDPARTLEFTEXTEND: - MovePositionTo(MovePositionSoVisible(pdoc->WordPartLeft(currentPos), -1), selStream); - SetLastXChosen(); - break; - case SCI_WORDPARTRIGHT: - MovePositionTo(MovePositionSoVisible(pdoc->WordPartRight(currentPos), 1)); - SetLastXChosen(); - break; - case SCI_WORDPARTRIGHTEXTEND: - MovePositionTo(MovePositionSoVisible(pdoc->WordPartRight(currentPos), 1), selStream); - SetLastXChosen(); - break; - case SCI_HOMEDISPLAY: - MovePositionTo(MovePositionSoVisible( - StartEndDisplayLine(currentPos, true), -1)); - SetLastXChosen(); - break; - case SCI_HOMEDISPLAYEXTEND: - MovePositionTo(MovePositionSoVisible( - StartEndDisplayLine(currentPos, true), -1), selStream); - SetLastXChosen(); - break; - case SCI_LINEENDDISPLAY: - MovePositionTo(MovePositionSoVisible( - StartEndDisplayLine(currentPos, false), 1)); - SetLastXChosen(); - break; - case SCI_LINEENDDISPLAYEXTEND: - MovePositionTo(MovePositionSoVisible( - StartEndDisplayLine(currentPos, false), 1), selStream); - SetLastXChosen(); - break; - } - return 0; -} - -int Editor::KeyDefault(int, int) { - return 0; -} - -int Editor::KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed) { - DwellEnd(false); - int modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | - (alt ? SCI_ALT : 0); - int msg = kmap.Find(key, modifiers); - if (msg) { - if (consumed) - *consumed = true; - return WndProc(msg, 0, 0); - } else { - if (consumed) - *consumed = false; - return KeyDefault(key, modifiers); - } -} - -void Editor::SetWhitespaceVisible(int view) { - vs.viewWhitespace = static_cast(view); -} - -int Editor::GetWhitespaceVisible() { - return vs.viewWhitespace; -} - -void Editor::Indent(bool forwards) { - //Platform::DebugPrintf("INdent %d\n", forwards); - int lineOfAnchor = pdoc->LineFromPosition(anchor); - int lineCurrentPos = pdoc->LineFromPosition(currentPos); - if (lineOfAnchor == lineCurrentPos) { - if (forwards) { - pdoc->BeginUndoAction(); - ClearSelection(); - if (pdoc->GetColumn(currentPos) <= pdoc->GetColumn(pdoc->GetLineIndentPosition(lineCurrentPos)) && - pdoc->tabIndents) { - int indentation = pdoc->GetLineIndentation(lineCurrentPos); - int indentationStep = pdoc->IndentSize(); - pdoc->SetLineIndentation(lineCurrentPos, indentation + indentationStep - indentation % indentationStep); - SetEmptySelection(pdoc->GetLineIndentPosition(lineCurrentPos)); - } else { - if (pdoc->useTabs) { - pdoc->InsertChar(currentPos, '\t'); - SetEmptySelection(currentPos + 1); - } else { - int numSpaces = (pdoc->tabInChars) - - (pdoc->GetColumn(currentPos) % (pdoc->tabInChars)); - if (numSpaces < 1) - numSpaces = pdoc->tabInChars; - for (int i = 0; i < numSpaces; i++) { - pdoc->InsertChar(currentPos + i, ' '); - } - SetEmptySelection(currentPos + numSpaces); - } - } - pdoc->EndUndoAction(); - } else { - if (pdoc->GetColumn(currentPos) <= pdoc->GetLineIndentation(lineCurrentPos) && - pdoc->tabIndents) { - pdoc->BeginUndoAction(); - int indentation = pdoc->GetLineIndentation(lineCurrentPos); - int indentationStep = pdoc->IndentSize(); - pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationStep); - SetEmptySelection(pdoc->GetLineIndentPosition(lineCurrentPos)); - pdoc->EndUndoAction(); - } else { - int newColumn = ((pdoc->GetColumn(currentPos) - 1) / pdoc->tabInChars) * - pdoc->tabInChars; - if (newColumn < 0) - newColumn = 0; - int newPos = currentPos; - while (pdoc->GetColumn(newPos) > newColumn) - newPos--; - SetEmptySelection(newPos); - } - } - } else { - int anchorPosOnLine = anchor - pdoc->LineStart(lineOfAnchor); - int currentPosPosOnLine = currentPos - pdoc->LineStart(lineCurrentPos); - // Multiple lines selected so indent / dedent - int lineTopSel = Platform::Minimum(lineOfAnchor, lineCurrentPos); - int lineBottomSel = Platform::Maximum(lineOfAnchor, lineCurrentPos); - if (pdoc->LineStart(lineBottomSel) == anchor || pdoc->LineStart(lineBottomSel) == currentPos) - lineBottomSel--; // If not selecting any characters on a line, do not indent - pdoc->BeginUndoAction(); - pdoc->Indent(forwards, lineBottomSel, lineTopSel); - pdoc->EndUndoAction(); - if (lineOfAnchor < lineCurrentPos) { - if (currentPosPosOnLine == 0) - SetSelection(pdoc->LineStart(lineCurrentPos), pdoc->LineStart(lineOfAnchor)); - else - SetSelection(pdoc->LineStart(lineCurrentPos + 1), pdoc->LineStart(lineOfAnchor)); - } else { - if (anchorPosOnLine == 0) - SetSelection(pdoc->LineStart(lineCurrentPos), pdoc->LineStart(lineOfAnchor)); - else - SetSelection(pdoc->LineStart(lineCurrentPos), pdoc->LineStart(lineOfAnchor + 1)); - } - } -} - -/** - * Search of a text in the document, in the given range. - * @return The position of the found text, -1 if not found. - */ -long Editor::FindText( - uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD, - ///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX. - sptr_t lParam) { ///< @c TextToFind structure: The text to search for in the given range. - - TextToFind *ft = reinterpret_cast(lParam); - int lengthFound = istrlen(ft->lpstrText); - int pos = pdoc->FindText(ft->chrg.cpMin, ft->chrg.cpMax, ft->lpstrText, - (wParam & SCFIND_MATCHCASE) != 0, - (wParam & SCFIND_WHOLEWORD) != 0, - (wParam & SCFIND_WORDSTART) != 0, - (wParam & SCFIND_REGEXP) != 0, - (wParam & SCFIND_POSIX) != 0, - &lengthFound); - if (pos != -1) { - ft->chrgText.cpMin = pos; - ft->chrgText.cpMax = pos + lengthFound; - } - return pos; -} - -/** - * Relocatable search support : Searches relative to current selection - * point and sets the selection to the found text range with - * each search. - */ -/** - * Anchor following searches at current selection start: This allows - * multiple incremental interactive searches to be macro recorded - * while still setting the selection to found text so the find/select - * operation is self-contained. - */ -void Editor::SearchAnchor() { - searchAnchor = SelectionStart(); -} - -/** - * Find text from current search anchor: Must call @c SearchAnchor first. - * Used for next text and previous text requests. - * @return The position of the found text, -1 if not found. - */ -long Editor::SearchText( - unsigned int iMessage, ///< Accepts both @c SCI_SEARCHNEXT and @c SCI_SEARCHPREV. - uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD, - ///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX. - sptr_t lParam) { ///< The text to search for. - - const char *txt = reinterpret_cast(lParam); - int pos; - int lengthFound = istrlen(txt); - if (iMessage == SCI_SEARCHNEXT) { - pos = pdoc->FindText(searchAnchor, pdoc->Length(), txt, - (wParam & SCFIND_MATCHCASE) != 0, - (wParam & SCFIND_WHOLEWORD) != 0, - (wParam & SCFIND_WORDSTART) != 0, - (wParam & SCFIND_REGEXP) != 0, - (wParam & SCFIND_POSIX) != 0, - &lengthFound); - } else { - pos = pdoc->FindText(searchAnchor, 0, txt, - (wParam & SCFIND_MATCHCASE) != 0, - (wParam & SCFIND_WHOLEWORD) != 0, - (wParam & SCFIND_WORDSTART) != 0, - (wParam & SCFIND_REGEXP) != 0, - (wParam & SCFIND_POSIX) != 0, - &lengthFound); - } - - if (pos != -1) { - SetSelection(pos, pos + lengthFound); - } - - return pos; -} - -/** - * Search for text in the target range of the document. - * @return The position of the found text, -1 if not found. - */ -long Editor::SearchInTarget(const char *text, int length) { - int lengthFound = length; - int pos = pdoc->FindText(targetStart, targetEnd, text, - (searchFlags & SCFIND_MATCHCASE) != 0, - (searchFlags & SCFIND_WHOLEWORD) != 0, - (searchFlags & SCFIND_WORDSTART) != 0, - (searchFlags & SCFIND_REGEXP) != 0, - (searchFlags & SCFIND_POSIX) != 0, - &lengthFound); - if (pos != -1) { - targetStart = pos; - targetEnd = pos + lengthFound; - } - return pos; -} - -void Editor::GoToLine(int lineNo) { - if (lineNo > pdoc->LinesTotal()) - lineNo = pdoc->LinesTotal(); - if (lineNo < 0) - lineNo = 0; - SetEmptySelection(pdoc->LineStart(lineNo)); - ShowCaretAtCurrentPosition(); - EnsureCaretVisible(); -} - -static bool Close(Point pt1, Point pt2) { - if (abs(pt1.x - pt2.x) > 3) - return false; - if (abs(pt1.y - pt2.y) > 3) - return false; - return true; -} - -char *Editor::CopyRange(int start, int end) { - char *text = 0; - if (start < end) { - int len = end - start; - text = new char[len + 1]; - if (text) { - for (int i = 0; i < len; i++) { - text[i] = pdoc->CharAt(start + i); - } - text[len] = '\0'; - } - } - return text; -} - -void Editor::CopySelectionFromRange(SelectionText *ss, bool allowLineCopy, int start, int end) { - bool isLine = allowLineCopy && (start == end); - if (isLine) { - int currentLine = pdoc->LineFromPosition(currentPos); - start = pdoc->LineStart(currentLine); - end = pdoc->LineEnd(currentLine); - - char *text = CopyRange(start, end); - int textLen = text ? strlen(text) : 0; - // include room for \r\n\0 - textLen += 3; - char *textWithEndl = new char[textLen]; - textWithEndl[0] = '\0'; - if (text) - strncat(textWithEndl, text, textLen); - if (pdoc->eolMode != SC_EOL_LF) - strncat(textWithEndl, "\r", textLen); - if (pdoc->eolMode != SC_EOL_CR) - strncat(textWithEndl, "\n", textLen); - ss->Set(textWithEndl, strlen(textWithEndl), - pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false, true); - delete []text; - } else { - ss->Set(CopyRange(start, end), end - start + 1, - pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false, false); - } -} - -void Editor::CopySelectionRange(SelectionText *ss, bool allowLineCopy) { - if (selType == selStream) { - CopySelectionFromRange(ss, allowLineCopy, SelectionStart(), SelectionEnd()); - } else { - char *text = 0; - int size = 0; - SelectionLineIterator lineIterator(this); - while (lineIterator.Iterate()) { - size += lineIterator.endPos - lineIterator.startPos; - if (selType != selLines) { - size++; - if (pdoc->eolMode == SC_EOL_CRLF) { - size++; - } - } - } - if (size > 0) { - text = new char[size + 1]; - if (text) { - int j = 0; - lineIterator.Reset(); - while (lineIterator.Iterate()) { - for (int i = lineIterator.startPos; - i < lineIterator.endPos; - i++) { - text[j++] = pdoc->CharAt(i); - } - if (selType != selLines) { - if (pdoc->eolMode != SC_EOL_LF) { - text[j++] = '\r'; - } - if (pdoc->eolMode != SC_EOL_CR) { - text[j++] = '\n'; - } - } - } - text[size] = '\0'; - } - } - ss->Set(text, size + 1, pdoc->dbcsCodePage, - vs.styles[STYLE_DEFAULT].characterSet, selType == selRectangle, selType == selLines); - } -} - -void Editor::CopyRangeToClipboard(int start, int end) { - start = pdoc->ClampPositionIntoDocument(start); - end = pdoc->ClampPositionIntoDocument(end); - SelectionText selectedText; - selectedText.Set(CopyRange(start, end), end - start + 1, - pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false, false); - CopyToClipboard(selectedText); -} - -void Editor::CopyText(int length, const char *text) { - SelectionText selectedText; - selectedText.Copy(text, length + 1, - pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false, false); - CopyToClipboard(selectedText); -} - -void Editor::SetDragPosition(int newPos) { - if (newPos >= 0) { - newPos = MovePositionOutsideChar(newPos, 1); - posDrop = newPos; - } - if (posDrag != newPos) { - caret.on = true; - SetTicking(true); - InvalidateCaret(); - posDrag = newPos; - InvalidateCaret(); - } -} - -void Editor::DisplayCursor(Window::Cursor c) { - if (cursorMode == SC_CURSORNORMAL) - wMain.SetCursor(c); - else - wMain.SetCursor(static_cast(cursorMode)); -} - -bool Editor::DragThreshold(Point ptStart, Point ptNow) { - int xMove = ptStart.x - ptNow.x; - int yMove = ptStart.y - ptNow.y; - int distanceSquared = xMove * xMove + yMove * yMove; - return distanceSquared > 16; -} - -void Editor::StartDrag() { - // Always handled by subclasses - //SetMouseCapture(true); - //DisplayCursor(Window::cursorArrow); -} - -void Editor::DropAt(int position, const char *value, bool moving, bool rectangular) { - //Platform::DebugPrintf("DropAt %d %d\n", inDragDrop, position); - if (inDragDrop == ddDragging) - dropWentOutside = false; - - int positionWasInSelection = PositionInSelection(position); - - bool positionOnEdgeOfSelection = - (position == SelectionStart()) || (position == SelectionEnd()); - - if ((inDragDrop != ddDragging) || !(0 == positionWasInSelection) || - (positionOnEdgeOfSelection && !moving)) { - - int selStart = SelectionStart(); - int selEnd = SelectionEnd(); - - pdoc->BeginUndoAction(); - - int positionAfterDeletion = position; - if ((inDragDrop == ddDragging) && moving) { - // Remove dragged out text - if (rectangular || selType == selLines) { - SelectionLineIterator lineIterator(this); - while (lineIterator.Iterate()) { - if (position >= lineIterator.startPos) { - if (position > lineIterator.endPos) { - positionAfterDeletion -= lineIterator.endPos - lineIterator.startPos; - } else { - positionAfterDeletion -= position - lineIterator.startPos; - } - } - } - } else { - if (position > selStart) { - positionAfterDeletion -= selEnd - selStart; - } - } - ClearSelection(); - } - position = positionAfterDeletion; - - if (rectangular) { - PasteRectangular(position, value, istrlen(value)); - pdoc->EndUndoAction(); - // Should try to select new rectangle but it may not be a rectangle now so just select the drop position - SetEmptySelection(position); - } else { - position = MovePositionOutsideChar(position, currentPos - position); - if (pdoc->InsertCString(position, value)) { - SetSelection(position + istrlen(value), position); - } - pdoc->EndUndoAction(); - } - } else if (inDragDrop == ddDragging) { - SetEmptySelection(position); - } -} - -/** - * @return -1 if given position is before the selection, - * 1 if position is after the selection, - * 0 if position is inside the selection, - */ -int Editor::PositionInSelection(int pos) { - pos = MovePositionOutsideChar(pos, currentPos - pos); - if (pos < SelectionStart()) { - return -1; - } - if (pos > SelectionEnd()) { - return 1; - } - if (selType == selStream) { - return 0; - } else { - SelectionLineIterator lineIterator(this); - lineIterator.SetAt(pdoc->LineFromPosition(pos)); - if (pos < lineIterator.startPos) { - return -1; - } else if (pos > lineIterator.endPos) { - return 1; - } else { - return 0; - } - } -} - -bool Editor::PointInSelection(Point pt) { - int pos = PositionFromLocation(pt); - if (0 == PositionInSelection(pos)) { - // Probably inside, but we must make a finer test - int selStart, selEnd; - if (selType == selStream) { - selStart = SelectionStart(); - selEnd = SelectionEnd(); - } else { - SelectionLineIterator lineIterator(this); - lineIterator.SetAt(pdoc->LineFromPosition(pos)); - selStart = lineIterator.startPos; - selEnd = lineIterator.endPos; - } - if (pos == selStart) { - // see if just before selection - Point locStart = LocationFromPosition(pos); - if (pt.x < locStart.x) { - return false; - } - } - if (pos == selEnd) { - // see if just after selection - Point locEnd = LocationFromPosition(pos); - if (pt.x > locEnd.x) { - return false; - } - } - return true; - } - return false; -} - -bool Editor::PointInSelMargin(Point pt) { - // Really means: "Point in a margin" - if (vs.fixedColumnWidth > 0) { // There is a margin - PRectangle rcSelMargin = GetClientRectangle(); - rcSelMargin.right = vs.fixedColumnWidth - vs.leftMarginWidth; - return rcSelMargin.Contains(pt); - } else { - return false; - } -} - -void Editor::LineSelection(int lineCurrent_, int lineAnchor_) { - if (lineAnchor_ < lineCurrent_) { - SetSelection(pdoc->LineStart(lineCurrent_ + 1), - pdoc->LineStart(lineAnchor_)); - } else if (lineAnchor_ > lineCurrent_) { - SetSelection(pdoc->LineStart(lineCurrent_), - pdoc->LineStart(lineAnchor_ + 1)); - } else { // Same line, select it - SetSelection(pdoc->LineStart(lineAnchor_ + 1), - pdoc->LineStart(lineAnchor_)); - } -} - -void Editor::DwellEnd(bool mouseMoved) { - if (mouseMoved) - ticksToDwell = dwellDelay; - else - ticksToDwell = SC_TIME_FOREVER; - if (dwelling && (dwellDelay < SC_TIME_FOREVER)) { - dwelling = false; - NotifyDwelling(ptMouseLast, dwelling); - } -} - -void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) { - //Platform::DebugPrintf("ButtonDown %d %d = %d alt=%d %d\n", curTime, lastClickTime, curTime - lastClickTime, alt, inDragDrop); - ptMouseLast = pt; - int newPos = PositionFromLocation(pt); - newPos = MovePositionOutsideChar(newPos, currentPos - newPos); - inDragDrop = ddNone; - moveExtendsSelection = false; - - bool processed = NotifyMarginClick(pt, shift, ctrl, alt); - if (processed) - return; - - NotifyIndicatorClick(true, newPos, shift, ctrl, alt); - - bool inSelMargin = PointInSelMargin(pt); - if (shift & !inSelMargin) { - SetSelection(newPos); - } - if (((curTime - lastClickTime) < Platform::DoubleClickTime()) && Close(pt, lastClick)) { - //Platform::DebugPrintf("Double click %d %d = %d\n", curTime, lastClickTime, curTime - lastClickTime); - SetMouseCapture(true); - SetEmptySelection(newPos); - bool doubleClick = false; - // Stop mouse button bounce changing selection type - if (!Platform::MouseButtonBounce() || curTime != lastClickTime) { - if (selectionType == selChar) { - selectionType = selWord; - doubleClick = true; - } else if (selectionType == selWord) { - selectionType = selLine; - } else { - selectionType = selChar; - originalAnchorPos = currentPos; - } - } - - if (selectionType == selWord) { - if (currentPos >= originalAnchorPos) { // Moved forward - SetSelection(pdoc->ExtendWordSelect(currentPos, 1), - pdoc->ExtendWordSelect(originalAnchorPos, -1)); - } else { // Moved backward - SetSelection(pdoc->ExtendWordSelect(currentPos, -1), - pdoc->ExtendWordSelect(originalAnchorPos, 1)); - } - } else if (selectionType == selLine) { - lineAnchor = LineFromLocation(pt); - SetSelection(pdoc->LineStart(lineAnchor + 1), pdoc->LineStart(lineAnchor)); - //Platform::DebugPrintf("Triple click: %d - %d\n", anchor, currentPos); - } else { - SetEmptySelection(currentPos); - } - //Platform::DebugPrintf("Double click: %d - %d\n", anchor, currentPos); - if (doubleClick) { - NotifyDoubleClick(pt, shift, ctrl, alt); - if (PositionIsHotspot(newPos)) - NotifyHotSpotDoubleClicked(newPos, shift, ctrl, alt); - } - } else { // Single click - if (inSelMargin) { - selType = selStream; - if (ctrl) { - SelectAll(); - lastClickTime = curTime; - return; - } - if (!shift) { - lineAnchor = LineFromLocation(pt); - // Single click in margin: select whole line - LineSelection(lineAnchor, lineAnchor); - SetSelection(pdoc->LineStart(lineAnchor + 1), - pdoc->LineStart(lineAnchor)); - } else { - // Single shift+click in margin: select from line anchor to clicked line - if (anchor > currentPos) - lineAnchor = pdoc->LineFromPosition(anchor - 1); - else - lineAnchor = pdoc->LineFromPosition(anchor); - int lineStart = LineFromLocation(pt); - LineSelection(lineStart, lineAnchor); - //lineAnchor = lineStart; // Keep the same anchor for ButtonMove - } - - SetDragPosition(invalidPosition); - SetMouseCapture(true); - selectionType = selLine; - } else { - if (PointIsHotspot(pt)) { - NotifyHotSpotClicked(newPos, shift, ctrl, alt); - } - if (!shift) { - if (PointInSelection(pt) && !SelectionEmpty()) - inDragDrop = ddInitial; - else - inDragDrop = ddNone; - } - SetMouseCapture(true); - if (inDragDrop != ddInitial) { - SetDragPosition(invalidPosition); - if (!shift) { - SetEmptySelection(newPos); - } - selType = alt ? selRectangle : selStream; - selectionType = selChar; - originalAnchorPos = currentPos; - SetRectangularRange(); - } - } - } - lastClickTime = curTime; - lastXChosen = pt.x; - ShowCaretAtCurrentPosition(); -} - -bool Editor::PositionIsHotspot(int position) { - return vs.styles[pdoc->StyleAt(position) & pdoc->stylingBitsMask].hotspot; -} - -bool Editor::PointIsHotspot(Point pt) { - int pos = PositionFromLocationClose(pt); - if (pos == INVALID_POSITION) - return false; - return PositionIsHotspot(pos); -} - -void Editor::SetHotSpotRange(Point *pt) { - if (pt) { - int pos = PositionFromLocation(*pt); - - // If we don't limit this to word characters then the - // range can encompass more than the run range and then - // the underline will not be drawn properly. - int hsStart_ = pdoc->ExtendStyleRange(pos, -1, vs.hotspotSingleLine); - int hsEnd_ = pdoc->ExtendStyleRange(pos, 1, vs.hotspotSingleLine); - - // Only invalidate the range if the hotspot range has changed... - if (hsStart_ != hsStart || hsEnd_ != hsEnd) { - if (hsStart != -1) { - InvalidateRange(hsStart, hsEnd); - } - hsStart = hsStart_; - hsEnd = hsEnd_; - InvalidateRange(hsStart, hsEnd); - } - } else { - if (hsStart != -1) { - int hsStart_ = hsStart; - int hsEnd_ = hsEnd; - hsStart = -1; - hsEnd = -1; - InvalidateRange(hsStart_, hsEnd_); - } else { - hsStart = -1; - hsEnd = -1; - } - } -} - -void Editor::GetHotSpotRange(int& hsStart_, int& hsEnd_) { - hsStart_ = hsStart; - hsEnd_ = hsEnd; -} - -void Editor::ButtonMove(Point pt) { - if ((ptMouseLast.x != pt.x) || (ptMouseLast.y != pt.y)) { - DwellEnd(true); - } - - int movePos = PositionFromLocation(pt); - movePos = MovePositionOutsideChar(movePos, currentPos - movePos); - - if (inDragDrop == ddInitial) { - if (DragThreshold(ptMouseLast, pt)) { - SetMouseCapture(false); - SetDragPosition(movePos); - CopySelectionRange(&drag); - StartDrag(); - } - return; - } - - ptMouseLast = pt; - //Platform::DebugPrintf("Move %d %d\n", pt.x, pt.y); - if (HaveMouseCapture()) { - - // Slow down autoscrolling/selection - autoScrollTimer.ticksToWait -= timer.tickSize; - if (autoScrollTimer.ticksToWait > 0) - return; - autoScrollTimer.ticksToWait = autoScrollDelay; - - // Adjust selection - if (posDrag >= 0) { - SetDragPosition(movePos); - } else { - if (selectionType == selChar) { - SetSelection(movePos); - } else if (selectionType == selWord) { - // Continue selecting by word - if (movePos == originalAnchorPos) { // Didn't move - // No need to do anything. Previously this case was lumped - // in with "Moved forward", but that can be harmful in this - // case: a handler for the NotifyDoubleClick re-adjusts - // the selection for a fancier definition of "word" (for - // example, in Perl it is useful to include the leading - // '$', '%' or '@' on variables for word selection). In this - // the ButtonMove() called via Tick() for auto-scrolling - // could result in the fancier word selection adjustment - // being unmade. - } else if (movePos > originalAnchorPos) { // Moved forward - SetSelection(pdoc->ExtendWordSelect(movePos, 1), - pdoc->ExtendWordSelect(originalAnchorPos, -1)); - } else { // Moved backward - SetSelection(pdoc->ExtendWordSelect(movePos, -1), - pdoc->ExtendWordSelect(originalAnchorPos, 1)); - } - } else { - // Continue selecting by line - int lineMove = LineFromLocation(pt); - LineSelection(lineMove, lineAnchor); - } - } - // While dragging to make rectangular selection, we don't want the current - // position to jump to the end of smaller or empty lines. - //xEndSelect = pt.x - vs.fixedColumnWidth + xOffset; - xEndSelect = XFromPosition(movePos); - - // Autoscroll - PRectangle rcClient = GetClientRectangle(); - if (pt.y > rcClient.bottom) { - int lineMove = cs.DisplayFromDoc(LineFromLocation(pt)); - if (lineMove < 0) { - lineMove = cs.DisplayFromDoc(pdoc->LinesTotal() - 1); - } - ScrollTo(lineMove - LinesOnScreen() + 1); - Redraw(); - } else if (pt.y < rcClient.top) { - int lineMove = cs.DisplayFromDoc(LineFromLocation(pt)); - ScrollTo(lineMove - 1); - Redraw(); - } - EnsureCaretVisible(false, false, true); - - if (hsStart != -1 && !PositionIsHotspot(movePos)) - SetHotSpotRange(NULL); - - } else { - if (vs.fixedColumnWidth > 0) { // There is a margin - if (PointInSelMargin(pt)) { - DisplayCursor(Window::cursorReverseArrow); - return; // No need to test for selection - } - } - // Display regular (drag) cursor over selection - if (PointInSelection(pt) && !SelectionEmpty()) { - DisplayCursor(Window::cursorArrow); - } else if (PointIsHotspot(pt)) { - DisplayCursor(Window::cursorHand); - SetHotSpotRange(&pt); - } else { - DisplayCursor(Window::cursorText); - SetHotSpotRange(NULL); - } - } -} - -void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) { - //Platform::DebugPrintf("ButtonUp %d %d\n", HaveMouseCapture(), inDragDrop); - int newPos = PositionFromLocation(pt); - newPos = MovePositionOutsideChar(newPos, currentPos - newPos); - if (inDragDrop == ddInitial) { - inDragDrop = ddNone; - SetEmptySelection(newPos); - } - if (HaveMouseCapture()) { - if (PointInSelMargin(pt)) { - DisplayCursor(Window::cursorReverseArrow); - } else { - DisplayCursor(Window::cursorText); - SetHotSpotRange(NULL); - } - ptMouseLast = pt; - SetMouseCapture(false); - int newPos = PositionFromLocation(pt); - newPos = MovePositionOutsideChar(newPos, currentPos - newPos); - NotifyIndicatorClick(false, newPos, false, false, false); - if (inDragDrop == ddDragging) { - int selStart = SelectionStart(); - int selEnd = SelectionEnd(); - if (selStart < selEnd) { - if (drag.len) { - if (ctrl) { - if (pdoc->InsertString(newPos, drag.s, drag.len)) { - SetSelection(newPos, newPos + drag.len); - } - } else if (newPos < selStart) { - pdoc->DeleteChars(selStart, drag.len); - if (pdoc->InsertString(newPos, drag.s, drag.len)) { - SetSelection(newPos, newPos + drag.len); - } - } else if (newPos > selEnd) { - pdoc->DeleteChars(selStart, drag.len); - newPos -= drag.len; - if (pdoc->InsertString(newPos, drag.s, drag.len)) { - SetSelection(newPos, newPos + drag.len); - } - } else { - SetEmptySelection(newPos); - } - drag.Free(); - } - selectionType = selChar; - } - } else { - if (selectionType == selChar) { - SetSelection(newPos); - } - } - SetRectangularRange(); - lastClickTime = curTime; - lastClick = pt; - lastXChosen = pt.x; - if (selType == selStream) { - SetLastXChosen(); - } - inDragDrop = ddNone; - EnsureCaretVisible(false); - } -} - -// Called frequently to perform background UI including -// caret blinking and automatic scrolling. -void Editor::Tick() { - if (HaveMouseCapture()) { - // Auto scroll - ButtonMove(ptMouseLast); - } - if (caret.period > 0) { - timer.ticksToWait -= timer.tickSize; - if (timer.ticksToWait <= 0) { - caret.on = !caret.on; - timer.ticksToWait = caret.period; - if (caret.active) { - InvalidateCaret(); - } - } - } - if (horizontalScrollBarVisible && trackLineWidth && (lineWidthMaxSeen > scrollWidth)) { - scrollWidth = lineWidthMaxSeen; - SetScrollBars(); - } - if ((dwellDelay < SC_TIME_FOREVER) && - (ticksToDwell > 0) && - (!HaveMouseCapture())) { - ticksToDwell -= timer.tickSize; - if (ticksToDwell <= 0) { - dwelling = true; - NotifyDwelling(ptMouseLast, dwelling); - } - } -} - -bool Editor::Idle() { - - bool idleDone; - - bool wrappingDone = wrapState == eWrapNone; - - if (!wrappingDone) { - // Wrap lines during idle. - WrapLines(false, -1); - // No more wrapping - if (wrapStart == wrapEnd) - wrappingDone = true; - } - - // Add more idle things to do here, but make sure idleDone is - // set correctly before the function returns. returning - // false will stop calling this idle funtion until SetIdle() is - // called again. - - idleDone = wrappingDone; // && thatDone && theOtherThingDone... - - return !idleDone; -} - -void Editor::SetFocusState(bool focusState) { - hasFocus = focusState; - NotifyFocus(hasFocus); - if (hasFocus) { - ShowCaretAtCurrentPosition(); - } else { - CancelModes(); - DropCaret(); - } -} - -bool Editor::PaintContains(PRectangle rc) { - if (rc.Empty()) { - return true; - } else { - return rcPaint.Contains(rc); - } -} - -bool Editor::PaintContainsMargin() { - PRectangle rcSelMargin = GetClientRectangle(); - rcSelMargin.right = vs.fixedColumnWidth; - return PaintContains(rcSelMargin); -} - -void Editor::CheckForChangeOutsidePaint(Range r) { - if (paintState == painting && !paintingAllText) { - //Platform::DebugPrintf("Checking range in paint %d-%d\n", r.start, r.end); - if (!r.Valid()) - return; - - PRectangle rcRange = RectangleFromRange(r.start, r.end); - PRectangle rcText = GetTextRectangle(); - if (rcRange.top < rcText.top) { - rcRange.top = rcText.top; - } - if (rcRange.bottom > rcText.bottom) { - rcRange.bottom = rcText.bottom; - } - - if (!PaintContains(rcRange)) { - AbandonPaint(); - } - } -} - -void Editor::SetBraceHighlight(Position pos0, Position pos1, int matchStyle) { - if ((pos0 != braces[0]) || (pos1 != braces[1]) || (matchStyle != bracesMatchStyle)) { - if ((braces[0] != pos0) || (matchStyle != bracesMatchStyle)) { - CheckForChangeOutsidePaint(Range(braces[0])); - CheckForChangeOutsidePaint(Range(pos0)); - braces[0] = pos0; - } - if ((braces[1] != pos1) || (matchStyle != bracesMatchStyle)) { - CheckForChangeOutsidePaint(Range(braces[1])); - CheckForChangeOutsidePaint(Range(pos1)); - braces[1] = pos1; - } - bracesMatchStyle = matchStyle; - if (paintState == notPainting) { - Redraw(); - } - } -} - -void Editor::SetDocPointer(Document *document) { - //Platform::DebugPrintf("** %x setdoc to %x\n", pdoc, document); - pdoc->RemoveWatcher(this, 0); - pdoc->Release(); - if (document == NULL) { - pdoc = new Document(); - } else { - pdoc = document; - } - pdoc->AddRef(); - - // Ensure all positions within document - selType = selStream; - currentPos = 0; - anchor = 0; - targetStart = 0; - targetEnd = 0; - - braces[0] = invalidPosition; - braces[1] = invalidPosition; - - // Reset the contraction state to fully shown. - cs.Clear(); - cs.InsertLines(0, pdoc->LinesTotal() - 1); - llc.Deallocate(); - NeedWrapping(); - - pdoc->AddWatcher(this, 0); - SetScrollBars(); - Redraw(); -} - -/** - * Recursively expand a fold, making lines visible except where they have an unexpanded parent. - */ -void Editor::Expand(int &line, bool doExpand) { - int lineMaxSubord = pdoc->GetLastChild(line); - line++; - while (line <= lineMaxSubord) { - if (doExpand) - cs.SetVisible(line, line, true); - int level = pdoc->GetLevel(line); - if (level & SC_FOLDLEVELHEADERFLAG) { - if (doExpand && cs.GetExpanded(line)) { - Expand(line, true); - } else { - Expand(line, false); - } - } else { - line++; - } - } -} - -void Editor::ToggleContraction(int line) { - if (line >= 0) { - if ((pdoc->GetLevel(line) & SC_FOLDLEVELHEADERFLAG) == 0) { - line = pdoc->GetFoldParent(line); - if (line < 0) - return; - } - - if (cs.GetExpanded(line)) { - int lineMaxSubord = pdoc->GetLastChild(line); - cs.SetExpanded(line, 0); - if (lineMaxSubord > line) { - cs.SetVisible(line + 1, lineMaxSubord, false); - - int lineCurrent = pdoc->LineFromPosition(currentPos); - if (lineCurrent > line && lineCurrent <= lineMaxSubord) { - // This does not re-expand the fold - EnsureCaretVisible(); - } - - SetScrollBars(); - Redraw(); - } - - } else { - if (!(cs.GetVisible(line))) { - EnsureLineVisible(line, false); - GoToLine(line); - } - cs.SetExpanded(line, 1); - Expand(line, true); - SetScrollBars(); - Redraw(); - } - } -} - -/** - * Recurse up from this line to find any folds that prevent this line from being visible - * and unfold them all. - */ -void Editor::EnsureLineVisible(int lineDoc, bool enforcePolicy) { - - // In case in need of wrapping to ensure DisplayFromDoc works. - WrapLines(true, -1); - - if (!cs.GetVisible(lineDoc)) { - int lineParent = pdoc->GetFoldParent(lineDoc); - if (lineParent >= 0) { - if (lineDoc != lineParent) - EnsureLineVisible(lineParent, enforcePolicy); - if (!cs.GetExpanded(lineParent)) { - cs.SetExpanded(lineParent, 1); - Expand(lineParent, true); - } - } - SetScrollBars(); - Redraw(); - } - if (enforcePolicy) { - int lineDisplay = cs.DisplayFromDoc(lineDoc); - if (visiblePolicy & VISIBLE_SLOP) { - if ((topLine > lineDisplay) || ((visiblePolicy & VISIBLE_STRICT) && (topLine + visibleSlop > lineDisplay))) { - SetTopLine(Platform::Clamp(lineDisplay - visibleSlop, 0, MaxScrollPos())); - SetVerticalScrollPos(); - Redraw(); - } else if ((lineDisplay > topLine + LinesOnScreen() - 1) || - ((visiblePolicy & VISIBLE_STRICT) && (lineDisplay > topLine + LinesOnScreen() - 1 - visibleSlop))) { - SetTopLine(Platform::Clamp(lineDisplay - LinesOnScreen() + 1 + visibleSlop, 0, MaxScrollPos())); - SetVerticalScrollPos(); - Redraw(); - } - } else { - if ((topLine > lineDisplay) || (lineDisplay > topLine + LinesOnScreen() - 1) || (visiblePolicy & VISIBLE_STRICT)) { - SetTopLine(Platform::Clamp(lineDisplay - LinesOnScreen() / 2 + 1, 0, MaxScrollPos())); - SetVerticalScrollPos(); - Redraw(); - } - } - } -} - -int Editor::ReplaceTarget(bool replacePatterns, const char *text, int length) { - pdoc->BeginUndoAction(); - if (length == -1) - length = istrlen(text); - if (replacePatterns) { - text = pdoc->SubstituteByPosition(text, &length); - if (!text) { - pdoc->EndUndoAction(); - return 0; - } - } - if (targetStart != targetEnd) - pdoc->DeleteChars(targetStart, targetEnd - targetStart); - targetEnd = targetStart; - pdoc->InsertString(targetStart, text, length); - targetEnd = targetStart + length; - pdoc->EndUndoAction(); - return length; -} - -bool Editor::IsUnicodeMode() const { - return pdoc && (SC_CP_UTF8 == pdoc->dbcsCodePage); -} - -int Editor::CodePage() const { - if (pdoc) - return pdoc->dbcsCodePage; - else - return 0; -} - -int Editor::WrapCount(int line) { - AutoSurface surface(this); - AutoLineLayout ll(llc, RetrieveLineLayout(line)); - - if (surface && ll) { - LayoutLine(line, surface, vs, ll, wrapWidth); - return ll->lines; - } else { - return 1; - } -} - -void Editor::AddStyledText(char *buffer, int appendLength) { - // The buffer consists of alternating character bytes and style bytes - size_t textLength = appendLength / 2; - char *text = new char[textLength]; - if (text) { - size_t i; - for (i = 0;i < textLength;i++) { - text[i] = buffer[i*2]; - } - pdoc->InsertString(CurrentPosition(), text, textLength); - for (i = 0;i < textLength;i++) { - text[i] = buffer[i*2+1]; - } - pdoc->StartStyling(CurrentPosition(), static_cast(0xff)); - pdoc->SetStyles(textLength, text); - delete []text; - } - SetEmptySelection(currentPos + textLength); -} - -static bool ValidMargin(unsigned long wParam) { - return wParam < ViewStyle::margins; -} - -static char *CharPtrFromSPtr(sptr_t lParam) { - return reinterpret_cast(lParam); -} - -void Editor::StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { - vs.EnsureStyle(wParam); - switch (iMessage) { - case SCI_STYLESETFORE: - vs.styles[wParam].fore.desired = ColourDesired(lParam); - break; - case SCI_STYLESETBACK: - vs.styles[wParam].back.desired = ColourDesired(lParam); - break; - case SCI_STYLESETBOLD: - vs.styles[wParam].bold = lParam != 0; - break; - case SCI_STYLESETITALIC: - vs.styles[wParam].italic = lParam != 0; - break; - case SCI_STYLESETEOLFILLED: - vs.styles[wParam].eolFilled = lParam != 0; - break; - case SCI_STYLESETSIZE: - vs.styles[wParam].size = lParam; - break; - case SCI_STYLESETFONT: - if (lParam != 0) { - vs.SetStyleFontName(wParam, CharPtrFromSPtr(lParam)); - } - break; - case SCI_STYLESETUNDERLINE: - vs.styles[wParam].underline = lParam != 0; - break; - case SCI_STYLESETCASE: - vs.styles[wParam].caseForce = static_cast(lParam); - break; - case SCI_STYLESETCHARACTERSET: - vs.styles[wParam].characterSet = lParam; - break; - case SCI_STYLESETVISIBLE: - vs.styles[wParam].visible = lParam != 0; - break; - case SCI_STYLESETCHANGEABLE: - vs.styles[wParam].changeable = lParam != 0; - break; - case SCI_STYLESETHOTSPOT: - vs.styles[wParam].hotspot = lParam != 0; - break; - } - InvalidateStyleRedraw(); -} - -sptr_t Editor::StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { - vs.EnsureStyle(wParam); - switch (iMessage) { - case SCI_STYLEGETFORE: - return vs.styles[wParam].fore.desired.AsLong(); - case SCI_STYLEGETBACK: - return vs.styles[wParam].back.desired.AsLong(); - case SCI_STYLEGETBOLD: - return vs.styles[wParam].bold ? 1 : 0; - case SCI_STYLEGETITALIC: - return vs.styles[wParam].italic ? 1 : 0; - case SCI_STYLEGETEOLFILLED: - return vs.styles[wParam].eolFilled ? 1 : 0; - case SCI_STYLEGETSIZE: - return vs.styles[wParam].size; - case SCI_STYLEGETFONT: - if (lParam != 0) - strcpy(CharPtrFromSPtr(lParam), vs.styles[wParam].fontName); - return strlen(vs.styles[wParam].fontName); - case SCI_STYLEGETUNDERLINE: - return vs.styles[wParam].underline ? 1 : 0; - case SCI_STYLEGETCASE: - return static_cast(vs.styles[wParam].caseForce); - case SCI_STYLEGETCHARACTERSET: - return vs.styles[wParam].characterSet; - case SCI_STYLEGETVISIBLE: - return vs.styles[wParam].visible ? 1 : 0; - case SCI_STYLEGETCHANGEABLE: - return vs.styles[wParam].changeable ? 1 : 0; - case SCI_STYLEGETHOTSPOT: - return vs.styles[wParam].hotspot ? 1 : 0; - } - return 0; -} - -sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { - //Platform::DebugPrintf("S start wnd proc %d %d %d\n",iMessage, wParam, lParam); - - // Optional macro recording hook - if (recordingMacro) - NotifyMacroRecord(iMessage, wParam, lParam); - - switch (iMessage) { - - case SCI_GETTEXT: { - if (lParam == 0) - return pdoc->Length() + 1; - if (wParam == 0) - return 0; - char *ptr = CharPtrFromSPtr(lParam); - unsigned int iChar = 0; - for (; iChar < wParam - 1; iChar++) - ptr[iChar] = pdoc->CharAt(iChar); - ptr[iChar] = '\0'; - return iChar; - } - - case SCI_SETTEXT: { - if (lParam == 0) - return 0; - pdoc->BeginUndoAction(); - pdoc->DeleteChars(0, pdoc->Length()); - SetEmptySelection(0); - pdoc->InsertCString(0, CharPtrFromSPtr(lParam)); - pdoc->EndUndoAction(); - return 1; - } - - case SCI_GETTEXTLENGTH: - return pdoc->Length(); - - case SCI_CUT: - Cut(); - SetLastXChosen(); - break; - - case SCI_COPY: - Copy(); - break; - - case SCI_COPYALLOWLINE: - CopyAllowLine(); - break; - - case SCI_COPYRANGE: - CopyRangeToClipboard(wParam, lParam); - break; - - case SCI_COPYTEXT: - CopyText(wParam, CharPtrFromSPtr(lParam)); - break; - - case SCI_PASTE: - Paste(); - if (!caretSticky) { - SetLastXChosen(); - } - EnsureCaretVisible(); - break; - - case SCI_CLEAR: - Clear(); - SetLastXChosen(); - EnsureCaretVisible(); - break; - - case SCI_UNDO: - Undo(); - SetLastXChosen(); - break; - - case SCI_CANUNDO: - return (pdoc->CanUndo() && !pdoc->IsReadOnly()) ? 1 : 0; - - case SCI_EMPTYUNDOBUFFER: - pdoc->DeleteUndoHistory(); - return 0; - - case SCI_GETFIRSTVISIBLELINE: - return topLine; - - case SCI_GETLINE: { // Risk of overwriting the end of the buffer - int lineStart = pdoc->LineStart(wParam); - int lineEnd = pdoc->LineStart(wParam + 1); - if (lParam == 0) { - return lineEnd - lineStart; - } - char *ptr = CharPtrFromSPtr(lParam); - int iPlace = 0; - for (int iChar = lineStart; iChar < lineEnd; iChar++) { - ptr[iPlace++] = pdoc->CharAt(iChar); - } - return iPlace; - } - - case SCI_GETLINECOUNT: - if (pdoc->LinesTotal() == 0) - return 1; - else - return pdoc->LinesTotal(); - - case SCI_GETMODIFY: - return !pdoc->IsSavePoint(); - - case SCI_SETSEL: { - int nStart = static_cast(wParam); - int nEnd = static_cast(lParam); - if (nEnd < 0) - nEnd = pdoc->Length(); - if (nStart < 0) - nStart = nEnd; // Remove selection - selType = selStream; - SetSelection(nEnd, nStart); - EnsureCaretVisible(); - } - break; - - case SCI_GETSELTEXT: { - if (lParam == 0) { - if (selType == selStream) { - return 1 + SelectionEnd() - SelectionStart(); - } else { - // TODO: why is selLines handled the slow way? - int size = 0; - int extraCharsPerLine = 0; - if (selType != selLines) - extraCharsPerLine = (pdoc->eolMode == SC_EOL_CRLF) ? 2 : 1; - SelectionLineIterator lineIterator(this); - while (lineIterator.Iterate()) { - size += lineIterator.endPos + extraCharsPerLine - lineIterator.startPos; - } - - return 1 + size; - } - } - SelectionText selectedText; - CopySelectionRange(&selectedText); - char *ptr = CharPtrFromSPtr(lParam); - int iChar = 0; - if (selectedText.len) { - for (; iChar < selectedText.len; iChar++) - ptr[iChar] = selectedText.s[iChar]; - } else { - ptr[0] = '\0'; - } - return iChar; - } - - case SCI_LINEFROMPOSITION: - if (static_cast(wParam) < 0) - return 0; - return pdoc->LineFromPosition(wParam); - - case SCI_POSITIONFROMLINE: - if (static_cast(wParam) < 0) - wParam = pdoc->LineFromPosition(SelectionStart()); - if (wParam == 0) - return 0; // Even if there is no text, there is a first line that starts at 0 - if (static_cast(wParam) > pdoc->LinesTotal()) - return -1; - //if (wParam > pdoc->LineFromPosition(pdoc->Length())) // Useful test, anyway... - // return -1; - return pdoc->LineStart(wParam); - - // Replacement of the old Scintilla interpretation of EM_LINELENGTH - case SCI_LINELENGTH: - if ((static_cast(wParam) < 0) || - (static_cast(wParam) > pdoc->LineFromPosition(pdoc->Length()))) - return 0; - return pdoc->LineStart(wParam + 1) - pdoc->LineStart(wParam); - - case SCI_REPLACESEL: { - if (lParam == 0) - return 0; - pdoc->BeginUndoAction(); - ClearSelection(); - char *replacement = CharPtrFromSPtr(lParam); - pdoc->InsertCString(currentPos, replacement); - pdoc->EndUndoAction(); - SetEmptySelection(currentPos + istrlen(replacement)); - EnsureCaretVisible(); - } - break; - - case SCI_SETTARGETSTART: - targetStart = wParam; - break; - - case SCI_GETTARGETSTART: - return targetStart; - - case SCI_SETTARGETEND: - targetEnd = wParam; - break; - - case SCI_GETTARGETEND: - return targetEnd; - - case SCI_TARGETFROMSELECTION: - if (currentPos < anchor) { - targetStart = currentPos; - targetEnd = anchor; - } else { - targetStart = anchor; - targetEnd = currentPos; - } - break; - - case SCI_REPLACETARGET: - PLATFORM_ASSERT(lParam); - return ReplaceTarget(false, CharPtrFromSPtr(lParam), wParam); - - case SCI_REPLACETARGETRE: - PLATFORM_ASSERT(lParam); - return ReplaceTarget(true, CharPtrFromSPtr(lParam), wParam); - - case SCI_SEARCHINTARGET: - PLATFORM_ASSERT(lParam); - return SearchInTarget(CharPtrFromSPtr(lParam), wParam); - - case SCI_SETSEARCHFLAGS: - searchFlags = wParam; - break; - - case SCI_GETSEARCHFLAGS: - return searchFlags; - - case SCI_POSITIONBEFORE: - return pdoc->MovePositionOutsideChar(wParam - 1, -1, true); - - case SCI_POSITIONAFTER: - return pdoc->MovePositionOutsideChar(wParam + 1, 1, true); - - case SCI_LINESCROLL: - ScrollTo(topLine + lParam); - HorizontalScrollTo(xOffset + wParam * vs.spaceWidth); - return 1; - - case SCI_SETXOFFSET: - xOffset = wParam; - SetHorizontalScrollPos(); - Redraw(); - break; - - case SCI_GETXOFFSET: - return xOffset; - - case SCI_CHOOSECARETX: - SetLastXChosen(); - break; - - case SCI_SCROLLCARET: - EnsureCaretVisible(); - break; - - case SCI_SETREADONLY: - pdoc->SetReadOnly(wParam != 0); - return 1; - - case SCI_GETREADONLY: - return pdoc->IsReadOnly(); - - case SCI_CANPASTE: - return CanPaste(); - - case SCI_POINTXFROMPOSITION: - if (lParam < 0) { - return 0; - } else { - Point pt = LocationFromPosition(lParam); - return pt.x; - } - - case SCI_POINTYFROMPOSITION: - if (lParam < 0) { - return 0; - } else { - Point pt = LocationFromPosition(lParam); - return pt.y; - } - - case SCI_FINDTEXT: - return FindText(wParam, lParam); - - case SCI_GETTEXTRANGE: { - if (lParam == 0) - return 0; - TextRange *tr = reinterpret_cast(lParam); - int cpMax = tr->chrg.cpMax; - if (cpMax == -1) - cpMax = pdoc->Length(); - PLATFORM_ASSERT(cpMax <= pdoc->Length()); - int len = cpMax - tr->chrg.cpMin; // No -1 as cpMin and cpMax are referring to inter character positions - pdoc->GetCharRange(tr->lpstrText, tr->chrg.cpMin, len); - // Spec says copied text is terminated with a NUL - tr->lpstrText[len] = '\0'; - return len; // Not including NUL - } - - case SCI_HIDESELECTION: - hideSelection = wParam != 0; - Redraw(); - break; - - case SCI_FORMATRANGE: - return FormatRange(wParam != 0, reinterpret_cast(lParam)); - - case SCI_GETMARGINLEFT: - return vs.leftMarginWidth; - - case SCI_GETMARGINRIGHT: - return vs.rightMarginWidth; - - case SCI_SETMARGINLEFT: - vs.leftMarginWidth = lParam; - InvalidateStyleRedraw(); - break; - - case SCI_SETMARGINRIGHT: - vs.rightMarginWidth = lParam; - InvalidateStyleRedraw(); - break; - - // Control specific mesages - - case SCI_ADDTEXT: { - if (lParam == 0) - return 0; - pdoc->InsertString(CurrentPosition(), CharPtrFromSPtr(lParam), wParam); - SetEmptySelection(currentPos + wParam); - return 0; - } - - case SCI_ADDSTYLEDTEXT: - if (lParam) - AddStyledText(CharPtrFromSPtr(lParam), wParam); - return 0; - - case SCI_INSERTTEXT: { - if (lParam == 0) - return 0; - int insertPos = wParam; - if (static_cast(wParam) == -1) - insertPos = CurrentPosition(); - int newCurrent = CurrentPosition(); - char *sz = CharPtrFromSPtr(lParam); - pdoc->InsertCString(insertPos, sz); - if (newCurrent > insertPos) - newCurrent += istrlen(sz); - SetEmptySelection(newCurrent); - return 0; - } - - case SCI_APPENDTEXT: - pdoc->InsertString(pdoc->Length(), CharPtrFromSPtr(lParam), wParam); - return 0; - - case SCI_CLEARALL: - ClearAll(); - return 0; - - case SCI_CLEARDOCUMENTSTYLE: - ClearDocumentStyle(); - return 0; - - case SCI_SETUNDOCOLLECTION: - pdoc->SetUndoCollection(wParam != 0); - return 0; - - case SCI_GETUNDOCOLLECTION: - return pdoc->IsCollectingUndo(); - - case SCI_BEGINUNDOACTION: - pdoc->BeginUndoAction(); - return 0; - - case SCI_ENDUNDOACTION: - pdoc->EndUndoAction(); - return 0; - - case SCI_GETCARETPERIOD: - return caret.period; - - case SCI_SETCARETPERIOD: - caret.period = wParam; - break; - - case SCI_SETWORDCHARS: { - pdoc->SetDefaultCharClasses(false); - if (lParam == 0) - return 0; - pdoc->SetCharClasses(reinterpret_cast(lParam), CharClassify::ccWord); - } - break; - - case SCI_SETWHITESPACECHARS: { - if (lParam == 0) - return 0; - pdoc->SetCharClasses(reinterpret_cast(lParam), CharClassify::ccSpace); - } - break; - - case SCI_SETCHARSDEFAULT: - pdoc->SetDefaultCharClasses(true); - break; - - case SCI_GETLENGTH: - return pdoc->Length(); - - case SCI_ALLOCATE: - pdoc->Allocate(wParam); - break; - - case SCI_GETCHARAT: - return pdoc->CharAt(wParam); - - case SCI_SETCURRENTPOS: - SetSelection(wParam, anchor); - break; - - case SCI_GETCURRENTPOS: - return currentPos; - - case SCI_SETANCHOR: - SetSelection(currentPos, wParam); - break; - - case SCI_GETANCHOR: - return anchor; - - case SCI_SETSELECTIONSTART: - SetSelection(Platform::Maximum(currentPos, wParam), wParam); - break; - - case SCI_GETSELECTIONSTART: - return Platform::Minimum(anchor, currentPos); - - case SCI_SETSELECTIONEND: - SetSelection(wParam, Platform::Minimum(anchor, wParam)); - break; - - case SCI_GETSELECTIONEND: - return Platform::Maximum(anchor, currentPos); - - case SCI_SETPRINTMAGNIFICATION: - printMagnification = wParam; - break; - - case SCI_GETPRINTMAGNIFICATION: - return printMagnification; - - case SCI_SETPRINTCOLOURMODE: - printColourMode = wParam; - break; - - case SCI_GETPRINTCOLOURMODE: - return printColourMode; - - case SCI_SETPRINTWRAPMODE: - printWrapState = (wParam == SC_WRAP_WORD) ? eWrapWord : eWrapNone; - break; - - case SCI_GETPRINTWRAPMODE: - return printWrapState; - - case SCI_GETSTYLEAT: - if (static_cast(wParam) >= pdoc->Length()) - return 0; - else - return pdoc->StyleAt(wParam); - - case SCI_REDO: - Redo(); - break; - - case SCI_SELECTALL: - SelectAll(); - break; - - case SCI_SETSAVEPOINT: - pdoc->SetSavePoint(); - break; - - case SCI_GETSTYLEDTEXT: { - if (lParam == 0) - return 0; - TextRange *tr = reinterpret_cast(lParam); - int iPlace = 0; - for (int iChar = tr->chrg.cpMin; iChar < tr->chrg.cpMax; iChar++) { - tr->lpstrText[iPlace++] = pdoc->CharAt(iChar); - tr->lpstrText[iPlace++] = pdoc->StyleAt(iChar); - } - tr->lpstrText[iPlace] = '\0'; - tr->lpstrText[iPlace + 1] = '\0'; - return iPlace; - } - - case SCI_CANREDO: - return (pdoc->CanRedo() && !pdoc->IsReadOnly()) ? 1 : 0; - - case SCI_MARKERLINEFROMHANDLE: - return pdoc->LineFromHandle(wParam); - - case SCI_MARKERDELETEHANDLE: - pdoc->DeleteMarkFromHandle(wParam); - break; - - case SCI_GETVIEWWS: - return vs.viewWhitespace; - - case SCI_SETVIEWWS: - vs.viewWhitespace = static_cast(wParam); - Redraw(); - break; - - case SCI_POSITIONFROMPOINT: - return PositionFromLocation(Point(wParam, lParam)); - - case SCI_POSITIONFROMPOINTCLOSE: - return PositionFromLocationClose(Point(wParam, lParam)); - - case SCI_GOTOLINE: - GoToLine(wParam); - break; - - case SCI_GOTOPOS: - SetEmptySelection(wParam); - EnsureCaretVisible(); - Redraw(); - break; - - case SCI_GETCURLINE: { - int lineCurrentPos = pdoc->LineFromPosition(currentPos); - int lineStart = pdoc->LineStart(lineCurrentPos); - unsigned int lineEnd = pdoc->LineStart(lineCurrentPos + 1); - if (lParam == 0) { - return 1 + lineEnd - lineStart; - } - PLATFORM_ASSERT(wParam > 0); - char *ptr = CharPtrFromSPtr(lParam); - unsigned int iPlace = 0; - for (unsigned int iChar = lineStart; iChar < lineEnd && iPlace < wParam - 1; iChar++) { - ptr[iPlace++] = pdoc->CharAt(iChar); - } - ptr[iPlace] = '\0'; - return currentPos - lineStart; - } - - case SCI_GETENDSTYLED: - return pdoc->GetEndStyled(); - - case SCI_GETEOLMODE: - return pdoc->eolMode; - - case SCI_SETEOLMODE: - pdoc->eolMode = wParam; - break; - - case SCI_STARTSTYLING: - pdoc->StartStyling(wParam, static_cast(lParam)); - break; - - case SCI_SETSTYLING: - pdoc->SetStyleFor(wParam, static_cast(lParam)); - break; - - case SCI_SETSTYLINGEX: // Specify a complete styling buffer - if (lParam == 0) - return 0; - pdoc->SetStyles(wParam, CharPtrFromSPtr(lParam)); - break; - - case SCI_SETBUFFEREDDRAW: - bufferedDraw = wParam != 0; - break; - - case SCI_GETBUFFEREDDRAW: - return bufferedDraw; - - case SCI_GETTWOPHASEDRAW: - return twoPhaseDraw; - - case SCI_SETTWOPHASEDRAW: - twoPhaseDraw = wParam != 0; - InvalidateStyleRedraw(); - break; - - case SCI_SETTABWIDTH: - if (wParam > 0) { - pdoc->tabInChars = wParam; - if (pdoc->indentInChars == 0) - pdoc->actualIndentInChars = pdoc->tabInChars; - } - InvalidateStyleRedraw(); - break; - - case SCI_GETTABWIDTH: - return pdoc->tabInChars; - - case SCI_SETINDENT: - pdoc->indentInChars = wParam; - if (pdoc->indentInChars != 0) - pdoc->actualIndentInChars = pdoc->indentInChars; - else - pdoc->actualIndentInChars = pdoc->tabInChars; - InvalidateStyleRedraw(); - break; - - case SCI_GETINDENT: - return pdoc->indentInChars; - - case SCI_SETUSETABS: - pdoc->useTabs = wParam != 0; - InvalidateStyleRedraw(); - break; - - case SCI_GETUSETABS: - return pdoc->useTabs; - - case SCI_SETLINEINDENTATION: - pdoc->SetLineIndentation(wParam, lParam); - break; - - case SCI_GETLINEINDENTATION: - return pdoc->GetLineIndentation(wParam); - - case SCI_GETLINEINDENTPOSITION: - return pdoc->GetLineIndentPosition(wParam); - - case SCI_SETTABINDENTS: - pdoc->tabIndents = wParam != 0; - break; - - case SCI_GETTABINDENTS: - return pdoc->tabIndents; - - case SCI_SETBACKSPACEUNINDENTS: - pdoc->backspaceUnindents = wParam != 0; - break; - - case SCI_GETBACKSPACEUNINDENTS: - return pdoc->backspaceUnindents; - - case SCI_SETMOUSEDWELLTIME: - dwellDelay = wParam; - ticksToDwell = dwellDelay; - break; - - case SCI_GETMOUSEDWELLTIME: - return dwellDelay; - - case SCI_WORDSTARTPOSITION: - return pdoc->ExtendWordSelect(wParam, -1, lParam != 0); - - case SCI_WORDENDPOSITION: - return pdoc->ExtendWordSelect(wParam, 1, lParam != 0); - - case SCI_SETWRAPMODE: - switch (wParam) { - case SC_WRAP_WORD: - wrapState = eWrapWord; - break; - case SC_WRAP_CHAR: - wrapState = eWrapChar; - break; - default: - wrapState = eWrapNone; - break; - } - xOffset = 0; - InvalidateStyleRedraw(); - ReconfigureScrollBars(); - break; - - case SCI_GETWRAPMODE: - return wrapState; - - case SCI_SETWRAPVISUALFLAGS: - wrapVisualFlags = wParam; - actualWrapVisualStartIndent = wrapVisualStartIndent; - if ((wrapVisualFlags & SC_WRAPVISUALFLAG_START) && (actualWrapVisualStartIndent == 0)) - actualWrapVisualStartIndent = 1; // must indent to show start visual - InvalidateStyleRedraw(); - ReconfigureScrollBars(); - break; - - case SCI_GETWRAPVISUALFLAGS: - return wrapVisualFlags; - - case SCI_SETWRAPVISUALFLAGSLOCATION: - wrapVisualFlagsLocation = wParam; - InvalidateStyleRedraw(); - break; - - case SCI_GETWRAPVISUALFLAGSLOCATION: - return wrapVisualFlagsLocation; - - case SCI_SETWRAPSTARTINDENT: - wrapVisualStartIndent = wParam; - actualWrapVisualStartIndent = wrapVisualStartIndent; - if ((wrapVisualFlags & SC_WRAPVISUALFLAG_START) && (actualWrapVisualStartIndent == 0)) - actualWrapVisualStartIndent = 1; // must indent to show start visual - InvalidateStyleRedraw(); - ReconfigureScrollBars(); - break; - - case SCI_GETWRAPSTARTINDENT: - return wrapVisualStartIndent; - - case SCI_SETLAYOUTCACHE: - llc.SetLevel(wParam); - break; - - case SCI_GETLAYOUTCACHE: - return llc.GetLevel(); - - case SCI_SETPOSITIONCACHE: - posCache.SetSize(wParam); - break; - - case SCI_GETPOSITIONCACHE: - return posCache.GetSize(); - - case SCI_SETSCROLLWIDTH: - PLATFORM_ASSERT(wParam > 0); - if ((wParam > 0) && (wParam != static_cast(scrollWidth))) { - lineWidthMaxSeen = 0; - scrollWidth = wParam; - SetScrollBars(); - } - break; - - case SCI_GETSCROLLWIDTH: - return scrollWidth; - - case SCI_SETSCROLLWIDTHTRACKING: - trackLineWidth = wParam != 0; - break; - - case SCI_GETSCROLLWIDTHTRACKING: - return trackLineWidth; - - case SCI_LINESJOIN: - LinesJoin(); - break; - - case SCI_LINESSPLIT: - LinesSplit(wParam); - break; - - case SCI_TEXTWIDTH: - PLATFORM_ASSERT(wParam < vs.stylesSize); - PLATFORM_ASSERT(lParam); - return TextWidth(wParam, CharPtrFromSPtr(lParam)); - - case SCI_TEXTHEIGHT: - return vs.lineHeight; - - case SCI_SETENDATLASTLINE: - PLATFORM_ASSERT((wParam == 0) || (wParam == 1)); - if (endAtLastLine != (wParam != 0)) { - endAtLastLine = wParam != 0; - SetScrollBars(); - } - break; - - case SCI_GETENDATLASTLINE: - return endAtLastLine; - - case SCI_SETCARETSTICKY: - PLATFORM_ASSERT((wParam == 0) || (wParam == 1)); - if (caretSticky != (wParam != 0)) { - caretSticky = wParam != 0; - } - break; - - case SCI_GETCARETSTICKY: - return caretSticky; - - case SCI_TOGGLECARETSTICKY: - caretSticky = !caretSticky; - break; - - case SCI_GETCOLUMN: - return pdoc->GetColumn(wParam); - - case SCI_FINDCOLUMN: - return pdoc->FindColumn(wParam, lParam); - - case SCI_SETHSCROLLBAR : - if (horizontalScrollBarVisible != (wParam != 0)) { - horizontalScrollBarVisible = wParam != 0; - SetScrollBars(); - ReconfigureScrollBars(); - } - break; - - case SCI_GETHSCROLLBAR: - return horizontalScrollBarVisible; - - case SCI_SETVSCROLLBAR: - if (verticalScrollBarVisible != (wParam != 0)) { - verticalScrollBarVisible = wParam != 0; - SetScrollBars(); - ReconfigureScrollBars(); - } - break; - - case SCI_GETVSCROLLBAR: - return verticalScrollBarVisible; - - case SCI_SETINDENTATIONGUIDES: - vs.viewIndentationGuides = IndentView(wParam); - Redraw(); - break; - - case SCI_GETINDENTATIONGUIDES: - return vs.viewIndentationGuides; - - case SCI_SETHIGHLIGHTGUIDE: - if ((highlightGuideColumn != static_cast(wParam)) || (wParam > 0)) { - highlightGuideColumn = wParam; - Redraw(); - } - break; - - case SCI_GETHIGHLIGHTGUIDE: - return highlightGuideColumn; - - case SCI_GETLINEENDPOSITION: - return pdoc->LineEnd(wParam); - - case SCI_SETCODEPAGE: - if (ValidCodePage(wParam)) { - pdoc->dbcsCodePage = wParam; - InvalidateStyleRedraw(); - } - break; - - case SCI_GETCODEPAGE: - return pdoc->dbcsCodePage; - - case SCI_SETUSEPALETTE: - palette.allowRealization = wParam != 0; - InvalidateStyleRedraw(); - break; - - case SCI_GETUSEPALETTE: - return palette.allowRealization; - - // Marker definition and setting - case SCI_MARKERDEFINE: - if (wParam <= MARKER_MAX) - vs.markers[wParam].markType = lParam; - InvalidateStyleData(); - RedrawSelMargin(); - break; - case SCI_MARKERSETFORE: - if (wParam <= MARKER_MAX) - vs.markers[wParam].fore.desired = ColourDesired(lParam); - InvalidateStyleData(); - RedrawSelMargin(); - break; - case SCI_MARKERSETBACK: - if (wParam <= MARKER_MAX) - vs.markers[wParam].back.desired = ColourDesired(lParam); - InvalidateStyleData(); - RedrawSelMargin(); - break; - case SCI_MARKERSETALPHA: - if (wParam <= MARKER_MAX) - vs.markers[wParam].alpha = lParam; - InvalidateStyleRedraw(); - break; - case SCI_MARKERADD: { - int markerID = pdoc->AddMark(wParam, lParam); - return markerID; - } - case SCI_MARKERADDSET: - if (lParam != 0) - pdoc->AddMarkSet(wParam, lParam); - break; - - case SCI_MARKERDELETE: - pdoc->DeleteMark(wParam, lParam); - break; - - case SCI_MARKERDELETEALL: - pdoc->DeleteAllMarks(static_cast(wParam)); - break; - - case SCI_MARKERGET: - return pdoc->GetMark(wParam); - - case SCI_MARKERNEXT: { - int lt = pdoc->LinesTotal(); - for (int iLine = wParam; iLine < lt; iLine++) { - if ((pdoc->GetMark(iLine) & lParam) != 0) - return iLine; - } - } - return -1; - - case SCI_MARKERPREVIOUS: { - for (int iLine = wParam; iLine >= 0; iLine--) { - if ((pdoc->GetMark(iLine) & lParam) != 0) - return iLine; - } - } - return -1; - - case SCI_MARKERDEFINEPIXMAP: - if (wParam <= MARKER_MAX) { - vs.markers[wParam].SetXPM(CharPtrFromSPtr(lParam)); - }; - InvalidateStyleData(); - RedrawSelMargin(); - break; - - case SCI_SETMARGINTYPEN: - if (ValidMargin(wParam)) { - vs.ms[wParam].style = lParam; - InvalidateStyleRedraw(); - } - break; - - case SCI_GETMARGINTYPEN: - if (ValidMargin(wParam)) - return vs.ms[wParam].style; - else - return 0; - - case SCI_SETMARGINWIDTHN: - if (ValidMargin(wParam)) { - // Short-circuit if the width is unchanged, to avoid unnecessary redraw. - if (vs.ms[wParam].width != lParam) { - vs.ms[wParam].width = lParam; - InvalidateStyleRedraw(); - } - } - break; - - case SCI_GETMARGINWIDTHN: - if (ValidMargin(wParam)) - return vs.ms[wParam].width; - else - return 0; - - case SCI_SETMARGINMASKN: - if (ValidMargin(wParam)) { - vs.ms[wParam].mask = lParam; - InvalidateStyleRedraw(); - } - break; - - case SCI_GETMARGINMASKN: - if (ValidMargin(wParam)) - return vs.ms[wParam].mask; - else - return 0; - - case SCI_SETMARGINSENSITIVEN: - if (ValidMargin(wParam)) { - vs.ms[wParam].sensitive = lParam != 0; - InvalidateStyleRedraw(); - } - break; - - case SCI_GETMARGINSENSITIVEN: - if (ValidMargin(wParam)) - return vs.ms[wParam].sensitive ? 1 : 0; - else - return 0; - - case SCI_STYLECLEARALL: - vs.ClearStyles(); - InvalidateStyleRedraw(); - break; - - case SCI_STYLESETFORE: - case SCI_STYLESETBACK: - case SCI_STYLESETBOLD: - case SCI_STYLESETITALIC: - case SCI_STYLESETEOLFILLED: - case SCI_STYLESETSIZE: - case SCI_STYLESETFONT: - case SCI_STYLESETUNDERLINE: - case SCI_STYLESETCASE: - case SCI_STYLESETCHARACTERSET: - case SCI_STYLESETVISIBLE: - case SCI_STYLESETCHANGEABLE: - case SCI_STYLESETHOTSPOT: - StyleSetMessage(iMessage, wParam, lParam); - break; - - case SCI_STYLEGETFORE: - case SCI_STYLEGETBACK: - case SCI_STYLEGETBOLD: - case SCI_STYLEGETITALIC: - case SCI_STYLEGETEOLFILLED: - case SCI_STYLEGETSIZE: - case SCI_STYLEGETFONT: - case SCI_STYLEGETUNDERLINE: - case SCI_STYLEGETCASE: - case SCI_STYLEGETCHARACTERSET: - case SCI_STYLEGETVISIBLE: - case SCI_STYLEGETCHANGEABLE: - case SCI_STYLEGETHOTSPOT: - return StyleGetMessage(iMessage, wParam, lParam); - - case SCI_STYLERESETDEFAULT: - vs.ResetDefaultStyle(); - InvalidateStyleRedraw(); - break; - case SCI_SETSTYLEBITS: - vs.EnsureStyle((1 << wParam) - 1); - pdoc->SetStylingBits(wParam); - break; - - case SCI_GETSTYLEBITS: - return pdoc->stylingBits; - - case SCI_SETLINESTATE: - return pdoc->SetLineState(wParam, lParam); - - case SCI_GETLINESTATE: - return pdoc->GetLineState(wParam); - - case SCI_GETMAXLINESTATE: - return pdoc->GetMaxLineState(); - - case SCI_GETCARETLINEVISIBLE: - return vs.showCaretLineBackground; - case SCI_SETCARETLINEVISIBLE: - vs.showCaretLineBackground = wParam != 0; - InvalidateStyleRedraw(); - break; - case SCI_GETCARETLINEBACK: - return vs.caretLineBackground.desired.AsLong(); - case SCI_SETCARETLINEBACK: - vs.caretLineBackground.desired = wParam; - InvalidateStyleRedraw(); - break; - case SCI_GETCARETLINEBACKALPHA: - return vs.caretLineAlpha; - case SCI_SETCARETLINEBACKALPHA: - vs.caretLineAlpha = wParam; - InvalidateStyleRedraw(); - break; - - // Folding messages - - case SCI_VISIBLEFROMDOCLINE: - return cs.DisplayFromDoc(wParam); - - case SCI_DOCLINEFROMVISIBLE: - return cs.DocFromDisplay(wParam); - - case SCI_WRAPCOUNT: - return WrapCount(wParam); - - case SCI_SETFOLDLEVEL: { - int prev = pdoc->SetLevel(wParam, lParam); - if (prev != lParam) - RedrawSelMargin(); - return prev; - } - - case SCI_GETFOLDLEVEL: - return pdoc->GetLevel(wParam); - - case SCI_GETLASTCHILD: - return pdoc->GetLastChild(wParam, lParam); - - case SCI_GETFOLDPARENT: - return pdoc->GetFoldParent(wParam); - - case SCI_SHOWLINES: - cs.SetVisible(wParam, lParam, true); - SetScrollBars(); - Redraw(); - break; - - case SCI_HIDELINES: - cs.SetVisible(wParam, lParam, false); - SetScrollBars(); - Redraw(); - break; - - case SCI_GETLINEVISIBLE: - return cs.GetVisible(wParam); - - case SCI_SETFOLDEXPANDED: - if (cs.SetExpanded(wParam, lParam != 0)) { - RedrawSelMargin(); - } - break; - - case SCI_GETFOLDEXPANDED: - return cs.GetExpanded(wParam); - - case SCI_SETFOLDFLAGS: - foldFlags = wParam; - Redraw(); - break; - - case SCI_TOGGLEFOLD: - ToggleContraction(wParam); - break; - - case SCI_ENSUREVISIBLE: - EnsureLineVisible(wParam, false); - break; - - case SCI_ENSUREVISIBLEENFORCEPOLICY: - EnsureLineVisible(wParam, true); - break; - - case SCI_SEARCHANCHOR: - SearchAnchor(); - break; - - case SCI_SEARCHNEXT: - case SCI_SEARCHPREV: - return SearchText(iMessage, wParam, lParam); - -#ifdef INCLUDE_DEPRECATED_FEATURES - case SCI_SETCARETPOLICY: // Deprecated - caretXPolicy = caretYPolicy = wParam; - caretXSlop = caretYSlop = lParam; - break; -#endif - - case SCI_SETXCARETPOLICY: - caretXPolicy = wParam; - caretXSlop = lParam; - break; - - case SCI_SETYCARETPOLICY: - caretYPolicy = wParam; - caretYSlop = lParam; - break; - - case SCI_SETVISIBLEPOLICY: - visiblePolicy = wParam; - visibleSlop = lParam; - break; - - case SCI_LINESONSCREEN: - return LinesOnScreen(); - - case SCI_SETSELFORE: - vs.selforeset = wParam != 0; - vs.selforeground.desired = ColourDesired(lParam); - InvalidateStyleRedraw(); - break; - - case SCI_SETSELBACK: - vs.selbackset = wParam != 0; - vs.selbackground.desired = ColourDesired(lParam); - InvalidateStyleRedraw(); - break; - - case SCI_SETSELALPHA: - vs.selAlpha = wParam; - InvalidateStyleRedraw(); - break; - - case SCI_GETSELALPHA: - return vs.selAlpha; - - case SCI_GETSELEOLFILLED: - return vs.selEOLFilled; - - case SCI_SETSELEOLFILLED: - vs.selEOLFilled = wParam != 0; - InvalidateStyleRedraw(); - break; - - case SCI_SETWHITESPACEFORE: - vs.whitespaceForegroundSet = wParam != 0; - vs.whitespaceForeground.desired = ColourDesired(lParam); - InvalidateStyleRedraw(); - break; - - case SCI_SETWHITESPACEBACK: - vs.whitespaceBackgroundSet = wParam != 0; - vs.whitespaceBackground.desired = ColourDesired(lParam); - InvalidateStyleRedraw(); - break; - - case SCI_SETCARETFORE: - vs.caretcolour.desired = ColourDesired(wParam); - InvalidateStyleRedraw(); - break; - - case SCI_GETCARETFORE: - return vs.caretcolour.desired.AsLong(); - - case SCI_SETCARETSTYLE: - if (wParam >= CARETSTYLE_INVISIBLE && wParam <= CARETSTYLE_BLOCK) - vs.caretStyle = wParam; - else - /* Default to the line caret */ - vs.caretStyle = CARETSTYLE_LINE; - InvalidateStyleRedraw(); - break; - - case SCI_GETCARETSTYLE: - return vs.caretStyle; - - case SCI_SETCARETWIDTH: - if (wParam <= 0) - vs.caretWidth = 0; - else if (wParam >= 3) - vs.caretWidth = 3; - else - vs.caretWidth = wParam; - InvalidateStyleRedraw(); - break; - - case SCI_GETCARETWIDTH: - return vs.caretWidth; - - case SCI_ASSIGNCMDKEY: - kmap.AssignCmdKey(Platform::LowShortFromLong(wParam), - Platform::HighShortFromLong(wParam), lParam); - break; - - case SCI_CLEARCMDKEY: - kmap.AssignCmdKey(Platform::LowShortFromLong(wParam), - Platform::HighShortFromLong(wParam), SCI_NULL); - break; - - case SCI_CLEARALLCMDKEYS: - kmap.Clear(); - break; - - case SCI_INDICSETSTYLE: - if (wParam <= INDIC_MAX) { - vs.indicators[wParam].style = lParam; - InvalidateStyleRedraw(); - } - break; - - case SCI_INDICGETSTYLE: - return (wParam <= INDIC_MAX) ? vs.indicators[wParam].style : 0; - - case SCI_INDICSETFORE: - if (wParam <= INDIC_MAX) { - vs.indicators[wParam].fore.desired = ColourDesired(lParam); - InvalidateStyleRedraw(); - } - break; - - case SCI_INDICGETFORE: - return (wParam <= INDIC_MAX) ? vs.indicators[wParam].fore.desired.AsLong() : 0; - - case SCI_INDICSETUNDER: - if (wParam <= INDIC_MAX) { - vs.indicators[wParam].under = lParam != 0; - InvalidateStyleRedraw(); - } - break; - - case SCI_INDICGETUNDER: - return (wParam <= INDIC_MAX) ? vs.indicators[wParam].under : 0; - - case SCI_SETINDICATORCURRENT: - pdoc->decorations.SetCurrentIndicator(wParam); - break; - case SCI_GETINDICATORCURRENT: - return pdoc->decorations.GetCurrentIndicator(); - case SCI_SETINDICATORVALUE: - pdoc->decorations.SetCurrentValue(wParam); - break; - case SCI_GETINDICATORVALUE: - return pdoc->decorations.GetCurrentValue(); - - case SCI_INDICATORFILLRANGE: - pdoc->DecorationFillRange(wParam, pdoc->decorations.GetCurrentValue(), lParam); - break; - - case SCI_INDICATORCLEARRANGE: - pdoc->DecorationFillRange(wParam, 0, lParam); - break; - - case SCI_INDICATORALLONFOR: - return pdoc->decorations.AllOnFor(wParam); - - case SCI_INDICATORVALUEAT: - return pdoc->decorations.ValueAt(wParam, lParam); - - case SCI_INDICATORSTART: - return pdoc->decorations.Start(wParam, lParam); - - case SCI_INDICATOREND: - return pdoc->decorations.End(wParam, lParam); - - case SCI_LINEDOWN: - case SCI_LINEDOWNEXTEND: - case SCI_PARADOWN: - case SCI_PARADOWNEXTEND: - case SCI_LINEUP: - case SCI_LINEUPEXTEND: - case SCI_PARAUP: - case SCI_PARAUPEXTEND: - case SCI_CHARLEFT: - case SCI_CHARLEFTEXTEND: - case SCI_CHARRIGHT: - case SCI_CHARRIGHTEXTEND: - case SCI_WORDLEFT: - case SCI_WORDLEFTEXTEND: - case SCI_WORDRIGHT: - case SCI_WORDRIGHTEXTEND: - case SCI_WORDLEFTEND: - case SCI_WORDLEFTENDEXTEND: - case SCI_WORDRIGHTEND: - case SCI_WORDRIGHTENDEXTEND: - case SCI_HOME: - case SCI_HOMEEXTEND: - case SCI_LINEEND: - case SCI_LINEENDEXTEND: - case SCI_HOMEWRAP: - case SCI_HOMEWRAPEXTEND: - case SCI_LINEENDWRAP: - case SCI_LINEENDWRAPEXTEND: - case SCI_DOCUMENTSTART: - case SCI_DOCUMENTSTARTEXTEND: - case SCI_DOCUMENTEND: - case SCI_DOCUMENTENDEXTEND: - - case SCI_STUTTEREDPAGEUP: - case SCI_STUTTEREDPAGEUPEXTEND: - case SCI_STUTTEREDPAGEDOWN: - case SCI_STUTTEREDPAGEDOWNEXTEND: - - case SCI_PAGEUP: - case SCI_PAGEUPEXTEND: - case SCI_PAGEDOWN: - case SCI_PAGEDOWNEXTEND: - case SCI_EDITTOGGLEOVERTYPE: - case SCI_CANCEL: - case SCI_DELETEBACK: - case SCI_TAB: - case SCI_BACKTAB: - case SCI_NEWLINE: - case SCI_FORMFEED: - case SCI_VCHOME: - case SCI_VCHOMEEXTEND: - case SCI_VCHOMEWRAP: - case SCI_VCHOMEWRAPEXTEND: - case SCI_ZOOMIN: - case SCI_ZOOMOUT: - case SCI_DELWORDLEFT: - case SCI_DELWORDRIGHT: - case SCI_DELWORDRIGHTEND: - case SCI_DELLINELEFT: - case SCI_DELLINERIGHT: - case SCI_LINECOPY: - case SCI_LINECUT: - case SCI_LINEDELETE: - case SCI_LINETRANSPOSE: - case SCI_LINEDUPLICATE: - case SCI_LOWERCASE: - case SCI_UPPERCASE: - case SCI_LINESCROLLDOWN: - case SCI_LINESCROLLUP: - case SCI_WORDPARTLEFT: - case SCI_WORDPARTLEFTEXTEND: - case SCI_WORDPARTRIGHT: - case SCI_WORDPARTRIGHTEXTEND: - case SCI_DELETEBACKNOTLINE: - case SCI_HOMEDISPLAY: - case SCI_HOMEDISPLAYEXTEND: - case SCI_LINEENDDISPLAY: - case SCI_LINEENDDISPLAYEXTEND: - case SCI_LINEDOWNRECTEXTEND: - case SCI_LINEUPRECTEXTEND: - case SCI_CHARLEFTRECTEXTEND: - case SCI_CHARRIGHTRECTEXTEND: - case SCI_HOMERECTEXTEND: - case SCI_VCHOMERECTEXTEND: - case SCI_LINEENDRECTEXTEND: - case SCI_PAGEUPRECTEXTEND: - case SCI_PAGEDOWNRECTEXTEND: - case SCI_SELECTIONDUPLICATE: - return KeyCommand(iMessage); - - case SCI_BRACEHIGHLIGHT: - SetBraceHighlight(static_cast(wParam), lParam, STYLE_BRACELIGHT); - break; - - case SCI_BRACEBADLIGHT: - SetBraceHighlight(static_cast(wParam), -1, STYLE_BRACEBAD); - break; - - case SCI_BRACEMATCH: - // wParam is position of char to find brace for, - // lParam is maximum amount of text to restyle to find it - return pdoc->BraceMatch(wParam, lParam); - - case SCI_GETVIEWEOL: - return vs.viewEOL; - - case SCI_SETVIEWEOL: - vs.viewEOL = wParam != 0; - InvalidateStyleRedraw(); - break; - - case SCI_SETZOOM: - vs.zoomLevel = wParam; - InvalidateStyleRedraw(); - NotifyZoom(); - break; - - case SCI_GETZOOM: - return vs.zoomLevel; - - case SCI_GETEDGECOLUMN: - return theEdge; - - case SCI_SETEDGECOLUMN: - theEdge = wParam; - InvalidateStyleRedraw(); - break; - - case SCI_GETEDGEMODE: - return vs.edgeState; - - case SCI_SETEDGEMODE: - vs.edgeState = wParam; - InvalidateStyleRedraw(); - break; - - case SCI_GETEDGECOLOUR: - return vs.edgecolour.desired.AsLong(); - - case SCI_SETEDGECOLOUR: - vs.edgecolour.desired = ColourDesired(wParam); - InvalidateStyleRedraw(); - break; - - case SCI_GETDOCPOINTER: - return reinterpret_cast(pdoc); - - case SCI_SETDOCPOINTER: - CancelModes(); - SetDocPointer(reinterpret_cast(lParam)); - return 0; - - case SCI_CREATEDOCUMENT: { - Document *doc = new Document(); - if (doc) { - doc->AddRef(); - } - return reinterpret_cast(doc); - } - - case SCI_ADDREFDOCUMENT: - (reinterpret_cast(lParam))->AddRef(); - break; - - case SCI_RELEASEDOCUMENT: - (reinterpret_cast(lParam))->Release(); - break; - - case SCI_SETMODEVENTMASK: - modEventMask = wParam; - return 0; - - case SCI_GETMODEVENTMASK: - return modEventMask; - - case SCI_CONVERTEOLS: - pdoc->ConvertLineEnds(wParam); - SetSelection(currentPos, anchor); // Ensure selection inside document - return 0; - - case SCI_SETLENGTHFORENCODE: - lengthForEncode = wParam; - return 0; - - case SCI_SELECTIONISRECTANGLE: - return selType == selRectangle ? 1 : 0; - - case SCI_SETSELECTIONMODE: { - switch (wParam) { - case SC_SEL_STREAM: - moveExtendsSelection = !moveExtendsSelection || (selType != selStream); - selType = selStream; - break; - case SC_SEL_RECTANGLE: - moveExtendsSelection = !moveExtendsSelection || (selType != selRectangle); - selType = selRectangle; - break; - case SC_SEL_LINES: - moveExtendsSelection = !moveExtendsSelection || (selType != selLines); - selType = selLines; - break; - default: - moveExtendsSelection = !moveExtendsSelection || (selType != selStream); - selType = selStream; - } - InvalidateSelection(currentPos, anchor, true); - } - case SCI_GETSELECTIONMODE: - switch (selType) { - case selStream: - return SC_SEL_STREAM; - case selRectangle: - return SC_SEL_RECTANGLE; - case selLines: - return SC_SEL_LINES; - default: // ?! - return SC_SEL_STREAM; - } - case SCI_GETLINESELSTARTPOSITION: { - SelectionLineIterator lineIterator(this); - lineIterator.SetAt(wParam); - return lineIterator.startPos; - } - case SCI_GETLINESELENDPOSITION: { - SelectionLineIterator lineIterator(this); - lineIterator.SetAt(wParam); - return lineIterator.endPos; - } - - case SCI_SETOVERTYPE: - inOverstrike = wParam != 0; - break; - - case SCI_GETOVERTYPE: - return inOverstrike ? 1 : 0; - - case SCI_SETFOCUS: - SetFocusState(wParam != 0); - break; - - case SCI_GETFOCUS: - return hasFocus; - - case SCI_SETSTATUS: - errorStatus = wParam; - break; - - case SCI_GETSTATUS: - return errorStatus; - - case SCI_SETMOUSEDOWNCAPTURES: - mouseDownCaptures = wParam != 0; - break; - - case SCI_GETMOUSEDOWNCAPTURES: - return mouseDownCaptures; - - case SCI_SETCURSOR: - cursorMode = wParam; - DisplayCursor(Window::cursorText); - break; - - case SCI_GETCURSOR: - return cursorMode; - - case SCI_SETCONTROLCHARSYMBOL: - controlCharSymbol = wParam; - break; - - case SCI_GETCONTROLCHARSYMBOL: - return controlCharSymbol; - - case SCI_STARTRECORD: - recordingMacro = true; - return 0; - - case SCI_STOPRECORD: - recordingMacro = false; - return 0; - - case SCI_MOVECARETINSIDEVIEW: - MoveCaretInsideView(); - break; - - case SCI_SETFOLDMARGINCOLOUR: - vs.foldmarginColourSet = wParam != 0; - vs.foldmarginColour.desired = ColourDesired(lParam); - InvalidateStyleRedraw(); - break; - - case SCI_SETFOLDMARGINHICOLOUR: - vs.foldmarginHighlightColourSet = wParam != 0; - vs.foldmarginHighlightColour.desired = ColourDesired(lParam); - InvalidateStyleRedraw(); - break; - - case SCI_SETHOTSPOTACTIVEFORE: - vs.hotspotForegroundSet = wParam != 0; - vs.hotspotForeground.desired = ColourDesired(lParam); - InvalidateStyleRedraw(); - break; - - case SCI_GETHOTSPOTACTIVEFORE: - return vs.hotspotForeground.desired.AsLong(); - - case SCI_SETHOTSPOTACTIVEBACK: - vs.hotspotBackgroundSet = wParam != 0; - vs.hotspotBackground.desired = ColourDesired(lParam); - InvalidateStyleRedraw(); - break; - - case SCI_GETHOTSPOTACTIVEBACK: - return vs.hotspotBackground.desired.AsLong(); - - case SCI_SETHOTSPOTACTIVEUNDERLINE: - vs.hotspotUnderline = wParam != 0; - InvalidateStyleRedraw(); - break; - - case SCI_GETHOTSPOTACTIVEUNDERLINE: - return vs.hotspotUnderline ? 1 : 0; - - case SCI_SETHOTSPOTSINGLELINE: - vs.hotspotSingleLine = wParam != 0; - InvalidateStyleRedraw(); - break; - - case SCI_GETHOTSPOTSINGLELINE: - return vs.hotspotSingleLine ? 1 : 0; - - case SCI_SETPASTECONVERTENDINGS: - convertPastes = wParam != 0; - break; - - case SCI_GETPASTECONVERTENDINGS: - return convertPastes ? 1 : 0; - - default: - return DefWndProc(iMessage, wParam, lParam); - } - //Platform::DebugPrintf("end wnd proc\n"); - return 0l; -} +// Scintilla source code edit control +/** @file Editor.cxx + ** Main code for the edit control. + **/ +// Copyright 1998-2004 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include + +#include +#include +#include + +// With Borland C++ 5.5, including includes Windows.h leading to defining +// FindText to FindTextA which makes calls here to Document::FindText fail. +#ifdef __BORLANDC__ +#ifdef FindText +#undef FindText +#endif +#endif + +#include "Platform.h" + +#include "Scintilla.h" + +#include "SplitVector.h" +#include "Partitioning.h" +#include "RunStyles.h" +#include "ContractionState.h" +#include "CellBuffer.h" +#include "KeyMap.h" +#include "Indicator.h" +#include "XPM.h" +#include "LineMarker.h" +#include "Style.h" +#include "ViewStyle.h" +#include "CharClassify.h" +#include "Decoration.h" +#include "Document.h" +#include "Selection.h" +#include "PositionCache.h" +#include "Editor.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +/* + return whether this modification represents an operation that + may reasonably be deferred (not done now OR [possibly] at all) +*/ +static bool CanDeferToLastStep(const DocModification& mh) { + if (mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) + return true; // CAN skip + if (!(mh.modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO))) + return false; // MUST do + if (mh.modificationType & SC_MULTISTEPUNDOREDO) + return true; // CAN skip + return false; // PRESUMABLY must do +} + +static bool CanEliminate(const DocModification& mh) { + return + (mh.modificationType & (SC_MOD_BEFOREINSERT | SC_MOD_BEFOREDELETE)) != 0; +} + +/* + return whether this modification represents the FINAL step + in a [possibly lengthy] multi-step Undo/Redo sequence +*/ +static bool IsLastStep(const DocModification& mh) { + return + (mh.modificationType & (SC_PERFORMED_UNDO | SC_PERFORMED_REDO)) != 0 + && (mh.modificationType & SC_MULTISTEPUNDOREDO) != 0 + && (mh.modificationType & SC_LASTSTEPINUNDOREDO) != 0 + && (mh.modificationType & SC_MULTILINEUNDOREDO) != 0; +} + +Caret::Caret() : + active(false), on(false), period(500) {} + +Timer::Timer() : + ticking(false), ticksToWait(0), tickerID(0) {} + +Idler::Idler() : + state(false), idlerID(0) {} + +static inline bool IsControlCharacter(int ch) { + // iscntrl returns true for lots of chars > 127 which are displayable + return ch >= 0 && ch < ' '; +} + +Editor::Editor() { + ctrlID = 0; + + stylesValid = false; + + printMagnification = 0; + printColourMode = SC_PRINT_NORMAL; + printWrapState = eWrapWord; + cursorMode = SC_CURSORNORMAL; + controlCharSymbol = 0; /* Draw the control characters */ + + hasFocus = false; + hideSelection = false; + inOverstrike = false; + errorStatus = 0; + mouseDownCaptures = true; + + bufferedDraw = true; + twoPhaseDraw = true; + + lastClickTime = 0; + dwellDelay = SC_TIME_FOREVER; + ticksToDwell = SC_TIME_FOREVER; + dwelling = false; + ptMouseLast.x = 0; + ptMouseLast.y = 0; + inDragDrop = ddNone; + dropWentOutside = false; + posDrag = SelectionPosition(invalidPosition); + posDrop = SelectionPosition(invalidPosition); + selectionType = selChar; + + lastXChosen = 0; + lineAnchor = 0; + originalAnchorPos = 0; + + primarySelection = true; + + caretXPolicy = CARET_SLOP | CARET_EVEN; + caretXSlop = 50; + + caretYPolicy = CARET_EVEN; + caretYSlop = 0; + + searchAnchor = 0; + + xOffset = 0; + xCaretMargin = 50; + horizontalScrollBarVisible = true; + scrollWidth = 2000; + trackLineWidth = false; + lineWidthMaxSeen = 0; + verticalScrollBarVisible = true; + endAtLastLine = true; + caretSticky = false; + multipleSelection = false; + additionalSelectionTyping = false; + additionalCaretsBlink = true; + virtualSpaceOptions = SCVS_NONE; + + pixmapLine = Surface::Allocate(); + pixmapSelMargin = Surface::Allocate(); + pixmapSelPattern = Surface::Allocate(); + pixmapIndentGuide = Surface::Allocate(); + pixmapIndentGuideHighlight = Surface::Allocate(); + + targetStart = 0; + targetEnd = 0; + searchFlags = 0; + + topLine = 0; + posTopLine = 0; + + lengthForEncode = -1; + + needUpdateUI = true; + braces[0] = invalidPosition; + braces[1] = invalidPosition; + bracesMatchStyle = STYLE_BRACEBAD; + highlightGuideColumn = 0; + + theEdge = 0; + + paintState = notPainting; + + modEventMask = SC_MODEVENTMASKALL; + + pdoc = new Document(); + pdoc->AddRef(); + pdoc->AddWatcher(this, 0); + + recordingMacro = false; + foldFlags = 0; + + wrapState = eWrapNone; + wrapWidth = LineLayout::wrapWidthInfinite; + wrapStart = wrapLineLarge; + wrapEnd = wrapLineLarge; + wrapVisualFlags = 0; + wrapVisualFlagsLocation = 0; + wrapVisualStartIndent = 0; + wrapIndentMode = SC_WRAPINDENT_FIXED; + wrapAddIndent = 0; + + convertPastes = true; + + hsStart = -1; + hsEnd = -1; + + llc.SetLevel(LineLayoutCache::llcCaret); + posCache.SetSize(0x400); +} + +Editor::~Editor() { + pdoc->RemoveWatcher(this, 0); + pdoc->Release(); + pdoc = 0; + DropGraphics(); + delete pixmapLine; + delete pixmapSelMargin; + delete pixmapSelPattern; + delete pixmapIndentGuide; + delete pixmapIndentGuideHighlight; +} + +void Editor::Finalise() { + SetIdle(false); + CancelModes(); +} + +void Editor::DropGraphics() { + pixmapLine->Release(); + pixmapSelMargin->Release(); + pixmapSelPattern->Release(); + pixmapIndentGuide->Release(); + pixmapIndentGuideHighlight->Release(); +} + +void Editor::InvalidateStyleData() { + stylesValid = false; + DropGraphics(); + palette.Release(); + llc.Invalidate(LineLayout::llInvalid); + posCache.Clear(); +} + +void Editor::InvalidateStyleRedraw() { + NeedWrapping(); + InvalidateStyleData(); + Redraw(); +} + +void Editor::RefreshColourPalette(Palette &pal, bool want) { + vs.RefreshColourPalette(pal, want); +} + +void Editor::RefreshStyleData() { + if (!stylesValid) { + stylesValid = true; + AutoSurface surface(this); + if (surface) { + vs.Refresh(*surface); + RefreshColourPalette(palette, true); + palette.Allocate(wMain); + RefreshColourPalette(palette, false); + } + if (wrapIndentMode == SC_WRAPINDENT_INDENT) { + wrapAddIndent = pdoc->IndentSize() * vs.spaceWidth; + } else if (wrapIndentMode == SC_WRAPINDENT_SAME) { + wrapAddIndent = 0; + } else { //SC_WRAPINDENT_FIXED + wrapAddIndent = wrapVisualStartIndent * vs.aveCharWidth; + if ((wrapVisualFlags & SC_WRAPVISUALFLAG_START) && (wrapAddIndent <= 0)) + wrapAddIndent = vs.aveCharWidth; // must indent to show start visual + } + SetScrollBars(); + SetRectangularRange(); + } +} + +PRectangle Editor::GetClientRectangle() { + return wMain.GetClientPosition(); +} + +PRectangle Editor::GetTextRectangle() { + PRectangle rc = GetClientRectangle(); + rc.left += vs.fixedColumnWidth; + rc.right -= vs.rightMarginWidth; + return rc; +} + +int Editor::LinesOnScreen() { + PRectangle rcClient = GetClientRectangle(); + int htClient = rcClient.bottom - rcClient.top; + //Platform::DebugPrintf("lines on screen = %d\n", htClient / lineHeight + 1); + return htClient / vs.lineHeight; +} + +int Editor::LinesToScroll() { + int retVal = LinesOnScreen() - 1; + if (retVal < 1) + return 1; + else + return retVal; +} + +int Editor::MaxScrollPos() { + //Platform::DebugPrintf("Lines %d screen = %d maxScroll = %d\n", + //LinesTotal(), LinesOnScreen(), LinesTotal() - LinesOnScreen() + 1); + int retVal = cs.LinesDisplayed(); + if (endAtLastLine) { + retVal -= LinesOnScreen(); + } else { + retVal--; + } + if (retVal < 0) { + return 0; + } else { + return retVal; + } +} + +const char *ControlCharacterString(unsigned char ch) { + const char *reps[] = { + "NUL", "SOH", "STX", "ETX", "EOT", "ENQ", "ACK", "BEL", + "BS", "HT", "LF", "VT", "FF", "CR", "SO", "SI", + "DLE", "DC1", "DC2", "DC3", "DC4", "NAK", "SYN", "ETB", + "CAN", "EM", "SUB", "ESC", "FS", "GS", "RS", "US" + }; + if (ch < (sizeof(reps) / sizeof(reps[0]))) { + return reps[ch]; + } else { + return "BAD"; + } +} + +/** + * Convenience class to ensure LineLayout objects are always disposed. + */ +class AutoLineLayout { + LineLayoutCache &llc; + LineLayout *ll; + AutoLineLayout &operator=(const AutoLineLayout &) { return * this; } +public: + AutoLineLayout(LineLayoutCache &llc_, LineLayout *ll_) : llc(llc_), ll(ll_) {} + ~AutoLineLayout() { + llc.Dispose(ll); + ll = 0; + } + LineLayout *operator->() const { + return ll; + } + operator LineLayout *() const { + return ll; + } + void Set(LineLayout *ll_) { + llc.Dispose(ll); + ll = ll_; + } +}; + +SelectionPosition Editor::ClampPositionIntoDocument(SelectionPosition sp) const { + if (sp.Position() < 0) { + return SelectionPosition(0); + } else if (sp.Position() > pdoc->Length()) { + return SelectionPosition(pdoc->Length()); + } else { + // If not at end of line then set offset to 0 + if (!pdoc->IsLineEndPosition(sp.Position())) + sp.SetVirtualSpace(0); + return sp; + } +} + +Point Editor::LocationFromPosition(SelectionPosition pos) { + Point pt; + RefreshStyleData(); + if (pos.Position() == INVALID_POSITION) + return pt; + int line = pdoc->LineFromPosition(pos.Position()); + int lineVisible = cs.DisplayFromDoc(line); + //Platform::DebugPrintf("line=%d\n", line); + AutoSurface surface(this); + AutoLineLayout ll(llc, RetrieveLineLayout(line)); + if (surface && ll) { + // -1 because of adding in for visible lines in following loop. + pt.y = (lineVisible - topLine - 1) * vs.lineHeight; + pt.x = 0; + unsigned int posLineStart = pdoc->LineStart(line); + LayoutLine(line, surface, vs, ll, wrapWidth); + int posInLine = pos.Position() - posLineStart; + // In case of very long line put x at arbitrary large position + if (posInLine > ll->maxLineLength) { + pt.x = ll->positions[ll->maxLineLength] - ll->positions[ll->LineStart(ll->lines)]; + } + + for (int subLine = 0; subLine < ll->lines; subLine++) { + if ((posInLine >= ll->LineStart(subLine)) && (posInLine <= ll->LineStart(subLine + 1))) { + pt.x = ll->positions[posInLine] - ll->positions[ll->LineStart(subLine)]; + if (ll->wrapIndent != 0) { + int lineStart = ll->LineStart(subLine); + if (lineStart != 0) // Wrapped + pt.x += ll->wrapIndent; + } + } + if (posInLine >= ll->LineStart(subLine)) { + pt.y += vs.lineHeight; + } + } + pt.x += vs.fixedColumnWidth - xOffset; + } + pt.x += pos.VirtualSpace() * static_cast(vs.styles[ll->EndLineStyle()].spaceWidth); + return pt; +} + +Point Editor::LocationFromPosition(int pos) { + return LocationFromPosition(SelectionPosition(pos)); +} + +int Editor::XFromPosition(int pos) { + Point pt = LocationFromPosition(pos); + return pt.x - vs.fixedColumnWidth + xOffset; +} + +int Editor::XFromPosition(SelectionPosition sp) { + Point pt = LocationFromPosition(sp); + return pt.x - vs.fixedColumnWidth + xOffset; +} + +int Editor::LineFromLocation(Point pt) { + return cs.DocFromDisplay(pt.y / vs.lineHeight + topLine); +} + +void Editor::SetTopLine(int topLineNew) { + topLine = topLineNew; + posTopLine = pdoc->LineStart(cs.DocFromDisplay(topLine)); +} + +SelectionPosition Editor::SPositionFromLocation(Point pt, bool canReturnInvalid, bool charPosition, bool virtualSpace) { + RefreshStyleData(); + if (canReturnInvalid) { + PRectangle rcClient = GetTextRectangle(); + if (!rcClient.Contains(pt)) + return SelectionPosition(INVALID_POSITION); + if (pt.x < vs.fixedColumnWidth) + return SelectionPosition(INVALID_POSITION); + if (pt.y < 0) + return SelectionPosition(INVALID_POSITION); + } + pt.x = pt.x - vs.fixedColumnWidth + xOffset; + int visibleLine = pt.y / vs.lineHeight + topLine; + if (pt.y < 0) { // Division rounds towards 0 + visibleLine = (pt.y - (vs.lineHeight - 1)) / vs.lineHeight + topLine; + } + if (!canReturnInvalid && (visibleLine < 0)) + visibleLine = 0; + int lineDoc = cs.DocFromDisplay(visibleLine); + if (canReturnInvalid && (lineDoc < 0)) + return SelectionPosition(INVALID_POSITION); + if (lineDoc >= pdoc->LinesTotal()) + return SelectionPosition(canReturnInvalid ? INVALID_POSITION : pdoc->Length()); + unsigned int posLineStart = pdoc->LineStart(lineDoc); + SelectionPosition retVal(canReturnInvalid ? INVALID_POSITION : static_cast(posLineStart)); + AutoSurface surface(this); + AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc)); + if (surface && ll) { + LayoutLine(lineDoc, surface, vs, ll, wrapWidth); + int lineStartSet = cs.DisplayFromDoc(lineDoc); + int subLine = visibleLine - lineStartSet; + if (subLine < ll->lines) { + int lineStart = ll->LineStart(subLine); + int lineEnd = ll->LineLastVisible(subLine); + int subLineStart = ll->positions[lineStart]; + + if (ll->wrapIndent != 0) { + if (lineStart != 0) // Wrapped + pt.x -= ll->wrapIndent; + } + int i = ll->FindBefore(pt.x + subLineStart, lineStart, lineEnd); + while (i < lineEnd) { + if (charPosition) { + if ((pt.x + subLineStart) < (ll->positions[i + 1])) { + return SelectionPosition(pdoc->MovePositionOutsideChar(i + posLineStart, 1)); + } + } else { + if ((pt.x + subLineStart) < ((ll->positions[i] + ll->positions[i + 1]) / 2)) { + return SelectionPosition(pdoc->MovePositionOutsideChar(i + posLineStart, 1)); + } + } + i++; + } + if (virtualSpace) { + const int spaceWidth = static_cast(vs.styles[ll->EndLineStyle()].spaceWidth); + int spaceOffset = (pt.x + subLineStart - ll->positions[lineEnd] + spaceWidth / 2) / + spaceWidth; + return SelectionPosition(lineEnd + posLineStart, spaceOffset); + } else if (canReturnInvalid) { + if (pt.x < (ll->positions[lineEnd] - subLineStart)) { + return SelectionPosition(pdoc->MovePositionOutsideChar(lineEnd + posLineStart, 1)); + } + } else { + return SelectionPosition(lineEnd + posLineStart); + } + } + if (!canReturnInvalid) + return SelectionPosition(ll->numCharsInLine + posLineStart); + } + return retVal; +} + +int Editor::PositionFromLocation(Point pt, bool canReturnInvalid, bool charPosition) { + return SPositionFromLocation(pt, canReturnInvalid, charPosition, false).Position(); +} + +/** + * Find the document position corresponding to an x coordinate on a particular document line. + * Ensure is between whole characters when document is in multi-byte or UTF-8 mode. + */ +int Editor::PositionFromLineX(int lineDoc, int x) { + RefreshStyleData(); + if (lineDoc >= pdoc->LinesTotal()) + return pdoc->Length(); + //Platform::DebugPrintf("Position of (%d,%d) line = %d top=%d\n", pt.x, pt.y, line, topLine); + AutoSurface surface(this); + AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc)); + int retVal = 0; + if (surface && ll) { + unsigned int posLineStart = pdoc->LineStart(lineDoc); + LayoutLine(lineDoc, surface, vs, ll, wrapWidth); + retVal = ll->numCharsBeforeEOL + posLineStart; + int subLine = 0; + int lineStart = ll->LineStart(subLine); + int lineEnd = ll->LineLastVisible(subLine); + int subLineStart = ll->positions[lineStart]; + + if (ll->wrapIndent != 0) { + if (lineStart != 0) // Wrapped + x -= ll->wrapIndent; + } + int i = ll->FindBefore(x + subLineStart, lineStart, lineEnd); + while (i < lineEnd) { + if ((x + subLineStart) < ((ll->positions[i] + ll->positions[i + 1]) / 2)) { + retVal = pdoc->MovePositionOutsideChar(i + posLineStart, 1); + break; + } + i++; + } + } + return retVal; +} + +/** + * Find the document position corresponding to an x coordinate on a particular document line. + * Ensure is between whole characters when document is in multi-byte or UTF-8 mode. + */ +SelectionPosition Editor::SPositionFromLineX(int lineDoc, int x) { + RefreshStyleData(); + if (lineDoc >= pdoc->LinesTotal()) + return SelectionPosition(pdoc->Length()); + //Platform::DebugPrintf("Position of (%d,%d) line = %d top=%d\n", pt.x, pt.y, line, topLine); + AutoSurface surface(this); + AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc)); + int retVal = 0; + if (surface && ll) { + unsigned int posLineStart = pdoc->LineStart(lineDoc); + LayoutLine(lineDoc, surface, vs, ll, wrapWidth); + int subLine = 0; + int lineStart = ll->LineStart(subLine); + int lineEnd = ll->LineLastVisible(subLine); + int subLineStart = ll->positions[lineStart]; + + if (ll->wrapIndent != 0) { + if (lineStart != 0) // Wrapped + x -= ll->wrapIndent; + } + int i = ll->FindBefore(x + subLineStart, lineStart, lineEnd); + while (i < lineEnd) { + if ((x + subLineStart) < ((ll->positions[i] + ll->positions[i + 1]) / 2)) { + retVal = pdoc->MovePositionOutsideChar(i + posLineStart, 1); + return SelectionPosition(retVal); + } + i++; + } + const int spaceWidth = static_cast(vs.styles[ll->EndLineStyle()].spaceWidth); + int spaceOffset = (x + subLineStart - ll->positions[lineEnd] + spaceWidth / 2) / spaceWidth; + return SelectionPosition(lineEnd + posLineStart, spaceOffset); + } + return SelectionPosition(retVal); +} + +/** + * If painting then abandon the painting because a wider redraw is needed. + * @return true if calling code should stop drawing. + */ +bool Editor::AbandonPaint() { + if ((paintState == painting) && !paintingAllText) { + paintState = paintAbandoned; + } + return paintState == paintAbandoned; +} + +void Editor::RedrawRect(PRectangle rc) { + //Platform::DebugPrintf("Redraw %0d,%0d - %0d,%0d\n", rc.left, rc.top, rc.right, rc.bottom); + + // Clip the redraw rectangle into the client area + PRectangle rcClient = GetClientRectangle(); + if (rc.top < rcClient.top) + rc.top = rcClient.top; + if (rc.bottom > rcClient.bottom) + rc.bottom = rcClient.bottom; + if (rc.left < rcClient.left) + rc.left = rcClient.left; + if (rc.right > rcClient.right) + rc.right = rcClient.right; + + if ((rc.bottom > rc.top) && (rc.right > rc.left)) { + wMain.InvalidateRectangle(rc); + } +} + +void Editor::Redraw() { + //Platform::DebugPrintf("Redraw all\n"); + PRectangle rcClient = GetClientRectangle(); + wMain.InvalidateRectangle(rcClient); + //wMain.InvalidateAll(); +} + +void Editor::RedrawSelMargin(int line) { + if (!AbandonPaint()) { + if (vs.maskInLine) { + Redraw(); + } else { + PRectangle rcSelMargin = GetClientRectangle(); + rcSelMargin.right = vs.fixedColumnWidth; + if (line != -1) { + int position = pdoc->LineStart(line); + PRectangle rcLine = RectangleFromRange(position, position); + rcSelMargin.top = rcLine.top; + rcSelMargin.bottom = rcLine.bottom; + } + wMain.InvalidateRectangle(rcSelMargin); + } + } +} + +PRectangle Editor::RectangleFromRange(int start, int end) { + int minPos = start; + if (minPos > end) + minPos = end; + int maxPos = start; + if (maxPos < end) + maxPos = end; + int minLine = cs.DisplayFromDoc(pdoc->LineFromPosition(minPos)); + int lineDocMax = pdoc->LineFromPosition(maxPos); + int maxLine = cs.DisplayFromDoc(lineDocMax) + cs.GetHeight(lineDocMax) - 1; + PRectangle rcClient = GetTextRectangle(); + PRectangle rc; + rc.left = vs.fixedColumnWidth; + rc.top = (minLine - topLine) * vs.lineHeight; + if (rc.top < 0) + rc.top = 0; + rc.right = rcClient.right; + rc.bottom = (maxLine - topLine + 1) * vs.lineHeight; + // Ensure PRectangle is within 16 bit space + rc.top = Platform::Clamp(rc.top, -32000, 32000); + rc.bottom = Platform::Clamp(rc.bottom, -32000, 32000); + + return rc; +} + +void Editor::InvalidateRange(int start, int end) { + RedrawRect(RectangleFromRange(start, end)); +} + +int Editor::CurrentPosition() { + return sel.MainCaret(); +} + +bool Editor::SelectionEmpty() { + return sel.Empty(); +} + +SelectionPosition Editor::SelectionStart() { + return sel.RangeMain().Start(); +} + +SelectionPosition Editor::SelectionEnd() { + return sel.RangeMain().End(); +} + +void Editor::SetRectangularRange() { + if (sel.IsRectangular()) { + int xAnchor = XFromPosition(sel.Rectangular().anchor); + int xCaret = XFromPosition(sel.Rectangular().caret); + if (sel.selType == Selection::selThin) { + xCaret = xAnchor; + } + int lineAnchor = pdoc->LineFromPosition(sel.Rectangular().anchor.Position()); + int lineCaret = pdoc->LineFromPosition(sel.Rectangular().caret.Position()); + int increment = (lineCaret > lineAnchor) ? 1 : -1; + for (int line=lineAnchor; line != lineCaret+increment; line += increment) { + SelectionRange range(SPositionFromLineX(line, xCaret), SPositionFromLineX(line, xAnchor)); + if ((virtualSpaceOptions & SCVS_RECTANGULARSELECTION) == 0) + range.ClearVirtualSpace(); + if (line == lineAnchor) + sel.SetSelection(range); + else + sel.AddSelection(range); + } + } +} + +void Editor::InvalidateSelection(SelectionRange newMain, bool invalidateWholeSelection) { + if (sel.Count() > 1 || !(sel.RangeMain().anchor == newMain.anchor) || sel.IsRectangular()) { + invalidateWholeSelection = true; + } + int firstAffected = Platform::Minimum(sel.RangeMain().Start().Position(), newMain.Start().Position()); + // +1 for lastAffected ensures caret repainted + int lastAffected = Platform::Maximum(newMain.caret.Position()+1, newMain.anchor.Position()); + lastAffected = Platform::Maximum(lastAffected, sel.RangeMain().End().Position()); + if (invalidateWholeSelection) { + for (size_t r=0; r 1 || !(sel.RangeMain() == rangeNew)) { + InvalidateSelection(rangeNew); + } + sel.RangeMain() = rangeNew; + SetRectangularRange(); + ClaimSelection(); +} + +void Editor::SetSelection(int currentPos_, int anchor_) { + SetSelection(SelectionPosition(currentPos_), SelectionPosition(anchor_)); +} + +// Just move the caret on the main selection +void Editor::SetSelection(SelectionPosition currentPos_) { + currentPos_ = ClampPositionIntoDocument(currentPos_); + if (sel.Count() > 1 || !(sel.RangeMain().caret == currentPos_)) { + InvalidateSelection(SelectionRange(currentPos_)); + } + if (sel.IsRectangular()) { + sel.Rectangular() = + SelectionRange(SelectionPosition(currentPos_), sel.Rectangular().anchor); + SetRectangularRange(); + } else { + sel.RangeMain() = + SelectionRange(SelectionPosition(currentPos_), sel.RangeMain().anchor); + } + ClaimSelection(); +} + +void Editor::SetSelection(int currentPos_) { + SetSelection(SelectionPosition(currentPos_)); +} + +void Editor::SetEmptySelection(SelectionPosition currentPos_) { + SelectionRange rangeNew(ClampPositionIntoDocument(currentPos_)); + if (sel.Count() > 1 || !(sel.RangeMain() == rangeNew)) { + InvalidateSelection(rangeNew); + } + sel.Clear(); + sel.RangeMain() = rangeNew; + SetRectangularRange(); + ClaimSelection(); + +} + +void Editor::SetEmptySelection(int currentPos_) { + SetEmptySelection(SelectionPosition(currentPos_)); +} + +bool Editor::RangeContainsProtected(int start, int end) const { + if (vs.ProtectionActive()) { + if (start > end) { + int t = start; + start = end; + end = t; + } + int mask = pdoc->stylingBitsMask; + for (int pos = start; pos < end; pos++) { + if (vs.styles[pdoc->StyleAt(pos) & mask].IsProtected()) + return true; + } + } + return false; +} + +bool Editor::SelectionContainsProtected() { + for (size_t r=0; rMovePositionOutsideChar(pos.Position(), moveDir, checkLineEnd); + if (posMoved != pos.Position()) + pos.SetPosition(posMoved); + if (vs.ProtectionActive()) { + int mask = pdoc->stylingBitsMask; + if (moveDir > 0) { + if ((pos.Position() > 0) && vs.styles[pdoc->StyleAt(pos.Position() - 1) & mask].IsProtected()) { + while ((pos.Position() < pdoc->Length()) && + (vs.styles[pdoc->StyleAt(pos.Position()) & mask].IsProtected())) + pos.Add(1); + } + } else if (moveDir < 0) { + if (vs.styles[pdoc->StyleAt(pos.Position()) & mask].IsProtected()) { + while ((pos.Position() > 0) && + (vs.styles[pdoc->StyleAt(pos.Position() - 1) & mask].IsProtected())) + pos.Add(-1); + } + } + } + return pos; +} + +int Editor::MovePositionTo(SelectionPosition newPos, Selection::selTypes selt, bool ensureVisible) { + int delta = newPos.Position() - sel.MainCaret(); + newPos = ClampPositionIntoDocument(newPos); + newPos = MovePositionOutsideChar(newPos, delta); + if (!sel.IsRectangular() && (selt == Selection::selRectangle)) { + // Switching to rectangular + SelectionRange rangeMain = sel.RangeMain(); + sel.Clear(); + sel.Rectangular() = rangeMain; + } + if (selt != Selection::noSel) { + sel.selType = selt; + } + if (selt != Selection::noSel || sel.MoveExtends()) { + SetSelection(newPos); + } else { + SetEmptySelection(newPos); + } + ShowCaretAtCurrentPosition(); + if (ensureVisible) { + EnsureCaretVisible(); + } + return 0; +} + +int Editor::MovePositionTo(int newPos, Selection::selTypes selt, bool ensureVisible) { + return MovePositionTo(SelectionPosition(newPos), selt, ensureVisible); +} + +SelectionPosition Editor::MovePositionSoVisible(SelectionPosition pos, int moveDir) { + pos = ClampPositionIntoDocument(pos); + pos = MovePositionOutsideChar(pos, moveDir); + int lineDoc = pdoc->LineFromPosition(pos.Position()); + if (cs.GetVisible(lineDoc)) { + return pos; + } else { + int lineDisplay = cs.DisplayFromDoc(lineDoc); + if (moveDir > 0) { + // lineDisplay is already line before fold as lines in fold use display line of line after fold + lineDisplay = Platform::Clamp(lineDisplay, 0, cs.LinesDisplayed()); + return SelectionPosition(pdoc->LineStart(cs.DocFromDisplay(lineDisplay))); + } else { + lineDisplay = Platform::Clamp(lineDisplay - 1, 0, cs.LinesDisplayed()); + return SelectionPosition(pdoc->LineEnd(cs.DocFromDisplay(lineDisplay))); + } + } +} + +SelectionPosition Editor::MovePositionSoVisible(int pos, int moveDir) { + return MovePositionSoVisible(SelectionPosition(pos), moveDir); +} + +Point Editor::PointMainCaret() { + return LocationFromPosition(sel.Range(sel.Main()).caret); +} + +/** + * Choose the x position that the caret will try to stick to + * as it moves up and down. + */ +void Editor::SetLastXChosen() { + Point pt = PointMainCaret(); + lastXChosen = pt.x; +} + +void Editor::ScrollTo(int line, bool moveThumb) { + int topLineNew = Platform::Clamp(line, 0, MaxScrollPos()); + if (topLineNew != topLine) { + // Try to optimise small scrolls + int linesToMove = topLine - topLineNew; + SetTopLine(topLineNew); + ShowCaretAtCurrentPosition(); + // Perform redraw rather than scroll if many lines would be redrawn anyway. +#ifndef UNDER_CE + if ((abs(linesToMove) <= 10) && (paintState == notPainting)) { + ScrollText(linesToMove); + } else { + Redraw(); + } +#else + Redraw(); +#endif + if (moveThumb) { + SetVerticalScrollPos(); + } + } +} + +void Editor::ScrollText(int /* linesToMove */) { + //Platform::DebugPrintf("Editor::ScrollText %d\n", linesToMove); + Redraw(); +} + +void Editor::HorizontalScrollTo(int xPos) { + //Platform::DebugPrintf("HorizontalScroll %d\n", xPos); + if (xPos < 0) + xPos = 0; + if ((wrapState == eWrapNone) && (xOffset != xPos)) { + xOffset = xPos; + SetHorizontalScrollPos(); + RedrawRect(GetClientRectangle()); + } +} + +void Editor::MoveCaretInsideView(bool ensureVisible) { + PRectangle rcClient = GetTextRectangle(); + Point pt = PointMainCaret(); + if (pt.y < rcClient.top) { + MovePositionTo(SPositionFromLocation( + Point(lastXChosen, rcClient.top)), + Selection::noSel, ensureVisible); + } else if ((pt.y + vs.lineHeight - 1) > rcClient.bottom) { + int yOfLastLineFullyDisplayed = rcClient.top + (LinesOnScreen() - 1) * vs.lineHeight; + MovePositionTo(SPositionFromLocation( + Point(lastXChosen, rcClient.top + yOfLastLineFullyDisplayed)), + Selection::noSel, ensureVisible); + } +} + +int Editor::DisplayFromPosition(int pos) { + int lineDoc = pdoc->LineFromPosition(pos); + int lineDisplay = cs.DisplayFromDoc(lineDoc); + AutoSurface surface(this); + AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc)); + if (surface && ll) { + LayoutLine(lineDoc, surface, vs, ll, wrapWidth); + unsigned int posLineStart = pdoc->LineStart(lineDoc); + int posInLine = pos - posLineStart; + lineDisplay--; // To make up for first increment ahead. + for (int subLine = 0; subLine < ll->lines; subLine++) { + if (posInLine >= ll->LineStart(subLine)) { + lineDisplay++; + } + } + } + return lineDisplay; +} + +/** + * Ensure the caret is reasonably visible in context. + * +Caret policy in SciTE + +If slop is set, we can define a slop value. +This value defines an unwanted zone (UZ) where the caret is... unwanted. +This zone is defined as a number of pixels near the vertical margins, +and as a number of lines near the horizontal margins. +By keeping the caret away from the edges, it is seen within its context, +so it is likely that the identifier that the caret is on can be completely seen, +and that the current line is seen with some of the lines following it which are +often dependent on that line. + +If strict is set, the policy is enforced... strictly. +The caret is centred on the display if slop is not set, +and cannot go in the UZ if slop is set. + +If jumps is set, the display is moved more energetically +so the caret can move in the same direction longer before the policy is applied again. +'3UZ' notation is used to indicate three time the size of the UZ as a distance to the margin. + +If even is not set, instead of having symmetrical UZs, +the left and bottom UZs are extended up to right and top UZs respectively. +This way, we favour the displaying of useful information: the begining of lines, +where most code reside, and the lines after the caret, eg. the body of a function. + + | | | | | +slop | strict | jumps | even | Caret can go to the margin | When reaching limit (caret going out of + | | | | | visibility or going into the UZ) display is... +-----+--------+-------+------+--------------------------------------------+-------------------------------------------------------------- + 0 | 0 | 0 | 0 | Yes | moved to put caret on top/on right + 0 | 0 | 0 | 1 | Yes | moved by one position + 0 | 0 | 1 | 0 | Yes | moved to put caret on top/on right + 0 | 0 | 1 | 1 | Yes | centred on the caret + 0 | 1 | - | 0 | Caret is always on top/on right of display | - + 0 | 1 | - | 1 | No, caret is always centred | - + 1 | 0 | 0 | 0 | Yes | moved to put caret out of the asymmetrical UZ + 1 | 0 | 0 | 1 | Yes | moved to put caret out of the UZ + 1 | 0 | 1 | 0 | Yes | moved to put caret at 3UZ of the top or right margin + 1 | 0 | 1 | 1 | Yes | moved to put caret at 3UZ of the margin + 1 | 1 | - | 0 | Caret is always at UZ of top/right margin | - + 1 | 1 | 0 | 1 | No, kept out of UZ | moved by one position + 1 | 1 | 1 | 1 | No, kept out of UZ | moved to put caret at 3UZ of the margin +*/ +void Editor::EnsureCaretVisible(bool useMargin, bool vert, bool horiz) { + //Platform::DebugPrintf("EnsureCaretVisible %d %s\n", xOffset, useMargin ? " margin" : " "); + PRectangle rcClient = GetTextRectangle(); + //int rcClientFullWidth = rcClient.Width(); + SelectionPosition posCaret = sel.RangeMain().caret; + if (posDrag.IsValid()) { + posCaret = posDrag; + } + Point pt = LocationFromPosition(posCaret); + Point ptBottomCaret = pt; + ptBottomCaret.y += vs.lineHeight - 1; + int lineCaret = DisplayFromPosition(posCaret.Position()); + bool bSlop, bStrict, bJump, bEven; + + // Vertical positioning + if (vert && (pt.y < rcClient.top || ptBottomCaret.y > rcClient.bottom || (caretYPolicy & CARET_STRICT) != 0)) { + int linesOnScreen = LinesOnScreen(); + int halfScreen = Platform::Maximum(linesOnScreen - 1, 2) / 2; + int newTopLine = topLine; + bSlop = (caretYPolicy & CARET_SLOP) != 0; + bStrict = (caretYPolicy & CARET_STRICT) != 0; + bJump = (caretYPolicy & CARET_JUMPS) != 0; + bEven = (caretYPolicy & CARET_EVEN) != 0; + + // It should be possible to scroll the window to show the caret, + // but this fails to remove the caret on GTK+ + if (bSlop) { // A margin is defined + int yMoveT, yMoveB; + if (bStrict) { + int yMarginT, yMarginB; + if (!useMargin) { + // In drag mode, avoid moves + // otherwise, a double click will select several lines. + yMarginT = yMarginB = 0; + } else { + // yMarginT must equal to caretYSlop, with a minimum of 1 and + // a maximum of slightly less than half the heigth of the text area. + yMarginT = Platform::Clamp(caretYSlop, 1, halfScreen); + if (bEven) { + yMarginB = yMarginT; + } else { + yMarginB = linesOnScreen - yMarginT - 1; + } + } + yMoveT = yMarginT; + if (bEven) { + if (bJump) { + yMoveT = Platform::Clamp(caretYSlop * 3, 1, halfScreen); + } + yMoveB = yMoveT; + } else { + yMoveB = linesOnScreen - yMoveT - 1; + } + if (lineCaret < topLine + yMarginT) { + // Caret goes too high + newTopLine = lineCaret - yMoveT; + } else if (lineCaret > topLine + linesOnScreen - 1 - yMarginB) { + // Caret goes too low + newTopLine = lineCaret - linesOnScreen + 1 + yMoveB; + } + } else { // Not strict + yMoveT = bJump ? caretYSlop * 3 : caretYSlop; + yMoveT = Platform::Clamp(yMoveT, 1, halfScreen); + if (bEven) { + yMoveB = yMoveT; + } else { + yMoveB = linesOnScreen - yMoveT - 1; + } + if (lineCaret < topLine) { + // Caret goes too high + newTopLine = lineCaret - yMoveT; + } else if (lineCaret > topLine + linesOnScreen - 1) { + // Caret goes too low + newTopLine = lineCaret - linesOnScreen + 1 + yMoveB; + } + } + } else { // No slop + if (!bStrict && !bJump) { + // Minimal move + if (lineCaret < topLine) { + // Caret goes too high + newTopLine = lineCaret; + } else if (lineCaret > topLine + linesOnScreen - 1) { + // Caret goes too low + if (bEven) { + newTopLine = lineCaret - linesOnScreen + 1; + } else { + newTopLine = lineCaret; + } + } + } else { // Strict or going out of display + if (bEven) { + // Always center caret + newTopLine = lineCaret - halfScreen; + } else { + // Always put caret on top of display + newTopLine = lineCaret; + } + } + } + newTopLine = Platform::Clamp(newTopLine, 0, MaxScrollPos()); + if (newTopLine != topLine) { + Redraw(); + SetTopLine(newTopLine); + SetVerticalScrollPos(); + } + } + + // Horizontal positioning + if (horiz && (wrapState == eWrapNone)) { + int halfScreen = Platform::Maximum(rcClient.Width() - 4, 4) / 2; + int xOffsetNew = xOffset; + bSlop = (caretXPolicy & CARET_SLOP) != 0; + bStrict = (caretXPolicy & CARET_STRICT) != 0; + bJump = (caretXPolicy & CARET_JUMPS) != 0; + bEven = (caretXPolicy & CARET_EVEN) != 0; + + if (bSlop) { // A margin is defined + int xMoveL, xMoveR; + if (bStrict) { + int xMarginL, xMarginR; + if (!useMargin) { + // In drag mode, avoid moves unless very near of the margin + // otherwise, a simple click will select text. + xMarginL = xMarginR = 2; + } else { + // xMargin must equal to caretXSlop, with a minimum of 2 and + // a maximum of slightly less than half the width of the text area. + xMarginR = Platform::Clamp(caretXSlop, 2, halfScreen); + if (bEven) { + xMarginL = xMarginR; + } else { + xMarginL = rcClient.Width() - xMarginR - 4; + } + } + if (bJump && bEven) { + // Jump is used only in even mode + xMoveL = xMoveR = Platform::Clamp(caretXSlop * 3, 1, halfScreen); + } else { + xMoveL = xMoveR = 0; // Not used, avoid a warning + } + if (pt.x < rcClient.left + xMarginL) { + // Caret is on the left of the display + if (bJump && bEven) { + xOffsetNew -= xMoveL; + } else { + // Move just enough to allow to display the caret + xOffsetNew -= (rcClient.left + xMarginL) - pt.x; + } + } else if (pt.x >= rcClient.right - xMarginR) { + // Caret is on the right of the display + if (bJump && bEven) { + xOffsetNew += xMoveR; + } else { + // Move just enough to allow to display the caret + xOffsetNew += pt.x - (rcClient.right - xMarginR) + 1; + } + } + } else { // Not strict + xMoveR = bJump ? caretXSlop * 3 : caretXSlop; + xMoveR = Platform::Clamp(xMoveR, 1, halfScreen); + if (bEven) { + xMoveL = xMoveR; + } else { + xMoveL = rcClient.Width() - xMoveR - 4; + } + if (pt.x < rcClient.left) { + // Caret is on the left of the display + xOffsetNew -= xMoveL; + } else if (pt.x >= rcClient.right) { + // Caret is on the right of the display + xOffsetNew += xMoveR; + } + } + } else { // No slop + if (bStrict || + (bJump && (pt.x < rcClient.left || pt.x >= rcClient.right))) { + // Strict or going out of display + if (bEven) { + // Center caret + xOffsetNew += pt.x - rcClient.left - halfScreen; + } else { + // Put caret on right + xOffsetNew += pt.x - rcClient.right + 1; + } + } else { + // Move just enough to allow to display the caret + if (pt.x < rcClient.left) { + // Caret is on the left of the display + if (bEven) { + xOffsetNew -= rcClient.left - pt.x; + } else { + xOffsetNew += pt.x - rcClient.right + 1; + } + } else if (pt.x >= rcClient.right) { + // Caret is on the right of the display + xOffsetNew += pt.x - rcClient.right + 1; + } + } + } + // In case of a jump (find result) largely out of display, adjust the offset to display the caret + if (pt.x + xOffset < rcClient.left + xOffsetNew) { + xOffsetNew = pt.x + xOffset - rcClient.left; + } else if (pt.x + xOffset >= rcClient.right + xOffsetNew) { + xOffsetNew = pt.x + xOffset - rcClient.right + 1; + if (vs.caretStyle == CARETSTYLE_BLOCK) { + // Ensure we can see a good portion of the block caret + xOffsetNew += vs.aveCharWidth; + } + } + if (xOffsetNew < 0) { + xOffsetNew = 0; + } + if (xOffset != xOffsetNew) { + xOffset = xOffsetNew; + if (xOffsetNew > 0) { + PRectangle rcText = GetTextRectangle(); + if (horizontalScrollBarVisible && + rcText.Width() + xOffset > scrollWidth) { + scrollWidth = xOffset + rcText.Width(); + SetScrollBars(); + } + } + SetHorizontalScrollPos(); + Redraw(); + } + } + UpdateSystemCaret(); +} + +void Editor::ShowCaretAtCurrentPosition() { + if (hasFocus) { + caret.active = true; + caret.on = true; + SetTicking(true); + } else { + caret.active = false; + caret.on = false; + } + InvalidateCaret(); +} + +void Editor::DropCaret() { + caret.active = false; + InvalidateCaret(); +} + +void Editor::InvalidateCaret() { + if (posDrag.IsValid()) { + InvalidateRange(posDrag.Position(), posDrag.Position() + 1); + } else { + for (size_t r=0; rLinesTotal()); + if (wrapStart > docLineStart) { + wrapStart = docLineStart; + llc.Invalidate(LineLayout::llPositions); + } + if (wrapEnd < docLineEnd) { + wrapEnd = docLineEnd; + } + wrapEnd = Platform::Clamp(wrapEnd, 0, pdoc->LinesTotal()); + // Wrap lines during idle. + if ((wrapState != eWrapNone) && (wrapEnd != wrapStart)) { + SetIdle(true); + } +} + +bool Editor::WrapOneLine(Surface *surface, int lineToWrap) { + AutoLineLayout ll(llc, RetrieveLineLayout(lineToWrap)); + int linesWrapped = 1; + if (ll) { + LayoutLine(lineToWrap, surface, vs, ll, wrapWidth); + linesWrapped = ll->lines; + } + return cs.SetHeight(lineToWrap, linesWrapped + + (vs.annotationVisible ? pdoc->AnnotationLines(lineToWrap) : 0)); +} + +// Check if wrapping needed and perform any needed wrapping. +// fullwrap: if true, all lines which need wrapping will be done, +// in this single call. +// priorityWrapLineStart: If greater than or equal to zero, all lines starting from +// here to 1 page + 100 lines past will be wrapped (even if there are +// more lines under wrapping process in idle). +// If it is neither fullwrap, nor priorityWrap, then 1 page + 100 lines will be +// wrapped, if there are any wrapping going on in idle. (Generally this +// condition is called only from idler). +// Return true if wrapping occurred. +bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) { + // If there are any pending wraps, do them during idle if possible. + int linesInOneCall = LinesOnScreen() + 100; + if (wrapState != eWrapNone) { + if (wrapStart < wrapEnd) { + if (!SetIdle(true)) { + // Idle processing not supported so full wrap required. + fullWrap = true; + } + } + if (!fullWrap && priorityWrapLineStart >= 0 && + // .. and if the paint window is outside pending wraps + (((priorityWrapLineStart + linesInOneCall) < wrapStart) || + (priorityWrapLineStart > wrapEnd))) { + // No priority wrap pending + return false; + } + } + int goodTopLine = topLine; + bool wrapOccurred = false; + if (wrapStart <= pdoc->LinesTotal()) { + if (wrapState == eWrapNone) { + if (wrapWidth != LineLayout::wrapWidthInfinite) { + wrapWidth = LineLayout::wrapWidthInfinite; + for (int lineDoc = 0; lineDoc < pdoc->LinesTotal(); lineDoc++) { + cs.SetHeight(lineDoc, 1 + + (vs.annotationVisible ? pdoc->AnnotationLines(lineDoc) : 0)); + } + wrapOccurred = true; + } + wrapStart = wrapLineLarge; + wrapEnd = wrapLineLarge; + } else { + if (wrapEnd >= pdoc->LinesTotal()) + wrapEnd = pdoc->LinesTotal(); + //ElapsedTime et; + int lineDocTop = cs.DocFromDisplay(topLine); + int subLineTop = topLine - cs.DisplayFromDoc(lineDocTop); + PRectangle rcTextArea = GetClientRectangle(); + rcTextArea.left = vs.fixedColumnWidth; + rcTextArea.right -= vs.rightMarginWidth; + wrapWidth = rcTextArea.Width(); + // Ensure all of the document is styled. + pdoc->EnsureStyledTo(pdoc->Length()); + RefreshStyleData(); + AutoSurface surface(this); + if (surface) { + bool priorityWrap = false; + int lastLineToWrap = wrapEnd; + int lineToWrap = wrapStart; + if (!fullWrap) { + if (priorityWrapLineStart >= 0) { + // This is a priority wrap. + lineToWrap = priorityWrapLineStart; + lastLineToWrap = priorityWrapLineStart + linesInOneCall; + priorityWrap = true; + } else { + // This is idle wrap. + lastLineToWrap = wrapStart + linesInOneCall; + } + if (lastLineToWrap >= wrapEnd) + lastLineToWrap = wrapEnd; + } // else do a fullWrap. + + // Platform::DebugPrintf("Wraplines: full = %d, priorityStart = %d (wrapping: %d to %d)\n", fullWrap, priorityWrapLineStart, lineToWrap, lastLineToWrap); + // Platform::DebugPrintf("Pending wraps: %d to %d\n", wrapStart, wrapEnd); + while (lineToWrap < lastLineToWrap) { + if (WrapOneLine(surface, lineToWrap)) { + wrapOccurred = true; + } + lineToWrap++; + } + if (!priorityWrap) + wrapStart = lineToWrap; + // If wrapping is done, bring it to resting position + if (wrapStart >= wrapEnd) { + wrapStart = wrapLineLarge; + wrapEnd = wrapLineLarge; + } + } + goodTopLine = cs.DisplayFromDoc(lineDocTop); + if (subLineTop < cs.GetHeight(lineDocTop)) + goodTopLine += subLineTop; + else + goodTopLine += cs.GetHeight(lineDocTop); + //double durWrap = et.Duration(true); + //Platform::DebugPrintf("Wrap:%9.6g \n", durWrap); + } + } + if (wrapOccurred) { + SetScrollBars(); + SetTopLine(Platform::Clamp(goodTopLine, 0, MaxScrollPos())); + SetVerticalScrollPos(); + } + return wrapOccurred; +} + +void Editor::LinesJoin() { + if (!RangeContainsProtected(targetStart, targetEnd)) { + UndoGroup ug(pdoc); + bool prevNonWS = true; + for (int pos = targetStart; pos < targetEnd; pos++) { + if (IsEOLChar(pdoc->CharAt(pos))) { + targetEnd -= pdoc->LenChar(pos); + pdoc->DelChar(pos); + if (prevNonWS) { + // Ensure at least one space separating previous lines + pdoc->InsertChar(pos, ' '); + targetEnd++; + } + } else { + prevNonWS = pdoc->CharAt(pos) != ' '; + } + } + } +} + +const char *Editor::StringFromEOLMode(int eolMode) { + if (eolMode == SC_EOL_CRLF) { + return "\r\n"; + } else if (eolMode == SC_EOL_CR) { + return "\r"; + } else { + return "\n"; + } +} + +void Editor::LinesSplit(int pixelWidth) { + if (!RangeContainsProtected(targetStart, targetEnd)) { + if (pixelWidth == 0) { + PRectangle rcText = GetTextRectangle(); + pixelWidth = rcText.Width(); + } + int lineStart = pdoc->LineFromPosition(targetStart); + int lineEnd = pdoc->LineFromPosition(targetEnd); + const char *eol = StringFromEOLMode(pdoc->eolMode); + UndoGroup ug(pdoc); + for (int line = lineStart; line <= lineEnd; line++) { + AutoSurface surface(this); + AutoLineLayout ll(llc, RetrieveLineLayout(line)); + if (surface && ll) { + unsigned int posLineStart = pdoc->LineStart(line); + LayoutLine(line, surface, vs, ll, pixelWidth); + for (int subLine = 1; subLine < ll->lines; subLine++) { + pdoc->InsertCString(posLineStart + (subLine - 1) * strlen(eol) + + ll->LineStart(subLine), eol); + targetEnd += static_cast(strlen(eol)); + } + } + lineEnd = pdoc->LineFromPosition(targetEnd); + } + } +} + +int Editor::SubstituteMarkerIfEmpty(int markerCheck, int markerDefault) { + if (vs.markers[markerCheck].markType == SC_MARK_EMPTY) + return markerDefault; + return markerCheck; +} + +// Avoid 64 bit compiler warnings. +// Scintilla does not support text buffers larger than 2**31 +static int istrlen(const char *s) { + return static_cast(strlen(s)); +} + +bool ValidStyledText(ViewStyle &vs, size_t styleOffset, const StyledText &st) { + if (st.multipleStyles) { + for (size_t iStyle=0;iStyle(styles[endSegment+1]) == style)) + endSegment++; + width += surface->WidthText(vs.styles[style+styleOffset].font, text + start, endSegment - start + 1); + start = endSegment + 1; + } + return width; +} + +static int WidestLineWidth(Surface *surface, ViewStyle &vs, int styleOffset, const StyledText &st) { + int widthMax = 0; + size_t start = 0; + while (start < st.length) { + size_t lenLine = st.LineLength(start); + int widthSubLine; + if (st.multipleStyles) { + widthSubLine = WidthStyledText(surface, vs, styleOffset, st.text + start, st.styles + start, lenLine); + } else { + widthSubLine = surface->WidthText(vs.styles[styleOffset + st.style].font, st.text + start, lenLine); + } + if (widthSubLine > widthMax) + widthMax = widthSubLine; + start += lenLine + 1; + } + return widthMax; +} + +void DrawStyledText(Surface *surface, ViewStyle &vs, int styleOffset, PRectangle rcText, int ascent, + const StyledText &st, size_t start, size_t length) { + + if (st.multipleStyles) { + int x = rcText.left; + size_t i = 0; + while (i < length) { + size_t end = i; + int style = st.styles[i + start]; + while (end < length-1 && st.styles[start+end+1] == style) + end++; + style += styleOffset; + int width = surface->WidthText(vs.styles[style].font, st.text + start + i, end - i + 1); + PRectangle rcSegment = rcText; + rcSegment.left = x; + rcSegment.right = x + width + 1; + surface->DrawTextNoClip(rcSegment, vs.styles[style].font, + ascent, st.text + start + i, end - i + 1, + vs.styles[style].fore.allocated, + vs.styles[style].back.allocated); + x += width; + i = end + 1; + } + } else { + int style = st.style + styleOffset; + surface->DrawTextNoClip(rcText, vs.styles[style].font, + rcText.top + vs.maxAscent, st.text + start, length, + vs.styles[style].fore.allocated, + vs.styles[style].back.allocated); + } +} + +void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { + if (vs.fixedColumnWidth == 0) + return; + + PRectangle rcMargin = GetClientRectangle(); + rcMargin.right = vs.fixedColumnWidth; + + if (!rc.Intersects(rcMargin)) + return; + + Surface *surface; + if (bufferedDraw) { + surface = pixmapSelMargin; + } else { + surface = surfWindow; + } + + PRectangle rcSelMargin = rcMargin; + rcSelMargin.right = rcMargin.left; + + for (int margin = 0; margin < vs.margins; margin++) { + if (vs.ms[margin].width > 0) { + + rcSelMargin.left = rcSelMargin.right; + rcSelMargin.right = rcSelMargin.left + vs.ms[margin].width; + + if (vs.ms[margin].style != SC_MARGIN_NUMBER) { + /* alternate scheme: + if (vs.ms[margin].mask & SC_MASK_FOLDERS) + surface->FillRectangle(rcSelMargin, vs.styles[STYLE_DEFAULT].back.allocated); + else + // Required because of special way brush is created for selection margin + surface->FillRectangle(rcSelMargin, pixmapSelPattern); + */ + if (vs.ms[margin].mask & SC_MASK_FOLDERS) + // Required because of special way brush is created for selection margin + surface->FillRectangle(rcSelMargin, *pixmapSelPattern); + else { + ColourAllocated colour; + switch (vs.ms[margin].style) { + case SC_MARGIN_BACK: + colour = vs.styles[STYLE_DEFAULT].back.allocated; + break; + case SC_MARGIN_FORE: + colour = vs.styles[STYLE_DEFAULT].fore.allocated; + break; + default: + colour = vs.styles[STYLE_LINENUMBER].back.allocated; + break; + } + surface->FillRectangle(rcSelMargin, colour); + } + } else { + surface->FillRectangle(rcSelMargin, vs.styles[STYLE_LINENUMBER].back.allocated); + } + + int visibleLine = topLine; + int yposScreen = 0; + + // Work out whether the top line is whitespace located after a + // lessening of fold level which implies a 'fold tail' but which should not + // be displayed until the last of a sequence of whitespace. + bool needWhiteClosure = false; + int level = pdoc->GetLevel(cs.DocFromDisplay(topLine)); + if (level & SC_FOLDLEVELWHITEFLAG) { + int lineBack = cs.DocFromDisplay(topLine); + int levelPrev = level; + while ((lineBack > 0) && (levelPrev & SC_FOLDLEVELWHITEFLAG)) { + lineBack--; + levelPrev = pdoc->GetLevel(lineBack); + } + if (!(levelPrev & SC_FOLDLEVELHEADERFLAG)) { + if ((level & SC_FOLDLEVELNUMBERMASK) < (levelPrev & SC_FOLDLEVELNUMBERMASK)) + needWhiteClosure = true; + } + } + + // Old code does not know about new markers needed to distinguish all cases + int folderOpenMid = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEROPENMID, + SC_MARKNUM_FOLDEROPEN); + int folderEnd = SubstituteMarkerIfEmpty(SC_MARKNUM_FOLDEREND, + SC_MARKNUM_FOLDER); + + while ((visibleLine < cs.LinesDisplayed()) && yposScreen < rcMargin.bottom) { + + PLATFORM_ASSERT(visibleLine < cs.LinesDisplayed()); + + int lineDoc = cs.DocFromDisplay(visibleLine); + PLATFORM_ASSERT(cs.GetVisible(lineDoc)); + bool firstSubLine = visibleLine == cs.DisplayFromDoc(lineDoc); + + // Decide which fold indicator should be displayed + level = pdoc->GetLevel(lineDoc); + int levelNext = pdoc->GetLevel(lineDoc + 1); + int marks = pdoc->GetMark(lineDoc); + if (!firstSubLine) + marks = 0; + int levelNum = level & SC_FOLDLEVELNUMBERMASK; + int levelNextNum = levelNext & SC_FOLDLEVELNUMBERMASK; + if (level & SC_FOLDLEVELHEADERFLAG) { + if (firstSubLine) { + if (cs.GetExpanded(lineDoc)) { + if (levelNum == SC_FOLDLEVELBASE) + marks |= 1 << SC_MARKNUM_FOLDEROPEN; + else + marks |= 1 << folderOpenMid; + } else { + if (levelNum == SC_FOLDLEVELBASE) + marks |= 1 << SC_MARKNUM_FOLDER; + else + marks |= 1 << folderEnd; + } + } else { + marks |= 1 << SC_MARKNUM_FOLDERSUB; + } + needWhiteClosure = false; + } else if (level & SC_FOLDLEVELWHITEFLAG) { + if (needWhiteClosure) { + if (levelNext & SC_FOLDLEVELWHITEFLAG) { + marks |= 1 << SC_MARKNUM_FOLDERSUB; + } else if (levelNum > SC_FOLDLEVELBASE) { + marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL; + needWhiteClosure = false; + } else { + marks |= 1 << SC_MARKNUM_FOLDERTAIL; + needWhiteClosure = false; + } + } else if (levelNum > SC_FOLDLEVELBASE) { + if (levelNextNum < levelNum) { + if (levelNextNum > SC_FOLDLEVELBASE) { + marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL; + } else { + marks |= 1 << SC_MARKNUM_FOLDERTAIL; + } + } else { + marks |= 1 << SC_MARKNUM_FOLDERSUB; + } + } + } else if (levelNum > SC_FOLDLEVELBASE) { + if (levelNextNum < levelNum) { + needWhiteClosure = false; + if (levelNext & SC_FOLDLEVELWHITEFLAG) { + marks |= 1 << SC_MARKNUM_FOLDERSUB; + needWhiteClosure = true; + } else if (levelNextNum > SC_FOLDLEVELBASE) { + marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL; + } else { + marks |= 1 << SC_MARKNUM_FOLDERTAIL; + } + } else { + marks |= 1 << SC_MARKNUM_FOLDERSUB; + } + } + + marks &= vs.ms[margin].mask; + PRectangle rcMarker = rcSelMargin; + rcMarker.top = yposScreen; + rcMarker.bottom = yposScreen + vs.lineHeight; + if (vs.ms[margin].style == SC_MARGIN_NUMBER) { + char number[100]; + number[0] = '\0'; + if (firstSubLine) + sprintf(number, "%d", lineDoc + 1); + if (foldFlags & SC_FOLDFLAG_LEVELNUMBERS) { + int lev = pdoc->GetLevel(lineDoc); + sprintf(number, "%c%c %03X %03X", + (lev & SC_FOLDLEVELHEADERFLAG) ? 'H' : '_', + (lev & SC_FOLDLEVELWHITEFLAG) ? 'W' : '_', + lev & SC_FOLDLEVELNUMBERMASK, + lev >> 16 + ); + } + PRectangle rcNumber = rcMarker; + // Right justify + int width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, istrlen(number)); + int xpos = rcNumber.right - width - 3; + rcNumber.left = xpos; + surface->DrawTextNoClip(rcNumber, vs.styles[STYLE_LINENUMBER].font, + rcNumber.top + vs.maxAscent, number, istrlen(number), + vs.styles[STYLE_LINENUMBER].fore.allocated, + vs.styles[STYLE_LINENUMBER].back.allocated); + } else if (vs.ms[margin].style == SC_MARGIN_TEXT || vs.ms[margin].style == SC_MARGIN_RTEXT) { + if (firstSubLine) { + const StyledText stMargin = pdoc->MarginStyledText(lineDoc); + if (stMargin.text && ValidStyledText(vs, vs.marginStyleOffset, stMargin)) { + surface->FillRectangle(rcMarker, + vs.styles[stMargin.StyleAt(0)+vs.marginStyleOffset].back.allocated); + if (vs.ms[margin].style == SC_MARGIN_RTEXT) { + int width = WidestLineWidth(surface, vs, vs.marginStyleOffset, stMargin); + rcMarker.left = rcMarker.right - width - 3; + } + DrawStyledText(surface, vs, vs.marginStyleOffset, rcMarker, rcMarker.top + vs.maxAscent, + stMargin, 0, stMargin.length); + } + } + } + + if (marks) { + for (int markBit = 0; (markBit < 32) && marks; markBit++) { + if (marks & 1) { + int lev = (pdoc->GetLevel(lineDoc) & SC_FOLDLEVELNUMBERMASK) - SC_FOLDLEVELBASE; + vs.markers[markBit].Draw(surface, rcMarker, vs.styles[STYLE_LINENUMBER].font, lev); + } + marks >>= 1; + } + } + + visibleLine++; + yposScreen += vs.lineHeight; + } + } + } + + PRectangle rcBlankMargin = rcMargin; + rcBlankMargin.left = rcSelMargin.right; + surface->FillRectangle(rcBlankMargin, vs.styles[STYLE_DEFAULT].back.allocated); + + if (bufferedDraw) { + surfWindow->Copy(rcMargin, Point(), *pixmapSelMargin); + } +} + +void DrawTabArrow(Surface *surface, PRectangle rcTab, int ymid) { + int ydiff = (rcTab.bottom - rcTab.top) / 2; + int xhead = rcTab.right - 1 - ydiff; + if (xhead <= rcTab.left) { + ydiff -= rcTab.left - xhead - 1; + xhead = rcTab.left - 1; + } + if ((rcTab.left + 2) < (rcTab.right - 1)) + surface->MoveTo(rcTab.left + 2, ymid); + else + surface->MoveTo(rcTab.right - 1, ymid); + surface->LineTo(rcTab.right - 1, ymid); + surface->LineTo(xhead, ymid - ydiff); + surface->MoveTo(rcTab.right - 1, ymid); + surface->LineTo(xhead, ymid + ydiff); +} + +LineLayout *Editor::RetrieveLineLayout(int lineNumber) { + int posLineStart = pdoc->LineStart(lineNumber); + int posLineEnd = pdoc->LineStart(lineNumber + 1); + PLATFORM_ASSERT(posLineEnd >= posLineStart); + int lineCaret = pdoc->LineFromPosition(sel.MainCaret()); + return llc.Retrieve(lineNumber, lineCaret, + posLineEnd - posLineStart, pdoc->GetStyleClock(), + LinesOnScreen() + 1, pdoc->LinesTotal()); +} + +static bool GoodTrailByte(int v) { + return (v >= 0x80) && (v < 0xc0); +} + +bool BadUTF(const char *s, int len, int &trailBytes) { + if (trailBytes) { + trailBytes--; + return false; + } + const unsigned char *us = reinterpret_cast(s); + if (*us < 0x80) { + // Single bytes easy + return false; + } else if (*us > 0xF4) { + // Characters longer than 4 bytes not possible in current UTF-8 + return true; + } else if (*us >= 0xF0) { + // 4 bytes + if (len < 4) + return true; + if (GoodTrailByte(us[1]) && GoodTrailByte(us[2]) && GoodTrailByte(us[3])) { + trailBytes = 3; + return false; + } else { + return true; + } + } else if (*us >= 0xE0) { + // 3 bytes + if (len < 3) + return true; + if (GoodTrailByte(us[1]) && GoodTrailByte(us[2])) { + trailBytes = 2; + return false; + } else { + return true; + } + } else if (*us >= 0xC2) { + // 2 bytes + if (len < 2) + return true; + if (GoodTrailByte(us[1])) { + trailBytes = 1; + return false; + } else { + return true; + } + } else if (*us >= 0xC0) { + // Overlong encoding + return true; + } else { + // Trail byte + return true; + } +} + +/** + * Fill in the LineLayout data for the given line. + * Copy the given @a line and its styles from the document into local arrays. + * Also determine the x position at which each character starts. + */ +void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll, int width) { + if (!ll) + return; + + PLATFORM_ASSERT(line < pdoc->LinesTotal()); + PLATFORM_ASSERT(ll->chars != NULL); + int posLineStart = pdoc->LineStart(line); + int posLineEnd = pdoc->LineStart(line + 1); + // If the line is very long, limit the treatment to a length that should fit in the viewport + if (posLineEnd > (posLineStart + ll->maxLineLength)) { + posLineEnd = posLineStart + ll->maxLineLength; + } + if (ll->validity == LineLayout::llCheckTextAndStyle) { + int lineLength = posLineEnd - posLineStart; + if (!vstyle.viewEOL) { + int cid = posLineEnd - 1; + while ((cid > posLineStart) && IsEOLChar(pdoc->CharAt(cid))) { + cid--; + lineLength--; + } + } + if (lineLength == ll->numCharsInLine) { + // See if chars, styles, indicators, are all the same + bool allSame = true; + const int styleMask = pdoc->stylingBitsMask; + // Check base line layout + char styleByte = 0; + int numCharsInLine = 0; + while (numCharsInLine < lineLength) { + int charInDoc = numCharsInLine + posLineStart; + char chDoc = pdoc->CharAt(charInDoc); + styleByte = pdoc->StyleAt(charInDoc); + allSame = allSame && + (ll->styles[numCharsInLine] == static_cast(styleByte & styleMask)); + allSame = allSame && + (ll->indicators[numCharsInLine] == static_cast(styleByte & ~styleMask)); + if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseMixed) + allSame = allSame && + (ll->chars[numCharsInLine] == chDoc); + else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower) + allSame = allSame && + (ll->chars[numCharsInLine] == static_cast(tolower(chDoc))); + else // Style::caseUpper + allSame = allSame && + (ll->chars[numCharsInLine] == static_cast(toupper(chDoc))); + numCharsInLine++; + } + allSame = allSame && (ll->styles[numCharsInLine] == styleByte); // For eolFilled + if (allSame) { + ll->validity = LineLayout::llPositions; + } else { + ll->validity = LineLayout::llInvalid; + } + } else { + ll->validity = LineLayout::llInvalid; + } + } + if (ll->validity == LineLayout::llInvalid) { + ll->widthLine = LineLayout::wrapWidthInfinite; + ll->lines = 1; + int numCharsInLine = 0; + int numCharsBeforeEOL = 0; + if (vstyle.edgeState == EDGE_BACKGROUND) { + ll->edgeColumn = pdoc->FindColumn(line, theEdge); + if (ll->edgeColumn >= posLineStart) { + ll->edgeColumn -= posLineStart; + } + } else { + ll->edgeColumn = -1; + } + + char styleByte = 0; + int styleMask = pdoc->stylingBitsMask; + ll->styleBitsSet = 0; + // Fill base line layout + for (int charInDoc = posLineStart; charInDoc < posLineEnd; charInDoc++) { + char chDoc = pdoc->CharAt(charInDoc); + styleByte = pdoc->StyleAt(charInDoc); + ll->styleBitsSet |= styleByte; + if (vstyle.viewEOL || (!IsEOLChar(chDoc))) { + ll->chars[numCharsInLine] = chDoc; + ll->styles[numCharsInLine] = static_cast(styleByte & styleMask); + ll->indicators[numCharsInLine] = static_cast(styleByte & ~styleMask); + if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseUpper) + ll->chars[numCharsInLine] = static_cast(toupper(chDoc)); + else if (vstyle.styles[ll->styles[numCharsInLine]].caseForce == Style::caseLower) + ll->chars[numCharsInLine] = static_cast(tolower(chDoc)); + numCharsInLine++; + if (!IsEOLChar(chDoc)) + numCharsBeforeEOL++; + } + } + ll->xHighlightGuide = 0; + // Extra element at the end of the line to hold end x position and act as + ll->chars[numCharsInLine] = 0; // Also triggers processing in the loops as this is a control character + ll->styles[numCharsInLine] = styleByte; // For eolFilled + ll->indicators[numCharsInLine] = 0; + + // Layout the line, determining the position of each character, + // with an extra element at the end for the end of the line. + int startseg = 0; // Start of the current segment, in char. number + int startsegx = 0; // Start of the current segment, in pixels + ll->positions[0] = 0; + unsigned int tabWidth = vstyle.spaceWidth * pdoc->tabInChars; + bool lastSegItalics = false; + Font &ctrlCharsFont = vstyle.styles[STYLE_CONTROLCHAR].font; + + int ctrlCharWidth[32] = {0}; + bool isControlNext = IsControlCharacter(ll->chars[0]); + int trailBytes = 0; + bool isBadUTFNext = IsUnicodeMode() && BadUTF(ll->chars, numCharsInLine, trailBytes); + for (int charInLine = 0; charInLine < numCharsInLine; charInLine++) { + bool isControl = isControlNext; + isControlNext = IsControlCharacter(ll->chars[charInLine + 1]); + bool isBadUTF = isBadUTFNext; + isBadUTFNext = IsUnicodeMode() && BadUTF(ll->chars + charInLine + 1, numCharsInLine - charInLine - 1, trailBytes); + if ((ll->styles[charInLine] != ll->styles[charInLine + 1]) || + isControl || isControlNext || isBadUTF || isBadUTFNext) { + ll->positions[startseg] = 0; + if (vstyle.styles[ll->styles[charInLine]].visible) { + if (isControl) { + if (ll->chars[charInLine] == '\t') { + ll->positions[charInLine + 1] = ((((startsegx + 2) / + tabWidth) + 1) * tabWidth) - startsegx; + } else if (controlCharSymbol < 32) { + if (ctrlCharWidth[ll->chars[charInLine]] == 0) { + const char *ctrlChar = ControlCharacterString(ll->chars[charInLine]); + // +3 For a blank on front and rounded edge each side: + ctrlCharWidth[ll->chars[charInLine]] = + surface->WidthText(ctrlCharsFont, ctrlChar, istrlen(ctrlChar)) + 3; + } + ll->positions[charInLine + 1] = ctrlCharWidth[ll->chars[charInLine]]; + } else { + char cc[2] = { static_cast(controlCharSymbol), '\0' }; + surface->MeasureWidths(ctrlCharsFont, cc, 1, + ll->positions + startseg + 1); + } + lastSegItalics = false; + } else if (isBadUTF) { + char hexits[3]; + sprintf(hexits, "%2X", ll->chars[charInLine] & 0xff); + ll->positions[charInLine + 1] = + surface->WidthText(ctrlCharsFont, hexits, istrlen(hexits)) + 3; + } else { // Regular character + int lenSeg = charInLine - startseg + 1; + if ((lenSeg == 1) && (' ' == ll->chars[startseg])) { + lastSegItalics = false; + // Over half the segments are single characters and of these about half are space characters. + ll->positions[charInLine + 1] = vstyle.styles[ll->styles[charInLine]].spaceWidth; + } else { + lastSegItalics = vstyle.styles[ll->styles[charInLine]].italic; + posCache.MeasureWidths(surface, vstyle, ll->styles[charInLine], ll->chars + startseg, + lenSeg, ll->positions + startseg + 1); + } + } + } else { // invisible + for (int posToZero = startseg; posToZero <= (charInLine + 1); posToZero++) { + ll->positions[posToZero] = 0; + } + } + for (int posToIncrease = startseg; posToIncrease <= (charInLine + 1); posToIncrease++) { + ll->positions[posToIncrease] += startsegx; + } + startsegx = ll->positions[charInLine + 1]; + startseg = charInLine + 1; + } + } + // Small hack to make lines that end with italics not cut off the edge of the last character + if ((startseg > 0) && lastSegItalics) { + ll->positions[startseg] += 2; + } + ll->numCharsInLine = numCharsInLine; + ll->numCharsBeforeEOL = numCharsBeforeEOL; + ll->validity = LineLayout::llPositions; + } + // Hard to cope when too narrow, so just assume there is space + if (width < 20) { + width = 20; + } + if ((ll->validity == LineLayout::llPositions) || (ll->widthLine != width)) { + ll->widthLine = width; + if (width == LineLayout::wrapWidthInfinite) { + ll->lines = 1; + } else if (width > ll->positions[ll->numCharsInLine]) { + // Simple common case where line does not need wrapping. + ll->lines = 1; + } else { + if (wrapVisualFlags & SC_WRAPVISUALFLAG_END) { + width -= vstyle.aveCharWidth; // take into account the space for end wrap mark + } + ll->wrapIndent = wrapAddIndent; + if (wrapIndentMode != SC_WRAPINDENT_FIXED) + for (int i = 0; i < ll->numCharsInLine; i++) { + if (!IsSpaceOrTab(ll->chars[i])) { + ll->wrapIndent += ll->positions[i]; // Add line indent + break; + } + } + // Check for text width minimum + if (ll->wrapIndent > width - static_cast(vstyle.aveCharWidth) * 15) + ll->wrapIndent = wrapAddIndent; + // Check for wrapIndent minimum + if ((wrapVisualFlags & SC_WRAPVISUALFLAG_START) && (ll->wrapIndent < static_cast(vstyle.aveCharWidth))) + ll->wrapIndent = vstyle.aveCharWidth; // Indent to show start visual + ll->lines = 0; + // Calculate line start positions based upon width. + int lastGoodBreak = 0; + int lastLineStart = 0; + int startOffset = 0; + int p = 0; + while (p < ll->numCharsInLine) { + if ((ll->positions[p + 1] - startOffset) >= width) { + if (lastGoodBreak == lastLineStart) { + // Try moving to start of last character + if (p > 0) { + lastGoodBreak = pdoc->MovePositionOutsideChar(p + posLineStart, -1) + - posLineStart; + } + if (lastGoodBreak == lastLineStart) { + // Ensure at least one character on line. + lastGoodBreak = pdoc->MovePositionOutsideChar(lastGoodBreak + posLineStart + 1, 1) + - posLineStart; + } + } + lastLineStart = lastGoodBreak; + ll->lines++; + ll->SetLineStart(ll->lines, lastGoodBreak); + startOffset = ll->positions[lastGoodBreak]; + // take into account the space for start wrap mark and indent + startOffset -= ll->wrapIndent; + p = lastGoodBreak + 1; + continue; + } + if (p > 0) { + if (wrapState == eWrapChar) { + lastGoodBreak = pdoc->MovePositionOutsideChar(p + posLineStart, -1) + - posLineStart; + p = pdoc->MovePositionOutsideChar(p + 1 + posLineStart, 1) - posLineStart; + continue; + } else if (ll->styles[p] != ll->styles[p - 1]) { + lastGoodBreak = p; + } else if (IsSpaceOrTab(ll->chars[p - 1]) && !IsSpaceOrTab(ll->chars[p])) { + lastGoodBreak = p; + } + } + p++; + } + ll->lines++; + } + ll->validity = LineLayout::llLines; + } +} + +ColourAllocated Editor::SelectionBackground(ViewStyle &vsDraw, bool main) { + return main ? + (primarySelection ? vsDraw.selbackground.allocated : vsDraw.selbackground2.allocated) : + vsDraw.selAdditionalBackground.allocated; +} + +ColourAllocated Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackground, + ColourAllocated background, int inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) { + if (inSelection == 1) { + if (vsDraw.selbackset && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) { + return SelectionBackground(vsDraw, true); + } + } else if (inSelection == 2) { + if (vsDraw.selbackset && (vsDraw.selAdditionalAlpha == SC_ALPHA_NOALPHA)) { + return SelectionBackground(vsDraw, false); + } + } else { + if ((vsDraw.edgeState == EDGE_BACKGROUND) && + (i >= ll->edgeColumn) && + !IsEOLChar(ll->chars[i])) + return vsDraw.edgecolour.allocated; + if (inHotspot && vsDraw.hotspotBackgroundSet) + return vsDraw.hotspotBackground.allocated; + if (overrideBackground && (styleMain != STYLE_BRACELIGHT) && (styleMain != STYLE_BRACEBAD)) + return background; + } + return vsDraw.styles[styleMain].back.allocated; +} + +void Editor::DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight) { + Point from(0, ((lineVisible & 1) && (lineHeight & 1)) ? 1 : 0); + PRectangle rcCopyArea(start + 1, rcSegment.top, start + 2, rcSegment.bottom); + surface->Copy(rcCopyArea, from, + highlight ? *pixmapIndentGuideHighlight : *pixmapIndentGuide); +} + +void Editor::DrawWrapMarker(Surface *surface, PRectangle rcPlace, + bool isEndMarker, ColourAllocated wrapColour) { + surface->PenColour(wrapColour); + + enum { xa = 1 }; // gap before start + int w = rcPlace.right - rcPlace.left - xa - 1; + + bool xStraight = isEndMarker; // x-mirrored symbol for start marker + bool yStraight = true; + //bool yStraight= isEndMarker; // comment in for start marker y-mirrowed + + int x0 = xStraight ? rcPlace.left : rcPlace.right - 1; + int y0 = yStraight ? rcPlace.top : rcPlace.bottom - 1; + + int dy = (rcPlace.bottom - rcPlace.top) / 5; + int y = (rcPlace.bottom - rcPlace.top) / 2 + dy; + + struct Relative { + Surface *surface; + int xBase; + int xDir; + int yBase; + int yDir; + void MoveTo(int xRelative, int yRelative) { + surface->MoveTo(xBase + xDir * xRelative, yBase + yDir * yRelative); + } + void LineTo(int xRelative, int yRelative) { + surface->LineTo(xBase + xDir * xRelative, yBase + yDir * yRelative); + } + }; + Relative rel = {surface, x0, xStraight ? 1 : -1, y0, yStraight ? 1 : -1}; + + // arrow head + rel.MoveTo(xa, y); + rel.LineTo(xa + 2*w / 3, y - dy); + rel.MoveTo(xa, y); + rel.LineTo(xa + 2*w / 3, y + dy); + + // arrow body + rel.MoveTo(xa, y); + rel.LineTo(xa + w, y); + rel.LineTo(xa + w, y - 2 * dy); + rel.LineTo(xa - 1, // on windows lineto is exclusive endpoint, perhaps GTK not... + y - 2 * dy); +} + +static void SimpleAlphaRectangle(Surface *surface, PRectangle rc, ColourAllocated fill, int alpha) { + if (alpha != SC_ALPHA_NOALPHA) { + surface->AlphaRectangle(rc, 0, fill, alpha, fill, alpha, 0); + } +} + +void DrawTextBlob(Surface *surface, ViewStyle &vsDraw, PRectangle rcSegment, + const char *s, ColourAllocated textBack, ColourAllocated textFore, bool twoPhaseDraw) { + if (!twoPhaseDraw) { + surface->FillRectangle(rcSegment, textBack); + } + Font &ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font; + int normalCharHeight = surface->Ascent(ctrlCharsFont) - + surface->InternalLeading(ctrlCharsFont); + PRectangle rcCChar = rcSegment; + rcCChar.left = rcCChar.left + 1; + rcCChar.top = rcSegment.top + vsDraw.maxAscent - normalCharHeight; + rcCChar.bottom = rcSegment.top + vsDraw.maxAscent + 1; + PRectangle rcCentral = rcCChar; + rcCentral.top++; + rcCentral.bottom--; + surface->FillRectangle(rcCentral, textFore); + PRectangle rcChar = rcCChar; + rcChar.left++; + rcChar.right--; + surface->DrawTextClipped(rcChar, ctrlCharsFont, + rcSegment.top + vsDraw.maxAscent, s, istrlen(s), + textBack, textFore); +} + +void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll, + int line, int lineEnd, int xStart, int subLine, int subLineStart, + bool overrideBackground, ColourAllocated background, + bool drawWrapMarkEnd, ColourAllocated wrapColour) { + + const int posLineStart = pdoc->LineStart(line); + const int styleMask = pdoc->stylingBitsMask; + PRectangle rcSegment = rcLine; + + const bool lastSubLine = subLine == (ll->lines - 1); + int virtualSpace = 0; + if (lastSubLine) { + const int spaceWidth = static_cast(vsDraw.styles[ll->EndLineStyle()].spaceWidth); + virtualSpace = sel.VirtualSpaceFor(pdoc->LineEnd(line)) * spaceWidth; + } + + // Fill in a PRectangle representing the end of line characters + + int xEol = ll->positions[lineEnd] - subLineStart; + + // Fill the virtual space and show selections within it + if (virtualSpace) { + rcSegment.left = xEol + xStart; + rcSegment.right = xEol + xStart + virtualSpace; + surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated); + if (!hideSelection && ((vsDraw.selAlpha == SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha == SC_ALPHA_NOALPHA))) { + SelectionSegment virtualSpaceRange(SelectionPosition(pdoc->LineEnd(line)), SelectionPosition(pdoc->LineEnd(line), sel.VirtualSpaceFor(pdoc->LineEnd(line)))); + for (size_t r=0; r(vsDraw.styles[ll->EndLineStyle()].spaceWidth); + rcSegment.left = xStart + ll->positions[portion.start.Position() - posLineStart] - subLineStart + portion.start.VirtualSpace() * spaceWidth; + rcSegment.right = xStart + ll->positions[portion.end.Position() - posLineStart] - subLineStart + portion.end.VirtualSpace() * spaceWidth; + rcSegment.left = Platform::Maximum(rcSegment.left, rcLine.left); + rcSegment.right = Platform::Minimum(rcSegment.right, rcLine.right); + surface->FillRectangle(rcSegment, SelectionBackground(vsDraw, r == sel.Main())); + } + } + } + } + } + + int posAfterLineEnd = pdoc->LineStart(line + 1); + int eolInSelection = (subLine == (ll->lines - 1)) ? sel.InSelectionForEOL(posAfterLineEnd) : 0; + int alpha = (eolInSelection == 1) ? vsDraw.selAlpha : vsDraw.selAdditionalAlpha; + + // Draw the [CR], [LF], or [CR][LF] blobs if visible line ends are on + int blobsWidth = 0; + if (lastSubLine) { + for (int eolPos=ll->numCharsBeforeEOL; eolPosnumCharsInLine; eolPos++) { + rcSegment.left = xStart + ll->positions[eolPos] - subLineStart + virtualSpace; + rcSegment.right = xStart + ll->positions[eolPos+1] - subLineStart + virtualSpace; + blobsWidth += rcSegment.Width(); + const char *ctrlChar = ControlCharacterString(ll->chars[eolPos]); + int inSelection = 0; + bool inHotspot = false; + int styleMain = ll->styles[eolPos]; + ColourAllocated textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, inHotspot, styleMain, eolPos, ll); + ColourAllocated textFore = vsDraw.styles[styleMain].fore.allocated; + if (!hideSelection && eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1)) { + if (alpha == SC_ALPHA_NOALPHA) { + surface->FillRectangle(rcSegment, SelectionBackground(vsDraw, eolInSelection == 1)); + } else { + surface->FillRectangle(rcSegment, textBack); + SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw, eolInSelection == 1), alpha); + } + } else { + surface->FillRectangle(rcSegment, textBack); + } + DrawTextBlob(surface, vsDraw, rcSegment, ctrlChar, textBack, textFore, twoPhaseDraw); + } + } + + // Draw the eol-is-selected rectangle + rcSegment.left = xEol + xStart + virtualSpace + blobsWidth; + rcSegment.right = xEol + xStart + virtualSpace + blobsWidth + vsDraw.aveCharWidth; + + if (!hideSelection && eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (alpha == SC_ALPHA_NOALPHA)) { + surface->FillRectangle(rcSegment, SelectionBackground(vsDraw, eolInSelection == 1)); + } else { + if (overrideBackground) { + surface->FillRectangle(rcSegment, background); + } else if (line < pdoc->LinesTotal() - 1) { + surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated); + } else { + surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back.allocated); + } + if (!hideSelection && eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (alpha != SC_ALPHA_NOALPHA)) { + SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw, eolInSelection == 1), alpha); + } + } + + // Fill the remainder of the line + rcSegment.left = xEol + xStart + virtualSpace + blobsWidth + vsDraw.aveCharWidth; + rcSegment.right = rcLine.right; + + if (!hideSelection && vsDraw.selEOLFilled && eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (alpha == SC_ALPHA_NOALPHA)) { + surface->FillRectangle(rcSegment, SelectionBackground(vsDraw, eolInSelection == 1)); + } else { + if (overrideBackground) { + surface->FillRectangle(rcSegment, background); + } else if (vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].eolFilled) { + surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated); + } else { + surface->FillRectangle(rcSegment, vsDraw.styles[STYLE_DEFAULT].back.allocated); + } + if (!hideSelection && vsDraw.selEOLFilled && eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (alpha != SC_ALPHA_NOALPHA)) { + SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw, eolInSelection == 1), alpha); + } + } + + if (drawWrapMarkEnd) { + PRectangle rcPlace = rcSegment; + + if (wrapVisualFlagsLocation & SC_WRAPVISUALFLAGLOC_END_BY_TEXT) { + rcPlace.left = ll->positions[ll->numCharsInLine] + xStart + virtualSpace; + rcPlace.right = rcPlace.left + vsDraw.aveCharWidth; + } else { + // draw left of the right text margin, to avoid clipping by the current clip rect + rcPlace.right = rcLine.right - vs.rightMarginWidth; + rcPlace.left = rcPlace.right - vsDraw.aveCharWidth; + } + DrawWrapMarker(surface, rcPlace, true, wrapColour); + } +} + +void Editor::DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int xStart, + PRectangle rcLine, LineLayout *ll, int subLine, int lineEnd, bool under) { + // Draw decorators + const int posLineStart = pdoc->LineStart(line); + const int lineStart = ll->LineStart(subLine); + const int subLineStart = ll->positions[lineStart]; + const int posLineEnd = posLineStart + lineEnd; + + if (!under) { + // Draw indicators + // foreach indicator... + for (int indicnum = 0, mask = 1 << pdoc->stylingBits; mask < 0x100; indicnum++) { + if (!(mask & ll->styleBitsSet)) { + mask <<= 1; + continue; + } + int startPos = -1; + // foreach style pos in line... + for (int indicPos = lineStart; indicPos <= lineEnd; indicPos++) { + // look for starts... + if (startPos < 0) { + // NOT in indicator run, looking for START + if (indicPos < lineEnd && (ll->indicators[indicPos] & mask)) + startPos = indicPos; + } + // ... or ends + if (startPos >= 0) { + // IN indicator run, looking for END + if (indicPos >= lineEnd || !(ll->indicators[indicPos] & mask)) { + // AT end of indicator run, DRAW it! + PRectangle rcIndic( + ll->positions[startPos] + xStart - subLineStart, + rcLine.top + vsDraw.maxAscent, + ll->positions[indicPos] + xStart - subLineStart, + rcLine.top + vsDraw.maxAscent + 3); + vsDraw.indicators[indicnum].Draw(surface, rcIndic, rcLine); + // RESET control var + startPos = -1; + } + } + } + mask <<= 1; + } + } + + for (Decoration *deco = pdoc->decorations.root; deco; deco = deco->next) { + if (under == vsDraw.indicators[deco->indicator].under) { + int startPos = posLineStart + lineStart; + if (!deco->rs.ValueAt(startPos)) { + startPos = deco->rs.EndRun(startPos); + } + while ((startPos < posLineEnd) && (deco->rs.ValueAt(startPos))) { + int endPos = deco->rs.EndRun(startPos); + if (endPos > posLineEnd) + endPos = posLineEnd; + PRectangle rcIndic( + ll->positions[startPos - posLineStart] + xStart - subLineStart, + rcLine.top + vsDraw.maxAscent, + ll->positions[endPos - posLineStart] + xStart - subLineStart, + rcLine.top + vsDraw.maxAscent + 3); + vsDraw.indicators[deco->indicator].Draw(surface, rcIndic, rcLine); + startPos = deco->rs.EndRun(endPos); + } + } + } +} + +void Editor::DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int xStart, + PRectangle rcLine, LineLayout *ll, int subLine) { + int indent = pdoc->GetLineIndentation(line) * vsDraw.spaceWidth; + PRectangle rcSegment = rcLine; + int annotationLine = subLine - ll->lines; + const StyledText stAnnotation = pdoc->AnnotationStyledText(line); + if (stAnnotation.text && ValidStyledText(vsDraw, vsDraw.annotationStyleOffset, stAnnotation)) { + surface->FillRectangle(rcSegment, vsDraw.styles[0].back.allocated); + if (vs.annotationVisible == ANNOTATION_BOXED) { + // Only care about calculating width if need to draw box + int widthAnnotation = WidestLineWidth(surface, vsDraw, vsDraw.annotationStyleOffset, stAnnotation); + widthAnnotation += vsDraw.spaceWidth * 2; // Margins + rcSegment.left = xStart + indent; + rcSegment.right = rcSegment.left + widthAnnotation; + surface->PenColour(vsDraw.styles[vsDraw.annotationStyleOffset].fore.allocated); + } else { + rcSegment.left = xStart; + } + const int annotationLines = pdoc->AnnotationLines(line); + size_t start = 0; + size_t lengthAnnotation = stAnnotation.LineLength(start); + int lineInAnnotation = 0; + while ((lineInAnnotation < annotationLine) && (start < stAnnotation.length)) { + start += lengthAnnotation + 1; + lengthAnnotation = stAnnotation.LineLength(start); + lineInAnnotation++; + } + + PRectangle rcText = rcSegment; + + if (vs.annotationVisible == ANNOTATION_BOXED) { + surface->FillRectangle(rcText, + vsDraw.styles[stAnnotation.StyleAt(start) + vsDraw.annotationStyleOffset].back.allocated); + rcText.left += vsDraw.spaceWidth; + } + + DrawStyledText(surface, vsDraw, vsDraw.annotationStyleOffset, rcText, rcText.top + vsDraw.maxAscent, + stAnnotation, start, lengthAnnotation); + if (vs.annotationVisible == ANNOTATION_BOXED) { + + // Set grey border colour + ColourDesired greyCol (128, 128, 128); + ColourDesired lightGreyCol(192, 192, 192); + + surface->PenColour(greyCol.AsLong()); + + surface->MoveTo(rcSegment.left, rcSegment.top); + surface->LineTo(rcSegment.left, rcSegment.bottom); + + surface->PenColour(lightGreyCol.AsLong()); + surface->MoveTo(rcSegment.right, rcSegment.top); + surface->LineTo(rcSegment.right, rcSegment.bottom); + + if (subLine == ll->lines){ + surface->PenColour(lightGreyCol.AsLong()); + surface->MoveTo(rcSegment.left, rcSegment.top); + surface->LineTo(rcSegment.right, rcSegment.top); + } + + if (subLine == ll->lines+annotationLines-1) { + surface->PenColour(greyCol.AsLong()); + surface->MoveTo(rcSegment.left, rcSegment.bottom - 1); + surface->LineTo(rcSegment.right, rcSegment.bottom - 1); + } + + } + } +} + +void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart, + PRectangle rcLine, LineLayout *ll, int subLine) { + + PRectangle rcSegment = rcLine; + + // Using one font for all control characters so it can be controlled independently to ensure + // the box goes around the characters tightly. Seems to be no way to work out what height + // is taken by an individual character - internal leading gives varying results. + Font &ctrlCharsFont = vsDraw.styles[STYLE_CONTROLCHAR].font; + + // See if something overrides the line background color: Either if caret is on the line + // and background color is set for that, or if a marker is defined that forces its background + // color onto the line, or if a marker is defined but has no selection margin in which to + // display itself (as long as it's not an SC_MARK_EMPTY marker). These are checked in order + // with the earlier taking precedence. When multiple markers cause background override, + // the color for the highest numbered one is used. + bool overrideBackground = false; + ColourAllocated background; + if (caret.active && vsDraw.showCaretLineBackground && (vsDraw.caretLineAlpha == SC_ALPHA_NOALPHA) && ll->containsCaret) { + overrideBackground = true; + background = vsDraw.caretLineBackground.allocated; + } + if (!overrideBackground) { + int marks = pdoc->GetMark(line); + for (int markBit = 0; (markBit < 32) && marks; markBit++) { + if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) && + (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) { + background = vsDraw.markers[markBit].back.allocated; + overrideBackground = true; + } + marks >>= 1; + } + } + if (!overrideBackground) { + if (vsDraw.maskInLine) { + int marksMasked = pdoc->GetMark(line) & vsDraw.maskInLine; + if (marksMasked) { + for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) { + if ((marksMasked & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY) && + (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) { + overrideBackground = true; + background = vsDraw.markers[markBit].back.allocated; + } + marksMasked >>= 1; + } + } + } + } + + bool drawWhitespaceBackground = (vsDraw.viewWhitespace != wsInvisible) && + (!overrideBackground) && (vsDraw.whitespaceBackgroundSet); + + bool inIndentation = subLine == 0; // Do not handle indentation except on first subline. + int indentWidth = pdoc->IndentSize() * vsDraw.spaceWidth; + + int posLineStart = pdoc->LineStart(line); + + int startseg = ll->LineStart(subLine); + int subLineStart = ll->positions[startseg]; + if (subLine >= ll->lines) { + DrawAnnotation(surface, vsDraw, line, xStart, rcLine, ll, subLine); + return; // No further drawing + } + int lineStart = 0; + int lineEnd = 0; + if (subLine < ll->lines) { + lineStart = ll->LineStart(subLine); + lineEnd = ll->LineStart(subLine + 1); + if (subLine == ll->lines - 1) { + lineEnd = ll->numCharsBeforeEOL; + } + } + + ColourAllocated wrapColour = vsDraw.styles[STYLE_DEFAULT].fore.allocated; + if (vsDraw.whitespaceForegroundSet) + wrapColour = vsDraw.whitespaceForeground.allocated; + + bool drawWrapMarkEnd = false; + + if (wrapVisualFlags & SC_WRAPVISUALFLAG_END) { + if (subLine + 1 < ll->lines) { + drawWrapMarkEnd = ll->LineStart(subLine + 1) != 0; + } + } + + if (ll->wrapIndent != 0) { + + bool continuedWrapLine = false; + if (subLine < ll->lines) { + continuedWrapLine = ll->LineStart(subLine) != 0; + } + + if (continuedWrapLine) { + // draw continuation rect + PRectangle rcPlace = rcSegment; + + rcPlace.left = ll->positions[startseg] + xStart - subLineStart; + rcPlace.right = rcPlace.left + ll->wrapIndent; + + // default bgnd here.. + surface->FillRectangle(rcSegment, overrideBackground ? background : + vsDraw.styles[STYLE_DEFAULT].back.allocated); + + // main line style would be below but this would be inconsistent with end markers + // also would possibly not be the style at wrap point + //int styleMain = ll->styles[lineStart]; + //surface->FillRectangle(rcPlace, vsDraw.styles[styleMain].back.allocated); + + if (wrapVisualFlags & SC_WRAPVISUALFLAG_START) { + + if (wrapVisualFlagsLocation & SC_WRAPVISUALFLAGLOC_START_BY_TEXT) + rcPlace.left = rcPlace.right - vsDraw.aveCharWidth; + else + rcPlace.right = rcPlace.left + vsDraw.aveCharWidth; + + DrawWrapMarker(surface, rcPlace, false, wrapColour); + } + + xStart += ll->wrapIndent; + } + } + + // Does not take margin into account but not significant + int xStartVisible = subLineStart - xStart; + + ll->psel = &sel; + BreakFinder bfBack(ll, lineStart, lineEnd, posLineStart, IsUnicodeMode(), xStartVisible); + int next = bfBack.First(); + + // Background drawing loop + while (twoPhaseDraw && (next < lineEnd)) { + + startseg = next; + next = bfBack.Next(); + int i = next - 1; + int iDoc = i + posLineStart; + + rcSegment.left = ll->positions[startseg] + xStart - subLineStart; + rcSegment.right = ll->positions[i + 1] + xStart - subLineStart; + // Only try to draw if really visible - enhances performance by not calling environment to + // draw strings that are completely past the right side of the window. + if ((rcSegment.left <= rcLine.right) && (rcSegment.right >= rcLine.left)) { + // Clip to line rectangle, since may have a huge position which will not work with some platforms + rcSegment.left = Platform::Maximum(rcSegment.left, rcLine.left); + rcSegment.right = Platform::Minimum(rcSegment.right, rcLine.right); + + int styleMain = ll->styles[i]; + const int inSelection = hideSelection ? 0 : sel.CharacterInSelection(iDoc); + bool inHotspot = (ll->hsStart != -1) && (iDoc >= ll->hsStart) && (iDoc < ll->hsEnd); + ColourAllocated textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, inHotspot, styleMain, i, ll); + if (ll->chars[i] == '\t') { + // Tab display + if (drawWhitespaceBackground && + (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) + textBack = vsDraw.whitespaceBackground.allocated; + surface->FillRectangle(rcSegment, textBack); + } else if (IsControlCharacter(ll->chars[i])) { + // Control character display + inIndentation = false; + surface->FillRectangle(rcSegment, textBack); + } else { + // Normal text display + surface->FillRectangle(rcSegment, textBack); + if (vsDraw.viewWhitespace != wsInvisible || + (inIndentation && vsDraw.viewIndentationGuides == ivReal)) { + for (int cpos = 0; cpos <= i - startseg; cpos++) { + if (ll->chars[cpos + startseg] == ' ') { + if (drawWhitespaceBackground && + (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) { + PRectangle rcSpace(ll->positions[cpos + startseg] + xStart - subLineStart, + rcSegment.top, + ll->positions[cpos + startseg + 1] + xStart - subLineStart, + rcSegment.bottom); + surface->FillRectangle(rcSpace, vsDraw.whitespaceBackground.allocated); + } + } else { + inIndentation = false; + } + } + } + } + } else if (rcSegment.left > rcLine.right) { + break; + } + } + + if (twoPhaseDraw) { + DrawEOL(surface, vsDraw, rcLine, ll, line, lineEnd, + xStart, subLine, subLineStart, overrideBackground, background, + drawWrapMarkEnd, wrapColour); + } + + DrawIndicators(surface, vsDraw, line, xStart, rcLine, ll, subLine, lineEnd, true); + + if (vsDraw.edgeState == EDGE_LINE) { + int edgeX = theEdge * vsDraw.spaceWidth; + rcSegment.left = edgeX + xStart; + rcSegment.right = rcSegment.left + 1; + surface->FillRectangle(rcSegment, vsDraw.edgecolour.allocated); + } + + // Draw underline mark as part of background if not transparent + int marks = pdoc->GetMark(line); + int markBit; + for (markBit = 0; (markBit < 32) && marks; markBit++) { + if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_UNDERLINE) && + (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) { + PRectangle rcUnderline = rcLine; + rcUnderline.top = rcUnderline.bottom - 2; + surface->FillRectangle(rcUnderline, vsDraw.markers[markBit].back.allocated); + } + marks >>= 1; + } + + inIndentation = subLine == 0; // Do not handle indentation except on first subline. + // Foreground drawing loop + BreakFinder bfFore(ll, lineStart, lineEnd, posLineStart, IsUnicodeMode(), xStartVisible); + next = bfFore.First(); + + while (next < lineEnd) { + + startseg = next; + next = bfFore.Next(); + int i = next - 1; + + int iDoc = i + posLineStart; + + rcSegment.left = ll->positions[startseg] + xStart - subLineStart; + rcSegment.right = ll->positions[i + 1] + xStart - subLineStart; + // Only try to draw if really visible - enhances performance by not calling environment to + // draw strings that are completely past the right side of the window. + if ((rcSegment.left <= rcLine.right) && (rcSegment.right >= rcLine.left)) { + int styleMain = ll->styles[i]; + ColourAllocated textFore = vsDraw.styles[styleMain].fore.allocated; + Font &textFont = vsDraw.styles[styleMain].font; + //hotspot foreground + if (ll->hsStart != -1 && iDoc >= ll->hsStart && iDoc < hsEnd) { + if (vsDraw.hotspotForegroundSet) + textFore = vsDraw.hotspotForeground.allocated; + } + const int inSelection = hideSelection ? 0 : sel.CharacterInSelection(iDoc); + if (inSelection && (vsDraw.selforeset)) { + textFore = (inSelection == 1) ? vsDraw.selforeground.allocated : vsDraw.selAdditionalForeground.allocated; + } + bool inHotspot = (ll->hsStart != -1) && (iDoc >= ll->hsStart) && (iDoc < ll->hsEnd); + ColourAllocated textBack = TextBackground(vsDraw, overrideBackground, background, inSelection, inHotspot, styleMain, i, ll); + if (ll->chars[i] == '\t') { + // Tab display + if (!twoPhaseDraw) { + if (drawWhitespaceBackground && + (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) + textBack = vsDraw.whitespaceBackground.allocated; + surface->FillRectangle(rcSegment, textBack); + } + if ((vsDraw.viewWhitespace != wsInvisible) || + (inIndentation && vsDraw.viewIndentationGuides != ivNone)) { + if (vsDraw.whitespaceForegroundSet) + textFore = vsDraw.whitespaceForeground.allocated; + surface->PenColour(textFore); + } + if (inIndentation && vsDraw.viewIndentationGuides == ivReal) { + for (int xIG = ll->positions[i] / indentWidth * indentWidth; xIG < ll->positions[i + 1]; xIG += indentWidth) { + if (xIG >= ll->positions[i] && xIG > 0) { + DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIG + xStart, rcSegment, + (ll->xHighlightGuide == xIG)); + } + } + } + if (vsDraw.viewWhitespace != wsInvisible) { + if (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways) { + PRectangle rcTab(rcSegment.left + 1, rcSegment.top + 4, + rcSegment.right - 1, rcSegment.bottom - vsDraw.maxDescent); + DrawTabArrow(surface, rcTab, rcSegment.top + vsDraw.lineHeight / 2); + } + } + } else if (IsControlCharacter(ll->chars[i])) { + // Control character display + inIndentation = false; + if (controlCharSymbol < 32) { + // Draw the character + const char *ctrlChar = ControlCharacterString(ll->chars[i]); + DrawTextBlob(surface, vsDraw, rcSegment, ctrlChar, textBack, textFore, twoPhaseDraw); + } else { + char cc[2] = { static_cast(controlCharSymbol), '\0' }; + surface->DrawTextNoClip(rcSegment, ctrlCharsFont, + rcSegment.top + vsDraw.maxAscent, + cc, 1, textBack, textFore); + } + } else if ((i == startseg) && (static_cast(ll->chars[i]) >= 0x80) && IsUnicodeMode()) { + char hexits[3]; + sprintf(hexits, "%2X", ll->chars[i] & 0xff); + DrawTextBlob(surface, vsDraw, rcSegment, hexits, textBack, textFore, twoPhaseDraw); + } else { + // Normal text display + if (vsDraw.styles[styleMain].visible) { + if (twoPhaseDraw) { + surface->DrawTextTransparent(rcSegment, textFont, + rcSegment.top + vsDraw.maxAscent, ll->chars + startseg, + i - startseg + 1, textFore); + } else { + surface->DrawTextNoClip(rcSegment, textFont, + rcSegment.top + vsDraw.maxAscent, ll->chars + startseg, + i - startseg + 1, textFore, textBack); + } + } + if (vsDraw.viewWhitespace != wsInvisible || + (inIndentation && vsDraw.viewIndentationGuides != ivNone)) { + for (int cpos = 0; cpos <= i - startseg; cpos++) { + if (ll->chars[cpos + startseg] == ' ') { + if (vsDraw.viewWhitespace != wsInvisible) { + if (vsDraw.whitespaceForegroundSet) + textFore = vsDraw.whitespaceForeground.allocated; + if (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways) { + int xmid = (ll->positions[cpos + startseg] + ll->positions[cpos + startseg + 1]) / 2; + if (!twoPhaseDraw && drawWhitespaceBackground && + (!inIndentation || vsDraw.viewWhitespace == wsVisibleAlways)) { + textBack = vsDraw.whitespaceBackground.allocated; + PRectangle rcSpace(ll->positions[cpos + startseg] + xStart - subLineStart, + rcSegment.top, + ll->positions[cpos + startseg + 1] + xStart - subLineStart, + rcSegment.bottom); + surface->FillRectangle(rcSpace, textBack); + } + PRectangle rcDot(xmid + xStart - subLineStart, rcSegment.top + vsDraw.lineHeight / 2, 0, 0); + rcDot.right = rcDot.left + 1; + rcDot.bottom = rcDot.top + 1; + surface->FillRectangle(rcDot, textFore); + } + } + if (inIndentation && vsDraw.viewIndentationGuides == ivReal) { + int startSpace = ll->positions[cpos + startseg]; + if (startSpace > 0 && (startSpace % indentWidth == 0)) { + DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, startSpace + xStart, rcSegment, + (ll->xHighlightGuide == ll->positions[cpos + startseg])); + } + } + } else { + inIndentation = false; + } + } + } + } + if (ll->hsStart != -1 && vsDraw.hotspotUnderline && iDoc >= ll->hsStart && iDoc < ll->hsEnd ) { + PRectangle rcUL = rcSegment; + rcUL.top = rcUL.top + vsDraw.maxAscent + 1; + rcUL.bottom = rcUL.top + 1; + if (vsDraw.hotspotForegroundSet) + surface->FillRectangle(rcUL, vsDraw.hotspotForeground.allocated); + else + surface->FillRectangle(rcUL, textFore); + } else if (vsDraw.styles[styleMain].underline) { + PRectangle rcUL = rcSegment; + rcUL.top = rcUL.top + vsDraw.maxAscent + 1; + rcUL.bottom = rcUL.top + 1; + surface->FillRectangle(rcUL, textFore); + } + } else if (rcSegment.left > rcLine.right) { + break; + } + } + if ((vsDraw.viewIndentationGuides == ivLookForward || vsDraw.viewIndentationGuides == ivLookBoth) + && (subLine == 0)) { + int indentSpace = pdoc->GetLineIndentation(line); + int xStartText = ll->positions[pdoc->GetLineIndentPosition(line) - posLineStart]; + + // Find the most recent line with some text + + int lineLastWithText = line; + while (lineLastWithText > Platform::Maximum(line-20, 0) && pdoc->IsWhiteLine(lineLastWithText)) { + lineLastWithText--; + } + if (lineLastWithText < line) { + xStartText = 100000; // Don't limit to visible indentation on empty line + // This line is empty, so use indentation of last line with text + int indentLastWithText = pdoc->GetLineIndentation(lineLastWithText); + int isFoldHeader = pdoc->GetLevel(lineLastWithText) & SC_FOLDLEVELHEADERFLAG; + if (isFoldHeader) { + // Level is one more level than parent + indentLastWithText += pdoc->IndentSize(); + } + if (vsDraw.viewIndentationGuides == ivLookForward) { + // In viLookForward mode, previous line only used if it is a fold header + if (isFoldHeader) { + indentSpace = Platform::Maximum(indentSpace, indentLastWithText); + } + } else { // viLookBoth + indentSpace = Platform::Maximum(indentSpace, indentLastWithText); + } + } + + int lineNextWithText = line; + while (lineNextWithText < Platform::Minimum(line+20, pdoc->LinesTotal()) && pdoc->IsWhiteLine(lineNextWithText)) { + lineNextWithText++; + } + if (lineNextWithText > line) { + // This line is empty, so use indentation of last line with text + indentSpace = Platform::Maximum(indentSpace, + pdoc->GetLineIndentation(lineNextWithText)); + } + + for (int indentPos = pdoc->IndentSize(); indentPos < indentSpace; indentPos += pdoc->IndentSize()) { + int xIndent = indentPos * vsDraw.spaceWidth; + if (xIndent < xStartText) { + DrawIndentGuide(surface, lineVisible, vsDraw.lineHeight, xIndent + xStart, rcSegment, + (ll->xHighlightGuide == xIndent)); + } + } + } + + DrawIndicators(surface, vsDraw, line, xStart, rcLine, ll, subLine, lineEnd, false); + + // End of the drawing of the current line + if (!twoPhaseDraw) { + DrawEOL(surface, vsDraw, rcLine, ll, line, lineEnd, + xStart, subLine, subLineStart, overrideBackground, background, + drawWrapMarkEnd, wrapColour); + } + if (!hideSelection && ((vsDraw.selAlpha != SC_ALPHA_NOALPHA) || (vsDraw.selAdditionalAlpha != SC_ALPHA_NOALPHA))) { + // For each selection draw + int virtualSpaces = 0; + if (subLine == (ll->lines - 1)) { + virtualSpaces = sel.VirtualSpaceFor(pdoc->LineEnd(line)); + } + SelectionSegment virtualSpaceRange(SelectionPosition(posLineStart), SelectionPosition(posLineStart + lineEnd, virtualSpaces)); + for (size_t r=0; r(vsDraw.styles[ll->EndLineStyle()].spaceWidth); + rcSegment.left = xStart + ll->positions[portion.start.Position() - posLineStart] - subLineStart + portion.start.VirtualSpace() * spaceWidth; + rcSegment.right = xStart + ll->positions[portion.end.Position() - posLineStart] - subLineStart + portion.end.VirtualSpace() * spaceWidth; + rcSegment.left = Platform::Maximum(rcSegment.left, rcLine.left); + rcSegment.right = Platform::Minimum(rcSegment.right, rcLine.right); + SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw, r == sel.Main()), alpha); + } + } + } + } + + // Draw any translucent whole line states + rcSegment.left = xStart; + rcSegment.right = rcLine.right - 1; + if (caret.active && vsDraw.showCaretLineBackground && ll->containsCaret) { + SimpleAlphaRectangle(surface, rcSegment, vsDraw.caretLineBackground.allocated, vsDraw.caretLineAlpha); + } + marks = pdoc->GetMark(line); + for (markBit = 0; (markBit < 32) && marks; markBit++) { + if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND)) { + SimpleAlphaRectangle(surface, rcSegment, vsDraw.markers[markBit].back.allocated, vsDraw.markers[markBit].alpha); + } else if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_UNDERLINE)) { + PRectangle rcUnderline = rcSegment; + rcUnderline.top = rcUnderline.bottom - 2; + SimpleAlphaRectangle(surface, rcUnderline, vsDraw.markers[markBit].back.allocated, vsDraw.markers[markBit].alpha); + } + marks >>= 1; + } + if (vsDraw.maskInLine) { + int marksMasked = pdoc->GetMark(line) & vsDraw.maskInLine; + if (marksMasked) { + for (markBit = 0; (markBit < 32) && marksMasked; markBit++) { + if ((marksMasked & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY)) { + SimpleAlphaRectangle(surface, rcSegment, vsDraw.markers[markBit].back.allocated, vsDraw.markers[markBit].alpha); + } + marksMasked >>= 1; + } + } + } +} + +void Editor::DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine, + int xStart, int offset, int posCaret, PRectangle rcCaret, ColourAllocated caretColour) { + + int lineStart = ll->LineStart(subLine); + int posBefore = posCaret; + int posAfter = MovePositionOutsideChar(posCaret + 1, 1); + int numCharsToDraw = posAfter - posCaret; + + // Work out where the starting and ending offsets are. We need to + // see if the previous character shares horizontal space, such as a + // glyph / combining character. If so we'll need to draw that too. + int offsetFirstChar = offset; + int offsetLastChar = offset + (posAfter - posCaret); + while ((offsetLastChar - numCharsToDraw) >= lineStart) { + if ((ll->positions[offsetLastChar] - ll->positions[offsetLastChar - numCharsToDraw]) > 0) { + // The char does not share horizontal space + break; + } + // Char shares horizontal space, update the numChars to draw + // Update posBefore to point to the prev char + posBefore = MovePositionOutsideChar(posBefore - 1, -1); + numCharsToDraw = posAfter - posBefore; + offsetFirstChar = offset - (posCaret - posBefore); + } + + // See if the next character shares horizontal space, if so we'll + // need to draw that too. + numCharsToDraw = offsetLastChar - offsetFirstChar; + while ((offsetLastChar < ll->LineStart(subLine + 1)) && (offsetLastChar <= ll->numCharsInLine)) { + // Update posAfter to point to the 2nd next char, this is where + // the next character ends, and 2nd next begins. We'll need + // to compare these two + posBefore = posAfter; + posAfter = MovePositionOutsideChar(posAfter + 1, 1); + offsetLastChar = offset + (posAfter - posCaret); + if ((ll->positions[offsetLastChar] - ll->positions[offsetLastChar - (posAfter - posBefore)]) > 0) { + // The char does not share horizontal space + break; + } + // Char shares horizontal space, update the numChars to draw + numCharsToDraw = offsetLastChar - offsetFirstChar; + } + + // We now know what to draw, update the caret drawing rectangle + rcCaret.left = ll->positions[offsetFirstChar] - ll->positions[lineStart] + xStart; + rcCaret.right = ll->positions[offsetFirstChar+numCharsToDraw] - ll->positions[lineStart] + xStart; + + // Adjust caret position to take into account any word wrapping symbols. + if ((ll->wrapIndent != 0) && (lineStart != 0)) { + int wordWrapCharWidth = ll->wrapIndent; + rcCaret.left += wordWrapCharWidth; + rcCaret.right += wordWrapCharWidth; + } + + // This character is where the caret block is, we override the colours + // (inversed) for drawing the caret here. + int styleMain = ll->styles[offsetFirstChar]; + surface->DrawTextClipped(rcCaret, vsDraw.styles[styleMain].font, + rcCaret.top + vsDraw.maxAscent, ll->chars + offsetFirstChar, + numCharsToDraw, vsDraw.styles[styleMain].back.allocated, + caretColour); +} + +void Editor::RefreshPixMaps(Surface *surfaceWindow) { + if (!pixmapSelPattern->Initialised()) { + const int patternSize = 8; + pixmapSelPattern->InitPixMap(patternSize, patternSize, surfaceWindow, wMain.GetID()); + // This complex procedure is to reproduce the checkerboard dithered pattern used by windows + // for scroll bars and Visual Studio for its selection margin. The colour of this pattern is half + // way between the chrome colour and the chrome highlight colour making a nice transition + // between the window chrome and the content area. And it works in low colour depths. + PRectangle rcPattern(0, 0, patternSize, patternSize); + + // Initialize default colours based on the chrome colour scheme. Typically the highlight is white. + ColourAllocated colourFMFill = vs.selbar.allocated; + ColourAllocated colourFMStripes = vs.selbarlight.allocated; + + if (!(vs.selbarlight.desired == ColourDesired(0xff, 0xff, 0xff))) { + // User has chosen an unusual chrome colour scheme so just use the highlight edge colour. + // (Typically, the highlight colour is white.) + colourFMFill = vs.selbarlight.allocated; + } + + if (vs.foldmarginColourSet) { + // override default fold margin colour + colourFMFill = vs.foldmarginColour.allocated; + } + if (vs.foldmarginHighlightColourSet) { + // override default fold margin highlight colour + colourFMStripes = vs.foldmarginHighlightColour.allocated; + } + + pixmapSelPattern->FillRectangle(rcPattern, colourFMFill); + pixmapSelPattern->PenColour(colourFMStripes); + for (int stripe = 0; stripe < patternSize; stripe++) { + // Alternating 1 pixel stripes is same as checkerboard. + pixmapSelPattern->MoveTo(0, stripe * 2); + pixmapSelPattern->LineTo(patternSize, stripe * 2 - patternSize); + } + } + + if (!pixmapIndentGuide->Initialised()) { + // 1 extra pixel in height so can handle odd/even positions and so produce a continuous line + pixmapIndentGuide->InitPixMap(1, vs.lineHeight + 1, surfaceWindow, wMain.GetID()); + pixmapIndentGuideHighlight->InitPixMap(1, vs.lineHeight + 1, surfaceWindow, wMain.GetID()); + PRectangle rcIG(0, 0, 1, vs.lineHeight); + pixmapIndentGuide->FillRectangle(rcIG, vs.styles[STYLE_INDENTGUIDE].back.allocated); + pixmapIndentGuide->PenColour(vs.styles[STYLE_INDENTGUIDE].fore.allocated); + pixmapIndentGuideHighlight->FillRectangle(rcIG, vs.styles[STYLE_BRACELIGHT].back.allocated); + pixmapIndentGuideHighlight->PenColour(vs.styles[STYLE_BRACELIGHT].fore.allocated); + for (int stripe = 1; stripe < vs.lineHeight + 1; stripe += 2) { + pixmapIndentGuide->MoveTo(0, stripe); + pixmapIndentGuide->LineTo(2, stripe); + pixmapIndentGuideHighlight->MoveTo(0, stripe); + pixmapIndentGuideHighlight->LineTo(2, stripe); + } + } + + if (bufferedDraw) { + if (!pixmapLine->Initialised()) { + PRectangle rcClient = GetClientRectangle(); + pixmapLine->InitPixMap(rcClient.Width(), vs.lineHeight, + surfaceWindow, wMain.GetID()); + pixmapSelMargin->InitPixMap(vs.fixedColumnWidth, + rcClient.Height(), surfaceWindow, wMain.GetID()); + } + } +} + +void Editor::DrawCarets(Surface *surface, ViewStyle &vsDraw, int lineDoc, int xStart, + PRectangle rcLine, LineLayout *ll, int subLine) { + // When drag is active it is the only caret drawn + bool drawDrag = posDrag.IsValid(); + if (hideSelection && !drawDrag) + return; + const int posLineStart = pdoc->LineStart(lineDoc); + // For each selection draw + for (size_t r=0; (r(vsDraw.styles[ll->EndLineStyle()].spaceWidth); + const int virtualOffset = posCaret.VirtualSpace() * spaceWidth; + if (ll->InLine(offset, subLine) && offset <= ll->numCharsBeforeEOL) { + int xposCaret = ll->positions[offset] + virtualOffset - ll->positions[ll->LineStart(subLine)] + xStart; + if (ll->wrapIndent != 0) { + int lineStart = ll->LineStart(subLine); + if (lineStart != 0) // Wrapped + xposCaret += ll->wrapIndent; + } + if ((xposCaret >= 0) && (vsDraw.caretWidth > 0) && (vsDraw.caretStyle != CARETSTYLE_INVISIBLE) && + ((posDrag.IsValid()) || ((caret.active && caret.on) || (!additionalCaretsBlink && !mainCaret)))) { + bool caretAtEOF = false; + bool caretAtEOL = false; + bool drawBlockCaret = false; + int widthOverstrikeCaret; + int caretWidthOffset = 0; + PRectangle rcCaret = rcLine; + + if (posCaret.Position() == pdoc->Length()) { // At end of document + caretAtEOF = true; + widthOverstrikeCaret = vsDraw.aveCharWidth; + } else if ((posCaret.Position() - posLineStart) >= ll->numCharsInLine) { // At end of line + caretAtEOL = true; + widthOverstrikeCaret = vsDraw.aveCharWidth; + } else { + widthOverstrikeCaret = ll->positions[offset + 1] - ll->positions[offset]; + } + if (widthOverstrikeCaret < 3) // Make sure its visible + widthOverstrikeCaret = 3; + + if (posCaret > SelectionPosition(ll->LineStart(subLine) + posLineStart)) + caretWidthOffset = 1; // Move back so overlaps both character cells. + if (posDrag.IsValid()) { + /* Dragging text, use a line caret */ + rcCaret.left = xposCaret - caretWidthOffset; + rcCaret.right = rcCaret.left + vsDraw.caretWidth; + } else if (inOverstrike) { + /* Overstrike (insert mode), use a modified bar caret */ + rcCaret.top = rcCaret.bottom - 2; + rcCaret.left = xposCaret + 1; + rcCaret.right = rcCaret.left + widthOverstrikeCaret - 1; + } else if (vsDraw.caretStyle == CARETSTYLE_BLOCK) { + /* Block caret */ + rcCaret.left = xposCaret; + if (!caretAtEOL && !caretAtEOF && (ll->chars[offset] != '\t') && !(IsControlCharacter(ll->chars[offset]))) { + drawBlockCaret = true; + rcCaret.right = xposCaret + widthOverstrikeCaret; + } else { + rcCaret.right = xposCaret + vsDraw.aveCharWidth; + } + } else { + /* Line caret */ + rcCaret.left = xposCaret - caretWidthOffset; + rcCaret.right = rcCaret.left + vsDraw.caretWidth; + } + ColourAllocated caretColour = mainCaret ? vsDraw.caretcolour.allocated : vsDraw.additionalCaretColour.allocated; + if (drawBlockCaret) { + DrawBlockCaret(surface, vsDraw, ll, subLine, xStart, offset, posCaret.Position(), rcCaret, caretColour); + } else { + surface->FillRectangle(rcCaret, caretColour); + } + } + } + if (drawDrag) + break; + } +} + +void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) { + //Platform::DebugPrintf("Paint:%1d (%3d,%3d) ... (%3d,%3d)\n", + // paintingAllText, rcArea.left, rcArea.top, rcArea.right, rcArea.bottom); + + pixmapLine->Release(); + RefreshStyleData(); + RefreshPixMaps(surfaceWindow); + + PRectangle rcClient = GetClientRectangle(); + //Platform::DebugPrintf("Client: (%3d,%3d) ... (%3d,%3d) %d\n", + // rcClient.left, rcClient.top, rcClient.right, rcClient.bottom); + + surfaceWindow->SetPalette(&palette, true); + pixmapLine->SetPalette(&palette, !hasFocus); + + int screenLinePaintFirst = rcArea.top / vs.lineHeight; + // The area to be painted plus one extra line is styled. + // The extra line is to determine when a style change, such as starting a comment flows on to other lines. + int lineStyleLast = topLine + (rcArea.bottom - 1) / vs.lineHeight + 1; + //Platform::DebugPrintf("Paint lines = %d .. %d\n", topLine + screenLinePaintFirst, lineStyleLast); + int endPosPaint = pdoc->Length(); + if (lineStyleLast < cs.LinesDisplayed()) + endPosPaint = pdoc->LineStart(cs.DocFromDisplay(lineStyleLast) + 1); + + int xStart = vs.fixedColumnWidth - xOffset; + int ypos = 0; + if (!bufferedDraw) + ypos += screenLinePaintFirst * vs.lineHeight; + int yposScreen = screenLinePaintFirst * vs.lineHeight; + + // Ensure we are styled as far as we are painting. + pdoc->EnsureStyledTo(endPosPaint); + bool paintAbandonedByStyling = paintState == paintAbandoned; + if (needUpdateUI) { + // Deselect palette by selecting a temporary palette + Palette palTemp; + surfaceWindow->SetPalette(&palTemp, true); + + NotifyUpdateUI(); + needUpdateUI = false; + + RefreshStyleData(); + RefreshPixMaps(surfaceWindow); + surfaceWindow->SetPalette(&palette, true); + pixmapLine->SetPalette(&palette, !hasFocus); + } + + // Call priority lines wrap on a window of lines which are likely + // to rendered with the following paint (that is wrap the visible + // lines first). + int startLineToWrap = cs.DocFromDisplay(topLine) - 5; + if (startLineToWrap < 0) + startLineToWrap = 0; + if (WrapLines(false, startLineToWrap)) { + // The wrapping process has changed the height of some lines so + // abandon this paint for a complete repaint. + if (AbandonPaint()) { + return; + } + RefreshPixMaps(surfaceWindow); // In case pixmaps invalidated by scrollbar change + } + PLATFORM_ASSERT(pixmapSelPattern->Initialised()); + + PaintSelMargin(surfaceWindow, rcArea); + + PRectangle rcRightMargin = rcClient; + rcRightMargin.left = rcRightMargin.right - vs.rightMarginWidth; + if (rcArea.Intersects(rcRightMargin)) { + surfaceWindow->FillRectangle(rcRightMargin, vs.styles[STYLE_DEFAULT].back.allocated); + } + + if (paintState == paintAbandoned) { + // Either styling or NotifyUpdateUI noticed that painting is needed + // outside the current painting rectangle + //Platform::DebugPrintf("Abandoning paint\n"); + if (wrapState != eWrapNone) { + if (paintAbandonedByStyling) { + // Styling has spilled over a line end, such as occurs by starting a multiline + // comment. The width of subsequent text may have changed, so rewrap. + NeedWrapping(cs.DocFromDisplay(topLine)); + } + } + return; + } + //Platform::DebugPrintf("start display %d, offset = %d\n", pdoc->Length(), xOffset); + + // Do the painting + if (rcArea.right > vs.fixedColumnWidth) { + + Surface *surface = surfaceWindow; + if (bufferedDraw) { + surface = pixmapLine; + PLATFORM_ASSERT(pixmapLine->Initialised()); + } + surface->SetUnicodeMode(IsUnicodeMode()); + surface->SetDBCSMode(CodePage()); + + int visibleLine = topLine + screenLinePaintFirst; + + SelectionPosition posCaret = sel.RangeMain().caret; + if (posDrag.IsValid()) + posCaret = posDrag; + int lineCaret = pdoc->LineFromPosition(posCaret.Position()); + + // Remove selection margin from drawing area so text will not be drawn + // on it in unbuffered mode. + PRectangle rcTextArea = rcClient; + rcTextArea.left = vs.fixedColumnWidth; + rcTextArea.right -= vs.rightMarginWidth; + surfaceWindow->SetClip(rcTextArea); + + // Loop on visible lines + //double durLayout = 0.0; + //double durPaint = 0.0; + //double durCopy = 0.0; + //ElapsedTime etWhole; + int lineDocPrevious = -1; // Used to avoid laying out one document line multiple times + AutoLineLayout ll(llc, 0); + while (visibleLine < cs.LinesDisplayed() && yposScreen < rcArea.bottom) { + + int lineDoc = cs.DocFromDisplay(visibleLine); + // Only visible lines should be handled by the code within the loop + PLATFORM_ASSERT(cs.GetVisible(lineDoc)); + int lineStartSet = cs.DisplayFromDoc(lineDoc); + int subLine = visibleLine - lineStartSet; + + // Copy this line and its styles from the document into local arrays + // and determine the x position at which each character starts. + //ElapsedTime et; + if (lineDoc != lineDocPrevious) { + ll.Set(0); + ll.Set(RetrieveLineLayout(lineDoc)); + LayoutLine(lineDoc, surface, vs, ll, wrapWidth); + lineDocPrevious = lineDoc; + } + //durLayout += et.Duration(true); + + if (ll) { + ll->containsCaret = lineDoc == lineCaret; + if (hideSelection) { + ll->containsCaret = false; + } + + GetHotSpotRange(ll->hsStart, ll->hsEnd); + + PRectangle rcLine = rcClient; + rcLine.top = ypos; + rcLine.bottom = ypos + vs.lineHeight; + + Range rangeLine(pdoc->LineStart(lineDoc), pdoc->LineStart(lineDoc + 1)); + // Highlight the current braces if any + ll->SetBracesHighlight(rangeLine, braces, static_cast(bracesMatchStyle), + highlightGuideColumn * vs.spaceWidth); + + // Draw the line + DrawLine(surface, vs, lineDoc, visibleLine, xStart, rcLine, ll, subLine); + //durPaint += et.Duration(true); + + // Restore the previous styles for the brace highlights in case layout is in cache. + ll->RestoreBracesHighlight(rangeLine, braces); + + bool expanded = cs.GetExpanded(lineDoc); + // Paint the line above the fold + if ((expanded && (foldFlags & SC_FOLDFLAG_LINEBEFORE_EXPANDED)) + || + (!expanded && (foldFlags & SC_FOLDFLAG_LINEBEFORE_CONTRACTED))) { + if (pdoc->GetLevel(lineDoc) & SC_FOLDLEVELHEADERFLAG) { + PRectangle rcFoldLine = rcLine; + rcFoldLine.bottom = rcFoldLine.top + 1; + surface->FillRectangle(rcFoldLine, vs.styles[STYLE_DEFAULT].fore.allocated); + } + } + // Paint the line below the fold + if ((expanded && (foldFlags & SC_FOLDFLAG_LINEAFTER_EXPANDED)) + || + (!expanded && (foldFlags & SC_FOLDFLAG_LINEAFTER_CONTRACTED))) { + if (pdoc->GetLevel(lineDoc) & SC_FOLDLEVELHEADERFLAG) { + PRectangle rcFoldLine = rcLine; + rcFoldLine.top = rcFoldLine.bottom - 1; + surface->FillRectangle(rcFoldLine, vs.styles[STYLE_DEFAULT].fore.allocated); + } + } + + DrawCarets(surface, vs, lineDoc, xStart, rcLine, ll, subLine); + + if (bufferedDraw) { + Point from(vs.fixedColumnWidth, 0); + PRectangle rcCopyArea(vs.fixedColumnWidth, yposScreen, + rcClient.right, yposScreen + vs.lineHeight); + surfaceWindow->Copy(rcCopyArea, from, *pixmapLine); + } + //durCopy += et.Duration(true); + } + + if (!bufferedDraw) { + ypos += vs.lineHeight; + } + + yposScreen += vs.lineHeight; + visibleLine++; + + lineWidthMaxSeen = Platform::Maximum( + lineWidthMaxSeen, ll->positions[ll->numCharsInLine]); + //gdk_flush(); + } + ll.Set(0); + //if (durPaint < 0.00000001) + // durPaint = 0.00000001; + + // Right column limit indicator + PRectangle rcBeyondEOF = rcClient; + rcBeyondEOF.left = vs.fixedColumnWidth; + rcBeyondEOF.right = rcBeyondEOF.right; + rcBeyondEOF.top = (cs.LinesDisplayed() - topLine) * vs.lineHeight; + if (rcBeyondEOF.top < rcBeyondEOF.bottom) { + surfaceWindow->FillRectangle(rcBeyondEOF, vs.styles[STYLE_DEFAULT].back.allocated); + if (vs.edgeState == EDGE_LINE) { + int edgeX = theEdge * vs.spaceWidth; + rcBeyondEOF.left = edgeX + xStart; + rcBeyondEOF.right = rcBeyondEOF.left + 1; + surfaceWindow->FillRectangle(rcBeyondEOF, vs.edgecolour.allocated); + } + } + //Platform::DebugPrintf( + //"Layout:%9.6g Paint:%9.6g Ratio:%9.6g Copy:%9.6g Total:%9.6g\n", + //durLayout, durPaint, durLayout / durPaint, durCopy, etWhole.Duration()); + NotifyPainted(); + } +} + +// Space (3 space characters) between line numbers and text when printing. +#define lineNumberPrintSpace " " + +ColourDesired InvertedLight(ColourDesired orig) { + unsigned int r = orig.GetRed(); + unsigned int g = orig.GetGreen(); + unsigned int b = orig.GetBlue(); + unsigned int l = (r + g + b) / 3; // There is a better calculation for this that matches human eye + unsigned int il = 0xff - l; + if (l == 0) + return ColourDesired(0xff, 0xff, 0xff); + r = r * il / l; + g = g * il / l; + b = b * il / l; + return ColourDesired(Platform::Minimum(r, 0xff), Platform::Minimum(g, 0xff), Platform::Minimum(b, 0xff)); +} + +// This is mostly copied from the Paint method but with some things omitted +// such as the margin markers, line numbers, selection and caret +// Should be merged back into a combined Draw method. +long Editor::FormatRange(bool draw, Sci_RangeToFormat *pfr) { + if (!pfr) + return 0; + + AutoSurface surface(pfr->hdc, this); + if (!surface) + return 0; + AutoSurface surfaceMeasure(pfr->hdcTarget, this); + if (!surfaceMeasure) { + return 0; + } + + // Can't use measurements cached for screen + posCache.Clear(); + + ViewStyle vsPrint(vs); + + // Modify the view style for printing as do not normally want any of the transient features to be printed + // Printing supports only the line number margin. + int lineNumberIndex = -1; + for (int margin = 0; margin < ViewStyle::margins; margin++) { + if ((vsPrint.ms[margin].style == SC_MARGIN_NUMBER) && (vsPrint.ms[margin].width > 0)) { + lineNumberIndex = margin; + } else { + vsPrint.ms[margin].width = 0; + } + } + vsPrint.showMarkedLines = false; + vsPrint.fixedColumnWidth = 0; + vsPrint.zoomLevel = printMagnification; + vsPrint.viewIndentationGuides = ivNone; + // Don't show the selection when printing + vsPrint.selbackset = false; + vsPrint.selforeset = false; + vsPrint.selAlpha = SC_ALPHA_NOALPHA; + vsPrint.selAdditionalAlpha = SC_ALPHA_NOALPHA; + vsPrint.whitespaceBackgroundSet = false; + vsPrint.whitespaceForegroundSet = false; + vsPrint.showCaretLineBackground = false; + + // Set colours for printing according to users settings + for (size_t sty = 0;sty < vsPrint.stylesSize;sty++) { + if (printColourMode == SC_PRINT_INVERTLIGHT) { + vsPrint.styles[sty].fore.desired = InvertedLight(vsPrint.styles[sty].fore.desired); + vsPrint.styles[sty].back.desired = InvertedLight(vsPrint.styles[sty].back.desired); + } else if (printColourMode == SC_PRINT_BLACKONWHITE) { + vsPrint.styles[sty].fore.desired = ColourDesired(0, 0, 0); + vsPrint.styles[sty].back.desired = ColourDesired(0xff, 0xff, 0xff); + } else if (printColourMode == SC_PRINT_COLOURONWHITE) { + vsPrint.styles[sty].back.desired = ColourDesired(0xff, 0xff, 0xff); + } else if (printColourMode == SC_PRINT_COLOURONWHITEDEFAULTBG) { + if (sty <= STYLE_DEFAULT) { + vsPrint.styles[sty].back.desired = ColourDesired(0xff, 0xff, 0xff); + } + } + } + // White background for the line numbers + vsPrint.styles[STYLE_LINENUMBER].back.desired = ColourDesired(0xff, 0xff, 0xff); + + vsPrint.Refresh(*surfaceMeasure); + // Determining width must hapen after fonts have been realised in Refresh + int lineNumberWidth = 0; + if (lineNumberIndex >= 0) { + lineNumberWidth = surfaceMeasure->WidthText(vsPrint.styles[STYLE_LINENUMBER].font, + "99999" lineNumberPrintSpace, 5 + istrlen(lineNumberPrintSpace)); + vsPrint.ms[lineNumberIndex].width = lineNumberWidth; + vsPrint.Refresh(*surfaceMeasure); // Recalculate fixedColumnWidth + } + // Ensure colours are set up + vsPrint.RefreshColourPalette(palette, true); + vsPrint.RefreshColourPalette(palette, false); + + int linePrintStart = pdoc->LineFromPosition(pfr->chrg.cpMin); + int linePrintLast = linePrintStart + (pfr->rc.bottom - pfr->rc.top) / vsPrint.lineHeight - 1; + if (linePrintLast < linePrintStart) + linePrintLast = linePrintStart; + int linePrintMax = pdoc->LineFromPosition(pfr->chrg.cpMax); + if (linePrintLast > linePrintMax) + linePrintLast = linePrintMax; + //Platform::DebugPrintf("Formatting lines=[%0d,%0d,%0d] top=%0d bottom=%0d line=%0d %0d\n", + // linePrintStart, linePrintLast, linePrintMax, pfr->rc.top, pfr->rc.bottom, vsPrint.lineHeight, + // surfaceMeasure->Height(vsPrint.styles[STYLE_LINENUMBER].font)); + int endPosPrint = pdoc->Length(); + if (linePrintLast < pdoc->LinesTotal()) + endPosPrint = pdoc->LineStart(linePrintLast + 1); + + // Ensure we are styled to where we are formatting. + pdoc->EnsureStyledTo(endPosPrint); + + int xStart = vsPrint.fixedColumnWidth + pfr->rc.left; + int ypos = pfr->rc.top; + + int lineDoc = linePrintStart; + + int nPrintPos = pfr->chrg.cpMin; + int visibleLine = 0; + int widthPrint = pfr->rc.Width() - vsPrint.fixedColumnWidth; + if (printWrapState == eWrapNone) + widthPrint = LineLayout::wrapWidthInfinite; + + while (lineDoc <= linePrintLast && ypos < pfr->rc.bottom) { + + // When printing, the hdc and hdcTarget may be the same, so + // changing the state of surfaceMeasure may change the underlying + // state of surface. Therefore, any cached state is discarded before + // using each surface. + surfaceMeasure->FlushCachedState(); + + // Copy this line and its styles from the document into local arrays + // and determine the x position at which each character starts. + LineLayout ll(8000); + LayoutLine(lineDoc, surfaceMeasure, vsPrint, &ll, widthPrint); + + ll.containsCaret = false; + + PRectangle rcLine; + rcLine.left = pfr->rc.left; + rcLine.top = ypos; + rcLine.right = pfr->rc.right - 1; + rcLine.bottom = ypos + vsPrint.lineHeight; + + // When document line is wrapped over multiple display lines, find where + // to start printing from to ensure a particular position is on the first + // line of the page. + if (visibleLine == 0) { + int startWithinLine = nPrintPos - pdoc->LineStart(lineDoc); + for (int iwl = 0; iwl < ll.lines - 1; iwl++) { + if (ll.LineStart(iwl) <= startWithinLine && ll.LineStart(iwl + 1) >= startWithinLine) { + visibleLine = -iwl; + } + } + + if (ll.lines > 1 && startWithinLine >= ll.LineStart(ll.lines - 1)) { + visibleLine = -(ll.lines - 1); + } + } + + if (draw && lineNumberWidth && + (ypos + vsPrint.lineHeight <= pfr->rc.bottom) && + (visibleLine >= 0)) { + char number[100]; + sprintf(number, "%d" lineNumberPrintSpace, lineDoc + 1); + PRectangle rcNumber = rcLine; + rcNumber.right = rcNumber.left + lineNumberWidth; + // Right justify + rcNumber.left = rcNumber.right - surfaceMeasure->WidthText( + vsPrint.styles[STYLE_LINENUMBER].font, number, istrlen(number)); + surface->FlushCachedState(); + surface->DrawTextNoClip(rcNumber, vsPrint.styles[STYLE_LINENUMBER].font, + ypos + vsPrint.maxAscent, number, istrlen(number), + vsPrint.styles[STYLE_LINENUMBER].fore.allocated, + vsPrint.styles[STYLE_LINENUMBER].back.allocated); + } + + // Draw the line + surface->FlushCachedState(); + + for (int iwl = 0; iwl < ll.lines; iwl++) { + if (ypos + vsPrint.lineHeight <= pfr->rc.bottom) { + if (visibleLine >= 0) { + if (draw) { + rcLine.top = ypos; + rcLine.bottom = ypos + vsPrint.lineHeight; + DrawLine(surface, vsPrint, lineDoc, visibleLine, xStart, rcLine, &ll, iwl); + } + ypos += vsPrint.lineHeight; + } + visibleLine++; + if (iwl == ll.lines - 1) + nPrintPos = pdoc->LineStart(lineDoc + 1); + else + nPrintPos += ll.LineStart(iwl + 1) - ll.LineStart(iwl); + } + } + + ++lineDoc; + } + + // Clear cache so measurements are not used for screen + posCache.Clear(); + + return nPrintPos; +} + +int Editor::TextWidth(int style, const char *text) { + RefreshStyleData(); + AutoSurface surface(this); + if (surface) { + return surface->WidthText(vs.styles[style].font, text, istrlen(text)); + } else { + return 1; + } +} + +// Empty method is overridden on GTK+ to show / hide scrollbars +void Editor::ReconfigureScrollBars() {} + +void Editor::SetScrollBars() { + RefreshStyleData(); + + int nMax = MaxScrollPos(); + int nPage = LinesOnScreen(); + bool modified = ModifyScrollBars(nMax + nPage - 1, nPage); + if (modified) { + DwellEnd(true); + } + + // TODO: ensure always showing as many lines as possible + // May not be, if, for example, window made larger + if (topLine > MaxScrollPos()) { + SetTopLine(Platform::Clamp(topLine, 0, MaxScrollPos())); + SetVerticalScrollPos(); + Redraw(); + } + if (modified) { + if (!AbandonPaint()) + Redraw(); + } + //Platform::DebugPrintf("end max = %d page = %d\n", nMax, nPage); +} + +void Editor::ChangeSize() { + DropGraphics(); + SetScrollBars(); + if (wrapState != eWrapNone) { + PRectangle rcTextArea = GetClientRectangle(); + rcTextArea.left = vs.fixedColumnWidth; + rcTextArea.right -= vs.rightMarginWidth; + if (wrapWidth != rcTextArea.Width()) { + NeedWrapping(); + Redraw(); + } + } +} + +int Editor::InsertSpace(int position, unsigned int spaces) { + if (spaces > 0) { + std::string spaceText(spaces, ' '); + pdoc->InsertString(position, spaceText.c_str(), spaces); + position += spaces; + } + return position; +} + +void Editor::AddChar(char ch) { + char s[2]; + s[0] = ch; + s[1] = '\0'; + AddCharUTF(s, 1); +} + +void Editor::FilterSelections() { + if (!additionalSelectionTyping && (sel.Count() > 1)) { + SelectionRange rangeOnly = sel.RangeMain(); + InvalidateSelection(rangeOnly, true); + sel.SetSelection(rangeOnly); + } +} + +// AddCharUTF inserts an array of bytes which may or may not be in UTF-8. +void Editor::AddCharUTF(char *s, unsigned int len, bool treatAsDBCS) { + FilterSelections(); + { + UndoGroup ug(pdoc, (sel.Count() > 1) || !sel.Empty() || inOverstrike); + for (size_t r=0; rDeleteChars(positionInsert, sel.Range(r).Length()); + sel.Range(r).ClearVirtualSpace(); + } else { + // Range is all virtual so collapse to start of virtual space + sel.Range(r).MinimizeVirtualSpace(); + } + } else if (inOverstrike) { + if (positionInsert < pdoc->Length()) { + if (!IsEOLChar(pdoc->CharAt(positionInsert))) { + pdoc->DelChar(positionInsert); + sel.Range(r).ClearVirtualSpace(); + } + } + } + positionInsert = InsertSpace(positionInsert, sel.Range(r).caret.VirtualSpace()); + if (pdoc->InsertString(positionInsert, s, len)) { + sel.Range(r).caret.SetPosition(positionInsert + len); + sel.Range(r).anchor.SetPosition(positionInsert + len); + } + sel.Range(r).ClearVirtualSpace(); + // If in wrap mode rewrap current line so EnsureCaretVisible has accurate information + if (wrapState != eWrapNone) { + AutoSurface surface(this); + if (surface) { + WrapOneLine(surface, pdoc->LineFromPosition(positionInsert)); + } + } + } + } + } + if (wrapState != eWrapNone) { + SetScrollBars(); + } + if (sel.IsRectangular()) { + sel.selType = Selection::selThin; + sel.Rectangular() = SelectionRange(sel.Rectangular().caret, sel.Range(0).anchor); + } + // If in wrap mode rewrap current line so EnsureCaretVisible has accurate information + EnsureCaretVisible(); + // Avoid blinking during rapid typing: + ShowCaretAtCurrentPosition(); + if (!caretSticky) { + SetLastXChosen(); + } + + if (treatAsDBCS) { + NotifyChar((static_cast(s[0]) << 8) | + static_cast(s[1])); + } else { + int byte = static_cast(s[0]); + if ((byte < 0xC0) || (1 == len)) { + // Handles UTF-8 characters between 0x01 and 0x7F and single byte + // characters when not in UTF-8 mode. + // Also treats \0 and naked trail bytes 0x80 to 0xBF as valid + // characters representing themselves. + } else { + // Unroll 1 to 3 byte UTF-8 sequences. See reference data at: + // http://www.cl.cam.ac.uk/~mgk25/unicode.html + // http://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt + if (byte < 0xE0) { + int byte2 = static_cast(s[1]); + if ((byte2 & 0xC0) == 0x80) { + // Two-byte-character lead-byte followed by a trail-byte. + byte = (((byte & 0x1F) << 6) | (byte2 & 0x3F)); + } + // A two-byte-character lead-byte not followed by trail-byte + // represents itself. + } else if (byte < 0xF0) { + int byte2 = static_cast(s[1]); + int byte3 = static_cast(s[2]); + if (((byte2 & 0xC0) == 0x80) && ((byte3 & 0xC0) == 0x80)) { + // Three-byte-character lead byte followed by two trail bytes. + byte = (((byte & 0x0F) << 12) | ((byte2 & 0x3F) << 6) | + (byte3 & 0x3F)); + } + // A three-byte-character lead-byte not followed by two trail-bytes + // represents itself. + } + } + NotifyChar(byte); + } +} + +void Editor::ClearSelection() { + if (!sel.IsRectangular()) + FilterSelections(); + UndoGroup ug(pdoc); + for (size_t r=0; rDeleteChars(sel.Range(r).Start().Position(), + sel.Range(r).Length()); + sel.Range(r).ClearVirtualSpace(); + } + } + } + sel.RemoveDuplicates(); + ClaimSelection(); +} + +void Editor::ClearAll() { + { + UndoGroup ug(pdoc); + if (0 != pdoc->Length()) { + pdoc->DeleteChars(0, pdoc->Length()); + } + if (!pdoc->IsReadOnly()) { + cs.Clear(); + pdoc->AnnotationClearAll(); + pdoc->MarginClearAll(); + } + } + sel.Clear(); + SetTopLine(0); + SetVerticalScrollPos(); + InvalidateStyleRedraw(); +} + +void Editor::ClearDocumentStyle() { + Decoration *deco = pdoc->decorations.root; + while (deco) { + // Save next in case deco deleted + Decoration *decoNext = deco->next; + if (deco->indicator < INDIC_CONTAINER) { + pdoc->decorations.SetCurrentIndicator(deco->indicator); + pdoc->DecorationFillRange(0, 0, pdoc->Length()); + } + deco = decoNext; + } + pdoc->StartStyling(0, '\377'); + pdoc->SetStyleFor(pdoc->Length(), 0); + cs.ShowAll(); + pdoc->ClearLevels(); +} + +void Editor::CopyAllowLine() { + SelectionText selectedText; + CopySelectionRange(&selectedText, true); + CopyToClipboard(selectedText); +} + +void Editor::Cut() { + pdoc->CheckReadOnly(); + if (!pdoc->IsReadOnly() && !SelectionContainsProtected()) { + Copy(); + ClearSelection(); + } +} + +void Editor::PasteRectangular(SelectionPosition pos, const char *ptr, int len) { + if (pdoc->IsReadOnly() || SelectionContainsProtected()) { + return; + } + sel.Clear(); + sel.RangeMain() = SelectionRange(pos); + int line = pdoc->LineFromPosition(sel.MainCaret()); + UndoGroup ug(pdoc); + sel.RangeMain().caret = SelectionPosition( + InsertSpace(sel.RangeMain().caret.Position(), sel.RangeMain().caret.VirtualSpace())); + int xInsert = XFromPosition(sel.RangeMain().caret); + bool prevCr = false; + while ((len > 0) && IsEOLChar(ptr[len-1])) + len--; + for (int i = 0; i < len; i++) { + if (IsEOLChar(ptr[i])) { + if ((ptr[i] == '\r') || (!prevCr)) + line++; + if (line >= pdoc->LinesTotal()) { + if (pdoc->eolMode != SC_EOL_LF) + pdoc->InsertChar(pdoc->Length(), '\r'); + if (pdoc->eolMode != SC_EOL_CR) + pdoc->InsertChar(pdoc->Length(), '\n'); + } + // Pad the end of lines with spaces if required + sel.RangeMain().caret.SetPosition(PositionFromLineX(line, xInsert)); + if ((XFromPosition(sel.MainCaret()) < xInsert) && (i + 1 < len)) { + while (XFromPosition(sel.MainCaret()) < xInsert) { + pdoc->InsertChar(sel.MainCaret(), ' '); + sel.RangeMain().caret.Add(1); + } + } + prevCr = ptr[i] == '\r'; + } else { + pdoc->InsertString(sel.MainCaret(), ptr + i, 1); + sel.RangeMain().caret.Add(1); + prevCr = false; + } + } + SetEmptySelection(pos); +} + +bool Editor::CanPaste() { + return !pdoc->IsReadOnly() && !SelectionContainsProtected(); +} + +void Editor::Clear() { + UndoGroup ug(pdoc); + // If multiple selections, don't delete EOLS + if (sel.Empty()) { + for (size_t r=0; rCharAt(sel.Range(r).caret.Position()))) { + pdoc->DelChar(sel.Range(r).caret.Position()); + sel.Range(r).ClearVirtualSpace(); + } // else multiple selection so don't eat line ends + } else { + sel.Range(r).ClearVirtualSpace(); + } + } + } else { + ClearSelection(); + } + sel.RemoveDuplicates(); +} + +void Editor::SelectAll() { + SetSelection(0, pdoc->Length()); + Redraw(); +} + +void Editor::Undo() { + if (pdoc->CanUndo()) { + InvalidateCaret(); + int newPos = pdoc->Undo(); + if (newPos >= 0) + SetEmptySelection(newPos); + EnsureCaretVisible(); + } +} + +void Editor::Redo() { + if (pdoc->CanRedo()) { + int newPos = pdoc->Redo(); + if (newPos >= 0) + SetEmptySelection(newPos); + EnsureCaretVisible(); + } +} + +void Editor::DelChar() { + if (!RangeContainsProtected(sel.MainCaret(), sel.MainCaret() + 1)) { + pdoc->DelChar(sel.MainCaret()); + } + // Avoid blinking during rapid typing: + ShowCaretAtCurrentPosition(); +} + +void Editor::DelCharBack(bool allowLineStartDeletion) { + if (!sel.IsRectangular()) + FilterSelections(); + if (sel.IsRectangular()) + allowLineStartDeletion = false; + UndoGroup ug(pdoc, (sel.Count() > 1) || !sel.Empty()); + if (sel.Empty()) { + for (size_t r=0; rLineFromPosition(sel.Range(r).caret.Position()); + if (allowLineStartDeletion || (pdoc->LineStart(lineCurrentPos) != sel.Range(r).caret.Position())) { + if (pdoc->GetColumn(sel.Range(r).caret.Position()) <= pdoc->GetLineIndentation(lineCurrentPos) && + pdoc->GetColumn(sel.Range(r).caret.Position()) > 0 && pdoc->backspaceUnindents) { + UndoGroup ugInner(pdoc, !ug.Needed()); + int indentation = pdoc->GetLineIndentation(lineCurrentPos); + int indentationStep = pdoc->IndentSize(); + if (indentation % indentationStep == 0) { + pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationStep); + } else { + pdoc->SetLineIndentation(lineCurrentPos, indentation - (indentation % indentationStep)); + } + // SetEmptySelection + sel.Range(r) = SelectionRange(pdoc->GetLineIndentPosition(lineCurrentPos), + pdoc->GetLineIndentPosition(lineCurrentPos)); + } else { + pdoc->DelCharBack(sel.Range(r).caret.Position()); + } + } + } + } else { + sel.Range(r).ClearVirtualSpace(); + } + } + } else { + ClearSelection(); + if (sel.IsRectangular()) { + sel.selType = Selection::selThin; + sel.Rectangular() = SelectionRange(sel.Rectangular().caret, sel.Range(0).anchor); + } + //SetEmptySelection(sel.MainCaret()); + } + sel.RemoveDuplicates(); + // Avoid blinking during rapid typing: + ShowCaretAtCurrentPosition(); +} + +void Editor::NotifyFocus(bool) {} + +void Editor::NotifyStyleToNeeded(int endStyleNeeded) { + SCNotification scn = {0}; + scn.nmhdr.code = SCN_STYLENEEDED; + scn.position = endStyleNeeded; + NotifyParent(scn); +} + +void Editor::NotifyStyleNeeded(Document*, void *, int endStyleNeeded) { + NotifyStyleToNeeded(endStyleNeeded); +} + +void Editor::NotifyChar(int ch) { + SCNotification scn = {0}; + scn.nmhdr.code = SCN_CHARADDED; + scn.ch = ch; + NotifyParent(scn); + if (recordingMacro) { + char txt[2]; + txt[0] = static_cast(ch); + txt[1] = '\0'; + NotifyMacroRecord(SCI_REPLACESEL, 0, reinterpret_cast(txt)); + } +} + +void Editor::NotifySavePoint(bool isSavePoint) { + SCNotification scn = {0}; + if (isSavePoint) { + scn.nmhdr.code = SCN_SAVEPOINTREACHED; + } else { + scn.nmhdr.code = SCN_SAVEPOINTLEFT; + } + NotifyParent(scn); +} + +void Editor::NotifyModifyAttempt() { + SCNotification scn = {0}; + scn.nmhdr.code = SCN_MODIFYATTEMPTRO; + NotifyParent(scn); +} + +void Editor::NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt) { + SCNotification scn = {0}; + scn.nmhdr.code = SCN_DOUBLECLICK; + scn.line = LineFromLocation(pt); + scn.position = PositionFromLocation(pt, true); + scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | + (alt ? SCI_ALT : 0); + NotifyParent(scn); +} + +void Editor::NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt) { + SCNotification scn = {0}; + scn.nmhdr.code = SCN_HOTSPOTDOUBLECLICK; + scn.position = position; + scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | + (alt ? SCI_ALT : 0); + NotifyParent(scn); +} + +void Editor::NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt) { + SCNotification scn = {0}; + scn.nmhdr.code = SCN_HOTSPOTCLICK; + scn.position = position; + scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | + (alt ? SCI_ALT : 0); + NotifyParent(scn); +} + +void Editor::NotifyUpdateUI() { + SCNotification scn = {0}; + scn.nmhdr.code = SCN_UPDATEUI; + NotifyParent(scn); +} + +void Editor::NotifyPainted() { + SCNotification scn = {0}; + scn.nmhdr.code = SCN_PAINTED; + NotifyParent(scn); +} + +void Editor::NotifyIndicatorClick(bool click, int position, bool shift, bool ctrl, bool alt) { + int mask = pdoc->decorations.AllOnFor(position); + if ((click && mask) || pdoc->decorations.clickNotified) { + SCNotification scn = {0}; + pdoc->decorations.clickNotified = click; + scn.nmhdr.code = click ? SCN_INDICATORCLICK : SCN_INDICATORRELEASE; + scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | (alt ? SCI_ALT : 0); + scn.position = position; + NotifyParent(scn); + } +} + +bool Editor::NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt) { + int marginClicked = -1; + int x = 0; + for (int margin = 0; margin < ViewStyle::margins; margin++) { + if ((pt.x > x) && (pt.x < x + vs.ms[margin].width)) + marginClicked = margin; + x += vs.ms[margin].width; + } + if ((marginClicked >= 0) && vs.ms[marginClicked].sensitive) { + SCNotification scn = {0}; + scn.nmhdr.code = SCN_MARGINCLICK; + scn.modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | + (alt ? SCI_ALT : 0); + scn.position = pdoc->LineStart(LineFromLocation(pt)); + scn.margin = marginClicked; + NotifyParent(scn); + return true; + } else { + return false; + } +} + +void Editor::NotifyNeedShown(int pos, int len) { + SCNotification scn = {0}; + scn.nmhdr.code = SCN_NEEDSHOWN; + scn.position = pos; + scn.length = len; + NotifyParent(scn); +} + +void Editor::NotifyDwelling(Point pt, bool state) { + SCNotification scn = {0}; + scn.nmhdr.code = state ? SCN_DWELLSTART : SCN_DWELLEND; + scn.position = PositionFromLocation(pt, true); + scn.x = pt.x; + scn.y = pt.y; + NotifyParent(scn); +} + +void Editor::NotifyZoom() { + SCNotification scn = {0}; + scn.nmhdr.code = SCN_ZOOM; + NotifyParent(scn); +} + +// Notifications from document +void Editor::NotifyModifyAttempt(Document*, void *) { + //Platform::DebugPrintf("** Modify Attempt\n"); + NotifyModifyAttempt(); +} + +void Editor::NotifySavePoint(Document*, void *, bool atSavePoint) { + //Platform::DebugPrintf("** Save Point %s\n", atSavePoint ? "On" : "Off"); + NotifySavePoint(atSavePoint); +} + +void Editor::CheckModificationForWrap(DocModification mh) { + if (mh.modificationType & (SC_MOD_INSERTTEXT | SC_MOD_DELETETEXT)) { + llc.Invalidate(LineLayout::llCheckTextAndStyle); + if (wrapState != eWrapNone) { + int lineDoc = pdoc->LineFromPosition(mh.position); + int lines = Platform::Maximum(0, mh.linesAdded); + NeedWrapping(lineDoc, lineDoc + lines + 1); + } + // Fix up annotation heights + int lineDoc = pdoc->LineFromPosition(mh.position); + int lines = Platform::Maximum(0, mh.linesAdded); + SetAnnotationHeights(lineDoc, lineDoc + lines + 2); + } +} + +// Move a position so it is still after the same character as before the insertion. +static inline int MovePositionForInsertion(int position, int startInsertion, int length) { + if (position > startInsertion) { + return position + length; + } + return position; +} + +// Move a position so it is still after the same character as before the deletion if that +// character is still present else after the previous surviving character. +static inline int MovePositionForDeletion(int position, int startDeletion, int length) { + if (position > startDeletion) { + int endDeletion = startDeletion + length; + if (position > endDeletion) { + return position - length; + } else { + return startDeletion; + } + } else { + return position; + } +} + +void Editor::NotifyModified(Document*, DocModification mh, void *) { + needUpdateUI = true; + if (paintState == painting) { + CheckForChangeOutsidePaint(Range(mh.position, mh.position + mh.length)); + } + if (mh.modificationType & SC_MOD_CHANGELINESTATE) { + if (paintState == painting) { + CheckForChangeOutsidePaint( + Range(pdoc->LineStart(mh.line), pdoc->LineStart(mh.line + 1))); + } else { + // Could check that change is before last visible line. + Redraw(); + } + } + if (mh.modificationType & (SC_MOD_CHANGESTYLE | SC_MOD_CHANGEINDICATOR)) { + if (mh.modificationType & SC_MOD_CHANGESTYLE) { + pdoc->IncrementStyleClock(); + } + if (paintState == notPainting) { + if (mh.position < pdoc->LineStart(topLine)) { + // Styling performed before this view + Redraw(); + } else { + InvalidateRange(mh.position, mh.position + mh.length); + } + } + if (mh.modificationType & SC_MOD_CHANGESTYLE) { + llc.Invalidate(LineLayout::llCheckTextAndStyle); + } + } else { + // Move selection and brace highlights + if (mh.modificationType & SC_MOD_INSERTTEXT) { + sel.MovePositions(true, mh.position, mh.length); + braces[0] = MovePositionForInsertion(braces[0], mh.position, mh.length); + braces[1] = MovePositionForInsertion(braces[1], mh.position, mh.length); + } else if (mh.modificationType & SC_MOD_DELETETEXT) { + sel.MovePositions(false, mh.position, mh.length); + braces[0] = MovePositionForDeletion(braces[0], mh.position, mh.length); + braces[1] = MovePositionForDeletion(braces[1], mh.position, mh.length); + } + if (cs.LinesDisplayed() < cs.LinesInDoc()) { + // Some lines are hidden so may need shown. + // TODO: check if the modified area is hidden. + if (mh.modificationType & SC_MOD_BEFOREINSERT) { + NotifyNeedShown(mh.position, 0); + } else if (mh.modificationType & SC_MOD_BEFOREDELETE) { + NotifyNeedShown(mh.position, mh.length); + } + } + if (mh.linesAdded != 0) { + // Update contraction state for inserted and removed lines + // lineOfPos should be calculated in context of state before modification, shouldn't it + int lineOfPos = pdoc->LineFromPosition(mh.position); + if (mh.linesAdded > 0) { + cs.InsertLines(lineOfPos, mh.linesAdded); + } else { + cs.DeleteLines(lineOfPos, -mh.linesAdded); + } + } + if (mh.modificationType & SC_MOD_CHANGEANNOTATION) { + int lineDoc = pdoc->LineFromPosition(mh.position); + if (vs.annotationVisible) { + cs.SetHeight(lineDoc, cs.GetHeight(lineDoc) + mh.annotationLinesAdded); + } + } + CheckModificationForWrap(mh); + if (mh.linesAdded != 0) { + // Avoid scrolling of display if change before current display + if (mh.position < posTopLine && !CanDeferToLastStep(mh)) { + int newTop = Platform::Clamp(topLine + mh.linesAdded, 0, MaxScrollPos()); + if (newTop != topLine) { + SetTopLine(newTop); + SetVerticalScrollPos(); + } + } + + //Platform::DebugPrintf("** %x Doc Changed\n", this); + // TODO: could invalidate from mh.startModification to end of screen + //InvalidateRange(mh.position, mh.position + mh.length); + if (paintState == notPainting && !CanDeferToLastStep(mh)) { + Redraw(); + } + } else { + //Platform::DebugPrintf("** %x Line Changed %d .. %d\n", this, + // mh.position, mh.position + mh.length); + if (paintState == notPainting && mh.length && !CanEliminate(mh)) { + InvalidateRange(mh.position, mh.position + mh.length); + } + } + } + + if (mh.linesAdded != 0 && !CanDeferToLastStep(mh)) { + SetScrollBars(); + } + + if ((mh.modificationType & SC_MOD_CHANGEMARKER) || (mh.modificationType & SC_MOD_CHANGEMARGIN)) { + if ((paintState == notPainting) || !PaintContainsMargin()) { + if (mh.modificationType & SC_MOD_CHANGEFOLD) { + // Fold changes can affect the drawing of following lines so redraw whole margin + RedrawSelMargin(); + } else { + RedrawSelMargin(mh.line); + } + } + } + + // NOW pay the piper WRT "deferred" visual updates + if (IsLastStep(mh)) { + SetScrollBars(); + Redraw(); + } + + // If client wants to see this modification + if (mh.modificationType & modEventMask) { + if ((mh.modificationType & (SC_MOD_CHANGESTYLE | SC_MOD_CHANGEINDICATOR)) == 0) { + // Real modification made to text of document. + NotifyChange(); // Send EN_CHANGE + } + + SCNotification scn = {0}; + scn.nmhdr.code = SCN_MODIFIED; + scn.position = mh.position; + scn.modificationType = mh.modificationType; + scn.text = mh.text; + scn.length = mh.length; + scn.linesAdded = mh.linesAdded; + scn.line = mh.line; + scn.foldLevelNow = mh.foldLevelNow; + scn.foldLevelPrev = mh.foldLevelPrev; + scn.token = mh.token; + scn.annotationLinesAdded = mh.annotationLinesAdded; + NotifyParent(scn); + } +} + +void Editor::NotifyDeleted(Document *, void *) { + /* Do nothing */ +} + +void Editor::NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { + + // Enumerates all macroable messages + switch (iMessage) { + case SCI_CUT: + case SCI_COPY: + case SCI_PASTE: + case SCI_CLEAR: + case SCI_REPLACESEL: + case SCI_ADDTEXT: + case SCI_INSERTTEXT: + case SCI_APPENDTEXT: + case SCI_CLEARALL: + case SCI_SELECTALL: + case SCI_GOTOLINE: + case SCI_GOTOPOS: + case SCI_SEARCHANCHOR: + case SCI_SEARCHNEXT: + case SCI_SEARCHPREV: + case SCI_LINEDOWN: + case SCI_LINEDOWNEXTEND: + case SCI_PARADOWN: + case SCI_PARADOWNEXTEND: + case SCI_LINEUP: + case SCI_LINEUPEXTEND: + case SCI_PARAUP: + case SCI_PARAUPEXTEND: + case SCI_CHARLEFT: + case SCI_CHARLEFTEXTEND: + case SCI_CHARRIGHT: + case SCI_CHARRIGHTEXTEND: + case SCI_WORDLEFT: + case SCI_WORDLEFTEXTEND: + case SCI_WORDRIGHT: + case SCI_WORDRIGHTEXTEND: + case SCI_WORDPARTLEFT: + case SCI_WORDPARTLEFTEXTEND: + case SCI_WORDPARTRIGHT: + case SCI_WORDPARTRIGHTEXTEND: + case SCI_WORDLEFTEND: + case SCI_WORDLEFTENDEXTEND: + case SCI_WORDRIGHTEND: + case SCI_WORDRIGHTENDEXTEND: + case SCI_HOME: + case SCI_HOMEEXTEND: + case SCI_LINEEND: + case SCI_LINEENDEXTEND: + case SCI_HOMEWRAP: + case SCI_HOMEWRAPEXTEND: + case SCI_LINEENDWRAP: + case SCI_LINEENDWRAPEXTEND: + case SCI_DOCUMENTSTART: + case SCI_DOCUMENTSTARTEXTEND: + case SCI_DOCUMENTEND: + case SCI_DOCUMENTENDEXTEND: + case SCI_STUTTEREDPAGEUP: + case SCI_STUTTEREDPAGEUPEXTEND: + case SCI_STUTTEREDPAGEDOWN: + case SCI_STUTTEREDPAGEDOWNEXTEND: + case SCI_PAGEUP: + case SCI_PAGEUPEXTEND: + case SCI_PAGEDOWN: + case SCI_PAGEDOWNEXTEND: + case SCI_EDITTOGGLEOVERTYPE: + case SCI_CANCEL: + case SCI_DELETEBACK: + case SCI_TAB: + case SCI_BACKTAB: + case SCI_FORMFEED: + case SCI_VCHOME: + case SCI_VCHOMEEXTEND: + case SCI_VCHOMEWRAP: + case SCI_VCHOMEWRAPEXTEND: + case SCI_DELWORDLEFT: + case SCI_DELWORDRIGHT: + case SCI_DELWORDRIGHTEND: + case SCI_DELLINELEFT: + case SCI_DELLINERIGHT: + case SCI_LINECOPY: + case SCI_LINECUT: + case SCI_LINEDELETE: + case SCI_LINETRANSPOSE: + case SCI_LINEDUPLICATE: + case SCI_LOWERCASE: + case SCI_UPPERCASE: + case SCI_LINESCROLLDOWN: + case SCI_LINESCROLLUP: + case SCI_DELETEBACKNOTLINE: + case SCI_HOMEDISPLAY: + case SCI_HOMEDISPLAYEXTEND: + case SCI_LINEENDDISPLAY: + case SCI_LINEENDDISPLAYEXTEND: + case SCI_SETSELECTIONMODE: + case SCI_LINEDOWNRECTEXTEND: + case SCI_LINEUPRECTEXTEND: + case SCI_CHARLEFTRECTEXTEND: + case SCI_CHARRIGHTRECTEXTEND: + case SCI_HOMERECTEXTEND: + case SCI_VCHOMERECTEXTEND: + case SCI_LINEENDRECTEXTEND: + case SCI_PAGEUPRECTEXTEND: + case SCI_PAGEDOWNRECTEXTEND: + case SCI_SELECTIONDUPLICATE: + case SCI_COPYALLOWLINE: + break; + + // Filter out all others like display changes. Also, newlines are redundant + // with char insert messages. + case SCI_NEWLINE: + default: + // printf("Filtered out %ld of macro recording\n", iMessage); + return ; + } + + // Send notification + SCNotification scn = {0}; + scn.nmhdr.code = SCN_MACRORECORD; + scn.message = iMessage; + scn.wParam = wParam; + scn.lParam = lParam; + NotifyParent(scn); +} + +/** + * Force scroll and keep position relative to top of window. + * + * If stuttered = true and not already at first/last row, move to first/last row of window. + * If stuttered = true and already at first/last row, scroll as normal. + */ +void Editor::PageMove(int direction, Selection::selTypes selt, bool stuttered) { + int topLineNew, newPos; + + // I consider only the caretYSlop, and ignore the caretYPolicy-- is that a problem? + int currentLine = pdoc->LineFromPosition(sel.MainCaret()); + int topStutterLine = topLine + caretYSlop; + int bottomStutterLine = + pdoc->LineFromPosition(PositionFromLocation( + Point(lastXChosen, direction * vs.lineHeight * LinesToScroll()))) + - caretYSlop - 1; + + if (stuttered && (direction < 0 && currentLine > topStutterLine)) { + topLineNew = topLine; + newPos = PositionFromLocation(Point(lastXChosen, vs.lineHeight * caretYSlop)); + + } else if (stuttered && (direction > 0 && currentLine < bottomStutterLine)) { + topLineNew = topLine; + newPos = PositionFromLocation(Point(lastXChosen, vs.lineHeight * (LinesToScroll() - caretYSlop))); + + } else { + Point pt = LocationFromPosition(sel.MainCaret()); + + topLineNew = Platform::Clamp( + topLine + direction * LinesToScroll(), 0, MaxScrollPos()); + newPos = PositionFromLocation( + Point(lastXChosen, pt.y + direction * (vs.lineHeight * LinesToScroll()))); + } + + if (topLineNew != topLine) { + SetTopLine(topLineNew); + MovePositionTo(SelectionPosition(newPos), selt); + Redraw(); + SetVerticalScrollPos(); + } else { + MovePositionTo(SelectionPosition(newPos), selt); + } +} + +void Editor::ChangeCaseOfSelection(bool makeUpperCase) { + UndoGroup ug(pdoc); + for (size_t r=0; rChangeCase(Range(current.Start().Position(), current.End().Position()), + makeUpperCase); + // Automatic movement cuts off last character so reset to exactly the same as it was. + sel.Range(r) = current; + } +} + +void Editor::LineTranspose() { + int line = pdoc->LineFromPosition(sel.MainCaret()); + if (line > 0) { + UndoGroup ug(pdoc); + int startPrev = pdoc->LineStart(line - 1); + int endPrev = pdoc->LineEnd(line - 1); + int start = pdoc->LineStart(line); + int end = pdoc->LineEnd(line); + char *line1 = CopyRange(startPrev, endPrev); + int len1 = endPrev - startPrev; + char *line2 = CopyRange(start, end); + int len2 = end - start; + pdoc->DeleteChars(start, len2); + pdoc->DeleteChars(startPrev, len1); + pdoc->InsertString(startPrev, line2, len2); + pdoc->InsertString(start - len1 + len2, line1, len1); + MovePositionTo(SelectionPosition(start - len1 + len2)); + delete []line1; + delete []line2; + } +} + +void Editor::Duplicate(bool forLine) { + if (sel.Empty()) { + forLine = true; + } + UndoGroup ug(pdoc, sel.Count() > 1); + for (size_t r=0; rLineFromPosition(sel.Range(r).caret.Position()); + start = SelectionPosition(pdoc->LineStart(line)); + end = SelectionPosition(pdoc->LineEnd(line)); + } + char *text = CopyRange(start.Position(), end.Position()); + if (forLine) { + const char *eol = StringFromEOLMode(pdoc->eolMode); + pdoc->InsertCString(end.Position(), eol); + pdoc->InsertString(end.Position() + istrlen(eol), text, SelectionRange(end, start).Length()); + } else { + pdoc->InsertString(end.Position(), text, SelectionRange(end, start).Length()); + } + delete []text; + } +} + +void Editor::CancelModes() { + sel.SetMoveExtends(false); +} + +void Editor::NewLine() { + ClearSelection(); + const char *eol = "\n"; + if (pdoc->eolMode == SC_EOL_CRLF) { + eol = "\r\n"; + } else if (pdoc->eolMode == SC_EOL_CR) { + eol = "\r"; + } // else SC_EOL_LF -> "\n" already set + if (pdoc->InsertCString(sel.MainCaret(), eol)) { + SetEmptySelection(sel.MainCaret() + istrlen(eol)); + while (*eol) { + NotifyChar(*eol); + eol++; + } + } + SetLastXChosen(); + SetScrollBars(); + EnsureCaretVisible(); + // Avoid blinking during rapid typing: + ShowCaretAtCurrentPosition(); +} + +void Editor::CursorUpOrDown(int direction, Selection::selTypes selt) { + Point pt = PointMainCaret(); + int lineDoc = pdoc->LineFromPosition(sel.MainCaret()); + Point ptStartLine = LocationFromPosition(pdoc->LineStart(lineDoc)); + int subLine = (pt.y - ptStartLine.y) / vs.lineHeight; + int commentLines = vs.annotationVisible ? pdoc->AnnotationLines(lineDoc) : 0; + SelectionPosition posNew = SPositionFromLocation( + Point(lastXChosen, pt.y + direction * vs.lineHeight), false, false, UserVirtualSpace()); + if ((direction > 0) && (subLine >= (cs.GetHeight(lineDoc) - 1 - commentLines))) { + posNew = SPositionFromLocation( + Point(lastXChosen, pt.y + (commentLines + 1) * vs.lineHeight), false, false, UserVirtualSpace()); + } + if (direction < 0) { + // Line wrapping may lead to a location on the same line, so + // seek back if that is the case. + // There is an equivalent case when moving down which skips + // over a line but as that does not trap the user it is fine. + Point ptNew = LocationFromPosition(posNew.Position()); + while ((posNew.Position() > 0) && (pt.y == ptNew.y)) { + posNew.Add(- 1); + posNew.SetVirtualSpace(0); + ptNew = LocationFromPosition(posNew.Position()); + } + } + MovePositionTo(posNew, selt); +} + +void Editor::ParaUpOrDown(int direction, Selection::selTypes selt) { + int lineDoc, savedPos = sel.MainCaret(); + do { + MovePositionTo(SelectionPosition(direction > 0 ? pdoc->ParaDown(sel.MainCaret()) : pdoc->ParaUp(sel.MainCaret())), selt); + lineDoc = pdoc->LineFromPosition(sel.MainCaret()); + if (direction > 0) { + if (sel.MainCaret() >= pdoc->Length() && !cs.GetVisible(lineDoc)) { + if (selt == Selection::noSel) { + MovePositionTo(SelectionPosition(pdoc->LineEndPosition(savedPos))); + } + break; + } + } + } while (!cs.GetVisible(lineDoc)); +} + +int Editor::StartEndDisplayLine(int pos, bool start) { + RefreshStyleData(); + int line = pdoc->LineFromPosition(pos); + AutoSurface surface(this); + AutoLineLayout ll(llc, RetrieveLineLayout(line)); + int posRet = INVALID_POSITION; + if (surface && ll) { + unsigned int posLineStart = pdoc->LineStart(line); + LayoutLine(line, surface, vs, ll, wrapWidth); + int posInLine = pos - posLineStart; + if (posInLine <= ll->maxLineLength) { + for (int subLine = 0; subLine < ll->lines; subLine++) { + if ((posInLine >= ll->LineStart(subLine)) && (posInLine <= ll->LineStart(subLine + 1))) { + if (start) { + posRet = ll->LineStart(subLine) + posLineStart; + } else { + if (subLine == ll->lines - 1) + posRet = ll->LineStart(subLine + 1) + posLineStart; + else + posRet = ll->LineStart(subLine + 1) + posLineStart - 1; + } + } + } + } + } + if (posRet == INVALID_POSITION) { + return pos; + } else { + return posRet; + } +} + +int Editor::KeyCommand(unsigned int iMessage) { + switch (iMessage) { + case SCI_LINEDOWN: + CursorUpOrDown(1); + break; + case SCI_LINEDOWNEXTEND: + CursorUpOrDown(1, Selection::selStream); + break; + case SCI_LINEDOWNRECTEXTEND: + CursorUpOrDown(1, Selection::selRectangle); + break; + case SCI_PARADOWN: + ParaUpOrDown(1); + break; + case SCI_PARADOWNEXTEND: + ParaUpOrDown(1, Selection::selStream); + break; + case SCI_LINESCROLLDOWN: + ScrollTo(topLine + 1); + MoveCaretInsideView(false); + break; + case SCI_LINEUP: + CursorUpOrDown(-1); + break; + case SCI_LINEUPEXTEND: + CursorUpOrDown(-1, Selection::selStream); + break; + case SCI_LINEUPRECTEXTEND: + CursorUpOrDown(-1, Selection::selRectangle); + break; + case SCI_PARAUP: + ParaUpOrDown(-1); + break; + case SCI_PARAUPEXTEND: + ParaUpOrDown(-1, Selection::selStream); + break; + case SCI_LINESCROLLUP: + ScrollTo(topLine - 1); + MoveCaretInsideView(false); + break; + case SCI_CHARLEFT: + if (SelectionEmpty() || sel.MoveExtends()) { + if (pdoc->IsLineEndPosition(sel.MainCaret()) && sel.RangeMain().caret.VirtualSpace()) { + SelectionPosition spCaret = sel.RangeMain().caret; + spCaret.SetVirtualSpace(spCaret.VirtualSpace() - 1); + MovePositionTo(spCaret); + } else { + MovePositionTo(MovePositionSoVisible(SelectionPosition(sel.MainCaret() - 1), -1)); + } + } else { + MovePositionTo(sel.RangeMain().Start()); + } + SetLastXChosen(); + break; + case SCI_CHARLEFTEXTEND: + if (pdoc->IsLineEndPosition(sel.MainCaret()) && sel.RangeMain().caret.VirtualSpace()) { + SelectionPosition spCaret = sel.RangeMain().caret; + spCaret.SetVirtualSpace(spCaret.VirtualSpace() - 1); + MovePositionTo(spCaret, Selection::selStream); + } else { + MovePositionTo(MovePositionSoVisible(SelectionPosition(sel.MainCaret() - 1), -1), Selection::selStream); + } + SetLastXChosen(); + break; + case SCI_CHARLEFTRECTEXTEND: + if (pdoc->IsLineEndPosition(sel.MainCaret()) && sel.RangeMain().caret.VirtualSpace()) { + SelectionPosition spCaret = sel.RangeMain().caret; + spCaret.SetVirtualSpace(spCaret.VirtualSpace() - 1); + MovePositionTo(spCaret, Selection::selRectangle); + } else { + MovePositionTo(MovePositionSoVisible(SelectionPosition(sel.MainCaret() - 1), -1), Selection::selRectangle); + } + SetLastXChosen(); + break; + case SCI_CHARRIGHT: + if (SelectionEmpty() || sel.MoveExtends()) { + if ((virtualSpaceOptions & SCVS_USERACCESSIBLE) && pdoc->IsLineEndPosition(sel.MainCaret())) { + SelectionPosition spCaret = sel.RangeMain().caret; + spCaret.SetVirtualSpace(spCaret.VirtualSpace() + 1); + MovePositionTo(spCaret); + } else { + MovePositionTo(MovePositionSoVisible(SelectionPosition(sel.MainCaret() + 1), 1)); + } + } else { + MovePositionTo(sel.RangeMain().End()); + } + SetLastXChosen(); + break; + case SCI_CHARRIGHTEXTEND: + if ((virtualSpaceOptions & SCVS_USERACCESSIBLE) && pdoc->IsLineEndPosition(sel.MainCaret())) { + SelectionPosition spCaret = sel.RangeMain().caret; + spCaret.SetVirtualSpace(spCaret.VirtualSpace() + 1); + MovePositionTo(spCaret, Selection::selStream); + } else { + MovePositionTo(MovePositionSoVisible(SelectionPosition(sel.MainCaret() + 1), 1), Selection::selStream); + } + SetLastXChosen(); + break; + case SCI_CHARRIGHTRECTEXTEND: + if ((virtualSpaceOptions & SCVS_RECTANGULARSELECTION) && pdoc->IsLineEndPosition(sel.MainCaret())) { + SelectionPosition spCaret = sel.RangeMain().caret; + spCaret.SetVirtualSpace(spCaret.VirtualSpace() + 1); + MovePositionTo(spCaret, Selection::selRectangle); + } else { + MovePositionTo(MovePositionSoVisible(SelectionPosition(sel.MainCaret() + 1), 1), Selection::selRectangle); + } + SetLastXChosen(); + break; + case SCI_WORDLEFT: + MovePositionTo(MovePositionSoVisible(pdoc->NextWordStart(sel.MainCaret(), -1), -1)); + SetLastXChosen(); + break; + case SCI_WORDLEFTEXTEND: + MovePositionTo(MovePositionSoVisible(pdoc->NextWordStart(sel.MainCaret(), -1), -1), Selection::selStream); + SetLastXChosen(); + break; + case SCI_WORDRIGHT: + MovePositionTo(MovePositionSoVisible(pdoc->NextWordStart(sel.MainCaret(), 1), 1)); + SetLastXChosen(); + break; + case SCI_WORDRIGHTEXTEND: + MovePositionTo(MovePositionSoVisible(pdoc->NextWordStart(sel.MainCaret(), 1), 1), Selection::selStream); + SetLastXChosen(); + break; + + case SCI_WORDLEFTEND: + MovePositionTo(MovePositionSoVisible(pdoc->NextWordEnd(sel.MainCaret(), -1), -1)); + SetLastXChosen(); + break; + case SCI_WORDLEFTENDEXTEND: + MovePositionTo(MovePositionSoVisible(pdoc->NextWordEnd(sel.MainCaret(), -1), -1), Selection::selStream); + SetLastXChosen(); + break; + case SCI_WORDRIGHTEND: + MovePositionTo(MovePositionSoVisible(pdoc->NextWordEnd(sel.MainCaret(), 1), 1)); + SetLastXChosen(); + break; + case SCI_WORDRIGHTENDEXTEND: + MovePositionTo(MovePositionSoVisible(pdoc->NextWordEnd(sel.MainCaret(), 1), 1), Selection::selStream); + SetLastXChosen(); + break; + + case SCI_HOME: + MovePositionTo(pdoc->LineStart(pdoc->LineFromPosition(sel.MainCaret()))); + SetLastXChosen(); + break; + case SCI_HOMEEXTEND: + MovePositionTo(pdoc->LineStart(pdoc->LineFromPosition(sel.MainCaret())), Selection::selStream); + SetLastXChosen(); + break; + case SCI_HOMERECTEXTEND: + MovePositionTo(pdoc->LineStart(pdoc->LineFromPosition(sel.MainCaret())), Selection::selRectangle); + SetLastXChosen(); + break; + case SCI_LINEEND: + MovePositionTo(pdoc->LineEndPosition(sel.MainCaret())); + SetLastXChosen(); + break; + case SCI_LINEENDEXTEND: + MovePositionTo(pdoc->LineEndPosition(sel.MainCaret()), Selection::selStream); + SetLastXChosen(); + break; + case SCI_LINEENDRECTEXTEND: + MovePositionTo(pdoc->LineEndPosition(sel.MainCaret()), Selection::selRectangle); + SetLastXChosen(); + break; + case SCI_HOMEWRAP: { + SelectionPosition homePos = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), true), -1); + if (sel.RangeMain().caret <= homePos) + homePos = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(sel.MainCaret()))); + MovePositionTo(homePos); + SetLastXChosen(); + } + break; + case SCI_HOMEWRAPEXTEND: { + SelectionPosition homePos = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), true), -1); + if (sel.RangeMain().caret <= homePos) + homePos = SelectionPosition(pdoc->LineStart(pdoc->LineFromPosition(sel.MainCaret()))); + MovePositionTo(homePos, Selection::selStream); + SetLastXChosen(); + } + break; + case SCI_LINEENDWRAP: { + SelectionPosition endPos = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), false), 1); + SelectionPosition realEndPos = SelectionPosition(pdoc->LineEndPosition(sel.MainCaret())); + if (endPos > realEndPos // if moved past visible EOLs + || sel.RangeMain().caret >= endPos) // if at end of display line already + endPos = realEndPos; + MovePositionTo(endPos); + SetLastXChosen(); + } + break; + case SCI_LINEENDWRAPEXTEND: { + SelectionPosition endPos = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), false), 1); + SelectionPosition realEndPos = SelectionPosition(pdoc->LineEndPosition(sel.MainCaret())); + if (endPos > realEndPos // if moved past visible EOLs + || sel.RangeMain().caret >= endPos) // if at end of display line already + endPos = realEndPos; + MovePositionTo(endPos, Selection::selStream); + SetLastXChosen(); + } + break; + case SCI_DOCUMENTSTART: + MovePositionTo(0); + SetLastXChosen(); + break; + case SCI_DOCUMENTSTARTEXTEND: + MovePositionTo(0, Selection::selStream); + SetLastXChosen(); + break; + case SCI_DOCUMENTEND: + MovePositionTo(pdoc->Length()); + SetLastXChosen(); + break; + case SCI_DOCUMENTENDEXTEND: + MovePositionTo(pdoc->Length(), Selection::selStream); + SetLastXChosen(); + break; + case SCI_STUTTEREDPAGEUP: + PageMove(-1, Selection::noSel, true); + break; + case SCI_STUTTEREDPAGEUPEXTEND: + PageMove(-1, Selection::selStream, true); + break; + case SCI_STUTTEREDPAGEDOWN: + PageMove(1, Selection::noSel, true); + break; + case SCI_STUTTEREDPAGEDOWNEXTEND: + PageMove(1, Selection::selStream, true); + break; + case SCI_PAGEUP: + PageMove(-1); + break; + case SCI_PAGEUPEXTEND: + PageMove(-1, Selection::selStream); + break; + case SCI_PAGEUPRECTEXTEND: + PageMove(-1, Selection::selRectangle); + break; + case SCI_PAGEDOWN: + PageMove(1); + break; + case SCI_PAGEDOWNEXTEND: + PageMove(1, Selection::selStream); + break; + case SCI_PAGEDOWNRECTEXTEND: + PageMove(1, Selection::selRectangle); + break; + case SCI_EDITTOGGLEOVERTYPE: + inOverstrike = !inOverstrike; + DropCaret(); + ShowCaretAtCurrentPosition(); + NotifyUpdateUI(); + break; + case SCI_CANCEL: // Cancel any modes - handled in subclass + // Also unselect text + CancelModes(); + break; + case SCI_DELETEBACK: + DelCharBack(true); + if (!caretSticky) { + SetLastXChosen(); + } + EnsureCaretVisible(); + break; + case SCI_DELETEBACKNOTLINE: + DelCharBack(false); + if (!caretSticky) { + SetLastXChosen(); + } + EnsureCaretVisible(); + break; + case SCI_TAB: + Indent(true); + if (!caretSticky) { + SetLastXChosen(); + } + EnsureCaretVisible(); + ShowCaretAtCurrentPosition(); // Avoid blinking + break; + case SCI_BACKTAB: + Indent(false); + if (!caretSticky) { + SetLastXChosen(); + } + EnsureCaretVisible(); + ShowCaretAtCurrentPosition(); // Avoid blinking + break; + case SCI_NEWLINE: + NewLine(); + break; + case SCI_FORMFEED: + AddChar('\f'); + break; + case SCI_VCHOME: + MovePositionTo(pdoc->VCHomePosition(sel.MainCaret())); + SetLastXChosen(); + break; + case SCI_VCHOMEEXTEND: + MovePositionTo(pdoc->VCHomePosition(sel.MainCaret()), Selection::selStream); + SetLastXChosen(); + break; + case SCI_VCHOMERECTEXTEND: + MovePositionTo(pdoc->VCHomePosition(sel.MainCaret()), Selection::selRectangle); + SetLastXChosen(); + break; + case SCI_VCHOMEWRAP: { + SelectionPosition homePos = SelectionPosition(pdoc->VCHomePosition(sel.MainCaret())); + SelectionPosition viewLineStart = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), true), -1); + if ((viewLineStart < sel.RangeMain().caret) && (viewLineStart > homePos)) + homePos = viewLineStart; + + MovePositionTo(homePos); + SetLastXChosen(); + } + break; + case SCI_VCHOMEWRAPEXTEND: { + SelectionPosition homePos = SelectionPosition(pdoc->VCHomePosition(sel.MainCaret())); + SelectionPosition viewLineStart = MovePositionSoVisible(StartEndDisplayLine(sel.MainCaret(), true), -1); + if ((viewLineStart < sel.RangeMain().caret) && (viewLineStart > homePos)) + homePos = viewLineStart; + + MovePositionTo(homePos, Selection::selStream); + SetLastXChosen(); + } + break; + case SCI_ZOOMIN: + if (vs.zoomLevel < 20) { + vs.zoomLevel++; + InvalidateStyleRedraw(); + NotifyZoom(); + } + break; + case SCI_ZOOMOUT: + if (vs.zoomLevel > -10) { + vs.zoomLevel--; + InvalidateStyleRedraw(); + NotifyZoom(); + } + break; + case SCI_DELWORDLEFT: { + int startWord = pdoc->NextWordStart(sel.MainCaret(), -1); + pdoc->DeleteChars(startWord, sel.MainCaret() - startWord); + SetLastXChosen(); + } + break; + case SCI_DELWORDRIGHT: { + int endWord = pdoc->NextWordStart(sel.MainCaret(), 1); + pdoc->DeleteChars(sel.MainCaret(), endWord - sel.MainCaret()); + } + break; + case SCI_DELWORDRIGHTEND: { + int endWord = pdoc->NextWordEnd(sel.MainCaret(), 1); + pdoc->DeleteChars(sel.MainCaret(), endWord - sel.MainCaret()); + } + break; + case SCI_DELLINELEFT: { + int line = pdoc->LineFromPosition(sel.MainCaret()); + int start = pdoc->LineStart(line); + pdoc->DeleteChars(start, sel.MainCaret() - start); + SetLastXChosen(); + } + break; + case SCI_DELLINERIGHT: { + int line = pdoc->LineFromPosition(sel.MainCaret()); + int end = pdoc->LineEnd(line); + pdoc->DeleteChars(sel.MainCaret(), end - sel.MainCaret()); + } + break; + case SCI_LINECOPY: { + int lineStart = pdoc->LineFromPosition(SelectionStart().Position()); + int lineEnd = pdoc->LineFromPosition(SelectionEnd().Position()); + CopyRangeToClipboard(pdoc->LineStart(lineStart), + pdoc->LineStart(lineEnd + 1)); + } + break; + case SCI_LINECUT: { + int lineStart = pdoc->LineFromPosition(SelectionStart().Position()); + int lineEnd = pdoc->LineFromPosition(SelectionEnd().Position()); + int start = pdoc->LineStart(lineStart); + int end = pdoc->LineStart(lineEnd + 1); + SetSelection(start, end); + Cut(); + SetLastXChosen(); + } + break; + case SCI_LINEDELETE: { + int line = pdoc->LineFromPosition(sel.MainCaret()); + int start = pdoc->LineStart(line); + int end = pdoc->LineStart(line + 1); + pdoc->DeleteChars(start, end - start); + } + break; + case SCI_LINETRANSPOSE: + LineTranspose(); + break; + case SCI_LINEDUPLICATE: + Duplicate(true); + break; + case SCI_SELECTIONDUPLICATE: + Duplicate(false); + break; + case SCI_LOWERCASE: + ChangeCaseOfSelection(false); + break; + case SCI_UPPERCASE: + ChangeCaseOfSelection(true); + break; + case SCI_WORDPARTLEFT: + MovePositionTo(MovePositionSoVisible(pdoc->WordPartLeft(sel.MainCaret()), -1)); + SetLastXChosen(); + break; + case SCI_WORDPARTLEFTEXTEND: + MovePositionTo(MovePositionSoVisible(pdoc->WordPartLeft(sel.MainCaret()), -1), Selection::selStream); + SetLastXChosen(); + break; + case SCI_WORDPARTRIGHT: + MovePositionTo(MovePositionSoVisible(pdoc->WordPartRight(sel.MainCaret()), 1)); + SetLastXChosen(); + break; + case SCI_WORDPARTRIGHTEXTEND: + MovePositionTo(MovePositionSoVisible(pdoc->WordPartRight(sel.MainCaret()), 1), Selection::selStream); + SetLastXChosen(); + break; + case SCI_HOMEDISPLAY: + MovePositionTo(MovePositionSoVisible( + StartEndDisplayLine(sel.MainCaret(), true), -1)); + SetLastXChosen(); + break; + case SCI_HOMEDISPLAYEXTEND: + MovePositionTo(MovePositionSoVisible( + StartEndDisplayLine(sel.MainCaret(), true), -1), Selection::selStream); + SetLastXChosen(); + break; + case SCI_LINEENDDISPLAY: + MovePositionTo(MovePositionSoVisible( + StartEndDisplayLine(sel.MainCaret(), false), 1)); + SetLastXChosen(); + break; + case SCI_LINEENDDISPLAYEXTEND: + MovePositionTo(MovePositionSoVisible( + StartEndDisplayLine(sel.MainCaret(), false), 1), Selection::selStream); + SetLastXChosen(); + break; + } + return 0; +} + +int Editor::KeyDefault(int, int) { + return 0; +} + +int Editor::KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed) { + DwellEnd(false); + int modifiers = (shift ? SCI_SHIFT : 0) | (ctrl ? SCI_CTRL : 0) | + (alt ? SCI_ALT : 0); + int msg = kmap.Find(key, modifiers); + if (msg) { + if (consumed) + *consumed = true; + return WndProc(msg, 0, 0); + } else { + if (consumed) + *consumed = false; + return KeyDefault(key, modifiers); + } +} + +void Editor::SetWhitespaceVisible(int view) { + vs.viewWhitespace = static_cast(view); +} + +int Editor::GetWhitespaceVisible() { + return vs.viewWhitespace; +} + +void Editor::Indent(bool forwards) { + for (size_t r=0; rLineFromPosition(sel.Range(r).anchor.Position()); + int caretPosition = sel.Range(r).caret.Position(); + int lineCurrentPos = pdoc->LineFromPosition(caretPosition); + if (lineOfAnchor == lineCurrentPos) { + if (forwards) { + UndoGroup ug(pdoc); + pdoc->DeleteChars(sel.Range(r).Start().Position(), sel.Range(r).Length()); + caretPosition = sel.Range(r).caret.Position(); + if (pdoc->GetColumn(caretPosition) <= pdoc->GetColumn(pdoc->GetLineIndentPosition(lineCurrentPos)) && + pdoc->tabIndents) { + int indentation = pdoc->GetLineIndentation(lineCurrentPos); + int indentationStep = pdoc->IndentSize(); + pdoc->SetLineIndentation(lineCurrentPos, indentation + indentationStep - indentation % indentationStep); + sel.Range(r) = SelectionRange(pdoc->GetLineIndentPosition(lineCurrentPos)); + } else { + if (pdoc->useTabs) { + pdoc->InsertChar(caretPosition, '\t'); + sel.Range(r) = SelectionRange(caretPosition+1); + } else { + int numSpaces = (pdoc->tabInChars) - + (pdoc->GetColumn(caretPosition) % (pdoc->tabInChars)); + if (numSpaces < 1) + numSpaces = pdoc->tabInChars; + for (int i = 0; i < numSpaces; i++) { + pdoc->InsertChar(caretPosition + i, ' '); + } + sel.Range(r) = SelectionRange(caretPosition+numSpaces); + } + } + } else { + if (pdoc->GetColumn(caretPosition) <= pdoc->GetLineIndentation(lineCurrentPos) && + pdoc->tabIndents) { + UndoGroup ug(pdoc); + int indentation = pdoc->GetLineIndentation(lineCurrentPos); + int indentationStep = pdoc->IndentSize(); + pdoc->SetLineIndentation(lineCurrentPos, indentation - indentationStep); + SetEmptySelection(pdoc->GetLineIndentPosition(lineCurrentPos)); + } else { + int newColumn = ((pdoc->GetColumn(caretPosition) - 1) / pdoc->tabInChars) * + pdoc->tabInChars; + if (newColumn < 0) + newColumn = 0; + int newPos = caretPosition; + while (pdoc->GetColumn(newPos) > newColumn) + newPos--; + sel.Range(r) = SelectionRange(newPos); + } + } + } else { // Multiline + int anchorPosOnLine = sel.Range(r).anchor.Position() - pdoc->LineStart(lineOfAnchor); + int currentPosPosOnLine = caretPosition - pdoc->LineStart(lineCurrentPos); + // Multiple lines selected so indent / dedent + int lineTopSel = Platform::Minimum(lineOfAnchor, lineCurrentPos); + int lineBottomSel = Platform::Maximum(lineOfAnchor, lineCurrentPos); + if (pdoc->LineStart(lineBottomSel) == sel.Range(r).anchor.Position() || pdoc->LineStart(lineBottomSel) == caretPosition) + lineBottomSel--; // If not selecting any characters on a line, do not indent + { + UndoGroup ug(pdoc); + pdoc->Indent(forwards, lineBottomSel, lineTopSel); + } + if (lineOfAnchor < lineCurrentPos) { + if (currentPosPosOnLine == 0) + sel.Range(r) = SelectionRange(pdoc->LineStart(lineCurrentPos), pdoc->LineStart(lineOfAnchor)); + else + sel.Range(r) = SelectionRange(pdoc->LineStart(lineCurrentPos + 1), pdoc->LineStart(lineOfAnchor)); + } else { + if (anchorPosOnLine == 0) + sel.Range(r) = SelectionRange(pdoc->LineStart(lineCurrentPos), pdoc->LineStart(lineOfAnchor)); + else + sel.Range(r) = SelectionRange(pdoc->LineStart(lineCurrentPos), pdoc->LineStart(lineOfAnchor + 1)); + } + } + } +} + +/** + * Search of a text in the document, in the given range. + * @return The position of the found text, -1 if not found. + */ +long Editor::FindText( + uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD, + ///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX. + sptr_t lParam) { ///< @c TextToFind structure: The text to search for in the given range. + + Sci_TextToFind *ft = reinterpret_cast(lParam); + int lengthFound = istrlen(ft->lpstrText); + int pos = pdoc->FindText(ft->chrg.cpMin, ft->chrg.cpMax, ft->lpstrText, + (wParam & SCFIND_MATCHCASE) != 0, + (wParam & SCFIND_WHOLEWORD) != 0, + (wParam & SCFIND_WORDSTART) != 0, + (wParam & SCFIND_REGEXP) != 0, + wParam, + &lengthFound); + if (pos != -1) { + ft->chrgText.cpMin = pos; + ft->chrgText.cpMax = pos + lengthFound; + } + return pos; +} + +/** + * Relocatable search support : Searches relative to current selection + * point and sets the selection to the found text range with + * each search. + */ +/** + * Anchor following searches at current selection start: This allows + * multiple incremental interactive searches to be macro recorded + * while still setting the selection to found text so the find/select + * operation is self-contained. + */ +void Editor::SearchAnchor() { + searchAnchor = SelectionStart().Position(); +} + +/** + * Find text from current search anchor: Must call @c SearchAnchor first. + * Used for next text and previous text requests. + * @return The position of the found text, -1 if not found. + */ +long Editor::SearchText( + unsigned int iMessage, ///< Accepts both @c SCI_SEARCHNEXT and @c SCI_SEARCHPREV. + uptr_t wParam, ///< Search modes : @c SCFIND_MATCHCASE, @c SCFIND_WHOLEWORD, + ///< @c SCFIND_WORDSTART, @c SCFIND_REGEXP or @c SCFIND_POSIX. + sptr_t lParam) { ///< The text to search for. + + const char *txt = reinterpret_cast(lParam); + int pos; + int lengthFound = istrlen(txt); + if (iMessage == SCI_SEARCHNEXT) { + pos = pdoc->FindText(searchAnchor, pdoc->Length(), txt, + (wParam & SCFIND_MATCHCASE) != 0, + (wParam & SCFIND_WHOLEWORD) != 0, + (wParam & SCFIND_WORDSTART) != 0, + (wParam & SCFIND_REGEXP) != 0, + wParam, + &lengthFound); + } else { + pos = pdoc->FindText(searchAnchor, 0, txt, + (wParam & SCFIND_MATCHCASE) != 0, + (wParam & SCFIND_WHOLEWORD) != 0, + (wParam & SCFIND_WORDSTART) != 0, + (wParam & SCFIND_REGEXP) != 0, + wParam, + &lengthFound); + } + + if (pos != -1) { + SetSelection(pos, pos + lengthFound); + } + + return pos; +} + +/** + * Search for text in the target range of the document. + * @return The position of the found text, -1 if not found. + */ +long Editor::SearchInTarget(const char *text, int length) { + int lengthFound = length; + int pos = pdoc->FindText(targetStart, targetEnd, text, + (searchFlags & SCFIND_MATCHCASE) != 0, + (searchFlags & SCFIND_WHOLEWORD) != 0, + (searchFlags & SCFIND_WORDSTART) != 0, + (searchFlags & SCFIND_REGEXP) != 0, + searchFlags, + &lengthFound); + if (pos != -1) { + targetStart = pos; + targetEnd = pos + lengthFound; + } + return pos; +} + +void Editor::GoToLine(int lineNo) { + if (lineNo > pdoc->LinesTotal()) + lineNo = pdoc->LinesTotal(); + if (lineNo < 0) + lineNo = 0; + SetEmptySelection(pdoc->LineStart(lineNo)); + ShowCaretAtCurrentPosition(); + EnsureCaretVisible(); +} + +static bool Close(Point pt1, Point pt2) { + if (abs(pt1.x - pt2.x) > 3) + return false; + if (abs(pt1.y - pt2.y) > 3) + return false; + return true; +} + +char *Editor::CopyRange(int start, int end) { + char *text = 0; + if (start < end) { + int len = end - start; + text = new char[len + 1]; + for (int i = 0; i < len; i++) { + text[i] = pdoc->CharAt(start + i); + } + text[len] = '\0'; + } + return text; +} + +void Editor::CopySelectionRange(SelectionText *ss, bool allowLineCopy) { + if (sel.Empty()) { + if (allowLineCopy) { + int currentLine = pdoc->LineFromPosition(sel.MainCaret()); + int start = pdoc->LineStart(currentLine); + int end = pdoc->LineEnd(currentLine); + + char *text = CopyRange(start, end); + int textLen = text ? strlen(text) : 0; + // include room for \r\n\0 + textLen += 3; + char *textWithEndl = new char[textLen]; + textWithEndl[0] = '\0'; + if (text) + strncat(textWithEndl, text, textLen); + if (pdoc->eolMode != SC_EOL_LF) + strncat(textWithEndl, "\r", textLen); + if (pdoc->eolMode != SC_EOL_CR) + strncat(textWithEndl, "\n", textLen); + ss->Set(textWithEndl, strlen(textWithEndl), + pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false, true); + delete []text; + } + } else { + int delimiterLength = 0; + if (sel.selType == Selection::selRectangle) { + if (pdoc->eolMode == SC_EOL_CRLF) { + delimiterLength = 2; + } else { + delimiterLength = 1; + } + } + int size = sel.Length() + delimiterLength * sel.Count(); + char *text = new char[size + 1]; + int j = 0; + std::vector rangesInOrder = sel.RangesCopy(); + if (sel.selType == Selection::selRectangle) + std::sort(rangesInOrder.begin(), rangesInOrder.end()); + for (size_t r=0; rCharAt(i); + } + if (sel.selType == Selection::selRectangle) { + if (pdoc->eolMode != SC_EOL_LF) { + text[j++] = '\r'; + } + if (pdoc->eolMode != SC_EOL_CR) { + text[j++] = '\n'; + } + } + } + text[size] = '\0'; + ss->Set(text, size + 1, pdoc->dbcsCodePage, + vs.styles[STYLE_DEFAULT].characterSet, sel.IsRectangular(), sel.selType == Selection::selLines); + } +} + +void Editor::CopyRangeToClipboard(int start, int end) { + start = pdoc->ClampPositionIntoDocument(start); + end = pdoc->ClampPositionIntoDocument(end); + SelectionText selectedText; + selectedText.Set(CopyRange(start, end), end - start + 1, + pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false, false); + CopyToClipboard(selectedText); +} + +void Editor::CopyText(int length, const char *text) { + SelectionText selectedText; + selectedText.Copy(text, length + 1, + pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false, false); + CopyToClipboard(selectedText); +} + +void Editor::SetDragPosition(SelectionPosition newPos) { + if (newPos.Position() >= 0) { + newPos = MovePositionOutsideChar(newPos, 1); + posDrop = newPos; + } + if (!(posDrag == newPos)) { + caret.on = true; + SetTicking(true); + InvalidateCaret(); + posDrag = newPos; + InvalidateCaret(); + } +} + +void Editor::DisplayCursor(Window::Cursor c) { + if (cursorMode == SC_CURSORNORMAL) + wMain.SetCursor(c); + else + wMain.SetCursor(static_cast(cursorMode)); +} + +bool Editor::DragThreshold(Point ptStart, Point ptNow) { + int xMove = ptStart.x - ptNow.x; + int yMove = ptStart.y - ptNow.y; + int distanceSquared = xMove * xMove + yMove * yMove; + return distanceSquared > 16; +} + +void Editor::StartDrag() { + // Always handled by subclasses + //SetMouseCapture(true); + //DisplayCursor(Window::cursorArrow); +} + +void Editor::DropAt(SelectionPosition position, const char *value, bool moving, bool rectangular) { + //Platform::DebugPrintf("DropAt %d %d\n", inDragDrop, position); + if (inDragDrop == ddDragging) + dropWentOutside = false; + + bool positionWasInSelection = PositionInSelection(position.Position()); + + bool positionOnEdgeOfSelection = + (position == SelectionStart()) || (position == SelectionEnd()); + + if ((inDragDrop != ddDragging) || !(positionWasInSelection) || + (positionOnEdgeOfSelection && !moving)) { + + SelectionPosition selStart = SelectionStart(); + SelectionPosition selEnd = SelectionEnd(); + + UndoGroup ug(pdoc); + + SelectionPosition positionAfterDeletion = position; + if ((inDragDrop == ddDragging) && moving) { + // Remove dragged out text + if (rectangular || sel.selType == Selection::selLines) { + for (size_t r=0; r= sel.Range(r).Start()) { + if (position > sel.Range(r).End()) { + positionAfterDeletion.Add(-sel.Range(r).Length()); + } else { + positionAfterDeletion.Add(-SelectionRange(position, sel.Range(r).Start()).Length()); + } + } + } + } else { + if (position > selStart) { + positionAfterDeletion.Add(-SelectionRange(selEnd, selStart).Length()); + } + } + ClearSelection(); + } + position = positionAfterDeletion; + + if (rectangular) { + PasteRectangular(position, value, istrlen(value)); + // Should try to select new rectangle but it may not be a rectangle now so just select the drop position + SetEmptySelection(position); + } else { + position = MovePositionOutsideChar(position, sel.MainCaret() - position.Position()); + position = SelectionPosition(InsertSpace(position.Position(), position.VirtualSpace())); + if (pdoc->InsertCString(position.Position(), value)) { + SelectionPosition posAfterInsertion = position; + posAfterInsertion.Add(istrlen(value)); + SetSelection(posAfterInsertion, position); + } + } + } else if (inDragDrop == ddDragging) { + SetEmptySelection(position); + } +} + +/** + * @return true if given position is inside the selection, + */ +bool Editor::PositionInSelection(int pos) { + pos = MovePositionOutsideChar(pos, sel.MainCaret() - pos); + for (size_t r=0; r xPos) { + hit = false; + } + } + if (hit) + return true; + } + } + return false; +} + +bool Editor::PointInSelMargin(Point pt) { + // Really means: "Point in a margin" + if (vs.fixedColumnWidth > 0) { // There is a margin + PRectangle rcSelMargin = GetClientRectangle(); + rcSelMargin.right = vs.fixedColumnWidth - vs.leftMarginWidth; + return rcSelMargin.Contains(pt); + } else { + return false; + } +} + +void Editor::LineSelection(int lineCurrent_, int lineAnchor_) { + if (lineAnchor_ < lineCurrent_) { + SetSelection(pdoc->LineStart(lineCurrent_ + 1), + pdoc->LineStart(lineAnchor_)); + } else if (lineAnchor_ > lineCurrent_) { + SetSelection(pdoc->LineStart(lineCurrent_), + pdoc->LineStart(lineAnchor_ + 1)); + } else { // Same line, select it + SetSelection(pdoc->LineStart(lineAnchor_ + 1), + pdoc->LineStart(lineAnchor_)); + } +} + +void Editor::DwellEnd(bool mouseMoved) { + if (mouseMoved) + ticksToDwell = dwellDelay; + else + ticksToDwell = SC_TIME_FOREVER; + if (dwelling && (dwellDelay < SC_TIME_FOREVER)) { + dwelling = false; + NotifyDwelling(ptMouseLast, dwelling); + } +} + +static bool AllowVirtualSpace(int virtualSpaceOptions, bool rectangular) { + return ((virtualSpaceOptions & SCVS_USERACCESSIBLE) != 0) + || (rectangular && ((virtualSpaceOptions & SCVS_RECTANGULARSELECTION) != 0)); +} + +void Editor::ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt) { + //Platform::DebugPrintf("ButtonDown %d %d = %d alt=%d %d\n", curTime, lastClickTime, curTime - lastClickTime, alt, inDragDrop); + ptMouseLast = pt; + SelectionPosition newPos = SPositionFromLocation(pt, false, false, AllowVirtualSpace(virtualSpaceOptions, alt)); + newPos = MovePositionOutsideChar(newPos, sel.MainCaret() - newPos.Position()); + inDragDrop = ddNone; + sel.SetMoveExtends(false); + + bool processed = NotifyMarginClick(pt, shift, ctrl, alt); + if (processed) + return; + + NotifyIndicatorClick(true, newPos.Position(), shift, ctrl, alt); + + bool inSelMargin = PointInSelMargin(pt); + if (shift & !inSelMargin) { + SetSelection(newPos.Position()); + } + if (((curTime - lastClickTime) < Platform::DoubleClickTime()) && Close(pt, lastClick)) { + //Platform::DebugPrintf("Double click %d %d = %d\n", curTime, lastClickTime, curTime - lastClickTime); + SetMouseCapture(true); + SetEmptySelection(newPos.Position()); + bool doubleClick = false; + // Stop mouse button bounce changing selection type + if (!Platform::MouseButtonBounce() || curTime != lastClickTime) { + if (selectionType == selChar) { + selectionType = selWord; + doubleClick = true; + } else if (selectionType == selWord) { + selectionType = selLine; + } else { + selectionType = selChar; + originalAnchorPos = sel.MainCaret(); + } + } + + if (selectionType == selWord) { + if (sel.MainCaret() >= originalAnchorPos) { // Moved forward + SetSelection(pdoc->ExtendWordSelect(sel.MainCaret(), 1), + pdoc->ExtendWordSelect(originalAnchorPos, -1)); + } else { // Moved backward + SetSelection(pdoc->ExtendWordSelect(sel.MainCaret(), -1), + pdoc->ExtendWordSelect(originalAnchorPos, 1)); + } + } else if (selectionType == selLine) { + lineAnchor = LineFromLocation(pt); + SetSelection(pdoc->LineStart(lineAnchor + 1), pdoc->LineStart(lineAnchor)); + //Platform::DebugPrintf("Triple click: %d - %d\n", anchor, currentPos); + } else { + SetEmptySelection(sel.MainCaret()); + } + //Platform::DebugPrintf("Double click: %d - %d\n", anchor, currentPos); + if (doubleClick) { + NotifyDoubleClick(pt, shift, ctrl, alt); + if (PositionIsHotspot(newPos.Position())) + NotifyHotSpotDoubleClicked(newPos.Position(), shift, ctrl, alt); + } + } else { // Single click + if (inSelMargin) { + sel.selType = Selection::selStream; + if (ctrl) { + SelectAll(); + lastClickTime = curTime; + return; + } + if (!shift) { + lineAnchor = LineFromLocation(pt); + // Single click in margin: select whole line + LineSelection(lineAnchor, lineAnchor); + SetSelection(pdoc->LineStart(lineAnchor + 1), + pdoc->LineStart(lineAnchor)); + } else { + // Single shift+click in margin: select from line anchor to clicked line + if (sel.MainAnchor() > sel.MainCaret()) + lineAnchor = pdoc->LineFromPosition(sel.MainAnchor() - 1); + else + lineAnchor = pdoc->LineFromPosition(sel.MainAnchor()); + int lineStart = LineFromLocation(pt); + LineSelection(lineStart, lineAnchor); + //lineAnchor = lineStart; // Keep the same anchor for ButtonMove + } + + SetDragPosition(SelectionPosition(invalidPosition)); + SetMouseCapture(true); + selectionType = selLine; + } else { + if (PointIsHotspot(pt)) { + NotifyHotSpotClicked(newPos.Position(), shift, ctrl, alt); + } + if (!shift) { + if (PointInSelection(pt) && !SelectionEmpty()) + inDragDrop = ddInitial; + else + inDragDrop = ddNone; + } + SetMouseCapture(true); + if (inDragDrop != ddInitial) { + SetDragPosition(SelectionPosition(invalidPosition)); + if (!shift) { + if (ctrl && multipleSelection) { + SelectionRange range(newPos); + sel.TentativeSelection(range); + InvalidateSelection(range, true); + } else { + InvalidateSelection(SelectionRange(newPos), true); + if (sel.Count() > 1) + Redraw(); + sel.Clear(); + sel.selType = alt ? Selection::selRectangle : Selection::selStream; + SetSelection(newPos, newPos); + } + } + sel.selType = alt ? Selection::selRectangle : Selection::selStream; + selectionType = selChar; + originalAnchorPos = sel.MainCaret(); + sel.Rectangular() = SelectionRange(newPos); + SetRectangularRange(); + } + } + } + lastClickTime = curTime; + lastXChosen = pt.x; + ShowCaretAtCurrentPosition(); +} + +bool Editor::PositionIsHotspot(int position) { + return vs.styles[pdoc->StyleAt(position) & pdoc->stylingBitsMask].hotspot; +} + +bool Editor::PointIsHotspot(Point pt) { + int pos = PositionFromLocation(pt, true); + if (pos == INVALID_POSITION) + return false; + return PositionIsHotspot(pos); +} + +void Editor::SetHotSpotRange(Point *pt) { + if (pt) { + int pos = PositionFromLocation(*pt); + + // If we don't limit this to word characters then the + // range can encompass more than the run range and then + // the underline will not be drawn properly. + int hsStart_ = pdoc->ExtendStyleRange(pos, -1, vs.hotspotSingleLine); + int hsEnd_ = pdoc->ExtendStyleRange(pos, 1, vs.hotspotSingleLine); + + // Only invalidate the range if the hotspot range has changed... + if (hsStart_ != hsStart || hsEnd_ != hsEnd) { + if (hsStart != -1) { + InvalidateRange(hsStart, hsEnd); + } + hsStart = hsStart_; + hsEnd = hsEnd_; + InvalidateRange(hsStart, hsEnd); + } + } else { + if (hsStart != -1) { + int hsStart_ = hsStart; + int hsEnd_ = hsEnd; + hsStart = -1; + hsEnd = -1; + InvalidateRange(hsStart_, hsEnd_); + } else { + hsStart = -1; + hsEnd = -1; + } + } +} + +void Editor::GetHotSpotRange(int& hsStart_, int& hsEnd_) { + hsStart_ = hsStart; + hsEnd_ = hsEnd; +} + +void Editor::ButtonMove(Point pt) { + if ((ptMouseLast.x != pt.x) || (ptMouseLast.y != pt.y)) { + DwellEnd(true); + } + + SelectionPosition movePos = SPositionFromLocation(pt, false, false, + AllowVirtualSpace(virtualSpaceOptions, sel.IsRectangular())); + movePos = MovePositionOutsideChar(movePos, sel.MainCaret() - movePos.Position()); + + if (inDragDrop == ddInitial) { + if (DragThreshold(ptMouseLast, pt)) { + SetMouseCapture(false); + SetDragPosition(movePos); + CopySelectionRange(&drag); + StartDrag(); + } + return; + } + + ptMouseLast = pt; + //Platform::DebugPrintf("Move %d %d\n", pt.x, pt.y); + if (HaveMouseCapture()) { + + // Slow down autoscrolling/selection + autoScrollTimer.ticksToWait -= timer.tickSize; + if (autoScrollTimer.ticksToWait > 0) + return; + autoScrollTimer.ticksToWait = autoScrollDelay; + + // Adjust selection + if (posDrag.IsValid()) { + SetDragPosition(movePos); + } else { + if (selectionType == selChar) { + if (sel.IsRectangular()) { + sel.Rectangular() = SelectionRange(movePos, sel.Rectangular().anchor); + SetSelection(movePos, sel.RangeMain().anchor); + } else if (sel.Count() > 1) { + SelectionRange range(movePos, sel.RangeMain().anchor); + sel.TentativeSelection(range); + InvalidateSelection(range, true); + } else { + SetSelection(movePos, sel.RangeMain().anchor); + } + } else if (selectionType == selWord) { + // Continue selecting by word + if (movePos.Position() == originalAnchorPos) { // Didn't move + // No need to do anything. Previously this case was lumped + // in with "Moved forward", but that can be harmful in this + // case: a handler for the NotifyDoubleClick re-adjusts + // the selection for a fancier definition of "word" (for + // example, in Perl it is useful to include the leading + // '$', '%' or '@' on variables for word selection). In this + // the ButtonMove() called via Tick() for auto-scrolling + // could result in the fancier word selection adjustment + // being unmade. + } else if (movePos.Position() > originalAnchorPos) { // Moved forward + SetSelection(pdoc->ExtendWordSelect(movePos.Position(), 1), + pdoc->ExtendWordSelect(originalAnchorPos, -1)); + } else { // Moved backward + SetSelection(pdoc->ExtendWordSelect(movePos.Position(), -1), + pdoc->ExtendWordSelect(originalAnchorPos, 1)); + } + } else { + // Continue selecting by line + int lineMove = LineFromLocation(pt); + LineSelection(lineMove, lineAnchor); + } + } + + // Autoscroll + PRectangle rcClient = GetClientRectangle(); + if (pt.y > rcClient.bottom) { + int lineMove = cs.DisplayFromDoc(LineFromLocation(pt)); + if (lineMove < 0) { + lineMove = cs.DisplayFromDoc(pdoc->LinesTotal() - 1); + } + ScrollTo(lineMove - LinesOnScreen() + 1); + Redraw(); + } else if (pt.y < rcClient.top) { + int lineMove = cs.DisplayFromDoc(LineFromLocation(pt)); + ScrollTo(lineMove - 1); + Redraw(); + } + EnsureCaretVisible(false, false, true); + + if (hsStart != -1 && !PositionIsHotspot(movePos.Position())) + SetHotSpotRange(NULL); + + } else { + if (vs.fixedColumnWidth > 0) { // There is a margin + if (PointInSelMargin(pt)) { + DisplayCursor(Window::cursorReverseArrow); + return; // No need to test for selection + } + } + // Display regular (drag) cursor over selection + if (PointInSelection(pt) && !SelectionEmpty()) { + DisplayCursor(Window::cursorArrow); + } else if (PointIsHotspot(pt)) { + DisplayCursor(Window::cursorHand); + SetHotSpotRange(&pt); + } else { + DisplayCursor(Window::cursorText); + SetHotSpotRange(NULL); + } + } +} + +void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) { + //Platform::DebugPrintf("ButtonUp %d %d\n", HaveMouseCapture(), inDragDrop); + SelectionPosition newPos = SPositionFromLocation(pt, false, false, + AllowVirtualSpace(virtualSpaceOptions, sel.IsRectangular())); + newPos = MovePositionOutsideChar(newPos, sel.MainCaret() - newPos.Position()); + if (inDragDrop == ddInitial) { + inDragDrop = ddNone; + SetEmptySelection(newPos.Position()); + } + if (HaveMouseCapture()) { + if (PointInSelMargin(pt)) { + DisplayCursor(Window::cursorReverseArrow); + } else { + DisplayCursor(Window::cursorText); + SetHotSpotRange(NULL); + } + ptMouseLast = pt; + SetMouseCapture(false); + NotifyIndicatorClick(false, newPos.Position(), false, false, false); + if (inDragDrop == ddDragging) { + SelectionPosition selStart = SelectionStart(); + SelectionPosition selEnd = SelectionEnd(); + if (selStart < selEnd) { + if (drag.len) { + if (ctrl) { + if (pdoc->InsertString(newPos.Position(), drag.s, drag.len)) { + SetSelection(newPos.Position(), newPos.Position() + drag.len); + } + } else if (newPos < selStart) { + pdoc->DeleteChars(selStart.Position(), drag.len); + if (pdoc->InsertString(newPos.Position(), drag.s, drag.len)) { + SetSelection(newPos.Position(), newPos.Position() + drag.len); + } + } else if (newPos > selEnd) { + pdoc->DeleteChars(selStart.Position(), drag.len); + newPos.Add(-drag.len); + if (pdoc->InsertString(newPos.Position(), drag.s, drag.len)) { + SetSelection(newPos.Position(), newPos.Position() + drag.len); + } + } else { + SetEmptySelection(newPos.Position()); + } + drag.Free(); + } + selectionType = selChar; + } + } else { + if (selectionType == selChar) { + if (sel.Count() > 1) { + sel.RangeMain() = + SelectionRange(newPos, sel.Range(sel.Count() - 1).anchor); + InvalidateSelection(sel.RangeMain(), true); + } else { + SetSelection(newPos, sel.RangeMain().anchor); + } + } + sel.CommitTentative(); + } + SetRectangularRange(); + lastClickTime = curTime; + lastClick = pt; + lastXChosen = pt.x; + if (sel.selType == Selection::selStream) { + SetLastXChosen(); + } + inDragDrop = ddNone; + EnsureCaretVisible(false); + } +} + +// Called frequently to perform background UI including +// caret blinking and automatic scrolling. +void Editor::Tick() { + if (HaveMouseCapture()) { + // Auto scroll + ButtonMove(ptMouseLast); + } + if (caret.period > 0) { + timer.ticksToWait -= timer.tickSize; + if (timer.ticksToWait <= 0) { + caret.on = !caret.on; + timer.ticksToWait = caret.period; + if (caret.active) { + InvalidateCaret(); + } + } + } + if (horizontalScrollBarVisible && trackLineWidth && (lineWidthMaxSeen > scrollWidth)) { + scrollWidth = lineWidthMaxSeen; + SetScrollBars(); + } + if ((dwellDelay < SC_TIME_FOREVER) && + (ticksToDwell > 0) && + (!HaveMouseCapture())) { + ticksToDwell -= timer.tickSize; + if (ticksToDwell <= 0) { + dwelling = true; + NotifyDwelling(ptMouseLast, dwelling); + } + } +} + +bool Editor::Idle() { + + bool idleDone; + + bool wrappingDone = wrapState == eWrapNone; + + if (!wrappingDone) { + // Wrap lines during idle. + WrapLines(false, -1); + // No more wrapping + if (wrapStart == wrapEnd) + wrappingDone = true; + } + + // Add more idle things to do here, but make sure idleDone is + // set correctly before the function returns. returning + // false will stop calling this idle funtion until SetIdle() is + // called again. + + idleDone = wrappingDone; // && thatDone && theOtherThingDone... + + return !idleDone; +} + +void Editor::SetFocusState(bool focusState) { + hasFocus = focusState; + NotifyFocus(hasFocus); + if (hasFocus) { + ShowCaretAtCurrentPosition(); + } else { + CancelModes(); + DropCaret(); + } +} + +bool Editor::PaintContains(PRectangle rc) { + if (rc.Empty()) { + return true; + } else { + return rcPaint.Contains(rc); + } +} + +bool Editor::PaintContainsMargin() { + PRectangle rcSelMargin = GetClientRectangle(); + rcSelMargin.right = vs.fixedColumnWidth; + return PaintContains(rcSelMargin); +} + +void Editor::CheckForChangeOutsidePaint(Range r) { + if (paintState == painting && !paintingAllText) { + //Platform::DebugPrintf("Checking range in paint %d-%d\n", r.start, r.end); + if (!r.Valid()) + return; + + PRectangle rcRange = RectangleFromRange(r.start, r.end); + PRectangle rcText = GetTextRectangle(); + if (rcRange.top < rcText.top) { + rcRange.top = rcText.top; + } + if (rcRange.bottom > rcText.bottom) { + rcRange.bottom = rcText.bottom; + } + + if (!PaintContains(rcRange)) { + AbandonPaint(); + } + } +} + +void Editor::SetBraceHighlight(Position pos0, Position pos1, int matchStyle) { + if ((pos0 != braces[0]) || (pos1 != braces[1]) || (matchStyle != bracesMatchStyle)) { + if ((braces[0] != pos0) || (matchStyle != bracesMatchStyle)) { + CheckForChangeOutsidePaint(Range(braces[0])); + CheckForChangeOutsidePaint(Range(pos0)); + braces[0] = pos0; + } + if ((braces[1] != pos1) || (matchStyle != bracesMatchStyle)) { + CheckForChangeOutsidePaint(Range(braces[1])); + CheckForChangeOutsidePaint(Range(pos1)); + braces[1] = pos1; + } + bracesMatchStyle = matchStyle; + if (paintState == notPainting) { + Redraw(); + } + } +} + +void Editor::SetAnnotationHeights(int start, int end) { + if (vs.annotationVisible) { + for (int line=start; lineAnnotationLines(line) + 1); + } + } +} + +void Editor::SetDocPointer(Document *document) { + //Platform::DebugPrintf("** %x setdoc to %x\n", pdoc, document); + pdoc->RemoveWatcher(this, 0); + pdoc->Release(); + if (document == NULL) { + pdoc = new Document(); + } else { + pdoc = document; + } + pdoc->AddRef(); + + // Ensure all positions within document + sel.Clear(); + targetStart = 0; + targetEnd = 0; + + braces[0] = invalidPosition; + braces[1] = invalidPosition; + + // Reset the contraction state to fully shown. + cs.Clear(); + cs.InsertLines(0, pdoc->LinesTotal() - 1); + SetAnnotationHeights(0, pdoc->LinesTotal()); + llc.Deallocate(); + NeedWrapping(); + + pdoc->AddWatcher(this, 0); + SetScrollBars(); + Redraw(); +} + +void Editor::SetAnnotationVisible(int visible) { + if (vs.annotationVisible != visible) { + bool changedFromOrToHidden = ((vs.annotationVisible != 0) != (visible != 0)); + vs.annotationVisible = visible; + if (changedFromOrToHidden) { + int dir = vs.annotationVisible ? 1 : -1; + for (int line=0; lineLinesTotal(); line++) { + int annotationLines = pdoc->AnnotationLines(line); + if (annotationLines > 0) { + cs.SetHeight(line, cs.GetHeight(line) + annotationLines * dir); + } + } + } + } +} + +/** + * Recursively expand a fold, making lines visible except where they have an unexpanded parent. + */ +void Editor::Expand(int &line, bool doExpand) { + int lineMaxSubord = pdoc->GetLastChild(line); + line++; + while (line <= lineMaxSubord) { + if (doExpand) + cs.SetVisible(line, line, true); + int level = pdoc->GetLevel(line); + if (level & SC_FOLDLEVELHEADERFLAG) { + if (doExpand && cs.GetExpanded(line)) { + Expand(line, true); + } else { + Expand(line, false); + } + } else { + line++; + } + } +} + +void Editor::ToggleContraction(int line) { + if (line >= 0) { + if ((pdoc->GetLevel(line) & SC_FOLDLEVELHEADERFLAG) == 0) { + line = pdoc->GetFoldParent(line); + if (line < 0) + return; + } + + if (cs.GetExpanded(line)) { + int lineMaxSubord = pdoc->GetLastChild(line); + cs.SetExpanded(line, 0); + if (lineMaxSubord > line) { + cs.SetVisible(line + 1, lineMaxSubord, false); + + int lineCurrent = pdoc->LineFromPosition(sel.MainCaret()); + if (lineCurrent > line && lineCurrent <= lineMaxSubord) { + // This does not re-expand the fold + EnsureCaretVisible(); + } + + SetScrollBars(); + Redraw(); + } + + } else { + if (!(cs.GetVisible(line))) { + EnsureLineVisible(line, false); + GoToLine(line); + } + cs.SetExpanded(line, 1); + Expand(line, true); + SetScrollBars(); + Redraw(); + } + } +} + +/** + * Recurse up from this line to find any folds that prevent this line from being visible + * and unfold them all. + */ +void Editor::EnsureLineVisible(int lineDoc, bool enforcePolicy) { + + // In case in need of wrapping to ensure DisplayFromDoc works. + WrapLines(true, -1); + + if (!cs.GetVisible(lineDoc)) { + int lineParent = pdoc->GetFoldParent(lineDoc); + if (lineParent >= 0) { + if (lineDoc != lineParent) + EnsureLineVisible(lineParent, enforcePolicy); + if (!cs.GetExpanded(lineParent)) { + cs.SetExpanded(lineParent, 1); + Expand(lineParent, true); + } + } + SetScrollBars(); + Redraw(); + } + if (enforcePolicy) { + int lineDisplay = cs.DisplayFromDoc(lineDoc); + if (visiblePolicy & VISIBLE_SLOP) { + if ((topLine > lineDisplay) || ((visiblePolicy & VISIBLE_STRICT) && (topLine + visibleSlop > lineDisplay))) { + SetTopLine(Platform::Clamp(lineDisplay - visibleSlop, 0, MaxScrollPos())); + SetVerticalScrollPos(); + Redraw(); + } else if ((lineDisplay > topLine + LinesOnScreen() - 1) || + ((visiblePolicy & VISIBLE_STRICT) && (lineDisplay > topLine + LinesOnScreen() - 1 - visibleSlop))) { + SetTopLine(Platform::Clamp(lineDisplay - LinesOnScreen() + 1 + visibleSlop, 0, MaxScrollPos())); + SetVerticalScrollPos(); + Redraw(); + } + } else { + if ((topLine > lineDisplay) || (lineDisplay > topLine + LinesOnScreen() - 1) || (visiblePolicy & VISIBLE_STRICT)) { + SetTopLine(Platform::Clamp(lineDisplay - LinesOnScreen() / 2 + 1, 0, MaxScrollPos())); + SetVerticalScrollPos(); + Redraw(); + } + } + } +} + +int Editor::ReplaceTarget(bool replacePatterns, const char *text, int length) { + UndoGroup ug(pdoc); + if (length == -1) + length = istrlen(text); + if (replacePatterns) { + text = pdoc->SubstituteByPosition(text, &length); + if (!text) { + return 0; + } + } + if (targetStart != targetEnd) + pdoc->DeleteChars(targetStart, targetEnd - targetStart); + targetEnd = targetStart; + pdoc->InsertString(targetStart, text, length); + targetEnd = targetStart + length; + return length; +} + +bool Editor::IsUnicodeMode() const { + return pdoc && (SC_CP_UTF8 == pdoc->dbcsCodePage); +} + +int Editor::CodePage() const { + if (pdoc) + return pdoc->dbcsCodePage; + else + return 0; +} + +int Editor::WrapCount(int line) { + AutoSurface surface(this); + AutoLineLayout ll(llc, RetrieveLineLayout(line)); + + if (surface && ll) { + LayoutLine(line, surface, vs, ll, wrapWidth); + return ll->lines; + } else { + return 1; + } +} + +void Editor::AddStyledText(char *buffer, int appendLength) { + // The buffer consists of alternating character bytes and style bytes + size_t textLength = appendLength / 2; + char *text = new char[textLength]; + size_t i; + for (i = 0;i < textLength;i++) { + text[i] = buffer[i*2]; + } + pdoc->InsertString(CurrentPosition(), text, textLength); + for (i = 0;i < textLength;i++) { + text[i] = buffer[i*2+1]; + } + pdoc->StartStyling(CurrentPosition(), static_cast(0xff)); + pdoc->SetStyles(textLength, text); + delete []text; + SetEmptySelection(sel.MainCaret() + textLength); +} + +static bool ValidMargin(unsigned long wParam) { + return wParam < ViewStyle::margins; +} + +static char *CharPtrFromSPtr(sptr_t lParam) { + return reinterpret_cast(lParam); +} + +void Editor::StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { + vs.EnsureStyle(wParam); + switch (iMessage) { + case SCI_STYLESETFORE: + vs.styles[wParam].fore.desired = ColourDesired(lParam); + break; + case SCI_STYLESETBACK: + vs.styles[wParam].back.desired = ColourDesired(lParam); + break; + case SCI_STYLESETBOLD: + vs.styles[wParam].bold = lParam != 0; + break; + case SCI_STYLESETITALIC: + vs.styles[wParam].italic = lParam != 0; + break; + case SCI_STYLESETEOLFILLED: + vs.styles[wParam].eolFilled = lParam != 0; + break; + case SCI_STYLESETSIZE: + vs.styles[wParam].size = lParam; + break; + case SCI_STYLESETFONT: + if (lParam != 0) { + vs.SetStyleFontName(wParam, CharPtrFromSPtr(lParam)); + } + break; + case SCI_STYLESETUNDERLINE: + vs.styles[wParam].underline = lParam != 0; + break; + case SCI_STYLESETCASE: + vs.styles[wParam].caseForce = static_cast(lParam); + break; + case SCI_STYLESETCHARACTERSET: + vs.styles[wParam].characterSet = lParam; + break; + case SCI_STYLESETVISIBLE: + vs.styles[wParam].visible = lParam != 0; + break; + case SCI_STYLESETCHANGEABLE: + vs.styles[wParam].changeable = lParam != 0; + break; + case SCI_STYLESETHOTSPOT: + vs.styles[wParam].hotspot = lParam != 0; + break; + } + InvalidateStyleRedraw(); +} + +sptr_t Editor::StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { + vs.EnsureStyle(wParam); + switch (iMessage) { + case SCI_STYLEGETFORE: + return vs.styles[wParam].fore.desired.AsLong(); + case SCI_STYLEGETBACK: + return vs.styles[wParam].back.desired.AsLong(); + case SCI_STYLEGETBOLD: + return vs.styles[wParam].bold ? 1 : 0; + case SCI_STYLEGETITALIC: + return vs.styles[wParam].italic ? 1 : 0; + case SCI_STYLEGETEOLFILLED: + return vs.styles[wParam].eolFilled ? 1 : 0; + case SCI_STYLEGETSIZE: + return vs.styles[wParam].size; + case SCI_STYLEGETFONT: + if (lParam != 0) + strcpy(CharPtrFromSPtr(lParam), vs.styles[wParam].fontName); + return strlen(vs.styles[wParam].fontName); + case SCI_STYLEGETUNDERLINE: + return vs.styles[wParam].underline ? 1 : 0; + case SCI_STYLEGETCASE: + return static_cast(vs.styles[wParam].caseForce); + case SCI_STYLEGETCHARACTERSET: + return vs.styles[wParam].characterSet; + case SCI_STYLEGETVISIBLE: + return vs.styles[wParam].visible ? 1 : 0; + case SCI_STYLEGETCHANGEABLE: + return vs.styles[wParam].changeable ? 1 : 0; + case SCI_STYLEGETHOTSPOT: + return vs.styles[wParam].hotspot ? 1 : 0; + } + return 0; +} + +sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { + //Platform::DebugPrintf("S start wnd proc %d %d %d\n",iMessage, wParam, lParam); + + // Optional macro recording hook + if (recordingMacro) + NotifyMacroRecord(iMessage, wParam, lParam); + + switch (iMessage) { + + case SCI_GETTEXT: { + if (lParam == 0) + return pdoc->Length() + 1; + if (wParam == 0) + return 0; + char *ptr = CharPtrFromSPtr(lParam); + unsigned int iChar = 0; + for (; iChar < wParam - 1; iChar++) + ptr[iChar] = pdoc->CharAt(iChar); + ptr[iChar] = '\0'; + return iChar; + } + + case SCI_SETTEXT: { + if (lParam == 0) + return 0; + UndoGroup ug(pdoc); + pdoc->DeleteChars(0, pdoc->Length()); + SetEmptySelection(0); + pdoc->InsertCString(0, CharPtrFromSPtr(lParam)); + return 1; + } + + case SCI_GETTEXTLENGTH: + return pdoc->Length(); + + case SCI_CUT: + Cut(); + SetLastXChosen(); + break; + + case SCI_COPY: + Copy(); + break; + + case SCI_COPYALLOWLINE: + CopyAllowLine(); + break; + + case SCI_COPYRANGE: + CopyRangeToClipboard(wParam, lParam); + break; + + case SCI_COPYTEXT: + CopyText(wParam, CharPtrFromSPtr(lParam)); + break; + + case SCI_PASTE: + Paste(); + if (!caretSticky) { + SetLastXChosen(); + } + EnsureCaretVisible(); + break; + + case SCI_CLEAR: + Clear(); + SetLastXChosen(); + EnsureCaretVisible(); + break; + + case SCI_UNDO: + Undo(); + SetLastXChosen(); + break; + + case SCI_CANUNDO: + return (pdoc->CanUndo() && !pdoc->IsReadOnly()) ? 1 : 0; + + case SCI_EMPTYUNDOBUFFER: + pdoc->DeleteUndoHistory(); + return 0; + + case SCI_GETFIRSTVISIBLELINE: + return topLine; + + case SCI_GETLINE: { // Risk of overwriting the end of the buffer + int lineStart = pdoc->LineStart(wParam); + int lineEnd = pdoc->LineStart(wParam + 1); + if (lParam == 0) { + return lineEnd - lineStart; + } + char *ptr = CharPtrFromSPtr(lParam); + int iPlace = 0; + for (int iChar = lineStart; iChar < lineEnd; iChar++) { + ptr[iPlace++] = pdoc->CharAt(iChar); + } + return iPlace; + } + + case SCI_GETLINECOUNT: + if (pdoc->LinesTotal() == 0) + return 1; + else + return pdoc->LinesTotal(); + + case SCI_GETMODIFY: + return !pdoc->IsSavePoint(); + + case SCI_SETSEL: { + int nStart = static_cast(wParam); + int nEnd = static_cast(lParam); + if (nEnd < 0) + nEnd = pdoc->Length(); + if (nStart < 0) + nStart = nEnd; // Remove selection + sel.selType = Selection::selStream; + SetSelection(nEnd, nStart); + EnsureCaretVisible(); + } + break; + + case SCI_GETSELTEXT: { + SelectionText selectedText; + CopySelectionRange(&selectedText); + if (lParam == 0) { + return selectedText.len + 1; + } else { + char *ptr = CharPtrFromSPtr(lParam); + int iChar = 0; + if (selectedText.len) { + for (; iChar < selectedText.len; iChar++) + ptr[iChar] = selectedText.s[iChar]; + } else { + ptr[0] = '\0'; + } + return iChar; + } + } + + case SCI_LINEFROMPOSITION: + if (static_cast(wParam) < 0) + return 0; + return pdoc->LineFromPosition(wParam); + + case SCI_POSITIONFROMLINE: + if (static_cast(wParam) < 0) + wParam = pdoc->LineFromPosition(SelectionStart().Position()); + if (wParam == 0) + return 0; // Even if there is no text, there is a first line that starts at 0 + if (static_cast(wParam) > pdoc->LinesTotal()) + return -1; + //if (wParam > pdoc->LineFromPosition(pdoc->Length())) // Useful test, anyway... + // return -1; + return pdoc->LineStart(wParam); + + // Replacement of the old Scintilla interpretation of EM_LINELENGTH + case SCI_LINELENGTH: + if ((static_cast(wParam) < 0) || + (static_cast(wParam) > pdoc->LineFromPosition(pdoc->Length()))) + return 0; + return pdoc->LineStart(wParam + 1) - pdoc->LineStart(wParam); + + case SCI_REPLACESEL: { + if (lParam == 0) + return 0; + UndoGroup ug(pdoc); + ClearSelection(); + char *replacement = CharPtrFromSPtr(lParam); + pdoc->InsertCString(sel.MainCaret(), replacement); + SetEmptySelection(sel.MainCaret() + istrlen(replacement)); + EnsureCaretVisible(); + } + break; + + case SCI_SETTARGETSTART: + targetStart = wParam; + break; + + case SCI_GETTARGETSTART: + return targetStart; + + case SCI_SETTARGETEND: + targetEnd = wParam; + break; + + case SCI_GETTARGETEND: + return targetEnd; + + case SCI_TARGETFROMSELECTION: + if (sel.MainCaret() < sel.MainAnchor()) { + targetStart = sel.MainCaret(); + targetEnd = sel.MainAnchor(); + } else { + targetStart = sel.MainAnchor(); + targetEnd = sel.MainCaret(); + } + break; + + case SCI_REPLACETARGET: + PLATFORM_ASSERT(lParam); + return ReplaceTarget(false, CharPtrFromSPtr(lParam), wParam); + + case SCI_REPLACETARGETRE: + PLATFORM_ASSERT(lParam); + return ReplaceTarget(true, CharPtrFromSPtr(lParam), wParam); + + case SCI_SEARCHINTARGET: + PLATFORM_ASSERT(lParam); + return SearchInTarget(CharPtrFromSPtr(lParam), wParam); + + case SCI_SETSEARCHFLAGS: + searchFlags = wParam; + break; + + case SCI_GETSEARCHFLAGS: + return searchFlags; + + case SCI_POSITIONBEFORE: + return pdoc->MovePositionOutsideChar(wParam - 1, -1, true); + + case SCI_POSITIONAFTER: + return pdoc->MovePositionOutsideChar(wParam + 1, 1, true); + + case SCI_LINESCROLL: + ScrollTo(topLine + lParam); + HorizontalScrollTo(xOffset + wParam * vs.spaceWidth); + return 1; + + case SCI_SETXOFFSET: + xOffset = wParam; + SetHorizontalScrollPos(); + Redraw(); + break; + + case SCI_GETXOFFSET: + return xOffset; + + case SCI_CHOOSECARETX: + SetLastXChosen(); + break; + + case SCI_SCROLLCARET: + EnsureCaretVisible(); + break; + + case SCI_SETREADONLY: + pdoc->SetReadOnly(wParam != 0); + return 1; + + case SCI_GETREADONLY: + return pdoc->IsReadOnly(); + + case SCI_CANPASTE: + return CanPaste(); + + case SCI_POINTXFROMPOSITION: + if (lParam < 0) { + return 0; + } else { + Point pt = LocationFromPosition(lParam); + return pt.x; + } + + case SCI_POINTYFROMPOSITION: + if (lParam < 0) { + return 0; + } else { + Point pt = LocationFromPosition(lParam); + return pt.y; + } + + case SCI_FINDTEXT: + return FindText(wParam, lParam); + + case SCI_GETTEXTRANGE: { + if (lParam == 0) + return 0; + Sci_TextRange *tr = reinterpret_cast(lParam); + int cpMax = tr->chrg.cpMax; + if (cpMax == -1) + cpMax = pdoc->Length(); + PLATFORM_ASSERT(cpMax <= pdoc->Length()); + int len = cpMax - tr->chrg.cpMin; // No -1 as cpMin and cpMax are referring to inter character positions + pdoc->GetCharRange(tr->lpstrText, tr->chrg.cpMin, len); + // Spec says copied text is terminated with a NUL + tr->lpstrText[len] = '\0'; + return len; // Not including NUL + } + + case SCI_HIDESELECTION: + hideSelection = wParam != 0; + Redraw(); + break; + + case SCI_FORMATRANGE: + return FormatRange(wParam != 0, reinterpret_cast(lParam)); + + case SCI_GETMARGINLEFT: + return vs.leftMarginWidth; + + case SCI_GETMARGINRIGHT: + return vs.rightMarginWidth; + + case SCI_SETMARGINLEFT: + vs.leftMarginWidth = lParam; + InvalidateStyleRedraw(); + break; + + case SCI_SETMARGINRIGHT: + vs.rightMarginWidth = lParam; + InvalidateStyleRedraw(); + break; + + // Control specific mesages + + case SCI_ADDTEXT: { + if (lParam == 0) + return 0; + pdoc->InsertString(CurrentPosition(), CharPtrFromSPtr(lParam), wParam); + SetEmptySelection(sel.MainCaret() + wParam); + return 0; + } + + case SCI_ADDSTYLEDTEXT: + if (lParam) + AddStyledText(CharPtrFromSPtr(lParam), wParam); + return 0; + + case SCI_INSERTTEXT: { + if (lParam == 0) + return 0; + int insertPos = wParam; + if (static_cast(wParam) == -1) + insertPos = CurrentPosition(); + int newCurrent = CurrentPosition(); + char *sz = CharPtrFromSPtr(lParam); + pdoc->InsertCString(insertPos, sz); + if (newCurrent > insertPos) + newCurrent += istrlen(sz); + SetEmptySelection(newCurrent); + return 0; + } + + case SCI_APPENDTEXT: + pdoc->InsertString(pdoc->Length(), CharPtrFromSPtr(lParam), wParam); + return 0; + + case SCI_CLEARALL: + ClearAll(); + return 0; + + case SCI_CLEARDOCUMENTSTYLE: + ClearDocumentStyle(); + return 0; + + case SCI_SETUNDOCOLLECTION: + pdoc->SetUndoCollection(wParam != 0); + return 0; + + case SCI_GETUNDOCOLLECTION: + return pdoc->IsCollectingUndo(); + + case SCI_BEGINUNDOACTION: + pdoc->BeginUndoAction(); + return 0; + + case SCI_ENDUNDOACTION: + pdoc->EndUndoAction(); + return 0; + + case SCI_GETCARETPERIOD: + return caret.period; + + case SCI_SETCARETPERIOD: + caret.period = wParam; + break; + + case SCI_SETWORDCHARS: { + pdoc->SetDefaultCharClasses(false); + if (lParam == 0) + return 0; + pdoc->SetCharClasses(reinterpret_cast(lParam), CharClassify::ccWord); + } + break; + + case SCI_SETWHITESPACECHARS: { + if (lParam == 0) + return 0; + pdoc->SetCharClasses(reinterpret_cast(lParam), CharClassify::ccSpace); + } + break; + + case SCI_SETCHARSDEFAULT: + pdoc->SetDefaultCharClasses(true); + break; + + case SCI_GETLENGTH: + return pdoc->Length(); + + case SCI_ALLOCATE: + pdoc->Allocate(wParam); + break; + + case SCI_GETCHARAT: + return pdoc->CharAt(wParam); + + case SCI_SETCURRENTPOS: + if (sel.IsRectangular()) { + sel.Rectangular().caret.SetPosition(wParam); + SetRectangularRange(); + Redraw(); + } else { + SetSelection(wParam, sel.MainAnchor()); + } + break; + + case SCI_GETCURRENTPOS: + return sel.IsRectangular() ? sel.Rectangular().caret.Position() : sel.MainCaret(); + + case SCI_SETANCHOR: + if (sel.IsRectangular()) { + sel.Rectangular().anchor.SetPosition(wParam); + SetRectangularRange(); + Redraw(); + } else { + SetSelection(sel.MainCaret(), wParam); + } + break; + + case SCI_GETANCHOR: + return sel.IsRectangular() ? sel.Rectangular().anchor.Position() : sel.MainAnchor(); + + case SCI_SETSELECTIONSTART: + SetSelection(Platform::Maximum(sel.MainCaret(), wParam), wParam); + break; + + case SCI_GETSELECTIONSTART: + return Platform::Minimum(sel.MainAnchor(), sel.MainCaret()); + + case SCI_SETSELECTIONEND: + SetSelection(wParam, Platform::Minimum(sel.MainAnchor(), wParam)); + break; + + case SCI_GETSELECTIONEND: + return Platform::Maximum(sel.MainAnchor(), sel.MainCaret()); + + case SCI_SETPRINTMAGNIFICATION: + printMagnification = wParam; + break; + + case SCI_GETPRINTMAGNIFICATION: + return printMagnification; + + case SCI_SETPRINTCOLOURMODE: + printColourMode = wParam; + break; + + case SCI_GETPRINTCOLOURMODE: + return printColourMode; + + case SCI_SETPRINTWRAPMODE: + printWrapState = (wParam == SC_WRAP_WORD) ? eWrapWord : eWrapNone; + break; + + case SCI_GETPRINTWRAPMODE: + return printWrapState; + + case SCI_GETSTYLEAT: + if (static_cast(wParam) >= pdoc->Length()) + return 0; + else + return pdoc->StyleAt(wParam); + + case SCI_REDO: + Redo(); + break; + + case SCI_SELECTALL: + SelectAll(); + break; + + case SCI_SETSAVEPOINT: + pdoc->SetSavePoint(); + break; + + case SCI_GETSTYLEDTEXT: { + if (lParam == 0) + return 0; + Sci_TextRange *tr = reinterpret_cast(lParam); + int iPlace = 0; + for (int iChar = tr->chrg.cpMin; iChar < tr->chrg.cpMax; iChar++) { + tr->lpstrText[iPlace++] = pdoc->CharAt(iChar); + tr->lpstrText[iPlace++] = pdoc->StyleAt(iChar); + } + tr->lpstrText[iPlace] = '\0'; + tr->lpstrText[iPlace + 1] = '\0'; + return iPlace; + } + + case SCI_CANREDO: + return (pdoc->CanRedo() && !pdoc->IsReadOnly()) ? 1 : 0; + + case SCI_MARKERLINEFROMHANDLE: + return pdoc->LineFromHandle(wParam); + + case SCI_MARKERDELETEHANDLE: + pdoc->DeleteMarkFromHandle(wParam); + break; + + case SCI_GETVIEWWS: + return vs.viewWhitespace; + + case SCI_SETVIEWWS: + vs.viewWhitespace = static_cast(wParam); + Redraw(); + break; + + case SCI_POSITIONFROMPOINT: + return PositionFromLocation(Point(wParam, lParam), false, false); + + case SCI_POSITIONFROMPOINTCLOSE: + return PositionFromLocation(Point(wParam, lParam), true, false); + + case SCI_CHARPOSITIONFROMPOINT: + return PositionFromLocation(Point(wParam, lParam), false, true); + + case SCI_CHARPOSITIONFROMPOINTCLOSE: + return PositionFromLocation(Point(wParam, lParam), true, true); + + case SCI_GOTOLINE: + GoToLine(wParam); + break; + + case SCI_GOTOPOS: + SetEmptySelection(wParam); + EnsureCaretVisible(); + Redraw(); + break; + + case SCI_GETCURLINE: { + int lineCurrentPos = pdoc->LineFromPosition(sel.MainCaret()); + int lineStart = pdoc->LineStart(lineCurrentPos); + unsigned int lineEnd = pdoc->LineStart(lineCurrentPos + 1); + if (lParam == 0) { + return 1 + lineEnd - lineStart; + } + PLATFORM_ASSERT(wParam > 0); + char *ptr = CharPtrFromSPtr(lParam); + unsigned int iPlace = 0; + for (unsigned int iChar = lineStart; iChar < lineEnd && iPlace < wParam - 1; iChar++) { + ptr[iPlace++] = pdoc->CharAt(iChar); + } + ptr[iPlace] = '\0'; + return sel.MainCaret() - lineStart; + } + + case SCI_GETENDSTYLED: + return pdoc->GetEndStyled(); + + case SCI_GETEOLMODE: + return pdoc->eolMode; + + case SCI_SETEOLMODE: + pdoc->eolMode = wParam; + break; + + case SCI_STARTSTYLING: + pdoc->StartStyling(wParam, static_cast(lParam)); + break; + + case SCI_SETSTYLING: + pdoc->SetStyleFor(wParam, static_cast(lParam)); + break; + + case SCI_SETSTYLINGEX: // Specify a complete styling buffer + if (lParam == 0) + return 0; + pdoc->SetStyles(wParam, CharPtrFromSPtr(lParam)); + break; + + case SCI_SETBUFFEREDDRAW: + bufferedDraw = wParam != 0; + break; + + case SCI_GETBUFFEREDDRAW: + return bufferedDraw; + + case SCI_GETTWOPHASEDRAW: + return twoPhaseDraw; + + case SCI_SETTWOPHASEDRAW: + twoPhaseDraw = wParam != 0; + InvalidateStyleRedraw(); + break; + + case SCI_SETTABWIDTH: + if (wParam > 0) { + pdoc->tabInChars = wParam; + if (pdoc->indentInChars == 0) + pdoc->actualIndentInChars = pdoc->tabInChars; + } + InvalidateStyleRedraw(); + break; + + case SCI_GETTABWIDTH: + return pdoc->tabInChars; + + case SCI_SETINDENT: + pdoc->indentInChars = wParam; + if (pdoc->indentInChars != 0) + pdoc->actualIndentInChars = pdoc->indentInChars; + else + pdoc->actualIndentInChars = pdoc->tabInChars; + InvalidateStyleRedraw(); + break; + + case SCI_GETINDENT: + return pdoc->indentInChars; + + case SCI_SETUSETABS: + pdoc->useTabs = wParam != 0; + InvalidateStyleRedraw(); + break; + + case SCI_GETUSETABS: + return pdoc->useTabs; + + case SCI_SETLINEINDENTATION: + pdoc->SetLineIndentation(wParam, lParam); + break; + + case SCI_GETLINEINDENTATION: + return pdoc->GetLineIndentation(wParam); + + case SCI_GETLINEINDENTPOSITION: + return pdoc->GetLineIndentPosition(wParam); + + case SCI_SETTABINDENTS: + pdoc->tabIndents = wParam != 0; + break; + + case SCI_GETTABINDENTS: + return pdoc->tabIndents; + + case SCI_SETBACKSPACEUNINDENTS: + pdoc->backspaceUnindents = wParam != 0; + break; + + case SCI_GETBACKSPACEUNINDENTS: + return pdoc->backspaceUnindents; + + case SCI_SETMOUSEDWELLTIME: + dwellDelay = wParam; + ticksToDwell = dwellDelay; + break; + + case SCI_GETMOUSEDWELLTIME: + return dwellDelay; + + case SCI_WORDSTARTPOSITION: + return pdoc->ExtendWordSelect(wParam, -1, lParam != 0); + + case SCI_WORDENDPOSITION: + return pdoc->ExtendWordSelect(wParam, 1, lParam != 0); + + case SCI_SETWRAPMODE: + switch (wParam) { + case SC_WRAP_WORD: + wrapState = eWrapWord; + break; + case SC_WRAP_CHAR: + wrapState = eWrapChar; + break; + default: + wrapState = eWrapNone; + break; + } + xOffset = 0; + InvalidateStyleRedraw(); + ReconfigureScrollBars(); + break; + + case SCI_GETWRAPMODE: + return wrapState; + + case SCI_SETWRAPVISUALFLAGS: + wrapVisualFlags = wParam; + InvalidateStyleRedraw(); + ReconfigureScrollBars(); + break; + + case SCI_GETWRAPVISUALFLAGS: + return wrapVisualFlags; + + case SCI_SETWRAPVISUALFLAGSLOCATION: + wrapVisualFlagsLocation = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_GETWRAPVISUALFLAGSLOCATION: + return wrapVisualFlagsLocation; + + case SCI_SETWRAPSTARTINDENT: + wrapVisualStartIndent = wParam; + InvalidateStyleRedraw(); + ReconfigureScrollBars(); + break; + + case SCI_GETWRAPSTARTINDENT: + return wrapVisualStartIndent; + + case SCI_SETWRAPINDENTMODE: + wrapIndentMode = wParam; + InvalidateStyleRedraw(); + ReconfigureScrollBars(); + break; + + case SCI_GETWRAPINDENTMODE: + return wrapIndentMode; + + case SCI_SETLAYOUTCACHE: + llc.SetLevel(wParam); + break; + + case SCI_GETLAYOUTCACHE: + return llc.GetLevel(); + + case SCI_SETPOSITIONCACHE: + posCache.SetSize(wParam); + break; + + case SCI_GETPOSITIONCACHE: + return posCache.GetSize(); + + case SCI_SETSCROLLWIDTH: + PLATFORM_ASSERT(wParam > 0); + if ((wParam > 0) && (wParam != static_cast(scrollWidth))) { + lineWidthMaxSeen = 0; + scrollWidth = wParam; + SetScrollBars(); + } + break; + + case SCI_GETSCROLLWIDTH: + return scrollWidth; + + case SCI_SETSCROLLWIDTHTRACKING: + trackLineWidth = wParam != 0; + break; + + case SCI_GETSCROLLWIDTHTRACKING: + return trackLineWidth; + + case SCI_LINESJOIN: + LinesJoin(); + break; + + case SCI_LINESSPLIT: + LinesSplit(wParam); + break; + + case SCI_TEXTWIDTH: + PLATFORM_ASSERT(wParam < vs.stylesSize); + PLATFORM_ASSERT(lParam); + return TextWidth(wParam, CharPtrFromSPtr(lParam)); + + case SCI_TEXTHEIGHT: + return vs.lineHeight; + + case SCI_SETENDATLASTLINE: + PLATFORM_ASSERT((wParam == 0) || (wParam == 1)); + if (endAtLastLine != (wParam != 0)) { + endAtLastLine = wParam != 0; + SetScrollBars(); + } + break; + + case SCI_GETENDATLASTLINE: + return endAtLastLine; + + case SCI_SETCARETSTICKY: + PLATFORM_ASSERT((wParam == 0) || (wParam == 1)); + if (caretSticky != (wParam != 0)) { + caretSticky = wParam != 0; + } + break; + + case SCI_GETCARETSTICKY: + return caretSticky; + + case SCI_TOGGLECARETSTICKY: + caretSticky = !caretSticky; + break; + + case SCI_GETCOLUMN: + return pdoc->GetColumn(wParam); + + case SCI_FINDCOLUMN: + return pdoc->FindColumn(wParam, lParam); + + case SCI_SETHSCROLLBAR : + if (horizontalScrollBarVisible != (wParam != 0)) { + horizontalScrollBarVisible = wParam != 0; + SetScrollBars(); + ReconfigureScrollBars(); + } + break; + + case SCI_GETHSCROLLBAR: + return horizontalScrollBarVisible; + + case SCI_SETVSCROLLBAR: + if (verticalScrollBarVisible != (wParam != 0)) { + verticalScrollBarVisible = wParam != 0; + SetScrollBars(); + ReconfigureScrollBars(); + } + break; + + case SCI_GETVSCROLLBAR: + return verticalScrollBarVisible; + + case SCI_SETINDENTATIONGUIDES: + vs.viewIndentationGuides = IndentView(wParam); + Redraw(); + break; + + case SCI_GETINDENTATIONGUIDES: + return vs.viewIndentationGuides; + + case SCI_SETHIGHLIGHTGUIDE: + if ((highlightGuideColumn != static_cast(wParam)) || (wParam > 0)) { + highlightGuideColumn = wParam; + Redraw(); + } + break; + + case SCI_GETHIGHLIGHTGUIDE: + return highlightGuideColumn; + + case SCI_GETLINEENDPOSITION: + return pdoc->LineEnd(wParam); + + case SCI_SETCODEPAGE: + if (ValidCodePage(wParam)) { + pdoc->dbcsCodePage = wParam; + InvalidateStyleRedraw(); + } + break; + + case SCI_GETCODEPAGE: + return pdoc->dbcsCodePage; + + case SCI_SETUSEPALETTE: + palette.allowRealization = wParam != 0; + InvalidateStyleRedraw(); + break; + + case SCI_GETUSEPALETTE: + return palette.allowRealization; + + // Marker definition and setting + case SCI_MARKERDEFINE: + if (wParam <= MARKER_MAX) + vs.markers[wParam].markType = lParam; + InvalidateStyleData(); + RedrawSelMargin(); + break; + + case SCI_MARKERSYMBOLDEFINED: + if (wParam <= MARKER_MAX) + return vs.markers[wParam].markType; + else + return 0; + + case SCI_MARKERSETFORE: + if (wParam <= MARKER_MAX) + vs.markers[wParam].fore.desired = ColourDesired(lParam); + InvalidateStyleData(); + RedrawSelMargin(); + break; + case SCI_MARKERSETBACK: + if (wParam <= MARKER_MAX) + vs.markers[wParam].back.desired = ColourDesired(lParam); + InvalidateStyleData(); + RedrawSelMargin(); + break; + case SCI_MARKERSETALPHA: + if (wParam <= MARKER_MAX) + vs.markers[wParam].alpha = lParam; + InvalidateStyleRedraw(); + break; + case SCI_MARKERADD: { + int markerID = pdoc->AddMark(wParam, lParam); + return markerID; + } + case SCI_MARKERADDSET: + if (lParam != 0) + pdoc->AddMarkSet(wParam, lParam); + break; + + case SCI_MARKERDELETE: + pdoc->DeleteMark(wParam, lParam); + break; + + case SCI_MARKERDELETEALL: + pdoc->DeleteAllMarks(static_cast(wParam)); + break; + + case SCI_MARKERGET: + return pdoc->GetMark(wParam); + + case SCI_MARKERNEXT: { + int lt = pdoc->LinesTotal(); + for (int iLine = wParam; iLine < lt; iLine++) { + if ((pdoc->GetMark(iLine) & lParam) != 0) + return iLine; + } + } + return -1; + + case SCI_MARKERPREVIOUS: { + for (int iLine = wParam; iLine >= 0; iLine--) { + if ((pdoc->GetMark(iLine) & lParam) != 0) + return iLine; + } + } + return -1; + + case SCI_MARKERDEFINEPIXMAP: + if (wParam <= MARKER_MAX) { + vs.markers[wParam].SetXPM(CharPtrFromSPtr(lParam)); + }; + InvalidateStyleData(); + RedrawSelMargin(); + break; + + case SCI_SETMARGINTYPEN: + if (ValidMargin(wParam)) { + vs.ms[wParam].style = lParam; + InvalidateStyleRedraw(); + } + break; + + case SCI_GETMARGINTYPEN: + if (ValidMargin(wParam)) + return vs.ms[wParam].style; + else + return 0; + + case SCI_SETMARGINWIDTHN: + if (ValidMargin(wParam)) { + // Short-circuit if the width is unchanged, to avoid unnecessary redraw. + if (vs.ms[wParam].width != lParam) { + vs.ms[wParam].width = lParam; + InvalidateStyleRedraw(); + } + } + break; + + case SCI_GETMARGINWIDTHN: + if (ValidMargin(wParam)) + return vs.ms[wParam].width; + else + return 0; + + case SCI_SETMARGINMASKN: + if (ValidMargin(wParam)) { + vs.ms[wParam].mask = lParam; + InvalidateStyleRedraw(); + } + break; + + case SCI_GETMARGINMASKN: + if (ValidMargin(wParam)) + return vs.ms[wParam].mask; + else + return 0; + + case SCI_SETMARGINSENSITIVEN: + if (ValidMargin(wParam)) { + vs.ms[wParam].sensitive = lParam != 0; + InvalidateStyleRedraw(); + } + break; + + case SCI_GETMARGINSENSITIVEN: + if (ValidMargin(wParam)) + return vs.ms[wParam].sensitive ? 1 : 0; + else + return 0; + + case SCI_STYLECLEARALL: + vs.ClearStyles(); + InvalidateStyleRedraw(); + break; + + case SCI_STYLESETFORE: + case SCI_STYLESETBACK: + case SCI_STYLESETBOLD: + case SCI_STYLESETITALIC: + case SCI_STYLESETEOLFILLED: + case SCI_STYLESETSIZE: + case SCI_STYLESETFONT: + case SCI_STYLESETUNDERLINE: + case SCI_STYLESETCASE: + case SCI_STYLESETCHARACTERSET: + case SCI_STYLESETVISIBLE: + case SCI_STYLESETCHANGEABLE: + case SCI_STYLESETHOTSPOT: + StyleSetMessage(iMessage, wParam, lParam); + break; + + case SCI_STYLEGETFORE: + case SCI_STYLEGETBACK: + case SCI_STYLEGETBOLD: + case SCI_STYLEGETITALIC: + case SCI_STYLEGETEOLFILLED: + case SCI_STYLEGETSIZE: + case SCI_STYLEGETFONT: + case SCI_STYLEGETUNDERLINE: + case SCI_STYLEGETCASE: + case SCI_STYLEGETCHARACTERSET: + case SCI_STYLEGETVISIBLE: + case SCI_STYLEGETCHANGEABLE: + case SCI_STYLEGETHOTSPOT: + return StyleGetMessage(iMessage, wParam, lParam); + + case SCI_STYLERESETDEFAULT: + vs.ResetDefaultStyle(); + InvalidateStyleRedraw(); + break; + case SCI_SETSTYLEBITS: + vs.EnsureStyle((1 << wParam) - 1); + pdoc->SetStylingBits(wParam); + break; + + case SCI_GETSTYLEBITS: + return pdoc->stylingBits; + + case SCI_SETLINESTATE: + return pdoc->SetLineState(wParam, lParam); + + case SCI_GETLINESTATE: + return pdoc->GetLineState(wParam); + + case SCI_GETMAXLINESTATE: + return pdoc->GetMaxLineState(); + + case SCI_GETCARETLINEVISIBLE: + return vs.showCaretLineBackground; + case SCI_SETCARETLINEVISIBLE: + vs.showCaretLineBackground = wParam != 0; + InvalidateStyleRedraw(); + break; + case SCI_GETCARETLINEBACK: + return vs.caretLineBackground.desired.AsLong(); + case SCI_SETCARETLINEBACK: + vs.caretLineBackground.desired = wParam; + InvalidateStyleRedraw(); + break; + case SCI_GETCARETLINEBACKALPHA: + return vs.caretLineAlpha; + case SCI_SETCARETLINEBACKALPHA: + vs.caretLineAlpha = wParam; + InvalidateStyleRedraw(); + break; + + // Folding messages + + case SCI_VISIBLEFROMDOCLINE: + return cs.DisplayFromDoc(wParam); + + case SCI_DOCLINEFROMVISIBLE: + return cs.DocFromDisplay(wParam); + + case SCI_WRAPCOUNT: + return WrapCount(wParam); + + case SCI_SETFOLDLEVEL: { + int prev = pdoc->SetLevel(wParam, lParam); + if (prev != lParam) + RedrawSelMargin(); + return prev; + } + + case SCI_GETFOLDLEVEL: + return pdoc->GetLevel(wParam); + + case SCI_GETLASTCHILD: + return pdoc->GetLastChild(wParam, lParam); + + case SCI_GETFOLDPARENT: + return pdoc->GetFoldParent(wParam); + + case SCI_SHOWLINES: + cs.SetVisible(wParam, lParam, true); + SetScrollBars(); + Redraw(); + break; + + case SCI_HIDELINES: + if (wParam > 0) + cs.SetVisible(wParam, lParam, false); + SetScrollBars(); + Redraw(); + break; + + case SCI_GETLINEVISIBLE: + return cs.GetVisible(wParam); + + case SCI_SETFOLDEXPANDED: + if (cs.SetExpanded(wParam, lParam != 0)) { + RedrawSelMargin(); + } + break; + + case SCI_GETFOLDEXPANDED: + return cs.GetExpanded(wParam); + + case SCI_SETFOLDFLAGS: + foldFlags = wParam; + Redraw(); + break; + + case SCI_TOGGLEFOLD: + ToggleContraction(wParam); + break; + + case SCI_ENSUREVISIBLE: + EnsureLineVisible(wParam, false); + break; + + case SCI_ENSUREVISIBLEENFORCEPOLICY: + EnsureLineVisible(wParam, true); + break; + + case SCI_SEARCHANCHOR: + SearchAnchor(); + break; + + case SCI_SEARCHNEXT: + case SCI_SEARCHPREV: + return SearchText(iMessage, wParam, lParam); + + case SCI_SETXCARETPOLICY: + caretXPolicy = wParam; + caretXSlop = lParam; + break; + + case SCI_SETYCARETPOLICY: + caretYPolicy = wParam; + caretYSlop = lParam; + break; + + case SCI_SETVISIBLEPOLICY: + visiblePolicy = wParam; + visibleSlop = lParam; + break; + + case SCI_LINESONSCREEN: + return LinesOnScreen(); + + case SCI_SETSELFORE: + vs.selforeset = wParam != 0; + vs.selforeground.desired = ColourDesired(lParam); + vs.selAdditionalForeground.desired = ColourDesired(lParam); + InvalidateStyleRedraw(); + break; + + case SCI_SETSELBACK: + vs.selbackset = wParam != 0; + vs.selbackground.desired = ColourDesired(lParam); + vs.selAdditionalBackground.desired = ColourDesired(lParam); + InvalidateStyleRedraw(); + break; + + case SCI_SETSELALPHA: + vs.selAlpha = wParam; + vs.selAdditionalAlpha = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_GETSELALPHA: + return vs.selAlpha; + + case SCI_GETSELEOLFILLED: + return vs.selEOLFilled; + + case SCI_SETSELEOLFILLED: + vs.selEOLFilled = wParam != 0; + InvalidateStyleRedraw(); + break; + + case SCI_SETWHITESPACEFORE: + vs.whitespaceForegroundSet = wParam != 0; + vs.whitespaceForeground.desired = ColourDesired(lParam); + InvalidateStyleRedraw(); + break; + + case SCI_SETWHITESPACEBACK: + vs.whitespaceBackgroundSet = wParam != 0; + vs.whitespaceBackground.desired = ColourDesired(lParam); + InvalidateStyleRedraw(); + break; + + case SCI_SETCARETFORE: + vs.caretcolour.desired = ColourDesired(wParam); + InvalidateStyleRedraw(); + break; + + case SCI_GETCARETFORE: + return vs.caretcolour.desired.AsLong(); + + case SCI_SETCARETSTYLE: + if (wParam >= CARETSTYLE_INVISIBLE && wParam <= CARETSTYLE_BLOCK) + vs.caretStyle = wParam; + else + /* Default to the line caret */ + vs.caretStyle = CARETSTYLE_LINE; + InvalidateStyleRedraw(); + break; + + case SCI_GETCARETSTYLE: + return vs.caretStyle; + + case SCI_SETCARETWIDTH: + if (wParam <= 0) + vs.caretWidth = 0; + else if (wParam >= 3) + vs.caretWidth = 3; + else + vs.caretWidth = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_GETCARETWIDTH: + return vs.caretWidth; + + case SCI_ASSIGNCMDKEY: + kmap.AssignCmdKey(Platform::LowShortFromLong(wParam), + Platform::HighShortFromLong(wParam), lParam); + break; + + case SCI_CLEARCMDKEY: + kmap.AssignCmdKey(Platform::LowShortFromLong(wParam), + Platform::HighShortFromLong(wParam), SCI_NULL); + break; + + case SCI_CLEARALLCMDKEYS: + kmap.Clear(); + break; + + case SCI_INDICSETSTYLE: + if (wParam <= INDIC_MAX) { + vs.indicators[wParam].style = lParam; + InvalidateStyleRedraw(); + } + break; + + case SCI_INDICGETSTYLE: + return (wParam <= INDIC_MAX) ? vs.indicators[wParam].style : 0; + + case SCI_INDICSETFORE: + if (wParam <= INDIC_MAX) { + vs.indicators[wParam].fore.desired = ColourDesired(lParam); + InvalidateStyleRedraw(); + } + break; + + case SCI_INDICGETFORE: + return (wParam <= INDIC_MAX) ? vs.indicators[wParam].fore.desired.AsLong() : 0; + + case SCI_INDICSETUNDER: + if (wParam <= INDIC_MAX) { + vs.indicators[wParam].under = lParam != 0; + InvalidateStyleRedraw(); + } + break; + + case SCI_INDICGETUNDER: + return (wParam <= INDIC_MAX) ? vs.indicators[wParam].under : 0; + + case SCI_INDICSETALPHA: + if (wParam <= INDIC_MAX && lParam >=0 && lParam <= 100) { + vs.indicators[wParam].fillAlpha = lParam; + InvalidateStyleRedraw(); + } + break; + + case SCI_INDICGETALPHA: + return (wParam <= INDIC_MAX) ? vs.indicators[wParam].fillAlpha : 0; + + case SCI_SETINDICATORCURRENT: + pdoc->decorations.SetCurrentIndicator(wParam); + break; + case SCI_GETINDICATORCURRENT: + return pdoc->decorations.GetCurrentIndicator(); + case SCI_SETINDICATORVALUE: + pdoc->decorations.SetCurrentValue(wParam); + break; + case SCI_GETINDICATORVALUE: + return pdoc->decorations.GetCurrentValue(); + + case SCI_INDICATORFILLRANGE: + pdoc->DecorationFillRange(wParam, pdoc->decorations.GetCurrentValue(), lParam); + break; + + case SCI_INDICATORCLEARRANGE: + pdoc->DecorationFillRange(wParam, 0, lParam); + break; + + case SCI_INDICATORALLONFOR: + return pdoc->decorations.AllOnFor(wParam); + + case SCI_INDICATORVALUEAT: + return pdoc->decorations.ValueAt(wParam, lParam); + + case SCI_INDICATORSTART: + return pdoc->decorations.Start(wParam, lParam); + + case SCI_INDICATOREND: + return pdoc->decorations.End(wParam, lParam); + + case SCI_LINEDOWN: + case SCI_LINEDOWNEXTEND: + case SCI_PARADOWN: + case SCI_PARADOWNEXTEND: + case SCI_LINEUP: + case SCI_LINEUPEXTEND: + case SCI_PARAUP: + case SCI_PARAUPEXTEND: + case SCI_CHARLEFT: + case SCI_CHARLEFTEXTEND: + case SCI_CHARRIGHT: + case SCI_CHARRIGHTEXTEND: + case SCI_WORDLEFT: + case SCI_WORDLEFTEXTEND: + case SCI_WORDRIGHT: + case SCI_WORDRIGHTEXTEND: + case SCI_WORDLEFTEND: + case SCI_WORDLEFTENDEXTEND: + case SCI_WORDRIGHTEND: + case SCI_WORDRIGHTENDEXTEND: + case SCI_HOME: + case SCI_HOMEEXTEND: + case SCI_LINEEND: + case SCI_LINEENDEXTEND: + case SCI_HOMEWRAP: + case SCI_HOMEWRAPEXTEND: + case SCI_LINEENDWRAP: + case SCI_LINEENDWRAPEXTEND: + case SCI_DOCUMENTSTART: + case SCI_DOCUMENTSTARTEXTEND: + case SCI_DOCUMENTEND: + case SCI_DOCUMENTENDEXTEND: + + case SCI_STUTTEREDPAGEUP: + case SCI_STUTTEREDPAGEUPEXTEND: + case SCI_STUTTEREDPAGEDOWN: + case SCI_STUTTEREDPAGEDOWNEXTEND: + + case SCI_PAGEUP: + case SCI_PAGEUPEXTEND: + case SCI_PAGEDOWN: + case SCI_PAGEDOWNEXTEND: + case SCI_EDITTOGGLEOVERTYPE: + case SCI_CANCEL: + case SCI_DELETEBACK: + case SCI_TAB: + case SCI_BACKTAB: + case SCI_NEWLINE: + case SCI_FORMFEED: + case SCI_VCHOME: + case SCI_VCHOMEEXTEND: + case SCI_VCHOMEWRAP: + case SCI_VCHOMEWRAPEXTEND: + case SCI_ZOOMIN: + case SCI_ZOOMOUT: + case SCI_DELWORDLEFT: + case SCI_DELWORDRIGHT: + case SCI_DELWORDRIGHTEND: + case SCI_DELLINELEFT: + case SCI_DELLINERIGHT: + case SCI_LINECOPY: + case SCI_LINECUT: + case SCI_LINEDELETE: + case SCI_LINETRANSPOSE: + case SCI_LINEDUPLICATE: + case SCI_LOWERCASE: + case SCI_UPPERCASE: + case SCI_LINESCROLLDOWN: + case SCI_LINESCROLLUP: + case SCI_WORDPARTLEFT: + case SCI_WORDPARTLEFTEXTEND: + case SCI_WORDPARTRIGHT: + case SCI_WORDPARTRIGHTEXTEND: + case SCI_DELETEBACKNOTLINE: + case SCI_HOMEDISPLAY: + case SCI_HOMEDISPLAYEXTEND: + case SCI_LINEENDDISPLAY: + case SCI_LINEENDDISPLAYEXTEND: + case SCI_LINEDOWNRECTEXTEND: + case SCI_LINEUPRECTEXTEND: + case SCI_CHARLEFTRECTEXTEND: + case SCI_CHARRIGHTRECTEXTEND: + case SCI_HOMERECTEXTEND: + case SCI_VCHOMERECTEXTEND: + case SCI_LINEENDRECTEXTEND: + case SCI_PAGEUPRECTEXTEND: + case SCI_PAGEDOWNRECTEXTEND: + case SCI_SELECTIONDUPLICATE: + return KeyCommand(iMessage); + + case SCI_BRACEHIGHLIGHT: + SetBraceHighlight(static_cast(wParam), lParam, STYLE_BRACELIGHT); + break; + + case SCI_BRACEBADLIGHT: + SetBraceHighlight(static_cast(wParam), -1, STYLE_BRACEBAD); + break; + + case SCI_BRACEMATCH: + // wParam is position of char to find brace for, + // lParam is maximum amount of text to restyle to find it + return pdoc->BraceMatch(wParam, lParam); + + case SCI_GETVIEWEOL: + return vs.viewEOL; + + case SCI_SETVIEWEOL: + vs.viewEOL = wParam != 0; + InvalidateStyleRedraw(); + break; + + case SCI_SETZOOM: + vs.zoomLevel = wParam; + InvalidateStyleRedraw(); + NotifyZoom(); + break; + + case SCI_GETZOOM: + return vs.zoomLevel; + + case SCI_GETEDGECOLUMN: + return theEdge; + + case SCI_SETEDGECOLUMN: + theEdge = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_GETEDGEMODE: + return vs.edgeState; + + case SCI_SETEDGEMODE: + vs.edgeState = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_GETEDGECOLOUR: + return vs.edgecolour.desired.AsLong(); + + case SCI_SETEDGECOLOUR: + vs.edgecolour.desired = ColourDesired(wParam); + InvalidateStyleRedraw(); + break; + + case SCI_GETDOCPOINTER: + return reinterpret_cast(pdoc); + + case SCI_SETDOCPOINTER: + CancelModes(); + SetDocPointer(reinterpret_cast(lParam)); + return 0; + + case SCI_CREATEDOCUMENT: { + Document *doc = new Document(); + if (doc) { + doc->AddRef(); + } + return reinterpret_cast(doc); + } + + case SCI_ADDREFDOCUMENT: + (reinterpret_cast(lParam))->AddRef(); + break; + + case SCI_RELEASEDOCUMENT: + (reinterpret_cast(lParam))->Release(); + break; + + case SCI_SETMODEVENTMASK: + modEventMask = wParam; + return 0; + + case SCI_GETMODEVENTMASK: + return modEventMask; + + case SCI_CONVERTEOLS: + pdoc->ConvertLineEnds(wParam); + SetSelection(sel.MainCaret(), sel.MainAnchor()); // Ensure selection inside document + return 0; + + case SCI_SETLENGTHFORENCODE: + lengthForEncode = wParam; + return 0; + + case SCI_SELECTIONISRECTANGLE: + return sel.selType == Selection::selRectangle ? 1 : 0; + + case SCI_SETSELECTIONMODE: { + switch (wParam) { + case SC_SEL_STREAM: + sel.SetMoveExtends(!sel.MoveExtends() || (sel.selType != Selection::selStream)); + sel.selType = Selection::selStream; + break; + case SC_SEL_RECTANGLE: + sel.SetMoveExtends(!sel.MoveExtends() || (sel.selType != Selection::selRectangle)); + sel.selType = Selection::selRectangle; + break; + case SC_SEL_LINES: + sel.SetMoveExtends(!sel.MoveExtends() || (sel.selType != Selection::selLines)); + sel.selType = Selection::selLines; + break; + case SC_SEL_THIN: + sel.SetMoveExtends(!sel.MoveExtends() || (sel.selType != Selection::selThin)); + sel.selType = Selection::selThin; + break; + default: + sel.SetMoveExtends(!sel.MoveExtends() || (sel.selType != Selection::selStream)); + sel.selType = Selection::selStream; + } + InvalidateSelection(sel.RangeMain(), true); + } + case SCI_GETSELECTIONMODE: + switch (sel.selType) { + case Selection::selStream: + return SC_SEL_STREAM; + case Selection::selRectangle: + return SC_SEL_RECTANGLE; + case Selection::selLines: + return SC_SEL_LINES; + case Selection::selThin: + return SC_SEL_THIN; + default: // ?! + return SC_SEL_STREAM; + } + case SCI_GETLINESELSTARTPOSITION: + case SCI_GETLINESELENDPOSITION: { + SelectionSegment segmentLine(SelectionPosition(pdoc->LineStart(wParam)), + SelectionPosition(pdoc->LineEnd(wParam))); + for (size_t r=0; r(pdoc->BufferPointer()); + + case SCI_SETEXTRAASCENT: + vs.extraAscent = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_GETEXTRAASCENT: + return vs.extraAscent; + + case SCI_SETEXTRADESCENT: + vs.extraDescent = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_GETEXTRADESCENT: + return vs.extraDescent; + + case SCI_MARGINSETSTYLEOFFSET: + vs.marginStyleOffset = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_MARGINGETSTYLEOFFSET: + return vs.marginStyleOffset; + + case SCI_MARGINSETTEXT: + pdoc->MarginSetText(wParam, CharPtrFromSPtr(lParam)); + break; + + case SCI_MARGINGETTEXT: { + const StyledText st = pdoc->MarginStyledText(wParam); + if (lParam) { + if (st.text) + memcpy(CharPtrFromSPtr(lParam), st.text, st.length); + else + strcpy(CharPtrFromSPtr(lParam), ""); + } + return st.length; + } + + case SCI_MARGINSETSTYLE: + pdoc->MarginSetStyle(wParam, lParam); + break; + + case SCI_MARGINGETSTYLE: { + const StyledText st = pdoc->MarginStyledText(wParam); + return st.style; + } + + case SCI_MARGINSETSTYLES: + pdoc->MarginSetStyles(wParam, reinterpret_cast(lParam)); + break; + + case SCI_MARGINGETSTYLES: { + const StyledText st = pdoc->MarginStyledText(wParam); + if (lParam) { + if (st.styles) + memcpy(CharPtrFromSPtr(lParam), st.styles, st.length); + else + strcpy(CharPtrFromSPtr(lParam), ""); + } + return st.styles ? st.length : 0; + } + + case SCI_MARGINTEXTCLEARALL: + pdoc->MarginClearAll(); + break; + + case SCI_ANNOTATIONSETTEXT: + pdoc->AnnotationSetText(wParam, CharPtrFromSPtr(lParam)); + break; + + case SCI_ANNOTATIONGETTEXT: { + const StyledText st = pdoc->AnnotationStyledText(wParam); + if (lParam) { + if (st.text) + memcpy(CharPtrFromSPtr(lParam), st.text, st.length); + else + strcpy(CharPtrFromSPtr(lParam), ""); + } + return st.length; + } + + case SCI_ANNOTATIONGETSTYLE: { + const StyledText st = pdoc->AnnotationStyledText(wParam); + return st.style; + } + + case SCI_ANNOTATIONSETSTYLE: + pdoc->AnnotationSetStyle(wParam, lParam); + break; + + case SCI_ANNOTATIONSETSTYLES: + pdoc->AnnotationSetStyles(wParam, reinterpret_cast(lParam)); + break; + + case SCI_ANNOTATIONGETSTYLES: { + const StyledText st = pdoc->AnnotationStyledText(wParam); + if (lParam) { + if (st.styles) + memcpy(CharPtrFromSPtr(lParam), st.styles, st.length); + else + strcpy(CharPtrFromSPtr(lParam), ""); + } + return st.styles ? st.length : 0; + } + + case SCI_ANNOTATIONGETLINES: + return pdoc->AnnotationLines(wParam); + + case SCI_ANNOTATIONCLEARALL: + pdoc->AnnotationClearAll(); + break; + + case SCI_ANNOTATIONSETVISIBLE: + SetAnnotationVisible(wParam); + break; + + case SCI_ANNOTATIONGETVISIBLE: + return vs.annotationVisible; + + case SCI_ANNOTATIONSETSTYLEOFFSET: + vs.annotationStyleOffset = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_ANNOTATIONGETSTYLEOFFSET: + return vs.annotationStyleOffset; + + case SCI_ADDUNDOACTION: + pdoc->AddUndoAction(wParam, lParam & UNDO_MAY_COALESCE); + break; + + case SCI_SETMULTIPLESELECTION: + multipleSelection = wParam != 0; + InvalidateCaret(); + break; + + case SCI_GETMULTIPLESELECTION: + return multipleSelection; + + case SCI_SETADDITIONALSELECTIONTYPING: + additionalSelectionTyping = wParam != 0; + InvalidateCaret(); + break; + + case SCI_GETADDITIONALSELECTIONTYPING: + return additionalSelectionTyping; + + case SCI_SETADDITIONALCARETSBLINK: + additionalCaretsBlink = wParam != 0; + InvalidateCaret(); + break; + + case SCI_GETADDITIONALCARETSBLINK: + return additionalCaretsBlink; + + case SCI_GETSELECTIONS: + return sel.Count(); + + case SCI_CLEARSELECTIONS: + sel.Clear(); + Redraw(); + break; + + case SCI_SETSELECTION: + sel.SetSelection(SelectionRange(wParam, lParam)); + Redraw(); + break; + + case SCI_ADDSELECTION: + sel.AddSelection(SelectionRange(wParam, lParam)); + Redraw(); + break; + + case SCI_SETMAINSELECTION: + sel.SetMain(wParam); + Redraw(); + break; + + case SCI_GETMAINSELECTION: + return sel.Main(); + + case SCI_SETSELECTIONNCARET: + sel.Range(wParam).caret.SetPosition(lParam); + Redraw(); + break; + + case SCI_GETSELECTIONNCARET: + return sel.Range(wParam).caret.Position(); + + case SCI_SETSELECTIONNANCHOR: + sel.Range(wParam).anchor.SetPosition(lParam); + Redraw(); + break; + case SCI_GETSELECTIONNANCHOR: + return sel.Range(wParam).anchor.Position(); + + case SCI_SETSELECTIONNCARETVIRTUALSPACE: + sel.Range(wParam).caret.SetVirtualSpace(lParam); + Redraw(); + break; + + case SCI_GETSELECTIONNCARETVIRTUALSPACE: + return sel.Range(wParam).caret.VirtualSpace(); + + case SCI_SETSELECTIONNANCHORVIRTUALSPACE: + sel.Range(wParam).anchor.SetVirtualSpace(lParam); + Redraw(); + break; + + case SCI_GETSELECTIONNANCHORVIRTUALSPACE: + return sel.Range(wParam).anchor.VirtualSpace(); + + case SCI_SETSELECTIONNSTART: + sel.Range(wParam).anchor.SetPosition(lParam); + Redraw(); + break; + + case SCI_GETSELECTIONNSTART: + return sel.Range(wParam).Start().Position(); + + case SCI_SETSELECTIONNEND: + sel.Range(wParam).caret.SetPosition(lParam); + Redraw(); + break; + + case SCI_GETSELECTIONNEND: + return sel.Range(wParam).End().Position(); + + case SCI_SETRECTANGULARSELECTIONCARET: + if (!sel.IsRectangular()) + sel.Clear(); + sel.selType = Selection::selRectangle; + sel.Rectangular().caret.SetPosition(wParam); + SetRectangularRange(); + Redraw(); + break; + + case SCI_GETRECTANGULARSELECTIONCARET: + return sel.Rectangular().caret.Position(); + + case SCI_SETRECTANGULARSELECTIONANCHOR: + if (!sel.IsRectangular()) + sel.Clear(); + sel.selType = Selection::selRectangle; + sel.Rectangular().anchor.SetPosition(wParam); + SetRectangularRange(); + Redraw(); + break; + + case SCI_GETRECTANGULARSELECTIONANCHOR: + return sel.Rectangular().anchor.Position(); + + case SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE: + if (!sel.IsRectangular()) + sel.Clear(); + sel.selType = Selection::selRectangle; + sel.Rectangular().caret.SetVirtualSpace(wParam); + SetRectangularRange(); + Redraw(); + break; + + case SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE: + return sel.Rectangular().caret.VirtualSpace(); + + case SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE: + if (!sel.IsRectangular()) + sel.Clear(); + sel.selType = Selection::selRectangle; + sel.Rectangular().anchor.SetVirtualSpace(wParam); + SetRectangularRange(); + Redraw(); + break; + + case SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE: + return sel.Rectangular().anchor.VirtualSpace(); + + case SCI_SETVIRTUALSPACEOPTIONS: + virtualSpaceOptions = wParam; + break; + + case SCI_GETVIRTUALSPACEOPTIONS: + return virtualSpaceOptions; + + case SCI_SETADDITIONALSELFORE: + vs.selAdditionalForeground.desired = ColourDesired(wParam); + InvalidateStyleRedraw(); + break; + + case SCI_SETADDITIONALSELBACK: + vs.selAdditionalBackground.desired = ColourDesired(wParam); + InvalidateStyleRedraw(); + break; + + case SCI_SETADDITIONALSELALPHA: + vs.selAdditionalAlpha = wParam; + InvalidateStyleRedraw(); + break; + + case SCI_GETADDITIONALSELALPHA: + return vs.selAdditionalAlpha; + + case SCI_SETADDITIONALCARETFORE: + vs.additionalCaretColour.desired = ColourDesired(wParam); + InvalidateStyleRedraw(); + break; + + case SCI_GETADDITIONALCARETFORE: + return vs.additionalCaretColour.desired.AsLong(); + + case SCI_ROTATESELECTION: + sel.RotateMain(); + InvalidateSelection(sel.RangeMain(), true); + break; + + case SCI_SWAPMAINANCHORCARET: + InvalidateSelection(sel.RangeMain()); + sel.RangeMain() = SelectionRange(sel.RangeMain().anchor, sel.RangeMain().caret); + break; + + default: + return DefWndProc(iMessage, wParam, lParam); + } + //Platform::DebugPrintf("end wnd proc\n"); + return 0l; +} diff --git a/sdk/wxscintilla/src/scintilla/src/Editor.h b/sdk/wxscintilla/src/scintilla/src/Editor.h index a6ceec0099..8f1ca9b7c3 100644 --- a/sdk/wxscintilla/src/scintilla/src/Editor.h +++ b/sdk/wxscintilla/src/scintilla/src/Editor.h @@ -1,522 +1,541 @@ -// Scintilla source code edit control -/** @file Editor.h - ** Defines the main editor class. - **/ -// Copyright 1998-2003 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef EDITOR_H -#define EDITOR_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -/** - */ -class Caret { -public: - bool active; - bool on; - int period; - - Caret(); -}; - -/** - */ -class Timer { -public: - bool ticking; - int ticksToWait; - enum {tickSize = 100}; - TickerID tickerID; - - Timer(); -}; - -/** - */ -class Idler { -public: - bool state; - IdlerID idlerID; - - Idler(); -}; - -/** - * Hold a piece of text selected for copying or dragging. - * The text is expected to hold a terminating '\0' and this is counted in len. - */ -class SelectionText { -public: - char *s; - int len; - bool rectangular; - bool lineCopy; - int codePage; - int characterSet; - SelectionText() : s(0), len(0), rectangular(false), lineCopy(false), codePage(0), characterSet(0) {} - ~SelectionText() { - Free(); - } - void Free() { - Set(0, 0, 0, 0, false, false); - } - void Set(char *s_, int len_, int codePage_, int characterSet_, bool rectangular_, bool lineCopy_) { - delete []s; - s = s_; - if (s) - len = len_; - else - len = 0; - codePage = codePage_; - characterSet = characterSet_; - rectangular = rectangular_; - lineCopy = lineCopy_; - } - void Copy(const char *s_, int len_, int codePage_, int characterSet_, bool rectangular_, bool lineCopy_) { - delete []s; - s = new char[len_]; - if (s) { - len = len_; - for (int i = 0; i < len_; i++) { - s[i] = s_[i]; - } - } else { - len = 0; - } - codePage = codePage_; - characterSet = characterSet_; - rectangular = rectangular_; - lineCopy = lineCopy_; - } - void Copy(const SelectionText &other) { - Copy(other.s, other.len, other.codePage, other.characterSet, other.rectangular, other.lineCopy); - } -}; - -/** - */ -class Editor : public DocWatcher { - // Private so Editor objects can not be copied - Editor(const Editor &) : DocWatcher() {} - Editor &operator=(const Editor &) { return *this; } - -protected: // ScintillaBase subclass needs access to much of Editor - - /** On GTK+, Scintilla is a container widget holding two scroll bars - * whereas on Windows there is just one window with both scroll bars turned on. */ - Window wMain; ///< The Scintilla parent window - - /** Style resources may be expensive to allocate so are cached between uses. - * When a style attribute is changed, this cache is flushed. */ - bool stylesValid; - ViewStyle vs; - Palette palette; - - int printMagnification; - int printColourMode; - int printWrapState; - int cursorMode; - int controlCharSymbol; - - bool hasFocus; - bool hideSelection; - bool inOverstrike; - int errorStatus; - bool mouseDownCaptures; - - /** In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to - * the screen. This avoids flashing but is about 30% slower. */ - bool bufferedDraw; - /** In twoPhaseDraw mode, drawing is performed in two phases, first the background - * and then the foreground. This avoids chopping off characters that overlap the next run. */ - bool twoPhaseDraw; - - int xOffset; ///< Horizontal scrolled amount in pixels - int xCaretMargin; ///< Ensure this many pixels visible on both sides of caret - bool horizontalScrollBarVisible; - int scrollWidth; - bool trackLineWidth; - int lineWidthMaxSeen; - bool verticalScrollBarVisible; - bool endAtLastLine; - bool caretSticky; - - Surface *pixmapLine; - Surface *pixmapSelMargin; - Surface *pixmapSelPattern; - Surface *pixmapIndentGuide; - Surface *pixmapIndentGuideHighlight; - - LineLayoutCache llc; - PositionCache posCache; - - KeyMap kmap; - - Caret caret; - Timer timer; - Timer autoScrollTimer; - enum { autoScrollDelay = 200 }; - - Idler idler; - - Point lastClick; - unsigned int lastClickTime; - int dwellDelay; - int ticksToDwell; - bool dwelling; - enum { selChar, selWord, selLine } selectionType; - Point ptMouseLast; - enum { ddNone, ddInitial, ddDragging } inDragDrop; - bool dropWentOutside; - int posDrag; - int posDrop; - int lastXChosen; - int lineAnchor; - int originalAnchorPos; - int currentPos; - int anchor; - int targetStart; - int targetEnd; - int searchFlags; - int topLine; - int posTopLine; - int lengthForEncode; - - bool needUpdateUI; - Position braces[2]; - int bracesMatchStyle; - int highlightGuideColumn; - - int theEdge; - - enum { notPainting, painting, paintAbandoned } paintState; - PRectangle rcPaint; - bool paintingAllText; - - int modEventMask; - - SelectionText drag; - enum selTypes { noSel, selStream, selRectangle, selLines }; - selTypes selType; - bool moveExtendsSelection; - int xStartSelect; ///< x position of start of rectangular selection - int xEndSelect; ///< x position of end of rectangular selection - bool primarySelection; - - int caretXPolicy; - int caretXSlop; ///< Ensure this many pixels visible on both sides of caret - - int caretYPolicy; - int caretYSlop; ///< Ensure this many lines visible on both sides of caret - - int visiblePolicy; - int visibleSlop; - - int searchAnchor; - - bool recordingMacro; - - int foldFlags; - ContractionState cs; - - // Hotspot support - int hsStart; - int hsEnd; - - // Wrapping support - enum { eWrapNone, eWrapWord, eWrapChar } wrapState; - enum { wrapLineLarge = 0x7ffffff }; - int wrapWidth; - int wrapStart; - int wrapEnd; - int wrapVisualFlags; - int wrapVisualFlagsLocation; - int wrapVisualStartIndent; - int actualWrapVisualStartIndent; - - bool convertPastes; - - Document *pdoc; - - Editor(); - virtual ~Editor(); - virtual void Initialise() = 0; - virtual void Finalise(); - - void InvalidateStyleData(); - void InvalidateStyleRedraw(); - virtual void RefreshColourPalette(Palette &pal, bool want); - void RefreshStyleData(); - void DropGraphics(); - - virtual PRectangle GetClientRectangle(); - PRectangle GetTextRectangle(); - - int LinesOnScreen(); - int LinesToScroll(); - int MaxScrollPos(); - Point LocationFromPosition(int pos); - int XFromPosition(int pos); - int PositionFromLocation(Point pt); - int PositionFromLocationClose(Point pt); - int PositionFromLineX(int line, int x); - int LineFromLocation(Point pt); - void SetTopLine(int topLineNew); - - bool AbandonPaint(); - void RedrawRect(PRectangle rc); - void Redraw(); - void RedrawSelMargin(int line=-1); - PRectangle RectangleFromRange(int start, int end); - void InvalidateRange(int start, int end); - - int CurrentPosition(); - bool SelectionEmpty(); - int SelectionStart(); - int SelectionEnd(); - void SetRectangularRange(); - void InvalidateSelection(int currentPos_, int anchor_, bool invalidateWholeSelection); - void SetSelection(int currentPos_, int anchor_); - void SetSelection(int currentPos_); - void SetEmptySelection(int currentPos_); - bool RangeContainsProtected(int start, int end) const; - bool SelectionContainsProtected(); - int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true); - int MovePositionTo(int newPos, selTypes sel=noSel, bool ensureVisible=true); - int MovePositionSoVisible(int pos, int moveDir); - void SetLastXChosen(); - - void ScrollTo(int line, bool moveThumb=true); - virtual void ScrollText(int linesToMove); - void HorizontalScrollTo(int xPos); - void MoveCaretInsideView(bool ensureVisible=true); - int DisplayFromPosition(int pos); - void EnsureCaretVisible(bool useMargin=true, bool vert=true, bool horiz=true); - void ShowCaretAtCurrentPosition(); - void DropCaret(); - void InvalidateCaret(); - virtual void UpdateSystemCaret(); - - void NeedWrapping(int docLineStart = 0, int docLineEnd = wrapLineLarge); - bool WrapOneLine(Surface *surface, int lineToWrap); - bool WrapLines(bool fullWrap, int priorityWrapLineStart); - void LinesJoin(); - void LinesSplit(int pixelWidth); - - int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault); - void PaintSelMargin(Surface *surface, PRectangle &rc); - LineLayout *RetrieveLineLayout(int lineNumber); - void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll, - int width=LineLayout::wrapWidthInfinite); - ColourAllocated SelectionBackground(ViewStyle &vsDraw); - ColourAllocated TextBackground(ViewStyle &vsDraw, bool overrideBackground, ColourAllocated background, bool inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll); - void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight); - void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourAllocated wrapColour); - void DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll, - int line, int lineEnd, int xStart, int subLine, int subLineStart, - bool overrideBackground, ColourAllocated background, - bool drawWrapMark, ColourAllocated wrapColour); - void DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int xStart, - PRectangle rcLine, LineLayout *ll, int subLine, int lineEnd, bool under); - void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart, - PRectangle rcLine, LineLayout *ll, int subLine=0); - void DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine, int xStart, int offset, int posCaret, PRectangle rcCaret); - void RefreshPixMaps(Surface *surfaceWindow); - void Paint(Surface *surfaceWindow, PRectangle rcArea); - long FormatRange(bool draw, RangeToFormat *pfr); - int TextWidth(int style, const char *text); - - virtual void SetVerticalScrollPos() = 0; - virtual void SetHorizontalScrollPos() = 0; - virtual bool ModifyScrollBars(int nMax, int nPage) = 0; - virtual void ReconfigureScrollBars(); - void SetScrollBars(); - void ChangeSize(); - - void AddChar(char ch); - virtual void AddCharUTF(char *s, unsigned int len, bool treatAsDBCS=false); - void ClearSelection(); - void ClearAll(); - void ClearDocumentStyle(); - void Cut(); - void PasteRectangular(int pos, const char *ptr, int len); - virtual void Copy() = 0; - virtual void CopyAllowLine(); - virtual bool CanPaste(); - virtual void Paste() = 0; - void Clear(); - void SelectAll(); - void Undo(); - void Redo(); - void DelChar(); - void DelCharBack(bool allowLineStartDeletion); - virtual void ClaimSelection() = 0; - - virtual void NotifyChange() = 0; - virtual void NotifyFocus(bool focus); - virtual int GetCtrlID() { return ctrlID; } - virtual void NotifyParent(SCNotification scn) = 0; - virtual void NotifyStyleToNeeded(int endStyleNeeded); - void NotifyChar(int ch); - void NotifyMove(int position); - void NotifySavePoint(bool isSavePoint); - void NotifyModifyAttempt(); - virtual void NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt); - void NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt); - void NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt); - void NotifyUpdateUI(); - void NotifyPainted(); - void NotifyIndicatorClick(bool click, int position, bool shift, bool ctrl, bool alt); - bool NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt); - void NotifyNeedShown(int pos, int len); - void NotifyDwelling(Point pt, bool state); - void NotifyZoom(); - - void NotifyModifyAttempt(Document *document, void *userData); - void NotifySavePoint(Document *document, void *userData, bool atSavePoint); - void CheckModificationForWrap(DocModification mh); - void NotifyModified(Document *document, DocModification mh, void *userData); - void NotifyDeleted(Document *document, void *userData); - void NotifyStyleNeeded(Document *doc, void *userData, int endPos); - void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - - void PageMove(int direction, selTypes sel=noSel, bool stuttered = false); - void ChangeCaseOfSelection(bool makeUpperCase); - void LineTranspose(); - void Duplicate(bool forLine); - virtual void CancelModes(); - void NewLine(); - void CursorUpOrDown(int direction, selTypes sel=noSel); - void ParaUpOrDown(int direction, selTypes sel=noSel); - int StartEndDisplayLine(int pos, bool start); - virtual int KeyCommand(unsigned int iMessage); - virtual int KeyDefault(int /* key */, int /*modifiers*/); - int KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed=0); - - int GetWhitespaceVisible(); - void SetWhitespaceVisible(int view); - - void Indent(bool forwards); - - long FindText(uptr_t wParam, sptr_t lParam); - void SearchAnchor(); - long SearchText(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - long SearchInTarget(const char *text, int length); - void GoToLine(int lineNo); - - virtual void CopyToClipboard(const SelectionText &selectedText) = 0; - char *CopyRange(int start, int end); - void CopySelectionFromRange(SelectionText *ss, bool allowLineCopy, int start, int end); - void CopySelectionRange(SelectionText *ss, bool allowLineCopy=false); - void CopyRangeToClipboard(int start, int end); - void CopyText(int length, const char *text); - void SetDragPosition(int newPos); - virtual void DisplayCursor(Window::Cursor c); - virtual bool DragThreshold(Point ptStart, Point ptNow); - virtual void StartDrag(); - void DropAt(int position, const char *value, bool moving, bool rectangular); - /** PositionInSelection returns 0 if position in selection, -1 if position before selection, and 1 if after. - * Before means either before any line of selection or before selection on its line, with a similar meaning to after. */ - int PositionInSelection(int pos); - bool PointInSelection(Point pt); - bool PointInSelMargin(Point pt); - void LineSelection(int lineCurrent_, int lineAnchor_); - void DwellEnd(bool mouseMoved); - virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt); - void ButtonMove(Point pt); - void ButtonUp(Point pt, unsigned int curTime, bool ctrl); - - void Tick(); - bool Idle(); - virtual void SetTicking(bool on) = 0; - virtual bool SetIdle(bool) { return false; } - virtual void SetMouseCapture(bool on) = 0; - virtual bool HaveMouseCapture() = 0; - void SetFocusState(bool focusState); - - virtual bool PaintContains(PRectangle rc); - bool PaintContainsMargin(); - void CheckForChangeOutsidePaint(Range r); - void SetBraceHighlight(Position pos0, Position pos1, int matchStyle); - - void SetDocPointer(Document *document); - - void Expand(int &line, bool doExpand); - void ToggleContraction(int line); - void EnsureLineVisible(int lineDoc, bool enforcePolicy); - int ReplaceTarget(bool replacePatterns, const char *text, int length=-1); - - bool PositionIsHotspot(int position); - bool PointIsHotspot(Point pt); - void SetHotSpotRange(Point *pt); - void GetHotSpotRange(int& hsStart, int& hsEnd); - - int CodePage() const; - virtual bool ValidCodePage(int /* codePage */) const { return true; } - int WrapCount(int line); - void AddStyledText(char *buffer, int appendLength); - - virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0; - void StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - sptr_t StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - - static const char *StringFromEOLMode(int eolMode); - -public: - // Public so the COM thunks can access it. - bool IsUnicodeMode() const; - // Public so scintilla_send_message can use it. - virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); - // Public so scintilla_set_id can use it. - int ctrlID; - friend class AutoSurface; - friend class SelectionLineIterator; -}; - -/** - * A smart pointer class to ensure Surfaces are set up and deleted correctly. - */ -class AutoSurface { -private: - Surface *surf; -public: - AutoSurface(Editor *ed) : surf(0) { - if (ed->wMain.GetID()) { - surf = Surface::Allocate(); - if (surf) { - surf->Init(ed->wMain.GetID()); - surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage()); - surf->SetDBCSMode(ed->CodePage()); - } - } - } - AutoSurface(SurfaceID sid, Editor *ed) : surf(0) { - if (ed->wMain.GetID()) { - surf = Surface::Allocate(); - if (surf) { - surf->Init(sid, ed->wMain.GetID()); - surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage()); - surf->SetDBCSMode(ed->CodePage()); - } - } - } - ~AutoSurface() { - delete surf; - } - Surface *operator->() const { - return surf; - } - operator Surface *() const { - return surf; - } -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif +// Scintilla source code edit control +/** @file Editor.h + ** Defines the main editor class. + **/ +// Copyright 1998-2003 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef EDITOR_H +#define EDITOR_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +/** + */ +class Caret { +public: + bool active; + bool on; + int period; + + Caret(); +}; + +/** + */ +class Timer { +public: + bool ticking; + int ticksToWait; + enum {tickSize = 100}; + TickerID tickerID; + + Timer(); +}; + +/** + */ +class Idler { +public: + bool state; + IdlerID idlerID; + + Idler(); +}; + +/** + * Hold a piece of text selected for copying or dragging. + * The text is expected to hold a terminating '\0' and this is counted in len. + */ +class SelectionText { +public: + char *s; + int len; + bool rectangular; + bool lineCopy; + int codePage; + int characterSet; + SelectionText() : s(0), len(0), rectangular(false), lineCopy(false), codePage(0), characterSet(0) {} + ~SelectionText() { + Free(); + } + void Free() { + Set(0, 0, 0, 0, false, false); + } + void Set(char *s_, int len_, int codePage_, int characterSet_, bool rectangular_, bool lineCopy_) { + delete []s; + s = s_; + if (s) + len = len_; + else + len = 0; + codePage = codePage_; + characterSet = characterSet_; + rectangular = rectangular_; + lineCopy = lineCopy_; + } + void Copy(const char *s_, int len_, int codePage_, int characterSet_, bool rectangular_, bool lineCopy_) { + delete []s; + s = 0; + s = new char[len_]; + len = len_; + for (int i = 0; i < len_; i++) { + s[i] = s_[i]; + } + codePage = codePage_; + characterSet = characterSet_; + rectangular = rectangular_; + lineCopy = lineCopy_; + } + void Copy(const SelectionText &other) { + Copy(other.s, other.len, other.codePage, other.characterSet, other.rectangular, other.lineCopy); + } +}; + +/** + */ +class Editor : public DocWatcher { + // Private so Editor objects can not be copied + Editor(const Editor &) : DocWatcher() {} + Editor &operator=(const Editor &) { return *this; } + +protected: // ScintillaBase subclass needs access to much of Editor + + /** On GTK+, Scintilla is a container widget holding two scroll bars + * whereas on Windows there is just one window with both scroll bars turned on. */ + Window wMain; ///< The Scintilla parent window + + /** Style resources may be expensive to allocate so are cached between uses. + * When a style attribute is changed, this cache is flushed. */ + bool stylesValid; + ViewStyle vs; + Palette palette; + + int printMagnification; + int printColourMode; + int printWrapState; + int cursorMode; + int controlCharSymbol; + + bool hasFocus; + bool hideSelection; + bool inOverstrike; + bool mouseDownCaptures; + + /** In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to + * the screen. This avoids flashing but is about 30% slower. */ + bool bufferedDraw; + /** In twoPhaseDraw mode, drawing is performed in two phases, first the background + * and then the foreground. This avoids chopping off characters that overlap the next run. */ + bool twoPhaseDraw; + + int xOffset; ///< Horizontal scrolled amount in pixels + int xCaretMargin; ///< Ensure this many pixels visible on both sides of caret + bool horizontalScrollBarVisible; + int scrollWidth; + bool trackLineWidth; + int lineWidthMaxSeen; + bool verticalScrollBarVisible; + bool endAtLastLine; + bool caretSticky; + bool multipleSelection; + bool additionalSelectionTyping; + bool additionalCaretsBlink; + + int virtualSpaceOptions; + + Surface *pixmapLine; + Surface *pixmapSelMargin; + Surface *pixmapSelPattern; + Surface *pixmapIndentGuide; + Surface *pixmapIndentGuideHighlight; + + LineLayoutCache llc; + PositionCache posCache; + + KeyMap kmap; + + Caret caret; + Timer timer; + Timer autoScrollTimer; + enum { autoScrollDelay = 200 }; + + Idler idler; + + Point lastClick; + unsigned int lastClickTime; + int dwellDelay; + int ticksToDwell; + bool dwelling; + enum { selChar, selWord, selLine } selectionType; + Point ptMouseLast; + enum { ddNone, ddInitial, ddDragging } inDragDrop; + bool dropWentOutside; + SelectionPosition posDrag; + SelectionPosition posDrop; + int lastXChosen; + int lineAnchor; + int originalAnchorPos; + int targetStart; + int targetEnd; + int searchFlags; + int topLine; + int posTopLine; + int lengthForEncode; + + bool needUpdateUI; + Position braces[2]; + int bracesMatchStyle; + int highlightGuideColumn; + + int theEdge; + + enum { notPainting, painting, paintAbandoned } paintState; + PRectangle rcPaint; + bool paintingAllText; + + int modEventMask; + + SelectionText drag; + Selection sel; + bool primarySelection; + + int caretXPolicy; + int caretXSlop; ///< Ensure this many pixels visible on both sides of caret + + int caretYPolicy; + int caretYSlop; ///< Ensure this many lines visible on both sides of caret + + int visiblePolicy; + int visibleSlop; + + int searchAnchor; + + bool recordingMacro; + + int foldFlags; + ContractionState cs; + + // Hotspot support + int hsStart; + int hsEnd; + + // Wrapping support + enum { eWrapNone, eWrapWord, eWrapChar } wrapState; + enum { wrapLineLarge = 0x7ffffff }; + int wrapWidth; + int wrapStart; + int wrapEnd; + int wrapVisualFlags; + int wrapVisualFlagsLocation; + int wrapVisualStartIndent; + int wrapAddIndent; // This will be added to initial indent of line + int wrapIndentMode; // SC_WRAPINDENT_FIXED, _SAME, _INDENT + + bool convertPastes; + + Document *pdoc; + + Editor(); + virtual ~Editor(); + virtual void Initialise() = 0; + virtual void Finalise(); + + void InvalidateStyleData(); + void InvalidateStyleRedraw(); + virtual void RefreshColourPalette(Palette &pal, bool want); + void RefreshStyleData(); + void DropGraphics(); + + virtual PRectangle GetClientRectangle(); + PRectangle GetTextRectangle(); + + int LinesOnScreen(); + int LinesToScroll(); + int MaxScrollPos(); + SelectionPosition ClampPositionIntoDocument(SelectionPosition sp) const; + Point LocationFromPosition(SelectionPosition pos); + Point LocationFromPosition(int pos); + int XFromPosition(int pos); + int XFromPosition(SelectionPosition sp); + SelectionPosition SPositionFromLocation(Point pt, bool canReturnInvalid=false, bool charPosition=false, bool virtualSpace=true); + int PositionFromLocation(Point pt, bool canReturnInvalid=false, bool charPosition=false); + SelectionPosition SPositionFromLineX(int lineDoc, int x); + int PositionFromLineX(int line, int x); + int LineFromLocation(Point pt); + void SetTopLine(int topLineNew); + + bool AbandonPaint(); + void RedrawRect(PRectangle rc); + void Redraw(); + void RedrawSelMargin(int line=-1); + PRectangle RectangleFromRange(int start, int end); + void InvalidateRange(int start, int end); + + bool UserVirtualSpace() const { + return ((virtualSpaceOptions & SCVS_USERACCESSIBLE) != 0); + } + int CurrentPosition(); + bool SelectionEmpty(); + SelectionPosition SelectionStart(); + SelectionPosition SelectionEnd(); + void SetRectangularRange(); + void InvalidateSelection(SelectionRange newMain, bool invalidateWholeSelection=false); + void SetSelection(SelectionPosition currentPos_, SelectionPosition anchor_); + void SetSelection(int currentPos_, int anchor_); + void SetSelection(SelectionPosition currentPos_); + void SetSelection(int currentPos_); + void SetEmptySelection(SelectionPosition currentPos_); + void SetEmptySelection(int currentPos_); + bool RangeContainsProtected(int start, int end) const; + bool SelectionContainsProtected(); + int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true) const; + SelectionPosition MovePositionOutsideChar(SelectionPosition pos, int moveDir, bool checkLineEnd=true) const; + int MovePositionTo(SelectionPosition newPos, Selection::selTypes sel=Selection::noSel, bool ensureVisible=true); + int MovePositionTo(int newPos, Selection::selTypes sel=Selection::noSel, bool ensureVisible=true); + SelectionPosition MovePositionSoVisible(SelectionPosition pos, int moveDir); + SelectionPosition MovePositionSoVisible(int pos, int moveDir); + Point PointMainCaret(); + void SetLastXChosen(); + + void ScrollTo(int line, bool moveThumb=true); + virtual void ScrollText(int linesToMove); + void HorizontalScrollTo(int xPos); + void MoveCaretInsideView(bool ensureVisible=true); + int DisplayFromPosition(int pos); + void EnsureCaretVisible(bool useMargin=true, bool vert=true, bool horiz=true); + void ShowCaretAtCurrentPosition(); + void DropCaret(); + void InvalidateCaret(); + virtual void UpdateSystemCaret(); + + void NeedWrapping(int docLineStart = 0, int docLineEnd = wrapLineLarge); + bool WrapOneLine(Surface *surface, int lineToWrap); + bool WrapLines(bool fullWrap, int priorityWrapLineStart); + void LinesJoin(); + void LinesSplit(int pixelWidth); + + int SubstituteMarkerIfEmpty(int markerCheck, int markerDefault); + void PaintSelMargin(Surface *surface, PRectangle &rc); + LineLayout *RetrieveLineLayout(int lineNumber); + void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll, + int width=LineLayout::wrapWidthInfinite); + ColourAllocated SelectionBackground(ViewStyle &vsDraw, bool main); + ColourAllocated TextBackground(ViewStyle &vsDraw, bool overrideBackground, ColourAllocated background, int inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll); + void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight); + void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourAllocated wrapColour); + void DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll, + int line, int lineEnd, int xStart, int subLine, int subLineStart, + bool overrideBackground, ColourAllocated background, + bool drawWrapMark, ColourAllocated wrapColour); + void DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int xStart, + PRectangle rcLine, LineLayout *ll, int subLine, int lineEnd, bool under); + void DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int xStart, + PRectangle rcLine, LineLayout *ll, int subLine); + void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart, + PRectangle rcLine, LineLayout *ll, int subLine); + void DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine, + int xStart, int offset, int posCaret, PRectangle rcCaret, ColourAllocated caretColour); + void DrawCarets(Surface *surface, ViewStyle &vsDraw, int line, int xStart, + PRectangle rcLine, LineLayout *ll, int subLine); + void RefreshPixMaps(Surface *surfaceWindow); + void Paint(Surface *surfaceWindow, PRectangle rcArea); + long FormatRange(bool draw, Sci_RangeToFormat *pfr); + int TextWidth(int style, const char *text); + + virtual void SetVerticalScrollPos() = 0; + virtual void SetHorizontalScrollPos() = 0; + virtual bool ModifyScrollBars(int nMax, int nPage) = 0; + virtual void ReconfigureScrollBars(); + void SetScrollBars(); + void ChangeSize(); + + void FilterSelections(); + int InsertSpace(int position, unsigned int spaces); + void AddChar(char ch); + virtual void AddCharUTF(char *s, unsigned int len, bool treatAsDBCS=false); + void ClearSelection(); + void ClearAll(); + void ClearDocumentStyle(); + void Cut(); + void PasteRectangular(SelectionPosition pos, const char *ptr, int len); + virtual void Copy() = 0; + virtual void CopyAllowLine(); + virtual bool CanPaste(); + virtual void Paste() = 0; + void Clear(); + void SelectAll(); + void Undo(); + void Redo(); + void DelChar(); + void DelCharBack(bool allowLineStartDeletion); + virtual void ClaimSelection() = 0; + + virtual void NotifyChange() = 0; + virtual void NotifyFocus(bool focus); + virtual int GetCtrlID() { return ctrlID; } + virtual void NotifyParent(SCNotification scn) = 0; + virtual void NotifyStyleToNeeded(int endStyleNeeded); + void NotifyChar(int ch); + void NotifySavePoint(bool isSavePoint); + void NotifyModifyAttempt(); + virtual void NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt); + void NotifyHotSpotClicked(int position, bool shift, bool ctrl, bool alt); + void NotifyHotSpotDoubleClicked(int position, bool shift, bool ctrl, bool alt); + void NotifyUpdateUI(); + void NotifyPainted(); + void NotifyIndicatorClick(bool click, int position, bool shift, bool ctrl, bool alt); + bool NotifyMarginClick(Point pt, bool shift, bool ctrl, bool alt); + void NotifyNeedShown(int pos, int len); + void NotifyDwelling(Point pt, bool state); + void NotifyZoom(); + + void NotifyModifyAttempt(Document *document, void *userData); + void NotifySavePoint(Document *document, void *userData, bool atSavePoint); + void CheckModificationForWrap(DocModification mh); + void NotifyModified(Document *document, DocModification mh, void *userData); + void NotifyDeleted(Document *document, void *userData); + void NotifyStyleNeeded(Document *doc, void *userData, int endPos); + void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam); + + void PageMove(int direction, Selection::selTypes sel=Selection::noSel, bool stuttered = false); + void ChangeCaseOfSelection(bool makeUpperCase); + void LineTranspose(); + void Duplicate(bool forLine); + virtual void CancelModes(); + void NewLine(); + void CursorUpOrDown(int direction, Selection::selTypes sel=Selection::noSel); + void ParaUpOrDown(int direction, Selection::selTypes sel=Selection::noSel); + int StartEndDisplayLine(int pos, bool start); + virtual int KeyCommand(unsigned int iMessage); + virtual int KeyDefault(int /* key */, int /*modifiers*/); + int KeyDown(int key, bool shift, bool ctrl, bool alt, bool *consumed=0); + + int GetWhitespaceVisible(); + void SetWhitespaceVisible(int view); + + void Indent(bool forwards); + + long FindText(uptr_t wParam, sptr_t lParam); + void SearchAnchor(); + long SearchText(unsigned int iMessage, uptr_t wParam, sptr_t lParam); + long SearchInTarget(const char *text, int length); + void GoToLine(int lineNo); + + virtual void CopyToClipboard(const SelectionText &selectedText) = 0; + char *CopyRange(int start, int end); + void CopySelectionRange(SelectionText *ss, bool allowLineCopy=false); + void CopyRangeToClipboard(int start, int end); + void CopyText(int length, const char *text); + void SetDragPosition(SelectionPosition newPos); + virtual void DisplayCursor(Window::Cursor c); + virtual bool DragThreshold(Point ptStart, Point ptNow); + virtual void StartDrag(); + void DropAt(SelectionPosition position, const char *value, bool moving, bool rectangular); + /** PositionInSelection returns true if position in selection. */ + bool PositionInSelection(int pos); + bool PointInSelection(Point pt); + bool PointInSelMargin(Point pt); + void LineSelection(int lineCurrent_, int lineAnchor_); + void DwellEnd(bool mouseMoved); + virtual void ButtonDown(Point pt, unsigned int curTime, bool shift, bool ctrl, bool alt); + void ButtonMove(Point pt); + void ButtonUp(Point pt, unsigned int curTime, bool ctrl); + + void Tick(); + bool Idle(); + virtual void SetTicking(bool on) = 0; + virtual bool SetIdle(bool) { return false; } + virtual void SetMouseCapture(bool on) = 0; + virtual bool HaveMouseCapture() = 0; + void SetFocusState(bool focusState); + + virtual bool PaintContains(PRectangle rc); + bool PaintContainsMargin(); + void CheckForChangeOutsidePaint(Range r); + void SetBraceHighlight(Position pos0, Position pos1, int matchStyle); + + void SetAnnotationHeights(int start, int end); + void SetDocPointer(Document *document); + + void SetAnnotationVisible(int visible); + + void Expand(int &line, bool doExpand); + void ToggleContraction(int line); + void EnsureLineVisible(int lineDoc, bool enforcePolicy); + int ReplaceTarget(bool replacePatterns, const char *text, int length=-1); + + bool PositionIsHotspot(int position); + bool PointIsHotspot(Point pt); + void SetHotSpotRange(Point *pt); + void GetHotSpotRange(int& hsStart, int& hsEnd); + + int CodePage() const; + virtual bool ValidCodePage(int /* codePage */) const { return true; } + int WrapCount(int line); + void AddStyledText(char *buffer, int appendLength); + + virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0; + void StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); + sptr_t StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); + + static const char *StringFromEOLMode(int eolMode); + +public: + // Public so the COM thunks can access it. + bool IsUnicodeMode() const; + // Public so scintilla_send_message can use it. + virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); + // Public so scintilla_set_id can use it. + int ctrlID; + // Public so COM methods for drag and drop can set it. + int errorStatus; + friend class AutoSurface; + friend class SelectionLineIterator; +}; + +/** + * A smart pointer class to ensure Surfaces are set up and deleted correctly. + */ +class AutoSurface { +private: + Surface *surf; +public: + AutoSurface(Editor *ed) : surf(0) { + if (ed->wMain.GetID()) { + surf = Surface::Allocate(); + if (surf) { + surf->Init(ed->wMain.GetID()); + surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage()); + surf->SetDBCSMode(ed->CodePage()); + } + } + } + AutoSurface(SurfaceID sid, Editor *ed) : surf(0) { + if (ed->wMain.GetID()) { + surf = Surface::Allocate(); + if (surf) { + surf->Init(sid, ed->wMain.GetID()); + surf->SetUnicodeMode(SC_CP_UTF8 == ed->CodePage()); + surf->SetDBCSMode(ed->CodePage()); + } + } + } + ~AutoSurface() { + delete surf; + } + Surface *operator->() const { + return surf; + } + operator Surface *() const { + return surf; + } +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/sdk/wxscintilla/src/scintilla/src/ExternalLexer.cxx b/sdk/wxscintilla/src/scintilla/src/ExternalLexer.cxx index c0fad149c3..098df4dd5b 100644 --- a/sdk/wxscintilla/src/scintilla/src/ExternalLexer.cxx +++ b/sdk/wxscintilla/src/scintilla/src/ExternalLexer.cxx @@ -1,263 +1,265 @@ -// Scintilla source code edit control -/** @file ExternalLexer.cxx - ** Support external lexers in DLLs. - **/ -// Copyright 2001 Simon Steele , portions copyright Neil Hodgson. -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include - -#include "Platform.h" - -#include "Scintilla.h" - -#include "SciLexer.h" -#include "PropSet.h" -#include "Accessor.h" -#include "DocumentAccessor.h" -#include "KeyWords.h" -#include "ExternalLexer.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -LexerManager *LexerManager::theInstance = NULL; - -//------------------------------------------ -// -// ExternalLexerModule -// -//------------------------------------------ - -char **WordListsToStrings(WordList *val[]) { - int dim = 0; - while (val[dim]) - dim++; - char **wls = new char * [dim + 1]; - for (int i = 0;i < dim;i++) { - SString words; - words = ""; - for (int n = 0; n < val[i]->len; n++) { - words += val[i]->words[n]; - if (n != val[i]->len - 1) - words += " "; - } - wls[i] = new char[words.length() + 1]; - strcpy(wls[i], words.c_str()); - } - wls[dim] = 0; - return wls; -} - -void DeleteWLStrings(char *strs[]) { - int dim = 0; - while (strs[dim]) { - delete strs[dim]; - dim++; - } - delete [] strs; -} - -void ExternalLexerModule::Lex(unsigned int startPos, int lengthDoc, int initStyle, - WordList *keywordlists[], Accessor &styler) const { - if (!fneLexer) - return ; - - char **kwds = WordListsToStrings(keywordlists); - char *ps = styler.GetProperties(); - - // The accessor passed in is always a DocumentAccessor so this cast and the subsequent - // access will work. Can not use the stricter dynamic_cast as that requires RTTI. - DocumentAccessor &da = static_cast(styler); - WindowID wID = da.GetWindow(); - - fneLexer(externalLanguage, startPos, lengthDoc, initStyle, kwds, wID, ps); - - delete ps; - DeleteWLStrings(kwds); -} - -void ExternalLexerModule::Fold(unsigned int startPos, int lengthDoc, int initStyle, - WordList *keywordlists[], Accessor &styler) const { - if (!fneFolder) - return ; - - char **kwds = WordListsToStrings(keywordlists); - char *ps = styler.GetProperties(); - - // The accessor passed in is always a DocumentAccessor so this cast and the subsequent - // access will work. Can not use the stricter dynamic_cast as that requires RTTI. - DocumentAccessor &da = static_cast(styler); - WindowID wID = da.GetWindow(); - - fneFolder(externalLanguage, startPos, lengthDoc, initStyle, kwds, wID, ps); - - delete ps; - DeleteWLStrings(kwds); -} - -void ExternalLexerModule::SetExternal(ExtLexerFunction fLexer, ExtFoldFunction fFolder, int index) { - fneLexer = fLexer; - fneFolder = fFolder; - externalLanguage = index; -} - -//------------------------------------------ -// -// LexerLibrary -// -//------------------------------------------ - -LexerLibrary::LexerLibrary(const char* ModuleName) { - // Initialise some members... - first = NULL; - last = NULL; - - // Load the DLL - lib = DynamicLibrary::Load(ModuleName); - if (lib->IsValid()) { - m_sModuleName = ModuleName; - //Cannot use reinterpret_cast because: ANSI C++ forbids casting between pointers to functions and objects - GetLexerCountFn GetLexerCount = (GetLexerCountFn)(sptr_t)lib->FindFunction("GetLexerCount"); - - if (GetLexerCount) { - ExternalLexerModule *lex; - LexerMinder *lm; - - // Find functions in the DLL - GetLexerNameFn GetLexerName = (GetLexerNameFn)(sptr_t)lib->FindFunction("GetLexerName"); - ExtLexerFunction Lexer = (ExtLexerFunction)(sptr_t)lib->FindFunction("Lex"); - ExtFoldFunction Folder = (ExtFoldFunction)(sptr_t)lib->FindFunction("Fold"); - - // Assign a buffer for the lexer name. - char lexname[100]; - strcpy(lexname, ""); - - int nl = GetLexerCount(); - - for (int i = 0; i < nl; i++) { - GetLexerName(i, lexname, 100); - lex = new ExternalLexerModule(SCLEX_AUTOMATIC, NULL, lexname, NULL); - - // Create a LexerMinder so we don't leak the ExternalLexerModule... - lm = new LexerMinder; - lm->self = lex; - lm->next = NULL; - if (first != NULL) { - last->next = lm; - last = lm; - } else { - first = lm; - last = lm; - } - - // The external lexer needs to know how to call into its DLL to - // do its lexing and folding, we tell it here. Folder may be null. - lex->SetExternal(Lexer, Folder, i); - } - } - } - next = NULL; -} - -LexerLibrary::~LexerLibrary() { - Release(); - delete lib; -} - -void LexerLibrary::Release() { - //TODO maintain a list of lexers created, and delete them! - LexerMinder *lm; - LexerMinder *next; - lm = first; - while (NULL != lm) { - next = lm->next; - delete lm->self; - delete lm; - lm = next; - } - - first = NULL; - last = NULL; -} - -//------------------------------------------ -// -// LexerManager -// -//------------------------------------------ - -/// Return the single LexerManager instance... -LexerManager *LexerManager::GetInstance() { - if(!theInstance) - theInstance = new LexerManager; - return theInstance; -} - -/// Delete any LexerManager instance... -void LexerManager::DeleteInstance() -{ - if(theInstance) { - delete theInstance; - theInstance = NULL; - } -} - -/// protected constructor - this is a singleton... -LexerManager::LexerManager() { - first = NULL; - last = NULL; -} - -LexerManager::~LexerManager() { - Clear(); -} - -void LexerManager::Load(const char* path) -{ - LoadLexerLibrary(path); -} - -void LexerManager::LoadLexerLibrary(const char* module) -{ - LexerLibrary *lib = new LexerLibrary(module); - if (NULL != first) { - last->next = lib; - last = lib; - } else { - first = lib; - last = lib; - } -} - -void LexerManager::Clear() -{ - if (NULL != first) { - LexerLibrary *cur = first; - LexerLibrary *next; - while (cur) { - next = cur->next; - delete cur; - cur = next; - } - first = NULL; - last = NULL; - } -} - -//------------------------------------------ -// -// LexerManager -// -//------------------------------------------ - -LMMinder::~LMMinder() -{ - LexerManager::DeleteInstance(); -} - -LMMinder minder; +// Scintilla source code edit control +/** @file ExternalLexer.cxx + ** Support external lexers in DLLs. + **/ +// Copyright 2001 Simon Steele , portions copyright Neil Hodgson. +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include + +#include + +#include "Platform.h" + +#include "Scintilla.h" + +#include "SciLexer.h" +#include "PropSet.h" +#include "Accessor.h" +#include "DocumentAccessor.h" +#include "KeyWords.h" +#include "ExternalLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +LexerManager *LexerManager::theInstance = NULL; + +//------------------------------------------ +// +// ExternalLexerModule +// +//------------------------------------------ + +char **WordListsToStrings(WordList *val[]) { + int dim = 0; + while (val[dim]) + dim++; + char **wls = new char * [dim + 1]; + for (int i = 0;i < dim;i++) { + std::string words; + words = ""; + for (int n = 0; n < val[i]->len; n++) { + words += val[i]->words[n]; + if (n != val[i]->len - 1) + words += " "; + } + wls[i] = new char[words.length() + 1]; + strcpy(wls[i], words.c_str()); + } + wls[dim] = 0; + return wls; +} + +void DeleteWLStrings(char *strs[]) { + int dim = 0; + while (strs[dim]) { + delete strs[dim]; + dim++; + } + delete [] strs; +} + +void ExternalLexerModule::Lex(unsigned int startPos, int lengthDoc, int initStyle, + WordList *keywordlists[], Accessor &styler) const { + if (!fneLexer) + return ; + + char **kwds = WordListsToStrings(keywordlists); + char *ps = styler.GetProperties(); + + // The accessor passed in is always a DocumentAccessor so this cast and the subsequent + // access will work. Can not use the stricter dynamic_cast as that requires RTTI. + DocumentAccessor &da = static_cast(styler); + WindowID wID = da.GetWindow(); + + fneLexer(externalLanguage, startPos, lengthDoc, initStyle, kwds, wID, ps); + + delete ps; + DeleteWLStrings(kwds); +} + +void ExternalLexerModule::Fold(unsigned int startPos, int lengthDoc, int initStyle, + WordList *keywordlists[], Accessor &styler) const { + if (!fneFolder) + return ; + + char **kwds = WordListsToStrings(keywordlists); + char *ps = styler.GetProperties(); + + // The accessor passed in is always a DocumentAccessor so this cast and the subsequent + // access will work. Can not use the stricter dynamic_cast as that requires RTTI. + DocumentAccessor &da = static_cast(styler); + WindowID wID = da.GetWindow(); + + fneFolder(externalLanguage, startPos, lengthDoc, initStyle, kwds, wID, ps); + + delete ps; + DeleteWLStrings(kwds); +} + +void ExternalLexerModule::SetExternal(ExtLexerFunction fLexer, ExtFoldFunction fFolder, int index) { + fneLexer = fLexer; + fneFolder = fFolder; + externalLanguage = index; +} + +//------------------------------------------ +// +// LexerLibrary +// +//------------------------------------------ + +LexerLibrary::LexerLibrary(const char* ModuleName) { + // Initialise some members... + first = NULL; + last = NULL; + + // Load the DLL + lib = DynamicLibrary::Load(ModuleName); + if (lib->IsValid()) { + m_sModuleName = ModuleName; + //Cannot use reinterpret_cast because: ANSI C++ forbids casting between pointers to functions and objects + GetLexerCountFn GetLexerCount = (GetLexerCountFn)(sptr_t)lib->FindFunction("GetLexerCount"); + + if (GetLexerCount) { + ExternalLexerModule *lex; + LexerMinder *lm; + + // Find functions in the DLL + GetLexerNameFn GetLexerName = (GetLexerNameFn)(sptr_t)lib->FindFunction("GetLexerName"); + ExtLexerFunction Lexer = (ExtLexerFunction)(sptr_t)lib->FindFunction("Lex"); + ExtFoldFunction Folder = (ExtFoldFunction)(sptr_t)lib->FindFunction("Fold"); + + // Assign a buffer for the lexer name. + char lexname[100]; + strcpy(lexname, ""); + + int nl = GetLexerCount(); + + for (int i = 0; i < nl; i++) { + GetLexerName(i, lexname, 100); + lex = new ExternalLexerModule(SCLEX_AUTOMATIC, NULL, lexname, NULL); + + // Create a LexerMinder so we don't leak the ExternalLexerModule... + lm = new LexerMinder; + lm->self = lex; + lm->next = NULL; + if (first != NULL) { + last->next = lm; + last = lm; + } else { + first = lm; + last = lm; + } + + // The external lexer needs to know how to call into its DLL to + // do its lexing and folding, we tell it here. Folder may be null. + lex->SetExternal(Lexer, Folder, i); + } + } + } + next = NULL; +} + +LexerLibrary::~LexerLibrary() { + Release(); + delete lib; +} + +void LexerLibrary::Release() { + //TODO maintain a list of lexers created, and delete them! + LexerMinder *lm; + LexerMinder *lmNext; + lm = first; + while (NULL != lm) { + lmNext = lm->next; + delete lm->self; + delete lm; + lm = lmNext; + } + + first = NULL; + last = NULL; +} + +//------------------------------------------ +// +// LexerManager +// +//------------------------------------------ + +/// Return the single LexerManager instance... +LexerManager *LexerManager::GetInstance() { + if(!theInstance) + theInstance = new LexerManager; + return theInstance; +} + +/// Delete any LexerManager instance... +void LexerManager::DeleteInstance() +{ + if(theInstance) { + delete theInstance; + theInstance = NULL; + } +} + +/// protected constructor - this is a singleton... +LexerManager::LexerManager() { + first = NULL; + last = NULL; +} + +LexerManager::~LexerManager() { + Clear(); +} + +void LexerManager::Load(const char* path) +{ + LoadLexerLibrary(path); +} + +void LexerManager::LoadLexerLibrary(const char* module) +{ + LexerLibrary *lib = new LexerLibrary(module); + if (NULL != first) { + last->next = lib; + last = lib; + } else { + first = lib; + last = lib; + } +} + +void LexerManager::Clear() +{ + if (NULL != first) { + LexerLibrary *cur = first; + LexerLibrary *next; + while (cur) { + next = cur->next; + delete cur; + cur = next; + } + first = NULL; + last = NULL; + } +} + +//------------------------------------------ +// +// LexerManager +// +//------------------------------------------ + +LMMinder::~LMMinder() +{ + LexerManager::DeleteInstance(); +} + +LMMinder minder; diff --git a/sdk/wxscintilla/src/scintilla/src/ExternalLexer.h b/sdk/wxscintilla/src/scintilla/src/ExternalLexer.h index b72f7a20c1..3c1659a55b 100644 --- a/sdk/wxscintilla/src/scintilla/src/ExternalLexer.h +++ b/sdk/wxscintilla/src/scintilla/src/ExternalLexer.h @@ -1,103 +1,103 @@ -// Scintilla source code edit control -/** @file ExternalLexer.h - ** Support external lexers in DLLs. - **/ -// Copyright 2001 Simon Steele , portions copyright Neil Hodgson. -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef EXTERNALLEXER_H -#define EXTERNALLEXER_H - -#if PLAT_WIN -#define EXT_LEXER_DECL __stdcall -#else -#define EXT_LEXER_DECL -#endif - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -// External Lexer function definitions... -typedef void (EXT_LEXER_DECL *ExtLexerFunction)(unsigned int lexer, unsigned int startPos, int length, int initStyle, - char *words[], WindowID window, char *props); -typedef void (EXT_LEXER_DECL *ExtFoldFunction)(unsigned int lexer, unsigned int startPos, int length, int initStyle, - char *words[], WindowID window, char *props); -typedef void* (EXT_LEXER_DECL *GetLexerFunction)(unsigned int Index); -typedef int (EXT_LEXER_DECL *GetLexerCountFn)(); -typedef void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength); - -//class DynamicLibrary; - -/// Sub-class of LexerModule to use an external lexer. -class ExternalLexerModule : protected LexerModule { -protected: - ExtLexerFunction fneLexer; - ExtFoldFunction fneFolder; - int externalLanguage; - char name[100]; -public: - ExternalLexerModule(int language_, LexerFunction fnLexer_, - const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_){ - strncpy(name, languageName_, sizeof(name)); - languageName = name; - }; - virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle, - WordList *keywordlists[], Accessor &styler) const; - virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle, - WordList *keywordlists[], Accessor &styler) const; - virtual void SetExternal(ExtLexerFunction fLexer, ExtFoldFunction fFolder, int index); -}; - -/// LexerMinder points to an ExternalLexerModule - so we don't leak them. -class LexerMinder { -public: - ExternalLexerModule *self; - LexerMinder *next; -}; - -/// LexerLibrary exists for every External Lexer DLL, contains LexerMinders. -class LexerLibrary { - DynamicLibrary *lib; - LexerMinder *first; - LexerMinder *last; - -public: - LexerLibrary(const char* ModuleName); - ~LexerLibrary(); - void Release(); - - LexerLibrary *next; - SString m_sModuleName; -}; - -/// LexerManager manages external lexers, contains LexerLibrarys. -class LexerManager { -public: - ~LexerManager(); - - static LexerManager *GetInstance(); - static void DeleteInstance(); - - void Load(const char* path); - void Clear(); - -private: - LexerManager(); - static LexerManager *theInstance; - - void LoadLexerLibrary(const char* module); - LexerLibrary *first; - LexerLibrary *last; -}; - -class LMMinder { -public: - ~LMMinder(); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif +// Scintilla source code edit control +/** @file ExternalLexer.h + ** Support external lexers in DLLs. + **/ +// Copyright 2001 Simon Steele , portions copyright Neil Hodgson. +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef EXTERNALLEXER_H +#define EXTERNALLEXER_H + +#if PLAT_WIN +#define EXT_LEXER_DECL __stdcall +#else +#define EXT_LEXER_DECL +#endif + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +// External Lexer function definitions... +typedef void (EXT_LEXER_DECL *ExtLexerFunction)(unsigned int lexer, unsigned int startPos, int length, int initStyle, + char *words[], WindowID window, char *props); +typedef void (EXT_LEXER_DECL *ExtFoldFunction)(unsigned int lexer, unsigned int startPos, int length, int initStyle, + char *words[], WindowID window, char *props); +typedef void* (EXT_LEXER_DECL *GetLexerFunction)(unsigned int Index); +typedef int (EXT_LEXER_DECL *GetLexerCountFn)(); +typedef void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength); + +//class DynamicLibrary; + +/// Sub-class of LexerModule to use an external lexer. +class ExternalLexerModule : protected LexerModule { +protected: + ExtLexerFunction fneLexer; + ExtFoldFunction fneFolder; + int externalLanguage; + char name[100]; +public: + ExternalLexerModule(int language_, LexerFunction fnLexer_, + const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_){ + strncpy(name, languageName_, sizeof(name)); + languageName = name; + }; + virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle, + WordList *keywordlists[], Accessor &styler) const; + virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle, + WordList *keywordlists[], Accessor &styler) const; + virtual void SetExternal(ExtLexerFunction fLexer, ExtFoldFunction fFolder, int index); +}; + +/// LexerMinder points to an ExternalLexerModule - so we don't leak them. +class LexerMinder { +public: + ExternalLexerModule *self; + LexerMinder *next; +}; + +/// LexerLibrary exists for every External Lexer DLL, contains LexerMinders. +class LexerLibrary { + DynamicLibrary *lib; + LexerMinder *first; + LexerMinder *last; + +public: + LexerLibrary(const char* ModuleName); + ~LexerLibrary(); + void Release(); + + LexerLibrary *next; + std::string m_sModuleName; +}; + +/// LexerManager manages external lexers, contains LexerLibrarys. +class LexerManager { +public: + ~LexerManager(); + + static LexerManager *GetInstance(); + static void DeleteInstance(); + + void Load(const char* path); + void Clear(); + +private: + LexerManager(); + static LexerManager *theInstance; + + void LoadLexerLibrary(const char* module); + LexerLibrary *first; + LexerLibrary *last; +}; + +class LMMinder { +public: + ~LMMinder(); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/sdk/wxscintilla/src/scintilla/src/Indicator.cxx b/sdk/wxscintilla/src/scintilla/src/Indicator.cxx index 6f979ddb00..da9531224a 100644 --- a/sdk/wxscintilla/src/scintilla/src/Indicator.cxx +++ b/sdk/wxscintilla/src/scintilla/src/Indicator.cxx @@ -1,81 +1,81 @@ -// Scintilla source code edit control -/** @file Indicator.cxx - ** Defines the style of indicators which are text decorations such as underlining. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include "Platform.h" - -#include "Scintilla.h" -#include "Indicator.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) { - surface->PenColour(fore.allocated); - int ymid = (rc.bottom + rc.top) / 2; - if (style == INDIC_SQUIGGLE) { - surface->MoveTo(rc.left, rc.top); - int x = rc.left + 2; - int y = 2; - while (x < rc.right) { - surface->LineTo(x, rc.top + y); - x += 2; - y = 2 - y; - } - surface->LineTo(rc.right, rc.top + y); // Finish the line - } else if (style == INDIC_TT) { - surface->MoveTo(rc.left, ymid); - int x = rc.left + 5; - while (x < rc.right) { - surface->LineTo(x, ymid); - surface->MoveTo(x-3, ymid); - surface->LineTo(x-3, ymid+2); - x++; - surface->MoveTo(x, ymid); - x += 5; - } - surface->LineTo(rc.right, ymid); // Finish the line - if (x - 3 <= rc.right) { - surface->MoveTo(x-3, ymid); - surface->LineTo(x-3, ymid+2); - } - } else if (style == INDIC_DIAGONAL) { - int x = rc.left; - while (x < rc.right) { - surface->MoveTo(x, rc.top+2); - int endX = x+3; - int endY = rc.top - 1; - if (endX > rc.right) { - endY += endX - rc.right; - endX = rc.right; - } - surface->LineTo(endX, endY); - x += 4; - } - } else if (style == INDIC_STRIKE) { - surface->MoveTo(rc.left, rc.top - 4); - surface->LineTo(rc.right, rc.top - 4); - } else if (style == INDIC_HIDDEN) { - // Draw nothing - } else if (style == INDIC_BOX) { - surface->MoveTo(rc.left, ymid+1); - surface->LineTo(rc.right, ymid+1); - surface->LineTo(rc.right, rcLine.top+1); - surface->LineTo(rc.left, rcLine.top+1); - surface->LineTo(rc.left, ymid+1); - } else if (style == INDIC_ROUNDBOX) { - PRectangle rcBox = rcLine; - rcBox.top = rcLine.top + 1; - rcBox.left = rc.left; - rcBox.right = rc.right; - surface->AlphaRectangle(rcBox, 1, fore.allocated, 100, fore.allocated, 100, 0); - } else { // Either INDIC_PLAIN or unknown - surface->MoveTo(rc.left, ymid); - surface->LineTo(rc.right, ymid); - } -} - +// Scintilla source code edit control +/** @file Indicator.cxx + ** Defines the style of indicators which are text decorations such as underlining. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include "Platform.h" + +#include "Scintilla.h" +#include "Indicator.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) { + surface->PenColour(fore.allocated); + int ymid = (rc.bottom + rc.top) / 2; + if (style == INDIC_SQUIGGLE) { + surface->MoveTo(rc.left, rc.top); + int x = rc.left + 2; + int y = 2; + while (x < rc.right) { + surface->LineTo(x, rc.top + y); + x += 2; + y = 2 - y; + } + surface->LineTo(rc.right, rc.top + y); // Finish the line + } else if (style == INDIC_TT) { + surface->MoveTo(rc.left, ymid); + int x = rc.left + 5; + while (x < rc.right) { + surface->LineTo(x, ymid); + surface->MoveTo(x-3, ymid); + surface->LineTo(x-3, ymid+2); + x++; + surface->MoveTo(x, ymid); + x += 5; + } + surface->LineTo(rc.right, ymid); // Finish the line + if (x - 3 <= rc.right) { + surface->MoveTo(x-3, ymid); + surface->LineTo(x-3, ymid+2); + } + } else if (style == INDIC_DIAGONAL) { + int x = rc.left; + while (x < rc.right) { + surface->MoveTo(x, rc.top+2); + int endX = x+3; + int endY = rc.top - 1; + if (endX > rc.right) { + endY += endX - rc.right; + endX = rc.right; + } + surface->LineTo(endX, endY); + x += 4; + } + } else if (style == INDIC_STRIKE) { + surface->MoveTo(rc.left, rc.top - 4); + surface->LineTo(rc.right, rc.top - 4); + } else if (style == INDIC_HIDDEN) { + // Draw nothing + } else if (style == INDIC_BOX) { + surface->MoveTo(rc.left, ymid+1); + surface->LineTo(rc.right, ymid+1); + surface->LineTo(rc.right, rcLine.top+1); + surface->LineTo(rc.left, rcLine.top+1); + surface->LineTo(rc.left, ymid+1); + } else if (style == INDIC_ROUNDBOX) { + PRectangle rcBox = rcLine; + rcBox.top = rcLine.top + 1; + rcBox.left = rc.left; + rcBox.right = rc.right; + surface->AlphaRectangle(rcBox, 1, fore.allocated, fillAlpha, fore.allocated, 50, 0); + } else { // Either INDIC_PLAIN or unknown + surface->MoveTo(rc.left, ymid); + surface->LineTo(rc.right, ymid); + } +} + diff --git a/sdk/wxscintilla/src/scintilla/src/Indicator.h b/sdk/wxscintilla/src/scintilla/src/Indicator.h index 015a1a23dc..42b56f07e7 100644 --- a/sdk/wxscintilla/src/scintilla/src/Indicator.h +++ b/sdk/wxscintilla/src/scintilla/src/Indicator.h @@ -1,31 +1,32 @@ -// Scintilla source code edit control -/** @file Indicator.h - ** Defines the style of indicators which are text decorations such as underlining. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef INDICATOR_H -#define INDICATOR_H - -#ifdef SCI_NAMESPACE -namespace Scintilla { -#endif - -/** - */ -class Indicator { -public: - int style; - bool under; - ColourPair fore; - Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)) { - } - void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine); -}; - -#ifdef SCI_NAMESPACE -} -#endif - -#endif +// Scintilla source code edit control +/** @file Indicator.h + ** Defines the style of indicators which are text decorations such as underlining. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef INDICATOR_H +#define INDICATOR_H + +#ifdef SCI_NAMESPACE +namespace Scintilla { +#endif + +/** + */ +class Indicator { +public: + int style; + bool under; + ColourPair fore; + int fillAlpha; + Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)), fillAlpha(30) { + } + void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine); +}; + +#ifdef SCI_NAMESPACE +} +#endif + +#endif diff --git a/sdk/wxscintilla/src/scintilla/src/KeyWords.cxx b/sdk/wxscintilla/src/scintilla/src/KeyWords.cxx index aeec288b79..2285cc2c75 100644 --- a/sdk/wxscintilla/src/scintilla/src/KeyWords.cxx +++ b/sdk/wxscintilla/src/scintilla/src/KeyWords.cxx @@ -1,241 +1,434 @@ -// Scintilla source code edit control -/** @file KeyWords.cxx - ** Colourise for particular languages. - **/ -// Copyright 1998-2002 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -const LexerModule *LexerModule::base = 0; -int LexerModule::nextLanguage = SCLEX_AUTOMATIC+1; - -LexerModule::LexerModule(int language_, - LexerFunction fnLexer_, - const char *languageName_, - LexerFunction fnFolder_, - const char * const wordListDescriptions_[], - int styleBits_) : - language(language_), - fnLexer(fnLexer_), - fnFolder(fnFolder_), - wordListDescriptions(wordListDescriptions_), - styleBits(styleBits_), - languageName(languageName_) { - next = base; - base = this; - if (language == SCLEX_AUTOMATIC) { - language = nextLanguage; - nextLanguage++; - } -} - -int LexerModule::GetNumWordLists() const { - if (wordListDescriptions == NULL) { - return -1; - } else { - int numWordLists = 0; - - while (wordListDescriptions[numWordLists]) { - ++numWordLists; - } - - return numWordLists; - } -} - -const char *LexerModule::GetWordListDescription(int index) const { - static const char *emptyStr = ""; - - PLATFORM_ASSERT(index < GetNumWordLists()); - if (index >= GetNumWordLists()) { - return emptyStr; - } else { - return wordListDescriptions[index]; - } -} - -int LexerModule::GetStyleBitsNeeded() const { - return styleBits; -} - -const LexerModule *LexerModule::Find(int language) { - const LexerModule *lm = base; - while (lm) { - if (lm->language == language) { - return lm; - } - lm = lm->next; - } - return 0; -} - -const LexerModule *LexerModule::Find(const char *languageName) { - if (languageName) { - const LexerModule *lm = base; - while (lm) { - if (lm->languageName && 0 == strcmp(lm->languageName, languageName)) { - return lm; - } - lm = lm->next; - } - } - return 0; -} - -void LexerModule::Lex(unsigned int startPos, int lengthDoc, int initStyle, - WordList *keywordlists[], Accessor &styler) const { - if (fnLexer) - fnLexer(startPos, lengthDoc, initStyle, keywordlists, styler); -} - -void LexerModule::Fold(unsigned int startPos, int lengthDoc, int initStyle, - WordList *keywordlists[], Accessor &styler) const { - if (fnFolder) { - int lineCurrent = styler.GetLine(startPos); - // Move back one line in case deletion wrecked current line fold state - if (lineCurrent > 0) { - lineCurrent--; - int newStartPos = styler.LineStart(lineCurrent); - lengthDoc += startPos - newStartPos; - startPos = newStartPos; - initStyle = 0; - if (startPos > 0) { - initStyle = styler.StyleAt(startPos - 1); - } - } - fnFolder(startPos, lengthDoc, initStyle, keywordlists, styler); - } -} - -// Alternative historical name for Scintilla_LinkLexers -int wxForceScintillaLexers(void) { - return Scintilla_LinkLexers(); -} - -// To add or remove a lexer, add or remove its file and run LexGen.py. - -// Force a reference to all of the Scintilla lexers so that the linker will -// not remove the code of the lexers. -int Scintilla_LinkLexers() { - static int forcer = 0; - -// Shorten the code that declares a lexer and ensures it is linked in by calling a method. -#define LINK_LEXER(lexer) extern LexerModule lexer; forcer += lexer.GetLanguage(); - -//++Autogenerated -- run src/LexGen.py to regenerate -//**\(\tLINK_LEXER(\*);\n\) - LINK_LEXER(lmAbaqus); - LINK_LEXER(lmAda); - LINK_LEXER(lmAns1); - LINK_LEXER(lmAPDL); - LINK_LEXER(lmAsm); - LINK_LEXER(lmASP); - LINK_LEXER(lmASY); - LINK_LEXER(lmAU3); - LINK_LEXER(lmAVE); - LINK_LEXER(lmBaan); - LINK_LEXER(lmBash); - LINK_LEXER(lmBatch); - LINK_LEXER(lmBlitzBasic); - LINK_LEXER(lmBullant); - LINK_LEXER(lmCaml); - LINK_LEXER(lmClw); - LINK_LEXER(lmClwNoCase); - LINK_LEXER(lmCmake); - LINK_LEXER(lmConf); - LINK_LEXER(lmCPP); - LINK_LEXER(lmCPPNoCase); - LINK_LEXER(lmCsound); - LINK_LEXER(lmCss); - LINK_LEXER(lmD); - LINK_LEXER(lmDiff); - LINK_LEXER(lmEiffel); - LINK_LEXER(lmEiffelkw); - LINK_LEXER(lmErlang); - LINK_LEXER(lmErrorList); - LINK_LEXER(lmESCRIPT); - LINK_LEXER(lmF77); - LINK_LEXER(lmFlagShip); - LINK_LEXER(lmForth); - LINK_LEXER(lmFortran); - LINK_LEXER(lmFreeBasic); - LINK_LEXER(lmGAP); - LINK_LEXER(lmGui4Cli); - LINK_LEXER(lmHaskell); - LINK_LEXER(lmHTML); - LINK_LEXER(lmInno); - LINK_LEXER(lmKix); - LINK_LEXER(lmLatex); - LINK_LEXER(lmLISP); - LINK_LEXER(lmLot); - LINK_LEXER(lmLout); - LINK_LEXER(lmLua); - LINK_LEXER(lmMagikSF); - LINK_LEXER(lmMake); - LINK_LEXER(lmMatlab); - LINK_LEXER(lmMETAPOST); - LINK_LEXER(lmMMIXAL); - LINK_LEXER(lmMSSQL); - LINK_LEXER(lmNncrontab); - LINK_LEXER(lmNsis); - LINK_LEXER(lmNull); - LINK_LEXER(lmOctave); - LINK_LEXER(lmOpal); - LINK_LEXER(lmPascal); - LINK_LEXER(lmPB); - LINK_LEXER(lmPerl); - LINK_LEXER(lmPHP); - LINK_LEXER(lmPHPSCRIPT); - LINK_LEXER(lmPLM); - LINK_LEXER(lmPOV); - LINK_LEXER(lmPowerShell); - LINK_LEXER(lmProgress); - LINK_LEXER(lmProps); - LINK_LEXER(lmPS); - LINK_LEXER(lmPureBasic); - LINK_LEXER(lmPython); - LINK_LEXER(lmR); - LINK_LEXER(lmREBOL); - LINK_LEXER(lmRuby); - LINK_LEXER(lmScriptol); - LINK_LEXER(lmSmalltalk); - LINK_LEXER(lmSpecman); - LINK_LEXER(lmSpice); - LINK_LEXER(lmSQL); - LINK_LEXER(lmTADS3); - LINK_LEXER(lmTCL); - LINK_LEXER(lmTeX); - LINK_LEXER(lmVB); - LINK_LEXER(lmVBScript); - LINK_LEXER(lmVerilog); - LINK_LEXER(lmVHDL); - LINK_LEXER(lmXML); - LINK_LEXER(lmYAML); - -//ERAN - START - LINK_LEXER(lmGcc); - LINK_LEXER(lmFif); - LINK_LEXER(lmSvn); -//ERAN - END - -//--Autogenerated -- end of automatically generated section - - return 1; -} +// Scintilla source code edit control +/** @file KeyWords.cxx + ** Colourise for particular languages. + **/ +// Copyright 1998-2002 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +/** + * Creates an array that points into each word in the string and puts \0 terminators + * after each word. + */ +static char **ArrayFromWordList(char *wordlist, int *len, bool onlyLineEnds = false) { + int prev = '\n'; + int words = 0; + // For rapid determination of whether a character is a separator, build + // a look up table. + bool wordSeparator[256]; + for (int i=0;i<256; i++) { + wordSeparator[i] = false; + } + wordSeparator['\r'] = true; + wordSeparator['\n'] = true; + if (!onlyLineEnds) { + wordSeparator[' '] = true; + wordSeparator['\t'] = true; + } + for (int j = 0; wordlist[j]; j++) { + int curr = static_cast(wordlist[j]); + if (!wordSeparator[curr] && wordSeparator[prev]) + words++; + prev = curr; + } + char **keywords = new char *[words + 1]; + if (keywords) { + words = 0; + prev = '\0'; + size_t slen = strlen(wordlist); + for (size_t k = 0; k < slen; k++) { + if (!wordSeparator[static_cast(wordlist[k])]) { + if (!prev) { + keywords[words] = &wordlist[k]; + words++; + } + } else { + wordlist[k] = '\0'; + } + prev = wordlist[k]; + } + keywords[words] = &wordlist[slen]; + *len = words; + } else { + *len = 0; + } + return keywords; +} + +void WordList::Clear() { + if (words) { + delete []list; + delete []words; + } + words = 0; + list = 0; + len = 0; + sorted = false; +} + +void WordList::Set(const char *s) { + list = new char[strlen(s) + 1]; + strcpy(list, s); + sorted = false; + words = ArrayFromWordList(list, &len, onlyLineEnds); +} + +extern "C" int cmpString(const void *a1, const void *a2) { + // Can't work out the correct incantation to use modern casts here + return strcmp(*(char**)(a1), *(char**)(a2)); +} + +static void SortWordList(char **words, unsigned int len) { + qsort(reinterpret_cast(words), len, sizeof(*words), + cmpString); +} + +bool WordList::InList(const char *s) { + if (0 == words) + return false; + if (!sorted) { + sorted = true; + SortWordList(words, len); + for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++) + starts[k] = -1; + for (int l = len - 1; l >= 0; l--) { + unsigned char indexChar = words[l][0]; + starts[indexChar] = l; + } + } + unsigned char firstChar = s[0]; + int j = starts[firstChar]; + if (j >= 0) { + while ((unsigned char)words[j][0] == firstChar) { + if (s[1] == words[j][1]) { + const char *a = words[j] + 1; + const char *b = s + 1; + while (*a && *a == *b) { + a++; + b++; + } + if (!*a && !*b) + return true; + } + j++; + } + } + j = starts['^']; + if (j >= 0) { + while (words[j][0] == '^') { + const char *a = words[j] + 1; + const char *b = s; + while (*a && *a == *b) { + a++; + b++; + } + if (!*a) + return true; + j++; + } + } + return false; +} + +/** similar to InList, but word s can be a substring of keyword. + * eg. the keyword define is defined as def~ine. This means the word must start + * with def to be a keyword, but also defi, defin and define are valid. + * The marker is ~ in this case. + */ +bool WordList::InListAbbreviated(const char *s, const char marker) { + if (0 == words) + return false; + if (!sorted) { + sorted = true; + SortWordList(words, len); + for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++) + starts[k] = -1; + for (int l = len - 1; l >= 0; l--) { + unsigned char indexChar = words[l][0]; + starts[indexChar] = l; + } + } + unsigned char firstChar = s[0]; + int j = starts[firstChar]; + if (j >= 0) { + while (words[j][0] == firstChar) { + bool isSubword = false; + int start = 1; + if (words[j][1] == marker) { + isSubword = true; + start++; + } + if (s[1] == words[j][start]) { + const char *a = words[j] + start; + const char *b = s + 1; + while (*a && *a == *b) { + a++; + if (*a == marker) { + isSubword = true; + a++; + } + b++; + } + if ((!*a || isSubword) && !*b) + return true; + } + j++; + } + } + j = starts['^']; + if (j >= 0) { + while (words[j][0] == '^') { + const char *a = words[j] + 1; + const char *b = s; + while (*a && *a == *b) { + a++; + b++; + } + if (!*a) + return true; + j++; + } + } + return false; +} + +const LexerModule *LexerModule::base = 0; +int LexerModule::nextLanguage = SCLEX_AUTOMATIC+1; + +LexerModule::LexerModule(int language_, + LexerFunction fnLexer_, + const char *languageName_, + LexerFunction fnFolder_, + const char * const wordListDescriptions_[], + int styleBits_) : + language(language_), + fnLexer(fnLexer_), + fnFolder(fnFolder_), + wordListDescriptions(wordListDescriptions_), + styleBits(styleBits_), + languageName(languageName_) { + next = base; + base = this; + if (language == SCLEX_AUTOMATIC) { + language = nextLanguage; + nextLanguage++; + } +} + +int LexerModule::GetNumWordLists() const { + if (wordListDescriptions == NULL) { + return -1; + } else { + int numWordLists = 0; + + while (wordListDescriptions[numWordLists]) { + ++numWordLists; + } + + return numWordLists; + } +} + +const char *LexerModule::GetWordListDescription(int index) const { + static const char *emptyStr = ""; + + PLATFORM_ASSERT(index < GetNumWordLists()); + if (index >= GetNumWordLists()) { + return emptyStr; + } else { + return wordListDescriptions[index]; + } +} + +int LexerModule::GetStyleBitsNeeded() const { + return styleBits; +} + +const LexerModule *LexerModule::Find(int language) { + const LexerModule *lm = base; + while (lm) { + if (lm->language == language) { + return lm; + } + lm = lm->next; + } + return 0; +} + +const LexerModule *LexerModule::Find(const char *languageName) { + if (languageName) { + const LexerModule *lm = base; + while (lm) { + if (lm->languageName && 0 == strcmp(lm->languageName, languageName)) { + return lm; + } + lm = lm->next; + } + } + return 0; +} + +void LexerModule::Lex(unsigned int startPos, int lengthDoc, int initStyle, + WordList *keywordlists[], Accessor &styler) const { + if (fnLexer) + fnLexer(startPos, lengthDoc, initStyle, keywordlists, styler); +} + +void LexerModule::Fold(unsigned int startPos, int lengthDoc, int initStyle, + WordList *keywordlists[], Accessor &styler) const { + if (fnFolder) { + int lineCurrent = styler.GetLine(startPos); + // Move back one line in case deletion wrecked current line fold state + if (lineCurrent > 0) { + lineCurrent--; + int newStartPos = styler.LineStart(lineCurrent); + lengthDoc += startPos - newStartPos; + startPos = newStartPos; + initStyle = 0; + if (startPos > 0) { + initStyle = styler.StyleAt(startPos - 1); + } + } + fnFolder(startPos, lengthDoc, initStyle, keywordlists, styler); + } +} + +// Alternative historical name for Scintilla_LinkLexers +int wxForceScintillaLexers(void) { + return Scintilla_LinkLexers(); +} + +// To add or remove a lexer, add or remove its file and run LexGen.py. + +// Force a reference to all of the Scintilla lexers so that the linker will +// not remove the code of the lexers. +int Scintilla_LinkLexers() { + static int forcer = 0; + +// Shorten the code that declares a lexer and ensures it is linked in by calling a method. +#define LINK_LEXER(lexer) extern LexerModule lexer; forcer += lexer.GetLanguage(); + +//++Autogenerated -- run src/LexGen.py to regenerate +//**\(\tLINK_LEXER(\*);\n\) + LINK_LEXER(lmAbaqus); + LINK_LEXER(lmAda); + LINK_LEXER(lmAns1); + LINK_LEXER(lmAPDL); + LINK_LEXER(lmAsm); + LINK_LEXER(lmASY); + LINK_LEXER(lmAU3); + LINK_LEXER(lmAVE); + LINK_LEXER(lmBaan); + LINK_LEXER(lmBash); + LINK_LEXER(lmBatch); + LINK_LEXER(lmBlitzBasic); + LINK_LEXER(lmBullant); + LINK_LEXER(lmCaml); + LINK_LEXER(lmClw); + LINK_LEXER(lmClwNoCase); + LINK_LEXER(lmCmake); + LINK_LEXER(lmCOBOL); + LINK_LEXER(lmConf); + LINK_LEXER(lmCPP); + LINK_LEXER(lmCPPNoCase); + LINK_LEXER(lmCsound); + LINK_LEXER(lmCss); + LINK_LEXER(lmD); + LINK_LEXER(lmDiff); + LINK_LEXER(lmEiffel); + LINK_LEXER(lmEiffelkw); + LINK_LEXER(lmErlang); + LINK_LEXER(lmErrorList); + LINK_LEXER(lmESCRIPT); + LINK_LEXER(lmF77); + LINK_LEXER(lmFlagShip); + LINK_LEXER(lmForth); + LINK_LEXER(lmFortran); + LINK_LEXER(lmFreeBasic); + LINK_LEXER(lmGAP); + LINK_LEXER(lmGui4Cli); + LINK_LEXER(lmHaskell); + LINK_LEXER(lmHTML); + LINK_LEXER(lmInno); + LINK_LEXER(lmKix); + LINK_LEXER(lmLatex); + LINK_LEXER(lmLISP); + LINK_LEXER(lmLot); + LINK_LEXER(lmLout); + LINK_LEXER(lmLua); + LINK_LEXER(lmMagikSF); + LINK_LEXER(lmMake); + LINK_LEXER(lmMatlab); + LINK_LEXER(lmMETAPOST); + LINK_LEXER(lmMMIXAL); + LINK_LEXER(lmMSSQL); + LINK_LEXER(lmMySQL); + LINK_LEXER(lmNimrod); + LINK_LEXER(lmNncrontab); + LINK_LEXER(lmNsis); + LINK_LEXER(lmNull); + LINK_LEXER(lmOctave); + LINK_LEXER(lmOpal); + LINK_LEXER(lmPascal); + LINK_LEXER(lmPB); + LINK_LEXER(lmPerl); + LINK_LEXER(lmPHPSCRIPT); + LINK_LEXER(lmPLM); + LINK_LEXER(lmPo); + LINK_LEXER(lmPOV); + LINK_LEXER(lmPowerPro); + LINK_LEXER(lmPowerShell); + LINK_LEXER(lmProgress); + LINK_LEXER(lmProps); + LINK_LEXER(lmPS); + LINK_LEXER(lmPureBasic); + LINK_LEXER(lmPython); + LINK_LEXER(lmR); + LINK_LEXER(lmREBOL); + LINK_LEXER(lmRuby); + LINK_LEXER(lmScriptol); + LINK_LEXER(lmSmalltalk); + LINK_LEXER(lmSML); + LINK_LEXER(lmSorc); + LINK_LEXER(lmSpecman); + LINK_LEXER(lmSpice); + LINK_LEXER(lmSQL); + LINK_LEXER(lmTACL); + LINK_LEXER(lmTADS3); + LINK_LEXER(lmTAL); + LINK_LEXER(lmTCL); + LINK_LEXER(lmTeX); + LINK_LEXER(lmVB); + LINK_LEXER(lmVBScript); + LINK_LEXER(lmVerilog); + LINK_LEXER(lmVHDL); + LINK_LEXER(lmXML); + LINK_LEXER(lmYAML); + +//ERAN - START + LINK_LEXER(lmGcc); + LINK_LEXER(lmFif); + LINK_LEXER(lmSvn); +//ERAN - END + +//--Autogenerated -- end of automatically generated section + + return 1; +} diff --git a/sdk/wxscintilla/src/scintilla/src/LexASY.cxx b/sdk/wxscintilla/src/scintilla/src/LexASY.cxx index 8a1785a528..5bf979fd37 100644 --- a/sdk/wxscintilla/src/scintilla/src/LexASY.cxx +++ b/sdk/wxscintilla/src/scintilla/src/LexASY.cxx @@ -1,270 +1,270 @@ -// Scintilla source code edit control -//Author: instanton (email: soft_share126com) -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" -#include "CharacterSet.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -static void ColouriseAsyDoc(unsigned int startPos, int length, int initStyle, - WordList *keywordlists[], Accessor &styler) { - - WordList &keywords = *keywordlists[0]; - WordList &keywords2 = *keywordlists[1]; - - CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true); - CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true); - - int visibleChars = 0; - - StyleContext sc(startPos, length, initStyle, styler); - - for (; sc.More(); sc.Forward()) { - - if (sc.atLineStart) { - if (sc.state == SCE_ASY_STRING) { - sc.SetState(SCE_ASY_STRING); - } - visibleChars = 0; - } - - if (sc.ch == '\\') { - if (sc.chNext == '\n' || sc.chNext == '\r') { - sc.Forward(); - if (sc.ch == '\r' && sc.chNext == '\n') { - sc.Forward(); - } -// continuationLine = true; - continue; - } - } - - // Determine if the current state should terminate. - switch (sc.state) { - case SCE_ASY_OPERATOR: - sc.SetState(SCE_ASY_DEFAULT); - break; - case SCE_ASY_NUMBER: - if (!setWord.Contains(sc.ch)) { - sc.SetState(SCE_ASY_DEFAULT); - } - break; - case SCE_ASY_IDENTIFIER: - if (!setWord.Contains(sc.ch) || (sc.ch == '.')) { - char s[1000]; - sc.GetCurrentLowered(s, sizeof(s)); - if (keywords.InList(s)) { - sc.ChangeState(SCE_ASY_WORD); - } else if (keywords2.InList(s)) { - sc.ChangeState(SCE_ASY_WORD2); - } - sc.SetState(SCE_ASY_DEFAULT); - } - break; - case SCE_ASY_COMMENT: - if (sc.Match('*', '/')) { - sc.Forward(); - sc.ForwardSetState(SCE_ASY_DEFAULT); - } - break; - case SCE_ASY_COMMENTLINE: - if (sc.atLineStart) { - sc.SetState(SCE_ASY_DEFAULT); - } - break; - case SCE_ASY_STRING: - if (sc.atLineEnd) { - sc.ChangeState(SCE_ASY_STRINGEOL); - } else if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\"') { - sc.ForwardSetState(SCE_ASY_DEFAULT); - } - break; - case SCE_ASY_CHARACTER: - if (sc.atLineEnd) { - sc.ChangeState(SCE_ASY_STRINGEOL); - } else if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\'') { - sc.ForwardSetState(SCE_ASY_DEFAULT); - } - break; - } - - // Determine if a new state should be entered. - if (sc.state == SCE_ASY_DEFAULT) { - if (setWordStart.Contains(sc.ch) || (sc.ch == '@')) { - sc.SetState(SCE_ASY_IDENTIFIER); - } else if (sc.Match('/', '*')) { - sc.SetState(SCE_ASY_COMMENT); - sc.Forward(); // - } else if (sc.Match('/', '/')) { - sc.SetState(SCE_ASY_COMMENTLINE); - } else if (sc.ch == '\"') { - sc.SetState(SCE_ASY_STRING); - } else if (sc.ch == '\'') { - sc.SetState(SCE_ASY_CHARACTER); - } else if (sc.ch == '#' && visibleChars == 0) { - do { - sc.Forward(); - } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()); - if (sc.atLineEnd) { - sc.SetState(SCE_ASY_DEFAULT); - } - } else if (isoperator(static_cast(sc.ch))) { - sc.SetState(SCE_ASY_OPERATOR); - } - } - - } - sc.Complete(); -} - -static bool IsAsyCommentStyle(int style) { - return style == SCE_ASY_COMMENT; -} - - -static inline bool isASYidentifier(int ch) { - return - ((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) ; -} - -static int ParseASYWord(unsigned int pos, Accessor &styler, char *word) -{ - int length=0; - char ch=styler.SafeGetCharAt(pos); - *word=0; - - while(isASYidentifier(ch) && length<100){ - word[length]=ch; - length++; - ch=styler.SafeGetCharAt(pos+length); - } - word[length]=0; - return length; -} - -static bool IsASYDrawingLine(int line, Accessor &styler) { - int pos = styler.LineStart(line); - int eol_pos = styler.LineStart(line + 1) - 1; - - int startpos = pos; - char buffer[100]=""; - - while (startpos 0) - levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; - int levelMinCurrent = levelCurrent; - int levelNext = levelCurrent; - char chNext = styler[startPos]; - int styleNext = styler.StyleAt(startPos); - int style = initStyle; - for (unsigned int i = startPos; i < endPos; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - int stylePrev = style; - style = styleNext; - styleNext = styler.StyleAt(i + 1); - bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - if (foldComment && IsAsyCommentStyle(style)) { - if (!IsAsyCommentStyle(stylePrev) && (stylePrev != SCE_ASY_COMMENTLINEDOC)) { - levelNext++; - } else if (!IsAsyCommentStyle(styleNext) && (styleNext != SCE_ASY_COMMENTLINEDOC) && !atEOL) { - levelNext--; - } - } - if (style == SCE_ASY_OPERATOR) { - if (ch == '{') { - if (levelMinCurrent > levelNext) { - levelMinCurrent = levelNext; - } - levelNext++; - } else if (ch == '}') { - levelNext--; - } - } - - if (atEOL && IsASYDrawingLine(lineCurrent, styler)){ - if (lineCurrent==0 && IsASYDrawingLine(lineCurrent + 1, styler)) - levelNext++; - else if (lineCurrent!=0 && !IsASYDrawingLine(lineCurrent - 1, styler) - && IsASYDrawingLine(lineCurrent + 1, styler) - ) - levelNext++; - else if (lineCurrent!=0 && IsASYDrawingLine(lineCurrent - 1, styler) && - !IsASYDrawingLine(lineCurrent+1, styler)) - levelNext--; - } - - if (atEOL) { - int levelUse = levelCurrent; - if (foldAtElse) { - levelUse = levelMinCurrent; - } - int lev = levelUse | levelNext << 16; - if (visibleChars == 0 && foldCompact) - lev |= SC_FOLDLEVELWHITEFLAG; - if (levelUse < levelNext) - lev |= SC_FOLDLEVELHEADERFLAG; - if (lev != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, lev); - } - lineCurrent++; - levelCurrent = levelNext; - levelMinCurrent = levelCurrent; - visibleChars = 0; - } - if (!IsASpace(ch)) - visibleChars++; - } -} - -static const char * const asyWordLists[] = { - "Primary keywords and identifiers", - "Secondary keywords and identifiers", - 0, - }; - -LexerModule lmASY(SCLEX_ASYMPTOTE, ColouriseAsyDoc, "asy", FoldAsyDoc, asyWordLists); +// Scintilla source code edit control +//Author: instanton (email: soft_share126com) +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" +#include "CharacterSet.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static void ColouriseAsyDoc(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler) { + + WordList &keywords = *keywordlists[0]; + WordList &keywords2 = *keywordlists[1]; + + CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true); + CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true); + + int visibleChars = 0; + + StyleContext sc(startPos, length, initStyle, styler); + + for (; sc.More(); sc.Forward()) { + + if (sc.atLineStart) { + if (sc.state == SCE_ASY_STRING) { + sc.SetState(SCE_ASY_STRING); + } + visibleChars = 0; + } + + if (sc.ch == '\\') { + if (sc.chNext == '\n' || sc.chNext == '\r') { + sc.Forward(); + if (sc.ch == '\r' && sc.chNext == '\n') { + sc.Forward(); + } +// continuationLine = true; + continue; + } + } + + // Determine if the current state should terminate. + switch (sc.state) { + case SCE_ASY_OPERATOR: + sc.SetState(SCE_ASY_DEFAULT); + break; + case SCE_ASY_NUMBER: + if (!setWord.Contains(sc.ch)) { + sc.SetState(SCE_ASY_DEFAULT); + } + break; + case SCE_ASY_IDENTIFIER: + if (!setWord.Contains(sc.ch) || (sc.ch == '.')) { + char s[1000]; + sc.GetCurrentLowered(s, sizeof(s)); + if (keywords.InList(s)) { + sc.ChangeState(SCE_ASY_WORD); + } else if (keywords2.InList(s)) { + sc.ChangeState(SCE_ASY_WORD2); + } + sc.SetState(SCE_ASY_DEFAULT); + } + break; + case SCE_ASY_COMMENT: + if (sc.Match('*', '/')) { + sc.Forward(); + sc.ForwardSetState(SCE_ASY_DEFAULT); + } + break; + case SCE_ASY_COMMENTLINE: + if (sc.atLineStart) { + sc.SetState(SCE_ASY_DEFAULT); + } + break; + case SCE_ASY_STRING: + if (sc.atLineEnd) { + sc.ChangeState(SCE_ASY_STRINGEOL); + } else if (sc.ch == '\\') { + if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\"') { + sc.ForwardSetState(SCE_ASY_DEFAULT); + } + break; + case SCE_ASY_CHARACTER: + if (sc.atLineEnd) { + sc.ChangeState(SCE_ASY_STRINGEOL); + } else if (sc.ch == '\\') { + if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\'') { + sc.ForwardSetState(SCE_ASY_DEFAULT); + } + break; + } + + // Determine if a new state should be entered. + if (sc.state == SCE_ASY_DEFAULT) { + if (setWordStart.Contains(sc.ch) || (sc.ch == '@')) { + sc.SetState(SCE_ASY_IDENTIFIER); + } else if (sc.Match('/', '*')) { + sc.SetState(SCE_ASY_COMMENT); + sc.Forward(); // + } else if (sc.Match('/', '/')) { + sc.SetState(SCE_ASY_COMMENTLINE); + } else if (sc.ch == '\"') { + sc.SetState(SCE_ASY_STRING); + } else if (sc.ch == '\'') { + sc.SetState(SCE_ASY_CHARACTER); + } else if (sc.ch == '#' && visibleChars == 0) { + do { + sc.Forward(); + } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()); + if (sc.atLineEnd) { + sc.SetState(SCE_ASY_DEFAULT); + } + } else if (isoperator(static_cast(sc.ch))) { + sc.SetState(SCE_ASY_OPERATOR); + } + } + + } + sc.Complete(); +} + +static bool IsAsyCommentStyle(int style) { + return style == SCE_ASY_COMMENT; +} + + +static inline bool isASYidentifier(int ch) { + return + ((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) ; +} + +static int ParseASYWord(unsigned int pos, Accessor &styler, char *word) +{ + int length=0; + char ch=styler.SafeGetCharAt(pos); + *word=0; + + while(isASYidentifier(ch) && length<100){ + word[length]=ch; + length++; + ch=styler.SafeGetCharAt(pos+length); + } + word[length]=0; + return length; +} + +static bool IsASYDrawingLine(int line, Accessor &styler) { + int pos = styler.LineStart(line); + int eol_pos = styler.LineStart(line + 1) - 1; + + int startpos = pos; + char buffer[100]=""; + + while (startpos 0) + levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; + int levelMinCurrent = levelCurrent; + int levelNext = levelCurrent; + char chNext = styler[startPos]; + int styleNext = styler.StyleAt(startPos); + int style = initStyle; + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + int stylePrev = style; + style = styleNext; + styleNext = styler.StyleAt(i + 1); + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + if (foldComment && IsAsyCommentStyle(style)) { + if (!IsAsyCommentStyle(stylePrev) && (stylePrev != SCE_ASY_COMMENTLINEDOC)) { + levelNext++; + } else if (!IsAsyCommentStyle(styleNext) && (styleNext != SCE_ASY_COMMENTLINEDOC) && !atEOL) { + levelNext--; + } + } + if (style == SCE_ASY_OPERATOR) { + if (ch == '{') { + if (levelMinCurrent > levelNext) { + levelMinCurrent = levelNext; + } + levelNext++; + } else if (ch == '}') { + levelNext--; + } + } + + if (atEOL && IsASYDrawingLine(lineCurrent, styler)){ + if (lineCurrent==0 && IsASYDrawingLine(lineCurrent + 1, styler)) + levelNext++; + else if (lineCurrent!=0 && !IsASYDrawingLine(lineCurrent - 1, styler) + && IsASYDrawingLine(lineCurrent + 1, styler) + ) + levelNext++; + else if (lineCurrent!=0 && IsASYDrawingLine(lineCurrent - 1, styler) && + !IsASYDrawingLine(lineCurrent+1, styler)) + levelNext--; + } + + if (atEOL) { + int levelUse = levelCurrent; + if (foldAtElse) { + levelUse = levelMinCurrent; + } + int lev = levelUse | levelNext << 16; + if (visibleChars == 0 && foldCompact) + lev |= SC_FOLDLEVELWHITEFLAG; + if (levelUse < levelNext) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + lineCurrent++; + levelCurrent = levelNext; + levelMinCurrent = levelCurrent; + visibleChars = 0; + } + if (!IsASpace(ch)) + visibleChars++; + } +} + +static const char * const asyWordLists[] = { + "Primary keywords and identifiers", + "Secondary keywords and identifiers", + 0, + }; + +LexerModule lmASY(SCLEX_ASYMPTOTE, ColouriseAsyDoc, "asy", FoldAsyDoc, asyWordLists); diff --git a/sdk/wxscintilla/src/scintilla/src/LexAU3.cxx b/sdk/wxscintilla/src/scintilla/src/LexAU3.cxx index 795d50b86a..cfff9279db 100644 --- a/sdk/wxscintilla/src/scintilla/src/LexAU3.cxx +++ b/sdk/wxscintilla/src/scintilla/src/LexAU3.cxx @@ -1,906 +1,907 @@ -// Scintilla source code edit control -// @file LexAU3.cxx -// Lexer for AutoIt3 http://www.hiddensoft.com/autoit3 -// by Jos van der Zande, jvdzande@yahoo.com -// -// Changes: -// March 28, 2004 - Added the standard Folding code -// April 21, 2004 - Added Preprosessor Table + Syntax Highlighting -// Fixed Number highlighting -// Changed default isoperator to IsAOperator to have a better match to AutoIt3 -// Fixed "#comments_start" -> "#comments-start" -// Fixed "#comments_end" -> "#comments-end" -// Fixed Sendkeys in Strings when not terminated with } -// Added support for Sendkey strings that have second parameter e.g. {UP 5} or {a down} -// April 26, 2004 - Fixed # pre-processor statement inside of comment block would invalidly change the color. -// Added logic for #include to treat the <> as string -// Added underscore to IsAOperator. -// May 17, 2004 - Changed the folding logic from indent to keyword folding. -// Added Folding logic for blocks of single-commentlines or commentblock. -// triggered by: fold.comment=1 -// Added Folding logic for preprocessor blocks triggered by fold.preprocessor=1 -// Added Special for #region - #endregion syntax highlight and folding. -// May 30, 2004 - Fixed issue with continuation lines on If statements. -// June 5, 2004 - Added comma to Operators for better readability. -// Added fold.compact support set with fold.compact=1 -// Changed folding inside of #cs-#ce. Default is no keyword folding inside comment blocks when fold.comment=1 -// it will now only happen when fold.comment=2. -// Sep 5, 2004 - Added logic to handle colourizing words on the last line. -// Typed Characters now show as "default" till they match any table. -// Oct 10, 2004 - Added logic to show Comments in "Special" directives. -// Nov 1, 2004 - Added better testing for Numbers supporting x and e notation. -// Nov 28, 2004 - Added logic to handle continuation lines for syntax highlighting. -// Jan 10, 2005 - Added Abbreviations Keyword used for expansion -// Mar 24, 2005 - Updated Abbreviations Keywords to fix when followed by Operator. -// Apr 18, 2005 - Updated #CE/#Comment-End logic to take a linecomment ";" into account -// - Added folding support for With...EndWith -// - Added support for a DOT in variable names -// - Fixed Underscore in CommentBlock -// May 23, 2005 - Fixed the SentKey lexing in case of a missing } -// Aug 11, 2005 - Fixed possible bug with s_save length > 100. -// Aug 23, 2005 - Added Switch/endswitch support to the folding logic. -// Sep 27, 2005 - Fixed the SentKey lexing logic in case of multiple sentkeys. -// Mar 12, 2006 - Fixed issue with <> coloring as String in stead of Operator in rare occasions. -// Apr 8, 2006 - Added support for AutoIt3 Standard UDF library (SCE_AU3_UDF) -// Mar 9, 2007 - Fixed bug with + following a String getting the wrong Color. -// Jun 20, 2007 - Fixed Commentblock issue when LF's are used as EOL. -// Jul 26, 2007 - Fixed #endregion undetected bug. -// -// Copyright for Scintilla: 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. -// Scintilla source code edit control - -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -static inline bool IsTypeCharacter(const int ch) -{ - return ch == '$'; -} -static inline bool IsAWordChar(const int ch) -{ - return (ch < 0x80) && (isalnum(ch) || ch == '_'); -} - -static inline bool IsAWordStart(const int ch) -{ - return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '@' || ch == '#' || ch == '$' || ch == '.'); -} - -static inline bool IsAOperator(char ch) { - if (isascii(ch) && isalnum(ch)) - return false; - if (ch == '+' || ch == '-' || ch == '*' || ch == '/' || - ch == '&' || ch == '^' || ch == '=' || ch == '<' || ch == '>' || - ch == '(' || ch == ')' || ch == '[' || ch == ']' || ch == ',' ) - return true; - return false; -} - -/////////////////////////////////////////////////////////////////////////////// -// GetSendKey() filters the portion before and after a/multiple space(s) -// and return the first portion to be looked-up in the table -// also check if the second portion is valid... (up,down.on.off,toggle or a number) -/////////////////////////////////////////////////////////////////////////////// - -static int GetSendKey(const char *szLine, char *szKey) -{ - int nFlag = 0; - int nStartFound = 0; - int nKeyPos = 0; - int nSpecPos= 0; - int nSpecNum= 1; - int nPos = 0; - char cTemp; - char szSpecial[100]; - - // split the portion of the sendkey in the part before and after the spaces - while ( ( (cTemp = szLine[nPos]) != '\0')) - { - // skip leading Ctrl/Shift/Alt state - if (cTemp == '{') { - nStartFound = 1; - } - // - if (nStartFound == 1) { - if ((cTemp == ' ') && (nFlag == 0) ) // get the stuff till first space - { - nFlag = 1; - // Add } to the end of the first bit for table lookup later. - szKey[nKeyPos++] = '}'; - } - else if (cTemp == ' ') - { - // skip other spaces - } - else if (nFlag == 0) - { - // save first portion into var till space or } is hit - szKey[nKeyPos++] = cTemp; - } - else if ((nFlag == 1) && (cTemp != '}')) - { - // Save second portion into var... - szSpecial[nSpecPos++] = cTemp; - // check if Second portion is all numbers for repeat fuction - if (isdigit(cTemp) == false) {nSpecNum = 0;} - } - } - nPos++; // skip to next char - - } // End While - - - // Check if the second portion is either a number or one of these keywords - szKey[nKeyPos] = '\0'; - szSpecial[nSpecPos] = '\0'; - if (strcmp(szSpecial,"down")== 0 || strcmp(szSpecial,"up")== 0 || - strcmp(szSpecial,"on")== 0 || strcmp(szSpecial,"off")== 0 || - strcmp(szSpecial,"toggle")== 0 || nSpecNum == 1 ) - { - nFlag = 0; - } - else - { - nFlag = 1; - } - return nFlag; // 1 is bad, 0 is good - -} // GetSendKey() - -// -// Routine to check the last "none comment" character on a line to see if its a continuation -// -static bool IsContinuationLine(unsigned int szLine, Accessor &styler) -{ - int nsPos = styler.LineStart(szLine); - int nePos = styler.LineStart(szLine+1) - 2; - //int stylech = styler.StyleAt(nsPos); - while (nsPos < nePos) - { - //stylech = styler.StyleAt(nePos); - int stylech = styler.StyleAt(nsPos); - if (!(stylech == SCE_AU3_COMMENT)) { - char ch = styler.SafeGetCharAt(nePos); - if (!isspacechar(ch)) { - if (ch == '_') - return true; - else - return false; - } - } - nePos--; // skip to next char - } // End While - return false; -} // IsContinuationLine() - -// -// syntax highlighting logic -static void ColouriseAU3Doc(unsigned int startPos, - int length, int initStyle, - WordList *keywordlists[], - Accessor &styler) { - - WordList &keywords = *keywordlists[0]; - WordList &keywords2 = *keywordlists[1]; - WordList &keywords3 = *keywordlists[2]; - WordList &keywords4 = *keywordlists[3]; - WordList &keywords5 = *keywordlists[4]; - WordList &keywords6 = *keywordlists[5]; - WordList &keywords7 = *keywordlists[6]; - WordList &keywords8 = *keywordlists[7]; - // find the first previous line without continuation character at the end - int lineCurrent = styler.GetLine(startPos); - int s_startPos = startPos; - // When not inside a Block comment: find First line without _ - if (!(initStyle==SCE_AU3_COMMENTBLOCK)) { - while ((lineCurrent > 0 && IsContinuationLine(lineCurrent,styler)) || - (lineCurrent > 1 && IsContinuationLine(lineCurrent-1,styler))) { - lineCurrent--; - startPos = styler.LineStart(lineCurrent); // get start position - initStyle = 0; // reset the start style to 0 - } - } - // Set the new length to include it from the start and set the start position - length = length + s_startPos - startPos; // correct the total length to process - styler.StartAt(startPos); - - StyleContext sc(startPos, length, initStyle, styler); - char si; // string indicator "=1 '=2 - char ni; // Numeric indicator error=9 normal=0 normal+dec=1 hex=2 Enot=3 - char ci; // comment indicator 0=not linecomment(;) - char s_save[100]; - si=0; - ni=0; - ci=0; - //$$$ - for (; sc.More(); sc.Forward()) { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - // ********************************************** - // save the total current word for eof processing - if (IsAWordChar(sc.ch) || sc.ch == '}') - { - strcpy(s_save,s); - int tp = strlen(s_save); - if (tp < 99) { - s_save[tp] = static_cast(tolower(sc.ch)); - s_save[tp+1] = '\0'; - } - } - // ********************************************** - // - switch (sc.state) - { - case SCE_AU3_COMMENTBLOCK: - { - //Reset at line end - if (sc.atLineEnd) { - ci=0; - if ((strcmp(s, "#ce")== 0 || strcmp(s, "#comments-end")== 0)) - if (sc.atLineEnd) - sc.SetState(SCE_AU3_DEFAULT); - else - sc.SetState(SCE_AU3_COMMENTBLOCK); - break; - } - //skip rest of line when a ; is encountered - if (sc.chPrev == ';') { - ci=2; - sc.SetState(SCE_AU3_COMMENTBLOCK); - } - // skip rest of the line - if (ci==2) - break; - // check when first character is detected on the line - if (ci==0) { - if (IsAWordStart(static_cast(sc.ch)) || IsAOperator(static_cast(sc.ch))) { - ci=1; - sc.SetState(SCE_AU3_COMMENTBLOCK); - } - break; - } - if (!(IsAWordChar(sc.ch) || (sc.ch == '-' && strcmp(s, "#comments") == 0))) { - if ((strcmp(s, "#ce")== 0 || strcmp(s, "#comments-end")== 0)) - sc.SetState(SCE_AU3_COMMENT); // set to comment line for the rest of the line - else - ci=2; // line doesn't begin with #CE so skip the rest of the line - } - break; - } - case SCE_AU3_COMMENT: - { - if (sc.atLineEnd) {sc.SetState(SCE_AU3_DEFAULT);} - break; - } - case SCE_AU3_OPERATOR: - { - // check if its a COMobject - if (sc.chPrev == '.' && IsAWordChar(sc.ch)) { - sc.SetState(SCE_AU3_COMOBJ); - } - else { - sc.SetState(SCE_AU3_DEFAULT); - } - break; - } - case SCE_AU3_SPECIAL: - { - if (sc.ch == ';') {sc.SetState(SCE_AU3_COMMENT);} - if (sc.atLineEnd) {sc.SetState(SCE_AU3_DEFAULT);} - break; - } - case SCE_AU3_KEYWORD: - { - if (!(IsAWordChar(sc.ch) || (sc.ch == '-' && (strcmp(s, "#comments") == 0 || strcmp(s, "#include") == 0)))) - { - if (!IsTypeCharacter(sc.ch)) - { - if (strcmp(s, "#cs")== 0 || strcmp(s, "#comments-start")== 0 ) - { - sc.ChangeState(SCE_AU3_COMMENTBLOCK); - sc.SetState(SCE_AU3_COMMENTBLOCK); - break; - } - else if (keywords.InList(s)) { - sc.ChangeState(SCE_AU3_KEYWORD); - sc.SetState(SCE_AU3_DEFAULT); - } - else if (keywords2.InList(s)) { - sc.ChangeState(SCE_AU3_FUNCTION); - sc.SetState(SCE_AU3_DEFAULT); - } - else if (keywords3.InList(s)) { - sc.ChangeState(SCE_AU3_MACRO); - sc.SetState(SCE_AU3_DEFAULT); - } - else if (keywords5.InList(s)) { - sc.ChangeState(SCE_AU3_PREPROCESSOR); - sc.SetState(SCE_AU3_DEFAULT); - if (strcmp(s, "#include")== 0) - { - si = 3; // use to determine string start for #inlude <> - } - } - else if (keywords6.InList(s)) { - sc.ChangeState(SCE_AU3_SPECIAL); - sc.SetState(SCE_AU3_SPECIAL); - } - else if ((keywords7.InList(s)) && (!IsAOperator(static_cast(sc.ch)))) { - sc.ChangeState(SCE_AU3_EXPAND); - sc.SetState(SCE_AU3_DEFAULT); - } - else if (keywords8.InList(s)) { - sc.ChangeState(SCE_AU3_UDF); - sc.SetState(SCE_AU3_DEFAULT); - } - else if (strcmp(s, "_") == 0) { - sc.ChangeState(SCE_AU3_OPERATOR); - sc.SetState(SCE_AU3_DEFAULT); - } - else if (!IsAWordChar(sc.ch)) { - sc.ChangeState(SCE_AU3_DEFAULT); - sc.SetState(SCE_AU3_DEFAULT); - } - } - } - if (sc.atLineEnd) { - sc.SetState(SCE_AU3_DEFAULT);} - break; - } - case SCE_AU3_NUMBER: - { - // Numeric indicator error=9 normal=0 normal+dec=1 hex=2 E-not=3 - // - // test for Hex notation - if (strcmp(s, "0") == 0 && (sc.ch == 'x' || sc.ch == 'X') && ni == 0) - { - ni = 2; - break; - } - // test for E notation - if (IsADigit(sc.chPrev) && (sc.ch == 'e' || sc.ch == 'E') && ni <= 1) - { - ni = 3; - break; - } - // Allow Hex characters inside hex numeric strings - if ((ni == 2) && - (sc.ch == 'a' || sc.ch == 'b' || sc.ch == 'c' || sc.ch == 'd' || sc.ch == 'e' || sc.ch == 'f' || - sc.ch == 'A' || sc.ch == 'B' || sc.ch == 'C' || sc.ch == 'D' || sc.ch == 'E' || sc.ch == 'F' )) - { - break; - } - // test for 1 dec point only - if (sc.ch == '.') - { - if (ni==0) - { - ni=1; - } - else - { - ni=9; - } - break; - } - // end of numeric string ? - if (!(IsADigit(sc.ch))) - { - if (ni==9) - { - sc.ChangeState(SCE_AU3_DEFAULT); - } - sc.SetState(SCE_AU3_DEFAULT); - } - break; - } - case SCE_AU3_VARIABLE: - { - // Check if its a COMObject - if (sc.ch == '.' && !IsADigit(sc.chNext)) { - sc.SetState(SCE_AU3_OPERATOR); - } - else if (!IsAWordChar(sc.ch)) { - sc.SetState(SCE_AU3_DEFAULT); - } - break; - } - case SCE_AU3_COMOBJ: - { - if (!(IsAWordChar(sc.ch))) { - sc.SetState(SCE_AU3_DEFAULT); - } - break; - } - case SCE_AU3_STRING: - { - // check for " to end a double qouted string or - // check for ' to end a single qouted string - if ((si == 1 && sc.ch == '\"') || (si == 2 && sc.ch == '\'') || (si == 3 && sc.ch == '>')) - { - sc.ForwardSetState(SCE_AU3_DEFAULT); - si=0; - break; - } - if (sc.atLineEnd) - { - si=0; - // at line end and not found a continuation char then reset to default - int lineCurrent = styler.GetLine(sc.currentPos); - if (!IsContinuationLine(lineCurrent,styler)) - { - sc.SetState(SCE_AU3_DEFAULT); - break; - } - } - // find Sendkeys in a STRING - if (sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' ) { - sc.SetState(SCE_AU3_SENT);} - break; - } - - case SCE_AU3_SENT: - { - // Send key string ended - if (sc.chPrev == '}' && sc.ch != '}') - { - // set color to SENDKEY when valid sendkey .. else set back to regular string - char sk[100]; - // split {111 222} and return {111} and check if 222 is valid. - // if return code = 1 then invalid 222 so must be string - if (GetSendKey(s,sk)) - { - sc.ChangeState(SCE_AU3_STRING); - } - // if single char between {?} then its ok as sendkey for a single character - else if (strlen(sk) == 3) - { - sc.ChangeState(SCE_AU3_SENT); - } - // if sendkey {111} is in table then ok as sendkey - else if (keywords4.InList(sk)) - { - sc.ChangeState(SCE_AU3_SENT); - } - else - { - sc.ChangeState(SCE_AU3_STRING); - } - sc.SetState(SCE_AU3_STRING); - } - else - { - // check if the start is a valid SendKey start - int nPos = 0; - int nState = 1; - char cTemp; - while (!(nState == 2) && ((cTemp = s[nPos]) != '\0')) - { - if (cTemp == '{' && nState == 1) - { - nState = 2; - } - if (nState == 1 && !(cTemp == '+' || cTemp == '!' || cTemp == '^' || cTemp == '#' )) - { - nState = 0; - } - nPos++; - } - //Verify characters infront of { ... if not assume regular string - if (nState == 1 && (!(sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' ))) { - sc.ChangeState(SCE_AU3_STRING); - sc.SetState(SCE_AU3_STRING); - } - // If invalid character found then assume its a regular string - if (nState == 0) { - sc.ChangeState(SCE_AU3_STRING); - sc.SetState(SCE_AU3_STRING); - } - } - // check if next portion is again a sendkey - if (sc.atLineEnd) - { - sc.ChangeState(SCE_AU3_STRING); - sc.SetState(SCE_AU3_DEFAULT); - si = 0; // reset string indicator - } - //* check in next characters following a sentkey are again a sent key - // Need this test incase of 2 sentkeys like {F1}{ENTER} but not detect {{} - if (sc.state == SCE_AU3_STRING && (sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' )) { - sc.SetState(SCE_AU3_SENT);} - // check to see if the string ended... - // Sendkey string isn't complete but the string ended.... - if ((si == 1 && sc.ch == '\"') || (si == 2 && sc.ch == '\'')) - { - sc.ChangeState(SCE_AU3_STRING); - sc.ForwardSetState(SCE_AU3_DEFAULT); - } - break; - } - } //switch (sc.state) - - // Determine if a new state should be entered: - - if (sc.state == SCE_AU3_DEFAULT) - { - if (sc.ch == ';') {sc.SetState(SCE_AU3_COMMENT);} - else if (sc.ch == '#') {sc.SetState(SCE_AU3_KEYWORD);} - else if (sc.ch == '$') {sc.SetState(SCE_AU3_VARIABLE);} - else if (sc.ch == '.' && !IsADigit(sc.chNext)) {sc.SetState(SCE_AU3_OPERATOR);} - else if (sc.ch == '@') {sc.SetState(SCE_AU3_KEYWORD);} - //else if (sc.ch == '_') {sc.SetState(SCE_AU3_KEYWORD);} - else if (sc.ch == '<' && si==3) {sc.SetState(SCE_AU3_STRING);} // string after #include - else if (sc.ch == '\"') { - sc.SetState(SCE_AU3_STRING); - si = 1; } - else if (sc.ch == '\'') { - sc.SetState(SCE_AU3_STRING); - si = 2; } - else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) - { - sc.SetState(SCE_AU3_NUMBER); - ni = 0; - } - else if (IsAWordStart(sc.ch)) {sc.SetState(SCE_AU3_KEYWORD);} - else if (IsAOperator(static_cast(sc.ch))) {sc.SetState(SCE_AU3_OPERATOR);} - else if (sc.atLineEnd) {sc.SetState(SCE_AU3_DEFAULT);} - } - } //for (; sc.More(); sc.Forward()) - - //************************************* - // Colourize the last word correctly - //************************************* - if (sc.state == SCE_AU3_KEYWORD) - { - if (strcmp(s_save, "#cs")== 0 || strcmp(s_save, "#comments-start")== 0 ) - { - sc.ChangeState(SCE_AU3_COMMENTBLOCK); - sc.SetState(SCE_AU3_COMMENTBLOCK); - } - else if (keywords.InList(s_save)) { - sc.ChangeState(SCE_AU3_KEYWORD); - sc.SetState(SCE_AU3_KEYWORD); - } - else if (keywords2.InList(s_save)) { - sc.ChangeState(SCE_AU3_FUNCTION); - sc.SetState(SCE_AU3_FUNCTION); - } - else if (keywords3.InList(s_save)) { - sc.ChangeState(SCE_AU3_MACRO); - sc.SetState(SCE_AU3_MACRO); - } - else if (keywords5.InList(s_save)) { - sc.ChangeState(SCE_AU3_PREPROCESSOR); - sc.SetState(SCE_AU3_PREPROCESSOR); - } - else if (keywords6.InList(s_save)) { - sc.ChangeState(SCE_AU3_SPECIAL); - sc.SetState(SCE_AU3_SPECIAL); - } - else if (keywords7.InList(s_save) && sc.atLineEnd) { - sc.ChangeState(SCE_AU3_EXPAND); - sc.SetState(SCE_AU3_EXPAND); - } - else if (keywords8.InList(s_save)) { - sc.ChangeState(SCE_AU3_UDF); - sc.SetState(SCE_AU3_UDF); - } - else { - sc.ChangeState(SCE_AU3_DEFAULT); - sc.SetState(SCE_AU3_DEFAULT); - } - } - if (sc.state == SCE_AU3_SENT) - { - // Send key string ended - if (sc.chPrev == '}' && sc.ch != '}') - { - // set color to SENDKEY when valid sendkey .. else set back to regular string - char sk[100]; - // split {111 222} and return {111} and check if 222 is valid. - // if return code = 1 then invalid 222 so must be string - if (GetSendKey(s_save,sk)) - { - sc.ChangeState(SCE_AU3_STRING); - } - // if single char between {?} then its ok as sendkey for a single character - else if (strlen(sk) == 3) - { - sc.ChangeState(SCE_AU3_SENT); - } - // if sendkey {111} is in table then ok as sendkey - else if (keywords4.InList(sk)) - { - sc.ChangeState(SCE_AU3_SENT); - } - else - { - sc.ChangeState(SCE_AU3_STRING); - } - sc.SetState(SCE_AU3_STRING); - } - // check if next portion is again a sendkey - if (sc.atLineEnd) - { - sc.ChangeState(SCE_AU3_STRING); - sc.SetState(SCE_AU3_DEFAULT); - } - } - //************************************* - sc.Complete(); -} - -// -static bool IsStreamCommentStyle(int style) { - return style == SCE_AU3_COMMENT || style == SCE_AU3_COMMENTBLOCK; -} - -// -// Routine to find first none space on the current line and return its Style -// needed for comment lines not starting on pos 1 -static int GetStyleFirstWord(unsigned int szLine, Accessor &styler) -{ - int nsPos = styler.LineStart(szLine); - int nePos = styler.LineStart(szLine+1) - 1; - while (isspacechar(styler.SafeGetCharAt(nsPos)) && nsPos < nePos) - { - nsPos++; // skip to next char - - } // End While - return styler.StyleAt(nsPos); - -} // GetStyleFirstWord() - - -// -static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) -{ - int endPos = startPos + length; - // get settings from the config files for folding comments and preprocessor lines - bool foldComment = styler.GetPropertyInt("fold.comment") != 0; - bool foldInComment = styler.GetPropertyInt("fold.comment") == 2; - bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - bool foldpreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; - // Backtrack to previous line in case need to fix its fold status - int lineCurrent = styler.GetLine(startPos); - if (startPos > 0) { - if (lineCurrent > 0) { - lineCurrent--; - startPos = styler.LineStart(lineCurrent); - } - } - // vars for style of previous/current/next lines - int style = GetStyleFirstWord(lineCurrent,styler); - int stylePrev = 0; - // find the first previous line without continuation character at the end - while ((lineCurrent > 0 && IsContinuationLine(lineCurrent,styler)) || - (lineCurrent > 1 && IsContinuationLine(lineCurrent-1,styler))) { - lineCurrent--; - startPos = styler.LineStart(lineCurrent); - } - if (lineCurrent > 0) { - stylePrev = GetStyleFirstWord(lineCurrent-1,styler); - } - // vars for getting first word to check for keywords - bool FirstWordStart = false; - bool FirstWordEnd = false; - char szKeyword[11]=""; - int szKeywordlen = 0; - char szThen[5]=""; - int szThenlen = 0; - bool ThenFoundLast = false; - // var for indentlevel - int levelCurrent = SC_FOLDLEVELBASE; - if (lineCurrent > 0) - levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; - int levelNext = levelCurrent; - // - int visibleChars = 0; - char chNext = styler.SafeGetCharAt(startPos); - char chPrev = ' '; - // - for (int i = startPos; i < endPos; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - if (IsAWordChar(ch)) { - visibleChars++; - } - // get the syle for the current character neede to check in comment - int stylech = styler.StyleAt(i); - // get first word for the line for indent check max 9 characters - if (FirstWordStart && (!(FirstWordEnd))) { - if (!IsAWordChar(ch)) { - FirstWordEnd = true; - szKeyword[szKeywordlen] = '\0'; - } - else { - if (szKeywordlen < 10) { - szKeyword[szKeywordlen++] = static_cast(tolower(ch)); - } - } - } - // start the capture of the first word - if (!(FirstWordStart)) { - if (IsAWordChar(ch) || IsAWordStart(ch) || ch == ';') { - FirstWordStart = true; - szKeyword[szKeywordlen++] = static_cast(tolower(ch)); - } - } - // only process this logic when not in comment section - if (!(stylech == SCE_AU3_COMMENT)) { - if (ThenFoundLast) { - if (IsAWordChar(ch)) { - ThenFoundLast = false; - } - } - // find out if the word "then" is the last on a "if" line - if (FirstWordEnd && strcmp(szKeyword,"if") == 0) { - if (szThenlen == 4) { - szThen[0] = szThen[1]; - szThen[1] = szThen[2]; - szThen[2] = szThen[3]; - szThen[3] = static_cast(tolower(ch)); - if (strcmp(szThen,"then") == 0 ) { - ThenFoundLast = true; - } - } - else { - szThen[szThenlen++] = static_cast(tolower(ch)); - if (szThenlen == 5) { - szThen[4] = '\0'; - } - } - } - } - // End of Line found so process the information - if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos)) { - // ************************** - // Folding logic for Keywords - // ************************** - // if a keyword is found on the current line and the line doesn't end with _ (continuation) - // and we are not inside a commentblock. - if (szKeywordlen > 0 && (!(chPrev == '_')) && - ((!(IsStreamCommentStyle(style)) || foldInComment)) ) { - szKeyword[szKeywordlen] = '\0'; - // only fold "if" last keyword is "then" (else its a one line if) - if (strcmp(szKeyword,"if") == 0 && ThenFoundLast) { - levelNext++; - } - // create new fold for these words - if (strcmp(szKeyword,"do") == 0 || strcmp(szKeyword,"for") == 0 || - strcmp(szKeyword,"func") == 0 || strcmp(szKeyword,"while") == 0|| - strcmp(szKeyword,"with") == 0 || strcmp(szKeyword,"#region") == 0 ) { - levelNext++; - } - // create double Fold for select&switch because Case will subtract one of the current level - if (strcmp(szKeyword,"select") == 0 || strcmp(szKeyword,"switch") == 0) { - levelNext++; - levelNext++; - } - // end the fold for these words before the current line - if (strcmp(szKeyword,"endfunc") == 0 || strcmp(szKeyword,"endif") == 0 || - strcmp(szKeyword,"next") == 0 || strcmp(szKeyword,"until") == 0 || - strcmp(szKeyword,"endwith") == 0 ||strcmp(szKeyword,"wend") == 0){ - levelNext--; - levelCurrent--; - } - // end the fold for these words before the current line and Start new fold - if (strcmp(szKeyword,"case") == 0 || strcmp(szKeyword,"else") == 0 || - strcmp(szKeyword,"elseif") == 0 ) { - levelCurrent--; - } - // end the double fold for this word before the current line - if (strcmp(szKeyword,"endselect") == 0 || strcmp(szKeyword,"endswitch") == 0 ) { - levelNext--; - levelNext--; - levelCurrent--; - levelCurrent--; - } - // end the fold for these words on the current line - if (strcmp(szKeyword,"#endregion") == 0 ) { - levelNext--; - } - } - // Preprocessor and Comment folding - int styleNext = GetStyleFirstWord(lineCurrent + 1,styler); - // ************************************* - // Folding logic for preprocessor blocks - // ************************************* - // process preprosessor line - if (foldpreprocessor && style == SCE_AU3_PREPROCESSOR) { - if (!(stylePrev == SCE_AU3_PREPROCESSOR) && (styleNext == SCE_AU3_PREPROCESSOR)) { - levelNext++; - } - // fold till the last line for normal comment lines - else if (stylePrev == SCE_AU3_PREPROCESSOR && !(styleNext == SCE_AU3_PREPROCESSOR)) { - levelNext--; - } - } - // ********************************* - // Folding logic for Comment blocks - // ********************************* - if (foldComment && IsStreamCommentStyle(style)) { - // Start of a comment block - if (!(stylePrev==style) && IsStreamCommentStyle(styleNext) && styleNext==style) { - levelNext++; - } - // fold till the last line for normal comment lines - else if (IsStreamCommentStyle(stylePrev) - && !(styleNext == SCE_AU3_COMMENT) - && stylePrev == SCE_AU3_COMMENT - && style == SCE_AU3_COMMENT) { - levelNext--; - } - // fold till the one but last line for Blockcomment lines - else if (IsStreamCommentStyle(stylePrev) - && !(styleNext == SCE_AU3_COMMENTBLOCK) - && style == SCE_AU3_COMMENTBLOCK) { - levelNext--; - levelCurrent--; - } - } - int levelUse = levelCurrent; - int lev = levelUse | levelNext << 16; - if (visibleChars == 0 && foldCompact) - lev |= SC_FOLDLEVELWHITEFLAG; - if (levelUse < levelNext) { - lev |= SC_FOLDLEVELHEADERFLAG; - } - if (lev != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, lev); - } - // reset values for the next line - lineCurrent++; - stylePrev = style; - style = styleNext; - levelCurrent = levelNext; - visibleChars = 0; - // if the last character is an Underscore then don't reset since the line continues on the next line. - if (!(chPrev == '_')) { - szKeywordlen = 0; - szThenlen = 0; - FirstWordStart = false; - FirstWordEnd = false; - ThenFoundLast = false; - } - } - // save the last processed character - if (!isspacechar(ch)) { - chPrev = ch; - visibleChars++; - } - } -} - - -// - -static const char * const AU3WordLists[] = { - "#autoit keywords", - "#autoit functions", - "#autoit macros", - "#autoit Sent keys", - "#autoit Pre-processors", - "#autoit Special", - "#autoit Expand", - "#autoit UDF", - 0 -}; -LexerModule lmAU3(SCLEX_AU3, ColouriseAU3Doc, "au3", FoldAU3Doc , AU3WordLists); +// Scintilla source code edit control +// @file LexAU3.cxx +// Lexer for AutoIt3 http://www.hiddensoft.com/autoit3 +// by Jos van der Zande, jvdzande@yahoo.com +// +// Changes: +// March 28, 2004 - Added the standard Folding code +// April 21, 2004 - Added Preprosessor Table + Syntax Highlighting +// Fixed Number highlighting +// Changed default isoperator to IsAOperator to have a better match to AutoIt3 +// Fixed "#comments_start" -> "#comments-start" +// Fixed "#comments_end" -> "#comments-end" +// Fixed Sendkeys in Strings when not terminated with } +// Added support for Sendkey strings that have second parameter e.g. {UP 5} or {a down} +// April 26, 2004 - Fixed # pre-processor statement inside of comment block would invalidly change the color. +// Added logic for #include to treat the <> as string +// Added underscore to IsAOperator. +// May 17, 2004 - Changed the folding logic from indent to keyword folding. +// Added Folding logic for blocks of single-commentlines or commentblock. +// triggered by: fold.comment=1 +// Added Folding logic for preprocessor blocks triggered by fold.preprocessor=1 +// Added Special for #region - #endregion syntax highlight and folding. +// May 30, 2004 - Fixed issue with continuation lines on If statements. +// June 5, 2004 - Added comma to Operators for better readability. +// Added fold.compact support set with fold.compact=1 +// Changed folding inside of #cs-#ce. Default is no keyword folding inside comment blocks when fold.comment=1 +// it will now only happen when fold.comment=2. +// Sep 5, 2004 - Added logic to handle colourizing words on the last line. +// Typed Characters now show as "default" till they match any table. +// Oct 10, 2004 - Added logic to show Comments in "Special" directives. +// Nov 1, 2004 - Added better testing for Numbers supporting x and e notation. +// Nov 28, 2004 - Added logic to handle continuation lines for syntax highlighting. +// Jan 10, 2005 - Added Abbreviations Keyword used for expansion +// Mar 24, 2005 - Updated Abbreviations Keywords to fix when followed by Operator. +// Apr 18, 2005 - Updated #CE/#Comment-End logic to take a linecomment ";" into account +// - Added folding support for With...EndWith +// - Added support for a DOT in variable names +// - Fixed Underscore in CommentBlock +// May 23, 2005 - Fixed the SentKey lexing in case of a missing } +// Aug 11, 2005 - Fixed possible bug with s_save length > 100. +// Aug 23, 2005 - Added Switch/endswitch support to the folding logic. +// Sep 27, 2005 - Fixed the SentKey lexing logic in case of multiple sentkeys. +// Mar 12, 2006 - Fixed issue with <> coloring as String in stead of Operator in rare occasions. +// Apr 8, 2006 - Added support for AutoIt3 Standard UDF library (SCE_AU3_UDF) +// Mar 9, 2007 - Fixed bug with + following a String getting the wrong Color. +// Jun 20, 2007 - Fixed Commentblock issue when LF's are used as EOL. +// Jul 26, 2007 - Fixed #endregion undetected bug. +// +// Copyright for Scintilla: 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. +// Scintilla source code edit control + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static inline bool IsTypeCharacter(const int ch) +{ + return ch == '$'; +} +static inline bool IsAWordChar(const int ch) +{ + return (ch < 0x80) && (isalnum(ch) || ch == '_'); +} + +static inline bool IsAWordStart(const int ch) +{ + return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '@' || ch == '#' || ch == '$' || ch == '.'); +} + +static inline bool IsAOperator(char ch) { + if (isascii(ch) && isalnum(ch)) + return false; + if (ch == '+' || ch == '-' || ch == '*' || ch == '/' || + ch == '&' || ch == '^' || ch == '=' || ch == '<' || ch == '>' || + ch == '(' || ch == ')' || ch == '[' || ch == ']' || ch == ',' ) + return true; + return false; +} + +/////////////////////////////////////////////////////////////////////////////// +// GetSendKey() filters the portion before and after a/multiple space(s) +// and return the first portion to be looked-up in the table +// also check if the second portion is valid... (up,down.on.off,toggle or a number) +/////////////////////////////////////////////////////////////////////////////// + +static int GetSendKey(const char *szLine, char *szKey) +{ + int nFlag = 0; + int nStartFound = 0; + int nKeyPos = 0; + int nSpecPos= 0; + int nSpecNum= 1; + int nPos = 0; + char cTemp; + char szSpecial[100]; + + // split the portion of the sendkey in the part before and after the spaces + while ( ( (cTemp = szLine[nPos]) != '\0')) + { + // skip leading Ctrl/Shift/Alt state + if (cTemp == '{') { + nStartFound = 1; + } + // + if (nStartFound == 1) { + if ((cTemp == ' ') && (nFlag == 0) ) // get the stuff till first space + { + nFlag = 1; + // Add } to the end of the first bit for table lookup later. + szKey[nKeyPos++] = '}'; + } + else if (cTemp == ' ') + { + // skip other spaces + } + else if (nFlag == 0) + { + // save first portion into var till space or } is hit + szKey[nKeyPos++] = cTemp; + } + else if ((nFlag == 1) && (cTemp != '}')) + { + // Save second portion into var... + szSpecial[nSpecPos++] = cTemp; + // check if Second portion is all numbers for repeat fuction + if (isdigit(cTemp) == false) {nSpecNum = 0;} + } + } + nPos++; // skip to next char + + } // End While + + + // Check if the second portion is either a number or one of these keywords + szKey[nKeyPos] = '\0'; + szSpecial[nSpecPos] = '\0'; + if (strcmp(szSpecial,"down")== 0 || strcmp(szSpecial,"up")== 0 || + strcmp(szSpecial,"on")== 0 || strcmp(szSpecial,"off")== 0 || + strcmp(szSpecial,"toggle")== 0 || nSpecNum == 1 ) + { + nFlag = 0; + } + else + { + nFlag = 1; + } + return nFlag; // 1 is bad, 0 is good + +} // GetSendKey() + +// +// Routine to check the last "none comment" character on a line to see if its a continuation +// +static bool IsContinuationLine(unsigned int szLine, Accessor &styler) +{ + int nsPos = styler.LineStart(szLine); + int nePos = styler.LineStart(szLine+1) - 2; + //int stylech = styler.StyleAt(nsPos); + while (nsPos < nePos) + { + //stylech = styler.StyleAt(nePos); + int stylech = styler.StyleAt(nsPos); + if (!(stylech == SCE_AU3_COMMENT)) { + char ch = styler.SafeGetCharAt(nePos); + if (!isspacechar(ch)) { + if (ch == '_') + return true; + else + return false; + } + } + nePos--; // skip to next char + } // End While + return false; +} // IsContinuationLine() + +// +// syntax highlighting logic +static void ColouriseAU3Doc(unsigned int startPos, + int length, int initStyle, + WordList *keywordlists[], + Accessor &styler) { + + WordList &keywords = *keywordlists[0]; + WordList &keywords2 = *keywordlists[1]; + WordList &keywords3 = *keywordlists[2]; + WordList &keywords4 = *keywordlists[3]; + WordList &keywords5 = *keywordlists[4]; + WordList &keywords6 = *keywordlists[5]; + WordList &keywords7 = *keywordlists[6]; + WordList &keywords8 = *keywordlists[7]; + // find the first previous line without continuation character at the end + int lineCurrent = styler.GetLine(startPos); + int s_startPos = startPos; + // When not inside a Block comment: find First line without _ + if (!(initStyle==SCE_AU3_COMMENTBLOCK)) { + while ((lineCurrent > 0 && IsContinuationLine(lineCurrent,styler)) || + (lineCurrent > 1 && IsContinuationLine(lineCurrent-1,styler))) { + lineCurrent--; + startPos = styler.LineStart(lineCurrent); // get start position + initStyle = 0; // reset the start style to 0 + } + } + // Set the new length to include it from the start and set the start position + length = length + s_startPos - startPos; // correct the total length to process + styler.StartAt(startPos); + + StyleContext sc(startPos, length, initStyle, styler); + char si; // string indicator "=1 '=2 + char ni; // Numeric indicator error=9 normal=0 normal+dec=1 hex=2 Enot=3 + char ci; // comment indicator 0=not linecomment(;) + char s_save[100]; + si=0; + ni=0; + ci=0; + //$$$ + for (; sc.More(); sc.Forward()) { + char s[100]; + sc.GetCurrentLowered(s, sizeof(s)); + // ********************************************** + // save the total current word for eof processing + if (IsAWordChar(sc.ch) || sc.ch == '}') + { + strcpy(s_save,s); + int tp = strlen(s_save); + if (tp < 99) { + s_save[tp] = static_cast(tolower(sc.ch)); + s_save[tp+1] = '\0'; + } + } + // ********************************************** + // + switch (sc.state) + { + case SCE_AU3_COMMENTBLOCK: + { + //Reset at line end + if (sc.atLineEnd) { + ci=0; + if (strcmp(s, "#ce")== 0 || strcmp(s, "#comments-end")== 0) { + if (sc.atLineEnd) + sc.SetState(SCE_AU3_DEFAULT); + else + sc.SetState(SCE_AU3_COMMENTBLOCK); + } + break; + } + //skip rest of line when a ; is encountered + if (sc.chPrev == ';') { + ci=2; + sc.SetState(SCE_AU3_COMMENTBLOCK); + } + // skip rest of the line + if (ci==2) + break; + // check when first character is detected on the line + if (ci==0) { + if (IsAWordStart(static_cast(sc.ch)) || IsAOperator(static_cast(sc.ch))) { + ci=1; + sc.SetState(SCE_AU3_COMMENTBLOCK); + } + break; + } + if (!(IsAWordChar(sc.ch) || (sc.ch == '-' && strcmp(s, "#comments") == 0))) { + if ((strcmp(s, "#ce")== 0 || strcmp(s, "#comments-end")== 0)) + sc.SetState(SCE_AU3_COMMENT); // set to comment line for the rest of the line + else + ci=2; // line doesn't begin with #CE so skip the rest of the line + } + break; + } + case SCE_AU3_COMMENT: + { + if (sc.atLineEnd) {sc.SetState(SCE_AU3_DEFAULT);} + break; + } + case SCE_AU3_OPERATOR: + { + // check if its a COMobject + if (sc.chPrev == '.' && IsAWordChar(sc.ch)) { + sc.SetState(SCE_AU3_COMOBJ); + } + else { + sc.SetState(SCE_AU3_DEFAULT); + } + break; + } + case SCE_AU3_SPECIAL: + { + if (sc.ch == ';') {sc.SetState(SCE_AU3_COMMENT);} + if (sc.atLineEnd) {sc.SetState(SCE_AU3_DEFAULT);} + break; + } + case SCE_AU3_KEYWORD: + { + if (!(IsAWordChar(sc.ch) || (sc.ch == '-' && (strcmp(s, "#comments") == 0 || strcmp(s, "#include") == 0)))) + { + if (!IsTypeCharacter(sc.ch)) + { + if (strcmp(s, "#cs")== 0 || strcmp(s, "#comments-start")== 0 ) + { + sc.ChangeState(SCE_AU3_COMMENTBLOCK); + sc.SetState(SCE_AU3_COMMENTBLOCK); + break; + } + else if (keywords.InList(s)) { + sc.ChangeState(SCE_AU3_KEYWORD); + sc.SetState(SCE_AU3_DEFAULT); + } + else if (keywords2.InList(s)) { + sc.ChangeState(SCE_AU3_FUNCTION); + sc.SetState(SCE_AU3_DEFAULT); + } + else if (keywords3.InList(s)) { + sc.ChangeState(SCE_AU3_MACRO); + sc.SetState(SCE_AU3_DEFAULT); + } + else if (keywords5.InList(s)) { + sc.ChangeState(SCE_AU3_PREPROCESSOR); + sc.SetState(SCE_AU3_DEFAULT); + if (strcmp(s, "#include")== 0) + { + si = 3; // use to determine string start for #inlude <> + } + } + else if (keywords6.InList(s)) { + sc.ChangeState(SCE_AU3_SPECIAL); + sc.SetState(SCE_AU3_SPECIAL); + } + else if ((keywords7.InList(s)) && (!IsAOperator(static_cast(sc.ch)))) { + sc.ChangeState(SCE_AU3_EXPAND); + sc.SetState(SCE_AU3_DEFAULT); + } + else if (keywords8.InList(s)) { + sc.ChangeState(SCE_AU3_UDF); + sc.SetState(SCE_AU3_DEFAULT); + } + else if (strcmp(s, "_") == 0) { + sc.ChangeState(SCE_AU3_OPERATOR); + sc.SetState(SCE_AU3_DEFAULT); + } + else if (!IsAWordChar(sc.ch)) { + sc.ChangeState(SCE_AU3_DEFAULT); + sc.SetState(SCE_AU3_DEFAULT); + } + } + } + if (sc.atLineEnd) { + sc.SetState(SCE_AU3_DEFAULT);} + break; + } + case SCE_AU3_NUMBER: + { + // Numeric indicator error=9 normal=0 normal+dec=1 hex=2 E-not=3 + // + // test for Hex notation + if (strcmp(s, "0") == 0 && (sc.ch == 'x' || sc.ch == 'X') && ni == 0) + { + ni = 2; + break; + } + // test for E notation + if (IsADigit(sc.chPrev) && (sc.ch == 'e' || sc.ch == 'E') && ni <= 1) + { + ni = 3; + break; + } + // Allow Hex characters inside hex numeric strings + if ((ni == 2) && + (sc.ch == 'a' || sc.ch == 'b' || sc.ch == 'c' || sc.ch == 'd' || sc.ch == 'e' || sc.ch == 'f' || + sc.ch == 'A' || sc.ch == 'B' || sc.ch == 'C' || sc.ch == 'D' || sc.ch == 'E' || sc.ch == 'F' )) + { + break; + } + // test for 1 dec point only + if (sc.ch == '.') + { + if (ni==0) + { + ni=1; + } + else + { + ni=9; + } + break; + } + // end of numeric string ? + if (!(IsADigit(sc.ch))) + { + if (ni==9) + { + sc.ChangeState(SCE_AU3_DEFAULT); + } + sc.SetState(SCE_AU3_DEFAULT); + } + break; + } + case SCE_AU3_VARIABLE: + { + // Check if its a COMObject + if (sc.ch == '.' && !IsADigit(sc.chNext)) { + sc.SetState(SCE_AU3_OPERATOR); + } + else if (!IsAWordChar(sc.ch)) { + sc.SetState(SCE_AU3_DEFAULT); + } + break; + } + case SCE_AU3_COMOBJ: + { + if (!(IsAWordChar(sc.ch))) { + sc.SetState(SCE_AU3_DEFAULT); + } + break; + } + case SCE_AU3_STRING: + { + // check for " to end a double qouted string or + // check for ' to end a single qouted string + if ((si == 1 && sc.ch == '\"') || (si == 2 && sc.ch == '\'') || (si == 3 && sc.ch == '>')) + { + sc.ForwardSetState(SCE_AU3_DEFAULT); + si=0; + break; + } + if (sc.atLineEnd) + { + si=0; + // at line end and not found a continuation char then reset to default + int lineCurrent = styler.GetLine(sc.currentPos); + if (!IsContinuationLine(lineCurrent,styler)) + { + sc.SetState(SCE_AU3_DEFAULT); + break; + } + } + // find Sendkeys in a STRING + if (sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' ) { + sc.SetState(SCE_AU3_SENT);} + break; + } + + case SCE_AU3_SENT: + { + // Send key string ended + if (sc.chPrev == '}' && sc.ch != '}') + { + // set color to SENDKEY when valid sendkey .. else set back to regular string + char sk[100]; + // split {111 222} and return {111} and check if 222 is valid. + // if return code = 1 then invalid 222 so must be string + if (GetSendKey(s,sk)) + { + sc.ChangeState(SCE_AU3_STRING); + } + // if single char between {?} then its ok as sendkey for a single character + else if (strlen(sk) == 3) + { + sc.ChangeState(SCE_AU3_SENT); + } + // if sendkey {111} is in table then ok as sendkey + else if (keywords4.InList(sk)) + { + sc.ChangeState(SCE_AU3_SENT); + } + else + { + sc.ChangeState(SCE_AU3_STRING); + } + sc.SetState(SCE_AU3_STRING); + } + else + { + // check if the start is a valid SendKey start + int nPos = 0; + int nState = 1; + char cTemp; + while (!(nState == 2) && ((cTemp = s[nPos]) != '\0')) + { + if (cTemp == '{' && nState == 1) + { + nState = 2; + } + if (nState == 1 && !(cTemp == '+' || cTemp == '!' || cTemp == '^' || cTemp == '#' )) + { + nState = 0; + } + nPos++; + } + //Verify characters infront of { ... if not assume regular string + if (nState == 1 && (!(sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' ))) { + sc.ChangeState(SCE_AU3_STRING); + sc.SetState(SCE_AU3_STRING); + } + // If invalid character found then assume its a regular string + if (nState == 0) { + sc.ChangeState(SCE_AU3_STRING); + sc.SetState(SCE_AU3_STRING); + } + } + // check if next portion is again a sendkey + if (sc.atLineEnd) + { + sc.ChangeState(SCE_AU3_STRING); + sc.SetState(SCE_AU3_DEFAULT); + si = 0; // reset string indicator + } + //* check in next characters following a sentkey are again a sent key + // Need this test incase of 2 sentkeys like {F1}{ENTER} but not detect {{} + if (sc.state == SCE_AU3_STRING && (sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' )) { + sc.SetState(SCE_AU3_SENT);} + // check to see if the string ended... + // Sendkey string isn't complete but the string ended.... + if ((si == 1 && sc.ch == '\"') || (si == 2 && sc.ch == '\'')) + { + sc.ChangeState(SCE_AU3_STRING); + sc.ForwardSetState(SCE_AU3_DEFAULT); + } + break; + } + } //switch (sc.state) + + // Determine if a new state should be entered: + + if (sc.state == SCE_AU3_DEFAULT) + { + if (sc.ch == ';') {sc.SetState(SCE_AU3_COMMENT);} + else if (sc.ch == '#') {sc.SetState(SCE_AU3_KEYWORD);} + else if (sc.ch == '$') {sc.SetState(SCE_AU3_VARIABLE);} + else if (sc.ch == '.' && !IsADigit(sc.chNext)) {sc.SetState(SCE_AU3_OPERATOR);} + else if (sc.ch == '@') {sc.SetState(SCE_AU3_KEYWORD);} + //else if (sc.ch == '_') {sc.SetState(SCE_AU3_KEYWORD);} + else if (sc.ch == '<' && si==3) {sc.SetState(SCE_AU3_STRING);} // string after #include + else if (sc.ch == '\"') { + sc.SetState(SCE_AU3_STRING); + si = 1; } + else if (sc.ch == '\'') { + sc.SetState(SCE_AU3_STRING); + si = 2; } + else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) + { + sc.SetState(SCE_AU3_NUMBER); + ni = 0; + } + else if (IsAWordStart(sc.ch)) {sc.SetState(SCE_AU3_KEYWORD);} + else if (IsAOperator(static_cast(sc.ch))) {sc.SetState(SCE_AU3_OPERATOR);} + else if (sc.atLineEnd) {sc.SetState(SCE_AU3_DEFAULT);} + } + } //for (; sc.More(); sc.Forward()) + + //************************************* + // Colourize the last word correctly + //************************************* + if (sc.state == SCE_AU3_KEYWORD) + { + if (strcmp(s_save, "#cs")== 0 || strcmp(s_save, "#comments-start")== 0 ) + { + sc.ChangeState(SCE_AU3_COMMENTBLOCK); + sc.SetState(SCE_AU3_COMMENTBLOCK); + } + else if (keywords.InList(s_save)) { + sc.ChangeState(SCE_AU3_KEYWORD); + sc.SetState(SCE_AU3_KEYWORD); + } + else if (keywords2.InList(s_save)) { + sc.ChangeState(SCE_AU3_FUNCTION); + sc.SetState(SCE_AU3_FUNCTION); + } + else if (keywords3.InList(s_save)) { + sc.ChangeState(SCE_AU3_MACRO); + sc.SetState(SCE_AU3_MACRO); + } + else if (keywords5.InList(s_save)) { + sc.ChangeState(SCE_AU3_PREPROCESSOR); + sc.SetState(SCE_AU3_PREPROCESSOR); + } + else if (keywords6.InList(s_save)) { + sc.ChangeState(SCE_AU3_SPECIAL); + sc.SetState(SCE_AU3_SPECIAL); + } + else if (keywords7.InList(s_save) && sc.atLineEnd) { + sc.ChangeState(SCE_AU3_EXPAND); + sc.SetState(SCE_AU3_EXPAND); + } + else if (keywords8.InList(s_save)) { + sc.ChangeState(SCE_AU3_UDF); + sc.SetState(SCE_AU3_UDF); + } + else { + sc.ChangeState(SCE_AU3_DEFAULT); + sc.SetState(SCE_AU3_DEFAULT); + } + } + if (sc.state == SCE_AU3_SENT) + { + // Send key string ended + if (sc.chPrev == '}' && sc.ch != '}') + { + // set color to SENDKEY when valid sendkey .. else set back to regular string + char sk[100]; + // split {111 222} and return {111} and check if 222 is valid. + // if return code = 1 then invalid 222 so must be string + if (GetSendKey(s_save,sk)) + { + sc.ChangeState(SCE_AU3_STRING); + } + // if single char between {?} then its ok as sendkey for a single character + else if (strlen(sk) == 3) + { + sc.ChangeState(SCE_AU3_SENT); + } + // if sendkey {111} is in table then ok as sendkey + else if (keywords4.InList(sk)) + { + sc.ChangeState(SCE_AU3_SENT); + } + else + { + sc.ChangeState(SCE_AU3_STRING); + } + sc.SetState(SCE_AU3_STRING); + } + // check if next portion is again a sendkey + if (sc.atLineEnd) + { + sc.ChangeState(SCE_AU3_STRING); + sc.SetState(SCE_AU3_DEFAULT); + } + } + //************************************* + sc.Complete(); +} + +// +static bool IsStreamCommentStyle(int style) { + return style == SCE_AU3_COMMENT || style == SCE_AU3_COMMENTBLOCK; +} + +// +// Routine to find first none space on the current line and return its Style +// needed for comment lines not starting on pos 1 +static int GetStyleFirstWord(unsigned int szLine, Accessor &styler) +{ + int nsPos = styler.LineStart(szLine); + int nePos = styler.LineStart(szLine+1) - 1; + while (isspacechar(styler.SafeGetCharAt(nsPos)) && nsPos < nePos) + { + nsPos++; // skip to next char + + } // End While + return styler.StyleAt(nsPos); + +} // GetStyleFirstWord() + + +// +static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) +{ + int endPos = startPos + length; + // get settings from the config files for folding comments and preprocessor lines + bool foldComment = styler.GetPropertyInt("fold.comment") != 0; + bool foldInComment = styler.GetPropertyInt("fold.comment") == 2; + bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + bool foldpreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; + // Backtrack to previous line in case need to fix its fold status + int lineCurrent = styler.GetLine(startPos); + if (startPos > 0) { + if (lineCurrent > 0) { + lineCurrent--; + startPos = styler.LineStart(lineCurrent); + } + } + // vars for style of previous/current/next lines + int style = GetStyleFirstWord(lineCurrent,styler); + int stylePrev = 0; + // find the first previous line without continuation character at the end + while ((lineCurrent > 0 && IsContinuationLine(lineCurrent,styler)) || + (lineCurrent > 1 && IsContinuationLine(lineCurrent-1,styler))) { + lineCurrent--; + startPos = styler.LineStart(lineCurrent); + } + if (lineCurrent > 0) { + stylePrev = GetStyleFirstWord(lineCurrent-1,styler); + } + // vars for getting first word to check for keywords + bool FirstWordStart = false; + bool FirstWordEnd = false; + char szKeyword[11]=""; + int szKeywordlen = 0; + char szThen[5]=""; + int szThenlen = 0; + bool ThenFoundLast = false; + // var for indentlevel + int levelCurrent = SC_FOLDLEVELBASE; + if (lineCurrent > 0) + levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; + int levelNext = levelCurrent; + // + int visibleChars = 0; + char chNext = styler.SafeGetCharAt(startPos); + char chPrev = ' '; + // + for (int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + if (IsAWordChar(ch)) { + visibleChars++; + } + // get the syle for the current character neede to check in comment + int stylech = styler.StyleAt(i); + // get first word for the line for indent check max 9 characters + if (FirstWordStart && (!(FirstWordEnd))) { + if (!IsAWordChar(ch)) { + FirstWordEnd = true; + szKeyword[szKeywordlen] = '\0'; + } + else { + if (szKeywordlen < 10) { + szKeyword[szKeywordlen++] = static_cast(tolower(ch)); + } + } + } + // start the capture of the first word + if (!(FirstWordStart)) { + if (IsAWordChar(ch) || IsAWordStart(ch) || ch == ';') { + FirstWordStart = true; + szKeyword[szKeywordlen++] = static_cast(tolower(ch)); + } + } + // only process this logic when not in comment section + if (!(stylech == SCE_AU3_COMMENT)) { + if (ThenFoundLast) { + if (IsAWordChar(ch)) { + ThenFoundLast = false; + } + } + // find out if the word "then" is the last on a "if" line + if (FirstWordEnd && strcmp(szKeyword,"if") == 0) { + if (szThenlen == 4) { + szThen[0] = szThen[1]; + szThen[1] = szThen[2]; + szThen[2] = szThen[3]; + szThen[3] = static_cast(tolower(ch)); + if (strcmp(szThen,"then") == 0 ) { + ThenFoundLast = true; + } + } + else { + szThen[szThenlen++] = static_cast(tolower(ch)); + if (szThenlen == 5) { + szThen[4] = '\0'; + } + } + } + } + // End of Line found so process the information + if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos)) { + // ************************** + // Folding logic for Keywords + // ************************** + // if a keyword is found on the current line and the line doesn't end with _ (continuation) + // and we are not inside a commentblock. + if (szKeywordlen > 0 && (!(chPrev == '_')) && + ((!(IsStreamCommentStyle(style)) || foldInComment)) ) { + szKeyword[szKeywordlen] = '\0'; + // only fold "if" last keyword is "then" (else its a one line if) + if (strcmp(szKeyword,"if") == 0 && ThenFoundLast) { + levelNext++; + } + // create new fold for these words + if (strcmp(szKeyword,"do") == 0 || strcmp(szKeyword,"for") == 0 || + strcmp(szKeyword,"func") == 0 || strcmp(szKeyword,"while") == 0|| + strcmp(szKeyword,"with") == 0 || strcmp(szKeyword,"#region") == 0 ) { + levelNext++; + } + // create double Fold for select&switch because Case will subtract one of the current level + if (strcmp(szKeyword,"select") == 0 || strcmp(szKeyword,"switch") == 0) { + levelNext++; + levelNext++; + } + // end the fold for these words before the current line + if (strcmp(szKeyword,"endfunc") == 0 || strcmp(szKeyword,"endif") == 0 || + strcmp(szKeyword,"next") == 0 || strcmp(szKeyword,"until") == 0 || + strcmp(szKeyword,"endwith") == 0 ||strcmp(szKeyword,"wend") == 0){ + levelNext--; + levelCurrent--; + } + // end the fold for these words before the current line and Start new fold + if (strcmp(szKeyword,"case") == 0 || strcmp(szKeyword,"else") == 0 || + strcmp(szKeyword,"elseif") == 0 ) { + levelCurrent--; + } + // end the double fold for this word before the current line + if (strcmp(szKeyword,"endselect") == 0 || strcmp(szKeyword,"endswitch") == 0 ) { + levelNext--; + levelNext--; + levelCurrent--; + levelCurrent--; + } + // end the fold for these words on the current line + if (strcmp(szKeyword,"#endregion") == 0 ) { + levelNext--; + } + } + // Preprocessor and Comment folding + int styleNext = GetStyleFirstWord(lineCurrent + 1,styler); + // ************************************* + // Folding logic for preprocessor blocks + // ************************************* + // process preprosessor line + if (foldpreprocessor && style == SCE_AU3_PREPROCESSOR) { + if (!(stylePrev == SCE_AU3_PREPROCESSOR) && (styleNext == SCE_AU3_PREPROCESSOR)) { + levelNext++; + } + // fold till the last line for normal comment lines + else if (stylePrev == SCE_AU3_PREPROCESSOR && !(styleNext == SCE_AU3_PREPROCESSOR)) { + levelNext--; + } + } + // ********************************* + // Folding logic for Comment blocks + // ********************************* + if (foldComment && IsStreamCommentStyle(style)) { + // Start of a comment block + if (!(stylePrev==style) && IsStreamCommentStyle(styleNext) && styleNext==style) { + levelNext++; + } + // fold till the last line for normal comment lines + else if (IsStreamCommentStyle(stylePrev) + && !(styleNext == SCE_AU3_COMMENT) + && stylePrev == SCE_AU3_COMMENT + && style == SCE_AU3_COMMENT) { + levelNext--; + } + // fold till the one but last line for Blockcomment lines + else if (IsStreamCommentStyle(stylePrev) + && !(styleNext == SCE_AU3_COMMENTBLOCK) + && style == SCE_AU3_COMMENTBLOCK) { + levelNext--; + levelCurrent--; + } + } + int levelUse = levelCurrent; + int lev = levelUse | levelNext << 16; + if (visibleChars == 0 && foldCompact) + lev |= SC_FOLDLEVELWHITEFLAG; + if (levelUse < levelNext) { + lev |= SC_FOLDLEVELHEADERFLAG; + } + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + // reset values for the next line + lineCurrent++; + stylePrev = style; + style = styleNext; + levelCurrent = levelNext; + visibleChars = 0; + // if the last character is an Underscore then don't reset since the line continues on the next line. + if (!(chPrev == '_')) { + szKeywordlen = 0; + szThenlen = 0; + FirstWordStart = false; + FirstWordEnd = false; + ThenFoundLast = false; + } + } + // save the last processed character + if (!isspacechar(ch)) { + chPrev = ch; + visibleChars++; + } + } +} + + +// + +static const char * const AU3WordLists[] = { + "#autoit keywords", + "#autoit functions", + "#autoit macros", + "#autoit Sent keys", + "#autoit Pre-processors", + "#autoit Special", + "#autoit Expand", + "#autoit UDF", + 0 +}; +LexerModule lmAU3(SCLEX_AU3, ColouriseAU3Doc, "au3", FoldAU3Doc , AU3WordLists); diff --git a/sdk/wxscintilla/src/scintilla/src/LexAbaqus.cxx b/sdk/wxscintilla/src/scintilla/src/LexAbaqus.cxx index f0c3780886..10e8b76b1e 100644 --- a/sdk/wxscintilla/src/scintilla/src/LexAbaqus.cxx +++ b/sdk/wxscintilla/src/scintilla/src/LexAbaqus.cxx @@ -1,260 +1,617 @@ -// Scintilla source code edit control -/** @file LexABAQUS.cxx - ** Lexer for ABAQUS. Based on the lexer for APDL by Hadar Raz. - ** By Sergio Lucato. - **/ -// The License.txt file describes the conditions under which this software may be distributed. - -// Code folding copyied and modified from LexBasic.cxx - -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -static inline bool IsAWordChar(const int ch) { - return (ch < 0x80 && (isalnum(ch) || ch == '_')); -} - -static inline bool IsAnOperator(char ch) { - // '.' left out as it is used to make up numbers - if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || - ch == '(' || ch == ')' || ch == '=' || ch == '^' || - ch == '[' || ch == ']' || ch == '<' || ch == '&' || - ch == '>' || ch == ',' || ch == '|' || ch == '~' || - ch == '$' || ch == ':' || ch == '%') - return true; - return false; -} - -static void ColouriseABAQUSDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], - Accessor &styler) { - - int stringStart = ' '; - - WordList &processors = *keywordlists[0]; - WordList &commands = *keywordlists[1]; - WordList &slashcommands = *keywordlists[2]; - WordList &starcommands = *keywordlists[3]; - WordList &arguments = *keywordlists[4]; - WordList &functions = *keywordlists[5]; - - // Do not leak onto next line - initStyle = SCE_ABAQUS_DEFAULT; - StyleContext sc(startPos, length, initStyle, styler); - - for (; sc.More(); sc.Forward()) { - // Determine if the current state should terminate. - if (sc.state == SCE_ABAQUS_NUMBER) { - if (!(IsADigit(sc.ch) || sc.ch == '.' || (sc.ch == 'e' || sc.ch == 'E') || - ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) { - sc.SetState(SCE_ABAQUS_DEFAULT); - } - } else if (sc.state == SCE_ABAQUS_COMMENT) { - if (sc.atLineEnd) { - sc.SetState(SCE_ABAQUS_DEFAULT); - } - } else if (sc.state == SCE_ABAQUS_COMMENTBLOCK) { - if (sc.atLineEnd) { - if (sc.ch == '\r') { - sc.Forward(); - } - sc.ForwardSetState(SCE_ABAQUS_DEFAULT); - } - } else if (sc.state == SCE_ABAQUS_STRING) { - if (sc.atLineEnd) { - sc.SetState(SCE_ABAQUS_DEFAULT); - } else if ((sc.ch == '\'' && stringStart == '\'') || (sc.ch == '\"' && stringStart == '\"')) { - sc.ForwardSetState(SCE_ABAQUS_DEFAULT); - } - } else if (sc.state == SCE_ABAQUS_WORD) { - if (!IsAWordChar(sc.ch)) { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - if (processors.InList(s)) { - sc.ChangeState(SCE_ABAQUS_PROCESSOR); - } else if (slashcommands.InList(s)) { - sc.ChangeState(SCE_ABAQUS_SLASHCOMMAND); - } else if (starcommands.InList(s)) { - sc.ChangeState(SCE_ABAQUS_STARCOMMAND); - } else if (commands.InList(s)) { - sc.ChangeState(SCE_ABAQUS_COMMAND); - } else if (arguments.InList(s)) { - sc.ChangeState(SCE_ABAQUS_ARGUMENT); - } else if (functions.InList(s)) { - sc.ChangeState(SCE_ABAQUS_FUNCTION); - } - sc.SetState(SCE_ABAQUS_DEFAULT); - } - } else if (sc.state == SCE_ABAQUS_OPERATOR) { - if (!IsAnOperator(static_cast(sc.ch))) { - sc.SetState(SCE_ABAQUS_DEFAULT); - } - } - - // Determine if a new state should be entered. - if (sc.state == SCE_ABAQUS_DEFAULT) { - if (sc.ch == '*' && sc.chNext == '*') { - sc.SetState(SCE_ABAQUS_COMMENTBLOCK); - } else if (sc.ch == '!') { - sc.SetState(SCE_ABAQUS_COMMENT); - } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { - sc.SetState(SCE_ABAQUS_NUMBER); - } else if (sc.ch == '\'' || sc.ch == '\"') { - sc.SetState(SCE_ABAQUS_STRING); - stringStart = sc.ch; - } else if (IsAWordChar(sc.ch) || ((sc.ch == '*' || sc.ch == '/') && !isgraph(sc.chPrev))) { - sc.SetState(SCE_ABAQUS_WORD); - } else if (IsAnOperator(static_cast(sc.ch))) { - sc.SetState(SCE_ABAQUS_OPERATOR); - } - } - } - sc.Complete(); -} - -//------------------------------------------------------------------------------ -// This copyied and modified from LexBasic.cxx -//------------------------------------------------------------------------------ - -/* Bits: - * 1 - whitespace - * 2 - operator - * 4 - identifier - * 8 - decimal digit - * 16 - hex digit - * 32 - bin digit - */ -static int character_classification[128] = -{ - 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, 2, 0, 2, 2, 2, 2, 2, 2, 2, 6, 2, 2, 2, 10, 6, - 60, 60, 28, 28, 28, 28, 28, 28, 28, 28, 2, 2, 2, 2, 2, 2, - 2, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 4, - 2, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 0 -}; - -static bool IsSpace(int c) { - return c < 128 && (character_classification[c] & 1); -} - -static bool IsIdentifier(int c) { - return c < 128 && (character_classification[c] & 4); -} - -static int LowerCase(int c) -{ - if (c >= 'A' && c <= 'Z') - return 'a' + c - 'A'; - return c; -} - -static int CheckABAQUSFoldPoint(char const *token, int &level) { - if (!strcmp(token, "*step") || - !strcmp(token, "*part") || - !strcmp(token, "*instance") || - !strcmp(token, "*assembly") || - !strcmp(token, "***region") ) { - level |= SC_FOLDLEVELHEADERFLAG; - return 1; - } - if (!strcmp(token, "*end step") || - !strcmp(token, "*end part") || - !strcmp(token, "*end instance") || - !strcmp(token, "*end assembly") || - !strcmp(token, "***end region") ) { - return -1; - } - return 0; -} - -static void FoldABAQUSDoc(unsigned int startPos, int length, int, - WordList *[], Accessor &styler) { - - int line = styler.GetLine(startPos); - int level = styler.LevelAt(line); - int go = 0, done = 0; - int endPos = startPos + length; - char word[256]; - int wordlen = 0; - int i; - bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - // Scan for tokens at the start of the line (they may include - // whitespace, for tokens like "End Function" - for (i = startPos; i < endPos; i++) { - int c = styler.SafeGetCharAt(i); - if (!done && !go) { - if (wordlen) { // are we scanning a token already? - word[wordlen] = static_cast(LowerCase(c)); - if (!IsIdentifier(c)) { // done with token - word[wordlen] = '\0'; - go = CheckABAQUSFoldPoint(word, level); - if (!go) { - // Treat any whitespace as single blank, for - // things like "End Function". - if (IsSpace(c) && IsIdentifier(word[wordlen - 1])) { - word[wordlen] = ' '; - if (wordlen < 255) - wordlen++; - } - else // done with this line - done = 1; - } - } else if (wordlen < 255) { - wordlen++; - } - } else { // start scanning at first non-whitespace character - if (!IsSpace(c)) { - if (IsIdentifier(c)) { - word[0] = static_cast(LowerCase(c)); - wordlen = 1; - } else // done with this line - done = 1; - } - } - } - if (c == '\n') { // line end - if (!done && wordlen == 0 && foldCompact) // line was only space - level |= SC_FOLDLEVELWHITEFLAG; - if (level != styler.LevelAt(line)) - styler.SetLevel(line, level); - level += go; - line++; - // reset state - wordlen = 0; - level &= ~SC_FOLDLEVELHEADERFLAG; - level &= ~SC_FOLDLEVELWHITEFLAG; - go = 0; - done = 0; - } - } -} - -static const char * const abaqusWordListDesc[] = { - "processors", - "commands", - "slashommands", - "starcommands", - "arguments", - "functions", - 0 -}; - -LexerModule lmAbaqus(SCLEX_ABAQUS, ColouriseABAQUSDoc, "abaqus", FoldABAQUSDoc, abaqusWordListDesc); +// Scintilla source code edit control +/** @file LexABAQUS.cxx + ** Lexer for ABAQUS. Based on the lexer for APDL by Hadar Raz. + ** By Sergio Lucato. + ** Sort of completely rewritten by Gertjan Kloosterman + **/ +// The License.txt file describes the conditions under which this software may be distributed. + +// Code folding copyied and modified from LexBasic.cxx + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static inline bool IsAWordChar(const int ch) { + return (ch < 0x80 && (isalnum(ch) || (ch == '_'))); +} + +static inline bool IsAKeywordChar(const int ch) { + return (ch < 0x80 && (isalnum(ch) || (ch == '_') || (ch == ' '))); +} + +static inline bool IsASetChar(const int ch) { + return (ch < 0x80 && (isalnum(ch) || (ch == '_') || (ch == '.') || (ch == '-'))); +} + +static inline bool IsAnOperator(char ch) { + // '.' left out as it is used to make up numbers + if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || + ch == '(' || ch == ')' || ch == '=' || ch == '^' || + ch == '[' || ch == ']' || ch == '<' || ch == '&' || + ch == '>' || ch == ',' || ch == '|' || ch == '~' || + ch == '$' || ch == ':' || ch == '%') + return true; + return false; +} + +static void ColouriseABAQUSDoc(unsigned int startPos, int length, int initStyle, WordList*[] /* *keywordlists[] */, + Accessor &styler) { + enum localState { KW_LINE_KW, KW_LINE_COMMA, KW_LINE_PAR, KW_LINE_EQ, KW_LINE_VAL, \ + DAT_LINE_VAL, DAT_LINE_COMMA,\ + COMMENT_LINE,\ + ST_ERROR, LINE_END } state ; + + // Do not leak onto next line + state = LINE_END ; + initStyle = SCE_ABAQUS_DEFAULT; + StyleContext sc(startPos, length, initStyle, styler); + + // Things are actually quite simple + // we have commentlines + // keywordlines and datalines + // On a data line there will only be colouring of numbers + // a keyword line is constructed as + // *word,[ paramname[=paramvalue]]* + // if the line ends with a , the keyword line continues onto the new line + + for (; sc.More(); sc.Forward()) { + switch ( state ) { + case KW_LINE_KW : + if ( sc.atLineEnd ) { + // finished the line in keyword state, switch to LINE_END + sc.SetState(SCE_ABAQUS_DEFAULT) ; + state = LINE_END ; + } else if ( IsAKeywordChar(sc.ch) ) { + // nothing changes + state = KW_LINE_KW ; + } else if ( sc.ch == ',' ) { + // Well well we say a comma, arguments *MUST* follow + sc.SetState(SCE_ABAQUS_OPERATOR) ; + state = KW_LINE_COMMA ; + } else { + // Flag an error + sc.SetState(SCE_ABAQUS_PROCESSOR) ; + state = ST_ERROR ; + } + // Done with processing + break ; + case KW_LINE_COMMA : + // acomma on a keywordline was seen + if ( IsAKeywordChar(sc.ch)) { + sc.SetState(SCE_ABAQUS_ARGUMENT) ; + state = KW_LINE_PAR ; + } else if ( sc.atLineEnd || (sc.ch == ',') ) { + // we remain in keyword mode + state = KW_LINE_COMMA ; + } else if ( sc.ch == ' ' ) { + sc.SetState(SCE_ABAQUS_DEFAULT) ; + state = KW_LINE_COMMA ; + } else { + // Anything else constitutes an error + sc.SetState(SCE_ABAQUS_PROCESSOR) ; + state = ST_ERROR ; + } + break ; + case KW_LINE_PAR : + if ( sc.atLineEnd ) { + sc.SetState(SCE_ABAQUS_DEFAULT) ; + state = LINE_END ; + } else if ( IsAKeywordChar(sc.ch) || (sc.ch == '-') ) { + // remain in this state + state = KW_LINE_PAR ; + } else if ( sc.ch == ',' ) { + sc.SetState(SCE_ABAQUS_OPERATOR) ; + state = KW_LINE_COMMA ; + } else if ( sc.ch == '=' ) { + sc.SetState(SCE_ABAQUS_OPERATOR) ; + state = KW_LINE_EQ ; + } else { + // Anything else constitutes an error + sc.SetState(SCE_ABAQUS_PROCESSOR) ; + state = ST_ERROR ; + } + break ; + case KW_LINE_EQ : + if ( sc.ch == ' ' ) { + sc.SetState(SCE_ABAQUS_DEFAULT) ; + // remain in this state + state = KW_LINE_EQ ; + } else if ( IsADigit(sc.ch) || (sc.ch == '-') || (sc.ch == '.' && IsADigit(sc.chNext)) ) { + sc.SetState(SCE_ABAQUS_NUMBER) ; + state = KW_LINE_VAL ; + } else if ( IsAKeywordChar(sc.ch) ) { + sc.SetState(SCE_ABAQUS_DEFAULT) ; + state = KW_LINE_VAL ; + } else if ( (sc.ch == '\'') || (sc.ch == '\"') ) { + sc.SetState(SCE_ABAQUS_STRING) ; + state = KW_LINE_VAL ; + } else { + sc.SetState(SCE_ABAQUS_PROCESSOR) ; + state = ST_ERROR ; + } + break ; + case KW_LINE_VAL : + if ( sc.atLineEnd ) { + sc.SetState(SCE_ABAQUS_DEFAULT) ; + state = LINE_END ; + } else if ( IsASetChar(sc.ch) && (sc.state == SCE_ABAQUS_DEFAULT) ) { + // nothing changes + state = KW_LINE_VAL ; + } else if (( (IsADigit(sc.ch) || sc.ch == '.' || (sc.ch == 'e' || sc.ch == 'E') || + ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) && + (sc.state == SCE_ABAQUS_NUMBER)) { + // remain in number mode + state = KW_LINE_VAL ; + } else if (sc.state == SCE_ABAQUS_STRING) { + // accept everything until a closing quote + if ( sc.ch == '\'' || sc.ch == '\"' ) { + sc.SetState(SCE_ABAQUS_DEFAULT) ; + state = KW_LINE_VAL ; + } + } else if ( sc.ch == ',' ) { + sc.SetState(SCE_ABAQUS_OPERATOR) ; + state = KW_LINE_COMMA ; + } else { + // anything else is an error + sc.SetState(SCE_ABAQUS_PROCESSOR) ; + state = ST_ERROR ; + } + break ; + case DAT_LINE_VAL : + if ( sc.atLineEnd ) { + sc.SetState(SCE_ABAQUS_DEFAULT) ; + state = LINE_END ; + } else if ( IsASetChar(sc.ch) && (sc.state == SCE_ABAQUS_DEFAULT) ) { + // nothing changes + state = DAT_LINE_VAL ; + } else if (( (IsADigit(sc.ch) || sc.ch == '.' || (sc.ch == 'e' || sc.ch == 'E') || + ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) && + (sc.state == SCE_ABAQUS_NUMBER)) { + // remain in number mode + state = DAT_LINE_VAL ; + } else if (sc.state == SCE_ABAQUS_STRING) { + // accept everything until a closing quote + if ( sc.ch == '\'' || sc.ch == '\"' ) { + sc.SetState(SCE_ABAQUS_DEFAULT) ; + state = DAT_LINE_VAL ; + } + } else if ( sc.ch == ',' ) { + sc.SetState(SCE_ABAQUS_OPERATOR) ; + state = DAT_LINE_COMMA ; + } else { + // anything else is an error + sc.SetState(SCE_ABAQUS_PROCESSOR) ; + state = ST_ERROR ; + } + break ; + case DAT_LINE_COMMA : + // a comma on a data line was seen + if ( sc.atLineEnd ) { + sc.SetState(SCE_ABAQUS_DEFAULT) ; + state = LINE_END ; + } else if ( sc.ch == ' ' ) { + sc.SetState(SCE_ABAQUS_DEFAULT) ; + state = DAT_LINE_COMMA ; + } else if (sc.ch == ',') { + sc.SetState(SCE_ABAQUS_OPERATOR) ; + state = DAT_LINE_COMMA ; + } else if ( IsADigit(sc.ch) || (sc.ch == '-')|| (sc.ch == '.' && IsADigit(sc.chNext)) ) { + sc.SetState(SCE_ABAQUS_NUMBER) ; + state = DAT_LINE_VAL ; + } else if ( IsAKeywordChar(sc.ch) ) { + sc.SetState(SCE_ABAQUS_DEFAULT) ; + state = DAT_LINE_VAL ; + } else if ( (sc.ch == '\'') || (sc.ch == '\"') ) { + sc.SetState(SCE_ABAQUS_STRING) ; + state = DAT_LINE_VAL ; + } else { + sc.SetState(SCE_ABAQUS_PROCESSOR) ; + state = ST_ERROR ; + } + break ; + case COMMENT_LINE : + if ( sc.atLineEnd ) { + sc.SetState(SCE_ABAQUS_DEFAULT) ; + state = LINE_END ; + } + break ; + case ST_ERROR : + if ( sc.atLineEnd ) { + sc.SetState(SCE_ABAQUS_DEFAULT) ; + state = LINE_END ; + } + break ; + case LINE_END : + if ( sc.atLineEnd || sc.ch == ' ' ) { + // nothing changes + state = LINE_END ; + } else if ( sc.ch == '*' ) { + if ( sc.chNext == '*' ) { + state = COMMENT_LINE ; + sc.SetState(SCE_ABAQUS_COMMENT) ; + } else { + state = KW_LINE_KW ; + sc.SetState(SCE_ABAQUS_STARCOMMAND) ; + } + } else { + // it must be a data line, things are as if we are in DAT_LINE_COMMA + if ( sc.ch == ',' ) { + sc.SetState(SCE_ABAQUS_OPERATOR) ; + state = DAT_LINE_COMMA ; + } else if ( IsADigit(sc.ch) || (sc.ch == '-')|| (sc.ch == '.' && IsADigit(sc.chNext)) ) { + sc.SetState(SCE_ABAQUS_NUMBER) ; + state = DAT_LINE_VAL ; + } else if ( IsAKeywordChar(sc.ch) ) { + sc.SetState(SCE_ABAQUS_DEFAULT) ; + state = DAT_LINE_VAL ; + } else if ( (sc.ch == '\'') || (sc.ch == '\"') ) { + sc.SetState(SCE_ABAQUS_STRING) ; + state = DAT_LINE_VAL ; + } else { + sc.SetState(SCE_ABAQUS_PROCESSOR) ; + state = ST_ERROR ; + } + } + break ; + } + } + sc.Complete(); +} + +//------------------------------------------------------------------------------ +// This copyied and modified from LexBasic.cxx +//------------------------------------------------------------------------------ + +/* Bits: + * 1 - whitespace + * 2 - operator + * 4 - identifier + * 8 - decimal digit + * 16 - hex digit + * 32 - bin digit + */ +static int character_classification[128] = +{ + 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, 2, 0, 2, 2, 2, 2, 2, 2, 2, 6, 2, 2, 2, 10, 6, + 60, 60, 28, 28, 28, 28, 28, 28, 28, 28, 2, 2, 2, 2, 2, 2, + 2, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 4, + 2, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4, + 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 0 +}; + +static bool IsSpace(int c) { + return c < 128 && (character_classification[c] & 1); +} + +static bool IsIdentifier(int c) { + return c < 128 && (character_classification[c] & 4); +} + +static int LowerCase(int c) +{ + if (c >= 'A' && c <= 'Z') + return 'a' + c - 'A'; + return c; +} + +static int LineEnd(int line, Accessor &styler) +{ + const int docLines = styler.GetLine(styler.Length() - 1); // Available last line + int eol_pos ; + // if the line is the last line, the eol_pos is styler.Length() + // eol will contain a new line, or a virtual new line + if ( docLines == line ) + eol_pos = styler.Length() ; + else + eol_pos = styler.LineStart(line + 1) - 1; + return eol_pos ; +} + +static int LineStart(int line, Accessor &styler) +{ + return styler.LineStart(line) ; +} + +// LineType +// +// bits determines the line type +// 1 : data line +// 2 : only whitespace +// 3 : data line with only whitespace +// 4 : keyword line +// 5 : block open keyword line +// 6 : block close keyword line +// 7 : keyword line in error +// 8 : comment line +static int LineType(int line, Accessor &styler) { + int pos = LineStart(line, styler) ; + int eol_pos = LineEnd(line, styler) ; + + int c ; + char ch = ' '; + + int i = pos ; + while ( i < eol_pos ) { + c = styler.SafeGetCharAt(i); + ch = static_cast(LowerCase(c)); + // We can say something as soon as no whitespace + // was encountered + if ( !IsSpace(c) ) + break ; + i++ ; + } + + if ( i >= eol_pos ) { + // This is a whitespace line, currently + // classifies as data line + return 3 ; + } + + if ( ch != '*' ) { + // This is a data line + return 1 ; + } + + if ( i == eol_pos - 1 ) { + // Only a single *, error but make keyword line + return 4+3 ; + } + + // This means we can have a second character + // if that is also a * this means a comment + // otherwise it is a keyword. + c = styler.SafeGetCharAt(i+1); + ch = static_cast(LowerCase(c)); + if ( ch == '*' ) { + return 8 ; + } + + // At this point we know this is a keyword line + // the character at position i is a * + // it is not a comment line + char word[256] ; + int wlen = 0; + + word[wlen] = '*' ; + wlen++ ; + + i++ ; + while ( (i < eol_pos) && (wlen < 255) ) { + c = styler.SafeGetCharAt(i); + ch = static_cast(LowerCase(c)); + + if ( (!IsSpace(c)) && (!IsIdentifier(c)) ) + break ; + + if ( IsIdentifier(c) ) { + word[wlen] = ch ; + wlen++ ; + } + + i++ ; + } + + word[wlen] = 0 ; + + // Make a comparison + if ( !strcmp(word, "*step") || + !strcmp(word, "*part") || + !strcmp(word, "*instance") || + !strcmp(word, "*assembly")) { + return 4+1 ; + } + + if ( !strcmp(word, "*endstep") || + !strcmp(word, "*endpart") || + !strcmp(word, "*endinstance") || + !strcmp(word, "*endassembly")) { + return 4+2 ; + } + + return 4 ; +} + +static void SafeSetLevel(int line, int level, Accessor &styler) +{ + if ( line < 0 ) + return ; + + int mask = ((~SC_FOLDLEVELHEADERFLAG) | (~SC_FOLDLEVELWHITEFLAG)); + + if ( (level & mask) < 0 ) + return ; + + if ( styler.LevelAt(line) != level ) + styler.SetLevel(line, level) ; +} + +static void FoldABAQUSDoc(unsigned int startPos, int length, int, +WordList *[], Accessor &styler) { + int startLine = styler.GetLine(startPos) ; + int endLine = styler.GetLine(startPos+length-1) ; + + // bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + // We want to deal with all the cases + // To know the correct indentlevel, we need to look back to the + // previous command line indentation level + // order of formatting keyline datalines commentlines + int beginData = -1 ; + int beginComment = -1 ; + int prvKeyLine = startLine ; + int prvKeyLineTp = 0 ; + + // Scan until we find the previous keyword line + // this will give us the level reference that we need + while ( prvKeyLine > 0 ) { + prvKeyLine-- ; + prvKeyLineTp = LineType(prvKeyLine, styler) ; + if ( prvKeyLineTp & 4 ) + break ; + } + + // Determine the base line level of all lines following + // the previous keyword + // new keyword lines are placed on this level + //if ( prvKeyLineTp & 4 ) { + int level = styler.LevelAt(prvKeyLine) & ~SC_FOLDLEVELHEADERFLAG ; + //} + + // uncomment line below if weird behaviour continues + prvKeyLine = -1 ; + + // Now start scanning over the lines. + for ( int line = startLine; line <= endLine; line++ ) { + int lineType = LineType(line, styler) ; + + // Check for comment line + if ( lineType == 8 ) { + if ( beginComment < 0 ) { + beginComment = line ; + } + } + + // Check for data line + if ( (lineType == 1) || (lineType == 3) ) { + if ( beginData < 0 ) { + if ( beginComment >= 0 ) { + beginData = beginComment ; + } else { + beginData = line ; + } + } + beginComment = -1 ; + } + + // Check for keywordline. + // As soon as a keyword line is encountered, we can set the + // levels of everything from the previous keyword line to this one + if ( lineType & 4 ) { + // this is a keyword, we can now place the previous keyword + // all its data lines and the remainder + + // Write comments and data line + if ( beginComment < 0 ) { + beginComment = line ; + } + + if ( beginData < 0 ) { + beginData = beginComment ; + if ( prvKeyLineTp != 5 ) + SafeSetLevel(prvKeyLine, level, styler) ; + else + SafeSetLevel(prvKeyLine, level | SC_FOLDLEVELHEADERFLAG, styler) ; + } else { + SafeSetLevel(prvKeyLine, level | SC_FOLDLEVELHEADERFLAG, styler) ; + } + + int datLevel = level + 1 ; + if ( !(prvKeyLineTp & 4) ) { + datLevel = level ; + } + + for ( int ll = beginData; ll < beginComment; ll++ ) + SafeSetLevel(ll, datLevel, styler) ; + + // The keyword we just found is going to be written at another level + // if we have a type 5 and type 6 + if ( prvKeyLineTp == 5 ) { + level += 1 ; + } + + if ( prvKeyLineTp == 6 ) { + level -= 1 ; + if ( level < 0 ) { + level = 0 ; + } + } + + for ( int lll = beginComment; lll < line; lll++ ) + SafeSetLevel(lll, level, styler) ; + + // wrap and reset + beginComment = -1 ; + beginData = -1 ; + prvKeyLine = line ; + prvKeyLineTp = lineType ; + } + + } + + if ( beginComment < 0 ) { + beginComment = endLine + 1 ; + } else { + // We need to find out whether this comment block is followed by + // a data line or a keyword line + const int docLines = styler.GetLine(styler.Length() - 1); + + for ( int line = endLine + 1; line <= docLines; line++ ) { + int lineType = LineType(line, styler) ; + + if ( lineType != 8 ) { + if ( !(lineType & 4) ) { + beginComment = endLine + 1 ; + } + break ; + } + } + } + + if ( beginData < 0 ) { + beginData = beginComment ; + if ( prvKeyLineTp != 5 ) + SafeSetLevel(prvKeyLine, level, styler) ; + else + SafeSetLevel(prvKeyLine, level | SC_FOLDLEVELHEADERFLAG, styler) ; + } else { + SafeSetLevel(prvKeyLine, level | SC_FOLDLEVELHEADERFLAG, styler) ; + } + + int datLevel = level + 1 ; + if ( !(prvKeyLineTp & 4) ) { + datLevel = level ; + } + + for ( int ll = beginData; ll < beginComment; ll++ ) + SafeSetLevel(ll, datLevel, styler) ; + + if ( prvKeyLineTp == 5 ) { + level += 1 ; + } + + if ( prvKeyLineTp == 6 ) { + level -= 1 ; + } + for ( int m = beginComment; m <= endLine; m++ ) + SafeSetLevel(m, level, styler) ; +} + +static const char * const abaqusWordListDesc[] = { + "processors", + "commands", + "slashommands", + "starcommands", + "arguments", + "functions", + 0 +}; + +LexerModule lmAbaqus(SCLEX_ABAQUS, ColouriseABAQUSDoc, "abaqus", FoldABAQUSDoc, abaqusWordListDesc); diff --git a/sdk/wxscintilla/src/scintilla/src/LexAda.cxx b/sdk/wxscintilla/src/scintilla/src/LexAda.cxx index 9d1b45702e..654bfbebad 100644 --- a/sdk/wxscintilla/src/scintilla/src/LexAda.cxx +++ b/sdk/wxscintilla/src/scintilla/src/LexAda.cxx @@ -1,524 +1,525 @@ -// Scintilla source code edit control -/** @file LexAda.cxx - ** Lexer for Ada 95 - **/ -// Copyright 2002 by Sergey Koshcheyev -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include - -#include "Platform.h" - -#include "Accessor.h" -#include "StyleContext.h" -#include "PropSet.h" -#include "KeyWords.h" -#include "SciLexer.h" -#include "SString.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -/* - * Interface - */ - -static void ColouriseDocument( - unsigned int startPos, - int length, - int initStyle, - WordList *keywordlists[], - Accessor &styler); - -static const char * const adaWordListDesc[] = { - "Keywords", - 0 -}; - -LexerModule lmAda(SCLEX_ADA, ColouriseDocument, "ada", NULL, adaWordListDesc); - -/* - * Implementation - */ - -// Functions that have apostropheStartsAttribute as a parameter set it according to whether -// an apostrophe encountered after processing the current token will start an attribute or -// a character literal. -static void ColouriseCharacter(StyleContext& sc, bool& apostropheStartsAttribute); -static void ColouriseComment(StyleContext& sc, bool& apostropheStartsAttribute); -static void ColouriseContext(StyleContext& sc, char chEnd, int stateEOL); -static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute); -static void ColouriseLabel(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute); -static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute); -static void ColouriseString(StyleContext& sc, bool& apostropheStartsAttribute); -static void ColouriseWhiteSpace(StyleContext& sc, bool& apostropheStartsAttribute); -static void ColouriseWord(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute); - -static inline bool IsDelimiterCharacter(int ch); -static inline bool IsNumberStartCharacter(int ch); -static inline bool IsNumberCharacter(int ch); -static inline bool IsSeparatorOrDelimiterCharacter(int ch); -static bool IsValidIdentifier(const SString& identifier); -static bool IsValidNumber(const SString& number); -static inline bool IsWordStartCharacter(int ch); -static inline bool IsWordCharacter(int ch); - -static void ColouriseCharacter(StyleContext& sc, bool& apostropheStartsAttribute) { - apostropheStartsAttribute = true; - - sc.SetState(SCE_ADA_CHARACTER); - - // Skip the apostrophe and one more character (so that '' is shown as non-terminated and ''' - // is handled correctly) - sc.Forward(); - sc.Forward(); - - ColouriseContext(sc, '\'', SCE_ADA_CHARACTEREOL); -} - -static void ColouriseContext(StyleContext& sc, char chEnd, int stateEOL) { - while (!sc.atLineEnd && !sc.Match(chEnd)) { - sc.Forward(); - } - - if (!sc.atLineEnd) { - sc.ForwardSetState(SCE_ADA_DEFAULT); - } else { - sc.ChangeState(stateEOL); - } -} - -static void ColouriseComment(StyleContext& sc, bool& /*apostropheStartsAttribute*/) { - // Apostrophe meaning is not changed, but the parameter is present for uniformity - - sc.SetState(SCE_ADA_COMMENTLINE); - - while (!sc.atLineEnd) { - sc.Forward(); - } -} - -static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute) { - apostropheStartsAttribute = sc.Match (')'); - sc.SetState(SCE_ADA_DELIMITER); - sc.ForwardSetState(SCE_ADA_DEFAULT); -} - -static void ColouriseLabel(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute) { - apostropheStartsAttribute = false; - - sc.SetState(SCE_ADA_LABEL); - - // Skip "<<" - sc.Forward(); - sc.Forward(); - - SString identifier; - - while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) { - identifier += static_cast(tolower(sc.ch)); - sc.Forward(); - } - - // Skip ">>" - if (sc.Match('>', '>')) { - sc.Forward(); - sc.Forward(); - } else { - sc.ChangeState(SCE_ADA_ILLEGAL); - } - - // If the name is an invalid identifier or a keyword, then make it invalid label - if (!IsValidIdentifier(identifier) || keywords.InList(identifier.c_str())) { - sc.ChangeState(SCE_ADA_ILLEGAL); - } - - sc.SetState(SCE_ADA_DEFAULT); - -} - -static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute) { - apostropheStartsAttribute = true; - - SString number; - sc.SetState(SCE_ADA_NUMBER); - - // Get all characters up to a delimiter or a separator, including points, but excluding - // double points (ranges). - while (!IsSeparatorOrDelimiterCharacter(sc.ch) || (sc.ch == '.' && sc.chNext != '.')) { - number += static_cast(sc.ch); - sc.Forward(); - } - - // Special case: exponent with sign - if ((sc.chPrev == 'e' || sc.chPrev == 'E') && - (sc.ch == '+' || sc.ch == '-')) { - number += static_cast(sc.ch); - sc.Forward (); - - while (!IsSeparatorOrDelimiterCharacter(sc.ch)) { - number += static_cast(sc.ch); - sc.Forward(); - } - } - - if (!IsValidNumber(number)) { - sc.ChangeState(SCE_ADA_ILLEGAL); - } - - sc.SetState(SCE_ADA_DEFAULT); -} - -static void ColouriseString(StyleContext& sc, bool& apostropheStartsAttribute) { - apostropheStartsAttribute = true; - - sc.SetState(SCE_ADA_STRING); - sc.Forward(); - - ColouriseContext(sc, '"', SCE_ADA_STRINGEOL); -} - -static void ColouriseWhiteSpace(StyleContext& sc, bool& /*apostropheStartsAttribute*/) { - // Apostrophe meaning is not changed, but the parameter is present for uniformity - sc.SetState(SCE_ADA_DEFAULT); - sc.ForwardSetState(SCE_ADA_DEFAULT); -} - -static void ColouriseWord(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute) { - apostropheStartsAttribute = true; - sc.SetState(SCE_ADA_IDENTIFIER); - - SString word; - - while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) { - word += static_cast(tolower(sc.ch)); - sc.Forward(); - } - - if (!IsValidIdentifier(word)) { - sc.ChangeState(SCE_ADA_ILLEGAL); - - } else if (keywords.InList(word.c_str())) { - sc.ChangeState(SCE_ADA_WORD); - - if (word != "all") { - apostropheStartsAttribute = false; - } - } - - sc.SetState(SCE_ADA_DEFAULT); -} - -// -// ColouriseDocument -// - -static void ColouriseDocument( - unsigned int startPos, - int length, - int initStyle, - WordList *keywordlists[], - Accessor &styler) { - WordList &keywords = *keywordlists[0]; - - StyleContext sc(startPos, length, initStyle, styler); - - int lineCurrent = styler.GetLine(startPos); - bool apostropheStartsAttribute = (styler.GetLineState(lineCurrent) & 1) != 0; - - while (sc.More()) { - if (sc.atLineEnd) { - // Go to the next line - sc.Forward(); - lineCurrent++; - - // Remember the line state for future incremental lexing - styler.SetLineState(lineCurrent, apostropheStartsAttribute); - - // Don't continue any styles on the next line - sc.SetState(SCE_ADA_DEFAULT); - } - - // Comments - if (sc.Match('-', '-')) { - ColouriseComment(sc, apostropheStartsAttribute); - - // Strings - } else if (sc.Match('"')) { - ColouriseString(sc, apostropheStartsAttribute); - - // Characters - } else if (sc.Match('\'') && !apostropheStartsAttribute) { - ColouriseCharacter(sc, apostropheStartsAttribute); - - // Labels - } else if (sc.Match('<', '<')) { - ColouriseLabel(sc, keywords, apostropheStartsAttribute); - - // Whitespace - } else if (IsASpace(sc.ch)) { - ColouriseWhiteSpace(sc, apostropheStartsAttribute); - - // Delimiters - } else if (IsDelimiterCharacter(sc.ch)) { - ColouriseDelimiter(sc, apostropheStartsAttribute); - - // Numbers - } else if (IsADigit(sc.ch) || sc.ch == '#') { - ColouriseNumber(sc, apostropheStartsAttribute); - - // Keywords or identifiers - } else { - ColouriseWord(sc, keywords, apostropheStartsAttribute); - } - } - - sc.Complete(); -} - -static inline bool IsDelimiterCharacter(int ch) { - switch (ch) { - case '&': - case '\'': - case '(': - case ')': - case '*': - case '+': - case ',': - case '-': - case '.': - case '/': - case ':': - case ';': - case '<': - case '=': - case '>': - case '|': - return true; - default: - return false; - } -} - -static inline bool IsNumberCharacter(int ch) { - return IsNumberStartCharacter(ch) || - ch == '_' || - ch == '.' || - ch == '#' || - (ch >= 'a' && ch <= 'f') || - (ch >= 'A' && ch <= 'F'); -} - -static inline bool IsNumberStartCharacter(int ch) { - return IsADigit(ch); -} - -static inline bool IsSeparatorOrDelimiterCharacter(int ch) { - return IsASpace(ch) || IsDelimiterCharacter(ch); -} - -static bool IsValidIdentifier(const SString& identifier) { - // First character can't be '_', so initialize the flag to true - bool lastWasUnderscore = true; - - size_t length = identifier.length(); - - // Zero-length identifiers are not valid (these can occur inside labels) - if (length == 0) { - return false; - } - - // Check for valid character at the start - if (!IsWordStartCharacter(identifier[0])) { - return false; - } - - // Check for only valid characters and no double underscores - for (size_t i = 0; i < length; i++) { - if (!IsWordCharacter(identifier[i]) || - (identifier[i] == '_' && lastWasUnderscore)) { - return false; - } - lastWasUnderscore = identifier[i] == '_'; - } - - // Check for underscore at the end - if (lastWasUnderscore == true) { - return false; - } - - // All checks passed - return true; -} - -static bool IsValidNumber(const SString& number) { - int hashPos = number.search("#"); - bool seenDot = false; - - size_t i = 0; - size_t length = number.length(); - - if (length == 0) - return false; // Just in case - - // Decimal number - if (hashPos == -1) { - bool canBeSpecial = false; - - for (; i < length; i++) { - if (number[i] == '_') { - if (!canBeSpecial) { - return false; - } - canBeSpecial = false; - } else if (number[i] == '.') { - if (!canBeSpecial || seenDot) { - return false; - } - canBeSpecial = false; - seenDot = true; - } else if (IsADigit(number[i])) { - canBeSpecial = true; - } else { - break; - } - } - - if (!canBeSpecial) - return false; - } else { - // Based number - bool canBeSpecial = false; - int base = 0; - - // Parse base - for (; i < length; i++) { - int ch = number[i]; - if (ch == '_') { - if (!canBeSpecial) - return false; - canBeSpecial = false; - } else if (IsADigit(ch)) { - base = base * 10 + (ch - '0'); - if (base > 16) - return false; - canBeSpecial = true; - } else if (ch == '#' && canBeSpecial) { - break; - } else { - return false; - } - } - - if (base < 2) - return false; - if (i == length) - return false; - - i++; // Skip over '#' - - // Parse number - canBeSpecial = false; - - for (; i < length; i++) { - int ch = tolower(number[i]); - - if (ch == '_') { - if (!canBeSpecial) { - return false; - } - canBeSpecial = false; - - } else if (ch == '.') { - if (!canBeSpecial || seenDot) { - return false; - } - canBeSpecial = false; - seenDot = true; - - } else if (IsADigit(ch)) { - if (ch - '0' >= base) { - return false; - } - canBeSpecial = true; - - } else if (ch >= 'a' && ch <= 'f') { - if (ch - 'a' + 10 >= base) { - return false; - } - canBeSpecial = true; - - } else if (ch == '#' && canBeSpecial) { - break; - - } else { - return false; - } - } - - if (i == length) { - return false; - } - - i++; - } - - // Exponent (optional) - if (i < length) { - if (number[i] != 'e' && number[i] != 'E') - return false; - - i++; // Move past 'E' - - if (i == length) { - return false; - } - - if (number[i] == '+') - i++; - else if (number[i] == '-') { - if (seenDot) { - i++; - } else { - return false; // Integer literals should not have negative exponents - } - } - - if (i == length) { - return false; - } - - bool canBeSpecial = false; - - for (; i < length; i++) { - if (number[i] == '_') { - if (!canBeSpecial) { - return false; - } - canBeSpecial = false; - } else if (IsADigit(number[i])) { - canBeSpecial = true; - } else { - return false; - } - } - - if (!canBeSpecial) - return false; - } - - // if i == length, number was parsed successfully. - return i == length; -} - -static inline bool IsWordCharacter(int ch) { - return IsWordStartCharacter(ch) || IsADigit(ch); -} - -static inline bool IsWordStartCharacter(int ch) { - return (isascii(ch) && isalpha(ch)) || ch == '_'; -} +// Scintilla source code edit control +/** @file LexAda.cxx + ** Lexer for Ada 95 + **/ +// Copyright 2002 by Sergey Koshcheyev +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include + +#include + +#include "Platform.h" + +#include "Accessor.h" +#include "StyleContext.h" +#include "PropSet.h" +#include "KeyWords.h" +#include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +/* + * Interface + */ + +static void ColouriseDocument( + unsigned int startPos, + int length, + int initStyle, + WordList *keywordlists[], + Accessor &styler); + +static const char * const adaWordListDesc[] = { + "Keywords", + 0 +}; + +LexerModule lmAda(SCLEX_ADA, ColouriseDocument, "ada", NULL, adaWordListDesc); + +/* + * Implementation + */ + +// Functions that have apostropheStartsAttribute as a parameter set it according to whether +// an apostrophe encountered after processing the current token will start an attribute or +// a character literal. +static void ColouriseCharacter(StyleContext& sc, bool& apostropheStartsAttribute); +static void ColouriseComment(StyleContext& sc, bool& apostropheStartsAttribute); +static void ColouriseContext(StyleContext& sc, char chEnd, int stateEOL); +static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute); +static void ColouriseLabel(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute); +static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute); +static void ColouriseString(StyleContext& sc, bool& apostropheStartsAttribute); +static void ColouriseWhiteSpace(StyleContext& sc, bool& apostropheStartsAttribute); +static void ColouriseWord(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute); + +static inline bool IsDelimiterCharacter(int ch); +static inline bool IsNumberStartCharacter(int ch); +static inline bool IsNumberCharacter(int ch); +static inline bool IsSeparatorOrDelimiterCharacter(int ch); +static bool IsValidIdentifier(const std::string& identifier); +static bool IsValidNumber(const std::string& number); +static inline bool IsWordStartCharacter(int ch); +static inline bool IsWordCharacter(int ch); + +static void ColouriseCharacter(StyleContext& sc, bool& apostropheStartsAttribute) { + apostropheStartsAttribute = true; + + sc.SetState(SCE_ADA_CHARACTER); + + // Skip the apostrophe and one more character (so that '' is shown as non-terminated and ''' + // is handled correctly) + sc.Forward(); + sc.Forward(); + + ColouriseContext(sc, '\'', SCE_ADA_CHARACTEREOL); +} + +static void ColouriseContext(StyleContext& sc, char chEnd, int stateEOL) { + while (!sc.atLineEnd && !sc.Match(chEnd)) { + sc.Forward(); + } + + if (!sc.atLineEnd) { + sc.ForwardSetState(SCE_ADA_DEFAULT); + } else { + sc.ChangeState(stateEOL); + } +} + +static void ColouriseComment(StyleContext& sc, bool& /*apostropheStartsAttribute*/) { + // Apostrophe meaning is not changed, but the parameter is present for uniformity + + sc.SetState(SCE_ADA_COMMENTLINE); + + while (!sc.atLineEnd) { + sc.Forward(); + } +} + +static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute) { + apostropheStartsAttribute = sc.Match (')'); + sc.SetState(SCE_ADA_DELIMITER); + sc.ForwardSetState(SCE_ADA_DEFAULT); +} + +static void ColouriseLabel(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute) { + apostropheStartsAttribute = false; + + sc.SetState(SCE_ADA_LABEL); + + // Skip "<<" + sc.Forward(); + sc.Forward(); + + std::string identifier; + + while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) { + identifier += static_cast(tolower(sc.ch)); + sc.Forward(); + } + + // Skip ">>" + if (sc.Match('>', '>')) { + sc.Forward(); + sc.Forward(); + } else { + sc.ChangeState(SCE_ADA_ILLEGAL); + } + + // If the name is an invalid identifier or a keyword, then make it invalid label + if (!IsValidIdentifier(identifier) || keywords.InList(identifier.c_str())) { + sc.ChangeState(SCE_ADA_ILLEGAL); + } + + sc.SetState(SCE_ADA_DEFAULT); + +} + +static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute) { + apostropheStartsAttribute = true; + + std::string number; + sc.SetState(SCE_ADA_NUMBER); + + // Get all characters up to a delimiter or a separator, including points, but excluding + // double points (ranges). + while (!IsSeparatorOrDelimiterCharacter(sc.ch) || (sc.ch == '.' && sc.chNext != '.')) { + number += static_cast(sc.ch); + sc.Forward(); + } + + // Special case: exponent with sign + if ((sc.chPrev == 'e' || sc.chPrev == 'E') && + (sc.ch == '+' || sc.ch == '-')) { + number += static_cast(sc.ch); + sc.Forward (); + + while (!IsSeparatorOrDelimiterCharacter(sc.ch)) { + number += static_cast(sc.ch); + sc.Forward(); + } + } + + if (!IsValidNumber(number)) { + sc.ChangeState(SCE_ADA_ILLEGAL); + } + + sc.SetState(SCE_ADA_DEFAULT); +} + +static void ColouriseString(StyleContext& sc, bool& apostropheStartsAttribute) { + apostropheStartsAttribute = true; + + sc.SetState(SCE_ADA_STRING); + sc.Forward(); + + ColouriseContext(sc, '"', SCE_ADA_STRINGEOL); +} + +static void ColouriseWhiteSpace(StyleContext& sc, bool& /*apostropheStartsAttribute*/) { + // Apostrophe meaning is not changed, but the parameter is present for uniformity + sc.SetState(SCE_ADA_DEFAULT); + sc.ForwardSetState(SCE_ADA_DEFAULT); +} + +static void ColouriseWord(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute) { + apostropheStartsAttribute = true; + sc.SetState(SCE_ADA_IDENTIFIER); + + std::string word; + + while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) { + word += static_cast(tolower(sc.ch)); + sc.Forward(); + } + + if (!IsValidIdentifier(word)) { + sc.ChangeState(SCE_ADA_ILLEGAL); + + } else if (keywords.InList(word.c_str())) { + sc.ChangeState(SCE_ADA_WORD); + + if (word != "all") { + apostropheStartsAttribute = false; + } + } + + sc.SetState(SCE_ADA_DEFAULT); +} + +// +// ColouriseDocument +// + +static void ColouriseDocument( + unsigned int startPos, + int length, + int initStyle, + WordList *keywordlists[], + Accessor &styler) { + WordList &keywords = *keywordlists[0]; + + StyleContext sc(startPos, length, initStyle, styler); + + int lineCurrent = styler.GetLine(startPos); + bool apostropheStartsAttribute = (styler.GetLineState(lineCurrent) & 1) != 0; + + while (sc.More()) { + if (sc.atLineEnd) { + // Go to the next line + sc.Forward(); + lineCurrent++; + + // Remember the line state for future incremental lexing + styler.SetLineState(lineCurrent, apostropheStartsAttribute); + + // Don't continue any styles on the next line + sc.SetState(SCE_ADA_DEFAULT); + } + + // Comments + if (sc.Match('-', '-')) { + ColouriseComment(sc, apostropheStartsAttribute); + + // Strings + } else if (sc.Match('"')) { + ColouriseString(sc, apostropheStartsAttribute); + + // Characters + } else if (sc.Match('\'') && !apostropheStartsAttribute) { + ColouriseCharacter(sc, apostropheStartsAttribute); + + // Labels + } else if (sc.Match('<', '<')) { + ColouriseLabel(sc, keywords, apostropheStartsAttribute); + + // Whitespace + } else if (IsASpace(sc.ch)) { + ColouriseWhiteSpace(sc, apostropheStartsAttribute); + + // Delimiters + } else if (IsDelimiterCharacter(sc.ch)) { + ColouriseDelimiter(sc, apostropheStartsAttribute); + + // Numbers + } else if (IsADigit(sc.ch) || sc.ch == '#') { + ColouriseNumber(sc, apostropheStartsAttribute); + + // Keywords or identifiers + } else { + ColouriseWord(sc, keywords, apostropheStartsAttribute); + } + } + + sc.Complete(); +} + +static inline bool IsDelimiterCharacter(int ch) { + switch (ch) { + case '&': + case '\'': + case '(': + case ')': + case '*': + case '+': + case ',': + case '-': + case '.': + case '/': + case ':': + case ';': + case '<': + case '=': + case '>': + case '|': + return true; + default: + return false; + } +} + +static inline bool IsNumberCharacter(int ch) { + return IsNumberStartCharacter(ch) || + ch == '_' || + ch == '.' || + ch == '#' || + (ch >= 'a' && ch <= 'f') || + (ch >= 'A' && ch <= 'F'); +} + +static inline bool IsNumberStartCharacter(int ch) { + return IsADigit(ch); +} + +static inline bool IsSeparatorOrDelimiterCharacter(int ch) { + return IsASpace(ch) || IsDelimiterCharacter(ch); +} + +static bool IsValidIdentifier(const std::string& identifier) { + // First character can't be '_', so initialize the flag to true + bool lastWasUnderscore = true; + + size_t length = identifier.length(); + + // Zero-length identifiers are not valid (these can occur inside labels) + if (length == 0) { + return false; + } + + // Check for valid character at the start + if (!IsWordStartCharacter(identifier[0])) { + return false; + } + + // Check for only valid characters and no double underscores + for (size_t i = 0; i < length; i++) { + if (!IsWordCharacter(identifier[i]) || + (identifier[i] == '_' && lastWasUnderscore)) { + return false; + } + lastWasUnderscore = identifier[i] == '_'; + } + + // Check for underscore at the end + if (lastWasUnderscore == true) { + return false; + } + + // All checks passed + return true; +} + +static bool IsValidNumber(const std::string& number) { + size_t hashPos = number.find("#"); + bool seenDot = false; + + size_t i = 0; + size_t length = number.length(); + + if (length == 0) + return false; // Just in case + + // Decimal number + if (hashPos == std::string::npos) { + bool canBeSpecial = false; + + for (; i < length; i++) { + if (number[i] == '_') { + if (!canBeSpecial) { + return false; + } + canBeSpecial = false; + } else if (number[i] == '.') { + if (!canBeSpecial || seenDot) { + return false; + } + canBeSpecial = false; + seenDot = true; + } else if (IsADigit(number[i])) { + canBeSpecial = true; + } else { + break; + } + } + + if (!canBeSpecial) + return false; + } else { + // Based number + bool canBeSpecial = false; + int base = 0; + + // Parse base + for (; i < length; i++) { + int ch = number[i]; + if (ch == '_') { + if (!canBeSpecial) + return false; + canBeSpecial = false; + } else if (IsADigit(ch)) { + base = base * 10 + (ch - '0'); + if (base > 16) + return false; + canBeSpecial = true; + } else if (ch == '#' && canBeSpecial) { + break; + } else { + return false; + } + } + + if (base < 2) + return false; + if (i == length) + return false; + + i++; // Skip over '#' + + // Parse number + canBeSpecial = false; + + for (; i < length; i++) { + int ch = tolower(number[i]); + + if (ch == '_') { + if (!canBeSpecial) { + return false; + } + canBeSpecial = false; + + } else if (ch == '.') { + if (!canBeSpecial || seenDot) { + return false; + } + canBeSpecial = false; + seenDot = true; + + } else if (IsADigit(ch)) { + if (ch - '0' >= base) { + return false; + } + canBeSpecial = true; + + } else if (ch >= 'a' && ch <= 'f') { + if (ch - 'a' + 10 >= base) { + return false; + } + canBeSpecial = true; + + } else if (ch == '#' && canBeSpecial) { + break; + + } else { + return false; + } + } + + if (i == length) { + return false; + } + + i++; + } + + // Exponent (optional) + if (i < length) { + if (number[i] != 'e' && number[i] != 'E') + return false; + + i++; // Move past 'E' + + if (i == length) { + return false; + } + + if (number[i] == '+') + i++; + else if (number[i] == '-') { + if (seenDot) { + i++; + } else { + return false; // Integer literals should not have negative exponents + } + } + + if (i == length) { + return false; + } + + bool canBeSpecial = false; + + for (; i < length; i++) { + if (number[i] == '_') { + if (!canBeSpecial) { + return false; + } + canBeSpecial = false; + } else if (IsADigit(number[i])) { + canBeSpecial = true; + } else { + return false; + } + } + + if (!canBeSpecial) + return false; + } + + // if i == length, number was parsed successfully. + return i == length; +} + +static inline bool IsWordCharacter(int ch) { + return IsWordStartCharacter(ch) || IsADigit(ch); +} + +static inline bool IsWordStartCharacter(int ch) { + return (isascii(ch) && isalpha(ch)) || ch == '_'; +} diff --git a/sdk/wxscintilla/src/scintilla/src/LexAsm.cxx b/sdk/wxscintilla/src/scintilla/src/LexAsm.cxx index deb2839332..17c938420a 100644 --- a/sdk/wxscintilla/src/scintilla/src/LexAsm.cxx +++ b/sdk/wxscintilla/src/scintilla/src/LexAsm.cxx @@ -1,180 +1,180 @@ -// Scintilla source code edit control -/** @file LexAsm.cxx - ** Lexer for Assembler, just for the MASM syntax - ** Written by The Black Horus - ** Enhancements and NASM stuff by Kein-Hong Man, 2003-10 - ** SCE_ASM_COMMENTBLOCK and SCE_ASM_CHARACTER are for future GNU as colouring - **/ -// Copyright 1998-2003 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -static inline bool IsAWordChar(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '.' || - ch == '_' || ch == '?'); -} - -static inline bool IsAWordStart(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.' || - ch == '%' || ch == '@' || ch == '$' || ch == '?'); -} - -static inline bool IsAsmOperator(char ch) { - if (isalnum(ch)) - return false; - // '.' left out as it is used to make up numbers - if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || - ch == '(' || ch == ')' || ch == '=' || ch == '^' || - ch == '[' || ch == ']' || ch == '<' || ch == '&' || - ch == '>' || ch == ',' || ch == '|' || ch == '~' || - ch == '%' || ch == ':') - return true; - return false; -} - -static void ColouriseAsmDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], - Accessor &styler) { - - WordList &cpuInstruction = *keywordlists[0]; - WordList &mathInstruction = *keywordlists[1]; - WordList ®isters = *keywordlists[2]; - WordList &directive = *keywordlists[3]; - WordList &directiveOperand = *keywordlists[4]; - WordList &extInstruction = *keywordlists[5]; - - // Do not leak onto next line - if (initStyle == SCE_ASM_STRINGEOL) - initStyle = SCE_ASM_DEFAULT; - - StyleContext sc(startPos, length, initStyle, styler); - - for (; sc.More(); sc.Forward()) - { - - // Prevent SCE_ASM_STRINGEOL from leaking back to previous line - if (sc.atLineStart && (sc.state == SCE_ASM_STRING)) { - sc.SetState(SCE_ASM_STRING); - } else if (sc.atLineStart && (sc.state == SCE_ASM_CHARACTER)) { - sc.SetState(SCE_ASM_CHARACTER); - } - - // Handle line continuation generically. - if (sc.ch == '\\') { - if (sc.chNext == '\n' || sc.chNext == '\r') { - sc.Forward(); - if (sc.ch == '\r' && sc.chNext == '\n') { - sc.Forward(); - } - continue; - } - } - - // Determine if the current state should terminate. - if (sc.state == SCE_ASM_OPERATOR) { - if (!IsAsmOperator(static_cast(sc.ch))) { - sc.SetState(SCE_ASM_DEFAULT); - } - }else if (sc.state == SCE_ASM_NUMBER) { - if (!IsAWordChar(sc.ch)) { - sc.SetState(SCE_ASM_DEFAULT); - } - } else if (sc.state == SCE_ASM_IDENTIFIER) { - if (!IsAWordChar(sc.ch) ) { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - - if (cpuInstruction.InList(s)) { - sc.ChangeState(SCE_ASM_CPUINSTRUCTION); - } else if (mathInstruction.InList(s)) { - sc.ChangeState(SCE_ASM_MATHINSTRUCTION); - } else if (registers.InList(s)) { - sc.ChangeState(SCE_ASM_REGISTER); - } else if (directive.InList(s)) { - sc.ChangeState(SCE_ASM_DIRECTIVE); - } else if (directiveOperand.InList(s)) { - sc.ChangeState(SCE_ASM_DIRECTIVEOPERAND); - } else if (extInstruction.InList(s)) { - sc.ChangeState(SCE_ASM_EXTINSTRUCTION); - } - sc.SetState(SCE_ASM_DEFAULT); - } - } - else if (sc.state == SCE_ASM_COMMENT ) { - if (sc.atLineEnd) { - sc.SetState(SCE_ASM_DEFAULT); - } - } else if (sc.state == SCE_ASM_STRING) { - if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\"') { - sc.ForwardSetState(SCE_ASM_DEFAULT); - } else if (sc.atLineEnd) { - sc.ChangeState(SCE_ASM_STRINGEOL); - sc.ForwardSetState(SCE_ASM_DEFAULT); - } - } else if (sc.state == SCE_ASM_CHARACTER) { - if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\'') { - sc.ForwardSetState(SCE_ASM_DEFAULT); - } else if (sc.atLineEnd) { - sc.ChangeState(SCE_ASM_STRINGEOL); - sc.ForwardSetState(SCE_ASM_DEFAULT); - } - } - - // Determine if a new state should be entered. - if (sc.state == SCE_ASM_DEFAULT) { - if (sc.ch == ';'){ - sc.SetState(SCE_ASM_COMMENT); - } else if (isdigit(sc.ch) || (sc.ch == '.' && isdigit(sc.chNext))) { - sc.SetState(SCE_ASM_NUMBER); - } else if (IsAWordStart(sc.ch)) { - sc.SetState(SCE_ASM_IDENTIFIER); - } else if (sc.ch == '\"') { - sc.SetState(SCE_ASM_STRING); - } else if (sc.ch == '\'') { - sc.SetState(SCE_ASM_CHARACTER); - } else if (IsAsmOperator(static_cast(sc.ch))) { - sc.SetState(SCE_ASM_OPERATOR); - } - } - - } - sc.Complete(); -} - -static const char * const asmWordListDesc[] = { - "CPU instructions", - "FPU instructions", - "Registers", - "Directives", - "Directive operands", - "Extended instructions", - 0 -}; - -LexerModule lmAsm(SCLEX_ASM, ColouriseAsmDoc, "asm", 0, asmWordListDesc); - +// Scintilla source code edit control +/** @file LexAsm.cxx + ** Lexer for Assembler, just for the MASM syntax + ** Written by The Black Horus + ** Enhancements and NASM stuff by Kein-Hong Man, 2003-10 + ** SCE_ASM_COMMENTBLOCK and SCE_ASM_CHARACTER are for future GNU as colouring + **/ +// Copyright 1998-2003 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static inline bool IsAWordChar(const int ch) { + return (ch < 0x80) && (isalnum(ch) || ch == '.' || + ch == '_' || ch == '?'); +} + +static inline bool IsAWordStart(const int ch) { + return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.' || + ch == '%' || ch == '@' || ch == '$' || ch == '?'); +} + +static inline bool IsAsmOperator(const int ch) { + if ((ch < 0x80) && (isalnum(ch))) + return false; + // '.' left out as it is used to make up numbers + if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || + ch == '(' || ch == ')' || ch == '=' || ch == '^' || + ch == '[' || ch == ']' || ch == '<' || ch == '&' || + ch == '>' || ch == ',' || ch == '|' || ch == '~' || + ch == '%' || ch == ':') + return true; + return false; +} + +static void ColouriseAsmDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], + Accessor &styler) { + + WordList &cpuInstruction = *keywordlists[0]; + WordList &mathInstruction = *keywordlists[1]; + WordList ®isters = *keywordlists[2]; + WordList &directive = *keywordlists[3]; + WordList &directiveOperand = *keywordlists[4]; + WordList &extInstruction = *keywordlists[5]; + + // Do not leak onto next line + if (initStyle == SCE_ASM_STRINGEOL) + initStyle = SCE_ASM_DEFAULT; + + StyleContext sc(startPos, length, initStyle, styler); + + for (; sc.More(); sc.Forward()) + { + + // Prevent SCE_ASM_STRINGEOL from leaking back to previous line + if (sc.atLineStart && (sc.state == SCE_ASM_STRING)) { + sc.SetState(SCE_ASM_STRING); + } else if (sc.atLineStart && (sc.state == SCE_ASM_CHARACTER)) { + sc.SetState(SCE_ASM_CHARACTER); + } + + // Handle line continuation generically. + if (sc.ch == '\\') { + if (sc.chNext == '\n' || sc.chNext == '\r') { + sc.Forward(); + if (sc.ch == '\r' && sc.chNext == '\n') { + sc.Forward(); + } + continue; + } + } + + // Determine if the current state should terminate. + if (sc.state == SCE_ASM_OPERATOR) { + if (!IsAsmOperator(sc.ch)) { + sc.SetState(SCE_ASM_DEFAULT); + } + }else if (sc.state == SCE_ASM_NUMBER) { + if (!IsAWordChar(sc.ch)) { + sc.SetState(SCE_ASM_DEFAULT); + } + } else if (sc.state == SCE_ASM_IDENTIFIER) { + if (!IsAWordChar(sc.ch) ) { + char s[100]; + sc.GetCurrentLowered(s, sizeof(s)); + + if (cpuInstruction.InList(s)) { + sc.ChangeState(SCE_ASM_CPUINSTRUCTION); + } else if (mathInstruction.InList(s)) { + sc.ChangeState(SCE_ASM_MATHINSTRUCTION); + } else if (registers.InList(s)) { + sc.ChangeState(SCE_ASM_REGISTER); + } else if (directive.InList(s)) { + sc.ChangeState(SCE_ASM_DIRECTIVE); + } else if (directiveOperand.InList(s)) { + sc.ChangeState(SCE_ASM_DIRECTIVEOPERAND); + } else if (extInstruction.InList(s)) { + sc.ChangeState(SCE_ASM_EXTINSTRUCTION); + } + sc.SetState(SCE_ASM_DEFAULT); + } + } + else if (sc.state == SCE_ASM_COMMENT ) { + if (sc.atLineEnd) { + sc.SetState(SCE_ASM_DEFAULT); + } + } else if (sc.state == SCE_ASM_STRING) { + if (sc.ch == '\\') { + if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\"') { + sc.ForwardSetState(SCE_ASM_DEFAULT); + } else if (sc.atLineEnd) { + sc.ChangeState(SCE_ASM_STRINGEOL); + sc.ForwardSetState(SCE_ASM_DEFAULT); + } + } else if (sc.state == SCE_ASM_CHARACTER) { + if (sc.ch == '\\') { + if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\'') { + sc.ForwardSetState(SCE_ASM_DEFAULT); + } else if (sc.atLineEnd) { + sc.ChangeState(SCE_ASM_STRINGEOL); + sc.ForwardSetState(SCE_ASM_DEFAULT); + } + } + + // Determine if a new state should be entered. + if (sc.state == SCE_ASM_DEFAULT) { + if (sc.ch == ';'){ + sc.SetState(SCE_ASM_COMMENT); + } else if (isascii(sc.ch) && (isdigit(sc.ch) || (sc.ch == '.' && isascii(sc.chNext) && isdigit(sc.chNext)))) { + sc.SetState(SCE_ASM_NUMBER); + } else if (IsAWordStart(sc.ch)) { + sc.SetState(SCE_ASM_IDENTIFIER); + } else if (sc.ch == '\"') { + sc.SetState(SCE_ASM_STRING); + } else if (sc.ch == '\'') { + sc.SetState(SCE_ASM_CHARACTER); + } else if (IsAsmOperator(sc.ch)) { + sc.SetState(SCE_ASM_OPERATOR); + } + } + + } + sc.Complete(); +} + +static const char * const asmWordListDesc[] = { + "CPU instructions", + "FPU instructions", + "Registers", + "Directives", + "Directive operands", + "Extended instructions", + 0 +}; + +LexerModule lmAsm(SCLEX_ASM, ColouriseAsmDoc, "asm", 0, asmWordListDesc); + diff --git a/sdk/wxscintilla/src/scintilla/src/LexBash.cxx b/sdk/wxscintilla/src/scintilla/src/LexBash.cxx index d5ecfd925a..5801278bec 100644 --- a/sdk/wxscintilla/src/scintilla/src/LexBash.cxx +++ b/sdk/wxscintilla/src/scintilla/src/LexBash.cxx @@ -1,683 +1,536 @@ -// Scintilla source code edit control -/** @file LexBash.cxx - ** Lexer for Bash. - **/ -// Copyright 2004-2007 by Neil Hodgson -// Adapted from LexPerl by Kein-Hong Man 2004 -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" - -// define this if you want 'invalid octals' to be marked as errors -// usually, this is not a good idea, permissive lexing is better -#undef PEDANTIC_OCTAL - -#define BASH_BASE_ERROR 65 -#define BASH_BASE_DECIMAL 66 -#define BASH_BASE_HEX 67 -#ifdef PEDANTIC_OCTAL -#define BASH_BASE_OCTAL 68 -#define BASH_BASE_OCTAL_ERROR 69 -#endif - -#define HERE_DELIM_MAX 256 - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -static inline int translateBashDigit(char ch) { - if (ch >= '0' && ch <= '9') { - return ch - '0'; - } else if (ch >= 'a' && ch <= 'z') { - return ch - 'a' + 10; - } else if (ch >= 'A' && ch <= 'Z') { - return ch - 'A' + 36; - } else if (ch == '@') { - return 62; - } else if (ch == '_') { - return 63; - } - return BASH_BASE_ERROR; -} - -static inline bool isEOLChar(char ch) { - return (ch == '\r') || (ch == '\n'); -} - -static bool isSingleCharOp(char ch) { - char strCharSet[2]; - strCharSet[0] = ch; - strCharSet[1] = '\0'; - return (NULL != strstr("rwxoRWXOezsfdlpSbctugkTBMACahGLNn", strCharSet)); -} - -static inline bool isBashOperator(char ch) { - if (ch == '^' || ch == '&' || ch == '\\' || ch == '%' || - ch == '(' || ch == ')' || ch == '-' || ch == '+' || - ch == '=' || ch == '|' || ch == '{' || ch == '}' || - ch == '[' || ch == ']' || ch == ':' || ch == ';' || - ch == '>' || ch == ',' || ch == '/' || ch == '<' || - ch == '?' || ch == '!' || ch == '.' || ch == '~' || - ch == '@') - return true; - return false; -} - -static int classifyWordBash(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { - char s[100]; - for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) { - s[i] = styler[start + i]; - s[i + 1] = '\0'; - } - char chAttr = SCE_SH_IDENTIFIER; - if (keywords.InList(s)) - chAttr = SCE_SH_WORD; - styler.ColourTo(end, chAttr); - return chAttr; -} - -static inline int getBashNumberBase(unsigned int start, unsigned int end, Accessor &styler) { - int base = 0; - for (unsigned int i = 0; i < end - start + 1 && i < 10; i++) { - base = base * 10 + (styler[start + i] - '0'); - } - if (base > 64 || (end - start) > 1) { - return BASH_BASE_ERROR; - } - return base; -} - -static inline bool isEndVar(char ch) { - return !isalnum(ch) && ch != '$' && ch != '_'; -} - -static inline bool isNonQuote(char ch) { - return isalnum(ch) || ch == '_'; -} - -static bool isMatch(Accessor &styler, int lengthDoc, int pos, const char *val) { - if ((pos + static_cast(strlen(val))) >= lengthDoc) { - return false; - } - while (*val) { - if (*val != styler[pos++]) { - return false; - } - val++; - } - return true; -} - -static char opposite(char ch) { - if (ch == '(') - return ')'; - if (ch == '[') - return ']'; - if (ch == '{') - return '}'; - if (ch == '<') - return '>'; - return ch; -} - -static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, - WordList *keywordlists[], Accessor &styler) { - - // Lexer for bash often has to backtrack to start of current style to determine - // which characters are being used as quotes, how deeply nested is the - // start position and what the termination string is for here documents - - WordList &keywords = *keywordlists[0]; - - class HereDocCls { - public: - int State; // 0: '<<' encountered - // 1: collect the delimiter - // 2: here doc text (lines after the delimiter) - char Quote; // the char after '<<' - bool Quoted; // true if Quote in ('\'','"','`') - bool Indent; // indented delimiter (for <<-) - int DelimiterLength; // strlen(Delimiter) - char *Delimiter; // the Delimiter, 256: sizeof PL_tokenbuf - HereDocCls() { - State = 0; - Quote = 0; - Quoted = false; - Indent = 0; - DelimiterLength = 0; - Delimiter = new char[HERE_DELIM_MAX]; - Delimiter[0] = '\0'; - } - ~HereDocCls() { - delete []Delimiter; - } - }; - HereDocCls HereDoc; - - class QuoteCls { - public: - int Rep; - int Count; - char Up; - char Down; - QuoteCls() { - this->New(1); - } - void New(int r) { - Rep = r; - Count = 0; - Up = '\0'; - Down = '\0'; - } - void Open(char u) { - Count++; - Up = u; - Down = opposite(Up); - } - }; - QuoteCls Quote; - - int state = initStyle; - int numBase = 0; - unsigned int lengthDoc = startPos + length; - - // If in a long distance lexical state, seek to the beginning to find quote characters - // Bash strings can be multi-line with embedded newlines, so backtrack. - // Bash numbers have additional state during lexing, so backtrack too. - if (state == SCE_SH_HERE_Q) { - while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_SH_HERE_DELIM)) { - startPos--; - } - startPos = styler.LineStart(styler.GetLine(startPos)); - state = styler.StyleAt(startPos - 1); - } - if (state == SCE_SH_STRING - || state == SCE_SH_BACKTICKS - || state == SCE_SH_CHARACTER - || state == SCE_SH_NUMBER - || state == SCE_SH_IDENTIFIER - || state == SCE_SH_COMMENTLINE - ) { - while ((startPos > 1) && (styler.StyleAt(startPos - 1) == state)) { - startPos--; - } - state = SCE_SH_DEFAULT; - } - - styler.StartAt(startPos); - char chPrev = styler.SafeGetCharAt(startPos - 1); - if (startPos == 0) - chPrev = '\n'; - char chNext = styler[startPos]; - styler.StartSegment(startPos); - - for (unsigned int i = startPos; i < lengthDoc; i++) { - char ch = chNext; - // if the current character is not consumed due to the completion of an - // earlier style, lexing can be restarted via a simple goto - restartLexer: - chNext = styler.SafeGetCharAt(i + 1); - char chNext2 = styler.SafeGetCharAt(i + 2); - - if (styler.IsLeadByte(ch)) { - chNext = styler.SafeGetCharAt(i + 2); - chPrev = ' '; - i += 1; - continue; - } - - if ((chPrev == '\r' && ch == '\n')) { // skip on DOS/Windows - styler.ColourTo(i, state); - chPrev = ch; - continue; - } - - if (HereDoc.State == 1 && isEOLChar(ch)) { - // Begin of here-doc (the line after the here-doc delimiter): - // Lexically, the here-doc starts from the next line after the >>, but the - // first line of here-doc seem to follow the style of the last EOL sequence - HereDoc.State = 2; - if (HereDoc.Quoted) { - if (state == SCE_SH_HERE_DELIM) { - // Missing quote at end of string! We are stricter than bash. - // Colour here-doc anyway while marking this bit as an error. - state = SCE_SH_ERROR; - } - styler.ColourTo(i - 1, state); - // HereDoc.Quote always == '\'' - state = SCE_SH_HERE_Q; - } else { - styler.ColourTo(i - 1, state); - // always switch - state = SCE_SH_HERE_Q; - } - } - - if (state == SCE_SH_DEFAULT) { - if (ch == '\\') { // escaped character - if (i < lengthDoc - 1) - i++; - ch = chNext; - chNext = chNext2; - styler.ColourTo(i, SCE_SH_IDENTIFIER); - } else if (isdigit(ch)) { - state = SCE_SH_NUMBER; - numBase = BASH_BASE_DECIMAL; - if (ch == '0') { // hex,octal - if (chNext == 'x' || chNext == 'X') { - numBase = BASH_BASE_HEX; - i++; - ch = chNext; - chNext = chNext2; - } else if (isdigit(chNext)) { -#ifdef PEDANTIC_OCTAL - numBase = BASH_BASE_OCTAL; -#else - numBase = BASH_BASE_HEX; -#endif - } - } - } else if (iswordstart(ch)) { - state = SCE_SH_WORD; - if (!iswordchar(chNext) && chNext != '+' && chNext != '-') { - // We need that if length of word == 1! - // This test is copied from the SCE_SH_WORD handler. - classifyWordBash(styler.GetStartSegment(), i, keywords, styler); - state = SCE_SH_DEFAULT; - } - } else if (ch == '#') { - state = SCE_SH_COMMENTLINE; - } else if (ch == '\"') { - state = SCE_SH_STRING; - Quote.New(1); - Quote.Open(ch); - } else if (ch == '\'') { - state = SCE_SH_CHARACTER; - Quote.New(1); - Quote.Open(ch); - } else if (ch == '`') { - state = SCE_SH_BACKTICKS; - Quote.New(1); - Quote.Open(ch); - } else if (ch == '$') { - if (chNext == '{') { - state = SCE_SH_PARAM; - goto startQuote; - } else if (chNext == '\'') { - state = SCE_SH_CHARACTER; - goto startQuote; - } else if (chNext == '"') { - state = SCE_SH_STRING; - goto startQuote; - } else if (chNext == '(' && chNext2 == '(') { - styler.ColourTo(i, SCE_SH_OPERATOR); - state = SCE_SH_DEFAULT; - goto skipChar; - } else if (chNext == '(' || chNext == '`') { - state = SCE_SH_BACKTICKS; - startQuote: - Quote.New(1); - Quote.Open(chNext); - goto skipChar; - } else { - state = SCE_SH_SCALAR; - skipChar: - i++; - ch = chNext; - chNext = chNext2; - } - } else if (ch == '*') { - if (chNext == '*') { // exponentiation - i++; - ch = chNext; - chNext = chNext2; - } - styler.ColourTo(i, SCE_SH_OPERATOR); - } else if (ch == '<' && chNext == '<') { - state = SCE_SH_HERE_DELIM; - HereDoc.State = 0; - HereDoc.Indent = false; - } else if (ch == '-' // file test operators - && isSingleCharOp(chNext) - && !isalnum((chNext2 = styler.SafeGetCharAt(i+2))) - && isspace(chPrev)) { - styler.ColourTo(i + 1, SCE_SH_WORD); - state = SCE_SH_DEFAULT; - i++; - ch = chNext; - chNext = chNext2; - } else if (isBashOperator(ch)) { - styler.ColourTo(i, SCE_SH_OPERATOR); - } else { - // keep colouring defaults to make restart easier - styler.ColourTo(i, SCE_SH_DEFAULT); - } - } else if (state == SCE_SH_NUMBER) { - int digit = translateBashDigit(ch); - if (numBase == BASH_BASE_DECIMAL) { - if (ch == '#') { - numBase = getBashNumberBase(styler.GetStartSegment(), i - 1, styler); - if (numBase == BASH_BASE_ERROR) // take the rest as comment - goto numAtEnd; - } else if (!isdigit(ch)) - goto numAtEnd; - } else if (numBase == BASH_BASE_HEX) { - if ((digit < 16) || (digit >= 36 && digit <= 41)) { - // hex digit 0-9a-fA-F - } else - goto numAtEnd; -#ifdef PEDANTIC_OCTAL - } else if (numBase == BASH_BASE_OCTAL || - numBase == BASH_BASE_OCTAL_ERROR) { - if (digit > 7) { - if (digit <= 9) { - numBase = BASH_BASE_OCTAL_ERROR; - } else - goto numAtEnd; - } -#endif - } else if (numBase == BASH_BASE_ERROR) { - if (digit > 9) - goto numAtEnd; - } else { // DD#DDDD number style handling - if (digit != BASH_BASE_ERROR) { - if (numBase <= 36) { - // case-insensitive if base<=36 - if (digit >= 36) digit -= 26; - } - if (digit >= numBase) { - if (digit <= 9) { - numBase = BASH_BASE_ERROR; - } else - goto numAtEnd; - } - } else { - numAtEnd: - if (numBase == BASH_BASE_ERROR -#ifdef PEDANTIC_OCTAL - || numBase == BASH_BASE_OCTAL_ERROR -#endif - ) - state = SCE_SH_ERROR; - styler.ColourTo(i - 1, state); - state = SCE_SH_DEFAULT; - goto restartLexer; - } - } - } else if (state == SCE_SH_WORD) { - if (!iswordchar(chNext) && chNext != '+' && chNext != '-') { - // "." never used in Bash variable names - // but used in file names - classifyWordBash(styler.GetStartSegment(), i, keywords, styler); - state = SCE_SH_DEFAULT; - ch = ' '; - } - } else if (state == SCE_SH_IDENTIFIER) { - if (!iswordchar(chNext) && chNext != '+' && chNext != '-') { - styler.ColourTo(i, SCE_SH_IDENTIFIER); - state = SCE_SH_DEFAULT; - ch = ' '; - } - } else { - if (state == SCE_SH_COMMENTLINE) { - if (ch == '\\' && isEOLChar(chNext)) { - // comment continuation - if (chNext == '\r' && chNext2 == '\n') { - i += 2; - ch = styler.SafeGetCharAt(i); - chNext = styler.SafeGetCharAt(i + 1); - } else { - i++; - ch = chNext; - chNext = chNext2; - } - } else if (isEOLChar(ch)) { - styler.ColourTo(i - 1, state); - state = SCE_SH_DEFAULT; - goto restartLexer; - } else if (isEOLChar(chNext)) { - styler.ColourTo(i, state); - state = SCE_SH_DEFAULT; - } - } else if (state == SCE_SH_HERE_DELIM) { - // - // From Bash info: - // --------------- - // Specifier format is: <<[-]WORD - // Optional '-' is for removal of leading tabs from here-doc. - // Whitespace acceptable after <<[-] operator - // - if (HereDoc.State == 0) { // '<<' encountered - HereDoc.State = 1; - HereDoc.Quote = chNext; - HereDoc.Quoted = false; - HereDoc.DelimiterLength = 0; - HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0'; - if (chNext == '\'' || chNext == '\"') { // a quoted here-doc delimiter (' or ") - i++; - ch = chNext; - chNext = chNext2; - HereDoc.Quoted = true; - } else if (!HereDoc.Indent && chNext == '-') { // <<- indent case - HereDoc.Indent = true; - HereDoc.State = 0; - } else if (isalpha(chNext) || chNext == '_' || chNext == '\\' - || chNext == '-' || chNext == '+' || chNext == '!') { - // an unquoted here-doc delimiter, no special handling - // TODO check what exactly bash considers part of the delim - } else if (chNext == '<') { // HERE string <<< - i++; - ch = chNext; - chNext = chNext2; - styler.ColourTo(i, SCE_SH_HERE_DELIM); - state = SCE_SH_DEFAULT; - HereDoc.State = 0; - } else if (isspacechar(chNext)) { - // eat whitespace - HereDoc.State = 0; - } else if (isdigit(chNext) || chNext == '=' || chNext == '$') { - // left shift << or <<= operator cases - styler.ColourTo(i, SCE_SH_OPERATOR); - state = SCE_SH_DEFAULT; - HereDoc.State = 0; - } else { - // symbols terminates; deprecated zero-length delimiter - } - } else if (HereDoc.State == 1) { // collect the delimiter - if (HereDoc.Quoted) { // a quoted here-doc delimiter - if (ch == HereDoc.Quote) { // closing quote => end of delimiter - styler.ColourTo(i, state); - state = SCE_SH_DEFAULT; - } else { - if (ch == '\\' && chNext == HereDoc.Quote) { // escaped quote - i++; - ch = chNext; - chNext = chNext2; - } - HereDoc.Delimiter[HereDoc.DelimiterLength++] = ch; - HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0'; - } - } else { // an unquoted here-doc delimiter - if (isalnum(ch) || ch == '_' || ch == '-' || ch == '+' || ch == '!') { - HereDoc.Delimiter[HereDoc.DelimiterLength++] = ch; - HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0'; - } else if (ch == '\\') { - // skip escape prefix - } else { - styler.ColourTo(i - 1, state); - state = SCE_SH_DEFAULT; - goto restartLexer; - } - } - if (HereDoc.DelimiterLength >= HERE_DELIM_MAX - 1) { - styler.ColourTo(i - 1, state); - state = SCE_SH_ERROR; - goto restartLexer; - } - } - } else if (HereDoc.State == 2) { - // state == SCE_SH_HERE_Q - if (isMatch(styler, lengthDoc, i, HereDoc.Delimiter)) { - if (!HereDoc.Indent && isEOLChar(chPrev)) { - endHereDoc: - // standard HERE delimiter - i += HereDoc.DelimiterLength; - chPrev = styler.SafeGetCharAt(i - 1); - ch = styler.SafeGetCharAt(i); - if (isEOLChar(ch)) { - styler.ColourTo(i - 1, state); - state = SCE_SH_DEFAULT; - HereDoc.State = 0; - goto restartLexer; - } - chNext = styler.SafeGetCharAt(i + 1); - } else if (HereDoc.Indent) { - // indented HERE delimiter - unsigned int bk = (i > 0)? i - 1: 0; - while (i > 0) { - ch = styler.SafeGetCharAt(bk--); - if (isEOLChar(ch)) { - goto endHereDoc; - } else if (!isspacechar(ch)) { - break; // got leading non-whitespace - } - } - } - } - } else if (state == SCE_SH_SCALAR) { // variable names - if (isEndVar(ch)) { - if ((state == SCE_SH_SCALAR) - && i == (styler.GetStartSegment() + 1)) { - // Special variable: $(, $_ etc. - styler.ColourTo(i, state); - state = SCE_SH_DEFAULT; - } else { - styler.ColourTo(i - 1, state); - state = SCE_SH_DEFAULT; - goto restartLexer; - } - } - } else if (state == SCE_SH_STRING - || state == SCE_SH_CHARACTER - || state == SCE_SH_BACKTICKS - || state == SCE_SH_PARAM - ) { - if (!Quote.Down && !isspacechar(ch)) { - Quote.Open(ch); - } else if (ch == '\\' && Quote.Up != '\\') { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } else if (ch == Quote.Down) { - Quote.Count--; - if (Quote.Count == 0) { - Quote.Rep--; - if (Quote.Rep <= 0) { - styler.ColourTo(i, state); - state = SCE_SH_DEFAULT; - ch = ' '; - } - if (Quote.Up == Quote.Down) { - Quote.Count++; - } - } - } else if (ch == Quote.Up) { - Quote.Count++; - } - } - } - if (state == SCE_SH_ERROR) { - break; - } - chPrev = ch; - } - styler.ColourTo(lengthDoc - 1, state); -} - -static bool IsCommentLine(int line, Accessor &styler) { - int pos = styler.LineStart(line); - int eol_pos = styler.LineStart(line + 1) - 1; - for (int i = pos; i < eol_pos; i++) { - char ch = styler[i]; - if (ch == '#') - return true; - else if (ch != ' ' && ch != '\t') - return false; - } - return false; -} - -static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[], - Accessor &styler) { - bool foldComment = styler.GetPropertyInt("fold.comment") != 0; - bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; - int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); - int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; - int levelCurrent = levelPrev; - char chNext = styler[startPos]; - int styleNext = styler.StyleAt(startPos); - for (unsigned int i = startPos; i < endPos; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - int style = styleNext; - styleNext = styler.StyleAt(i + 1); - bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - // Comment folding - if (foldComment && atEOL && IsCommentLine(lineCurrent, styler)) - { - if (!IsCommentLine(lineCurrent - 1, styler) - && IsCommentLine(lineCurrent + 1, styler)) - levelCurrent++; - else if (IsCommentLine(lineCurrent - 1, styler) - && !IsCommentLine(lineCurrent+1, styler)) - levelCurrent--; - } - if (style == SCE_SH_OPERATOR) { - if (ch == '{') { - levelCurrent++; - } else if (ch == '}') { - levelCurrent--; - } - } - if (atEOL) { - int lev = levelPrev; - if (visibleChars == 0 && foldCompact) - lev |= SC_FOLDLEVELWHITEFLAG; - if ((levelCurrent > levelPrev) && (visibleChars > 0)) - lev |= SC_FOLDLEVELHEADERFLAG; - if (lev != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, lev); - } - lineCurrent++; - levelPrev = levelCurrent; - visibleChars = 0; - } - if (!isspacechar(ch)) - visibleChars++; - } - // Fill in the real level of the next line, keeping the current flags as they will be filled in later - int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; - styler.SetLevel(lineCurrent, levelPrev | flagsNext); -} - -static const char * const bashWordListDesc[] = { - "Keywords", - 0 -}; - -LexerModule lmBash(SCLEX_BASH, ColouriseBashDoc, "bash", FoldBashDoc, bashWordListDesc); +// Scintilla source code edit control +/** @file LexBash.cxx + ** Lexer for Bash. + **/ +// Copyright 2004-2008 by Neil Hodgson +// Adapted from LexPerl by Kein-Hong Man 2004 +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" +#include "CharacterSet.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +#define HERE_DELIM_MAX 256 + +// define this if you want 'invalid octals' to be marked as errors +// usually, this is not a good idea, permissive lexing is better +#undef PEDANTIC_OCTAL + +#define BASH_BASE_ERROR 65 +#define BASH_BASE_DECIMAL 66 +#define BASH_BASE_HEX 67 +#ifdef PEDANTIC_OCTAL +#define BASH_BASE_OCTAL 68 +#define BASH_BASE_OCTAL_ERROR 69 +#endif + +static inline int translateBashDigit(int ch) { + if (ch >= '0' && ch <= '9') { + return ch - '0'; + } else if (ch >= 'a' && ch <= 'z') { + return ch - 'a' + 10; + } else if (ch >= 'A' && ch <= 'Z') { + return ch - 'A' + 36; + } else if (ch == '@') { + return 62; + } else if (ch == '_') { + return 63; + } + return BASH_BASE_ERROR; +} + +static inline int getBashNumberBase(char *s) { + int i = 0; + int base = 0; + while (*s) { + base = base * 10 + (*s++ - '0'); + i++; + } + if (base > 64 || i > 2) { + return BASH_BASE_ERROR; + } + return base; +} + +static int opposite(int ch) { + if (ch == '(') return ')'; + if (ch == '[') return ']'; + if (ch == '{') return '}'; + if (ch == '<') return '>'; + return ch; +} + +static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler) { + + WordList &keywords = *keywordlists[0]; + + CharacterSet setWordStart(CharacterSet::setAlpha, "_"); + // note that [+-] are often parts of identifiers in shell scripts + CharacterSet setWord(CharacterSet::setAlphaNum, "._+-"); + CharacterSet setBashOperator(CharacterSet::setNone, "^&\\%()-+=|{}[]:;>,*/(ch); + Delimiter[DelimiterLength] = '\0'; + } + ~HereDocCls() { + delete []Delimiter; + } + }; + HereDocCls HereDoc; + + class QuoteCls { // Class to manage quote pairs (simplified vs LexPerl) + public: + int Count; + int Up, Down; + QuoteCls() { + Count = 0; + Up = '\0'; + Down = '\0'; + } + void Open(int u) { + Count++; + Up = u; + Down = opposite(Up); + } + void Start(int u) { + Count = 0; + Open(u); + } + }; + QuoteCls Quote; + + int numBase = 0; + int digit; + unsigned int endPos = startPos + length; + + // Backtrack to beginning of style if required... + // If in a long distance lexical state, backtrack to find quote characters + if (initStyle == SCE_SH_HERE_Q) { + while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_SH_HERE_DELIM)) { + startPos--; + } + startPos = styler.LineStart(styler.GetLine(startPos)); + initStyle = styler.StyleAt(startPos - 1); + } + // Bash strings can be multi-line with embedded newlines, so backtrack. + // Bash numbers have additional state during lexing, so backtrack too. + if (initStyle == SCE_SH_STRING + || initStyle == SCE_SH_BACKTICKS + || initStyle == SCE_SH_CHARACTER + || initStyle == SCE_SH_NUMBER + || initStyle == SCE_SH_IDENTIFIER + || initStyle == SCE_SH_COMMENTLINE) { + while ((startPos > 1) && (styler.StyleAt(startPos - 1) == initStyle)) { + startPos--; + } + initStyle = SCE_SH_DEFAULT; + } + + StyleContext sc(startPos, endPos - startPos, initStyle, styler); + + for (; sc.More(); sc.Forward()) { + + // Determine if the current state should terminate. + switch (sc.state) { + case SCE_SH_OPERATOR: + sc.SetState(SCE_SH_DEFAULT); + break; + case SCE_SH_WORD: + // "." never used in Bash variable names but used in file names + if (!setWord.Contains(sc.ch)) { + char s[1000]; + sc.GetCurrent(s, sizeof(s)); + if (s[0] != '-' && // for file operators + !keywords.InList(s)) { + sc.ChangeState(SCE_SH_IDENTIFIER); + } + sc.SetState(SCE_SH_DEFAULT); + } + break; + case SCE_SH_IDENTIFIER: + if (sc.chPrev == '\\') { // for escaped chars + sc.ForwardSetState(SCE_SH_DEFAULT); + } else if (!setWord.Contains(sc.ch)) { + sc.SetState(SCE_SH_DEFAULT); + } + break; + case SCE_SH_NUMBER: + digit = translateBashDigit(sc.ch); + if (numBase == BASH_BASE_DECIMAL) { + if (sc.ch == '#') { + char s[10]; + sc.GetCurrent(s, sizeof(s)); + numBase = getBashNumberBase(s); + if (numBase != BASH_BASE_ERROR) + break; + } else if (IsADigit(sc.ch)) + break; + } else if (numBase == BASH_BASE_HEX) { + if (IsADigit(sc.ch, 16)) + break; +#ifdef PEDANTIC_OCTAL + } else if (numBase == BASH_BASE_OCTAL || + numBase == BASH_BASE_OCTAL_ERROR) { + if (digit <= 7) + break; + if (digit <= 9) { + numBase = BASH_BASE_OCTAL_ERROR; + break; + } +#endif + } else if (numBase == BASH_BASE_ERROR) { + if (digit <= 9) + break; + } else { // DD#DDDD number style handling + if (digit != BASH_BASE_ERROR) { + if (numBase <= 36) { + // case-insensitive if base<=36 + if (digit >= 36) digit -= 26; + } + if (digit < numBase) + break; + if (digit <= 9) { + numBase = BASH_BASE_ERROR; + break; + } + } + } + // fallthrough when number is at an end or error + if (numBase == BASH_BASE_ERROR +#ifdef PEDANTIC_OCTAL + || numBase == BASH_BASE_OCTAL_ERROR +#endif + ) { + sc.ChangeState(SCE_SH_ERROR); + } + sc.SetState(SCE_SH_DEFAULT); + break; + case SCE_SH_COMMENTLINE: + if (sc.ch == '\\' && (sc.chNext == '\r' || sc.chNext == '\n')) { + // comment continuation + sc.Forward(); + if (sc.ch == '\r' && sc.chNext == '\n') { + sc.Forward(); + } + } else if (sc.atLineEnd) { + sc.ForwardSetState(SCE_SH_DEFAULT); + } + break; + case SCE_SH_HERE_DELIM: + // From Bash info: + // --------------- + // Specifier format is: <<[-]WORD + // Optional '-' is for removal of leading tabs from here-doc. + // Whitespace acceptable after <<[-] operator + // + if (HereDoc.State == 0) { // '<<' encountered + HereDoc.Quote = sc.chNext; + HereDoc.Quoted = false; + HereDoc.DelimiterLength = 0; + HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0'; + if (sc.chNext == '\'' || sc.chNext == '\"') { // a quoted here-doc delimiter (' or ") + sc.Forward(); + HereDoc.Quoted = true; + HereDoc.State = 1; + } else if (!HereDoc.Indent && sc.chNext == '-') { // <<- indent case + HereDoc.Indent = true; + } else if (setHereDoc.Contains(sc.chNext)) { + // an unquoted here-doc delimiter, no special handling + // TODO check what exactly bash considers part of the delim + HereDoc.State = 1; + } else if (sc.chNext == '<') { // HERE string <<< + sc.Forward(); + sc.ForwardSetState(SCE_SH_DEFAULT); + } else if (IsASpace(sc.chNext)) { + // eat whitespace + } else if (setLeftShift.Contains(sc.chNext)) { + // left shift << or <<= operator cases + sc.ChangeState(SCE_SH_OPERATOR); + sc.ForwardSetState(SCE_SH_DEFAULT); + } else { + // symbols terminates; deprecated zero-length delimiter + HereDoc.State = 1; + } + } else if (HereDoc.State == 1) { // collect the delimiter + if (HereDoc.Quoted) { // a quoted here-doc delimiter + if (sc.ch == HereDoc.Quote) { // closing quote => end of delimiter + sc.ForwardSetState(SCE_SH_DEFAULT); + } else { + if (sc.ch == '\\' && sc.chNext == HereDoc.Quote) { // escaped quote + sc.Forward(); + } + HereDoc.Append(sc.ch); + } + } else { // an unquoted here-doc delimiter + if (setHereDoc2.Contains(sc.ch)) { + HereDoc.Append(sc.ch); + } else if (sc.ch == '\\') { + // skip escape prefix + } else { + sc.SetState(SCE_SH_DEFAULT); + } + } + if (HereDoc.DelimiterLength >= HERE_DELIM_MAX - 1) { // force blowup + sc.SetState(SCE_SH_ERROR); + HereDoc.State = 0; + } + } + break; + case SCE_SH_HERE_Q: + // HereDoc.State == 2 + if (sc.atLineStart) { + sc.SetState(SCE_SH_HERE_Q); + int prefixws = 0; + while (IsASpace(sc.ch) && !sc.atLineEnd) { // whitespace prefix + sc.Forward(); + prefixws++; + } + if (prefixws > 0) + sc.SetState(SCE_SH_HERE_Q); + while (!sc.atLineEnd) { + sc.Forward(); + } + char s[HERE_DELIM_MAX]; + sc.GetCurrent(s, sizeof(s)); + if (sc.LengthCurrent() == 0) + break; + if (s[strlen(s) - 1] == '\r') + s[strlen(s) - 1] = '\0'; + if (strcmp(HereDoc.Delimiter, s) == 0) { + if ((prefixws > 0 && HereDoc.Indent) || // indentation rule + (prefixws == 0 && !HereDoc.Indent)) { + sc.SetState(SCE_SH_DEFAULT); + break; + } + } + } + break; + case SCE_SH_SCALAR: // variable names + if (!setParam.Contains(sc.ch)) { + if (sc.LengthCurrent() == 1) { + // Special variable: $(, $_ etc. + sc.ForwardSetState(SCE_SH_DEFAULT); + } else { + sc.SetState(SCE_SH_DEFAULT); + } + } + break; + case SCE_SH_STRING: // delimited styles + case SCE_SH_CHARACTER: + case SCE_SH_BACKTICKS: + case SCE_SH_PARAM: + if (sc.ch == '\\' && Quote.Up != '\\') { + sc.Forward(); + } else if (sc.ch == Quote.Down) { + Quote.Count--; + if (Quote.Count == 0) { + sc.ForwardSetState(SCE_SH_DEFAULT); + } + } else if (sc.ch == Quote.Up) { + Quote.Count++; + } + break; + } + + // Must check end of HereDoc state 1 before default state is handled + if (HereDoc.State == 1 && sc.atLineEnd) { + // Begin of here-doc (the line after the here-doc delimiter): + // Lexically, the here-doc starts from the next line after the >>, but the + // first line of here-doc seem to follow the style of the last EOL sequence + HereDoc.State = 2; + if (HereDoc.Quoted) { + if (sc.state == SCE_SH_HERE_DELIM) { + // Missing quote at end of string! We are stricter than bash. + // Colour here-doc anyway while marking this bit as an error. + sc.ChangeState(SCE_SH_ERROR); + } + // HereDoc.Quote always == '\'' + } + sc.SetState(SCE_SH_HERE_Q); + } + + // Determine if a new state should be entered. + if (sc.state == SCE_SH_DEFAULT) { + if (sc.ch == '\\') { // escaped character + sc.SetState(SCE_SH_IDENTIFIER); + } else if (IsADigit(sc.ch)) { + sc.SetState(SCE_SH_NUMBER); + numBase = BASH_BASE_DECIMAL; + if (sc.ch == '0') { // hex,octal + if (sc.chNext == 'x' || sc.chNext == 'X') { + numBase = BASH_BASE_HEX; + sc.Forward(); + } else if (IsADigit(sc.chNext)) { +#ifdef PEDANTIC_OCTAL + numBase = BASH_BASE_OCTAL; +#else + numBase = BASH_BASE_HEX; +#endif + } + } + } else if (setWordStart.Contains(sc.ch)) { + sc.SetState(SCE_SH_WORD); + } else if (sc.ch == '#') { + sc.SetState(SCE_SH_COMMENTLINE); + } else if (sc.ch == '\"') { + sc.SetState(SCE_SH_STRING); + Quote.Start(sc.ch); + } else if (sc.ch == '\'') { + sc.SetState(SCE_SH_CHARACTER); + Quote.Start(sc.ch); + } else if (sc.ch == '`') { + sc.SetState(SCE_SH_BACKTICKS); + Quote.Start(sc.ch); + } else if (sc.ch == '$') { + sc.SetState(SCE_SH_SCALAR); + sc.Forward(); + if (sc.ch == '{') { + sc.ChangeState(SCE_SH_PARAM); + } else if (sc.ch == '\'') { + sc.ChangeState(SCE_SH_CHARACTER); + } else if (sc.ch == '"') { + sc.ChangeState(SCE_SH_STRING); + } else if (sc.ch == '(' || sc.ch == '`') { + sc.ChangeState(SCE_SH_BACKTICKS); + if (sc.chNext == '(') { // $(( is lexed as operator + sc.ChangeState(SCE_SH_OPERATOR); + } + } else { + continue; // scalar has no delimiter pair + } + // fallthrough, open delim for $[{'"(`] + Quote.Start(sc.ch); + } else if (sc.Match('<', '<')) { + sc.SetState(SCE_SH_HERE_DELIM); + HereDoc.State = 0; + HereDoc.Indent = false; + } else if (sc.ch == '-' && // one-char file test operators + setSingleCharOp.Contains(sc.chNext) && + !setWord.Contains(sc.GetRelative(2)) && + IsASpace(sc.chPrev)) { + sc.SetState(SCE_SH_WORD); + sc.Forward(); + } else if (setBashOperator.Contains(sc.ch)) { + sc.SetState(SCE_SH_OPERATOR); + } + } + } + sc.Complete(); +} + +static bool IsCommentLine(int line, Accessor &styler) { + int pos = styler.LineStart(line); + int eol_pos = styler.LineStart(line + 1) - 1; + for (int i = pos; i < eol_pos; i++) { + char ch = styler[i]; + if (ch == '#') + return true; + else if (ch != ' ' && ch != '\t') + return false; + } + return false; +} + +static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[], + Accessor &styler) { + bool foldComment = styler.GetPropertyInt("fold.comment") != 0; + bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + unsigned int endPos = startPos + length; + int visibleChars = 0; + int lineCurrent = styler.GetLine(startPos); + int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; + int levelCurrent = levelPrev; + char chNext = styler[startPos]; + int styleNext = styler.StyleAt(startPos); + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + int style = styleNext; + styleNext = styler.StyleAt(i + 1); + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + // Comment folding + if (foldComment && atEOL && IsCommentLine(lineCurrent, styler)) + { + if (!IsCommentLine(lineCurrent - 1, styler) + && IsCommentLine(lineCurrent + 1, styler)) + levelCurrent++; + else if (IsCommentLine(lineCurrent - 1, styler) + && !IsCommentLine(lineCurrent + 1, styler)) + levelCurrent--; + } + if (style == SCE_SH_OPERATOR) { + if (ch == '{') { + levelCurrent++; + } else if (ch == '}') { + levelCurrent--; + } + } + if (atEOL) { + int lev = levelPrev; + if (visibleChars == 0 && foldCompact) + lev |= SC_FOLDLEVELWHITEFLAG; + if ((levelCurrent > levelPrev) && (visibleChars > 0)) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + lineCurrent++; + levelPrev = levelCurrent; + visibleChars = 0; + } + if (!isspacechar(ch)) + visibleChars++; + } + // Fill in the real level of the next line, keeping the current flags as they will be filled in later + int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; + styler.SetLevel(lineCurrent, levelPrev | flagsNext); +} + +static const char * const bashWordListDesc[] = { + "Keywords", + 0 +}; + +LexerModule lmBash(SCLEX_BASH, ColouriseBashDoc, "bash", FoldBashDoc, bashWordListDesc); diff --git a/sdk/wxscintilla/src/scintilla/src/LexCOBOL.cxx b/sdk/wxscintilla/src/scintilla/src/LexCOBOL.cxx new file mode 100644 index 0000000000..d061d5c674 --- /dev/null +++ b/sdk/wxscintilla/src/scintilla/src/LexCOBOL.cxx @@ -0,0 +1,368 @@ +// Scintilla source code edit control +/** @file LexCOBOL.cxx + ** Lexer for COBOL + ** Based on LexPascal.cxx + ** Written by Laurent le Tynevez + ** Updated by Simon Steele September 2002 + ** Updated by Mathias Rauen May 2003 (Delphi adjustments) + ** Updated by Rod Falck, Aug 2006 Converted to COBOL + **/ + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" +#include "StyleContext.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +#define IN_DIVISION 0x01 +#define IN_DECLARATIVES 0x02 +#define IN_SECTION 0x04 +#define IN_PARAGRAPH 0x08 +#define IN_FLAGS 0xF +#define NOT_HEADER 0x10 + +inline bool isCOBOLoperator(char ch) + { + return isoperator(ch); + } + +inline bool isCOBOLwordchar(char ch) + { + return isascii(ch) && (isalnum(ch) || ch == '-'); + + } + +inline bool isCOBOLwordstart(char ch) + { + return isascii(ch) && isalnum(ch); + } + +static int CountBits(int nBits) + { + int count = 0; + for (int i = 0; i < 32; ++i) + { + count += nBits & 1; + nBits >>= 1; + } + return count; + } + +static void getRange(unsigned int start, + unsigned int end, + Accessor &styler, + char *s, + unsigned int len) { + unsigned int i = 0; + while ((i < end - start + 1) && (i < len-1)) { + s[i] = static_cast(tolower(styler[start + i])); + i++; + } + s[i] = '\0'; +} + +static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr) { + styler.ColourTo(end, attr); +} + + +static int classifyWordCOBOL(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, int nContainment, bool *bAarea) { + int ret = 0; + + WordList& a_keywords = *keywordlists[0]; + WordList& b_keywords = *keywordlists[1]; + WordList& c_keywords = *keywordlists[2]; + + char s[100]; + getRange(start, end, styler, s, sizeof(s)); + + char chAttr = SCE_C_IDENTIFIER; + if (isdigit(s[0]) || (s[0] == '.')) { + chAttr = SCE_C_NUMBER; + char *p = s + 1; + while (*p) { + if (!isdigit(*p) && isCOBOLwordchar(*p)) { + chAttr = SCE_C_IDENTIFIER; + break; + } + ++p; + } + } + else { + if (a_keywords.InList(s)) { + chAttr = SCE_C_WORD; + } + else if (b_keywords.InList(s)) { + chAttr = SCE_C_WORD2; + } + else if (c_keywords.InList(s)) { + chAttr = SCE_C_UUID; + } + } + if (*bAarea) { + if (strcmp(s, "division") == 0) { + ret = IN_DIVISION; + // we've determined the containment, anything else is just ignored for those purposes + *bAarea = false; + } else if (strcmp(s, "declaratives") == 0) { + ret = IN_DIVISION | IN_DECLARATIVES; + if (nContainment & IN_DECLARATIVES) + ret |= NOT_HEADER | IN_SECTION; + // we've determined the containment, anything else is just ignored for those purposes + *bAarea = false; + } else if (strcmp(s, "section") == 0) { + ret = (nContainment &~ IN_PARAGRAPH) | IN_SECTION; + // we've determined the containment, anything else is just ignored for those purposes + *bAarea = false; + } else if (strcmp(s, "end") == 0 && (nContainment & IN_DECLARATIVES)) { + ret = IN_DIVISION | IN_DECLARATIVES | IN_SECTION | NOT_HEADER; + } else { + ret = nContainment | IN_PARAGRAPH; + } + } + ColourTo(styler, end, chAttr); + return ret; +} + +static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], + Accessor &styler) { + + styler.StartAt(startPos); + + int state = initStyle; + if (state == SCE_C_CHARACTER) // Does not leak onto next line + state = SCE_C_DEFAULT; + char chPrev = ' '; + char chNext = styler[startPos]; + unsigned int lengthDoc = startPos + length; + + int nContainment; + + int currentLine = styler.GetLine(startPos); + if (currentLine > 0) { + styler.SetLineState(currentLine, styler.GetLineState(currentLine-1)); + nContainment = styler.GetLineState(currentLine); + nContainment &= ~NOT_HEADER; + } else { + styler.SetLineState(currentLine, 0); + nContainment = 0; + } + + styler.StartSegment(startPos); + bool bNewLine = true; + bool bAarea = !isspacechar(chNext); + int column = 0; + for (unsigned int i = startPos; i < lengthDoc; i++) { + char ch = chNext; + + chNext = styler.SafeGetCharAt(i + 1); + + ++column; + + if (bNewLine) { + column = 0; + } + if (column <= 1 && !bAarea) { + bAarea = !isspacechar(ch); + } + bool bSetNewLine = false; + if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { + // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix) + // Avoid triggering two times on Dos/Win + // End of line + if (state == SCE_C_CHARACTER) { + ColourTo(styler, i, state); + state = SCE_C_DEFAULT; + } + styler.SetLineState(currentLine, nContainment); + currentLine++; + bSetNewLine = true; + if (nContainment & NOT_HEADER) + nContainment &= ~(NOT_HEADER | IN_DECLARATIVES | IN_SECTION); + } + + if (styler.IsLeadByte(ch)) { + chNext = styler.SafeGetCharAt(i + 2); + chPrev = ' '; + i += 1; + continue; + } + + if (state == SCE_C_DEFAULT) { + if (isCOBOLwordstart(ch) || (ch == '$' && isalpha(chNext))) { + ColourTo(styler, i-1, state); + state = SCE_C_IDENTIFIER; + } else if (column == 0 && ch == '*' && chNext != '*') { + ColourTo(styler, i-1, state); + state = SCE_C_COMMENTLINE; + } else if (column == 0 && ch == '/' && chNext != '*') { + ColourTo(styler, i-1, state); + state = SCE_C_COMMENTLINE; + } else if (column == 0 && ch == '*' && chNext == '*') { + ColourTo(styler, i-1, state); + state = SCE_C_COMMENTDOC; + } else if (column == 0 && ch == '/' && chNext == '*') { + ColourTo(styler, i-1, state); + state = SCE_C_COMMENTDOC; + } else if (ch == '"') { + ColourTo(styler, i-1, state); + state = SCE_C_STRING; + } else if (ch == '\'') { + ColourTo(styler, i-1, state); + state = SCE_C_CHARACTER; + } else if (ch == '?' && column == 0) { + ColourTo(styler, i-1, state); + state = SCE_C_PREPROCESSOR; + } else if (isCOBOLoperator(ch)) { + ColourTo(styler, i-1, state); + ColourTo(styler, i, SCE_C_OPERATOR); + } + } else if (state == SCE_C_IDENTIFIER) { + if (!isCOBOLwordchar(ch)) { + int lStateChange = classifyWordCOBOL(styler.GetStartSegment(), i - 1, keywordlists, styler, nContainment, &bAarea); + + if(lStateChange != 0) { + styler.SetLineState(currentLine, lStateChange); + nContainment = lStateChange; + } + + state = SCE_C_DEFAULT; + chNext = styler.SafeGetCharAt(i + 1); + if (ch == '"') { + state = SCE_C_STRING; + } else if (ch == '\'') { + state = SCE_C_CHARACTER; + } else if (isCOBOLoperator(ch)) { + ColourTo(styler, i, SCE_C_OPERATOR); + } + } + } else { + if (state == SCE_C_PREPROCESSOR) { + if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) { + ColourTo(styler, i-1, state); + state = SCE_C_DEFAULT; + } + } else if (state == SCE_C_COMMENT) { + if (ch == '\r' || ch == '\n') { + ColourTo(styler, i, state); + state = SCE_C_DEFAULT; + } + } else if (state == SCE_C_COMMENTDOC) { + if (ch == '\r' || ch == '\n') { + if (((i > styler.GetStartSegment() + 2) || ( + (initStyle == SCE_C_COMMENTDOC) && + (styler.GetStartSegment() == static_cast(startPos))))) { + ColourTo(styler, i, state); + state = SCE_C_DEFAULT; + } + } + } else if (state == SCE_C_COMMENTLINE) { + if (ch == '\r' || ch == '\n') { + ColourTo(styler, i-1, state); + state = SCE_C_DEFAULT; + } + } else if (state == SCE_C_STRING) { + if (ch == '"') { + ColourTo(styler, i, state); + state = SCE_C_DEFAULT; + } + } else if (state == SCE_C_CHARACTER) { + if (ch == '\'') { + ColourTo(styler, i, state); + state = SCE_C_DEFAULT; + } + } + } + chPrev = ch; + bNewLine = bSetNewLine; + if (bNewLine) + { + bAarea = false; + } + } + ColourTo(styler, lengthDoc - 1, state); +} + +static void FoldCOBOLDoc(unsigned int startPos, int length, int, WordList *[], + Accessor &styler) { + bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + unsigned int endPos = startPos + length; + int visibleChars = 0; + int lineCurrent = styler.GetLine(startPos); + int levelPrev = lineCurrent > 0 ? styler.LevelAt(lineCurrent - 1) & SC_FOLDLEVELNUMBERMASK : 0xFFF; + char chNext = styler[startPos]; + + bool bNewLine = true; + bool bAarea = !isspacechar(chNext); + int column = 0; + bool bComment = false; + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + ++column; + + if (bNewLine) { + column = 0; + bComment = (ch == '*' || ch == '/' || ch == '?'); + } + if (column <= 1 && !bAarea) { + bAarea = !isspacechar(ch); + } + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + if (atEOL) { + int nContainment = styler.GetLineState(lineCurrent); + int lev = CountBits(nContainment & IN_FLAGS) | SC_FOLDLEVELBASE; + if (bAarea && !bComment) + --lev; + if (visibleChars == 0 && foldCompact) + lev |= SC_FOLDLEVELWHITEFLAG; + if ((bAarea) && (visibleChars > 0) && !(nContainment & NOT_HEADER) && !bComment) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + if ((lev & SC_FOLDLEVELNUMBERMASK) <= (levelPrev & SC_FOLDLEVELNUMBERMASK)) { + // this level is at the same level or less than the previous line + // therefore these is nothing for the previous header to collapse, so remove the header + styler.SetLevel(lineCurrent - 1, levelPrev & ~SC_FOLDLEVELHEADERFLAG); + } + levelPrev = lev; + visibleChars = 0; + bAarea = false; + bNewLine = true; + lineCurrent++; + } else { + bNewLine = false; + } + + + if (!isspacechar(ch)) + visibleChars++; + } + + // Fill in the real level of the next line, keeping the current flags as they will be filled in later + int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; + styler.SetLevel(lineCurrent, levelPrev | flagsNext); +} + +static const char * const COBOLWordListDesc[] = { + "A Keywords", + "B Keywords", + "Extended Keywords", + 0 +}; + +LexerModule lmCOBOL(SCLEX_COBOL, ColouriseCOBOLDoc, "COBOL", FoldCOBOLDoc, COBOLWordListDesc); diff --git a/sdk/wxscintilla/src/scintilla/src/LexCPP.cxx b/sdk/wxscintilla/src/scintilla/src/LexCPP.cxx index 4fe0a5d018..7f816fadfd 100644 --- a/sdk/wxscintilla/src/scintilla/src/LexCPP.cxx +++ b/sdk/wxscintilla/src/scintilla/src/LexCPP.cxx @@ -58,6 +58,9 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo WordList &keywords3 = *keywordlists[2]; WordList &keywords4 = *keywordlists[3]; + // property styling.within.preprocessor + // For C++ code, determines whether all preprocessor code is styled in the preprocessor style (0, the default) + // or only from the initial # to the end of the command word(1). bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor") != 0; CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-"); @@ -67,6 +70,9 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true); CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true); + + // property lexer.cpp.allow.dollars + // Set to 0 to disallow the '$' character in identifiers with the cpp lexer. if (styler.GetPropertyInt("lexer.cpp.allow.dollars", 1) != 0) { setWordStart.Add('$'); setWord.Add('$'); @@ -78,6 +84,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo bool lastOpSetScope = false; int styleBeforeDCKeyword = SCE_C_DEFAULT; bool continuationLine = false; + bool isIncludePreprocessor = false; if (initStyle == SCE_C_PREPROCESSOR) { // Set continuationLine if last character of previous line is '\' @@ -119,6 +126,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo // if different sets of lines lexed. visibleChars = 0; lastWordWasUUID = false; + isIncludePreprocessor = false; } // Handle line continuation generically. @@ -233,6 +241,11 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo case SCE_C_STRING: if (sc.atLineEnd) { sc.ChangeState(SCE_C_STRINGEOL); + } else if (isIncludePreprocessor) { + if (sc.ch == '>') { + sc.ForwardSetState(SCE_C_DEFAULT); + isIncludePreprocessor = false; + } } else if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); @@ -324,6 +337,9 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo sc.SetState(SCE_C_REGEX); // JavaScript's RegEx } else if (sc.ch == '\"') { sc.SetState(SCE_C_STRING); + isIncludePreprocessor = false; // ensure that '>' won't end the string + } else if (isIncludePreprocessor && sc.ch == '<') { + sc.SetState(SCE_C_STRING); } else if (sc.ch == '\'') { sc.SetState(SCE_C_CHARACTER); } else if (sc.ch == '#' && visibleChars == 0) { @@ -335,6 +351,8 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()); if (sc.atLineEnd) { sc.SetState(SCE_C_DEFAULT); + } else if (sc.Match("include")) { + isIncludePreprocessor = true; } } else if (isoperator(static_cast(sc.ch))) { sc.SetState(SCE_C_OPERATOR); @@ -372,10 +390,24 @@ static bool IsStreamCommentStyle(int style) { // and to make it possible to fiddle the current level for "} else {". static void FoldCppDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { + + // property fold.comment + // This option enables folding multi-line comments and explicit fold points when using the C++ lexer. + // Explicit fold points allows adding extra folding by placing a //{ comment at the start and a //} + // at the end of a section that should fold. bool foldComment = styler.GetPropertyInt("fold.comment") != 0; + + // property fold.preprocessor + // This option enables folding preprocessor directives when using the C++ lexer. + // Includes C#'s explicit #region and #endregion folding directives. bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; + bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + + // property fold.at.else + // This option enables C++ folding on a "} else {" line of an if statement. bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; + unsigned int endPos = startPos + length; int visibleChars = 0; int lineCurrent = styler.GetLine(startPos); @@ -422,18 +454,6 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle, levelNext++; } else if (styler.Match(j, "end")) { levelNext--; - } else if (j < endPos && isdigit(styler.SafeGetCharAt(j))) { - // e.g.: # 34 "file.h" 1 3 4 - // a '1' after the file name indicates start of include, a '2' end of include - char pch, nch = ch; - do pch = nch, nch = styler.SafeGetCharAt(++j); - while (j < endPos && nch != '\r' && nch != '\n' && - !((nch == '1' || nch == '2') && IsASpaceOrTab(pch))); - if (nch == '1') { - levelNext++; - } else if (nch == '2') { - levelNext--; - } } } } @@ -467,6 +487,10 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle, lineCurrent++; levelCurrent = levelNext; levelMinCurrent = levelCurrent; + if (atEOL && (i == static_cast(styler.Length()-1))) { + // There is an empty line at end of file so give it same level and empty + styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); + } visibleChars = 0; } } diff --git a/sdk/wxscintilla/src/scintilla/src/LexCSS.cxx b/sdk/wxscintilla/src/scintilla/src/LexCSS.cxx index b60408bd19..3b139cdcdd 100644 --- a/sdk/wxscintilla/src/scintilla/src/LexCSS.cxx +++ b/sdk/wxscintilla/src/scintilla/src/LexCSS.cxx @@ -1,307 +1,363 @@ -// Scintilla source code edit control -/** @file LexCSS.cxx - ** Lexer for Cascading Style Sheets - ** Written by Jakub Vrána - ** Improved by Philippe Lhoste (CSS2) - **/ -// Copyright 1998-2002 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - - -static inline bool IsAWordChar(const unsigned int ch) { - return (isalnum(ch) || ch == '-' || ch == '_' || ch >= 161); // _ is not in fact correct CSS word-character -} - -inline bool IsCssOperator(const char ch) { - if (!isalnum(ch) && - (ch == '{' || ch == '}' || ch == ':' || ch == ',' || ch == ';' || - ch == '.' || ch == '#' || ch == '!' || ch == '@' || - /* CSS2 */ - ch == '*' || ch == '>' || ch == '+' || ch == '=' || ch == '~' || ch == '|' || - ch == '[' || ch == ']' || ch == '(' || ch == ')')) { - return true; - } - return false; -} - -static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { - WordList &keywords = *keywordlists[0]; - WordList &pseudoClasses = *keywordlists[1]; - WordList &keywords2 = *keywordlists[2]; - - StyleContext sc(startPos, length, initStyle, styler); - - int lastState = -1; // before operator - int lastStateC = -1; // before comment - int op = ' '; // last operator - - for (; sc.More(); sc.Forward()) { - if (sc.state == SCE_CSS_COMMENT && sc.Match('*', '/')) { - if (lastStateC == -1) { - // backtrack to get last state: - // comments are like whitespace, so we must return to the previous state - unsigned int i = startPos; - for (; i > 0; i--) { - if ((lastStateC = styler.StyleAt(i-1)) != SCE_CSS_COMMENT) { - if (lastStateC == SCE_CSS_OPERATOR) { - op = styler.SafeGetCharAt(i-1); - while (--i) { - lastState = styler.StyleAt(i-1); - if (lastState != SCE_CSS_OPERATOR && lastState != SCE_CSS_COMMENT) - break; - } - if (i == 0) - lastState = SCE_CSS_DEFAULT; - } - break; - } - } - if (i == 0) - lastStateC = SCE_CSS_DEFAULT; - } - sc.Forward(); - sc.ForwardSetState(lastStateC); - } - - if (sc.state == SCE_CSS_COMMENT) - continue; - - if (sc.state == SCE_CSS_DOUBLESTRING || sc.state == SCE_CSS_SINGLESTRING) { - if (sc.ch != (sc.state == SCE_CSS_DOUBLESTRING ? '\"' : '\'')) - continue; - unsigned int i = sc.currentPos; - while (i && styler[i-1] == '\\') - i--; - if ((sc.currentPos - i) % 2 == 1) - continue; - sc.ForwardSetState(SCE_CSS_VALUE); - } - - if (sc.state == SCE_CSS_OPERATOR) { - if (op == ' ') { - unsigned int i = startPos; - op = styler.SafeGetCharAt(i-1); - while (--i) { - lastState = styler.StyleAt(i-1); - if (lastState != SCE_CSS_OPERATOR && lastState != SCE_CSS_COMMENT) - break; - } - } - switch (op) { - case '@': - if (lastState == SCE_CSS_DEFAULT) - sc.SetState(SCE_CSS_DIRECTIVE); - break; - case '*': - if (lastState == SCE_CSS_DEFAULT) - sc.SetState(SCE_CSS_TAG); - break; - case '>': - case '+': - if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_CLASS - || lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS) - sc.SetState(SCE_CSS_DEFAULT); - break; - case '[': - if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT || - lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS) - sc.SetState(SCE_CSS_ATTRIBUTE); - break; - case ']': - if (lastState == SCE_CSS_ATTRIBUTE) - sc.SetState(SCE_CSS_TAG); - break; - case '{': - if (lastState == SCE_CSS_DIRECTIVE) - sc.SetState(SCE_CSS_DEFAULT); - else if (lastState == SCE_CSS_TAG) - sc.SetState(SCE_CSS_IDENTIFIER); - break; - case '}': - if (lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_VALUE || lastState == SCE_CSS_IMPORTANT || - lastState == SCE_CSS_IDENTIFIER || lastState == SCE_CSS_IDENTIFIER2) - sc.SetState(SCE_CSS_DEFAULT); - break; - case ':': - if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT || - lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS) - sc.SetState(SCE_CSS_PSEUDOCLASS); - else if (lastState == SCE_CSS_IDENTIFIER || lastState == SCE_CSS_IDENTIFIER2 || lastState == SCE_CSS_UNKNOWN_IDENTIFIER) - sc.SetState(SCE_CSS_VALUE); - break; - case '.': - if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT || - lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS) - sc.SetState(SCE_CSS_CLASS); - break; - case '#': - if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT || - lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS) - sc.SetState(SCE_CSS_ID); - break; - case ',': - if (lastState == SCE_CSS_TAG) - sc.SetState(SCE_CSS_DEFAULT); - break; - case ';': - if (lastState == SCE_CSS_DIRECTIVE) - sc.SetState(SCE_CSS_DEFAULT); - else if (lastState == SCE_CSS_VALUE || lastState == SCE_CSS_IMPORTANT) - sc.SetState(SCE_CSS_IDENTIFIER); - break; - case '!': - if (lastState == SCE_CSS_VALUE) - sc.SetState(SCE_CSS_IMPORTANT); - break; - } - } - - if (IsAWordChar(sc.ch)) { - if (sc.state == SCE_CSS_DEFAULT) - sc.SetState(SCE_CSS_TAG); - continue; - } - - if (IsAWordChar(sc.chPrev) && ( - sc.state == SCE_CSS_IDENTIFIER || sc.state == SCE_CSS_IDENTIFIER2 - || sc.state == SCE_CSS_UNKNOWN_IDENTIFIER - || sc.state == SCE_CSS_PSEUDOCLASS || sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS - || sc.state == SCE_CSS_IMPORTANT - )) { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - char *s2 = s; - while (*s2 && !IsAWordChar(*s2)) - s2++; - switch (sc.state) { - case SCE_CSS_IDENTIFIER: - if (!keywords.InList(s2)) { - if (keywords2.InList(s2)) { - sc.ChangeState(SCE_CSS_IDENTIFIER2); - } else { - sc.ChangeState(SCE_CSS_UNKNOWN_IDENTIFIER); - } - } - break; - case SCE_CSS_UNKNOWN_IDENTIFIER: - if (keywords.InList(s2)) - sc.ChangeState(SCE_CSS_IDENTIFIER); - else if (keywords2.InList(s2)) - sc.ChangeState(SCE_CSS_IDENTIFIER2); - break; - case SCE_CSS_PSEUDOCLASS: - if (!pseudoClasses.InList(s2)) - sc.ChangeState(SCE_CSS_UNKNOWN_PSEUDOCLASS); - break; - case SCE_CSS_UNKNOWN_PSEUDOCLASS: - if (pseudoClasses.InList(s2)) - sc.ChangeState(SCE_CSS_PSEUDOCLASS); - break; - case SCE_CSS_IMPORTANT: - if (strcmp(s2, "important") != 0) - sc.ChangeState(SCE_CSS_VALUE); - break; - } - } - - if (sc.ch != '.' && sc.ch != ':' && sc.ch != '#' && (sc.state == SCE_CSS_CLASS || sc.state == SCE_CSS_PSEUDOCLASS || sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS || sc.state == SCE_CSS_ID)) - sc.SetState(SCE_CSS_TAG); - - if (sc.Match('/', '*')) { - lastStateC = sc.state; - sc.SetState(SCE_CSS_COMMENT); - sc.Forward(); - } else if (sc.state == SCE_CSS_VALUE && (sc.ch == '\"' || sc.ch == '\'')) { - sc.SetState((sc.ch == '\"' ? SCE_CSS_DOUBLESTRING : SCE_CSS_SINGLESTRING)); - } else if (IsCssOperator(static_cast(sc.ch)) - && (sc.state != SCE_CSS_ATTRIBUTE || sc.ch == ']') - && (sc.state != SCE_CSS_VALUE || sc.ch == ';' || sc.ch == '}' || sc.ch == '!') - && (sc.state != SCE_CSS_DIRECTIVE || sc.ch == ';' || sc.ch == '{') - ) { - if (sc.state != SCE_CSS_OPERATOR) - lastState = sc.state; - sc.SetState(SCE_CSS_OPERATOR); - op = sc.ch; - } - } - - sc.Complete(); -} - -static void FoldCSSDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { - bool foldComment = styler.GetPropertyInt("fold.comment") != 0; - bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; - int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); - int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; - int levelCurrent = levelPrev; - char chNext = styler[startPos]; - bool inComment = (styler.StyleAt(startPos-1) == SCE_CSS_COMMENT); - for (unsigned int i = startPos; i < endPos; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - int style = styler.StyleAt(i); - bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - if (foldComment) { - if (!inComment && (style == SCE_CSS_COMMENT)) - levelCurrent++; - else if (inComment && (style != SCE_CSS_COMMENT)) - levelCurrent--; - inComment = (style == SCE_CSS_COMMENT); - } - if (style == SCE_CSS_OPERATOR) { - if (ch == '{') { - levelCurrent++; - } else if (ch == '}') { - levelCurrent--; - } - } - if (atEOL) { - int lev = levelPrev; - if (visibleChars == 0 && foldCompact) - lev |= SC_FOLDLEVELWHITEFLAG; - if ((levelCurrent > levelPrev) && (visibleChars > 0)) - lev |= SC_FOLDLEVELHEADERFLAG; - if (lev != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, lev); - } - lineCurrent++; - levelPrev = levelCurrent; - visibleChars = 0; - } - if (!isspacechar(ch)) - visibleChars++; - } - // Fill in the real level of the next line, keeping the current flags as they will be filled in later - int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; - styler.SetLevel(lineCurrent, levelPrev | flagsNext); -} - -static const char * const cssWordListDesc[] = { - "CSS1 Keywords", - "Pseudo classes", - "CSS2 Keywords", - 0 -}; - -LexerModule lmCss(SCLEX_CSS, ColouriseCssDoc, "css", FoldCSSDoc, cssWordListDesc); +// Scintilla source code edit control +/** @file LexCSS.cxx + ** Lexer for Cascading Style Sheets + ** Written by Jakub Vrána + ** Improved by Philippe Lhoste (CSS2) + **/ +// Copyright 1998-2002 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + + +static inline bool IsAWordChar(const unsigned int ch) { + /* FIXME: + * The CSS spec allows "ISO 10646 characters U+00A1 and higher" to be treated as word chars. + * Unfortunately, we are only getting string bytes here, and not full unicode characters. We cannot guarantee + * that our byte is between U+0080 - U+00A0 (to return false), so we have to allow all characters U+0080 and higher + */ + return ch >= 0x80 || isalnum(ch) || ch == '-' || ch == '_'; +} + +inline bool IsCssOperator(const int ch) { + if (!((ch < 0x80) && isalnum(ch)) && + (ch == '{' || ch == '}' || ch == ':' || ch == ',' || ch == ';' || + ch == '.' || ch == '#' || ch == '!' || ch == '@' || + /* CSS2 */ + ch == '*' || ch == '>' || ch == '+' || ch == '=' || ch == '~' || ch == '|' || + ch == '[' || ch == ']' || ch == '(' || ch == ')')) { + return true; + } + return false; +} + +static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { + WordList &css1Props = *keywordlists[0]; + WordList &pseudoClasses = *keywordlists[1]; + WordList &css2Props = *keywordlists[2]; + WordList &css3Props = *keywordlists[3]; + WordList &pseudoElements = *keywordlists[4]; + WordList &exProps = *keywordlists[5]; + WordList &exPseudoClasses = *keywordlists[6]; + WordList &exPseudoElements = *keywordlists[7]; + + StyleContext sc(startPos, length, initStyle, styler); + + int lastState = -1; // before operator + int lastStateC = -1; // before comment + int op = ' '; // last operator + int opPrev = ' '; // last operator + + for (; sc.More(); sc.Forward()) { + if (sc.state == SCE_CSS_COMMENT && sc.Match('*', '/')) { + if (lastStateC == -1) { + // backtrack to get last state: + // comments are like whitespace, so we must return to the previous state + unsigned int i = startPos; + for (; i > 0; i--) { + if ((lastStateC = styler.StyleAt(i-1)) != SCE_CSS_COMMENT) { + if (lastStateC == SCE_CSS_OPERATOR) { + op = styler.SafeGetCharAt(i-1); + opPrev = styler.SafeGetCharAt(i-2); + while (--i) { + lastState = styler.StyleAt(i-1); + if (lastState != SCE_CSS_OPERATOR && lastState != SCE_CSS_COMMENT) + break; + } + if (i == 0) + lastState = SCE_CSS_DEFAULT; + } + break; + } + } + if (i == 0) + lastStateC = SCE_CSS_DEFAULT; + } + sc.Forward(); + sc.ForwardSetState(lastStateC); + } + + if (sc.state == SCE_CSS_COMMENT) + continue; + + if (sc.state == SCE_CSS_DOUBLESTRING || sc.state == SCE_CSS_SINGLESTRING) { + if (sc.ch != (sc.state == SCE_CSS_DOUBLESTRING ? '\"' : '\'')) + continue; + unsigned int i = sc.currentPos; + while (i && styler[i-1] == '\\') + i--; + if ((sc.currentPos - i) % 2 == 1) + continue; + sc.ForwardSetState(SCE_CSS_VALUE); + } + + if (sc.state == SCE_CSS_OPERATOR) { + if (op == ' ') { + unsigned int i = startPos; + op = styler.SafeGetCharAt(i-1); + opPrev = styler.SafeGetCharAt(i-2); + while (--i) { + lastState = styler.StyleAt(i-1); + if (lastState != SCE_CSS_OPERATOR && lastState != SCE_CSS_COMMENT) + break; + } + } + switch (op) { + case '@': + if (lastState == SCE_CSS_DEFAULT) + sc.SetState(SCE_CSS_DIRECTIVE); + break; + case '>': + case '+': + if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || + lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS) + sc.SetState(SCE_CSS_DEFAULT); + break; + case '[': + if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || + lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS) + sc.SetState(SCE_CSS_ATTRIBUTE); + break; + case ']': + if (lastState == SCE_CSS_ATTRIBUTE) + sc.SetState(SCE_CSS_TAG); + break; + case '{': + if (lastState == SCE_CSS_DIRECTIVE) + sc.SetState(SCE_CSS_DEFAULT); + else if (lastState == SCE_CSS_TAG) + sc.SetState(SCE_CSS_IDENTIFIER); + break; + case '}': + if (lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_VALUE || lastState == SCE_CSS_IMPORTANT || + lastState == SCE_CSS_IDENTIFIER || lastState == SCE_CSS_IDENTIFIER2 || lastState == SCE_CSS_IDENTIFIER3) + sc.SetState(SCE_CSS_DEFAULT); + break; + case '(': + if (lastState == SCE_CSS_PSEUDOCLASS) + sc.SetState(SCE_CSS_TAG); + else if (lastState == SCE_CSS_EXTENDED_PSEUDOCLASS) + sc.SetState(SCE_CSS_EXTENDED_PSEUDOCLASS); + break; + case ')': + if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || + lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS || + lastState == SCE_CSS_PSEUDOELEMENT || lastState == SCE_CSS_EXTENDED_PSEUDOELEMENT) + sc.SetState(SCE_CSS_TAG); + break; + case ':': + if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || + lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS || + lastState == SCE_CSS_PSEUDOELEMENT || lastState == SCE_CSS_EXTENDED_PSEUDOELEMENT) + sc.SetState(SCE_CSS_PSEUDOCLASS); + else if (lastState == SCE_CSS_IDENTIFIER || lastState == SCE_CSS_IDENTIFIER2 || + lastState == SCE_CSS_IDENTIFIER3 || lastState == SCE_CSS_EXTENDED_IDENTIFIER || + lastState == SCE_CSS_UNKNOWN_IDENTIFIER) + sc.SetState(SCE_CSS_VALUE); + break; + case '.': + if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || + lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS) + sc.SetState(SCE_CSS_CLASS); + break; + case '#': + if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || + lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS) + sc.SetState(SCE_CSS_ID); + break; + case ',': + case '|': + case '~': + if (lastState == SCE_CSS_TAG) + sc.SetState(SCE_CSS_DEFAULT); + break; + case ';': + if (lastState == SCE_CSS_DIRECTIVE) + sc.SetState(SCE_CSS_DEFAULT); + else if (lastState == SCE_CSS_VALUE || lastState == SCE_CSS_IMPORTANT) + sc.SetState(SCE_CSS_IDENTIFIER); + break; + case '!': + if (lastState == SCE_CSS_VALUE) + sc.SetState(SCE_CSS_IMPORTANT); + break; + } + } + + if (IsAWordChar(sc.ch)) { + if (sc.state == SCE_CSS_DEFAULT) + sc.SetState(SCE_CSS_TAG); + continue; + } + + if (sc.ch == '*' && sc.state == SCE_CSS_DEFAULT) { + sc.SetState(SCE_CSS_TAG); + continue; + } + + if (IsAWordChar(sc.chPrev) && ( + sc.state == SCE_CSS_IDENTIFIER || sc.state == SCE_CSS_IDENTIFIER2 || + sc.state == SCE_CSS_IDENTIFIER3 || sc.state == SCE_CSS_EXTENDED_IDENTIFIER || + sc.state == SCE_CSS_UNKNOWN_IDENTIFIER || + sc.state == SCE_CSS_PSEUDOCLASS || sc.state == SCE_CSS_PSEUDOELEMENT || + sc.state == SCE_CSS_EXTENDED_PSEUDOCLASS || sc.state == SCE_CSS_EXTENDED_PSEUDOELEMENT || + sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS || + sc.state == SCE_CSS_IMPORTANT + )) { + char s[100]; + sc.GetCurrentLowered(s, sizeof(s)); + char *s2 = s; + while (*s2 && !IsAWordChar(*s2)) + s2++; + switch (sc.state) { + case SCE_CSS_IDENTIFIER: + case SCE_CSS_IDENTIFIER2: + case SCE_CSS_IDENTIFIER3: + case SCE_CSS_EXTENDED_IDENTIFIER: + case SCE_CSS_UNKNOWN_IDENTIFIER: + if (css1Props.InList(s2)) + sc.ChangeState(SCE_CSS_IDENTIFIER); + else if (css2Props.InList(s2)) + sc.ChangeState(SCE_CSS_IDENTIFIER2); + else if (css3Props.InList(s2)) + sc.ChangeState(SCE_CSS_IDENTIFIER3); + else if (exProps.InList(s2)) + sc.ChangeState(SCE_CSS_EXTENDED_IDENTIFIER); + else + sc.ChangeState(SCE_CSS_UNKNOWN_IDENTIFIER); + break; + case SCE_CSS_PSEUDOCLASS: + case SCE_CSS_PSEUDOELEMENT: + case SCE_CSS_EXTENDED_PSEUDOCLASS: + case SCE_CSS_EXTENDED_PSEUDOELEMENT: + case SCE_CSS_UNKNOWN_PSEUDOCLASS: + if (op == ':' && opPrev != ':' && pseudoClasses.InList(s2)) + sc.ChangeState(SCE_CSS_PSEUDOCLASS); + else if (opPrev == ':' && pseudoElements.InList(s2)) + sc.ChangeState(SCE_CSS_PSEUDOELEMENT); + else if ((op == ':' || (op == '(' && lastState == SCE_CSS_EXTENDED_PSEUDOCLASS)) && opPrev != ':' && exPseudoClasses.InList(s2)) + sc.ChangeState(SCE_CSS_EXTENDED_PSEUDOCLASS); + else if (opPrev == ':' && exPseudoElements.InList(s2)) + sc.ChangeState(SCE_CSS_EXTENDED_PSEUDOELEMENT); + else + sc.ChangeState(SCE_CSS_UNKNOWN_PSEUDOCLASS); + break; + case SCE_CSS_IMPORTANT: + if (strcmp(s2, "important") != 0) + sc.ChangeState(SCE_CSS_VALUE); + break; + } + } + + if (sc.ch != '.' && sc.ch != ':' && sc.ch != '#' && ( + sc.state == SCE_CSS_CLASS || sc.state == SCE_CSS_ID || + (sc.ch != '(' && sc.ch != ')' && ( /* This line of the condition makes it possible to extend pseudo-classes with parentheses */ + sc.state == SCE_CSS_PSEUDOCLASS || sc.state == SCE_CSS_PSEUDOELEMENT || + sc.state == SCE_CSS_EXTENDED_PSEUDOCLASS || sc.state == SCE_CSS_EXTENDED_PSEUDOELEMENT || + sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS + )) + )) + sc.SetState(SCE_CSS_TAG); + + if (sc.Match('/', '*')) { + lastStateC = sc.state; + sc.SetState(SCE_CSS_COMMENT); + sc.Forward(); + } else if (sc.state == SCE_CSS_VALUE && (sc.ch == '\"' || sc.ch == '\'')) { + sc.SetState((sc.ch == '\"' ? SCE_CSS_DOUBLESTRING : SCE_CSS_SINGLESTRING)); + } else if (IsCssOperator(sc.ch) + && (sc.state != SCE_CSS_ATTRIBUTE || sc.ch == ']') + && (sc.state != SCE_CSS_VALUE || sc.ch == ';' || sc.ch == '}' || sc.ch == '!') + && (sc.state != SCE_CSS_DIRECTIVE || sc.ch == ';' || sc.ch == '{') + ) { + if (sc.state != SCE_CSS_OPERATOR) + lastState = sc.state; + sc.SetState(SCE_CSS_OPERATOR); + op = sc.ch; + opPrev = sc.chPrev; + } + } + + sc.Complete(); +} + +static void FoldCSSDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { + bool foldComment = styler.GetPropertyInt("fold.comment") != 0; + bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + unsigned int endPos = startPos + length; + int visibleChars = 0; + int lineCurrent = styler.GetLine(startPos); + int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; + int levelCurrent = levelPrev; + char chNext = styler[startPos]; + bool inComment = (styler.StyleAt(startPos-1) == SCE_CSS_COMMENT); + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + int style = styler.StyleAt(i); + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + if (foldComment) { + if (!inComment && (style == SCE_CSS_COMMENT)) + levelCurrent++; + else if (inComment && (style != SCE_CSS_COMMENT)) + levelCurrent--; + inComment = (style == SCE_CSS_COMMENT); + } + if (style == SCE_CSS_OPERATOR) { + if (ch == '{') { + levelCurrent++; + } else if (ch == '}') { + levelCurrent--; + } + } + if (atEOL) { + int lev = levelPrev; + if (visibleChars == 0 && foldCompact) + lev |= SC_FOLDLEVELWHITEFLAG; + if ((levelCurrent > levelPrev) && (visibleChars > 0)) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + lineCurrent++; + levelPrev = levelCurrent; + visibleChars = 0; + } + if (!isspacechar(ch)) + visibleChars++; + } + // Fill in the real level of the next line, keeping the current flags as they will be filled in later + int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; + styler.SetLevel(lineCurrent, levelPrev | flagsNext); +} + +static const char * const cssWordListDesc[] = { + "CSS1 Properties", + "Pseudo-classes", + "CSS2 Properties", + "CSS3 Properties", + "Pseudo-elements", + "Browser-Specific CSS Properties", + "Browser-Specific Pseudo-classes", + "Browser-Specific Pseudo-elements", + 0 +}; + +LexerModule lmCss(SCLEX_CSS, ColouriseCssDoc, "css", FoldCSSDoc, cssWordListDesc); diff --git a/sdk/wxscintilla/src/scintilla/src/LexCaml.cxx b/sdk/wxscintilla/src/scintilla/src/LexCaml.cxx index 845ac657e1..0d11622593 100644 --- a/sdk/wxscintilla/src/scintilla/src/LexCaml.cxx +++ b/sdk/wxscintilla/src/scintilla/src/LexCaml.cxx @@ -1,403 +1,451 @@ -// Scintilla source code edit control -/** @file LexCaml.cxx - ** Lexer for Objective Caml. - **/ -// Copyright 2005 by Robert Roessler -// The License.txt file describes the conditions under which this software may be distributed. -/* Release History - 20050204 Initial release. - 20050205 Quick compiler standards/"cleanliness" adjustment. - 20050206 Added cast for IsLeadByte(). - 20050209 Changes to "external" build support. - 20050306 Fix for 1st-char-in-doc "corner" case. - 20050502 Fix for [harmless] one-past-the-end coloring. - 20050515 Refined numeric token recognition logic. - 20051125 Added 2nd "optional" keywords class. - 20051129 Support "magic" (read-only) comments for RCaml. - 20051204 Swtich to using StyleContext infrastructure. -*/ - -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" - -// Since the Microsoft __iscsym[f] funcs are not ANSI... -inline int iscaml(int c) {return isalnum(c) || c == '_';} -inline int iscamlf(int c) {return isalpha(c) || c == '_';} -inline int iscamld(int c) {return isdigit(c) || c == '_';} - -static const int baseT[24] = { - 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* A - L */ - 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0,16 /* M - X */ -}; - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -#ifdef BUILD_AS_EXTERNAL_LEXER -/* - (actually seems to work!) -*/ -#include "WindowAccessor.h" -#include "ExternalLexer.h" - -#if PLAT_WIN -#include -#endif - -static void ColouriseCamlDoc( - unsigned int startPos, int length, - int initStyle, - WordList *keywordlists[], - Accessor &styler); - -static void FoldCamlDoc( - unsigned int startPos, int length, - int initStyle, - WordList *keywordlists[], - Accessor &styler); - -static void InternalLexOrFold(int lexOrFold, unsigned int startPos, int length, - int initStyle, char *words[], WindowID window, char *props); - -static const char* LexerName = "caml"; - -#ifdef TRACE -void Platform::DebugPrintf(const char *format, ...) { - char buffer[2000]; - va_list pArguments; - va_start(pArguments, format); - vsprintf(buffer,format,pArguments); - va_end(pArguments); - Platform::DebugDisplay(buffer); -} -#else -void Platform::DebugPrintf(const char *, ...) { -} -#endif - -bool Platform::IsDBCSLeadByte(int codePage, char ch) { - return ::IsDBCSLeadByteEx(codePage, ch) != 0; -} - -long Platform::SendScintilla(WindowID w, unsigned int msg, unsigned long wParam, long lParam) { - return ::SendMessage(reinterpret_cast(w), msg, wParam, lParam); -} - -long Platform::SendScintillaPointer(WindowID w, unsigned int msg, unsigned long wParam, void *lParam) { - return ::SendMessage(reinterpret_cast(w), msg, wParam, - reinterpret_cast(lParam)); -} - -void EXT_LEXER_DECL Fold(unsigned int lexer, unsigned int startPos, int length, - int initStyle, char *words[], WindowID window, char *props) -{ - // below useless evaluation(s) to supress "not used" warnings - lexer; - // build expected data structures and do the Fold - InternalLexOrFold(1, startPos, length, initStyle, words, window, props); - -} - -int EXT_LEXER_DECL GetLexerCount() -{ - return 1; // just us [Objective] Caml lexers here! -} - -void EXT_LEXER_DECL GetLexerName(unsigned int Index, char *name, int buflength) -{ - // below useless evaluation(s) to supress "not used" warnings - Index; - // return as much of our lexer name as will fit (what's up with Index?) - if (buflength > 0) { - buflength--; - int n = strlen(LexerName); - if (n > buflength) - n = buflength; - memcpy(name, LexerName, n), name[n] = '\0'; - } -} - -void EXT_LEXER_DECL Lex(unsigned int lexer, unsigned int startPos, int length, - int initStyle, char *words[], WindowID window, char *props) -{ - // below useless evaluation(s) to supress "not used" warnings - lexer; - // build expected data structures and do the Lex - InternalLexOrFold(0, startPos, length, initStyle, words, window, props); -} - -static void InternalLexOrFold(int foldOrLex, unsigned int startPos, int length, - int initStyle, char *words[], WindowID window, char *props) -{ - // create and initialize a WindowAccessor (including contained PropSet) - PropSet ps; - ps.SetMultiple(props); - WindowAccessor wa(window, ps); - // create and initialize WordList(s) - int nWL = 0; - for (; words[nWL]; nWL++) ; // count # of WordList PTRs needed - WordList** wl = new WordList* [nWL + 1];// alloc WordList PTRs - int i = 0; - for (; i < nWL; i++) { - wl[i] = new WordList(); // (works or THROWS bad_alloc EXCEPTION) - wl[i]->Set(words[i]); - } - wl[i] = 0; - // call our "internal" folder/lexer (... then do Flush!) - if (foldOrLex) - FoldCamlDoc(startPos, length, initStyle, wl, wa); - else - ColouriseCamlDoc(startPos, length, initStyle, wl, wa); - wa.Flush(); - // clean up before leaving - for (i = nWL - 1; i >= 0; i--) - delete wl[i]; - delete [] wl; -} - -static -#endif /* BUILD_AS_EXTERNAL_LEXER */ - -void ColouriseCamlDoc( - unsigned int startPos, int length, - int initStyle, - WordList *keywordlists[], - Accessor &styler) -{ - // initialize styler - StyleContext sc(startPos, length, initStyle, styler); - // set up [initial] state info (terminating states that shouldn't "bleed") - int nesting = 0; - if (sc.state < SCE_CAML_STRING) - sc.state = SCE_CAML_DEFAULT; - if (sc.state >= SCE_CAML_COMMENT) - nesting = (sc.state & 0x0f) - SCE_CAML_COMMENT; - - int chBase = 0, chToken = 0, chLit = 0; - WordList& keywords = *keywordlists[0]; - WordList& keywords2 = *keywordlists[1]; - WordList& keywords3 = *keywordlists[2]; - const int useMagic = styler.GetPropertyInt("lexer.caml.magic", 0); - - // foreach char in range... - while (sc.More()) { - // set up [per-char] state info - int state2 = -1; // (ASSUME no state change) - int chColor = sc.currentPos - 1;// (ASSUME standard coloring range) - bool advance = true; // (ASSUME scanner "eats" 1 char) - - // step state machine - switch (sc.state & 0x0f) { - case SCE_CAML_DEFAULT: - chToken = sc.currentPos; // save [possible] token start (JIC) - // it's wide open; what do we have? - if (iscamlf(sc.ch)) - state2 = SCE_CAML_IDENTIFIER; - else if (sc.Match('`') && iscamlf(sc.chNext)) - state2 = SCE_CAML_TAGNAME; - else if (sc.Match('#') && isdigit(sc.chNext)) - state2 = SCE_CAML_LINENUM; - else if (isdigit(sc.ch)) { - state2 = SCE_CAML_NUMBER, chBase = 10; - if (sc.Match('0') && strchr("bBoOxX", sc.chNext)) - chBase = baseT[tolower(sc.chNext) - 'a'], sc.Forward(); - } else if (sc.Match('\'')) /* (char literal?) */ - state2 = SCE_CAML_CHAR, chLit = 0; - else if (sc.Match('\"')) - state2 = SCE_CAML_STRING; - else if (sc.Match('(', '*')) - state2 = SCE_CAML_COMMENT, - sc.ch = ' ', // (make SURE "(*)" isn't seen as a closed comment) - sc.Forward(); - else if (strchr("!?~" /* Caml "prefix-symbol" */ - "=<>@^|&+-*/$%" /* Caml "infix-symbol" */ - "()[]{};,:.#", sc.ch)) /* Caml "bracket" or ;,:.# */ - state2 = SCE_CAML_OPERATOR; - break; - - case SCE_CAML_IDENTIFIER: - // [try to] interpret as [additional] identifier char - if (!(iscaml(sc.ch) || sc.Match('\''))) { - const int n = sc.currentPos - chToken; - if (n < 24) { - // length is believable as keyword, [re-]construct token - char t[24]; - for (int i = -n; i < 0; i++) - t[n + i] = static_cast(sc.GetRelative(i)); - t[n] = '\0'; - // special-case "_" token as KEYWORD - if ((n == 1 && sc.chPrev == '_') || keywords.InList(t)) - sc.ChangeState(SCE_CAML_KEYWORD); - else if (keywords2.InList(t)) - sc.ChangeState(SCE_CAML_KEYWORD2); - else if (keywords3.InList(t)) - sc.ChangeState(SCE_CAML_KEYWORD3); - } - state2 = SCE_CAML_DEFAULT, advance = false; - } - break; - - case SCE_CAML_TAGNAME: - // [try to] interpret as [additional] tagname char - if (!(iscaml(sc.ch) || sc.Match('\''))) - state2 = SCE_CAML_DEFAULT, advance = false; - break; - - /*case SCE_CAML_KEYWORD: - case SCE_CAML_KEYWORD2: - case SCE_CAML_KEYWORD3: - // [try to] interpret as [additional] keyword char - if (!iscaml(ch)) - state2 = SCE_CAML_DEFAULT, advance = false; - break;*/ - - case SCE_CAML_LINENUM: - // [try to] interpret as [additional] linenum directive char - if (!isdigit(sc.ch)) - state2 = SCE_CAML_DEFAULT, advance = false; - break; - - case SCE_CAML_OPERATOR: { - // [try to] interpret as [additional] operator char - const char* o = 0; - if (iscaml(sc.ch) || isspace(sc.ch) /* ident or whitespace */ - || (o = strchr(")]};,\'\"`#", sc.ch),o)/* "termination" chars */ - || !strchr("!$%&*+-./:<=>?@^|~", sc.ch)/* "operator" chars */) { - // check for INCLUSIVE termination - if (o && strchr(")]};,", sc.ch)) { - if ((sc.Match(')') && sc.chPrev == '(') - || (sc.Match(']') && sc.chPrev == '[')) - // special-case "()" and "[]" tokens as KEYWORDS - sc.ChangeState(SCE_CAML_KEYWORD); - chColor++; - } else - advance = false; - state2 = SCE_CAML_DEFAULT; - } - break; - } - - case SCE_CAML_NUMBER: - // [try to] interpret as [additional] numeric literal char - // N.B. - improperly accepts "extra" digits in base 2 or 8 literals - if (iscamld(sc.ch) || IsADigit(sc.ch, chBase)) - break; - // how about an integer suffix? - if ((sc.Match('l') || sc.Match('L') || sc.Match('n')) - && (iscamld(sc.chPrev) || IsADigit(sc.chPrev, chBase))) - break; - // or a floating-point literal? - if (chBase == 10) { - // with a decimal point? - if (sc.Match('.') && iscamld(sc.chPrev)) - break; - // with an exponent? (I) - if ((sc.Match('e') || sc.Match('E')) - && (iscamld(sc.chPrev) || sc.chPrev == '.')) - break; - // with an exponent? (II) - if ((sc.Match('+') || sc.Match('-')) - && (sc.chPrev == 'e' || sc.chPrev == 'E')) - break; - } - // it looks like we have run out of number - state2 = SCE_CAML_DEFAULT, advance = false; - break; - - case SCE_CAML_CHAR: - // [try to] interpret as [additional] char literal char - if (sc.Match('\\')) { - chLit = 1; // (definitely IS a char literal) - if (sc.chPrev == '\\') - sc.ch = ' '; // (so termination test isn't fooled) - // should we be terminating - one way or another? - } else if ((sc.Match('\'') && sc.chPrev != '\\') || sc.atLineEnd) { - state2 = SCE_CAML_DEFAULT; - if (sc.Match('\'')) - chColor++; - else - sc.ChangeState(SCE_CAML_IDENTIFIER); - // ... maybe a char literal, maybe not - } else if (chLit < 1 && sc.currentPos - chToken >= 2) - sc.ChangeState(SCE_CAML_IDENTIFIER), advance = false; - break; - - case SCE_CAML_STRING: - // [try to] interpret as [additional] string literal char - if (sc.Match('\\') && sc.chPrev == '\\') - sc.ch = ' '; // (so '\\' doesn't cause us trouble) - else if (sc.Match('\"') && sc.chPrev != '\\') - state2 = SCE_CAML_DEFAULT, chColor++; - break; - - case SCE_CAML_COMMENT: - case SCE_CAML_COMMENT1: - case SCE_CAML_COMMENT2: - case SCE_CAML_COMMENT3: - // we're IN a comment - does this start a NESTED comment? - if (sc.Match('(', '*')) - state2 = sc.state + 1, chToken = sc.currentPos, - sc.ch = ' ', // (make SURE "(*)" isn't seen as a closed comment) - sc.Forward(), nesting++; - // [try to] interpret as [additional] comment char - else if (sc.Match(')') && sc.chPrev == '*') { - if (nesting) - state2 = (sc.state & 0x0f) - 1, chToken = 0, nesting--; - else - state2 = SCE_CAML_DEFAULT; - chColor++; - // enable "magic" (read-only) comment AS REQUIRED - } else if (useMagic && sc.currentPos - chToken == 4 - && sc.Match('c') && sc.chPrev == 'r' && sc.GetRelative(-2) == '@') - sc.state |= 0x10; // (switch to read-only comment style) - break; - } - - // handle state change and char coloring as required - if (state2 >= 0) - styler.ColourTo(chColor, sc.state), sc.ChangeState(state2); - // move to next char UNLESS re-scanning current char - if (advance) - sc.Forward(); - } - - // do any required terminal char coloring (JIC) - sc.Complete(); -} - -#ifdef BUILD_AS_EXTERNAL_LEXER -static -#endif /* BUILD_AS_EXTERNAL_LEXER */ -void FoldCamlDoc( - unsigned int startPos, int length, - int initStyle, - WordList *keywordlists[], - Accessor &styler) -{ - // below useless evaluation(s) to supress "not used" warnings - startPos || length || initStyle || keywordlists[0] || styler.Length(); -} - -static const char * const camlWordListDesc[] = { - "Keywords", // primary Objective Caml keywords - "Keywords2", // "optional" keywords (typically from Pervasives) - "Keywords3", // "optional" keywords (typically typenames) - 0 -}; - -#ifndef BUILD_AS_EXTERNAL_LEXER -LexerModule lmCaml(SCLEX_CAML, ColouriseCamlDoc, "caml", FoldCamlDoc, camlWordListDesc); -#endif /* BUILD_AS_EXTERNAL_LEXER */ +// Scintilla source code edit control +/** @file LexCaml.cxx + ** Lexer for Objective Caml. + **/ +// Copyright 2005-2009 by Robert Roessler +// The License.txt file describes the conditions under which this software may be distributed. +/* Release History + 20050204 Initial release. + 20050205 Quick compiler standards/"cleanliness" adjustment. + 20050206 Added cast for IsLeadByte(). + 20050209 Changes to "external" build support. + 20050306 Fix for 1st-char-in-doc "corner" case. + 20050502 Fix for [harmless] one-past-the-end coloring. + 20050515 Refined numeric token recognition logic. + 20051125 Added 2nd "optional" keywords class. + 20051129 Support "magic" (read-only) comments for RCaml. + 20051204 Swtich to using StyleContext infrastructure. + 20090629 Add full Standard ML '97 support. +*/ + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "PropSetSimple.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +// Since the Microsoft __iscsym[f] funcs are not ANSI... +inline int iscaml(int c) {return isalnum(c) || c == '_';} +inline int iscamlf(int c) {return isalpha(c) || c == '_';} + +static const int baseT[24] = { + 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* A - L */ + 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0,16 /* M - X */ +}; + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +#ifdef BUILD_AS_EXTERNAL_LEXER +/* + (actually seems to work!) +*/ +#include "WindowAccessor.h" +#include "ExternalLexer.h" + +#if PLAT_WIN +#include +#endif + +static void ColouriseCamlDoc( + unsigned int startPos, int length, + int initStyle, + WordList *keywordlists[], + Accessor &styler); + +static void FoldCamlDoc( + unsigned int startPos, int length, + int initStyle, + WordList *keywordlists[], + Accessor &styler); + +static void InternalLexOrFold(int lexOrFold, unsigned int startPos, int length, + int initStyle, char *words[], WindowID window, char *props); + +static const char* LexerName = "caml"; + +#ifdef TRACE +void Platform::DebugPrintf(const char *format, ...) { + char buffer[2000]; + va_list pArguments; + va_start(pArguments, format); + vsprintf(buffer,format,pArguments); + va_end(pArguments); + Platform::DebugDisplay(buffer); +} +#else +void Platform::DebugPrintf(const char *, ...) { +} +#endif + +bool Platform::IsDBCSLeadByte(int codePage, char ch) { + return ::IsDBCSLeadByteEx(codePage, ch) != 0; +} + +long Platform::SendScintilla(WindowID w, unsigned int msg, unsigned long wParam, long lParam) { + return ::SendMessage(reinterpret_cast(w), msg, wParam, lParam); +} + +long Platform::SendScintillaPointer(WindowID w, unsigned int msg, unsigned long wParam, void *lParam) { + return ::SendMessage(reinterpret_cast(w), msg, wParam, + reinterpret_cast(lParam)); +} + +void EXT_LEXER_DECL Fold(unsigned int lexer, unsigned int startPos, int length, + int initStyle, char *words[], WindowID window, char *props) +{ + // below useless evaluation(s) to supress "not used" warnings + lexer; + // build expected data structures and do the Fold + InternalLexOrFold(1, startPos, length, initStyle, words, window, props); + +} + +int EXT_LEXER_DECL GetLexerCount() +{ + return 1; // just us [Objective] Caml lexers here! +} + +void EXT_LEXER_DECL GetLexerName(unsigned int Index, char *name, int buflength) +{ + // below useless evaluation(s) to supress "not used" warnings + Index; + // return as much of our lexer name as will fit (what's up with Index?) + if (buflength > 0) { + buflength--; + int n = strlen(LexerName); + if (n > buflength) + n = buflength; + memcpy(name, LexerName, n), name[n] = '\0'; + } +} + +void EXT_LEXER_DECL Lex(unsigned int lexer, unsigned int startPos, int length, + int initStyle, char *words[], WindowID window, char *props) +{ + // below useless evaluation(s) to supress "not used" warnings + lexer; + // build expected data structures and do the Lex + InternalLexOrFold(0, startPos, length, initStyle, words, window, props); +} + +static void InternalLexOrFold(int foldOrLex, unsigned int startPos, int length, + int initStyle, char *words[], WindowID window, char *props) +{ + // create and initialize a WindowAccessor (including contained PropSet) + PropSetSimple ps; + ps.SetMultiple(props); + WindowAccessor wa(window, ps); + // create and initialize WordList(s) + int nWL = 0; + for (; words[nWL]; nWL++) ; // count # of WordList PTRs needed + WordList** wl = new WordList* [nWL + 1];// alloc WordList PTRs + int i = 0; + for (; i < nWL; i++) { + wl[i] = new WordList(); // (works or THROWS bad_alloc EXCEPTION) + wl[i]->Set(words[i]); + } + wl[i] = 0; + // call our "internal" folder/lexer (... then do Flush!) + if (foldOrLex) + FoldCamlDoc(startPos, length, initStyle, wl, wa); + else + ColouriseCamlDoc(startPos, length, initStyle, wl, wa); + wa.Flush(); + // clean up before leaving + for (i = nWL - 1; i >= 0; i--) + delete wl[i]; + delete [] wl; +} + +static +#endif /* BUILD_AS_EXTERNAL_LEXER */ + +void ColouriseCamlDoc( + unsigned int startPos, int length, + int initStyle, + WordList *keywordlists[], + Accessor &styler) +{ + // initialize styler + StyleContext sc(startPos, length, initStyle, styler); + + int chBase = 0, chToken = 0, chLit = 0; + WordList& keywords = *keywordlists[0]; + WordList& keywords2 = *keywordlists[1]; + WordList& keywords3 = *keywordlists[2]; + const bool isSML = keywords.InList("andalso"); + const int useMagic = styler.GetPropertyInt("lexer.caml.magic", 0); + + // set up [initial] state info (terminating states that shouldn't "bleed") + const int state_ = sc.state & 0x0f; + if (state_ <= SCE_CAML_CHAR + || (isSML && state_ == SCE_CAML_STRING)) + sc.state = SCE_CAML_DEFAULT; + int nesting = (state_ >= SCE_CAML_COMMENT)? (state_ - SCE_CAML_COMMENT): 0; + + // foreach char in range... + while (sc.More()) { + // set up [per-char] state info + int state2 = -1; // (ASSUME no state change) + int chColor = sc.currentPos - 1;// (ASSUME standard coloring range) + bool advance = true; // (ASSUME scanner "eats" 1 char) + + // step state machine + switch (sc.state & 0x0f) { + case SCE_CAML_DEFAULT: + chToken = sc.currentPos; // save [possible] token start (JIC) + // it's wide open; what do we have? + if (iscamlf(sc.ch)) + state2 = SCE_CAML_IDENTIFIER; + else if (!isSML && sc.Match('`') && iscamlf(sc.chNext)) + state2 = SCE_CAML_TAGNAME; + else if (!isSML && sc.Match('#') && isdigit(sc.chNext)) + state2 = SCE_CAML_LINENUM; + else if (isdigit(sc.ch)) { + // it's a number, assume base 10 + state2 = SCE_CAML_NUMBER, chBase = 10; + if (sc.Match('0')) { + // there MAY be a base specified... + const char* baseC = "bBoOxX"; + if (isSML) { + if (sc.chNext == 'w') + sc.Forward(); // (consume SML "word" indicator) + baseC = "x"; + } + // ... change to specified base AS REQUIRED + if (strchr(baseC, sc.chNext)) + chBase = baseT[tolower(sc.chNext) - 'a'], sc.Forward(); + } + } else if (!isSML && sc.Match('\'')) // (Caml char literal?) + state2 = SCE_CAML_CHAR, chLit = 0; + else if (isSML && sc.Match('#', '"')) // (SML char literal?) + state2 = SCE_CAML_CHAR, sc.Forward(); + else if (sc.Match('"')) + state2 = SCE_CAML_STRING; + else if (sc.Match('(', '*')) + state2 = SCE_CAML_COMMENT, sc.Forward(), sc.ch = ' '; // (*)... + else if (strchr("!?~" /* Caml "prefix-symbol" */ + "=<>@^|&+-*/$%" /* Caml "infix-symbol" */ + "()[]{};,:.#", sc.ch) // Caml "bracket" or ;,:.# + // SML "extra" ident chars + || (isSML && (sc.Match('\\') || sc.Match('`')))) + state2 = SCE_CAML_OPERATOR; + break; + + case SCE_CAML_IDENTIFIER: + // [try to] interpret as [additional] identifier char + if (!(iscaml(sc.ch) || sc.Match('\''))) { + const int n = sc.currentPos - chToken; + if (n < 24) { + // length is believable as keyword, [re-]construct token + char t[24]; + for (int i = -n; i < 0; i++) + t[n + i] = static_cast(sc.GetRelative(i)); + t[n] = '\0'; + // special-case "_" token as KEYWORD + if ((n == 1 && sc.chPrev == '_') || keywords.InList(t)) + sc.ChangeState(SCE_CAML_KEYWORD); + else if (keywords2.InList(t)) + sc.ChangeState(SCE_CAML_KEYWORD2); + else if (keywords3.InList(t)) + sc.ChangeState(SCE_CAML_KEYWORD3); + } + state2 = SCE_CAML_DEFAULT, advance = false; + } + break; + + case SCE_CAML_TAGNAME: + // [try to] interpret as [additional] tagname char + if (!(iscaml(sc.ch) || sc.Match('\''))) + state2 = SCE_CAML_DEFAULT, advance = false; + break; + + /*case SCE_CAML_KEYWORD: + case SCE_CAML_KEYWORD2: + case SCE_CAML_KEYWORD3: + // [try to] interpret as [additional] keyword char + if (!iscaml(ch)) + state2 = SCE_CAML_DEFAULT, advance = false; + break;*/ + + case SCE_CAML_LINENUM: + // [try to] interpret as [additional] linenum directive char + if (!isdigit(sc.ch)) + state2 = SCE_CAML_DEFAULT, advance = false; + break; + + case SCE_CAML_OPERATOR: { + // [try to] interpret as [additional] operator char + const char* o = 0; + if (iscaml(sc.ch) || isspace(sc.ch) // ident or whitespace + || (o = strchr(")]};,\'\"#", sc.ch),o) // "termination" chars + || (!isSML && sc.Match('`')) // Caml extra term char + || (!strchr("!$%&*+-./:<=>?@^|~", sc.ch)// "operator" chars + // SML extra ident chars + && !(isSML && (sc.Match('\\') || sc.Match('`'))))) { + // check for INCLUSIVE termination + if (o && strchr(")]};,", sc.ch)) { + if ((sc.Match(')') && sc.chPrev == '(') + || (sc.Match(']') && sc.chPrev == '[')) + // special-case "()" and "[]" tokens as KEYWORDS + sc.ChangeState(SCE_CAML_KEYWORD); + chColor++; + } else + advance = false; + state2 = SCE_CAML_DEFAULT; + } + break; + } + + case SCE_CAML_NUMBER: + // [try to] interpret as [additional] numeric literal char + if ((!isSML && sc.Match('_')) || IsADigit(sc.ch, chBase)) + break; + // how about an integer suffix? + if (!isSML && (sc.Match('l') || sc.Match('L') || sc.Match('n')) + && (sc.chPrev == '_' || IsADigit(sc.chPrev, chBase))) + break; + // or a floating-point literal? + if (chBase == 10) { + // with a decimal point? + if (sc.Match('.') + && ((!isSML && sc.chPrev == '_') + || IsADigit(sc.chPrev, chBase))) + break; + // with an exponent? (I) + if ((sc.Match('e') || sc.Match('E')) + && ((!isSML && (sc.chPrev == '.' || sc.chPrev == '_')) + || IsADigit(sc.chPrev, chBase))) + break; + // with an exponent? (II) + if (((!isSML && (sc.Match('+') || sc.Match('-'))) + || (isSML && sc.Match('~'))) + && (sc.chPrev == 'e' || sc.chPrev == 'E')) + break; + } + // it looks like we have run out of number + state2 = SCE_CAML_DEFAULT, advance = false; + break; + + case SCE_CAML_CHAR: + if (!isSML) { + // [try to] interpret as [additional] char literal char + if (sc.Match('\\')) { + chLit = 1; // (definitely IS a char literal) + if (sc.chPrev == '\\') + sc.ch = ' '; // (...\\') + // should we be terminating - one way or another? + } else if ((sc.Match('\'') && sc.chPrev != '\\') + || sc.atLineEnd) { + state2 = SCE_CAML_DEFAULT; + if (sc.Match('\'')) + chColor++; + else + sc.ChangeState(SCE_CAML_IDENTIFIER); + // ... maybe a char literal, maybe not + } else if (chLit < 1 && sc.currentPos - chToken >= 2) + sc.ChangeState(SCE_CAML_IDENTIFIER), advance = false; + break; + }/* else + // fall through for SML char literal (handle like string) */ + + case SCE_CAML_STRING: + // [try to] interpret as [additional] [SML char/] string literal char + if (isSML && sc.Match('\\') && sc.chPrev != '\\' && isspace(sc.chNext)) + state2 = SCE_CAML_WHITE; + else if (sc.Match('\\') && sc.chPrev == '\\') + sc.ch = ' '; // (...\\") + // should we be terminating - one way or another? + else if ((sc.Match('"') && sc.chPrev != '\\') + || (isSML && sc.atLineEnd)) { + state2 = SCE_CAML_DEFAULT; + if (sc.Match('"')) + chColor++; + } + break; + + case SCE_CAML_WHITE: + // [try to] interpret as [additional] SML embedded whitespace char + if (sc.Match('\\')) { + // style this puppy NOW... + state2 = SCE_CAML_STRING, sc.ch = ' ' /* (...\") */, chColor++, + styler.ColourTo(chColor, SCE_CAML_WHITE), styler.Flush(); + // ... then backtrack to determine original SML literal type + int p = chColor - 2; + for (; p >= 0 && styler.StyleAt(p) == SCE_CAML_WHITE; p--) ; + if (p >= 0) + state2 = static_cast(styler.StyleAt(p)); + // take care of state change NOW + sc.ChangeState(state2), state2 = -1; + } + break; + + case SCE_CAML_COMMENT: + case SCE_CAML_COMMENT1: + case SCE_CAML_COMMENT2: + case SCE_CAML_COMMENT3: + // we're IN a comment - does this start a NESTED comment? + if (sc.Match('(', '*')) + state2 = sc.state + 1, chToken = sc.currentPos, + sc.Forward(), sc.ch = ' ' /* (*)... */, nesting++; + // [try to] interpret as [additional] comment char + else if (sc.Match(')') && sc.chPrev == '*') { + if (nesting) + state2 = (sc.state & 0x0f) - 1, chToken = 0, nesting--; + else + state2 = SCE_CAML_DEFAULT; + chColor++; + // enable "magic" (read-only) comment AS REQUIRED + } else if (useMagic && sc.currentPos - chToken == 4 + && sc.Match('c') && sc.chPrev == 'r' && sc.GetRelative(-2) == '@') + sc.state |= 0x10; // (switch to read-only comment style) + break; + } + + // handle state change and char coloring AS REQUIRED + if (state2 >= 0) + styler.ColourTo(chColor, sc.state), sc.ChangeState(state2); + // move to next char UNLESS re-scanning current char + if (advance) + sc.Forward(); + } + + // do any required terminal char coloring (JIC) + sc.Complete(); +} + +#ifdef BUILD_AS_EXTERNAL_LEXER +static +#endif /* BUILD_AS_EXTERNAL_LEXER */ +void FoldCamlDoc( + unsigned int startPos, int length, + int initStyle, + WordList *keywordlists[], + Accessor &styler) +{ + // below useless evaluation(s) to supress "not used" warnings + startPos || length || initStyle || keywordlists[0] || styler.Length(); +} + +static const char * const camlWordListDesc[] = { + "Keywords", // primary Objective Caml keywords + "Keywords2", // "optional" keywords (typically from Pervasives) + "Keywords3", // "optional" keywords (typically typenames) + 0 +}; + +#ifndef BUILD_AS_EXTERNAL_LEXER +LexerModule lmCaml(SCLEX_CAML, ColouriseCamlDoc, "caml", FoldCamlDoc, camlWordListDesc); +#endif /* BUILD_AS_EXTERNAL_LEXER */ diff --git a/sdk/wxscintilla/src/scintilla/src/LexCmake.cxx b/sdk/wxscintilla/src/scintilla/src/LexCmake.cxx index c29d739097..1f51f474e8 100644 --- a/sdk/wxscintilla/src/scintilla/src/LexCmake.cxx +++ b/sdk/wxscintilla/src/scintilla/src/LexCmake.cxx @@ -1,456 +1,457 @@ -// Scintilla source code edit control -/** @file LexCmake.cxx - ** Lexer for Cmake - **/ -// Copyright 2007 by Cristian Adam -// based on the NSIS lexer -// The License.txt file describes the conditions under which this software may be distributed. -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -static bool isCmakeNumber(char ch) -{ - return(ch >= '0' && ch <= '9'); -} - -static bool isCmakeChar(char ch) -{ - return(ch == '.' ) || (ch == '_' ) || isCmakeNumber(ch) || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'); -} - -static bool isCmakeLetter(char ch) -{ - return(ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'); -} - -static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor &styler) -{ - int nNextLine = -1; - for ( unsigned int i = start; i < end; i++ ) { - char cNext = styler.SafeGetCharAt( i ); - if ( cNext == '\n' ) { - nNextLine = i+1; - break; - } - } - - if ( nNextLine == -1 ) // We never foudn the next line... - return false; - - for ( unsigned int firstChar = nNextLine; firstChar < end; firstChar++ ) { - char cNext = styler.SafeGetCharAt( firstChar ); - if ( cNext == ' ' ) - continue; - if ( cNext == '\t' ) - continue; - if ( styler.Match(firstChar, "ELSE") || styler.Match(firstChar, "else")) - return true; - break; - } - - return false; -} - -static int calculateFoldCmake(unsigned int start, unsigned int end, int foldlevel, Accessor &styler, bool bElse) -{ - // If the word is too long, it is not what we are looking for - if ( end - start > 20 ) - return foldlevel; - - int newFoldlevel = foldlevel; - - char s[20]; // The key word we are looking for has atmost 13 characters - for (unsigned int i = 0; i < end - start + 1 && i < 19; i++) { - s[i] = static_cast( styler[ start + i ] ); - s[i + 1] = '\0'; - } - - if ( CompareCaseInsensitive(s, "IF") == 0 || CompareCaseInsensitive(s, "WHILE") == 0 - || CompareCaseInsensitive(s, "MACRO") == 0 || CompareCaseInsensitive(s, "FOREACH") == 0 - || CompareCaseInsensitive(s, "ELSEIF") == 0 ) - newFoldlevel++; - else if ( CompareCaseInsensitive(s, "ENDIF") == 0 || CompareCaseInsensitive(s, "ENDWHILE") == 0 - || CompareCaseInsensitive(s, "ENDMACRO") == 0 || CompareCaseInsensitive(s, "ENDFOREACH") == 0) - newFoldlevel--; - else if ( bElse && CompareCaseInsensitive(s, "ELSEIF") == 0 ) - newFoldlevel++; - else if ( bElse && CompareCaseInsensitive(s, "ELSE") == 0 ) - newFoldlevel++; - - return newFoldlevel; -} - -static int classifyWordCmake(unsigned int start, unsigned int end, WordList *keywordLists[], Accessor &styler ) -{ - char word[100] = {0}; - char lowercaseWord[100] = {0}; - - WordList &Commands = *keywordLists[0]; - WordList &Parameters = *keywordLists[1]; - WordList &UserDefined = *keywordLists[2]; - - for (unsigned int i = 0; i < end - start + 1 && i < 99; i++) { - word[i] = static_cast( styler[ start + i ] ); - lowercaseWord[i] = static_cast(tolower(word[i])); - } - - // Check for special words... - if ( CompareCaseInsensitive(word, "MACRO") == 0 || CompareCaseInsensitive(word, "ENDMACRO") == 0 ) - return SCE_CMAKE_MACRODEF; - - if ( CompareCaseInsensitive(word, "IF") == 0 || CompareCaseInsensitive(word, "ENDIF") == 0 ) - return SCE_CMAKE_IFDEFINEDEF; - - if ( CompareCaseInsensitive(word, "ELSEIF") == 0 || CompareCaseInsensitive(word, "ELSE") == 0 ) - return SCE_CMAKE_IFDEFINEDEF; - - if ( CompareCaseInsensitive(word, "WHILE") == 0 || CompareCaseInsensitive(word, "ENDWHILE") == 0) - return SCE_CMAKE_WHILEDEF; - - if ( CompareCaseInsensitive(word, "FOREACH") == 0 || CompareCaseInsensitive(word, "ENDFOREACH") == 0) - return SCE_CMAKE_FOREACHDEF; - - if ( Commands.InList(lowercaseWord) ) - return SCE_CMAKE_COMMANDS; - - if ( Parameters.InList(word) ) - return SCE_CMAKE_PARAMETERS; - - - if ( UserDefined.InList(word) ) - return SCE_CMAKE_USERDEFINED; - - if ( strlen(word) > 3 ) { - if ( word[1] == '{' && word[strlen(word)-1] == '}' ) - return SCE_CMAKE_VARIABLE; - } - - // To check for numbers - if ( isCmakeNumber( word[0] ) ) { - bool bHasSimpleCmakeNumber = true; - for (unsigned int j = 1; j < end - start + 1 && j < 99; j++) { - if ( !isCmakeNumber( word[j] ) ) { - bHasSimpleCmakeNumber = false; - break; - } - } - - if ( bHasSimpleCmakeNumber ) - return SCE_CMAKE_NUMBER; - } - - return SCE_CMAKE_DEFAULT; -} - -static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) -{ - int state = SCE_CMAKE_DEFAULT; - if ( startPos > 0 ) - state = styler.StyleAt(startPos-1); // Use the style from the previous line, usually default, but could be commentbox - - styler.StartAt( startPos ); - styler.GetLine( startPos ); - - unsigned int nLengthDoc = startPos + length; - styler.StartSegment( startPos ); - - char cCurrChar; - bool bVarInString = false; - bool bClassicVarInString = false; - - unsigned int i; - for ( i = startPos; i < nLengthDoc; i++ ) { - cCurrChar = styler.SafeGetCharAt( i ); - char cNextChar = styler.SafeGetCharAt(i+1); - - switch (state) { - case SCE_CMAKE_DEFAULT: - if ( cCurrChar == '#' ) { // we have a comment line - styler.ColourTo(i-1, state ); - state = SCE_CMAKE_COMMENT; - break; - } - if ( cCurrChar == '"' ) { - styler.ColourTo(i-1, state ); - state = SCE_CMAKE_STRINGDQ; - bVarInString = false; - bClassicVarInString = false; - break; - } - if ( cCurrChar == '\'' ) { - styler.ColourTo(i-1, state ); - state = SCE_CMAKE_STRINGRQ; - bVarInString = false; - bClassicVarInString = false; - break; - } - if ( cCurrChar == '`' ) { - styler.ColourTo(i-1, state ); - state = SCE_CMAKE_STRINGLQ; - bVarInString = false; - bClassicVarInString = false; - break; - } - - // CMake Variable - if ( cCurrChar == '$' || isCmakeChar(cCurrChar)) { - styler.ColourTo(i-1,state); - state = SCE_CMAKE_VARIABLE; - - // If it is a number, we must check and set style here first... - if ( isCmakeNumber(cCurrChar) && (cNextChar == '\t' || cNextChar == ' ' || cNextChar == '\r' || cNextChar == '\n' ) ) - styler.ColourTo( i, SCE_CMAKE_NUMBER); - - break; - } - - break; - case SCE_CMAKE_COMMENT: - if ( cNextChar == '\n' || cNextChar == '\r' ) { - // Special case: - if ( cCurrChar == '\\' ) { - styler.ColourTo(i-2,state); - styler.ColourTo(i,SCE_CMAKE_DEFAULT); - } - else { - styler.ColourTo(i,state); - state = SCE_CMAKE_DEFAULT; - } - } - break; - case SCE_CMAKE_STRINGDQ: - case SCE_CMAKE_STRINGLQ: - case SCE_CMAKE_STRINGRQ: - - if ( styler.SafeGetCharAt(i-1) == '\\' && styler.SafeGetCharAt(i-2) == '$' ) - break; // Ignore the next character, even if it is a quote of some sort - - if ( cCurrChar == '"' && state == SCE_CMAKE_STRINGDQ ) { - styler.ColourTo(i,state); - state = SCE_CMAKE_DEFAULT; - break; - } - - if ( cCurrChar == '`' && state == SCE_CMAKE_STRINGLQ ) { - styler.ColourTo(i,state); - state = SCE_CMAKE_DEFAULT; - break; - } - - if ( cCurrChar == '\'' && state == SCE_CMAKE_STRINGRQ ) { - styler.ColourTo(i,state); - state = SCE_CMAKE_DEFAULT; - break; - } - - if ( cNextChar == '\r' || cNextChar == '\n' ) { - int nCurLine = styler.GetLine(i+1); - int nBack = i; - // We need to check if the previous line has a \ in it... - bool bNextLine = false; - - while ( nBack > 0 ) { - if ( styler.GetLine(nBack) != nCurLine ) - break; - - char cTemp = styler.SafeGetCharAt(nBack, 'a'); // Letter 'a' is safe here - - if ( cTemp == '\\' ) { - bNextLine = true; - break; - } - if ( cTemp != '\r' && cTemp != '\n' && cTemp != '\t' && cTemp != ' ' ) - break; - - nBack--; - } - - if ( bNextLine ) { - styler.ColourTo(i+1,state); - } - if ( bNextLine == false ) { - styler.ColourTo(i,state); - state = SCE_CMAKE_DEFAULT; - } - } - break; - - case SCE_CMAKE_VARIABLE: - - // CMake Variable: - if ( cCurrChar == '$' ) - state = SCE_CMAKE_DEFAULT; - else if ( cCurrChar == '\\' && (cNextChar == 'n' || cNextChar == 'r' || cNextChar == 't' ) ) - state = SCE_CMAKE_DEFAULT; - else if ( (isCmakeChar(cCurrChar) && !isCmakeChar( cNextChar) && cNextChar != '}') || cCurrChar == '}' ) { - state = classifyWordCmake( styler.GetStartSegment(), i, keywordLists, styler ); - styler.ColourTo( i, state); - state = SCE_CMAKE_DEFAULT; - } - else if ( !isCmakeChar( cCurrChar ) && cCurrChar != '{' && cCurrChar != '}' ) { - if ( classifyWordCmake( styler.GetStartSegment(), i-1, keywordLists, styler) == SCE_CMAKE_NUMBER ) - styler.ColourTo( i-1, SCE_CMAKE_NUMBER ); - - state = SCE_CMAKE_DEFAULT; - - if ( cCurrChar == '"' ) { - state = SCE_CMAKE_STRINGDQ; - bVarInString = false; - bClassicVarInString = false; - } - else if ( cCurrChar == '`' ) { - state = SCE_CMAKE_STRINGLQ; - bVarInString = false; - bClassicVarInString = false; - } - else if ( cCurrChar == '\'' ) { - state = SCE_CMAKE_STRINGRQ; - bVarInString = false; - bClassicVarInString = false; - } - else if ( cCurrChar == '#' ) { - state = SCE_CMAKE_COMMENT; - } - } - break; - } - - if ( state == SCE_CMAKE_COMMENT) { - styler.ColourTo(i,state); - } - else if ( state == SCE_CMAKE_STRINGDQ || state == SCE_CMAKE_STRINGLQ || state == SCE_CMAKE_STRINGRQ ) { - bool bIngoreNextDollarSign = false; - - if ( bVarInString && cCurrChar == '$' ) { - bVarInString = false; - bIngoreNextDollarSign = true; - } - else if ( bVarInString && cCurrChar == '\\' && (cNextChar == 'n' || cNextChar == 'r' || cNextChar == 't' || cNextChar == '"' || cNextChar == '`' || cNextChar == '\'' ) ) { - styler.ColourTo( i+1, SCE_CMAKE_STRINGVAR); - bVarInString = false; - bIngoreNextDollarSign = false; - } - - else if ( bVarInString && !isCmakeChar(cNextChar) ) { - int nWordState = classifyWordCmake( styler.GetStartSegment(), i, keywordLists, styler); - if ( nWordState == SCE_CMAKE_VARIABLE ) - styler.ColourTo( i, SCE_CMAKE_STRINGVAR); - bVarInString = false; - } - // Covers "${TEST}..." - else if ( bClassicVarInString && cNextChar == '}' ) { - styler.ColourTo( i+1, SCE_CMAKE_STRINGVAR); - bClassicVarInString = false; - } - - // Start of var in string - if ( !bIngoreNextDollarSign && cCurrChar == '$' && cNextChar == '{' ) { - styler.ColourTo( i-1, state); - bClassicVarInString = true; - bVarInString = false; - } - else if ( !bIngoreNextDollarSign && cCurrChar == '$' ) { - styler.ColourTo( i-1, state); - bVarInString = true; - bClassicVarInString = false; - } - } - } - - // Colourise remaining document - styler.ColourTo(nLengthDoc-1,state); -} - -static void FoldCmakeDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) -{ - // No folding enabled, no reason to continue... - if ( styler.GetPropertyInt("fold") == 0 ) - return; - - bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) == 1; - - int lineCurrent = styler.GetLine(startPos); - unsigned int safeStartPos = styler.LineStart( lineCurrent ); - - bool bArg1 = true; - int nWordStart = -1; - - int levelCurrent = SC_FOLDLEVELBASE; - if (lineCurrent > 0) - levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; - int levelNext = levelCurrent; - - for (unsigned int i = safeStartPos; i < startPos + length; i++) { - char chCurr = styler.SafeGetCharAt(i); - - if ( bArg1 ) { - if ( nWordStart == -1 && (isCmakeLetter(chCurr)) ) { - nWordStart = i; - } - else if ( isCmakeLetter(chCurr) == false && nWordStart > -1 ) { - int newLevel = calculateFoldCmake( nWordStart, i-1, levelNext, styler, foldAtElse); - - if ( newLevel == levelNext ) { - if ( foldAtElse ) { - if ( CmakeNextLineHasElse(i, startPos + length, styler) ) - levelNext--; - } - } - else - levelNext = newLevel; - bArg1 = false; - } - } - - if ( chCurr == '\n' ) { - if ( bArg1 && foldAtElse) { - if ( CmakeNextLineHasElse(i, startPos + length, styler) ) - levelNext--; - } - - // If we are on a new line... - int levelUse = levelCurrent; - int lev = levelUse | levelNext << 16; - if (levelUse < levelNext ) - lev |= SC_FOLDLEVELHEADERFLAG; - if (lev != styler.LevelAt(lineCurrent)) - styler.SetLevel(lineCurrent, lev); - - lineCurrent++; - levelCurrent = levelNext; - bArg1 = true; // New line, lets look at first argument again - nWordStart = -1; - } - } - - int levelUse = levelCurrent; - int lev = levelUse | levelNext << 16; - if (levelUse < levelNext) - lev |= SC_FOLDLEVELHEADERFLAG; - if (lev != styler.LevelAt(lineCurrent)) - styler.SetLevel(lineCurrent, lev); -} - -static const char * const cmakeWordLists[] = { - "Commands", - "Parameters", - "UserDefined", - 0, - 0,}; - -LexerModule lmCmake(SCLEX_CMAKE, ColouriseCmakeDoc, "cmake", FoldCmakeDoc, cmakeWordLists); +// Scintilla source code edit control +/** @file LexCmake.cxx + ** Lexer for Cmake + **/ +// Copyright 2007 by Cristian Adam +// based on the NSIS lexer +// The License.txt file describes the conditions under which this software may be distributed. +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "CharClassify.h" +#include "PropSet.h" +#include "Accessor.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static bool isCmakeNumber(char ch) +{ + return(ch >= '0' && ch <= '9'); +} + +static bool isCmakeChar(char ch) +{ + return(ch == '.' ) || (ch == '_' ) || isCmakeNumber(ch) || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'); +} + +static bool isCmakeLetter(char ch) +{ + return(ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'); +} + +static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor &styler) +{ + int nNextLine = -1; + for ( unsigned int i = start; i < end; i++ ) { + char cNext = styler.SafeGetCharAt( i ); + if ( cNext == '\n' ) { + nNextLine = i+1; + break; + } + } + + if ( nNextLine == -1 ) // We never foudn the next line... + return false; + + for ( unsigned int firstChar = nNextLine; firstChar < end; firstChar++ ) { + char cNext = styler.SafeGetCharAt( firstChar ); + if ( cNext == ' ' ) + continue; + if ( cNext == '\t' ) + continue; + if ( styler.Match(firstChar, "ELSE") || styler.Match(firstChar, "else")) + return true; + break; + } + + return false; +} + +static int calculateFoldCmake(unsigned int start, unsigned int end, int foldlevel, Accessor &styler, bool bElse) +{ + // If the word is too long, it is not what we are looking for + if ( end - start > 20 ) + return foldlevel; + + int newFoldlevel = foldlevel; + + char s[20]; // The key word we are looking for has atmost 13 characters + for (unsigned int i = 0; i < end - start + 1 && i < 19; i++) { + s[i] = static_cast( styler[ start + i ] ); + s[i + 1] = '\0'; + } + + if ( CompareCaseInsensitive(s, "IF") == 0 || CompareCaseInsensitive(s, "WHILE") == 0 + || CompareCaseInsensitive(s, "MACRO") == 0 || CompareCaseInsensitive(s, "FOREACH") == 0 + || CompareCaseInsensitive(s, "ELSEIF") == 0 ) + newFoldlevel++; + else if ( CompareCaseInsensitive(s, "ENDIF") == 0 || CompareCaseInsensitive(s, "ENDWHILE") == 0 + || CompareCaseInsensitive(s, "ENDMACRO") == 0 || CompareCaseInsensitive(s, "ENDFOREACH") == 0) + newFoldlevel--; + else if ( bElse && CompareCaseInsensitive(s, "ELSEIF") == 0 ) + newFoldlevel++; + else if ( bElse && CompareCaseInsensitive(s, "ELSE") == 0 ) + newFoldlevel++; + + return newFoldlevel; +} + +static int classifyWordCmake(unsigned int start, unsigned int end, WordList *keywordLists[], Accessor &styler ) +{ + char word[100] = {0}; + char lowercaseWord[100] = {0}; + + WordList &Commands = *keywordLists[0]; + WordList &Parameters = *keywordLists[1]; + WordList &UserDefined = *keywordLists[2]; + + for (unsigned int i = 0; i < end - start + 1 && i < 99; i++) { + word[i] = static_cast( styler[ start + i ] ); + lowercaseWord[i] = static_cast(tolower(word[i])); + } + + // Check for special words... + if ( CompareCaseInsensitive(word, "MACRO") == 0 || CompareCaseInsensitive(word, "ENDMACRO") == 0 ) + return SCE_CMAKE_MACRODEF; + + if ( CompareCaseInsensitive(word, "IF") == 0 || CompareCaseInsensitive(word, "ENDIF") == 0 ) + return SCE_CMAKE_IFDEFINEDEF; + + if ( CompareCaseInsensitive(word, "ELSEIF") == 0 || CompareCaseInsensitive(word, "ELSE") == 0 ) + return SCE_CMAKE_IFDEFINEDEF; + + if ( CompareCaseInsensitive(word, "WHILE") == 0 || CompareCaseInsensitive(word, "ENDWHILE") == 0) + return SCE_CMAKE_WHILEDEF; + + if ( CompareCaseInsensitive(word, "FOREACH") == 0 || CompareCaseInsensitive(word, "ENDFOREACH") == 0) + return SCE_CMAKE_FOREACHDEF; + + if ( Commands.InList(lowercaseWord) ) + return SCE_CMAKE_COMMANDS; + + if ( Parameters.InList(word) ) + return SCE_CMAKE_PARAMETERS; + + + if ( UserDefined.InList(word) ) + return SCE_CMAKE_USERDEFINED; + + if ( strlen(word) > 3 ) { + if ( word[1] == '{' && word[strlen(word)-1] == '}' ) + return SCE_CMAKE_VARIABLE; + } + + // To check for numbers + if ( isCmakeNumber( word[0] ) ) { + bool bHasSimpleCmakeNumber = true; + for (unsigned int j = 1; j < end - start + 1 && j < 99; j++) { + if ( !isCmakeNumber( word[j] ) ) { + bHasSimpleCmakeNumber = false; + break; + } + } + + if ( bHasSimpleCmakeNumber ) + return SCE_CMAKE_NUMBER; + } + + return SCE_CMAKE_DEFAULT; +} + +static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) +{ + int state = SCE_CMAKE_DEFAULT; + if ( startPos > 0 ) + state = styler.StyleAt(startPos-1); // Use the style from the previous line, usually default, but could be commentbox + + styler.StartAt( startPos ); + styler.GetLine( startPos ); + + unsigned int nLengthDoc = startPos + length; + styler.StartSegment( startPos ); + + char cCurrChar; + bool bVarInString = false; + bool bClassicVarInString = false; + + unsigned int i; + for ( i = startPos; i < nLengthDoc; i++ ) { + cCurrChar = styler.SafeGetCharAt( i ); + char cNextChar = styler.SafeGetCharAt(i+1); + + switch (state) { + case SCE_CMAKE_DEFAULT: + if ( cCurrChar == '#' ) { // we have a comment line + styler.ColourTo(i-1, state ); + state = SCE_CMAKE_COMMENT; + break; + } + if ( cCurrChar == '"' ) { + styler.ColourTo(i-1, state ); + state = SCE_CMAKE_STRINGDQ; + bVarInString = false; + bClassicVarInString = false; + break; + } + if ( cCurrChar == '\'' ) { + styler.ColourTo(i-1, state ); + state = SCE_CMAKE_STRINGRQ; + bVarInString = false; + bClassicVarInString = false; + break; + } + if ( cCurrChar == '`' ) { + styler.ColourTo(i-1, state ); + state = SCE_CMAKE_STRINGLQ; + bVarInString = false; + bClassicVarInString = false; + break; + } + + // CMake Variable + if ( cCurrChar == '$' || isCmakeChar(cCurrChar)) { + styler.ColourTo(i-1,state); + state = SCE_CMAKE_VARIABLE; + + // If it is a number, we must check and set style here first... + if ( isCmakeNumber(cCurrChar) && (cNextChar == '\t' || cNextChar == ' ' || cNextChar == '\r' || cNextChar == '\n' ) ) + styler.ColourTo( i, SCE_CMAKE_NUMBER); + + break; + } + + break; + case SCE_CMAKE_COMMENT: + if ( cNextChar == '\n' || cNextChar == '\r' ) { + // Special case: + if ( cCurrChar == '\\' ) { + styler.ColourTo(i-2,state); + styler.ColourTo(i,SCE_CMAKE_DEFAULT); + } + else { + styler.ColourTo(i,state); + state = SCE_CMAKE_DEFAULT; + } + } + break; + case SCE_CMAKE_STRINGDQ: + case SCE_CMAKE_STRINGLQ: + case SCE_CMAKE_STRINGRQ: + + if ( styler.SafeGetCharAt(i-1) == '\\' && styler.SafeGetCharAt(i-2) == '$' ) + break; // Ignore the next character, even if it is a quote of some sort + + if ( cCurrChar == '"' && state == SCE_CMAKE_STRINGDQ ) { + styler.ColourTo(i,state); + state = SCE_CMAKE_DEFAULT; + break; + } + + if ( cCurrChar == '`' && state == SCE_CMAKE_STRINGLQ ) { + styler.ColourTo(i,state); + state = SCE_CMAKE_DEFAULT; + break; + } + + if ( cCurrChar == '\'' && state == SCE_CMAKE_STRINGRQ ) { + styler.ColourTo(i,state); + state = SCE_CMAKE_DEFAULT; + break; + } + + if ( cNextChar == '\r' || cNextChar == '\n' ) { + int nCurLine = styler.GetLine(i+1); + int nBack = i; + // We need to check if the previous line has a \ in it... + bool bNextLine = false; + + while ( nBack > 0 ) { + if ( styler.GetLine(nBack) != nCurLine ) + break; + + char cTemp = styler.SafeGetCharAt(nBack, 'a'); // Letter 'a' is safe here + + if ( cTemp == '\\' ) { + bNextLine = true; + break; + } + if ( cTemp != '\r' && cTemp != '\n' && cTemp != '\t' && cTemp != ' ' ) + break; + + nBack--; + } + + if ( bNextLine ) { + styler.ColourTo(i+1,state); + } + if ( bNextLine == false ) { + styler.ColourTo(i,state); + state = SCE_CMAKE_DEFAULT; + } + } + break; + + case SCE_CMAKE_VARIABLE: + + // CMake Variable: + if ( cCurrChar == '$' ) + state = SCE_CMAKE_DEFAULT; + else if ( cCurrChar == '\\' && (cNextChar == 'n' || cNextChar == 'r' || cNextChar == 't' ) ) + state = SCE_CMAKE_DEFAULT; + else if ( (isCmakeChar(cCurrChar) && !isCmakeChar( cNextChar) && cNextChar != '}') || cCurrChar == '}' ) { + state = classifyWordCmake( styler.GetStartSegment(), i, keywordLists, styler ); + styler.ColourTo( i, state); + state = SCE_CMAKE_DEFAULT; + } + else if ( !isCmakeChar( cCurrChar ) && cCurrChar != '{' && cCurrChar != '}' ) { + if ( classifyWordCmake( styler.GetStartSegment(), i-1, keywordLists, styler) == SCE_CMAKE_NUMBER ) + styler.ColourTo( i-1, SCE_CMAKE_NUMBER ); + + state = SCE_CMAKE_DEFAULT; + + if ( cCurrChar == '"' ) { + state = SCE_CMAKE_STRINGDQ; + bVarInString = false; + bClassicVarInString = false; + } + else if ( cCurrChar == '`' ) { + state = SCE_CMAKE_STRINGLQ; + bVarInString = false; + bClassicVarInString = false; + } + else if ( cCurrChar == '\'' ) { + state = SCE_CMAKE_STRINGRQ; + bVarInString = false; + bClassicVarInString = false; + } + else if ( cCurrChar == '#' ) { + state = SCE_CMAKE_COMMENT; + } + } + break; + } + + if ( state == SCE_CMAKE_COMMENT) { + styler.ColourTo(i,state); + } + else if ( state == SCE_CMAKE_STRINGDQ || state == SCE_CMAKE_STRINGLQ || state == SCE_CMAKE_STRINGRQ ) { + bool bIngoreNextDollarSign = false; + + if ( bVarInString && cCurrChar == '$' ) { + bVarInString = false; + bIngoreNextDollarSign = true; + } + else if ( bVarInString && cCurrChar == '\\' && (cNextChar == 'n' || cNextChar == 'r' || cNextChar == 't' || cNextChar == '"' || cNextChar == '`' || cNextChar == '\'' ) ) { + styler.ColourTo( i+1, SCE_CMAKE_STRINGVAR); + bVarInString = false; + bIngoreNextDollarSign = false; + } + + else if ( bVarInString && !isCmakeChar(cNextChar) ) { + int nWordState = classifyWordCmake( styler.GetStartSegment(), i, keywordLists, styler); + if ( nWordState == SCE_CMAKE_VARIABLE ) + styler.ColourTo( i, SCE_CMAKE_STRINGVAR); + bVarInString = false; + } + // Covers "${TEST}..." + else if ( bClassicVarInString && cNextChar == '}' ) { + styler.ColourTo( i+1, SCE_CMAKE_STRINGVAR); + bClassicVarInString = false; + } + + // Start of var in string + if ( !bIngoreNextDollarSign && cCurrChar == '$' && cNextChar == '{' ) { + styler.ColourTo( i-1, state); + bClassicVarInString = true; + bVarInString = false; + } + else if ( !bIngoreNextDollarSign && cCurrChar == '$' ) { + styler.ColourTo( i-1, state); + bVarInString = true; + bClassicVarInString = false; + } + } + } + + // Colourise remaining document + styler.ColourTo(nLengthDoc-1,state); +} + +static void FoldCmakeDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) +{ + // No folding enabled, no reason to continue... + if ( styler.GetPropertyInt("fold") == 0 ) + return; + + bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) == 1; + + int lineCurrent = styler.GetLine(startPos); + unsigned int safeStartPos = styler.LineStart( lineCurrent ); + + bool bArg1 = true; + int nWordStart = -1; + + int levelCurrent = SC_FOLDLEVELBASE; + if (lineCurrent > 0) + levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; + int levelNext = levelCurrent; + + for (unsigned int i = safeStartPos; i < startPos + length; i++) { + char chCurr = styler.SafeGetCharAt(i); + + if ( bArg1 ) { + if ( nWordStart == -1 && (isCmakeLetter(chCurr)) ) { + nWordStart = i; + } + else if ( isCmakeLetter(chCurr) == false && nWordStart > -1 ) { + int newLevel = calculateFoldCmake( nWordStart, i-1, levelNext, styler, foldAtElse); + + if ( newLevel == levelNext ) { + if ( foldAtElse ) { + if ( CmakeNextLineHasElse(i, startPos + length, styler) ) + levelNext--; + } + } + else + levelNext = newLevel; + bArg1 = false; + } + } + + if ( chCurr == '\n' ) { + if ( bArg1 && foldAtElse) { + if ( CmakeNextLineHasElse(i, startPos + length, styler) ) + levelNext--; + } + + // If we are on a new line... + int levelUse = levelCurrent; + int lev = levelUse | levelNext << 16; + if (levelUse < levelNext ) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) + styler.SetLevel(lineCurrent, lev); + + lineCurrent++; + levelCurrent = levelNext; + bArg1 = true; // New line, lets look at first argument again + nWordStart = -1; + } + } + + int levelUse = levelCurrent; + int lev = levelUse | levelNext << 16; + if (levelUse < levelNext) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) + styler.SetLevel(lineCurrent, lev); +} + +static const char * const cmakeWordLists[] = { + "Commands", + "Parameters", + "UserDefined", + 0, + 0,}; + +LexerModule lmCmake(SCLEX_CMAKE, ColouriseCmakeDoc, "cmake", FoldCmakeDoc, cmakeWordLists); diff --git a/sdk/wxscintilla/src/scintilla/src/LexD.cxx b/sdk/wxscintilla/src/scintilla/src/LexD.cxx index 0d6db93ca7..4c4bcb343e 100644 --- a/sdk/wxscintilla/src/scintilla/src/LexD.cxx +++ b/sdk/wxscintilla/src/scintilla/src/LexD.cxx @@ -1,358 +1,399 @@ -/** @file LexD.cxx - ** Lexer for D. - ** - ** Copyright (c) 2006 by Waldemar Augustyn - **/ -// Copyright 1998-2005 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -/*/ Nested comments require keeping the value of the nesting level for every - position in the document. But since scintilla always styles line by line, - we only need to store one value per line. The non-negative number indicates - nesting level at the end of the line. -/*/ - -// We use custom qualifiers since it is not clear what D allows. - -static bool IsWordStart(int ch) { - return isascii(ch) && (isalpha(ch) || ch == '_'); -} - -static bool IsWord(int ch) { - return isascii(ch) && (isalnum(ch) || ch == '_'); -} - -static bool IsDoxygen(int ch) { - if (isascii(ch) && islower(ch)) - return true; - if (ch == '$' || ch == '@' || ch == '\\' || - ch == '&' || ch == '#' || ch == '<' || ch == '>' || - ch == '{' || ch == '}' || ch == '[' || ch == ']') - return true; - return false; -} - - -static void ColouriseDoc(unsigned int startPos, int length, int initStyle, - WordList *keywordlists[], Accessor &styler, bool caseSensitive) { - - WordList &keywords = *keywordlists[0]; - WordList &keywords2 = *keywordlists[1]; - WordList &keywords3 = *keywordlists[2]; - WordList &keywords4 = *keywordlists[3]; - - int styleBeforeDCKeyword = SCE_D_DEFAULT; - - StyleContext sc(startPos, length, initStyle, styler); - - int curLine = styler.GetLine(startPos); - int curNcLevel = curLine > 0? styler.GetLineState(curLine-1): 0; - - for (; sc.More(); sc.Forward()) { - - if (sc.atLineStart) { - if (sc.state == SCE_D_STRING) { - // Prevent SCE_D_STRINGEOL from leaking back to previous line which - // ends with a line continuation by locking in the state upto this position. - sc.SetState(SCE_D_STRING); - } - curLine = styler.GetLine(sc.currentPos); - styler.SetLineState(curLine, curNcLevel); - } - - // Handle line continuation generically. - if (sc.ch == '\\') { - if (sc.chNext == '\n' || sc.chNext == '\r') { - sc.Forward(); - if (sc.ch == '\r' && sc.chNext == '\n') { - sc.Forward(); - } - continue; - } - } - - // Determine if the current state should terminate. - switch (sc.state) { - case SCE_D_OPERATOR: - sc.SetState(SCE_D_DEFAULT); - break; - case SCE_D_NUMBER: - // We accept almost anything because of hex. and number suffixes - if (!IsWord(sc.ch) && sc.ch != '.') { - sc.SetState(SCE_D_DEFAULT); - } - break; - case SCE_D_IDENTIFIER: - if (!IsWord(sc.ch)) { - char s[1000]; - if (caseSensitive) { - sc.GetCurrent(s, sizeof(s)); - } else { - sc.GetCurrentLowered(s, sizeof(s)); - } - if (keywords.InList(s)) { - sc.ChangeState(SCE_D_WORD); - } else if (keywords2.InList(s)) { - sc.ChangeState(SCE_D_WORD2); - } else if (keywords4.InList(s)) { - sc.ChangeState(SCE_D_TYPEDEF); - } - sc.SetState(SCE_D_DEFAULT); - } - break; - case SCE_D_COMMENT: - if (sc.Match('*', '/')) { - sc.Forward(); - sc.ForwardSetState(SCE_D_DEFAULT); - } - break; - case SCE_D_COMMENTDOC: - if (sc.Match('*', '/')) { - sc.Forward(); - sc.ForwardSetState(SCE_D_DEFAULT); - } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support - // Verify that we have the conditions to mark a comment-doc-keyword - if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) { - styleBeforeDCKeyword = SCE_D_COMMENTDOC; - sc.SetState(SCE_D_COMMENTDOCKEYWORD); - } - } - break; - case SCE_D_COMMENTLINE: - if (sc.atLineStart) { - sc.SetState(SCE_D_DEFAULT); - } - break; - case SCE_D_COMMENTLINEDOC: - if (sc.atLineStart) { - sc.SetState(SCE_D_DEFAULT); - } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support - // Verify that we have the conditions to mark a comment-doc-keyword - if ((IsASpace(sc.chPrev) || sc.chPrev == '/' || sc.chPrev == '!') && (!IsASpace(sc.chNext))) { - styleBeforeDCKeyword = SCE_D_COMMENTLINEDOC; - sc.SetState(SCE_D_COMMENTDOCKEYWORD); - } - } - break; - case SCE_D_COMMENTDOCKEYWORD: - if ((styleBeforeDCKeyword == SCE_D_COMMENTDOC) && sc.Match('*', '/')) { - sc.ChangeState(SCE_D_COMMENTDOCKEYWORDERROR); - sc.Forward(); - sc.ForwardSetState(SCE_D_DEFAULT); - } else if (!IsDoxygen(sc.ch)) { - char s[100]; - if (caseSensitive) { - sc.GetCurrent(s, sizeof(s)); - } else { - sc.GetCurrentLowered(s, sizeof(s)); - } - if (!IsASpace(sc.ch) || !keywords3.InList(s + 1)) { - sc.ChangeState(SCE_D_COMMENTDOCKEYWORDERROR); - } - sc.SetState(styleBeforeDCKeyword); - } - break; - case SCE_D_COMMENTNESTED: - if (sc.Match('+', '/')) { - if (curNcLevel > 0) - curNcLevel -= 1; - curLine = styler.GetLine(sc.currentPos); - styler.SetLineState(curLine, curNcLevel); - sc.Forward(); - if (curNcLevel == 0) { - sc.ForwardSetState(SCE_D_DEFAULT); - } - } - else if (sc.Match('/','+')) { - curNcLevel += 1; - curLine = styler.GetLine(sc.currentPos); - styler.SetLineState(curLine, curNcLevel); - sc.Forward(); - } - break; - case SCE_D_STRING: - if (sc.atLineEnd) { - sc.ChangeState(SCE_D_STRINGEOL); - } else if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\"') { - sc.ForwardSetState(SCE_D_DEFAULT); - } - break; - case SCE_D_CHARACTER: - if (sc.atLineEnd) { - sc.ChangeState(SCE_D_STRINGEOL); - } else if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\'') { - sc.ForwardSetState(SCE_D_DEFAULT); - } - break; - case SCE_D_STRINGEOL: - if (sc.atLineStart) { - sc.SetState(SCE_D_DEFAULT); - } - break; - } - - // Determine if a new state should be entered. - if (sc.state == SCE_D_DEFAULT) { - if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { - sc.SetState(SCE_D_NUMBER); - } else if (IsWordStart(sc.ch)) { - sc.SetState(SCE_D_IDENTIFIER); - } else if (sc.Match('/','+')) { - curNcLevel += 1; - curLine = styler.GetLine(sc.currentPos); - styler.SetLineState(curLine, curNcLevel); - sc.SetState(SCE_D_COMMENTNESTED); - sc.Forward(); - } else if (sc.Match('/', '*')) { - if (sc.Match("/**") || sc.Match("/*!")) { // Support of Qt/Doxygen doc. style - sc.SetState(SCE_D_COMMENTDOC); - } else { - sc.SetState(SCE_D_COMMENT); - } - sc.Forward(); // Eat the * so it isn't used for the end of the comment - } else if (sc.Match('/', '/')) { - if ((sc.Match("///") && !sc.Match("////")) || sc.Match("//!")) - // Support of Qt/Doxygen doc. style - sc.SetState(SCE_D_COMMENTLINEDOC); - else - sc.SetState(SCE_D_COMMENTLINE); - } else if (sc.ch == '\"') { - sc.SetState(SCE_D_STRING); - } else if (sc.ch == '\'') { - sc.SetState(SCE_D_CHARACTER); - } else if (isoperator(static_cast(sc.ch))) { - sc.SetState(SCE_D_OPERATOR); - } - } - } - sc.Complete(); -} - -static bool IsStreamCommentStyle(int style) { - return style == SCE_D_COMMENT || - style == SCE_D_COMMENTDOC || - style == SCE_D_COMMENTDOCKEYWORD || - style == SCE_D_COMMENTDOCKEYWORDERROR; -} - -// Store both the current line's fold level and the next lines in the -// level store to make it easy to pick up with each increment -// and to make it possible to fiddle the current level for "} else {". -static void FoldDoc(unsigned int startPos, int length, int initStyle, Accessor &styler) { - bool foldComment = styler.GetPropertyInt("fold.comment") != 0; - bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - bool foldAtElse = styler.GetPropertyInt("lexer.d.fold.at.else", - styler.GetPropertyInt("fold.at.else", 0)) != 0; - unsigned int endPos = startPos + length; - int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); - int levelCurrent = SC_FOLDLEVELBASE; - if (lineCurrent > 0) - levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; - int levelMinCurrent = levelCurrent; - int levelNext = levelCurrent; - char chNext = styler[startPos]; - int styleNext = styler.StyleAt(startPos); - int style = initStyle; - for (unsigned int i = startPos; i < endPos; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - int stylePrev = style; - style = styleNext; - styleNext = styler.StyleAt(i + 1); - bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - if (foldComment && IsStreamCommentStyle(style)) { - if (!IsStreamCommentStyle(stylePrev)) { - levelNext++; - } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { - // Comments don't end at end of line and the next character may be unstyled. - levelNext--; - } - } - if (style == SCE_D_OPERATOR) { - if (ch == '{') { - // Measure the minimum before a '{' to allow - // folding on "} else {" - if (levelMinCurrent > levelNext) { - levelMinCurrent = levelNext; - } - levelNext++; - } else if (ch == '}') { - levelNext--; - } - } - if (atEOL) { - if (foldComment) { // Handle nested comments - int nc; - nc = styler.GetLineState(lineCurrent); - nc -= lineCurrent>0? styler.GetLineState(lineCurrent-1): 0; - levelNext += nc; - } - int levelUse = levelCurrent; - if (foldAtElse) { - levelUse = levelMinCurrent; - } - int lev = levelUse | levelNext << 16; - if (visibleChars == 0 && foldCompact) - lev |= SC_FOLDLEVELWHITEFLAG; - if (levelUse < levelNext) - lev |= SC_FOLDLEVELHEADERFLAG; - if (lev != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, lev); - } - lineCurrent++; - levelCurrent = levelNext; - levelMinCurrent = levelCurrent; - visibleChars = 0; - } - if (!IsASpace(ch)) - visibleChars++; - } -} - -static void FoldDDoc(unsigned int startPos, int length, int initStyle, - WordList *[], Accessor &styler) { - FoldDoc(startPos, length, initStyle, styler); -} - -static const char * const dWordLists[] = { - "Primary keywords and identifiers", - "Secondary keywords and identifiers", - "Documentation comment keywords", - "Type definitions and aliases", - 0, - }; - -static void ColouriseDDoc(unsigned int startPos, int length, - int initStyle, WordList *keywordlists[], Accessor &styler) { - ColouriseDoc(startPos, length, initStyle, keywordlists, styler, true); -} - -LexerModule lmD(SCLEX_D, ColouriseDDoc, "d", FoldDDoc, dWordLists); +/** @file LexD.cxx + ** Lexer for D. + ** + ** Copyright (c) 2006 by Waldemar Augustyn + **/ +// Copyright 1998-2005 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +/* Nested comments require keeping the value of the nesting level for every + position in the document. But since scintilla always styles line by line, + we only need to store one value per line. The non-negative number indicates + nesting level at the end of the line. +*/ + +// Underscore, letter, digit and universal alphas from C99 Appendix D. + +static bool IsWordStart(int ch) { + return (isascii(ch) && (isalpha(ch) || ch == '_')) || !isascii(ch); +} + +static bool IsWord(int ch) { + return (isascii(ch) && (isalnum(ch) || ch == '_')) || !isascii(ch); +} + +static bool IsDoxygen(int ch) { + if (isascii(ch) && islower(ch)) + return true; + if (ch == '$' || ch == '@' || ch == '\\' || + ch == '&' || ch == '#' || ch == '<' || ch == '>' || + ch == '{' || ch == '}' || ch == '[' || ch == ']') + return true; + return false; +} + +static bool IsStringSuffix(int ch) { + return ch == 'c' || ch == 'w' || ch == 'd'; +} + + +static void ColouriseDoc(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler, bool caseSensitive) { + + WordList &keywords = *keywordlists[0]; + WordList &keywords2 = *keywordlists[1]; + WordList &keywords3 = *keywordlists[2]; //doxygen + WordList &keywords4 = *keywordlists[3]; + WordList &keywords5 = *keywordlists[4]; + WordList &keywords6 = *keywordlists[5]; + WordList &keywords7 = *keywordlists[6]; + + int styleBeforeDCKeyword = SCE_D_DEFAULT; + + StyleContext sc(startPos, length, initStyle, styler); + + int curLine = styler.GetLine(startPos); + int curNcLevel = curLine > 0? styler.GetLineState(curLine-1): 0; + bool numFloat = false; // Float literals have '+' and '-' signs + bool numHex = false; + + for (; sc.More(); sc.Forward()) { + + if (sc.atLineStart) { + curLine = styler.GetLine(sc.currentPos); + styler.SetLineState(curLine, curNcLevel); + } + + // Determine if the current state should terminate. + switch (sc.state) { + case SCE_D_OPERATOR: + sc.SetState(SCE_D_DEFAULT); + break; + case SCE_D_NUMBER: + // We accept almost anything because of hex. and number suffixes + if (isascii(sc.ch) && (isalnum(sc.ch) || sc.ch == '_')) { + continue; + } else if (sc.ch == '.' && sc.chNext != '.' && !numFloat) { + // Don't parse 0..2 as number. + numFloat=true; + continue; + } else if ( ( sc.ch == '-' || sc.ch == '+' ) && ( /*sign and*/ + ( !numHex && ( sc.chPrev == 'e' || sc.chPrev == 'E' ) ) || /*decimal or*/ + ( sc.chPrev == 'p' || sc.chPrev == 'P' ) ) ) { /*hex*/ + // Parse exponent sign in float literals: 2e+10 0x2e+10 + continue; + } else { + sc.SetState(SCE_D_DEFAULT); + } + break; + case SCE_D_IDENTIFIER: + if (!IsWord(sc.ch)) { + char s[1000]; + if (caseSensitive) { + sc.GetCurrent(s, sizeof(s)); + } else { + sc.GetCurrentLowered(s, sizeof(s)); + } + if (keywords.InList(s)) { + sc.ChangeState(SCE_D_WORD); + } else if (keywords2.InList(s)) { + sc.ChangeState(SCE_D_WORD2); + } else if (keywords4.InList(s)) { + sc.ChangeState(SCE_D_TYPEDEF); + } else if (keywords5.InList(s)) { + sc.ChangeState(SCE_D_WORD5); + } else if (keywords6.InList(s)) { + sc.ChangeState(SCE_D_WORD6); + } else if (keywords7.InList(s)) { + sc.ChangeState(SCE_D_WORD7); + } + sc.SetState(SCE_D_DEFAULT); + } + break; + case SCE_D_COMMENT: + if (sc.Match('*', '/')) { + sc.Forward(); + sc.ForwardSetState(SCE_D_DEFAULT); + } + break; + case SCE_D_COMMENTDOC: + if (sc.Match('*', '/')) { + sc.Forward(); + sc.ForwardSetState(SCE_D_DEFAULT); + } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support + // Verify that we have the conditions to mark a comment-doc-keyword + if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) { + styleBeforeDCKeyword = SCE_D_COMMENTDOC; + sc.SetState(SCE_D_COMMENTDOCKEYWORD); + } + } + break; + case SCE_D_COMMENTLINE: + if (sc.atLineStart) { + sc.SetState(SCE_D_DEFAULT); + } + break; + case SCE_D_COMMENTLINEDOC: + if (sc.atLineStart) { + sc.SetState(SCE_D_DEFAULT); + } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support + // Verify that we have the conditions to mark a comment-doc-keyword + if ((IsASpace(sc.chPrev) || sc.chPrev == '/' || sc.chPrev == '!') && (!IsASpace(sc.chNext))) { + styleBeforeDCKeyword = SCE_D_COMMENTLINEDOC; + sc.SetState(SCE_D_COMMENTDOCKEYWORD); + } + } + break; + case SCE_D_COMMENTDOCKEYWORD: + if ((styleBeforeDCKeyword == SCE_D_COMMENTDOC) && sc.Match('*', '/')) { + sc.ChangeState(SCE_D_COMMENTDOCKEYWORDERROR); + sc.Forward(); + sc.ForwardSetState(SCE_D_DEFAULT); + } else if (!IsDoxygen(sc.ch)) { + char s[100]; + if (caseSensitive) { + sc.GetCurrent(s, sizeof(s)); + } else { + sc.GetCurrentLowered(s, sizeof(s)); + } + if (!IsASpace(sc.ch) || !keywords3.InList(s + 1)) { + sc.ChangeState(SCE_D_COMMENTDOCKEYWORDERROR); + } + sc.SetState(styleBeforeDCKeyword); + } + break; + case SCE_D_COMMENTNESTED: + if (sc.Match('+', '/')) { + if (curNcLevel > 0) + curNcLevel -= 1; + curLine = styler.GetLine(sc.currentPos); + styler.SetLineState(curLine, curNcLevel); + sc.Forward(); + if (curNcLevel == 0) { + sc.ForwardSetState(SCE_D_DEFAULT); + } + } else if (sc.Match('/','+')) { + curNcLevel += 1; + curLine = styler.GetLine(sc.currentPos); + styler.SetLineState(curLine, curNcLevel); + sc.Forward(); + } + break; + case SCE_D_STRING: + if (sc.ch == '\\') { + if (sc.chNext == '"' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '"') { + if(IsStringSuffix(sc.chNext)) + sc.Forward(); + sc.ForwardSetState(SCE_D_DEFAULT); + } + break; + case SCE_D_CHARACTER: + if (sc.atLineEnd) { + sc.ChangeState(SCE_D_STRINGEOL); + } else if (sc.ch == '\\') { + if (sc.chNext == '\'' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\'') { + // Char has no suffixes + sc.ForwardSetState(SCE_D_DEFAULT); + } + break; + case SCE_D_STRINGEOL: + if (sc.atLineStart) { + sc.SetState(SCE_D_DEFAULT); + } + break; + case SCE_D_STRINGB: + if (sc.ch == '`') { + if(IsStringSuffix(sc.chNext)) + sc.Forward(); + sc.ForwardSetState(SCE_D_DEFAULT); + } + break; + case SCE_D_STRINGR: + if (sc.ch == '"') { + if(IsStringSuffix(sc.chNext)) + sc.Forward(); + sc.ForwardSetState(SCE_D_DEFAULT); + } + break; + } + + // Determine if a new state should be entered. + if (sc.state == SCE_D_DEFAULT) { + if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { + sc.SetState(SCE_D_NUMBER); + numFloat = sc.ch == '.'; + // Remember hex literal + numHex = sc.ch == '0' && ( sc.chNext == 'x' || sc.chNext == 'X' ); + } else if ( (sc.ch == 'r' || sc.ch == 'x' || sc.ch == 'q') + && sc.chNext == '"' ) { + // Limited support for hex and delimited strings: parse as r"" + sc.SetState(SCE_D_STRINGR); + sc.Forward(); + } else if (IsWordStart(sc.ch) || sc.ch == '$') { + sc.SetState(SCE_D_IDENTIFIER); + } else if (sc.Match('/','+')) { + curNcLevel += 1; + curLine = styler.GetLine(sc.currentPos); + styler.SetLineState(curLine, curNcLevel); + sc.SetState(SCE_D_COMMENTNESTED); + sc.Forward(); + } else if (sc.Match('/', '*')) { + if (sc.Match("/**") || sc.Match("/*!")) { // Support of Qt/Doxygen doc. style + sc.SetState(SCE_D_COMMENTDOC); + } else { + sc.SetState(SCE_D_COMMENT); + } + sc.Forward(); // Eat the * so it isn't used for the end of the comment + } else if (sc.Match('/', '/')) { + if ((sc.Match("///") && !sc.Match("////")) || sc.Match("//!")) + // Support of Qt/Doxygen doc. style + sc.SetState(SCE_D_COMMENTLINEDOC); + else + sc.SetState(SCE_D_COMMENTLINE); + } else if (sc.ch == '"') { + sc.SetState(SCE_D_STRING); + } else if (sc.ch == '\'') { + sc.SetState(SCE_D_CHARACTER); + } else if (sc.ch == '`') { + sc.SetState(SCE_D_STRINGB); + } else if (isoperator(static_cast(sc.ch))) { + sc.SetState(SCE_D_OPERATOR); + if (sc.ch == '.' && sc.chNext == '.') sc.Forward(); // Range operator + } + } + } + sc.Complete(); +} + +static bool IsStreamCommentStyle(int style) { + return style == SCE_D_COMMENT || + style == SCE_D_COMMENTDOC || + style == SCE_D_COMMENTDOCKEYWORD || + style == SCE_D_COMMENTDOCKEYWORDERROR; +} + +// Store both the current line's fold level and the next lines in the +// level store to make it easy to pick up with each increment +// and to make it possible to fiddle the current level for "} else {". +static void FoldDoc(unsigned int startPos, int length, int initStyle, Accessor &styler) { + bool foldComment = styler.GetPropertyInt("fold.comment") != 0; + bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + + // property lexer.d.fold.at.else + // This option enables D folding on a "} else {" line of an if statement. + bool foldAtElse = styler.GetPropertyInt("lexer.d.fold.at.else", + styler.GetPropertyInt("fold.at.else", 0)) != 0; + unsigned int endPos = startPos + length; + int visibleChars = 0; + int lineCurrent = styler.GetLine(startPos); + int levelCurrent = SC_FOLDLEVELBASE; + if (lineCurrent > 0) + levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; + int levelMinCurrent = levelCurrent; + int levelNext = levelCurrent; + char chNext = styler[startPos]; + int styleNext = styler.StyleAt(startPos); + int style = initStyle; + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + int stylePrev = style; + style = styleNext; + styleNext = styler.StyleAt(i + 1); + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + if (foldComment && IsStreamCommentStyle(style)) { + if (!IsStreamCommentStyle(stylePrev)) { + levelNext++; + } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { + // Comments don't end at end of line and the next character may be unstyled. + levelNext--; + } + } + if (style == SCE_D_OPERATOR) { + if (ch == '{') { + // Measure the minimum before a '{' to allow + // folding on "} else {" + if (levelMinCurrent > levelNext) { + levelMinCurrent = levelNext; + } + levelNext++; + } else if (ch == '}') { + levelNext--; + } + } + if (atEOL) { + if (foldComment) { // Handle nested comments + int nc; + nc = styler.GetLineState(lineCurrent); + nc -= lineCurrent>0? styler.GetLineState(lineCurrent-1): 0; + levelNext += nc; + } + int levelUse = levelCurrent; + if (foldAtElse) { + levelUse = levelMinCurrent; + } + int lev = levelUse | levelNext << 16; + if (visibleChars == 0 && foldCompact) + lev |= SC_FOLDLEVELWHITEFLAG; + if (levelUse < levelNext) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + lineCurrent++; + levelCurrent = levelNext; + levelMinCurrent = levelCurrent; + visibleChars = 0; + } + if (!IsASpace(ch)) + visibleChars++; + } +} + +static void FoldDDoc(unsigned int startPos, int length, int initStyle, + WordList *[], Accessor &styler) { + FoldDoc(startPos, length, initStyle, styler); +} + +static const char * const dWordLists[] = { + "Primary keywords and identifiers", + "Secondary keywords and identifiers", + "Documentation comment keywords", + "Type definitions and aliases", + "Keywords 5", + "Keywords 6", + "Keywords 7", + 0, + }; + +static void ColouriseDDoc(unsigned int startPos, int length, + int initStyle, WordList *keywordlists[], Accessor &styler) { + ColouriseDoc(startPos, length, initStyle, keywordlists, styler, true); +} + +LexerModule lmD(SCLEX_D, ColouriseDDoc, "d", FoldDDoc, dWordLists); diff --git a/sdk/wxscintilla/src/scintilla/src/LexEScript.cxx b/sdk/wxscintilla/src/scintilla/src/LexEScript.cxx index 3e53627e4d..295aaec531 100644 --- a/sdk/wxscintilla/src/scintilla/src/LexEScript.cxx +++ b/sdk/wxscintilla/src/scintilla/src/LexEScript.cxx @@ -1,273 +1,273 @@ -// Scintilla source code edit control -/** @file LexESCRIPT.cxx - ** Lexer for ESCRIPT - **/ -// Copyright 2003 by Patrizio Bekerle (patrizio@bekerle.com) - -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - - -static inline bool IsAWordChar(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_'); -} - -static inline bool IsAWordStart(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '_'); -} - - - -static void ColouriseESCRIPTDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], - Accessor &styler) { - - WordList &keywords = *keywordlists[0]; - WordList &keywords2 = *keywordlists[1]; - WordList &keywords3 = *keywordlists[2]; - - // Do not leak onto next line - /*if (initStyle == SCE_ESCRIPT_STRINGEOL) - initStyle = SCE_ESCRIPT_DEFAULT;*/ - - StyleContext sc(startPos, length, initStyle, styler); - - bool caseSensitive = styler.GetPropertyInt("escript.case.sensitive", 0) != 0; - - for (; sc.More(); sc.Forward()) { - - /*if (sc.atLineStart && (sc.state == SCE_ESCRIPT_STRING)) { - // Prevent SCE_ESCRIPT_STRINGEOL from leaking back to previous line - sc.SetState(SCE_ESCRIPT_STRING); - }*/ - - // Handle line continuation generically. - if (sc.ch == '\\') { - if (sc.chNext == '\n' || sc.chNext == '\r') { - sc.Forward(); - if (sc.ch == '\r' && sc.chNext == '\n') { - sc.Forward(); - } - continue; - } - } - - // Determine if the current state should terminate. - if (sc.state == SCE_ESCRIPT_OPERATOR || sc.state == SCE_ESCRIPT_BRACE) { - sc.SetState(SCE_ESCRIPT_DEFAULT); - } else if (sc.state == SCE_ESCRIPT_NUMBER) { - if (!IsADigit(sc.ch) || sc.ch != '.') { - sc.SetState(SCE_ESCRIPT_DEFAULT); - } - } else if (sc.state == SCE_ESCRIPT_IDENTIFIER) { - if (!IsAWordChar(sc.ch) || (sc.ch == '.')) { - char s[100]; - if (caseSensitive) { - sc.GetCurrent(s, sizeof(s)); - } else { - sc.GetCurrentLowered(s, sizeof(s)); - } - -// sc.GetCurrentLowered(s, sizeof(s)); - - if (keywords.InList(s)) { - sc.ChangeState(SCE_ESCRIPT_WORD); - } else if (keywords2.InList(s)) { - sc.ChangeState(SCE_ESCRIPT_WORD2); - } else if (keywords3.InList(s)) { - sc.ChangeState(SCE_ESCRIPT_WORD3); - // sc.state = SCE_ESCRIPT_IDENTIFIER; - } - sc.SetState(SCE_ESCRIPT_DEFAULT); - } - } else if (sc.state == SCE_ESCRIPT_COMMENT) { - if (sc.Match('*', '/')) { - sc.Forward(); - sc.ForwardSetState(SCE_ESCRIPT_DEFAULT); - } - } else if (sc.state == SCE_ESCRIPT_COMMENTDOC) { - if (sc.Match('*', '/')) { - sc.Forward(); - sc.ForwardSetState(SCE_ESCRIPT_DEFAULT); - } - } else if (sc.state == SCE_ESCRIPT_COMMENTLINE) { - if (sc.atLineEnd) { - sc.SetState(SCE_ESCRIPT_DEFAULT); - } - } else if (sc.state == SCE_ESCRIPT_STRING) { - if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\"') { - sc.ForwardSetState(SCE_ESCRIPT_DEFAULT); - } - } - - // Determine if a new state should be entered. - if (sc.state == SCE_ESCRIPT_DEFAULT) { - if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { - sc.SetState(SCE_ESCRIPT_NUMBER); - } else if (IsAWordStart(sc.ch) || (sc.ch == '#')) { - sc.SetState(SCE_ESCRIPT_IDENTIFIER); - } else if (sc.Match('/', '*')) { - sc.SetState(SCE_ESCRIPT_COMMENT); - sc.Forward(); // Eat the * so it isn't used for the end of the comment - } else if (sc.Match('/', '/')) { - sc.SetState(SCE_ESCRIPT_COMMENTLINE); - } else if (sc.ch == '\"') { - sc.SetState(SCE_ESCRIPT_STRING); - //} else if (isoperator(static_cast(sc.ch))) { - } else if (sc.ch == '+' || sc.ch == '-' || sc.ch == '*' || sc.ch == '/' || sc.ch == '=' || sc.ch == '<' || sc.ch == '>' || sc.ch == '&' || sc.ch == '|' || sc.ch == '!' || sc.ch == '?' || sc.ch == ':') { - sc.SetState(SCE_ESCRIPT_OPERATOR); - } else if (sc.ch == '{' || sc.ch == '}') { - sc.SetState(SCE_ESCRIPT_BRACE); - } - } - - } - sc.Complete(); -} - - -static int classifyFoldPointESCRIPT(const char* s, const char* prevWord) { - int lev = 0; - if (strcmp(prevWord, "end") == 0) return lev; - if ((strcmp(prevWord, "else") == 0 && strcmp(s, "if") == 0) || strcmp(s, "elseif") == 0) - return -1; - - if (strcmp(s, "for") == 0 || strcmp(s, "foreach") == 0 - || strcmp(s, "program") == 0 || strcmp(s, "function") == 0 - || strcmp(s, "while") == 0 || strcmp(s, "case") == 0 - || strcmp(s, "if") == 0 ) { - lev = 1; - } else if ( strcmp(s, "endfor") == 0 || strcmp(s, "endforeach") == 0 - || strcmp(s, "endprogram") == 0 || strcmp(s, "endfunction") == 0 - || strcmp(s, "endwhile") == 0 || strcmp(s, "endcase") == 0 - || strcmp(s, "endif") == 0 ) { - lev = -1; - } - - return lev; -} - - -static bool IsStreamCommentStyle(int style) { - return style == SCE_ESCRIPT_COMMENT || - style == SCE_ESCRIPT_COMMENTDOC || - style == SCE_ESCRIPT_COMMENTLINE; -} - -static void FoldESCRIPTDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { - //~ bool foldComment = styler.GetPropertyInt("fold.comment") != 0; - // Do not know how to fold the comment at the moment. - bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - bool foldComment = true; - unsigned int endPos = startPos + length; - int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); - int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; - int levelCurrent = levelPrev; - char chNext = styler[startPos]; - int styleNext = styler.StyleAt(startPos); - int style = initStyle; - - int lastStart = 0; - char prevWord[32] = ""; - - for (unsigned int i = startPos; i < endPos; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - int stylePrev = style; - style = styleNext; - styleNext = styler.StyleAt(i + 1); - bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - - - if (foldComment && IsStreamCommentStyle(style)) { - if (!IsStreamCommentStyle(stylePrev)) { - levelCurrent++; - } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { - // Comments don't end at end of line and the next character may be unstyled. - levelCurrent--; - } - } - - if (foldComment && (style == SCE_ESCRIPT_COMMENTLINE)) { - if ((ch == '/') && (chNext == '/')) { - char chNext2 = styler.SafeGetCharAt(i + 2); - if (chNext2 == '{') { - levelCurrent++; - } else if (chNext2 == '}') { - levelCurrent--; - } - } - } - - if (stylePrev == SCE_ESCRIPT_DEFAULT && style == SCE_ESCRIPT_WORD3) - { - // Store last word start point. - lastStart = i; - } - - if (style == SCE_ESCRIPT_WORD3) { - if(iswordchar(ch) && !iswordchar(chNext)) { - char s[32]; - unsigned int j; - for(j = 0; ( j < 31 ) && ( j < i-lastStart+1 ); j++) { - s[j] = static_cast(tolower(styler[lastStart + j])); - } - s[j] = '\0'; - levelCurrent += classifyFoldPointESCRIPT(s, prevWord); - strcpy(prevWord, s); - } - } - if (atEOL) { - int lev = levelPrev; - if (visibleChars == 0 && foldCompact) - lev |= SC_FOLDLEVELWHITEFLAG; - if ((levelCurrent > levelPrev) && (visibleChars > 0)) - lev |= SC_FOLDLEVELHEADERFLAG; - if (lev != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, lev); - } - lineCurrent++; - levelPrev = levelCurrent; - visibleChars = 0; - strcpy(prevWord, ""); - } - - if (!isspacechar(ch)) - visibleChars++; - } - - // Fill in the real level of the next line, keeping the current flags as they will be filled in later - int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; - styler.SetLevel(lineCurrent, levelPrev | flagsNext); -} - - - -static const char * const ESCRIPTWordLists[] = { - "Primary keywords and identifiers", - "Intrinsic functions", - "Extended and user defined functions", - 0, -}; - -LexerModule lmESCRIPT(SCLEX_ESCRIPT, ColouriseESCRIPTDoc, "escript", FoldESCRIPTDoc, ESCRIPTWordLists); +// Scintilla source code edit control +/** @file LexESCRIPT.cxx + ** Lexer for ESCRIPT + **/ +// Copyright 2003 by Patrizio Bekerle (patrizio@bekerle.com) + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + + +static inline bool IsAWordChar(const int ch) { + return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_'); +} + +static inline bool IsAWordStart(const int ch) { + return (ch < 0x80) && (isalnum(ch) || ch == '_'); +} + + + +static void ColouriseESCRIPTDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], + Accessor &styler) { + + WordList &keywords = *keywordlists[0]; + WordList &keywords2 = *keywordlists[1]; + WordList &keywords3 = *keywordlists[2]; + + // Do not leak onto next line + /*if (initStyle == SCE_ESCRIPT_STRINGEOL) + initStyle = SCE_ESCRIPT_DEFAULT;*/ + + StyleContext sc(startPos, length, initStyle, styler); + + bool caseSensitive = styler.GetPropertyInt("escript.case.sensitive", 0) != 0; + + for (; sc.More(); sc.Forward()) { + + /*if (sc.atLineStart && (sc.state == SCE_ESCRIPT_STRING)) { + // Prevent SCE_ESCRIPT_STRINGEOL from leaking back to previous line + sc.SetState(SCE_ESCRIPT_STRING); + }*/ + + // Handle line continuation generically. + if (sc.ch == '\\') { + if (sc.chNext == '\n' || sc.chNext == '\r') { + sc.Forward(); + if (sc.ch == '\r' && sc.chNext == '\n') { + sc.Forward(); + } + continue; + } + } + + // Determine if the current state should terminate. + if (sc.state == SCE_ESCRIPT_OPERATOR || sc.state == SCE_ESCRIPT_BRACE) { + sc.SetState(SCE_ESCRIPT_DEFAULT); + } else if (sc.state == SCE_ESCRIPT_NUMBER) { + if (!IsADigit(sc.ch) || sc.ch != '.') { + sc.SetState(SCE_ESCRIPT_DEFAULT); + } + } else if (sc.state == SCE_ESCRIPT_IDENTIFIER) { + if (!IsAWordChar(sc.ch) || (sc.ch == '.')) { + char s[100]; + if (caseSensitive) { + sc.GetCurrent(s, sizeof(s)); + } else { + sc.GetCurrentLowered(s, sizeof(s)); + } + +// sc.GetCurrentLowered(s, sizeof(s)); + + if (keywords.InList(s)) { + sc.ChangeState(SCE_ESCRIPT_WORD); + } else if (keywords2.InList(s)) { + sc.ChangeState(SCE_ESCRIPT_WORD2); + } else if (keywords3.InList(s)) { + sc.ChangeState(SCE_ESCRIPT_WORD3); + // sc.state = SCE_ESCRIPT_IDENTIFIER; + } + sc.SetState(SCE_ESCRIPT_DEFAULT); + } + } else if (sc.state == SCE_ESCRIPT_COMMENT) { + if (sc.Match('*', '/')) { + sc.Forward(); + sc.ForwardSetState(SCE_ESCRIPT_DEFAULT); + } + } else if (sc.state == SCE_ESCRIPT_COMMENTDOC) { + if (sc.Match('*', '/')) { + sc.Forward(); + sc.ForwardSetState(SCE_ESCRIPT_DEFAULT); + } + } else if (sc.state == SCE_ESCRIPT_COMMENTLINE) { + if (sc.atLineEnd) { + sc.SetState(SCE_ESCRIPT_DEFAULT); + } + } else if (sc.state == SCE_ESCRIPT_STRING) { + if (sc.ch == '\\') { + if (sc.chNext == '\"' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\"') { + sc.ForwardSetState(SCE_ESCRIPT_DEFAULT); + } + } + + // Determine if a new state should be entered. + if (sc.state == SCE_ESCRIPT_DEFAULT) { + if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { + sc.SetState(SCE_ESCRIPT_NUMBER); + } else if (IsAWordStart(sc.ch) || (sc.ch == '#')) { + sc.SetState(SCE_ESCRIPT_IDENTIFIER); + } else if (sc.Match('/', '*')) { + sc.SetState(SCE_ESCRIPT_COMMENT); + sc.Forward(); // Eat the * so it isn't used for the end of the comment + } else if (sc.Match('/', '/')) { + sc.SetState(SCE_ESCRIPT_COMMENTLINE); + } else if (sc.ch == '\"') { + sc.SetState(SCE_ESCRIPT_STRING); + //} else if (isoperator(static_cast(sc.ch))) { + } else if (sc.ch == '+' || sc.ch == '-' || sc.ch == '*' || sc.ch == '/' || sc.ch == '=' || sc.ch == '<' || sc.ch == '>' || sc.ch == '&' || sc.ch == '|' || sc.ch == '!' || sc.ch == '?' || sc.ch == ':') { + sc.SetState(SCE_ESCRIPT_OPERATOR); + } else if (sc.ch == '{' || sc.ch == '}') { + sc.SetState(SCE_ESCRIPT_BRACE); + } + } + + } + sc.Complete(); +} + + +static int classifyFoldPointESCRIPT(const char* s, const char* prevWord) { + int lev = 0; + if (strcmp(prevWord, "end") == 0) return lev; + if ((strcmp(prevWord, "else") == 0 && strcmp(s, "if") == 0) || strcmp(s, "elseif") == 0) + return -1; + + if (strcmp(s, "for") == 0 || strcmp(s, "foreach") == 0 + || strcmp(s, "program") == 0 || strcmp(s, "function") == 0 + || strcmp(s, "while") == 0 || strcmp(s, "case") == 0 + || strcmp(s, "if") == 0 ) { + lev = 1; + } else if ( strcmp(s, "endfor") == 0 || strcmp(s, "endforeach") == 0 + || strcmp(s, "endprogram") == 0 || strcmp(s, "endfunction") == 0 + || strcmp(s, "endwhile") == 0 || strcmp(s, "endcase") == 0 + || strcmp(s, "endif") == 0 ) { + lev = -1; + } + + return lev; +} + + +static bool IsStreamCommentStyle(int style) { + return style == SCE_ESCRIPT_COMMENT || + style == SCE_ESCRIPT_COMMENTDOC || + style == SCE_ESCRIPT_COMMENTLINE; +} + +static void FoldESCRIPTDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) { + //~ bool foldComment = styler.GetPropertyInt("fold.comment") != 0; + // Do not know how to fold the comment at the moment. + bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + bool foldComment = true; + unsigned int endPos = startPos + length; + int visibleChars = 0; + int lineCurrent = styler.GetLine(startPos); + int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; + int levelCurrent = levelPrev; + char chNext = styler[startPos]; + int styleNext = styler.StyleAt(startPos); + int style = initStyle; + + int lastStart = 0; + char prevWord[32] = ""; + + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + int stylePrev = style; + style = styleNext; + styleNext = styler.StyleAt(i + 1); + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + + + if (foldComment && IsStreamCommentStyle(style)) { + if (!IsStreamCommentStyle(stylePrev)) { + levelCurrent++; + } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { + // Comments don't end at end of line and the next character may be unstyled. + levelCurrent--; + } + } + + if (foldComment && (style == SCE_ESCRIPT_COMMENTLINE)) { + if ((ch == '/') && (chNext == '/')) { + char chNext2 = styler.SafeGetCharAt(i + 2); + if (chNext2 == '{') { + levelCurrent++; + } else if (chNext2 == '}') { + levelCurrent--; + } + } + } + + if (stylePrev == SCE_ESCRIPT_DEFAULT && style == SCE_ESCRIPT_WORD3) + { + // Store last word start point. + lastStart = i; + } + + if (style == SCE_ESCRIPT_WORD3) { + if(iswordchar(ch) && !iswordchar(chNext)) { + char s[32]; + unsigned int j; + for(j = 0; ( j < 31 ) && ( j < i-lastStart+1 ); j++) { + s[j] = static_cast(tolower(styler[lastStart + j])); + } + s[j] = '\0'; + levelCurrent += classifyFoldPointESCRIPT(s, prevWord); + strcpy(prevWord, s); + } + } + if (atEOL) { + int lev = levelPrev; + if (visibleChars == 0 && foldCompact) + lev |= SC_FOLDLEVELWHITEFLAG; + if ((levelCurrent > levelPrev) && (visibleChars > 0)) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + lineCurrent++; + levelPrev = levelCurrent; + visibleChars = 0; + strcpy(prevWord, ""); + } + + if (!isspacechar(ch)) + visibleChars++; + } + + // Fill in the real level of the next line, keeping the current flags as they will be filled in later + int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; + styler.SetLevel(lineCurrent, levelPrev | flagsNext); +} + + + +static const char * const ESCRIPTWordLists[] = { + "Primary keywords and identifiers", + "Intrinsic functions", + "Extended and user defined functions", + 0, +}; + +LexerModule lmESCRIPT(SCLEX_ESCRIPT, ColouriseESCRIPTDoc, "escript", FoldESCRIPTDoc, ESCRIPTWordLists); diff --git a/sdk/wxscintilla/src/scintilla/src/LexEiffel.cxx b/sdk/wxscintilla/src/scintilla/src/LexEiffel.cxx index 4f8e7e2468..03dea5e73d 100644 --- a/sdk/wxscintilla/src/scintilla/src/LexEiffel.cxx +++ b/sdk/wxscintilla/src/scintilla/src/LexEiffel.cxx @@ -1,238 +1,238 @@ -// Scintilla source code edit control -/** @file LexEiffel.cxx - ** Lexer for Eiffel. - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -static inline bool isEiffelOperator(unsigned int ch) { - // '.' left out as it is used to make up numbers - return ch == '*' || ch == '/' || ch == '\\' || ch == '-' || ch == '+' || - ch == '(' || ch == ')' || ch == '=' || - ch == '{' || ch == '}' || ch == '~' || - ch == '[' || ch == ']' || ch == ';' || - ch == '<' || ch == '>' || ch == ',' || - ch == '.' || ch == '^' || ch == '%' || ch == ':' || - ch == '!' || ch == '@' || ch == '?'; -} - -static inline bool IsAWordChar(unsigned int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '_'); -} - -static inline bool IsAWordStart(unsigned int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '_'); -} - -static void ColouriseEiffelDoc(unsigned int startPos, - int length, - int initStyle, - WordList *keywordlists[], - Accessor &styler) { - - WordList &keywords = *keywordlists[0]; - - StyleContext sc(startPos, length, initStyle, styler); - - for (; sc.More(); sc.Forward()) { - - if (sc.state == SCE_EIFFEL_STRINGEOL) { - if (sc.ch != '\r' && sc.ch != '\n') { - sc.SetState(SCE_EIFFEL_DEFAULT); - } - } else if (sc.state == SCE_EIFFEL_OPERATOR) { - sc.SetState(SCE_EIFFEL_DEFAULT); - } else if (sc.state == SCE_EIFFEL_WORD) { - if (!IsAWordChar(sc.ch)) { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - if (!keywords.InList(s)) { - sc.ChangeState(SCE_EIFFEL_IDENTIFIER); - } - sc.SetState(SCE_EIFFEL_DEFAULT); - } - } else if (sc.state == SCE_EIFFEL_NUMBER) { - if (!IsAWordChar(sc.ch)) { - sc.SetState(SCE_EIFFEL_DEFAULT); - } - } else if (sc.state == SCE_EIFFEL_COMMENTLINE) { - if (sc.ch == '\r' || sc.ch == '\n') { - sc.SetState(SCE_EIFFEL_DEFAULT); - } - } else if (sc.state == SCE_EIFFEL_STRING) { - if (sc.ch == '%') { - sc.Forward(); - } else if (sc.ch == '\"') { - sc.Forward(); - sc.SetState(SCE_EIFFEL_DEFAULT); - } - } else if (sc.state == SCE_EIFFEL_CHARACTER) { - if (sc.ch == '\r' || sc.ch == '\n') { - sc.SetState(SCE_EIFFEL_STRINGEOL); - } else if (sc.ch == '%') { - sc.Forward(); - } else if (sc.ch == '\'') { - sc.Forward(); - sc.SetState(SCE_EIFFEL_DEFAULT); - } - } - - if (sc.state == SCE_EIFFEL_DEFAULT) { - if (sc.ch == '-' && sc.chNext == '-') { - sc.SetState(SCE_EIFFEL_COMMENTLINE); - } else if (sc.ch == '\"') { - sc.SetState(SCE_EIFFEL_STRING); - } else if (sc.ch == '\'') { - sc.SetState(SCE_EIFFEL_CHARACTER); - } else if (IsADigit(sc.ch) || (sc.ch == '.')) { - sc.SetState(SCE_EIFFEL_NUMBER); - } else if (IsAWordStart(sc.ch)) { - sc.SetState(SCE_EIFFEL_WORD); - } else if (isEiffelOperator(sc.ch)) { - sc.SetState(SCE_EIFFEL_OPERATOR); - } - } - } - sc.Complete(); -} - -static bool IsEiffelComment(Accessor &styler, int pos, int len) { - return len>1 && styler[pos]=='-' && styler[pos+1]=='-'; -} - -static void FoldEiffelDocIndent(unsigned int startPos, int length, int, - WordList *[], Accessor &styler) { - int lengthDoc = startPos + length; - - // Backtrack to previous line in case need to fix its fold status - int lineCurrent = styler.GetLine(startPos); - if (startPos > 0) { - if (lineCurrent > 0) { - lineCurrent--; - startPos = styler.LineStart(lineCurrent); - } - } - int spaceFlags = 0; - int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsEiffelComment); - char chNext = styler[startPos]; - for (int i = startPos; i < lengthDoc; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - - if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) { - int lev = indentCurrent; - int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsEiffelComment); - if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { - // Only non whitespace lines can be headers - if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) { - lev |= SC_FOLDLEVELHEADERFLAG; - } else if (indentNext & SC_FOLDLEVELWHITEFLAG) { - // Line after is blank so check the next - maybe should continue further? - int spaceFlags2 = 0; - int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsEiffelComment); - if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) { - lev |= SC_FOLDLEVELHEADERFLAG; - } - } - } - indentCurrent = indentNext; - styler.SetLevel(lineCurrent, lev); - lineCurrent++; - } - } -} - -static void FoldEiffelDocKeyWords(unsigned int startPos, int length, int /* initStyle */, WordList *[], - Accessor &styler) { - unsigned int lengthDoc = startPos + length; - int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); - int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; - int levelCurrent = levelPrev; - char chNext = styler[startPos]; - int stylePrev = 0; - int styleNext = styler.StyleAt(startPos); - // lastDeferred should be determined by looking back to last keyword in case - // the "deferred" is on a line before "class" - bool lastDeferred = false; - for (unsigned int i = startPos; i < lengthDoc; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - int style = styleNext; - styleNext = styler.StyleAt(i + 1); - bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - if ((stylePrev != SCE_EIFFEL_WORD) && (style == SCE_EIFFEL_WORD)) { - char s[20]; - unsigned int j = 0; - while ((j < (sizeof(s) - 1)) && (iswordchar(styler[i + j]))) { - s[j] = styler[i + j]; - j++; - } - s[j] = '\0'; - - if ( - (strcmp(s, "check") == 0) || - (strcmp(s, "debug") == 0) || - (strcmp(s, "deferred") == 0) || - (strcmp(s, "do") == 0) || - (strcmp(s, "from") == 0) || - (strcmp(s, "if") == 0) || - (strcmp(s, "inspect") == 0) || - (strcmp(s, "once") == 0) - ) - levelCurrent++; - if (!lastDeferred && (strcmp(s, "class") == 0)) - levelCurrent++; - if (strcmp(s, "end") == 0) - levelCurrent--; - lastDeferred = strcmp(s, "deferred") == 0; - } - - if (atEOL) { - int lev = levelPrev; - if (visibleChars == 0) - lev |= SC_FOLDLEVELWHITEFLAG; - if ((levelCurrent > levelPrev) && (visibleChars > 0)) - lev |= SC_FOLDLEVELHEADERFLAG; - if (lev != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, lev); - } - lineCurrent++; - levelPrev = levelCurrent; - visibleChars = 0; - } - if (!isspacechar(ch)) - visibleChars++; - stylePrev = style; - } - // Fill in the real level of the next line, keeping the current flags as they will be filled in later - int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; - styler.SetLevel(lineCurrent, levelPrev | flagsNext); -} - -static const char * const eiffelWordListDesc[] = { - "Keywords", - 0 -}; - -LexerModule lmEiffel(SCLEX_EIFFEL, ColouriseEiffelDoc, "eiffel", FoldEiffelDocIndent, eiffelWordListDesc); -LexerModule lmEiffelkw(SCLEX_EIFFELKW, ColouriseEiffelDoc, "eiffelkw", FoldEiffelDocKeyWords, eiffelWordListDesc); +// Scintilla source code edit control +/** @file LexEiffel.cxx + ** Lexer for Eiffel. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static inline bool isEiffelOperator(unsigned int ch) { + // '.' left out as it is used to make up numbers + return ch == '*' || ch == '/' || ch == '\\' || ch == '-' || ch == '+' || + ch == '(' || ch == ')' || ch == '=' || + ch == '{' || ch == '}' || ch == '~' || + ch == '[' || ch == ']' || ch == ';' || + ch == '<' || ch == '>' || ch == ',' || + ch == '.' || ch == '^' || ch == '%' || ch == ':' || + ch == '!' || ch == '@' || ch == '?'; +} + +static inline bool IsAWordChar(unsigned int ch) { + return (ch < 0x80) && (isalnum(ch) || ch == '_'); +} + +static inline bool IsAWordStart(unsigned int ch) { + return (ch < 0x80) && (isalnum(ch) || ch == '_'); +} + +static void ColouriseEiffelDoc(unsigned int startPos, + int length, + int initStyle, + WordList *keywordlists[], + Accessor &styler) { + + WordList &keywords = *keywordlists[0]; + + StyleContext sc(startPos, length, initStyle, styler); + + for (; sc.More(); sc.Forward()) { + + if (sc.state == SCE_EIFFEL_STRINGEOL) { + if (sc.ch != '\r' && sc.ch != '\n') { + sc.SetState(SCE_EIFFEL_DEFAULT); + } + } else if (sc.state == SCE_EIFFEL_OPERATOR) { + sc.SetState(SCE_EIFFEL_DEFAULT); + } else if (sc.state == SCE_EIFFEL_WORD) { + if (!IsAWordChar(sc.ch)) { + char s[100]; + sc.GetCurrentLowered(s, sizeof(s)); + if (!keywords.InList(s)) { + sc.ChangeState(SCE_EIFFEL_IDENTIFIER); + } + sc.SetState(SCE_EIFFEL_DEFAULT); + } + } else if (sc.state == SCE_EIFFEL_NUMBER) { + if (!IsAWordChar(sc.ch)) { + sc.SetState(SCE_EIFFEL_DEFAULT); + } + } else if (sc.state == SCE_EIFFEL_COMMENTLINE) { + if (sc.ch == '\r' || sc.ch == '\n') { + sc.SetState(SCE_EIFFEL_DEFAULT); + } + } else if (sc.state == SCE_EIFFEL_STRING) { + if (sc.ch == '%') { + sc.Forward(); + } else if (sc.ch == '\"') { + sc.Forward(); + sc.SetState(SCE_EIFFEL_DEFAULT); + } + } else if (sc.state == SCE_EIFFEL_CHARACTER) { + if (sc.ch == '\r' || sc.ch == '\n') { + sc.SetState(SCE_EIFFEL_STRINGEOL); + } else if (sc.ch == '%') { + sc.Forward(); + } else if (sc.ch == '\'') { + sc.Forward(); + sc.SetState(SCE_EIFFEL_DEFAULT); + } + } + + if (sc.state == SCE_EIFFEL_DEFAULT) { + if (sc.ch == '-' && sc.chNext == '-') { + sc.SetState(SCE_EIFFEL_COMMENTLINE); + } else if (sc.ch == '\"') { + sc.SetState(SCE_EIFFEL_STRING); + } else if (sc.ch == '\'') { + sc.SetState(SCE_EIFFEL_CHARACTER); + } else if (IsADigit(sc.ch) || (sc.ch == '.')) { + sc.SetState(SCE_EIFFEL_NUMBER); + } else if (IsAWordStart(sc.ch)) { + sc.SetState(SCE_EIFFEL_WORD); + } else if (isEiffelOperator(sc.ch)) { + sc.SetState(SCE_EIFFEL_OPERATOR); + } + } + } + sc.Complete(); +} + +static bool IsEiffelComment(Accessor &styler, int pos, int len) { + return len>1 && styler[pos]=='-' && styler[pos+1]=='-'; +} + +static void FoldEiffelDocIndent(unsigned int startPos, int length, int, + WordList *[], Accessor &styler) { + int lengthDoc = startPos + length; + + // Backtrack to previous line in case need to fix its fold status + int lineCurrent = styler.GetLine(startPos); + if (startPos > 0) { + if (lineCurrent > 0) { + lineCurrent--; + startPos = styler.LineStart(lineCurrent); + } + } + int spaceFlags = 0; + int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsEiffelComment); + char chNext = styler[startPos]; + for (int i = startPos; i < lengthDoc; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + + if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) { + int lev = indentCurrent; + int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsEiffelComment); + if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { + // Only non whitespace lines can be headers + if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) { + lev |= SC_FOLDLEVELHEADERFLAG; + } else if (indentNext & SC_FOLDLEVELWHITEFLAG) { + // Line after is blank so check the next - maybe should continue further? + int spaceFlags2 = 0; + int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsEiffelComment); + if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) { + lev |= SC_FOLDLEVELHEADERFLAG; + } + } + } + indentCurrent = indentNext; + styler.SetLevel(lineCurrent, lev); + lineCurrent++; + } + } +} + +static void FoldEiffelDocKeyWords(unsigned int startPos, int length, int /* initStyle */, WordList *[], + Accessor &styler) { + unsigned int lengthDoc = startPos + length; + int visibleChars = 0; + int lineCurrent = styler.GetLine(startPos); + int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; + int levelCurrent = levelPrev; + char chNext = styler[startPos]; + int stylePrev = 0; + int styleNext = styler.StyleAt(startPos); + // lastDeferred should be determined by looking back to last keyword in case + // the "deferred" is on a line before "class" + bool lastDeferred = false; + for (unsigned int i = startPos; i < lengthDoc; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + int style = styleNext; + styleNext = styler.StyleAt(i + 1); + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + if ((stylePrev != SCE_EIFFEL_WORD) && (style == SCE_EIFFEL_WORD)) { + char s[20]; + unsigned int j = 0; + while ((j < (sizeof(s) - 1)) && (iswordchar(styler[i + j]))) { + s[j] = styler[i + j]; + j++; + } + s[j] = '\0'; + + if ( + (strcmp(s, "check") == 0) || + (strcmp(s, "debug") == 0) || + (strcmp(s, "deferred") == 0) || + (strcmp(s, "do") == 0) || + (strcmp(s, "from") == 0) || + (strcmp(s, "if") == 0) || + (strcmp(s, "inspect") == 0) || + (strcmp(s, "once") == 0) + ) + levelCurrent++; + if (!lastDeferred && (strcmp(s, "class") == 0)) + levelCurrent++; + if (strcmp(s, "end") == 0) + levelCurrent--; + lastDeferred = strcmp(s, "deferred") == 0; + } + + if (atEOL) { + int lev = levelPrev; + if (visibleChars == 0) + lev |= SC_FOLDLEVELWHITEFLAG; + if ((levelCurrent > levelPrev) && (visibleChars > 0)) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + lineCurrent++; + levelPrev = levelCurrent; + visibleChars = 0; + } + if (!isspacechar(ch)) + visibleChars++; + stylePrev = style; + } + // Fill in the real level of the next line, keeping the current flags as they will be filled in later + int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; + styler.SetLevel(lineCurrent, levelPrev | flagsNext); +} + +static const char * const eiffelWordListDesc[] = { + "Keywords", + 0 +}; + +LexerModule lmEiffel(SCLEX_EIFFEL, ColouriseEiffelDoc, "eiffel", FoldEiffelDocIndent, eiffelWordListDesc); +LexerModule lmEiffelkw(SCLEX_EIFFELKW, ColouriseEiffelDoc, "eiffelkw", FoldEiffelDocKeyWords, eiffelWordListDesc); diff --git a/sdk/wxscintilla/src/scintilla/src/LexErlang.cxx b/sdk/wxscintilla/src/scintilla/src/LexErlang.cxx index d9d58f9624..809dcefe99 100644 --- a/sdk/wxscintilla/src/scintilla/src/LexErlang.cxx +++ b/sdk/wxscintilla/src/scintilla/src/LexErlang.cxx @@ -1,526 +1,526 @@ -// Scintilla source code edit control -/** @file LexErlang.cxx - ** Lexer for Erlang. - ** Written by Peter-Henry Mander, based on Matlab lexer by José Fonseca - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -/* - TODO: - o _Param should be a new lexical type -*/ - -static int is_radix(int radix, int ch) { - int digit; - if ( 16 < radix || 2 > radix ) { - return 0; - } - if ( isdigit(ch) ) { - digit = ch - '0'; - } else if ( isxdigit(ch) ) { - digit = toupper(ch) - 'A' + 10; - } else { - return 0; - } - if ( digit < radix ) { - return 1; - } else { - return 0; - } -} - -typedef enum { - STATE_NULL, - ATOM_UNQUOTED, - ATOM_QUOTED, - ATOM_FUN_NAME, - NODE_NAME_UNQUOTED, - NODE_NAME_QUOTED, - MACRO_START, - MACRO_UNQUOTED, - MACRO_QUOTED, - RECORD_START, - RECORD_UNQUOTED, - RECORD_QUOTED, - NUMERAL_START, - NUMERAL_SIGNED, - NUMERAL_RADIX_LITERAL, - NUMERAL_SPECULATIVE_MANTISSA, - NUMERAL_FLOAT_MANTISSA, - NUMERAL_FLOAT_EXPONENT, - NUMERAL_FLOAT_SIGNED_EXPONENT, - PARSE_ERROR -} atom_parse_state_t; - -static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle, - WordList *keywordlists[], Accessor &styler) { - - WordList &keywords = *keywordlists[0]; - - styler.StartAt(startPos); - - StyleContext sc(startPos, length, initStyle, styler); - atom_parse_state_t parse_state = STATE_NULL; - int radix_digits = 0; - int exponent_digits = 0; - for (; sc.More(); sc.Forward()) { - if ( STATE_NULL != parse_state ) { - switch (parse_state) { - case STATE_NULL: - sc.SetState(SCE_ERLANG_DEFAULT); - break; - case ATOM_UNQUOTED: - if ( '@' == sc.ch ){ - parse_state = NODE_NAME_UNQUOTED; - } else if ( !isalnum(sc.ch) && sc.ch != '_' ) { - char s[100]; - sc.GetCurrent(s, sizeof(s)); - if (keywords.InList(s)) { - sc.ChangeState(SCE_ERLANG_KEYWORD); - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } else { - if ( '/' == sc.ch ) { - parse_state = ATOM_FUN_NAME; - } else { - sc.ChangeState(SCE_ERLANG_ATOM); - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - } - } - break; - case ATOM_QUOTED: - if ( '@' == sc.ch ){ - parse_state = NODE_NAME_QUOTED; - } else if ( '\'' == sc.ch && '\\' != sc.chPrev ) { - sc.ChangeState(SCE_ERLANG_ATOM); - sc.ForwardSetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case ATOM_FUN_NAME: - if ( !isdigit(sc.ch) ) { - sc.ChangeState(SCE_ERLANG_FUNCTION_NAME); - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case NODE_NAME_QUOTED: - if ( '@' == sc.ch ) { - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } else if ( '\'' == sc.ch && '\\' != sc.chPrev ) { - sc.ChangeState(SCE_ERLANG_NODE_NAME); - sc.ForwardSetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case NODE_NAME_UNQUOTED: - if ( '@' == sc.ch ) { - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } else if ( !isalnum(sc.ch) && sc.ch != '_' ) { - sc.ChangeState(SCE_ERLANG_NODE_NAME); - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case RECORD_START: - if ( '\'' == sc.ch ) { - parse_state = RECORD_QUOTED; - } else if (isalpha(sc.ch) && islower(sc.ch)) { - parse_state = RECORD_UNQUOTED; - } else { // error - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case RECORD_QUOTED: - if ( '\'' == sc.ch && '\\' != sc.chPrev ) { - sc.ChangeState(SCE_ERLANG_RECORD); - sc.ForwardSetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case RECORD_UNQUOTED: - if ( !isalpha(sc.ch) && '_' != sc.ch ) { - sc.ChangeState(SCE_ERLANG_RECORD); - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case MACRO_START: - if ( '\'' == sc.ch ) { - parse_state = MACRO_QUOTED; - } else if (isalpha(sc.ch)) { - parse_state = MACRO_UNQUOTED; - } else { // error - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case MACRO_UNQUOTED: - if ( !isalpha(sc.ch) && '_' != sc.ch ) { - sc.ChangeState(SCE_ERLANG_MACRO); - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case MACRO_QUOTED: - if ( '\'' == sc.ch && '\\' != sc.chPrev ) { - sc.ChangeState(SCE_ERLANG_MACRO); - sc.ForwardSetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case NUMERAL_START: - if ( isdigit(sc.ch) ) { - radix_digits *= 10; - radix_digits += sc.ch - '0'; // Assuming ASCII here! - } else if ( '#' == sc.ch ) { - if ( 2 > radix_digits || 16 < radix_digits) { - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } else { - parse_state = NUMERAL_RADIX_LITERAL; - } - } else if ( '.' == sc.ch && isdigit(sc.chNext)) { - radix_digits = 0; - parse_state = NUMERAL_FLOAT_MANTISSA; - } else if ( 'e' == sc.ch || 'E' == sc.ch ) { - exponent_digits = 0; - parse_state = NUMERAL_FLOAT_EXPONENT; - } else { - radix_digits = 0; - sc.ChangeState(SCE_ERLANG_NUMBER); - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case NUMERAL_RADIX_LITERAL: - if ( !is_radix(radix_digits,sc.ch) ) { - radix_digits = 0; - if ( !isalnum(sc.ch) ) { - sc.ChangeState(SCE_ERLANG_NUMBER); - } - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case NUMERAL_FLOAT_MANTISSA: - if ( 'e' == sc.ch || 'E' == sc.ch ) { - exponent_digits = 0; - parse_state = NUMERAL_FLOAT_EXPONENT; - } else if ( !isdigit(sc.ch) ) { - sc.ChangeState(SCE_ERLANG_NUMBER); - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } - break; - case NUMERAL_FLOAT_EXPONENT: - if ( '-' == sc.ch || '+' == sc.ch ) { - parse_state = NUMERAL_FLOAT_SIGNED_EXPONENT; - } else if ( !isdigit(sc.ch) ) { - if ( 0 < exponent_digits ) { - sc.ChangeState(SCE_ERLANG_NUMBER); - } - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } else { - ++exponent_digits; - } - break; - case NUMERAL_FLOAT_SIGNED_EXPONENT: - if ( !isdigit(sc.ch) ) { - if ( 0 < exponent_digits ) { - sc.ChangeState(SCE_ERLANG_NUMBER); - } - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } else { - ++exponent_digits; - } - break; - case NUMERAL_SIGNED: - if ( !isdigit(sc.ch) ) { - sc.ChangeState(SCE_ERLANG_NUMBER); - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } else if ( '.' == sc.ch ) { - parse_state = NUMERAL_FLOAT_MANTISSA; - } - break; - case NUMERAL_SPECULATIVE_MANTISSA: - if ( !isdigit(sc.ch) ) { - sc.ChangeState(SCE_ERLANG_OPERATOR); - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - } else { - parse_state = NUMERAL_FLOAT_MANTISSA; - } - break; - case PARSE_ERROR: - sc.SetState(SCE_ERLANG_DEFAULT); - parse_state = STATE_NULL; - break; - } - } else if (sc.state == SCE_ERLANG_OPERATOR) { - if (sc.chPrev == '.') { - if (sc.ch == '*' || sc.ch == '/' || sc.ch == '\\' || sc.ch == '^') { - sc.ForwardSetState(SCE_ERLANG_DEFAULT); - } else if (sc.ch == '\'') { - sc.ForwardSetState(SCE_ERLANG_DEFAULT); - } else { - sc.SetState(SCE_ERLANG_DEFAULT); - } - } else { - sc.SetState(SCE_ERLANG_DEFAULT); - } - } else if (sc.state == SCE_ERLANG_VARIABLE) { - if (!isalnum(sc.ch) && sc.ch != '_') { - sc.SetState(SCE_ERLANG_DEFAULT); - } - } else if (sc.state == SCE_ERLANG_STRING) { - if (sc.ch == '\"' && sc.chPrev != '\\') { - sc.ForwardSetState(SCE_ERLANG_DEFAULT); - } - } else if (sc.state == SCE_ERLANG_COMMENT ) { - if (sc.atLineEnd) { - sc.SetState(SCE_ERLANG_DEFAULT); - } - } else if (sc.state == SCE_ERLANG_CHARACTER ) { - if ( sc.chPrev == '\\' ) { - sc.ForwardSetState(SCE_ERLANG_DEFAULT); - } else if ( sc.ch != '\\' ) { - sc.ForwardSetState(SCE_ERLANG_DEFAULT); - } - } - - if (sc.state == SCE_ERLANG_DEFAULT) { - if (sc.ch == '%') { - sc.SetState(SCE_ERLANG_COMMENT); - } else if (sc.ch == '\"') { - sc.SetState(SCE_ERLANG_STRING); - } else if (sc.ch == '#') { - parse_state = RECORD_START; - sc.SetState(SCE_ERLANG_UNKNOWN); - } else if (sc.ch == '?') { - parse_state = MACRO_START; - sc.SetState(SCE_ERLANG_UNKNOWN); - } else if (sc.ch == '$') { - sc.SetState(SCE_ERLANG_CHARACTER); - } else if (sc.ch == '\'') { - parse_state = ATOM_QUOTED; - sc.SetState(SCE_ERLANG_UNKNOWN); - } else if ( isdigit(sc.ch) ) { - parse_state = NUMERAL_START; - radix_digits = sc.ch - '0'; - sc.SetState(SCE_ERLANG_UNKNOWN); - } else if ( '.' == sc.ch ) { - parse_state = NUMERAL_SPECULATIVE_MANTISSA; - sc.SetState(SCE_ERLANG_UNKNOWN); - } else if (isalpha(sc.ch) && isupper(sc.ch)) { - sc.SetState(SCE_ERLANG_VARIABLE); - } else if (isalpha(sc.ch)) { - parse_state = ATOM_UNQUOTED; - sc.SetState(SCE_ERLANG_UNKNOWN); - } else if (isoperator(static_cast(sc.ch)) || sc.ch == '\\') { - sc.SetState(SCE_ERLANG_OPERATOR); - } - } - } - sc.Complete(); -} - -static int ClassifyFoldPointErlang( - Accessor &styler, - int styleNext, - int keyword_start -) { - int lev = 0; - if ( styler.Match(keyword_start,"case") - || ( - styler.Match(keyword_start,"fun") - && SCE_ERLANG_FUNCTION_NAME != styleNext) - || styler.Match(keyword_start,"if") - || styler.Match(keyword_start,"query") - || styler.Match(keyword_start,"receive") - ) { - ++lev; - } else if ( styler.Match(keyword_start,"end") ) { - --lev; - } - return lev; -} - - -static void FoldErlangDoc( - unsigned int startPos, int length, int initStyle, - WordList** /*keywordlists*/, Accessor &styler -) { - unsigned int endPos = startPos + length; - //~ int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); - int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; - int levelCurrent = levelPrev; - char chNext = styler.SafeGetCharAt(startPos); - int styleNext = styler.StyleAt(startPos); - int style = initStyle; - int keyword_start = 0; - - bool fold_keywords = true; - bool fold_comments = true; - bool fold_braces = true; - bool fold_function_clauses = false; - bool fold_clauses = false; - - //int clause_level = 0; - - for (unsigned int i = startPos; i < endPos; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - int stylePrev = style; - style = styleNext; - styleNext = styler.StyleAt(i + 1); - bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - - if ( (stylePrev != SCE_ERLANG_KEYWORD) && (style == SCE_ERLANG_KEYWORD) ) { - keyword_start = i; - } - if ( fold_keywords ) { - if ( (stylePrev == SCE_ERLANG_KEYWORD) - && (style != SCE_ERLANG_KEYWORD) - && (style != SCE_ERLANG_ATOM) - ) { - levelCurrent += ClassifyFoldPointErlang(styler,styleNext,keyword_start); - } - } - - if ( fold_comments ) { - if (style == SCE_ERLANG_COMMENT) { - if ((ch == '%') && (chNext == '{')) { - levelCurrent++; - } else if ((ch == '%') && (chNext == '}')) { - levelCurrent--; - } - } - } - - if ( fold_function_clauses ) { - if ( (SC_FOLDLEVELBASE == levelCurrent) /*&& (style == SCE_ERLANG_OPERATOR)*/ ) { - if ( (ch == '-') && (chNext == '>')) { - //~ fprintf(stderr,"levelCurrent=%d\n", levelCurrent); - //++clause_level; - //~ if ( 0 < clause_level ) - ++levelCurrent; - } - } - //~ if ( (stylePrev != SCE_ERLANG_RECORD) - //~ && (style != SCE_ERLANG_NUMBER) - //~ && (style != SCE_ERLANG_STRING) - //~ && (style != SCE_ERLANG_COMMENT) - //~ ) { - if ( (SC_FOLDLEVELBASE+1 == levelCurrent) && (ch == '.') ) { - //--clause_level; - //~ if ( 0 == clause_level ) - --levelCurrent; - } - //~ } - } - - if ( fold_clauses ) { - if ( (0 < levelCurrent) && (style == SCE_ERLANG_OPERATOR) ) { - if ((ch == '-') && (chNext == '>')) { - levelCurrent++; - } - if ( (ch == ';') ) { - levelCurrent--; - } - } - if ( (stylePrev != SCE_ERLANG_RECORD) - && (style != SCE_ERLANG_NUMBER) - && (style != SCE_ERLANG_STRING) - && (style != SCE_ERLANG_COMMENT) - ) { - if ( (ch == '.') ) { - levelCurrent--; - } - } - if ( (stylePrev == SCE_ERLANG_KEYWORD) - && (style != SCE_ERLANG_KEYWORD) - && (style != SCE_ERLANG_ATOM) - && ( - styler.Match(keyword_start,"end") // 'end' counted twice if fold_keywords too - || styler.Match(keyword_start,"after") ) - ) { - levelCurrent--; - } - } - - if ( fold_braces ) { - if (style == SCE_ERLANG_OPERATOR) { - if ( (ch == '{') || (ch == '(') || (ch == '[') ) { - levelCurrent++; - } else if ( (ch == '}') || (ch == ')') || (ch == ']') ) { - levelCurrent--; - } - } - } - - if (atEOL) { - int lev = levelPrev; - //~ if (visibleChars == 0 && foldCompact) - //~ lev |= SC_FOLDLEVELWHITEFLAG; - //~ if ((levelCurrent > levelPrev) && (visibleChars > 0)) - if ((levelCurrent > levelPrev)) { - lev |= SC_FOLDLEVELHEADERFLAG; - } - if (lev != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, lev); - } - lineCurrent++; - levelPrev = levelCurrent; - //~ visibleChars = 0; - } - //~ if (!isspacechar(ch)) - //~ visibleChars++; - - } - // Fill in the real level of the next line, keeping the current flags as they will be filled in later - int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; - styler.SetLevel(lineCurrent, levelPrev | flagsNext); -} - -static const char * const erlangWordListDesc[] = { - "Keywords", - 0 -}; - -LexerModule lmErlang( - SCLEX_ERLANG, - ColouriseErlangDoc, - "erlang", - FoldErlangDoc, - erlangWordListDesc); - +// Scintilla source code edit control +/** @file LexErlang.cxx + ** Lexer for Erlang. + ** Written by Peter-Henry Mander, based on Matlab lexer by José Fonseca + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +/* + TODO: + o _Param should be a new lexical type +*/ + +static int is_radix(int radix, int ch) { + int digit; + if ( 16 < radix || 2 > radix ) { + return 0; + } + if ( isdigit(ch) ) { + digit = ch - '0'; + } else if ( isxdigit(ch) ) { + digit = toupper(ch) - 'A' + 10; + } else { + return 0; + } + if ( digit < radix ) { + return 1; + } else { + return 0; + } +} + +typedef enum { + STATE_NULL, + ATOM_UNQUOTED, + ATOM_QUOTED, + ATOM_FUN_NAME, + NODE_NAME_UNQUOTED, + NODE_NAME_QUOTED, + MACRO_START, + MACRO_UNQUOTED, + MACRO_QUOTED, + RECORD_START, + RECORD_UNQUOTED, + RECORD_QUOTED, + NUMERAL_START, + NUMERAL_SIGNED, + NUMERAL_RADIX_LITERAL, + NUMERAL_SPECULATIVE_MANTISSA, + NUMERAL_FLOAT_MANTISSA, + NUMERAL_FLOAT_EXPONENT, + NUMERAL_FLOAT_SIGNED_EXPONENT, + PARSE_ERROR +} atom_parse_state_t; + +static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler) { + + WordList &keywords = *keywordlists[0]; + + styler.StartAt(startPos); + + StyleContext sc(startPos, length, initStyle, styler); + atom_parse_state_t parse_state = STATE_NULL; + int radix_digits = 0; + int exponent_digits = 0; + for (; sc.More(); sc.Forward()) { + if ( STATE_NULL != parse_state ) { + switch (parse_state) { + case STATE_NULL: + sc.SetState(SCE_ERLANG_DEFAULT); + break; + case ATOM_UNQUOTED: + if ( '@' == sc.ch ){ + parse_state = NODE_NAME_UNQUOTED; + } else if ( !isalnum(sc.ch) && sc.ch != '_' ) { + char s[100]; + sc.GetCurrent(s, sizeof(s)); + if (keywords.InList(s)) { + sc.ChangeState(SCE_ERLANG_KEYWORD); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } else { + if ( '/' == sc.ch ) { + parse_state = ATOM_FUN_NAME; + } else { + sc.ChangeState(SCE_ERLANG_ATOM); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + } + } + break; + case ATOM_QUOTED: + if ( '@' == sc.ch ){ + parse_state = NODE_NAME_QUOTED; + } else if ( '\'' == sc.ch && '\\' != sc.chPrev ) { + sc.ChangeState(SCE_ERLANG_ATOM); + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + break; + case ATOM_FUN_NAME: + if ( !isdigit(sc.ch) ) { + sc.ChangeState(SCE_ERLANG_FUNCTION_NAME); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + break; + case NODE_NAME_QUOTED: + if ( '@' == sc.ch ) { + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } else if ( '\'' == sc.ch && '\\' != sc.chPrev ) { + sc.ChangeState(SCE_ERLANG_NODE_NAME); + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + break; + case NODE_NAME_UNQUOTED: + if ( '@' == sc.ch ) { + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } else if ( !isalnum(sc.ch) && sc.ch != '_' ) { + sc.ChangeState(SCE_ERLANG_NODE_NAME); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + break; + case RECORD_START: + if ( '\'' == sc.ch ) { + parse_state = RECORD_QUOTED; + } else if (isalpha(sc.ch) && islower(sc.ch)) { + parse_state = RECORD_UNQUOTED; + } else { // error + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + break; + case RECORD_QUOTED: + if ( '\'' == sc.ch && '\\' != sc.chPrev ) { + sc.ChangeState(SCE_ERLANG_RECORD); + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + break; + case RECORD_UNQUOTED: + if ( !isalpha(sc.ch) && '_' != sc.ch ) { + sc.ChangeState(SCE_ERLANG_RECORD); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + break; + case MACRO_START: + if ( '\'' == sc.ch ) { + parse_state = MACRO_QUOTED; + } else if (isalpha(sc.ch)) { + parse_state = MACRO_UNQUOTED; + } else { // error + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + break; + case MACRO_UNQUOTED: + if ( !isalpha(sc.ch) && '_' != sc.ch ) { + sc.ChangeState(SCE_ERLANG_MACRO); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + break; + case MACRO_QUOTED: + if ( '\'' == sc.ch && '\\' != sc.chPrev ) { + sc.ChangeState(SCE_ERLANG_MACRO); + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + break; + case NUMERAL_START: + if ( isdigit(sc.ch) ) { + radix_digits *= 10; + radix_digits += sc.ch - '0'; // Assuming ASCII here! + } else if ( '#' == sc.ch ) { + if ( 2 > radix_digits || 16 < radix_digits) { + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } else { + parse_state = NUMERAL_RADIX_LITERAL; + } + } else if ( '.' == sc.ch && isdigit(sc.chNext)) { + radix_digits = 0; + parse_state = NUMERAL_FLOAT_MANTISSA; + } else if ( 'e' == sc.ch || 'E' == sc.ch ) { + exponent_digits = 0; + parse_state = NUMERAL_FLOAT_EXPONENT; + } else { + radix_digits = 0; + sc.ChangeState(SCE_ERLANG_NUMBER); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + break; + case NUMERAL_RADIX_LITERAL: + if ( !is_radix(radix_digits,sc.ch) ) { + radix_digits = 0; + if ( !isalnum(sc.ch) ) { + sc.ChangeState(SCE_ERLANG_NUMBER); + } + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + break; + case NUMERAL_FLOAT_MANTISSA: + if ( 'e' == sc.ch || 'E' == sc.ch ) { + exponent_digits = 0; + parse_state = NUMERAL_FLOAT_EXPONENT; + } else if ( !isdigit(sc.ch) ) { + sc.ChangeState(SCE_ERLANG_NUMBER); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } + break; + case NUMERAL_FLOAT_EXPONENT: + if ( '-' == sc.ch || '+' == sc.ch ) { + parse_state = NUMERAL_FLOAT_SIGNED_EXPONENT; + } else if ( !isdigit(sc.ch) ) { + if ( 0 < exponent_digits ) { + sc.ChangeState(SCE_ERLANG_NUMBER); + } + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } else { + ++exponent_digits; + } + break; + case NUMERAL_FLOAT_SIGNED_EXPONENT: + if ( !isdigit(sc.ch) ) { + if ( 0 < exponent_digits ) { + sc.ChangeState(SCE_ERLANG_NUMBER); + } + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } else { + ++exponent_digits; + } + break; + case NUMERAL_SIGNED: + if ( !isdigit(sc.ch) ) { + sc.ChangeState(SCE_ERLANG_NUMBER); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } else if ( '.' == sc.ch ) { + parse_state = NUMERAL_FLOAT_MANTISSA; + } + break; + case NUMERAL_SPECULATIVE_MANTISSA: + if ( !isdigit(sc.ch) ) { + sc.ChangeState(SCE_ERLANG_OPERATOR); + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + } else { + parse_state = NUMERAL_FLOAT_MANTISSA; + } + break; + case PARSE_ERROR: + sc.SetState(SCE_ERLANG_DEFAULT); + parse_state = STATE_NULL; + break; + } + } else if (sc.state == SCE_ERLANG_OPERATOR) { + if (sc.chPrev == '.') { + if (sc.ch == '*' || sc.ch == '/' || sc.ch == '\\' || sc.ch == '^') { + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + } else if (sc.ch == '\'') { + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + } else { + sc.SetState(SCE_ERLANG_DEFAULT); + } + } else { + sc.SetState(SCE_ERLANG_DEFAULT); + } + } else if (sc.state == SCE_ERLANG_VARIABLE) { + if (!isalnum(sc.ch) && sc.ch != '_') { + sc.SetState(SCE_ERLANG_DEFAULT); + } + } else if (sc.state == SCE_ERLANG_STRING) { + if (sc.ch == '\"' && sc.chPrev != '\\') { + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + } + } else if (sc.state == SCE_ERLANG_COMMENT ) { + if (sc.atLineEnd) { + sc.SetState(SCE_ERLANG_DEFAULT); + } + } else if (sc.state == SCE_ERLANG_CHARACTER ) { + if ( sc.chPrev == '\\' ) { + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + } else if ( sc.ch != '\\' ) { + sc.ForwardSetState(SCE_ERLANG_DEFAULT); + } + } + + if (sc.state == SCE_ERLANG_DEFAULT) { + if (sc.ch == '%') { + sc.SetState(SCE_ERLANG_COMMENT); + } else if (sc.ch == '\"') { + sc.SetState(SCE_ERLANG_STRING); + } else if (sc.ch == '#') { + parse_state = RECORD_START; + sc.SetState(SCE_ERLANG_UNKNOWN); + } else if (sc.ch == '?') { + parse_state = MACRO_START; + sc.SetState(SCE_ERLANG_UNKNOWN); + } else if (sc.ch == '$') { + sc.SetState(SCE_ERLANG_CHARACTER); + } else if (sc.ch == '\'') { + parse_state = ATOM_QUOTED; + sc.SetState(SCE_ERLANG_UNKNOWN); + } else if ( isdigit(sc.ch) ) { + parse_state = NUMERAL_START; + radix_digits = sc.ch - '0'; + sc.SetState(SCE_ERLANG_UNKNOWN); + } else if ( '.' == sc.ch ) { + parse_state = NUMERAL_SPECULATIVE_MANTISSA; + sc.SetState(SCE_ERLANG_UNKNOWN); + } else if (isalpha(sc.ch) && isupper(sc.ch)) { + sc.SetState(SCE_ERLANG_VARIABLE); + } else if (isalpha(sc.ch)) { + parse_state = ATOM_UNQUOTED; + sc.SetState(SCE_ERLANG_UNKNOWN); + } else if (isoperator(static_cast(sc.ch)) || sc.ch == '\\') { + sc.SetState(SCE_ERLANG_OPERATOR); + } + } + } + sc.Complete(); +} + +static int ClassifyFoldPointErlang( + Accessor &styler, + int styleNext, + int keyword_start +) { + int lev = 0; + if ( styler.Match(keyword_start,"case") + || ( + styler.Match(keyword_start,"fun") + && SCE_ERLANG_FUNCTION_NAME != styleNext) + || styler.Match(keyword_start,"if") + || styler.Match(keyword_start,"query") + || styler.Match(keyword_start,"receive") + ) { + ++lev; + } else if ( styler.Match(keyword_start,"end") ) { + --lev; + } + return lev; +} + + +static void FoldErlangDoc( + unsigned int startPos, int length, int initStyle, + WordList** /*keywordlists*/, Accessor &styler +) { + unsigned int endPos = startPos + length; + //~ int visibleChars = 0; + int lineCurrent = styler.GetLine(startPos); + int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; + int levelCurrent = levelPrev; + char chNext = styler.SafeGetCharAt(startPos); + int styleNext = styler.StyleAt(startPos); + int style = initStyle; + int keyword_start = 0; + + bool fold_keywords = true; + bool fold_comments = true; + bool fold_braces = true; + bool fold_function_clauses = false; + bool fold_clauses = false; + + //int clause_level = 0; + + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + int stylePrev = style; + style = styleNext; + styleNext = styler.StyleAt(i + 1); + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + + if ( (stylePrev != SCE_ERLANG_KEYWORD) && (style == SCE_ERLANG_KEYWORD) ) { + keyword_start = i; + } + if ( fold_keywords ) { + if ( (stylePrev == SCE_ERLANG_KEYWORD) + && (style != SCE_ERLANG_KEYWORD) + && (style != SCE_ERLANG_ATOM) + ) { + levelCurrent += ClassifyFoldPointErlang(styler,styleNext,keyword_start); + } + } + + if ( fold_comments ) { + if (style == SCE_ERLANG_COMMENT) { + if ((ch == '%') && (chNext == '{')) { + levelCurrent++; + } else if ((ch == '%') && (chNext == '}')) { + levelCurrent--; + } + } + } + + if ( fold_function_clauses ) { + if ( (SC_FOLDLEVELBASE == levelCurrent) /*&& (style == SCE_ERLANG_OPERATOR)*/ ) { + if ( (ch == '-') && (chNext == '>')) { + //~ fprintf(stderr,"levelCurrent=%d\n", levelCurrent); + //++clause_level; + //~ if ( 0 < clause_level ) + ++levelCurrent; + } + } + //~ if ( (stylePrev != SCE_ERLANG_RECORD) + //~ && (style != SCE_ERLANG_NUMBER) + //~ && (style != SCE_ERLANG_STRING) + //~ && (style != SCE_ERLANG_COMMENT) + //~ ) { + if ( (SC_FOLDLEVELBASE+1 == levelCurrent) && (ch == '.') ) { + //--clause_level; + //~ if ( 0 == clause_level ) + --levelCurrent; + } + //~ } + } + + if ( fold_clauses ) { + if ( (0 < levelCurrent) && (style == SCE_ERLANG_OPERATOR) ) { + if ((ch == '-') && (chNext == '>')) { + levelCurrent++; + } + if ( (ch == ';') ) { + levelCurrent--; + } + } + if ( (stylePrev != SCE_ERLANG_RECORD) + && (style != SCE_ERLANG_NUMBER) + && (style != SCE_ERLANG_STRING) + && (style != SCE_ERLANG_COMMENT) + ) { + if ( (ch == '.') ) { + levelCurrent--; + } + } + if ( (stylePrev == SCE_ERLANG_KEYWORD) + && (style != SCE_ERLANG_KEYWORD) + && (style != SCE_ERLANG_ATOM) + && ( + styler.Match(keyword_start,"end") // 'end' counted twice if fold_keywords too + || styler.Match(keyword_start,"after") ) + ) { + levelCurrent--; + } + } + + if ( fold_braces ) { + if (style == SCE_ERLANG_OPERATOR) { + if ( (ch == '{') || (ch == '(') || (ch == '[') ) { + levelCurrent++; + } else if ( (ch == '}') || (ch == ')') || (ch == ']') ) { + levelCurrent--; + } + } + } + + if (atEOL) { + int lev = levelPrev; + //~ if (visibleChars == 0 && foldCompact) + //~ lev |= SC_FOLDLEVELWHITEFLAG; + //~ if ((levelCurrent > levelPrev) && (visibleChars > 0)) + if ((levelCurrent > levelPrev)) { + lev |= SC_FOLDLEVELHEADERFLAG; + } + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + lineCurrent++; + levelPrev = levelCurrent; + //~ visibleChars = 0; + } + //~ if (!isspacechar(ch)) + //~ visibleChars++; + + } + // Fill in the real level of the next line, keeping the current flags as they will be filled in later + int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; + styler.SetLevel(lineCurrent, levelPrev | flagsNext); +} + +static const char * const erlangWordListDesc[] = { + "Keywords", + 0 +}; + +LexerModule lmErlang( + SCLEX_ERLANG, + ColouriseErlangDoc, + "erlang", + FoldErlangDoc, + erlangWordListDesc); + diff --git a/sdk/wxscintilla/src/scintilla/src/LexFlagship.cxx b/sdk/wxscintilla/src/scintilla/src/LexFlagship.cxx index ddb647cf7b..baf2941a84 100644 --- a/sdk/wxscintilla/src/scintilla/src/LexFlagship.cxx +++ b/sdk/wxscintilla/src/scintilla/src/LexFlagship.cxx @@ -1,230 +1,230 @@ -// Scintilla source code edit control -/** @file LexFlagShip.cxx - ** Lexer for FlagShip - ** (Syntactically compatible to other XBase dialects, like dBase, Clipper, Fox etc.) - **/ -// Copyright 2005 by Randy Butler -// Copyright 1998-2003 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -static bool IsFlagShipComment(Accessor &styler, int pos, int len) { - return len>0 && styler[pos]=='\''; -} - -static inline bool IsTypeCharacter(int ch) { - return ch == '%' || ch == '&' || ch == '@' || ch == '!' || ch == '#' || ch == '$'; -} - -// Extended to accept accented characters -static inline bool IsAWordChar(int ch) { - return ch >= 0x80 || - (isalnum(ch) || ch == '.' || ch == '_'); -} - -static inline bool IsAWordStart(int ch) { - return ch >= 0x80 || - (isalnum(ch) || ch == '_'); -} - -static inline bool IsADateCharacter(const int ch) { - return (ch < 0x80) && - (isalnum(ch) || ch == '|' || ch == '-' || ch == '/' || ch == ':' || ch == ' ' || ch == '\t'); -} - - -static void ColouriseFlagShipDoc(unsigned int startPos, int length, int initStyle, - WordList *keywordlists[], Accessor &styler) { - - //bool FSScriptSyntax = true; - WordList &keywords = *keywordlists[0]; - WordList &keywords2 = *keywordlists[1]; - WordList &keywords3 = *keywordlists[2]; - WordList &keywords4 = *keywordlists[3]; - - styler.StartAt(startPos); - - int visibleChars = 0; - - StyleContext sc(startPos, length, initStyle, styler); - - for (; sc.More(); sc.Forward()) { - - if (sc.state == SCE_FS_OPERATOR) { - sc.SetState(SCE_FS_DEFAULT); - } else if (sc.state == SCE_FS_IDENTIFIER) { - if (!IsAWordChar(sc.ch)) { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - if (keywords.InList(s)) { - sc.ChangeState(SCE_FS_KEYWORD); - } else if (keywords2.InList(s)) { - sc.ChangeState(SCE_FS_KEYWORD2); - } else if (keywords3.InList(s)) { - sc.ChangeState(SCE_FS_KEYWORD3); - } else if (keywords4.InList(s)) { - sc.ChangeState(SCE_FS_KEYWORD4); - }// Else, it is really an identifier... - sc.SetState(SCE_FS_DEFAULT); - } - } else if (sc.state == SCE_FS_NUMBER) { - if (!IsAWordChar(sc.ch)) { - sc.SetState(SCE_FS_DEFAULT); - } - } else if (sc.state == SCE_FS_STRING) { - // VB doubles quotes to preserve them, so just end this string - // state now as a following quote will start again - if (sc.ch == '\"') { - if (tolower(sc.chNext) == 'c') { - sc.Forward(); - } - sc.ForwardSetState(SCE_FS_DEFAULT); - } else if (sc.atLineEnd) { - sc.ChangeState(SCE_FS_STRINGEOL); - sc.ForwardSetState(SCE_FS_DEFAULT); - } - } else if (sc.state == SCE_FS_COMMENT) { - if (sc.Match('*', '/')) { // new code - sc.Forward(); - sc.ForwardSetState(SCE_FS_DEFAULT); - //if (sc.atLineEnd) { // old code - // sc.SetState(SCE_FS_DEFAULT); - } - } else if (sc.state == SCE_FS_COMMENTLINE) { //new code - if (sc.ch == '\r' || sc.ch == '\n') { - sc.SetState(SCE_FS_DEFAULT); - visibleChars = 0; - } - } else if (sc.state == SCE_FS_PREPROCESSOR) { - if (sc.atLineEnd) { - sc.SetState(SCE_FS_DEFAULT); - } - } else if (sc.state == SCE_FS_DATE) { - if (sc.ch == '#' || !IsADateCharacter(sc.chNext)) { - sc.ForwardSetState(SCE_FS_DEFAULT); - } - } - - // Determine if a new state should be entered. - if (sc.state == SCE_FS_DEFAULT) { - if (sc.Match('/', '*')) { // New code - sc.SetState(SCE_FS_COMMENT); - sc.Forward(); // Eat the * so it isn't used for the end of the comment - //if (sc.ch == '\'') { // Old code - // sc.SetState(SCE_FS_COMMENT); // old code - } else if (sc.Match('/', '/')) { // New code - sc.SetState(SCE_FS_COMMENTLINE); - } else if (sc.ch == '\"') { - sc.SetState(SCE_FS_STRING); - } else if (sc.ch == '#' && visibleChars == 0) { - // Preprocessor commands are alone on their line - sc.SetState(SCE_FS_PREPROCESSOR); - } else if (sc.ch == '#') { - int n = 1; - int chSeek = ' '; - while ((n < 100) && (chSeek == ' ' || chSeek == '\t')) { - chSeek = sc.GetRelative(n); - n++; - } - if (IsADigit(chSeek)) { - sc.SetState(SCE_FS_DATE); - } else { - sc.SetState(SCE_FS_OPERATOR); - } - } else if (sc.ch == '&' && tolower(sc.chNext) == 'h') { - sc.SetState(SCE_FS_NUMBER); - } else if (sc.ch == '&' && tolower(sc.chNext) == 'o') { - sc.SetState(SCE_FS_NUMBER); - } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { - sc.SetState(SCE_FS_NUMBER); - } else if (IsAWordStart(sc.ch) || (sc.ch == '[')) { - sc.SetState(SCE_FS_IDENTIFIER); - } else if (isoperator(static_cast(sc.ch)) || (sc.ch == '\\')) { - sc.SetState(SCE_FS_OPERATOR); - } - } - - if (sc.atLineEnd) { - visibleChars = 0; - } - if (!IsASpace(sc.ch)) { - visibleChars++; - } - } - sc.Complete(); -} - -static void FoldFlagShipDoc(unsigned int startPos, int length, int, - WordList *[], Accessor &styler) { - - int endPos = startPos + length; - - // Backtrack to previous line in case need to fix its fold status - int lineCurrent = styler.GetLine(startPos); - if (startPos > 0) { - if (lineCurrent > 0) { - lineCurrent--; - startPos = styler.LineStart(lineCurrent); - } - } - int spaceFlags = 0; - int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsFlagShipComment); - char chNext = styler[startPos]; - for (int i = startPos; i < endPos; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - - if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos)) { - int lev = indentCurrent; - int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsFlagShipComment); - if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { - // Only non whitespace lines can be headers - if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) { - lev |= SC_FOLDLEVELHEADERFLAG; - } else if (indentNext & SC_FOLDLEVELWHITEFLAG) { - // Line after is blank so check the next - maybe should continue further? - int spaceFlags2 = 0; - int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsFlagShipComment); - if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) { - lev |= SC_FOLDLEVELHEADERFLAG; - } - } - } - indentCurrent = indentNext; - styler.SetLevel(lineCurrent, lev); - lineCurrent++; - } - } -} - - -static const char * const FSWordListDesc[] = { - "Keywords", - "functions", - "user2", - "user3", - 0 -}; - -LexerModule lmFlagShip(SCLEX_FLAGSHIP, ColouriseFlagShipDoc, "flagship", FoldFlagShipDoc, FSWordListDesc); - - - +// Scintilla source code edit control +/** @file LexFlagShip.cxx + ** Lexer for FlagShip + ** (Syntactically compatible to other XBase dialects, like dBase, Clipper, Fox etc.) + **/ +// Copyright 2005 by Randy Butler +// Copyright 1998-2003 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static bool IsFlagShipComment(Accessor &styler, int pos, int len) { + return len>0 && styler[pos]=='\''; +} + +static inline bool IsTypeCharacter(int ch) { + return ch == '%' || ch == '&' || ch == '@' || ch == '!' || ch == '#' || ch == '$'; +} + +// Extended to accept accented characters +static inline bool IsAWordChar(int ch) { + return ch >= 0x80 || + (isalnum(ch) || ch == '.' || ch == '_'); +} + +static inline bool IsAWordStart(int ch) { + return ch >= 0x80 || + (isalnum(ch) || ch == '_'); +} + +static inline bool IsADateCharacter(const int ch) { + return (ch < 0x80) && + (isalnum(ch) || ch == '|' || ch == '-' || ch == '/' || ch == ':' || ch == ' ' || ch == '\t'); +} + + +static void ColouriseFlagShipDoc(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler) { + + //bool FSScriptSyntax = true; + WordList &keywords = *keywordlists[0]; + WordList &keywords2 = *keywordlists[1]; + WordList &keywords3 = *keywordlists[2]; + WordList &keywords4 = *keywordlists[3]; + + styler.StartAt(startPos); + + int visibleChars = 0; + + StyleContext sc(startPos, length, initStyle, styler); + + for (; sc.More(); sc.Forward()) { + + if (sc.state == SCE_FS_OPERATOR) { + sc.SetState(SCE_FS_DEFAULT); + } else if (sc.state == SCE_FS_IDENTIFIER) { + if (!IsAWordChar(sc.ch)) { + char s[100]; + sc.GetCurrentLowered(s, sizeof(s)); + if (keywords.InList(s)) { + sc.ChangeState(SCE_FS_KEYWORD); + } else if (keywords2.InList(s)) { + sc.ChangeState(SCE_FS_KEYWORD2); + } else if (keywords3.InList(s)) { + sc.ChangeState(SCE_FS_KEYWORD3); + } else if (keywords4.InList(s)) { + sc.ChangeState(SCE_FS_KEYWORD4); + }// Else, it is really an identifier... + sc.SetState(SCE_FS_DEFAULT); + } + } else if (sc.state == SCE_FS_NUMBER) { + if (!IsAWordChar(sc.ch)) { + sc.SetState(SCE_FS_DEFAULT); + } + } else if (sc.state == SCE_FS_STRING) { + // VB doubles quotes to preserve them, so just end this string + // state now as a following quote will start again + if (sc.ch == '\"') { + if (tolower(sc.chNext) == 'c') { + sc.Forward(); + } + sc.ForwardSetState(SCE_FS_DEFAULT); + } else if (sc.atLineEnd) { + sc.ChangeState(SCE_FS_STRINGEOL); + sc.ForwardSetState(SCE_FS_DEFAULT); + } + } else if (sc.state == SCE_FS_COMMENT) { + if (sc.Match('*', '/')) { // new code + sc.Forward(); + sc.ForwardSetState(SCE_FS_DEFAULT); + //if (sc.atLineEnd) { // old code + // sc.SetState(SCE_FS_DEFAULT); + } + } else if (sc.state == SCE_FS_COMMENTLINE) { //new code + if (sc.ch == '\r' || sc.ch == '\n') { + sc.SetState(SCE_FS_DEFAULT); + visibleChars = 0; + } + } else if (sc.state == SCE_FS_PREPROCESSOR) { + if (sc.atLineEnd) { + sc.SetState(SCE_FS_DEFAULT); + } + } else if (sc.state == SCE_FS_DATE) { + if (sc.ch == '#' || !IsADateCharacter(sc.chNext)) { + sc.ForwardSetState(SCE_FS_DEFAULT); + } + } + + // Determine if a new state should be entered. + if (sc.state == SCE_FS_DEFAULT) { + if (sc.Match('/', '*')) { // New code + sc.SetState(SCE_FS_COMMENT); + sc.Forward(); // Eat the * so it isn't used for the end of the comment + //if (sc.ch == '\'') { // Old code + // sc.SetState(SCE_FS_COMMENT); // old code + } else if (sc.Match('/', '/')) { // New code + sc.SetState(SCE_FS_COMMENTLINE); + } else if (sc.ch == '\"') { + sc.SetState(SCE_FS_STRING); + } else if (sc.ch == '#' && visibleChars == 0) { + // Preprocessor commands are alone on their line + sc.SetState(SCE_FS_PREPROCESSOR); + } else if (sc.ch == '#') { + int n = 1; + int chSeek = ' '; + while ((n < 100) && (chSeek == ' ' || chSeek == '\t')) { + chSeek = sc.GetRelative(n); + n++; + } + if (IsADigit(chSeek)) { + sc.SetState(SCE_FS_DATE); + } else { + sc.SetState(SCE_FS_OPERATOR); + } + } else if (sc.ch == '&' && tolower(sc.chNext) == 'h') { + sc.SetState(SCE_FS_NUMBER); + } else if (sc.ch == '&' && tolower(sc.chNext) == 'o') { + sc.SetState(SCE_FS_NUMBER); + } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { + sc.SetState(SCE_FS_NUMBER); + } else if (IsAWordStart(sc.ch) || (sc.ch == '[')) { + sc.SetState(SCE_FS_IDENTIFIER); + } else if (isoperator(static_cast(sc.ch)) || (sc.ch == '\\')) { + sc.SetState(SCE_FS_OPERATOR); + } + } + + if (sc.atLineEnd) { + visibleChars = 0; + } + if (!IsASpace(sc.ch)) { + visibleChars++; + } + } + sc.Complete(); +} + +static void FoldFlagShipDoc(unsigned int startPos, int length, int, + WordList *[], Accessor &styler) { + + int endPos = startPos + length; + + // Backtrack to previous line in case need to fix its fold status + int lineCurrent = styler.GetLine(startPos); + if (startPos > 0) { + if (lineCurrent > 0) { + lineCurrent--; + startPos = styler.LineStart(lineCurrent); + } + } + int spaceFlags = 0; + int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsFlagShipComment); + char chNext = styler[startPos]; + for (int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + + if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos)) { + int lev = indentCurrent; + int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsFlagShipComment); + if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { + // Only non whitespace lines can be headers + if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) { + lev |= SC_FOLDLEVELHEADERFLAG; + } else if (indentNext & SC_FOLDLEVELWHITEFLAG) { + // Line after is blank so check the next - maybe should continue further? + int spaceFlags2 = 0; + int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsFlagShipComment); + if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) { + lev |= SC_FOLDLEVELHEADERFLAG; + } + } + } + indentCurrent = indentNext; + styler.SetLevel(lineCurrent, lev); + lineCurrent++; + } + } +} + + +static const char * const FSWordListDesc[] = { + "Keywords", + "functions", + "user2", + "user3", + 0 +}; + +LexerModule lmFlagShip(SCLEX_FLAGSHIP, ColouriseFlagShipDoc, "flagship", FoldFlagShipDoc, FSWordListDesc); + + + diff --git a/sdk/wxscintilla/src/scintilla/src/LexForth.cxx b/sdk/wxscintilla/src/scintilla/src/LexForth.cxx index aa72287f2f..e52543fa55 100644 --- a/sdk/wxscintilla/src/scintilla/src/LexForth.cxx +++ b/sdk/wxscintilla/src/scintilla/src/LexForth.cxx @@ -1,352 +1,176 @@ -// Scintilla source code edit control -/** @file LexCrontab.cxx - ** Lexer to use with extended crontab files used by a powerful - ** Windows scheduler/event monitor/automation manager nnCron. - ** (http://nemtsev.eserv.ru/) - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -bool is_whitespace(int ch){ - return ch == '\n' || ch == '\r' || ch == '\t' || ch == ' '; -} - -bool is_blank(int ch){ - return ch == '\t' || ch == ' '; -} -//#define FORTH_DEBUG -#ifdef FORTH_DEBUG -static FILE *f_debug; -#define log(x) fputs(f_debug,x); -#else -#define log(x) -#endif - -#define STATE_LOCALE -#define BL ' ' - -static Accessor *st; -static int cur_pos,pos1,pos2,pos0,lengthDoc; -char *buffer; - -char getChar(bool is_bl){ - char ch=st->SafeGetCharAt(cur_pos); - if(is_bl) if(is_whitespace(ch)) ch=BL; - return ch; -} - -char getCharBL(){ - char ch=st->SafeGetCharAt(cur_pos); - return ch; -} -bool is_eol(char ch){ - return ch=='\n' || ch=='\r'; -} - -int parse(char ch, bool skip_eol){ -// pos1 - start pos of word -// pos2 - pos after of word -// pos0 - start pos - char c=0; - int len; - bool is_bl=ch==BL; - pos0=pos1=pos2=cur_pos; - for(;cur_pos9 && base>10) digit-=7; - if(digit<0) return false; - if(digit>=base) return false; - } - return true; -} - -bool is_number(char *s){ - if(strncmp(s,"0x",2)==0) return _is_number(s+2,16); - return _is_number(s,10); -} - -static void ColouriseForthDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) -{ - st=&styler; - cur_pos=startPos; - lengthDoc = startPos + length; - buffer = new char[length]; - -#ifdef FORTH_DEBUG - f_debug=fopen("c:\\sci.log","at"); -#endif - - WordList &control = *keywordLists[0]; - WordList &keyword = *keywordLists[1]; - WordList &defword = *keywordLists[2]; - WordList &preword1 = *keywordLists[3]; - WordList &preword2 = *keywordLists[4]; - WordList &strings = *keywordLists[5]; - - // go through all provided text segment - // using the hand-written state machine shown below - styler.StartAt(startPos); - styler.StartSegment(startPos); - while(parse(BL,true)!=0){ - if(pos0!=pos1){ - styler.ColourTo(pos0,SCE_FORTH_DEFAULT); - styler.ColourTo(pos1-1,SCE_FORTH_DEFAULT); - } - if(strcmp("\\",buffer)==0){ - styler.ColourTo(pos1,SCE_FORTH_COMMENT); - parse(1,false); - styler.ColourTo(pos2,SCE_FORTH_COMMENT); - }else if(strcmp("(",buffer)==0){ - styler.ColourTo(pos1,SCE_FORTH_COMMENT); - parse(')',true); - if(cur_pos +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static inline bool IsAWordChar(int ch) { + return (ch < 0x80) && (isalnum(ch) || ch == '.' || + ch == '_' || ch == '?' || ch == '"' || ch == '@' || + ch == '!' || ch == '[' || ch == ']' || ch == '/' || + ch == '+' || ch == '-' || ch == '*' || ch == '<' || + ch == '>' || ch == '=' || ch == ';' || ch == '(' || + ch == ')' ); +} + +static inline bool IsAWordStart(int ch) { + return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.'); +} + +static inline bool IsANumChar(int ch) { + return (ch < 0x80) && (isxdigit(ch) || ch == '.' || ch == 'e' || ch == 'E' ); +} + +static inline bool IsASpaceChar(int ch) { + return (ch < 0x80) && isspace(ch); +} + +static void ColouriseForthDoc(unsigned int startPos, int length, int initStyle, WordList *keywordLists[], + Accessor &styler) { + + WordList &control = *keywordLists[0]; + WordList &keyword = *keywordLists[1]; + WordList &defword = *keywordLists[2]; + WordList &preword1 = *keywordLists[3]; + WordList &preword2 = *keywordLists[4]; + WordList &strings = *keywordLists[5]; + + StyleContext sc(startPos, length, initStyle, styler); + + for (; sc.More(); sc.Forward()) + { + // Determine if the current state should terminate. + if (sc.state == SCE_FORTH_COMMENT) { + if (sc.atLineEnd) { + sc.SetState(SCE_FORTH_DEFAULT); + } + }else if (sc.state == SCE_FORTH_COMMENT_ML) { + if (sc.ch == ')') { + sc.ForwardSetState(SCE_FORTH_DEFAULT); + } + }else if (sc.state == SCE_FORTH_IDENTIFIER || sc.state == SCE_FORTH_NUMBER) { + // handle numbers here too, because what we thought was a number might + // turn out to be a keyword e.g. 2DUP + if (IsASpaceChar(sc.ch) ) { + char s[100]; + sc.GetCurrentLowered(s, sizeof(s)); + int newState = sc.state == SCE_FORTH_NUMBER ? SCE_FORTH_NUMBER : SCE_FORTH_DEFAULT; + if (control.InList(s)) { + sc.ChangeState(SCE_FORTH_CONTROL); + } else if (keyword.InList(s)) { + sc.ChangeState(SCE_FORTH_KEYWORD); + } else if (defword.InList(s)) { + sc.ChangeState(SCE_FORTH_DEFWORD); + } else if (preword1.InList(s)) { + sc.ChangeState(SCE_FORTH_PREWORD1); + } else if (preword2.InList(s)) { + sc.ChangeState(SCE_FORTH_PREWORD2); + } else if (strings.InList(s)) { + sc.ChangeState(SCE_FORTH_STRING); + newState = SCE_FORTH_STRING; + } + sc.SetState(newState); + } + if (sc.state == SCE_FORTH_NUMBER) { + if (IsASpaceChar(sc.ch)) { + sc.SetState(SCE_FORTH_DEFAULT); + } else if (!IsANumChar(sc.ch)) { + sc.ChangeState(SCE_FORTH_IDENTIFIER); + } + } + }else if (sc.state == SCE_FORTH_STRING) { + if (sc.ch == '\"') { + sc.ForwardSetState(SCE_FORTH_DEFAULT); + } + }else if (sc.state == SCE_FORTH_LOCALE) { + if (sc.ch == '}') { + sc.ForwardSetState(SCE_FORTH_DEFAULT); + } + }else if (sc.state == SCE_FORTH_DEFWORD) { + if (IsASpaceChar(sc.ch)) { + sc.SetState(SCE_FORTH_DEFAULT); + } + } + + // Determine if a new state should be entered. + if (sc.state == SCE_FORTH_DEFAULT) { + if (sc.ch == '\\'){ + sc.SetState(SCE_FORTH_COMMENT); + } else if (sc.ch == '(' && + (sc.atLineStart || IsASpaceChar(sc.chPrev)) && + (sc.atLineEnd || IsASpaceChar(sc.chNext))) { + sc.SetState(SCE_FORTH_COMMENT_ML); + } else if ( (sc.ch == '$' && (isascii(sc.chNext) && isxdigit(sc.chNext))) ) { + // number starting with $ is a hex number + sc.SetState(SCE_FORTH_NUMBER); + while(sc.More() && isascii(sc.chNext) && isxdigit(sc.chNext)) + sc.Forward(); + } else if ( (sc.ch == '%' && (isascii(sc.chNext) && (sc.chNext == '0' || sc.chNext == '1'))) ) { + // number starting with % is binary + sc.SetState(SCE_FORTH_NUMBER); + while(sc.More() && isascii(sc.chNext) && (sc.chNext == '0' || sc.chNext == '1')) + sc.Forward(); + } else if ( isascii(sc.ch) && + (isxdigit(sc.ch) || ((sc.ch == '.' || sc.ch == '-') && isascii(sc.chNext) && isxdigit(sc.chNext)) ) + ){ + sc.SetState(SCE_FORTH_NUMBER); + } else if (IsAWordStart(sc.ch)) { + sc.SetState(SCE_FORTH_IDENTIFIER); + } else if (sc.ch == '{') { + sc.SetState(SCE_FORTH_LOCALE); + } else if (sc.ch == ':' && isascii(sc.chNext) && isspace(sc.chNext)) { + // highlight word definitions e.g. : GCD ( n n -- n ) ..... ; + // ^ ^^^ + sc.SetState(SCE_FORTH_DEFWORD); + while(sc.More() && isascii(sc.chNext) && isspace(sc.chNext)) + sc.Forward(); + } else if (sc.ch == ';' && + (sc.atLineStart || IsASpaceChar(sc.chPrev)) && + (sc.atLineEnd || IsASpaceChar(sc.chNext)) ) { + // mark the ';' that ends a word + sc.SetState(SCE_FORTH_DEFWORD); + sc.ForwardSetState(SCE_FORTH_DEFAULT); + } + } + + } + sc.Complete(); +} + +static void FoldForthDoc(unsigned int, int, int, WordList *[], + Accessor &) { +} + +static const char * const forthWordLists[] = { + "control keywords", + "keywords", + "definition words", + "prewords with one argument", + "prewords with two arguments", + "string definition keywords", + 0, + }; + +LexerModule lmForth(SCLEX_FORTH, ColouriseForthDoc, "forth", FoldForthDoc, forthWordLists); + + diff --git a/sdk/wxscintilla/src/scintilla/src/LexFortran.cxx b/sdk/wxscintilla/src/scintilla/src/LexFortran.cxx index e80fb7744e..0b3f2777c9 100644 --- a/sdk/wxscintilla/src/scintilla/src/LexFortran.cxx +++ b/sdk/wxscintilla/src/scintilla/src/LexFortran.cxx @@ -1,457 +1,466 @@ -// Scintilla source code edit control -/** @file LexFortran.cxx - ** Lexer for Fortran. - ** Writen by Chuan-jian Shen, Last changed Sep. 2003 - **/ -// Copyright 1998-2001 by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. -/***************************************/ -#include -#include -#include -#include -#include -/***************************************/ -#include "Platform.h" -#include "PropSet.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -/***********************************************/ -static inline bool IsAWordChar(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '%'); -} -/**********************************************/ -static inline bool IsAWordStart(const int ch) { - return (ch < 0x80) && (isalnum(ch)); -} -/***************************************/ -inline bool IsABlank(unsigned int ch) { - return (ch == ' ') || (ch == 0x09) || (ch == 0x0b) ; -} -/***************************************/ -inline bool IsALineEnd(char ch) { - return ((ch == '\n') || (ch == '\r')) ; -} -/***************************************/ -unsigned int GetContinuedPos(unsigned int pos, Accessor &styler) { - while (!IsALineEnd(styler.SafeGetCharAt(pos++))) continue; - if (styler.SafeGetCharAt(pos) == '\n') pos++; - while (IsABlank(styler.SafeGetCharAt(pos++))) continue; - char chCur = styler.SafeGetCharAt(pos); - if (chCur == '&') { - while (IsABlank(styler.SafeGetCharAt(++pos))) continue; - return pos; - } else { - return pos; - } -} -/***************************************/ -static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle, - WordList *keywordlists[], Accessor &styler, bool isFixFormat) { - WordList &keywords = *keywordlists[0]; - WordList &keywords2 = *keywordlists[1]; - WordList &keywords3 = *keywordlists[2]; - /***************************************/ - int posLineStart = 0, numNonBlank = 0, prevState = 0; - int endPos = startPos + length; - /***************************************/ - // backtrack to the nearest keyword - while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_F_WORD)) { - startPos--; - } - startPos = styler.LineStart(styler.GetLine(startPos)); - initStyle = styler.StyleAt(startPos - 1); - StyleContext sc(startPos, endPos-startPos, initStyle, styler); - /***************************************/ - for (; sc.More(); sc.Forward()) { - // remember the start position of the line - if (sc.atLineStart) { - posLineStart = sc.currentPos; - numNonBlank = 0; - sc.SetState(SCE_F_DEFAULT); - } - if (!IsASpaceOrTab(sc.ch)) numNonBlank ++; - /***********************************************/ - // Handle the fix format generically - int toLineStart = sc.currentPos - posLineStart; - if (isFixFormat && (toLineStart < 6 || toLineStart > 72)) { - if (toLineStart == 0 && (tolower(sc.ch) == 'c' || sc.ch == '*') || sc.ch == '!') { - sc.SetState(SCE_F_COMMENT); - while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end - } else if (toLineStart > 72) { - sc.SetState(SCE_F_COMMENT); - while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end - } else if (toLineStart < 5) { - if (IsADigit(sc.ch)) - sc.SetState(SCE_F_LABEL); - else - sc.SetState(SCE_F_DEFAULT); - } else if (toLineStart == 5) { - if (!IsASpace(sc.ch) && sc.ch != '0') { - sc.SetState(SCE_F_CONTINUATION); - sc.ForwardSetState(prevState); - } else - sc.SetState(SCE_F_DEFAULT); - } - continue; - } - /***************************************/ - // Handle line continuation generically. - if (!isFixFormat && sc.ch == '&') { - char chTemp = ' '; - int j = 1; - while (IsABlank(chTemp) && j<132) { - chTemp = static_cast(sc.GetRelative(j)); - j++; - } - if (chTemp == '!') { - sc.SetState(SCE_F_CONTINUATION); - if (sc.chNext == '!') sc.ForwardSetState(SCE_F_COMMENT); - } else if (chTemp == '\r' || chTemp == '\n') { - int currentState = sc.state; - sc.SetState(SCE_F_CONTINUATION); - sc.ForwardSetState(SCE_F_DEFAULT); - while (IsASpace(sc.ch) && sc.More()) sc.Forward(); - if (sc.ch == '&') { - sc.SetState(SCE_F_CONTINUATION); - sc.Forward(); - } - sc.SetState(currentState); - } - } - /***************************************/ - // Determine if the current state should terminate. - if (sc.state == SCE_F_OPERATOR) { - sc.SetState(SCE_F_DEFAULT); - } else if (sc.state == SCE_F_NUMBER) { - if (!(IsAWordChar(sc.ch) || sc.ch=='\'' || sc.ch=='\"' || sc.ch=='.')) { - sc.SetState(SCE_F_DEFAULT); - } - } else if (sc.state == SCE_F_IDENTIFIER) { - if (!IsAWordChar(sc.ch) || (sc.ch == '%')) { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - if (keywords.InList(s)) { - sc.ChangeState(SCE_F_WORD); - } else if (keywords2.InList(s)) { - sc.ChangeState(SCE_F_WORD2); - } else if (keywords3.InList(s)) { - sc.ChangeState(SCE_F_WORD3); - } - sc.SetState(SCE_F_DEFAULT); - } - } else if (sc.state == SCE_F_COMMENT || sc.state == SCE_F_PREPROCESSOR) { - if (sc.ch == '\r' || sc.ch == '\n') { - sc.SetState(SCE_F_DEFAULT); - } - } else if (sc.state == SCE_F_STRING1) { - prevState = sc.state; - if (sc.ch == '\'') { - if (sc.chNext == '\'') { - sc.Forward(); - } else { - sc.ForwardSetState(SCE_F_DEFAULT); - prevState = SCE_F_DEFAULT; - } - } else if (sc.atLineEnd) { - sc.ChangeState(SCE_F_STRINGEOL); - sc.ForwardSetState(SCE_F_DEFAULT); - } - } else if (sc.state == SCE_F_STRING2) { - prevState = sc.state; - if (sc.atLineEnd) { - sc.ChangeState(SCE_F_STRINGEOL); - sc.ForwardSetState(SCE_F_DEFAULT); - } else if (sc.ch == '\"') { - if (sc.chNext == '\"') { - sc.Forward(); - } else { - sc.ForwardSetState(SCE_F_DEFAULT); - prevState = SCE_F_DEFAULT; - } - } - } else if (sc.state == SCE_F_OPERATOR2) { - if (sc.ch == '.') { - sc.ForwardSetState(SCE_F_DEFAULT); - } - } else if (sc.state == SCE_F_CONTINUATION) { - sc.SetState(SCE_F_DEFAULT); - } else if (sc.state == SCE_F_LABEL) { - if (!IsADigit(sc.ch)) { - sc.SetState(SCE_F_DEFAULT); - } else { - if (isFixFormat && sc.currentPos-posLineStart > 4) - sc.SetState(SCE_F_DEFAULT); - else if (numNonBlank > 5) - sc.SetState(SCE_F_DEFAULT); - } - } - /***************************************/ - // Determine if a new state should be entered. - if (sc.state == SCE_F_DEFAULT) { - if (sc.ch == '!') { - if (sc.chNext == '$') { - sc.SetState(SCE_F_PREPROCESSOR); - } else { - sc.SetState(SCE_F_COMMENT); - } - } else if ((!isFixFormat) && IsADigit(sc.ch) && numNonBlank == 1) { - sc.SetState(SCE_F_LABEL); - } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { - sc.SetState(SCE_F_NUMBER); - } else if ((tolower(sc.ch) == 'b' || tolower(sc.ch) == 'o' || - tolower(sc.ch) == 'z') && (sc.chNext == '\"' || sc.chNext == '\'')) { - sc.SetState(SCE_F_NUMBER); - sc.Forward(); - } else if (sc.ch == '.' && isalpha(sc.chNext)) { - sc.SetState(SCE_F_OPERATOR2); - } else if (IsAWordStart(sc.ch)) { - sc.SetState(SCE_F_IDENTIFIER); - } else if (sc.ch == '\"') { - sc.SetState(SCE_F_STRING2); - } else if (sc.ch == '\'') { - sc.SetState(SCE_F_STRING1); - } else if (isoperator(static_cast(sc.ch))) { - sc.SetState(SCE_F_OPERATOR); - } - } - } - sc.Complete(); -} -/***************************************/ -// To determine the folding level depending on keywords -static int classifyFoldPointFortran(const char* s, const char* prevWord, const char chNextNonBlank) { - int lev = 0; - if ((strcmp(prevWord, "else") == 0 && strcmp(s, "if") == 0) || strcmp(s, "elseif") == 0) - return -1; - if (strcmp(s, "associate") == 0 || strcmp(s, "block") == 0 - || strcmp(s, "blockdata") == 0 || strcmp(s, "select") == 0 - || strcmp(s, "do") == 0 || strcmp(s, "enum") ==0 - || strcmp(s, "function") == 0 || strcmp(s, "interface") == 0 - || strcmp(s, "module") == 0 || strcmp(s, "program") == 0 - || strcmp(s, "subroutine") == 0 || strcmp(s, "then") == 0 - || (strcmp(s, "type") == 0 && chNextNonBlank != '(') ){ - if (strcmp(prevWord, "end") == 0) - lev = 0; - else - lev = 1; - } else if (strcmp(s, "end") == 0 && chNextNonBlank != '=' - || strcmp(s, "endassociate") == 0 || strcmp(s, "endblock") == 0 - || strcmp(s, "endblockdata") == 0 || strcmp(s, "endselect") == 0 - || strcmp(s, "enddo") == 0 || strcmp(s, "endenum") ==0 - || strcmp(s, "endif") == 0 || strcmp(s, "endforall") == 0 - || strcmp(s, "endfunction") == 0 || strcmp(s, "endinterface") == 0 - || strcmp(s, "endmodule") == 0 || strcmp(s, "endprogram") == 0 - || strcmp(s, "endsubroutine") == 0 || strcmp(s, "endtype") == 0 - || strcmp(s, "endwhere") == 0 - || strcmp(s, "procedure") == 0 ) { // Take care of the module procedure statement - lev = -1; - } else if (strcmp(prevWord, "end") == 0 && strcmp(s, "if") == 0){ // end if - lev = 0; - } - return lev; -} -// Folding the code -static void FoldFortranDoc(unsigned int startPos, int length, int initStyle, - Accessor &styler, bool isFixFormat) { - // - // bool foldComment = styler.GetPropertyInt("fold.comment") != 0; - // Do not know how to fold the comment at the moment. - // - bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - unsigned int endPos = startPos + length; - int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); - int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; - int levelCurrent = levelPrev; - char chNext = styler[startPos]; - char chNextNonBlank; - int styleNext = styler.StyleAt(startPos); - int style = initStyle; - /***************************************/ - int lastStart = 0; - char prevWord[32] = ""; - char Label[6] = ""; - // Variables for do label folding. - static int doLabels[100]; - static int posLabel=-1; - /***************************************/ - for (unsigned int i = startPos; i < endPos; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - chNextNonBlank = chNext; - unsigned int j=i+1; - while(IsABlank(chNextNonBlank) && j(tolower(styler[lastStart+k])); - } - s[k] = '\0'; - // Handle the forall and where statement and structure. - if (strcmp(s, "forall") == 0 || strcmp(s, "where") == 0) { - if (strcmp(prevWord, "end") != 0) { - j = i + 1; - char chBrace = '(', chSeek = ')', ch1 = styler.SafeGetCharAt(j); - // Find the position of the first ( - while (ch1 != chBrace && j -1) { - levelCurrent--; - posLabel--; - } - } - } - if (atEOL) { - int lev = levelPrev; - if (visibleChars == 0 && foldCompact) - lev |= SC_FOLDLEVELWHITEFLAG; - if ((levelCurrent > levelPrev) && (visibleChars > 0)) - lev |= SC_FOLDLEVELHEADERFLAG; - if (lev != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, lev); - } - lineCurrent++; - levelPrev = levelCurrent; - visibleChars = 0; - strcpy(prevWord, ""); - } - /***************************************/ - if (!isspacechar(ch)) visibleChars++; - } - /***************************************/ - // Fill in the real level of the next line, keeping the current flags as they will be filled in later - int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; - styler.SetLevel(lineCurrent, levelPrev | flagsNext); -} -/***************************************/ -static const char * const FortranWordLists[] = { - "Primary keywords and identifiers", - "Intrinsic functions", - "Extended and user defined functions", - 0, -}; -/***************************************/ -static void ColouriseFortranDocFreeFormat(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], - Accessor &styler) { - ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, false); -} -/***************************************/ -static void ColouriseFortranDocFixFormat(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], - Accessor &styler) { - ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, true); -} -/***************************************/ -static void FoldFortranDocFreeFormat(unsigned int startPos, int length, int initStyle, - WordList *[], Accessor &styler) { - FoldFortranDoc(startPos, length, initStyle,styler, false); -} -/***************************************/ -static void FoldFortranDocFixFormat(unsigned int startPos, int length, int initStyle, - WordList *[], Accessor &styler) { - FoldFortranDoc(startPos, length, initStyle,styler, true); -} -/***************************************/ -LexerModule lmFortran(SCLEX_FORTRAN, ColouriseFortranDocFreeFormat, "fortran", FoldFortranDocFreeFormat, FortranWordLists); -LexerModule lmF77(SCLEX_F77, ColouriseFortranDocFixFormat, "f77", FoldFortranDocFixFormat, FortranWordLists); +// Scintilla source code edit control +/** @file LexFortran.cxx + ** Lexer for Fortran. + ** Writen by Chuan-jian Shen, Last changed Sep. 2003 + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. +/***************************************/ +#include +#include +#include +#include +#include +/***************************************/ +#include "Platform.h" +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +/***********************************************/ +static inline bool IsAWordChar(const int ch) { + return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '%'); +} +/**********************************************/ +static inline bool IsAWordStart(const int ch) { + return (ch < 0x80) && (isalnum(ch)); +} +/***************************************/ +inline bool IsABlank(unsigned int ch) { + return (ch == ' ') || (ch == 0x09) || (ch == 0x0b) ; +} +/***************************************/ +inline bool IsALineEnd(char ch) { + return ((ch == '\n') || (ch == '\r')) ; +} +/***************************************/ +unsigned int GetContinuedPos(unsigned int pos, Accessor &styler) { + while (!IsALineEnd(styler.SafeGetCharAt(pos++))) continue; + if (styler.SafeGetCharAt(pos) == '\n') pos++; + while (IsABlank(styler.SafeGetCharAt(pos++))) continue; + char chCur = styler.SafeGetCharAt(pos); + if (chCur == '&') { + while (IsABlank(styler.SafeGetCharAt(++pos))) continue; + return pos; + } else { + return pos; + } +} +/***************************************/ +static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler, bool isFixFormat) { + WordList &keywords = *keywordlists[0]; + WordList &keywords2 = *keywordlists[1]; + WordList &keywords3 = *keywordlists[2]; + /***************************************/ + int posLineStart = 0, numNonBlank = 0, prevState = 0; + int endPos = startPos + length; + /***************************************/ + // backtrack to the nearest keyword + while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_F_WORD)) { + startPos--; + } + startPos = styler.LineStart(styler.GetLine(startPos)); + initStyle = styler.StyleAt(startPos - 1); + StyleContext sc(startPos, endPos-startPos, initStyle, styler); + /***************************************/ + for (; sc.More(); sc.Forward()) { + // remember the start position of the line + if (sc.atLineStart) { + posLineStart = sc.currentPos; + numNonBlank = 0; + sc.SetState(SCE_F_DEFAULT); + } + if (!IsASpaceOrTab(sc.ch)) numNonBlank ++; + /***********************************************/ + // Handle the fix format generically + int toLineStart = sc.currentPos - posLineStart; + if (isFixFormat && (toLineStart < 6 || toLineStart > 72)) { + if ((toLineStart == 0 && (tolower(sc.ch) == 'c' || sc.ch == '*')) || sc.ch == '!') { + if (sc.MatchIgnoreCase("cdec$") || sc.MatchIgnoreCase("*dec$") || sc.MatchIgnoreCase("!dec$") || + sc.MatchIgnoreCase("cdir$") || sc.MatchIgnoreCase("*dir$") || sc.MatchIgnoreCase("!dir$") || + sc.MatchIgnoreCase("cms$") || sc.MatchIgnoreCase("*ms$") || sc.MatchIgnoreCase("!ms$") || + sc.chNext == '$') { + sc.SetState(SCE_F_PREPROCESSOR); + } else { + sc.SetState(SCE_F_COMMENT); + } + + while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end + } else if (toLineStart > 72) { + sc.SetState(SCE_F_COMMENT); + while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end + } else if (toLineStart < 5) { + if (IsADigit(sc.ch)) + sc.SetState(SCE_F_LABEL); + else + sc.SetState(SCE_F_DEFAULT); + } else if (toLineStart == 5) { + if (!IsASpace(sc.ch) && sc.ch != '0') { + sc.SetState(SCE_F_CONTINUATION); + sc.ForwardSetState(prevState); + } else + sc.SetState(SCE_F_DEFAULT); + } + continue; + } + /***************************************/ + // Handle line continuation generically. + if (!isFixFormat && sc.ch == '&') { + char chTemp = ' '; + int j = 1; + while (IsABlank(chTemp) && j<132) { + chTemp = static_cast(sc.GetRelative(j)); + j++; + } + if (chTemp == '!') { + sc.SetState(SCE_F_CONTINUATION); + if (sc.chNext == '!') sc.ForwardSetState(SCE_F_COMMENT); + } else if (chTemp == '\r' || chTemp == '\n') { + int currentState = sc.state; + sc.SetState(SCE_F_CONTINUATION); + sc.ForwardSetState(SCE_F_DEFAULT); + while (IsASpace(sc.ch) && sc.More()) sc.Forward(); + if (sc.ch == '&') { + sc.SetState(SCE_F_CONTINUATION); + sc.Forward(); + } + sc.SetState(currentState); + } + } + /***************************************/ + // Determine if the current state should terminate. + if (sc.state == SCE_F_OPERATOR) { + sc.SetState(SCE_F_DEFAULT); + } else if (sc.state == SCE_F_NUMBER) { + if (!(IsAWordChar(sc.ch) || sc.ch=='\'' || sc.ch=='\"' || sc.ch=='.')) { + sc.SetState(SCE_F_DEFAULT); + } + } else if (sc.state == SCE_F_IDENTIFIER) { + if (!IsAWordChar(sc.ch) || (sc.ch == '%')) { + char s[100]; + sc.GetCurrentLowered(s, sizeof(s)); + if (keywords.InList(s)) { + sc.ChangeState(SCE_F_WORD); + } else if (keywords2.InList(s)) { + sc.ChangeState(SCE_F_WORD2); + } else if (keywords3.InList(s)) { + sc.ChangeState(SCE_F_WORD3); + } + sc.SetState(SCE_F_DEFAULT); + } + } else if (sc.state == SCE_F_COMMENT || sc.state == SCE_F_PREPROCESSOR) { + if (sc.ch == '\r' || sc.ch == '\n') { + sc.SetState(SCE_F_DEFAULT); + } + } else if (sc.state == SCE_F_STRING1) { + prevState = sc.state; + if (sc.ch == '\'') { + if (sc.chNext == '\'') { + sc.Forward(); + } else { + sc.ForwardSetState(SCE_F_DEFAULT); + prevState = SCE_F_DEFAULT; + } + } else if (sc.atLineEnd) { + sc.ChangeState(SCE_F_STRINGEOL); + sc.ForwardSetState(SCE_F_DEFAULT); + } + } else if (sc.state == SCE_F_STRING2) { + prevState = sc.state; + if (sc.atLineEnd) { + sc.ChangeState(SCE_F_STRINGEOL); + sc.ForwardSetState(SCE_F_DEFAULT); + } else if (sc.ch == '\"') { + if (sc.chNext == '\"') { + sc.Forward(); + } else { + sc.ForwardSetState(SCE_F_DEFAULT); + prevState = SCE_F_DEFAULT; + } + } + } else if (sc.state == SCE_F_OPERATOR2) { + if (sc.ch == '.') { + sc.ForwardSetState(SCE_F_DEFAULT); + } + } else if (sc.state == SCE_F_CONTINUATION) { + sc.SetState(SCE_F_DEFAULT); + } else if (sc.state == SCE_F_LABEL) { + if (!IsADigit(sc.ch)) { + sc.SetState(SCE_F_DEFAULT); + } else { + if (isFixFormat && sc.currentPos-posLineStart > 4) + sc.SetState(SCE_F_DEFAULT); + else if (numNonBlank > 5) + sc.SetState(SCE_F_DEFAULT); + } + } + /***************************************/ + // Determine if a new state should be entered. + if (sc.state == SCE_F_DEFAULT) { + if (sc.ch == '!') { + if (sc.MatchIgnoreCase("!dec$") || sc.MatchIgnoreCase("!dir$") || + sc.MatchIgnoreCase("!ms$") || sc.chNext == '$') { + sc.SetState(SCE_F_PREPROCESSOR); + } else { + sc.SetState(SCE_F_COMMENT); + } + } else if ((!isFixFormat) && IsADigit(sc.ch) && numNonBlank == 1) { + sc.SetState(SCE_F_LABEL); + } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { + sc.SetState(SCE_F_NUMBER); + } else if ((tolower(sc.ch) == 'b' || tolower(sc.ch) == 'o' || + tolower(sc.ch) == 'z') && (sc.chNext == '\"' || sc.chNext == '\'')) { + sc.SetState(SCE_F_NUMBER); + sc.Forward(); + } else if (sc.ch == '.' && isalpha(sc.chNext)) { + sc.SetState(SCE_F_OPERATOR2); + } else if (IsAWordStart(sc.ch)) { + sc.SetState(SCE_F_IDENTIFIER); + } else if (sc.ch == '\"') { + sc.SetState(SCE_F_STRING2); + } else if (sc.ch == '\'') { + sc.SetState(SCE_F_STRING1); + } else if (isoperator(static_cast(sc.ch))) { + sc.SetState(SCE_F_OPERATOR); + } + } + } + sc.Complete(); +} +/***************************************/ +// To determine the folding level depending on keywords +static int classifyFoldPointFortran(const char* s, const char* prevWord, const char chNextNonBlank) { + int lev = 0; + if ((strcmp(prevWord, "else") == 0 && strcmp(s, "if") == 0) || strcmp(s, "elseif") == 0) + return -1; + if (strcmp(s, "associate") == 0 || strcmp(s, "block") == 0 + || strcmp(s, "blockdata") == 0 || strcmp(s, "select") == 0 + || strcmp(s, "do") == 0 || strcmp(s, "enum") ==0 + || strcmp(s, "function") == 0 || strcmp(s, "interface") == 0 + || strcmp(s, "module") == 0 || strcmp(s, "program") == 0 + || strcmp(s, "subroutine") == 0 || strcmp(s, "then") == 0 + || (strcmp(s, "type") == 0 && chNextNonBlank != '(') ){ + if (strcmp(prevWord, "end") == 0) + lev = 0; + else + lev = 1; + } else if ((strcmp(s, "end") == 0 && chNextNonBlank != '=') + || strcmp(s, "endassociate") == 0 || strcmp(s, "endblock") == 0 + || strcmp(s, "endblockdata") == 0 || strcmp(s, "endselect") == 0 + || strcmp(s, "enddo") == 0 || strcmp(s, "endenum") ==0 + || strcmp(s, "endif") == 0 || strcmp(s, "endforall") == 0 + || strcmp(s, "endfunction") == 0 || strcmp(s, "endinterface") == 0 + || strcmp(s, "endmodule") == 0 || strcmp(s, "endprogram") == 0 + || strcmp(s, "endsubroutine") == 0 || strcmp(s, "endtype") == 0 + || strcmp(s, "endwhere") == 0 + || strcmp(s, "procedure") == 0 ) { // Take care of the module procedure statement + lev = -1; + } else if (strcmp(prevWord, "end") == 0 && strcmp(s, "if") == 0){ // end if + lev = 0; + } + return lev; +} +// Folding the code +static void FoldFortranDoc(unsigned int startPos, int length, int initStyle, + Accessor &styler, bool isFixFormat) { + // + // bool foldComment = styler.GetPropertyInt("fold.comment") != 0; + // Do not know how to fold the comment at the moment. + // + bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + unsigned int endPos = startPos + length; + int visibleChars = 0; + int lineCurrent = styler.GetLine(startPos); + int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; + int levelCurrent = levelPrev; + char chNext = styler[startPos]; + char chNextNonBlank; + int styleNext = styler.StyleAt(startPos); + int style = initStyle; + /***************************************/ + int lastStart = 0; + char prevWord[32] = ""; + char Label[6] = ""; + // Variables for do label folding. + static int doLabels[100]; + static int posLabel=-1; + /***************************************/ + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + chNextNonBlank = chNext; + unsigned int j=i+1; + while(IsABlank(chNextNonBlank) && j(tolower(styler[lastStart+k])); + } + s[k] = '\0'; + // Handle the forall and where statement and structure. + if (strcmp(s, "forall") == 0 || strcmp(s, "where") == 0) { + if (strcmp(prevWord, "end") != 0) { + j = i + 1; + char chBrace = '(', chSeek = ')', ch1 = styler.SafeGetCharAt(j); + // Find the position of the first ( + while (ch1 != chBrace && j -1) { + levelCurrent--; + posLabel--; + } + } + } + if (atEOL) { + int lev = levelPrev; + if (visibleChars == 0 && foldCompact) + lev |= SC_FOLDLEVELWHITEFLAG; + if ((levelCurrent > levelPrev) && (visibleChars > 0)) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + lineCurrent++; + levelPrev = levelCurrent; + visibleChars = 0; + strcpy(prevWord, ""); + } + /***************************************/ + if (!isspacechar(ch)) visibleChars++; + } + /***************************************/ + // Fill in the real level of the next line, keeping the current flags as they will be filled in later + int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; + styler.SetLevel(lineCurrent, levelPrev | flagsNext); +} +/***************************************/ +static const char * const FortranWordLists[] = { + "Primary keywords and identifiers", + "Intrinsic functions", + "Extended and user defined functions", + 0, +}; +/***************************************/ +static void ColouriseFortranDocFreeFormat(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], + Accessor &styler) { + ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, false); +} +/***************************************/ +static void ColouriseFortranDocFixFormat(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], + Accessor &styler) { + ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, true); +} +/***************************************/ +static void FoldFortranDocFreeFormat(unsigned int startPos, int length, int initStyle, + WordList *[], Accessor &styler) { + FoldFortranDoc(startPos, length, initStyle,styler, false); +} +/***************************************/ +static void FoldFortranDocFixFormat(unsigned int startPos, int length, int initStyle, + WordList *[], Accessor &styler) { + FoldFortranDoc(startPos, length, initStyle,styler, true); +} +/***************************************/ +LexerModule lmFortran(SCLEX_FORTRAN, ColouriseFortranDocFreeFormat, "fortran", FoldFortranDocFreeFormat, FortranWordLists); +LexerModule lmF77(SCLEX_F77, ColouriseFortranDocFixFormat, "f77", FoldFortranDocFixFormat, FortranWordLists); diff --git a/sdk/wxscintilla/src/scintilla/src/LexGAP.cxx b/sdk/wxscintilla/src/scintilla/src/LexGAP.cxx index bec53b7d01..25bd33b900 100644 --- a/sdk/wxscintilla/src/scintilla/src/LexGAP.cxx +++ b/sdk/wxscintilla/src/scintilla/src/LexGAP.cxx @@ -1,263 +1,263 @@ -// Scintilla source code edit control -/** @file LexGAP.cxx - ** Lexer for the GAP language. (The GAP System for Computational Discrete Algebra) - ** http://www.gap-system.org - **/ -// Copyright 2007 by Istvan Szollosi ( szteven gmail com ) -// The License.txt file describes the conditions under which this software may be distributed. - -#include -#include -#include -#include -#include - -#include "Platform.h" - -#include "PropSet.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "KeyWords.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#ifdef SCI_NAMESPACE -using namespace Scintilla; -#endif - -static inline bool IsGAPOperator(char ch) { - if (isalnum(ch)) return false; - if (ch == '+' || ch == '-' || ch == '*' || ch == '/' || - ch == '^' || ch == ',' || ch == '!' || ch == '.' || - ch == '=' || ch == '<' || ch == '>' || ch == '(' || - ch == ')' || ch == ';' || ch == '[' || ch == ']' || - ch == '{' || ch == '}' || ch == ':' ) - return true; - return false; -} - -static void GetRange(unsigned int start, unsigned int end, Accessor &styler, char *s, unsigned int len) { - unsigned int i = 0; - while ((i < end - start + 1) && (i < len-1)) { - s[i] = static_cast(styler[start + i]); - i++; - } - s[i] = '\0'; -} - -static void ColouriseGAPDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { - - WordList &keywords1 = *keywordlists[0]; - WordList &keywords2 = *keywordlists[1]; - WordList &keywords3 = *keywordlists[2]; - WordList &keywords4 = *keywordlists[3]; - - // Do not leak onto next line - if (initStyle == SCE_GAP_STRINGEOL) initStyle = SCE_GAP_DEFAULT; - - StyleContext sc(startPos, length, initStyle, styler); - - for (; sc.More(); sc.Forward()) { - - // Prevent SCE_GAP_STRINGEOL from leaking back to previous line - if ( sc.atLineStart ) { - if (sc.state == SCE_GAP_STRING) sc.SetState(SCE_GAP_STRING); - if (sc.state == SCE_GAP_CHAR) sc.SetState(SCE_GAP_CHAR); - } - - // Handle line continuation generically - if (sc.ch == '\\' ) { - if (sc.chNext == '\n' || sc.chNext == '\r') { - sc.Forward(); - if (sc.ch == '\r' && sc.chNext == '\n') { - sc.Forward(); - } - continue; - } - } - - // Determine if the current state should terminate - switch (sc.state) { - case SCE_GAP_OPERATOR : - sc.SetState(SCE_GAP_DEFAULT); - break; - - case SCE_GAP_NUMBER : - if (!IsADigit(sc.ch)) { - if (sc.ch == '\\') { - if (!sc.atLineEnd) { - if (!IsADigit(sc.chNext)) { - sc.Forward(); - sc.ChangeState(SCE_GAP_IDENTIFIER); - } - } - } else if (isalpha(sc.ch) || sc.ch == '_') { - sc.ChangeState(SCE_GAP_IDENTIFIER); - } - else sc.SetState(SCE_GAP_DEFAULT); - } - break; - - case SCE_GAP_IDENTIFIER : - if (!(iswordstart(static_cast(sc.ch)) || sc.ch == '$')) { - if (sc.ch == '\\') sc.Forward(); - else { - char s[1000]; - sc.GetCurrent(s, sizeof(s)); - if (keywords1.InList(s)) { - sc.ChangeState(SCE_GAP_KEYWORD); - } else if (keywords2.InList(s)) { - sc.ChangeState(SCE_GAP_KEYWORD2); - } else if (keywords3.InList(s)) { - sc.ChangeState(SCE_GAP_KEYWORD3); - } else if (keywords4.InList(s)) { - sc.ChangeState(SCE_GAP_KEYWORD4); - } - sc.SetState(SCE_GAP_DEFAULT); - } - } - break; - - case SCE_GAP_COMMENT : - if (sc.atLineEnd) { - sc.SetState(SCE_GAP_DEFAULT); - } - break; - - case SCE_GAP_STRING: - if (sc.atLineEnd) { - sc.ChangeState(SCE_GAP_STRINGEOL); - } else if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\"') { - sc.ForwardSetState(SCE_GAP_DEFAULT); - } - break; - - case SCE_GAP_CHAR: - if (sc.atLineEnd) { - sc.ChangeState(SCE_GAP_STRINGEOL); - } else if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\'') { - sc.ForwardSetState(SCE_GAP_DEFAULT); - } - break; - - case SCE_GAP_STRINGEOL: - if (sc.atLineStart) { - sc.SetState(SCE_GAP_DEFAULT); - } - break; - } - - // Determine if a new state should be entered - if (sc.state == SCE_GAP_DEFAULT) { - if (IsGAPOperator(static_cast(sc.ch))) { - sc.SetState(SCE_GAP_OPERATOR); - } - else if (IsADigit(sc.ch)) { - sc.SetState(SCE_GAP_NUMBER); - } else if (isalpha(sc.ch) || sc.ch == '_' || sc.ch == '\\' || sc.ch == '$' || sc.ch == '~') { - sc.SetState(SCE_GAP_IDENTIFIER); - if (sc.ch == '\\') sc.Forward(); - } else if (sc.ch == '#') { - sc.SetState(SCE_GAP_COMMENT); - } else if (sc.ch == '\"') { - sc.SetState(SCE_GAP_STRING); - } else if (sc.ch == '\'') { - sc.SetState(SCE_GAP_CHAR); - } - } - - } - sc.Complete(); -} - -static int ClassifyFoldPointGAP(const char* s) { - int level = 0; - if (strcmp(s, "function") == 0 || - strcmp(s, "do") == 0 || - strcmp(s, "if") == 0 || - strcmp(s, "repeat") == 0 ) { - level = 1; - } else if (strcmp(s, "end") == 0 || - strcmp(s, "od") == 0 || - strcmp(s, "fi") == 0 || - strcmp(s, "until") == 0 ) { - level = -1; - } - return level; -} - -static void FoldGAPDoc( unsigned int startPos, int length, int initStyle, WordList** , Accessor &styler) { - unsigned int endPos = startPos + length; - int visibleChars = 0; - int lineCurrent = styler.GetLine(startPos); - int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; - int levelCurrent = levelPrev; - char chNext = styler[startPos]; - int styleNext = styler.StyleAt(startPos); - int style = initStyle; - - int lastStart = 0; - - for (unsigned int i = startPos; i < endPos; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - int stylePrev = style; - style = styleNext; - styleNext = styler.StyleAt(i + 1); - bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - - if (stylePrev != SCE_GAP_KEYWORD && style == SCE_GAP_KEYWORD) { - // Store last word start point. - lastStart = i; - } - - if (stylePrev == SCE_GAP_KEYWORD) { - if(iswordchar(ch) && !iswordchar(chNext)) { - char s[100]; - GetRange(lastStart, i, styler, s, sizeof(s)); - levelCurrent += ClassifyFoldPointGAP(s); - } - } - - if (atEOL) { - int lev = levelPrev; - if ((levelCurrent > levelPrev) && (visibleChars > 0)) - lev |= SC_FOLDLEVELHEADERFLAG; - if (lev != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, lev); - } - lineCurrent++; - levelPrev = levelCurrent; - visibleChars = 0; - } - - if (!isspacechar(ch)) - visibleChars++; - } - - int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; - styler.SetLevel(lineCurrent, levelPrev | flagsNext); -} - -static const char * const GAPWordListDesc[] = { - "Keywords 1", - "Keywords 2", - "Keywords 3 (unused)", - "Keywords 4 (unused)", - 0 -}; - -LexerModule lmGAP( - SCLEX_GAP, - ColouriseGAPDoc, - "gap", - FoldGAPDoc, - GAPWordListDesc); +// Scintilla source code edit control +/** @file LexGAP.cxx + ** Lexer for the GAP language. (The GAP System for Computational Discrete Algebra) + ** http://www.gap-system.org + **/ +// Copyright 2007 by Istvan Szollosi ( szteven gmail com ) +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include + +#include "Platform.h" + +#include "PropSet.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "KeyWords.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +static inline bool IsGAPOperator(char ch) { + if (isalnum(ch)) return false; + if (ch == '+' || ch == '-' || ch == '*' || ch == '/' || + ch == '^' || ch == ',' || ch == '!' || ch == '.' || + ch == '=' || ch == '<' || ch == '>' || ch == '(' || + ch == ')' || ch == ';' || ch == '[' || ch == ']' || + ch == '{' || ch == '}' || ch == ':' ) + return true; + return false; +} + +static void GetRange(unsigned int start, unsigned int end, Accessor &styler, char *s, unsigned int len) { + unsigned int i = 0; + while ((i < end - start + 1) && (i < len-1)) { + s[i] = static_cast(styler[start + i]); + i++; + } + s[i] = '\0'; +} + +static void ColouriseGAPDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { + + WordList &keywords1 = *keywordlists[0]; + WordList &keywords2 = *keywordlists[1]; + WordList &keywords3 = *keywordlists[2]; + WordList &keywords4 = *keywordlists[3]; + + // Do not leak onto next line + if (initStyle == SCE_GAP_STRINGEOL) initStyle = SCE_GAP_DEFAULT; + + StyleContext sc(startPos, length, initStyle, styler); + + for (; sc.More(); sc.Forward()) { + + // Prevent SCE_GAP_STRINGEOL from leaking back to previous line + if ( sc.atLineStart ) { + if (sc.state == SCE_GAP_STRING) sc.SetState(SCE_GAP_STRING); + if (sc.state == SCE_GAP_CHAR) sc.SetState(SCE_GAP_CHAR); + } + + // Handle line continuation generically + if (sc.ch == '\\' ) { + if (sc.chNext == '\n' || sc.chNext == '\r') { + sc.Forward(); + if (sc.ch == '\r' && sc.chNext == '\n') { + sc.Forward(); + } + continue; + } + } + + // Determine if the current state should terminate + switch (sc.state) { + case SCE_GAP_OPERATOR : + sc.SetState(SCE_GAP_DEFAULT); + break; + + case SCE_GAP_NUMBER : + if (!IsADigit(sc.ch)) { + if (sc.ch == '\\') { + if (!sc.atLineEnd) { + if (!IsADigit(sc.chNext)) { + sc.Forward(); + sc.ChangeState(SCE_GAP_IDENTIFIER); + } + } + } else if (isalpha(sc.ch) || sc.ch == '_') { + sc.ChangeState(SCE_GAP_IDENTIFIER); + } + else sc.SetState(SCE_GAP_DEFAULT); + } + break; + + case SCE_GAP_IDENTIFIER : + if (!(iswordstart(static_cast(sc.ch)) || sc.ch == '$')) { + if (sc.ch == '\\') sc.Forward(); + else { + char s[1000]; + sc.GetCurrent(s, sizeof(s)); + if (keywords1.InList(s)) { + sc.ChangeState(SCE_GAP_KEYWORD); + } else if (keywords2.InList(s)) { + sc.ChangeState(SCE_GAP_KEYWORD2); + } else if (keywords3.InList(s)) { + sc.ChangeState(SCE_GAP_KEYWORD3); + } else if (keywords4.InList(s)) { + sc.ChangeState(SCE_GAP_KEYWORD4); + } + sc.SetState(SCE_GAP_DEFAULT); + } + } + break; + + case SCE_GAP_COMMENT : + if (sc.atLineEnd) { + sc.SetState(SCE_GAP_DEFAULT); + } + break; + + case SCE_GAP_STRING: + if (sc.atLineEnd) { + sc.ChangeState(SCE_GAP_STRINGEOL); + } else if (sc.ch == '\\') { + if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\"') { + sc.ForwardSetState(SCE_GAP_DEFAULT); + } + break; + + case SCE_GAP_CHAR: + if (sc.atLineEnd) { + sc.ChangeState(SCE_GAP_STRINGEOL); + } else if (sc.ch == '\\') { + if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { + sc.Forward(); + } + } else if (sc.ch == '\'') { + sc.ForwardSetState(SCE_GAP_DEFAULT); + } + break; + + case SCE_GAP_STRINGEOL: + if (sc.atLineStart) { + sc.SetState(SCE_GAP_DEFAULT); + } + break; + } + + // Determine if a new state should be entered + if (sc.state == SCE_GAP_DEFAULT) { + if (IsGAPOperator(static_cast(sc.ch))) { + sc.SetState(SCE_GAP_OPERATOR); + } + else if (IsADigit(sc.ch)) { + sc.SetState(SCE_GAP_NUMBER); + } else if (isalpha(sc.ch) || sc.ch == '_' || sc.ch == '\\' || sc.ch == '$' || sc.ch == '~') { + sc.SetState(SCE_GAP_IDENTIFIER); + if (sc.ch == '\\') sc.Forward(); + } else if (sc.ch == '#') { + sc.SetState(SCE_GAP_COMMENT); + } else if (sc.ch == '\"') { + sc.SetState(SCE_GAP_STRING); + } else if (sc.ch == '\'') { + sc.SetState(SCE_GAP_CHAR); + } + } + + } + sc.Complete(); +} + +static int ClassifyFoldPointGAP(const char* s) { + int level = 0; + if (strcmp(s, "function") == 0 || + strcmp(s, "do") == 0 || + strcmp(s, "if") == 0 || + strcmp(s, "repeat") == 0 ) { + level = 1; + } else if (strcmp(s, "end") == 0 || + strcmp(s, "od") == 0 || + strcmp(s, "fi") == 0 || + strcmp(s, "until") == 0 ) { + level = -1; + } + return level; +} + +static void FoldGAPDoc( unsigned int startPos, int length, int initStyle, WordList** , Accessor &styler) { + unsigned int endPos = startPos + length; + int visibleChars = 0; + int lineCurrent = styler.GetLine(startPos); + int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; + int levelCurrent = levelPrev; + char chNext = styler[startPos]; + int styleNext = styler.StyleAt(startPos); + int style = initStyle; + + int lastStart = 0; + + for (unsigned int i = startPos; i < endPos; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + int stylePrev = style; + style = styleNext; + styleNext = styler.StyleAt(i + 1); + bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); + + if (stylePrev != SCE_GAP_KEYWORD && style == SCE_GAP_KEYWORD) { + // Store last word start point. + lastStart = i; + } + + if (stylePrev == SCE_GAP_KEYWORD) { + if(iswordchar(ch) && !iswordchar(chNext)) { + char s[100]; + GetRange(lastStart, i, styler, s, sizeof(s)); + levelCurrent += ClassifyFoldPointGAP(s); + } + } + + if (atEOL) { + int lev = levelPrev; + if ((levelCurrent > levelPrev) && (visibleChars > 0)) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + lineCurrent++; + levelPrev = levelCurrent; + visibleChars = 0; + } + + if (!isspacechar(ch)) + visibleChars++; + } + + int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; + styler.SetLevel(lineCurrent, levelPrev | flagsNext); +} + +static const char * const GAPWordListDesc[] = { + "Keywords 1", + "Keywords 2", + "Keywords 3 (unused)", + "Keywords 4 (unused)", + 0 +}; + +LexerModule lmGAP( + SCLEX_GAP, + ColouriseGAPDoc, + "gap", + FoldGAPDoc, + GAPWordListDesc); diff --git a/sdk/wxscintilla/src/scintilla/src/LexGen.py b/sdk/wxscintilla/src/scintilla/src/LexGen.py index f204fcba05..571332e6e3 100644 --- a/sdk/wxscintilla/src/scintilla/src/LexGen.py +++ b/sdk/wxscintilla/src/scintilla/src/LexGen.py @@ -1,244 +1,288 @@ -# LexGen.py - implemented 2002 by Neil Hodgson neilh@scintilla.org -# Released to the public domain. - -# Regenerate the Scintilla and SciTE source files that list -# all the lexers and all the properties files. -# Should be run whenever a new lexer is added or removed. -# Requires Python 2.4 or later -# Most files are regenerated in place with templates stored in comments. -# The VS .NET project file is generated into a different file as the -# VS .NET environment will not retain comments when modifying the file. -# The files are copied to a string apart from sections between a -# ++Autogenerated comment and a --Autogenerated comment which is -# generated by the CopyWithInsertion function. After the whole -# string is instantiated, it is compared with the target file and -# if different the file is rewritten. -# Does not regenerate the Visual C++ 6 project files but does the VS .NET -# project file. - -import string -import sys -import os -import glob - -# EOL constants -CR = "\r" -LF = "\n" -CRLF = "\r\n" -if sys.platform == "win32": - NATIVE = CRLF -else: - # Yes, LF is the native EOL even on Mac OS X. CR is just for - # Mac OS <=9 (a.k.a. "Mac Classic") - NATIVE = LF - -# Automatically generated sections contain start and end comments, -# a definition line and the results. -# The results are replaced by regenerating based on the definition line. -# The definition line is a comment prefix followed by "**". -# If there is a digit after the ** then this indicates which list to use -# and the digit and next character are not part of the definition -# Backslash is used as an escape within the definition line. -# The part between \( and \) is repeated for each item in the list. -# \* is replaced by each list item. \t, and \n are tab and newline. -def CopyWithInsertion(input, commentPrefix, retainDefs, eolType, *lists): - copying = 1 - listid = 0 - output = [] - for line in input.splitlines(0): - isStartGenerated = line.startswith(commentPrefix + "++Autogenerated") - if copying and not isStartGenerated: - output.append(line) - if isStartGenerated: - if retainDefs: - output.append(line) - copying = 0 - definition = "" - elif not copying and line.startswith(commentPrefix + "**"): - if retainDefs: - output.append(line) - definition = line[len(commentPrefix + "**"):] - listid = 0 - if definition[0] in string.digits: - listid = int(definition[:1]) - definition = definition[2:] - # Hide double slashes as a control character - definition = definition.replace("\\\\", "\001") - # Do some normal C style transforms - definition = definition.replace("\\n", "\n") - definition = definition.replace("\\t", "\t") - # Get the doubled backslashes back as single backslashes - definition = definition.replace("\001", "\\") - startRepeat = definition.find("\\(") - endRepeat = definition.find("\\)") - intro = definition[:startRepeat] - out = "" - if intro.endswith("\n"): - pos = 0 - else: - pos = len(intro) - out += intro - middle = definition[startRepeat+2:endRepeat] - for i in lists[listid]: - item = middle.replace("\\*", i) - if pos and (pos + len(item) >= 80): - out += "\\\n" - pos = 0 - out += item - pos += len(item) - if item.endswith("\n"): - pos = 0 - outro = definition[endRepeat+2:] - out += outro - out = out.replace("\n", eolType) # correct EOLs in generated content - output.append(out) - elif line.startswith(commentPrefix + "--Autogenerated"): - copying = 1 - if retainDefs: - output.append(line) - output = [line.rstrip(" \t") for line in output] # trim trailing whitespace - return eolType.join(output) + eolType - -def UpdateFile(filename, updated): - """ If the file is different to updated then copy updated - into the file else leave alone so CVS and make don't treat - it as modified. """ - try: - infile = open(filename, "rb") - except IOError: # File is not there yet - out = open(filename, "wb") - out.write(updated) - out.close() - print "New", filename - return - original = infile.read() - infile.close() - if updated != original: - os.unlink(filename) - out = open(filename, "wb") - out.write(updated) - out.close() - print "Changed", filename - #~ else: - #~ print "Unchanged", filename - -def Generate(inpath, outpath, commentPrefix, eolType, *lists): - """Generate 'outpath' from 'inpath'. - - "eolType" indicates the type of EOLs to use in the generated - file. It should be one of following constants: LF, CRLF, - CR, or NATIVE. - """ - #print "generate '%s' -> '%s' (comment prefix: %r, eols: %r)"\ - # % (inpath, outpath, commentPrefix, eolType) - try: - infile = open(inpath, "r") - except IOError: - print "Can not open", inpath - return - original = infile.read() - infile.close() - updated = CopyWithInsertion(original, commentPrefix, - inpath == outpath, eolType, *lists) - UpdateFile(outpath, updated) - -def Regenerate(filename, commentPrefix, eolType, *lists): - """Regenerate the given file. - - "eolType" indicates the type of EOLs to use in the generated - file. It should be one of following constants: LF, CRLF, - CR, or NATIVE. - """ - Generate(filename, filename, commentPrefix, eolType, *lists) - -def FindModules(lexFile): - modules = [] - f = open(lexFile) - for l in f.readlines(): - if l.startswith("LexerModule"): - l = l.replace("(", " ") - modules.append(l.split()[1]) - return modules - -knownIrregularProperties = [ - "fold", - "styling.within.preprocessor", - "tab.timmy.whinge.level", - "asp.default.language", - "html.tags.case.sensitive", - "ps.level", - "ps.tokenize", - "sql.backslash.escapes", - "nsis.uservars", - "nsis.ignorecase" -] - -def FindProperties(lexFile): - properties = set() - f = open(lexFile) - for l in f.readlines(): - if "GetProperty" in l: - l = l.strip() - if not l.startswith("//"): # Drop comments - propertyName = l.split("\"")[1] - if propertyName.lower() == propertyName: - # Only allow lower case property names - if propertyName in knownIrregularProperties or \ - propertyName.startswith("fold.") or \ - propertyName.startswith("lexer."): - properties.add(propertyName) - return properties - -def ciCompare(a,b): - return cmp(a.lower(), b.lower()) - -def RegenerateAll(): - root="../../" - - # Find all the lexer source code files - lexFilePaths = glob.glob(root + "scintilla/src/Lex*.cxx") - lexFiles = [os.path.basename(f)[:-4] for f in lexFilePaths] - print lexFiles - lexerModules = [] - lexerProperties = set() - for lexFile in lexFilePaths: - lexerModules.extend(FindModules(lexFile)) - lexerProperties.update(FindProperties(lexFile)) - lexerModules.sort(ciCompare) - lexerProperties.remove("fold.comment.python") - lexerProperties = list(lexerProperties) - lexerProperties.sort(ciCompare) - - # Find all the SciTE properties files - otherProps = ["abbrev.properties", "Embedded.properties", "SciTEGlobal.properties", "SciTE.properties"] - if os.path.exists(root + "scite"): - propFilePaths = glob.glob(root + "scite/src/*.properties") - propFiles = [os.path.basename(f) for f in propFilePaths if os.path.basename(f) not in otherProps] - propFiles.sort(ciCompare) - print propFiles - - # Find all the menu command IDs in the SciTE header - SciTEHeader = file(root + "scite/src/SciTE.h") - lines = SciTEHeader.read().split("\n") - SciTEHeader.close() - ids = [id for id in [l.split()[1] for l in lines if l.startswith("#define")] if id.startswith("IDM_")] - #print ids - - Regenerate(root + "scintilla/src/KeyWords.cxx", "//", NATIVE, lexerModules) - Regenerate(root + "scintilla/win32/makefile", "#", NATIVE, lexFiles) - Regenerate(root + "scintilla/win32/scintilla.mak", "#", NATIVE, lexFiles) - Regenerate(root + "scintilla/win32/scintilla_vc6.mak", "#", NATIVE, lexFiles) - # Use Unix EOLs for gtk Makefiles so they work for Linux users when - # extracted from the Scintilla source ZIP (typically created on - # Windows). - Regenerate(root + "scintilla/gtk/makefile", "#", LF, lexFiles) - Regenerate(root + "scintilla/gtk/scintilla.mak", "#", NATIVE, lexFiles) - Regenerate(root + "scintilla/macosx/makefile", "#", LF, lexFiles) - if os.path.exists(root + "scite"): - Regenerate(root + "scite/win32/makefile", "#", NATIVE, lexFiles, propFiles) - Regenerate(root + "scite/win32/scite.mak", "#", NATIVE, lexFiles, propFiles) - Regenerate(root + "scite/src/SciTEProps.cxx", "//", NATIVE, lexerProperties, ids) - Generate(root + "scite/boundscheck/vcproj.gen", - root + "scite/boundscheck/SciTE.vcproj", "#", NATIVE, lexFiles) - -RegenerateAll() +# LexGen.py - implemented 2002 by Neil Hodgson neilh@scintilla.org +# Released to the public domain. + +# Regenerate the Scintilla and SciTE source files that list +# all the lexers and all the properties files. +# Should be run whenever a new lexer is added or removed. +# Requires Python 2.4 or later +# Most files are regenerated in place with templates stored in comments. +# The VS .NET project file is generated into a different file as the +# VS .NET environment will not retain comments when modifying the file. +# The files are copied to a string apart from sections between a +# ++Autogenerated comment and a --Autogenerated comment which is +# generated by the CopyWithInsertion function. After the whole +# string is instantiated, it is compared with the target file and +# if different the file is rewritten. +# Does not regenerate the Visual C++ 6 project files but does the VS .NET +# project file. + +import string +import sys +import os +import glob + +# EOL constants +CR = "\r" +LF = "\n" +CRLF = "\r\n" +if sys.platform == "win32": + NATIVE = CRLF +else: + # Yes, LF is the native EOL even on Mac OS X. CR is just for + # Mac OS <=9 (a.k.a. "Mac Classic") + NATIVE = LF + +# Automatically generated sections contain start and end comments, +# a definition line and the results. +# The results are replaced by regenerating based on the definition line. +# The definition line is a comment prefix followed by "**". +# If there is a digit after the ** then this indicates which list to use +# and the digit and next character are not part of the definition +# Backslash is used as an escape within the definition line. +# The part between \( and \) is repeated for each item in the list. +# \* is replaced by each list item. \t, and \n are tab and newline. +def CopyWithInsertion(input, commentPrefix, retainDefs, eolType, *lists): + copying = 1 + listid = 0 + output = [] + for line in input.splitlines(0): + isStartGenerated = line.startswith(commentPrefix + "++Autogenerated") + if copying and not isStartGenerated: + output.append(line) + if isStartGenerated: + if retainDefs: + output.append(line) + copying = 0 + definition = "" + elif not copying and line.startswith(commentPrefix + "**"): + if retainDefs: + output.append(line) + definition = line[len(commentPrefix + "**"):] + if (commentPrefix == "" in definition): + definition = definition.replace(" -->", "") + listid = 0 + if definition[0] in string.digits: + listid = int(definition[:1]) + definition = definition[2:] + # Hide double slashes as a control character + definition = definition.replace("\\\\", "\001") + # Do some normal C style transforms + definition = definition.replace("\\n", "\n") + definition = definition.replace("\\t", "\t") + # Get the doubled backslashes back as single backslashes + definition = definition.replace("\001", "\\") + startRepeat = definition.find("\\(") + endRepeat = definition.find("\\)") + intro = definition[:startRepeat] + out = "" + if intro.endswith("\n"): + pos = 0 + else: + pos = len(intro) + out += intro + middle = definition[startRepeat+2:endRepeat] + for i in lists[listid]: + item = middle.replace("\\*", i) + if pos and (pos + len(item) >= 80): + out += "\\\n" + pos = 0 + out += item + pos += len(item) + if item.endswith("\n"): + pos = 0 + outro = definition[endRepeat+2:] + out += outro + out = out.replace("\n", eolType) # correct EOLs in generated content + output.append(out) + elif line.startswith(commentPrefix + "--Autogenerated"): + copying = 1 + if retainDefs: + output.append(line) + output = [line.rstrip(" \t") for line in output] # trim trailing whitespace + return eolType.join(output) + eolType + +def UpdateFile(filename, updated): + """ If the file is different to updated then copy updated + into the file else leave alone so CVS and make don't treat + it as modified. """ + try: + infile = open(filename, "rb") + except IOError: # File is not there yet + out = open(filename, "wb") + out.write(updated.encode('utf-8')) + out.close() + print("New %s" % filename) + return + original = infile.read() + infile.close() + original = original.decode('utf-8') + if updated != original: + os.unlink(filename) + out = open(filename, "wb") + out.write(updated.encode('utf-8')) + out.close() + print("Changed %s " % filename) + #~ else: + #~ print "Unchanged", filename + +def Generate(inpath, outpath, commentPrefix, eolType, *lists): + """Generate 'outpath' from 'inpath'. + + "eolType" indicates the type of EOLs to use in the generated + file. It should be one of following constants: LF, CRLF, + CR, or NATIVE. + """ + #print "generate '%s' -> '%s' (comment prefix: %r, eols: %r)"\ + # % (inpath, outpath, commentPrefix, eolType) + try: + infile = open(inpath, "rb") + except IOError: + print("Can not open %s" % inpath) + return + original = infile.read() + infile.close() + original = original.decode('utf-8') + updated = CopyWithInsertion(original, commentPrefix, + inpath == outpath, eolType, *lists) + UpdateFile(outpath, updated) + +def Regenerate(filename, commentPrefix, eolType, *lists): + """Regenerate the given file. + + "eolType" indicates the type of EOLs to use in the generated + file. It should be one of following constants: LF, CRLF, + CR, or NATIVE. + """ + Generate(filename, filename, commentPrefix, eolType, *lists) + +def FindModules(lexFile): + modules = [] + f = open(lexFile) + for l in f.readlines(): + if l.startswith("LexerModule"): + l = l.replace("(", " ") + modules.append(l.split()[1]) + return modules + +knownIrregularProperties = [ + "fold", + "styling.within.preprocessor", + "tab.timmy.whinge.level", + "asp.default.language", + "html.tags.case.sensitive", + "ps.level", + "ps.tokenize", + "sql.backslash.escapes", + "nsis.uservars", + "nsis.ignorecase" +] + +def FindProperties(lexFile): + properties = {} + f = open(lexFile) + for l in f.readlines(): + if "GetProperty" in l: + l = l.strip() + if not l.startswith("//"): # Drop comments + propertyName = l.split("\"")[1] + if propertyName.lower() == propertyName: + # Only allow lower case property names + if propertyName in knownIrregularProperties or \ + propertyName.startswith("fold.") or \ + propertyName.startswith("lexer."): + properties[propertyName] = 1 + return properties + +def FindPropertyDocumentation(lexFile): + documents = {} + f = open(lexFile) + name = "" + for l in f.readlines(): + l = l.strip() + if "// property " in l: + propertyName = l.split()[2] + if propertyName.lower() == propertyName: + # Only allow lower case property names + name = propertyName + documents[name] = "" + elif name: + if l.startswith("//"): + if documents[name]: + documents[name] += " " + documents[name] += l[2:].strip() + else: + name = "" + return documents + +def ciCompare(a,b): + return cmp(a.lower(), b.lower()) + +def ciKey(a): + return a.lower() + +def sortListInsensitive(l): + try: # Try key function + l.sort(key=ciKey) + except TypeError: # Earlier version of Python, so use comparison function + l.sort(ciCompare) + +def RegenerateAll(): + root="../../" + + # Find all the lexer source code files + lexFilePaths = glob.glob(root + "scintilla/src/Lex*.cxx") + sortListInsensitive(lexFilePaths) + lexFiles = [os.path.basename(f)[:-4] for f in lexFilePaths] + print(lexFiles) + lexerModules = [] + lexerProperties = {} + propertyDocuments = {} + for lexFile in lexFilePaths: + lexerModules.extend(FindModules(lexFile)) + for k in FindProperties(lexFile).keys(): + lexerProperties[k] = 1 + documents = FindPropertyDocumentation(lexFile) + for k in documents.keys(): + propertyDocuments[k] = documents[k] + sortListInsensitive(lexerModules) + del lexerProperties["fold.comment.python"] + lexerProperties = list(lexerProperties.keys()) + sortListInsensitive(lexerProperties) + + # Generate HTML to document each property + # This is done because tags can not be safely put inside comments in HTML + documentProperties = list(propertyDocuments.keys()) + sortListInsensitive(documentProperties) + propertiesHTML = [] + for k in documentProperties: + propertiesHTML.append("\t\n\t%s\n\t%s\n\t" % + (k, propertyDocuments[k])) + + # Find all the SciTE properties files + otherProps = ["abbrev.properties", "Embedded.properties", "SciTEGlobal.properties", "SciTE.properties"] + if os.path.exists(root + "scite"): + propFilePaths = glob.glob(root + "scite/src/*.properties") + sortListInsensitive(propFilePaths) + propFiles = [os.path.basename(f) for f in propFilePaths if os.path.basename(f) not in otherProps] + sortListInsensitive(propFiles) + print(propFiles) + + Regenerate(root + "scintilla/src/KeyWords.cxx", "//", NATIVE, lexerModules) + Regenerate(root + "scintilla/win32/makefile", "#", NATIVE, lexFiles) + Regenerate(root + "scintilla/win32/scintilla.mak", "#", NATIVE, lexFiles) + Regenerate(root + "scintilla/win32/scintilla_vc6.mak", "#", NATIVE, lexFiles) + # Use Unix EOLs for gtk Makefiles so they work for Linux users when + # extracted from the Scintilla source ZIP (typically created on + # Windows). + Regenerate(root + "scintilla/gtk/makefile", "#", LF, lexFiles) + Regenerate(root + "scintilla/gtk/scintilla.mak", "#", NATIVE, lexFiles) + Regenerate(root + "scintilla/macosx/makefile", "#", LF, lexFiles) + if os.path.exists(root + "scite"): + Regenerate(root + "scite/win32/makefile", "#", NATIVE, lexFiles, propFiles) + Regenerate(root + "scite/win32/scite.mak", "#", NATIVE, lexFiles, propFiles) + Regenerate(root + "scite/src/SciTEProps.cxx", "//", NATIVE, lexerProperties) + Regenerate(root + "scite/doc/SciTEDoc.html", "")) { - sc.Forward(); - sc.Forward(); - sc.ForwardSetState(SCE_H_DEFAULT); - } - } else if (sc.state == SCE_H_ENTITY) { - if (sc.ch == ';') { - sc.ForwardSetState(SCE_H_DEFAULT); - } else if (sc.ch != '#' && (sc.ch < 0x80) && !isalnum(sc.ch) // Should check that '#' follows '&', but it is unlikely anyway... - && sc.ch != '.' && sc.ch != '-' && sc.ch != '_' && sc.ch != ':') { // valid in XML - sc.ChangeState(SCE_H_TAGUNKNOWN); - sc.SetState(SCE_H_DEFAULT); - } - } else if (sc.state == SCE_H_TAGUNKNOWN) { - if (!ishtmlwordchar(sc.ch) && !((sc.ch == '/') && (sc.chPrev == '<')) && sc.ch != '[') { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - if (s[1] == '/') { - if (keywordsTags.InList(s + 2)) { - sc.ChangeState(SCE_H_TAG); - } - } else { - if (keywordsTags.InList(s + 1)) { - sc.ChangeState(SCE_H_TAG); - } - } - if (sc.ch == '>') { - sc.ForwardSetState(SCE_H_DEFAULT); - } else if (sc.Match('/', '>')) { - sc.SetState(SCE_H_TAGEND); - sc.Forward(); - sc.ForwardSetState(SCE_H_DEFAULT); - } else { - sc.SetState(SCE_H_OTHER); - } - } - } else if (sc.state == SCE_H_ATTRIBUTE) { - if (!ishtmlwordchar(sc.ch)) { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - if (!keywordsTags.InList(s)) { - sc.ChangeState(SCE_H_ATTRIBUTEUNKNOWN); - } - sc.SetState(SCE_H_OTHER); - } - } else if (sc.state == SCE_H_OTHER) { - if (sc.ch == '>') { - sc.SetState(SCE_H_TAG); - sc.ForwardSetState(SCE_H_DEFAULT); - } else if (sc.Match('/', '>')) { - sc.SetState(SCE_H_TAG); - sc.Forward(); - sc.ForwardSetState(SCE_H_DEFAULT); - } else if (sc.chPrev == '=') { - sc.SetState(SCE_H_VALUE); - } - } else if (sc.state == SCE_H_DOUBLESTRING) { - if (sc.ch == '\"') { - sc.ForwardSetState(SCE_H_OTHER); - } - } else if (sc.state == SCE_H_SINGLESTRING) { - if (sc.ch == '\'') { - sc.ForwardSetState(SCE_H_OTHER); - } - } else if (sc.state == SCE_H_NUMBER) { - if (!IsADigit(sc.ch)) { - sc.SetState(SCE_H_OTHER); - } - } - - if (sc.state == SCE_H_DEFAULT) { - if (sc.ch == '<') { - if (sc.Match("