comparison th_ioctx.h @ 772:1959ba53e9dc

Fix th_ioctx_t_ops -> th_ioctx_ops_t
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 20 Feb 2023 23:36:33 +0200
parents c17eadc60c3d
children 482b0acef25a
comparison
equal deleted inserted replaced
771:c17eadc60c3d 772:1959ba53e9dc
21 21
22 // 22 //
23 // Typedefs and structures 23 // Typedefs and structures
24 // 24 //
25 struct th_ioctx_t; 25 struct th_ioctx_t;
26 struct th_ioctx_t_ops; 26 struct th_ioctx_ops_t;
27 27
28 28
29 /** I/O context structure 29 /** I/O context structure
30 */ 30 */
31 typedef struct th_ioctx_t 31 typedef struct th_ioctx_t
54 54
55 // Message functions 55 // Message functions
56 void (*error)(struct th_ioctx_t *ctx, const int err, const char *msg); 56 void (*error)(struct th_ioctx_t *ctx, const int err, const char *msg);
57 void (*msg)(struct th_ioctx_t *ctx, const int level, const char *msg); 57 void (*msg)(struct th_ioctx_t *ctx, const int level, const char *msg);
58 58
59 const struct th_ioctx_t_ops *fops; ///< Pointer to I/O ops struct to be used with this context 59 const struct th_ioctx_ops_t *fops; ///< Pointer to I/O ops struct to be used with this context
60 } th_ioctx_t; 60 } th_ioctx_t;
61 61
62 62
63 typedef struct th_ioctx_t_ops 63 typedef struct th_ioctx_ops_t
64 { 64 {
65 char *name; ///< Name of this I/O ops definition 65 char *name; ///< Name of this I/O ops definition
66 66
67 int (*fopen)(th_ioctx_t *ctx); 67 int (*fopen)(th_ioctx_t *ctx);
68 void (*fclose)(th_ioctx_t *ctx); 68 void (*fclose)(th_ioctx_t *ctx);
80 80
81 char * (*fgets)(char *str, int size, th_ioctx_t *ctx); 81 char * (*fgets)(char *str, int size, th_ioctx_t *ctx);
82 int (*fputs)(const char *str, th_ioctx_t *ctx); 82 int (*fputs)(const char *str, th_ioctx_t *ctx);
83 int (*vfprintf)(th_ioctx_t *ctx, const char *fmt, va_list ap); 83 int (*vfprintf)(th_ioctx_t *ctx, const char *fmt, va_list ap);
84 84
85 } th_ioctx_t_ops; 85 } th_ioctx_ops_t;
86 86
87 87
88 // 88 //
89 // Some basic iops 89 // Some basic iops
90 // 90 //
91 extern const th_ioctx_t_ops th_stdio_io_ops, th_mem_io_ops; 91 extern const th_ioctx_ops_t th_stdio_io_ops, th_mem_io_ops;
92 92
93 93
94 94
95 // 95 //
96 // I/O context management functions 96 // I/O context management functions
97 // 97 //
98 th_ioctx_t * th_io_new(const th_ioctx_t_ops *fops, const char *filename, const char *mode); 98 th_ioctx_t * th_io_new(const th_ioctx_ops_t *fops, const char *filename, const char *mode);
99 int th_io_fopen(th_ioctx_t **pctx, const th_ioctx_t_ops *fops, const char *filename, const char *mode); 99 int th_io_fopen(th_ioctx_t **pctx, const th_ioctx_ops_t *fops, const char *filename, const char *mode);
100 int th_io_reopen(th_ioctx_t *ctx, const char *mode); 100 int th_io_reopen(th_ioctx_t *ctx, const char *mode);
101 void th_io_close(th_ioctx_t *ctx); 101 void th_io_close(th_ioctx_t *ctx);
102 102
103 void th_io_init_stdio(th_ioctx_t *ctx, FILE *fh); 103 void th_io_init_stdio(th_ioctx_t *ctx, FILE *fh);
104 104