diff --git a/src/libmain.c b/src/libmain.c index 42a18c9b..ce6bb8cf 100644 --- a/src/libmain.c +++ b/src/libmain.c @@ -251,7 +251,6 @@ static void main_init(void) file_prefs.tab_order_beside = FALSE; main_status.quitting = FALSE; ignore_callback = FALSE; - app->tm_workspace = tm_get_workspace(); ui_prefs.recent_queue = g_queue_new(); ui_prefs.recent_projects_queue = g_queue_new(); main_status.opening_session_files = FALSE; @@ -1047,6 +1046,8 @@ gint main_lib(gint argc, gchar **argv) #ifdef ENABLE_NLS main_locale_init(utils_resource_dir(RESOURCE_DIR_LOCALE), GETTEXT_PACKAGE); #endif + /* initialize TM before parsing command-line - needed for tag file generation */ + app->tm_workspace = tm_get_workspace(); parse_command_line_options(&argc, &argv); #if ! GLIB_CHECK_VERSION(2, 32, 0) diff --git a/tagmanager/src/tm_source_file.c b/tagmanager/src/tm_source_file.c index 68eada79..3fa80f54 100644 --- a/tagmanager/src/tm_source_file.c +++ b/tagmanager/src/tm_source_file.c @@ -159,6 +159,13 @@ static int tm_source_file_tags(const tagEntryInfo *tag) return TRUE; } +void tm_source_file_ctags_init() +{ + initializeParsing(); + installLanguageMapDefaults(); + TagEntryFunction = tm_source_file_tags; +} + /* Initializes a TMSourceFile structure from a file name. */ static gboolean tm_source_file_init(TMSourceFile *source_file, const char *file_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(); - if (NULL == LanguageTable) - { - initializeParsing(); - installLanguageMapDefaults(); - if (NULL == TagEntryFunction) - TagEntryFunction = tm_source_file_tags; - } - if (name == NULL) source_file->lang = TM_PARSER_NONE; else @@ -341,13 +340,6 @@ gboolean tm_source_file_parse(TMSourceFile *source_file, guchar* text_buf, gsize return TRUE; } - if (NULL == LanguageTable) - { - initializeParsing(); - installLanguageMapDefaults(); - if (NULL == TagEntryFunction) - TagEntryFunction = tm_source_file_tags; - } current_source_file = source_file; 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) { - if (NULL == LanguageTable) - { - initializeParsing(); - installLanguageMapDefaults(); - if (NULL == TagEntryFunction) - TagEntryFunction = tm_source_file_tags; - } 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) { - if (NULL == LanguageTable) - { - initializeParsing(); - installLanguageMapDefaults(); - if (NULL == TagEntryFunction) - TagEntryFunction = tm_source_file_tags; - } return getNamedLanguage(name); } diff --git a/tagmanager/src/tm_source_file.h b/tagmanager/src/tm_source_file.h index ae901587..4af18c78 100644 --- a/tagmanager/src/tm_source_file.h +++ b/tagmanager/src/tm_source_file.h @@ -45,6 +45,8 @@ typedef struct TMSourceFile 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); void tm_source_file_free(TMSourceFile *source_file); diff --git a/tagmanager/src/tm_workspace.c b/tagmanager/src/tm_workspace.c index 5e295c9e..7e3548eb 100644 --- a/tagmanager/src/tm_workspace.c +++ b/tagmanager/src/tm_workspace.c @@ -72,6 +72,9 @@ static gboolean tm_create_workspace(void) theWorkspace->source_files = g_ptr_array_new(); theWorkspace->typename_array = g_ptr_array_new(); theWorkspace->global_typename_array = g_ptr_array_new(); + + tm_source_file_ctags_init(); + return TRUE; }