aboutsummaryrefslogtreecommitdiff
path: root/backends/file/ds/ds-file.h
diff options
context:
space:
mode:
authorDavid Corrales2007-08-01 22:07:50 +0000
committerDavid Corrales2007-08-01 22:07:50 +0000
commit1400d28bfb37fc94f3c44dec0a4d0cef65fb8fb7 (patch)
tree57e08541d48d6a98fc7f700f75dade472a2878bb /backends/file/ds/ds-file.h
parent9752c75f407c8bd82006222433fcc3618b9e82bb (diff)
downloadscummvm-rg350-1400d28bfb37fc94f3c44dec0a4d0cef65fb8fb7.tar.gz
scummvm-rg350-1400d28bfb37fc94f3c44dec0a4d0cef65fb8fb7.tar.bz2
scummvm-rg350-1400d28bfb37fc94f3c44dec0a4d0cef65fb8fb7.zip
Initial commit of the new BaseFile implementation. It provides a common ground for file objects across platforms and divides responsibilities between the Common::File class and a base file implementation.
Also rearranged the factories into a new directory for clarity. Note 1: The posix-file.h and cpp files are for testing only. Only the ds, ps2 and symbian architecture will use special BaseFile based objects. Note 2: The current code does not yet make use of this new structure, since the Common::File remains intact. svn-id: r28395
Diffstat (limited to 'backends/file/ds/ds-file.h')
-rw-r--r--backends/file/ds/ds-file.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/backends/file/ds/ds-file.h b/backends/file/ds/ds-file.h
new file mode 100644
index 0000000000..e133def548
--- /dev/null
+++ b/backends/file/ds/ds-file.h
@@ -0,0 +1,46 @@
+#ifdef __DS__
+
+ // These functions replease the standard library functions of the same name.
+ // As this header is included after the standard one, I have the chance to #define
+ // all of these to my own code.
+ //
+ // A #define is the only way, as redefinig the functions would cause linker errors.
+
+ // These functions need to be #undef'ed, as their original definition
+ // in devkitarm is done with #includes (ugh!)
+ #undef feof
+ #undef clearerr
+ //#undef getc
+ //#undef ferror
+
+
+ //void std_fprintf(FILE* handle, const char* fmt, ...); // used in common/util.cpp
+ //void std_fflush(FILE* handle); // used in common/util.cpp
+
+ //char* std_fgets(char* str, int size, FILE* file); // not used
+ //int std_getc(FILE* handle); // not used
+ //char* std_getcwd(char* dir, int dunno); // not used
+ //void std_cwd(char* dir); // not used
+ //int std_ferror(FILE* handle); // not used
+
+ // Only functions used in the ScummVM source have been defined here!
+ #define fopen(name, mode) DS::std_fopen(name, mode)
+ #define fclose(handle) DS::std_fclose(handle)
+ #define fread(ptr, size, items, file) DS::std_fread(ptr, size, items, file)
+ #define fwrite(ptr, size, items, file) DS::std_fwrite(ptr, size, items, file)
+ #define feof(handle) DS::std_feof(handle)
+ #define ftell(handle) DS::std_ftell(handle)
+ #define fseek(handle, offset, whence) DS::std_fseek(handle, offset, whence)
+ #define clearerr(handle) DS::std_clearerr(handle)
+
+ //#define printf(fmt, ...) consolePrintf(fmt, ##__VA_ARGS__)
+
+ //#define fprintf(file, fmt, ...) { char str[128]; sprintf(str, fmt, ##__VA_ARGS__); DS::std_fwrite(str, strlen(str), 1, file); }
+ //#define fflush(file) DS::std_fflush(file) // used in common/util.cpp
+
+ //#define fgets(str, size, file) DS::std_fgets(str, size, file) // not used
+ //#define getc(handle) DS::std_getc(handle) // not used
+ //#define getcwd(dir, dunno) DS::std_getcwd(dir, dunno) // not used
+ //#define ferror(handle) DS::std_ferror(handle) // not used
+
+#endif \ No newline at end of file