aboutsummaryrefslogtreecommitdiffstats
path: root/src/byte_source.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2018-06-03 22:15:53 +0200
committerDavid Robillard <d@drobilla.net>2018-12-31 11:37:47 -0500
commit5246440bc489b9b8168d0e26700cf5f343895169 (patch)
tree345fd9e2916a0e92205186e011721d9c8459c047 /src/byte_source.h
parentc10db88a4eac181e83acff319e77308291c59645 (diff)
downloadserd-5246440bc489b9b8168d0e26700cf5f343895169.tar.gz
serd-5246440bc489b9b8168d0e26700cf5f343895169.tar.bz2
serd-5246440bc489b9b8168d0e26700cf5f343895169.zip
Add SerdCursor to public API
Diffstat (limited to 'src/byte_source.h')
-rw-r--r--src/byte_source.h17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/byte_source.h b/src/byte_source.h
index 0edfd75c..f88fa6c9 100644
--- a/src/byte_source.h
+++ b/src/byte_source.h
@@ -17,6 +17,8 @@
#ifndef SERD_BYTE_SOURCE_H
#define SERD_BYTE_SOURCE_H
+#include "cursor.h"
+
#include "serd/serd.h"
#include <assert.h>
@@ -27,18 +29,13 @@
typedef int (*SerdStreamCloseFunc)(void*);
typedef struct {
- const char* filename;
- unsigned line;
- unsigned col;
-} Cursor;
-
-typedef struct {
SerdReadFunc read_func; ///< Read function (e.g. fread)
SerdStreamErrorFunc error_func; ///< Error function (e.g. ferror)
SerdStreamCloseFunc close_func; ///< Function for closing stream
void* stream; ///< Stream (e.g. FILE)
size_t page_size; ///< Number of bytes to read at a time
- Cursor cur; ///< Cursor for error reporting
+ SerdNode* name; ///< Name of stream (referenced by cur)
+ SerdCursor 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
@@ -49,7 +46,9 @@ typedef struct {
} SerdByteSource;
SerdStatus
-serd_byte_source_open_string(SerdByteSource* source, const char* utf8);
+serd_byte_source_open_string(SerdByteSource* source,
+ const char* utf8,
+ const SerdNode* name);
SerdStatus
serd_byte_source_open_source(SerdByteSource* source,
@@ -57,7 +56,7 @@ serd_byte_source_open_source(SerdByteSource* source,
SerdStreamErrorFunc error_func,
SerdStreamCloseFunc close_func,
void* stream,
- const char* name,
+ const SerdNode* name,
size_t page_size);
SerdStatus