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