Symbol fixes to .h and .hpp filetype prototypes

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/branches/build-system@3204 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Lex Trotman 2008-11-11 09:27:49 +00:00
parent 1469e56fea
commit b7b4834e1f
3 changed files with 33 additions and 9 deletions

View File

@ -1,3 +1,17 @@
2008-11-11 Lex Trotman <elextr(at)gmail(dot)com>
fix tagmanager interaction with H and HPP filetypes
* src/filetypes.c
fix h and hpp filetype names to pretend to be c and c++ for tags
purposes
filetypes_detect_from_file_internal() modified to detect C++ anywhere
between -*- and another -*-
* src/symbols.c
add GEANY_FILETYPES_H and GEANY_FILETYPES_HPP as alternates where ever
GEANY_FILETYPES_C and GEANY_FILETYPES_CPP occur
2008-11-10 Lex Trotman <elextr(at)gmail(dot)com> 2008-11-10 Lex Trotman <elextr(at)gmail(dot)com>
Prototype C and CPP header filetypes, also detects .h or no extension Prototype C and CPP header filetypes, also detects .h or no extension

View File

@ -92,7 +92,7 @@ static void init_builtin_filetypes(void)
#define CH #define CH
ft = filetypes[GEANY_FILETYPES_H]; ft = filetypes[GEANY_FILETYPES_H];
ft->lang = 0; ft->lang = 0;
ft->name = g_strdup("H"); ft->name = g_strdup("C");
ft->title = g_strdup_printf(_("%s header file"), "C"); ft->title = g_strdup_printf(_("%s header file"), "C");
ft->extension = g_strdup("h"); ft->extension = g_strdup("h");
ft->pattern = utils_strv_new("*.h", NULL); ft->pattern = utils_strv_new("*.h", NULL);
@ -115,7 +115,7 @@ static void init_builtin_filetypes(void)
#define HPP #define HPP
ft = filetypes[GEANY_FILETYPES_HPP]; ft = filetypes[GEANY_FILETYPES_HPP];
ft->lang = 1; ft->lang = 1;
ft->name = g_strdup("H++"); ft->name = g_strdup("C++");
ft->title = g_strdup_printf(_("%s header file"), "C++"); ft->title = g_strdup_printf(_("%s header file"), "C++");
ft->extension = g_strdup("hpp"); ft->extension = g_strdup("hpp");
ft->pattern = utils_strv_new("*.h", "*.hpp", "*.hxx", "*.h++", "*.hh", NULL); ft->pattern = utils_strv_new("*.h", "*.hpp", "*.hxx", "*.h++", "*.hh", NULL);
@ -804,7 +804,10 @@ static GeanyFiletype *filetypes_detect_from_file_internal(const gchar *utf8_file
id = FILETYPE_ID(ft); id = FILETYPE_ID(ft);
if (id == GEANY_FILETYPES_H || id == GEANY_FILETYPES_NONE) if (id == GEANY_FILETYPES_H || id == GEANY_FILETYPES_NONE)
{ {
if (strstr(line, "-*-C++-*-")) char *c;
if (c=strstr(line, "-*-")) /* look for C++ between -*- es */
if (c=strstr(c,"C++"))
if (strstr(c,"-*-"))
ft = filetypes[GEANY_FILETYPES_HPP]; ft = filetypes[GEANY_FILETYPES_HPP];
} }
return ft; return ft;

View File

@ -118,7 +118,8 @@ void symbols_global_tags_loaded(gint file_type_idx)
gint tag_type; gint tag_type;
/* load ignore list for C/C++ parser */ /* load ignore list for C/C++ parser */
if ((file_type_idx == GEANY_FILETYPES_C || file_type_idx == GEANY_FILETYPES_CPP) && if ((file_type_idx == GEANY_FILETYPES_C || file_type_idx == GEANY_FILETYPES_CPP
|| file_type_idx == GEANY_FILETYPES_H || file_type_idx == GEANY_FILETYPES_HPP ) &&
c_tags_ignore == NULL) c_tags_ignore == NULL)
{ {
load_c_ignore_tags(); load_c_ignore_tags();
@ -138,9 +139,11 @@ void symbols_global_tags_loaded(gint file_type_idx)
switch (file_type_idx) switch (file_type_idx)
{ {
case GEANY_FILETYPES_CPP: case GEANY_FILETYPES_CPP:
case GEANY_FILETYPES_HPP:
symbols_global_tags_loaded(GEANY_FILETYPES_C); /* load C global tags */ symbols_global_tags_loaded(GEANY_FILETYPES_C); /* load C global tags */
/* no C++ tagfile yet */ /* no C++ tagfile yet */
return; return;
case GEANY_FILETYPES_H:
case GEANY_FILETYPES_C: tag_type = GTF_C; break; case GEANY_FILETYPES_C: tag_type = GTF_C; break;
case GEANY_FILETYPES_PASCAL:tag_type = GTF_PASCAL; break; case GEANY_FILETYPES_PASCAL:tag_type = GTF_PASCAL; break;
case GEANY_FILETYPES_PHP: tag_type = GTF_PHP; break; case GEANY_FILETYPES_PHP: tag_type = GTF_PHP; break;
@ -232,6 +235,8 @@ const gchar *symbols_get_context_separator(gint ft_id)
switch (ft_id) switch (ft_id)
{ {
case GEANY_FILETYPES_C: /* for C++ .h headers or C structs */ case GEANY_FILETYPES_C: /* for C++ .h headers or C structs */
case GEANY_FILETYPES_H:
case GEANY_FILETYPES_HPP:
case GEANY_FILETYPES_CPP: case GEANY_FILETYPES_CPP:
case GEANY_FILETYPES_GLSL: /* for structs */ case GEANY_FILETYPES_GLSL: /* for structs */
/*case GEANY_FILETYPES_RUBY:*/ /* not sure what to use atm*/ /*case GEANY_FILETYPES_RUBY:*/ /* not sure what to use atm*/
@ -1025,10 +1030,12 @@ int symbols_generate_global_tags(int argc, char **argv, gboolean want_preprocess
return 1; return 1;
} }
/* load ignore list for C/C++ parser */ /* load ignore list for C/C++ parser */
if (ft->id == GEANY_FILETYPES_C || ft->id == GEANY_FILETYPES_CPP) if (ft->id == GEANY_FILETYPES_C || ft->id == GEANY_FILETYPES_CPP
|| ft->id == GEANY_FILETYPES_H || ft->id == GEANY_FILETYPES_HPP )
load_c_ignore_tags(); load_c_ignore_tags();
if (want_preprocess && (ft->id == GEANY_FILETYPES_C || ft->id == GEANY_FILETYPES_CPP)) if (want_preprocess && (ft->id == GEANY_FILETYPES_C || ft->id == GEANY_FILETYPES_CPP
|| ft->id == GEANY_FILETYPES_H || ft->id == GEANY_FILETYPES_HPP ))
command = g_strdup_printf("%s %s", pre_process, NVL(getenv("CFLAGS"), "")); command = g_strdup_printf("%s %s", pre_process, NVL(getenv("CFLAGS"), ""));
else else
command = NULL; /* don't preprocess */ command = NULL; /* don't preprocess */