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

Re: libzglob?



> has there been any talk / thought / action as to separate the zsh
> globbing code into its own library?  (as Zle nowadays seems to be,
> sort of)

glob.c is quite independent of the rest of the code, I think it would not
be hard to make it a standalone library.

> I realize that this is not trivial because the glob.c seems to
> use a lot of general zsh structs and call other zsh functions,
> ansi2knr, makepro.sh, for some things it may be useful to use

ansi2knr is only needed for very old traditional compilers which cannot
compile programs with ANSI C prototypes.  Makepro is just a simple
prototype generator.

> If this happens I can see one zsh API change need right now: glob()
> should be 'thread-safe' in that the various glob options should be
> passed in as arguments (a bitmask? a struct?) instead of being part of
> the 'global' zsh state -- as there is no zsh opts[] if only the glob
> lib is being used.

There are several static variables used by glob.c, so if you want real
re-entrant glob, more changes are necessary.

The scanner in zsh glob can be used for perl, however the pattern
matching part has some problems.  One for example is that (ab#)# does not
match ab.  For perl, a zsh glob -> regexp translator would be much more
roboust and relyable.

Zoltan



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