2015-04-28 10:36:21 -05:00
|
|
|
#ifndef LOCFILE_H
|
|
|
|
#define LOCFILE_H
|
2013-05-26 12:42:04 +10:00
|
|
|
|
2013-11-30 02:05:42 -06:00
|
|
|
#include "jq.h"
|
|
|
|
|
2012-09-11 00:04:47 +01:00
|
|
|
typedef struct {
|
|
|
|
int start, end;
|
|
|
|
} location;
|
|
|
|
|
2012-09-11 12:24:54 +01:00
|
|
|
static const location UNKNOWN_LOCATION = {-1, -1};
|
|
|
|
|
2012-09-11 00:04:47 +01:00
|
|
|
struct locfile {
|
2015-03-29 19:12:23 -05:00
|
|
|
jv fname;
|
2012-09-11 00:04:47 +01:00
|
|
|
const char* data;
|
|
|
|
int length;
|
|
|
|
int* linemap;
|
|
|
|
int nlines;
|
2013-11-30 02:05:42 -06:00
|
|
|
char *error;
|
|
|
|
jq_state *jq;
|
2014-07-09 00:55:20 -04:00
|
|
|
int refct;
|
2012-09-11 00:04:47 +01:00
|
|
|
};
|
|
|
|
|
2015-03-29 19:12:23 -05:00
|
|
|
struct locfile* locfile_init(jq_state *, const char *, const char *, int);
|
|
|
|
struct locfile* locfile_retain(struct locfile *);
|
2015-03-30 15:55:54 -05:00
|
|
|
int locfile_get_line(struct locfile *, int);
|
2015-03-29 19:12:23 -05:00
|
|
|
void locfile_free(struct locfile *);
|
|
|
|
void locfile_locate(struct locfile *, location, const char *, ...);
|
2012-09-11 12:24:54 +01:00
|
|
|
|
|
|
|
#endif
|