Commit 33e87a1f authored by Massimo Cora\'s avatar Massimo Cora\ Committed by Johannes Schmid

fixed global search. There were some bitwise problems in

2008-07-07  Massimo Cora\'  <maxcvs@email.it>

	* libanjuta/interfaces/libanjuta.idl:
	* plugins/symbol-db/plugin.c (isymbol_manager_search):
	* plugins/symbol-db/symbol-db-engine.c
	(symbol_db_engine_get_class_parents_by_symbol_id),
	(symbol_db_engine_get_class_parents),
	(symbol_db_engine_get_scope_members_by_symbol_id),
	(symbol_db_engine_get_scope_members),
	(symbol_db_engine_get_current_scope),
	(symbol_db_engine_get_file_symbols),
	(symbol_db_engine_find_symbol_by_name_pattern),
	(symbol_db_engine_find_symbol_by_name_pattern_filtered):
	fixed global search. There were some bitwise problems in IAnjutaSymbolManager 
	interface.

svn path=/trunk/; revision=4071
parent f2770a4a
2008-07-07 Massimo Cora' <maxcvs@email.it>
* libanjuta/interfaces/libanjuta.idl:
* plugins/symbol-db/plugin.c (isymbol_manager_search):
* plugins/symbol-db/symbol-db-engine.c
(symbol_db_engine_get_class_parents_by_symbol_id),
(symbol_db_engine_get_class_parents),
(symbol_db_engine_get_scope_members_by_symbol_id),
(symbol_db_engine_get_scope_members),
(symbol_db_engine_get_current_scope),
(symbol_db_engine_get_file_symbols),
(symbol_db_engine_find_symbol_by_name_pattern),
(symbol_db_engine_find_symbol_by_name_pattern_filtered):
fixed global search. There were some bitwise problems in IAnjutaSymbolManager
interface.
2008-07-07 Johannes Schmid <jhs@gnome.org>
* libanjuta/libanjuta-1.0.vapi:
......
......@@ -4541,47 +4541,47 @@ interface IAnjutaSymbol
enum Type
{
TYPE_UNDEF = 0, // Unknown type
TYPE_CLASS = 1, // Class declaration
TYPE_ENUM = 2, // Enum declaration
TYPE_ENUMERATOR = 4, // Enumerator value
TYPE_FIELD = 8, // Field (Java only)
TYPE_FUNCTION = 16, // Function definition
TYPE_INTERFACE = 32, // Interface (Java only)
TYPE_MEMBER = 64, // Member variable of class/struct
TYPE_METHOD = 128, // Class method (Java only)
TYPE_NAMESPACE = 256, // Namespace declaration
TYPE_PACKAGE = 512, // Package (Java only)
TYPE_PROTOTYPE = 1024, // Function prototype
TYPE_STRUCT = 2048, // Struct declaration
TYPE_TYPEDEF = 4096, // Typedef
TYPE_UNION = 8192, // Union
TYPE_VARIABLE = 16384, // Variable
TYPE_EXTERNVAR = 32768, // Extern or forward declaration
TYPE_MACRO = 65536, // Macro (without arguments)
TYPE_MACRO_WITH_ARG = 131072, // Parameterized macro
TYPE_FILE = 262144, // File (Pseudo tag)
TYPE_OTHER = 524288, // Other (non C/C++/Java tag)
TYPE_MAX = 1048575 // Maximum value
TYPE_UNDEF = 1, // Unknown type
TYPE_CLASS = 2, // Class declaration
TYPE_ENUM = 4, // Enum declaration
TYPE_ENUMERATOR = 8, // Enumerator value
TYPE_FIELD = 16, // Field (Java only)
TYPE_FUNCTION = 32, // Function definition
TYPE_INTERFACE = 64, // Interface (Java only)
TYPE_MEMBER = 128, // Member variable of class/struct
TYPE_METHOD = 256, // Class method (Java only)
TYPE_NAMESPACE = 512, // Namespace declaration
TYPE_PACKAGE = 1024, // Package (Java only)
TYPE_PROTOTYPE = 2048, // Function prototype
TYPE_STRUCT = 4096, // Struct declaration
TYPE_TYPEDEF = 8192, // Typedef
TYPE_UNION = 16384, // Union
TYPE_VARIABLE = 32768, // Variable
TYPE_EXTERNVAR = 65536, // Extern or forward declaration
TYPE_MACRO = 131072, // Macro (without arguments)
TYPE_MACRO_WITH_ARG = 262144, // Parameterized macro
TYPE_FILE = 524288, // File (Pseudo tag)
TYPE_OTHER = 1048576, // Other (non C/C++/Java tag)
TYPE_MAX = 2097151 // Maximum value, means all known values.
}
/* Field masks -- used mainly to retrieve fields of a symbol */
enum Field
{
FIELD_SIMPLE = 0, // With this field you will have name, line of declaration,
FIELD_SIMPLE = 1, // With this field you will have name, line of declaration,
// is_file_scope and signature of the symbol
FIELD_FILE_PATH = 1,
FIELD_IMPLEMENTATION = 2,
FIELD_ACCESS = 4,
FIELD_KIND = 8,
FIELD_TYPE = 16,
FIELD_TYPE_NAME = 32,
FIELD_LANGUAGE = 64,
FIELD_FILE_IGNORE = 128,
FIELD_FILE_INCLUDE = 256,
FIELD_PROJECT_NAME = 512,
FIELD_WORKSPACE_NAME = 1024
FIELD_FILE_PATH = 2,
FIELD_IMPLEMENTATION = 4,
FIELD_ACCESS = 8,
FIELD_KIND = 16,
FIELD_TYPE = 32,
FIELD_TYPE_NAME = 64,
FIELD_LANGUAGE = 128,
FIELD_FILE_IGNORE = 256,
FIELD_FILE_INCLUDE = 512,
FIELD_PROJECT_NAME = 1024,
FIELD_WORKSPACE_NAME = 2048
}
/**
......@@ -4656,7 +4656,7 @@ interface IAnjutaSymbolManager
/**
* ianjuta_symbol_manager_search:
* @obj: Self
* @match_types: If passed IANJUTA_TYPE_UNDEF the function will not perfom any filter.
* @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.
* @match_name: fixme
......
......@@ -336,7 +336,7 @@ cpp_java_assist_create_scope_completion_cache (CppJavaAssist *assist,
}
}
else if (g_str_equal (scope_operator, ".") ||
g_str_equal (scope_operator, "->"))
g_str_equal (scope_operator, "->"))
{
/* TODO: Find the type of context by parsing the file somehow and
search for the member as it is done with the :: context */
......@@ -359,7 +359,7 @@ cpp_java_assist_create_word_completion_cache (CppJavaAssist *assist,
cpp_java_assist_destroy_completion_cache (assist);
IAnjutaIterable* iter_project =
ianjuta_symbol_manager_search (assist->priv->isymbol_manager,
IANJUTA_SYMBOL_TYPE_MAX,
IANJUTA_SYMBOL_TYPE_MAX,
TRUE,
IANJUTA_SYMBOL_FIELD_SIMPLE|IANJUTA_SYMBOL_FIELD_TYPE,
pre_word, TRUE, FALSE, FALSE, max_completions, -1, NULL);
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.4 on Tue Jul 1 00:29:01 2008 -->
<!--Generated with glade3 3.4.4 on Mon Jul 7 23:02:54 2008 -->
<glade-interface>
<widget class="GtkWindow" id="symbol_db_pref_window">
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
......@@ -8,6 +8,7 @@
<widget class="GtkVBox" id="symbol_prefs">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="spacing">1</property>
<child>
<widget class="GtkFrame" id="frame1">
<property name="visible">True</property>
......@@ -39,8 +40,8 @@
<widget class="GtkFileChooserButton" id="preferences_folder:text:/:0:symboldb.root">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="use_preview_label">False</property>
<property name="preview_widget_active">False</property>
<property name="use_preview_label">False</property>
<property name="title" translatable="yes">Choose Ctags executable</property>
</widget>
<packing>
......@@ -201,6 +202,7 @@
</child>
</widget>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
......
......@@ -1531,19 +1531,33 @@ isymbol_manager_search (IAnjutaSymbolManager *sm,
dbe_project = SYMBOL_DB_ENGINE (sdb_plugin->sdbe_project);
dbe_globals = SYMBOL_DB_ENGINE (sdb_plugin->sdbe_globals);
if (match_types & IANJUTA_SYMBOL_TYPE_UNDEF)
if (match_types & IANJUTA_SYMBOL_TYPE_MAX)
{
filter_array = NULL;
else
}
else
{
filter_array = symbol_db_engine_fill_type_array (match_types);
}
/* DEBUG REMOVE ME *
gint i;
if (filter_array != NULL)
for (i=0; i < filter_array->len; i++)
{
DEBUG_PRINT ("isymbol_manager_search (): search for type %s",
g_ptr_array_index (filter_array, i));
}
//*/
if (exact_match == FALSE)
pattern = g_strdup_printf ("%s%%", match_name);
else
pattern = g_strdup_printf ("%s", match_name);
/* should we lookup for project of system tags? */
DEBUG_PRINT ("tags scan [%s] [exact_match %d] [global %d]", pattern,
exact_match, global_symbols_search);
/* DEBUG_PRINT ("tags scan [%s] [exact_match %d] [global %d]", pattern,
exact_match, global_symbols_search); */
iterator =
symbol_db_engine_find_symbol_by_name_pattern_filtered (
global_tags_search == FALSE ? dbe_project : dbe_globals,
......@@ -1555,7 +1569,6 @@ isymbol_manager_search (IAnjutaSymbolManager *sm,
results_limit,
results_offset,
info_fields);
DEBUG_PRINT ("iterator length %d", ianjuta_iterable_get_length (iterator, NULL));
g_free (pattern);
if (filter_array)
......
......@@ -1966,7 +1966,7 @@ sdb_engine_init (SymbolDBEngine * object)
STATIC_QUERY_POPULATE_INIT_NODE(sdbe->priv->static_query_list,
PREP_QUERY_GET_SYMBOL_ID_BY_CLASS_NAME,
"SELECT symbol_id FROM symbol JOIN sym_type ON symbol.type_id = "
"sym_type.type_id WHERE scope_id=0 AND sym_type.type_type='class' AND "
"sym_type.type_id AND symbol.scope_id = 0 WHERE AND sym_type.type_type='class' AND "
"name = ## /* name:'klassname' type:gchararray */ LIMIT 1");
STATIC_QUERY_POPULATE_INIT_NODE(sdbe->priv->static_query_list,
......@@ -5807,8 +5807,7 @@ symbol_db_engine_get_class_parents_by_symbol_id (SymbolDBEngine *dbe,
}
if (dyn_node == NULL)
{
DEBUG_PRINT ("dyn_node is NULL");
{
if (priv->mutex)
g_mutex_unlock (priv->mutex);
return NULL;
......@@ -5950,8 +5949,7 @@ symbol_db_engine_get_class_parents (SymbolDBEngine *dbe, const gchar *klass_name
if (dyn_node == NULL)
{
DEBUG_PRINT ("dyn_node is NULL");
{
if (priv->mutex)
g_mutex_unlock (priv->mutex);
return NULL;
......@@ -6648,8 +6646,7 @@ select b.* from symbol a, symbol b where a.symbol_id = 348 and
g_free (offset);
if (dyn_node == NULL)
{
DEBUG_PRINT ("dyn_node is NULL");
{
if (priv->mutex)
g_mutex_unlock (priv->mutex);
return NULL;
......@@ -6812,8 +6809,7 @@ es. scope_path = First, namespace, Second, namespace, NULL,
}
if (dyn_node == NULL)
{
DEBUG_PRINT ("dyn_node is NULL");
{
if (priv->mutex)
g_mutex_unlock (priv->mutex);
return NULL;
......@@ -6919,8 +6915,7 @@ symbol_db_engine_get_current_scope (SymbolDBEngine *dbe, const gchar* filename,
}
if (dyn_node == NULL)
{
DEBUG_PRINT ("dyn_node is NULL");
{
if (priv->mutex)
g_mutex_unlock (priv->mutex);
return NULL;
......@@ -7037,8 +7032,7 @@ symbol_db_engine_get_file_symbols (SymbolDBEngine *dbe,
}
if (dyn_node == NULL)
{
DEBUG_PRINT ("dyn_node is NULL");
{
if (priv->mutex)
g_mutex_unlock (priv->mutex);
return NULL;
......@@ -7233,8 +7227,7 @@ symbol_db_engine_find_symbol_by_name_pattern (SymbolDBEngine *dbe,
}
if (dyn_node == NULL)
{
DEBUG_PRINT ("dyn_node is NULL");
{
if (priv->mutex)
g_mutex_unlock (priv->mutex);
return NULL;
......@@ -7848,7 +7841,7 @@ symbol_db_engine_find_symbol_by_name_pattern_filtered (SymbolDBEngine *dbe,
g_mutex_unlock (priv->mutex);
return NULL;
}
DEBUG_PRINT ("SETTING globalsearch %d", !global_symbols_search);
value = gda_value_new (G_TYPE_INT);
g_value_set_int (value, !global_symbols_search);
gda_holder_set_value (param, value);
......@@ -7864,8 +7857,8 @@ DEBUG_PRINT ("SETTING globalsearch %d", !global_symbols_search);
gda_holder_set_value_str (param, NULL, pattern);
DEBUG_PRINT ("symbol_db_engine_find_symbol_by_name_pattern_filtered query: %s",
dyn_node->query_str);
/* DEBUG_PRINT ("symbol_db_engine_find_symbol_by_name_pattern_filtered query: %s",
dyn_node->query_str);*/
/* execute the query with parametes just set */
data = gda_connection_statement_execute_select (priv->db_connection,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment