[geany/geany] ed01b7: Grab uctags keyword.c/h and add types.h with type declarations
Jiří Techet
git-noreply at xxxxx
Mon Dec 17 21:05:31 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:12:44 UTC
Commit: ed01b7edb4dd8f24857fdefe9a226fc6e5c7473d
https://github.com/geany/geany/commit/ed01b7edb4dd8f24857fdefe9a226fc6e5c7473d
Log Message:
-----------
Grab uctags keyword.c/h and add types.h with type declarations
keyword.c/h contains only changes made by me. To make the sync complete,
add type.h with type declarations (and remove the added declarations from
their original locations).
Modified Paths:
--------------
ctags/Makefile.am
ctags/main/entry.h
ctags/main/keyword.c
ctags/main/keyword.h
ctags/main/kind.h
ctags/main/lcpp.h
ctags/main/parse.h
ctags/main/types.h
Modified: ctags/Makefile.am
1 lines changed, 1 insertions(+), 0 deletions(-)
===================================================================
@@ -89,6 +89,7 @@ libctags_la_SOURCES = \
main/sort.h \
main/strlist.c \
main/strlist.h \
+ main/types.h \
main/vstring.c \
main/vstring.h \
main/xtag.h \
Modified: ctags/main/entry.h
5 lines changed, 3 insertions(+), 2 deletions(-)
===================================================================
@@ -13,6 +13,7 @@
* INCLUDE FILES
*/
#include "general.h" /* must always come first */
+#include "types.h"
#include "mio.h"
#include "vstring.h"
@@ -51,7 +52,7 @@ typedef struct sTagFields {
/* Information about the current tag candidate.
*/
-typedef struct sTagEntryInfo {
+struct sTagEntryInfo {
bool lineNumberEntry; /* pattern or line number entry */
unsigned long lineNumber; /* line number of tag */
MIOPos filePosition; /* file position of line containing tag */
@@ -74,7 +75,7 @@ typedef struct sTagEntryInfo {
const char *signature; /* Argument list for functions and macros with arguments */
const char *varType;
} extensionFields; /* list of extension fields*/
-} tagEntryInfo;
+};
/*
* GLOBAL VARIABLES
Modified: ctags/main/keyword.c
22 lines changed, 17 insertions(+), 5 deletions(-)
===================================================================
@@ -13,12 +13,12 @@
#include "general.h" /* must always come first */
#include <string.h>
+#include <ctype.h>
#include "debug.h"
#include "keyword.h"
#include "options.h"
#include "routines.h"
-#include "main.h"
/*
* DATA DECLARATIONS
@@ -78,7 +78,7 @@ static unsigned int hashValue (const char *const string, langType language)
/* "djb" hash as used in g_str_hash() in glib */
for (p = (const signed char *)string; *p != '\0'; p++)
- h = (h << 5) + h + *p;
+ h = (h << 5) + h + tolower (*p);
/* consider language as an extra "character" and add it to the hash */
h = (h << 5) + h + language;
@@ -136,15 +136,17 @@ extern void addKeyword (const char *const string, langType language, int value)
}
}
-extern int lookupKeyword (const char *const string, langType language)
+static int lookupKeywordFull (const char *const string, bool caseSensitive, langType language)
{
const unsigned int index = hashValue (string, language) % TableSize;
hashEntry *entry = getHashTableEntry (index);
- int result = -1;
+ int result = KEYWORD_NONE;
while (entry != NULL)
{
- if (language == entry->language && strcmp (string, entry->string) == 0)
+ if (language == entry->language &&
+ ((caseSensitive && strcmp (string, entry->string) == 0) ||
+ (!caseSensitive && strcasecmp (string, entry->string) == 0)))
{
result = entry->value;
break;
@@ -154,6 +156,16 @@ extern int lookupKeyword (const char *const string, langType language)
return result;
}
+extern int lookupKeyword (const char *const string, langType language)
+{
+ return lookupKeywordFull (string, true, language);
+}
+
+extern int lookupCaseKeyword (const char *const string, langType language)
+{
+ return lookupKeywordFull (string, false, language);
+}
+
extern void freeKeywordTable (void)
{
if (HashTable != NULL)
Modified: ctags/main/keyword.h
4 lines changed, 3 insertions(+), 1 deletions(-)
===================================================================
@@ -14,7 +14,8 @@
*/
#include "general.h" /* must always come first */
-#include "parse.h"
+#include "types.h"
+#include "vstring.h"
#define KEYWORD_NONE -1
@@ -23,6 +24,7 @@
*/
extern void addKeyword (const char *const string, langType language, int value);
extern int lookupKeyword (const char *const string, langType language);
+extern int lookupCaseKeyword (const char *const string, langType language);
extern void freeKeywordTable (void);
#ifdef DEBUG
extern void printKeywordTable (void);
Modified: ctags/main/kind.h
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -17,11 +17,11 @@
#define KIND_FILE_DEFAULT 'F'
#define KIND_FILE_DEFAULT_LONG "file"
-typedef struct sKindOption {
+struct sKindOption {
bool enabled; /* are tags for kind enabled? */
char letter; /* kind letter */
const char* name; /* kind name */
const char* description; /* displayed in --help output */
-} kindOption;
+};
#endif /* CTAGS_MAIN_KIND_H */
Modified: ctags/main/lcpp.h
3 lines changed, 1 insertions(+), 2 deletions(-)
===================================================================
@@ -13,8 +13,7 @@
* INCLUDE FILES
*/
#include "general.h" /* must always come first */
-
-#include "ctags.h" /* to define langType */
+#include "types.h"
/*
* MACROS
Modified: ctags/main/parse.h
1 lines changed, 0 insertions(+), 1 deletions(-)
===================================================================
@@ -27,7 +27,6 @@
/*
* DATA DECLARATIONS
*/
-typedef int langType;
typedef void (*createRegexTag) (const vString* const name);
typedef void (*simpleParser) (void);
Modified: ctags/main/types.h
21 lines changed, 21 insertions(+), 0 deletions(-)
===================================================================
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 1998-2003, Darren Hiebert
+*
+* 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.
+*
+* Private definitions for parsing support.
+*/
+
+#ifndef CTAGS_MAIN_TYPES_H
+#define CTAGS_MAIN_TYPES_H
+
+typedef int langType;
+
+struct sTagEntryInfo;
+typedef struct sTagEntryInfo tagEntryInfo;
+
+struct sKindOption;
+typedef struct sKindOption kindOption;
+
+#endif /* CTAGS_MAIN_TYPES_H */
--------------
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