Mercurial > hg > th-libs
comparison th_ioctx.h @ 477:96d137a6b392
Improve ioctx API. This breaks backwards compatibility of th_io_fopen().
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Mon, 09 Jul 2018 08:06:45 +0300 |
parents | 85fa3d333556 |
children | e4ce60239d16 |
comparison
equal
deleted
inserted
replaced
476:61fed1286780 | 477:96d137a6b392 |
---|---|
33 time_t atime; ///< Last access time | 33 time_t atime; ///< Last access time |
34 int64_t size; ///< Size in bytes | 34 int64_t size; ///< Size in bytes |
35 int status; ///< Status | 35 int status; ///< Status |
36 size_t line; ///< Line number | 36 size_t line; ///< Line number |
37 | 37 |
38 void (*error)(struct th_ioctx *, const int err, const char *msg); | 38 void (*error)(struct th_ioctx *ctx, const int err, const char *msg); |
39 void (*msg)(struct th_ioctx *, const int level, const char *msg); | 39 void (*msg)(struct th_ioctx *ctx, const int level, const char *msg); |
40 | 40 |
41 const struct th_ioctx_ops *fops; ///< Pointer to I/O ops struct to be used with this context | 41 const struct th_ioctx_ops *fops; ///< Pointer to I/O ops struct to be used with this context |
42 } th_ioctx; | 42 } th_ioctx; |
43 | 43 |
44 | 44 |
77 // | 77 // |
78 // I/O context management functions | 78 // I/O context management functions |
79 // | 79 // |
80 th_ioctx * th_io_new(const th_ioctx_ops *fops, const char *filename); | 80 th_ioctx * th_io_new(const th_ioctx_ops *fops, const char *filename); |
81 int th_io_open(th_ioctx *ctx, const char *mode); | 81 int th_io_open(th_ioctx *ctx, const char *mode); |
82 th_ioctx * th_io_fopen(const th_ioctx_ops *fops, const char *filename, const char *mode); | 82 int th_io_fopen(th_ioctx **pctx, const th_ioctx_ops *fops, const char *filename, const char *mode); |
83 void th_io_close(th_ioctx *ctx); | 83 void th_io_close(th_ioctx *ctx); |
84 void th_io_free(th_ioctx *ctx); | 84 void th_io_free(th_ioctx *ctx); |
85 | 85 |
86 BOOL th_io_set_handlers(th_ioctx *ctx, | 86 BOOL th_io_set_handlers(th_ioctx *ctx, |
87 void (*error)(th_ioctx *, const int, const char *msg), | 87 void (*error)(th_ioctx *, const int, const char *msg), |