[geany/geany] a2ecda: Update TM to use latest universal ctags

Jiří Techet git-noreply at xxxxx
Sun Feb 7 21:31:58 UTC 2021


Branch:      refs/heads/master
Author:      Jiří Techet <techet at gmail.com>
Committer:   Jiří Techet <techet at gmail.com>
Date:        Thu, 19 Nov 2020 10:30:21 UTC
Commit:      a2ecdab6d79b19806a5be3feae2058292620f0cc
             https://github.com/geany/geany/commit/a2ecdab6d79b19806a5be3feae2058292620f0cc

Log Message:
-----------
Update TM to use latest universal ctags

Introduce new tm_ctags.c/h files which roughly correspond to the previously
used ctags-api.c/h files and which serve as an interface between ctags
and Geany. Move init_tag() and update_python_arglist() from
tm_source_file.c to tm_ctags.c. Use the new functions from tm_ctags in
the rest of the tag manager. Define external parser list inside
tm_parsers.h which is injected to ctags using the EXTERNAL_PARSER_LIST
macro.


Modified Paths:
--------------
    src/tagmanager/Makefile.am
    src/tagmanager/tm_ctags.c
    src/tagmanager/tm_ctags.h
    src/tagmanager/tm_parser.c
    src/tagmanager/tm_parser.h
    src/tagmanager/tm_parsers.h
    src/tagmanager/tm_source_file.c
    src/tagmanager/tm_source_file.h
    src/tagmanager/tm_tag.c
    src/tagmanager/tm_workspace.c

Modified: src/tagmanager/Makefile.am
5 lines changed, 4 insertions(+), 1 deletions(-)
===================================================================
@@ -17,9 +17,12 @@ tagmanager_include_HEADERS = \
 	tm_parser.h
 
 
-libtagmanager_la_SOURCES =\
+libtagmanager_la_SOURCES = \
+	tm_ctags.h \
+	tm_ctags.c \
 	tm_parser.h \
 	tm_parser.c \
+	tm_parsers.h \
 	tm_source_file.h \
 	tm_source_file.c \
 	tm_tag.h \


