1pub const _STDINT_H: u32 = 1;
4pub const _FEATURES_H: u32 = 1;
5pub const _DEFAULT_SOURCE: u32 = 1;
6pub const __GLIBC_USE_ISOC2X: u32 = 0;
7pub const __USE_ISOC11: u32 = 1;
8pub const __USE_ISOC99: u32 = 1;
9pub const __USE_ISOC95: u32 = 1;
10pub const __USE_POSIX_IMPLICITLY: u32 = 1;
11pub const _POSIX_SOURCE: u32 = 1;
12pub const _POSIX_C_SOURCE: u32 = 200809;
13pub const __USE_POSIX: u32 = 1;
14pub const __USE_POSIX2: u32 = 1;
15pub const __USE_POSIX199309: u32 = 1;
16pub const __USE_POSIX199506: u32 = 1;
17pub const __USE_XOPEN2K: u32 = 1;
18pub const __USE_XOPEN2K8: u32 = 1;
19pub const _ATFILE_SOURCE: u32 = 1;
20pub const __WORDSIZE: u32 = 64;
21pub const __WORDSIZE_TIME64_COMPAT32: u32 = 1;
22pub const __SYSCALL_WORDSIZE: u32 = 64;
23pub const __TIMESIZE: u32 = 64;
24pub const __USE_MISC: u32 = 1;
25pub const __USE_ATFILE: u32 = 1;
26pub const __USE_FORTIFY_LEVEL: u32 = 0;
27pub const __GLIBC_USE_DEPRECATED_GETS: u32 = 0;
28pub const __GLIBC_USE_DEPRECATED_SCANF: u32 = 0;
29pub const __GLIBC_USE_C2X_STRTOL: u32 = 0;
30pub const _STDC_PREDEF_H: u32 = 1;
31pub const __STDC_IEC_559__: u32 = 1;
32pub const __STDC_IEC_60559_BFP__: u32 = 201404;
33pub const __STDC_IEC_559_COMPLEX__: u32 = 1;
34pub const __STDC_IEC_60559_COMPLEX__: u32 = 201404;
35pub const __STDC_ISO_10646__: u32 = 201706;
36pub const __GNU_LIBRARY__: u32 = 6;
37pub const __GLIBC__: u32 = 2;
38pub const __GLIBC_MINOR__: u32 = 38;
39pub const _SYS_CDEFS_H: u32 = 1;
40pub const __glibc_c99_flexarr_available: u32 = 1;
41pub const __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI: u32 = 0;
42pub const __HAVE_GENERIC_SELECTION: u32 = 1;
43pub const __GLIBC_USE_LIB_EXT2: u32 = 0;
44pub const __GLIBC_USE_IEC_60559_BFP_EXT: u32 = 0;
45pub const __GLIBC_USE_IEC_60559_BFP_EXT_C2X: u32 = 0;
46pub const __GLIBC_USE_IEC_60559_EXT: u32 = 0;
47pub const __GLIBC_USE_IEC_60559_FUNCS_EXT: u32 = 0;
48pub const __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X: u32 = 0;
49pub const __GLIBC_USE_IEC_60559_TYPES_EXT: u32 = 0;
50pub const _BITS_TYPES_H: u32 = 1;
51pub const _BITS_TYPESIZES_H: u32 = 1;
52pub const __OFF_T_MATCHES_OFF64_T: u32 = 1;
53pub const __INO_T_MATCHES_INO64_T: u32 = 1;
54pub const __RLIM_T_MATCHES_RLIM64_T: u32 = 1;
55pub const __STATFS_MATCHES_STATFS64: u32 = 1;
56pub const __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64: u32 = 1;
57pub const __FD_SETSIZE: u32 = 1024;
58pub const _BITS_TIME64_H: u32 = 1;
59pub const _BITS_WCHAR_H: u32 = 1;
60pub const _BITS_STDINT_INTN_H: u32 = 1;
61pub const _BITS_STDINT_UINTN_H: u32 = 1;
62pub const INT8_MIN: i32 = -128;
63pub const INT16_MIN: i32 = -32768;
64pub const INT32_MIN: i32 = -2147483648;
65pub const INT8_MAX: u32 = 127;
66pub const INT16_MAX: u32 = 32767;
67pub const INT32_MAX: u32 = 2147483647;
68pub const UINT8_MAX: u32 = 255;
69pub const UINT16_MAX: u32 = 65535;
70pub const UINT32_MAX: u32 = 4294967295;
71pub const INT_LEAST8_MIN: i32 = -128;
72pub const INT_LEAST16_MIN: i32 = -32768;
73pub const INT_LEAST32_MIN: i32 = -2147483648;
74pub const INT_LEAST8_MAX: u32 = 127;
75pub const INT_LEAST16_MAX: u32 = 32767;
76pub const INT_LEAST32_MAX: u32 = 2147483647;
77pub const UINT_LEAST8_MAX: u32 = 255;
78pub const UINT_LEAST16_MAX: u32 = 65535;
79pub const UINT_LEAST32_MAX: u32 = 4294967295;
80pub const INT_FAST8_MIN: i32 = -128;
81pub const INT_FAST16_MIN: i64 = -9223372036854775808;
82pub const INT_FAST32_MIN: i64 = -9223372036854775808;
83pub const INT_FAST8_MAX: u32 = 127;
84pub const INT_FAST16_MAX: u64 = 9223372036854775807;
85pub const INT_FAST32_MAX: u64 = 9223372036854775807;
86pub const UINT_FAST8_MAX: u32 = 255;
87pub const UINT_FAST16_MAX: i32 = -1;
88pub const UINT_FAST32_MAX: i32 = -1;
89pub const INTPTR_MIN: i64 = -9223372036854775808;
90pub const INTPTR_MAX: u64 = 9223372036854775807;
91pub const UINTPTR_MAX: i32 = -1;
92pub const PTRDIFF_MIN: i64 = -9223372036854775808;
93pub const PTRDIFF_MAX: u64 = 9223372036854775807;
94pub const SIG_ATOMIC_MIN: i32 = -2147483648;
95pub const SIG_ATOMIC_MAX: u32 = 2147483647;
96pub const SIZE_MAX: i32 = -1;
97pub const WINT_MIN: u32 = 0;
98pub const WINT_MAX: u32 = 4294967295;
99pub const __bool_true_false_are_defined: u32 = 1;
100pub const true_: u32 = 1;
101pub const false_: u32 = 0;
102pub const CLINGO_VERSION_MAJOR: u32 = 5;
103pub const CLINGO_VERSION_MINOR: u32 = 6;
104pub const CLINGO_VERSION_REVISION: u32 = 2;
105pub const CLINGO_VERSION: &[u8; 6] = b"5.6.2\0";
106pub type wchar_t = ::std::os::raw::c_int;
107pub type __u_char = ::std::os::raw::c_uchar;
108pub type __u_short = ::std::os::raw::c_ushort;
109pub type __u_int = ::std::os::raw::c_uint;
110pub type __u_long = ::std::os::raw::c_ulong;
111pub type __int8_t = ::std::os::raw::c_schar;
112pub type __uint8_t = ::std::os::raw::c_uchar;
113pub type __int16_t = ::std::os::raw::c_short;
114pub type __uint16_t = ::std::os::raw::c_ushort;
115pub type __int32_t = ::std::os::raw::c_int;
116pub type __uint32_t = ::std::os::raw::c_uint;
117pub type __int64_t = ::std::os::raw::c_long;
118pub type __uint64_t = ::std::os::raw::c_ulong;
119pub type __int_least8_t = __int8_t;
120pub type __uint_least8_t = __uint8_t;
121pub type __int_least16_t = __int16_t;
122pub type __uint_least16_t = __uint16_t;
123pub type __int_least32_t = __int32_t;
124pub type __uint_least32_t = __uint32_t;
125pub type __int_least64_t = __int64_t;
126pub type __uint_least64_t = __uint64_t;
127pub type __quad_t = ::std::os::raw::c_long;
128pub type __u_quad_t = ::std::os::raw::c_ulong;
129pub type __intmax_t = ::std::os::raw::c_long;
130pub type __uintmax_t = ::std::os::raw::c_ulong;
131pub type __dev_t = ::std::os::raw::c_ulong;
132pub type __uid_t = ::std::os::raw::c_uint;
133pub type __gid_t = ::std::os::raw::c_uint;
134pub type __ino_t = ::std::os::raw::c_ulong;
135pub type __ino64_t = ::std::os::raw::c_ulong;
136pub type __mode_t = ::std::os::raw::c_uint;
137pub type __nlink_t = ::std::os::raw::c_ulong;
138pub type __off_t = ::std::os::raw::c_long;
139pub type __off64_t = ::std::os::raw::c_long;
140pub type __pid_t = ::std::os::raw::c_int;
141#[repr(C)]
142#[derive(Debug, Copy, Clone)]
143pub struct __fsid_t {
144 pub __val: [::std::os::raw::c_int; 2usize],
145}
146#[test]
147fn bindgen_test_layout___fsid_t() {
148 const UNINIT: ::std::mem::MaybeUninit<__fsid_t> = ::std::mem::MaybeUninit::uninit();
149 let ptr = UNINIT.as_ptr();
150 assert_eq!(
151 ::std::mem::size_of::<__fsid_t>(),
152 8usize,
153 concat!("Size of: ", stringify!(__fsid_t))
154 );
155 assert_eq!(
156 ::std::mem::align_of::<__fsid_t>(),
157 4usize,
158 concat!("Alignment of ", stringify!(__fsid_t))
159 );
160 assert_eq!(
161 unsafe { ::std::ptr::addr_of!((*ptr).__val) as usize - ptr as usize },
162 0usize,
163 concat!(
164 "Offset of field: ",
165 stringify!(__fsid_t),
166 "::",
167 stringify!(__val)
168 )
169 );
170}
171pub type __clock_t = ::std::os::raw::c_long;
172pub type __rlim_t = ::std::os::raw::c_ulong;
173pub type __rlim64_t = ::std::os::raw::c_ulong;
174pub type __id_t = ::std::os::raw::c_uint;
175pub type __time_t = ::std::os::raw::c_long;
176pub type __useconds_t = ::std::os::raw::c_uint;
177pub type __suseconds_t = ::std::os::raw::c_long;
178pub type __suseconds64_t = ::std::os::raw::c_long;
179pub type __daddr_t = ::std::os::raw::c_int;
180pub type __key_t = ::std::os::raw::c_int;
181pub type __clockid_t = ::std::os::raw::c_int;
182pub type __timer_t = *mut ::std::os::raw::c_void;
183pub type __blksize_t = ::std::os::raw::c_long;
184pub type __blkcnt_t = ::std::os::raw::c_long;
185pub type __blkcnt64_t = ::std::os::raw::c_long;
186pub type __fsblkcnt_t = ::std::os::raw::c_ulong;
187pub type __fsblkcnt64_t = ::std::os::raw::c_ulong;
188pub type __fsfilcnt_t = ::std::os::raw::c_ulong;
189pub type __fsfilcnt64_t = ::std::os::raw::c_ulong;
190pub type __fsword_t = ::std::os::raw::c_long;
191pub type __ssize_t = ::std::os::raw::c_long;
192pub type __syscall_slong_t = ::std::os::raw::c_long;
193pub type __syscall_ulong_t = ::std::os::raw::c_ulong;
194pub type __loff_t = __off64_t;
195pub type __caddr_t = *mut ::std::os::raw::c_char;
196pub type __intptr_t = ::std::os::raw::c_long;
197pub type __socklen_t = ::std::os::raw::c_uint;
198pub type __sig_atomic_t = ::std::os::raw::c_int;
199pub type int_least8_t = __int_least8_t;
200pub type int_least16_t = __int_least16_t;
201pub type int_least32_t = __int_least32_t;
202pub type int_least64_t = __int_least64_t;
203pub type uint_least8_t = __uint_least8_t;
204pub type uint_least16_t = __uint_least16_t;
205pub type uint_least32_t = __uint_least32_t;
206pub type uint_least64_t = __uint_least64_t;
207pub type int_fast8_t = ::std::os::raw::c_schar;
208pub type int_fast16_t = ::std::os::raw::c_long;
209pub type int_fast32_t = ::std::os::raw::c_long;
210pub type int_fast64_t = ::std::os::raw::c_long;
211pub type uint_fast8_t = ::std::os::raw::c_uchar;
212pub type uint_fast16_t = ::std::os::raw::c_ulong;
213pub type uint_fast32_t = ::std::os::raw::c_ulong;
214pub type uint_fast64_t = ::std::os::raw::c_ulong;
215pub type intmax_t = __intmax_t;
216pub type uintmax_t = __uintmax_t;
217#[doc = "! Signed integer type used for aspif and solver literals."]
218pub type clingo_literal_t = i32;
219#[doc = "! Unsigned integer type used for aspif atoms."]
220pub type clingo_atom_t = u32;
221#[doc = "! Unsigned integer type used in various places."]
222pub type clingo_id_t = u32;
223#[doc = "! Signed integer type for weights in sum aggregates and minimize constraints."]
224pub type clingo_weight_t = i32;
225#[doc = "! A Literal with an associated weight."]
226#[repr(C)]
227#[derive(Debug, Copy, Clone)]
228pub struct clingo_weighted_literal {
229 pub literal: clingo_literal_t,
230 pub weight: clingo_weight_t,
231}
232#[test]
233fn bindgen_test_layout_clingo_weighted_literal() {
234 const UNINIT: ::std::mem::MaybeUninit<clingo_weighted_literal> =
235 ::std::mem::MaybeUninit::uninit();
236 let ptr = UNINIT.as_ptr();
237 assert_eq!(
238 ::std::mem::size_of::<clingo_weighted_literal>(),
239 8usize,
240 concat!("Size of: ", stringify!(clingo_weighted_literal))
241 );
242 assert_eq!(
243 ::std::mem::align_of::<clingo_weighted_literal>(),
244 4usize,
245 concat!("Alignment of ", stringify!(clingo_weighted_literal))
246 );
247 assert_eq!(
248 unsafe { ::std::ptr::addr_of!((*ptr).literal) as usize - ptr as usize },
249 0usize,
250 concat!(
251 "Offset of field: ",
252 stringify!(clingo_weighted_literal),
253 "::",
254 stringify!(literal)
255 )
256 );
257 assert_eq!(
258 unsafe { ::std::ptr::addr_of!((*ptr).weight) as usize - ptr as usize },
259 4usize,
260 concat!(
261 "Offset of field: ",
262 stringify!(clingo_weighted_literal),
263 "::",
264 stringify!(weight)
265 )
266 );
267}
268#[doc = "! A Literal with an associated weight."]
269pub type clingo_weighted_literal_t = clingo_weighted_literal;
270#[doc = "!< successful API calls"]
271pub const clingo_error_e_clingo_error_success: clingo_error_e = 0;
272#[doc = "!< errors only detectable at runtime like invalid input"]
273pub const clingo_error_e_clingo_error_runtime: clingo_error_e = 1;
274#[doc = "!< wrong usage of the clingo API"]
275pub const clingo_error_e_clingo_error_logic: clingo_error_e = 2;
276#[doc = "!< memory could not be allocated"]
277pub const clingo_error_e_clingo_error_bad_alloc: clingo_error_e = 3;
278#[doc = "!< errors unrelated to clingo"]
279pub const clingo_error_e_clingo_error_unknown: clingo_error_e = 4;
280#[doc = "! Enumeration of error codes.\n!\n! @note Errors can only be recovered from if explicitly mentioned; most\n! functions do not provide strong exception guarantees. This means that in\n! case of errors associated objects cannot be used further. If such an\n! object has a free function, this function can and should still be called."]
281pub type clingo_error_e = ::std::os::raw::c_uint;
282#[doc = "! Corresponding type to ::clingo_error_e."]
283pub type clingo_error_t = ::std::os::raw::c_int;
284extern "C" {
285 #[doc = "! Convert error code into string."]
286 pub fn clingo_error_string(code: clingo_error_t) -> *const ::std::os::raw::c_char;
287}
288extern "C" {
289 #[doc = "! Get the last error code set by a clingo API call.\n! @note Each thread has its own local error code.\n! @return error code"]
290 pub fn clingo_error_code() -> clingo_error_t;
291}
292extern "C" {
293 #[doc = "! Get the last error message set if an API call fails.\n! @note Each thread has its own local error message.\n! @return error message or NULL"]
294 pub fn clingo_error_message() -> *const ::std::os::raw::c_char;
295}
296extern "C" {
297 #[doc = "! Set a custom error code and message in the active thread.\n! @param[in] code the error code\n! @param[in] message the error message"]
298 pub fn clingo_set_error(code: clingo_error_t, message: *const ::std::os::raw::c_char);
299}
300#[doc = "!< undefined arithmetic operation or weight of aggregate"]
301pub const clingo_warning_e_clingo_warning_operation_undefined: clingo_warning_e = 0;
302#[doc = "!< to report multiple errors; a corresponding runtime error is raised later"]
303pub const clingo_warning_e_clingo_warning_runtime_error: clingo_warning_e = 1;
304#[doc = "!< undefined atom in program"]
305pub const clingo_warning_e_clingo_warning_atom_undefined: clingo_warning_e = 2;
306#[doc = "!< same file included multiple times"]
307pub const clingo_warning_e_clingo_warning_file_included: clingo_warning_e = 3;
308#[doc = "!< CSP variable with unbounded domain"]
309pub const clingo_warning_e_clingo_warning_variable_unbounded: clingo_warning_e = 4;
310#[doc = "!< global variable in tuple of aggregate element"]
311pub const clingo_warning_e_clingo_warning_global_variable: clingo_warning_e = 5;
312#[doc = "!< other kinds of warnings"]
313pub const clingo_warning_e_clingo_warning_other: clingo_warning_e = 6;
314#[doc = "! Enumeration of warning codes."]
315pub type clingo_warning_e = ::std::os::raw::c_uint;
316#[doc = "! Corresponding type to ::clingo_warning_e."]
317pub type clingo_warning_t = ::std::os::raw::c_int;
318extern "C" {
319 #[doc = "! Convert warning code into string."]
320 pub fn clingo_warning_string(code: clingo_warning_t) -> *const ::std::os::raw::c_char;
321}
322#[doc = "! Callback to intercept warning messages.\n!\n! @param[in] code associated warning code\n! @param[in] message warning message\n! @param[in] data user data for callback\n!\n! @see clingo_control_new()\n! @see clingo_parse_term()\n! @see clingo_parse_program()"]
323pub type clingo_logger_t = ::std::option::Option<
324 unsafe extern "C" fn(
325 code: clingo_warning_t,
326 message: *const ::std::os::raw::c_char,
327 data: *mut ::std::os::raw::c_void,
328 ),
329>;
330extern "C" {
331 #[doc = "! Obtain the clingo version.\n!\n! @param[out] major major version number\n! @param[out] minor minor version number\n! @param[out] revision revision number"]
332 pub fn clingo_version(
333 major: *mut ::std::os::raw::c_int,
334 minor: *mut ::std::os::raw::c_int,
335 revision: *mut ::std::os::raw::c_int,
336 );
337}
338#[doc = "!< no truth value"]
339pub const clingo_truth_value_e_clingo_truth_value_free: clingo_truth_value_e = 0;
340#[doc = "!< true"]
341pub const clingo_truth_value_e_clingo_truth_value_true: clingo_truth_value_e = 1;
342#[doc = "!< false"]
343pub const clingo_truth_value_e_clingo_truth_value_false: clingo_truth_value_e = 2;
344#[doc = "! Represents three-valued truth values."]
345pub type clingo_truth_value_e = ::std::os::raw::c_uint;
346#[doc = "! Corresponding type to ::clingo_truth_value_e."]
347pub type clingo_truth_value_t = ::std::os::raw::c_int;
348#[doc = "! Represents a source code location marking its beginnig and end.\n!\n! @note Not all locations refer to physical files.\n! By convention, such locations use a name put in angular brackets as filename.\n! The string members of a location object are internalized and valid for the duration of the process."]
349#[repr(C)]
350#[derive(Debug, Copy, Clone)]
351pub struct clingo_location {
352 #[doc = "!< the file where the location begins"]
353 pub begin_file: *const ::std::os::raw::c_char,
354 #[doc = "!< the file where the location ends"]
355 pub end_file: *const ::std::os::raw::c_char,
356 #[doc = "!< the line where the location begins"]
357 pub begin_line: usize,
358 #[doc = "!< the line where the location ends"]
359 pub end_line: usize,
360 #[doc = "!< the column where the location begins"]
361 pub begin_column: usize,
362 #[doc = "!< the column where the location ends"]
363 pub end_column: usize,
364}
365#[test]
366fn bindgen_test_layout_clingo_location() {
367 const UNINIT: ::std::mem::MaybeUninit<clingo_location> = ::std::mem::MaybeUninit::uninit();
368 let ptr = UNINIT.as_ptr();
369 assert_eq!(
370 ::std::mem::size_of::<clingo_location>(),
371 48usize,
372 concat!("Size of: ", stringify!(clingo_location))
373 );
374 assert_eq!(
375 ::std::mem::align_of::<clingo_location>(),
376 8usize,
377 concat!("Alignment of ", stringify!(clingo_location))
378 );
379 assert_eq!(
380 unsafe { ::std::ptr::addr_of!((*ptr).begin_file) as usize - ptr as usize },
381 0usize,
382 concat!(
383 "Offset of field: ",
384 stringify!(clingo_location),
385 "::",
386 stringify!(begin_file)
387 )
388 );
389 assert_eq!(
390 unsafe { ::std::ptr::addr_of!((*ptr).end_file) as usize - ptr as usize },
391 8usize,
392 concat!(
393 "Offset of field: ",
394 stringify!(clingo_location),
395 "::",
396 stringify!(end_file)
397 )
398 );
399 assert_eq!(
400 unsafe { ::std::ptr::addr_of!((*ptr).begin_line) as usize - ptr as usize },
401 16usize,
402 concat!(
403 "Offset of field: ",
404 stringify!(clingo_location),
405 "::",
406 stringify!(begin_line)
407 )
408 );
409 assert_eq!(
410 unsafe { ::std::ptr::addr_of!((*ptr).end_line) as usize - ptr as usize },
411 24usize,
412 concat!(
413 "Offset of field: ",
414 stringify!(clingo_location),
415 "::",
416 stringify!(end_line)
417 )
418 );
419 assert_eq!(
420 unsafe { ::std::ptr::addr_of!((*ptr).begin_column) as usize - ptr as usize },
421 32usize,
422 concat!(
423 "Offset of field: ",
424 stringify!(clingo_location),
425 "::",
426 stringify!(begin_column)
427 )
428 );
429 assert_eq!(
430 unsafe { ::std::ptr::addr_of!((*ptr).end_column) as usize - ptr as usize },
431 40usize,
432 concat!(
433 "Offset of field: ",
434 stringify!(clingo_location),
435 "::",
436 stringify!(end_column)
437 )
438 );
439}
440#[doc = "! Represents a source code location marking its beginnig and end.\n!\n! @note Not all locations refer to physical files.\n! By convention, such locations use a name put in angular brackets as filename.\n! The string members of a location object are internalized and valid for the duration of the process."]
441pub type clingo_location_t = clingo_location;
442#[doc = "! Represents a predicate signature.\n!\n! Signatures have a name and an arity, and can be positive or negative (to\n! represent classical negation)."]
443pub type clingo_signature_t = u64;
444extern "C" {
445 #[doc = "! Create a new signature.\n!\n! @param[in] name name of the signature\n! @param[in] arity arity of the signature\n! @param[in] positive false if the signature has a classical negation sign\n! @param[out] signature the resulting signature\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
446 pub fn clingo_signature_create(
447 name: *const ::std::os::raw::c_char,
448 arity: u32,
449 positive: bool,
450 signature: *mut clingo_signature_t,
451 ) -> bool;
452}
453extern "C" {
454 #[doc = "! Get the name of a signature.\n!\n! @note\n! The string is internalized and valid for the duration of the process.\n!\n! @param[in] signature the target signature\n! @return the name of the signature"]
455 pub fn clingo_signature_name(signature: clingo_signature_t) -> *const ::std::os::raw::c_char;
456}
457extern "C" {
458 #[doc = "! Get the arity of a signature.\n!\n! @param[in] signature the target signature\n! @return the arity of the signature"]
459 pub fn clingo_signature_arity(signature: clingo_signature_t) -> u32;
460}
461extern "C" {
462 #[doc = "! Whether the signature is positive (is not classically negated).\n!\n! @param[in] signature the target signature\n! @return whether the signature has no sign"]
463 pub fn clingo_signature_is_positive(signature: clingo_signature_t) -> bool;
464}
465extern "C" {
466 #[doc = "! Whether the signature is negative (is classically negated).\n!\n! @param[in] signature the target signature\n! @return whether the signature has a sign"]
467 pub fn clingo_signature_is_negative(signature: clingo_signature_t) -> bool;
468}
469extern "C" {
470 #[doc = "! Check if two signatures are equal.\n!\n! @param[in] a first signature\n! @param[in] b second signature\n! @return whether a == b"]
471 pub fn clingo_signature_is_equal_to(a: clingo_signature_t, b: clingo_signature_t) -> bool;
472}
473extern "C" {
474 #[doc = "! Check if a signature is less than another signature.\n!\n! Signatures are compared first by sign (unsigned < signed), then by arity,\n! then by name.\n!\n! @param[in] a first signature\n! @param[in] b second signature\n! @return whether a < b"]
475 pub fn clingo_signature_is_less_than(a: clingo_signature_t, b: clingo_signature_t) -> bool;
476}
477extern "C" {
478 #[doc = "! Calculate a hash code of a signature.\n!\n! @param[in] signature the target signature\n! @return the hash code of the signature"]
479 pub fn clingo_signature_hash(signature: clingo_signature_t) -> usize;
480}
481#[doc = "!< the <tt>\\#inf</tt> symbol"]
482pub const clingo_symbol_type_e_clingo_symbol_type_infimum: clingo_symbol_type_e = 0;
483#[doc = "!< a numeric symbol, e.g., `1`"]
484pub const clingo_symbol_type_e_clingo_symbol_type_number: clingo_symbol_type_e = 1;
485#[doc = "!< a string symbol, e.g., `\"a\"`"]
486pub const clingo_symbol_type_e_clingo_symbol_type_string: clingo_symbol_type_e = 4;
487#[doc = "!< a numeric symbol, e.g., `c`, `(1, \"a\")`, or `f(1,\"a\")`"]
488pub const clingo_symbol_type_e_clingo_symbol_type_function: clingo_symbol_type_e = 5;
489#[doc = "!< the <tt>\\#sup</tt> symbol"]
490pub const clingo_symbol_type_e_clingo_symbol_type_supremum: clingo_symbol_type_e = 7;
491#[doc = "! Enumeration of available symbol types."]
492pub type clingo_symbol_type_e = ::std::os::raw::c_uint;
493#[doc = "! Corresponding type to ::clingo_symbol_type."]
494pub type clingo_symbol_type_t = ::std::os::raw::c_int;
495#[doc = "! Represents a symbol.\n!\n! This includes numbers, strings, functions (including constants when\n! arguments are empty and tuples when the name is empty), <tt>\\#inf</tt> and <tt>\\#sup</tt>."]
496pub type clingo_symbol_t = u64;
497extern "C" {
498 #[doc = "! Construct a symbol representing a number.\n!\n! @param[in] number the number\n! @param[out] symbol the resulting symbol"]
499 pub fn clingo_symbol_create_number(number: ::std::os::raw::c_int, symbol: *mut clingo_symbol_t);
500}
501extern "C" {
502 #[doc = "! Construct a symbol representing \\#sup.\n!\n! @param[out] symbol the resulting symbol"]
503 pub fn clingo_symbol_create_supremum(symbol: *mut clingo_symbol_t);
504}
505extern "C" {
506 #[doc = "! Construct a symbol representing <tt>\\#inf</tt>.\n!\n! @param[out] symbol the resulting symbol"]
507 pub fn clingo_symbol_create_infimum(symbol: *mut clingo_symbol_t);
508}
509extern "C" {
510 #[doc = "! Construct a symbol representing a string.\n!\n! @param[in] string the string\n! @param[out] symbol the resulting symbol\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
511 pub fn clingo_symbol_create_string(
512 string: *const ::std::os::raw::c_char,
513 symbol: *mut clingo_symbol_t,
514 ) -> bool;
515}
516extern "C" {
517 #[doc = "! Construct a symbol representing an id.\n!\n! @note This is just a shortcut for clingo_symbol_create_function() with\n! empty arguments.\n!\n! @param[in] name the name\n! @param[in] positive whether the symbol has a classical negation sign\n! @param[out] symbol the resulting symbol\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
518 pub fn clingo_symbol_create_id(
519 name: *const ::std::os::raw::c_char,
520 positive: bool,
521 symbol: *mut clingo_symbol_t,
522 ) -> bool;
523}
524extern "C" {
525 #[doc = "! Construct a symbol representing a function or tuple.\n!\n! @note To create tuples, the empty string has to be used as name.\n!\n! @param[in] name the name of the function\n! @param[in] arguments the arguments of the function\n! @param[in] arguments_size the number of arguments\n! @param[in] positive whether the symbol has a classical negation sign\n! @param[out] symbol the resulting symbol\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
526 pub fn clingo_symbol_create_function(
527 name: *const ::std::os::raw::c_char,
528 arguments: *const clingo_symbol_t,
529 arguments_size: usize,
530 positive: bool,
531 symbol: *mut clingo_symbol_t,
532 ) -> bool;
533}
534extern "C" {
535 #[doc = "! Get the number of a symbol.\n!\n! @param[in] symbol the target symbol\n! @param[out] number the resulting number\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime if symbol is not of type ::clingo_symbol_type_number"]
536 pub fn clingo_symbol_number(
537 symbol: clingo_symbol_t,
538 number: *mut ::std::os::raw::c_int,
539 ) -> bool;
540}
541extern "C" {
542 #[doc = "! Get the name of a symbol.\n!\n! @note\n! The string is internalized and valid for the duration of the process.\n!\n! @param[in] symbol the target symbol\n! @param[out] name the resulting name\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime if symbol is not of type ::clingo_symbol_type_function"]
543 pub fn clingo_symbol_name(
544 symbol: clingo_symbol_t,
545 name: *mut *const ::std::os::raw::c_char,
546 ) -> bool;
547}
548extern "C" {
549 #[doc = "! Get the string of a symbol.\n!\n! @note\n! The string is internalized and valid for the duration of the process.\n!\n! @param[in] symbol the target symbol\n! @param[out] string the resulting string\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime if symbol is not of type ::clingo_symbol_type_string"]
550 pub fn clingo_symbol_string(
551 symbol: clingo_symbol_t,
552 string: *mut *const ::std::os::raw::c_char,
553 ) -> bool;
554}
555extern "C" {
556 #[doc = "! Check if a function is positive (does not have a sign).\n!\n! @param[in] symbol the target symbol\n! @param[out] positive the result\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime if symbol is not of type ::clingo_symbol_type_function"]
557 pub fn clingo_symbol_is_positive(symbol: clingo_symbol_t, positive: *mut bool) -> bool;
558}
559extern "C" {
560 #[doc = "! Check if a function is negative (has a sign).\n!\n! @param[in] symbol the target symbol\n! @param[out] negative the result\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime if symbol is not of type ::clingo_symbol_type_function"]
561 pub fn clingo_symbol_is_negative(symbol: clingo_symbol_t, negative: *mut bool) -> bool;
562}
563extern "C" {
564 #[doc = "! Get the arguments of a symbol.\n!\n! @param[in] symbol the target symbol\n! @param[out] arguments the resulting arguments\n! @param[out] arguments_size the number of arguments\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime if symbol is not of type ::clingo_symbol_type_function"]
565 pub fn clingo_symbol_arguments(
566 symbol: clingo_symbol_t,
567 arguments: *mut *const clingo_symbol_t,
568 arguments_size: *mut usize,
569 ) -> bool;
570}
571extern "C" {
572 #[doc = "! Get the type of a symbol.\n!\n! @param[in] symbol the target symbol\n! @return the type of the symbol"]
573 pub fn clingo_symbol_type(symbol: clingo_symbol_t) -> clingo_symbol_type_t;
574}
575extern "C" {
576 #[doc = "! Get the size of the string representation of a symbol (including the terminating 0).\n!\n! @param[in] symbol the target symbol\n! @param[out] size the resulting size\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
577 pub fn clingo_symbol_to_string_size(symbol: clingo_symbol_t, size: *mut usize) -> bool;
578}
579extern "C" {
580 #[doc = "! Get the string representation of a symbol.\n!\n! @param[in] symbol the target symbol\n! @param[out] string the resulting string\n! @param[in] size the size of the string\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n!\n! @see clingo_symbol_to_string_size()"]
581 pub fn clingo_symbol_to_string(
582 symbol: clingo_symbol_t,
583 string: *mut ::std::os::raw::c_char,
584 size: usize,
585 ) -> bool;
586}
587extern "C" {
588 #[doc = "! Check if two symbols are equal.\n!\n! @param[in] a first symbol\n! @param[in] b second symbol\n! @return whether a == b"]
589 pub fn clingo_symbol_is_equal_to(a: clingo_symbol_t, b: clingo_symbol_t) -> bool;
590}
591extern "C" {
592 #[doc = "! Check if a symbol is less than another symbol.\n!\n! Symbols are first compared by type. If the types are equal, the values are\n! compared (where strings are compared using strcmp). Functions are first\n! compared by signature and then lexicographically by arguments.\n!\n! @param[in] a first symbol\n! @param[in] b second symbol\n! @return whether a < b"]
593 pub fn clingo_symbol_is_less_than(a: clingo_symbol_t, b: clingo_symbol_t) -> bool;
594}
595extern "C" {
596 #[doc = "! Calculate a hash code of a symbol.\n!\n! @param[in] symbol the target symbol\n! @return the hash code of the symbol"]
597 pub fn clingo_symbol_hash(symbol: clingo_symbol_t) -> usize;
598}
599extern "C" {
600 #[doc = "! Internalize a string.\n!\n! This functions takes a string as input and returns an equal unique string\n! that is (at the moment) not freed until the program is closed.\n!\n! @param[in] string the string to internalize\n! @param[out] result the internalized string\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
601 pub fn clingo_add_string(
602 string: *const ::std::os::raw::c_char,
603 result: *mut *const ::std::os::raw::c_char,
604 ) -> bool;
605}
606extern "C" {
607 #[doc = "! Parse a term in string form.\n!\n! The result of this function is a symbol. The input term can contain\n! unevaluated functions, which are evaluated during parsing.\n!\n! @param[in] string the string to parse\n! @param[in] logger optional logger to report warnings during parsing\n! @param[in] logger_data user data for the logger\n! @param[in] message_limit maximum number of times to call the logger\n! @param[out] symbol the resulting symbol\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! - ::clingo_error_runtime if parsing fails"]
608 pub fn clingo_parse_term(
609 string: *const ::std::os::raw::c_char,
610 logger: clingo_logger_t,
611 logger_data: *mut ::std::os::raw::c_void,
612 message_limit: ::std::os::raw::c_uint,
613 symbol: *mut clingo_symbol_t,
614 ) -> bool;
615}
616#[repr(C)]
617#[derive(Debug)]
618pub struct clingo_symbolic_atoms {
619 _unused: [u8; 0],
620}
621#[doc = "! Object to inspect symbolic atoms in a program---the relevant Herbrand base\n! gringo uses to instantiate programs.\n!\n! @see clingo_control_symbolic_atoms()"]
622pub type clingo_symbolic_atoms_t = clingo_symbolic_atoms;
623#[doc = "! Object to iterate over symbolic atoms.\n!\n! Such an iterator either points to a symbolic atom within a sequence of\n! symbolic atoms or to the end of the sequence.\n!\n! @note Iterators are valid as long as the underlying sequence is not modified.\n! Operations that can change this sequence are ::clingo_control_ground(),\n! ::clingo_control_cleanup(), and functions that modify the underlying\n! non-ground program."]
624pub type clingo_symbolic_atom_iterator_t = u64;
625extern "C" {
626 #[doc = "! Get the number of different atoms occurring in a logic program.\n!\n! @param[in] atoms the target\n! @param[out] size the number of atoms\n! @return whether the call was successful"]
627 pub fn clingo_symbolic_atoms_size(
628 atoms: *const clingo_symbolic_atoms_t,
629 size: *mut usize,
630 ) -> bool;
631}
632extern "C" {
633 #[doc = "! Get a forward iterator to the beginning of the sequence of all symbolic\n! atoms optionally restricted to a given signature.\n!\n! @param[in] atoms the target\n! @param[in] signature optional signature\n! @param[out] iterator the resulting iterator\n! @return whether the call was successful"]
634 pub fn clingo_symbolic_atoms_begin(
635 atoms: *const clingo_symbolic_atoms_t,
636 signature: *const clingo_signature_t,
637 iterator: *mut clingo_symbolic_atom_iterator_t,
638 ) -> bool;
639}
640extern "C" {
641 #[doc = "! Iterator pointing to the end of the sequence of symbolic atoms.\n!\n! @param[in] atoms the target\n! @param[out] iterator the resulting iterator\n! @return whether the call was successful"]
642 pub fn clingo_symbolic_atoms_end(
643 atoms: *const clingo_symbolic_atoms_t,
644 iterator: *mut clingo_symbolic_atom_iterator_t,
645 ) -> bool;
646}
647extern "C" {
648 #[doc = "! Find a symbolic atom given its symbolic representation.\n!\n! @param[in] atoms the target\n! @param[in] symbol the symbol to lookup\n! @param[out] iterator iterator pointing to the symbolic atom or to the end\n! of the sequence if no corresponding atom is found\n! @return whether the call was successful"]
649 pub fn clingo_symbolic_atoms_find(
650 atoms: *const clingo_symbolic_atoms_t,
651 symbol: clingo_symbol_t,
652 iterator: *mut clingo_symbolic_atom_iterator_t,
653 ) -> bool;
654}
655extern "C" {
656 #[doc = "! Check if two iterators point to the same element (or end of the sequence).\n!\n! @param[in] atoms the target\n! @param[in] a the first iterator\n! @param[in] b the second iterator\n! @param[out] equal whether the two iterators are equal\n! @return whether the call was successful"]
657 pub fn clingo_symbolic_atoms_iterator_is_equal_to(
658 atoms: *const clingo_symbolic_atoms_t,
659 a: clingo_symbolic_atom_iterator_t,
660 b: clingo_symbolic_atom_iterator_t,
661 equal: *mut bool,
662 ) -> bool;
663}
664extern "C" {
665 #[doc = "! Get the symbolic representation of an atom.\n!\n! @param[in] atoms the target\n! @param[in] iterator iterator to the atom\n! @param[out] symbol the resulting symbol\n! @return whether the call was successful"]
666 pub fn clingo_symbolic_atoms_symbol(
667 atoms: *const clingo_symbolic_atoms_t,
668 iterator: clingo_symbolic_atom_iterator_t,
669 symbol: *mut clingo_symbol_t,
670 ) -> bool;
671}
672extern "C" {
673 #[doc = "! Check whether an atom is a fact.\n!\n! @note This does not determine if an atom is a cautious consequence. The\n! grounding or solving component's simplifications can only detect this in\n! some cases.\n!\n! @param[in] atoms the target\n! @param[in] iterator iterator to the atom\n! @param[out] fact whether the atom is a fact\n! @return whether the call was successful"]
674 pub fn clingo_symbolic_atoms_is_fact(
675 atoms: *const clingo_symbolic_atoms_t,
676 iterator: clingo_symbolic_atom_iterator_t,
677 fact: *mut bool,
678 ) -> bool;
679}
680extern "C" {
681 #[doc = "! Check whether an atom is external.\n!\n! An atom is external if it has been defined using an external directive and\n! has not been released or defined by a rule.\n!\n! @param[in] atoms the target\n! @param[in] iterator iterator to the atom\n! @param[out] external whether the atom is a external\n! @return whether the call was successful"]
682 pub fn clingo_symbolic_atoms_is_external(
683 atoms: *const clingo_symbolic_atoms_t,
684 iterator: clingo_symbolic_atom_iterator_t,
685 external: *mut bool,
686 ) -> bool;
687}
688extern "C" {
689 #[doc = "! Returns the (numeric) aspif literal corresponding to the given symbolic atom.\n!\n! Such a literal can be mapped to a solver literal (see the \\ref Propagator\n! module) or be used in rules in aspif format (see the \\ref ProgramBuilder\n! module).\n!\n! @param[in] atoms the target\n! @param[in] iterator iterator to the atom\n! @param[out] literal the associated literal\n! @return whether the call was successful"]
690 pub fn clingo_symbolic_atoms_literal(
691 atoms: *const clingo_symbolic_atoms_t,
692 iterator: clingo_symbolic_atom_iterator_t,
693 literal: *mut clingo_literal_t,
694 ) -> bool;
695}
696extern "C" {
697 #[doc = "! Get the number of different predicate signatures used in the program.\n!\n! @param[in] atoms the target\n! @param[out] size the number of signatures\n! @return whether the call was successful"]
698 pub fn clingo_symbolic_atoms_signatures_size(
699 atoms: *const clingo_symbolic_atoms_t,
700 size: *mut usize,
701 ) -> bool;
702}
703extern "C" {
704 #[doc = "! Get the predicate signatures occurring in a logic program.\n!\n! @param[in] atoms the target\n! @param[out] signatures the resulting signatures\n! @param[in] size the number of signatures\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! - ::clingo_error_runtime if the size is too small\n!\n! @see clingo_symbolic_atoms_signatures_size()"]
705 pub fn clingo_symbolic_atoms_signatures(
706 atoms: *const clingo_symbolic_atoms_t,
707 signatures: *mut clingo_signature_t,
708 size: usize,
709 ) -> bool;
710}
711extern "C" {
712 #[doc = "! Get an iterator to the next element in the sequence of symbolic atoms.\n!\n! @param[in] atoms the target\n! @param[in] iterator the current iterator\n! @param[out] next the succeeding iterator\n! @return whether the call was successful"]
713 pub fn clingo_symbolic_atoms_next(
714 atoms: *const clingo_symbolic_atoms_t,
715 iterator: clingo_symbolic_atom_iterator_t,
716 next: *mut clingo_symbolic_atom_iterator_t,
717 ) -> bool;
718}
719extern "C" {
720 #[doc = "! Check whether the given iterator points to some element with the sequence\n! of symbolic atoms or to the end of the sequence.\n!\n! @param[in] atoms the target\n! @param[in] iterator the iterator\n! @param[out] valid whether the iterator points to some element within the\n! sequence\n! @return whether the call was successful"]
721 pub fn clingo_symbolic_atoms_is_valid(
722 atoms: *const clingo_symbolic_atoms_t,
723 iterator: clingo_symbolic_atom_iterator_t,
724 valid: *mut bool,
725 ) -> bool;
726}
727#[doc = "! Callback function to inject symbols.\n!\n! @param symbols array of symbols\n! @param symbols_size size of the symbol array\n! @param data user data of the callback\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! @see ::clingo_ground_callback_t"]
728pub type clingo_symbol_callback_t = ::std::option::Option<
729 unsafe extern "C" fn(
730 symbols: *const clingo_symbol_t,
731 symbols_size: usize,
732 data: *mut ::std::os::raw::c_void,
733 ) -> bool,
734>;
735#[doc = "!< a tuple term, e.g., `(1,2,3)`"]
736pub const clingo_theory_term_type_e_clingo_theory_term_type_tuple: clingo_theory_term_type_e = 0;
737#[doc = "!< a list term, e.g., `[1,2,3]`"]
738pub const clingo_theory_term_type_e_clingo_theory_term_type_list: clingo_theory_term_type_e = 1;
739#[doc = "!< a set term, e.g., `{1,2,3}`"]
740pub const clingo_theory_term_type_e_clingo_theory_term_type_set: clingo_theory_term_type_e = 2;
741#[doc = "!< a function term, e.g., `f(1,2,3)`"]
742pub const clingo_theory_term_type_e_clingo_theory_term_type_function: clingo_theory_term_type_e = 3;
743#[doc = "!< a number term, e.g., `42`"]
744pub const clingo_theory_term_type_e_clingo_theory_term_type_number: clingo_theory_term_type_e = 4;
745#[doc = "!< a symbol term, e.g., `c`"]
746pub const clingo_theory_term_type_e_clingo_theory_term_type_symbol: clingo_theory_term_type_e = 5;
747#[doc = "! Enumeration of theory term types."]
748pub type clingo_theory_term_type_e = ::std::os::raw::c_uint;
749#[doc = "! Corresponding type to ::clingo_theory_term_type_e."]
750pub type clingo_theory_term_type_t = ::std::os::raw::c_int;
751#[repr(C)]
752#[derive(Debug)]
753pub struct clingo_theory_atoms {
754 _unused: [u8; 0],
755}
756#[doc = "! Container that stores theory atoms, elements, and terms (see @ref clingo_control_theory_atoms())."]
757pub type clingo_theory_atoms_t = clingo_theory_atoms;
758extern "C" {
759 #[doc = "! Get the type of the given theory term.\n!\n! @param[in] atoms container where the term is stored\n! @param[in] term id of the term\n! @param[out] type the resulting type\n! @return whether the call was successful"]
760 pub fn clingo_theory_atoms_term_type(
761 atoms: *const clingo_theory_atoms_t,
762 term: clingo_id_t,
763 type_: *mut clingo_theory_term_type_t,
764 ) -> bool;
765}
766extern "C" {
767 #[doc = "! Get the number of the given numeric theory term.\n!\n! @pre The term must be of type ::clingo_theory_term_type_number.\n! @param[in] atoms container where the term is stored\n! @param[in] term id of the term\n! @param[out] number the resulting number\n! @return whether the call was successful"]
768 pub fn clingo_theory_atoms_term_number(
769 atoms: *const clingo_theory_atoms_t,
770 term: clingo_id_t,
771 number: *mut ::std::os::raw::c_int,
772 ) -> bool;
773}
774extern "C" {
775 #[doc = "! Get the name of the given constant or function theory term.\n!\n! @note\n! The lifetime of the string is tied to the current solve step.\n!\n! @pre The term must be of type ::clingo_theory_term_type_function or ::clingo_theory_term_type_symbol.\n! @param[in] atoms container where the term is stored\n! @param[in] term id of the term\n! @param[out] name the resulting name\n! @return whether the call was successful"]
776 pub fn clingo_theory_atoms_term_name(
777 atoms: *const clingo_theory_atoms_t,
778 term: clingo_id_t,
779 name: *mut *const ::std::os::raw::c_char,
780 ) -> bool;
781}
782extern "C" {
783 #[doc = "! Get the arguments of the given function theory term.\n!\n! @pre The term must be of type ::clingo_theory_term_type_function.\n! @param[in] atoms container where the term is stored\n! @param[in] term id of the term\n! @param[out] arguments the resulting arguments in form of an array of term ids\n! @param[out] size the number of arguments\n! @return whether the call was successful"]
784 pub fn clingo_theory_atoms_term_arguments(
785 atoms: *const clingo_theory_atoms_t,
786 term: clingo_id_t,
787 arguments: *mut *const clingo_id_t,
788 size: *mut usize,
789 ) -> bool;
790}
791extern "C" {
792 #[doc = "! Get the size of the string representation of the given theory term (including the terminating 0).\n!\n! @param[in] atoms container where the term is stored\n! @param[in] term id of the term\n! @param[out] size the resulting size\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
793 pub fn clingo_theory_atoms_term_to_string_size(
794 atoms: *const clingo_theory_atoms_t,
795 term: clingo_id_t,
796 size: *mut usize,
797 ) -> bool;
798}
799extern "C" {
800 #[doc = "! Get the string representation of the given theory term.\n!\n! @param[in] atoms container where the term is stored\n! @param[in] term id of the term\n! @param[out] string the resulting string\n! @param[in] size the size of the string\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime if the size is too small\n! - ::clingo_error_bad_alloc\n!\n! @see clingo_theory_atoms_term_to_string_size()"]
801 pub fn clingo_theory_atoms_term_to_string(
802 atoms: *const clingo_theory_atoms_t,
803 term: clingo_id_t,
804 string: *mut ::std::os::raw::c_char,
805 size: usize,
806 ) -> bool;
807}
808extern "C" {
809 #[doc = "! Get the tuple (array of theory terms) of the given theory element.\n!\n! @param[in] atoms container where the element is stored\n! @param[in] element id of the element\n! @param[out] tuple the resulting array of term ids\n! @param[out] size the number of term ids\n! @return whether the call was successful"]
810 pub fn clingo_theory_atoms_element_tuple(
811 atoms: *const clingo_theory_atoms_t,
812 element: clingo_id_t,
813 tuple: *mut *const clingo_id_t,
814 size: *mut usize,
815 ) -> bool;
816}
817extern "C" {
818 #[doc = "! Get the condition (array of aspif literals) of the given theory element.\n!\n! @param[in] atoms container where the element is stored\n! @param[in] element id of the element\n! @param[out] condition the resulting array of aspif literals\n! @param[out] size the number of term literals\n! @return whether the call was successful"]
819 pub fn clingo_theory_atoms_element_condition(
820 atoms: *const clingo_theory_atoms_t,
821 element: clingo_id_t,
822 condition: *mut *const clingo_literal_t,
823 size: *mut usize,
824 ) -> bool;
825}
826extern "C" {
827 #[doc = "! Get the id of the condition of the given theory element.\n!\n! @note\n! This id can be mapped to a solver literal using clingo_propagate_init_solver_literal().\n! This id is not (necessarily) an aspif literal;\n! to get aspif literals use clingo_theory_atoms_element_condition().\n!\n! @param[in] atoms container where the element is stored\n! @param[in] element id of the element\n! @param[out] condition the resulting condition id\n! @return whether the call was successful"]
828 pub fn clingo_theory_atoms_element_condition_id(
829 atoms: *const clingo_theory_atoms_t,
830 element: clingo_id_t,
831 condition: *mut clingo_literal_t,
832 ) -> bool;
833}
834extern "C" {
835 #[doc = "! Get the size of the string representation of the given theory element (including the terminating 0).\n!\n! @param[in] atoms container where the element is stored\n! @param[in] element id of the element\n! @param[out] size the resulting size\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
836 pub fn clingo_theory_atoms_element_to_string_size(
837 atoms: *const clingo_theory_atoms_t,
838 element: clingo_id_t,
839 size: *mut usize,
840 ) -> bool;
841}
842extern "C" {
843 #[doc = "! Get the string representation of the given theory element.\n!\n! @param[in] atoms container where the element is stored\n! @param[in] element id of the element\n! @param[out] string the resulting string\n! @param[in] size the size of the string\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime if the size is too small\n! - ::clingo_error_bad_alloc"]
844 pub fn clingo_theory_atoms_element_to_string(
845 atoms: *const clingo_theory_atoms_t,
846 element: clingo_id_t,
847 string: *mut ::std::os::raw::c_char,
848 size: usize,
849 ) -> bool;
850}
851extern "C" {
852 #[doc = "! Get the total number of theory atoms.\n!\n! @param[in] atoms the target\n! @param[out] size the resulting number\n! @return whether the call was successful"]
853 pub fn clingo_theory_atoms_size(atoms: *const clingo_theory_atoms_t, size: *mut usize) -> bool;
854}
855extern "C" {
856 #[doc = "! Get the theory term associated with the theory atom.\n!\n! @param[in] atoms container where the atom is stored\n! @param[in] atom id of the atom\n! @param[out] term the resulting term id\n! @return whether the call was successful"]
857 pub fn clingo_theory_atoms_atom_term(
858 atoms: *const clingo_theory_atoms_t,
859 atom: clingo_id_t,
860 term: *mut clingo_id_t,
861 ) -> bool;
862}
863extern "C" {
864 #[doc = "! Get the theory elements associated with the theory atom.\n!\n! @param[in] atoms container where the atom is stored\n! @param[in] atom id of the atom\n! @param[out] elements the resulting array of elements\n! @param[out] size the number of elements\n! @return whether the call was successful"]
865 pub fn clingo_theory_atoms_atom_elements(
866 atoms: *const clingo_theory_atoms_t,
867 atom: clingo_id_t,
868 elements: *mut *const clingo_id_t,
869 size: *mut usize,
870 ) -> bool;
871}
872extern "C" {
873 #[doc = "! Whether the theory atom has a guard.\n!\n! @param[in] atoms container where the atom is stored\n! @param[in] atom id of the atom\n! @param[out] has_guard whether the theory atom has a guard\n! @return whether the call was successful"]
874 pub fn clingo_theory_atoms_atom_has_guard(
875 atoms: *const clingo_theory_atoms_t,
876 atom: clingo_id_t,
877 has_guard: *mut bool,
878 ) -> bool;
879}
880extern "C" {
881 #[doc = "! Get the guard consisting of a theory operator and a theory term of the given theory atom.\n!\n! @note\n! The lifetime of the string is tied to the current solve step.\n!\n! @param[in] atoms container where the atom is stored\n! @param[in] atom id of the atom\n! @param[out] connective the resulting theory operator\n! @param[out] term the resulting term\n! @return whether the call was successful"]
882 pub fn clingo_theory_atoms_atom_guard(
883 atoms: *const clingo_theory_atoms_t,
884 atom: clingo_id_t,
885 connective: *mut *const ::std::os::raw::c_char,
886 term: *mut clingo_id_t,
887 ) -> bool;
888}
889extern "C" {
890 #[doc = "! Get the aspif literal associated with the given theory atom.\n!\n! @param[in] atoms container where the atom is stored\n! @param[in] atom id of the atom\n! @param[out] literal the resulting literal\n! @return whether the call was successful"]
891 pub fn clingo_theory_atoms_atom_literal(
892 atoms: *const clingo_theory_atoms_t,
893 atom: clingo_id_t,
894 literal: *mut clingo_literal_t,
895 ) -> bool;
896}
897extern "C" {
898 #[doc = "! Get the size of the string representation of the given theory atom (including the terminating 0).\n!\n! @param[in] atoms container where the atom is stored\n! @param[in] atom id of the element\n! @param[out] size the resulting size\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
899 pub fn clingo_theory_atoms_atom_to_string_size(
900 atoms: *const clingo_theory_atoms_t,
901 atom: clingo_id_t,
902 size: *mut usize,
903 ) -> bool;
904}
905extern "C" {
906 #[doc = "! Get the string representation of the given theory atom.\n!\n! @param[in] atoms container where the atom is stored\n! @param[in] atom id of the element\n! @param[out] string the resulting string\n! @param[in] size the size of the string\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime if the size is too small\n! - ::clingo_error_bad_alloc"]
907 pub fn clingo_theory_atoms_atom_to_string(
908 atoms: *const clingo_theory_atoms_t,
909 atom: clingo_id_t,
910 string: *mut ::std::os::raw::c_char,
911 size: usize,
912 ) -> bool;
913}
914#[repr(C)]
915#[derive(Debug)]
916pub struct clingo_assignment {
917 _unused: [u8; 0],
918}
919#[doc = "! Represents a (partial) assignment of a particular solver.\n!\n! An assignment assigns truth values to a set of literals.\n! A literal is assigned to either @link clingo_assignment_truth_value() true or false, or is unassigned@endlink.\n! Furthermore, each assigned literal is associated with a @link clingo_assignment_level() decision level@endlink.\n! There is exactly one @link clingo_assignment_decision() decision literal@endlink for each decision level greater than zero.\n! Assignments to all other literals on the same level are consequences implied by the current and possibly previous decisions.\n! Assignments on level zero are immediate consequences of the current program.\n! Decision levels are consecutive numbers starting with zero up to and including the @link clingo_assignment_decision_level() current decision level@endlink."]
920pub type clingo_assignment_t = clingo_assignment;
921extern "C" {
922 #[doc = "! Get the current decision level.\n!\n! @param[in] assignment the target assignment\n! @return the decision level"]
923 pub fn clingo_assignment_decision_level(assignment: *const clingo_assignment_t) -> u32;
924}
925extern "C" {
926 #[doc = "! Get the current root level.\n!\n! Decisions levels smaller or equal to the root level are not backtracked during solving.\n!\n! @param[in] assignment the target assignment\n! @return the decision level"]
927 pub fn clingo_assignment_root_level(assignment: *const clingo_assignment_t) -> u32;
928}
929extern "C" {
930 #[doc = "! Check if the given assignment is conflicting.\n!\n! @param[in] assignment the target assignment\n! @return whether the assignment is conflicting"]
931 pub fn clingo_assignment_has_conflict(assignment: *const clingo_assignment_t) -> bool;
932}
933extern "C" {
934 #[doc = "! Check if the given literal is part of a (partial) assignment.\n!\n! @param[in] assignment the target assignment\n! @param[in] literal the literal\n! @return whether the literal is valid"]
935 pub fn clingo_assignment_has_literal(
936 assignment: *const clingo_assignment_t,
937 literal: clingo_literal_t,
938 ) -> bool;
939}
940extern "C" {
941 #[doc = "! Determine the decision level of a given literal.\n!\n! @param[in] assignment the target assignment\n! @param[in] literal the literal\n! @param[out] level the resulting level\n! @return whether the call was successful"]
942 pub fn clingo_assignment_level(
943 assignment: *const clingo_assignment_t,
944 literal: clingo_literal_t,
945 level: *mut u32,
946 ) -> bool;
947}
948extern "C" {
949 #[doc = "! Determine the decision literal given a decision level.\n!\n! @param[in] assignment the target assignment\n! @param[in] level the level\n! @param[out] literal the resulting literal\n! @return whether the call was successful"]
950 pub fn clingo_assignment_decision(
951 assignment: *const clingo_assignment_t,
952 level: u32,
953 literal: *mut clingo_literal_t,
954 ) -> bool;
955}
956extern "C" {
957 #[doc = "! Check if a literal has a fixed truth value.\n!\n! @param[in] assignment the target assignment\n! @param[in] literal the literal\n! @param[out] is_fixed whether the literal is fixed\n! @return whether the call was successful"]
958 pub fn clingo_assignment_is_fixed(
959 assignment: *const clingo_assignment_t,
960 literal: clingo_literal_t,
961 is_fixed: *mut bool,
962 ) -> bool;
963}
964extern "C" {
965 #[doc = "! Check if a literal is true.\n!\n! @param[in] assignment the target assignment\n! @param[in] literal the literal\n! @param[out] is_true whether the literal is true\n! @return whether the call was successful\n! @see clingo_assignment_truth_value()"]
966 pub fn clingo_assignment_is_true(
967 assignment: *const clingo_assignment_t,
968 literal: clingo_literal_t,
969 is_true: *mut bool,
970 ) -> bool;
971}
972extern "C" {
973 #[doc = "! Check if a literal has a fixed truth value.\n!\n! @param[in] assignment the target assignment\n! @param[in] literal the literal\n! @param[out] is_false whether the literal is false\n! @return whether the call was successful\n! @see clingo_assignment_truth_value()"]
974 pub fn clingo_assignment_is_false(
975 assignment: *const clingo_assignment_t,
976 literal: clingo_literal_t,
977 is_false: *mut bool,
978 ) -> bool;
979}
980extern "C" {
981 #[doc = "! Determine the truth value of a given literal.\n!\n! @param[in] assignment the target assignment\n! @param[in] literal the literal\n! @param[out] value the resulting truth value\n! @return whether the call was successful"]
982 pub fn clingo_assignment_truth_value(
983 assignment: *const clingo_assignment_t,
984 literal: clingo_literal_t,
985 value: *mut clingo_truth_value_t,
986 ) -> bool;
987}
988extern "C" {
989 #[doc = "! The number of (positive) literals in the assignment.\n!\n! @param[in] assignment the target\n! @return the number of literals"]
990 pub fn clingo_assignment_size(assignment: *const clingo_assignment_t) -> usize;
991}
992extern "C" {
993 #[doc = "! The (positive) literal at the given offset in the assignment.\n!\n! @param[in] assignment the target\n! @param[in] offset the offset of the literal\n! @param[out] literal the literal\n! @return whether the call was successful"]
994 pub fn clingo_assignment_at(
995 assignment: *const clingo_assignment_t,
996 offset: usize,
997 literal: *mut clingo_literal_t,
998 ) -> bool;
999}
1000extern "C" {
1001 #[doc = "! Check if the assignment is total, i.e. there are no free literal.\n!\n! @param[in] assignment the target\n! @return wheather the assignment is total"]
1002 pub fn clingo_assignment_is_total(assignment: *const clingo_assignment_t) -> bool;
1003}
1004extern "C" {
1005 #[doc = "! Returns the number of literals in the trail, i.e., the number of assigned literals.\n!\n! @param[in] assignment the target\n! @param[out] size the number of literals in the trail\n! @return whether the call was successful"]
1006 pub fn clingo_assignment_trail_size(
1007 assignment: *const clingo_assignment_t,
1008 size: *mut u32,
1009 ) -> bool;
1010}
1011extern "C" {
1012 #[doc = "! Returns the offset of the decision literal with the given decision level in\n! the trail.\n!\n! @note Literals in the trail are ordered by decision levels, where the first\n! literal with a larger level than the previous literals is a decision; the\n! following literals with same level are implied by this decision literal.\n! Each decision level up to and including the current decision level has a\n! valid offset in the trail.\n!\n! @param[in] assignment the target\n! @param[in] level the decision level\n! @param[out] offset the offset of the decision literal\n! @return whether the call was successful"]
1013 pub fn clingo_assignment_trail_begin(
1014 assignment: *const clingo_assignment_t,
1015 level: u32,
1016 offset: *mut u32,
1017 ) -> bool;
1018}
1019extern "C" {
1020 #[doc = "! Returns the offset following the last literal with the given decision level.\n!\n! @note This function is the counter part to clingo_assignment_trail_begin().\n!\n! @param[in] assignment the target\n! @param[in] level the decision level\n! @param[out] offset the offset\n! @return whether the call was successful"]
1021 pub fn clingo_assignment_trail_end(
1022 assignment: *const clingo_assignment_t,
1023 level: u32,
1024 offset: *mut u32,
1025 ) -> bool;
1026}
1027extern "C" {
1028 #[doc = "! Returns the literal at the given position in the trail.\n!\n! @param[in] assignment the target\n! @param[in] offset the offset of the literal\n! @param[out] literal the literal\n! @return whether the call was successful"]
1029 pub fn clingo_assignment_trail_at(
1030 assignment: *const clingo_assignment_t,
1031 offset: u32,
1032 literal: *mut clingo_literal_t,
1033 ) -> bool;
1034}
1035#[doc = "!< do not call @ref ::clingo_propagator::check() at all"]
1036pub const clingo_propagator_check_mode_e_clingo_propagator_check_mode_none:
1037 clingo_propagator_check_mode_e = 0;
1038#[doc = "!< call @ref ::clingo_propagator::check() on total assignments"]
1039pub const clingo_propagator_check_mode_e_clingo_propagator_check_mode_total:
1040 clingo_propagator_check_mode_e = 1;
1041#[doc = "!< call @ref ::clingo_propagator::check() on propagation fixpoints"]
1042pub const clingo_propagator_check_mode_e_clingo_propagator_check_mode_fixpoint:
1043 clingo_propagator_check_mode_e = 2;
1044#[doc = "!< call @ref ::clingo_propagator::check() on propagation fixpoints and total assignments"]
1045pub const clingo_propagator_check_mode_e_clingo_propagator_check_mode_both:
1046 clingo_propagator_check_mode_e = 3;
1047#[doc = "! Supported check modes for propagators.\n!\n! Note that total checks are subject to the lock when a model is found.\n! This means that information from previously found models can be used to discard assignments in check calls."]
1048pub type clingo_propagator_check_mode_e = ::std::os::raw::c_uint;
1049#[doc = "! Corresponding type to ::clingo_propagator_check_mode_e."]
1050pub type clingo_propagator_check_mode_t = ::std::os::raw::c_int;
1051#[doc = "!< the weight constraint implies the literal"]
1052pub const clingo_weight_constraint_type_e_clingo_weight_constraint_type_implication_left:
1053 clingo_weight_constraint_type_e = -1;
1054#[doc = "!< the literal implies the weight constraint"]
1055pub const clingo_weight_constraint_type_e_clingo_weight_constraint_type_implication_right:
1056 clingo_weight_constraint_type_e = 1;
1057#[doc = "!< the weight constraint is equivalent to the literal"]
1058pub const clingo_weight_constraint_type_e_clingo_weight_constraint_type_equivalence:
1059 clingo_weight_constraint_type_e = 0;
1060#[doc = "! Enumeration of weight_constraint_types."]
1061pub type clingo_weight_constraint_type_e = ::std::os::raw::c_int;
1062#[doc = "! Corresponding type to ::clingo_weight_constraint_type_e."]
1063pub type clingo_weight_constraint_type_t = ::std::os::raw::c_int;
1064#[repr(C)]
1065#[derive(Debug)]
1066pub struct clingo_propagate_init {
1067 _unused: [u8; 0],
1068}
1069#[doc = "! Object to initialize a user-defined propagator before each solving step.\n!\n! Each @link SymbolicAtoms symbolic@endlink or @link TheoryAtoms theory atom@endlink is uniquely associated with an aspif atom in form of a positive integer (@ref ::clingo_literal_t).\n! Aspif literals additionally are signed to represent default negation.\n! Furthermore, there are non-zero integer solver literals (also represented using @ref ::clingo_literal_t).\n! There is a surjective mapping from program atoms to solver literals.\n!\n! All methods called during propagation use solver literals whereas clingo_symbolic_atoms_literal() and clingo_theory_atoms_atom_literal() return program literals.\n! The function clingo_propagate_init_solver_literal() can be used to map program literals or @link clingo_theory_atoms_element_condition_id() condition ids@endlink to solver literals."]
1070pub type clingo_propagate_init_t = clingo_propagate_init;
1071extern "C" {
1072 #[doc = "! Map the given program literal or condition id to its solver literal.\n!\n! @param[in] init the target\n! @param[in] aspif_literal the aspif literal to map\n! @param[out] solver_literal the resulting solver literal\n! @return whether the call was successful"]
1073 pub fn clingo_propagate_init_solver_literal(
1074 init: *const clingo_propagate_init_t,
1075 aspif_literal: clingo_literal_t,
1076 solver_literal: *mut clingo_literal_t,
1077 ) -> bool;
1078}
1079extern "C" {
1080 #[doc = "! Add a watch for the solver literal in the given phase.\n!\n! @param[in] init the target\n! @param[in] solver_literal the solver literal\n! @return whether the call was successful"]
1081 pub fn clingo_propagate_init_add_watch(
1082 init: *mut clingo_propagate_init_t,
1083 solver_literal: clingo_literal_t,
1084 ) -> bool;
1085}
1086extern "C" {
1087 #[doc = "! Add a watch for the solver literal in the given phase to the given solver thread.\n!\n! @param[in] init the target\n! @param[in] solver_literal the solver literal\n! @param[in] thread_id the id of the solver thread\n! @return whether the call was successful"]
1088 pub fn clingo_propagate_init_add_watch_to_thread(
1089 init: *mut clingo_propagate_init_t,
1090 solver_literal: clingo_literal_t,
1091 thread_id: clingo_id_t,
1092 ) -> bool;
1093}
1094extern "C" {
1095 #[doc = "! Remove the watch for the solver literal in the given phase.\n!\n! @param[in] init the target\n! @param[in] solver_literal the solver literal\n! @return whether the call was successful"]
1096 pub fn clingo_propagate_init_remove_watch(
1097 init: *mut clingo_propagate_init_t,
1098 solver_literal: clingo_literal_t,
1099 ) -> bool;
1100}
1101extern "C" {
1102 #[doc = "! Remove the watch for the solver literal in the given phase from the given solver thread.\n!\n! @param[in] init the target\n! @param[in] solver_literal the solver literal\n! @param[in] thread_id the id of the solver thread\n! @return whether the call was successful"]
1103 pub fn clingo_propagate_init_remove_watch_from_thread(
1104 init: *mut clingo_propagate_init_t,
1105 solver_literal: clingo_literal_t,
1106 thread_id: u32,
1107 ) -> bool;
1108}
1109extern "C" {
1110 #[doc = "! Freeze the given solver literal.\n!\n! Any solver literal that is not frozen is subject to simplification and might be removed in a preprocessing step after propagator initialization.\n! A propagator should freeze all literals over which it might add clauses during propagation.\n! Note that any watched literal is automatically frozen and that it does not matter which phase of the literal is frozen.\n!\n! @param[in] init the target\n! @param[in] solver_literal the solver literal\n! @return whether the call was successful"]
1111 pub fn clingo_propagate_init_freeze_literal(
1112 init: *mut clingo_propagate_init_t,
1113 solver_literal: clingo_literal_t,
1114 ) -> bool;
1115}
1116extern "C" {
1117 #[doc = "! Get an object to inspect the symbolic atoms.\n!\n! @param[in] init the target\n! @param[out] atoms the resulting object\n! @return whether the call was successful"]
1118 pub fn clingo_propagate_init_symbolic_atoms(
1119 init: *const clingo_propagate_init_t,
1120 atoms: *mut *const clingo_symbolic_atoms_t,
1121 ) -> bool;
1122}
1123extern "C" {
1124 #[doc = "! Get an object to inspect the theory atoms.\n!\n! @param[in] init the target\n! @param[out] atoms the resulting object\n! @return whether the call was successful"]
1125 pub fn clingo_propagate_init_theory_atoms(
1126 init: *const clingo_propagate_init_t,
1127 atoms: *mut *const clingo_theory_atoms_t,
1128 ) -> bool;
1129}
1130extern "C" {
1131 #[doc = "! Get the number of threads used in subsequent solving.\n!\n! @param[in] init the target\n! @return the number of threads\n! @see clingo_propagate_control_thread_id()"]
1132 pub fn clingo_propagate_init_number_of_threads(
1133 init: *const clingo_propagate_init_t,
1134 ) -> ::std::os::raw::c_int;
1135}
1136extern "C" {
1137 #[doc = "! Configure when to call the check method of the propagator.\n!\n! @param[in] init the target\n! @param[in] mode bitmask when to call the propagator\n! @see @ref ::clingo_propagator::check()"]
1138 pub fn clingo_propagate_init_set_check_mode(
1139 init: *mut clingo_propagate_init_t,
1140 mode: clingo_propagator_check_mode_t,
1141 );
1142}
1143extern "C" {
1144 #[doc = "! Get the current check mode of the propagator.\n!\n! @param[in] init the target\n! @return bitmask when to call the propagator\n! @see clingo_propagate_init_set_check_mode()"]
1145 pub fn clingo_propagate_init_get_check_mode(
1146 init: *const clingo_propagate_init_t,
1147 ) -> clingo_propagator_check_mode_t;
1148}
1149extern "C" {
1150 #[doc = "! Get the top level assignment solver.\n!\n! @param[in] init the target\n! @return the assignment"]
1151 pub fn clingo_propagate_init_assignment(
1152 init: *const clingo_propagate_init_t,
1153 ) -> *const clingo_assignment_t;
1154}
1155extern "C" {
1156 #[doc = "! Add a literal to the solver.\n!\n! To be able to use the variable in clauses during propagation or add watches to it, it has to be frozen.\n! Otherwise, it might be removed during preprocessing.\n!\n! @attention If varibales were added, subsequent calls to functions adding constraints or ::clingo_propagate_init_propagate() are expensive.\n! It is best to add varables in batches.\n!\n! @param[in] init the target\n! @param[in] freeze whether to freeze the literal\n! @param[out] result the added literal\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1157 pub fn clingo_propagate_init_add_literal(
1158 init: *mut clingo_propagate_init_t,
1159 freeze: bool,
1160 result: *mut clingo_literal_t,
1161 ) -> bool;
1162}
1163extern "C" {
1164 #[doc = "! Add the given clause to the solver.\n!\n! @attention No further calls on the init object or functions on the assignment should be called when the result of this method is false.\n!\n! @param[in] init the target\n! @param[in] clause the clause to add\n! @param[in] size the size of the clause\n! @param[out] result result indicating whether the problem became unsatisfiable\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1165 pub fn clingo_propagate_init_add_clause(
1166 init: *mut clingo_propagate_init_t,
1167 clause: *const clingo_literal_t,
1168 size: usize,
1169 result: *mut bool,
1170 ) -> bool;
1171}
1172extern "C" {
1173 #[doc = "! Add the given weight constraint to the solver.\n!\n! This function adds a constraint of form `literal <=> { lit=weight | (lit, weight) in literals } >= bound` to the solver.\n! Depending on the type the `<=>` connective can be either a left implication, right implication, or equivalence.\n!\n! @attention No further calls on the init object or functions on the assignment should be called when the result of this method is false.\n!\n! @param[in] init the target\n! @param[in] literal the literal of the constraint\n! @param[in] literals the weighted literals\n! @param[in] size the number of weighted literals\n! @param[in] bound the bound of the constraint\n! @param[in] type the type of the weight constraint\n! @param[in] compare_equal if true compare equal instead of less than equal\n! @param[out] result result indicating whether the problem became unsatisfiable\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1174 pub fn clingo_propagate_init_add_weight_constraint(
1175 init: *mut clingo_propagate_init_t,
1176 literal: clingo_literal_t,
1177 literals: *const clingo_weighted_literal_t,
1178 size: usize,
1179 bound: clingo_weight_t,
1180 type_: clingo_weight_constraint_type_t,
1181 compare_equal: bool,
1182 result: *mut bool,
1183 ) -> bool;
1184}
1185extern "C" {
1186 #[doc = "! Add the given literal to minimize to the solver.\n!\n! This corresponds to a weak constraint of form `:~ literal. [weight@priority]`.\n!\n! @param[in] init the target\n! @param[in] literal the literal to minimize\n! @param[in] weight the weight of the literal\n! @param[in] priority the priority of the literal\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1187 pub fn clingo_propagate_init_add_minimize(
1188 init: *mut clingo_propagate_init_t,
1189 literal: clingo_literal_t,
1190 weight: clingo_weight_t,
1191 priority: clingo_weight_t,
1192 ) -> bool;
1193}
1194extern "C" {
1195 #[doc = "! Propagates consequences of the underlying problem excluding registered propagators.\n!\n! @note The function has no effect if SAT-preprocessing is enabled.\n! @attention No further calls on the init object or functions on the assignment should be called when the result of this method is false.\n!\n! @param[in] init the target\n! @param[out] result result indicating whether the problem became unsatisfiable\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1196 pub fn clingo_propagate_init_propagate(
1197 init: *mut clingo_propagate_init_t,
1198 result: *mut bool,
1199 ) -> bool;
1200}
1201#[doc = "!< clause is subject to the solvers deletion policy"]
1202pub const clingo_clause_type_e_clingo_clause_type_learnt: clingo_clause_type_e = 0;
1203#[doc = "!< clause is not subject to the solvers deletion policy"]
1204pub const clingo_clause_type_e_clingo_clause_type_static: clingo_clause_type_e = 1;
1205#[doc = "!< like ::clingo_clause_type_learnt but the clause is deleted after a solving step"]
1206pub const clingo_clause_type_e_clingo_clause_type_volatile: clingo_clause_type_e = 2;
1207#[doc = "!< like ::clingo_clause_type_static but the clause is deleted after a solving step"]
1208pub const clingo_clause_type_e_clingo_clause_type_volatile_static: clingo_clause_type_e = 3;
1209#[doc = "! Enumeration of clause types determining the lifetime of a clause.\n!\n! Clauses in the solver are either cleaned up based on a configurable deletion policy or at the end of a solving step.\n! The values of this enumeration determine if a clause is subject to one of the above deletion strategies."]
1210pub type clingo_clause_type_e = ::std::os::raw::c_uint;
1211#[doc = "! Corresponding type to ::clingo_clause_type_e."]
1212pub type clingo_clause_type_t = ::std::os::raw::c_int;
1213#[repr(C)]
1214#[derive(Debug)]
1215pub struct clingo_propagate_control {
1216 _unused: [u8; 0],
1217}
1218#[doc = "! This object can be used to add clauses and propagate literals while solving."]
1219pub type clingo_propagate_control_t = clingo_propagate_control;
1220extern "C" {
1221 #[doc = "! Get the id of the underlying solver thread.\n!\n! Thread ids are consecutive numbers starting with zero.\n!\n! @param[in] control the target\n! @return the thread id"]
1222 pub fn clingo_propagate_control_thread_id(
1223 control: *const clingo_propagate_control_t,
1224 ) -> clingo_id_t;
1225}
1226extern "C" {
1227 #[doc = "! Get the assignment associated with the underlying solver.\n!\n! @param[in] control the target\n! @return the assignment"]
1228 pub fn clingo_propagate_control_assignment(
1229 control: *const clingo_propagate_control_t,
1230 ) -> *const clingo_assignment_t;
1231}
1232extern "C" {
1233 #[doc = "! Adds a new volatile literal to the underlying solver thread.\n!\n! @attention The literal is only valid within the current solving step and solver thread.\n! All volatile literals and clauses involving a volatile literal are deleted after the current search.\n!\n! @param[in] control the target\n! @param[out] result the (positive) solver literal\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! - ::clingo_error_logic if the assignment is conflicting"]
1234 pub fn clingo_propagate_control_add_literal(
1235 control: *mut clingo_propagate_control_t,
1236 result: *mut clingo_literal_t,
1237 ) -> bool;
1238}
1239extern "C" {
1240 #[doc = "! Add a watch for the solver literal in the given phase.\n!\n! @note Unlike @ref clingo_propagate_init_add_watch() this does not add a watch to all solver threads but just the current one.\n!\n! @param[in] control the target\n! @param[in] literal the literal to watch\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! - ::clingo_error_logic if the literal is invalid\n! @see clingo_propagate_control_remove_watch()"]
1241 pub fn clingo_propagate_control_add_watch(
1242 control: *mut clingo_propagate_control_t,
1243 literal: clingo_literal_t,
1244 ) -> bool;
1245}
1246extern "C" {
1247 #[doc = "! Check whether a literal is watched in the current solver thread.\n!\n! @param[in] control the target\n! @param[in] literal the literal to check\n!\n! @return whether the literal is watched"]
1248 pub fn clingo_propagate_control_has_watch(
1249 control: *const clingo_propagate_control_t,
1250 literal: clingo_literal_t,
1251 ) -> bool;
1252}
1253extern "C" {
1254 #[doc = "! Removes the watch (if any) for the given solver literal.\n!\n! @note Similar to @ref clingo_propagate_init_add_watch() this just removes the watch in the current solver thread.\n!\n! @param[in] control the target\n! @param[in] literal the literal to remove"]
1255 pub fn clingo_propagate_control_remove_watch(
1256 control: *mut clingo_propagate_control_t,
1257 literal: clingo_literal_t,
1258 );
1259}
1260extern "C" {
1261 #[doc = "! Add the given clause to the solver.\n!\n! This method sets its result to false if the current propagation must be stopped for the solver to backtrack.\n!\n! @attention No further calls on the control object or functions on the assignment should be called when the result of this method is false.\n!\n! @param[in] control the target\n! @param[in] clause the clause to add\n! @param[in] size the size of the clause\n! @param[in] type the clause type determining its lifetime\n! @param[out] result result indicating whether propagation has to be stopped\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1262 pub fn clingo_propagate_control_add_clause(
1263 control: *mut clingo_propagate_control_t,
1264 clause: *const clingo_literal_t,
1265 size: usize,
1266 type_: clingo_clause_type_t,
1267 result: *mut bool,
1268 ) -> bool;
1269}
1270extern "C" {
1271 #[doc = "! Propagate implied literals (resulting from added clauses).\n!\n! This method sets its result to false if the current propagation must be stopped for the solver to backtrack.\n!\n! @attention No further calls on the control object or functions on the assignment should be called when the result of this method is false.\n!\n! @param[in] control the target\n! @param[out] result result indicating whether propagation has to be stopped\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1272 pub fn clingo_propagate_control_propagate(
1273 control: *mut clingo_propagate_control_t,
1274 result: *mut bool,
1275 ) -> bool;
1276}
1277#[doc = "! Typedef for @ref ::clingo_propagator::init()."]
1278pub type clingo_propagator_init_callback_t = ::std::option::Option<
1279 unsafe extern "C" fn(
1280 arg1: *mut clingo_propagate_init_t,
1281 arg2: *mut ::std::os::raw::c_void,
1282 ) -> bool,
1283>;
1284#[doc = "! Typedef for @ref ::clingo_propagator::propagate()."]
1285pub type clingo_propagator_propagate_callback_t = ::std::option::Option<
1286 unsafe extern "C" fn(
1287 arg1: *mut clingo_propagate_control_t,
1288 arg2: *const clingo_literal_t,
1289 arg3: usize,
1290 arg4: *mut ::std::os::raw::c_void,
1291 ) -> bool,
1292>;
1293#[doc = "! Typedef for @ref ::clingo_propagator::undo()."]
1294pub type clingo_propagator_undo_callback_t = ::std::option::Option<
1295 unsafe extern "C" fn(
1296 arg1: *const clingo_propagate_control_t,
1297 arg2: *const clingo_literal_t,
1298 arg3: usize,
1299 arg4: *mut ::std::os::raw::c_void,
1300 ),
1301>;
1302#[doc = "! Typedef for @ref ::clingo_propagator::check()."]
1303pub type clingo_propagator_check_callback_t = ::std::option::Option<
1304 unsafe extern "C" fn(
1305 arg1: *mut clingo_propagate_control_t,
1306 arg2: *mut ::std::os::raw::c_void,
1307 ) -> bool,
1308>;
1309#[doc = "! An instance of this struct has to be registered with a solver to implement a custom propagator.\n!\n! Not all callbacks have to be implemented and can be set to NULL if not needed.\n! @see Propagator"]
1310#[repr(C)]
1311#[derive(Debug, Copy, Clone)]
1312pub struct clingo_propagator {
1313 #[doc = "! This function is called once before each solving step.\n! It is used to map relevant program literals to solver literals, add watches for solver literals, and initialize the data structures used during propagation.\n!\n! @note This is the last point to access symbolic and theory atoms.\n! Once the search has started, they are no longer accessible.\n!\n! @param[in] init initizialization object\n! @param[in] data user data for the callback\n! @return whether the call was successful\n! @see ::clingo_propagator_init_callback_t"]
1314 pub init: ::std::option::Option<
1315 unsafe extern "C" fn(
1316 init: *mut clingo_propagate_init_t,
1317 data: *mut ::std::os::raw::c_void,
1318 ) -> bool,
1319 >,
1320 #[doc = "! Can be used to propagate solver literals given a @link clingo_assignment_t partial assignment@endlink.\n!\n! Called during propagation with a non-empty array of @link clingo_propagate_init_add_watch() watched solver literals@endlink\n! that have been assigned to true since the last call to either propagate, undo, (or the start of the search) - the change set.\n! Only watched solver literals are contained in the change set.\n! Each literal in the change set is true w.r.t. the current @link clingo_assignment_t assignment@endlink.\n! @ref clingo_propagate_control_add_clause() can be used to add clauses.\n! If a clause is unit resulting, it can be propagated using @ref clingo_propagate_control_propagate().\n! If the result of either of the two methods is false, the propagate function must return immediately.\n!\n! The following snippet shows how to use the methods to add clauses and propagate consequences within the callback.\n! The important point is to return true (true to indicate there was no error) if the result of either of the methods is false.\n! ~~~~~~~~~~~~~~~{.c}\n! bool result;\n! clingo_literal_t clause[] = { ... };\n!\n! // add a clause\n! if (!clingo_propagate_control_add_clause(control, clause, clingo_clause_type_learnt, &result) { return false; }\n! if (!result) { return true; }\n! // propagate its consequences\n! if (!clingo_propagate_control_propagate(control, &result) { return false; }\n! if (!result) { return true; }\n!\n! // add further clauses and propagate them\n! ...\n!\n! return true;\n! ~~~~~~~~~~~~~~~\n!\n! @note\n! This function can be called from different solving threads.\n! Each thread has its own assignment and id, which can be obtained using @ref clingo_propagate_control_thread_id().\n!\n! @param[in] control control object for the target solver\n! @param[in] changes the change set\n! @param[in] size the size of the change set\n! @param[in] data user data for the callback\n! @return whether the call was successful\n! @see ::clingo_propagator_propagate_callback_t"]
1321 pub propagate: ::std::option::Option<
1322 unsafe extern "C" fn(
1323 control: *mut clingo_propagate_control_t,
1324 changes: *const clingo_literal_t,
1325 size: usize,
1326 data: *mut ::std::os::raw::c_void,
1327 ) -> bool,
1328 >,
1329 #[doc = "! Called whenever a solver undoes assignments to watched solver literals.\n!\n! This callback is meant to update assignment dependent state in the propagator.\n!\n! @note No clauses must be propagated in this callback and no errors should be set.\n!\n! @param[in] control control object for the target solver\n! @param[in] changes the change set\n! @param[in] size the size of the change set\n! @param[in] data user data for the callback\n! @return whether the call was successful\n! @see ::clingo_propagator_undo_callback_t"]
1330 pub undo: ::std::option::Option<
1331 unsafe extern "C" fn(
1332 control: *const clingo_propagate_control_t,
1333 changes: *const clingo_literal_t,
1334 size: usize,
1335 data: *mut ::std::os::raw::c_void,
1336 ),
1337 >,
1338 #[doc = "! This function is similar to @ref clingo_propagate_control_propagate() but is called without a change set on propagation fixpoints.\n!\n! When exactly this function is called, can be configured using the @ref clingo_propagate_init_set_check_mode() function.\n!\n! @note This function is called even if no watches have been added.\n!\n! @param[in] control control object for the target solver\n! @param[in] data user data for the callback\n! @return whether the call was successful\n! @see ::clingo_propagator_check_callback_t"]
1339 pub check: ::std::option::Option<
1340 unsafe extern "C" fn(
1341 control: *mut clingo_propagate_control_t,
1342 data: *mut ::std::os::raw::c_void,
1343 ) -> bool,
1344 >,
1345 #[doc = "! This function allows a propagator to implement domain-specific heuristics.\n!\n! It is called whenever propagation reaches a fixed point and\n! should return a free solver literal that is to be assigned true.\n! In case multiple propagators are registered,\n! this function can return 0 to let a propagator registered later make a decision.\n! If all propagators return 0, then the fallback literal is\n!\n! @param[in] thread_id the solver's thread id\n! @param[in] assignment the assignment of the solver\n! @param[in] fallback the literal choosen by the solver's heuristic\n! @param[out] decision the literal to make true\n! @return whether the call was successful"]
1346 pub decide: ::std::option::Option<
1347 unsafe extern "C" fn(
1348 thread_id: clingo_id_t,
1349 assignment: *const clingo_assignment_t,
1350 fallback: clingo_literal_t,
1351 data: *mut ::std::os::raw::c_void,
1352 decision: *mut clingo_literal_t,
1353 ) -> bool,
1354 >,
1355}
1356#[test]
1357fn bindgen_test_layout_clingo_propagator() {
1358 const UNINIT: ::std::mem::MaybeUninit<clingo_propagator> = ::std::mem::MaybeUninit::uninit();
1359 let ptr = UNINIT.as_ptr();
1360 assert_eq!(
1361 ::std::mem::size_of::<clingo_propagator>(),
1362 40usize,
1363 concat!("Size of: ", stringify!(clingo_propagator))
1364 );
1365 assert_eq!(
1366 ::std::mem::align_of::<clingo_propagator>(),
1367 8usize,
1368 concat!("Alignment of ", stringify!(clingo_propagator))
1369 );
1370 assert_eq!(
1371 unsafe { ::std::ptr::addr_of!((*ptr).init) as usize - ptr as usize },
1372 0usize,
1373 concat!(
1374 "Offset of field: ",
1375 stringify!(clingo_propagator),
1376 "::",
1377 stringify!(init)
1378 )
1379 );
1380 assert_eq!(
1381 unsafe { ::std::ptr::addr_of!((*ptr).propagate) as usize - ptr as usize },
1382 8usize,
1383 concat!(
1384 "Offset of field: ",
1385 stringify!(clingo_propagator),
1386 "::",
1387 stringify!(propagate)
1388 )
1389 );
1390 assert_eq!(
1391 unsafe { ::std::ptr::addr_of!((*ptr).undo) as usize - ptr as usize },
1392 16usize,
1393 concat!(
1394 "Offset of field: ",
1395 stringify!(clingo_propagator),
1396 "::",
1397 stringify!(undo)
1398 )
1399 );
1400 assert_eq!(
1401 unsafe { ::std::ptr::addr_of!((*ptr).check) as usize - ptr as usize },
1402 24usize,
1403 concat!(
1404 "Offset of field: ",
1405 stringify!(clingo_propagator),
1406 "::",
1407 stringify!(check)
1408 )
1409 );
1410 assert_eq!(
1411 unsafe { ::std::ptr::addr_of!((*ptr).decide) as usize - ptr as usize },
1412 32usize,
1413 concat!(
1414 "Offset of field: ",
1415 stringify!(clingo_propagator),
1416 "::",
1417 stringify!(decide)
1418 )
1419 );
1420}
1421#[doc = "! An instance of this struct has to be registered with a solver to implement a custom propagator.\n!\n! Not all callbacks have to be implemented and can be set to NULL if not needed.\n! @see Propagator"]
1422pub type clingo_propagator_t = clingo_propagator;
1423#[doc = "!< Theory tuples \"(t1,...,tn)\"."]
1424pub const clingo_theory_sequence_type_e_clingo_theory_sequence_type_tuple:
1425 clingo_theory_sequence_type_e = 0;
1426#[doc = "!< Theory lists \"[t1,...,tn]\"."]
1427pub const clingo_theory_sequence_type_e_clingo_theory_sequence_type_list:
1428 clingo_theory_sequence_type_e = 1;
1429#[doc = "!< Theory sets \"{t1,...,tn}\"."]
1430pub const clingo_theory_sequence_type_e_clingo_theory_sequence_type_set:
1431 clingo_theory_sequence_type_e = 2;
1432#[doc = "! Enumeration of theory sequence types."]
1433pub type clingo_theory_sequence_type_e = ::std::os::raw::c_uint;
1434#[doc = "! Corresponding type to ::clingo_theory_sequence_type_e."]
1435pub type clingo_theory_sequence_type_t = ::std::os::raw::c_int;
1436#[doc = "!< set the level of an atom"]
1437pub const clingo_heuristic_type_e_clingo_heuristic_type_level: clingo_heuristic_type_e = 0;
1438#[doc = "!< configure which sign to chose for an atom"]
1439pub const clingo_heuristic_type_e_clingo_heuristic_type_sign: clingo_heuristic_type_e = 1;
1440#[doc = "!< modify VSIDS factor of an atom"]
1441pub const clingo_heuristic_type_e_clingo_heuristic_type_factor: clingo_heuristic_type_e = 2;
1442#[doc = "!< modify the initial VSIDS score of an atom"]
1443pub const clingo_heuristic_type_e_clingo_heuristic_type_init: clingo_heuristic_type_e = 3;
1444#[doc = "!< set the level of an atom and choose a positive sign"]
1445pub const clingo_heuristic_type_e_clingo_heuristic_type_true: clingo_heuristic_type_e = 4;
1446#[doc = "!< set the level of an atom and choose a negative sign"]
1447pub const clingo_heuristic_type_e_clingo_heuristic_type_false: clingo_heuristic_type_e = 5;
1448#[doc = "! Enumeration of different heuristic modifiers.\n! @ingroup ProgramInspection"]
1449pub type clingo_heuristic_type_e = ::std::os::raw::c_uint;
1450#[doc = "! Corresponding type to ::clingo_heuristic_type_e.\n! @ingroup ProgramInspection"]
1451pub type clingo_heuristic_type_t = ::std::os::raw::c_int;
1452#[doc = "!< allow an external to be assigned freely"]
1453pub const clingo_external_type_e_clingo_external_type_free: clingo_external_type_e = 0;
1454#[doc = "!< assign an external to true"]
1455pub const clingo_external_type_e_clingo_external_type_true: clingo_external_type_e = 1;
1456#[doc = "!< assign an external to false"]
1457pub const clingo_external_type_e_clingo_external_type_false: clingo_external_type_e = 2;
1458#[doc = "!< no longer treat an atom as external"]
1459pub const clingo_external_type_e_clingo_external_type_release: clingo_external_type_e = 3;
1460#[doc = "! Enumeration of different external statements.\n! @ingroup ProgramInspection"]
1461pub type clingo_external_type_e = ::std::os::raw::c_uint;
1462#[doc = "! Corresponding type to ::clingo_external_type_e.\n! @ingroup ProgramInspection"]
1463pub type clingo_external_type_t = ::std::os::raw::c_int;
1464#[repr(C)]
1465#[derive(Debug)]
1466pub struct clingo_backend {
1467 _unused: [u8; 0],
1468}
1469#[doc = "! Handle to the backend to add directives in aspif format."]
1470pub type clingo_backend_t = clingo_backend;
1471extern "C" {
1472 #[doc = "! Prepare the backend for usage.\n!\n! @param[in] backend the target backend\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! - ::clingo_error_runtime"]
1473 pub fn clingo_backend_begin(backend: *mut clingo_backend_t) -> bool;
1474}
1475extern "C" {
1476 #[doc = "! Finalize the backend after using it.\n!\n! @param[in] backend the target backend\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! - ::clingo_error_runtime"]
1477 pub fn clingo_backend_end(backend: *mut clingo_backend_t) -> bool;
1478}
1479extern "C" {
1480 #[doc = "! Add a rule to the program.\n!\n! @param[in] backend the target backend\n! @param[in] choice determines if the head is a choice or a disjunction\n! @param[in] head the head atoms\n! @param[in] head_size the number of atoms in the head\n! @param[in] body the body literals\n! @param[in] body_size the number of literals in the body\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1481 pub fn clingo_backend_rule(
1482 backend: *mut clingo_backend_t,
1483 choice: bool,
1484 head: *const clingo_atom_t,
1485 head_size: usize,
1486 body: *const clingo_literal_t,
1487 body_size: usize,
1488 ) -> bool;
1489}
1490extern "C" {
1491 #[doc = "! Add a weight rule to the program.\n!\n! @attention All weights and the lower bound must be positive.\n! @param[in] backend the target backend\n! @param[in] choice determines if the head is a choice or a disjunction\n! @param[in] head the head atoms\n! @param[in] head_size the number of atoms in the head\n! @param[in] lower_bound the lower bound of the weight rule\n! @param[in] body the weighted body literals\n! @param[in] body_size the number of weighted literals in the body\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1492 pub fn clingo_backend_weight_rule(
1493 backend: *mut clingo_backend_t,
1494 choice: bool,
1495 head: *const clingo_atom_t,
1496 head_size: usize,
1497 lower_bound: clingo_weight_t,
1498 body: *const clingo_weighted_literal_t,
1499 body_size: usize,
1500 ) -> bool;
1501}
1502extern "C" {
1503 #[doc = "! Add a minimize constraint (or weak constraint) to the program.\n!\n! @param[in] backend the target backend\n! @param[in] priority the priority of the constraint\n! @param[in] literals the weighted literals whose sum to minimize\n! @param[in] size the number of weighted literals\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1504 pub fn clingo_backend_minimize(
1505 backend: *mut clingo_backend_t,
1506 priority: clingo_weight_t,
1507 literals: *const clingo_weighted_literal_t,
1508 size: usize,
1509 ) -> bool;
1510}
1511extern "C" {
1512 #[doc = "! Add a projection directive.\n!\n! @param[in] backend the target backend\n! @param[in] atoms the atoms to project on\n! @param[in] size the number of atoms\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1513 pub fn clingo_backend_project(
1514 backend: *mut clingo_backend_t,
1515 atoms: *const clingo_atom_t,
1516 size: usize,
1517 ) -> bool;
1518}
1519extern "C" {
1520 #[doc = "! Add an external statement.\n!\n! @param[in] backend the target backend\n! @param[in] atom the external atom\n! @param[in] type the type of the external statement\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1521 pub fn clingo_backend_external(
1522 backend: *mut clingo_backend_t,
1523 atom: clingo_atom_t,
1524 type_: clingo_external_type_t,
1525 ) -> bool;
1526}
1527extern "C" {
1528 #[doc = "! Add an assumption directive.\n!\n! @param[in] backend the target backend\n! @param[in] literals the literals to assume (positive literals are true and negative literals false for the next solve call)\n! @param[in] size the number of atoms\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1529 pub fn clingo_backend_assume(
1530 backend: *mut clingo_backend_t,
1531 literals: *const clingo_literal_t,
1532 size: usize,
1533 ) -> bool;
1534}
1535extern "C" {
1536 #[doc = "! Add an heuristic directive.\n!\n! @param[in] backend the target backend\n! @param[in] atom the target atom\n! @param[in] type the type of the heuristic modification\n! @param[in] bias the heuristic bias\n! @param[in] priority the heuristic priority\n! @param[in] condition the condition under which to apply the heuristic modification\n! @param[in] size the number of atoms in the condition\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1537 pub fn clingo_backend_heuristic(
1538 backend: *mut clingo_backend_t,
1539 atom: clingo_atom_t,
1540 type_: clingo_heuristic_type_t,
1541 bias: ::std::os::raw::c_int,
1542 priority: ::std::os::raw::c_uint,
1543 condition: *const clingo_literal_t,
1544 size: usize,
1545 ) -> bool;
1546}
1547extern "C" {
1548 #[doc = "! Add an edge directive.\n!\n! @param[in] backend the target backend\n! @param[in] node_u the start vertex of the edge\n! @param[in] node_v the end vertex of the edge\n! @param[in] condition the condition under which the edge is part of the graph\n! @param[in] size the number of atoms in the condition\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1549 pub fn clingo_backend_acyc_edge(
1550 backend: *mut clingo_backend_t,
1551 node_u: ::std::os::raw::c_int,
1552 node_v: ::std::os::raw::c_int,
1553 condition: *const clingo_literal_t,
1554 size: usize,
1555 ) -> bool;
1556}
1557extern "C" {
1558 #[doc = "! Get a fresh atom to be used in aspif directives.\n!\n! @param[in] backend the target backend\n! @param[in] symbol optional symbol to associate the atom with\n! @param[out] atom the resulting atom\n! @return whether the call was successful"]
1559 pub fn clingo_backend_add_atom(
1560 backend: *mut clingo_backend_t,
1561 symbol: *mut clingo_symbol_t,
1562 atom: *mut clingo_atom_t,
1563 ) -> bool;
1564}
1565extern "C" {
1566 #[doc = "! Add a numeric theory term.\n!\n! @param[in] backend the target backend\n! @param[in] number the value of the term\n! @param[out] term_id the resulting term id\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1567 pub fn clingo_backend_theory_term_number(
1568 backend: *mut clingo_backend_t,
1569 number: ::std::os::raw::c_int,
1570 term_id: *mut clingo_id_t,
1571 ) -> bool;
1572}
1573extern "C" {
1574 #[doc = "! Add a theory term representing a string.\n!\n! @param[in] backend the target backend\n! @param[in] string the value of the term\n! @param[out] term_id the resulting term id\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1575 pub fn clingo_backend_theory_term_string(
1576 backend: *mut clingo_backend_t,
1577 string: *const ::std::os::raw::c_char,
1578 term_id: *mut clingo_id_t,
1579 ) -> bool;
1580}
1581extern "C" {
1582 #[doc = "! Add a theory term representing a sequence of theory terms.\n!\n! @param[in] backend the target backend\n! @param[in] type the type of the sequence\n! @param[in] arguments the term ids of the terms in the sequence\n! @param[in] size the number of elements of the sequence\n! @param[out] term_id the resulting term id\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1583 pub fn clingo_backend_theory_term_sequence(
1584 backend: *mut clingo_backend_t,
1585 type_: clingo_theory_sequence_type_t,
1586 arguments: *const clingo_id_t,
1587 size: usize,
1588 term_id: *mut clingo_id_t,
1589 ) -> bool;
1590}
1591extern "C" {
1592 #[doc = "! Add a theory term representing a function.\n!\n! @param[in] backend the target backend\n! @param[in] name the name of the function\n! @param[in] arguments an array of term ids for the theory terms in the arguments\n! @param[in] size the number of arguments\n! @param[out] term_id the resulting term id\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1593 pub fn clingo_backend_theory_term_function(
1594 backend: *mut clingo_backend_t,
1595 name: *const ::std::os::raw::c_char,
1596 arguments: *const clingo_id_t,
1597 size: usize,
1598 term_id: *mut clingo_id_t,
1599 ) -> bool;
1600}
1601extern "C" {
1602 #[doc = "! Convert the given symbol into a theory term.\n!\n! @param[in] backend the target backend\n! @param[in] symbol the symbol to convert\n! @param[out] term_id the resulting term id\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1603 pub fn clingo_backend_theory_term_symbol(
1604 backend: *mut clingo_backend_t,
1605 symbol: clingo_symbol_t,
1606 term_id: *mut clingo_id_t,
1607 ) -> bool;
1608}
1609extern "C" {
1610 #[doc = "! Add a theory atom element.\n!\n! @param[in] backend the target backend\n! @param[in] tuple the array of term ids represeting the tuple\n! @param[in] tuple_size the size of the tuple\n! @param[in] condition an array of program literals represeting the condition\n! @param[in] condition_size the size of the condition\n! @param[out] element_id the resulting element id\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1611 pub fn clingo_backend_theory_element(
1612 backend: *mut clingo_backend_t,
1613 tuple: *const clingo_id_t,
1614 tuple_size: usize,
1615 condition: *const clingo_literal_t,
1616 condition_size: usize,
1617 element_id: *mut clingo_id_t,
1618 ) -> bool;
1619}
1620extern "C" {
1621 #[doc = "! Add a theory atom without a guard.\n!\n! @param[in] backend the target backend\n! @param[in] atom_id_or_zero a program atom or zero for theory directives\n! @param[in] term_id the term id of the term associated with the theory atom\n! @param[in] elements an array of element ids for the theory atoms's elements\n! @param[in] size the number of elements\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1622 pub fn clingo_backend_theory_atom(
1623 backend: *mut clingo_backend_t,
1624 atom_id_or_zero: clingo_atom_t,
1625 term_id: clingo_id_t,
1626 elements: *const clingo_id_t,
1627 size: usize,
1628 ) -> bool;
1629}
1630extern "C" {
1631 #[doc = "! Add a theory atom with a guard.\n!\n! @param[in] backend the target backend\n! @param[in] atom_id_or_zero a program atom or zero for theory directives\n! @param[in] term_id the term id of the term associated with the theory atom\n! @param[in] elements an array of element ids for the theory atoms's elements\n! @param[in] size the number of elements\n! @param[in] operator_name the string representation of a theory operator\n! @param[in] right_hand_side_id the term id of the right hand side term\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1632 pub fn clingo_backend_theory_atom_with_guard(
1633 backend: *mut clingo_backend_t,
1634 atom_id_or_zero: clingo_atom_t,
1635 term_id: clingo_id_t,
1636 elements: *const clingo_id_t,
1637 size: usize,
1638 operator_name: *const ::std::os::raw::c_char,
1639 right_hand_side_id: clingo_id_t,
1640 ) -> bool;
1641}
1642#[doc = "!< the entry is a (string) value"]
1643pub const clingo_configuration_type_e_clingo_configuration_type_value: clingo_configuration_type_e =
1644 1;
1645#[doc = "!< the entry is an array"]
1646pub const clingo_configuration_type_e_clingo_configuration_type_array: clingo_configuration_type_e =
1647 2;
1648#[doc = "!< the entry is a map"]
1649pub const clingo_configuration_type_e_clingo_configuration_type_map: clingo_configuration_type_e =
1650 4;
1651#[doc = "! Enumeration for entries of the configuration."]
1652pub type clingo_configuration_type_e = ::std::os::raw::c_uint;
1653#[doc = "! Bitset for values of type ::clingo_configuration_type_e."]
1654pub type clingo_configuration_type_bitset_t = ::std::os::raw::c_uint;
1655#[repr(C)]
1656#[derive(Debug)]
1657pub struct clingo_configuration {
1658 _unused: [u8; 0],
1659}
1660#[doc = "! Handle for to the solver configuration."]
1661pub type clingo_configuration_t = clingo_configuration;
1662extern "C" {
1663 #[doc = "! Get the root key of the configuration.\n!\n! @param[in] configuration the target configuration\n! @param[out] key the root key\n! @return whether the call was successful"]
1664 pub fn clingo_configuration_root(
1665 configuration: *const clingo_configuration_t,
1666 key: *mut clingo_id_t,
1667 ) -> bool;
1668}
1669extern "C" {
1670 #[doc = "! Get the type of a key.\n!\n! @note The type is bitset, an entry can have multiple (but at least one) type.\n!\n! @param[in] configuration the target configuration\n! @param[in] key the key\n! @param[out] type the resulting type\n! @return whether the call was successful"]
1671 pub fn clingo_configuration_type(
1672 configuration: *const clingo_configuration_t,
1673 key: clingo_id_t,
1674 type_: *mut clingo_configuration_type_bitset_t,
1675 ) -> bool;
1676}
1677extern "C" {
1678 #[doc = "! Get the description of an entry.\n!\n! @param[in] configuration the target configuration\n! @param[in] key the key\n! @param[out] description the description\n! @return whether the call was successful"]
1679 pub fn clingo_configuration_description(
1680 configuration: *const clingo_configuration_t,
1681 key: clingo_id_t,
1682 description: *mut *const ::std::os::raw::c_char,
1683 ) -> bool;
1684}
1685extern "C" {
1686 #[doc = "! Get the size of an array entry.\n!\n! @pre The @link clingo_configuration_type() type@endlink of the entry must be @ref ::clingo_configuration_type_array.\n! @param[in] configuration the target configuration\n! @param[in] key the key\n! @param[out] size the resulting size\n! @return whether the call was successful"]
1687 pub fn clingo_configuration_array_size(
1688 configuration: *const clingo_configuration_t,
1689 key: clingo_id_t,
1690 size: *mut usize,
1691 ) -> bool;
1692}
1693extern "C" {
1694 #[doc = "! Get the subkey at the given offset of an array entry.\n!\n! @note Some array entries, like fore example the solver configuration, can be accessed past there actual size to add subentries.\n! @pre The @link clingo_configuration_type() type@endlink of the entry must be @ref ::clingo_configuration_type_array.\n! @param[in] configuration the target configuration\n! @param[in] key the key\n! @param[in] offset the offset in the array\n! @param[out] subkey the resulting subkey\n! @return whether the call was successful"]
1695 pub fn clingo_configuration_array_at(
1696 configuration: *const clingo_configuration_t,
1697 key: clingo_id_t,
1698 offset: usize,
1699 subkey: *mut clingo_id_t,
1700 ) -> bool;
1701}
1702extern "C" {
1703 #[doc = "! Get the number of subkeys of a map entry.\n!\n! @pre The @link clingo_configuration_type() type@endlink of the entry must be @ref ::clingo_configuration_type_map.\n! @param[in] configuration the target configuration\n! @param[in] key the key\n! @param[out] size the resulting number\n! @return whether the call was successful"]
1704 pub fn clingo_configuration_map_size(
1705 configuration: *const clingo_configuration_t,
1706 key: clingo_id_t,
1707 size: *mut usize,
1708 ) -> bool;
1709}
1710extern "C" {
1711 #[doc = "! Query whether the map has a key.\n!\n! @pre The @link clingo_configuration_type() type@endlink of the entry must be @ref ::clingo_configuration_type_map.\n! @note Multiple levels can be looked up by concatenating keys with a period.\n! @param[in] configuration the target configuration\n! @param[in] key the key\n! @param[in] name the name to lookup the subkey\n! @param[out] result whether the key is in the map\n! @return whether the call was successful"]
1712 pub fn clingo_configuration_map_has_subkey(
1713 configuration: *const clingo_configuration_t,
1714 key: clingo_id_t,
1715 name: *const ::std::os::raw::c_char,
1716 result: *mut bool,
1717 ) -> bool;
1718}
1719extern "C" {
1720 #[doc = "! Get the name associated with the offset-th subkey.\n!\n! @pre The @link clingo_configuration_type() type@endlink of the entry must be @ref ::clingo_configuration_type_map.\n! @param[in] configuration the target configuration\n! @param[in] key the key\n! @param[in] offset the offset of the name\n! @param[out] name the resulting name\n! @return whether the call was successful"]
1721 pub fn clingo_configuration_map_subkey_name(
1722 configuration: *const clingo_configuration_t,
1723 key: clingo_id_t,
1724 offset: usize,
1725 name: *mut *const ::std::os::raw::c_char,
1726 ) -> bool;
1727}
1728extern "C" {
1729 #[doc = "! Lookup a subkey under the given name.\n!\n! @pre The @link clingo_configuration_type() type@endlink of the entry must be @ref ::clingo_configuration_type_map.\n! @note Multiple levels can be looked up by concatenating keys with a period.\n! @param[in] configuration the target configuration\n! @param[in] key the key\n! @param[in] name the name to lookup the subkey\n! @param[out] subkey the resulting subkey\n! @return whether the call was successful"]
1730 pub fn clingo_configuration_map_at(
1731 configuration: *const clingo_configuration_t,
1732 key: clingo_id_t,
1733 name: *const ::std::os::raw::c_char,
1734 subkey: *mut clingo_id_t,
1735 ) -> bool;
1736}
1737extern "C" {
1738 #[doc = "! Check whether a entry has a value.\n!\n! @pre The @link clingo_configuration_type() type@endlink of the entry must be @ref ::clingo_configuration_type_value.\n! @param[in] configuration the target configuration\n! @param[in] key the key\n! @param[out] assigned whether the entry has a value\n! @return whether the call was successful"]
1739 pub fn clingo_configuration_value_is_assigned(
1740 configuration: *const clingo_configuration_t,
1741 key: clingo_id_t,
1742 assigned: *mut bool,
1743 ) -> bool;
1744}
1745extern "C" {
1746 #[doc = "! Get the size of the string value of the given entry.\n!\n! @pre The @link clingo_configuration_type() type@endlink of the entry must be @ref ::clingo_configuration_type_value.\n! @param[in] configuration the target configuration\n! @param[in] key the key\n! @param[out] size the resulting size\n! @return whether the call was successful"]
1747 pub fn clingo_configuration_value_get_size(
1748 configuration: *const clingo_configuration_t,
1749 key: clingo_id_t,
1750 size: *mut usize,
1751 ) -> bool;
1752}
1753extern "C" {
1754 #[doc = "! Get the string value of the given entry.\n!\n! @pre The @link clingo_configuration_type() type@endlink of the entry must be @ref ::clingo_configuration_type_value.\n! @pre The given size must be larger or equal to size of the value.\n! @param[in] configuration the target configuration\n! @param[in] key the key\n! @param[out] value the resulting string value\n! @param[in] size the size of the given char array\n! @return whether the call was successful"]
1755 pub fn clingo_configuration_value_get(
1756 configuration: *const clingo_configuration_t,
1757 key: clingo_id_t,
1758 value: *mut ::std::os::raw::c_char,
1759 size: usize,
1760 ) -> bool;
1761}
1762extern "C" {
1763 #[doc = "! Set the value of an entry.\n!\n! @pre The @link clingo_configuration_type() type@endlink of the entry must be @ref ::clingo_configuration_type_value.\n! @param[in] configuration the target configuration\n! @param[in] key the key\n! @param[in] value the value to set\n! @return whether the call was successful"]
1764 pub fn clingo_configuration_value_set(
1765 configuration: *mut clingo_configuration_t,
1766 key: clingo_id_t,
1767 value: *const ::std::os::raw::c_char,
1768 ) -> bool;
1769}
1770#[doc = "!< the entry is invalid (has neither of the types below)"]
1771pub const clingo_statistics_type_e_clingo_statistics_type_empty: clingo_statistics_type_e = 0;
1772#[doc = "!< the entry is a (double) value"]
1773pub const clingo_statistics_type_e_clingo_statistics_type_value: clingo_statistics_type_e = 1;
1774#[doc = "!< the entry is an array"]
1775pub const clingo_statistics_type_e_clingo_statistics_type_array: clingo_statistics_type_e = 2;
1776#[doc = "!< the entry is a map"]
1777pub const clingo_statistics_type_e_clingo_statistics_type_map: clingo_statistics_type_e = 3;
1778#[doc = "! Enumeration for entries of the statistics."]
1779pub type clingo_statistics_type_e = ::std::os::raw::c_uint;
1780#[doc = "! Corresponding type to ::clingo_statistics_type."]
1781pub type clingo_statistics_type_t = ::std::os::raw::c_int;
1782#[repr(C)]
1783#[derive(Debug)]
1784pub struct clingo_statistic {
1785 _unused: [u8; 0],
1786}
1787#[doc = "! Handle for the solver statistics."]
1788pub type clingo_statistics_t = clingo_statistic;
1789extern "C" {
1790 #[doc = "! Get the root key of the statistics.\n!\n! @param[in] statistics the target statistics\n! @param[out] key the root key\n! @return whether the call was successful"]
1791 pub fn clingo_statistics_root(statistics: *const clingo_statistics_t, key: *mut u64) -> bool;
1792}
1793extern "C" {
1794 #[doc = "! Get the type of a key.\n!\n! @param[in] statistics the target statistics\n! @param[in] key the key\n! @param[out] type the resulting type\n! @return whether the call was successful"]
1795 pub fn clingo_statistics_type(
1796 statistics: *const clingo_statistics_t,
1797 key: u64,
1798 type_: *mut clingo_statistics_type_t,
1799 ) -> bool;
1800}
1801extern "C" {
1802 #[doc = "! Get the size of an array entry.\n!\n! @pre The @link clingo_statistics_type() type@endlink of the entry must be @ref ::clingo_statistics_type_array.\n! @param[in] statistics the target statistics\n! @param[in] key the key\n! @param[out] size the resulting size\n! @return whether the call was successful"]
1803 pub fn clingo_statistics_array_size(
1804 statistics: *const clingo_statistics_t,
1805 key: u64,
1806 size: *mut usize,
1807 ) -> bool;
1808}
1809extern "C" {
1810 #[doc = "! Get the subkey at the given offset of an array entry.\n!\n! @pre The @link clingo_statistics_type() type@endlink of the entry must be @ref ::clingo_statistics_type_array.\n! @param[in] statistics the target statistics\n! @param[in] key the key\n! @param[in] offset the offset in the array\n! @param[out] subkey the resulting subkey\n! @return whether the call was successful"]
1811 pub fn clingo_statistics_array_at(
1812 statistics: *const clingo_statistics_t,
1813 key: u64,
1814 offset: usize,
1815 subkey: *mut u64,
1816 ) -> bool;
1817}
1818extern "C" {
1819 #[doc = "! Create the subkey at the end of an array entry.\n!\n! @pre The @link clingo_statistics_type() type@endlink of the entry must be @ref ::clingo_statistics_type_array.\n! @param[in] statistics the target statistics\n! @param[in] key the key\n! @param[in] type the type of the new subkey\n! @param[out] subkey the resulting subkey\n! @return whether the call was successful"]
1820 pub fn clingo_statistics_array_push(
1821 statistics: *mut clingo_statistics_t,
1822 key: u64,
1823 type_: clingo_statistics_type_t,
1824 subkey: *mut u64,
1825 ) -> bool;
1826}
1827extern "C" {
1828 #[doc = "! Get the number of subkeys of a map entry.\n!\n! @pre The @link clingo_statistics_type() type@endlink of the entry must be @ref ::clingo_statistics_type_map.\n! @param[in] statistics the target statistics\n! @param[in] key the key\n! @param[out] size the resulting number\n! @return whether the call was successful"]
1829 pub fn clingo_statistics_map_size(
1830 statistics: *const clingo_statistics_t,
1831 key: u64,
1832 size: *mut usize,
1833 ) -> bool;
1834}
1835extern "C" {
1836 #[doc = "! Test if the given map contains a specific subkey.\n!\n! @pre The @link clingo_statistics_type() type@endlink of the entry must be @ref ::clingo_statistics_type_map.\n! @param[in] statistics the target statistics\n! @param[in] key the key\n! @param[in] name name of the subkey\n! @param[out] result true if the map has a subkey with the given name\n! @return whether the call was successful"]
1837 pub fn clingo_statistics_map_has_subkey(
1838 statistics: *const clingo_statistics_t,
1839 key: u64,
1840 name: *const ::std::os::raw::c_char,
1841 result: *mut bool,
1842 ) -> bool;
1843}
1844extern "C" {
1845 #[doc = "! Get the name associated with the offset-th subkey.\n!\n! @pre The @link clingo_statistics_type() type@endlink of the entry must be @ref ::clingo_statistics_type_map.\n! @param[in] statistics the target statistics\n! @param[in] key the key\n! @param[in] offset the offset of the name\n! @param[out] name the resulting name\n! @return whether the call was successful"]
1846 pub fn clingo_statistics_map_subkey_name(
1847 statistics: *const clingo_statistics_t,
1848 key: u64,
1849 offset: usize,
1850 name: *mut *const ::std::os::raw::c_char,
1851 ) -> bool;
1852}
1853extern "C" {
1854 #[doc = "! Lookup a subkey under the given name.\n!\n! @pre The @link clingo_statistics_type() type@endlink of the entry must be @ref ::clingo_statistics_type_map.\n! @note Multiple levels can be looked up by concatenating keys with a period.\n! @param[in] statistics the target statistics\n! @param[in] key the key\n! @param[in] name the name to lookup the subkey\n! @param[out] subkey the resulting subkey\n! @return whether the call was successful"]
1855 pub fn clingo_statistics_map_at(
1856 statistics: *const clingo_statistics_t,
1857 key: u64,
1858 name: *const ::std::os::raw::c_char,
1859 subkey: *mut u64,
1860 ) -> bool;
1861}
1862extern "C" {
1863 #[doc = "! Add a subkey with the given name.\n!\n! @pre The @link clingo_statistics_type() type@endlink of the entry must be @ref ::clingo_statistics_type_map.\n! @param[in] statistics the target statistics\n! @param[in] key the key\n! @param[in] name the name of the new subkey\n! @param[in] type the type of the new subkey\n! @param[out] subkey the index of the resulting subkey\n! @return whether the call was successful"]
1864 pub fn clingo_statistics_map_add_subkey(
1865 statistics: *mut clingo_statistics_t,
1866 key: u64,
1867 name: *const ::std::os::raw::c_char,
1868 type_: clingo_statistics_type_t,
1869 subkey: *mut u64,
1870 ) -> bool;
1871}
1872extern "C" {
1873 #[doc = "! Get the value of the given entry.\n!\n! @pre The @link clingo_statistics_type() type@endlink of the entry must be @ref ::clingo_statistics_type_value.\n! @param[in] statistics the target statistics\n! @param[in] key the key\n! @param[out] value the resulting value\n! @return whether the call was successful"]
1874 pub fn clingo_statistics_value_get(
1875 statistics: *const clingo_statistics_t,
1876 key: u64,
1877 value: *mut f64,
1878 ) -> bool;
1879}
1880extern "C" {
1881 #[doc = "! Set the value of the given entry.\n!\n! @pre The @link clingo_statistics_type() type@endlink of the entry must be @ref ::clingo_statistics_type_value.\n! @param[in] statistics the target statistics\n! @param[in] key the key\n! @param[out] value the new value\n! @return whether the call was successful"]
1882 pub fn clingo_statistics_value_set(
1883 statistics: *mut clingo_statistics_t,
1884 key: u64,
1885 value: f64,
1886 ) -> bool;
1887}
1888#[repr(C)]
1889#[derive(Debug)]
1890pub struct clingo_solve_control {
1891 _unused: [u8; 0],
1892}
1893#[doc = "! Object to add clauses during search."]
1894pub type clingo_solve_control_t = clingo_solve_control;
1895#[repr(C)]
1896#[derive(Debug)]
1897pub struct clingo_model {
1898 _unused: [u8; 0],
1899}
1900#[doc = "! Object representing a model."]
1901pub type clingo_model_t = clingo_model;
1902#[doc = "!< The model represents a stable model."]
1903pub const clingo_model_type_e_clingo_model_type_stable_model: clingo_model_type_e = 0;
1904#[doc = "!< The model represents a set of brave consequences."]
1905pub const clingo_model_type_e_clingo_model_type_brave_consequences: clingo_model_type_e = 1;
1906#[doc = "!< The model represents a set of cautious consequences."]
1907pub const clingo_model_type_e_clingo_model_type_cautious_consequences: clingo_model_type_e = 2;
1908#[doc = "! Enumeration for the different model types."]
1909pub type clingo_model_type_e = ::std::os::raw::c_uint;
1910#[doc = "! Corresponding type to ::clingo_model_type_e."]
1911pub type clingo_model_type_t = ::std::os::raw::c_int;
1912#[doc = "!< Select shown atoms and terms."]
1913pub const clingo_show_type_e_clingo_show_type_shown: clingo_show_type_e = 2;
1914#[doc = "!< Select all atoms."]
1915pub const clingo_show_type_e_clingo_show_type_atoms: clingo_show_type_e = 4;
1916#[doc = "!< Select all terms."]
1917pub const clingo_show_type_e_clingo_show_type_terms: clingo_show_type_e = 8;
1918#[doc = "!< Select symbols added by theory."]
1919pub const clingo_show_type_e_clingo_show_type_theory: clingo_show_type_e = 16;
1920#[doc = "!< Select everything."]
1921pub const clingo_show_type_e_clingo_show_type_all: clingo_show_type_e = 31;
1922#[doc = "!< Select false instead of true atoms (::clingo_show_type_atoms) or terms (::clingo_show_type_terms)."]
1923pub const clingo_show_type_e_clingo_show_type_complement: clingo_show_type_e = 32;
1924#[doc = "! Enumeration of bit flags to select symbols in models."]
1925pub type clingo_show_type_e = ::std::os::raw::c_uint;
1926#[doc = "! Corresponding type to ::clingo_show_type_e."]
1927pub type clingo_show_type_bitset_t = ::std::os::raw::c_uint;
1928extern "C" {
1929 #[doc = "! Get the type of the model.\n!\n! @param[in] model the target\n! @param[out] type the type of the model\n! @return whether the call was successful"]
1930 pub fn clingo_model_type(model: *const clingo_model_t, type_: *mut clingo_model_type_t)
1931 -> bool;
1932}
1933extern "C" {
1934 #[doc = "! Get the running number of the model.\n!\n! @param[in] model the target\n! @param[out] number the number of the model\n! @return whether the call was successful"]
1935 pub fn clingo_model_number(model: *const clingo_model_t, number: *mut u64) -> bool;
1936}
1937extern "C" {
1938 #[doc = "! Get the number of symbols of the selected types in the model.\n!\n! @param[in] model the target\n! @param[in] show which symbols to select\n! @param[out] size the number symbols\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
1939 pub fn clingo_model_symbols_size(
1940 model: *const clingo_model_t,
1941 show: clingo_show_type_bitset_t,
1942 size: *mut usize,
1943 ) -> bool;
1944}
1945extern "C" {
1946 #[doc = "! Get the symbols of the selected types in the model.\n!\n! @note CSP assignments are represented using functions with name \"$\"\n! where the first argument is the name of the CSP variable and the second one its\n! value.\n!\n! @param[in] model the target\n! @param[in] show which symbols to select\n! @param[out] symbols the resulting symbols\n! @param[in] size the number of selected symbols\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! - ::clingo_error_runtime if the size is too small\n!\n! @see clingo_model_symbols_size()"]
1947 pub fn clingo_model_symbols(
1948 model: *const clingo_model_t,
1949 show: clingo_show_type_bitset_t,
1950 symbols: *mut clingo_symbol_t,
1951 size: usize,
1952 ) -> bool;
1953}
1954extern "C" {
1955 #[doc = "! Constant time lookup to test whether an atom is in a model.\n!\n! @param[in] model the target\n! @param[in] atom the atom to lookup\n! @param[out] contained whether the atom is contained\n! @return whether the call was successful"]
1956 pub fn clingo_model_contains(
1957 model: *const clingo_model_t,
1958 atom: clingo_symbol_t,
1959 contained: *mut bool,
1960 ) -> bool;
1961}
1962extern "C" {
1963 #[doc = "! Check if a program literal is true in a model.\n!\n! @param[in] model the target\n! @param[in] literal the literal to lookup\n! @param[out] result whether the literal is true\n! @return whether the call was successful"]
1964 pub fn clingo_model_is_true(
1965 model: *const clingo_model_t,
1966 literal: clingo_literal_t,
1967 result: *mut bool,
1968 ) -> bool;
1969}
1970extern "C" {
1971 #[doc = "! Get the number of cost values of a model.\n!\n! @param[in] model the target\n! @param[out] size the number of costs\n! @return whether the call was successful"]
1972 pub fn clingo_model_cost_size(model: *const clingo_model_t, size: *mut usize) -> bool;
1973}
1974extern "C" {
1975 #[doc = "! Get the cost vector of a model.\n!\n! @param[in] model the target\n! @param[out] costs the resulting costs\n! @param[in] size the number of costs\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! - ::clingo_error_runtime if the size is too small\n!\n! @see clingo_model_cost_size()\n! @see clingo_model_optimality_proven()"]
1976 pub fn clingo_model_cost(model: *const clingo_model_t, costs: *mut i64, size: usize) -> bool;
1977}
1978extern "C" {
1979 #[doc = "! Whether the optimality of a model has been proven.\n!\n! @param[in] model the target\n! @param[out] proven whether the optimality has been proven\n! @return whether the call was successful\n!\n! @see clingo_model_cost()"]
1980 pub fn clingo_model_optimality_proven(model: *const clingo_model_t, proven: *mut bool) -> bool;
1981}
1982extern "C" {
1983 #[doc = "! Get the id of the solver thread that found the model.\n!\n! @param[in] model the target\n! @param[out] id the resulting thread id\n! @return whether the call was successful"]
1984 pub fn clingo_model_thread_id(model: *const clingo_model_t, id: *mut clingo_id_t) -> bool;
1985}
1986extern "C" {
1987 #[doc = "! Add symbols to the model.\n!\n! These symbols will appear in clingo's output, which means that this\n! function is only meaningful if there is an underlying clingo application.\n! Only models passed to the ::clingo_solve_event_callback_t are extendable.\n!\n! @param[in] model the target\n! @param[in] symbols the symbols to add\n! @param[in] size the number of symbols to add\n! @return whether the call was successful"]
1988 pub fn clingo_model_extend(
1989 model: *mut clingo_model_t,
1990 symbols: *const clingo_symbol_t,
1991 size: usize,
1992 ) -> bool;
1993}
1994extern "C" {
1995 #[doc = "! Get the associated solve control object of a model.\n!\n! This object allows for adding clauses during model enumeration.\n! @param[in] model the target\n! @param[out] control the resulting solve control object\n! @return whether the call was successful"]
1996 pub fn clingo_model_context(
1997 model: *const clingo_model_t,
1998 control: *mut *mut clingo_solve_control_t,
1999 ) -> bool;
2000}
2001extern "C" {
2002 #[doc = "! Get an object to inspect the symbolic atoms.\n!\n! @param[in] control the target\n! @param[out] atoms the resulting object\n! @return whether the call was successful"]
2003 pub fn clingo_solve_control_symbolic_atoms(
2004 control: *const clingo_solve_control_t,
2005 atoms: *mut *const clingo_symbolic_atoms_t,
2006 ) -> bool;
2007}
2008extern "C" {
2009 #[doc = "! Add a clause that applies to the current solving step during model\n! enumeration.\n!\n! @note The @ref Propagator module provides a more sophisticated\n! interface to add clauses - even on partial assignments.\n!\n! @param[in] control the target\n! @param[in] clause array of literals representing the clause\n! @param[in] size the size of the literal array\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! - ::clingo_error_runtime if adding the clause fails"]
2010 pub fn clingo_solve_control_add_clause(
2011 control: *mut clingo_solve_control_t,
2012 clause: *const clingo_literal_t,
2013 size: usize,
2014 ) -> bool;
2015}
2016pub const clingo_solve_result_e_clingo_solve_result_satisfiable: clingo_solve_result_e = 1;
2017pub const clingo_solve_result_e_clingo_solve_result_unsatisfiable: clingo_solve_result_e = 2;
2018pub const clingo_solve_result_e_clingo_solve_result_exhausted: clingo_solve_result_e = 4;
2019pub const clingo_solve_result_e_clingo_solve_result_interrupted: clingo_solve_result_e = 8;
2020pub type clingo_solve_result_e = ::std::os::raw::c_uint;
2021pub type clingo_solve_result_bitset_t = ::std::os::raw::c_uint;
2022#[doc = "!< Enable non-blocking search."]
2023pub const clingo_solve_mode_e_clingo_solve_mode_async: clingo_solve_mode_e = 1;
2024#[doc = "!< Yield models in calls to clingo_solve_handle_model."]
2025pub const clingo_solve_mode_e_clingo_solve_mode_yield: clingo_solve_mode_e = 2;
2026#[doc = "! Enumeration of solve modes."]
2027pub type clingo_solve_mode_e = ::std::os::raw::c_uint;
2028#[doc = "! Corresponding type to ::clingo_solve_mode_e."]
2029pub type clingo_solve_mode_bitset_t = ::std::os::raw::c_uint;
2030#[doc = "!< Issued if a model is found."]
2031pub const clingo_solve_event_type_e_clingo_solve_event_type_model: clingo_solve_event_type_e = 0;
2032#[doc = "!< Issued if an optimization problem is found unsatisfiable."]
2033pub const clingo_solve_event_type_e_clingo_solve_event_type_unsat: clingo_solve_event_type_e = 1;
2034#[doc = "!< Issued when the statistics can be updated."]
2035pub const clingo_solve_event_type_e_clingo_solve_event_type_statistics: clingo_solve_event_type_e =
2036 2;
2037#[doc = "!< Issued if the search has completed."]
2038pub const clingo_solve_event_type_e_clingo_solve_event_type_finish: clingo_solve_event_type_e = 3;
2039#[doc = "! Enumeration of solve events."]
2040pub type clingo_solve_event_type_e = ::std::os::raw::c_uint;
2041#[doc = "! Corresponding type to ::clingo_solve_event_type_e."]
2042pub type clingo_solve_event_type_t = ::std::os::raw::c_uint;
2043#[doc = "! Callback function called during search to notify when the search is finished or a model is ready.\n!\n! If a (non-recoverable) clingo API function fails in this callback, it must return false.\n! In case of errors not related to clingo, set error code ::clingo_error_unknown and return false to stop solving with an error.\n!\n! The event is either a pointer to a model, a pointer to an int64_t* and a size_t, a pointer to two statistics objects (per step and accumulated statistics), or a solve result.\n! @attention If the search is finished, the model is NULL.\n!\n! @param[in] event the current event.\n! @param[in] data user data of the callback\n! @param[out] goon can be set to false to stop solving\n! @return whether the call was successful\n!\n! @see clingo_control_solve()"]
2044pub type clingo_solve_event_callback_t = ::std::option::Option<
2045 unsafe extern "C" fn(
2046 type_: clingo_solve_event_type_t,
2047 event: *mut ::std::os::raw::c_void,
2048 data: *mut ::std::os::raw::c_void,
2049 goon: *mut bool,
2050 ) -> bool,
2051>;
2052#[repr(C)]
2053#[derive(Debug)]
2054pub struct clingo_solve_handle {
2055 _unused: [u8; 0],
2056}
2057#[doc = "! Search handle to a solve call.\n!\n! @see clingo_control_solve()"]
2058pub type clingo_solve_handle_t = clingo_solve_handle;
2059extern "C" {
2060 #[doc = "! Get the next solve result.\n!\n! Blocks until the result is ready.\n! When yielding partial solve results can be obtained, i.e.,\n! when a model is ready, the result will be satisfiable but neither the search exhausted nor the optimality proven.\n!\n! @param[in] handle the target\n! @param[out] result the solve result\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! - ::clingo_error_runtime if solving fails"]
2061 pub fn clingo_solve_handle_get(
2062 handle: *mut clingo_solve_handle_t,
2063 result: *mut clingo_solve_result_bitset_t,
2064 ) -> bool;
2065}
2066extern "C" {
2067 #[doc = "! Wait for the specified amount of time to check if the next result is ready.\n!\n! If the time is set to zero, this function can be used to poll if the search is still active.\n! If the time is negative, the function blocks until the search is finished.\n!\n! @param[in] handle the target\n! @param[in] timeout the maximum time to wait\n! @param[out] result whether the search has finished"]
2068 pub fn clingo_solve_handle_wait(
2069 handle: *mut clingo_solve_handle_t,
2070 timeout: f64,
2071 result: *mut bool,
2072 );
2073}
2074extern "C" {
2075 #[doc = "! Get the next model (or zero if there are no more models).\n!\n! @param[in] handle the target\n! @param[out] model the model (it is NULL if there are no more models)\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! - ::clingo_error_runtime if solving fails"]
2076 pub fn clingo_solve_handle_model(
2077 handle: *mut clingo_solve_handle_t,
2078 model: *mut *const clingo_model_t,
2079 ) -> bool;
2080}
2081extern "C" {
2082 #[doc = "! When a problem is unsatisfiable, get a subset of the assumptions that made the problem unsatisfiable.\n!\n! If the program is not unsatisfiable, core is set to NULL and size to zero.\n!\n! @param[in] handle the target\n! @param[out] core pointer where to store the core\n! @param[out] size size of the given array\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
2083 pub fn clingo_solve_handle_core(
2084 handle: *mut clingo_solve_handle_t,
2085 core: *mut *const clingo_literal_t,
2086 size: *mut usize,
2087 ) -> bool;
2088}
2089extern "C" {
2090 #[doc = "! Discards the last model and starts the search for the next one.\n!\n! If the search has been started asynchronously, this function continues the search in the background.\n!\n! @note This function does not block.\n!\n! @param[in] handle the target\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! - ::clingo_error_runtime if solving fails"]
2091 pub fn clingo_solve_handle_resume(handle: *mut clingo_solve_handle_t) -> bool;
2092}
2093extern "C" {
2094 #[doc = "! Stop the running search and block until done.\n!\n! @param[in] handle the target\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! - ::clingo_error_runtime if solving fails"]
2095 pub fn clingo_solve_handle_cancel(handle: *mut clingo_solve_handle_t) -> bool;
2096}
2097extern "C" {
2098 #[doc = "! Stops the running search and releases the handle.\n!\n! Blocks until the search is stopped (as if an implicit cancel was called before the handle is released).\n!\n! @param[in] handle the target\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! - ::clingo_error_runtime if solving fails"]
2099 pub fn clingo_solve_handle_close(handle: *mut clingo_solve_handle_t) -> bool;
2100}
2101#[doc = "! An instance of this struct has to be registered with a solver to observe ground directives as they are passed to the solver.\n!\n! @note This interface is closely modeled after the aspif format.\n! For more information please refer to the specification of the aspif format.\n!\n! Not all callbacks have to be implemented and can be set to NULL if not needed.\n! If one of the callbacks in the struct fails, grounding is stopped.\n! If a non-recoverable clingo API call fails, a callback must return false.\n! Otherwise ::clingo_error_unknown should be set and false returned.\n!\n! @see clingo_control_register_observer()"]
2102#[repr(C)]
2103#[derive(Debug, Copy, Clone)]
2104pub struct clingo_ground_program_observer {
2105 #[doc = "! Called once in the beginning.\n!\n! If the incremental flag is true, there can be multiple calls to @ref clingo_control_solve().\n!\n! @param[in] incremental whether the program is incremental\n! @param[in] data user data for the callback\n! @return whether the call was successful"]
2106 pub init_program: ::std::option::Option<
2107 unsafe extern "C" fn(incremental: bool, data: *mut ::std::os::raw::c_void) -> bool,
2108 >,
2109 #[doc = "! Marks the beginning of a block of directives passed to the solver.\n!\n! @see @ref end_step\n!\n! @param[in] data user data for the callback\n! @return whether the call was successful"]
2110 pub begin_step:
2111 ::std::option::Option<unsafe extern "C" fn(data: *mut ::std::os::raw::c_void) -> bool>,
2112 #[doc = "! Marks the end of a block of directives passed to the solver.\n!\n! This function is called before solving starts.\n!\n! @see @ref begin_step\n!\n! @param[in] data user data for the callback\n! @return whether the call was successful"]
2113 pub end_step:
2114 ::std::option::Option<unsafe extern "C" fn(data: *mut ::std::os::raw::c_void) -> bool>,
2115 #[doc = "! Observe rules passed to the solver.\n!\n! @param[in] choice determines if the head is a choice or a disjunction\n! @param[in] head the head atoms\n! @param[in] head_size the number of atoms in the head\n! @param[in] body the body literals\n! @param[in] body_size the number of literals in the body\n! @param[in] data user data for the callback\n! @return whether the call was successful"]
2116 pub rule: ::std::option::Option<
2117 unsafe extern "C" fn(
2118 choice: bool,
2119 head: *const clingo_atom_t,
2120 head_size: usize,
2121 body: *const clingo_literal_t,
2122 body_size: usize,
2123 data: *mut ::std::os::raw::c_void,
2124 ) -> bool,
2125 >,
2126 #[doc = "! Observe weight rules passed to the solver.\n!\n! @param[in] choice determines if the head is a choice or a disjunction\n! @param[in] head the head atoms\n! @param[in] head_size the number of atoms in the head\n! @param[in] lower_bound the lower bound of the weight rule\n! @param[in] body the weighted body literals\n! @param[in] body_size the number of weighted literals in the body\n! @param[in] data user data for the callback\n! @return whether the call was successful"]
2127 pub weight_rule: ::std::option::Option<
2128 unsafe extern "C" fn(
2129 choice: bool,
2130 head: *const clingo_atom_t,
2131 head_size: usize,
2132 lower_bound: clingo_weight_t,
2133 body: *const clingo_weighted_literal_t,
2134 body_size: usize,
2135 data: *mut ::std::os::raw::c_void,
2136 ) -> bool,
2137 >,
2138 #[doc = "! Observe minimize constraints (or weak constraints) passed to the solver.\n!\n! @param[in] priority the priority of the constraint\n! @param[in] literals the weighted literals whose sum to minimize\n! @param[in] size the number of weighted literals\n! @param[in] data user data for the callback\n! @return whether the call was successful"]
2139 pub minimize: ::std::option::Option<
2140 unsafe extern "C" fn(
2141 priority: clingo_weight_t,
2142 literals: *const clingo_weighted_literal_t,
2143 size: usize,
2144 data: *mut ::std::os::raw::c_void,
2145 ) -> bool,
2146 >,
2147 #[doc = "! Observe projection directives passed to the solver.\n!\n! @param[in] atoms the atoms to project on\n! @param[in] size the number of atoms\n! @param[in] data user data for the callback\n! @return whether the call was successful"]
2148 pub project: ::std::option::Option<
2149 unsafe extern "C" fn(
2150 atoms: *const clingo_atom_t,
2151 size: usize,
2152 data: *mut ::std::os::raw::c_void,
2153 ) -> bool,
2154 >,
2155 #[doc = "! Observe shown atoms passed to the solver.\n! \\note Facts do not have an associated aspif atom.\n! The value of the atom is set to zero.\n!\n! @param[in] symbol the symbolic representation of the atom\n! @param[in] atom the aspif atom (0 for facts)\n! @param[in] data user data for the callback\n! @return whether the call was successful"]
2156 pub output_atom: ::std::option::Option<
2157 unsafe extern "C" fn(
2158 symbol: clingo_symbol_t,
2159 atom: clingo_atom_t,
2160 data: *mut ::std::os::raw::c_void,
2161 ) -> bool,
2162 >,
2163 #[doc = "! Observe shown terms passed to the solver.\n!\n! @param[in] symbol the symbolic representation of the term\n! @param[in] condition the literals of the condition\n! @param[in] size the size of the condition\n! @param[in] data user data for the callback\n! @return whether the call was successful"]
2164 pub output_term: ::std::option::Option<
2165 unsafe extern "C" fn(
2166 symbol: clingo_symbol_t,
2167 condition: *const clingo_literal_t,
2168 size: usize,
2169 data: *mut ::std::os::raw::c_void,
2170 ) -> bool,
2171 >,
2172 #[doc = "! Observe external statements passed to the solver.\n!\n! @param[in] atom the external atom\n! @param[in] type the type of the external statement\n! @param[in] data user data for the callback\n! @return whether the call was successful"]
2173 pub external: ::std::option::Option<
2174 unsafe extern "C" fn(
2175 atom: clingo_atom_t,
2176 type_: clingo_external_type_t,
2177 data: *mut ::std::os::raw::c_void,
2178 ) -> bool,
2179 >,
2180 #[doc = "! Observe assumption directives passed to the solver.\n!\n! @param[in] literals the literals to assume (positive literals are true and negative literals false for the next solve call)\n! @param[in] size the number of atoms\n! @param[in] data user data for the callback\n! @return whether the call was successful"]
2181 pub assume: ::std::option::Option<
2182 unsafe extern "C" fn(
2183 literals: *const clingo_literal_t,
2184 size: usize,
2185 data: *mut ::std::os::raw::c_void,
2186 ) -> bool,
2187 >,
2188 #[doc = "! Observe heuristic directives passed to the solver.\n!\n! @param[in] atom the target atom\n! @param[in] type the type of the heuristic modification\n! @param[in] bias the heuristic bias\n! @param[in] priority the heuristic priority\n! @param[in] condition the condition under which to apply the heuristic modification\n! @param[in] size the number of atoms in the condition\n! @param[in] data user data for the callback\n! @return whether the call was successful"]
2189 pub heuristic: ::std::option::Option<
2190 unsafe extern "C" fn(
2191 atom: clingo_atom_t,
2192 type_: clingo_heuristic_type_t,
2193 bias: ::std::os::raw::c_int,
2194 priority: ::std::os::raw::c_uint,
2195 condition: *const clingo_literal_t,
2196 size: usize,
2197 data: *mut ::std::os::raw::c_void,
2198 ) -> bool,
2199 >,
2200 #[doc = "! Observe edge directives passed to the solver.\n!\n! @param[in] node_u the start vertex of the edge\n! @param[in] node_v the end vertex of the edge\n! @param[in] condition the condition under which the edge is part of the graph\n! @param[in] size the number of atoms in the condition\n! @param[in] data user data for the callback\n! @return whether the call was successful"]
2201 pub acyc_edge: ::std::option::Option<
2202 unsafe extern "C" fn(
2203 node_u: ::std::os::raw::c_int,
2204 node_v: ::std::os::raw::c_int,
2205 condition: *const clingo_literal_t,
2206 size: usize,
2207 data: *mut ::std::os::raw::c_void,
2208 ) -> bool,
2209 >,
2210 #[doc = "! Observe numeric theory terms.\n!\n! @param[in] term_id the id of the term\n! @param[in] number the value of the term\n! @param[in] data user data for the callback\n! @return whether the call was successful"]
2211 pub theory_term_number: ::std::option::Option<
2212 unsafe extern "C" fn(
2213 term_id: clingo_id_t,
2214 number: ::std::os::raw::c_int,
2215 data: *mut ::std::os::raw::c_void,
2216 ) -> bool,
2217 >,
2218 #[doc = "! Observe string theory terms.\n!\n! @param[in] term_id the id of the term\n! @param[in] name the value of the term\n! @param[in] data user data for the callback\n! @return whether the call was successful"]
2219 pub theory_term_string: ::std::option::Option<
2220 unsafe extern "C" fn(
2221 term_id: clingo_id_t,
2222 name: *const ::std::os::raw::c_char,
2223 data: *mut ::std::os::raw::c_void,
2224 ) -> bool,
2225 >,
2226 #[doc = "! Observe compound theory terms.\n!\n! The name_id_or_type gives the type of the compound term:\n! - if it is -1, then it is a tuple\n! - if it is -2, then it is a set\n! - if it is -3, then it is a list\n! - otherwise, it is a function and name_id_or_type refers to the id of the name (in form of a string term)\n!\n! @param[in] term_id the id of the term\n! @param[in] name_id_or_type the name or type of the term\n! @param[in] arguments the arguments of the term\n! @param[in] size the number of arguments\n! @param[in] data user data for the callback\n! @return whether the call was successful"]
2227 pub theory_term_compound: ::std::option::Option<
2228 unsafe extern "C" fn(
2229 term_id: clingo_id_t,
2230 name_id_or_type: ::std::os::raw::c_int,
2231 arguments: *const clingo_id_t,
2232 size: usize,
2233 data: *mut ::std::os::raw::c_void,
2234 ) -> bool,
2235 >,
2236 #[doc = "! Observe theory elements.\n!\n! @param element_id the id of the element\n! @param terms the term tuple of the element\n! @param terms_size the number of terms in the tuple\n! @param condition the condition of the elemnt\n! @param condition_size the number of literals in the condition\n! @param[in] data user data for the callback\n! @return whether the call was successful"]
2237 pub theory_element: ::std::option::Option<
2238 unsafe extern "C" fn(
2239 element_id: clingo_id_t,
2240 terms: *const clingo_id_t,
2241 terms_size: usize,
2242 condition: *const clingo_literal_t,
2243 condition_size: usize,
2244 data: *mut ::std::os::raw::c_void,
2245 ) -> bool,
2246 >,
2247 #[doc = "! Observe theory atoms without guard.\n!\n! @param[in] atom_id_or_zero the id of the atom or zero for directives\n! @param[in] term_id the term associated with the atom\n! @param[in] elements the elements of the atom\n! @param[in] size the number of elements\n! @param[in] data user data for the callback\n! @return whether the call was successful"]
2248 pub theory_atom: ::std::option::Option<
2249 unsafe extern "C" fn(
2250 atom_id_or_zero: clingo_id_t,
2251 term_id: clingo_id_t,
2252 elements: *const clingo_id_t,
2253 size: usize,
2254 data: *mut ::std::os::raw::c_void,
2255 ) -> bool,
2256 >,
2257 #[doc = "! Observe theory atoms with guard.\n!\n! @param[in] atom_id_or_zero the id of the atom or zero for directives\n! @param[in] term_id the term associated with the atom\n! @param[in] elements the elements of the atom\n! @param[in] size the number of elements\n! @param[in] operator_id the id of the operator (a string term)\n! @param[in] right_hand_side_id the id of the term on the right hand side of the atom\n! @param[in] data user data for the callback\n! @return whether the call was successful"]
2258 pub theory_atom_with_guard: ::std::option::Option<
2259 unsafe extern "C" fn(
2260 atom_id_or_zero: clingo_id_t,
2261 term_id: clingo_id_t,
2262 elements: *const clingo_id_t,
2263 size: usize,
2264 operator_id: clingo_id_t,
2265 right_hand_side_id: clingo_id_t,
2266 data: *mut ::std::os::raw::c_void,
2267 ) -> bool,
2268 >,
2269}
2270#[test]
2271fn bindgen_test_layout_clingo_ground_program_observer() {
2272 const UNINIT: ::std::mem::MaybeUninit<clingo_ground_program_observer> =
2273 ::std::mem::MaybeUninit::uninit();
2274 let ptr = UNINIT.as_ptr();
2275 assert_eq!(
2276 ::std::mem::size_of::<clingo_ground_program_observer>(),
2277 152usize,
2278 concat!("Size of: ", stringify!(clingo_ground_program_observer))
2279 );
2280 assert_eq!(
2281 ::std::mem::align_of::<clingo_ground_program_observer>(),
2282 8usize,
2283 concat!("Alignment of ", stringify!(clingo_ground_program_observer))
2284 );
2285 assert_eq!(
2286 unsafe { ::std::ptr::addr_of!((*ptr).init_program) as usize - ptr as usize },
2287 0usize,
2288 concat!(
2289 "Offset of field: ",
2290 stringify!(clingo_ground_program_observer),
2291 "::",
2292 stringify!(init_program)
2293 )
2294 );
2295 assert_eq!(
2296 unsafe { ::std::ptr::addr_of!((*ptr).begin_step) as usize - ptr as usize },
2297 8usize,
2298 concat!(
2299 "Offset of field: ",
2300 stringify!(clingo_ground_program_observer),
2301 "::",
2302 stringify!(begin_step)
2303 )
2304 );
2305 assert_eq!(
2306 unsafe { ::std::ptr::addr_of!((*ptr).end_step) as usize - ptr as usize },
2307 16usize,
2308 concat!(
2309 "Offset of field: ",
2310 stringify!(clingo_ground_program_observer),
2311 "::",
2312 stringify!(end_step)
2313 )
2314 );
2315 assert_eq!(
2316 unsafe { ::std::ptr::addr_of!((*ptr).rule) as usize - ptr as usize },
2317 24usize,
2318 concat!(
2319 "Offset of field: ",
2320 stringify!(clingo_ground_program_observer),
2321 "::",
2322 stringify!(rule)
2323 )
2324 );
2325 assert_eq!(
2326 unsafe { ::std::ptr::addr_of!((*ptr).weight_rule) as usize - ptr as usize },
2327 32usize,
2328 concat!(
2329 "Offset of field: ",
2330 stringify!(clingo_ground_program_observer),
2331 "::",
2332 stringify!(weight_rule)
2333 )
2334 );
2335 assert_eq!(
2336 unsafe { ::std::ptr::addr_of!((*ptr).minimize) as usize - ptr as usize },
2337 40usize,
2338 concat!(
2339 "Offset of field: ",
2340 stringify!(clingo_ground_program_observer),
2341 "::",
2342 stringify!(minimize)
2343 )
2344 );
2345 assert_eq!(
2346 unsafe { ::std::ptr::addr_of!((*ptr).project) as usize - ptr as usize },
2347 48usize,
2348 concat!(
2349 "Offset of field: ",
2350 stringify!(clingo_ground_program_observer),
2351 "::",
2352 stringify!(project)
2353 )
2354 );
2355 assert_eq!(
2356 unsafe { ::std::ptr::addr_of!((*ptr).output_atom) as usize - ptr as usize },
2357 56usize,
2358 concat!(
2359 "Offset of field: ",
2360 stringify!(clingo_ground_program_observer),
2361 "::",
2362 stringify!(output_atom)
2363 )
2364 );
2365 assert_eq!(
2366 unsafe { ::std::ptr::addr_of!((*ptr).output_term) as usize - ptr as usize },
2367 64usize,
2368 concat!(
2369 "Offset of field: ",
2370 stringify!(clingo_ground_program_observer),
2371 "::",
2372 stringify!(output_term)
2373 )
2374 );
2375 assert_eq!(
2376 unsafe { ::std::ptr::addr_of!((*ptr).external) as usize - ptr as usize },
2377 72usize,
2378 concat!(
2379 "Offset of field: ",
2380 stringify!(clingo_ground_program_observer),
2381 "::",
2382 stringify!(external)
2383 )
2384 );
2385 assert_eq!(
2386 unsafe { ::std::ptr::addr_of!((*ptr).assume) as usize - ptr as usize },
2387 80usize,
2388 concat!(
2389 "Offset of field: ",
2390 stringify!(clingo_ground_program_observer),
2391 "::",
2392 stringify!(assume)
2393 )
2394 );
2395 assert_eq!(
2396 unsafe { ::std::ptr::addr_of!((*ptr).heuristic) as usize - ptr as usize },
2397 88usize,
2398 concat!(
2399 "Offset of field: ",
2400 stringify!(clingo_ground_program_observer),
2401 "::",
2402 stringify!(heuristic)
2403 )
2404 );
2405 assert_eq!(
2406 unsafe { ::std::ptr::addr_of!((*ptr).acyc_edge) as usize - ptr as usize },
2407 96usize,
2408 concat!(
2409 "Offset of field: ",
2410 stringify!(clingo_ground_program_observer),
2411 "::",
2412 stringify!(acyc_edge)
2413 )
2414 );
2415 assert_eq!(
2416 unsafe { ::std::ptr::addr_of!((*ptr).theory_term_number) as usize - ptr as usize },
2417 104usize,
2418 concat!(
2419 "Offset of field: ",
2420 stringify!(clingo_ground_program_observer),
2421 "::",
2422 stringify!(theory_term_number)
2423 )
2424 );
2425 assert_eq!(
2426 unsafe { ::std::ptr::addr_of!((*ptr).theory_term_string) as usize - ptr as usize },
2427 112usize,
2428 concat!(
2429 "Offset of field: ",
2430 stringify!(clingo_ground_program_observer),
2431 "::",
2432 stringify!(theory_term_string)
2433 )
2434 );
2435 assert_eq!(
2436 unsafe { ::std::ptr::addr_of!((*ptr).theory_term_compound) as usize - ptr as usize },
2437 120usize,
2438 concat!(
2439 "Offset of field: ",
2440 stringify!(clingo_ground_program_observer),
2441 "::",
2442 stringify!(theory_term_compound)
2443 )
2444 );
2445 assert_eq!(
2446 unsafe { ::std::ptr::addr_of!((*ptr).theory_element) as usize - ptr as usize },
2447 128usize,
2448 concat!(
2449 "Offset of field: ",
2450 stringify!(clingo_ground_program_observer),
2451 "::",
2452 stringify!(theory_element)
2453 )
2454 );
2455 assert_eq!(
2456 unsafe { ::std::ptr::addr_of!((*ptr).theory_atom) as usize - ptr as usize },
2457 136usize,
2458 concat!(
2459 "Offset of field: ",
2460 stringify!(clingo_ground_program_observer),
2461 "::",
2462 stringify!(theory_atom)
2463 )
2464 );
2465 assert_eq!(
2466 unsafe { ::std::ptr::addr_of!((*ptr).theory_atom_with_guard) as usize - ptr as usize },
2467 144usize,
2468 concat!(
2469 "Offset of field: ",
2470 stringify!(clingo_ground_program_observer),
2471 "::",
2472 stringify!(theory_atom_with_guard)
2473 )
2474 );
2475}
2476#[doc = "! An instance of this struct has to be registered with a solver to observe ground directives as they are passed to the solver.\n!\n! @note This interface is closely modeled after the aspif format.\n! For more information please refer to the specification of the aspif format.\n!\n! Not all callbacks have to be implemented and can be set to NULL if not needed.\n! If one of the callbacks in the struct fails, grounding is stopped.\n! If a non-recoverable clingo API call fails, a callback must return false.\n! Otherwise ::clingo_error_unknown should be set and false returned.\n!\n! @see clingo_control_register_observer()"]
2477pub type clingo_ground_program_observer_t = clingo_ground_program_observer;
2478#[doc = "! Struct used to specify the program parts that have to be grounded.\n!\n! Programs may be structured into parts, which can be grounded independently with ::clingo_control_ground.\n! Program parts are mainly interesting for incremental grounding and multi-shot solving.\n! For single-shot solving, program parts are not needed.\n!\n! @note Parts of a logic program without an explicit <tt>\\#program</tt>\n! specification are by default put into a program called `base` without\n! arguments.\n!\n! @see clingo_control_ground()"]
2479#[repr(C)]
2480#[derive(Debug, Copy, Clone)]
2481pub struct clingo_part {
2482 #[doc = "!< name of the program part"]
2483 pub name: *const ::std::os::raw::c_char,
2484 #[doc = "!< array of parameters"]
2485 pub params: *const clingo_symbol_t,
2486 #[doc = "!< number of parameters"]
2487 pub size: usize,
2488}
2489#[test]
2490fn bindgen_test_layout_clingo_part() {
2491 const UNINIT: ::std::mem::MaybeUninit<clingo_part> = ::std::mem::MaybeUninit::uninit();
2492 let ptr = UNINIT.as_ptr();
2493 assert_eq!(
2494 ::std::mem::size_of::<clingo_part>(),
2495 24usize,
2496 concat!("Size of: ", stringify!(clingo_part))
2497 );
2498 assert_eq!(
2499 ::std::mem::align_of::<clingo_part>(),
2500 8usize,
2501 concat!("Alignment of ", stringify!(clingo_part))
2502 );
2503 assert_eq!(
2504 unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
2505 0usize,
2506 concat!(
2507 "Offset of field: ",
2508 stringify!(clingo_part),
2509 "::",
2510 stringify!(name)
2511 )
2512 );
2513 assert_eq!(
2514 unsafe { ::std::ptr::addr_of!((*ptr).params) as usize - ptr as usize },
2515 8usize,
2516 concat!(
2517 "Offset of field: ",
2518 stringify!(clingo_part),
2519 "::",
2520 stringify!(params)
2521 )
2522 );
2523 assert_eq!(
2524 unsafe { ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
2525 16usize,
2526 concat!(
2527 "Offset of field: ",
2528 stringify!(clingo_part),
2529 "::",
2530 stringify!(size)
2531 )
2532 );
2533}
2534#[doc = "! Struct used to specify the program parts that have to be grounded.\n!\n! Programs may be structured into parts, which can be grounded independently with ::clingo_control_ground.\n! Program parts are mainly interesting for incremental grounding and multi-shot solving.\n! For single-shot solving, program parts are not needed.\n!\n! @note Parts of a logic program without an explicit <tt>\\#program</tt>\n! specification are by default put into a program called `base` without\n! arguments.\n!\n! @see clingo_control_ground()"]
2535pub type clingo_part_t = clingo_part;
2536#[doc = "! Callback function to implement external functions.\n!\n! If an external function of form <tt>\\@name(parameters)</tt> occurs in a logic program,\n! then this function is called with its location, name, parameters, and a callback to inject symbols as arguments.\n! The callback can be called multiple times; all symbols passed are injected.\n!\n! If a (non-recoverable) clingo API function fails in this callback, for example, the symbol callback, the callback must return false.\n! In case of errors not related to clingo, this function can set error ::clingo_error_unknown and return false to stop grounding with an error.\n!\n! @param[in] location location from which the external function was called\n! @param[in] name name of the called external function\n! @param[in] arguments arguments of the called external function\n! @param[in] arguments_size number of arguments\n! @param[in] data user data of the callback\n! @param[in] symbol_callback function to inject symbols\n! @param[in] symbol_callback_data user data for the symbol callback\n! (must be passed untouched)\n! @return whether the call was successful\n! @see clingo_control_ground()\n!\n! The following example implements the external function <tt>\\@f()</tt> returning 42.\n! ~~~~~~~~~~~~~~~{.c}\n! bool\n! ground_callback(clingo_location_t const *location,\n! char const *name,\n! clingo_symbol_t const *arguments,\n! size_t arguments_size,\n! void *data,\n! clingo_symbol_callback_t symbol_callback,\n! void *symbol_callback_data) {\n! if (strcmp(name, \"f\") == 0 && arguments_size == 0) {\n! clingo_symbol_t sym;\n! clingo_symbol_create_number(42, &sym);\n! return symbol_callback(&sym, 1, symbol_callback_data);\n! }\n! clingo_set_error(clingo_error_runtime, \"function not found\");\n! return false;\n! }\n! ~~~~~~~~~~~~~~~"]
2537pub type clingo_ground_callback_t = ::std::option::Option<
2538 unsafe extern "C" fn(
2539 location: *const clingo_location_t,
2540 name: *const ::std::os::raw::c_char,
2541 arguments: *const clingo_symbol_t,
2542 arguments_size: usize,
2543 data: *mut ::std::os::raw::c_void,
2544 symbol_callback: clingo_symbol_callback_t,
2545 symbol_callback_data: *mut ::std::os::raw::c_void,
2546 ) -> bool,
2547>;
2548#[repr(C)]
2549#[derive(Debug)]
2550pub struct clingo_control {
2551 _unused: [u8; 0],
2552}
2553#[doc = "! Control object holding grounding and solving state."]
2554pub type clingo_control_t = clingo_control;
2555extern "C" {
2556 #[doc = "! Create a new control object.\n!\n! A control object has to be freed using clingo_control_free().\n!\n! @note Only gringo options (without <code>\\-\\-output</code>) and clasp's options are supported as arguments,\n! except basic options such as <code>\\-\\-help</code>.\n! Furthermore, a control object is blocked while a search call is active;\n! you must not call any member function during search.\n!\n! If the logger is NULL, messages are printed to stderr.\n!\n! @param[in] arguments C string array of command line arguments\n! @param[in] arguments_size size of the arguments array\n! @param[in] logger callback functions for warnings and info messages\n! @param[in] logger_data user data for the logger callback\n! @param[in] message_limit maximum number of times the logger callback is called\n! @param[out] control resulting control object\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! - ::clingo_error_runtime if argument parsing fails"]
2557 pub fn clingo_control_new(
2558 arguments: *const *const ::std::os::raw::c_char,
2559 arguments_size: usize,
2560 logger: clingo_logger_t,
2561 logger_data: *mut ::std::os::raw::c_void,
2562 message_limit: ::std::os::raw::c_uint,
2563 control: *mut *mut clingo_control_t,
2564 ) -> bool;
2565}
2566extern "C" {
2567 #[doc = "! Free a control object created with clingo_control_new().\n! @param[in] control the target"]
2568 pub fn clingo_control_free(control: *mut clingo_control_t);
2569}
2570extern "C" {
2571 #[doc = "! Extend the logic program with a program in a file.\n!\n! @param[in] control the target\n! @param[in] file path to the file\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! - ::clingo_error_runtime if parsing or checking fails"]
2572 pub fn clingo_control_load(
2573 control: *mut clingo_control_t,
2574 file: *const ::std::os::raw::c_char,
2575 ) -> bool;
2576}
2577extern "C" {
2578 #[doc = "! Extend the logic program with the given non-ground logic program in string form.\n!\n! This function puts the given program into a block of form: <tt>\\#program name(parameters).</tt>\n!\n! After extending the logic program, the corresponding program parts are typically grounded with ::clingo_control_ground.\n!\n! @param[in] control the target\n! @param[in] name name of the program block\n! @param[in] parameters string array of parameters of the program block\n! @param[in] parameters_size number of parameters\n! @param[in] program string representation of the program\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! - ::clingo_error_runtime if parsing fails"]
2579 pub fn clingo_control_add(
2580 control: *mut clingo_control_t,
2581 name: *const ::std::os::raw::c_char,
2582 parameters: *const *const ::std::os::raw::c_char,
2583 parameters_size: usize,
2584 program: *const ::std::os::raw::c_char,
2585 ) -> bool;
2586}
2587extern "C" {
2588 #[doc = "! Ground the selected @link ::clingo_part parts @endlink of the current (non-ground) logic program.\n!\n! After grounding, logic programs can be solved with ::clingo_control_solve().\n!\n! @note Parts of a logic program without an explicit <tt>\\#program</tt>\n! specification are by default put into a program called `base` without\n! arguments.\n!\n! @param[in] control the target\n! @param[in] parts array of parts to ground\n! @param[in] parts_size size of the parts array\n! @param[in] ground_callback callback to implement external functions\n! @param[in] ground_callback_data user data for ground_callback\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! - error code of ground callback\n!\n! @see clingo_part"]
2589 pub fn clingo_control_ground(
2590 control: *mut clingo_control_t,
2591 parts: *const clingo_part_t,
2592 parts_size: usize,
2593 ground_callback: clingo_ground_callback_t,
2594 ground_callback_data: *mut ::std::os::raw::c_void,
2595 ) -> bool;
2596}
2597extern "C" {
2598 #[doc = "! Solve the currently @link ::clingo_control_ground grounded @endlink logic program enumerating its models.\n!\n! See the @ref SolveHandle module for more information.\n!\n! @param[in] control the target\n! @param[in] mode configures the search mode\n! @param[in] assumptions array of assumptions to solve under\n! @param[in] assumptions_size number of assumptions\n! @param[in] notify the event handler to register\n! @param[in] data the user data for the event handler\n! @param[out] handle handle to the current search to enumerate models\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! - ::clingo_error_runtime if solving could not be started"]
2599 pub fn clingo_control_solve(
2600 control: *mut clingo_control_t,
2601 mode: clingo_solve_mode_bitset_t,
2602 assumptions: *const clingo_literal_t,
2603 assumptions_size: usize,
2604 notify: clingo_solve_event_callback_t,
2605 data: *mut ::std::os::raw::c_void,
2606 handle: *mut *mut clingo_solve_handle_t,
2607 ) -> bool;
2608}
2609extern "C" {
2610 #[doc = "! @param[in] control the target\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n!\n! @see clingo_control_get_enable_cleanup()\n! @see clingo_control_set_enable_cleanup()"]
2611 pub fn clingo_control_cleanup(control: *mut clingo_control_t) -> bool;
2612}
2613extern "C" {
2614 #[doc = "! Assign a truth value to an external atom.\n!\n! If a negative literal is passed, the corresponding atom is assigned the\n! inverted truth value.\n!\n! If the atom does not exist or is not external, this is a noop.\n!\n! @param[in] control the target\n! @param[in] literal literal to assign\n! @param[in] value the truth value\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
2615 pub fn clingo_control_assign_external(
2616 control: *mut clingo_control_t,
2617 literal: clingo_literal_t,
2618 value: clingo_truth_value_t,
2619 ) -> bool;
2620}
2621extern "C" {
2622 #[doc = "! Release an external atom.\n!\n! If a negative literal is passed, the corresponding atom is released.\n!\n! After this call, an external atom is no longer external and subject to\n! program simplifications. If the atom does not exist or is not external,\n! this is a noop.\n!\n! @param[in] control the target\n! @param[in] literal literal to release\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
2623 pub fn clingo_control_release_external(
2624 control: *mut clingo_control_t,
2625 literal: clingo_literal_t,
2626 ) -> bool;
2627}
2628extern "C" {
2629 #[doc = "! Register a custom propagator with the control object.\n!\n! If the sequential flag is set to true, the propagator is called\n! sequentially when solving with multiple threads.\n!\n! See the @ref Propagator module for more information.\n!\n! @param[in] control the target\n! @param[in] propagator the propagator\n! @param[in] data user data passed to the propagator functions\n! @param[in] sequential whether the propagator should be called sequentially\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
2630 pub fn clingo_control_register_propagator(
2631 control: *mut clingo_control_t,
2632 propagator: *const clingo_propagator_t,
2633 data: *mut ::std::os::raw::c_void,
2634 sequential: bool,
2635 ) -> bool;
2636}
2637extern "C" {
2638 #[doc = "! Check if the solver has determined that the internal program representation is conflicting.\n!\n! If this function returns true, solve calls will return immediately with an unsatisfiable solve result.\n! Note that conflicts first have to be detected, e.g. -\n! initial unit propagation results in an empty clause,\n! or later if an empty clause is resolved during solving.\n! Hence, the function might return false even if the problem is unsatisfiable.\n!\n! @param[in] control the target\n! @return whether the program representation is conflicting"]
2639 pub fn clingo_control_is_conflicting(control: *const clingo_control_t) -> bool;
2640}
2641extern "C" {
2642 #[doc = "! Get a statistics object to inspect solver statistics.\n!\n! Statistics are updated after a solve call.\n!\n! See the @ref Statistics module for more information.\n!\n! @attention\n! The level of detail of the statistics depends on the stats option\n! (which can be set using @ref Configuration module or passed as an option when @link clingo_control_new creating the control object@endlink).\n! The default level zero only provides basic statistics,\n! level one provides extended and accumulated statistics,\n! and level two provides per-thread statistics.\n! Furthermore, the statistics object is best accessed right after solving.\n! Otherwise, not all of its entries have valid values.\n!\n! @param[in] control the target\n! @param[out] statistics the statistics object\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
2643 pub fn clingo_control_statistics(
2644 control: *const clingo_control_t,
2645 statistics: *mut *const clingo_statistics_t,
2646 ) -> bool;
2647}
2648extern "C" {
2649 #[doc = "! Interrupt the active solve call (or the following solve call right at the beginning).\n!\n! @param[in] control the target"]
2650 pub fn clingo_control_interrupt(control: *mut clingo_control_t);
2651}
2652extern "C" {
2653 #[doc = "! Get low-level access to clasp.\n!\n! @attention\n! This function is intended for experimental use only and not part of the stable API.\n!\n! This function may return a <code>nullptr</code>.\n! Otherwise, the returned pointer can be casted to a ClaspFacade pointer.\n!\n! @param[in] control the target\n! @param[out] clasp pointer to the ClaspFacade object (may be <code>nullptr</code>)\n! @return whether the call was successful"]
2654 pub fn clingo_control_clasp_facade(
2655 control: *mut clingo_control_t,
2656 clasp: *mut *mut ::std::os::raw::c_void,
2657 ) -> bool;
2658}
2659extern "C" {
2660 #[doc = "! Get a configuration object to change the solver configuration.\n!\n! See the @ref Configuration module for more information.\n!\n! @param[in] control the target\n! @param[out] configuration the configuration object\n! @return whether the call was successful"]
2661 pub fn clingo_control_configuration(
2662 control: *mut clingo_control_t,
2663 configuration: *mut *mut clingo_configuration_t,
2664 ) -> bool;
2665}
2666extern "C" {
2667 #[doc = "! Configure how learnt constraints are handled during enumeration.\n!\n! If the enumeration assumption is enabled, then all information learnt from\n! the solver's various enumeration modes is removed after a solve call. This\n! includes enumeration of cautious or brave consequences, enumeration of\n! answer sets with or without projection, or finding optimal models, as well\n! as clauses added with clingo_solve_control_add_clause().\n!\n! @attention For practical purposes, this option is only interesting for single-shot solving\n! or before the last solve call to squeeze out a tiny bit of performance.\n! Initially, the enumeration assumption is enabled.\n!\n! @param[in] control the target\n! @param[in] enable whether to enable the assumption\n! @return whether the call was successful"]
2668 pub fn clingo_control_set_enable_enumeration_assumption(
2669 control: *mut clingo_control_t,
2670 enable: bool,
2671 ) -> bool;
2672}
2673extern "C" {
2674 #[doc = "! Check whether the enumeration assumption is enabled.\n!\n! See ::clingo_control_set_enable_enumeration_assumption().\n! @param[in] control the target\n! @return whether using the enumeration assumption is enabled"]
2675 pub fn clingo_control_get_enable_enumeration_assumption(control: *mut clingo_control_t)
2676 -> bool;
2677}
2678extern "C" {
2679 #[doc = "! Enable automatic cleanup after solving.\n!\n! @note Cleanup is enabled by default.\n!\n! @param[in] control the target\n! @param[in] enable whether to enable cleanups\n! @return whether the call was successful\n!\n! @see clingo_control_cleanup()\n! @see clingo_control_get_enable_cleanup()"]
2680 pub fn clingo_control_set_enable_cleanup(control: *mut clingo_control_t, enable: bool) -> bool;
2681}
2682extern "C" {
2683 #[doc = "! Check whether automatic cleanup is enabled.\n!\n! See ::clingo_control_set_enable_cleanup().\n!\n! @param[in] control the target\n!\n! @see clingo_control_cleanup()\n! @see clingo_control_set_enable_cleanup()"]
2684 pub fn clingo_control_get_enable_cleanup(control: *mut clingo_control_t) -> bool;
2685}
2686extern "C" {
2687 #[doc = "! Return the symbol for a constant definition of form: <tt>\\#const name = symbol</tt>.\n!\n! @param[in] control the target\n! @param[in] name the name of the constant\n! @param[out] symbol the resulting symbol\n! @return whether the call was successful"]
2688 pub fn clingo_control_get_const(
2689 control: *const clingo_control_t,
2690 name: *const ::std::os::raw::c_char,
2691 symbol: *mut clingo_symbol_t,
2692 ) -> bool;
2693}
2694extern "C" {
2695 #[doc = "! Check if there is a constant definition for the given constant.\n!\n! @param[in] control the target\n! @param[in] name the name of the constant\n! @param[out] exists whether a matching constant definition exists\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime if constant definition does not exist\n!\n! @see clingo_control_get_const()"]
2696 pub fn clingo_control_has_const(
2697 control: *const clingo_control_t,
2698 name: *const ::std::os::raw::c_char,
2699 exists: *mut bool,
2700 ) -> bool;
2701}
2702extern "C" {
2703 #[doc = "! Get an object to inspect symbolic atoms (the relevant Herbrand base) used\n! for grounding.\n!\n! See the @ref SymbolicAtoms module for more information.\n!\n! @param[in] control the target\n! @param[out] atoms the symbolic atoms object\n! @return whether the call was successful"]
2704 pub fn clingo_control_symbolic_atoms(
2705 control: *const clingo_control_t,
2706 atoms: *mut *const clingo_symbolic_atoms_t,
2707 ) -> bool;
2708}
2709extern "C" {
2710 #[doc = "! Get an object to inspect theory atoms that occur in the grounding.\n!\n! See the @ref TheoryAtoms module for more information.\n!\n! @param[in] control the target\n! @param[out] atoms the theory atoms object\n! @return whether the call was successful"]
2711 pub fn clingo_control_theory_atoms(
2712 control: *const clingo_control_t,
2713 atoms: *mut *const clingo_theory_atoms_t,
2714 ) -> bool;
2715}
2716extern "C" {
2717 #[doc = "! Register a program observer with the control object.\n!\n! @param[in] control the target\n! @param[in] observer the observer to register\n! @param[in] replace just pass the grounding to the observer but not the solver\n! @param[in] data user data passed to the observer functions\n! @return whether the call was successful"]
2718 pub fn clingo_control_register_observer(
2719 control: *mut clingo_control_t,
2720 observer: *const clingo_ground_program_observer_t,
2721 replace: bool,
2722 data: *mut ::std::os::raw::c_void,
2723 ) -> bool;
2724}
2725extern "C" {
2726 #[doc = "! Get an object to add ground directives to the program.\n!\n! See the @ref ProgramBuilder module for more information.\n!\n! @param[in] control the target\n! @param[out] backend the backend object\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
2727 pub fn clingo_control_backend(
2728 control: *mut clingo_control_t,
2729 backend: *mut *mut clingo_backend_t,
2730 ) -> bool;
2731}
2732#[doc = "!< Theory tuples \"(t1,...,tn)\"."]
2733pub const clingo_ast_theory_sequence_type_e_clingo_ast_theory_sequence_type_tuple:
2734 clingo_ast_theory_sequence_type_e = 0;
2735#[doc = "!< Theory lists \"[t1,...,tn]\"."]
2736pub const clingo_ast_theory_sequence_type_e_clingo_ast_theory_sequence_type_list:
2737 clingo_ast_theory_sequence_type_e = 1;
2738#[doc = "!< Theory sets \"{t1,...,tn}\"."]
2739pub const clingo_ast_theory_sequence_type_e_clingo_ast_theory_sequence_type_set:
2740 clingo_ast_theory_sequence_type_e = 2;
2741#[doc = "! Enumeration of theory sequence types.\n!\n! Same as clingo_theory_sequence_type_e but kept for backward compatibility."]
2742pub type clingo_ast_theory_sequence_type_e = ::std::os::raw::c_uint;
2743#[doc = "! Corresponding type to ::clingo_ast_theory_sequence_type_e."]
2744pub type clingo_ast_theory_sequence_type_t = ::std::os::raw::c_int;
2745#[doc = "!< Operator \">\"."]
2746pub const clingo_ast_comparison_operator_e_clingo_ast_comparison_operator_greater_than:
2747 clingo_ast_comparison_operator_e = 0;
2748#[doc = "!< Operator \"<\"."]
2749pub const clingo_ast_comparison_operator_e_clingo_ast_comparison_operator_less_than:
2750 clingo_ast_comparison_operator_e = 1;
2751#[doc = "!< Operator \"<=\"."]
2752pub const clingo_ast_comparison_operator_e_clingo_ast_comparison_operator_less_equal:
2753 clingo_ast_comparison_operator_e = 2;
2754#[doc = "!< Operator \">=\"."]
2755pub const clingo_ast_comparison_operator_e_clingo_ast_comparison_operator_greater_equal:
2756 clingo_ast_comparison_operator_e = 3;
2757#[doc = "!< Operator \"!=\"."]
2758pub const clingo_ast_comparison_operator_e_clingo_ast_comparison_operator_not_equal:
2759 clingo_ast_comparison_operator_e = 4;
2760#[doc = "!< Operator \"==\"."]
2761pub const clingo_ast_comparison_operator_e_clingo_ast_comparison_operator_equal:
2762 clingo_ast_comparison_operator_e = 5;
2763#[doc = "! Enumeration of comparison relations."]
2764pub type clingo_ast_comparison_operator_e = ::std::os::raw::c_uint;
2765#[doc = "! Corresponding type to ::clingo_ast_comparison_operator_e."]
2766pub type clingo_ast_comparison_operator_t = ::std::os::raw::c_int;
2767#[doc = "!< For positive literals."]
2768pub const clingo_ast_sign_e_clingo_ast_sign_no_sign: clingo_ast_sign_e = 0;
2769#[doc = "!< For negative literals (prefix \"not\")."]
2770pub const clingo_ast_sign_e_clingo_ast_sign_negation: clingo_ast_sign_e = 1;
2771#[doc = "!< For double negated literals (prefix \"not not\")."]
2772pub const clingo_ast_sign_e_clingo_ast_sign_double_negation: clingo_ast_sign_e = 2;
2773#[doc = "! Enumeration of signs."]
2774pub type clingo_ast_sign_e = ::std::os::raw::c_uint;
2775#[doc = "! Corresponding type to ::clingo_ast_sign_t."]
2776pub type clingo_ast_sign_t = ::std::os::raw::c_int;
2777#[doc = "!< Operator \"-\"."]
2778pub const clingo_ast_unary_operator_e_clingo_ast_unary_operator_minus: clingo_ast_unary_operator_e =
2779 0;
2780#[doc = "!< Operator \"~\"."]
2781pub const clingo_ast_unary_operator_e_clingo_ast_unary_operator_negation:
2782 clingo_ast_unary_operator_e = 1;
2783#[doc = "!< Operator \"|.|\"."]
2784pub const clingo_ast_unary_operator_e_clingo_ast_unary_operator_absolute:
2785 clingo_ast_unary_operator_e = 2;
2786#[doc = "! Enumeration of unary operators."]
2787pub type clingo_ast_unary_operator_e = ::std::os::raw::c_uint;
2788#[doc = "! Corresponding type to ::clingo_ast_unary_operator_e."]
2789pub type clingo_ast_unary_operator_t = ::std::os::raw::c_int;
2790#[doc = "!< Operator \"^\"."]
2791pub const clingo_ast_binary_operator_e_clingo_ast_binary_operator_xor:
2792 clingo_ast_binary_operator_e = 0;
2793#[doc = "!< Operator \"?\"."]
2794pub const clingo_ast_binary_operator_e_clingo_ast_binary_operator_or: clingo_ast_binary_operator_e =
2795 1;
2796#[doc = "!< Operator \"&\"."]
2797pub const clingo_ast_binary_operator_e_clingo_ast_binary_operator_and:
2798 clingo_ast_binary_operator_e = 2;
2799#[doc = "!< Operator \"+\"."]
2800pub const clingo_ast_binary_operator_e_clingo_ast_binary_operator_plus:
2801 clingo_ast_binary_operator_e = 3;
2802#[doc = "!< Operator \"-\"."]
2803pub const clingo_ast_binary_operator_e_clingo_ast_binary_operator_minus:
2804 clingo_ast_binary_operator_e = 4;
2805#[doc = "!< Operator \"*\"."]
2806pub const clingo_ast_binary_operator_e_clingo_ast_binary_operator_multiplication:
2807 clingo_ast_binary_operator_e = 5;
2808#[doc = "!< Operator \"/\"."]
2809pub const clingo_ast_binary_operator_e_clingo_ast_binary_operator_division:
2810 clingo_ast_binary_operator_e = 6;
2811#[doc = "!< Operator \"\\\"."]
2812pub const clingo_ast_binary_operator_e_clingo_ast_binary_operator_modulo:
2813 clingo_ast_binary_operator_e = 7;
2814#[doc = "!< Operator \"**\"."]
2815pub const clingo_ast_binary_operator_e_clingo_ast_binary_operator_power:
2816 clingo_ast_binary_operator_e = 8;
2817#[doc = "! Enumeration of binary operators."]
2818pub type clingo_ast_binary_operator_e = ::std::os::raw::c_uint;
2819#[doc = "! Corresponding type to ::clingo_ast_binary_operator_e."]
2820pub type clingo_ast_binary_operator_t = ::std::os::raw::c_int;
2821#[doc = "!< Operator \"^\"."]
2822pub const clingo_ast_aggregate_function_e_clingo_ast_aggregate_function_count:
2823 clingo_ast_aggregate_function_e = 0;
2824#[doc = "!< Operator \"?\"."]
2825pub const clingo_ast_aggregate_function_e_clingo_ast_aggregate_function_sum:
2826 clingo_ast_aggregate_function_e = 1;
2827#[doc = "!< Operator \"&\"."]
2828pub const clingo_ast_aggregate_function_e_clingo_ast_aggregate_function_sump:
2829 clingo_ast_aggregate_function_e = 2;
2830#[doc = "!< Operator \"+\"."]
2831pub const clingo_ast_aggregate_function_e_clingo_ast_aggregate_function_min:
2832 clingo_ast_aggregate_function_e = 3;
2833#[doc = "!< Operator \"-\"."]
2834pub const clingo_ast_aggregate_function_e_clingo_ast_aggregate_function_max:
2835 clingo_ast_aggregate_function_e = 4;
2836#[doc = "! Enumeration of aggregate functions."]
2837pub type clingo_ast_aggregate_function_e = ::std::os::raw::c_uint;
2838#[doc = "! Corresponding type to ::clingo_ast_aggregate_function_e."]
2839pub type clingo_ast_aggregate_function_t = ::std::os::raw::c_int;
2840#[doc = "!< An unary theory operator."]
2841pub const clingo_ast_theory_operator_type_e_clingo_ast_theory_operator_type_unary:
2842 clingo_ast_theory_operator_type_e = 0;
2843#[doc = "!< A left associative binary operator."]
2844pub const clingo_ast_theory_operator_type_e_clingo_ast_theory_operator_type_binary_left:
2845 clingo_ast_theory_operator_type_e = 1;
2846#[doc = "!< A right associative binary operator."]
2847pub const clingo_ast_theory_operator_type_e_clingo_ast_theory_operator_type_binary_right:
2848 clingo_ast_theory_operator_type_e = 2;
2849#[doc = "! Enumeration of theory operators."]
2850pub type clingo_ast_theory_operator_type_e = ::std::os::raw::c_uint;
2851#[doc = "! Corresponding type to ::clingo_ast_theory_operator_type_e."]
2852pub type clingo_ast_theory_operator_type_t = ::std::os::raw::c_int;
2853#[doc = "!< For theory atoms that can appear in the head."]
2854pub const clingo_ast_theory_atom_definition_type_e_clingo_ast_theory_atom_definition_type_head:
2855 clingo_ast_theory_atom_definition_type_e = 0;
2856#[doc = "!< For theory atoms that can appear in the body."]
2857pub const clingo_ast_theory_atom_definition_type_e_clingo_ast_theory_atom_definition_type_body:
2858 clingo_ast_theory_atom_definition_type_e = 1;
2859#[doc = "!< For theory atoms that can appear in both head and body."]
2860pub const clingo_ast_theory_atom_definition_type_e_clingo_ast_theory_atom_definition_type_any:
2861 clingo_ast_theory_atom_definition_type_e = 2;
2862#[doc = "!< For theory atoms that must not have a body."]
2863pub const clingo_ast_theory_atom_definition_type_e_clingo_ast_theory_atom_definition_type_directive : clingo_ast_theory_atom_definition_type_e = 3 ;
2864#[doc = "! Enumeration of the theory atom types."]
2865pub type clingo_ast_theory_atom_definition_type_e = ::std::os::raw::c_uint;
2866#[doc = "! Corresponding type to ::clingo_ast_theory_atom_definition_type_e."]
2867pub type clingo_ast_theory_atom_definition_type_t = ::std::os::raw::c_int;
2868pub const clingo_ast_type_e_clingo_ast_type_id: clingo_ast_type_e = 0;
2869pub const clingo_ast_type_e_clingo_ast_type_variable: clingo_ast_type_e = 1;
2870pub const clingo_ast_type_e_clingo_ast_type_symbolic_term: clingo_ast_type_e = 2;
2871pub const clingo_ast_type_e_clingo_ast_type_unary_operation: clingo_ast_type_e = 3;
2872pub const clingo_ast_type_e_clingo_ast_type_binary_operation: clingo_ast_type_e = 4;
2873pub const clingo_ast_type_e_clingo_ast_type_interval: clingo_ast_type_e = 5;
2874pub const clingo_ast_type_e_clingo_ast_type_function: clingo_ast_type_e = 6;
2875pub const clingo_ast_type_e_clingo_ast_type_pool: clingo_ast_type_e = 7;
2876pub const clingo_ast_type_e_clingo_ast_type_boolean_constant: clingo_ast_type_e = 8;
2877pub const clingo_ast_type_e_clingo_ast_type_symbolic_atom: clingo_ast_type_e = 9;
2878pub const clingo_ast_type_e_clingo_ast_type_comparison: clingo_ast_type_e = 10;
2879pub const clingo_ast_type_e_clingo_ast_type_guard: clingo_ast_type_e = 11;
2880pub const clingo_ast_type_e_clingo_ast_type_conditional_literal: clingo_ast_type_e = 12;
2881pub const clingo_ast_type_e_clingo_ast_type_aggregate: clingo_ast_type_e = 13;
2882pub const clingo_ast_type_e_clingo_ast_type_body_aggregate_element: clingo_ast_type_e = 14;
2883pub const clingo_ast_type_e_clingo_ast_type_body_aggregate: clingo_ast_type_e = 15;
2884pub const clingo_ast_type_e_clingo_ast_type_head_aggregate_element: clingo_ast_type_e = 16;
2885pub const clingo_ast_type_e_clingo_ast_type_head_aggregate: clingo_ast_type_e = 17;
2886pub const clingo_ast_type_e_clingo_ast_type_disjunction: clingo_ast_type_e = 18;
2887pub const clingo_ast_type_e_clingo_ast_type_theory_sequence: clingo_ast_type_e = 19;
2888pub const clingo_ast_type_e_clingo_ast_type_theory_function: clingo_ast_type_e = 20;
2889pub const clingo_ast_type_e_clingo_ast_type_theory_unparsed_term_element: clingo_ast_type_e = 21;
2890pub const clingo_ast_type_e_clingo_ast_type_theory_unparsed_term: clingo_ast_type_e = 22;
2891pub const clingo_ast_type_e_clingo_ast_type_theory_guard: clingo_ast_type_e = 23;
2892pub const clingo_ast_type_e_clingo_ast_type_theory_atom_element: clingo_ast_type_e = 24;
2893pub const clingo_ast_type_e_clingo_ast_type_theory_atom: clingo_ast_type_e = 25;
2894pub const clingo_ast_type_e_clingo_ast_type_literal: clingo_ast_type_e = 26;
2895pub const clingo_ast_type_e_clingo_ast_type_theory_operator_definition: clingo_ast_type_e = 27;
2896pub const clingo_ast_type_e_clingo_ast_type_theory_term_definition: clingo_ast_type_e = 28;
2897pub const clingo_ast_type_e_clingo_ast_type_theory_guard_definition: clingo_ast_type_e = 29;
2898pub const clingo_ast_type_e_clingo_ast_type_theory_atom_definition: clingo_ast_type_e = 30;
2899pub const clingo_ast_type_e_clingo_ast_type_rule: clingo_ast_type_e = 31;
2900pub const clingo_ast_type_e_clingo_ast_type_definition: clingo_ast_type_e = 32;
2901pub const clingo_ast_type_e_clingo_ast_type_show_signature: clingo_ast_type_e = 33;
2902pub const clingo_ast_type_e_clingo_ast_type_show_term: clingo_ast_type_e = 34;
2903pub const clingo_ast_type_e_clingo_ast_type_minimize: clingo_ast_type_e = 35;
2904pub const clingo_ast_type_e_clingo_ast_type_script: clingo_ast_type_e = 36;
2905pub const clingo_ast_type_e_clingo_ast_type_program: clingo_ast_type_e = 37;
2906pub const clingo_ast_type_e_clingo_ast_type_external: clingo_ast_type_e = 38;
2907pub const clingo_ast_type_e_clingo_ast_type_edge: clingo_ast_type_e = 39;
2908pub const clingo_ast_type_e_clingo_ast_type_heuristic: clingo_ast_type_e = 40;
2909pub const clingo_ast_type_e_clingo_ast_type_project_atom: clingo_ast_type_e = 41;
2910pub const clingo_ast_type_e_clingo_ast_type_project_signature: clingo_ast_type_e = 42;
2911pub const clingo_ast_type_e_clingo_ast_type_defined: clingo_ast_type_e = 43;
2912pub const clingo_ast_type_e_clingo_ast_type_theory_definition: clingo_ast_type_e = 44;
2913#[doc = "! Enumeration of AST types."]
2914pub type clingo_ast_type_e = ::std::os::raw::c_uint;
2915#[doc = "! Corresponding type to ::clingo_ast_type_e."]
2916pub type clingo_ast_type_t = ::std::os::raw::c_int;
2917#[doc = "!< For an attribute of type \"int\"."]
2918pub const clingo_ast_attribute_type_e_clingo_ast_attribute_type_number:
2919 clingo_ast_attribute_type_e = 0;
2920#[doc = "!< For an attribute of type \"clingo_ast_symbol_t\"."]
2921pub const clingo_ast_attribute_type_e_clingo_ast_attribute_type_symbol:
2922 clingo_ast_attribute_type_e = 1;
2923#[doc = "!< For an attribute of type \"clingo_location_t\"."]
2924pub const clingo_ast_attribute_type_e_clingo_ast_attribute_type_location:
2925 clingo_ast_attribute_type_e = 2;
2926#[doc = "!< For an attribute of type \"char const *\"."]
2927pub const clingo_ast_attribute_type_e_clingo_ast_attribute_type_string:
2928 clingo_ast_attribute_type_e = 3;
2929#[doc = "!< For an attribute of type \"clingo_ast_t *\"."]
2930pub const clingo_ast_attribute_type_e_clingo_ast_attribute_type_ast: clingo_ast_attribute_type_e =
2931 4;
2932#[doc = "!< For an attribute of type \"clingo_ast_t *\" that can be NULL."]
2933pub const clingo_ast_attribute_type_e_clingo_ast_attribute_type_optional_ast:
2934 clingo_ast_attribute_type_e = 5;
2935#[doc = "!< For an attribute of type \"char const **\"."]
2936pub const clingo_ast_attribute_type_e_clingo_ast_attribute_type_string_array:
2937 clingo_ast_attribute_type_e = 6;
2938#[doc = "!< For an attribute of type \"clingo_ast_t **\"."]
2939pub const clingo_ast_attribute_type_e_clingo_ast_attribute_type_ast_array:
2940 clingo_ast_attribute_type_e = 7;
2941#[doc = "! Enumeration of attributes types used by the AST."]
2942pub type clingo_ast_attribute_type_e = ::std::os::raw::c_uint;
2943#[doc = "! Corresponding type to ::clingo_ast_attribute_type."]
2944pub type clingo_ast_attribute_type_t = ::std::os::raw::c_int;
2945pub const clingo_ast_attribute_e_clingo_ast_attribute_argument: clingo_ast_attribute_e = 0;
2946pub const clingo_ast_attribute_e_clingo_ast_attribute_arguments: clingo_ast_attribute_e = 1;
2947pub const clingo_ast_attribute_e_clingo_ast_attribute_arity: clingo_ast_attribute_e = 2;
2948pub const clingo_ast_attribute_e_clingo_ast_attribute_atom: clingo_ast_attribute_e = 3;
2949pub const clingo_ast_attribute_e_clingo_ast_attribute_atoms: clingo_ast_attribute_e = 4;
2950pub const clingo_ast_attribute_e_clingo_ast_attribute_atom_type: clingo_ast_attribute_e = 5;
2951pub const clingo_ast_attribute_e_clingo_ast_attribute_bias: clingo_ast_attribute_e = 6;
2952pub const clingo_ast_attribute_e_clingo_ast_attribute_body: clingo_ast_attribute_e = 7;
2953pub const clingo_ast_attribute_e_clingo_ast_attribute_code: clingo_ast_attribute_e = 8;
2954pub const clingo_ast_attribute_e_clingo_ast_attribute_coefficient: clingo_ast_attribute_e = 9;
2955pub const clingo_ast_attribute_e_clingo_ast_attribute_comparison: clingo_ast_attribute_e = 10;
2956pub const clingo_ast_attribute_e_clingo_ast_attribute_condition: clingo_ast_attribute_e = 11;
2957pub const clingo_ast_attribute_e_clingo_ast_attribute_elements: clingo_ast_attribute_e = 12;
2958pub const clingo_ast_attribute_e_clingo_ast_attribute_external: clingo_ast_attribute_e = 13;
2959pub const clingo_ast_attribute_e_clingo_ast_attribute_external_type: clingo_ast_attribute_e = 14;
2960pub const clingo_ast_attribute_e_clingo_ast_attribute_function: clingo_ast_attribute_e = 15;
2961pub const clingo_ast_attribute_e_clingo_ast_attribute_guard: clingo_ast_attribute_e = 16;
2962pub const clingo_ast_attribute_e_clingo_ast_attribute_guards: clingo_ast_attribute_e = 17;
2963pub const clingo_ast_attribute_e_clingo_ast_attribute_head: clingo_ast_attribute_e = 18;
2964pub const clingo_ast_attribute_e_clingo_ast_attribute_is_default: clingo_ast_attribute_e = 19;
2965pub const clingo_ast_attribute_e_clingo_ast_attribute_left: clingo_ast_attribute_e = 20;
2966pub const clingo_ast_attribute_e_clingo_ast_attribute_left_guard: clingo_ast_attribute_e = 21;
2967pub const clingo_ast_attribute_e_clingo_ast_attribute_literal: clingo_ast_attribute_e = 22;
2968pub const clingo_ast_attribute_e_clingo_ast_attribute_location: clingo_ast_attribute_e = 23;
2969pub const clingo_ast_attribute_e_clingo_ast_attribute_modifier: clingo_ast_attribute_e = 24;
2970pub const clingo_ast_attribute_e_clingo_ast_attribute_name: clingo_ast_attribute_e = 25;
2971pub const clingo_ast_attribute_e_clingo_ast_attribute_node_u: clingo_ast_attribute_e = 26;
2972pub const clingo_ast_attribute_e_clingo_ast_attribute_node_v: clingo_ast_attribute_e = 27;
2973pub const clingo_ast_attribute_e_clingo_ast_attribute_operator_name: clingo_ast_attribute_e = 28;
2974pub const clingo_ast_attribute_e_clingo_ast_attribute_operator_type: clingo_ast_attribute_e = 29;
2975pub const clingo_ast_attribute_e_clingo_ast_attribute_operators: clingo_ast_attribute_e = 30;
2976pub const clingo_ast_attribute_e_clingo_ast_attribute_parameters: clingo_ast_attribute_e = 31;
2977pub const clingo_ast_attribute_e_clingo_ast_attribute_positive: clingo_ast_attribute_e = 32;
2978pub const clingo_ast_attribute_e_clingo_ast_attribute_priority: clingo_ast_attribute_e = 33;
2979pub const clingo_ast_attribute_e_clingo_ast_attribute_right: clingo_ast_attribute_e = 34;
2980pub const clingo_ast_attribute_e_clingo_ast_attribute_right_guard: clingo_ast_attribute_e = 35;
2981pub const clingo_ast_attribute_e_clingo_ast_attribute_sequence_type: clingo_ast_attribute_e = 36;
2982pub const clingo_ast_attribute_e_clingo_ast_attribute_sign: clingo_ast_attribute_e = 37;
2983pub const clingo_ast_attribute_e_clingo_ast_attribute_symbol: clingo_ast_attribute_e = 38;
2984pub const clingo_ast_attribute_e_clingo_ast_attribute_term: clingo_ast_attribute_e = 39;
2985pub const clingo_ast_attribute_e_clingo_ast_attribute_terms: clingo_ast_attribute_e = 40;
2986pub const clingo_ast_attribute_e_clingo_ast_attribute_value: clingo_ast_attribute_e = 41;
2987pub const clingo_ast_attribute_e_clingo_ast_attribute_variable: clingo_ast_attribute_e = 42;
2988pub const clingo_ast_attribute_e_clingo_ast_attribute_weight: clingo_ast_attribute_e = 43;
2989#[doc = "! Enumeration of attributes used by the AST."]
2990pub type clingo_ast_attribute_e = ::std::os::raw::c_uint;
2991#[doc = "! Corresponding type to ::clingo_ast_attribute_e."]
2992pub type clingo_ast_attribute_t = ::std::os::raw::c_int;
2993#[doc = "! Struct to map attributes to their string representation."]
2994#[repr(C)]
2995#[derive(Debug, Copy, Clone)]
2996pub struct clingo_ast_attribute_names {
2997 pub names: *const *const ::std::os::raw::c_char,
2998 pub size: usize,
2999}
3000#[test]
3001fn bindgen_test_layout_clingo_ast_attribute_names() {
3002 const UNINIT: ::std::mem::MaybeUninit<clingo_ast_attribute_names> =
3003 ::std::mem::MaybeUninit::uninit();
3004 let ptr = UNINIT.as_ptr();
3005 assert_eq!(
3006 ::std::mem::size_of::<clingo_ast_attribute_names>(),
3007 16usize,
3008 concat!("Size of: ", stringify!(clingo_ast_attribute_names))
3009 );
3010 assert_eq!(
3011 ::std::mem::align_of::<clingo_ast_attribute_names>(),
3012 8usize,
3013 concat!("Alignment of ", stringify!(clingo_ast_attribute_names))
3014 );
3015 assert_eq!(
3016 unsafe { ::std::ptr::addr_of!((*ptr).names) as usize - ptr as usize },
3017 0usize,
3018 concat!(
3019 "Offset of field: ",
3020 stringify!(clingo_ast_attribute_names),
3021 "::",
3022 stringify!(names)
3023 )
3024 );
3025 assert_eq!(
3026 unsafe { ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
3027 8usize,
3028 concat!(
3029 "Offset of field: ",
3030 stringify!(clingo_ast_attribute_names),
3031 "::",
3032 stringify!(size)
3033 )
3034 );
3035}
3036#[doc = "! Struct to map attributes to their string representation."]
3037pub type clingo_ast_attribute_names_t = clingo_ast_attribute_names;
3038extern "C" {
3039 #[doc = "! A map from attributes to their string representation."]
3040 pub static mut g_clingo_ast_attribute_names: clingo_ast_attribute_names_t;
3041}
3042#[doc = "! Struct to define an argument that consists of a name and a type."]
3043#[repr(C)]
3044#[derive(Debug, Copy, Clone)]
3045pub struct clingo_ast_argument {
3046 pub attribute: clingo_ast_attribute_t,
3047 pub type_: clingo_ast_attribute_type_t,
3048}
3049#[test]
3050fn bindgen_test_layout_clingo_ast_argument() {
3051 const UNINIT: ::std::mem::MaybeUninit<clingo_ast_argument> = ::std::mem::MaybeUninit::uninit();
3052 let ptr = UNINIT.as_ptr();
3053 assert_eq!(
3054 ::std::mem::size_of::<clingo_ast_argument>(),
3055 8usize,
3056 concat!("Size of: ", stringify!(clingo_ast_argument))
3057 );
3058 assert_eq!(
3059 ::std::mem::align_of::<clingo_ast_argument>(),
3060 4usize,
3061 concat!("Alignment of ", stringify!(clingo_ast_argument))
3062 );
3063 assert_eq!(
3064 unsafe { ::std::ptr::addr_of!((*ptr).attribute) as usize - ptr as usize },
3065 0usize,
3066 concat!(
3067 "Offset of field: ",
3068 stringify!(clingo_ast_argument),
3069 "::",
3070 stringify!(attribute)
3071 )
3072 );
3073 assert_eq!(
3074 unsafe { ::std::ptr::addr_of!((*ptr).type_) as usize - ptr as usize },
3075 4usize,
3076 concat!(
3077 "Offset of field: ",
3078 stringify!(clingo_ast_argument),
3079 "::",
3080 stringify!(type_)
3081 )
3082 );
3083}
3084#[doc = "! Struct to define an argument that consists of a name and a type."]
3085pub type clingo_ast_argument_t = clingo_ast_argument;
3086#[doc = "! A lists of required attributes to construct an AST."]
3087#[repr(C)]
3088#[derive(Debug, Copy, Clone)]
3089pub struct clingo_ast_constructor {
3090 pub name: *const ::std::os::raw::c_char,
3091 pub arguments: *const clingo_ast_argument_t,
3092 pub size: usize,
3093}
3094#[test]
3095fn bindgen_test_layout_clingo_ast_constructor() {
3096 const UNINIT: ::std::mem::MaybeUninit<clingo_ast_constructor> =
3097 ::std::mem::MaybeUninit::uninit();
3098 let ptr = UNINIT.as_ptr();
3099 assert_eq!(
3100 ::std::mem::size_of::<clingo_ast_constructor>(),
3101 24usize,
3102 concat!("Size of: ", stringify!(clingo_ast_constructor))
3103 );
3104 assert_eq!(
3105 ::std::mem::align_of::<clingo_ast_constructor>(),
3106 8usize,
3107 concat!("Alignment of ", stringify!(clingo_ast_constructor))
3108 );
3109 assert_eq!(
3110 unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
3111 0usize,
3112 concat!(
3113 "Offset of field: ",
3114 stringify!(clingo_ast_constructor),
3115 "::",
3116 stringify!(name)
3117 )
3118 );
3119 assert_eq!(
3120 unsafe { ::std::ptr::addr_of!((*ptr).arguments) as usize - ptr as usize },
3121 8usize,
3122 concat!(
3123 "Offset of field: ",
3124 stringify!(clingo_ast_constructor),
3125 "::",
3126 stringify!(arguments)
3127 )
3128 );
3129 assert_eq!(
3130 unsafe { ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
3131 16usize,
3132 concat!(
3133 "Offset of field: ",
3134 stringify!(clingo_ast_constructor),
3135 "::",
3136 stringify!(size)
3137 )
3138 );
3139}
3140#[doc = "! A lists of required attributes to construct an AST."]
3141pub type clingo_ast_constructor_t = clingo_ast_constructor;
3142#[doc = "! Struct to map AST types to lists of required attributes to construct ASTs."]
3143#[repr(C)]
3144#[derive(Debug, Copy, Clone)]
3145pub struct clingo_ast_constructors {
3146 pub constructors: *const clingo_ast_constructor_t,
3147 pub size: usize,
3148}
3149#[test]
3150fn bindgen_test_layout_clingo_ast_constructors() {
3151 const UNINIT: ::std::mem::MaybeUninit<clingo_ast_constructors> =
3152 ::std::mem::MaybeUninit::uninit();
3153 let ptr = UNINIT.as_ptr();
3154 assert_eq!(
3155 ::std::mem::size_of::<clingo_ast_constructors>(),
3156 16usize,
3157 concat!("Size of: ", stringify!(clingo_ast_constructors))
3158 );
3159 assert_eq!(
3160 ::std::mem::align_of::<clingo_ast_constructors>(),
3161 8usize,
3162 concat!("Alignment of ", stringify!(clingo_ast_constructors))
3163 );
3164 assert_eq!(
3165 unsafe { ::std::ptr::addr_of!((*ptr).constructors) as usize - ptr as usize },
3166 0usize,
3167 concat!(
3168 "Offset of field: ",
3169 stringify!(clingo_ast_constructors),
3170 "::",
3171 stringify!(constructors)
3172 )
3173 );
3174 assert_eq!(
3175 unsafe { ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
3176 8usize,
3177 concat!(
3178 "Offset of field: ",
3179 stringify!(clingo_ast_constructors),
3180 "::",
3181 stringify!(size)
3182 )
3183 );
3184}
3185#[doc = "! Struct to map AST types to lists of required attributes to construct ASTs."]
3186pub type clingo_ast_constructors_t = clingo_ast_constructors;
3187extern "C" {
3188 #[doc = "! A map from AST types to their constructors.\n!\n! @note The idea of this variable is to provide enough information to auto-generate code for language bindings."]
3189 pub static mut g_clingo_ast_constructors: clingo_ast_constructors_t;
3190}
3191#[repr(C)]
3192#[derive(Debug, Copy, Clone)]
3193pub struct clingo_ast {
3194 _unused: [u8; 0],
3195}
3196#[doc = "! This struct provides a view to nodes in the AST."]
3197pub type clingo_ast_t = clingo_ast;
3198extern "C" {
3199 #[doc = "! Construct an AST of the given type.\n!\n! @note The arguments corresponding to the given type can be inspected using \"g_clingo_ast_constructors.constructors[type]\".\n!\n! @param[in] type the type of AST to construct\n! @param[out] ast the resulting AST\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc\n! - ::clingo_error_runtime if one of the arguments is incompatible with the type"]
3200 pub fn clingo_ast_build(type_: clingo_ast_type_t, ast: *mut *mut clingo_ast_t, ...) -> bool;
3201}
3202extern "C" {
3203 #[doc = "! Increment the reference count of an AST node.\n!\n! @note All functions that return AST nodes already increment the reference count.\n! The reference count of callback arguments is not incremented.\n!\n! @param[in] ast the target AST"]
3204 pub fn clingo_ast_acquire(ast: *mut clingo_ast_t);
3205}
3206extern "C" {
3207 #[doc = "! Decrement the reference count of an AST node.\n!\n! @note The node is deleted if the reference count reaches zero.\n!\n! @param[in] ast the target AST"]
3208 pub fn clingo_ast_release(ast: *mut clingo_ast_t);
3209}
3210extern "C" {
3211 #[doc = "! Create a shallow copy of an AST node.\n!\n! @param[in] ast the AST to copy\n! @param[out] copy the resulting AST\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
3212 pub fn clingo_ast_copy(ast: *mut clingo_ast_t, copy: *mut *mut clingo_ast_t) -> bool;
3213}
3214extern "C" {
3215 #[doc = "! Create a deep copy of an AST node.\n!\n! @param[in] ast the AST to copy\n! @param[out] copy the resulting AST\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
3216 pub fn clingo_ast_deep_copy(ast: *mut clingo_ast_t, copy: *mut *mut clingo_ast_t) -> bool;
3217}
3218extern "C" {
3219 #[doc = "! Less than compare two AST nodes.\n!\n! @param[in] a the left-hand-side AST\n! @param[in] b the right-hand-side AST\n! @return the result of the comparison"]
3220 pub fn clingo_ast_less_than(a: *mut clingo_ast_t, b: *mut clingo_ast_t) -> bool;
3221}
3222extern "C" {
3223 #[doc = "! Equality compare two AST nodes.\n!\n! @param[in] a the left-hand-side AST\n! @param[in] b the right-hand-side AST\n! @return the result of the comparison"]
3224 pub fn clingo_ast_equal(a: *mut clingo_ast_t, b: *mut clingo_ast_t) -> bool;
3225}
3226extern "C" {
3227 #[doc = "! Compute a hash for an AST node.\n!\n! @param[in] ast the target AST\n! @return the resulting hash code"]
3228 pub fn clingo_ast_hash(ast: *mut clingo_ast_t) -> usize;
3229}
3230extern "C" {
3231 #[doc = "! Get the size of the string representation of an AST node.\n!\n! @param[in] ast the target AST\n! @param[out] size the size of the string representation\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3232 pub fn clingo_ast_to_string_size(ast: *mut clingo_ast_t, size: *mut usize) -> bool;
3233}
3234extern "C" {
3235 #[doc = "! Get the string representation of an AST node.\n!\n! @param[in] ast the target AST\n! @param[out] string the string representation\n! @param[out] size the size of the string representation\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3236 pub fn clingo_ast_to_string(
3237 ast: *mut clingo_ast_t,
3238 string: *mut ::std::os::raw::c_char,
3239 size: usize,
3240 ) -> bool;
3241}
3242extern "C" {
3243 #[doc = "! Get the type of an AST node.\n!\n! @param[in] ast the target AST\n! @param[out] type the resulting type\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3244 pub fn clingo_ast_get_type(ast: *mut clingo_ast_t, type_: *mut clingo_ast_type_t) -> bool;
3245}
3246extern "C" {
3247 #[doc = "! Check if an AST has the given attribute.\n!\n! @param[in] ast the target AST\n! @param[in] attribute the attribute to check\n! @param[out] has_attribute the result\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3248 pub fn clingo_ast_has_attribute(
3249 ast: *mut clingo_ast_t,
3250 attribute: clingo_ast_attribute_t,
3251 has_attribute: *mut bool,
3252 ) -> bool;
3253}
3254extern "C" {
3255 #[doc = "! Get the type of the given AST.\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[out] type the resulting type\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3256 pub fn clingo_ast_attribute_type(
3257 ast: *mut clingo_ast_t,
3258 attribute: clingo_ast_attribute_t,
3259 type_: *mut clingo_ast_attribute_type_t,
3260 ) -> bool;
3261}
3262extern "C" {
3263 #[doc = "! Get the value of an attribute of type \"clingo_ast_attribute_type_number\".\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[out] value the resulting value\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3264 pub fn clingo_ast_attribute_get_number(
3265 ast: *mut clingo_ast_t,
3266 attribute: clingo_ast_attribute_t,
3267 value: *mut ::std::os::raw::c_int,
3268 ) -> bool;
3269}
3270extern "C" {
3271 #[doc = "! Set the value of an attribute of type \"clingo_ast_attribute_type_number\".\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[in] value the value\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3272 pub fn clingo_ast_attribute_set_number(
3273 ast: *mut clingo_ast_t,
3274 attribute: clingo_ast_attribute_t,
3275 value: ::std::os::raw::c_int,
3276 ) -> bool;
3277}
3278extern "C" {
3279 #[doc = "! Get the value of an attribute of type \"clingo_ast_attribute_type_symbol\".\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[out] value the resulting value\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3280 pub fn clingo_ast_attribute_get_symbol(
3281 ast: *mut clingo_ast_t,
3282 attribute: clingo_ast_attribute_t,
3283 value: *mut clingo_symbol_t,
3284 ) -> bool;
3285}
3286extern "C" {
3287 #[doc = "! Set the value of an attribute of type \"clingo_ast_attribute_type_symbol\".\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[in] value the value\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3288 pub fn clingo_ast_attribute_set_symbol(
3289 ast: *mut clingo_ast_t,
3290 attribute: clingo_ast_attribute_t,
3291 value: clingo_symbol_t,
3292 ) -> bool;
3293}
3294extern "C" {
3295 #[doc = "! Get the value of an attribute of type \"clingo_ast_attribute_type_location\".\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[out] value the resulting value\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3296 pub fn clingo_ast_attribute_get_location(
3297 ast: *mut clingo_ast_t,
3298 attribute: clingo_ast_attribute_t,
3299 value: *mut clingo_location_t,
3300 ) -> bool;
3301}
3302extern "C" {
3303 #[doc = "! Set the value of an attribute of type \"clingo_ast_attribute_type_location\".\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[in] value the value\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3304 pub fn clingo_ast_attribute_set_location(
3305 ast: *mut clingo_ast_t,
3306 attribute: clingo_ast_attribute_t,
3307 value: *const clingo_location_t,
3308 ) -> bool;
3309}
3310extern "C" {
3311 #[doc = "! Get the value of an attribute of type \"clingo_ast_attribute_type_string\".\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[out] value the resulting value\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3312 pub fn clingo_ast_attribute_get_string(
3313 ast: *mut clingo_ast_t,
3314 attribute: clingo_ast_attribute_t,
3315 value: *mut *const ::std::os::raw::c_char,
3316 ) -> bool;
3317}
3318extern "C" {
3319 #[doc = "! Set the value of an attribute of type \"clingo_ast_attribute_type_string\".\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[in] value the value\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3320 pub fn clingo_ast_attribute_set_string(
3321 ast: *mut clingo_ast_t,
3322 attribute: clingo_ast_attribute_t,
3323 value: *const ::std::os::raw::c_char,
3324 ) -> bool;
3325}
3326extern "C" {
3327 #[doc = "! Get the value of an attribute of type \"clingo_ast_attribute_type_ast\".\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[out] value the resulting value\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3328 pub fn clingo_ast_attribute_get_ast(
3329 ast: *mut clingo_ast_t,
3330 attribute: clingo_ast_attribute_t,
3331 value: *mut *mut clingo_ast_t,
3332 ) -> bool;
3333}
3334extern "C" {
3335 #[doc = "! Set the value of an attribute of type \"clingo_ast_attribute_type_ast\".\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[in] value the value\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3336 pub fn clingo_ast_attribute_set_ast(
3337 ast: *mut clingo_ast_t,
3338 attribute: clingo_ast_attribute_t,
3339 value: *mut clingo_ast_t,
3340 ) -> bool;
3341}
3342extern "C" {
3343 #[doc = "! Get the value of an attribute of type \"clingo_ast_attribute_type_optional_ast\".\n!\n! @note The value might be \"NULL\".\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[out] value the resulting value\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3344 pub fn clingo_ast_attribute_get_optional_ast(
3345 ast: *mut clingo_ast_t,
3346 attribute: clingo_ast_attribute_t,
3347 value: *mut *mut clingo_ast_t,
3348 ) -> bool;
3349}
3350extern "C" {
3351 #[doc = "! Set the value of an attribute of type \"clingo_ast_attribute_type_optional_ast\".\n!\n! @note The value might be \"NULL\".\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[in] value the value\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3352 pub fn clingo_ast_attribute_set_optional_ast(
3353 ast: *mut clingo_ast_t,
3354 attribute: clingo_ast_attribute_t,
3355 value: *mut clingo_ast_t,
3356 ) -> bool;
3357}
3358extern "C" {
3359 #[doc = "! Get the value of an attribute of type \"clingo_ast_attribute_type_string_array\" at the given index.\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[in] index the target index\n! @param[out] value the resulting value\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3360 pub fn clingo_ast_attribute_get_string_at(
3361 ast: *mut clingo_ast_t,
3362 attribute: clingo_ast_attribute_t,
3363 index: usize,
3364 value: *mut *const ::std::os::raw::c_char,
3365 ) -> bool;
3366}
3367extern "C" {
3368 #[doc = "! Set the value of an attribute of type \"clingo_ast_attribute_type_string_array\" at the given index.\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[in] index the target index\n! @param[in] value the value\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime\n! - ::clingo_error_bad_alloc"]
3369 pub fn clingo_ast_attribute_set_string_at(
3370 ast: *mut clingo_ast_t,
3371 attribute: clingo_ast_attribute_t,
3372 index: usize,
3373 value: *const ::std::os::raw::c_char,
3374 ) -> bool;
3375}
3376extern "C" {
3377 #[doc = "! Remove an element from an attribute of type \"clingo_ast_attribute_type_string_array\" at the given index.\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[in] index the target index\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3378 pub fn clingo_ast_attribute_delete_string_at(
3379 ast: *mut clingo_ast_t,
3380 attribute: clingo_ast_attribute_t,
3381 index: usize,
3382 ) -> bool;
3383}
3384extern "C" {
3385 #[doc = "! Get the size of an attribute of type \"clingo_ast_attribute_type_string_array\".\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[out] size the resulting size\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3386 pub fn clingo_ast_attribute_size_string_array(
3387 ast: *mut clingo_ast_t,
3388 attribute: clingo_ast_attribute_t,
3389 size: *mut usize,
3390 ) -> bool;
3391}
3392extern "C" {
3393 #[doc = "! Insert a value into an attribute of type \"clingo_ast_attribute_type_string_array\" at the given index.\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[in] index the target index\n! @param[in] value the value\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime\n! - ::clingo_error_bad_alloc"]
3394 pub fn clingo_ast_attribute_insert_string_at(
3395 ast: *mut clingo_ast_t,
3396 attribute: clingo_ast_attribute_t,
3397 index: usize,
3398 value: *const ::std::os::raw::c_char,
3399 ) -> bool;
3400}
3401extern "C" {
3402 #[doc = "! Get the value of an attribute of type \"clingo_ast_attribute_type_ast_array\" at the given index.\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[in] index the target index\n! @param[out] value the resulting value\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3403 pub fn clingo_ast_attribute_get_ast_at(
3404 ast: *mut clingo_ast_t,
3405 attribute: clingo_ast_attribute_t,
3406 index: usize,
3407 value: *mut *mut clingo_ast_t,
3408 ) -> bool;
3409}
3410extern "C" {
3411 #[doc = "! Set the value of an attribute of type \"clingo_ast_attribute_type_ast_array\" at the given index.\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[in] index the target index\n! @param[in] value the value\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime\n! - ::clingo_error_bad_alloc"]
3412 pub fn clingo_ast_attribute_set_ast_at(
3413 ast: *mut clingo_ast_t,
3414 attribute: clingo_ast_attribute_t,
3415 index: usize,
3416 value: *mut clingo_ast_t,
3417 ) -> bool;
3418}
3419extern "C" {
3420 #[doc = "! Remove an element from an attribute of type \"clingo_ast_attribute_type_ast_array\" at the given index.\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[in] index the target index\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3421 pub fn clingo_ast_attribute_delete_ast_at(
3422 ast: *mut clingo_ast_t,
3423 attribute: clingo_ast_attribute_t,
3424 index: usize,
3425 ) -> bool;
3426}
3427extern "C" {
3428 #[doc = "! Get the size of an attribute of type \"clingo_ast_attribute_type_ast_array\".\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[out] size the resulting size\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime"]
3429 pub fn clingo_ast_attribute_size_ast_array(
3430 ast: *mut clingo_ast_t,
3431 attribute: clingo_ast_attribute_t,
3432 size: *mut usize,
3433 ) -> bool;
3434}
3435extern "C" {
3436 #[doc = "! Insert a value into an attribute of type \"clingo_ast_attribute_type_ast_array\" at the given index.\n!\n! @param[in] ast the target AST\n! @param[in] attribute the target attribute\n! @param[in] index the target index\n! @param[in] value the value\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime\n! - ::clingo_error_bad_alloc"]
3437 pub fn clingo_ast_attribute_insert_ast_at(
3438 ast: *mut clingo_ast_t,
3439 attribute: clingo_ast_attribute_t,
3440 index: usize,
3441 value: *mut clingo_ast_t,
3442 ) -> bool;
3443}
3444#[doc = "! Callback function to intercept AST nodes.\n!\n! @param[in] ast the AST\n! @param[in] data a user data pointer\n! @return whether the call was successful"]
3445pub type clingo_ast_callback_t = ::std::option::Option<
3446 unsafe extern "C" fn(ast: *mut clingo_ast_t, data: *mut ::std::os::raw::c_void) -> bool,
3447>;
3448extern "C" {
3449 #[doc = "! Parse the given program and return an abstract syntax tree for each statement via a callback.\n!\n! @note The control object can be set to a NULL to disable reading input in aspif format.\n!\n! @param[in] program the program in gringo syntax\n! @param[in] callback the callback reporting statements\n! @param[in] callback_data user data for the callback\n! @param[in] control object to add ground statements to\n! @param[in] logger callback to report messages during parsing\n! @param[in] logger_data user data for the logger\n! @param[in] message_limit the maximum number of times the logger is called\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime if parsing fails\n! - ::clingo_error_bad_alloc"]
3450 pub fn clingo_ast_parse_string(
3451 program: *const ::std::os::raw::c_char,
3452 callback: clingo_ast_callback_t,
3453 callback_data: *mut ::std::os::raw::c_void,
3454 control: *mut clingo_control_t,
3455 logger: clingo_logger_t,
3456 logger_data: *mut ::std::os::raw::c_void,
3457 message_limit: ::std::os::raw::c_uint,
3458 ) -> bool;
3459}
3460extern "C" {
3461 #[doc = "! Parse the programs in the given list of files and return an abstract syntax tree for each statement via a callback.\n!\n! The function follows clingo's handling of files on the command line.\n! Filename \"-\" is treated as \"STDIN\" and if an empty list is given, then the parser will read from \"STDIN\".\n!\n! @note The control object can be set to a NULL to disable reading input in aspif format.\n!\n! @param[in] files the beginning of the file name array\n! @param[in] size the number of file names\n! @param[in] callback the callback reporting statements\n! @param[in] callback_data user data for the callback\n! @param[in] control object to add ground statements to\n! @param[in] logger callback to report messages during parsing\n! @param[in] logger_data user data for the logger\n! @param[in] message_limit the maximum number of times the logger is called\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime if parsing fails\n! - ::clingo_error_bad_alloc"]
3462 pub fn clingo_ast_parse_files(
3463 files: *const *const ::std::os::raw::c_char,
3464 size: usize,
3465 callback: clingo_ast_callback_t,
3466 callback_data: *mut ::std::os::raw::c_void,
3467 control: *mut clingo_control_t,
3468 logger: clingo_logger_t,
3469 logger_data: *mut ::std::os::raw::c_void,
3470 message_limit: ::std::os::raw::c_uint,
3471 ) -> bool;
3472}
3473#[repr(C)]
3474#[derive(Debug)]
3475pub struct clingo_program_builder {
3476 _unused: [u8; 0],
3477}
3478#[doc = "! Object to build non-ground programs."]
3479pub type clingo_program_builder_t = clingo_program_builder;
3480extern "C" {
3481 #[doc = "! Get an object to add non-ground directives to the program.\n!\n! See the @ref ProgramBuilder module for more information.\n!\n! @param[in] control the target\n! @param[out] builder the program builder object\n! @return whether the call was successful"]
3482 pub fn clingo_program_builder_init(
3483 control: *mut clingo_control_t,
3484 builder: *mut *mut clingo_program_builder_t,
3485 ) -> bool;
3486}
3487extern "C" {
3488 #[doc = "! Begin building a program.\n!\n! @param[in] builder the target program builder\n! @return whether the call was successful"]
3489 pub fn clingo_program_builder_begin(builder: *mut clingo_program_builder_t) -> bool;
3490}
3491extern "C" {
3492 #[doc = "! End building a program.\n!\n! @param[in] builder the target program builder\n! @return whether the call was successful"]
3493 pub fn clingo_program_builder_end(builder: *mut clingo_program_builder_t) -> bool;
3494}
3495extern "C" {
3496 #[doc = "! Adds a statement to the program.\n!\n! @attention @ref clingo_program_builder_begin() must be called before adding statements and @ref clingo_program_builder_end() must be called after all statements have been added.\n! @param[in] builder the target program builder\n! @param[in] ast the AST node to add\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_runtime for statements of invalid form or AST nodes that do not represent statements\n! - ::clingo_error_bad_alloc"]
3497 pub fn clingo_program_builder_add(
3498 builder: *mut clingo_program_builder_t,
3499 ast: *mut clingo_ast_t,
3500 ) -> bool;
3501}
3502#[doc = "!< To only unpool conditions of conditional literals."]
3503pub const clingo_ast_unpool_type_e_clingo_ast_unpool_type_condition: clingo_ast_unpool_type_e = 1;
3504#[doc = "!< To unpool everything except conditions of conditional literals."]
3505pub const clingo_ast_unpool_type_e_clingo_ast_unpool_type_other: clingo_ast_unpool_type_e = 2;
3506#[doc = "!< To unpool everything."]
3507pub const clingo_ast_unpool_type_e_clingo_ast_unpool_type_all: clingo_ast_unpool_type_e = 3;
3508#[doc = "! Enum to configure unpooling."]
3509pub type clingo_ast_unpool_type_e = ::std::os::raw::c_uint;
3510#[doc = "! Corresponding type to ::clingo_ast_unpool_type_e."]
3511pub type clingo_ast_unpool_type_bitset_t = ::std::os::raw::c_int;
3512extern "C" {
3513 #[doc = "! Unpool the given AST.\n!\n! @param[in] ast the target AST\n! @param[in] unpool_type what to unpool\n! @param[in] callback the callback to report ASTs\n! @param[in] callback_data user data for the callback\n! @return whether the call was successful; might set one of the following error codes:\n! - ::clingo_error_bad_alloc"]
3514 pub fn clingo_ast_unpool(
3515 ast: *mut clingo_ast_t,
3516 unpool_type: clingo_ast_unpool_type_bitset_t,
3517 callback: clingo_ast_callback_t,
3518 callback_data: *mut ::std::os::raw::c_void,
3519 ) -> bool;
3520}
3521#[repr(C)]
3522#[derive(Debug)]
3523pub struct clingo_options {
3524 _unused: [u8; 0],
3525}
3526#[doc = "! Object to add command-line options."]
3527pub type clingo_options_t = clingo_options;
3528#[doc = "! Callback to customize clingo main function.\n!\n! @param[in] control corresponding control object\n! @param[in] files files passed via command line arguments\n! @param[in] size number of files\n! @param[in] data user data for the callback\n!\n! @return whether the call was successful"]
3529pub type clingo_main_function_t = ::std::option::Option<
3530 unsafe extern "C" fn(
3531 control: *mut clingo_control_t,
3532 files: *const *const ::std::os::raw::c_char,
3533 size: usize,
3534 data: *mut ::std::os::raw::c_void,
3535 ) -> bool,
3536>;
3537#[doc = "! Callback to print a model in default format.\n!\n! @param[in] data user data for the callback\n!\n! @return whether the call was successful"]
3538pub type clingo_default_model_printer_t =
3539 ::std::option::Option<unsafe extern "C" fn(data: *mut ::std::os::raw::c_void) -> bool>;
3540#[doc = "! Callback to customize model printing.\n!\n! @param[in] model the model\n! @param[in] printer the default model printer\n! @param[in] printer_data user data for the printer\n! @param[in] data user data for the callback\n!\n! @return whether the call was successful"]
3541pub type clingo_model_printer_t = ::std::option::Option<
3542 unsafe extern "C" fn(
3543 model: *const clingo_model_t,
3544 printer: clingo_default_model_printer_t,
3545 printer_data: *mut ::std::os::raw::c_void,
3546 data: *mut ::std::os::raw::c_void,
3547 ) -> bool,
3548>;
3549#[doc = "! This struct contains a set of functions to customize the clingo application."]
3550#[repr(C)]
3551#[derive(Debug, Copy, Clone)]
3552pub struct clingo_application {
3553 #[doc = "!< callback to obtain program name"]
3554 pub program_name: ::std::option::Option<
3555 unsafe extern "C" fn(data: *mut ::std::os::raw::c_void) -> *const ::std::os::raw::c_char,
3556 >,
3557 #[doc = "!< callback to obtain version information"]
3558 pub version: ::std::option::Option<
3559 unsafe extern "C" fn(data: *mut ::std::os::raw::c_void) -> *const ::std::os::raw::c_char,
3560 >,
3561 #[doc = "!< callback to obtain message limit"]
3562 pub message_limit: ::std::option::Option<
3563 unsafe extern "C" fn(data: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_uint,
3564 >,
3565 #[doc = "!< callback to override clingo's main function"]
3566 pub main: clingo_main_function_t,
3567 #[doc = "!< callback to override default logger"]
3568 pub logger: clingo_logger_t,
3569 #[doc = "!< callback to override default model printing"]
3570 pub printer: clingo_model_printer_t,
3571 #[doc = "!< callback to register options"]
3572 pub register_options: ::std::option::Option<
3573 unsafe extern "C" fn(
3574 options: *mut clingo_options_t,
3575 data: *mut ::std::os::raw::c_void,
3576 ) -> bool,
3577 >,
3578 #[doc = "!< callback validate options"]
3579 pub validate_options:
3580 ::std::option::Option<unsafe extern "C" fn(data: *mut ::std::os::raw::c_void) -> bool>,
3581}
3582#[test]
3583fn bindgen_test_layout_clingo_application() {
3584 const UNINIT: ::std::mem::MaybeUninit<clingo_application> = ::std::mem::MaybeUninit::uninit();
3585 let ptr = UNINIT.as_ptr();
3586 assert_eq!(
3587 ::std::mem::size_of::<clingo_application>(),
3588 64usize,
3589 concat!("Size of: ", stringify!(clingo_application))
3590 );
3591 assert_eq!(
3592 ::std::mem::align_of::<clingo_application>(),
3593 8usize,
3594 concat!("Alignment of ", stringify!(clingo_application))
3595 );
3596 assert_eq!(
3597 unsafe { ::std::ptr::addr_of!((*ptr).program_name) as usize - ptr as usize },
3598 0usize,
3599 concat!(
3600 "Offset of field: ",
3601 stringify!(clingo_application),
3602 "::",
3603 stringify!(program_name)
3604 )
3605 );
3606 assert_eq!(
3607 unsafe { ::std::ptr::addr_of!((*ptr).version) as usize - ptr as usize },
3608 8usize,
3609 concat!(
3610 "Offset of field: ",
3611 stringify!(clingo_application),
3612 "::",
3613 stringify!(version)
3614 )
3615 );
3616 assert_eq!(
3617 unsafe { ::std::ptr::addr_of!((*ptr).message_limit) as usize - ptr as usize },
3618 16usize,
3619 concat!(
3620 "Offset of field: ",
3621 stringify!(clingo_application),
3622 "::",
3623 stringify!(message_limit)
3624 )
3625 );
3626 assert_eq!(
3627 unsafe { ::std::ptr::addr_of!((*ptr).main) as usize - ptr as usize },
3628 24usize,
3629 concat!(
3630 "Offset of field: ",
3631 stringify!(clingo_application),
3632 "::",
3633 stringify!(main)
3634 )
3635 );
3636 assert_eq!(
3637 unsafe { ::std::ptr::addr_of!((*ptr).logger) as usize - ptr as usize },
3638 32usize,
3639 concat!(
3640 "Offset of field: ",
3641 stringify!(clingo_application),
3642 "::",
3643 stringify!(logger)
3644 )
3645 );
3646 assert_eq!(
3647 unsafe { ::std::ptr::addr_of!((*ptr).printer) as usize - ptr as usize },
3648 40usize,
3649 concat!(
3650 "Offset of field: ",
3651 stringify!(clingo_application),
3652 "::",
3653 stringify!(printer)
3654 )
3655 );
3656 assert_eq!(
3657 unsafe { ::std::ptr::addr_of!((*ptr).register_options) as usize - ptr as usize },
3658 48usize,
3659 concat!(
3660 "Offset of field: ",
3661 stringify!(clingo_application),
3662 "::",
3663 stringify!(register_options)
3664 )
3665 );
3666 assert_eq!(
3667 unsafe { ::std::ptr::addr_of!((*ptr).validate_options) as usize - ptr as usize },
3668 56usize,
3669 concat!(
3670 "Offset of field: ",
3671 stringify!(clingo_application),
3672 "::",
3673 stringify!(validate_options)
3674 )
3675 );
3676}
3677#[doc = "! This struct contains a set of functions to customize the clingo application."]
3678pub type clingo_application_t = clingo_application;
3679extern "C" {
3680 #[doc = "! Add an option that is processed with a custom parser.\n!\n! Note that the parser also has to take care of storing the semantic value of\n! the option somewhere.\n!\n! Parameter option specifies the name(s) of the option.\n! For example, \"ping,p\" adds the short option \"-p\" and its long form \"--ping\".\n! It is also possible to associate an option with a help level by adding \",@l\" to the option specification.\n! Options with a level greater than zero are only shown if the argument to help is greater or equal to l.\n!\n! @param[in] options object to register the option with\n! @param[in] group options are grouped into sections as given by this string\n! @param[in] option specifies the command line option\n! @param[in] description the description of the option\n! @param[in] parse callback to parse the value of the option\n! @param[in] data user data for the callback\n! @param[in] multi whether the option can appear multiple times on the command-line\n! @param[in] argument optional string to change the value name in the generated help output\n! @return whether the call was successful"]
3681 pub fn clingo_options_add(
3682 options: *mut clingo_options_t,
3683 group: *const ::std::os::raw::c_char,
3684 option: *const ::std::os::raw::c_char,
3685 description: *const ::std::os::raw::c_char,
3686 parse: ::std::option::Option<
3687 unsafe extern "C" fn(
3688 value: *const ::std::os::raw::c_char,
3689 data: *mut ::std::os::raw::c_void,
3690 ) -> bool,
3691 >,
3692 data: *mut ::std::os::raw::c_void,
3693 multi: bool,
3694 argument: *const ::std::os::raw::c_char,
3695 ) -> bool;
3696}
3697extern "C" {
3698 #[doc = "! Add an option that is a simple flag.\n!\n! This function is similar to @ref clingo_options_add() but simpler because it only supports flags, which do not have values.\n! If a flag is passed via the command-line the parameter target is set to true.\n!\n! @param[in] options object to register the option with\n! @param[in] group options are grouped into sections as given by this string\n! @param[in] option specifies the command line option\n! @param[in] description the description of the option\n! @param[in] target boolean set to true if the flag is given on the command-line\n! @return whether the call was successful"]
3699 pub fn clingo_options_add_flag(
3700 options: *mut clingo_options_t,
3701 group: *const ::std::os::raw::c_char,
3702 option: *const ::std::os::raw::c_char,
3703 description: *const ::std::os::raw::c_char,
3704 target: *mut bool,
3705 ) -> bool;
3706}
3707extern "C" {
3708 #[doc = "! Run clingo with a customized main function (similar to python and lua embedding).\n!\n! @param[in] application struct with callbacks to override default clingo functionality\n! @param[in] arguments command line arguments\n! @param[in] size number of arguments\n! @param[in] data user data to pass to callbacks in application\n! @return exit code to return from main function"]
3709 pub fn clingo_main(
3710 application: *mut clingo_application_t,
3711 arguments: *const *const ::std::os::raw::c_char,
3712 size: usize,
3713 data: *mut ::std::os::raw::c_void,
3714 ) -> ::std::os::raw::c_int;
3715}
3716#[doc = "! Custom scripting language to run functions during grounding."]
3717#[repr(C)]
3718#[derive(Debug, Copy, Clone)]
3719pub struct clingo_script {
3720 #[doc = "! Evaluate the given source code.\n! @param[in] location the location in the logic program of the source code\n! @param[in] code the code to evaluate\n! @param[in] data user data as given when registering the script\n! @return whether the function call was successful"]
3721 pub execute: ::std::option::Option<
3722 unsafe extern "C" fn(
3723 location: *const clingo_location_t,
3724 code: *const ::std::os::raw::c_char,
3725 data: *mut ::std::os::raw::c_void,
3726 ) -> bool,
3727 >,
3728 #[doc = "! Call the function with the given name and arguments.\n! @param[in] location the location in the logic program of the function call\n! @param[in] name the name of the function\n! @param[in] arguments the arguments to the function\n! @param[in] arguments_size the number of arguments\n! @param[in] symbol_callback callback to return a pool of symbols\n! @param[in] symbol_callback_data user data for the symbol callback\n! @param[in] data user data as given when registering the script\n! @return whether the function call was successful"]
3729 pub call: ::std::option::Option<
3730 unsafe extern "C" fn(
3731 location: *const clingo_location_t,
3732 name: *const ::std::os::raw::c_char,
3733 arguments: *const clingo_symbol_t,
3734 arguments_size: usize,
3735 symbol_callback: clingo_symbol_callback_t,
3736 symbol_callback_data: *mut ::std::os::raw::c_void,
3737 data: *mut ::std::os::raw::c_void,
3738 ) -> bool,
3739 >,
3740 #[doc = "! Check if the given function is callable.\n! @param[in] name the name of the function\n! @param[out] result whether the function is callable\n! @param[in] data user data as given when registering the script\n! @return whether the function call was successful"]
3741 pub callable: ::std::option::Option<
3742 unsafe extern "C" fn(
3743 name: *const ::std::os::raw::c_char,
3744 result: *mut bool,
3745 data: *mut ::std::os::raw::c_void,
3746 ) -> bool,
3747 >,
3748 #[doc = "! Run the main function.\n! @param[in] control the control object to pass to the main function\n! @param[in] data user data as given when registering the script\n! @return whether the function call was successful"]
3749 pub main: ::std::option::Option<
3750 unsafe extern "C" fn(
3751 control: *mut clingo_control_t,
3752 data: *mut ::std::os::raw::c_void,
3753 ) -> bool,
3754 >,
3755 #[doc = "! This function is called once when the script is deleted.\n! @param[in] data user data as given when registering the script"]
3756 pub free: ::std::option::Option<unsafe extern "C" fn(data: *mut ::std::os::raw::c_void)>,
3757 pub version: *const ::std::os::raw::c_char,
3758}
3759#[test]
3760fn bindgen_test_layout_clingo_script() {
3761 const UNINIT: ::std::mem::MaybeUninit<clingo_script> = ::std::mem::MaybeUninit::uninit();
3762 let ptr = UNINIT.as_ptr();
3763 assert_eq!(
3764 ::std::mem::size_of::<clingo_script>(),
3765 48usize,
3766 concat!("Size of: ", stringify!(clingo_script))
3767 );
3768 assert_eq!(
3769 ::std::mem::align_of::<clingo_script>(),
3770 8usize,
3771 concat!("Alignment of ", stringify!(clingo_script))
3772 );
3773 assert_eq!(
3774 unsafe { ::std::ptr::addr_of!((*ptr).execute) as usize - ptr as usize },
3775 0usize,
3776 concat!(
3777 "Offset of field: ",
3778 stringify!(clingo_script),
3779 "::",
3780 stringify!(execute)
3781 )
3782 );
3783 assert_eq!(
3784 unsafe { ::std::ptr::addr_of!((*ptr).call) as usize - ptr as usize },
3785 8usize,
3786 concat!(
3787 "Offset of field: ",
3788 stringify!(clingo_script),
3789 "::",
3790 stringify!(call)
3791 )
3792 );
3793 assert_eq!(
3794 unsafe { ::std::ptr::addr_of!((*ptr).callable) as usize - ptr as usize },
3795 16usize,
3796 concat!(
3797 "Offset of field: ",
3798 stringify!(clingo_script),
3799 "::",
3800 stringify!(callable)
3801 )
3802 );
3803 assert_eq!(
3804 unsafe { ::std::ptr::addr_of!((*ptr).main) as usize - ptr as usize },
3805 24usize,
3806 concat!(
3807 "Offset of field: ",
3808 stringify!(clingo_script),
3809 "::",
3810 stringify!(main)
3811 )
3812 );
3813 assert_eq!(
3814 unsafe { ::std::ptr::addr_of!((*ptr).free) as usize - ptr as usize },
3815 32usize,
3816 concat!(
3817 "Offset of field: ",
3818 stringify!(clingo_script),
3819 "::",
3820 stringify!(free)
3821 )
3822 );
3823 assert_eq!(
3824 unsafe { ::std::ptr::addr_of!((*ptr).version) as usize - ptr as usize },
3825 40usize,
3826 concat!(
3827 "Offset of field: ",
3828 stringify!(clingo_script),
3829 "::",
3830 stringify!(version)
3831 )
3832 );
3833}
3834#[doc = "! Custom scripting language to run functions during grounding."]
3835pub type clingo_script_t = clingo_script;
3836extern "C" {
3837 #[doc = "! Add a custom scripting language to clingo.\n!\n! @param[in] name the name of the scripting language\n! @param[in] script struct with functions implementing the language\n! @param[in] data user data to pass to callbacks in the script\n! @return whether the call was successful"]
3838 pub fn clingo_register_script(
3839 name: *const ::std::os::raw::c_char,
3840 script: *const clingo_script_t,
3841 data: *mut ::std::os::raw::c_void,
3842 ) -> bool;
3843}
3844extern "C" {
3845 #[doc = "! Get the version of the registered scripting language.\n!\n! @param[in] name the name of the scripting language\n! @return the version"]
3846 pub fn clingo_script_version(
3847 name: *const ::std::os::raw::c_char,
3848 ) -> *const ::std::os::raw::c_char;
3849}