anjuta r3920 - in trunk: . libanjuta/interfaces plugins/class-inheritance plugins/language-support-cpp-java plugins/profiler plugins/symbol-db



Author: jhs
Date: Thu May  8 08:08:14 2008
New Revision: 3920
URL: http://svn.gnome.org/viewvc/anjuta?rev=3920&view=rev

Log:
2008-05-07  Massimo Cora\'  <maxcvs email it>

	* libanjuta/interfaces/libanjuta.idl:
	* plugins/class-inheritance/class-inherit.c
	(class_inheritance_show_dynamic_class_popup_menu):
	* plugins/language-support-cpp-java/cpp-java-assist.c
	(cpp_java_assist_create_word_completion_cache),
	(cpp_java_assist_show_calltip):
	* plugins/profiler/gprof-view.c (gprof_view_show_symbol_in_editor):
	* plugins/symbol-db/plugin.c (isymbol_manager_search):
	* plugins/symbol-db/symbol-db-engine.c
	(on_scan_update_files_symbols_end),
	(symbol_db_engine_find_symbol_by_name_pattern_filtered):
	* plugins/symbol-db/symbol-db-engine.h:
	add limit/offset keywords to search query. Adjusted APIs.
	Fixed a minor bug with caches in the engine.

Modified:
   trunk/ChangeLog
   trunk/libanjuta/interfaces/libanjuta.idl
   trunk/plugins/class-inheritance/class-inherit.c
   trunk/plugins/language-support-cpp-java/cpp-java-assist.c
   trunk/plugins/profiler/gprof-view.c
   trunk/plugins/symbol-db/plugin.c
   trunk/plugins/symbol-db/symbol-db-engine.c
   trunk/plugins/symbol-db/symbol-db-engine.h

Modified: trunk/libanjuta/interfaces/libanjuta.idl
==============================================================================
--- trunk/libanjuta/interfaces/libanjuta.idl	(original)
+++ trunk/libanjuta/interfaces/libanjuta.idl	Thu May  8 08:08:14 2008
@@ -4481,13 +4481,15 @@
 	* string match_name.
 	* @global_search: if TRUE it will search only for public/extern functions. 
 	* If FALSE it will search also for static/private functions.
+ 	* @results_limit Limit results to an upper bound. -1 If you don't want to use this par.
+ 	* @results_offset Skip results_offset results. -1 If you don't want to use this par.	 
 	* @err: Error propagation and reporting.
 	* 
 	* Database query. Returned iterable must be unrefed after use.
 	* 
 	* Returns: fixme
 	*/
