From 633f6110e0e2e9b67ea9407bfb2bf514d0d260a3 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Sun, 21 Mar 2004 01:43:25 +0000 Subject: [PATCH] *** empty log message *** --- config | 18 +++++------------- luabind/detail/policy.hpp | 2 ++ src/makefile | 6 ++++-- test/makefile | 30 ++++++++++++++++++------------ test/test_object.cpp | 12 ++++++++---- 5 files changed, 37 insertions(+), 31 deletions(-) diff --git a/config b/config index 693e0ae..0c5987c 100644 --- a/config +++ b/config @@ -8,19 +8,11 @@ # -DNDEBUG \ # -DLUA_API=__declspec(dllimport) -# if boost and lua are installed in system -# include paths, you don't have to set these -# variables - -#BOOST_PATH = -I/scratch/boost_1_30_0 -#LUA_PATH = -I/scratch/lua-5.0/include - -#lua lib path is used for the test program - -#LUA_LIB_PATH = -L/scratch/lua-5.0/lib -BOOST_PATH = -I/cygdrive/c/boost - -LUA_LIB_PATH = -L/usr/local/lib +# you have to set the environment variables +# BOOST_ROOT to the path to your boost +# installation. +# and LUA_PATH to the path to your lua +# installation (prebuilt) CXX = g++ diff --git a/luabind/detail/policy.hpp b/luabind/detail/policy.hpp index 8ebe672..a10983c 100644 --- a/luabind/detail/policy.hpp +++ b/luabind/detail/policy.hpp @@ -813,6 +813,8 @@ namespace luabind { namespace detail // getmetatable().__lua_class is true // object_rep->flags() & object_rep::constant == 0 + // TODO: if T is a holder type and obj is nil, we should be able to + // create a null-holder. assert((lua_isnil(L, index) == false) && "internal error, please report"); object_rep* obj = static_cast(lua_touserdata(L, index)); diff --git a/src/makefile b/src/makefile index 9367008..1e8984d 100755 --- a/src/makefile +++ b/src/makefile @@ -1,6 +1,8 @@ include ../config SOURCES = \ + pcall.cpp \ + error.cpp \ ref.cpp \ scope.cpp \ class.cpp \ @@ -13,7 +15,7 @@ SOURCES = \ stack_content_by_name.cpp \ object.cpp \ class_info.cpp \ - class_registry + class_registry.cpp OBJECTS = $(SOURCES:.cpp=.o) @@ -30,7 +32,7 @@ $(TARGET): $(OBJECTS) ranlib $@ %.o:%.cpp - $(CXX) -g -Wall -c $? -o $@ $(LUA_PATH) -I- -I.. $(BOOST_PATH) $(CONFIG) + $(CXX) -g -Wall -DLUABIND_BUILDING -c $? -o $@ -I$(LUA_PATH) -I- -I.. -I$(BOOST_ROOT) $(CONFIG) clean: rm -f $(OBJECTS) $(TARGET) diff --git a/test/makefile b/test/makefile index 2113964..9a2be74 100644 --- a/test/makefile +++ b/test/makefile @@ -1,24 +1,30 @@ include ../config SOURCES = \ - test_typetraits.cpp \ main.cpp \ - test_iterator.cpp \ - test_lua_classes.cpp \ - test_construction.cpp \ - test_operators.cpp \ test_attributes.cpp \ - test_exceptions.cpp \ test_const.cpp \ - test_null_pointer.cpp \ + test_construction.cpp \ + test_exceptions.cpp \ + test_held_type.cpp \ test_implicit_cast.cpp \ - test_policies.cpp \ - test_free_functions.cpp \ + test_lua_classes.cpp \ test_object.cpp \ - test_held_type.cpp \ + test_operators.cpp \ test_scope.cpp \ + test_separate_registration.cpp \ + test_separation.cpp \ + test_typetraits.cpp \ test_yield.cpp +# not converted yet + +# test_null_pointer.cpp \ + test_policies.cpp \ + test_free_functions.cpp \ + test_iterator.cpp \ + + TARGET = test_luabind @@ -29,10 +35,10 @@ OBJECTS = $(SOURCES:.cpp=.o) all: $(TARGET) $(TARGET): $(OBJECTS) - $(CXX) -g $(OBJECTS) $(LUA_LIB_PATH) -L../lib -lluabind -llua -llualib -o $@ + $(CXX) -g $(OBJECTS) -L$(LUA_PATH)/lib -L../lib -lluabind -llua -llualib -o $@ %.o:%.cpp - $(CXX) -Wall -ftemplate-depth-50 -g $(CONFIG) $(LUA_PATH) -I. -I- -I../ $(BOOST_PATH) -c $? -o $@ + $(CXX) -Wall -ftemplate-depth-50 -g $(CONFIG) -I$(LUA_PATH) -I. -I- -I../ -I$(BOOST_ROOT) -c $? -o $@ relink: rm -f $(TARGET) diff --git a/test/test_object.cpp b/test/test_object.cpp index 5cf8061..0389b08 100644 --- a/test/test_object.cpp +++ b/test/test_object.cpp @@ -169,18 +169,22 @@ void test_object() BOOST_CHECK(object_cast(g.at("glob")) == "teststring"); BOOST_CHECK(object_cast(g.raw_at("glob")) == "teststring"); +// TODO: this fails! +// object nil = get_globals(L)["non_existing_variable_is_nil"]; +// BOOST_CHECK(object_cast >(nil).get() == 0); + #ifndef LUABIND_NO_EXCEPTIONS try { - luabind::object null; - int i = luabind::object_cast(null); + object not_initialized; + int i = object_cast(not_initialized); BOOST_ERROR("invalid cast succeeded"); } catch(luabind::cast_failed&) {} #endif - luabind::object null; - BOOST_CHECK(!luabind::object_cast_nothrow(null)); + object not_initialized; + BOOST_CHECK(!object_cast_nothrow(not_initialized)); } -- 2.11.4.GIT