SF.net SVN: geany: [553] trunk
eht16 at users.sourceforge.net
eht16 at xxxxx
Fri Jul 14 10:15:24 UTC 2006
Revision: 553
Author: eht16
Date: 2006-07-14 03:15:12 -0700 (Fri, 14 Jul 2006)
ViewCVS: http://svn.sourceforge.net/geany/?rev=553&view=rev
Log Message:
-----------
Fixed autocompletion for filetype C++.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/filetypes.c
trunk/src/highlighting.c
trunk/tagmanager/tm_tag.c
trunk/tagmanager/tm_workspace.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2006-07-13 19:49:33 UTC (rev 552)
+++ trunk/ChangeLog 2006-07-14 10:15:12 UTC (rev 553)
@@ -1,3 +1,9 @@
+2006-07-14 Enrico Tröger <enrico.troeger at uvena.de>
+
+ * src/filetypes.c, src/highlighting.c, tagmanager/tm_tag.c,
+ tagmanager/tm_workspace.c: Fixed autocompletion for filetype C++.
+
+
2006-07-13 Nick Treleaven <nick.treleaven at btinternet.com>
* src/build.c, src/interface.c, src/utils.c, src/utils.h, src/geany.h,
Modified: trunk/src/filetypes.c
===================================================================
--- trunk/src/filetypes.c 2006-07-13 19:49:33 UTC (rev 552)
+++ trunk/src/filetypes.c 2006-07-14 10:15:12 UTC (rev 553)
@@ -67,8 +67,7 @@
#define CPP
filetypes[GEANY_FILETYPES_CPP] = g_new0(filetype, 1);
filetypes[GEANY_FILETYPES_CPP]->id = GEANY_FILETYPES_CPP;
- // C++ has langType 1, but to get the global tags for C, too, we use the langType of C
- filetypes[GEANY_FILETYPES_CPP]->lang = 0;
+ filetypes[GEANY_FILETYPES_CPP]->lang = 1;
filetypes[GEANY_FILETYPES_CPP]->name = g_strdup("C++");
filetypes[GEANY_FILETYPES_CPP]->has_tags = TRUE;
filetypes[GEANY_FILETYPES_CPP]->title = g_strdup(_("C++ source file"));
Modified: trunk/src/highlighting.c
===================================================================
--- trunk/src/highlighting.c 2006-07-13 19:49:33 UTC (rev 552)
+++ trunk/src/highlighting.c 2006-07-14 10:15:12 UTC (rev 553)
@@ -235,7 +235,7 @@
// why? if I let this out, the indicator remains green with PHP
SSM(sci, SCI_INDICSETFORE, 0, invert(0x0000ff));
SSM(sci, SCI_INDICSETFORE, 2, invert(0x0000ff));
-
+
// define marker symbols
// 0 -> line marker
SSM(sci, SCI_MARKERDEFINE, 0, SC_MARK_SHORTARROW);
@@ -506,8 +506,7 @@
if (! app->ignore_global_tags && ! global_c_tags_loaded)
{
// 0 is the langType used in TagManager (see the table in tagmanager/parsers.h)
- // C++ is a special case, here we use 0 to have C global tags in C++, too
- tm_workspace_load_global_tags(GEANY_DATA_DIR G_DIR_SEPARATOR_S "global.tags", 0);
+ tm_workspace_load_global_tags(GEANY_DATA_DIR G_DIR_SEPARATOR_S "global.tags", 1);
global_c_tags_loaded = TRUE;
}
}
Modified: trunk/tagmanager/tm_tag.c
===================================================================
--- trunk/tagmanager/tm_tag.c 2006-07-13 19:49:33 UTC (rev 552)
+++ trunk/tagmanager/tm_tag.c 2006-07-14 10:15:12 UTC (rev 553)
@@ -210,7 +210,7 @@
if ((NULL == fgets((gchar*)buf, BUFSIZ, fp)) || ('\0' == *buf))
return FALSE;
- if (mode == 0)
+ if (mode == 0 || mode == 1)
{
for (start = end = buf, status = TRUE; (TRUE == status); start = end, ++ end)
{
@@ -291,11 +291,12 @@
#endif
break;
}
+ tag->atts.file.lang = mode;
}
*end = changed_char;
}
}
- else
+ else
{
// alternative parser for PHP and LaTeX global tags files with the following format
// tagname|return value|arglist|description\n
@@ -314,7 +315,7 @@
fields = g_strsplit((gchar*)start, "|", -1);
field_len = g_strv_length(fields);
-
+
if (field_len >= 1) tag->name = g_strdup(fields[0]);
else tag->name = NULL;
if (field_len >= 2 && fields[1] != NULL) tag->atts.entry.var_type = g_strdup(fields[1]);
@@ -324,7 +325,7 @@
g_strfreev(fields);
}
}
-
+
if (NULL == tag->name)
return FALSE;
if (tm_tag_file_t != tag->type)
Modified: trunk/tagmanager/tm_workspace.c
===================================================================
--- trunk/tagmanager/tm_workspace.c 2006-07-13 19:49:33 UTC (rev 552)
+++ trunk/tagmanager/tm_workspace.c 2006-07-14 10:15:12 UTC (rev 553)
@@ -152,7 +152,7 @@
// resort the whole array, because tm_tags_find expects a sorted array and it is not sorted
// when global.tags, php.tags and latex.tags are loaded at the same time
tm_tags_sort(theWorkspace->global_tags, attr, TRUE);
-
+
return TRUE;
}
@@ -444,8 +444,8 @@
, gboolean partial, langType lang)
{
static GPtrArray *tags = NULL;
- TMTag **matches[2], **match;
- int i, len, tagCount[2]={0,0}, tagIter;
+ TMTag **matches[2];
+ int len, tagCount[2]={0,0}, tagIter;
gint tags_lang;
if ((!theWorkspace) || (!name))
@@ -460,38 +460,67 @@
matches[0] = tm_tags_find(theWorkspace->work_object.tags_array, name, partial, &tagCount[0]);
matches[1] = tm_tags_find(theWorkspace->global_tags, name, partial, &tagCount[1]);
- for (i = 0; i < 2; ++i)
+
+ // file tags
+ if (matches[0] && *matches[0])
{
- match = matches[i];
- if (match && *match)
+ // tag->atts.file.lang contains the line of the tag and
+ // tags->atts.entry.file->lang contains the language
+ tags_lang = (*matches[0])->atts.entry.file->lang;
+
+ for (tagIter=0;tagIter<tagCount[0];++tagIter)
{
- // for global tags: tag->atts.file.lang contains the language and
- // tags->atts.entry.file->lang is NULL
- // for "usual" tags: tag->atts.file.lang contains the line of the tag and
- // tags->atts.entry.file->lang contains the language
- if ((*match)->atts.entry.file != NULL)
- tags_lang = (*match)->atts.entry.file->lang;
- else
- tags_lang = (*match)->atts.file.lang;
-
- for (tagIter=0;tagIter<tagCount[i];++tagIter)
+ if ((type & (*matches[0])->type) && (lang == -1 || tags_lang == lang))
+ g_ptr_array_add(tags, *matches[0]);
+ if (partial)
{
- if ((type & (*match)->type) && (lang == -1 || tags_lang == lang))
- g_ptr_array_add(tags, *match);
- if (partial)
- {
- if (0 != strncmp((*match)->name, name, len))
- break;
- }
- else
- {
- if (0 != strcmp((*match)->name, name))
- break;
- }
- ++ match;
+ if (0 != strncmp((*matches[0])->name, name, len))
+ break;
}
+ else
+ {
+ if (0 != strcmp((*matches[0])->name, name))
+ break;
+ }
+ ++ matches[0];
}
}
+
+ // global tags
+ if (matches[1] && *matches[1])
+ {
+ int tags_lang_alt = 0;
+ // tag->atts.file.lang contains the language and
+ // tags->atts.entry.file is NULL
+ tags_lang = (*matches[1])->atts.file.lang;
+ // tags_lang_alt is used to load C global tags only once for C and C++
+ // lang = 1 is C++, lang = 0 is C
+ // if we have lang 0, than accept also lang 1 for C++
+ if (tags_lang == 0) // C or C++
+ tags_lang_alt = 1;
+ else
+ tags_lang_alt = tags_lang; // otherwise just ignore it
+
+ for (tagIter=0;tagIter<tagCount[1];++tagIter)
+ {
+ if ((type & (*matches[1])->type) && (lang == -1 ||
+ tags_lang == lang || tags_lang_alt == lang))
+ g_ptr_array_add(tags, *matches[1]);
+
+ if (partial)
+ {
+ if (0 != strncmp((*matches[1])->name, name, len))
+ break;
+ }
+ else
+ {
+ if (0 != strcmp((*matches[1])->name, name))
+ break;
+ }
+ ++ matches[1];
+ }
+ }
+
tm_tags_sort(tags, attrs, TRUE);
return tags;
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Commits
mailing list