ZEDA  1.6.18
zeda_option.h
Go to the documentation of this file.
1 /* ZEDA - Elementary Data and Algorithms
2  * Copyright (C) 1998 Tomomichi Sugihara (Zhidao)
3  */
9 #ifndef __ZEDA_OPTION_H__
10 #define __ZEDA_OPTION_H__
11 
14 #ifndef __KERNEL__
15 
16 #include <ctype.h>
17 #include <zeda/zeda_strlist.h>
18 
20 
21 /* ********************************************************** *//* ************************************************** */
24 
25 /* ********************************************************** *//* ******************************************************* */
59 
60 typedef struct{
61  const char *key;
62  const char *longkey;
63  const char *arg_guide;
64  const char *desc;
65  char *arg;
66  bool flag;
67 } zOption;
68 
85 __EXPORT void zOptionHelp(zOption *opts);
86 
96 __EXPORT void zOptionDiag(zOption *opts);
97 
143 __EXPORT bool zOptionRead(zOption *opts, char **argv, zStrAddrList *arglist);
144 
145 /* ********************************************************** */
146 /* integer range
147  * ********************************************************** */
148 
149 #define Z_INTRANGE_BORDER (-1)
150 
173 __EXPORT void zParseIntRange(char *expr, int *from, int *to);
174 
175 /* ********************************************************** */
176 /* commandline argument vector
177  * ********************************************************** */
178 
200 __EXPORT char *zGetArg(char ***argv);
201 
212 #ifdef __WINDOWS__
213 # define zIsOption(o) \
214  ( ( (o)[0] == '-' || (o)[0] == '/' ) && !isdigit( (o)[1] ) && (o)[1] != '-' )
215 #else
216 #define zIsOption(o) \
217  ( ( (o)[0] == '-' ) && !isdigit( (o)[1] ) && (o)[1] != '-' )
218 #endif /* __WINDOWS__ */
219 
223 
224 #endif /* __KERNEL__ */
225 
226 #endif /* __ZEDA_OPTION_H__ */
const char * longkey
Definition: zeda_option.h:62
command line option information.
Definition: zeda_option.h:60
char * zGetArg(char ***argv)
get the next command line argument.
#define __END_DECLS
Definition: zeda_defs.h:30
const char * desc
Definition: zeda_option.h:64
void zParseIntRange(char *expr, int *from, int *to)
parse integer range notation.
void zOptionDiag(zOption *opts)
diagnose option flags.
bool zOptionRead(zOption *opts, char **argv, zStrAddrList *arglist)
read command line options.
bool flag
Definition: zeda_option.h:66
void zOptionHelp(zOption *opts)
display a command line help.
#define __BEGIN_DECLS
Definition: zeda_defs.h:26
char * arg
Definition: zeda_option.h:65
#define __EXPORT
Definition: zeda_compat.h:32
const char * arg_guide
Definition: zeda_option.h:63
const char * key
Definition: zeda_option.h:61
Definition: zeda_strlist.h:23