Initialize ctags at a single place instead of four
This commit is contained in:
parent
f61a64be29
commit
7be40f5832
@ -251,7 +251,6 @@ static void main_init(void)
|
|||||||
file_prefs.tab_order_beside = FALSE;
|
file_prefs.tab_order_beside = FALSE;
|
||||||
main_status.quitting = FALSE;
|
main_status.quitting = FALSE;
|
||||||
ignore_callback = FALSE;
|
ignore_callback = FALSE;
|
||||||
app->tm_workspace = tm_get_workspace();
|
|
||||||
ui_prefs.recent_queue = g_queue_new();
|
ui_prefs.recent_queue = g_queue_new();
|
||||||
ui_prefs.recent_projects_queue = g_queue_new();
|
ui_prefs.recent_projects_queue = g_queue_new();
|
||||||
main_status.opening_session_files = FALSE;
|
main_status.opening_session_files = FALSE;
|
||||||
@ -1047,6 +1046,8 @@ gint main_lib(gint argc, gchar **argv)
|
|||||||
#ifdef ENABLE_NLS
|
#ifdef ENABLE_NLS
|
||||||
main_locale_init(utils_resource_dir(RESOURCE_DIR_LOCALE), GETTEXT_PACKAGE);
|
main_locale_init(utils_resource_dir(RESOURCE_DIR_LOCALE), GETTEXT_PACKAGE);
|
||||||
#endif
|
#endif
|
||||||
|
/* initialize TM before parsing command-line - needed for tag file generation */
|
||||||
|
app->tm_workspace = tm_get_workspace();
|
||||||
parse_command_line_options(&argc, &argv);
|
parse_command_line_options(&argc, &argv);
|
||||||
|
|
||||||
#if ! GLIB_CHECK_VERSION(2, 32, 0)
|
#if ! GLIB_CHECK_VERSION(2, 32, 0)
|
||||||
|
@ -159,6 +159,13 @@ static int tm_source_file_tags(const tagEntryInfo *tag)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void tm_source_file_ctags_init()
|
||||||
|
{
|
||||||
|
initializeParsing();
|
||||||
|
installLanguageMapDefaults();
|
||||||
|
TagEntryFunction = tm_source_file_tags;
|
||||||
|
}
|
||||||
|
|
||||||
/* Initializes a TMSourceFile structure from a file name. */
|
/* Initializes a TMSourceFile structure from a file name. */
|
||||||
static gboolean tm_source_file_init(TMSourceFile *source_file, const char *file_name,
|
static gboolean tm_source_file_init(TMSourceFile *source_file, const char *file_name,
|
||||||
const char* name)
|
const char* name)
|
||||||
@ -193,14 +200,6 @@ static gboolean tm_source_file_init(TMSourceFile *source_file, const char *file_
|
|||||||
|
|
||||||
source_file->tags_array = g_ptr_array_new();
|
source_file->tags_array = g_ptr_array_new();
|
||||||
|
|
||||||
if (NULL == LanguageTable)
|
|
||||||
{
|
|
||||||
initializeParsing();
|
|
||||||
installLanguageMapDefaults();
|
|
||||||
if (NULL == TagEntryFunction)
|
|
||||||
TagEntryFunction = tm_source_file_tags;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
source_file->lang = TM_PARSER_NONE;
|
source_file->lang = TM_PARSER_NONE;
|
||||||
else
|
else
|
||||||
@ -341,13 +340,6 @@ gboolean tm_source_file_parse(TMSourceFile *source_file, guchar* text_buf, gsize
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == LanguageTable)
|
|
||||||
{
|
|
||||||
initializeParsing();
|
|
||||||
installLanguageMapDefaults();
|
|
||||||
if (NULL == TagEntryFunction)
|
|
||||||
TagEntryFunction = tm_source_file_tags;
|
|
||||||
}
|
|
||||||
current_source_file = source_file;
|
current_source_file = source_file;
|
||||||
if (! LanguageTable [source_file->lang]->enabled)
|
if (! LanguageTable [source_file->lang]->enabled)
|
||||||
{
|
{
|
||||||
@ -407,13 +399,6 @@ gboolean tm_source_file_parse(TMSourceFile *source_file, guchar* text_buf, gsize
|
|||||||
*/
|
*/
|
||||||
const gchar *tm_source_file_get_lang_name(TMParserType lang)
|
const gchar *tm_source_file_get_lang_name(TMParserType lang)
|
||||||
{
|
{
|
||||||
if (NULL == LanguageTable)
|
|
||||||
{
|
|
||||||
initializeParsing();
|
|
||||||
installLanguageMapDefaults();
|
|
||||||
if (NULL == TagEntryFunction)
|
|
||||||
TagEntryFunction = tm_source_file_tags;
|
|
||||||
}
|
|
||||||
return getLanguageName(lang);
|
return getLanguageName(lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,13 +408,6 @@ const gchar *tm_source_file_get_lang_name(TMParserType lang)
|
|||||||
*/
|
*/
|
||||||
TMParserType tm_source_file_get_named_lang(const gchar *name)
|
TMParserType tm_source_file_get_named_lang(const gchar *name)
|
||||||
{
|
{
|
||||||
if (NULL == LanguageTable)
|
|
||||||
{
|
|
||||||
initializeParsing();
|
|
||||||
installLanguageMapDefaults();
|
|
||||||
if (NULL == TagEntryFunction)
|
|
||||||
TagEntryFunction = tm_source_file_tags;
|
|
||||||
}
|
|
||||||
return getNamedLanguage(name);
|
return getNamedLanguage(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +45,8 @@ typedef struct TMSourceFile
|
|||||||
|
|
||||||
GType tm_source_file_get_type(void);
|
GType tm_source_file_get_type(void);
|
||||||
|
|
||||||
|
void tm_source_file_ctags_init();
|
||||||
|
|
||||||
TMSourceFile *tm_source_file_new(const char *file_name, const char *name);
|
TMSourceFile *tm_source_file_new(const char *file_name, const char *name);
|
||||||
|
|
||||||
void tm_source_file_free(TMSourceFile *source_file);
|
void tm_source_file_free(TMSourceFile *source_file);
|
||||||
|
@ -72,6 +72,9 @@ static gboolean tm_create_workspace(void)
|
|||||||
theWorkspace->source_files = g_ptr_array_new();
|
theWorkspace->source_files = g_ptr_array_new();
|
||||||
theWorkspace->typename_array = g_ptr_array_new();
|
theWorkspace->typename_array = g_ptr_array_new();
|
||||||
theWorkspace->global_typename_array = g_ptr_array_new();
|
theWorkspace->global_typename_array = g_ptr_array_new();
|
||||||
|
|
||||||
|
tm_source_file_ctags_init();
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user