summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/BLua.cc25
-rw-r--r--lib/String.cc5
-rw-r--r--lib/hashtab.c8
-rw-r--r--lib/recycle.c2
4 files changed, 37 insertions, 3 deletions
diff --git a/lib/BLua.cc b/lib/BLua.cc
index d86740d..7d70bb9 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.36 2006-02-09 17:08:24 pixel Exp $ */
+/* $Id: BLua.cc,v 1.37 2006-07-16 12:24:54 pixel Exp $ */
#include <stdlib.h>
#include "BLua.h"
@@ -77,6 +77,7 @@ class LuaStatics : public Base {
static int dumpvars(lua_State *);
static int iconv(lua_State *);
+ static int mkdir(lua_State *);
static int globalindex(lua_State *);
};
@@ -299,6 +300,22 @@ int LuaStatics::iconv(lua_State * _L) {
return 1;
}
+int LuaStatics::mkdir(lua_State * _L) {
+ Lua * L = Lua::find(_L);
+ int n = L->gettop();
+ String dirname;
+
+ if (n != 1) {
+ L->error("Incorrect arguments to function `mkdir'");
+ }
+
+ dirname = L->tostring(1);
+
+ ::MKDIR(dirname.to_charp());
+
+ return 0;
+}
+
int LuaStatics::callwrap(lua_State * __L, lua_CFunction func) {
Lua * L = Lua::find(__L);
int n;
@@ -419,7 +436,13 @@ Lua::Lua(const Lua & l) throw (GeneralException) {
void Lua::open_base() {
lock();
luaopen_base(L);
+ push("mkdir");
+ push(LuaStatics::mkdir);
+ settable();
lua_pop(L, 1);
+ push("mkdir");
+ push(LuaStatics::mkdir);
+ settable(LUA_GLOBALSINDEX);
unlock();
}
diff --git a/lib/String.cc b/lib/String.cc
index 36e6c52..bc5739e 100644
--- a/lib/String.cc
+++ b/lib/String.cc
@@ -17,7 +17,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-/* $Id: String.cc,v 1.43 2006-02-09 17:03:07 pixel Exp $ */
+/* $Id: String.cc,v 1.44 2006-07-16 12:24:54 pixel Exp $ */
#include <stdio.h>
#include <string.h>
@@ -562,8 +562,9 @@ String String::trim() const {
return rtrim().ltrim();
}
-String & String::iconv(const String & from, const String & to) {
+String & String::iconv(const String & from, const String & _to) {
iconv_t cd;
+ String to = _to + "//TRANSLIT";
#ifdef __linux__
char * inbuf;
#else
diff --git a/lib/hashtab.c b/lib/hashtab.c
index 4ce9961..566d7a6 100644
--- a/lib/hashtab.c
+++ b/lib/hashtab.c
@@ -40,6 +40,14 @@ This implements a hash table.
#include "recycle.h"
#endif
+#ifndef FALSE
+#define FALSE 0
+#endif
+
+#ifndef TRUE
+#define TRUE !FALSE
+#endif
+
/* sanity check -- make sure ipos, apos, and count make sense */
static void hsanity(t)
htab *t;
diff --git a/lib/recycle.c b/lib/recycle.c
index 325e08a..2530e66 100644
--- a/lib/recycle.c
+++ b/lib/recycle.c
@@ -19,6 +19,8 @@ This also decreases memory fragmentation, and freeing structures
# include "recycle.h"
#endif
+# define align(a) (((Uint32)a+(sizeof(void *)-1))&(~(sizeof(void *)-1)))
+
reroot *remkroot(size)
size_t size;
{