Migration guide to Scintilla 5 with Lexilla

57 views
Skip to first unread message

Neil Hodgson

unread,
Mar 15, 2021, 10:53:54 PM3/15/21
to Scintilla mailing list
   I have written and uploaded a guide to migrating applications to Scintilla 5 using Lexilla.

   Neil

Mitchell

unread,
Mar 26, 2021, 11:32:09 PM3/26/21
to scintilla...@googlegroups.com
Hi Neil,

On Tue, 16 Mar 2021 13:53:47 +1100
"'Neil Hodgson' via scintilla-interest" <scintilla...@googlegroups.com> wrote:

> I have written and uploaded a guide to migrating applications to Scintilla 5 using Lexilla.
> https://www.scintilla.org/Scintilla5Migration.html <https://www.scintilla.org/Scintilla5Migration.html>

This looks good. The only issue I ran into was on the C side -- I got a compiler warning when trying to compile:

CallScintilla(scintilla, SCI_SETILEXER, 0, pLexer);

For me, it's trying to cast void* to sptr_t. I needed a cast:

CallScintilla(scintilla, SCI_SETILEXER, 0, (sptr_t)pLexer);

I'm not sure how CallScintilla is defined for other platforms, but for my curses platform, the last argument is sptr_t.

Cheers,
Mitchell

Lex Trotman

unread,
Mar 27, 2021, 1:45:34 AM3/27/21
to scintilla...@googlegroups.com
On Sat, 27 Mar 2021 at 13:32, Mitchell <li...@triplequasar.com> wrote:
>
> Hi Neil,
>
> On Tue, 16 Mar 2021 13:53:47 +1100
> "'Neil Hodgson' via scintilla-interest" <scintilla...@googlegroups.com> wrote:
>
> > I have written and uploaded a guide to migrating applications to Scintilla 5 using Lexilla.
> > https://www.scintilla.org/Scintilla5Migration.html <https://www.scintilla.org/Scintilla5Migration.html>
>
> This looks good. The only issue I ran into was on the C side -- I got a compiler warning when trying to compile:

Yeah, some compilers are trying to be linters as well and give
warnings about no explicit cast of void* :(

>
> CallScintilla(scintilla, SCI_SETILEXER, 0, pLexer);
>
> For me, it's trying to cast void* to sptr_t. I needed a cast:
>
> CallScintilla(scintilla, SCI_SETILEXER, 0, (sptr_t)pLexer);
>
> I'm not sure how CallScintilla is defined for other platforms, but for my curses platform, the last argument is sptr_t.

Since its exported by Scintilla.h I expect most C users use it, eg Geany does.

Cheers
Lex

>
> Cheers,
> Mitchell
>
> --
> You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-inter...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/scintilla-interest/20210326233158.d6f57a908e690d6d1dc5956f%40triplequasar.com.

Neil Hodgson

unread,
Mar 27, 2021, 6:09:38 PM3/27/21
to Scintilla mailing list
Mitchell:

> This looks good. The only issue I ran into was on the C side -- I got a compiler warning when trying to compile:
>
> CallScintilla(scintilla, SCI_SETILEXER, 0, pLexer);
>
> For me, it's trying to cast void* to sptr_t. I needed a cast:
>
> CallScintilla(scintilla, SCI_SETILEXER, 0, (sptr_t)pLexer);
>
> I'm not sure how CallScintilla is defined for other platforms, but for my curses platform, the last argument is sptr_t.

Since pointers generally go in the last ‘lParam’ parameter, it can be worthwhile defining a short ‘call with pointer’ function. That can also warn when an integer is given to a pointer API.

Neil
Reply all
Reply to author
Forward
0 new messages