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