summaryrefslogtreecommitdiff
path: root/src/source.h
blob: c88c2b49fe4417b36c37fd3b6e2ab85a6de8a4db (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
29
30
31
#ifndef ANIMTOOL_SOURCE_H
#define ANIMTOOL_SOURCE_H

#include <stddef.h>
#include "util/container.h"
#include "util/str.h"

struct range
{
    size_t start, end;  
};

struct loc_str
{
    struct range loc;
    str str;
};

struct source
{
    str name;
    str contents;
    size_t offset;
    arraybuf(str) strings;
};

[[noreturn]] void source_error(struct source *source, struct range loc, const char *fmt, ...) __attribute__((format (printf, 3, 4)));
void source_init(struct source *source, str name, str contents);
void source_free(struct source *source);

#endif