Modified: src/tagmanager/tm_ctags.c
275 lines changed, 275 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,275 @@
+/*
+*   Copyright (c) 2016, Jiri Techet
+*
+*   This source code is released for free distribution under the terms of the
+*   GNU General Public License version 2 or (at your option) any later version.
+*
+*   Encapsulates ctags so it is isolated from the rest of Geany.
+*/
+
+#include "tm_ctags.h"
+#include "tm_tag.h"
+
+#include "general.h"  /* must always come before the rest of ctags headers */
+#include "entry_p.h"
+#include "error_p.h"
+#include "field_p.h"
+#include "options_p.h"
+#include "parse_p.h"
+#include "trashbox_p.h"
+#include "writer_p.h"
+#include "xtag_p.h"
+
+#include <string.h>
+
+
+static gint write_entry(tagWriter *writer, MIO * mio, const tagEntryInfo *const tag, void *user_data);
+static void rescan_failed(tagWriter *writer, gulong valid_tag_num, void *user_data);
+
+tagWriter geanyWriter = {
+	.writeEntry = write_entry,
+	.writePtagEntry = NULL, /* no pseudo-tags */
+	.preWriteEntry = NULL,
+	.postWriteEntry = NULL,
+	.rescanFailedEntry = rescan_failed,
+	.treatFieldAsFixed = NULL,
+	.defaultFileName = "geany_tags_file_which_should_never_appear_anywhere",
+	.private = NULL,
+	.type = WRITER_CUSTOM
+};
+
+
+static bool nonfatal_error_printer(const errorSelection selection,
+					  const gchar *const format,
+					  va_list ap, void *data CTAGS_ATTR_UNUSED)
+{
+	g_logv(G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, format, ap);
+
+	return false;
+}
+
+
+static void enable_all_lang_kinds()
+{
+	TMParserType lang;
+
+	for (lang = 0; lang < countParsers(); lang++)
+	{
+		guint kind_num = countLanguageKinds(lang);
+		guint kind;
+
+		for (kind = 0; kind < kind_num; kind++)
+		{
+			kindDefinition *def = getLanguageKind(lang, kind);
+			enableKind(def, true);
+		}
+	}
+}
+
+
+/*
+ Initializes a TMTag structure with information from a ctagsTag struct
+ used by the ctags parsers. Note that the TMTag structure must be malloc()ed
+ before calling this function.
+ @param tag The TMTag structure to initialize
+ @param file Pointer to a TMSourceFile struct (it is assigned to the file member)
+ @param tag_entry Tag information gathered by the ctags parser
+ @return TRUE on success, FALSE on failure
+*/
+static gboolean init_tag(TMTag *tag, TMSourceFile *file, const tagEntryInfo *tag_entry)
+{
+	TMTagType type;
+	guchar kind_letter;
+	TMParserType lang;
+
+	if (!tag_entry)
+		return FALSE;
+
+	lang = tag_entry->langType;
+	kind_letter = getLanguageKind(tag_entry->langType, tag_entry->kindIndex)->letter;
+	type = tm_parser_get_tag_type(kind_letter, lang);
+	if (file->lang != lang)  /* this is a tag from a subparser */
+	{
+		/* check for possible re-definition of subparser type */
+		type = tm_parser_get_subparser_type(file->lang, lang, type);
+	}
+
+	if (!tag_entry->name || type == tm_tag_undef_t)
+		return FALSE;
+
+	tag->name = g_strdup(tag_entry->name);
+	tag->type = type;
+	tag->local = tag_entry->isFileScope;
+	tag->pointerOrder = 0;	/* backward compatibility (use var_type instead) */
+	tag->line = tag_entry->lineNumber;
+	if (NULL != tag_entry->extensionFields.signature)
+		tag->arglist = g_strdup(tag_entry->extensionFields.signature);
+	if ((NULL != tag_entry->extensionFields.scopeName) &&
+		(0 != tag_entry->extensionFields.scopeName[0]))
+		tag->scope = g_strdup(tag_entry->extensionFields.scopeName);
+	if (tag_entry->extensionFields.inheritance != NULL)
+		tag->inheritance = g_strdup(tag_entry->extensionFields.inheritance);
+	if (tag_entry->extensionFields.typeRef[1] != NULL)
+		tag->var_type = g_strdup(tag_entry->extensionFields.typeRef[1]);
+	if (tag_entry->extensionFields.access != NULL)
+		tag->access = tm_source_file_get_tag_access(tag_entry->extensionFields.access);
+	if (tag_entry->extensionFields.implementation != NULL)
+		tag->impl = tm_source_file_get_tag_impl(tag_entry->extensionFields.implementation);
+	if ((tm_tag_macro_t == tag->type) && (NULL != tag->arglist))
+		tag->type = tm_tag_macro_with_arg_t;
+	tag->file = file;
+	/* redefine lang also for subparsers because the rest of Geany assumes that
+	 * tags from a single file are from a single language */
+	tag->lang = file->lang;
+	return TRUE;
+}
+
+
+/* add argument list of __init__() Python methods to the class tag */
+static void update_python_arglist(const TMTag *tag, TMSourceFile *source_file)
+{
+	guint i;
+	const gchar *parent_tag_name;
+
+	if (tag->type != tm_tag_method_t || tag->scope == NULL ||
+		g_strcmp0(tag->name, "__init__") != 0)
+		return;
+
+	parent_tag_name = strrchr(tag->scope, '.');
+	if (parent_tag_name)
+		parent_tag_name++;
+	else
+		parent_tag_name = tag->scope;
+
+	/* going in reverse order because the tag was added recently */
+	for (i = source_file->tags_array->len; i > 0; i--)
+	{
+		TMTag *prev_tag = (TMTag *) source_file->tags_array->pdata[i - 1];
+		if (g_strcmp0(prev_tag->name, parent_tag_name) == 0)
+		{
+			g_free(prev_tag->arglist);
+			prev_tag->arglist = g_strdup(tag->arglist);
+			break;
+		}
+	}
+}
+
+
+static gint write_entry(tagWriter *writer, MIO * mio, const tagEntryInfo *const tag, void *user_data)
+{
+	TMSourceFile *source_file = user_data;
+	TMTag *tm_tag = tm_tag_new();
+
+	getTagScopeInformation((tagEntryInfo *)tag, NULL, NULL);
+
+	if (!init_tag(tm_tag, source_file, tag))
+	{
+		tm_tag_unref(tm_tag);
+		return 0;
+	}
+
+	if (tm_tag->lang == TM_PARSER_PYTHON)
+		update_python_arglist(tm_tag, source_file);
+
+	g_ptr_array_add(source_file->tags_array, tm_tag);
+
+	/* output length - we don't write anything to the MIO */
+	return 0;
+}
+
+
+static void rescan_failed(tagWriter *writer, gulong valid_tag_num, void *user_data)
+{
+	TMSourceFile *source_file = user_data;
+	GPtrArray *tags_array = source_file->tags_array;
+
+	if (tags_array->len > valid_tag_num)
+	{
+		guint i;
+		for (i = valid_tag_num; i < tags_array->len; i++)
+			tm_tag_unref(tags_array->pdata[i]);
+		g_ptr_array_set_size(tags_array, valid_tag_num);
+	}
+}
+
+
+/* keep in sync with ctags main() - use only things interesting for us */
+void tm_ctags_init(void)
+{
+	initDefaultTrashBox();
+
+	setErrorPrinter(nonfatal_error_printer, NULL);
+	setTagWriter(WRITER_CUSTOM, &geanyWriter);
+
+	checkRegex();
+	initFieldObjects();
+	initXtagObjects();
+
+	initializeParsing();
+	initOptions();
+
+	/* make sure all parsers are initialized */
+	initializeParser(LANG_AUTO);
+
+	/* change default values which are false */
+	enableXtag(XTAG_TAGS_GENERATED_BY_GUEST_PARSERS, true);
+	enableXtag(XTAG_REFERENCE_TAGS, true);
+
+	/* some kinds we are interested in are disabled by default */
+	enable_all_lang_kinds();
+}
+
+
+void tm_ctags_parse(guchar *buffer, gsize buffer_size,
+	const gchar *file_name, TMParserType language, TMSourceFile *source_file)
+{
+	g_return_if_fail(buffer != NULL || file_name != NULL);
+
+	parseRawBuffer(file_name, buffer, buffer_size, language, source_file);
+}
+
+
+const gchar *tm_ctags_get_lang_name(TMParserType lang)
+{
+	return getLanguageName(lang);
+}
+
+
+TMParserType tm_ctags_get_named_lang(const gchar *name)
+{
+	return getNamedLanguage(name, 0);
+}
+
+
+const gchar *tm_ctags_get_lang_kinds(TMParserType lang)
+{
+	guint kind_num = countLanguageKinds(lang);
+	static gchar kinds[257];
+	guint i;
+
+	for (i = 0; i < kind_num; i++)
+		kinds[i] = getLanguageKind(lang, i)->letter;
+	kinds[i] = '\0';
+
+	return kinds;
+}
+
+
+const gchar *tm_ctags_get_kind_name(gchar kind, TMParserType lang)
+{
+	kindDefinition *def = getLanguageKindForLetter(lang, kind);
+	return def ? def->name : "unknown";
+}
+
+
+gchar tm_ctags_get_kind_from_name(const gchar *name, TMParserType lang)
+{
+	kindDefinition *def = getLanguageKindForName(lang, name);
+	return def ? def->letter : '-';
+}
+
+
+guint tm_ctags_get_lang_count(void)
+{
+	return countParsers();
+}


