Re: Glib Regex?



Derek,

I've got GRegex more or less finished.  All that is left is making it
so you can split a string on a pattern and stuff the results into a
NULL terminated char**.  GRegex is in the Entity source tree.  Get it
via CVS from:

setenv CVSROOT :pserver:anoncvs@stemwinder.org:/home/cvs
login: anoncvs
password anoncvs
cvs -z3 co entity
to grab it.

Regards,
scottwimer

On Mon, Apr 10, 2000 at 02:36:55PM -0700, Derek Simkowiak wrote:
> 
> 	Has any thought/effort been put into wrapping GNU regex.c in the
> Glib style?
> 
> 	My GtkEtextBuffer object is about 98% done (minus
> testing/debugging--I haven't even tried compiling it yet).  I decided to
> put in a simple g_strcmp()-based search function into the API so the
> keybindings for things like "next word", "previous line", etc. would be
> easy to implement.
> 
> 	Here is the prototype for that simple search function:
> /********************************************************/
> /**
>  * gtk_etext_buffer_find:
>  * @buf: The #GtkEtextBuffer you wish to search in
>  * @search_text: The string you wish to search for
>  * @start_pos: The position to start the search from
>  * @forward: The direction you wish to search
>  * 
>  * This function lets you do a (very) simple g_strcmp() search for a particular
>  * string.  This is useful for things like keybindings (it makes it easy
>  * to find the previous space (" ") if you want to move to the beginning or
>  * end of the previous word, for example) or if you want to move to the last
>  * paragraph by searching for "\n\n" or some such thing.
>  * Preconditions: @buf should be valid and non-NULL.
>  * Postconditions: none.
>  * 
>  * Returns: The position that @search_text is found at, or -1 if it's not found.
>  */
> gint gtk_etext_buffer_find              (GtkEtextBuffer *buf,
> 				         const gchar *search_text,
> 					 guint start_pos,
> 					 gboolean forward);
> /********************************************************/
> 
> 	I think regex-based searches are a feature that many applications
> would want, so I'm considering adding some kind of regex-based search to
> the GtkEtextBuffer API.  However, I don't want to do that unless there is
> a Glib wrapper for GNU regex.
> 
> 	So: Has this come up before?  Has any work been done?  Would there
> be a problem with adding regexes to Glib?  I might be willing to do it if
> people are interested.
> 
> 	As an aside, does anyone know if GNU regex compiles on the win32
> platform?
> 
> Thanks,
> Derek Simkowiak
> dereks@kd-dev.com
> 
> 
> -- 
>          To unsubscribe: mail gtk-devel-list-request@redhat.com with 
>                        "unsubscribe" as the Subject.



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]