anjuta r4099 - in trunk: . libanjuta/interfaces plugins/symbol-browser plugins/symbol-db plugins/symbol-db/test
- From: jhs svn gnome org
- To: svn-commits-list gnome org
- Subject: anjuta r4099 - in trunk: . libanjuta/interfaces plugins/symbol-browser plugins/symbol-db plugins/symbol-db/test
- Date: Tue, 29 Jul 2008 21:04:25 +0000 (UTC)
Author: jhs
Date: Tue Jul 29 21:04:25 2008
New Revision: 4099
URL: http://svn.gnome.org/viewvc/anjuta?rev=4099&view=rev
Log:
2008-07-19 Massimo Cora\' <maxcvs email it>
* libanjuta/interfaces/libanjuta.idl:
* plugins/symbol-browser/plugin.c (project_root_added),
(on_editor_saved), (update_editor_symbol_model),
(value_removed_current_editor), (isymbol_manager_get_scope),
(isymbol_manager_get_parent_scope),
(isymbol_manager_get_symbol_more_info),
(isymbol_manager_iface_init):
* plugins/symbol-db/plugin.c (do_import_system_src_after_abort),
(do_import_sources), (isymbol_manager_search),
(isymbol_manager_get_scope), (isymbol_manager_get_parent_scope),
(isymbol_manager_get_symbol_more_info),
(isymbol_manager_iface_init):
* plugins/symbol-db/symbol-db-engine-iterator-node.c
(symbol_db_engine_iterator_node_get_symbol_extra_string):
* plugins/symbol-db/symbol-db-engine.c (sdb_engine_init),
(symbol_db_engine_add_new_files),
(sdb_engine_second_pass_update_scope_1),
(sdb_engine_second_pass_update_scope),
(sdb_engine_second_pass_update_heritage),
(sdb_engine_second_pass_do), (sdb_engine_prepare_symbol_info_sql),
(symbol_db_engine_get_class_parents_by_symbol_id),
(symbol_db_engine_get_current_scope),
(symbol_db_engine_find_symbol_by_name_pattern_filtered):
* plugins/symbol-db/symbol-db-engine.h:
* plugins/symbol-db/symbol-db-system.c
(symbol_db_system_parse_aborted_package):
* plugins/symbol-db/symbol-db-system.h:
* plugins/symbol-db/symbol-db-view-locals.c:
* plugins/symbol-db/symbol-db-view.c:
* plugins/symbol-db/symbol-db-view.h:
* plugins/symbol-db/test/benchmark.c (main):
temporary disabled do_import_system_src_after_abort (). It needs more
performance tests.
Implemented some new methods for IAnjutaSymbolManager.
More performances on population and displaying.
Modified:
trunk/ChangeLog
trunk/libanjuta/interfaces/libanjuta.idl
trunk/plugins/symbol-browser/plugin.c
trunk/plugins/symbol-db/plugin.c
trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c
trunk/plugins/symbol-db/symbol-db-engine.c
trunk/plugins/symbol-db/symbol-db-engine.h
trunk/plugins/symbol-db/symbol-db-system.c
trunk/plugins/symbol-db/symbol-db-system.h
trunk/plugins/symbol-db/symbol-db-view-locals.c
trunk/plugins/symbol-db/symbol-db-view.c
trunk/plugins/symbol-db/symbol-db-view.h
trunk/plugins/symbol-db/test/benchmark.c
Modified: trunk/libanjuta/interfaces/libanjuta.idl
==============================================================================
--- trunk/libanjuta/interfaces/libanjuta.idl (original)
+++ trunk/libanjuta/interfaces/libanjuta.idl Tue Jul 29 21:04:25 2008
@@ -4669,6 +4669,7 @@
* @match_types: If passed IANJUTA_TYPE_MAX the function will not perfom any filter.
* @include_types: Should the result contain or exclude the match_types? TRUE to include them,
* FALSE to exclude. For example use may want all symbols but classes.
+ * @info_fields: Kind of infos you would like to have available on the resulting Symbols.
* @match_name: fixme
* @partial_name_match: if TRUE it will search for %match_name%, it FALSE for the exact
* string match_name.
@@ -4682,29 +4683,28 @@
* @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.
+ * Database query. The returned @IAnjutaIterable object 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_symbols_search, gboolean global_tags_search, gint results_limit, gint results_offset);
/**
* ianjuta_symbol_manager_get_members:
* @obj: Self
- * @symbol_name: fixme
+ * @info_fields: Kind of infos you would like to have available on the resulting Symbols.
* @global_search: fixme
* @err: Error propagation and reporting.
*
- * Database query. Returned iterable must be unrefed after use.
+ * Database query. The returned @IAnjutaIterable object must be unrefed after use.
*
- * Returns: fixme
*/
IAnjutaIterable* get_members (IAnjutaSymbol *symbol, IAnjutaSymbolField info_fields, gboolean global_search);
/**
* ianjuta_symbol_manager_get_parents:
* @obj: Self
- * @symbol_name: fixme
+ * @symbol: Symbol which you want to know the parent classes of.
+ * @info_fields: Kind of infos you would like to have available on the resulting Symbols.
* @err: Error propagation and reporting.
*
* fixme
@@ -4712,6 +4712,56 @@
* Returns: fixme
*/
IAnjutaIterable* get_class_parents (IAnjutaSymbol *symbol, IAnjutaSymbolField info_fields);
+
+ /**
+ * ianjuta_symbol_manager_get_scope:
+ * @obj: Self
+ * @filename: full path of the file.
+ * @line line of @filename in which symbol exist.
+ * @info_fields: Kind of infos you would like to have available on the resulting Symbols.
+ * @err: Error propagation and reporting.
+ *
+ * Get the scope specified by the line of
+ * the file.
+ *
+ * Returns Iterator should contain just one element if the query is successful,
+ * no element or NULL is returned if function went wrong.
+ *
+ */
+ IAnjutaIterable* get_scope (const gchar* filename, gulong line, IAnjutaSymbolField info_fields);
+
+ /**
+ * ianjuta_symbol_manager_get_parent_scope:
+ * @obj: Self
+ * @symbol: Symbol which you want to know the parent scope of.
+ * @filename: Can be NULL. Full path filename where to search for the parent scope symbol.
+ * @info_fields: Kind of infos you would like to have available on the resulting Symbols.
+ * @err: Error propagation and reporting.
+ *
+ * Find the parent scope given a symbol
+ *
+ * The returned @IAnjutaIterable object should contain just one element if the
+ * query is successful,
+ * no element or NULL is returned if function went wrong.
+ * The returned @IAnjutaIterable object must be unrefed after use.
+ */
+ IAnjutaIterable* get_parent_scope (IAnjutaSymbol *symbol, const gchar *filename, IAnjutaSymbolField info_fields);
+
+ /**
+ * ianjuta_symbol_manager_get_symbol_more_info:
+ * @obj: Self
+ * @symbol symbol of which you want to know more infos about.
+ * @info_fields: Kind of infos you would like to have available on the resulting Symbols.
+ * @err: Error propagation and reporting.
+ *
+ * While at first sight this function may seem as useless, in a deeper inspection
+ * you can see that you can achieve speed improvements for example avoiding
+ * to pass many info_fields requests to a search query, which itself could require
+ * complicated joins between engine tables, slowing down the thing.
+ * It's up to you to see which method is more performant.
+ *
+ */
+ IAnjutaIterable* get_symbol_more_info (IAnjutaSymbol *symbol, IAnjutaSymbolField info_fields);
}
/**
Modified: trunk/plugins/symbol-browser/plugin.c
==============================================================================
--- trunk/plugins/symbol-browser/plugin.c (original)
+++ trunk/plugins/symbol-browser/plugin.c Tue Jul 29 21:04:25 2008
@@ -363,7 +363,6 @@
IAnjutaProjectManager *pm;
SymbolBrowserPlugin *sv_plugin;
const gchar *root_uri;
- gchar* tags;
sv_plugin = ANJUTA_PLUGIN_SYMBOL_BROWSER (plugin);
@@ -636,7 +635,6 @@
const gchar *old_uri;
gboolean tags_update;
GtkTreeModel *file_symbol_model;
- GtkAction *action;
AnjutaUI *ui;
/* FIXME: Do this only if automatic tags update is enabled */
@@ -748,7 +746,6 @@
{
gchar *local_filename;
GtkTreeModel *file_symbol_model;
- GtkAction *action;
/* Verify that it's local file */
local_filename = gnome_vfs_get_local_path_from_uri (uri);
@@ -883,7 +880,6 @@
{
AnjutaUI *ui;
SymbolBrowserPlugin *sv_plugin;
- GtkAction *action;
/* let's remove the timeout for symbols refresh */
@@ -1206,12 +1202,48 @@
return NULL;
}
+static IAnjutaIterable*
+isymbol_manager_get_scope (IAnjutaSymbolManager *sm,
+ const gchar* filename,
+ gulong line,
+ IAnjutaSymbolField info_fields,
+ GError **err)
+{
+ DEBUG_PRINT ("isymbol_manager_get_scope (): not implemented");
+ return NULL;
+}
+
+static IAnjutaIterable*
+isymbol_manager_get_parent_scope (IAnjutaSymbolManager *sm,
+ IAnjutaSymbol *symbol,
+ const gchar *filename,
+ IAnjutaSymbolField info_fields,
+ GError **err)
+{
+ DEBUG_PRINT ("isymbol_manager_get_parent_scope (): not implemented");
+ return NULL;
+}
+
+
+static IAnjutaIterable*
+isymbol_manager_get_symbol_more_info (IAnjutaSymbolManager *sm,
+ IAnjutaSymbol *symbol,
+ IAnjutaSymbolField info_fields,
+ GError **err)
+{
+ DEBUG_PRINT ("isymbol_manager_get_symbol_more_info (): not implemented");
+ return NULL;
+}
+
static void
isymbol_manager_iface_init (IAnjutaSymbolManagerIface *iface)
{
iface->search = isymbol_manager_search;
iface->get_members = isymbol_manager_get_members;
iface->get_class_parents = isymbol_manager_get_class_parents;
+ iface->get_scope = isymbol_manager_get_scope;
+ iface->get_parent_scope = isymbol_manager_get_parent_scope;
+ iface->get_symbol_more_info = isymbol_manager_get_symbol_more_info;
}
static void
Modified: trunk/plugins/symbol-db/plugin.c
==============================================================================
--- trunk/plugins/symbol-db/plugin.c (original)
+++ trunk/plugins/symbol-db/plugin.c Tue Jul 29 21:04:25 2008
@@ -863,6 +863,7 @@
do_import_system_src_after_abort (AnjutaPlugin *plugin,
const GPtrArray *sources_array)
{
+#if 0
SymbolDBPlugin *sdb_plugin;
GPtrArray* languages_array = NULL;
GPtrArray *to_scan_array = NULL;
@@ -914,13 +915,14 @@
g_ptr_array_add (to_scan_array, g_strdup (local_filename));
}
- symbol_db_parse_aborted_package (sdb_plugin->sdbs,
+ symbol_db_system_parse_aborted_package (sdb_plugin->sdbs,
to_scan_array,
languages_array);
/* no need to free the GPtrArray, Huston. They'll be auto-destroyed in that
* function
*/
+#endif
}
/* we assume that sources_array has already unique elements */
@@ -1031,7 +1033,7 @@
lang_manager = anjuta_shell_get_interface (plugin->shell, IAnjutaLanguage,
NULL);
- if (!lang_manager)
+ if (lang_manager == NULL)
{
g_critical ("LanguageManager not found");
return;
@@ -1041,6 +1043,12 @@
IANJUTA_PROJECT_MANAGER_SOURCE,
NULL);
+ if (prj_elements_list == NULL)
+ {
+ g_critical ("No sources found within this project");
+ return;
+ }
+
/* to speed the things up we must avoid the dups */
check_unique_file = g_hash_table_new_full (g_str_hash,
g_str_equal, g_free, g_free);
@@ -1686,6 +1694,7 @@
filter_array,
include_types,
global_symbols_search,
+ NULL,
results_limit,
results_offset,
info_fields);
@@ -1752,12 +1761,93 @@
return IANJUTA_ITERABLE (iterator);
}
+static IAnjutaIterable*
+isymbol_manager_get_scope (IAnjutaSymbolManager *sm,
+ const gchar* filename,
+ gulong line,
+ IAnjutaSymbolField info_fields,
+ GError **err)
+{
+ SymbolDBPlugin *sdb_plugin;
+ SymbolDBEngine *dbe;
+ SymbolDBEngineIterator *iterator;
+
+ sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (sm);
+ dbe = SYMBOL_DB_ENGINE (sdb_plugin->sdbe_project);
+
+ iterator = symbol_db_engine_get_current_scope (dbe, filename, line, info_fields);
+
+ return IANJUTA_ITERABLE (iterator);
+}
+
+static IAnjutaIterable*
+isymbol_manager_get_parent_scope (IAnjutaSymbolManager *sm,
+ IAnjutaSymbol *symbol,
+ const gchar *filename,
+ IAnjutaSymbolField info_fields,
+ GError **err)
+{
+ SymbolDBEngineIteratorNode *node;
+ gint child_node_id, parent_node_id;
+ SymbolDBPlugin *sdb_plugin;
+ SymbolDBEngine *dbe;
+ SymbolDBEngineIterator *iterator;
+
+ sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (sm);
+ dbe = SYMBOL_DB_ENGINE (sdb_plugin->sdbe_project);
+
+ node = SYMBOL_DB_ENGINE_ITERATOR_NODE (symbol);
+
+ child_node_id = symbol_db_engine_iterator_node_get_symbol_id (node);
+
+ if (child_node_id <= 0)
+ return NULL;
+
+ parent_node_id = symbol_db_engine_get_parent_scope_id_by_symbol_id (dbe,
+ child_node_id,
+ filename);
+
+ iterator = symbol_db_engine_get_symbol_info_by_id (dbe, parent_node_id,
+ info_fields);
+ return IANJUTA_ITERABLE (iterator);
+}
+
+static IAnjutaIterable*
+isymbol_manager_get_symbol_more_info (IAnjutaSymbolManager *sm,
+ IAnjutaSymbol *symbol,
+ IAnjutaSymbolField info_fields,
+ GError **err)
+{
+ SymbolDBEngineIteratorNode *node;
+ gint node_id;
+ SymbolDBPlugin *sdb_plugin;
+ SymbolDBEngine *dbe;
+ SymbolDBEngineIterator *iterator;
+
+ sdb_plugin = ANJUTA_PLUGIN_SYMBOL_DB (sm);
+ dbe = SYMBOL_DB_ENGINE (sdb_plugin->sdbe_project);
+
+ node = SYMBOL_DB_ENGINE_ITERATOR_NODE (symbol);
+
+ node_id = symbol_db_engine_iterator_node_get_symbol_id (node);
+
+ if (node_id <= 0)
+ return NULL;
+
+ iterator = symbol_db_engine_get_symbol_info_by_id (dbe, node_id, info_fields);
+
+ return IANJUTA_ITERABLE (iterator);
+}
+
static void
isymbol_manager_iface_init (IAnjutaSymbolManagerIface *iface)
{
iface->search = isymbol_manager_search;
iface->get_members = isymbol_manager_get_members;
iface->get_class_parents = isymbol_manager_get_class_parents;
+ iface->get_scope = isymbol_manager_get_scope;
+ iface->get_parent_scope = isymbol_manager_get_parent_scope;
+ iface->get_symbol_more_info = isymbol_manager_get_symbol_more_info;
}
static gint
Modified: trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c (original)
+++ trunk/plugins/symbol-db/symbol-db-engine-iterator-node.c Tue Jul 29 21:04:25 2008
@@ -194,7 +194,7 @@
if (sym_info & SYMINFO_FILE_PATH)
{
value = gda_data_model_iter_get_value_for_field (priv->data_iter,
- "file_path");
+ "db_file_path");
}
else if (sym_info & SYMINFO_LANGUAGE)
{
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 Tue Jul 29 21:04:25 2008
@@ -184,6 +184,7 @@
PREP_QUERY_GET_SYMBOL_ID_BY_CLASS_NAME,
PREP_QUERY_GET_SYMBOL_ID_BY_CLASS_NAME_AND_NAMESPACE,
PREP_QUERY_UPDATE_SYMBOL_SCOPE_ID,
+ PREP_QUERY_UPDATE_SYMBOL_SCOPE_ID_MIXED,
PREP_QUERY_GET_SYMBOL_ID_BY_UNIQUE_INDEX_KEY,
PREP_QUERY_UPDATE_SYMBOL_ALL,
PREP_QUERY_REMOVE_NON_UPDATED_SYMBOLS,
@@ -333,6 +334,7 @@
/* some forward declarations */
static void
sdb_engine_second_pass_do (SymbolDBEngine * dbe);
+
static gint
sdb_engine_add_new_symbol (SymbolDBEngine * dbe, const tagEntry * tag_entry,
int file_defined_id,
@@ -797,7 +799,7 @@
/**
* @return -1 on error. Otherwise the id of tuple.
*/
-static gint
+static inline gint
sdb_engine_get_tuple_id_by_unique_name (SymbolDBEngine * dbe, static_query_type qtype,
gchar * param_key,
const GValue * param_value)
@@ -857,7 +859,7 @@
* @return -1 on error. Otherwise the id of table
*
*/
-static gint
+static inline gint
sdb_engine_get_tuple_id_by_unique_name2 (SymbolDBEngine * dbe,
static_query_type qtype,
gchar * param_key1,
@@ -926,7 +928,7 @@
return table_id;
}
-static gint
+static inline gint
sdb_engine_get_tuple_id_by_unique_name3 (SymbolDBEngine * dbe,
static_query_type qtype,
gchar * param_key1,
@@ -1474,7 +1476,7 @@
}
-static inline void
+static void
sdb_engine_ctags_launcher_create (SymbolDBEngine * dbe)
{
SymbolDBEnginePriv *priv;
@@ -1988,7 +1990,16 @@
STATIC_QUERY_POPULATE_INIT_NODE(sdbe->priv->static_query_list,
PREP_QUERY_UPDATE_SYMBOL_SCOPE_ID,
- "UPDATE symbol SET scope_id = ## /* name:'scopeid' type:gint */ "
+ "UPDATE symbol SET scope_id = ## /* name:'scopeid' type:gint */ "
+ "WHERE symbol_id = ## /* name:'symbolid' type:gint */");
+
+ STATIC_QUERY_POPULATE_INIT_NODE(sdbe->priv->static_query_list,
+ PREP_QUERY_UPDATE_SYMBOL_SCOPE_ID_MIXED,
+ "UPDATE symbol SET scope_id = (SELECT scope_definition_id FROM symbol "
+ "JOIN sym_type ON symbol.type_id "
+ "= sym_type.type_id WHERE sym_type.type_type = ## /* name:'tokenname' "
+ "type:gchararray */ AND sym_type.type_name = ## /* name:'objectname' "
+ "type:gchararray */ LIMIT 1) "
"WHERE symbol_id = ## /* name:'symbolid' type:gint */");
STATIC_QUERY_POPULATE_INIT_NODE(sdbe->priv->static_query_list,
@@ -2013,7 +2024,7 @@
STATIC_QUERY_POPULATE_INIT_NODE(sdbe->priv->static_query_list,
PREP_QUERY_REMOVE_NON_UPDATED_SYMBOLS,
"DELETE FROM symbol WHERE file_defined_id = (SELECT file_id FROM file "
- "WHERE file_path = ## /* name:'filepath' type:gchararray */) "
+ "WHERE file.file_path = ## /* name:'filepath' type:gchararray */) "
"AND update_flag = 0");
STATIC_QUERY_POPULATE_INIT_NODE(sdbe->priv->static_query_list,
@@ -2986,8 +2997,11 @@
GPtrArray * filtered_languages;
gboolean ret_code;
g_return_val_if_fail (dbe != NULL, FALSE);
+ g_return_val_if_fail (project_name != NULL, FALSE);
+ g_return_val_if_fail (files_path != NULL, FALSE);
+ g_return_val_if_fail (languages != NULL, FALSE);
priv = dbe->priv;
-
+
g_return_val_if_fail (priv->db_connection != NULL, FALSE);
g_return_val_if_fail (files_path->len > 0, FALSE);
g_return_val_if_fail (languages->len > 0, FALSE);
@@ -3042,7 +3056,7 @@
}
-static gint
+static inline gint
sdb_engine_add_new_sym_type (SymbolDBEngine * dbe, const tagEntry * tag_entry)
{
/*
@@ -3442,7 +3456,7 @@
}
-static gint
+static inline gint
sdb_engine_add_new_scope_definition (SymbolDBEngine * dbe, const tagEntry * tag_entry,
gint type_table_id)
{
@@ -3552,7 +3566,7 @@
*
* @return the table_id of the inserted tuple. -1 on error.
*/
-static gint
+static inline gint
sdb_engine_add_new_tmp_heritage_scope (SymbolDBEngine * dbe,
const tagEntry * tag_entry,
gint symbol_referer_id)
@@ -3736,7 +3750,8 @@
}
/** Return the symbol_id of the changed symbol */
-static gint
+// FIXME: find a quicker way to handle the thing here.
+static inline gint
sdb_engine_second_pass_update_scope_1 (SymbolDBEngine * dbe,
GdaDataModel * data, gint data_row,
gchar * token_name,
@@ -3762,7 +3777,7 @@
tmp_str = g_value_get_string (token_value);
/* we don't need empty strings */
- if (strcmp (tmp_str, "") == 0)
+ if (strlen (tmp_str) <= 0)
{
return -1;
}
@@ -3800,7 +3815,7 @@
value2 = gda_value_new (G_TYPE_STRING);
g_value_set_string (value2, object_name);
- /* we're gonna access db. Lets lock here */
+ /* we're gonna access db. Let's lock here */
if (priv->mutex)
g_mutex_lock (priv->mutex);
@@ -3912,6 +3927,7 @@
priv = dbe->priv;
+ DEBUG_PRINT ("sdb_engine_second_pass_update_scope()");
/* temporary unlock. This function may take a while to be completed
* so let other db-task to be executed, so that main thread
* isn't locked up.
@@ -3921,9 +3937,11 @@
if (priv->mutex)
g_mutex_unlock (priv->mutex);
+ DEBUG_PRINT ("processing %d rows", gda_data_model_get_n_rows (data));
+
for (i = 0; i < gda_data_model_get_n_rows (data); i++)
{
- GValue *value;
+ GValue *value;
if ((value =
(GValue *) gda_data_model_get_value_at_col_name (data,
@@ -3982,8 +4000,7 @@
/* relock */
if (priv->mutex)
- g_mutex_lock (priv->mutex);
-
+ g_mutex_lock (priv->mutex);
}
@@ -4001,7 +4018,8 @@
g_return_if_fail (dbe != NULL);
priv = dbe->priv;
-
+
+ DEBUG_PRINT ("sdb_engine_second_pass_update_heritage ()");
/* unlock */
if (priv->mutex)
g_mutex_unlock (dbe->priv->mutex);
@@ -4201,6 +4219,8 @@
priv = dbe->priv;
+ DEBUG_PRINT ("sdb_engine_second_pass_do()");
+
/* prepare for scope second scan */
if ((stmt1 =
sdb_engine_get_statement_by_query_id (dbe,
@@ -5714,7 +5734,7 @@
sym_info & SYMINFO_FILE_IGNORE ||
sym_info & SYMINFO_FILE_INCLUDE)
{
- info_data = g_string_append (info_data, ",file.file_path AS file_path ");
+ info_data = g_string_append (info_data, ",file.file_path AS db_file_path ");
join_data = g_string_append (join_data, "LEFT JOIN file ON "
"symbol.file_defined_id = file.file_id ");
}
@@ -5838,9 +5858,6 @@
"WHERE heritage.symbol_id_derived = ## /* name:'childklassid' type:gint */",
info_data->str, join_data->str);
- DEBUG_PRINT ("symbol_db_engine_get_class_parents_by_symbol_id query: %s",
- query_str);
-
dyn_node = sdb_engine_insert_dyn_query_node_by_id (dbe,
DYN_PREP_QUERY_GET_CLASS_PARENTS_BY_SYMBOL_ID,
sym_info, 0,
@@ -6902,7 +6919,7 @@
* It will be possible to get the scope specified by the line of the file.
*/
SymbolDBEngineIterator *
-symbol_db_engine_get_current_scope (SymbolDBEngine *dbe, const gchar* filename,
+symbol_db_engine_get_current_scope (SymbolDBEngine *dbe, const gchar* full_local_file_path,
gulong line, SymExtraInfo sym_info)
{
SymbolDBEnginePriv *priv;
@@ -6913,15 +6930,25 @@
GdaHolder *param;
GValue *value;
const DynChildQueryNode *dyn_node;
+ gchar *db_relative_file;
g_return_val_if_fail (dbe != NULL, NULL);
priv = dbe->priv;
+ db_relative_file = symbol_db_engine_get_file_db_path (dbe, full_local_file_path);
+ if (db_relative_file == NULL)
+ return NULL;
+
+ DEBUG_PRINT ("db_relative_file %s", db_relative_file);
+ DEBUG_PRINT ("full_local_file_path %s", full_local_file_path);
+
if (priv->mutex)
{
g_mutex_lock (priv->mutex);
}
+ sym_info = sym_info & ~SYMINFO_FILE_PATH;
+
if ((dyn_node = sdb_engine_get_dyn_query_node_by_id (dbe,
DYN_PREP_QUERY_GET_CURRENT_SCOPE, sym_info, 0)) == NULL)
{
@@ -6936,19 +6963,17 @@
/* fill info_data and join data with optional sql */
sdb_engine_prepare_symbol_info_sql (dbe, info_data, join_data, sym_info);
- /* WARNING: probably there can be some problems with escaping file names here.
- * They should come already escaped as from project db.
- */
query_str = g_strdup_printf ("SELECT symbol.symbol_id AS symbol_id, "
"symbol.name AS name, symbol.file_position AS file_position, "
- "symbol.is_file_scope AS is_file_scope, symbol.signature AS signature, "
- "MIN(## /* name:'linenum' type:gint */ - symbol.file_position) "
- "FROM symbol "
+ "symbol.is_file_scope AS is_file_scope, symbol.signature AS signature "
+ "%s FROM symbol "
"JOIN file ON file_defined_id = file_id "
- "WHERE file.file_path = ## /* name:'filepath' type:gchararray */ "
- "AND ## /* name:'linenum' type:gint */ - "
- "symbol.file_position >= 0");
-
+ "%s WHERE file.file_path = ## /* name:'filepath' type:gchararray */ "
+ "AND symbol.file_position <= ## /* name:'linenum' type:gint */ "
+ "ORDER BY symbol.file_position DESC LIMIT 1",
+ info_data->str, join_data->str);
+/* DEBUG_PRINT ("symbol_db_engine_get_current_scope () %s", query_str);*/
+
dyn_node = sdb_engine_insert_dyn_query_node_by_id (dbe,
DYN_PREP_QUERY_GET_CURRENT_SCOPE,
sym_info, 0,
@@ -6963,6 +6988,7 @@
{
if (priv->mutex)
g_mutex_unlock (priv->mutex);
+ g_free (db_relative_file);
return NULL;
}
@@ -6970,6 +6996,7 @@
{
if (priv->mutex)
g_mutex_unlock (priv->mutex);
+ g_free (db_relative_file);
return NULL;
}
@@ -6983,10 +7010,11 @@
{
if (priv->mutex)
g_mutex_unlock (priv->mutex);
+ g_free (db_relative_file);
return NULL;
}
- gda_holder_set_value_str (param, NULL, filename);
+ gda_holder_set_value_str (param, NULL, db_relative_file);
/* execute the query with parametes just set */
data = gda_connection_statement_execute_select (priv->db_connection,
@@ -7001,11 +7029,15 @@
if (priv->mutex)
g_mutex_unlock (priv->mutex);
+ g_free (db_relative_file);
return NULL;
}
if (priv->mutex)
g_mutex_unlock (priv->mutex);
+
+ g_free (db_relative_file);
+
return (SymbolDBEngineIterator *)symbol_db_engine_iterator_new (data,
priv->sym_type_conversion_hash);
}
@@ -7591,6 +7623,8 @@
* @param include_kinds Should the filter_kinds (if not null) be applied as inluded or excluded?
* @param global_symbols_search If TRUE only global public function will be searched. If false
* even private or static (for C language) will be searched.
+ * @param session_projects Should the search, a global search, be filtered by some packages (projects)?
+ * If yes then provide a GList, if no then pass 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.
* @param sym_info Infos about symbols you want to know.
@@ -7604,6 +7638,7 @@
#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_LIMIT 64
#define DYN_FIND_SYMBOL_BY_NAME_PATTERN_FILTERED_EXTRA_PAR_OFFSET 128
+// FIXME handle session_projects
SymbolDBEngineIterator *
symbol_db_engine_find_symbol_by_name_pattern_filtered (SymbolDBEngine *dbe,
const gchar *pattern,
@@ -7611,6 +7646,7 @@
const GPtrArray *filter_kinds,
gboolean include_kinds,
gboolean global_symbols_search,
+ GList *session_projects,
gint results_limit,
gint results_offset,
SymExtraInfo sym_info)
@@ -7760,11 +7796,11 @@
other_parameters)) == NULL)
{
gint i;
- /* info_data contains the stuff after SELECT and befor FROM */
+ /* info_data contains the stuff after SELECT and before FROM */
info_data = g_string_new ("");
- /* join_data contains the optionals joins to do to retrieve new data on other
- * tables.
+ /* join_data contains the optionals joins to do to retrieve new
+ * data on other tables.
*/
join_data = g_string_new ("");
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 Tue Jul 29 21:04:25 2008
@@ -284,6 +284,8 @@
* @param include_kinds Should the filter_kinds (if not null) be applied as inluded or excluded?
* @param global_symbols_search If TRUE only global public function will be searched. If false
* even private or static (for C language) will be searched.
+ * @param session_projects Should the search, a global search, be filtered by some packages (projects)?
+ * If yes then provide a GList, if no then pass 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.
* @param sym_info Infos about symbols you want to know.
@@ -295,6 +297,7 @@
const GPtrArray *filter_kinds,
gboolean include_kinds,
gboolean global_symbols_search,
+ GList *session_projects,
gint results_limit,
gint results_offset,
SymExtraInfo sym_info);
@@ -318,12 +321,13 @@
SymExtraInfo sym_info);
/**
- * Return an iterator to the data retrieved from database.
- * It will be possible to get the scope specified by the line of the file.
+ * Get the scope specified by the line of the file.
+ * Iterator should contain just one element if the query is successful, no element
+ * or NULL is returned if function went wrong.
*/
SymbolDBEngineIterator *
symbol_db_engine_get_current_scope (SymbolDBEngine *dbe,
- const gchar* filename, gulong line,
+ const gchar* full_local_file_path, gulong line,
SymExtraInfo sym_info);
@@ -366,7 +370,8 @@
gint scoped_symbol_id,
const gchar* db_file);
-/** scope_path cannot be NULL.
+/**
+ * scope_path cannot be NULL.
* scope_path will be something like "scope1_kind", "scope1_name", "scope2_kind",
* "scope2_name", NULL
*/
Modified: trunk/plugins/symbol-db/symbol-db-system.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-system.c (original)
+++ trunk/plugins/symbol-db/symbol-db-system.c Tue Jul 29 21:04:25 2008
@@ -735,7 +735,7 @@
}
void
-symbol_db_parse_aborted_package (SymbolDBSystem *sdbs,
+symbol_db_system_parse_aborted_package (SymbolDBSystem *sdbs,
GPtrArray *files_to_scan_array,
GPtrArray *languages_array)
{
Modified: trunk/plugins/symbol-db/symbol-db-system.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-system.h (original)
+++ trunk/plugins/symbol-db/symbol-db-system.h Tue Jul 29 21:04:25 2008
@@ -109,7 +109,7 @@
* freed inside this function. This for speed reasons.
*/
void
-symbol_db_parse_aborted_package (SymbolDBSystem *sdbs,
+symbol_db_system_parse_aborted_package (SymbolDBSystem *sdbs,
GPtrArray *files_to_scan_array,
GPtrArray *languages_array);
G_END_DECLS
Modified: trunk/plugins/symbol-db/symbol-db-view-locals.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view-locals.c (original)
+++ trunk/plugins/symbol-db/symbol-db-view-locals.c Tue Jul 29 21:04:25 2008
@@ -371,7 +371,7 @@
return GTK_WIDGET (g_object_new (SYMBOL_TYPE_DB_VIEW_LOCALS, NULL));
}
-static GtkTreeRowReference *
+static inline GtkTreeRowReference *
do_add_root_symbol_to_view (SymbolDBViewLocals *dbvl, const GdkPixbuf *pixbuf,
const gchar* symbol_name, gint symbol_id)
{
Modified: trunk/plugins/symbol-db/symbol-db-view.c
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view.c (original)
+++ trunk/plugins/symbol-db/symbol-db-view.c Tue Jul 29 21:04:25 2008
@@ -1572,7 +1572,7 @@
* @return The pixbufs. It will initialize pixbufs first if they weren't before
* @param node_access can be NULL.
*/
-const GdkPixbuf*
+inline const GdkPixbuf*
symbol_db_view_get_pixbuf (const gchar *node_type, const gchar *node_access)
{
gchar *search_node;
Modified: trunk/plugins/symbol-db/symbol-db-view.h
==============================================================================
--- trunk/plugins/symbol-db/symbol-db-view.h (original)
+++ trunk/plugins/symbol-db/symbol-db-view.h Tue Jul 29 21:04:25 2008
@@ -62,7 +62,7 @@
/* return the pixbufs. It will initialize pixbufs first if they weren't before
* node_access: can be NULL.
*/
-const GdkPixbuf*
+inline const GdkPixbuf*
symbol_db_view_get_pixbuf (const gchar *node_type, const gchar *node_access);
void
Modified: trunk/plugins/symbol-db/test/benchmark.c
==============================================================================
--- trunk/plugins/symbol-db/test/benchmark.c (original)
+++ trunk/plugins/symbol-db/test/benchmark.c Tue Jul 29 21:04:25 2008
@@ -69,8 +69,7 @@
}
root_dir = argv[1];
- GMutex *mutex = g_mutex_new ();
- engine = symbol_db_engine_new (mutex);
+ engine = symbol_db_engine_new ("/usr/bin/ctags");
if (!symbol_db_engine_open_db (engine, root_dir, root_dir))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]