Upgrade Scintilla - integrate boost's PCRE in 64 build

And remove compiling warning.
This commit is contained in:
Don HO 2019-05-08 10:43:30 +02:00
parent 37c4b894cc
commit 2d90b38795
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
14 changed files with 73 additions and 472 deletions

Binary file not shown.

View File

@ -1,19 +1,16 @@
#ifndef ANSIDOCUMENTITERATOR_H_12481491281240
#define ANSIDOCUMENTITERATOR_H_12481491281240
#include "Position.h"
namespace Scintilla {
class AnsiDocumentIterator : public std::iterator<std::bidirectional_iterator_tag, char>
{
public:
AnsiDocumentIterator() :
m_doc(0),
m_pos(0),
m_end(0)
{
}
AnsiDocumentIterator() {};
AnsiDocumentIterator(Document* doc, int pos, int end) :
AnsiDocumentIterator(Document* doc, Sci::Position pos, Sci::Position end) :
m_doc(doc),
m_pos(pos),
m_end(end)
@ -72,13 +69,13 @@ public:
return *this;
}
int pos() const
Sci::Position pos() const
{
return m_pos;
}
private:
char charAt(int position) const
char charAt(Sci::Position position) const
{
return m_doc->CharAt(position);
}
@ -88,9 +85,9 @@ private:
return m_pos == m_end;
}
int m_pos;
int m_end;
Document* m_doc;
Sci::Position m_pos = 0;
Sci::Position m_end = 0;
Document* m_doc = nullptr;
};
}

View File

