]> andersk Git - libyaml.git/blobdiff - include/yaml.h
Add `const` qualifier for `yaml_parser_set_input_string` parameter `input`.
[libyaml.git] / include / yaml.h
index a4fc4e8afedde448625d311c8299de280ca5174b..afb62f077d538465b2d1a9d25ede1ed6c03d1bd2 100644 (file)
@@ -4,7 +4,7 @@
  * 
  * Include the header file with the code:
  * @code
- * #include <yaml/yaml.h>
+ * #include <yaml.h>
  * @endcode
  */
 
@@ -169,8 +169,8 @@ typedef enum {
     YAML_ANY_MAPPING_STYLE,
 
     YAML_BLOCK_MAPPING_STYLE,
-    YAML_FLOW_MAPPING_STYLE,
-    YAML_FLOW_SET_MAPPING_STYLE
+    YAML_FLOW_MAPPING_STYLE
+/*    YAML_FLOW_SET_MAPPING_STYLE   */
 } yaml_mapping_style_t;
 
 /** @} */
@@ -285,7 +285,7 @@ typedef struct {
 /**
  * Free any memory allocated for a token object.
  *
- * @param[in]   token   A token object.
+ * @param[in,out]   token   A token object.
  */
 
 YAML_DECLARE(void)
@@ -406,22 +406,484 @@ typedef struct {
 
     } data;
 
-    /** The beginning of the token. */
+    /** The beginning of the event. */
     yaml_mark_t start_mark;
-    /** The end of the token. */
+    /** The end of the event. */
     yaml_mark_t end_mark;
 
 } yaml_event_t;
 
+/**
+ * Create the STREAM-START event.
+ *
+ * @param[out]  event       An empty event object.
+ * @param[in]   encoding    The stream encoding.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_stream_start_event_initialize(yaml_event_t *event,
+        yaml_encoding_t encoding);
+
+/**
+ * Create the STREAM-END event.
+ *
+ * @param[out]  event       An empty event object.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_stream_end_event_initialize(yaml_event_t *event);
+
+/**
+ * Create the DOCUMENT-START event.
+ *
+ * The @a implicit argument is considered as a stylistic parameter and may be
+ * ignored by the emitter.
+ *
+ * @param[out]  event                   An empty event object.
+ * @param[in]   version_directive       The %YAML directive value or @c NULL.
+ * @param[in]   tag_directives_start    The beginning of the %TAG directives list.
+ * @param[in]   tag_directives_end      The end of the %TAG directives list.
+ * @param[in]   implicit                If the document start indicator is implicit.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+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);
+
+/**
+ * Create the DOCUMENT-END event.
+ *
+ * The @a implicit argument is considered as a stylistic parameter and may be
+ * ignored by the emitter.
+ *
+ * @param[out]  event       An empty event object.
+ * @param[in]   implicit    If the document end indicator is implicit.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_document_end_event_initialize(yaml_event_t *event, int implicit);
+
+/**
+ * Create an ALIAS event.
+ *
+ * @param[out]  event       An empty event object.
+ * @param[in]   anchor      The anchor value.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_alias_event_initialize(yaml_event_t *event, yaml_char_t *anchor);
+
+/**
+ * Create a SCALAR event.
+ *
+ * The @a style argument may be ignored by the emitter.
+ *
+ * Either the @a tag attribute or one of the @a plain_implicit and
+ * @a quoted_implicit flags must be set.
+ *
+ * @param[out]  event           An empty event object.
+ * @param[in]   anchor          The scalar anchor or @c NULL.
+ * @param[in]   tag             The scalar tag or @c NULL.
+ * @param[in]   value           The scalar value.
+ * @param[in]   length          The length of the scalar value.
+ * @param[in]   plain_implicit  If the tag may be omitted for the plain style.
+ * @param[in]   quoted_implicit If the tag may be omitted for any non-plain style.
+ * @param[in]   style           The scalar style.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_scalar_event_initialize(yaml_event_t *event,
+        yaml_char_t *anchor, yaml_char_t *tag,
+        yaml_char_t *value, int length,
+        int plain_implicit, int quoted_implicit,
+        yaml_scalar_style_t style);
+
+/**
+ * Create a SEQUENCE-START event.
+ *
+ * The @a style argument may be ignored by the emitter.
+ *
+ * Either the @a tag attribute or the @a implicit flag must be set.
+ *
+ * @param[out]  event       An empty event object.
+ * @param[in]   anchor      The sequence anchor or @c NULL.
+ * @param[in]   tag         The sequence tag or @c NULL.
+ * @param[in]   implicit    If the tag may be omitted.
+ * @param[in]   style       The sequence style.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_sequence_start_event_initialize(yaml_event_t *event,
+        yaml_char_t *anchor, yaml_char_t *tag, int implicit,
+        yaml_sequence_style_t style);
+
+/**
+ * Create a SEQUENCE-END event.
+ *
+ * @param[out]  event       An empty event object.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_sequence_end_event_initialize(yaml_event_t *event);
+
+/**
+ * Create a MAPPING-START event.
+ *
+ * The @a style argument may be ignored by the emitter.
+ *
+ * Either the @a tag attribute or the @a implicit flag must be set.
+ *
+ * @param[out]  event       An empty event object.
+ * @param[in]   anchor      The mapping anchor or @c NULL.
+ * @param[in]   tag         The mapping tag or @c NULL.
+ * @param[in]   implicit    If the tag may be omitted.
+ * @param[in]   style       The mapping style.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_mapping_start_event_initialize(yaml_event_t *event,
+        yaml_char_t *anchor, yaml_char_t *tag, int implicit,
+        yaml_mapping_style_t style);
+
+/**
+ * Create a MAPPING-END event.
+ *
+ * @param[out]  event       An empty event object.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_mapping_end_event_initialize(yaml_event_t *event);
+
 /**
  * Free any memory allocated for an event object.
  *
- * @param[in]   event   An event object.
+ * @param[out]  event   An event object.
  */
 
 YAML_DECLARE(void)
 yaml_event_delete(yaml_event_t *event);
 
