aboutsummaryrefslogtreecommitdiffstats
path: root/src/serd_internal.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2017-11-05 12:47:42 +0100
committerDavid Robillard <d@drobilla.net>2017-11-05 12:47:42 +0100
commit7667e8750e3aec21af8c56a85966878b6ea00bbd (patch)
tree91132b3e39d1b2af98f02ba2868d33ace12a6554 /src/serd_internal.h
parent07e6a2e7d182483552b940ecdb27231d7983fd19 (diff)
downloadserd-7667e8750e3aec21af8c56a85966878b6ea00bbd.tar.gz
serd-7667e8750e3aec21af8c56a85966878b6ea00bbd.tar.bz2
serd-7667e8750e3aec21af8c56a85966878b6ea00bbd.zip
Move cursor from reader to byte source
Diffstat (limited to 'src/serd_internal.h')
-rw-r--r--src/serd_internal.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/serd_internal.h b/src/serd_internal.h
index 7c758cb8..9523af91 100644
--- a/src/serd_internal.h
+++ b/src/serd_internal.h
@@ -75,10 +75,17 @@ serd_bufalloc(size_t size)
/* Byte source */
typedef struct {
+ const uint8_t* filename;
+ unsigned line;
+ unsigned col;
+} Cursor;
+
+typedef struct {
SerdSource read_func; ///< Read function (e.g. fread)
SerdStreamErrorFunc error_func; ///< Error function (e.g. ferror)
void* stream; ///< Stream (e.g. FILE)
size_t page_size; ///< Number of bytes to read at a time
+ Cursor cur; ///< Cursor for error reporting
uint8_t* file_buf; ///< Buffer iff reading pages from a file
const uint8_t* read_buf; ///< Pointer to file_buf or read_byte
size_t read_head; ///< Offset into read_buf
@@ -101,6 +108,7 @@ serd_byte_source_open_source(SerdByteSource* source,
SerdSource read_func,
SerdStreamErrorFunc error_func,
void* stream,
+ const uint8_t* name,
size_t page_size);
SerdStatus