summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/Handle.h3
-rw-r--r--lib/BLua.cc19
-rw-r--r--lib/Handle.cc11
-rw-r--r--lib/Input.cc6
4 files changed, 28 insertions, 11 deletions
diff --git a/include/Handle.h b/include/Handle.h
index ebe488c..89eaba3 100644
--- a/include/Handle.h
+++ b/include/Handle.h
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: Handle.h,v 1.31 2003-12-04 04:09:02 pixel Exp $ */
+/* $Id: Handle.h,v 1.32 2003-12-07 05:50:41 pixel Exp $ */
#ifndef __HANDLE_H__
#define __HANDLE_H__
@@ -57,6 +57,7 @@ class Handle : public Base {
virtual time_t GetModif() const;
void close() throw (GeneralException);
int GetHandle();
+ void * GetHFile();
virtual bool CanWatch() const;
virtual int Dup() const throw (GeneralException);
virtual void SetZ(int = 9) throw (GeneralException);
diff --git a/lib/BLua.cc b/lib/BLua.cc
index 9e5373e..c3f7351 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.8 2003-12-07 04:44:38 pixel Exp $ */
+/* $Id: BLua.cc,v 1.9 2003-12-07 05:50:41 pixel Exp $ */
#include <lualib.h>
@@ -33,7 +33,8 @@ class LuaStatics : public Base {
public:
static const char * getF(lua_State *, void *, size_t *);
static int putF(lua_State *, const void *, size_t, void *);
- static int luapanic(lua_State *) throw(GeneralException);
+ static int luapanic(lua_State *);
+ static int trueluapanic(lua_State *) throw(GeneralException);
static int destructor(lua_State *);
static int andB(lua_State *);
@@ -45,7 +46,11 @@ class LuaStatics : public Base {
std::map<lua_State *, Lua *> Lua::lualist;
-int LuaStatics::luapanic(lua_State * L) throw (GeneralException) {
+int LuaStatics::luapanic(lua_State * L) {
+ return trueluapanic(L);
+}
+
+int LuaStatics::trueluapanic(lua_State * L) throw (GeneralException) {
Lua::find(L)->showerror();
throw LuaException("Error running Lua code, bailing out.");
}
@@ -437,10 +442,10 @@ void Lua::showerror() {
t.set("(Number) %f", lua_tonumber(L, i));
break;
case LUA_TBOOLEAN:
- t.set("(Bool) %s", lua_toboolean(L, i) ? "true" : "false");
+ t = String("(Bool) ") + (lua_toboolean(L, i) ? "true" : "false");
break;
case LUA_TSTRING:
- t.set("(String) %s", lua_tostring(L, i));
+ t = String("(String) ") + lua_tostring(L, i);
break;
case LUA_TTABLE:
t = "(Table)";
@@ -499,13 +504,13 @@ void LuaObject::pushit(Lua * L, const String & s, lua_CFunction f) {
}
void LuaObject::pushmeta(Lua * L, const String & s, lua_CFunction f) {
- if (!L->getmetatable(1)) {
+ if (!L->getmetatable()) {
L->newtable();
}
L->push(s);
L->push(f);
L->settable();
- L->setmetatable(1);
+ L->setmetatable();
}
int LuaStatics::destructor(lua_State * _L) {
diff --git a/lib/Handle.cc b/lib/Handle.cc
index 68724aa..d18a2e4 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.63 2003-12-04 04:09:02 pixel Exp $ */
+/* $Id: Handle.cc,v 1.64 2003-12-07 05:50:41 pixel Exp $ */
#include <stdio.h>
#include <string.h>
@@ -90,6 +90,10 @@ int Handle::GetHandle() {
return h;
}
+void * Handle::GetHFile() {
+ return hFile;
+}
+
int Handle::GetHandle() const {
return h;
}
@@ -558,6 +562,11 @@ void * Handle::mmap(off_t offset, size_t length) throw (GeneralException) {
if (h == -1) {
throw GeneralException("Can't mmap() a virtual handle");
}
+#ifdef _WIN32
+ if (!hFile) {
+ throw GeneralException("Can't mmap() a non-hFile handle under windows");
+ }
+#endif
if (mapped) {
throw GeneralException("Handle already mmap()ped");
}
diff --git a/lib/Input.cc b/lib/Input.cc
index b4dfb85..3f2fe21 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.37 2003-12-04 04:09:02 pixel Exp $ */
+/* $Id: Input.cc,v 1.38 2003-12-07 05:50:41 pixel Exp $ */
#include <stdio.h>
#include <string.h>
@@ -121,6 +121,7 @@ Input::Input(const String & no) throw (GeneralException) :
date_modif = 0;
SetZ();
fromarchive = true;
+ itell = 0;
}
}
@@ -183,7 +184,8 @@ int Input::wrapopen(const String & fname, openresults_t * results) {
printm(M_BARE, _("Trying to open the file in archive, since it seems to be here\n"));
#endif
#ifdef _WIN32
- hFile = t->GetHandle();
+// hFile = t->GetHandle()->GetHFile();
+ hFile = 0;
#endif
return t->open(fname, results);
}