[geany/geany] 0a0ed5: Create geany.c/h and put isIgnoreToken()
Jiří Techet
git-noreply at xxxxx
Mon Dec 17 21:05:39 UTC 2018
Branch: refs/heads/master
Author: Jiří Techet <techet at gmail.com>
Committer: Jiří Techet <techet at gmail.com>
Date: Sat, 08 Oct 2016 12:13:41 UTC
Commit: 0a0ed51792b9af2693b9ec632c1456e62ace0af3
https://github.com/geany/geany/commit/0a0ed51792b9af2693b9ec632c1456e62ace0af3
Log Message:
-----------
Create geany.c/h and put isIgnoreToken()
This is a (hopefully) temporary file where we put geany-specific code
that for some reason has to be still in ctags. Put isIgnoreToken()
in this file.
Modified Paths:
--------------
ctags/Makefile.am
ctags/main/geany.c
ctags/main/geany.h
ctags/main/options.c
ctags/main/options.h
ctags/parsers/c.c
src/symbols.c
Modified: ctags/Makefile.am
2 lines changed, 2 insertions(+), 0 deletions(-)
===================================================================
@@ -64,6 +64,8 @@ libctags_la_SOURCES = \
main/error.c \
main/error.h \
main/gcc-attr.h \
+ main/geany.c \
+ main/geany.h \
main/general.h \
main/keyword.c \
main/keyword.h \
Modified: ctags/main/geany.c
80 lines changed, 80 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2016, Jiri Techet
+*
+* This source code is released for free distribution under the terms of the
+* GNU General Public License version 2 or (at your option) any later version.
+*
+* Defines external interface to option processing.
+*/
+
+#include "general.h" /* must always come first */
+
+#include "geany.h"
+#include "vstring.h"
+
+#include <string.h>
+#include <glib.h>
+
+/* tags_ignore is a NULL-terminated array of strings, read from ~/.config/geany/ignore.tags.
+ * This file contains a space or newline separated list of symbols which should be ignored
+ * by the C/C++ parser, see -I command line option of ctags for details. */
+gchar **c_tags_ignore = NULL;
+
+/* Determines whether or not "name" should be ignored, per the ignore list.
+ */
+extern bool isIgnoreToken (const char *const name,
+ bool *const pIgnoreParens,
+ const char **const replacement)
+{
+ bool result = false;
+
+ if (c_tags_ignore != NULL)
+ {
+ const size_t nameLen = strlen (name);
+ unsigned int i;
+ guint len = g_strv_length (c_tags_ignore);
+ vString *token = vStringNew();
+
+ if (pIgnoreParens != NULL)
+ *pIgnoreParens = false;
+
+ for (i = 0 ; i < len ; ++i)
+ {
+ size_t tokenLen;
+
+ vStringCopyS (token, c_tags_ignore[i]);
+ tokenLen = vStringLength (token);
+
+ if (tokenLen >= 2 && vStringChar (token, tokenLen - 1) == '*' &&
+ strncmp (vStringValue (token), name, tokenLen - 1) == 0)
+ {
+ result = true;
+ break;
+ }
+ if (strncmp (vStringValue (token), name, nameLen) == 0)
+ {
+ if (nameLen == tokenLen)
+ {
+ result = true;
+ break;
+ }
+ else if (tokenLen == nameLen + 1 &&
+ vStringChar (token, tokenLen - 1) == '+')
+ {
+ result = true;
+ if (pIgnoreParens != NULL)
+ *pIgnoreParens = true;
+ break;
+ }
+ else if (vStringChar (token, nameLen) == '=')
+ {
+ if (replacement != NULL)
+ *replacement = vStringValue (token) + nameLen + 1;
+ break;
+ }
+ }
+ }
+ vStringDelete (token);
+ }
+ return result;
+}
Modified: ctags/main/geany.h
14 lines changed, 14 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,14 @@
+/*
+* Copyright (c) 2016, Jiri Techet
+*
+* This source code is released for free distribution under the terms of the
+* GNU General Public License version 2 or (at your option) any later version.
+*
+* Defines external interface to option processing.
+*/
+#ifndef CTAGS_GEANY_H
+#define CTAGS_GEANY_H
+
+extern bool isIgnoreToken (const char *const name, bool *const pIgnoreParens, const char **const replacement);
+
+#endif /* CTAGS_GEANY_H */
Modified: ctags/main/options.c
66 lines changed, 0 insertions(+), 66 deletions(-)
===================================================================
@@ -23,8 +23,6 @@
#include "options.h"
#include "parse.h"
-#include <glib.h>
-
#define CTAGS_ENVIRONMENT "CTAGS"
#define CTAGS_FILE "tags"
@@ -133,67 +131,3 @@ extern bool isIncludeFile (const char *const fileName)
{
return false;
}
-
-/* tags_ignore is a NULL-terminated array of strings, read from ~/.config/geany/ignore.tags.
- * This file contains a space or newline separated list of symbols which should be ignored
- * by the C/C++ parser, see -I command line option of ctags for details. */
-gchar **c_tags_ignore = NULL;
-
-/* Determines whether or not "name" should be ignored, per the ignore list.
- */
-extern bool isIgnoreToken (const char *const name,
- bool *const pIgnoreParens,
- const char **const replacement)
-{
- bool result = false;
-
- if (c_tags_ignore != NULL)
- {
- const size_t nameLen = strlen (name);
- unsigned int i;
- guint len = g_strv_length (c_tags_ignore);
- vString *token = vStringNew();
-
- if (pIgnoreParens != NULL)
- *pIgnoreParens = false;
-
- for (i = 0 ; i < len ; ++i)
- {
- size_t tokenLen;
-
- vStringCopyS (token, c_tags_ignore[i]);
- tokenLen = vStringLength (token);
-
- if (tokenLen >= 2 && vStringChar (token, tokenLen - 1) == '*' &&
- strncmp (vStringValue (token), name, tokenLen - 1) == 0)
- {
- result = true;
- break;
- }
- if (strncmp (vStringValue (token), name, nameLen) == 0)
- {
- if (nameLen == tokenLen)
- {
- result = true;
- break;
- }
- else if (tokenLen == nameLen + 1 &&
- vStringChar (token, tokenLen - 1) == '+')
- {
- result = true;
- if (pIgnoreParens != NULL)
- *pIgnoreParens = true;
- break;
- }
- else if (vStringChar (token, nameLen) == '=')
- {
- if (replacement != NULL)
- *replacement = vStringValue (token) + nameLen + 1;
- break;
- }
- }
- }
- vStringDelete (token);
- }
- return result;
-}
Modified: ctags/main/options.h
1 lines changed, 0 insertions(+), 1 deletions(-)
===================================================================
@@ -103,6 +103,5 @@ extern void freeList (stringList** const pString);
extern void setDefaultTagFileName (void);
extern bool isIncludeFile (const char *const fileName);
-extern bool isIgnoreToken (const char *const name, bool *const pIgnoreParens, const char **const replacement);
#endif /* CTAGS_MAIN_OPTIONS_H */
Modified: ctags/parsers/c.c
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -26,6 +26,7 @@
#include "read.h"
#include "routines.h"
#include "xtag.h"
+#include "geany.h"
/*
* MACROS
Modified: src/symbols.c
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -118,7 +118,7 @@ symbol_menu;
static void load_user_tags(GeanyFiletypeID ft_id);
-/* get the tags_ignore list, exported by tagmanager's options.c */
+/* get the tags_ignore list, exported by tagmanager's geany.c */
extern gchar **c_tags_ignore;
/* ignore certain tokens when parsing C-like syntax.
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list