geany
1.38
About: Geany is a text editor (using GTK2) with basic features of an integrated development environment (syntax highlighting, code folding, symbol name auto-completion, ...). F: office T: editor programming GTK+ IDE
![]() ![]() |
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <ctype.h>
#include <sys/types.h>
#include <string.h>
#include <sys/stat.h>
#include <glib/gstdio.h>
#include "tm_workspace.h"
#include "tm_ctags.h"
#include "tm_tag.h"
#include "tm_parser.h"
Go to the source code of this file.
Functions | |
static gboolean | tm_create_workspace (void) |
void | tm_workspace_free (void) |
const TMWorkspace * | tm_get_workspace (void) |
static void | tm_workspace_merge_tags (GPtrArray **big_array, GPtrArray *small_array) |
static void | merge_extracted_tags (GPtrArray **dest, GPtrArray *src, TMTagType tag_types) |
static void | update_source_file (TMSourceFile *source_file, guchar *text_buf, gsize buf_size, gboolean use_buffer, gboolean update_workspace) |
void | tm_workspace_add_source_file (TMSourceFile *source_file) |
Adds a source file to the workspace, parses it and updates the workspace tags. More... | |
void | tm_workspace_add_source_file_noupdate (TMSourceFile *source_file) |
void | tm_workspace_update_source_file_buffer (TMSourceFile *source_file, guchar *text_buf, gsize buf_size) |
void | tm_workspace_remove_source_file (TMSourceFile *source_file) |
Removes a source file from the workspace if it exists. More... | |
static void | tm_workspace_update (void) |
void | tm_workspace_add_source_files (GPtrArray *source_files) |
Adds multiple source files to the workspace and updates the workspace tag arrays. More... | |
void | tm_workspace_remove_source_files (GPtrArray *source_files) |
Removes multiple source files from the workspace and updates the workspace tag arrays. More... | |
gboolean | tm_workspace_load_global_tags (const char *tags_file, TMParserType mode) |
static gboolean | write_includes_file (const gchar *outf, GList *includes_files) |
static gboolean | combine_include_files (const gchar *outf, GList *file_list) |
static gchar * | create_temp_file (const gchar *tpl) |
static GList * | lookup_includes (const gchar **includes, gint includes_count) |
static gchar * | pre_process_file (const gchar *cmd, const gchar *inf) |
gboolean | tm_workspace_create_global_tags (const char *pre_process, const char **includes, int includes_count, const char *tags_file, TMParserType lang) |
static void | fill_find_tags_array (GPtrArray *dst, const GPtrArray *src, const char *name, const char *scope, TMTagType type, TMParserType lang) |
GPtrArray * | tm_workspace_find (const char *name, const char *scope, TMTagType type, TMTagAttrType *attrs, TMParserType lang) |
static void | fill_find_tags_array_prefix (GPtrArray *dst, const GPtrArray *src, const char *name, TMParserType lang, guint max_num) |
GPtrArray * | tm_workspace_find_prefix (const char *prefix, TMParserType lang, guint max_num) |
static GPtrArray * | find_scope_members_tags (const GPtrArray *all, TMTag *type_tag, gboolean namespace) |
static gchar * | strip_type (const gchar *scoped_name, TMParserType lang) |
static GPtrArray * | find_scope_members (const GPtrArray *tags_array, const gchar *name, TMSourceFile *file, TMParserType lang, gboolean namespace) |
static gboolean | member_at_method_scope (const GPtrArray *tags, const gchar *method_scope, TMTag *member_tag, TMParserType lang) |
static GPtrArray * | find_scope_members_all (const GPtrArray *tags, const GPtrArray *searched_array, TMParserType lang, gboolean member, const gchar *current_scope) |
static GPtrArray * | find_namespace_members_all (const GPtrArray *tags, const GPtrArray *searched_array, TMParserType lang) |
GPtrArray * | tm_workspace_find_scope_members (TMSourceFile *source_file, const char *name, gboolean function, gboolean member, const gchar *current_scope, gboolean search_namespace) |
Variables | |
static TMTagAttrType | workspace_tags_sort_attrs [] |
static TMTagAttrType | file_tags_sort_attrs [] |
static TMTagAttrType | global_tags_sort_attrs [] |
static TMTagType | TM_TYPE_WITH_MEMBERS |
static TMTagType | TM_GLOBAL_TYPE_MASK |
static TMWorkspace * | theWorkspace = NULL |
|
static |
Definition at line 394 of file tm_workspace.c.
References NULL.
Referenced by tm_workspace_create_global_tags().
|
static |
Definition at line 427 of file tm_workspace.c.
References close, name, and NULL.
Referenced by pre_process_file(), and tm_workspace_create_global_tags().
|
static |
Definition at line 637 of file tm_workspace.c.
References name, scope, tm_parser_langs_compatible(), and tm_tags_find().
Referenced by find_scope_members(), member_at_method_scope(), and tm_workspace_find().
|
static |
Definition at line 684 of file tm_workspace.c.
References count, name, TMTag::name, NULL, tm_parser_langs_compatible(), tm_tag_is_anon(), and tm_tags_find().
Referenced by tm_workspace_find_prefix().
|
static |
Definition at line 976 of file tm_workspace.c.
References find_scope_members_tags(), NULL, and TM_TAG.
Referenced by tm_workspace_find_scope_members().
|
static |
Definition at line 804 of file tm_workspace.c.
References TMTag::file, fill_find_tags_array(), find_scope_members_tags(), TMTag::lang, name, NULL, strip_type(), TMSourceFile::tags_array, TM_TAG, tm_tag_is_anon(), tm_tag_typedef_t, TM_TYPE_WITH_MEMBERS, TMTag::type, and TMTag::var_type.
Referenced by find_scope_members_all().
|
static |
Definition at line 932 of file tm_workspace.c.
References TMTag::file, find_scope_members(), find_scope_members_tags(), TMTag::lang, member_at_method_scope(), TMTag::name, NULL, strip_type(), TMSourceFile::tags_array, TM_TAG, tm_tag_field_t, tm_tag_member_t, tm_tag_method_t, tm_tag_typedef_t, TM_TYPE_WITH_MEMBERS, TMTag::type, and TMTag::var_type.
Referenced by tm_workspace_find_scope_members().
|
static |
Definition at line 742 of file tm_workspace.c.
References TMTag::lang, TMTag::name, NULL, scope, TMTag::scope, tm_parser_context_separator(), tm_parser_langs_compatible(), TM_TAG, tm_tag_is_anon(), tm_tag_max_t, tm_tag_typedef_t, TM_TYPE_WITH_MEMBERS, and TMTag::type.
Referenced by find_namespace_members_all(), find_scope_members(), and find_scope_members_all().
|
static |
Definition at line 441 of file tm_workspace.c.
References NULL.
Referenced by tm_workspace_create_global_tags().
|
static |
Definition at line 881 of file tm_workspace.c.
References TMTag::file, fill_find_tags_array(), NULL, TMTag::scope, TMSourceFile::tags_array, tm_parser_context_separator(), tm_tag_namespace_t, and TM_TYPE_WITH_MEMBERS.
Referenced by find_scope_members_all().
|
static |
Definition at line 133 of file tm_workspace.c.
References tm_tags_extract(), and tm_workspace_merge_tags().
Referenced by update_source_file().
|
static |
Definition at line 521 of file tm_workspace.c.
References command, create_temp_file(), and NULL.
Referenced by tm_workspace_create_global_tags().
|
static |
Definition at line 783 of file tm_workspace.c.
References name, NULL, and tm_parser_context_separator().
Referenced by find_scope_members(), and find_scope_members_all().
|
static |
Definition at line 70 of file tm_workspace.c.
References TMWorkspace::global_tags, TMWorkspace::global_typename_array, TMWorkspace::source_files, TMWorkspace::tags_array, theWorkspace, tm_ctags_init(), tm_parser_verify_type_mappings(), and TMWorkspace::typename_array.
Referenced by tm_get_workspace().
const TMWorkspace * tm_get_workspace | ( | void | ) |
Definition at line 116 of file tm_workspace.c.
References NULL, theWorkspace, and tm_create_workspace().
Referenced by get_tag_count(), main_lib(), and symbols_generate_global_tags().
void tm_workspace_add_source_file | ( | TMSourceFile * | source_file | ) |
Adds a source file to the workspace, parses it and updates the workspace tags.
source_file | The source file to add to the workspace. |
Definition at line 181 of file tm_workspace.c.
References NULL, TMWorkspace::source_files, theWorkspace, and update_source_file().
void tm_workspace_add_source_file_noupdate | ( | TMSourceFile * | source_file | ) |
Definition at line 190 of file tm_workspace.c.
References NULL, TMWorkspace::source_files, and theWorkspace.
Referenced by document_update_tags(), and tm_workspace_add_source_files().
void tm_workspace_add_source_files | ( | GPtrArray * | source_files | ) |
Adds multiple source files to the workspace and updates the workspace tag arrays.
This is more efficient than calling tm_workspace_add_source_file() and tm_workspace_update_source_file() separately for each of the files.
source_files | (element-type: TMSourceFile) The source files to be added to the workspace. |
Definition at line 292 of file tm_workspace.c.
References NULL, tm_workspace_add_source_file_noupdate(), tm_workspace_update(), and update_source_file().
gboolean tm_workspace_create_global_tags | ( | const char * | pre_process, |
const char ** | includes, | ||
int | includes_count, | ||
const char * | tags_file, | ||
TMParserType | lang | ||
) |
Definition at line 576 of file tm_workspace.c.
References combine_include_files(), create_temp_file(), global_tags_sort_attrs, lookup_includes(), NULL, pre_process_file(), TMSourceFile::tags_array, tm_source_file_free(), tm_source_file_get_lang_name(), tm_source_file_new(), tm_source_file_write_tags_file(), tm_tags_sort(), update_source_file(), and write_includes_file().
Referenced by symbols_generate_global_tags().
GPtrArray * tm_workspace_find | ( | const char * | name, |
const char * | scope, | ||
TMTagType | type, | ||
TMTagAttrType * | attrs, | ||
TMParserType | lang | ||
) |
Definition at line 669 of file tm_workspace.c.
References fill_find_tags_array(), TMWorkspace::global_tags, name, scope, TMWorkspace::tags_array, theWorkspace, and tm_tags_sort().
Referenced by find_calltip(), goto_tag(), and tm_workspace_find_scope_members().
GPtrArray * tm_workspace_find_prefix | ( | const char * | prefix, |
TMParserType | lang, | ||
guint | max_num | ||
) |
Definition at line 718 of file tm_workspace.c.
References fill_find_tags_array_prefix(), TMWorkspace::global_tags, TMWorkspace::tags_array, theWorkspace, tm_tag_attr_name_t, and tm_tags_sort().
Referenced by autocomplete_tags().
GPtrArray * tm_workspace_find_scope_members | ( | TMSourceFile * | source_file, |
const char * | name, | ||
gboolean | function, | ||
gboolean | member, | ||
const gchar * | current_scope, | ||
gboolean | search_namespace | ||
) |
Definition at line 1002 of file tm_workspace.c.
References find_namespace_members_all(), find_scope_members_all(), TMWorkspace::global_tags, TMSourceFile::lang, name, NULL, TMSourceFile::tags_array, TMWorkspace::tags_array, theWorkspace, tm_tag_attr_name_t, tm_tag_enumerator_t, tm_tag_function_t, tm_tag_macro_with_arg_t, tm_tag_max_t, tm_tag_method_t, tm_tag_namespace_t, tm_tag_package_t, tm_tag_prototype_t, tm_tags_dedup(), and tm_workspace_find().
Referenced by autocomplete_scope().
void tm_workspace_free | ( | void | ) |
Definition at line 90 of file tm_workspace.c.
References TMWorkspace::global_tags, TMWorkspace::global_typename_array, NULL, TMWorkspace::source_files, TMWorkspace::tags_array, theWorkspace, tm_source_file_free(), tm_tags_array_free(), and TMWorkspace::typename_array.
Referenced by do_main_quit().
gboolean tm_workspace_load_global_tags | ( | const char * | tags_file, |
TMParserType | mode | ||
) |
Definition at line 348 of file tm_workspace.c.
References TMWorkspace::global_tags, global_tags_sort_attrs, TMWorkspace::global_typename_array, theWorkspace, TM_GLOBAL_TYPE_MASK, tm_source_file_read_tags_file(), tm_tags_extract(), tm_tags_merge(), and tm_tags_sort().
Referenced by symbols_load_global_tags().
|
static |
Definition at line 124 of file tm_workspace.c.
References tm_tags_merge(), and workspace_tags_sort_attrs.
Referenced by merge_extracted_tags(), and update_source_file().
void tm_workspace_remove_source_file | ( | TMSourceFile * | source_file | ) |
Removes a source file from the workspace if it exists.
This function also removes the tags belonging to this file from the workspace. To completely free the TMSourceFile pointer call tm_source_file_free() on it.
source_file | Pointer to the source file to be removed. |
Definition at line 223 of file tm_workspace.c.
References NULL, TMWorkspace::source_files, TMWorkspace::tags_array, theWorkspace, tm_tags_remove_file_tags(), and TMWorkspace::typename_array.
Referenced by document_load_config(), handle_save_as(), and remove_page().
void tm_workspace_remove_source_files | ( | GPtrArray * | source_files | ) |
Removes multiple source files from the workspace and updates the workspace tag arrays.
This is more efficient than calling tm_workspace_remove_source_file() separately for each of the files. To completely free the TMSourceFile pointers call tm_source_file_free() on each of them.
source_files | (element-type: TMSourceFile) The source files to be removed from the workspace. |
Definition at line 317 of file tm_workspace.c.
References NULL, TMWorkspace::source_files, theWorkspace, and tm_workspace_update().
|
static |
Definition at line 247 of file tm_workspace.c.
References TMSourceFile::file_name, TMWorkspace::source_files, TMSourceFile::tags_array, TMWorkspace::tags_array, theWorkspace, TM_GLOBAL_TYPE_MASK, tm_tags_extract(), tm_tags_sort(), TMWorkspace::typename_array, and workspace_tags_sort_attrs.
Referenced by tm_workspace_add_source_files(), and tm_workspace_remove_source_files().
void tm_workspace_update_source_file_buffer | ( | TMSourceFile * | source_file, |
guchar * | text_buf, | ||
gsize | buf_size | ||
) |
Definition at line 210 of file tm_workspace.c.
References update_source_file().
Referenced by document_update_tags().
|
static |
Definition at line 143 of file tm_workspace.c.
References TMSourceFile::file_name, file_tags_sort_attrs, merge_extracted_tags(), TMSourceFile::tags_array, TMWorkspace::tags_array, theWorkspace, TM_GLOBAL_TYPE_MASK, tm_source_file_parse(), tm_tags_remove_file_tags(), tm_tags_sort(), tm_workspace_merge_tags(), and TMWorkspace::typename_array.
Referenced by tm_workspace_add_source_file(), tm_workspace_add_source_files(), tm_workspace_create_global_tags(), and tm_workspace_update_source_file_buffer().
|
static |
Definition at line 372 of file tm_workspace.c.
Referenced by tm_workspace_create_global_tags().
|
static |
Definition at line 46 of file tm_workspace.c.
Referenced by update_source_file().
|
static |
Definition at line 53 of file tm_workspace.c.
Referenced by tm_workspace_create_global_tags(), and tm_workspace_load_global_tags().
|
static |
Definition at line 67 of file tm_workspace.c.
Referenced by tm_create_workspace(), tm_get_workspace(), tm_workspace_add_source_file(), tm_workspace_add_source_file_noupdate(), tm_workspace_find(), tm_workspace_find_prefix(), tm_workspace_find_scope_members(), tm_workspace_free(), tm_workspace_load_global_tags(), tm_workspace_remove_source_file(), tm_workspace_remove_source_files(), tm_workspace_update(), and update_source_file().
|
static |
Definition at line 63 of file tm_workspace.c.
Referenced by tm_workspace_load_global_tags(), tm_workspace_update(), and update_source_file().
|
static |
Definition at line 59 of file tm_workspace.c.
Referenced by find_scope_members(), find_scope_members_all(), find_scope_members_tags(), and member_at_method_scope().
|
static |
Definition at line 39 of file tm_workspace.c.
Referenced by tm_workspace_merge_tags(), and tm_workspace_update().