Use TMTagType everywhere to hold tag types

This commit is contained in:
Colomban Wendling 2014-10-31 20:07:27 +01:00
parent d7ed48f86b
commit 42a9603f4a
6 changed files with 27 additions and 25 deletions

View File

@ -1831,7 +1831,7 @@ static gboolean append_calltip(GString *str, const TMTag *tag, filetype_id ft_id
static gchar *find_calltip(const gchar *word, GeanyFiletype *ft) static gchar *find_calltip(const gchar *word, GeanyFiletype *ft)
{ {
const GPtrArray *tags; const GPtrArray *tags;
const gint arg_types = tm_tag_function_t | tm_tag_prototype_t | const TMTagType arg_types = tm_tag_function_t | tm_tag_prototype_t |
tm_tag_method_t | tm_tag_macro_with_arg_t; tm_tag_method_t | tm_tag_macro_with_arg_t;
TMTagAttrType *attrs = NULL; TMTagAttrType *attrs = NULL;
TMTag *tag; TMTag *tag;

View File

@ -489,7 +489,7 @@ static gint compare_symbol_lines(gconstpointer a, gconstpointer b)
} }
static GList *get_tag_list(GeanyDocument *doc, guint tag_types) static GList *get_tag_list(GeanyDocument *doc, TMTagType tag_types)
{ {
GList *tag_names = NULL; GList *tag_names = NULL;
TMTag *tag; TMTag *tag;
@ -1922,8 +1922,8 @@ static void load_user_tags(filetype_id ft_id)
static gboolean goto_tag(const gchar *name, gboolean definition) static gboolean goto_tag(const gchar *name, gboolean definition)
{ {
const gint forward_types = tm_tag_prototype_t | tm_tag_externvar_t; const TMTagType forward_types = tm_tag_prototype_t | tm_tag_externvar_t;
guint type; TMTagType type;
TMTag *tmtag = NULL; TMTag *tmtag = NULL;
GeanyDocument *old_doc = document_get_current(); GeanyDocument *old_doc = document_get_current();
@ -2113,7 +2113,7 @@ static gint get_fold_header_after(ScintillaObject *sci, gint line)
} }
static gint get_current_tag_name(GeanyDocument *doc, gchar **tagname, guint tag_types) static gint get_current_tag_name(GeanyDocument *doc, gchar **tagname, TMTagType tag_types)
{ {
gint line; gint line;
gint parent; gint parent;
@ -2190,7 +2190,7 @@ static gint get_current_tag_name(GeanyDocument *doc, gchar **tagname, guint tag_
} }
static gint get_current_tag_name_cached(GeanyDocument *doc, const gchar **tagname, guint tag_types) static gint get_current_tag_name_cached(GeanyDocument *doc, const gchar **tagname, TMTagType tag_types)
{ {
static gint tag_line = -1; static gint tag_line = -1;
static gchar *cur_tag = NULL; static gchar *cur_tag = NULL;
@ -2236,7 +2236,7 @@ gint symbols_get_current_function(GeanyDocument *doc, const gchar **tagname)
/* same as symbols_get_current_function() but finds class, namespaces and more */ /* same as symbols_get_current_function() but finds class, namespaces and more */
gint symbols_get_current_scope(GeanyDocument *doc, const gchar **tagname) gint symbols_get_current_scope(GeanyDocument *doc, const gchar **tagname)
{ {
guint tag_types = (tm_tag_function_t | tm_tag_method_t | tm_tag_class_t | TMTagType tag_types = (tm_tag_function_t | tm_tag_method_t | tm_tag_class_t |
tm_tag_struct_t | tm_tag_enum_t | tm_tag_union_t); tm_tag_struct_t | tm_tag_enum_t | tm_tag_union_t);
/* Python parser reports imports as namespaces which confuses the scope detection */ /* Python parser reports imports as namespaces which confuses the scope detection */

View File

@ -78,7 +78,7 @@ static void log_tag_free(TMTag *tag)
#endif /* DEBUG_TAG_REFS */ #endif /* DEBUG_TAG_REFS */
const guint TM_GLOBAL_TYPE_MASK = const TMTagType TM_GLOBAL_TYPE_MASK =
tm_tag_class_t | tm_tag_enum_t | tm_tag_interface_t | tm_tag_class_t | tm_tag_enum_t | tm_tag_interface_t |
tm_tag_struct_t | tm_tag_typedef_t | tm_tag_union_t | tm_tag_namespace_t; tm_tag_struct_t | tm_tag_typedef_t | tm_tag_union_t | tm_tag_namespace_t;
@ -131,7 +131,7 @@ static const char *s_tag_type_names[] = {
"other" /* Other tag type (non C/C++/Java) */ "other" /* Other tag type (non C/C++/Java) */
}; };
static int s_tag_types[] = { static TMTagType s_tag_types[] = {
tm_tag_class_t, tm_tag_class_t,
tm_tag_enum_t, tm_tag_enum_t,
tm_tag_enumerator_t, tm_tag_enumerator_t,
@ -164,7 +164,7 @@ GType tm_tag_get_type(void)
return gtype; return gtype;
} }
static int get_tag_type(const char *tag_name) static TMTagType get_tag_type(const char *tag_name)
{ {
unsigned int i; unsigned int i;
int cmp; int cmp;
@ -981,7 +981,7 @@ GPtrArray *tm_tags_merge(GPtrArray *big_array, GPtrArray *small_array,
the original array. the original array.
@return an array of tags (NULL on failure) @return an array of tags (NULL on failure)
*/ */
GPtrArray *tm_tags_extract(GPtrArray *tags_array, guint tag_types) GPtrArray *tm_tags_extract(GPtrArray *tags_array, TMTagType tag_types)
{ {
GPtrArray *new_tags; GPtrArray *new_tags;
guint i; guint i;

View File

@ -143,7 +143,7 @@ typedef struct _TMTag
#ifdef GEANY_PRIVATE #ifdef GEANY_PRIVATE
extern const guint TM_GLOBAL_TYPE_MASK; extern const TMTagType TM_GLOBAL_TYPE_MASK;
typedef enum { typedef enum {

View File

@ -633,7 +633,7 @@ void tm_workspace_update_source_file_buffer(TMSourceFile *source_file, guchar* t
-1 for all -1 for all
@return Array of matching tags. Do not free() it since it is a static member. @return Array of matching tags. Do not free() it since it is a static member.
*/ */
const GPtrArray *tm_workspace_find(const char *name, int type, TMTagAttrType *attrs, const GPtrArray *tm_workspace_find(const char *name, TMTagType type, TMTagAttrType *attrs,
gboolean partial, langType lang) gboolean partial, langType lang)
{ {
static GPtrArray *tags = NULL; static GPtrArray *tags = NULL;
@ -735,7 +735,7 @@ static gboolean match_langs(gint lang, const TMTag *tag)
* lang can be -1 */ * lang can be -1 */
static int static int
fill_find_tags_array (GPtrArray *dst, const GPtrArray *src, fill_find_tags_array (GPtrArray *dst, const GPtrArray *src,
const char *name, const char *scope, int type, gboolean partial, const char *name, const char *scope, TMTagType type, gboolean partial,
gint lang, gboolean first) gint lang, gboolean first)
{ {
TMTag **match; TMTag **match;
@ -777,7 +777,7 @@ fill_find_tags_array (GPtrArray *dst, const GPtrArray *src,
@return Array of matching tags. Do not free() it since it is a static member. @return Array of matching tags. Do not free() it since it is a static member.
*/ */
const GPtrArray * const GPtrArray *
tm_workspace_find_scoped (const char *name, const char *scope, gint type, tm_workspace_find_scoped (const char *name, const char *scope, TMTagType type,
TMTagAttrType *attrs, gboolean partial, langType lang, gboolean global_search) TMTagAttrType *attrs, gboolean partial, langType lang, gboolean global_search)
{ {
static GPtrArray *tags = NULL; static GPtrArray *tags = NULL;
@ -807,7 +807,7 @@ tm_workspace_find_scoped (const char *name, const char *scope, gint type,
@param tag_types the tag types to include in the match @param tag_types the tag types to include in the match
@return TMTag pointers to owner tag. */ @return TMTag pointers to owner tag. */
const TMTag * const TMTag *
tm_get_current_tag (GPtrArray * file_tags, const gulong line, const guint tag_types) tm_get_current_tag (GPtrArray * file_tags, const gulong line, const TMTagType tag_types)
{ {
TMTag *matching_tag = NULL; TMTag *matching_tag = NULL;
if (file_tags && file_tags->len) if (file_tags && file_tags->len)
@ -972,7 +972,8 @@ tm_workspace_find_scope_members (const GPtrArray * file_tags, const char *name,
while (1) while (1)
{ {
const GPtrArray *tags2; const GPtrArray *tags2;
int got = 0, types = (tm_tag_class_t | tm_tag_namespace_t | int got = 0;
TMTagType types = (tm_tag_class_t | tm_tag_namespace_t |
tm_tag_struct_t | tm_tag_typedef_t | tm_tag_struct_t | tm_tag_typedef_t |
tm_tag_union_t | tm_tag_enum_t); tm_tag_union_t | tm_tag_enum_t);
@ -1194,7 +1195,8 @@ tm_workspace_find_namespace_members (const GPtrArray * file_tags, const char *na
while (1) while (1)
{ {
const GPtrArray *tags2; const GPtrArray *tags2;
int got = 0, types = (tm_tag_class_t | tm_tag_namespace_t | int got = 0;
TMTagType types = (tm_tag_class_t
tm_tag_struct_t | tm_tag_typedef_t | tm_tag_struct_t | tm_tag_typedef_t |
tm_tag_union_t | tm_tag_enum_t); tm_tag_union_t | tm_tag_enum_t);

View File

@ -53,11 +53,11 @@ gboolean tm_workspace_load_global_tags(const char *tags_file, gint mode);
gboolean tm_workspace_create_global_tags(const char *pre_process, const char **includes, gboolean tm_workspace_create_global_tags(const char *pre_process, const char **includes,
int includes_count, const char *tags_file, int lang); int includes_count, const char *tags_file, int lang);
const GPtrArray *tm_workspace_find(const char *name, int type, TMTagAttrType *attrs, const GPtrArray *tm_workspace_find(const char *name, TMTagType type, TMTagAttrType *attrs,
gboolean partial, langType lang); gboolean partial, langType lang);
const GPtrArray * const GPtrArray *
tm_workspace_find_scoped (const char *name, const char *scope, gint type, tm_workspace_find_scoped (const char *name, const char *scope, TMTagType type,
TMTagAttrType *attrs, gboolean partial, langType lang, gboolean global_search); TMTagAttrType *attrs, gboolean partial, langType lang, gboolean global_search);
const GPtrArray *tm_workspace_find_scope_members(const GPtrArray *file_tags, const GPtrArray *tm_workspace_find_scope_members(const GPtrArray *file_tags,
@ -65,7 +65,7 @@ const GPtrArray *tm_workspace_find_scope_members(const GPtrArray *file_tags,
gboolean find_global, gboolean find_global,
gboolean no_definitions); gboolean no_definitions);
const TMTag *tm_get_current_tag(GPtrArray *file_tags, const gulong line, const guint tag_types); const TMTag *tm_get_current_tag(GPtrArray *file_tags, const gulong line, const TMTagType tag_types);
void tm_workspace_update_source_file_buffer(TMSourceFile *source_file, guchar* text_buf, void tm_workspace_update_source_file_buffer(TMSourceFile *source_file, guchar* text_buf,
gint buf_size, gboolean update_workspace); gint buf_size, gboolean update_workspace);