anjuta r3977 - in trunk: . plugins/build-basic-autotools plugins/cvs-plugin plugins/document-manager plugins/editor plugins/macro plugins/search plugins/sourceview plugins/subversion



Author: sgranjoux
Date: Mon Jun  2 19:36:23 2008
New Revision: 3977
URL: http://svn.gnome.org/viewvc/anjuta?rev=3977&view=rev

Log:
	* plugins/cvs-plugin/Makefile.am,
	plugins/cvs-plugin/cvs-execute.c,
	plugins/sourceview/anjuta-document.c,
	plugins/sourceview/Makefile.am,
	plugins/subversion/Makefile.am,
	plugins/search/search-replace.h,
	plugins/search/Makefile.am,
	plugins/build-basic-autotools/build-basic-autotools.c,
	plugins/build-basic-autotools/Makefile.am,
	plugins/editor/Makefile.am,
	plugins/document-manager/Makefile.am,
	plugins/macro/Makefile.am,
	configure.in:
	Fix #514620: Port anjuta to GRegex


Modified:
   trunk/ChangeLog
   trunk/configure.in
   trunk/plugins/build-basic-autotools/Makefile.am
   trunk/plugins/build-basic-autotools/build-basic-autotools.c
   trunk/plugins/cvs-plugin/Makefile.am
   trunk/plugins/cvs-plugin/cvs-execute.c
   trunk/plugins/document-manager/Makefile.am
   trunk/plugins/editor/Makefile.am
   trunk/plugins/macro/Makefile.am
   trunk/plugins/search/Makefile.am
   trunk/plugins/search/search-replace.h
   trunk/plugins/sourceview/Makefile.am
   trunk/plugins/sourceview/anjuta-document.c
   trunk/plugins/subversion/Makefile.am

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Mon Jun  2 19:36:23 2008
@@ -19,7 +19,7 @@
 AC_DEFINE(ANJUTA_VERSION, anjuta_version, [Anjuta version])
 AC_SUBST(ANJUTA_VERSION)
 
-GLIB_REQUIRED=2.8.0
+GLIB_REQUIRED=2.14.0
 GOBJECT_REQUIRED=2.8.0
 GMODULE_REQUIRED=2.8.0
 GTHREAD_REQUIRED=2.8.0
@@ -38,7 +38,6 @@
 VTE_NEW_REQUIRED=0.13.1
 LIBXML_REQUIRED=2.4.23
 PANGO_REQUIRED=1.1.1
-PCRE_REQUIRED=3.9
 LIBDEVHELP_REQUIRED=0.13
 GDL_REQUIRED=0.7.3
 GNOMEBUILD_REQUIRED=0.3.0
@@ -73,7 +72,6 @@
 AC_SUBST(LIBXML_REQUIRED)
 AC_SUBST(PANGO_REQUIRED)
 AC_SUBST(VTE_NEW_REQUIRED)
-AC_SUBST(PCRE_REQUIRED)
 AC_SUBST(LIBDEVHELP_REQUIRED)
 AC_SUBST(GDL_REQUIRED)
 AC_SUBST(GNOMEBUILD_REQUIRED)
@@ -638,19 +636,6 @@
 dnl AC_SUBST(SCROLLKEEPER_VERSION_NUM)
 
 dnl ***************************************************************************
-dnl Check for PCRE
-dnl ***************************************************************************
-dnl Check for PCRE
-AC_PATH_PROG(PCRE_CONFIG, pcre-config,no)
-if test x$PCRE_CONFIG = xno; then
-  AC_MSG_ERROR(Please install the PCRE package from http://www.pcre.org/)
-fi
-PCRE_CFLAGS=`pcre-config --cflags`
-PCRE_LIBS=`pcre-config --libs`
-AC_SUBST(PCRE_LIBS)
-AC_SUBST(PCRE_CFLAGS)
-
-dnl ***************************************************************************
 dnl Tagmanager checks.
 dnl ***************************************************************************
 

Modified: trunk/plugins/build-basic-autotools/Makefile.am
==============================================================================
--- trunk/plugins/build-basic-autotools/Makefile.am	(original)
+++ trunk/plugins/build-basic-autotools/Makefile.am	Mon Jun  2 19:36:23 2008
@@ -28,7 +28,6 @@
 AM_CPPFLAGS = \
 	$(WARN_CFLAGS) \
 	$(DEPRECATED_FLAGS) \
-	$(PCRE_CFLAGS) \
 	$(LIBANJUTA_CFLAGS)
 
 # Where to install the plugin
@@ -48,7 +47,6 @@
 
 # Plugin dependencies
 libanjuta_build_basic_autotools_la_LIBADD = \
-	$(PCRE_LIBS) \
 	$(GLADE_LIBS) \
 	$(GNOME_LIBS) \
 	$(LIBANJUTA_LIBS)

Modified: trunk/plugins/build-basic-autotools/build-basic-autotools.c
==============================================================================
--- trunk/plugins/build-basic-autotools/build-basic-autotools.c	(original)
+++ trunk/plugins/build-basic-autotools/build-basic-autotools.c	Mon Jun  2 19:36:23 2008
@@ -20,7 +20,6 @@
 
 #include <config.h>
 #include <ctype.h>
-#include <pcre.h>
 
 #include <libgnomevfs/gnome-vfs-utils.h>
 #include <libanjuta/anjuta-shell.h>
@@ -79,7 +78,7 @@
 	gchar *pattern;
 	int options;
 	gchar *replace;
-	pcre *regex;
+	GRegex *regex;
 } BuildPattern;
 
 typedef struct
