Mathias Michaelis wrote:

> > Patch 7.0.044
> > Problem:  Perl: setting a buffer line in another buffer may result in
> >           changing the current buffer.
> > Solution: Properly change to the buffer to be changed.
> > Files:    src/if_perl.xs
> > 
> > [...]
> >
> Alas, if I want to compile this, I get the following output
> 
> ---%<---
>       "C:\Program Files\ActivePerl\Bin\perl" "C:\Program 
> Files\ActivePerl\lib\ExtUtils\xsubpp" -prototypes -typemap "C:\Program 
> Files\ActivePerl\lib\ExtUtils\typemap"  -typemap typemap if_perl.xs > 
> if_perl.c
>       cl -c /W3 /nologo  -D_MT -MT -I. -Iproto -DHAVE_PATHDEF -DWIN32  
> -DFEAT_SNIFF -DFEAT_CSCOPE -DFEAT_NETBEANS_INTG   -DFEAT_XPM_W32   
> -DWINVER=0x0500 -D_WIN32_WINNT=0x0500  /Fo.\ObjGOL/ /Ox -DNDEBUG /G6 
> -DFEAT_OLE -DFEAT_MBYTE_IME -DDYNAMIC_IME
> -DGLOBAL_IME -DFEAT_MBYTE -DFEAT_GUI_W32 -DDYNAMIC_ICONV -DDYNAMIC_GETTEXT 
> -DFEAT_PERL -DDYNAMIC_PERL -DDYNAMIC_PERL_DLL=\"perl58.dll\" -DFEAT_HUGE /Zi 
> /Fd.\ObjGOL/ /I "C:\Program Files\ActivePerl\Lib\Core" if_perl.c
> cl : Command line warning D9002 : ignoring unknown option '/G6'
> if_perl.c
> if_perl.xs(1075) : error C2275: 'buf_T' : illegal use of this type as an 
> expression
>         c:\software\vim\vim70\src\structs.h(1133) : see declaration of 'buf_T'
> if_perl.xs(1075) : error C2065: 'save_curbuf' : undeclared identifier
> if_perl.xs(1088) : warning C4047: '=' : 'buf_T *' differs in levels of 
> indirection from 'int'
> if_perl.xs(1089) : warning C4047: '=' : 'buf_T *' differs in levels of 
> indirection from 'int'
> if_perl.xs(1187) : error C2275: 'buf_T' : illegal use of this type as an 
> expression
>         c:\software\vim\vim70\src\structs.h(1133) : see declaration of 'buf_T'
> if_perl.xs(1200) : warning C4047: '=' : 'buf_T *' differs in levels of 
> indirection from 'int'
> if_perl.xs(1201) : warning C4047: '=' : 'buf_T *' differs in levels of 
> indirection from 'int'
> NMAKE : fatal error U1077: 'cl' : return code '0x2'
> Stop.
> --->%---
> 
> I inspected if_perl.xs and if_perl.c and saw that xsubpp simply removed
> preprocessor directives such as
> 
> > !     #ifdef FEAT_AUTOCMD
> >
> 
> out of the code without really make a decision between the #if or #else:
> Both parts were left.

I missed this, it compiles OK for me even though the code is wrong.
Note that I put some white space before the # to make it work for me.

> I then found
> 
> http://perldoc.perl.org/perlxs.html#Inserting-POD%2c-Comments-and-C-Preprocessor-Directives

But that mentions that the preprocessor directives are passed on
unmodified...  That isn't so, this documentation is wrong.

Your solution to duplicate the functions is not nice.  Further changes
must be made in two places, that's asking for trouble.

I suppose implementing aucmd_prepbuf() for when FEAT_AUTOCMD is not
defined would be a better solution.

-- 
>From "know your smileys":
 <|-) Chinese
 <|-( Chinese and doesn't like these kind of jokes

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

Reply via email to