Commits

Kirill Simonov committed 776aa62

Eliminate some warnings and add more doxygen definitions.

Comments (0)

Files changed (6)

 
 /** The stream encoding. */
 typedef enum yaml_encoding_e {
+    /** Let the parser choose the encoding. */
     YAML_ANY_ENCODING,
+    /** The default UTF-8 encoding. */
     YAML_UTF8_ENCODING,
+    /** The UTF-16-LE encoding with BOM. */
     YAML_UTF16LE_ENCODING,
+    /** The UTF-16-BE encoding with BOM. */
     YAML_UTF16BE_ENCODING
 } yaml_encoding_t;
 
 /** Line break types. */
 
 typedef enum yaml_break_e {
+    /** Let the parser choose the break type. */
     YAML_ANY_BREAK,
+    /** Use CR for line breaks (Mac style). */
     YAML_CR_BREAK,
+    /** Use LN for line breaks (Unix style). */
     YAML_LN_BREAK,
+    /** Use CR LN for line breaks (DOS style). */
     YAML_CRLN_BREAK
 } yaml_break_t;
 
 /** Many bad things could happen with the parser and emitter. */
 typedef enum yaml_error_type_e {
+    /** No error is produced. */
     YAML_NO_ERROR,
 
+    /** Cannot allocate or reallocate a block of memory. */
     YAML_MEMORY_ERROR,
 
+    /** Cannot read or decode the input stream. */
     YAML_READER_ERROR,
+    /** Cannot scan the input stream. */
     YAML_SCANNER_ERROR,
+    /** Cannot parse the input stream. */
     YAML_PARSER_ERROR,
+    /** Cannot compose a YAML document. */
     YAML_COMPOSER_ERROR,
 
+    /** Cannot write to the output stream. */
     YAML_WRITER_ERROR,
+    /** Cannot emit a YAML stream. */
     YAML_EMITTER_ERROR
 } yaml_error_type_t;
 
 
 /** Scalar styles. */
 typedef enum yaml_scalar_style_e {
+    /** Let the emitter choose the style. */
     YAML_ANY_SCALAR_STYLE,
 
+    /** The plain scalar style. */
     YAML_PLAIN_SCALAR_STYLE,
 
+    /** The single-quoted scalar style. */
     YAML_SINGLE_QUOTED_SCALAR_STYLE,
+    /** The double-quoted scalar style. */
     YAML_DOUBLE_QUOTED_SCALAR_STYLE,
 
+    /** The literal scalar style. */
     YAML_LITERAL_SCALAR_STYLE,
+    /** The folded scalar style. */
     YAML_FOLDED_SCALAR_STYLE
 } yaml_scalar_style_t;
 
 /** Sequence styles. */
 typedef enum yaml_sequence_style_e {
+    /** Let the emitter choose the style. */
     YAML_ANY_SEQUENCE_STYLE,
 
+    /** The block sequence style. */
     YAML_BLOCK_SEQUENCE_STYLE,
+    /** The flow sequence style. */
     YAML_FLOW_SEQUENCE_STYLE
 } yaml_sequence_style_t;
 
 /** Mapping styles. */
 typedef enum yaml_mapping_style_e {
+    /** Let the emitter choose the style. */
     YAML_ANY_MAPPING_STYLE,
 
+    /** The block mapping style. */
     YAML_BLOCK_MAPPING_STYLE,
+    /** The flow mapping style. */
     YAML_FLOW_MAPPING_STYLE
 /*    YAML_FLOW_SET_MAPPING_STYLE   */
 } yaml_mapping_style_t;
 
 /** Token types. */
 typedef enum yaml_token_type_e {
+    /** An empty token. */
     YAML_NO_TOKEN,
 
+    /** A STREAM-START token. */
     YAML_STREAM_START_TOKEN,
+    /** A STREAM-END token. */
     YAML_STREAM_END_TOKEN,
 
+    /** A VERSION-DIRECTIVE token. */
     YAML_VERSION_DIRECTIVE_TOKEN,
+    /** A TAG-DIRECTIVE token. */
     YAML_TAG_DIRECTIVE_TOKEN,
+    /** A DOCUMENT-START token. */
     YAML_DOCUMENT_START_TOKEN,
+    /** A DOCUMENT-END token. */
     YAML_DOCUMENT_END_TOKEN,
 
+    /** A BLOCK-SEQUENCE-START token. */
     YAML_BLOCK_SEQUENCE_START_TOKEN,
+    /** A BLOCK-SEQUENCE-END token. */
     YAML_BLOCK_MAPPING_START_TOKEN,
+    /** A BLOCK-END token. */
     YAML_BLOCK_END_TOKEN,
 
+    /** A FLOW-SEQUENCE-START token. */
     YAML_FLOW_SEQUENCE_START_TOKEN,
+    /** A FLOW-SEQUENCE-END token. */
     YAML_FLOW_SEQUENCE_END_TOKEN,
+    /** A FLOW-MAPPING-START token. */
     YAML_FLOW_MAPPING_START_TOKEN,
+    /** A FLOW-MAPPING-END token. */
     YAML_FLOW_MAPPING_END_TOKEN,
 
+    /** A BLOCK-ENTRY token. */
     YAML_BLOCK_ENTRY_TOKEN,
+    /** A FLOW-ENTRY token. */
     YAML_FLOW_ENTRY_TOKEN,
+    /** A KEY token. */
     YAML_KEY_TOKEN,
+    /** A VALUE token. */
     YAML_VALUE_TOKEN,
 
+    /** An ALIAS token. */
     YAML_ALIAS_TOKEN,
+    /** An ANCHOR token. */
     YAML_ANCHOR_TOKEN,
+    /** A TAG token. */
     YAML_TAG_TOKEN,
+    /** A SCALAR token. */
     YAML_SCALAR_TOKEN
 } yaml_token_type_t;
 
 
 /** Event types. */
 typedef enum yaml_event_type_e {
+    /** An empty event. */
     YAML_NO_EVENT,
 
+    /** A STREAM-START event. */
     YAML_STREAM_START_EVENT,
+    /** A STREAM-END event. */
     YAML_STREAM_END_EVENT,
 
+    /** A DOCUMENT-START event. */
     YAML_DOCUMENT_START_EVENT,
+    /** A DOCUMENT-END event. */
     YAML_DOCUMENT_END_EVENT,
 
+    /** An ALIAS event. */
     YAML_ALIAS_EVENT,
+    /** A SCALAR event. */
     YAML_SCALAR_EVENT,
 
+    /** A SEQUENCE-START event. */
     YAML_SEQUENCE_START_EVENT,
+    /** A SEQUENCE-END event. */
     YAML_SEQUENCE_END_EVENT,
 
+    /** A MAPPING-START event. */
     YAML_MAPPING_START_EVENT,
+    /** A MAPPING-END event. */
     YAML_MAPPING_END_EVENT
 } yaml_event_type_t;
 
 YAML_DECLARE(void)
 yaml_event_delete(yaml_event_t *event);
 