Modified: src/tagmanager/tm_ctags.h
34 lines changed, 34 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,34 @@
+/*
+*   Copyright (c) 2016, Jiri Techet
+*
+*   This source code is released for free distribution under the terms of the
+*   GNU General Public License version 2 or (at your option) any later version.
+*
+*   Encapsulates ctags so it is isolated from the rest of Geany.
+*/
+#ifndef TM_CTAGS_H
+#define TM_CTAGS_H
+
+#include <glib.h>
+
+#include "tm_source_file.h"
+
+G_BEGIN_DECLS
+
+#ifdef GEANY_PRIVATE
+
+void tm_ctags_init(void);
+void tm_ctags_parse(guchar *buffer, gsize buffer_size,
+	const gchar *file_name, TMParserType language, TMSourceFile *source_file);
+const gchar *tm_ctags_get_lang_name(TMParserType lang);
+TMParserType tm_ctags_get_named_lang(const gchar *name);
+const gchar *tm_ctags_get_lang_kinds(TMParserType lang);
+const gchar *tm_ctags_get_kind_name(gchar kind, TMParserType lang);
+gchar tm_ctags_get_kind_from_name(const gchar *name, TMParserType lang);
+guint tm_ctags_get_lang_count(void);
+
+#endif /* GEANY_PRIVATE */
+
+G_END_DECLS
+
+#endif /* TM_CTAGS_H */


