Hi,
char101 wrote:
> On Apr 1, 3:53 pm, "Xiaozhou Liu" <[EMAIL PROTECTED]> wrote:
>> The attached patch represents the current status of my work on the new
>> NFA based regexp engine, from last summer's GSoC project, mentored by
>> Russ Cox. I have been using this new engine myself for quite some time
>> now, so I feel it's ready for a wider review audience.
>
> The patch does not work with Visual C++ 9.0 2008. The main problem is
> this macros
>
> +#define PUSH(s) { \
> + if (stackp >= stack_end)\
> + return NULL; \
> + *stackp++ = s; \
> + }
> +
> +#define POP() ({ \
> + if (stackp <= stack) \
> + return NULL; \
> + *--stackp; \
> + })
>
> But even though I have changed those macros to
>
> #define PUSH(s) if (stackp >= stack_end) return NULL; *stackp =
> s; ++stackp;
> #define POP(var) if (stackp <= stack) return NULL; --stackp; var
> = *stackp;
>
> the resulting gvim executable seems to be losing its regex capability,
> for example typing abc and then searching for a does not work.
I don't see a difference in meaning between "*stackp++ = s;" and
"*stackp = s; ++stackp;" and I don't know anything about the context or
usage of the original patch, but your change might break existing code,
e.g.,
if ( test )
PUSH(anything)
will expand differently because of the missing braces.
Actually, I would write macros that expand to multiple statements as
#define PUSH(s) do { \
if (stackp >= stack_end)\
return NULL; \
*stackp++ = s; \
} while (0)
#define POP() do { \
if (stackp <= stack) \
return NULL; \
*--stackp; \
} while (0)
so they can always be used like in
if ( test )
PUSH(anything);
(note the additional semicolon), which is more in accordance with the
normal C syntax.
Regards,
Jürgen
--
Sometimes I think the surest sign that intelligent life exists elsewhere
in the universe is that none of it has tried to contact us. (Calvin)
--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---