Clingo C API
C API for clingo providing high level functions to control grounding and solving.
|
Functions and data structures to work with program ASTs.
Classes | |
struct | clingo_ast_attribute_names |
Struct to map attributes to their string representation. More... | |
struct | clingo_ast_argument |
Struct to define an argument that consists of a name and a type. More... | |
struct | clingo_ast_constructor |
A lists of required attributes to construct an AST. More... | |
struct | clingo_ast_constructors |
Struct to map AST types to lists of required attributes to construct ASTs. More... | |
Typedefs | |
typedef int | clingo_ast_theory_sequence_type_t |
Corresponding type to clingo_ast_theory_sequence_type_e. | |
typedef int | clingo_ast_comparison_operator_t |
Corresponding type to clingo_ast_comparison_operator_e. | |
typedef int | clingo_ast_sign_t |
Corresponding type to clingo_ast_sign_t. | |
typedef int | clingo_ast_unary_operator_t |
Corresponding type to clingo_ast_unary_operator_e. | |
typedef int | clingo_ast_binary_operator_t |
Corresponding type to clingo_ast_binary_operator_e. | |
typedef int | clingo_ast_aggregate_function_t |
Corresponding type to clingo_ast_aggregate_function_e. | |
typedef int | clingo_ast_theory_operator_type_t |
Corresponding type to clingo_ast_theory_operator_type_e. | |
typedef int | clingo_ast_theory_atom_definition_type_t |
Corresponding type to clingo_ast_theory_atom_definition_type_e. | |
typedef int | clingo_ast_type_t |
Corresponding type to clingo_ast_type_e. | |
typedef int | clingo_ast_attribute_type_t |
Corresponding type to clingo_ast_attribute_type. | |
typedef int | clingo_ast_attribute_t |
Corresponding type to clingo_ast_attribute_e. | |
typedef struct clingo_ast_attribute_names | clingo_ast_attribute_names_t |
Struct to map attributes to their string representation. | |
typedef struct clingo_ast_argument | clingo_ast_argument_t |
Struct to define an argument that consists of a name and a type. | |
typedef struct clingo_ast_constructor | clingo_ast_constructor_t |
A lists of required attributes to construct an AST. | |
typedef struct clingo_ast_constructors | clingo_ast_constructors_t |
Struct to map AST types to lists of required attributes to construct ASTs. | |
typedef struct clingo_ast | clingo_ast_t |
This struct provides a view to nodes in the AST. | |
typedef struct clingo_program_builder | clingo_program_builder_t |
Object to build non-ground programs. | |
Enumerations | |
enum | clingo_ast_theory_sequence_type_e { clingo_ast_theory_sequence_type_tuple, clingo_ast_theory_sequence_type_list, clingo_ast_theory_sequence_type_set } |
Enumeration of theory sequence types. More... | |
enum | clingo_ast_comparison_operator_e { clingo_ast_comparison_operator_greater_than = 0, clingo_ast_comparison_operator_less_than = 1, clingo_ast_comparison_operator_less_equal = 2, clingo_ast_comparison_operator_greater_equal = 3, clingo_ast_comparison_operator_not_equal = 4, clingo_ast_comparison_operator_equal = 5 } |
Enumeration of comparison relations. More... | |
enum | clingo_ast_sign_e { clingo_ast_sign_no_sign = 0, clingo_ast_sign_negation = 1, clingo_ast_sign_double_negation = 2 } |
Enumeration of signs. More... | |
enum | clingo_ast_unary_operator_e { clingo_ast_unary_operator_minus = 0, clingo_ast_unary_operator_negation = 1, clingo_ast_unary_operator_absolute = 2 } |
Enumeration of unary operators. More... | |
enum | clingo_ast_binary_operator_e { clingo_ast_binary_operator_xor = 0, clingo_ast_binary_operator_or = 1, clingo_ast_binary_operator_and = 2, clingo_ast_binary_operator_plus = 3, clingo_ast_binary_operator_minus = 4, clingo_ast_binary_operator_multiplication = 5, clingo_ast_binary_operator_division = 6, clingo_ast_binary_operator_modulo = 7, clingo_ast_binary_operator_power = 8 } |
Enumeration of binary operators. More... | |
enum | clingo_ast_aggregate_function_e { clingo_ast_aggregate_function_count = 0, clingo_ast_aggregate_function_sum = 1, clingo_ast_aggregate_function_sump = 2, clingo_ast_aggregate_function_min = 3, clingo_ast_aggregate_function_max = 4 } |
Enumeration of aggregate functions. More... | |
enum | clingo_ast_theory_operator_type_e { clingo_ast_theory_operator_type_unary = 0, clingo_ast_theory_operator_type_binary_left = 1, clingo_ast_theory_operator_type_binary_right = 2 } |
Enumeration of theory operators. More... | |
enum | clingo_ast_theory_atom_definition_type_e { clingo_ast_theory_atom_definition_type_head = 0, clingo_ast_theory_atom_definition_type_body = 1, clingo_ast_theory_atom_definition_type_any = 2, clingo_ast_theory_atom_definition_type_directive = 3 } |
Enumeration of the theory atom types. More... | |
enum | clingo_ast_type_e { clingo_ast_type_id, clingo_ast_type_variable, clingo_ast_type_symbolic_term, clingo_ast_type_unary_operation, clingo_ast_type_binary_operation, clingo_ast_type_interval, clingo_ast_type_function, clingo_ast_type_pool, clingo_ast_type_csp_product, clingo_ast_type_csp_sum, clingo_ast_type_csp_guard, clingo_ast_type_boolean_constant, clingo_ast_type_symbolic_atom, clingo_ast_type_comparison, clingo_ast_type_csp_literal, clingo_ast_type_aggregate_guard, clingo_ast_type_conditional_literal, clingo_ast_type_aggregate, clingo_ast_type_body_aggregate_element, clingo_ast_type_body_aggregate, clingo_ast_type_head_aggregate_element, clingo_ast_type_head_aggregate, clingo_ast_type_disjunction, clingo_ast_type_disjoint_element, clingo_ast_type_disjoint, clingo_ast_type_theory_sequence, clingo_ast_type_theory_function, clingo_ast_type_theory_unparsed_term_element, clingo_ast_type_theory_unparsed_term, clingo_ast_type_theory_guard, clingo_ast_type_theory_atom_element, clingo_ast_type_theory_atom, clingo_ast_type_literal, clingo_ast_type_theory_operator_definition, clingo_ast_type_theory_term_definition, clingo_ast_type_theory_guard_definition, clingo_ast_type_theory_atom_definition, clingo_ast_type_rule, clingo_ast_type_definition, clingo_ast_type_show_signature, clingo_ast_type_show_term, clingo_ast_type_minimize, clingo_ast_type_script, clingo_ast_type_program, clingo_ast_type_external, clingo_ast_type_edge, clingo_ast_type_heuristic, clingo_ast_type_project_atom, clingo_ast_type_project_signature, clingo_ast_type_defined, clingo_ast_type_theory_definition } |
Enumeration of AST types. | |
enum | clingo_ast_attribute_type_e { clingo_ast_attribute_type_number = 0, clingo_ast_attribute_type_symbol = 1, clingo_ast_attribute_type_location = 2, clingo_ast_attribute_type_string = 3, clingo_ast_attribute_type_ast = 4, clingo_ast_attribute_type_optional_ast = 5, clingo_ast_attribute_type_string_array = 6, clingo_ast_attribute_type_ast_array = 7 } |
Enumeration of attributes types used by the AST. More... | |
enum | clingo_ast_attribute_e { clingo_ast_attribute_argument, clingo_ast_attribute_arguments, clingo_ast_attribute_arity, clingo_ast_attribute_atom, clingo_ast_attribute_atoms, clingo_ast_attribute_atom_type, clingo_ast_attribute_bias, clingo_ast_attribute_body, clingo_ast_attribute_code, clingo_ast_attribute_coefficient, clingo_ast_attribute_comparison, clingo_ast_attribute_condition, clingo_ast_attribute_csp, clingo_ast_attribute_elements, clingo_ast_attribute_external, clingo_ast_attribute_external_type, clingo_ast_attribute_function, clingo_ast_attribute_guard, clingo_ast_attribute_guards, clingo_ast_attribute_head, clingo_ast_attribute_is_default, clingo_ast_attribute_left, clingo_ast_attribute_left_guard, clingo_ast_attribute_literal, clingo_ast_attribute_location, clingo_ast_attribute_modifier, clingo_ast_attribute_name, clingo_ast_attribute_node_u, clingo_ast_attribute_node_v, clingo_ast_attribute_operator_name, clingo_ast_attribute_operator_type, clingo_ast_attribute_operators, clingo_ast_attribute_parameters, clingo_ast_attribute_positive, clingo_ast_attribute_priority, clingo_ast_attribute_right, clingo_ast_attribute_right_guard, clingo_ast_attribute_sequence_type, clingo_ast_attribute_sign, clingo_ast_attribute_symbol, clingo_ast_attribute_term, clingo_ast_attribute_terms, clingo_ast_attribute_value, clingo_ast_attribute_variable, clingo_ast_attribute_weight } |
Enumeration of attributes used by the AST. | |
Variables | |
CLINGO_VISIBILITY_DEFAULT clingo_ast_attribute_names_t | g_clingo_ast_attribute_names |
A map from attributes to their string representation. | |
CLINGO_VISIBILITY_DEFAULT clingo_ast_constructors_t | g_clingo_ast_constructors |
A map from AST types to their constructors. More... | |
Functions to construct ASTs | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_build (clingo_ast_type_t type, clingo_ast_t **ast,...) |
Construct an AST of the given type. More... | |
Functions to manage life time of ASTs | |
CLINGO_VISIBILITY_DEFAULT void | clingo_ast_acquire (clingo_ast_t *ast) |
Increment the reference count of an AST node. More... | |
CLINGO_VISIBILITY_DEFAULT void | clingo_ast_release (clingo_ast_t *ast) |
Decrement the reference count of an AST node. More... | |
Functions to copy ASTs | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_copy (clingo_ast_t *ast, clingo_ast_t **copy) |
Deep copy an AST node. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_deep_copy (clingo_ast_t *ast, clingo_ast_t **copy) |
Create a shallow copy of an AST node. More... | |
Functions to compare ASTs | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_less_than (clingo_ast_t *a, clingo_ast_t *b) |
Less than compare two AST nodes. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_equal (clingo_ast_t *a, clingo_ast_t *b) |
Equality compare two AST nodes. More... | |
CLINGO_VISIBILITY_DEFAULT size_t | clingo_ast_hash (clingo_ast_t *ast) |
Compute a hash for an AST node. More... | |
Functions to get convert ASTs to strings | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_to_string_size (clingo_ast_t *ast, size_t *size) |
Get the size of the string representation of an AST node. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_to_string (clingo_ast_t *ast, char *string, size_t size) |
Get the string representation of an AST node. More... | |
Functions to inspect ASTs | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_get_type (clingo_ast_t *ast, clingo_ast_type_t *type) |
Get the type of an AST node. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_has_attribute (clingo_ast_t *ast, clingo_ast_attribute_t attribute, bool *has_attribute) |
Check if an AST has the given attribute. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_type (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_ast_attribute_type_t *type) |
Get the type of the given AST. More... | |
Functions to get/set numeric attributes of ASTs | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_get_number (clingo_ast_t *ast, clingo_ast_attribute_t attribute, int *value) |
Get the value of an attribute of type "clingo_ast_attribute_type_number". More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_set_number (clingo_ast_t *ast, clingo_ast_attribute_t attribute, int value) |
Set the value of an attribute of type "clingo_ast_attribute_type_number". More... | |
Functions to get/set symbolic attributes of ASTs | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_get_symbol (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_symbol_t *value) |
Get the value of an attribute of type "clingo_ast_attribute_type_symbol". More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_set_symbol (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_symbol_t value) |
Set the value of an attribute of type "clingo_ast_attribute_type_symbol". More... | |
Functions to get/set location attributes of ASTs | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_get_location (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_location_t *value) |
Get the value of an attribute of type "clingo_ast_attribute_type_location". More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_set_location (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_location_t const *value) |
Set the value of an attribute of type "clingo_ast_attribute_type_location". More... | |
Functions to get/set string attributes of ASTs | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_get_string (clingo_ast_t *ast, clingo_ast_attribute_t attribute, char const **value) |
Get the value of an attribute of type "clingo_ast_attribute_type_string". More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_set_string (clingo_ast_t *ast, clingo_ast_attribute_t attribute, char const *value) |
Set the value of an attribute of type "clingo_ast_attribute_type_string". More... | |
Functions to get/set AST attributes of ASTs | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_get_ast (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_ast_t **value) |
Get the value of an attribute of type "clingo_ast_attribute_type_ast". More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_set_ast (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_ast_t *value) |
Set the value of an attribute of type "clingo_ast_attribute_type_ast". More... | |
Functions to get/set optional AST attributes of ASTs | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_get_optional_ast (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_ast_t **value) |
Get the value of an attribute of type "clingo_ast_attribute_type_optional_ast". More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_set_optional_ast (clingo_ast_t *ast, clingo_ast_attribute_t attribute, clingo_ast_t *value) |
Set the value of an attribute of type "clingo_ast_attribute_type_optional_ast". More... | |
Functions to get/set string array attributes of ASTs | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_get_string_at (clingo_ast_t *ast, clingo_ast_attribute_t attribute, size_t index, char const **value) |
Get the value of an attribute of type "clingo_ast_attribute_type_string_array" at the given index. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_set_string_at (clingo_ast_t *ast, clingo_ast_attribute_t attribute, size_t index, char const *value) |
Set the value of an attribute of type "clingo_ast_attribute_type_string_array" at the given index. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_delete_string_at (clingo_ast_t *ast, clingo_ast_attribute_t attribute, size_t index) |
Remove an element from an attribute of type "clingo_ast_attribute_type_string_array" at the given index. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_size_string_array (clingo_ast_t *ast, clingo_ast_attribute_t attribute, size_t *size) |
Get the size of an attribute of type "clingo_ast_attribute_type_string_array". More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_insert_string_at (clingo_ast_t *ast, clingo_ast_attribute_t attribute, size_t index, char const *value) |
Insert a value into an attribute of type "clingo_ast_attribute_type_string_array" at the given index. More... | |
Functions to get/set AST array attributes of ASTs | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_get_ast_at (clingo_ast_t *ast, clingo_ast_attribute_t attribute, size_t index, clingo_ast_t **value) |
Get the value of an attribute of type "clingo_ast_attribute_type_ast_array" at the given index. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_set_ast_at (clingo_ast_t *ast, clingo_ast_attribute_t attribute, size_t index, clingo_ast_t *value) |
Set the value of an attribute of type "clingo_ast_attribute_type_ast_array" at the given index. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_delete_ast_at (clingo_ast_t *ast, clingo_ast_attribute_t attribute, size_t index) |
Remove an element from an attribute of type "clingo_ast_attribute_type_ast_array" at the given index. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_size_ast_array (clingo_ast_t *ast, clingo_ast_attribute_t attribute, size_t *size) |
Get the size of an attribute of type "clingo_ast_attribute_type_ast_array". More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_attribute_insert_ast_at (clingo_ast_t *ast, clingo_ast_attribute_t attribute, size_t index, clingo_ast_t *value) |
Insert a value into an attribute of type "clingo_ast_attribute_type_ast_array" at the given index. More... | |
Functions to construct ASTs from strings | |
typedef bool(* | clingo_ast_callback_t) (clingo_ast_t *ast, void *data) |
Callback function to intercept AST nodes. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_parse_string (char const *program, clingo_ast_callback_t callback, void *callback_data, clingo_logger_t logger, void *logger_data, unsigned message_limit) |
Parse the given program and return an abstract syntax tree for each statement via a callback. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_parse_files (char const *const *files, size_t size, clingo_ast_callback_t callback, void *callback_data, clingo_logger_t logger, void *logger_data, unsigned message_limit) |
Parse the programs in the given list of files and return an abstract syntax tree for each statement via a callback. More... | |
Functions to add ASTs to logic programs | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_program_builder_begin (clingo_program_builder_t *builder) |
Begin building a program. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_program_builder_end (clingo_program_builder_t *builder) |
End building a program. More... | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_program_builder_add (clingo_program_builder_t *builder, clingo_ast_t *ast) |
Adds a statement to the program. More... | |
Functions to unpool ASts | |
enum | clingo_ast_unpool_type_e { clingo_ast_unpool_type_condition = 1, clingo_ast_unpool_type_other = 2, clingo_ast_unpool_type_all = 3 } |
Enum to configure unpooling. More... | |
typedef int | clingo_ast_unpool_type_bitset_t |
Corresponding type to clingo_ast_unpool_type_e. | |
CLINGO_VISIBILITY_DEFAULT bool | clingo_ast_unpool (clingo_ast_t *ast, clingo_ast_unpool_type_bitset_t unpool_type, clingo_ast_callback_t callback, void *callback_data) |
Unpool the given AST. More... | |
typedef bool(* clingo_ast_callback_t) (clingo_ast_t *ast, void *data) |
Callback function to intercept AST nodes.
[in] | ast | the AST |
[in] | data | a user data pointer |
Enumeration of attributes types used by the AST.
Enumeration of binary operators.
Enumeration of comparison relations.
enum clingo_ast_sign_e |
Enumeration of the theory atom types.
CLINGO_VISIBILITY_DEFAULT void clingo_ast_acquire | ( | clingo_ast_t * | ast | ) |
Increment the reference count of an AST node.
[in] | ast | the target AST |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_delete_ast_at | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
size_t | index | ||
) |
Remove an element from an attribute of type "clingo_ast_attribute_type_ast_array" at the given index.
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[in] | index | the target index |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_delete_string_at | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
size_t | index | ||
) |
Remove an element from an attribute of type "clingo_ast_attribute_type_string_array" at the given index.
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[in] | index | the target index |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_ast | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
clingo_ast_t ** | value | ||
) |
Get the value of an attribute of type "clingo_ast_attribute_type_ast".
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[out] | value | the resulting value |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_ast_at | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
size_t | index, | ||
clingo_ast_t ** | value | ||
) |
Get the value of an attribute of type "clingo_ast_attribute_type_ast_array" at the given index.
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[in] | index | the target index |
[out] | value | the resulting value |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_location | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
clingo_location_t * | value | ||
) |
Get the value of an attribute of type "clingo_ast_attribute_type_location".
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[out] | value | the resulting value |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_number | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
int * | value | ||
) |
Get the value of an attribute of type "clingo_ast_attribute_type_number".
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[out] | value | the resulting value |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_optional_ast | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
clingo_ast_t ** | value | ||
) |
Get the value of an attribute of type "clingo_ast_attribute_type_optional_ast".
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[out] | value | the resulting value |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_string | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
char const ** | value | ||
) |
Get the value of an attribute of type "clingo_ast_attribute_type_string".
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[out] | value | the resulting value |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_string_at | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
size_t | index, | ||
char const ** | value | ||
) |
Get the value of an attribute of type "clingo_ast_attribute_type_string_array" at the given index.
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[in] | index | the target index |
[out] | value | the resulting value |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_get_symbol | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
clingo_symbol_t * | value | ||
) |
Get the value of an attribute of type "clingo_ast_attribute_type_symbol".
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[out] | value | the resulting value |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_insert_ast_at | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
size_t | index, | ||
clingo_ast_t * | value | ||
) |
Insert a value into an attribute of type "clingo_ast_attribute_type_ast_array" at the given index.
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[in] | index | the target index |
[in] | value | the value |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_insert_string_at | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
size_t | index, | ||
char const * | value | ||
) |
Insert a value into an attribute of type "clingo_ast_attribute_type_string_array" at the given index.
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[in] | index | the target index |
[in] | value | the value |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_set_ast | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
clingo_ast_t * | value | ||
) |
Set the value of an attribute of type "clingo_ast_attribute_type_ast".
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[in] | value | the value |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_set_ast_at | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
size_t | index, | ||
clingo_ast_t * | value | ||
) |
Set the value of an attribute of type "clingo_ast_attribute_type_ast_array" at the given index.
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[in] | index | the target index |
[in] | value | the value |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_set_location | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
clingo_location_t const * | value | ||
) |
Set the value of an attribute of type "clingo_ast_attribute_type_location".
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[in] | value | the value |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_set_number | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
int | value | ||
) |
Set the value of an attribute of type "clingo_ast_attribute_type_number".
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[in] | value | the value |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_set_optional_ast | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
clingo_ast_t * | value | ||
) |
Set the value of an attribute of type "clingo_ast_attribute_type_optional_ast".
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[in] | value | the value |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_set_string | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
char const * | value | ||
) |
Set the value of an attribute of type "clingo_ast_attribute_type_string".
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[in] | value | the value |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_set_string_at | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
size_t | index, | ||
char const * | value | ||
) |
Set the value of an attribute of type "clingo_ast_attribute_type_string_array" at the given index.
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[in] | index | the target index |
[in] | value | the value |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_set_symbol | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
clingo_symbol_t | value | ||
) |
Set the value of an attribute of type "clingo_ast_attribute_type_symbol".
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[in] | value | the value |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_size_ast_array | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
size_t * | size | ||
) |
Get the size of an attribute of type "clingo_ast_attribute_type_ast_array".
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[out] | size | the resulting size |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_size_string_array | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
size_t * | size | ||
) |
Get the size of an attribute of type "clingo_ast_attribute_type_string_array".
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[out] | size | the resulting size |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_attribute_type | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
clingo_ast_attribute_type_t * | type | ||
) |
Get the type of the given AST.
[in] | ast | the target AST |
[in] | attribute | the target attribute |
[out] | type | the resulting type |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_build | ( | clingo_ast_type_t | type, |
clingo_ast_t ** | ast, | ||
... | |||
) |
Construct an AST of the given type.
[in] | type | the type of AST to construct |
[out] | ast | the resulting AST |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_copy | ( | clingo_ast_t * | ast, |
clingo_ast_t ** | copy | ||
) |
Deep copy an AST node.
[in] | ast | the AST to copy |
[out] | copy | the resulting AST |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_deep_copy | ( | clingo_ast_t * | ast, |
clingo_ast_t ** | copy | ||
) |
Create a shallow copy of an AST node.
[in] | ast | the AST to copy |
[out] | copy | the resulting AST |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_equal | ( | clingo_ast_t * | a, |
clingo_ast_t * | b | ||
) |
Equality compare two AST nodes.
[in] | a | the left-hand-side AST |
[in] | b | the right-hand-side AST |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_get_type | ( | clingo_ast_t * | ast, |
clingo_ast_type_t * | type | ||
) |
Get the type of an AST node.
[in] | ast | the target AST |
[out] | type | the resulting type |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_has_attribute | ( | clingo_ast_t * | ast, |
clingo_ast_attribute_t | attribute, | ||
bool * | has_attribute | ||
) |
Check if an AST has the given attribute.
[in] | ast | the target AST |
[in] | attribute | the attribute to check |
[out] | has_attribute | the result |
CLINGO_VISIBILITY_DEFAULT size_t clingo_ast_hash | ( | clingo_ast_t * | ast | ) |
Compute a hash for an AST node.
[in] | ast | the target AST |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_less_than | ( | clingo_ast_t * | a, |
clingo_ast_t * | b | ||
) |
Less than compare two AST nodes.
[in] | a | the left-hand-side AST |
[in] | b | the right-hand-side AST |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_parse_files | ( | char const *const * | files, |
size_t | size, | ||
clingo_ast_callback_t | callback, | ||
void * | callback_data, | ||
clingo_logger_t | logger, | ||
void * | logger_data, | ||
unsigned | message_limit | ||
) |
Parse the programs in the given list of files and return an abstract syntax tree for each statement via a callback.
The function follows clingo's handling of files on the command line. Filename "-" is treated as "STDIN" and if an empty list is given, then the parser will read from "STDIN".
[in] | files | the beginning of the file name array |
[in] | size | the number of file names |
[in] | callback | the callback reporting statements |
[in] | callback_data | user data for the callback |
[in] | logger | callback to report messages during parsing |
[in] | logger_data | user data for the logger |
[in] | message_limit | the maximum number of times the logger is called |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_parse_string | ( | char const * | program, |
clingo_ast_callback_t | callback, | ||
void * | callback_data, | ||
clingo_logger_t | logger, | ||
void * | logger_data, | ||
unsigned | message_limit | ||
) |
Parse the given program and return an abstract syntax tree for each statement via a callback.
[in] | program | the program in gringo syntax |
[in] | callback | the callback reporting statements |
[in] | callback_data | user data for the callback |
[in] | logger | callback to report messages during parsing |
[in] | logger_data | user data for the logger |
[in] | message_limit | the maximum number of times the logger is called |
CLINGO_VISIBILITY_DEFAULT void clingo_ast_release | ( | clingo_ast_t * | ast | ) |
Decrement the reference count of an AST node.
[in] | ast | the target AST |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_to_string | ( | clingo_ast_t * | ast, |
char * | string, | ||
size_t | size | ||
) |
Get the string representation of an AST node.
[in] | ast | the target AST |
[out] | string | the string representation |
[out] | size | the size of the string representation |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_to_string_size | ( | clingo_ast_t * | ast, |
size_t * | size | ||
) |
Get the size of the string representation of an AST node.
[in] | ast | the target AST |
[out] | size | the size of the string representation |
CLINGO_VISIBILITY_DEFAULT bool clingo_ast_unpool | ( | clingo_ast_t * | ast, |
clingo_ast_unpool_type_bitset_t | unpool_type, | ||
clingo_ast_callback_t | callback, | ||
void * | callback_data | ||
) |
Unpool the given AST.
[in] | ast | the target AST |
[in] | unpool_type | what to unpool |
[in] | callback | the callback to report ASTs |
[in] | callback_data | user data for the callback |
CLINGO_VISIBILITY_DEFAULT bool clingo_program_builder_add | ( | clingo_program_builder_t * | builder, |
clingo_ast_t * | ast | ||
) |
Adds a statement to the program.
[in] | builder | the target program builder |
[in] | ast | the AST node to add |
CLINGO_VISIBILITY_DEFAULT bool clingo_program_builder_begin | ( | clingo_program_builder_t * | builder | ) |
Begin building a program.
[in] | builder | the target program builder |
CLINGO_VISIBILITY_DEFAULT bool clingo_program_builder_end | ( | clingo_program_builder_t * | builder | ) |
End building a program.
[in] | builder | the target program builder |
CLINGO_VISIBILITY_DEFAULT clingo_ast_constructors_t g_clingo_ast_constructors |
A map from AST types to their constructors.