aboutsummaryrefslogtreecommitdiffstats
path: root/src/gfile/inc_memfs.c
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2014-02-15 22:31:33 +1000
committerinmarket <andrewh@inmarket.com.au>2014-02-15 22:31:33 +1000
commitdcedf414136e55e6dacbe736babe748e1374e19e (patch)
treede3823534bfa37f9cc92c0dae3b474db8ece9088 /src/gfile/inc_memfs.c
parent84fc1ac166fc2908b5840a78ceb515b4f14edd80 (diff)
parent5edf7c956e8a00a6a49e1f3c446c80cecf0e59ef (diff)
downloaduGFX-dcedf414136e55e6dacbe736babe748e1374e19e.tar.gz
uGFX-dcedf414136e55e6dacbe736babe748e1374e19e.tar.bz2
uGFX-dcedf414136e55e6dacbe736babe748e1374e19e.zip
Merge branch 'master' into gwin
Diffstat (limited to 'src/gfile/inc_memfs.c')
-rw-r--r--src/gfile/inc_memfs.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/gfile/inc_memfs.c b/src/gfile/inc_memfs.c
new file mode 100644
index 00000000..434150d8
--- /dev/null
+++ b/src/gfile/inc_memfs.c
@@ -0,0 +1,43 @@
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ * http://ugfx.org/license.html
+ */
+
+/**
+ * This file is included by src/gfile/gfile.c
+ */
+
+/********************************************************
+ * The Memory pointer file-system VMT
+ ********************************************************/
+
+#include <string.h>
+
+static int MEMRead(GFILE *f, void *buf, int size);
+static int MEMWrite(GFILE *f, const void *buf, int size);
+static bool_t MEMSetpos(GFILE *f, long int pos);
+
+static const GFILEVMT FsMemVMT = {
+ 0, // next
+ GFSFLG_SEEKABLE|GFSFLG_WRITEABLE, // flags
+ 0, // prefix
+ 0, 0, 0, 0,
+ 0, 0, MEMRead, MEMWrite,
+ MEMSetpos, 0, 0,
+};
+
+static int MEMRead(GFILE *f, void *buf, int size) {
+ memcpy(buf, ((char *)f->obj)+f->pos, size);
+ return size;
+}
+static int MEMWrite(GFILE *f, const void *buf, int size) {
+ memcpy(((char *)f->obj)+f->pos, buf, size);
+ return size;
+}
+static bool_t MEMSetpos(GFILE *f, long int pos) {
+ (void) f;
+ (void) pos;
+ return TRUE;
+}