diff options
author | pixel <pixel> | 2004-05-01 11:48:57 +0000 |
---|---|---|
committer | pixel <pixel> | 2004-05-01 11:48:57 +0000 |
commit | 8c1b2d217ef0a0cf825e873149c06b72b462d6c4 (patch) | |
tree | 6344dbcd6db4b317621977d1bd10352d6d99b84e | |
parent | ee584fefbfc67549ae0a8bf6f421b6840cf455de (diff) |
Fixes, changes, improvements, ...
-rw-r--r-- | include/BLua.h | 9 | ||||
-rw-r--r-- | lib/BLua.cc | 8 | ||||
-rw-r--r-- | lib/Handle.cc | 10 |
3 files changed, 22 insertions, 5 deletions
diff --git a/include/BLua.h b/include/BLua.h index dc2d963..4f8acc2 100644 --- a/include/BLua.h +++ b/include/BLua.h @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: BLua.h,v 1.13 2004-02-27 10:35:44 pixel Exp $ */ +/* $Id: BLua.h,v 1.14 2004-05-01 11:48:57 pixel Exp $ */ #ifndef __BLUA_H__ #define __BLUA_H__ @@ -99,6 +99,13 @@ class LuaObject : public Base { bool wantdestruct, pushed; }; +class LuaException : public GeneralException { + public: + LuaException(String); + protected: + LuaException(); +}; + enum Lua_types_t { LUA_ANY = 0, LUA_OBJECT, diff --git a/lib/BLua.cc b/lib/BLua.cc index 1166915..95519a1 100644 --- a/lib/BLua.cc +++ b/lib/BLua.cc @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id: BLua.cc,v 1.17 2003-12-26 23:51:33 pixel Exp $ */ +/* $Id: BLua.cc,v 1.18 2004-05-01 11:48:57 pixel Exp $ */ #include <lualib.h> @@ -27,8 +27,6 @@ #define BUFFERSIZE 2048 #endif -typedef GeneralException LuaException; - class LuaStatics : public Base { public: static const char * getF(lua_State *, void *, size_t *); @@ -619,3 +617,7 @@ void LuaObject::pushdestruct(Lua * L) throw (GeneralException) { wantdestruct = true; } + +LuaException::LuaException(String fn) : GeneralException(fn) { } + +LuaException::LuaException() { } diff --git a/lib/Handle.cc b/lib/Handle.cc index fe58b48..9f369ce 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.69 2004-04-30 08:21:36 pixel Exp $ */ +/* $Id: Handle.cc,v 1.70 2004-05-01 11:48:57 pixel Exp $ */ #include <stdio.h> #include <string.h> @@ -102,6 +102,10 @@ ssize_t Handle::write(const void *cbuf, size_t count) throw (GeneralException) { ssize_t r, tr = 0; bool done, full = false; const char * buf = (const char *)cbuf; + + if (closed) { + throw IOGeneral("Unable to write: handle `" + GetName() + "' is closed."); + } if (!count) return 0; @@ -151,6 +155,10 @@ ssize_t Handle::write(const void *cbuf, size_t count) throw (GeneralException) { ssize_t Handle::read(void *buf, size_t count) throw (GeneralException) { ssize_t r; + if (closed) { + throw IOGeneral("Unable to read: handle `" + GetName() + "' is closed."); + } + if (!count) return 0; |