From: Eric H. <eh...@co...> - 2005-12-05 15:30:08
|
Que es esto Scintilla? -----Original Message----- From: per...@li... [mailto:per...@li...] On Behalf Of per...@li... Sent: Sunday, December 04, 2005 10:34 PM To: per...@li... Subject: [SPAM-MAIL ] - Perl-Win32-GUI-Hackers digest, Vol 1 #239 - 2 msgs - Found word(s) remove list list error in the Text body Send Perl-Win32-GUI-Hackers mailing list submissions to per...@li... To subscribe or unsubscribe via the World Wide Web, visit =09 https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-hackers or, via email, send a message with subject or body 'help' to per...@li... You can reach the person managing the list at per...@li... When replying, please edit your Subject line so it is more specific than "Re: Contents of Perl-Win32-GUI-Hackers digest..." Today's Topics: 1. Re: Fixing Scintilla (Robert May) 2. Perl contexts [Was: Fixing Scintilla] (Robert May) --__--__-- Message: 1 Date: Sun, 04 Dec 2005 19:16:34 +0000 From: Robert May <rm...@po...> Reply-To: rm...@po... Organization: At Home To: Jeremy White <jez...@ho...> CC: per...@li... Subject: [perl-win32-gui-hackers] Re: Fixing Scintilla Jeremy White wrote: > I'm trying to fix Scintilla, with the aim of creating a new release of > this module. The problem is that Scintilla defines and uses it's own=20 > PERLWIN32GUI_USERDATA structure. As this structure has changed over time=20 > in Win32-GUI it creates all kinds of problems with this module=20 > (Scintilla subclasses Win32-GUI, and uses the PERLWIN32GUI_USERDATA=20 > structure passed to it by Win32-GUI). The most extreme behaviour is=20 > with perl 5.8.x where the Scintilla does not process events - there is > also cases where Scintilla crashes. >=20 > I've managed to get a build of Scintilla working, but I've got several > issues. Instead of defining it's own version of PERLWIN32GUI_USERDATA it=20 > now picks it up from GUI.h - which I think is the best solution (?). >=20 > 1) The original Scintilla: >=20 > #include "EXTERN.h" > #include "perl.h" > #include "XSUB.h" >=20 > #include <windows.h> > #include "./include/Scintilla.h" >=20 > changed to: >=20 > #include "../Win32-GUI/GUI.h" > #include "./include/Scintilla.h" >=20 > However, when compiling with VC I get two errors: >=20 > *** Using Preserved Perl context. >=20 > ../Win32-GUI/GUI.h(439) : error C2143: syntax error : missing ')' before=20 > '=3D' > ../Win32-GUI/GUI.h(439) : error C2072: 'DoHook' : initialization of a=20 > function > ../Win32-GUI/GUI.h(439) : error C2059: syntax error : ')' > ../Win32-GUI/GUI.h(809) : error C2059: syntax error : 'string' > NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code > '0x2' > Stop. >=20 > this is with the line: >=20 > void DoHook(NOTXSPROC LPPERLWIN32GUI_USERDATA perlud, UINT uMsg, WPARAM=20 > wParam, LPARAM lParam, int* PerlResult, int notify =3D 0); >=20 > removing " =3D 0" fixes that issue. At first glance these errors look like C++ vs. C syntax problems. I=20 haven't looked at the scintilla code, but it would be my guess that the=20 XS files is being compiled as C (this is the standard Makefile.PL=20 behaviour) whereas Win32::GUI (for reasons that escape me) is built=20 using a C++ compiler (see the override in Win32::GUI's Makefile.PL (sub=20 xs_c) that builds .cpp files from the XS rather than .c files). There are 2 approaches: (1) add the same override to Scintilla to get it to make .cpp files from the .xs, forcing the compilers into c++ mode,=20 (2) Fix up the Win32::GUI GUI.h file to work correctly with a standard C compiler. I thin that (2) if preferable, and it is one of my longer-term goals to=20 get Win32::GUI to use standard 'C' too. Standard 'C' does not allow defaulting of function parameters in the=20 prototype, so my solution here would be to remove the "=3D 0" from = GUI.h,=20 and modify the 2 calls to DoHook() in GUI_MessageLoops.cpp that don't=20 pass the last parameter to pass 0 explicitly. > The second error: >=20 > *** Using Preserved Perl context. >=20 > ../Win32-GUI/GUI.h(809) : error C2059: syntax error : 'string' > NMAKE : fatal error U1077: 'C:\WINDOWS\system32\cmd.exe' : return code > '0x2' > Stop. >=20 > this is with: >=20 > extern "C" BOOL WINAPI > GetWindowInfo( > HWND hwnd, > PWINDOWINFO pwi > ); >=20 > Commenting out this code removes the error. My fix would be to replace that code with #ifdef __cplusplus extern "C" #endif BOOL WINAPI GetWindowInfo( HWND hwnd, PWINDOWINFO pwi ); > 2) I'm confused about the Perl context and how it's used within=20 > Win32-GUI - and how Scintilla should handle things. >=20 > I've got it working by doing: >=20 > dTHX; /* fetch context */ >=20 > in the Scintilla event handlers, but had to remove NOTXSCALL/NOTXSPROC > in some functions where the context isn't used/needed. >=20 > If it would help, I can check in what I've got, with the idea of fixing=20 > things once I've got my head around these issues? I'm not overly familiar with this, but the concept is that a call to a C function that doesn't require perl context should look like a regular=20 C call; A call from an XS sub (or anywhere that has a perl context=20 pointer available) to a function that requires a perl context should be=20 defined with a first argument of NOTXACALL/NOTXSPROC macro (but with no=20 following comma). These macros defined the correct type of argument to pass the perl context. I can do more investigation and expand on this=20 if necessary. Regards, Rob. --__--__-- Message: 2 Date: Sun, 04 Dec 2005 20:21:24 +0000 From: Robert May <rm...@po...> Reply-To: rm...@po... Organization: At Home To: per...@li... CC: Jeremy White <jez...@ho...> Subject: [perl-win32-gui-hackers] Perl contexts [Was: Fixing Scintilla] >> 2) I'm confused about the Perl context and how it's used within=20 >> Win32-GUI - and how Scintilla should handle things. >> >> I've got it working by doing: >> >> dTHX; /* fetch context */ >> >> in the Scintilla event handlers, but had to remove NOTXSCALL/NOTXSPROC=20 >> in some functions where the context isn't used/needed. >> >> If it would help, I can check in what I've got, with the idea of=20 >> fixing things once I've got my head around these issues? >=20 >=20 > I'm not overly familiar with this, but the concept is that a call to a C=20 > function that doesn't require perl context should look like a regular C=20 > call; A call from an XS sub (or anywhere that has a perl context=20 > pointer available) to a function that requires a perl context should be=20 > defined with a first argument of NOTXACALL/NOTXSPROC macro (but with no=20 > following comma). These macros defined the correct type of argument to=20 > pass the perl context. I can do more investigation and expand on this > if necessary. OK, I've just scanned the perldoc perlguts section entitled "How=20 multiple interpreters and concurrency are supported". I think it's=20 reasonable to assume the following: You can always define PERL_NO_GET_CONTEXT - all modern perl's will=20 behave with this regardless of whether PERL_IMPLICIT_CONTEXT is defined=20 or not (although it is defined for current ActiveState Perl builds -=20 it's required for ithread support). Defining pTHX, pTHX_, aTHX, aTHX_=20 and dTHX are dealt with in perl.h and XSUB.h In Win32::GUI NOTXSPROC and NOTXSCALL are aliases for pTHX_ and aTHX_=20 respectively. Any other code in GUI.h is purely for backwards=20 compatibility with older perl's. Even the "\n*** Using an implicit Perl context.\n" section should not be necessary, as pTHX_ and aTHX_ should=20 deal with non-thread-capable perl builds. To understand how to use pTHX_ and aTHX_ correctly read perlguts - but=20 for consistency with Win32::GUI I would recommend using NOTXSPROC and=20 NOTXSCALL macros in their place. [ I've added a note to myself to look for all the places that we use=20 dTHX and to ensure that they are necessary - I think they are used when=20 we get a win32 api callback such that we can't use the NOTXSPROC calling convention ] I hope this helps. Rob. --__--__-- _______________________________________________ Perl-Win32-GUI-Hackers mailing list Per...@li... https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-hackers http://perl-win32-gui.sourceforge.net/ End of Perl-Win32-GUI-Hackers Digest |