@@ -424,8 +423,7 @@
 build_regex_init ()
 {
 	GList *node;
-	const char *error;
-	int erroffset;
+	GError *error = NULL;
 
 	build_regex_load ();
 	if (!patterns_list)
@@ -441,15 +439,15 @@
 		
 		pattern = node->data;
 		pattern->regex =
-			pcre_compile(
+			g_regex_new(
 			   pattern->pattern,
 			   pattern->options,
-			   &error,           /* for error message */
-			   &erroffset,       /* for error offset */
-			   NULL);            /* use default character tables */
-		if (pattern->regex == NULL) {
-			DEBUG_PRINT ("PCRE compilation failed: %s: regex \"%s\" at char %d",
-						pattern->pattern, error, erroffset);
+			   0,
+			   &error);           /* for error message */
+		if (error != NULL) {
+			DEBUG_PRINT ("GRegex compilation failed: pattern \"%s\": error %s",
+						pattern->pattern, error->message);
+			g_error_free (error);
 		}
 		node = g_list_next (node);
 	}
@@ -459,8 +457,8 @@
 static gchar*
 build_get_summary (const gchar *details, BuildPattern* bp)
 {
-	int rc;
-	int ovector[30];
+	gboolean matched;
+	GMatchInfo *match_info;
 	const gchar *iter;
 	GString *ret;
 	gchar *final;
@@ -468,17 +466,13 @@
 	if (!bp || !bp->regex)
 		return NULL;
 	
-	rc = pcre_exec(
-			bp->regex,       /* result of pcre_compile() */
-			NULL,            /* we didnât study the pattern */
-			details,         /* the subject string */
-			strlen (details),/* the length of the subject string */
-			0,               /* start at offset 0 in the subject */
-			bp->options,     /* default options */
-			ovector,         /* vector for substring information */
-			30);             /* number of elements in the vector */
+	matched = g_regex_match(
+			  bp->regex,       /* result of g_regex_new() */
+			  details,         /* the subject string */
+			  0,
+			  &match_info);
 	
-	if (rc < 0)
+	if (!matched)
 		return NULL;
 	
 	ret = g_string_new ("");
@@ -488,11 +482,15 @@
 		if (*iter == '\\' && isdigit(*(iter + 1)))
 		{
 			char temp[2] = {0, 0};
+			gint start_pos, end_pos;
 			
 			temp[0] = *(iter + 1);
 			int idx = atoi (temp);
-			ret = g_string_append_len (ret, details + ovector[2*idx],
-									   ovector[2*idx+1] - ovector[2*idx]);
+
+			g_match_info_fetch_pos (match_info, idx, &start_pos, &end_pos);
+
+			ret = g_string_append_len (ret, details + start_pos,
+									   end_pos - start_pos);
 			iter += 2;
 		}
 		else
@@ -507,6 +505,7 @@
 			ret = g_string_append_len (ret, start, end - start);
 		}
 	}
