aboutsummaryrefslogtreecommitdiffstats
path: root/test/test_writer.c
AgeCommit message (Collapse)AuthorFilesLines
2022-01-28Add custom allocator supportDavid Robillard1-20/+113
2022-01-28Make environments and sinks part of the worldDavid Robillard1-9/+9
Although functions/components that require minimal pre-existing state are nice, these allocate memory and could potentially share resources. So, give them a pointer to a world which can be used to configure such things. In particular, this is working towards supporting custom allocators everywhere.
2022-01-28Fix handling of deferred write errors that happen when closingDavid Robillard1-6/+9
2022-01-28Use more human-readable status codesDavid Robillard1-8/+8
2022-01-28Simplify output stream APIDavid Robillard1-55/+67
This makes the paging mechanism an internal detail once again. While it's conceptually elegant to simply have a single write interface and have the block dumper just be another implementation of that, unfortunately it is not practical. The inlining of serd_block_dumper_write() is a significant performance boost, because it avoids a non-inlinable function call of overhead per character. Compared to the SerdByteSink approach, this removes the burden and overhead of needing to dynamically allocate the structure itself.
2022-01-28Provide a full output stream implementation for SerdBufferDavid Robillard1-4/+6
Essentially replaces serd_buffer_sink_finish() with serd_buffer_close(), which makes writing to a buffer consistent with writing to a file or anything else.
2022-01-28Add a close function to SerdByteSinkDavid Robillard1-12/+17
This simplifies everything by replacing special cases with a more general close function. A type is no longer stored in the structure, so the other constructors are now essentially syntactic sugar for the universal serd_byte_sink_new_function().
2022-01-28Support writing all escapes in Turtle and TriG prefixed namesDavid Robillard1-0/+77
2022-01-14Preserve long or short quoting from input documentsDavid Robillard1-1/+7
2022-01-14Remove SERD_CURIE node datatype entirelyDavid Robillard1-1/+3
2022-01-14Expand URIs in readerDavid Robillard1-0/+36
This expands relative and prefixed URIs in the reader on the stack, rather than passing them to the caller to be dealt with. This pushes these context-full forms to the edge of the system as much as possible to minimise the headaches they can cause. Towards having stricter guarantees about nodes and eliminating the CURIE node type altogether.
2022-01-14Move SerdEnv mutation from writer to readerDavid Robillard1-30/+0
Writing having side-effects seems questionable in general, and this prepares things for expanding URIs in the reader.
2022-01-13Make Writer always write to a ByteSinkDavid Robillard1-31/+44
2022-01-13Add empty syntax type for suppressing outputDavid Robillard1-0/+34
2022-01-13Replace SERD_WRITE_STRICT flag with SERD_WRITE_LAXDavid Robillard1-3/+3
The unset value for flags should represent the best default, which in this case is strict parsing. Lax parsing is the riskier opt-in option.
2022-01-13Improve writer error handlingDavid Robillard1-0/+101
2022-01-13Simplify streaming API and improve pretty printingDavid Robillard1-6/+6
This removes the obligation from the caller to correctly maintain flags to describe the current anonymous context, instead making the writer handle this itself as much as possible. Flags remain for the cases the writer can not infer from context: the start of anonymous subject and object nodes.
2022-01-13Replace multiple stream callbacks with SerdEventDavid Robillard1-0/+26
This makes plumbing easier since everything goes through the same "stream" and only one callback is required to handling everything. It's also more easily extensible in case more event types need to be added in the future.
2022-01-13Use SerdNodes to simplify some testsDavid Robillard1-20/+21
2022-01-13Add SerdWorld for shared library stateDavid Robillard1-4/+13
2022-01-13Simplify literal construction APIDavid Robillard1-3/+1
2022-01-13Handle writer stack overflows gracefullyDavid Robillard1-0/+56
2022-01-13Add SerdSink interface and hide implementationsDavid Robillard1-2/+3
2022-01-13Simplify node construction APIDavid Robillard1-5/+34
2022-01-13Merge datatype/language into nodeDavid Robillard1-1/+1
This moves closer to the sord API, and is more convenient in most cases.
2022-01-13Make nodes opaqueDavid Robillard1-4/+7
2022-01-13Rename SerdStyle to SerdWriterFlagsDavid Robillard1-2/+2
2022-01-13Use char* for strings in public APIDavid Robillard1-8/+4
The constant casting just makes user code a mess, for no benefit.
2022-01-13Add SerdBuffer type for mutable buffersDavid Robillard1-3/+3
This avoids const violations from abusing SerdChunk as a mutable buffer for string sinks.
2021-07-10Add missing includeDavid Robillard1-0/+1
2021-07-09Fix accidentally disabled writer testDavid Robillard1-4/+1
2021-02-15Fix writing long literals with triple quotesDavid Robillard1-0/+65