Changeset 272


Ignore:
Timestamp:
07/31/08 16:24:39 (6 years ago)
Author:
xi
Message:

Tagged the 0.1.1 release (better later than never).

Location:
libyaml
Files:
2 edited
2 copied

Legend:

Unmodified
Added
Removed
  • libyaml/trunk/src/dumper.c

    r263 r272  
    11 
    22#include "yaml_private.h" 
    3  
    4 #if 0 
    53 
    64/* 
     
    6765    yaml_mark_t mark = { 0, 0, 0 }; 
    6866 
    69     assert(emitter);            /* Non-NULL emitter object is required. */ 
    70     assert(!emitter->opened);   /* Emitter should not be opened yet. */ 
     67    assert(emitter);                /* Non-NULL emitter object is required. */ 
     68    assert(!emitter->is_opened);    /* Emitter should not be opened yet. */ 
    7169 
    7270    STREAM_START_EVENT_INIT(event, YAML_ANY_ENCODING, mark, mark); 
     
    7674    } 
    7775 
    78     emitter->opened = 1; 
     76    emitter->is_opened = 1; 
    7977 
    8078    return 1; 
     
    9290 
    9391    assert(emitter);            /* Non-NULL emitter object is required. */ 
    94     assert(emitter->opened);    /* Emitter should be opened. */ 
    95  
    96     if (emitter->closed) return 1; 
     92    assert(emitter->is_opened); /* Emitter should be opened. */ 
     93 
     94    if (emitter->is_closed) return 1; 
    9795 
    9896    STREAM_END_EVENT_INIT(event, mark, mark); 
     
    102100    } 
    103101 
    104     emitter->closed = 1; 
     102    emitter->is_closed = 1; 
    105103 
    106104    return 1; 
     
    122120    emitter->document = document; 
    123121 
    124     if (!emitter->opened) { 
     122    if (!emitter->is_opened) { 
    125123        if (!yaml_emitter_open(emitter)) goto error; 
    126124    } 
    127125 
    128     if (STACK_EMPTY(emitter, document->nodes)) { 
     126    if (document->type == YAML_DOCUMENT) 
     127    { 
     128        assert(emitter->is_opened); /* Emitter should be opened. */ 
     129 
     130        if (STACK_EMPTY(emitter, emitter->nodes)) { 
     131            SERIALIZER_ERROR_INIT(emitter, "root node is not specified"); 
     132            goto error; 
     133        } 
     134 
     135        emitter->anchors = yaml_malloc(sizeof(*(emitter->anchors)) 
     136                * (document->nodes.length)); 
     137        if (!emitter->anchors) goto error; 
     138        memset(emitter->anchors, 0, sizeof(*(emitter->anchors)) 
     139                * (document->nodes.length)); 
     140 
     141        DOCUMENT_START_EVENT_INIT(event, document->version_directive, 
     142                document->tag_directives.list, document->tag_directives.length, 
     143                document->tag_directives.capacity, 
     144                document->start_implicit, mark, mark); 
     145        if (!yaml_emitter_emit(emitter, &event)) goto error; 
     146 
     147        yaml_emitter_anchor_node(emitter, 0); 
     148        if (!yaml_emitter_dump_node(emitter, 0)) goto error; 
     149 
     150        DOCUMENT_END_EVENT_INIT(event, document->end_implicit, mark, mark); 
     151        if (!yaml_emitter_emit(emitter, &event)) goto error; 
     152    } 
     153 
     154    if (!document->type) { 
    129155        if (!yaml_emitter_close(emitter)) goto error; 
    130         yaml_emitter_delete_document_and_anchors(emitter); 
    131         return 1; 
    132     } 
    133  
    134     assert(emitter->opened);    /* Emitter should be opened. */ 
    135  
    136     emitter->anchors = yaml_malloc(sizeof(*(emitter->anchors)) 
    137             * (document->nodes.top - document->nodes.start)); 
    138     if (!emitter->anchors) goto error; 
    139     memset(emitter->anchors, 0, sizeof(*(emitter->anchors)) 
    140             * (document->nodes.top - document->nodes.start)); 
    141  
    142     DOCUMENT_START_EVENT_INIT(event, document->version_directive, 
    143             document->tag_directives.start, document->tag_directives.end, 
    144             document->start_implicit, mark, mark); 
    145     if (!yaml_emitter_emit(emitter, &event)) goto error; 
    146  
    147     yaml_emitter_anchor_node(emitter, 1); 
    148     if (!yaml_emitter_dump_node(emitter, 1)) goto error; 
    149  
    150     DOCUMENT_END_EVENT_INIT(event, document->end_implicit, mark, mark); 
    151     if (!yaml_emitter_emit(emitter, &event)) goto error; 
     156    } 
    152157 
    153158    yaml_emitter_delete_document_and_anchors(emitter); 
     
    244249 */ 
    245250 
    246 #define ANCHOR_TEMPLATE         "id%03d" 
     251#define ANCHOR_TEMPLATE         "_%03d" 
    247252#define ANCHOR_TEMPLATE_LENGTH  16 
    248253 
     
    395400} 
    396401 
    397 #endif 
    398  
  • libyaml/trunk/src/yaml_private.h

    r267 r272  
    12291229 
    12301230/* 
     1231 * The information of a node being emitted. 
     1232 */ 
     1233 
     1234struct typedef yaml_node_data_s { 
     1235    /* The node id. */ 
     1236    int id; 
     1237    /* The collection iterator. */ 
     1238    int index; 
     1239} yaml_node_data_t; 
     1240 
     1241/* 
    12311242 * The structure that holds data used by the file and string readers. 
    12321243 */ 
     
    12411252 
    12421253/* 
    1243  * The internals emitter structure. 
     1254 * The internal emitter structure. 
    12441255 */ 
    12451256 
Note: See TracChangeset for help on using the changeset viewer.