Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: [patch] Re: UTF-8 and PCRE and metafy

On Fri, 21 Oct 2011 05:56:25 -0400
Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx> wrote:
> On 2011-03-08 at 09:58 +0000, Peter Stephenson wrote:
> > On Tue, 8 Mar 2011 01:52:16 -0500
> > Phil Pennock <zsh-workers+phil.pennock@xxxxxxxxxxxx> wrote:
> > > I'm guessing I need a bunch of calls to metafy() to process the
> > > results of extraction in zpcre_get_substrings() ?
> > 
> > You'll need to unmetafy any string getting passed into
> > pcre_get_substring_list() and metafy() the resulting captures coming
> > out.  You should duplicate any string that needs unmetafying, since
> > otherwise it's in place and you may need the metafied form later (you do
> > for the string passed in as the first argument).
> Okay, it took me far too long to get back around to this, sorry. :(
> Attached is what looks to me to be a correct patch.

I didn't look through in great detail, so I haven't validated the
structure, but certainly what I saw looked fine
> I'm not sure on when I should be using the wcs_strdup() functions and
> the like; what I've got appears to work.  None of what I've added
> appears to be specific to UTF-8.

You probably don't need wcs_strdup().  When metafied, normals str*
functions work because the NULLs are converted to Meta + space; when not
metafied you should the length around in a variable and can use mem*
> Is it reasonable to add tests to D07multibyte.ztst for this, with the
> zsh/pcre dependency?

You'd probably need to encapsulate it within a test for loading the
library, given which it's probably easier just to copy D07multibyte.ztst
and add to the prerequisites a test for loading zsh/pcre at that point,
which ought to be easy.
Peter Stephenson <p.w.stephenson@xxxxxxxxxxxx>
Web page now at http://homepage.ntlworld.com/p.w.stephenson/

Messages sorted by: Reverse Date, Date, Thread, Author