Modified: src/tagmanager/tm_parser.c
21 lines changed, 8 insertions(+), 13 deletions(-)
===================================================================
@@ -19,7 +19,7 @@
  */
 
 #include "tm_parser.h"
-#include "ctags-api.h"
+#include "tm_ctags.h"
 
 #include <string.h>
 
@@ -691,28 +691,23 @@ void tm_parser_verify_type_mappings(void)
 {
 	TMParserType lang;
 
-	if (TM_PARSER_COUNT > ctagsGetLangCount())
+	if (TM_PARSER_COUNT > tm_ctags_get_lang_count())
 		g_error("More parsers defined in Geany than in ctags");
 
 	for (lang = 0; lang < TM_PARSER_COUNT; lang++)
 	{
-		const gchar *kinds = ctagsGetLangKinds(lang);
+		const gchar *kinds = tm_ctags_get_lang_kinds(lang);
 		TMParserMap *map = &parser_map[lang];
 		gchar presence_map[256];
 		guint i;
 
 		if (! map->entries || map->size < 1)
 			g_error("No tag types in TM for %s, is the language listed in parser_map?",
-					ctagsGetLangName(lang));
-
-		/* TODO: check also regex parser mappings. At the moment there's no way
-		 * to access regex parser definitions in ctags */
-		if (ctagsIsUsingRegexParser(lang))
-			continue;
+					tm_ctags_get_lang_name(lang));
 
 		if (map->size != strlen(kinds))
 			g_error("Different number of tag types in TM (%d) and ctags (%d) for %s",
-				map->size, (int)strlen(kinds), ctagsGetLangName(lang));
+				map->size, (int)strlen(kinds), tm_ctags_get_lang_name(lang));
 
 		memset(presence_map, 0, sizeof(presence_map));
 		for (i = 0; i < map->size; i++)
@@ -734,10 +729,10 @@ void tm_parser_verify_type_mappings(void)
 			}
 			if (!ctags_found)
 				g_error("Tag type '%c' found in TM but not in ctags for %s",
-					map->entries[i].kind, ctagsGetLangName(lang));
+					map->entries[i].kind, tm_ctags_get_lang_name(lang));
 			if (!tm_found)
 				g_error("Tag type '%c' found in ctags but not in TM for %s",
-					kinds[i], ctagsGetLangName(lang));
+					kinds[i], tm_ctags_get_lang_name(lang));
 
 			presence_map[(unsigned char) map->entries[i].kind]++;
 		}
@@ -746,7 +741,7 @@ void tm_parser_verify_type_mappings(void)
 		{
 			if (presence_map[i] > 1)
 				g_error("Duplicate tag type '%c' found for %s",
-					(gchar)i, ctagsGetLangName(lang));
+					(gchar)i, tm_ctags_get_lang_name(lang));
 		}
 	}
 }


Modified: src/tagmanager/tm_parser.h
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -54,7 +54,7 @@ typedef gint TMParserType;
 
 #ifdef GEANY_PRIVATE
 
