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).
This commit is contained in:
parent
a52137f414
commit
ed01b7edb4
@ -89,6 +89,7 @@ libctags_la_SOURCES = \
|
|||||||
main/sort.h \
|
main/sort.h \
|
||||||
main/strlist.c \
|
main/strlist.c \
|
||||||
main/strlist.h \
|
main/strlist.h \
|
||||||
|
main/types.h \
|
||||||
main/vstring.c \
|
main/vstring.c \
|
||||||
main/vstring.h \
|
main/vstring.h \
|
||||||
main/xtag.h \
|
main/xtag.h \
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
* INCLUDE FILES
|
* INCLUDE FILES
|
||||||
*/
|
*/
|
||||||
#include "general.h" /* must always come first */
|
#include "general.h" /* must always come first */
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
#include "mio.h"
|
#include "mio.h"
|
||||||
#include "vstring.h"
|
#include "vstring.h"
|
||||||
@ -51,7 +52,7 @@ typedef struct sTagFields {
|
|||||||
|
|
||||||
/* Information about the current tag candidate.
|
/* Information about the current tag candidate.
|
||||||
*/
|
*/
|
||||||
typedef struct sTagEntryInfo {
|
struct sTagEntryInfo {
|
||||||
bool lineNumberEntry; /* pattern or line number entry */
|
bool lineNumberEntry; /* pattern or line number entry */
|
||||||
unsigned long lineNumber; /* line number of tag */
|
unsigned long lineNumber; /* line number of tag */
|
||||||
MIOPos filePosition; /* file position of line containing 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 *signature; /* Argument list for functions and macros with arguments */
|
||||||
const char *varType;
|
const char *varType;
|
||||||
} extensionFields; /* list of extension fields*/
|
} extensionFields; /* list of extension fields*/
|
||||||
} tagEntryInfo;
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GLOBAL VARIABLES
|
* GLOBAL VARIABLES
|
||||||
|
@ -13,12 +13,12 @@
|
|||||||
#include "general.h" /* must always come first */
|
#include "general.h" /* must always come first */
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
#include "keyword.h"
|
#include "keyword.h"
|
||||||
#include "options.h"
|
#include "options.h"
|
||||||
#include "routines.h"
|
#include "routines.h"
|
||||||
#include "main.h"
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* DATA DECLARATIONS
|
* 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 */
|
/* "djb" hash as used in g_str_hash() in glib */
|
||||||
for (p = (const signed char *)string; *p != '\0'; p++)
|
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 */
|
/* consider language as an extra "character" and add it to the hash */
|
||||||
h = (h << 5) + h + language;
|
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;
|
const unsigned int index = hashValue (string, language) % TableSize;
|
||||||
hashEntry *entry = getHashTableEntry (index);
|
hashEntry *entry = getHashTableEntry (index);
|
||||||
int result = -1;
|
int result = KEYWORD_NONE;
|
||||||
|
|
||||||
while (entry != NULL)
|
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;
|
result = entry->value;
|
||||||
break;
|
break;
|
||||||
@ -154,6 +156,16 @@ extern int lookupKeyword (const char *const string, langType language)
|
|||||||
return result;
|
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)
|
extern void freeKeywordTable (void)
|
||||||
{
|
{
|
||||||
if (HashTable != NULL)
|
if (HashTable != NULL)
|
||||||
|
@ -14,7 +14,8 @@
|
|||||||
*/
|
*/
|
||||||
#include "general.h" /* must always come first */
|
#include "general.h" /* must always come first */
|
||||||
|
|
||||||
#include "parse.h"
|
#include "types.h"
|
||||||
|
#include "vstring.h"
|
||||||
|
|
||||||
#define KEYWORD_NONE -1
|
#define KEYWORD_NONE -1
|
||||||
|
|
||||||
@ -23,6 +24,7 @@
|
|||||||
*/
|
*/
|
||||||
extern void addKeyword (const char *const string, langType language, int value);
|
extern void addKeyword (const char *const string, langType language, int value);
|
||||||
extern int lookupKeyword (const char *const string, langType language);
|
extern int lookupKeyword (const char *const string, langType language);
|
||||||
|
extern int lookupCaseKeyword (const char *const string, langType language);
|
||||||
extern void freeKeywordTable (void);
|
extern void freeKeywordTable (void);
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
extern void printKeywordTable (void);
|
extern void printKeywordTable (void);
|
||||||
|
@ -17,11 +17,11 @@
|
|||||||
#define KIND_FILE_DEFAULT 'F'
|
#define KIND_FILE_DEFAULT 'F'
|
||||||
#define KIND_FILE_DEFAULT_LONG "file"
|
#define KIND_FILE_DEFAULT_LONG "file"
|
||||||
|
|
||||||
typedef struct sKindOption {
|
struct sKindOption {
|
||||||
bool enabled; /* are tags for kind enabled? */
|
bool enabled; /* are tags for kind enabled? */
|
||||||
char letter; /* kind letter */
|
char letter; /* kind letter */
|
||||||
const char* name; /* kind name */
|
const char* name; /* kind name */
|
||||||
const char* description; /* displayed in --help output */
|
const char* description; /* displayed in --help output */
|
||||||
} kindOption;
|
};
|
||||||
|
|
||||||
#endif /* CTAGS_MAIN_KIND_H */
|
#endif /* CTAGS_MAIN_KIND_H */
|
||||||
|
@ -13,8 +13,7 @@
|
|||||||
* INCLUDE FILES
|
* INCLUDE FILES
|
||||||
*/
|
*/
|
||||||
#include "general.h" /* must always come first */
|
#include "general.h" /* must always come first */
|
||||||
|
#include "types.h"
|
||||||
#include "ctags.h" /* to define langType */
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* MACROS
|
* MACROS
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
/*
|
/*
|
||||||
* DATA DECLARATIONS
|
* DATA DECLARATIONS
|
||||||
*/
|
*/
|
||||||
typedef int langType;
|
|
||||||
|
|
||||||
typedef void (*createRegexTag) (const vString* const name);
|
typedef void (*createRegexTag) (const vString* const name);
|
||||||
typedef void (*simpleParser) (void);
|
typedef void (*simpleParser) (void);
|
||||||
|
21
ctags/main/types.h
Normal file
21
ctags/main/types.h
Normal file
@ -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 */
|
Loading…
x
Reference in New Issue
Block a user