@ -38,8 +38,6 @@
#define CP_UTF8 65001
#define SC_CP_UTF8 65001
#define _SILENCE_ALL_CXX17_DEPRECATION_WARNI
using namespace Scintilla;
using namespace boost;
@ -55,9 +53,9 @@ public:
}
virtual Sci::Position FindText(Document* doc, Sci::Position minPos, Sci::Position maxPos, const char *regex,
bool caseSensitive, bool word, bool wordStart, int sciSearchFlags, int *lengthRet);
bool caseSensitive, bool word, bool wordStart, int sciSearchFlags, Sci::Position *lengthRet);
virtual const char *SubstituteByPosition(Document* doc, const char *text, int *length);
virtual const char *SubstituteByPosition(Document* doc, const char *text, Sci::Position *length);
private:
class SearchParameters;
@ -66,7 +64,7 @@ private:
public:
Match() : _document(NULL), _documentModified(false), _position(-1), _endPosition(-1), _endPositionForContinuationCheck(-1) {}
~Match() { setDocument(NULL); }
Match(Document* document, int position = -1, int endPosition = -1) : _document(NULL) { set(document, position, endPosition); }
Match(Document* document, Sci::Position position = -1, Sci::Position endPosition = -1) : _document(NULL) { set(document, position, endPosition); }
Match& operator=(Match& m) {
set(m._document, m.position(), m.endPosition());
return *this;
@ -76,14 +74,14 @@ private:
return *this;
}
void set(Document* document = NULL, int position = -1, int endPosition = -1) {
void set(Document* document = NULL, Sci::Position position = -1, Sci::Position endPosition = -1) {
setDocument(document);
_position = position;
_endPositionForContinuationCheck = _endPosition = endPosition;
_documentModified = false;
}
bool isContinuationSearch(Document* document, int startPosition, int direction) {
bool isContinuationSearch(Document* document, Sci::Position startPosition, int direction) {
if (hasDocumentChanged(document))
return false;
if (direction > 0)
@ -94,13 +92,13 @@ private:
bool isEmpty() {
return _position == _endPosition;
}
int position() {
Sci::Position position() {
return _position;
}
int endPosition() {
Sci::Position endPosition() {
return _endPosition;
}
int length() {
Sci::Position length() {
return _endPosition - _position;
}
int found() {
@ -158,14 +156,14 @@ private:
}
virtual void NotifyModifyAttempt(Document* /*document*/, void* /*userData*/) {}
virtual void NotifySavePoint(Document* /*document*/, void* /*userData*/, bool /*atSavePoint*/) {}
virtual void NotifyStyleNeeded(Document* /*document*/, void* /*userData*/, int /*endPos*/) {}
virtual void NotifyStyleNeeded(Document* /*document*/, void* /*userData*/, Sci::Position /*endPos*/) {}
virtual void NotifyLexerChanged(Document* /*document*/, void* /*userData*/) {}
virtual void NotifyErrorOccurred(Document* /*document*/, void* /*userData*/, int /*status*/) {}
Document* _document;
bool _documentModified;
int _position, _endPosition;
int _endPositionForContinuationCheck;
Sci::Position _position, _endPosition;
Sci::Position _endPositionForContinuationCheck;
};
class CharTPtr { // Automatically translatable from utf8 to wchar_t*, if required, with allocation and deallocation on destruction; char* is not deallocated.
@ -193,7 +191,7 @@ private:
EncodingDependent() : _lastCompileFlags(-1) {}
void compileRegex(const char *regex, const int compileFlags);
Match FindText(SearchParameters& search);
char *SubstituteByPosition(const char *text, int *length);
char *SubstituteByPosition(const char *text, Sci::Position *length);
private:
Match FindTextForward(SearchParameters& search);
Match FindTextBackward(SearchParameters& search);
@ -212,15 +210,15 @@ private:
class SearchParameters {
public:
int nextCharacter(int position);
bool isLineStart(int position);
bool isLineEnd(int position);
Sci::Position nextCharacter(Sci::Position position);
bool isLineStart(Sci::Position position);
bool isLineEnd(Sci::Position position);
Document* _document;
const char *_regexString;
int _compileFlags;
int _startPosition;
int _endPosition;
Sci::Position _startPosition;
Sci::Position _endPosition;
regex_constants::match_flag_type _boostRegexFlags;
int _direction;
bool _is_allowed_empty;
@ -258,7 +256,7 @@ RegexSearchBase *CreateRegexSearch(CharClassify* /* charClassTable */)
*/
Sci::Position BoostRegexSearch::FindText(Document* doc, Sci::Position startPosition, Sci::Position endPosition, const char *regexString,
bool caseSensitive, bool /*word*/, bool /*wordStart*/, int sciSearchFlags, int *lengthRet)
bool caseSensitive, bool /*word*/, bool /*wordStart*/, int sciSearchFlags, Sci::Position *lengthRet)
{
try {
SearchParameters search;
@ -345,7 +343,7 @@ template <class CharT, class CharacterIterator>
BoostRegexSearch::Match BoostRegexSearch::EncodingDependent<CharT, CharacterIterator>::FindTextForward(SearchParameters& search)
{
CharacterIterator endIterator(search._document, search._endPosition, search._endPosition);
int next_search_from_position = search._startPosition;
Sci::Position next_search_from_position = search._startPosition;
bool found = false;
bool match_is_valid = false;
do {
@ -355,8 +353,8 @@ BoostRegexSearch::Match BoostRegexSearch::EncodingDependent<CharT, CharacterIter
const bool end_reached = next_search_from_position > search._endPosition;
found = !end_reached && boost::regex_search(CharacterIterator(search._document, next_search_from_position, search._endPosition), endIterator, _match, _regex, search._boostRegexFlags);
if (found) {
const int position = _match[0].first.pos();
const int length = _match[0].second.pos() - position;
const Sci::Position position = _match[0].first.pos();
const Sci::Position length = _match[0].second.pos() - position;
const bool match_is_non_empty = length != 0;
const bool is_allowed_empty_here = search._is_allowed_empty && (search._is_allowed_empty_at_start_position || position > search._startPosition);
match_is_valid = match_is_non_empty || is_allowed_empty_here;
@ -380,14 +378,14 @@ BoostRegexSearch::Match BoostRegexSearch::EncodingDependent<CharT, CharacterIter
search._is_allowed_empty_at_start_position = search._is_allowed_empty;
MatchResults bestMatch;
int bestPosition = -1;
int bestEnd = -1;
Sci::Position bestPosition = -1;
Sci::Position bestEnd = -1;
for (;;) {
Match matchRange = FindText(search);
if (!matchRange.found())
break;
int position = matchRange.position();
int endPosition = matchRange.endPosition();
Sci::Position position = matchRange.position();
Sci::Position endPosition = matchRange.endPosition();
if (endPosition > bestEnd && (endPosition < search._endPosition || position != endPosition || is_allowed_empty_at_end_position)) // We are searching for the longest match which has the fathest end (but may not accept empty match at end position).
{
bestMatch = _match;
@ -413,7 +411,7 @@ void BoostRegexSearch::EncodingDependent<CharT, CharacterIterator>::compileRegex
}
}
int BoostRegexSearch::SearchParameters::nextCharacter(int position)
Sci::Position BoostRegexSearch::SearchParameters::nextCharacter(Sci::Position position)
{
if (_skip_windows_line_end_as_one_character && _document->CharAt(position) == '\r' && _document->CharAt(position+1) == '\n')
return position + 2;
@ -421,21 +419,21 @@ int BoostRegexSearch::SearchParameters::nextCharacter(int position)
return position + 1;
}
bool BoostRegexSearch::SearchParameters::isLineStart(int position)
bool BoostRegexSearch::SearchParameters::isLineStart(Sci::Position position)
{
return (position == 0)
|| _document->CharAt(position-1) == '\n'
|| _document->CharAt(position-1) == '\r' && _document->CharAt(position) != '\n';
}
bool BoostRegexSearch::SearchParameters::isLineEnd(int position)
bool BoostRegexSearch::SearchParameters::isLineEnd(Sci::Position position)
{
return (position == _document->Length())
|| _document->CharAt(position) == '\r'
|| _document->CharAt(position) == '\n' && (position == 0 || _document->CharAt(position-1) != '\n');
}
const char *BoostRegexSearch::SubstituteByPosition(Document* doc, const char *text, int *length) {
const char *BoostRegexSearch::SubstituteByPosition(Document* doc, const char *text, Sci::Position *length) {
delete[] _substituted;
_substituted = (doc->CodePage() == SC_CP_UTF8)
? _utf8.SubstituteByPosition(text, length)
@ -444,7 +442,7 @@ const char *BoostRegexSearch::SubstituteByPosition(Document* doc, const char *te
}
template <class CharT, class CharacterIterator>
char *BoostRegexSearch::EncodingDependent<CharT, CharacterIterator>::SubstituteByPosition(const char *text, int *length) {
char *BoostRegexSearch::EncodingDependent<CharT, CharacterIterator>::SubstituteByPosition(const char *text, Sci::Position *length) {
char *substituted = stringToCharPtr(_match.format((const CharT*)CharTPtr(text), boost::format_all));
*length = static_cast<int>(strlen(substituted));
return substituted;
@ -465,7 +463,7 @@ char *BoostRegexSearch::wcharToUtf8(const wchar_t *w)
{
//int wcharSize = static_cast<int>(wcslen(w));
std::wstring ws(w);
int charSize = UTF8Length(ws);
size_t charSize = UTF8Length(ws);
char *c = new char[charSize + 1];
UTF8FromUTF16(ws, c, charSize);
c[charSize] = 0;

View File

@ -1,267 +0,0 @@
@ECHO OFF
:: Perform the pre-steps to build boost and set the boost path for the build file
SETLOCAL
SET BOOSTPATH=
SET MSVCTOOLSET=
SET TOOLSETCOMMAND=
SET BOOSTVERSION=
SET WORKPATH=%~dp0%
SET BUILDTARGETPARAM=
SET BUILDTARGETPATH=
rem :PARAMLOOP
IF [%1]==[] (
GOTO PARAMCONTINUE
)
IF NOT [%1]==[--toolset] (
SET BOOSTPATH=%1
)
IF [%1]==[--toolset] (
SET MSVCTOOLSET=%2
SHIFT
)
IF [%2]==[-x64] (
SET BUILDTARGETPARAM=architecture=ia64
SET BUILDTARGETPATH=architecture-ia64\
)
rem SHIFT
rem GOTO PARAMLOOP
:PARAMCONTINUE
IF [%BOOSTPATH%]==[] (
GOTO USAGE
)
SET TOOLSETCOMMAND=
IF NOT [%MSVCTOOLSET%]==[] (
SET TOOLSETCOMMAND=toolset=%MSVCTOOLSET%
)
IF NOT EXIST "%BOOSTPATH%\boost\regex.hpp" (
ECHO Not found: %BOOSTPATH%\boost\regex.hpp
GOTO BOOSTNOTFOUND
)
IF NOT EXIST "%BOOSTPATH%\bjam\bin\bjam.exe" (
ECHO Building BJAM, the boost build tool
PUSHD %BOOSTPATH%\tools\build\v2
CALL bootstrap.bat
%BOOSTPATH%\tools\build\v2\b2 --prefix=%BOOSTPATH%\bjam install
POPD
)
IF NOT ERRORLEVEL 0 (
GOTO BUILDERROR
)
ECHO.
ECHO ***************************************************************
ECHO Building tool to check boost version
ECHO ***************************************************************
ECHO # Temporary version of auto-generated file > %WORKPATH%\boostpath.mak
ECHO # If you're seeing this version of the file, and you're not currently building boost, >> %WORKPATH%\boostpath.mak
ECHO # then your buildboost.bat is failing somewhere. >> %WORKPATH%\boostpath.mak
ECHO # Run BuildBoost.bat [absolute_path_to_boost] to generate this file again >> %WORKPATH%\boostpath.mak
ECHO # And lookout for error messages >> %WORKPATH%\boostpath.mak
ECHO BOOSTPATH=%BOOSTPATH% >> %WORKPATH%\boostpath.mak
IF NOT EXIST bin md bin
nmake -f getboostver.mak
IF ERRORLEVEL 1 (
ECHO ******************************
ECHO ** ERROR building getboostver.exe
ECHO ** Please see the error messages above, and post as much as you can to the
ECHO ** Notepad++ Open Discussion forum
ECHO ** http://sourceforge.net/projects/notepad-plus/forums/forum/331753
ECHO.
GOTO EOF
)
for /f "delims=" %%i in ('bin\getboostver.exe') do set BOOSTVERSION=%%i
IF [%BOOSTVERSION%]==[] (
ECHO There was an error detecting the boost version.
ECHO Please see the error messages above, and post as much as you can to the
ECHO Notepad++ Open Discussion forum
ECHO http://sourceforge.net/projects/notepad-plus/forums/forum/331753
ECHO.
GOTO EOF
)
ECHO.
ECHO ***************************************************************
ECHO Boost version in use: %BOOSTVERSION%
ECHO ***************************************************************
ECHO.
ECHO.
ECHO ***************************************************************
ECHO Building Boost::regex
ECHO ***************************************************************
ECHO.
PUSHD %BOOSTPATH%\libs\regex\build
%BOOSTPATH%\bjam\bin\bjam %TOOLSETCOMMAND% variant=release threading=multi link=static runtime-link=static %BUILDTARGETPARAM%
IF NOT ERRORLEVEL 0 (
GOTO BUILDERROR
)
%BOOSTPATH%\bjam\bin\bjam %TOOLSETCOMMAND% variant=debug threading=multi link=static runtime-link=static %BUILDTARGETPARAM%
IF NOT ERRORLEVEL 0 (
GOTO BUILDERROR
)
IF NOT [%MSVCTOOLSET%]==[] (
GOTO TOOLSETKNOWN
)
:: VS2013
IF EXIST %BOOSTPATH%\bin.v2\libs\regex\build\msvc-12.0\release\%BUILDTARGETPATH%link-static\runtime-link-static\threading-multi\libboost_regex-vc120-mt-s-%BOOSTVERSION%.lib (
SET MSVCTOOLSET=msvc-12.0
)
:: VS2012
IF EXIST %BOOSTPATH%\bin.v2\libs\regex\build\msvc-11.0\release\link-static\runtime-link-static\threading-multi\libboost_regex-vc110-mt-s-%BOOSTVERSION%.lib (
SET MSVCTOOLSET=msvc-11.0
)
:: VS2010
IF EXIST %BOOSTPATH%\bin.v2\libs\regex\build\msvc-10.0\release\link-static\runtime-link-static\threading-multi\libboost_regex-vc100-mt-s-%BOOSTVERSION%.lib (
SET MSVCTOOLSET=msvc-10.0
)
:: VS2008
IF EXIST %BOOSTPATH%\bin.v2\libs\regex\build\msvc-9.0\release\link-static\runtime-link-static\threading-multi\libboost_regex-vc90-mt-s-%BOOSTVERSION%.lib (
SET MSVCTOOLSET=msvc-9.0
)
:: VS2005
IF EXIST %BOOSTPATH%\bin.v2\libs\regex\build\msvc-8.0\release\link-static\runtime-link-static\threading-multi\libboost_regex-vc80-mt-s-%BOOSTVERSION%.lib (
SET MSVCTOOLSET=msvc-8.0
)
IF [%MSVCTOOLSET%]==[] (
ECHO No correctly built boost regex libraries could be found.
ECHO Try specifying the MSVC version on the command line.
GOTO USAGE
)
ECHO ***********************************************
ECHO Assuming toolset in use is %MSVCTOOLSET%
ECHO ***********************************************
ECHO If this is not correct, specify the version on the command line with --toolset
ECHO Run buildboost.bat without parameters to see the usage.
:TOOLSETKNOWN
:: VS2013
IF [%MSVCTOOLSET%]==[msvc-12.0] (
SET BOOSTLIBPATH=%BOOSTPATH%\bin.v2\libs\regex\build\msvc-12.0
)
:: VS2012
IF [%MSVCTOOLSET%]==[msvc-11.0] (
SET BOOSTLIBPATH=%BOOSTPATH%\bin.v2\libs\regex\build\msvc-11.0
)
:: VS2010
IF [%MSVCTOOLSET%]==[msvc-10.0] (
SET BOOSTLIBPATH=%BOOSTPATH%\bin.v2\libs\regex\build\msvc-10.0
)
:: VS2008
IF [%MSVCTOOLSET%]==[msvc-9.0] (
SET BOOSTLIBPATH=%BOOSTPATH%\bin.v2\libs\regex\build\msvc-9.0
)
:: VS2005
IF [%MSVCTOOLSET%]==[msvc-8.0] (
SET BOOSTLIBPATH=%BOOSTPATH%\bin.v2\libs\regex\build\msvc-8.0
)
:: Error case, so we try to give the user a helpful error message
IF [%BOOSTLIBPATH%] == [] (
ECHO ****************************************
ECHO ** ERROR
ECHO ** Boost library could not be found.
ECHO ** Make sure you've specified the correct boost path on the command line,
ECHO ** and try adding the toolset version
ECHO ****************************************
GOTO USAGE
)
ECHO # Autogenerated file, run BuildBoost.bat [path_to_boost] to generate > %WORKPATH%\boostpath.mak
ECHO BOOSTPATH=%BOOSTPATH% >> %WORKPATH%\boostpath.mak
ECHO BOOSTLIBPATH=%BOOSTLIBPATH% >> %WORKPATH%\boostpath.mak
ECHO BUILDTARGETPATH=%BUILDTARGETPATH% >> %WORKPATH%\boostpath.mak
POPD
ECHO.
ECHO.
ECHO Boost::regex built.
ECHO.
ECHO Now you need to build scintilla.
ECHO.
ECHO From the scintilla\win32 directory
ECHO.
ECHO nmake -f scintilla.mak
ECHO.
ECHO.
GOTO EOF
:BOOSTNOTFOUND
ECHO Boost Path not valid. Run BuildBoost.bat with the absolute path to the directory
ECHO where you unpacked your boost zip.
ECHO.
:USAGE
ECHO.
ECHO Boost is available free from www.boost.org
ECHO.
ECHO Unzip the file downloaded from www.boost.org, and give the absolute path
ECHO as the first parameter to buildboost.bat
ECHO.
ECHO e.g.
ECHO buildboost.bat d:\libs\boost_1_55_0
ECHO.
ECHO To build 64 bit version, add "-x64" flag after the full file path.
ECHO e.g.
ECHO buildboost.bat d:\libs\boost_1_55_0 -x64
ECHO.
ECHO.
ECHO You can specify which version of the Visual Studio compiler to use
ECHO with --toolset.
ECHO Use:
ECHO --toolset msvc-8.0 for Visual studio 2005
ECHO --toolset msvc-9.0 for Visual Studio 2008
ECHO --toolset msvc-10.0 for Visual Studio 2010
ECHO --toolset msvc-11.0 for Visual Studio 2012
ECHO --toolset msvc-12.0 for Visual Studio 2013
ECHO.
ECHO.
ECHO e.g. To build with boost in d:\libs\boost_1_55_0 with Visual Studio 2008
ECHO.
ECHO buildboost.bat --toolset msvc-9.0 d:\libs\boost_1_55_0
ECHO.
GOTO EOF
:BUILDERROR
ECHO There was an error building boost. Please see the messages above for details.
ECHO - Have you got a clean extract from a recent boost version, such as 1.55?
ECHO - Download a fresh copy from www.boost.org and extract it to a directory,
ECHO and run the batch again with the name of that directory
:EOF
ENDLOCAL

View File

@ -21,7 +21,7 @@
using namespace Scintilla;
UTF8DocumentIterator::UTF8DocumentIterator(Document* doc, int pos, int end) :
UTF8DocumentIterator::UTF8DocumentIterator(Document* doc, Sci::Position pos, Sci::Position end) :
m_doc(doc),
m_pos(pos),
m_end(end),
@ -95,7 +95,7 @@ void UTF8DocumentIterator::readCharacter()
} while (currentChar & mask);
int result = currentChar & m_firstByteMask[nBytes];
int pos = m_pos;
Sci::Position pos = m_pos;
m_utf8Length = 1;
// work out the unicode point, and count the actual bytes.
// If a byte does not start with 10xxxxxx then it's not part of the
@ -112,8 +112,8 @@ void UTF8DocumentIterator::readCharacter()
result -= 0x10000;
m_utf16Length = 2;
// UTF-16 Pair
m_character[0] = 0xD800 + (result >> 10);
m_character[1] = 0xDC00 + (result & 0x3FF);
m_character[0] = static_cast<wchar_t>(0xD800 + (result >> 10));
m_character[1] = static_cast<wchar_t>(0xDC00 + (result & 0x3FF));
}
else

View File

@ -5,6 +5,7 @@
#include <iterator>
#include <vector>
#include "Platform.h"
#include "Position.h"
namespace Scintilla {
@ -13,17 +14,9 @@ class Document;
class UTF8DocumentIterator : public std::iterator<std::bidirectional_iterator_tag, wchar_t>
{
public:
UTF8DocumentIterator() :
m_doc(0),
m_pos(0),
m_end(0),
m_characterIndex(0),
m_utf8Length(0),
m_utf16Length(0)
{
}
UTF8DocumentIterator() {};
UTF8DocumentIterator(Document* doc, int pos, int end);
UTF8DocumentIterator(Document* doc, Sci::Position pos, Sci::Position end);
UTF8DocumentIterator(const UTF8DocumentIterator& copy);
bool operator == (const UTF8DocumentIterator& other) const
@ -41,7 +34,7 @@ public:
return m_character[m_characterIndex];
}
UTF8DocumentIterator& operator = (int other)
UTF8DocumentIterator& operator = (Sci::Position other)
{
m_pos = other;
return *this;
@ -50,7 +43,7 @@ public:
UTF8DocumentIterator& operator ++ ()
{
PLATFORM_ASSERT(m_pos < m_end);
if (2 == m_utf16Length && 0 == m_characterIndex)
if (m_utf16Length == 2 && m_characterIndex == 0)
{
m_characterIndex = 1;
}
@ -70,7 +63,7 @@ public:
UTF8DocumentIterator& operator -- ();
int pos() const
Sci::Position pos() const
{
return m_pos;
}
@ -84,13 +77,13 @@ private:
return m_pos >= m_end;
}
int m_pos;
Sci::Position m_pos = 0;
wchar_t m_character[2];
int m_characterIndex;
int m_end;
int m_utf8Length;
int m_utf16Length;
Document* m_doc;
int m_characterIndex = 0;
Sci::Position m_end = 0;
int m_utf8Length = 0;
int m_utf16Length = 0;
Document* m_doc = nullptr;
static const unsigned char m_firstByteMask[];
};

View File

@ -1,9 +0,0 @@
#include <stdio.h>
#include <boost/version.hpp>
int main(int argc, char* argv[])
{
printf("%s", BOOST_LIB_VERSION);
return 0;
}

View File

@ -1,30 +0,0 @@
# Make file for building getboostver
DIR_O=.\obj
DIR_BIN=.\bin
CC=cl
RC=rc
CXXNDEBUG=-O1 -MT -DNDEBUG -GL -nologo
LDFLAGS=-OPT:REF -LTCG -nologo
LIBS=KERNEL32.lib USER32.lib
CXXFLAGS=$(CXXNDEBUG)
!INCLUDE boostpath.mak
LDFLAGS=$(LDFLAGS)
CXXFLAGS=$(CXXFLAGS) -I$(BOOSTPATH)
# GDI32.lib IMM32.lib OLE32.LIB
ALL: clean $(DIR_BIN)\getboostver.exe
$(DIR_BIN)\getboostver.exe::
$(CC) $(CXXFLAGS) getboostver.cpp /link $(LDFLAGS) $(LIBS) /OUT:$(DIR_BIN)\getboostver.exe
clean:
-del /q $(DIR_BIN)\getboostver.exe

View File

@ -7,62 +7,36 @@
# Set your boost path (the root of where you've unpacked your boost zip).
# Boost is available from www.boost.org
!IF EXIST(..\boostregex\boostpath.mak)
!INCLUDE ..\boostregex\boostpath.mak
!IFDEF BOOSTPATH
!IFDEF BOOSTREGEXLIBPATH
SOBJS=\
$(SOBJS)\
$(DIR_O)\BoostRegexSearch.obj\
$(DIR_O)\UTF8DocumentIterator.obj
SCILEXOBJS=\
$(SCILEXOBJS)\
$(DIR_O)\BoostRegexSearch.obj\
$(DIR_O)\UTF8DocumentIterator.obj
LOBJS=\
$(LOBJS)\
$(DIR_O)\BoostRegexSearch.obj\
$(DIR_O)\UTF8DocumentIterator.obj
INCLUDEDIRS=$(INCLUDEDIRS) -I$(BOOSTPATH)
!IFDEF BUILDTARGETPATH
CXXFLAGS=$(CXXFLAGS) -DSCI_OWNREGEX
!ELSE
CXXFLAGS=$(CXXFLAGS) -DSCI_OWNREGEX -arch:IA32
!ENDIF
!IFDEF DEBUG
LDFLAGS=$(LDFLAGS) -LIBPATH:$(BOOSTLIBPATH)\debug\link-static\runtime-link-static\threading-multi
!ELSE
LDFLAGS=$(LDFLAGS) -LIBPATH:$(BOOSTLIBPATH)\release\$(BUILDTARGETPATH)link-static\runtime-link-static\threading-multi
!ENDIF
LDFLAGS=$(LDFLAGS) -LIBPATH:$(BOOSTREGEXLIBPATH)
$(DIR_O)\UTF8DocumentIterator.obj:: ../boostregex/UTF8DocumentIterator.cxx
$(CC) $(CXXFLAGS) -c ../boostregex/UTF8DocumentIterator.cxx
$(CC) $(CXXFLAGS) -D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS -c ../boostregex/UTF8DocumentIterator.cxx
$(DIR_O)\BoostRegexSearch.obj:: ../boostregex/BoostRegexSearch.cxx ../src/CharClassify.h ../src/RESearch.h
$(CC) $(CXXFLAGS) -c ../boostregex/BoostRegexSearch.cxx
!ELSE
!IFDEF NOBOOST
!MESSAGE Note: Building without Boost-Regex support.
!ELSE
!MESSAGE Note: It looks like you've not built boost yet.
!MESSAGE You can build boost::regex by running BuildBoost.bat
!MESSAGE from scintilla\BoostRegex directory with the path where
!MESSAGE you have extracted the boost archive (from www.boost.org)
!MESSAGE e.g.
!MESSAGE buildboost.bat d:\libs\boost_1_48_0
!MESSAGE
!MESSAGE If you want to build scintilla without Boost (and just
!MESSAGE use the limited built-in regular expressions),
!MESSAGE then run nmake again, with NOBOOST=1
!MESSAGE e.g.
!MESSAGE nmake NOBOOST=1 -f scintilla.mak
!MESSAGE
!ERROR Stopping build. Either build boost or specify NOBOOST=1
!ENDIF
$(CC) $(CXXFLAGS) -D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS -c ../boostregex/BoostRegexSearch.cxx
!ENDIF
!ENDIF

View File

@ -1,42 +0,0 @@
# This makefile should be included in the main scintilla.mak file,
# just after where LOBJS is defined (around line
#
# The following line should be added around line 211 of scintilla.mak
# !INCLUDE nppSpecifics.mak
# Set your boost path (the root of where you've unpacked your boost zip).
# Boost is available from www.boost.org
!IFDEF BOOSTPATH
!IFDEF BOOSTREGEXLIBPATH
SOBJS=\
$(SOBJS)\
$(DIR_O)\BoostRegexSearch.obj\
$(DIR_O)\UTF8DocumentIterator.obj
SCILEXOBJS=\
$(SCILEXOBJS)\
$(DIR_O)\BoostRegexSearch.obj\
$(DIR_O)\UTF8DocumentIterator.obj
LOBJS=\
$(LOBJS)\
$(DIR_O)\BoostRegexSearch.obj\
$(DIR_O)\UTF8DocumentIterator.obj
INCLUDEDIRS=$(INCLUDEDIRS) -I$(BOOSTPATH)
CXXFLAGS=$(CXXFLAGS) -DSCI_OWNREGEX -arch:IA32
LDFLAGS=$(LDFLAGS) -LIBPATH:$(BOOSTREGEXLIBPATH)
$(DIR_O)\UTF8DocumentIterator.obj:: ../boostregex/UTF8DocumentIterator.cxx
$(CC) $(CXXFLAGS) -c ../boostregex/UTF8DocumentIterator.cxx
$(DIR_O)\BoostRegexSearch.obj:: ../boostregex/BoostRegexSearch.cxx ../src/CharClassify.h ../src/RESearch.h
$(CC) $(CXXFLAGS) -c ../boostregex/BoostRegexSearch.cxx
!ENDIF
!ENDIF

View File

@ -27,8 +27,6 @@
#include <vector>
#include <assert.h>
//#include "Platform.h"
#include "ILexer.h"
#include "LexAccessor.h"
#include "PropSetSimple.h"
@ -54,13 +52,7 @@ static const char * const emptyWordListDesc[] = {
0
};
#ifdef NDEBUG
#define PLATFORM_ASSERT(c) ((void)0)
#else
#define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Scintilla::Platform::Assert(#c, __FILE__, __LINE__))
#endif
static void ColouriseSearchResultLine(SearchResultMarkings* pMarkings, char *lineBuffer/*, size_t lengthLine*/, size_t startLine, size_t endPos, Accessor &styler, int linenum)
static void ColouriseSearchResultLine(SearchResultMarkings* pMarkings, char *lineBuffer, size_t startLine, size_t endPos, Accessor &styler, int linenum)
{
// startLine and endPos are the absolute positions.
@ -76,21 +68,18 @@ static void ColouriseSearchResultLine(SearchResultMarkings* pMarkings, char *lin
{
const unsigned int firstTokenLen = 4;
unsigned int currentPos;
//PLATFORM_ASSERT(lengthLine >= firstTokenLen + 2);
styler.ColourTo(startLine + firstTokenLen, SCE_SEARCHRESULT_DEFAULT);
for (currentPos = firstTokenLen; lineBuffer[currentPos] != ':'; currentPos++)
{
//PLATFORM_ASSERT(currentPos < lengthLine);
// Just make currentPos mover forward
}
styler.ColourTo(startLine + currentPos - 1, SCE_SEARCHRESULT_LINE_NUMBER);
int currentStat = SCE_SEARCHRESULT_DEFAULT;
PLATFORM_ASSERT(linenum < pMarkings->_length);
SearchResultMarking mi = pMarkings->_markings[linenum];
currentPos += 2; // skip ": "
@ -122,21 +111,20 @@ static void ColouriseSearchResultDoc(Sci_PositionU startPos, Sci_Position length
SearchResultMarkings* pMarkings = NULL;
sscanf(addrMarkingsStruct, "%p", &pMarkings);
PLATFORM_ASSERT(pMarkings);
for (size_t i = startPos; i < startPos + length; i++) {
lineBuffer[linePos++] = styler[i];
if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
// End of line (or of line buffer) met, colourise it
lineBuffer[linePos] = '\0';
ColouriseSearchResultLine(pMarkings, lineBuffer/*, linePos*/, startLine, i, styler, styler.GetLine(startLine));
ColouriseSearchResultLine(pMarkings, lineBuffer, startLine, i, styler, styler.GetLine(startLine));
linePos = 0;
startLine = i + 1;
while (!AtEOL(styler, i)) i++;
}
}
if (linePos > 0) { // Last line does not have ending characters
ColouriseSearchResultLine(pMarkings, lineBuffer/*, linePos*/, startLine, startPos + length - 1, styler, styler.GetLine(startLine));
ColouriseSearchResultLine(pMarkings, lineBuffer, startLine, startPos + length - 1, styler, styler.GetLine(startLine));
}
}

View File

@ -23,7 +23,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#include <assert.h>
#include <windows.h>
//#include "Platform.h"
#include "ILexer.h"
#include "LexAccessor.h"
#include "Accessor.h"

View File

@ -243,7 +243,7 @@ SCILEXOBJS=\
# Otherwise boost's PCRE won't be included in the build
# For example:
# nmake BOOSTPATH=C:\sources\boost_1_70_0\ BOOSTREGEXLIBPATH=C:\tmp\scintilla.414\boostregex -f scintilla.mak
!INCLUDE ../boostregex/nppSpecifics2.mak
!INCLUDE ../boostregex/nppSpecifics.mak
$(DIR_O)\ScintRes.res : ScintRes.rc
$(RC) -fo$@ $**