From e1df70d85ef641c0988928d257dbc21a99d77650 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Mon, 12 May 2003 21:49:28 +0000 Subject: [PATCH] made the makefiles of the example to use the config-file. the first working test of held_type added. --- examples/any_converter/makefile | 4 +++- examples/cln/makefile | 2 +- examples/glut/makefile | 4 +++- examples/regexp/makefile | 2 +- luabind/class.hpp | 11 +++++++++++ test/test_held_type.cpp | 5 +++-- 6 files changed, 22 insertions(+), 6 deletions(-) diff --git a/examples/any_converter/makefile b/examples/any_converter/makefile index 47038c0..e108b31 100644 --- a/examples/any_converter/makefile +++ b/examples/any_converter/makefile @@ -1,3 +1,5 @@ +include ../../config + any_converter: any_converter.cpp - g++ any_converter.cpp -O3 -o any_converter -I- -I../../ -ftemplate-depth-50 -L../../lib -L/usr/local/lib -lluabind -llua -llualib + $(CXX) any_converter.cpp -O3 -o any_converter $(LUA_PATH) -I- $(BOOST_PATH) -I../../ -L../../lib $(LUA_LIB_PATH) -lluabind -llua -llualib diff --git a/examples/cln/makefile b/examples/cln/makefile index 9003a7f..23fa280 100644 --- a/examples/cln/makefile +++ b/examples/cln/makefile @@ -1,5 +1,5 @@ include ../../config cln_test: cln_test.cpp - g++ cln_test.cpp -o cln_test $(LUA_PATH) -I- $(BOOST_PATH) -I../../ $(LUA_LIB_PATH) -L../../lib -lluabind -llua -llualib -lcln + $(CXX) cln_test.cpp -o cln_test $(LUA_PATH) -I- $(BOOST_PATH) -I../../ $(LUA_LIB_PATH) -L../../lib -lluabind -llua -llualib -lcln diff --git a/examples/glut/makefile b/examples/glut/makefile index 0777ab5..24a73a2 100644 --- a/examples/glut/makefile +++ b/examples/glut/makefile @@ -1,3 +1,5 @@ +include ../../config + glut_test: glut_bind.cpp - g++ glut_bind.cpp -o glut_bind -I- -I../../ -ftemplate-depth-50 -I/usr/X11R6/include -L/usr/X11R6/lib -L/usr/local/lib -L../../lib -lluabind -lX11 -lXi -lXmu -lglut -lGL -lGLU -lm -llua -llualib + $(CXX) glut_bind.cpp -o glut_bind $(LUA_PATH) -I- $(BOOST_PATH) -I../../ -I/usr/X11R6/include -L/usr/X11R6/lib $(LUA_LIB_PATH) -L../../lib -lluabind -lX11 -lXi -lXmu -lglut -lGL -lGLU -lm -llua -llualib diff --git a/examples/regexp/makefile b/examples/regexp/makefile index a680764..45c1136 100644 --- a/examples/regexp/makefile +++ b/examples/regexp/makefile @@ -1,5 +1,5 @@ include ../../config regexp: regex_wrap.cpp - g++ regex_wrap.cpp -o regex_wrap $(LUA_PATH) -I- $(BOOST_PATH) -I../../ -L../../lib $(LUA_LIB_PATH) -lluabind -lboost_regex -llua -llualib + $(CXX) regex_wrap.cpp -o regex_wrap $(LUA_PATH) -I- $(BOOST_PATH) -I../../ -L../../lib $(LUA_LIB_PATH) -lluabind -lboost_regex -llua -llualib diff --git a/luabind/class.hpp b/luabind/class.hpp index 0dc354f..37c8b45 100644 --- a/luabind/class.hpp +++ b/luabind/class.hpp @@ -536,6 +536,12 @@ namespace luabind // register this new type in the class registry r->add_class(m_type, crep); + if (!(LUABIND_TYPE_INFO_EQUAL(m_held_type, LUABIND_INVALID_TYPE_INFO))) + { + // if we have a held type + // we have to register it in the class-table + r->add_class(m_held_type, crep); + } // add methods for (std::map::iterator i = m_methods.begin(); @@ -582,6 +588,7 @@ namespace luabind lua_pop(L, 1); } + // destructive copy virtual luabind::detail::scoped_object* clone() { @@ -601,11 +608,15 @@ namespace luabind std::swap(ret->m_static_constants, m_static_constants); ret->m_destructor = m_destructor; + ret->m_extractor = m_extractor; std::swap(ret->m_bases, m_bases); std::swap(ret->m_methods, m_methods); m_constructor.swap(ret->m_constructor); + ret->m_type = m_type; + ret->m_held_type = m_held_type; + #ifndef LUABIND_DONT_COPY_STRINGS std::swap(ret->m_strings, m_strings); #endif diff --git a/test/test_held_type.cpp b/test/test_held_type.cpp index 5d16156..4f3be21 100644 --- a/test/test_held_type.cpp +++ b/test/test_held_type.cpp @@ -34,8 +34,9 @@ namespace bool test_held_type() { // This feature is not finished yet -/* + using namespace luabind; + { lua_State* L = lua_open(); lua_closer c(L); @@ -58,7 +59,7 @@ bool test_held_type() } if (feedback != 1) return false; -*/ + return true; } -- 2.11.4.GIT