You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2022/11/25 13:41:58 UTC
[nuttx] 01/02: include: unified stream read and write interface
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 511070c300a18768927c5398f8ac26359e54d1db
Author: yinshengkai <yi...@xiaomi.com>
AuthorDate: Fri Nov 25 17:19:45 2022 +0800
include: unified stream read and write interface
Signed-off-by: yinshengkai <yi...@xiaomi.com>
---
include/nuttx/streams.h | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/include/nuttx/streams.h b/include/nuttx/streams.h
index da85e1d9ea..109681558c 100644
--- a/include/nuttx/streams.h
+++ b/include/nuttx/streams.h
@@ -40,6 +40,25 @@
* Pre-processor Definitions
****************************************************************************/
+#define lib_stream_puts(stream, buf, len) \
+ ((FAR struct lib_outstream_s *)(stream))->puts( \
+ (FAR struct lib_outstream_s *)(stream), buf, len)
+#define lib_stream_putc(stream, ch) \
+ ((FAR struct lib_outstream_s *)(stream))->putc( \
+ (FAR struct lib_outstream_s *)(stream), ch)
+#define lib_stream_getc(stream) \
+ ((FAR struct lib_instream_s *)(stream))->get( \
+ (FAR struct lib_instream_s *)(stream))
+#define lib_stream_gets(stream, buf, len) \
+ ((FAR struct lib_instream_s *)(stream))->gets( \
+ (FAR struct lib_instream_s *)(stream), buf, len)
+#define lib_stream_flush(stream) \
+ ((FAR struct lib_outstream_s *)(stream))->flush( \
+ (FAR struct lib_outstream_s *)(stream))
+#define lib_stream_seek(stream, offset, whence) \
+ ((FAR struct lib_sostream_s *)(stream))->seek( \
+ (FAR struct lib_sostream_s *)(stream), offset, whence)
+
#ifdef CONFIG_LIBC_LZF
#define LZF_STREAM_BLOCKSIZE ((1 << CONFIG_STREAM_LZF_BLOG) - 1)
#endif