1 /*
2 *   Copyright (c) 1999-2002, Darren Hiebert
3 *
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.
6 *
7 *   Defines external interface to command line argument reading.
8 */
9 #ifndef CTAGS_MAIN_ARGS_H
10 #define CTAGS_MAIN_ARGS_H
11 
12 /*
13 *   INCLUDE FILES
14 */
15 #include "general.h"  /* must always come first */
16 
17 #include <stdio.h>
18 
19 /*
20 *   DATA DECLARATIONS
21 */
22 
23 typedef enum { ARG_NONE, ARG_STRING, ARG_ARGV, ARG_FILE } argType;
24 
25 typedef struct sArgs {
26 	argType type;
27 	union {
28 		struct sStringArgs {
29 			const char* next;
30 		} stringArgs;
31 		struct sArgvArgs {
32 			char* const* argv;
33 			char* const* item;
34 		} argvArgs;
35 		struct sFileArgs {
36 			FILE* fp;
37 		} fileArgs;
38 	} u;
39 	char* item;
40 	bool lineMode;
41 } Arguments;
42 
43 /*
44 *   FUNCTION PROTOTYPES
45 */
46 extern Arguments* argNewFromString (const char* const string);
47 extern Arguments* argNewFromArgv (char* const* const argv);
48 extern Arguments* argNewFromFile (FILE* const fp);
49 extern Arguments* argNewFromLineFile (FILE* const fp);
50 extern char *argItem (const Arguments* const current);
51 extern bool argOff (const Arguments* const current);
52 extern void argSetWordMode (Arguments* const current);
53 extern void argSetLineMode (Arguments* const current);
54 extern void argForth (Arguments* const current);
55 extern void argDelete (Arguments* const current);
56 
57 #endif  /* CTAGS_MAIN_ARGS_H */
58