diff --git a/include/villas/format_type.h b/include/villas/format_type.h index 68721a9d8..805b930a3 100644 --- a/include/villas/format_type.h +++ b/include/villas/format_type.h @@ -97,8 +97,10 @@ struct format_type { /** @} */ - size_t size; /**< Number of bytes to allocate for io::_vd */ - int flags; /**< A set of flags which is automatically used. */ + size_t size; /**< Number of bytes to allocate for io::_vd */ + int flags; /**< A set of flags which is automatically used. */ + char delimiter; /**< Newline delimiter. */ + char separator; /**< Column separator (used by csv and villas.human formats only) */ }; struct format_type * format_type_lookup(const char *name); diff --git a/include/villas/io.h b/include/villas/io.h index da8fcac3b..d24705a61 100644 --- a/include/villas/io.h +++ b/include/villas/io.h @@ -41,6 +41,7 @@ struct io { enum state state; int flags; char delimiter; /**< Newline delimiter. */ + char separator; /**< Column separator (used by csv and villas.human formats only) */ struct { /** A format type can use this file handle or overwrite the diff --git a/lib/io.c b/lib/io.c index 7461e8643..689a46e6d 100644 --- a/lib/io.c +++ b/lib/io.c @@ -89,7 +89,8 @@ int io_init(struct io *io, struct format_type *fmt, struct node *n, int flags) io->_vd = alloc(fmt->size); io->flags = flags | io->_vt->flags; - io->delimiter = '\n'; + io->delimiter = io->_vt->delimiter ? io->_vt->delimiter : '\n'; + io->separator = io->_vt->separator ? io->_vt->separator : '\t'; io->input.buflen = io->output.buflen = 4096;