+	g_match_info_free (match_info);
 	
 	final = g_string_free (ret, FALSE);
 	if (strlen (final) <= 0) {

Modified: trunk/plugins/cvs-plugin/Makefile.am
==============================================================================
--- trunk/plugins/cvs-plugin/Makefile.am	(original)
+++ trunk/plugins/cvs-plugin/Makefile.am	Mon Jun  2 19:36:23 2008
@@ -19,8 +19,7 @@
 AM_CPPFLAGS= \
 	$(WARN_CFLAGS) \
 	$(DEPRECATED_FLAGS) \
-	$(LIBANJUTA_CFLAGS) \
-	$(PCRE_CFLAGS)
+	$(LIBANJUTA_CFLAGS)
 
 plugindir = $(anjuta_plugin_dir)
 plugin_LTLIBRARIES = libanjuta-cvs-plugin.la
@@ -30,7 +29,7 @@
 libanjuta_cvs_plugin_la_LIBADD = \
 	$(GLADE_LIBS) \
 	$(GNOME_VFS_LIBS) \
-	$(LIBANJUTA_LIBS) $(PCRE_LIBS)
+	$(LIBANJUTA_LIBS)
 
 libanjuta_cvs_plugin_la_SOURCES = \
 	plugin.c \

Modified: trunk/plugins/cvs-plugin/cvs-execute.c
==============================================================================
--- trunk/plugins/cvs-plugin/cvs-execute.c	(original)
+++ trunk/plugins/cvs-plugin/cvs-execute.c	Mon Jun  2 19:36:23 2008
@@ -28,7 +28,6 @@
 #include <libanjuta/anjuta-debug.h>
 
 #include <glade/glade.h>
-#include <pcre.h>
 
 #define CVS_ICON ""
 #define CVS_INFO_REGEXP "(cvs update:.|cvs server:.)"
@@ -48,39 +47,37 @@
 					  AnjutaPlugin *plugin)
 {
 	IAnjutaMessageViewType type;
-	pcre *info, *err;
-	const gchar *err_buf;
-	int err_ptr, output[16];
+	GRegex *info, *err;
+	GError *error = NULL;
 	
 	g_return_if_fail (line != NULL);
 
 	/* Compile the regexps for message types. */
-	if (!(info = pcre_compile(CVS_INFO_REGEXP, 0, &err_buf, &err_ptr, NULL)))
+	info = g_regex_new (CVS_INFO_REGEXP, 0, 0, &error);
+	if (error != NULL)
 	{
-		g_free((gchar *) err_buf);
+		g_error_free (error);
 		return;
 	}
-	if (!(err = pcre_compile(CVS_ERR_REGEXP, 0, &err_buf, &err_ptr, NULL)))
+	err = g_regex_new (CVS_ERR_REGEXP, 0, 0, &error);
+	if (error != NULL)
 	{
-		g_free((gchar *) err_buf);
+		g_error_free (error);
 		return;
 	}		
 	
 	/* Match against type regexps to find the message type. */
-	if (pcre_exec(info, NULL, line, strlen(line), 0, 0, output, 16) >= 0)
-	{
+	if (g_regex_match (info, line, 0, NULL))
 		type = IANJUTA_MESSAGE_VIEW_TYPE_INFO;
-	}
-	else if (pcre_exec(err, NULL, line, strlen(line), 0, 0, output, 16) >= 0)
-	{
+	else if (g_regex_match (info, line, 0, NULL))
 		type = IANJUTA_MESSAGE_VIEW_TYPE_ERROR;
-	}
-	else type = IANJUTA_MESSAGE_VIEW_TYPE_NORMAL;
+	else 
+		type = IANJUTA_MESSAGE_VIEW_TYPE_NORMAL;
 
 	ianjuta_message_view_append (view, type, line, "", NULL);
 	
-	pcre_free(info);
-	pcre_free(err);
+	g_regex_unref (info);
+	g_regex_unref (err);
 }
 
 static void

Modified: trunk/plugins/document-manager/Makefile.am
==============================================================================
--- trunk/plugins/document-manager/Makefile.am	(original)
+++ trunk/plugins/document-manager/Makefile.am	Mon Jun  2 19:36:23 2008
@@ -21,7 +21,6 @@
 AM_CPPFLAGS = \
 	$(WARN_CFLAGS) \
 	$(DEPRECATED_FLAGS) \
-	$(PCRE_CFLAGS) \
 	$(GDL_CFLAGS) \
 	$(GNOME_PRINT_UI_CFLAGS) \
 	$(GNOME_VFS_CFLAGS) \
@@ -31,7 +30,6 @@
 
 libanjuta_document_manager_la_LIBADD = \
 	$(GDL_LIBS) \
-	$(PCRE_LIBS) \
 	$(GNOME_PRINT_UI_LIBS) \
 	$(GNOME_VFS_LIBS) \
 	$(LIBANJUTA_LIBS)

Modified: trunk/plugins/editor/Makefile.am
==============================================================================
--- trunk/plugins/editor/Makefile.am	(original)
+++ trunk/plugins/editor/Makefile.am	Mon Jun  2 19:36:23 2008
@@ -22,7 +22,6 @@
 plugin_LTLIBRARIES = libanjuta-editor.la
 
 AM_CPPFLAGS = \
-	$(PCRE_CFLAGS) \
 	$(GNOME_PRINT_UI_CFLAGS) \
 	$(GNOME_VFS_CFLAGS) \
 	$(LIBANJUTA_CFLAGS) \
@@ -33,7 +32,6 @@
 libanjuta_editor_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
 
 libanjuta_editor_la_LIBADD = \
-	$(PCRE_LIBS) \
 	$(GNOME_PRINT_UI_LIBS) \
 	$(GNOME_VFS_LIBS) \
 	$(LIBANJUTA_LIBS) \