+/**
+ * @defgroup nodes Nodes
+ * @{
+ */
+
+#define YAML_NULL_TAG       "tag:yaml.org,2002:null"
+#define YAML_BOOL_TAG       "tag:yaml.org,2002:bool"
+#define YAML_STR_TAG        "tag:yaml.org,2002:str"
+#define YAML_INT_TAG        "tag:yaml.org,2002:int"
+#define YAML_FLOAT_TAG      "tag:yaml.org,2002:float"
+#define YAML_TIMESTAMP_TAG  "tag:yaml.org,2002:timestamp"
+
+#define YAML_SEQ_TAG        "tag:yaml.org,2002:seq"
+#define YAML_MAP_TAG        "tag:yaml.org,2002:map"
+
+#define YAML_DEFAULT_SCALAR_TAG     YAML_STR_TAG
+#define YAML_DEFAULT_SEQUENCE_TAG   YAML_SEQ_TAG
+#define YAML_DEFAULT_MAPPING_STYLE  YAML_MAP_TAG
+
+/** Node types. */
+typedef enum {
+    YAML_NO_NODE,
+
+    YAML_SCALAR_NODE,
+    YAML_SEQUENCE_NODE,
+    YAML_MAPPING_NODE
+} yaml_node_type_t;
+
+#if 0
+
+typedef struct _yaml_node_t yaml_node_item_t;
+
+typedef struct {
+    yaml_node_item_t key;
+    yaml_node_item_t value;
+} yaml_node_pair_t;
+
+/** The node structure. */
+typedef struct _yaml_node_t {
+
+    /** The node type. */
+    yaml_node_type_t type;
+
+    /* The reference counter. */
+    int references;
+
+    /** The node data. */
+    union {
+        
+        /** The scalar parameters (for @c YAML_SCALAR_NODE). */
+        struct {
+            /** The tag. */
+            yaml_char_t *tag;
+            /** The scalar value. */
+            yaml_char_t *value;
+            /** The length of the scalar value. */
+            size_t length;
+            /** The scalar style. */
+            yaml_scalar_style_t style;
+        } scalar;
+
+        /** The sequence parameters (for @c YAML_SEQUENCE_NODE). */
+        struct {
+            /** The tag. */
+            yaml_char_t *tag;
+            /** The stack of sequence items. */
+            struct {
+                /** The beginning of the stack. */
+                struct yaml_node_item_t *start;
+                /** The end of the stack. */
+                struct yaml_node_item_t *end;
+                /** The top of the stack. */
+                struct yaml_node_item_t *top;
+            } items;
+            /** The sequence style. */
+            yaml_sequence_style_t style;
+        } sequence;
+
+        /** The mapping parameters (for @c YAML_MAPPING_NODE). */
+        struct {
+            /** The tag. */
+            yaml_char_t *tag;
+            /** The stack of mapping pairs. */
+            struct {
+                /** The beginning of the stack. */
+                struct yaml_node_pair_t *start;
+                /** The end of the stack. */
+                struct yaml_node_pair_t *end;
+                /** The top of the stack. */
+                struct yaml_node_pair_t *top;
+            } pairs;
+            /** The mapping style. */
+            yaml_mapping_style_t style;
+        } mapping;
+
+    } data;
+
+    /** The beginning of the node. */
+    yaml_mark_t start_mark;
+    /** The end of the node. */
+    yaml_mark_t end_mark;
+
+} yaml_node_t;
+
+/**
+ * Create a SCALAR node.
+ *
+ * The @a style argument may be ignored by the emitter.
+ *
+ * @param[out]  node            An empty node object.
+ * @param[in]   tag             The scalar tag.
+ * @param[in]   value           The scalar value.
+ * @param[in]   length          The length of the scalar value.
+ * @param[in]   style           The scalar style.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_scalar_node_initialize(yaml_node_t *node,
+        yaml_char_t *tag, yaml_char_t *value, int length,
+        yaml_scalar_style_t style);
+
+/**
+ * Create a SEQUENCE node.
+ *
+ * The @a style argument may be ignored by the emitter.
+ *
+ * @param[out]  node        An empty node object.
+ * @param[in]   tag         The sequence tag.
+ * @param[in]   style       The sequence style.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_sequence_node_initialize(yaml_node_t *node,
+        yaml_char_t *tag, yaml_sequence_style_t style);
+
+/**
+ * Add an item to a SEQUENCE node
+ *
+ * @param[out]  node        A sequence node.
+ * @param[in]   item        An item node.
+*
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_sequence_node_add_item(yaml_node_t *node, yaml_node_t *item)
+
+/**
+ * Create a SCALAR node and add it to a SEQUENCE node.
+ *
+ * @param[out]  node        A sequence node.
+ * @param[in]   tag         The scalar tag.
+ * @param[in]   value       The scalar value.
+ * @param[in]   length      The length of the scalar value.
+ * @param[in]   style       The scalar style.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_sequence_node_add_scalar_item(yaml_node_t *node,
+        yaml_char_t *tag, yaml_char_t *value, int length,
+        yaml_scalar_style_t style);
+
+/**
+ * Get the number of subnodes of a SEQUENCE node.
+ *
+ * @param[in]  node         A sequence node.
+ *
+ * @returns the number of subnodes.
+ */
+
+YAML_DECLARE(size_t)
+yaml_sequence_node_get_length(yaml_node_t *node);
+
+/**
+ * Get a subnode of a SEQUENCE node.
+ *
+ * @param[in]   node        A sequence node.
+ * @param[in]   index       The index of a subnode.
+ * @param[out]  item        A subnode.
+ */
+
+YAML_DECLARE(void)
+yaml_sequence_node_get_item(yaml_node_t *node, size_t index,
+        yaml_node_t *item);
+
+/**
+ * Create a MAPPING node.
+ *
+ * The @a style argument may be ignored by the emitter.
+ *
+ * @param[out]  node        An empty node object.
+ * @param[in]   tag         The mapping tag.
+ * @param[in]   style       The mapping style.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_mapping_node_initialize(yaml_node_t *node,
+        yaml_char_t *tag, yaml_mapping_style_t style);
+
+/**
+ * Add a key/value pair of nodes to a MAPPING node.
+ *
+ * @param[out]  node        A mapping node.
+ * @param[in]   key         A key node.
+ * @param[in]   value       A value node.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_mapping_node_add_pair(yaml_node_t *node,
+        yaml_node_t *key, yaml_node_t *value)
+
+/**
+ * Create a scalar key and add the key/value pair to a MAPPING node.
+ *
+ * @param[out]  node        A mapping node.
+ * @param[in]   key_tag     The key node tag.
+ * @param[in]   key_value   The key node value.
+ * @param[in]   key_length  The length of the key node value.
+ * @param[in]   key_style   The key node style.
+ * @param[in]   value       A value node.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_sequence_node_add_scalar_key_pair(yaml_node_t *node,
+        yaml_char_t *key_tag, yaml_char_t *key_value, int key_length,
+        yaml_scalar_style_t key_style,
+        yaml_node_t *value);
+
+/**
+ * Create a scalar key/value nodes and add the pair to a MAPPING node.
+ *
+ * @param[out]  node            A mapping node.
+ * @param[in]   key_tag         The key node tag.
+ * @param[in]   key_value       The key node value.
+ * @param[in]   key_length      The length of the key node value.
+ * @param[in]   key_style       The key node style.
+ * @param[in]   value_tag       The value node tag.
+ * @param[in]   value_value     The value node value.
+ * @param[in]   value_length    The length of the value node value.
+ * @param[in]   value_style     The value node style.
+ *
+ * @returns @c 1 if the function succeeded, @c 0 on error.
+ */
+
+YAML_DECLARE(int)
+yaml_sequence_node_add_scalar_pair(yaml_node_t *node,
+        yaml_char_t *key_tag, yaml_char_t *key_value, int key_length,
+        yaml_scalar_style_t key_style,
+        yaml_char_t *value_tag, yaml_char_t *value_value, int value_length,
+        yaml_scalar_style_t value_style);
+
+/**
+ * Get the number of subnode pairs of a MAPPING node.
+ *
+ * @param[in]  node         A mapping node.
+ *
+ * @returns the number of pairs.
+ */
+
+YAML_DECLARE(size_t)
+yaml_mapping_node_get_length(yaml_node_t *node);
+
+/**
+ * Get a subnode of a SEQUENCE node.
+ *
+ * @param[in]   node        A sequence node.
+ * @param[in]   index       The index of a subnode.
+ * @param[out]  key         The key subnode.
+ * @param[out]  value       The value subnode.
+ */
+
+YAML_DECLARE(void)
+yaml_mapping_node_get_pair(yaml_node_t *node, size_t index,
+        yaml_node_t *key, yaml_node_t *value);
+
+/**
+ * Delete a node and its subnodes.
+ *
+ * @param[out]  node    A node object.
+ */
+
+YAML_DECLARE(void)
+yaml_node_delete(yaml_node_t *node);
+
+#endif
+
 /** @} */
 
 /**
@@ -436,11 +898,11 @@ yaml_event_delete(yaml_event_t *event);
  * source.  The handler should write not more than @a size bytes to the @a
  * buffer.  The number of written bytes should be set to the @a length variable.
  *
- * @param[in]   data        A pointer to an application data specified by
- *                          @c yaml_parser_set_read_handler.
- * @param[out]  buffer      The buffer to write the data from the source.
- * @param[in]   size        The size of the buffer.
- * @param[out]  size_read   The actual number of bytes read from the source.
+ * @param[in,out]   data        A pointer to an application data specified by
+ *                              yaml_parser_set_input().
+ * @param[out]      buffer      The buffer to write the data from the source.
+ * @param[in]       size        The size of the buffer.
+ * @param[out]      size_read   The actual number of bytes read from the source.
  *
  * @returns On success, the handler should return @c 1.  If the handler failed,
  * the returned value should be @c 0.  On EOF, the handler should set the
@@ -547,11 +1009,11 @@ typedef struct {
         /** String input data. */
         struct {
             /** The string start pointer. */
-            unsigned char *start;
+            const unsigned char *start;
             /** The string end pointer. */
-            unsigned char *end;
+            const unsigned char *end;
             /** The string current position. */
-            unsigned char *current;
+            const unsigned char *current;
         } string;
 
         /** File input data. */