-/* keep in sync with ctags/parsers.h */
+/* keep in sync with tm_parsers.h and parser_map in tm_parser.c */
 enum
 {
 	TM_PARSER_NONE = -2, /* keep in sync with ctags LANG_IGNORE */


Modified: src/tagmanager/tm_parsers.h
70 lines changed, 70 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,70 @@
+/*
+*   Copyright (c) 2019, Jiri Techet
+*
+*   This source code is released for free distribution under the terms of the
+*   GNU General Public License version 2 or (at your option) any later version.
+*
+*   Declares parsers used by ctags
+*/
+#ifndef TM_PARSERS_H
+#define TM_PARSERS_H
+
+/* This file is included by ctags by defining EXTERNAL_PARSER_LIST_FILE inside
+ * ctags/Makefile.am */
+
+/* Keep in sync with tm_parser.h */
+#define EXTERNAL_PARSER_LIST \
+	CParser, \
+	CppParser, \
+	JavaParser, \
+	MakefileParser, \
+	PascalParser, \
+	PerlParser, \
+	PhpParser, \
+	PythonParser, \
+	TexParser, \
+	AsmParser, \
+	ConfParser, \
+	SqlParser, \
+	DocBookParser, \
+	ErlangParser, \
+	CssParser, \
+	RubyParser, \
+	TclParser, \
+	ShParser, \
+	DParser, \
+	FortranParser, \
+	FeriteParser, \
+	DiffParser, \
+	VhdlParser, \
+	LuaParser, \
+	JavaScriptParser, \
+	HaskellParser, \
+	CsharpParser, \
+	BasicParser,\
+	HaxeParser,\
+	RstParser, \
+	HtmlParser, \
+	F77Parser, \
+	GLSLParser, \
+	MatLabParser, \
+	ValaParser, \
+	FlexParser, \
+	NsisParser, \
+	MarkdownParser, \
+	Txt2tagsParser, \
+	AbcParser, \
+	VerilogParser, \
+	RParser, \
+	CobolParser, \
+	ObjcParser, \
+	AsciidocParser, \
+	AbaqusParser, \
+	RustParser, \
+	GoParser, \
+	JsonParser, \
+	ZephirParser, \
+	PowerShellParser, \
+	BibtexParser
+
+#endif


Modified: src/tagmanager/tm_source_file.c
133 lines changed, 11 insertions(+), 122 deletions(-)
===================================================================
@@ -32,7 +32,7 @@
 #include "tm_source_file.h"
 #include "tm_tag.h"
 #include "tm_parser.h"
-#include "ctags-api.h"
+#include "tm_ctags.h"
 
 typedef struct
 {
@@ -136,7 +136,7 @@ gchar *tm_get_real_path(const gchar *file_name)
 	return NULL;
 }
 
-static char get_tag_impl(const char *impl)
+gchar tm_source_file_get_tag_impl(const gchar *impl)
 {
 	if ((0 == strcmp("virtual", impl))
 	 || (0 == strcmp("pure virtual", impl)))
@@ -148,7 +148,7 @@ static char get_tag_impl(const char *impl)
 	return TAG_IMPL_UNKNOWN;
 }
 
-static char get_tag_access(const char *access)
+gchar tm_source_file_get_tag_access(const gchar *access)
 {
 	if (0 == strcmp("public", access))
 		return TAG_ACCESS_PUBLIC;
@@ -167,59 +167,6 @@ static char get_tag_access(const char *access)
 	return TAG_ACCESS_UNKNOWN;
 }
 
-/*
- Initializes a TMTag structure with information from a ctagsTag struct
- used by the ctags parsers. Note that the TMTag structure must be malloc()ed
- before calling this function.
- @param tag The TMTag structure to initialize
- @param file Pointer to a TMSourceFile struct (it is assigned to the file member)
- @param tag_entry Tag information gathered by the ctags parser
- @return TRUE on success, FALSE on failure
-*/
-static gboolean init_tag(TMTag *tag, TMSourceFile *file, const ctagsTag *tag_entry)
-{
-	TMTagType type;
-
-	if (!tag_entry)
-		return FALSE;
-
-	type = tm_parser_get_tag_type(tag_entry->kindLetter, tag_entry->lang);
-	if (file->lang != tag_entry->lang)  /* this is a tag from a subparser */
-	{
-		/* check for possible re-definition of subparser type */
-		type = tm_parser_get_subparser_type(file->lang, tag_entry->lang, type);
-	}
-
-	if (!tag_entry->name || type == tm_tag_undef_t)
-		return FALSE;
-
-	tag->name = g_strdup(tag_entry->name);
-	tag->type = type;
-	tag->local = tag_entry->isFileScope;
-	tag->pointerOrder = 0;	/* backward compatibility (use var_type instead) */
-	tag->line = tag_entry->lineNumber;
-	if (NULL != tag_entry->signature)
-		tag->arglist = g_strdup(tag_entry->signature);
-	if ((NULL != tag_entry->scopeName) &&
-		(0 != tag_entry->scopeName[0]))
-		tag->scope = g_strdup(tag_entry->scopeName);
-	if (tag_entry->inheritance != NULL)
-		tag->inheritance = g_strdup(tag_entry->inheritance);
-	if (tag_entry->varType != NULL)
-		tag->var_type = g_strdup(tag_entry->varType);
-	if (tag_entry->access != NULL)
-		tag->access = get_tag_access(tag_entry->access);
-	if (tag_entry->implementation != NULL)
-		tag->impl = get_tag_impl(tag_entry->implementation);
-	if ((tm_tag_macro_t == tag->type) && (NULL != tag->arglist))
-		tag->type = tm_tag_macro_with_arg_t;
-	tag->file = file;
-	/* redefine lang also for subparsers because the rest of Geany assumes that
-	 * tags from a single file are from a single language */
-	tag->lang = file->lang;
-	return TRUE;
-}
-
 /*
  Initializes an already malloc()ed TMTag structure by reading a tag entry
  line from a file. The structure should be allocated beforehand.
@@ -429,7 +376,7 @@ static gboolean init_tag_from_file_ctags(TMTag *tag, TMSourceFile *file, FILE *f
 				const gchar *kind = value ? value : key;
 
 				if (kind[0] && kind[1])
-					tag->type = tm_parser_get_tag_type(ctagsGetKindFromName(kind, lang), lang);
+					tag->type = tm_parser_get_tag_type(tm_ctags_get_kind_from_name(kind, lang), lang);
 				else
 					tag->type = tm_parser_get_tag_type(*kind, lang);
 			}
@@ -439,11 +386,11 @@ static gboolean init_tag_from_file_ctags(TMTag *tag, TMSourceFile *file, FILE *f
 				tag->inheritance = g_strdup(value);
 			}
 			else if (0 == strcmp(key, "implementation")) /* implementation limit */
-				tag->impl = get_tag_impl(value);
+				tag->impl = tm_source_file_get_tag_impl(value);
 			else if (0 == strcmp(key, "line")) /* line */
 				tag->line = atol(value);
 			else if (0 == strcmp(key, "access")) /* access */
-				tag->access = get_tag_access(value);
+				tag->access = tm_source_file_get_tag_access(value);
 			else if (0 == strcmp(key, "class") ||
 					 0 == strcmp(key, "enum") ||
 					 0 == strcmp(key, "function") ||
@@ -614,64 +561,6 @@ gboolean tm_source_file_write_tags_file(const gchar *tags_file, GPtrArray *tags_
 	return ret;
 }
 
-/* add argument list of __init__() Python methods to the class tag */
-static void update_python_arglist(const TMTag *tag, TMSourceFile *current_source_file)
-{
-	guint i;
-	const char *parent_tag_name;
-
-	if (tag->type != tm_tag_method_t || tag->scope == NULL ||
-		g_strcmp0(tag->name, "__init__") != 0)
-		return;
-
-	parent_tag_name = strrchr(tag->scope, '.');
-	if (parent_tag_name)
-		parent_tag_name++;
-	else
-		parent_tag_name = tag->scope;
-
-	/* going in reverse order because the tag was added recently */
-	for (i = current_source_file->tags_array->len; i > 0; i--)
-	{
-		TMTag *prev_tag = (TMTag *) current_source_file->tags_array->pdata[i - 1];
-		if (g_strcmp0(prev_tag->name, parent_tag_name) == 0)
-		{
-			g_free(prev_tag->arglist);
-			prev_tag->arglist = g_strdup(tag->arglist);
-			break;
-		}
-	}
-}
-
-/* new parsing pass ctags callback function */
-static bool ctags_pass_start(void *user_data)
-{
-	TMSourceFile *current_source_file = user_data;
-
-	tm_tags_array_free(current_source_file->tags_array, FALSE);
-	return TRUE;
-}
-
-/* new tag ctags callback function */
-static bool ctags_new_tag(const ctagsTag *const tag,
-	void *user_data)
-{
-	TMSourceFile *current_source_file = user_data;
-	TMTag *tm_tag = tm_tag_new();
-
-	if (!init_tag(tm_tag, current_source_file, tag))
-	{
-		tm_tag_unref(tm_tag);
-		return TRUE;
-	}
-
-	if (tm_tag->lang == TM_PARSER_PYTHON)
-		update_python_arglist(tm_tag, current_source_file);
-
-	g_ptr_array_add(current_source_file->tags_array, tm_tag);
-
-	return TRUE;
-}
 
 /* Initializes a TMSourceFile structure from a file name. */
 static gboolean tm_source_file_init(TMSourceFile *source_file, const char *file_name,
@@ -710,7 +599,7 @@ static gboolean tm_source_file_init(TMSourceFile *source_file, const char *file_
 	if (name == NULL)
 		source_file->lang = TM_PARSER_NONE;
 	else
-		source_file->lang = ctagsGetNamedLang(name);
+		source_file->lang = tm_ctags_get_named_lang(name);
 
 	return TRUE;
 }
@@ -827,8 +716,8 @@ gboolean tm_source_file_parse(TMSourceFile *source_file, guchar* text_buf, gsize
 
 	tm_tags_array_free(source_file->tags_array, FALSE);
 
-	ctagsParse(use_buffer ? text_buf : NULL, buf_size, file_name,
-		source_file->lang, ctags_new_tag, ctags_pass_start, source_file);
+	tm_ctags_parse(use_buffer ? text_buf : NULL, buf_size, file_name,
+		source_file->lang, source_file);
 
 	return !retry;
 }
@@ -839,7 +728,7 @@ gboolean tm_source_file_parse(TMSourceFile *source_file, guchar* text_buf, gsize
 */
 const gchar *tm_source_file_get_lang_name(TMParserType lang)
 {
-	return ctagsGetLangName(lang);
+	return tm_ctags_get_lang_name(lang);
 }
 
 /* Gets the language index for \a name.
@@ -848,5 +737,5 @@ const gchar *tm_source_file_get_lang_name(TMParserType lang)
 */
 TMParserType tm_source_file_get_named_lang(const gchar *name)
 {
-	return ctagsGetNamedLang(name);
+	return tm_ctags_get_named_lang(name);
 }


Modified: src/tagmanager/tm_source_file.h
4 lines changed, 4 insertions(+), 0 deletions(-)
===================================================================
@@ -62,6 +62,10 @@ GPtrArray *tm_source_file_read_tags_file(const gchar *tags_file, TMParserType mo
 
 gboolean tm_source_file_write_tags_file(const gchar *tags_file, GPtrArray *tags_array);
 
+gchar tm_source_file_get_tag_impl(const gchar *impl);
+
+gchar tm_source_file_get_tag_access(const gchar *access);
+
 #endif /* GEANY_PRIVATE */
 
 G_END_DECLS


Modified: src/tagmanager/tm_tag.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -13,7 +13,7 @@
 #include <glib-object.h>
 
 #include "tm_tag.h"
-#include "ctags-api.h"
+#include "tm_ctags.h"
 
 
 #define TAG_NEW(T)	((T) = g_slice_new0(TMTag))


Modified: src/tagmanager/tm_workspace.c
10 lines changed, 4 insertions(+), 6 deletions(-)
===================================================================
@@ -17,8 +17,6 @@
  and a set of individual source files.
 */
 
-#include "general.h"
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <unistd.h>
@@ -32,7 +30,7 @@
 #include <glib/gstdio.h>
 
 #include "tm_workspace.h"
-#include "ctags-api.h"
+#include "tm_ctags.h"
 #include "tm_tag.h"
 #include "tm_parser.h"
 
@@ -79,7 +77,7 @@ static gboolean tm_create_workspace(void)
 	theWorkspace->typename_array = g_ptr_array_new();
 	theWorkspace->global_typename_array = g_ptr_array_new();
 
-	ctagsInit();
+	tm_ctags_init();
 	tm_parser_verify_type_mappings();
 
 	return TRUE;
@@ -664,7 +662,7 @@ static void fill_find_tags_array(GPtrArray *dst, const GPtrArray *src,
  @param scope The scope name of the tag to find, or NULL.
  @param type The tag types to return (TMTagType). Can be a bitmask.
  @param attrs The attributes to sort and dedup on (0 terminated integer array).
- @param lang Specifies the language(see the table in parsers.h) of the tags to be found,
+ @param lang Specifies the language(see the table in tm_parsers.h) of the tags to be found,
              -1 for all
  @return Array of matching tags.
 */
@@ -712,7 +710,7 @@ static void fill_find_tags_array_prefix(GPtrArray *dst, const GPtrArray *src,
 /* Returns tags with the specified prefix sorted by name. If there are several
  tags with the same name, only one of them appears in the resulting array.
  @param prefix The prefix of the tag to find.
- @param lang Specifies the language(see the table in parsers.h) of the tags to be found,
+ @param lang Specifies the language(see the table in tm_parsers.h) of the tags to be found,
              -1 for all.
  @param max_num The maximum number of tags to return.
  @return Array of matching tags sorted by their name.



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list