| 1 | /* |
| 2 | * This Source Code Form is subject to the terms of the Mozilla Public |
| 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. |
| 5 | * |
| 6 | * Copyright 1997 - July 2008 CWI, August 2008 - 2019 MonetDB B.V. |
| 7 | */ |
| 8 | |
| 9 | #ifndef _MO_H_ |
| 10 | #define _MO_H_ |
| 11 | |
| 12 | typedef enum opt_kind { |
| 13 | opt_builtin = 0, |
| 14 | opt_config = 1, |
| 15 | opt_cmdline = 2 |
| 16 | } opt_kind; |
| 17 | |
| 18 | typedef struct opt { |
| 19 | opt_kind kind; |
| 20 | char *name; |
| 21 | char *value; |
| 22 | } opt; |
| 23 | |
| 24 | #ifdef __cplusplus |
| 25 | extern "C" { |
| 26 | #endif |
| 27 | |
| 28 | #ifndef moptions_export |
| 29 | /* avoid using "#ifdef WIN32" so that this file does not need our config.h */ |
| 30 | #if defined(_MSC_VER) || defined(__CYGWIN__) || defined(__MINGW32__) |
| 31 | #if !defined(LIBMOPTIONS) && !defined(LIBGDK) && !defined(LIBMAPI) |
| 32 | #define moptions_export extern __declspec(dllimport) |
| 33 | #else |
| 34 | #define moptions_export extern __declspec(dllexport) |
| 35 | #endif |
| 36 | #else |
| 37 | #define moptions_export extern |
| 38 | #endif |
| 39 | #endif |
| 40 | |
| 41 | /* mo_print_options will print the option set on stderr */ |
| 42 | moptions_export void mo_print_options(opt *set, int setlen); |
| 43 | |
| 44 | /* mo_find_option, finds the option with the given name in the option set |
| 45 | (set,setlen). */ |
| 46 | moptions_export char *mo_find_option(opt *set, int setlen, const char *name); |
| 47 | |
| 48 | /* mo_system_config will add the options from the system config file |
| 49 | (returns the new setlen) */ |
| 50 | moptions_export int mo_system_config(opt **Set, int setlen); |
| 51 | |
| 52 | /* mo_builtin_settings, will place the builtin settings into a new |
| 53 | option set (returns the length of this set). */ |
| 54 | moptions_export int mo_builtin_settings(opt **Set); |
| 55 | |
| 56 | /* mo_add_option will add a single option to the option set |
| 57 | (returns new length) */ |
| 58 | moptions_export int mo_add_option(opt **Set, int setlen, opt_kind kind, const char *name, const char *value); |
| 59 | |
| 60 | /* mo_free_options will free the resouces take by the options set */ |
| 61 | moptions_export void mo_free_options(opt *set, int setlen); |
| 62 | |
| 63 | #ifdef __cplusplus |
| 64 | } |
| 65 | #endif |
| 66 | #endif |
| 67 | |