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.
This commit is contained in:
parent
f1dbf2cb7b
commit
0a0ed51792
@ -64,6 +64,8 @@ libctags_la_SOURCES = \
|
|||||||
main/error.c \
|
main/error.c \
|
||||||
main/error.h \
|
main/error.h \
|
||||||
main/gcc-attr.h \
|
main/gcc-attr.h \
|
||||||
|
main/geany.c \
|
||||||
|
main/geany.h \
|
||||||
main/general.h \
|
main/general.h \
|
||||||
main/keyword.c \
|
main/keyword.c \
|
||||||
main/keyword.h \
|
main/keyword.h \
|
||||||
|
80
ctags/main/geany.c
Normal file
80
ctags/main/geany.c
Normal file
@ -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;
|
||||||
|
}
|
14
ctags/main/geany.h
Normal file
14
ctags/main/geany.h
Normal file
@ -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 */
|
@ -23,8 +23,6 @@
|
|||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "parse.h"
|
#include "parse.h"
|
||||||
|
|
||||||
#include <glib.h>
|
|
||||||
|
|
||||||
#define CTAGS_ENVIRONMENT "CTAGS"
|
#define CTAGS_ENVIRONMENT "CTAGS"
|
||||||
|
|
||||||
#define CTAGS_FILE "tags"
|
#define CTAGS_FILE "tags"
|
||||||
@ -133,67 +131,3 @@ extern bool isIncludeFile (const char *const fileName)
|
|||||||
{
|
{
|
||||||
return false;
|
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;
|
|
||||||
}
|
|
||||||
|
@ -103,6 +103,5 @@ extern void freeList (stringList** const pString);
|
|||||||
extern void setDefaultTagFileName (void);
|
extern void setDefaultTagFileName (void);
|
||||||
|
|
||||||
extern bool isIncludeFile (const char *const fileName);
|
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 */
|
#endif /* CTAGS_MAIN_OPTIONS_H */
|
||||||
|
@ -26,6 +26,7 @@
|
|||||||
#include "read.h"
|
#include "read.h"
|
||||||
#include "routines.h"
|
#include "routines.h"
|
||||||
#include "xtag.h"
|
#include "xtag.h"
|
||||||
|
#include "geany.h"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MACROS
|
* MACROS
|
||||||
|
@ -118,7 +118,7 @@ symbol_menu;
|
|||||||
|
|
||||||
static void load_user_tags(GeanyFiletypeID ft_id);
|
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;
|
extern gchar **c_tags_ignore;
|
||||||
|
|
||||||
/* ignore certain tokens when parsing C-like syntax.
|
/* ignore certain tokens when parsing C-like syntax.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user