4 * Copyright (c) 1998-2003, Darren Hiebert
6 * This source code is released for free distribution under the terms of the
7 * GNU General Public License.
9 * Defines external interface to option processing.
14 #if defined(OPTION_WRITE) || defined(VAXC)
17 # define CONST_OPTION const
23 #include "general.h" /* must always come first */
36 typedef enum { OPTION_NONE
, OPTION_SHORT
, OPTION_LONG
} optionType
;
38 typedef struct sCookedArgs
{
45 const char* parameter
;
50 typedef enum eLocate
{
51 EX_MIX
, /* line numbers for defines, patterns otherwise */
52 EX_LINENUM
, /* -n only line numbers in tag file */
53 EX_PATTERN
/* -N only patterns in tag file */
56 typedef enum sortType
{
63 boolean fileNames
; /* include tags for source file names */
64 boolean qualifiedTags
; /* include tags for qualified class members */
65 boolean fileScope
; /* include tags of file scope only */
68 struct sExtFields
{ /* extension field content control */
71 boolean implementation
;
81 boolean argList
; /* Write function and macro argumentlist */
84 /* This stores the command line options.
86 typedef struct sOptionValues
{
87 struct sInclude include
;/* --extra extra tag inclusion */
88 struct sExtFields extensionFields
;/* --fields extension field control */
89 stringList
* ignore
; /* -I name of file containing tokens to ignore */
90 boolean append
; /* -a append to "tags" file */
91 boolean backward
; /* -B regexp patterns search backwards */
92 boolean etags
; /* -e output Emacs style tags file */
93 exCmd locate
; /* --excmd EX command used to locate tag */
94 boolean recurse
; /* -R recurse into directories */
95 sortType sorted
; /* -u,--sort sort tags */
96 boolean verbose
; /* -V verbose */
97 boolean xref
; /* -x generate xref output instead */
98 char *fileList
; /* -L name of file containing names of files */
99 char *tagFileName
; /* -o name of tags file */
100 stringList
* headerExt
; /* -h header extensions */
101 stringList
* etagsInclude
;/* --etags-include list of TAGS files to include*/
102 unsigned int tagFileFormat
;/* --format tag file format (level) */
103 boolean if0
; /* --if0 examine code within "#if 0" branch */
104 boolean kindLong
; /* --kind-long */
105 langType language
; /* --lang specified language override */
106 boolean followLinks
; /* --link follow symbolic links? */
107 boolean filter
; /* --filter behave as filter: files in, tags out */
108 char* filterTerminator
; /* --filter-terminator string to output */
109 boolean tagRelative
; /* --tag-relative file paths relative to tag file */
110 boolean printTotals
; /* --totals print cumulative statistics */
111 boolean lineDirectives
; /* --linedirectives process #line directives */
113 long debugLevel
; /* -D debugging output */
114 unsigned long breakLine
;/* -b source line at which to call lineBreak() */
121 extern CONST_OPTION optionValues Option
;
124 * FUNCTION PROTOTYPES
126 extern void verbose (const char *const format
, ...) __printf__ (1, 2);
127 extern void freeList (stringList
** const pString
);
128 extern void setDefaultTagFileName (void);
129 extern void checkOptions (void);
130 extern boolean
filesRequired (void);
131 extern void testEtagsInvocation (void);
133 extern cookedArgs
* cArgNewFromString (const char* string
);
134 extern cookedArgs
* cArgNewFromArgv (char* const* const argv
);
135 extern cookedArgs
* cArgNewFromFile (FILE* const fp
);
136 extern cookedArgs
* cArgNewFromLineFile (FILE* const fp
);
137 extern void cArgDelete (cookedArgs
* const current
);
138 extern boolean
cArgOff (cookedArgs
* const current
);
139 extern boolean
cArgIsOption (cookedArgs
* const current
);
140 extern const char* cArgItem (cookedArgs
* const current
);
141 extern void cArgForth (cookedArgs
* const current
);
143 extern boolean
isExcludedFile (const char* const name
);
144 extern boolean
isIncludeFile (const char *const fileName
);
145 extern boolean
isIgnoreToken (const char *const name
, boolean
*const pIgnoreParens
, const char **const replacement
);
146 extern void parseOption (cookedArgs
* const cargs
);
147 extern void parseOptions (cookedArgs
* const cargs
);
148 extern void previewFirstOption (cookedArgs
* const cargs
);
149 extern void readOptionConfiguration (void);
150 extern void initOptions (void);
151 extern void freeOptionResources (void);
153 void addIgnoreListFromFile (const char *const fileName
);
155 #endif /* _OPTIONS_H */
157 /* vi:set tabstop=4 shiftwidth=4: */