@@ -711,9 +1173,9 @@ typedef struct {
  * Initialize a parser.
  *
  * This function creates a new parser object.  An application is responsible
- * for destroying the object using the @c yaml_parser_delete function.
+ * for destroying the object using the yaml_parser_delete() function.
  *
- * @param[in]   parser  An empty parser object.
+ * @param[out]  parser  An empty parser object.
  *
  * @returns @c 1 if the function succeeded, @c 0 on error.
  */
@@ -724,7 +1186,7 @@ yaml_parser_initialize(yaml_parser_t *parser);
 /**
  * Destroy a parser.
  *
- * @param[in]   parser  A parser object.
+ * @param[in,out]   parser  A parser object.
  */
 
 YAML_DECLARE(void)
@@ -737,14 +1199,14 @@ yaml_parser_delete(yaml_parser_t *parser);
  * exists.  The application is responsible for destroing @a input after
  * destroying the @a parser.
  *
- * @param[in]   parser  A parser object.
- * @param[in]   input   A source data.
- * @param[in]   size    The length of the source data in bytes.
+ * @param[in,out]   parser  A parser object.
+ * @param[in]       input   A source data.
+ * @param[in]       size    The length of the source data in bytes.
  */
 
 YAML_DECLARE(void)
 yaml_parser_set_input_string(yaml_parser_t *parser,
-        unsigned char *input, size_t size);
+        const unsigned char *input, size_t size);
 
 /**
  * Set a file input.
@@ -752,8 +1214,8 @@ yaml_parser_set_input_string(yaml_parser_t *parser,
  * @a file should be a file object open for reading.  The application is
  * responsible for closing the @a file.
  *
- * @param[in]   parser  A parser object.
- * @param[in]   file    An open file.
+ * @param[in,out]   parser  A parser object.
+ * @param[in]       file    An open file.
  */
 
 YAML_DECLARE(void)
