Skip to content

Commit 9d26931

Browse files
authored
Npp 8.3 interface (#221)
* - add n++ 8.3 interface files - adapt generated code therefore regarding textrange - fixed some compiler/intellisense warnings ScintillaWrapper.cpp - format code in TestRunner.cpp * use Sci_Position for position at Scintilla.iface * avoid compiler warning
1 parent b09ab67 commit 9d26931

16 files changed

+220
-196
lines changed

NppPlugin/include/Common.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ class WcharMbcsConvertor final
9494
return instance;
9595
}
9696

97-
const wchar_t * char2wchar(const char *mbStr, UINT codepage, int lenIn=-1, int *pLenOut=NULL, int *pBytesNotProcessed=NULL);
98-
const wchar_t * char2wchar(const char *mbcs2Convert, UINT codepage, int *mstart, int *mend);
99-
const char * wchar2char(const wchar_t *wcStr, UINT codepage, int lenIn = -1, int *pLenOut = NULL);
100-
const char * wchar2char(const wchar_t *wcStr, UINT codepage, long *mstart, long *mend);
97+
const wchar_t * char2wchar(const char *mbStr, size_t codepage, int lenMbcs =-1, int* pLenOut=NULL, int* pBytesNotProcessed=NULL);
98+
const wchar_t * char2wchar(const char *mbcs2Convert, size_t codepage, intptr_t* mstart, intptr_t* mend);
99+
const char * wchar2char(const wchar_t *wcStr, size_t codepage, int lenIn = -1, int* pLenOut = NULL);
100+
const char * wchar2char(const wchar_t *wcStr, size_t codepage, intptr_t* mstart, intptr_t* mend);
101101

102-
const char * encode(UINT fromCodepage, UINT toCodepage, const char *txt2Encode, int lenIn=-1, int *pLenOut=NULL, int *pBytesNotProcessed=NULL)
102+
const char * encode(UINT fromCodepage, UINT toCodepage, const char *txt2Encode, int lenIn = -1, int* pLenOut=NULL, int* pBytesNotProcessed=NULL)
103103
{
104104
int lenWc = 0;
105105
const wchar_t * strW = char2wchar(txt2Encode, fromCodepage, lenIn, &lenWc, pBytesNotProcessed);

NppPlugin/include/DockingDlgInterface.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ protected :
9494
generic_string _pluginName;
9595
bool _isClosed = false;
9696

97-
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
97+
virtual intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) {
9898
switch (message)
9999
{
100100
case WM_ERASEBKGND:

NppPlugin/include/Notepad_plus_msgs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ enum LangType {L_TEXT, L_PHP , L_C, L_CPP, L_CS, L_OBJC, L_JAVA, L_RC,\
3838
L_EXTERNAL};
3939

4040
enum winVer{ WV_UNKNOWN, WV_WIN32S, WV_95, WV_98, WV_ME, WV_NT, WV_W2K, WV_XP, WV_S2003, WV_XPX64, WV_VISTA, WV_WIN7, WV_WIN8, WV_WIN81, WV_WIN10 };
41-
enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64 };
41+
enum Platform { PF_UNKNOWN, PF_X86, PF_X64, PF_IA64, PF_ARM64 };
4242

4343

4444

NppPlugin/include/Sci_Position.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,12 @@
1515
typedef ptrdiff_t Sci_Position;
1616

1717
// Unsigned variant used for ILexer::Lex and ILexer::Fold
18+
// Definitions of common types
1819
typedef size_t Sci_PositionU;
1920

21+
2022
// For Sci_CharacterRange which is defined as long to be compatible with Win32 CHARRANGE
21-
typedef long Sci_PositionCR;
23+
typedef intptr_t Sci_PositionCR;
2224

2325
#ifdef _WIN32
2426
#define SCI_METHOD __stdcall

NppPlugin/include/Scintilla.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1279,12 +1279,12 @@ struct SCNotification {
12791279
};
12801280

12811281
struct SearchResultMarking {
1282-
long _start;
1283-
long _end;
1282+
intptr_t _start;
1283+
intptr_t _end;
12841284
};
12851285

12861286
struct SearchResultMarkings {
1287-
long _length;
1287+
intptr_t _length;
12881288
SearchResultMarking *_markings;
12891289
};
12901290

NppPlugin/include/StaticDialog.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ public :
6969

7070
protected:
7171
RECT _rc = { 0 };
72-
static INT_PTR CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
73-
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) = 0;
72+
static intptr_t CALLBACK dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
73+
virtual intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) = 0;
7474

