! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_stream_start_event_initialize ( yaml_event_t *event,
yaml_encoding_t encoding ) ;
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_stream_end_event_initialize ( yaml_event_t *event ) ;
! /**
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_document_start_event_initialize ( yaml_event_t *event,
yaml_version_directive_t *version_directive,
yaml_tag_directive_t *tag_directives_start,
yaml_tag_directive_t *tag_directives_end,
- int implicit ) ;
+ bool implicit ) ;
! /**
! * Create the DOCUMENT-END event.
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
-yaml_document_end_event_initialize ( yaml_event_t *event, int implicit ) ;
+FUNCTION: bool
+yaml_document_end_event_initialize ( yaml_event_t *event, bool implicit ) ;
! /**
! * Create an ALIAS event.
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_alias_event_initialize ( yaml_event_t *event, c-string anchor ) ;
! /**
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_scalar_event_initialize ( yaml_event_t *event,
c-string anchor, c-string tag,
c-string value, int length,
- int plain_implicit, int quoted_implicit,
+ bool plain_implicit, bool quoted_implicit,
yaml_scalar_style_t style ) ;
! /**
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_sequence_start_event_initialize ( yaml_event_t *event,
- c-string anchor, c-string tag, int implicit,
+ c-string anchor, c-string tag, bool implicit,
yaml_sequence_style_t style ) ;
! /**
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_sequence_end_event_initialize ( yaml_event_t *event ) ;
! /**
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_mapping_start_event_initialize ( yaml_event_t *event,
- c-string anchor, c-string tag, int implicit,
+ c-string anchor, c-string tag, bool implicit,
yaml_mapping_style_t style ) ;
! /**
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_mapping_end_event_initialize ( yaml_event_t *event ) ;
! /**
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_document_initialize ( yaml_document_t *document,
yaml_version_directive_t *version_directive,
yaml_tag_directive_t *tag_directives_start,
yaml_tag_directive_t *tag_directives_end,
- int start_implicit, int end_implicit ) ;
+ bool start_implicit, bool end_implicit ) ;
! /**
! * Delete a YAML document and all its nodes.
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_document_append_sequence_item ( yaml_document_t *document,
int sequence, int item ) ;
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_document_append_mapping_pair ( yaml_document_t *document,
int mapping, int key, int value ) ;
! * @a size_read to @c 0 and return @c 1.
! */
-CALLBACK: int yaml_read_handler_t ( void *data, uchar *buffer, size_t size,
+CALLBACK: bool yaml_read_handler_t ( void *data, uchar *buffer, size_t size,
size_t *size_read ) ;
! /**
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_parser_initialize ( yaml_parser_t *parser ) ;
! /**
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_parser_scan ( yaml_parser_t *parser, yaml_token_t *token ) ;
! /**
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_parser_parse ( yaml_parser_t *parser, yaml_event_t *event ) ;
! /**
! * @return @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_parser_load ( yaml_parser_t *parser, yaml_document_t *document ) ;
! /** @} */
! * the returned value should be @c 0.
! */
-CALLBACK: int yaml_write_handler_t ( void *data, uchar *buffer, size_t size ) ;
+CALLBACK: bool yaml_write_handler_t ( void *data, uchar *buffer, size_t size ) ;
! /** The emitter states. */
ENUM: yaml_emitter_state_t
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_emitter_initialize ( yaml_emitter_t *emitter ) ;
! /**
! */
FUNCTION: void
-yaml_emitter_set_canonical ( yaml_emitter_t *emitter, int canonical ) ;
+yaml_emitter_set_canonical ( yaml_emitter_t *emitter, bool canonical ) ;
! /**
! * Set the intendation increment.
! */
FUNCTION: void
-yaml_emitter_set_unicode ( yaml_emitter_t *emitter, int unicode ) ;
+yaml_emitter_set_unicode ( yaml_emitter_t *emitter, bool unicode ) ;
! /**
! * Set the preferred line break.
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_emitter_emit ( yaml_emitter_t *emitter, yaml_event_t *event ) ;
! /**
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_emitter_open ( yaml_emitter_t *emitter ) ;
! /**
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_emitter_close ( yaml_emitter_t *emitter ) ;
! /**
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_emitter_dump ( yaml_emitter_t *emitter, yaml_document_t *document ) ;
! /**
! * @returns @c 1 if the function succeeded, @c 0 on error.
! */
-FUNCTION: int
+FUNCTION: bool
yaml_emitter_flush ( yaml_emitter_t *emitter ) ;
! /** @} */
<PRIVATE
-: yaml-assert-ok ( n -- ) 0 = [ "yaml error" throw ] when ;
+: yaml-assert-ok ( ? -- ) [ "yaml error" throw ] unless ;
: event>scalar ( event -- obj )
data>> scalar>> value>> ;
GENERIC: emit-value ( emitter event obj -- )
M:: string emit-value ( emitter event string -- )
- event f YAML_STR_TAG string -1 0 0 0
+ event f YAML_STR_TAG string -1 f f YAML_ANY_SCALAR_STYLE
yaml_scalar_event_initialize yaml-assert-ok
emitter event yaml_emitter_emit yaml-assert-ok ;
:: emit-sequence-start ( emitter event -- )
- event f YAML_SEQ_TAG 0 0
+ event f YAML_SEQ_TAG f YAML_ANY_SEQUENCE_STYLE
yaml_sequence_start_event_initialize yaml-assert-ok
emitter event yaml_emitter_emit yaml-assert-ok ;
: emit-sequence-end ( emitter event -- )
[ drop emit-sequence-end ] 3tri ;
:: emit-assoc-start ( emitter event -- )
- event f YAML_MAP_TAG 0 0
+ event f YAML_MAP_TAG f YAML_ANY_MAPPING_STYLE
yaml_mapping_start_event_initialize yaml-assert-ok
emitter event yaml_emitter_emit yaml-assert-ok ;
: emit-assoc-end ( emitter event -- )
emitter event ;
:: emit-doc ( emitter event obj -- )
- event f f f 0 yaml_document_start_event_initialize yaml-assert-ok
+ event f f f f yaml_document_start_event_initialize yaml-assert-ok
emitter event yaml_emitter_emit yaml-assert-ok
emitter event obj emit-value
- event 0 yaml_document_end_event_initialize yaml-assert-ok
+ event f yaml_document_end_event_initialize yaml-assert-ok
emitter event yaml_emitter_emit yaml-assert-ok ;
! registers destructors (use with with-destructors)