+/** @} */
+
 /**
  * @defgroup nodes Nodes
  * @{
  */
 
+/** The tag @c !!null with the only possible value: @c null. */
 #define YAML_NULL_TAG       "tag:yaml.org,2002:null"
+/** The tag @c !!bool with the values: @c true and @c falce. */
 #define YAML_BOOL_TAG       "tag:yaml.org,2002:bool"
+/** The tag @c !!str for string values. */
 #define YAML_STR_TAG        "tag:yaml.org,2002:str"
+/** The tag @c !!int for integer values. */
 #define YAML_INT_TAG        "tag:yaml.org,2002:int"
+/** The tag @c !!float for float values. */
 #define YAML_FLOAT_TAG      "tag:yaml.org,2002:float"
+/** The tag @c !!timestamp for date and time values. */
 #define YAML_TIMESTAMP_TAG  "tag:yaml.org,2002:timestamp"
 
+/** The tag @c !!seq is used to denote sequences. */
 #define YAML_SEQ_TAG        "tag:yaml.org,2002:seq"
+/** The tag @c !!map is used to denote mapping. */
 #define YAML_MAP_TAG        "tag:yaml.org,2002:map"
 
+/** The default scalar tag is @c !!str. */
 #define YAML_DEFAULT_SCALAR_TAG     YAML_STR_TAG
+/** The default sequence tag is @c !!seq. */
 #define YAML_DEFAULT_SEQUENCE_TAG   YAML_SEQ_TAG
