aboutsummaryrefslogtreecommitdiffstats
path: root/lualdap
diff options
context:
space:
mode:
authorTomas Guisasola <tomas@luaforge.net>2004-10-15 15:28:09 +0000
committerTomas Guisasola <tomas@luaforge.net>2004-10-15 15:28:09 +0000
commit4464cd205813c369b5036b755e3505406a13399c (patch)
treee5d95be4e68c6178d909ad8376219f053ffd9004 /lualdap
parentAtualizacao da documentacao sobre instalacao (proposta de pacotes de Lua 5.1) (diff)
downloadlualdap-4464cd205813c369b5036b755e3505406a13399c.tar.xz
lualdap-4464cd205813c369b5036b755e3505406a13399c.zip
Adaptacao para o uso dos arquivos compat-5.1.[c,h].
Diffstat (limited to 'lualdap')
-rwxr-xr-xlualdap/Makefile8
-rwxr-xr-xlualdap/src/lualdap.c30
2 files changed, 15 insertions, 23 deletions
diff --git a/lualdap/Makefile b/lualdap/Makefile
index c0abdf6..b105368 100755
--- a/lualdap/Makefile
+++ b/lualdap/Makefile
@@ -1,5 +1,6 @@
+COMPAT_DIR= ../compat
WARN= -Wall -Wmissing-prototypes -Wmissing-declarations -ansi
-INCS= -I/usr/local/include/lua5
+INCS= -I/usr/local/include/lua5 -I$(COMPAT_DIR)
LIBS_DIR=
LIBS= -llua -llualib -lm -lldap -ldl
CFLAGS= -g $(MYCFLAGS) $(WARN) $(INCS) $(DEFS)
@@ -17,7 +18,7 @@ SRCS= README Makefile \
AR= ar rcu
RANLIB= ranlib
-OBJ= lualdap.o
+OBJ= lualdap.o compat-5.1.o
LIB= liblualdap$(VERSION).a
SO= liblualdap$(VERSION).so
DYLIB= liblualdap$(VERSION).dylib
@@ -46,5 +47,8 @@ $(DYLIB): $(OBJ)
#gcc -o $@ -dynamiclib $(OBJ) $(LIBS_DIR) $(LIBS)
libtool -dynamic -compatibility_version $V -current_version $V -o $@ $(OBJ) $(LIBS_DIR) $(LIBS) -lcc_dynamic -lc
+compat-5.1.o: $(COMPAT_DIR)/compat-5.1.c
+ $(CC) -c $(CFLAGS) -o $@ $(COMPAT_DIR)/compat-5.1.c
+
clean:
rm -f $(OBJ) $(LIB) $(SO) $(DYLIB) $(DLL) $(TAR_FILE) $(ZIP_FILE)
diff --git a/lualdap/src/lualdap.c b/lualdap/src/lualdap.c
index eb87bf3..d9bb6f1 100755
--- a/lualdap/src/lualdap.c
+++ b/lualdap/src/lualdap.c
@@ -1,7 +1,7 @@
/*
** LuaLDAP
** See Copyright Notice in license.html
-** $Id: lualdap.c,v 1.29 2004-09-17 15:40:18 tomas Exp $
+** $Id: lualdap.c,v 1.30 2004-10-15 15:28:09 tomas Exp $
*/
#include <stdlib.h>
@@ -12,6 +12,7 @@
#include <lua.h>
#include <lauxlib.h>
+#include <compat-5.1.h>
#define LUALDAP_PREFIX "LuaLDAP: "
@@ -945,34 +946,21 @@ static int lualdap_open_simple (lua_State *L) {
** Create ldap table and register the open method.
*/
int luaopen_lualdap (lua_State *L) {
- const char *name;
- int lualdap;
+ struct luaL_reg lualdap[] = {
+ {"open_simple", lualdap_open_simple},
+ {NULL, NULL},
+ };
lualdap_createmeta (L);
-
+ luaL_openlib (L, LUALDAP_TABLENAME, lualdap, 0);
+/*
lua_newtable (L);
lualdap = lua_gettop (L);
lua_pushliteral (L, "open_simple");
lua_pushcfunction (L, lualdap_open_simple);
lua_rawset (L, -3);
lua_setglobal (L, LUALDAP_TABLENAME);
-
- /* if Lua 5.0 then Set package.loaded[name] = lualdap */
- if (lua_isstring(L, 1))
- name = lua_tostring (L, 1);
- else {
- lua_getglobal (L, "arg");
- lua_rawgeti (L, -1, 1);
- name = lua_tostring (L, -1);
- lua_pop (L, 2);
- }
- lua_getglobal (L, "package");
- lua_pushliteral (L, "loaded");
- lua_gettable (L, -2);
- lua_pushstring (L, name);
- lua_pushvalue (L, lualdap);
- lua_settable (L, -3); /* package.loaded[name] = lualdap */
- lua_pop (L, 2);
+*/
return 1;
}