Add space between items

This commit is contained in:
David Tolnay 2022-07-08 08:51:24 -07:00
parent 92093d8f4f
commit 47ad13e63c
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82
11 changed files with 284 additions and 1 deletions

View file

@ -13,9 +13,11 @@ use crate::{
};
use core::mem::{size_of, MaybeUninit};
use core::ptr::{self, addr_of_mut};
struct api_context {
error: yaml_error_type_t,
}
/// Get the libyaml version as a string.
///
/// Returns the pointer to a static string of the form `"X.Y.Z"`, where `X` is
@ -24,6 +26,7 @@ struct api_context {
pub unsafe fn yaml_get_version_string() -> *const libc::c_char {
b"0.2.5\0" as *const u8 as *const libc::c_char
}
/// Get the libyaml version numbers.
pub unsafe fn yaml_get_version(
major: *mut libc::c_int,
@ -34,9 +37,11 @@ pub unsafe fn yaml_get_version(
*minor = 2_i32;
*patch = 5_i32;
}
pub(crate) unsafe fn yaml_malloc(size: size_t) -> *mut libc::c_void {
malloc(size)
}
pub(crate) unsafe fn yaml_realloc(ptr: *mut libc::c_void, size: size_t) -> *mut libc::c_void {
if !ptr.is_null() {
realloc(ptr, size)
@ -44,17 +49,20 @@ pub(crate) unsafe fn yaml_realloc(ptr: *mut libc::c_void, size: size_t) -> *mut
malloc(size)
}
}
pub(crate) unsafe fn yaml_free(ptr: *mut libc::c_void) {
if !ptr.is_null() {
free(ptr);
}
}
pub(crate) unsafe fn yaml_strdup(str: *const yaml_char_t) -> *mut yaml_char_t {
if str.is_null() {
return ptr::null_mut::<yaml_char_t>();
}
strdup(str as *mut libc::c_char) as *mut yaml_char_t
}
pub(crate) unsafe fn yaml_string_extend(
start: *mut *mut yaml_char_t,
pointer: *mut *mut yaml_char_t,
@ -79,6 +87,7 @@ pub(crate) unsafe fn yaml_string_extend(
*start = new_start;
1_i32
}
pub(crate) unsafe fn yaml_string_join(
a_start: *mut *mut yaml_char_t,
a_pointer: *mut *mut yaml_char_t,
@ -106,6 +115,7 @@ pub(crate) unsafe fn yaml_string_join(
(*a_pointer).wrapping_offset((*b_pointer).c_offset_from(*b_start) as libc::c_long as isize);
1_i32
}
pub(crate) unsafe fn yaml_stack_extend(
start: *mut *mut libc::c_void,
top: *mut *mut libc::c_void,
@ -135,6 +145,7 @@ pub(crate) unsafe fn yaml_stack_extend(
*start = new_start;
1_i32
}
pub(crate) unsafe fn yaml_queue_extend(
start: *mut *mut libc::c_void,
head: *mut *mut libc::c_void,
@ -181,6 +192,7 @@ pub(crate) unsafe fn yaml_queue_extend(
}
1_i32
}
/// Initialize a parser.
///
/// This function creates a new parser object. An application is responsible
@ -388,6 +400,7 @@ pub unsafe fn yaml_parser_initialize(parser: *mut yaml_parser_t) -> libc::c_int
*fresh51 = *fresh50;
0_i32
}
/// Destroy a parser.
pub unsafe fn yaml_parser_delete(parser: *mut yaml_parser_t) {
__assert!(!parser.is_null());
@ -468,6 +481,7 @@ pub unsafe fn yaml_parser_delete(parser: *mut yaml_parser_t) {
size_of::<yaml_parser_t>() as libc::c_ulong,
);
}
unsafe fn yaml_string_read_handler(
data: *mut libc::c_void,
buffer: *mut libc::c_uchar,
@ -496,6 +510,7 @@ unsafe fn yaml_string_read_handler(
*size_read = size;
1_i32
}
/// Set a string input.
///
/// Note that the `input` pointer must be valid while the `parser` object
@ -523,6 +538,7 @@ pub unsafe fn yaml_parser_set_input_string(
let fresh85 = addr_of_mut!((*parser).input.string.end);
*fresh85 = input.wrapping_offset(size as isize);
}
/// Set a generic input handler.
pub unsafe fn yaml_parser_set_input(
parser: *mut yaml_parser_t,
@ -537,12 +553,14 @@ pub unsafe fn yaml_parser_set_input(
let fresh90 = addr_of_mut!((*parser).read_handler_data);
*fresh90 = data;
}
/// Set the source encoding.
pub unsafe fn yaml_parser_set_encoding(mut parser: *mut yaml_parser_t, encoding: yaml_encoding_t) {
__assert!(!parser.is_null());
__assert!((*parser).encoding as u64 == 0);
(*parser).encoding = encoding;
}
/// Initialize an emitter.
///
/// This function creates a new emitter object. An application is responsible
@ -703,6 +721,7 @@ pub unsafe fn yaml_emitter_initialize(mut emitter: *mut yaml_emitter_t) -> libc:
*fresh130 = *fresh129;
0_i32
}
/// Destroy an emitter.
pub unsafe fn yaml_emitter_delete(emitter: *mut yaml_emitter_t) {
__assert!(!emitter.is_null());
@ -770,6 +789,7 @@ pub unsafe fn yaml_emitter_delete(emitter: *mut yaml_emitter_t) {
size_of::<yaml_emitter_t>() as libc::c_ulong,
);
}
unsafe fn yaml_string_write_handler(
data: *mut libc::c_void,
buffer: *mut libc::c_uchar,
@ -798,6 +818,7 @@ unsafe fn yaml_string_write_handler(
*fresh153 = (*fresh153 as libc::c_ulong).wrapping_add(size) as size_t as size_t;
1_i32
}
/// Set a string output.
///
/// The emitter will write the output characters to the `output` buffer of the
@ -827,6 +848,7 @@ pub unsafe fn yaml_emitter_set_output_string(
*fresh157 = size_written;
*size_written = 0_u64;
}
/// Set a generic output handler.
pub unsafe fn yaml_emitter_set_output(
emitter: *mut yaml_emitter_t,
@ -841,6 +863,7 @@ pub unsafe fn yaml_emitter_set_output(
let fresh162 = addr_of_mut!((*emitter).write_handler_data);
*fresh162 = data;
}
/// Set the output encoding.
pub unsafe fn yaml_emitter_set_encoding(
mut emitter: *mut yaml_emitter_t,
@ -850,12 +873,14 @@ pub unsafe fn yaml_emitter_set_encoding(
__assert!((*emitter).encoding as u64 == 0);
(*emitter).encoding = encoding;
}
/// Set if the output should be in the "canonical" format as in the YAML
/// specification.
pub unsafe fn yaml_emitter_set_canonical(mut emitter: *mut yaml_emitter_t, canonical: libc::c_int) {
__assert!(!emitter.is_null());
(*emitter).canonical = (canonical != 0_i32) as libc::c_int;
}
/// Set the indentation increment.
pub unsafe fn yaml_emitter_set_indent(mut emitter: *mut yaml_emitter_t, indent: libc::c_int) {
__assert!(!emitter.is_null());
@ -865,21 +890,25 @@ pub unsafe fn yaml_emitter_set_indent(mut emitter: *mut yaml_emitter_t, indent:
2_i32
};
}
/// Set the preferred line width. -1 means unlimited.
pub unsafe fn yaml_emitter_set_width(mut emitter: *mut yaml_emitter_t, width: libc::c_int) {
__assert!(!emitter.is_null());
(*emitter).best_width = if width >= 0_i32 { width } else { -1_i32 };
}
/// Set if unescaped non-ASCII characters are allowed.
pub unsafe fn yaml_emitter_set_unicode(mut emitter: *mut yaml_emitter_t, unicode: libc::c_int) {
__assert!(!emitter.is_null());
(*emitter).unicode = (unicode != 0_i32) as libc::c_int;
}
/// Set the preferred line break.
pub unsafe fn yaml_emitter_set_break(mut emitter: *mut yaml_emitter_t, line_break: yaml_break_t) {
__assert!(!emitter.is_null());
(*emitter).line_break = line_break;
}
/// Free any memory allocated for a token object.
pub unsafe fn yaml_token_delete(token: *mut yaml_token_t) {
__assert!(!token.is_null());
@ -909,6 +938,7 @@ pub unsafe fn yaml_token_delete(token: *mut yaml_token_t) {
size_of::<yaml_token_t>() as libc::c_ulong,
);
}
unsafe fn yaml_check_utf8(start: *const yaml_char_t, length: size_t) -> libc::c_int {
let end: *const yaml_char_t = start.wrapping_offset(length as isize);
let mut pointer: *const yaml_char_t = start;
@ -966,6 +996,7 @@ unsafe fn yaml_check_utf8(start: *const yaml_char_t, length: size_t) -> libc::c_
}
1_i32
}
/// Create the STREAM-START event.
///
/// Returns 1 if the function succeeded, 0 on error.
@ -990,6 +1021,7 @@ pub unsafe fn yaml_stream_start_event_initialize(
(*event).data.stream_start.encoding = encoding;
1_i32
}
/// Create the STREAM-END event.
///
/// Returns 1 if the function succeeded, 0 on error.
@ -1010,6 +1042,7 @@ pub unsafe fn yaml_stream_end_event_initialize(mut event: *mut yaml_event_t) ->
(*event).end_mark = mark;
1_i32
}
/// Create the DOCUMENT-START event.
///
/// The `implicit` argument is considered as a stylistic parameter and may be
@ -1180,6 +1213,7 @@ pub unsafe fn yaml_document_start_event_initialize(
yaml_free(value.prefix as *mut libc::c_void);
0_i32
}
/// Create the DOCUMENT-END event.
///
/// The `implicit` argument is considered as a stylistic parameter and may be
@ -1207,6 +1241,7 @@ pub unsafe fn yaml_document_end_event_initialize(
(*event).data.document_end.implicit = implicit;
1_i32
}
/// Create an ALIAS event.
///
/// Returns 1 if the function succeeded, 0 on error.
@ -1240,6 +1275,7 @@ pub unsafe fn yaml_alias_event_initialize(
*fresh167 = anchor_copy;
1_i32
}
/// Create a SCALAR event.
///
/// The `style` argument may be ignored by the emitter.
@ -1346,6 +1382,7 @@ pub unsafe fn yaml_scalar_event_initialize(
yaml_free(value_copy as *mut libc::c_void);
0_i32
}
/// Create a SEQUENCE-START event.
///
/// The `style` argument may be ignored by the emitter.
@ -1426,6 +1463,7 @@ pub unsafe fn yaml_sequence_start_event_initialize(
yaml_free(tag_copy as *mut libc::c_void);
0_i32
}
/// Create a SEQUENCE-END event.
///
/// Returns 1 if the function succeeded, 0 on error.
@ -1446,6 +1484,7 @@ pub unsafe fn yaml_sequence_end_event_initialize(mut event: *mut yaml_event_t) -
(*event).end_mark = mark;
1_i32
}
/// Create a MAPPING-START event.
///
/// The `style` argument may be ignored by the emitter.
@ -1526,6 +1565,7 @@ pub unsafe fn yaml_mapping_start_event_initialize(
yaml_free(tag_copy as *mut libc::c_void);
0_i32
}
/// Create a MAPPING-END event.
///
/// Returns 1 if the function succeeded, 0 on error.
@ -1546,6 +1586,7 @@ pub unsafe fn yaml_mapping_end_event_initialize(mut event: *mut yaml_event_t) ->
(*event).end_mark = mark;
1_i32
}
/// Free any memory allocated for an event object.
pub unsafe fn yaml_event_delete(event: *mut yaml_event_t) {
let mut tag_directive: *mut yaml_tag_directive_t;
@ -1585,6 +1626,7 @@ pub unsafe fn yaml_event_delete(event: *mut yaml_event_t) {
size_of::<yaml_event_t>() as libc::c_ulong,
);
}
/// Create a YAML document.
///
/// Returns 1 if the function succeeded, 0 on error.
@ -1791,6 +1833,7 @@ pub unsafe fn yaml_document_initialize(
yaml_free(value.prefix as *mut libc::c_void);
0_i32
}
/// Delete a YAML document and all its nodes.
pub unsafe fn yaml_document_delete(document: *mut yaml_document_t) {
let mut tag_directive: *mut yaml_tag_directive_t;
@ -1842,6 +1885,7 @@ pub unsafe fn yaml_document_delete(document: *mut yaml_document_t) {
size_of::<yaml_document_t>() as libc::c_ulong,
);
}
/// Get a node of a YAML document.
///
/// The pointer returned by this function is valid until any of the functions
@ -1862,6 +1906,7 @@ pub unsafe fn yaml_document_get_node(
}
ptr::null_mut::<yaml_node_t>()
}
/// Get the root of a YAML document node.
///
/// The root object is the first object added to the document.
@ -1879,6 +1924,7 @@ pub unsafe fn yaml_document_get_root_node(document: *mut yaml_document_t) -> *mu
}
ptr::null_mut::<yaml_node_t>()
}
/// Create a SCALAR node and attach it to the document.
///
/// The `style` argument may be ignored by the emitter.
@ -1963,6 +2009,7 @@ pub unsafe fn yaml_document_add_scalar(
yaml_free(value_copy as *mut libc::c_void);
0_i32
}
/// Create a SEQUENCE node and attach it to the document.
///
/// The `style` argument may be ignored by the emitter.
@ -2056,6 +2103,7 @@ pub unsafe fn yaml_document_add_sequence(
yaml_free(tag_copy as *mut libc::c_void);
0_i32
}
/// Create a MAPPING node and attach it to the document.
///
/// The `style` argument may be ignored by the emitter.
@ -2149,6 +2197,7 @@ pub unsafe fn yaml_document_add_mapping(
yaml_free(tag_copy as *mut libc::c_void);
0_i32
}
/// Add an item to a SEQUENCE node.
///
/// Returns 1 if the function succeeded, 0 on error.
@ -2229,6 +2278,7 @@ pub unsafe fn yaml_document_append_sequence_item(
}
1_i32
}
/// Add a pair of a key and a value to a MAPPING node.
///
/// Returns 1 if the function succeeded, 0 on error.