+/** The default mapping tag is @c !!map. */
 #define YAML_DEFAULT_MAPPING_TAG    YAML_MAP_TAG
 
 /** Node types. */
 typedef enum yaml_node_type_e {
+    /** An empty node. */
     YAML_NO_NODE,
 
+    /** A scalar node. */
     YAML_SCALAR_NODE,
+    /** A sequence node. */
     YAML_SEQUENCE_NODE,
+    /** A mapping node. */
     YAML_MAPPING_NODE
 } yaml_node_type_t;
 
  * modifying the documents are called.
  *
  * @param[in]       document        A document object.
- * @param[in]       node            The node id.
+ * @param[in]       index           The node id.
  *
  * @returns the node objct or @c NULL if @c node_id is out of range.
  */
 
 YAML_DECLARE(yaml_node_t *)
-yaml_document_get_node(yaml_document_t *document, int node_id);
+yaml_document_get_node(yaml_document_t *document, int index);
 
 /**
  * Get the root of a YAML document node.
  * The states of the parser.
  */
 typedef enum yaml_parser_state_e {
+    /** Expect STREAM-START. */
     YAML_PARSE_STREAM_START_STATE,
+    /** Expect the beginning of an implicit document. */
     YAML_PARSE_IMPLICIT_DOCUMENT_START_STATE,
+    /** Expect DOCUMENT-START. */
     YAML_PARSE_DOCUMENT_START_STATE,
+    /** Expect the content of a document. */
     YAML_PARSE_DOCUMENT_CONTENT_STATE,
+    /** Expect DOCUMENT-END. */
     YAML_PARSE_DOCUMENT_END_STATE,
+    /** Expect a block node. */
     YAML_PARSE_BLOCK_NODE_STATE,
+    /** Expect a block node or indentless sequence. */
     YAML_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE,
+    /** Expect a flow node. */
     YAML_PARSE_FLOW_NODE_STATE,
+    /** Expect the first entry of a block sequence. */
     YAML_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE,
+    /** Expect an entry of a block sequence. */
     YAML_PARSE_BLOCK_SEQUENCE_ENTRY_STATE,
+    /** Expect an entry of an indentless sequence. */
     YAML_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE,
+    /** Expect the first key of a block mapping. */
     YAML_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE,
+    /** Expect a block mapping key. */
     YAML_PARSE_BLOCK_MAPPING_KEY_STATE,
+    /** Expect a block mapping value. */
     YAML_PARSE_BLOCK_MAPPING_VALUE_STATE,
+    /** Expect the first entry of a flow sequence. */
     YAML_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE,
+    /** Expect an entry of a flow sequence. */
     YAML_PARSE_FLOW_SEQUENCE_ENTRY_STATE,
+    /** Expect a key of an ordered mapping. */
     YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE,
+    /** Expect a value of an ordered mapping. */
     YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE,
+    /** Expect the and of an ordered mapping entry. */
     YAML_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE,
+    /** Expect the first key of a flow mapping. */
     YAML_PARSE_FLOW_MAPPING_FIRST_KEY_STATE,
+    /** Expect a key of a flow mapping. */
     YAML_PARSE_FLOW_MAPPING_KEY_STATE,
+    /** Expect a value of a flow mapping. */
     YAML_PARSE_FLOW_MAPPING_VALUE_STATE,
+    /** Expect an empty value of a flow mapping. */
     YAML_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE,
+    /** Expect nothing. */
     YAML_PARSE_END_STATE
 } yaml_parser_state_t;
 
 
 /** The emitter states. */
 typedef enum yaml_emitter_state_e {
+    /** Expect STREAM-START. */
     YAML_EMIT_STREAM_START_STATE,
+    /** Expect the first DOCUMENT-START or STREAM-END. */
     YAML_EMIT_FIRST_DOCUMENT_START_STATE,
+    /** Expect DOCUMENT-START or STREAM-END. */
     YAML_EMIT_DOCUMENT_START_STATE,
+    /** Expect the content of a document. */
     YAML_EMIT_DOCUMENT_CONTENT_STATE,
+    /** Expect DOCUMENT-END. */
     YAML_EMIT_DOCUMENT_END_STATE,
+    /** Expect the first item of a flow sequence. */
     YAML_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE,
+    /** Expect an item of a flow sequence. */
     YAML_EMIT_FLOW_SEQUENCE_ITEM_STATE,
+    /** Expect the first key of a flow mapping. */
     YAML_EMIT_FLOW_MAPPING_FIRST_KEY_STATE,
+    /** Expect a key of a flow mapping. */
     YAML_EMIT_FLOW_MAPPING_KEY_STATE,
+    /** Expect a value for a simple key of a flow mapping. */
     YAML_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE,
+    /** Expect a value of a flow mapping. */
     YAML_EMIT_FLOW_MAPPING_VALUE_STATE,
+    /** Expect the first item of a block sequence. */
     YAML_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE,
+    /** Expect an item of a block sequence. */
     YAML_EMIT_BLOCK_SEQUENCE_ITEM_STATE,
+    /** Expect the first key of a block mapping. */
     YAML_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE,
+    /** Expect the key of a block mapping. */
     YAML_EMIT_BLOCK_MAPPING_KEY_STATE,
+    /** Expect a value for a simple key of a block mapping. */
     YAML_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE,
+    /** Expect a value of a block mapping. */
     YAML_EMIT_BLOCK_MAPPING_VALUE_STATE,
+    /** Expect nothing. */
     YAML_EMIT_END_STATE
 } yaml_emitter_state_t;
 
 YAML_DECLARE(int)
 yaml_emitter_emit(yaml_emitter_t *emitter, yaml_event_t *event);
 
