49#define INVOCATION "Usage: %s [options] [file(s)]\n"
51#define CTAGS_ENVIRONMENT "CTAGS"
52#define ETAGS_ENVIRONMENT "ETAGS"
60#define EXTENSION_SEPARATOR '.'
61#define PATTERN_START '('
62#define PATTERN_STOP ')'
63#define IGNORE_SEPARATORS ", \t\n"
65#ifndef DEFAULT_FILE_FORMAT
66# define DEFAULT_FILE_FORMAT 2
69#if defined (HAVE_OPENDIR) || defined (HAVE__FINDFIRST)
70# define RECURSE_SUPPORTED
73#define isCompoundOption(c) (bool) (strchr ("fohiILpdDb", (c)) != NULL)
75#define ENTER(STAGE) do { \
76 Assert (Stage <= OptionLoadingStage##STAGE); \
77 if (Stage != OptionLoadingStage##STAGE) \
79 Stage = OptionLoadingStage##STAGE; \
80 verbose ("Entering configuration stage: loading %s\n", StageDescription[Stage]); \
83#define ACCEPT(STAGE) (1UL << OptionLoadingStage##STAGE)
101typedef const struct {
131 "h",
"H",
"hh",
"hpp",
"hxx",
"h++",
"inc",
"def",
NULL
142#ifdef MACROS_USE_PATTERNS
155 .etagsInclude =
NULL,
158 .inputEncoding=
NULL,
159 .outputEncoding =
NULL,
164 .filterTerminator =
NULL,
167 .lineDirectives =
false,
168 .printLanguage =
false,
169 .guessLanguageEagerly =
false,
171 .fatalWarnings =
false,
172 .patternLengthLimit = 96,
173 .putFieldPrefix =
false,
174 .maxRecursionDepth = 0xffffffff,
175 .interactive =
false,
177 .useSlashAsFilenameSeparator = FILENAME_SEP_UNSET,
189 .withListHeader =
true,
193#define STAGE_ANY ~0UL
200 {1,
" -? Print this option summary."},
201 {1,
" -a Append the tags to an existing tag file."},
204 {1,
" Set break line."},
206 {0,
" -B Use backward searching patterns (?...?)."},
209 {1,
" Set debug level."},
211 {1,
" -D <macro>=<definition>"},
212 {1,
" (CPreProcessor) Give definition for macro."},
213 {0,
" -e Output tag file for use with Emacs."},
215 {1,
" Write tags to specified file. Value of \"-\" writes tags to stdout"},
216 {1,
" [\"tags\"; or \"TAGS\" when -e supplied]."},
217 {0,
" -F Use forward searching patterns (/.../; default)."},
218 {1,
" -G Equivalent to --guess-language-eagerly."},
220 {1,
" Specify list of file extensions to be treated as include files"},
221 {1,
" [\".h.H.hh.hpp.hxx.h++.inc.def\"]."},
222 {1,
" -I <list|@file>"},
223 {1,
" A list of tokens to be specially handled is read from either the"},
224 {1,
" command line or the specified file."},
226 {1,
" A list of input file names is read from the specified file."},
227 {1,
" If specified as \"-\", then standard input is read."},
228 {0,
" -n Equivalent to --excmd=number."},
229 {0,
" -N Equivalent to --excmd=pattern."},
230 {1,
" -o Alternative for -f."},
231#ifdef RECURSE_SUPPORTED
232 {1,
" -R Equivalent to --recurse."},
234 {1,
" -R Not supported on this platform."},
236 {0,
" -u Equivalent to --sort=no."},
237 {1,
" -V Equivalent to --verbose."},
238 {1,
" -x Print a tabular cross reference file to standard output."},
239 {1,
" --alias-<LANG>=[+|-]aliasPattern"},
240 {1,
" Add a pattern detecting a name, can be used as an alternative name"},
242 {1,
" --append=[yes|no]"},
243 {1,
" Should tags should be appended to existing tag file [no]?"},
244 {1,
" --etags-include=file"},
245 {1,
" Include reference to 'file' in Emacs-style tag file (requires -e)."},
246 {1,
" --exclude=pattern"},
247 {1,
" Exclude files and directories matching 'pattern'."},
248 {1,
" See also --exclude-exception option."},
249 {1,
" --exclude-exception=pattern"},
250 {1,
" Don't exclude files and directories matching 'pattern' even if"},
251 {1,
" they match the pattern specified with --exclude option."},
252 {0,
" --excmd=number|pattern|mix|combine"},
253#ifdef MACROS_USE_PATTERNS
254 {0,
" Uses the specified type of EX command to locate tags [pattern]."},
256 {0,
" Uses the specified type of EX command to locate tags [mix]."},
258 {1,
" --extras=[+|-]flags"},
259 {1,
" Include extra tag entries for selected information (flags: \"fFgpqrs\") [F]."},
260 {1,
" --extras-<LANG|all>=[+|-]flags"},
261 {1,
" Include <LANG> own extra tag entries for selected information"},
262 {1,
" (flags: see the output of --list-extras=<LANG> option)."},
263 {1,
" --fields=[+|-]flags"},
264 {1,
" Include selected extension fields (flags: \"aCeEfFikKlmnNpPrRsStxzZ\") [fks]."},
265 {1,
" --fields-<LANG|all>=[+|-]flags"},
266 {1,
" Include selected <LANG> own extension fields"},
267 {1,
" (flags: see the output of --list-fields=<LANG> option)."},
268 {1,
" --filter=[yes|no]"},
269 {1,
" Behave as a filter, reading file names from standard input and"},
270 {1,
" writing tags to standard output [no]."},
271 {1,
" --filter-terminator=string"},
272 {1,
" Specify string to print to stdout following the tags for each file"},
273 {1,
" parsed when --filter is enabled."},
274 {0,
" --format=level"},
275#if DEFAULT_FILE_FORMAT == 1
276 {0,
" Force output of specified tag file format [1]."},
278 {0,
" Force output of specified tag file format [2]."},
280 {1,
" --guess-language-eagerly"},
281 {1,
" Guess the language of input file more eagerly"},
282 {1,
" (but taking longer time for guessing):"},
283 {1,
" o shebang, even if the input file is not executable,"},
284 {1,
" o emacs mode specification at the beginning and end of input file, and"},
285 {1,
" o vim syntax specification at the end of input file."},
287 {1,
" Print this option summary."},
289 {1,
" Print this option summary including experimental features."},
290 {1,
" --if0=[yes|no]"},
291 {1,
" Should code within #if 0 conditional branches be parsed [no]?"},
293 {1,
" --input-encoding=encoding"},
294 {1,
" Specify encoding of all input files."},
295 {1,
" --input-encoding-<LANG>=encoding"},
296 {1,
" Specify encoding of the LANG input files."},
298 {1,
" --kinddef-<LANG>=letter,name,desc"},
299 {1,
" Define new kind for <LANG>."},
300 {1,
" --kinds-<LANG>=[+|-]kinds, or"},
301 {1,
" Enable/disable tag kinds for language <LANG>."},
302 {1,
" --langdef=name"},
303 {1,
" Define a new language to be parsed with regular expressions."},
304 {1,
" --langmap=map(s)"},
305 {1,
" Override default mapping of language to input file extension."},
306 {1,
" --language-force=language"},
307 {1,
" Force all files to be interpreted using specified language."},
308 {1,
" --languages=[+|-]list"},
309 {1,
" Restrict files scanned for tags to those mapped to languages"},
310 {1,
" specified in the comma-separated 'list'. The list can contain any"},
311 {1,
" built-in or user-defined language [all]."},
313 {1,
" Print details of software license."},
314 {0,
" --line-directives=[yes|no]"},
315 {0,
" Should #line directives be processed [no]?"},
316 {1,
" --links=[yes|no]"},
317 {1,
" Indicate whether symbolic links should be followed [yes]."},
318 {1,
" --list-aliases=[language|all]"},
319 {1,
" Output list of alias patterns."},
320 {1,
" --list-excludes"},
321 {1,
" Output list of exclude patterns for excluding files/directories."},
322 {1,
" --list-extras=[language|all]"},
323 {1,
" Output list of extra tag flags."},
324 {1,
" --list-features"},
325 {1,
" Output list of compiled features."},
326 {1,
" --list-fields=[language|all]"},
327 {1,
" Output list of fields."},
328 {1,
" --list-kinds=[language|all]"},
329 {1,
" Output a list of all tag kinds for specified language or all."},
330 {1,
" --list-kinds-full=[language|all]"},
331 {1,
" List the details of all tag kinds for specified language or all"},
332 {1,
" For each line, associated language name is printed when \"all\" is"},
333 {1,
" specified as language."},
334 {1,
" --list-languages"},
335 {1,
" Output list of supported languages."},
336 {1,
" --list-map-extensions=[language|all]"},
337 {1,
" Output list of language extensions in mapping."},
338 {1,
" --list-map-patterns=[language|all]"},
339 {1,
" Output list of language patterns in mapping."},
340 {1,
" --list-maps=[language|all]"},
341 {1,
" Output list of language mappings(both extensions and patterns)."},
342 {1,
" --list-mline-regex-flags"},
343 {1,
" Output list of flags which can be used in a multiline regex parser definition."},
344 {1,
" --list-params=[language|all]"},
345 {1,
" Output list of language parameters. This works with --machinable."},
346 {0,
" --list-pseudo-tags"},
347 {0,
" Output list of pseudo tags."},
348 {1,
" --list-regex-flags"},
349 {1,
" Output list of flags which can be used in a regex parser definition."},
350 {1,
" --list-roles=[[language|all].[kindspecs|*]]"},
351 {1,
" Output list of all roles of tag kind(s) specified for language(s)."},
352 {1,
" Both letters and names can be used in kindspecs."},
353 {1,
" e.g. --list-roles=C.{header}d"},
354 {1,
" --list-subparsers=[baselang|all]"},
355 {1,
" Output list of subparsers for the base language."},
356 {1,
" --machinable=[yes|no]"},
357 {1,
" Use tab separated representation in --list- option output. [no]"},
358 {1,
" --list-{aliases,extras,features,fields,kind-full,langdef-flags,params," },
359 {1,
" pseudo-tags,regex-flags,roles,subparsers} support this option."},
360 {1,
" Suitable for scripting. Specify before --list-* option."},
361 {1,
" --map-<LANG>=[+|-]extension|pattern"},
362 {1,
" Set, add(+) or remove(-) the map for <LANG>."},
363 {1,
" Unlike --langmap, this doesn't take a list; only one file name pattern"},
364 {1,
" or one file extension can be specified at once."},
365 {1,
" Unlike --langmap the change with this option affects mapping of <LANG> only."},
367#ifdef RECURSE_SUPPORTED
368 {1,
" Specify maximum recursion depth."},
370 {1,
" Not supported on this platform."},
372 {1,
" --mline-regex-<LANG>=/line_pattern/name_pattern/[flags]"},
373 {1,
" Define multiline regular expression for locating tags in specific language."},
374 {1,
" --options=path"},
375 {1,
" Specify file(or directory) from which command line options should be read."},
376 {1,
" --options-maybe=path"},
377 {1,
" Do the same as --options but this doesn't make an error for non-existing file."},
378 {1,
" --optlib-dir=[+]DIR"},
379 {1,
" Add or set DIR to optlib search path."},
381 {1,
" --output-encoding=encoding"},
382 {1,
" The encoding to write the tag file in. Defaults to UTF-8 if --input-encoding"},
383 {1,
" is specified, otherwise no conversion is performed."},
385 {0,
" --output-format=u-ctags|e-ctags|etags|xref"
390 {0,
" Specify the output format. [u-ctags]"},
391 {1,
" --param-<LANG>:name=argument"},
392 {1,
" Set <LANG> specific parameter. Available parameters can be listed with --list-params."},
393 {0,
" --pattern-length-limit=N"},
394 {0,
" Cutoff patterns of tag entries after N characters. Disable by setting to 0. [96]"},
395 {0,
" --print-language"},
396 {0,
" Don't make tags file but just print the guessed language name for"},
398 {0,
" --pseudo-tags=[+|-]ptag"},
399 {0,
" --pseudo-tags=*"},
400 {0,
" Enable/disable emitting pseudo tag named ptag."},
401 {0,
" if * is given, enable emitting all pseudo tags."},
402 {0,
" --put-field-prefix"},
403 {0,
" Put \"" CTAGS_FIELD_PREFIX "\" as prefix for the name of fields newly introduced in"},
404 {0,
" universal-ctags."},
405 {1,
" --quiet=[yes|no]"},
406 {0,
" Don't print NOTICE class messages [no]."},
407 {1,
" --recurse=[yes|no]"},
408#ifdef RECURSE_SUPPORTED
409 {1,
" Recurse into directories supplied on command line [no]."},
411 {1,
" Not supported on this platform."},
413 {1,
" --regex-<LANG>=/line_pattern/name_pattern/[flags]"},
414 {1,
" Define regular expression for locating tags in specific language."},
415 {1,
" --roles-<LANG>.kind=[+|-]role, or"},
416 {1,
" Enable/disable tag roles for kinds of language <LANG>."},
417 {0,
" --sort=[yes|no|foldcase]"},
418 {0,
" Should tags be sorted (optionally ignoring case) [yes]?"},
419 {0,
" --tag-relative=[yes|no|always|never]"},
420 {0,
" Should paths be relative to location of tag file [no; yes when -e]?"},
421 {0,
" always: be relative even if input files are passed in with absolute paths" },
422 {0,
" never: be absolute even if input files are passed in with relative paths" },
423 {1,
" --totals=[yes|no|extra]"},
424 {1,
" Print statistics about input and tag files [no]."},
426 {1,
" --use-slash-as-filename-separator=[yes|no]"},
427 {1,
" Use slash as filename separator [yes] for u-ctags output format."},
429 {1,
" --verbose=[yes|no]"},
430 {1,
" Enable verbose messages describing actions on each input file."},
432 {1,
" Print version identifier to standard output."},
433 {1,
" --with-list-header=[yes|no]"},
434 {1,
" Prepend the column descriptions in --list- output. [yes]"},
435 {1,
" --list-{aliases,extras,features,fields,kind-full,langdef-flags,params," },
436 {1,
" pseudo-tags,regex-flags,roles,subparsers} support this option."},
437 {1,
" Specify before --list-* option."},
442 {1,
" --_anonhash=fname"},
443 {1,
" Used in u-ctags test harness"},
444 {1,
" --_dump-keywords"},
445 {1,
" Dump keywords of initialized parser(s)."},
446 {1,
" --_dump-options"},
447 {1,
" Dump options."},
449 {1,
" Echo MSG to standard error. Useful to debug the chain"},
450 {1,
" of loading option files."},
451 {1,
" --_extradef-<LANG>=name,desc"},
452 {1,
" Define new extra for <LANG>. \"--extras-<LANG>=+{name}\" enables it."},
453 {1,
" --_fatal-warnings"},
454 {1,
" Make all warnings fatal."},
455 {1,
" --_fielddef-<LANG>=name,description"},
456 {1,
" EXPERIMENTAL, Define new field for <LANG>."},
457 {1,
" --_force-initializing"},
458 {1,
" Initialize all parsers in early stage"},
459 {1,
" --_force-quit=[num]"},
460 {1,
" Quit when the option is processed. Useful to debug the chain"},
461 {1,
" of loading option files."},
468 {0,
" Enter interactive mode (json over stdio)."},
470 {0,
" Enter file I/O limited interactive mode if sandbox is specified. [default]"},
473 {1,
" --_list-kinddef-flags"},
474 {1,
" Output list of flags which can be used with --kinddef option."},
475 {1,
" --_list-langdef-flags"},
476 {1,
" Output list of flags which can be used with --langdef option."},
477 {1,
" --_list-mtable-regex-flags"},
478 {1,
" Output list of flags which can be used in a multitable regex parser definition."},
479 {1,
" --_mtable-extend-<LANG>=disttable+srctable."},
480 {1,
" Copy patterns of a regex table to another regex table."},
481 {1,
" --_mtable-regex-<LANG>=table/line_pattern/name_pattern/[flags]"},
482 {1,
" Define multitable regular expression for locating tags in specific language."},
483 {1,
" --_pretend-<NEWLANG>=<OLDLANG>"},
484 {1,
" Make NEWLANG parser pretend OLDLANG parser in lang: field."},
485 {1,
" --_roledef-<LANG>.kind=role_name,role_desc"},
486 {1,
" Define new role for the kind in <LANG>."},
487 {1,
" --_scopesep-<LANG>=[parent_kind_letter]/child_kind_letter:separator"},
488 {1,
" Specify scope separator between <PARENT_KIND> and <KIND>."},
489 {1,
" * as a kind letter matches any kind."},
490 {1,
" --_tabledef-<LANG>=name"},
491 {1,
" Define new regex table for <LANG>."},
493 {1,
" --_trace=list"},
494 {1,
" Trace parsers for the languages."},
496 {1,
" --_xformat=field_format"},
497 {1,
" Specify custom format for tabular cross reference (-x)."},
498 {1,
" Fields can be specified with letter listed in --list-fields."},
499 {1,
" e.g. --_xformat=%10N %10l:%K @ %-20F:%-20n"},
504"This program is free software; you can redistribute it and/or\n"
505"modify it under the terms of the GNU General Public License\n"
506"as published by the Free Software Foundation; either version 2"
507"of the License, or (at your option) any later version.\n"
510"This program is distributed in the hope that it will be useful,\n"
511"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
512"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
513"GNU General Public License for more details.\n"
515"You should have received a copy of the GNU General Public License\n"
516"along with this program; if not, write to the Free Software\n"
517"Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.\n";
527 {
"win32",
"TO BE WRITTEN"},
530 {
"wildcards",
"can use glob matching"},
531 {
"regex",
"can use regular expression based pattern matching"},
534 {
"internal-sort",
"uses internal sort routine instead of invoking sort command"},
536#ifdef CUSTOM_CONFIGURATION_FILE
537 {
"custom-conf",
"read \"" CUSTOM_CONFIGURATION_FILE
"\" as config file"},
540 {
"unix-path-separator",
"can use '/' as file name separator"},
543 {
"iconv",
"can convert input/output encodings"},
546 {
"debug",
"TO BE WRITTEN"},
548#if defined (HAVE_DIRENT_H) || defined (_MSC_VER)
549 {
"option-directory",
"TO BE WRITTEN"},
552 {
"xpath",
"linked with library for parsing xml input"},
555 {
"json",
"supports json format output"},
556 {
"interactive",
"accepts source code from stdin"},
559 {
"sandbox",
"linked with code for system call level sandbox"},
562 {
"yaml",
"linked with library for parsing yaml input"},
564#ifdef CASE_INSENSITIVE_FILENAMES
565 {
"case-insensitive-filenames",
"TO BE WRITTEN"},
568 {
"gcov",
"linked with code for coverage analysis"},
572 {
"packcc",
"has peg based parser(s)"},
597static bool getBooleanOption (
const char *
const option,
const char *
const parameter);
609_CRTIMP
int _vscprintf(
const char *
format, va_list argptr);
613#define va_copy(dest, src) (dest = src)
631 length = _vscprintf(fmt, args_copy);
634 length = vsnprintf(&
dummy,
sizeof dummy, fmt, args_copy);
642 *strp = malloc(size);
648 vsnprintf(*strp, size, fmt, args);
661 vfprintf (stderr,
format, ap);
673 vfprintf (stderr,
format, ap);
675 fputs (
"\n", stderr);
690 if (*pString !=
NULL)
744 notice =
"append mode is not compatible with";
763 const char *
const prefix,
772 Assert (prefix && prefix[0]);
775 prefix_len = strlen (prefix);
776 if (strncmp (option, prefix, prefix_len) != 0)
780 lang = option + prefix_len;
781 if (lang [0] ==
'\0')
788 sep = strpbrk (lang,
":.");
790 lang_len = sep - lang;
794 const char *langName = (lang_len == 0)? lang:
eStrndup (lang, lang_len);
795 error (
FATAL,
"Unknown language \"%s\" in \"%s\" option", langName, option);
802 const char *
const prefix)
821#ifdef CASE_INSENSITIVE_FILENAMES
827 verbose (
"Running in etags mode\n");
841static void setJsonMode (
void)
879 const char*
const equal = strchr (item,
'=');
904 if (strncmp (item,
"--", (
size_t) 2) == 0)
912 else if (*item ==
'-')
999 return current->
item;
1034 char *
const extensionList =
eStrdup (elist);
1035 const char *extension =
NULL;
1044 if (elist !=
NULL && *elist !=
'\0')
1046 extension = extensionList;
1050 while (extension !=
NULL)
1053 if (separator !=
NULL)
1055 verbose (
"%s%s", first ?
"" :
", ",
1056 *extension ==
'\0' ?
"(NONE)" : extension);
1059 if (separator ==
NULL)
1062 extension = separator + 1;
1066 fprintf (vfp,
"\n now: ");
1094 const char *errWhat,
const char *errCategory)
1098 if (value [0] ==
'\0')
1105 error (
FATAL,
"Invalid value for \"%s\" %s", errWhat, errCategory);
1116 bool result =
false;
1128 const char *
const option,
const char *
const parameter)
1131 error (
FATAL,
"Etags must be enabled to use \"%s\" option", option);
1143 stringList**
list,
const char *
const optname,
const char *
const parameter)
1145 const char *
const fileName = parameter + 1;
1146 if (parameter [0] ==
'\0')
1148 else if (parameter [0] ==
'@')
1157 verbose (
" adding %s patterns from %s\n", optname, fileName);
1168 verbose (
" adding %s pattern: %s\n", optname, parameter);
1173 const char *
const option,
const char *
const parameter)
1179 const char *
const option,
const char *
const parameter)
1185 bool falseIfExceptionsAreDefeind)
1188 bool result =
false;
1190 if (falseIfExceptionsAreDefeind
1198 if (! result &&
name != base)
1204 bool result_exception;
1207 if (! result_exception &&
name != base)
1210 if (result_exception)
1217 const char *
const option,
const char *
const parameter)
1225 if (strcmp(parameter,
"combine") == 0)
1228 error (
FATAL,
"Invalid value for \"%s\" option: %s", option, parameter);
1242 const char *
const option,
const char *
const parameter)
1245 const char *p = parameter;
1249 bool inLongName =
false;
1252 if (strcmp (option,
"extra") == 0)
1253 error(
WARNING,
"--extra option is obsolete; use --extras instead");
1260 else if (*p !=
'+' && *p !=
'-')
1265 while ((c = *p++) !=
'\0')
1284 "unexpected character in extra specification: \'%c\'",
1291 "unexpected character in extra specification: \'%c\'",
1297 error(
WARNING,
"Unsupported parameter '{%s}' for \"%s\" option",
1312 error(
WARNING,
"Unsupported parameter '%c' for \"%s\" option",
1332 const char *
const option,
const char *
const parameter)
1334 const char *p = parameter;
1340 bool inLongName =
false;
1349 else if (*p !=
'+' && *p !=
'-')
1352 while ((c = *p++) !=
'\0')
switch (c)
1369 "unexpected character in field specification: \'%c\'",
1376 "unexpected character in field specification: \'%c\'",
1399 error(
WARNING,
"Unsupported parameter '%c' for \"%s\" option",
1416 const char *
const option,
const char *
const parameter)
1420 if (sscanf (parameter,
"%u", &
format) < 1)
1421 error (
FATAL,
"Invalid value for \"%s\" option",option);
1425 error (
FATAL,
"Unsupported value for \"%s\" option", option);
1429static void processInputEncodingOption(
const char *
const option
CTAGS_ATTR_UNUSED,
1430 const char *
const parameter)
1432 if (
Option.inputEncoding)
1436 if (!
Option.outputEncoding)
1442static void processOutputEncodingOption(
const char *
const option
CTAGS_ATTR_UNUSED,
1443 const char *
const parameter)
1445 if (
Option.outputEncoding)
1462 puts (optDesc [i].description);
1480 for (i = 0; i <
max; ++i)
1504 printf (
" Optional compiled features: ");
1506 printf (
"%s+%s", (i>0 ?
", " :
""),
Features [i].
name);
1507#ifdef CUSTOM_CONFIGURATION_FILE
1509 printf (
"=%s", CUSTOM_CONFIGURATION_FILE);
1551 const char *
const parameter)
1570 error (
FATAL,
"Unknown language \"%s\" in \"%s\" option", parameter, option);
1585 printf (
"%s %s, %s %s\n",
1589 printf (
"%s %s(%s), %s %s\n",
1592 printf (
"Universal Ctags is derived from Exuberant Ctags.\n");
1593 printf (
"Exuberant Ctags 5.8, Copyright (C) 1996-2009 Darren Hiebert\n");
1595 printf (
" Compiled: %s, %s\n", __DATE__, __TIME__);
1604 bool includingExperimentalOptions)
1611 if (includingExperimentalOptions)
1616 const char *
const option,
1617 const char *
const parameter)
1624 const char *
const option,
1625 const char *
const parameter)
1632static void processInteractiveOption (
1634 const char *
const parameter)
1639 if (parameter && (strcmp (parameter,
"sandbox") == 0))
1642 args.sandbox =
true;
1644 else if (parameter && (strcmp (parameter,
"default") == 0))
1647 args.sandbox =
false;
1649 else if ((!parameter) || *parameter ==
'\0')
1652 args.sandbox =
false;
1655 error (
FATAL,
"Unknown option argument \"%s\" for --%s option",
1660 error (
FATAL,
"sandbox submode is not supported on this platform");
1665 error (
FATAL,
"sandbox submode does not work if gcov is instrumented");
1679 const char *
const parameter)
1683 const char *arg = if0?
"true":
"false";
1689 const char *
const option,
const char *
const parameter)
1697 if (strcmp (option,
"lang") == 0 || strcmp (option,
"language") == 0)
1699 "\"--%s\" option is obsolete; use \"--language-force\" instead",
1702 error (
FATAL,
"Unknown language \"%s\" in \"%s\" option", parameter, option);
1721 char* (* skip) (
char *))
1724 const char first = *parameter;
1733 p = (* skip) (parameter);
1737 *
tail = parameter + strlen (parameter);
1755 for (p = parameter ; *p !=
PATTERN_STOP && *p !=
'\0' ; ++p)
1761 error (
FATAL,
"Unterminated file name pattern for %s language",
1778 bool exclusiveInAllLanguages)
1785 if (map && pattern_p ==
false)
1787 else if (map && pattern_p ==
true)
1790 error (
FATAL,
"Badly formed language map for %s language",
1805 if (map && pattern_p ==
false)
1807 else if (map && pattern_p ==
true)
1810 error (
FATAL,
"Badly formed language map for %s language",
1820 char*
const separator = strchr (map,
':');
1821 char* result =
NULL;
1822 if (separator !=
NULL)
1825 char *
list = separator + 1;
1837 for (p =
list ; *p !=
',' && *p !=
'\0' ; ++p) ;
1838 if ((
size_t) (p -
list) == strlen (deflt) &&
1867 const char *
const option,
const char *
const parameter)
1869 char *
const maps =
eStrdup (parameter);
1874 verbose (
" Restoring default language maps:\n");
1877 else while (map !=
NULL && *map !=
'\0')
1881 error (
WARNING,
"Unknown language \"%s\" in \"%s\" option", parameter, option);
1888 const char *
const option,
const char *
const parameter)
1890 char *
const langs =
eStrdup (parameter);
1891 enum { Add, Remove, Replace } mode = Replace;
1894 const char* prefix =
"";
1895 verbose (
" Enabled languages: ");
1896 while (lang !=
NULL)
1898 char *
const end = strchr (lang,
',');
1899 if (lang [0] ==
'+')
1905 else if (lang [0] ==
'-')
1911 if (mode == Replace)
1915 if (lang [0] !=
'\0')
1923 error (
WARNING,
"Unknown language \"%s\" in \"%s\" option", lang, option);
1927 verbose (
"%s%s%s", (first ?
"" :
", "), prefix, lang);
1930 if (mode == Replace)
1933 lang = (end !=
NULL ? end + 1 :
NULL);
1940 const char *
const option,
const char *
const parameter)
1944 char* map_parameter;
1952 if (parameter ==
NULL || parameter [0] ==
'\0')
1953 error (
FATAL,
"no parameter is given for %s", option);
1956 if (*spec ==
'+' || *spec ==
'-')
1974 verbose (
" %s %s %s %s language map:",
1975 op ==
'+'?
"Adding":
"Removing",
1977 op ==
'+'?
"to":
"from",
1979 map_parameter =
eStrdup (spec);
1988 eFree (map_parameter);
1995 const char *
const option,
const char *
const value)
2005 sep = option + strlen (
"param-") + strlen (
getLanguageName (language));
2007 error (
FATAL,
"no separator(:) is given for %s=%s", option, value);
2010 if (value ==
NULL || value [0] ==
'\0')
2011 error (
FATAL,
"no parameter is given for %s", option);
2030 const char *
const option,
const char *
const parameter)
2039 error (
FATAL,
"Unknown language \"%s\" in \"%s\" option", parameter, option);
2067 error (
FATAL,
"Unknown language \"%s\" in \"%s\" option", parameter, option);
2079 const char *
const option,
const char *
const parameter)
2081 bool print_all = (strcmp (option,
"list-kinds-full") == 0)?
true:
false;
2090 error (
FATAL,
"Unknown language \"%s\" in \"%s\" option", parameter, option);
2099 const char *
const parameter)
2109 error (
FATAL,
"Unknown language \"%s\" in \"%s\" option", parameter, option);
2120 const char *
const parameter,
2131 error (
FATAL,
"Unknown language \"%s\" in \"%s\" option", parameter, option);
2141 const char *
const parameter)
2147 const char *
const parameter)
2216 const char *
const parameter)
2219 const char *kindspecs;
2223 if (parameter ==
NULL || parameter[0] ==
'\0')
2232 sep = strchr (parameter,
'.');
2234 if (sep ==
NULL || sep [1] ==
'\0')
2242 kindspecs = sep + 1;
2243 if (strncmp (parameter,
"all.", 4) == 0
2246 || strncmp (parameter,
".", 1) == 0)
2253 const char *langName =
eStrndup (parameter, sep - parameter);
2254 error (
FATAL,
"Unknown language \"%s\" in \"%s\"", langName, option);
2265 const char *
const parameter)
2270 if (parameter ==
NULL || parameter[0] ==
'\0'
2281 error (
FATAL,
"Unknown language \"%s\" in \"%s\"", parameter, option);
2297 bool (* check) (
const char *
const))
2306 if ((* check) (tmp))
2325 const char *
const option,
const char *
const parameter,
2326 bool allowNonExistingFile)
2332 if (parameter [0] ==
'\0')
2333 error (
FATAL,
"no option file supplied for \"%s\"", option);
2335 if (parameter [0] !=
'/' && parameter [0] !=
'.')
2343 status =
eStat (path);
2346 if (!allowNonExistingFile)
2366 const char *
const option,
const char *
const parameter)
2372 const char *
const option,
const char *
const parameter)
2378 const char *
const parameter)
2380 if (parameter [0] ==
'\0')
2381 error (
FATAL,
"no output format name supplied for \"%s\"", option);
2383 if (strcmp (parameter,
"u-ctags") == 0)
2385 else if (strcmp (parameter,
"e-ctags") == 0)
2387 else if (strcmp (parameter,
"etags") == 0)
2389 else if (strcmp (parameter,
"xref") == 0)
2392 else if (strcmp (parameter,
"json") == 0)
2396 error (
FATAL,
"unknown output format name supplied for \"%s=%s\"", option, parameter);
2400 const char *
const parameter)
2402 const char *p = parameter;
2407 if (*p ==
'\0' || !strchr (
"*+-", *p))
2409 for (
unsigned int i = 0; i <
PTAG_COUNT; i++)
2440 const char *origin = p;
2443 while (*p !=
'\0' && *p !=
'}')
2449 error (
FATAL,
"curly bracket specifying a pseudo tags is unbalanced: %s",
2470 const char *
const option,
const char *
const parameter)
2474 else if (
isTrue (parameter))
2481 error (
FATAL,
"Invalid value for \"%s\" option", option);
2485 const char *
const option,
const char *
const parameter)
2489 else if (
isTrue (parameter) || *parameter ==
'\0')
2491 else if (
strcasecmp (parameter,
"always") == 0)
2493 else if (
strcasecmp (parameter,
"never") == 0)
2496 error (
FATAL,
"Invalid value for \"%s\" option", option);
2500 const char *
const option,
const char *
const parameter)
2504 else if (
isTrue (parameter) || *parameter ==
'\0')
2506 else if (
strcasecmp (parameter,
"extra") == 0)
2509 error (
FATAL,
"Invalid value for \"%s\" option", option);
2518 fprintf (vfp,
" Setting default header extensions: ");
2532 if (strcmp (parameter,
"default") == 0)
2538 if (parameter [0] ==
'+')
2545 verbose (
" Header Extensions:\n");
2559 while (token !=
NULL)
2591 if (IgnoreOrDefine ==
'D')
2593 else if (strchr (
"@./\\",
list [0]) !=
NULL)
2595 const char* fileName = (*
list ==
'@') ?
list + 1 :
list;
2599 else if (isalpha (
list [0]) &&
list [1] ==
':')
2602 else if (strcmp (
list,
"-") == 0)
2610 if (parameter ==
NULL || parameter[0] ==
'\0')
2611 error (
FATAL,
"Something string is needed for \"%s\" option", option);
2615 printf(
"%s\n", buf);
2626 if (parameter ==
NULL || parameter[0] ==
'\0')
2627 error (
FATAL,
"Something message is needed for \"%s\" option", option);
2628 notice (
"%s", parameter);
2634 verbose (
"force initializing all built-in parsers\n");
2639 const char *
const parameter)
2642 if (parameter ==
NULL || parameter[0] ==
'\0' || !
strToInt(parameter, 0, &s))
2657 const char *
const parameter)
2659 const char *langs =
eStrdup (parameter);
2660 const char *lang = langs;
2664 while (lang !=
NULL)
2674 char *
const end = strchr (lang,
',');
2681 error (
WARNING,
"Unknown language \"%s\" in \"%s\" option", lang, option);
2684 traceLanguage (language);
2685 verbose (
"Enable tracing language: %s\n", lang);
2688 lang = (end !=
NULL ? end + 1 :
NULL);
2690 eFree ((
char *)langs);
2695 const char *
const parameter)
2707 if (report_in_verbose)
2708 verbose (
"Prepend %s to %s\n",
2709 dir,
"OptlibPathList");
2717 if (report_in_verbose)
2718 verbose (
"Reset OptlibPathList\n");
2723 const char *
const option,
const char *
const parameter)
2730 if (parameter[0] ==
'\0')
2732 else if (parameter[0] ==
'+')
2734 path = parameter + 1;
2735 if (path[0] ==
'\0')
2749 if (parameter ==
NULL || parameter[0] ==
'\0')
2750 error (
FATAL,
"A parameter is needed after \"%s\" option", option);
2752 if (atol (parameter) < 1)
2753 error (
FATAL,
"-%s: Invalid maximum recursion depth", option);
2760 if (parameter ==
NULL || parameter[0] ==
'\0')
2761 error (
FATAL,
"A parameter is needed after \"%s\" option", option);
2764 error (
FATAL,
"-%s: Invalid pattern length limit", option);
2784 if (strcmp (option->
name,
"file-tags") == 0)
2786 else if (strcmp (option->
name,
"file-scope") == 0)
2790 error (
WARNING,
"\"--%s\" option is obsolete; use \"--extras=%c%c\" instead",
2791 option->
name, value?
'+':
'-', x);
2817 {
"input-encoding", processInputEncodingOption,
false,
STAGE_ANY },
2818 {
"output-encoding", processOutputEncodingOption,
false,
STAGE_ANY },
2862 {
"_interactive", processInteractiveOption,
true,
STAGE_ANY },
2868 {
"_trace", processTraceOption,
false,
STAGE_ANY },
2885#ifdef RECURSE_SUPPORTED
2890 {
"use-slash-as-filename-separator", (
bool *)&
Option.useSlashAsFilenameSeparator,
false,
STAGE_ANY },
2903 error (
FATAL,
"-%s%s option may not follow a file name", longOption?
"-":
"", option);
2907 const char *
const option,
const char *
const parameter)
2913 for (i = 0 ; i <
count && ! found ; ++i)
2916 if (strcmp (option,
entry->name) == 0)
2919 if (!(
entry->acceptableStages & (1UL <<
Stage)))
2925 if (
entry->initOnly)
2927 (
entry->handler) (option, parameter);
2934 const char *
const option,
const char *
const parameter)
2940 const char *
const option,
const char *
const parameter)
2946 for (i = 0 ; i <
count && ! found ; ++i)
2949 if (strcmp (option,
entry->name) == 0)
2952 if (!(
entry->acceptableStages & (1UL <<
Stage)))
2958 if (
entry->initOnly)
2965 *
entry->pValue = value;
3008 const char *
const parameter)
3010#define PREFIX "fields-"
3011#define PREFIX_LEN strlen(PREFIX)
3015 const char *p = parameter;
3020 bool inLongName =
false;
3026 len = strlen (lang);
3028 error (
FATAL,
"No language given in \"%s\" option", option);
3036 error (
WARNING,
"Unknown language: %s (ignoring \"--%s\")", lang, option);
3048 else if (*p ==
'{' || *p ==
'\0')
3054 else if (*p !=
'+' && *p !=
'-')
3055 error (
WARNING,
"Wrong per language field specification: %s", p);
3058 while ((c = *p++) !=
'\0')
3077 "unexpected character in field specification: \'%c\'",
3084 "unexpected character in field specification: \'%c\'",
3097 "only long name can be used in per language field spec: \'%c\'",
3108 const char *
const parameter)
3110#define PREFIX "extras-"
3111#define PREFIX_LEN strlen(PREFIX)
3115 const char *p = parameter;
3120 bool inLongName =
false;
3126 len = strlen (lang);
3129 error (
FATAL,
"No language given in \"%s\" option", option);
3137 error (
WARNING,
"Unknown language: %s (ignoring \"--%s\")", lang, option);
3149 else if (*p ==
'{' || *p ==
'\0')
3155 else if (*p !=
'+' && *p !=
'-')
3156 error (
WARNING,
"Wrong per language extra specification: %s", p);
3159 while ((c = *p++) !=
'\0')
3178 "unexpected character in extra specification: \'%c\'",
3185 "unexpected character in extra specification: \'%c\'",
3198 "only long name can be used in per language extra spec: \'%c\'",
3207 const char *
const parameter)
3221 const char *
const parameter)
3235 const char *
const parameter)
3249 const char *
const parameter)
3263 const char *
const option,
const char *
const parameter)
3268 if (parameter [0] ==
'\0')
3269 verbose (
" Option: --%s\n", option);
3271 verbose (
" Option: --%s=%s\n", option, parameter);
3306 else if (processLanguageEncodingOption (option, parameter))
3309#ifndef RECURSE_SUPPORTED
3310 else if (strcmp (option,
"recurse") == 0)
3311 error (
WARNING,
"%s option not supported on this host", option);
3322 error (
FATAL,
"Unknown option: --%s", option);
3326 const char *
const option,
const char *
const parameter)
3328 if (parameter ==
NULL || parameter [0] ==
'\0')
3329 verbose (
" Option: -%s\n", option);
3331 verbose (
" Option: -%s %s\n", option, parameter);
3334 error (
FATAL,
"Missing parameter for \"%s\" option", option);
3335 else switch (*option)
3347 if (atol (parameter) < 0)
3348 error (
FATAL,
"-%s: Invalid line number", option);
3349 Option.breakLine = atol (parameter);
3353 error (
FATAL,
"-%s: Invalid debug level", option);
3375 "-%s option specified more than once, last value used",
3379 else if (parameter [0] ==
'-' && parameter [1] !=
'\0')
3380 error (
FATAL,
"output file name may not begin with a '-'");
3399 "-%s option specified more than once, last value used",
3412#ifdef RECURSE_SUPPORTED
3415 error (
WARNING,
"-%s option not supported on this host", option);
3433 error (
FATAL,
"Unknown option: -%s", option);
3447 const char *parameter = args->
parameter;
3448 while (*parameter ==
' ')
3472 return isSameFile ((
const char*
const) userData, fileName);
3477 bool fileFound =
false;
3478 const char*
const format =
"Considering option file %s: %s\n";
3486 FILE*
const fp = fopen (fileName,
"r");
3497 error (
WARNING,
"Ignoring non-option in %s\n", fileName);
3511 if (strcmp (args->
item,
"V") == 0
3512 || strcmp (args->
item,
"verbose") == 0
3513 || strcmp (args->
item,
"quiet") == 0)
3515 else if (strcmp (args->
item,
"options") == 0 &&
3518 notice (
"No options will be read from files or environment");
3527#if defined (HAVE_DIRENT_H) || defined (_MSC_VER)
3528extern int scanDirectory (
const char *directory_name,
3529 struct dirent ***array_pointer,
int (*select_function) (
const struct dirent *),
3530 int (*compare_function) (
const struct dirent **,
const struct dirent **));
3532static void parseConfigurationFileOptionsInDirectoryWithLeafname (
const char* directory,
const char* leafname)
3539static int ignore_dot_file(
const struct dirent* dent)
3542 if (*dent->d_name ==
'.')
3548static int accept_only_dot_ctags(
const struct dirent* dent)
3553 len = strlen(dent->d_name);
3557 if (strcmp(dent->d_name + (len - 6),
".ctags") == 0)
3563static int alphaSort(
const struct dirent ** a,
3564 const struct dirent ** b)
3566 return strcmp ((*a)->d_name, (*b)->d_name);
3572 struct dirent **dents;
3575 n = scanDirectory (dirName, &dents, ignore_dot_file, alphaSort);
3579 for (i = 0; i < n; i++)
3584 if (already_loaded_files &&
stringListHas (already_loaded_files, dents[i]->d_name))
3586 else if (already_loaded_files)
3592 if (s->
exists && accept_only_dot_ctags(dents[i]))
3593 parseConfigurationFileOptionsInDirectoryWithLeafname (dirName,
3610typedef char* (* preloadMakePathFunc) (
const char*,
const char*);
3622 char *full_path =
NULL;
3624 const char*
const envval = getenv (envvar);
3625 if (envval && strlen (envval))
3644static char *getConfigAtHomeOnWindows (
const char *path,
3651 const char* homeDrive = getenv (
"HOMEDRIVE");
3652 const char* homePath = getenv (
"HOMEPATH");
3653 if (homeDrive !=
NULL && homePath !=
NULL)
3709#ifdef CUSTOM_CONFIGURATION_FILE
3711 .
path = CUSTOM_CONFIGURATION_FILE,
3712 .isDirectory =
false,
3720 .isDirectory =
true,
3727 .isDirectory =
true,
3735 .isDirectory =
true,
3736 .makePath = getConfigAtHomeOnWindows,
3743 .isDirectory =
true,
3749 .isDirectory =
true,
3766 const char *envOptions =
NULL;
3767 const char* var =
NULL;
3773 envOptions = getenv (var);
3775 if (envOptions ==
NULL)
3778 envOptions = getenv (var);
3780 if (envOptions !=
NULL && envOptions [0] !=
'\0')
3783 verbose (
"Reading options from $CTAGS\n");
3787 error (
WARNING,
"Ignoring non-option in %s variable", var);
3809 verbose (
"Setting option defaults\n");
3811 verbose (
" Installing default language mappings:\n");
3813 verbose (
" Installing default language aliases:\n");
3817 verbose (
" Installing default exclude patterns:\n");
3899 fprintf(stdout,
"# %s\n",
"ParametricOptions");
3903 fprintf(stdout,
"# %s\n",
"BooleanOptions");
3920 bool toStdout =
false;
void argDelete(Arguments *const current)
Arguments * argNewFromLineFile(FILE *const fp)
void argForth(Arguments *const current)
bool argOff(const Arguments *const current)
char * argItem(const Arguments *const current)
Arguments * argNewFromString(const char *const string)
Arguments * argNewFromFile(FILE *const fp)
Arguments * argNewFromArgv(char *const *const argv)
void colprintLineAppendColumnCString(struct colprintLine *line, const char *column)
void colprintTableSort(struct colprintTable *table, int(*compareFn)(struct colprintLine *, struct colprintLine *))
struct colprintLine * colprintTableGetNewLine(struct colprintTable *table)
void colprintTableDelete(struct colprintTable *table)
struct colprintTable * colprintTableNew(const char *columnHeader,...)
void colprintLineAppendColumnVString(struct colprintLine *line, vString *column)
void colprintTablePrint(struct colprintTable *table, unsigned int startFrom, bool withHeader, bool machinable, FILE *fp)
const char * colprintLineGetColumn(struct colprintLine *line, unsigned int column)
void setMainLoop(mainLoopFunc func, void *data)
bool writePseudoTag(const ptagDesc *desc, const char *const fileName, const char *const pattern, const char *const parserName)
void error(const errorSelection selection, const char *const format,...)
void setErrorPrinter(errorPrintFunc printer, void *data)
struct colprintTable * fieldColprintTableNew(void)
void fieldColprintAddLanguageLines(struct colprintTable *table, langType language)
bool enableField(fieldType type, bool state, bool warnIfFixedField)
fieldType getFieldTypeForOption(char letter)
fieldType nextSiblingField(fieldType type)
void fieldColprintAddCommonLines(struct colprintTable *table)
int getFieldOwner(fieldType type)
void fieldColprintTablePrint(struct colprintTable *table, bool withListHeader, bool machinable, FILE *fp)
fieldType getFieldTypeForNameAndLanguage(const char *fieldName, langType language)
enum eFieldType fieldType
fmtElement * fmtNew(const char *fmtString)
void fmtDelete(fmtElement *fmtelts)
#define CTAGS_ATTR_UNUSED
static parseNext fallback
static bool tail(const char *cp)
#define strncasecmp(s1, s2, n)
#define strcasecmp(s1, s2)
void interactiveLoop(cookedArgs *args, void *user)
bool jsonErrorPrinter(const errorSelection selection, const char *const format, va_list ap, void *data)
void dumpKeywordTable(FILE *fp)
void printMultitableRegexFlags(bool withListHeader, bool machinable, FILE *fp)
void printRegexFlags(bool withListHeader, bool machinable, FILE *fp)
void printMultilineRegexFlags(bool withListHeader, bool machinable, FILE *fp)
#define ETAGS_ENVIRONMENT
stringList searchPathList
static bool parseFileOptions(const char *const fileName)
static void freeString(char **const pString)
static void installHeaderListDefaults(void)
static char * processLanguageMap(char *map)
static bool parseAllConfigurationFilesOptionsInDirectory(const char *const fileName, stringList *const already_loaded_files)
static void processListSubparsersOptions(const char *const option, const char *const parameter)
static void processListPseudoTagsOptions(const char *const option, const char *const parameter)
static void readIgnoreList(const char *const list)
static vString * expandOnSearchPathList(searchPathList *pathList, const char *leaf, bool(*check)(const char *const))
static bool NonOptionEncountered
static void processListLanguagesOption(const char *const option, const char *const parameter)
#define va_copy(dest, src)
int asprintf(char **strp, const char *fmt,...)
cookedArgs * cArgNewFromArgv(char *const *const argv)
static void setEtagsMode(void)
const struct sBooleanOption booleanOption
static void checkOptionOrder(const char *const option, bool longOption)
const char * cArgItem(cookedArgs *const current)
static const char *const License2
static void processListRegexFlagsOptions(const char *const option, const char *const parameter)
static optionDescription LongOptionDescription[]
bool cArgOff(cookedArgs *const current)
langType getLanguageComponentInOptionFull(const char *const option, const char *const prefix, bool noPretending)
static bool SkipConfiguration
void parseCmdlineOptions(cookedArgs *const args)
#define CTAGS_ENVIRONMENT
static void processSortOption(const char *const option, const char *const parameter)
static bool isTrue(const char *parameter)
bool canUseLineNumberAsLocator(void)
static void processDumpKeywordsOption(const char *const option, const char *const parameter)
static void processExcludeOptionCommon(stringList **list, const char *const optname, const char *const parameter)
static void processFieldsOption(const char *const option, const char *const parameter)
static bool processMultitableRegexOption(const char *const option, const char *const parameter)
static void processListMapPatternsOption(const char *const option, const char *const parameter)
static void processHeaderListOption(const int option, const char *parameter)
void testEtagsInvocation(void)
void freeList(stringList **const pList)
static void processListMultitableRegexFlagsOptions(const char *const option, const char *const parameter)
static void resetXtags(langType lang, bool mode)
static int excludesCompare(struct colprintLine *a, struct colprintLine *b)
static void processEtagsInclude(const char *const option, const char *const parameter)
static void processAnonHashOption(const char *const option, const char *const parameter)
static int featureCompare(struct colprintLine *a, struct colprintLine *b)
static void processForceQuitOption(const char *const option, const char *const parameter)
static void resetFieldsOption(langType lang, bool mode)
struct localOptionValues localOption
static void cArgRead(cookedArgs *const current)
static stringList * Excluded
static bool checkSameFile(const char *const fileName, void *userData)
static bool processBooleanOption(const char *const option, const char *const parameter)
static void printOptionDescriptions(const optionDescription *const optDesc)
static void processFilterTerminatorOption(const char *const option, const char *const parameter)
static void processExtraTagsOption(const char *const option, const char *const parameter)
static bool processMultilineRegexOption(const char *const option, const char *const parameter)
cookedArgs * cArgNewFromFile(FILE *const fp)
bool isIncludeFile(const char *const fileName)
static void addExtensionList(stringList *const slist, const char *const elist, const bool clear)
static void processExcmdOption(const char *const option, const char *const parameter)
void notice(const char *const format,...)
bool paramParserBool(const char *value, bool fallback, const char *errWhat, const char *errCategory)
static void processOptionFileMaybe(const char *const option, const char *const parameter)
static bool processParametricOption(const char *const option, const char *const parameter)
static struct Feature Features[]
static void processOptlibDir(const char *const option, const char *const parameter)
#define isCompoundOption(c)
static void enableLanguageField(langType language, const char *field, bool mode)
static booleanOption BooleanOptions[]
static const char *const License1
void previewFirstOption(cookedArgs *const args)
static void processEchoOption(const char *const option, const char *const parameter)
static void processListLangdefFlagsOptions(const char *const option, const char *const parameter)
cookedArgs * cArgNewFromLineFile(FILE *const fp)
bool ptagMakePatternLengthLimit(ptagDesc *pdesc, langType language, const void *data)
static bool processRegexOption(const char *const option, const char *const parameter)
static void addIgnoreListFromFile(const char *const fileName)
static void processListMapExtensionsOption(const char *const option, const char *const parameter)
static const char *const StageDescription[]
static void processListKindsOption(const char *const option, const char *const parameter)
static char * extractMapFromParameter(const langType language, char *parameter, char **tail, bool *pattern_p, char *(*skip)(char *))
static bool processMultitableExtendingOption(const char *const option, const char *const parameter)
static void processPseudoTags(const char *const option, const char *const parameter)
static void processOutputFormat(const char *const option, const char *const parameter)
static void processListKinddefFlagsOptions(const char *const option, const char *const parameter)
static stringList * OptionFiles
static char * skipPastMap(char *p)
void verbose(const char *const format,...)
void cArgDelete(cookedArgs *const current)
static bool FilesRequired
static void processListRolesOptions(const char *const option, const char *const parameter)
static const char *const HeaderExtensions[]
static void processListExcludesOption(const char *const option, const char *const parameter)
static void resetOptlibPathList(bool report_in_verbose)
static void processListMapsOption(const char *const option, const char *const parameter)
static void parseShortOption(cookedArgs *const args)
static void processListExtrasOption(const char *const option, const char *const parameter)
static void processMaxRecursionDepthOption(const char *const option, const char *const parameter)
static void enableLanguageXtag(langType language, const char *xtag, bool mode)
bool cArgIsOption(cookedArgs *const current)
static void processLanguagesOption(const char *const option, const char *const parameter)
static void processLanguageMapOption(const char *const option, const char *const parameter)
static void processListFieldsOption(const char *const option, const char *const parameter)
static void processHelpOption(const char *const option, const char *const parameter)
static void processExcludeExceptionOption(const char *const option, const char *const parameter)
static void processForceInitOption(const char *const option, const char *const parameter)
static char * stringCopy(const char *const string)
static stringList * ExcludedException
void(* parametricOptionHandler)(const char *const option, const char *const parameter)
static searchPathList * OptlibPathList
#define DEFAULT_FILE_FORMAT
static OptionLoadingStage Stage
static bool getBooleanOption(const char *const option, const char *const parameter)
static void preload(struct preloadPathElt *pathList)
static void processListMultilineRegexFlagsOptions(const char *const option, const char *const parameter)
void cArgForth(cookedArgs *const current)
static char * getConfigForXDG(const char *path, const char *extra)
bool processMapOption(const char *const option, const char *const parameter)
struct sOptionDescription optionDescription
static void processHelpOptionCommon(const char *const option, const char *const parameter, bool includingExperimentalOptions)
static void setBooleanToXtagWithWarning(booleanOption *const option, bool value)
void setDefaultTagFileName(void)
static void processFormatOption(const char *const option, const char *const parameter)
static void processListAliasesOption(const char *const option, const char *const parameter)
static void processLicenseOption(const char *const option, const char *const parameter)
static void freeSearchPathList(searchPathList **pathList)
char *(* preloadMakePathFunc)(const char *, const char *)
static void processLongOption(const char *const option, const char *const parameter)
bool isDestinationStdout(void)
static void setXrefMode(void)
static parametricOption ParametricOptions[]
static void processPatternLengthLimit(const char *const option, const char *const parameter)
static void processShortOption(const char *const option, const char *const parameter)
static char * addLanguageMap(const langType language, char *map_parameter, bool exclusiveInAllLanguages)
static bool processLangSpecificFieldsOption(const char *const option, const char *const parameter)
static char * prependEnvvar(const char *path, const char *envvar)
static optionDescription ExperimentalLongOptionDescription[]
static void processListParametersOption(const char *const option, const char *const parameter)
static void processOptionFileCommon(const char *const option, const char *const parameter, bool allowNonExistingFile)
void readOptionConfiguration(void)
static char * removeLanguageMap(const langType language, char *map_parameter)
static void processHelpFullOption(const char *const option, const char *const parameter)
static bool processLangSpecificExtraOption(const char *const option, const char *const parameter)
langType getLanguageComponentInOption(const char *const option, const char *const prefix)
static void parseLongOption(cookedArgs *const args, const char *item)
static void printProgramIdentification(void)
bool isExcludedFile(const char *const name, bool falseIfExceptionsAreDefeind)
static void processDumpOptionsOption(const char *const option, const char *const parameter)
static void prependToOptlibPathList(const char *const dir, bool report_in_verbose)
bool processParamOption(const char *const option, const char *const value)
void freeOptionResources(void)
static void printInvocationDescription(void)
static vString * expandOnOptlibPathList(const char *leaf)
static void processOptionFile(const char *const option, const char *const parameter)
static bool isFalse(const char *parameter)
static struct preloadPathElt preload_path_list[]
static void processVersionOption(const char *const option, const char *const parameter)
static void parseConfigurationFileOptions(void)
static void processIgnoreOption(const char *const list, int IgnoreOrDefine)
static void printFeatureList(void)
static void parseEnvironmentOptions(void)
static bool cArgOptionPending(cookedArgs *const current)
static void processLanguageForceOption(const char *const option, const char *const parameter)
static void processListFeaturesOption(const char *const option, const char *const parameter)
static void parseOptions(cookedArgs *const args)
#define IGNORE_SEPARATORS
static void processIf0Option(const char *const option, const char *const parameter)
static void parseOption(cookedArgs *const args)
static void processExcludeOption(const char *const option, const char *const parameter)
static void processListMapsOptionForType(const char *const option, const char *const parameter, langmapType type)
static void processXformatOption(const char *const option, const char *const parameter)
static void processTotals(const char *const option, const char *const parameter)
#define EXTENSION_SEPARATOR
cookedArgs * cArgNewFromString(const char *string)
static void processTagRelative(const char *const option, const char *const parameter)
#define BEGIN_VERBOSE(VFP)
@ OptionLoadingStageCmdline
@ OptionLoadingStageDosCnf
@ OptionLoadingStageCurrentRecursive
@ OptionLoadingStagePreload
@ OptionLoadingStageHomeRecursive
@ OptionLoadingStageEnvVar
@ OptionLoadingStageLocalEtc
@ OptionLoadingStageCustom
bool processScopesepOption(const char *const option, const char *const parameter)
bool processAliasOption(const char *const option, const char *const parameter)
bool processRoledefOption(const char *const option, const char *const parameter)
bool processTabledefOption(const char *const option, const char *const parameter)
bool processKindsOption(const char *const option, const char *const parameter)
bool processFielddefOption(const char *const option, const char *const parameter)
bool processKinddefOption(const char *const option, const char *const parameter)
bool processExtradefOption(const char *const option, const char *const parameter)
bool processRolesOption(const char *const option, const char *const parameter)
void processLanguageDefineOption(const char *const option, const char *const parameter)
bool processPretendOption(const char *const option, const char *const parameter)
enum eOptionLoadingStage OptionLoadingStage
void applyParameter(const langType language, const char *name, const char *args)
langType getNamedLanguage(const char *const name, size_t len)
void printLanguageAliases(const langType language, bool withListHeader, bool machinable, FILE *fp)
langType getNamedLanguageFull(const char *const name, size_t len, bool noPretending)
void installLanguageAliasesDefaults(void)
void processLanguageMultitableExtendingOption(langType language, const char *const parameter)
unsigned int countParsers(void)
void printLanguageMaps(const langType language, langmapType type, bool withListHeader, bool machinable, FILE *fp)
bool removeLanguageExtensionMap(const langType language, const char *const extension)
void installLanguageMapDefault(const langType language)
void printLangdefFlags(bool withListHeader, bool machinable, FILE *fp)
void printLanguageSubparsers(const langType language, bool withListHeader, bool machinable, FILE *fp)
void enableLanguages(const bool state)
void enableLanguage(const langType language, const bool state)
bool isLanguageVisible(const langType language)
const char * getLanguageName(const langType language)
void printLanguageParameters(const langType language, bool withListHeader, bool machinable, FILE *fp)
void printKinddefFlags(bool withListHeader, bool machinable, FILE *fp)
void printLanguageRoles(const langType language, const char *kindspecs, bool withListHeader, bool machinable, FILE *fp)
void printLanguageKinds(const langType language, bool allKindFields, bool withListHeader, bool machinable, FILE *fp)
void initializeParser(langType lang)
void printLanguageList(void)
void addLanguageExtensionMap(const langType language, const char *extension, bool exclusiveInAllLanguages)
bool removeLanguagePatternMap(const langType language, const char *const pattern)
void clearLanguageMap(const langType language)
void addLanguagePatternMap(const langType language, const char *ptrn, bool exclusiveInAllLanguages)
void anonHashString(const char *filename, char buf[9])
void installLanguageMapDefaults(void)
bool processLanguageRegexOption(langType language, enum regexParserType regptype, const char *const parameter)
ptagType getPtagTypeForName(const char *name)
void printPtags(bool withListHeader, bool machinable, FILE *fp)
bool enablePtag(ptagType type, bool state)
@ PTAG_JSON_OUTPUT_VERSION
char * combinePathAndFile(const char *const path, const char *const file)
char * eStrndup(const char *str, size_t len)
bool doesFileExist(const char *const fileName)
bool strToUInt(const char *const str, int base, unsigned int *value)
bool strToInt(const char *const str, int base, int *value)
void * eMalloc(const size_t size)
void toLowerString(char *str)
bool isSameFile(const char *const name1, const char *const name2)
const char * fileExtension(const char *const fileName)
char * strstr(const char *str, const char *substr)
const char * getExecutableName(void)
char * eStrdup(const char *str)
void eFree(void *const ptr)
fileStatus * eStat(const char *const fileName)
void eStatFree(fileStatus *status)
const char * baseFilename(const char *const filePath)
bool strToLong(const char *const str, int base, long *value)
#define OUTPUT_PATH_SEPARATOR
stringList * stringListNew(void)
bool stringListHasTest(const stringList *const current, bool(*test)(const char *s, void *userData), void *userData)
void stringListDelete(stringList *const current)
void stringListClear(stringList *const current)
void stringListCombine(stringList *const current, stringList *const from)
stringList * stringListNewFromArgv(const char *const *const argv)
vString * stringListItem(const stringList *const current, const unsigned int indx)
stringList * stringListNewFromFile(const char *const fileName)
void stringListPrint(const stringList *const current, FILE *fp)
bool stringListExtensionMatched(const stringList *const current, const char *const extension)
bool stringListFileMatched(const stringList *const current, const char *const fileName)
unsigned int stringListCount(const stringList *const current)
void stringListAdd(stringList *const current, vString *string)
bool stringListHas(const stringList *const current, const char *const string)
parametricOptionHandler handler
unsigned long acceptableStages
preloadMakePathFunc makePath
void(* set)(const struct sBooleanOption *const option, bool value)
unsigned long acceptableStages
unsigned int tagFileFormat
unsigned int patternLengthLimit
stringList * etagsInclude
enum sOptionValues::interactiveMode interactive
unsigned int maxRecursionDepth
bool guessLanguageEagerly
void vStringTranslate(vString *const string, char fromC, char toC)
void vStringCopyS(vString *const string, const char *const s)
vString * vStringNew(void)
void vStringDelete(vString *const string)
vString * vStringNewOrClearWithAutoRelease(vString *const string)
vString * vStringNewOwn(char *s)
void vStringCatS(vString *const string, const char *const s)
vString * vStringNewInit(const char *const s)
#define vStringClear(string)
#define vStringLength(vs)
#define vStringIsEmpty(vs)
static void vStringPut(vString *const string, const int c)
void writerCheckOptions(void)
const char * outputDefaultFileName(void)
void setTagWriter(writerType wtype, tagWriter *customWriter)
void xtagColprintTablePrint(struct colprintTable *table, bool withListHeader, bool machinable, FILE *fp)
xtagType getXtagTypeForLetter(char letter)
bool enableXtag(xtagType type, bool state)
xtagType nextSiblingXtag(xtagType type)
struct colprintTable * xtagColprintTableNew(void)
bool isXtagEnabled(xtagType type)
void xtagColprintAddLanguageLines(struct colprintTable *table, langType language)
xtagType getXtagTypeForNameAndLanguage(const char *name, langType language)
int getXtagOwner(xtagType type)
void xtagColprintAddCommonLines(struct colprintTable *table)