-	IAnjutaIterable* search (IAnjutaSymbolType match_types, gboolean include_types, IAnjutaSymbolField info_fields, const gchar *match_name, gboolean partial_name_match, gboolean global_search);
+	IAnjutaIterable* search (IAnjutaSymbolType match_types, gboolean include_types, IAnjutaSymbolField info_fields, const gchar *match_name, gboolean partial_name_match, gboolean global_search, gint results_limit, gint results_offset);
 	
 	/**
 	* ianjuta_symbol_manager_get_members:

Modified: trunk/plugins/class-inheritance/class-inherit.c
==============================================================================
--- trunk/plugins/class-inheritance/class-inherit.c	(original)
+++ trunk/plugins/class-inheritance/class-inherit.c	Thu May  8 08:08:14 2008
@@ -102,6 +102,8 @@
 													   nodedata->name,
 													   FALSE,
 													   TRUE,
+													   -1,
+													   -1,
 													   NULL);
 		
 		if (iter_searched == NULL)
@@ -320,6 +322,8 @@
 													   node_name,
 													   FALSE,
 													   TRUE,
+													   -1,
+													   -1,
 													   NULL);
 		
 			if (iter_searched == NULL) {
@@ -465,6 +469,8 @@
 												   node->name,
 												   FALSE,
 												   TRUE,
+												   -1,
+												   -1,
 												   NULL);
 		
 	if (iter_searched == NULL) {
@@ -899,7 +905,7 @@
 	iter = ianjuta_symbol_manager_search (sm, IANJUTA_SYMBOL_TYPE_CLASS, 
 										  TRUE,
 										  IANJUTA_SYMBOL_FIELD_SIMPLE,
-										  NULL, FALSE, TRUE, NULL);
+										  NULL, FALSE, TRUE, -1, -1, NULL);
 	if (!iter)
 	{
 		DEBUG_PRINT ("class_inheritance_update_graph (): search returned no items.");

Modified: trunk/plugins/language-support-cpp-java/cpp-java-assist.c
==============================================================================
--- trunk/plugins/language-support-cpp-java/cpp-java-assist.c	(original)
+++ trunk/plugins/language-support-cpp-java/cpp-java-assist.c	Thu May  8 08:08:14 2008
@@ -335,13 +335,19 @@
 cpp_java_assist_create_word_completion_cache (CppJavaAssist *assist,
 											  const gchar *pre_word)
 {
+	gint max_completions;
+	max_completions =
+		anjuta_preferences_get_int_with_default (assist->priv->preferences,
+												 PREF_AUTOCOMPLETE_CHOICES,
+												 MAX_COMPLETIONS);
+	
 	cpp_java_assist_destroy_completion_cache (assist);
 	IAnjutaIterable* iter = 
 		ianjuta_symbol_manager_search (assist->priv->isymbol_manager,
 										IANJUTA_SYMBOL_TYPE_MAX,
 									    TRUE,
 										IANJUTA_SYMBOL_FIELD_SIMPLE|IANJUTA_SYMBOL_FIELD_TYPE,
-										pre_word, TRUE, TRUE, NULL);
+										pre_word, TRUE, TRUE, max_completions, -1, NULL);
 	if (iter)
 	{
 		assist->priv->completion_cache =
@@ -476,7 +482,13 @@
 							  IAnjutaIterable *position_iter)
 {
 	GList *tips = NULL;
+	gint max_completions;
 	
+	max_completions =
+		anjuta_preferences_get_int_with_default (assist->priv->preferences,
+												 PREF_AUTOCOMPLETE_CHOICES,
+												 MAX_COMPLETIONS);
+
 	IAnjutaIterable* iter = 
 		ianjuta_symbol_manager_search (assist->priv->isymbol_manager,
 									   IANJUTA_SYMBOL_TYPE_PROTOTYPE|
@@ -485,7 +497,8 @@
 									   IANJUTA_SYMBOL_TYPE_MACRO_WITH_ARG,
 									   TRUE,
 									   IANJUTA_SYMBOL_FIELD_SIMPLE,
-									   call_context, FALSE, TRUE, NULL);
+									   call_context, FALSE, TRUE, max_completions,
+									   -1, NULL);
 	if (iter)
 	{
 		do

Modified: trunk/plugins/profiler/gprof-view.c
==============================================================================
--- trunk/plugins/profiler/gprof-view.c	(original)
+++ trunk/plugins/profiler/gprof-view.c	Thu May  8 08:08:14 2008
@@ -130,6 +130,8 @@
 													 symbol_name,
 													 FALSE,
 													 TRUE,
+													 -1,
+													 -1,
 													 NULL);
 		
 		if (symbol_iter &&

Modified: trunk/plugins/symbol-db/plugin.c
==============================================================================
--- trunk/plugins/symbol-db/plugin.c	(original)
+++ trunk/plugins/symbol-db/plugin.c	Thu May  8 08:08:14 2008
@@ -1422,6 +1422,8 @@
 						const gchar *match_name,
 						gboolean partial_name_match,
 						gboolean global_search,
+						gint results_limit,
+						gint results_offset,
 						GError **err)
 {
 	SymbolDBEngineIterator *iterator = NULL;
@@ -1456,6 +1458,8 @@
 																	  filter_array,
 																	  include_types,
 																	  global_search,
+																	  results_limit,
+																	  results_offset,
 																	  info_fields);
 
 	g_free (pattern);

Modified: trunk/plugins/symbol-db/symbol-db-engine.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine.c	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine.c	Thu May  8 08:08:14 2008
@@ -4764,6 +4764,9 @@
 	
 	sdb_engine_clear_caches (dbe);
 	
+	/* we need a reinitialization */
+	sdb_engine_init_caches (dbe);
+	
 	for (i = 0; i < files_to_scan->len; i++)
 	{
 		gchar *node = (gchar *) g_ptr_array_index (files_to_scan, i);
@@ -6263,6 +6266,8 @@
  * You can specify which kind of symbols to retrieve, and if include them or exclude.
  * Kinds are 'namespace', 'class' etc.
  * @param filter_kinds cannot be NULL.
+ * @param results_limit Limit results to an upper bound. -1 If you don't want to use this par.
+ * @param results_offset Skip results_offset results. -1 If you don't want to use this par. 
  */
 #define DYN_GET_SCOPE_MEMBERS_BY_SYMBOL_ID_FILTERED_EXTRA_PAR_LIMIT					1
 #define DYN_GET_SCOPE_MEMBERS_BY_SYMBOL_ID_FILTERED_EXTRA_PAR_OFFSET				2
@@ -7528,14 +7533,18 @@
  * @param include_kinds Should the filter_kinds (if not null) be applied as inluded or excluded?
  * @param global_search If TRUE only global public function will be searched. If false
  *		  even private or static (for C language) will be searched.
+ * @param results_limit Limit results to an upper bound. -1 If you don't want to use this par.
+ * @param results_offset Skip results_offset results. -1 If you don't want to use this par.	 
  * @param sym_info Infos about symbols you want to know.
  */
-#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_EXACT_MATCH_YES					1
-#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_EXACT_MATCH_NO					2
-#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_INCLUDE_KINDS_YES				4
-#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_INCLUDE_KINDS_NO					8
-#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_GLOBAL_SEARCH_YES				16
-#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_GLOBAL_SEARCH_NO					32
+#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_EXACT_MATCH_YES			1
+#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_EXACT_MATCH_NO			2
+#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_INCLUDE_KINDS_YES		4
+#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_INCLUDE_KINDS_NO			8
+#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_GLOBAL_SEARCH_YES		16
+#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_GLOBAL_SEARCH_NO			32
+#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_LIMIT					64
+#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_OFFSET					128
 
 SymbolDBEngineIterator *
 symbol_db_engine_find_symbol_by_name_pattern_filtered (SymbolDBEngine *dbe, 
@@ -7544,6 +7553,8 @@
 									const GPtrArray *filter_kinds,
 									gboolean include_kinds,
 									gboolean global_search,
+									gint results_limit, 
+									gint results_offset,
 									SymExtraInfo sym_info)
 {
 	SymbolDBEnginePriv *priv;
@@ -7557,6 +7568,10 @@
 	const DynChildQueryNode *dyn_node;
 	GValue *value;
 	gint other_parameters;
+	gchar *limit = "";
+	gboolean limit_free = FALSE;
+	gchar *offset = "";
+	gboolean offset_free = FALSE;
 
 	g_return_val_if_fail (dbe != NULL, NULL);
 	priv = dbe->priv;
@@ -7608,6 +7623,20 @@
 			DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_GLOBAL_SEARCH_NO;
 	}
 	
+	if (results_limit > 0)
+	{
+		other_parameters |= DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_LIMIT;
+		limit_free = TRUE;
+		limit = g_strdup_printf ("LIMIT ## /* name:'limit' type:gint */");
+	}
+	
+	if (results_offset > 0)
+	{
+		other_parameters |= DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_OFFSET;
+		offset = g_strdup_printf ("OFFSET ## /* name:'offset' type:gint */");
+		offset_free = TRUE;
+	}
+	
 	if (filter_kinds == NULL) 
 	{
 		if ((dyn_node = sdb_engine_get_dyn_query_node_by_id (dbe, 
@@ -7632,8 +7661,8 @@
 					"sym_kind.kind_name AS kind_name "
 					"%s FROM symbol %s JOIN sym_kind ON symbol.kind_id = sym_kind.sym_kind_id "
 					"WHERE symbol.name %s AND symbol.is_file_scope = "
-					"## /* name:'globalsearch' type:gint */", 
-				info_data->str, join_data->str, match_str);			
+					"## /* name:'globalsearch' type:gint */ %s %s", 
+				info_data->str, join_data->str, match_str, limit, offset);			
 
 			dyn_node = sdb_engine_insert_dyn_query_node_by_id (dbe, 
 						DYN_PREP_QUERY_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED,
@@ -7697,9 +7726,9 @@
 					"sym_kind.kind_name AS kind_name "
 						"%s FROM symbol %s JOIN sym_kind ON symbol.kind_id = sym_kind.sym_kind_id "
 						"WHERE symbol.name %s AND symbol.is_file_scope = "
-						"## /* name:'globalsearch' type:gint */ %s GROUP BY symbol.name", 
+						"## /* name:'globalsearch' type:gint */ %s GROUP BY symbol.name %s %s", 
 				 		info_data->str, join_data->str, match_str, 
-				 		filter_str->str);
+				 		filter_str->str, limit, offset);
 
 				dyn_node = sdb_engine_insert_dyn_query_node_by_id (dbe, 
 							DYN_PREP_QUERY_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED,
@@ -7715,6 +7744,12 @@
 		g_string_free (filter_str, TRUE);
 	}	
 	
+	if (limit_free)
+		g_free (limit);
+	
+	if (offset_free)
+		g_free (offset);
+
 	if (dyn_node == NULL)
 	{
 		if (priv->mutex)
@@ -7722,6 +7757,38 @@
 		return NULL;
 	}
 	
+	if (other_parameters & DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_LIMIT)
+	{	
+		GValue *value;
+		if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "limit")) == NULL)
+		{
+			if (priv->mutex)
+				g_mutex_unlock (priv->mutex);
+			return NULL;
+		}
+
+		value = gda_value_new (G_TYPE_INT);
+		g_value_set_int (value, results_limit);	
+		gda_holder_set_value (param, value);
+		gda_value_free (value);
+	}
+
+	if (other_parameters & DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_OFFSET)
+	{	
+		GValue *value;
+		if ((param = gda_set_get_holder ((GdaSet*)dyn_node->plist, "offset")) == NULL)
+		{
+			if (priv->mutex)
+				g_mutex_unlock (priv->mutex);
+			return NULL;
+		}
+
+		value = gda_value_new (G_TYPE_INT);
+		g_value_set_int (value, results_offset);
+		gda_holder_set_value (param, value);
+		gda_value_free (value);
+	}
+	
 	if (other_parameters & DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_INCLUDE_KINDS_YES ||
 		other_parameters & DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_INCLUDE_KINDS_NO)
 	{	

Modified: trunk/plugins/symbol-db/symbol-db-engine.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine.h	(original)
+++ trunk/plugins/symbol-db/symbol-db-engine.h	Thu May  8 08:08:14 2008
@@ -264,6 +264,8 @@
  * @param include_kinds Should the filter_kinds (if not null) be applied as inluded or excluded?
  * @param global_search If TRUE only global public function will be searched. If false
  *		  even private or static (for C language) will be searched.
+ * @param results_limit Limit results to an upper bound. -1 If you don't want to use this par.
+ * @param results_offset Skip results_offset results. -1 If you don't want to use this par.
  * @param sym_info Infos about symbols you want to know.
  */
 SymbolDBEngineIterator *
@@ -273,6 +275,8 @@
 									const GPtrArray *filter_kinds,
 									gboolean include_kinds,
 									gboolean global_search,
+									gint results_limit, 
+									gint results_offset,
 									SymExtraInfo sym_info);
 
 
