summaryrefslogtreecommitdiff
path: root/bridges
diff options
context:
space:
mode:
authorTazyFoundSoup <gardendistrict0x0@outlook.com>2026-03-28 16:27:54 +1100
committerTazyFoundSoup <gardendistrict0x0@outlook.com>2026-03-28 16:30:38 +1100
commit4ad97bd1527c6ccb2f31c61e9da33f2900379c04 (patch)
tree04ce34ae274b280c500797caaf308681fae62182 /bridges
parent99c82d92180a7c1b6a1d3393d91f9fef0369edb5 (diff)
fix(bridges): Create new file stream moved to stdio bridge
Diffstat (limited to 'bridges')
-rw-r--r--bridges/README.md2
-rw-r--r--bridges/stdio/stream.c17
-rw-r--r--bridges/stdio/stream.h8
3 files changed, 26 insertions, 1 deletions
diff --git a/bridges/README.md b/bridges/README.md
index 4bccdc9..02e477f 100644
--- a/bridges/README.md
+++ b/bridges/README.md
@@ -5,4 +5,4 @@ These files **do not need to be compiled** if you are running tinyff on a freest
## Structure
-`stream_file.c`: The bridge for file handling. \ No newline at end of file
+`stdio/`: Bridges which use the stdio library
diff --git a/bridges/stdio/stream.c b/bridges/stdio/stream.c
new file mode 100644
index 0000000..72cee46
--- /dev/null
+++ b/bridges/stdio/stream.c
@@ -0,0 +1,17 @@
+#include "../bridges/stdio/stream.h"
+
+size_t ff_file_read(void *ptr, size_t size, void *user)
+{
+ FILE *f = (FILE *)user;
+ return fread(ptr, size, 1, f);
+}
+
+ff_stream ff_create_file_stream(FILE *f)
+{
+ ff_stream stream;
+ stream.read = ff_file_read;
+ stream.user = (void *)f;
+ return stream;
+}
+
+// Memory stream coming soon \ No newline at end of file
diff --git a/bridges/stdio/stream.h b/bridges/stdio/stream.h
new file mode 100644
index 0000000..1ae2dbc
--- /dev/null
+++ b/bridges/stdio/stream.h
@@ -0,0 +1,8 @@
+#include <stdio.h>
+#include <tinyff/stream.h>
+
+// Default reads for common types (just FILE for now, memory later)
+size_t ff_file_read(void *ptr, size_t size, void *user);
+
+// Stream creation helpers
+ff_stream ff_create_file_stream(FILE *f); \ No newline at end of file