Hi,
ParseRegExp can't correctly handle the following script on both Linux (Mandrake-9.1) and Windows (Win2000).
-------------------------------------
use Inline (C => Config =>
BUILD_NOISY => 1,
CLEAN_AFTER_BUILD => 0,
USING => "ParseRegExp",
);
use Inline C => <<'EOC';
SV * sum_it(SV * a, SV * b) { printf("Adding\n"); return newSViv(SvIV(a) + SvIV(b)); }
SV * times_it(SV * a, SV * b) { printf("Multiplying\n"); return newSViv(SvIV(a) * SvIV(b)); }
EOC
print sum_it(2, 7), "\n", times_it(3, 6), "\n"; -------------------------------------
The 'times_it' argument list never makes it into the XS file, and, although compilation succeeds, I get the following runtime error:
Can't locate auto/main/times_it.al in @INC (@INC contains: /home/rob/pscrpt/inline/_Inline/lib /usr/local/lib/perl5/5.8.3/i686-linux /usr/local/lib/perl5/5.8.3 /usr/local/lib/perl5/site_perl/5.8.3/i686-linux /usr/local/lib/perl5/site_perl/5.8.3 /usr/local/lib/perl5/site_perl/5.8.0/i686-linux /usr/local/lib/perl5/site_perl/5.8.0 /usr/local/lib/perl5/site_perl .) at break.pl line 21
If I remove (or comment out) either one (or both) of the 'printf()' statements, then the script runs perfectly.
Hopefully we have a regex guru here who can tell us why this happens, and how to fix it.
My scripts tend to include quite a few 'printf()' statements when it comes to debugging :-)
Cheers, Rob
Just as a follow-up, I took Ingy's advice and queried Mitchell about this problem, but didn't receive a reply. I guess Mitchell is either busy with other stuff, or the address that I used is no longer valid. (I used the address given at the end of the Inline::C::ParseRegExp documentation.)
I haven't really investigated the problem. As a fix I commented out the following line of code from Inline/C/ParseRegExp.pm:
$code =~ s/$RE_quoted/\"\"/go;
That seems to have fixed the problem for me. I would think that removing that line would leave me susceptible to some other breakage, but so far that has not happened. The "build parse stage" which used to take up to 3 minutes with ParseRecDescent for certain largish tasks, now invariably completes in less than a second - which is a definite improvement :-)
Cheers, Rob
--
Any emails containing attachments will be deleted from my ISP's mail server before I even get to see them. If you wish to email me an attachment, please provide advance warning so that I can make the necessary arrangements.