develooper Front page | perl.perl5.porters | Postings from January 2003

Re: Checking if regex matches from XS

Thread Previous | Thread Next
From:
Nick Ing-Simmons
Date:
January 19, 2003 08:32
Subject:
Re: Checking if regex matches from XS
Message ID:
20030119163216.5159.8@bactrian.ni-s.u-net.com
Dave Rolsky <autarch@urth.org> writes:
>I've read the Jenness/Cozens book and the various perldocs on XS, but I
>can find no hint of how to use the regex engine from XS.

It is tricky and risky - trying to use perl's regex engine 
to subsitute for Tcl's is one of the recurring porting issues 
with perl/Tk.

The main snag (as I recall) is that in perl you need an "OP" in order
to call some of regex engine.

>
>What I want to do is accept an SV containing either qr/.../ or regular
>string, and then check whether the specified regex matches the contents of
>another SV.
>
>If someone knows of a module that does this in XS, I'd be happy to be
>pointed at it.  Otherwise more explicit hints are welcome ;)
>
>Poking through the internals, I see the Perl_pregexec function in
>regexec.c, which seems like a likely start, but what the heck are the
>arguments?  What's screamer?  And how do I turn an SV into a regexp
>struct?
>
>Help!

Unless you _really_ need this I strongly recommend writing the 
"leaf" functions for this in perl and perl_call_sv()-ing them from your
XS code.

Unless Hugo wants to give us a clean interface?



>
>
>-dave
>
>/*=======================
>House Absolute Consulting
>www.houseabsolute.com
>=======================*/
-- 
Nick Ing-Simmons
http://www.ni-s.u-net.com/


Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About