2 * Copyright (c) 1998-2003, Darren Hiebert
4 * This source code is released for free distribution under the terms of the
5 * GNU General Public License version 2 or (at your option) any later version.
7 * Defines internal interface to option processing.
9 #ifndef CTAGS_MAIN_OPTIONS_PRIVATE_H
10 #define CTAGS_MAIN_OPTIONS_PRIVATE_H
12 #if defined(OPTION_WRITE)
15 # define CONST_OPTION const
21 #include "general.h" /* must always come first */
34 #define includeExtensionFlags() (Option.tagFileFormat > 1)
39 typedef enum { OPTION_NONE
, OPTION_SHORT
, OPTION_LONG
} optionType
;
41 typedef struct sCookedArgs
{
48 const char* parameter
;
53 typedef enum eLocate
{
54 EX_MIX
, /* line numbers for defines, patterns otherwise */
55 EX_LINENUM
, /* -n only line numbers in tag file */
56 EX_PATTERN
, /* -N only patterns in tag file */
57 EX_COMBINE
, /* Combine linenum and pattern with `;'*/
60 typedef enum sortType
{
66 typedef enum eTagRelative
{
73 /* This stores the command line options.
75 typedef struct sOptionValues
{
76 bool append
; /* -a append to "tags" file */
77 bool backward
; /* -B regexp patterns search backwards */
78 bool etags
; /* -e output Emacs style tags file */
79 exCmd locate
; /* --excmd EX command used to locate tag */
80 bool recurse
; /* -R recurse into directories */
81 sortType sorted
; /* -u,--sort sort tags */
82 bool xref
; /* -x generate xref output instead */
83 fmtElement
*customXfmt
; /* compiled code for --xformat=XFMT */
84 char *fileList
; /* -L name of file containing names of files */
85 char *tagFileName
; /* -o name of tags file */
86 stringList
* headerExt
; /* -h header extensions */
87 stringList
* etagsInclude
;/* --etags-include list of TAGS files to include*/
88 unsigned int tagFileFormat
;/* --format tag file format (level) */
90 char *inputEncoding
; /* --input-encoding convert text into --output-encoding */
91 char *outputEncoding
; /* --output-encoding write tags file as this encoding */
93 langType language
; /* --lang specified language override */
94 bool followLinks
; /* --link follow symbolic links? */
95 bool filter
; /* --filter behave as filter: files in, tags out */
96 char* filterTerminator
; /* --filter-terminator string to output */
97 tagRelative tagRelative
; /* --tag-relative file paths relative to tag file */
98 int printTotals
; /* --totals print cumulative statistics */
99 bool lineDirectives
; /* --line-directives process #line directives */
100 bool printLanguage
; /* --print-language */
101 bool guessLanguageEagerly
; /* --guess-language-eagerly|-G */
102 bool quiet
; /* --quiet */
103 bool fatalWarnings
; /* --_fatal-warnings */
104 unsigned int patternLengthLimit
; /* --pattern-length-limit=N */
105 bool putFieldPrefix
; /* --put-field-prefix */
106 unsigned int maxRecursionDepth
; /* --maxdepth=<max-recursion-depth> */
107 bool fieldsReset
; /* --fields=[^+-] */
108 enum interactiveMode
{ INTERACTIVE_NONE
= 0,
110 INTERACTIVE_SANDBOX
, } interactive
; /* --interactive */
112 enum filenameSepOp
{ FILENAME_SEP_NO_REPLACE
= false,
113 FILENAME_SEP_USE_SLASH
= true,
115 } useSlashAsFilenameSeparator
; /* --use-slash-as-filename-separator */
118 unsigned long breakLine
;/* -b input line at which to call lineBreak() */
123 typedef void (* mainLoopFunc
) (cookedArgs
*args
, void *data
);
129 extern CONST_OPTION optionValues Option
;
132 * FUNCTION PROTOTYPES
134 extern void freeList (stringList
** const pString
);
135 extern void setDefaultTagFileName (void);
136 extern void checkOptions (void);
137 extern bool filesRequired (void);
138 extern void testEtagsInvocation (void);
140 extern cookedArgs
* cArgNewFromString (const char* string
);
141 extern cookedArgs
* cArgNewFromArgv (char* const* const argv
);
142 extern cookedArgs
* cArgNewFromFile (FILE* const fp
);
143 extern cookedArgs
* cArgNewFromLineFile (FILE* const fp
);
144 extern void cArgDelete (cookedArgs
* const current
);
145 extern bool cArgOff (cookedArgs
* const current
);
146 extern bool cArgIsOption (cookedArgs
* const current
);
147 extern const char* cArgItem (cookedArgs
* const current
);
148 extern void cArgForth (cookedArgs
* const current
);
149 extern bool isExcludedFile (const char* const name
,
150 bool falseIfExceptionsAreDefeind
);
151 extern bool isIncludeFile (const char *const fileName
);
152 extern void parseCmdlineOptions (cookedArgs
* const cargs
);
153 extern void previewFirstOption (cookedArgs
* const cargs
);
154 extern void readOptionConfiguration (void);
155 extern void initOptions (void);
156 extern void freeOptionResources (void);
158 extern langType
getLanguageComponentInOption (const char *const option
,
159 const char *const prefix
);
160 extern langType
getLanguageComponentInOptionFull (const char *const option
,
161 const char *const prefix
, bool noPretending
);
163 extern void processLanguageDefineOption (const char *const option
, const char *const parameter
);
164 extern bool processMapOption (const char *const option
, const char *const parameter
);
165 extern bool processParamdefOption (const char *const option
, const char *const value
);
166 extern bool processParamOption (const char *const option
, const char *const value
);
167 extern bool processKinddefOption (const char *const option
, const char *const parameter
);
168 extern bool processKindsOption (const char *const option
, const char *const parameter
);
169 extern bool processExtradefOption (const char *const option
, const char *const parameter
);
170 extern bool processFielddefOption (const char *const option
, const char *const parameter
);
171 extern bool processAliasOption (const char *const option
, const char *const parameter
);
172 extern bool processTabledefOption (const char *const option
, const char *const parameter
);
174 extern bool processLanguageEncodingOption (const char *const option
, const char *const parameter
);
176 extern bool processRoledefOption (const char *const option
, const char *const parameter
);
177 extern bool processScopesepOption (const char *const option
, const char *const parameter
);
178 extern bool processPreludeOption (const char *const option
, const char *const parameter
);
179 extern bool processSequelOption (const char *const option
, const char *const parameter
);
180 extern bool processPretendOption (const char *const option
, const char *const parameter
);
181 extern bool processRolesOption (const char *const option
, const char *const parameter
);
183 extern bool isDestinationStdout (void);
185 extern void setMainLoop (mainLoopFunc func
, void *data
);
187 extern bool ptagMakePatternLengthLimit (ptagDesc
*pdesc
, langType langType
, const void *data
);
188 #endif /* CTAGS_MAIN_OPTIONS_PRIVATE_H */