diff options
| author | mitchell <unknown> | 2020-06-19 08:40:49 -0400 |
|---|---|---|
| committer | mitchell <unknown> | 2020-06-19 08:40:49 -0400 |
| commit | ee0e98b74c7e7c64fb9079cd0bacd4c3e840c3b0 (patch) | |
| tree | 9c3c74b739dfdfaa36dfcb6df613c48fbbf00de5 | |
| parent | 6822a42fc6e0d25fe583d8d0fac80946c30bd8ca (diff) | |
| download | scintilla-mirror-ee0e98b74c7e7c64fb9079cd0bacd4c3e840c3b0.tar.gz | |
Reverted experimental Lexilla and SCI_SETILEXER support.
When testing, it works when compiled with debug symbols enabled, but crashes
without them. It doesn't seem worth maintaining.
| -rw-r--r-- | check.mak | 77 | ||||
| -rw-r--r-- | doc/ScintillaDoc.html | 19 | ||||
| -rw-r--r-- | doc/ScintillaHistory.html | 11 | ||||
| -rw-r--r-- | include/ILexer.h | 78 | ||||
| -rw-r--r-- | include/Scintilla.h | 1 | ||||
| -rw-r--r-- | include/Scintilla.iface | 5 | ||||
| -rw-r--r-- | lexlib/LexerModule.cxx | 3 | ||||
| -rw-r--r-- | lexlib/LexerModule.h | 2 | ||||
| -rw-r--r-- | src/ExternalLexer.cxx | 40 | ||||
| -rw-r--r-- | src/ExternalLexer.h | 2 | ||||
| -rw-r--r-- | src/ScintillaBase.cxx | 41 | ||||
| -rw-r--r-- | src/ScintillaBase.h | 5 | ||||
| -rw-r--r-- | win32/DepGen.py | 5 | ||||
| -rw-r--r-- | win32/deps.mak | 9 | ||||
| -rw-r--r-- | win32/makefile | 18 | ||||
| -rw-r--r-- | win32/nmdeps.mak | 9 | ||||
| -rw-r--r-- | win32/scintilla.mak | 13 |
17 files changed, 50 insertions, 288 deletions
@@ -8,7 +8,6 @@ # make -f check.mak test # run all tests # make -f check.mak bait # run test GTK program # make -f check.mak dmapp # run test Win32 program using WINE -# make -f check.mak lexilla # run test Win32 program with Lexilla # make -f check.mak jinx # run test curses program with Lua LPeg lexers # make -f check.mak gen # update all version info and dates based on # version.txt and the current date @@ -236,12 +235,9 @@ bait: | /tmp/scintilla/gtk/bait wget -O $@ https://www.scintilla.org/bait.zip # dmapp test program for Win32. -# There are two configurations: one that uses the standard SciLexer.dll, and one -# that uses the standard Scintilla.dll (no lexers) with a Lexilla.dll from -# SciTE 4.x+. Since the test program is mean to be build on Windows, create a -# makefile for cross-compiling from Linux and also patch the test program to -# support the Lexilla configuration. -dmapp_dlls = $(addprefix /tmp/scintilla/win32/dmapp/,Scintilla.dll SciLexer.dll Lexilla.dll) +# Since the test program is mean to be build on Windows, create a makefile for +# cross-compiling from Linux. +dmapp_dlls = /tmp/scintilla/win32/dmapp/SciLexer.dll define _dmapp_makefile ALL: DMApp.exe DMApp.o: DMApp.cxx ; i686-w64-mingw32-g++ -std=c++11 -I ../../include -c $< -o $@ @@ -250,89 +246,26 @@ DMApp.exe: DMApp.o DMApp_rc.o ; i686-w64-mingw32-g++ $^ -o $@ -lkernel32 -luser3 clean: ; rm -f *.exe *.o *.res endef export dmapp_makefile = $(value _dmapp_makefile) -define _dmapp_patch ---- a/DMApp.cxx 2000-03-08 01:37:03.000000000 -0500 -+++ b/DMApp.cxx 2020-06-07 10:13:31.328183977 -0400 -@@ -4,6 +4,7 @@ - #include <windows.h> - #include <richedit.h> - -+#include "ILexer.h" - #include "Scintilla.h" - #include "SciLexer.h" - #include "resource.h" -@@ -20,6 +21,7 @@ - HWND currentDialog; - HWND wMain; - HWND wEditor; -+ bool lexilla; - bool isDirty; - char fullPath[MAX_PATH]; - -@@ -56,6 +58,7 @@ - currentDialog = 0; - wMain = 0; - wEditor = 0; -+ lexilla = false; - isDirty = false; - fullPath[0] = '\\0'; - } -@@ -335,7 +338,13 @@ - - void DMApp::InitialiseEditor() { - SendEditor(SCI_SETLEXER, SCLEX_HTML); -- SendEditor(SCI_SETSTYLEBITS, 7); -+ if (lexilla) { -+ typedef Scintilla::ILexer5 *(__stdcall *CreateLexerFn)(const char *name); -+ auto fp = ::GetProcAddress(::LoadLibrary("Lexilla.dll"), "CreateLexer"); -+ CreateLexerFn f; -+ memcpy(&f, &fp, sizeof(CreateLexerFn)); -+ SendEditor(SCI_SETILEXER, 1, reinterpret_cast<LPARAM>(f("hypertext"))); -+ } - - SendEditor(SCI_SETKEYWORDS, 0, - reinterpret_cast<LPARAM>(htmlKeyWords)); -@@ -539,11 +548,12 @@ - int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR lpszCmdLine, int nCmdShow) { - - app.hInstance = hInstance; -+ app.lexilla = lpszCmdLine[0] == 'X'; - - HACCEL hAccTable = LoadAccelerators(hInstance, "DMApp"); - - //::LoadLibrary("Scintilla.DLL"); -- ::LoadLibrary("SciLexer.DLL"); -+ ::LoadLibrary(!app.lexilla ? "SciLexer.DLL" : "Scintilla.DLL"); - - RegisterWindowClass(); - -endef -export dmapp_patch = $(value _dmapp_patch) dmapp: /tmp/scintilla/win32/dmapp/DMApp.exe WINEPREFIX=$(dir $<)/wine WINEARCH=win32 wine $< lexilla: /tmp/scintilla/win32/dmapp/DMApp.exe WINEPREFIX=$(dir $<)/wine WINEARCH=win32 wine $< X /tmp/scintilla/win32/dmapp/DMApp.exe: $(dmapp_dlls) | /tmp/scintilla/win32/dmapp make -C $| -$(dmapp_dlls): /tmp/scintilla/scite.zip | /tmp/scintilla/win32/dmapp +$(dmapp_dlls): | /tmp/scintilla/win32/dmapp rm -f $|/../Catalogue.o $|/../ScintillaBase.o make -C $(dir $|) CXX=/opt/mingw-w64/bin/i686-w64-mingw32-g++ \ AR=/opt/mingw-w64/bin/i686-w64-mingw32-ar \ RANLIB=/opt/mingw-w64/bin/i686-w64-mingw32-ranlib \ WINDRES=/opt/mingw-w64/bin/i686-w64-mingw32-windres -j4 cd $| && ln -sf ../../bin/*.dll . - unzip -d $| $< wscite/Lexilla.dll && mv $|/wscite/* $| /tmp/scintilla/win32/dmapp: /tmp/scintilla/dmapp.zip | /tmp/scintilla mkdir $@ unzip -d $@ $< - perl -pi -e 's/\r\n/\n/g' $@/DMApp.cxx + sed -i -e '/SCI_SETSTYLEBITS/d' $@/DMApp.cxx echo "$$dmapp_makefile" > $@/makefile - echo "$$dmapp_patch" > $@/patch - cd $@ && patch -p1 < patch /tmp/scintilla/dmapp.zip: | /tmp/scintilla wget -O $@ https://www.scintilla.org/dmapp.zip -/tmp/scintilla/scite.zip: | /tmp/scintilla - wget -O $@ https://www.scintilla.org/wscite32_443.zip # jinx test program for curses. jinx: | /tmp/scintilla/curses/jinx diff --git a/doc/ScintillaDoc.html b/doc/ScintillaDoc.html index 3848140d6..ece36a4e2 100644 --- a/doc/ScintillaDoc.html +++ b/doc/ScintillaDoc.html @@ -6952,8 +6952,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ <a class="message" href="#SCI_SETLEXERLANGUAGE">SCI_SETLEXERLANGUAGE(<unused>, const char *language)</a><br /> <a class="message" href="#SCI_GETLEXERLANGUAGE">SCI_GETLEXERLANGUAGE(<unused>, char *language) → int</a><br /> - <a class="message" href="#SCI_SETILEXER">SCI_SETILEXER(bool iLexer5, pointer lexer)</a><br /> - <a class="message" href="#SCI_LOADLEXERLIBRARY">SCI_LOADLEXERLIBRARY(bool iLexer5, const char + <a class="message" href="#SCI_LOADLEXERLIBRARY">SCI_LOADLEXERLIBRARY(<unused>, const char *path)</a><br /> <a class="message" href="#SCI_COLOURISE">SCI_COLOURISE(position start, position end)</a><br /> <a class="message" href="#SCI_CHANGELEXERSTATE">SCI_CHANGELEXERSTATE(position start, position end) → int</a><br /> @@ -7003,27 +7002,15 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){ <code>Lex*.cxx</code> file and search for <code>LexerModule</code>. The third argument in the <code>LexerModule</code> constructor is the name to use.</p> - <p class="provisional"><b id="SCI_SETILEXER">SCI_SETILEXER(bool iLexer5, pointer lexer)</b><br /> - <code>SCI_SETILEXER</code> allows setting a lexer as an <code>ILexer*</code>. - The lexer may be implemented by an application or a shared library such as Lexilla. - <code>iLexer5</code> indicates whether or not the library contains Scintilla lexers that implement - the ILexer5 interface defined in Scintilla 4.3+ (e.g. Lexilla). The default is to assume lexers - implement the ILexer interface defined in Scintilla 3.x. This flag must be set explicitly and - cannot be inferred.</p> - <p>To test if your lexer assignment worked, use <a class="message" href="#SCI_GETLEXER"><code>SCI_GETLEXER</code></a> before and after setting the new lexer to see if the lexer number changed.</p> <p><code>SCI_GETLEXERLANGUAGE</code> retrieves the name of the lexer.</p> - <p><b id="SCI_LOADLEXERLIBRARY">SCI_LOADLEXERLIBRARY(bool iLexer5, const char *path)</b><br /> + <p><b id="SCI_LOADLEXERLIBRARY">SCI_LOADLEXERLIBRARY(<unused>, const char *path)</b><br /> Load a lexer implemented in a shared library. This is a .so file on GTK/Linux, a .dylib file on macOS, or a .DLL file on Windows. - <code>iLexer5</code> indicates whether or not the library contains Scintilla lexers that implement - the ILexer5 interface defined in Scintilla 4.3+ (e.g. Lexilla). The default is to assume lexers - implement the ILexer interface defined in Scintilla 3.x. This flag must be set explicitly and - cannot be inferred. - </p> + </p> <p><b id="SCI_COLOURISE">SCI_COLOURISE(position start, position end)</b><br /> This requests the current lexer or the container (if the lexer is set to diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index def900bc2..266868958 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -634,17 +634,6 @@ Released 9 May 2020. </li> <li> - SCI_SETILEXER implemented to use lexers from Lexilla or other sources. - </li> - </ul> - <h3> - <a href="https://sourceforge.net/projects/scintilla/files/scintilla/3.20.0/scintilla3200.zip/download">Release 3.20.0</a> - </h3> - <ul> - <li> - Released 9 May 2020. - </li> - <li> ILexerWithIdentity interface defined provisionally to support potential use of Lexilla. The details of this interface may change before being stabilised in Scintilla 5.0. </li> diff --git a/include/ILexer.h b/include/ILexer.h index 991c981e8..f7f188972 100644 --- a/include/ILexer.h +++ b/include/ILexer.h @@ -12,7 +12,7 @@ namespace Scintilla { -enum { dvOriginal=0, dvLineEnd=1, dvRelease4=2 }; +enum { dvOriginal=0, dvLineEnd=1 }; class IDocument { public: @@ -92,82 +92,6 @@ public: virtual const char * SCI_METHOD PropertyGet(const char *key) = 0; }; -// For upstream lexer/lexilla support. - -enum { lvRelease4=2, lvRelease5=3 }; - -class ILexer4 { -public: - virtual int SCI_METHOD Version() const = 0; - virtual void SCI_METHOD Release() = 0; - virtual const char * SCI_METHOD PropertyNames() = 0; - virtual int SCI_METHOD PropertyType(const char *name) = 0; - virtual const char * SCI_METHOD DescribeProperty(const char *name) = 0; - virtual Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) = 0; - virtual const char * SCI_METHOD DescribeWordListSets() = 0; - virtual Sci_Position SCI_METHOD WordListSet(int n, const char *wl) = 0; - virtual void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0; - virtual void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0; - virtual void * SCI_METHOD PrivateCall(int operation, void *pointer) = 0; - virtual int SCI_METHOD LineEndTypesSupported() = 0; - virtual int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) = 0; - virtual int SCI_METHOD SubStylesStart(int styleBase) = 0; - virtual int SCI_METHOD SubStylesLength(int styleBase) = 0; - virtual int SCI_METHOD StyleFromSubStyle(int subStyle) = 0; - virtual int SCI_METHOD PrimaryStyleFromStyle(int style) = 0; - virtual void SCI_METHOD FreeSubStyles() = 0; - virtual void SCI_METHOD SetIdentifiers(int style, const char *identifiers) = 0; - virtual int SCI_METHOD DistanceToSecondaryStyles() = 0; - virtual const char * SCI_METHOD GetSubStyleBases() = 0; - virtual int SCI_METHOD NamedStyles() = 0; - virtual const char * SCI_METHOD NameOfStyle(int style) = 0; - virtual const char * SCI_METHOD TagsOfStyle(int style) = 0; - virtual const char * SCI_METHOD DescriptionOfStyle(int style) = 0; -}; - -class ILexer5 : public ILexer4 { -public: - virtual const char * SCI_METHOD GetName() = 0; - virtual int SCI_METHOD GetIdentifier() = 0; - virtual const char * SCI_METHOD PropertyGet(const char *key) = 0; -}; - -class LexillaLexer : public ILexerWithIdentity { -ILexer5 *lex; -public: - LexillaLexer(ILexer5 *lex_) : lex(lex_) {} - virtual ~LexillaLexer() {} - void SCI_METHOD Release() override { lex->Release(); delete this; }; - int SCI_METHOD Version() const override { return lex->Version(); } - const char * SCI_METHOD PropertyNames() override { return lex->PropertyNames(); } - int SCI_METHOD PropertyType(const char *name) override { return lex->PropertyType(name); } - const char * SCI_METHOD DescribeProperty(const char *name) override { return lex->DescribeProperty(name); } - Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override { return lex->PropertySet(key, val); } - const char * SCI_METHOD DescribeWordListSets() override { return lex->DescribeWordListSets(); } - Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override { return lex->WordListSet(n, wl); } - void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) override { lex->Lex(startPos, lengthDoc, initStyle, pAccess); } - void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) override { lex->Fold(startPos, lengthDoc, initStyle, pAccess); } - void * SCI_METHOD PrivateCall(int operation, void *pointer) override { return lex->PrivateCall(operation, pointer); } - int SCI_METHOD LineEndTypesSupported() override { return lex->LineEndTypesSupported(); } - int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) override { return lex->AllocateSubStyles(styleBase, numberStyles); } - int SCI_METHOD SubStylesStart(int styleBase) override { return lex->SubStylesStart(styleBase); } - int SCI_METHOD SubStylesLength(int styleBase) override { return lex->SubStylesLength(styleBase); } - int SCI_METHOD StyleFromSubStyle(int subStyle) override { return lex->StyleFromSubStyle(subStyle); } - int SCI_METHOD PrimaryStyleFromStyle(int style) override { return lex->PrimaryStyleFromStyle(style); } - void SCI_METHOD FreeSubStyles() override { lex->FreeSubStyles(); } - void SCI_METHOD SetIdentifiers(int style, const char *identifiers) override { lex->SetIdentifiers(style, identifiers); } - int SCI_METHOD DistanceToSecondaryStyles() override { return lex->DistanceToSecondaryStyles(); } - const char * SCI_METHOD GetSubStyleBases() override { return lex->GetSubStyleBases(); } - int SCI_METHOD NamedStyles() override { return lex->NamedStyles(); } - const char * SCI_METHOD NameOfStyle(int style) override { return lex->NameOfStyle(style); } - const char * SCI_METHOD TagsOfStyle(int style) override { return lex->TagsOfStyle(style); } - const char * SCI_METHOD DescriptionOfStyle(int style) override { return lex->DescriptionOfStyle(style); } - // ILexerWithIdentity methods - const char * SCI_METHOD GetName() override { return lex->GetName(); } - int SCI_METHOD GetIdentifier() override { return lex->GetIdentifier(); } - const char * SCI_METHOD PropertyGet(const char *key) override { return lex->PropertyGet(key); } -}; - } #endif diff --git a/include/Scintilla.h b/include/Scintilla.h index 7cc0211d3..7eaef9be8 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -1055,7 +1055,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_NAMEOFSTYLE 4030 #define SCI_TAGSOFSTYLE 4031 #define SCI_DESCRIPTIONOFSTYLE 4032 -#define SCI_SETILEXER 4033 #define SC_MOD_NONE 0x0 #define SC_MOD_INSERTTEXT 0x1 #define SC_MOD_DELETETEXT 0x2 diff --git a/include/Scintilla.iface b/include/Scintilla.iface index 483208acf..29b5a2ac6 100644 --- a/include/Scintilla.iface +++ b/include/Scintilla.iface @@ -2904,7 +2904,7 @@ set void SetKeyWords=4005(int keyWordSet, string keyWords) set void SetLexerLanguage=4006(, string language) # Load a lexer library (dll / so). -fun void LoadLexerLibrary=4007(bool iLexer5, string path) +fun void LoadLexerLibrary=4007(, string path) # Retrieve a "property" value previously set with SetProperty. # Result is NUL-terminated. @@ -2995,9 +2995,6 @@ fun int TagsOfStyle=4031(int style, stringresult tags) # Result is NUL-terminated. fun int DescriptionOfStyle=4032(int style, stringresult description) -# Set the lexer from an ILexer*. -set void SetILexer=4033(, pointer ilexer) - # 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. diff --git a/lexlib/LexerModule.cxx b/lexlib/LexerModule.cxx index 592b53871..eecaa7b49 100644 --- a/lexlib/LexerModule.cxx +++ b/lexlib/LexerModule.cxx @@ -35,7 +35,6 @@ LexerModule::LexerModule(int language_, fnLexer(fnLexer_), fnFolder(fnFolder_), fnFactory(nullptr), - fnFactory5(nullptr), wordListDescriptions(wordListDescriptions_), lexClasses(lexClasses_), nClasses(nClasses_), @@ -97,8 +96,6 @@ size_t LexerModule::NamedStyles() const { ILexer *LexerModule::Create() const { if (fnFactory) return fnFactory(); - else if (fnFactory5) - return new LexillaLexer(fnFactory5()); else return new LexerSimple(this); } diff --git a/lexlib/LexerModule.h b/lexlib/LexerModule.h index f22729af6..096df5042 100644 --- a/lexlib/LexerModule.h +++ b/lexlib/LexerModule.h @@ -17,7 +17,6 @@ struct LexicalClass; typedef void (*LexerFunction)(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, WordList *keywordlists[], Accessor &styler); typedef ILexer *(*LexerFactoryFunction)(); -typedef ILexer5 *(*LexerFactoryFunction5)(); /** * A LexerModule is responsible for lexing and folding a particular language. @@ -31,7 +30,6 @@ protected: LexerFunction fnLexer; LexerFunction fnFolder; LexerFactoryFunction fnFactory; - LexerFactoryFunction5 fnFactory5; const char * const * wordListDescriptions; const LexicalClass *lexClasses; size_t nClasses; diff --git a/src/ExternalLexer.cxx b/src/ExternalLexer.cxx index eae5806ee..748789ed0 100644 --- a/src/ExternalLexer.cxx +++ b/src/ExternalLexer.cxx @@ -39,7 +39,6 @@ int nextLanguage = SCLEX_AUTOMATIC + 1; typedef int (EXT_LEXER_DECL *GetLexerCountFn)(); typedef void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength); typedef LexerFactoryFunction(EXT_LEXER_DECL *GetLexerFactoryFunction)(unsigned int Index); -typedef LexerFactoryFunction5(EXT_LEXER_DECL *GetLexerFactoryFunction5)(unsigned int Index); /// Generic function to convert from a void* to a function pointer. /// This avoids undefined and conditionally defined behaviour. @@ -55,17 +54,15 @@ T FunctionPointer(void *function) noexcept { class ExternalLexerModule : public LexerModule { protected: GetLexerFactoryFunction fneFactory; - GetLexerFactoryFunction5 fneFactory5; std::string name; public: ExternalLexerModule(int language_, LexerFunction fnLexer_, const char *languageName_=nullptr, LexerFunction fnFolder_=nullptr) : LexerModule(language_, fnLexer_, nullptr, fnFolder_), - fneFactory(nullptr), fneFactory5(nullptr), name(languageName_){ + fneFactory(nullptr), name(languageName_){ languageName = name.c_str(); } void SetExternal(GetLexerFactoryFunction fFactory, int index) noexcept; - void SetExternal(GetLexerFactoryFunction5 fFactory, int index) noexcept; }; /// LexerLibrary exists for every External Lexer DLL, contains ExternalLexerModules. @@ -73,7 +70,7 @@ class LexerLibrary { std::unique_ptr<DynamicLibrary> lib; std::vector<std::unique_ptr<ExternalLexerModule>> modules; public: - explicit LexerLibrary(const char *moduleName_, bool iLexer5=false); + explicit LexerLibrary(const char *moduleName_); ~LexerLibrary(); std::string moduleName; @@ -87,7 +84,7 @@ public: static LexerManager *GetInstance(); static void DeleteInstance() noexcept; - void Load(const char *path, bool iLexer5=false); + void Load(const char *path); void Clear() noexcept; private: @@ -114,18 +111,13 @@ void ExternalLexerModule::SetExternal(GetLexerFactoryFunction fFactory, int inde fnFactory = fFactory(index); } -void ExternalLexerModule::SetExternal(GetLexerFactoryFunction5 fFactory5, int index) noexcept { - fneFactory5 = fFactory5; - fnFactory5 = fFactory5(index); -} - //------------------------------------------ // // LexerLibrary // //------------------------------------------ -LexerLibrary::LexerLibrary(const char *moduleName_, bool iLexer5) { +LexerLibrary::LexerLibrary(const char *moduleName_) { // Load the DLL lib.reset(DynamicLibrary::Load(moduleName_)); if (lib->IsValid()) { @@ -135,14 +127,9 @@ LexerLibrary::LexerLibrary(const char *moduleName_, bool iLexer5) { if (GetLexerCount) { // Find functions in the DLL GetLexerNameFn GetLexerName = FunctionPointer<GetLexerNameFn>(lib->FindFunction("GetLexerName")); - GetLexerFactoryFunction fnFactory = nullptr; - GetLexerFactoryFunction5 fnFactory5 = nullptr; - if (!iLexer5) - fnFactory = FunctionPointer<GetLexerFactoryFunction>(lib->FindFunction("GetLexerFactory")); - else - fnFactory5 = FunctionPointer<GetLexerFactoryFunction5>(lib->FindFunction("GetLexerFactory")); - - if (!GetLexerName || (!fnFactory && !fnFactory5)) { + GetLexerFactoryFunction fnFactory = FunctionPointer<GetLexerFactoryFunction>(lib->FindFunction("GetLexerFactory")); + + if (!GetLexerName || !fnFactory) { return; } @@ -164,10 +151,7 @@ LexerLibrary::LexerLibrary(const char *moduleName_, bool iLexer5) { // The external lexer needs to know how to call into its DLL to // do its lexing and folding, we tell it here. - if (!iLexer5) - lex->SetExternal(fnFactory, i); - else - lex->SetExternal(fnFactory5, i); + lex->SetExternal(fnFactory, i); } } } @@ -202,12 +186,12 @@ LexerManager::~LexerManager() { Clear(); } -void LexerManager::Load(const char *path, bool iLexer5) { +void LexerManager::Load(const char *path) { for (const std::unique_ptr<LexerLibrary> &ll : libraries) { if (ll->moduleName == path) return; } - libraries.push_back(Sci::make_unique<LexerLibrary>(path, iLexer5)); + libraries.push_back(Sci::make_unique<LexerLibrary>(path)); } void LexerManager::Clear() noexcept { @@ -230,8 +214,8 @@ LMMinder minder; namespace Scintilla { -void ExternalLexerLoad(const char *path, bool iLexer5) { - LexerManager::GetInstance()->Load(path, iLexer5); +void ExternalLexerLoad(const char *path) { + LexerManager::GetInstance()->Load(path); } } diff --git a/src/ExternalLexer.h b/src/ExternalLexer.h index 736b91531..d0a615e31 100644 --- a/src/ExternalLexer.h +++ b/src/ExternalLexer.h @@ -10,7 +10,7 @@ namespace Scintilla { -void ExternalLexerLoad(const char *path, bool iLexer5=false); +void ExternalLexerLoad(const char *path); } diff --git a/src/ScintillaBase.cxx b/src/ScintillaBase.cxx index 92d8577a8..082cb82d5 100644 --- a/src/ScintillaBase.cxx +++ b/src/ScintillaBase.cxx @@ -23,13 +23,17 @@ #include "ILexer.h" #include "Scintilla.h" +#ifdef SCI_LEXER #include "SciLexer.h" +#endif #include "PropSetSimple.h" #include "CharacterCategory.h" +#ifdef SCI_LEXER #include "LexerModule.h" #include "Catalogue.h" +#endif #include "Position.h" #include "UniqueString.h" @@ -57,7 +61,9 @@ #include "AutoComplete.h" #include "ScintillaBase.h" +#ifdef SCI_LEXER #include "ExternalLexer.h" +#endif using namespace Scintilla; @@ -542,6 +548,8 @@ void ScintillaBase::RightButtonDownWithModifiers(Point pt, unsigned int curTime, Editor::RightButtonDownWithModifiers(pt, curTime, modifiers); } +#ifdef SCI_LEXER + namespace Scintilla { class LexState : public LexInterface { @@ -553,7 +561,6 @@ public: int lexLanguage; explicit LexState(Document *pdoc_); - void SetInstance(ILexer *instance_); // Deleted so LexState objects can not be copied. LexState(const LexState &) = delete; LexState(LexState &&) = delete; @@ -562,10 +569,8 @@ public: ~LexState() override; void SetLexer(uptr_t wParam); void SetLexerLanguage(const char *languageName); - const char *DescribeWordListSets(); void SetWordList(int n, const char *wl); - int GetIdentifier() const; const char *GetName() const; void *PrivateCall(int operation, void *pointer); const char *PropertyNames(); @@ -608,15 +613,6 @@ LexState::~LexState() { } } -void LexState::SetInstance(ILexer *instance_) { - if (instance) { - instance->Release(); - instance = nullptr; - } - instance = instance_; - pdoc->LexerChanged(); -} - LexState *ScintillaBase::DocumentLexState() { if (!pdoc->GetLexInterface()) { pdoc->SetLexInterface(Sci::make_unique<LexState>(pdoc)); @@ -845,7 +841,10 @@ const char *LexState::DescriptionOfStyle(int style) { } } +#endif + void ScintillaBase::NotifyStyleToNeeded(Sci::Position endStyleNeeded) { +#ifdef SCI_LEXER if (DocumentLexState()->lexLanguage != SCLEX_CONTAINER) { const Sci::Line lineEndStyled = pdoc->SciLineFromPosition(pdoc->GetEndStyled()); @@ -854,11 +853,14 @@ void ScintillaBase::NotifyStyleToNeeded(Sci::Position endStyleNeeded) { DocumentLexState()->Colourise(endStyled, endStyleNeeded); return; } +#endif Editor::NotifyStyleToNeeded(endStyleNeeded); } void ScintillaBase::NotifyLexerChanged(Document *, void *) { +#ifdef SCI_LEXER vs.EnsureStyle(0xff); +#endif } sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) { @@ -1056,6 +1058,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara displayPopupMenu = static_cast<int>(wParam); break; +#ifdef SCI_LEXER case SCI_SETLEXER: DocumentLexState()->SetLexer(static_cast<int>(wParam)); break; @@ -1063,14 +1066,6 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara case SCI_GETLEXER: return DocumentLexState()->lexLanguage; - case SCI_SETILEXER: - if (wParam == 0) { - DocumentLexState()->SetInstance(reinterpret_cast<ILexer *>(lParam)); - } else { - DocumentLexState()->SetInstance(new LexillaLexer(reinterpret_cast<ILexer5 *>(lParam))); - } - return 0; - case SCI_COLOURISE: if (DocumentLexState()->lexLanguage == SCLEX_CONTAINER) { pdoc->ModifiedAt(static_cast<Sci::Position>(wParam)); @@ -1107,11 +1102,9 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara case SCI_GETLEXERLANGUAGE: return StringResult(lParam, DocumentLexState()->GetName()); -#ifdef SCI_LEXER case SCI_LOADLEXERLIBRARY: - ExternalLexerLoad(ConstCharPtrFromSPtr(lParam), wParam != 0); + ExternalLexerLoad(ConstCharPtrFromSPtr(lParam)); break; -#endif case SCI_PRIVATELEXERCALL: return reinterpret_cast<sptr_t>( @@ -1183,6 +1176,8 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara return StringResult(lParam, DocumentLexState()-> DescriptionOfStyle(static_cast<int>(wParam))); +#endif + default: return Editor::WndProc(iMessage, wParam, lParam); } diff --git a/src/ScintillaBase.h b/src/ScintillaBase.h index fcb1c9796..a558922bc 100644 --- a/src/ScintillaBase.h +++ b/src/ScintillaBase.h @@ -10,7 +10,10 @@ namespace Scintilla { +#ifdef SCI_LEXER class LexState; +#endif + /** */ class ScintillaBase : public Editor, IListBoxDelegate { @@ -41,10 +44,12 @@ protected: int maxListWidth; /// Maximum width of list, in average character widths int multiAutoCMode; /// Mode for autocompleting when multiple selections are present +#if SCI_LEXER LexState *DocumentLexState(); void SetLexer(uptr_t wParam); void SetLexerLanguage(const char *languageName); void Colourise(int start, int end); +#endif ScintillaBase(); // Deleted so ScintillaBase objects can not be copied. diff --git a/win32/DepGen.py b/win32/DepGen.py index 6196720e2..fa11b020a 100644 --- a/win32/DepGen.py +++ b/win32/DepGen.py @@ -22,9 +22,6 @@ def Generate(): # Add ScintillaBaseL as the same as ScintillaBase deps = Dependencies.InsertSynonym(deps, "ScintillaBase.o", "ScintillaBaseL.o") - # Add CatalogueL as the same as Catalogue - deps = Dependencies.InsertSynonym(deps, "Catalogue.o", "CatalogueL.o") - Dependencies.UpdateDependencies("../win32/deps.mak", deps, topComment) # Create the dependencies file for MSVC @@ -35,4 +32,4 @@ def Generate(): Dependencies.UpdateDependencies("../win32/nmdeps.mak", deps, topComment) if __name__ == "__main__": - Generate()
\ No newline at end of file + Generate() diff --git a/win32/deps.mak b/win32/deps.mak index 4b921238c..3dbe89399 100644 --- a/win32/deps.mak +++ b/win32/deps.mak @@ -96,15 +96,6 @@ Catalogue.o: \ ../lexlib/LexerModule.h \ ../lexlib/CatalogueModules.h \ ../src/Catalogue.h -CatalogueL.o: \ - ../src/Catalogue.cxx \ - ../include/ILexer.h \ - ../include/Sci_Position.h \ - ../include/Scintilla.h \ - ../include/SciLexer.h \ - ../lexlib/LexerModule.h \ - ../lexlib/CatalogueModules.h \ - ../src/Catalogue.h CellBuffer.o: \ ../src/CellBuffer.cxx \ ../include/Platform.h \ diff --git a/win32/makefile b/win32/makefile index 0bb3d0d8f..1b5ce451b 100644 --- a/win32/makefile +++ b/win32/makefile @@ -117,7 +117,6 @@ SRC_OBJS = \ MarginView.o \ PerLine.o \ PositionCache.o \ - PropSetSimple.o \ RESearch.o \ RunStyles.o \ Selection.o \ @@ -130,12 +129,13 @@ SRC_OBJS = \ # Required by lexers LEXLIB_OBJS = \ Accessor.o \ - CatalogueL.o \ + Catalogue.o \ DefaultLexer.o \ ExternalLexer.o \ LexerBase.o \ LexerModule.o \ LexerSimple.o \ + PropSetSimple.o \ StyleContext.o \ WordList.o @@ -152,18 +152,12 @@ SCILEX_OBJS=\ COMPONENT_OBJS = \ $(SRC_OBJS) \ - Accessor.o \ - Catalogue.o \ HanjaDic.o \ - LexerBase.o \ - LexerModule.o \ - LexerSimple.o \ PlatWin.o \ ScintillaBase.o \ ScintillaDLL.o \ ScintillaWin.o \ - ScintRes.o \ - WordList.o + ScintRes.o LEXCOMPONENT_OBJS = \ $(SCILEX_OBJS) \ @@ -186,12 +180,6 @@ include deps.mak ScintillaBaseL.o: $(CXX) $(CXX_ALL_FLAGS) $(CXXFLAGS) -D SCI_LEXER -c $< -o $@ -Catalogue.o: Catalogue.cxx - $(CXX) $(CXX_ALL_FLAGS) $(CXXFLAGS) -D SCI_LEXER -D SCI_EMPTYCATALOGUE -c $< -o $@ - -CatalogueL.o: Catalogue.cxx - $(CXX) $(CXX_ALL_FLAGS) $(CXXFLAGS) -D SCI_LEXER -c $< -o $@ - ScintRes.o: ScintRes.rc $(WINDRES) ScintRes.rc $@ diff --git a/win32/nmdeps.mak b/win32/nmdeps.mak index 8a886b517..79cc0ab45 100644 --- a/win32/nmdeps.mak +++ b/win32/nmdeps.mak @@ -96,15 +96,6 @@ $(DIR_O)/Catalogue.obj: \ ../lexlib/LexerModule.h \ ../lexlib/CatalogueModules.h \ ../src/Catalogue.h -$(DIR_O)/CatalogueL.obj: \ - ../src/Catalogue.cxx \ - ../include/ILexer.h \ - ../include/Sci_Position.h \ - ../include/Scintilla.h \ - ../include/SciLexer.h \ - ../lexlib/LexerModule.h \ - ../lexlib/CatalogueModules.h \ - ../src/Catalogue.h $(DIR_O)/CellBuffer.obj: \ ../src/CellBuffer.cxx \ ../include/Platform.h \ diff --git a/win32/scintilla.mak b/win32/scintilla.mak index d446bb262..cfbb73224 100644 --- a/win32/scintilla.mak +++ b/win32/scintilla.mak @@ -230,7 +230,6 @@ LEX_OBJS=\ # Required by lexers LEXLIB_OBJS = \ $(DIR_O)\Accessor.obj \ - $(DIR_O)\CatalogueL.obj \ $(DIR_O)\ExternalLexer.obj \ $(DIR_O)\DefaultLexer.obj \ $(DIR_O)\LexerBase.obj \ @@ -250,17 +249,11 @@ SCILEX_OBJS = \ $(DIR_O)\ScintillaWin.obj COMPONENT_OBJS = \ - $(DIR_O)\Accessor.obj \ - $(DIR_O)\Catalogue.obj \ $(DIR_O)\HanjaDic.obj \ - $(DIR_O)\LexerBase.obj \ - $(DIR_O)\LexerModule.obj \ - $(DIR_O)\LexerSimple.obj \ $(DIR_O)\PlatWin.obj \ $(DIR_O)\ScintillaBase.obj \ $(DIR_O)\ScintillaDLL.obj \ $(DIR_O)\ScintillaWin.obj \ - $(DIR_O)\WordList.obj \ $(SRC_OBJS) LEXCOMPONENT_OBJS = \ @@ -294,12 +287,6 @@ $(LIBSCI): $(SCILEX_OBJS) $(DIR_O)\ScintillaBaseL.obj: ..\src\ScintillaBase.cxx $(CXX) $(CXXFLAGS) -DSCI_LEXER -c $(NAME)$@ ..\src\ScintillaBase.cxx -$(DIR_O)\CatalogueL.obj: ..\src\Catalogue.cxx - $(CXX) $(CXXFLAGS) -DSCI_LEXER -c $(NAME)$@ ..\src\Catalogue.cxx - -$(DIR_O)\Catalogue.obj: ..\src\Catalogue.cxx - $(CXX) $(CXXFLAGS) -DSCI_LEXER -DSCI_EMPTYCATALOGUE -c $(NAME)$@ ..\src\Catalogue.cxx - # Dependencies !IF EXISTS(nmdeps.mak) |