-/*
+/**
  * Start a YAML stream.
  *
  * This function should be used before yaml_emitter_dump() is called.
 YAML_DECLARE(int)
 yaml_emitter_open(yaml_emitter_t *emitter);
 
-/*
+/**
  * Finish a YAML stream.
  *
  * This function should be used after yaml_emitter_dump() is called.
 YAML_DECLARE(int)
 yaml_emitter_close(yaml_emitter_t *emitter);
 
-/*
+/**
  * Emit a YAML document.
  *
  * The documen object may be generated using the yaml_parser_load() function
 {
     struct {
         yaml_error_type_t error;
-    } context = { YAML_NO_ERROR };
+    } context;
     yaml_tag_directive_t *tag_directive;
 
+    context.error = YAML_NO_ERROR;  /* Eliminate a compliler warning. */
+
     assert(document);   /* Non-NULL document object is expected. */
 
     while (!STACK_EMPTY(&context, document->nodes)) {
  */
 
 YAML_DECLARE(yaml_node_t *)
-yaml_document_get_node(yaml_document_t *document, int node)
+yaml_document_get_node(yaml_document_t *document, int index)
 {
     assert(document);   /* Non-NULL document object is expected. */
 
-    if (node > 0 && document->nodes.start + node <= document->nodes.top) {
-        return document->nodes.start + node - 1;
+    if (index > 0 && document->nodes.start + index <= document->nodes.top) {
+        return document->nodes.start + index - 1;
     }
     return NULL;
 }
     assert(value);      /* Non-NULL value is expected. */
 
     if (!tag) {
-        tag = YAML_DEFAULT_SCALAR_TAG;
+        tag = (yaml_char_t *)YAML_DEFAULT_SCALAR_TAG;
     }
 
     if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error;
     assert(document);   /* Non-NULL document object is expected. */
 
     if (!tag) {
-        tag = YAML_DEFAULT_SEQUENCE_TAG;
+        tag = (yaml_char_t *)YAML_DEFAULT_SEQUENCE_TAG;
     }
 
     if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error;
     assert(document);   /* Non-NULL document object is expected. */
 
     if (!tag) {
-        tag = YAML_DEFAULT_MAPPING_TAG;
+        tag = (yaml_char_t *)YAML_DEFAULT_MAPPING_TAG;
     }
 
     if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error;
  */
 
 static int
-yaml_parser_set_parser_error(yaml_parser_t *parser,
+yaml_parser_set_composer_error(yaml_parser_t *parser,
         const char *problem, yaml_mark_t problem_mark);
 
 static int
-yaml_parser_set_parser_error_context(yaml_parser_t *parser,
+yaml_parser_set_composer_error_context(yaml_parser_t *parser,
         const char *context, yaml_mark_t context_mark,
         const char *problem, yaml_mark_t problem_mark);
 
 
     if (!tag || strcmp((char *)tag, "!") == 0) {
         yaml_free(tag);
-        tag = yaml_strdup(YAML_DEFAULT_SCALAR_TAG);
+        tag = yaml_strdup((yaml_char_t *)YAML_DEFAULT_SCALAR_TAG);
         if (!tag) goto error;
     }
 
 
     if (!tag || strcmp((char *)tag, "!") == 0) {
         yaml_free(tag);
-        tag = yaml_strdup(YAML_DEFAULT_SEQUENCE_TAG);
+        tag = yaml_strdup((yaml_char_t *)YAML_DEFAULT_SEQUENCE_TAG);
         if (!tag) goto error;
     }
 
 
     if (!tag || strcmp((char *)tag, "!") == 0) {
         yaml_free(tag);
-        tag = yaml_strdup(YAML_DEFAULT_MAPPING_TAG);
+        tag = yaml_strdup((yaml_char_t *)YAML_DEFAULT_MAPPING_TAG);
         if (!tag) goto error;
     }
 
 
     else if (token->type == YAML_BLOCK_END_TOKEN)
     {
+        yaml_mark_t dummy_mark;     /* Used to eliminate a compiler warning. */
         parser->state = POP(parser, parser->states);
-        POP(parser, parser->marks);
+        dummy_mark = POP(parser, parser->marks);
         SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
         SKIP_TOKEN(parser);
         return 1;
 
     else if (token->type == YAML_BLOCK_END_TOKEN)
     {
+        yaml_mark_t dummy_mark;     /* Used to eliminate a compiler warning. */
         parser->state = POP(parser, parser->states);
-        POP(parser, parser->marks);
+        dummy_mark = POP(parser, parser->marks);
         MAPPING_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
         SKIP_TOKEN(parser);
         return 1;
         yaml_event_t *event, int first)
 {
     yaml_token_t *token;
+    yaml_mark_t dummy_mark;     /* Used to eliminate a compiler warning. */
 
     if (first) {
         token = PEEK_TOKEN(parser);
     }
 
     parser->state = POP(parser, parser->states);
-    POP(parser, parser->marks);
+    dummy_mark = POP(parser, parser->marks);
     SEQUENCE_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
     SKIP_TOKEN(parser);
     return 1;
         yaml_event_t *event, int first)
 {
     yaml_token_t *token;
+    yaml_mark_t dummy_mark;     /* Used to eliminate a compiler warning. */
 
     if (first) {
         token = PEEK_TOKEN(parser);
     }
 
     parser->state = POP(parser, parser->states);
-    POP(parser, parser->marks);
+    dummy_mark = POP(parser, parser->marks);
     MAPPING_END_EVENT_INIT(*event, token->start_mark, token->end_mark);
     SKIP_TOKEN(parser);
     return 1;
 static int
 yaml_parser_decrease_flow_level(yaml_parser_t *parser)
 {
+    yaml_simple_key_t dummy_key;    /* Used to eliminate a compiler warning. */
+
     if (parser->flow_level) {
         parser->flow_level --;
-        POP(parser, parser->simple_keys);
+        dummy_key = POP(parser, parser->simple_keys);
     }
 
     return 1;

src/yaml_private.h

 #define DOCUMENT_INIT(document,document_nodes_start,document_nodes_end,         \
         document_version_directive,document_tag_directives_start,               \
         document_tag_directives_end,document_start_implicit,                    \
-        document_end_implicit,start_mark,end_mark)                              \
+        document_end_implicit,document_start_mark,document_end_mark)            \
     (memset(&(document), 0, sizeof(yaml_document_t)),                           \
      (document).nodes.start = (document_nodes_start),                           \
      (document).nodes.end = (document_nodes_end),                               \
      (document).tag_directives.start = (document_tag_directives_start),         \
      (document).tag_directives.end = (document_tag_directives_end),             \
      (document).start_implicit = (document_start_implicit),                     \
-     (document).end_implicit = (document_end_implicit))
+     (document).end_implicit = (document_end_implicit),                         \
+     (document).start_mark = (document_start_mark),                             \
+     (document).end_mark = (document_end_mark))
 
 /*
  * Node initializers.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.