1#![allow(non_camel_case_types)]
4
5pub type __int64_t = ::std::os::raw::c_long;
6pub type __uint64_t = ::std::os::raw::c_ulong;
7pub type __size_t = __uint64_t;
8pub type __off_t = __int64_t;
9pub type fpos_t = __off_t;
10#[repr(u32)]
11#[doc = " The common error codes returned by ucl parser"]
12#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
13pub enum ucl_error {
14 #[doc = "< No error"]
15 UCL_EOK = 0,
16 #[doc = "< Syntax error occurred during parsing"]
17 UCL_ESYNTAX = 1,
18 #[doc = "< IO error occurred during parsing"]
19 UCL_EIO = 2,
20 #[doc = "< Invalid state machine state"]
21 UCL_ESTATE = 3,
22 #[doc = "< Input has too many recursion levels"]
23 UCL_ENESTED = 4,
24 #[doc = "< Error processing a macro"]
25 UCL_EMACRO = 5,
26 #[doc = "< Internal unclassified error"]
27 UCL_EINTERNAL = 6,
28 #[doc = "< SSL error"]
29 UCL_ESSL = 7,
30 #[doc = "< A merge error occurred"]
31 UCL_EMERGE = 8,
32}
33pub use self::ucl_error as ucl_error_t;
34#[repr(u32)]
35#[doc = " #ucl_object_t may have one of specified types, some types are compatible with each other and some are not."]
36#[doc = " For example, you can always convert #UCL_TIME to #UCL_FLOAT. Also you can convert #UCL_FLOAT to #UCL_INTEGER"]
37#[doc = " by loosing floating point. Every object may be converted to a string by #ucl_object_tostring_forced() function."]
38#[doc = ""]
39#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
40pub enum ucl_type {
41 #[doc = "< UCL object - key/value pairs"]
42 UCL_OBJECT = 0,
43 #[doc = "< UCL array"]
44 UCL_ARRAY = 1,
45 #[doc = "< Integer number"]
46 UCL_INT = 2,
47 #[doc = "< Floating point number"]
48 UCL_FLOAT = 3,
49 #[doc = "< Null terminated string"]
50 UCL_STRING = 4,
51 #[doc = "< Boolean value"]
52 UCL_BOOLEAN = 5,
53 #[doc = "< Time value (floating point number of seconds)"]
54 UCL_TIME = 6,
55 #[doc = "< Opaque userdata pointer (may be used in macros)"]
56 UCL_USERDATA = 7,
57 #[doc = "< Null value"]
58 UCL_NULL = 8,
59}
60pub use self::ucl_type as ucl_type_t;
61#[repr(u32)]
62#[doc = " You can use one of these types to serialise #ucl_object_t by using ucl_object_emit()."]
63#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
64pub enum ucl_emitter {
65 #[doc = "< Emit fine formatted JSON"]
66 UCL_EMIT_JSON = 0,
67 #[doc = "< Emit compacted JSON"]
68 UCL_EMIT_JSON_COMPACT = 1,
69 #[doc = "< Emit human readable config format"]
70 UCL_EMIT_CONFIG = 2,
71 #[doc = "< Emit embedded YAML format"]
72 UCL_EMIT_YAML = 3,
73 #[doc = "< Emit msgpack output"]
74 UCL_EMIT_MSGPACK = 4,
75 #[doc = "< Unsupported emitter type"]
76 UCL_EMIT_MAX = 5,
77}
78pub use self::ucl_emitter as ucl_emitter_t;
79impl ucl_parser_flags {
80 #[doc = "< No special flags"]
81 pub const UCL_PARSER_DEFAULT: ucl_parser_flags = ucl_parser_flags(0);
82}
83impl ucl_parser_flags {
84 #[doc = "< Convert all keys to lower case"]
85 pub const UCL_PARSER_KEY_LOWERCASE: ucl_parser_flags = ucl_parser_flags(1);
86}
87impl ucl_parser_flags {
88 #[doc = "< Parse input in zero-copy mode if possible"]
89 pub const UCL_PARSER_ZEROCOPY: ucl_parser_flags = ucl_parser_flags(2);
90}
91impl ucl_parser_flags {
92 #[doc = "< Do not parse time and treat time values as strings"]
93 pub const UCL_PARSER_NO_TIME: ucl_parser_flags = ucl_parser_flags(4);
94}
95impl ucl_parser_flags {
96 pub const UCL_PARSER_NO_IMPLICIT_ARRAYS: ucl_parser_flags = ucl_parser_flags(8);
97}
98impl ucl_parser_flags {
99 #[doc = " Create explicit arrays instead of implicit ones"]
100 pub const UCL_PARSER_SAVE_COMMENTS: ucl_parser_flags = ucl_parser_flags(16);
101}
102impl ucl_parser_flags {
103 #[doc = " Save comments in the parser context"]
104 pub const UCL_PARSER_DISABLE_MACRO: ucl_parser_flags = ucl_parser_flags(32);
105}
106impl ucl_parser_flags {
107 #[doc = " Treat macros as comments"]
108 pub const UCL_PARSER_NO_FILEVARS: ucl_parser_flags = ucl_parser_flags(64);
109}
110impl ::std::ops::BitOr<ucl_parser_flags> for ucl_parser_flags {
111 type Output = Self;
112 #[inline]
113 fn bitor(self, other: Self) -> Self {
114 ucl_parser_flags(self.0 | other.0)
115 }
116}
117impl ::std::ops::BitOrAssign for ucl_parser_flags {
118 #[inline]
119 fn bitor_assign(&mut self, rhs: ucl_parser_flags) {
120 self.0 |= rhs.0;
121 }
122}
123impl ::std::ops::BitAnd<ucl_parser_flags> for ucl_parser_flags {
124 type Output = Self;
125 #[inline]
126 fn bitand(self, other: Self) -> Self {
127 ucl_parser_flags(self.0 & other.0)
128 }
129}
130impl ::std::ops::BitAndAssign for ucl_parser_flags {
131 #[inline]
132 fn bitand_assign(&mut self, rhs: ucl_parser_flags) {
133 self.0 &= rhs.0;
134 }
135}
136#[repr(transparent)]
137#[doc = " These flags defines parser behaviour. If you specify #UCL_PARSER_ZEROCOPY you must ensure"]
138#[doc = " that the input memory is not freed if an object is in use. Moreover, if you want to use"]
139#[doc = " zero-terminated keys and string values then you should not use zero-copy mode, as in this case"]
140#[doc = " UCL still has to perform copying implicitly."]
141#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
142pub struct ucl_parser_flags(pub u32);
143pub use self::ucl_parser_flags as ucl_parser_flags_t;
144impl ucl_string_flags {
145 #[doc = "< Treat string as is"]
146 pub const UCL_STRING_RAW: ucl_string_flags = ucl_string_flags(0);
147}
148impl ucl_string_flags {
149 #[doc = "< Perform JSON escape"]
150 pub const UCL_STRING_ESCAPE: ucl_string_flags = ucl_string_flags(1);
151}
152impl ucl_string_flags {
153 #[doc = "< Trim leading and trailing whitespaces"]
154 pub const UCL_STRING_TRIM: ucl_string_flags = ucl_string_flags(2);
155}
156impl ucl_string_flags {
157 #[doc = "< Parse passed string and detect boolean"]
158 pub const UCL_STRING_PARSE_BOOLEAN: ucl_string_flags = ucl_string_flags(4);
159}
160impl ucl_string_flags {
161 #[doc = "< Parse passed string and detect integer number"]
162 pub const UCL_STRING_PARSE_INT: ucl_string_flags = ucl_string_flags(8);
163}
164impl ucl_string_flags {
165 #[doc = "< Parse passed string and detect integer or float number"]
166 pub const UCL_STRING_PARSE_DOUBLE: ucl_string_flags = ucl_string_flags(16);
167}
168impl ucl_string_flags {
169 #[doc = "< Parse time strings"]
170 pub const UCL_STRING_PARSE_TIME: ucl_string_flags = ucl_string_flags(32);
171}
172impl ucl_string_flags {
173 #[doc = "<"]
174 #[doc = "Parse passed string and detect number"]
175 pub const UCL_STRING_PARSE_NUMBER: ucl_string_flags = ucl_string_flags(56);
176}
177impl ucl_string_flags {
178 #[doc = "<"]
179 #[doc = "Parse passed string (and detect booleans and numbers)"]
180 pub const UCL_STRING_PARSE: ucl_string_flags = ucl_string_flags(60);
181}
182impl ucl_string_flags {
183 #[doc = "< Treat numbers as bytes"]
184 pub const UCL_STRING_PARSE_BYTES: ucl_string_flags = ucl_string_flags(64);
185}
186impl ::std::ops::BitOr<ucl_string_flags> for ucl_string_flags {
187 type Output = Self;
188 #[inline]
189 fn bitor(self, other: Self) -> Self {
190 ucl_string_flags(self.0 | other.0)
191 }
192}
193impl ::std::ops::BitOrAssign for ucl_string_flags {
194 #[inline]
195 fn bitor_assign(&mut self, rhs: ucl_string_flags) {
196 self.0 |= rhs.0;
197 }
198}
199impl ::std::ops::BitAnd<ucl_string_flags> for ucl_string_flags {
200 type Output = Self;
201 #[inline]
202 fn bitand(self, other: Self) -> Self {
203 ucl_string_flags(self.0 & other.0)
204 }
205}
206impl ::std::ops::BitAndAssign for ucl_string_flags {
207 #[inline]
208 fn bitand_assign(&mut self, rhs: ucl_string_flags) {
209 self.0 &= rhs.0;
210 }
211}
212#[repr(transparent)]
213#[doc = " String conversion flags, that are used in #ucl_object_fromstring_common function."]
214#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
215pub struct ucl_string_flags(pub u32);
216pub use self::ucl_string_flags as ucl_string_flags_t;
217impl ucl_object_flags {
218 #[doc = "< An object has key allocated internally"]
219 pub const UCL_OBJECT_ALLOCATED_KEY: ucl_object_flags = ucl_object_flags(1);
220}
221impl ucl_object_flags {
222 #[doc = "< An object has a string value allocated internally"]
223 pub const UCL_OBJECT_ALLOCATED_VALUE: ucl_object_flags = ucl_object_flags(2);
224}
225impl ucl_object_flags {
226 #[doc = "< The key of an object need to be escaped on output"]
227 pub const UCL_OBJECT_NEED_KEY_ESCAPE: ucl_object_flags = ucl_object_flags(4);
228}
229impl ucl_object_flags {
230 #[doc = "< Temporary object that does not need to be freed really"]
231 pub const UCL_OBJECT_EPHEMERAL: ucl_object_flags = ucl_object_flags(8);
232}
233impl ucl_object_flags {
234 #[doc = "< String should be displayed as multiline string"]
235 pub const UCL_OBJECT_MULTILINE: ucl_object_flags = ucl_object_flags(16);
236}
237impl ucl_object_flags {
238 #[doc = "< Object is a key with multiple values"]
239 pub const UCL_OBJECT_MULTIVALUE: ucl_object_flags = ucl_object_flags(32);
240}
241impl ucl_object_flags {
242 #[doc = "< Object has been inherited from another"]
243 pub const UCL_OBJECT_INHERITED: ucl_object_flags = ucl_object_flags(64);
244}
245impl ucl_object_flags {
246 #[doc = "< Object contains raw binary data"]
247 pub const UCL_OBJECT_BINARY: ucl_object_flags = ucl_object_flags(128);
248}
249impl ::std::ops::BitOr<ucl_object_flags> for ucl_object_flags {
250 type Output = Self;
251 #[inline]
252 fn bitor(self, other: Self) -> Self {
253 ucl_object_flags(self.0 | other.0)
254 }
255}
256impl ::std::ops::BitOrAssign for ucl_object_flags {
257 #[inline]
258 fn bitor_assign(&mut self, rhs: ucl_object_flags) {
259 self.0 |= rhs.0;
260 }
261}
262impl ::std::ops::BitAnd<ucl_object_flags> for ucl_object_flags {
263 type Output = Self;
264 #[inline]
265 fn bitand(self, other: Self) -> Self {
266 ucl_object_flags(self.0 & other.0)
267 }
268}
269impl ::std::ops::BitAndAssign for ucl_object_flags {
270 #[inline]
271 fn bitand_assign(&mut self, rhs: ucl_object_flags) {
272 self.0 &= rhs.0;
273 }
274}
275#[repr(transparent)]
276#[doc = " Basic flags for an object"]
277#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
278pub struct ucl_object_flags(pub u32);
279pub use self::ucl_object_flags as ucl_object_flags_t;
280#[repr(u32)]
281#[doc = " Duplicate policy types"]
282#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
283pub enum ucl_duplicate_strategy {
284 #[doc = "< Default policy to merge based on priorities"]
285 UCL_DUPLICATE_APPEND = 0,
286 #[doc = "< Merge new object with old one"]
287 UCL_DUPLICATE_MERGE = 1,
288 #[doc = "< Rewrite old keys"]
289 UCL_DUPLICATE_REWRITE = 2,
290 #[doc = "< Stop parsing on duplicate found"]
291 UCL_DUPLICATE_ERROR = 3,
292}
293#[repr(u32)]
294#[doc = " Input format type"]
295#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
296pub enum ucl_parse_type {
297 #[doc = "< Default ucl format"]
298 UCL_PARSE_UCL = 0,
299 #[doc = "< Message pack input format"]
300 UCL_PARSE_MSGPACK = 1,
301 #[doc = "< Canonical S-expressions"]
302 UCL_PARSE_CSEXP = 2,
303 #[doc = "< Try to detect parse type"]
304 UCL_PARSE_AUTO = 3,
305}
306#[doc = " UCL object structure. Please mention that the most of fields should not be touched by"]
307#[doc = " UCL users. In future, this structure may be converted to private one."]
308#[repr(C)]
309#[repr(align(8))]
310#[derive(Debug, Copy, Clone)]
311pub struct ucl_object_s {
312 pub _bindgen_opaque_blob: [u64; 8usize],
313}
314#[doc = " Variant value type"]
315#[repr(C)]
316#[derive(Copy, Clone)]
317pub union ucl_object_s__bindgen_ty_1 {
318 #[doc = "< Int value of an object"]
319 pub iv: i64,
320 #[doc = "< String value of an object"]
321 pub sv: *const ::std::os::raw::c_char,
322 #[doc = "< Double value of an object"]
323 pub dv: f64,
324 #[doc = "< Array"]
325 pub av: *mut ::std::os::raw::c_void,
326 #[doc = "< Object"]
327 pub ov: *mut ::std::os::raw::c_void,
328 #[doc = "< Opaque user data"]
329 pub ud: *mut ::std::os::raw::c_void,
330 _bindgen_union_align: u64,
331}
332#[test]
333fn bindgen_test_layout_ucl_object_s__bindgen_ty_1() {
334 assert_eq!(
335 ::std::mem::size_of::<ucl_object_s__bindgen_ty_1>(),
336 8usize,
337 concat!("Size of: ", stringify!(ucl_object_s__bindgen_ty_1))
338 );
339 assert_eq!(
340 ::std::mem::align_of::<ucl_object_s__bindgen_ty_1>(),
341 8usize,
342 concat!("Alignment of ", stringify!(ucl_object_s__bindgen_ty_1))
343 );
344 assert_eq!(
345 unsafe { &(*(::std::ptr::null::<ucl_object_s__bindgen_ty_1>())).iv as *const _ as usize },
346 0usize,
347 concat!(
348 "Offset of field: ",
349 stringify!(ucl_object_s__bindgen_ty_1),
350 "::",
351 stringify!(iv)
352 )
353 );
354 assert_eq!(
355 unsafe { &(*(::std::ptr::null::<ucl_object_s__bindgen_ty_1>())).sv as *const _ as usize },
356 0usize,
357 concat!(
358 "Offset of field: ",
359 stringify!(ucl_object_s__bindgen_ty_1),
360 "::",
361 stringify!(sv)
362 )
363 );
364 assert_eq!(
365 unsafe { &(*(::std::ptr::null::<ucl_object_s__bindgen_ty_1>())).dv as *const _ as usize },
366 0usize,
367 concat!(
368 "Offset of field: ",
369 stringify!(ucl_object_s__bindgen_ty_1),
370 "::",
371 stringify!(dv)
372 )
373 );
374 assert_eq!(
375 unsafe { &(*(::std::ptr::null::<ucl_object_s__bindgen_ty_1>())).av as *const _ as usize },
376 0usize,
377 concat!(
378 "Offset of field: ",
379 stringify!(ucl_object_s__bindgen_ty_1),
380 "::",
381 stringify!(av)
382 )
383 );
384 assert_eq!(
385 unsafe { &(*(::std::ptr::null::<ucl_object_s__bindgen_ty_1>())).ov as *const _ as usize },
386 0usize,
387 concat!(
388 "Offset of field: ",
389 stringify!(ucl_object_s__bindgen_ty_1),
390 "::",
391 stringify!(ov)
392 )
393 );
394 assert_eq!(
395 unsafe { &(*(::std::ptr::null::<ucl_object_s__bindgen_ty_1>())).ud as *const _ as usize },
396 0usize,
397 concat!(
398 "Offset of field: ",
399 stringify!(ucl_object_s__bindgen_ty_1),
400 "::",
401 stringify!(ud)
402 )
403 );
404}
405#[test]
406fn bindgen_test_layout_ucl_object_s() {
407 assert_eq!(
408 ::std::mem::size_of::<ucl_object_s>(),
409 64usize,
410 concat!("Size of: ", stringify!(ucl_object_s))
411 );
412 assert_eq!(
413 ::std::mem::align_of::<ucl_object_s>(),
414 8usize,
415 concat!("Alignment of ", stringify!(ucl_object_s))
416 );
417}
418pub type ucl_object_t = ucl_object_s;
419#[doc = " Destructor type for userdata objects"]
420#[doc = " @param ud user specified data pointer"]
421pub type ucl_userdata_dtor =
422 ::std::option::Option<unsafe extern "C" fn(ud: *mut ::std::os::raw::c_void)>;
423pub type ucl_userdata_emitter = ::std::option::Option<
424 unsafe extern "C" fn(ud: *mut ::std::os::raw::c_void) -> *const ::std::os::raw::c_char,
425>;
426extern "C" {
427 #[doc = " @defgroup utils Utility functions"]
428 #[doc = " A number of utility functions simplify handling of UCL objects"]
429 #[doc = ""]
430 #[doc = " @{"]
431 #[doc = " Copy and return a key of an object, returned key is zero-terminated"]
432 #[doc = " @param obj CL object"]
433 #[doc = " @return zero terminated key"]
434 pub fn ucl_copy_key_trash(obj: *const ucl_object_t) -> *mut ::std::os::raw::c_char;
435}
436extern "C" {
437 #[doc = " Copy and return a string value of an object, returned key is zero-terminated"]
438 #[doc = " @param obj CL object"]
439 #[doc = " @return zero terminated string representation of object value"]
440 pub fn ucl_copy_value_trash(obj: *const ucl_object_t) -> *mut ::std::os::raw::c_char;
441}
442extern "C" {
443 #[doc = " Creates a new object"]
444 #[doc = " @return new object"]
445 pub fn ucl_object_new() -> *mut ucl_object_t;
446}
447extern "C" {
448 #[doc = " Create new object with type specified"]
449 #[doc = " @param type type of a new object"]
450 #[doc = " @return new object"]
451 pub fn ucl_object_typed_new(type_: ucl_type_t) -> *mut ucl_object_t;
452}
453extern "C" {
454 #[doc = " Create new object with type and priority specified"]
455 #[doc = " @param type type of a new object"]
456 #[doc = " @param priority priority of an object"]
457 #[doc = " @return new object"]
458 pub fn ucl_object_new_full(
459 type_: ucl_type_t,
460 priority: ::std::os::raw::c_uint,
461 ) -> *mut ucl_object_t;
462}
463extern "C" {
464 #[doc = " Create new object with userdata dtor"]
465 #[doc = " @param dtor destructor function"]
466 #[doc = " @param emitter emitter for userdata"]
467 #[doc = " @param ptr opaque pointer"]
468 #[doc = " @return new object"]
469 pub fn ucl_object_new_userdata(
470 dtor: ucl_userdata_dtor,
471 emitter: ucl_userdata_emitter,
472 ptr: *mut ::std::os::raw::c_void,
473 ) -> *mut ucl_object_t;
474}
475extern "C" {
476 #[doc = " Perform deep copy of an object copying everything"]
477 #[doc = " @param other object to copy"]
478 #[doc = " @return new object with refcount equal to 1"]
479 pub fn ucl_object_copy(other: *const ucl_object_t) -> *mut ucl_object_t;
480}
481extern "C" {
482 #[doc = " Return the type of an object"]
483 #[doc = " @return the object type"]
484 pub fn ucl_object_type(obj: *const ucl_object_t) -> ucl_type_t;
485}
486extern "C" {
487 #[doc = " Converts ucl object type to its string representation"]
488 #[doc = " @param type type of object"]
489 #[doc = " @return constant string describing type"]
490 pub fn ucl_object_type_to_string(type_: ucl_type_t) -> *const ::std::os::raw::c_char;
491}
492extern "C" {
493 #[doc = " Converts string that represents ucl type to real ucl type enum"]
494 #[doc = " @param input C string with name of type"]
495 #[doc = " @param res resulting target"]
496 #[doc = " @return true if `input` is a name of type stored in `res`"]
497 pub fn ucl_object_string_to_type(
498 input: *const ::std::os::raw::c_char,
499 res: *mut ucl_type_t,
500 ) -> bool;
501}
502extern "C" {
503 #[doc = " Convert any string to an ucl object making the specified transformations"]
504 #[doc = " @param str fixed size or NULL terminated string"]
505 #[doc = " @param len length (if len is zero, than str is treated as NULL terminated)"]
506 #[doc = " @param flags conversion flags"]
507 #[doc = " @return new object"]
508 pub fn ucl_object_fromstring_common(
509 str: *const ::std::os::raw::c_char,
510 len: usize,
511 flags: ucl_string_flags,
512 ) -> *mut ucl_object_t;
513}
514extern "C" {
515 #[doc = " Create a UCL object from the specified string"]
516 #[doc = " @param str NULL terminated string, will be json escaped"]
517 #[doc = " @return new object"]
518 pub fn ucl_object_fromstring(str: *const ::std::os::raw::c_char) -> *mut ucl_object_t;
519}
520extern "C" {
521 #[doc = " Create a UCL object from the specified string"]
522 #[doc = " @param str fixed size string, will be json escaped"]
523 #[doc = " @param len length of a string"]
524 #[doc = " @return new object"]
525 pub fn ucl_object_fromlstring(
526 str: *const ::std::os::raw::c_char,
527 len: usize,
528 ) -> *mut ucl_object_t;
529}
530extern "C" {
531 #[doc = " Create an object from an integer number"]
532 #[doc = " @param iv number"]
533 #[doc = " @return new object"]
534 pub fn ucl_object_fromint(iv: i64) -> *mut ucl_object_t;
535}
536extern "C" {
537 #[doc = " Create an object from a float number"]
538 #[doc = " @param dv number"]
539 #[doc = " @return new object"]
540 pub fn ucl_object_fromdouble(dv: f64) -> *mut ucl_object_t;
541}
542extern "C" {
543 #[doc = " Create an object from a boolean"]
544 #[doc = " @param bv bool value"]
545 #[doc = " @return new object"]
546 pub fn ucl_object_frombool(bv: bool) -> *mut ucl_object_t;
547}
548extern "C" {
549 #[doc = " Insert a object 'elt' to the hash 'top' and associate it with key 'key'"]
550 #[doc = " @param top destination object (must be of type UCL_OBJECT)"]
551 #[doc = " @param elt element to insert (must NOT be NULL)"]
552 #[doc = " @param key key to associate with this object (either const or preallocated)"]
553 #[doc = " @param keylen length of the key (or 0 for NULL terminated keys)"]
554 #[doc = " @param copy_key make an internal copy of key"]
555 #[doc = " @return true if key has been inserted"]
556 pub fn ucl_object_insert_key(
557 top: *mut ucl_object_t,
558 elt: *mut ucl_object_t,
559 key: *const ::std::os::raw::c_char,
560 keylen: usize,
561 copy_key: bool,
562 ) -> bool;
563}
564extern "C" {
565 #[doc = " Replace a object 'elt' to the hash 'top' and associate it with key 'key', old object will be unrefed,"]
566 #[doc = " if no object has been found this function works like ucl_object_insert_key()"]
567 #[doc = " @param top destination object (must be of type UCL_OBJECT)"]
568 #[doc = " @param elt element to insert (must NOT be NULL)"]
569 #[doc = " @param key key to associate with this object (either const or preallocated)"]
570 #[doc = " @param keylen length of the key (or 0 for NULL terminated keys)"]
571 #[doc = " @param copy_key make an internal copy of key"]
572 #[doc = " @return true if key has been inserted"]
573 pub fn ucl_object_replace_key(
574 top: *mut ucl_object_t,
575 elt: *mut ucl_object_t,
576 key: *const ::std::os::raw::c_char,
577 keylen: usize,
578 copy_key: bool,
579 ) -> bool;
580}
581extern "C" {
582 #[doc = " Merge the keys from one object to another object. Overwrite on conflict"]
583 #[doc = " @param top destination object (must be of type UCL_OBJECT)"]
584 #[doc = " @param elt element to insert (must be of type UCL_OBJECT)"]
585 #[doc = " @param copy copy rather than reference the elements"]
586 #[doc = " @return true if all keys have been merged"]
587 pub fn ucl_object_merge(top: *mut ucl_object_t, elt: *mut ucl_object_t, copy: bool) -> bool;
588}
589extern "C" {
590 #[doc = " Delete a object associated with key 'key', old object will be unrefered,"]
591 #[doc = " @param top object"]
592 #[doc = " @param key key associated to the object to remove"]
593 #[doc = " @param keylen length of the key (or 0 for NULL terminated keys)"]
594 pub fn ucl_object_delete_keyl(
595 top: *mut ucl_object_t,
596 key: *const ::std::os::raw::c_char,
597 keylen: usize,
598 ) -> bool;
599}
600extern "C" {
601 #[doc = " Delete a object associated with key 'key', old object will be unrefered,"]
602 #[doc = " @param top object"]
603 #[doc = " @param key key associated to the object to remove"]
604 pub fn ucl_object_delete_key(
605 top: *mut ucl_object_t,
606 key: *const ::std::os::raw::c_char,
607 ) -> bool;
608}
609extern "C" {
610 #[doc = " Removes `key` from `top` object, returning the object that was removed. This"]
611 #[doc = " object is not released, caller must unref the returned object when it is no"]
612 #[doc = " longer needed."]
613 #[doc = " @param top object"]
614 #[doc = " @param key key to remove"]
615 #[doc = " @param keylen length of the key (or 0 for NULL terminated keys)"]
616 #[doc = " @return removed object or NULL if object has not been found"]
617 pub fn ucl_object_pop_keyl(
618 top: *mut ucl_object_t,
619 key: *const ::std::os::raw::c_char,
620 keylen: usize,
621 ) -> *mut ucl_object_t;
622}
623extern "C" {
624 #[doc = " Removes `key` from `top` object returning the object that was removed. This"]
625 #[doc = " object is not released, caller must unref the returned object when it is no"]
626 #[doc = " longer needed."]
627 #[doc = " @param top object"]
628 #[doc = " @param key key to remove"]
629 #[doc = " @return removed object or NULL if object has not been found"]
630 pub fn ucl_object_pop_key(
631 top: *mut ucl_object_t,
632 key: *const ::std::os::raw::c_char,
633 ) -> *mut ucl_object_t;
634}
635extern "C" {
636 #[doc = " Insert a object 'elt' to the hash 'top' and associate it with key 'key', if"]
637 #[doc = " the specified key exist, try to merge its content"]
638 #[doc = " @param top destination object (must be of type UCL_OBJECT)"]
639 #[doc = " @param elt element to insert (must NOT be NULL)"]
640 #[doc = " @param key key to associate with this object (either const or preallocated)"]
641 #[doc = " @param keylen length of the key (or 0 for NULL terminated keys)"]
642 #[doc = " @param copy_key make an internal copy of key"]
643 #[doc = " @return true if key has been inserted"]
644 pub fn ucl_object_insert_key_merged(
645 top: *mut ucl_object_t,
646 elt: *mut ucl_object_t,
647 key: *const ::std::os::raw::c_char,
648 keylen: usize,
649 copy_key: bool,
650 ) -> bool;
651}
652extern "C" {
653 #[doc = " Reserve space in ucl array or object for `elt` elements"]
654 #[doc = " @param obj object to reserve"]
655 #[doc = " @param reserved size to reserve in an object"]
656 pub fn ucl_object_reserve(obj: *mut ucl_object_t, reserved: usize);
657}
658extern "C" {
659 #[doc = " Append an element to the end of array object"]
660 #[doc = " @param top destination object (must NOT be NULL)"]
661 #[doc = " @param elt element to append (must NOT be NULL)"]
662 #[doc = " @return true if value has been inserted"]
663 pub fn ucl_array_append(top: *mut ucl_object_t, elt: *mut ucl_object_t) -> bool;
664}
665extern "C" {
666 #[doc = " Append an element to the start of array object"]
667 #[doc = " @param top destination object (must NOT be NULL)"]
668 #[doc = " @param elt element to append (must NOT be NULL)"]
669 #[doc = " @return true if value has been inserted"]
670 pub fn ucl_array_prepend(top: *mut ucl_object_t, elt: *mut ucl_object_t) -> bool;
671}
672extern "C" {
673 #[doc = " Merge all elements of second array into the first array"]
674 #[doc = " @param top destination array (must be of type UCL_ARRAY)"]
675 #[doc = " @param elt array to copy elements from (must be of type UCL_ARRAY)"]
676 #[doc = " @param copy copy elements instead of referencing them"]
677 #[doc = " @return true if arrays were merged"]
678 pub fn ucl_array_merge(top: *mut ucl_object_t, elt: *mut ucl_object_t, copy: bool) -> bool;
679}
680extern "C" {
681 #[doc = " Removes an element `elt` from the array `top`, returning the object that was"]
682 #[doc = " removed. This object is not released, caller must unref the returned object"]
683 #[doc = " when it is no longer needed."]
684 #[doc = " @param top array ucl object"]
685 #[doc = " @param elt element to remove"]
686 #[doc = " @return removed element or NULL if `top` is NULL or not an array"]
687 pub fn ucl_array_delete(top: *mut ucl_object_t, elt: *mut ucl_object_t) -> *mut ucl_object_t;
688}
689extern "C" {
690 #[doc = " Returns the first element of the array `top`"]
691 #[doc = " @param top array ucl object"]
692 #[doc = " @return element or NULL if `top` is NULL or not an array"]
693 pub fn ucl_array_head(top: *const ucl_object_t) -> *const ucl_object_t;
694}
695extern "C" {
696 #[doc = " Returns the last element of the array `top`"]
697 #[doc = " @param top array ucl object"]
698 #[doc = " @return element or NULL if `top` is NULL or not an array"]
699 pub fn ucl_array_tail(top: *const ucl_object_t) -> *const ucl_object_t;
700}
701extern "C" {
702 #[doc = " Removes the last element from the array `top`, returning the object that was"]
703 #[doc = " removed. This object is not released, caller must unref the returned object"]
704 #[doc = " when it is no longer needed."]
705 #[doc = " @param top array ucl object"]
706 #[doc = " @return removed element or NULL if `top` is NULL or not an array"]
707 pub fn ucl_array_pop_last(top: *mut ucl_object_t) -> *mut ucl_object_t;
708}
709extern "C" {
710 #[doc = " Removes the first element from the array `top`, returning the object that was"]
711 #[doc = " removed. This object is not released, caller must unref the returned object"]
712 #[doc = " when it is no longer needed."]
713 #[doc = " @param top array ucl object"]
714 #[doc = " @return removed element or NULL if `top` is NULL or not an array"]
715 pub fn ucl_array_pop_first(top: *mut ucl_object_t) -> *mut ucl_object_t;
716}
717extern "C" {
718 #[doc = " Return size of the array `top`"]
719 #[doc = " @param top object to get size from (must be of type UCL_ARRAY)"]
720 #[doc = " @return size of the array"]
721 pub fn ucl_array_size(top: *const ucl_object_t) -> ::std::os::raw::c_uint;
722}
723extern "C" {
724 #[doc = " Return object identified by index of the array `top`"]
725 #[doc = " @param top object to get a key from (must be of type UCL_ARRAY)"]
726 #[doc = " @param index array index to return"]
727 #[doc = " @return object at the specified index or NULL if index is not found"]
728 pub fn ucl_array_find_index(
729 top: *const ucl_object_t,
730 index: ::std::os::raw::c_uint,
731 ) -> *const ucl_object_t;
732}
733extern "C" {
734 #[doc = " Return the index of `elt` in the array `top`"]
735 #[doc = " @param top object to get a key from (must be of type UCL_ARRAY)"]
736 #[doc = " @param elt element to find index of (must NOT be NULL)"]
737 #[doc = " @return index of `elt` in the array `top or (unsigned int)-1 if `elt` is not found"]
738 pub fn ucl_array_index_of(
739 top: *mut ucl_object_t,
740 elt: *mut ucl_object_t,
741 ) -> ::std::os::raw::c_uint;
742}
743extern "C" {
744 #[doc = " Replace an element in an array with a different element, returning the object"]
745 #[doc = " that was replaced. This object is not released, caller must unref the"]
746 #[doc = " returned object when it is no longer needed."]
747 #[doc = " @param top destination object (must be of type UCL_ARRAY)"]
748 #[doc = " @param elt element to append (must NOT be NULL)"]
749 #[doc = " @param index array index in destination to overwrite with elt"]
750 #[doc = " @return object that was replaced or NULL if index is not found"]
751 pub fn ucl_array_replace_index(
752 top: *mut ucl_object_t,
753 elt: *mut ucl_object_t,
754 index: ::std::os::raw::c_uint,
755 ) -> *mut ucl_object_t;
756}
757extern "C" {
758 #[doc = " Append a element to another element forming an implicit array"]
759 #[doc = " @param head head to append (may be NULL)"]
760 #[doc = " @param elt new element"]
761 #[doc = " @return the new implicit array"]
762 pub fn ucl_elt_append(head: *mut ucl_object_t, elt: *mut ucl_object_t) -> *mut ucl_object_t;
763}
764extern "C" {
765 #[doc = " Converts an object to double value"]
766 #[doc = " @param obj CL object"]
767 #[doc = " @param target target double variable"]
768 #[doc = " @return true if conversion was successful"]
769 pub fn ucl_object_todouble_safe(obj: *const ucl_object_t, target: *mut f64) -> bool;
770}
771extern "C" {
772 #[doc = " Unsafe version of \\ref ucl_obj_todouble_safe"]
773 #[doc = " @param obj CL object"]
774 #[doc = " @return double value"]
775 pub fn ucl_object_todouble(obj: *const ucl_object_t) -> f64;
776}
777extern "C" {
778 #[doc = " Converts an object to integer value"]
779 #[doc = " @param obj CL object"]
780 #[doc = " @param target target integer variable"]
781 #[doc = " @return true if conversion was successful"]
782 pub fn ucl_object_toint_safe(obj: *const ucl_object_t, target: *mut i64) -> bool;
783}
784extern "C" {
785 #[doc = " Unsafe version of \\ref ucl_obj_toint_safe"]
786 #[doc = " @param obj CL object"]
787 #[doc = " @return int value"]
788 pub fn ucl_object_toint(obj: *const ucl_object_t) -> i64;
789}
790extern "C" {
791 #[doc = " Converts an object to boolean value"]
792 #[doc = " @param obj CL object"]
793 #[doc = " @param target target boolean variable"]
794 #[doc = " @return true if conversion was successful"]
795 pub fn ucl_object_toboolean_safe(obj: *const ucl_object_t, target: *mut bool) -> bool;
796}
797extern "C" {
798 #[doc = " Unsafe version of \\ref ucl_obj_toboolean_safe"]
799 #[doc = " @param obj CL object"]
800 #[doc = " @return boolean value"]
801 pub fn ucl_object_toboolean(obj: *const ucl_object_t) -> bool;
802}
803extern "C" {
804 #[doc = " Converts an object to string value"]
805 #[doc = " @param obj CL object"]
806 #[doc = " @param target target string variable, no need to free value"]
807 #[doc = " @return true if conversion was successful"]
808 pub fn ucl_object_tostring_safe(
809 obj: *const ucl_object_t,
810 target: *mut *const ::std::os::raw::c_char,
811 ) -> bool;
812}
813extern "C" {
814 #[doc = " Unsafe version of \\ref ucl_obj_tostring_safe"]
815 #[doc = " @param obj CL object"]
816 #[doc = " @return string value"]
817 pub fn ucl_object_tostring(obj: *const ucl_object_t) -> *const ::std::os::raw::c_char;
818}
819extern "C" {
820 #[doc = " Convert any object to a string in JSON notation if needed"]
821 #[doc = " @param obj CL object"]
822 #[doc = " @return string value"]
823 pub fn ucl_object_tostring_forced(obj: *const ucl_object_t) -> *const ::std::os::raw::c_char;
824}
825extern "C" {
826 #[doc = " Return string as char * and len, string may be not zero terminated, more efficient that \\ref ucl_obj_tostring as it"]
827 #[doc = " allows zero-copy (if #UCL_PARSER_ZEROCOPY has been used during parsing)"]
828 #[doc = " @param obj CL object"]
829 #[doc = " @param target target string variable, no need to free value"]
830 #[doc = " @param tlen target length"]
831 #[doc = " @return true if conversion was successful"]
832 pub fn ucl_object_tolstring_safe(
833 obj: *const ucl_object_t,
834 target: *mut *const ::std::os::raw::c_char,
835 tlen: *mut usize,
836 ) -> bool;
837}
838extern "C" {
839 #[doc = " Unsafe version of \\ref ucl_obj_tolstring_safe"]
840 #[doc = " @param obj CL object"]
841 #[doc = " @return string value"]
842 pub fn ucl_object_tolstring(
843 obj: *const ucl_object_t,
844 tlen: *mut usize,
845 ) -> *const ::std::os::raw::c_char;
846}
847extern "C" {
848 #[doc = " Return object identified by a key in the specified object"]
849 #[doc = " @param obj object to get a key from (must be of type UCL_OBJECT)"]
850 #[doc = " @param key key to search"]
851 #[doc = " @return object matching the specified key or NULL if key was not found"]
852 pub fn ucl_object_lookup(
853 obj: *const ucl_object_t,
854 key: *const ::std::os::raw::c_char,
855 ) -> *const ucl_object_t;
856}
857extern "C" {
858 #[doc = " Return object identified by a key in the specified object, if the first key is"]
859 #[doc = " not found then look for the next one. This process is repeated unless"]
860 #[doc = " the next argument in the list is not NULL. So, `ucl_object_find_any_key(obj, key, NULL)`"]
861 #[doc = " is equal to `ucl_object_find_key(obj, key)`"]
862 #[doc = " @param obj object to get a key from (must be of type UCL_OBJECT)"]
863 #[doc = " @param key key to search"]
864 #[doc = " @param ... list of alternative keys to search (NULL terminated)"]
865 #[doc = " @return object matching the specified key or NULL if key was not found"]
866 pub fn ucl_object_lookup_any(
867 obj: *const ucl_object_t,
868 key: *const ::std::os::raw::c_char,
869 ...
870 ) -> *const ucl_object_t;
871}
872extern "C" {
873 #[doc = " Return object identified by a fixed size key in the specified object"]
874 #[doc = " @param obj object to get a key from (must be of type UCL_OBJECT)"]
875 #[doc = " @param key key to search"]
876 #[doc = " @param klen length of a key"]
877 #[doc = " @return object matching the specified key or NULL if key was not found"]
878 pub fn ucl_object_lookup_len(
879 obj: *const ucl_object_t,
880 key: *const ::std::os::raw::c_char,
881 klen: usize,
882 ) -> *const ucl_object_t;
883}
884extern "C" {
885 #[doc = " Return object identified by dot notation string"]
886 #[doc = " @param obj object to search in"]
887 #[doc = " @param path dot.notation.path to the path to lookup. May use numeric .index on arrays"]
888 #[doc = " @return object matched the specified path or NULL if path is not found"]
889 pub fn ucl_object_lookup_path(
890 obj: *const ucl_object_t,
891 path: *const ::std::os::raw::c_char,
892 ) -> *const ucl_object_t;
893}
894extern "C" {
895 #[doc = " Return object identified by object notation string using arbitrary delimiter"]
896 #[doc = " @param obj object to search in"]
897 #[doc = " @param path dot.notation.path to the path to lookup. May use numeric .index on arrays"]
898 #[doc = " @param sep the sepatorator to use in place of . (incase keys have . in them)"]
899 #[doc = " @return object matched the specified path or NULL if path is not found"]
900 pub fn ucl_object_lookup_path_char(
901 obj: *const ucl_object_t,
902 path: *const ::std::os::raw::c_char,
903 sep: ::std::os::raw::c_char,
904 ) -> *const ucl_object_t;
905}
906extern "C" {
907 #[doc = " Returns a key of an object as a NULL terminated string"]
908 #[doc = " @param obj CL object"]
909 #[doc = " @return key or NULL if there is no key"]
910 pub fn ucl_object_key(obj: *const ucl_object_t) -> *const ::std::os::raw::c_char;
911}
912extern "C" {
913 #[doc = " Returns a key of an object as a fixed size string (may be more efficient)"]
914 #[doc = " @param obj CL object"]
915 #[doc = " @param len target key length"]
916 #[doc = " @return key pointer"]
917 pub fn ucl_object_keyl(
918 obj: *const ucl_object_t,
919 len: *mut usize,
920 ) -> *const ::std::os::raw::c_char;
921}
922extern "C" {
923 #[doc = " Increase reference count for an object"]
924 #[doc = " @param obj object to ref"]
925 #[doc = " @return the referenced object"]
926 pub fn ucl_object_ref(obj: *const ucl_object_t) -> *mut ucl_object_t;
927}
928extern "C" {
929 pub fn ucl_object_free(obj: *mut ucl_object_t);
930}
931extern "C" {
932 #[doc = " Decrease reference count for an object"]
933 #[doc = " @param obj object to unref"]
934 pub fn ucl_object_unref(obj: *mut ucl_object_t);
935}
936extern "C" {
937 #[doc = " Compare objects `o1` and `o2`"]
938 #[doc = " @param o1 the first object"]
939 #[doc = " @param o2 the second object"]
940 #[doc = " @return values >0, 0 and <0 if `o1` is more than, equal and less than `o2`."]
941 #[doc = " The order of comparison:"]
942 #[doc = " 1) Type of objects"]
943 #[doc = " 2) Size of objects"]
944 #[doc = " 3) Content of objects"]
945 pub fn ucl_object_compare(
946 o1: *const ucl_object_t,
947 o2: *const ucl_object_t,
948 ) -> ::std::os::raw::c_int;
949}
950extern "C" {
951 #[doc = " Compare objects `o1` and `o2` useful for sorting"]
952 #[doc = " @param o1 the first object"]
953 #[doc = " @param o2 the second object"]
954 #[doc = " @return values >0, 0 and <0 if `o1` is more than, equal and less than `o2`."]
955 #[doc = " The order of comparison:"]
956 #[doc = " 1) Type of objects"]
957 #[doc = " 2) Size of objects"]
958 #[doc = " 3) Content of objects"]
959 pub fn ucl_object_compare_qsort(
960 o1: *mut *const ucl_object_t,
961 o2: *mut *const ucl_object_t,
962 ) -> ::std::os::raw::c_int;
963}
964extern "C" {
965 #[doc = " Sort UCL array using `cmp` compare function"]
966 #[doc = " @param ar"]
967 #[doc = " @param cmp"]
968 pub fn ucl_object_array_sort(
969 ar: *mut ucl_object_t,
970 cmp: ::std::option::Option<
971 unsafe extern "C" fn(
972 o1: *mut *const ucl_object_t,
973 o2: *mut *const ucl_object_t,
974 ) -> ::std::os::raw::c_int,
975 >,
976 );
977}
978extern "C" {
979 #[doc = " Get the priority for specific UCL object"]
980 #[doc = " @param obj any ucl object"]
981 #[doc = " @return priority of an object"]
982 pub fn ucl_object_get_priority(obj: *const ucl_object_t) -> ::std::os::raw::c_uint;
983}
984extern "C" {
985 #[doc = " Set explicit priority of an object."]
986 #[doc = " @param obj any ucl object"]
987 #[doc = " @param priority new priroity value (only 4 least significant bits are considred)"]
988 pub fn ucl_object_set_priority(obj: *mut ucl_object_t, priority: ::std::os::raw::c_uint);
989}
990#[doc = " Opaque iterator object"]
991pub type ucl_object_iter_t = *mut ::std::os::raw::c_void;
992extern "C" {
993 #[doc = " Get next key from an object"]
994 #[doc = " @param obj object to iterate"]
995 #[doc = " @param iter opaque iterator, must be set to NULL on the first call:"]
996 #[doc = " ucl_object_iter_t it = NULL;"]
997 #[doc = " while ((cur = ucl_iterate_object (obj, &it)) != NULL) ..."]
998 #[doc = " @return the next object or NULL"]
999 pub fn ucl_object_iterate(
1000 obj: *const ucl_object_t,
1001 iter: *mut ucl_object_iter_t,
1002 expand_values: bool,
1003 ) -> *const ucl_object_t;
1004}
1005extern "C" {
1006 #[doc = " Create new safe iterator for the specified object"]
1007 #[doc = " @param obj object to iterate"]
1008 #[doc = " @return new iterator object that should be used with safe iterators API only"]
1009 pub fn ucl_object_iterate_new(obj: *const ucl_object_t) -> ucl_object_iter_t;
1010}
1011extern "C" {
1012 #[doc = " Reset initialized iterator to a new object"]
1013 #[doc = " @param obj new object to iterate"]
1014 #[doc = " @return modified iterator object"]
1015 pub fn ucl_object_iterate_reset(
1016 it: ucl_object_iter_t,
1017 obj: *const ucl_object_t,
1018 ) -> ucl_object_iter_t;
1019}
1020extern "C" {
1021 #[doc = " Get the next object from the `obj`. This function iterates over arrays, objects"]
1022 #[doc = " and implicit arrays"]
1023 #[doc = " @param iter safe iterator"]
1024 #[doc = " @param expand_values expand explicit arrays and objects"]
1025 #[doc = " @return the next object in sequence"]
1026 pub fn ucl_object_iterate_safe(
1027 iter: ucl_object_iter_t,
1028 expand_values: bool,
1029 ) -> *const ucl_object_t;
1030}
1031#[repr(u32)]
1032#[doc = " Iteration type enumerator"]
1033#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1034pub enum ucl_iterate_type {
1035 #[doc = "< Iterate just explicit arrays and objects"]
1036 UCL_ITERATE_EXPLICIT = 1,
1037 #[doc = "< Iterate just implicit arrays"]
1038 UCL_ITERATE_IMPLICIT = 2,
1039 #[doc = "< Iterate both explicit and implicit arrays"]
1040 UCL_ITERATE_BOTH = 3,
1041}
1042extern "C" {
1043 #[doc = " Get the next object from the `obj`. This function iterates over arrays, objects"]
1044 #[doc = " and implicit arrays if needed"]
1045 #[doc = " @param iter safe iterator"]
1046 #[doc = " @param"]
1047 #[doc = " @return the next object in sequence"]
1048 pub fn ucl_object_iterate_full(
1049 iter: ucl_object_iter_t,
1050 type_: ucl_iterate_type,
1051 ) -> *const ucl_object_t;
1052}
1053extern "C" {
1054 #[doc = " Free memory associated with the safe iterator"]
1055 #[doc = " @param it safe iterator object"]
1056 pub fn ucl_object_iterate_free(it: ucl_object_iter_t);
1057}
1058#[doc = " Macro handler for a parser"]
1059#[doc = " @param data the content of macro"]
1060#[doc = " @param len the length of content"]
1061#[doc = " @param arguments arguments object"]
1062#[doc = " @param ud opaque user data"]
1063#[doc = " @param err error pointer"]
1064#[doc = " @return true if macro has been parsed"]
1065pub type ucl_macro_handler = ::std::option::Option<
1066 unsafe extern "C" fn(
1067 data: *const ::std::os::raw::c_uchar,
1068 len: usize,
1069 arguments: *const ucl_object_t,
1070 ud: *mut ::std::os::raw::c_void,
1071 ) -> bool,
1072>;
1073#[doc = " Context dependent macro handler for a parser"]
1074#[doc = " @param data the content of macro"]
1075#[doc = " @param len the length of content"]
1076#[doc = " @param arguments arguments object"]
1077#[doc = " @param context previously parsed context"]
1078#[doc = " @param ud opaque user data"]
1079#[doc = " @param err error pointer"]
1080#[doc = " @return true if macro has been parsed"]
1081pub type ucl_context_macro_handler = ::std::option::Option<
1082 unsafe extern "C" fn(
1083 data: *const ::std::os::raw::c_uchar,
1084 len: usize,
1085 arguments: *const ucl_object_t,
1086 context: *const ucl_object_t,
1087 ud: *mut ::std::os::raw::c_void,
1088 ) -> bool,
1089>;
1090#[repr(C)]
1091#[derive(Debug, Copy, Clone)]
1092pub struct ucl_parser {
1093 _unused: [u8; 0],
1094}
1095extern "C" {
1096 #[doc = " Creates new parser object"]
1097 #[doc = " @param pool pool to allocate memory from"]
1098 #[doc = " @return new parser object"]
1099 pub fn ucl_parser_new(flags: ::std::os::raw::c_int) -> *mut ucl_parser;
1100}
1101extern "C" {
1102 #[doc = " Sets the default priority for the parser applied to chunks that do not"]
1103 #[doc = " specify priority explicitly"]
1104 #[doc = " @param parser parser object"]
1105 #[doc = " @param prio default priority (0 .. 16)"]
1106 #[doc = " @return true if parser's default priority was set"]
1107 pub fn ucl_parser_set_default_priority(
1108 parser: *mut ucl_parser,
1109 prio: ::std::os::raw::c_uint,
1110 ) -> bool;
1111}
1112extern "C" {
1113 #[doc = " Gets the default priority for the parser applied to chunks that do not"]
1114 #[doc = " specify priority explicitly"]
1115 #[doc = " @param parser parser object"]
1116 #[doc = " @return true default priority (0 .. 16), -1 for failure"]
1117 pub fn ucl_parser_get_default_priority(parser: *mut ucl_parser) -> ::std::os::raw::c_int;
1118}
1119extern "C" {
1120 #[doc = " Register new handler for a macro"]
1121 #[doc = " @param parser parser object"]
1122 #[doc = " @param macro macro name (without leading dot)"]
1123 #[doc = " @param handler handler (it is called immediately after macro is parsed)"]
1124 #[doc = " @param ud opaque user data for a handler"]
1125 pub fn ucl_parser_register_macro(
1126 parser: *mut ucl_parser,
1127 macro_: *const ::std::os::raw::c_char,
1128 handler: ucl_macro_handler,
1129 ud: *mut ::std::os::raw::c_void,
1130 );
1131}
1132extern "C" {
1133 #[doc = " Register new context dependent handler for a macro"]
1134 #[doc = " @param parser parser object"]
1135 #[doc = " @param macro macro name (without leading dot)"]
1136 #[doc = " @param handler handler (it is called immediately after macro is parsed)"]
1137 #[doc = " @param ud opaque user data for a handler"]
1138 pub fn ucl_parser_register_context_macro(
1139 parser: *mut ucl_parser,
1140 macro_: *const ::std::os::raw::c_char,
1141 handler: ucl_context_macro_handler,
1142 ud: *mut ::std::os::raw::c_void,
1143 );
1144}
1145#[doc = " Handler to detect unregistered variables"]
1146#[doc = " @param data variable data"]
1147#[doc = " @param len length of variable"]
1148#[doc = " @param replace (out) replace value for variable"]
1149#[doc = " @param replace_len (out) replace length for variable"]
1150#[doc = " @param need_free (out) UCL will free `dest` after usage"]
1151#[doc = " @param ud opaque userdata"]
1152#[doc = " @return true if variable"]
1153pub type ucl_variable_handler = ::std::option::Option<
1154 unsafe extern "C" fn(
1155 data: *const ::std::os::raw::c_uchar,
1156 len: usize,
1157 replace: *mut *mut ::std::os::raw::c_uchar,
1158 replace_len: *mut usize,
1159 need_free: *mut bool,
1160 ud: *mut ::std::os::raw::c_void,
1161 ) -> bool,
1162>;
1163extern "C" {
1164 #[doc = " Register new parser variable"]
1165 #[doc = " @param parser parser object"]
1166 #[doc = " @param var variable name"]
1167 #[doc = " @param value variable value"]
1168 pub fn ucl_parser_register_variable(
1169 parser: *mut ucl_parser,
1170 var: *const ::std::os::raw::c_char,
1171 value: *const ::std::os::raw::c_char,
1172 );
1173}
1174extern "C" {
1175 #[doc = " Set handler for unknown variables"]
1176 #[doc = " @param parser parser structure"]
1177 #[doc = " @param handler desired handler"]
1178 #[doc = " @param ud opaque data for the handler"]
1179 pub fn ucl_parser_set_variables_handler(
1180 parser: *mut ucl_parser,
1181 handler: ucl_variable_handler,
1182 ud: *mut ::std::os::raw::c_void,
1183 );
1184}
1185extern "C" {
1186 #[doc = " Load new chunk to a parser"]
1187 #[doc = " @param parser parser structure"]
1188 #[doc = " @param data the pointer to the beginning of a chunk"]
1189 #[doc = " @param len the length of a chunk"]
1190 #[doc = " @return true if chunk has been added and false in case of error"]
1191 pub fn ucl_parser_add_chunk(
1192 parser: *mut ucl_parser,
1193 data: *const ::std::os::raw::c_uchar,
1194 len: usize,
1195 ) -> bool;
1196}
1197extern "C" {
1198 #[doc = " Load new chunk to a parser with the specified priority"]
1199 #[doc = " @param parser parser structure"]
1200 #[doc = " @param data the pointer to the beginning of a chunk"]
1201 #[doc = " @param len the length of a chunk"]
1202 #[doc = " @param priority the desired priority of a chunk (only 4 least significant bits"]
1203 #[doc = " are considered for this parameter)"]
1204 #[doc = " @return true if chunk has been added and false in case of error"]
1205 pub fn ucl_parser_add_chunk_priority(
1206 parser: *mut ucl_parser,
1207 data: *const ::std::os::raw::c_uchar,
1208 len: usize,
1209 priority: ::std::os::raw::c_uint,
1210 ) -> bool;
1211}
1212extern "C" {
1213 #[doc = " Insert new chunk to a parser (must have previously processed data with an existing top object)"]
1214 #[doc = " @param parser parser structure"]
1215 #[doc = " @param data the pointer to the beginning of a chunk"]
1216 #[doc = " @param len the length of a chunk"]
1217 #[doc = " @return true if chunk has been added and false in case of error"]
1218 pub fn ucl_parser_insert_chunk(
1219 parser: *mut ucl_parser,
1220 data: *const ::std::os::raw::c_uchar,
1221 len: usize,
1222 ) -> bool;
1223}
1224extern "C" {
1225 #[doc = " Full version of ucl_add_chunk with priority and duplicate strategy"]
1226 #[doc = " @param parser parser structure"]
1227 #[doc = " @param data the pointer to the beginning of a chunk"]
1228 #[doc = " @param len the length of a chunk"]
1229 #[doc = " @param priority the desired priority of a chunk (only 4 least significant bits"]
1230 #[doc = " are considered for this parameter)"]
1231 #[doc = " @param strat duplicates merging strategy"]
1232 #[doc = " @param parse_type input format"]
1233 #[doc = " @return true if chunk has been added and false in case of error"]
1234 pub fn ucl_parser_add_chunk_full(
1235 parser: *mut ucl_parser,
1236 data: *const ::std::os::raw::c_uchar,
1237 len: usize,
1238 priority: ::std::os::raw::c_uint,
1239 strat: ucl_duplicate_strategy,
1240 parse_type: ucl_parse_type,
1241 ) -> bool;
1242}
1243extern "C" {
1244 #[doc = " Load ucl object from a string"]
1245 #[doc = " @param parser parser structure"]
1246 #[doc = " @param data the pointer to the string"]
1247 #[doc = " @param len the length of the string, if `len` is 0 then `data` must be zero-terminated string"]
1248 #[doc = " @return true if string has been added and false in case of error"]
1249 pub fn ucl_parser_add_string(
1250 parser: *mut ucl_parser,
1251 data: *const ::std::os::raw::c_char,
1252 len: usize,
1253 ) -> bool;
1254}
1255extern "C" {
1256 #[doc = " Load ucl object from a string"]
1257 #[doc = " @param parser parser structure"]
1258 #[doc = " @param data the pointer to the string"]
1259 #[doc = " @param len the length of the string, if `len` is 0 then `data` must be zero-terminated string"]
1260 #[doc = " @param priority the desired priority of a chunk (only 4 least significant bits"]
1261 #[doc = " are considered for this parameter)"]
1262 #[doc = " @return true if string has been added and false in case of error"]
1263 pub fn ucl_parser_add_string_priority(
1264 parser: *mut ucl_parser,
1265 data: *const ::std::os::raw::c_char,
1266 len: usize,
1267 priority: ::std::os::raw::c_uint,
1268 ) -> bool;
1269}
1270extern "C" {
1271 #[doc = " Load and add data from a file"]
1272 #[doc = " @param parser parser structure"]
1273 #[doc = " @param filename the name of file"]
1274 #[doc = " @param err if *err is NULL it is set to parser error"]
1275 #[doc = " @return true if chunk has been added and false in case of error"]
1276 pub fn ucl_parser_add_file(
1277 parser: *mut ucl_parser,
1278 filename: *const ::std::os::raw::c_char,
1279 ) -> bool;
1280}
1281extern "C" {
1282 #[doc = " Load and add data from a file"]
1283 #[doc = " @param parser parser structure"]
1284 #[doc = " @param filename the name of file"]
1285 #[doc = " @param err if *err is NULL it is set to parser error"]
1286 #[doc = " @param priority the desired priority of a chunk (only 4 least significant bits"]
1287 #[doc = " are considered for this parameter)"]
1288 #[doc = " @return true if chunk has been added and false in case of error"]
1289 pub fn ucl_parser_add_file_priority(
1290 parser: *mut ucl_parser,
1291 filename: *const ::std::os::raw::c_char,
1292 priority: ::std::os::raw::c_uint,
1293 ) -> bool;
1294}
1295extern "C" {
1296 #[doc = " Load and add data from a file"]
1297 #[doc = " @param parser parser structure"]
1298 #[doc = " @param filename the name of file"]
1299 #[doc = " @param priority the desired priority of a chunk (only 4 least significant bits"]
1300 #[doc = " are considered for this parameter)"]
1301 #[doc = " @param strat Merge strategy to use while parsing this file"]
1302 #[doc = " @param parse_type Parser type to use while parsing this file"]
1303 #[doc = " @return true if chunk has been added and false in case of error"]
1304 pub fn ucl_parser_add_file_full(
1305 parser: *mut ucl_parser,
1306 filename: *const ::std::os::raw::c_char,
1307 priority: ::std::os::raw::c_uint,
1308 strat: ucl_duplicate_strategy,
1309 parse_type: ucl_parse_type,
1310 ) -> bool;
1311}
1312extern "C" {
1313 #[doc = " Load and add data from a file descriptor"]
1314 #[doc = " @param parser parser structure"]
1315 #[doc = " @param filename the name of file"]
1316 #[doc = " @param err if *err is NULL it is set to parser error"]
1317 #[doc = " @return true if chunk has been added and false in case of error"]
1318 pub fn ucl_parser_add_fd(parser: *mut ucl_parser, fd: ::std::os::raw::c_int) -> bool;
1319}
1320extern "C" {
1321 #[doc = " Load and add data from a file descriptor"]
1322 #[doc = " @param parser parser structure"]
1323 #[doc = " @param filename the name of file"]
1324 #[doc = " @param err if *err is NULL it is set to parser error"]
1325 #[doc = " @param priority the desired priority of a chunk (only 4 least significant bits"]
1326 #[doc = " are considered for this parameter)"]
1327 #[doc = " @return true if chunk has been added and false in case of error"]
1328 pub fn ucl_parser_add_fd_priority(
1329 parser: *mut ucl_parser,
1330 fd: ::std::os::raw::c_int,
1331 priority: ::std::os::raw::c_uint,
1332 ) -> bool;
1333}
1334extern "C" {
1335 #[doc = " Load and add data from a file descriptor"]
1336 #[doc = " @param parser parser structure"]
1337 #[doc = " @param filename the name of file"]
1338 #[doc = " @param err if *err is NULL it is set to parser error"]
1339 #[doc = " @param priority the desired priority of a chunk (only 4 least significant bits"]
1340 #[doc = " are considered for this parameter)"]
1341 #[doc = " @param strat Merge strategy to use while parsing this file"]
1342 #[doc = " @param parse_type Parser type to use while parsing this file"]
1343 #[doc = " @return true if chunk has been added and false in case of error"]
1344 pub fn ucl_parser_add_fd_full(
1345 parser: *mut ucl_parser,
1346 fd: ::std::os::raw::c_int,
1347 priority: ::std::os::raw::c_uint,
1348 strat: ucl_duplicate_strategy,
1349 parse_type: ucl_parse_type,
1350 ) -> bool;
1351}
1352extern "C" {
1353 #[doc = " Provide a UCL_ARRAY of paths to search for include files. The object is"]
1354 #[doc = " copied so caller must unref the object."]
1355 #[doc = " @param parser parser structure"]
1356 #[doc = " @param paths UCL_ARRAY of paths to search"]
1357 #[doc = " @return true if the path search array was replaced in the parser"]
1358 pub fn ucl_set_include_path(parser: *mut ucl_parser, paths: *mut ucl_object_t) -> bool;
1359}
1360extern "C" {
1361 #[doc = " Get a top object for a parser (refcount is increased)"]
1362 #[doc = " @param parser parser structure"]
1363 #[doc = " @param err if *err is NULL it is set to parser error"]
1364 #[doc = " @return top parser object or NULL"]
1365 pub fn ucl_parser_get_object(parser: *mut ucl_parser) -> *mut ucl_object_t;
1366}
1367extern "C" {
1368 #[doc = " Get the current stack object as stack accessor function for use in macro"]
1369 #[doc = " functions (refcount is increased)"]
1370 #[doc = " @param parser parser object"]
1371 #[doc = " @param depth depth of stack to retrieve (top is 0)"]
1372 #[doc = " @return current stack object or NULL"]
1373 pub fn ucl_parser_get_current_stack_object(
1374 parser: *mut ucl_parser,
1375 depth: ::std::os::raw::c_uint,
1376 ) -> *mut ucl_object_t;
1377}
1378extern "C" {
1379 #[doc = " Peek at the character at the current chunk position"]
1380 #[doc = " @param parser parser structure"]
1381 #[doc = " @return current chunk position character"]
1382 pub fn ucl_parser_chunk_peek(parser: *mut ucl_parser) -> ::std::os::raw::c_uchar;
1383}
1384extern "C" {
1385 #[doc = " Skip the character at the current chunk position"]
1386 #[doc = " @param parser parser structure"]
1387 #[doc = " @return success boolean"]
1388 pub fn ucl_parser_chunk_skip(parser: *mut ucl_parser) -> bool;
1389}
1390extern "C" {
1391 #[doc = " Get the error string if parsing has been failed"]
1392 #[doc = " @param parser parser object"]
1393 #[doc = " @return error description"]
1394 pub fn ucl_parser_get_error(parser: *mut ucl_parser) -> *const ::std::os::raw::c_char;
1395}
1396extern "C" {
1397 #[doc = " Get the code of the last error"]
1398 #[doc = " @param parser parser object"]
1399 #[doc = " @return error code"]
1400 pub fn ucl_parser_get_error_code(parser: *mut ucl_parser) -> ::std::os::raw::c_int;
1401}
1402extern "C" {
1403 #[doc = " Get the current column number within parser"]
1404 #[doc = " @param parser parser object"]
1405 #[doc = " @return current column number"]
1406 pub fn ucl_parser_get_column(parser: *mut ucl_parser) -> ::std::os::raw::c_uint;
1407}
1408extern "C" {
1409 #[doc = " Get the current line number within parser"]
1410 #[doc = " @param parser parser object"]
1411 #[doc = " @return current line number"]
1412 pub fn ucl_parser_get_linenum(parser: *mut ucl_parser) -> ::std::os::raw::c_uint;
1413}
1414extern "C" {
1415 #[doc = " Clear the error in the parser"]
1416 #[doc = " @param parser parser object"]
1417 pub fn ucl_parser_clear_error(parser: *mut ucl_parser);
1418}
1419extern "C" {
1420 #[doc = " Free ucl parser object"]
1421 #[doc = " @param parser parser object"]
1422 pub fn ucl_parser_free(parser: *mut ucl_parser);
1423}
1424extern "C" {
1425 #[doc = " Get constant opaque pointer to comments structure for this parser. Increase"]
1426 #[doc = " refcount to prevent this object to be destroyed on parser's destruction"]
1427 #[doc = " @param parser parser structure"]
1428 #[doc = " @return ucl comments pointer or NULL"]
1429 pub fn ucl_parser_get_comments(parser: *mut ucl_parser) -> *const ucl_object_t;
1430}
1431extern "C" {
1432 #[doc = " Utility function to find a comment object for the specified object in the input"]
1433 #[doc = " @param comments comments object"]
1434 #[doc = " @param srch search object"]
1435 #[doc = " @return string comment enclosed in ucl_object_t"]
1436 pub fn ucl_comments_find(
1437 comments: *const ucl_object_t,
1438 srch: *const ucl_object_t,
1439 ) -> *const ucl_object_t;
1440}
1441extern "C" {
1442 #[doc = " Move comment from `from` object to `to` object"]
1443 #[doc = " @param comments comments object"]
1444 #[doc = " @param what source object"]
1445 #[doc = " @param with destination object"]
1446 #[doc = " @return `true` if `from` has comment and it has been moved to `to`"]
1447 pub fn ucl_comments_move(
1448 comments: *mut ucl_object_t,
1449 from: *const ucl_object_t,
1450 to: *const ucl_object_t,
1451 ) -> bool;
1452}
1453extern "C" {
1454 #[doc = " Adds a new comment for an object"]
1455 #[doc = " @param comments comments object"]
1456 #[doc = " @param obj object to add comment to"]
1457 #[doc = " @param comment string representation of a comment"]
1458 pub fn ucl_comments_add(
1459 comments: *mut ucl_object_t,
1460 obj: *const ucl_object_t,
1461 comment: *const ::std::os::raw::c_char,
1462 );
1463}
1464extern "C" {
1465 #[doc = " Add new public key to parser for signatures check"]
1466 #[doc = " @param parser parser object"]
1467 #[doc = " @param key PEM representation of a key"]
1468 #[doc = " @param len length of the key"]
1469 #[doc = " @param err if *err is NULL it is set to parser error"]
1470 #[doc = " @return true if a key has been successfully added"]
1471 pub fn ucl_parser_pubkey_add(
1472 parser: *mut ucl_parser,
1473 key: *const ::std::os::raw::c_uchar,
1474 len: usize,
1475 ) -> bool;
1476}
1477extern "C" {
1478 #[doc = " Set FILENAME and CURDIR variables in parser"]
1479 #[doc = " @param parser parser object"]
1480 #[doc = " @param filename filename to set or NULL to set FILENAME to \"undef\" and CURDIR to getcwd()"]
1481 #[doc = " @param need_expand perform realpath() if this variable is true and filename is not NULL"]
1482 #[doc = " @return true if variables has been set"]
1483 pub fn ucl_parser_set_filevars(
1484 parser: *mut ucl_parser,
1485 filename: *const ::std::os::raw::c_char,
1486 need_expand: bool,
1487 ) -> bool;
1488}
1489#[doc = " Structure using for emitter callbacks"]
1490#[repr(C)]
1491#[derive(Debug, Copy, Clone)]
1492pub struct ucl_emitter_functions {
1493 #[doc = " Append a single character"]
1494 pub ucl_emitter_append_character: ::std::option::Option<
1495 unsafe extern "C" fn(
1496 c: ::std::os::raw::c_uchar,
1497 nchars: usize,
1498 ud: *mut ::std::os::raw::c_void,
1499 ) -> ::std::os::raw::c_int,
1500 >,
1501 #[doc = " Append a string of a specified length"]
1502 pub ucl_emitter_append_len: ::std::option::Option<
1503 unsafe extern "C" fn(
1504 str: *const ::std::os::raw::c_uchar,
1505 len: usize,
1506 ud: *mut ::std::os::raw::c_void,
1507 ) -> ::std::os::raw::c_int,
1508 >,
1509 #[doc = " Append a 64 bit integer"]
1510 pub ucl_emitter_append_int: ::std::option::Option<
1511 unsafe extern "C" fn(elt: i64, ud: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int,
1512 >,
1513 #[doc = " Append floating point element"]
1514 pub ucl_emitter_append_double: ::std::option::Option<
1515 unsafe extern "C" fn(elt: f64, ud: *mut ::std::os::raw::c_void) -> ::std::os::raw::c_int,
1516 >,
1517 #[doc = " Free userdata"]
1518 pub ucl_emitter_free_func:
1519 ::std::option::Option<unsafe extern "C" fn(ud: *mut ::std::os::raw::c_void)>,
1520 #[doc = " Opaque userdata pointer"]
1521 pub ud: *mut ::std::os::raw::c_void,
1522}
1523#[test]
1524fn bindgen_test_layout_ucl_emitter_functions() {
1525 assert_eq!(
1526 ::std::mem::size_of::<ucl_emitter_functions>(),
1527 48usize,
1528 concat!("Size of: ", stringify!(ucl_emitter_functions))
1529 );
1530 assert_eq!(
1531 ::std::mem::align_of::<ucl_emitter_functions>(),
1532 8usize,
1533 concat!("Alignment of ", stringify!(ucl_emitter_functions))
1534 );
1535 assert_eq!(
1536 unsafe {
1537 &(*(::std::ptr::null::<ucl_emitter_functions>())).ucl_emitter_append_character
1538 as *const _ as usize
1539 },
1540 0usize,
1541 concat!(
1542 "Offset of field: ",
1543 stringify!(ucl_emitter_functions),
1544 "::",
1545 stringify!(ucl_emitter_append_character)
1546 )
1547 );
1548 assert_eq!(
1549 unsafe {
1550 &(*(::std::ptr::null::<ucl_emitter_functions>())).ucl_emitter_append_len as *const _
1551 as usize
1552 },
1553 8usize,
1554 concat!(
1555 "Offset of field: ",
1556 stringify!(ucl_emitter_functions),
1557 "::",
1558 stringify!(ucl_emitter_append_len)
1559 )
1560 );
1561 assert_eq!(
1562 unsafe {
1563 &(*(::std::ptr::null::<ucl_emitter_functions>())).ucl_emitter_append_int as *const _
1564 as usize
1565 },
1566 16usize,
1567 concat!(
1568 "Offset of field: ",
1569 stringify!(ucl_emitter_functions),
1570 "::",
1571 stringify!(ucl_emitter_append_int)
1572 )
1573 );
1574 assert_eq!(
1575 unsafe {
1576 &(*(::std::ptr::null::<ucl_emitter_functions>())).ucl_emitter_append_double as *const _
1577 as usize
1578 },
1579 24usize,
1580 concat!(
1581 "Offset of field: ",
1582 stringify!(ucl_emitter_functions),
1583 "::",
1584 stringify!(ucl_emitter_append_double)
1585 )
1586 );
1587 assert_eq!(
1588 unsafe {
1589 &(*(::std::ptr::null::<ucl_emitter_functions>())).ucl_emitter_free_func as *const _
1590 as usize
1591 },
1592 32usize,
1593 concat!(
1594 "Offset of field: ",
1595 stringify!(ucl_emitter_functions),
1596 "::",
1597 stringify!(ucl_emitter_free_func)
1598 )
1599 );
1600 assert_eq!(
1601 unsafe { &(*(::std::ptr::null::<ucl_emitter_functions>())).ud as *const _ as usize },
1602 40usize,
1603 concat!(
1604 "Offset of field: ",
1605 stringify!(ucl_emitter_functions),
1606 "::",
1607 stringify!(ud)
1608 )
1609 );
1610}
1611#[repr(C)]
1612#[derive(Debug, Copy, Clone)]
1613pub struct ucl_emitter_operations {
1614 #[doc = " Write a primitive element"]
1615 pub ucl_emitter_write_elt: ::std::option::Option<
1616 unsafe extern "C" fn(
1617 ctx: *mut ucl_emitter_context,
1618 obj: *const ucl_object_t,
1619 first: bool,
1620 print_key: bool,
1621 ),
1622 >,
1623 #[doc = " Start ucl object"]
1624 pub ucl_emitter_start_object: ::std::option::Option<
1625 unsafe extern "C" fn(
1626 ctx: *mut ucl_emitter_context,
1627 obj: *const ucl_object_t,
1628 print_key: bool,
1629 ),
1630 >,
1631 #[doc = " End ucl object"]
1632 pub ucl_emitter_end_object: ::std::option::Option<
1633 unsafe extern "C" fn(ctx: *mut ucl_emitter_context, obj: *const ucl_object_t),
1634 >,
1635 #[doc = " Start ucl array"]
1636 pub ucl_emitter_start_array: ::std::option::Option<
1637 unsafe extern "C" fn(
1638 ctx: *mut ucl_emitter_context,
1639 obj: *const ucl_object_t,
1640 print_key: bool,
1641 ),
1642 >,
1643 pub ucl_emitter_end_array: ::std::option::Option<
1644 unsafe extern "C" fn(ctx: *mut ucl_emitter_context, obj: *const ucl_object_t),
1645 >,
1646}
1647#[test]
1648fn bindgen_test_layout_ucl_emitter_operations() {
1649 assert_eq!(
1650 ::std::mem::size_of::<ucl_emitter_operations>(),
1651 40usize,
1652 concat!("Size of: ", stringify!(ucl_emitter_operations))
1653 );
1654 assert_eq!(
1655 ::std::mem::align_of::<ucl_emitter_operations>(),
1656 8usize,
1657 concat!("Alignment of ", stringify!(ucl_emitter_operations))
1658 );
1659 assert_eq!(
1660 unsafe {
1661 &(*(::std::ptr::null::<ucl_emitter_operations>())).ucl_emitter_write_elt as *const _
1662 as usize
1663 },
1664 0usize,
1665 concat!(
1666 "Offset of field: ",
1667 stringify!(ucl_emitter_operations),
1668 "::",
1669 stringify!(ucl_emitter_write_elt)
1670 )
1671 );
1672 assert_eq!(
1673 unsafe {
1674 &(*(::std::ptr::null::<ucl_emitter_operations>())).ucl_emitter_start_object as *const _
1675 as usize
1676 },
1677 8usize,
1678 concat!(
1679 "Offset of field: ",
1680 stringify!(ucl_emitter_operations),
1681 "::",
1682 stringify!(ucl_emitter_start_object)
1683 )
1684 );
1685 assert_eq!(
1686 unsafe {
1687 &(*(::std::ptr::null::<ucl_emitter_operations>())).ucl_emitter_end_object as *const _
1688 as usize
1689 },
1690 16usize,
1691 concat!(
1692 "Offset of field: ",
1693 stringify!(ucl_emitter_operations),
1694 "::",
1695 stringify!(ucl_emitter_end_object)
1696 )
1697 );
1698 assert_eq!(
1699 unsafe {
1700 &(*(::std::ptr::null::<ucl_emitter_operations>())).ucl_emitter_start_array as *const _
1701 as usize
1702 },
1703 24usize,
1704 concat!(
1705 "Offset of field: ",
1706 stringify!(ucl_emitter_operations),
1707 "::",
1708 stringify!(ucl_emitter_start_array)
1709 )
1710 );
1711 assert_eq!(
1712 unsafe {
1713 &(*(::std::ptr::null::<ucl_emitter_operations>())).ucl_emitter_end_array as *const _
1714 as usize
1715 },
1716 32usize,
1717 concat!(
1718 "Offset of field: ",
1719 stringify!(ucl_emitter_operations),
1720 "::",
1721 stringify!(ucl_emitter_end_array)
1722 )
1723 );
1724}
1725#[doc = " @defgroup emitter Emitting functions"]
1726#[doc = " These functions are used to serialise UCL objects to some string representation."]
1727#[doc = ""]
1728#[doc = " @{"]
1729#[repr(C)]
1730#[derive(Debug, Copy, Clone)]
1731pub struct ucl_emitter_context {
1732 #[doc = " Name of emitter (e.g. json, compact_json)"]
1733 pub name: *const ::std::os::raw::c_char,
1734 #[doc = " Unique id (e.g. UCL_EMIT_JSON for standard emitters"]
1735 pub id: ::std::os::raw::c_int,
1736 #[doc = " A set of output functions"]
1737 pub func: *const ucl_emitter_functions,
1738 #[doc = " A set of output operations"]
1739 pub ops: *const ucl_emitter_operations,
1740 #[doc = " Current amount of indent tabs"]
1741 pub indent: ::std::os::raw::c_uint,
1742 #[doc = " Top level object"]
1743 pub top: *const ucl_object_t,
1744 #[doc = " Optional comments"]
1745 pub comments: *const ucl_object_t,
1746}
1747#[test]
1748fn bindgen_test_layout_ucl_emitter_context() {
1749 assert_eq!(
1750 ::std::mem::size_of::<ucl_emitter_context>(),
1751 56usize,
1752 concat!("Size of: ", stringify!(ucl_emitter_context))
1753 );
1754 assert_eq!(
1755 ::std::mem::align_of::<ucl_emitter_context>(),
1756 8usize,
1757 concat!("Alignment of ", stringify!(ucl_emitter_context))
1758 );
1759 assert_eq!(
1760 unsafe { &(*(::std::ptr::null::<ucl_emitter_context>())).name as *const _ as usize },
1761 0usize,
1762 concat!(
1763 "Offset of field: ",
1764 stringify!(ucl_emitter_context),
1765 "::",
1766 stringify!(name)
1767 )
1768 );
1769 assert_eq!(
1770 unsafe { &(*(::std::ptr::null::<ucl_emitter_context>())).id as *const _ as usize },
1771 8usize,
1772 concat!(
1773 "Offset of field: ",
1774 stringify!(ucl_emitter_context),
1775 "::",
1776 stringify!(id)
1777 )
1778 );
1779 assert_eq!(
1780 unsafe { &(*(::std::ptr::null::<ucl_emitter_context>())).func as *const _ as usize },
1781 16usize,
1782 concat!(
1783 "Offset of field: ",
1784 stringify!(ucl_emitter_context),
1785 "::",
1786 stringify!(func)
1787 )
1788 );
1789 assert_eq!(
1790 unsafe { &(*(::std::ptr::null::<ucl_emitter_context>())).ops as *const _ as usize },
1791 24usize,
1792 concat!(
1793 "Offset of field: ",
1794 stringify!(ucl_emitter_context),
1795 "::",
1796 stringify!(ops)
1797 )
1798 );
1799 assert_eq!(
1800 unsafe { &(*(::std::ptr::null::<ucl_emitter_context>())).indent as *const _ as usize },
1801 32usize,
1802 concat!(
1803 "Offset of field: ",
1804 stringify!(ucl_emitter_context),
1805 "::",
1806 stringify!(indent)
1807 )
1808 );
1809 assert_eq!(
1810 unsafe { &(*(::std::ptr::null::<ucl_emitter_context>())).top as *const _ as usize },
1811 40usize,
1812 concat!(
1813 "Offset of field: ",
1814 stringify!(ucl_emitter_context),
1815 "::",
1816 stringify!(top)
1817 )
1818 );
1819 assert_eq!(
1820 unsafe { &(*(::std::ptr::null::<ucl_emitter_context>())).comments as *const _ as usize },
1821 48usize,
1822 concat!(
1823 "Offset of field: ",
1824 stringify!(ucl_emitter_context),
1825 "::",
1826 stringify!(comments)
1827 )
1828 );
1829}
1830extern "C" {
1831 #[doc = " Emit object to a string"]
1832 #[doc = " @param obj object"]
1833 #[doc = " @param emit_type if type is #UCL_EMIT_JSON then emit json, if type is"]
1834 #[doc = " #UCL_EMIT_CONFIG then emit config like object"]
1835 #[doc = " @return dump of an object (must be freed after using) or NULL in case of error"]
1836 pub fn ucl_object_emit(
1837 obj: *const ucl_object_t,
1838 emit_type: ucl_emitter,
1839 ) -> *mut ::std::os::raw::c_uchar;
1840}
1841extern "C" {
1842 #[doc = " Emit object to a string that can contain `\\0` inside"]
1843 #[doc = " @param obj object"]
1844 #[doc = " @param emit_type if type is #UCL_EMIT_JSON then emit json, if type is"]
1845 #[doc = " #UCL_EMIT_CONFIG then emit config like object"]
1846 #[doc = " @param len the resulting length"]
1847 #[doc = " @return dump of an object (must be freed after using) or NULL in case of error"]
1848 pub fn ucl_object_emit_len(
1849 obj: *const ucl_object_t,
1850 emit_type: ucl_emitter,
1851 len: *mut usize,
1852 ) -> *mut ::std::os::raw::c_uchar;
1853}
1854extern "C" {
1855 #[doc = " Emit object to a string"]
1856 #[doc = " @param obj object"]
1857 #[doc = " @param emit_type if type is #UCL_EMIT_JSON then emit json, if type is"]
1858 #[doc = " #UCL_EMIT_CONFIG then emit config like object"]
1859 #[doc = " @param emitter a set of emitter functions"]
1860 #[doc = " @param comments optional comments for the parser"]
1861 #[doc = " @return dump of an object (must be freed after using) or NULL in case of error"]
1862 pub fn ucl_object_emit_full(
1863 obj: *const ucl_object_t,
1864 emit_type: ucl_emitter,
1865 emitter: *mut ucl_emitter_functions,
1866 comments: *const ucl_object_t,
1867 ) -> bool;
1868}
1869extern "C" {
1870 #[doc = " Start streamlined UCL object emitter"]
1871 #[doc = " @param obj top UCL object"]
1872 #[doc = " @param emit_type emit type"]
1873 #[doc = " @param emitter a set of emitter functions"]
1874 #[doc = " @return new streamlined context that should be freed by"]
1875 #[doc = " `ucl_object_emit_streamline_finish`"]
1876 pub fn ucl_object_emit_streamline_new(
1877 obj: *const ucl_object_t,
1878 emit_type: ucl_emitter,
1879 emitter: *mut ucl_emitter_functions,
1880 ) -> *mut ucl_emitter_context;
1881}
1882extern "C" {
1883 #[doc = " Start object or array container for the streamlined output"]
1884 #[doc = " @param ctx streamlined context"]
1885 #[doc = " @param obj container object"]
1886 pub fn ucl_object_emit_streamline_start_container(
1887 ctx: *mut ucl_emitter_context,
1888 obj: *const ucl_object_t,
1889 );
1890}
1891extern "C" {
1892 #[doc = " Add a complete UCL object to streamlined output"]
1893 #[doc = " @param ctx streamlined context"]
1894 #[doc = " @param obj object to output"]
1895 pub fn ucl_object_emit_streamline_add_object(
1896 ctx: *mut ucl_emitter_context,
1897 obj: *const ucl_object_t,
1898 );
1899}
1900extern "C" {
1901 #[doc = " End previously added container"]
1902 #[doc = " @param ctx streamlined context"]
1903 pub fn ucl_object_emit_streamline_end_container(ctx: *mut ucl_emitter_context);
1904}
1905extern "C" {
1906 #[doc = " Terminate streamlined container finishing all containers in it"]
1907 #[doc = " @param ctx streamlined context"]
1908 pub fn ucl_object_emit_streamline_finish(ctx: *mut ucl_emitter_context);
1909}
1910extern "C" {
1911 #[doc = " Returns functions to emit object to memory"]
1912 #[doc = " @param pmem target pointer (should be freed by caller)"]
1913 #[doc = " @return emitter functions structure"]
1914 pub fn ucl_object_emit_memory_funcs(
1915 pmem: *mut *mut ::std::os::raw::c_void,
1916 ) -> *mut ucl_emitter_functions;
1917}
1918extern "C" {
1919 #[doc = " Returns functions to emit object to a file descriptor"]
1920 #[doc = " @param fd file descriptor"]
1921 #[doc = " @return emitter functions structure"]
1922 pub fn ucl_object_emit_fd_funcs(fd: ::std::os::raw::c_int) -> *mut ucl_emitter_functions;
1923}
1924extern "C" {
1925 #[doc = " Free emitter functions"]
1926 #[doc = " @param f pointer to functions"]
1927 pub fn ucl_object_emit_funcs_free(f: *mut ucl_emitter_functions);
1928}
1929#[repr(u32)]
1930#[doc = " Used to define UCL schema error"]
1931#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
1932pub enum ucl_schema_error_code {
1933 #[doc = "< no error"]
1934 UCL_SCHEMA_OK = 0,
1935 #[doc = "< type of object is incorrect"]
1936 UCL_SCHEMA_TYPE_MISMATCH = 1,
1937 #[doc = "< schema is invalid"]
1938 UCL_SCHEMA_INVALID_SCHEMA = 2,
1939 #[doc = "< one or more missing properties"]
1940 UCL_SCHEMA_MISSING_PROPERTY = 3,
1941 #[doc = "< constraint found"]
1942 UCL_SCHEMA_CONSTRAINT = 4,
1943 #[doc = "< missing dependency"]
1944 UCL_SCHEMA_MISSING_DEPENDENCY = 5,
1945 #[doc = "< cannot fetch external ref"]
1946 UCL_SCHEMA_EXTERNAL_REF_MISSING = 6,
1947 #[doc = "< invalid external ref"]
1948 UCL_SCHEMA_EXTERNAL_REF_INVALID = 7,
1949 #[doc = "< something bad happened"]
1950 UCL_SCHEMA_INTERNAL_ERROR = 8,
1951 #[doc = "< generic error"]
1952 UCL_SCHEMA_UNKNOWN = 9,
1953}
1954#[doc = " Generic ucl schema error"]
1955#[repr(C)]
1956#[derive(Copy, Clone)]
1957pub struct ucl_schema_error {
1958 #[doc = "< error code"]
1959 pub code: ucl_schema_error_code,
1960 #[doc = "< error message"]
1961 pub msg: [::std::os::raw::c_char; 128usize],
1962 #[doc = "< object where error occurred"]
1963 pub obj: *const ucl_object_t,
1964}
1965#[test]
1966fn bindgen_test_layout_ucl_schema_error() {
1967 assert_eq!(
1968 ::std::mem::size_of::<ucl_schema_error>(),
1969 144usize,
1970 concat!("Size of: ", stringify!(ucl_schema_error))
1971 );
1972 assert_eq!(
1973 ::std::mem::align_of::<ucl_schema_error>(),
1974 8usize,
1975 concat!("Alignment of ", stringify!(ucl_schema_error))
1976 );
1977 assert_eq!(
1978 unsafe { &(*(::std::ptr::null::<ucl_schema_error>())).code as *const _ as usize },
1979 0usize,
1980 concat!(
1981 "Offset of field: ",
1982 stringify!(ucl_schema_error),
1983 "::",
1984 stringify!(code)
1985 )
1986 );
1987 assert_eq!(
1988 unsafe { &(*(::std::ptr::null::<ucl_schema_error>())).msg as *const _ as usize },
1989 4usize,
1990 concat!(
1991 "Offset of field: ",
1992 stringify!(ucl_schema_error),
1993 "::",
1994 stringify!(msg)
1995 )
1996 );
1997 assert_eq!(
1998 unsafe { &(*(::std::ptr::null::<ucl_schema_error>())).obj as *const _ as usize },
1999 136usize,
2000 concat!(
2001 "Offset of field: ",
2002 stringify!(ucl_schema_error),
2003 "::",
2004 stringify!(obj)
2005 )
2006 );
2007}
2008extern "C" {
2009 #[doc = " Validate object `obj` using schema object `schema`."]
2010 #[doc = " @param schema schema object"]
2011 #[doc = " @param obj object to validate"]
2012 #[doc = " @param err error pointer, if this parameter is not NULL and error has been"]
2013 #[doc = " occurred, then `err` is filled with the exact error definition."]
2014 #[doc = " @return true if `obj` is valid using `schema`"]
2015 pub fn ucl_object_validate(
2016 schema: *const ucl_object_t,
2017 obj: *const ucl_object_t,
2018 err: *mut ucl_schema_error,
2019 ) -> bool;
2020}
2021extern "C" {
2022 #[doc = " Validate object `obj` using schema object `schema` and root schema at `root`."]
2023 #[doc = " @param schema schema object"]
2024 #[doc = " @param obj object to validate"]
2025 #[doc = " @param root root schema object"]
2026 #[doc = " @param err error pointer, if this parameter is not NULL and error has been"]
2027 #[doc = " occurred, then `err` is filled with the exact error definition."]
2028 #[doc = " @return true if `obj` is valid using `schema`"]
2029 pub fn ucl_object_validate_root(
2030 schema: *const ucl_object_t,
2031 obj: *const ucl_object_t,
2032 root: *const ucl_object_t,
2033 err: *mut ucl_schema_error,
2034 ) -> bool;
2035}
2036extern "C" {
2037 #[doc = " Validate object `obj` using schema object `schema` and root schema at `root`"]
2038 #[doc = " using some external references provided."]
2039 #[doc = " @param schema schema object"]
2040 #[doc = " @param obj object to validate"]
2041 #[doc = " @param root root schema object"]
2042 #[doc = " @param ext_refs external references (might be modified during validation)"]
2043 #[doc = " @param err error pointer, if this parameter is not NULL and error has been"]
2044 #[doc = " occurred, then `err` is filled with the exact error definition."]
2045 #[doc = " @return true if `obj` is valid using `schema`"]
2046 pub fn ucl_object_validate_root_ext(
2047 schema: *const ucl_object_t,
2048 obj: *const ucl_object_t,
2049 root: *const ucl_object_t,
2050 ext_refs: *mut ucl_object_t,
2051 err: *mut ucl_schema_error,
2052 ) -> bool;
2053}
2054#[repr(C)]
2055#[derive(Debug, Copy, Clone)]
2056pub struct pthread_mutex {
2057 pub _address: u8,
2058}
2059#[repr(C)]
2060#[derive(Debug, Copy, Clone)]
2061pub struct pthread {
2062 pub _address: u8,
2063}