Add tm_source_file_set_tag_arglist() to manually set the argument list of a tag.

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@4833 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Enrico Tröger 2010-04-18 21:42:38 +00:00
parent 853356b305
commit 1932d3fae9
7 changed files with 54 additions and 0 deletions

View File

@ -1,3 +1,12 @@
2010-04-18 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* tagmanager/entry.c, tagmanager/entry.h,
tagmanager/include/tm_source_file.h, tagmanager/parse.c,
tagmanager/parse.h, tagmanager/tm_source_file.c:
Add tm_source_file_set_tag_arglist() to manually set the argument
list of a tag.
2010-04-17 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de>
* tagmanager/txt2tags.c:

View File

@ -395,6 +395,12 @@ extern void makeTagEntry (const tagEntryInfo *const tag)
}
}
extern void setTagArglistByName (const char *tag_name, const char *arglist)
{
if (NULL != TagEntrySetArglistFunction)
TagEntrySetArglistFunction(tag_name, arglist);
}
extern void initTagEntry (tagEntryInfo *const e, const char *const name)
{
Assert (File.source.name != NULL);

View File

@ -95,6 +95,7 @@ extern void closeTagFile (const boolean resize);
extern void beginEtagsFile (void);
extern void endEtagsFile (const char *const name);
extern void makeTagEntry (const tagEntryInfo *const tag);
extern void setTagArglistByName (const char *tag_name, const char *arglist);
extern void initTagEntry (tagEntryInfo *const e, const char *const name);
#endif /* _ENTRY_H */

View File

@ -150,6 +150,9 @@ const gchar *tm_source_file_get_lang_name(gint lang);
*/
gint tm_source_file_get_named_lang(const gchar *name);
/* Set the argument list of tag identified by its name */
void tm_source_file_set_tag_arglist(const char *tag_name, const char *arglist);
#ifdef __cplusplus
}
#endif

View File

@ -32,6 +32,7 @@ static parserDefinitionFunc* BuiltInParsers[] = { PARSER_LIST };
parserDefinition** LanguageTable = NULL;
static unsigned int LanguageCount = 0;
tagEntryFunction TagEntryFunction = NULL;
tagEntrySetArglistFunction TagEntrySetArglistFunction = NULL;
/*
* FUNCTION DEFINITIONS

View File

@ -37,6 +37,7 @@ typedef void (*simpleParser) (void);
typedef boolean (*rescanParser) (const unsigned int passCount);
typedef void (*parserInitialize) (langType language);
typedef int (*tagEntryFunction) (const tagEntryInfo *const tag);
typedef void (*tagEntrySetArglistFunction) (const char *tag_name, const char *arglist);
typedef struct sKindOption {
boolean enabled; /* are tags for kind enabled? */
@ -128,6 +129,7 @@ extern void checkRegex (void);
/* Extra stuff for Tag Manager */
extern tagEntryFunction TagEntryFunction;
extern tagEntrySetArglistFunction TagEntrySetArglistFunction;
extern void setTagEntryFunction(tagEntryFunction entry_function);
#endif /* _PARSE_H */

View File

@ -55,6 +55,8 @@ gboolean tm_source_file_init(TMSourceFile *source_file, const char *file_name
installLanguageMapDefaults();
if (NULL == TagEntryFunction)
TagEntryFunction = tm_source_file_tags;
if (NULL == TagEntrySetArglistFunction)
TagEntrySetArglistFunction = tm_source_file_set_tag_arglist;
}
if (name == NULL)
@ -120,6 +122,8 @@ gboolean tm_source_file_parse(TMSourceFile *source_file)
installLanguageMapDefaults();
if (NULL == TagEntryFunction)
TagEntryFunction = tm_source_file_tags;
if (NULL == TagEntrySetArglistFunction)
TagEntrySetArglistFunction = tm_source_file_set_tag_arglist;
}
current_source_file = source_file;
@ -178,6 +182,8 @@ gboolean tm_source_file_buffer_parse(TMSourceFile *source_file, guchar* text_buf
installLanguageMapDefaults();
if (NULL == TagEntryFunction)
TagEntryFunction = tm_source_file_tags;
if (NULL == TagEntrySetArglistFunction)
TagEntrySetArglistFunction = tm_source_file_set_tag_arglist;
}
current_source_file = source_file;
if (LANG_AUTO == source_file->lang)
@ -225,6 +231,28 @@ gboolean tm_source_file_buffer_parse(TMSourceFile *source_file, guchar* text_buf
return status;
}
void tm_source_file_set_tag_arglist(const char *tag_name, const char *arglist)
{
int count;
TMTag **tags, *tag;
if (NULL == arglist ||
NULL == tag_name ||
NULL == current_source_file ||
NULL == current_source_file->work_object.tags_array)
{
return;
}
tags = tm_tags_find(current_source_file->work_object.tags_array, tag_name, FALSE, &count);
if (tags != NULL && count == 1)
{
tag = tags[0];
g_free(tag->atts.entry.arglist);
tag->atts.entry.arglist = g_strdup(arglist);
}
}
int tm_source_file_tags(const tagEntryInfo *tag)
{
if (NULL == current_source_file)
@ -319,6 +347,8 @@ const gchar *tm_source_file_get_lang_name(gint lang)
installLanguageMapDefaults();
if (NULL == TagEntryFunction)
TagEntryFunction = tm_source_file_tags;
if (NULL == TagEntrySetArglistFunction)
TagEntrySetArglistFunction = tm_source_file_set_tag_arglist;
}
return getLanguageName(lang);
}
@ -331,6 +361,8 @@ gint tm_source_file_get_named_lang(const gchar *name)
installLanguageMapDefaults();
if (NULL == TagEntryFunction)
TagEntryFunction = tm_source_file_tags;
if (NULL == TagEntrySetArglistFunction)
TagEntrySetArglistFunction = tm_source_file_set_tag_arglist;
}
return getNamedLanguage(name);
}