diff options
author | inmarket <andrewh@inmarket.com.au> | 2014-02-07 01:34:38 +1000 |
---|---|---|
committer | inmarket <andrewh@inmarket.com.au> | 2014-02-07 01:34:38 +1000 |
commit | e72e2705381558ff2347543ed21b853a1168858c (patch) | |
tree | f0e3026640e71e4a78b9d8f46bb9daea7cee8743 /src/gfile/inc_memfs.c | |
parent | 9ef10b9ec669bd6af0747b083b1b61b4a041e206 (diff) | |
download | uGFX-e72e2705381558ff2347543ed21b853a1168858c.tar.gz uGFX-e72e2705381558ff2347543ed21b853a1168858c.tar.bz2 uGFX-e72e2705381558ff2347543ed21b853a1168858c.zip |
Add support for GFILEs based on BaseFileStreams and Memory Pointers
Diffstat (limited to 'src/gfile/inc_memfs.c')
-rw-r--r-- | src/gfile/inc_memfs.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/gfile/inc_memfs.c b/src/gfile/inc_memfs.c new file mode 100644 index 00000000..fee089ce --- /dev/null +++ b/src/gfile/inc_memfs.c @@ -0,0 +1,41 @@ +/* + * 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, char *buf, int size); +static int MEMWrite(GFILE *f, char *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, char *buf, int size) { + memset(buf, ((char *)f->fd)+f->pos, size); + return size; +} +static int MEMWrite(GFILE *f, char *buf, int size) { + memset(((char *)f->fd)+f->pos, buf, size); + return size; +} +static bool_t MEMSetpos(GFILE *f, long int pos) { + return TRUE; +} |