📄 ctags.h
字号:
/*****************************************************************************
* $Id: ctags.h,v 6.13 1998/08/13 01:32:38 darren Exp $
*
* Copyright (c) 1996-1998, Darren Hiebert
*
* This source code is released for free distribution under the terms of the
* GNU General Public License.
*
* This module is a global include file.
*****************************************************************************/
/*============================================================================
= Include files
============================================================================*/
#include <stdio.h>
#include <string.h>
#include <ctype.h> /* to declare isalnum(), isalpha(), isspace() */
#if defined(MSDOS) || defined(WIN32) || defined(OS2) || defined(AMIGA)
# define HAVE_STDLIB_H
#endif
#if defined(__STDC__) || defined(MSDOS) || defined(WIN32) || defined(OS2)
# define ENABLE_PROTOTYPES
#endif
#if defined(HAVE_STDLIB_H)
# include <stdlib.h> /* to declare alloc funcs and getenv() */
#endif
/*============================================================================
= Portability defines
============================================================================*/
#if defined(MSDOS) || defined(WIN32) || defined(OS2) || defined(AMIGA) || defined(HAVE_OPENDIR)
# define RECURSE_SUPPORTED
#endif
/* Determine whether to use prototypes or simple declarations.
*/
#ifndef __ARGS
# ifdef ENABLE_PROTOTYPES
# define __ARGS(x) x
# else
# define __ARGS(x) ()
# endif
#endif
/* This is a helpful internal feature of later versions (> 2.7) of GCC
* to prevent warnings about unused variables.
*/
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
# define __unused__ __attribute__((unused))
#else
# define __unused__
#endif
/* MS-DOS doesn't allow manipulation of standard error, so we send it to
* stdout instead.
*/
#if defined(MSDOS) || defined(WIN32)
# define errout stdout
#else
# define errout stderr
#endif
/*============================================================================
= General defines
============================================================================*/
#ifndef PROGRAM_VERSION
# define PROGRAM_VERSION "2.3"
#endif
#define PROGRAM_NAME "Exuberant Ctags"
#define PROGRAM_URL "http://darren.hiebert.com/ctags/index.html"
#define AUTHOR_NAME "Darren Hiebert"
#define AUTHOR_EMAIL "darren@hiebert.com"
#define CTAGS_FILE "tags"
#define ETAGS_FILE "TAGS"
#define PSEUDO_TAG_PREFIX "!_"
/*============================================================================
= Macros
============================================================================*/
#ifdef DEBUG
# define debug(level) ((Option.debugLevel & (int)(level)) != 0)
# define DebugStatement(x) x
#else
# define DebugStatement(x)
# ifndef NDEBUG
# define NDEBUG
# endif
#endif
/* For convenience and safety.
*/
#define stringMatch(s1,s2) (strcmp(s1,s2) == 0)
/* Is the character valid as a character of a C identifier?
*/
#define isident(c) (isalnum(c) || (c) == '_')
/* Is the character valid as the first character of a C identifier?
*/
#define isident1(c) (isalpha(c) || (c) == '_' || (c) == '~')
/* Is that character a space or a tab?
*/
#define isspacetab(c) ((c) == ' ' || (c) == '\t')
/*============================================================================
= Data declarations
============================================================================*/
#undef FALSE
#undef TRUE
typedef enum { FALSE, TRUE } boolean;
typedef int errorSelection;
enum _errorTypes { FATAL = 1, WARNING = 2, PERROR = 4 };
enum _limits {
MaxNameLength = 256, /* maximum length of token with null */
MaxHeaderExtensions = 100, /* maximum number of extensions in -h option */
MaxCppNestingLevel = 20,
MaxSupportedTagFormat = 2
};
enum _characters {
/* White space characters.
*/
SPACE = ' ',
NEWLINE = '\n',
CRETURN = '\r',
FORMFEED = '\f',
TAB = '\t',
VTAB = '\v',
/* Some hard to read characters.
*/
DOUBLE_QUOTE = '"',
SINGLE_QUOTE = '\'',
BACKSLASH = '\\',
STRING_SYMBOL = ('S' + 0x80),
CHAR_SYMBOL = ('C' + 0x80)
};
typedef struct _lineBuf {
int size; /* size of buffer; 'int' because passed to fgets() */
char *buffer; /* buffer for placing line into */
} lineBuf;
/* Maintains the state of the tag file.
*/
typedef struct _tagFile {
const char *name;
FILE *fp;
struct _numTags { unsigned long added, prev; } numTags;
struct _max { size_t line, tag, file; } max;
struct _etags {
char name[L_tmpnam];
FILE *fp;
size_t byteCount;
} etags;
lineBuf line;
} tagFile;
typedef enum _langType {
LANG_AUTO = -2, /* automatically determine language */
LANG_IGNORE = -1, /* ignore file (uunknown/nsupported language) */
LANG_C, /* ANSI C */
LANG_CPP, /* C++ */
LANG_JAVA, /* Java */
LANG_COUNT /* count of languages */
} langType;
/* Maintains the state of the current source file.
*/
typedef struct _sourceFile {
const char *name; /* name of the current file */
FILE *fp; /* stream used for reading the file */
unsigned long lineNumber; /* line number in the current file */
long seek; /* fseek() offset to start of current line */
int ungetch; /* a single character that was ungotten */
boolean afterNL; /* was previous character a newline? */
boolean isHeader; /* is current file a header file? */
langType language; /* language of current file */
} sourceFile;
/* This stores the command line options.
*/
typedef struct _optionValues {
struct _include { /* include tags for: */
boolean classNames; /* -ic class names */
boolean defines; /* -id defines */
boolean enumerators; /* -ie enumeration value */
boolean functions; /* -if functions */
boolean enumNames; /* -ig enum names */
boolean interfaceNames; /* -ii interface names */
boolean members; /* -im data members */
boolean namespaceNames; /* -in namespace names */
boolean prototypes; /* -ip function prototypes */
boolean structNames; /* -is struct names */
boolean typedefs; /* -it typedefs */
boolean unionNames; /* -iu unions */
boolean variables; /* -iv variables */
boolean externVars; /* -ix extern variables */
boolean classPrefix; /* -iC include tag entries of class::member */
boolean sourceFiles; /* -iF include tags for source files */
boolean statics; /* -iS include static tags */
} include;
struct _ignore {
char **list;
unsigned int count, max;
} ignore; /* -I name of file containing tokens to ignore */
boolean append; /* -a append to "tags" files */
boolean backward; /* -B regexp patterns search backwards */
boolean etags; /* -e output Emacs style tags file */
enum _locate {
EX_MIX, /* line numbers for defines, patterns otherwise */
EX_LINENUM, /* -n only line numbers in tag file */
EX_PATTERN /* -N only patterns in tag file */
} locate; /* --excmd EX command used to locate tag */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -