[Orxonox-commit 3598] r8283 - in code/branches/kicklib2: . bin cmake cmake/tools data/gui/scripts doc/api src src/external src/external/ogreceguirenderer src/external/tolua src/external/tolua/lua src/libraries/core src/libraries/core/input src/libraries/tools src/libraries/util src/modules/pickup src/orxonox
rgrieder at orxonox.net
rgrieder at orxonox.net
Thu Apr 21 18:32:29 CEST 2011
Author: rgrieder
Date: 2011-04-21 18:32:28 +0200 (Thu, 21 Apr 2011)
New Revision: 8283
Added:
code/branches/kicklib2/cmake/tools/FindLua5.1.cmake
code/branches/kicklib2/src/external/tolua/README_ORXONOX
Removed:
code/branches/kicklib2/cmake/tools/FindLua.cmake
code/branches/kicklib2/src/external/ceguilua/
code/branches/kicklib2/src/external/tolua/all-5.0.lua
code/branches/kicklib2/src/external/tolua/tolua++.h
code/branches/kicklib2/src/external/tolua/tolua_event.c
code/branches/kicklib2/src/external/tolua/tolua_event.h
code/branches/kicklib2/src/external/tolua/tolua_is.c
code/branches/kicklib2/src/external/tolua/tolua_map.c
code/branches/kicklib2/src/external/tolua/tolua_push.c
code/branches/kicklib2/src/external/tolua/tolua_to.c
code/branches/kicklib2/src/libraries/core/MemoryArchive.cc
code/branches/kicklib2/src/libraries/core/MemoryArchive.h
Modified:
code/branches/kicklib2/
code/branches/kicklib2/INSTALL
code/branches/kicklib2/bin/vld.ini.in
code/branches/kicklib2/cmake/LibraryConfig.cmake
code/branches/kicklib2/cmake/LibraryConfigTardis.cmake
code/branches/kicklib2/cmake/PackageConfig.cmake
code/branches/kicklib2/cmake/tools/FindCEGUI.cmake
code/branches/kicklib2/data/gui/scripts/GUITools.lua
code/branches/kicklib2/data/gui/scripts/InitialiseGUI.lua
code/branches/kicklib2/data/gui/scripts/NotificationLayer.lua
code/branches/kicklib2/doc/api/doxy.config.in
code/branches/kicklib2/src/CMakeLists.txt
code/branches/kicklib2/src/SpecialConfig.h.in
code/branches/kicklib2/src/external/CMakeLists.txt
code/branches/kicklib2/src/external/ogreceguirenderer/OgreCEGUIRenderer.cpp
code/branches/kicklib2/src/external/ogreceguirenderer/VERSION
code/branches/kicklib2/src/external/ogreceguirenderer/changes_orxonox.diff
code/branches/kicklib2/src/external/tolua/CMakeLists.txt
code/branches/kicklib2/src/external/tolua/VERSION
code/branches/kicklib2/src/external/tolua/changes_orxonox.diff
code/branches/kicklib2/src/external/tolua/lua/package.lua
code/branches/kicklib2/src/libraries/core/CMakeLists.txt
code/branches/kicklib2/src/libraries/core/CorePrereqs.h
code/branches/kicklib2/src/libraries/core/GUIManager.cc
code/branches/kicklib2/src/libraries/core/GUIManager.h
code/branches/kicklib2/src/libraries/core/GraphicsManager.cc
code/branches/kicklib2/src/libraries/core/GraphicsManager.h
code/branches/kicklib2/src/libraries/core/LuaState.cc
code/branches/kicklib2/src/libraries/core/LuaState.h
code/branches/kicklib2/src/libraries/core/input/KeyBinder.cc
code/branches/kicklib2/src/libraries/tools/Mesh.cc
code/branches/kicklib2/src/libraries/util/Exception.cc
code/branches/kicklib2/src/modules/pickup/PickupCollection.h
code/branches/kicklib2/src/orxonox/CMakeLists.txt
Log:
Merged revisions 7940-7974 from kicklib to kicklib2.
Property changes on: code/branches/kicklib2
___________________________________________________________________
Modified: svn:mergeinfo
- /code/branches/ai:6592-7033
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dynamicmatch:6584-7030
/code/branches/fps:6591-7072
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hudelements:6584-6941
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7975-7977
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network64:2210-2355
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation3:6913-7162
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
/code/branches/tetris:8100-8107
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890
+ /code/branches/ai:6592-7033
/code/branches/buildsystem:1874-2276,2278-2400
/code/branches/buildsystem2:2506-2658
/code/branches/buildsystem3:2662-2708
/code/branches/ceguilua:1802-1808
/code/branches/chat:6527-6797
/code/branches/chat2:6836-6910
/code/branches/console:5941-6104
/code/branches/consolecommands2:6451-7178
/code/branches/consolecommands3:7178-7283
/code/branches/core3:1572-1739
/code/branches/core4:3221-3224,3227,3234-3238,3242,3244-3250,3252-3254,3256,3259-3261,3264-3265,3268-3275,3277-3278,3280,3284-3285,3287,3289-3294,3305,3309-3310
/code/branches/core5:5768-5928,6009
/code/branches/data_cleanup:7537-7686
/code/branches/doc:7290-7400
/code/branches/dynamicmatch:6584-7030
/code/branches/fps:6591-7072
/code/branches/gamestate:6430-6572,6621-6661
/code/branches/gamestates2:6594-6745
/code/branches/gametypes:2826-3031
/code/branches/gcc43:1580
/code/branches/gui:1635-1723,2795-2894
/code/branches/hudelements:6584-6941
/code/branches/ingamemenu:6000-6023
/code/branches/input:1629-1636
/code/branches/ipv6:7293-7458
/code/branches/kicklib:7940-7977
/code/branches/lastmanstanding:7479-7644
/code/branches/lastmanstanding3:7903-8175
/code/branches/libraries:5612-5692
/code/branches/libraries2:5703-5737
/code/branches/lod:6586-6911
/code/branches/lodfinal:2372-2411
/code/branches/map:2801-3086,3089
/code/branches/masterserver:7502-7738
/code/branches/menu:5941-6146,6148,7536-7687
/code/branches/miniprojects:2754-2824
/code/branches/netp2:2835-2988
/code/branches/netp3:2988-3082
/code/branches/netp6:3214-3302
/code/branches/network:2356
/code/branches/network2:6434-6465
/code/branches/network3:7196-7344
/code/branches/network4:7497-7755
/code/branches/network5:7757-7781
/code/branches/network64:2210-2355
/code/branches/notifications:7314-7401
/code/branches/objecthierarchy:1911-2085,2100,2110-2169
/code/branches/objecthierarchy2:2171-2479
/code/branches/overlay:2117-2385
/code/branches/particles:2829-3085
/code/branches/particles2:6050-6106,6109
/code/branches/pch:3113-3194
/code/branches/physics:1912-2055,2107-2439
/code/branches/physics_merge:2436-2457
/code/branches/pickup2:5942-6405
/code/branches/pickup3:6418-6523
/code/branches/pickup4:6594-6710
/code/branches/pickups:1926-2086,2127,2827-2915
/code/branches/pickups2:2107-2497,2915-3071
/code/branches/png2:7262-7263
/code/branches/ppspickups1:6552-6708
/code/branches/ppspickups2:6527-6532,6554-6709
/code/branches/ppspickups3:6757-6997
/code/branches/ppspickups4:7003-7089
/code/branches/presentation:2369-2652,2654-2660,7736-7786
/code/branches/presentation2:6106-6416,7787-7800
/code/branches/presentation3:6913-7162
/code/branches/questsystem:1894-2088
/code/branches/questsystem2:2107-2259
/code/branches/questsystem5:2776-2905
/code/branches/releasetodo:7614-7647
/code/branches/resource:3327-3366
/code/branches/resource2:3372-5694
/code/branches/rocket:6523-6950
/code/branches/rocket2:6953-6970
/code/branches/script_trigger:1295-1953,1955
/code/branches/skybox2:6559-6989
/code/branches/sound:2829-3010
/code/branches/sound3:5941-6102
/code/branches/steering:5949-6091
/code/branches/tetris:8100-8107
/code/branches/usability:7915-8078
/code/branches/weapon:1925-2094
/code/branches/weapon2:2107-2488
/code/branches/weapons:2897-3051
/code/branches/weaponsystem:2742-2890
Modified: code/branches/kicklib2/INSTALL
===================================================================
--- code/branches/kicklib2/INSTALL 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/INSTALL 2011-04-21 16:32:28 UTC (rev 8283)
@@ -8,10 +8,9 @@
In order to compile Orxonox you will need the following libraries:
(for windows there are already precompiled packages on the website)
-OGRE 3D Graphics Engine 1.4 - 1.7
-CEGUI (Crazy Eddie's GUI System) 0.5 - 0.6
+OGRE 3D Graphics Engine 1.6 - 1.7
+CEGUI (Crazy Eddie's GUI System) 0.6
Boost libraries 1.35 -
-ENet (Network library) 1.1 - 1.2
Lua (scripting language) 5.0 - 5.1
Tcl (shell script language) 8.4 - 8.5
OpenAL (audio) (no version requirements specified yet)
Modified: code/branches/kicklib2/bin/vld.ini.in
===================================================================
--- code/branches/kicklib2/bin/vld.ini.in 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/bin/vld.ini.in 2011-04-21 16:32:28 UTC (rev 8283)
@@ -55,7 +55,7 @@
; Valid Values: Any list containing module names (i.e. names of EXEs or DLLs).
; Default: None.
;
-ForceIncludeModules = boost_date_time-vc80-mt-gd-1_39.dll, boost_filesystem-vc80-mt-gd-1_39.dll, boost_system-vc80-mt-gd-1_39.dll, boost_thread-vc80-mt-gd-1_39.dll, enet_d.dll, lua_d.dll, ogg_d.dll, vorbis_d.dll, vorbifile_d.dll
+ForceIncludeModules = boost_date_time-vc90-mt-gd-1_44.dll, boost_filesystem-vc90-mt-gd-1_44.dll, boost_system-vc90-mt-gd-1_44.dll, boost_thread-vc90-mt-gd-1_44.dll, lua_d.dll, ogg_d.dll, vorbis_d.dll, vorbifile_d.dll
; Maximum number of data bytes to display for each leaked block. If zero, then
; the data dump is completely suppressed and only call stacks are shown.
Modified: code/branches/kicklib2/cmake/LibraryConfig.cmake
===================================================================
--- code/branches/kicklib2/cmake/LibraryConfig.cmake 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/cmake/LibraryConfig.cmake 2011-04-21 16:32:28 UTC (rev 8283)
@@ -92,8 +92,9 @@
############### Library finding #################
# Performs the search and sets the variables #
-FIND_PACKAGE(OGRE 1.4 REQUIRED)
-#FIND_PACKAGE(ENet 1.1 REQUIRED)
+FIND_PACKAGE(OGRE 1.6 REQUIRED)
+#FIND_PACKAGE(ENet 1.1 REQUIRED)
+FIND_PACKAGE(Lua5.1 REQUIRED)
FIND_PACKAGE(Ogg REQUIRED)
FIND_PACKAGE(Vorbis REQUIRED)
FIND_PACKAGE(ALUT REQUIRED)
@@ -110,34 +111,13 @@
##### CEGUI #####
# We make use of the CEGUI script module called CEGUILua.
-# However there is a small issue with that: We use Tolua, a C++ binding
-# generator ourselves. And we also have to use our bindings in the same
-# lua state is CEGUILua's. Unfortunately this implies that both lua runtime
-# version are equal or else you get segmentation faults.
-# In order to match the Lua versions we decided to ship CEGUILua in our
-# repository, mainly because there is no way to determine which version of
-# Lua CEGUILua was linked against (you'd have to specify yourself) and secondly
-# because we can then choose the Lua version. Future plans might involve only
-# accepting Lua 5.1.
+# However there is a small issue with that: Both CEGUILua and Orxonox use
+# Lua library functions on the same objects. And it turns out that in this case
+# the linked library must be EXACTLY the same.
+# Since Lua v5.1 has been out for a long while, this does not seem to be a
+# problem anymore, at least as long as Lua 5.2 is not released.
+FIND_PACKAGE(CEGUI 0.6 REQUIRED)
-# Insert all internally supported CEGUILua versions here
-SET(CEGUILUA_INTERNAL_SUPPORT 0.5.0 0.6.0 0.6.1 0.6.2)
-OPTION(CEGUILUA_USE_EXTERNAL_LIBRARY "Force the use of external CEGUILua library" OFF)
-FIND_PACKAGE(CEGUI 0.5 REQUIRED)
-
-##### Lua #####
-IF(CEGUILUA_USE_EXTERNAL_LIBRARY)
- COMPARE_VERSION_STRINGS(${CEGUI_VERSION} "0.6" _version_comparison)
- IF(version_comparison LESS 0)
- SET(LUA_VERSION_REQUEST 5.0)
- ELSE()
- SET(LUA_VERSION_REQUEST 5.1)
- ENDIF()
-ELSE()
- SET(LUA_VERSION_REQUEST 5)
-ENDIF()
-FIND_PACKAGE(Lua ${LUA_VERSION_REQUEST} EXACT REQUIRED)
-
##### OpenAL #####
FIND_PACKAGE(OpenAL REQUIRED)
# Also use parent include dir (without AL/) for ALUT
@@ -176,24 +156,19 @@
# You may want to edit these settings if you provide your own libraries
# Note: Default option in the libraries vary, but our default option is dynamic
IF(WIN32)
- OPTION(LINK_BOOST_DYNAMIC "Link Boost dynamically on Windows" TRUE)
- OPTION(LINK_CEGUI_DYNAMIC "Link CEGUI dynamicylly on Windows" TRUE)
- #OPTION(LINK_ENET_DYNAMIC "Link ENet dynamically on Windows" TRUE)
- OPTION(LINK_OGRE_DYNAMIC "Link OGRE dynamically on Windows" TRUE)
- OPTION(LINK_TCL_DYNAMIC "Link TCL dynamically on Windows" TRUE)
- OPTION(LINK_ZLIB_DYNAMIC "Link ZLib dynamically on Windows" TRUE)
- COMPARE_VERSION_STRINGS("${LUA_VERSION}" "5.1" _version_comparison)
- IF(_version_comparison LESS 0)
- OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" FALSE)
- ELSE(_version_comparison LESS 0)
- OPTION(LINK_LUA_DYNAMIC "Link Lua dynamically on Windows" TRUE)
- ENDIF(_version_comparison LESS 0)
+ OPTION(LINK_BOOST_DYNAMIC "Link Boost dynamically on Windows" TRUE)
+ OPTION(LINK_CEGUI_DYNAMIC "Link CEGUI dynamicylly on Windows" TRUE)
+ #OPTION(LINK_ENET_DYNAMIC "Link ENet dynamically on Windows" TRUE)
+ OPTION(LINK_OGRE_DYNAMIC "Link OGRE dynamically on Windows" TRUE)
+ OPTION(LINK_TCL_DYNAMIC "Link TCL dynamically on Windows" TRUE)
+ OPTION(LINK_ZLIB_DYNAMIC "Link ZLib dynamically on Windows" TRUE)
+ OPTION(LINK_LUA5.1_DYNAMIC "Link Lua dynamically on Windows" TRUE)
IF(DEPENDENCY_PACKAGE_ENABLE)
MARK_AS_ADVANCED(
LINK_BOOST_DYNAMIC LINK_CEGUI_DYNAMIC #LINK_ENET_DYNAMIC
LINK_OGRE_DYNAMIC LINK_TCL_DYNAMIC LINK_ZLIB_DYNAMIC
- LINK_LUA_DYNAMIC
+ LINK_LUA5.1_DYNAMIC
)
ENDIF()
ENDIF(WIN32)
Modified: code/branches/kicklib2/cmake/LibraryConfigTardis.cmake
===================================================================
--- code/branches/kicklib2/cmake/LibraryConfigTardis.cmake 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/cmake/LibraryConfigTardis.cmake 2011-04-21 16:32:28 UTC (rev 8283)
@@ -76,7 +76,7 @@
#SET(ENV{ALUTDIR} "/usr/pack/openal-0.0.8-cl;/usr/pack/openal-0.0.8-cl/i686-debian-linux3.1")
#SET(ENV{OGGDIR} "/usr/pack/oggvorbis-1.0-ds;/usr/pack/oggvorbis-1.0-ds/i686-debian-linux3.0")
#SET(ENV{VORBISDIR} "/usr/pack/oggvorbis-1.0-ds;/usr/pack/oggvorbis-1.0-ds/i686-debian-linux3.0")
- #SET(ENV{LUA_DIR} "/usr/pack/lua-5.1.4-sd;/usr/pack/lua-5.1.4-sd/i686-debian-linux4.0")
+ #SET(ENV{LUA5.1_DIR} "/usr/pack/lua-5.1.4-sd;/usr/pack/lua-5.1.4-sd/i686-debian-linux4.0")
#SET(ENV{OGRE_HOME} "/usr/pack/ogre-1.4.9-sd;/usr/pack/ogre-1.4.9-sd/i686-debian-linux4.0")
#SET(ENV{OPENALDIR} "/usr/pack/openal-0.0.8-cl;/usr/pack/openal-0.0.8-cl/i686-debian-linux3.1")
#SET(TCL_INCLUDE_PATH "/usr/pack/tcltk-8.4.9.linux-mo/include")
Modified: code/branches/kicklib2/cmake/PackageConfig.cmake
===================================================================
--- code/branches/kicklib2/cmake/PackageConfig.cmake 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/cmake/PackageConfig.cmake 2011-04-21 16:32:28 UTC (rev 8283)
@@ -30,7 +30,11 @@
# For example any code running on 3.0 should still run on 3.1
# But you can specify that the code only runs on 3.1 and higher
# or 4.0 and higher (so both 3.1 and 4.0 will work).
-SET(ALLOWED_MINIMUM_VERSIONS 3.1 4.0 5.0)
+IF(MSVC)
+ SET(ALLOWED_MINIMUM_VERSIONS 4.3 5.1 6.0)
+ELSE()
+ SET(ALLOWED_MINIMUM_VERSIONS 4.1 5.2)
+ENDIF()
IF(NOT EXISTS ${DEPENDENCY_PACKAGE_DIR}/version.txt)
SET(DEPENDENCY_VERSION 1.0)
@@ -83,7 +87,7 @@
SET(ENV{DBGHELP_DIR} ${DEP_INCLUDE_DIR}/dbghelp)
SET(ENV{DXSDK_DIR} ${DEP_INCLUDE_DIR}/directx)
#SET(ENV{ENETDIR} ${DEP_INCLUDE_DIR}/enet)
-SET(ENV{LUA_DIR} ${DEP_INCLUDE_DIR}/lua)
+SET(ENV{LUA5.1_DIR} ${DEP_INCLUDE_DIR}/lua)
SET(ENV{OGGDIR} ${DEP_INCLUDE_DIR}/libogg)
SET(ENV{VORBISDIR} ${DEP_INCLUDE_DIR}/libvorbis)
SET(ENV{OGRE_HOME} ${DEP_INCLUDE_DIR}/ogre)
Modified: code/branches/kicklib2/cmake/tools/FindCEGUI.cmake
===================================================================
--- code/branches/kicklib2/cmake/tools/FindCEGUI.cmake 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/cmake/tools/FindCEGUI.cmake 2011-04-21 16:32:28 UTC (rev 8283)
@@ -3,16 +3,13 @@
# This module defines
# CEGUI_INCLUDE_DIR
# CEGUI_LIBRARY, the library to link against to use CEGUI.
+# CEGUILUA_LIBRARY, the library to link against to use the CEGUI script module.
+# CEGUI_TOLUA_LIBRARY, the library to link against to use Tolua++.
# CEGUI_FOUND, If false, do not try to use CEGUI
# CEGUI_VERSION, the version as string "x.y.z"
-# CEGUILUA_LIBRARY, Script module library
-# CEGUILUA_USE_INTERNAL_LIBRARY, True if CEGUILUA_LIBRARY was not defined here
#
# Input:
# ENV{CEGUIDIR}, CEGUI path, optional
-# FIND CEGUILUA_INTERNAL_SUPPORT, List of all CEGUILua version supported
-# in the source repository
-# CEGUILUA_USE_EXTERNAL_LIBRARY, Force finding of CEGUILua
#
# Created by Matt Williams to find OGRE libraries
# Copyright © 2007, Matt Williams
@@ -28,14 +25,21 @@
# Version checking and CEGUILua finding by Reto Grieder
# > www.orxonox.net <
+INCLUDE(CompareVersionStrings)
INCLUDE(DetermineVersion)
INCLUDE(FindPackageHandleAdvancedArgs)
INCLUDE(HandleLibraryTypes)
+# Find headers
FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h
PATHS $ENV{CEGUIDIR}
PATH_SUFFIXES include include/CEGUI CEGUI.framework/Headers
)
+
+# Inspect CEGUIVersion.h for the version number
+DETERMINE_VERSION(CEGUI ${CEGUI_INCLUDE_DIR}/CEGUIVersion.h)
+
+# Find CEGUI library
FIND_LIBRARY(CEGUI_LIBRARY_OPTIMIZED
NAMES CEGUIBase CEGUI
PATHS $ENV{CEGUIDIR}
@@ -49,55 +53,75 @@
PATH_SUFFIXES lib bin
)
-# Inspect CEGUIVersion.h for the version number
-DETERMINE_VERSION(CEGUI ${CEGUI_INCLUDE_DIR}/CEGUIVersion.h)
+# Find CEGUILua libraries
+FIND_LIBRARY(CEGUILUA_LIBRARY_OPTIMIZED
+ NAMES CEGUILua CEGUILuaScriptModule
+ PATHS $ENV{CEGUIDIR}
+ PATH_SUFFIXES lib bin
+)
+FIND_LIBRARY(CEGUILUA_LIBRARY_DEBUG
+ NAMES CEGUILuad CEGUILua_d CEGUILuaScriptModuled CEGUILuaScriptModule_d
+ PATHS $ENV{CEGUIDIR}
+ PATH_SUFFIXES lib bin
+)
+# Find CEGUI Tolua++ libraries
+FIND_LIBRARY(CEGUI_TOLUA_LIBRARY_OPTIMIZED
+ NAMES CEGUItoluapp tolua++
+ PATHS $ENV{CEGUIDIR}
+ PATH_SUFFIXES lib bin
+)
+FIND_LIBRARY(CEGUI_TOLUA_LIBRARY_DEBUG
+ NAMES CEGUItoluappd CEGUItoluapp_d tolua++d tolua++_d
+ PATHS $ENV{CEGUIDIR}
+ PATH_SUFFIXES lib bin
+)
+
+# Newer versions of CEGUI have the renderer for OGRE shipped with them
+COMPARE_VERSION_STRINGS("${CEGUI_VERSION}" "0.7" _version_compare TRUE)
+IF(_version_compare GREATER -1)
+ # Find CEGUI OGRE Renderer libraries
+ FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
+ NAMES CEGUIOgreRenderer
+ PATHS $ENV{CEGUIDIR}
+ PATH_SUFFIXES lib bin
+ )
+ FIND_LIBRARY(CEGUI_OGRE_RENDERER_LIBRARY_DEBUG
+ NAMES CEGUIOgreRendererd CEGUIOgreRenderer_d
+ PATHS $ENV{CEGUIDIR}
+ PATH_SUFFIXES lib bin
+ )
+ SET(CEGUI_OGRE_RENDERER_LIBRARY_NAME CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED)
+ELSE()
+ SET(CEGUI_OGRE_RENDERER_BUILD_REQUIRED TRUE)
+ENDIF()
+
# Handle the REQUIRED argument and set CEGUI_FOUND
# Also checks the version requirements if given
FIND_PACKAGE_HANDLE_ADVANCED_ARGS(CEGUI DEFAULT_MSG "${CEGUI_VERSION}"
+ CEGUI_INCLUDE_DIR
CEGUI_LIBRARY_OPTIMIZED
- CEGUI_INCLUDE_DIR
+ CEGUILUA_LIBRARY_OPTIMIZED
+ CEGUI_TOLUA_LIBRARY_OPTIMIZED
+ ${CEGUI_OGRE_RENDERER_LIBRARY_NAME}
)
# Collect optimized and debug libraries
HANDLE_LIBRARY_TYPES(CEGUI)
+HANDLE_LIBRARY_TYPES(CEGUILUA)
+HANDLE_LIBRARY_TYPES(CEGUI_TOLUA)
+IF(NOT CEGUI_OGRE_RENDERER_BUILD_REQUIRED)
+ HANDLE_LIBRARY_TYPES(CEGUI_OGRE_RENDERER)
+ENDIF()
MARK_AS_ADVANCED(
CEGUI_INCLUDE_DIR
CEGUI_LIBRARY_OPTIMIZED
CEGUI_LIBRARY_DEBUG
+ CEGUILUA_LIBRARY_OPTIMIZED
+ CEGUILUA_LIBRARY_DEBUG
+ CEGUI_TOLUA_LIBRARY_OPTIMIZED
+ CEGUI_TOLUA_LIBRARY_DEBUG
+ CEGUI_OGRE_RENDERER_LIBRARY_OPTIMIZED
+ CEGUI_OGRE_RENDERER_LIBRARY_DEBUG
)
-
-LIST(FIND CEGUILUA_INTERNAL_SUPPORT "${CEGUI_VERSION}" _find_result)
-IF(CEGUILUA_USE_EXTERNAL_LIBRARY OR _find_result EQUAL -1)
- # Also try to find the CEGUILua libraries.
- # There would already be libraries in src/ for versions 0.5 and 0.6
- FIND_LIBRARY(CEGUILUA_LIBRARY_OPTIMIZED
- NAMES CEGUILua
- PATHS $ENV{CEGUIDIR}
- PATH_SUFFIXES lib bin
- )
- FIND_LIBRARY(CEGUILUA_LIBRARY_DEBUG
- NAMES CEGUILuad CEGUILua_d
- PATHS $ENV{CEGUIDIR}
- PATH_SUFFIXES lib bin
- )
-
- SET(CEGUILua_FIND_REQUIRED ${CEGUI_FIND_REQUIRED})
- # Handle the REQUIRED argument and set CEGUILUA_FOUND
- FIND_PACKAGE_HANDLE_STANDARD_ARGS(CEGUILua DEFAULT_MSG
- CEGUILUA_LIBRARY_OPTIMIZED
- )
-
- # Collect optimized and debug libraries
- HANDLE_LIBRARY_TYPES(CEGUILUA)
-
- MARK_AS_ADVANCED(
- CEGUILUA_LIBRARY_OPTIMIZED
- CEGUILUA_LIBRARY_DEBUG
- )
-
-ELSE(CEGUILUA_USE_EXTERNAL_LIBRARY OR _find_result EQUAL -1)
- SET(CEGUILUA_USE_INTERNAL_LIBRARY TRUE)
-ENDIF(CEGUILUA_USE_EXTERNAL_LIBRARY OR _find_result EQUAL -1)
-
Deleted: code/branches/kicklib2/cmake/tools/FindLua.cmake
===================================================================
--- code/branches/kicklib2/cmake/tools/FindLua.cmake 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/cmake/tools/FindLua.cmake 2011-04-21 16:32:28 UTC (rev 8283)
@@ -1,184 +0,0 @@
- #
- # ORXONOX - the hottest 3D action shooter ever to exist
- # > www.orxonox.net <
- #
- # This program is free software; you can redistribute it and/or
- # modify it under the terms of the GNU General Public License
- # as published by the Free Software Foundation; either version 2
- # of the License, or (at your option) any later version.
- #
- # This program is distributed in the hope that it will be useful,
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- # GNU General Public License for more details.
- #
- # You should have received a copy of the GNU General Public License along
- # with this program; if not, write to the Free Software Foundation,
- # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- #
- #
- # Author:
- # Reto Grieder
- # Description:
- # Finds either Lua 5.0 or Lua 5.1 on the system. The script regards the
- # VERSION, EXACT, REQUIRED and QUIET arguments. A note about the EXACT
- # argument: EXACT 5 will match all Lua 5 versions.
- # When the search was successful, the following variables are set:
- # LUA_INCLUDE_DIR, LUA_LIBRARIES, LUA_VERSION, LUA_FOUND
- #
-
-INCLUDE(CompareVersionStrings)
-INCLUDE(FindPackageHandleAdvancedArgs)
-INCLUDE(HandleLibraryTypes)
-
-# Macro that determines Lua version. Should work for versions 2.2 and above (current release: 5.1.4)
-FUNCTION(DETERMINE_LUA_VERSION _file _varname)
- IF(EXISTS ${_file})
- FILE(STRINGS ${_file} _file_content REGEX "LUA_VERSION|LUA_RELEASE")
- ELSE()
- SET(${_varname} "0" PARENT_SCOPE)
- RETURN()
- ENDIF()
- STRING(REGEX REPLACE "^.*LUA_RELEASE[ \t]+\"Lua[ \t]+([.0-9]+)\".*$" "\\1" ${_varname} "${_file_content}")
- IF(${_varname} STREQUAL "${_file_content}")
- # At most version 5.1.0
- STRING(REGEX REPLACE "^.*LUA_VERSION[ \t]+\"Lua[ \t]+([.0-9]+)\".*$" "\\1" ${_varname} "${_file_content}")
- IF(${_varname} STREQUAL "${_file_content}")
- MESSAGE(FATAL_ERROR "Could not determine Lua version which means this script has a bug")
- ENDIF()
- IF(${_varname} MATCHES "^[0-9]+\\.[0-9]+$")
- SET(${_varname} "${${_varname}}.0") # E.g. "3.2" is "3.2.0" actually
- ENDIF()
- ENDIF()
- SET(${_varname} "${${_varname}}" PARENT_SCOPE)
-ENDFUNCTION(DETERMINE_LUA_VERSION)
-
-
-# Find Lua 5.1
-FIND_PATH(LUA_5.1_INCLUDE_DIR lua.h
- PATHS $ENV{LUA_DIR}
- PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include
-)
-IF(LUA_5.1_INCLUDE_DIR)
- DETERMINE_LUA_VERSION(${LUA_5.1_INCLUDE_DIR}/lua.h LUA_5.1_VERSION)
- COMPARE_VERSION_STRINGS("${LUA_5.1_VERSION}" "5.1" _version_compare TRUE)
- IF(NOT _version_compare EQUAL 0)
- # Incorrect version found, abort search
- SET(LUA_5.1_INCLUDE_DIR "LUA_5.1_INCLUDE_DIR-NOTFOUND" CACHE PATH "" FORCE)
- ELSE()
- FIND_LIBRARY(LUA_5.1_LIBRARY_OPTIMIZED
- NAMES lua51 lua5.1 lua
- PATHS $ENV{LUA_DIR}
- PATH_SUFFIXES lib64 lib
- )
- FIND_LIBRARY(LUA_5.1_LIBRARY_DEBUG
- NAMES lua51d lua51_d lua5.1d lua5.1_d luad lua_d
- lua51D lua51_D lua5.1D lua5.1_D luad lua_D
- PATHS $ENV{LUA_DIR}
- PATH_SUFFIXES lib64 lib
- )
- HANDLE_LIBRARY_TYPES(LUA_5.1)
- SET(LUA_5.1_LIBRARIES ${LUA_5.1_LIBRARY})
- IF(LUA_5.1_LIBRARIES)
- SET(LUA_5.1_FOUND TRUE)
- ENDIF()
- ENDIF(NOT _version_compare EQUAL 0)
-ENDIF(LUA_5.1_INCLUDE_DIR)
-
-
-# Find Lua 5.0
-FIND_PATH(LUA_5.0_INCLUDE_DIR lua.h
- PATHS $ENV{LUA_DIR}
- PATH_SUFFIXES include/lua50 include/lua5.0 include/lua5 include/lua include
-)
-IF(LUA_5.0_INCLUDE_DIR)
- DETERMINE_LUA_VERSION(${LUA_5.0_INCLUDE_DIR}/lua.h LUA_5.0_VERSION)
- COMPARE_VERSION_STRINGS("${LUA_5.0_VERSION}" "5.0" _version_compare TRUE)
- IF(NOT _version_compare EQUAL 0)
- # Incorrect version found, abourt search
- SET(LUA_5.0_INCLUDE_DIR "LUA_5.0_INCLUDE_DIR-NOTFOUND" CACHE PATH "" FORCE)
- ELSE()
- FIND_LIBRARY(LUA_5.0_LUA_LIBRARY_OPTIMIZED
- NAMES lua50 lua5.0 lua5 lua
- PATHS $ENV{LUA_DIR}
- PATH_SUFFIXES lib64 lib
- )
- FIND_LIBRARY(LUA_5.0_LUA_LIBRARY_DEBUG
- NAMES lua50d lua50_d lua5.0d lua5.0_d lua5d lua5_d luad lua_d
- lua50D lua50_D lua5.0D lua5.0_D lua5d lua5_D luaD lua_D
- PATHS $ENV{LUA_DIR}
- PATH_SUFFIXES lib64 lib
- )
- HANDLE_LIBRARY_TYPES(LUA_5.0_LUA)
-
- # In an OS X framework, lualib is usually included as part of the framework
- # (like GLU in OpenGL.framework)
- IF(${LUA_5.0_LUA_LIBRARY} MATCHES "framework")
- SET(LUA_5.0_LIBRARIES ${LUA_5.0_LUA_LIBRARY})
- ELSE()
- FIND_LIBRARY(LUA_5.0_LUALIB_LIBRARY_OPTIMIZED
- NAMES lualib50 lualib5.0 lualib5 lualib
- PATHS $ENV{LUALIB_DIR} $ENV{LUA_DIR}
- PATH_SUFFIXES lib64 lib
- )
- FIND_LIBRARY(LUA_5.0_LUALIB_LIBRARY_DEBUG
- NAMES lualib50d lualib50_d lualib5.0d lualib5.0_d
- lualib5d lualib5_d lualibd lualib_d
- lualib50D lualib50_D lualib5.0D lualib5.0_D
- lualib5D lualib5_D lualibD lualib_D
- PATHS $ENV{LUALIB_DIR} $ENV{LUA_DIR}
- PATH_SUFFIXES lib64 lib
- )
- HANDLE_LIBRARY_TYPES(LUA_5.0_LUALIB)
- # Both libraries are required for Lua 5.0 to be found
- IF(LUA_5.0_LUA_LIBRARY AND LUA_5.0_LUALIB_LIBRARY)
- SET(LUA_5.0_LIBRARIES ${LUA_5.0_LUA_LIBRARY} ${LUA_5.0_LUALIB_LIBRARY})
- ENDIF()
- ENDIF(${LUA_5.0_LUA_LIBRARY} MATCHES "framework")
-
- IF(LUA_5.0_LIBRARIES)
- SET(LUA_5.0_FOUND TRUE)
- ENDIF()
- ENDIF(NOT _version_compare EQUAL 0)
-ENDIF(LUA_5.0_INCLUDE_DIR)
-
-# Pick the right version
-IF(Lua_FIND_VERSION_EXACT AND NOT Lua_FIND_VERSION MATCHES "^[0-9]*$")
- STRING(REGEX REPLACE "^([0-9]+\\.[0-9]+)(\\..*)?$" "\\1" LUA_VERSION_SELECTION ${Lua_FIND_VERSION})
-ELSE()
- IF(LUA_5.1_FOUND) # Prefer version 5.1 if found
- SET(LUA_VERSION_SELECTION "5.1")
- ELSEIF(LUA_5.0_FOUND)
- SET(LUA_VERSION_SELECTION "5.0")
- ENDIF()
-ENDIF()
-
-SET(LUA_INCLUDE_DIR "${LUA_${LUA_VERSION_SELECTION}_INCLUDE_DIR}")
-SET(LUA_LIBRARIES "${LUA_${LUA_VERSION_SELECTION}_LIBRARIES}")
-SET(LUA_VERSION_LONG "${LUA_${LUA_VERSION_SELECTION}_VERSION}")
-SET(LUA_VERSION "${LUA_VERSION_SELECTION}")
-
-FIND_PACKAGE_HANDLE_ADVANCED_ARGS(Lua DEFAULT_MSG "${LUA_VERSION_LONG}"
- LUA_LIBRARIES
- LUA_INCLUDE_DIR
-)
-
-# Include the math library for Unix only
-IF(LUA_FOUND)
- IF(UNIX AND NOT APPLE)
- FIND_LIBRARY(UNIX_MATH_LIBRARY m)
- SET(LUA_LIBRARIES ${LUA_LIBRARIES} ${UNIX_MATH_LIBRARY})
- ENDIF()
-ENDIF(LUA_FOUND)
-
-MARK_AS_ADVANCED(
- LUA_5.0_INCLUDE_DIR
- LUA_5.0_LUA_LIBRARY_OPTIMIZED
- LUA_5.0_LUA_LIBRARY_DEBUG
- LUA_5.0_LUALIB_LIBRARY_OPTIMIZED
- LUA_5.0_LUALIB_LIBRARY_DEBUG
- LUA_5.1_INCLUDE_DIR
- LUA_5.1_LIBRARY_OPTIMIZED
- LUA_5.1_LIBRARY_DEBUG
- UNIX_MATH_LIBRARY
-)
Copied: code/branches/kicklib2/cmake/tools/FindLua5.1.cmake (from rev 7974, code/branches/kicklib/cmake/tools/FindLua5.1.cmake)
===================================================================
--- code/branches/kicklib2/cmake/tools/FindLua5.1.cmake (rev 0)
+++ code/branches/kicklib2/cmake/tools/FindLua5.1.cmake 2011-04-21 16:32:28 UTC (rev 8283)
@@ -0,0 +1,100 @@
+ #
+ # ORXONOX - the hottest 3D action shooter ever to exist
+ # > www.orxonox.net <
+ #
+ # This program is free software; you can redistribute it and/or
+ # modify it under the terms of the GNU General Public License
+ # as published by the Free Software Foundation; either version 2
+ # of the License, or (at your option) any later version.
+ #
+ # This program is distributed in the hope that it will be useful,
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ # GNU General Public License for more details.
+ #
+ # You should have received a copy of the GNU General Public License along
+ # with this program; if not, write to the Free Software Foundation,
+ # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ #
+ #
+ # Author:
+ # Reto Grieder
+ # Description:
+ # Finds Lua 5.1 on the system.
+ # Handles REQUIRED and QUIET arguments.
+ # When the search was successful, the following variables are set:
+ # LUA5.1_INCLUDE_DIR, LUA5.1_LIBRARY, LUA5.1_VERSION, LUA5.1_FOUND
+ #
+
+INCLUDE(CompareVersionStrings)
+INCLUDE(FindPackageHandleAdvancedArgs)
+INCLUDE(HandleLibraryTypes)
+
+# Macro that determines Lua version. Should work for versions 2.2 and above (current release: 5.1.4)
+FUNCTION(DETERMINE_LUA_VERSION _file _varname)
+ IF(EXISTS ${_file})
+ FILE(STRINGS ${_file} _file_content REGEX "LUA_VERSION|LUA_RELEASE")
+ ELSE()
+ SET(${_varname} "0" PARENT_SCOPE)
+ RETURN()
+ ENDIF()
+ STRING(REGEX REPLACE "^.*LUA_RELEASE[ \t]+\"Lua[ \t]+([.0-9]+)\".*$" "\\1" ${_varname} "${_file_content}")
+ IF(${_varname} STREQUAL "${_file_content}")
+ # At most version 5.1.0
+ STRING(REGEX REPLACE "^.*LUA_VERSION[ \t]+\"Lua[ \t]+([.0-9]+)\".*$" "\\1" ${_varname} "${_file_content}")
+ IF(${_varname} STREQUAL "${_file_content}")
+ MESSAGE(FATAL_ERROR "Could not determine Lua version which means this script has a bug")
+ ENDIF()
+ IF(${_varname} MATCHES "^[0-9]+\\.[0-9]+$")
+ SET(${_varname} "${${_varname}}.0") # E.g. "3.2" is "3.2.0" actually
+ ENDIF()
+ ENDIF()
+ SET(${_varname} "${${_varname}}" PARENT_SCOPE)
+ENDFUNCTION(DETERMINE_LUA_VERSION)
+
+
+# Find include path
+FIND_PATH(LUA5.1_INCLUDE_DIR lua.h
+ PATHS $ENV{LUA5.1_DIR}
+ PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include
+)
+
+# Check whether we really found Lua version 5.1
+IF(LUA5.1_INCLUDE_DIR)
+ DETERMINE_LUA_VERSION(${LUA5.1_INCLUDE_DIR}/lua.h LUA5.1_VERSION)
+ COMPARE_VERSION_STRINGS("${LUA5.1_VERSION}" "5.1" _version_compare TRUE)
+ IF(NOT _version_compare EQUAL 0)
+ # Wrong version
+ MESSAGE(SEND_ERROR "Version of Lua header found is not 5.1")
+ SET(LUA5.1_INCLUDE_DIR "LUA5.1_INCLUDE_DIR-NOTFOUND" CACHE PATH "" FORCE)
+ ENDIF(NOT _version_compare EQUAL 0)
+ENDIF(LUA5.1_INCLUDE_DIR)
+
+# Find library
+FIND_LIBRARY(LUA5.1_LIBRARY_OPTIMIZED
+ NAMES lua51 lua5.1 lua
+ PATHS $ENV{LUA5.1_DIR} $ENV{LUA_DIR}
+ PATH_SUFFIXES lib64 lib
+)
+FIND_LIBRARY(LUA5.1_LIBRARY_DEBUG
+ NAMES lua51d lua51_d lua5.1d lua5.1_d
+ lua51D lua51_D lua5.1D lua5.1_D
+ luad lua_d luad lua_D
+ PATHS $ENV{LUA5.1_DIR} $ENV{LUA_DIR}
+ PATH_SUFFIXES lib64 lib
+)
+
+# Handle the REQUIRED argument and set LUA5.1_FOUND
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua5.1 DEFAULT_MSG
+ LUA5.1_LIBRARY_OPTIMIZED
+ LUA5.1_INCLUDE_DIR
+)
+
+# Collect optimized and debug libraries
+HANDLE_LIBRARY_TYPES(LUA5.1)
+
+MARK_AS_ADVANCED(
+ LUA5.1_INCLUDE_DIR
+ LUA5.1_LIBRARY_OPTIMIZED
+ LUA5.1_LIBRARY_DEBUG
+)
Modified: code/branches/kicklib2/data/gui/scripts/GUITools.lua
===================================================================
--- code/branches/kicklib2/data/gui/scripts/GUITools.lua 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/data/gui/scripts/GUITools.lua 2011-04-21 16:32:28 UTC (rev 8283)
@@ -30,8 +30,8 @@
local size = {}
local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(window:getLookNFeel())
- local height = window:getFont():getLineSpacing() + window:getUnclippedPixelRect():getHeight() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getHeight()
- local width = window:getFont():getTextExtent(window:getText()) + window:getUnclippedPixelRect():getWidth() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getWidth()
+ local height = window:getFont():getLineSpacing() + window:getUnclippedOuterRect():getHeight() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getHeight()
+ local width = window:getFont():getTextExtent(window:getText()) + window:getUnclippedOuterRect():getWidth() - lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window):getWidth()
table.insert(size, height)
table.insert(size, width)
@@ -39,17 +39,25 @@
end
function getScrollingStepSize(window)
- local height = window:getUnclippedPixelRect():getHeight()
- local maxHeight = CEGUI.System:getSingleton():getGUISheet():getUnclippedPixelRect():getHeight()
+ local height = window:getUnclippedOuterRect():getHeight()
+ local maxHeight = CEGUI.System:getSingleton():getGUISheet():getUnclippedOuterRect():getHeight()
local ratio = height/maxHeight
return 0.008*ratio/0.3204
end
function getStaticTextWindowHeight(window)
+ -- Get the area the text is formatted and drawn into.
local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(window:getLookNFeel())
local formattedArea = lookAndFeel:getNamedArea("WithFrameTextRenderArea"):getArea():getPixelRect(window)
- local frameHeight = window:getUnclippedPixelRect():getHeight() - formattedArea:getHeight()
- local lines = window:getFont():getFormattedLineCount(window:getText(), formattedArea, CEGUI.WordWrapLeftAligned)
- local height = lines * window:getFont():getLineSpacing() + frameHeight
+ -- Calculate the pixel height of the frame by subtracting the height of the area above from the total height of the window.
+ local frameHeight = window:getUnclippedOuterRect():getHeight() - formattedArea:getHeight()
+
+ local height = 0
+ if ORXONOX_OLD_CEGUI then
+ local lines = window:getFont():getFormattedLineCount(window:getText(), formattedArea, CEGUI.WordWrapLeftAligned)
+ height = lines * window:getFont():getLineSpacing() + frameHeight
+ else
+ height = math.floor(CEGUI.PropertyHelper:stringToFloat(window:getProperty("VertExtent")) + frameHeight) + 1
+ end
return height
end
Modified: code/branches/kicklib2/data/gui/scripts/InitialiseGUI.lua
===================================================================
--- code/branches/kicklib2/data/gui/scripts/InitialiseGUI.lua 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/data/gui/scripts/InitialiseGUI.lua 2011-04-21 16:32:28 UTC (rev 8283)
@@ -6,27 +6,27 @@
local scheme = orxonox.CommandExecutor:query("getConfig GUIManager guiScheme_")
-- Load all required skins
---schemeMgr:loadScheme("TaharezGreenLook.scheme")
-schemeMgr:loadScheme(scheme .. "Look.scheme")
---schemeMgr:loadScheme("TaharezLook.scheme")
---schemeMgr:loadScheme("WindowsLook.scheme")
---schemeMgr:loadScheme("VanillaLook.scheme")
---schemeMgr:loadScheme("SleekSpaceLook.scheme")
+--schemeMgr:create("TaharezGreenLook.scheme")
+schemeMgr:create(scheme .. "Look.scheme")
+--schemeMgr:create("TaharezLook.scheme")
+--schemeMgr:create("WindowsLook.scheme")
+--schemeMgr:create("VanillaLook.scheme")
+--schemeMgr:create("SleekSpaceLook.scheme")
-- Connect skin specific window types with our own window types
-- By loading a different file (if there is) you can change the skin
-- of the menus or the HUD independently
---schemeMgr:loadScheme("TaharezGreenMenuWidgets.scheme")
+--schemeMgr:create("TaharezGreenMenuWidgets.scheme")
--menuImageSet = "TaharezGreenLook"
---schemeMgr:loadScheme("TaharezGreenHUDWidgets.scheme")
+--schemeMgr:create("TaharezGreenHUDWidgets.scheme")
--hudImageSet = "TaharezGreenLook"
-schemeMgr:loadScheme(scheme .. "MenuWidgets.scheme")
+schemeMgr:create(scheme .. "MenuWidgets.scheme")
menuImageSet = scheme .. "Look"
-schemeMgr:loadScheme(scheme .. "HUDWidgets.scheme")
+schemeMgr:create(scheme .. "HUDWidgets.scheme")
hudImageSet = scheme .. "Look"
-- Just a remaining test hack
-schemeMgr:loadScheme("OrxonoxGUIScheme.scheme")
+schemeMgr:create("OrxonoxGUIScheme.scheme")
local system = CEGUI.System:getSingleton()
system:setDefaultMouseCursor(menuImageSet, "MouseArrow")
Modified: code/branches/kicklib2/data/gui/scripts/NotificationLayer.lua
===================================================================
--- code/branches/kicklib2/data/gui/scripts/NotificationLayer.lua 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/data/gui/scripts/NotificationLayer.lua 2011-04-21 16:32:28 UTC (rev 8283)
@@ -483,7 +483,7 @@
local singleItemHeight = listbox:getTotalItemsHeight()
local lookAndFeel = CEGUI.WidgetLookManager:getSingleton():getWidgetLook(queue:getLookNFeel())
local formattedArea = lookAndFeel:getNamedArea("ItemRenderingArea"):getArea():getPixelRect(queue)
- local frameHeight = queue:getUnclippedPixelRect():getHeight() - formattedArea:getHeight()
+ local frameHeight = queue:getUnclippedOuterRect():getHeight() - formattedArea:getHeight()
listbox:removeItem(item)
return frameHeight + singleItemHeight*size
end
Modified: code/branches/kicklib2/doc/api/doxy.config.in
===================================================================
--- code/branches/kicklib2/doc/api/doxy.config.in 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/doc/api/doxy.config.in 2011-04-21 16:32:28 UTC (rev 8283)
@@ -625,9 +625,6 @@
EXCLUDE = @CMAKE_SOURCE_DIR@/src/external/bullet/ \
@CMAKE_SOURCE_DIR@/src/external/cpptcl/ \
- @CMAKE_SOURCE_DIR@/src/external/ceguilua/ceguilua-0.5.0 \
- @CMAKE_SOURCE_DIR@/src/external/ceguilua/ceguilua-0.6.0 \
- @CMAKE_SOURCE_DIR@/src/external/ceguilua/ceguilua-0.6.1 \
@CMAKE_SOURCE_DIR@/src/libraries/core/command/IOConsoleWindows.h \
@CMAKE_SOURCE_DIR@/src/libraries/core/command/IOConsoleWindows.cc \
@CMAKE_SOURCE_DIR@/src/libraries/tools/bsp \
Modified: code/branches/kicklib2/src/CMakeLists.txt
===================================================================
--- code/branches/kicklib2/src/CMakeLists.txt 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/CMakeLists.txt 2011-04-21 16:32:28 UTC (rev 8283)
@@ -39,10 +39,10 @@
# If no defines are specified, these libs get linked statically
ADD_COMPILER_FLAGS("-DBOOST_ALL_DYN_LINK" WIN32 LINK_BOOST_DYNAMIC)
#ADD_COMPILER_FLAGS("-DENET_DLL" WIN32 LINK_ENET_DYNAMIC)
-ADD_COMPILER_FLAGS("-DLUA_BUILD_AS_DLL" WIN32 LINK_LUA_DYNAMIC)
+ADD_COMPILER_FLAGS("-DLUA_BUILD_AS_DLL" WIN32 LINK_LUA5.1_DYNAMIC)
ADD_COMPILER_FLAGS("-DZLIB_DLL" WIN32 LINK_ZLIB_DYNAMIC)
# If no defines are specified, these libs get linked dynamically
-ADD_COMPILER_FLAGS("-DCEGUI_STATIC" WIN32 NOT LINK_CEGUI_DYNAMIC)
+ADD_COMPILER_FLAGS("-DCEGUI_STATIC -DTOLUA_STATIC" WIN32 NOT LINK_CEGUI_DYNAMIC)
ADD_COMPILER_FLAGS("-DOGRE_STATIC_LIB" WIN32 NOT LINK_OGRE_DYNAMIC)
ADD_COMPILER_FLAGS("-DSTATIC_BUILD" WIN32 NOT LINK_TCL_DYNAMIC)
@@ -60,11 +60,9 @@
SET(_external_shared_link FALSE)
ENDIF()
# If no defines are specified, these libs get linked dynamically
-ADD_COMPILER_FLAGS("-DCEGUILUA_STATIC" WIN32 NOT _external_shared_link)
ADD_COMPILER_FLAGS("-DENET_DLL" WIN32 _external_shared_link)
ADD_COMPILER_FLAGS("-DOGRE_GUIRENDERER_STATIC_LIB" WIN32 NOT _external_shared_link)
ADD_COMPILER_FLAGS("-DOIS_STATIC_LIB" WIN32 NOT _external_shared_link)
-ADD_COMPILER_FLAGS("-DTOLUA_STATIC_BUILD" WIN32 NOT _external_shared_link)
############## Include Directories ##############
@@ -80,7 +78,7 @@
${ALUT_INCLUDE_DIR}
${VORBIS_INCLUDE_DIR}
${OGG_INCLUDE_DIR}
- ${LUA_INCLUDE_DIR}
+ ${LUA5.1_INCLUDE_DIR}
${TCL_INCLUDE_PATH}
${DIRECTX_INCLUDE_DIR}
${ZLIB_INCLUDE_DIR}
@@ -96,14 +94,16 @@
${CMAKE_CURRENT_BINARY_DIR}
)
-IF(CEGUILUA_USE_INTERNAL_LIBRARY)
- INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/external/ceguilua/ceguilua-${CEGUI_VERSION})
-ENDIF()
-
IF (DBGHELP_FOUND)
INCLUDE_DIRECTORIES(${DBGHELP_INCLUDE_DIR})
ENDIF()
+############## CEGUI OGRE Renderer ##############
+
+IF(CEGUI_OGRE_RENDERER_BUILD_REQUIRED)
+ SET(CEGUI_OGRE_RENDERER_LIBRARY ogreceguirenderer_orxonox)
+ENDIF()
+
################### Tolua Bind ##################
# Create directory because the tolua application doesn't work otherwise
Modified: code/branches/kicklib2/src/SpecialConfig.h.in
===================================================================
--- code/branches/kicklib2/src/SpecialConfig.h.in 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/SpecialConfig.h.in 2011-04-21 16:32:28 UTC (rev 8283)
@@ -41,8 +41,6 @@
#include "OrxonoxConfig.h"
-#cmakedefine CEGUILUA_USE_INTERNAL_LIBRARY ///< Set whether we must suffix "ceguilua/" for the CEGUILua.h include
-
#cmakedefine DEPENDENCY_PACKAGE_ENABLE ///< Defined if a precompiled depdency package was used. We then copy all libraries too when installing.
#cmakedefine INSTALL_COPYABLE ///< Orxonox either gets installed to the system or just into a folder. The latter uses relative paths.
Modified: code/branches/kicklib2/src/external/CMakeLists.txt
===================================================================
--- code/branches/kicklib2/src/external/CMakeLists.txt 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/external/CMakeLists.txt 2011-04-21 16:32:28 UTC (rev 8283)
@@ -20,21 +20,12 @@
################ Sub Directories ################
ADD_SUBDIRECTORY(tolua)
-
-# Include CEGUILua if not requested otherwise
-IF(CEGUILUA_USE_INTERNAL_LIBRARY)
- IF(NOT IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ceguilua/ceguilua-${CEGUI_VERSION})
- MESSAGE(FATAL_ERROR "CEGUILua version not found in src folder. Update list of supported versions in LibraryConfig.cmake!")
- ENDIF()
-
- ADD_SUBDIRECTORY(ceguilua)
- SET(CEGUILUA_LIBRARY ${CEGUILUA_LIBRARY} PARENT_SCOPE)
-ENDIF()
-
ADD_SUBDIRECTORY(bullet)
ADD_SUBDIRECTORY(cpptcl)
ADD_SUBDIRECTORY(enet)
ADD_SUBDIRECTORY(loki)
-ADD_SUBDIRECTORY(ogreceguirenderer)
+IF(CEGUI_OGRE_RENDERER_BUILD_REQUIRED)
+ ADD_SUBDIRECTORY(ogreceguirenderer)
+ENDIF()
ADD_SUBDIRECTORY(ois)
ADD_SUBDIRECTORY(tinyxml)
Modified: code/branches/kicklib2/src/external/ogreceguirenderer/OgreCEGUIRenderer.cpp
===================================================================
--- code/branches/kicklib2/src/external/ogreceguirenderer/OgreCEGUIRenderer.cpp 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/external/ogreceguirenderer/OgreCEGUIRenderer.cpp 2011-04-21 16:32:28 UTC (rev 8283)
@@ -454,11 +454,7 @@
d_render_sys->_setTextureUnitFiltering(0, FO_LINEAR, FO_LINEAR, FO_POINT);
d_render_sys->_setTextureAddressingMode(0, d_uvwAddressMode);
d_render_sys->_setTextureMatrix(0, Matrix4::IDENTITY);
-#if OGRE_VERSION >= 0x010600
d_render_sys->_setAlphaRejectSettings(CMPF_ALWAYS_PASS, 0, false);
-#else
- d_render_sys->_setAlphaRejectSettings(CMPF_ALWAYS_PASS, 0);
-#endif
d_render_sys->_setTextureBlendMode(0, d_colourBlendMode);
d_render_sys->_setTextureBlendMode(0, d_alphaBlendMode);
d_render_sys->_disableTextureUnitsFrom(1);
Modified: code/branches/kicklib2/src/external/ogreceguirenderer/VERSION
===================================================================
--- code/branches/kicklib2/src/external/ogreceguirenderer/VERSION 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/external/ogreceguirenderer/VERSION 2011-04-21 16:32:28 UTC (rev 8283)
@@ -1,4 +1,4 @@
-This library is part of the OGRE v1.6.1 source.
+This library is part of the OGRE v1.6.5 source.
-----
Modified: code/branches/kicklib2/src/external/ogreceguirenderer/changes_orxonox.diff
===================================================================
--- code/branches/kicklib2/src/external/ogreceguirenderer/changes_orxonox.diff 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/external/ogreceguirenderer/changes_orxonox.diff 2011-04-21 16:32:28 UTC (rev 8283)
@@ -17,18 +17,6 @@
#include "OgreCEGUIRenderer.h"
#include "OgreCEGUITexture.h"
-@@ -454,7 +454,11 @@
- d_render_sys->_setTextureUnitFiltering(0, FO_LINEAR, FO_LINEAR, FO_POINT);
- d_render_sys->_setTextureAddressingMode(0, d_uvwAddressMode);
- d_render_sys->_setTextureMatrix(0, Matrix4::IDENTITY);
-+#if OGRE_VERSION >= 0x010600
-+ d_render_sys->_setAlphaRejectSettings(CMPF_ALWAYS_PASS, 0, false);
-+#else
- d_render_sys->_setAlphaRejectSettings(CMPF_ALWAYS_PASS, 0);
-+#endif
- d_render_sys->_setTextureBlendMode(0, d_colourBlendMode);
- d_render_sys->_setTextureBlendMode(0, d_alphaBlendMode);
- d_render_sys->_disableTextureUnitsFrom(1);
--- OgreCEGUIRenderer.h Wed Jan 28 21:14:09 2009
+++ OgreCEGUIRenderer.h Wed Jan 28 21:06:46 2009
@@ -29,15 +29,15 @@
Modified: code/branches/kicklib2/src/external/tolua/CMakeLists.txt
===================================================================
--- code/branches/kicklib2/src/external/tolua/CMakeLists.txt 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/external/tolua/CMakeLists.txt 2011-04-21 16:32:28 UTC (rev 8283)
@@ -17,33 +17,6 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
-################### Tolua++ library ###################
-
-SET_SOURCE_FILES(TOLUA_FILES
- tolua_event.h
- tolua++.h
-COMPILATION_BEGIN ToluaCompilation.c
- tolua_event.c
- tolua_is.c
- tolua_map.c
- tolua_push.c
- tolua_to.c
-COMPILATION_END
-)
-
-ORXONOX_ADD_LIBRARY(tolua_orxonox
- ORXONOX_EXTERNAL
- DEFINE_SYMBOL
- "TOLUA_SHARED_BUILD"
- VERSION
- 1.0.92
- LINK_LIBRARIES
- ${LUA_LIBRARIES}
- SOURCE_FILES
- ${TOLUA_FILES}
-)
-
-
################## Tolua++ generator ##################
ORXONOX_ADD_EXECUTABLE(toluaapp_orxonox
@@ -52,16 +25,16 @@
1.0.92
NO_INSTALL
LINK_LIBRARIES
- ${LUA_LIBRARIES}
+ ${LUA5.1_LIBRARY}
SOURCE_FILES
tolua.c
)
# Set some variables to the cache in order to use them in the TOLUA macro
-SET(TOLUA_PARSER_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/all-${LUA_VERSION}.lua" CACHE INTERNAL "")
+SET(TOLUA_PARSER_SOURCE "${CMAKE_CURRENT_SOURCE_DIR}/all-5.1.lua" CACHE INTERNAL "")
SET(TOLUA_PARSER_DEPENDENCIES
toluaapp_orxonox
- ${CMAKE_CURRENT_SOURCE_DIR}/all-${LUA_VERSION}.lua
+ ${CMAKE_CURRENT_SOURCE_DIR}/all-5.1.lua
${CMAKE_CURRENT_SOURCE_DIR}/lua/compat-5.1.lua
${CMAKE_CURRENT_SOURCE_DIR}/lua/compat.lua
${CMAKE_CURRENT_SOURCE_DIR}/lua/basic.lua
Copied: code/branches/kicklib2/src/external/tolua/README_ORXONOX (from rev 7974, code/branches/kicklib/src/external/tolua/README_ORXONOX)
===================================================================
--- code/branches/kicklib2/src/external/tolua/README_ORXONOX (rev 0)
+++ code/branches/kicklib2/src/external/tolua/README_ORXONOX 2011-04-21 16:32:28 UTC (rev 8283)
@@ -0,0 +1,2 @@
+Beware that this tolua folder does not fully contain Tolua++. Instead you can only find the source code required for the generator executable.
+The actual tolua library has to be supplied and is called CEGUI_TOLUA_LIBRARY because we use the one supplied with CEGUI.
Modified: code/branches/kicklib2/src/external/tolua/VERSION
===================================================================
--- code/branches/kicklib2/src/external/tolua/VERSION 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/external/tolua/VERSION 2011-04-21 16:32:28 UTC (rev 8283)
@@ -1,4 +1,4 @@
-Tolua++ v1.0.92 with changes:
+Tolua++ v1.0.92 (generator application only) with changes:
- Exception handling by CEGUI team
- Corrected all indentation by Orxonox
Deleted: code/branches/kicklib2/src/external/tolua/all-5.0.lua
===================================================================
--- code/branches/kicklib2/src/external/tolua/all-5.0.lua 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/external/tolua/all-5.0.lua 2011-04-21 16:32:28 UTC (rev 8283)
@@ -1,28 +0,0 @@
-dofile(path.."lua/compat.lua")
-dofile(path.."lua/basic.lua")
-dofile(path.."lua/feature.lua")
-dofile(path.."lua/verbatim.lua")
-dofile(path.."lua/code.lua")
-dofile(path.."lua/typedef.lua")
-dofile(path.."lua/container.lua")
-dofile(path.."lua/package.lua")
-dofile(path.."lua/module.lua")
-dofile(path.."lua/namespace.lua")
-dofile(path.."lua/define.lua")
-dofile(path.."lua/enumerate.lua")
-dofile(path.."lua/declaration.lua")
-dofile(path.."lua/variable.lua")
-dofile(path.."lua/array.lua")
-dofile(path.."lua/function.lua")
-dofile(path.."lua/operator.lua")
-dofile(path.."lua/class.lua")
-dofile(path.."lua/clean.lua")
---dofile(path.."lua/custom.lua")
-dofile(path.."lua/doit.lua")
-
-local err,msg = xpcall(doit, debug.traceback)
-if not err then
---print("**** msg is "..tostring(msg))
- local _,_,label,msg = strfind(msg,"(.-:.-:%s*)(.*)")
- tolua_error(msg,label)
-end
Modified: code/branches/kicklib2/src/external/tolua/changes_orxonox.diff
===================================================================
--- code/branches/kicklib2/src/external/tolua/changes_orxonox.diff 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/external/tolua/changes_orxonox.diff 2011-04-21 16:32:28 UTC (rev 8283)
@@ -1,41 +1,3 @@
-diff -ruN tolua/tolua++.h tolua2/tolua++.h
---- tolua/tolua++.h Wed Jan 28 21:51:38 2009
-+++ tolua2/tolua++.h Sat Jan 10 14:48:44 2009
-@@ -16,9 +16,34 @@
- #ifndef TOLUA_H
- #define TOLUA_H
-
-+/* original code */
-+/*
- #ifndef TOLUA_API
- #define TOLUA_API extern
- #endif
-+*/
-+
-+/********************************
-+******* ORXONOX CHANGES *********
-+********************************/
-+
-+#if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined( TOLUA_STATIC_BUILD )
-+# ifdef TOLUA_SHARED_BUILD
-+# define TOLUA_API __declspec(dllexport)
-+# else
-+# if defined( __MINGW32__ )
-+# define TOLUA_API
-+# else
-+# define TOLUA_API __declspec(dllimport)
-+# endif
-+# endif
-+#else
-+# define TOLUA_API extern
-+#endif
-+
-+/********************************
-+****** END ORXONOX CHANGES ******
-+********************************/
-
- #define TOLUA_VERSION "tolua++-1.0.92"
-
diff -ruN tolua/tolua.c tolua2/tolua.c
--- tolua/tolua.c Wed Jan 28 21:51:00 2009
+++ tolua2/tolua.c Sat Jan 10 14:48:45 2009
Modified: code/branches/kicklib2/src/external/tolua/lua/package.lua
===================================================================
--- code/branches/kicklib2/src/external/tolua/lua/package.lua 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/external/tolua/lua/package.lua 2011-04-21 16:32:28 UTC (rev 8283)
@@ -123,7 +123,7 @@
output('#include <stdlib.h>\n')
output('#endif\n')
output('#include <string.h>\n\n')
- output('#include <tolua/tolua++.h>\n\n')
+ output('#include <tolua++.h>\n\n')
if flags.H then
output('#include "'..flags.H..'"\n')
Deleted: code/branches/kicklib2/src/external/tolua/tolua++.h
===================================================================
--- code/branches/kicklib2/src/external/tolua/tolua++.h 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/external/tolua/tolua++.h 2011-04-21 16:32:28 UTC (rev 8283)
@@ -1,182 +0,0 @@
-/* tolua
-** Support code for Lua bindings.
-** Written by Waldemar Celes
-** TeCGraf/PUC-Rio
-** Apr 2003
-** $Id: $
-*/
-
-/* This code is free software; you can redistribute it and/or modify it.
-** The software provided hereunder is on an "as is" basis, and
-** the author has no obligation to provide maintenance, support, updates,
-** enhancements, or modifications.
-*/
-
-
-#ifndef TOLUA_H
-#define TOLUA_H
-
-/* original code */
-/*
-#ifndef TOLUA_API
-#define TOLUA_API extern
-#endif
-*/
-
-/********************************
-******* ORXONOX CHANGES *********
-********************************/
-
-#if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined( TOLUA_STATIC_BUILD )
-# ifdef TOLUA_SHARED_BUILD
-# define TOLUA_API __declspec(dllexport)
-# else
-# if defined( __MINGW32__ )
-# define TOLUA_API
-# else
-# define TOLUA_API __declspec(dllimport)
-# endif
-# endif
-#else
-# define TOLUA_API extern
-#endif
-
-/********************************
-****** END ORXONOX CHANGES ******
-********************************/
-
-#define TOLUA_VERSION "tolua++-1.0.92"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#define tolua_pushcppstring(x,y) tolua_pushstring(x,y.c_str())
-#define tolua_iscppstring tolua_isstring
-
-#define tolua_iscppstringarray tolua_isstringarray
-#define tolua_pushfieldcppstring(L,lo,idx,s) tolua_pushfieldstring(L, lo, idx, s.c_str())
-
-#define TEMPLATE_BIND(p)
-#define TOLUA_TEMPLATE_BIND(p)
-#define TOLUA_PROTECTED_DESTRUCTOR
-#define TOLUA_PROPERTY_TYPE(p)
-
-typedef int lua_Object;
-
-#include "lua.h"
-#include "lauxlib.h"
-
-struct tolua_Error
-{
- int index;
- int array;
- const char* type;
-};
-typedef struct tolua_Error tolua_Error;
-
-#define TOLUA_NOPEER LUA_REGISTRYINDEX /* for lua 5.1 */
-
-TOLUA_API const char* tolua_typename (lua_State* L, int lo);
-TOLUA_API void tolua_error (lua_State* L, char* msg, tolua_Error* err);
-TOLUA_API int tolua_isnoobj (lua_State* L, int lo, tolua_Error* err);
-TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err);
-TOLUA_API int tolua_isboolean (lua_State* L, int lo, int def, tolua_Error* err);
-TOLUA_API int tolua_isnumber (lua_State* L, int lo, int def, tolua_Error* err);
-TOLUA_API int tolua_isstring (lua_State* L, int lo, int def, tolua_Error* err);
-TOLUA_API int tolua_istable (lua_State* L, int lo, int def, tolua_Error* err);
-TOLUA_API int tolua_isusertable (lua_State* L, int lo, const char* type, int def, tolua_Error* err);
-TOLUA_API int tolua_isuserdata (lua_State* L, int lo, int def, tolua_Error* err);
-TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def, tolua_Error* err);
-TOLUA_API int tolua_isvaluearray
- (lua_State* L, int lo, int dim, int def, tolua_Error* err);
-TOLUA_API int tolua_isbooleanarray
- (lua_State* L, int lo, int dim, int def, tolua_Error* err);
-TOLUA_API int tolua_isnumberarray
- (lua_State* L, int lo, int dim, int def, tolua_Error* err);
-TOLUA_API int tolua_isstringarray
- (lua_State* L, int lo, int dim, int def, tolua_Error* err);
-TOLUA_API int tolua_istablearray
- (lua_State* L, int lo, int dim, int def, tolua_Error* err);
-TOLUA_API int tolua_isuserdataarray
- (lua_State* L, int lo, int dim, int def, tolua_Error* err);
-TOLUA_API int tolua_isusertypearray
- (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err);
-
-TOLUA_API void tolua_open (lua_State* L);
-
-TOLUA_API void* tolua_copy (lua_State* L, void* value, unsigned int size);
-TOLUA_API int tolua_register_gc (lua_State* L, int lo);
-TOLUA_API int tolua_default_collect (lua_State* tolua_S);
-
-TOLUA_API void tolua_usertype (lua_State* L, char* type);
-TOLUA_API void tolua_beginmodule (lua_State* L, char* name);
-TOLUA_API void tolua_endmodule (lua_State* L);
-TOLUA_API void tolua_module (lua_State* L, char* name, int hasvar);
-TOLUA_API void tolua_class (lua_State* L, char* name, char* base);
-TOLUA_API void tolua_cclass (lua_State* L, char* lname, char* name, char* base, lua_CFunction col);
-TOLUA_API void tolua_function (lua_State* L, char* name, lua_CFunction func);
-TOLUA_API void tolua_constant (lua_State* L, char* name, double value);
-TOLUA_API void tolua_variable (lua_State* L, char* name, lua_CFunction get, lua_CFunction set);
-TOLUA_API void tolua_array (lua_State* L,char* name, lua_CFunction get, lua_CFunction set);
-
-/* TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type); */
-/* TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base); */
-
-TOLUA_API void tolua_pushvalue (lua_State* L, int lo);
-TOLUA_API void tolua_pushboolean (lua_State* L, int value);
-TOLUA_API void tolua_pushnumber (lua_State* L, double value);
-TOLUA_API void tolua_pushstring (lua_State* L, const char* value);
-TOLUA_API void tolua_pushuserdata (lua_State* L, void* value);
-TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type);
-TOLUA_API void tolua_pushusertype_and_takeownership(lua_State* L, void* value, const char* type);
-TOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v);
-TOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v);
-TOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, double v);
-TOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v);
-TOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v);
-TOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type);
-TOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type);
-
-TOLUA_API double tolua_tonumber (lua_State* L, int narg, double def);
-TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def);
-TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def);
-TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def);
-TOLUA_API int tolua_tovalue (lua_State* L, int narg, int def);
-TOLUA_API int tolua_toboolean (lua_State* L, int narg, int def);
-TOLUA_API double tolua_tofieldnumber (lua_State* L, int lo, int index, double def);
-TOLUA_API const char* tolua_tofieldstring (lua_State* L, int lo, int index, const char* def);
-TOLUA_API void* tolua_tofielduserdata (lua_State* L, int lo, int index, void* def);
-TOLUA_API void* tolua_tofieldusertype (lua_State* L, int lo, int index, void* def);
-TOLUA_API int tolua_tofieldvalue (lua_State* L, int lo, int index, int def);
-TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def);
-
-TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const char* name);
-
-TOLUA_API int class_gc_event (lua_State* L);
-
-#ifdef __cplusplus
-static inline const char* tolua_tocppstring (lua_State* L, int narg, const char* def) {
-
- const char* s = tolua_tostring(L, narg, def);
- return s?s:"";
-};
-
-static inline const char* tolua_tofieldcppstring (lua_State* L, int lo, int index, const char* def) {
-
- const char* s = tolua_tofieldstring(L, lo, index, def);
- return s?s:"";
-};
-
-#else
-#define tolua_tocppstring tolua_tostring
-#define tolua_tofieldcppstring tolua_tofieldstring
-#endif
-
-TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
Deleted: code/branches/kicklib2/src/external/tolua/tolua_event.c
===================================================================
--- code/branches/kicklib2/src/external/tolua/tolua_event.c 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/external/tolua/tolua_event.c 2011-04-21 16:32:28 UTC (rev 8283)
@@ -1,513 +0,0 @@
-/* tolua: event functions
-** Support code for Lua bindings.
-** Written by Waldemar Celes
-** TeCGraf/PUC-Rio
-** Apr 2003
-** $Id: $
-*/
-
-/* This code is free software; you can redistribute it and/or modify it.
-** The software provided hereunder is on an "as is" basis, and
-** the author has no obligation to provide maintenance, support, updates,
-** enhancements, or modifications.
-*/
-
-#include <stdio.h>
-
-#include "tolua++.h"
-
-/* Store at ubox
- * It stores, creating the corresponding table if needed,
- * the pair key/value in the corresponding ubox table
-*/
-static void storeatubox (lua_State* L, int lo)
-{
- #ifdef LUA_VERSION_NUM
- lua_getfenv(L, lo);
- if (lua_rawequal(L, -1, TOLUA_NOPEER)) {
- lua_pop(L, 1);
- lua_newtable(L);
- lua_pushvalue(L, -1);
- lua_setfenv(L, lo); /* stack: k,v,table */
- };
- lua_insert(L, -3);
- lua_settable(L, -3); /* on lua 5.1, we trade the "tolua_peers" lookup for a settable call */
- lua_pop(L, 1);
- #else
- /* stack: key value (to be stored) */
- lua_pushstring(L,"tolua_peers");
- lua_rawget(L,LUA_REGISTRYINDEX); /* stack: k v ubox */
- lua_pushvalue(L,lo);
- lua_rawget(L,-2); /* stack: k v ubox ubox[u] */
- if (!lua_istable(L,-1))
- {
- lua_pop(L,1); /* stack: k v ubox */
- lua_newtable(L); /* stack: k v ubox table */
- lua_pushvalue(L,1);
- lua_pushvalue(L,-2); /* stack: k v ubox table u table */
- lua_rawset(L,-4); /* stack: k v ubox ubox[u]=table */
- }
- lua_insert(L,-4); /* put table before k */
- lua_pop(L,1); /* pop ubox */
- lua_rawset(L,-3); /* store at table */
- lua_pop(L,1); /* pop ubox[u] */
- #endif
-}
-
-/* Module index function
-*/
-static int module_index_event (lua_State* L)
-{
- lua_pushstring(L,".get");
- lua_rawget(L,-3);
- if (lua_istable(L,-1))
- {
- lua_pushvalue(L,2); /* key */
- lua_rawget(L,-2);
- if (lua_iscfunction(L,-1))
- {
- lua_call(L,0,1);
- return 1;
- }
- else if (lua_istable(L,-1))
- return 1;
- }
- /* call old index meta event */
- if (lua_getmetatable(L,1))
- {
- lua_pushstring(L,"__index");
- lua_rawget(L,-2);
- lua_pushvalue(L,1);
- lua_pushvalue(L,2);
- if (lua_isfunction(L,-1))
- {
- lua_call(L,2,1);
- return 1;
- }
- else if (lua_istable(L,-1))
- {
- lua_gettable(L,-3);
- return 1;
- }
- }
- lua_pushnil(L);
- return 1;
-}
-
-/* Module newindex function
-*/
-static int module_newindex_event (lua_State* L)
-{
- lua_pushstring(L,".set");
- lua_rawget(L,-4);
- if (lua_istable(L,-1))
- {
- lua_pushvalue(L,2); /* key */
- lua_rawget(L,-2);
- if (lua_iscfunction(L,-1))
- {
- lua_pushvalue(L,1); /* only to be compatible with non-static vars */
- lua_pushvalue(L,3); /* value */
- lua_call(L,2,0);
- return 0;
- }
- }
- /* call old newindex meta event */
- if (lua_getmetatable(L,1) && lua_getmetatable(L,-1))
- {
- lua_pushstring(L,"__newindex");
- lua_rawget(L,-2);
- if (lua_isfunction(L,-1))
- {
- lua_pushvalue(L,1);
- lua_pushvalue(L,2);
- lua_pushvalue(L,3);
- lua_call(L,3,0);
- }
- }
- lua_settop(L,3);
- lua_rawset(L,-3);
- return 0;
-}
-
-/* Class index function
- * If the object is a userdata (ie, an object), it searches the field in
- * the alternative table stored in the corresponding "ubox" table.
-*/
-static int class_index_event (lua_State* L)
-{
- int t = lua_type(L,1);
- if (t == LUA_TUSERDATA)
- {
- /* Access alternative table */
- #ifdef LUA_VERSION_NUM /* new macro on version 5.1 */
- lua_getfenv(L,1);
- if (!lua_rawequal(L, -1, TOLUA_NOPEER)) {
- lua_pushvalue(L, 2); /* key */
- lua_gettable(L, -2); /* on lua 5.1, we trade the "tolua_peers" lookup for a gettable call */
- if (!lua_isnil(L, -1))
- return 1;
- };
- #else
- lua_pushstring(L,"tolua_peers");
- lua_rawget(L,LUA_REGISTRYINDEX); /* stack: obj key ubox */
- lua_pushvalue(L,1);
- lua_rawget(L,-2); /* stack: obj key ubox ubox[u] */
- if (lua_istable(L,-1))
- {
- lua_pushvalue(L,2); /* key */
- lua_rawget(L,-2); /* stack: obj key ubox ubox[u] value */
- if (!lua_isnil(L,-1))
- return 1;
- }
- #endif
- lua_settop(L,2); /* stack: obj key */
- /* Try metatables */
- lua_pushvalue(L,1); /* stack: obj key obj */
- while (lua_getmetatable(L,-1))
- { /* stack: obj key obj mt */
- lua_remove(L,-2); /* stack: obj key mt */
- if (lua_isnumber(L,2)) /* check if key is a numeric value */
- {
- /* try operator[] */
- lua_pushstring(L,".geti");
- lua_rawget(L,-2); /* stack: obj key mt func */
- if (lua_isfunction(L,-1))
- {
- lua_pushvalue(L,1);
- lua_pushvalue(L,2);
- lua_call(L,2,1);
- return 1;
- }
- }
- else
- {
- lua_pushvalue(L,2); /* stack: obj key mt key */
- lua_rawget(L,-2); /* stack: obj key mt value */
- if (!lua_isnil(L,-1))
- return 1;
- else
- lua_pop(L,1);
- /* try C/C++ variable */
- lua_pushstring(L,".get");
- lua_rawget(L,-2); /* stack: obj key mt tget */
- if (lua_istable(L,-1))
- {
- lua_pushvalue(L,2);
- lua_rawget(L,-2); /* stack: obj key mt value */
- if (lua_iscfunction(L,-1))
- {
- lua_pushvalue(L,1);
- lua_pushvalue(L,2);
- lua_call(L,2,1);
- return 1;
- }
- else if (lua_istable(L,-1))
- {
- /* deal with array: create table to be returned and cache it in ubox */
- void* u = *((void**)lua_touserdata(L,1));
- lua_newtable(L); /* stack: obj key mt value table */
- lua_pushstring(L,".self");
- lua_pushlightuserdata(L,u);
- lua_rawset(L,-3); /* store usertype in ".self" */
- lua_insert(L,-2); /* stack: obj key mt table value */
- lua_setmetatable(L,-2); /* set stored value as metatable */
- lua_pushvalue(L,-1); /* stack: obj key met table table */
- lua_pushvalue(L,2); /* stack: obj key mt table table key */
- lua_insert(L,-2); /* stack: obj key mt table key table */
- storeatubox(L,1); /* stack: obj key mt table */
- return 1;
- }
- }
- }
- lua_settop(L,3);
- }
- lua_pushnil(L);
- return 1;
- }
- else if (t== LUA_TTABLE)
- {
- module_index_event(L);
- return 1;
- }
- lua_pushnil(L);
- return 1;
-}
-
-/* Newindex function
- * It first searches for a C/C++ varaible to be set.
- * Then, it either stores it in the alternative ubox table (in the case it is
- * an object) or in the own table (that represents the class or module).
-*/
-static int class_newindex_event (lua_State* L)
-{
- int t = lua_type(L,1);
- if (t == LUA_TUSERDATA)
- {
- /* Try accessing a C/C++ variable to be set */
- lua_getmetatable(L,1);
- while (lua_istable(L,-1)) /* stack: t k v mt */
- {
- if (lua_isnumber(L,2)) /* check if key is a numeric value */
- {
- /* try operator[] */
- lua_pushstring(L,".seti");
- lua_rawget(L,-2); /* stack: obj key mt func */
- if (lua_isfunction(L,-1))
- {
- lua_pushvalue(L,1);
- lua_pushvalue(L,2);
- lua_pushvalue(L,3);
- lua_call(L,3,0);
- return 0;
- }
- }
- else
- {
- lua_pushstring(L,".set");
- lua_rawget(L,-2); /* stack: t k v mt tset */
- if (lua_istable(L,-1))
- {
- lua_pushvalue(L,2);
- lua_rawget(L,-2); /* stack: t k v mt tset func */
- if (lua_iscfunction(L,-1))
- {
- lua_pushvalue(L,1);
- lua_pushvalue(L,3);
- lua_call(L,2,0);
- return 0;
- }
- lua_pop(L,1); /* stack: t k v mt tset */
- }
- lua_pop(L,1); /* stack: t k v mt */
- if (!lua_getmetatable(L,-1)) /* stack: t k v mt mt */
- lua_pushnil(L);
- lua_remove(L,-2); /* stack: t k v mt */
- }
- }
- lua_settop(L,3); /* stack: t k v */
-
- /* then, store as a new field */
- storeatubox(L,1);
- }
- else if (t== LUA_TTABLE)
- {
- module_newindex_event(L);
- }
- return 0;
-}
-
-static int class_call_event(lua_State* L) {
-
- if (lua_istable(L, 1)) {
- lua_pushstring(L, ".call");
- lua_rawget(L, 1);
- if (lua_isfunction(L, -1)) {
-
- lua_insert(L, 1);
- lua_call(L, lua_gettop(L)-1, 1);
-
- return 1;
- };
- };
- tolua_error(L,"Attempt to call a non-callable object.",NULL);
- return 0;
-};
-
-static int do_operator (lua_State* L, const char* op)
-{
- if (lua_isuserdata(L,1))
- {
- /* Try metatables */
- lua_pushvalue(L,1); /* stack: op1 op2 */
- while (lua_getmetatable(L,-1))
- { /* stack: op1 op2 op1 mt */
- lua_remove(L,-2); /* stack: op1 op2 mt */
- lua_pushstring(L,op); /* stack: op1 op2 mt key */
- lua_rawget(L,-2); /* stack: obj key mt func */
- if (lua_isfunction(L,-1))
- {
- lua_pushvalue(L,1);
- lua_pushvalue(L,2);
- lua_call(L,2,1);
- return 1;
- }
- lua_settop(L,3);
- }
- }
- tolua_error(L,"Attempt to perform operation on an invalid operand",NULL);
- return 0;
-}
-
-static int class_add_event (lua_State* L)
-{
- return do_operator(L,".add");
-}
-
-static int class_sub_event (lua_State* L)
-{
- return do_operator(L,".sub");
-}
-
-static int class_mul_event (lua_State* L)
-{
- return do_operator(L,".mul");
-}
-
-static int class_div_event (lua_State* L)
-{
- return do_operator(L,".div");
-}
-
-static int class_lt_event (lua_State* L)
-{
- return do_operator(L,".lt");
-}
-
-static int class_le_event (lua_State* L)
-{
- return do_operator(L,".le");
-}
-
-static int class_eq_event (lua_State* L)
-{
- return do_operator(L,".eq");
-}
-
-/*
-static int class_gc_event (lua_State* L)
-{
- void* u = *((void**)lua_touserdata(L,1));
- fprintf(stderr, "collecting: looking at %p\n", u);
- lua_pushstring(L,"tolua_gc");
- lua_rawget(L,LUA_REGISTRYINDEX);
- lua_pushlightuserdata(L,u);
- lua_rawget(L,-2);
- if (lua_isfunction(L,-1))
- {
- lua_pushvalue(L,1);
- lua_call(L,1,0);
- lua_pushlightuserdata(L,u);
- lua_pushnil(L);
- lua_rawset(L,-3);
- }
- lua_pop(L,2);
- return 0;
-}
-*/
-TOLUA_API int class_gc_event (lua_State* L)
-{
- void* u = *((void**)lua_touserdata(L,1));
- int top;
- /*fprintf(stderr, "collecting: looking at %p\n", u);*/
- /*
- lua_pushstring(L,"tolua_gc");
- lua_rawget(L,LUA_REGISTRYINDEX);
- */
- lua_pushvalue(L, lua_upvalueindex(1));
- lua_pushlightuserdata(L,u);
- lua_rawget(L,-2); /* stack: gc umt */
- lua_getmetatable(L,1); /* stack: gc umt mt */
- /*fprintf(stderr, "checking type\n");*/
- top = lua_gettop(L);
- if (tolua_fast_isa(L,top,top-1, lua_upvalueindex(2))) /* make sure we collect correct type */
- {
- /*fprintf(stderr, "Found type!\n");*/
- /* get gc function */
- lua_pushliteral(L,".collector");
- lua_rawget(L,-2); /* stack: gc umt mt collector */
- if (lua_isfunction(L,-1)) {
- /*fprintf(stderr, "Found .collector!\n");*/
- }
- else {
- lua_pop(L,1);
- /*fprintf(stderr, "Using default cleanup\n");*/
- lua_pushcfunction(L,tolua_default_collect);
- }
-
- lua_pushvalue(L,1); /* stack: gc umt mt collector u */
- lua_call(L,1,0);
-
- lua_pushlightuserdata(L,u); /* stack: gc umt mt u */
- lua_pushnil(L); /* stack: gc umt mt u nil */
- lua_rawset(L,-5); /* stack: gc umt mt */
- }
- lua_pop(L,3);
- return 0;
-}
-
-
-/* Register module events
- * It expects the metatable on the top of the stack
-*/
-TOLUA_API void tolua_moduleevents (lua_State* L)
-{
- lua_pushstring(L,"__index");
- lua_pushcfunction(L,module_index_event);
- lua_rawset(L,-3);
- lua_pushstring(L,"__newindex");
- lua_pushcfunction(L,module_newindex_event);
- lua_rawset(L,-3);
-}
-
-/* Check if the object on the top has a module metatable
-*/
-TOLUA_API int tolua_ismodulemetatable (lua_State* L)
-{
- int r = 0;
- if (lua_getmetatable(L,-1))
- {
- lua_pushstring(L,"__index");
- lua_rawget(L,-2);
- r = (lua_tocfunction(L,-1) == module_index_event);
- lua_pop(L,2);
- }
- return r;
-}
-
-/* Register class events
- * It expects the metatable on the top of the stack
-*/
-TOLUA_API void tolua_classevents (lua_State* L)
-{
- lua_pushstring(L,"__index");
- lua_pushcfunction(L,class_index_event);
- lua_rawset(L,-3);
- lua_pushstring(L,"__newindex");
- lua_pushcfunction(L,class_newindex_event);
- lua_rawset(L,-3);
-
- lua_pushstring(L,"__add");
- lua_pushcfunction(L,class_add_event);
- lua_rawset(L,-3);
- lua_pushstring(L,"__sub");
- lua_pushcfunction(L,class_sub_event);
- lua_rawset(L,-3);
- lua_pushstring(L,"__mul");
- lua_pushcfunction(L,class_mul_event);
- lua_rawset(L,-3);
- lua_pushstring(L,"__div");
- lua_pushcfunction(L,class_div_event);
- lua_rawset(L,-3);
-
- lua_pushstring(L,"__lt");
- lua_pushcfunction(L,class_lt_event);
- lua_rawset(L,-3);
- lua_pushstring(L,"__le");
- lua_pushcfunction(L,class_le_event);
- lua_rawset(L,-3);
- lua_pushstring(L,"__eq");
- lua_pushcfunction(L,class_eq_event);
- lua_rawset(L,-3);
-
- lua_pushstring(L,"__call");
- lua_pushcfunction(L,class_call_event);
- lua_rawset(L,-3);
-
- lua_pushstring(L,"__gc");
- lua_pushstring(L, "tolua_gc_event");
- lua_rawget(L, LUA_REGISTRYINDEX);
- /*lua_pushcfunction(L,class_gc_event);*/
- lua_rawset(L,-3);
-}
-
Deleted: code/branches/kicklib2/src/external/tolua/tolua_event.h
===================================================================
--- code/branches/kicklib2/src/external/tolua/tolua_event.h 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/external/tolua/tolua_event.h 2011-04-21 16:32:28 UTC (rev 8283)
@@ -1,24 +0,0 @@
-/* tolua: event functions
-** Support code for Lua bindings.
-** Written by Waldemar Celes
-** TeCGraf/PUC-Rio
-** Apr 2003
-** $Id: $
-*/
-
-/* This code is free software; you can redistribute it and/or modify it.
-** The software provided hereunder is on an "as is" basis, and
-** the author has no obligation to provide maintenance, support, updates,
-** enhancements, or modifications.
-*/
-
-#ifndef TOLUA_EVENT_H
-#define TOLUA_EVENT_H
-
-#include "tolua++.h"
-
-TOLUA_API void tolua_moduleevents (lua_State* L);
-TOLUA_API int tolua_ismodulemetatable (lua_State* L);
-TOLUA_API void tolua_classevents (lua_State* L);
-
-#endif
Deleted: code/branches/kicklib2/src/external/tolua/tolua_is.c
===================================================================
--- code/branches/kicklib2/src/external/tolua/tolua_is.c 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/external/tolua/tolua_is.c 2011-04-21 16:32:28 UTC (rev 8283)
@@ -1,607 +0,0 @@
-/* tolua: functions to check types.
-** Support code for Lua bindings.
-** Written by Waldemar Celes
-** TeCGraf/PUC-Rio
-** Apr 2003
-** $Id: $
-*/
-
-/* This code is free software; you can redistribute it and/or modify it.
-** The software provided hereunder is on an "as is" basis, and
-** the author has no obligation to provide maintenance, support, updates,
-** enhancements, or modifications.
-*/
-
-#include "tolua++.h"
-#include "lauxlib.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-/* a fast check if a is b, without parameter validation
- i.e. if b is equal to a or a superclass of a. */
-TOLUA_API int tolua_fast_isa(lua_State *L, int mt_indexa, int mt_indexb, int super_index)
-{
- int result;
- if (lua_rawequal(L,mt_indexa,mt_indexb))
- result = 1;
- else
- {
- if (super_index) {
- lua_pushvalue(L, super_index);
- } else {
- lua_pushliteral(L,"tolua_super");
- lua_rawget(L,LUA_REGISTRYINDEX); /* stack: super */
- };
- lua_pushvalue(L,mt_indexa); /* stack: super mta */
- lua_rawget(L,-2); /* stack: super super[mta] */
- lua_pushvalue(L,mt_indexb); /* stack: super super[mta] mtb */
- lua_rawget(L,LUA_REGISTRYINDEX); /* stack: super super[mta] typenameB */
- lua_rawget(L,-2); /* stack: super super[mta] bool */
- result = lua_toboolean(L,-1);
- lua_pop(L,3);
- }
- return result;
-}
-
-/* Push and returns the corresponding object typename */
-TOLUA_API const char* tolua_typename (lua_State* L, int lo)
-{
- int tag = lua_type(L,lo);
- if (tag == LUA_TNONE)
- lua_pushstring(L,"[no object]");
- else if (tag != LUA_TUSERDATA && tag != LUA_TTABLE)
- lua_pushstring(L,lua_typename(L,tag));
- else if (tag == LUA_TUSERDATA)
- {
- if (!lua_getmetatable(L,lo))
- lua_pushstring(L,lua_typename(L,tag));
- else
- {
- lua_rawget(L,LUA_REGISTRYINDEX);
- if (!lua_isstring(L,-1))
- {
- lua_pop(L,1);
- lua_pushstring(L,"[undefined]");
- }
- }
- }
- else /* is table */
- {
- lua_pushvalue(L,lo);
- lua_rawget(L,LUA_REGISTRYINDEX);
- if (!lua_isstring(L,-1))
- {
- lua_pop(L,1);
- lua_pushstring(L,"table");
- }
- else
- {
- lua_pushstring(L,"class ");
- lua_insert(L,-2);
- lua_concat(L,2);
- }
- }
- return lua_tostring(L,-1);
-}
-
-TOLUA_API void tolua_error (lua_State* L, char* msg, tolua_Error* err)
-{
- if (msg[0] == '#')
- {
- const char* expected = err->type;
- const char* provided = tolua_typename(L,err->index);
- if (msg[1]=='f')
- {
- int narg = err->index;
- if (err->array)
- luaL_error(L,"%s\n argument #%d is array of '%s'; array of '%s' expected.\n",
- msg+2,narg,provided,expected);
- else
- luaL_error(L,"%s\n argument #%d is '%s'; '%s' expected.\n",
- msg+2,narg,provided,expected);
- }
- else if (msg[1]=='v')
- {
- if (err->array)
- luaL_error(L,"%s\n value is array of '%s'; array of '%s' expected.\n",
- msg+2,provided,expected);
- else
- luaL_error(L,"%s\n value is '%s'; '%s' expected.\n",
- msg+2,provided,expected);
- }
- }
- else
- luaL_error(L,msg);
-}
-
-/* the equivalent of lua_is* for usertable */
-static int lua_isusertable (lua_State* L, int lo, const char* type)
-{
- int r = 0;
- if (lo < 0) lo = lua_gettop(L)+lo+1;
- lua_pushvalue(L,lo);
- lua_rawget(L,LUA_REGISTRYINDEX); /* get registry[t] */
- if (lua_isstring(L,-1))
- {
- r = strcmp(lua_tostring(L,-1),type)==0;
- if (!r)
- {
- /* try const */
- lua_pushstring(L,"const ");
- lua_insert(L,-2);
- lua_concat(L,2);
- r = lua_isstring(L,-1) && strcmp(lua_tostring(L,-1),type)==0;
- }
- }
- lua_pop(L, 1);
- return r;
-}
-
-int push_table_instance(lua_State* L, int lo) {
-
- if (lua_istable(L, lo)) {
-
- lua_pushstring(L, ".c_instance");
- lua_gettable(L, lo);
- if (lua_isuserdata(L, -1)) {
-
- lua_replace(L, lo);
- return 1;
- } else {
-
- lua_pop(L, 1);
- return 0;
- };
- } else {
- return 0;
- };
-
- return 0;
-};
-
-/* the equivalent of lua_is* for usertype */
-static int lua_isusertype (lua_State* L, int lo, const char* type)
-{
- if (!lua_isuserdata(L,lo)) {
- if (!push_table_instance(L, lo)) {
- return 0;
- };
- };
- {
- /* check if it is of the same type */
- int r;
- const char *tn;
- if (lua_getmetatable(L,lo)) /* if metatable? */
- {
- lua_rawget(L,LUA_REGISTRYINDEX); /* get registry[mt] */
- tn = lua_tostring(L,-1);
- r = tn && (strcmp(tn,type) == 0);
- lua_pop(L, 1);
- if (r)
- return 1;
- else
- {
- /* check if it is a specialized class */
- lua_pushstring(L,"tolua_super");
- lua_rawget(L,LUA_REGISTRYINDEX); /* get super */
- lua_getmetatable(L,lo);
- lua_rawget(L,-2); /* get super[mt] */
- if (lua_istable(L,-1))
- {
- int b;
- lua_pushstring(L,type);
- lua_rawget(L,-2); /* get super[mt][type] */
- b = lua_toboolean(L,-1);
- lua_pop(L,3);
- if (b)
- return 1;
- }
- }
- }
- }
- return 0;
-}
-
-TOLUA_API int tolua_isnoobj (lua_State* L, int lo, tolua_Error* err)
-{
- if (lua_gettop(L)<abs(lo))
- return 1;
- err->index = lo;
- err->array = 0;
- err->type = "[no object]";
- return 0;
-}
-TOLUA_API int tolua_isvalue (lua_State* L, int lo, int def, tolua_Error* err)
-{
- if (def || abs(lo)<=lua_gettop(L)) /* any valid index */
- return 1;
- err->index = lo;
- err->array = 0;
- err->type = "value";
- return 0;
-}
-
-TOLUA_API int tolua_isboolean (lua_State* L, int lo, int def, tolua_Error* err)
-{
- if (def && lua_gettop(L)<abs(lo))
- return 1;
- if (lua_isnil(L,lo) || lua_isboolean(L,lo))
- return 1;
- err->index = lo;
- err->array = 0;
- err->type = "boolean";
- return 0;
-}
-
-TOLUA_API int tolua_isnumber (lua_State* L, int lo, int def, tolua_Error* err)
-{
- if (def && lua_gettop(L)<abs(lo))
- return 1;
- if (lua_isnumber(L,lo))
- return 1;
- err->index = lo;
- err->array = 0;
- err->type = "number";
- return 0;
-}
-
-TOLUA_API int tolua_isstring (lua_State* L, int lo, int def, tolua_Error* err)
-{
- if (def && lua_gettop(L)<abs(lo))
- return 1;
- if (lua_isnil(L,lo) || lua_isstring(L,lo))
- return 1;
- err->index = lo;
- err->array = 0;
- err->type = "string";
- return 0;
-}
-
-TOLUA_API int tolua_istable (lua_State* L, int lo, int def, tolua_Error* err)
-{
- if (def && lua_gettop(L)<abs(lo))
- return 1;
- if (lua_istable(L,lo))
- return 1;
- err->index = lo;
- err->array = 0;
- err->type = "table";
- return 0;
-}
-
-TOLUA_API int tolua_isusertable (lua_State* L, int lo, const char* type, int def, tolua_Error* err)
-{
- if (def && lua_gettop(L)<abs(lo))
- return 1;
- if (lua_isusertable(L,lo,type))
- return 1;
- err->index = lo;
- err->array = 0;
- err->type = type;
- return 0;
-}
-
-
-TOLUA_API int tolua_isuserdata (lua_State* L, int lo, int def, tolua_Error* err)
-{
- if (def && lua_gettop(L)<abs(lo))
- return 1;
- if (lua_isnil(L,lo) || lua_isuserdata(L,lo))
- return 1;
- err->index = lo;
- err->array = 0;
- err->type = "userdata";
- return 0;
-}
-
-TOLUA_API int tolua_isusertype (lua_State* L, int lo, const char* type, int def, tolua_Error* err)
-{
- if (def && lua_gettop(L)<abs(lo))
- return 1;
- if (lua_isnil(L,lo) || lua_isusertype(L,lo,type))
- return 1;
- err->index = lo;
- err->array = 0;
- err->type = type;
- return 0;
-}
-
-TOLUA_API int tolua_isvaluearray
- (lua_State* L, int lo, int dim, int def, tolua_Error* err)
-{
- if (!tolua_istable(L,lo,def,err))
- return 0;
- else
- return 1;
-}
-
-TOLUA_API int tolua_isbooleanarray
- (lua_State* L, int lo, int dim, int def, tolua_Error* err)
-{
- if (!tolua_istable(L,lo,def,err))
- return 0;
- else
- {
- int i;
- for (i=1; i<=dim; ++i)
- {
- lua_pushnumber(L,i);
- lua_gettable(L,lo);
- if (!(lua_isnil(L,-1) || lua_isboolean(L,-1)) &&
- !(def && lua_isnil(L,-1))
- )
- {
- err->index = lo;
- err->array = 1;
- err->type = "boolean";
- return 0;
- }
- lua_pop(L,1);
- }
- }
- return 1;
-}
-
-TOLUA_API int tolua_isnumberarray
- (lua_State* L, int lo, int dim, int def, tolua_Error* err)
-{
- if (!tolua_istable(L,lo,def,err))
- return 0;
- else
- {
- int i;
- for (i=1; i<=dim; ++i)
- {
- lua_pushnumber(L,i);
- lua_gettable(L,lo);
- if (!lua_isnumber(L,-1) &&
- !(def && lua_isnil(L,-1))
- )
- {
- err->index = lo;
- err->array = 1;
- err->type = "number";
- return 0;
- }
- lua_pop(L,1);
- }
- }
- return 1;
-}
-
-TOLUA_API int tolua_isstringarray
- (lua_State* L, int lo, int dim, int def, tolua_Error* err)
-{
- if (!tolua_istable(L,lo,def,err))
- return 0;
- else
- {
- int i;
- for (i=1; i<=dim; ++i)
- {
- lua_pushnumber(L,i);
- lua_gettable(L,lo);
- if (!(lua_isnil(L,-1) || lua_isstring(L,-1)) &&
- !(def && lua_isnil(L,-1))
- )
- {
- err->index = lo;
- err->array = 1;
- err->type = "string";
- return 0;
- }
- lua_pop(L,1);
- }
- }
- return 1;
-}
-
-TOLUA_API int tolua_istablearray
- (lua_State* L, int lo, int dim, int def, tolua_Error* err)
-{
- if (!tolua_istable(L,lo,def,err))
- return 0;
- else
- {
- int i;
- for (i=1; i<=dim; ++i)
- {
- lua_pushnumber(L,i);
- lua_gettable(L,lo);
- if (! lua_istable(L,-1) &&
- !(def && lua_isnil(L,-1))
- )
- {
- err->index = lo;
- err->array = 1;
- err->type = "table";
- return 0;
- }
- lua_pop(L,1);
- }
- }
- return 1;
-}
-
-TOLUA_API int tolua_isuserdataarray
- (lua_State* L, int lo, int dim, int def, tolua_Error* err)
-{
- if (!tolua_istable(L,lo,def,err))
- return 0;
- else
- {
- int i;
- for (i=1; i<=dim; ++i)
- {
- lua_pushnumber(L,i);
- lua_gettable(L,lo);
- if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) &&
- !(def && lua_isnil(L,-1))
- )
- {
- err->index = lo;
- err->array = 1;
- err->type = "userdata";
- return 0;
- }
- lua_pop(L,1);
- }
- }
- return 1;
-}
-
-TOLUA_API int tolua_isusertypearray
- (lua_State* L, int lo, const char* type, int dim, int def, tolua_Error* err)
-{
- if (!tolua_istable(L,lo,def,err))
- return 0;
- else
- {
- int i;
- for (i=1; i<=dim; ++i)
- {
- lua_pushnumber(L,i);
- lua_gettable(L,lo);
- if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) &&
- !(def && lua_isnil(L,-1))
- )
- {
- err->index = lo;
- err->type = type;
- err->array = 1;
- return 0;
- }
- lua_pop(L,1);
- }
- }
- return 1;
-}
-
-#if 0
-int tolua_isbooleanfield
- (lua_State* L, int lo, int i, int def, tolua_Error* err)
-{
- lua_pushnumber(L,i);
- lua_gettable(L,lo);
- if (!(lua_isnil(L,-1) || lua_isboolean(L,-1)) &&
- !(def && lua_isnil(L,-1))
- )
- {
- err->index = lo;
- err->array = 1;
- err->type = "boolean";
- return 0;
- }
- lua_pop(L,1);
- return 1;
-}
-
-int tolua_isnumberfield
- (lua_State* L, int lo, int i, int def, tolua_Error* err)
-{
- lua_pushnumber(L,i);
- lua_gettable(L,lo);
- if (!lua_isnumber(L,-1) &&
- !(def && lua_isnil(L,-1))
- )
- {
- err->index = lo;
- err->array = 1;
- err->type = "number";
- return 0;
- }
- lua_pop(L,1);
- return 1;
-}
-
-int tolua_isstringfield
- (lua_State* L, int lo, int i, int def, tolua_Error* err)
-{
- lua_pushnumber(L,i);
- lua_gettable(L,lo);
- if (!(lua_isnil(L,-1) || lua_isstring(L,-1)) &&
- !(def && lua_isnil(L,-1))
- )
- {
- err->index = lo;
- err->array = 1;
- err->type = "string";
- return 0;
- }
- lua_pop(L,1);
- return 1;
-}
-
-int tolua_istablefield
- (lua_State* L, int lo, int i, int def, tolua_Error* err)
-{
- lua_pushnumber(L,i+1);
- lua_gettable(L,lo);
- if (! lua_istable(L,-1) &&
- !(def && lua_isnil(L,-1))
- )
- {
- err->index = lo;
- err->array = 1;
- err->type = "table";
- return 0;
- }
- lua_pop(L,1);
-}
-
-int tolua_isusertablefield
- (lua_State* L, int lo, const char* type, int i, int def, tolua_Error* err)
-{
- lua_pushnumber(L,i);
- lua_gettable(L,lo);
- if (! lua_isusertable(L,-1,type) &&
- !(def && lua_isnil(L,-1))
- )
- {
- err->index = lo;
- err->array = 1;
- err->type = type;
- return 0;
- }
- lua_pop(L,1);
- return 1;
-}
-
-int tolua_isuserdatafield
- (lua_State* L, int lo, int i, int def, tolua_Error* err)
-{
- lua_pushnumber(L,i);
- lua_gettable(L,lo);
- if (!(lua_isnil(L,-1) || lua_isuserdata(L,-1)) &&
- !(def && lua_isnil(L,-1))
- )
- {
- err->index = lo;
- err->array = 1;
- err->type = "userdata";
- return 0;
- }
- lua_pop(L,1);
- return 1;
-}
-
-int tolua_isusertypefield
- (lua_State* L, int lo, const char* type, int i, int def, tolua_Error* err)
-{
- lua_pushnumber(L,i);
- lua_gettable(L,lo);
- if (!(lua_isnil(L,-1) || lua_isusertype(L,-1,type)) &&
- !(def && lua_isnil(L,-1))
- )
- {
- err->index = lo;
- err->type = type;
- err->array = 1;
- return 0;
- }
- lua_pop(L,1);
- return 1;
-}
-
-#endif
Deleted: code/branches/kicklib2/src/external/tolua/tolua_map.c
===================================================================
--- code/branches/kicklib2/src/external/tolua/tolua_map.c 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/external/tolua/tolua_map.c 2011-04-21 16:32:28 UTC (rev 8283)
@@ -1,704 +0,0 @@
-/* tolua: functions to map features
-** Support code for Lua bindings.
-** Written by Waldemar Celes
-** TeCGraf/PUC-Rio
-** Apr 2003
-** $Id: $
-*/
-
-/* This code is free software; you can redistribute it and/or modify it.
-** The software provided hereunder is on an "as is" basis, and
-** the author has no obligation to provide maintenance, support, updates,
-** enhancements, or modifications.
-*/
-
-#include "tolua++.h"
-#include "tolua_event.h"
-#include "lauxlib.h"
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-
-
-/* Create metatable
- * Create and register new metatable
-*/
-static int tolua_newmetatable (lua_State* L, char* name)
-{
- int r = luaL_newmetatable(L,name);
-
- #ifdef LUA_VERSION_NUM /* only lua 5.1 */
- if (r) {
- lua_pushvalue(L, -1);
- lua_pushstring(L, name);
- lua_settable(L, LUA_REGISTRYINDEX); /* reg[mt] = type_name */
- };
- #endif
-
- if (r)
- tolua_classevents(L); /* set meta events */
- lua_pop(L,1);
- return r;
-}
-
-/* Map super classes
- * It sets 'name' as being also a 'base', mapping all super classes of 'base' in 'name'
-*/
-static void mapsuper (lua_State* L, const char* name, const char* base)
-{
- /* push registry.super */
- lua_pushstring(L,"tolua_super");
- lua_rawget(L,LUA_REGISTRYINDEX); /* stack: super */
- luaL_getmetatable(L,name); /* stack: super mt */
- lua_rawget(L,-2); /* stack: super table */
- if (lua_isnil(L,-1))
- {
- /* create table */
- lua_pop(L,1);
- lua_newtable(L); /* stack: super table */
- luaL_getmetatable(L,name); /* stack: super table mt */
- lua_pushvalue(L,-2); /* stack: super table mt table */
- lua_rawset(L,-4); /* stack: super table */
- }
-
- /* set base as super class */
- lua_pushstring(L,base);
- lua_pushboolean(L,1);
- lua_rawset(L,-3); /* stack: super table */
-
- /* set all super class of base as super class of name */
- luaL_getmetatable(L,base); /* stack: super table base_mt */
- lua_rawget(L,-3); /* stack: super table base_table */
- if (lua_istable(L,-1))
- {
- /* traverse base table */
- lua_pushnil(L); /* first key */
- while (lua_next(L,-2) != 0)
- {
- /* stack: ... base_table key value */
- lua_pushvalue(L,-2); /* stack: ... base_table key value key */
- lua_insert(L,-2); /* stack: ... base_table key key value */
- lua_rawset(L,-5); /* stack: ... base_table key */
- }
- }
- lua_pop(L,3); /* stack: <empty> */
-}
-
-/* creates a 'tolua_ubox' table for base clases, and
-// expects the metatable and base metatable on the stack */
-static void set_ubox(lua_State* L) {
-
- /* mt basemt */
- if (!lua_isnil(L, -1)) {
- lua_pushstring(L, "tolua_ubox");
- lua_rawget(L,-2);
- } else {
- lua_pushnil(L);
- };
- /* mt basemt base_ubox */
- if (!lua_isnil(L,-1)) {
- lua_pushstring(L, "tolua_ubox");
- lua_insert(L, -2);
- /* mt basemt key ubox */
- lua_rawset(L,-4);
- /* (mt with ubox) basemt */
- } else {
- /* mt basemt nil */
- lua_pop(L, 1);
- lua_pushstring(L,"tolua_ubox"); lua_newtable(L);
- /* make weak value metatable for ubox table to allow userdata to be
- garbage-collected */
- lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "v"); lua_rawset(L, -3); /* stack: string ubox mt */
- lua_setmetatable(L, -2); /* stack:mt basemt string ubox */
- lua_rawset(L,-4);
- };
-
-};
-
-/* Map inheritance
- * It sets 'name' as derived from 'base' by setting 'base' as metatable of 'name'
-*/
-static void mapinheritance (lua_State* L, const char* name, const char* base)
-{
- /* set metatable inheritance */
- luaL_getmetatable(L,name);
-
- if (base && *base)
- luaL_getmetatable(L,base);
- else {
-
- if (lua_getmetatable(L, -1)) { /* already has a mt, we don't overwrite it */
- lua_pop(L, 2);
- return;
- };
- luaL_getmetatable(L,"tolua_commonclass");
- };
-
- set_ubox(L);
-
- lua_setmetatable(L,-2);
- lua_pop(L,1);
-}
-
-/* Object type
-*/
-static int tolua_bnd_type (lua_State* L)
-{
- tolua_typename(L,lua_gettop(L));
- return 1;
-}
-
-/* Take ownership
-*/
-static int tolua_bnd_takeownership (lua_State* L)
-{
- int success = 0;
- if (lua_isuserdata(L,1))
- {
- if (lua_getmetatable(L,1)) /* if metatable? */
- {
- lua_pop(L,1); /* clear metatable off stack */
- /* force garbage collection to avoid C to reuse a to-be-collected address */
- #ifdef LUA_VERSION_NUM
- lua_gc(L, LUA_GCCOLLECT, 0);
- #else
- lua_setgcthreshold(L,0);
- #endif
-
- success = tolua_register_gc(L,1);
- }
- }
- lua_pushboolean(L,success!=0);
- return 1;
-}
-
-/* Release ownership
-*/
-static int tolua_bnd_releaseownership (lua_State* L)
-{
- int done = 0;
- if (lua_isuserdata(L,1))
- {
- void* u = *((void**)lua_touserdata(L,1));
- /* force garbage collection to avoid releasing a to-be-collected address */
- #ifdef LUA_VERSION_NUM
- lua_gc(L, LUA_GCCOLLECT, 0);
- #else
- lua_setgcthreshold(L,0);
- #endif
- lua_pushstring(L,"tolua_gc");
- lua_rawget(L,LUA_REGISTRYINDEX);
- lua_pushlightuserdata(L,u);
- lua_rawget(L,-2);
- lua_getmetatable(L,1);
- if (lua_rawequal(L,-1,-2)) /* check that we are releasing the correct type */
- {
- lua_pushlightuserdata(L,u);
- lua_pushnil(L);
- lua_rawset(L,-5);
- done = 1;
- }
- }
- lua_pushboolean(L,done!=0);
- return 1;
-}
-
-/* Type casting
-*/
-static int tolua_bnd_cast (lua_State* L)
-{
-
-/* // old code
- void* v = tolua_tousertype(L,1,NULL);
- const char* s = tolua_tostring(L,2,NULL);
- if (v && s)
- tolua_pushusertype(L,v,s);
- else
- lua_pushnil(L);
- return 1;
-*/
-
- void* v;
- const char* s;
- if (lua_islightuserdata(L, 1)) {
- v = tolua_touserdata(L, 1, NULL);
- } else {
- v = tolua_tousertype(L, 1, 0);
- };
-
- s = tolua_tostring(L,2,NULL);
- if (v && s)
- tolua_pushusertype(L,v,s);
- else
- lua_pushnil(L);
- return 1;
-}
-
-/* Inheritance
-*/
-static int tolua_bnd_inherit (lua_State* L) {
-
- /* stack: lua object, c object */
- lua_pushstring(L, ".c_instance");
- lua_pushvalue(L, -2);
- lua_rawset(L, -4);
- /* l_obj[".c_instance"] = c_obj */
-
- return 0;
-};
-
-#ifdef LUA_VERSION_NUM /* lua 5.1 */
-static int tolua_bnd_setpeer(lua_State* L) {
-
- /* stack: userdata, table */
- if (!lua_isuserdata(L, -2)) {
- lua_pushstring(L, "Invalid argument #1 to setpeer: userdata expected.");
- lua_error(L);
- };
-
- if (lua_isnil(L, -1)) {
-
- lua_pop(L, 1);
- lua_pushvalue(L, TOLUA_NOPEER);
- };
- lua_setfenv(L, -2);
-
- return 0;
-};
-
-static int tolua_bnd_getpeer(lua_State* L) {
-
- /* stack: userdata */
- lua_getfenv(L, -1);
- if (lua_rawequal(L, -1, TOLUA_NOPEER)) {
- lua_pop(L, 1);
- lua_pushnil(L);
- };
- return 1;
-};
-#endif
-
-/* static int class_gc_event (lua_State* L); */
-
-TOLUA_API void tolua_open (lua_State* L)
-{
- int top = lua_gettop(L);
- lua_pushstring(L,"tolua_opened");
- lua_rawget(L,LUA_REGISTRYINDEX);
- if (!lua_isboolean(L,-1))
- {
- lua_pushstring(L,"tolua_opened"); lua_pushboolean(L,1); lua_rawset(L,LUA_REGISTRYINDEX);
-
- #ifndef LUA_VERSION_NUM /* only prior to lua 5.1 */
- /* create peer object table */
- lua_pushstring(L, "tolua_peers"); lua_newtable(L);
- /* make weak key metatable for peers indexed by userdata object */
- lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "k"); lua_rawset(L, -3); /* stack: string peers mt */
- lua_setmetatable(L, -2); /* stack: string peers */
- lua_rawset(L,LUA_REGISTRYINDEX);
- #endif
-
- /* create object ptr -> udata mapping table */
- lua_pushstring(L,"tolua_ubox"); lua_newtable(L);
- /* make weak value metatable for ubox table to allow userdata to be
- garbage-collected */
- lua_newtable(L); lua_pushliteral(L, "__mode"); lua_pushliteral(L, "v"); lua_rawset(L, -3); /* stack: string ubox mt */
- lua_setmetatable(L, -2); /* stack: string ubox */
- lua_rawset(L,LUA_REGISTRYINDEX);
-
- lua_pushstring(L,"tolua_super"); lua_newtable(L); lua_rawset(L,LUA_REGISTRYINDEX);
- lua_pushstring(L,"tolua_gc"); lua_newtable(L);lua_rawset(L,LUA_REGISTRYINDEX);
-
- /* create gc_event closure */
- lua_pushstring(L, "tolua_gc_event");
- lua_pushstring(L, "tolua_gc");
- lua_rawget(L, LUA_REGISTRYINDEX);
- lua_pushstring(L, "tolua_super");
- lua_rawget(L, LUA_REGISTRYINDEX);
- lua_pushcclosure(L, class_gc_event, 2);
- lua_rawset(L, LUA_REGISTRYINDEX);
-
- tolua_newmetatable(L,"tolua_commonclass");
-
- tolua_module(L,NULL,0);
- tolua_beginmodule(L,NULL);
- tolua_module(L,"tolua",0);
- tolua_beginmodule(L,"tolua");
- tolua_function(L,"type",tolua_bnd_type);
- tolua_function(L,"takeownership",tolua_bnd_takeownership);
- tolua_function(L,"releaseownership",tolua_bnd_releaseownership);
- tolua_function(L,"cast",tolua_bnd_cast);
- tolua_function(L,"inherit", tolua_bnd_inherit);
- #ifdef LUA_VERSION_NUM /* lua 5.1 */
- tolua_function(L, "setpeer", tolua_bnd_setpeer);
- tolua_function(L, "getpeer", tolua_bnd_getpeer);
- #endif
-
- tolua_endmodule(L);
- tolua_endmodule(L);
- }
- lua_settop(L,top);
-}
-
-/* Copy a C object
-*/
-TOLUA_API void* tolua_copy (lua_State* L, void* value, unsigned int size)
-{
- void* clone = (void*)malloc(size);
- if (clone)
- memcpy(clone,value,size);
- else
- tolua_error(L,"insuficient memory",NULL);
- return clone;
-}
-
-/* Default collect function
-*/
-TOLUA_API int tolua_default_collect (lua_State* tolua_S)
-{
- void* self = tolua_tousertype(tolua_S,1,0);
- free(self);
- return 0;
-}
-
-/* Do clone
-*/
-TOLUA_API int tolua_register_gc (lua_State* L, int lo)
-{
- int success = 1;
- void *value = *(void **)lua_touserdata(L,lo);
- lua_pushstring(L,"tolua_gc");
- lua_rawget(L,LUA_REGISTRYINDEX);
- lua_pushlightuserdata(L,value);
- lua_rawget(L,-2);
- if (!lua_isnil(L,-1)) /* make sure that object is not already owned */
- success = 0;
- else
- {
- lua_pushlightuserdata(L,value);
- lua_getmetatable(L,lo);
- lua_rawset(L,-4);
- }
- lua_pop(L,2);
- return success;
-}
-
-/* Register a usertype
- * It creates the correspoding metatable in the registry, for both 'type' and 'const type'.
- * It maps 'const type' as being also a 'type'
-*/
-TOLUA_API void tolua_usertype (lua_State* L, char* type)
-{
- char ctype[128] = "const ";
- strncat(ctype,type,120);
-
- /* create both metatables */
- if (tolua_newmetatable(L,ctype) && tolua_newmetatable(L,type))
- mapsuper(L,type,ctype); /* 'type' is also a 'const type' */
-}
-
-
-/* Begin module
- * It pushes the module (or class) table on the stack
-*/
-TOLUA_API void tolua_beginmodule (lua_State* L, char* name)
-{
- if (name)
- {
- lua_pushstring(L,name);
- lua_rawget(L,-2);
- }
- else
- lua_pushvalue(L,LUA_GLOBALSINDEX);
-}
-
-/* End module
- * It pops the module (or class) from the stack
-*/
-TOLUA_API void tolua_endmodule (lua_State* L)
-{
- lua_pop(L,1);
-}
-
-/* Map module
- * It creates a new module
-*/
-#if 1
-TOLUA_API void tolua_module (lua_State* L, char* name, int hasvar)
-{
- if (name)
- {
- /* tolua module */
- lua_pushstring(L,name);
- lua_rawget(L,-2);
- if (!lua_istable(L,-1)) /* check if module already exists */
- {
- lua_pop(L,1);
- lua_newtable(L);
- lua_pushstring(L,name);
- lua_pushvalue(L,-2);
- lua_rawset(L,-4); /* assing module into module */
- }
- }
- else
- {
- /* global table */
- lua_pushvalue(L,LUA_GLOBALSINDEX);
- }
- if (hasvar)
- {
- if (!tolua_ismodulemetatable(L)) /* check if it already has a module metatable */
- {
- /* create metatable to get/set C/C++ variable */
- lua_newtable(L);
- tolua_moduleevents(L);
- if (lua_getmetatable(L,-2))
- lua_setmetatable(L,-2); /* set old metatable as metatable of metatable */
- lua_setmetatable(L,-2);
- }
- }
- lua_pop(L,1); /* pop module */
-}
-#else
-TOLUA_API void tolua_module (lua_State* L, char* name, int hasvar)
-{
- if (name)
- {
- /* tolua module */
- lua_pushstring(L,name);
- lua_newtable(L);
- }
- else
- {
- /* global table */
- lua_pushvalue(L,LUA_GLOBALSINDEX);
- }
- if (hasvar)
- {
- /* create metatable to get/set C/C++ variable */
- lua_newtable(L);
- tolua_moduleevents(L);
- if (lua_getmetatable(L,-2))
- lua_setmetatable(L,-2); /* set old metatable as metatable of metatable */
- lua_setmetatable(L,-2);
- }
- if (name)
- lua_rawset(L,-3); /* assing module into module */
- else
- lua_pop(L,1); /* pop global table */
-}
-#endif
-
-static void push_collector(lua_State* L, const char* type, lua_CFunction col) {
-
- /* push collector function, but only if it's not NULL, or if there's no
- collector already */
- if (!col) return;
- luaL_getmetatable(L,type);
- lua_pushstring(L,".collector");
- /*
- if (!col) {
- lua_pushvalue(L, -1);
- lua_rawget(L, -3);
- if (!lua_isnil(L, -1)) {
- lua_pop(L, 3);
- return;
- };
- lua_pop(L, 1);
- };
- // */
- lua_pushcfunction(L,col);
-
- lua_rawset(L,-3);
- lua_pop(L, 1);
-};
-
-/* Map C class
- * It maps a C class, setting the appropriate inheritance and super classes.
-*/
-TOLUA_API void tolua_cclass (lua_State* L, char* lname, char* name, char* base, lua_CFunction col)
-{
- char cname[128] = "const ";
- char cbase[128] = "const ";
- strncat(cname,name,120);
- strncat(cbase,base,120);
-
- mapinheritance(L,name,base);
- mapinheritance(L,cname,name);
-
- mapsuper(L,cname,cbase);
- mapsuper(L,name,base);
-
- lua_pushstring(L,lname);
-
- push_collector(L, name, col);
- /*
- luaL_getmetatable(L,name);
- lua_pushstring(L,".collector");
- lua_pushcfunction(L,col);
-
- lua_rawset(L,-3);
- */
-
- luaL_getmetatable(L,name);
- lua_rawset(L,-3); /* assign class metatable to module */
-
- /* now we also need to store the collector table for the const
- instances of the class */
- push_collector(L, cname, col);
- /*
- luaL_getmetatable(L,cname);
- lua_pushstring(L,".collector");
- lua_pushcfunction(L,col);
- lua_rawset(L,-3);
- lua_pop(L,1);
- */
-
-
-}
-
-/* Add base
- * It adds additional base classes to a class (for multiple inheritance)
- * (not for now)
-TOLUA_API void tolua_addbase(lua_State* L, char* name, char* base) {
-
- char cname[128] = "const ";
- char cbase[128] = "const ";
- strncat(cname,name,120);
- strncat(cbase,base,120);
-
- mapsuper(L,cname,cbase);
- mapsuper(L,name,base);
-};
-*/
-
-/* Map function
- * It assigns a function into the current module (or class)
-*/
-TOLUA_API void tolua_function (lua_State* L, char* name, lua_CFunction func)
-{
- lua_pushstring(L,name);
- lua_pushcfunction(L,func);
- lua_rawset(L,-3);
-}
-
-/* sets the __call event for the class (expects the class' main table on top) */
-/* never really worked :(
-TOLUA_API void tolua_set_call_event(lua_State* L, lua_CFunction func, char* type) {
-
- lua_getmetatable(L, -1);
- //luaL_getmetatable(L, type);
- lua_pushstring(L,"__call");
- lua_pushcfunction(L,func);
- lua_rawset(L,-3);
- lua_pop(L, 1);
-};
-*/
-
-/* Map constant number
- * It assigns a constant number into the current module (or class)
-*/
-TOLUA_API void tolua_constant (lua_State* L, char* name, double value)
-{
- lua_pushstring(L,name);
- tolua_pushnumber(L,value);
- lua_rawset(L,-3);
-}
-
-
-/* Map variable
- * It assigns a variable into the current module (or class)
-*/
-TOLUA_API void tolua_variable (lua_State* L, char* name, lua_CFunction get, lua_CFunction set)
-{
- /* get func */
- lua_pushstring(L,".get");
- lua_rawget(L,-2);
- if (!lua_istable(L,-1))
- {
- /* create .get table, leaving it at the top */
- lua_pop(L,1);
- lua_newtable(L);
- lua_pushstring(L,".get");
- lua_pushvalue(L,-2);
- lua_rawset(L,-4);
- }
- lua_pushstring(L,name);
- lua_pushcfunction(L,get);
- lua_rawset(L,-3); /* store variable */
- lua_pop(L,1); /* pop .get table */
-
- /* set func */
- if (set)
- {
- lua_pushstring(L,".set");
- lua_rawget(L,-2);
- if (!lua_istable(L,-1))
- {
- /* create .set table, leaving it at the top */
- lua_pop(L,1);
- lua_newtable(L);
- lua_pushstring(L,".set");
- lua_pushvalue(L,-2);
- lua_rawset(L,-4);
- }
- lua_pushstring(L,name);
- lua_pushcfunction(L,set);
- lua_rawset(L,-3); /* store variable */
- lua_pop(L,1); /* pop .set table */
- }
-}
-
-/* Access const array
- * It reports an error when trying to write into a const array
-*/
-static int const_array (lua_State* L)
-{
- luaL_error(L,"value of const array cannot be changed");
- return 0;
-}
-
-/* Map an array
- * It assigns an array into the current module (or class)
-*/
-TOLUA_API void tolua_array (lua_State* L, char* name, lua_CFunction get, lua_CFunction set)
-{
- lua_pushstring(L,".get");
- lua_rawget(L,-2);
- if (!lua_istable(L,-1))
- {
- /* create .get table, leaving it at the top */
- lua_pop(L,1);
- lua_newtable(L);
- lua_pushstring(L,".get");
- lua_pushvalue(L,-2);
- lua_rawset(L,-4);
- }
- lua_pushstring(L,name);
-
- lua_newtable(L); /* create array metatable */
- lua_pushvalue(L,-1);
- lua_setmetatable(L,-2); /* set the own table as metatable (for modules) */
- lua_pushstring(L,"__index");
- lua_pushcfunction(L,get);
- lua_rawset(L,-3);
- lua_pushstring(L,"__newindex");
- lua_pushcfunction(L,set?set:const_array);
- lua_rawset(L,-3);
-
- lua_rawset(L,-3); /* store variable */
- lua_pop(L,1); /* pop .get table */
-}
-
-
-TOLUA_API void tolua_dobuffer(lua_State* L, char* B, unsigned int size, const char* name) {
-
- #ifdef LUA_VERSION_NUM /* lua 5.1 */
- luaL_loadbuffer(L, B, size, name) || lua_pcall(L, 0, 0, 0);
- #else
- lua_dobuffer(L, B, size, name);
- #endif
-};
-
Deleted: code/branches/kicklib2/src/external/tolua/tolua_push.c
===================================================================
--- code/branches/kicklib2/src/external/tolua/tolua_push.c 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/external/tolua/tolua_push.c 2011-04-21 16:32:28 UTC (rev 8283)
@@ -1,171 +0,0 @@
-/* tolua: functions to push C values.
-** Support code for Lua bindings.
-** Written by Waldemar Celes
-** TeCGraf/PUC-Rio
-** Apr 2003
-** $Id: $
-*/
-
-/* This code is free software; you can redistribute it and/or modify it.
-** The software provided hereunder is on an "as is" basis, and
-** the author has no obligation to provide maintenance, support, updates,
-** enhancements, or modifications.
-*/
-
-#include "tolua++.h"
-#include "lauxlib.h"
-
-#include <stdlib.h>
-
-TOLUA_API void tolua_pushvalue (lua_State* L, int lo)
-{
- lua_pushvalue(L,lo);
-}
-
-TOLUA_API void tolua_pushboolean (lua_State* L, int value)
-{
- lua_pushboolean(L,value);
-}
-
-TOLUA_API void tolua_pushnumber (lua_State* L, double value)
-{
- lua_pushnumber(L,value);
-}
-
-TOLUA_API void tolua_pushstring (lua_State* L, const char* value)
-{
- if (value == NULL)
- lua_pushnil(L);
- else
- lua_pushstring(L,value);
-}
-
-TOLUA_API void tolua_pushuserdata (lua_State* L, void* value)
-{
- if (value == NULL)
- lua_pushnil(L);
- else
- lua_pushlightuserdata(L,value);
-}
-
-TOLUA_API void tolua_pushusertype (lua_State* L, void* value, const char* type)
-{
- if (value == NULL)
- lua_pushnil(L);
- else
- {
- luaL_getmetatable(L, type);
- lua_pushstring(L,"tolua_ubox");
- lua_rawget(L,-2); /* stack: mt ubox */
- if (lua_isnil(L, -1)) {
- lua_pop(L, 1);
- lua_pushstring(L, "tolua_ubox");
- lua_rawget(L, LUA_REGISTRYINDEX);
- };
- lua_pushlightuserdata(L,value);
- lua_rawget(L,-2); /* stack: mt ubox ubox[u] */
- if (lua_isnil(L,-1))
- {
- lua_pop(L,1); /* stack: mt ubox */
- lua_pushlightuserdata(L,value);
- *(void**)lua_newuserdata(L,sizeof(void *)) = value; /* stack: mt ubox u newud */
- lua_pushvalue(L,-1); /* stack: mt ubox u newud newud */
- lua_insert(L,-4); /* stack: mt newud ubox u newud */
- lua_rawset(L,-3); /* stack: mt newud ubox */
- lua_pop(L,1); /* stack: mt newud */
- /*luaL_getmetatable(L,type);*/
- lua_pushvalue(L, -2); /* stack: mt newud mt */
- lua_setmetatable(L,-2); /* stack: mt newud */
-
- #ifdef LUA_VERSION_NUM
- lua_pushvalue(L, TOLUA_NOPEER);
- lua_setfenv(L, -2);
- #endif
- }
- else
- {
- /* check the need of updating the metatable to a more specialized class */
- lua_insert(L,-2); /* stack: mt ubox[u] ubox */
- lua_pop(L,1); /* stack: mt ubox[u] */
- lua_pushstring(L,"tolua_super");
- lua_rawget(L,LUA_REGISTRYINDEX); /* stack: mt ubox[u] super */
- lua_getmetatable(L,-2); /* stack: mt ubox[u] super mt */
- lua_rawget(L,-2); /* stack: mt ubox[u] super super[mt] */
- if (lua_istable(L,-1))
- {
- lua_pushstring(L,type); /* stack: mt ubox[u] super super[mt] type */
- lua_rawget(L,-2); /* stack: mt ubox[u] super super[mt] flag */
- if (lua_toboolean(L,-1) == 1) /* if true */
- {
- lua_pop(L,3); /* mt ubox[u]*/
- lua_remove(L, -2);
- return;
- }
- }
- /* type represents a more specilized type */
- /*luaL_getmetatable(L,type); // stack: mt ubox[u] super super[mt] flag mt */
- lua_pushvalue(L, -5); /* stack: mt ubox[u] super super[mt] flag mt */
- lua_setmetatable(L,-5); /* stack: mt ubox[u] super super[mt] flag */
- lua_pop(L,3); /* stack: mt ubox[u] */
- }
- lua_remove(L, -2); /* stack: ubox[u]*/
- }
-}
-
-TOLUA_API void tolua_pushusertype_and_takeownership (lua_State* L, void* value, const char* type)
-{
- tolua_pushusertype(L,value,type);
- tolua_register_gc(L,lua_gettop(L));
-}
-
-TOLUA_API void tolua_pushfieldvalue (lua_State* L, int lo, int index, int v)
-{
- lua_pushnumber(L,index);
- lua_pushvalue(L,v);
- lua_settable(L,lo);
-}
-
-TOLUA_API void tolua_pushfieldboolean (lua_State* L, int lo, int index, int v)
-{
- lua_pushnumber(L,index);
- lua_pushboolean(L,v);
- lua_settable(L,lo);
-}
-
-
-TOLUA_API void tolua_pushfieldnumber (lua_State* L, int lo, int index, double v)
-{
- lua_pushnumber(L,index);
- tolua_pushnumber(L,v);
- lua_settable(L,lo);
-}
-
-TOLUA_API void tolua_pushfieldstring (lua_State* L, int lo, int index, const char* v)
-{
- lua_pushnumber(L,index);
- tolua_pushstring(L,v);
- lua_settable(L,lo);
-}
-
-TOLUA_API void tolua_pushfielduserdata (lua_State* L, int lo, int index, void* v)
-{
- lua_pushnumber(L,index);
- tolua_pushuserdata(L,v);
- lua_settable(L,lo);
-}
-
-TOLUA_API void tolua_pushfieldusertype (lua_State* L, int lo, int index, void* v, const char* type)
-{
- lua_pushnumber(L,index);
- tolua_pushusertype(L,v,type);
- lua_settable(L,lo);
-}
-
-TOLUA_API void tolua_pushfieldusertype_and_takeownership (lua_State* L, int lo, int index, void* v, const char* type)
-{
- lua_pushnumber(L,index);
- tolua_pushusertype(L,v,type);
- tolua_register_gc(L,lua_gettop(L));
- lua_settable(L,lo);
-}
-
Deleted: code/branches/kicklib2/src/external/tolua/tolua_to.c
===================================================================
--- code/branches/kicklib2/src/external/tolua/tolua_to.c 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/external/tolua/tolua_to.c 2011-04-21 16:32:28 UTC (rev 8283)
@@ -1,133 +0,0 @@
-/* tolua: funcitons to convert to C types
-** Support code for Lua bindings.
-** Written by Waldemar Celes
-** TeCGraf/PUC-Rio
-** Apr 2003
-** $Id: $
-*/
-
-/* This code is free software; you can redistribute it and/or modify it.
-** The software provided hereunder is on an "as is" basis, and
-** the author has no obligation to provide maintenance, support, updates,
-** enhancements, or modifications.
-*/
-
-#include "tolua++.h"
-
-#include <string.h>
-#include <stdlib.h>
-
-TOLUA_API double tolua_tonumber (lua_State* L, int narg, double def)
-{
- return lua_gettop(L)<abs(narg) ? def : lua_tonumber(L,narg);
-}
-
-TOLUA_API const char* tolua_tostring (lua_State* L, int narg, const char* def)
-{
- return lua_gettop(L)<abs(narg) ? def : lua_tostring(L,narg);
-}
-
-TOLUA_API void* tolua_touserdata (lua_State* L, int narg, void* def)
-{
-
- /* return lua_gettop(L)<abs(narg) ? def : lua_touserdata(L,narg); */
-
- if (lua_gettop(L)<abs(narg)) {
- return def;
- };
-
- if (lua_islightuserdata(L, narg)) {
-
- return lua_touserdata(L,narg);
- };
-
- return tolua_tousertype(L, narg, def);
-}
-
-extern int push_table_instance(lua_State* L, int lo);
-
-TOLUA_API void* tolua_tousertype (lua_State* L, int narg, void* def)
-{
- if (lua_gettop(L)<abs(narg))
- return def;
- else
- {
- void* u;
- if (!lua_isuserdata(L, narg)) {
- if (!push_table_instance(L, narg)) return NULL;
- };
- u = lua_touserdata(L,narg);
- return (u==NULL) ? NULL : *((void**)u); /* nil represents NULL */
- }
-}
-
-TOLUA_API int tolua_tovalue (lua_State* L, int narg, int def)
-{
- return lua_gettop(L)<abs(narg) ? def : narg;
-}
-
-TOLUA_API int tolua_toboolean (lua_State* L, int narg, int def)
-{
- return lua_gettop(L)<abs(narg) ? def : lua_toboolean(L,narg);
-}
-
-TOLUA_API double tolua_tofieldnumber (lua_State* L, int lo, int index, double def)
-{
- double v;
- lua_pushnumber(L,index);
- lua_gettable(L,lo);
- v = lua_isnil(L,-1) ? def : lua_tonumber(L,-1);
- lua_pop(L,1);
- return v;
-}
-
-TOLUA_API const char* tolua_tofieldstring
-(lua_State* L, int lo, int index, const char* def)
-{
- const char* v;
- lua_pushnumber(L,index);
- lua_gettable(L,lo);
- v = lua_isnil(L,-1) ? def : lua_tostring(L,-1);
- lua_pop(L,1);
- return v;
-}
-
-TOLUA_API void* tolua_tofielduserdata (lua_State* L, int lo, int index, void* def)
-{
- void* v;
- lua_pushnumber(L,index);
- lua_gettable(L,lo);
- v = lua_isnil(L,-1) ? def : lua_touserdata(L,-1);
- lua_pop(L,1);
- return v;
-}
-
-TOLUA_API void* tolua_tofieldusertype (lua_State* L, int lo, int index, void* def)
-{
- void* v;
- lua_pushnumber(L,index);
- lua_gettable(L,lo);
- v = lua_isnil(L,-1) ? def : (*(void **)(lua_touserdata(L, -1))); /* lua_unboxpointer(L,-1); */
- lua_pop(L,1);
- return v;
-}
-
-TOLUA_API int tolua_tofieldvalue (lua_State* L, int lo, int index, int def)
-{
- int v;
- lua_pushnumber(L,index);
- lua_gettable(L,lo);
- v = lua_isnil(L,-1) ? def : lo;
- lua_pop(L,1);
- return v;
-}
-
-TOLUA_API int tolua_getfieldboolean (lua_State* L, int lo, int index, int def)
-{
- int v;
- lua_pushnumber(L,index);
- lua_gettable(L,lo);
- v = lua_isnil(L,-1) ? 0 : lua_toboolean(L,-1);
- lua_pop(L,1);
- return v;
-}
Modified: code/branches/kicklib2/src/libraries/core/CMakeLists.txt
===================================================================
--- code/branches/kicklib2/src/libraries/core/CMakeLists.txt 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/libraries/core/CMakeLists.txt 2011-04-21 16:32:28 UTC (rev 8283)
@@ -57,7 +57,6 @@
COMPILATION_BEGIN FilesystemCompilation.cc
command/ArgumentCompletionFunctions.cc
ConfigFileManager.cc
- MemoryArchive.cc
PathConfig.cc
COMPILATION_END
@@ -97,12 +96,12 @@
${Boost_DATE_TIME_LIBRARY} # Thread dependency
${CEGUI_LIBRARY}
${CEGUILUA_LIBRARY}
- ${LUA_LIBRARIES}
+ ${CEGUI_TOLUA_LIBRARY}
+ ${CEGUI_OGRE_RENDERER_LIBRARY}
+ ${LUA5.1_LIBRARY}
cpptcl_orxonox
- ogreceguirenderer_orxonox
ois_orxonox
tinyxml_orxonox
- tolua_orxonox
util
SOURCE_FILES
${CORE_SRC_FILES}
Modified: code/branches/kicklib2/src/libraries/core/CorePrereqs.h
===================================================================
--- code/branches/kicklib2/src/libraries/core/CorePrereqs.h 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/libraries/core/CorePrereqs.h 2011-04-21 16:32:28 UTC (rev 8283)
@@ -37,6 +37,7 @@
#include "OrxonoxConfig.h"
#include <boost/version.hpp>
+#include <CEGUIVersion.h>
//-----------------------------------------------------------------------
// Shared library settings
@@ -305,9 +306,15 @@
class Logger;
class LuaScriptModule;
+#if CEGUI_VERSION_MAJOR < 1 && CEGUI_VERSION_MINOR < 7
class OgreCEGUIRenderer;
class OgreCEGUIResourceProvider;
class OgreCEGUITexture;
+#else
+ class OgreRenderer;
+ class OgreResourceProvider;
+ class OgreImageCodec;
+#endif
}
// Lua
Modified: code/branches/kicklib2/src/libraries/core/GUIManager.cc
===================================================================
--- code/branches/kicklib2/src/libraries/core/GUIManager.cc 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/libraries/core/GUIManager.cc 2011-04-21 16:32:28 UTC (rev 8283)
@@ -29,8 +29,10 @@
#include "GUIManager.h"
+#include <memory>
#include <boost/bind.hpp>
-#include <memory>
+#include <OgreRenderQueue.h>
+#include <OgreRenderWindow.h>
#include <CEGUIDefaultLogger.h>
#include <CEGUIExceptions.h>
@@ -42,13 +44,18 @@
#include <CEGUIWindowManager.h>
#include <elements/CEGUIListbox.h>
#include <elements/CEGUIListboxItem.h>
-#include <ogreceguirenderer/OgreCEGUIRenderer.h>
-#include "SpecialConfig.h" // Configures the macro below
-#ifdef CEGUILUA_USE_INTERNAL_LIBRARY
-# include <ceguilua/CEGUILua.h>
+#ifdef ORXONOX_OLD_CEGUI
+# include <CEGUILua.h>
+# include <ogreceguirenderer/OgreCEGUIRenderer.h>
+extern "C" {
+# include <lauxlib.h>
+}
#else
-# include <CEGUILua.h>
+# include <ScriptingModules/LuaScriptModule/CEGUILua.h>
+# include <RendererModules/Ogre/CEGUIOgreImageCodec.h>
+# include <RendererModules/Ogre/CEGUIOgreRenderer.h>
+# include <RendererModules/Ogre/CEGUIOgreResourceProvider.h>
#endif
#include "util/Clock.h"
@@ -88,7 +95,7 @@
case CEGUI::Standard: orxonoxLevel = 4; break;
case CEGUI::Informative: orxonoxLevel = 5; break;
case CEGUI::Insane: orxonoxLevel = 6; break;
- default: OrxAssert(false, "CEGUI log level out of range, inpect immediately!");
+ default: OrxAssert(false, "CEGUI log level out of range, inspect immediately!");
}
OutputHandler::getOutStream(orxonoxLevel)
<< "CEGUI: " << message << std::endl;
@@ -97,6 +104,28 @@
}
};
+#ifdef ORXONOX_OLD_CEGUI
+ /** Class with the same memory layout as CEGUI::LuaScriptModule. <br>
+ We need this to fix a problem with an uninitialised member variable
+ in CEGUI < 0.7 <br>
+ Notice that "public" modifier for the otherwise private variables.
+ */
+ class CEGUILUA_API LuaScriptModuleWorkaround : public CEGUI::ScriptModule
+ {
+ public:
+ LuaScriptModuleWorkaround();
+ ~LuaScriptModuleWorkaround();
+
+ public:
+ bool d_ownsState;
+ lua_State* d_state;
+ CEGUI::String d_errFuncName;
+ int d_errFuncIndex;
+ CEGUI::String d_activeErrFuncName;
+ int d_activeErrFuncIndex;
+ };
+#endif
+
static CEGUI::MouseButton convertButton(MouseButtonCode::ByEnum button);
GUIManager* GUIManager::singletonPtr_s = 0;
@@ -117,7 +146,15 @@
@return true if success, otherwise false
*/
GUIManager::GUIManager(const std::pair<int, int>& mousePosition)
- : resourceProvider_(NULL)
+ : destroyer_(*this, &GUIManager::cleanup)
+ , guiRenderer_(NULL)
+ , luaState_(NULL)
+ , scriptModule_(NULL)
+ , guiSystem_(NULL)
+ , resourceProvider_(NULL)
+#ifndef ORXONOX_OLD_CEGUI
+ , imageCodec_(NULL)
+#endif
, camera_(NULL)
{
RegisterRootObject(GUIManager);
@@ -128,28 +165,51 @@
COUT(3) << "Initialising CEGUI." << std::endl;
// Note: No SceneManager specified yet
- guiRenderer_.reset(new OgreCEGUIRenderer(GraphicsManager::getInstance().getRenderWindow(), Ogre::RENDER_QUEUE_OVERLAY, false, 3000));
+#ifdef ORXONOX_OLD_CEGUI
+ guiRenderer_ = new OgreCEGUIRenderer(GraphicsManager::getInstance().getRenderWindow(), Ogre::RENDER_QUEUE_OVERLAY, false, 3000);
resourceProvider_ = guiRenderer_->createResourceProvider();
+#else
+ guiRenderer_ = &OgreRenderer::create(*GraphicsManager::getInstance().getRenderWindow());
+ resourceProvider_ = &OgreRenderer::createOgreResourceProvider();
+ imageCodec_ = &OgreRenderer::createOgreImageCodec();
+#endif
resourceProvider_->setDefaultResourceGroup("General");
// Setup scripting
- luaState_.reset(new LuaState());
+ luaState_ = new LuaState();
rootFileInfo_ = Resource::getInfo("InitialiseGUI.lua");
// This is necessary to ensure that input events also use the right resource info when triggering lua functions
luaState_->setDefaultResourceInfo(this->rootFileInfo_);
- scriptModule_.reset(new LuaScriptModule(luaState_->getInternalLuaState()));
+#ifdef ORXONOX_OLD_CEGUI
+ scriptModule_ = new LuaScriptModule(luaState_->getInternalLuaState());
+ // Ugly workaround: older CEGUILua versions don't initialise the member
+ // d_activeErrFuncIndex at all. That leads to "error in error handling"
+ // problems when a Lua error occurs.
+ // We fix this by setting the member manually.
+ reinterpret_cast<LuaScriptModuleWorkaround*>(scriptModule_)->d_activeErrFuncIndex = LUA_NOREF;
+ luaState_->doString("ORXONOX_OLD_CEGUI = true");
+#else
+ scriptModule_ = &LuaScriptModule::create(luaState_->getInternalLuaState());
+#endif
scriptModule_->setDefaultPCallErrorHandler(LuaState::ERROR_HANDLER_NAME);
// Create our own logger to specify the filepath
std::auto_ptr<CEGUILogger> ceguiLogger(new CEGUILogger());
ceguiLogger->setLogFilename(PathConfig::getLogPathString() + "cegui.log");
- // set the log level according to ours (translate by subtracting 1)
+ // Set the log level according to ours (translate by subtracting 1)
ceguiLogger->setLoggingLevel(
static_cast<LoggingLevel>(OutputHandler::getInstance().getSoftDebugLevel("logFile") - 1));
this->ceguiLogger_ = ceguiLogger.release();
// Create the CEGUI system singleton
- guiSystem_.reset(new System(guiRenderer_.get(), resourceProvider_, 0, scriptModule_.get()));
+#ifdef ORXONOX_OLD_CEGUI
+ guiSystem_ = new System(guiRenderer_, resourceProvider_, 0, scriptModule_);
+ // Add functions that have been renamed in newer versions
+ luaState_->doString("CEGUI.SchemeManager.create = CEGUI.SchemeManager.loadScheme");
+ luaState_->doString("CEGUI.Window.getUnclippedOuterRect = CEGUI.Window.getUnclippedPixelRect");
+#else
+ guiSystem_ = &System::create(*guiRenderer_, resourceProvider_, 0, imageCodec_, scriptModule_);
+#endif
// Align CEGUI mouse with OIS mouse
guiSystem_->injectMousePosition((float)mousePosition.first, (float)mousePosition.second);
@@ -174,12 +234,22 @@
this->luaState_->doFile("SheetManager.lua");
}
- /**
- @brief
- Basically shuts down CEGUI (member smart pointers) but first unloads our Tolua modules.
- */
- GUIManager::~GUIManager()
+ void GUIManager::cleanup()
{
+ using namespace CEGUI;
+
+#ifdef ORXONOX_OLD_CEGUI
+ delete guiSystem_;
+ delete guiRenderer_;
+ delete scriptModule_;
+#else
+ System::destroy();
+ OgreRenderer::destroyOgreResourceProvider(*resourceProvider_);
+ OgreRenderer::destroyOgreImageCodec(*imageCodec_);
+ OgreRenderer::destroy(*guiRenderer_);
+ LuaScriptModule::destroy(*scriptModule_);
+#endif
+ delete luaState_;
}
void GUIManager::setConfigValues(void)
@@ -221,10 +291,12 @@
void GUIManager::setCamera(Ogre::Camera* camera)
{
this->camera_ = camera;
+#ifdef ORXONOX_OLD_CEGUI
if (camera == NULL)
this->guiRenderer_->setTargetSceneManager(0);
else
this->guiRenderer_->setTargetSceneManager(camera->getSceneManager());
+#endif
}
/**
@@ -521,7 +593,7 @@
@param listbox
The Listbox for which to enable (or disable) tooltips.
@param enabled
- Whether to enable or disabel the tooltips.
+ Whether to enable or disable the tooltips.
*/
void GUIManager::setItemTooltipsEnabledHelper(CEGUI::Listbox* listbox, bool enabled)
{
@@ -534,6 +606,9 @@
void GUIManager::windowResized(unsigned int newWidth, unsigned int newHeight)
{
this->guiRenderer_->setDisplaySize(CEGUI::Size((float)newWidth, (float)newHeight));
+#else
+ this->guiRenderer_->setDisplaySize(CEGUI::Size((float)newWidth, (float)newHeight));
+#endif
}
/**
Modified: code/branches/kicklib2/src/libraries/core/GUIManager.h
===================================================================
--- code/branches/kicklib2/src/libraries/core/GUIManager.h 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/libraries/core/GUIManager.h 2011-04-21 16:32:28 UTC (rev 8283)
@@ -41,8 +41,9 @@
#include <set>
#include <string>
#include <CEGUIForwardRefs.h>
-#include <boost/scoped_ptr.hpp>
+#include <CEGUIVersion.h>
#include <boost/shared_ptr.hpp>
+#include <loki/ScopeGuard.h>
#include "util/OgreForwardRefs.h"
#include "util/TriBool.h"
@@ -57,6 +58,10 @@
$cfile "../util/TriBool.h" // tolua_export
*/
+#if CEGUI_VERSION_MAJOR < 1 && CEGUI_VERSION_MINOR < 7
+# define ORXONOX_OLD_CEGUI
+#endif
+
namespace orxonox // tolua_export
{ // tolua_export
class PlayerInfo; // Forward declaration
@@ -77,7 +82,8 @@
friend class Singleton<GUIManager>;
public:
GUIManager(const std::pair<int, int>& mousePosition);
- ~GUIManager();
+ //! Leave empty and use cleanup() instead
+ ~GUIManager() {}
void setConfigValues(void);
void changedGUIScheme(void);
@@ -103,7 +109,7 @@
//! Creates a new InputState to be used with a GUI Sheet
const std::string& createInputState(const std::string& name, TriBool::Value showCursor = TriBool::True, TriBool::Value useKeyboard = TriBool::True, bool bBlockJoyStick = false); // tolua_export
LuaState* getLuaState(void)
- { return this->luaState_.get(); }
+ { return this->luaState_; }
//! Returns the root window for all menu sheets
CEGUI::Window* getMenuRootWindow() { return this->menuRootWindow_; } // tolua_export
@@ -126,6 +132,10 @@
private:
GUIManager(const GUIManager& instance); //!< private and undefined copy c'tor (this is a singleton class)
+
+ /// Destructor that also executes when object fails to construct
+ void cleanup();
+
void executeCode(const std::string& str);
template <typename FunctionType>
@@ -146,12 +156,21 @@
virtual void windowResized(unsigned int newWidth, unsigned int newHeight);
virtual void windowFocusChanged(bool bFocus);
- scoped_ptr<CEGUI::OgreCEGUIRenderer> guiRenderer_; //!< CEGUI's interface to the Ogre Engine
- scoped_ptr<LuaState> luaState_; //!< LuaState, access point to the Lua engine
- scoped_ptr<CEGUI::LuaScriptModule> scriptModule_; //!< CEGUI's script module to use Lua
- scoped_ptr<CEGUI::System> guiSystem_; //!< CEGUI's main system
+ /// Surrogate for the destructor
+ Loki::ObjScopeGuardImpl0<GUIManager, void (GUIManager::*)()> destroyer_;
+
+#ifdef ORXONOX_OLD_CEGUI
+ CEGUI::OgreCEGUIRenderer* guiRenderer_; //!< CEGUI's interface to the Ogre Engine
+ CEGUI::ResourceProvider* resourceProvider_; //!< CEGUI's resource provider
+#else
+ CEGUI::OgreRenderer* guiRenderer_; //!< CEGUI's interface to the Ogre Engine
+ CEGUI::OgreResourceProvider* resourceProvider_; //!< CEGUI's resource provider
+ CEGUI::OgreImageCodec* imageCodec_;
+#endif
+ LuaState* luaState_; //!< LuaState, access point to the Lua engine
+ CEGUI::LuaScriptModule* scriptModule_; //!< CEGUI's script module to use Lua
+ CEGUI::System* guiSystem_; //!< CEGUI's main system
shared_ptr<ResourceInfo> rootFileInfo_; //!< Resource information about the root script
- CEGUI::ResourceProvider* resourceProvider_; //!< CEGUI's resource provider
CEGUI::Logger* ceguiLogger_; //!< CEGUI's logger to be able to log CEGUI errors in our log
CEGUI::Window* rootWindow_; //!< Root node for all windows
CEGUI::Window* hudRootWindow_; //!< Root node for the HUD sheets
Modified: code/branches/kicklib2/src/libraries/core/GraphicsManager.cc
===================================================================
--- code/branches/kicklib2/src/libraries/core/GraphicsManager.cc 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/libraries/core/GraphicsManager.cc 2011-04-21 16:32:28 UTC (rev 8283)
@@ -34,8 +34,6 @@
#include <boost/filesystem.hpp>
#include <boost/shared_array.hpp>
-#include <OgreArchiveFactory.h>
-#include <OgreArchiveManager.h>
#include <OgreFrameListener.h>
#include <OgreRoot.h>
#include <OgreLogManager.h>
@@ -59,7 +57,6 @@
#include "GameMode.h"
#include "GUIManager.h"
#include "Loader.h"
-#include "MemoryArchive.h"
#include "PathConfig.h"
#include "ViewportEventListener.h"
#include "WindowEventListener.h"
@@ -101,9 +98,6 @@
*/
GraphicsManager::GraphicsManager(bool bLoadRenderer)
: ogreWindowEventListener_(new OgreWindowEventListener())
-#if OGRE_VERSION < 0x010600
- , memoryArchiveFactory_(new MemoryArchiveFactory())
-#endif
, renderWindow_(0)
, viewport_(0)
, lastFrameStartTime_(0.0f)
@@ -195,54 +189,6 @@
this->loadRenderer();
-#if OGRE_VERSION < 0x010600
- // WORKAROUND: There is an incompatibility for particle scripts when trying
- // to support both Ogre 1.4 and 1.6. The hacky solution is to create
- // scripts for the 1.6 version and then remove the inserted "particle_system"
- // keyword. But we need to supply these new scripts as well, which is why
- // there is an extra Ogre::Archive dealing with it in the memory.
- using namespace Ogre;
- ArchiveManager::getSingleton().addArchiveFactory(memoryArchiveFactory_.get());
- const StringVector& groups = ResourceGroupManager::getSingleton().getResourceGroups();
- // Travers all groups
- for (StringVector::const_iterator itGroup = groups.begin(); itGroup != groups.end(); ++itGroup)
- {
- FileInfoListPtr files = ResourceGroupManager::getSingleton().findResourceFileInfo(*itGroup, "*.particle");
- for (FileInfoList::const_iterator itFile = files->begin(); itFile != files->end(); ++itFile)
- {
- // open file
- Ogre::DataStreamPtr input = ResourceGroupManager::getSingleton().openResource(itFile->filename, *itGroup, false);
- std::stringstream output;
- // Parse file and replace "particle_system" with nothing
- while (!input->eof())
- {
- std::string line = input->getLine();
- size_t pos = line.find("particle_system");
- if (pos != std::string::npos)
- {
- // 15 is the length of "particle_system"
- line.replace(pos, 15, "");
- }
- output << line << std::endl;
- }
- // Add file to the memory archive
- shared_array<char> data(new char[output.str().size()]);
- // Debug optimisations
- const std::string& outputStr = output.str();
- char* rawData = data.get();
- for (unsigned i = 0; i < outputStr.size(); ++i)
- rawData[i] = outputStr[i];
- MemoryArchive::addFile("particle_scripts_ogre_1.4_" + *itGroup, itFile->filename, data, output.str().size());
- }
- if (!files->empty())
- {
- // Declare the files, but using a new group
- ResourceGroupManager::getSingleton().addResourceLocation("particle_scripts_ogre_1.4_" + *itGroup,
- "Memory", "particle_scripts_ogre_1.4_" + *itGroup);
- }
- }
-#endif
-
// Initialise all resources (do this AFTER the renderer has been loaded!)
// Note: You can only do this once! Ogre will check whether a resource group has
// already been initialised. If you need to load resources later, you will have to
Modified: code/branches/kicklib2/src/libraries/core/GraphicsManager.h
===================================================================
--- code/branches/kicklib2/src/libraries/core/GraphicsManager.h 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/libraries/core/GraphicsManager.h 2011-04-21 16:32:28 UTC (rev 8283)
@@ -113,9 +113,6 @@
std::string setVSync(bool vsync);
scoped_ptr<OgreWindowEventListener> ogreWindowEventListener_; //!< Pimpl to hide OgreWindowUtilities.h
-#if OGRE_VERSION < 0x010600
- scoped_ptr<MemoryArchiveFactory> memoryArchiveFactory_; //!< Stores the modified particle scripts
-#endif
scoped_ptr<Ogre::LogManager> ogreLogger_;
scoped_ptr<Ogre::Root> ogreRoot_; //!< Ogre's root
Ogre::RenderWindow* renderWindow_; //!< the one and only render window
Modified: code/branches/kicklib2/src/libraries/core/LuaState.cc
===================================================================
--- code/branches/kicklib2/src/libraries/core/LuaState.cc 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/libraries/core/LuaState.cc 2011-04-21 16:32:28 UTC (rev 8283)
@@ -29,7 +29,7 @@
#include "LuaState.h"
-#include <tolua/tolua++.h>
+#include <tolua++.h>
extern "C" {
#include <lua.h>
#include <lualib.h>
@@ -59,16 +59,7 @@
// Create new lua state and configure it
luaState_ = lua_open();
Loki::ScopeGuard luaStateGuard = Loki::MakeGuard(&lua_close, luaState_);
-#if LUA_VERSION_NUM == 501
luaL_openlibs(luaState_);
-#else
- luaopen_base(luaState_);
- luaopen_string(luaState_);
- luaopen_table(luaState_);
- luaopen_math(luaState_);
- luaopen_io(luaState_);
- luaopen_debug(luaState_);
-#endif
// Open all available tolua interfaces
this->openToluaInterfaces(luaState_);
@@ -186,14 +177,7 @@
errorHandler = 0;
}
-#if LUA_VERSION_NUM != 501
- LoadS ls;
- ls.s = code.c_str();
- ls.size = code.size();
- int error = lua_load(luaState_, &orxonox::LuaState::lua_Chunkreader, &ls, chunkname.c_str());
-#else
int error = luaL_loadbuffer(luaState_, code.c_str(), code.size(), chunkname.c_str());
-#endif
switch (error)
{
@@ -292,18 +276,6 @@
return IOConsole::exists();
}
-#if LUA_VERSION_NUM != 501
- const char * LuaState::lua_Chunkreader(lua_State *L, void *data, size_t *size)
- {
- LoadS* ls = static_cast<LoadS*>(data);
- if (ls->size == 0)
- return NULL;
- *size = ls->size;
- ls->size = 0;
- return ls->s;
- }
-#endif
-
/*static*/ bool LuaState::addToluaInterface(int (*function)(lua_State*), const std::string& name)
{
for (ToluaInterfaceMap::const_iterator it = toluaInterfaces_s.begin(); it != toluaInterfaces_s.end(); ++it)
Modified: code/branches/kicklib2/src/libraries/core/LuaState.h
===================================================================
--- code/branches/kicklib2/src/libraries/core/LuaState.h 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/libraries/core/LuaState.h 2011-04-21 16:32:28 UTC (rev 8283)
@@ -112,16 +112,6 @@
private:
shared_ptr<ResourceInfo> getFileInfo(const std::string& filename);
-#if LUA_VERSION_NUM != 501
- struct LoadS
- {
- const char* s;
- size_t size;
- };
-
- static const char * lua_Chunkreader(lua_State *L, void *data, size_t *size);
-#endif
-
std::stringstream output_;
lua_State* luaState_;
bool bIsRunning_;
Deleted: code/branches/kicklib2/src/libraries/core/MemoryArchive.cc
===================================================================
--- code/branches/kicklib2/src/libraries/core/MemoryArchive.cc 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/libraries/core/MemoryArchive.cc 2011-04-21 16:32:28 UTC (rev 8283)
@@ -1,141 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-#include "MemoryArchive.h"
-
-#if OGRE_VERSION < 0x010600
-
-#include <OgreException.h>
-#include <boost/filesystem.hpp>
-#include <boost/version.hpp>
-
-// Boost 1.36 has some issues with deprecated functions that have been omitted
-#if (BOOST_VERSION == 103600)
-# define BOOST_HAS_BRANCH_PATH_FUNCTION has_parent_path
-#else
-# define BOOST_HAS_BRANCH_PATH_FUNCTION has_branch_path
-#endif
-
-namespace orxonox
-{
- using namespace Ogre;
-
- MemoryArchive::ArchiveMap MemoryArchive::archives_s;
-
- void MemoryArchive::load()
- {
- if (archives_s.find(this->getName()) == archives_s.end())
- OGRE_EXCEPT(Ogre::Exception::ERR_INTERNAL_ERROR, this->getName() + " - MemoryArchive not found.", "MemoryArchive");
- }
-
- DataStreamPtr MemoryArchive::open(const Ogre::String& filename) const
- {
- const FileMap& files = archives_s[this->getName()];
- FileMap::const_iterator itFile = files.find(filename);
- if (itFile == files.end())
- return DataStreamPtr();
- else
- return MemoryDataStreamPtr(new MemoryDataStream(itFile->second.first.get(), itFile->second.second));
- }
-
- void MemoryArchive::findFiles(const Ogre::String& pattern, bool bRecursive,
- bool bDirs, Ogre::StringVector* simpleList, Ogre::FileInfoList* detailList)
- {
- const FileMap& files = archives_s[this->getName()];
-
- for (FileMap::const_iterator it = files.begin(); it != files.end(); ++it)
- {
- boost::filesystem::path file = it->first;
- // Check pattern
- if (!StringUtil::match(file.string(), pattern, true))
- continue;
- if (bDirs)
- file = file.branch_path();
- if (file.empty())
- continue;
- if (file.BOOST_HAS_BRANCH_PATH_FUNCTION() && !bRecursive)
- continue;
- if (simpleList)
- simpleList->push_back(file.string());
- if (detailList)
- {
- FileInfo fi;
- fi.archive = this;
- fi.filename = file.string();
- fi.basename = file.leaf();
- fi.path = file.branch_path().string();
- fi.compressedSize = it->second.second;
- fi.uncompressedSize = it->second.second;
- detailList->push_back(fi);
- }
- }
- }
- StringVectorPtr MemoryArchive::list(bool recursive, bool dirs)
- {
- StringVectorPtr ret(new StringVector());
- findFiles("*", recursive, dirs, ret.getPointer(), 0);
- return ret;
- }
-
- FileInfoListPtr MemoryArchive::listFileInfo(bool recursive, bool dirs)
- {
- FileInfoListPtr ret(new FileInfoList());
- findFiles("*", recursive, dirs, 0, ret.getPointer());
- return ret;
- }
-
- StringVectorPtr MemoryArchive::find(const Ogre::String& pattern,
- bool recursive, bool dirs)
- {
- StringVectorPtr ret(new StringVector());
- findFiles(pattern, recursive, dirs, ret.getPointer(), 0);
- return ret;
- }
-
- FileInfoListPtr MemoryArchive::findFileInfo(const Ogre::String& pattern,
- bool recursive, bool dirs)
- {
- FileInfoListPtr ret(new FileInfoList());
- findFiles(pattern, recursive, dirs, 0, ret.getPointer());
- return ret;
- }
-
- bool MemoryArchive::exists(const Ogre::String& filename)
- {
- const FileMap& files = archives_s[this->getName()];
- return files.find(filename) != files.end();
- }
-
- const Ogre::String& MemoryArchiveFactory::getType(void) const
- {
- static std::string result("Memory");
- return result;
- }
-}
-
-#endif /* OGRE_VERSION < 0x010600 */
Deleted: code/branches/kicklib2/src/libraries/core/MemoryArchive.h
===================================================================
--- code/branches/kicklib2/src/libraries/core/MemoryArchive.h 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/libraries/core/MemoryArchive.h 2011-04-21 16:32:28 UTC (rev 8283)
@@ -1,106 +0,0 @@
-/*
- * ORXONOX - the hottest 3D action shooter ever to exist
- * > www.orxonox.net <
- *
- *
- * License notice:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * Author:
- * Reto Grieder
- * Co-authors:
- * ...
- *
- */
-
-/**
- @file
- @ingroup Management Resources
-*/
-
-#ifndef _MemoryArchive_H__
-#define _MemoryArchive_H__
-
-#include "CorePrereqs.h"
-#include <OgrePrerequisites.h>
-
-#if OGRE_VERSION < 0x010600
-
-#include <map>
-#include <OgreArchive.h>
-#include <OgreArchiveFactory.h>
-#include <boost/shared_array.hpp>
-
-namespace orxonox
-{
- /**
- @brief
- Provides a simple mechanism of 'memory mapped IO', but compatible for Ogre 1.4
-
- Files are stored as shared_array<char> in a static map with the archive names
- (imaging the different archives as resource locations). This map then contains
- yet another map with the actual files.
- If you want to know why we make such a fuss, contact GraphicsManager::upgradeToGraphics()
- for more information.
- */
- class MemoryArchive : public Ogre::Archive
- {
- public:
- MemoryArchive(const Ogre::String& name, const Ogre::String& archiveType) : Ogre::Archive(name, archiveType) { }
- ~MemoryArchive() { }
-
- bool isCaseSensitive(void) const { return true; }
-
- void load();
- void unload() { }
-
- Ogre::DataStreamPtr open(const Ogre::String& filename) const;
-
- Ogre::StringVectorPtr list(bool recursive = true, bool dirs = false);
- Ogre::FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false);
-
- Ogre::StringVectorPtr find(const Ogre::String& pattern, bool recursive = true,
- bool dirs = false);
- Ogre::FileInfoListPtr findFileInfo(const Ogre::String& pattern, bool recursive = true,
- bool dirs = false);
-
- bool exists(const Ogre::String& filename);
-
- static void addFile(const std::string& archiveName, const std::string& filename, shared_array<char> content, size_t size)
- { archives_s[archiveName][filename] = std::make_pair(content, size); }
-
- private:
- void findFiles(const Ogre::String& pattern, bool bRecursive,
- bool bDirs, Ogre::StringVector* simpleList, Ogre::FileInfoList* detailList);
-
- typedef std::map<std::string, std::pair<shared_array<char>, size_t> > FileMap;
- typedef std::map<std::string, FileMap> ArchiveMap;
- static ArchiveMap archives_s;
- };
-
- //! Specialisation of ArchiveFactory for MemoryArchive.
- class _CoreExport MemoryArchiveFactory : public Ogre::ArchiveFactory
- {
- public:
- const Ogre::String& getType(void) const;
- Ogre::Archive* createInstance(const Ogre::String& name) { return new MemoryArchive(name, "Memory"); }
- void destroyInstance(Ogre::Archive* arch) { delete arch; }
- };
-}
-
-#endif /* OGRE_VERSION < 0x010600 */
-
-#endif /* _MemoryArchive_H__ */
Modified: code/branches/kicklib2/src/libraries/core/input/KeyBinder.cc
===================================================================
--- code/branches/kicklib2/src/libraries/core/input/KeyBinder.cc 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/libraries/core/input/KeyBinder.cc 2011-04-21 16:32:28 UTC (rev 8283)
@@ -395,7 +395,7 @@
Button* button = it->second;
// iterate over all modes
- for (size_t mode_index = 0; mode_index < 3; ++mode_index)
+ for (int mode_index = 0; mode_index < 3; ++mode_index)
{
if (mode_index == (unsigned int)new_mode) // skip commands that are already in the desired mode
continue;
Modified: code/branches/kicklib2/src/libraries/tools/Mesh.cc
===================================================================
--- code/branches/kicklib2/src/libraries/tools/Mesh.cc 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/libraries/tools/Mesh.cc 2011-04-21 16:32:28 UTC (rev 8283)
@@ -68,17 +68,6 @@
{
this->entity_ = this->scenemanager_->createEntity("Mesh" + multi_cast<std::string>(Mesh::meshCounter_s++), meshsource);
this->entity_->setCastShadows(this->bCastShadows_);
-
-#if OGRE_VERSION < 0x010600
- this->entity_->setNormaliseNormals(true);
- /*
- Excerpt from Ogre forum:
- "Note that the above is only for the fixed function pipeline.
- If/when you get into shaders, you'll need to manually normalize() the normal inside the vertex or pixel shader."
-
- I don't know exactly what this means, but I put this here if there will be problems with shaders.
- */
-#endif
}
catch (...)
{
Modified: code/branches/kicklib2/src/libraries/util/Exception.cc
===================================================================
--- code/branches/kicklib2/src/libraries/util/Exception.cc 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/libraries/util/Exception.cc 2011-04-21 16:32:28 UTC (rev 8283)
@@ -94,19 +94,15 @@
// rethrow
throw;
}
- catch (const std::exception& ex)
- {
- return ex.what();
- }
catch (const CEGUI::Exception& ex)
{
-#if CEGUI_VERSION_MAJOR == 0 && CEGUI_VERSION_MINOR < 6
- return GeneralException(ex.getMessage().c_str()).getDescription();
-#else
return GeneralException(ex.getMessage().c_str(), ex.getLine(),
ex.getFileName().c_str(), ex.getName().c_str()).getDescription();
-#endif
}
+ catch (const std::exception& ex)
+ {
+ return ex.what();
+ }
catch (...)
{
COUT(0) << "BIG WARNING: Unknown exception type encountered."
Modified: code/branches/kicklib2/src/modules/pickup/PickupCollection.h
===================================================================
--- code/branches/kicklib2/src/modules/pickup/PickupCollection.h 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/modules/pickup/PickupCollection.h 2011-04-21 16:32:28 UTC (rev 8283)
@@ -117,4 +117,4 @@
}
-#endif /* _PickupCollection_H__ */
\ No newline at end of file
+#endif /* _PickupCollection_H__ */
Modified: code/branches/kicklib2/src/orxonox/CMakeLists.txt
===================================================================
--- code/branches/kicklib2/src/orxonox/CMakeLists.txt 2011-04-21 16:01:01 UTC (rev 8282)
+++ code/branches/kicklib2/src/orxonox/CMakeLists.txt 2011-04-21 16:32:28 UTC (rev 8283)
@@ -77,8 +77,8 @@
${VORBISFILE_LIBRARY}
${VORBIS_LIBRARY}
${OGG_LIBRARY}
+ ${CEGUI_TOLUA_LIBRARY}
tinyxml_orxonox
- tolua_orxonox
bullet_orxonox
util
core
More information about the Orxonox-commit
mailing list