| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
#ifndef eslGETOPTS_INCLUDED |
| 7 |
#define eslGETOPTS_INCLUDED |
| 8 |
#include <esl_config.h> |
| 9 |
#include "easel.h" |
| 10 |
#ifdef __cplusplus |
| 11 |
extern "C" { |
| 12 |
#endif |
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
typedef struct { |
| 22 |
char *name; |
| 23 |
int type; |
| 24 |
char *defval; |
| 25 |
char *envvar; |
| 26 |
char *range; |
| 27 |
char *toggle_opts; |
| 28 |
char *required_opts; |
| 29 |
char *incompat_opts; |
| 30 |
char *help; |
| 31 |
int docgrouptag; |
| 32 |
} ESL_OPTIONS; |
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
#define eslARG_NONE 0 |
| 38 |
#define eslARG_INT 1 |
| 39 |
#define eslARG_REAL 2 |
| 40 |
#define eslARG_CHAR 3 |
| 41 |
#define eslARG_STRING 4 |
| 42 |
#define eslARG_INFILE 5 |
| 43 |
#define eslARG_OUTFILE 6 |
| 44 |
|
| 45 |
|
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
typedef struct { |
| 54 |
const ESL_OPTIONS *opt; |
| 55 |
int nopts; |
| 56 |
|
| 57 |
int argc; |
| 58 |
char **argv; |
| 59 |
int optind; |
| 60 |
int nfiles; |
| 61 |
|
| 62 |
char **val; |
| 63 |
int *setby; |
| 64 |
int *valloc; |
| 65 |
|
| 66 |
char *optstring; |
| 67 |
char *spoof; |
| 68 |
char **spoof_argv; |
| 69 |
|
| 70 |
char errbuf[eslERRBUFSIZE]; |
| 71 |
} ESL_GETOPTS; |
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
#define eslARG_SETBY_DEFAULT 0 |
| 80 |
#define eslARG_SETBY_CMDLINE 1 |
| 81 |
#define eslARG_SETBY_ENV 2 |
| 82 |
#define eslARG_SETBY_CFGFILE 3 |
| 83 |
|
| 84 |
|
| 85 |
|
| 86 |
|
| 87 |
extern ESL_GETOPTS *esl_getopts_Create(const ESL_OPTIONS *opt); |
| 88 |
extern ESL_GETOPTS *esl_getopts_CreateDefaultApp(const ESL_OPTIONS *options, int nargs, int argc, char **argv, char *banner, char *usage); |
| 89 |
extern int esl_getopts_Reuse (ESL_GETOPTS *g); |
| 90 |
extern void esl_getopts_Destroy(ESL_GETOPTS *g); |
| 91 |
extern void esl_getopts_Dump(FILE *ofp, ESL_GETOPTS *g); |
| 92 |
|
| 93 |
extern int esl_opt_ProcessConfigfile (ESL_GETOPTS *g, char *filename, FILE *fp); |
| 94 |
extern int esl_opt_ProcessEnvironment(ESL_GETOPTS *g); |
| 95 |
extern int esl_opt_ProcessCmdline (ESL_GETOPTS *g, int argc, char **argv); |
| 96 |
extern int esl_opt_ProcessSpoof (ESL_GETOPTS *g, const char *cmdline); |
| 97 |
extern int esl_opt_VerifyConfig (ESL_GETOPTS *g); |
| 98 |
extern int esl_opt_ArgNumber (const ESL_GETOPTS *g); |
| 99 |
extern int esl_opt_SpoofCmdline(const ESL_GETOPTS *g, char **ret_cmdline); |
| 100 |
extern char *esl_getopts_CreateOptsLine(ESL_GETOPTS *g); |
| 101 |
extern int esl_opt_GetSetter (const ESL_GETOPTS *g, char *optname); |
| 102 |
|
| 103 |
extern int esl_opt_IsDefault (const ESL_GETOPTS *g, char *optname); |
| 104 |
extern int esl_opt_IsOn (const ESL_GETOPTS *g, char *optname); |
| 105 |
extern int esl_opt_IsUsed (const ESL_GETOPTS *g, char *optname); |
| 106 |
|
| 107 |
extern int esl_opt_GetBoolean(const ESL_GETOPTS *g, char *optname); |
| 108 |
extern int esl_opt_GetInteger(const ESL_GETOPTS *g, char *optname); |
| 109 |
extern double esl_opt_GetReal (const ESL_GETOPTS *g, char *optname); |
| 110 |
extern char esl_opt_GetChar (const ESL_GETOPTS *g, char *optname); |
| 111 |
extern char *esl_opt_GetString (const ESL_GETOPTS *g, char *optname); |
| 112 |
extern char *esl_opt_GetArg (const ESL_GETOPTS *g, int which); |
| 113 |
|
| 114 |
extern int esl_opt_DisplayHelp(FILE *ofp, const ESL_GETOPTS *go, int docgroup, int indent, int textwidth); |
| 115 |
#ifdef __cplusplus |
| 116 |
} |
| 117 |
#endif |
| 118 |
#endif |