[anjuta] anjuta-tags: fixed bgo #616503 - updates to the ctags vala parser.



commit c711a5745c57ac46eaf0b27b42c3f8eec7e9b96e
Author: Massimo Corà <mcora src gnome org>
Date:   Mon Apr 26 19:54:39 2010 +0200

    anjuta-tags: fixed bgo #616503 - updates to the ctags vala parser.

 plugins/symbol-db/anjuta-tags/Makefile.am   |    4 ++-
 plugins/symbol-db/anjuta-tags/ctags-utils.c |   41 +++++++++++++++++++++++++++
 plugins/symbol-db/anjuta-tags/ctags-utils.h |   38 +++++++++++++++++++++++++
 plugins/symbol-db/anjuta-tags/gir.c         |   15 +---------
 plugins/symbol-db/anjuta-tags/jscript.c     |   15 +---------
 5 files changed, 84 insertions(+), 29 deletions(-)
---
diff --git a/plugins/symbol-db/anjuta-tags/Makefile.am b/plugins/symbol-db/anjuta-tags/Makefile.am
index e038196..1d6f60f 100644
--- a/plugins/symbol-db/anjuta-tags/Makefile.am
+++ b/plugins/symbol-db/anjuta-tags/Makefile.am
@@ -123,7 +123,9 @@ anjuta_tags_SOURCES = \
 	js-parser/js-context.h	\
 	js-parser/js-node.c	\
 	js-parser/js-node.h	\
-	js-parser/jstypes.h
+	js-parser/jstypes.h     \
+	ctags-utils.c     \
+	ctags-utils.h
 
 anjuta_tags_LDFLAGS = \
 		$(GLIB_LDFLAGS) \
diff --git a/plugins/symbol-db/anjuta-tags/ctags-utils.c b/plugins/symbol-db/anjuta-tags/ctags-utils.c
new file mode 100644
index 0000000..0db7745
--- /dev/null
+++ b/plugins/symbol-db/anjuta-tags/ctags-utils.c
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) Massimo Cora' 2010 <maxcvs email it>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
+ */
+
+#include "ctags-utils.h"
+
+void
+get_file_pos (gint line, fpos_t *fpos, FILE *f)
+{
+	vString * str = vStringNew ();
+	gint i;
+	g_assert (fseek (f, 0, SEEK_SET) == 0);
+
+	for (i = 0;i < line - 1; i++)
+	{
+		if (readLine (str, f) == NULL)
+		{
+			vStringDelete (str);
+			return;
+		}
+	}
+
+	vStringDelete (str);
+	g_assert (fgetpos (f, fpos) == 0);
+}
+
+
diff --git a/plugins/symbol-db/anjuta-tags/ctags-utils.h b/plugins/symbol-db/anjuta-tags/ctags-utils.h
new file mode 100644
index 0000000..41283bf
--- /dev/null
+++ b/plugins/symbol-db/anjuta-tags/ctags-utils.h
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) Massimo Cora' 2010 <maxcvs email it>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ * 
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Library General Public License for more details.
+ * 
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor Boston, MA 02110-1301,  USA
+ */
+
+#include "general.h"	/* must always come first */
+#include "read.h"
+#include <assert.h>
+#include <glib.h>
+#include <string.h>
+
+
+/**
+ * IMPORTANT NOTE 
+ *
+ * This file should contain functions/helpers that aren't strictly 
+ * ctags-standardized and that can be used in extra parsers (i.e. parser
+ * not included with ctags distribution).
+ * Doing so and keeping separate standard/extra files should make 
+ * an upgrade of ctags easier.
+ */
+ 
+
+void get_file_pos (gint line, fpos_t *fpos, FILE *f);
+
diff --git a/plugins/symbol-db/anjuta-tags/gir.c b/plugins/symbol-db/anjuta-tags/gir.c
index b0e85c5..517472b 100644
--- a/plugins/symbol-db/anjuta-tags/gir.c
+++ b/plugins/symbol-db/anjuta-tags/gir.c
@@ -12,6 +12,7 @@
 #include <libxml/xmlmemory.h>
 #include <libxml/parser.h>
 #include <libxml/tree.h>
+#include "ctags-utils.h"
 
 static kindOption Kinds [] = {
 	{ TRUE,  'f', "function",	  "functions"},
@@ -27,20 +28,6 @@ initialize (const langType language)
 }
 
 static void
-get_file_pos (gint line, fpos_t *fpos, FILE *f)
-{
-	vString * str = vStringNew ();
-	gint i;
-	g_assert (fseek (f, 0, SEEK_SET) == 0);
-
-	for (i = 0;i < line - 1; i++)
-		if (readLine (str, f) == NULL)
-			return;
-
-	g_assert (fgetpos (f, fpos) == 0);
-}
-
-static void
 parse_function (xmlNode *node, const gchar *parent)
 {
 	xmlNode *i, *k;
diff --git a/plugins/symbol-db/anjuta-tags/jscript.c b/plugins/symbol-db/anjuta-tags/jscript.c
index c3b0e08..e7150e9 100644
--- a/plugins/symbol-db/anjuta-tags/jscript.c
+++ b/plugins/symbol-db/anjuta-tags/jscript.c
@@ -29,6 +29,7 @@
 #include <glib.h>
 #include "js-parser/jsparse.h"
 #include "js-parser/js-context.h"
+#include "ctags-utils.h"
 
 #include <string.h>
 
@@ -42,20 +43,6 @@ getTagPos (JSNode *node)
 
 #define PROTOTYPE ".prototype"
 
-static void
-get_file_pos (gint line, fpos_t *fpos, FILE *f)
-{
-	vString * str = vStringNew ();
-	gint i;
-	g_assert (fseek (f, 0, SEEK_SET) == 0);
-
-	for (i = 0;i < line - 1; i++)
-		if (readLine (str, f) == NULL)
-			return;
-
-	g_assert (fgetpos (f, fpos) == 0);
-}
-
 static GList *symbols = NULL;
 static GList *tags = NULL;
 



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