summaryrefslogtreecommitdiffstats
path: root/locfile.h
blob: 35907974807d3f6a398efca085d422729f116407 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef _LOCFILE_H
#define _LOCFILE_H

typedef struct {
  int start, end;
} location;

static const location UNKNOWN_LOCATION = {-1, -1};

struct locfile {
  const char* data;
  int length;
  int* linemap;
  int nlines;
};

void locfile_init(struct locfile* l, const char* data, int length);

void locfile_free(struct locfile* l);

void locfile_locate(struct locfile* l, location loc, const char* fmt, ...);

#endif