~rogpeppe/goyaml/goyaml-rune-changes

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include "_cgo_export.h"
#include "helpers.h"

#define DEFINE_YUNION_FUNC(name) \
    __typeof__(((yaml_event_t *)0)->data.name) * \
    event_##name(yaml_event_t *event) { \
        return &event->data.name; \
    }

DEFINE_YUNION_FUNC(scalar)
DEFINE_YUNION_FUNC(alias)
DEFINE_YUNION_FUNC(mapping_start)
DEFINE_YUNION_FUNC(sequence_start)

void set_output_handler(yaml_emitter_t *e)
{
    yaml_emitter_set_output(e, (yaml_write_handler_t*)outputHandler, (void *)e);
}