diff options
-rw-r--r-- | doc/ScintillaHistory.html | 8 | ||||
-rw-r--r-- | include/ILexer.h | 48 | ||||
-rw-r--r-- | include/Sci_Position.h | 21 | ||||
-rw-r--r-- | include/Scintilla.h | 16 |
4 files changed, 63 insertions, 30 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 773a376bf..98ae1dfbb 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -492,6 +492,14 @@ Released 20 June 2015. </li> <li> + External interfaces use the Sci_Position and Sci_PositionU typedefs instead of int and unsigned int + to allow for changes to a 64-bit interface on 64-bit plactforms in the future. + Applications and external lexers should start using the new type names so that + they will be compatible when the 64-bit change occurs. + There is also Sci_PositionCR (long) for use in the Sci_CharacterRange struct which will + also eventually become 64-bit. + </li> + <li> Multiple selection now works over more key commands. The new multiple-selection handling commands include horizontal movement and selection commands, line up and down movement and selection commands, word and line deletion commands, and diff --git a/include/ILexer.h b/include/ILexer.h index b90092750..f01029178 100644 --- a/include/ILexer.h +++ b/include/ILexer.h @@ -8,6 +8,8 @@ #ifndef ILEXER_H #define ILEXER_H +#include "Sci_Position.h" + #ifdef SCI_NAMESPACE namespace Scintilla { #endif @@ -24,32 +26,32 @@ class IDocument { public: virtual int SCI_METHOD Version() const = 0; virtual void SCI_METHOD SetErrorStatus(int status) = 0; - virtual int SCI_METHOD Length() const = 0; - virtual void SCI_METHOD GetCharRange(char *buffer, int position, int lengthRetrieve) const = 0; - virtual char SCI_METHOD StyleAt(int position) const = 0; - virtual int SCI_METHOD LineFromPosition(int position) const = 0; - virtual int SCI_METHOD LineStart(int line) const = 0; - virtual int SCI_METHOD GetLevel(int line) const = 0; - virtual int SCI_METHOD SetLevel(int line, int level) = 0; - virtual int SCI_METHOD GetLineState(int line) const = 0; - virtual int SCI_METHOD SetLineState(int line, int state) = 0; - virtual void SCI_METHOD StartStyling(int position, char mask) = 0; - virtual bool SCI_METHOD SetStyleFor(int length, char style) = 0; - virtual bool SCI_METHOD SetStyles(int length, const char *styles) = 0; + virtual Sci_Position SCI_METHOD Length() const = 0; + virtual void SCI_METHOD GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const = 0; + virtual char SCI_METHOD StyleAt(Sci_Position position) const = 0; + virtual Sci_Position SCI_METHOD LineFromPosition(Sci_Position position) const = 0; + virtual Sci_Position SCI_METHOD LineStart(Sci_Position line) const = 0; + virtual int SCI_METHOD GetLevel(Sci_Position line) const = 0; + virtual int SCI_METHOD SetLevel(Sci_Position line, int level) = 0; + virtual int SCI_METHOD GetLineState(Sci_Position line) const = 0; + virtual int SCI_METHOD SetLineState(Sci_Position line, int state) = 0; + virtual void SCI_METHOD StartStyling(Sci_Position position, char mask) = 0; + virtual bool SCI_METHOD SetStyleFor(Sci_Position length, char style) = 0; + virtual bool SCI_METHOD SetStyles(Sci_Position length, const char *styles) = 0; virtual void SCI_METHOD DecorationSetCurrentIndicator(int indicator) = 0; - virtual void SCI_METHOD DecorationFillRange(int position, int value, int fillLength) = 0; - virtual void SCI_METHOD ChangeLexerState(int start, int end) = 0; + virtual void SCI_METHOD DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength) = 0; + virtual void SCI_METHOD ChangeLexerState(Sci_Position start, Sci_Position end) = 0; virtual int SCI_METHOD CodePage() const = 0; virtual bool SCI_METHOD IsDBCSLeadByte(char ch) const = 0; virtual const char * SCI_METHOD BufferPointer() = 0; - virtual int SCI_METHOD GetLineIndentation(int line) = 0; + virtual int SCI_METHOD GetLineIndentation(Sci_Position line) = 0; }; class IDocumentWithLineEnd : public IDocument { public: - virtual int SCI_METHOD LineEnd(int line) const = 0; - virtual int SCI_METHOD GetRelativePosition(int positionStart, int characterOffset) const = 0; - virtual int SCI_METHOD GetCharacterAndWidth(int position, int *pWidth) const = 0; + virtual Sci_Position SCI_METHOD LineEnd(Sci_Position line) const = 0; + virtual Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const = 0; + virtual int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const = 0; }; enum { lvOriginal=0, lvSubStyles=1 }; @@ -61,11 +63,11 @@ public: 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 int SCI_METHOD PropertySet(const char *key, const char *val) = 0; + virtual Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) = 0; virtual const char * SCI_METHOD DescribeWordListSets() = 0; - virtual int SCI_METHOD WordListSet(int n, const char *wl) = 0; - virtual void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0; - virtual void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 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; }; @@ -87,7 +89,7 @@ class ILoader { public: virtual int SCI_METHOD Release() = 0; // Returns a status code from SC_STATUS_* - virtual int SCI_METHOD AddData(char *data, int length) = 0; + virtual int SCI_METHOD AddData(char *data, Sci_Position length) = 0; virtual void * SCI_METHOD ConvertToDocument() = 0; }; diff --git a/include/Sci_Position.h b/include/Sci_Position.h new file mode 100644 index 000000000..a83e2864f --- /dev/null +++ b/include/Sci_Position.h @@ -0,0 +1,21 @@ +// Scintilla source code edit control +/** @file Sci_Position.h + ** Define the Sci_Position type used in Scintilla's external interfaces. + ** These need to be available to clients written in C so are not in a C++ namespace. + **/ +// Copyright 2015 by Neil Hodgson <neilh@scintilla.org> +// The License.txt file describes the conditions under which this software may be distributed. + +#ifndef SCI_POSITION_H +#define SCI_POSITION_H + +// Basic signed type used throughout interface +typedef int Sci_Position; + +// Unsigned variant used for ILexer::Lex and ILexer::Fold +typedef unsigned int Sci_PositionU; + +// For Sci_CharacterRange which is defined as long to be compatible with Win32 CHARRANGE +typedef long Sci_PositionCR; + +#endif diff --git a/include/Scintilla.h b/include/Scintilla.h index bc2b5080d..4db2e0dde 100644 --- a/include/Scintilla.h +++ b/include/Scintilla.h @@ -11,6 +11,8 @@ #ifndef SCINTILLA_H #define SCINTILLA_H +#include "Sci_Position.h" + #ifdef __cplusplus extern "C" { #endif @@ -1070,8 +1072,8 @@ namespace Scintilla { #endif struct Sci_CharacterRange { - long cpMin; - long cpMax; + Sci_PositionCR cpMin; + Sci_PositionCR cpMax; }; struct Sci_TextRange { @@ -1124,7 +1126,7 @@ struct Sci_NotifyHeader { struct SCNotification { struct Sci_NotifyHeader nmhdr; - int position; + Sci_Position position; /* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, */ /* SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, */ /* SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, */ @@ -1142,12 +1144,12 @@ struct SCNotification { const char *text; /* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_URIDROPPED */ - int length; /* SCN_MODIFIED */ - int linesAdded; /* SCN_MODIFIED */ + Sci_Position length; /* SCN_MODIFIED */ + Sci_Position linesAdded; /* SCN_MODIFIED */ int message; /* SCN_MACRORECORD */ uptr_t wParam; /* SCN_MACRORECORD */ sptr_t lParam; /* SCN_MACRORECORD */ - int line; /* SCN_MODIFIED */ + Sci_Position line; /* SCN_MODIFIED */ int foldLevelNow; /* SCN_MODIFIED */ int foldLevelPrev; /* SCN_MODIFIED */ int margin; /* SCN_MARGINCLICK */ @@ -1155,7 +1157,7 @@ struct SCNotification { int x; /* SCN_DWELLSTART, SCN_DWELLEND */ int y; /* SCN_DWELLSTART, SCN_DWELLEND */ int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */ - int annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */ + Sci_Position annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */ int updated; /* SCN_UPDATEUI */ int listCompletionMethod; /* SCN_AUTOCSELECTION, SCN_AUTOCCOMPLETED, SCN_USERLISTSELECTION, */ |