Modified: trunk/plugins/macro/Makefile.am
==============================================================================
--- trunk/plugins/macro/Makefile.am	(original)
+++ trunk/plugins/macro/Makefile.am	Mon Jun  2 19:36:23 2008
@@ -21,8 +21,7 @@
 AM_CPPFLAGS= \
 	$(WARN_CFLAGS) \
 	$(DEPRECATED_FLAGS) \
-	$(LIBANJUTA_CFLAGS) \
-	$(PCRE_CFLAGS)
+	$(LIBANJUTA_CFLAGS)
 
 plugindir = $(anjuta_plugin_dir)
 plugin_LTLIBRARIES = libanjuta-macro.la
@@ -32,7 +31,7 @@
 libanjuta_macro_la_LIBADD = \
 	$(GLADE_LIBS) \
 	$(GNOME_VFS_LIBS) \
-	$(LIBANJUTA_LIBS) $(PCRE_LIBS)
+	$(LIBANJUTA_LIBS)
 
 libanjuta_macro_la_SOURCES = \
 	plugin.c\

Modified: trunk/plugins/search/Makefile.am
==============================================================================
--- trunk/plugins/search/Makefile.am	(original)
+++ trunk/plugins/search/Makefile.am	Mon Jun  2 19:36:23 2008
@@ -28,7 +28,6 @@
 AM_CPPFLAGS = \
 	$(WARN_CFLAGS) \
 	$(DEPRECATED_FLAGS) \
-	$(PCRE_CFLAGS) \
 	$(GNOME_PRINT_UI_CFLAGS) \
 	$(GNOME_VFS_CFLAGS) \
 	$(LIBANJUTA_CFLAGS) \
@@ -37,7 +36,6 @@
 libanjuta_search_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
 
 libanjuta_search_la_LIBADD = \
-	$(PCRE_LIBS) \
 	$(GNOME_PRINT_UI_LIBS) \
 	$(GNOME_UI_LIBS) \
 	$(GLADE_LIBS) \

Modified: trunk/plugins/search/search-replace.h
==============================================================================
--- trunk/plugins/search/search-replace.h	(original)
+++ trunk/plugins/search/search-replace.h	Mon Jun  2 19:36:23 2008
@@ -7,7 +7,6 @@
 #endif
 
 #include <glib.h>
-#include <pcre.h>
 #include <glade/glade.h>
 
 typedef enum _GUIElementType

Modified: trunk/plugins/sourceview/Makefile.am
==============================================================================
--- trunk/plugins/sourceview/Makefile.am	(original)
+++ trunk/plugins/sourceview/Makefile.am	Mon Jun  2 19:36:23 2008
@@ -24,7 +24,6 @@
 AM_CPPFLAGS = \
 	$(WARN_CFLAGS) \
 	$(DEPRECATED_FLAGS) \
-	$(PCRE_CFLAGS) \
 	$(GNOME_PRINT_UI_CFLAGS) \
 	$(GNOME_VFS_CFLAGS) \
 	$(PLUGIN_SOURCEVIEW_CFLAGS) \
@@ -82,7 +81,6 @@
 
 # Plugin dependencies
 libanjuta_sourceview_la_LIBADD = \
-	$(PCRE_LIBS) \
 	$(GNOME_PRINT_UI_LIBS) \
 	$(GNOME_VFS_LIBS) \
 	$(PLUGIN_SOURCEVIEW_LIBS) \

Modified: trunk/plugins/sourceview/anjuta-document.c
==============================================================================
--- trunk/plugins/sourceview/anjuta-document.c	(original)
+++ trunk/plugins/sourceview/anjuta-document.c	Mon Jun  2 19:36:23 2008
@@ -50,7 +50,6 @@
 #include "anjuta-utils.h"
 
 #include <gtksourceview/gtksourceiter.h>
-#include <pcre.h>
 
 #define ANJUTA_MAX_PATH_LEN  2048
 

Modified: trunk/plugins/subversion/Makefile.am
==============================================================================
--- trunk/plugins/subversion/Makefile.am	(original)
+++ trunk/plugins/subversion/Makefile.am	Mon Jun  2 19:36:23 2008
@@ -24,8 +24,7 @@
 	$(DEPRECATED_FLAGS) \
 	$(LIBANJUTA_CFLAGS) \
 	$(SVN_CFLAGS) \
-	$(SVN_INCLUDE)\
-	$(PCRE_CFLAGS)
+	$(SVN_INCLUDE)
 
 plugindir = $(anjuta_plugin_dir)
 
@@ -35,7 +34,7 @@
 
 libanjuta_subversion_la_LIBADD = \
 	$(GLADE_LIBS) $(GNOME_VFS_LIBS) \
-	$(LIBANJUTA_LIBS) $(PCRE_LIBS) $(SVN_LIB)
+	$(LIBANJUTA_LIBS) $(SVN_LIB)
 
 libanjuta_subversion_la_SOURCES = \
 	plugin.c \



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