From 9c4faeaa889fb1e74cff4f0da4959998398e74da Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Sat, 7 Jul 2001 08:24:47 +0000 Subject: [PATCH] Moved from root source dir. --- archivers/dir.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++ archivers/zip.c | 54 +++++++++++++++++++++++++++++++++++++++++ platform/unix.c | 63 ++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 181 insertions(+) create mode 100644 archivers/dir.c create mode 100644 archivers/zip.c create mode 100644 platform/unix.c diff --git a/archivers/dir.c b/archivers/dir.c new file mode 100644 index 0000000..54e7b3b --- /dev/null +++ b/archivers/dir.c @@ -0,0 +1,64 @@ +/* + * Standard directory I/O support routines for PhysicsFS. + * + * Please see the file LICENSE in the source's root directory. + * + * This file written by Ryan C. Gordon. + */ + +#include +#include + +#define __PHYSICSFS_INTERNAL__ +#include "physfs_internal.h" + +static const FileFunctions __PHYSFS_FileHandle_DIR = +{ + DIR_read, /* read() method */ + NULL, /* write() method */ + DIR_eof, /* eof() method */ + DIR_tell, /* tell() method */ + DIR_seek, /* seek() method */ + DIR_close, /* close() method */ +}; + + +static const FileFunctions __PHYSFS_FileHandle_DIRW = +{ + NULL, /* read() method */ + DIR_write, /* write() method */ + DIR_eof, /* eof() method */ + DIR_tell, /* tell() method */ + DIR_seek, /* seek() method */ + DIR_close, /* close() method */ +}; + + +const DirFunctions __PHYSFS_DirFunctions_DIR = +{ + DIR_isArchive, /* isArchive() method */ + DIR_openArchive, /* openArchive() method */ + DIR_enumerate, /* enumerateFiles() method */ + DIR_exists, /* exists() method */ + DIR_isDirectory, /* isDirectory() method */ + DIR_isSymLink, /* isSymLink() method */ + DIR_openRead, /* openRead() method */ + DIR_openWrite, /* openWrite() method */ + DIR_openAppend, /* openAppend() method */ + DIR_remove, /* remove() method */ + DIR_mkdir, /* mkdir() method */ + DIR_close, /* close() method */ +}; + + +/* This doesn't get listed, since it's technically not an archive... */ +#if 0 +const __PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_DIR = +{ + "DIR", + "non-archive directory I/O" +}; +#endif + +/* end of dir.c ... */ + diff --git a/archivers/zip.c b/archivers/zip.c new file mode 100644 index 0000000..c1f5d87 --- /dev/null +++ b/archivers/zip.c @@ -0,0 +1,54 @@ +/* + * ZIP support routines for PhysicsFS. + * + * Please see the file LICENSE in the source's root directory. + * + * This file written by Ryan C. Gordon. + */ + +#include +#include + +#define __PHYSICSFS_INTERNAL__ +#include "physfs_internal.h" + +#if (!defined PHYSFS_SUPPORTS_ZIP) +#error PHYSFS_SUPPORTS_ZIP must be defined. +#endif + + +static const FileFunctions __PHYSFS_FileHandle_ZIP = +{ + ZIP_read, /* read() method */ + NULL, /* write() method */ + ZIP_eof, /* eof() method */ + ZIP_tell, /* tell() method */ + ZIP_seek, /* seek() method */ + ZIP_close, /* close() method */ +}; + + +const DirFunctions __PHYSFS_DirFunctions_ZIP = +{ + ZIP_isArchive, /* isArchive() method */ + ZIP_openArchive, /* openArchive() method */ + ZIP_enumerate, /* enumerateFiles() method */ + ZIP_exists, /* exists() method */ + ZIP_isDirectory, /* isDirectory() method */ + ZIP_isSymLink, /* isSymLink() method */ + ZIP_openRead, /* openRead() method */ + NULL, /* openWrite() method */ + NULL, /* openAppend() method */ + NULL, /* remove() method */ + NULL, /* mkdir() method */ + ZIP_close, /* close() method */ +}; + +const __PHYSFS_ArchiveInfo __PHYSFS_ArchiveInfo_ZIP = +{ + "ZIP", + "PkZip/WinZip/Info-Zip compatible" +}; + +/* end of zip.c ... */ + diff --git a/platform/unix.c b/platform/unix.c new file mode 100644 index 0000000..487ba3c --- /dev/null +++ b/platform/unix.c @@ -0,0 +1,63 @@ +/* + * Unix support routines for PhysicsFS. + * + * Please see the file LICENSE in the source's root directory. + * + * This file written by Ryan C. Gordon. + */ + +#include +#include +#include + +#define __PHYSICSFS_INTERNAL__ +#include "physfs_internal.h" + + +const char *__PHYSFS_platformDirSeparator = "/"; + +char **__PHYSFS_platformDetectAvailableCDs(void) +{ +} /* __PHYSFS_detectAvailableCDs */ + + +char *__PHYSFS_platformCalcBaseDir(char *argv0) +{ + return(NULL); +} /* __PHYSFS_platformCalcBaseDir */ + + +char *__PHYSFS_platformGetUserName(void) +{ +} /* __PHYSFS_platformGetUserName */ + + +char *__PHYSFS_platformGetUserDir(void) +{ +} /* __PHYSFS_platformGetUserDir */ + + +int __PHYSFS_platformGetThreadID(void) +{ + return((int) pthread_self()); +} /* __PHYSFS_platformGetThreadID */ + + +int __PHYSFS_platformStricmp(const char *str1, const char *str2) +{ + return(strcasecmp(str1, str2)); +} /* __PHYSFS_platformStricmp */ + + +int __PHYSFS_platformIsSymlink(const char *fname) +{ +} /* __PHYSFS_platformIsSymlink */ + + +int __PHYSFS_platformIsDirectory(const char *fname) +{ +} /* __PHYSFS_platformIsDirectory */ + + +/* end of unix.c ... */ +