From 10950039598638315f96a5a966804d68427166e5 Mon Sep 17 00:00:00 2001 From: pixel Date: Thu, 17 Feb 2005 08:33:49 +0000 Subject: Updating makefiles to add luapatch, and updating things a bit for PS2 target. --- lib/BLua.cc | 5 +++-- lib/Exceptions.cc | 14 +++++++++++++- lib/Handle.cc | 10 ++++++++-- lib/Input.cc | 31 ++++++++++++++++--------------- lib/Output.cc | 12 ++++++++++-- 5 files changed, 50 insertions(+), 22 deletions(-) (limited to 'lib') diff --git a/lib/BLua.cc b/lib/BLua.cc index 056598f..4a37c1b 100644 --- a/lib/BLua.cc +++ b/lib/BLua.cc @@ -17,8 +17,9 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: BLua.cc,v 1.28 2005-02-17 08:31:04 pixel Exp $ */ +/* $Id: BLua.cc,v 1.29 2005-02-17 08:33:50 pixel Exp $ */ +#include #include "BLua.h" #include @@ -70,7 +71,7 @@ class LuaStatics : public Base { std::map Lua::lualist; -int LuaStatics::luaerror(lua_State * _L) throw (GeneralException) { +int LuaStatics::luaerror(lua_State * _L) { Lua * L = Lua::find(_L); L->push_lua_context(); L->showerror(); diff --git a/lib/Exceptions.cc b/lib/Exceptions.cc index a6cfc54..acc948c 100644 --- a/lib/Exceptions.cc +++ b/lib/Exceptions.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Exceptions.cc,v 1.37 2004-12-27 18:50:00 pixel Exp $ */ +/* $Id: Exceptions.cc,v 1.38 2005-02-17 08:33:50 pixel Exp $ */ #include #include @@ -178,6 +178,14 @@ int xpipe(int *, int) throw (GeneralException) { } #endif +int xdup(int h) throw(GeneralException) { +#ifdef __MIPSEL__ + throw GeneralException(_("Dup isn't supported on PlayStation2 yet")); +#else + return dup(h); +#endif +} + #ifdef HAVE_FORK pid_t xfork() throw (GeneralException) { pid_t p; @@ -220,6 +228,10 @@ void * Base::calloc(size_t n, size_t s) { return xmalloc(n * s); } +int Base::dup(int h) { + return xdup(h); +} + void * Base::operator new(size_t s) { #ifdef DEBUG printm(M_BARE, _("Operator new(s) called. Allocating memory.\n")); diff --git a/lib/Handle.cc b/lib/Handle.cc index b875f3e..684001d 100644 --- a/lib/Handle.cc +++ b/lib/Handle.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Handle.cc,v 1.74 2004-12-23 02:30:34 pixel Exp $ */ +/* $Id: Handle.cc,v 1.75 2005-02-17 08:33:50 pixel Exp $ */ #include #include @@ -50,7 +50,7 @@ inline Uint32 bswap_32(Uint32 w) { #include #endif -#ifndef _WIN32 +#if !defined(_WIN32) && !defined(__MIPSEL__) #include #endif @@ -605,7 +605,11 @@ void * Handle::mmap(off_t offset, size_t length) throw (GeneralException) { } maplength = length; #ifndef _WIN32 +#ifdef __MIPSEL__ + throw GeneralException("No mmap in ps2sdk yet."); +#else r = ::mmap(0, length, (CanRead() ? PROT_READ : 0) | (CanWrite() ? PROT_WRITE : 0), MAP_SHARED, h, offset); +#endif if (!r) { throw GeneralException(String("Was not able to mmap(): ") + strerror(errno)); } @@ -643,9 +647,11 @@ void Handle::munmap() throw (GeneralException) { throw GeneralException("Can't munmap, was not mapped"); } #ifndef _WIN32 +#ifndef __MIPSEL__ if (::munmap(mappedarea, maplength)) { throw GeneralException(String("Was not able to munmap(): ") + strerror(errno)); } +#endif #else if (!UnmapViewOfFile(mappedarea)) { throw GeneralException("Was not able to UnmapViewOfFile()"); diff --git a/lib/Input.cc b/lib/Input.cc index 15d9a38..1c58dab 100644 --- a/lib/Input.cc +++ b/lib/Input.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Input.cc,v 1.50 2004-12-27 18:48:48 pixel Exp $ */ +/* $Id: Input.cc,v 1.51 2005-02-17 08:33:50 pixel Exp $ */ #include #include @@ -107,27 +107,24 @@ Input::Input(const String & no) throw (GeneralException) : fromarchive = false; if (results.name == "") { +#ifndef __MIPSEL__ struct stat s; fstat(GetHandle(), &s); date_modif = s.st_mtime; +#endif #ifdef __linux__ - if (S_ISREG(s.st_mode)) { + if (S_ISREG(s.st_mode)) #endif -#if 0 -#if defined (_WIN32) && !defined (NO_HFILE) - if (hFile) { - GetFileSize(hFile, (LPDWORD)&size); - } else -#endif -#endif - { - size = seek(0, SEEK_END); - seek(0, SEEK_SET); - } -#ifdef __linux__ - } +#if 0 && defined (_WIN32) && !defined (NO_HFILE) + if (hFile) { + GetFileSize(hFile, (LPDWORD)&size); + } else #endif + { + size = seek(0, SEEK_END); + seek(0, SEEK_SET); + } } else { #ifdef DEBUG printm(M_INFO, String(_("Opening file in archive, position ")) + results.ptr + "\n"); @@ -154,11 +151,15 @@ bool Input::CanRead() const { } bool Input::CanSeek() const { +#ifdef __MIPSEL__ + return true; +#else struct stat s; fstat(GetHandle(), &s); return S_ISREG(s.st_mode); +#endif } String Input::GetName() const { diff --git a/lib/Output.cc b/lib/Output.cc index 310ca79..ab5a583 100644 --- a/lib/Output.cc +++ b/lib/Output.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: Output.cc,v 1.22 2004-11-27 21:46:04 pixel Exp $ */ +/* $Id: Output.cc,v 1.23 2005-02-17 08:33:50 pixel Exp $ */ #include #include @@ -51,11 +51,15 @@ Output::Output(String no, int create, int trunc) throw (GeneralException) : size = lseek(GetHandle(), 0, SEEK_END); lseek(GetHandle(), 0, SEEK_SET); +#ifndef __MIPSEL__ struct stat s; fstat(GetHandle(), &s); date_modif = s.st_mtime; +#else + date_modif = 0; +#endif } int Output::wrapopen(const String & n, int create, int trunc) { @@ -107,11 +111,15 @@ bool Output::CanRead() const { } bool Output::CanSeek() const { +#ifdef __MIPSEL__ + return true; +#else struct stat s; fstat(GetHandle(), &s); - return S_ISREG(s.st_mode); + return S_ISREG(s.st_mode); +#endif } off_t Output::seek(off_t offset, int whence) throw (GeneralException) { -- cgit v1.2.3