[Cogl] [PATCH 3/5] Add a simple internal regular expression parser

Robert Bragg robert at sixbynine.org
Tue Apr 3 09:00:25 PDT 2012


On Tue, Mar 27, 2012 at 5:56 PM, Neil Roberts <neil at linux.intel.com> wrote:
> This adds a function which can match a string against a simple form of
> regular expressions. The regular expression is parsed into a tree
> structure and then tried against every position in the string. The
> parser does not support backtracking or capturing and only has a
> limited set of operators. This will be used as a convenient way to
> match patterns on the values from glGetString to determine driver
> specific workarounds. GRegex is not used to avoid having to pull in a
> large dependency when --disable-glib is used.
> ---
>  cogl/Makefile.am            |    2 +
>  cogl/cogl-mini-re-private.h |   67 +++++
>  cogl/cogl-mini-re.c         |  558 +++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 627 insertions(+), 0 deletions(-)
>  create mode 100644 cogl/cogl-mini-re-private.h
>  create mode 100644 cogl/cogl-mini-re.c
>

Although this is pretty neat, when we talked about this the other day
over lunch I think we agreed that maybe this was a bit ott at this
point.

While we do want to avoid redundant dependencies for environments such
as Android (One of the main reasons for the --without-glib option) if
we do find that actually using regular expressions here is the best
way to go maybe we should simply accept that as justification for
depending on libpcre and the glib wrapper api unless they really do
turn out to be overly large.

For now can we put this on hold and instead try re-working things so
we just hand write the code to detect the relevent strings if they are
simple enough? If that turns out to become too awkward then we can
look at depending on glib's regex api and if that turns out to be a
problem then we can take another look at this.

kind regards,
- Robert


More information about the Cogl mailing list