@@ -762,9 +1224,10 @@ yaml_parser_set_input_file(yaml_parser_t *parser, FILE *file);
 /**
  * Set a generic input handler.
  *
- * @param[in]   parser  A parser object.
- * @param[in]   handler A read handler.
- * @param[in]   data    Any application data for passing to the read handler.
+ * @param[in,out]   parser  A parser object.
+ * @param[in]       handler A read handler.
+ * @param[in]       data    Any application data for passing to the read
+ *                          handler.
  */
 
 YAML_DECLARE(void)
@@ -774,8 +1237,8 @@ yaml_parser_set_input(yaml_parser_t *parser,
 /**
  * Set the source encoding.
  *
- * @param[in]   parser      A parser object.
- * @param[in]   encoding    The source encoding.
+ * @param[in,out]   parser      A parser object.
+ * @param[in]       encoding    The source encoding.
  */
 
 YAML_DECLARE(void)
@@ -792,11 +1255,11 @@ yaml_parser_set_encoding(yaml_parser_t *parser, yaml_encoding_t encoding);
  * An application is responsible for freeing any buffers associated with the
  * produced token object using the @c yaml_token_delete function.
  *
- * An application must not alternate the calls of @c yaml_parser_scan with the
- * calls of @c yaml_parser_parse. Doing this will break the parser.
+ * An application must not alternate the calls of yaml_parser_scan() with the
+ * calls of yaml_parser_parse(). Doing this will break the parser.
  *
- * @param[in]   parser      A parser object.
- * @param[in]   token       An empty token object.
+ * @param[in,out]   parser      A parser object.
+ * @param[out]      token       An empty token object.
  *
  * @returns @c 1 if the function succeeded, @c 0 on error.
  */
@@ -813,13 +1276,13 @@ yaml_parser_scan(yaml_parser_t *parser, yaml_token_t *token);
  * @c YAML_STREAM_END_EVENT.
  *
  * An application is responsible for freeing any buffers associated with the
- * produced event object using the @c yaml_event_delete function.
+ * produced event object using the yaml_event_delete() function.
  *
- * An application must not alternate the calls of @c yaml_parser_scan with the
- * calls of @c yaml_parser_parse. Doing this will break the parser.
+ * An application must not alternate the calls of yaml_parser_scan() with the
+ * calls of yaml_parser_parse(). Doing this will break the parser.
  *
- * @param[in]   parser      A parser object.
- * @param[in]   event       An empty event object.
+ * @param[in,out]   parser      A parser object.
+ * @param[out]      event       An empty event object.
  *
  * @returns @c 1 if the function succeeded, @c 0 on error.
  */
@@ -841,10 +1304,10 @@ yaml_parser_parse(yaml_parser_t *parser, yaml_event_t *event);
  * characters to the output.  The handler should write @a size bytes of the
  * @a buffer to the output.
  *
- * @param[in]   data        A pointer to an application data specified by
- *                          @c yaml_emitter_set_write_handler.
- * @param[out]  buffer      The buffer with bytes to be written.
- * @param[in]   size        The size of the buffer.
+ * @param[in,out]   data        A pointer to an application data specified by
+ *                              yaml_emitter_set_output().
+ * @param[in]       buffer      The buffer with bytes to be written.
+ * @param[in]       size        The size of the buffer.
  *
  * @returns On success, the handler should return @c 1.  If the handler failed,
  * the returned value should be @c 0.
@@ -870,7 +1333,8 @@ typedef enum {
     YAML_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE,
     YAML_EMIT_BLOCK_MAPPING_KEY_STATE,
     YAML_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE,
-    YAML_EMIT_BLOCK_MAPPING_VALUE_STATE
+    YAML_EMIT_BLOCK_MAPPING_VALUE_STATE,
+    YAML_EMIT_END_STATE
 } yaml_emitter_state_t;
 
 /**
@@ -995,9 +1459,6 @@ typedef struct {
         yaml_event_t *tail;
     } events;
 
-    /** The current event. */
-    yaml_event_t event;
-
     /** The stack of indentation levels. */
     struct {
         /** The beginning of the stack. */
@@ -1042,6 +1503,48 @@ typedef struct {
     /** If the last character was an indentation character (' ', '-', '?', ':')? */
     int indention;
 
+    /** Anchor analysis. */
+    struct {
+        /** The anchor value. */
+        yaml_char_t *anchor;
+        /** The anchor length. */
+        size_t anchor_length;
+        /** Is it an alias? */
+        int alias;
+    } anchor_data;
+
+    /** Tag analysis. */
+    struct {
+        /** The tag handle. */
+        yaml_char_t *handle;
+        /** The tag handle length. */
+        size_t handle_length;
+        /** The tag suffix. */
+        yaml_char_t *suffix;
+        /** The tag suffix length. */
+        size_t suffix_length;
+    } tag_data;
+
+    /** Scalar analysis. */
+    struct {
+        /** The scalar value. */
+        yaml_char_t *value;
+        /** The scalar length. */
+        size_t length;
+        /** Does the scalar contain line breaks? */
+        int multiline;
+        /** Can the scalar be expessed in the flow plain style? */
+        int flow_plain_allowed;
+        /** Can the scalar be expressed in the block plain style? */
+        int block_plain_allowed;
+        /** Can the scalar be expressed in the single quoted style? */
+        int single_quoted_allowed;
+        /** Can the scalar be expressed in the literal or folded styles? */
+        int block_allowed;
+        /** The output style. */
+        yaml_scalar_style_t style;
+    } scalar_data;
+
     /**
      * @}
      */
@@ -1052,9 +1555,9 @@ typedef struct {
  * Initialize an emitter.
  *
  * This function creates a new emitter object.  An application is responsible
- * for destroying the object using the @c yaml_emitter_delete function.
+ * for destroying the object using the yaml_emitter_delete() function.
  *
- * @param[in]   emitter An empty parser object.
+ * @param[out]      emitter     An empty parser object.
  *
  * @returns @c 1 if the function succeeded, @c 0 on error.
  */
@@ -1065,7 +1568,7 @@ yaml_emitter_initialize(yaml_emitter_t *emitter);
 /**
  * Destroy an emitter.
  *
- * @param[in]   emitter An emitter object.
+ * @param[in,out]   emitter     An emitter object.
  */
 
 YAML_DECLARE(void)
@@ -1079,10 +1582,11 @@ yaml_emitter_delete(yaml_emitter_t *emitter);
  * bytes.  If the buffer is smaller than required, the emitter produces the
  * YAML_WRITE_ERROR error.
  *
- * @param[in]   emitter         An emitter object.
- * @param[in]   output          An output buffer.
- * @param[in]   size            The buffer size.
- * @param[in]   size_written    The pointer to save the number of written bytes.
+ * @param[in,out]   emitter         An emitter object.
+ * @param[in]       output          An output buffer.
+ * @param[in]       size            The buffer size.
+ * @param[in]       size_written    The pointer to save the number of written
+ *                                  bytes.
  */
 
 YAML_DECLARE(void)
@@ -1095,8 +1599,8 @@ yaml_emitter_set_output_string(yaml_emitter_t *emitter,
  * @a file should be a file object open for writing.  The application is
  * responsible for closing the @a file.
  *
- * @param[in]   emitter An emitter object.
- * @param[in]   file    An open file.
+ * @param[in,out]   emitter     An emitter object.
+ * @param[in]       file        An open file.
  */
 
 YAML_DECLARE(void)
@@ -1105,9 +1609,10 @@ yaml_emitter_set_output_file(yaml_emitter_t *emitter, FILE *file);
 /**
  * Set a generic output handler.
  *
- * @param[in]   emitter An emitter object.
- * @param[in]   handler A write handler.
- * @param[in]   data    Any application data for passing to the write handler.
+ * @param[in,out]   emitter     An emitter object.
+ * @param[in]       handler     A write handler.
+ * @param[in]       data        Any application data for passing to the write
+ *                              handler.
  */
 
 YAML_DECLARE(void)
@@ -1117,8 +1622,8 @@ yaml_emitter_set_output(yaml_emitter_t *emitter,
 /**
  * Set the output encoding.
  *
- * @param[in]   emitter     An emitter object.
- * @param[in]   encoding    The output encoding.
+ * @param[in,out]   emitter     An emitter object.
+ * @param[in]       encoding    The output encoding.
  */
 
 YAML_DECLARE(void)
@@ -1128,8 +1633,8 @@ yaml_emitter_set_encoding(yaml_emitter_t *emitter, yaml_encoding_t encoding);
  * Set if the output should be in the "canonical" format as in the YAML
  * specification.
  *
- * @param[in]   emitter     An emitter object.
- * @param[in]   canonical   If the output is canonical.
+ * @param[in,out]   emitter     An emitter object.
+ * @param[in]       canonical   If the output is canonical.
  */
 
 YAML_DECLARE(void)
@@ -1138,8 +1643,8 @@ yaml_emitter_set_canonical(yaml_emitter_t *emitter, int canonical);
 /**
  * Set the intendation increment.
  *
- * @param[in]   emitter     An emitter object.
- * @param[in]   indent      The indentation increment (1 < . < 10).
+ * @param[in,out]   emitter     An emitter object.
+ * @param[in]       indent      The indentation increment (1 < . < 10).
  */
 
 YAML_DECLARE(void)
@@ -1148,8 +1653,8 @@ yaml_emitter_set_indent(yaml_emitter_t *emitter, int indent);
 /**
  * Set the preferred line width. @c -1 means unlimited.
  *
- * @param[in]   emitter     An emitter object.
- * @param[in]   width       The preferred line width.
+ * @param[in,out]   emitter     An emitter object.
+ * @param[in]       width       The preferred line width.
  */
 
 YAML_DECLARE(void)
@@ -1158,8 +1663,8 @@ yaml_emitter_set_width(yaml_emitter_t *emitter, int width);
 /**
  * Set if unescaped non-ASCII characters are allowed.
  *
- * @param[in]   emitter     An emitter object.
- * @param[in]   unicode     If unescaped Unicode characters are allowed.
+ * @param[in,out]   emitter     An emitter object.
+ * @param[in]       unicode     If unescaped Unicode characters are allowed.
  */
 
 YAML_DECLARE(void)
@@ -1168,8 +1673,8 @@ yaml_emitter_set_unicode(yaml_emitter_t *emitter, int unicode);
 /**
  * Set the preferred line break.
  *
- * @param[in]   emitter     An emitter object.
- * @param[in]   line_break  The preferred line break.
+ * @param[in,out]   emitter     An emitter object.
+ * @param[in]       line_break  The preferred line break.
  */
 
 YAML_DECLARE(void)
@@ -1178,13 +1683,13 @@ yaml_emitter_set_break(yaml_emitter_t *emitter, yaml_break_t line_break);
 /**
  * Emit an event.
  *
- * The event object may be generated using the @c yaml_parser_parse function.
- * The emitter will destroy the event object if the function succeeds.  If the
- * function fails, the application is responsible for destroing the event
- * object.
+ * The event object may be generated using the yaml_parser_parse() function.
+ * The emitter takes the responsibility for the event object and destroys its
+ * content after it is emitted. The event object is destroyed even if the
+ * function fails.
  *
- * @param[in]   emitter     An emitter object.
- * @param[in]   event       An event object.
+ * @param[in,out]   emitter     An emitter object.
+ * @param[in,out]   event       An event object.
  *
  * @returns @c 1 if the function succeeded, @c 0 on error.
  */
@@ -1192,174 +1697,10 @@ yaml_emitter_set_break(yaml_emitter_t *emitter, yaml_break_t line_break);
 YAML_DECLARE(int)
 yaml_emitter_emit(yaml_emitter_t *emitter, yaml_event_t *event);
 
-/**
- * Emit the STREAM-START event.
- *
- * @param[in]   emitter     An emitter object.
- * @param[in]   encoding    The stream encoding.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_emitter_emit_stream_start(yaml_emitter_t *emitter,
-        yaml_encoding_t encoding);
-
-/**
- * Emit the STREAM-END event.
- *
- * @param[in]   emitter     An emitter object.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_emitter_emit_stream_end(yaml_emitter_t *emitter);
-
-/**
- * Emit the DOCUMENT-START event.
- *
- * The @a implicit argument is considered as a stylistic parameter and may be
- * ignored by the emitter.
- *
- * @param[in]   emitter                 An emitter object.
- * @param[in]   version_directive       The %YAML directive value or @c NULL.
- * @param[in]   tag_directives_start    The beginning of the %TAG directives list.
- * @param[in]   tag_directives_end      The end of the %TAG directives list.
- * @param[in]   implicit                If the document start indicator is implicit.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_emitter_emit_document_start(yaml_emitter_t *emitter,
-        yaml_version_directive_t *version_directive,
-        yaml_tag_directive_t *tag_directives_start,
-        yaml_tag_directive_t *tag_directives_end,
-        int implicit);
-
-/**
- * Emit the DOCUMENT-END event.
- *
- * The @a implicit argument is considered as a stylistic parameter and may be
- * ignored by the emitter.
- *
- * @param[in]   emitter     An emitter object.
- * @param[in]   implicit    If the document end indicator is implicit.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_emitter_emit_document_end(yaml_emitter_t *emitter, int implicit);
-
-/**
- * Emit an ALIAS event.
- *
- * @param[in]   emitter     An emitter object.
- * @param[in]   anchor      The anchor value.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_emitter_emit_alias(yaml_emitter_t *emitter, yaml_char_t *anchor);
-
-/**
- * Emit a SCALAR event.
- *
- * The @a style argument may be ignored by the emitter.
- *
- * Either the @a tag attribute or one of the @a plain_implicit and
- * @a quoted_implicit flags must be set.
- *
- * @param[in]   emitter         An emitter object.
- * @param[in]   anchor          The scalar anchor or @c NULL.
- * @param[in]   tag             The scalar tag or @c NULL.
- * @param[in]   value           The scalar value.
- * @param[in]   length          The length of the scalar value.
- * @param[in]   plain_implicit  If the tag may be omitted for the plain style.
- * @param[in]   quoted_implicit If the tag may be omitted for any non-plain style.
- * @param[in]   style           The scalar style.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_emitter_emit_scalar(yaml_emitter_t *emitter,
-        yaml_char_t *anchor, yaml_char_t *tag,
-        yaml_char_t *value, size_t length,
-        int plain_implicit, int quoted_implicit,
-        yaml_scalar_style_t style);
-
-/**
- * Emit a SEQUENCE-START event.
- *
- * The @a style argument may be ignored by the emitter.
- *
- * Either the @a tag attribute or the @a implicit flag must be set.
- *
- * @param[in]   emitter     An emitter object.
- * @param[in]   anchor      The sequence anchor or @c NULL.
- * @param[in]   tag         The sequence tag or @c NULL.
- * @param[in]   implicit    If the tag may be omitted.
- * @param[in]   style       The sequence style.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_emitter_emit_sequence_start(yaml_emitter_t *emitter,
-        yaml_char_t *anchor, yaml_char_t *tag, int implicit,
-        yaml_sequence_style_t style);
-
-/**
- * Emit a SEQUENCE-END event.
- *
- * @param[in]   emitter     An emitter object.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_emitter_emit_sequence_end(yaml_emitter_t *emitter);
-
-/**
- * Emit a MAPPING-START event.
- *
- * The @a style argument may be ignored by the emitter.
- *
- * Either the @a tag attribute or the @a implicit flag must be set.
- *
- * @param[in]   emitter     An emitter object.
- * @param[in]   anchor      The mapping anchor or @c NULL.
- * @param[in]   tag         The mapping tag or @c NULL.
- * @param[in]   implicit    If the tag may be omitted.
- * @param[in]   style       The mapping style.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_emitter_emit_mapping_start(yaml_emitter_t *emitter,
-        yaml_char_t *anchor, yaml_char_t *tag, int implicit,
-        yaml_mapping_style_t style);
-
-/**
- * Emit a MAPPING-END event.
- *
- * @param[in]   emitter     An emitter object.
- *
- * @returns @c 1 if the function succeeded, @c 0 on error.
- */
-
-YAML_DECLARE(int)
-yaml_emitter_emit_mapping_end(yaml_emitter_t *emitter);
-
 /**
  * Flush the accumulated characters to the output.
  *
- * @param[in]   emitter     An emitter object.
+ * @param[in,out]   emitter     An emitter object.
  *
  * @returns @c 1 if the function succeeded, @c 0 on error.
  */
This page took 0.070059 seconds and 4 git commands to generate.