SF.net SVN: geany: [1197] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Tue Jan 16 15:24:01 UTC 2007


Revision: 1197
          http://svn.sourceforge.net/geany/?rev=1197&view=rev
Author:   ntrel
Date:     2007-01-16 07:24:01 -0800 (Tue, 16 Jan 2007)

Log Message:
-----------
Add tm_arglist_compare().
Fix comparison in tm_symbol_tag_compare().

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/tagmanager/include/tm_symbol.h
    trunk/tagmanager/tm_symbol.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2007-01-16 15:22:24 UTC (rev 1196)
+++ trunk/ChangeLog	2007-01-16 15:24:01 UTC (rev 1197)
@@ -4,6 +4,9 @@
    Backport improvements from Anjuta 2.02.
    Parse anonymous struct and enums (using contextual_fake_count).
    Add better C99 support, e.g. wchar_t variables.
+ * tagmanager/include/tm_symbol.h, tagmanager/tm_symbol.c:
+   Add tm_arglist_compare().
+   Fix comparison in tm_symbol_tag_compare().
 
 
 2007-01-15  Enrico Tröger  <enrico.troeger at uvena.de>

Modified: trunk/tagmanager/include/tm_symbol.h
===================================================================
--- trunk/tagmanager/include/tm_symbol.h	2007-01-16 15:22:24 UTC (rev 1196)
+++ trunk/tagmanager/include/tm_symbol.h	2007-01-16 15:24:01 UTC (rev 1197)
@@ -10,6 +10,7 @@
 #ifndef TM_SYMBOL_H
 #define TM_SYMBOL_H
 
+
 /*! \file
  The TMSymbol structure and related routines are used by TMProject to maintain a symbol
  hierarchy. The top level TMSymbol maintains a pretty simple hierarchy, consisting of
@@ -60,6 +61,9 @@
 */
 TMSymbol *tm_symbol_tree_update(TMSymbol *root, GPtrArray *tags);
 
+/*! Arglist comparison function */
+int tm_arglist_compare(const TMTag *t1, const TMTag *t2);
+
 /*! Symbol comparison function - can be used for sorting purposes. */
 int tm_symbol_compare(const void *p1, const void *p2);
 

Modified: trunk/tagmanager/tm_symbol.c
===================================================================
--- trunk/tagmanager/tm_symbol.c	2007-01-16 15:22:24 UTC (rev 1196)
+++ trunk/tagmanager/tm_symbol.c	2007-01-16 15:24:01 UTC (rev 1197)
@@ -75,6 +75,16 @@
 	return strcmp(s1->tag->name, s2->tag->name);
 }
 
+/*
+ * Compares function argument lists.
+ * FIXME: Compare based on types, not an exact string match.
+ */
+int tm_arglist_compare(const TMTag* t1, const TMTag* t2)
+{
+	return strcmp(NVL(t1->atts.entry.arglist, ""),
+			NVL(t2->atts.entry.arglist, ""));
+}
+
 /* Need this custom compare function to generate a symbol tree
 in a simgle pass from tag list */
 int tm_symbol_tag_compare(const TMTag **t1, const TMTag **t2)
@@ -120,8 +130,8 @@
 	/* If none of them are function/prototype, they are effectively equal */
 	if ((tm_tag_function_t != (*t1)->type) &&
 	    (tm_tag_prototype_t != (*t1)->type)&&
-	    (tm_tag_function_t != (*t1)->type) &&
-	    (tm_tag_prototype_t != (*t1)->type))
+	    (tm_tag_function_t != (*t2)->type) &&
+	    (tm_tag_prototype_t != (*t2)->type))
 		return 0;
 
 	/* Whichever is not a function/prototype goes first */
@@ -133,8 +143,7 @@
 		return 1;
 
 	/* Compare the argument list */
-	s1 = strcmp(NVL((*t1)->atts.entry.arglist, ""),
-	  NVL((*t2)->atts.entry.arglist, ""));
+	s1 = tm_arglist_compare(*t1, *t2);
 	if (s1 != 0)
 		return s1;
 
@@ -145,7 +154,7 @@
 	if ((tm_tag_function_t != (*t1)->type) &&
 	    (tm_tag_function_t == (*t2)->type))
 		return 1;
-	
+
 	/* Give up */
 	return 0;
 }
@@ -165,12 +174,14 @@
 #ifdef TM_DEBUG
 	fprintf(stderr, "Dumping all tags..\n");
 	tm_tags_array_print(tags_array, stderr);
-#endif	
+#endif
+
 	tags = tm_tags_extract(tags_array, tm_tag_max_t);
 #ifdef TM_DEBUG
 	fprintf(stderr, "Dumping unordered tags..\n");
 	tm_tags_array_print(tags, stderr);
 #endif
+
 	if (tags && (tags->len > 0))
 	{
 		guint i;
@@ -186,6 +197,7 @@
 		SYM_NEW(root);
 		tm_tags_custom_sort(tags, (TMTagCompareFunc) tm_symbol_tag_compare
 		  , FALSE);
+
 #ifdef TM_DEBUG
 		fprintf(stderr, "Dumping ordered tags..");
 		tm_tags_array_print(tags, stderr);
@@ -194,6 +206,7 @@
 		for (i=0; i < tags->len; ++i)
 		{
 			tag = TM_TAG(tags->pdata[i]);
+
 			if (tm_tag_prototype_t == tag->type)
 			{
 				if (sym && (tm_tag_function_t == sym->tag->type) &&


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list