Changeset 238 for libyaml/trunk/tests/example-reformatter-alt.c
- Timestamp:
- 01/07/07 15:11:16 (6 years ago)
- File:
-
- 1 copied
-
libyaml/trunk/tests/example-reformatter-alt.c (copied) (copied from libyaml/trunk/tests/example-reformatter.c) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libyaml/trunk/tests/example-reformatter-alt.c
r220 r238 16 16 yaml_parser_t parser; 17 17 yaml_emitter_t emitter; 18 yaml_ event_t event;18 yaml_document_t document; 19 19 20 20 /* Clear the objects. */ … … 22 22 memset(&parser, 0, sizeof(parser)); 23 23 memset(&emitter, 0, sizeof(emitter)); 24 memset(& event, 0, sizeof(event));24 memset(&document, 0, sizeof(document)); 25 25 26 26 /* Analyze command line options. */ … … 89 89 /* Get the next event. */ 90 90 91 if (!yaml_parser_ parse(&parser, &event))91 if (!yaml_parser_load(&parser, &document)) 92 92 goto parser_error; 93 93 94 94 /* Check if this is the stream end. */ 95 95 96 if ( event.type == YAML_STREAM_END_EVENT) {96 if (!yaml_document_get_root_node(&document)) { 97 97 done = 1; 98 98 } … … 100 100 /* Emit the event. */ 101 101 102 if (!yaml_emitter_ emit(&emitter, &event))102 if (!yaml_emitter_dump(&emitter, &document)) 103 103 goto emitter_error; 104 104 } … … 160 160 break; 161 161 162 case YAML_COMPOSER_ERROR: 163 if (parser.context) { 164 fprintf(stderr, "Composer error: %s at line %d, column %d\n" 165 "%s at line %d, column %d\n", parser.context, 166 parser.context_mark.line+1, parser.context_mark.column+1, 167 parser.problem, parser.problem_mark.line+1, 168 parser.problem_mark.column+1); 169 } 170 else { 171 fprintf(stderr, "Composer error: %s at line %d, column %d\n", 172 parser.problem, parser.problem_mark.line+1, 173 parser.problem_mark.column+1); 174 } 175 break; 176 162 177 default: 163 178 /* Couldn't happen. */
Note: See TracChangeset
for help on using the changeset viewer.
