summaryrefslogtreecommitdiffstats
path: root/src/locfile.h
diff options
context:
space:
mode:
authorDavid Tolnay <dtolnay@gmail.com>2015-08-23 20:36:11 -0700
committerDavid Tolnay <dtolnay@gmail.com>2015-08-23 20:36:11 -0700
commit0c93eb3379241dc4775718a9d39f54a6c4de20d6 (patch)
tree67bb5510adb707d54c6f72b51b0718578a2caf5c /src/locfile.h
parent891f28ef5e406a8d2156ad88d0244ab03fe490eb (diff)
Move source files to src/
Diffstat (limited to 'src/locfile.h')
-rw-r--r--src/locfile.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/locfile.h b/src/locfile.h
new file mode 100644
index 00000000..9931b009
--- /dev/null
+++ b/src/locfile.h
@@ -0,0 +1,29 @@
+#ifndef LOCFILE_H
+#define LOCFILE_H
+
+#include "jq.h"
+
+typedef struct {
+ int start, end;
+} location;
+
+static const location UNKNOWN_LOCATION = {-1, -1};
+
+struct locfile {
+ jv fname;
+ const char* data;
+ int length;
+ int* linemap;
+ int nlines;
+ char *error;
+ jq_state *jq;
+ int refct;
+};
+
+struct locfile* locfile_init(jq_state *, const char *, const char *, int);
+struct locfile* locfile_retain(struct locfile *);
+int locfile_get_line(struct locfile *, int);
+void locfile_free(struct locfile *);
+void locfile_locate(struct locfile *, location, const char *, ...);
+
+#endif