00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #pragma once
00017
00018 namespace drizzled
00019 {
00020
00021 #define GET_NO_ARG 1
00022 #define GET_BOOL 2
00023 #define GET_INT 3
00024 #define GET_UINT 4
00025 #define GET_LONG 5
00026 #define GET_UINT32 6
00027 #define GET_LL 7
00028 #define GET_ULL 8
00029 #define GET_STR 9
00030 #define GET_STR_ALLOC 10
00031 #define GET_DISABLED 11
00032 #define GET_ENUM 12
00033 #define GET_SET 13
00034 #define GET_DOUBLE 14
00035 #define GET_SIZE 15
00036 #define GET_UINT64 16
00037 #define GET_ULONG_IS_FAIL 17
00038
00039 #define GET_ASK_ADDR 128
00040 #define GET_TYPE_MASK 127
00041
00042 enum loglevel {
00043 ERROR_LEVEL,
00044 WARNING_LEVEL,
00045 INFORMATION_LEVEL
00046 };
00047
00048 enum get_opt_arg_type { NO_ARG, OPT_ARG, REQUIRED_ARG };
00049
00050 struct st_typelib;
00051
00052 struct option
00053 {
00054 const char *name;
00055 int id;
00056 const char *comment;
00057 char **value;
00058 char **u_max_value;
00059 struct st_typelib *typelib;
00060 uint32_t var_type;
00061 enum get_opt_arg_type arg_type;
00062 int64_t def_value;
00063 int64_t min_value;
00064 int64_t max_value;
00065 int64_t sub_size;
00066 long block_size;
00067 void *app_type;
00068 };
00069
00070
00071 typedef int (* my_get_one_option) (int, const struct option *, char * );
00072 typedef void (* my_error_reporter) (enum loglevel level, const char *format, ... );
00073 typedef char ** (*getopt_get_addr_func)(const char *, uint32_t, const struct option *);
00074
00075 extern char *disabled_my_option;
00076 extern bool my_getopt_skip_unknown;
00077 extern my_error_reporter my_getopt_error_reporter;
00078
00079 extern int handle_options (int *argc, char ***argv,
00080 const struct option *longopts, my_get_one_option);
00081 extern void my_cleanup_options(const struct option *options);
00082 extern void my_print_help(const struct option *options);
00083 extern void my_print_variables(const struct option *options);
00084
00085 uint64_t getopt_ull_limit_value(uint64_t num, const struct option *optp,
00086 bool *fix);
00087 int64_t getopt_ll_limit_value(int64_t, const struct option *,
00088 bool *fix);
00089 bool getopt_compare_strings(const char *s, const char *t, uint32_t length);
00090
00091 }
00092
00093