README: rename
[ppn.git] / include / isa / yll.h
blobc2e61172f2a95635d522c8bde2bb44779a41f6e5
1 #ifndef YLL_H
2 #define YLL_H
4 #include <stdio.h>
5 #include <syck.h>
7 typedef enum _yll_option {
8 YLL_INLINE_SEQ = 1 << 0,
9 YLL_ADD_SPACE = 1 << 1,
10 } YllOption;
12 struct _yll_emitter;
14 typedef void (*YllNext)(struct _yll_emitter *e);
16 struct _yll_emitter_node {
17 struct _yll_emitter_node *next;
18 YllNext nextf;
19 YllOption flags;
22 struct _yll_anchor_node {
23 struct _yll_emitter_node en;
24 SYMID anchor;
27 struct _yll_seq_node {
28 struct _yll_emitter_node en;
29 int first;
32 typedef struct _yll_emitter_node YllEmitterNode;
33 typedef struct _yll_anchor_node YllAnchorNode;
34 typedef struct _yll_seq_node YllSeqNode;
36 struct _yll_emitter {
37 FILE *out;
38 SYMID last_anchor;
39 YllEmitterNode *stack;
40 int indent;
41 YllOption flags;
42 const char *transfer;
45 typedef struct _yll_emitter YllEmitter;
47 typedef void (*YllOutputHandler)(YllEmitter *, char *, long);
49 YllEmitter* yll_new_emitter();
50 void yll_emitter_handler(YllEmitter *e, YllOutputHandler hdlr);
51 void yll_free_emitter(YllEmitter *e);
52 SYMID yll_emitter_anchor(YllEmitter *e);
53 void yll_emitter_alias(YllEmitter *e, SYMID id);
54 void yll_emitter_set_options(YllEmitter *e, YllOption flags);
55 void yll_emitter_set_transfer(YllEmitter *e, const char *t);
56 void yll_emitter_start_seq(YllEmitter *e);
57 void yll_emitter_end_seq(YllEmitter *e);
58 void yll_emitter_start_map(YllEmitter *e);
59 void yll_emitter_end_map(YllEmitter *e);
60 void yll_emitter_write_string(YllEmitter *e, const char *str);
61 void yll_emitter_write_int(YllEmitter *e, int i);
62 void yll_emitter_write_null(YllEmitter *e);
64 #endif