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
  Fossies Dox: geany-1.38.tar.bz2  ("unofficial" and yet experimental doxygen-generated source code documentation)  

tm_workspace.c File Reference
#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"
Include dependency graph for tm_workspace.c:

Go to the source code of this file.

Functions

static gboolean tm_create_workspace (void)
 
void tm_workspace_free (void)
 
const TMWorkspacetm_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 TMWorkspacetheWorkspace = NULL
 

Function Documentation

◆ combine_include_files()

static gboolean combine_include_files ( const gchar *  outf,
GList *  file_list 
)
static

Definition at line 394 of file tm_workspace.c.

References NULL.

Referenced by tm_workspace_create_global_tags().

◆ create_temp_file()

static gchar * create_temp_file ( const gchar *  tpl)
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().

◆ fill_find_tags_array()

static void fill_find_tags_array ( GPtrArray *  dst,
const GPtrArray *  src,
const char *  name,
const char *  scope,
TMTagType  type,
TMParserType  lang 
)
static

◆ fill_find_tags_array_prefix()

static void fill_find_tags_array_prefix ( GPtrArray *  dst,
const GPtrArray *  src,
const char *  name,
TMParserType  lang,
guint  max_num 
)
static

◆ find_namespace_members_all()

static GPtrArray * find_namespace_members_all ( const GPtrArray *  tags,
const GPtrArray *  searched_array,
TMParserType  lang 
)
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().

◆ find_scope_members()

static GPtrArray * find_scope_members ( const GPtrArray *  tags_array,
const gchar *  name,
TMSourceFile file,
TMParserType  lang,
gboolean  namespace 
)
static

◆ find_scope_members_all()

static GPtrArray * find_scope_members_all ( const GPtrArray *  tags,
const GPtrArray *  searched_array,
TMParserType  lang,
gboolean  member,
const gchar *  current_scope 
)
static

◆ find_scope_members_tags()

static GPtrArray * find_scope_members_tags ( const GPtrArray *  all,
TMTag type_tag,
gboolean  namespace 
)
static

◆ lookup_includes()

static GList * lookup_includes ( const gchar **  includes,
gint  includes_count 
)
static

Definition at line 441 of file tm_workspace.c.

References NULL.

Referenced by tm_workspace_create_global_tags().

◆ member_at_method_scope()

static gboolean member_at_method_scope ( const GPtrArray *  tags,
const gchar *  method_scope,
TMTag member_tag,
TMParserType  lang 
)
static

◆ merge_extracted_tags()

static void merge_extracted_tags ( GPtrArray **  dest,
GPtrArray *  src,
TMTagType  tag_types 
)
static

Definition at line 133 of file tm_workspace.c.

References tm_tags_extract(), and tm_workspace_merge_tags().

Referenced by update_source_file().

◆ pre_process_file()

static gchar * pre_process_file ( const gchar *  cmd,
const gchar *  inf 
)
static

Definition at line 521 of file tm_workspace.c.

References command, create_temp_file(), and NULL.

Referenced by tm_workspace_create_global_tags().

◆ strip_type()

static gchar * strip_type ( const gchar *  scoped_name,
TMParserType  lang 
)
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().

◆ tm_create_workspace()

◆ 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().

◆ tm_workspace_add_source_file()

void tm_workspace_add_source_file ( TMSourceFile source_file)

Adds a source file to the workspace, parses it and updates the workspace tags.

Parameters
source_fileThe 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().

◆ tm_workspace_add_source_file_noupdate()

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().

◆ 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.

Parameters
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().

◆ tm_workspace_create_global_tags()

gboolean tm_workspace_create_global_tags ( const char *  pre_process,
const char **  includes,
int  includes_count,
const char *  tags_file,
TMParserType  lang 
)

◆ tm_workspace_find()

GPtrArray * tm_workspace_find ( const char *  name,
const char *  scope,
TMTagType  type,
TMTagAttrType attrs,
TMParserType  lang 
)

◆ tm_workspace_find_prefix()

GPtrArray * tm_workspace_find_prefix ( const char *  prefix,
TMParserType  lang,
guint  max_num 
)

◆ tm_workspace_find_scope_members()

GPtrArray * tm_workspace_find_scope_members ( TMSourceFile source_file,
const char *  name,
gboolean  function,
gboolean  member,
const gchar *  current_scope,
gboolean  search_namespace 
)

◆ tm_workspace_free()

◆ tm_workspace_load_global_tags()

◆ tm_workspace_merge_tags()

static void tm_workspace_merge_tags ( GPtrArray **  big_array,
GPtrArray *  small_array 
)
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().

◆ tm_workspace_remove_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.

Parameters
source_filePointer 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().

◆ tm_workspace_remove_source_files()

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.

Parameters
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().

◆ tm_workspace_update()

◆ tm_workspace_update_source_file_buffer()

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().

◆ update_source_file()

◆ write_includes_file()

static gboolean write_includes_file ( const gchar *  outf,
GList *  includes_files 
)
static

Definition at line 372 of file tm_workspace.c.

Referenced by tm_workspace_create_global_tags().

Variable Documentation

◆ file_tags_sort_attrs

TMTagAttrType file_tags_sort_attrs[]
static
Initial value:
=
{
}
@ tm_tag_attr_name_t
Tag Name.
Definition: tm_tag.h:53
@ tm_tag_attr_scope_t
Scope of the tag.
Definition: tm_tag.h:58
@ tm_tag_attr_arglist_t
Argument list.
Definition: tm_tag.h:60
@ tm_tag_attr_line_t
Line number of tag.
Definition: tm_tag.h:56
@ tm_tag_attr_type_t
Tag Type.
Definition: tm_tag.h:54

Definition at line 46 of file tm_workspace.c.

Referenced by update_source_file().

◆ global_tags_sort_attrs

TMTagAttrType global_tags_sort_attrs[]
static

◆ theWorkspace

◆ TM_GLOBAL_TYPE_MASK

TMTagType TM_GLOBAL_TYPE_MASK
static
Initial value:
=
@ tm_tag_interface_t
Interface (Java only)
Definition: tm_parser.h:30
@ tm_tag_class_t
Class declaration.
Definition: tm_parser.h:25
@ tm_tag_union_t
Union.
Definition: tm_parser.h:38
@ tm_tag_struct_t
Struct declaration.
Definition: tm_parser.h:36
@ tm_tag_namespace_t
Namespace declaration.
Definition: tm_parser.h:33
@ tm_tag_typedef_t
Typedef.
Definition: tm_parser.h:37
@ tm_tag_enum_t
Enum declaration.
Definition: tm_parser.h:26

Definition at line 63 of file tm_workspace.c.

Referenced by tm_workspace_load_global_tags(), tm_workspace_update(), and update_source_file().

◆ TM_TYPE_WITH_MEMBERS

◆ workspace_tags_sort_attrs

TMTagAttrType workspace_tags_sort_attrs[]
static
Initial value:

Definition at line 39 of file tm_workspace.c.

Referenced by tm_workspace_merge_tags(), and tm_workspace_update().