View file

@ -36,6 +36,7 @@ use unsafe_libyaml::{
YAML_LITERAL_SCALAR_STYLE, YAML_PLAIN_SCALAR_STYLE, YAML_SINGLE_QUOTED_SCALAR_STYLE,
YAML_UTF8_ENCODING,
};
pub(crate) unsafe fn unsafe_main(
stdin: &mut dyn Read,
mut stdout: &mut dyn Write,
@ -180,11 +181,13 @@ pub(crate) unsafe fn unsafe_main(
yaml_emitter_delete(emitter);
result
}
struct ReadBuf {
buf: [u8; 1024],
offset: usize,
filled: usize,
}
impl ReadBuf {
fn new() -> Self {
ReadBuf {
@ -193,6 +196,7 @@ impl ReadBuf {
filled: 0,
}
}
fn get_line(&mut self, input: &mut dyn Read) -> Option<&mut [u8]> {
loop {
for i in self.offset..self.offset + self.filled {
@ -226,6 +230,7 @@ impl ReadBuf {
}
}
}
unsafe fn get_anchor(sigil: i8, line: *mut i8, anchor: *mut i8) -> *mut i8 {
let mut start: *mut i8;
let mut end: *mut i8;
@ -246,6 +251,7 @@ unsafe fn get_anchor(sigil: i8, line: *mut i8, anchor: *mut i8) -> *mut i8 {
*anchor.offset(end.offset_from(start) as i64 as isize) = '\0' as i32 as i8;
anchor
}
unsafe fn get_tag(line: *mut i8, tag: *mut i8) -> *mut i8 {
let start: *mut i8 = strchr(line, '<' as i32);
if start.is_null() {
@ -263,6 +269,7 @@ unsafe fn get_tag(line: *mut i8, tag: *mut i8) -> *mut i8 {
*tag.offset((end.offset_from(start) as i64 - 1_i64) as isize) = '\0' as i32 as i8;
tag
}
unsafe fn get_value(line: *mut i8, value: *mut i8, style: *mut yaml_scalar_style_t) {
let mut i: i32 = 0_i32;
let mut c: *mut i8;
@ -345,6 +352,7 @@ unsafe fn get_value(line: *mut i8, value: *mut i8, style: *mut yaml_scalar_style
}
*value.offset(i as isize) = '\0' as i32 as i8;
}
unsafe fn memcpy(dest: *mut c_void, src: *const c_void, count: u64) -> *mut c_void {
ptr::copy_nonoverlapping(
src.cast::<MaybeUninit<u8>>(),
@ -353,6 +361,7 @@ unsafe fn memcpy(dest: *mut c_void, src: *const c_void, count: u64) -> *mut c_vo
);
dest
}
unsafe fn strchr(mut str: *const i8, c: i32) -> *mut i8 {
loop {
match *str {
@ -362,6 +371,7 @@ unsafe fn strchr(mut str: *const i8, c: i32) -> *mut i8 {
}
}
}
unsafe fn strlen(str: *const i8) -> u64 {
let mut end = str;
while *end != 0 {
@ -369,6 +379,7 @@ unsafe fn strlen(str: *const i8) -> u64 {
}
end.offset_from(str) as u64
}
unsafe fn strncmp(lhs: *const i8, rhs: *const i8, mut count: u64) -> i32 {
let mut lhs = lhs.cast::<u8>();
let mut rhs = rhs.cast::<u8>();
@ -383,6 +394,7 @@ unsafe fn strncmp(lhs: *const i8, rhs: *const i8, mut count: u64) -> i32 {
(*lhs).cmp(&*rhs) as i32
}
}
fn main() -> ExitCode {
let args = env::args_os().skip(1);
if args.len() == 0 {

View file

@ -28,6 +28,7 @@ use unsafe_libyaml::{
YAML_MAPPING_START_EVENT, YAML_NO_EVENT, YAML_SCALAR_EVENT, YAML_SEQUENCE_END_EVENT,
YAML_SEQUENCE_START_EVENT, YAML_STREAM_END_EVENT, YAML_STREAM_START_EVENT,
};
pub(crate) unsafe fn unsafe_main(
mut stdin: &mut dyn Read,
stdout: &mut dyn Write,
@ -192,6 +193,7 @@ pub(crate) unsafe fn unsafe_main(
yaml_parser_delete(parser);
Ok(())
}
unsafe fn print_escaped(stdout: &mut dyn Write, str: *mut u8, length: u64) {
let mut i: i32;
let mut c: i8;
@ -216,6 +218,7 @@ unsafe fn print_escaped(stdout: &mut dyn Write, str: *mut u8, length: u64) {
i += 1;
}
}
fn main() -> ExitCode {
let args = env::args_os().skip(1);
if args.len() == 0 {

View file

@ -11,6 +11,7 @@ use crate::yaml::{
use crate::{libc, yaml_document_delete, yaml_emitter_emit, PointerExt};
use core::mem::{size_of, MaybeUninit};
use core::ptr::{self, addr_of_mut};
/// Start a YAML stream.
///
/// This function should be used before yaml_emitter_dump() is called.
@ -41,6 +42,7 @@ pub unsafe fn yaml_emitter_open(mut emitter: *mut yaml_emitter_t) -> libc::c_int
(*emitter).opened = 1_i32;
1_i32
}
/// Finish a YAML stream.
///
/// This function should be used after yaml_emitter_dump() is called.
@ -73,6 +75,7 @@ pub unsafe fn yaml_emitter_close(mut emitter: *mut yaml_emitter_t) -> libc::c_in
(*emitter).closed = 1_i32;
1_i32
}
/// Emit a YAML document.
///
/// The documen object may be generated using the yaml_parser_load() function or
@ -169,6 +172,7 @@ pub unsafe fn yaml_emitter_dump(
yaml_emitter_delete_document_and_anchors(emitter);
0_i32
}
unsafe fn yaml_emitter_delete_document_and_anchors(mut emitter: *mut yaml_emitter_t) {
let mut index: libc::c_int;
if ((*emitter).anchors).is_null() {
@ -217,6 +221,7 @@ unsafe fn yaml_emitter_delete_document_and_anchors(mut emitter: *mut yaml_emitte
let fresh7 = addr_of_mut!((*emitter).document);
*fresh7 = ptr::null_mut::<yaml_document_t>();
}
unsafe fn yaml_emitter_anchor_node(emitter: *mut yaml_emitter_t, index: libc::c_int) {
let node: *mut yaml_node_t = ((*(*emitter).document).nodes.start)
.wrapping_offset(index as isize)
@ -252,6 +257,7 @@ unsafe fn yaml_emitter_anchor_node(emitter: *mut yaml_emitter_t, index: libc::c_
(*((*emitter).anchors).wrapping_offset((index - 1_i32) as isize)).anchor = *fresh9;
}
}
unsafe fn yaml_emitter_generate_anchor(
_emitter: *mut yaml_emitter_t,
anchor_id: libc::c_int,
@ -263,6 +269,7 @@ unsafe fn yaml_emitter_generate_anchor(
write!(WriteToPtr::new(anchor), "id{:03}\0", anchor_id);
anchor
}
unsafe fn yaml_emitter_dump_node(emitter: *mut yaml_emitter_t, index: libc::c_int) -> libc::c_int {
let node: *mut yaml_node_t = ((*(*emitter).document).nodes.start)
.wrapping_offset(index as isize)
@ -287,6 +294,7 @@ unsafe fn yaml_emitter_dump_node(emitter: *mut yaml_emitter_t, index: libc::c_in
_ => __assert!(false),
}
}
unsafe fn yaml_emitter_dump_alias(
emitter: *mut yaml_emitter_t,
anchor: *mut yaml_char_t,
@ -309,6 +317,7 @@ unsafe fn yaml_emitter_dump_alias(
(*event).data.alias.anchor = anchor;
yaml_emitter_emit(emitter, event)
}
unsafe fn yaml_emitter_dump_scalar(
emitter: *mut yaml_emitter_t,
node: *mut yaml_node_t,
@ -346,6 +355,7 @@ unsafe fn yaml_emitter_dump_scalar(
(*event).data.scalar.style = (*node).data.scalar.style;
yaml_emitter_emit(emitter, event)
}
unsafe fn yaml_emitter_dump_sequence(
emitter: *mut yaml_emitter_t,
node: *mut yaml_node_t,
@ -398,6 +408,7 @@ unsafe fn yaml_emitter_dump_sequence(
}
1_i32
}
unsafe fn yaml_emitter_dump_mapping(
emitter: *mut yaml_emitter_t,
node: *mut yaml_node_t,

View file

@ -20,6 +20,7 @@ use crate::{
YAML_STREAM_START_EVENT, YAML_UTF8_ENCODING,
};
use core::ptr::{self, addr_of_mut};
unsafe fn yaml_emitter_set_emitter_error(
mut emitter: *mut yaml_emitter_t,
problem: *const libc::c_char,
@ -29,6 +30,7 @@ unsafe fn yaml_emitter_set_emitter_error(
*fresh0 = problem;
0_i32
}
/// Emit an event.
///
/// The event object may be generated using the yaml_parser_parse() function.
@ -76,6 +78,7 @@ pub unsafe fn yaml_emitter_emit(
}
1_i32
}
unsafe fn yaml_emitter_need_more_events(emitter: *mut yaml_emitter_t) -> libc::c_int {
let mut level: libc::c_int = 0_i32;
let mut event: *mut yaml_event_t;
@ -111,6 +114,7 @@ unsafe fn yaml_emitter_need_more_events(emitter: *mut yaml_emitter_t) -> libc::c
}
1_i32
}
unsafe fn yaml_emitter_append_tag_directive(
mut emitter: *mut yaml_emitter_t,
value: yaml_tag_directive_t,
@ -165,6 +169,7 @@ unsafe fn yaml_emitter_append_tag_directive(
yaml_free(copy.prefix as *mut libc::c_void);
0_i32
}
unsafe fn yaml_emitter_increase_indent(
mut emitter: *mut yaml_emitter_t,
flow: libc::c_int,
@ -200,6 +205,7 @@ unsafe fn yaml_emitter_increase_indent(
}
1_i32
}
unsafe fn yaml_emitter_state_machine(
emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
@ -252,6 +258,7 @@ unsafe fn yaml_emitter_state_machine(
}
0_i32
}
unsafe fn yaml_emitter_emit_stream_start(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
@ -296,6 +303,7 @@ unsafe fn yaml_emitter_emit_stream_start(
b"expected STREAM-START\0" as *const u8 as *const libc::c_char,
)
}
unsafe fn yaml_emitter_emit_document_start(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
@ -500,6 +508,7 @@ unsafe fn yaml_emitter_emit_document_start(
b"expected DOCUMENT-START or STREAM-END\0" as *const u8 as *const libc::c_char,
)
}
unsafe fn yaml_emitter_emit_document_content(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
@ -525,6 +534,7 @@ unsafe fn yaml_emitter_emit_document_content(
}
yaml_emitter_emit_node(emitter, event, 1_i32, 0_i32, 0_i32, 0_i32)
}
unsafe fn yaml_emitter_emit_document_end(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
@ -569,6 +579,7 @@ unsafe fn yaml_emitter_emit_document_end(
b"expected DOCUMENT-END\0" as *const u8 as *const libc::c_char,
)
}
unsafe fn yaml_emitter_emit_flow_sequence_item(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
@ -665,6 +676,7 @@ unsafe fn yaml_emitter_emit_flow_sequence_item(
}
yaml_emitter_emit_node(emitter, event, 0_i32, 1_i32, 0_i32, 0_i32)
}
unsafe fn yaml_emitter_emit_flow_mapping_key(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
@ -794,6 +806,7 @@ unsafe fn yaml_emitter_emit_flow_mapping_key(
yaml_emitter_emit_node(emitter, event, 0_i32, 0_i32, 1_i32, 0_i32)
}
}
unsafe fn yaml_emitter_emit_flow_mapping_value(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
@ -848,6 +861,7 @@ unsafe fn yaml_emitter_emit_flow_mapping_value(
}
yaml_emitter_emit_node(emitter, event, 0_i32, 0_i32, 1_i32, 0_i32)
}
unsafe fn yaml_emitter_emit_block_sequence_item(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
@ -906,6 +920,7 @@ unsafe fn yaml_emitter_emit_block_sequence_item(
}
yaml_emitter_emit_node(emitter, event, 0_i32, 1_i32, 0_i32, 0_i32)
}
unsafe fn yaml_emitter_emit_block_mapping_key(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
@ -982,6 +997,7 @@ unsafe fn yaml_emitter_emit_block_mapping_key(
yaml_emitter_emit_node(emitter, event, 0_i32, 0_i32, 1_i32, 0_i32)
}
}
unsafe fn yaml_emitter_emit_block_mapping_value(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
@ -1034,6 +1050,7 @@ unsafe fn yaml_emitter_emit_block_mapping_value(
}
yaml_emitter_emit_node(emitter, event, 0_i32, 0_i32, 1_i32, 0_i32)
}
unsafe fn yaml_emitter_emit_node(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
@ -1058,6 +1075,7 @@ unsafe fn yaml_emitter_emit_node(
),
}
}
unsafe fn yaml_emitter_emit_alias(
mut emitter: *mut yaml_emitter_t,
_event: *mut yaml_event_t,
@ -1086,6 +1104,7 @@ unsafe fn yaml_emitter_emit_alias(
(*emitter).state = **fresh43;
1_i32
}
unsafe fn yaml_emitter_emit_scalar(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
@ -1113,6 +1132,7 @@ unsafe fn yaml_emitter_emit_scalar(
(*emitter).state = **fresh45;
1_i32
}
unsafe fn yaml_emitter_emit_sequence_start(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
@ -1135,6 +1155,7 @@ unsafe fn yaml_emitter_emit_sequence_start(
}
1_i32
}
unsafe fn yaml_emitter_emit_mapping_start(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
@ -1157,9 +1178,11 @@ unsafe fn yaml_emitter_emit_mapping_start(
}
1_i32
}
unsafe fn yaml_emitter_check_empty_document(_emitter: *mut yaml_emitter_t) -> libc::c_int {
0_i32
}
unsafe fn yaml_emitter_check_empty_sequence(emitter: *mut yaml_emitter_t) -> libc::c_int {
if (((*emitter).events.tail).c_offset_from((*emitter).events.head) as libc::c_long) < 2_i64 {
return 0_i32;
@ -1169,6 +1192,7 @@ unsafe fn yaml_emitter_check_empty_sequence(emitter: *mut yaml_emitter_t) -> lib
&& (*((*emitter).events.head).wrapping_offset(1_isize)).type_ as libc::c_uint
== YAML_SEQUENCE_END_EVENT as libc::c_int as libc::c_uint) as libc::c_int
}
unsafe fn yaml_emitter_check_empty_mapping(emitter: *mut yaml_emitter_t) -> libc::c_int {
if (((*emitter).events.tail).c_offset_from((*emitter).events.head) as libc::c_long) < 2_i64 {
return 0_i32;
@ -1178,6 +1202,7 @@ unsafe fn yaml_emitter_check_empty_mapping(emitter: *mut yaml_emitter_t) -> libc
&& (*((*emitter).events.head).wrapping_offset(1_isize)).type_ as libc::c_uint
== YAML_MAPPING_END_EVENT as libc::c_int as libc::c_uint) as libc::c_int
}
unsafe fn yaml_emitter_check_simple_key(emitter: *mut yaml_emitter_t) -> libc::c_int {
let event: *mut yaml_event_t = (*emitter).events.head;
let mut length: size_t = 0_u64;
@ -1224,6 +1249,7 @@ unsafe fn yaml_emitter_check_simple_key(emitter: *mut yaml_emitter_t) -> libc::c
}
1_i32
}
unsafe fn yaml_emitter_select_scalar_style(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
@ -1290,6 +1316,7 @@ unsafe fn yaml_emitter_select_scalar_style(
(*emitter).scalar_data.style = style;
1_i32
}
unsafe fn yaml_emitter_process_anchor(emitter: *mut yaml_emitter_t) -> libc::c_int {
if ((*emitter).anchor_data.anchor).is_null() {
return 1_i32;
@ -1314,6 +1341,7 @@ unsafe fn yaml_emitter_process_anchor(emitter: *mut yaml_emitter_t) -> libc::c_i
(*emitter).anchor_data.anchor_length,
)
}
unsafe fn yaml_emitter_process_tag(emitter: *mut yaml_emitter_t) -> libc::c_int {
if ((*emitter).tag_data.handle).is_null() && ((*emitter).tag_data.suffix).is_null() {
return 1_i32;
@ -1371,6 +1399,7 @@ unsafe fn yaml_emitter_process_tag(emitter: *mut yaml_emitter_t) -> libc::c_int
}
1_i32
}
unsafe fn yaml_emitter_process_scalar(emitter: *mut yaml_emitter_t) -> libc::c_int {
match (*emitter).scalar_data.style as libc::c_uint {
1 => {
@ -1415,6 +1444,7 @@ unsafe fn yaml_emitter_process_scalar(emitter: *mut yaml_emitter_t) -> libc::c_i
}
0_i32
}
unsafe fn yaml_emitter_analyze_version_directive(
emitter: *mut yaml_emitter_t,
version_directive: yaml_version_directive_t,
@ -1429,6 +1459,7 @@ unsafe fn yaml_emitter_analyze_version_directive(
}
1_i32
}
unsafe fn yaml_emitter_analyze_tag_directive(
emitter: *mut yaml_emitter_t,
tag_directive: yaml_tag_directive_t,
@ -1511,6 +1542,7 @@ unsafe fn yaml_emitter_analyze_tag_directive(
}
1_i32
}
unsafe fn yaml_emitter_analyze_anchor(
mut emitter: *mut yaml_emitter_t,
anchor: *mut yaml_char_t,
@ -1583,6 +1615,7 @@ unsafe fn yaml_emitter_analyze_anchor(
(*emitter).anchor_data.alias = alias;
1_i32
}
unsafe fn yaml_emitter_analyze_tag(
mut emitter: *mut yaml_emitter_t,
tag: *mut yaml_char_t,
@ -1629,6 +1662,7 @@ unsafe fn yaml_emitter_analyze_tag(
string.end.c_offset_from(string.start) as libc::c_long as size_t;
1_i32
}
unsafe fn yaml_emitter_analyze_scalar(
mut emitter: *mut yaml_emitter_t,
value: *mut yaml_char_t,
@ -2534,6 +2568,7 @@ unsafe fn yaml_emitter_analyze_scalar(
}
1_i32
}
unsafe fn yaml_emitter_analyze_event(
mut emitter: *mut yaml_emitter_t,
event: *mut yaml_event_t,
@ -2619,6 +2654,7 @@ unsafe fn yaml_emitter_analyze_event(
_ => 1_i32,
}
}
unsafe fn yaml_emitter_write_bom(emitter: *mut yaml_emitter_t) -> libc::c_int {
if !(((*emitter).buffer.pointer).wrapping_offset(5_isize) < (*emitter).buffer.end
|| yaml_emitter_flush(emitter) != 0)
@ -2639,6 +2675,7 @@ unsafe fn yaml_emitter_write_bom(emitter: *mut yaml_emitter_t) -> libc::c_int {
*fresh61 = -65i32 as yaml_char_t;
1_i32
}
unsafe fn yaml_emitter_write_indent(mut emitter: *mut yaml_emitter_t) -> libc::c_int {
let indent: libc::c_int = if (*emitter).indent >= 0_i32 {
(*emitter).indent
@ -2707,6 +2744,7 @@ unsafe fn yaml_emitter_write_indent(mut emitter: *mut yaml_emitter_t) -> libc::c
(*emitter).indention = 1_i32;
1_i32
}
unsafe fn yaml_emitter_write_indicator(
mut emitter: *mut yaml_emitter_t,
indicator: *const libc::c_char,
@ -2817,6 +2855,7 @@ unsafe fn yaml_emitter_write_indicator(
(*emitter).indention = ((*emitter).indention != 0 && is_indention != 0) as libc::c_int;
1_i32
}
unsafe fn yaml_emitter_write_anchor(
mut emitter: *mut yaml_emitter_t,
value: *mut yaml_char_t,
@ -2908,6 +2947,7 @@ unsafe fn yaml_emitter_write_anchor(
(*emitter).indention = 0_i32;
1_i32
}
unsafe fn yaml_emitter_write_tag_handle(
mut emitter: *mut yaml_emitter_t,
value: *mut yaml_char_t,
@ -3015,6 +3055,7 @@ unsafe fn yaml_emitter_write_tag_handle(
(*emitter).indention = 0_i32;
1_i32
}
unsafe fn yaml_emitter_write_tag_content(
mut emitter: *mut yaml_emitter_t,
value: *mut yaml_char_t,
@ -3260,6 +3301,7 @@ unsafe fn yaml_emitter_write_tag_content(
(*emitter).indention = 0_i32;
1_i32
}
unsafe fn yaml_emitter_write_plain_scalar(
mut emitter: *mut yaml_emitter_t,
value: *mut yaml_char_t,
@ -3671,6 +3713,7 @@ unsafe fn yaml_emitter_write_plain_scalar(
(*emitter).indention = 0_i32;
1_i32
}
unsafe fn yaml_emitter_write_single_quoted_scalar(
mut emitter: *mut yaml_emitter_t,
value: *mut yaml_char_t,
@ -4111,6 +4154,7 @@ unsafe fn yaml_emitter_write_single_quoted_scalar(
(*emitter).indention = 0_i32;
1_i32
}
unsafe fn yaml_emitter_write_double_quoted_scalar(
mut emitter: *mut yaml_emitter_t,
value: *mut yaml_char_t,
@ -4792,6 +4836,7 @@ unsafe fn yaml_emitter_write_double_quoted_scalar(
(*emitter).indention = 0_i32;
1_i32
}
unsafe fn yaml_emitter_write_block_scalar_hints(
mut emitter: *mut yaml_emitter_t,
mut string: yaml_string_t,
@ -4905,6 +4950,7 @@ unsafe fn yaml_emitter_write_block_scalar_hints(
}
1_i32
}
unsafe fn yaml_emitter_write_literal_scalar(
mut emitter: *mut yaml_emitter_t,
value: *mut yaml_char_t,
@ -5195,6 +5241,7 @@ unsafe fn yaml_emitter_write_literal_scalar(
}
1_i32
}
unsafe fn yaml_emitter_write_folded_scalar(
mut emitter: *mut yaml_emitter_t,
value: *mut yaml_char_t,

View file

@ -10,12 +10,14 @@ use crate::{
};
use core::mem::{size_of, MaybeUninit};
use core::ptr::{self, addr_of_mut};
#[repr(C)]
struct loader_ctx {
start: *mut libc::c_int,
end: *mut libc::c_int,
top: *mut libc::c_int,
}
/// Parse the input stream and produce the next YAML document.
///
/// Call this function subsequently to produce a sequence of documents
@ -119,6 +121,7 @@ pub unsafe fn yaml_parser_load(
*fresh8 = ptr::null_mut::<yaml_document_t>();
0_i32
}
unsafe fn yaml_parser_set_composer_error(
mut parser: *mut yaml_parser_t,
problem: *const libc::c_char,
@ -130,6 +133,7 @@ unsafe fn yaml_parser_set_composer_error(
(*parser).problem_mark = problem_mark;
0_i32
}
unsafe fn yaml_parser_set_composer_error_context(
mut parser: *mut yaml_parser_t,
context: *const libc::c_char,
@ -146,6 +150,7 @@ unsafe fn yaml_parser_set_composer_error_context(
(*parser).problem_mark = problem_mark;
0_i32
}
unsafe fn yaml_parser_delete_aliases(parser: *mut yaml_parser_t) {
while !((*parser).aliases.start == (*parser).aliases.top) {
let fresh12 = addr_of_mut!((*parser).aliases.top);
@ -160,6 +165,7 @@ unsafe fn yaml_parser_delete_aliases(parser: *mut yaml_parser_t) {
let fresh15 = addr_of_mut!((*parser).aliases.start);
*fresh15 = *fresh14;
}
unsafe fn yaml_parser_load_document(
mut parser: *mut yaml_parser_t,
event: *mut yaml_event_t,
@ -206,6 +212,7 @@ unsafe fn yaml_parser_load_document(
ctx.start = ctx.top;
1_i32
}
unsafe fn yaml_parser_load_nodes(
mut parser: *mut yaml_parser_t,
ctx: *mut loader_ctx,
@ -262,6 +269,7 @@ unsafe fn yaml_parser_load_nodes(
(*(*parser).document).end_mark = (*event).end_mark;
1_i32
}
unsafe fn yaml_parser_register_anchor(
mut parser: *mut yaml_parser_t,
index: libc::c_int,
@ -317,6 +325,7 @@ unsafe fn yaml_parser_register_anchor(
}
1_i32
}
unsafe fn yaml_parser_load_node_add(
mut parser: *mut yaml_parser_t,
ctx: *mut loader_ctx,
@ -429,6 +438,7 @@ unsafe fn yaml_parser_load_node_add(
}
1_i32
}
unsafe fn yaml_parser_load_alias(
parser: *mut yaml_parser_t,
event: *mut yaml_event_t,
@ -455,6 +465,7 @@ unsafe fn yaml_parser_load_alias(
(*event).start_mark,
)
}
unsafe fn yaml_parser_load_scalar(
mut parser: *mut yaml_parser_t,
event: *mut yaml_event_t,
@ -542,6 +553,7 @@ unsafe fn yaml_parser_load_scalar(
yaml_free((*event).data.scalar.value as *mut libc::c_void);
0_i32
}
unsafe fn yaml_parser_load_sequence(
mut parser: *mut yaml_parser_t,
event: *mut yaml_event_t,
@ -690,6 +702,7 @@ unsafe fn yaml_parser_load_sequence(
yaml_free((*event).data.sequence_start.anchor as *mut libc::c_void);
0_i32
}
unsafe fn yaml_parser_load_sequence_end(
parser: *mut yaml_parser_t,
event: *mut yaml_event_t,
@ -708,6 +721,7 @@ unsafe fn yaml_parser_load_sequence_end(
*fresh31 = (*fresh31).wrapping_offset(-1);
1_i32
}
unsafe fn yaml_parser_load_mapping(
mut parser: *mut yaml_parser_t,
event: *mut yaml_event_t,
@ -856,6 +870,7 @@ unsafe fn yaml_parser_load_mapping(
yaml_free((*event).data.mapping_start.anchor as *mut libc::c_void);
0_i32
}
unsafe fn yaml_parser_load_mapping_end(
parser: *mut yaml_parser_t,
event: *mut yaml_event_t,

View file

@ -30,6 +30,7 @@ use crate::{
};
use core::mem::size_of;
use core::ptr::{self, addr_of_mut};
/// Parse the input stream and produce the next parsing event.
///
/// Call the function subsequently to produce a sequence of events corresponding
@ -63,6 +64,7 @@ pub unsafe fn yaml_parser_parse(
}
yaml_parser_state_machine(parser, event)
}
unsafe fn yaml_parser_set_parser_error(
mut parser: *mut yaml_parser_t,
problem: *const libc::c_char,
@ -74,6 +76,7 @@ unsafe fn yaml_parser_set_parser_error(
(*parser).problem_mark = problem_mark;
0_i32
}
unsafe fn yaml_parser_set_parser_error_context(
mut parser: *mut yaml_parser_t,
context: *const libc::c_char,
@ -90,6 +93,7 @@ unsafe fn yaml_parser_set_parser_error_context(
(*parser).problem_mark = problem_mark;
0_i32
}
unsafe fn yaml_parser_state_machine(
parser: *mut yaml_parser_t,
event: *mut yaml_event_t,
@ -140,6 +144,7 @@ unsafe fn yaml_parser_state_machine(
}
0_i32
}
unsafe fn yaml_parser_parse_stream_start(
mut parser: *mut yaml_parser_t,
mut event: *mut yaml_event_t,
@ -180,6 +185,7 @@ unsafe fn yaml_parser_parse_stream_start(
*fresh4 = (*fresh4).wrapping_offset(1);
1_i32
}
unsafe fn yaml_parser_parse_document_start(
mut parser: *mut yaml_parser_t,
mut event: *mut yaml_event_t,
@ -383,6 +389,7 @@ unsafe fn yaml_parser_parse_document_start(
1_i32
}
}
unsafe fn yaml_parser_parse_document_content(
mut parser: *mut yaml_parser_t,
event: *mut yaml_event_t,
@ -411,6 +418,7 @@ unsafe fn yaml_parser_parse_document_content(
yaml_parser_parse_node(parser, event, 1_i32, 0_i32)
}
}
unsafe fn yaml_parser_parse_document_end(
mut parser: *mut yaml_parser_t,
mut event: *mut yaml_event_t,
@ -459,6 +467,7 @@ unsafe fn yaml_parser_parse_document_end(
(*event).data.document_end.implicit = implicit;
1_i32
}
unsafe fn yaml_parser_parse_node(
mut parser: *mut yaml_parser_t,
mut event: *mut yaml_event_t,
@ -911,6 +920,7 @@ unsafe fn yaml_parser_parse_node(
0_i32
}
}
unsafe fn yaml_parser_parse_block_sequence_entry(
mut parser: *mut yaml_parser_t,
mut event: *mut yaml_event_t,
@ -1040,6 +1050,7 @@ unsafe fn yaml_parser_parse_block_sequence_entry(
)
}
}
unsafe fn yaml_parser_parse_indentless_sequence_entry(
mut parser: *mut yaml_parser_t,
mut event: *mut yaml_event_t,
@ -1115,6 +1126,7 @@ unsafe fn yaml_parser_parse_indentless_sequence_entry(
1_i32
}
}
unsafe fn yaml_parser_parse_block_mapping_key(
mut parser: *mut yaml_parser_t,
mut event: *mut yaml_event_t,
@ -1245,6 +1257,7 @@ unsafe fn yaml_parser_parse_block_mapping_key(
)
}
}
unsafe fn yaml_parser_parse_block_mapping_value(
mut parser: *mut yaml_parser_t,
event: *mut yaml_event_t,
@ -1309,6 +1322,7 @@ unsafe fn yaml_parser_parse_block_mapping_value(
yaml_parser_process_empty_scalar(parser, event, (*token).start_mark)
}
}
unsafe fn yaml_parser_parse_flow_sequence_entry(
mut parser: *mut yaml_parser_t,
mut event: *mut yaml_event_t,
@ -1466,6 +1480,7 @@ unsafe fn yaml_parser_parse_flow_sequence_entry(
*fresh108 = (*fresh108).wrapping_offset(1);
1_i32
}
unsafe fn yaml_parser_parse_flow_sequence_entry_mapping_key(
mut parser: *mut yaml_parser_t,
event: *mut yaml_event_t,
@ -1518,6 +1533,7 @@ unsafe fn yaml_parser_parse_flow_sequence_entry_mapping_key(
yaml_parser_process_empty_scalar(parser, event, mark)
}
}
unsafe fn yaml_parser_parse_flow_sequence_entry_mapping_value(
mut parser: *mut yaml_parser_t,
event: *mut yaml_event_t,
@ -1577,6 +1593,7 @@ unsafe fn yaml_parser_parse_flow_sequence_entry_mapping_value(
(*parser).state = YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE;
yaml_parser_process_empty_scalar(parser, event, (*token).start_mark)
}
unsafe fn yaml_parser_parse_flow_sequence_entry_mapping_end(
mut parser: *mut yaml_parser_t,
mut event: *mut yaml_event_t,
@ -1601,6 +1618,7 @@ unsafe fn yaml_parser_parse_flow_sequence_entry_mapping_end(
(*event).end_mark = (*token).start_mark;
1_i32
}
unsafe fn yaml_parser_parse_flow_mapping_key(
mut parser: *mut yaml_parser_t,
mut event: *mut yaml_event_t,
@ -1781,6 +1799,7 @@ unsafe fn yaml_parser_parse_flow_mapping_key(
*fresh133 = (*fresh133).wrapping_offset(1);
1_i32
}
unsafe fn yaml_parser_parse_flow_mapping_value(
mut parser: *mut yaml_parser_t,
event: *mut yaml_event_t,
@ -1845,6 +1864,7 @@ unsafe fn yaml_parser_parse_flow_mapping_value(
(*parser).state = YAML_PARSE_FLOW_MAPPING_KEY_STATE;
yaml_parser_process_empty_scalar(parser, event, (*token).start_mark)
}
unsafe fn yaml_parser_process_empty_scalar(
mut parser: *mut yaml_parser_t,
mut event: *mut yaml_event_t,
@ -1876,6 +1896,7 @@ unsafe fn yaml_parser_process_empty_scalar(
(*event).data.scalar.style = YAML_PLAIN_SCALAR_STYLE;
1_i32
}
unsafe fn yaml_parser_process_directives(
mut parser: *mut yaml_parser_t,
version_directive_ref: *mut *mut yaml_version_directive_t,
@ -2097,6 +2118,7 @@ unsafe fn yaml_parser_process_directives(
tag_directives.start = tag_directives.top;
0_i32
}
unsafe fn yaml_parser_append_tag_directive(
mut parser: *mut yaml_parser_t,
value: yaml_tag_directive_t,

View file

@ -5,6 +5,7 @@ use crate::{
YAML_UTF16LE_ENCODING, YAML_UTF8_ENCODING,
};
use core::ptr::addr_of_mut;
unsafe fn yaml_parser_set_reader_error(
mut parser: *mut yaml_parser_t,
problem: *const libc::c_char,
@ -18,6 +19,7 @@ unsafe fn yaml_parser_set_reader_error(
(*parser).problem_value = value;
0_i32
}
unsafe fn yaml_parser_determine_encoding(mut parser: *mut yaml_parser_t) -> libc::c_int {
while (*parser).eof == 0
&& (((*parser).raw_buffer.last).c_offset_from((*parser).raw_buffer.pointer) as libc::c_long)
@ -73,6 +75,7 @@ unsafe fn yaml_parser_determine_encoding(mut parser: *mut yaml_parser_t) -> libc
}
1_i32
}
unsafe fn yaml_parser_update_raw_buffer(mut parser: *mut yaml_parser_t) -> libc::c_int {
let mut size_read: size_t = 0_u64;
if (*parser).raw_buffer.start == (*parser).raw_buffer.pointer
@ -122,6 +125,7 @@ unsafe fn yaml_parser_update_raw_buffer(mut parser: *mut yaml_parser_t) -> libc:
}
1_i32
}
pub(crate) unsafe fn yaml_parser_update_buffer(
parser: *mut yaml_parser_t,
length: size_t,

View file

@ -19,6 +19,7 @@ use crate::{
};
use core::mem::{size_of, MaybeUninit};
use core::ptr::{self, addr_of_mut};
/// Scan the input stream and produce the next token.
///
/// Call the function subsequently to produce a sequence of tokens corresponding
@ -64,6 +65,7 @@ pub unsafe fn yaml_parser_scan(
}
1_i32
}
unsafe fn yaml_parser_set_scanner_error(
mut parser: *mut yaml_parser_t,
context: *const libc::c_char,
@ -79,6 +81,7 @@ unsafe fn yaml_parser_set_scanner_error(
(*parser).problem_mark = (*parser).mark;
0_i32
}
pub(crate) unsafe fn yaml_parser_fetch_more_tokens(mut parser: *mut yaml_parser_t) -> libc::c_int {
let mut need_more_tokens: libc::c_int;
loop {
@ -112,6 +115,7 @@ pub(crate) unsafe fn yaml_parser_fetch_more_tokens(mut parser: *mut yaml_parser_
(*parser).token_available = 1_i32;
1_i32
}
unsafe fn yaml_parser_fetch_next_token(parser: *mut yaml_parser_t) -> libc::c_int {
if if (*parser).unread >= 1_u64 {
1_i32
@ -522,6 +526,7 @@ unsafe fn yaml_parser_fetch_next_token(parser: *mut yaml_parser_t) -> libc::c_in
b"found character that cannot start any token\0" as *const u8 as *const libc::c_char,
)
}
unsafe fn yaml_parser_stale_simple_keys(parser: *mut yaml_parser_t) -> libc::c_int {
let mut simple_key: *mut yaml_simple_key_t;
simple_key = (*parser).simple_keys.start;
@ -544,6 +549,7 @@ unsafe fn yaml_parser_stale_simple_keys(parser: *mut yaml_parser_t) -> libc::c_i
}
1_i32
}
unsafe fn yaml_parser_save_simple_key(parser: *mut yaml_parser_t) -> libc::c_int {
let required: libc::c_int = ((*parser).flow_level == 0
&& (*parser).indent as libc::c_long == (*parser).mark.column as ptrdiff_t)
@ -564,6 +570,7 @@ unsafe fn yaml_parser_save_simple_key(parser: *mut yaml_parser_t) -> libc::c_int
}
1_i32
}
unsafe fn yaml_parser_remove_simple_key(parser: *mut yaml_parser_t) -> libc::c_int {
let mut simple_key: *mut yaml_simple_key_t =
((*parser).simple_keys.top).wrapping_offset(-(1_isize));
@ -580,6 +587,7 @@ unsafe fn yaml_parser_remove_simple_key(parser: *mut yaml_parser_t) -> libc::c_i
(*simple_key).possible = 0_i32;
1_i32
}
unsafe fn yaml_parser_increase_flow_level(mut parser: *mut yaml_parser_t) -> libc::c_int {
let empty_simple_key = yaml_simple_key_t {
possible: 0_i32,
@ -618,6 +626,7 @@ unsafe fn yaml_parser_increase_flow_level(mut parser: *mut yaml_parser_t) -> lib
*fresh7 += 1;
1_i32
}
unsafe fn yaml_parser_decrease_flow_level(parser: *mut yaml_parser_t) -> libc::c_int {
if (*parser).flow_level != 0 {
let fresh8 = addr_of_mut!((*parser).flow_level);
@ -627,6 +636,7 @@ unsafe fn yaml_parser_decrease_flow_level(parser: *mut yaml_parser_t) -> libc::c
}
1_i32
}
unsafe fn yaml_parser_roll_indent(
mut parser: *mut yaml_parser_t,
column: ptrdiff_t,
@ -731,6 +741,7 @@ unsafe fn yaml_parser_roll_indent(
}
1_i32
}
unsafe fn yaml_parser_unroll_indent(
mut parser: *mut yaml_parser_t,
column: ptrdiff_t,
@ -775,6 +786,7 @@ unsafe fn yaml_parser_unroll_indent(
}
1_i32
}
unsafe fn yaml_parser_fetch_stream_start(mut parser: *mut yaml_parser_t) -> libc::c_int {
let simple_key = yaml_simple_key_t {
possible: 0_i32,
@ -841,6 +853,7 @@ unsafe fn yaml_parser_fetch_stream_start(mut parser: *mut yaml_parser_t) -> libc
}
1_i32
}
unsafe fn yaml_parser_fetch_stream_end(mut parser: *mut yaml_parser_t) -> libc::c_int {
let mut token = MaybeUninit::<yaml_token_t>::uninit();
let token = token.as_mut_ptr();
@ -886,6 +899,7 @@ unsafe fn yaml_parser_fetch_stream_end(mut parser: *mut yaml_parser_t) -> libc::
}
1_i32
}
unsafe fn yaml_parser_fetch_directive(mut parser: *mut yaml_parser_t) -> libc::c_int {
let mut token = MaybeUninit::<yaml_token_t>::uninit();
let token = token.as_mut_ptr();
@ -922,6 +936,7 @@ unsafe fn yaml_parser_fetch_directive(mut parser: *mut yaml_parser_t) -> libc::c
}
1_i32
}
unsafe fn yaml_parser_fetch_document_indicator(
mut parser: *mut yaml_parser_t,
type_: yaml_token_type_t,
@ -1048,6 +1063,7 @@ unsafe fn yaml_parser_fetch_document_indicator(
}
1_i32
}
unsafe fn yaml_parser_fetch_flow_collection_start(
mut parser: *mut yaml_parser_t,
type_: yaml_token_type_t,
@ -1120,6 +1136,7 @@ unsafe fn yaml_parser_fetch_flow_collection_start(
}
1_i32
}
unsafe fn yaml_parser_fetch_flow_collection_end(
mut parser: *mut yaml_parser_t,
type_: yaml_token_type_t,
@ -1192,6 +1209,7 @@ unsafe fn yaml_parser_fetch_flow_collection_end(
}
1_i32
}
unsafe fn yaml_parser_fetch_flow_entry(mut parser: *mut yaml_parser_t) -> libc::c_int {
let mut token = MaybeUninit::<yaml_token_t>::uninit();
let token = token.as_mut_ptr();
@ -1258,6 +1276,7 @@ unsafe fn yaml_parser_fetch_flow_entry(mut parser: *mut yaml_parser_t) -> libc::
}
1_i32
}
unsafe fn yaml_parser_fetch_block_entry(mut parser: *mut yaml_parser_t) -> libc::c_int {
let mut token = MaybeUninit::<yaml_token_t>::uninit();
let token = token.as_mut_ptr();
@ -1345,6 +1364,7 @@ unsafe fn yaml_parser_fetch_block_entry(mut parser: *mut yaml_parser_t) -> libc:
}
1_i32
}
unsafe fn yaml_parser_fetch_key(mut parser: *mut yaml_parser_t) -> libc::c_int {
let mut token = MaybeUninit::<yaml_token_t>::uninit();
let token = token.as_mut_ptr();
@ -1432,6 +1452,7 @@ unsafe fn yaml_parser_fetch_key(mut parser: *mut yaml_parser_t) -> libc::c_int {
}
1_i32
}
unsafe fn yaml_parser_fetch_value(mut parser: *mut yaml_parser_t) -> libc::c_int {
let mut token = MaybeUninit::<yaml_token_t>::uninit();
let token = token.as_mut_ptr();
@ -1578,6 +1599,7 @@ unsafe fn yaml_parser_fetch_value(mut parser: *mut yaml_parser_t) -> libc::c_int
}
1_i32
}
unsafe fn yaml_parser_fetch_anchor(
mut parser: *mut yaml_parser_t,
type_: yaml_token_type_t,
@ -1614,6 +1636,7 @@ unsafe fn yaml_parser_fetch_anchor(
}
1_i32
}
unsafe fn yaml_parser_fetch_tag(mut parser: *mut yaml_parser_t) -> libc::c_int {
let mut token = MaybeUninit::<yaml_token_t>::uninit();
let token = token.as_mut_ptr();
@ -1647,6 +1670,7 @@ unsafe fn yaml_parser_fetch_tag(mut parser: *mut yaml_parser_t) -> libc::c_int {
}
1_i32
}
unsafe fn yaml_parser_fetch_block_scalar(
mut parser: *mut yaml_parser_t,
literal: libc::c_int,
@ -1683,6 +1707,7 @@ unsafe fn yaml_parser_fetch_block_scalar(
}
1_i32
}
unsafe fn yaml_parser_fetch_flow_scalar(
mut parser: *mut yaml_parser_t,
single: libc::c_int,
@ -1719,6 +1744,7 @@ unsafe fn yaml_parser_fetch_flow_scalar(
}
1_i32
}
unsafe fn yaml_parser_fetch_plain_scalar(mut parser: *mut yaml_parser_t) -> libc::c_int {
let mut token = MaybeUninit::<yaml_token_t>::uninit();
let token = token.as_mut_ptr();
@ -1752,6 +1778,7 @@ unsafe fn yaml_parser_fetch_plain_scalar(mut parser: *mut yaml_parser_t) -> libc
}
1_i32
}
unsafe fn yaml_parser_scan_to_next_token(mut parser: *mut yaml_parser_t) -> libc::c_int {
loop {
if if (*parser).unread >= 1_u64 {
@ -2029,6 +2056,7 @@ unsafe fn yaml_parser_scan_to_next_token(mut parser: *mut yaml_parser_t) -> libc
}
1_i32
}
unsafe fn yaml_parser_scan_directive(
mut parser: *mut yaml_parser_t,
mut token: *mut yaml_token_t,
@ -2525,6 +2553,7 @@ unsafe fn yaml_parser_scan_directive(
yaml_free(name as *mut libc::c_void);
0_i32
}
unsafe fn yaml_parser_scan_directive_name(
mut parser: *mut yaml_parser_t,
start_mark: yaml_mark_t,
@ -2740,6 +2769,7 @@ unsafe fn yaml_parser_scan_directive_name(
string.start = string.pointer;
0_i32
}
unsafe fn yaml_parser_scan_version_directive_value(
parser: *mut yaml_parser_t,
start_mark: yaml_mark_t,
@ -2841,6 +2871,7 @@ unsafe fn yaml_parser_scan_version_directive_value(
}
1_i32
}
unsafe fn yaml_parser_scan_version_directive_number(
parser: *mut yaml_parser_t,
start_mark: yaml_mark_t,
@ -2921,6 +2952,7 @@ unsafe fn yaml_parser_scan_version_directive_number(
*number = value;
1_i32
}
unsafe fn yaml_parser_scan_tag_directive_value(
parser: *mut yaml_parser_t,
start_mark: yaml_mark_t,
@ -3163,6 +3195,7 @@ unsafe fn yaml_parser_scan_tag_directive_value(
}
}
}
unsafe fn yaml_parser_scan_anchor(
mut parser: *mut yaml_parser_t,
mut token: *mut yaml_token_t,
@ -3456,6 +3489,7 @@ unsafe fn yaml_parser_scan_anchor(
string.start = string.pointer;
0_i32
}
unsafe fn yaml_parser_scan_tag(
parser: *mut yaml_parser_t,
mut token: *mut yaml_token_t,
@ -3738,6 +3772,7 @@ unsafe fn yaml_parser_scan_tag(
yaml_free(suffix as *mut libc::c_void);
0_i32
}
unsafe fn yaml_parser_scan_tag_handle(
mut parser: *mut yaml_parser_t,
directive: libc::c_int,
@ -4149,6 +4184,7 @@ unsafe fn yaml_parser_scan_tag_handle(
string.start = string.pointer;
0_i32
}
unsafe fn yaml_parser_scan_tag_uri(
mut parser: *mut yaml_parser_t,
uri_char: libc::c_int,
@ -4461,6 +4497,7 @@ unsafe fn yaml_parser_scan_tag_uri(
}
}
}
unsafe fn yaml_parser_scan_uri_escapes(
parser: *mut yaml_parser_t,
directive: libc::c_int,
@ -4687,6 +4724,7 @@ unsafe fn yaml_parser_scan_uri_escapes(
}
1_i32
}
unsafe fn yaml_parser_scan_block_scalar(
mut parser: *mut yaml_parser_t,
mut token: *mut yaml_token_t,
@ -6054,6 +6092,7 @@ unsafe fn yaml_parser_scan_block_scalar(
trailing_breaks.start = trailing_breaks.pointer;
0_i32
}
unsafe fn yaml_parser_scan_block_scalar_breaks(
mut parser: *mut yaml_parser_t,
indent: *mut libc::c_int,
@ -6287,6 +6326,7 @@ unsafe fn yaml_parser_scan_block_scalar_breaks(
}
1_i32
}
unsafe fn yaml_parser_scan_flow_scalar(
mut parser: *mut yaml_parser_t,
mut token: *mut yaml_token_t,
@ -8229,6 +8269,7 @@ unsafe fn yaml_parser_scan_flow_scalar(
whitespaces.start = whitespaces.pointer;
0_i32
}
unsafe fn yaml_parser_scan_plain_scalar(
mut parser: *mut yaml_parser_t,
mut token: *mut yaml_token_t,

View file

@ -3,6 +3,7 @@ use crate::{
libc, yaml_emitter_t, PointerExt, YAML_UTF16LE_ENCODING, YAML_UTF8_ENCODING, YAML_WRITER_ERROR,
};
use core::ptr::addr_of_mut;
unsafe fn yaml_emitter_set_writer_error(
mut emitter: *mut yaml_emitter_t,
problem: *const libc::c_char,
@ -12,6 +13,7 @@ unsafe fn yaml_emitter_set_writer_error(
*fresh0 = problem;
0_i32
}
/// Flush the accumulated characters to the output.
///
/// Returns 1 if the function succeeded, 0 on error.

View file

@ -1,10 +1,12 @@
use crate::libc;
pub use self::{
yaml_break_t::*, yaml_emitter_state_t::*, yaml_encoding_t::*, yaml_error_type_t::*,
yaml_event_type_t::*, yaml_mapping_style_t::*, yaml_node_type_t::*, yaml_parser_state_t::*,
yaml_scalar_style_t::*, yaml_sequence_style_t::*, yaml_token_type_t::*,
};
use crate::libc;
pub use core::primitive::{i64 as ptrdiff_t, u64 as size_t, u8 as yaml_char_t};
/// The version directive data.
#[derive(Copy, Clone)]
#[repr(C)]
@ -15,6 +17,7 @@ pub struct yaml_version_directive_t {
/// The minor version number.
pub minor: libc::c_int,
}
/// The tag directive data.
#[derive(Copy, Clone)]
#[repr(C)]
@ -25,6 +28,7 @@ pub struct yaml_tag_directive_t {
/// The tag prefix.
pub prefix: *mut yaml_char_t,
}
/// The stream encoding.
#[derive(Copy, Clone)]
#[repr(u32)]
@ -39,6 +43,7 @@ pub enum yaml_encoding_t {
/// The UTF-16-BE encoding with BOM.
YAML_UTF16BE_ENCODING = 3,
}
/// Line break type.
#[derive(Copy, Clone)]
#[repr(u32)]
@ -53,6 +58,7 @@ pub enum yaml_break_t {
/// Use CR LN for line breaks (DOS style).
YAML_CRLN_BREAK = 3,
}
/// Many bad things could happen with the parser and emitter.
#[derive(Copy, Clone)]
#[repr(u32)]
@ -75,6 +81,7 @@ pub enum yaml_error_type_t {
/// Cannot emit a YAML stream.
YAML_EMITTER_ERROR = 7,
}
/// The pointer position.
#[derive(Copy, Clone)]
#[repr(C)]
@ -87,6 +94,7 @@ pub struct yaml_mark_t {
/// The position column.
pub column: size_t,
}
/// Scalar styles.
#[derive(Copy, Clone)]
#[repr(u32)]
@ -105,6 +113,7 @@ pub enum yaml_scalar_style_t {
/// The folded scalar style.
YAML_FOLDED_SCALAR_STYLE = 5,
}
/// Sequence styles.
#[derive(Copy, Clone)]
#[repr(u32)]
@ -117,6 +126,7 @@ pub enum yaml_sequence_style_t {
/// The flow sequence style.
YAML_FLOW_SEQUENCE_STYLE = 2,
}
/// Mapping styles.
#[derive(Copy, Clone)]
#[repr(u32)]
@ -129,6 +139,7 @@ pub enum yaml_mapping_style_t {
/// The flow mapping style.
YAML_FLOW_MAPPING_STYLE = 2,
}
/// Token types.
#[derive(Copy, Clone)]
#[repr(u32)]
@ -179,6 +190,7 @@ pub enum yaml_token_type_t {
/// A SCALAR token.
YAML_SCALAR_TOKEN = 21,
}
/// The token structure.
#[derive(Copy, Clone)]
#[repr(C)]
@ -193,6 +205,7 @@ pub struct yaml_token_t {
/// The end of the token.
pub end_mark: yaml_mark_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union unnamed_yaml_token_t_data {
@ -211,6 +224,7 @@ pub union unnamed_yaml_token_t_data {
/// The tag directive (for YAML_TAG_DIRECTIVE_TOKEN).
pub tag_directive: unnamed_yaml_token_t_data_tag_directive,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -218,6 +232,7 @@ pub struct unnamed_yaml_token_t_data_stream_start {
/// The stream encoding.
pub encoding: yaml_encoding_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -225,6 +240,7 @@ pub struct unnamed_yaml_token_t_data_alias {
/// The alias value.
pub value: *mut yaml_char_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -232,6 +248,7 @@ pub struct unnamed_yaml_token_t_data_anchor {
/// The anchor value.
pub value: *mut yaml_char_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -241,6 +258,7 @@ pub struct unnamed_yaml_token_t_data_tag {
/// The tag suffix.
pub suffix: *mut yaml_char_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -252,6 +270,7 @@ pub struct unnamed_yaml_token_t_data_scalar {
/// The scalar style.
pub style: yaml_scalar_style_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -261,6 +280,7 @@ pub struct unnamed_yaml_token_t_data_version_directive {
/// The minor version number.
pub minor: libc::c_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -270,6 +290,7 @@ pub struct unnamed_yaml_token_t_data_tag_directive {
/// The tag prefix.
pub prefix: *mut yaml_char_t,
}
/// Event types.
#[derive(Copy, Clone)]
#[repr(u32)]
@ -298,6 +319,7 @@ pub enum yaml_event_type_t {
/// A MAPPING-END event.
YAML_MAPPING_END_EVENT = 10,
}
/// The event structure.
#[derive(Copy, Clone)]
#[repr(C)]
@ -312,6 +334,7 @@ pub struct yaml_event_t {
/// The end of the event.
pub end_mark: yaml_mark_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union unnamed_yaml_event_t_data {
@ -330,6 +353,7 @@ pub union unnamed_yaml_event_t_data {
/// The mapping parameters (for YAML_MAPPING_START_EVENT).
pub mapping_start: unnamed_yaml_event_t_data_mapping_start,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -337,6 +361,7 @@ pub struct unnamed_yaml_event_t_data_stream_start {
/// The document encoding.
pub encoding: yaml_encoding_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -348,6 +373,7 @@ pub struct unnamed_yaml_event_t_data_document_start {
/// Is the document indicator implicit?
pub implicit: libc::c_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -357,6 +383,7 @@ pub struct unnamed_yaml_event_t_data_document_start_tag_directives {
/// The end of the tag directives list.
pub end: *mut yaml_tag_directive_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -364,6 +391,7 @@ pub struct unnamed_yaml_event_t_data_document_end {
/// Is the document end indicator implicit?
pub implicit: libc::c_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -371,6 +399,7 @@ pub struct unnamed_yaml_event_t_data_alias {
/// The anchor.
pub anchor: *mut yaml_char_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -390,6 +419,7 @@ pub struct unnamed_yaml_event_t_data_scalar {
/// The scalar style.
pub style: yaml_scalar_style_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -403,6 +433,7 @@ pub struct unnamed_yaml_event_t_data_sequence_start {
/// The sequence style.
pub style: yaml_sequence_style_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -416,6 +447,7 @@ pub struct unnamed_yaml_event_t_data_mapping_start {
/// The mapping style.
pub style: yaml_mapping_style_t,
}
/// Node types.
#[derive(Copy, Clone)]
#[repr(u32)]
@ -430,6 +462,7 @@ pub enum yaml_node_type_t {
/// A mapping node.
YAML_MAPPING_NODE = 3,
}
/// The node structure.
#[derive(Copy, Clone)]
#[repr(C)]
@ -446,6 +479,7 @@ pub struct yaml_node_t {
/// The end of the node.
pub end_mark: yaml_mark_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub union unnamed_yaml_node_t_data {
@ -456,6 +490,7 @@ pub union unnamed_yaml_node_t_data {
/// The mapping parameters (for YAML_MAPPING_NODE).
pub mapping: unnamed_yaml_node_t_data_mapping,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -467,8 +502,10 @@ pub struct unnamed_yaml_node_t_data_scalar {
/// The scalar style.
pub style: yaml_scalar_style_t,
}
/// An element of a sequence node.
pub type yaml_node_item_t = libc::c_int;
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -478,6 +515,7 @@ pub struct unnamed_yaml_node_t_data_sequence {
/// The sequence style.
pub style: yaml_sequence_style_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -489,6 +527,7 @@ pub struct unnamed_yaml_node_t_data_sequence_items {
/// The top of the stack.
pub top: *mut yaml_node_item_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -498,6 +537,7 @@ pub struct unnamed_yaml_node_t_data_mapping {
/// The mapping style.
pub style: yaml_mapping_style_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -509,6 +549,7 @@ pub struct unnamed_yaml_node_t_data_mapping_pairs {
/// The top of the stack.
pub top: *mut yaml_node_pair_t,
}
/// An element of a mapping node.
#[derive(Copy, Clone)]
#[repr(C)]
@ -519,6 +560,7 @@ pub struct yaml_node_pair_t {
/// The value of the element.
pub value: libc::c_int,
}
/// The document structure.
#[derive(Copy, Clone)]
#[repr(C)]
@ -539,6 +581,7 @@ pub struct yaml_document_t {
/// The end of the document.
pub end_mark: yaml_mark_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -550,6 +593,7 @@ pub struct unnamed_yaml_document_t_nodes {
/// The top of the stack.
pub top: *mut yaml_node_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -559,6 +603,7 @@ pub struct unnamed_yaml_document_t_tag_directives {
/// The end of the tag directives list.
pub end: *mut yaml_tag_directive_t,
}
/// The prototype of a read handler.
///
/// The read handler is called when the parser needs to read more bytes from the
@ -574,6 +619,7 @@ pub type yaml_read_handler_t = unsafe fn(
size: size_t,
size_read: *mut size_t,
) -> libc::c_int;
/// This structure holds information about a potential simple key.
#[derive(Copy, Clone)]
#[repr(C)]
@ -588,6 +634,7 @@ pub struct yaml_simple_key_t {
/// The position mark.
pub mark: yaml_mark_t,
}
/// The states of the parser.
#[derive(Copy, Clone)]
#[repr(u32)]
@ -642,6 +689,7 @@ pub enum yaml_parser_state_t {
/// Expect nothing.
YAML_PARSE_END_STATE = 23,
}
/// This structure holds aliases data.
#[derive(Copy, Clone)]
#[repr(C)]
@ -654,6 +702,7 @@ pub struct yaml_alias_data_t {
/// The anchor mark.
pub mark: yaml_mark_t,
}
/// The parser structure.
///
/// All members are internal. Manage the structure using the `yaml_parser_`
@ -731,12 +780,14 @@ pub struct yaml_parser_t {
/// The currently parsed document.
pub(crate) document: *mut yaml_document_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub(crate) union unnamed_yaml_parser_t_input {
/// String input data.
pub string: unnamed_yaml_parser_t_input_string,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -748,6 +799,7 @@ pub(crate) struct unnamed_yaml_parser_t_input_string {
/// The string current position.
pub current: *const libc::c_uchar,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -761,6 +813,7 @@ pub(crate) struct unnamed_yaml_parser_t_buffer {
/// The last filled position of the buffer.
pub last: *mut yaml_char_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -774,6 +827,7 @@ pub(crate) struct unnamed_yaml_parser_t_raw_buffer {
/// The last filled position of the buffer.
pub last: *mut libc::c_uchar,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -787,6 +841,7 @@ pub(crate) struct unnamed_yaml_parser_t_tokens {
/// The tail of the tokens queue.
pub tail: *mut yaml_token_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -798,6 +853,7 @@ pub(crate) struct unnamed_yaml_parser_t_indents {
/// The top of the stack.
pub top: *mut libc::c_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -809,6 +865,7 @@ pub(crate) struct unnamed_yaml_parser_t_simple_keys {
/// The top of the stack.
pub top: *mut yaml_simple_key_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -820,6 +877,7 @@ pub(crate) struct unnamed_yaml_parser_t_states {
/// The top of the stack.
pub top: *mut yaml_parser_state_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -831,6 +889,7 @@ pub(crate) struct unnamed_yaml_parser_t_marks {
/// The top of the stack.
pub top: *mut yaml_mark_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -842,6 +901,7 @@ pub(crate) struct unnamed_yaml_parser_t_tag_directives {
/// The top of the list.
pub top: *mut yaml_tag_directive_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -853,6 +913,7 @@ pub(crate) struct unnamed_yaml_parser_t_aliases {
/// The top of the list.
pub top: *mut yaml_alias_data_t,
}
/// The prototype of a write handler.
///
/// The write handler is called when the emitter needs to flush the accumulated
@ -863,6 +924,7 @@ pub(crate) struct unnamed_yaml_parser_t_aliases {
/// value should be 0.
pub type yaml_write_handler_t =
unsafe fn(data: *mut libc::c_void, buffer: *mut libc::c_uchar, size: size_t) -> libc::c_int;
/// The emitter states.
#[derive(Copy, Clone)]
#[repr(u32)]
@ -905,6 +967,7 @@ pub enum yaml_emitter_state_t {
/// Expect nothing.
YAML_EMIT_END_STATE = 17,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -916,6 +979,7 @@ pub(crate) struct yaml_anchors_t {
/// If the node has been emitted?
pub serialized: libc::c_int,
}
/// The emitter structure.
///
/// All members are internal. Manage the structure using the `yaml_emitter_`
@ -1001,12 +1065,14 @@ pub struct yaml_emitter_t {
/// The currently emitted document.
pub(crate) document: *mut yaml_document_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
pub(crate) union unnamed_yaml_emitter_t_output {
/// String output data.
pub string: unnamed_yaml_emitter_t_output_string,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -1018,6 +1084,7 @@ pub(crate) struct unnamed_yaml_emitter_t_output_string {
/// The number of written bytes.
pub size_written: *mut size_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -1031,6 +1098,7 @@ pub(crate) struct unnamed_yaml_emitter_t_buffer {
/// The last filled position of the buffer.
pub last: *mut yaml_char_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -1044,6 +1112,7 @@ pub(crate) struct unnamed_yaml_emitter_t_raw_buffer {
/// The last filled position of the buffer.
pub last: *mut libc::c_uchar,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -1055,6 +1124,7 @@ pub(crate) struct unnamed_yaml_emitter_t_states {
/// The top of the stack.
pub top: *mut yaml_emitter_state_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -1068,6 +1138,7 @@ pub(crate) struct unnamed_yaml_emitter_t_events {
/// The tail of the event queue.
pub tail: *mut yaml_event_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -1079,6 +1150,7 @@ pub(crate) struct unnamed_yaml_emitter_t_indents {
/// The top of the stack.
pub top: *mut libc::c_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -1090,6 +1162,7 @@ pub(crate) struct unnamed_yaml_emitter_t_tag_directives {
/// The top of the list.
pub top: *mut yaml_tag_directive_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -1101,6 +1174,7 @@ pub(crate) struct unnamed_yaml_emitter_t_anchor_data {
/// Is it an alias?
pub alias: libc::c_int,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -1114,6 +1188,7 @@ pub(crate) struct unnamed_yaml_emitter_t_tag_data {
/// The tag suffix length.
pub suffix_length: size_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]
@ -1135,6 +1210,7 @@ pub(crate) struct unnamed_yaml_emitter_t_scalar_data {
/// The output style.
pub style: yaml_scalar_style_t,
}
#[derive(Copy, Clone)]
#[repr(C)]
#[non_exhaustive]