summaryrefslogtreecommitdiff
path: root/dseg.h
blob: 4decf2f34b31259f0794ea8837c09650ecc8d9b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#ifndef DSEG_H
#define DSEG_H

#include "ccc.h"
#include <stdio.h>

struct dseg_entry {
    enum {
        ENT_STRING,
    } type;
    union {
        const char* string;
    } key;
    char* symbol;
};

struct dseg {
    struct dseg_entry** entries;
    integral_t sz;
    integral_t cap;
};

void dseg_init(struct dseg* dseg);
void dseg_destroy(struct dseg* dseg);
const char* dseg_put(struct dseg* dseg, struct dseg_entry entry);
void emit_dseg(FILE* outfile, const struct dseg* dseg);

#endif