@@ -320,6 +324,8 @@
  * @param group_them If TRUE then will be issued a 'group by symbol.name' option.
  * 		If FALSE you can have as result more symbols with the same name but different
  * 		symbols id. See for example more namespaces declared on different files.
+ * @param results_limit Limit results to an upper bound. -1 If you don't want to use this par.
+ * @param results_offset Skip results_offset results. -1 If you don't want to use this par. 
  */
 SymbolDBEngineIterator *
 symbol_db_engine_get_global_members_filtered (SymbolDBEngine *dbe, 
@@ -352,6 +358,8 @@
 /**
  * Sometimes it's useful going to query just with ids [and so integers] to have
  * a little speed improvement.
+ * @param results_limit Limit results to an upper bound. -1 If you don't want to use this par.
+ * @param results_offset Skip results_offset results. -1 If you don't want to use this par. 
  */
 SymbolDBEngineIterator *
 symbol_db_engine_get_scope_members_by_symbol_id (SymbolDBEngine *dbe, 
@@ -365,6 +373,8 @@
  * You can specify which kind of symbols to retrieve, and if include them or exclude.
  * Kinds are 'namespace', 'class' etc.
  * @param filter_kinds cannot be NULL.
+ * @param results_limit Limit results to an upper bound. -1 If you don't want to use this par.
+ * @param results_offset Skip results_offset results. -1 If you don't want to use this par. 
  */
 SymbolDBEngineIterator *
 symbol_db_engine_get_scope_members_by_symbol_id_filtered (SymbolDBEngine *dbe, 



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