Support for building applications on top of clingo.
More...
|
CLINGO_VISIBILITY_DEFAULT bool | clingo_options_add (clingo_options_t *options, char const *group, size_t group_size, char const *option, size_t option_size, char const *description, size_t description_size, clingo_option_parser_t parser, void *data, bool multi, char const *argument, size_t argument_size) |
| Add an option that is processed with a custom parser.
|
|
CLINGO_VISIBILITY_DEFAULT bool | clingo_options_add_flag (clingo_options_t *options, char const *group, size_t group_size, char const *option, size_t option_size, char const *description, size_t description_size, bool *target) |
| Add an option that is a simple flag.
|
|
CLINGO_VISIBILITY_DEFAULT bool | clingo_main (clingo_lib_t *lib, clingo_string_t const *arguments, size_t size, clingo_application_t const *app, void *data, int *code) |
| Run an application with the given library and arguments.
|
|
Support for building applications on top of clingo.
◆ clingo_default_model_printer_t
typedef bool(* clingo_default_model_printer_t) (void *data) |
Callback to print a model in default format.
- Parameters
-
[in] | data | user data for the callback |
- Returns
- wether the call was successful
◆ clingo_main_function_t
typedef bool(* clingo_main_function_t) (clingo_control_t *control, clingo_string_t const *files, size_t size, void *data) |
Callback to customize clingo main function.
- Parameters
-
[in] | control | corresponding control object |
[in] | files | files passed via command line arguments |
[in] | size | number of files |
[in] | data | user data for the callback |
- Returns
- wether the call was successful
◆ clingo_model_printer_t
Callback to customize model printing.
- Parameters
-
[in] | model | the model |
[in] | printer | the default model printer |
[in] | printer_data | user data for the printer |
[in] | data | user data for the callback |
- Returns
- wether the call was successful
◆ clingo_option_parser_t
typedef bool(* clingo_option_parser_t) (char const *value, size_t size, void *data, bool *result) |
Callback to parse the value of a command-line option.
- Parameters
-
[in] | value | the value to parse |
[in] | size | the size of the value |
[in] | data | the user data of the callback |
[in] | result | |
- Returns
- wether the call was successful
◆ clingo_main()
Run an application with the given library and arguments.
Note that the application can be set to NULL to start clingo.
Returns an exit code instead of a result code.
- Parameters
-
[in] | lib | the library object |
[in] | arguments | the command line arguments |
[in] | size | the number of command line arguments |
[in] | app | struct with callbacks to override default clingo functionality |
[in] | data | user data for callbacks in app |
[out] | code | the exit code |
- Returns
- wether the call was successful
◆ clingo_options_add()
CLINGO_VISIBILITY_DEFAULT bool clingo_options_add |
( |
clingo_options_t * |
options, |
|
|
char const * |
group, |
|
|
size_t |
group_size, |
|
|
char const * |
option, |
|
|
size_t |
option_size, |
|
|
char const * |
description, |
|
|
size_t |
description_size, |
|
|
clingo_option_parser_t |
parser, |
|
|
void * |
data, |
|
|
bool |
multi, |
|
|
char const * |
argument, |
|
|
size_t |
argument_size |
|
) |
| |
Add an option that is processed with a custom parser.
Note that the parser also has to take care of storing the semantic value of the option somewhere.
Parameter option specifies the name(s) of the option. For example, "-p,ping" adds the short option "-p" and its long form "--ping". It is also possible to associate an option with a help level by prepending "@l" to the option specification. Options with a level greater than zero are only shown if the argument to help is greater or equal to l.
- Parameters
-
[in] | options | object to register the option with |
[in] | group | options are grouped into sections as given by this string |
[in] | group_size | the size of the group |
[in] | option | specifies the command line option |
[in] | option_size | teh size of the option |
[in] | description | the description of the option |
[in] | description_size | the size of the description |
[in] | parser | callback to parse the value of the option |
[in] | data | user data for the callback |
[in] | multi | whether the option can appear multiple times on the command-line |
[in] | argument | optional string (NULL) to change the value name in the generated help output |
[in] | argument_size | the size of the argument |
- Returns
- wether the call was successful
◆ clingo_options_add_flag()
CLINGO_VISIBILITY_DEFAULT bool clingo_options_add_flag |
( |
clingo_options_t * |
options, |
|
|
char const * |
group, |
|
|
size_t |
group_size, |
|
|
char const * |
option, |
|
|
size_t |
option_size, |
|
|
char const * |
description, |
|
|
size_t |
description_size, |
|
|
bool * |
target |
|
) |
| |
Add an option that is a simple flag.
This function is similar to clingo_options_add() but simpler because it only supports flags, which do not have values. If a flag is passed via the command-line, the parameter target is set to true.
- Parameters
-
[in] | options | object to register the option with |
[in] | group | options are grouped into sections as given by this string |
[in] | group_size | the size of the group |
[in] | option | specifies the command line option |
[in] | option_size | teh size of the option |
[in] | description | the description of the option |
[in] | description_size | the size of the description |
[in] | target | boolean set to true if the flag is given on the command-line |
- Returns
- wether the call was successful