1use crate::libc;
2use core::ops::Deref;
3use core::ptr::{self, addr_of};
4
5pub(crate) use self::{
6 YamlEncodingT::*, YamlEventTypeT::*, YamlNodeTypeT::*,
7};
8pub use core::primitive::{
9 i64 as ptrdiff_t, u64 as size_t, u8 as yaml_char_t,
10};
11
12#[derive(Copy, Clone, Debug, Default)]
14#[repr(C)]
15#[non_exhaustive]
16pub struct YamlVersionDirectiveT {
17 pub major: libc::c_int,
19 pub minor: libc::c_int,
21}
22
23impl YamlVersionDirectiveT {
24 pub fn new(major: libc::c_int, minor: libc::c_int) -> Self {
26 YamlVersionDirectiveT {
27 major,
28 minor,
29 }
31 }
32}
33
34#[derive(Copy, Clone, Debug)]
36#[repr(C)]
37#[non_exhaustive]
38pub struct YamlTagDirectiveT {
39 pub handle: *mut yaml_char_t,
41 pub prefix: *mut yaml_char_t,
43}
44
45#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
47#[repr(u32)]
48#[non_exhaustive]
49pub enum YamlEncodingT {
50 YamlAnyEncoding = 0,
52 YamlUtf8Encoding = 1,
54 YamlUtf16leEncoding = 2,
56 YamlUtf16beEncoding = 3,
58}
59
60#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
62#[repr(u32)]
63#[non_exhaustive]
64pub enum YamlBreakT {
65 YamlAnyBreak = 0,
67 YamlCrBreak = 1,
69 YamlLnBreak = 2,
71 YamlCrlnBreak = 3,
73}
74
75#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
77#[repr(u32)]
78#[non_exhaustive]
79pub enum YamlErrorTypeT {
80 YamlNoError = 0,
82 YamlMemoryError = 1,
84 YamlReaderError = 2,
86 YamlScannerError = 3,
88 YamlParserError = 4,
90 YamlComposerError = 5,
92 YamlWriterError = 6,
94 YamlEmitterError = 7,
96}
97
98impl Default for YamlErrorTypeT {
99 fn default() -> Self {
100 YamlErrorTypeT::YamlNoError
101 }
102}
103
104#[derive(Copy, Clone, Debug, Default)]
106#[repr(C)]
107#[non_exhaustive]
108pub struct YamlMarkT {
109 pub index: size_t,
111 pub line: size_t,
113 pub column: size_t,
115}
116
117#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
119#[repr(u32)]
120#[non_exhaustive]
121pub enum YamlScalarStyleT {
122 YamlAnyScalarStyle = 0,
124 YamlPlainScalarStyle = 1,
126 YamlSingleQuotedScalarStyle = 2,
128 YamlDoubleQuotedScalarStyle = 3,
130 YamlLiteralScalarStyle = 4,
132 YamlFoldedScalarStyle = 5,
134}
135
136#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
138#[repr(u32)]
139#[non_exhaustive]
140pub enum YamlSequenceStyleT {
141 YamlAnySequenceStyle = 0,
143 YamlBlockSequenceStyle = 1,
145 YamlFlowSequenceStyle = 2,
147}
148
149#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
151#[repr(u32)]
152#[non_exhaustive]
153pub enum YamlMappingStyleT {
154 YamlAnyMappingStyle = 0,
156 YamlBlockMappingStyle = 1,
158 YamlFlowMappingStyle = 2,
160}
161
162#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
164#[repr(u32)]
165#[non_exhaustive]
166pub enum YamlTokenTypeT {
167 YamlNoToken = 0,
169 YamlStreamStartToken = 1,
171 YamlStreamEndToken = 2,
173 YamlVersionDirectiveToken = 3,
175 YamlTagDirectiveToken = 4,
177 YamlDocumentStartToken = 5,
179 YamlDocumentEndToken = 6,
181 YamlBlockSequenceStartToken = 7,
183 YamlBlockMappingStartToken = 8,
185 YamlBlockEndToken = 9,
187 YamlFlowSequenceStartToken = 10,
189 YamlFlowSequenceEndToken = 11,
191 YamlFlowMappingStartToken = 12,
193 YamlFlowMappingEndToken = 13,
195 YamlBlockEntryToken = 14,
197 YamlFlowEntryToken = 15,
199 YamlKeyToken = 16,
201 YamlValueToken = 17,
203 YamlAliasToken = 18,
205 YamlAnchorToken = 19,
207 YamlTagToken = 20,
209 YamlScalarToken = 21,
211}
212
213#[derive(Copy, Clone, Debug)]
215#[repr(C)]
216#[non_exhaustive]
217pub struct YamlTokenT {
218 pub type_: YamlTokenTypeT,
220 pub data: UnnamedYamlTokenTData,
222 pub start_mark: YamlMarkT,
224 pub end_mark: YamlMarkT,
226}
227
228#[derive(Copy, Clone, Debug, Default)]
229#[repr(C)]
230pub struct UnnamedYamlTokenTData {
232 pub stream_start: UnnamedYamlTokenTdataStreamStart,
234 pub alias: UnnamedYamlTokenTdataAlias,
236 pub anchor: UnnamedYamlTokenTdataAnchor,
238 pub tag: UnnamedYamlTokenTdataTag,
240 pub scalar: UnnamedYamlTokenTdataScalar,
242 pub version_directive: UnnamedYamlTokenTdataVersionDirective,
244 pub tag_directive: UnnamedYamlTokenTdataTagDirective,
246}
247
248#[derive(Copy, Clone, Debug)]
250#[repr(C)]
251#[non_exhaustive]
252pub struct UnnamedYamlTokenTdataStreamStart {
253 pub encoding: YamlEncodingT,
255}
256
257#[derive(Copy, Clone, Debug)]
259#[repr(C)]
260#[non_exhaustive]
261pub struct UnnamedYamlTokenTdataAlias {
262 pub value: *mut yaml_char_t,
264}
265
266#[derive(Copy, Clone, Debug)]
268#[repr(C)]
269#[non_exhaustive]
270pub struct UnnamedYamlTokenTdataAnchor {
271 pub value: *mut yaml_char_t,
273}
274
275#[derive(Copy, Clone, Debug)]
277#[repr(C)]
278#[non_exhaustive]
279pub struct UnnamedYamlTokenTdataTag {
280 pub handle: *mut yaml_char_t,
282 pub suffix: *mut yaml_char_t,
284}
285
286#[derive(Copy, Clone, Debug)]
288#[repr(C)]
289#[non_exhaustive]
290pub struct UnnamedYamlTokenTdataScalar {
291 pub value: *mut yaml_char_t,
293 pub length: size_t,
295 pub style: YamlScalarStyleT,
297}
298
299#[derive(Copy, Clone, Debug, Default)]
301#[repr(C)]
302#[non_exhaustive]
303pub struct UnnamedYamlTokenTdataVersionDirective {
304 pub major: libc::c_int,
306 pub minor: libc::c_int,
308}
309
310#[derive(Copy, Clone, Debug)]
312#[repr(C)]
313#[non_exhaustive]
314pub struct UnnamedYamlTokenTdataTagDirective {
315 pub handle: *mut yaml_char_t,
317 pub prefix: *mut yaml_char_t,
319}
320
321#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
323#[repr(u32)]
324#[non_exhaustive]
325pub enum YamlEventTypeT {
326 YamlNoEvent = 0,
328 YamlStreamStartEvent = 1,
330 YamlStreamEndEvent = 2,
332 YamlDocumentStartEvent = 3,
334 YamlDocumentEndEvent = 4,
336 YamlAliasEvent = 5,
338 YamlScalarEvent = 6,
340 YamlSequenceStartEvent = 7,
342 YamlSequenceEndEvent = 8,
344 YamlMappingStartEvent = 9,
346 YamlMappingEndEvent = 10,
348}
349
350#[derive(Copy, Clone, Debug)]
352#[repr(C)]
353#[non_exhaustive]
354pub struct YamlEventT {
355 pub type_: YamlEventTypeT,
357 pub data: UnnamedYamlEventTData,
359 pub start_mark: YamlMarkT,
361 pub end_mark: YamlMarkT,
363}
364
365#[derive(Copy, Clone, Debug)]
367#[repr(C)]
368pub struct UnnamedYamlEventTData {
369 pub stream_start: UnnamedYamlEventTdataStreamStart,
371 pub document_start: UnnamedYamlEventTdataDocumentStart,
373 pub document_end: UnnamedYamlEventTdataDocumentEnd,
375 pub alias: UnnamedYamlEventTdataAlias,
377 pub scalar: UnnamedYamlEventTdataScalar,
379 pub sequence_start: UnnamedYamlEventTdataSequenceStart,
381 pub mapping_start: UnnamedYamlEventTdataMappingStart,
383}
384
385#[derive(Copy, Clone, Debug)]
387#[repr(C)]
388#[non_exhaustive]
389pub struct UnnamedYamlEventTdataStreamStart {
390 pub encoding: YamlEncodingT,
392}
393
394#[derive(Copy, Clone, Debug)]
396#[repr(C)]
397#[non_exhaustive]
398pub struct UnnamedYamlEventTdataDocumentStart {
399 pub version_directive: *mut YamlVersionDirectiveT,
401 pub tag_directives: UnnamedYamlEventTdataDocumentStartTagDirectives,
403 pub implicit: bool,
405}
406
407#[derive(Copy, Clone, Debug)]
409#[repr(C)]
410#[non_exhaustive]
411pub struct UnnamedYamlEventTdataDocumentStartTagDirectives {
412 pub start: *mut YamlTagDirectiveT,
414 pub end: *mut YamlTagDirectiveT,
416}
417
418#[derive(Copy, Clone, Debug)]
420#[repr(C)]
421#[non_exhaustive]
422pub struct UnnamedYamlEventTdataDocumentEnd {
423 pub implicit: bool,
425}
426
427#[derive(Copy, Clone, Debug)]
429#[repr(C)]
430#[non_exhaustive]
431pub struct UnnamedYamlEventTdataAlias {
432 pub anchor: *mut yaml_char_t,
434}
435
436#[derive(Copy, Clone, Debug)]
438#[repr(C)]
439#[non_exhaustive]
440pub struct UnnamedYamlEventTdataScalar {
441 pub anchor: *mut yaml_char_t,
443 pub tag: *mut yaml_char_t,
445 pub value: *mut yaml_char_t,
447 pub length: size_t,
449 pub plain_implicit: bool,
451 pub quoted_implicit: bool,
453 pub style: YamlScalarStyleT,
455}
456
457#[derive(Copy, Clone, Debug)]
459#[repr(C)]
460#[non_exhaustive]
461pub struct UnnamedYamlEventTdataSequenceStart {
462 pub anchor: *mut yaml_char_t,
464 pub tag: *mut yaml_char_t,
466 pub implicit: bool,
468 pub style: YamlSequenceStyleT,
470}
471
472#[derive(Copy, Clone, Debug)]
474#[repr(C)]
475#[non_exhaustive]
476pub struct UnnamedYamlEventTdataMappingStart {
477 pub anchor: *mut yaml_char_t,
479 pub tag: *mut yaml_char_t,
481 pub implicit: bool,
483 pub style: YamlMappingStyleT,
485}
486
487#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
489#[repr(u32)]
490#[non_exhaustive]
491pub enum YamlNodeTypeT {
492 YamlNoNode = 0,
494 YamlScalarNode = 1,
496 YamlSequenceNode = 2,
498 YamlMappingNode = 3,
500}
501
502#[derive(Copy, Clone, Debug)]
504#[repr(C)]
505#[non_exhaustive]
506pub struct YamlNodeT {
507 pub type_: YamlNodeTypeT,
509 pub tag: *mut yaml_char_t,
511 pub data: UnnamedYamlNodeTData,
513 pub start_mark: YamlMarkT,
515 pub end_mark: YamlMarkT,
517}
518
519#[derive(Copy, Clone, Debug)]
521#[repr(C)]
522pub struct UnnamedYamlNodeTData {
523 pub scalar: UnnamedYamlNodeTDataScalar,
525 pub sequence: UnnamedYamlNodeTDataSequence,
527 pub mapping: UnnamedYamlNodeTDataMapping,
529}
530
531#[derive(Copy, Clone, Debug)]
533#[repr(C)]
534#[non_exhaustive]
535pub struct UnnamedYamlNodeTDataScalar {
536 pub value: *mut yaml_char_t,
538 pub length: size_t,
540 pub style: YamlScalarStyleT,
542}
543
544pub type YamlNodeItemT = libc::c_int;
546
547#[derive(Copy, Clone, Debug)]
549#[repr(C)]
550#[non_exhaustive]
551pub struct UnnamedYamlNodeTDataSequence {
552 pub items: YamlStackT<YamlNodeItemT>,
554 pub style: YamlSequenceStyleT,
556}
557
558#[derive(Copy, Clone, Debug)]
560#[repr(C)]
561#[non_exhaustive]
562pub struct UnnamedYamlNodeTDataMapping {
563 pub pairs: YamlStackT<YamlNodePairT>,
565 pub style: YamlMappingStyleT,
567}
568
569#[derive(Copy, Clone, Debug)]
571#[repr(C)]
572#[non_exhaustive]
573pub struct YamlNodePairT {
574 pub key: libc::c_int,
576 pub value: libc::c_int,
578}
579
580#[derive(Clone, Debug)]
582#[repr(C)]
583#[non_exhaustive]
584pub struct YamlDocumentT {
585 pub nodes: YamlStackT<YamlNodeT>,
587 pub version_directive: *mut YamlVersionDirectiveT,
589 pub tag_directives: UnnamedYamlDocumentTTagDirectives,
591 pub start_implicit: bool,
593 pub end_implicit: bool,
595 pub start_mark: YamlMarkT,
597 pub end_mark: YamlMarkT,
599}
600
601#[derive(Copy, Clone, Debug)]
603#[repr(C)]
604#[non_exhaustive]
605pub struct UnnamedYamlDocumentTTagDirectives {
606 pub start: *mut YamlTagDirectiveT,
608 pub end: *mut YamlTagDirectiveT,
610}
611
612pub type YamlReadHandlerT = unsafe fn(
622 data: *mut libc::c_void,
623 buffer: *mut libc::c_uchar,
624 size: size_t,
625 size_read: *mut size_t,
626) -> libc::c_int;
627
628#[derive(Copy, Clone, Debug, Default)]
630#[repr(C)]
631#[non_exhaustive]
632pub struct YamlSimpleKeyT {
633 pub possible: bool,
635 pub required: bool,
637 pub token_number: size_t,
639 pub mark: YamlMarkT,
641}
642
643#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
645#[repr(u32)]
646#[non_exhaustive]
647pub enum YamlParserStateT {
648 YamlParseStreamStartState = 0,
650 YamlParseImplicitDocumentStartState = 1,
652 YamlParseDocumentStartState = 2,
654 YamlParseDocumentContentState = 3,
656 YamlParseDocumentEndState = 4,
658 YamlParseBlockNodeState = 5,
660 YamlParseBlockNodeOrIndentlessSequenceState = 6,
662 YamlParseFlowNodeState = 7,
664 YamlParseBlockSequenceFirstEntryState = 8,
666 YamlParseBlockSequenceEntryState = 9,
668 YamlParseIndentlessSequenceEntryState = 10,
670 YamlParseBlockMappingFirstKeyState = 11,
672 YamlParseBlockMappingKeyState = 12,
674 YamlParseBlockMappingValueState = 13,
676 YamlParseFlowSequenceFirstEntryState = 14,
678 YamlParseFlowSequenceEntryState = 15,
680 YamlParseFlowSequenceEntryMappingKeyState = 16,
682 YamlParseFlowSequenceEntryMappingValueState = 17,
684 YamlParseFlowSequenceEntryMappingEndState = 18,
686 YamlParseFlowMappingFirstKeyState = 19,
688 YamlParseFlowMappingKeyState = 20,
690 YamlParseFlowMappingValueState = 21,
692 YamlParseFlowMappingEmptyValueState = 22,
694 YamlParseEndState = 23,
696}
697
698#[derive(Copy, Clone, Debug)]
700#[repr(C)]
701#[non_exhaustive]
702pub struct YamlAliasDataT {
703 pub anchor: *mut yaml_char_t,
705 pub index: libc::c_int,
707 pub mark: YamlMarkT,
709}
710
711#[derive(Clone, Debug)]
716#[repr(C)]
717#[non_exhaustive]
718pub struct YamlParserT {
719 #[cfg(doc)]
721 pub error: YamlErrorTypeT,
722 #[cfg(not(doc))]
723 pub(crate) error: YamlErrorTypeT,
724 #[cfg(doc)]
726 pub problem: *const libc::c_char,
727 #[cfg(not(doc))]
728 pub(crate) problem: *const libc::c_char,
729 #[cfg(doc)]
731 pub problem_offset: size_t,
732 #[cfg(not(doc))]
733 pub(crate) problem_offset: size_t,
734 #[cfg(doc)]
736 pub problem_value: libc::c_int,
737 #[cfg(not(doc))]
738 pub(crate) problem_value: libc::c_int,
739 #[cfg(doc)]
741 pub problem_mark: YamlMarkT,
742 #[cfg(not(doc))]
743 pub(crate) problem_mark: YamlMarkT,
744 #[cfg(doc)]
746 pub context: *const libc::c_char,
747 #[cfg(not(doc))]
748 pub(crate) context: *const libc::c_char,
749 #[cfg(doc)]
751 pub context_mark: YamlMarkT,
752 #[cfg(not(doc))]
753 pub(crate) context_mark: YamlMarkT,
754 pub(crate) read_handler: Option<YamlReadHandlerT>,
756 pub(crate) read_handler_data: *mut libc::c_void,
758 pub(crate) input: UnnamedYamlParserTInput,
760 pub(crate) eof: bool,
762 pub(crate) buffer: YamlBufferT<yaml_char_t>,
764 pub(crate) unread: size_t,
766 pub(crate) raw_buffer: YamlBufferT<libc::c_uchar>,
768 pub(crate) encoding: YamlEncodingT,
770 pub(crate) offset: size_t,
772 pub(crate) mark: YamlMarkT,
774 pub(crate) stream_start_produced: bool,
776 pub(crate) stream_end_produced: bool,
778 pub(crate) flow_level: libc::c_int,
780 pub(crate) tokens: YamlQueueT<YamlTokenT>,
782 pub(crate) tokens_parsed: size_t,
784 pub(crate) token_available: bool,
786 pub(crate) indents: YamlStackT<libc::c_int>,
788 pub(crate) indent: libc::c_int,
790 pub(crate) simple_key_allowed: bool,
792 pub(crate) simple_keys: YamlStackT<YamlSimpleKeyT>,
794 pub(crate) not_simple_keys: libc::c_int,
796 pub(crate) states: YamlStackT<YamlParserStateT>,
798 pub(crate) state: YamlParserStateT,
800 pub(crate) marks: YamlStackT<YamlMarkT>,
802 pub(crate) tag_directives: YamlStackT<YamlTagDirectiveT>,
804 pub(crate) aliases: YamlStackT<YamlAliasDataT>,
806 pub(crate) document: *mut YamlDocumentT,
808}
809
810#[derive(Copy, Clone, Debug)]
812#[repr(C)]
813#[non_exhaustive]
814pub struct YamlParserTPrefix {
815 pub error: YamlErrorTypeT,
817 pub problem: *const libc::c_char,
819 pub problem_offset: size_t,
821 pub problem_value: libc::c_int,
823 pub problem_mark: YamlMarkT,
825 pub context: *const libc::c_char,
827 pub context_mark: YamlMarkT,
829}
830
831#[doc(hidden)]
832impl Deref for YamlParserT {
833 type Target = YamlParserTPrefix;
834 fn deref(&self) -> &Self::Target {
835 unsafe { &*addr_of!(*self).cast() }
836 }
837}
838
839#[derive(Copy, Clone, Debug, Default)]
840#[repr(C)]
841pub(crate) struct UnnamedYamlParserTInput {
842 pub(crate) string: UnnamedYamlParserTInputString,
844}
845
846#[derive(Copy, Clone, Debug)]
847#[repr(C)]
848pub(crate) struct UnnamedYamlParserTInputString {
849 pub(crate) start: *const libc::c_uchar,
851 pub(crate) end: *const libc::c_uchar,
853 pub(crate) current: *const libc::c_uchar,
855}
856
857pub type YamlWriteHandlerT = unsafe fn(
866 data: *mut libc::c_void,
867 buffer: *mut libc::c_uchar,
868 size: size_t,
869) -> libc::c_int;
870
871#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
873#[repr(u32)]
874#[non_exhaustive]
875pub enum YamlEmitterStateT {
876 YamlEmitStreamStartState = 0,
878 YamlEmitFirstDocumentStartState = 1,
880 YamlEmitDocumentStartState = 2,
882 YamlEmitDocumentContentState = 3,
884 YamlEmitDocumentEndState = 4,
886 YamlEmitFlowSequenceFirstItemState = 5,
888 YamlEmitFlowSequenceItemState = 6,
890 YamlEmitFlowMappingFirstKeyState = 7,
892 YamlEmitFlowMappingKeyState = 8,
894 YamlEmitFlowMappingSimpleValueState = 9,
896 YamlEmitFlowMappingValueState = 10,
898 YamlEmitBlockSequenceFirstItemState = 11,
900 YamlEmitBlockSequenceItemState = 12,
902 YamlEmitBlockMappingFirstKeyState = 13,
904 YamlEmitBlockMappingKeyState = 14,
906 YamlEmitBlockMappingSimpleValueState = 15,
908 YamlEmitBlockMappingValueState = 16,
910 YamlEmitEndState = 17,
912}
913
914#[derive(Copy, Clone, Debug)]
915#[repr(C)]
916pub(crate) struct YamlAnchorsT {
917 pub(crate) references: libc::c_int,
919 pub(crate) anchor: libc::c_int,
921 pub(crate) serialized: bool,
923}
924
925#[derive(Clone, Debug)]
930#[repr(C)]
931#[non_exhaustive]
932pub struct YamlEmitterT {
933 #[cfg(doc)]
935 pub error: YamlErrorTypeT,
936 #[cfg(not(doc))]
937 pub(crate) error: YamlErrorTypeT,
938 #[cfg(doc)]
940 pub problem: *const libc::c_char,
941 #[cfg(not(doc))]
942 pub(crate) problem: *const libc::c_char,
943 pub write_handler: Option<YamlWriteHandlerT>,
945 pub(crate) write_handler_data: *mut libc::c_void,
947 pub output: UnnamedYamlEmitterTOutput,
949 pub buffer: YamlBufferT<yaml_char_t>,
951 pub(crate) raw_buffer: YamlBufferT<libc::c_uchar>,
953 pub(crate) encoding: YamlEncodingT,
955 pub(crate) canonical: bool,
957 pub(crate) best_indent: libc::c_int,
959 pub(crate) best_width: libc::c_int,
961 pub(crate) unicode: bool,
963 pub(crate) line_break: YamlBreakT,
965 pub(crate) states: YamlStackT<YamlEmitterStateT>,
967 pub(crate) state: YamlEmitterStateT,
969 pub(crate) events: YamlQueueT<YamlEventT>,
971 pub(crate) indents: YamlStackT<libc::c_int>,
973 pub(crate) tag_directives: YamlStackT<YamlTagDirectiveT>,
975 pub(crate) indent: libc::c_int,
977 pub(crate) flow_level: libc::c_int,
979 pub(crate) root_context: bool,
981 pub(crate) sequence_context: bool,
983 pub(crate) mapping_context: bool,
985 pub(crate) simple_key_context: bool,
987 pub(crate) line: libc::c_int,
989 pub(crate) column: libc::c_int,
991 pub(crate) whitespace: bool,
993 pub(crate) indention: bool,
995 pub(crate) open_ended: libc::c_int,
997 pub(crate) anchor_data: UnnamedYamlEmitterTAnchorData,
999 pub(crate) tag_data: UnnamedYamlEmitterTTagData,
1001 pub(crate) scalar_data: UnnamedYamlEmitterTScalarData,
1003 pub opened: bool,
1005 pub closed: bool,
1007 pub(crate) anchors: *mut YamlAnchorsT,
1009 pub(crate) last_anchor_id: libc::c_int,
1011 pub(crate) document: *mut YamlDocumentT,
1013}
1014
1015#[derive(Copy, Clone, Debug)]
1017#[repr(C)]
1018#[non_exhaustive]
1019pub struct YamlEmitterTPrefix {
1020 pub error: YamlErrorTypeT,
1022 pub problem: *const libc::c_char,
1024}
1025
1026#[doc(hidden)]
1027impl Deref for YamlEmitterT {
1028 type Target = YamlEmitterTPrefix;
1029 fn deref(&self) -> &Self::Target {
1030 unsafe { &*addr_of!(*self).cast() }
1031 }
1032}
1033
1034#[derive(Copy, Clone, Debug, Default)]
1035#[repr(C)]
1036pub struct UnnamedYamlEmitterTOutput {
1038 pub string: UnnamedYamlEmitterTOutputString,
1040}
1041
1042#[derive(Copy, Clone, Debug)]
1043#[repr(C)]
1044pub struct UnnamedYamlEmitterTOutputString {
1046 pub buffer: *mut libc::c_uchar,
1048 pub size: size_t,
1050 pub size_written: *mut size_t,
1052}
1053
1054#[derive(Copy, Clone, Debug)]
1055#[repr(C)]
1056pub(crate) struct UnnamedYamlEmitterTAnchorData {
1057 pub(crate) anchor: *mut yaml_char_t,
1059 pub(crate) anchor_length: size_t,
1061 pub(crate) alias: bool,
1063}
1064
1065#[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
1066#[repr(C)]
1067pub(crate) struct UnnamedYamlEmitterTTagData {
1068 pub(crate) handle: *mut yaml_char_t,
1070 pub(crate) handle_length: size_t,
1072 pub(crate) suffix: *mut yaml_char_t,
1074 pub(crate) suffix_length: size_t,
1076}
1077
1078#[derive(Copy, Clone, Debug)]
1079#[repr(C)]
1080pub(crate) struct UnnamedYamlEmitterTScalarData {
1081 pub(crate) value: *mut yaml_char_t,
1083 pub(crate) length: size_t,
1085 pub(crate) multiline: bool,
1087 pub(crate) flow_plain_allowed: bool,
1089 pub(crate) block_plain_allowed: bool,
1091 pub(crate) single_quoted_allowed: bool,
1093 pub(crate) block_allowed: bool,
1095 pub(crate) style: YamlScalarStyleT,
1097}
1098
1099#[derive(Copy, Clone, Debug)]
1100#[repr(C)]
1101pub(crate) struct YamlStringT {
1102 pub(crate) start: *mut yaml_char_t,
1103 pub(crate) end: *mut yaml_char_t,
1104 pub(crate) pointer: *mut yaml_char_t,
1105}
1106
1107pub(crate) const NULL_STRING: YamlStringT = YamlStringT {
1108 start: ptr::null_mut::<yaml_char_t>(),
1109 end: ptr::null_mut::<yaml_char_t>(),
1110 pointer: ptr::null_mut::<yaml_char_t>(),
1111};
1112
1113#[derive(Copy, Clone, Debug)]
1114#[repr(C)]
1115pub struct YamlBufferT<T> {
1117 pub start: *mut T,
1119 pub end: *mut T,
1121 pub pointer: *mut T,
1123 pub last: *mut T,
1125}
1126
1127impl<T> YamlBufferT<T> {
1128 pub(crate) fn is_empty(&self) -> bool {
1130 self.pointer == self.last
1131 }
1132
1133 pub(crate) fn next(&mut self) {
1135 if !self.is_empty() {
1136 unsafe {
1137 self.pointer = self.pointer.add(1);
1138 }
1139 }
1140 }
1141}
1142
1143impl<T> Default for YamlBufferT<T> {
1144 fn default() -> Self {
1145 YamlBufferT {
1146 start: ptr::null_mut(),
1147 end: ptr::null_mut(),
1148 pointer: ptr::null_mut(),
1149 last: ptr::null_mut(),
1150 }
1151 }
1152}
1153
1154#[derive(Debug)]
1156#[repr(C)]
1157pub struct YamlStackT<T> {
1158 pub start: *mut T,
1160 pub end: *mut T,
1162 pub top: *mut T,
1164}
1165
1166impl<T> Copy for YamlStackT<T> {}
1167impl<T> Clone for YamlStackT<T> {
1168 fn clone(&self) -> Self {
1169 *self
1170 }
1171}
1172
1173#[derive(Debug)]
1175#[repr(C)]
1176pub(crate) struct YamlQueueT<T> {
1177 pub(crate) start: *mut T,
1179 pub(crate) end: *mut T,
1181 pub(crate) head: *mut T,
1183 pub(crate) tail: *mut T,
1185}
1186
1187impl<T> Copy for YamlQueueT<T> {}
1188impl<T> Clone for YamlQueueT<T> {
1189 fn clone(&self) -> Self {
1190 *self
1191 }
1192}
1193
1194impl<T: Default> Default for YamlQueueT<T> {
1195 fn default() -> Self {
1196 YamlQueueT {
1197 start: ptr::null_mut(),
1198 end: ptr::null_mut(),
1199 head: ptr::null_mut(),
1200 tail: ptr::null_mut(),
1201 }
1202 }
1203}
1204
1205impl Default for YamlStringT {
1206 fn default() -> Self {
1207 YamlStringT {
1208 start: ptr::null_mut(),
1209 end: ptr::null_mut(),
1210 pointer: ptr::null_mut(),
1211 }
1212 }
1213}
1214
1215impl Default for UnnamedYamlEmitterTScalarData {
1216 fn default() -> Self {
1217 UnnamedYamlEmitterTScalarData {
1218 value: ptr::null_mut(),
1219 length: 0,
1220 multiline: false,
1221 flow_plain_allowed: false,
1222 block_plain_allowed: false,
1223 single_quoted_allowed: false,
1224 block_allowed: false,
1225 style: YamlScalarStyleT::YamlAnyScalarStyle,
1226 }
1227 }
1228}
1229
1230impl Default for UnnamedYamlEmitterTTagData {
1231 fn default() -> Self {
1232 UnnamedYamlEmitterTTagData {
1233 handle: ptr::null_mut(),
1234 handle_length: 0,
1235 suffix: ptr::null_mut(),
1236 suffix_length: 0,
1237 }
1238 }
1239}
1240
1241impl Default for UnnamedYamlEmitterTAnchorData {
1242 fn default() -> Self {
1243 UnnamedYamlEmitterTAnchorData {
1244 anchor: ptr::null_mut(),
1245 anchor_length: 0,
1246 alias: false,
1247 }
1248 }
1249}
1250
1251impl Default for UnnamedYamlEmitterTOutputString {
1252 fn default() -> Self {
1253 UnnamedYamlEmitterTOutputString {
1254 buffer: ptr::null_mut(),
1255 size: 0,
1256 size_written: ptr::null_mut(),
1257 }
1258 }
1259}
1260
1261impl Default for UnnamedYamlParserTInputString {
1262 fn default() -> Self {
1263 UnnamedYamlParserTInputString {
1264 start: ptr::null(),
1265 end: ptr::null(),
1266 current: ptr::null(),
1267 }
1268 }
1269}
1270
1271impl Default for UnnamedYamlDocumentTTagDirectives {
1272 fn default() -> Self {
1273 UnnamedYamlDocumentTTagDirectives {
1274 start: ptr::null_mut(),
1275 end: ptr::null_mut(),
1276 }
1277 }
1278}
1279
1280impl Default for YamlEncodingT {
1281 fn default() -> Self {
1282 YamlAnyEncoding
1283 }
1284}
1285
1286impl Default for YamlParserStateT {
1287 fn default() -> Self {
1288 YamlParserStateT::YamlParseStreamStartState
1289 }
1290}
1291
1292impl Default for YamlScalarStyleT {
1293 fn default() -> Self {
1294 YamlScalarStyleT::YamlAnyScalarStyle
1295 }
1296}
1297
1298impl Default for YamlTokenT {
1299 fn default() -> Self {
1300 YamlTokenT {
1301 type_: YamlTokenTypeT::YamlNoToken,
1302 data: UnnamedYamlTokenTData::default(),
1303 start_mark: YamlMarkT::default(),
1304 end_mark: YamlMarkT::default(),
1305 }
1306 }
1307}
1308
1309impl Default for UnnamedYamlTokenTdataStreamStart {
1310 fn default() -> Self {
1311 UnnamedYamlTokenTdataStreamStart {
1312 encoding: YamlAnyEncoding,
1313 }
1314 }
1315}
1316
1317impl Default for UnnamedYamlTokenTdataAlias {
1318 fn default() -> Self {
1319 UnnamedYamlTokenTdataAlias {
1320 value: ptr::null_mut(),
1321 }
1322 }
1323}
1324
1325impl Default for UnnamedYamlTokenTdataAnchor {
1326 fn default() -> Self {
1327 UnnamedYamlTokenTdataAnchor {
1328 value: ptr::null_mut(),
1329 }
1330 }
1331}
1332
1333impl Default for UnnamedYamlTokenTdataTag {
1334 fn default() -> Self {
1335 UnnamedYamlTokenTdataTag {
1336 handle: ptr::null_mut(),
1337 suffix: ptr::null_mut(),
1338 }
1339 }
1340}
1341
1342impl Default for UnnamedYamlTokenTdataScalar {
1343 fn default() -> Self {
1344 UnnamedYamlTokenTdataScalar {
1345 value: ptr::null_mut(),
1346 length: 0,
1347 style: YamlScalarStyleT::YamlAnyScalarStyle,
1348 }
1349 }
1350}
1351
1352impl Default for UnnamedYamlTokenTdataTagDirective {
1353 fn default() -> Self {
1354 UnnamedYamlTokenTdataTagDirective {
1355 handle: ptr::null_mut(),
1356 prefix: ptr::null_mut(),
1357 }
1358 }
1359}
1360
1361impl Default for YamlStackT<YamlSimpleKeyT> {
1362 fn default() -> Self {
1363 YamlStackT {
1364 start: ptr::null_mut(),
1365 end: ptr::null_mut(),
1366 top: ptr::null_mut(),
1367 }
1368 }
1369}
1370
1371impl Default for YamlStackT<YamlTagDirectiveT> {
1372 fn default() -> Self {
1373 YamlStackT {
1374 start: ptr::null_mut(),
1375 end: ptr::null_mut(),
1376 top: ptr::null_mut(),
1377 }
1378 }
1379}
1380
1381impl Default for YamlStackT<YamlAliasDataT> {
1382 fn default() -> Self {
1383 YamlStackT {
1384 start: ptr::null_mut(),
1385 end: ptr::null_mut(),
1386 top: ptr::null_mut(),
1387 }
1388 }
1389}
1390
1391impl Default for YamlTagDirectiveT {
1392 fn default() -> Self {
1393 YamlTagDirectiveT {
1394 handle: ptr::null_mut(),
1395 prefix: ptr::null_mut(),
1396 }
1397 }
1398}
1399
1400impl Default for YamlBreakT {
1401 fn default() -> Self {
1402 YamlBreakT::YamlAnyBreak
1403 }
1404}
1405
1406impl Default for YamlSequenceStyleT {
1407 fn default() -> Self {
1408 YamlSequenceStyleT::YamlAnySequenceStyle
1409 }
1410}
1411
1412impl Default for YamlMappingStyleT {
1413 fn default() -> Self {
1414 YamlMappingStyleT::YamlAnyMappingStyle
1415 }
1416}
1417
1418impl Default for YamlEventTypeT {
1419 fn default() -> Self {
1420 YamlNoEvent
1421 }
1422}
1423
1424impl Default for YamlAliasDataT {
1425 fn default() -> Self {
1426 YamlAliasDataT {
1427 anchor: ptr::null_mut(),
1428 index: 0,
1429 mark: YamlMarkT::default(),
1430 }
1431 }
1432}
1433
1434impl Default for YamlNodeTypeT {
1435 fn default() -> Self {
1436 YamlNoNode
1437 }
1438}
1439
1440impl Default for YamlEmitterStateT {
1441 fn default() -> Self {
1442 YamlEmitterStateT::YamlEmitStreamStartState
1443 }
1444}
1445
1446impl YamlDocumentT {
1447 pub unsafe fn cleanup(&mut self) {
1464 if !self.version_directive.is_null() {
1466 self.version_directive = ptr::null_mut();
1469 }
1470
1471 let mut tag_directive = self.tag_directives.start;
1473 while tag_directive < self.tag_directives.end {
1474 tag_directive = tag_directive.offset(1);
1478 }
1479
1480 let mut node = self.nodes.start;
1482 while node < self.nodes.top {
1483 node = node.offset(1);
1486 }
1487
1488 self.nodes.start = ptr::null_mut();
1491 self.nodes.end = ptr::null_mut();
1492 self.nodes.top = ptr::null_mut();
1493 }
1494}
1495
1496impl Default for YamlDocumentT {
1497 fn default() -> Self {
1498 YamlDocumentT {
1499 nodes: YamlStackT {
1500 start: ptr::null_mut(),
1501 end: ptr::null_mut(),
1502 top: ptr::null_mut(),
1503 },
1504 version_directive: ptr::null_mut(),
1505 tag_directives: UnnamedYamlDocumentTTagDirectives::default(
1506 ),
1507 start_implicit: false,
1508 end_implicit: false,
1509 start_mark: YamlMarkT::default(),
1510 end_mark: YamlMarkT::default(),
1511 }
1512 }
1513}