-
-
Notifications
You must be signed in to change notification settings - Fork 19
/
options.h
155 lines (137 loc) · 4.92 KB
/
options.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/*
* $Id: options.h 443 2006-05-30 04:37:13Z darren $
*
* Copyright (c) 1998-2003, Darren Hiebert
*
* This source code is released for free distribution under the terms of the
* GNU General Public License.
*
* Defines external interface to option processing.
*/
#ifndef _OPTIONS_H
#define _OPTIONS_H
#if defined(OPTION_WRITE) || defined(VAXC)
# define CONST_OPTION
#else
# define CONST_OPTION const
#endif
/*
* INCLUDE FILES
*/
#include "general.h" /* must always come first */
#include <stdarg.h>
#include "args.h"
#include "parse.h"
#include "strlist.h"
#include "vstring.h"
/*
* DATA DECLARATIONS
*/
typedef enum { OPTION_NONE, OPTION_SHORT, OPTION_LONG } optionType;
typedef struct sCookedArgs {
/* private */
Arguments* args;
char *shortOptions;
char simple[2];
boolean isOption;
boolean longOption;
const char* parameter;
/* public */
char* item;
} cookedArgs;
typedef enum eLocate {
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 */
} exCmd;
typedef enum sortType {
SO_UNSORTED,
SO_SORTED,
SO_FOLDSORTED
} sortType;
struct sInclude {
boolean fileNames; /* include tags for source file names */
boolean qualifiedTags; /* include tags for qualified class members */
boolean fileScope; /* include tags of file scope only */
};
struct sExtFields { /* extension field content control */
boolean access;
boolean fileScope;
boolean implementation;
boolean inheritance;
boolean kind;
boolean kindKey;
boolean kindLong;
boolean language;
boolean lineNumber;
boolean scope;
boolean signature;
boolean returnType;
boolean typeRef;
};
/* This stores the command line options.
*/
typedef struct sOptionValues {
struct sInclude include;/* --extra extra tag inclusion */
struct sExtFields extensionFields;/* --fields extension field control */
stringList* ignore; /* -I name of file containing tokens to ignore */
boolean append; /* -a append to "tags" file */
boolean backward; /* -B regexp patterns search backwards */
boolean etags; /* -e output Emacs style tags file */
exCmd locate; /* --excmd EX command used to locate tag */
boolean recurse; /* -R recurse into directories */
sortType sorted; /* -u,--sort sort tags */
boolean verbose; /* -V verbose */
boolean xref; /* -x generate xref output instead */
char *fileList; /* -L name of file containing names of files */
char *tagFileName; /* -o name of tags file */
stringList* headerExt; /* -h header extensions */
stringList* etagsInclude;/* --etags-include list of TAGS files to include*/
unsigned int tagFileFormat;/* --format tag file format (level) */
boolean if0; /* --if0 examine code within "#if 0" branch */
boolean kindLong; /* --kind-long */
langType language; /* --lang specified language override */
boolean followLinks; /* --link follow symbolic links? */
boolean filter; /* --filter behave as filter: files in, tags out */
char* filterTerminator; /* --filter-terminator string to output */
boolean tagRelative; /* --tag-relative file paths relative to tag file */
boolean printTotals; /* --totals print cumulative statistics */
boolean lineDirectives; /* --linedirectives process #line directives */
#ifdef DEBUG
long debugLevel; /* -D debugging output */
unsigned long breakLine;/* -b source line at which to call lineBreak() */
#endif
} optionValues;
/*
* GLOBAL VARIABLES
*/
extern CONST_OPTION optionValues Option;
/*
* FUNCTION PROTOTYPES
*/
extern void verbose (const char *const format, ...) __printf__ (1, 2);
extern void freeList (stringList** const pString);
extern void setDefaultTagFileName (void);
extern void checkOptions (void);
extern boolean filesRequired (void);
extern void testEtagsInvocation (void);
extern cookedArgs* cArgNewFromString (const char* string);
extern cookedArgs* cArgNewFromArgv (char* const* const argv);
extern cookedArgs* cArgNewFromFile (FILE* const fp);
extern cookedArgs* cArgNewFromLineFile (FILE* const fp);
extern void cArgDelete (cookedArgs* const current);
extern boolean cArgOff (cookedArgs* const current);
extern boolean cArgIsOption (cookedArgs* const current);
extern const char* cArgItem (cookedArgs* const current);
extern void cArgForth (cookedArgs* const current);
extern boolean isExcludedFile (const char* const name);
extern boolean isIncludeFile (const char *const fileName);
extern boolean isIgnoreToken (const char *const name, boolean *const pIgnoreParens, const char **const replacement);
extern void parseOption (cookedArgs* const cargs);
extern void parseOptions (cookedArgs* const cargs);
extern void previewFirstOption (cookedArgs* const cargs);
extern void readOptionConfiguration (void);
extern void initOptions (void);
extern void freeOptionResources (void);
#endif /* _OPTIONS_H */
/* vi:set tabstop=4 shiftwidth=4: */