7575
HGLOBAL makeRTLResource(int dialogID, DLGTEMPLATE **ppMyDlgTemplate);
7676
};

NppPlugin/project/NppPlugin.vcxproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,13 @@
197197
<ClInclude Include="..\include\DockingDlgInterface.h" />
198198
<ClInclude Include="..\include\dockingResource.h" />
199199
<ClInclude Include="..\include\keys.h" />
200+
<ClInclude Include="..\include\menuCmdID.h" />
200201
<ClInclude Include="..\include\Notepad_plus_msgs.h" />
202+
<ClInclude Include="..\include\NppDarkMode.h" />
201203
<ClInclude Include="..\include\PluginInterface.h" />
204+
<ClInclude Include="..\include\SciLexer.h" />
205+
<ClInclude Include="..\include\Scintilla.h" />
206+
<ClInclude Include="..\include\Sci_Position.h" />
202207
<ClInclude Include="..\include\StaticDialog.h" />
203208
<ClInclude Include="..\include\SysMsg.h" />
204209
<ClInclude Include="..\include\Window.h" />

NppPlugin/project/NppPlugin.vcxproj.filters

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,21 @@
5959
<ClInclude Include="..\stdafx.h">
6060
<Filter>Header Files</Filter>
6161
</ClInclude>
62+
<ClInclude Include="..\include\menuCmdID.h">
63+
<Filter>Header Files</Filter>
64+
</ClInclude>
65+
<ClInclude Include="..\include\NppDarkMode.h">
66+
<Filter>Header Files</Filter>
67+
</ClInclude>
68+
<ClInclude Include="..\include\Sci_Position.h">
69+
<Filter>Header Files</Filter>
70+
</ClInclude>
71+
<ClInclude Include="..\include\SciLexer.h">
72+
<Filter>Header Files</Filter>
73+
</ClInclude>
74+
<ClInclude Include="..\include\Scintilla.h">
75+
<Filter>Header Files</Filter>
76+
</ClInclude>
6277
</ItemGroup>
6378
<ItemGroup>
6479
<None Include="ReadMe.txt" />

NppPlugin/src/StaticDialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ void StaticDialog::create(int dialogID, bool isRTL, bool msgDestParent)
235235
::SendMessage(msgDestParent ? _hParent : (::GetParent(_hParent)), NPPM_MODELESSDIALOG, MODELESSDIALOGADD, reinterpret_cast<WPARAM>(_hSelf));
236236
}
237237

238-
INT_PTR CALLBACK StaticDialog::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
238+
intptr_t CALLBACK StaticDialog::dlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
239239
{
240240
switch (message)
241241
{

PythonScript.Tests/TestRunner.cpp

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@ void deleteEntry(NppPythonScript::ReplaceEntry* entry)
1313

1414
void runReplace()
1515
{
16-
17-
NppPythonScript::Replacer<NppPythonScript::Utf8CharTraits> replacer;
16+
NppPythonScript::Replacer<NppPythonScript::Utf8CharTraits> replacer;
1817
std::list<NppPythonScript::ReplaceEntry* > entries;
1918
bool moreEntries = replacer.startReplace("aaabbbaaabb", 12, 0, 0, "(b+)", "x$1x", NppPythonScript::python_re_flag_normal, entries);
2019
ASSERT_EQ(2, entries.size());
@@ -26,26 +25,26 @@ void runReplace()
2625
int main(int argc, char* argv[])
2726
{
2827
#ifdef _DEBUG
29-
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
30-
_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
31-
_CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );
32-
_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
33-
_CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT );
34-
_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
35-
_CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );
28+
_CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
29+
_CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE );
30+
_CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT );
31+
_CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE );
32+
_CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT );
33+
_CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE );
34+
_CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT );
3635
_CrtMemState state;
3736
_CrtMemCheckpoint(&state);
3837
#endif
39-
38+
4039

4140
::testing::InitGoogleTest(&argc, argv);
4241
RUN_ALL_TESTS();
43-
42+
4443
// This function call is used to check if we've created memory leaks using startReplace
4544
// Gtest creates various static objects, so it can be a bit tricky to identify leaks with Gtest running
46-
// It's left commented out as it normally serves no purpose. If it looks like there's leaks, then remove the
45+
// It's left commented out as it normally serves no purpose. If it looks like there's leaks, then remove the
4746
// test code above, and uncomment this runReplace() call to try to identify the source of the leak.
48-
// runReplace();
47+
// runReplace();
4948

5049
#ifdef _DEBUG
5150
_CrtMemDumpAllObjectsSince(&state);

0 commit comments

Comments
 (0)