diff options
| author | nsfisis <nsfisis@gmail.com> | 2025-08-29 21:25:03 +0900 |
|---|---|---|
| committer | nsfisis <nsfisis@gmail.com> | 2025-08-29 21:49:56 +0900 |
| commit | b678465c11517a5342b1ec5aa4fe21570f13a3ed (patch) | |
| tree | 6ef19e02b1cf18f5ac451e6104f6e20b475a6f52 /src/io.c | |
| parent | 8f352553faec69a6f29854898b93be47604aff28 (diff) | |
| download | ducc-b678465c11517a5342b1ec5aa4fe21570f13a3ed.tar.gz ducc-b678465c11517a5342b1ec5aa4fe21570f13a3ed.tar.zst ducc-b678465c11517a5342b1ec5aa4fe21570f13a3ed.zip | |
feat: add utility function to dump any internal object as JSON
Diffstat (limited to 'src/io.c')
| -rw-r--r-- | src/io.c | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -1,5 +1,17 @@ #include "io.h" #include "common.h" +#include "json.h" + +void sourcelocation_build_json(JsonBuilder* builder, SourceLocation* loc) { + jsonbuilder_object_start(builder); + jsonbuilder_object_member_start(builder, "filename"); + jsonbuilder_string(builder, loc->filename); + jsonbuilder_object_member_end(builder); + jsonbuilder_object_member_start(builder, "line"); + jsonbuilder_integer(builder, loc->line); + jsonbuilder_object_member_end(builder); + jsonbuilder_object_end(builder); +} InFile* infile_open(const char* filename) { FILE* in; |
