Index: /code/branches/buildsystem3/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/CMakeLists.txt	(revision 2664)
@@ -1,131 +1,54 @@
-PROJECT(Orxonox)
+ #
+ #             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.
+ #
+ 
+PROJECT(Orxonox C CXX)
 
-cmake_minimum_required(VERSION 2.4)
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
 
-IF (COMMAND cmake_policy)
-  cmake_policy(SET CMP0003 NEW)
-ENDIF (COMMAND cmake_policy)
+SET(ORXONOX_VERSION_MAJOR 0)
+SET(ORXONOX_VERSION_MINOR 0)
+SET(ORXONOX_VERSION_PATCH 3)
+SET(ORXONOX_VERSION 0.0.3)
+SET(ORXONOX_VERSION_NAME "Castor")
 
-# Allow for simple IF constructs (makes code a lot more readable)
-#SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true)
+# Keep devs from using the root directory as binary directory (messes up the source tree)
+IF(${CMAKE_CURRENT_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_BINARY_DIR})
+  MESSAGE(FATAL_ERROR "Do not use the root directory as CMake output directory! mkdir build; cd build; cmake ..")
+ENDIF()
 
 # This sets where to look for modules (e.g. "Find*.cmake" files)
-SET(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
 
-# Check whether we are on a tardis box
-INCLUDE(CheckTardis)
+# Library Config
+INCLUDE(LibraryConfig)
 
+# Build Config
+INCLUDE(BuildConfig)
 
-############## Testing options ##################
+# Configure media directory location and installation
+ADD_SUBDIRECTORY(media)
 
-OPTION(TESTING_ENABLED "Do you want to enable Testing")
-IF (TESTING_ENABLED)
-  ENABLE_TESTING()
-ENDIF(TESTING_ENABLED)
-
-OPTION (NETWORK_TESTING_ENABLED "Do you want to build network testing tools: i.e. chatclient chatserver and alike")
-OPTION (NETWORKTRAFFIC_TESTING_ENABLED "Do you want to build dummyserver4 and dummyclient4")
-
-
-########## Compiler/Linker options ##############
-
-# if on tardis change compiler and reset boost include directory
-IF(IS_TARDIS)
-  MESSAGE("System is a TARDIS: Setting Compiler to g++-4.1.1")
-  # Force-set the compiler on tardis machines, as default points to g++-3.3
-  SET(CMAKE_CXX_COMPILER "g++-4.1.1")
-  # Reset Boost serach path
-  SET(Boost_INCLUDE_DIR "/usr/pack/boost-1.34.1-sd/i686-debian-linux3.1/include")
-ELSE (IS_TARDIS)
-  IF (NOT WIN32)
-    SET(Boost_INCLUDE_DIR "/usr/include/boost")
-  ENDIF (NOT WIN32)
-ENDIF(IS_TARDIS)
-
-# Set binary output directories
-SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
-SET(LIBRARY_OUTPUT_PATH    ${PROJECT_SOURCE_DIR}/bin/lib)
-
-# Global compiler/linker flags. force -O2!
-SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -O0 -Wall -g -ggdb")
-SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -O0 -Wall -g -ggdb")
-#SET(CMAKE_C_FLAGS "$ENV{CFLAGS} -O3 -s")
-#SET(CMAKE_CXX_FLAGS "$ENV{CXXFLAGS} -O3 -s")
-
-SET(CMAKE_LD_FLAGS "$ENV{LDFLAGS}")
-SET(CMAKE_EXE_LINKER_FLAGS " --no-undefined")
-SET(CMAKE_SHARED_LINKER_FLAGS " --no-undefined")
-SET(CMAKE_MODULE_LINKER_FLAGS " --no-undefined")
-
-# Use 'cmake -D make_verb:1 path' to get verbose make output when compiling
-IF (MAKE_VERB)
- SET(CMAKE_VERBOSE_MAKEFILE TRUE)
-ENDIF (MAKE_VERB)
-
-
-############### Library finding #################
-
-# Uncomment the following line if you want the include and library paths to be shown
-# Alternatively use the "-D VERBOSE_FIND:BOOL=true" option when executing cmake
-
-# SET (VERBOSE_FIND true)
-
-# Set the library directory when using precompiled tarballs for the dependencies under windows
-IF (WIN32)
-  IF (MSVC)
-    IF ($ENV{ORXONOX_DEV})
-      SET (DEPENDENCY_DIR ${CMAKE_SOURCE_DIR}/../lib_dist/dependencies/)
-    ELSE ($ENV{ORXONOX_DEV})
-      SET (DEPENDENCY_DIR ${CMAKE_SOURCE_DIR}/dependencies/)
-    ENDIF ($ENV{ORXONOX_DEV})
-    SET(Boost_LIB_SUFFIX_DEBUG vc80-mt-gd-1_35)
-  ENDIF (MSVC)
-ENDIF (WIN32)
-MESSAGE(STATUS ${DEPENDENCY_DIR})
-
-# Performs the search and sets the variables
-FIND_PACKAGE(OGRE)
-FIND_PACKAGE(CEGUI)
-# FIND_PACKAGE(CEGUI_OGRE)
-FIND_PACKAGE(ENet)
-FIND_PACKAGE(Boost REQUIRED thread filesystem)
-FIND_PACKAGE(OpenAL)
-FIND_PACKAGE(ALUT)
-FIND_PACKAGE(OggVorbis)
-FIND_PACKAGE(ZLIB)
-#FIND_PACKAGE(Lua)
-FIND_PACKAGE(TCL)
-FIND_PACKAGE(DirectX)
-
-# Set the search paths for the linking
-LINK_DIRECTORIES(
-  ${OGRE_LIB_DIR}
-  ${CEGUI_LIB_DIR}
-#  ${CEGUI_SCRIPT_LIB_DIR}
-#  ${CEGUI_OGRE_LIB_DIR}
-  ${ENet_LIBRARY}
-  ${Boost_LIBRARY_DIRS}
-  ${Zlib_LIBRARY_DIR}
-  ${TCL_LIBRARY}
-)
-
-# Set the search paths for include files
-INCLUDE_DIRECTORIES(
-  ${OGRE_INCLUDE_DIR}
-  ${CEGUI_INCLUDE_DIR}
-#  ${CEGUI_OGRE_INCLUDE_DIR}
-  ${ENet_INCLUDE_DIR}
-  ${Boost_INCLUDE_DIRS}
-  ${OPENAL_INCLUDE_DIR}
-  ${ALUT_INCLUDE_DIR}
-  ${VORBIS_INCLUDE_DIR}
-  ${OGG_INCLUDE_DIR}
-#  ${Lua_INCLUDE_DIR}
-  ${TCL_INCLUDE_PATH}
-  ${DirectX_INCLUDE_DIR}
-  ${ZLIB_INCLUDE_DIR}
-)
-
-# Add main source dir
+# Creates the actual project
 ADD_SUBDIRECTORY(src)
 
+# Configure the binary output directory
+ADD_SUBDIRECTORY(bin)
+
+# Last but not least: Try to make doxygen target
+ADD_SUBDIRECTORY(doc)
Index: /code/branches/buildsystem3/INSTALL
===================================================================
--- /code/branches/buildsystem3/INSTALL	(revision 2663)
+++ /code/branches/buildsystem3/INSTALL	(revision 2664)
@@ -1,17 +1,26 @@
-Here our installing directions
+************* Build System **************
+To make platform support as easy as possible we have decided to use CMake as our build system.
+Therefore the first thing you need to do is to get
+CMake v.2.6 or later.
 
-requirements:
-ogre-1.4.5
-ois-1.0
-cegui-0.5.0b
-enet-1.1
-boost-1.34.1
-cmake-2.4.7
-openal-0.0.8
-freealut-1.1.0
-libvorbis-1.2.0
-(all named version were tested. lower version requirement may be possible)
+************** Libraries ****************
 
-It is assumed, that you have a working graphical environment (i.e X11), including some sort of 3d acceleration (OpenGL, Direct3D)
+In order to compile Orxonox you will need the following libraries:
+(for windows there are already precompiled packages on the website)
 
-Further information about installing and running this application can be found on http://www.orxonox.net/wiki/Running
+OGRE 3D Graphics Engine          1.4 (1.6 not yet supported)
+CEGUI (Crazy Eddie's GUI System) 0.5
+Boost libraries                  1.34
+ENet (Network library)           1.1
+Lua (scripting language)         5.0 or 5.1
+Tcl (shell script language)      8.4 or 8.5
+OpenAL (audio)                   (no version requirements specified yet)
+ALUT (audio)                     (no version requirements specified yet)
+LibOgg                           (no version requirements specified yet)
+LibVorbis                        (no version requirements specified yet)
+ZLib (compression)               (no version requirements specified yet)
+
+OGRE supports both OpenGL and DirectX9 rendering. You will also need OGRE for the dedicated server!
+
+Further information about installing and running this application can be found on
+http://www.orxonox.net/wiki/Running
Index: /code/branches/buildsystem3/bin/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/bin/CMakeLists.txt	(revision 2664)
+++ /code/branches/buildsystem3/bin/CMakeLists.txt	(revision 2664)
@@ -0,0 +1,129 @@
+ #
+ #             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:
+ #    Configures the binary output directory with files required for Orxonox
+ #    to run like orxonox.ini or the default keybindings.
+ #    Also creates a run-script in the root directory of the build tree.
+ #
+ 
+SET(READ_ONLY_CONFIG_FILES
+  def_keybindings.ini
+  def_masterKeybindings.ini
+  disco.txt
+  irc.tcl
+  remote.tcl
+  telnet_server.tcl
+)
+
+SET(WRITABLE_CONFIG_FILES
+)
+
+# Not getting installed
+SET(ORXONOX_INI orxonox.ini)
+
+IF(TARDIS)
+  # OGRE can't find fonts to display config screen on Tardis,
+  # so providing default config file here (bug).
+  LIST(APPEND WRITABLE_CONFIG_FILES ogre.cfg)
+ENDIF(TARDIS)
+
+# We need the same code for both READ_ONLY and WRITABLE config files
+MACRO(CONFIGURE_FILES _file_name _build_configs _read_only_arg)
+  SET(_read_only ${_read_only_arg})
+  FOREACH(_build_config ${_build_configs})
+    # Is there an extra file in bin/Debug or bin/Release?
+    IF(${_build_config} MATCHES "Rel")
+      SET(_build_config_short "Release")
+    ELSE()
+      SET(_build_config_short "Debug")
+    ENDIF()
+    IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/${_build_config_short}/${_file_name})
+      SET(_in_file ${CMAKE_CURRENT_SOURCE_DIR}/${_build_config_short}/${_file_name})
+    ELSE()
+      SET(_in_file ${CMAKE_CURRENT_SOURCE_DIR}/${_file_name})
+    ENDIF()
+
+    # Copy to the folder named like the build config for Visual Studio
+    IF(CMAKE_CONFIGURATION_TYPES)
+      SET(_out_file ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${_build_config}/${_file_name})
+    ELSE()
+      SET(_out_file ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${_file_name})
+    ENDIF()
+    # Only copy if target file doesn't exist. This may result in problems but
+    # otherwise we might delete a user's config
+    IF(NOT EXISTS ${_out_file} OR _read_only)
+      CONFIGURE_FILE(${_in_file} ${_out_file} @ONLY)
+    ENDIF()
+  ENDFOREACH(_build_config)
+ENDMACRO(CONFIGURE_FILES)
+
+# Copy config files to all Visual Studio output directories
+IF(CMAKE_CONFIGURATION_TYPES)
+  SET(BUILD_CONFIGS ${CMAKE_CONFIGURATION_TYPES})
+ELSE()
+  SET(CONFIG_OUT_PATHS_REL ".")
+  SET(BUILD_CONFIGS ${CMAKE_BUILD_TYPE})
+ENDIF()
+
+FOREACH(_file_name ${READ_ONLY_CONFIG_FILES})
+  CONFIGURE_FILES("${_file_name}" "${BUILD_CONFIGS}" TRUE)
+ENDFOREACH(_file_name)
+FOREACH(_file_name ${WRITABLE_CONFIG_FILES} ${ORXONOX_INI})
+  CONFIGURE_FILES("${_file_name}" "${BUILD_CONFIGS}" FALSE)
+ENDFOREACH(_file_name)
+
+
+################ Installation #################
+
+# Not using collective call to allow configuration with CMake.
+FOREACH(_file ${READ_ONLY_CONFIG_FILES} ${WRITABLE_CONFIG_FILES})
+  IF(CMAKE_CONFIGURATION_TYPES)
+    FOREACH(_configuration ${CMAKE_CONFIGURATION_TYPES})
+      INSTALL(
+        FILES ${CMAKE_BINARY_DIR}/bin/${_configuration}/${_file}
+        DESTINATION ${ORXONOX_RUNTIME_INSTALL_PATH}
+        CONFIGURATIONS ${_configuration}
+      )
+    ENDFOREACH(_configuration)
+  ELSE()
+    INSTALL(FILES ${CMAKE_BINARY_DIR}/bin/${_file} DESTINATION ${ORXONOX_RUNTIME_INSTALL_PATH})
+  ENDIF()
+ENDFOREACH(_file)
+
+
+################ Run Scripts ##################
+
+# Create a run script for both Windows and Linux in the source root path if
+# CMake is not used to create multi-configuration project files
+IF(NOT CMAKE_CONFIGURATION_TYPES)
+  IF(WIN32)
+    SET(RUN_SCRIPT run.bat)
+    # Note: Do not use FILE(TO_NATIVE_PATH) because it doesn't work for MinGW
+    STRING(REGEX REPLACE "^([A-Z]\\:)\\/.*$" "\\1" WINDOWS_DRIVE_CHANGE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
+    STRING(REPLACE "/" "\\" CMAKE_RUNTIME_OUTPUT_DIRECTORY_WINDOWS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
+    STRING(REPLACE "/" "\\" ORXONOX_RUNTIME_LIBRARY_DIRECTORY_WINDOWS ${ORXONOX_RUNTIME_LIBRARY_DIRECTORY})
+  ELSE(UNIX)
+    SET(RUN_SCRIPT run)
+  ENDIF(WIN32)
+  CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${RUN_SCRIPT} ${CMAKE_SOURCE_DIR}/${RUN_SCRIPT} @ONLY)
+  CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/${RUN_SCRIPT} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${RUN_SCRIPT} @ONLY)
+ENDIF(NOT CMAKE_CONFIGURATION_TYPES)
Index: /code/branches/buildsystem3/bin/Debug/orxonox.ini
===================================================================
--- /code/branches/buildsystem3/bin/Debug/orxonox.ini	(revision 2664)
+++ /code/branches/buildsystem3/bin/Debug/orxonox.ini	(revision 2664)
@@ -0,0 +1,11 @@
+[Settings]
+dataPath_ = @ORXONOX_MEDIA_DIRECTORY@
+
+[GSGraphics]
+ogrePluginsFolder_ = @OGRE_PLUGINS_FOLDER_DEBUG@
+ogrePlugins_ = @OGRE_PLUGINS_DEBUG@
+
+[Core]
+softDebugLevelConsole_=3
+softDebugLevelLogfile_=4
+softDebugLevelShell_=2
Index: de/branches/buildsystem3/bin/Plugins.cfg
===================================================================
--- /code/branches/buildsystem3/bin/Plugins.cfg	(revision 2663)
+++ 	(revision )
@@ -1,13 +1,0 @@
-# Defines plugins to load
-
-# Define plugin folder
-PluginFolder=..\..\libs\ogre\Samples\Common\bin\Release
-
-# Define plugins
-Plugin=RenderSystem_Direct3D9
-Plugin=RenderSystem_GL
-Plugin=Plugin_ParticleFX
-Plugin=Plugin_BSPSceneManager
-Plugin=Plugin_OctreeSceneManager
-Plugin=Plugin_CgProgramManager
-
Index: /code/branches/buildsystem3/bin/Release/orxonox.ini
===================================================================
--- /code/branches/buildsystem3/bin/Release/orxonox.ini	(revision 2664)
+++ /code/branches/buildsystem3/bin/Release/orxonox.ini	(revision 2664)
@@ -0,0 +1,11 @@
+[Settings]
+dataPath_ = @ORXONOX_MEDIA_DIRECTORY@
+
+[GSGraphics]
+ogrePluginsFolder_ = @OGRE_PLUGINS_FOLDER_RELEASE@
+ogrePlugins_ = @OGRE_PLUGINS_RELEASE@
+
+[Core]
+softDebugLevelConsole_=1
+softDebugLevelLogfile_=3
+softDebugLevelShell_=1
Index: /code/branches/buildsystem3/bin/ogre.cfg
===================================================================
--- /code/branches/buildsystem3/bin/ogre.cfg	(revision 2664)
+++ /code/branches/buildsystem3/bin/ogre.cfg	(revision 2664)
@@ -0,0 +1,7 @@
+Render System=OpenGL Rendering Subsystem
+
+[OpenGL Rendering Subsystem]
+FSAA=0
+Full Screen=No
+RTT Preferred Mode=FBO
+Video Mode=800 x 600
Index: de/branches/buildsystem3/bin/ogre.cfg-init
===================================================================
--- /code/branches/buildsystem3/bin/ogre.cfg-init	(revision 2663)
+++ 	(revision )
@@ -1,7 +1,0 @@
-Render System=OpenGL Rendering Subsystem
-
-[OpenGL Rendering Subsystem]
-FSAA=0
-Full Screen=No
-RTT Preferred Mode=FBO
-Video Mode=1024 x 768
Index: de/branches/buildsystem3/bin/orxonox.bat
===================================================================
--- /code/branches/buildsystem3/bin/orxonox.bat	(revision 2663)
+++ 	(revision )
@@ -1,4 +1,0 @@
-title Orxonox
-path lib;..\..\libs;%path%
-orxonox.exe
-pause
Index: de/branches/buildsystem3/bin/plugins.cfg-init
===================================================================
--- /code/branches/buildsystem3/bin/plugins.cfg-init	(revision 2663)
+++ 	(revision )
@@ -1,14 +1,0 @@
-# Defines plugins to load
-
-# Define plugin folder
-PluginFolder=/usr/lib/OGRE
-
-# Define plugins
-#Plugin=RenderSystem_Direct3D9
-Plugin=RenderSystem_GL
-Plugin=Plugin_ParticleFX
-Plugin=Plugin_BSPSceneManager
-Plugin=Plugin_OctreeSceneManager
-#Plugin=Plugin_CgProgramManager
-
-
Index: /code/branches/buildsystem3/bin/run
===================================================================
--- /code/branches/buildsystem3/bin/run	(revision 2664)
+++ /code/branches/buildsystem3/bin/run	(revision 2664)
@@ -0,0 +1,4 @@
+#!/bin/sh
+# convenience script for starting orxonox on Linux
+
+cd @CMAKE_RUNTIME_OUTPUT_DIRECTORY@ && exec ./@ORXONOX_EXECUTABLE_NAME@ $@
Index: de/branches/buildsystem3/bin/run-script
===================================================================
--- /code/branches/buildsystem3/bin/run-script	(revision 2663)
+++ 	(revision )
@@ -1,26 +1,0 @@
-#!/bin/bash
-
-if [[ !  -f orxonox ]] ; then
-	echo "orxonox does not exist"
-	echo "did you compile it?"
-
-	exit 1
-fi
-
-if [[ ! -f ogre.cfg ]] ; then
-	cp ogre.cfg-init ogre.cfg
-fi
-
-# check if plugins.cfg exists, and of not create it
-# and modify 
-if [[ ! -f plugins.cfg ]] ; then 
-	if uname -n | grep "tardis" > /dev/null ; then
-		sed -e 's:PluginFolder=/usr/lib/OGRE:PluginFolder=/usr/pack/ogre-1.4.5-sd/i686-debian-linux3.1/lib/OGRE/:' \
-		-e 's:#Plugin=Plugin_CgProgramManager:Plugin=Plugin_CgProgramManager:' plugins.cfg-init > plugins.cfg
-	else
-                cp plugins.cfg-init plugins.cfg
-	fi
-fi
-
-trap "xset r && echo 'resetting autorepeat'" HUP INT TERM QUIT ABRT KILL ALRM
-./orxonox $@
Index: /code/branches/buildsystem3/bin/run.bat
===================================================================
--- /code/branches/buildsystem3/bin/run.bat	(revision 2664)
+++ /code/branches/buildsystem3/bin/run.bat	(revision 2664)
@@ -0,0 +1,6 @@
+title @PROJECT_NAME@
+path @ORXONOX_RUNTIME_LIBRARY_DIRECTORY_WINDOWS@;%path%
+@WINDOWS_DRIVE_CHANGE@
+cd @CMAKE_RUNTIME_OUTPUT_DIRECTORY_WINDOWS@
+@ORXONOX_EXECUTABLE_NAME@
+pause
Index: de/branches/buildsystem3/cmake/AddSourceFiles.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/AddSourceFiles.cmake	(revision 2663)
+++ 	(revision )
@@ -1,39 +1,0 @@
-#    AddSourceFiles.cmake - CMake Module to include source files in subdirectories.
-#    Author: Reto '1337' Grieder (2008)
-#
-#    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
-
-MACRO(ADD_SOURCE_DIRECTORY _target_list _directory)
-
-  # Subfolder puts source files into CMake Cache variable _CACHED_SOURCE_FILES
-  ADD_SUBDIRECTORY(${_directory})
-
-  # Put the directory name in front of each source file from the subfolder
-  # and add it to the source list in the current directory
-  FOREACH(_source_file ${_CACHED_SOURCE_FILES})
-    LIST(APPEND ${_target_list} "${_directory}/${_source_file}")
-  ENDFOREACH(_source_file)
-
-ENDMACRO(ADD_SOURCE_DIRECTORY)
-
-
-MACRO(ADD_SOURCE_FILES _source_list)
-  
-  # Put the source file into a variable that still exists in this_folder/../
-  # Use FORCE to always overwrite the cache variable
-  SET(_CACHED_SOURCE_FILES ${${_source_list}} CACHE STRING "" FORCE)
-  MARK_AS_ADVANCED(_CACHED_SOURCE_FILES FORCE)
-
-ENDMACRO(ADD_SOURCE_FILES)
Index: /code/branches/buildsystem3/cmake/BuildConfig.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/BuildConfig.cmake	(revision 2664)
+++ /code/branches/buildsystem3/cmake/BuildConfig.cmake	(revision 2664)
@@ -0,0 +1,167 @@
+ #
+ #             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:
+ #    Configures the compilers and sets build options.
+ #    This also includes handling the OGRE plugins and the media directory.
+ #
+
+################ Misc Options ###################
+
+# Set binary output directories
+SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
+SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
+
+# Sets where to find the external libraries like OgreMain.dll at runtime
+# On Unix you should not have to change this at all.
+IF(NOT ORXONOX_RUNTIME_LIBRARY_DIRECTORY)
+  SET(ORXONOX_RUNTIME_LIBRARY_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
+ENDIF()
+
+# Set Debug build to default when not having multi-config generator like msvc
+IF(NOT CMAKE_CONFIGURATION_TYPES)
+  IF(NOT CMAKE_BUILD_TYPE)
+    SET(CMAKE_BUILD_TYPE Debug CACHE STRING
+        "Build types are: Debug, Release, MinSizeRel, RelWithDebInfo" FORCE)
+  ENDIF()
+  MARK_AS_ADVANCED(CLEAR CMAKE_BUILD_TYPE)
+
+  MESSAGE(STATUS "*** Build type is ${CMAKE_BUILD_TYPE} ***")
+ELSE()
+  IF(CMAKE_BUILD_TYPE)
+    SET(CMAKE_BUILD_TYPE CACHE STRING FORCE)
+  ENDIF()
+  MARK_AS_ADVANCED(CMAKE_BUILD_TYPE)
+ENDIF()
+
+OPTION(EXTRA_WARNINGS "Enable some extra warnings (heavily pollutes the output)")
+
+# More plugins: Plugin_BSPSceneManager, Plugin_OctreeSceneManager
+# Render systems may be optional, but at least one has to be found in FindOgre
+SET(OGRE_PLUGINS_INT RenderSystem_GL RenderSystem_Direct3D9 Plugin_ParticleFX)
+IF(WIN32)
+  # CG program manager is probably DirectX related (not available under unix)
+  LIST(APPEND OGRE_PLUGINS_INT Plugin_CgProgramManager)
+ENDIF(WIN32)
+SET(OGRE_PLUGINS ${OGRE_PLUGINS_INT} CACHE STRING
+   "Specify which OGRE plugins to load. Existance check is performed.")
+
+# Check the plugins and determine the plugin folder
+# You can give a hint by setting the environment variable ENV{OGRE_PLUGIN_DIR}
+INCLUDE(CheckOGREPlugins)
+CHECK_OGRE_PLUGINS(${OGRE_PLUGINS})
+
+
+############## Compiler Config ##################
+
+INCLUDE(FlagUtilities)
+
+# Configure the compiler specific build options
+IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUC)
+  INCLUDE(BuildConfigGCC)
+ELSEIF(MSVC)
+  INCLUDE(BuildConfigMSVC)
+ELSE()
+  MESSAGE(STATUS "Warning: Your compiler is not officially supported.")
+ENDIF()
+
+SET(BUILD_CONFIG_USER_SCRIPT "" CACHE FILEPATH
+    "Specify a CMake script if you wish to write your own build config.
+     See BuildConfigGCC.cmake or BuildConfigMSVC.cmake for examples.")
+IF(BUILD_CONFIG_USER_SCRIPT)
+  IF(EXISTS ${CMAKE_MODULE_PATH}/${BUILD_CONFIG_USER_SCRIPT}.cmake)
+    INCLUDE(${BUILD_CONFIG_USER_SCRIPT})
+  ELSEIF(EXISTS ${BUILD_CONFIG_USER_SCRIPT})
+    INCLUDE(${BUILD_CONFIG_USER_SCRIPT})
+  ELSEIF(EXISTS ${CMAKE_MODULE_PATH}/${BUILD_CONFIG_USER_SCRIPT})
+    INCLUDE(${CMAKE_MODULE_PATH}/${BUILD_CONFIG_USER_SCRIPT})
+  ENDIF()
+ENDIF(BUILD_CONFIG_USER_SCRIPT)
+
+
+################ Test options ###################
+
+OPTION(ENABLE_TESTS "Enable build tests.")
+IF(ENABLE_TESTS)
+  ENABLE_TESTING()
+ENDIF(ENABLE_TESTS)
+
+OPTION(NETWORK_TESTING_ENABLED "Build network testing tools: i.e. chatclient chatserver and alike.")
+OPTION(NETWORKTRAFFIC_TESTING_ENABLED "Build dummyserver4 and dummyclient4.")
+
+
+############ Installation Settings ##############
+
+IF(UNIX)
+  SET(ORXONOX_RUNTIME_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/bin/orxonox)
+  SET(ORXONOX_LIBRARY_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/orxonox)
+  SET(ORXONOX_ARCHIVE_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/orxonox/static)
+  SET(ORXONOX_MEDIA_INSTALL_PATH   ${CMAKE_INSTALL_PREFIX}/share/orxonox)
+  SET(ORXONOX_DOC_INSTALL_PATH     ${CMAKE_INSTALL_PREFIX}/share/doc/orxonox)
+  # Not yet used
+  SET(ORXONOX_LOG_INSTALL_PATH     ~/.orxonox/log)
+  SET(ORXONOX_CONFIG_INSTALL_PATH  ~/.orxonox/config)
+ELSEIF(WIN32)
+  SET(ORXONOX_RUNTIME_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/bin)
+  SET(ORXONOX_LIBRARY_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib)
+  SET(ORXONOX_ARCHIVE_INSTALL_PATH ${CMAKE_INSTALL_PREFIX}/lib/static)
+  SET(ORXONOX_MEDIA_INSTALL_PATH   ${CMAKE_INSTALL_PREFIX}/media)
+  SET(ORXONOX_DOC_INSTALL_PATH     ${CMAKE_INSTALL_PREFIX}/doc)
+  # Not yet used
+  SET(ORXONOX_LOG_INSTALL_PATH     ${CMAKE_INSTALL_PREFIX}/log)
+  SET(ORXONOX_CONFIG_INSTALL_PATH  ${CMAKE_INSTALL_PREFIX}/config)
+ENDIF()
+
+
+################# Unix rpath ####################
+
+# use, i.e. don't skip the full RPATH for the build tree
+SET(CMAKE_SKIP_BUILD_RPATH  FALSE)
+
+# when building, don't use the install RPATH already
+# (but later on when installing)
+SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) 
+
+# the RPATH to be used when installing
+SET(CMAKE_INSTALL_RPATH ${ORXONOX_LIBRARY_INSTALL_PATH})
+
+# add the automatically determined parts of the RPATH
+# which point to directories outside the build tree to the install RPATH
+SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
+
+
+####### Static/Dynamic linking defines ##########
+
+# Disable Boost auto linking completely
+ADD_COMPILER_FLAGS("-DBOOST_ALL_NO_LIB")
+
+# 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("-DZLIB_DLL"           WIN32 LINK_ZLIB_DYNAMIC)
+
+# If no defines are specified, these libs get linked dynamically
+# You can change that optionally in the Cache.
+ADD_COMPILER_FLAGS("-DCEGUI_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)
Index: /code/branches/buildsystem3/cmake/BuildConfigGCC.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/BuildConfigGCC.cmake	(revision 2664)
+++ /code/branches/buildsystem3/cmake/BuildConfigGCC.cmake	(revision 2664)
@@ -0,0 +1,68 @@
+ #
+ #             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, Adrian Friedli
+ #  Description:
+ #    Sets the right compiler and linker flags for GCC.
+ #
+
+# Determine compiler version
+EXEC_PROGRAM(
+  ${CMAKE_CXX_COMPILER}
+  ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
+  OUTPUT_VARIABLE GCC_VERSION
+)
+
+# GCC may not support #pragma GCC system_header correctly when using
+# templates. According to Bugzilla, it was fixed March 07 but tests
+# have confirmed that GCC 4.0.0 does not pose a problem for our cases.
+INCLUDE(CompareVersionStrings)
+COMPARE_VERSION_STRINGS("${GCC_VERSION}" "4.0.0" _compare_result)
+IF(_compare_result LESS 0)
+  SET(GCC_NO_SYSTEM_HEADER_SUPPORT TRUE)
+ENDIF()
+
+# Also include environment flags. Could cause conflicts though
+SET_COMPILER_FLAGS("$ENV{CXXFLAGS}" CXX CACHE)
+SET_COMPILER_FLAGS("$ENV{CFLAGS}"   C   CACHE)
+
+# These flags get added to the flags above
+SET_COMPILER_FLAGS("    -g -ggdb -D_DEBUG" Debug          CACHE)
+SET_COMPILER_FLAGS("             -DNDEBUG" ReleaseAll     CACHE)
+ADD_COMPILER_FLAGS("-O3"                   Release        CACHE)
+ADD_COMPILER_FLAGS("-O2 -g -ggdb"          RelWithDebInfo CACHE)
+ADD_COMPILER_FLAGS("-Os"                   MinSizeRel     CACHE)
+
+# CMake doesn't seem to set the PIC flags right on certain 64 bit systems
+IF(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64")
+  ADD_COMPILER_FLAGS("-fPIC" CACHE)
+ENDIF()
+
+# Increase warning level if requested
+IF(EXTRA_WARNINGS)
+  REMOVE_COMPILER_FLAGS("-Wall" CACHE)
+  ADD_COMPILER_FLAGS("-Wextra --Wno-unused-parameter" CACHE)
+ELSE()
+  REMOVE_COMPILER_FLAGS("-Wextra --Wno-unused-parameter" CACHE)
+  ADD_COMPILER_FLAGS("-Wall" CACHE)
+ENDIF()
+
+# General linker flags
+SET_LINKER_FLAGS("--no-undefined" CACHE)
Index: /code/branches/buildsystem3/cmake/BuildConfigMSVC.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/BuildConfigMSVC.cmake	(revision 2664)
+++ /code/branches/buildsystem3/cmake/BuildConfigMSVC.cmake	(revision 2664)
@@ -0,0 +1,119 @@
+ #
+ #             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:
+ #    Sets the right compiler and linker flags for the Microsoft Compiler.
+ #
+
+######################## Options ########################
+
+OPTION(ACTIVATE_VISUAL_LEAK_DETECTOR "Memory leak detector" FALSE)
+
+#################### Compiler Flags #####################
+
+# -MD    Minimal Rebuild
+# -RTC1  Both basic runtime checks
+# -MD[d] Multithreaded [debug] DLL
+# -Zi    Program Database
+# -ZI    Program Database for Edit & Continue
+# -WX    General warning Level X
+# -wdX   Disable specific warning X
+# -wnX   Set warning level of specific warning X to level n
+
+# Overwrite CMake default flags first. Be careful with this
+# Only add (not set) the general compiler flags.
+# CMake default flags : -DWIN32 -D_WINDOWS -W3 -Zm1000
+# additionally for CXX: -EHsc -GR
+ADD_COMPILER_FLAGS("-D__WIN32__ -D_WIN32"      CACHE)
+ADD_COMPILER_FLAGS("-D_CRT_SECURE_NO_WARNINGS" CACHE)
+ADD_COMPILER_FLAGS("-DUNICODE -D_UNICODE"      CACHE)
+
+# Overwrite CMake default flags here.
+SET_COMPILER_FLAGS("-MDd -Od -ZI -D_DEBUG -Gm -RTC1" Debug          CACHE)
+SET_COMPILER_FLAGS("-MD  -O2     -DNDEBUG -MP2"      Release        CACHE)
+SET_COMPILER_FLAGS("-MD  -O2 -Zi -DNDEBUG"           RelWithDebInfo CACHE)
+SET_COMPILER_FLAGS("-MD  -O1     -DNDEBUG -MP2"      MinSizeRel     CACHE)
+
+
+####################### Warnings ########################
+
+# Increase warning level if requested
+IF(EXTRA_WARNINGS)
+  REMOVE_COMPILER_FLAGS("-W1 -W2 -W3" CACHE)
+  ADD_COMPILER_FLAGS   ("-W4" CACHE)
+ELSE()
+  REMOVE_COMPILER_FLAGS("-W1 -W2 -W4" CACHE)
+  ADD_COMPILER_FLAGS   ("-W3" CACHE)
+ENDIF()
+
+# "<type> needs to have dll-interface to be used by clients'
+# Happens on STL member variables which are not public
+ADD_COMPILER_FLAGS("-w44251" CACHE)
+
+# Multiple assignment operators specified
+ADD_COMPILER_FLAGS("-w44522" CACHE)
+
+# Forcing values to bool
+ADD_COMPILER_FLAGS("-w44800" CACHE)
+
+# This warns about truncation to 255 characters in debug/browse info
+# ADD_COMPILER_FLAGS("-w44786 -w44503" CACHE)
+
+# conversion from 'double' to 'float', possible loss of data
+# conversion from 'ogg_int64_t' to 'long', possible loss of data
+# ADD_COMPILER_FLAGS("-w44244" CACHE)
+
+# "conversion from 'size_t' to 'unsigned int', possible loss of data
+# ADD_COMPILER_FLAGS("-w44267" CACHE)
+
+# "truncation from 'double' to 'float'
+# ADD_COMPILER_FLAGS("-w44305" CACHE)
+
+# "non dll-interface class used as base for dll-interface class"
+# ADD_COMPILER_FLAGS("-w44275" CACHE)
+
+# "C++ Exception Specification ignored"
+# This is because MSVC 6 did not implement all the C++ exception
+# specifications in the ANSI C++ draft.
+# ADD_COMPILER_FLAGS("-w44290" CACHE)
+
+# "no suitable definition provided for explicit template
+# instantiation request" Occurs in VC7 for no justifiable reason.
+# ADD_COMPILER_FLAGS("-w44661" CACHE)
+
+# Deprecation warnings when using CRT calls in VC8
+# These show up on all C runtime lib code in VC8, disable since they clutter
+# the warnings with things we may not be able to do anything about (e.g.
+# generated code from nvparse etc). I doubt very much that these calls
+# will ever be actually removed from VC anyway, it would break too much code.
+# Note: Probably handled by "-DCRT_SECURE_NO_WARNINGS"
+# ADD_COMPILER_FLAGS("-w44996" CACHE)
+
+# "conditional expression constant"
+# ADD_COMPILER_FLAGS("-w4201" CACHE)
+
+
+##################### Linker Flags ######################
+
+# CMake default flags: -MANIFEST -STACK:10000000 -machine:I386
+# and INCREMENTAL and DEBUG for debug versions
+ADD_LINKER_FLAGS("-OPT:REF -OPT:ICF" Release MinSizeRel CACHE)
+ADD_LINKER_FLAGS("-OPT:NOWIN98" MSVC80 CACHE)
Index: /code/branches/buildsystem3/cmake/CheckOGREPlugins.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/CheckOGREPlugins.cmake	(revision 2664)
+++ /code/branches/buildsystem3/cmake/CheckOGREPlugins.cmake	(revision 2664)
@@ -0,0 +1,116 @@
+ #
+ #             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:
+ #    Function that checks each OGRE plugin for existance. Also looks for debug
+ #    versions and sets them accordingly.
+ #    All the plugins specified as function arguments have to be found or the
+ #    script will issue a fatal error. Additionally, all release plugins have
+ #    to be found in the same folder. Analogously for debug plugins.
+ #    Output:
+ #    OGRE_PLUGINS_FOLDER_DEBUG   Folder with the debug plugins
+ #    OGRE_PLUGINS_FOLDER_RELEASE Folder with the release plugins
+ #    OGRE_PLUGINS_DEBUG          Names of the debug plugins without extension
+ #    OGRE_PLUGINS_RELEASE        Names of the release plugins without ext.
+ #
+
+FUNCTION(CHECK_OGRE_PLUGINS)
+
+  SET(OGRE_PLUGINS ${ARGN})
+
+  IF(WIN32)
+    # On Windows we need only *.dll, not *.lib. Especially the MSVC generator doesn't look for *.dll
+    SET(CMAKE_FIND_LIBRARY_SUFFIXES .dll)
+  ENDIF(WIN32)
+  # Do not prefix "lib" on any platform
+  SET(CMAKE_FIND_LIBRARY_PREFIXES "")
+
+  SET(OGRE_RENDER_SYSTEM_FOUND FALSE)
+  FOREACH(_plugin ${OGRE_PLUGINS})
+    FIND_LIBRARY(OGRE_PLUGIN_${_plugin}_OPTIMIZED
+      NAMES ${_plugin}
+      PATHS $ENV{OGRE_HOME} $ENV{OGRE_PLUGIN_DIR}
+      PATH_SUFFIXES bin/Release bin/release Release release lib lib/OGRE bin
+    )
+    FIND_LIBRARY(OGRE_PLUGIN_${_plugin}_DEBUG
+      NAMES ${_plugin}d ${_plugin}_d ${_plugin}
+      PATHS $ENV{OGRE_HOME} $ENV{OGRE_PLUGIN_DIR}
+      PATH_SUFFIXES bin/Debug bin/debug Debug debug lib lib/OGRE bin
+    )
+    # We only need at least one render system. Check at the end.
+    IF(NOT ${_plugin} MATCHES "RenderSystem")
+      IF(NOT OGRE_PLUGIN_${_plugin}_OPTIMIZED)
+        MESSAGE(FATAL_ERROR "Could not find OGRE plugin named ${_plugin}")
+      ENDIF()
+    ELSEIF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
+      SET(OGRE_RENDER_SYSTEM_FOUND TRUE)
+    ENDIF()
+
+    IF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
+      # If debug version is not available, release will do as well
+      IF(OGRE_PLUGIN_${_plugin}_DEBUG STREQUAL OGRE_PLUGIN_${_plugin}_OPTIMIZED)
+        # In this case the library finder didn't find real debug versions
+        SET(OGRE_PLUGIN_${_plugin}_DEBUG "OGRE_PLUGIN_${_plugin}_DEBUG-NOTFOUND" CACHE STRING "" FORCE)
+      ENDIF()
+      MARK_AS_ADVANCED(OGRE_PLUGIN_${_plugin}_OPTIMIZED OGRE_PLUGIN_${_plugin}_DEBUG)
+
+      ### Set variables to configure orxonox.ini correctly afterwards in bin/ ###
+      # Check and set the folders
+      GET_FILENAME_COMPONENT(_plugins_folder ${OGRE_PLUGIN_${_plugin}_OPTIMIZED} PATH)
+      IF(OGRE_PLUGINS_FOLDER_RELEASE AND NOT OGRE_PLUGINS_FOLDER_RELEASE STREQUAL _plugins_folder)
+        MESSAGE(FATAL_ERROR "Ogre release plugins have to be in the same folder!")
+      ENDIF()
+      SET(OGRE_PLUGINS_FOLDER_RELEASE ${_plugins_folder})
+      IF(OGRE_PLUGIN_${_plugin}_DEBUG)
+        GET_FILENAME_COMPONENT(_plugins_folder ${OGRE_PLUGIN_${_plugin}_DEBUG} PATH)
+      ENDIF()
+      IF(OGRE_PLUGINS_FOLDER_DEBUG AND NOT OGRE_PLUGINS_FOLDER_DEBUG STREQUAL _plugins_folder)
+        MESSAGE(FATAL_ERROR "Ogre debug plugins have to be in the same folder!")
+      ENDIF()
+      SET(OGRE_PLUGINS_FOLDER_DEBUG ${_plugins_folder})
+
+      # Create a list with the plugins for release and debug configurations
+      LIST(APPEND OGRE_PLUGINS_RELEASE ${_plugin})
+      # Determine debug postfix ("d" or "_d" or none)
+      IF(OGRE_PLUGIN_${_plugin}_DEBUG MATCHES "_d\\.|_d$")
+        LIST(APPEND OGRE_PLUGINS_DEBUG "${_plugin}_d")
+      ELSEIF(OGRE_PLUGIN_${_plugin}_DEBUG MATCHES "d\\.|d$")
+        LIST(APPEND OGRE_PLUGINS_DEBUG "${_plugin}d")
+      ELSE()
+        LIST(APPEND OGRE_PLUGINS_DEBUG "${_plugin}")
+      ENDIF()
+    ENDIF(OGRE_PLUGIN_${_plugin}_OPTIMIZED)
+  ENDFOREACH(_plugin)
+  IF(NOT OGRE_RENDER_SYSTEM_FOUND)
+      MESSAGE(FATAL_ERROR "Could not find an OGRE render system plugin")
+  ENDIF()
+
+  # List has to be comma separated for orxonox.ini
+  STRING(REPLACE ";" ", " OGRE_PLUGINS_RELEASE "${OGRE_PLUGINS_RELEASE}")
+  STRING(REPLACE ";" ", " OGRE_PLUGINS_DEBUG   "${OGRE_PLUGINS_DEBUG}")
+
+  # Set variables outside function scope
+  SET(OGRE_PLUGINS_FOLDER_DEBUG ${OGRE_PLUGINS_FOLDER_DEBUG} PARENT_SCOPE)
+  SET(OGRE_PLUGINS_FOLDER_RELEASE ${OGRE_PLUGINS_FOLDER_RELEASE} PARENT_SCOPE)
+  SET(OGRE_PLUGINS_RELEASE ${OGRE_PLUGINS_RELEASE} PARENT_SCOPE)
+  SET(OGRE_PLUGINS_DEBUG ${OGRE_PLUGINS_DEBUG} PARENT_SCOPE)
+
+ENDFUNCTION(CHECK_OGRE_PLUGINS)
Index: de/branches/buildsystem3/cmake/CheckTardis.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/CheckTardis.cmake	(revision 2663)
+++ 	(revision )
@@ -1,31 +1,0 @@
-################# Tardis check ##################
-# This code checks whether the current machine  #
-# is an ETH tardis box.                         #
-#################################################
-
-# only run this test on a lunix/unix machine
-IF (UNIX)
-
-  FIND_PROGRAM(UNAME_CMD "uname"
-  PATHS "/usr/bin /bin")
-  IF(NOT UNAME_CMD)
-    MESSAGE(ERROR "Unable to find uname. Tardis-Check cannot be done.")
-  ENDIF(NOT UNAME_CMD)
-
-  # run uname -n to get nodename
-  EXECUTE_PROCESS(
-  COMMAND "${UNAME_CMD}" "-n"
-  RESULT_VARIABLE UNAME_RV
-  ERROR_VARIABLE UNAME_EV
-  OUTPUT_VARIABLE UNAME_OV)
-
-  IF (NOT "${UNAME_RV}" STREQUAL "0")
-    MESSAGE(ERROR "ERROR: uname terminated unclean.")
-  ENDIF (NOT "${UNAME_RV}" STREQUAL "0")
-
-  # check wheter we are on a tardis machine
-  IF ("${UNAME_OV}" MATCHES "tardis")
-    SET (IS_TARDIS ON)
-  ENDIF ("${UNAME_OV}" MATCHES "tardis")
-
-ENDIF (UNIX)
Index: /code/branches/buildsystem3/cmake/CompareVersionStrings.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/CompareVersionStrings.cmake	(revision 2664)
+++ /code/branches/buildsystem3/cmake/CompareVersionStrings.cmake	(revision 2664)
@@ -0,0 +1,78 @@
+# Computes the relationship between two version strings.  A version
+# string is a number delineated by '.'s such as 1.3.2 and 0.99.9.1.
+# You can feed version strings with different number of dot versions,
+# and the shorter version number will be padded with zeros: 9.2 <
+# 9.2.1 will actually compare 9.2.0 < 9.2.1.
+#
+# Input: a_in - value, not variable
+#        b_in - value, not variable
+#        result_out - variable with value:
+#                         -1 : a_in <  b_in
+#                          0 : a_in == b_in
+#                          1 : a_in >  b_in
+#        optional argument - TRUE or default FALSE:
+#              When passing 1.2.3 and 1.2 and this switch is on
+#              the function will actually compare 1.2 < 1.2
+#              Caution: Only the first string is adjusted!
+#
+# Written by James Bigler.
+# Extended with an optional argument by Reto Grieder
+
+FUNCTION(COMPARE_VERSION_STRINGS a_in b_in result_out)
+  # Additional argument can be a switch to change compare behaviour
+  SET(cut_first ${ARGN})
+
+  # Replace '.' with ';' to allow easy tokenization of the string.
+  STRING(REPLACE "." ";" a ${a_in})
+  STRING(REPLACE "." ";" b ${b_in})
+
+  # Check the size of each list to see if they are equal.
+  LIST(LENGTH a a_length)
+  LIST(LENGTH b b_length)
+
+  # Pad the shorter list with zeros.
+
+  IF(a_length LESS b_length)
+    # a is shorter
+    SET(shorter a)
+    MATH(EXPR pad_range "${b_length} - ${a_length} - 1")
+  ELSE(a_length LESS b_length)
+    # b is shorter
+    SET(shorter b)
+    SET(first_longer a)
+    MATH(EXPR pad_range "${a_length} - ${b_length} - 1")
+  ENDIF(a_length LESS b_length)
+
+  # PAD out if we need to
+  IF(NOT pad_range LESS 0)
+    FOREACH(pad RANGE ${pad_range})
+      # Since shorter is an alias for b, we need to get to it by dereferencing shorter.
+      IF(cut_first AND first_longer)
+        LIST(REMOVE_AT a -1) # remove last element
+      ELSE(cut_first AND first_longer)
+        LIST(APPEND ${shorter} 0)
+      ENDIF(cut_first AND first_longer)
+    ENDFOREACH(pad)
+  ENDIF(NOT pad_range LESS 0)
+
+  SET(result 0)
+  SET(index 0)
+  FOREACH(a_version ${a})
+    IF(result EQUAL 0)
+      # Only continue to compare things as long as they are equal
+      LIST(GET b ${index} b_version)
+      # LESS
+      IF(a_version LESS b_version)
+        SET(result -1)
+      ENDIF(a_version LESS b_version)
+      # GREATER
+      IF(a_version GREATER b_version)
+        SET(result 1)
+      ENDIF(a_version GREATER b_version)
+    ENDIF(result EQUAL 0)
+    MATH(EXPR index "${index} + 1")
+  ENDFOREACH(a_version)
+
+  # Copy out the return result
+  SET(${result_out} ${result} PARENT_SCOPE)
+ENDFUNCTION(COMPARE_VERSION_STRINGS)
Index: /code/branches/buildsystem3/cmake/DetermineVersion.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/DetermineVersion.cmake	(revision 2664)
+++ /code/branches/buildsystem3/cmake/DetermineVersion.cmake	(revision 2664)
@@ -0,0 +1,58 @@
+ #
+ #             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:
+ #    Inspects a given file for the following expressions
+ #    "NAME_MAJOR_VERSION #"
+ #    "NAME_MINOR_VERSION #"
+ #    "NAME_PATCH_VERSION #"
+ #    and sets NAME_VERSION accordingly. NAME_PART_VERSION variables are also
+ #    set. If you wish to look for different parts (e.g. "first" "second", etc.)
+ #    simply deliver them as additional arguments (have to be three though).
+ #
+
+FUNCTION(DETERMINE_VERSION _name _file)
+  IF(EXISTS ${_file})
+    FILE(READ ${_file} _file_content)
+    SET(_parts ${ARGN})
+    LIST(LENGTH _parts _parts_length)
+    IF(NOT ${_parts_length} EQUAL 3)
+      SET(_parts MAJOR MINOR PATCH)
+    ENDIF()
+
+    FOREACH(_part ${_parts})
+      STRING(REGEX MATCH "${_name}_VERSION_${_part} +([0-9]+)" _match ${_file_content})
+      IF(_match)
+        SET(${_name}_VERSION_${_part} ${CMAKE_MATCH_1})
+        SET(${_name}_VERSION_${_part} ${CMAKE_MATCH_1} PARENT_SCOPE)
+      ELSE()
+        SET(${_name}_VERSION_${_part} "0")
+        SET(${_name}_VERSION_${_part} "0" PARENT_SCOPE)
+      ENDIF()
+      IF("${_parts}" MATCHES "^${_part}") # First?
+        SET(${_name}_VERSION "${${_name}_VERSION_${_part}}")
+      ELSE()
+        SET(${_name}_VERSION "${${_name}_VERSION}.${${_name}_VERSION_${_part}}")
+      ENDIF()
+    ENDFOREACH(_part)
+    SET(${_name}_VERSION "${${_name}_VERSION}" PARENT_SCOPE)
+  ENDIF(EXISTS ${_file})
+ENDFUNCTION(DETERMINE_VERSION)
Index: /code/branches/buildsystem3/cmake/FindALUT.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/FindALUT.cmake	(revision 2663)
+++ /code/branches/buildsystem3/cmake/FindALUT.cmake	(revision 2664)
@@ -2,5 +2,5 @@
 # This module defines
 #  ALUT_LIBRARY
-#  ALUT_FOUND, if false, do not try to link to Alut
+#  ALUT_FOUND, if false, do not try to link against Alut
 #  ALUT_INCLUDE_DIR, where to find the headers
 #
@@ -18,37 +18,18 @@
 #
 # Several changes and additions by Fabian 'x3n' Landau
+# Some simplifications by Adrian Friedli and Reto Grieder
 #                 > www.orxonox.net <
 
-IF (ALUT_LIBRARY AND ALUT_INCLUDE_DIR)
-  SET (ALUT_FIND_QUIETLY TRUE)
-ENDIF (ALUT_LIBRARY AND ALUT_INCLUDE_DIR)
+INCLUDE(FindPackageHandleStandardArgs)
+INCLUDE(HandleLibraryTypes)
 
 FIND_PATH(ALUT_INCLUDE_DIR AL/alut.h
-  $ENV{ALUTDIR}/include
-  ~/Library/Frameworks/OpenAL.framework/Headers
-  /Library/Frameworks/OpenAL.framework/Headers
-  /System/Library/Frameworks/OpenAL.framework/Headers # Tiger
-  /usr/pack/openal-0.0.8-cl/include # Tardis specific hack
-  /usr/local/include/
-  /usr/local/include/OpenAL
-  /usr/local/include
-  /usr/include/
-  /usr/include/OpenAL
-  /usr/include
-  /sw/include/ # Fink
-  /sw/include/OpenAL
-  /sw/include
-  /opt/local/include/AL # DarwinPorts
-  /opt/local/include/OpenAL
-  /opt/local/include
-  /opt/csw/include/ # Blastwave
-  /opt/csw/include/OpenAL
-  /opt/csw/include
-  /opt/include/
-  /opt/include/OpenAL
-  /opt/include
-  ../libs/freealut-1.1.0/include
-  ${DEPENDENCY_DIR}/freealut-1.1.0/include
-  )
+  PATHS
+  $ENV{ALUTDIR}
+  ~/Library/Frameworks/OpenAL.framework
+  /Library/Frameworks/OpenAL.framework
+  /System/Library/Frameworks/OpenAL.framework # Tiger
+  PATH_SUFFIXES include include/OpenAL include/AL Headers
+)
 
 # I'm not sure if I should do a special casing for Apple. It is
@@ -57,4 +38,5 @@
 # do they want the -framework option also?
 IF(${ALUT_INCLUDE_DIR} MATCHES ".framework")
+
   STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" ALUT_FRAMEWORK_PATH_TMP ${ALUT_INCLUDE_DIR})
   IF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
@@ -62,54 +44,37 @@
       )
     # String is in default search path, don't need to use -F
-    SET (ALUT_LIBRARY "-framework OpenAL" CACHE STRING "OpenAL framework for OSX")
-  ELSE("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
-      OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
-      )
+    SET (ALUT_LIBRARY_OPTIMIZED "-framework OpenAL" CACHE STRING "OpenAL framework for OSX")
+  ELSE()
     # String is not /Library/Frameworks, need to use -F
-    SET(ALUT_LIBRARY "-F${ALUT_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX")
-  ENDIF("${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
-    OR "${ALUT_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
-    )
+    SET(ALUT_LIBRARY_OPTIMIZED "-F${ALUT_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX")
+  ENDIF()
   # Clear the temp variable so nobody can see it
   SET(ALUT_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "")
 
-ELSE(${ALUT_INCLUDE_DIR} MATCHES ".framework")
-  FIND_LIBRARY(ALUT_LIBRARY
+ELSE()
+  FIND_LIBRARY(ALUT_LIBRARY_OPTIMIZED
     NAMES alut
-    PATHS
-    $ENV{ALUTDIR}/lib
-    $ENV{ALUTDIR}/libs
-    /usr/pack/openal-0.0.8-cl/i686-debian-linux3.1/lib
-    /usr/local/lib
-    /usr/lib
-    /sw/lib
-    /opt/local/lib
-    /opt/csw/lib
-    /opt/lib
-    ../libs/freealut-1.1.0/src/.libs
-    ../libs/freealut-1.1.0/lib
-    ${DEPENDENCY_DIR}/freealut-1.1.0/lib
-    )
-ENDIF(${ALUT_INCLUDE_DIR} MATCHES ".framework")
+    PATHS $ENV{ALUTDIR}
+    PATH_SUFFIXES lib libs
+  )
+  FIND_LIBRARY(ALUT_LIBRARY_DEBUG
+    NAMES alutd alut_d alutD alut_D
+    PATHS $ENV{ALUTDIR}
+    PATH_SUFFIXES lib libs
+  )
+ENDIF()
 
-SET (ALUT_FOUND "NO")
-IF (ALUT_LIBRARY AND ALUT_INCLUDE_DIR)
-  SET (ALUT_FOUND "YES")
-  IF (NOT ALUT_FIND_QUIETLY)
-    MESSAGE (STATUS "FreeAlut was found.")
-    IF (VERBOSE_FIND)
-      MESSAGE (STATUS "  include path: ${ALUT_INCLUDE_DIR}")
-      MESSAGE (STATUS "  library path: ${ALUT_LIBRARY}")
-      MESSAGE (STATUS "  libraries:    alut")
-    ENDIF (VERBOSE_FIND)
-  ENDIF (NOT ALUT_FIND_QUIETLY)
-ELSE (ALUT_LIBRARY AND ALUT_INCLUDE_DIR)
-  IF (NOT ALUT_INCLUDE_DIR)
-    MESSAGE (SEND_ERROR "FreeAlut include path was not found.")
-  ENDIF (NOT ALUT_INCLUDE_DIR)
-  IF (NOT ALUT_LIBRARY)
-    MESSAGE (SEND_ERROR "FreeAlut library was not found.")
-  ENDIF (NOT ALUT_LIBRARY)
-ENDIF (ALUT_LIBRARY AND ALUT_INCLUDE_DIR)
+# Handle the REQUIRED argument and set ALUT_FOUND
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(ALUT DEFAULT_MSG
+    ALUT_LIBRARY_OPTIMIZED
+    ALUT_INCLUDE_DIR
+)
 
+# Collect optimized and debug libraries
+HANDLE_LIBRARY_TYPES(ALUT)
 
+MARK_AS_ADVANCED(
+    ALUT_INCLUDE_DIR
+    ALUT_LIBRARY_OPTIMIZED
+    ALUT_LIBRARY_DEBUG
+)
Index: de/branches/buildsystem3/cmake/FindBoost.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/FindBoost.cmake	(revision 2663)
+++ 	(revision )
@@ -1,316 +1,0 @@
-# THIS FILE HAS BEEN MODIFIED TO WORK ON THE TARDIS INFRASTURUCTURE of THE ETH.
-# use with caution
-# Nicolas Schlumberger <nico AT orxonx DOT net> (C) 2007
-#
-# Several changes and additions by Fabian 'x3n' Landau
-#                 > www.orxonox.net <
-#
-# - Find the Boost includes and libraries.
-# The following variables are set if Boost is found.  If Boost is not
-# found, Boost_FOUND is set to false.
-#  Boost_FOUND                  - True when the Boost include directory is found.
-#  Boost_INCLUDE_DIRS           - the path to where the boost include files are.
-#  Boost_LIBRARY_DIRS           - The path to where the boost library files are.
-#  Boost_LIB_DIAGNOSTIC_DEFINITIONS - Only set if using Windows.
-#  Boost_<library>_FOUND        - True if the Boost <library> is found.
-#  Boost_<library>_INCLUDE_DIRS - The include path for Boost <library>.
-#  Boost_<library>_LIBRARIES    - The libraries to link to to use Boost <library>.
-#  Boost_LIBRARIES              - The libraries to link to to use all Boost libraries.
-#
-# The following variables can be set to configure how Boost is found:
-#  Boost_LIB_PREFIX             - Look for Boost libraries prefixed with this, e.g. "lib"
-#  Boost_LIB_SUFFIX             - Look for Boost libraries ending with this, e.g. "vc80-mt"
-#  Boost_LIB_SUFFIX_DEBUG       - As for Boost_LIB_SUFFIX but for debug builds, e.g. "vs80-mt-gd"
-
-# ----------------------------------------------------------------------------
-# If you have installed Boost in a non-standard location or you have
-# just staged the boost files using bjam then you have three
-# options. In the following comments, it is assumed that <Your Path>
-# points to the root directory of the include directory of Boost. e.g
-# If you have put boost in C:\development\Boost then <Your Path> is
-# "C:/development/Boost" and in this directory there will be two
-# directories called "include" and "lib".
-# 1) After CMake runs, set Boost_INCLUDE_DIR to <Your Path>/include/boost<-version>
-# 2) Use CMAKE_INCLUDE_PATH to set a path to <Your Path>/include. This will allow FIND_PATH()
-#    to locate Boost_INCLUDE_DIR by utilizing the PATH_SUFFIXES option. e.g.
-#    SET(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "<Your Path>/include")
-# 3) Set an environment variable called ${BOOST_ROOT} that points to the root of where you have
-#    installed Boost, e.g. <Your Path>. It is assumed that there is at least a subdirectory called
-#    include in this path.
-#
-# Note:
-#  1) If you are just using the boost headers, then you do not need to use
-#     Boost_LIBRARY_DIRS in your CMakeLists.txt file.
-#  2) If Boost has not been installed, then when setting Boost_LIBRARY_DIRS
-#     the script will look for /lib first and, if this fails, then for /stage/lib.
-#
-# Usage:
-# In your CMakeLists.txt file do something like this:
-# ...
-# # Boost
-# FIND_PACKAGE(Boost)
-# ...
-# INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})
-# LINK_DIRECTORIES(${Boost_LIBRARY_DIRS})
-
-#
-# TODO:
-#
-# 1) Automatically find the Boost library files and eliminate the need
-#    to use Link Directories.
-#
-
-IF (Boost_INCLUDE_DIR)
-  SET (Boost_INCLUDE_FIND_QUIETLY TRUE)
-ENDIF (Boost_INCLUDE_DIR)
-
-IF(WIN32)
-# In windows, automatic linking is performed, so you do not have to specify the libraries.
-# If you are linking to a dynamic runtime, then you can choose to link to either a static or a
-# dynamic Boost library, the default is to do a static link.  You can alter this for a specific
-# library "whatever" by defining BOOST_WHATEVER_DYN_LINK to force Boost library "whatever" to
-# be linked dynamically.  Alternatively you can force all Boost libraries to dynamic link by
-# defining BOOST_ALL_DYN_LINK.
-
-# This feature can be disabled for Boost library "whatever" by defining BOOST_WHATEVER_NO_LIB,
-# or for all of Boost by defining BOOST_ALL_NO_LIB.
-
-# If you want to observe which libraries are being linked against then defining
-# BOOST_LIB_DIAGNOSTIC will cause the auto-linking code to emit a #pragma message each time
-# a library is selected for linking.
-#  SET(Boost_LIB_DIAGNOSTIC_DEFINITIONS "-DBOOST_LIB_DIAGNOSTIC")
-#  SET(Boost_LIB_PREFIX "lib")
-#  SET(Boost_LIB_SUFFIX "gcc-mt-1_33_1.lib")
-ENDIF(WIN32)
-
-
-SET(BOOST_INCLUDE_PATH_DESCRIPTION "directory containing the boost include files.")
-
-SET(BOOST_DIR_MESSAGE "Set the Boost_INCLUDE_DIR cmake cache entry to the ${BOOST_INCLUDE_PATH_DESCRIPTION}")
-
-SET(BOOST_DIR_SEARCH $ENV{BOOST_ROOT})
-IF(BOOST_DIR_SEARCH)
-  FILE(TO_CMAKE_PATH ${BOOST_DIR_SEARCH} BOOST_DIR_SEARCH)
-  SET(BOOST_DIR_SEARCH ${BOOST_DIR_SEARCH}/include)
-ENDIF(BOOST_DIR_SEARCH)
-
-# Add in some path suffixes. These will have to be updated whenever a new Boost version comes out.
-SET(SUFFIX_FOR_PATH
- boost
- boost-1_35_0
- boost-1_35
- boost-1_34_1
- boost-1_34_0
- boost-1_34
- boost-1_33_1
- boost-1_33_0
-)
-
-#
-# Look for an installation.
-#
-FIND_PATH(Boost_INCLUDE_DIR NAMES boost/config.hpp PATH_SUFFIXES ${SUFFIX_FOR_PATH} PATHS
-
-# Look in other places.
-  ${BOOST_DIR_SEARCH}
-
-#    ../libs/boost_1_33_1
-    ../libs/boost_1_34_1
-#    ../libs/boost-1_35_0
-    ${DEPENDENCY_DIR}/boost-1.35.0/include
-
-# Help the user find it if we cannot.
-  DOC "The ${BOOST_INCLUDE_PATH_DESCRIPTION}"
-)
-
-# Assume we didn't find it.
-SET(Boost_FOUND 0)
-
-# Now try to get the include and library path.
-IF(Boost_INCLUDE_DIR)
-
-# Look for the boost library path.
-# Note that the user may not have installed any libraries
-# so it is quite possible the Boost_LIBRARY_PATH may not exist.
-  SET(Boost_LIBRARY_DIR ${Boost_INCLUDE_DIR})
-
-  IF("${Boost_LIBRARY_DIR}" MATCHES "boost-[0-9]+")
-    GET_FILENAME_COMPONENT(Boost_LIBRARY_DIR ${Boost_LIBRARY_DIR} PATH)
-  ENDIF ("${Boost_LIBRARY_DIR}" MATCHES "boost-[0-9]+")
-
-  IF("${Boost_LIBRARY_DIR}" MATCHES "/include$")
-# Strip off the trailing "/include" in the path.
-    GET_FILENAME_COMPONENT(Boost_LIBRARY_DIR ${Boost_LIBRARY_DIR} PATH)
-  ENDIF("${Boost_LIBRARY_DIR}" MATCHES "/include$")
-
-  IF(EXISTS "${Boost_LIBRARY_DIR}/lib")
-    SET (Boost_LIBRARY_DIR ${Boost_LIBRARY_DIR}/lib)
-  ELSEIF(EXISTS "${Boost_LIBRARY_DIR}/bin/boost/libs/thread/build/boost_thread.dll/gcc/release/threading-multi")
-    SET (Boost_LIBRARY_DIR ${Boost_LIBRARY_DIR}/bin/boost/libs/thread/build/boost_thread.dll/gcc/release/threading-multi)
-  ELSE(EXISTS "${Boost_LIBRARY_DIR}/lib")
-    IF(EXISTS "${Boost_LIBRARY_DIR}/stage/lib")
-      SET(Boost_LIBRARY_DIR ${Boost_LIBRARY_DIR}/stage/lib)
-    ELSE(EXISTS "${Boost_LIBRARY_DIR}/stage/lib")
-      IF(EXISTS "${Boost_LIBRARY_DIR}/../../lib")
-        SET(Boost_LIBRARY_DIR "${Boost_LIBRARY_DIR}/../../lib")
-      ELSE(EXISTS "${Boost_LIBRARY_DIR}/../../lib")
-        SET(Boost_LIBRARY_DIR "")
-      ENDIF(EXISTS "${Boost_LIBRARY_DIR}/../../lib")
-    ENDIF(EXISTS "${Boost_LIBRARY_DIR}/stage/lib")
-  ENDIF(EXISTS "${Boost_LIBRARY_DIR}/lib")
-
-
-  IF(EXISTS "${Boost_INCLUDE_DIR}")
-    SET(Boost_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
-# We have found boost. It is possible that the user has not
-# compiled any libraries so we set Boost_FOUND to be true here.
-    SET(Boost_FOUND 1)
-    MARK_AS_ADVANCED(Boost_INCLUDE_DIR)
-  ENDIF(EXISTS "${Boost_INCLUDE_DIR}")
-  IF(Boost_LIBRARY_DIR AND EXISTS "${Boost_LIBRARY_DIR}")
-    SET(Boost_LIBRARY_DIRS ${Boost_LIBRARY_DIR})
-  ENDIF(Boost_LIBRARY_DIR AND EXISTS "${Boost_LIBRARY_DIR}")
-ENDIF(Boost_INCLUDE_DIR)
-
-
-#
-# Find boost libraries
-#
-
-# List of library suffixes to search, e.g. libboost_date_time-gcc
-SET(BOOST_SUFFIX_SEARCH
-  mt
-  gcc41-mt
-  gcc
-  il
-  gcc-1_33_1
-  gcc-mt-1_33_1
-  mgw34-mt-1_34_1
-  mgw34-mt-1_35
-  vc80-mt-1_35
-  vc80-mt-gd-1_35
-)
-
-# List of all boost libraries
-SET(BOOST_ALL_LIBRARIES
-  date_time
-  filesystem
-  graph
-  iostreams
-  program_options
-  regex
-  serialization
-  signals
-  unit_test_framework
-  thread
-  wave
-)
-
-# Macro to find boost library called name
-MACRO(BOOST_FIND_LIBRARY name)
-
-# User can specify a particular build variant via the variables:
-#   Boost_LIB_PREFIX, Boost_LIB_SUFFIX, Boost_LIB_SUFFIX_DEBUG
-# otherwise we'll search the BOOST_SUFFIX_SEARCH list
-
-  SET(BOOST_LIB_NAMES ${Boost_LIB_PREFIX}boost_${name}-${Boost_LIB_SUFFIX})
-  IF(NOT Boost_LIB_SUFFIX)
-    FOREACH(suffix ${BOOST_SUFFIX_SEARCH})
-      SET(BOOST_LIB_NAMES ${BOOST_LIB_NAMES} ${Boost_LIB_PREFIX}boost_${name}-${suffix})
-    ENDFOREACH(suffix)
-  ENDIF(NOT Boost_LIB_SUFFIX)
-
-# Find the library in the Boost_LIBRARY_DIRS
-  FIND_LIBRARY(Boost_${name}_LIBRARY
-    NAMES ${BOOST_LIB_NAMES}
-    PATHS ${Boost_LIBRARY_DIRS})
-
-# For MSVC builds find debug library
-  IF(WIN32 AND MSVC AND Boost_${name}_LIBRARY)
-    FIND_LIBRARY(Boost_${name}_LIBRARY_DEBUG
-      NAMES ${Boost_LIB_PREFIX}boost_${name}-${Boost_LIB_SUFFIX_DEBUG}
-      PATHS ${Boost_LIBRARY_DIRS})
-
-    IF(MSVC_IDE)
-      IF(Boost_${name}_LIBRARY AND Boost_${name}_LIBRARY_DEBUG)
-        SET(Boost_${name}_LIBRARIES debug ${Boost_${name}_LIBRARY_DEBUG} optimized ${Boost_${name}_LIBRARY})
-      ELSE(Boost_${name}_LIBRARY AND Boost_${name}_LIBRARY_DEBUG)
-        MESSAGE(FATAL_ERROR "Could not find the debug and release version of Boost ${name} library.")
-      ENDIF(Boost_${name}_LIBRARY AND Boost_${name}_LIBRARY_DEBUG)
-    ELSE(MSVC_IDE)
-      STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
-      IF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
-        SET(Boost_${name}_LIBRARIES ${Boost_${name}_LIBRARY_DEBUG})
-      ELSE(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
-        SET(Boost_${name}_LIBRARIES ${Boost_${name}_LIBRARY})
-      ENDIF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
-    ENDIF(MSVC_IDE)
-  ELSE(WIN32 AND MSVC AND Boost_${name}_LIBRARY)
-    SET(Boost_${name}_LIBRARIES ${Boost_${name}_LIBRARY})
-  ENDIF(WIN32 AND MSVC AND Boost_${name}_LIBRARY)
-
-# If we've got it setup appropriate variables or issue error message
-  IF(Boost_${name}_LIBRARY)
-    SET(Boost_${name}_FOUND 1)
-    SET(Boost_${name}_INCLUDE_DIRS ${Boost_INCLUDE_DIR})
-    MARK_AS_ADVANCED(Boost_${name}_LIBRARY Boost_${name}_LIBRARY_DEBUG)
-  ELSE(Boost_${name}_LIBRARY)
-    IF(NOT Boost_FIND_QUIETLY)
-      MESSAGE(SEND_ERROR "Boost ${name} library was not found.")
-    ELSE(NOT Boost_FIND_QUIETLY)
-      IF(Boost_FIND_REQUIRED_${name})
-        MESSAGE(FATAL_ERROR "Could NOT find required Boost ${name} library.")
-      ENDIF(Boost_FIND_REQUIRED_${name})
-    ENDIF(NOT Boost_FIND_QUIETLY)
-  ENDIF(Boost_${name}_LIBRARY)
-ENDMACRO(BOOST_FIND_LIBRARY)
-
-IF(Boost_LIBRARY_DIRS)
-
-# If the user specified required components e.g. via
-# FIND_PACKAGE(Boost REQUIRED date_time regex)
-# find (just) those libraries. Otherwise find all libraries.
-  IF(Boost_FIND_COMPONENTS)
-    SET(Boost_FIND_LIBRARIES ${Boost_FIND_COMPONENTS})
-  ELSE(Boost_FIND_COMPONENTS)
-    SET(Boost_FIND_LIBRARIES ${BOOST_ALL_LIBRARIES})
-  ENDIF(Boost_FIND_COMPONENTS)
-
-  SET(Boost_LIBRARIES)
-  FOREACH(library ${Boost_FIND_LIBRARIES})
-    IF (Boost_${library}_LIBRARY)
-      SET (Boost_${name}_LIBRARY_FIND_QUIETLY TRUE)
-    ENDIF (Boost_${library}_LIBRARY)
-
-    BOOST_FIND_LIBRARY(${library})
-    IF(Boost_${library}_FOUND)
-      SET(Boost_LIBRARIES ${Boost_LIBRARIES} ${Boost_${library}_LIBRARIES})
-      IF (NOT Boost_${name}_LIBRARY_FIND_QUIETLY)
-        MESSAGE(STATUS "Found BoostLibrary: ${library}")
-        IF (VERBOSE_FIND)
-          MESSAGE (STATUS "  library path: ${Boost_${library}_LIBRARIES}")
-        ENDIF (VERBOSE_FIND)
-      ENDIF (NOT Boost_${name}_LIBRARY_FIND_QUIETLY)
-    ENDIF(Boost_${library}_FOUND)
-  ENDFOREACH(library)
-ELSE(Boost_LIBRARY_DIRS)
-  MESSAGE(SEND_ERROR "Boost libraries not found: ${Boost_FIND_COMPONENTS}")
-ENDIF(Boost_LIBRARY_DIRS)
-
-IF(NOT Boost_FOUND)
-  IF(NOT Boost_FIND_QUIETLY)
-    MESSAGE(SEND_ERROR "Boost was not found. ${BOOST_DIR_MESSAGE}")
-  ELSE(NOT Boost_FIND_QUIETLY)
-    IF(Boost_FIND_REQUIRED)
-      MESSAGE(SEND_ERROR "Boost was not found. ${BOOST_DIR_MESSAGE}")
-    ENDIF(Boost_FIND_REQUIRED)
-  ENDIF(NOT Boost_FIND_QUIETLY)
-ELSE(NOT Boost_FOUND)
-  IF (NOT Boost_INCLUDE_FIND_QUIETLY)
-    MESSAGE(STATUS "Boost include path was found.")
-    IF (VERBOSE_FIND)
-      MESSAGE (STATUS "  include path: ${Boost_INCLUDE_DIR}")
-    ENDIF (VERBOSE_FIND)
-  ENDIF (NOT Boost_INCLUDE_FIND_QUIETLY)
-ENDIF(NOT Boost_FOUND)
-
Index: /code/branches/buildsystem3/cmake/FindCEGUI.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/FindCEGUI.cmake	(revision 2663)
+++ /code/branches/buildsystem3/cmake/FindCEGUI.cmake	(revision 2664)
@@ -3,7 +3,15 @@
 # This module defines
 #  CEGUI_INCLUDE_DIR
-#  CEGUI_LIBRARIES, the libraries to link against to use CEGUI.
-#  CEGUI_LIB_DIR, the location of the libraries
+#  CEGUI_LIBRARY, the library to link against to use CEGUI.
 #  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
@@ -17,97 +25,79 @@
 #
 # Several changes and additions by Fabian 'x3n' Landau
+# Lots of simplifications by Adrian Friedli and Reto Grieder
+# Version checking and CEGUILua finding by Reto Grieder
 #                 > www.orxonox.net <
 
-IF (CEGUI_LIBRARIES AND CEGUI_INCLUDE_DIR AND CEGUI_LIB_DIR)# AND CEGUI_SCRIPT_LIBRARIES)
-    SET(CEGUI_FIND_QUIETLY TRUE) # Already in cache, be silent
-ENDIF (CEGUI_LIBRARIES AND CEGUI_INCLUDE_DIR AND CEGUI_LIB_DIR)# AND CEGUI_SCRIPT_LIBRARIES)
+INCLUDE(DetermineVersion)
+INCLUDE(FindPackageHandleAdvancedArgs)
+INCLUDE(HandleLibraryTypes)
 
-IF (WIN32) #Windows
-    FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h
-        ../libs/cegui-0.6.1/include
-        ${DEPENDENCY_DIR}/cegui-0.6.1/include
-    )
+FIND_PATH(CEGUI_INCLUDE_DIR CEGUI.h
+  PATHS $ENV{CEGUIDIR}
+  PATH_SUFFIXES include include/CEGUI CEGUI.framework/Headers
+)
+FIND_LIBRARY(CEGUI_LIBRARY_OPTIMIZED
+  NAMES CEGUIBase CEGUI
+  PATHS $ENV{CEGUIDIR}
+  PATH_SUFFIXES lib bin
+)
+FIND_LIBRARY(CEGUI_LIBRARY_DEBUG
+  NAMES
+    CEGUIBased CEGUIBase_d CEGUIBaseD CEGUIBase_D
+    CEGUId CEGUI_d CEGUID CEGUI_D
+  PATHS $ENV{CEGUIDIR}
+  PATH_SUFFIXES lib bin
+)
 
-    SET(CEGUI_LIBRARIES debug CEGUIBase_d optimized CEGUIBase)
-    FIND_LIBRARY(CEGUI_LIBDIR NAMES ${CEGUI_LIBRARIES} PATHS
-        ../libs/cegui-0.6.1/bin
-        ${DEPENDENCY_DIR}/cegui-0.6.1/lib
-    )
+# Inspect CEGUIVersion.h for the version number
+DETERMINE_VERSION(CEGUI ${CEGUI_INCLUDE_DIR}/CEGUIVersion.h)
 
-    # Strip the filename from the path
-    IF (CEGUI_LIBDIR)
-        GET_FILENAME_COMPONENT(CEGUI_LIBDIR ${CEGUI_LIBDIR} PATH)
-        SET (CEGUI_LIB_DIR ${CEGUI_LIBDIR} CACHE FILEPATH "")
-    ENDIF (CEGUI_LIBDIR)
+# 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_LIBRARY_OPTIMIZED
+  CEGUI_INCLUDE_DIR
+)
 
-#    IF (NOT CEGUI_SCRIPT_LIBDIR)
-#        # Search Lua script module
-#        SET(CEGUI_SCRIPT_LIBRARIES "CEGUILuaScriptModule")
-#        FIND_LIBRARY(CEGUI_SCRIPT_LIBDIR NAMES ${CEGUI_SCRIPT_LIBRARIES} PATHS
-#            ../libs/cegui-0.6.1/bin
-#        )
-#	IF (NOT CEGUI_SCRIPT_LIBDIR)
-#            SET(CEGUI_SCRIPT_LIBRARIES "CEGUILua")
-#            FIND_LIBRARY(CEGUI_SCRIPT_LIBDIR NAMES ${CEGUI_SCRIPT_LIBRARIES} PATHS
-#                ../libs/cegui-0.6.1/bin
-#            )
-#            IF (NOT CEGUI_SCRIPT_LIBDIR)
-#                SET(CEGUI_SCRIPT_LIBRARIES)
-#            ENDIF (NOT CEGUI_SCRIPT_LIBDIR)
-#        ENDIF (NOT CEGUI_SCRIPT_LIBDIR)
-#    ENDIF (NOT CEGUI_SCRIPT_LIBDIR)
+# Collect optimized and debug libraries
+HANDLE_LIBRARY_TYPES(CEGUI)
 
-#    # Strip the filename from the path
-#    IF (CEGUI_SCRIPT_LIBDIR)
-#        GET_FILENAME_COMPONENT(CEGUI_SCRIPT_LIBDIR ${CEGUI_SCRIPT_LIBDIR} PATH)
-#        SET (CEGUI_SCRIPT_LIB_DIR ${CEGUI_SCRIPT_LIBDIR} CACHE FILEPATH "")
-#    ENDIF (CEGUI_SCRIPT_LIBDIR)
+MARK_AS_ADVANCED(
+  CEGUI_INCLUDE_DIR
+  CEGUI_LIBRARY_OPTIMIZED
+  CEGUI_LIBRARY_DEBUG
+)
 
-ELSE (WIN32) #Unix
-    FIND_PACKAGE(PkgConfig)
-    PKG_SEARCH_MODULE(CEGUI CEGUI /usr/pack/cegui-0.5.0-sd/i686-debian-linux3.1/lib/pkgconfig/CEGUI.pc) # tardis specific hack
-    SET(CEGUI_INCLUDE_DIR ${CEGUI_INCLUDE_DIRS})
-    SET(CEGUI_LIB_DIR ${CEGUI_LIBDIR})
-    SET(CEGUI_LIBRARIES ${CEGUI_LIBRARIES} CACHE STRING "")
-#    SET(CEGUI_SCRIPT_LIBRARIES "CEGUILuaScriptModule")
-#    SET(CEGUI_SCRIPT_LIB_DIR)
-ENDIF (WIN32)
+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
+  )
 
-IF (CEGUI_INCLUDE_DIR AND CEGUI_LIBRARIES AND CEGUI_LIB_DIR)# AND CEGUI_SCRIPT_LIBRARIES)
-    SET(CEGUI_FOUND TRUE)
+  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
+  )
 
-    #Do some preparation
-    SEPARATE_ARGUMENTS(CEGUI_INCLUDE_DIR)
-    SEPARATE_ARGUMENTS(CEGUI_LIBRARIES)
+  # Collect optimized and debug libraries
+  HANDLE_LIBRARY_TYPES(CEGUILUA)
 
-    SET(CEGUI_INCLUDE_DIR ${CEGUI_INCLUDE_DIR} CACHE PATH "")
-    SET(CEGUI_LIBRARIES ${CEGUI_LIBRARIES} CACHE STRING "")
-    SET(CEGUI_LIB_DIR ${CEGUI_LIB_DIR} CACHE PATH "")
-#    SET(CEGUI_SCRIPT_LIBRARIES ${CEGUI_SCRIPT_LIBRARIES} CACHE PATH "")
-ENDIF (CEGUI_INCLUDE_DIR AND CEGUI_LIBRARIES AND CEGUI_LIB_DIR)# AND CEGUI_SCRIPT_LIBRARIES)
+  MARK_AS_ADVANCED(
+    CEGUILUA_LIBRARY_OPTIMIZED
+    CEGUILUA_LIBRARY_DEBUG
+  )
 
-IF (CEGUI_FOUND)
-    IF (NOT CEGUI_FIND_QUIETLY)
-        MESSAGE(STATUS "CEGUI was found.")
-        IF (VERBOSE_FIND)
-            MESSAGE (STATUS "  include path: ${CEGUI_INCLUDE_DIR}")
-            MESSAGE (STATUS "  library path: ${CEGUI_LIB_DIR}")
-            MESSAGE (STATUS "  libraries:    ${CEGUI_LIBRARIES}")
-#            MESSAGE (STATUS "           :    ${CEGUI_SCRIPT_LIBRARIES}")
-        ENDIF (VERBOSE_FIND)
-    ENDIF (NOT CEGUI_FIND_QUIETLY)
-ELSE (CEGUI_FOUND)
-    IF (NOT CEGUI_INCLUDE_DIR)
-        MESSAGE(SEND_ERROR "CEGUI include path was not found.")
-    ENDIF (NOT CEGUI_INCLUDE_DIR)
-    IF (NOT CEGUI_LIB_DIR)
-        MESSAGE(SEND_ERROR "CEGUI library was not found.")
-    ENDIF (NOT CEGUI_LIB_DIR)
-    IF (NOT CEGUI_LIBRARIES)
-        MESSAGE(SEND_ERROR "CEGUI libraries not known.")
-    ENDIF (NOT CEGUI_LIBRARIES)
-#    IF (NOT CEGUI_SCRIPT_LIBRARIES)
-#        MESSAGE(SEND_ERROR "CEGUI Lua script module was not found.")
-#    ENDIF (NOT CEGUI_SCRIPT_LIBRARIES)
-ENDIF (CEGUI_FOUND)
+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)
 
Index: de/branches/buildsystem3/cmake/FindCEGUI_OGRE.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/FindCEGUI_OGRE.cmake	(revision 2663)
+++ 	(revision )
@@ -1,69 +1,0 @@
-# Find CEGUI_OGRE includes and library
-#
-# This module defines
-#  CEGUI_OGRE_INCLUDE_DIR
-#  CEGUI_OGRE_LIBRARIES, the libraries to link against to use CEGUI_OGRE.
-#  CEGUI_OGRE_LIB_DIR, the location of the libraries
-#  CEGUI_OGRE_FOUND, If false, do not try to use CEGUI_OGRE
-#
-# Created by Matt Williams to find OGRE libraries
-# Copyright © 2007, Matt Williams
-#
-# Modified by Nicolas Schlumberger to find CEGUI-OGRE libraries
-# and make it run on the Tardis-Infrastucture of the ETH Zurich
-# Copyright 2007, Nicolas Schlumberger
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-#
-# Several changes and additions by Fabian 'x3n' Landau
-#                 > www.orxonox.net <
-
-IF (CEGUI_OGRE_LIBRARIES AND CEGUI_OGRE_INCLUDE_DIR AND CEGUI_OGRE_LIB_DIR)
-    SET(CEGUI_OGRE_FIND_QUIETLY TRUE) # Already in cache, be silent
-ENDIF (CEGUI_OGRE_LIBRARIES AND CEGUI_OGRE_INCLUDE_DIR AND CEGUI_OGRE_LIB_DIR)
-
-IF (WIN32) #Windows
-    MESSAGE(STATUS "Looking for CEGUI_OGRE")
-    SET(CEGUI_OGRE_INCLUDE_DIR ../libs/ogre/Samples/Common/CEGUIRenderer/include)
-    SET(CEGUI_OGRE_LIB_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../libs/ogre/Samples/Common/bin/Release/lib)
-    SET(CEGUI_OGRE_LIBRARIES debug OgreGUIRenderer_d optimized OgreGUIRenderer)
-ELSE (WIN32) #Unix
-    FIND_PACKAGE(PkgConfig)
-    PKG_SEARCH_MODULE(CEGUI_OGRE CEGUI-OGRE /usr/pack/ogre-1.4.5-sd/i686-debian-linux3.1/lib/pkgconfig/CEGUI-OGRE.pc) # tardis specific hack
-    SET(CEGUI_OGRE_INCLUDE_DIR ${CEGUI_OGRE_INCLUDE_DIRS})
-    SET(CEGUI_OGRE_LIB_DIR ${CEGUI_OGRE_LIBDIR})
-    SET(CEGUI_OGRE_LIBRARIES ${CEGUI_OGRE_LIBRARIES} CACHE STRING "")
-ENDIF (WIN32)
-
-#Do some preparation
-SEPARATE_ARGUMENTS(CEGUI_OGRE_INCLUDE_DIR)
-SEPARATE_ARGUMENTS(CEGUI_OGRE_LIBRARIES)
-
-SET(CEGUI_OGRE_INCLUDE_DIR ${CEGUI_OGRE_INCLUDE_DIR} CACHE PATH "")
-SET(CEGUI_OGRE_LIBRARIES ${CEGUI_OGRE_LIBRARIES} CACHE STRING "")
-SET(CEGUI_OGRE_LIB_DIR ${CEGUI_OGRE_LIB_DIR} CACHE PATH "")
-
-IF (CEGUI_OGRE_INCLUDE_DIR AND CEGUI_OGRE_LIBRARIES AND CEGUI_OGRE_LIB_DIR)
-    SET(CEGUI_OGRE_FOUND TRUE)
-ENDIF (CEGUI_OGRE_INCLUDE_DIR AND CEGUI_OGRE_LIBRARIES AND CEGUI_OGRE_LIB_DIR)
-
-IF (CEGUI_OGRE_FOUND)
-    IF (NOT CEGUI_OGRE_FIND_QUIETLY)
-        MESSAGE(STATUS "CEGUI_Ogre was found.")
-        IF (VERBOSE_FIND)
-            MESSAGE (STATUS "  include path: ${CEGUI_OGRE_INCLUDE_DIR}")
-            MESSAGE (STATUS "  library path: ${CEGUI_OGRE_LIB_DIR}")
-            MESSAGE (STATUS "  libraries:    ${CEGUI_OGRE_LIBRARIES}")
-        ENDIF (VERBOSE_FIND)
-    ENDIF (NOT CEGUI_OGRE_FIND_QUIETLY)
-ELSE (CEGUI_OGRE_FOUND)
-    IF (NOT CEGUI_OGRE_INCLUDE_DIR)
-        MESSAGE(SEND_ERROR "CEGUI_Ogre include path was not found.")
-    ENDIF (NOT CEGUI_OGRE_INCLUDE_DIR)
-    IF (NOT CEGUI_OGRE_LIB_DIR)
-        MESSAGE(SEND_ERROR "CEGUI_Ogre library was not found.")
-    ENDIF (NOT CEGUI_OGRE_LIB_DIR)
-    IF (NOT CEGUI_OGRE_LIBRARIES)
-        MESSAGE(SEND_ERROR "CEGUI_Ogre libraries not known.")
-    ENDIF (NOT CEGUI_OGRE_LIBRARIES)
-ENDIF (CEGUI_OGRE_FOUND)
Index: /code/branches/buildsystem3/cmake/FindDirectX.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/FindDirectX.cmake	(revision 2663)
+++ /code/branches/buildsystem3/cmake/FindDirectX.cmake	(revision 2664)
@@ -1,49 +1,53 @@
-IF(WIN32)
-  # - Test for DirectX
-  # Once loaded this will define
-  #   DirectX_FOUND        - system has DirectX
-  #   DirectX_INCLUDE_DIR  - include directory for DirectX
-  #   DirectX_LIB_DIR      - lib directory for DirectX
-  #
-  # Several changes and additions by Fabian 'x3n' Landau
-  #                 > www.orxonox.net <
+# Find script for DirectX on Windows
+# Specifically designed to find dxguid and dinput8 for OIS
+# Once loaded this will define
+#   DIRECTX_FOUND        - system has DirectX
+#   DIRECTX_INCLUDE_DIR  - include directory for DirectX
+#   DIRECTX_LIBRARIES    - libraries for DirectX
+#
+# Set ENV{DXSD_DIR} if that has not been done the SDK installation.
+#
+# Several changes and additions by Fabian 'x3n' Landau
+# Simplifications and CMake 2.6.0 bugfix by Reto Grieder
+#                 > www.orxonox.net <
 
-  IF (DirectX_INCLUDE_DIR AND DirectX_LIB_DIR)
-    SET(DirectX_FIND_QUIETLY TRUE)
-  ENDIF (DirectX_INCLUDE_DIR AND DirectX_LIB_DIR)
+INCLUDE(FindPackageHandleStandardArgs)
+INCLUDE(HandleLibraryTypes)
 
-  set(DirectX_FOUND "NO")
+FIND_PATH(DIRECTX_INCLUDE_DIR dinput.h
+  PATHS $ENV{DXSDK_DIR}
+  PATH_SUFFIXES include
+)
+FIND_LIBRARY(DIRECTX_LIBRARY_input dinput8
+  PATHS $ENV{DXSDK_DIR}
+  PATH_SUFFIXES lib Lib lib/x86 Lib/x86
+  NO_DEFAULT_PATH # Or else CMake 2.6.0 will find the dll in system32 on windows
+)
+FIND_LIBRARY(DIRECTX_LIBRARY_input dinput8
+  PATHS $ENV{DXSDK_DIR}
+  PATH_SUFFIXES lib Lib lib/x86 Lib/x86
+)
+FIND_LIBRARY(DIRECTX_LIBRARY_guid dxguid
+  PATHS $ENV{DXSDK_DIR}
+  PATH_SUFFIXES lib Lib lib/x86 Lib/x86
+  NO_DEFAULT_PATH # Or else CMake 2.6.0 will find the dll in system32 on windows
+)
+FIND_LIBRARY(DIRECTX_LIBRARY_guid dxguid
+  PATHS $ENV{DXSDK_DIR}
+  PATH_SUFFIXES lib Lib lib/x86 Lib/x86
+)
 
-  FIND_PATH(DirectX_INCLUDE_DIR "dinput.h"
-    ../libs/DXSDK/Include
-    $ENV{DXSDK_DIR}/Include
-  )
+# Handle the REQUIRED argument and set DIRECTX_FOUND
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(DirectX DEFAULT_MSG
+  DIRECTX_LIBRARY_input
+  DIRECTX_LIBRARY_guid
+  DIRECTX_INCLUDE_DIR
+)
 
-  FIND_PATH(DirectX_LIB_DIR "dinput8.lib"
-    ../libs/DXSDK/Lib
-    ../libs/DXSDK/Lib/x86
-    $ENV{DXSDK_DIR}/lib/x86
-  )
+SET(DIRECTX_LIBRARIES ${DIRECTX_LIBRARY_input} ${DIRECTX_LIBRARY_guid})
 
-  IF (DirectX_INCLUDE_DIR AND DirectX_LIB_DIR)
-    SET (DirectX_FOUND "YES")
-  ENDIF (DirectX_INCLUDE_DIR AND DirectX_LIB_DIR)
-
-  IF (DirectX_FOUND)
-    IF (NOT DirectX_FIND_QUIETLY)
-      MESSAGE(STATUS "DirectX was found.")
-      IF (VERBOSE_FIND)
-        MESSAGE (STATUS "  include path: ${DirectX_INCLUDE_DIR}")
-        MESSAGE (STATUS "  library path: ${DirectX_LIB_DIR}")
-        MESSAGE (STATUS "  libraries:    dinput8.lib")
-      ENDIF (VERBOSE_FIND)
-    ENDIF (NOT DirectX_FIND_QUIETLY)
-  ELSE (DirectX_FOUND)
-    IF (NOT DirectX_INCLUDE_DIR)
-      MESSAGE(SEND_ERROR "DirectX include path was not found.")
-    ENDIF (NOT DirectX_INCLUDE_DIR)
-    IF (NOT DirectX_LIB_DIR)
-      MESSAGE(SEND_ERROR "DirectX library was not found.")
-    ENDIF (NOT DirectX_LIB_DIR)
-  ENDIF (DirectX_FOUND)
-ENDIF(WIN32)
+MARK_AS_ADVANCED(
+  DIRECTX_INCLUDE_DIR
+  DIRECTX_LIBRARY_input
+  DIRECTX_LIBRARY_guid
+)
Index: /code/branches/buildsystem3/cmake/FindENet.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/FindENet.cmake	(revision 2663)
+++ /code/branches/buildsystem3/cmake/FindENet.cmake	(revision 2664)
@@ -3,7 +3,8 @@
 #
 #  ENET_FOUND - system has enet
-#  ENET_INCLUDE_DIR - the enet include directory
-#  ENET_LIBRARIES - the libraries needed to use enet
-#  ENET_DEFINITIONS - Compiler switches required for using enet
+#  ENet_INCLUDE_DIR - the enet include directory
+#  ENet_LIBRARY - the library needed to link against enet
+#
+# $ENETDIR is an environment variable used for finding enet.
 #
 #  Borrowed from The Mana World
@@ -11,55 +12,60 @@
 #
 # Several changes and additions by Fabian 'x3n' Landau
+# Lots of simplifications by Adrian Friedli and Reto Grieder
+# Version checking by Reto Grieder
 #                 > www.orxonox.net <
 
-IF (ENet_INCLUDE_DIR AND ENet_LIBRARY)
-   SET(ENet_FIND_QUIETLY TRUE)
-ENDIF (ENet_INCLUDE_DIR AND ENet_LIBRARY)
+INCLUDE(FindPackageHandleAdvancedArgs)
+INCLUDE(HandleLibraryTypes)
 
-FIND_PATH(ENet_INCLUDE_DIR enet/enet.h
-    /usr/include
-    /usr/local/include
-    /usr/pack/enet-2007-sd/include
-    ../libs/enet-1.1/include
-    ${DEPENDENCY_DIR}/enet-1.2/include
-    )
+FIND_PATH(ENET_INCLUDE_DIR enet/enet.h
+  PATHS $ENV{ENETDIR}
+  PATH_SUFFIXES include
+)
+FIND_LIBRARY(ENET_LIBRARY_OPTIMIZED
+  NAMES enet
+  PATHS $ENV{ENETDIR}
+  PATH_SUFFIXES lib
+)
+FIND_LIBRARY(ENET_LIBRARY_DEBUG
+  NAMES enetd enet_d enet_D
+  PATHS $ENV{ENETDIR}
+  PATH_SUFFIXES lib
+)
 
-FIND_LIBRARY(ENet_LIBRARY
-    NAMES enet
-    PATHS /usr/lib /usr/local/lib /usr/pack/enet-2007-sd/i686-debian-linux3.1/lib/
-    ../libs/enet-1.1
-    ${DEPENDENCY_DIR}/enet-1.2/lib
-    )
+# Try to determine the version. Note that enet only stores the major
+# version in the header file. So we check for existing functions.
+# Hence the this script only distinguishes between 1.0, 1.1 and 1.2
+FILE(STRINGS ${ENET_INCLUDE_DIR}/enet/enet.h _enet_header REGEX "ENET_")
+IF(_enet_header MATCHES "ENET_VERSION[ \t]*=[ \t]*1")
+  IF(_enet_header MATCHES "enet_socket_set_option")
+    SET(ENET_VERSION 1.2)
+  ELSEIF(_enet_header MATCHES "enet_peer_disconnect_later")
+    SET(ENET_VERSION 1.1)
+  ELSE()
+    SET(ENET_VERSION 1.0)
+  ENDIF()
+ELSE()
+  SET(ENET_VERSION 0) # Script doesn't support versions below 1.0
+ENDIF()
 
-SET(ENET_FOUND FALSE)
-IF (ENet_INCLUDE_DIR AND ENet_LIBRARY)
-    SET(ENET_FOUND TRUE)
-    SET(ENET_INCLUDE_DIR ${ENet_INCLUDE_DIR})
+# Handle the REQUIRED argument and set ENET_FOUND
+# Also check the the version requirements
+FIND_PACKAGE_HANDLE_ADVANCED_ARGS(ENet DEFAULT_MSG ${ENET_VERSION}
+  ENET_LIBRARY_OPTIMIZED
+  ENET_INCLUDE_DIR
+)
 
-    IF(WIN32)
-        SET(WINDOWS_ENET_DEPENDENCIES "ws2_32;winmm")
-        SET(ENet_LIBRARY ${ENet_LIBRARY} ${WINDOWS_ENET_DEPENDENCIES})
-    ENDIF(WIN32)
+# Collect optimized and debug libraries
+IF(NOT LINK_ENET_DYNAMIC AND WIN32)
+  # ENet is linked statically, hence we need to add some windows dependencies
+  HANDLE_LIBRARY_TYPES(ENET ws2_32 winmm)
+ELSE()
+  HANDLE_LIBRARY_TYPES(ENET)
+ENDIF()
 
-    SET(ENET_LIBRARIES ${ENet_LIBRARY})
-ENDIF (ENet_INCLUDE_DIR AND ENet_LIBRARY)
-
-IF (ENET_FOUND)
-    IF (NOT ENet_FIND_QUIETLY)
-        MESSAGE(STATUS "ENet was found.")
-        IF (VERBOSE_FIND)
-            MESSAGE (STATUS "  include path: ${ENet_INCLUDE_DIR}")
-            MESSAGE (STATUS "  library path: ${ENet_LIBRARY}")
-            MESSAGE (STATUS "  libraries:    enet")
-        ENDIF (VERBOSE_FIND)
-    ENDIF (NOT ENet_FIND_QUIETLY)
-ELSE (ENET_FOUND)
-    IF (NOT ENet_INCLUDE_DIR)
-        MESSAGE(SEND_ERROR "ENet include path was not found.")
-    ENDIF (NOT ENet_INCLUDE_DIR)
-    IF (NOT ENet_LIBRARY)
-        MESSAGE(SEND_ERROR "ENet library was not found.")
-    ENDIF (NOT ENet_LIBRARY)
-ENDIF (ENET_FOUND)
-
-MARK_AS_ADVANCED(ENet_INCLUDE_DIR ENet_LIBRARY)
+MARK_AS_ADVANCED(
+  ENET_INCLUDE_DIR
+  ENET_LIBRARY_OPTIMIZED
+  ENET_LIBRARY_DEBUG
+)
Index: /code/branches/buildsystem3/cmake/FindLua.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/FindLua.cmake	(revision 2663)
+++ /code/branches/buildsystem3/cmake/FindLua.cmake	(revision 2664)
@@ -1,101 +1,184 @@
-#  Find Lua header and library files
-#
-#  When called, this script tries to define:
-#  Lua_INCLUDE_DIR    Header files directory
-#  Lua_LIBRARIES      library files (or file when using lua 5.1)
-#  Lua_FOUND          defined (true) if lua was found
-#  Lua_VERSION        either 5.1 or 5.0 or undefined
-#
-#  authors: Benjamin Knecht, Reto Grieder
-#
-# Several changes and additions by Fabian 'x3n' Landau
-#                 > www.orxonox.net <
+ #
+ #             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
+ #
 
-IF (Lua_LIBRARIES AND Lua_INCLUDE_DIR)
+INCLUDE(CompareVersionStrings)
+INCLUDE(FindPackageHandleAdvancedArgs)
+INCLUDE(HandleLibraryTypes)
 
-  # Already in cache, be silent
-  SET(Lua_FOUND TRUE)
-  SET(Lua_FIND_QUIETLY TRUE) 
-#  MESSAGE(STATUS "Lua was found.")
-
-ELSE (Lua_LIBRARIES AND Lua_INCLUDE_DIR)
-
-  FIND_PATH(Lua_INCLUDE_DIR_51 lua.h
-    /usr/include/lua5.1
-    /usr/local/include/lua5.1
-    ../libs/lua-5.1.3/include)
-
-  FIND_PATH(Lua_INCLUDE_DIR_50 lua.h
-    /usr/include/lua50
-    /usr/local/include/lua50
-    /usr/pack/lua-5.0.3-sd/include)
-
-  FIND_LIBRARY(Lua_LIBRARY_51 NAMES lua5.1 lua PATHS
-    /usr/lib
-    /usr/local/lib
-    ../libs/lua-5.1.3/lib)
-
-  FIND_LIBRARY(Lua_LIBRARY_1_50 NAMES lua50 lua PATHS
-    /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib #tardis
-    /usr/lib
-    /usr/local/lib)
-
-  FIND_LIBRARY(Lua_LIBRARY_2_50 NAMES lualib50 lualib PATHS
-    /usr/pack/lua-5.0.3-sd/i686-debian-linux3.1/lib #tardis
-    /usr/lib
-    /usr/local/lib)
+# 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)
 
 
-  IF (Lua_INCLUDE_DIR_51 AND Lua_LIBRARY_51)
+# 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)
 
-    # Found newer lua 5.1 libs
-    SET(Lua_FOUND TRUE)
-    SET(Lua_VERSION "5.1" CACHE STRING "")
-    SET(Lua_INCLUDE_DIR ${Lua_INCLUDE_DIR_51} CACHE PATH "")
-    SET(Lua_LIBRARIES ${Lua_LIBRARY_51} CACHE FILEPATH "")
-    SET(Lua_LIBRARY_NAMES "lua5.1 lua")
 
-  ELSEIF(Lua_INCLUDE_DIR_50 AND Lua_LIBRARY_1_50 AND Lua_LIBRARY_2_50)
+# 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)
 
-    # Found older lua 5.0 libs
-    SET(Lua_FOUND TRUE)
-    SET(Lua_VERSION "5.0" CACHE STRING "")
-    SET(Lua_INCLUDE_DIR ${Lua_INCLUDE_DIR_50} CACHE PATH "")
-    SET(Lua_LIBRARIES ${Lua_LIBRARY_1_50} ${Lua_LIBRARY_2_50} CACHE FILEPATH "")
-    SET(Lua_LIBRARY_NAMES "lua50 lua, lualib50 lualib")
+    # 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)
 
-  ENDIF (Lua_INCLUDE_DIR_51 AND Lua_LIBRARY_51)
-	
+# 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()
 
-  IF (Lua_FOUND)
-    MESSAGE(STATUS "Lua was found.")
-    IF (VERBOSE_FIND)
-      MESSAGE (STATUS "  include path: ${Lua_INCLUDE_DIR}")
-      MESSAGE (STATUS "  library path: ${Lua_LIBRARIES}")
-      MESSAGE (STATUS "  libraries:    ${Lua_LIBRARY_NAMES}")
-    ENDIF (VERBOSE_FIND)
-  ELSE (Lua_FOUND)
-    IF (Lua_INCLUDE_DIR_51 AND NOT Lua_LIBRARY_51)
-      MESSAGE(SEND_ERROR "Lua 5.1 library was not found")
-    ENDIF (Lua_INCLUDE_DIR_51 AND NOT Lua_LIBRARY_51)
-    IF (NOT Lua_INCLUDE_DIR_51 AND Lua_LIBRARY_51)
-      MESSAGE(SEND_ERROR "Lua 5.1 include path was not found")
-    ENDIF (NOT Lua_INCLUDE_DIR_51 AND Lua_LIBRARY_51)
+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}")
 
-    IF (Lua_INCLUDE_DIR_50)
-      IF (NOT Lua_LIBRARY_1_50)
-       MESSAGE(SEND_ERROR "Lua 5.0 library "lua" was not found")
-      ENDIF (NOT Lua_LIBRARY_1_50)
-      IF (NOT Lua_LIBRARY_2_50)
-       MESSAGE(SEND_ERROR "Lua 5.0 library "lualib" was not found")
-      ENDIF (NOT Lua_LIBRARY_2_50)
-    ENDIF (Lua_INCLUDE_DIR_50)
-    IF (NOT Lua_INCLUDE_DIR_50 AND Lua_LIBRARY_1_50 AND Lua_LIBRARY_2_50)
-      MESSAGE(SEND_ERROR "Lua 5.0 include path was not found")
-    ENDIF (NOT Lua_INCLUDE_DIR_50 AND Lua_LIBRARY_1_50 AND Lua_LIBRARY_2_50)
+FIND_PACKAGE_HANDLE_ADVANCED_ARGS(Lua DEFAULT_MSG "${LUA_VERSION_LONG}"
+  LUA_LIBRARIES
+  LUA_INCLUDE_DIR
+)
 
-    MESSAGE(SEND_ERROR "Lua was not found.")
-  ENDIF (Lua_FOUND)
+# 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)
 
-ENDIF (Lua_LIBRARIES AND Lua_INCLUDE_DIR)
-
+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
+)
Index: /code/branches/buildsystem3/cmake/FindOGRE.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/FindOGRE.cmake	(revision 2663)
+++ /code/branches/buildsystem3/cmake/FindOGRE.cmake	(revision 2664)
@@ -3,75 +3,53 @@
 # This module defines
 #  OGRE_INCLUDE_DIR
-#  OGRE_LIBRARIES, the libraries to link against to use OGRE.
-#  OGRE_LIB_DIR, the location of the libraries
+#  OGRE_LIBRARY, the library to link against to use OGRE.
 #  OGRE_FOUND, If false, do not try to use OGRE
 #
 # Copyright © 2007, Matt Williams
-# Modified by Nicolas Schlumberger to make it work on the Tardis-Infrastucture of the ETH Zurich
+# Modified by Nicolas Schlumberger to make it work on the Tardis-Infrastucture
+# of the ETH Zurich (removed later on)
 #
 # Redistribution and use is allowed according to the terms of the BSD license.
 #
 # Several changes and additions by Fabian 'x3n' Landau
+# Lots of simplifications by Adrian Friedli
+# Version checking by Reto Grieder
 #                 > www.orxonox.net <
 
-IF (OGRE_LIBRARIES AND OGRE_INCLUDE_DIR AND OGRE_LIB_DIR)
-    SET (OGRE_FIND_QUIETLY TRUE) # Already in cache, be silent
-ENDIF (OGRE_LIBRARIES AND OGRE_INCLUDE_DIR AND OGRE_LIB_DIR)
+INCLUDE(DetermineVersion)
+INCLUDE(FindPackageHandleAdvancedArgs)
+INCLUDE(HandleLibraryTypes)
 
-IF (WIN32) #Windows
-    FIND_PATH(OGRE_INCLUDE_DIR Ogre.h
-        ../libs/ogre/OgreMain/include
-        ${DEPENDENCY_DIR}/ogre-1.4.9/include
-    )
+FIND_PATH(OGRE_INCLUDE_DIR Ogre.h
+  PATHS $ENV{OGRE_HOME}
+  PATH_SUFFIXES include include/OGRE Ogre.framework/Headers
+)
+FIND_LIBRARY(OGRE_LIBRARY_OPTIMIZED
+  NAMES OgreMain Ogre
+  PATHS $ENV{OGRE_HOME}
+  PATH_SUFFIXES lib bin/Release bin/release Release release
+)
+FIND_LIBRARY(OGRE_LIBRARY_DEBUG
+  NAMES OgreMaind OgreMain_d OgreMainD OgreMain_D Ogred Ogre_d OgreD Ogre_d
+  PATHS $ENV{OGRE_HOME}
+  PATH_SUFFIXES lib bin/Debug bin/debug Debug debug Versions/A
+)
 
-    SET(OGRE_LIBRARIES debug OgreMain_d optimized OgreMain)
-    FIND_LIBRARY(OGRE_LIBDIR NAMES ${OGRE_LIBRARIES} PATHS
-        ../libs/ogre/Samples/Common/bin/Release
-        ${DEPENDENCY_DIR}/ogre-1.4.9/lib
-    )
+# Inspect OgrePrerquisites.h for the version number
+DETERMINE_VERSION(OGRE ${OGRE_INCLUDE_DIR}/OgrePrerequisites.h)
 
-    # Strip the filename from the path
-    IF (OGRE_LIBDIR)
-        GET_FILENAME_COMPONENT(OGRE_LIBDIR ${OGRE_LIBDIR} PATH)
-        SET (OGRE_LIB_DIR ${OGRE_LIBDIR} CACHE FILEPATH "")
-    ENDIF (OGRE_LIBDIR)
-ELSE (WIN32) #Unix
-    FIND_PACKAGE(PkgConfig)
-    PKG_SEARCH_MODULE(OGRE OGRE /usr/pack/ogre-1.4.5-sd/i686-debian-linux3.1/lib/pkgconfig/OGRE.pc) # tardis specific hack
-    SET(OGRE_INCLUDE_DIR ${OGRE_INCLUDE_DIRS})
-    SET(OGRE_LIB_DIR ${OGRE_LIBDIR})
-    SET(OGRE_LIBRARIES ${OGRE_LIBRARIES})
-ENDIF (WIN32)
+# Handle the REQUIRED argument and set OGRE_FOUND
+# Also check the version requirements
+FIND_PACKAGE_HANDLE_ADVANCED_ARGS(OGRE DEFAULT_MSG ${OGRE_VERSION}
+  OGRE_LIBRARY_OPTIMIZED
+  OGRE_INCLUDE_DIR
+)
 
-#Do some preparation
-SEPARATE_ARGUMENTS(OGRE_INCLUDE_DIR)
-SEPARATE_ARGUMENTS(OGRE_LIBRARIES)
+# Collect optimized and debug libraries
+HANDLE_LIBRARY_TYPES(OGRE)
 
-SET (OGRE_INCLUDE_DIR ${OGRE_INCLUDE_DIR} CACHE PATH "")
-SET (OGRE_LIBRARIES ${OGRE_LIBRARIES} CACHE STRING "")
-SET (OGRE_LIB_DIR ${OGRE_LIB_DIR} CACHE PATH "")
-
-IF (OGRE_INCLUDE_DIR AND OGRE_LIBRARIES AND OGRE_LIB_DIR)
-    SET(OGRE_FOUND TRUE)
-ENDIF (OGRE_INCLUDE_DIR AND OGRE_LIBRARIES AND OGRE_LIB_DIR)
-
-IF (OGRE_FOUND)
-    IF (NOT OGRE_FIND_QUIETLY)
-        MESSAGE(STATUS "Ogre was found.")
-        IF (VERBOSE_FIND)
-            MESSAGE (STATUS "  include path: ${OGRE_INCLUDE_DIR}")
-            MESSAGE (STATUS "  library path: ${OGRE_LIB_DIR}")
-            MESSAGE (STATUS "  libraries:    ${OGRE_LIBRARIES}")
-        ENDIF (VERBOSE_FIND)
-    ENDIF (NOT OGRE_FIND_QUIETLY)
-ELSE (OGRE_FOUND)
-    IF (NOT OGRE_INCLUDE_DIR)
-        MESSAGE(SEND_ERROR "Ogre include path was not found.")
-    ENDIF (NOT OGRE_INCLUDE_DIR)
-    IF (NOT OGRE_LIB_DIR)
-        MESSAGE(SEND_ERROR "Ogre library was not found.")
-    ENDIF (NOT OGRE_LIB_DIR)
-    IF (NOT OGRE_LIBRARIES)
-        MESSAGE(SEND_ERROR "Ogre libraries not known.")
-    ENDIF (NOT OGRE_LIBRARIES)
-ENDIF (OGRE_FOUND)
+MARK_AS_ADVANCED(
+  OGRE_INCLUDE_DIR
+  OGRE_LIBRARY_OPTIMIZED
+  OGRE_LIBRARY_DEBUG
+)
Index: /code/branches/buildsystem3/cmake/FindOgg.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/FindOgg.cmake	(revision 2664)
+++ /code/branches/buildsystem3/cmake/FindOgg.cmake	(revision 2664)
@@ -0,0 +1,47 @@
+# - Try to find ogg
+# Once done this will define
+#
+#  OGG_FOUND - system has ogg
+#  OGG_INCLUDE_DIR
+#  OGG_LIBRARY
+#
+# $OGGDIR is an environment variable used
+# for finding ogg.
+#
+# Several changes and additions by Fabian 'x3n' Landau
+# Most of all rewritten by Adrian Friedli
+# Debug versions and simplifications by Reto Grieder
+#                 > www.orxonox.net <
+
+INCLUDE(FindPackageHandleStandardArgs)
+INCLUDE(HandleLibraryTypes)
+
+FIND_PATH(OGG_INCLUDE_DIR ogg/ogg.h
+  PATHS $ENV{OGGDIR}
+  PATH_SUFFIXES include
+)
+FIND_LIBRARY(OGG_LIBRARY_OPTIMIZED
+  NAMES ogg
+  PATHS $ENV{OGGDIR}
+  PATH_SUFFIXES lib
+)
+FIND_LIBRARY(OGG_LIBRARY_DEBUG
+  NAMES oggd ogg_d oggD ogg_D
+  PATHS $ENV{OGGDIR}
+  PATH_SUFFIXES lib
+)
+
+# Handle the REQUIRED argument and set OGG_FOUND
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Ogg DEFAULT_MSG
+  OGG_LIBRARY_OPTIMIZED
+  OGG_INCLUDE_DIR
+)
+
+# Collect optimized and debug libraries
+HANDLE_LIBRARY_TYPES(OGG)
+
+MARK_AS_ADVANCED(
+  OGG_INCLUDE_DIR
+  OGG_LIBRARY_OPTIMIZED
+  OGG_LIBRARY_DEBUG
+)
Index: de/branches/buildsystem3/cmake/FindOggVorbis.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/FindOggVorbis.cmake	(revision 2663)
+++ 	(revision )
@@ -1,156 +1,0 @@
-# Several changes and additions by Fabian 'x3n' Landau
-#                 > www.orxonox.net <
-
-IF (OGG_INCLUDE_DIR AND OGG_LIBRARY)
-  SET(OGG_FIND_QUIETLY TRUE)
-ENDIF (OGG_INCLUDE_DIR AND OGG_LIBRARY)
-
-IF (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISENC_LIBRARY AND VORBISFILE_LIBRARY)
-  SET(VORBIS_FIND_QUIETLY TRUE)
-ENDIF (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISENC_LIBRARY AND VORBISFILE_LIBRARY) 
-
-
-#SET(OGGVORBIS_LIBRARY_DIR "/usr/pack/oggvorbis-1.0-ds/i686-debian-linux3.0/lib")
-#SET(OGGVORBIS_LIBRARY "-L ${OGGVORBIS_LIBRARY_DIR} -lvorbisenc -lvorbisfile -logg -lvorbis ")
-#SET(OGGVORBIS_INCLUDE_DIR "/usr/pack/oggvorbis-1.0-ds/i686-debian-linux3.0/include")
-
-#
-# Includes
-#
-
-FIND_PATH(OGG_INCLUDE_DIR ogg/ogg.h
-  /usr/pack/oggvorbis-1.0-ds/i686-debian-linux3.0/include 		# Tardis specific hack
-  /usr/local/include
-  /usr/include
-  /sw/include
-  /opt/local/include
-  /opt/csw/include
-  /opt/csw/include
-  /opt/include
-  ../libs/libogg-1.1.3/include
-  ${DEPENDENCY_DIR}/libogg-1.1.3/include
-  )
-
-FIND_PATH(VORBIS_INCLUDE_DIR vorbis/codec.h
-  /usr/pack/oggvorbis-1.0-ds/i686-debian-linux3.0/include 		# Tardis specific hack
-  /usr/local/include
-  /usr/include
-  /sw/include
-  /opt/local/include
-  /opt/csw/include
-  /opt/csw/include
-  /opt/include
-  ../libs/libvorbis-1.2.0/include
-  ${DEPENDENCY_DIR}/libvorbis-1.2.0/include
-  )
-
-#
-# Libs
-#
-
-FIND_LIBRARY(OGG_LIBRARY
-  NAMES ogg
-  PATHS
-  /usr/pack/oggvorbis-1.0-ds/i686-debian-linux3.1/lib
-  /usr/local/lib
-  /usr/lib
-  /sw/lib
-  /opt/local/lib
-  /opt/csw/lib
-  /opt/lib
-  ../libs/libogg-1.1.3/src/.libs
-  ${DEPENDENCY_DIR}/libogg-1.1.3/lib
-  )
-
-FIND_LIBRARY(VORBIS_LIBRARY
-  NAMES vorbis
-  PATHS
-  /usr/pack/oggvorbis-1.0-ds/i686-debian-linux3.1/lib
-  /usr/local/lib
-  /usr/lib
-  /sw/lib
-  /opt/local/lib
-  /opt/csw/lib
-  /opt/lib
-  ../libs/libvorbis-1.2.0/lib/.libs
-  ${DEPENDENCY_DIR}/libvorbis-1.2.0/lib
-  )
-
-#FIND_LIBRARY(VORBISENC_LIBRARY
-#  NAMES vorbisenc
-#  PATHS
-#  /usr/pack/oggvorbis-1.0-ds/i686-debian-linux3.1/lib
-#  /usr/local/lib
-#  /usr/lib
-#  /sw/lib
-#  /opt/local/lib
-#  /opt/csw/lib
-#  /opt/lib
-#  ../libs/libvorbis-1.2.0/lib/.libs
-#  )
-
-FIND_LIBRARY(VORBISFILE_LIBRARY
-  NAMES vorbisfile
-  PATHS
-  /usr/pack/oggvorbis-1.0-ds/i686-debian-linux3.1/lib
-  /usr/local/lib
-  /usr/lib
-  /sw/lib
-  /opt/local/lib
-  /opt/csw/lib
-  /opt/lib
-  ../libs/libvorbis-1.2.0/lib/.libs
-  ${DEPENDENCY_DIR}/libvorbis-1.2.0/lib
-  )
-
-SET (OGG_FOUND "NO")
-
-IF (OGG_INCLUDE_DIR AND OGG_LIBRARY)
-  SET (OGG_FOUND "YES")
-  IF (NOT OGG_FIND_QUIETLY)
-    MESSAGE (STATUS "Ogg was found.")
-    IF (VERBOSE_FIND)
-      MESSAGE (STATUS "  include path: ${OGG_INCLUDE_DIR}")
-      MESSAGE (STATUS "  library path: ${OGG_LIBRARY}")
-      MESSAGE (STATUS "  libraries:    ogg")
-    ENDIF (VERBOSE_FIND)
-  ENDIF (NOT OGG_FIND_QUIETLY)
-ELSE (OGG_INCLUDE_DIR AND OGG_LIBRARY)
-  IF (NOT OGG_INCLUDE_DIR)
-    MESSAGE (SEND_ERROR "Ogg include path was not found.")
-  ENDIF (NOT OGG_INCLUDE_DIR)
-  IF (NOT OGG_LIBRARY)
-    MESSAGE (SEND_ERROR "Ogg library was not found.")
-  ENDIF (NOT OGG_LIBRARY)
-ENDIF (OGG_INCLUDE_DIR AND OGG_LIBRARY)
-
-
-SET (VORBIS_FOUND "NO")
-
-IF (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY)# AND VORBISENC_LIBRARY)
-  SET (VORBIS_FOUND "YES")
-  IF (NOT VORBIS_FIND_QUIETLY)
-    MESSAGE (STATUS "Vorbis was found.")
-    IF (VERBOSE_FIND)
-      MESSAGE (STATUS "  include path: ${VORBIS_INCLUDE_DIR}")
-      MESSAGE (STATUS "  library path: ${VORBIS_LIBRARY}")
-      #MESSAGE (STATUS "  library path: ${VORBISENC_LIBRARY}")
-      MESSAGE (STATUS "  library path: ${VORBISFILE_LIBRARY}")
-      MESSAGE (STATUS "  libraries:    vorbis vorbisenc vorbisfile")
-    ENDIF (VERBOSE_FIND)
-  ENDIF (NOT VORBIS_FIND_QUIETLY)
-ELSE (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY)# AND VORBISENC_LIBRARY)
-  IF (NOT VORBIS_INCLUDE_DIR)
-    MESSAGE (SEND_ERROR "Vorbis include path was not found.")
-  ENDIF (NOT VORBIS_INCLUDE_DIR)
-  IF (NOT VORBIS_LIBRARY)
-    MESSAGE (SEND_ERROR "Vorbis library \"vorbis\" was not found.")
-  ENDIF (NOT VORBIS_LIBRARY)
-  #IF (NOT VORBISENC_LIBRARY)
-  #  MESSAGE (SEND_ERROR "Vorbis library \"vorbisenc\" was not found.")
-  #ENDIF (NOT VORBISENC_LIBRARY)
-  IF (NOT VORBISFILE_LIBRARY)
-    MESSAGE (SEND_ERROR "Vorbis library \"vorbisfile\" was not found.")
-  ENDIF (NOT VORBISFILE_LIBRARY)
-ENDIF (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY)# AND VORBISENC_LIBRARY)
-
Index: de/branches/buildsystem3/cmake/FindOpenAL.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/FindOpenAL.cmake	(revision 2663)
+++ 	(revision )
@@ -1,113 +1,0 @@
-# - Locate OpenAL
-# This module defines
-#  OPENAL_LIBRARY
-#  OPENAL_FOUND, if false, do not try to link to OpenAL
-#  OPENAL_INCLUDE_DIR, where to find the headers
-#
-# $OPENALDIR is an environment variable that would
-# correspond to the ./configure --prefix=$OPENALDIR
-# used in building OpenAL.
-#
-# Several changes and additions by Fabian 'x3n' Landau
-#                 > www.orxonox.net <
-
-IF (OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR)
-  SET(OPENAL_FIND_QUIETLY TRUE)
-ENDIF (OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR)
-
-# Created by Eric Wing. This was influenced by the FindSDL.cmake module.
-# On OSX, this will prefer the Framework version (if found) over others.
-# People will have to manually change the cache values of
-# OPENAL_LIBRARY to override this selection.
-# Tiger will include OpenAL as part of the System.
-# But for now, we have to look around.
-# Other (Unix) systems should be able to utilize the non-framework paths.
-FIND_PATH(OPENAL_INCLUDE_DIR AL/al.h
-  $ENV{OPENALDIR}/include
-  ~/Library/Frameworks/OpenAL.framework/Headers
-  /Library/Frameworks/OpenAL.framework/Headers
-  /System/Library/Frameworks/OpenAL.framework/Headers # Tiger
-  /usr/pack/openal-0.0.8-cl/include # Tardis specific hack
-  /usr/local/include/
-  /usr/local/include/OpenAL
-  /usr/local/include
-  /usr/include/
-  /usr/include/OpenAL
-  /usr/include
-  /sw/include # Fink
-  /sw/include/OpenAL
-  /sw/include
-  /opt/local/include # DarwinPorts
-  /opt/local/include/OpenAL
-  /opt/local/include
-  /opt/csw/include # Blastwave
-  /opt/csw/include/OpenAL
-  /opt/csw/include
-  /opt/include
-  /opt/include/OpenAL
-  /opt/include
-  ../libs/openal-0.0.8/common/include
-  ${DEPENDENCY_DIR}/openal-1.1/include
-  )
-# I'm not sure if I should do a special casing for Apple. It is
-# unlikely that other Unix systems will find the framework path.
-# But if they do ([Next|Open|GNU]Step?),
-# do they want the -framework option also?
-IF(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
-  STRING(REGEX REPLACE "(.*)/.*\\.framework/.*" "\\1" OPENAL_FRAMEWORK_PATH_TMP ${OPENAL_INCLUDE_DIR})
-  IF("${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
-      OR "${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
-      )
-    # String is in default search path, don't need to use -F
-    SET (OPENAL_LIBRARY "-framework OpenAL" CACHE STRING "OpenAL framework for OSX")
-  ELSE("${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
-      OR "${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
-      )
-    # String is not /Library/Frameworks, need to use -F
-    SET(OPENAL_LIBRARY "-F${OPENAL_FRAMEWORK_PATH_TMP} -framework OpenAL" CACHE STRING "OpenAL framework for OSX")
-  ENDIF("${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/Library/Frameworks"
-    OR "${OPENAL_FRAMEWORK_PATH_TMP}" STREQUAL "/System/Library/Frameworks"
-    )
-  # Clear the temp variable so nobody can see it
-  SET(OPENAL_FRAMEWORK_PATH_TMP "" CACHE INTERNAL "")
-
-ELSE(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
-  FIND_LIBRARY(OPENAL_LIBRARY
-    NAMES openal al OpenAL32
-    PATHS
-    $ENV{OPENALDIR}/lib
-    $ENV{OPENALDIR}/libs
-    /usr/pack/openal-0.0.8-cl/i686-debian-linux3.1/lib
-    /usr/local/lib
-    /usr/lib
-    /sw/lib
-    /opt/local/lib
-    /opt/csw/lib
-    /opt/lib
-    ../libs/openal-0.0.8/src/.libs
-    ${DEPENDENCY_DIR}/openal-1.1/lib
-    )
-ENDIF(${OPENAL_INCLUDE_DIR} MATCHES ".framework")
-
-SET (OPENAL_FOUND "NO")
-
-IF (OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR)
-  SET (OPENAL_FOUND "YES")
-  IF (NOT OPENAL_FIND_QUIETLY)
-    MESSAGE (STATUS "OpenAL was found.")
-    IF (VERBOSE_FIND)
-      MESSAGE (STATUS "  include path: ${OPENAL_INCLUDE_DIR}")
-      MESSAGE (STATUS "  library path: ${OPENAL_LIBRARY}")
-      MESSAGE (STATUS "  libraries:    openal al OpenAL32")
-    ENDIF (VERBOSE_FIND)
-  ENDIF (NOT OPENAL_FIND_QUIETLY)
-ELSE (OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR)
-  IF (NOT OPENAL_INCLUDE_DIR)
-    MESSAGE (SEND_ERROR "OpenAL include path was not found.")
-  ENDIF (NOT OPENAL_INCLUDE_DIR)
-  IF (NOT OPENAL_LIBRARY)
-    MESSAGE (SEND_ERROR "OpenAL library was not found.")
-  ENDIF (NOT OPENAL_LIBRARY)
-ENDIF (OPENAL_LIBRARY AND OPENAL_INCLUDE_DIR)
-
-
Index: /code/branches/buildsystem3/cmake/FindPackageHandleAdvancedArgs.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/FindPackageHandleAdvancedArgs.cmake	(revision 2664)
+++ /code/branches/buildsystem3/cmake/FindPackageHandleAdvancedArgs.cmake	(revision 2664)
@@ -0,0 +1,66 @@
+ #
+ #             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:
+ #    Extension of the standard module "FindPackageHandleStandardArgs".
+ #    This function also checks the version requirements. Also regards the
+ #    EXACT keyword if specified in FIND_PACKAGE(...).
+ #
+ 
+INCLUDE(FindPackageHandleStandardArgs)
+INCLUDE(CompareVersionStrings)
+
+FUNCTION(FIND_PACKAGE_HANDLE_ADVANCED_ARGS _name _fail_msg _version)
+
+  # Modify the message to include version requirements
+  IF("${_fail_msg}" STREQUAL "DEFAULT_MSG")
+    SET(_fail_msg_adv "Could NOT find ${_name}")
+  ELSE()
+    SET(_fail_msg_adv "${_fail_msg}")
+  ENDIF()
+  IF(${_name}_FIND_VERSION_EXACT)
+    SET(_fail_msg_adv "${_fail_msg_adv} (version requirements: exactly ${${_name}_FIND_VERSION})")
+  ELSE()
+    SET(_fail_msg_adv "${_fail_msg_adv} (version requirements: at least ${${_name}_FIND_VERSION})")
+  ENDIF()
+  FIND_PACKAGE_HANDLE_STANDARD_ARGS("${_name}" "${_fail_msg_adv}" ${ARGN})
+  STRING(TOUPPER ${_name} _NAME_UPPER)
+
+  # Also check version requirements if given to FindPackage(...)
+  IF(${_name}_FIND_VERSION)
+    # Note: the last argument of the function tells it to cut the first
+    #       version string instead of padding it with zeros if necessary
+    COMPARE_VERSION_STRINGS("${_version}" "${${_name}_FIND_VERSION}" _compatible TRUE)
+    IF(${_name}_FIND_VERSION_EXACT AND NOT _compatible EQUAL 0)
+      MESSAGE(FATAL_ERROR "Exact ${_name} version required is ${${_name}_FIND_VERSION}\n"
+                          "Your version is ${_version}")
+      SET(${_NAME_UPPER}_FOUND FALSE)
+    ELSEIF(_compatible LESS 0)
+      MESSAGE(FATAL_ERROR "Minimum ${_name} version required is ${${_name}_FIND_VERSION}\n"
+                          "Your version is ${_version}")
+      SET(${_NAME_UPPER}_FOUND FALSE)
+    ENDIF()
+  ENDIF(${_name}_FIND_VERSION)
+
+  # Raise scope (FindPackageHandleStandardArgs uses PARENT_SCOPE)
+  SET(${_NAME_UPPER}_FOUND ${${_NAME_UPPER}_FOUND} PARENT_SCOPE)
+
+ENDFUNCTION(FIND_PACKAGE_HANDLE_ADVANCED_ARGS)
Index: de/branches/buildsystem3/cmake/FindPkgConfig.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/FindPkgConfig.cmake	(revision 2663)
+++ 	(revision )
@@ -1,360 +1,0 @@
-# - a pkg-config module for CMake
-#
-# Usage:
-#   pkg_check_modules(<PREFIX> [REQUIRED] <MODULE> [<MODULE>]*)
-#     checks for all the given modules
-#
-#   pkg_search_module(<PREFIX> [REQUIRED] <MODULE> [<MODULE>]*)
-#     checks for given modules and uses the first working one
-#
-# When the 'REQUIRED' argument was set, macros will fail with an error
-# when module(s) could not be found
-#
-# It sets the following variables:
-#   PKG_CONFIG_FOUND         ... true iff pkg-config works on the system
-#   PKG_CONFIG_EXECUTABLE    ... pathname of the pkg-config program
-#   <PREFIX>_FOUND           ... set to 1 iff module(s) exist
-#
-# For the following variables two sets of values exist; first one is the
-# common one and has the given PREFIX. The second set contains flags
-# which are given out when pkgconfig was called with the '--static'
-# option.
-#   <XPREFIX>_LIBRARIES      ... only the libraries (w/o the '-l')
-#   <XPREFIX>_LIBRARY_DIRS   ... the paths of the libraries (w/o the '-L')
-#   <XPREFIX>_LDFLAGS        ... all required linker flags
-#   <XPREFIX>_LDFLAGS_OTHERS ... all other linker flags
-#   <XPREFIX>_INCLUDE_DIRS   ... the '-I' preprocessor flags (w/o the '-I')
-#   <XPREFIX>_CFLAGS         ... all required cflags
-#   <XPREFIX>_CFLAGS_OTHERS  ... the other compiler flags
-#
-#   <XPREFIX> = <PREFIX>        for common case
-#   <XPREFIX> = <PREFIX>_STATIC for static linking
-#
-# There are some special variables whose prefix depends on the count
-# of given modules. When there is only one module, <PREFIX> stays
-# unchanged. When there are multiple modules, the prefix will be
-# changed to <PREFIX>_<MODNAME>:
-#   <XPREFIX>_VERSION    ... version of the module
-#   <XPREFIX>_PREFIX     ... prefix-directory of the module
-#   <XPREFIX>_INCLUDEDIR ... include-dir of the module
-#   <XPREFIX>_LIBDIR     ... lib-dir of the module
-#
-#   <XPREFIX> = <PREFIX>  when |MODULES| == 1, else
-#   <XPREFIX> = <PREFIX>_<MODNAME>
-#
-# A <MODULE> parameter can have the following formats:
-#   {MODNAME}            ... matches any version
-#   {MODNAME}>={VERSION} ... at least version <VERSION> is required
-#   {MODNAME}={VERSION}  ... exactly version <VERSION> is required
-#   {MODNAME}<={VERSION} ... modules must not be newer than <VERSION>
-#
-# Examples
-#   pkg_check_modules (GLIB2   glib-2.0)
-#
-#   pkg_check_modules (GLIB2   glib-2.0>=2.10)
-#     requires at least version 2.10 of glib2 and defines e.g.
-#       GLIB2_VERSION=2.10.3
-#
-#   pkg_check_modules (FOO     glib-2.0>=2.10 gtk+-2.0)
-#     requires both glib2 and gtk2, and defines e.g.
-#       FOO_glib-2.0_VERSION=2.10.3
-#       FOO_gtk+-2.0_VERSION=2.8.20
-#
-#   pkg_check_modules (XRENDER REQUIRED xrender)
-#     defines e.g.:
-#       XRENDER_LIBRARIES=Xrender;X11
-#       XRENDER_STATIC_LIBRARIES=Xrender;X11;pthread;Xau;Xdmcp
-#
-#   pkg_search_module (BAR     libxml-2.0 libxml2 libxml>=2)
-
-
-# Copyright (C) 2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
-#
-# Redistribution and use, with or without modification, are permitted
-# provided that the following conditions are met:
-# 
-#    1. Redistributions must retain the above copyright notice, this
-#       list of conditions and the following disclaimer.
-#    2. The name of the author may not be used to endorse or promote
-#       products derived from this software without specific prior
-#       written permission.
-# 
-# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
-# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
-# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
-# GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
-# IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
-# IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-### Common stuff ####
-set(PKG_CONFIG_VERSION 1)
-set(PKG_CONFIG_FOUND   0)
-
-find_program(PKG_CONFIG_EXECUTABLE NAMES pkg-config DOC "pkg-config executable")
-mark_as_advanced(PKG_CONFIG_EXECUTABLE)
-
-if(PKG_CONFIG_EXECUTABLE)
-  set(PKG_CONFIG_FOUND 1)
-endif(PKG_CONFIG_EXECUTABLE)
-
-
-# Unsets the given variables
-macro(_pkgconfig_unset var)
-  set(${var} "" CACHE INTERNAL "")
-endmacro(_pkgconfig_unset)
-
-macro(_pkgconfig_set var value)
-  set(${var} ${value} CACHE INTERNAL "")
-endmacro(_pkgconfig_set)
-
-# Invokes pkgconfig, cleans up the result and sets variables
-macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp)
-  set(_pkgconfig_invoke_result)
-
-  execute_process(
-    COMMAND ${PKG_CONFIG_EXECUTABLE} ${ARGN} ${_pkglist}
-    OUTPUT_VARIABLE _pkgconfig_invoke_result
-    RESULT_VARIABLE _pkgconfig_failed)
-
-  if (_pkgconfig_failed)
-    set(_pkgconfig_${_varname} "")
-    _pkgconfig_unset(${_prefix}_${_varname})
-  else(_pkgconfig_failed)
-    string(REGEX REPLACE "[\r\n]"                  " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
-    string(REGEX REPLACE " +$"                     ""  _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
-
-    if (NOT ${_regexp} STREQUAL "")
-      string(REGEX REPLACE "${_regexp}" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}")
-    endif(NOT ${_regexp} STREQUAL "")
-
-    separate_arguments(_pkgconfig_invoke_result)
-
-    #message(STATUS "  ${_varname} ... ${_pkgconfig_invoke_result}")
-    set(_pkgconfig_${_varname} ${_pkgconfig_invoke_result})
-    _pkgconfig_set(${_prefix}_${_varname} "${_pkgconfig_invoke_result}")
-  endif(_pkgconfig_failed)
-endmacro(_pkgconfig_invoke)
-
-# Invokes pkgconfig two times; once without '--static' and once with
-# '--static'
-macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp)
-  _pkgconfig_invoke("${_pkglist}" ${_prefix}        ${_varname} "${cleanup_regexp}" ${ARGN})
-  _pkgconfig_invoke("${_pkglist}" ${_prefix} STATIC_${_varname} "${cleanup_regexp}" --static  ${ARGN})
-endmacro(_pkgconfig_invoke_dyn)
-
-# Splits given arguments into options and a package list
-macro(_pkgconfig_parse_options _result _is_req)
-  set(${_is_req} 0)
-  
-  foreach(_pkg ${ARGN})
-    if (_pkg STREQUAL "REQUIRED")
-      set(${_is_req} 1)
-    endif (_pkg STREQUAL "REQUIRED")
-  endforeach(_pkg ${ARGN})
-
-  set(${_result} ${ARGN})
-  list(REMOVE_ITEM ${_result} "REQUIRED")
-endmacro(_pkgconfig_parse_options)
-
-###
-macro(_pkg_check_modules_internal _is_required _is_silent _prefix)
-  _pkgconfig_unset(${_prefix}_FOUND)
-  _pkgconfig_unset(${_prefix}_VERSION)
-  _pkgconfig_unset(${_prefix}_PREFIX)
-  _pkgconfig_unset(${_prefix}_INCLUDEDIR)
-  _pkgconfig_unset(${_prefix}_LIBDIR)
-  _pkgconfig_unset(${_prefix}_LIBS)
-  _pkgconfig_unset(${_prefix}_LIBS_L)
-  _pkgconfig_unset(${_prefix}_LIBS_PATHS)
-  _pkgconfig_unset(${_prefix}_LIBS_OTHER)
-  _pkgconfig_unset(${_prefix}_CFLAGS)
-  _pkgconfig_unset(${_prefix}_CFLAGS_I)
-  _pkgconfig_unset(${_prefix}_CFLAGS_OTHER)
-  _pkgconfig_unset(${_prefix}_STATIC_LIBDIR)
-  _pkgconfig_unset(${_prefix}_STATIC_LIBS)
-  _pkgconfig_unset(${_prefix}_STATIC_LIBS_L)
-  _pkgconfig_unset(${_prefix}_STATIC_LIBS_PATHS)
-  _pkgconfig_unset(${_prefix}_STATIC_LIBS_OTHER)
-  _pkgconfig_unset(${_prefix}_STATIC_CFLAGS)
-  _pkgconfig_unset(${_prefix}_STATIC_CFLAGS_I)
-  _pkgconfig_unset(${_prefix}_STATIC_CFLAGS_OTHER)
-
-  # create a better addressable variable of the modules and calculate its size
-  set(_pkg_check_modules_list ${ARGN})
-  list(LENGTH _pkg_check_modules_list _pkg_check_modules_cnt)
-
-  if(PKG_CONFIG_EXECUTABLE)
-    # give out status message telling checked module
-    if (NOT ${_is_silent})
-      if (_pkg_check_modules_cnt EQUAL 1)
-        message(STATUS "checking for module '${_pkg_check_modules_list}'")
-      else(_pkg_check_modules_cnt EQUAL 1)
-        message(STATUS "checking for modules '${_pkg_check_modules_list}'")
-      endif(_pkg_check_modules_cnt EQUAL 1)
-    endif(NOT ${_is_silent})
-    
-    set(_pkg_check_modules_packages)
-    set(_pkg_check_modules_failed)
-
-    # iterate through module list and check whether they exist and match the required version
-    foreach (_pkg_check_modules_pkg ${_pkg_check_modules_list})
-      set(_pkg_check_modules_exist_query)
-
-      # check whether version is given
-      if (_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*")
-        string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\1" _pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}")
-        string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\2" _pkg_check_modules_pkg_op   "${_pkg_check_modules_pkg}")
-        string(REGEX REPLACE "(.*[^><])(>=|=|<=)(.*)" "\\3" _pkg_check_modules_pkg_ver  "${_pkg_check_modules_pkg}")
-      else(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*")
-        set(_pkg_check_modules_pkg_name "${_pkg_check_modules_pkg}")
-        set(_pkg_check_modules_pkg_op)
-        set(_pkg_check_modules_pkg_ver)
-      endif(_pkg_check_modules_pkg MATCHES ".*(>=|=|<=).*")
-
-      # handle the operands
-      if (_pkg_check_modules_pkg_op STREQUAL ">=")
-        list(APPEND _pkg_check_modules_exist_query --atleast-version)
-      endif(_pkg_check_modules_pkg_op STREQUAL ">=")
-
-      if (_pkg_check_modules_pkg_op STREQUAL "=")
-        list(APPEND _pkg_check_modules_exist_query --exact-version)
-      endif(_pkg_check_modules_pkg_op STREQUAL "=")
-      
-      if (_pkg_check_modules_pkg_op STREQUAL "<=")
-        list(APPEND _pkg_check_modules_exist_query --max-version)
-      endif(_pkg_check_modules_pkg_op STREQUAL "<=")
-
-      # create the final query which is of the format:
-      # * --atleast-version <version> <pkg-name>
-      # * --exact-version <version> <pkg-name>      
-      # * --max-version <version> <pkg-name>
-      # * --exists <pkg-name>
-      if (_pkg_check_modules_pkg_op)
-        list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_ver}")
-      else(_pkg_check_modules_pkg_op)
-        list(APPEND _pkg_check_modules_exist_query --exists)
-      endif(_pkg_check_modules_pkg_op)
-
-      _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_VERSION)
-      _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_PREFIX)
-      _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_INCLUDEDIR)
-      _pkgconfig_unset(${_prefix}_${_pkg_check_modules_pkg_name}_LIBDIR)
-
-      list(APPEND _pkg_check_modules_exist_query "${_pkg_check_modules_pkg_name}")
-      list(APPEND _pkg_check_modules_packages    "${_pkg_check_modules_pkg_name}")
-
-      # execute the query
-      execute_process(
-        COMMAND ${PKG_CONFIG_EXECUTABLE} ${_pkg_check_modules_exist_query}
-        RESULT_VARIABLE _pkgconfig_retval)
-
-      # evaluate result and tell failures
-      if (_pkgconfig_retval)
-        if(NOT ${_is_silent})
-          message(STATUS "  package '${_pkg_check_modules_pkg}' not found")
-        endif(NOT ${_is_silent})
-
-        set(_pkg_check_modules_failed 1)
-      endif(_pkgconfig_retval)
-    endforeach(_pkg_check_modules_pkg)
-
-    if(_pkg_check_modules_failed)
-      # fail when requested
-      if (${_is_required})
-        message(SEND_ERROR "A required package was not found")
-      endif (${_is_required})
-    else(_pkg_check_modules_failed)
-      # when we are here, we checked whether requested modules
-      # exist. Now, go through them and set variables
-      
-      _pkgconfig_set(${_prefix}_FOUND 1)
-      list(LENGTH _pkg_check_modules_packages pkg_count)
-
-      # iterate through all modules again and set individual variables
-      foreach (_pkg_check_modules_pkg ${_pkg_check_modules_packages})
-        # handle case when there is only one package required
-        if (pkg_count EQUAL 1)
-          set(_pkg_check_prefix "${_prefix}")
-        else(pkg_count EQUAL 1)
-          set(_pkg_check_prefix "${_prefix}_${_pkg_check_modules_pkg}")
-        endif(pkg_count EQUAL 1)
-        
-        _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" VERSION    ""   --modversion )
-        _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" PREFIX     ""   --variable=prefix )
-        _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR ""   --variable=includedir )
-        _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" LIBDIR     ""   --variable=libdir )
-
-        message(STATUS "  found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}")
-      endforeach(_pkg_check_modules_pkg)
-
-      # set variables which are combined for multiple modules
-      _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARIES           "(^| )-l" --libs-only-l )
-      _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARY_DIRS        "(^| )-L" --libs-only-L )
-      _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS             ""        --libs )
-      _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS_OTHER       ""        --libs-only-other )
-
-      _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS        "(^| )-I" --cflags-only-I )
-      _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS              ""        --cflags )
-      _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER        ""        --cflags-only-other )
-    endif(_pkg_check_modules_failed)
-  else(PKG_CONFIG_EXECUTABLE)
-    if (${_is_required})
-      message(SEND_ERROR "pkg-config tool not found")
-    endif (${_is_required})
-  endif(PKG_CONFIG_EXECUTABLE)
-endmacro(_pkg_check_modules_internal)
-
-###
-### User visible macros start here
-###
-
-###
-macro(pkg_check_modules _prefix _module0)
-  # check cached value
-  if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION})
-    _pkgconfig_parse_options   (_pkg_modules _pkg_is_required "${_module0}" ${ARGN})
-    _pkg_check_modules_internal("${_pkg_is_required}" 0 "${_prefix}" ${_pkg_modules})
-
-    _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
-  endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION})
-endmacro(pkg_check_modules)
-
-###
-macro(pkg_search_module _prefix _module0)
-  # check cached value
-  if (NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION})
-    set(_pkg_modules_found 0)
-    _pkgconfig_parse_options(_pkg_modules_alt _pkg_is_required "${_module0}" ${ARGN})
-
-    message(STATUS "checking for one of the modules '${_pkg_modules_alt}'")
-
-    # iterate through all modules and stop at the first working one.
-    foreach(_pkg_alt ${_pkg_modules_alt})
-      if(NOT _pkg_modules_found)
-        _pkg_check_modules_internal(0 1 "${_prefix}" "${_pkg_alt}")
-      endif(NOT _pkg_modules_found)
-
-      if (${_prefix}_FOUND)
-        set(_pkg_modules_found 1)
-      endif(${_prefix}_FOUND)
-    endforeach(_pkg_alt)
-
-    if (NOT ${_prefix}_FOUND)
-      if(${_pkg_is_required})
-        message(SEND_ERROR "None of the required '${_pkg_modules_alt}' found")
-      endif(${_pkg_is_required})
-    endif(NOT ${_prefix}_FOUND)
-    
-    _pkgconfig_set(__pkg_config_checked_${_prefix} ${PKG_CONFIG_VERSION})
-  endif(NOT DEFINED __pkg_config_checked_${_prefix} OR __pkg_config_checked_${_prefix} LESS ${PKG_CONFIG_VERSION})  
-endmacro(pkg_search_module)
-
-### Local Variables:
-### mode: cmake
-### End:
Index: de/branches/buildsystem3/cmake/FindTCL.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/FindTCL.cmake	(revision 2663)
+++ 	(revision )
@@ -1,90 +1,0 @@
-# - Find Tcl includes and libraries.
-# This module finds if TCL is installed and determines where the
-# include files and libraries are. It also determines what the name of
-# the library is. This code sets the following variables:
-#  TCL_LIBRARY        = path to Tcl library (tcl tcl80)
-#  TCL_LIBRARY_DEBUG  = path to Tcl library (debug)
-#  TCL_INCLUDE_PATH   = path to where tcl.h can be found
-#
-# Several changes and additions by Fabian 'x3n' Landau
-#                 > www.orxonox.net <
-
-IF (TCL_LIBRARY AND TCL_INCLUDE_PATH)
-  SET(TCL_FIND_QUIETLY TRUE)
-ENDIF (TCL_LIBRARY AND TCL_INCLUDE_PATH)
-
-SET (TCLTK_POSSIBLE_LIB_PATHS
-  "${TCL_TCLSH_PATH}/../lib"
-  "${TK_WISH_PATH}/../lib"
-  "${TCL_INCLUDE_PATH}/../lib"
-  "${TK_INCLUDE_PATH}/../lib"
-  "$ENV{ProgramFiles}/Tcl/Lib"
-  "C:/Program Files/Tcl/lib" 
-  "C:/Tcl/lib" 
-  [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/lib
-  [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/lib
-  /usr/lib 
-  /usr/local/lib
-  /usr/pack/tcltk-8.4.9.linux-mo/lib
-  ../libs/tcl8.5.2/win
-  ../libs/tcl8.5.2/unix
-  ../libs/tcl8.5.2/macosx
-  ${DEPENDENCY_DIR}/tcl-8.5.2/lib
-)
-
-FIND_LIBRARY(TCL_LIBRARY
-  NAMES tcl tcl85 tcl8.5 tcl84 tcl8.4 tcl85t
-  PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
-)
-
-FIND_LIBRARY(TCL_LIBRARY_DEBUG
-  NAMES tcld tcl85d tcl8.5d tcl84d tcl8.4d
-  PATHS ${TCLTK_POSSIBLE_LIB_PATHS}
-)
-
-SET (TCLTK_POSSIBLE_INCLUDE_PATHS
-  ${TCL_TCLSH_PATH}/../include
-  ${TK_WISH_PATH}/../include
-  "${TCL_LIBRARY_PATH}/../include"
-  "${TK_LIBRARY_PATH}/../include"
-  [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.5;Root]/include
-  [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/include
-  "$ENV{ProgramFiles}/Tcl/include"
-  "C:/Program Files/Tcl/include"
-  C:/Tcl/include
-  /usr/include
-  /usr/local/include
-  /usr/include/tcl8.5
-  /usr/include/tcl8.4
-  ../libs/tcl8.5.2/generic
-  ${DEPENDENCY_DIR}/tcl-8.5.2/include
-)
-
-FIND_PATH(TCL_INCLUDE_PATH tcl.h
-  ${TCL_FRAMEWORK_INCLUDES} ${TCLTK_POSSIBLE_INCLUDE_PATHS}
-)
-
-
-IF (TCL_LIBRARY AND TCL_INCLUDE_PATH)
-  IF (NOT TCL_FIND_QUIETLY)
-    MESSAGE(STATUS "Tcl was found")
-    IF (VERBOSE_FIND)
-      MESSAGE (STATUS "  include path: ${TCL_INCLUDE_PATH}")
-      MESSAGE (STATUS "  library path: ${TCL_LIBRARY}")
-      MESSAGE (STATUS "  libraries:    tcld tcl85d tcl8.5d tcl84d tcl8.4d")
-    ENDIF (VERBOSE_FIND)
-  ENDIF (NOT TCL_FIND_QUIETLY)
-ELSE (TCL_LIBRARY AND TCL_INCLUDE_PATH)
-  IF (NOT TCL_INCLUDE_PATH)
-    MESSAGE(SEND_ERROR "Tcl include path was not found.")
-  ENDIF (NOT TCL_INCLUDE_PATH)
-  IF (NOT TCL_LIBRARY )
-    MESSAGE(SEND_ERROR "Tcl library was not found.")
-  ENDIF (NOT TCL_LIBRARY )
-ENDIF (TCL_LIBRARY AND TCL_INCLUDE_PATH)
-
-IF(TCL_INCLUDE_PATH)
-  IF(TCL_LIBRARY)
-    SET(TCL_FOUND 1)
-  ENDIF(TCL_LIBRARY)
-ENDIF(TCL_INCLUDE_PATH)
Index: /code/branches/buildsystem3/cmake/FindVorbis.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/FindVorbis.cmake	(revision 2664)
+++ /code/branches/buildsystem3/cmake/FindVorbis.cmake	(revision 2664)
@@ -0,0 +1,62 @@
+# - Try to find ogg/vorbis
+# Once done this will define
+#
+#  VORBIS_FOUND - system has vorbis
+#  VORBIS_INCLUDE_DIR
+#  VORBIS_LIBRARIES - vorbis and vorbisfile libraries
+#
+# $VORBISDIR is an environment variable used
+# for finding vorbis.
+#
+# Several changes and additions by Fabian 'x3n' Landau
+# Most of all rewritten by Adrian Friedli
+# Debug versions and simplifications by Reto Grieder
+#                 > www.orxonox.net <
+
+INCLUDE(FindPackageHandleStandardArgs)
+INCLUDE(HandleLibraryTypes)
+
+FIND_PATH(VORBIS_INCLUDE_DIR vorbis/codec.h
+  PATHS $ENV{VORBISDIR}
+  PATH_SUFFIXES include
+)
+FIND_LIBRARY(VORBIS_LIBRARY_OPTIMIZED
+  NAMES vorbis
+  PATHS $ENV{VORBISDIR}
+  PATH_SUFFIXES lib
+)
+FIND_LIBRARY(VORBIS_LIBRARY_DEBUG
+  NAMES vorbisd vorbis_d vorbisD vorbis_D
+  PATHS $ENV{VORBISDIR}
+  PATH_SUFFIXES lib
+)
+FIND_LIBRARY(VORBISFILE_LIBRARY_OPTIMIZED
+  NAMES vorbisfile
+  PATHS $ENV{VORBISDIR}
+  PATH_SUFFIXES lib
+)
+FIND_LIBRARY(VORBISFILE_LIBRARY_DEBUG
+  NAMES vorbisfiled vorbisfile_d vorbisfileD vorbisfile_D
+  PATHS $ENV{VORBISDIR}
+  PATH_SUFFIXES lib
+)
+
+# Handle the REQUIRED argument and set VORBIS_FOUND
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(Vorbis DEFAULT_MSG
+  VORBIS_LIBRARY_OPTIMIZED
+  VORBISFILE_LIBRARY_OPTIMIZED
+  VORBIS_INCLUDE_DIR
+)
+
+# Collect optimized and debug libraries
+HANDLE_LIBRARY_TYPES(VORBIS)
+HANDLE_LIBRARY_TYPES(VORBISFILE)
+SET(VORBIS_LIBRARIES ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY})
+
+MARK_AS_ADVANCED(
+  VORBIS_INCLUDE_DIR
+  VORBIS_LIBRARY_OPTIMIZED
+  VORBIS_LIBRARY_DEBUG
+  VORBISFILE_LIBRARY_OPTIMIZED
+  VORBISFILE_LIBRARY_DEBUG
+)
Index: de/branches/buildsystem3/cmake/FindZLIB.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/FindZLIB.cmake	(revision 2663)
+++ 	(revision )
@@ -1,76 +1,0 @@
-# - Find zlib
-# Find the native ZLIB includes and library
-#
-#  ZLIB_INCLUDE_DIR - where to find zlib.h, etc.
-#  ZLIB_LIBRARY     - List of libraries when using zlib.
-#  ZLIB_FOUND       - True if zlib found.
-#
-#  Modified by Nicolas Schlumberger, (c) 2007
-#  to make it work on the Tardis Infrastucture of the ETH Zurich
-#
-# Several changes and additions by Fabian 'x3n' Landau
-#                 > www.orxonox.net <
-
-IF (ZLIB_INCLUDE_DIR)
-  SET(ZLIB_FIND_QUIETLY TRUE)
-ENDIF (ZLIB_INCLUDE_DIR)
-
-IF(UNIX)
-  FIND_PATH(ZLIB_INCLUDE_DIR zlib.h
-    /usr/pack/zziplib-0.13.49-sd/include/
-    /usr/local/include
-    /usr/include
-  )
-
-  SET(ZLIB_NAMES z zlib zdll)
-  FIND_LIBRARY(ZLIB_LIBRARY
-    NAMES ${ZLIB_NAMES}
-    PATHS /usr/pack/zziplib-0.13.49-sd/i686-debian-linux3.1/lib/ /usr/lib /usr/local/lib
-  )
-ENDIF(UNIX)
-
-IF(WIN32)
-  IF(EXISTS "../libs/zlib")
-    SET (ZLIB_LIBRARY_DIR "../libs/zlib")
-  ENDIF(EXISTS "../libs/zlib")
-
-  FIND_PATH(ZLIB_INCLUDE_DIR zlib.h
-    ../libs/zlib/include
-    ${DEPENDENCY_DIR}/zlib-1.2.3/include
-  )
-
-  FIND_LIBRARY(ZLIB_LIBRARY
-    NAMES zlib
-    PATHS ${ZLIB_LIBRARY_DIR}
-    ${DEPENDENCY_DIR}/zlib-1.2.3/lib
-  )
-ENDIF(WIN32)
-
-SET(ZLIB_FOUND FALSE)
-IF (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)
-  SET(ZLIB_FOUND TRUE)
-ENDIF (ZLIB_INCLUDE_DIR AND ZLIB_LIBRARY)
-
-IF (ZLIB_FOUND)
-  IF (NOT ZLIB_FIND_QUIETLY)
-    MESSAGE(STATUS "ZLIB was found.")
-    IF (VERBOSE_FIND)
-      MESSAGE (STATUS "  include path: ${ZLIB_INCLUDE_DIR}")
-      MESSAGE (STATUS "  library path: ${ZLIB_LIBRARY}")
-      MESSAGE (STATUS "  libraries:    zlib")
-    ENDIF (VERBOSE_FIND)
-  ENDIF (NOT ZLIB_FIND_QUIETLY)
-ELSE (ZLIB_FOUND)
-  IF (NOT ZLIB_INCLUDE_DIR)
-    MESSAGE(SEND_ERROR "ZLIB include path was not found.")
-  ENDIF (NOT ZLIB_INCLUDE_DIR)
-  IF (NOT ZLIB_LIBRARY)
-    MESSAGE(SEND_ERROR "ZLIB was not found.")
-    MESSAGE(STATUS "Looked for Z libraries named ${ZLIBS_NAMES}.")
-  ENDIF (NOT ZLIB_LIBRARY)
-ENDIF (ZLIB_FOUND)
-
-MARK_AS_ADVANCED(
-  ZLIB_LIBRARY
-  ZLIB_INCLUDE_DIR
-)
Index: /code/branches/buildsystem3/cmake/FlagUtilities.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/FlagUtilities.cmake	(revision 2664)
+++ /code/branches/buildsystem3/cmake/FlagUtilities.cmake	(revision 2664)
@@ -0,0 +1,211 @@
+ #
+ #             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:
+ #    Sets the compiler/linker flags. After the flags you can specify more args:
+ #    Release, Debug, RelWithDebInfo, MinSizeRel: Build configs (inclusive)
+ #    ReleaseAll: Sets the flags of all three release builds
+ #    CACHE: Values are witten with SET_CACHE (see above)
+ #    FORCE: When writing to the cache, the values are set anyway
+ #    Any variable names (like WIN32, MSVC, etc.): Condition (combined with AND)
+ #    You can suffix the condition with a NOT if you wish
+ #  Functions:
+ #    [ADD/SET/REMOVE]_[COMPILER/LINKER]_FLAGS
+ #  Caution: -If you use CACHE after calling the macro without CACHE, the value
+ #            Will not get written unless FORCE is specified.
+ #          - Also be aware to always specify the flags in quotes.
+ #  Example:
+ #    REMOVE_COMPILER_FLAGS("/Gm "asdf" -q"test -foo" CXX ReleaseAll NOT UNIX)
+ #    This will only remove the CXX (C++) flags on a non Unix system for the
+ #    Release, RelWithDebInfo and MinSizeRel configurations. The macros should
+ #    be able to cope with "test -foo" that is like another flag in the string.
+ #
+
+# Write to the cache by force, but only if the user didn't edit the value
+# Additional argument is the value (may also be a list)
+MACRO(SET_CACHE _varname _type _docstring)
+  SET(_value ${ARGN})
+  IF(NOT "${_type}" MATCHES "^(STRING|BOOL|PATH|FILEPATH)$")
+    MESSAGE(FATAL_ERROR "${_type} is not a valid CACHE entry type")
+  ENDIF()
+
+  IF(NOT DEFINED _INTERNAL_${_varname} OR "${_INTERNAL_${_varname}}" STREQUAL "${${_varname}}")
+    SET(${_varname} "${_value}" CACHE ${_type} "${_docstring}" FORCE)
+    SET(_INTERNAL_${_varname} "${_value}" CACHE INTERNAL "Do not edit in any case!")
+  ENDIF()
+ENDMACRO(SET_CACHE)
+
+# Separates a string of flags. " -" or " /" denotes the start of a flag.
+# The same sequence inside double quotation marks is ignored.
+# Spaces not within quotes are cleaned meaningfully.
+# This macro cannot cope with semicolons in the flag string!
+MACRO(SEPARATE_FLAGS _flags _output_variable)
+  SET(_flags_prep " ${_flags} -")
+  STRING(REPLACE " " " ;" _flag_chunks ${_flags_prep}) # Max loop iterations
+  SET(_flag_string)
+  SET(_parsed_flags)
+  # Loop is necessary because the regex engine is greedy
+  FOREACH(_chunk ${_flag_chunks})
+    SET(_flag_string "${_flag_string}${_chunk}")
+    # Replace all " -" and " /" inside quotation marks
+    STRING(REGEX REPLACE "^(([^\"]*\"[^\"]*\")*[^\"]*\"[^\"]*) [/-]([^\"]*\")"
+           "\\1@39535493@\\3" _flag_string "${_flag_string}")
+    # Extract one flag if possible
+    SET(_flag)
+    STRING(REGEX REPLACE "^.* [/-](.+)( [/-].*$)" "-\\1" _flag "${_flag_string}")
+    STRING(REGEX REPLACE "^.* [/-](.+)( [/-].*$)" "\\2"  _flag_string "${_flag_string}")
+    IF(NOT _flag STREQUAL _flag_string)
+      LIST(APPEND _parsed_flags "${_flag}")
+    ENDIF(NOT _flag STREQUAL _flag_string)
+  ENDFOREACH(_chunk)
+
+  # Re-replace all " -" and " /" inside quotation marks
+  STRING(REGEX REPLACE "@39535493@" " -" ${_output_variable} "${_parsed_flags}")
+ENDMACRO(SEPARATE_FLAGS)
+
+# Internal macro, do not use
+# Modifies the flags according to the mode: set, add or remove
+# Also sets flags according to the CACHE and FORCE parameter.
+# If only CACHE is specified, SET_CACHE() is used.
+MACRO(_INTERNAL_PARSE_FLAGS _mode _flags _varname _write_to_cache _force)
+  SEPARATE_FLAGS("${_flags}" _arg_flag_list)
+
+  IF("${_mode}" STREQUAL "SET")
+    # SET
+    SET(_flag_list "${_arg_flag_list}")
+  ELSE()
+    # ADD or REMOVE
+    SEPARATE_FLAGS("${${_varname}}" _flag_list)
+    FOREACH(_flag ${_arg_flag_list})
+      LIST(${_mode} _flag_list "${_flag}")
+    ENDFOREACH(_flag)
+  ENDIF()
+
+  LIST(REMOVE_DUPLICATES _flag_list)
+  LIST(SORT _flag_list)
+  STRING(REPLACE ";" " " _flag_list "${_flag_list}")
+
+  IF(_write_to_cache)
+    IF(_force)
+      SET(${_varname} "${_flag_list}" CACHE STRING "${${_varname}}" FORCE)
+      SET(${_varname} "${_flag_list}" CACHE STRING "${${_varname}}" FORCE)
+    ELSE()
+      SET_CACHE(${_varname} STRING "${${_varname}}" "${_flag_list}")
+    ENDIF()
+  ELSE()
+    SET(${_varname} "${_flag_list}")
+  ENDIF()
+ENDMACRO(_INTERNAL_PARSE_FLAGS)
+
+# Internal macro, do not use
+# Parses the given additional arguments and sets the flags to the
+# corresponding variables.
+MACRO(_INTERNAL_PARSE_FLAGS_ARGS _mode _keys _key_postfix _flags)
+  SET(_langs)
+  SET(_build_types)
+  SET(_cond TRUE)
+  SET(_invert_condition FALSE)
+  SET(_write_to_cache FALSE)
+  SET(_force FALSE)
+  STRING(REPLACE ";" "|" _key_regex "${_keys}")
+  SET(_key_regex "^(${_key_regex})$")
+
+  FOREACH(_arg ${ARGN})
+    IF(_arg MATCHES "${_key_regex}")
+      LIST(APPEND _langs "${_arg}")
+    ELSEIF(   _arg MATCHES "^(Debug|Release|MinSizeRel|RelWithDebInfo)$"
+           OR _arg MATCHES "^(DEBUG|RELEASE|MINSIZEREL|RELWITHDEBINFO)$")
+      STRING(TOUPPER "${_arg}" _upper_arg)
+      LIST(APPEND _build_types ${_upper_arg})
+    ELSEIF(_arg STREQUAL "ReleaseAll")
+      LIST(APPEND _build_types RELEASE MINSIZEREL RELWITHDEBINFO)
+    ELSEIF(_arg STREQUAL "CACHE")
+      SET(_write_to_cache TRUE)
+    ELSEIF(_arg STREQUAL "FORCE")
+      SET(_force TRUE)
+    ELSEIF(_arg MATCHES "^[Nn][Oo][Tt]$")
+      SET(_invert_condition TRUE)
+    ELSE()
+      IF(_invert_condition)
+        SET(_invert_condition FALSE)
+    IF(${_arg})
+          SET(_arg_cond FALSE)
+    ELSE()
+          SET(_arg_cond TRUE)
+    ENDIF()
+      ELSE()
+        SET(_arg_cond ${${_arg}})
+      ENDIF()
+      IF(_cond AND _arg_cond)
+        SET(_cond TRUE)
+      ELSE()
+        SET(_cond FALSE)
+      ENDIF()
+    ENDIF()
+  ENDFOREACH(_arg)
+
+  # No language specified, use all: C and CXX or EXE, SHARED and MODULE
+  IF(NOT DEFINED _langs)
+    SET(_langs ${_keys})
+  ENDIF()
+
+  IF(_cond)
+    FOREACH(_lang ${_langs})
+      SET(_varname "CMAKE_${_lang}${_key_postfix}_FLAGS")
+      IF(DEFINED _build_types)
+        FOREACH(_build_type ${_build_types})
+          _INTERNAL_PARSE_FLAGS(${_mode} "${_flags}" ${_varname}_${_build_type} ${_write_to_cache} ${_force})
+        ENDFOREACH(_build_type)
+      ELSE()
+        _INTERNAL_PARSE_FLAGS(${_mode} "${_flags}" ${_varname} ${_write_to_cache} ${_force})
+      ENDIF()
+    ENDFOREACH(_lang ${_langs})
+  ENDIF(_cond)
+ENDMACRO(_INTERNAL_PARSE_FLAGS_ARGS)
+
+
+# Compiler flags, additional arguments:
+# C, CXX: Specify a language, default is both
+MACRO(SET_COMPILER_FLAGS _flags)
+  _INTERNAL_PARSE_FLAGS_ARGS(SET "C;CXX" "" "${_flags}" "${ARGN}")
+ENDMACRO(SET_COMPILER_FLAGS)
+# Add flags (flags don't get added twice)
+MACRO(ADD_COMPILER_FLAGS _flags)
+  _INTERNAL_PARSE_FLAGS_ARGS(APPEND "C;CXX" "" "${_flags}" "${ARGN}")
+ENDMACRO(ADD_COMPILER_FLAGS)
+# Remove flags
+MACRO(REMOVE_COMPILER_FLAGS _flags)
+  _INTERNAL_PARSE_FLAGS_ARGS(REMOVE_ITEM "C;CXX" "" "${_flags}" "${ARGN}")
+ENDMACRO(REMOVE_COMPILER_FLAGS)
+
+# Linker flags, additional arguments:
+# EXE, SHARED, MODULE: Specify a linker mode, default is all three
+MACRO(SET_LINKER_FLAGS _flags)
+  _INTERNAL_PARSE_FLAGS_ARGS(SET "EXE;SHARED;MODULE" "_LINKER" "${_flags}" "${ARGN}")
+ENDMACRO(SET_LINKER_FLAGS)
+# Add flags (flags don't get added twice)
+MACRO(ADD_LINKER_FLAGS _flags)
+  _INTERNAL_PARSE_FLAGS_ARGS(APPEND "EXE;SHARED;MODULE" "_LINKER" "${_flags}" "${ARGN}")
+ENDMACRO(ADD_LINKER_FLAGS)
+# Remove flags
+MACRO(REMOVE_LINKER_FLAGS _flags)
+  _INTERNAL_PARSE_FLAGS_ARGS(REMOVE_ITEM "EXE;SHARED;MODULE" "_LINKER" "${_flags}" "${ARGN}")
+ENDMACRO(REMOVE_LINKER_FLAGS)
Index: /code/branches/buildsystem3/cmake/GenerateToluaBindings.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/GenerateToluaBindings.cmake	(revision 2664)
+++ /code/branches/buildsystem3/cmake/GenerateToluaBindings.cmake	(revision 2664)
@@ -0,0 +1,70 @@
+ #
+ #             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:
+ #    Adrian Friedli
+ #  Description:
+ #    Sets the CMake options that will generate Tolua++ bindings.
+ #  Parameters:
+ #    _tolua_package - Name of the package, e.g. "Core"
+ #    _target_source_files - Variable name of the target source files, the
+ #                           script will add the generated files to this list.
+ #    ARGN - The header files in the style "INTPUTFILES Foo.h Bar.h"
+ #  Global Variables: (need to be set before)
+ #    TOLUA_PARSER_SOURCE - Lua file with the parser source code
+ #    TOLUA_PARSER_DEPENDENCIES - All the dependent lua files
+ #    ORXONOX_RUNTIME_LIBRARY_DIRECTORY - Working directory
+ #
+
+FUNCTION(GENERATE_TOLUA_BINDINGS _tolua_package _target_source_files)
+  SET(_tolua_inputfiles ${ARGN})
+  LIST(REMOVE_ITEM _tolua_inputfiles "INPUTFILES")
+
+  SET(_tolua_pkgfile "${CMAKE_CURRENT_BINARY_DIR}/tolua.pkg")
+  SET(_tolua_cxxfile "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/ToluaBind${_tolua_package}.cc")
+  SET(_tolua_hfile   "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/ToluaBind${_tolua_package}.h")
+
+  SET(${_target_source_files}
+    ${${_target_source_files}}
+    ${_tolua_cxxfile}
+    ${_tolua_hfile}
+    PARENT_SCOPE
+  )
+  SOURCE_GROUP("Tolua" FILES ${_tolua_cxxfile} ${_tolua_hfile})
+
+  # Create temporary package file
+  FILE(REMOVE ${_tolua_pkgfile})
+  FOREACH(_tolua_inputfile ${_tolua_inputfiles})
+    FILE(APPEND ${_tolua_pkgfile} "\$cfile \"${_tolua_inputfile}\"\n")
+  ENDFOREACH(_tolua_inputfile)
+
+  ADD_CUSTOM_COMMAND(
+    OUTPUT ${_tolua_cxxfile} ${_tolua_hfile}
+    COMMAND tolua++app_orxonox -n ${_tolua_package}
+                               -w ${CMAKE_CURRENT_SOURCE_DIR}
+                               -o ${_tolua_cxxfile}
+                               -H ${_tolua_hfile}
+                               -s ${TOLUA_PARSER_SOURCE}
+                                  ${_tolua_pkgfile}
+    DEPENDS              ${TOLUA_PARSER_DEPENDENCIES}
+    IMPLICIT_DEPENDS CXX ${_tolua_inputfiles}
+    WORKING_DIRECTORY    ${ORXONOX_RUNTIME_LIBRARY_DIRECTORY}
+    COMMENT "Generating tolua bind files for package ${_tolua_package}"
+  )
+ENDFUNCTION(GENERATE_TOLUA_BINDINGS)
Index: /code/branches/buildsystem3/cmake/HandleLibraryTypes.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/HandleLibraryTypes.cmake	(revision 2664)
+++ /code/branches/buildsystem3/cmake/HandleLibraryTypes.cmake	(revision 2664)
@@ -0,0 +1,42 @@
+ #
+ #             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:
+ #    Checks debug and optimized libaries and sets the variable ${_name}_LIBRARY
+ #    accordingly. If only an optimized library was found, the "optimized"
+ #    keyword is omitted to support the debug version too.
+ #
+
+FUNCTION(HANDLE_LIBRARY_TYPES _name)
+  # Additional libraries can be added as additional arguments
+  IF(${_name}_LIBRARY_DEBUG AND ${_name}_LIBRARY_OPTIMIZED)
+    SET(${_name}_LIBRARY
+      optimized ${${_name}_LIBRARY_OPTIMIZED} ${ARGN}
+      debug     ${${_name}_LIBRARY_DEBUG}     ${ARGN}
+      PARENT_SCOPE
+    )
+  ELSE()
+    SET(${_name}_LIBRARY
+      ${${_name}_LIBRARY_OPTIMIZED} ${ARGN}
+      PARENT_SCOPE
+     )
+  ENDIF()
+ENDFUNCTION(HANDLE_LIBRARY_TYPES)
Index: /code/branches/buildsystem3/cmake/InstallUtilities.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/InstallUtilities.cmake	(revision 2664)
+++ /code/branches/buildsystem3/cmake/InstallUtilities.cmake	(revision 2664)
@@ -0,0 +1,34 @@
+ #
+ #             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:
+ #    Helps configuring the INSTALL command in more global way.
+ #  Parameters:
+ #    Specifiy the targets as additional parameter.
+ #
+
+FUNCTION(ORXONOX_INSTALL)
+  INSTALL(TARGETS ${ARGN}
+    RUNTIME DESTINATION ${ORXONOX_RUNTIME_INSTALL_PATH}
+    LIBRARY DESTINATION ${ORXONOX_LIBRARY_INSTALL_PATH}
+    #ARCHIVE DESTINATION ${ORXONOX_ARCHIVE_INSTALL_PATH}
+  )
+ENDFUNCTION(ORXONOX_INSTALL)
Index: /code/branches/buildsystem3/cmake/LibraryConfig.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/LibraryConfig.cmake	(revision 2664)
+++ /code/branches/buildsystem3/cmake/LibraryConfig.cmake	(revision 2664)
@@ -0,0 +1,201 @@
+ #
+ #             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:
+ #    Configures the external libraries. Whenever possible, the find scripts
+ #    from the CMake module path are used, but that required some adjustments
+ #    for certain libraries (Boost, OpenAL, TCL)
+ #
+ 
+INCLUDE(CompareVersionStrings)
+INCLUDE(FindPackageHandleStandardArgs)
+
+# Prevent CMake from finding libraries in the installation folder on windows
+# There might already be an installation from another compiler
+LIST(REMOVE_ITEM CMAKE_SYSTEM_PREFIX_PATH "${CMAKE_INSTALL_PREFIX}")
+LIST(REMOVE_ITEM CMAKE_SYSTEM_LIBRARY_PATH "${CMAKE_INSTALL_PREFIX}/bin")
+
+############## Platform Scripts #################
+
+# On Windows using a package causes way less problems
+SET(_option_msg "Set this to true to use precompiled dependecy archives")
+IF(WIN32)
+  OPTION(USE_DEPENDENCY_PACKAGE "${_option_msg}" ON)
+ELSE(WIN32)
+  OPTION(USE_DEPENDENCY_PACKAGE "${_option_msg}" FALSE)
+ENDIF(WIN32)
+
+# Scripts for specific library and CMake config
+INCLUDE(LibraryConfigTardis)
+INCLUDE(LibraryConfigApple)
+
+IF(USE_DEPENDENCY_PACKAGE)
+  FIND_PATH(DEPENDENCY_DIR
+    NAMES PackageConfigMSVC.cmake PackageConfigMinGW.cmake
+    PATHS
+      ${CMAKE_SOURCE_DIR}/dependencies
+      ${CMAKE_SOURCE_DIR}/../dependencies
+      ${CMAKE_SOURCE_DIR}/../lib_dist/dependencies
+  )
+  IF(NOT DEPENDENCY_DIR)
+    MESSAGE(STATUS "Warning: Could not find dependency directory."
+                   "Disable LIBRARY_USE_PACKAGE if you have none intalled.")
+  ELSE()
+    FILE(GLOB _package_config_files "${DEPENDENCY_DIR}/PackageConfig*.cmake")
+    FOREACH(_file ${_package_config_files})
+      INCLUDE(${_file})
+    ENDFOREACH(_file)
+
+    # On Windows, DLLs have to be in the executable folder
+    IF(DEP_BINARY_DIR AND WIN32)
+      # When installing a debug version, we really can't know which libraries
+      # are used in released mode because there might be deps of deps.
+      INSTALL(
+        DIRECTORY ${DEP_BINARY_DIR}/
+        DESTINATION bin
+        CONFIGURATIONS Debug
+        REGEX "^.*\\.pdb$" EXCLUDE
+      )
+
+      # Try to filter out all the debug libraries. If the regex doesn't do the
+      # job anymore, simply adjust it.
+      INSTALL(
+        DIRECTORY ${DEP_BINARY_DIR}/
+        DESTINATION bin
+        CONFIGURATIONS Release RelWithDebInfo MinSizeRel
+        REGEX "_[Dd]\\.[a-zA-Z0-9+-]+$|-mt-gd-|^.*\\.pdb$" EXCLUDE
+      )
+    ENDIF(DEP_BINARY_DIR AND WIN32)
+  ENDIF(NOT DEPENDENCY_DIR)
+ENDIF(USE_DEPENDENCY_PACKAGE)
+
+# User script
+SET(LIBRARY_CONFIG_USER_SCRIPT "" CACHE FILEPATH
+    "Specify a CMake script if you wish to write your own library path config.
+     See LibraryConfigTardis.cmake or LibraryConfigMinGW.cmake for examples.")
+IF(LIBRARY_CONFIG_USER_SCRIPT)
+  IF(EXISTS ${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT}.cmake)
+    INCLUDE(${LIBRARY_CONFIG_USER_SCRIPT})
+  ELSEIF(EXISTS ${LIBRARY_CONFIG_USER_SCRIPT})
+    INCLUDE(${LIBRARY_CONFIG_USER_SCRIPT})
+  ELSEIF(EXISTS ${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT})
+    INCLUDE(${CMAKE_MODULE_PATH}/${LIBRARY_CONFIG_USER_SCRIPT})
+  ENDIF()
+ENDIF(LIBRARY_CONFIG_USER_SCRIPT)
+
+
+############### Library finding #################
+# Performs the search and sets the variables    #
+
+FIND_PACKAGE(OGRE  1.4 EXACT REQUIRED)
+FIND_PACKAGE(ENet  1.1       REQUIRED)
+FIND_PACKAGE(Ogg             REQUIRED)
+FIND_PACKAGE(Vorbis          REQUIRED)
+FIND_PACKAGE(ALUT            REQUIRED)
+FIND_PACKAGE(ZLIB            REQUIRED)
+IF(WIN32)
+  FIND_PACKAGE(DirectX       REQUIRED)
+ENDIF(WIN32)
+
+##### 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.
+
+# 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
+IF(OPENAL_INCLUDE_DIR MATCHES "/AL$")
+  GET_FILENAME_COMPONENT(ALT_OPENAL_INCLUDE_DIR ${OPENAL_INCLUDE_DIR} PATH)
+ENDIF()
+SET(OPENAL_INCLUDE_DIRS ${OPENAL_INCLUDE_DIR} ${ALT_OPENAL_INCLUDE_DIR})
+# Notfiy user
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenAL DEFAULT_MSG OPENAL_LIBRARY OPENAL_INCLUDE_DIR)
+# Hide variables created by the script
+MARK_AS_ADVANCED(OPENAL_INCLUDE_DIR OPENAL_LIBRARY)
+
+##### Tcl #####
+# We only require Tcl, so avoid confusing user about other Tcl stuff by
+# applying a little workaround
+SET(Tclsh_FIND_QUIETLY TRUE)
+FIND_PACKAGE(TCL 8.4 REQUIRED QUIET)
+# Display messages separately
+SET(TCL_FIND_QUIETLY FALSE)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(TCL DEFAULT_MSG TCL_LIBRARY TCL_INCLUDE_PATH)
+
+##### Boost #####
+# Expand the next statement if newer boost versions than 1.36.1 are released
+SET(Boost_ADDITIONAL_VERSIONS 1.37 1.37.0)
+# MSVC seems to be the only compiler requiring date_time
+IF(MSVC)
+  FIND_PACKAGE(Boost 1.34 REQUIRED thread filesystem date_time)
+ELSE(MSVC)
+  FIND_PACKAGE(Boost 1.34 REQUIRED thread filesystem)
+ENDIF(MSVC)
+# Boost 1.35 and newer also need the 'System' library
+IF(NOT Boost_VERSION LESS 103500)
+  FIND_PACKAGE(Boost 1.35 REQUIRED system)
+ENDIF()
+
+####### Static/Dynamic linking options ##########
+
+# On Windows dynamically linked libraries need some special treatment
+# 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)
+ENDIF(WIN32)
Index: /code/branches/buildsystem3/cmake/LibraryConfigApple.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/LibraryConfigApple.cmake	(revision 2664)
+++ /code/branches/buildsystem3/cmake/LibraryConfigApple.cmake	(revision 2664)
@@ -0,0 +1,43 @@
+ #
+ #             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:
+ #    Yuning Chai
+ #  Description:
+ #    Sets necessary library options and paths on Mac.
+ #
+ 
+IF(APPLE)
+  MESSAGE(STATUS "Running on Apple. Using customized paths and options.")
+
+  SET(ENV{OGRE_HOME} "/Developer/SDKs/OgreSDK/Dependencies")
+  SET(ENV{CEGUIDIR} "/Developer/SDKs/OgreSDK/Dependencies")
+
+  #MESSAGE(STATUS $ENV{OGRE_HOME})
+
+  SET(CMAKE_FIND_FRAMEWORK "FIRST")
+
+#  SET(OGRE_LIBRARY_OPTIMIZED "/Developer/SDKs/OgreSDK/Dependencies/Ogre.framework/Ogre")
+
+#  SET(CEGUI_LIBRARY_OPTIMIZED "/Developer/SDKs/OgreSDK/Dependencies/CEGUI.framework/CEGUI")
+
+#  SET(OGRE_LIBRARY_OPTIMIZED  "/Developer/SDKs/OgreSDK/Dependencies/Ogre.framework" CACHE STRING "Ogre lib for OSX")
+#  SET(CEGUI_LIBRARY_OPTIMIZED  "/Developer/SDKs/OgreSDK/Dependencies/CEGUI.framework" CACHE STRING "CEGUI lib for OSX")
+
+ENDIF(APPLE)
Index: /code/branches/buildsystem3/cmake/LibraryConfigTardis.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/LibraryConfigTardis.cmake	(revision 2664)
+++ /code/branches/buildsystem3/cmake/LibraryConfigTardis.cmake	(revision 2664)
@@ -0,0 +1,54 @@
+ #
+ #             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:
+ #    Adrian Friedli
+ #  Description:
+ #    Sets the correct find script paths on the ETH Tardis workstations.
+ #    Also sets the TARDIS variable.
+ #
+
+IF(UNIX AND NOT APPLE)
+  FILE(STRINGS /etc/hostname HOSTNAME LIMIT_COUNT 1)
+  IF(${HOSTNAME} MATCHES "^tardis-[a-z][0-9][0-9]$")
+    SET (TARDIS ON)
+  ENDIF()
+ENDIF()
+
+IF(TARDIS)
+  MESSAGE(STATUS "Running on D-ITET isg.ee Tardis Computer. Using customized paths.")
+
+  # We cannot use the default compiler (why?)
+  SET(CMAKE_C_COMPILER "gcc-4.1")
+  SET(CMAKE_CXX_COMPILER "g++-4.1")
+
+  # Note: When setting ENV${} variables, make sure to use quotes when
+  #       having multiple directories.
+  SET(BOOST_INCLUDEDIR "/usr/pack/boost-1.34.1-sd/include")
+  SET(BOOST_LIBRARYDIR "/usr/pack/boost-1.34.1-sd/i686-debian-linux3.1/lib")
+  SET(ENV{CEGUIDIR}    "/usr/pack/cegui-0.5.0-sd;/usr/pack/cegui-0.5.0-sd/i686-debian-linux3.1")
+  SET(ENV{ENETDIR}     "/usr/pack/enet-2007-sd;/usr/pack/enet-2007-sd/i686-debian-linux3.1")
+  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.0.3-sd;/usr/pack/lua-5.0.3-sd/i686-debian-linux3.1")
+  SET(ENV{OGRE_HOME}   "/usr/pack/ogre-1.4.5-sd;/usr/pack/ogre-1.4.5-sd/i686-debian-linux3.1")
+  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")
+ENDIF(TARDIS)
Index: /code/branches/buildsystem3/cmake/SourceFileUtilities.cmake
===================================================================
--- /code/branches/buildsystem3/cmake/SourceFileUtilities.cmake	(revision 2664)
+++ /code/branches/buildsystem3/cmake/SourceFileUtilities.cmake	(revision 2664)
@@ -0,0 +1,73 @@
+ #
+ #             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:
+ #    Several functions that help organising the source tree.
+ #    [ADD/SET]_SOURCE_FILES - Writes source files to the cache by force and
+ #                             adds the current directory.
+ #    GET_ALL_HEADER_FILES - Finds all header files recursively.
+ #    GENERATE_SOURCE_GROUPS - Set Visual Studio source groups.
+ #
+
+# Adds source files with the full path to a list
+FUNCTION(ADD_SOURCE_FILES _varname)
+  # Prefix the full path
+  SET(_fullpath_sources)
+  FOREACH(_file ${ARGN})
+    GET_SOURCE_FILE_PROPERTY(_filepath ${_file} LOCATION)
+    LIST(APPEND _fullpath_sources ${_filepath})
+  ENDFOREACH(_file)
+  # Write into the cache to avoid variable scoping in subdirs
+  SET(${_varname} ${${_varname}} ${_fullpath_sources} CACHE INTERNAL "Do not edit")
+ENDFUNCTION(ADD_SOURCE_FILES)
+
+
+# Sets source files with the full path
+FUNCTION(SET_SOURCE_FILES _varname)
+  # Prefix the full path
+  SET(_fullpath_sources)
+  FOREACH(_file ${ARGN})
+    GET_SOURCE_FILE_PROPERTY(_filepath ${_file} LOCATION)
+    LIST(APPEND _fullpath_sources ${_filepath})
+  ENDFOREACH(_file)
+  # Write into the cache to avoid variable scoping in subdirs
+  SET(${_varname} ${_fullpath_sources} CACHE INTERNAL "Do not edit")
+ENDFUNCTION(SET_SOURCE_FILES)
+
+
+# Search the entire directory tree for header files and add them to a variable
+MACRO(GET_ALL_HEADER_FILES _target_varname)
+  FILE(GLOB_RECURSE ${_target_varname} ${CMAKE_CURRENT_SOURCE_DIR} "*.h")
+ENDMACRO(GET_ALL_HEADER_FILES)
+
+
+# Generate source groups according to the directory structure
+FUNCTION(GENERATE_SOURCE_GROUPS)
+
+  FOREACH(_file ${ARGN})
+    GET_SOURCE_FILE_PROPERTY(_full_filepath ${_file} LOCATION)
+    FILE(RELATIVE_PATH _relative_path ${CMAKE_CURRENT_SOURCE_DIR} ${_full_filepath})
+    GET_FILENAME_COMPONENT(_relative_path ${_relative_path} PATH)
+    STRING(REPLACE "/" "\\\\" _group_path "${_relative_path}")
+    SOURCE_GROUP("Source\\${_group_path}" FILES ${_file})
+  ENDFOREACH(_file)
+
+ENDFUNCTION(GENERATE_SOURCE_GROUPS)
Index: de/branches/buildsystem3/cmakeclearcache
===================================================================
--- /code/branches/buildsystem3/cmakeclearcache	(revision 2663)
+++ 	(revision )
@@ -1,11 +1,0 @@
-#!/bin/bash
-# Clears the cmake cache
-# Author: Nicolas Perrenoud <nicolape@ee.ethz.ch>
-# Co-Author: Nicolas Schlumberger <nico_at_orxonox.net>
-
-find . -name "CMakeCache.txt" -exec rm -f {} \;
-find . -name "cmake_install.cmake" -exec rm -f {} \;
-find . -name "CMakeFiles" -exec rm -fr {} \;
-find . -name "Makefile" -exec rm -fr {} \;
-
-echo "Cmake Cache cleared!"
Index: /code/branches/buildsystem3/doc/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/doc/CMakeLists.txt	(revision 2664)
+++ /code/branches/buildsystem3/doc/CMakeLists.txt	(revision 2664)
@@ -0,0 +1,5 @@
+# Add a "doc" target with CMake build system. 
+# And configure doxy.config.in to doxy.config
+#
+# target "doc" allows building the documentation with doxygen/dot on WIN32 and Linux
+ADD_SUBDIRECTORY(api)
Index: /code/branches/buildsystem3/doc/api/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/doc/api/CMakeLists.txt	(revision 2664)
+++ /code/branches/buildsystem3/doc/api/CMakeLists.txt	(revision 2664)
@@ -0,0 +1,89 @@
+# Add a "doc" target with CMake build system. 
+# And configure doxy.config.in to doxy.config
+#
+# target "doc" allows building the documentation with doxygen/dot on WIN32 and Linux
+# Creates .chm windows help file if MS HTML help workshop 
+# (available from http://msdn.microsoft.com/workshop/author/htmlhelp)
+# is installed with its DLLs in PATH.
+#
+#
+# Please note, that the tools, e.g.:
+# doxygen, dot, latex, dvips, makeindex, gswin32, etc.
+# must be in path.
+#
+# Note about Visual Studio Projects: 
+# MSVS hast its own path environment which may differ from the shell.
+# See "Menu Tools/Options/Projects/VC++ Directories" in VS 7.1
+#
+# author Jan Woetzel 2004-2006
+# www.mip.informatik.uni-kiel.de/~jw
+# Adjustments for Orxonox by Reto Grieder
+
+FIND_PACKAGE(Doxygen QUIET)
+
+IF (DOXYGEN_FOUND)
+  # click+jump in Emacs and Visual Studio (for doxy.config) (jw)
+  IF(CMAKE_BUILD_TOOL MATCHES "msdev|devenv")
+    SET(DOXY_WARN_FORMAT "\"$file($line) : $text \"")
+  ELSE()
+    SET(DOXY_WARN_FORMAT "\"$file:$line: $text \"")
+  ENDIF()
+
+  SET(DOXY_INPUT_DIR  ${CMAKE_CURRENT_SOURCE_DIR})
+  SET(DOXY_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR})
+  
+  # we need latex for doxygen because of the formulas
+  # Orxonox doesn't
+  #FIND_PACKAGE(LATEX)
+  #IF    (NOT LATEX_COMPILER)
+  #  MESSAGE(STATUS "latex command LATEX_COMPILER not found but usually required. You will probably get warnings and user inetraction on doxy run.")
+  #ENDIF (NOT LATEX_COMPILER)
+  #IF    (NOT MAKEINDEX_COMPILER)
+  #  MESSAGE(STATUS "makeindex command MAKEINDEX_COMPILER not found but usually required.")
+  #ENDIF (NOT MAKEINDEX_COMPILER)
+  #IF    (NOT DVIPS_CONVERTER)
+  #  MESSAGE(STATUS "dvips command DVIPS_CONVERTER not found but usually required.")
+  #ENDIF (NOT DVIPS_CONVERTER)
+  
+  IF(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in)
+    CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/doxy.config.in ${CMAKE_CURRENT_BINARY_DIR}/doxy.config @ONLY)
+    # use (configured) doxy.config from (out of place) BUILD tree:
+    SET(DOXY_CONFIG ${CMAKE_CURRENT_BINARY_DIR}/doxy.config)
+  ELSE()
+    MESSAGE(STATUS "Warning: Could not find dox.config.in in the root directory.")
+  ENDIF()
+  
+  ADD_CUSTOM_TARGET(doc ${DOXYGEN_EXECUTABLE} ${DOXY_CONFIG})
+  
+  # create a windows help .chm file using hhc.exe
+  # HTMLHelp DLL must be in path!
+  # fallback: use hhw.exe interactively
+  IF(WIN32)
+    FIND_PACKAGE(HTMLHelp)
+    IF(HTML_HELP_COMPILER)      
+      SET(TMP ${DOXY_OUTPUT_DIR}/html/index.hhp)
+      STRING(REGEX REPLACE "/" "\\\\" HHP_FILE ${TMP})
+      ADD_CUSTOM_TARGET(chmdoc ${HTML_HELP_COMPILER} ${HHP_FILE})
+      IF(NOT MSVC)
+        ADD_DEPENDENCIES(chmdoc doc)
+      ELSE(NOT MSVC)
+        # Do not add the dependency because msvc will then always build
+        # Doxygen, which is not very comforting.
+      ENDIF(NOT MSVC)
+    ENDIF(HTML_HELP_COMPILER)
+  ENDIF (WIN32) 
+
+
+  # Installation
+  INSTALL(
+    FILES ${DOXY_CONFIG} ${CMAKE_CURRENT_BINARY_DIR}/doxy.log
+    DESTINATION ${ORXONOX_DOC_INSTALL_PATH}/api
+    OPTIONAL
+  )
+  IF(EXISTS ${CMAAKE_CURRENT_BINARY_DIR}/html)
+    INSTALL(
+      DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html
+      DESTINATION ${ORXONOX_DOC_INSTALL_PATH}/api
+    )
+  ENDIF()
+ENDIF(DOXYGEN_FOUND)
Index: /code/branches/buildsystem3/doc/api/doxy.config.in
===================================================================
--- /code/branches/buildsystem3/doc/api/doxy.config.in	(revision 2664)
+++ /code/branches/buildsystem3/doc/api/doxy.config.in	(revision 2664)
@@ -0,0 +1,1254 @@
+# Doxyfile 1.4.5
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+#       TAG = value [value, ...]
+# For lists items can also be appended using:
+#       TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded 
+# by quotes) that should identify the project.
+
+PROJECT_NAME           = "@PROJECT_NAME@"
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number. 
+# This could be handy for archiving the generated documentation or 
+# if some version control system is used.
+
+PROJECT_NUMBER         = @PROJECT_VERSION@
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) 
+# base path where the generated documentation will be put. 
+# If a relative path is entered, it will be relative to the location 
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY       = @DOXY_OUTPUT_DIR@
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create 
+# 4096 sub-directories (in 2 levels) under the output directory of each output 
+# format and will distribute the generated files over these directories. 
+# Enabling this option can be useful when feeding doxygen a huge amount of 
+# source files, where putting all generated files in the same directory would 
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS         = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all 
+# documentation generated by doxygen is written. Doxygen will use this 
+# information to generate all constant output in the proper language. 
+# The default language is English, other supported languages are: 
+# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish, 
+# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese, 
+# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian, 
+# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish, 
+# Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE        = English
+
+# This tag can be used to specify the encoding used in the generated output. 
+# The encoding is not always determined by the language that is chosen, 
+# but also whether or not the output is meant for Windows or non-Windows users. 
+# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES 
+# forces the Windows encoding (this is the default for the Windows binary), 
+# whereas setting the tag to NO uses a Unix-style encoding (the default for 
+# all platforms other than Windows).
+
+USE_WINDOWS_ENCODING   = YES
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will 
+# include brief member descriptions after the members that are listed in 
+# the file and class documentation (similar to JavaDoc). 
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC      = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend 
+# the brief description of a member or function before the detailed description. 
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the 
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF           = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator 
+# that is used to form the text in various listings. Each string 
+# in this list, if found as the leading text of the brief description, will be 
+# stripped from the text and the result after processing the whole list, is 
+# used as the annotated text. Otherwise, the brief description is used as-is. 
+# If left blank, the following values are used ("$name" is automatically 
+# replaced with the name of the entity): "The $name class" "The $name widget" 
+# "The $name file" "is" "provides" "specifies" "contains" 
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF       = 
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then 
+# Doxygen will generate a detailed section even if there is only a brief 
+# description.
+
+ALWAYS_DETAILED_SEC    = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all 
+# inherited members of a class in the documentation of that class as if those 
+# members were ordinary class members. Constructors, destructors and assignment 
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB  = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full 
+# path before files name in the file list and in the header files. If set 
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES        = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag 
+# can be used to strip a user-defined part of the path. Stripping is 
+# only done if one of the specified strings matches the left-hand part of 
+# the path. The tag can be used to show relative paths in the file list. 
+# If left blank the directory from which doxygen is run is used as the 
+# path to strip.
+
+STRIP_FROM_PATH        = @CMAKE_SOURCE_DIR@
+
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of 
+# the path mentioned in the documentation of a class, which tells 
+# the reader which header file to include in order to use a class. 
+# If left blank only the name of the header file containing the class 
+# definition is used. Otherwise one should specify the include paths that 
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH    = @CMAKE_SOURCE_DIR@
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter 
+# (but less readable) file names. This can be useful is your file systems 
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES            = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen 
+# will interpret the first line (until the first dot) of a JavaDoc-style 
+# comment as the brief description. If set to NO, the JavaDoc 
+# comments will behave just like the Qt-style comments (thus requiring an 
+# explicit @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF      = YES
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen 
+# treat a multi-line C++ special comment block (i.e. a block of //! or /// 
+# comments) as a brief description. This used to be the default behaviour. 
+# The new default is to treat a multi-line C++ comment block as a detailed 
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen 
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member 
+# documentation.
+
+DETAILS_AT_TOP         = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented 
+# member inherits the documentation from any documented member that it 
+# re-implements.
+
+INHERIT_DOCS           = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce 
+# a new page for each member. If set to NO, the documentation of a member will 
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES  = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab. 
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE               = 2
+
+# This tag can be used to specify a number of aliases that acts 
+# as commands in the documentation. An alias has the form "name=value". 
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to 
+# put the command \sideeffect (or @sideeffect) in the documentation, which 
+# will result in a user-defined paragraph with heading "Side Effects:". 
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES                = 
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C 
+# sources only. Doxygen will then generate output that is more tailored for C. 
+# For instance, some of the names that are used will be different. The list 
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C  = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java 
+# sources only. Doxygen will then generate output that is more tailored for Java. 
+# For instance, namespaces will be presented as packages, qualified scopes 
+# will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA   = NO
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to 
+# include (a tag file for) the STL sources as input, then you should 
+# set this tag to YES in order to let doxygen match functions declarations and 
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. 
+# func(std::string) {}). This also make the inheritance and collaboration 
+# diagrams that involve STL classes more complete and accurate.
+
+# BUILTIN_STL_SUPPORT    = NO
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC 
+# tag is set to YES, then doxygen will reuse the documentation of the first 
+# member in the group (if any) for the other members of the group. By default 
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC   = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of 
+# the same type (for instance a group of public functions) to be put as a 
+# subgroup of that type (e.g. under the Public Functions section). Set it to 
+# NO to prevent subgrouping. Alternatively, this can be done per class using 
+# the \nosubgrouping command.
+
+SUBGROUPING            = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in 
+# documentation are documented, even if no documentation was available. 
+# Private class members and static file members will be hidden unless 
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL            = YES
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class 
+# will be included in the documentation.
+
+EXTRACT_PRIVATE        = YES
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file 
+# will be included in the documentation.
+
+EXTRACT_STATIC         = YES
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) 
+# defined locally in source files will be included in the documentation. 
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES  = YES
+
+# This flag is only useful for Objective-C code. When set to YES local 
+# methods, which are defined in the implementation section but not in 
+# the interface are included in the documentation. 
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS  = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all 
+# undocumented members of documented classes, files or namespaces. 
+# If set to NO (the default) these members will be included in the 
+# various overviews, but no documentation section is generated. 
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS     = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all 
+# undocumented classes that are normally visible in the class hierarchy. 
+# If set to NO (the default) these classes will be included in the various 
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES     = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all 
+# friend (class|struct|union) declarations. 
+# If set to NO (the default) these declarations will be included in the 
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS  = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any 
+# documentation blocks found inside the body of a function. 
+# If set to NO (the default) these blocks will be appended to the 
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS      = NO
+
+# The INTERNAL_DOCS tag determines if documentation 
+# that is typed after a \internal command is included. If the tag is set 
+# to NO (the default) then the documentation will be excluded. 
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS          = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate 
+# file names in lower-case letters. If set to YES upper-case letters are also 
+# allowed. This is useful if you have classes or files whose names only differ 
+# in case and if your file system supports case sensitive file names. Windows 
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES       = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen 
+# will show members with their full class and namespace scopes in the 
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES       = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen 
+# will put a list of the files that are included by a file in the documentation 
+# of that file.
+
+SHOW_INCLUDE_FILES     = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] 
+# is inserted in the documentation for inline members.
+
+INLINE_INFO            = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen 
+# will sort the (detailed) documentation of file and class members 
+# alphabetically by member name. If set to NO the members will appear in 
+# declaration order.
+
+SORT_MEMBER_DOCS       = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the 
+# brief documentation of file, namespace and class members alphabetically 
+# by member name. If set to NO (the default) the members will appear in 
+# declaration order.
+
+SORT_BRIEF_DOCS        = YES
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be 
+# sorted by fully-qualified names, including namespaces. If set to 
+# NO (the default), the class list will be sorted only by class name, 
+# not including the namespace part. 
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the 
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME     = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or 
+# disable (NO) the todo list. This list is created by putting \todo 
+# commands in the documentation.
+
+GENERATE_TODOLIST      = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or 
+# disable (NO) the test list. This list is created by putting \test 
+# commands in the documentation.
+
+GENERATE_TESTLIST      = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or 
+# disable (NO) the bug list. This list is created by putting \bug 
+# commands in the documentation.
+
+GENERATE_BUGLIST       = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or 
+# disable (NO) the deprecated list. This list is created by putting 
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional 
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS       = 
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines 
+# the initial value of a variable or define consists of for it to appear in 
+# the documentation. If the initializer consists of more lines than specified 
+# here it will be hidden. Use a value of 0 to hide initializers completely. 
+# The appearance of the initializer of individual variables and defines in the 
+# documentation can be controlled using \showinitializer or \hideinitializer 
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES  = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated 
+# at the bottom of the documentation of classes and structs. If set to YES the 
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES        = YES
+
+# If the sources in your project are distributed over multiple directories 
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy 
+# in the documentation. The default is YES.
+
+SHOW_DIRECTORIES       = YES
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that 
+# doxygen should invoke to get the current version for each file (typically from the 
+# version control system). Doxygen will invoke the program by executing (via 
+# popen()) the command <command> <input-file>, where <command> is the value of 
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file 
+# provided by doxygen. Whatever the program writes to standard output 
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated 
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET                  = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are 
+# generated by doxygen. Possible values are YES and NO. If left blank 
+# NO is used.
+
+WARNINGS               = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings 
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will 
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED   = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for 
+# potential errors in the documentation, such as not documenting some 
+# parameters in a documented function, or documenting parameters that 
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR      = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for 
+# functions that are documented, but have no documentation for their parameters 
+# or return value. If set to NO (the default) doxygen will only warn about 
+# wrong or incomplete parameter documentation, but not about the absence of 
+# documentation.
+
+WARN_NO_PARAMDOC       = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that 
+# doxygen can produce. The string should contain the $file, $line, and $text 
+# tags, which will be replaced by the file and line number from which the 
+# warning originated and the warning text. Optionally the format may contain 
+# $version, which will be replaced by the version of the file (if it could 
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT            = @DOXY_WARN_FORMAT@
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning 
+# and error messages should be written. If left blank the output is written 
+# to stderr.
+
+WARN_LOGFILE           = @DOXY_OUTPUT_DIR@/doxy.log
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain 
+# documented source files. You may enter file names like "myfile.cpp" or 
+# directories like "/usr/src/myproject". Separate the files or directories 
+# with spaces.
+
+INPUT                  = @CMAKE_SOURCE_DIR@/src \
+                         @CMAKE_BINARY_DIR@/src
+
+# If the value of the INPUT tag contains directories, you can use the 
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank the following patterns are tested: 
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx 
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py
+
+FILE_PATTERNS          = *.cpp \
+                         *.cc \
+                         *.h \
+                         *.hh \
+                         *.hpp \
+                         *.dox
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories 
+# should be searched for input files as well. Possible values are YES and NO. 
+# If left blank NO is used.
+
+RECURSIVE              = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should 
+# excluded from the INPUT source files. This way you can easily exclude a 
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE                = 
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or 
+# directories that are symbolic links (a Unix filesystem feature) are excluded 
+# from the input.
+
+EXCLUDE_SYMLINKS       = NO
+
+# If the value of the INPUT tag contains directories, you can use the 
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude 
+# certain files from those directories. Note that the wildcards are matched 
+# against the file with absolute path, so to exclude all test directories 
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS       = 
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or 
+# directories that contain example code fragments that are included (see 
+# the \include command).
+
+EXAMPLE_PATH           = @DOXY_INPUT_DIR@
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the 
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp 
+# and *.h) to filter out the source-files in the directories. If left 
+# blank all files are included.
+
+EXAMPLE_PATTERNS       = *.cpp \
+                         *.cc \
+                         *.h \
+                         *.hh \
+                         INSTALL DEPENDENCIES CHANGELOG LICENSE LGPL
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be 
+# searched for input files to be used with the \include or \dontinclude 
+# commands irrespective of the value of the RECURSIVE tag. 
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE      = YES
+
+# The IMAGE_PATH tag can be used to specify one or more files or 
+# directories that contain image that are included in the documentation (see 
+# the \image command).
+
+IMAGE_PATH             = @DOXY_INPUT_DIR@
+
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should 
+# invoke to filter for each input file. Doxygen will invoke the filter program 
+# by executing (via popen()) the command <filter> <input-file>, where <filter> 
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an 
+# input file. Doxygen will then use the output that the filter program writes 
+# to standard output.  If FILTER_PATTERNS is specified, this tag will be 
+# ignored.
+
+INPUT_FILTER           = 
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
+# basis.  Doxygen will compare the file name with each pattern and apply the 
+# filter if there is a match.  The filters are a list of the form: 
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further 
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER 
+# is applied to all files.
+
+FILTER_PATTERNS        = 
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using 
+# INPUT_FILTER) will be used to filter the input files when producing source 
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES    = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will 
+# be generated. Documented entities will be cross-referenced with these sources. 
+# Note: To get rid of all source code in the generated output, make sure also 
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER         = YES
+
+# Setting the INLINE_SOURCES tag to YES will include the body 
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES         = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct 
+# doxygen to hide any special comment blocks from generated source code 
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS    = NO
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default) 
+# then for each documented function all documented 
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default) 
+# then for each documented function all documented entities 
+# called/used by that function will be listed.
+
+REFERENCES_RELATION    = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code 
+# will point to the HTML generated by the htags(1) tool instead of doxygen 
+# built-in source browser. The htags tool is part of GNU's global source 
+# tagging system (see http://www.gnu.org/software/global/global.html). You 
+# will need version 4.8.6 or higher.
+
+USE_HTAGS              = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen 
+# will generate a verbatim copy of the header file for each class for 
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS       = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index 
+# of all compounds will be generated. Enable this if the project 
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX     = YES
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then 
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns 
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX    = 2
+
+# In case all classes in a project start with a common prefix, all 
+# classes will be put under the same header in the alphabetical index. 
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that 
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX          = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will 
+# generate HTML output.
+
+GENERATE_HTML          = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT            = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for 
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank 
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION    = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard header.
+HTML_HEADER            = 
+
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for 
+# each generated HTML page. If it is left blank doxygen will generate a 
+# standard footer.
+
+HTML_FOOTER            = 
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading 
+# style sheet that is used by each HTML page. It can be used to 
+# fine-tune the look of the HTML output. If the tag is left blank doxygen 
+# will generate a default style sheet. Note that doxygen will try to copy 
+# the style sheet file to the HTML output directory, so don't put your own 
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET        = 
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, 
+# files or namespaces will be aligned in HTML using tables. If set to 
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS     = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files 
+# will be generated that can be used as input for tools like the 
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm) 
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP      = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can 
+# be used to specify the file name of the resulting .chm file. You 
+# can add a path in front of the file if the result should not be 
+# written to the html output directory.
+
+CHM_FILE               = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can 
+# be used to specify the location (absolute path including file name) of 
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run 
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION           = 
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag 
+# controls if a separate .chi index file is generated (YES) or that 
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI           = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag 
+# controls whether a binary table of contents is generated (YES) or a 
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC             = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members 
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND             = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at 
+# top of each HTML page. The value NO (the default) enables the index and 
+# the value YES disables it.
+
+DISABLE_INDEX          = NO
+
+# This tag can be used to set the number of enum values (range [1..20]) 
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE   = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that 
+# is generated for HTML Help). For this to work a browser that supports 
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+, 
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are 
+# probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW      = YES
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be 
+# used to set the initial width (in pixels) of the frame in which the tree 
+# is shown.
+
+TREEVIEW_WIDTH         = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will 
+# generate Latex output.
+
+GENERATE_LATEX         = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT           = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be 
+# invoked. If left blank `latex' will be used as the default command name.
+
+#LATEX_CMD_NAME         = latex
+LATEX_CMD_NAME          = @LATEX_COMPILER@
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to 
+# generate index for LaTeX. If left blank `makeindex' will be used as the 
+# default command name.
+
+#MAKEINDEX_CMD_NAME     = makeindex
+MAKEINDEX_CMD_NAME     = @MAKEINDEX_COMPILER@
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact 
+# LaTeX documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_LATEX          = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used 
+# by the printer. Possible values are: a4, a4wide, letter, legal and 
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE             = a4
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX 
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES         = 
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for 
+# the generated latex document. The header should contain everything until 
+# the first chapter. If it is left blank doxygen will generate a 
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER           = 
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated 
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will 
+# contain links (just like the HTML output) instead of page references 
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS         = YES
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of 
+# plain latex in the generated Makefile. Set this option to YES to get a 
+# higher quality PDF documentation.
+
+USE_PDFLATEX           = YES
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. 
+# command to the generated LaTeX files. This will instruct LaTeX to keep 
+# running if errors occur, instead of asking the user for help. 
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE        = YES
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not 
+# include the index chapters (such as File Index, Compound Index, etc.) 
+# in the output.
+
+LATEX_HIDE_INDICES     = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output 
+# The RTF output is optimized for Word 97 and may not look very pretty with 
+# other RTF readers or editors.
+
+GENERATE_RTF           = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT             = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact 
+# RTF documents. This may be useful for small projects and may help to 
+# save some trees in general.
+
+COMPACT_RTF            = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated 
+# will contain hyperlink fields. The RTF file will 
+# contain links (just like the HTML output) instead of page references. 
+# This makes the output suitable for online browsing using WORD or other 
+# programs which support those fields. 
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS         = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's 
+# config file, i.e. a series of assignments. You only have to provide 
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE    = 
+
+# Set optional variables used in the generation of an rtf document. 
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE    = 
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will 
+# generate man pages
+
+GENERATE_MAN           = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT             = man
+
+# The MAN_EXTENSION tag determines the extension that is added to 
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION          = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output, 
+# then it will generate one additional man file for each entity 
+# documented in the real man page(s). These additional files 
+# only source the real man page, but without them the man command 
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS              = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will 
+# generate an XML file that captures the structure of 
+# the code including all documentation.
+
+GENERATE_XML           = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put. 
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be 
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT             = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_SCHEMA             = 
+
+# The XML_DTD tag can be used to specify an XML DTD, 
+# which can be used by a validating XML parser to check the 
+# syntax of the XML files.
+
+XML_DTD                = 
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will 
+# dump the program listings (including syntax highlighting 
+# and cross-referencing information) to the XML output. Note that 
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING     = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will 
+# generate an AutoGen Definitions (see autogen.sf.net) file 
+# that captures the structure of the code including all 
+# documentation. Note that this feature is still experimental 
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF   = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will 
+# generate a Perl module file that captures the structure of 
+# the code including all documentation. Note that this 
+# feature is still experimental and incomplete at the 
+# moment.
+
+GENERATE_PERLMOD       = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate 
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able 
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX          = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be 
+# nicely formatted so it can be parsed by a human reader.  This is useful 
+# if you want to understand what is going on.  On the other hand, if this 
+# tag is set to NO the size of the Perl module output will be much smaller 
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY         = YES
+
+# The names of the make variables in the generated doxyrules.make file 
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. 
+# This is useful so different doxyrules.make files included by the same 
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX = 
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor   
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will 
+# evaluate all C-preprocessor directives found in the sources and include 
+# files.
+
+ENABLE_PREPROCESSING   = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro 
+# names in the source code. If set to NO (the default) only conditional 
+# compilation will be performed. Macro expansion can be done in a controlled 
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION        = YES
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES 
+# then the macro expansion is limited to the macros specified with the 
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF     = YES
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files 
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES        = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that 
+# contain include files that are not input files but should be processed by 
+# the preprocessor.
+
+INCLUDE_PATH           = 
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard 
+# patterns (like *.h and *.hpp) to filter out the header-files in the 
+# directories. If left blank, the patterns specified with FILE_PATTERNS will 
+# be used.
+
+INCLUDE_FILE_PATTERNS  = 
+
+# The PREDEFINED tag can be used to specify one or more macro names that 
+# are defined before the preprocessor is started (similar to the -D option of 
+# gcc). The argument of the tag is a list of macros of the form: name 
+# or name=definition (no spaces). If the definition and the = are 
+# omitted =1 is assumed. To prevent a macro definition from being 
+# undefined via #undef or recursively expanded use the := operator 
+# instead of the = operator.
+
+PREDEFINED             = 
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then 
+# this tag can be used to specify a list of macro names that should be expanded. 
+# The macro definition that is found in the sources will be used. 
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED      = 
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then 
+# doxygen's preprocessor will remove all function-like macros that are alone 
+# on a line, have an all uppercase name, and do not end with a semicolon. Such 
+# function macros are typically used for boiler-plate code, and will confuse 
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS   = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references   
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles. 
+# Optionally an initial location of the external documentation 
+# can be added for each tagfile. The format of a tag file without 
+# this location is as follows: 
+#   TAGFILES = file1 file2 ... 
+# Adding location for the tag files is done as follows: 
+#   TAGFILES = file1=loc1 "file2 = loc2" ... 
+# where "loc1" and "loc2" can be relative or absolute paths or 
+# URLs. If a location is present for each tag, the installdox tool 
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen 
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES               = 
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create 
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE       = @DOXY_OUTPUT_DIR@/html/@PROJECT_NAME@.TAGFILE
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed 
+# in the class index. If set to NO only the inherited external classes 
+# will be listed.
+
+ALLEXTERNALS           = YES
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed 
+# in the modules index. If set to NO, only the current project's groups will 
+# be listed.
+
+EXTERNAL_GROUPS        = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script 
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH              = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool   
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will 
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base 
+# or super classes. Setting the tag to NO turns the diagrams off. Note that 
+# this option is superseded by the HAVE_DOT option below. This is only a 
+# fallback. It is recommended to install and use dot, since it yields more 
+# powerful graphs.
+
+CLASS_DIAGRAMS         = YES
+
+# If set to YES, the inheritance and collaboration graphs will hide 
+# inheritance and usage relations if the target is undocumented 
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS   = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is 
+# available from the path. This tool is part of Graphviz, a graph visualization 
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section 
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT               = @DOXYGEN_DOT_FOUND@
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect inheritance relations. Setting this tag to YES will force the 
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH            = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for each documented class showing the direct and 
+# indirect implementation dependencies (inheritance, containment, and 
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH    = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen 
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS           = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and 
+# collaboration diagrams in a style similar to the OMG's Unified Modeling 
+# Language.
+
+UML_LOOK               = NO
+# UML_LOOK               = YES
+
+# If set to YES, the inheritance and collaboration graphs will show the 
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS     = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT 
+# tags are set to YES then doxygen will generate a graph for each documented 
+# file showing the direct and indirect include dependencies of the file with 
+# other documented files.
+
+INCLUDE_GRAPH          = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and 
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each 
+# documented header file showing the documented files that directly or 
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH      = YES
+
+# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will 
+# generate a call dependency graph for every global function or class method. 
+# Note that enabling this option will significantly increase the time of a run. 
+# So in most cases it will be better to enable call graphs for selected 
+# functions only using the \callgraph command.
+
+CALL_GRAPH             = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen 
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY    = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES 
+# then doxygen will show the dependencies a directory has on other directories 
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH        = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images 
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT       = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be 
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH               = @DOXYGEN_DOT_EXECUTABLE_PATH@
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that 
+# contain dot files that are included in the documentation (see the 
+# \dotfile command).
+
+DOTFILE_DIRS           = 
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_WIDTH    = 1280
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height 
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than 
+# this value, doxygen will try to truncate the graph, so that it fits within 
+# the specified constraint. Beware that most browsers cannot cope with very 
+# large images.
+
+MAX_DOT_GRAPH_HEIGHT   = 1024
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the 
+# graphs generated by dot. A depth value of 3 means that only nodes reachable 
+# from the root by following a path via at most 3 edges will be shown. Nodes 
+# that lay further from the root node will be omitted. Note that setting this 
+# option to 1 or 2 may greatly reduce the computation time needed for large 
+# code bases. Also note that a graph may be further truncated if the graph's 
+# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH 
+# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default), 
+# the graph is not depth-constrained.
+
+MAX_DOT_GRAPH_DEPTH    = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent 
+# background. This is disabled by default, which results in a white background. 
+# Warning: Depending on the platform used, enabling this option may lead to 
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to 
+# read).
+
+DOT_TRANSPARENT        = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output 
+# files in one run (i.e. multiple -o and -T options on the command line). This 
+# makes dot run faster, but since only newer versions of dot (>1.8.10) 
+# support this, this feature is disabled by default.
+# JW
+# DOT_MULTI_TARGETS      = NO
+DOT_MULTI_TARGETS      = YES
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will 
+# generate a legend page explaining the meaning of the various boxes and 
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND        = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will 
+# remove the intermediate dot files that are used to generate 
+# the various graphs.
+
+DOT_CLEANUP            = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine   
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be 
+# used. If set to NO the values of all tags below this one will be ignored.
+
+# JW SEARCHENGINE           = NO
+SEARCHENGINE           = YES
Index: /code/branches/buildsystem3/media/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/media/CMakeLists.txt	(revision 2664)
+++ /code/branches/buildsystem3/media/CMakeLists.txt	(revision 2664)
@@ -0,0 +1,46 @@
+ #
+ #             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 the media directory and configures it's installation.
+ #
+
+# Specify media directory
+FIND_PATH(ORXONOX_MEDIA_DIRECTORY resources.cfg
+  PATHS
+    ${CMAKE_CURRENT_SOURCE_DIR}
+    ${CMAKE_SOURCE_DIR}/../media
+    $ENV{ORXONOX_MEDIA_DIR}
+)
+IF(NOT ORXONOX_MEDIA_DIRECTORY)
+  MESSAGE(STATUS "Warning: Media directory not found. If you want to compile while downloading the media files, you must specify the directory by Hand BEFORE compiling! Default location is orxonox_root/media")
+  # Temporary override to the default location.
+  SET(ORXONOX_MEDIA_DIRECTORY ${CMAKE_SOURCE_DIR}/media)
+ENDIF()
+
+
+################ Installation #################
+
+INSTALL(
+  DIRECTORY ${ORXONOX_MEDIA_DIRECTORY}/
+  DESTINATION ${ORXONOX_MEDIA_INSTALL_PATH}
+  REGEX "\\.svn$|_svn$" EXCLUDE
+)
Index: de/branches/buildsystem3/run
===================================================================
--- /code/branches/buildsystem3/run	(revision 2663)
+++ 	(revision )
@@ -1,4 +1,0 @@
-#!/bin/bash
-cd bin
-./run-script $@
-cd ..
Index: /code/branches/buildsystem3/src/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/CMakeLists.txt	(revision 2664)
@@ -1,39 +1,134 @@
-INCLUDE_DIRECTORIES(.)
-INCLUDE_DIRECTORIES(..)
-INCLUDE_DIRECTORIES(orxonox)
-INCLUDE_DIRECTORIES(bullet)
+ #
+ #             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.
+ #
 
+################ Various Options ################
+
+# various macro includes
+INCLUDE(FlagUtilities)
+INCLUDE(GenerateToluaBindings)
+INCLUDE(InstallUtilities)
+INCLUDE(SourceFileUtilities)
+
+# Use TinyXML++
+ADD_COMPILER_FLAGS("-DTIXML_USE_TICPP")
+# OIS dynamic linking requires macro definition, at least for Windows
+ADD_COMPILER_FLAGS("-DOIS_DYNAMIC_LIB")
+# Tolua binding speedup if required
+ADD_COMPILER_FLAGS("-DTOLUA_RELEASE" Release MinSizeRel TOLUA_PARSER_RELEASE)
+
+################ OrxonoxConfig.h ################
+
+# Check endianness
+INCLUDE(TestBigEndian)
+TEST_BIG_ENDIAN(ORXONOX_BIG_ENDIAN)
+IF(NOT ORXONOX_BIG_ENDIAN)
+  SET(ORXONOX_LITTLE_ENDIAN TRUE)
+ENDIF()
+
+# 32/64 bit system check
+IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
+  SET(ORXONOX_ARCH_64 TRUE)
+ELSE()
+  SET(ORXONOX_ARCH_32 TRUE)
+ENDIF()
+
+# Platforms
+SET(ORXONOX_PLATFORM_WINDOWS ${WIN32})
+SET(ORXONOX_PLATFORM_APPLE ${APPLE})
+SET(ORXONOX_PLATFORM_UNIX ${UNIX})
+IF(UNIX AND NOT APPLE)
+  SET(ORXONOX_PLATFORM_LINUX TRUE)
+ENDIF()
+
+# Check __forceinline
+INCLUDE(CheckCXXSourceCompiles)
+SET(_source "int main() { return 0; } __forceinline void test() { return; }")
+CHECK_CXX_SOURCE_COMPILES("${_source}" HAVE_FORCEINLINE)
+
+# Check ciso646 include (operators in words)
+INCLUDE(CheckIncludeFileCXX)
+CHECK_INCLUDE_FILE_CXX(iso646.h HAVE_ISO646_H)
+
+SET(GENERATED_FILE_COMMENT
+   "DO NOT EDIT THIS FILE!
+    It has been automatically generated by CMake from OrxonoxConfig.h.in")
+# Copy and configure OrxonoxConfig which gets included in every file
+CONFIGURE_FILE(OrxonoxConfig.h.in ${CMAKE_CURRENT_BINARY_DIR}/OrxonoxConfig.h)
+
+
+############## Include Directories ##############
+
+# Set the search paths for include files
+INCLUDE_DIRECTORIES(
+  # External
+  ${OGRE_INCLUDE_DIR}
+  ${CEGUI_INCLUDE_DIR}
+  ${ENET_INCLUDE_DIR}
+  ${Boost_INCLUDE_DIRS}
+  ${OPENAL_INCLUDE_DIRS}
+  ${ALUT_INCLUDE_DIR}
+  ${VORBIS_INCLUDE_DIR}
+  ${OGG_INCLUDE_DIR}
+  ${LUA_INCLUDE_DIR}
+  ${TCL_INCLUDE_PATH}
+  ${DIRECTX_INCLUDE_DIR}
+  ${ZLIB_INCLUDE_DIR}
+
+  # All library includes are prefixed with the path to avoid conflicts
+  ${CMAKE_CURRENT_SOURCE_DIR}
+  # Bullet headers really need the include directory
+  ${CMAKE_CURRENT_SOURCE_DIR}/bullet
+  # Convenience directory
+  ${CMAKE_CURRENT_SOURCE_DIR}/orxonox
+  # OrxonoxConfig.h
+  ${CMAKE_CURRENT_BINARY_DIR}
+  # Tolua bind files for Core
+  ${CMAKE_CURRENT_BINARY_DIR}/core/${CMAKE_CFG_INTDIR}
+  # Tolua bind files for Orxonox
+  ${CMAKE_CURRENT_BINARY_DIR}/orxonox/${CMAKE_CFG_INTDIR}
+)
+
+
+################ Sub Directories ################
+
+# Third party libraries
+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()
+
+  INCLUDE_DIRECTORIES(ceguilua/ceguilua-${CEGUI_VERSION})
+  ADD_SUBDIRECTORY(ceguilua)
+ENDIF()
+
+ADD_SUBDIRECTORY(bullet)
 ADD_SUBDIRECTORY(cpptcl)
+ADD_SUBDIRECTORY(ogreceguirenderer)
 ADD_SUBDIRECTORY(ois)
 ADD_SUBDIRECTORY(tinyxml)
-ADD_SUBDIRECTORY(bullet)
-ADD_SUBDIRECTORY(lua)
-ADD_SUBDIRECTORY(tolua)
 
-# Some people may not have CEGUILua installed, espc. with version 0.5
-# And we don't know what lua version it was linked against, so we compile
-# it ourselves.
-# So first, find out what CEGUI version we have.
-
-IF (WIN32)
-    ADD_SUBDIRECTORY(ceguilua-0.6.1/ceguilua)
-    INCLUDE_DIRECTORIES(ceguilua-0.6.1)
-ELSE (WIN32)
-    IF (${CEGUI_VERSION} LESS 0.6.0)
-        ADD_SUBDIRECTORY(ceguilua-0.5.0b/ceguilua)
-        INCLUDE_DIRECTORIES(ceguilua-0.5.0b)
-    ELSE (${CEGUI_VERSION} LESS 0.6.0)
-        ADD_SUBDIRECTORY(ceguilua-0.6.1/ceguilua)
-        INCLUDE_DIRECTORIES(ceguilua-0.6.1)
-    ENDIF (${CEGUI_VERSION} LESS 0.6.0)
-ENDIF (WIN32)
-
-# Include macro to easily add source files in subdirectories
-INCLUDE(AddSourceFiles)
-
-# Our own libraries
+# Orxonox code
 ADD_SUBDIRECTORY(util)
 ADD_SUBDIRECTORY(core)
-ADD_SUBDIRECTORY(audio)
+#ADD_SUBDIRECTORY(audio)
 ADD_SUBDIRECTORY(network)
 ADD_SUBDIRECTORY(orxonox)
Index: /code/branches/buildsystem3/src/OrxonoxConfig.h.in
===================================================================
--- /code/branches/buildsystem3/src/OrxonoxConfig.h.in	(revision 2664)
+++ /code/branches/buildsystem3/src/OrxonoxConfig.h.in	(revision 2664)
@@ -0,0 +1,217 @@
+/*
+ *   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:
+ *      ...
+ *
+ *   Original code: OgrePlatform.h, licensed under the LGPL. The code
+ *   has changed almost completely though.
+ *
+ *   Caution: Do not configure this file CMake configuration (Debug, Release, etc.)
+ *            dependent! XCode and Visual Studio have the same file for all.
+ *
+ */
+
+/**
+ @file
+ @brief
+    Various constants for compiler, architecture and platform.
+
+    @GENERATED_FILE_COMMENT@
+ */
+
+#ifndef _OrxonoxConfig_H__
+#define _OrxonoxConfig_H__
+
+/*---------------------------------
+ * Platform and compiler related options
+ *-------------------------------*/
+#cmakedefine ORXONOX_PLATFORM_WINDOWS
+#cmakedefine ORXONOX_PLATFORM_LINUX
+#cmakedefine ORXONOX_PLATFORM_APPLE
+#cmakedefine ORXONOX_PLATFORM_UNIX /* Apple and Linux */
+
+/* Determine compiler and set ORXONOX_COMP_VER */
+#if defined( _MSC_VER )
+#  define ORXONOX_COMPILER_MSVC
+#  define ORXONOX_COMP_VER _MSC_VER
+
+#elif defined( __GNUC__ )
+#  define ORXONOX_COMPILER_GCC
+#  define ORXONOX_COMP_VER (((__GNUC__)*100) + \
+        (__GNUC_MINOR__*10) + \
+        __GNUC_PATCHLEVEL__)
+#  if defined(__MINGW32__)
+#    define ORXONOX_COMPILER_MINGW
+#  endif
+
+#elif defined( __BORLANDC__ )
+#  define ORXONOX_COMPILER_BORLAND
+#  define ORXONOX_COMP_VER __BCPLUSPLUS__
+
+#else
+#  pragma error "No known compiler. Abort!"
+
+#endif
+
+/* Endianness */
+#cmakedefine ORXONOX_BIG_ENDIAN
+#cmakedefine ORXONOX_LITTLE_ENDIAN
+
+/* Architecture */
+#cmakedefine ORXONOX_ARCH_32
+#cmakedefine ORXONOX_ARCH_64
+
+/* See if we can use __forceinline or if we need to use __inline instead */
+#cmakedefine HAVE_FORCEINLINE
+#ifdef HAVE_FORCEINLINE
+#  define FORCEINLINE __forceinline
+#else
+#  define FORCEINLINE __inline
+#endif
+
+/* Try to define function information */
+#ifndef __FUNCTIONNAME__
+#  ifdef ORXONOX_COMPILER_BORLAND
+#    define __FUNCTIONNAME__ __FUNC__
+#  elif defined(ORXONOX_COMPILER_GCC)
+#    define __FUNCTIONNAME__ __PRETTY_FUNCTION__
+#  elif defined(ORXONOX_COMPILER_MSVC)
+#    define __FUNCTIONNAME__ __FUNCTION__
+#  else
+#    define __FUNCTIONNAME__
+#  endif
+#endif
+
+
+/*---------------------------------
+ * Version information
+ *-------------------------------*/
+#define ORXONOX_VERSION_MAJOR @ORXONOX_VERSION_MAJOR@
+#define ORXONOX_VERSION_MINOR @ORXONOX_VERSION_MINOR@
+#define ORXONOX_VERSION_PATCH @ORXONOX_VERSION_PATCH@
+#define ORXONOX_VERSION_NAME "@ORXONOX_VERSION_NAME@"
+
+#define ORXONOX_VERSION ((ORXONOX_VERSION_MAJOR << 16) | (ORXONOX_VERSION_MINOR << 8) | ORXONOX_VERSION_PATCH)
+
+
+/*---------------------------------
+ * Unix settings
+ *-------------------------------*/
+#ifdef ORXONOX_PLATFORM_UNIX
+
+/* TODO: Check what this actually is and whether we need it or not */
+#if 0
+#  ifdef ORXONOX_PLATFORM_APPLE
+#    define ORXONOX_PLATFORM_LIB "OrxonoxPlatform.bundle"
+#  else
+/* ORXONOX_PLATFORM_LINUX */
+#    define ORXONOX_PLATFORM_LIB "libOrxonoxPlatform.so"
+#  endif
+#endif
+
+#endif /* Patform Unix */
+
+
+/*---------------------------------
+ * Apple Settings
+ *-------------------------------*/
+
+
+/*---------------------------------
+ * Includes
+ *-------------------------------*/
+/* Define the english written operators like and, or, xor
+ * This is C++ standard, but the Microsoft compiler doesn't define them. */
+#cmakedefine HAVE_ISO646_H
+#ifdef HAVE_ISO646_H
+#  include <iso646.h>
+#endif
+
+#cmakedefine HAVE_STDINT_H
+#ifdef HAVE_STDINT_H
+#  include <stdint.h>
+#elif defined(ORXONOX_COMPILER_MSVC)
+typedef __int8            int8_t;
+typedef __int16           int16_t;
+typedef __int32           int32_t;
+typedef __int64           int64_t;
+typedef unsigned __int8   uint8_t;
+typedef unsigned __int16  uint16_t;
+typedef unsigned __int32  uint32_t;
+typedef unsigned __int64  uint64_t;
+#endif
+
+#cmakedefine HAVE_STDDEF_H
+#ifdef HAVE_STDDEF_H
+#  include <stddef.h>
+#endif
+
+/* Visual Leak Detector looks for memory leaks */
+#cmakedefine ACTIVATE_VISUAL_LEAK_DETECTOR
+#ifdef ACTIVATE_VISUAL_LEAK_DETECTOR
+#  include <vld.h>
+#endif
+
+
+/*---------------------------------
+ * Various Settings
+ *-------------------------------*/
+/* Set whether we must suffix "ceguilua/" for the CEGUILua.h include */
+#cmakedefine CEGUILUA_USE_INTERNAL_LIBRARY
+
+/* Defined if a precompiled depdency package was used. We then copy all libraries
+   too when installing. */
+#cmakedefine USE_DEPENDENCY_PACKAGE
+
+/* Handle default ConfigValues */
+namespace orxonox
+{
+#ifdef ORXONOX_PLATFORM_WINDOWS
+    const char* const ORXONOX_MEDIA_PATH("../media");
+#elif defined(ORXONOX_PLATFORM_LINUX)
+    const char* const ORXONOX_MEDIA_PATH("../../share/orxonox");
+#else
+    /* TODO: Apple? */
+    const char* const ORXONOX_MEDIA_PATH("../../share/orxonox");
+#endif
+    
+#ifdef NDEBUG
+    const char* const ORXONOX_OGRE_PLUGINS("@OGRE_PLUGINS_RELEASE@");
+#  ifdef USE_DEPENDENCY_PACKAGE
+    const char* const ORXONOX_OGRE_PLUGINS_FOLDER(".");
+#  else
+    const char* const ORXONOX_OGRE_PLUGINS_FOLDER("@OGRE_PLUGINS_FOLDER_RELEASE@");
+#  endif
+#else
+    const char* const ORXONOX_OGRE_PLUGINS("@OGRE_PLUGINS_DEBUG@");
+#  ifdef USE_DEPENDENCY_PACKAGE
+    const char* const ORXONOX_OGRE_PLUGINS_FOLDER(".");
+#  else
+    const char* const ORXONOX_OGRE_PLUGINS_FOLDER("@OGRE_PLUGINS_FOLDER_DEBUG@");
+#  endif
+#endif
+}
+
+
+#endif /* _OrxonoxConfig_H__ */
Index: /code/branches/buildsystem3/src/audio/AudioBuffer.h
===================================================================
--- /code/branches/buildsystem3/src/audio/AudioBuffer.h	(revision 2663)
+++ /code/branches/buildsystem3/src/audio/AudioBuffer.h	(revision 2664)
@@ -33,5 +33,5 @@
 
 #include <string>
-#include <AL/al.h>
+#include <al.h>
 
 namespace orxonox
Index: /code/branches/buildsystem3/src/audio/AudioIncludes.h
===================================================================
--- /code/branches/buildsystem3/src/audio/AudioIncludes.h	(revision 2663)
+++ /code/branches/buildsystem3/src/audio/AudioIncludes.h	(revision 2664)
@@ -39,6 +39,6 @@
 #include <string>
 
-#include <AL/al.h>
-#include <AL/alc.h>
+#include <al.h>
+#include <alc.h>
 #include <AL/alut.h>
 #include <ogg/ogg.h>
Index: /code/branches/buildsystem3/src/audio/AudioPrereqs.h
===================================================================
--- /code/branches/buildsystem3/src/audio/AudioPrereqs.h	(revision 2663)
+++ /code/branches/buildsystem3/src/audio/AudioPrereqs.h	(revision 2664)
@@ -35,10 +35,10 @@
 #define _AudioPrereqs_H__
 
-#include "util/OrxonoxPlatform.h"
+#include "OrxonoxConfig.h"
 
 //-----------------------------------------------------------------------
 // Shared library settings
 //-----------------------------------------------------------------------
-#if (ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32) && !defined( AUDIO_STATIC_BUILD )
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined( AUDIO_STATIC_BUILD )
 #  ifdef AUDIO_SHARED_BUILD
 #    define _AudioExport __declspec(dllexport)
@@ -68,14 +68,3 @@
 }
 
-//-----------------------------------------------------------------------
-// Warnings
-//-----------------------------------------------------------------------
-#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
-
-// set to 4: conversion from 'ogg_int64_t' to 'long', possible loss of data
-#pragma warning (4 : 4244)
-
-#endif
-
-
 #endif /* _AudioPrereqs_H__ */
Index: /code/branches/buildsystem3/src/audio/AudioStream.h
===================================================================
--- /code/branches/buildsystem3/src/audio/AudioStream.h	(revision 2663)
+++ /code/branches/buildsystem3/src/audio/AudioStream.h	(revision 2664)
@@ -34,5 +34,5 @@
 #include <string>
 #include <iostream>
-#include <AL/al.h>
+#include <al.h>
 #include <vorbis/vorbisfile.h>
 #include <vorbis/codec.h>
Index: /code/branches/buildsystem3/src/audio/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/audio/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/audio/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,29 @@
-SET ( AUDIO_SRC_FILES
+ #
+ #             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.
+ #
+
+SET_SOURCE_FILES(AUDIO_FILES
+  AudioBuffer.h
+  AudioIncludes.h
+  AudioManager.h
+  AudioPrereqs.h
+  AudioSource.h
+  AudioStream.h
+
   AudioBuffer.cc
   AudioManager.cc
@@ -5,12 +31,13 @@
   AudioStream.cc
 )
+#GET_ALL_HEADER_FILES(AUDIO_HDR_FILES)
+#SET(AUDIO_FILES ${AUDIO_SRC_FILES} ${AUDIO_HDR_FILES})
+GENERATE_SOURCE_GROUPS(${AUDIO_FILES})
 
-IF (WIN32)
-  ADD_LIBRARY( audio ${AUDIO_SRC_FILES} )
-ELSE (WIN32)
-  ADD_LIBRARY( audio SHARED ${AUDIO_SRC_FILES} )
-ENDIF (WIN32)
+ADD_COMPILER_FLAGS("-w44244" MSVC)
 
-TARGET_LINK_LIBRARIES( audio
+ADD_LIBRARY(audio SHARED ${AUDIO_FILES})
+SET_TARGET_PROPERTIES(audio PROPERTIES DEFINE_SYMBOL "AUDIO_SHARED_BUILD")
+TARGET_LINK_LIBRARIES(audio
   ${OPENAL_LIBRARY}
   ${ALUT_LIBRARY}
@@ -19,5 +46,6 @@
   ${OGG_LIBRARY}
   core
+  util
 )
 
-
+ORXONOX_INSTALL(audio)
Index: /code/branches/buildsystem3/src/ceguilua/AUTHORS_CEGUI
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/AUTHORS_CEGUI	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/AUTHORS_CEGUI	(revision 2664)
@@ -0,0 +1,112 @@
+Crazy Eddie's GUI System Mk-2
+http://www.cegui.org.uk
+
+Copyright ©2004 - 2008 CEGUI Team & Contributing Authors
+
+
+The following is a list of primary authors and contributors for Crazy Eddie's
+GUI System Mk-2.
+
+
+CEGUI Team
+---------
+James O'Sullivan (_mental_)
+Tomas Lindquist Olsen (lindquist)
+Paul D Turner (crayzed / CrazyEddie)
+Patrick Kooman (scriptkid)
+Paul Schifferer (Exsortis)
+Olivier Delannoy (Dalfy)
+
+CEGUI Tools Team
+----------------
+
+Frederico Jeronimo (fjeronimo). See:
+- http://www.cegui.org.uk/phpBB2/viewtopic.php?t=2766
+- http://www.cegui.org.uk/phpBB2/viewtopic.php?t=2785
+- http://www.cegui.org.uk/phpBB2/viewtopic.php?t=2799
+- http://www.cegui.org.uk/phpBB2/viewtopic.php?t=2816
+
+Main Contributors
+-----------------
+The following have made large, important, or on-going contributions to the
+system (these people may have made additional contributions than those
+specifically mentioned)...
+
+Lars Rinde:
+- Original TaharezLook graphics design.
+
+'Blakharaz':
+- Initial XmlHandlerHelper class and general cleanup of original XML parsing
+code.
+
+Jeff Leigh:
+- Original CEGUI::ColourManipulator class (now re-factored into CEGUI::colour
+class) and related fixes.
+
+Jose A Milan:
+- Refactoring of XML handling classes to remove public dependency on Xerces-C++.
+- Initial updates to Ogre renderer to support Ogre 1.0.
+
+Magnus Osterlind:
+- Direct3D 9 GUI renderer module.
+
+Steve Streeting:
+- TabControl widget base classes & related 'TaharezLook' classes.
+
+Mark Strom:
+- OpenGL GUI renderer module.
+
+Thomas Suter:
+- Irrlicht GUI renderer module.
+
+Andrew Zabolotny:
+- Font class rewrite.
+
+
+Other Contributors
+------------------
+The following have contributed patches, bug reports, and other such valuable
+things...
+
+Tupone Alfredo
+Geoff Carlton
+Clay Culver
+Paul Downey
+Jeff Doyle
+Jan Eickmann
+Andrzej Krzysztof Haczewski
+Markus Henschel
+Erik Hjortsberg
+Rafal Jastrzebski
+Chris Kang
+Peter Newman
+Chris Osborn
+Shane Parker
+Andrea Santambrogio
+James Turner
+Chris Weaver
+Christopher Wedman
+armaduck
+genva
+Te'ja
+Xavier
+
+
+Special Thanks
+--------------
+Shawn Carroll	- For his tutorial series.
+Chris McGuirk	- For his C#.Net port.
+Shane Parker	- For giving permission to use his "Vanilla GUI" imagery.
+
+Everyone on the GameDev.Net forums who looked at earlier versions of the system
+and gave constructive criticism.
+
+Everyone on the Ogre forums who encouraged the development of this Mk-2 version
+of the system.
+
+
+Have I Missed You?
+------------------
+If you feel that we have missed you from some section of this list, then please
+contact us (team@cegui.org.uk) and let us know who you are and what you did,
+and we'll correct the mistake as soon as possible.
Index: /code/branches/buildsystem3/src/ceguilua/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/CMakeLists.txt	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/CMakeLists.txt	(revision 2664)
@@ -0,0 +1,78 @@
+ #
+ #             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.
+ #
+
+SET(CEGUILUA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ceguilua-${CEGUI_VERSION}/ceguilua)
+SET(CEGUILUA_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
+
+SET(CEGUILUA_FILES
+  ${CEGUILUA_DIR}/CEGUILua.cpp
+  ${CEGUILUA_DIR}/CEGUILuaFunctor.cpp
+  ${CEGUILUA_DIR}/required.cpp
+  ${CEGUILUA_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lua_CEGUI.cpp
+
+  ${CEGUILUA_DIR}/CEGUILua.h
+  ${CEGUILUA_DIR}/CEGUILuaFunctor.h
+  ${CEGUILUA_DIR}/required.h
+)
+
+INCLUDE(CompareVersionStrings)
+
+# Copy package files incrementally until the version is met
+SET(CEGUILUA_VERSIONS 0.5.0 0.6.0 0.6.1 0.6.2)
+FOREACH(_version ${CEGUILUA_VERSIONS})
+  COMPARE_VERSION_STRINGS(${_version} ${CEGUI_VERSION} _compare_result)
+  IF(_compare_result EQUAL 1)
+    BREAK() # _version > CEGUI_VERSION
+  ENDIF()
+  
+  ADD_SUBDIRECTORY(ceguilua-${_version}) # Sets parent scope variable
+  FOREACH(_file ${_package_files})
+    CONFIGURE_FILE(ceguilua-${_version}/package/${_file} ${CEGUILUA_BINARY_DIR}/${_file} COPYONLY)
+  ENDFOREACH(_file)
+ENDFOREACH(_version)
+
+# Create the tolua bind file. We could use the orignal file though, but it is 1.6MB...
+ADD_CUSTOM_COMMAND(
+  OUTPUT ${CEGUILUA_BINARY_DIR}/${CMAKE_CFG_INTDIR}/lua_CEGUI.cpp
+  COMMAND tolua++app_orxonox -n CEGUI
+                             -w ${CEGUILUA_BINARY_DIR}
+                             -o ${CMAKE_CFG_INTDIR}/lua_CEGUI.cpp
+                             -L exceptions.lua
+                             -s ${TOLUA_PARSER_SOURCE}
+                                CEGUI.pkg
+  DEPENDS              ${TOLUA_PARSER_DEPENDENCIES}
+  WORKING_DIRECTORY    ${ORXONOX_RUNTIME_LIBRARY_DIRECTORY}
+  COMMENT "Generating tolua bind files for package CEGUILua"
+)
+
+ADD_COMPILER_FLAGS("-w44996" MSVC)
+
+SOURCE_GROUP("Source" FILES ${CEGUILUA_FILES})
+
+SET(CEGUILUA_LIBRARY ceguilua_orxonox)
+SET(CEGUILUA_LIBRARY ${CEGUILUA_LIBRARY} PARENT_SCOPE)
+ADD_LIBRARY(${CEGUILUA_LIBRARY} SHARED ${CEGUILUA_FILES})
+SET_TARGET_PROPERTIES(${CEGUILUA_LIBRARY} PROPERTIES DEFINE_SYMBOL "CEGUILUA_EXPORTS")
+TARGET_LINK_LIBRARIES(${CEGUILUA_LIBRARY}
+  tolua++_orxonox
+  ${LUA_LIBRARIES}
+  ${CEGUI_LIBRARY}
+)
+
+ORXONOX_INSTALL(ceguilua_orxonox)
Index: /code/branches/buildsystem3/src/ceguilua/COPYING
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/COPYING	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/COPYING	(revision 2664)
@@ -0,0 +1,20 @@
+The MIT License
+
+Copyright (c) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index: /code/branches/buildsystem3/src/ceguilua/ChangeLog
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ChangeLog	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ChangeLog	(revision 2664)
@@ -0,0 +1,130 @@
+Crazy Eddie's GUI System Mk-2
+http://www.cegui.org.uk
+
+Copyright 2004 - 2008 CEGUI Team & Contributing Authors
+
+
+The following is a high-level view of changes made to the system between releases.
+
+All changes not related to the lua script module have been deleted!
+
+Release 0.6.2
+=============
+Added: Support for TreeEventArgs in the lua scripting module (patch from kripken, http://www.cegui.org.uk/phpBB2/viewtopic.php?t=3704)
+Added: Added ability to specify a function to be used as the error handler in calls to lua_pcall.  See: http://www.cegui.org.uk/mantis/view.php?id=239
+
+Modified: Forward CEGUI::ScriptException from within the CEGUI::System script execution functions as opposed to translating them into less useful CEGUI::GenericException.  See: http://www.cegui.org.uk/phpBB2/viewtopic.php?t=3595
+
+Bug Fix: Event connection objects returned to lua subscribeEvent calls did not have the connected or disconnect members available for use (making the connection object useless).
+Bug Fix: Lua script module based 'executeScriptedEventHandler was still not returning correct value (missed when I did the LuaFunctor version of the same, see: http://www.cegui.org.uk/mantis/view.php?id=225 for original issue).
+Bug Fix: ScriptModule bindings were destroyed out of sequence meaning event handlers could still be fired that needed CEGUI bindings to exist.  See: http://www.cegui.org.uk/mantis/view.php?id=245.
+Bug Fix: The C++ side of the lua based event mechanism would always return true as if the event were handled, even if some other boolean value (i.e. false) were returned from the lua side.  See: http://www.cegui.org.uk/mantis/view.php?id=225
+
+
+Release 0.6.1
+=============
+Modified: On linux, use installed system versions of tolua++ and TinyXML libraries if available (can be disabled to force continued use of internal versions).  See: http://www.cegui.org.uk/mantis/view.php?id=198
+
+Bug Fix: Need to bring in CEGUIConfig.h when building CEGUILua.cpp in case we're on a Mac.
+Bug Fix: uncomment part of cegui.lua configuration script that allows use of option to have Ogre in samples.
+Bug Fix: tolua++cegui generator missing Lua_CFLAGS in autotools build.
+
+
+Release 0.6.0
+=============
+Added: Levia's GroupBox to the Lua module.
+Added: Warning log level to the Lua module.
+
+Modified: tolua++cegui changes in exception handlers.
+
+Bug Fix: Lua 5.1 removes table.setn - update code to use alternate method of ensuring table is indeed empty.
+Bug Fix: Lua was not correctly detected on (K)Ubuntu type systems (http://www.cegui.org.uk/mantis/view.php?id=138)
+Bug Fix: Support lua 5.1 in CEGUILua.cpp (not sure of generator status with 5.1) (http://www.cegui.org.uk/mantis/view.php?id=161)
+Bug Fix: warnings of unused local variables in lua_CEGUI.cpp fixed.
+Bug Fix: Fixed Memory Leak in Lua Scripting Module when it throws and helper object has already been created.
+
+
+Release 0.5.0 (Final)
+=====================
+Added: Missing functions in WindowFactoryManager Lua bindings. Incomplete FalagardWindowMapping binding as well.
+Added: Lua binding for OutStream: FileStream (minimal std::ofstream).
+Added: XML writing function in Lua bindings.
+
+Modified: Renamed tolua++bin/remake_pkg..bat to remove extra period
+
+
+Release 0.5.0-RC2
+=================
+Modified: Removed static Makefile for tolua++cegui generator tool and switched to autotools style build, with enable/disable configure option, for tolua++cegui generator tool
+Modified: Moved tolua++ into it's own dir, removed lua_and_tolua++
+Modified: Externalised our use of the Lua library
+Modified: LuaScriptModule public headers no longer need include lua.h included.
+
+Bug Fix: Corrected some mistakes in the Falagard Lua bindings
+Bug Fix: Lua bindings was missing ImagesetManager::createImagesetFromImageFile + some missing tolua_throws modifiers
+
+
+Release 0.5.0-RC1
+=================
+CEGUI MK2 has moved to the MIT license.
+
+Added: small script to recreate the binding generator for tolua++
+Added: customized tolua++ binary. For exception handling support in generated binding code.
+Added: Documentation for some of the new features in the bundled tolua++ generator.
+Added: When subscribing to events from "inside" Lua a self object can be registered as well to be passed along with the EventArgs.
+Added: Major update of the LuaScriptModule to support anonymous functions.
+Added: Default resource group support to ScriptingModule, and implemented it's use in the CEGUILua module.
+Added: Lots of missing members in the Lua bindings.
+Added: bat files to make it easier for Windows users to regenerate the Lua bindings and tolua++cegui.
+
+Modified: The "Lua and tolua++" module has been made a DLL on Windows machines.
+Modified: In the lua module, updated Window with casting helpers as member functions. eg. w:toFrameWindow()
+Modified: Updated to tolua++ 1.0.92
+Modified: Moved LuaFunctor into its own files
+Modified: Reimplemented the "late binding" effect from the v04 Lua module. In v04 the function is always looked up by name. In CVS HEAD the actual Lua function is referenced, but now this will only occur the first time the event is triggered. This means that it's no longer necessary to have a function defined to subscribe it to an event. As long as the function has been created before the event occurs everything will be good Smile
+Modified: Moved subscribeScriptedEvent into ScriptModule to allow more customized script subscription functionality.
+Modified: Removal of "tolua_outside" stuff that was no longer needed.
+Modified: The script module now throws ScriptException.
+Modified: The bundled tolua++cegui binding generator will now generate a lua_CEGUI.cpp that compiles out-of-the-box on Windows
+
+Bug Fix: Bug in LuaScriptModule where executeScriptFile did not unload the file data buffer correctly in case of an exception (thanks gcarlton).
+
+
+Release 0.4.1
+=============
+
+
+Release 0.4.0
+=============
+Added: Missing Lua bindings for some System based Tooltip stuff.
+Added: Missing Lua bindings for Menusystem widgets.
+Added: Lua module 'toKeyEventArgs' helper 
+Added: Support to the Lua module for FontFlags to allow direct loading of TTF fonts from script without using .font files.
+
+Modified: Lua scripting module renamed to CEGUILua (Win32 systems).
+
+Bug Fix: Fixed some uint/ColourRect/String CEGUILua issues.
+
+
+Release 0.3.0
+=============
+Added: Lua based ScriptModule (including optional embedded lua and toloua++) for Win32 and Linux users.
+Added: resourceGroup parameter to executeScriptFile methods.
+
+
+Release 0.2.1
+=============
+
+
+Release 0.2.0
+=============
+Added: CEGUI::System constructor overload to allow custom ResourceProvider to be specified when also using a ScriptModule.
+
+
+Release 0.1.1
+=============
+
+
+Release 0.1.0
+=============
+Initial release.
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/CMakeLists.txt	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/CMakeLists.txt	(revision 2664)
@@ -0,0 +1,34 @@
+SET(_package_files
+  exceptions.lua Basic.pkg FontManager.pkg InputEvent.pkg OutStream.pkg
+  System.pkg WindowManager.pkg CEGUI.pkg HelperFunctions.pkg Iterators.pkg
+  PropertyHelper.pkg Texture.pkg CoordConverter.pkg Image.pkg Key.pkg
+  Renderer.pkg UnifiedCoordSystem.pkg EventSet.pkg Imageset.pkg Logger.pkg
+  Scheme.pkg Window.pkg Font.pkg ImagesetManager.pkg MouseCursor.pkg
+  SchemeManager.pkg WindowFactoryManager.pkg
+
+  elements/ButtonBase.pkg elements/Checkbox.pkg elements/ComboDropList.pkg
+  elements/Combobox.pkg elements/DragContainer.pkg elements/Editbox.pkg
+  elements/FrameWindow.pkg elements/GUISheet.pkg elements/ItemEntry.pkg
+  elements/ItemListBase.pkg elements/ItemListbox.pkg elements/ListHeader.pkg
+  elements/ListHeaderSegment.pkg elements/Listbox.pkg elements/ListboxItem.pkg
+  elements/ListboxTextItem.pkg elements/MenuBase.pkg elements/MenuItem.pkg
+  elements/Menubar.pkg elements/MultiColumnList.pkg
+  elements/MultiLineEditbox.pkg elements/PopupMenu.pkg elements/ProgressBar.pkg
+  elements/PushButton.pkg elements/RadioButton.pkg elements/ScrollablePane.pkg
+  elements/Scrollbar.pkg elements/ScrolledContainer.pkg
+  elements/ScrolledItemListBase.pkg elements/Slider.pkg elements/Spinner.pkg
+  elements/TabButton.pkg elements/TabControl.pkg elements/Thumb.pkg
+  elements/Titlebar.pkg elements/Tooltip.pkg
+  
+  falagard/Dimension.pkg falagard/Enums.pkg falagard/FalagardComponentBase.pkg
+  falagard/FrameComponent.pkg falagard/ImageryComponent.pkg
+  falagard/ImagerySection.pkg falagard/LayerSpecification.pkg
+  falagard/NamedArea.pkg falagard/PropertyDefinition.pkg
+  falagard/PropertyDefinitionBase.pkg falagard/PropertyInitialiser.pkg
+  falagard/PropertyLinkDefinition.pkg falagard/SectionSpecification.pkg
+  falagard/StateImagery.pkg falagard/TextComponent.pkg
+  falagard/WidgetComponent.pkg falagard/WidgetLookFeel.pkg
+  falagard/WidgetLookManager.pkg
+
+  PARENT_SCOPE
+)
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILua.cpp
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILua.cpp	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILua.cpp	(revision 2664)
@@ -0,0 +1,312 @@
+/***********************************************************************
+	filename: CEGUILua.cpp
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+	
+	purpose:  Implementation for LuaScriptModule class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "CEGUIPropertyHelper.h"
+#include "CEGUILua.h"
+#include "CEGUILuaFunctor.h"
+#include <vector>
+
+// include Lua libs and tolua++
+extern "C" {
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+}
+
+#include "tolua/tolua++.h"
+
+// prototype for bindings initialisation function
+int tolua_CEGUI_open(lua_State* tolua_S);
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+	Constructor (creates Lua state)
+*************************************************************************/
+LuaScriptModule::LuaScriptModule()
+{
+    #if LUA_VERSION_NUM >= 501
+        static const luaL_Reg lualibs[] = {
+            {"", luaopen_base},
+            {LUA_LOADLIBNAME, luaopen_package},
+            {LUA_TABLIBNAME, luaopen_table},
+            {LUA_IOLIBNAME, luaopen_io},
+            {LUA_OSLIBNAME, luaopen_os},
+            {LUA_STRLIBNAME, luaopen_string},
+            {LUA_MATHLIBNAME, luaopen_math},
+        #if defined(DEBUG) || defined (_DEBUG)
+                {LUA_DBLIBNAME, luaopen_debug},
+        #endif
+            {0, 0}
+        };
+    #endif /* LUA_VERSION_NUM >= 501 */
+
+	// create a lua state
+	d_ownsState = true;
+	d_state = lua_open();
+
+	// init all standard libraries
+    #if LUA_VERSION_NUM >= 501
+            const luaL_Reg *lib = lualibs;
+            for (; lib->func; lib++)
+            {
+                lua_pushcfunction(d_state, lib->func);
+                lua_pushstring(d_state, lib->name);
+                lua_call(d_state, 1, 0);
+            }
+    #else /* LUA_VERSION_NUM >= 501 */
+	    luaopen_base(d_state);
+	    luaopen_io(d_state);
+	    luaopen_string(d_state);
+	    luaopen_table(d_state);
+	    luaopen_math(d_state);
+        #if defined(DEBUG) || defined (_DEBUG)
+	        luaopen_debug(d_state);
+        #endif
+    #endif /* LUA_VERSION_NUM >= 501 */
+
+	setModuleIdentifierString();
+}
+
+
+/*************************************************************************
+	Constructor (uses given Lua state)
+*************************************************************************/
+LuaScriptModule::LuaScriptModule(lua_State* state)
+{
+	// just use the given state
+	d_ownsState = false;
+	d_state = state;
+
+	setModuleIdentifierString();
+}
+
+
+/*************************************************************************
+	Destructor
+*************************************************************************/
+LuaScriptModule::~LuaScriptModule()
+{
+	if ( d_ownsState && d_state )
+	{
+		lua_close( d_state );
+	}
+}
+
+
+/*************************************************************************
+	Execute script file
+*************************************************************************/
+void LuaScriptModule::executeScriptFile(const String& filename, const String& resourceGroup)
+{
+	// load file
+	RawDataContainer raw;
+	System::getSingleton().getResourceProvider()->loadRawDataContainer(filename,
+        raw, resourceGroup.empty() ? d_defaultResourceGroup : resourceGroup);
+
+	// load code into lua
+	int top = lua_gettop(d_state);
+	int loaderr = luaL_loadbuffer(d_state, (char*)raw.getDataPtr(), raw.getSize(), filename.c_str());
+	System::getSingleton().getResourceProvider()->unloadRawDataContainer( raw );
+	if (loaderr)
+	{
+	    String errMsg = lua_tostring(d_state,-1);
+		lua_settop(d_state,top);
+		throw ScriptException("Unable to execute Lua script file: '"+filename+"'\n\n"+errMsg+"\n");
+	}
+    
+    // call it
+	if (lua_pcall(d_state,0,0,0))
+	{
+	    String errMsg = lua_tostring(d_state,-1);
+		lua_settop(d_state,top);
+		throw ScriptException("Unable to execute Lua script file: '"+filename+"'\n\n"+errMsg+"\n");
+	}
+
+	lua_settop(d_state,top); // just in case :P
+}
+
+
+/*************************************************************************
+	Execute global script function
+*************************************************************************/
+int	LuaScriptModule::executeScriptGlobal(const String& function_name)
+{
+    int top = lua_gettop(d_state);
+
+    // get the function from lua
+    lua_getglobal(d_state, function_name.c_str());
+
+    // is it a function
+    if (!lua_isfunction(d_state,-1))
+    {
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to get Lua global: '"+function_name+"' as name not represent a global Lua function" );
+    }
+
+    // call it
+    int error = lua_pcall(d_state,0,1,0);		
+
+    // handle errors
+    if (error)
+    {
+        String errMsg = lua_tostring(d_state,-1);
+        lua_pop(d_state,1);
+        throw ScriptException("Unable to evaluate Lua global: '"+function_name+"\n\n"+errMsg+"\n");
+    }
+
+    // get return value
+    if (!lua_isnumber(d_state,-1))
+    {
+        // log that return value is invalid. return -1 and move on.
+        lua_settop(d_state,top);
+        ScriptException("Unable to get Lua global : '"+function_name+"' return value as it's not a number" );
+        return -1;
+    }
+
+    int ret = (int)lua_tonumber(d_state,-1);
+    lua_pop(d_state,1);
+
+    // return it
+    return ret;
+}
+
+
+/*************************************************************************
+	Execute scripted event handler
+*************************************************************************/
+bool LuaScriptModule::executeScriptedEventHandler(const String& handler_name, const EventArgs& e)
+{
+    LuaFunctor::pushNamedFunction(d_state, handler_name);
+
+    // push EventArgs as the first parameter
+    tolua_pushusertype(d_state,(void*)&e,"const CEGUI::EventArgs");
+
+    // call it
+    int error = lua_pcall(d_state,1,0,0);
+
+    // handle errors
+    if (error)
+    {
+        String errStr(lua_tostring(d_state,-1));
+        lua_pop(d_state,1);
+        throw ScriptException("Unable to evaluate the Lua event handler: '"+handler_name+"'\n\n"+errStr+"\n");
+    }
+
+    return true;
+}
+
+
+/*************************************************************************
+	Execute script code string
+*************************************************************************/
+void LuaScriptModule::executeString(const String& str)
+{
+    int top = lua_gettop(d_state);
+
+    // load code into lua and call it
+    int error =	luaL_loadbuffer(d_state, str.c_str(), str.length(), str.c_str()) || lua_pcall(d_state,0,0,0);
+
+    // handle errors
+    if (error)
+    {
+        String errMsg = lua_tostring(d_state,-1);
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to execute Lua script string: '"+str+"'\n\n"+errMsg+"\n");
+    }
+}
+	
+
+/*************************************************************************
+	Create Lua bindings
+*************************************************************************/
+void LuaScriptModule::createBindings(void)
+{
+	CEGUI::Logger::getSingleton().logEvent( "---- Creating Lua bindings ----" );
+	// init CEGUI module
+	tolua_CEGUI_open(d_state);
+}
+
+
+/*************************************************************************
+	Destroy Lua bindings
+*************************************************************************/
+void LuaScriptModule::destroyBindings(void)
+{
+	CEGUI::Logger::getSingleton().logEvent( "---- Destroying Lua bindings ----" );
+	// is this ok ?
+	lua_pushnil(d_state);
+	lua_setglobal(d_state,"CEGUI");
+}
+
+
+/*************************************************************************
+	Set the ID string for the module
+*************************************************************************/
+void LuaScriptModule::setModuleIdentifierString()
+{
+    // set ID string
+    d_identifierString = "CEGUI::LuaScriptModule - Official Lua based scripting module for CEGUI";
+}
+
+
+/*************************************************************************
+	Subscribe to a scripted event handler
+*************************************************************************/
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target, const String& event_name, const String& subscriber_name)
+{
+    // do the real subscription
+    LuaFunctor functor(d_state,subscriber_name,LUA_NOREF);
+    Event::Connection con = target->subscribeEvent(event_name, Event::Subscriber(functor));
+    // make sure we don't release the reference we just made when this call returns
+    functor.index = LUA_NOREF;
+
+    // return the event connection
+    return con;
+}
+
+
+/*************************************************************************
+	Subscribe to a scripted event handler
+*************************************************************************/
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target, const String& event_name, Event::Group group, const String& subscriber_name)
+{
+    // do the real subscription
+    LuaFunctor functor(d_state,subscriber_name,LUA_NOREF);
+    Event::Connection con = target->subscribeEvent(event_name, group, Event::Subscriber(functor));
+
+    // return the event connection
+    return con;
+}
+
+} // namespace CEGUI
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILua.h
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILua.h	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILua.h	(revision 2664)
@@ -0,0 +1,253 @@
+/***********************************************************************
+	filename: CEGUILua.h
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+	
+	purpose:  Defines interface for LuaScriptModule class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#ifndef _CEGUILua_h_
+#define _CEGUILua_h_
+
+
+/*************************************************************************
+	Import / Export control macros
+*************************************************************************/
+#if defined( __WIN32__ ) || defined( _WIN32 )
+#   ifdef CEGUILUA_EXPORTS
+#       define CEGUILUA_API __declspec(dllexport)
+#   else
+#       if defined( __MINGW32__ )
+#           define CEGUILUA_API
+#       else
+#           define CEGUILUA_API __declspec(dllimport)
+#       endif
+#   endif
+#else
+#   define CEGUILUA_API
+#endif
+
+
+#include "CEGUIScriptModule.h"
+
+struct lua_State;
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Interface for the LuaScriptModule class
+*/
+class CEGUILUA_API LuaScriptModule : public CEGUI::ScriptModule
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for LuaScriptModule class which create a lua_State
+	*/
+	LuaScriptModule();
+
+
+	/*!
+	\brief
+		Constructor for LuaScriptModule class which takes a lua_State
+
+	\param state
+		Pointer to the lua_State that the script module should attach to.
+	*/
+	LuaScriptModule(lua_State* state);
+
+
+	/*!
+	\brief
+		Destructor for LuaScriptModule class.
+	*/
+	~LuaScriptModule();
+
+
+	/*************************************************************************
+		Script Execution Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Execute a script file.
+
+	\param filename
+		String object holding the filename of the script file that is to be executed
+		
+	\param resourceGroup
+		Resource group idendifier to be passed to the ResourceProvider when loading the script file.
+	*/
+	void executeScriptFile(const String& filename, const String& resourceGroup);
+
+
+	/*!
+	\brief
+		Execute a scripted global function.  The function should not take any parameters and should return an integer.
+
+	\param function_name
+		String object holding the name of the function, in the global script environment, that
+		is to be executed.
+
+	\return
+		The integer value returned from the script function.
+	*/
+	int executeScriptGlobal(const String& function_name);
+
+
+    /*!
+    \brief
+        Execute a scripted global 'event handler' function by looking it up by name.
+
+    \param handler_name
+        String object holding the name of the scripted handler function.
+        If this string contains dots '.' it will be parsed as tables containing a function field.
+        For example: 'mytable.subtable.func'
+
+    \param e
+        EventArgs based object that should be passed, by any appropriate means, to the scripted function.
+
+    \return
+        - true if the event was handled.
+        - false if the event was not handled.
+    */
+    bool executeScriptedEventHandler(const String& handler_name, const EventArgs& e);
+
+
+    /*!
+    \brief
+        Execute script code contained in the given CEGUI::String object.
+
+    \param str
+        String object holding the valid script code that should be executed.
+
+    \return
+        Nothing.
+    */
+    void executeString(const String& str);
+
+    /*************************************************************************
+        Event subscription
+    *************************************************************************/
+    /*!
+    \brief
+            Subscribes the named Event to a scripted funtion
+
+    \param target
+            The target EventSet for the subscription.
+
+    \param name
+            String object containing the name of the Event to subscribe to.
+
+    \param subscriber_name
+            String object containing the name of the script funtion that is to be subscribed to the Event.
+
+    \return
+            Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.
+
+    \exception UnknownObjectException	Thrown if an Event named \a name is not in the EventSet
+    */
+    Event::Connection	subscribeEvent(EventSet* target, const String& name, const String& subscriber_name);
+
+    /*!
+    \brief
+            Subscribes the specified group of the named Event to a scripted funtion.
+
+    \param target
+            The target EventSet for the subscription.
+
+    \param name
+            String object containing the name of the Event to subscribe to.
+
+    \param group
+            Group which is to be subscribed to.  Subscription groups are called in ascending order.
+
+    \param subscriber_name
+            String object containing the name of the script funtion that is to be subscribed to the Event.
+
+    \return
+            Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.
+
+    \exception UnknownObjectException	Thrown if an Event named \a name is not in the EventSet
+    */
+    Event::Connection	subscribeEvent(EventSet* target, const String& name, Event::Group group, const String& subscriber_name);
+
+    /*************************************************************************
+        Bindings creation / destruction
+    *************************************************************************/
+    /*!
+    \brief
+        Method called during system initialisation, prior to running any scripts via the ScriptModule, to enable the ScriptModule
+        to perform any operations required to complete initialisation or binding of the script language to the gui system objects.
+
+    \return
+        Nothing.
+    */
+    void createBindings(void);
+
+
+    /*!
+    \brief
+        Method called during system destruction, after all scripts have been run via the ScriptModule, to enable the ScriptModule
+        to perform any operations required to cleanup bindings of the script language to the gui system objects, as set-up in the
+        earlier createBindings call.
+
+    \return
+        Nothing.
+    */
+    void destroyBindings(void);
+
+    /*************************************************************************
+        Accessor type functions
+    *************************************************************************/
+    /*!
+    \brief
+        Method used to get a pointer to the lua_State that the script module is attached to.
+
+    \return
+        A pointer to the lua_State that the script module is attached to.
+    */
+    lua_State* getLuaState(void) const {return d_state;}
+
+private:
+    /*************************************************************************
+        Implementation Functions
+    *************************************************************************/
+    void setModuleIdentifierString();
+
+    /*************************************************************************
+        Implementation Data
+    *************************************************************************/
+    bool d_ownsState;      //!< true when the attached lua_State was created by this script module
+    lua_State* d_state;    //!< The lua_State that this script module uses.
+};
+
+} // namespace CEGUI
+
+#endif // end of guard _CEGUILua_h_
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILuaFunctor.cpp
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILuaFunctor.cpp	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILuaFunctor.cpp	(revision 2664)
@@ -0,0 +1,259 @@
+/***********************************************************************
+    filename: CEGUILuaFunctor.cpp
+    created:  Thu Jan 26 2006
+    author:   Tomas Lindquist Olsen <tomas@famolsen.dk>
+
+    purpose:  Implementation for LuaFunctor class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUILuaFunctor.h"
+#include "CEGUILogger.h"
+#include "CEGUIExceptions.h"
+#include "CEGUIPropertyHelper.h"
+
+// include Lua libs and tolua++
+extern "C" {
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+}
+
+#include "tolua/tolua++.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(lua_State* state, int func, int selfIndex) :
+    L(state),
+    index(func),
+    self(selfIndex),
+    needs_lookup(false)
+{
+}
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(lua_State* state, const String& func, int selfIndex) :
+    L(state),
+    index(LUA_NOREF),
+    self(selfIndex),
+    needs_lookup(true),
+    function_name(func)
+{
+}
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(const LuaFunctor& cp) :
+    L(cp.L),
+    index(cp.index),
+    self(cp.self),
+    needs_lookup(cp.needs_lookup),
+    function_name(cp.function_name)
+{
+}
+
+/*************************************************************************
+    Destructor
+*************************************************************************/
+LuaFunctor::~LuaFunctor()
+{
+    if (self!=LUA_NOREF)
+    {
+        luaL_unref(L, LUA_REGISTRYINDEX, self);
+    }
+    if (index!=LUA_NOREF)
+    {
+        luaL_unref(L, LUA_REGISTRYINDEX, index);
+    }
+}
+
+/*************************************************************************
+    Call operator
+*************************************************************************/
+bool LuaFunctor::operator()(const EventArgs& args) const
+{
+    // is this a late binding?
+    if (needs_lookup)
+    {
+        pushNamedFunction(L, function_name);
+        // reference function
+        index = luaL_ref(L, LUA_REGISTRYINDEX);
+        needs_lookup = false;
+        CEGUI_LOGINSANE("Late binding of callback '"+function_name+"' performed");
+        function_name.clear();
+    }
+
+    // retrieve function
+    lua_rawgeti(L, LUA_REGISTRYINDEX, index);
+
+    // possibly self as well?
+    int nargs = 1;
+    if (self != LUA_NOREF)
+    {
+        lua_rawgeti(L, LUA_REGISTRYINDEX, self);
+        ++nargs;
+    }
+
+    // push EventArgs  parameter
+    tolua_pushusertype(L, (void*)&args, "const CEGUI::EventArgs");
+
+    // call it
+    int error = lua_pcall(L, nargs, 0, 0);
+
+    // handle errors
+    if (error)
+    {
+        String errStr(lua_tostring(L, -1));
+        lua_pop(L, 1);
+        throw ScriptException("Unable to call Lua event handler:\n\n"+errStr+"\n");
+    }
+
+    return true;
+}
+
+/*************************************************************************
+    do event subscription by reference instead of by name
+*************************************************************************/
+Event::Connection LuaFunctor::SubscribeEvent(EventSet* self, const String& event_name, int funcIndex, int selfIndex, lua_State* L)
+{
+    // should we pass a self to the callback?
+    int thisIndex = LUA_NOREF;
+    if (selfIndex != LUA_NOREF)
+    {
+        // reference self
+        thisIndex = luaL_ref(L, LUA_REGISTRYINDEX);
+    }
+
+    // do the real subscription
+    int type = lua_type(L,-1);
+    Event::Connection con;
+    if (type == LUA_TFUNCTION)
+    {
+        // reference function
+        int index = luaL_ref(L, LUA_REGISTRYINDEX);
+        LuaFunctor functor(L,index,thisIndex);
+        con = self->subscribeEvent(String(event_name), Event::Subscriber(functor));
+        // make sure we don't release the reference(s) we just made when this call returns
+        functor.index = LUA_NOREF;
+        functor.self = LUA_NOREF;
+    }
+    else if (type == LUA_TSTRING)
+    {
+        const char* str = lua_tostring(L, -1);
+        LuaFunctor functor(L,String(str),thisIndex);
+        con = self->subscribeEvent(String(event_name), Event::Subscriber(functor));
+        // make sure we don't release the reference we just (maybe) made when this call returns
+        functor.self = LUA_NOREF;
+    }
+    else
+    {
+        luaL_error(L,"bad function passed to subscribe function. must be a real function, or a string for late binding");
+    }
+
+    // return the event connection
+    return con;
+}
+
+/*************************************************************************
+    Pushes a named function on the stack
+*************************************************************************/
+void LuaFunctor::pushNamedFunction(lua_State* L, const String& handler_name)
+{
+    int top = lua_gettop(L);
+
+    // do we have any dots in the handler name? if so we grab the function as a table field
+    String::size_type i = handler_name.find_first_of((utf32)'.');
+    if (i!=String::npos)
+    {
+        // split the rest of the string up in parts seperated by '.'
+        // TODO: count the dots and size the vector accordingly from the beginning.
+        std::vector<String> parts;
+        String::size_type start = 0;
+        do
+        {
+            parts.push_back(handler_name.substr(start,i-start));
+            start = i+1;
+            i = handler_name.find_first_of((utf32)'.',start);
+        } while(i!=String::npos);
+
+        // add last part
+        parts.push_back(handler_name.substr(start));
+
+        // first part is the global
+        lua_getglobal(L, parts[0].c_str());
+        if (!lua_istable(L,-1))
+        {
+            lua_settop(L,top);
+            throw ScriptException("Unable to get the Lua event handler: '"+handler_name+"' as first part is not a table");
+        }
+
+        // if there is more than two parts, we have more tables to go through
+        std::vector<String>::size_type visz = parts.size();
+        if (visz-- > 2) // avoid subtracting one later on
+        {
+            // go through all the remaining parts to (hopefully) have a valid Lua function in the end
+            std::vector<String>::size_type vi = 1;
+            while (vi<visz)
+            {
+                // push key, and get the next table
+                lua_pushstring(L,parts[vi].c_str());
+                lua_gettable(L,-2);
+                if (!lua_istable(L,-1))
+                {
+                    lua_settop(L,top);
+                    throw ScriptException("Unable to get the Lua event handler: '"+handler_name+"' as part #"+PropertyHelper::uintToString(uint(vi+1))+" ("+parts[vi]+") is not a table");
+                }
+                // get rid of the last table and move on
+                lua_remove(L,-2);
+                vi++;
+            }
+        }
+
+        // now we are ready to get the function to call ... phew :)
+        lua_pushstring(L,parts[visz].c_str());
+        lua_gettable(L,-2);
+        lua_remove(L,-2); // get rid of the table
+    }
+    // just a regular global function
+    else
+    {
+        lua_getglobal(L, handler_name.c_str());
+    }
+
+    // is it a function
+    if (!lua_isfunction(L,-1))
+    {
+        lua_settop(L,top);
+        throw ScriptException("The Lua event handler: '"+handler_name+"' does not represent a Lua function");
+    }
+}
+
+} // namespace CEGUI
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILuaFunctor.h
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILuaFunctor.h	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/CEGUILuaFunctor.h	(revision 2664)
@@ -0,0 +1,85 @@
+/***********************************************************************
+    filename: CEGUILuaFunctor.h
+    created:  Thu Jan 26 2006
+    author:   Tomas Lindquist Olsen <tomas@famolsen.dk>
+
+    purpose:  Defines interface for LuaFunctor class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#ifndef _CEGUILuaFunctor_h_
+#define _CEGUILuaFunctor_h_
+
+#include "CEGUIEventSet.h"
+
+struct lua_State;
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// forward declaration
+class LuaScriptModule;
+
+/*!
+\brief
+    Functor class used for subscribing Lua functions to CEGUI events
+*/
+class LuaFunctor
+{
+public:
+    LuaFunctor(lua_State* state, int func, int selfIndex);
+    LuaFunctor(lua_State* state, const String& func, int selfIndex);
+    LuaFunctor(const LuaFunctor& cp);
+    ~LuaFunctor();
+
+    bool operator()(const EventArgs& args) const;
+
+    /*!
+    \brief
+        function used to subscribe any Lua function as event handler.
+        References using the Lua registry.
+        To be called from Lua only.
+    */
+    static Event::Connection SubscribeEvent(EventSet* self, const String& eventName, int funcIndex, int selfIndex, lua_State* L);
+
+    /*!
+    \brief
+        Pushes the Lua function named \param name on top of the Lua stack.
+        The name may contain '.' (dots) character for (nested) table values.
+    */
+    static void pushNamedFunction(lua_State* L, const String& name);
+
+private:
+    lua_State* L;
+    mutable int index;
+    int self;
+    mutable bool needs_lookup;
+    mutable String function_name;
+
+    friend class LuaScriptModule;
+};
+
+} // namespace CEGUI
+
+#endif // end of guard _CEGUILuaFunctor_h_
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/changes_orxonox.diff
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/changes_orxonox.diff	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/changes_orxonox.diff	(revision 2664)
@@ -0,0 +1,103 @@
+--- CEGUILua.cpp	Thu Jan 29 20:08:43 2009
++++ CEGUILua.cpp	Thu Jan 29 10:23:36 2009
+@@ -40,7 +40,7 @@
+ #include "lauxlib.h"
+ }
+ 
+-#include "tolua++.h"
++#include "tolua/tolua++.h"
+ 
+ // prototype for bindings initialisation function
+ int tolua_CEGUI_open(lua_State* tolua_S);
+@@ -55,19 +55,45 @@
+ *************************************************************************/
+ LuaScriptModule::LuaScriptModule()
+ {
++    #if LUA_VERSION_NUM >= 501
++        static const luaL_Reg lualibs[] = {
++            {"", luaopen_base},
++            {LUA_LOADLIBNAME, luaopen_package},
++            {LUA_TABLIBNAME, luaopen_table},
++            {LUA_IOLIBNAME, luaopen_io},
++            {LUA_OSLIBNAME, luaopen_os},
++            {LUA_STRLIBNAME, luaopen_string},
++            {LUA_MATHLIBNAME, luaopen_math},
++        #if defined(DEBUG) || defined (_DEBUG)
++                {LUA_DBLIBNAME, luaopen_debug},
++        #endif
++            {0, 0}
++        };
++    #endif /* LUA_VERSION_NUM >= 501 */
++
+ 	// create a lua state
+ 	d_ownsState = true;
+ 	d_state = lua_open();
+ 
+ 	// init all standard libraries
+-	luaopen_base(d_state);
+-	luaopen_io(d_state);
+-	luaopen_string(d_state);
+-	luaopen_table(d_state);
+-	luaopen_math(d_state);
+-#if defined(DEBUG) || defined (_DEBUG)
+-	luaopen_debug(d_state);
+-#endif
++    #if LUA_VERSION_NUM >= 501
++            const luaL_Reg *lib = lualibs;
++            for (; lib->func; lib++)
++            {
++                lua_pushcfunction(d_state, lib->func);
++                lua_pushstring(d_state, lib->name);
++                lua_call(d_state, 1, 0);
++            }
++    #else /* LUA_VERSION_NUM >= 501 */
++	    luaopen_base(d_state);
++	    luaopen_io(d_state);
++	    luaopen_string(d_state);
++	    luaopen_table(d_state);
++	    luaopen_math(d_state);
++        #if defined(DEBUG) || defined (_DEBUG)
++	        luaopen_debug(d_state);
++        #endif
++    #endif /* LUA_VERSION_NUM >= 501 */
+ 
+ 	setModuleIdentifierString();
+ }
+--- CEGUILua.h	Thu Jan 29 20:08:23 2009
++++ CEGUILua.h	Thu Jan 29 10:18:39 2009
+@@ -38,7 +38,11 @@
+ #   ifdef CEGUILUA_EXPORTS
+ #       define CEGUILUA_API __declspec(dllexport)
+ #   else
+-#       define CEGUILUA_API __declspec(dllimport)
++#       if defined( __MINGW32__ )
++#           define CEGUILUA_API
++#       else
++#           define CEGUILUA_API __declspec(dllimport)
++#       endif
+ #   endif
+ #else
+ #   define CEGUILUA_API
+--- CEGUILuaFunctor.cpp	Thu Jan 29 20:08:38 2009
++++ CEGUILuaFunctor.cpp	Thu Jan 29 10:21:45 2009
+@@ -39,7 +39,7 @@
+ #include "lauxlib.h"
+ }
+ 
+-#include "tolua++.h"
++#include "tolua/tolua++.h"
+ 
+ // Start of CEGUI namespace section
+ namespace CEGUI
+--- required.h	Thu Jan 29 20:08:32 2009
++++ required.h	Thu Jan 29 15:01:58 2009
+@@ -36,6 +36,9 @@
+ #define __operator_decrement    operator--
+ #define __operator_dereference  operator*
+ 
++//This is used to keep compilers happy
++#define CEGUIDeadException(e) &
++
+ #define LuaFunctorSubscribeEvent CEGUI::LuaFunctor::SubscribeEvent
+ 
+ #if defined(_MSC_VER) && !defined(snprintf)
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/required.cpp
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/required.cpp	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/required.cpp	(revision 2664)
@@ -0,0 +1,88 @@
+/***********************************************************************
+	filename: required.cpp
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+	
+	purpose:  Implementation of helper functions
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "required.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+	Functions for getting Thumb range pairs as two return values
+*************************************************************************/
+
+// returns horizontal range as two values for lua
+void ceguiLua_Thumb_getHorzRange(Thumb* wnd, float* min, float* max)
+{
+	std::pair<float,float> range_pair = wnd->getHorzRange();
+	*min = range_pair.first;
+	*max = range_pair.second;
+}
+
+
+// returns vertical range as two values for lua
+void ceguiLua_Thumb_getVertRange(Thumb* wnd, float* min, float* max)
+{
+	std::pair<float,float> range_pair = wnd->getVertRange();
+	*min = range_pair.first;
+	*max = range_pair.second;
+}
+
+
+/*************************************************************************
+	Functions for creating list box items
+*************************************************************************/
+
+// allocates and returns a new ListboxTextItem
+ListboxTextItem* ceguiLua_createListboxTextItem(const String& text, uint item_id, void* item_data, bool disabled, bool auto_delete)
+{
+	return new ListboxTextItem(text,item_id,item_data,disabled,auto_delete);
+}
+
+
+/************************************************************************
+    OutStream
+*************************************************************************/
+void ceguiLua_FileStream_open(FileStream* os, const char* filename)
+{
+    os->open(filename, std::ios::binary);
+}
+
+
+/************************************************************************
+    CEGUI::System::getSystemKeys alternative
+*************************************************************************/
+bool ceguiLua_System_isSystemKeyDown(const System* sys, SystemKey k)
+{
+    return (k & sys->getSystemKeys()) != 0;
+}
+
+
+} // namespace CEGUI
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/required.h
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/required.h	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/ceguilua/required.h	(revision 2664)
@@ -0,0 +1,113 @@
+/***********************************************************************
+	filename: required.h
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+	
+	purpose:  Header that includes the necessary stuff needed for the Lua bindings
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "CEGUILua.h"
+#include "CEGUILuaFunctor.h"
+#include <fstream>
+
+#define __operator_increment    operator++
+#define __operator_decrement    operator--
+#define __operator_dereference  operator*
+
+//This is used to keep compilers happy
+#define CEGUIDeadException(e) &
+
+#define LuaFunctorSubscribeEvent CEGUI::LuaFunctor::SubscribeEvent
+
+#if defined(_MSC_VER) && !defined(snprintf)
+#   define snprintf   _snprintf
+#endif
+
+typedef CEGUI::String string;
+
+namespace CEGUI
+{
+
+typedef Event::Connection EventConnection;
+
+/*************************************************************************
+	Functions for getting Thumb range pairs as two return values
+*************************************************************************/
+void ceguiLua_Thumb_getHorzRange(Thumb* wnd, float* min, float* max);
+void ceguiLua_Thumb_getVertRange(Thumb* wnd, float* min, float* max);
+
+
+/*************************************************************************
+	Functions for creating list box items
+*************************************************************************/
+ListboxTextItem* ceguiLua_createListboxTextItem(const String& text, uint item_id, void* item_data, bool disabled, bool auto_delete);
+
+
+/************************************************************************
+    Stuff needed to make the iterators work
+*************************************************************************/
+typedef PropertySet::Iterator PropertyIterator;
+typedef EventSet::Iterator EventIterator;
+typedef WindowManager::WindowIterator WindowIterator;
+typedef WindowFactoryManager::WindowFactoryIterator WindowFactoryIterator;
+typedef WindowFactoryManager::FalagardMappingIterator FalagardMappingIterator;
+typedef WindowFactoryManager::FalagardWindowMapping FalagardWindowMapping;
+typedef ImagesetManager::ImagesetIterator ImagesetIterator;
+typedef Imageset::ImageIterator ImageIterator;
+typedef SchemeManager::SchemeIterator SchemeIterator;
+typedef FontManager::FontIterator FontIterator;
+
+template <typename T>
+inline PropertyIterator ceguiLua_getPropertyIterator(const T* self)
+{
+    return static_cast<const PropertySet*>(self)->getIterator();
+}
+
+template <typename T>
+inline EventIterator ceguiLua_getEventIterator(const T* self)
+{
+    return static_cast<const EventSet*>(self)->getIterator();
+}
+
+
+/************************************************************************
+    OutStream
+*************************************************************************/
+typedef std::ofstream FileStream;
+void ceguiLua_FileStream_open(FileStream*, const char* filename);
+
+
+/************************************************************************
+    CEGUI::System::getSystemKeys alternative
+*************************************************************************/
+bool ceguiLua_System_isSystemKeyDown(const System* sys, SystemKey k);
+
+}
+
+// the binding file generates alot of
+// warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
+#if defined(_MSC_VER)
+#   pragma warning(disable : 4800)
+#endif
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Basic.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Basic.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Basic.pkg	(revision 2664)
@@ -0,0 +1,190 @@
+/***********************************************************************
+    Vector2
+***********************************************************************/
+class Vector2
+{
+    // rename 'd_x' and 'd_y' to just 'x' and 'y'
+    float d_x @ x;
+    float d_y @ y;
+
+    Vector2 operator+ (const Vector2& vec) const;
+    Vector2 operator- (const Vector2& vec) const;
+    Vector2 operator* (const Vector2& vec) const;
+    bool operator== (const Vector2& vec) const;
+
+    Vector2();
+    Vector2(float x, float y);
+};
+
+// do a simple copy of Point to Vector2
+$[
+CEGUI.Point = CEGUI.Vector2
+$]
+
+
+
+/***********************************************************************
+	Size
+***********************************************************************/
+class Size
+{
+	// rename 'd_width' and 'd_height' to just 'width' and 'height'
+	float d_width @ width;
+	float d_height @ height;
+
+	bool operator== (const Size& sz) const;
+
+	Size();
+	Size(float w, float h);
+};
+
+
+
+/***********************************************************************
+	Rect
+***********************************************************************/
+class Rect
+{
+	// remove member variable 'd_' prefix
+	float d_top @ top;
+	float d_bottom @ bottom;
+	float d_left @ left;
+	float d_right @ right;
+
+	Vector2 getPosition() const;
+	float getWidth() const;
+	float getHeight() const;
+	Size getSize() const;
+
+	Rect getIntersection(const Rect& rect) const;
+	bool isPointInRect(const Vector2& p) const;
+
+	void setPosition(const Vector2& p);
+	void setWidth(float w);
+	void setHeight(float h);
+	void setSize(const Size& sz);
+
+	Rect& offset(const Vector2& p);
+	Rect& constrainSizeMax(const Size& sz);
+	Rect& constrainSizeMin(const Size& sz);
+	Rect& constrainSize(const Size& min, const Size& max);
+
+	bool operator== (const Rect& r) const;
+
+	Rect();
+	Rect(float l, float t, float r, float b);
+};
+
+
+
+/***********************************************************************
+	colour
+***********************************************************************/
+class colour
+{
+	float getAlpha() const;
+	float getRed() const;
+	float getGreen() const;
+	float getBlue() const;
+	float getHue() const;
+	float getSaturation() const;
+	float getLumination() const;
+
+	void set(float r, float g, float b, float a);
+	void setAlpha(float a);
+	void setRed(float r);
+	void setGreen(float g);
+	void setBlue(float b);
+	void setRGB(float r, float g, float b);
+	void setHSL(float hue, float saturation, float luminance, float alpha=1);
+
+	colour operator+ (const colour& c) const;
+	colour operator- (const colour& c) const;
+	//colour operator* (const colour& c) const; // gives a warning about argb_t to colour conversion
+	bool operator== (const colour& c) const;
+
+	colour();
+	colour(float r, float g, float b, float a);
+};
+
+
+
+/***********************************************************************
+	ColourRect
+***********************************************************************/
+class ColourRect
+{
+	colour d_top_left @ top_left;
+	colour d_top_right @ top_right;
+	colour d_bottom_left @ bottom_left;
+	colour d_bottom_right @ bottom_right;
+
+	void	setAlpha(float alpha);
+	void	setTopAlpha(float alpha);
+	void	setBottomAlpha(float alpha);
+	void	setLeftAlpha(float alpha);
+	void	setRightAlpha(float alpha);
+	void	modulateAlpha(float alpha);
+
+	void	setColours(const colour& col);
+
+	bool	isMonochromatic() const;
+
+	ColourRect getSubRectangle( float left, float right, float top, float bottom ) const;
+	colour getColourAtPoint( float x, float y ) const;
+
+	//ColourRect& operator*= (const ColourRect& other); // no support for *= operators
+
+	ColourRect();
+	ColourRect(const colour& col);
+	ColourRect(const colour& top_left, const colour& top_right, const colour& bottom_left, const colour& bottom_right);
+};
+
+
+
+/************************************************************************
+    String
+*************************************************************************/
+class String
+{
+    static const unsigned long npos;
+
+    unsigned long size() const;
+    unsigned long length() const;
+    bool empty() const;
+    unsigned long capacity() const;
+
+    unsigned long& operator[] (unsigned long i);
+    unsigned long& at(unsigned long i);
+    string c_str() const;
+
+    void reserve(unsigned long num=0);
+    void resize(unsigned long num);
+    void resize(unsigned long num, unsigned long codepoint);
+
+    void clear();
+    String& erase();
+    // default len is different from usual to handle ambiguity issue
+    String& erase(unsigned long idx, unsigned long len=1);
+
+    String& replace(unsigned long begin, unsigned long len, const String&s);
+    //String& replace(unsigned long begin, unsigned long len, unsigned long codepoint);
+
+    void swap(String& s);
+    String& insert(unsigned long pos, const String& s);
+    //String& insert(unsigned long pos, unsigned long codepoint);
+
+    unsigned long find(unsigned long codepoint, unsigned long idx=0) const;
+    unsigned long rfind(unsigned long codepoint, unsigned long idx=-1) const;
+    unsigned long find(const String& sub, unsigned long idx=0) const;
+    unsigned long rfind(const String& sub, unsigned long idx=-1) const;
+
+    String substr(unsigned long idx=0, unsigned long len=-1) const;
+
+    void push_back(unsigned long codepoint);
+
+    String();
+    String(unsigned long num, unsigned long codepoint);
+    String(string s);
+    String(const String& s);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/CEGUI.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/CEGUI.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/CEGUI.pkg	(revision 2664)
@@ -0,0 +1,116 @@
+// include the header that makes these files generate valid code
+$#include "ceguilua/required.h"
+$#include "CEGUIPropertyHelper.h"
+
+// start the CEGUI namespace and include everything inside that
+namespace CEGUI
+{
+
+$pfile "Basic.pkg"
+$pfile "UnifiedCoordSystem.pkg"
+$pfile "Logger.pkg"
+
+$pfile "Font.pkg"
+$pfile "FontManager.pkg"
+
+$pfile "Image.pkg"
+$pfile "Texture.pkg"
+$pfile "Imageset.pkg"
+$pfile "ImagesetManager.pkg"
+
+$pfile "Iterators.pkg"
+
+$pfile "Key.pkg"
+$pfile "InputEvent.pkg"
+$pfile "EventSet.pkg"
+
+$pfile "MouseCursor.pkg"
+$pfile "Window.pkg"
+$pfile "CoordConverter.pkg"
+$pfile "Renderer.pkg"
+$pfile "System.pkg"
+
+$pfile "WindowManager.pkg"
+$pfile "WindowFactoryManager.pkg"
+
+$pfile "Scheme.pkg"
+$pfile "SchemeManager.pkg"
+
+$pfile "PropertyHelper.pkg"
+
+// elements
+$pfile "elements/GUISheet.pkg"
+
+$pfile "elements/ButtonBase.pkg"
+$pfile "elements/Checkbox.pkg"
+$pfile "elements/PushButton.pkg"
+$pfile "elements/Thumb.pkg"
+$pfile "elements/RadioButton.pkg"
+
+$pfile "elements/TabButton.pkg"
+$pfile "elements/TabControl.pkg"
+
+$pfile "elements/Titlebar.pkg"
+$pfile "elements/FrameWindow.pkg"
+
+$pfile "elements/Tooltip.pkg"
+
+$pfile "elements/DragContainer.pkg"
+
+$pfile "elements/Scrollbar.pkg"
+$pfile "elements/ScrolledContainer.pkg"
+$pfile "elements/ScrollablePane.pkg"
+
+$pfile "elements/Slider.pkg"
+
+$pfile "elements/Spinner.pkg"
+
+$pfile "elements/ProgressBar.pkg"
+
+$pfile "elements/Editbox.pkg"
+$pfile "elements/MultiLineEditbox.pkg"
+
+$pfile "elements/ListboxItem.pkg"
+$pfile "elements/ListboxTextItem.pkg"
+
+$pfile "elements/Combobox.pkg"
+$pfile "elements/Listbox.pkg"
+$pfile "elements/ComboDropList.pkg"
+
+$pfile "elements/ListHeaderSegment.pkg"
+$pfile "elements/ListHeader.pkg"
+$pfile "elements/MultiColumnList.pkg"
+
+$pfile "elements/ItemEntry.pkg"
+$pfile "elements/ItemListBase.pkg"
+$pfile "elements/MenuBase.pkg"
+$pfile "elements/Menubar.pkg"
+$pfile "elements/PopupMenu.pkg"
+$pfile "elements/MenuItem.pkg"
+$pfile "elements/ScrolledItemListBase.pkg"
+$pfile "elements/ItemListbox.pkg"
+
+$pfile "falagard/Enums.pkg"
+$pfile "falagard/Dimension.pkg"
+$pfile "falagard/NamedArea.pkg"
+$pfile "falagard/PropertyDefinitionBase.pkg"
+$pfile "falagard/PropertyDefinition.pkg"
+$pfile "falagard/PropertyInitialiser.pkg"
+$pfile "falagard/PropertyLinkDefinition.pkg"
+$pfile "falagard/FalagardComponentBase.pkg"
+$pfile "falagard/FrameComponent.pkg"
+$pfile "falagard/ImageryComponent.pkg"
+$pfile "falagard/TextComponent.pkg"
+$pfile "falagard/ImagerySection.pkg"
+$pfile "falagard/SectionSpecification.pkg"
+$pfile "falagard/LayerSpecification.pkg"
+$pfile "falagard/StateImagery.pkg"
+$pfile "falagard/WidgetComponent.pkg"
+$pfile "falagard/WidgetLookFeel.pkg"
+$pfile "falagard/WidgetLookManager.pkg"
+
+$pfile "HelperFunctions.pkg"
+
+$pfile "OutStream.pkg"
+
+}
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/CoordConverter.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/CoordConverter.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/CoordConverter.pkg	(revision 2664)
@@ -0,0 +1,30 @@
+/***********************************************************************
+    CoordConverter utility class
+***********************************************************************/
+class CoordConverter
+{
+    static float windowToScreenX(const Window& window, const UDim& x);
+    static float windowToScreenX(const Window& window, const float x);
+
+    static float windowToScreenY(const Window& window, const UDim& y);
+    static float windowToScreenY(const Window& window, const float y);
+
+    static Vector2 windowToScreen(const Window& window, const UVector2& vec);
+    static Vector2 windowToScreen(const Window& window, const Vector2& vec);
+
+    static Rect windowToScreen(const Window& window, const URect& rect);
+    static Rect windowToScreen(const Window& window, const Rect& rect);
+
+    static float screenToWindowX(const Window& window, const UDim& x);
+    static float screenToWindowX(const Window& window, const float x);
+
+    static float screenToWindowY(const Window& window, const UDim& y);
+    static float screenToWindowY(const Window& window, const float y);
+
+    static Vector2 screenToWindow(const Window& window, const UVector2& vec);
+    static Vector2 screenToWindow(const Window& window, const Vector2& vec);
+
+    static Rect screenToWindow(const Window& window, const URect& rect);
+    static Rect screenToWindow(const Window& window, const Rect& rect);
+
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/EventSet.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/EventSet.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/EventSet.pkg	(revision 2664)
@@ -0,0 +1,46 @@
+/************************************************************************
+    Event
+*************************************************************************/
+class Event
+{
+    string getName() const;
+};
+
+class EventConnection
+{
+//    bool connected() const;
+//    void disconnect();
+};
+
+
+/***********************************************************************
+	EventSet
+***********************************************************************/
+class EventSet
+{
+	void addEvent(string name);
+	void removeEvent(string name);
+	void removeAllEvents();
+	bool isEventPresent(string name);
+
+	tolua_throws|CEGUI::UnknownObjectException,error| tolua_outside EventConnection LuaFunctorSubscribeEvent @ subscribeEvent(string name, lua_Object funcIndex, lua_Object selfIndex=LUA_NOREF, lua_State*);
+
+	tolua_throws|CEGUI::UnknownObjectException,error| EventConnection subscribeScriptedEvent @ subscribeEvent(string name, string callback_name);
+
+	void fireEvent(string name, EventArgs& args, string eventnamespace="");
+
+	bool isMuted() const;
+	void setMutedState(bool setting);
+
+    tolua_outside EventIterator ceguiLua_getEventIterator @ getEventIterator() const;
+};
+
+
+
+/***********************************************************************
+	GlobalEventSet
+***********************************************************************/
+class GlobalEventSet : public EventSet
+{
+	static GlobalEventSet& getSingleton();
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Font.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Font.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Font.pkg	(revision 2664)
@@ -0,0 +1,53 @@
+/***********************************************************************
+	TextFormatting
+***********************************************************************/
+enum TextFormatting
+{
+	LeftAligned,
+	RightAligned,
+	Centred,
+	Justified,
+	WordWrapLeftAligned,
+	WordWrapRightAligned,
+	WordWrapCentred,
+	WordWrapJustified
+};
+
+
+/***********************************************************************
+	Font
+***********************************************************************/
+class Font //: public PropertySet
+{
+	//////////////////////////////////////////////
+	// PropertySet
+	void setProperty(string name, string value);
+	string getProperty(string name) const;
+	string getPropertyDefault(string name) const;
+	string getPropertyHelp(string name) const;
+
+	bool isPropertyPresent(string name) const;
+	bool isPropertyDefault(string name) const;
+
+    tolua_outside PropertyIterator ceguiLua_getPropertyIterator @ getPropertyIterator() const;
+
+    static void setDefaultResourceGroup(string resourceGroup);
+    static string getDefaultResourceGroup();
+
+    void load ();
+
+	bool isCodepointAvailable(unsigned long cp) const;
+
+	void setNativeResolution(const Size& sz);
+	void notifyScreenResolution(const Size& sz);
+
+	float getTextExtent(string text, float xscale=1);
+	float getLineSpacing(float yscale=1) const;
+	float getFontHeight(float yscale=1) const;
+
+	unsigned long getCharAtPixel(string text, unsigned long start_char, float pixel, float xscale=1);
+	unsigned long getCharAtPixel(string text, float pixel, float xscale=1);
+
+	unsigned long getFormattedLineCount(string text, const Rect& format_area, TextFormatting fmt, float xscale=1);
+	float getFormattedTextExtent(string text, const Rect& format_area, TextFormatting fmt, float xscale=1);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/FontManager.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/FontManager.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/FontManager.pkg	(revision 2664)
@@ -0,0 +1,21 @@
+/***********************************************************************
+	FontManager
+***********************************************************************/
+class FontManager
+{
+	static FontManager& getSingleton();
+
+	tolua_throws|CEGUI::AlreadyExistsException,error|CEGUI::InvalidRequestException,error| Font* createFont(string type, string name, string fontname, string resourcegroup="");
+	tolua_throws|CEGUI::AlreadyExistsException,error|CEGUI::InvalidRequestException,error| Font* createFont(string filename, string resourcegroup="");
+
+	void destroyFont(string name);
+	void destroyFont(Font* font);
+	void destroyAllFonts();
+
+	bool isFontPresent(string name) const;
+	Font* getFont(string name) const;
+
+	void notifyScreenResolution(const Size& sz);
+
+    FontIterator getIterator() const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/HelperFunctions.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/HelperFunctions.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/HelperFunctions.pkg	(revision 2664)
@@ -0,0 +1,235 @@
+/****************************************************
+	EventArgs casting helper functions.
+	These are not part of the core CEGUI API, merely here for
+	convenience
+*****************************************************/
+$[
+
+function CEGUI.toMouseCursorEventArgs(e)
+    return tolua.cast(e,"const CEGUI::MouseCursorEventArgs")
+end
+
+function CEGUI.toWindowEventArgs(e)
+    return tolua.cast(e,"const CEGUI::WindowEventArgs")
+end
+
+function CEGUI.toActivationEventArgs(e)
+    return tolua.cast(e,"const CEGUI::ActivationEventArgs")
+end
+
+function CEGUI.toHeaderSequenceEventArgs(e)
+    return tolua.cast(e,"const CEGUI::HeaderSequenceEventArgs")
+end
+
+function CEGUI.toMouseEventArgs(e)
+    return tolua.cast(e,"const CEGUI::MouseEventArgs")
+end
+
+function CEGUI.toKeyEventArgs(e)
+    return tolua.cast(e,"const CEGUI::KeyEventArgs")
+end
+
+function CEGUI.toDragDropEventArgs(e)
+    return tolua.cast(e,"const CEGUI::DragDropEventArgs")
+end
+
+CEGUI.EventArgs.toMouseCursorEventArgs      = CEGUI.toMouseCursorEventArgs
+CEGUI.EventArgs.toWindowEventArgs           = CEGUI.toWindowEventArgs
+CEGUI.EventArgs.toActivationEventArgs       = CEGUI.toActivationEventArgs
+CEGUI.EventArgs.toHeaderSequenceEventArgs   = CEGUI.toHeaderSequenceEventArgs
+CEGUI.EventArgs.toMouseEventArgs            = CEGUI.toMouseEventArgs
+CEGUI.EventArgs.toKeyEventArgs              = CEGUI.toKeyEventArgs
+CEGUI.EventArgs.toDragDropEventArgs         = CEGUI.toDragDropEventArgs
+
+$]
+
+
+/****************************************************
+	Functions for easy casting CEGUI::Window class
+	to the widget classes derived from it.
+	
+	all widget types gets these and they are made available as:
+	CEGUI.toButtonBase and CEGUI.Window:toButtonBase
+	etc...
+*****************************************************/
+$[
+
+function CEGUI.toButtonBase(w)
+    return tolua.cast(w,"CEGUI::ButtonBase")
+end
+
+function CEGUI.toCheckbox(w)
+    return tolua.cast(w,"CEGUI::Checkbox")
+end
+
+function CEGUI.toCombobox(w)
+    return tolua.cast(w,"CEGUI::Combobox")
+end
+
+function CEGUI.toComboDropList(w)
+    return tolua.cast(w,"CEGUI::ComboDropList")
+end
+
+function CEGUI.toDragContainer(w)
+    return tolua.cast(w,"CEGUI::DragContainer")
+end
+
+function CEGUI.toEditbox(w)
+    return tolua.cast(w,"CEGUI::Editbox")
+end
+
+function CEGUI.toFrameWindow(w)
+    return tolua.cast(w,"CEGUI::FrameWindow")
+end
+
+function CEGUI.toGUISheet(w)
+    return tolua.cast(w,"CEGUI::GUISheet")
+end
+
+function CEGUI.toItemEntry(w)
+    return tolua.cast(w,"CEGUI::ItemEntry")
+end
+
+function CEGUI.toItemListBase(w)
+    return tolua.cast(w,"CEGUI::ItemListBase")
+end
+
+function CEGUI.toItemListbox(w)
+    return tolua.cast(w,"CEGUI::ItemListbox")
+end
+
+function CEGUI.toListbox(w)
+    return tolua.cast(w,"CEGUI::Listbox")
+end
+
+function CEGUI.toListHeader(w)
+    return tolua.cast(w,"CEGUI::ListHeader")
+end
+
+function CEGUI.toListHeaderSegment(w)
+    return tolua.cast(w,"CEGUI::ListHeaderSegment")
+end
+
+function CEGUI.toMenubar(w)
+    return tolua.cast(w,"CEGUI::Menubar")
+end
+
+function CEGUI.toMenuBase(w)
+    return tolua.cast(w,"CEGUI::MenuBase")
+end
+
+function CEGUI.toMenuItem(w)
+    return tolua.cast(w,"CEGUI::MenuItem")
+end
+
+function CEGUI.toMultiColumnList(w)
+    return tolua.cast(w,"CEGUI::MultiColumnList")
+end
+
+function CEGUI.toMultiLineEditbox(w)
+    return tolua.cast(w,"CEGUI::MultiLineEditbox")
+end
+
+function CEGUI.toPopupMenu(w)
+    return tolua.cast(w,"CEGUI::PopupMenu")
+end
+
+function CEGUI.toProgressBar(w)
+    return tolua.cast(w,"CEGUI::ProgressBar")
+end
+
+function CEGUI.toPushButton(w)
+    return tolua.cast(w,"CEGUI::PushButton")
+end
+
+function CEGUI.toRadioButton(w)
+    return tolua.cast(w,"CEGUI::RadioButton")
+end
+
+function CEGUI.toScrollablePane(w)
+    return tolua.cast(w,"CEGUI::ScrollablePane")
+end
+
+function CEGUI.toScrollbar(w)
+    return tolua.cast(w,"CEGUI::Scrollbar")
+end
+
+function CEGUI.toScrolledContainer(w)
+    return tolua.cast(w,"CEGUI::ScrolledContainer")
+end
+
+function CEGUI.toScrolledItemListBase(w)
+    return tolua.cast(w,"CEGUI::ScrolledItemListBase")
+end
+
+function CEGUI.toSlider(w)
+    return tolua.cast(w,"CEGUI::Slider")
+end
+
+function CEGUI.toSpinner(w)
+    return tolua.cast(w,"CEGUI::Spinner")
+end
+
+function CEGUI.toTabButton(w)
+    return tolua.cast(w,"CEGUI::TabButton")
+end
+
+function CEGUI.toTabControl(w)
+    return tolua.cast(w,"CEGUI::TabControl")
+end
+
+function CEGUI.toTabPane(w)
+    return tolua.cast(w,"CEGUI::TabPane")
+end
+
+function CEGUI.toThumb(w)
+    return tolua.cast(w,"CEGUI::Thumb")
+end
+
+function CEGUI.toTooltip(w)
+    return tolua.cast(w,"CEGUI::Tooltip")
+end
+
+CEGUI.Window.toButtonBase = CEGUI.toButtonBase
+CEGUI.Window.toCheckbox = CEGUI.toCheckbox
+CEGUI.Window.toCombobox = CEGUI.toCombobox
+CEGUI.Window.toComboDropList = CEGUI.toComboDropList
+CEGUI.Window.toDragContainer = CEGUI.toDragContainer
+CEGUI.Window.toEditbox = CEGUI.toEditbox
+CEGUI.Window.toFrameWindow = CEGUI.toFrameWindow
+CEGUI.Window.toGUISheet = CEGUI.toGUISheet
+CEGUI.Window.toItemEntry = CEGUI.toItemEntry
+CEGUI.Window.toItemListBase = CEGUI.toItemListBase
+CEGUI.Window.toItemListbox = CEGUI.toItemListBase
+CEGUI.Window.toListbox = CEGUI.toListbox
+CEGUI.Window.toListHeader = CEGUI.toListHeader
+CEGUI.Window.toListHeaderSegment = CEGUI.toListHeaderSegment
+CEGUI.Window.toMenubar = CEGUI.toMenubar
+CEGUI.Window.toMenuBase = CEGUI.toMenuBase
+CEGUI.Window.toMenuItem = CEGUI.toMenuItem
+CEGUI.Window.toMultiColumnList = CEGUI.toMultiColumnList
+CEGUI.Window.toMultiLineEditbox = CEGUI.toMultiLineEditbox
+CEGUI.Window.toPopupMenu = CEGUI.toPopupMenu
+CEGUI.Window.toProgressBar = CEGUI.toProgressBar
+CEGUI.Window.toPushButton = CEGUI.toPushButton
+CEGUI.Window.toRadioButton = CEGUI.toRadioButton
+CEGUI.Window.toScrollablePane = CEGUI.toScrollablePane
+CEGUI.Window.toScrollbar = CEGUI.toScrollbar
+CEGUI.Window.toScrolledContainer = CEGUI.toScrolledContainer
+CEGUI.Window.toScrolledItemListBase = CEGUI.toScrolledItemListBase
+CEGUI.Window.toSlider = CEGUI.toSlider
+CEGUI.Window.toSpinner = CEGUI.toSpinner
+CEGUI.Window.toTabButton = CEGUI.toTabButton
+CEGUI.Window.toTabControl = CEGUI.toTabControl
+CEGUI.Window.toTabPane = CEGUI.toTabPane
+CEGUI.Window.toThumb = CEGUI.toThumb
+CEGUI.Window.toTooltip = CEGUI.toTooltip
+
+$]
+
+
+/****************************************************
+	Helper to create a ListboxTextItem.
+	Mimics the constructor
+*****************************************************/
+ListboxTextItem* ceguiLua_createListboxTextItem @ createListboxTextItem(string text, unsigned int item_id=0, void* item_data=0, bool disabled=false, bool auto_delete=true);
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Image.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Image.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Image.pkg	(revision 2664)
@@ -0,0 +1,15 @@
+/***********************************************************************
+	Image
+***********************************************************************/
+class Image
+{
+	Size getSize() const;
+	float getWidth() const;
+	float getHeight() const;
+	Vector2 getOffsets() const;
+	float getOffsetX() const;
+	float getOffsetY() const;
+	string getName() const;
+	string getImagesetName() const;
+	Rect getSourceTextureArea() const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Imageset.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Imageset.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Imageset.pkg	(revision 2664)
@@ -0,0 +1,31 @@
+/***********************************************************************
+	Imageset
+***********************************************************************/
+class Imageset
+{
+	Texture* getTexture() const;
+	string getName() const;
+	unsigned int getImageCount() const;
+	bool isImageDefined(string name) const;
+	const Image& getImage(string name) const;
+	void undefineImage(string name);
+	void undefineAllImages();
+	Size getImageSize(string name) const;
+	float getImageWidth(string name) const;
+	float getImageHeight(string name) const;
+	Vector2 getImageOffset(string name) const;
+	float getImageOffsetX(string name) const;
+	float getImageOffsetY(string name) const;
+	void defineImage(string name, const Vector2& pos, const Size& size, const Vector2& render_offset);
+	void defineImage(string name, const Rect& rect, const Vector2& render_offset);
+	bool isAutoScaled() const;
+	void setAutoScalingEnabled(bool setting);
+	Size getNativeResolution() const;
+	void setNativeResolution(const Size& sz);
+	void notifyScreenResolution(const Size& sz);
+
+    ImageIterator getIterator() const;
+
+    static void setDefaultResourceGroup(string resourceGroup);
+    static string getDefaultResourceGroup();
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/ImagesetManager.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/ImagesetManager.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/ImagesetManager.pkg	(revision 2664)
@@ -0,0 +1,22 @@
+/***********************************************************************
+	ImagesetManager
+***********************************************************************/
+class ImagesetManager
+{
+	static ImagesetManager& getSingleton();
+
+	tolua_throws|CEGUI::Exception,error| Imageset* createImageset(string name, Texture* texture);
+	tolua_throws|CEGUI::Exception,error| Imageset* createImageset(string filename, string resourcegroup="");
+	tolua_throws|CEGUI::Exception,error| Imageset* createImagesetFromImageFile(string name, string filename, string resourcegroup="");
+
+	void destroyImageset(Imageset* imageset);
+	void destroyImageset(string name);
+	void destroyAllImagesets();
+
+	tolua_throws|CEGUI::Exception,nil| Imageset* getImageset(string name) const;
+	bool isImagesetPresent(string name) const;
+
+	void notifyScreenResolution(const Size& size);
+
+    ImagesetIterator getIterator() const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/InputEvent.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/InputEvent.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/InputEvent.pkg	(revision 2664)
@@ -0,0 +1,118 @@
+/***********************************************************************
+	EventArgs
+***********************************************************************/
+class EventArgs
+{
+	bool handled;
+
+	EventArgs();
+};
+
+
+
+/***********************************************************************
+	MouseCursorEventArgs
+***********************************************************************/
+class MouseCursorEventArgs : public EventArgs
+{
+	MouseCursor* mouseCursor;
+	const Image* image;
+
+	MouseCursorEventArgs(MouseCursor* cursor);
+};
+
+
+
+/***********************************************************************
+	WindowEventArgs
+***********************************************************************/
+class WindowEventArgs : public EventArgs
+{
+	Window* window;
+
+	WindowEventArgs(Window* wnd);
+};
+
+
+
+/***********************************************************************
+	ActivationEventArgs
+***********************************************************************/
+class ActivationEventArgs : public WindowEventArgs
+{
+	Window* otherWindow;
+
+	ActivationEventArgs(Window* wnd);
+};
+
+
+
+/***********************************************************************
+	HeaderSequenceEventArgs
+***********************************************************************/
+class HeaderSequenceEventArgs : public WindowEventArgs
+{
+	// remove 'd_' member variable prefix
+	unsigned int d_oldIdx @ oldIdx;
+	unsigned int d_newIdx @ newIdx;
+
+	HeaderSequenceEventArgs(Window* wnd, unsigned int old_index, unsigned int new_index);
+};
+
+
+
+/***********************************************************************
+	MouseButton
+***********************************************************************/
+enum MouseButton
+{
+	LeftButton,
+	RightButton,
+	MiddleButton,
+	X1Button,
+	X2Button,
+	MouseButtonCount,
+	NoButton
+};
+
+
+
+/***********************************************************************
+	MouseEventArgs
+***********************************************************************/
+class MouseEventArgs : public WindowEventArgs
+{
+	Vector2 position;
+	Vector2 moveDelta;
+	MouseButton button;
+	unsigned int sysKeys;
+	float wheelChange;
+
+	MouseEventArgs(Window* wnd);
+};
+
+
+
+/***********************************************************************
+	KeyEventArgs
+***********************************************************************/
+class KeyEventArgs : public WindowEventArgs
+{
+	unsigned long codepoint;
+	Key::Scan scancode;
+	unsigned int sysKeys;
+
+	KeyEventArgs(Window* wnd);
+};
+
+
+
+/************************************************************************
+    DragDropEventArgs
+*************************************************************************/
+class DragDropEventArgs : public WindowEventArgs
+{
+    DragContainer* dragDropItem;
+
+    DragDropEventArgs(Window* wnd);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Iterators.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Iterators.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Iterators.pkg	(revision 2664)
@@ -0,0 +1,295 @@
+/************************************************************************
+    Lua iterator implementation
+*************************************************************************/
+$[
+
+function CEGUI.iterator_impl_next(p)
+    if p:isAtEnd() then
+        return nil;
+    end
+    local k,v = p:key(), p:value();
+    p:next();
+    return k,v;
+end
+
+function CEGUI.iterator_impl(self)
+   return CEGUI.iterator_impl_next, self; 
+end
+
+$]
+
+
+
+/************************************************************************
+    PropertyIterator
+*************************************************************************/
+class Property
+{
+    string getHelp() const;
+    string getName() const;
+};
+
+class PropertyIterator
+{
+    string getCurrentKey @ key() const;
+    Property* getCurrentValue @ value() const;
+
+    bool isAtEnd() const;
+    bool isAtStart() const;
+
+    PropertyIterator& __operator_increment @ next();
+    PropertyIterator& __operator_decrement @ previous();
+    bool operator== (const PropertyIterator& rhs) const;
+
+    void toStart();
+    void toEnd();
+
+    PropertyIterator(const PropertyIterator& org);
+};
+
+// lua iterator
+$[
+
+CEGUI.PropertyIterator.iterator = CEGUI.iterator_impl;
+
+$]
+
+
+
+/************************************************************************
+    EventIterator
+*************************************************************************/
+class EventIterator
+{
+    string getCurrentKey @ key() const;
+    Event* getCurrentValue @ value() const;
+
+    bool isAtEnd() const;
+    bool isAtStart() const;
+
+    EventIterator& __operator_increment @ next();
+    EventIterator& __operator_decrement @ previous();
+    bool operator== (const EventIterator& rhs) const;
+
+    void toStart();
+    void toEnd();
+
+    EventIterator(const EventIterator& org);
+};
+
+// lua iterator
+$[
+
+CEGUI.EventIterator.iterator = CEGUI.iterator_impl;
+
+$]
+
+
+
+/************************************************************************
+    WindowIterator
+*************************************************************************/
+class WindowIterator
+{
+    string getCurrentKey @ key() const;
+    Window* getCurrentValue @ value() const;
+
+    bool isAtEnd() const;
+    bool isAtStart() const;
+
+    WindowIterator& __operator_increment @ next();
+    WindowIterator& __operator_decrement @ previous();
+    bool operator== (const WindowIterator& rhs) const;
+
+    void toStart();
+    void toEnd();
+
+    WindowIterator(const WindowIterator& org);
+};
+
+// lua iterator
+$[
+
+CEGUI.WindowIterator.iterator = CEGUI.iterator_impl;
+
+$]
+
+
+
+/************************************************************************
+    WindowFactoryIterator
+*************************************************************************/
+class WindowFactoryIterator
+{
+    string getCurrentKey @ key() const;
+    WindowFactory* getCurrentValue @ value() const;
+
+    bool isAtEnd() const;
+    bool isAtStart() const;
+
+    WindowFactoryIterator& __operator_increment @ next();
+    WindowFactoryIterator& __operator_decrement @ previous();
+    bool operator== (const WindowFactoryIterator& rhs) const;
+
+    void toStart();
+    void toEnd();
+
+    WindowFactoryIterator(const WindowFactoryIterator& org);
+};
+
+// lua iterator
+$[
+
+CEGUI.WindowFactoryIterator.iterator = CEGUI.iterator_impl;
+
+$]
+
+
+
+/************************************************************************
+    FalagardMappingIterator
+*************************************************************************/
+class FalagardMappingIterator
+{
+    string getCurrentKey @ key() const;
+    FalagardWindowMapping getCurrentValue @ value() const;
+
+    bool isAtEnd() const;
+    bool isAtStart() const;
+
+    FalagardMappingIterator& __operator_increment @ next();
+    FalagardMappingIterator& __operator_decrement @ previous();
+    bool operator== (const FalagardMappingIterator& rhs) const;
+
+    void toStart();
+    void toEnd();
+
+    FalagardMappingIterator(const FalagardMappingIterator& org);
+};
+
+// lua iterator
+$[
+
+CEGUI.FalagardMappingIterator.iterator = CEGUI.iterator_impl;
+
+$]
+
+
+
+/************************************************************************
+    ImagesetIterator
+*************************************************************************/
+class ImagesetIterator
+{
+    string getCurrentKey @ key() const;
+    Imageset* getCurrentValue @ value() const;
+
+    bool isAtEnd() const;
+    bool isAtStart() const;
+
+    ImagesetIterator& __operator_increment @ next();
+    ImagesetIterator& __operator_decrement @ previous();
+    bool operator== (const ImagesetIterator& rhs) const;
+
+    void toStart();
+    void toEnd();
+
+    ImagesetIterator(const ImagesetIterator& org);
+};
+
+// lua iterator
+$[
+
+CEGUI.ImagesetIterator.iterator = CEGUI.iterator_impl;
+
+$]
+
+
+
+/************************************************************************
+    ImageIterator
+*************************************************************************/
+class ImageIterator
+{
+    string getCurrentKey @ key() const;
+    Image getCurrentValue @ value() const;
+
+    bool isAtEnd() const;
+    bool isAtStart() const;
+
+    ImageIterator& __operator_increment @ next();
+    ImageIterator& __operator_decrement @ previous();
+    bool operator== (const ImageIterator& rhs) const;
+
+    void toStart();
+    void toEnd();
+
+    ImageIterator(const ImageIterator& org);
+};
+
+// lua iterator
+$[
+
+CEGUI.ImageIterator.iterator = CEGUI.iterator_impl;
+
+$]
+
+
+
+/************************************************************************
+    SchemeIterator
+*************************************************************************/
+class SchemeIterator
+{
+    string getCurrentKey @ key() const;
+    Scheme* getCurrentValue @ value() const;
+
+    bool isAtEnd() const;
+    bool isAtStart() const;
+
+    SchemeIterator& __operator_increment @ next();
+    SchemeIterator& __operator_decrement @ previous();
+    bool operator== (const SchemeIterator& rhs) const;
+
+    void toStart();
+    void toEnd();
+
+    SchemeIterator(const SchemeIterator& org);
+};
+
+// lua iterator
+$[
+
+CEGUI.SchemeIterator.iterator = CEGUI.iterator_impl;
+
+$]
+
+
+
+/************************************************************************
+    FontIterator
+*************************************************************************/
+class FontIterator
+{
+    string getCurrentKey @ key() const;
+    Font* getCurrentValue @ value() const;
+
+    bool isAtEnd() const;
+    bool isAtStart() const;
+
+    FontIterator& __operator_increment @ next();
+    FontIterator& __operator_decrement @ previous();
+    bool operator== (const FontIterator& rhs) const;
+
+    void toStart();
+    void toEnd();
+
+    FontIterator(const FontIterator& org);
+};
+
+// lua iterator
+$[
+
+CEGUI.FontIterator.iterator = CEGUI.iterator_impl;
+
+$]
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Key.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Key.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Key.pkg	(revision 2664)
@@ -0,0 +1,175 @@
+/***********************************************************************
+	Key::Scan
+
+	This is'nt exactly how it's done in the C++ code, but it works
+	fine anyway :)
+***********************************************************************/
+namespace Key
+{
+
+enum Scan
+{
+	Escape          =0x01,
+	One             =0x02,
+	Two             =0x03,
+	Three           =0x04,
+	Four            =0x05,
+	Five            =0x06,
+	Six             =0x07,
+	Seven           =0x08,
+	Eight           =0x09,
+	Nine            =0x0A,
+	Zero            =0x0B,
+	Minus           =0x0C,    /* - on main keyboard */
+	Equals			=0x0D,
+	Backspace		=0x0E,    /* backspace */
+	Tab				=0x0F,
+	Q               =0x10,
+	W               =0x11,
+	E               =0x12,
+	R               =0x13,
+	T               =0x14,
+	Y               =0x15,
+	U               =0x16,
+	I               =0x17,
+	O               =0x18,
+	P               =0x19,
+	LeftBracket     =0x1A,
+	RightBracket    =0x1B,
+	Return			=0x1C,    /* Enter on main keyboard */
+	LeftControl		=0x1D,
+	A               =0x1E,
+	S               =0x1F,
+	D               =0x20,
+	F               =0x21,
+	G               =0x22,
+	H               =0x23,
+	J               =0x24,
+	K               =0x25,
+	L               =0x26,
+	Semicolon       =0x27,
+	Apostrophe		=0x28,
+	Grave           =0x29,    /* accent grave */
+	LeftShift       =0x2A,
+	Backslash       =0x2B,
+	Z               =0x2C,
+	X               =0x2D,
+	C               =0x2E,
+	V               =0x2F,
+	B               =0x30,
+	N               =0x31,
+	M               =0x32,
+	Comma           =0x33,
+	Period          =0x34,    /* . on main keyboard */
+	Slash           =0x35,    /* '/' on main keyboard */
+	RightShift      =0x36,
+	Multiply        =0x37,    /* * on numeric keypad */
+	LeftAlt         =0x38,    /* left Alt */
+	Space           =0x39,
+	Capital         =0x3A,
+	F1              =0x3B,
+	F2              =0x3C,
+	F3              =0x3D,
+	F4              =0x3E,
+	F5              =0x3F,
+	F6              =0x40,
+	F7              =0x41,
+	F8              =0x42,
+	F9              =0x43,
+	F10             =0x44,
+	NumLock         =0x45,
+	ScrollLock      =0x46,    /* Scroll Lock */
+	Numpad7         =0x47,
+	Numpad8         =0x48,
+	Numpad9         =0x49,
+	Subtract        =0x4A,    /* - on numeric keypad */
+	Numpad4         =0x4B,
+	Numpad5         =0x4C,
+	Numpad6         =0x4D,
+	Add				=0x4E,    /* + on numeric keypad */
+	Numpad1         =0x4F,
+	Numpad2         =0x50,
+	Numpad3         =0x51,
+	Numpad0         =0x52,
+	Decimal			=0x53,    /* . on numeric keypad */
+	OEM_102         =0x56,    /* < > | on UK/Germany keyboards */
+	F11             =0x57,
+	F12             =0x58,
+	F13             =0x64,    /*                     (NEC PC98) */
+	F14             =0x65,    /*                     (NEC PC98) */
+	F15             =0x66,    /*                     (NEC PC98) */
+	Kana            =0x70,    /* (Japanese keyboard)            */
+	ABNT_C1         =0x73,    /* / ? on Portugese (Brazilian) keyboards */
+	Convert         =0x79,    /* (Japanese keyboard)            */
+	NoConvert       =0x7B,    /* (Japanese keyboard)            */
+	Yen             =0x7D,    /* (Japanese keyboard)            */
+	ABNT_C2         =0x7E,    /* Numpad . on Portugese (Brazilian) keyboards */
+	NumpadEquals    =0x8D,    /* = on numeric keypad (NEC PC98) */
+	PrevTrack       =0x90,    /* Previous Track (KC_CIRCUMFLEX on Japanese keyboard) */
+	At              =0x91,    /*                     (NEC PC98) */
+	Colon           =0x92,    /*                     (NEC PC98) */
+	Underline       =0x93,    /*                     (NEC PC98) */
+	Kanji           =0x94,    /* (Japanese keyboard)            */
+	Stop            =0x95,    /*                     (NEC PC98) */
+	AX              =0x96,    /*                     (Japan AX) */
+	Unlabeled       =0x97,    /*                        (J3100) */
+	NextTrack       =0x99,    /* Next Track */
+	NumpadEnter     =0x9C,    /* Enter on numeric keypad */
+	RightControl    =0x9D,
+	Mute            =0xA0,    /* Mute */
+	Calculator      =0xA1,    /* Calculator */
+	PlayPause       =0xA2,    /* Play / Pause */
+	MediaStop       =0xA4,    /* Media Stop */
+	VolumeDown      =0xAE,    /* Volume - */
+	VolumeUp        =0xB0,    /* Volume + */
+	WebHome         =0xB2,    /* Web home */
+	NumpadComma     =0xB3,    /* , on numeric keypad (NEC PC98) */
+	Divide          =0xB5,    /* / on numeric keypad */
+	SysRq           =0xB7,
+	RightAlt        =0xB8,    /* right Alt */
+	Pause           =0xC5,    /* Pause */
+	Home            =0xC7,    /* Home on arrow keypad */
+	ArrowUp         =0xC8,    /* UpArrow on arrow keypad */
+	PageUp          =0xC9,    /* PgUp on arrow keypad */
+	ArrowLeft       =0xCB,    /* LeftArrow on arrow keypad */
+	ArrowRight      =0xCD,    /* RightArrow on arrow keypad */
+	End             =0xCF,    /* End on arrow keypad */
+	ArrowDown       =0xD0,    /* DownArrow on arrow keypad */
+	PageDown		=0xD1,    /* PgDn on arrow keypad */
+	Insert          =0xD2,    /* Insert on arrow keypad */
+	Delete          =0xD3,    /* Delete on arrow keypad */
+	LeftWindows     =0xDB,    /* Left Windows key */
+	RightWindow     =0xDC,    /* Right Windows key */
+	AppMenu         =0xDD,    /* AppMenu key */
+	Power           =0xDE,    /* System Power */
+	Sleep           =0xDF,    /* System Sleep */
+	Wake			=0xE3,    /* System Wake */
+	WebSearch		=0xE5,    /* Web Search */
+	WebFavorites	=0xE6,    /* Web Favorites */
+	WebRefresh		=0xE7,    /* Web Refresh */
+	WebStop			=0xE8,    /* Web Stop */
+	WebForward		=0xE9,    /* Web Forward */
+	WebBack			=0xEA,    /* Web Back */
+	MyComputer		=0xEB,    /* My Computer */
+	Mail			=0xEC,    /* Mail */
+	MediaSelect		=0xED     /* Media Select */
+
+}; // Key::Scan
+
+} // Key
+
+
+
+/***********************************************************************
+	SystemKey
+***********************************************************************/
+enum SystemKey
+{
+	LeftMouse		= 0x01,			//!< The left mouse button.
+	RightMouse		= 0x02,			//!< The right mouse button.
+	Shift			= 0x04,			//!< Either shift key.
+	Control			= 0x08,			//!< Either control key.
+	MiddleMouse		= 0x10,			//!< The middle mouse button.
+	X1Mouse			= 0x20,			//!< The first 'extra' mouse button
+	X2Mouse			= 0x40			//!< The second 'extra' mouse button.
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Logger.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Logger.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Logger.pkg	(revision 2664)
@@ -0,0 +1,25 @@
+/***********************************************************************
+	LoggingLevel
+***********************************************************************/
+enum LoggingLevel
+{
+	Errors,
+	Standard,
+	Informative,
+	Insane
+};
+
+
+
+/***********************************************************************
+	Logger
+***********************************************************************/
+class Logger
+{
+	static Logger& getSingleton();
+
+	void setLoggingLevel(LoggingLevel level);
+	LoggingLevel getLoggingLevel() const;
+
+	void logEvent(string message, LoggingLevel level=Standard);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/MouseCursor.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/MouseCursor.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/MouseCursor.pkg	(revision 2664)
@@ -0,0 +1,40 @@
+/***********************************************************************
+	MouseCursorImage
+***********************************************************************/
+enum MouseCursorImage
+{
+	BlankMouseCursor	= 0,
+	DefaultMouseCursor	= -1
+};
+
+
+
+/***********************************************************************
+	MouseCursor
+***********************************************************************/
+class MouseCursor : public EventSet
+{
+	static MouseCursor& getSingleton();
+
+	void setImage(const Image* image);
+	void setImage(string imageset, string image);
+	const Image* getImage() const;
+
+	void setPosition(const Vector2& pos);
+	void offsetPosition(const Vector2& offset);
+	void setConstraintArea(const Rect* area);
+	Vector2 getPosition() const;
+	Rect getConstraintArea() const;
+	Vector2 getDisplayIndependantPosition() const;
+
+	void setUnifiedConstraintArea(const URect* area);
+	const URect& getUnifiedConstraintArea(void) const;
+
+	void hide();
+	void show();
+
+    void setVisible(bool visible);
+	bool isVisible() const;
+
+    tolua_outside EventIterator ceguiLua_getEventIterator @ getEventIterator() const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/OutStream.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/OutStream.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/OutStream.pkg	(revision 2664)
@@ -0,0 +1,16 @@
+/***********************************************************************
+    OutStream
+***********************************************************************/
+
+class OutStream
+{
+};
+
+class FileStream : public OutStream
+{
+    FileStream();
+
+    bool is_open();
+    tolua_outside void CEGUI::ceguiLua_FileStream_open @ open(const char* filename);
+    void close();
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/PropertyHelper.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/PropertyHelper.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/PropertyHelper.pkg	(revision 2664)
@@ -0,0 +1,33 @@
+/***********************************************************************
+	PropertyHelper
+***********************************************************************/
+class PropertyHelper
+{
+	static	float			stringToFloat(string str);
+	static	unsigned int	stringToUint(string str);
+	static	bool			stringToBool(string str);
+	static	Size			stringToSize(string str);
+	static	Vector2			stringToPoint(string str);
+	static	Rect			stringToRect(string str);
+	static	const Image*	stringToImage(string str);
+	static	colour			stringToColour(string str);
+	static	ColourRect		stringToColourRect(string str);
+
+	static	UDim			stringToUDim(string str);
+	static	UVector2		stringToUVector2(string str);
+	static	URect			stringToURect(string str);
+
+	static string	floatToString(float val);
+	static string	uintToString(unsigned int val);
+	static string	boolToString(bool val);
+	static string	sizeToString(const Size& val);
+	static string	pointToString(const Vector2& val);
+	static string	rectToString(const Rect& val);
+	static string	imageToString(const Image* val);
+	static string	colourToString(const colour& val);
+	static string	colourRectToString(const ColourRect& val);
+
+	static string	udimToString(const UDim& val);
+	static string	uvector2ToString(const UVector2& val);
+	static string	urectToString(const URect& val);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Renderer.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Renderer.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Renderer.pkg	(revision 2664)
@@ -0,0 +1,34 @@
+/***********************************************************************
+	Renderer
+***********************************************************************/
+class Renderer : public EventSet
+{
+	//void doRender();
+	//void clearRenderList();
+
+	//void resetZValue();
+	//void advanceZValue();
+	float getCurrentZ() const;
+	float getZLayer(unsigned int layer) const;
+
+	//void setQueueingEnabled(bool setting);
+	bool isQueueingEnabled() const;
+
+	Texture* createTexture();
+	Texture* createTexture(float size);
+	Texture* createTexture(string filename, string resourcegroup);
+
+	void destroyTexture(Texture* tex);
+	void destroyAllTextures();
+
+	float getWidth() const;
+	float getHeight() const;
+	Size getSize() const;
+	Rect getRect() const;
+
+	unsigned int getMaxTextureSize() const;
+	unsigned int getHorzScreenDPI() const;
+	unsigned int getVertScreenDPI() const;
+
+    tolua_outside EventIterator ceguiLua_getEventIterator @ getEventIterator() const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Scheme.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Scheme.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Scheme.pkg	(revision 2664)
@@ -0,0 +1,13 @@
+/***********************************************************************
+	Scheme
+***********************************************************************/
+class Scheme
+{
+	void loadResources();
+	void unloadResources();
+	bool resourcesLoaded() const;
+	string getName() const;
+
+    static void setDefaultResourceGroup(string resourceGroup);
+    static string getDefaultResourceGroup();
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/SchemeManager.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/SchemeManager.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/SchemeManager.pkg	(revision 2664)
@@ -0,0 +1,15 @@
+/***********************************************************************
+	SchemeManager
+***********************************************************************/
+class SchemeManager
+{
+	static SchemeManager& getSingleton();
+
+	Scheme* loadScheme(string filename, string resourcegroup="");
+	void unloadScheme(string name);
+	bool isSchemePresent(string name) const;
+	Scheme* getScheme(string name) const;
+	void unloadAllSchemes();
+
+    SchemeIterator getIterator() const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/System.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/System.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/System.pkg	(revision 2664)
@@ -0,0 +1,64 @@
+/***********************************************************************
+	System
+***********************************************************************/
+class System : public EventSet
+{
+	static System& getSingleton();
+
+	Renderer* getRenderer() const;
+
+	void setDefaultFont(string name);
+	void setDefaultFont(Font* font);
+    Font* getDefaultFont() const;
+
+	void signalRedraw();
+	bool isRedrawRequested() const;
+	void renderGUI();
+
+	Window* setGUISheet(Window* sheet);
+	Window* getGUISheet() const;
+
+	void setSingleClickTimeout(double timeout);
+	void setMultiClickTimeout(double timeout);
+	void setMultiClickToleranceAreaSize(const Size& sz);
+	double getSingleClickTimeout() const;
+	double getMultiClickTimeout() const;
+	const Size& getMultiClickToleranceAreaSize() const;
+
+	void setDefaultMouseCursor(MouseCursorImage image);
+	void setDefaultMouseCursor(const Image* image);
+	void setDefaultMouseCursor(string imageset_name, string image_name);
+	const Image* getDefaultMouseCursor() const;
+
+	Window* getWindowContainingMouse() const;
+
+	void executeScriptFile(string filename) const;
+	int executeScriptGlobal(string global_name) const;
+	void executeScriptString(string lua_string) const;
+
+	float getMouseMoveScaling() const;
+	void setMouseMoveScaling(float scaling);
+
+	void notifyWindowDestroyed(const Window* window);
+
+    // commented because we can't do 'bitwise and' in Lua
+	//unsigned int getSystemKeys() const;
+	tolua_outside bool ceguiLua_System_isSystemKeyDown @ isSystemKeyDown(SystemKey k) const;
+
+	void setDefaultTooltip(Tooltip* tooltip);
+	void setDefaultTooltip(string tooltipType);
+	Tooltip* getDefaultTooltip(void) const;
+
+	bool injectMouseMove(float dx, float dy);
+	bool injectMouseLeaves();
+	bool injectMouseButtonDown(MouseButton btn);
+	bool injectMouseButtonUp(MouseButton btn);
+	bool injectKeyDown(unsigned int keycode);
+	bool injectKeyUp(unsigned int keycode);
+	bool injectChar(unsigned long code_point);
+	bool injectMouseWheelChange(float delta);
+	bool injectMousePosition(float x, float y);
+	bool injectTimePulse(float timeElapsed);
+
+    tolua_outside EventIterator ceguiLua_getEventIterator @ getEventIterator() const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Texture.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Texture.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Texture.pkg	(revision 2664)
@@ -0,0 +1,13 @@
+/***********************************************************************
+	Texture
+***********************************************************************/
+class Texture
+{
+	unsigned short getWidth() const;
+	unsigned short getHeight() const;
+	void loadFromFile(string filename, string resourcegroup="");
+
+	// no memory loading
+
+	Renderer* getRenderer() const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/UnifiedCoordSystem.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/UnifiedCoordSystem.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/UnifiedCoordSystem.pkg	(revision 2664)
@@ -0,0 +1,73 @@
+/***********************************************************************
+	UDim
+***********************************************************************/
+class UDim
+{
+	float d_scale @ scale;
+	float d_offset @ offset;
+
+	float asAbsolute(float base) const;
+	float asRelative(float base) const;
+
+	UDim operator+ (const UDim& other) const;
+	UDim operator- (const UDim& other) const;
+	UDim operator/ (const UDim& other) const;
+	UDim operator* (const UDim& other) const;
+
+	bool operator== (const UDim& other) const;
+
+	UDim();
+	UDim(float scale, float offset);
+};
+
+
+/***********************************************************************
+	UVector2
+***********************************************************************/
+class UVector2
+{
+	UDim d_x @ x;
+	UDim d_y @ y;
+
+	Vector2 asAbsolute(const Size& base) const;
+	Vector2 asRelative(const Size& base) const;
+
+	UVector2 operator+ (const UVector2& other) const;
+	UVector2 operator- (const UVector2& other) const;
+	UVector2 operator/ (const UVector2& other) const;
+	UVector2 operator* (const UVector2& other) const;
+
+	bool operator== (const UVector2& other) const;
+
+	UVector2();
+	UVector2(UDim& scale, UDim& offset);
+};
+
+
+/***********************************************************************
+	URect
+***********************************************************************/
+class URect
+{
+	UVector2 d_min @ min;
+	UVector2 d_max @ max;
+
+	Rect asAbsolute(const Size& base) const;
+	Rect asRelative(const Size& base) const;
+
+	const UVector2& getPosition() const;
+	UVector2 getSize() const;
+	UDim getWidth() const;
+	UDim getHeight() const;
+
+	void setPosition(const UVector2& pos);
+	void setSize(const UVector2& sz);
+	void setWidth(const UDim& w);
+	void setHeight(const UDim& h);
+
+	void offset(const UVector2& sz);
+
+	URect();
+	URect(const UVector2& min, const UVector2& max);
+	URect(const UDim& left, const UDim& top, const UDim& right, const UDim& bottom);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Window.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Window.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/Window.pkg	(revision 2664)
@@ -0,0 +1,247 @@
+/****************************************
+	Vertical alignment modes
+*****************************************/
+enum VerticalAlignment
+{
+	VA_TOP,
+	VA_CENTRE,
+	VA_BOTTOM
+};
+
+
+/****************************************
+	Horizontal alignment modes
+*****************************************/
+enum HorizontalAlignment
+{
+	HA_LEFT,
+	HA_CENTRE,
+	HA_RIGHT
+};
+
+
+/****************************************
+	Window
+*****************************************/
+class Window //: public EventSet
+{
+	string getType() const;
+	string getName() const;
+
+	bool isDestroyedByParent() const;
+	bool isAlwaysOnTop() const;
+	bool isDisabled(bool localOnly=false) const;
+	bool isVisible(bool localOnly=false) const;
+	bool isActive() const;
+	bool isClippedByParent() const;
+
+	void setDestroyedByParent(bool setting);
+	void setAlwaysOnTop(bool setting);
+	void setEnabled(bool setting);
+	void enable();
+	void disable();
+	void setVisible(bool setting);
+	void show();
+	void hide();
+	void activate();
+	void deactivate();
+
+	void setClippedByParent(bool setting);
+
+	unsigned int getID() const;
+	void setID(unsigned int ID);
+
+	unsigned int getChildCount() const;
+
+	bool isChild(unsigned int ID) const;
+	bool isChild(string name) const;
+	bool isChild(const Window* window) const;
+	bool isChildRecursive(unsigned int ID) const;
+
+	void addChildWindow(string name);
+	void addChildWindow(Window* window);
+
+	void removeChildWindow(unsigned int ID);
+	void removeChildWindow(string name);
+	void removeChildWindow(Window* window);
+
+	tolua_throws|CEGUI::UnknownObjectException,nil| Window* getChild(unsigned int ID) const;
+	tolua_throws|CEGUI::UnknownObjectException,nil| Window* getChild(string name) const;
+	Window* getChildAtIdx(unsigned int ID) const;
+	Window* getActiveChild() const;
+	Window* getChildAtPosition(const Vector2& pos) const;
+    Window* getTargetChildAtPosition(const Vector2& pos) const;
+    Window* getChildRecursive(unsigned int ID) const;
+
+	Window* getParent() const;
+
+	bool isAncestor(unsigned int ID) const;
+	bool isAncestor(string name) const;
+	bool isAncestor(const Window* window) const;
+
+	void setFont(string name);
+	void setFont(Font* font);
+	Font* getFont() const;
+
+	void setText(string text);
+	string getText() const;
+
+	bool inheritsAlpha() const;
+	float getAlpha() const;
+	float getEffectiveAlpha() const;
+	void setAlpha(float a);
+	void setInheritsAlpha(bool setting);
+
+	void requestRedraw() const;
+
+	bool isZOrderingEnabled() const;
+	void setZOrderingEnabled(bool setting);
+
+	Rect getPixelRect() const;
+	Rect getInnerRect() const;
+	Rect getUnclippedPixelRect() const;
+	Rect getUnclippedInnerRect() const;
+
+    Size getParentPixelSize(void) const;
+    float getParentPixelWidth(void) const;
+    float getParentPixelHeight(void) const;
+
+	static Window* getCaptureWindow();
+	void setRestoreCapture(bool setting);
+	bool restoresOldCapture() const;
+
+	bool distributesCapturedInputs() const;
+	void setDistributesCapturedInputs(bool setting);
+
+	bool captureInput();
+	void releaseInput();
+
+	bool isCapturedByThis() const;
+	bool isCapturedByAncestor() const;
+	bool isCapturedByChild() const;
+
+	bool isHit(const Vector2& pos) const;
+
+	bool isRiseOnClickEnabled() const;
+	void setRiseOnClickEnabled(bool setting);
+
+	const Image* getMouseCursor() const;
+	void setMouseCursor(MouseCursorImage cursor);
+	void setMouseCursor(const Image* image);
+	void setMouseCursor(string imageset, string image);
+
+	void moveToFront();
+	void moveToBack();
+
+	bool wantsMultiClickEvents() const;
+	bool isMouseAutoRepeatEnabled() const;
+	float getAutoRepeatDelay() const;
+	float getAutoRepeatRate() const;
+	void setWantsMultiClickEvents(bool setting);
+	void setMouseAutoRepeatEnabled(bool setting);
+	void setAutoRepeatDelay(float delay);
+	void setAutoRepeatRate(float rate);
+
+	//void destroy();
+
+	bool isUsingDefaultTooltip() const;
+	Tooltip* getTooltip() const;
+	string getTooltipType() const;
+	string getTooltipText() const;
+	bool inheritsTooltipText() const;
+
+	void setTooltip(Tooltip* tooltip);
+	void setTooltipType(string tooltipType);
+	void setTooltipText(string tip);
+	void setInheritsTooltipText(bool setting);
+
+	bool testClassName(string class_name) const;
+
+	void notifyDragDropItemEnters(DragContainer* item);
+	void notifyDragDropItemLeaves(DragContainer* item);
+	void notifyDragDropItemDropped(DragContainer* item);
+
+	VerticalAlignment getVerticalAlignment() const;
+	HorizontalAlignment getHorizontalAlignment() const;
+
+    // these actually have a const, but tolua++ chokes on that
+    void setVerticalAlignment(VerticalAlignment alignment);
+    void setHorizontalAlignment(HorizontalAlignment alignment);
+
+	string getLookNFeel() const;
+    tolua_throws|CEGUI::Exception,error| void setLookNFeel(string lnf);
+
+    tolua_throws|CEGUI::Exception,error| void setWindowRenderer(string name);
+    string getWindowRendererName() const;
+
+	//RenderCache& getRenderCache()
+
+	bool getModalState() const;
+	void setModalState(bool state);
+
+    tolua_throws|CEGUI::UnknownObjectException,nil| string getUserString(string name) const;
+    bool isUserStringDefined(string name) const;
+    void setUserString(string name, string value);
+
+    void beginInitialisation();
+    void endInitialisation();
+
+	// unified stuff
+	void setArea(const UDim& xpos, const UDim& ypos, const UDim& width, const UDim& height);
+	void setArea(const UVector2& pos, const UVector2& size);
+	void setArea(const URect& area);
+	void setPosition(const UVector2& pos);
+	void setXPosition(const UDim& x);
+	void setYPosition(const UDim& y);
+	void setSize(const UVector2& size);
+	void setWidth(const UDim& width);
+	void setHeight(const UDim& height);
+	void setMaxSize(const UVector2& size);
+	void setMinSize(const UVector2& size);
+
+	const URect& getArea() const;
+	const UVector2& getPosition() const;
+	const UDim& getXPosition() const;
+	const UDim& getYPosition() const;
+	UVector2 getSize() const;
+	UDim getWidth() const;
+	UDim getHeight() const;
+	const UVector2& getMaxSize() const;
+	const UVector2& getMinSize() const;
+
+    // event pass through
+    bool isMousePassThroughEnabled() const;
+    void setMousePassThroughEnabled(bool setting);
+    
+    tolua_throws|CEGUI::Exception,error| void rename(string new_name);
+
+	//////////////////////////////////////////////
+	// PropertySet
+	void setProperty(string name, string value);
+	string getProperty(string name) const;
+	string getPropertyDefault(string name) const;
+	string getPropertyHelp(string name) const;
+
+	bool isPropertyPresent(string name) const;
+	bool isPropertyDefault(string name) const;
+
+    tolua_outside PropertyIterator ceguiLua_getPropertyIterator @ getPropertyIterator() const;
+
+	//////////////////////////////////////////////
+	// EventSet
+	void addEvent(string name);
+	void removeEvent(string name);
+	void removeAllEvents();
+	bool isEventPresent(string name);
+
+	tolua_throws|CEGUI::UnknownObjectException,error| tolua_outside EventConnection LuaFunctorSubscribeEvent @ subscribeEvent(string name, lua_Object funcIndex, lua_Object selfIndex=LUA_NOREF, lua_State*);
+
+	tolua_throws|CEGUI::UnknownObjectException,error| EventConnection subscribeScriptedEvent @ subscribeEvent(string name, string callback_name);
+	
+	void fireEvent(string name, EventArgs& args, string eventnamespace="");
+
+	bool isMuted() const;
+	void setMutedState(bool setting);
+
+    tolua_outside EventIterator ceguiLua_getEventIterator @ getEventIterator() const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/WindowFactoryManager.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/WindowFactoryManager.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/WindowFactoryManager.pkg	(revision 2664)
@@ -0,0 +1,34 @@
+/***********************************************************************
+	WindowFactoryManager
+***********************************************************************/
+class FalagardWindowMapping
+{
+    string d_windowType @ windowType;
+    string d_lookName @ lookName;
+    string d_baseType @ baseType;
+    string d_rendererType @ rendererType;
+};
+
+class WindowFactory
+{
+    string getTypeName() const;
+};
+
+class WindowFactoryManager
+{
+    static WindowFactoryManager& getSingleton();
+
+    bool isFactoryPresent(string name) const;
+    void addWindowTypeAlias(string aliasName, string targetType);
+    void removeWindowTypeAlias(string aliasName, string targetType);
+    void addFalagardWindowMapping(string newType, string targetType, string lookName, string renderer);
+    void removeFalagardWindowMapping(string type);
+    bool isFalagardMappedType(string type) const;
+    string getMappedLookForType(string type) const;
+    string getMappedRendererForType(string type) const;
+    String getDereferencedAliasType(string type) const;
+    const FalagardWindowMapping& getFalagardMappingForType(string type) const;
+
+    WindowFactoryIterator getIterator() const;
+    FalagardMappingIterator getFalagardMappingIterator() const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/WindowManager.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/WindowManager.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/WindowManager.pkg	(revision 2664)
@@ -0,0 +1,31 @@
+/***********************************************************************
+	WindowManager
+***********************************************************************/
+class WindowManager
+{
+	static WindowManager& getSingleton();
+
+	tolua_throws|CEGUI::AlreadyExistsException,nil| Window* createWindow(string type, string name="");
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| Window* loadWindowLayout(string filename, string name_prefix="", string resourcegroup="");
+
+    void writeWindowLayoutToStream(string window, OutStream& out, bool writeParent=false) const;
+    void writeWindowLayoutToStream(const Window& window, OutStream& out, bool writeParent=false) const;
+
+	void destroyWindow(string name);
+	void destroyWindow(Window* window);
+	void destroyAllWindows();
+
+	tolua_throws|CEGUI::UnknownObjectException,nil| Window* getWindow(string name) const;
+	bool isWindowPresent(string name) const;
+
+	bool isDeadPoolEmpty() const;
+	void cleanDeadPool();
+
+    void renameWindow(Window* window, string  new_name);
+    void renameWindow(string window, string new_name);
+
+    WindowIterator getIterator() const;
+
+    static void setDefaultResourceGroup(string resourceGroup);
+    static string& getDefaultResourceGroup();
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ButtonBase.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ButtonBase.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ButtonBase.pkg	(revision 2664)
@@ -0,0 +1,8 @@
+/***********************************************************************
+	ButtonBase
+***********************************************************************/
+class ButtonBase : public Window
+{
+	bool isHovering() const;
+	bool isPushed() const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Checkbox.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Checkbox.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Checkbox.pkg	(revision 2664)
@@ -0,0 +1,8 @@
+/***********************************************************************
+	Checkbox
+***********************************************************************/
+class Checkbox : public ButtonBase
+{
+	bool isSelected() const;
+	void setSelected(bool select);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ComboDropList.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ComboDropList.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ComboDropList.pkg	(revision 2664)
@@ -0,0 +1,10 @@
+/***********************************************************************
+	ComboDropList
+***********************************************************************/
+class ComboDropList : public Listbox
+{
+	void	setArmed(bool setting);
+	bool	isArmed(void) const;
+	void	setAutoArmEnabled(bool setting);
+	bool	isAutoArmEnabled(void) const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Combobox.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Combobox.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Combobox.pkg	(revision 2664)
@@ -0,0 +1,59 @@
+/***********************************************************************
+	Combobox
+***********************************************************************/
+class Combobox : public Window
+{
+	bool getSingleClickEnabled() const;
+	bool isDropDownListVisible() const;
+
+    Editbox* getEditbox() const;
+    PushButton* getPushButton() const;
+    ComboDropList* getDropList() const;
+
+	bool hasInputFocus() const;
+	bool isReadOnly() const;
+	bool isTextValid() const;
+	string getValidationString() const;
+
+	unsigned long getCaratIndex() const;
+	unsigned long getSelectionStartIndex() const;
+	unsigned long getSelectionEndIndex() const;
+	unsigned long getSelectionLength() const;
+	unsigned long getMaxTextLength() const;
+
+	void activateEditbox();
+
+	unsigned long getItemCount() const;
+	ListboxItem* getSelectedItem() const;
+	ListboxItem* getListboxItemFromIndex(unsigned long index) const;
+	unsigned long getItemIndex(const ListboxItem* item) const;
+	bool isItemSelected(unsigned long index) const;
+	ListboxItem* findItemWithText(string text, const ListboxItem* start_item);
+	bool isListboxItemInList(const ListboxItem* item) const;
+
+	void resetList();
+	void addItem(ListboxItem* item);
+	void insertItem(ListboxItem* item, const ListboxItem* position);
+	void removeItem(const ListboxItem* item);
+	void clearAllSelections();
+	void setSortingEnabled(bool setting);
+	void setShowVertScrollbar(bool setting);
+	void setShowHorzScrollbar(bool setting);
+	void setItemSelectState(ListboxItem* item, bool state);
+	void setItemSelectState(unsigned long item_index, bool state);
+	void handleUpdatedListItemData();
+
+	bool isSortEnabled() const;
+	bool isVertScrollbarAlwaysShown() const;
+	bool isHorzScrollbarAlwaysShown() const;
+
+	void showDropList();
+	void hideDropList();
+	void setSingleClickEnabled(bool setting);
+
+	void setReadOnly(bool setting);
+	void setValidationString(string validation_string);
+	void setCaratIndex(unsigned long carat_pos);
+	void setSelection(unsigned long start_pos, unsigned long end_pos);
+	void setMaxTextLength(unsigned long max_len);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/DragContainer.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/DragContainer.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/DragContainer.pkg	(revision 2664)
@@ -0,0 +1,23 @@
+/***********************************************************************
+	DragContainer
+***********************************************************************/
+class DragContainer : public Window
+{
+	bool isDraggingEnabled() const;
+	void setDraggingEnabled(bool setting);
+
+	bool isBeingDragged() const;
+
+	float getPixelDragThreshold() const;
+	void setPixelDragThreshold(float pixels);
+
+	float getDragAlpha() const;
+	void setDragAlpha(float alpha);
+
+	const Image* getDragCursorImage() const;
+	void setDragCursorImage(MouseCursorImage image);
+	void setDragCursorImage(string imageset, string image);
+	void setDragCursorImage(const Image* image);
+
+	Window* getCurrentDropTarget() const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Editbox.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Editbox.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Editbox.pkg	(revision 2664)
@@ -0,0 +1,27 @@
+/***********************************************************************
+	Editbox
+***********************************************************************/
+class Editbox : public Window
+{
+	bool hasInputFocus() const;
+	bool isReadOnly() const;
+	bool isTextMasked() const;
+	bool isTextValid() const;
+
+	string getValidationString() const;
+
+	unsigned long getCaratIndex() const;
+	unsigned long getSelectionStartIndex() const;
+	unsigned long getSelectionEndIndex() const;
+	unsigned long getSelectionLength() const;
+	unsigned long getMaskCodePoint() const;
+	unsigned long getMaxTextLength() const;
+
+	void setReadOnly(bool setting);
+	void setTextMasked(bool setting);
+	void setValidationString(string validation_string);
+	void setCaratIndex(unsigned long carat_pos);
+	void setSelection(unsigned long start_pos, unsigned long end_pos);
+	void setMaskCodePoint(unsigned long code_point);
+	void setMaxTextLength(unsigned long max_len);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/FrameWindow.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/FrameWindow.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/FrameWindow.pkg	(revision 2664)
@@ -0,0 +1,27 @@
+/***********************************************************************
+	FrameWindow
+***********************************************************************/
+class FrameWindow : public Window
+{
+	bool isSizingEnabled() const;
+	bool isFrameEnabled() const;
+	bool isTitleBarEnabled() const;
+	bool isCloseButtonEnabled() const;
+	bool isRollupEnabled() const;
+	bool isRolledup() const;
+	bool isDragMovingEnabled() const;
+
+	void setSizingEnabled(bool enabled);
+	void setFrameEnabled(bool enabled);
+	void setTitleBarEnabled(bool enabled);
+	void setCloseButtonEnabled(bool enabled);
+	void setRollupEnabled(bool enabled);
+	void setDragMovingEnabled(bool enabled);
+
+	float getSizingBorderThickness() const;
+	void setSizingBorderThickness(float pixels);
+
+	void toggleRollup();
+
+	void offsetPixelPosition(const Vector2& offset);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/GUISheet.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/GUISheet.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/GUISheet.pkg	(revision 2664)
@@ -0,0 +1,6 @@
+/***********************************************************************
+	GUISheet
+***********************************************************************/
+class GUISheet : public Window
+{
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ItemEntry.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ItemEntry.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ItemEntry.pkg	(revision 2664)
@@ -0,0 +1,14 @@
+/***********************************************************************
+	ItemEntry
+***********************************************************************/
+class ItemEntry : public Window
+{
+	Size getItemPixelSize();
+	ItemListBase* getOwnerList() const;
+	bool isSelected() const;
+	bool isSelectable() const;
+	void setSelected(bool setting);
+	void select();
+	void deselect();
+	void setSelectable(bool setting);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ItemListBase.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ItemListBase.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ItemListBase.pkg	(revision 2664)
@@ -0,0 +1,34 @@
+/***********************************************************************
+	ItemListBase
+***********************************************************************/
+class ItemListBase : public Window
+{
+    enum SortMode
+    {
+        Ascending,
+        Descending,
+        UserSort
+    };
+
+	unsigned int getItemCount() const;
+	ItemEntry* getItemFromIndex(unsigned int index) const;
+	unsigned int getItemIndex(const ItemEntry* item) const;
+	ItemEntry* findItemWithText(string text, const ItemEntry* start_item);
+	bool isItemInList(const ItemEntry* item) const;
+	bool isAutoResizeEnabled() const;
+	bool isSortEnabled() const;
+	SortMode getSortMode() const;
+	Rect getItemRenderArea() const;
+    Window* getContentPane() const;
+
+	void resetList();
+	void addItem(ItemEntry* item);
+	void insertItem(ItemEntry* item, const ItemEntry* position);
+	void removeItem(ItemEntry* item);
+	void handleUpdatedItemData();
+	void setAutoResizeEnabled(bool setting);
+	void sizeToContent();
+    void setSortEnabled(bool setting);
+    void setSortMode(SortMode mode);
+    void sortList();
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ItemListbox.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ItemListbox.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ItemListbox.pkg	(revision 2664)
@@ -0,0 +1,17 @@
+/***********************************************************************
+	ItemListbox
+***********************************************************************/
+class ItemListbox : public ScrolledItemListBase
+{
+    unsigned long getSelectedCount() const;
+    ItemEntry* getLastSelectedItem() const;
+    ItemEntry* getFirstSelectedItem(unsigned long start_index=0) const;
+    ItemEntry* getNextSelectedItem() const;
+    ItemEntry* getNextSelectedItemAfter(const ItemEntry* start_item) const;
+    bool isMultiSelectEnabled() const;
+    bool isItemSelected(unsigned long index) const;
+    void setMultiSelectEnabled(bool state);
+    void clearAllSelections();
+    void selectRange(unsigned long a, unsigned long z);
+    void selectAllItems();
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ListHeader.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ListHeader.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ListHeader.pkg	(revision 2664)
@@ -0,0 +1,55 @@
+/***********************************************************************
+	ListHeader
+***********************************************************************/
+class ListHeader : public Window
+{
+	unsigned int getColumnCount() const;
+
+	ListHeaderSegment& getSegmentFromColumn(unsigned int column) const;
+	ListHeaderSegment& getSegmentFromID(unsigned int id) const;
+	ListHeaderSegment& getSortSegment() const;
+
+	unsigned int getColumnFromSegment(const ListHeaderSegment& segment) const;
+	unsigned int getColumnFromID(unsigned int id) const;
+	unsigned int getSortColumn() const;
+	unsigned int getColumnWithText(string text) const;
+
+	float getPixelOffsetToSegment(const ListHeaderSegment& segment) const;
+	float getPixelOffsetToColumn(unsigned int column) const;
+	float getTotalSegmentsPixelExtent() const;
+	UDim  getColumnWidth(unsigned int column) const;
+
+	ListHeaderSegment::SortDirection getSortDirection() const;
+
+	bool isSortingEnabled() const;
+	bool isColumnSizingEnabled() const;
+	bool isColumnDraggingEnabled() const;
+
+	float getSegmentOffset() const;
+
+
+	void setSortingEnabled(bool setting);
+	void setSortDirection(ListHeaderSegment::SortDirection direction);
+	void setSortSegment(const ListHeaderSegment& segment);
+	void setSortColumn(unsigned int column);
+	void setSortColumnFromID(unsigned int id);
+
+	void setColumnSizingEnabled(bool setting);
+	void setColumnDraggingEnabled(bool setting);
+	void addColumn(string text, unsigned int id, const UDim& width);
+
+	void insertColumn(string text, unsigned int id, const UDim& width, unsigned int position);
+	void insertColumn(string text, unsigned int id, const UDim& width, const ListHeaderSegment& position);
+	void removeColumn(unsigned int column);
+	void removeSegment(const ListHeaderSegment& segment);
+
+	void moveColumn(unsigned int column, unsigned int position);
+	void moveColumn(unsigned int column, const ListHeaderSegment& position);
+
+	void moveSegment(const ListHeaderSegment& segment, unsigned int position);
+	void moveSegment(const ListHeaderSegment& segment, const ListHeaderSegment& position);
+
+	void setSegmentOffset(float offset);
+
+	void setColumnWidth(unsigned int column, const UDim& width);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ListHeaderSegment.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ListHeaderSegment.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ListHeaderSegment.pkg	(revision 2664)
@@ -0,0 +1,23 @@
+/***********************************************************************
+	ListHeaderSegment
+***********************************************************************/
+class ListHeaderSegment : public Window
+{
+	enum SortDirection
+	{
+		None,
+		Ascending,
+		Descending
+	};
+
+	bool isSizingEnabled() const;
+	SortDirection getSortDirection() const;
+	bool isDragMovingEnabled() const;
+	const Vector2& getDragMoveOffset() const;
+	bool isClickable() const;
+
+	void setSizingEnabled(bool setting);
+	void setSortDirection(SortDirection sort_dir);
+	void setDragMovingEnabled(bool setting);
+	void setClickable(bool setting);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Listbox.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Listbox.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Listbox.pkg	(revision 2664)
@@ -0,0 +1,40 @@
+/***********************************************************************
+	Listbox
+***********************************************************************/
+class Listbox : public Window
+{
+	unsigned long getItemCount() const;
+	unsigned long getSelectedCount() const;
+	ListboxItem* getFirstSelectedItem() const;
+	ListboxItem* getNextSelected(const ListboxItem* start_item) const;
+	ListboxItem* getListboxItemFromIndex(unsigned long index) const;
+	unsigned long getItemIndex(const ListboxItem* item) const;
+	ListboxItem* findItemWithText(string text, const ListboxItem* start_item);
+	bool isSortEnabled() const;
+	bool isMultiselectEnabled() const;
+	bool isItemSelected(unsigned long index) const;
+	bool isListboxItemInList(const ListboxItem* item) const;
+	bool isVertScrollbarAlwaysShown() const;
+	bool isHorzScrollbarAlwaysShown() const;
+
+	void resetList(void);
+	void addItem(ListboxItem* item);
+	void insertItem(ListboxItem* item, const ListboxItem* position);
+	void removeItem(const ListboxItem* item);
+	void clearAllSelections(void);
+	void setSortingEnabled(bool setting);
+	void setMultiselectEnabled(bool setting);
+	void setShowVertScrollbar(bool setting);
+	void setShowHorzScrollbar(bool setting);
+	void setItemSelectState(ListboxItem* item, bool state);
+	void setItemSelectState(unsigned long item_index, bool state);
+	void handleUpdatedItemData(void);
+	void ensureItemIsVisible(unsigned long item_index);
+	void ensureItemIsVisible(const ListboxItem* item);
+	
+	Rect getListRenderArea() const;
+	Scrollbar* getVertScrollbar() const;
+	Scrollbar* getHorzScrollbar() const;
+	float getWidestItemWidth() const;
+	float getTotalItemsHeight() const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ListboxItem.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ListboxItem.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ListboxItem.pkg	(revision 2664)
@@ -0,0 +1,33 @@
+/***********************************************************************
+	ListboxItem
+***********************************************************************/
+class ListboxItem
+{
+	string getText() const;
+	unsigned int getID() const;
+	void* getUserData() const;
+	bool isSelected() const;
+	bool isDisabled() const;
+	bool isAutoDeleted() const;
+	const Window* getOwnerWindow();
+	ColourRect getSelectionColours() const;
+	const Image* getSelectionBrushImage() const;
+
+	void setText(string text);
+	void setID(unsigned int item_id);
+	void setUserData(void* item_data);
+	void setSelected(bool setting);
+	void setDisabled(bool setting);
+	void setAutoDeleted(bool setting);
+	void setOwnerWindow(const Window* owner);
+	void setSelectionColours(const ColourRect& cols);
+	void setSelectionColours(colour top_left_colour, colour top_right_colour, colour bottom_left_colour, colour bottom_right_colour);
+	void setSelectionColours(colour col);
+	void setSelectionBrushImage(const Image* image);
+	void setSelectionBrushImage(string imageset, string image);
+
+	Size getPixelSize() const;
+
+	//void draw(const Vector3& position, float alpha, const Rect& clipper) const;
+	// operators missing
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ListboxTextItem.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ListboxTextItem.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ListboxTextItem.pkg	(revision 2664)
@@ -0,0 +1,21 @@
+/***********************************************************************
+	ListboxTextItem
+
+	The constructor is not exportet, instead a helper function is
+	available (CEGUI.createListboxTextItem).
+
+	I decided to do it like this to avoid any possible memory issues
+	with allocating from Lua.
+***********************************************************************/
+class ListboxTextItem : public ListboxItem
+{
+	Font* getFont() const;
+	ColourRect getTextColours() const;
+
+	void setFont(string font_name);
+	void setFont(Font* font);
+
+	void setTextColours(colour top_left_colour, colour top_right_colour, colour bottom_left_colour, colour bottom_right_colour);
+	void setTextColours(const ColourRect& cols);
+	void setTextColours(colour col);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/MenuBase.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/MenuBase.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/MenuBase.pkg	(revision 2664)
@@ -0,0 +1,13 @@
+/***********************************************************************
+	MenuBase
+***********************************************************************/
+class MenuBase : public ItemListBase
+{
+	float getItemSpacing() const;
+	bool isMultiplePopupsAllowed() const;
+	MenuItem* getPopupMenuItem() const;
+
+	void setItemSpacing(float spacing);
+	void changePopupMenuItem(MenuItem* item);
+	void setAllowMultiplePopups(bool setting);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/MenuItem.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/MenuItem.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/MenuItem.pkg	(revision 2664)
@@ -0,0 +1,14 @@
+/***********************************************************************
+	Menubar
+***********************************************************************/
+class MenuItem : public ItemEntry
+{
+	bool isHovering() const;
+	bool isPushed() const;
+	PopupMenu* getPopupMenu() const;
+
+	void setPopupMenu(PopupMenu* popup);
+	void openPopupMenu();
+	void closePopupMenu(bool notify=true);
+	bool togglePopupMenu();
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Menubar.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Menubar.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Menubar.pkg	(revision 2664)
@@ -0,0 +1,6 @@
+/***********************************************************************
+	Menubar
+***********************************************************************/
+class Menubar : public MenuBase
+{
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/MultiColumnList.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/MultiColumnList.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/MultiColumnList.pkg	(revision 2664)
@@ -0,0 +1,138 @@
+/***********************************************************************
+	MultiColumnList
+***********************************************************************/
+struct MCLGridRef
+{
+	unsigned int row;
+	unsigned int column;
+
+	//bool operator< (const MCLGridRef& rhs) const;
+	//bool operator>= (const MCLGridRef& rhs) const;
+	bool operator== (const MCLGridRef& rhs) const;
+
+	MCLGridRef(unsigned int r, unsigned int c);
+};
+
+
+/***********************************************************************
+	MultiColumnList
+***********************************************************************/
+class MultiColumnList : public Window
+{
+	enum SelectionMode
+	{
+		RowSingle,
+		RowMultiple,
+		CellSingle,
+		CellMultiple,
+		NominatedColumnSingle,
+		NominatedColumnMultiple,
+		ColumnSingle,
+		ColumnMultiple,
+		NominatedRowSingle,
+		NominatedRowMultiple
+	};
+
+	bool isUserSortControlEnabled() const;
+	bool isUserColumnSizingEnabled() const;
+	bool isUserColumnDraggingEnabled() const;
+
+	unsigned int getColumnCount() const;
+	unsigned int getRowCount() const;
+	unsigned int getSortColumn() const;
+	unsigned int getColumnWithID(unsigned int col_id) const;
+	unsigned int getColumnWithHeaderText(string text) const;
+
+	UDim getTotalColumnHeadersWidth() const;
+	UDim getColumnHeaderWidth(unsigned int col_idx) const;
+
+	ListHeaderSegment::SortDirection getSortDirection() const;
+	ListHeaderSegment& getHeaderSegmentForColumn(unsigned int col_idx) const;
+
+	unsigned int getItemRowIndex(const ListboxItem* item) const;
+	unsigned int getItemColumnIndex(const ListboxItem* item) const;
+
+	MCLGridRef getItemGridReference(const ListboxItem* item) const;
+	ListboxItem* getItemAtGridReference(const MCLGridRef& grid_ref) const;
+
+	bool isListboxItemInColumn(const ListboxItem* item, unsigned int col_idx) const;
+	bool isListboxItemInRow(const ListboxItem* item, unsigned int row_idx) const;
+	bool isListboxItemInList(const ListboxItem* item) const;
+
+	ListboxItem* findColumnItemWithText(string text, unsigned int col_idx, const ListboxItem* start_item) const;
+	ListboxItem* findRowItemWithText(string text, unsigned int row_idx, const ListboxItem* start_item) const;
+	ListboxItem* findListItemWithText(string text, const ListboxItem* start_item) const;
+	ListboxItem* getFirstSelectedItem() const;
+	ListboxItem* getNextSelected(const ListboxItem* start_item) const;
+
+	unsigned int getSelectedCount() const;
+	bool isItemSelected(const MCLGridRef& grid_ref) const;
+
+	unsigned int getNominatedSelectionColumnID() const;
+	unsigned int getNominatedSelectionColumn() const;
+	unsigned int getNominatedSelectionRow() const;
+
+	SelectionMode getSelectionMode() const;
+
+	bool isVertScrollbarAlwaysShown() const;
+	bool isHorzScrollbarAlwaysShown() const;
+
+	unsigned int getColumnID(unsigned int col_idx) const;
+	unsigned int getRowID(unsigned int row_idx) const;
+    unsigned int getRowWithID(unsigned int row_id) const;
+
+    Rect getListRenderArea() const;
+
+    Scrollbar* getVertScrollbar() const;
+    Scrollbar* getHorzScrollbar() const;
+    ListHeader* getListHeader() const;
+
+    float getTotalRowsHeight() const;
+    float getWidestColumnItemWidth(unsigned int col_idx) const;
+    float getHighestRowItemHeight(unsigned int row_idx) const;
+
+	void resetList();
+
+	void addColumn(string text, unsigned int col_id, const UDim& width);
+	void insertColumn(string text, unsigned int col_id, const UDim& width, unsigned int position);
+	void removeColumn(unsigned int col_idx);
+	void removeColumnWithID(unsigned int col_id);
+	void moveColumn(unsigned int col_idx, unsigned int position);
+	void moveColumnWithID(unsigned int col_id, unsigned int position);
+
+	unsigned int addRow();
+	unsigned int addRow(ListboxItem* item, unsigned int col_id);
+	unsigned int insertRow(unsigned int row_idx);
+	unsigned int insertRow(ListboxItem* item, unsigned int col_id, unsigned int row_idx);
+	void removeRow(unsigned int row_idx);
+
+	void setItem(ListboxItem* item, const MCLGridRef& position);
+	void setItem(ListboxItem* item, unsigned int col_id, unsigned int row_idx);
+
+	void setSelectionMode(MultiColumnList::SelectionMode sel_mode);
+	void setNominatedSelectionColumnID(unsigned int col_id);
+	void setNominatedSelectionColumn(unsigned int col_idx);
+	void setNominatedSelectionRow(unsigned int row_idx);
+
+	void setSortDirection(ListHeaderSegment::SortDirection direction);
+	void setSortColumn(unsigned int col_idx);
+	void setSortColumnByID(unsigned int col_id);
+
+	void setShowVertScrollbar(bool setting);
+	void setShowHorzScrollbar(bool setting);
+
+	void clearAllSelections();
+
+	void setItemSelectState(ListboxItem* item, bool state);
+	void setItemSelectState(const MCLGridRef& grid_ref, bool state);
+
+	void handleUpdatedItemData();
+
+	void setColumnHeaderWidth(unsigned int col_idx, const UDim& width);
+	void setUserSortControlEnabled(bool setting);
+	void setUserColumnSizingEnabled(bool setting);
+	void setUserColumnDraggingEnabled(bool setting);
+	void autoSizeColumnHeader(unsigned int col_idx);
+	
+	void setRowID(unsigned int row_idx, unsigned int row_id);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/MultiLineEditbox.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/MultiLineEditbox.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/MultiLineEditbox.pkg	(revision 2664)
@@ -0,0 +1,29 @@
+/***********************************************************************
+	MultiLineEditbox
+***********************************************************************/
+class MultiLineEditbox : public Window
+{
+	bool hasInputFocus() const;
+	bool isReadOnly() const;
+	unsigned long getCaratIndex() const;
+	unsigned long getSelectionStartIndex() const;
+	unsigned long getSelectionEndIndex() const;
+	unsigned long getSelectionLength() const;
+	unsigned long getMaxTextLength() const;
+	bool isWordWrapped() const;
+
+    Scrollbar* getVertScrollbar() const;
+    Scrollbar* getHorzScrollbar() const;
+    Rect getTextRenderArea() const;
+    unsigned long getLineNumberFromIndex(unsigned long index) const;
+
+	void setReadOnly(bool setting);
+	void setCaratIndex(unsigned long carat_pos);
+	void setSelection(unsigned long start_pos, unsigned long end_pos);
+	void setMaxTextLength(unsigned long max_len);
+	void ensureCaratIsVisible();
+	void setWordWrapping(bool setting);
+
+    void setSelectionBrushImage(const Image* image);
+    const Image* getSelectionBrushImage() const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/PopupMenu.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/PopupMenu.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/PopupMenu.pkg	(revision 2664)
@@ -0,0 +1,13 @@
+/***********************************************************************
+	PopupMenu
+***********************************************************************/
+class PopupMenu : public MenuBase
+{
+	float getFadeInTime() const;
+	float getFadeOutTime() const;
+
+	void setFadeInTime(float fadetime);
+	void setFadeOutTime(float fadetime);
+	void openPopupMenu();
+	void closePopupMenu();
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ProgressBar.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ProgressBar.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ProgressBar.pkg	(revision 2664)
@@ -0,0 +1,13 @@
+/***********************************************************************
+	ProgressBar
+***********************************************************************/
+class ProgressBar : public Window
+{
+	float getProgress() const;
+	float getStep() const;
+
+	void setProgress(float progress);
+	void setStepSize(float step);
+	void step();
+	void adjustProgress(float delta);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/PushButton.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/PushButton.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/PushButton.pkg	(revision 2664)
@@ -0,0 +1,6 @@
+/***********************************************************************
+	PushButton
+***********************************************************************/
+class PushButton : public ButtonBase
+{
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/RadioButton.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/RadioButton.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/RadioButton.pkg	(revision 2664)
@@ -0,0 +1,13 @@
+/***********************************************************************
+	RadioButton
+***********************************************************************/
+class RadioButton : public ButtonBase
+{
+	bool isSelected() const;
+	void setSelected(bool select);
+
+	unsigned long getGroupID() const;
+	void setGroupID(unsigned long group);
+
+	RadioButton* getSelectedButtonInGroup() const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ScrollablePane.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ScrollablePane.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ScrollablePane.pkg	(revision 2664)
@@ -0,0 +1,41 @@
+/***********************************************************************
+	ScrollablePane
+***********************************************************************/
+class ScrollablePane : public Window
+{
+	const ScrolledContainer* getContentPane() const;
+
+	bool	isVertScrollbarAlwaysShown() const;
+	void	setShowVertScrollbar(bool setting);
+
+	bool	isHorzScrollbarAlwaysShown() const;
+	void	setShowHorzScrollbar(bool setting);
+
+	bool isContentPaneAutoSized() const;
+	void setContentPaneAutoSized(bool setting);
+
+	const Rect& getContentPaneArea() const;
+	void setContentPaneArea(const Rect& area);
+
+	float getHorizontalStepSize() const;
+	void setHorizontalStepSize(float step);
+
+	float getHorizontalOverlapSize() const;
+	void setHorizontalOverlapSize(float overlap);
+
+	float getHorizontalScrollPosition() const;
+	void setHorizontalScrollPosition(float position);
+
+	float getVerticalStepSize() const;
+	void setVerticalStepSize(float step);
+
+	float getVerticalOverlapSize() const;
+	void setVerticalOverlapSize(float overlap);
+
+	float getVerticalScrollPosition() const;
+	void setVerticalScrollPosition(float position);
+
+    Rect getViewableArea() const;
+    Scrollbar* getVertScrollbar() const;
+    Scrollbar* getHorzScrollbar() const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Scrollbar.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Scrollbar.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Scrollbar.pkg	(revision 2664)
@@ -0,0 +1,17 @@
+/***********************************************************************
+	Scrollbar
+***********************************************************************/
+class Scrollbar : public Window
+{
+	float getDocumentSize() const;
+	float getPageSize() const;
+	float getStepSize() const;
+	float getOverlapSize() const;
+	float getScrollPosition() const;
+
+	void setDocumentSize(float document_size);
+	void setPageSize(float page_size);
+	void setStepSize(float step_size);
+	void setOverlapSize(float overlap_size);
+	void setScrollPosition(float position);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ScrolledContainer.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ScrolledContainer.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ScrolledContainer.pkg	(revision 2664)
@@ -0,0 +1,13 @@
+/***********************************************************************
+	ScrolledContainer
+***********************************************************************/
+class ScrolledContainer : public Window
+{
+	bool isContentPaneAutoSized() const;
+	void setContentPaneAutoSized(bool setting);
+
+	const Rect& getContentArea() const;
+	void setContentArea(const Rect& area);
+
+	Rect getChildExtentsArea() const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ScrolledItemListBase.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ScrolledItemListBase.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/ScrolledItemListBase.pkg	(revision 2664)
@@ -0,0 +1,12 @@
+/***********************************************************************
+	ScrolledItemListBase
+***********************************************************************/
+class ScrolledItemListBase : public ItemListBase
+{
+	bool isVertScrollbarAlwaysShown() const;
+	bool isHorzScrollbarAlwaysShown() const;
+    Scrollbar* getVertScrollbar() const;
+    Scrollbar* getHorzScrollbar() const;
+    void setShowVertScrollbar(bool mode);
+    void setShowHorzScrollbar(bool mode);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Slider.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Slider.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Slider.pkg	(revision 2664)
@@ -0,0 +1,13 @@
+/***********************************************************************
+	Slider
+***********************************************************************/
+class Slider : public Window
+{
+	float getCurrentValue() const;
+	float getMaxValue() const;
+	float getClickStep() const;
+
+	void setMaxValue(float maxVal);
+	void setCurrentValue(float value);
+	void setClickStep(float step);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Spinner.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Spinner.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Spinner.pkg	(revision 2664)
@@ -0,0 +1,25 @@
+/***********************************************************************
+	Spinner
+***********************************************************************/
+class Spinner : public Window
+{
+	enum TextInputMode
+	{
+		FloatingPoint,
+		Integer,
+		Hexadecimal,
+		Octal
+	};
+
+	float getCurrentValue() const;
+	float getStepSize() const;
+	float getMaximumValue() const;
+	float getMinimumValue() const;
+	TextInputMode getTextInputMode() const;
+
+	void setCurrentValue(float value);
+	void setStepSize(float step);
+	void setMaximumValue(float maxValue);
+	void setMinimumValue(float minVaue);
+	void setTextInputMode(TextInputMode mode);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/TabButton.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/TabButton.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/TabButton.pkg	(revision 2664)
@@ -0,0 +1,11 @@
+/***********************************************************************
+	TabButton
+***********************************************************************/
+class TabButton : public ButtonBase
+{
+	bool isSelected() const;
+	void setSelected(bool select);
+
+	void setTargetWindow(Window* wnd);
+	Window* getTargetWindow();
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/TabControl.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/TabControl.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/TabControl.pkg	(revision 2664)
@@ -0,0 +1,29 @@
+/***********************************************************************
+	TabControl
+***********************************************************************/
+class TabControl : public Window
+{
+	unsigned int getTabCount() const;
+
+	void setSelectedTab(string name);
+	void setSelectedTab(unsigned int ID);
+	void setSelectedTabAtIndex(unsigned int index);
+
+	Window* getTabContentsAtIndex(unsigned int index) const;
+	Window* getTabContents(string name) const;
+	Window* getTabContents(unsigned int ID) const;
+
+	bool isTabContentsSelected(Window* wnd) const;
+	unsigned int getSelectedTabIndex() const;
+
+	const UDim& getTabHeight() const;
+	const UDim& getTabTextPadding() const;
+
+	void setTabHeight(const UDim& height);
+	void setTabTextPadding(const UDim& pad);
+
+	void addTab(Window* wnd);
+
+	void removeTab(unsigned int ID);
+	void removeTab(string name);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Thumb.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Thumb.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Thumb.pkg	(revision 2664)
@@ -0,0 +1,22 @@
+/***********************************************************************
+	Thumb
+***********************************************************************/
+class Thumb : public PushButton
+{
+	bool isHotTracked() const;
+	bool isVertFree() const;
+	bool isHorzFree() const;
+
+	void setHotTracked(bool setting);
+	void setVertFree(bool setting);
+	void setHorzFree(bool setting);
+
+
+	// we have a helper function that converts the std::pair to two return values tolua++ style
+	tolua_outside void ceguiLua_Thumb_getVertRange @ getVertRange(float* min=0, float* max=0);
+	tolua_outside void ceguiLua_Thumb_getHorzRange @ getHorzRange(float* min=0, float* max=0);
+
+
+	void setVertRange(float min, float max);
+	void setHorzRange(float min, float max);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Titlebar.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Titlebar.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Titlebar.pkg	(revision 2664)
@@ -0,0 +1,8 @@
+/***********************************************************************
+	Titlebar
+***********************************************************************/
+class Titlebar : public Window
+{
+	bool isDraggingEnabled() const;
+	void setDraggingEnabled(bool setting);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Tooltip.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Tooltip.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/elements/Tooltip.pkg	(revision 2664)
@@ -0,0 +1,14 @@
+/***********************************************************************
+	Tooltip
+***********************************************************************/
+class Tooltip : public Window
+{
+	void setTargetWindow(Window* wnd);
+	void resetTimer();
+	float getHoverTime() const;
+	void setDisplayTime(float seconds);
+	float getFadeTime() const;
+	void setHoverTime(float seconds);
+	float getDisplayTime() const;
+	void setFadeTime(float seconds);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/exceptions.lua
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/exceptions.lua	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/exceptions.lua	(revision 2664)
@@ -0,0 +1,7 @@
+exceptionDefs["CEGUI::Exception"]           = {}
+exceptionDefs["CEGUI::Exception"]["var"]    = "&e"
+exceptionDefs["CEGUI::Exception"]["c_str"]  = "e.getMessage().c_str()"
+
+exceptionDefs["CEGUI::AlreadyExistsException"]  = exceptionDefs["CEGUI::Exception"]
+exceptionDefs["CEGUI::InvalidRequestException"] = exceptionDefs["CEGUI::Exception"]
+exceptionDefs["CEGUI::UnknownObjectException"]  = exceptionDefs["CEGUI::Exception"]
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/Dimension.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/Dimension.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/Dimension.pkg	(revision 2664)
@@ -0,0 +1,102 @@
+/******************************************************************************
+  BaseDim  
+******************************************************************************/
+class BaseDim
+{
+  tolua_throws|CEGUI::InvalidRequestException,error| float getValue(const Window& wnd) const;
+  tolua_throws|CEGUI::InvalidRequestException,error| float getValue(const Window& wnd, const Rect& container) const;
+  BaseDim* clone() const;
+  DimensionOperator getDimensionOperator() const;
+  void setDimensionOperator(DimensionOperator op);
+  const BaseDim* getOperand() const;
+  void setOperand(const BaseDim& operand);
+  //void writeXMLToStream(OutStream& out_stream) const;
+};
+
+/******************************************************************************
+  AbsoluteDim 
+******************************************************************************/
+class AbsoluteDim : public BaseDim
+{
+  void setValue(float val);
+  AbsoluteDim(float val);
+};
+
+/******************************************************************************
+  ImageDim
+******************************************************************************/
+class ImageDim : public BaseDim 
+{
+  void setSourceImage(string imageset, string image);
+  void setSourceDimension(DimensionType dim);
+  ImageDim(string imageset, string image, DimensionType dim);
+};
+
+/******************************************************************************
+  WidgetDim
+******************************************************************************/
+class WidgetDim : public BaseDim
+{
+  void setWidgetName(string name);
+  void setSourceDimension(DimensionType dim); 
+  WidgetDim(string name, DimensionType dim);
+};
+
+/******************************************************************************
+  UnifiedDim
+******************************************************************************/
+class UnifiedDim : public BaseDim 
+{
+  UnifiedDim(const UDim& value, DimensionType dim);
+};
+
+/******************************************************************************
+  FontDim
+******************************************************************************/
+class FontDim : public BaseDim
+{
+  FontDim(string name, string font, string text, FontMetricType metric, float padding = 0);
+};
+
+/******************************************************************************
+  PropertyDim
+******************************************************************************/
+class PropertyDim : public BaseDim
+{
+  PropertyDim(string name, string property, DimensionType type);
+};
+
+/******************************************************************************
+  Dimension
+******************************************************************************/
+class Dimension
+{
+  const BaseDim& getBaseDimension() const;
+  void setBaseDimension(const BaseDim& dim);
+  DimensionType getDimensionType() const;
+  void setDimensionType(DimensionType type);
+
+  //Dimension& operator=(const Dimension& other);
+  //void writeXMLToStream(OutStream& out_stream) const;
+  Dimension(const BaseDim& dim, DimensionType type);
+  Dimension(const Dimension& other);
+  Dimension();
+};
+
+/******************************************************************************
+  ComponentArea 
+******************************************************************************/
+class ComponentArea
+{
+  Rect getPixelRect(const Window& wnd) const;
+  Rect getPixelRect(const Window& wnd, const Rect& container) const;
+  //void writeXMLToStream(OutStream& out_stream) const;
+  bool isAreaFetchedFromProperty() const;
+  string getAreaPropertySource() const;
+  void setAreaPropertySource(string property);
+  Dimension d_left;
+  Dimension d_top;
+  Dimension d_right_or_width;
+  Dimension d_bottom_or_height;
+  ComponentArea();
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/Enums.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/Enums.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/Enums.pkg	(revision 2664)
@@ -0,0 +1,108 @@
+/******************************************************************************
+  DimensionType
+*******************************************************************************/
+enum DimensionType
+{
+  DT_LEFT_EDGE,
+  DT_X_POSITION,
+  DT_TOP_EDGE,
+  DT_Y_POSITION,
+  DT_RIGHT_EDGE,
+  DT_BOTTOM_EDGE,
+  DT_WIDTH,
+  DT_HEIGHT,
+  DT_X_OFFSET, 
+  DT_Y_OFFSET,
+  DT_INVALID 
+};
+
+
+/******************************************************************************
+  VerticalFormatting  
+*******************************************************************************/
+enum VerticalFormatting
+{
+  VF_TOP_ALIGNED,
+  VF_CENTRE_ALIGNED,
+  VF_BOTTOM_ALIGNED, 
+  VF_STRETCHED,  
+  VF_TILED 
+};
+
+
+/******************************************************************************
+  HorizontalFormatting  
+*******************************************************************************/
+enum HorizontalFormatting
+{
+  HF_LEFT_ALIGNED,
+  HF_CENTRE_ALIGNED,
+  HF_RIGHT_ALIGNED,
+  HF_STRETCHED,
+  HF_TILED
+};
+
+/******************************************************************************
+  VerticalTextFormatting  
+*******************************************************************************/
+enum VerticalTextFormatting
+{
+  VTF_TOP_ALIGNED,
+  VTF_CENTRE_ALIGNED,
+  VTF_BOTTOM_ALIGNED 
+};
+
+/******************************************************************************
+  HorinzontalTextFormatting  
+*******************************************************************************/
+enum HorizontalTextFormatting
+{
+  HTF_LEFT_ALIGNED,
+  HTF_RIGHT_ALIGNED,
+  HTF_CENTRE_ALIGNED,
+  HTF_JUSTIFIED, 
+  HTF_WORDWRAP_LEFT_ALIGNED,
+  HTF_WORDWRAP_RIGHT_ALIGNED,
+  HTF_WORDWRAP_CENTRE_ALIGNED,
+  HTF_WORDWRAP_JUSTIFIED 
+};
+
+/******************************************************************************
+  FontMetricType   
+*******************************************************************************/
+enum FontMetricType
+{
+  FMT_LINE_SPACING,
+  FMT_BASELINE,
+  FMT_HORZ_EXTENT
+};
+
+/******************************************************************************
+  DimensionOperator 
+*******************************************************************************/
+enum DimensionOperator
+{
+  DOP_NOOP,
+  DOP_ADD,
+  DOP_SUBTRACT,
+  DOP_MULTIPLY,
+  DOP_DIVIDE
+};
+
+/******************************************************************************
+  FrameImageComponent
+*******************************************************************************/
+enum FrameImageComponent
+{
+  FIC_BACKGROUND,
+  FIC_TOP_LEFT_CORNER,
+  FIC_TOP_RIGHT_CORNER,
+  FIC_BOTTOM_LEFT_CORNER,
+  FIC_BOTTOM_RIGHT_CORNER,
+  FIC_LEFT_EDGE,
+  FIC_RIGHT_EDGE,
+  FIC_TOP_EDGE,
+  FIC_BOTTOM_EDGE,
+  FIC_FRAME_IMAGE_COUNT 
+};
+
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/FalagardComponentBase.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/FalagardComponentBase.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/FalagardComponentBase.pkg	(revision 2664)
@@ -0,0 +1,17 @@
+/******************************************************************************
+  FalagardComponentBase
+******************************************************************************/
+
+class FalagardComponentBase
+{
+  void render(Window& srcWindow, float base_z, const ColourRect* modColours = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+  void render(Window& srcWindow, const Rect& baseRect, float base_z, const ColourRect* modColours = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+  const ComponentArea& getComponentArea() const;
+  void setComponentArea(const ComponentArea& area);
+  const ColourRect& getColours() const;
+  void setColours(const ColourRect& cols);
+  void setColoursPropertySource(string property);
+  void setColoursPropertyIsColourRect(bool setting = true);
+  void setVertFormattingPropertySource(string property);
+  void setHorzFormattingPropertySource(string property);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/FrameComponent.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/FrameComponent.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/FrameComponent.pkg	(revision 2664)
@@ -0,0 +1,17 @@
+/******************************************************************************
+  FrameComponent
+******************************************************************************/
+
+class FrameComponent : public FalagardComponentBase
+{
+
+  VerticalFormatting getBackgroundVerticalFormatting() const;
+  void setBackgroundVerticalFormatting(VerticalFormatting fmt);
+  HorizontalFormatting getBackgroundHorizontalFormatting() const;
+  void setBackgroundHorizontalFormatting(HorizontalFormatting fmt);
+  const Image* getImage(FrameImageComponent part) const;
+  void setImage(FrameImageComponent part, const Image* image);
+  void setImage(FrameImageComponent part, string imageset, string image);
+  //void writeXMLToStream(OutStream& out_stream) const;
+  FrameComponent();
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/ImageryComponent.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/ImageryComponent.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/ImageryComponent.pkg	(revision 2664)
@@ -0,0 +1,19 @@
+/******************************************************************************
+  ImageryComponent
+******************************************************************************/
+
+class ImageryComponent : public FalagardComponentBase 
+{
+  const Image* getImage() const;
+  void setImage(const Image* image);
+  void setImage(string imageset, string image);
+  VerticalFormatting getVerticalFormatting() const;
+  void setVerticalFormatting(VerticalFormatting fmt);
+  HorizontalFormatting getHorizontalFormatting() const;
+  void setHorizontalFormatting(HorizontalFormatting fmt);
+  //void writeXMLToStream(OutStream& out_stream) const;
+  bool isImageFetchedFromProperty() const;
+  string getImagePropertySource() const;
+  void setImagePropertySource(string property);
+  ImageryComponent();
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/ImagerySection.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/ImagerySection.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/ImagerySection.pkg	(revision 2664)
@@ -0,0 +1,28 @@
+/******************************************************************************
+  ImagerySection
+******************************************************************************/
+
+class ImagerySection
+{
+  void render(Window& srcWindow, float base_z, const ColourRect* modColours = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+
+  void render(Window& srcWindow, const Rect& baseRect, float base_z, const ColourRect* modColours = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+  void addImageryComponent(const ImageryComponent& img);
+  void clearImageryComponents();
+  void addTextComponent(const TextComponent& text);
+  void clearTextComponents();
+  void clearFrameComponents();
+  void addFrameComponent(const FrameComponent& frame);
+  const ColourRect& getMasterColours() const;
+  void setMasterColours(const ColourRect& cols);
+  string getName() const;
+  void setMasterColoursPropertySource(string property);
+  void setMasterColoursPropertyIsColourRect(bool setting = true);
+  Rect getBoundingRect(const Window& wnd) const;
+  Rect getBoundingRect(const Window& wnd, const Rect& rect) const;
+  //void writeXMLToStream(OutStream& out_stream) const;
+
+  ImagerySection();
+  ImagerySection(string name);
+};
+
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/LayerSpecification.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/LayerSpecification.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/LayerSpecification.pkg	(revision 2664)
@@ -0,0 +1,16 @@
+/******************************************************************************
+  LayerSpecification
+******************************************************************************/
+
+class LayerSpecification
+{
+  void render(Window& srcWindow, float base_z, const ColourRect* modcols = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+  void render(Window& srcWindow, const Rect& baseRect, float base_z, const ColourRect* modcols = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+  void addSectionSpecification(const SectionSpecification& section);
+  void clearSectionSpecifications();
+  unsigned int getLayerPriority() const;
+  bool operator<(const LayerSpecification& other) const;
+  //void writeXMLToStream(OutStream& out_stream) const;
+  LayerSpecification(unsigned int priority);
+};
+
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/NamedArea.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/NamedArea.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/NamedArea.pkg	(revision 2664)
@@ -0,0 +1,14 @@
+/***********************************************************************
+  NamedArea
+***********************************************************************/
+class NamedArea
+{
+  string getName() const;
+  const ComponentArea& getArea() const;
+  void setArea(ComponentArea area);
+  //void writeXMLToStream(OutStream& out_stream) const;
+
+  NamedArea();
+  NamedArea(string name);
+};
+
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/PropertyDefinition.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/PropertyDefinition.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/PropertyDefinition.pkg	(revision 2664)
@@ -0,0 +1,13 @@
+/******************************************************************************
+  PropertyDefinition
+******************************************************************************/
+
+class PropertyDefinition : public PropertyDefinitionBase
+{
+  //string get(const PropertyReceiver* receiver) const;
+  //void set(PropertyReceiver* receiver, string value);
+  string get(const Window* receiver) const;
+  void set(Window* receiver, string value);
+
+  PropertyDefinition(string name, string initialValue, bool redrawOnWrite, bool layoutOnWrite);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/PropertyDefinitionBase.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/PropertyDefinitionBase.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/PropertyDefinitionBase.pkg	(revision 2664)
@@ -0,0 +1,10 @@
+/******************************************************************************
+  PropertyDefinitionBase 
+*******************************************************************************/
+
+class PropertyDefinitionBase : public Property 
+{
+  //void set(PropertyReceiver* receiver, string value);
+  void set(Window* receiver, string value);
+  //virtual void writeXMLToStream(OutStream& out_stream) const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/PropertyInitialiser.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/PropertyInitialiser.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/PropertyInitialiser.pkg	(revision 2664)
@@ -0,0 +1,14 @@
+/******************************************************************************
+  PropertyInitialiser
+******************************************************************************/
+
+class PropertyInitialiser
+{
+  //void apply(PropertySet& target) const;
+  void apply(Window& target) const;
+
+  string getTargetPropertyName() const;
+  string getInitialiserValue() const;
+  //void writeXMLToStream(OutStream& out_stream) const;
+  PropertyInitialiser(string property, string value);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/PropertyLinkDefinition.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/PropertyLinkDefinition.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/PropertyLinkDefinition.pkg	(revision 2664)
@@ -0,0 +1,12 @@
+/******************************************************************************
+  PropertyLinkDefinition
+******************************************************************************/
+
+class PropertyLinkDefinition : public PropertyDefinitionBase
+{
+  //string get(const PropertyReceiver* receiver) const;
+  //void set(PropertyReceiver* receiver, string value);
+  string get(const Window* receiver) const;
+  void set(Window* receiver, string value);
+  PropertyLinkDefinition(string propertyName, string widgetNameSuffix, string targetProperty, string initialValue, bool redrawOnWrite, bool layoutOnWrite);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/SectionSpecification.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/SectionSpecification.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/SectionSpecification.pkg	(revision 2664)
@@ -0,0 +1,23 @@
+/******************************************************************************
+  SectionSpecification
+******************************************************************************/
+
+class SectionSpecification
+{
+  void render(Window& srcWindow, float base_z, const ColourRect* modcols = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+  void render(Window& srcWindow, const Rect& baseRect, float base_z, const ColourRect* modcols = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+
+  string getOwnerWidgetLookFeel() const;
+  string getSectionName() const;
+  const ColourRect& getOverrideColours() const;
+  void setOverrideColours(const ColourRect& cols);
+  bool isUsingOverrideColours() const;
+  void setUsingOverrideColours(bool setting = true);
+  void setOverrideColoursPropertySource(string property);
+  void setOverrideColoursPropertyIsColourRect(bool setting = true);  
+  void setRenderControlPropertySource(string property);
+  // void writeXMLToStream(OutStream& out_stream) const;
+  SectionSpecification(string owner, string sectionName, const string controlPropertySource);
+  SectionSpecification(string owner, string sectionName, string controlPropertySource, const ColourRect& cols);
+  
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/StateImagery.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/StateImagery.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/StateImagery.pkg	(revision 2664)
@@ -0,0 +1,19 @@
+/******************************************************************************
+  StateImagery
+******************************************************************************/
+
+class StateImagery
+{
+  void render(Window& srcWindow, const ColourRect* modcols = 0, const Rect* clipper = 0) const;
+  void render(Window& srcWindow, const Rect& baseRect, const ColourRect* modcols = 0, const Rect* clipper = 0) const;
+
+  void addLayer(const LayerSpecification& layer);
+  void clearLayers();
+  string getName() const;
+  bool isClippedToDisplay() const;
+  void setClippedToDisplay(bool setting);
+  //void writeXMLToStream(OutStream& out_stream) const;
+  StateImagery(string name);
+  StateImagery();
+};
+
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/TextComponent.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/TextComponent.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/TextComponent.pkg	(revision 2664)
@@ -0,0 +1,22 @@
+/*********************************************************************
+ TextComponent
+**********************************************************************/
+class TextComponent : public FalagardComponentBase 
+{
+    string getText() const;
+    void setText(string text);
+    string getFont() const;
+    void setFont(string font);
+    VerticalTextFormatting getVerticalFormatting() const;
+    void setVerticalFormatting(VerticalTextFormatting fmt);
+    HorizontalTextFormatting getHorizontalFormatting() const;
+    void setHorizontalFormatting(HorizontalTextFormatting fmt);
+    //void writeXMLToStream(OutStream& out_stream) const;
+    bool isTextFetchedFromProperty() const;
+    string getTextPropertySource() const;
+    void setTextPropertySource(string property);
+    bool isFontFetchedFromProperty() const;
+    string getFontPropertySource() const;
+    void setFontPropertySource(string property);
+    TextComponent();
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/WidgetComponent.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/WidgetComponent.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/WidgetComponent.pkg	(revision 2664)
@@ -0,0 +1,33 @@
+/******************************************************************************
+  WidgetComponent
+******************************************************************************/
+
+class WidgetComponent
+{
+  void create(Window& parent) const;
+  const ComponentArea& getComponentArea() const;
+  void setComponentArea(const ComponentArea& area);
+  string getBaseWidgetType() const;
+  void setBaseWidgetType(string type);
+  string getWidgetLookName() const;
+  void setWidgetLookName(string look);
+  string getWidgetNameSuffix() const;
+  void setWidgetNameSuffix(string suffix);
+  string getWindowRendererType() const;
+  void setWindowRendererType(string type);
+  VerticalAlignment getVerticalWidgetAlignment() const;
+  void setVerticalWidgetAlignment(VerticalAlignment alignment);
+  HorizontalAlignment getHorizontalWidgetAlignment() const;
+  void setHorizontalWidgetAlignment(HorizontalAlignment alignment);
+  void addPropertyInitialiser(const PropertyInitialiser& initialiser);
+  void clearPropertyInitialisers();
+  void layout(const Window& owner) const;
+
+  //void writeXMLToStream(OutStream& out_stream) const;
+
+  const PropertyInitialiser* findPropertyInitialiser(string propertyName) const;
+
+  WidgetComponent();
+  WidgetComponent(string type, string look, string suffix, string renderer);
+};
+
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/WidgetLookFeel.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/WidgetLookFeel.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/WidgetLookFeel.pkg	(revision 2664)
@@ -0,0 +1,37 @@
+/**************************************************************************************
+    WidgetLookFeel
+**************************************************************************************/
+
+class WidgetLookFeel
+{
+    StateImagery& getStateImagery(string state) const;
+    ImagerySection& getImagerySection(string section) const;
+    string getName() const;
+    void addImagerySection(const ImagerySection& section);
+    void addWidgetComponent(const WidgetComponent& widget);
+    void addStateSpecification(const StateImagery& state);
+    void addPropertyInitialiser(const PropertyInitialiser& initialiser);
+    void clearImagerySections();
+    void clearWidgetComponents();
+    void clearStateSpecifications();
+    void clearPropertyInitialisers();
+    void initialiseWidget(Window& widget) const;
+    bool isStateImageryPresent(string state) const;
+    void addNamedArea(const NamedArea& area);
+    void clearNamedAreas();
+    const NamedArea& getNamedArea(string name) const;
+    bool isNamedAreaDefined(string name) const;
+    void layoutChildWidgets(const Window& owner) const;
+    void addPropertyDefinition(const PropertyDefinition& propdef);
+    void addPropertyLinkDefinition(const PropertyLinkDefinition& propdef);
+    void clearPropertyDefinitions();
+    void clearPropertyLinkDefinitions();
+    //void writeXMLToStream(XMLSerializer& out_stream) const;
+    void renameChildren(const Window& widget, string newBaseName) const;
+
+    const PropertyInitialiser* findPropertyInitialiser(string propertyName) const;
+    const WidgetComponent* findWidgetComponent(string nameSuffix) const;
+
+    WidgetLookFeel(string name);
+    WidgetLookFeel();
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/WidgetLookManager.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/WidgetLookManager.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.5.0/package/falagard/WidgetLookManager.pkg	(revision 2664)
@@ -0,0 +1,22 @@
+/***********************************************************************
+  WidgetLookManager
+***********************************************************************/
+
+class WidgetLookManager
+{
+  static WidgetLookManager& getSingleton(void);
+
+  void parseLookNFeelSpecification(string filename, string resourceGroup = "");
+  bool isWidgetLookAvailable(string widget) const;
+  const WidgetLookFeel& getWidgetLook(string widget) const;
+  void eraseWidgetLook(string widget);
+  void addWidgetLook(WidgetLookFeel& look);
+
+  void writeWidgetLookToStream(string name, OutStream& out_stream) const;
+  void writeWidgetLookSeriesToStream(string prefix, OutStream& out_stream) const;
+
+  WidgetLookManager();
+
+  static void setDefaultResourceGroup(string resourceGroup);
+  static string getDefaultResourceGroup();
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/CMakeLists.txt	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/CMakeLists.txt	(revision 2664)
@@ -0,0 +1,12 @@
+SET(_package_files
+  CEGUI.pkg
+  Logger.pkg
+  ScriptWindowHelper.pkg
+  WindowManager.pkg
+  elements/GroupBox.pkg
+  elements/MultiLineEditbox.pkg
+  elements/Tree.pkg
+  elements/TreeItem.pkg
+
+  PARENT_SCOPE
+)
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILua.cpp
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILua.cpp	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILua.cpp	(revision 2664)
@@ -0,0 +1,336 @@
+/***********************************************************************
+	filename: CEGUILua.cpp
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+
+	purpose:  Implementation for LuaScriptModule class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "CEGUIPropertyHelper.h"
+#include "CEGUILua.h"
+#include "CEGUILuaFunctor.h"
+#include <vector>
+
+// include Lua libs and tolua++
+extern "C" {
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+}
+
+#include "tolua/tolua++.h"
+
+// prototype for bindings initialisation function
+int tolua_CEGUI_open(lua_State* tolua_S);
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+	Constructor (creates Lua state)
+*************************************************************************/
+LuaScriptModule::LuaScriptModule()
+{
+    #if LUA_VERSION_NUM >= 501
+        static const luaL_Reg lualibs[] = {
+            {"", luaopen_base},
+            {LUA_LOADLIBNAME, luaopen_package},
+            {LUA_TABLIBNAME, luaopen_table},
+            {LUA_IOLIBNAME, luaopen_io},
+            {LUA_OSLIBNAME, luaopen_os},
+            {LUA_STRLIBNAME, luaopen_string},
+            {LUA_MATHLIBNAME, luaopen_math},
+        #if defined(DEBUG) || defined (_DEBUG)
+                {LUA_DBLIBNAME, luaopen_debug},
+        #endif
+            {0, 0}
+        };
+    #endif /* LUA_VERSION_NUM >= 501 */
+
+    // create a lua state
+    d_ownsState = true;
+    d_state = lua_open();
+
+    // init all standard libraries
+    #if LUA_VERSION_NUM >= 501
+            const luaL_Reg *lib = lualibs;
+            for (; lib->func; lib++)
+            {
+                lua_pushcfunction(d_state, lib->func);
+                lua_pushstring(d_state, lib->name);
+                lua_call(d_state, 1, 0);
+            }
+    #else /* LUA_VERSION_NUM >= 501 */
+        luaopen_base(d_state);
+        luaopen_io(d_state);
+        luaopen_string(d_state);
+        luaopen_table(d_state);
+        luaopen_math(d_state);
+        #if defined(DEBUG) || defined (_DEBUG)
+            luaopen_debug(d_state);
+        #endif
+    #endif /* LUA_VERSION_NUM >= 501 */
+
+    setModuleIdentifierString();
+}
+
+
+/*************************************************************************
+	Constructor (uses given Lua state)
+*************************************************************************/
+LuaScriptModule::LuaScriptModule(lua_State* state)
+{
+	// just use the given state
+	d_ownsState = false;
+	d_state = state;
+
+	setModuleIdentifierString();
+}
+
+
+/*************************************************************************
+	Destructor
+*************************************************************************/
+LuaScriptModule::~LuaScriptModule()
+{
+	if ( d_ownsState && d_state )
+	{
+		lua_close( d_state );
+	}
+}
+
+
+/*************************************************************************
+	Execute script file
+*************************************************************************/
+void LuaScriptModule::executeScriptFile(const String& filename, const String& resourceGroup)
+{
+	// load file
+	RawDataContainer raw;
+	System::getSingleton().getResourceProvider()->loadRawDataContainer(filename,
+        raw, resourceGroup.empty() ? d_defaultResourceGroup : resourceGroup);
+
+	// load code into lua
+	int top = lua_gettop(d_state);
+	int loaderr = luaL_loadbuffer(d_state, (char*)raw.getDataPtr(), raw.getSize(), filename.c_str());
+	System::getSingleton().getResourceProvider()->unloadRawDataContainer( raw );
+	if (loaderr)
+	{
+	    String errMsg = lua_tostring(d_state,-1);
+		lua_settop(d_state,top);
+		throw ScriptException("Unable to execute Lua script file: '"+filename+"'\n\n"+errMsg+"\n");
+	}
+
+    // call it
+	if (lua_pcall(d_state,0,0,0))
+	{
+	    String errMsg = lua_tostring(d_state,-1);
+		lua_settop(d_state,top);
+		throw ScriptException("Unable to execute Lua script file: '"+filename+"'\n\n"+errMsg+"\n");
+	}
+
+	lua_settop(d_state,top); // just in case :P
+}
+
+
+/*************************************************************************
+	Execute global script function
+*************************************************************************/
+int	LuaScriptModule::executeScriptGlobal(const String& function_name)
+{
+    int top = lua_gettop(d_state);
+
+    // get the function from lua
+    lua_getglobal(d_state, function_name.c_str());
+
+    // is it a function
+    if (!lua_isfunction(d_state,-1))
+    {
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to get Lua global: '"+function_name+"' as name not represent a global Lua function" );
+    }
+
+    // call it
+    int error = lua_pcall(d_state,0,1,0);
+
+    // handle errors
+    if (error)
+    {
+        String errMsg = lua_tostring(d_state,-1);
+        lua_pop(d_state,1);
+        throw ScriptException("Unable to evaluate Lua global: '"+function_name+"\n\n"+errMsg+"\n");
+    }
+
+    // get return value
+    if (!lua_isnumber(d_state,-1))
+    {
+        // log that return value is invalid. return -1 and move on.
+        lua_settop(d_state,top);
+        ScriptException("Unable to get Lua global : '"+function_name+"' return value as it's not a number" );
+        return -1;
+    }
+
+    int ret = (int)lua_tonumber(d_state,-1);
+    lua_pop(d_state,1);
+
+    // return it
+    return ret;
+}
+
+
+/*************************************************************************
+	Execute scripted event handler
+*************************************************************************/
+bool LuaScriptModule::executeScriptedEventHandler(const String& handler_name, const EventArgs& e)
+{
+
+	LuaFunctor::pushNamedFunction(d_state, handler_name);
+
+	ScriptWindowHelper* helper = 0;
+	//If this is an event that was triggered by a window then make a "this" pointer to the window for the script.
+	if(e.d_hasWindow)
+	{
+		WindowEventArgs& we = (WindowEventArgs&)e;
+		helper = new ScriptWindowHelper(we.window);
+		lua_pushlightuserdata(d_state,(void*)helper);
+		lua_setglobal(d_state,"this");
+	} // if(e.d_hasWindow)
+
+    // push EventArgs as the first parameter
+    tolua_pushusertype(d_state,(void*)&e,"const CEGUI::EventArgs");
+
+    // call it
+    int error = lua_pcall(d_state,1,0,0);
+
+    // handle errors
+    if (error)
+    {
+        String errStr(lua_tostring(d_state,-1));
+        lua_pop(d_state,1);
+		//cleanup the helper object if any
+		if(helper)
+		{
+			delete helper;
+			helper = 0;
+		}
+        throw ScriptException("Unable to evaluate the Lua event handler: '"+handler_name+"'\n\n"+errStr+"\n");
+    } // if (error)
+
+	if(helper)
+	{
+		delete helper;
+		helper = 0;
+	}
+
+    return true;
+}
+
+
+/*************************************************************************
+	Execute script code string
+*************************************************************************/
+void LuaScriptModule::executeString(const String& str)
+{
+    int top = lua_gettop(d_state);
+
+    // load code into lua and call it
+    int error =	luaL_loadbuffer(d_state, str.c_str(), str.length(), str.c_str()) || lua_pcall(d_state,0,0,0);
+
+    // handle errors
+    if (error)
+    {
+        String errMsg = lua_tostring(d_state,-1);
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to execute Lua script string: '"+str+"'\n\n"+errMsg+"\n");
+    }
+}
+
+
+/*************************************************************************
+	Create Lua bindings
+*************************************************************************/
+void LuaScriptModule::createBindings(void)
+{
+	CEGUI::Logger::getSingleton().logEvent( "---- Creating Lua bindings ----" );
+	// init CEGUI module
+	tolua_CEGUI_open(d_state);
+}
+
+
+/*************************************************************************
+	Destroy Lua bindings
+*************************************************************************/
+void LuaScriptModule::destroyBindings(void)
+{
+	CEGUI::Logger::getSingleton().logEvent( "---- Destroying Lua bindings ----" );
+	// is this ok ?
+	lua_pushnil(d_state);
+	lua_setglobal(d_state,"CEGUI");
+}
+
+
+/*************************************************************************
+	Set the ID string for the module
+*************************************************************************/
+void LuaScriptModule::setModuleIdentifierString()
+{
+    // set ID string
+    d_identifierString = "CEGUI::LuaScriptModule - Official Lua based scripting module for CEGUI";
+	d_language = "Lua";
+}
+
+
+/*************************************************************************
+	Subscribe to a scripted event handler
+*************************************************************************/
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target, const String& event_name, const String& subscriber_name)
+{
+    // do the real subscription
+    LuaFunctor functor(d_state,subscriber_name,LUA_NOREF);
+    Event::Connection con = target->subscribeEvent(event_name, Event::Subscriber(functor));
+    // make sure we don't release the reference we just made when this call returns
+    functor.index = LUA_NOREF;
+
+    // return the event connection
+    return con;
+}
+
+
+/*************************************************************************
+	Subscribe to a scripted event handler
+*************************************************************************/
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target, const String& event_name, Event::Group group, const String& subscriber_name)
+{
+    // do the real subscription
+    LuaFunctor functor(d_state,subscriber_name,LUA_NOREF);
+    Event::Connection con = target->subscribeEvent(event_name, group, Event::Subscriber(functor));
+
+    // return the event connection
+    return con;
+}
+
+} // namespace CEGUI
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILua.h
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILua.h	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILua.h	(revision 2664)
@@ -0,0 +1,253 @@
+/***********************************************************************
+	filename: CEGUILua.h
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+	
+	purpose:  Defines interface for LuaScriptModule class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#ifndef _CEGUILua_h_
+#define _CEGUILua_h_
+
+
+/*************************************************************************
+	Import / Export control macros
+*************************************************************************/
+#if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
+#   ifdef CEGUILUA_EXPORTS
+#       define CEGUILUA_API __declspec(dllexport)
+#   else
+#       if defined( __MINGW32__ )
+#           define CEGUILUA_API
+#       else
+#           define CEGUILUA_API __declspec(dllimport)
+#       endif
+#   endif
+#else
+#   define CEGUILUA_API
+#endif
+
+
+#include "CEGUIScriptModule.h"
+
+struct lua_State;
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Interface for the LuaScriptModule class
+*/
+class CEGUILUA_API LuaScriptModule : public CEGUI::ScriptModule
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for LuaScriptModule class which create a lua_State
+	*/
+	LuaScriptModule();
+
+
+	/*!
+	\brief
+		Constructor for LuaScriptModule class which takes a lua_State
+
+	\param state
+		Pointer to the lua_State that the script module should attach to.
+	*/
+	LuaScriptModule(lua_State* state);
+
+
+	/*!
+	\brief
+		Destructor for LuaScriptModule class.
+	*/
+	~LuaScriptModule();
+
+
+	/*************************************************************************
+		Script Execution Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Execute a script file.
+
+	\param filename
+		String object holding the filename of the script file that is to be executed
+		
+	\param resourceGroup
+		Resource group idendifier to be passed to the ResourceProvider when loading the script file.
+	*/
+	void executeScriptFile(const String& filename, const String& resourceGroup);
+
+
+	/*!
+	\brief
+		Execute a scripted global function.  The function should not take any parameters and should return an integer.
+
+	\param function_name
+		String object holding the name of the function, in the global script environment, that
+		is to be executed.
+
+	\return
+		The integer value returned from the script function.
+	*/
+	int executeScriptGlobal(const String& function_name);
+
+
+    /*!
+    \brief
+        Execute a scripted global 'event handler' function by looking it up by name.
+
+    \param handler_name
+        String object holding the name of the scripted handler function.
+        If this string contains dots '.' it will be parsed as tables containing a function field.
+        For example: 'mytable.subtable.func'
+
+    \param e
+        EventArgs based object that should be passed, by any appropriate means, to the scripted function.
+
+    \return
+        - true if the event was handled.
+        - false if the event was not handled.
+    */
+    bool executeScriptedEventHandler(const String& handler_name, const EventArgs& e);
+
+
+    /*!
+    \brief
+        Execute script code contained in the given CEGUI::String object.
+
+    \param str
+        String object holding the valid script code that should be executed.
+
+    \return
+        Nothing.
+    */
+    void executeString(const String& str);
+
+    /*************************************************************************
+        Event subscription
+    *************************************************************************/
+    /*!
+    \brief
+            Subscribes the named Event to a scripted funtion
+
+    \param target
+            The target EventSet for the subscription.
+
+    \param name
+            String object containing the name of the Event to subscribe to.
+
+    \param subscriber_name
+            String object containing the name of the script funtion that is to be subscribed to the Event.
+
+    \return
+            Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.
+
+    \exception UnknownObjectException	Thrown if an Event named \a name is not in the EventSet
+    */
+    Event::Connection	subscribeEvent(EventSet* target, const String& name, const String& subscriber_name);
+
+    /*!
+    \brief
+            Subscribes the specified group of the named Event to a scripted funtion.
+
+    \param target
+            The target EventSet for the subscription.
+
+    \param name
+            String object containing the name of the Event to subscribe to.
+
+    \param group
+            Group which is to be subscribed to.  Subscription groups are called in ascending order.
+
+    \param subscriber_name
+            String object containing the name of the script funtion that is to be subscribed to the Event.
+
+    \return
+            Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.
+
+    \exception UnknownObjectException	Thrown if an Event named \a name is not in the EventSet
+    */
+    Event::Connection	subscribeEvent(EventSet* target, const String& name, Event::Group group, const String& subscriber_name);
+
+    /*************************************************************************
+        Bindings creation / destruction
+    *************************************************************************/
+    /*!
+    \brief
+        Method called during system initialisation, prior to running any scripts via the ScriptModule, to enable the ScriptModule
+        to perform any operations required to complete initialisation or binding of the script language to the gui system objects.
+
+    \return
+        Nothing.
+    */
+    void createBindings(void);
+
+
+    /*!
+    \brief
+        Method called during system destruction, after all scripts have been run via the ScriptModule, to enable the ScriptModule
+        to perform any operations required to cleanup bindings of the script language to the gui system objects, as set-up in the
+        earlier createBindings call.
+
+    \return
+        Nothing.
+    */
+    void destroyBindings(void);
+
+    /*************************************************************************
+        Accessor type functions
+    *************************************************************************/
+    /*!
+    \brief
+        Method used to get a pointer to the lua_State that the script module is attached to.
+
+    \return
+        A pointer to the lua_State that the script module is attached to.
+    */
+    lua_State* getLuaState(void) const {return d_state;}
+
+private:
+    /*************************************************************************
+        Implementation Functions
+    *************************************************************************/
+    void setModuleIdentifierString();
+
+    /*************************************************************************
+        Implementation Data
+    *************************************************************************/
+    bool d_ownsState;      //!< true when the attached lua_State was created by this script module
+    lua_State* d_state;    //!< The lua_State that this script module uses.
+};
+
+} // namespace CEGUI
+
+#endif // end of guard _CEGUILua_h_
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILuaFunctor.cpp
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILuaFunctor.cpp	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILuaFunctor.cpp	(revision 2664)
@@ -0,0 +1,280 @@
+/***********************************************************************
+    filename: CEGUILuaFunctor.cpp
+    created:  Thu Jan 26 2006
+    author:   Tomas Lindquist Olsen <tomas@famolsen.dk>
+
+    purpose:  Implementation for LuaFunctor class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUILuaFunctor.h"
+#include "CEGUILogger.h"
+#include "CEGUIExceptions.h"
+#include "CEGUIPropertyHelper.h"
+
+// include Lua libs and tolua++
+extern "C" {
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+}
+
+#include "tolua/tolua++.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(lua_State* state, int func, int selfIndex) :
+    L(state),
+    index(func),
+    self(selfIndex),
+    needs_lookup(false)
+{
+}
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(lua_State* state, const String& func, int selfIndex) :
+    L(state),
+    index(LUA_NOREF),
+    self(selfIndex),
+    needs_lookup(true),
+    function_name(func)
+{
+}
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(const LuaFunctor& cp) :
+    L(cp.L),
+    index(cp.index),
+    self(cp.self),
+    needs_lookup(cp.needs_lookup),
+    function_name(cp.function_name)
+{
+}
+
+/*************************************************************************
+    Destructor
+*************************************************************************/
+LuaFunctor::~LuaFunctor()
+{
+    if (self!=LUA_NOREF)
+    {
+        luaL_unref(L, LUA_REGISTRYINDEX, self);
+    }
+    if (index!=LUA_NOREF)
+    {
+        luaL_unref(L, LUA_REGISTRYINDEX, index);
+    }
+}
+
+/*************************************************************************
+    Call operator
+*************************************************************************/
+bool LuaFunctor::operator()(const EventArgs& args) const
+{
+    // is this a late binding?
+    if (needs_lookup)
+    {
+        pushNamedFunction(L, function_name);
+        // reference function
+        index = luaL_ref(L, LUA_REGISTRYINDEX);
+        needs_lookup = false;
+        CEGUI_LOGINSANE("Late binding of callback '"+function_name+"' performed");
+        function_name.clear();
+    } // if (needs_lookup)
+
+	ScriptWindowHelper* helper = 0;
+	//Set a global for this window
+	if(args.d_hasWindow)
+	{
+		WindowEventArgs& we = (WindowEventArgs&)args;
+		helper = new ScriptWindowHelper(we.window);
+		tolua_pushusertype(L,(void*)helper,"CEGUI::ScriptWindowHelper");
+		lua_setglobal(L,"this");
+	}
+
+    // retrieve function
+    lua_rawgeti(L, LUA_REGISTRYINDEX, index);
+
+    // possibly self as well?
+    int nargs = 1;
+    if (self != LUA_NOREF)
+    {
+        lua_rawgeti(L, LUA_REGISTRYINDEX, self);
+        ++nargs;
+    }
+
+    // push EventArgs  parameter
+    tolua_pushusertype(L, (void*)&args, "const CEGUI::EventArgs");
+
+    // call it
+    int error = lua_pcall(L, nargs, 0, 0);
+
+    // handle errors
+    if (error)
+    {
+        String errStr(lua_tostring(L, -1));
+        lua_pop(L, 1);
+		if(helper)
+		{
+			delete helper;
+			helper = 0;
+		}
+        throw ScriptException("Unable to call Lua event handler:\n\n"+errStr+"\n");
+    } // if (error)
+
+	if(helper)
+	{
+		delete helper;
+		helper = 0;
+	}
+
+    return true;
+}
+
+/*************************************************************************
+    do event subscription by reference instead of by name
+*************************************************************************/
+Event::Connection LuaFunctor::SubscribeEvent(EventSet* self, const String& event_name, int funcIndex, int selfIndex, lua_State* L)
+{
+    // should we pass a self to the callback?
+    int thisIndex = LUA_NOREF;
+    if (selfIndex != LUA_NOREF)
+    {
+        // reference self
+        thisIndex = luaL_ref(L, LUA_REGISTRYINDEX);
+    }
+
+    // do the real subscription
+    int type = lua_type(L,-1);
+    Event::Connection con;
+    if (type == LUA_TFUNCTION)
+    {
+        // reference function
+        int index = luaL_ref(L, LUA_REGISTRYINDEX);
+        LuaFunctor functor(L,index,thisIndex);
+        con = self->subscribeEvent(String(event_name), Event::Subscriber(functor));
+        // make sure we don't release the reference(s) we just made when this call returns
+        functor.index = LUA_NOREF;
+        functor.self = LUA_NOREF;
+    }
+    else if (type == LUA_TSTRING)
+    {
+        const char* str = lua_tostring(L, -1);
+        LuaFunctor functor(L,String(str),thisIndex);
+        con = self->subscribeEvent(String(event_name), Event::Subscriber(functor));
+        // make sure we don't release the reference we just (maybe) made when this call returns
+        functor.self = LUA_NOREF;
+    }
+    else
+    {
+        luaL_error(L,"bad function passed to subscribe function. must be a real function, or a string for late binding");
+    }
+
+    // return the event connection
+    return con;
+}
+
+/*************************************************************************
+    Pushes a named function on the stack
+*************************************************************************/
+void LuaFunctor::pushNamedFunction(lua_State* L, const String& handler_name)
+{
+    int top = lua_gettop(L);
+
+    // do we have any dots in the handler name? if so we grab the function as a table field
+    String::size_type i = handler_name.find_first_of((utf32)'.');
+    if (i!=String::npos)
+    {
+        // split the rest of the string up in parts seperated by '.'
+        // TODO: count the dots and size the vector accordingly from the beginning.
+        std::vector<String> parts;
+        String::size_type start = 0;
+        do
+        {
+            parts.push_back(handler_name.substr(start,i-start));
+            start = i+1;
+            i = handler_name.find_first_of((utf32)'.',start);
+        } while(i!=String::npos);
+
+        // add last part
+        parts.push_back(handler_name.substr(start));
+
+        // first part is the global
+        lua_getglobal(L, parts[0].c_str());
+        if (!lua_istable(L,-1))
+        {
+            lua_settop(L,top);
+            throw ScriptException("Unable to get the Lua event handler: '"+handler_name+"' as first part is not a table");
+        }
+
+        // if there is more than two parts, we have more tables to go through
+        std::vector<String>::size_type visz = parts.size();
+        if (visz-- > 2) // avoid subtracting one later on
+        {
+            // go through all the remaining parts to (hopefully) have a valid Lua function in the end
+            std::vector<String>::size_type vi = 1;
+            while (vi<visz)
+            {
+                // push key, and get the next table
+                lua_pushstring(L,parts[vi].c_str());
+                lua_gettable(L,-2);
+                if (!lua_istable(L,-1))
+                {
+                    lua_settop(L,top);
+                    throw ScriptException("Unable to get the Lua event handler: '"+handler_name+"' as part #"+PropertyHelper::uintToString(uint(vi+1))+" ("+parts[vi]+") is not a table");
+                }
+                // get rid of the last table and move on
+                lua_remove(L,-2);
+                vi++;
+            }
+        }
+
+        // now we are ready to get the function to call ... phew :)
+        lua_pushstring(L,parts[visz].c_str());
+        lua_gettable(L,-2);
+        lua_remove(L,-2); // get rid of the table
+    }
+    // just a regular global function
+    else
+    {
+        lua_getglobal(L, handler_name.c_str());
+    }
+
+    // is it a function
+    if (!lua_isfunction(L,-1))
+    {
+        lua_settop(L,top);
+        throw ScriptException("The Lua event handler: '"+handler_name+"' does not represent a Lua function");
+    }
+}
+
+} // namespace CEGUI
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILuaFunctor.h
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILuaFunctor.h	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/CEGUILuaFunctor.h	(revision 2664)
@@ -0,0 +1,86 @@
+/***********************************************************************
+    filename: CEGUILuaFunctor.h
+    created:  Thu Jan 26 2006
+    author:   Tomas Lindquist Olsen <tomas@famolsen.dk>
+
+    purpose:  Defines interface for LuaFunctor class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#ifndef _CEGUILuaFunctor_h_
+#define _CEGUILuaFunctor_h_
+
+#include "CEGUIEventSet.h"
+#include "CEGUIScriptWindowHelper.h"
+
+struct lua_State;
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// forward declaration
+class LuaScriptModule;
+
+/*!
+\brief
+    Functor class used for subscribing Lua functions to CEGUI events
+*/
+class LuaFunctor
+{
+public:
+    LuaFunctor(lua_State* state, int func, int selfIndex);
+    LuaFunctor(lua_State* state, const String& func, int selfIndex);
+    LuaFunctor(const LuaFunctor& cp);
+    ~LuaFunctor();
+
+    bool operator()(const EventArgs& args) const;
+
+    /*!
+    \brief
+        function used to subscribe any Lua function as event handler.
+        References using the Lua registry.
+        To be called from Lua only.
+    */
+    static Event::Connection SubscribeEvent(EventSet* self, const String& eventName, int funcIndex, int selfIndex, lua_State* L);
+
+    /*!
+    \brief
+        Pushes the Lua function named \param name on top of the Lua stack.
+        The name may contain '.' (dots) character for (nested) table values.
+    */
+    static void pushNamedFunction(lua_State* L, const String& name);
+
+private:
+    lua_State* L;
+    mutable int index;
+    int self;
+    mutable bool needs_lookup;
+    mutable String function_name;
+
+    friend class LuaScriptModule;
+};
+
+} // namespace CEGUI
+
+#endif // end of guard _CEGUILuaFunctor_h_
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/changes_orxonox.diff
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/changes_orxonox.diff	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/changes_orxonox.diff	(revision 2664)
@@ -0,0 +1,92 @@
+--- CEGUILua.cpp	Sun Jan 25 18:30:39 2009
++++ CEGUILua.cpp	Thu Jan 29 10:25:05 2009
+@@ -27,10 +27,6 @@
+  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+  *   OTHER DEALINGS IN THE SOFTWARE.
+  ***************************************************************************/
+-#ifdef HAVE_CONFIG_H
+-#   include "config.h"
+-#endif
+-
+ #include "CEGUI.h"
+ #include "CEGUIPropertyHelper.h"
+ #include "CEGUILua.h"
+@@ -44,7 +40,7 @@
+ #include "lauxlib.h"
+ }
+ 
+-#include "tolua++.h"
++#include "tolua/tolua++.h"
+ 
+ // prototype for bindings initialisation function
+ int tolua_CEGUI_open(lua_State* tolua_S);
+@@ -59,7 +55,7 @@
+ *************************************************************************/
+ LuaScriptModule::LuaScriptModule()
+ {
+-    #if CEGUI_LUA_VER >= 51
++    #if LUA_VERSION_NUM >= 501
+         static const luaL_Reg lualibs[] = {
+             {"", luaopen_base},
+             {LUA_LOADLIBNAME, luaopen_package},
+@@ -73,14 +69,14 @@
+         #endif
+             {0, 0}
+         };
+-    #endif /* CEGUI_LUA_VER >= 51 */
++    #endif /* LUA_VERSION_NUM >= 501 */
+ 
+     // create a lua state
+     d_ownsState = true;
+     d_state = lua_open();
+ 
+     // init all standard libraries
+-    #if CEGUI_LUA_VER >= 51
++    #if LUA_VERSION_NUM >= 501
+             const luaL_Reg *lib = lualibs;
+             for (; lib->func; lib++)
+             {
+@@ -88,7 +84,7 @@
+                 lua_pushstring(d_state, lib->name);
+                 lua_call(d_state, 1, 0);
+             }
+-    #else /* CEGUI_LUA_VER >= 51 */
++    #else /* LUA_VERSION_NUM >= 501 */
+         luaopen_base(d_state);
+         luaopen_io(d_state);
+         luaopen_string(d_state);
+@@ -97,7 +93,7 @@
+         #if defined(DEBUG) || defined (_DEBUG)
+             luaopen_debug(d_state);
+         #endif
+-    #endif /* CEGUI_LUA_VER >= 51 */
++    #endif /* LUA_VERSION_NUM >= 501 */
+ 
+     setModuleIdentifierString();
+ }
+--- CEGUILua.h	Wed Jul  9 18:24:49 2008
++++ CEGUILua.h	Thu Jan 29 10:17:07 2009
+@@ -38,7 +38,11 @@
+ #   ifdef CEGUILUA_EXPORTS
+ #       define CEGUILUA_API __declspec(dllexport)
+ #   else
+-#       define CEGUILUA_API __declspec(dllimport)
++#       if defined( __MINGW32__ )
++#           define CEGUILUA_API
++#       else
++#           define CEGUILUA_API __declspec(dllimport)
++#       endif
+ #   endif
+ #else
+ #   define CEGUILUA_API
+--- CEGUILuaFunctor.cpp	Wed Jul  9 18:25:02 2008
++++ CEGUILuaFunctor.cpp	Thu Jan 29 10:26:58 2009
+@@ -39,7 +39,7 @@
+ #include "lauxlib.h"
+ }
+ 
+-#include "tolua++.h"
++#include "tolua/tolua++.h"
+ 
+ // Start of CEGUI namespace section
+ namespace CEGUI
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/required.cpp
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/required.cpp	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/required.cpp	(revision 2664)
@@ -0,0 +1,88 @@
+/***********************************************************************
+	filename: required.cpp
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+	
+	purpose:  Implementation of helper functions
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "required.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+	Functions for getting Thumb range pairs as two return values
+*************************************************************************/
+
+// returns horizontal range as two values for lua
+void ceguiLua_Thumb_getHorzRange(Thumb* wnd, float* min, float* max)
+{
+	std::pair<float,float> range_pair = wnd->getHorzRange();
+	*min = range_pair.first;
+	*max = range_pair.second;
+}
+
+
+// returns vertical range as two values for lua
+void ceguiLua_Thumb_getVertRange(Thumb* wnd, float* min, float* max)
+{
+	std::pair<float,float> range_pair = wnd->getVertRange();
+	*min = range_pair.first;
+	*max = range_pair.second;
+}
+
+
+/*************************************************************************
+	Functions for creating list box items
+*************************************************************************/
+
+// allocates and returns a new ListboxTextItem
+ListboxTextItem* ceguiLua_createListboxTextItem(const String& text, uint item_id, void* item_data, bool disabled, bool auto_delete)
+{
+	return new ListboxTextItem(text,item_id,item_data,disabled,auto_delete);
+}
+
+
+/************************************************************************
+    OutStream
+*************************************************************************/
+void ceguiLua_FileStream_open(FileStream* os, const char* filename)
+{
+    os->open(filename, std::ios::binary);
+}
+
+
+/************************************************************************
+    CEGUI::System::getSystemKeys alternative
+*************************************************************************/
+bool ceguiLua_System_isSystemKeyDown(const System* sys, SystemKey k)
+{
+    return (k & sys->getSystemKeys()) != 0;
+}
+
+
+} // namespace CEGUI
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/required.h
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/required.h	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/ceguilua/required.h	(revision 2664)
@@ -0,0 +1,113 @@
+/***********************************************************************
+	filename: required.h
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+
+	purpose:  Header that includes the necessary stuff needed for the Lua bindings
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "CEGUILua.h"
+#include "CEGUILuaFunctor.h"
+#include <fstream>
+
+#define __operator_increment    operator++
+#define __operator_decrement    operator--
+#define __operator_dereference  operator*
+
+#define LuaFunctorSubscribeEvent CEGUI::LuaFunctor::SubscribeEvent
+
+//This is used to keep compilers happy
+#define CEGUIDeadException(e) &
+
+#if defined(_MSC_VER) && !defined(snprintf)
+#   define snprintf   _snprintf
+#endif
+
+typedef CEGUI::String string;
+
+namespace CEGUI
+{
+
+typedef Event::Connection EventConnection;
+
+/*************************************************************************
+	Functions for getting Thumb range pairs as two return values
+*************************************************************************/
+void ceguiLua_Thumb_getHorzRange(Thumb* wnd, float* min, float* max);
+void ceguiLua_Thumb_getVertRange(Thumb* wnd, float* min, float* max);
+
+
+/*************************************************************************
+	Functions for creating list box items
+*************************************************************************/
+ListboxTextItem* ceguiLua_createListboxTextItem(const String& text, uint item_id, void* item_data, bool disabled, bool auto_delete);
+
+
+/************************************************************************
+    Stuff needed to make the iterators work
+*************************************************************************/
+typedef PropertySet::Iterator PropertyIterator;
+typedef EventSet::Iterator EventIterator;
+typedef WindowManager::WindowIterator WindowIterator;
+typedef WindowFactoryManager::WindowFactoryIterator WindowFactoryIterator;
+typedef WindowFactoryManager::FalagardMappingIterator FalagardMappingIterator;
+typedef WindowFactoryManager::FalagardWindowMapping FalagardWindowMapping;
+typedef ImagesetManager::ImagesetIterator ImagesetIterator;
+typedef Imageset::ImageIterator ImageIterator;
+typedef SchemeManager::SchemeIterator SchemeIterator;
+typedef FontManager::FontIterator FontIterator;
+
+template <typename T>
+inline PropertyIterator ceguiLua_getPropertyIterator(const T* self)
+{
+    return static_cast<const PropertySet*>(self)->getIterator();
+}
+
+template <typename T>
+inline EventIterator ceguiLua_getEventIterator(const T* self)
+{
+    return static_cast<const EventSet*>(self)->getIterator();
+}
+
+
+/************************************************************************
+    OutStream
+*************************************************************************/
+typedef std::ofstream FileStream;
+void ceguiLua_FileStream_open(FileStream*, const char* filename);
+
+
+/************************************************************************
+    CEGUI::System::getSystemKeys alternative
+*************************************************************************/
+bool ceguiLua_System_isSystemKeyDown(const System* sys, SystemKey k);
+
+}
+
+// the binding file generates alot of
+// warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
+#if defined(_MSC_VER)
+#   pragma warning(disable : 4800)
+#endif
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/CEGUI.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/CEGUI.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/CEGUI.pkg	(revision 2664)
@@ -0,0 +1,121 @@
+// include the header that makes these files generate valid code
+$#include "ceguilua/required.h"
+$#include "CEGUIPropertyHelper.h"
+
+// start the CEGUI namespace and include everything inside that
+namespace CEGUI
+{
+
+$pfile "Basic.pkg"
+$pfile "UnifiedCoordSystem.pkg"
+$pfile "Logger.pkg"
+
+$pfile "Font.pkg"
+$pfile "FontManager.pkg"
+
+$pfile "Image.pkg"
+$pfile "Texture.pkg"
+$pfile "Imageset.pkg"
+$pfile "ImagesetManager.pkg"
+
+$pfile "Iterators.pkg"
+
+$pfile "Key.pkg"
+$pfile "InputEvent.pkg"
+$pfile "EventSet.pkg"
+
+$pfile "MouseCursor.pkg"
+$pfile "Window.pkg"
+$pfile "CoordConverter.pkg"
+$pfile "Renderer.pkg"
+$pfile "ScriptWindowHelper.pkg"
+$pfile "System.pkg"
+
+$pfile "WindowManager.pkg"
+$pfile "WindowFactoryManager.pkg"
+
+$pfile "Scheme.pkg"
+$pfile "SchemeManager.pkg"
+
+$pfile "PropertyHelper.pkg"
+
+// elements
+$pfile "elements/GUISheet.pkg"
+$pfile "elements/Tree.pkg"
+
+$pfile "elements/ButtonBase.pkg"
+$pfile "elements/Checkbox.pkg"
+$pfile "elements/PushButton.pkg"
+$pfile "elements/Thumb.pkg"
+$pfile "elements/RadioButton.pkg"
+
+$pfile "elements/TabButton.pkg"
+$pfile "elements/TabControl.pkg"
+
+$pfile "elements/Titlebar.pkg"
+$pfile "elements/TreeItem.pkg"
+$pfile "elements/FrameWindow.pkg"
+
+$pfile "elements/Tooltip.pkg"
+
+$pfile "elements/DragContainer.pkg"
+
+$pfile "elements/Scrollbar.pkg"
+$pfile "elements/ScrolledContainer.pkg"
+$pfile "elements/ScrollablePane.pkg"
+
+$pfile "elements/Slider.pkg"
+
+$pfile "elements/Spinner.pkg"
+
+$pfile "elements/ProgressBar.pkg"
+
+$pfile "elements/Editbox.pkg"
+$pfile "elements/MultiLineEditbox.pkg"
+
+$pfile "elements/ListboxItem.pkg"
+$pfile "elements/ListboxTextItem.pkg"
+
+$pfile "elements/Combobox.pkg"
+$pfile "elements/Listbox.pkg"
+$pfile "elements/ComboDropList.pkg"
+
+$pfile "elements/ListHeaderSegment.pkg"
+$pfile "elements/ListHeader.pkg"
+$pfile "elements/MultiColumnList.pkg"
+
+$pfile "elements/ItemEntry.pkg"
+$pfile "elements/ItemListBase.pkg"
+$pfile "elements/MenuBase.pkg"
+$pfile "elements/Menubar.pkg"
+$pfile "elements/PopupMenu.pkg"
+$pfile "elements/MenuItem.pkg"
+$pfile "elements/ScrolledItemListBase.pkg"
+$pfile "elements/ItemListbox.pkg"
+
+$pfile "elements/GroupBox.pkg"
+
+$pfile "falagard/Enums.pkg"
+$pfile "falagard/Dimension.pkg"
+$pfile "falagard/NamedArea.pkg"
+$pfile "falagard/PropertyDefinitionBase.pkg"
+$pfile "falagard/PropertyDefinition.pkg"
+$pfile "falagard/PropertyInitialiser.pkg"
+$pfile "falagard/PropertyLinkDefinition.pkg"
+$pfile "falagard/FalagardComponentBase.pkg"
+$pfile "falagard/FrameComponent.pkg"
+$pfile "falagard/ImageryComponent.pkg"
+$pfile "falagard/TextComponent.pkg"
+$pfile "falagard/ImagerySection.pkg"
+$pfile "falagard/SectionSpecification.pkg"
+$pfile "falagard/LayerSpecification.pkg"
+$pfile "falagard/StateImagery.pkg"
+$pfile "falagard/WidgetComponent.pkg"
+$pfile "falagard/WidgetLookFeel.pkg"
+$pfile "falagard/WidgetLookManager.pkg"
+
+$pfile "HelperFunctions.pkg"
+
+$pfile "OutStream.pkg"
+
+}
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/Logger.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/Logger.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/Logger.pkg	(revision 2664)
@@ -0,0 +1,26 @@
+/***********************************************************************
+	LoggingLevel
+***********************************************************************/
+enum LoggingLevel
+{
+	Errors,
+	Warnings,
+	Standard,
+	Informative,
+	Insane
+};
+
+
+
+/***********************************************************************
+	Logger
+***********************************************************************/
+class Logger
+{
+	static Logger& getSingleton();
+
+	void setLoggingLevel(LoggingLevel level);
+	LoggingLevel getLoggingLevel() const;
+
+	void logEvent(string message, LoggingLevel level=Standard);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/ScriptWindowHelper.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/ScriptWindowHelper.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/ScriptWindowHelper.pkg	(revision 2664)
@@ -0,0 +1,8 @@
+/***********************************************************************
+	ScriptWindowHelper
+***********************************************************************/
+class ScriptWindowHelper
+{
+	Window* getWindow(string name);
+	Window* getWindow();
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/WindowManager.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/WindowManager.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/WindowManager.pkg	(revision 2664)
@@ -0,0 +1,32 @@
+/***********************************************************************
+	WindowManager
+***********************************************************************/
+class WindowManager
+{
+	static WindowManager& getSingleton();
+
+	tolua_throws|CEGUI::AlreadyExistsException,nil| Window* createWindow(string type, string name="");
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| Window* loadWindowLayout(string filename, string name_prefix="", string resourcegroup="");
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| Window* loadWindowLayout(string filename, bool generateRandomPrefix);
+
+    void writeWindowLayoutToStream(string window, OutStream& out, bool writeParent=false) const;
+    void writeWindowLayoutToStream(const Window& window, OutStream& out, bool writeParent=false) const;
+
+	void destroyWindow(string name);
+	void destroyWindow(Window* window);
+	void destroyAllWindows();
+
+	tolua_throws|CEGUI::UnknownObjectException,nil| Window* getWindow(string name) const;
+	bool isWindowPresent(string name) const;
+
+	bool isDeadPoolEmpty() const;
+	void cleanDeadPool();
+
+    void renameWindow(Window* window, string  new_name);
+    void renameWindow(string window, string new_name);
+
+    WindowIterator getIterator() const;
+
+    static void setDefaultResourceGroup(string resourceGroup);
+    static string& getDefaultResourceGroup();
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/elements/GroupBox.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/elements/GroupBox.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/elements/GroupBox.pkg	(revision 2664)
@@ -0,0 +1,7 @@
+/***********************************************************************
+	GroupBox
+***********************************************************************/
+class GroupBox : public Window
+{
+	bool drawAroundWidget(string name);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/elements/MultiLineEditbox.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/elements/MultiLineEditbox.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/elements/MultiLineEditbox.pkg	(revision 2664)
@@ -0,0 +1,31 @@
+/***********************************************************************
+	MultiLineEditbox
+***********************************************************************/
+class MultiLineEditbox : public Window
+{
+	bool hasInputFocus() const;
+	bool isReadOnly() const;
+	unsigned long getCaratIndex() const;
+	unsigned long getSelectionStartIndex() const;
+	unsigned long getSelectionEndIndex() const;
+	unsigned long getSelectionLength() const;
+	unsigned long getMaxTextLength() const;
+	bool isWordWrapped() const;
+
+    Scrollbar* getVertScrollbar() const;
+    bool isVertScrollbarAlwaysShown() const;
+    Scrollbar* getHorzScrollbar() const;
+    Rect getTextRenderArea() const;
+    unsigned long getLineNumberFromIndex(unsigned long index) const;
+
+	void setReadOnly(bool setting);
+	void setCaratIndex(unsigned long carat_pos);
+	void setSelection(unsigned long start_pos, unsigned long end_pos);
+	void setMaxTextLength(unsigned long max_len);
+	void ensureCaratIsVisible();
+	void setWordWrapping(bool setting);
+    void setShowVertScrollbar(bool setting);
+
+    void setSelectionBrushImage(const Image* image);
+    const Image* getSelectionBrushImage() const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/elements/Tree.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/elements/Tree.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/elements/Tree.pkg	(revision 2664)
@@ -0,0 +1,33 @@
+/***********************************************************************
+	Tree
+***********************************************************************/
+class Tree : public Window
+{
+	size_t	getItemCount(void) const;
+	size_t	getSelectedCount(void) const;
+	
+	TreeItem*	getFirstSelectedItem(void) const;
+	TreeItem*	getLastSelectedItem(void) const;
+	
+	bool	isSortEnabled(void) const;
+	bool	isMultiselectEnabled(void) const;
+	bool	isItemTooltipsEnabled(void) const;
+	
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| TreeItem*	findFirstItemWithText(string text);
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| TreeItem*	findNextItemWithText(string text, const TreeItem* start_item);
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| TreeItem*	findFirstItemWithID(unsigned int searchID);
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| TreeItem*	findNextItemWithID(unsigned int searchID, const TreeItem* start_item);
+	
+	bool	isTreeItemInList(const TreeItem* item) const;
+	void	resetList(void);
+	void	addItem(TreeItem* item);
+	
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| void	insertItem(TreeItem* item, const TreeItem* position);
+	void	removeItem(const TreeItem* item);
+	void	clearAllSelections(void);
+	void	setSortingEnabled(bool setting);
+	void	setMultiselectEnabled(bool setting);
+	void	setItemSelectState(TreeItem* item, bool state);
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| void	setItemSelectState(size_t item_index, bool state);
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| void	ensureItemIsVisible(const TreeItem* item);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/elements/TreeItem.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/elements/TreeItem.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.0/package/elements/TreeItem.pkg	(revision 2664)
@@ -0,0 +1,33 @@
+/***********************************************************************
+	TreeItem
+***********************************************************************/
+class TreeItem
+{
+	ColourRect  getTextColours(void) const;
+	void  setTextColours(ColourRect& cols);
+	void  setTextColours(colour top_left_colour, colour top_right_colour, colour bottom_left_colour, colour bottom_right_colour);
+	void  setTextColours(colour col);
+	string getText(void) const;
+	string getTooltipText(void) const;
+	unsigned int  getID(void) const;
+	void* getUserData(void) const;
+	bool  isSelected(void) const;
+	bool  isDisabled(void) const;
+	bool  isAutoDeleted(void) const;
+	Window*  getOwnerWindow(void);
+	ColourRect  getSelectionColours(void) const;
+	void  setText(string text);
+	void  setTooltipText(string text);
+	void  setUserData(void* item_data);
+	void  setSelected(bool setting);
+	void  setDisabled(bool setting);
+	void  setAutoDeleted(bool setting);
+	void  setSelectionColours(ColourRect& cols);
+	void  setSelectionColours(colour top_left_colour, colour top_right_colour, colour bottom_left_colour, colour bottom_right_colour);
+	void  setSelectionColours(colour col);
+	bool  getIsOpen();
+	void toggleIsOpen();
+	size_t getItemCount();
+	void addItem(TreeItem* item);
+	void setIcon(Image& icon);		
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/CMakeLists.txt	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/CMakeLists.txt	(revision 2664)
@@ -0,0 +1,5 @@
+SET(_package_files
+  Window.pkg
+
+  PARENT_SCOPE
+)
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILua.cpp
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILua.cpp	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILua.cpp	(revision 2664)
@@ -0,0 +1,337 @@
+/***********************************************************************
+	filename: CEGUILua.cpp
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+
+	purpose:  Implementation for LuaScriptModule class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "CEGUIConfig.h"
+#include "CEGUIPropertyHelper.h"
+#include "CEGUILua.h"
+#include "CEGUILuaFunctor.h"
+#include <vector>
+
+// include Lua libs and tolua++
+extern "C" {
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+}
+
+#include "tolua/tolua++.h"
+
+// prototype for bindings initialisation function
+int tolua_CEGUI_open(lua_State* tolua_S);
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+	Constructor (creates Lua state)
+*************************************************************************/
+LuaScriptModule::LuaScriptModule()
+{
+    #if LUA_VERSION_NUM >= 501
+        static const luaL_Reg lualibs[] = {
+            {"", luaopen_base},
+            {LUA_LOADLIBNAME, luaopen_package},
+            {LUA_TABLIBNAME, luaopen_table},
+            {LUA_IOLIBNAME, luaopen_io},
+            {LUA_OSLIBNAME, luaopen_os},
+            {LUA_STRLIBNAME, luaopen_string},
+            {LUA_MATHLIBNAME, luaopen_math},
+        #if defined(DEBUG) || defined (_DEBUG)
+                {LUA_DBLIBNAME, luaopen_debug},
+        #endif
+            {0, 0}
+        };
+    #endif /* LUA_VERSION_NUM >= 501 */
+
+    // create a lua state
+    d_ownsState = true;
+    d_state = lua_open();
+
+    // init all standard libraries
+    #if LUA_VERSION_NUM >= 501
+            const luaL_Reg *lib = lualibs;
+            for (; lib->func; lib++)
+            {
+                lua_pushcfunction(d_state, lib->func);
+                lua_pushstring(d_state, lib->name);
+                lua_call(d_state, 1, 0);
+            }
+    #else /* LUA_VERSION_NUM >= 501 */
+        luaopen_base(d_state);
+        luaopen_io(d_state);
+        luaopen_string(d_state);
+        luaopen_table(d_state);
+        luaopen_math(d_state);
+        #if defined(DEBUG) || defined (_DEBUG)
+            luaopen_debug(d_state);
+        #endif
+    #endif /* LUA_VERSION_NUM >= 501 */
+
+    setModuleIdentifierString();
+}
+
+
+/*************************************************************************
+	Constructor (uses given Lua state)
+*************************************************************************/
+LuaScriptModule::LuaScriptModule(lua_State* state)
+{
+	// just use the given state
+	d_ownsState = false;
+	d_state = state;
+
+	setModuleIdentifierString();
+}
+
+
+/*************************************************************************
+	Destructor
+*************************************************************************/
+LuaScriptModule::~LuaScriptModule()
+{
+	if ( d_ownsState && d_state )
+	{
+		lua_close( d_state );
+	}
+}
+
+
+/*************************************************************************
+	Execute script file
+*************************************************************************/
+void LuaScriptModule::executeScriptFile(const String& filename, const String& resourceGroup)
+{
+	// load file
+	RawDataContainer raw;
+	System::getSingleton().getResourceProvider()->loadRawDataContainer(filename,
+        raw, resourceGroup.empty() ? d_defaultResourceGroup : resourceGroup);
+
+	// load code into lua
+	int top = lua_gettop(d_state);
+	int loaderr = luaL_loadbuffer(d_state, (char*)raw.getDataPtr(), raw.getSize(), filename.c_str());
+	System::getSingleton().getResourceProvider()->unloadRawDataContainer( raw );
+	if (loaderr)
+	{
+	    String errMsg = lua_tostring(d_state,-1);
+		lua_settop(d_state,top);
+		throw ScriptException("Unable to execute Lua script file: '"+filename+"'\n\n"+errMsg+"\n");
+	}
+
+    // call it
+	if (lua_pcall(d_state,0,0,0))
+	{
+	    String errMsg = lua_tostring(d_state,-1);
+		lua_settop(d_state,top);
+		throw ScriptException("Unable to execute Lua script file: '"+filename+"'\n\n"+errMsg+"\n");
+	}
+
+	lua_settop(d_state,top); // just in case :P
+}
+
+
+/*************************************************************************
+	Execute global script function
+*************************************************************************/
+int	LuaScriptModule::executeScriptGlobal(const String& function_name)
+{
+    int top = lua_gettop(d_state);
+
+    // get the function from lua
+    lua_getglobal(d_state, function_name.c_str());
+
+    // is it a function
+    if (!lua_isfunction(d_state,-1))
+    {
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to get Lua global: '"+function_name+"' as name not represent a global Lua function" );
+    }
+
+    // call it
+    int error = lua_pcall(d_state,0,1,0);
+
+    // handle errors
+    if (error)
+    {
+        String errMsg = lua_tostring(d_state,-1);
+        lua_pop(d_state,1);
+        throw ScriptException("Unable to evaluate Lua global: '"+function_name+"\n\n"+errMsg+"\n");
+    }
+
+    // get return value
+    if (!lua_isnumber(d_state,-1))
+    {
+        // log that return value is invalid. return -1 and move on.
+        lua_settop(d_state,top);
+        ScriptException("Unable to get Lua global : '"+function_name+"' return value as it's not a number" );
+        return -1;
+    }
+
+    int ret = (int)lua_tonumber(d_state,-1);
+    lua_pop(d_state,1);
+
+    // return it
+    return ret;
+}
+
+
+/*************************************************************************
+	Execute scripted event handler
+*************************************************************************/
+bool LuaScriptModule::executeScriptedEventHandler(const String& handler_name, const EventArgs& e)
+{
+
+	LuaFunctor::pushNamedFunction(d_state, handler_name);
+
+	ScriptWindowHelper* helper = 0;
+	//If this is an event that was triggered by a window then make a "this" pointer to the window for the script.
+	if(e.d_hasWindow)
+	{
+		WindowEventArgs& we = (WindowEventArgs&)e;
+		helper = new ScriptWindowHelper(we.window);
+		lua_pushlightuserdata(d_state,(void*)helper);
+		lua_setglobal(d_state,"this");
+	} // if(e.d_hasWindow)
+
+    // push EventArgs as the first parameter
+    tolua_pushusertype(d_state,(void*)&e,"const CEGUI::EventArgs");
+
+    // call it
+    int error = lua_pcall(d_state,1,0,0);
+
+    // handle errors
+    if (error)
+    {
+        String errStr(lua_tostring(d_state,-1));
+        lua_pop(d_state,1);
+		//cleanup the helper object if any
+		if(helper)
+		{
+			delete helper;
+			helper = 0;
+		}
+        throw ScriptException("Unable to evaluate the Lua event handler: '"+handler_name+"'\n\n"+errStr+"\n");
+    } // if (error)
+
+	if(helper)
+	{
+		delete helper;
+		helper = 0;
+	}
+
+    return true;
+}
+
+
+/*************************************************************************
+	Execute script code string
+*************************************************************************/
+void LuaScriptModule::executeString(const String& str)
+{
+    int top = lua_gettop(d_state);
+
+    // load code into lua and call it
+    int error =	luaL_loadbuffer(d_state, str.c_str(), str.length(), str.c_str()) || lua_pcall(d_state,0,0,0);
+
+    // handle errors
+    if (error)
+    {
+        String errMsg = lua_tostring(d_state,-1);
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to execute Lua script string: '"+str+"'\n\n"+errMsg+"\n");
+    }
+}
+
+
+/*************************************************************************
+	Create Lua bindings
+*************************************************************************/
+void LuaScriptModule::createBindings(void)
+{
+	CEGUI::Logger::getSingleton().logEvent( "---- Creating Lua bindings ----" );
+	// init CEGUI module
+	tolua_CEGUI_open(d_state);
+}
+
+
+/*************************************************************************
+	Destroy Lua bindings
+*************************************************************************/
+void LuaScriptModule::destroyBindings(void)
+{
+	CEGUI::Logger::getSingleton().logEvent( "---- Destroying Lua bindings ----" );
+	// is this ok ?
+	lua_pushnil(d_state);
+	lua_setglobal(d_state,"CEGUI");
+}
+
+
+/*************************************************************************
+	Set the ID string for the module
+*************************************************************************/
+void LuaScriptModule::setModuleIdentifierString()
+{
+    // set ID string
+    d_identifierString = "CEGUI::LuaScriptModule - Official Lua based scripting module for CEGUI";
+	d_language = "Lua";
+}
+
+
+/*************************************************************************
+	Subscribe to a scripted event handler
+*************************************************************************/
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target, const String& event_name, const String& subscriber_name)
+{
+    // do the real subscription
+    LuaFunctor functor(d_state,subscriber_name,LUA_NOREF);
+    Event::Connection con = target->subscribeEvent(event_name, Event::Subscriber(functor));
+    // make sure we don't release the reference we just made when this call returns
+    functor.index = LUA_NOREF;
+
+    // return the event connection
+    return con;
+}
+
+
+/*************************************************************************
+	Subscribe to a scripted event handler
+*************************************************************************/
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target, const String& event_name, Event::Group group, const String& subscriber_name)
+{
+    // do the real subscription
+    LuaFunctor functor(d_state,subscriber_name,LUA_NOREF);
+    Event::Connection con = target->subscribeEvent(event_name, group, Event::Subscriber(functor));
+
+    // return the event connection
+    return con;
+}
+
+} // namespace CEGUI
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILua.h
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILua.h	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILua.h	(revision 2664)
@@ -0,0 +1,253 @@
+/***********************************************************************
+	filename: CEGUILua.h
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+	
+	purpose:  Defines interface for LuaScriptModule class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#ifndef _CEGUILua_h_
+#define _CEGUILua_h_
+
+
+/*************************************************************************
+	Import / Export control macros
+*************************************************************************/
+#if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
+#   ifdef CEGUILUA_EXPORTS
+#       define CEGUILUA_API __declspec(dllexport)
+#   else
+#       if defined( __MINGW32__ )
+#           define CEGUILUA_API
+#       else
+#           define CEGUILUA_API __declspec(dllimport)
+#       endif
+#   endif
+#else
+#   define CEGUILUA_API
+#endif
+
+
+#include "CEGUIScriptModule.h"
+
+struct lua_State;
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Interface for the LuaScriptModule class
+*/
+class CEGUILUA_API LuaScriptModule : public CEGUI::ScriptModule
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for LuaScriptModule class which create a lua_State
+	*/
+	LuaScriptModule();
+
+
+	/*!
+	\brief
+		Constructor for LuaScriptModule class which takes a lua_State
+
+	\param state
+		Pointer to the lua_State that the script module should attach to.
+	*/
+	LuaScriptModule(lua_State* state);
+
+
+	/*!
+	\brief
+		Destructor for LuaScriptModule class.
+	*/
+	~LuaScriptModule();
+
+
+	/*************************************************************************
+		Script Execution Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Execute a script file.
+
+	\param filename
+		String object holding the filename of the script file that is to be executed
+		
+	\param resourceGroup
+		Resource group idendifier to be passed to the ResourceProvider when loading the script file.
+	*/
+	void executeScriptFile(const String& filename, const String& resourceGroup);
+
+
+	/*!
+	\brief
+		Execute a scripted global function.  The function should not take any parameters and should return an integer.
+
+	\param function_name
+		String object holding the name of the function, in the global script environment, that
+		is to be executed.
+
+	\return
+		The integer value returned from the script function.
+	*/
+	int executeScriptGlobal(const String& function_name);
+
+
+    /*!
+    \brief
+        Execute a scripted global 'event handler' function by looking it up by name.
+
+    \param handler_name
+        String object holding the name of the scripted handler function.
+        If this string contains dots '.' it will be parsed as tables containing a function field.
+        For example: 'mytable.subtable.func'
+
+    \param e
+        EventArgs based object that should be passed, by any appropriate means, to the scripted function.
+
+    \return
+        - true if the event was handled.
+        - false if the event was not handled.
+    */
+    bool executeScriptedEventHandler(const String& handler_name, const EventArgs& e);
+
+
+    /*!
+    \brief
+        Execute script code contained in the given CEGUI::String object.
+
+    \param str
+        String object holding the valid script code that should be executed.
+
+    \return
+        Nothing.
+    */
+    void executeString(const String& str);
+
+    /*************************************************************************
+        Event subscription
+    *************************************************************************/
+    /*!
+    \brief
+            Subscribes the named Event to a scripted funtion
+
+    \param target
+            The target EventSet for the subscription.
+
+    \param name
+            String object containing the name of the Event to subscribe to.
+
+    \param subscriber_name
+            String object containing the name of the script funtion that is to be subscribed to the Event.
+
+    \return
+            Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.
+
+    \exception UnknownObjectException	Thrown if an Event named \a name is not in the EventSet
+    */
+    Event::Connection	subscribeEvent(EventSet* target, const String& name, const String& subscriber_name);
+
+    /*!
+    \brief
+            Subscribes the specified group of the named Event to a scripted funtion.
+
+    \param target
+            The target EventSet for the subscription.
+
+    \param name
+            String object containing the name of the Event to subscribe to.
+
+    \param group
+            Group which is to be subscribed to.  Subscription groups are called in ascending order.
+
+    \param subscriber_name
+            String object containing the name of the script funtion that is to be subscribed to the Event.
+
+    \return
+            Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.
+
+    \exception UnknownObjectException	Thrown if an Event named \a name is not in the EventSet
+    */
+    Event::Connection	subscribeEvent(EventSet* target, const String& name, Event::Group group, const String& subscriber_name);
+
+    /*************************************************************************
+        Bindings creation / destruction
+    *************************************************************************/
+    /*!
+    \brief
+        Method called during system initialisation, prior to running any scripts via the ScriptModule, to enable the ScriptModule
+        to perform any operations required to complete initialisation or binding of the script language to the gui system objects.
+
+    \return
+        Nothing.
+    */
+    void createBindings(void);
+
+
+    /*!
+    \brief
+        Method called during system destruction, after all scripts have been run via the ScriptModule, to enable the ScriptModule
+        to perform any operations required to cleanup bindings of the script language to the gui system objects, as set-up in the
+        earlier createBindings call.
+
+    \return
+        Nothing.
+    */
+    void destroyBindings(void);
+
+    /*************************************************************************
+        Accessor type functions
+    *************************************************************************/
+    /*!
+    \brief
+        Method used to get a pointer to the lua_State that the script module is attached to.
+
+    \return
+        A pointer to the lua_State that the script module is attached to.
+    */
+    lua_State* getLuaState(void) const {return d_state;}
+
+private:
+    /*************************************************************************
+        Implementation Functions
+    *************************************************************************/
+    void setModuleIdentifierString();
+
+    /*************************************************************************
+        Implementation Data
+    *************************************************************************/
+    bool d_ownsState;      //!< true when the attached lua_State was created by this script module
+    lua_State* d_state;    //!< The lua_State that this script module uses.
+};
+
+} // namespace CEGUI
+
+#endif // end of guard _CEGUILua_h_
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILuaFunctor.cpp
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILuaFunctor.cpp	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILuaFunctor.cpp	(revision 2664)
@@ -0,0 +1,280 @@
+/***********************************************************************
+    filename: CEGUILuaFunctor.cpp
+    created:  Thu Jan 26 2006
+    author:   Tomas Lindquist Olsen <tomas@famolsen.dk>
+
+    purpose:  Implementation for LuaFunctor class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUILuaFunctor.h"
+#include "CEGUILogger.h"
+#include "CEGUIExceptions.h"
+#include "CEGUIPropertyHelper.h"
+
+// include Lua libs and tolua++
+extern "C" {
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+}
+
+#include "tolua/tolua++.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(lua_State* state, int func, int selfIndex) :
+    L(state),
+    index(func),
+    self(selfIndex),
+    needs_lookup(false)
+{
+}
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(lua_State* state, const String& func, int selfIndex) :
+    L(state),
+    index(LUA_NOREF),
+    self(selfIndex),
+    needs_lookup(true),
+    function_name(func)
+{
+}
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(const LuaFunctor& cp) :
+    L(cp.L),
+    index(cp.index),
+    self(cp.self),
+    needs_lookup(cp.needs_lookup),
+    function_name(cp.function_name)
+{
+}
+
+/*************************************************************************
+    Destructor
+*************************************************************************/
+LuaFunctor::~LuaFunctor()
+{
+    if (self!=LUA_NOREF)
+    {
+        luaL_unref(L, LUA_REGISTRYINDEX, self);
+    }
+    if (index!=LUA_NOREF)
+    {
+        luaL_unref(L, LUA_REGISTRYINDEX, index);
+    }
+}
+
+/*************************************************************************
+    Call operator
+*************************************************************************/
+bool LuaFunctor::operator()(const EventArgs& args) const
+{
+    // is this a late binding?
+    if (needs_lookup)
+    {
+        pushNamedFunction(L, function_name);
+        // reference function
+        index = luaL_ref(L, LUA_REGISTRYINDEX);
+        needs_lookup = false;
+        CEGUI_LOGINSANE("Late binding of callback '"+function_name+"' performed");
+        function_name.clear();
+    } // if (needs_lookup)
+
+	ScriptWindowHelper* helper = 0;
+	//Set a global for this window
+	if(args.d_hasWindow)
+	{
+		WindowEventArgs& we = (WindowEventArgs&)args;
+		helper = new ScriptWindowHelper(we.window);
+		tolua_pushusertype(L,(void*)helper,"CEGUI::ScriptWindowHelper");
+		lua_setglobal(L,"this");
+	}
+
+    // retrieve function
+    lua_rawgeti(L, LUA_REGISTRYINDEX, index);
+
+    // possibly self as well?
+    int nargs = 1;
+    if (self != LUA_NOREF)
+    {
+        lua_rawgeti(L, LUA_REGISTRYINDEX, self);
+        ++nargs;
+    }
+
+    // push EventArgs  parameter
+    tolua_pushusertype(L, (void*)&args, "const CEGUI::EventArgs");
+
+    // call it
+    int error = lua_pcall(L, nargs, 0, 0);
+
+    // handle errors
+    if (error)
+    {
+        String errStr(lua_tostring(L, -1));
+        lua_pop(L, 1);
+		if(helper)
+		{
+			delete helper;
+			helper = 0;
+		}
+        throw ScriptException("Unable to call Lua event handler:\n\n"+errStr+"\n");
+    } // if (error)
+
+	if(helper)
+	{
+		delete helper;
+		helper = 0;
+	}
+
+    return true;
+}
+
+/*************************************************************************
+    do event subscription by reference instead of by name
+*************************************************************************/
+Event::Connection LuaFunctor::SubscribeEvent(EventSet* self, const String& event_name, int funcIndex, int selfIndex, lua_State* L)
+{
+    // should we pass a self to the callback?
+    int thisIndex = LUA_NOREF;
+    if (selfIndex != LUA_NOREF)
+    {
+        // reference self
+        thisIndex = luaL_ref(L, LUA_REGISTRYINDEX);
+    }
+
+    // do the real subscription
+    int type = lua_type(L,-1);
+    Event::Connection con;
+    if (type == LUA_TFUNCTION)
+    {
+        // reference function
+        int index = luaL_ref(L, LUA_REGISTRYINDEX);
+        LuaFunctor functor(L,index,thisIndex);
+        con = self->subscribeEvent(String(event_name), Event::Subscriber(functor));
+        // make sure we don't release the reference(s) we just made when this call returns
+        functor.index = LUA_NOREF;
+        functor.self = LUA_NOREF;
+    }
+    else if (type == LUA_TSTRING)
+    {
+        const char* str = lua_tostring(L, -1);
+        LuaFunctor functor(L,String(str),thisIndex);
+        con = self->subscribeEvent(String(event_name), Event::Subscriber(functor));
+        // make sure we don't release the reference we just (maybe) made when this call returns
+        functor.self = LUA_NOREF;
+    }
+    else
+    {
+        luaL_error(L,"bad function passed to subscribe function. must be a real function, or a string for late binding");
+    }
+
+    // return the event connection
+    return con;
+}
+
+/*************************************************************************
+    Pushes a named function on the stack
+*************************************************************************/
+void LuaFunctor::pushNamedFunction(lua_State* L, const String& handler_name)
+{
+    int top = lua_gettop(L);
+
+    // do we have any dots in the handler name? if so we grab the function as a table field
+    String::size_type i = handler_name.find_first_of((utf32)'.');
+    if (i!=String::npos)
+    {
+        // split the rest of the string up in parts seperated by '.'
+        // TODO: count the dots and size the vector accordingly from the beginning.
+        std::vector<String> parts;
+        String::size_type start = 0;
+        do
+        {
+            parts.push_back(handler_name.substr(start,i-start));
+            start = i+1;
+            i = handler_name.find_first_of((utf32)'.',start);
+        } while(i!=String::npos);
+
+        // add last part
+        parts.push_back(handler_name.substr(start));
+
+        // first part is the global
+        lua_getglobal(L, parts[0].c_str());
+        if (!lua_istable(L,-1))
+        {
+            lua_settop(L,top);
+            throw ScriptException("Unable to get the Lua event handler: '"+handler_name+"' as first part is not a table");
+        }
+
+        // if there is more than two parts, we have more tables to go through
+        std::vector<String>::size_type visz = parts.size();
+        if (visz-- > 2) // avoid subtracting one later on
+        {
+            // go through all the remaining parts to (hopefully) have a valid Lua function in the end
+            std::vector<String>::size_type vi = 1;
+            while (vi<visz)
+            {
+                // push key, and get the next table
+                lua_pushstring(L,parts[vi].c_str());
+                lua_gettable(L,-2);
+                if (!lua_istable(L,-1))
+                {
+                    lua_settop(L,top);
+                    throw ScriptException("Unable to get the Lua event handler: '"+handler_name+"' as part #"+PropertyHelper::uintToString(uint(vi+1))+" ("+parts[vi]+") is not a table");
+                }
+                // get rid of the last table and move on
+                lua_remove(L,-2);
+                vi++;
+            }
+        }
+
+        // now we are ready to get the function to call ... phew :)
+        lua_pushstring(L,parts[visz].c_str());
+        lua_gettable(L,-2);
+        lua_remove(L,-2); // get rid of the table
+    }
+    // just a regular global function
+    else
+    {
+        lua_getglobal(L, handler_name.c_str());
+    }
+
+    // is it a function
+    if (!lua_isfunction(L,-1))
+    {
+        lua_settop(L,top);
+        throw ScriptException("The Lua event handler: '"+handler_name+"' does not represent a Lua function");
+    }
+}
+
+} // namespace CEGUI
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILuaFunctor.h
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILuaFunctor.h	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/CEGUILuaFunctor.h	(revision 2664)
@@ -0,0 +1,86 @@
+/***********************************************************************
+    filename: CEGUILuaFunctor.h
+    created:  Thu Jan 26 2006
+    author:   Tomas Lindquist Olsen <tomas@famolsen.dk>
+
+    purpose:  Defines interface for LuaFunctor class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#ifndef _CEGUILuaFunctor_h_
+#define _CEGUILuaFunctor_h_
+
+#include "CEGUIEventSet.h"
+#include "CEGUIScriptWindowHelper.h"
+
+struct lua_State;
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// forward declaration
+class LuaScriptModule;
+
+/*!
+\brief
+    Functor class used for subscribing Lua functions to CEGUI events
+*/
+class LuaFunctor
+{
+public:
+    LuaFunctor(lua_State* state, int func, int selfIndex);
+    LuaFunctor(lua_State* state, const String& func, int selfIndex);
+    LuaFunctor(const LuaFunctor& cp);
+    ~LuaFunctor();
+
+    bool operator()(const EventArgs& args) const;
+
+    /*!
+    \brief
+        function used to subscribe any Lua function as event handler.
+        References using the Lua registry.
+        To be called from Lua only.
+    */
+    static Event::Connection SubscribeEvent(EventSet* self, const String& eventName, int funcIndex, int selfIndex, lua_State* L);
+
+    /*!
+    \brief
+        Pushes the Lua function named \param name on top of the Lua stack.
+        The name may contain '.' (dots) character for (nested) table values.
+    */
+    static void pushNamedFunction(lua_State* L, const String& name);
+
+private:
+    lua_State* L;
+    mutable int index;
+    int self;
+    mutable bool needs_lookup;
+    mutable String function_name;
+
+    friend class LuaScriptModule;
+};
+
+} // namespace CEGUI
+
+#endif // end of guard _CEGUILuaFunctor_h_
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/changes_orxonox.diff
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/changes_orxonox.diff	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/changes_orxonox.diff	(revision 2664)
@@ -0,0 +1,92 @@
+--- CEGUILua.h	Mi Jul  9 18:24:49 2008
++++ CEGUILua.h	Do Jan 29 10:18:14 2009
+@@ -38,7 +38,11 @@
+ #   ifdef CEGUILUA_EXPORTS
+ #       define CEGUILUA_API __declspec(dllexport)
+ #   else
+-#       define CEGUILUA_API __declspec(dllimport)
++#       if defined( __MINGW32__ )
++#           define CEGUILUA_API
++#       else
++#           define CEGUILUA_API __declspec(dllimport)
++#       endif
+ #   endif
+ #else
+ #   define CEGUILUA_API
+--- CEGUILuaFunctor.cpp	Mi Jul  9 18:25:01 2008
++++ CEGUILuaFunctor.cpp	Do Jan 29 10:26:27 2009
+@@ -39,7 +39,7 @@
+ #include "lauxlib.h"
+ }
+ 
+-#include "tolua++.h"
++#include "tolua/tolua++.h"
+ 
+ // Start of CEGUI namespace section
+ namespace CEGUI
+--- CEGUILua.cpp	Mi Jul  9 18:25:01 2008
++++ CEGUILua.cpp	Do Jan 29 10:24:53 2009
+@@ -27,10 +27,6 @@
+  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+  *   OTHER DEALINGS IN THE SOFTWARE.
+  ***************************************************************************/
+-#ifdef HAVE_CONFIG_H
+-#   include "config.h"
+-#endif
+-
+ #include "CEGUI.h"
+ #include "CEGUIConfig.h"
+ #include "CEGUIPropertyHelper.h"
+@@ -45,7 +41,7 @@
+ #include "lauxlib.h"
+ }
+ 
+-#include "tolua++.h"
++#include "tolua/tolua++.h"
+ 
+ // prototype for bindings initialisation function
+ int tolua_CEGUI_open(lua_State* tolua_S);
+@@ -60,7 +56,7 @@
+ *************************************************************************/
+ LuaScriptModule::LuaScriptModule()
+ {
+-    #if CEGUI_LUA_VER >= 51
++    #if LUA_VERSION_NUM >= 501
+         static const luaL_Reg lualibs[] = {
+             {"", luaopen_base},
+             {LUA_LOADLIBNAME, luaopen_package},
+@@ -74,14 +70,14 @@
+         #endif
+             {0, 0}
+         };
+-    #endif /* CEGUI_LUA_VER >= 51 */
++    #endif /* LUA_VERSION_NUM >= 501 */
+ 
+     // create a lua state
+     d_ownsState = true;
+     d_state = lua_open();
+ 
+     // init all standard libraries
+-    #if CEGUI_LUA_VER >= 51
++    #if LUA_VERSION_NUM >= 501
+             const luaL_Reg *lib = lualibs;
+             for (; lib->func; lib++)
+             {
+@@ -89,7 +85,7 @@
+                 lua_pushstring(d_state, lib->name);
+                 lua_call(d_state, 1, 0);
+             }
+-    #else /* CEGUI_LUA_VER >= 51 */
++    #else /* LUA_VERSION_NUM >= 501 */
+         luaopen_base(d_state);
+         luaopen_io(d_state);
+         luaopen_string(d_state);
+@@ -98,7 +94,7 @@
+         #if defined(DEBUG) || defined (_DEBUG)
+             luaopen_debug(d_state);
+         #endif
+-    #endif /* CEGUI_LUA_VER >= 51 */
++    #endif /* LUA_VERSION_NUM >= 501 */
+ 
+     setModuleIdentifierString();
+ }
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/required.cpp
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/required.cpp	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/required.cpp	(revision 2664)
@@ -0,0 +1,88 @@
+/***********************************************************************
+	filename: required.cpp
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+	
+	purpose:  Implementation of helper functions
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "required.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+	Functions for getting Thumb range pairs as two return values
+*************************************************************************/
+
+// returns horizontal range as two values for lua
+void ceguiLua_Thumb_getHorzRange(Thumb* wnd, float* min, float* max)
+{
+	std::pair<float,float> range_pair = wnd->getHorzRange();
+	*min = range_pair.first;
+	*max = range_pair.second;
+}
+
+
+// returns vertical range as two values for lua
+void ceguiLua_Thumb_getVertRange(Thumb* wnd, float* min, float* max)
+{
+	std::pair<float,float> range_pair = wnd->getVertRange();
+	*min = range_pair.first;
+	*max = range_pair.second;
+}
+
+
+/*************************************************************************
+	Functions for creating list box items
+*************************************************************************/
+
+// allocates and returns a new ListboxTextItem
+ListboxTextItem* ceguiLua_createListboxTextItem(const String& text, uint item_id, void* item_data, bool disabled, bool auto_delete)
+{
+	return new ListboxTextItem(text,item_id,item_data,disabled,auto_delete);
+}
+
+
+/************************************************************************
+    OutStream
+*************************************************************************/
+void ceguiLua_FileStream_open(FileStream* os, const char* filename)
+{
+    os->open(filename, std::ios::binary);
+}
+
+
+/************************************************************************
+    CEGUI::System::getSystemKeys alternative
+*************************************************************************/
+bool ceguiLua_System_isSystemKeyDown(const System* sys, SystemKey k)
+{
+    return (k & sys->getSystemKeys()) != 0;
+}
+
+
+} // namespace CEGUI
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/required.h
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/required.h	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/ceguilua/required.h	(revision 2664)
@@ -0,0 +1,113 @@
+/***********************************************************************
+	filename: required.h
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+
+	purpose:  Header that includes the necessary stuff needed for the Lua bindings
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "CEGUILua.h"
+#include "CEGUILuaFunctor.h"
+#include <fstream>
+
+#define __operator_increment    operator++
+#define __operator_decrement    operator--
+#define __operator_dereference  operator*
+
+#define LuaFunctorSubscribeEvent CEGUI::LuaFunctor::SubscribeEvent
+
+//This is used to keep compilers happy
+#define CEGUIDeadException(e) &
+
+#if defined(_MSC_VER) && !defined(snprintf)
+#   define snprintf   _snprintf
+#endif
+
+typedef CEGUI::String string;
+
+namespace CEGUI
+{
+
+typedef Event::Connection EventConnection;
+
+/*************************************************************************
+	Functions for getting Thumb range pairs as two return values
+*************************************************************************/
+void ceguiLua_Thumb_getHorzRange(Thumb* wnd, float* min, float* max);
+void ceguiLua_Thumb_getVertRange(Thumb* wnd, float* min, float* max);
+
+
+/*************************************************************************
+	Functions for creating list box items
+*************************************************************************/
+ListboxTextItem* ceguiLua_createListboxTextItem(const String& text, uint item_id, void* item_data, bool disabled, bool auto_delete);
+
+
+/************************************************************************
+    Stuff needed to make the iterators work
+*************************************************************************/
+typedef PropertySet::Iterator PropertyIterator;
+typedef EventSet::Iterator EventIterator;
+typedef WindowManager::WindowIterator WindowIterator;
+typedef WindowFactoryManager::WindowFactoryIterator WindowFactoryIterator;
+typedef WindowFactoryManager::FalagardMappingIterator FalagardMappingIterator;
+typedef WindowFactoryManager::FalagardWindowMapping FalagardWindowMapping;
+typedef ImagesetManager::ImagesetIterator ImagesetIterator;
+typedef Imageset::ImageIterator ImageIterator;
+typedef SchemeManager::SchemeIterator SchemeIterator;
+typedef FontManager::FontIterator FontIterator;
+
+template <typename T>
+inline PropertyIterator ceguiLua_getPropertyIterator(const T* self)
+{
+    return static_cast<const PropertySet*>(self)->getIterator();
+}
+
+template <typename T>
+inline EventIterator ceguiLua_getEventIterator(const T* self)
+{
+    return static_cast<const EventSet*>(self)->getIterator();
+}
+
+
+/************************************************************************
+    OutStream
+*************************************************************************/
+typedef std::ofstream FileStream;
+void ceguiLua_FileStream_open(FileStream*, const char* filename);
+
+
+/************************************************************************
+    CEGUI::System::getSystemKeys alternative
+*************************************************************************/
+bool ceguiLua_System_isSystemKeyDown(const System* sys, SystemKey k);
+
+}
+
+// the binding file generates alot of
+// warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
+#if defined(_MSC_VER)
+#   pragma warning(disable : 4800)
+#endif
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/package/Window.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/package/Window.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.1/package/Window.pkg	(revision 2664)
@@ -0,0 +1,249 @@
+/****************************************
+	Vertical alignment modes
+*****************************************/
+enum VerticalAlignment
+{
+	VA_TOP,
+	VA_CENTRE,
+	VA_BOTTOM
+};
+
+
+/****************************************
+	Horizontal alignment modes
+*****************************************/
+enum HorizontalAlignment
+{
+	HA_LEFT,
+	HA_CENTRE,
+	HA_RIGHT
+};
+
+
+/****************************************
+	Window
+*****************************************/
+class Window //: public EventSet
+{
+	string getType() const;
+	string getName() const;
+
+	bool isDestroyedByParent() const;
+	bool isAlwaysOnTop() const;
+	bool isDisabled(bool localOnly=false) const;
+	bool isVisible(bool localOnly=false) const;
+	bool isActive() const;
+	bool isClippedByParent() const;
+
+	void setDestroyedByParent(bool setting);
+	void setAlwaysOnTop(bool setting);
+	void setEnabled(bool setting);
+	void enable();
+	void disable();
+	void setVisible(bool setting);
+	void show();
+	void hide();
+	void activate();
+	void deactivate();
+
+	void setClippedByParent(bool setting);
+
+	unsigned int getID() const;
+	void setID(unsigned int ID);
+
+	unsigned int getChildCount() const;
+
+	bool isChild(unsigned int ID) const;
+	bool isChild(string name) const;
+	bool isChild(const Window* window) const;
+	bool isChildRecursive(unsigned int ID) const;
+
+	void addChildWindow(string name);
+	void addChildWindow(Window* window);
+
+	void removeChildWindow(unsigned int ID);
+	void removeChildWindow(string name);
+	void removeChildWindow(Window* window);
+
+	tolua_throws|CEGUI::UnknownObjectException,nil| Window* getChild(unsigned int ID) const;
+	tolua_throws|CEGUI::UnknownObjectException,nil| Window* getChild(string name) const;
+	Window* getChildAtIdx(unsigned int ID) const;
+	Window* getActiveChild() const;
+	Window* getChildAtPosition(const Vector2& pos) const;
+    Window* getTargetChildAtPosition(const Vector2& pos) const;
+    Window* getChildRecursive(unsigned int ID) const;
+
+	Window* getParent() const;
+
+	bool isAncestor(unsigned int ID) const;
+	bool isAncestor(string name) const;
+	bool isAncestor(const Window* window) const;
+
+	void setFont(string name);
+	void setFont(Font* font);
+	Font* getFont() const;
+
+	void setText(string text);
+    void insertText(string text, unsigned long position);
+    void appendText(string text);
+	string getText() const;
+
+	bool inheritsAlpha() const;
+	float getAlpha() const;
+	float getEffectiveAlpha() const;
+	void setAlpha(float a);
+	void setInheritsAlpha(bool setting);
+
+	void requestRedraw() const;
+
+	bool isZOrderingEnabled() const;
+	void setZOrderingEnabled(bool setting);
+
+	Rect getPixelRect() const;
+	Rect getInnerRect() const;
+	Rect getUnclippedPixelRect() const;
+	Rect getUnclippedInnerRect() const;
+
+    Size getParentPixelSize(void) const;
+    float getParentPixelWidth(void) const;
+    float getParentPixelHeight(void) const;
+
+	static Window* getCaptureWindow();
+	void setRestoreCapture(bool setting);
+	bool restoresOldCapture() const;
+
+	bool distributesCapturedInputs() const;
+	void setDistributesCapturedInputs(bool setting);
+
+	bool captureInput();
+	void releaseInput();
+
+	bool isCapturedByThis() const;
+	bool isCapturedByAncestor() const;
+	bool isCapturedByChild() const;
+
+	bool isHit(const Vector2& pos) const;
+
+	bool isRiseOnClickEnabled() const;
+	void setRiseOnClickEnabled(bool setting);
+
+	const Image* getMouseCursor() const;
+	void setMouseCursor(MouseCursorImage cursor);
+	void setMouseCursor(const Image* image);
+	void setMouseCursor(string imageset, string image);
+
+	void moveToFront();
+	void moveToBack();
+
+	bool wantsMultiClickEvents() const;
+	bool isMouseAutoRepeatEnabled() const;
+	float getAutoRepeatDelay() const;
+	float getAutoRepeatRate() const;
+	void setWantsMultiClickEvents(bool setting);
+	void setMouseAutoRepeatEnabled(bool setting);
+	void setAutoRepeatDelay(float delay);
+	void setAutoRepeatRate(float rate);
+
+	//void destroy();
+
+	bool isUsingDefaultTooltip() const;
+	Tooltip* getTooltip() const;
+	string getTooltipType() const;
+	string getTooltipText() const;
+	bool inheritsTooltipText() const;
+
+	void setTooltip(Tooltip* tooltip);
+	void setTooltipType(string tooltipType);
+	void setTooltipText(string tip);
+	void setInheritsTooltipText(bool setting);
+
+	bool testClassName(string class_name) const;
+
+	void notifyDragDropItemEnters(DragContainer* item);
+	void notifyDragDropItemLeaves(DragContainer* item);
+	void notifyDragDropItemDropped(DragContainer* item);
+
+	VerticalAlignment getVerticalAlignment() const;
+	HorizontalAlignment getHorizontalAlignment() const;
+
+    // these actually have a const, but tolua++ chokes on that
+    void setVerticalAlignment(VerticalAlignment alignment);
+    void setHorizontalAlignment(HorizontalAlignment alignment);
+
+	string getLookNFeel() const;
+    tolua_throws|CEGUI::Exception,error| void setLookNFeel(string lnf);
+
+    tolua_throws|CEGUI::Exception,error| void setWindowRenderer(string name);
+    string getWindowRendererName() const;
+
+	//RenderCache& getRenderCache()
+
+	bool getModalState() const;
+	void setModalState(bool state);
+
+    tolua_throws|CEGUI::UnknownObjectException,nil| string getUserString(string name) const;
+    bool isUserStringDefined(string name) const;
+    void setUserString(string name, string value);
+
+    void beginInitialisation();
+    void endInitialisation();
+
+	// unified stuff
+	void setArea(const UDim& xpos, const UDim& ypos, const UDim& width, const UDim& height);
+	void setArea(const UVector2& pos, const UVector2& size);
+	void setArea(const URect& area);
+	void setPosition(const UVector2& pos);
+	void setXPosition(const UDim& x);
+	void setYPosition(const UDim& y);
+	void setSize(const UVector2& size);
+	void setWidth(const UDim& width);
+	void setHeight(const UDim& height);
+	void setMaxSize(const UVector2& size);
+	void setMinSize(const UVector2& size);
+
+	const URect& getArea() const;
+	const UVector2& getPosition() const;
+	const UDim& getXPosition() const;
+	const UDim& getYPosition() const;
+	UVector2 getSize() const;
+	UDim getWidth() const;
+	UDim getHeight() const;
+	const UVector2& getMaxSize() const;
+	const UVector2& getMinSize() const;
+
+    // event pass through
+    bool isMousePassThroughEnabled() const;
+    void setMousePassThroughEnabled(bool setting);
+    
+    tolua_throws|CEGUI::Exception,error| void rename(string new_name);
+
+	//////////////////////////////////////////////
+	// PropertySet
+	void setProperty(string name, string value);
+	string getProperty(string name) const;
+	string getPropertyDefault(string name) const;
+	string getPropertyHelp(string name) const;
+
+	bool isPropertyPresent(string name) const;
+	bool isPropertyDefault(string name) const;
+
+    tolua_outside PropertyIterator ceguiLua_getPropertyIterator @ getPropertyIterator() const;
+
+	//////////////////////////////////////////////
+	// EventSet
+	void addEvent(string name);
+	void removeEvent(string name);
+	void removeAllEvents();
+	bool isEventPresent(string name);
+
+	tolua_throws|CEGUI::UnknownObjectException,error| tolua_outside EventConnection LuaFunctorSubscribeEvent @ subscribeEvent(string name, lua_Object funcIndex, lua_Object selfIndex=LUA_NOREF, lua_State*);
+
+	tolua_throws|CEGUI::UnknownObjectException,error| EventConnection subscribeScriptedEvent @ subscribeEvent(string name, string callback_name);
+	
+	void fireEvent(string name, EventArgs& args, string eventnamespace="");
+
+	bool isMuted() const;
+	void setMutedState(bool setting);
+
+    tolua_outside EventIterator ceguiLua_getEventIterator @ getEventIterator() const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/CMakeLists.txt	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/CMakeLists.txt	(revision 2664)
@@ -0,0 +1,9 @@
+SET(_package_files
+  EventSet.pkg
+  HelperFunctions.pkg
+  InputEvent.pkg
+  Window.pkg
+  WindowManager.pkg
+
+  PARENT_SCOPE
+)
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILua.cpp
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILua.cpp	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILua.cpp	(revision 2664)
@@ -0,0 +1,709 @@
+/***********************************************************************
+	filename: CEGUILua.cpp
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+
+	purpose:  Implementation for LuaScriptModule class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2008 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "CEGUIConfig.h"
+#include "CEGUIPropertyHelper.h"
+#include "CEGUILua.h"
+#include "CEGUILuaFunctor.h"
+#include <vector>
+
+// include Lua libs and tolua++
+extern "C" {
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+}
+
+#include "tolua/tolua++.h"
+
+// prototype for bindings initialisation function
+int tolua_CEGUI_open(lua_State* tolua_S);
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+	Constructor (creates Lua state)
+*************************************************************************/
+LuaScriptModule::LuaScriptModule() :
+    d_errFuncIndex(LUA_NOREF)
+{
+    #if LUA_VERSION_NUM >= 501
+        static const luaL_Reg lualibs[] = {
+            {"", luaopen_base},
+            {LUA_LOADLIBNAME, luaopen_package},
+            {LUA_TABLIBNAME, luaopen_table},
+            {LUA_IOLIBNAME, luaopen_io},
+            {LUA_OSLIBNAME, luaopen_os},
+            {LUA_STRLIBNAME, luaopen_string},
+            {LUA_MATHLIBNAME, luaopen_math},
+        #if defined(DEBUG) || defined (_DEBUG)
+                {LUA_DBLIBNAME, luaopen_debug},
+        #endif
+            {0, 0}
+        };
+    #endif /* LUA_VERSION_NUM >= 501 */
+
+    // create a lua state
+    d_ownsState = true;
+    d_state = lua_open();
+
+    // init all standard libraries
+    #if LUA_VERSION_NUM >= 501
+            const luaL_Reg *lib = lualibs;
+            for (; lib->func; lib++)
+            {
+                lua_pushcfunction(d_state, lib->func);
+                lua_pushstring(d_state, lib->name);
+                lua_call(d_state, 1, 0);
+            }
+    #else /* LUA_VERSION_NUM >= 501 */
+        luaopen_base(d_state);
+        luaopen_io(d_state);
+        luaopen_string(d_state);
+        luaopen_table(d_state);
+        luaopen_math(d_state);
+        #if defined(DEBUG) || defined (_DEBUG)
+            luaopen_debug(d_state);
+        #endif
+    #endif /* LUA_VERSION_NUM >= 501 */
+
+    setModuleIdentifierString();
+}
+
+
+/*************************************************************************
+	Constructor (uses given Lua state)
+*************************************************************************/
+LuaScriptModule::LuaScriptModule(lua_State* state)
+{
+	// just use the given state
+	d_ownsState = false;
+	d_state = state;
+
+	setModuleIdentifierString();
+}
+
+
+/*************************************************************************
+	Destructor
+*************************************************************************/
+LuaScriptModule::~LuaScriptModule()
+{
+    if (d_state)
+    {
+        unrefErrorFunc();
+
+        if (d_ownsState)
+            lua_close( d_state );
+    }
+}
+
+
+/*************************************************************************
+	Execute script file
+*************************************************************************/
+void LuaScriptModule::executeScriptFile(const String& filename,
+    const String& resourceGroup)
+{
+    int top = lua_gettop(d_state);
+
+    executeScriptFile_impl(filename, resourceGroup,
+                           initErrorHandlerFunc(),
+                           top);
+
+    cleanupErrorHandlerFunc();
+}
+
+
+/*************************************************************************
+	Execute global script function
+*************************************************************************/
+int	LuaScriptModule::executeScriptGlobal(const String& function_name)
+{
+    int top = lua_gettop(d_state);
+    int r = executeScriptGlobal_impl(function_name, initErrorHandlerFunc(), top);
+    cleanupErrorHandlerFunc();
+
+    return r;
+}
+
+
+/*************************************************************************
+	Execute scripted event handler
+*************************************************************************/
+bool LuaScriptModule::executeScriptedEventHandler(const String& handler_name,
+    const EventArgs& e)
+{
+    int top = lua_gettop(d_state);
+    bool r = executeScriptedEventHandler_impl(handler_name, e,
+                                              initErrorHandlerFunc(), top);
+    cleanupErrorHandlerFunc();
+
+    return r;
+}
+
+
+/*************************************************************************
+	Execute script code string
+*************************************************************************/
+void LuaScriptModule::executeString(const String& str)
+{
+    int top = lua_gettop(d_state);
+
+    executeString_impl(str, initErrorHandlerFunc(), top);
+    cleanupErrorHandlerFunc();
+}
+
+
+/*************************************************************************
+	Create Lua bindings
+*************************************************************************/
+void LuaScriptModule::createBindings(void)
+{
+	CEGUI::Logger::getSingleton().logEvent( "---- Creating Lua bindings ----" );
+	// init CEGUI module
+	tolua_CEGUI_open(d_state);
+}
+
+
+/*************************************************************************
+	Destroy Lua bindings
+*************************************************************************/
+void LuaScriptModule::destroyBindings(void)
+{
+	CEGUI::Logger::getSingleton().logEvent( "---- Destroying Lua bindings ----" );
+	// is this ok ?
+	lua_pushnil(d_state);
+	lua_setglobal(d_state,"CEGUI");
+}
+
+
+/*************************************************************************
+	Set the ID string for the module
+*************************************************************************/
+void LuaScriptModule::setModuleIdentifierString()
+{
+    // set ID string
+    d_identifierString = "CEGUI::LuaScriptModule - Official Lua based scripting module for CEGUI";
+	d_language = "Lua";
+}
+
+
+/*************************************************************************
+	Subscribe to a scripted event handler
+*************************************************************************/
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target,
+    const String& event_name, const String& subscriber_name)
+{
+    const String& err_str = getActivePCallErrorHandlerString();
+    const int err_ref     = getActivePCallErrorHandlerReference();
+
+    // do the real subscription
+    LuaFunctor functor((err_ref == LUA_NOREF) ?
+                LuaFunctor(d_state, subscriber_name, LUA_NOREF, err_str) :
+                LuaFunctor(d_state, subscriber_name, LUA_NOREF, err_ref));
+    Event::Connection con =
+        target->subscribeEvent(event_name, Event::Subscriber(functor));
+
+    // make sure we don't release the reference we just made when 'functor' is
+    // destroyed as it goes out of scope.
+    functor.index = LUA_NOREF;
+    functor.d_errFuncIndex = LUA_NOREF;
+
+    // return the event connection
+    return con;
+}
+
+
+/*************************************************************************
+	Subscribe to a scripted event handler
+*************************************************************************/
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target,
+    const String& event_name, Event::Group group, const String& subscriber_name)
+{
+    const String& err_str = getActivePCallErrorHandlerString();
+    const int err_ref     = getActivePCallErrorHandlerReference();
+
+    // do the real subscription
+    LuaFunctor functor((err_ref == LUA_NOREF) ?
+                LuaFunctor(d_state, subscriber_name, LUA_NOREF, err_str) :
+                LuaFunctor(d_state, subscriber_name, LUA_NOREF, err_ref));
+    Event::Connection con =
+        target->subscribeEvent(event_name, group, Event::Subscriber(functor));
+
+    // make sure we don't release the reference we just made when 'functor' is
+    // destroyed as it goes out of scope.
+    functor.index = LUA_NOREF;
+    functor.d_errFuncIndex = LUA_NOREF;
+
+    // return the event connection
+    return con;
+}
+
+//----------------------------------------------------------------------------//
+void LuaScriptModule::setDefaultPCallErrorHandler(
+    const String& error_handler_function)
+{
+    unrefErrorFunc();
+
+    d_errFuncName = error_handler_function;
+    d_errFuncIndex = LUA_NOREF;
+}
+
+//----------------------------------------------------------------------------//
+void LuaScriptModule::setDefaultPCallErrorHandler(int function_reference)
+{
+    unrefErrorFunc();
+
+    d_errFuncIndex = function_reference;
+    d_errFuncName.clear();
+}
+
+//----------------------------------------------------------------------------//
+const String& LuaScriptModule::getActivePCallErrorHandlerString() const
+{
+    if ((d_activeErrFuncIndex == LUA_NOREF) && d_activeErrFuncName.empty())
+        return d_errFuncName;
+    else
+        return d_activeErrFuncName;
+}
+
+//----------------------------------------------------------------------------//
+int LuaScriptModule::getActivePCallErrorHandlerReference() const
+{
+    if ((d_activeErrFuncIndex == LUA_NOREF) && d_activeErrFuncName.empty())
+        return d_errFuncIndex;
+    else
+        return d_activeErrFuncIndex;
+}
+
+//----------------------------------------------------------------------------//
+int LuaScriptModule::initErrorHandlerFunc()
+{
+    d_activeErrFuncName = d_errFuncName;
+
+    // should we create a registry reference for named function
+    if ((d_errFuncIndex == LUA_NOREF) && !d_errFuncName.empty())
+    {
+        int top = lua_gettop(d_state);
+
+        LuaFunctor::pushNamedFunction(d_state, d_errFuncName);
+        // reference function
+        d_errFuncIndex = luaL_ref(d_state, LUA_REGISTRYINDEX);
+
+        lua_settop(d_state, top);
+    }
+
+    // init handler via function index in registry
+    return initErrorHandlerFunc(d_errFuncIndex);
+}
+
+//----------------------------------------------------------------------------//
+int LuaScriptModule::initErrorHandlerFunc(const String func_name)
+{
+    d_activeErrFuncName = func_name;
+
+    // string has some text in it?
+    if (!func_name.empty())
+    {
+        LuaFunctor::pushNamedFunction(d_state, func_name);
+        return lua_gettop(d_state);
+    }
+
+    // use no error handler function.
+    return 0;
+}
+
+//----------------------------------------------------------------------------//
+int LuaScriptModule::initErrorHandlerFunc(int func)
+{
+    d_activeErrFuncIndex = func;
+
+    // check if we have a valid registry index for the error handler function
+    if (func != LUA_NOREF)
+    {
+        lua_rawgeti(d_state, LUA_REGISTRYINDEX, func);
+        return lua_gettop(d_state);
+    }
+
+    // use no error handler function.
+    return 0;
+}
+
+//----------------------------------------------------------------------------//
+void LuaScriptModule::cleanupErrorHandlerFunc()
+{
+    d_activeErrFuncIndex = LUA_NOREF;
+    d_activeErrFuncName.clear();
+}
+
+//----------------------------------------------------------------------------//
+void LuaScriptModule::unrefErrorFunc()
+{
+    if ((d_errFuncIndex != LUA_NOREF) && !d_errFuncName.empty())
+    {
+        luaL_unref(d_state, LUA_REGISTRYINDEX, d_errFuncIndex);
+        d_errFuncIndex = LUA_NOREF;
+    }
+}
+
+//----------------------------------------------------------------------------//
+void LuaScriptModule::executeScriptFile(const String& filename,
+    const String& resourceGroup, const String& error_handler)
+{
+    int top = lua_gettop(d_state);
+
+    executeScriptFile_impl(filename, resourceGroup,
+                           initErrorHandlerFunc(error_handler),
+                           top);
+    cleanupErrorHandlerFunc();
+}
+
+//----------------------------------------------------------------------------//
+void LuaScriptModule::executeScriptFile(const String& filename,
+    const String& resourceGroup, const int error_handler)
+{
+    int top = lua_gettop(d_state);
+
+    executeScriptFile_impl(filename, resourceGroup,
+                           initErrorHandlerFunc(error_handler),
+                           top);
+    cleanupErrorHandlerFunc();
+}
+
+//----------------------------------------------------------------------------//
+int LuaScriptModule::executeScriptGlobal(const String& function_name,
+    const String& error_handler)
+{
+    int top = lua_gettop(d_state);
+    int r = executeScriptGlobal_impl(function_name,
+                                     initErrorHandlerFunc(error_handler),
+                                     top);
+    cleanupErrorHandlerFunc();
+
+    return r;
+}
+
+//----------------------------------------------------------------------------//
+int LuaScriptModule::executeScriptGlobal(const String& function_name,
+    const int error_handler)
+{
+    int top = lua_gettop(d_state);
+    int r = executeScriptGlobal_impl(function_name,
+                                     initErrorHandlerFunc(error_handler),
+                                     top);
+    cleanupErrorHandlerFunc();
+
+    return r;
+}
+
+//----------------------------------------------------------------------------//
+bool LuaScriptModule::executeScriptedEventHandler(const String& handler_name,
+    const EventArgs& e, const String& error_handler)
+{
+    int top = lua_gettop(d_state);
+
+    bool r =executeScriptedEventHandler_impl(handler_name, e,
+                                             initErrorHandlerFunc(error_handler),
+                                             top);
+    cleanupErrorHandlerFunc();
+
+    return r;
+}
+
+//----------------------------------------------------------------------------//
+bool LuaScriptModule::executeScriptedEventHandler(const String& handler_name,
+    const EventArgs& e, const int error_handler)
+{
+    int top = lua_gettop(d_state);
+    bool r = executeScriptedEventHandler_impl(handler_name, e,
+                                              initErrorHandlerFunc(error_handler),
+                                              top);
+    cleanupErrorHandlerFunc();
+
+    return r;
+}
+
+//----------------------------------------------------------------------------//
+void LuaScriptModule::executeString(const String& str,
+    const String& error_handler)
+{
+    int top = lua_gettop(d_state);
+
+    executeString_impl(str, initErrorHandlerFunc(error_handler), top);
+    cleanupErrorHandlerFunc();
+}
+
+//----------------------------------------------------------------------------//
+void LuaScriptModule::executeString(const String& str, const int error_handler)
+{
+    int top = lua_gettop(d_state);
+
+    executeString_impl(str, initErrorHandlerFunc(error_handler), top);
+    cleanupErrorHandlerFunc();
+}
+
+//----------------------------------------------------------------------------//
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target,
+    const String& event_name, const String& subscriber_name,
+    const String& error_handler)
+{
+    // do the real subscription
+    LuaFunctor functor(d_state, subscriber_name, LUA_NOREF, error_handler);
+    Event::Connection con =
+        target->subscribeEvent(event_name, Event::Subscriber(functor));
+
+    // make sure we don't release the references we just made when 'functor' is
+    // destroyed as it goes out of scope.
+    functor.index = LUA_NOREF;
+    functor.d_errFuncIndex = LUA_NOREF;
+
+    // return the event connection
+    return con;
+}
+
+//----------------------------------------------------------------------------//
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target,
+    const String& event_name, const String& subscriber_name,
+    const int error_handler)
+{
+    // do the real subscription
+    LuaFunctor functor(d_state, subscriber_name, LUA_NOREF, error_handler);
+    Event::Connection con =
+        target->subscribeEvent(event_name, Event::Subscriber(functor));
+
+    // make sure we don't release the references we just made when 'functor' is
+    // destroyed as it goes out of scope.
+    functor.index = LUA_NOREF;
+    functor.d_errFuncIndex = LUA_NOREF;
+
+    // return the event connection
+    return con;
+}
+
+
+//----------------------------------------------------------------------------//
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target,
+    const String& event_name, Event::Group group, const String& subscriber_name,
+    const String& error_handler)
+{
+    // do the real subscription
+    LuaFunctor functor(d_state, subscriber_name, LUA_NOREF, error_handler);
+    Event::Connection con =
+        target->subscribeEvent(event_name, group, Event::Subscriber(functor));
+
+    // make sure we don't release the references we just made when 'functor' is
+    // destroyed as it goes out of scope.
+    functor.index = LUA_NOREF;
+    functor.d_errFuncIndex = LUA_NOREF;
+
+    // return the event connection
+    return con;
+}
+
+//----------------------------------------------------------------------------//
+Event::Connection LuaScriptModule::subscribeEvent(EventSet* target,
+    const String& event_name, Event::Group group, const String& subscriber_name,
+    const int error_handler)
+{
+    // do the real subscription
+    LuaFunctor functor(d_state, subscriber_name, LUA_NOREF, error_handler);
+    Event::Connection con =
+        target->subscribeEvent(event_name, group, Event::Subscriber(functor));
+
+    // make sure we don't release the references we just made when 'functor' is
+    // destroyed as it goes out of scope.
+    functor.index = LUA_NOREF;
+    functor.d_errFuncIndex = LUA_NOREF;
+
+    // return the event connection
+    return con;
+}
+
+//----------------------------------------------------------------------------//
+void LuaScriptModule::executeScriptFile_impl(const String& filename,
+    const String& resourceGroup, const int err_idx, const int top)
+{
+    // load file
+    RawDataContainer raw;
+    System::getSingleton().getResourceProvider()->loadRawDataContainer(filename,
+        raw, resourceGroup.empty() ? d_defaultResourceGroup : resourceGroup);
+
+    // load code into lua
+    int loaderr = luaL_loadbuffer(d_state,
+                                  reinterpret_cast<char*>(raw.getDataPtr()),
+                                  raw.getSize(), filename.c_str());
+
+    System::getSingleton().getResourceProvider()->unloadRawDataContainer( raw );
+
+    if (loaderr)
+    {
+        String errMsg = lua_tostring(d_state,-1);
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to execute Lua script file: '" +
+                              filename + "'\n\n" + errMsg + "\n");
+    }
+
+    // call it
+    if (lua_pcall(d_state, 0, 0, err_idx))
+    {
+        String errMsg = lua_tostring(d_state,-1);
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to execute Lua script file: '" +
+                              filename + "'\n\n" + errMsg + "\n");
+    }
+
+    lua_settop(d_state,top); // just in case :P
+}
+
+//----------------------------------------------------------------------------//
+int LuaScriptModule::executeScriptGlobal_impl(const String& function_name,
+    const int err_idx, const int top)
+{
+    // get the function from lua
+    lua_getglobal(d_state, function_name.c_str());
+
+    // is it a function
+    if (!lua_isfunction(d_state,-1))
+    {
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to get Lua global: '" + function_name +
+                              "' as name not represent a global Lua function" );
+    }
+
+    // call it
+    int error = lua_pcall(d_state, 0, 1, err_idx);
+
+    // handle errors
+    if (error)
+    {
+        String errMsg = lua_tostring(d_state,-1);
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to evaluate Lua global: '" + 
+                              function_name + "\n\n" + errMsg + "\n");
+    }
+
+    // get return value
+    if (!lua_isnumber(d_state,-1))
+    {
+        // log that return value is invalid. return -1 and move on.
+        lua_settop(d_state,top);
+        ScriptException("Unable to get Lua global : '" + function_name +
+                        "' return value as it's not a number");
+        return -1;
+    }
+
+    int ret = static_cast<int>(lua_tonumber(d_state,-1));
+    lua_settop(d_state,top);
+
+    // return it
+    return ret;
+}
+
+//----------------------------------------------------------------------------//
+bool LuaScriptModule::executeScriptedEventHandler_impl(
+    const String& handler_name, const EventArgs& e, const int err_idx,
+    const int top)
+{
+    LuaFunctor::pushNamedFunction(d_state, handler_name);
+
+    ScriptWindowHelper* helper = 0;
+    // If this is an event that was triggered by a window then make a "this"
+    // pointer to the window for the script.
+    if(e.d_hasWindow)
+    {
+        WindowEventArgs& we = (WindowEventArgs&)e;
+        helper = new ScriptWindowHelper(we.window);
+        lua_pushlightuserdata(d_state,(void*)helper);
+        lua_setglobal(d_state,"this");
+    }
+
+    // push EventArgs as the first parameter
+    tolua_pushusertype(d_state, (void*)&e, "const CEGUI::EventArgs");
+
+    // call it
+    int error = lua_pcall(d_state, 1, 1, err_idx);
+
+    // handle errors
+    if (error)
+    {
+        String errStr(lua_tostring(d_state,-1));
+        lua_settop(d_state,top);
+        //cleanup the helper object if any
+        if(helper)
+        {
+            delete helper;
+            helper = 0;
+        }
+
+        throw ScriptException("Unable to evaluate the Lua event handler: '" +
+                              handler_name + "'\n\n" + errStr + "\n");
+    }
+
+    // retrieve result
+    bool ret = lua_isboolean(d_state, -1) ? lua_toboolean(d_state, -1 ) : true;
+    lua_settop(d_state,top);
+
+    if(helper)
+    {
+        delete helper;
+        helper = 0;
+    }
+
+    return ret;
+}
+
+//----------------------------------------------------------------------------//
+void LuaScriptModule::executeString_impl(const String& str, const int err_idx,
+    const int top)
+{
+    // load code into lua and call it
+    int error = luaL_loadbuffer(d_state, str.c_str(), str.length(), str.c_str()) ||
+                lua_pcall(d_state, 0, 0, err_idx);
+
+    // handle errors
+    if (error)
+    {
+        String errMsg = lua_tostring(d_state,-1);
+        lua_settop(d_state,top);
+        throw ScriptException("Unable to execute Lua script string: '" +
+                              str + "'\n\n" + errMsg + "\n");
+    }
+
+    lua_settop(d_state,top);
+}
+
+//----------------------------------------------------------------------------//
+
+
+} // namespace CEGUI
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILua.h
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILua.h	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILua.h	(revision 2664)
@@ -0,0 +1,674 @@
+/***********************************************************************
+	filename: CEGUILua.h
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+	
+	purpose:  Defines interface for LuaScriptModule class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2008 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#ifndef _CEGUILua_h_
+#define _CEGUILua_h_
+
+
+/*************************************************************************
+	Import / Export control macros
+*************************************************************************/
+#if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(CEGUI_STATIC)
+#   ifdef CEGUILUA_EXPORTS
+#       define CEGUILUA_API __declspec(dllexport)
+#   else
+#       if defined( __MINGW32__ )
+#           define CEGUILUA_API
+#       else
+#           define CEGUILUA_API __declspec(dllimport)
+#       endif
+#   endif
+#else
+#   define CEGUILUA_API
+#endif
+
+
+#include "CEGUIScriptModule.h"
+
+struct lua_State;
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Interface for the LuaScriptModule class
+*/
+class CEGUILUA_API LuaScriptModule : public CEGUI::ScriptModule
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for LuaScriptModule class which create a lua_State
+	*/
+	LuaScriptModule();
+
+
+	/*!
+	\brief
+		Constructor for LuaScriptModule class which takes a lua_State
+
+	\param state
+		Pointer to the lua_State that the script module should attach to.
+	*/
+	LuaScriptModule(lua_State* state);
+
+
+	/*!
+	\brief
+		Destructor for LuaScriptModule class.
+	*/
+	~LuaScriptModule();
+
+
+	/*************************************************************************
+		Script Execution Functions
+	*************************************************************************/
+    /*!
+    \brief
+        Execute a script file.
+
+    \param filename
+        String object holding the filename of the script file that is to be
+        executed.
+
+    \param resourceGroup
+        Resource group idendifier to be passed to the ResourceProvider when
+        loading the script file.
+    */
+    void executeScriptFile(const String& filename, const String& resourceGroup);
+
+    /*!
+    \brief
+        Execute a script file.
+
+    \param filename
+        String object holding the filename of the script file that is to be
+        executed.
+
+    \param resourceGroup
+        Resource group idendifier to be passed to the ResourceProvider when
+        loading the script file.
+
+    \param error_handler
+        String containing the name of the script fuction that will be called
+        if an error occurs while executing the handler function.  NB: This is
+        the function passed as the error handler to lua_pcall.
+    */
+    void executeScriptFile(const String& filename,
+                           const String& resourceGroup,
+                           const String& error_handler);
+
+    /*!
+    \brief
+        Execute a script file.
+
+    \param filename
+        String object holding the filename of the script file that is to be
+        executed.
+
+    \param resourceGroup
+        Resource group idendifier to be passed to the ResourceProvider when
+        loading the script file.
+
+    \param error_handler
+        integer value describing a lua registry reference to the function that
+        will be called if an error occurs while executing the handler function.
+        NB: This is the function passed as the error handler to lua_pcall.
+    */
+    void executeScriptFile(const String& filename,
+                           const String& resourceGroup,
+                           const int error_handler);
+
+    /*!
+    \brief
+        Execute a scripted global function.  The function should not take any
+        parameters and should return an integer.
+
+    \param function_name
+        String object holding the name of the function, in the global script
+        environment, that is to be executed.
+
+    \return
+        The integer value returned from the script function.
+    */
+    int executeScriptGlobal(const String& function_name);
+
+    /*!
+    \brief
+        Execute a scripted global function.  The function should not take any
+        parameters and should return an integer.
+
+    \param function_name
+        String object holding the name of the function, in the global script
+        environment, that is to be executed.
+
+    \param error_handler
+        String containing the name of the script fuction that will be called
+        if an error occurs while executing the handler function.  NB: This is
+        the function passed as the error handler to lua_pcall.
+
+    \return
+        The integer value returned from the script function.
+    */
+    int executeScriptGlobal(const String& function_name,
+                            const String& error_handler);
+
+    /*!
+    \brief
+        Execute a scripted global function.  The function should not take any
+        parameters and should return an integer.
+
+    \param function_name
+        String object holding the name of the function, in the global script
+        environment, that is to be executed.
+
+    \param error_handler
+        integer value describing a lua registry reference to the function that
+        will be called if an error occurs while executing the handler function.
+        NB: This is the function passed as the error handler to lua_pcall.
+
+    \return
+        The integer value returned from the script function.
+    */
+    int executeScriptGlobal(const String& function_name,
+                            const int error_handler);
+
+
+    /*!
+    \brief
+        Execute a scripted global 'event handler' function by looking it up by
+        name.
+
+    \param handler_name
+        String object holding the name of the scripted handler function.
+        If this string contains dots '.' it will be parsed as tables containing
+        a function field.  For example: 'mytable.subtable.func'
+
+    \param e
+        EventArgs based object that should be passed, by any appropriate means,
+        to the scripted function.
+
+    \return
+        - true if the event was handled.
+        - false if the event was not handled.
+    */
+    bool executeScriptedEventHandler(const String& handler_name,
+                                     const EventArgs& e);
+
+    /*!
+    \brief
+        Execute a scripted global 'event handler' function by looking it up by
+        name.
+
+    \param handler_name
+        String object holding the name of the scripted handler function.
+        If this string contains dots '.' it will be parsed as tables containing
+        a function field.  For example: 'mytable.subtable.func'
+
+    \param e
+        EventArgs based object that should be passed, by any appropriate means,
+        to the scripted function.
+
+    \param error_handler
+        String containing the name of the script fuction that will be called
+        if an error occurs while executing the handler function.  NB: This is
+        the function passed as the error handler to lua_pcall.
+
+    \return
+        - true if the event was handled.
+        - false if the event was not handled.
+    */
+    bool executeScriptedEventHandler(const String& handler_name,
+                                     const EventArgs& e,
+                                     const String& error_handler);
+
+    /*!
+    \brief
+        Execute a scripted global 'event handler' function by looking it up by
+        name.
+
+    \param handler_name
+        String object holding the name of the scripted handler function.
+        If this string contains dots '.' it will be parsed as tables containing
+        a function field.  For example: 'mytable.subtable.func'
+
+    \param e
+        EventArgs based object that should be passed, by any appropriate means,
+        to the scripted function.
+
+    \param error_handler
+        integer value describing a lua registry reference to the function that
+        will be called if an error occurs while executing the handler function.
+        NB: This is the function passed as the error handler to lua_pcall.
+
+    \return
+        - true if the event was handled.
+        - false if the event was not handled.
+    */
+    bool executeScriptedEventHandler(const String& handler_name,
+                                     const EventArgs& e,
+                                     const int error_handler);
+
+    /*!
+    \brief
+        Execute script code contained in the given CEGUI::String object.
+
+    \param str
+        String object holding the valid script code that should be executed.
+
+    \return
+        Nothing.
+    */
+    void executeString(const String& str);
+
+    /*!
+    \brief
+        Execute script code contained in the given CEGUI::String object.
+
+    \param str
+        String object holding the valid script code that should be executed.
+
+    \param error_handler
+        String containing the name of the script fuction that will be called
+        if an error occurs while executing the handler function.  NB: This is
+        the function passed as the error handler to lua_pcall.
+
+    \return
+        Nothing.
+    */
+    void executeString(const String& str, const String& error_handler);
+
+    /*!
+    \brief
+        Execute script code contained in the given CEGUI::String object.
+
+    \param str
+        String object holding the valid script code that should be executed.
+
+    \param error_handler
+        integer value describing a lua registry reference to the function that
+        will be called if an error occurs while executing the handler function.
+        NB: This is the function passed as the error handler to lua_pcall.
+
+    \return
+        Nothing.
+    */
+    void executeString(const String& str, const int error_handler);
+
+    /*************************************************************************
+        Event subscription
+    *************************************************************************/
+    /*!
+    \brief
+        Subscribes the named Event to a scripted funtion
+
+    \param target
+        The target EventSet for the subscription.
+
+    \param name
+        String object containing the name of the Event to subscribe to.
+
+    \param subscriber_name
+        String object containing the name of the script funtion that is to be
+        subscribed to the Event.
+
+    \return
+        Connection object that can be used to check the status of the Event
+        connection and to disconnect (unsubscribe) from the Event.
+    */
+    Event::Connection subscribeEvent(EventSet* target, const String& name,
+                                     const String& subscriber_name);
+
+    /*!
+    \brief
+        Subscribes the named Event to a scripted funtion
+
+    \param target
+        The target EventSet for the subscription.
+
+    \param name
+        String object containing the name of the Event to subscribe to.
+
+    \param subscriber_name
+        String object containing the name of the script funtion that is to be
+        subscribed to the Event.
+
+    \param error_handler
+        String containing the name of the script fuction that will be called
+        if an error occurs while executing the handler function.  NB: This is
+        the function passed as the error handler to lua_pcall.
+
+    \return
+        Connection object that can be used to check the status of the Event
+        connection and to disconnect (unsubscribe) from the Event.
+    */
+    Event::Connection subscribeEvent(EventSet* target, const String& name,
+                                     const String& subscriber_name,
+                                     const String& error_handler);
+
+    /*!
+    \brief
+        Subscribes the named Event to a scripted funtion
+
+    \param target
+        The target EventSet for the subscription.
+
+    \param name
+        String object containing the name of the Event to subscribe to.
+
+    \param subscriber_name
+        String object containing the name of the script funtion that is to be
+        subscribed to the Event.
+
+    \param error_handler
+        integer value describing a lua registry reference to the function that
+        will be called if an error occurs while executing the handler function.
+        NB: This is the function passed as the error handler to lua_pcall.
+
+    \return
+        Connection object that can be used to check the status of the Event
+        connection and to disconnect (unsubscribe) from the Event.
+    */
+    Event::Connection subscribeEvent(EventSet* target, const String& name,
+                                     const String& subscriber_name,
+                                     const int error_handler);
+
+    /*!
+    \brief
+        Subscribes the specified group of the named Event to a scripted funtion.
+
+    \param target
+        The target EventSet for the subscription.
+
+    \param name
+        String object containing the name of the Event to subscribe to.
+
+    \param group
+        Group which is to be subscribed to.  Subscription groups are called in
+        ascending order.
+
+    \param subscriber_name
+        String object containing the name of the script funtion that is to be
+        subscribed to the Event.
+
+    \return
+        Connection object that can be used to check the status of the Event
+        connection and to disconnect (unsubscribe) from the Event.
+    */
+    Event::Connection	subscribeEvent(EventSet* target, const String& name,
+                                       Event::Group group,
+                                       const String& subscriber_name);
+
+    /*!
+    \brief
+        Subscribes the specified group of the named Event to a scripted funtion.
+
+    \param target
+        The target EventSet for the subscription.
+
+    \param name
+        String object containing the name of the Event to subscribe to.
+
+    \param group
+        Group which is to be subscribed to.  Subscription groups are called in
+        ascending order.
+
+    \param subscriber_name
+        String object containing the name of the script funtion that is to be
+        subscribed to the Event.
+
+    \param error_handler
+        String containing the name of the script fuction that will be called
+        if an error occurs while executing the handler function.  NB: This is
+        the function passed as the error handler to lua_pcall.
+
+    \return
+        Connection object that can be used to check the status of the Event
+        connection and to disconnect (unsubscribe) from the Event.
+    */
+    Event::Connection subscribeEvent(EventSet* target, const String& name,
+                                     Event::Group group,
+                                     const String& subscriber_name,
+                                     const String& error_handler);
+
+    /*!
+    \brief
+        Subscribes the specified group of the named Event to a scripted funtion.
+
+    \param target
+        The target EventSet for the subscription.
+
+    \param name
+        String object containing the name of the Event to subscribe to.
+
+    \param group
+        Group which is to be subscribed to.  Subscription groups are called in
+        ascending order.
+
+    \param subscriber_name
+        String object containing the name of the script funtion that is to be
+        subscribed to the Event.
+
+    \param error_handler
+        integer value describing a lua registry reference to the function that
+        will be called if an error occurs while executing the handler function.
+        NB: This is the function passed as the error handler to lua_pcall.
+
+    \return
+        Connection object that can be used to check the status of the Event
+        connection and to disconnect (unsubscribe) from the Event.
+    */
+    Event::Connection subscribeEvent(EventSet* target, const String& name,
+                                     Event::Group group,
+                                     const String& subscriber_name,
+                                     const int error_handler);
+
+    /*************************************************************************
+        Bindings creation / destruction
+    *************************************************************************/
+    /*!
+    \brief
+        Method called during system initialisation, prior to running any scripts
+        via the ScriptModule, to enable the ScriptModule to perform any
+        operations required to complete initialisation or binding of the script
+        language to the gui system objects.
+
+    \return
+        Nothing.
+    */
+    void createBindings(void);
+
+    /*!
+    \brief
+        Method called during system destruction, after all scripts have been run
+        via the ScriptModule, to enable the ScriptModule to perform any
+        operations required to cleanup bindings of the script language to the
+        gui system objects, as set-up in the earlier createBindings call.
+
+    \return
+        Nothing.
+    */
+    void destroyBindings(void);
+
+    /*************************************************************************
+        Accessor type functions
+    *************************************************************************/
+    /*!
+    \brief
+        Method used to get a pointer to the lua_State that the script module is
+        attached to.
+
+    \return
+        A pointer to the lua_State that the script module is attached to.
+    */
+    lua_State* getLuaState(void) const {return d_state;}
+
+    /*************************************************************************
+        Lua error handler related functions
+    *************************************************************************/
+    /*!
+    \brief
+        Set the name of the lua function that will be passed as the error
+        handler in calls to lua_pcall, unless an alternative is specified
+        in some other function call.
+
+    \param error_handler_function
+        Name of the lua function to be called.  This is looked up / bound on
+        first usage.
+    */
+    void setDefaultPCallErrorHandler(const String& error_handler_function);
+
+    /*!
+    \brief
+        Set the function that will be passed as the error handler in calls to
+        lua_pcall, unless an alternative is specified in some other function
+        call.
+
+    \param function_reference
+        Lua function registry index of the function to be called.
+    */
+    void setDefaultPCallErrorHandler(int function_reference);
+
+    /*!
+    \brief
+        Return the function name string of the active error handler function.
+
+        The 'active' error handler for the LuaScriptModule is either the
+        default as specified by calling setDefaultPCallErrorHandler, or
+        whatever might have been set up by a call to the internal
+        initErrorHandlerFunc function.
+
+    \note
+        This function is really intended for use internally by other parts of
+        the lua scripting support.  Although it could be useful elsewhere for
+        advanced uses, so long as you're careful!
+    */
+    const String& getActivePCallErrorHandlerString() const;
+
+    /*!
+    \brief
+        return the lua registry index of the active error handler function.
+
+        The 'active' error handler for the LuaScriptModule is either the
+        default as specified by calling setDefaultPCallErrorHandler, or
+        whatever might have been set up by a call to the internal
+        initErrorHandlerFunc function.
+        \par This may return a value previously set by the user, or the value as
+        bound internally by the script module for an error handler specified by
+        function name.
+
+    \note
+        This function is really intended for use internally by other parts of
+        the lua scripting support.  Although it could be useful elsewhere for
+        advanced uses, so long as you're careful!
+
+    \warning
+        You should never call luaL_unref on the value returned by this function
+        unless you created tge reference in the first place, and even then only
+        after having called setDefaultPCallErrorHandler passing LUA_NOREF.
+    */
+    int getActivePCallErrorHandlerReference() const;
+
+private:
+    /*************************************************************************
+        Implementation Functions
+    *************************************************************************/
+    void setModuleIdentifierString();
+    /** Init the error handler function.  Return the lua stack index that
+     *  should be passed to lua_pcall.  NB: This should be called prior to
+     *  pushing any function parameters onto the lua stack.
+     */
+    int initErrorHandlerFunc();
+    /** Init the error handler function.  Return the lua stack index that
+     *  should be passed to lua_pcall.  NB: This should be called prior to
+     *  pushing any function parameters onto the lua stack.
+     */
+    int initErrorHandlerFunc(const String func_name);
+    /** Init the error handler function.  Return the lua stack index that
+     *  should be passed to lua_pcall.  NB: This should be called prior to
+     *  pushing any function parameters onto the lua stack.
+     */
+    int initErrorHandlerFunc(int func);
+
+    /** do any needed cleanup after having called initErrorHandlerFunc and
+     * (possible) executed a script.
+     *
+     * NB: This probably does less than you think ;)
+     */
+    void cleanupErrorHandlerFunc();
+
+    //! release any reference we might have made to an error handling function.
+    void unrefErrorFunc();
+
+    //! Implementation function that executes a scipt file.
+    void executeScriptFile_impl(const String& filename,
+                                const String& resourceGroup,
+                                const int err_idx, const int top);
+
+    //! Implementation function that executes a global script function.
+    int executeScriptGlobal_impl(const String& function_name,
+                                 const int err_idx, const int top);
+
+    //! Implementation function that executes a scripted event handler.
+    bool executeScriptedEventHandler_impl(const String& handler_name,
+                                          const EventArgs& e,
+                                          const int err_idx, const int top);
+
+    //! Implementation function that executes script contained in a String.
+    void executeString_impl(const String& str, const int err_idx, const int top);
+
+    /*************************************************************************
+        Implementation Data
+    *************************************************************************/
+    //! true when the attached lua_State was created by this script module
+    bool d_ownsState;
+    //! The lua_State that this script module uses.
+    lua_State* d_state;
+    //! Default error handler function to pass to lua_pcall.
+    String d_errFuncName;
+    //! Default registry index of the function to pass to lua_pcall.
+    int d_errFuncIndex;
+    /** Error handler function that is currently in use (as setup via a call
+        to initErrorHandlerFunc)
+    */
+    String d_activeErrFuncName;
+    /** Registry index of the function that is currently in use (as setup via a
+        call to initErrorHandlerFunc)
+    */
+    int d_activeErrFuncIndex;
+};
+
+} // namespace CEGUI
+
+#endif // end of guard _CEGUILua_h_
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILuaFunctor.cpp
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILuaFunctor.cpp	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILuaFunctor.cpp	(revision 2664)
@@ -0,0 +1,426 @@
+/***********************************************************************
+    filename: CEGUILuaFunctor.cpp
+    created:  Thu Jan 26 2006
+    author:   Tomas Lindquist Olsen <tomas@famolsen.dk>
+
+    purpose:  Implementation for LuaFunctor class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2008 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUILuaFunctor.h"
+#include "CEGUILogger.h"
+#include "CEGUIExceptions.h"
+#include "CEGUIPropertyHelper.h"
+#include "CEGUILua.h"
+
+// include Lua libs and tolua++
+extern "C" {
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
+}
+
+#include "tolua/tolua++.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(lua_State* state, int func, int selfIndex) :
+    L(state),
+    index(func),
+    self(selfIndex),
+    needs_lookup(false),
+    d_ourErrFuncIndex(false)
+{
+    // TODO: This would perhaps be better done another way, to avoid the
+    // TODO: interdependence.
+    LuaScriptModule* sm =
+        static_cast<LuaScriptModule*>(System::getSingleton().getScriptingModule());
+
+    if (sm)
+    {
+        d_errFuncName  = sm->getActivePCallErrorHandlerString();
+        d_errFuncIndex = sm->getActivePCallErrorHandlerReference();
+    }
+}
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(lua_State* state, const String& func, int selfIndex) :
+    L(state),
+    index(LUA_NOREF),
+    self(selfIndex),
+    needs_lookup(true),
+    function_name(func),
+    d_ourErrFuncIndex(false)
+{
+    // TODO: This would perhaps be better done another way, to avoid the
+    // TODO: interdependence.
+    LuaScriptModule* sm =
+        static_cast<LuaScriptModule*>(System::getSingleton().getScriptingModule());
+
+    if (sm)
+    {
+        d_errFuncName  = sm->getActivePCallErrorHandlerString();
+        d_errFuncIndex = sm->getActivePCallErrorHandlerReference();
+    }
+}
+
+/*************************************************************************
+    Constructor
+*************************************************************************/
+LuaFunctor::LuaFunctor(const LuaFunctor& cp) :
+    L(cp.L),
+    index(cp.index),
+    self(cp.self),
+    needs_lookup(cp.needs_lookup),
+    function_name(cp.function_name),
+    d_errFuncName(cp.d_errFuncName),
+    d_errFuncIndex(cp.d_errFuncIndex),
+    d_ourErrFuncIndex(cp.d_ourErrFuncIndex)
+{
+}
+
+/*************************************************************************
+    Destructor
+*************************************************************************/
+LuaFunctor::~LuaFunctor()
+{
+    if (self != LUA_NOREF)
+        luaL_unref(L, LUA_REGISTRYINDEX, self);
+
+    if (index != LUA_NOREF)
+        luaL_unref(L, LUA_REGISTRYINDEX, index);
+
+    if (d_ourErrFuncIndex &&
+        (d_errFuncIndex != LUA_NOREF) &&
+        !d_errFuncName.empty())
+            luaL_unref(L, LUA_REGISTRYINDEX, d_errFuncIndex);
+}
+
+/*************************************************************************
+    Call operator
+*************************************************************************/
+bool LuaFunctor::operator()(const EventArgs& args) const
+{
+    // named error handler needs binding?
+    if ((d_errFuncIndex == LUA_NOREF) && !d_errFuncName.empty())
+    {
+        pushNamedFunction(L, d_errFuncName);
+        d_errFuncIndex = luaL_ref(L, LUA_REGISTRYINDEX);
+        d_ourErrFuncIndex = true;
+    }
+
+    // is this a late binding?
+    if (needs_lookup)
+    {
+        pushNamedFunction(L, function_name);
+        // reference function
+        index = luaL_ref(L, LUA_REGISTRYINDEX);
+        needs_lookup = false;
+        CEGUI_LOGINSANE("Late binding of callback '"+function_name+"' performed");
+        function_name.clear();
+    } // if (needs_lookup)
+
+    // put error handler on stack if we're using such a thing
+    int err_idx = 0;
+    if (d_errFuncIndex != LUA_NOREF)
+    {
+        lua_rawgeti(L, LUA_REGISTRYINDEX, d_errFuncIndex);
+        err_idx = lua_gettop(L);
+    }
+
+	ScriptWindowHelper* helper = 0;
+	//Set a global for this window
+	if(args.d_hasWindow)
+	{
+		WindowEventArgs& we = (WindowEventArgs&)args;
+		helper = new ScriptWindowHelper(we.window);
+		tolua_pushusertype(L,(void*)helper,"CEGUI::ScriptWindowHelper");
+		lua_setglobal(L,"this");
+	}
+
+    // retrieve function
+    lua_rawgeti(L, LUA_REGISTRYINDEX, index);
+
+    // possibly self as well?
+    int nargs = 1;
+    if (self != LUA_NOREF)
+    {
+        lua_rawgeti(L, LUA_REGISTRYINDEX, self);
+        ++nargs;
+    }
+
+    // push EventArgs  parameter
+    tolua_pushusertype(L, (void*)&args, "const CEGUI::EventArgs");
+
+    // call it
+    int error = lua_pcall(L, nargs, 1, err_idx);
+
+    // handle errors
+    if (error)
+    {
+        String errStr(lua_tostring(L, -1));
+        lua_pop(L, 1);
+		if(helper)
+		{
+			delete helper;
+			helper = 0;
+		}
+        throw ScriptException("Unable to call Lua event handler:\n\n"+errStr+"\n");
+    } // if (error)
+
+    // retrieve result
+    bool ret = lua_isboolean(L, -1) ? lua_toboolean(L, -1 ) : true;
+    lua_pop(L, 1);
+
+	if(helper)
+	{
+		delete helper;
+		helper = 0;
+	}
+
+    return ret;
+}
+
+/*************************************************************************
+    Pushes a named function on the stack
+*************************************************************************/
+void LuaFunctor::pushNamedFunction(lua_State* L, const String& handler_name)
+{
+    int top = lua_gettop(L);
+
+    // do we have any dots in the handler name? if so we grab the function as a table field
+    String::size_type i = handler_name.find_first_of((utf32)'.');
+    if (i!=String::npos)
+    {
+        // split the rest of the string up in parts seperated by '.'
+        // TODO: count the dots and size the vector accordingly from the beginning.
+        std::vector<String> parts;
+        String::size_type start = 0;
+        do
+        {
+            parts.push_back(handler_name.substr(start,i-start));
+            start = i+1;
+            i = handler_name.find_first_of((utf32)'.',start);
+        } while(i!=String::npos);
+
+        // add last part
+        parts.push_back(handler_name.substr(start));
+
+        // first part is the global
+        lua_getglobal(L, parts[0].c_str());
+        if (!lua_istable(L,-1))
+        {
+            lua_settop(L,top);
+            throw ScriptException("Unable to get the Lua event handler: '"+handler_name+"' as first part is not a table");
+        }
+
+        // if there is more than two parts, we have more tables to go through
+        std::vector<String>::size_type visz = parts.size();
+        if (visz-- > 2) // avoid subtracting one later on
+        {
+            // go through all the remaining parts to (hopefully) have a valid Lua function in the end
+            std::vector<String>::size_type vi = 1;
+            while (vi<visz)
+            {
+                // push key, and get the next table
+                lua_pushstring(L,parts[vi].c_str());
+                lua_gettable(L,-2);
+                if (!lua_istable(L,-1))
+                {
+                    lua_settop(L,top);
+                    throw ScriptException("Unable to get the Lua event handler: '"+handler_name+"' as part #"+PropertyHelper::uintToString(uint(vi+1))+" ("+parts[vi]+") is not a table");
+                }
+                // get rid of the last table and move on
+                lua_remove(L,-2);
+                vi++;
+            }
+        }
+
+        // now we are ready to get the function to call ... phew :)
+        lua_pushstring(L,parts[visz].c_str());
+        lua_gettable(L,-2);
+        lua_remove(L,-2); // get rid of the table
+    }
+    // just a regular global function
+    else
+    {
+        lua_getglobal(L, handler_name.c_str());
+    }
+
+    // is it a function
+    if (!lua_isfunction(L,-1))
+    {
+        lua_settop(L,top);
+        throw ScriptException("The Lua event handler: '"+handler_name+"' does not represent a Lua function");
+    }
+}
+
+//----------------------------------------------------------------------------//
+LuaFunctor::LuaFunctor(lua_State* state, const int func, const int selfIndex,
+    const String& error_handler) :
+    // State initialisation
+    L(state),
+    index(func),
+    self(selfIndex),
+    needs_lookup(false),
+    d_errFuncName(error_handler),
+    d_errFuncIndex(LUA_NOREF),
+    d_ourErrFuncIndex(false)
+{
+}
+
+//----------------------------------------------------------------------------//
+LuaFunctor::LuaFunctor(lua_State* state, const String& func, const int selfIndex,
+    const String& error_handler) :
+    // State initialisation
+    L(state),
+    index(LUA_NOREF),
+    self(selfIndex),
+    needs_lookup(true),
+    function_name(func),
+    d_errFuncName(error_handler),
+    d_errFuncIndex(LUA_NOREF),
+    d_ourErrFuncIndex(false)
+{
+}
+
+//----------------------------------------------------------------------------//
+LuaFunctor::LuaFunctor(lua_State* state, const int func, const int selfIndex,
+    const int error_handler) :
+    // State initialisation
+    L(state),
+    index(func),
+    self(selfIndex),
+    needs_lookup(false),
+    d_errFuncIndex(error_handler),
+    d_ourErrFuncIndex(false)
+{
+}
+
+//----------------------------------------------------------------------------//
+LuaFunctor::LuaFunctor(lua_State* state, const String& func, const int selfIndex,
+    const int error_handler) :
+    // State initialisation
+    L(state),
+    index(LUA_NOREF),
+    self(selfIndex),
+    needs_lookup(true),
+    function_name(func),
+    d_errFuncIndex(error_handler),
+    d_ourErrFuncIndex(false)
+{
+}
+
+//----------------------------------------------------------------------------//
+Event::Connection LuaFunctor::SubscribeEvent(EventSet* self,
+    const String& event_name, const int funcIndex, const int selfIndex,
+    const int error_handler, lua_State* L)
+{
+    // deal with error handler function
+    int err_idx = LUA_NOREF;
+    String err_str;
+    if (error_handler != LUA_NOREF)
+    {
+        int err_handler_type = lua_type(L,-1);
+        switch (err_handler_type)
+        {
+        case LUA_TFUNCTION:
+            // reference function
+            err_idx = luaL_ref(L, LUA_REGISTRYINDEX);
+            break;
+        case LUA_TSTRING:
+            err_str = lua_tostring(L, -1);
+            lua_pop(L, 1);
+            break;
+        default:
+            luaL_error(L, "bad error handler function passed to subscribe "
+                          "function. must be a real function, or a string for "
+                          "late binding");
+            break;
+        }
+
+    }
+
+    // should we pass a self to the callback?
+    int thisIndex = LUA_NOREF;
+    if (selfIndex != LUA_NOREF)
+    {
+        // reference self
+        thisIndex = luaL_ref(L, LUA_REGISTRYINDEX);
+    }
+
+    // do the real subscription
+    int type = lua_type(L,-1);
+    Event::Connection con;
+    if (type == LUA_TFUNCTION)
+    {
+        // reference function
+        int index = luaL_ref(L, LUA_REGISTRYINDEX);
+
+        LuaFunctor functor((err_idx != LUA_NOREF) ?
+                        LuaFunctor(L, index, thisIndex, err_idx) :
+                        (!err_str.empty()) ?
+                            LuaFunctor(L, index, thisIndex, err_str) :
+                            LuaFunctor(L, index, thisIndex));
+        con = self->subscribeEvent(String(event_name), Event::Subscriber(functor));
+        // make sure we don't release the reference(s) we just made when the
+        // 'functor' object is destroyed (goes out of scope)
+        functor.index = LUA_NOREF;
+        functor.self = LUA_NOREF;
+        functor.d_errFuncIndex = LUA_NOREF;
+    }
+    else if (type == LUA_TSTRING)
+    {
+        const char* str = lua_tostring(L, -1);
+        LuaFunctor functor((err_idx != LUA_NOREF) ?
+                        LuaFunctor(L, String(str), thisIndex, err_idx) :
+                        (!err_str.empty()) ?
+                            LuaFunctor(L, String(str), thisIndex, err_str) :
+                            LuaFunctor(L, String(str), thisIndex));
+
+        con = self->subscribeEvent(String(event_name), Event::Subscriber(functor));
+        // make sure we don't release the reference(s) we just made when the
+        // 'functor' object is destroyed (goes out of scope)
+        functor.self = LUA_NOREF;
+        functor.d_errFuncIndex = LUA_NOREF;
+    }
+    else
+    {
+        luaL_error(L, "bad function passed to subscribe function. must be a "
+                      "real function, or a string for late binding");
+    }
+
+    // return the event connection
+    return con;
+}
+
+//----------------------------------------------------------------------------//
+
+} // namespace CEGUI
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILuaFunctor.h
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILuaFunctor.h	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/CEGUILuaFunctor.h	(revision 2664)
@@ -0,0 +1,108 @@
+/***********************************************************************
+    filename: CEGUILuaFunctor.h
+    created:  Thu Jan 26 2006
+    author:   Tomas Lindquist Olsen <tomas@famolsen.dk>
+
+    purpose:  Defines interface for LuaFunctor class
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2008 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#ifndef _CEGUILuaFunctor_h_
+#define _CEGUILuaFunctor_h_
+
+#include "CEGUIEventSet.h"
+#include "CEGUIScriptWindowHelper.h"
+
+struct lua_State;
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// forward declaration
+class LuaScriptModule;
+
+/*!
+\brief
+    Functor class used for subscribing Lua functions to CEGUI events
+*/
+class LuaFunctor
+{
+public:
+    LuaFunctor(lua_State* state, int func, int selfIndex);
+    LuaFunctor(lua_State* state, const String& func, int selfIndex);
+
+    LuaFunctor(lua_State* state, const int func, const int selfIndex,
+               const String& error_handler);
+    LuaFunctor(lua_State* state, const String& func, const int selfIndex,
+               const String& error_handler);
+    LuaFunctor(lua_State* state, const int func, const int selfIndex,
+               const int error_handler);
+    LuaFunctor(lua_State* state, const String& func, const int selfIndex,
+               const int error_handler);
+
+    LuaFunctor(const LuaFunctor& cp);
+    ~LuaFunctor();
+
+    bool operator()(const EventArgs& args) const;
+
+    /*!
+    \brief
+        function used to subscribe any Lua function as event handler.
+        References using the Lua registry.
+        To be called from Lua only.
+    */
+    static Event::Connection SubscribeEvent(EventSet* self,
+                                            const String& eventName,
+                                            const int funcIndex,
+                                            const int selfIndex,
+                                            const int error_handler,
+                                            lua_State* L);
+
+    /*!
+    \brief
+        Pushes the Lua function named \param name on top of the Lua stack.
+        The name may contain '.' (dots) character for (nested) table values.
+    */
+    static void pushNamedFunction(lua_State* L, const String& name);
+
+private:
+    lua_State* L;
+    mutable int index;
+    int self;
+    mutable bool needs_lookup;
+    mutable String function_name;
+
+    //! Error handler function to pass to lua_pcall.
+    mutable String d_errFuncName;
+    //! registry index of the function to pass to lua_pcall.
+    mutable int d_errFuncIndex;
+    //! signfies whether we made the reference index at d_errFuncIndex.
+    mutable bool d_ourErrFuncIndex;
+
+    friend class LuaScriptModule;
+};
+
+} // namespace CEGUI
+
+#endif // end of guard _CEGUILuaFunctor_h_
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/changes_orxonox.diff
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/changes_orxonox.diff	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/changes_orxonox.diff	(revision 2664)
@@ -0,0 +1,92 @@
+--- CEGUILua.cpp	Sun Jan 25 18:32:57 2009
++++ CEGUILua.cpp	Thu Jan 29 10:24:44 2009
+@@ -27,10 +27,6 @@
+  *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+  *   OTHER DEALINGS IN THE SOFTWARE.
+  ***************************************************************************/
+-#ifdef HAVE_CONFIG_H
+-#   include "config.h"
+-#endif
+-
+ #include "CEGUI.h"
+ #include "CEGUIConfig.h"
+ #include "CEGUIPropertyHelper.h"
+@@ -45,7 +41,7 @@
+ #include "lauxlib.h"
+ }
+ 
+-#include "tolua++.h"
++#include "tolua/tolua++.h"
+ 
+ // prototype for bindings initialisation function
+ int tolua_CEGUI_open(lua_State* tolua_S);
+@@ -61,7 +57,7 @@
+ LuaScriptModule::LuaScriptModule() :
+     d_errFuncIndex(LUA_NOREF)
+ {
+-    #if CEGUI_LUA_VER >= 51
++    #if LUA_VERSION_NUM >= 501
+         static const luaL_Reg lualibs[] = {
+             {"", luaopen_base},
+             {LUA_LOADLIBNAME, luaopen_package},
+@@ -75,14 +71,14 @@
+         #endif
+             {0, 0}
+         };
+-    #endif /* CEGUI_LUA_VER >= 51 */
++    #endif /* LUA_VERSION_NUM >= 501 */
+ 
+     // create a lua state
+     d_ownsState = true;
+     d_state = lua_open();
+ 
+     // init all standard libraries
+-    #if CEGUI_LUA_VER >= 51
++    #if LUA_VERSION_NUM >= 501
+             const luaL_Reg *lib = lualibs;
+             for (; lib->func; lib++)
+             {
+@@ -90,7 +86,7 @@
+                 lua_pushstring(d_state, lib->name);
+                 lua_call(d_state, 1, 0);
+             }
+-    #else /* CEGUI_LUA_VER >= 51 */
++    #else /* LUA_VERSION_NUM >= 501 */
+         luaopen_base(d_state);
+         luaopen_io(d_state);
+         luaopen_string(d_state);
+@@ -99,7 +95,7 @@
+         #if defined(DEBUG) || defined (_DEBUG)
+             luaopen_debug(d_state);
+         #endif
+-    #endif /* CEGUI_LUA_VER >= 51 */
++    #endif /* LUA_VERSION_NUM >= 501 */
+ 
+     setModuleIdentifierString();
+ }
+--- CEGUILua.h	Sun Jan 25 18:32:57 2009
++++ CEGUILua.h	Thu Jan 29 10:17:42 2009
+@@ -38,7 +38,11 @@
+ #   ifdef CEGUILUA_EXPORTS
+ #       define CEGUILUA_API __declspec(dllexport)
+ #   else
+-#       define CEGUILUA_API __declspec(dllimport)
++#       if defined( __MINGW32__ )
++#           define CEGUILUA_API
++#       else
++#           define CEGUILUA_API __declspec(dllimport)
++#       endif
+ #   endif
+ #else
+ #   define CEGUILUA_API
+--- CEGUILuaFunctor.cpp	Sun Jan 25 18:32:57 2009
++++ CEGUILuaFunctor.cpp	Thu Jan 29 10:25:48 2009
+@@ -40,7 +40,7 @@
+ #include "lauxlib.h"
+ }
+ 
+-#include "tolua++.h"
++#include "tolua/tolua++.h"
+ 
+ // Start of CEGUI namespace section
+ namespace CEGUI
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/required.cpp
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/required.cpp	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/required.cpp	(revision 2664)
@@ -0,0 +1,108 @@
+/***********************************************************************
+	filename: required.cpp
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+
+	purpose:  Implementation of helper functions
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "required.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+	Functions for getting Thumb range pairs as two return values
+*************************************************************************/
+
+// returns horizontal range as two values for lua
+void ceguiLua_Thumb_getHorzRange(Thumb* wnd, float* min, float* max)
+{
+	std::pair<float,float> range_pair = wnd->getHorzRange();
+	*min = range_pair.first;
+	*max = range_pair.second;
+}
+
+
+// returns vertical range as two values for lua
+void ceguiLua_Thumb_getVertRange(Thumb* wnd, float* min, float* max)
+{
+	std::pair<float,float> range_pair = wnd->getVertRange();
+	*min = range_pair.first;
+	*max = range_pair.second;
+}
+
+
+/*************************************************************************
+	Functions for creating list box items
+*************************************************************************/
+
+// allocates and returns a new ListboxTextItem
+ListboxTextItem* ceguiLua_createListboxTextItem(const String& text, uint item_id, void* item_data, bool disabled, bool auto_delete)
+{
+	return new ListboxTextItem(text,item_id,item_data,disabled,auto_delete);
+}
+
+
+/************************************************************************
+    OutStream
+*************************************************************************/
+void ceguiLua_FileStream_open(FileStream* os, const char* filename)
+{
+    os->open(filename, std::ios::binary);
+}
+
+
+/************************************************************************
+    CEGUI::System::getSystemKeys alternative
+*************************************************************************/
+bool ceguiLua_System_isSystemKeyDown(const System* sys, SystemKey k)
+{
+    return (k & sys->getSystemKeys()) != 0;
+}
+
+/************************************************************************
+    EventConnection helper class implementation
+*************************************************************************/
+EventConnection::EventConnection(RefCounted<BoundSlot> slot) :
+    d_slot(slot)
+{}
+
+//----------------------------------------------------------------------------//
+bool EventConnection::connected() const
+{
+    return d_slot->connected();
+}
+
+//----------------------------------------------------------------------------//
+void EventConnection::disconnect()
+{
+    d_slot->disconnect();
+}
+
+//----------------------------------------------------------------------------//
+
+} // namespace CEGUI
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/required.h
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/required.h	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/ceguilua/required.h	(revision 2664)
@@ -0,0 +1,125 @@
+/***********************************************************************
+	filename: required.h
+	created:  16/3/2005
+	author:   Tomas Lindquist Olsen
+
+	purpose:  Header that includes the necessary stuff needed for the Lua bindings
+*************************************************************************/
+/***************************************************************************
+ *   Copyright (C) 2004 - 2006 Paul D Turner & The CEGUI Development Team
+ *
+ *   Permission is hereby granted, free of charge, to any person obtaining
+ *   a copy of this software and associated documentation files (the
+ *   "Software"), to deal in the Software without restriction, including
+ *   without limitation the rights to use, copy, modify, merge, publish,
+ *   distribute, sublicense, and/or sell copies of the Software, and to
+ *   permit persons to whom the Software is furnished to do so, subject to
+ *   the following conditions:
+ *
+ *   The above copyright notice and this permission notice shall be
+ *   included in all copies or substantial portions of the Software.
+ *
+ *   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ *   EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ *   MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ *   IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
+ *   OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ *   ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *   OTHER DEALINGS IN THE SOFTWARE.
+ ***************************************************************************/
+#include "CEGUI.h"
+#include "CEGUILua.h"
+#include "CEGUILuaFunctor.h"
+#include <fstream>
+
+#define __operator_increment    operator++
+#define __operator_decrement    operator--
+#define __operator_dereference  operator*
+
+#define LuaFunctorSubscribeEvent CEGUI::LuaFunctor::SubscribeEvent
+
+//This is used to keep compilers happy
+#define CEGUIDeadException(e) &
+
+#if defined(_MSC_VER) && !defined(snprintf)
+#   define snprintf   _snprintf
+#endif
+
+typedef CEGUI::String string;
+
+namespace CEGUI
+{
+
+/*************************************************************************
+    Helper class to enable us to represent an Event::Connection object
+    (which is actually a RefCounted<BoundSlot> object)
+*************************************************************************/
+class EventConnection
+{
+    RefCounted<BoundSlot> d_slot;
+
+public:
+    EventConnection(RefCounted<BoundSlot> slot);
+    bool connected() const;
+    void disconnect();
+};
+
+/*************************************************************************
+	Functions for getting Thumb range pairs as two return values
+*************************************************************************/
+void ceguiLua_Thumb_getHorzRange(Thumb* wnd, float* min, float* max);
+void ceguiLua_Thumb_getVertRange(Thumb* wnd, float* min, float* max);
+
+
+/*************************************************************************
+	Functions for creating list box items
+*************************************************************************/
+ListboxTextItem* ceguiLua_createListboxTextItem(const String& text, uint item_id, void* item_data, bool disabled, bool auto_delete);
+
+
+/************************************************************************
+    Stuff needed to make the iterators work
+*************************************************************************/
+typedef PropertySet::Iterator PropertyIterator;
+typedef EventSet::Iterator EventIterator;
+typedef WindowManager::WindowIterator WindowIterator;
+typedef WindowFactoryManager::WindowFactoryIterator WindowFactoryIterator;
+typedef WindowFactoryManager::FalagardMappingIterator FalagardMappingIterator;
+typedef WindowFactoryManager::FalagardWindowMapping FalagardWindowMapping;
+typedef ImagesetManager::ImagesetIterator ImagesetIterator;
+typedef Imageset::ImageIterator ImageIterator;
+typedef SchemeManager::SchemeIterator SchemeIterator;
+typedef FontManager::FontIterator FontIterator;
+
+template <typename T>
+inline PropertyIterator ceguiLua_getPropertyIterator(const T* self)
+{
+    return static_cast<const PropertySet*>(self)->getIterator();
+}
+
+template <typename T>
+inline EventIterator ceguiLua_getEventIterator(const T* self)
+{
+    return static_cast<const EventSet*>(self)->getIterator();
+}
+
+
+/************************************************************************
+    OutStream
+*************************************************************************/
+typedef std::ofstream FileStream;
+void ceguiLua_FileStream_open(FileStream*, const char* filename);
+
+
+/************************************************************************
+    CEGUI::System::getSystemKeys alternative
+*************************************************************************/
+bool ceguiLua_System_isSystemKeyDown(const System* sys, SystemKey k);
+
+}
+
+// the binding file generates alot of
+// warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning)
+#if defined(_MSC_VER)
+#   pragma warning(disable : 4800)
+#endif
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/package/EventSet.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/package/EventSet.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/package/EventSet.pkg	(revision 2664)
@@ -0,0 +1,46 @@
+/************************************************************************
+    Event
+*************************************************************************/
+class Event
+{
+    string getName() const;
+};
+
+class EventConnection
+{
+    bool connected() const;
+    void disconnect();
+};
+
+
+/***********************************************************************
+	EventSet
+***********************************************************************/
+class EventSet
+{
+	void addEvent(string name);
+	void removeEvent(string name);
+	void removeAllEvents();
+	bool isEventPresent(string name);
+
+    tolua_throws|CEGUI::UnknownObjectException,error| tolua_outside EventConnection LuaFunctorSubscribeEvent @ subscribeEvent(string name, lua_Object funcIndex, lua_Object selfIndex=LUA_NOREF, lua_Object error_handler = LUA_NOREF, lua_State*);
+
+	tolua_throws|CEGUI::UnknownObjectException,error| EventConnection subscribeScriptedEvent @ subscribeEvent(string name, string callback_name);
+
+	void fireEvent(string name, EventArgs& args, string eventnamespace="");
+
+	bool isMuted() const;
+	void setMutedState(bool setting);
+
+    tolua_outside EventIterator ceguiLua_getEventIterator @ getEventIterator() const;
+};
+
+
+
+/***********************************************************************
+	GlobalEventSet
+***********************************************************************/
+class GlobalEventSet : public EventSet
+{
+	static GlobalEventSet& getSingleton();
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/package/HelperFunctions.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/package/HelperFunctions.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/package/HelperFunctions.pkg	(revision 2664)
@@ -0,0 +1,240 @@
+/****************************************************
+	EventArgs casting helper functions.
+	These are not part of the core CEGUI API, merely here for
+	convenience
+*****************************************************/
+$[
+
+function CEGUI.toMouseCursorEventArgs(e)
+    return tolua.cast(e,"const CEGUI::MouseCursorEventArgs")
+end
+
+function CEGUI.toWindowEventArgs(e)
+    return tolua.cast(e,"const CEGUI::WindowEventArgs")
+end
+
+function CEGUI.toActivationEventArgs(e)
+    return tolua.cast(e,"const CEGUI::ActivationEventArgs")
+end
+
+function CEGUI.toHeaderSequenceEventArgs(e)
+    return tolua.cast(e,"const CEGUI::HeaderSequenceEventArgs")
+end
+
+function CEGUI.toMouseEventArgs(e)
+    return tolua.cast(e,"const CEGUI::MouseEventArgs")
+end
+
+function CEGUI.toKeyEventArgs(e)
+    return tolua.cast(e,"const CEGUI::KeyEventArgs")
+end
+
+function CEGUI.toDragDropEventArgs(e)
+    return tolua.cast(e,"const CEGUI::DragDropEventArgs")
+end
+
+function CEGUI.toTreeEventArgs(e)
+    return tolua.cast(e,"const CEGUI::TreeEventArgs")
+end
+
+CEGUI.EventArgs.toMouseCursorEventArgs      = CEGUI.toMouseCursorEventArgs
+CEGUI.EventArgs.toWindowEventArgs           = CEGUI.toWindowEventArgs
+CEGUI.EventArgs.toActivationEventArgs       = CEGUI.toActivationEventArgs
+CEGUI.EventArgs.toHeaderSequenceEventArgs   = CEGUI.toHeaderSequenceEventArgs
+CEGUI.EventArgs.toMouseEventArgs            = CEGUI.toMouseEventArgs
+CEGUI.EventArgs.toKeyEventArgs              = CEGUI.toKeyEventArgs
+CEGUI.EventArgs.toDragDropEventArgs         = CEGUI.toDragDropEventArgs
+CEGUI.EventArgs.toTreeEventArgs             = CEGUI.toTreeEventArgs
+
+$]
+
+
+/****************************************************
+	Functions for easy casting CEGUI::Window class
+	to the widget classes derived from it.
+	
+	all widget types gets these and they are made available as:
+	CEGUI.toButtonBase and CEGUI.Window:toButtonBase
+	etc...
+*****************************************************/
+$[
+
+function CEGUI.toButtonBase(w)
+    return tolua.cast(w,"CEGUI::ButtonBase")
+end
+
+function CEGUI.toCheckbox(w)
+    return tolua.cast(w,"CEGUI::Checkbox")
+end
+
+function CEGUI.toCombobox(w)
+    return tolua.cast(w,"CEGUI::Combobox")
+end
+
+function CEGUI.toComboDropList(w)
+    return tolua.cast(w,"CEGUI::ComboDropList")
+end
+
+function CEGUI.toDragContainer(w)
+    return tolua.cast(w,"CEGUI::DragContainer")
+end
+
+function CEGUI.toEditbox(w)
+    return tolua.cast(w,"CEGUI::Editbox")
+end
+
+function CEGUI.toFrameWindow(w)
+    return tolua.cast(w,"CEGUI::FrameWindow")
+end
+
+function CEGUI.toGUISheet(w)
+    return tolua.cast(w,"CEGUI::GUISheet")
+end
+
+function CEGUI.toItemEntry(w)
+    return tolua.cast(w,"CEGUI::ItemEntry")
+end
+
+function CEGUI.toItemListBase(w)
+    return tolua.cast(w,"CEGUI::ItemListBase")
+end
+
+function CEGUI.toItemListbox(w)
+    return tolua.cast(w,"CEGUI::ItemListbox")
+end
+
+function CEGUI.toListbox(w)
+    return tolua.cast(w,"CEGUI::Listbox")
+end
+
+function CEGUI.toListHeader(w)
+    return tolua.cast(w,"CEGUI::ListHeader")
+end
+
+function CEGUI.toListHeaderSegment(w)
+    return tolua.cast(w,"CEGUI::ListHeaderSegment")
+end
+
+function CEGUI.toMenubar(w)
+    return tolua.cast(w,"CEGUI::Menubar")
+end
+
+function CEGUI.toMenuBase(w)
+    return tolua.cast(w,"CEGUI::MenuBase")
+end
+
+function CEGUI.toMenuItem(w)
+    return tolua.cast(w,"CEGUI::MenuItem")
+end
+
+function CEGUI.toMultiColumnList(w)
+    return tolua.cast(w,"CEGUI::MultiColumnList")
+end
+
+function CEGUI.toMultiLineEditbox(w)
+    return tolua.cast(w,"CEGUI::MultiLineEditbox")
+end
+
+function CEGUI.toPopupMenu(w)
+    return tolua.cast(w,"CEGUI::PopupMenu")
+end
+
+function CEGUI.toProgressBar(w)
+    return tolua.cast(w,"CEGUI::ProgressBar")
+end
+
+function CEGUI.toPushButton(w)
+    return tolua.cast(w,"CEGUI::PushButton")
+end
+
+function CEGUI.toRadioButton(w)
+    return tolua.cast(w,"CEGUI::RadioButton")
+end
+
+function CEGUI.toScrollablePane(w)
+    return tolua.cast(w,"CEGUI::ScrollablePane")
+end
+
+function CEGUI.toScrollbar(w)
+    return tolua.cast(w,"CEGUI::Scrollbar")
+end
+
+function CEGUI.toScrolledContainer(w)
+    return tolua.cast(w,"CEGUI::ScrolledContainer")
+end
+
+function CEGUI.toScrolledItemListBase(w)
+    return tolua.cast(w,"CEGUI::ScrolledItemListBase")
+end
+
+function CEGUI.toSlider(w)
+    return tolua.cast(w,"CEGUI::Slider")
+end
+
+function CEGUI.toSpinner(w)
+    return tolua.cast(w,"CEGUI::Spinner")
+end
+
+function CEGUI.toTabButton(w)
+    return tolua.cast(w,"CEGUI::TabButton")
+end
+
+function CEGUI.toTabControl(w)
+    return tolua.cast(w,"CEGUI::TabControl")
+end
+
+function CEGUI.toTabPane(w)
+    return tolua.cast(w,"CEGUI::TabPane")
+end
+
+function CEGUI.toThumb(w)
+    return tolua.cast(w,"CEGUI::Thumb")
+end
+
+function CEGUI.toTooltip(w)
+    return tolua.cast(w,"CEGUI::Tooltip")
+end
+
+CEGUI.Window.toButtonBase = CEGUI.toButtonBase
+CEGUI.Window.toCheckbox = CEGUI.toCheckbox
+CEGUI.Window.toCombobox = CEGUI.toCombobox
+CEGUI.Window.toComboDropList = CEGUI.toComboDropList
+CEGUI.Window.toDragContainer = CEGUI.toDragContainer
+CEGUI.Window.toEditbox = CEGUI.toEditbox
+CEGUI.Window.toFrameWindow = CEGUI.toFrameWindow
+CEGUI.Window.toGUISheet = CEGUI.toGUISheet
+CEGUI.Window.toItemEntry = CEGUI.toItemEntry
+CEGUI.Window.toItemListBase = CEGUI.toItemListBase
+CEGUI.Window.toItemListbox = CEGUI.toItemListBase
+CEGUI.Window.toListbox = CEGUI.toListbox
+CEGUI.Window.toListHeader = CEGUI.toListHeader
+CEGUI.Window.toListHeaderSegment = CEGUI.toListHeaderSegment
+CEGUI.Window.toMenubar = CEGUI.toMenubar
+CEGUI.Window.toMenuBase = CEGUI.toMenuBase
+CEGUI.Window.toMenuItem = CEGUI.toMenuItem
+CEGUI.Window.toMultiColumnList = CEGUI.toMultiColumnList
+CEGUI.Window.toMultiLineEditbox = CEGUI.toMultiLineEditbox
+CEGUI.Window.toPopupMenu = CEGUI.toPopupMenu
+CEGUI.Window.toProgressBar = CEGUI.toProgressBar
+CEGUI.Window.toPushButton = CEGUI.toPushButton
+CEGUI.Window.toRadioButton = CEGUI.toRadioButton
+CEGUI.Window.toScrollablePane = CEGUI.toScrollablePane
+CEGUI.Window.toScrollbar = CEGUI.toScrollbar
+CEGUI.Window.toScrolledContainer = CEGUI.toScrolledContainer
+CEGUI.Window.toScrolledItemListBase = CEGUI.toScrolledItemListBase
+CEGUI.Window.toSlider = CEGUI.toSlider
+CEGUI.Window.toSpinner = CEGUI.toSpinner
+CEGUI.Window.toTabButton = CEGUI.toTabButton
+CEGUI.Window.toTabControl = CEGUI.toTabControl
+CEGUI.Window.toTabPane = CEGUI.toTabPane
+CEGUI.Window.toThumb = CEGUI.toThumb
+CEGUI.Window.toTooltip = CEGUI.toTooltip
+
+$]
+
+
+/****************************************************
+	Helper to create a ListboxTextItem.
+	Mimics the constructor
+*****************************************************/
+ListboxTextItem* ceguiLua_createListboxTextItem @ createListboxTextItem(string text, unsigned int item_id=0, void* item_data=0, bool disabled=false, bool auto_delete=true);
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/package/InputEvent.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/package/InputEvent.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/package/InputEvent.pkg	(revision 2664)
@@ -0,0 +1,129 @@
+/***********************************************************************
+	EventArgs
+***********************************************************************/
+class EventArgs
+{
+	bool handled;
+
+	EventArgs();
+};
+
+
+
+/***********************************************************************
+	MouseCursorEventArgs
+***********************************************************************/
+class MouseCursorEventArgs : public EventArgs
+{
+	MouseCursor* mouseCursor;
+	const Image* image;
+
+	MouseCursorEventArgs(MouseCursor* cursor);
+};
+
+
+
+/***********************************************************************
+	WindowEventArgs
+***********************************************************************/
+class WindowEventArgs : public EventArgs
+{
+	Window* window;
+
+	WindowEventArgs(Window* wnd);
+};
+
+
+
+/***********************************************************************
+	ActivationEventArgs
+***********************************************************************/
+class ActivationEventArgs : public WindowEventArgs
+{
+	Window* otherWindow;
+
+	ActivationEventArgs(Window* wnd);
+};
+
+
+
+/***********************************************************************
+	HeaderSequenceEventArgs
+***********************************************************************/
+class HeaderSequenceEventArgs : public WindowEventArgs
+{
+	// remove 'd_' member variable prefix
+	unsigned int d_oldIdx @ oldIdx;
+	unsigned int d_newIdx @ newIdx;
+
+	HeaderSequenceEventArgs(Window* wnd, unsigned int old_index, unsigned int new_index);
+};
+
+
+
+/***********************************************************************
+	MouseButton
+***********************************************************************/
+enum MouseButton
+{
+	LeftButton,
+	RightButton,
+	MiddleButton,
+	X1Button,
+	X2Button,
+	MouseButtonCount,
+	NoButton
+};
+
+
+
+/***********************************************************************
+	MouseEventArgs
+***********************************************************************/
+class MouseEventArgs : public WindowEventArgs
+{
+	Vector2 position;
+	Vector2 moveDelta;
+	MouseButton button;
+	unsigned int sysKeys;
+	float wheelChange;
+
+	MouseEventArgs(Window* wnd);
+};
+
+
+
+/***********************************************************************
+	KeyEventArgs
+***********************************************************************/
+class KeyEventArgs : public WindowEventArgs
+{
+	unsigned long codepoint;
+	Key::Scan scancode;
+	unsigned int sysKeys;
+
+	KeyEventArgs(Window* wnd);
+};
+
+
+
+/************************************************************************
+    DragDropEventArgs
+*************************************************************************/
+class DragDropEventArgs : public WindowEventArgs
+{
+    DragContainer* dragDropItem;
+
+    DragDropEventArgs(Window* wnd);
+};
+
+
+/***********************************************************************
+   TreeEventArgs
+***********************************************************************/
+class TreeEventArgs : public WindowEventArgs
+{
+   TreeItem *treeItem;
+
+   TreeEventArgs(Window* wnd);
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/package/Window.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/package/Window.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/package/Window.pkg	(revision 2664)
@@ -0,0 +1,250 @@
+/****************************************
+	Vertical alignment modes
+*****************************************/
+enum VerticalAlignment
+{
+	VA_TOP,
+	VA_CENTRE,
+	VA_BOTTOM
+};
+
+
+/****************************************
+	Horizontal alignment modes
+*****************************************/
+enum HorizontalAlignment
+{
+	HA_LEFT,
+	HA_CENTRE,
+	HA_RIGHT
+};
+
+
+/****************************************
+	Window
+*****************************************/
+class Window //: public EventSet
+{
+	string getType() const;
+	string getName() const;
+
+	bool isDestroyedByParent() const;
+	bool isAlwaysOnTop() const;
+	bool isDisabled(bool localOnly=false) const;
+	bool isVisible(bool localOnly=false) const;
+	bool isActive() const;
+	bool isClippedByParent() const;
+
+	void setDestroyedByParent(bool setting);
+	void setAlwaysOnTop(bool setting);
+	void setEnabled(bool setting);
+	void enable();
+	void disable();
+	void setVisible(bool setting);
+	void show();
+	void hide();
+	void activate();
+	void deactivate();
+
+	void setClippedByParent(bool setting);
+
+	unsigned int getID() const;
+	void setID(unsigned int ID);
+
+	unsigned int getChildCount() const;
+
+	bool isChild(unsigned int ID) const;
+	bool isChild(string name) const;
+	bool isChild(const Window* window) const;
+	bool isChildRecursive(unsigned int ID) const;
+
+	void addChildWindow(string name);
+	void addChildWindow(Window* window);
+
+	void removeChildWindow(unsigned int ID);
+	void removeChildWindow(string name);
+	void removeChildWindow(Window* window);
+
+	tolua_throws|CEGUI::UnknownObjectException,nil| Window* getChild(unsigned int ID) const;
+	tolua_throws|CEGUI::UnknownObjectException,nil| Window* getChild(string name) const;
+    Window* getChildRecursive(unsigned int ID) const;
+    Window* getChildRecursive(string name) const;
+	Window* getChildAtIdx(unsigned int ID) const;
+	Window* getActiveChild() const;
+	Window* getChildAtPosition(const Vector2& pos) const;
+    Window* getTargetChildAtPosition(const Vector2& pos) const;
+
+	Window* getParent() const;
+
+	bool isAncestor(unsigned int ID) const;
+	bool isAncestor(string name) const;
+	bool isAncestor(const Window* window) const;
+
+	void setFont(string name);
+	void setFont(Font* font);
+	Font* getFont() const;
+
+	void setText(string text);
+    void insertText(string text, unsigned long position);
+    void appendText(string text);
+	string getText() const;
+
+	bool inheritsAlpha() const;
+	float getAlpha() const;
+	float getEffectiveAlpha() const;
+	void setAlpha(float a);
+	void setInheritsAlpha(bool setting);
+
+	void requestRedraw() const;
+
+	bool isZOrderingEnabled() const;
+	void setZOrderingEnabled(bool setting);
+
+	Rect getPixelRect() const;
+	Rect getInnerRect() const;
+	Rect getUnclippedPixelRect() const;
+	Rect getUnclippedInnerRect() const;
+
+    Size getParentPixelSize(void) const;
+    float getParentPixelWidth(void) const;
+    float getParentPixelHeight(void) const;
+
+	static Window* getCaptureWindow();
+	void setRestoreCapture(bool setting);
+	bool restoresOldCapture() const;
+
+	bool distributesCapturedInputs() const;
+	void setDistributesCapturedInputs(bool setting);
+
+	bool captureInput();
+	void releaseInput();
+
+	bool isCapturedByThis() const;
+	bool isCapturedByAncestor() const;
+	bool isCapturedByChild() const;
+
+	bool isHit(const Vector2& pos) const;
+
+	bool isRiseOnClickEnabled() const;
+	void setRiseOnClickEnabled(bool setting);
+
+	const Image* getMouseCursor() const;
+	void setMouseCursor(MouseCursorImage cursor);
+	void setMouseCursor(const Image* image);
+	void setMouseCursor(string imageset, string image);
+
+	void moveToFront();
+	void moveToBack();
+
+	bool wantsMultiClickEvents() const;
+	bool isMouseAutoRepeatEnabled() const;
+	float getAutoRepeatDelay() const;
+	float getAutoRepeatRate() const;
+	void setWantsMultiClickEvents(bool setting);
+	void setMouseAutoRepeatEnabled(bool setting);
+	void setAutoRepeatDelay(float delay);
+	void setAutoRepeatRate(float rate);
+
+	//void destroy();
+
+	bool isUsingDefaultTooltip() const;
+	Tooltip* getTooltip() const;
+	string getTooltipType() const;
+	string getTooltipText() const;
+	bool inheritsTooltipText() const;
+
+	void setTooltip(Tooltip* tooltip);
+	void setTooltipType(string tooltipType);
+	void setTooltipText(string tip);
+	void setInheritsTooltipText(bool setting);
+
+	bool testClassName(string class_name) const;
+
+	void notifyDragDropItemEnters(DragContainer* item);
+	void notifyDragDropItemLeaves(DragContainer* item);
+	void notifyDragDropItemDropped(DragContainer* item);
+
+	VerticalAlignment getVerticalAlignment() const;
+	HorizontalAlignment getHorizontalAlignment() const;
+
+    // these actually have a const, but tolua++ chokes on that
+    void setVerticalAlignment(VerticalAlignment alignment);
+    void setHorizontalAlignment(HorizontalAlignment alignment);
+
+	string getLookNFeel() const;
+    tolua_throws|CEGUI::Exception,error| void setLookNFeel(string lnf);
+
+    tolua_throws|CEGUI::Exception,error| void setWindowRenderer(string name);
+    string getWindowRendererName() const;
+
+	//RenderCache& getRenderCache()
+
+	bool getModalState() const;
+	void setModalState(bool state);
+
+    tolua_throws|CEGUI::UnknownObjectException,nil| string getUserString(string name) const;
+    bool isUserStringDefined(string name) const;
+    void setUserString(string name, string value);
+
+    void beginInitialisation();
+    void endInitialisation();
+
+	// unified stuff
+	void setArea(const UDim& xpos, const UDim& ypos, const UDim& width, const UDim& height);
+	void setArea(const UVector2& pos, const UVector2& size);
+	void setArea(const URect& area);
+	void setPosition(const UVector2& pos);
+	void setXPosition(const UDim& x);
+	void setYPosition(const UDim& y);
+	void setSize(const UVector2& size);
+	void setWidth(const UDim& width);
+	void setHeight(const UDim& height);
+	void setMaxSize(const UVector2& size);
+	void setMinSize(const UVector2& size);
+
+	const URect& getArea() const;
+	const UVector2& getPosition() const;
+	const UDim& getXPosition() const;
+	const UDim& getYPosition() const;
+	UVector2 getSize() const;
+	UDim getWidth() const;
+	UDim getHeight() const;
+	const UVector2& getMaxSize() const;
+	const UVector2& getMinSize() const;
+
+    // event pass through
+    bool isMousePassThroughEnabled() const;
+    void setMousePassThroughEnabled(bool setting);
+    
+    tolua_throws|CEGUI::Exception,error| void rename(string new_name);
+
+	//////////////////////////////////////////////
+	// PropertySet
+	void setProperty(string name, string value);
+	string getProperty(string name) const;
+	string getPropertyDefault(string name) const;
+	string getPropertyHelp(string name) const;
+
+	bool isPropertyPresent(string name) const;
+	bool isPropertyDefault(string name) const;
+
+    tolua_outside PropertyIterator ceguiLua_getPropertyIterator @ getPropertyIterator() const;
+
+	//////////////////////////////////////////////
+	// EventSet
+	void addEvent(string name);
+	void removeEvent(string name);
+	void removeAllEvents();
+	bool isEventPresent(string name);
+
+    tolua_throws|CEGUI::UnknownObjectException,error| tolua_outside EventConnection LuaFunctorSubscribeEvent @ subscribeEvent(string name, lua_Object funcIndex, lua_Object selfIndex=LUA_NOREF, lua_Object error_handler = LUA_NOREF, lua_State*);
+
+	tolua_throws|CEGUI::UnknownObjectException,error| EventConnection subscribeScriptedEvent @ subscribeEvent(string name, string callback_name);
+	
+	void fireEvent(string name, EventArgs& args, string eventnamespace="");
+
+	bool isMuted() const;
+	void setMutedState(bool setting);
+
+    tolua_outside EventIterator ceguiLua_getEventIterator @ getEventIterator() const;
+};
Index: /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/package/WindowManager.pkg
===================================================================
--- /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/package/WindowManager.pkg	(revision 2664)
+++ /code/branches/buildsystem3/src/ceguilua/ceguilua-0.6.2/package/WindowManager.pkg	(revision 2664)
@@ -0,0 +1,36 @@
+/***********************************************************************
+	WindowManager
+***********************************************************************/
+class WindowManager
+{
+	static WindowManager& getSingleton();
+
+	tolua_throws|CEGUI::AlreadyExistsException,nil|CEGUI::InvalidRequestException,nil| Window* createWindow(string type, string name="");
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| Window* loadWindowLayout(string filename, string name_prefix="", string resourcegroup="");
+	tolua_throws|CEGUI::Exception,error|std::exception,error|any,error| Window* loadWindowLayout(string filename, bool generateRandomPrefix);
+
+    void writeWindowLayoutToStream(string window, OutStream& out, bool writeParent=false) const;
+    void writeWindowLayoutToStream(const Window& window, OutStream& out, bool writeParent=false) const;
+
+	void destroyWindow(string name);
+	void destroyWindow(Window* window);
+	void destroyAllWindows();
+
+	tolua_throws|CEGUI::UnknownObjectException,nil| Window* getWindow(string name) const;
+	bool isWindowPresent(string name) const;
+
+	bool isDeadPoolEmpty() const;
+	void cleanDeadPool();
+
+    void renameWindow(Window* window, string  new_name);
+    void renameWindow(string window, string new_name);
+
+    WindowIterator getIterator() const;
+
+    static void setDefaultResourceGroup(string resourceGroup);
+    static string& getDefaultResourceGroup();
+
+    void lock();
+    void unlock();
+    bool isLocked() const;
+};
Index: /code/branches/buildsystem3/src/core/ArgumentCompletionFunctions.cc
===================================================================
--- /code/branches/buildsystem3/src/core/ArgumentCompletionFunctions.cc	(revision 2663)
+++ /code/branches/buildsystem3/src/core/ArgumentCompletionFunctions.cc	(revision 2664)
@@ -63,5 +63,5 @@
                     startdirectory = ".";
                 }
-#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
+#ifdef ORXONOX_PLATFORM_WINDOWS
                 else
                 {
Index: /code/branches/buildsystem3/src/core/BaseObject.cc
===================================================================
--- /code/branches/buildsystem3/src/core/BaseObject.cc	(revision 2663)
+++ /code/branches/buildsystem3/src/core/BaseObject.cc	(revision 2664)
@@ -33,5 +33,7 @@
 
 #include "BaseObject.h"
-#include "tinyxml/tinyxml.h"
+
+#include <tinyxml/tinyxml.h>
+
 #include "CoreIncludes.h"
 #include "EventIncludes.h"
Index: /code/branches/buildsystem3/src/core/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/core/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/core/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,22 @@
-SET(CORE_SRC_FILES
+ #
+ #             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.
+ #
+
+SET_SOURCE_FILES(CORE_SRC_FILES
   Clock.cc
   ConfigFileManager.cc
@@ -41,33 +60,33 @@
   TclBind.cc
   TclThreadManager.cc
+)
+ADD_SUBDIRECTORY(input)
+GET_ALL_HEADER_FILES(CORE_HDR_FILES)
+SET(CORE_FILES ${CORE_SRC_FILES} ${CORE_HDR_FILES})
 
-  tolua/tolua_bind.cc
+GENERATE_SOURCE_GROUPS(${CORE_FILES})
+GENERATE_TOLUA_BINDINGS(Core CORE_FILES INPUTFILES LuaBind.h CommandExecutor.h)
+
+IF(GCC_NO_SYSTEM_HEADER_SUPPORT)
+  # Get around displaying a few hundred lines of warning code
+  SET_SOURCE_FILES_PROPERTIES(ArgumentCompletionFunctions.cc PROPERTIES COMPILE_FLAGS "-w")
+ENDIF()
+
+ADD_LIBRARY(core SHARED ${CORE_FILES})
+
+SET_TARGET_PROPERTIES(core PROPERTIES DEFINE_SYMBOL "CORE_SHARED_BUILD")
+TARGET_LINK_LIBRARIES(core
+  ${OGRE_LIBRARY}
+  ${Boost_THREAD_LIBRARY}
+  ${Boost_FILESYSTEM_LIBRARY}
+  ${Boost_SYSTEM_LIBRARY}
+  ${Boost_DATE_TIME_LIBRARY} # MSVC only
+  ${LUA_LIBRARIES}
+  cpptcl_orxonox
+  ois_orxonox
+  tinyxml++_orxonox
+  tolua++_orxonox
+  util
 )
 
-ADD_SOURCE_DIRECTORY(CORE_SRC_FILES input)
-
-GET_TARGET_PROPERTY(TOLUA_EXE tolua_orxonox LOCATION)
-ADD_CUSTOM_COMMAND(
-  OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/tolua/tolua_bind.cc ${CMAKE_CURRENT_SOURCE_DIR}/tolua/tolua_bind.h
-  COMMAND ${TOLUA_EXE} -n Core -o ../../src/core/tolua/tolua_bind.cc -H ../../src/core/tolua/tolua_bind.h ../../src/core/tolua/tolua.pkg
-  DEPENDS
-    tolua_orxonox
-    tolua/tolua.pkg
-    LuaBind.h
-    CommandExecutor.h
-  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib
-)
-
-ADD_LIBRARY(core SHARED ${CORE_SRC_FILES})
-
-TARGET_LINK_LIBRARIES(core
-  ${OGRE_LIBRARIES}
-  ${Boost_thread_LIBRARIES}
-  ${Boost_filesystem_LIBRARIES}
-  lua_orxonox
-  cpptcl_orxonox
-  ois_orxonox
-  tinyxml_orxonox
-  tolualib_orxonox
-  util
-)
+ORXONOX_INSTALL(core)
Index: /code/branches/buildsystem3/src/core/CommandExecutor.h
===================================================================
--- /code/branches/buildsystem3/src/core/CommandExecutor.h	(revision 2663)
+++ /code/branches/buildsystem3/src/core/CommandExecutor.h	(revision 2664)
@@ -36,11 +36,10 @@
 #include "CommandEvaluation.h"
 
-namespace orxonox // tolua_export
-{ // tolua_export
+// tolua_begin
+namespace orxonox
+{
     class _CoreExport CommandExecutor
-    /*
-    class CommandExecutor { // tolua_export
-    */
     {
+// tolua_end
         public:
             static bool execute(const std::string& command, bool useTcl = true); // tolua_export
Index: /code/branches/buildsystem3/src/core/CorePrereqs.h
===================================================================
--- /code/branches/buildsystem3/src/core/CorePrereqs.h	(revision 2663)
+++ /code/branches/buildsystem3/src/core/CorePrereqs.h	(revision 2664)
@@ -35,5 +35,5 @@
 #define _CorePrereqs_H__
 
-#include "util/OrxonoxPlatform.h"
+#include "OrxonoxConfig.h"
 
 #include <string>
@@ -42,5 +42,5 @@
 // Shared library settings
 //-----------------------------------------------------------------------
-#if (ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32) && !defined( CORE_STATIC_BUILD )
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined( CORE_STATIC_BUILD )
 #  ifdef CORE_SHARED_BUILD
 #    define _CoreExport __declspec(dllexport)
Index: /code/branches/buildsystem3/src/core/Functor.h
===================================================================
--- /code/branches/buildsystem3/src/core/Functor.h	(revision 2663)
+++ /code/branches/buildsystem3/src/core/Functor.h	(revision 2664)
@@ -436,5 +436,5 @@
 
 // disable annoying warning about forcing value to boolean
-#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
+#ifdef ORXONOX_COMPILER_MSVC
 #pragma warning(push)
 #pragma warning(disable:4100 4800)
@@ -475,5 +475,5 @@
 }
 
-#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
+#ifdef ORXONOX_COMPILER_MSVC
 #pragma warning(pop)
 #endif
Index: /code/branches/buildsystem3/src/core/IRC.h
===================================================================
--- /code/branches/buildsystem3/src/core/IRC.h	(revision 2663)
+++ /code/branches/buildsystem3/src/core/IRC.h	(revision 2664)
@@ -32,6 +32,6 @@
 #include "CorePrereqs.h"
 
+#include <cpptcl/cpptcl.h>
 #include "OrxonoxClass.h"
-#include "cpptcl/CppTcl.h"
 
 namespace orxonox
Index: /code/branches/buildsystem3/src/core/Loader.cc
===================================================================
--- /code/branches/buildsystem3/src/core/Loader.cc	(revision 2663)
+++ /code/branches/buildsystem3/src/core/Loader.cc	(revision 2664)
@@ -28,4 +28,7 @@
 
 #include "Loader.h"
+
+#include <tinyxml/ticpp.h>
+
 #include "XMLFile.h"
 #include "BaseObject.h"
@@ -39,6 +42,4 @@
 #include "util/Exception.h"
 
-#include "tinyxml/ticpp.h"
-
 namespace orxonox
 {
Index: /code/branches/buildsystem3/src/core/LuaBind.cc
===================================================================
--- /code/branches/buildsystem3/src/core/LuaBind.cc	(revision 2663)
+++ /code/branches/buildsystem3/src/core/LuaBind.cc	(revision 2664)
@@ -32,7 +32,11 @@
 #include <map>
 
-#include "lua/lua.hpp"
-#include "tolua/tolua++.h"
-#include "tolua/tolua_bind.h"
+extern "C" {
+#include <lua.h>
+#include <lualib.h>
+}
+#include <tolua/tolua++.h>
+
+#include "ToluaBindCore.h"
 #include "util/String.h"
 #include "CoreIncludes.h"
Index: /code/branches/buildsystem3/src/core/LuaBind.h
===================================================================
--- /code/branches/buildsystem3/src/core/LuaBind.h	(revision 2663)
+++ /code/branches/buildsystem3/src/core/LuaBind.h	(revision 2664)
@@ -39,5 +39,5 @@
 
 extern "C" {
-#include <lua/lua.h>
+#include <lua.h>
 }
 
@@ -46,11 +46,11 @@
 #include <string>
 
-namespace orxonox // tolua_export
-{ // tolua_export
+// tolua_begin
+namespace orxonox
+{
   class _CoreExport LuaBind
   {
-  /*
-  class LuaBind { // tolua_export
-  */
+
+// tolua_end
     struct LoadS {
       const char *s;
Index: /code/branches/buildsystem3/src/core/TclBind.h
===================================================================
--- /code/branches/buildsystem3/src/core/TclBind.h	(revision 2663)
+++ /code/branches/buildsystem3/src/core/TclBind.h	(revision 2664)
@@ -32,5 +32,5 @@
 #include "CorePrereqs.h"
 
-#include "cpptcl/CppTcl.h"
+#include <cpptcl/cpptcl.h>
 
 namespace orxonox
Index: /code/branches/buildsystem3/src/core/TclThreadManager.h
===================================================================
--- /code/branches/buildsystem3/src/core/TclThreadManager.h	(revision 2663)
+++ /code/branches/buildsystem3/src/core/TclThreadManager.h	(revision 2664)
@@ -40,5 +40,5 @@
 #include <boost/thread/thread.hpp>
 
-#include "cpptcl/CppTcl.h"
+#include <cpptcl/cpptcl.h>
 #include "core/OrxonoxClass.h"
 
Index: /code/branches/buildsystem3/src/core/Template.cc
===================================================================
--- /code/branches/buildsystem3/src/core/Template.cc	(revision 2663)
+++ /code/branches/buildsystem3/src/core/Template.cc	(revision 2664)
@@ -29,8 +29,9 @@
 #include "Template.h"
 
+#include <tinyxml/ticpp.h>
+
 #include "core/CoreIncludes.h"
 #include "core/XMLPort.h"
 #include "util/Debug.h"
-#include "tinyxml/ticpp.h"
 
 namespace orxonox
Index: /code/branches/buildsystem3/src/core/Template.h
===================================================================
--- /code/branches/buildsystem3/src/core/Template.h	(revision 2663)
+++ /code/branches/buildsystem3/src/core/Template.h	(revision 2664)
@@ -34,6 +34,6 @@
 #include "CorePrereqs.h"
 
+#include <tinyxml/tinyxml.h>
 #include "BaseObject.h"
-#include "tinyxml/tinyxml.h"
 
 namespace orxonox
Index: /code/branches/buildsystem3/src/core/XMLPort.h
===================================================================
--- /code/branches/buildsystem3/src/core/XMLPort.h	(revision 2663)
+++ /code/branches/buildsystem3/src/core/XMLPort.h	(revision 2664)
@@ -44,8 +44,8 @@
 
 #include <cassert>
+#include <tinyxml/ticpp.h>
 #include "util/Debug.h"
 #include "util/Exception.h"
 #include "util/MultiType.h"
-#include "tinyxml/ticpp.h"
 #include "XMLIncludes.h"
 #include "Executor.h"
Index: /code/branches/buildsystem3/src/core/input/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/core/input/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/core/input/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,3 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(CORE_SRC_FILES
   Button.cc
   CalibratorCallback.cc
@@ -12,4 +12,2 @@
   SimpleInputState.cc
 )
-
-ADD_SOURCE_FILES(SRC_FILES)
Index: /code/branches/buildsystem3/src/cpptcl/CHANGES
===================================================================
--- /code/branches/buildsystem3/src/cpptcl/CHANGES	(revision 2664)
+++ /code/branches/buildsystem3/src/cpptcl/CHANGES	(revision 2664)
@@ -0,0 +1,46 @@
+This file contains the history of changes in the C++/Tcl library.
+
+---
+The version 1.1.3 differs from 1.1.2 in the following ways:
+
+- A bug in the initialization of interpreter object was fixed.
+
+---
+The version 1.1.2 differs from 1.1.1 in the following ways:
+
+- Copyright was updated to cover 2006.
+
+- Information was added to docs about the usage of the Boost library.
+
+- Few bug fixes were applied to allow empty parameter lists with variadic
+  functions.
+
+---
+The version 1.1.1 differs from 1.1.0 in the following ways:
+
+- Explicit instantiations of some templates were moved to proper namespace.
+
+
+---
+The version 1.1.0 differs from 1.0.0 in the following ways:
+
+- CHANGES file was added.
+
+- LICENSE file was added with clear description of the license terms.
+
+- Copyright was updated to cover 2005.
+
+- Small patch was added to make the code compile on g++ 3.2.
+
+- New assign method was added that accepts Tcl_Obj.
+
+- Overload of interpreter::eval was added that accepts istream& parameter.
+  This allows to evaluate the contents of arbitrary stream
+  (for example, a file).
+
+- Support for package definitions was added.
+
+- Support for const class member functions was added.
+
+- Support for variadic free functions, constructors and class methods
+  was added.
Index: /code/branches/buildsystem3/src/cpptcl/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/cpptcl/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/cpptcl/CMakeLists.txt	(revision 2664)
@@ -1,5 +1,42 @@
-ADD_LIBRARY(cpptcl_orxonox SHARED CppTcl.cc)
+ #
+ #             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.
+ #
 
-TARGET_LINK_LIBRARIES(cpptcl_orxonox
-  ${TCL_LIBRARY}
+SET(CPPTCL_FILES
+  cpptcl.h
+  cpptcl.cc
+
+  details/callbacks.h
+  details/callbacks_v.h
+  details/constructors.h
+  details/conversions.h
+  details/dispatchers.h
+  details/metahelpers.h
+  details/methods.h
+  details/methods_v.h
 )
+GENERATE_SOURCE_GROUPS(${CPPTCL_FILES})
+
+IF(MSVC)
+  ADD_LIBRARY(cpptcl_orxonox STATIC ${CPPTCL_FILES})
+ELSE()
+  ADD_LIBRARY(cpptcl_orxonox SHARED ${CPPTCL_FILES})
+  ORXONOX_INSTALL(cpptcl_orxonox)
+ENDIF()
+
+TARGET_LINK_LIBRARIES(cpptcl_orxonox ${TCL_LIBRARY})
Index: de/branches/buildsystem3/src/cpptcl/CppTcl.cc
===================================================================
--- /code/branches/buildsystem3/src/cpptcl/CppTcl.cc	(revision 2663)
+++ 	(revision )
@@ -1,1099 +1,0 @@
-//
-// Copyright (C) 2004-2006, Maciej Sobczak
-//
-// Permission to copy, use, modify, sell and distribute this software
-// is granted provided this copyright notice appears in all copies.
-// This software is provided "as is" without express or implied
-// warranty, and with no claim as to its suitability for any purpose.
-//
-
-#include "CppTcl.h"
-#include <map>
-#include <sstream>
-#include <iterator>
-
-
-using namespace Tcl;
-using namespace Tcl::details;
-using namespace std;
-using namespace boost;
-
-
-result::result(Tcl_Interp *interp) : interp_(interp) {}
-
-result::operator bool() const
-{
-     Tcl_Obj *obj = Tcl_GetObjResult(interp_);
-
-     int val, cc;
-     cc = Tcl_GetBooleanFromObj(interp_, obj, &val);
-     if (cc != TCL_OK)
-     {
-          throw tcl_error(interp_);
-     }
-
-     return static_cast<bool>(val);
-}
-
-result::operator double() const
-{
-     Tcl_Obj *obj = Tcl_GetObjResult(interp_);
-
-     double val;
-     int cc = Tcl_GetDoubleFromObj(interp_, obj, &val);
-     if (cc != TCL_OK)
-     {
-          throw tcl_error(interp_);
-     }
-
-     return val;
-}
-
-result::operator int() const
-{
-     Tcl_Obj *obj = Tcl_GetObjResult(interp_);
-
-     int val, cc;
-     cc = Tcl_GetIntFromObj(interp_, obj, &val);
-     if (cc != TCL_OK)
-     {
-          throw tcl_error(interp_);
-     }
-
-     return val;
-}
-
-result::operator long() const
-{
-     Tcl_Obj *obj = Tcl_GetObjResult(interp_);
-
-     long val;
-     int cc;
-     cc = Tcl_GetLongFromObj(interp_, obj, &val);
-     if (cc != TCL_OK)
-     {
-          throw tcl_error(interp_);
-     }
-
-     return val;
-}
-
-result::operator string() const
-{
-     Tcl_Obj *obj = Tcl_GetObjResult(interp_);
-     return Tcl_GetString(obj);
-}
-
-result::operator object() const
-{
-     return object(Tcl_GetObjResult(interp_));
-}
-
-
-void details::set_result(Tcl_Interp *interp, bool b)
-{
-     Tcl_SetObjResult(interp, Tcl_NewBooleanObj(b));
-}
-
-void details::set_result(Tcl_Interp *interp, int i)
-{
-     Tcl_SetObjResult(interp, Tcl_NewIntObj(i));
-}
-
-void details::set_result(Tcl_Interp *interp, long i)
-{
-     Tcl_SetObjResult(interp, Tcl_NewLongObj(i));
-}
-
-void details::set_result(Tcl_Interp *interp, double d)
-{
-     Tcl_SetObjResult(interp, Tcl_NewDoubleObj(d));
-}
-
-void details::set_result(Tcl_Interp *interp, string const &s)
-{
-     Tcl_SetObjResult(interp,
-          Tcl_NewStringObj(s.data(), static_cast<int>(s.size())));
-}
-
-void details::set_result(Tcl_Interp *interp, void *p)
-{
-     ostringstream ss;
-     ss << 'p' << p;
-     string s(ss.str());
-
-     Tcl_SetObjResult(interp,
-          Tcl_NewStringObj(s.data(), static_cast<int>(s.size())));
-}
-
-void details::set_result(Tcl_Interp *interp, object const &o)
-{
-     Tcl_SetObjResult(interp, o.get_object());
-}
-
-
-void details::check_params_no(int objc, int required)
-{
-     if (objc < required)
-     {
-          throw tcl_error("Too few arguments.");
-     }
-}
-
-object details::get_var_params(Tcl_Interp *interp,
-     int objc, Tcl_Obj * CONST objv[],
-     int from, policies const &pol)
-{
-     object o;
-     if (pol.variadic_)
-     {
-          check_params_no(objc, from);
-          o.assign(objv + from, objv + objc);
-     }
-     else
-     {
-          check_params_no(objc, from + 1);
-          o.assign(objv[from]);
-     }
-
-     o.set_interp(interp);
-
-     return o;
-}
-
-
-namespace // anonymous
-{
-
-// map of polymorphic callbacks
-typedef map<string, shared_ptr<callback_base> > callback_interp_map;
-typedef map<Tcl_Interp *, callback_interp_map> callback_map;
-
-callback_map callbacks;
-callback_map constructors;
-
-// map of call policies
-typedef map<string, policies> policies_interp_map;
-typedef map<Tcl_Interp *, policies_interp_map> policies_map;
-
-policies_map call_policies;
-
-// map of object handlers
-typedef map<string, shared_ptr<class_handler_base> > class_interp_map;
-typedef map<Tcl_Interp *, class_interp_map> class_handlers_map;
-
-class_handlers_map class_handlers;
-
-
-// helper for finding call policies - returns true when found
-bool find_policies(Tcl_Interp *interp, string const &cmdName,
-     policies_interp_map::iterator &piti)
-{
-     policies_map::iterator pit = call_policies.find(interp);
-     if (pit == call_policies.end())
-     {
-          return false;
-     }
-
-     piti = pit->second.find(cmdName);
-     return piti != pit->second.end();
-}
-
-extern "C"
-int object_handler(ClientData cd, Tcl_Interp *interp,
-     int objc, Tcl_Obj * CONST objv[]);
-
-// helper function for post-processing call policies
-// for both free functions (isMethod == false)
-// and class methods (isMethod == true)
-void post_process_policies(Tcl_Interp *interp, policies &pol,
-     Tcl_Obj * CONST objv[], bool isMethod)
-{
-     // check if it is a factory
-     if (!pol.factory_.empty())
-     {
-          class_handlers_map::iterator it = class_handlers.find(interp);
-          if (it == class_handlers.end())
-          {
-               throw tcl_error(
-                    "Factory was registered for unknown class.");
-          }
-
-          class_interp_map::iterator oit = it->second.find(pol.factory_);
-          if (oit == it->second.end())
-          {
-               throw tcl_error(
-                    "Factory was registered for unknown class.");
-          }
-
-          class_handler_base *chb = oit->second.get();
-
-          // register a new command for the object returned
-          // by this factory function
-          // if everything went OK, the result is the address of the
-          // new object in the 'pXXX' form
-          // - the new command will be created with this name
-
-          Tcl_CreateObjCommand(interp,
-               Tcl_GetString(Tcl_GetObjResult(interp)),
-               object_handler, static_cast<ClientData>(chb), 0);
-     }
-
-     // process all declared sinks
-     // - unregister all object commands that envelopes the pointers
-     for (vector<int>::iterator s = pol.sinks_.begin();
-          s != pol.sinks_.end(); ++s)
-     {
-          if (isMethod == false)
-          {
-               // example: if there is a declared sink at parameter 3,
-               // and the Tcl command was:
-               // % fun par1 par2 PAR3 par4
-               // then the index 3 correctly points into the objv array
-
-               int index = *s;
-               Tcl_DeleteCommand(interp, Tcl_GetString(objv[index]));
-          }
-          else
-          {
-               // example: if there is a declared sink at parameter 3,
-               // and the Tcl command was:
-               // % $p method par1 par2 PAR3 par4
-               // then the index 3 needs to be incremented
-               // in order correctly point into the 4th index of objv array
-
-               int index = *s + 1;
-               Tcl_DeleteCommand(interp, Tcl_GetString(objv[index]));
-          }
-     }
-}
-
-// actual functions handling various callbacks
-
-// generic callback handler
-extern "C"
-int callback_handler(ClientData, Tcl_Interp *interp,
-     int objc, Tcl_Obj * CONST objv[])
-{
-     callback_map::iterator it = callbacks.find(interp);
-     if (it == callbacks.end())
-     {
-          Tcl_SetResult(interp,
-               "Trying to invoke non-existent callback (wrong interpreter?)",
-               TCL_STATIC);
-          return TCL_ERROR;
-     }
-
-     string cmdName(Tcl_GetString(objv[0]));
-     callback_interp_map::iterator iti = it->second.find(cmdName);
-     if (iti == it->second.end())
-     {
-          Tcl_SetResult(interp,
-               "Trying to invoke non-existent callback (wrong cmd name?)",
-               TCL_STATIC);
-          return TCL_ERROR;
-     }
-
-     policies_map::iterator pit = call_policies.find(interp);
-     if (pit == call_policies.end())
-     {
-          Tcl_SetResult(interp,
-               "Trying to invoke callback with no known policies",
-               TCL_STATIC);
-          return TCL_ERROR;
-     }
-
-     policies_interp_map::iterator piti;
-     if (find_policies(interp, cmdName, piti) == false)
-     {
-          Tcl_SetResult(interp,
-               "Trying to invoke callback with no known policies",
-               TCL_STATIC);
-          return TCL_ERROR;
-     }
-
-     policies &pol = piti->second;
-
-     try
-     {
-          iti->second->invoke(interp, objc, objv, pol);
-
-          post_process_policies(interp, pol, objv, false);
-     }
-     catch (exception const &e)
-     {
-          Tcl_SetResult(interp, const_cast<char*>(e.what()), TCL_VOLATILE);
-          return TCL_ERROR;
-     }
-     catch (...)
-     {
-          Tcl_SetResult(interp, "Unknown error.", TCL_STATIC);
-          return TCL_ERROR;
-     }
-
-     return TCL_OK;
-}
-
-// generic "object" command handler
-extern "C"
-int object_handler(ClientData cd, Tcl_Interp *interp,
-     int objc, Tcl_Obj * CONST objv[])
-{
-     // here, client data points to the singleton object
-     // which is responsible for managing commands for
-     // objects of a given type
-
-     class_handler_base *chb = reinterpret_cast<class_handler_base*>(cd);
-
-     // the command name has the form 'pXXX' where XXX is the address
-     // of the "this" object
-
-     string const str(Tcl_GetString(objv[0]));
-     istringstream ss(str);
-     char dummy;
-     void *p;
-     ss >> dummy >> p;
-
-     try
-     {
-          string methodName(Tcl_GetString(objv[1]));
-          policies &pol = chb->get_policies(methodName);
-
-          chb->invoke(p, interp, objc, objv, pol);
-
-          post_process_policies(interp, pol, objv, true);
-     }
-     catch (exception const &e)
-     {
-          Tcl_SetResult(interp, const_cast<char*>(e.what()), TCL_VOLATILE);
-          return TCL_ERROR;
-     }
-     catch (...)
-     {
-          Tcl_SetResult(interp, "Unknown error.", TCL_STATIC);
-          return TCL_ERROR;
-     }
-
-     return TCL_OK;
-}
-
-// generic "constructor" command
-extern "C"
-int constructor_handler(ClientData cd, Tcl_Interp *interp,
-     int objc, Tcl_Obj * CONST objv[])
-{
-     // here, client data points to the singleton object
-     // which is responsible for managing commands for
-     // objects of a given type
-
-     class_handler_base *chb = reinterpret_cast<class_handler_base*>(cd);
-
-     callback_map::iterator it = constructors.find(interp);
-     if (it == constructors.end())
-     {
-          Tcl_SetResult(interp,
-               "Trying to invoke non-existent callback (wrong interpreter?)",
-               TCL_STATIC);
-          return TCL_ERROR;
-     }
-
-     string className(Tcl_GetString(objv[0]));
-     callback_interp_map::iterator iti = it->second.find(className);
-     if (iti == it->second.end())
-     {
-          Tcl_SetResult(interp,
-               "Trying to invoke non-existent callback (wrong class name?)",
-               TCL_STATIC);
-          return TCL_ERROR;
-     }
-
-     policies_interp_map::iterator piti;
-     if (find_policies(interp, className, piti) == false)
-     {
-          Tcl_SetResult(interp,
-               "Trying to invoke callback with no known policies",
-               TCL_STATIC);
-          return TCL_ERROR;
-     }
-
-     policies &pol = piti->second;
-
-     try
-     {
-          iti->second->invoke(interp, objc, objv, pol);
-
-          // if everything went OK, the result is the address of the
-          // new object in the 'pXXX' form
-          // - we can create a new command with this name
-
-          Tcl_CreateObjCommand(interp,
-               Tcl_GetString(Tcl_GetObjResult(interp)),
-               object_handler, static_cast<ClientData>(chb), 0);
-     }
-     catch (exception const &e)
-     {
-          Tcl_SetResult(interp, const_cast<char*>(e.what()), TCL_VOLATILE);
-          return TCL_ERROR;
-     }
-     catch (...)
-     {
-          Tcl_SetResult(interp, "Unknown error.", TCL_STATIC);
-          return TCL_ERROR;
-     }
-
-     return TCL_OK;
-}
-
-} // namespace anonymous
-
-Tcl::details::no_init_type Tcl::no_init;
-
-
-policies & policies::factory(string const &name)
-{
-     factory_ = name;
-     return *this;
-}
-
-policies & policies::sink(int index)
-{
-     sinks_.push_back(index);
-     return *this;
-}
-
-policies & policies::variadic()
-{
-     variadic_ = true;
-     return *this;
-}
-
-policies Tcl::factory(string const &name)
-{
-     return policies().factory(name);
-}
-
-policies Tcl::sink(int index)
-{
-     return policies().sink(index);
-}
-
-policies Tcl::variadic()
-{
-     return policies().variadic();
-}
-
-
-class_handler_base::class_handler_base()
-{
-     // default policies for the -delete command
-     policies_["-delete"] = policies();
-}
-
-void class_handler_base::register_method(string const &name,
-     shared_ptr<object_cmd_base> ocb, policies const &p)
-{
-     methods_[name] = ocb;
-     policies_[name] = p;
-}
-
-policies & class_handler_base::get_policies(string const &name)
-{
-     policies_map_type::iterator it = policies_.find(name);
-     if (it == policies_.end())
-     {
-          throw tcl_error("Trying to use non-existent policy: " + name);
-     }
-
-     return it->second;
-}
-
-
-object::object()
-     : interp_(0)
-{
-     obj_ = Tcl_NewObj();
-     Tcl_IncrRefCount(obj_);
-}
-
-object::object(bool b)
-     : interp_(0)
-{
-     obj_ = Tcl_NewBooleanObj(b);
-     Tcl_IncrRefCount(obj_);
-}
-
-object::object(char const *buf, size_t size)
-     : interp_(0)
-{
-     obj_ = Tcl_NewByteArrayObj(
-          reinterpret_cast<unsigned char const *>(buf),
-          static_cast<int>(size));
-     Tcl_IncrRefCount(obj_);
-}
-
-object::object(double d)
-     : interp_(0)
-{
-     obj_ = Tcl_NewDoubleObj(d);
-     Tcl_IncrRefCount(obj_);
-}
-
-object::object(int i)
-     : interp_(0)
-{
-     obj_ = Tcl_NewIntObj(i);
-     Tcl_IncrRefCount(obj_);
-}
-
-object::object(long l)
-     : interp_(0)
-{
-     obj_ = Tcl_NewLongObj(l);
-     Tcl_IncrRefCount(obj_);
-}
-
-object::object(char const *s)
-     : interp_(0)
-{
-     obj_ = Tcl_NewStringObj(s, -1);
-     Tcl_IncrRefCount(obj_);
-}
-
-object::object(string const &s)
-     : interp_(0)
-{
-     obj_ = Tcl_NewStringObj(s.data(), static_cast<int>(s.size()));
-     Tcl_IncrRefCount(obj_);
-}
-
-object::object(Tcl_Obj *o, bool shared)
-     : interp_(0)
-{
-     init(o, shared);
-}
-
-object::object(object const &other, bool shared)
-     : interp_(other.get_interp())
-{
-     init(other.obj_, shared);
-}
-
-void object::init(Tcl_Obj *o, bool shared)
-{
-     if (shared)
-     {
-          obj_ = o;
-     }
-     else
-     {
-          obj_ = Tcl_DuplicateObj(o);
-     }
-     Tcl_IncrRefCount(obj_);
-}
-
-object::~object()
-{
-     Tcl_DecrRefCount(obj_);
-}
-
-object & object::assign(bool b)
-{
-     Tcl_SetBooleanObj(obj_, b);
-     return *this;
-}
-
-object & object::resize(size_t size)
-{
-     Tcl_SetByteArrayLength(obj_, static_cast<int>(size));
-     return *this;
-}
-
-object & object::assign(char const *buf, size_t size)
-{
-     Tcl_SetByteArrayObj(obj_,
-          reinterpret_cast<unsigned char const *>(buf),
-          static_cast<int>(size));
-     return *this;
-}
-
-object & object::assign(double d)
-{
-     Tcl_SetDoubleObj(obj_, d);
-     return *this;
-}
-
-object & object::assign(int i)
-{
-     Tcl_SetIntObj(obj_, i);
-     return *this;
-}
-
-object & object::assign(long l)
-{
-     Tcl_SetLongObj(obj_, l);
-     return *this;
-}
-
-object & object::assign(char const *s)
-{
-     Tcl_SetStringObj(obj_, s, -1);
-     return *this;
-}
-
-object & object::assign(string const &s)
-{
-     Tcl_SetStringObj(obj_, s.data(), static_cast<int>(s.size()));
-     return *this;
-}
-
-object & object::assign(object const &other)
-{
-     object(other).swap(*this);
-     return *this;
-}
-
-object & object::assign(Tcl_Obj *o)
-{
-     object(o).swap(*this);
-     return *this;
-}
-
-object & object::swap(object &other)
-{
-     std::swap(obj_, other.obj_);
-     std::swap(interp_, other.interp_);
-     return *this;
-}
-
-template <>
-bool object::get<bool>(interpreter &i) const
-{
-     int retVal;
-     int res = Tcl_GetBooleanFromObj(i.get(), obj_, &retVal);
-     if (res != TCL_OK)
-     {
-          throw tcl_error(i.get());
-     }
-
-     return static_cast<bool>(retVal);
-}
-
-template <>
-vector<char> object::get<vector<char> >(interpreter &) const
-{
-     size_t size;
-     char const *buf = get(size);
-     return vector<char>(buf, buf + size);
-}
-
-template <>
-double object::get<double>(interpreter &i) const
-{
-     double retVal;
-     int res = Tcl_GetDoubleFromObj(i.get(), obj_, &retVal);
-     if (res != TCL_OK)
-     {
-          throw tcl_error(i.get());
-     }
-
-     return retVal;
-}
-
-template <>
-int object::get<int>(interpreter &i) const
-{
-     int retVal;
-
-     int res = Tcl_GetIntFromObj(i.get(), obj_, &retVal);
-     if (res != TCL_OK)
-     {
-          throw tcl_error(i.get());
-     }
-
-     return retVal;
-}
-
-template <>
-long object::get<long>(interpreter &i) const
-{
-     long retVal;
-     int res = Tcl_GetLongFromObj(i.get(), obj_, &retVal);
-     if (res != TCL_OK)
-     {
-          throw tcl_error(i.get());
-     }
-
-     return retVal;
-}
-
-template <>
-char const * object::get<char const *>(interpreter &) const
-{
-     return get();
-}
-
-template <>
-string object::get<string>(interpreter &) const
-{
-     int len;
-     char const *buf = Tcl_GetStringFromObj(obj_, &len);
-     return string(buf, buf + len);
-}
-
-char const * object::get() const
-{
-     return Tcl_GetString(obj_);
-}
-
-char const * object::get(size_t &size) const
-{
-     int len;
-     unsigned char *buf = Tcl_GetByteArrayFromObj(obj_, &len);
-     size = len;
-     return const_cast<char const *>(reinterpret_cast<char *>(buf));
-}
-
-size_t object::length(interpreter &i) const
-{
-     int len;
-     int res = Tcl_ListObjLength(i.get(), obj_, &len);
-
-     if (res != TCL_OK)
-     {
-          throw tcl_error(i.get());
-     }
-
-     return static_cast<size_t>(len);
-}
-
-object object::at(interpreter &i, size_t index) const
-{
-     Tcl_Obj *o;
-     int res = Tcl_ListObjIndex(i.get(), obj_, static_cast<int>(index), &o);
-     if (res != TCL_OK)
-     {
-          throw tcl_error(i.get());
-     }
-     if (o == NULL)
-     {
-          throw tcl_error("Index out of range.");
-     }
-
-     return object(o);
-}
-
-object & object::append(interpreter &i, object const &o)
-{
-     int res = Tcl_ListObjAppendElement(i.get(), obj_, o.obj_);
-     if (res != TCL_OK)
-     {
-          throw tcl_error(i.get());
-     }
-
-     return *this;
-}
-
-object & object::append_list(interpreter &i, object const &o)
-{
-     int res = Tcl_ListObjAppendList(i.get(), obj_, o.obj_);
-     if (res != TCL_OK)
-     {
-          throw tcl_error(i.get());
-     }
-
-     return *this;
-}
-
-object & object::replace(interpreter &i, size_t index, size_t count,
-     object const &o)
-{
-     int res = Tcl_ListObjReplace(i.get(), obj_,
-          static_cast<int>(index), static_cast<int>(count),
-          1, &(o.obj_));
-     if (res != TCL_OK)
-     {
-          throw tcl_error(i.get());
-     }
-
-     return *this;
-}
-
-object & object::replace_list(interpreter &i, size_t index, size_t count,
-     object const &o)
-{
-     int objc;
-     Tcl_Obj **objv;
-
-     int res = Tcl_ListObjGetElements(i.get(), o.obj_, &objc, &objv);
-     if (res != TCL_OK)
-     {
-          throw tcl_error(i.get());
-     }
-
-     res = Tcl_ListObjReplace(i.get(), obj_,
-          static_cast<int>(index), static_cast<int>(count),
-          objc, objv);
-     if (res != TCL_OK)
-     {
-          throw tcl_error(i.get());
-     }
-
-     return *this;
-}
-
-void object::set_interp(Tcl_Interp *interp)
-{
-     interp_ = interp;
-}
-
-Tcl_Interp * object::get_interp() const
-{
-     return interp_;
-}
-
-
-interpreter::interpreter()
-{
-     interp_ =  Tcl_CreateInterp();
-     owner_ = true;
-}
-
-interpreter::interpreter(string const &libpath)
-{
-     interp_ =  Tcl_CreateInterp();
-     owner_ = true;
-
-     try
-     {
-        this->eval("set tcl_library " + libpath);
-        Tcl_Init(this->interp_);
-     } catch (...) {}
-}
-
-interpreter::interpreter(Tcl_Interp *interp, bool owner)
-{
-     interp_ =  interp;
-     owner_ = owner;
-}
-
-interpreter::~interpreter()
-{
-     if (owner_)
-     {
-          // clear all callback info belonging to this interpreter
-          clear_definitions(interp_);
-
-          Tcl_DeleteInterp(interp_);
-     }
-}
-
-void interpreter::make_safe()
-{
-     int cc = Tcl_MakeSafe(interp_);
-     if (cc != TCL_OK)
-     {
-          throw tcl_error(interp_);
-     }
-}
-
-result interpreter::eval(string const &script)
-{
-     int cc = Tcl_Eval(interp_, script.c_str());
-     if (cc != TCL_OK)
-     {
-          throw tcl_error(interp_);
-     }
-
-     return result(interp_);
-}
-
-result interpreter::eval(istream &s)
-{
-     string str(
-          istreambuf_iterator<char>(s.rdbuf()),
-          istreambuf_iterator<char>()
-     );
-     return eval(str);
-}
-
-result interpreter::eval(object const &o)
-{
-     int cc = Tcl_EvalObjEx(interp_, o.get_object(), 0);
-     if (cc != TCL_OK)
-     {
-          throw tcl_error(interp_);
-     }
-
-     return result(interp_);
-}
-
-void interpreter::pkg_provide(string const &name, string const &version)
-{
-     int cc = Tcl_PkgProvide(interp_, name.c_str(), version.c_str());
-     if (cc != TCL_OK)
-     {
-          throw tcl_error(interp_);
-     }
-}
-
-void interpreter::create_alias(string const &cmd,
-     interpreter &targetInterp, string const &targetCmd)
-{
-     int cc = Tcl_CreateAlias(interp_, cmd.c_str(),
-          targetInterp.interp_, targetCmd.c_str(), 0, 0);
-     if (cc != TCL_OK)
-     {
-          throw tcl_error(interp_);
-     }
-}
-
-void interpreter::clear_definitions(Tcl_Interp *interp)
-{
-     // delete all callbacks that were registered for given interpreter
-
-     {
-          // TODO: why could this probably be necessary? map::find of empty map
-          // shouldn't be a problem.
-          if (callbacks.size() == 0)
-            return;
-          callback_map::iterator it = callbacks.find(interp);
-          if (it == callbacks.end())
-          {
-               // no callbacks defined for this interpreter
-               return;
-          }
-
-          callback_interp_map &imap = it->second;
-          for (callback_interp_map::iterator it2 = imap.begin();
-               it2 != imap.end(); ++it2)
-          {
-               Tcl_DeleteCommand(interp, it2->first.c_str());
-          }
-
-          callbacks.erase(interp);
-     }
-
-     // delete all constructors
-
-     {
-          callback_map::iterator it = constructors.find(interp);
-          if (it == constructors.end())
-          {
-               // no callbacks defined for this interpreter
-               return;
-          }
-
-          callback_interp_map &imap = it->second;
-          for (callback_interp_map::iterator it2 = imap.begin();
-               it2 != imap.end(); ++it2)
-          {
-               Tcl_DeleteCommand(interp, it2->first.c_str());
-          }
-
-          callbacks.erase(interp);
-     }
-
-     // delete all call policies
-
-     call_policies.erase(interp);
-
-     // delete all object handlers
-     // (we have to assume that all living objects were destroyed,
-     // otherwise Bad Things will happen)
-
-     class_handlers.erase(interp);
-}
-
-void interpreter::add_function(string const &name,
-     shared_ptr<callback_base> cb, policies const &p)
-{
-     Tcl_CreateObjCommand(interp_, name.c_str(),
-          callback_handler, 0, 0);
-
-     callbacks[interp_][name] = cb;
-     call_policies[interp_][name] = p;
-}
-
-void interpreter::add_class(string const &name,
-     shared_ptr<class_handler_base> chb)
-{
-     class_handlers[interp_][name] = chb;
-}
-
-void interpreter::add_constructor(string const &name,
-     shared_ptr<class_handler_base> chb, shared_ptr<callback_base> cb,
-     policies const &p)
-{
-     Tcl_CreateObjCommand(interp_, name.c_str(),
-          constructor_handler, static_cast<ClientData>(chb.get()), 0);
-
-     constructors[interp_][name] = cb;
-     call_policies[interp_][name] = p;
-}
-
-
-int tcl_cast<int>::from(Tcl_Interp *interp, Tcl_Obj *obj)
-{
-     int res;
-     int cc = Tcl_GetIntFromObj(interp, obj, &res);
-     if (cc != TCL_OK)
-     {
-          throw tcl_error(interp);
-     }
-
-     return res;
-}
-
-long tcl_cast<long>::from(Tcl_Interp *interp, Tcl_Obj *obj)
-{
-     long res;
-     int cc = Tcl_GetLongFromObj(interp, obj, &res);
-     if (cc != TCL_OK)
-     {
-          throw tcl_error(interp);
-     }
-
-     return res;
-}
-
-bool tcl_cast<bool>::from(Tcl_Interp *interp, Tcl_Obj *obj)
-{
-     int res;
-     int cc = Tcl_GetBooleanFromObj(interp, obj, &res);
-     if (cc != TCL_OK)
-     {
-          throw tcl_error(interp);
-     }
-
-     return res != 0;
-}
-
-double tcl_cast<double>::from(Tcl_Interp *interp, Tcl_Obj *obj)
-{
-     double res;
-     int cc = Tcl_GetDoubleFromObj(interp, obj, &res);
-     if (cc != TCL_OK)
-     {
-          throw tcl_error(interp);
-     }
-
-     return res;
-}
-
-string tcl_cast<string>::from(Tcl_Interp *, Tcl_Obj *obj)
-{
-     return Tcl_GetString(obj);
-}
-
-char const * tcl_cast<char const *>::from(Tcl_Interp *, Tcl_Obj *obj)
-{
-     return Tcl_GetString(obj);
-}
-
-object tcl_cast<object>::from(Tcl_Interp *interp, Tcl_Obj *obj)
-{
-     object o(obj);
-     o.set_interp(interp);
-
-     return o;
-}
Index: de/branches/buildsystem3/src/cpptcl/CppTcl.h
===================================================================
--- /code/branches/buildsystem3/src/cpptcl/CppTcl.h	(revision 2663)
+++ 	(revision )
@@ -1,871 +1,0 @@
-//
-// Copyright (C) 2004-2006, Maciej Sobczak
-//
-// Permission to copy, use, modify, sell and distribute this software
-// is granted provided this copyright notice appears in all copies.
-// This software is provided "as is" without express or implied
-// warranty, and with no claim as to its suitability for any purpose.
-//
-
-#ifndef CPPTCL_INCLUDED
-#define CPPTCL_INCLUDED
-
-#include <tcl.h>
-#include <string>
-#include <stdexcept>
-#include <sstream>
-#include <map>
-#include <vector>
-#include <boost/shared_ptr.hpp>
-#include <boost/bind.hpp>
-
-
-namespace Tcl
-{
-
-// exception class used for reporting all Tcl errors
-
-class tcl_error : public std::runtime_error
-{
-public:
-     explicit tcl_error(std::string const &msg)
-          : std::runtime_error(msg) {}
-     explicit tcl_error(Tcl_Interp *interp)
-          : std::runtime_error(Tcl_GetString(Tcl_GetObjResult(interp))) {}
-};
-
-// call policies
-
-struct policies
-{
-     policies() : variadic_(false) {}
-
-     policies & factory(std::string const &name);
-
-     // note: this is additive
-     policies & sink(int index);
-
-     policies & variadic();
-
-     std::string factory_;
-     std::vector<int> sinks_;
-     bool variadic_;
-};
-
-// syntax short-cuts
-policies factory(std::string const &name);
-policies sink(int index);
-policies variadic();
-
-
-class interpreter;
-class object;
-
-namespace details
-{
-
-// wrapper for the evaluation result
-class result
-{
-public:
-     result(Tcl_Interp *interp);
-
-     operator bool() const;
-     operator double() const;
-     operator int() const;
-     operator long() const;
-     operator std::string() const;
-     operator object() const;
-
-private:
-     Tcl_Interp *interp_;
-};
-
-// helper functions used to set the result value
-
-void set_result(Tcl_Interp *interp, bool b);
-void set_result(Tcl_Interp *interp, int i);
-void set_result(Tcl_Interp *interp, long i);
-void set_result(Tcl_Interp *interp, double d);
-void set_result(Tcl_Interp *interp, std::string const &s);
-void set_result(Tcl_Interp *interp, void *p);
-void set_result(Tcl_Interp *interp, object const &o);
-
-// helper functor for converting Tcl objects to the given type
-#include "details/conversions.h"
-
-// dispatchers able to capture (or ignore) the result
-#include "details/dispatchers.h"
-
-// helper for checking for required number of parameters
-// (throws tcl_error when not met)
-void check_params_no(int objc, int required);
-
-// helper for gathering optional params in variadic functions
-object get_var_params(Tcl_Interp *interp,
-     int objc, Tcl_Obj * CONST objv[],
-     int from, policies const &pol);
-
-// the callback_base is used to store callback handlers in a polynorphic map
-class callback_base
-{
-public:
-     virtual ~callback_base() {}
-
-     virtual void invoke(Tcl_Interp *interp,
-          int objc, Tcl_Obj * CONST objv[],
-          policies const &pol) = 0;
-};
-
-
-// base class for object command handlers
-// and for class handlers
-class object_cmd_base
-{
-public:
-     // destructor not needed, but exists to shut up the compiler warnings
-     virtual ~object_cmd_base() {}
-
-     virtual void invoke(void *p, Tcl_Interp *interp,
-          int objc, Tcl_Obj * CONST objv[],
-          policies const &pol) = 0;
-};
-
-// base class for all class handlers, still abstract
-class class_handler_base : public object_cmd_base
-{
-public:
-     typedef std::map<std::string, policies> policies_map_type;
-
-     class_handler_base();
-
-     void register_method(std::string const &name,
-          boost::shared_ptr<object_cmd_base> ocb, policies const &p);
-
-     policies & get_policies(std::string const &name);
-
-protected:
-     typedef std::map<
-          std::string,
-          boost::shared_ptr<object_cmd_base>
-          > method_map_type;
-
-     // a map of methods for the given class
-     method_map_type methods_;
-
-     policies_map_type policies_;
-};
-
-// class handler - responsible for executing class methods
-template <class C>
-class class_handler : public class_handler_base
-{
-public:
-     virtual void invoke(void *pv, Tcl_Interp *interp,
-          int objc, Tcl_Obj * CONST objv[], policies const &pol)
-     {
-          C * p = static_cast<C*>(pv);
-
-          if (objc < 2)
-          {
-               throw tcl_error("Too few arguments.");
-          }
-
-          std::string methodName(Tcl_GetString(objv[1]));
-
-          if (methodName == "-delete")
-          {
-               Tcl_DeleteCommand(interp, Tcl_GetString(objv[0]));
-               delete p;
-               return;
-          }
-
-          // dispatch on the method name
-
-          method_map_type::iterator it = methods_.find(methodName);
-          if (it == methods_.end())
-          {
-               throw tcl_error("Method " + methodName + " not found.");
-          }
-
-          it->second->invoke(pv, interp, objc, objv, pol);
-     }
-};
-
-
-// factory functions for creating class objects
-#include "details/constructors.h"
-
-// actual callback envelopes
-#include "details/callbacks.h"
-
-// actual method envelopes
-#include "details/methods.h"
-
-// helper meta function for figuring appropriate constructor callback
-#include "details/metahelpers.h"
-
-
-// this class is used to provide the "def" interface for defining
-// class member functions
-
-template <class C>
-class class_definer
-{
-public:
-     class_definer(boost::shared_ptr<class_handler<C> > ch) : ch_(ch) {}
-
-     template <typename R>
-     class_definer & def(std::string const &name, R (C::*f)(),
-          policies const &p = policies())
-     {
-          ch_->register_method(name,
-               boost::shared_ptr<details::object_cmd_base>(
-                    new details::method0<C, R>(f)), p);
-          return *this;
-     }
-
-     template <typename R>
-     class_definer & def(std::string const &name, R (C::*f)() const,
-          policies const &p = policies())
-     {
-          ch_->register_method(name,
-               boost::shared_ptr<details::object_cmd_base>(
-                    new details::method0<C, R>(f)), p);
-          return *this;
-     }
-
-     template <typename R, typename T1>
-     class_definer & def(std::string const &name, R (C::*f)(T1),
-          policies const &p = policies())
-     {
-          ch_->register_method(name,
-               boost::shared_ptr<details::object_cmd_base>(
-                    new details::method1<C, R, T1>(f)), p);
-          return *this;
-     }
-
-     template <typename R, typename T1>
-     class_definer & def(std::string const &name, R (C::*f)(T1) const,
-          policies const &p = policies())
-     {
-          ch_->register_method(name,
-               boost::shared_ptr<details::object_cmd_base>(
-                    new details::method1<C, R, T1>(f)), p);
-          return *this;
-     }
-
-     template <typename R, typename T1, typename T2>
-     class_definer & def(std::string const &name, R (C::*f)(T1, T2),
-          policies const &p = policies())
-     {
-          ch_->register_method(name,
-               boost::shared_ptr<details::object_cmd_base>(
-                    new details::method2<C, R, T1, T2>(f)), p);
-          return *this;
-     }
-
-     template <typename R, typename T1, typename T2>
-     class_definer & def(std::string const &name, R (C::*f)(T1, T2) const,
-          policies const &p = policies())
-     {
-          ch_->register_method(name,
-               boost::shared_ptr<details::object_cmd_base>(
-                    new details::method2<C, R, T1, T2>(f)), p);
-          return *this;
-     }
-
-     template <typename R, typename T1, typename T2, typename T3>
-     class_definer & def(std::string const &name, R (C::*f)(T1, T2, T3),
-          policies const &p = policies())
-     {
-          ch_->register_method(name,
-               boost::shared_ptr<details::object_cmd_base>(
-                    new details::method3<C, R, T1, T2, T3>(f)), p);
-          return *this;
-     }
-
-     template <typename R, typename T1, typename T2, typename T3>
-     class_definer & def(std::string const &name, R (C::*f)(T1, T2, T3) const,
-          policies const &p = policies())
-     {
-          ch_->register_method(name,
-               boost::shared_ptr<details::object_cmd_base>(
-                    new details::method3<C, R, T1, T2, T3>(f)), p);
-          return *this;
-     }
-
-     template <typename R, typename T1, typename T2, typename T3, typename T4>
-     class_definer & def(std::string const &name, R (C::*f)(T1, T2, T3, T4),
-          policies const &p = policies())
-     {
-          ch_->register_method(name,
-               boost::shared_ptr<details::object_cmd_base>(
-                    new details::method4<C, R, T1, T2, T3, T4>(f)), p);
-          return *this;
-     }
-
-     template <typename R, typename T1, typename T2, typename T3, typename T4>
-     class_definer & def(std::string const &name,
-          R (C::*f)(T1, T2, T3, T4) const,
-          policies const &p = policies())
-     {
-          ch_->register_method(name,
-               boost::shared_ptr<details::object_cmd_base>(
-                    new details::method4<C, R, T1, T2, T3, T4>(f)), p);
-          return *this;
-     }
-
-     template <typename R, typename T1, typename T2, typename T3, typename T4,
-          typename T5>
-     class_definer & def(std::string const &name,
-          R (C::*f)(T1, T2, T3, T4, T5), policies const &p = policies())
-     {
-          ch_->register_method(name,
-               boost::shared_ptr<details::object_cmd_base>(
-                    new details::method5<C, R, T1, T2, T3, T4, T5>(f)), p);
-          return *this;
-     }
-
-     template <typename R, typename T1, typename T2, typename T3, typename T4,
-          typename T5>
-     class_definer & def(std::string const &name,
-          R (C::*f)(T1, T2, T3, T4, T5) const, policies const &p = policies())
-     {
-          ch_->register_method(name,
-               boost::shared_ptr<details::object_cmd_base>(
-                    new details::method5<C, R, T1, T2, T3, T4, T5>(f)), p);
-          return *this;
-     }
-
-     template <typename R, typename T1, typename T2, typename T3, typename T4,
-          typename T5, typename T6>
-     class_definer & def(std::string const &name,
-          R (C::*f)(T1, T2, T3, T4, T5, T6), policies const &p = policies())
-     {
-          ch_->register_method(name,
-               boost::shared_ptr<details::object_cmd_base>(
-                    new details::method6<C, R, T1, T2, T3, T4, T5, T6>(f)),
-               p);
-          return *this;
-     }
-
-     template <typename R, typename T1, typename T2, typename T3, typename T4,
-          typename T5, typename T6>
-     class_definer & def(std::string const &name,
-          R (C::*f)(T1, T2, T3, T4, T5, T6) const,
-          policies const &p = policies())
-     {
-          ch_->register_method(name,
-               boost::shared_ptr<details::object_cmd_base>(
-                    new details::method6<C, R, T1, T2, T3, T4, T5, T6>(f)),
-               p);
-          return *this;
-     }
-
-     template <typename R, typename T1, typename T2, typename T3, typename T4,
-          typename T5, typename T6, typename T7>
-     class_definer & def(std::string const &name,
-          R (C::*f)(T1, T2, T3, T4, T5, T6, T7),
-          policies const &p = policies())
-     {
-          ch_->register_method(name,
-               boost::shared_ptr<details::object_cmd_base>(
-                    new details::method7<C, R,
-                    T1, T2, T3, T4, T5, T6, T7>(f)), p);
-          return *this;
-     }
-
-     template <typename R, typename T1, typename T2, typename T3, typename T4,
-          typename T5, typename T6, typename T7>
-     class_definer & def(std::string const &name,
-          R (C::*f)(T1, T2, T3, T4, T5, T6, T7) const,
-          policies const &p = policies())
-     {
-          ch_->register_method(name,
-               boost::shared_ptr<details::object_cmd_base>(
-                    new details::method7<C, R,
-                    T1, T2, T3, T4, T5, T6, T7>(f)), p);
-          return *this;
-     }
-
-     template <typename R, typename T1, typename T2, typename T3, typename T4,
-          typename T5, typename T6, typename T7, typename T8>
-     class_definer & def(std::string const &name,
-          R (C::*f)(T1, T2, T3, T4, T5, T6, T7, T8),
-          policies const &p = policies())
-     {
-          ch_->register_method(name,
-               boost::shared_ptr<details::object_cmd_base>(
-                    new details::method8<C, R,
-                    T1, T2, T3, T4, T5, T6, T7, T8>(f)), p);
-          return *this;
-     }
-
-     template <typename R, typename T1, typename T2, typename T3, typename T4,
-          typename T5, typename T6, typename T7, typename T8>
-     class_definer & def(std::string const &name,
-          R (C::*f)(T1, T2, T3, T4, T5, T6, T7, T8) const,
-          policies const &p = policies())
-     {
-          ch_->register_method(name,
-               boost::shared_ptr<details::object_cmd_base>(
-                    new details::method8<C, R,
-                    T1, T2, T3, T4, T5, T6, T7, T8>(f)), p);
-          return *this;
-     }
-
-     template <typename R, typename T1, typename T2, typename T3, typename T4,
-          typename T5, typename T6, typename T7, typename T8, typename T9>
-     class_definer & def(std::string const &name,
-          R (C::*f)(T1, T2, T3, T4, T5, T6, T7, T8, T9),
-          policies const &p = policies())
-     {
-          ch_->register_method(name,
-               boost::shared_ptr<details::object_cmd_base>(
-                    new details::method9<C, R,
-                    T1, T2, T3, T4, T5, T6, T7, T8, T9>(f)), p);
-          return *this;
-     }
-
-     template <typename R, typename T1, typename T2, typename T3, typename T4,
-          typename T5, typename T6, typename T7, typename T8, typename T9>
-     class_definer & def(std::string const &name,
-          R (C::*f)(T1, T2, T3, T4, T5, T6, T7, T8, T9) const,
-          policies const &p = policies())
-     {
-          ch_->register_method(name,
-               boost::shared_ptr<details::object_cmd_base>(
-                    new details::method9<C, R,
-                    T1, T2, T3, T4, T5, T6, T7, T8, T9>(f)), p);
-          return *this;
-     }
-
-private:
-     boost::shared_ptr<class_handler<C> > ch_;
-};
-
-} // namespace details
-
-
-// init type for defining class constructors
-template <typename T1 = void, typename T2 = void, typename T3 = void,
-          typename T4 = void, typename T5 = void, typename T6 = void,
-          typename T7 = void, typename T8 = void, typename T9 = void>
-class init {};
-
-// no_init type and object - to define classes without constructors
-namespace details
-{
-     struct no_init_type {};
-} // namespace details
-extern details::no_init_type no_init;
-
-
-// interpreter wrapper
-class interpreter
-{
-public:
-     interpreter();
-     interpreter(std::string const &libpath);
-     interpreter(Tcl_Interp *, bool owner = true);
-     ~interpreter();
-
-     void make_safe();
-
-     Tcl_Interp * get() const { return interp_; }
-
-     // free function definitions
-
-     template <typename R>
-     void def(std::string const &name, R (*f)(),
-          policies const &p = policies())
-     {
-          add_function(name,
-               boost::shared_ptr<details::callback_base>(
-                    new details::callback0<R>(f)), p);
-     }
-
-     template <typename R, typename T1>
-     void def(std::string const &name, R (*f)(T1),
-          policies const &p = policies())
-     {
-          add_function(name,
-               boost::shared_ptr<details::callback_base>(
-                    new details::callback1<R, T1>(f)), p);
-     }
-
-     template <typename R, typename T1, typename T2>
-     void def(std::string const &name, R (*f)(T1, T2),
-          policies const &p = policies())
-     {
-          add_function(name,
-               boost::shared_ptr<details::callback_base>(
-                    new details::callback2<R, T1, T2>(f)), p);
-     }
-
-     template <typename R, typename T1, typename T2, typename T3>
-     void def(std::string const &name, R (*f)(T1, T2, T3),
-          policies const &p = policies())
-     {
-          add_function(name,
-               boost::shared_ptr<details::callback_base>(
-                    new details::callback3<R, T1, T2, T3>(f)), p);
-     }
-
-     template <typename R, typename T1, typename T2, typename T3, typename T4>
-     void def(std::string const &name, R (*f)(T1, T2, T3, T4),
-          policies const &p = policies())
-     {
-          add_function(name,
-               boost::shared_ptr<details::callback_base>(
-                    new details::callback4<R, T1, T2, T3, T4>(f)), p);
-     }
-
-     template <typename R, typename T1, typename T2, typename T3,
-          typename T4, typename T5>
-     void def(std::string const &name, R (*f)(T1, T2, T3, T4, T5),
-          policies const &p = policies())
-     {
-          add_function(name,
-               boost::shared_ptr<details::callback_base>(
-                    new details::callback5<R, T1, T2, T3, T4, T5>(f)), p);
-     }
-
-     template <typename R, typename T1, typename T2, typename T3,
-          typename T4, typename T5, typename T6>
-     void def(std::string const &name, R (*f)(T1, T2, T3, T4, T5, T6),
-          policies const &p = policies())
-     {
-          add_function(name,
-               boost::shared_ptr<details::callback_base>(
-                    new details::callback6<R, T1, T2, T3, T4, T5, T6>(f)), p);
-     }
-
-     template <typename R, typename T1, typename T2, typename T3,
-          typename T4, typename T5, typename T6, typename T7>
-     void def(std::string const &name, R (*f)(T1, T2, T3, T4, T5, T6, T7),
-          policies const &p = policies())
-     {
-          add_function(name,
-               boost::shared_ptr<details::callback_base>(
-                    new details::callback7<R,
-                    T1, T2, T3, T4, T5, T6, T7>(f)), p);
-     }
-
-     template <typename R, typename T1, typename T2, typename T3,
-          typename T4, typename T5, typename T6, typename T7, typename T8>
-     void def(std::string const &name, R (*f)(T1, T2, T3, T4, T5, T6, T7, T8),
-          policies const &p = policies())
-     {
-          add_function(name,
-               boost::shared_ptr<details::callback_base>(
-                    new details::callback8<R,
-                    T1, T2, T3, T4, T5, T6, T7, T8>(f)), p);
-     }
-
-     template <typename R, typename T1, typename T2, typename T3,
-          typename T4, typename T5, typename T6, typename T7, typename T8,
-          typename T9>
-     void def(std::string const &name,
-          R (*f)(T1, T2, T3, T4, T5, T6, T7, T8, T9),
-          policies const &p = policies())
-     {
-          add_function(name,
-               boost::shared_ptr<details::callback_base>(
-                    new details::callback9<R,
-                    T1, T2, T3, T4, T5, T6, T7, T8, T9>(f)), p);
-     }
-
-
-     // class definitions
-
-     template <class C>
-     details::class_definer<C> class_(std::string const &name)
-     {
-          boost::shared_ptr<details::class_handler<C> > ch(
-               new details::class_handler<C>());
-
-          add_class(name, ch);
-
-          add_constructor(name, ch,
-               boost::shared_ptr<details::callback_base>(
-                    new details::callback0<C*>(&details::construct<
-                         C, void, void, void, void, void, void, void,
-                         void, void>::doit)));
-
-          return details::class_definer<C>(ch);
-     }
-
-     template <class C, typename T1, typename T2, typename T3, typename T4,
-               typename T5, typename T6, typename T7, typename T8,
-               typename T9>
-     details::class_definer<C> class_(std::string const &name,
-          init<T1, T2, T3, T4, T5, T6, T7, T8, T9> const &,
-          policies const &p = policies())
-     {
-          typedef typename details::get_callback_type_for_construct<
-               C, T1, T2, T3, T4, T5, T6, T7, T8, T9>::type
-               callback_type;
-
-          boost::shared_ptr<details::class_handler<C> > ch(
-               new details::class_handler<C>());
-
-          add_class(name, ch);
-
-          add_constructor(name, ch,
-               boost::shared_ptr<details::callback_base>(
-                    new callback_type(&details::construct<
-                         C, T1, T2, T3, T4, T5, T6, T7, T8, T9>::doit)), p);
-
-          return details::class_definer<C>(ch);
-     }
-
-     template <class C>
-     details::class_definer<C> class_(
-          std::string const &name, details::no_init_type const &)
-     {
-          boost::shared_ptr<details::class_handler<C> > ch(
-               new details::class_handler<C>());
-
-          add_class(name, ch);
-
-          return details::class_definer<C>(ch);
-     }
-
-     // free script evaluation
-     details::result eval(std::string const &script);
-     details::result eval(std::istream &s);
-
-     details::result eval(object const &o);
-
-     // the InputIterator should give object& or Tcl_Obj* when dereferenced
-     template <class InputIterator>
-     details::result eval(InputIterator first, InputIterator last);
-
-     // create alias from the *this interpreter to the target interpreter
-     void create_alias(std::string const &cmd,
-          interpreter &targetInterp, std::string const &targetCmd);
-
-     // register a package info (useful when defining packages)
-     void pkg_provide(std::string const &name, std::string const &version);
-
-     // helper for cleaning up callbacks in non-managed interpreters
-     static void clear_definitions(Tcl_Interp *);
-
-private:
-
-     // copy not supported
-     interpreter(const interpreter &);
-     void operator=(const interpreter &);
-
-     void add_function(std::string const &name,
-          boost::shared_ptr<details::callback_base> cb,
-          policies const &p = policies());
-
-     void add_class(std::string const &name,
-          boost::shared_ptr<details::class_handler_base> chb);
-
-     void add_constructor(std::string const &name,
-          boost::shared_ptr<details::class_handler_base> chb,
-          boost::shared_ptr<details::callback_base> cb,
-          policies const &p = policies());
-
-     Tcl_Interp *interp_;
-     bool owner_;
-};
-
-
-// object wrapper
-class object
-{
-public:
-
-     // constructors
-
-     object();
-
-     explicit object(bool b);
-     object(char const *buf, size_t size); // byte array
-     explicit object(double b);
-     explicit object(int i);
-
-     // list creation
-     // the InputIterator should give object& or Tcl_Obj* when dereferenced
-     template <class InputIterator>
-     object(InputIterator first, InputIterator last)
-          : interp_(0)
-     {
-          std::vector<Tcl_Obj*> v;
-          fill_vector(v, first, last);
-          obj_ = Tcl_NewListObj(static_cast<int>(v.size()),
-               v.empty() ? NULL : &v[0]);
-          Tcl_IncrRefCount(obj_);
-     }
-
-     explicit object(long i);
-     explicit object(char const *s);        // string construction
-     explicit object(std::string const &s); // string construction
-
-     explicit object(Tcl_Obj *o, bool shared = false);
-
-     object(object const &other, bool shared = false);
-     ~object();
-
-     // assignment
-
-     object & assign(bool b);
-     object & resize(size_t size);                  // byte array resize
-     object & assign(char const *buf, size_t size); // byte array assignment
-     object & assign(double d);
-     object & assign(int i);
-
-     // list assignment
-     // the InputIterator should give Tcl_Obj* or object& when dereferenced
-     template <class InputIterator>
-     object & assign(InputIterator first, InputIterator last)
-     {
-          std::vector<Tcl_Obj*> v;
-          fill_vector(v, first, last);
-          Tcl_SetListObj(obj_, static_cast<int>(v.size()),
-               v.empty() ? NULL : &v[0]);
-          return *this;
-     }
-
-     object & assign(long l);
-     object & assign(char const *s);        // string assignment
-     object & assign(std::string const &s); // string assignment
-     object & assign(object const &o);
-     object & assign(Tcl_Obj *o);
-
-     object & operator=(bool b)               { return assign(b); }
-     object & operator=(double d)             { return assign(d); }
-     object & operator=(int i)                { return assign(i); }
-     object & operator=(long l)               { return assign(l); }
-     object & operator=(char const *s)        { return assign(s); }
-     object & operator=(std::string const &s) { return assign(s); }
-
-     object & operator=(object const &o)      { return assign(o); }
-     object & swap(object &other);
-
-     // (logically) non-modifying members
-
-     template <typename T>
-     T get(interpreter &i) const;
-
-     char const * get() const;             // string get
-     char const * get(size_t &size) const; // byte array get
-
-     size_t length(interpreter &i) const;  // returns list length
-     object at(interpreter &i, size_t index) const;
-
-     Tcl_Obj * get_object() const { return obj_; }
-
-     // modifying members
-
-     object & append(interpreter &i, object const &o);
-     object & append_list(interpreter &i, object const &o);
-
-     // list replace
-     // the InputIterator should give Tcl_Obj* or object& when dereferenced
-     template <class InputIterator>
-     object & replace(interpreter &i, size_t index, size_t count,
-          InputIterator first, InputIterator last)
-     {
-          std::vector<Tcl_Obj*> v;
-          fill_vector(v, first, last);
-          int res = Tcl_ListObjReplace(i.get(), obj_,
-               static_cast<int>(index), static_cast<int>(count),
-               static_cast<int>(v.size()), v.empty() ? NULL : &v[0]);
-          if (res != TCL_OK)
-          {
-               throw tcl_error(i.get());
-          }
-
-          return *this;
-     }
-
-     object & replace(interpreter &i, size_t index, size_t count,
-          object const &o);
-     object & replace_list(interpreter &i, size_t index, size_t count,
-          object const &o);
-
-     // helper functions for piggy-backing interpreter info
-     void set_interp(Tcl_Interp *interp);
-     Tcl_Interp * get_interp() const;
-
-     // helper function, also used from interpreter::eval
-     template <class InputIterator>
-     static void fill_vector(std::vector<Tcl_Obj*> &v,
-          InputIterator first, InputIterator last)
-     {
-          for (; first != last; ++first)
-          {
-               object o(*first, true);
-               v.push_back(o.obj_);
-          }
-     }
-
-private:
-
-     // helper function used from copy constructors
-     void init(Tcl_Obj *o, bool shared);
-
-     Tcl_Obj *obj_;
-     Tcl_Interp *interp_;
-};
-
-// available specializations for object::get
-template <> bool         object::get<bool>(interpreter &i) const;
-template <> double       object::get<double>(interpreter &i) const;
-template <> int          object::get<int>(interpreter &i) const;
-template <> long         object::get<long>(interpreter &i) const;
-template <> char const * object::get<char const *>(interpreter &i) const;
-template <> std::string  object::get<std::string>(interpreter &i) const;
-template <>
-std::vector<char> object::get<std::vector<char> >(interpreter &i) const;
-
-// the InputIterator should give object& or Tcl_Obj* when dereferenced
-template <class InputIterator>
-details::result interpreter::eval(InputIterator first, InputIterator last)
-{
-     std::vector<Tcl_Obj*> v;
-     object::fill_vector(v, first, last);
-     int cc = Tcl_EvalObjv(interp_,
-          static_cast<int>(v.size()), v.empty() ? NULL : &v[0], 0);
-     if (cc != TCL_OK)
-     {
-          throw tcl_error(interp_);
-     }
-
-     return details::result(interp_);
-}
-
-namespace details
-{
-
-// additional callback envelopes for variadic functions
-#include "details/callbacks_v.h"
-
-// additional method envelopes for variadic methods
-#include "details/methods_v.h"
-
-} // namespace details
-
-} // namespace Tcl
-
-
-// macro for defining loadable module entry point
-// - used for extending Tcl interpreter
-
-#define CPPTCL_MODULE(name, i) void name##_cpptcl_Init(Tcl::interpreter &i); \
-     extern "C" int name##_Init(Tcl_Interp *interp) \
-     { \
-          Tcl::interpreter i(interp, false); \
-          name##_cpptcl_Init(i); \
-          return TCL_OK; \
-     } \
-     void name##_cpptcl_Init(Tcl::interpreter &i)
-
-
-#endif // CPPTCL_INCLUDED
Index: /code/branches/buildsystem3/src/cpptcl/changes_orxonox.diff
===================================================================
--- /code/branches/buildsystem3/src/cpptcl/changes_orxonox.diff	(revision 2664)
+++ /code/branches/buildsystem3/src/cpptcl/changes_orxonox.diff	(revision 2664)
@@ -0,0 +1,58 @@
+--- cpptcl.cc	So Feb  8 23:14:34 2009
++++ cpptcl.cc	So Feb  8 23:13:07 2009
+@@ -320,7 +320,7 @@
+ 
+           post_process_policies(interp, pol, objv, false);
+      }
+-     catch (exception const &e)
++     catch (std::exception const &e)
+      {
+           Tcl_SetResult(interp, const_cast<char*>(e.what()), TCL_VOLATILE);
+           return TCL_ERROR;
+@@ -363,7 +363,7 @@
+ 
+           post_process_policies(interp, pol, objv, true);
+      }
+-     catch (exception const &e)
++     catch (std::exception const &e)
+      {
+           Tcl_SetResult(interp, const_cast<char*>(e.what()), TCL_VOLATILE);
+           return TCL_ERROR;
+@@ -430,7 +430,7 @@
+                Tcl_GetString(Tcl_GetObjResult(interp)),
+                object_handler, static_cast<ClientData>(chb), 0);
+      }
+-     catch (exception const &e)
++     catch (std::exception const &e)
+      {
+           Tcl_SetResult(interp, const_cast<char*>(e.what()), TCL_VOLATILE);
+           return TCL_ERROR;
+@@ -858,6 +858,18 @@
+      owner_ = true;
+ }
+ 
++interpreter::interpreter(string const &libpath)
++{
++     interp_ =  Tcl_CreateInterp();
++     owner_ = true;
++
++     try
++     {
++        this->eval("set tcl_library " + libpath);
++        Tcl_Init(this->interp_);
++     } catch (...) {}
++}
++
+ interpreter::interpreter(Tcl_Interp *interp, bool owner)
+ {
+      interp_ =  interp;
+--- cpptcl.h	Wed Jan 28 20:56:11 2009
++++ cpptcl.h	Sat Jan 24 12:52:54 2009
+@@ -467,6 +467,7 @@
+ {
+ public:
+      interpreter();
++     interpreter(std::string const &libpath);
+      interpreter(Tcl_Interp *, bool owner = true);
+      ~interpreter();
+      
Index: /code/branches/buildsystem3/src/cpptcl/cpptcl.cc
===================================================================
--- /code/branches/buildsystem3/src/cpptcl/cpptcl.cc	(revision 2664)
+++ /code/branches/buildsystem3/src/cpptcl/cpptcl.cc	(revision 2664)
@@ -0,0 +1,1095 @@
+//
+// Copyright (C) 2004-2006, Maciej Sobczak
+//
+// Permission to copy, use, modify, sell and distribute this software
+// is granted provided this copyright notice appears in all copies.
+// This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+//
+
+#include "cpptcl.h"
+#include <map>
+#include <sstream>
+#include <iterator>
+
+
+using namespace Tcl;
+using namespace Tcl::details;
+using namespace std;
+using namespace boost;
+
+
+result::result(Tcl_Interp *interp) : interp_(interp) {}
+
+result::operator bool() const
+{
+     Tcl_Obj *obj = Tcl_GetObjResult(interp_);
+     
+     int val, cc;
+     cc = Tcl_GetBooleanFromObj(interp_, obj, &val);
+     if (cc != TCL_OK)
+     {
+          throw tcl_error(interp_);
+     }
+     
+     return static_cast<bool>(val);
+}
+
+result::operator double() const
+{
+     Tcl_Obj *obj = Tcl_GetObjResult(interp_);
+     
+     double val;
+     int cc = Tcl_GetDoubleFromObj(interp_, obj, &val);
+     if (cc != TCL_OK)
+     {
+          throw tcl_error(interp_);
+     }
+     
+     return val;
+}
+
+result::operator int() const
+{
+     Tcl_Obj *obj = Tcl_GetObjResult(interp_);
+     
+     int val, cc;
+     cc = Tcl_GetIntFromObj(interp_, obj, &val);
+     if (cc != TCL_OK)
+     {
+          throw tcl_error(interp_);
+     }
+     
+     return val;
+}
+
+result::operator long() const
+{
+     Tcl_Obj *obj = Tcl_GetObjResult(interp_);
+     
+     long val;
+     int cc;
+     cc = Tcl_GetLongFromObj(interp_, obj, &val);
+     if (cc != TCL_OK)
+     {
+          throw tcl_error(interp_);
+     }
+     
+     return val;
+}
+
+result::operator string() const
+{
+     Tcl_Obj *obj = Tcl_GetObjResult(interp_);
+     return Tcl_GetString(obj);
+}
+
+result::operator object() const
+{
+     return object(Tcl_GetObjResult(interp_));
+}
+
+
+void details::set_result(Tcl_Interp *interp, bool b)
+{
+     Tcl_SetObjResult(interp, Tcl_NewBooleanObj(b));
+}
+
+void details::set_result(Tcl_Interp *interp, int i)
+{
+     Tcl_SetObjResult(interp, Tcl_NewIntObj(i));
+}
+
+void details::set_result(Tcl_Interp *interp, long i)
+{
+     Tcl_SetObjResult(interp, Tcl_NewLongObj(i));
+}
+
+void details::set_result(Tcl_Interp *interp, double d)
+{
+     Tcl_SetObjResult(interp, Tcl_NewDoubleObj(d));
+}
+
+void details::set_result(Tcl_Interp *interp, string const &s)
+{
+     Tcl_SetObjResult(interp,
+          Tcl_NewStringObj(s.data(), static_cast<int>(s.size())));
+}
+
+void details::set_result(Tcl_Interp *interp, void *p)
+{
+     ostringstream ss;
+     ss << 'p' << p;
+     string s(ss.str());
+
+     Tcl_SetObjResult(interp,
+          Tcl_NewStringObj(s.data(), static_cast<int>(s.size())));
+}
+
+void details::set_result(Tcl_Interp *interp, object const &o)
+{
+     Tcl_SetObjResult(interp, o.get_object());
+}
+
+
+void details::check_params_no(int objc, int required)
+{
+     if (objc < required)
+     {
+          throw tcl_error("Too few arguments.");
+     }
+}
+
+object details::get_var_params(Tcl_Interp *interp,
+     int objc, Tcl_Obj * CONST objv[],
+     int from, policies const &pol)
+{
+     object o;
+     if (pol.variadic_)
+     {
+          check_params_no(objc, from);
+          o.assign(objv + from, objv + objc);
+     }
+     else
+     {
+          check_params_no(objc, from + 1);
+          o.assign(objv[from]);
+     }
+
+     o.set_interp(interp);
+
+     return o;
+}
+
+
+namespace // anonymous
+{
+
+// map of polymorphic callbacks
+typedef map<string, shared_ptr<callback_base> > callback_interp_map;
+typedef map<Tcl_Interp *, callback_interp_map> callback_map;
+
+callback_map callbacks;
+callback_map constructors;
+
+// map of call policies
+typedef map<string, policies> policies_interp_map;
+typedef map<Tcl_Interp *, policies_interp_map> policies_map;
+
+policies_map call_policies;
+
+// map of object handlers
+typedef map<string, shared_ptr<class_handler_base> > class_interp_map;
+typedef map<Tcl_Interp *, class_interp_map> class_handlers_map;
+
+class_handlers_map class_handlers;
+
+
+// helper for finding call policies - returns true when found
+bool find_policies(Tcl_Interp *interp, string const &cmdName,
+     policies_interp_map::iterator &piti)
+{
+     policies_map::iterator pit = call_policies.find(interp);
+     if (pit == call_policies.end())
+     {
+          return false;
+     }
+     
+     piti = pit->second.find(cmdName);
+     return piti != pit->second.end();
+}
+
+extern "C"
+int object_handler(ClientData cd, Tcl_Interp *interp,
+     int objc, Tcl_Obj * CONST objv[]);
+
+// helper function for post-processing call policies
+// for both free functions (isMethod == false)
+// and class methods (isMethod == true)
+void post_process_policies(Tcl_Interp *interp, policies &pol,
+     Tcl_Obj * CONST objv[], bool isMethod)
+{
+     // check if it is a factory
+     if (!pol.factory_.empty())
+     {
+          class_handlers_map::iterator it = class_handlers.find(interp);
+          if (it == class_handlers.end())
+          {
+               throw tcl_error(
+                    "Factory was registered for unknown class.");
+          }
+
+          class_interp_map::iterator oit = it->second.find(pol.factory_);
+          if (oit == it->second.end())
+          {
+               throw tcl_error(
+                    "Factory was registered for unknown class.");
+          }
+
+          class_handler_base *chb = oit->second.get();
+
+          // register a new command for the object returned
+          // by this factory function
+          // if everything went OK, the result is the address of the
+          // new object in the 'pXXX' form
+          // - the new command will be created with this name
+
+          Tcl_CreateObjCommand(interp,
+               Tcl_GetString(Tcl_GetObjResult(interp)),
+               object_handler, static_cast<ClientData>(chb), 0);
+     }
+
+     // process all declared sinks
+     // - unregister all object commands that envelopes the pointers
+     for (vector<int>::iterator s = pol.sinks_.begin();
+          s != pol.sinks_.end(); ++s)
+     {
+          if (isMethod == false)
+          {
+               // example: if there is a declared sink at parameter 3,
+               // and the Tcl command was:
+               // % fun par1 par2 PAR3 par4
+               // then the index 3 correctly points into the objv array
+
+               int index = *s;
+               Tcl_DeleteCommand(interp, Tcl_GetString(objv[index]));
+          }
+          else
+          {
+               // example: if there is a declared sink at parameter 3,
+               // and the Tcl command was:
+               // % $p method par1 par2 PAR3 par4
+               // then the index 3 needs to be incremented
+               // in order correctly point into the 4th index of objv array
+
+               int index = *s + 1;
+               Tcl_DeleteCommand(interp, Tcl_GetString(objv[index]));
+          }
+     }
+}
+
+// actual functions handling various callbacks
+
+// generic callback handler
+extern "C"
+int callback_handler(ClientData, Tcl_Interp *interp,
+     int objc, Tcl_Obj * CONST objv[])
+{
+     callback_map::iterator it = callbacks.find(interp);
+     if (it == callbacks.end())
+     {
+          Tcl_SetResult(interp,
+               "Trying to invoke non-existent callback (wrong interpreter?)",
+               TCL_STATIC);
+          return TCL_ERROR;
+     }
+     
+     string cmdName(Tcl_GetString(objv[0]));
+     callback_interp_map::iterator iti = it->second.find(cmdName);
+     if (iti == it->second.end())
+     {
+          Tcl_SetResult(interp,
+               "Trying to invoke non-existent callback (wrong cmd name?)",
+               TCL_STATIC);
+          return TCL_ERROR;
+     }
+     
+     policies_map::iterator pit = call_policies.find(interp);
+     if (pit == call_policies.end())
+     {
+          Tcl_SetResult(interp,
+               "Trying to invoke callback with no known policies",
+               TCL_STATIC);
+          return TCL_ERROR;
+     }
+     
+     policies_interp_map::iterator piti;
+     if (find_policies(interp, cmdName, piti) == false)
+     {
+          Tcl_SetResult(interp,
+               "Trying to invoke callback with no known policies",
+               TCL_STATIC);
+          return TCL_ERROR;
+     }
+
+     policies &pol = piti->second;
+     
+     try
+     {
+          iti->second->invoke(interp, objc, objv, pol);
+
+          post_process_policies(interp, pol, objv, false);
+     }
+     catch (std::exception const &e)
+     {
+          Tcl_SetResult(interp, const_cast<char*>(e.what()), TCL_VOLATILE);
+          return TCL_ERROR;
+     }
+     catch (...)
+     {
+          Tcl_SetResult(interp, "Unknown error.", TCL_STATIC);
+          return TCL_ERROR;
+     }
+     
+     return TCL_OK;
+}
+
+// generic "object" command handler
+extern "C"
+int object_handler(ClientData cd, Tcl_Interp *interp,
+     int objc, Tcl_Obj * CONST objv[])
+{
+     // here, client data points to the singleton object
+     // which is responsible for managing commands for
+     // objects of a given type
+
+     class_handler_base *chb = reinterpret_cast<class_handler_base*>(cd);
+
+     // the command name has the form 'pXXX' where XXX is the address
+     // of the "this" object
+
+     string const str(Tcl_GetString(objv[0]));
+     istringstream ss(str);
+     char dummy;
+     void *p;
+     ss >> dummy >> p;
+
+     try
+     {
+          string methodName(Tcl_GetString(objv[1]));
+          policies &pol = chb->get_policies(methodName);
+
+          chb->invoke(p, interp, objc, objv, pol);
+
+          post_process_policies(interp, pol, objv, true);
+     }
+     catch (std::exception const &e)
+     {
+          Tcl_SetResult(interp, const_cast<char*>(e.what()), TCL_VOLATILE);
+          return TCL_ERROR;
+     }
+     catch (...)
+     {
+          Tcl_SetResult(interp, "Unknown error.", TCL_STATIC);
+          return TCL_ERROR;
+     }
+
+     return TCL_OK;
+}
+
+// generic "constructor" command
+extern "C"
+int constructor_handler(ClientData cd, Tcl_Interp *interp,
+     int objc, Tcl_Obj * CONST objv[])
+{
+     // here, client data points to the singleton object
+     // which is responsible for managing commands for
+     // objects of a given type
+
+     class_handler_base *chb = reinterpret_cast<class_handler_base*>(cd);
+
+     callback_map::iterator it = constructors.find(interp);
+     if (it == constructors.end())
+     {
+          Tcl_SetResult(interp,
+               "Trying to invoke non-existent callback (wrong interpreter?)",
+               TCL_STATIC);
+          return TCL_ERROR;
+     }
+     
+     string className(Tcl_GetString(objv[0]));
+     callback_interp_map::iterator iti = it->second.find(className);
+     if (iti == it->second.end())
+     {
+          Tcl_SetResult(interp,
+               "Trying to invoke non-existent callback (wrong class name?)",
+               TCL_STATIC);
+          return TCL_ERROR;
+     }
+     
+     policies_interp_map::iterator piti;
+     if (find_policies(interp, className, piti) == false)
+     {
+          Tcl_SetResult(interp,
+               "Trying to invoke callback with no known policies",
+               TCL_STATIC);
+          return TCL_ERROR;
+     }
+
+     policies &pol = piti->second;
+
+     try
+     {
+          iti->second->invoke(interp, objc, objv, pol);
+
+          // if everything went OK, the result is the address of the
+          // new object in the 'pXXX' form
+          // - we can create a new command with this name
+
+          Tcl_CreateObjCommand(interp,
+               Tcl_GetString(Tcl_GetObjResult(interp)),
+               object_handler, static_cast<ClientData>(chb), 0);
+     }
+     catch (std::exception const &e)
+     {
+          Tcl_SetResult(interp, const_cast<char*>(e.what()), TCL_VOLATILE);
+          return TCL_ERROR;
+     }
+     catch (...)
+     {
+          Tcl_SetResult(interp, "Unknown error.", TCL_STATIC);
+          return TCL_ERROR;
+     }
+
+     return TCL_OK;
+}
+
+} // namespace anonymous
+
+Tcl::details::no_init_type Tcl::no_init;
+
+
+policies & policies::factory(string const &name)
+{
+     factory_ = name;
+     return *this;
+}
+
+policies & policies::sink(int index)
+{
+     sinks_.push_back(index);
+     return *this;
+}
+
+policies & policies::variadic()
+{
+     variadic_ = true;
+     return *this;
+}
+
+policies Tcl::factory(string const &name)
+{
+     return policies().factory(name);
+}
+
+policies Tcl::sink(int index)
+{
+     return policies().sink(index);
+}
+
+policies Tcl::variadic()
+{
+     return policies().variadic();
+}
+
+
+class_handler_base::class_handler_base()
+{
+     // default policies for the -delete command
+     policies_["-delete"] = policies();
+}
+
+void class_handler_base::register_method(string const &name,
+     shared_ptr<object_cmd_base> ocb, policies const &p)
+{
+     methods_[name] = ocb;
+     policies_[name] = p;
+}
+
+policies & class_handler_base::get_policies(string const &name)
+{
+     policies_map_type::iterator it = policies_.find(name);
+     if (it == policies_.end())
+     {
+          throw tcl_error("Trying to use non-existent policy: " + name);
+     }
+
+     return it->second;
+}
+
+
+object::object()
+     : interp_(0)
+{
+     obj_ = Tcl_NewObj();
+     Tcl_IncrRefCount(obj_);
+}
+
+object::object(bool b)
+     : interp_(0)
+{
+     obj_ = Tcl_NewBooleanObj(b);
+     Tcl_IncrRefCount(obj_);
+}
+
+object::object(char const *buf, size_t size)
+     : interp_(0)
+{
+     obj_ = Tcl_NewByteArrayObj(
+          reinterpret_cast<unsigned char const *>(buf),
+          static_cast<int>(size));
+     Tcl_IncrRefCount(obj_);
+}
+
+object::object(double d)
+     : interp_(0)
+{
+     obj_ = Tcl_NewDoubleObj(d);
+     Tcl_IncrRefCount(obj_);
+}
+
+object::object(int i)
+     : interp_(0)
+{
+     obj_ = Tcl_NewIntObj(i);
+     Tcl_IncrRefCount(obj_);
+}
+
+object::object(long l)
+     : interp_(0)
+{
+     obj_ = Tcl_NewLongObj(l);
+     Tcl_IncrRefCount(obj_);
+}
+
+object::object(char const *s)
+     : interp_(0)
+{
+     obj_ = Tcl_NewStringObj(s, -1);
+     Tcl_IncrRefCount(obj_);
+}
+
+object::object(string const &s)
+     : interp_(0)
+{
+     obj_ = Tcl_NewStringObj(s.data(), static_cast<int>(s.size()));
+     Tcl_IncrRefCount(obj_);
+}
+
+object::object(Tcl_Obj *o, bool shared)
+     : interp_(0)
+{
+     init(o, shared);
+}
+
+object::object(object const &other, bool shared)
+     : interp_(other.get_interp())
+{
+     init(other.obj_, shared);
+}
+
+void object::init(Tcl_Obj *o, bool shared)
+{
+     if (shared)
+     {
+          obj_ = o;
+     }
+     else
+     {
+          obj_ = Tcl_DuplicateObj(o);
+     }
+     Tcl_IncrRefCount(obj_);
+}
+
+object::~object()
+{
+     Tcl_DecrRefCount(obj_);
+}
+
+object & object::assign(bool b)
+{
+     Tcl_SetBooleanObj(obj_, b);
+     return *this;
+}
+
+object & object::resize(size_t size)
+{
+     Tcl_SetByteArrayLength(obj_, static_cast<int>(size));
+     return *this;
+}
+
+object & object::assign(char const *buf, size_t size)
+{
+     Tcl_SetByteArrayObj(obj_,
+          reinterpret_cast<unsigned char const *>(buf),
+          static_cast<int>(size));
+     return *this;
+}
+
+object & object::assign(double d)
+{
+     Tcl_SetDoubleObj(obj_, d);
+     return *this;
+}
+
+object & object::assign(int i)
+{
+     Tcl_SetIntObj(obj_, i);
+     return *this;
+}
+
+object & object::assign(long l)
+{
+     Tcl_SetLongObj(obj_, l);
+     return *this;
+}
+
+object & object::assign(char const *s)
+{
+     Tcl_SetStringObj(obj_, s, -1);
+     return *this;
+}
+
+object & object::assign(string const &s)
+{
+     Tcl_SetStringObj(obj_, s.data(), static_cast<int>(s.size()));
+     return *this;
+}
+
+object & object::assign(object const &other)
+{
+     object(other).swap(*this);
+     return *this;
+}
+
+object & object::assign(Tcl_Obj *o)
+{
+     object(o).swap(*this);
+     return *this;
+}
+
+object & object::swap(object &other)
+{
+     std::swap(obj_, other.obj_);
+     std::swap(interp_, other.interp_);
+     return *this;
+}
+
+template <>
+bool object::get<bool>(interpreter &i) const
+{
+     int retVal;
+     int res = Tcl_GetBooleanFromObj(i.get(), obj_, &retVal);
+     if (res != TCL_OK)
+     {
+          throw tcl_error(i.get());
+     }
+
+     return static_cast<bool>(retVal);
+}
+
+template <>
+vector<char> object::get<vector<char> >(interpreter &) const
+{
+     size_t size;
+     char const *buf = get(size);
+     return vector<char>(buf, buf + size);
+}
+
+template <>
+double object::get<double>(interpreter &i) const
+{
+     double retVal;
+     int res = Tcl_GetDoubleFromObj(i.get(), obj_, &retVal);
+     if (res != TCL_OK)
+     {
+          throw tcl_error(i.get());
+     }
+
+     return retVal;
+}
+
+template <>
+int object::get<int>(interpreter &i) const
+{
+     int retVal;
+
+     int res = Tcl_GetIntFromObj(i.get(), obj_, &retVal);
+     if (res != TCL_OK)
+     {
+          throw tcl_error(i.get());
+     }
+
+     return retVal;
+}
+
+template <>
+long object::get<long>(interpreter &i) const
+{
+     long retVal;
+     int res = Tcl_GetLongFromObj(i.get(), obj_, &retVal);
+     if (res != TCL_OK)
+     {
+          throw tcl_error(i.get());
+     }
+
+     return retVal;
+}
+
+template <>
+char const * object::get<char const *>(interpreter &) const
+{
+     return get();
+}
+
+template <>
+string object::get<string>(interpreter &) const
+{
+     int len;
+     char const *buf = Tcl_GetStringFromObj(obj_, &len);
+     return string(buf, buf + len);
+}
+
+char const * object::get() const
+{
+     return Tcl_GetString(obj_);
+}
+
+char const * object::get(size_t &size) const
+{
+     int len;
+     unsigned char *buf = Tcl_GetByteArrayFromObj(obj_, &len);
+     size = len;
+     return const_cast<char const *>(reinterpret_cast<char *>(buf));
+}
+
+size_t object::length(interpreter &i) const
+{
+     int len;
+     int res = Tcl_ListObjLength(i.get(), obj_, &len);
+
+     if (res != TCL_OK)
+     {
+          throw tcl_error(i.get());
+     }
+
+     return static_cast<size_t>(len);
+}
+
+object object::at(interpreter &i, size_t index) const
+{
+     Tcl_Obj *o;
+     int res = Tcl_ListObjIndex(i.get(), obj_, static_cast<int>(index), &o);
+     if (res != TCL_OK)
+     {
+          throw tcl_error(i.get());
+     }
+     if (o == NULL)
+     {
+          throw tcl_error("Index out of range.");
+     }
+
+     return object(o);
+}
+
+object & object::append(interpreter &i, object const &o)
+{
+     int res = Tcl_ListObjAppendElement(i.get(), obj_, o.obj_);
+     if (res != TCL_OK)
+     {
+          throw tcl_error(i.get());
+     }
+
+     return *this;
+}
+
+object & object::append_list(interpreter &i, object const &o)
+{
+     int res = Tcl_ListObjAppendList(i.get(), obj_, o.obj_);
+     if (res != TCL_OK)
+     {
+          throw tcl_error(i.get());
+     }
+
+     return *this;
+}
+
+object & object::replace(interpreter &i, size_t index, size_t count,
+     object const &o)
+{
+     int res = Tcl_ListObjReplace(i.get(), obj_,
+          static_cast<int>(index), static_cast<int>(count),
+          1, &(o.obj_));
+     if (res != TCL_OK)
+     {
+          throw tcl_error(i.get());
+     }
+
+     return *this;
+}
+
+object & object::replace_list(interpreter &i, size_t index, size_t count,
+     object const &o)
+{
+     int objc;
+     Tcl_Obj **objv;
+
+     int res = Tcl_ListObjGetElements(i.get(), o.obj_, &objc, &objv);
+     if (res != TCL_OK)
+     {
+          throw tcl_error(i.get());
+     }
+
+     res = Tcl_ListObjReplace(i.get(), obj_,
+          static_cast<int>(index), static_cast<int>(count),
+          objc, objv);
+     if (res != TCL_OK)
+     {
+          throw tcl_error(i.get());
+     }
+
+     return *this;
+}
+
+void object::set_interp(Tcl_Interp *interp)
+{
+     interp_ = interp;
+}
+
+Tcl_Interp * object::get_interp() const
+{
+     return interp_;
+}
+
+
+interpreter::interpreter()
+{
+     interp_ =  Tcl_CreateInterp();
+     owner_ = true;
+}
+
+interpreter::interpreter(string const &libpath)
+{
+     interp_ =  Tcl_CreateInterp();
+     owner_ = true;
+
+     try
+     {
+        this->eval("set tcl_library " + libpath);
+        Tcl_Init(this->interp_);
+     } catch (...) {}
+}
+
+interpreter::interpreter(Tcl_Interp *interp, bool owner)
+{
+     interp_ =  interp;
+     owner_ = owner;
+}
+
+interpreter::~interpreter()
+{
+     if (owner_)
+     {
+          // clear all callback info belonging to this interpreter
+          clear_definitions(interp_);
+
+          Tcl_DeleteInterp(interp_);
+     }
+}
+
+void interpreter::make_safe()
+{
+     int cc = Tcl_MakeSafe(interp_);
+     if (cc != TCL_OK)
+     {
+          throw tcl_error(interp_);
+     }
+}
+
+result interpreter::eval(string const &script)
+{
+     int cc = Tcl_Eval(interp_, script.c_str());
+     if (cc != TCL_OK)
+     {
+          throw tcl_error(interp_);
+     }
+ 
+     return result(interp_);
+}
+
+result interpreter::eval(istream &s)
+{
+     string str(
+          istreambuf_iterator<char>(s.rdbuf()),
+          istreambuf_iterator<char>()
+     );
+     return eval(str);
+}
+
+result interpreter::eval(object const &o)
+{
+     int cc = Tcl_EvalObjEx(interp_, o.get_object(), 0);
+     if (cc != TCL_OK)
+     {
+          throw tcl_error(interp_);
+     }
+ 
+     return result(interp_);
+}
+
+void interpreter::pkg_provide(string const &name, string const &version)
+{
+     int cc = Tcl_PkgProvide(interp_, name.c_str(), version.c_str());
+     if (cc != TCL_OK)
+     {
+          throw tcl_error(interp_);
+     }
+}
+
+void interpreter::create_alias(string const &cmd,
+     interpreter &targetInterp, string const &targetCmd)
+{
+     int cc = Tcl_CreateAlias(interp_, cmd.c_str(),
+          targetInterp.interp_, targetCmd.c_str(), 0, 0);
+     if (cc != TCL_OK)
+     {
+          throw tcl_error(interp_);
+     }
+}
+
+void interpreter::clear_definitions(Tcl_Interp *interp)
+{
+     // delete all callbacks that were registered for given interpreter
+
+     {
+          callback_map::iterator it = callbacks.find(interp);
+          if (it == callbacks.end())
+          {
+               // no callbacks defined for this interpreter
+               return;
+          }
+
+          callback_interp_map &imap = it->second;
+          for (callback_interp_map::iterator it2 = imap.begin();
+               it2 != imap.end(); ++it2)
+          {
+               Tcl_DeleteCommand(interp, it2->first.c_str());
+          }
+
+          callbacks.erase(interp);
+     }
+
+     // delete all constructors
+
+     {
+          callback_map::iterator it = constructors.find(interp);
+          if (it == constructors.end())
+          {
+               // no callbacks defined for this interpreter
+               return;
+          }
+
+          callback_interp_map &imap = it->second;
+          for (callback_interp_map::iterator it2 = imap.begin();
+               it2 != imap.end(); ++it2)
+          {
+               Tcl_DeleteCommand(interp, it2->first.c_str());
+          }
+
+          callbacks.erase(interp);
+     }
+
+     // delete all call policies
+
+     call_policies.erase(interp);
+
+     // delete all object handlers
+     // (we have to assume that all living objects were destroyed,
+     // otherwise Bad Things will happen)
+
+     class_handlers.erase(interp);
+}
+
+void interpreter::add_function(string const &name,
+     shared_ptr<callback_base> cb, policies const &p)
+{
+     Tcl_CreateObjCommand(interp_, name.c_str(),
+          callback_handler, 0, 0);
+     
+     callbacks[interp_][name] = cb;
+     call_policies[interp_][name] = p;
+}
+
+void interpreter::add_class(string const &name,
+     shared_ptr<class_handler_base> chb)
+{
+     class_handlers[interp_][name] = chb;
+}
+
+void interpreter::add_constructor(string const &name,
+     shared_ptr<class_handler_base> chb, shared_ptr<callback_base> cb,
+     policies const &p)
+{
+     Tcl_CreateObjCommand(interp_, name.c_str(),
+          constructor_handler, static_cast<ClientData>(chb.get()), 0);
+
+     constructors[interp_][name] = cb;
+     call_policies[interp_][name] = p;
+}
+
+
+int tcl_cast<int>::from(Tcl_Interp *interp, Tcl_Obj *obj)
+{
+     int res;
+     int cc = Tcl_GetIntFromObj(interp, obj, &res);
+     if (cc != TCL_OK)
+     {
+          throw tcl_error(interp);
+     }
+     
+     return res;
+}
+
+long tcl_cast<long>::from(Tcl_Interp *interp, Tcl_Obj *obj)
+{
+     long res;
+     int cc = Tcl_GetLongFromObj(interp, obj, &res);
+     if (cc != TCL_OK)
+     {
+          throw tcl_error(interp);
+     }
+     
+     return res;
+}
+
+bool tcl_cast<bool>::from(Tcl_Interp *interp, Tcl_Obj *obj)
+{
+     int res;
+     int cc = Tcl_GetBooleanFromObj(interp, obj, &res);
+     if (cc != TCL_OK)
+     {
+          throw tcl_error(interp);
+     }
+     
+     return res != 0;
+}
+
+double tcl_cast<double>::from(Tcl_Interp *interp, Tcl_Obj *obj)
+{
+     double res;
+     int cc = Tcl_GetDoubleFromObj(interp, obj, &res);
+     if (cc != TCL_OK)
+     {
+          throw tcl_error(interp);
+     }
+     
+     return res;
+}
+
+string tcl_cast<string>::from(Tcl_Interp *, Tcl_Obj *obj)
+{
+     return Tcl_GetString(obj);
+}
+
+char const * tcl_cast<char const *>::from(Tcl_Interp *, Tcl_Obj *obj)
+{
+     return Tcl_GetString(obj);
+}
+
+object tcl_cast<object>::from(Tcl_Interp *interp, Tcl_Obj *obj)
+{
+     object o(obj);
+     o.set_interp(interp);
+
+     return o;
+}
Index: /code/branches/buildsystem3/src/cpptcl/cpptcl.h
===================================================================
--- /code/branches/buildsystem3/src/cpptcl/cpptcl.h	(revision 2664)
+++ /code/branches/buildsystem3/src/cpptcl/cpptcl.h	(revision 2664)
@@ -0,0 +1,871 @@
+//
+// Copyright (C) 2004-2006, Maciej Sobczak
+//
+// Permission to copy, use, modify, sell and distribute this software
+// is granted provided this copyright notice appears in all copies.
+// This software is provided "as is" without express or implied
+// warranty, and with no claim as to its suitability for any purpose.
+//
+
+#ifndef CPPTCL_INCLUDED
+#define CPPTCL_INCLUDED
+
+#include <tcl.h>
+#include <string>
+#include <stdexcept>
+#include <sstream>
+#include <map>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include <boost/bind.hpp>
+
+
+namespace Tcl
+{
+
+// exception class used for reporting all Tcl errors
+
+class tcl_error : public std::runtime_error
+{
+public:
+     explicit tcl_error(std::string const &msg)
+          : std::runtime_error(msg) {}
+     explicit tcl_error(Tcl_Interp *interp)
+          : std::runtime_error(Tcl_GetString(Tcl_GetObjResult(interp))) {}
+};
+
+// call policies
+
+struct policies
+{
+     policies() : variadic_(false) {}
+
+     policies & factory(std::string const &name);
+
+     // note: this is additive
+     policies & sink(int index);
+
+     policies & variadic();
+
+     std::string factory_;
+     std::vector<int> sinks_;
+     bool variadic_;
+};
+
+// syntax short-cuts
+policies factory(std::string const &name);
+policies sink(int index);
+policies variadic();
+
+
+class interpreter;
+class object;
+
+namespace details
+{
+
+// wrapper for the evaluation result
+class result
+{
+public:
+     result(Tcl_Interp *interp);
+     
+     operator bool() const;
+     operator double() const;
+     operator int() const;
+     operator long() const;
+     operator std::string() const;
+     operator object() const;
+
+private:
+     Tcl_Interp *interp_;
+};
+
+// helper functions used to set the result value
+
+void set_result(Tcl_Interp *interp, bool b);
+void set_result(Tcl_Interp *interp, int i);
+void set_result(Tcl_Interp *interp, long i);
+void set_result(Tcl_Interp *interp, double d);
+void set_result(Tcl_Interp *interp, std::string const &s);
+void set_result(Tcl_Interp *interp, void *p);
+void set_result(Tcl_Interp *interp, object const &o);
+
+// helper functor for converting Tcl objects to the given type
+#include "details/conversions.h"
+
+// dispatchers able to capture (or ignore) the result
+#include "details/dispatchers.h"
+
+// helper for checking for required number of parameters
+// (throws tcl_error when not met)
+void check_params_no(int objc, int required);
+
+// helper for gathering optional params in variadic functions
+object get_var_params(Tcl_Interp *interp,
+     int objc, Tcl_Obj * CONST objv[],
+     int from, policies const &pol);
+
+// the callback_base is used to store callback handlers in a polynorphic map
+class callback_base
+{
+public:
+     virtual ~callback_base() {}
+
+     virtual void invoke(Tcl_Interp *interp,
+          int objc, Tcl_Obj * CONST objv[],
+          policies const &pol) = 0;
+};
+
+
+// base class for object command handlers
+// and for class handlers
+class object_cmd_base
+{
+public:
+     // destructor not needed, but exists to shut up the compiler warnings
+     virtual ~object_cmd_base() {}
+
+     virtual void invoke(void *p, Tcl_Interp *interp,
+          int objc, Tcl_Obj * CONST objv[],
+          policies const &pol) = 0;
+};
+
+// base class for all class handlers, still abstract
+class class_handler_base : public object_cmd_base
+{
+public:
+     typedef std::map<std::string, policies> policies_map_type;
+
+     class_handler_base();
+
+     void register_method(std::string const &name,
+          boost::shared_ptr<object_cmd_base> ocb, policies const &p);
+
+     policies & get_policies(std::string const &name);
+
+protected:
+     typedef std::map<
+          std::string,
+          boost::shared_ptr<object_cmd_base>
+          > method_map_type;
+
+     // a map of methods for the given class
+     method_map_type methods_;
+
+     policies_map_type policies_;
+};
+
+// class handler - responsible for executing class methods
+template <class C>
+class class_handler : public class_handler_base
+{
+public:
+     virtual void invoke(void *pv, Tcl_Interp *interp,
+          int objc, Tcl_Obj * CONST objv[], policies const &pol)
+     {
+          C * p = static_cast<C*>(pv);
+
+          if (objc < 2)
+          {
+               throw tcl_error("Too few arguments.");
+          }
+          
+          std::string methodName(Tcl_GetString(objv[1]));
+
+          if (methodName == "-delete")
+          {
+               Tcl_DeleteCommand(interp, Tcl_GetString(objv[0]));
+               delete p;
+               return;
+          }
+
+          // dispatch on the method name
+
+          method_map_type::iterator it = methods_.find(methodName);
+          if (it == methods_.end())
+          {
+               throw tcl_error("Method " + methodName + " not found.");
+          }
+
+          it->second->invoke(pv, interp, objc, objv, pol);
+     }
+};
+
+
+// factory functions for creating class objects
+#include "details/constructors.h"
+
+// actual callback envelopes
+#include "details/callbacks.h"
+
+// actual method envelopes
+#include "details/methods.h"
+
+// helper meta function for figuring appropriate constructor callback
+#include "details/metahelpers.h"
+
+
+// this class is used to provide the "def" interface for defining
+// class member functions
+
+template <class C>
+class class_definer
+{
+public:
+     class_definer(boost::shared_ptr<class_handler<C> > ch) : ch_(ch) {}
+
+     template <typename R>
+     class_definer & def(std::string const &name, R (C::*f)(),
+          policies const &p = policies())
+     {
+          ch_->register_method(name,
+               boost::shared_ptr<details::object_cmd_base>(
+                    new details::method0<C, R>(f)), p);
+          return *this;
+     }
+
+     template <typename R>
+     class_definer & def(std::string const &name, R (C::*f)() const,
+          policies const &p = policies())
+     {
+          ch_->register_method(name,
+               boost::shared_ptr<details::object_cmd_base>(
+                    new details::method0<C, R>(f)), p);
+          return *this;
+     }
+
+     template <typename R, typename T1>
+     class_definer & def(std::string const &name, R (C::*f)(T1),
+          policies const &p = policies())
+     {
+          ch_->register_method(name,
+               boost::shared_ptr<details::object_cmd_base>(
+                    new details::method1<C, R, T1>(f)), p);
+          return *this;
+     }
+
+     template <typename R, typename T1>
+     class_definer & def(std::string const &name, R (C::*f)(T1) const,
+          policies const &p = policies())
+     {
+          ch_->register_method(name,
+               boost::shared_ptr<details::object_cmd_base>(
+                    new details::method1<C, R, T1>(f)), p);
+          return *this;
+     }
+
+     template <typename R, typename T1, typename T2>
+     class_definer & def(std::string const &name, R (C::*f)(T1, T2),
+          policies const &p = policies())
+     {
+          ch_->register_method(name,
+               boost::shared_ptr<details::object_cmd_base>(
+                    new details::method2<C, R, T1, T2>(f)), p);
+          return *this;
+     }
+
+     template <typename R, typename T1, typename T2>
+     class_definer & def(std::string const &name, R (C::*f)(T1, T2) const,
+          policies const &p = policies())
+     {
+          ch_->register_method(name,
+               boost::shared_ptr<details::object_cmd_base>(
+                    new details::method2<C, R, T1, T2>(f)), p);
+          return *this;
+     }
+
+     template <typename R, typename T1, typename T2, typename T3>
+     class_definer & def(std::string const &name, R (C::*f)(T1, T2, T3),
+          policies const &p = policies())
+     {
+          ch_->register_method(name,
+               boost::shared_ptr<details::object_cmd_base>(
+                    new details::method3<C, R, T1, T2, T3>(f)), p);
+          return *this;
+     }
+
+     template <typename R, typename T1, typename T2, typename T3>
+     class_definer & def(std::string const &name, R (C::*f)(T1, T2, T3) const,
+          policies const &p = policies())
+     {
+          ch_->register_method(name,
+               boost::shared_ptr<details::object_cmd_base>(
+                    new details::method3<C, R, T1, T2, T3>(f)), p);
+          return *this;
+     }
+
+     template <typename R, typename T1, typename T2, typename T3, typename T4>
+     class_definer & def(std::string const &name, R (C::*f)(T1, T2, T3, T4),
+          policies const &p = policies())
+     {
+          ch_->register_method(name,
+               boost::shared_ptr<details::object_cmd_base>(
+                    new details::method4<C, R, T1, T2, T3, T4>(f)), p);
+          return *this;
+     }
+
+     template <typename R, typename T1, typename T2, typename T3, typename T4>
+     class_definer & def(std::string const &name,
+          R (C::*f)(T1, T2, T3, T4) const,
+          policies const &p = policies())
+     {
+          ch_->register_method(name,
+               boost::shared_ptr<details::object_cmd_base>(
+                    new details::method4<C, R, T1, T2, T3, T4>(f)), p);
+          return *this;
+     }
+
+     template <typename R, typename T1, typename T2, typename T3, typename T4,
+          typename T5>
+     class_definer & def(std::string const &name,
+          R (C::*f)(T1, T2, T3, T4, T5), policies const &p = policies())
+     {
+          ch_->register_method(name,
+               boost::shared_ptr<details::object_cmd_base>(
+                    new details::method5<C, R, T1, T2, T3, T4, T5>(f)), p);
+          return *this;
+     }
+
+     template <typename R, typename T1, typename T2, typename T3, typename T4,
+          typename T5>
+     class_definer & def(std::string const &name,
+          R (C::*f)(T1, T2, T3, T4, T5) const, policies const &p = policies())
+     {
+          ch_->register_method(name,
+               boost::shared_ptr<details::object_cmd_base>(
+                    new details::method5<C, R, T1, T2, T3, T4, T5>(f)), p);
+          return *this;
+     }
+
+     template <typename R, typename T1, typename T2, typename T3, typename T4,
+          typename T5, typename T6>
+     class_definer & def(std::string const &name,
+          R (C::*f)(T1, T2, T3, T4, T5, T6), policies const &p = policies())
+     {
+          ch_->register_method(name,
+               boost::shared_ptr<details::object_cmd_base>(
+                    new details::method6<C, R, T1, T2, T3, T4, T5, T6>(f)),
+               p);
+          return *this;
+     }
+
+     template <typename R, typename T1, typename T2, typename T3, typename T4,
+          typename T5, typename T6>
+     class_definer & def(std::string const &name,
+          R (C::*f)(T1, T2, T3, T4, T5, T6) const,
+          policies const &p = policies())
+     {
+          ch_->register_method(name,
+               boost::shared_ptr<details::object_cmd_base>(
+                    new details::method6<C, R, T1, T2, T3, T4, T5, T6>(f)),
+               p);
+          return *this;
+     }
+
+     template <typename R, typename T1, typename T2, typename T3, typename T4,
+          typename T5, typename T6, typename T7>
+     class_definer & def(std::string const &name,
+          R (C::*f)(T1, T2, T3, T4, T5, T6, T7),
+          policies const &p = policies())
+     {
+          ch_->register_method(name,
+               boost::shared_ptr<details::object_cmd_base>(
+                    new details::method7<C, R,
+                    T1, T2, T3, T4, T5, T6, T7>(f)), p);
+          return *this;
+     }
+
+     template <typename R, typename T1, typename T2, typename T3, typename T4,
+          typename T5, typename T6, typename T7>
+     class_definer & def(std::string const &name,
+          R (C::*f)(T1, T2, T3, T4, T5, T6, T7) const,
+          policies const &p = policies())
+     {
+          ch_->register_method(name,
+               boost::shared_ptr<details::object_cmd_base>(
+                    new details::method7<C, R,
+                    T1, T2, T3, T4, T5, T6, T7>(f)), p);
+          return *this;
+     }
+
+     template <typename R, typename T1, typename T2, typename T3, typename T4,
+          typename T5, typename T6, typename T7, typename T8>
+     class_definer & def(std::string const &name,
+          R (C::*f)(T1, T2, T3, T4, T5, T6, T7, T8),
+          policies const &p = policies())
+     {
+          ch_->register_method(name,
+               boost::shared_ptr<details::object_cmd_base>(
+                    new details::method8<C, R,
+                    T1, T2, T3, T4, T5, T6, T7, T8>(f)), p);
+          return *this;
+     }
+
+     template <typename R, typename T1, typename T2, typename T3, typename T4,
+          typename T5, typename T6, typename T7, typename T8>
+     class_definer & def(std::string const &name,
+          R (C::*f)(T1, T2, T3, T4, T5, T6, T7, T8) const,
+          policies const &p = policies())
+     {
+          ch_->register_method(name,
+               boost::shared_ptr<details::object_cmd_base>(
+                    new details::method8<C, R,
+                    T1, T2, T3, T4, T5, T6, T7, T8>(f)), p);
+          return *this;
+     }
+
+     template <typename R, typename T1, typename T2, typename T3, typename T4,
+          typename T5, typename T6, typename T7, typename T8, typename T9>
+     class_definer & def(std::string const &name,
+          R (C::*f)(T1, T2, T3, T4, T5, T6, T7, T8, T9),
+          policies const &p = policies())
+     {
+          ch_->register_method(name,
+               boost::shared_ptr<details::object_cmd_base>(
+                    new details::method9<C, R,
+                    T1, T2, T3, T4, T5, T6, T7, T8, T9>(f)), p);
+          return *this;
+     }
+
+     template <typename R, typename T1, typename T2, typename T3, typename T4,
+          typename T5, typename T6, typename T7, typename T8, typename T9>
+     class_definer & def(std::string const &name,
+          R (C::*f)(T1, T2, T3, T4, T5, T6, T7, T8, T9) const,
+          policies const &p = policies())
+     {
+          ch_->register_method(name,
+               boost::shared_ptr<details::object_cmd_base>(
+                    new details::method9<C, R,
+                    T1, T2, T3, T4, T5, T6, T7, T8, T9>(f)), p);
+          return *this;
+     }
+
+private:
+     boost::shared_ptr<class_handler<C> > ch_;
+};
+
+} // namespace details
+
+
+// init type for defining class constructors
+template <typename T1 = void, typename T2 = void, typename T3 = void,
+          typename T4 = void, typename T5 = void, typename T6 = void,
+          typename T7 = void, typename T8 = void, typename T9 = void>
+class init {};
+
+// no_init type and object - to define classes without constructors
+namespace details
+{
+     struct no_init_type {};
+} // namespace details
+extern details::no_init_type no_init;
+
+
+// interpreter wrapper
+class interpreter
+{
+public:
+     interpreter();
+     interpreter(std::string const &libpath);
+     interpreter(Tcl_Interp *, bool owner = true);
+     ~interpreter();
+     
+     void make_safe();
+     
+     Tcl_Interp * get() const { return interp_; }
+
+     // free function definitions     
+     
+     template <typename R>
+     void def(std::string const &name, R (*f)(),
+          policies const &p = policies())
+     {
+          add_function(name,
+               boost::shared_ptr<details::callback_base>(
+                    new details::callback0<R>(f)), p);
+     }
+
+     template <typename R, typename T1>
+     void def(std::string const &name, R (*f)(T1),
+          policies const &p = policies())
+     {
+          add_function(name,
+               boost::shared_ptr<details::callback_base>(
+                    new details::callback1<R, T1>(f)), p);
+     }
+
+     template <typename R, typename T1, typename T2>
+     void def(std::string const &name, R (*f)(T1, T2),
+          policies const &p = policies())
+     {
+          add_function(name,
+               boost::shared_ptr<details::callback_base>(
+                    new details::callback2<R, T1, T2>(f)), p);
+     }
+
+     template <typename R, typename T1, typename T2, typename T3>
+     void def(std::string const &name, R (*f)(T1, T2, T3),
+          policies const &p = policies())
+     {
+          add_function(name,
+               boost::shared_ptr<details::callback_base>(
+                    new details::callback3<R, T1, T2, T3>(f)), p);
+     }
+
+     template <typename R, typename T1, typename T2, typename T3, typename T4>
+     void def(std::string const &name, R (*f)(T1, T2, T3, T4),
+          policies const &p = policies())
+     {
+          add_function(name,
+               boost::shared_ptr<details::callback_base>(
+                    new details::callback4<R, T1, T2, T3, T4>(f)), p);
+     }
+
+     template <typename R, typename T1, typename T2, typename T3,
+          typename T4, typename T5>
+     void def(std::string const &name, R (*f)(T1, T2, T3, T4, T5),
+          policies const &p = policies())
+     {
+          add_function(name,
+               boost::shared_ptr<details::callback_base>(
+                    new details::callback5<R, T1, T2, T3, T4, T5>(f)), p);
+     }
+
+     template <typename R, typename T1, typename T2, typename T3,
+          typename T4, typename T5, typename T6>
+     void def(std::string const &name, R (*f)(T1, T2, T3, T4, T5, T6),
+          policies const &p = policies())
+     {
+          add_function(name,
+               boost::shared_ptr<details::callback_base>(
+                    new details::callback6<R, T1, T2, T3, T4, T5, T6>(f)), p);
+     }
+
+     template <typename R, typename T1, typename T2, typename T3,
+          typename T4, typename T5, typename T6, typename T7>
+     void def(std::string const &name, R (*f)(T1, T2, T3, T4, T5, T6, T7),
+          policies const &p = policies())
+     {
+          add_function(name,
+               boost::shared_ptr<details::callback_base>(
+                    new details::callback7<R,
+                    T1, T2, T3, T4, T5, T6, T7>(f)), p);
+     }
+
+     template <typename R, typename T1, typename T2, typename T3,
+          typename T4, typename T5, typename T6, typename T7, typename T8>
+     void def(std::string const &name, R (*f)(T1, T2, T3, T4, T5, T6, T7, T8),
+          policies const &p = policies())
+     {
+          add_function(name,
+               boost::shared_ptr<details::callback_base>(
+                    new details::callback8<R,
+                    T1, T2, T3, T4, T5, T6, T7, T8>(f)), p);
+     }
+
+     template <typename R, typename T1, typename T2, typename T3,
+          typename T4, typename T5, typename T6, typename T7, typename T8,
+          typename T9>
+     void def(std::string const &name,
+          R (*f)(T1, T2, T3, T4, T5, T6, T7, T8, T9),
+          policies const &p = policies())
+     {
+          add_function(name,
+               boost::shared_ptr<details::callback_base>(
+                    new details::callback9<R,
+                    T1, T2, T3, T4, T5, T6, T7, T8, T9>(f)), p);
+     }
+
+
+     // class definitions
+
+     template <class C>
+     details::class_definer<C> class_(std::string const &name)
+     {
+          boost::shared_ptr<details::class_handler<C> > ch(
+               new details::class_handler<C>());
+
+          add_class(name, ch);
+
+          add_constructor(name, ch,
+               boost::shared_ptr<details::callback_base>(
+                    new details::callback0<C*>(&details::construct<
+                         C, void, void, void, void, void, void, void,
+                         void, void>::doit)));
+
+          return details::class_definer<C>(ch);
+     }
+
+     template <class C, typename T1, typename T2, typename T3, typename T4,
+               typename T5, typename T6, typename T7, typename T8,
+               typename T9>
+     details::class_definer<C> class_(std::string const &name,
+          init<T1, T2, T3, T4, T5, T6, T7, T8, T9> const &,
+          policies const &p = policies())
+     {
+          typedef typename details::get_callback_type_for_construct<
+               C, T1, T2, T3, T4, T5, T6, T7, T8, T9>::type
+               callback_type;
+
+          boost::shared_ptr<details::class_handler<C> > ch(
+               new details::class_handler<C>());
+
+          add_class(name, ch);
+
+          add_constructor(name, ch,
+               boost::shared_ptr<details::callback_base>(
+                    new callback_type(&details::construct<
+                         C, T1, T2, T3, T4, T5, T6, T7, T8, T9>::doit)), p);
+
+          return details::class_definer<C>(ch);
+     }
+
+     template <class C>
+     details::class_definer<C> class_(
+          std::string const &name, details::no_init_type const &)
+     {
+          boost::shared_ptr<details::class_handler<C> > ch(
+               new details::class_handler<C>());
+
+          add_class(name, ch);
+
+          return details::class_definer<C>(ch);
+     }
+
+     // free script evaluation     
+     details::result eval(std::string const &script);
+     details::result eval(std::istream &s);
+
+     details::result eval(object const &o);
+
+     // the InputIterator should give object& or Tcl_Obj* when dereferenced
+     template <class InputIterator>
+     details::result eval(InputIterator first, InputIterator last);
+
+     // create alias from the *this interpreter to the target interpreter
+     void create_alias(std::string const &cmd,
+          interpreter &targetInterp, std::string const &targetCmd);
+
+     // register a package info (useful when defining packages)
+     void pkg_provide(std::string const &name, std::string const &version);
+
+     // helper for cleaning up callbacks in non-managed interpreters
+     static void clear_definitions(Tcl_Interp *);
+
+private:
+
+     // copy not supported
+     interpreter(const interpreter &);
+     void operator=(const interpreter &);
+
+     void add_function(std::string const &name,
+          boost::shared_ptr<details::callback_base> cb,
+          policies const &p = policies());
+
+     void add_class(std::string const &name,
+          boost::shared_ptr<details::class_handler_base> chb);
+
+     void add_constructor(std::string const &name,
+          boost::shared_ptr<details::class_handler_base> chb,
+          boost::shared_ptr<details::callback_base> cb,
+          policies const &p = policies());
+
+     Tcl_Interp *interp_;
+     bool owner_;
+};
+
+
+// object wrapper
+class object
+{
+public:
+
+     // constructors
+
+     object();
+
+     explicit object(bool b);
+     object(char const *buf, size_t size); // byte array
+     explicit object(double b);
+     explicit object(int i);
+
+     // list creation
+     // the InputIterator should give object& or Tcl_Obj* when dereferenced
+     template <class InputIterator>
+     object(InputIterator first, InputIterator last)
+          : interp_(0)
+     {
+          std::vector<Tcl_Obj*> v;
+          fill_vector(v, first, last);
+          obj_ = Tcl_NewListObj(static_cast<int>(v.size()),
+               v.empty() ? NULL : &v[0]);
+          Tcl_IncrRefCount(obj_);
+     }
+
+     explicit object(long i);
+     explicit object(char const *s);        // string construction
+     explicit object(std::string const &s); // string construction
+
+     explicit object(Tcl_Obj *o, bool shared = false);
+
+     object(object const &other, bool shared = false);
+     ~object();
+
+     // assignment
+
+     object & assign(bool b);
+     object & resize(size_t size);                  // byte array resize
+     object & assign(char const *buf, size_t size); // byte array assignment
+     object & assign(double d);
+     object & assign(int i);
+
+     // list assignment
+     // the InputIterator should give Tcl_Obj* or object& when dereferenced
+     template <class InputIterator>
+     object & assign(InputIterator first, InputIterator last)
+     {
+          std::vector<Tcl_Obj*> v;
+          fill_vector(v, first, last);
+          Tcl_SetListObj(obj_, static_cast<int>(v.size()),
+               v.empty() ? NULL : &v[0]);
+          return *this;
+     }
+
+     object & assign(long l);
+     object & assign(char const *s);        // string assignment
+     object & assign(std::string const &s); // string assignment
+     object & assign(object const &o);
+     object & assign(Tcl_Obj *o);
+
+     object & operator=(bool b)               { return assign(b); }
+     object & operator=(double d)             { return assign(d); }
+     object & operator=(int i)                { return assign(i); }
+     object & operator=(long l)               { return assign(l); }
+     object & operator=(char const *s)        { return assign(s); }
+     object & operator=(std::string const &s) { return assign(s); }
+
+     object & operator=(object const &o)      { return assign(o); }
+     object & swap(object &other);
+
+     // (logically) non-modifying members
+
+     template <typename T>
+     T get(interpreter &i) const;
+
+     char const * get() const;             // string get
+     char const * get(size_t &size) const; // byte array get
+
+     size_t length(interpreter &i) const;  // returns list length
+     object at(interpreter &i, size_t index) const;
+
+     Tcl_Obj * get_object() const { return obj_; }
+
+     // modifying members
+
+     object & append(interpreter &i, object const &o);
+     object & append_list(interpreter &i, object const &o);
+
+     // list replace
+     // the InputIterator should give Tcl_Obj* or object& when dereferenced
+     template <class InputIterator>
+     object & replace(interpreter &i, size_t index, size_t count,
+          InputIterator first, InputIterator last)
+     {
+          std::vector<Tcl_Obj*> v;
+          fill_vector(v, first, last);
+          int res = Tcl_ListObjReplace(i.get(), obj_,
+               static_cast<int>(index), static_cast<int>(count),
+               static_cast<int>(v.size()), v.empty() ? NULL : &v[0]);
+          if (res != TCL_OK)
+          {
+               throw tcl_error(i.get());
+          }
+
+          return *this;
+     }
+
+     object & replace(interpreter &i, size_t index, size_t count,
+          object const &o);
+     object & replace_list(interpreter &i, size_t index, size_t count,
+          object const &o);
+
+     // helper functions for piggy-backing interpreter info
+     void set_interp(Tcl_Interp *interp);
+     Tcl_Interp * get_interp() const;
+
+     // helper function, also used from interpreter::eval
+     template <class InputIterator>
+     static void fill_vector(std::vector<Tcl_Obj*> &v,
+          InputIterator first, InputIterator last)
+     {
+          for (; first != last; ++first)
+          {
+               object o(*first, true);
+               v.push_back(o.obj_);
+          }
+     }
+
+private:
+
+     // helper function used from copy constructors
+     void init(Tcl_Obj *o, bool shared);
+
+     Tcl_Obj *obj_;
+     Tcl_Interp *interp_;
+};
+
+// available specializations for object::get
+template <> bool         object::get<bool>(interpreter &i) const;
+template <> double       object::get<double>(interpreter &i) const;
+template <> int          object::get<int>(interpreter &i) const;
+template <> long         object::get<long>(interpreter &i) const;
+template <> char const * object::get<char const *>(interpreter &i) const;
+template <> std::string  object::get<std::string>(interpreter &i) const;
+template <>
+std::vector<char> object::get<std::vector<char> >(interpreter &i) const;
+
+// the InputIterator should give object& or Tcl_Obj* when dereferenced
+template <class InputIterator>
+details::result interpreter::eval(InputIterator first, InputIterator last)
+{
+     std::vector<Tcl_Obj*> v;
+     object::fill_vector(v, first, last);
+     int cc = Tcl_EvalObjv(interp_,
+          static_cast<int>(v.size()), v.empty() ? NULL : &v[0], 0);
+     if (cc != TCL_OK)
+     {
+          throw tcl_error(interp_);
+     }
+ 
+     return details::result(interp_);
+}
+
+namespace details
+{
+
+// additional callback envelopes for variadic functions
+#include "details/callbacks_v.h"
+
+// additional method envelopes for variadic methods
+#include "details/methods_v.h"
+
+} // namespace details
+
+} // namespace Tcl
+
+
+// macro for defining loadable module entry point
+// - used for extending Tcl interpreter
+
+#define CPPTCL_MODULE(name, i) void name##_cpptcl_Init(Tcl::interpreter &i); \
+     extern "C" int name##_Init(Tcl_Interp *interp) \
+     { \
+          Tcl::interpreter i(interp, false); \
+          name##_cpptcl_Init(i); \
+          return TCL_OK; \
+     } \
+     void name##_cpptcl_Init(Tcl::interpreter &i)
+
+
+#endif // CPPTCL_INCLUDED
Index: /code/branches/buildsystem3/src/network/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/network/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/network/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,22 @@
-SET( NETWORK_SRC_FILES
+ #
+ #             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.
+ #
+
+SET_SOURCE_FILES(NETWORK_SRC_FILES
   ChatListener.cc
   Client.cc
@@ -14,36 +33,35 @@
   Host.cc
 )
+ADD_SUBDIRECTORY(packet)
+GET_ALL_HEADER_FILES(NETWORK_HDR_FILES)
+SET(NETWORK_FILES ${NETWORK_SRC_FILES} ${NETWORK_HDR_FILES})
 
-ADD_SOURCE_DIRECTORY(NETWORK_SRC_FILES packet)
+GENERATE_SOURCE_GROUPS(${NETWORK_FILES})
 ADD_SOURCE_DIRECTORY(NETWORK_SRC_FILES synchronisable)
 
-
-IF(WIN32)
-  ADD_LIBRARY( network ${NETWORK_SRC_FILES} )
-ELSE(WIN32)
-  ADD_LIBRARY( network SHARED ${NETWORK_SRC_FILES} )
-ENDIF(WIN32)
-
-TARGET_LINK_LIBRARIES( network
+ADD_LIBRARY(network SHARED ${NETWORK_FILES})
+SET_TARGET_PROPERTIES(network PROPERTIES DEFINE_SYMBOL "NETWORK_SHARED_BUILD")
+TARGET_LINK_LIBRARIES(network
   ${ZLIB_LIBRARY}
-  ${ENet_LIBRARY}
-  ${Boost_thread_LIBRARIES}
+  ${ENET_LIBRARY}
+  ${Boost_THREAD_LIBRARY}
+  util
   core
 )
 
+ORXONOX_INSTALL(network)
 
 # build those parts only on request.
 IF(NETWORK_TESTING_ENABLED)
   ##### test for gamestate stuff #####
-  SET( TEST_SRC_FILES
+  SET(TEST_SRC_FILES
     ${NETWORK_SRC_FILES}
   )
   ADD_EXECUTABLE(networktest ${TEST_SRC_FILES})
-  TARGET_LINK_LIBRARIES( networktest
-    ${OGRE_LIBRARIES}
+  TARGET_LINK_LIBRARIES(networktest
+    ${OGRE_LIBRARY}
     network
-    ${ENet_LIBRARY}
+    ${ENET_LIBRARY}
     ${ZLIB_LIBRARY}
-    ${WINDOWS_ENET_DEPENDENCIES}
   )
   ##### end test for gamestate stuff #####
Index: de/branches/buildsystem3/src/network/Makefile.norm
===================================================================
--- /code/branches/buildsystem3/src/network/Makefile.norm	(revision 2663)
+++ 	(revision )
@@ -1,40 +1,0 @@
-CC=g++
-MAIN_INC=..
-INC=-I ${MAIN_INC}
-
-all: server client
-
-# Link command:
-server: PacketBuffer.o ConnectionManager.o dummyserver.o PacketDecoder.o PacketGenerator.o
-	${CC} PacketDecoder.o PacketGenerator.o ConnectionManager.o dummyserver.o PacketBuffer.o -o server -lenet -lboost_thread -g
-
-dummyserver.o: dummyserver.cc
-	${CC} -c dummyserver.cc -o dummyserver.o -g ${INC}
-# Compilation commands:
-ConnectionManager.o: ConnectionManager.cc ConnectionManager.h
-	${CC} -c ConnectionManager.cc -o ConnectionManager.o -g ${INC}
-ClientConnection.o: ClientConnection.cc ClientConnection.h
-	${CC} -c ClientConnection.cc -o ClientConnection.o -g ${INC}
-
-PacketBuffer.o: PacketBuffer.cc
-	${CC} -c PacketBuffer.cc -o PacketBuffer.o -g ${INC}
-PacketGenerator.o: PacketGenerator.cc
-	${CC} -c PacketGenerator.cc -o PacketGenerator.o -g ${INC}
-PacketDecoder.o: PacketDecoder.cc
-	${CC} -c PacketDecoder.cc -o PacketDecoder.o -g ${INC}
-Client.o: Client.cc
-	${CC} -c Client.cc -g ${INC}
-Server.o: Server.cc
-	${CC} -c Server.cc -g ${INC}
-Synchronisable.o: Synchronisable.cc
-	${CC} -c Synchronisable.cc -g ${INC}
-GameStateManager.o: GameStateManager.cc
-	${CC} -c GameStateManager.cc -g ${INC}
-
-clean:
-	rm -rf *.o
-
-client_old: PacketGenerator.o dummyclient.cc
-	${CC} dummyclient.cc PacketGenerator.o -o client -lenet -g ${INC}
-client: PacketGenerator.o ClientConnection.o PacketBuffer.o dummyclient2.cc 
-	${CC} dummyclient2.cc PacketGenerator.o PacketBuffer.o ClientConnection.o -o client -lenet -lboost_thread -g ${INC}
Index: de/branches/buildsystem3/src/network/Makefile.tardis
===================================================================
--- /code/branches/buildsystem3/src/network/Makefile.tardis	(revision 2663)
+++ 	(revision )
@@ -1,39 +1,0 @@
-all: server client
-
-CC=g++-4.1.1
-
-BOOST_INC=/usr/pack/boost-1.34.1-sd/i686-debian-linux3.1/include/boost-1_34_1/
-BOOST_LIB=/usr/pack/boost-1.34.1-sd/i686-debian-linux3.1/lib/
-MAIN_INC=..
-ENET_INC=/usr/pack/enet-2007-sd/include/
-ENET_LIB=/usr/pack/enet-2007-sd/i686-debian-linux3.1/lib/
-INC=-I ${BOOST_INC} -I ${MAIN_INC} -I ${ENET_INC}
-LIB=-L ${BOOST_LIB} -L ${ENET_LIB}
-
-# Link command:
-server: clean PacketBuffer.o ConnectionManager.o dummyserver.o PacketGenerator.o PacketDecoder.o
-	${CC} ConnectionManager.o dummyserver.o PacketBuffer.o PacketDecoder.o PacketGenerator.o -o server -lenet -lboost_thread-gcc41-mt -g ${INC} ${LIB} -Wl,-rpath,${BOOST_LIB} -Wl,-rpath,${ENET_LIB}
-
-dummyserver.o:
-	${CC} -c dummyserver.cc -o dummyserver.o -g ${INC}
-# Compilation commands:
-
-ConnectionManager.o:
-	${CC} -c ConnectionManager.cc -o ConnectionManager.o -g ${INC}
-
-PacketBuffer.o: 
-	${CC} -c PacketBuffer.cc -o PacketBuffer.o -g ${INC}
-PacketGenerator.o: PacketGenerator.cc
-	${CC} -c PacketGenerator.cc -o PacketGenerator.o -g ${INC}
-PacketDecoder.o: PacketDecoder.cc
-	${CC} -c PacketDecoder.cc -o PacketDecoder.o -g ${INC}
-Synchronisable.o: Synchronisable.cc
-	${CC} -c Synchronisable.cc -g ${INC}
-GameStateManager.o: GameStateManager.cc
-	${CC} -c GameStateManager.cc -g ${INC}
-
-clean:
-	rm -rf *.o
-
-client: dummyclient.cc PacketDecoder.o PacketGenerator.o
-	${CC} PacketGenerator.o PacketDecoder.o dummyclient.cc -o client -lenet ${LIB} ${INC} -Wl,-rpath,${BOOST_LIB}
Index: de/branches/buildsystem3/src/network/Makefile.test
===================================================================
--- /code/branches/buildsystem3/src/network/Makefile.test	(revision 2663)
+++ 	(revision )
@@ -1,45 +1,0 @@
-CC=g++
-MAIN_INC=..
-INC=-I ${MAIN_INC} -I..
-
-all: server client
-
-# Link command:
-server: PacketBuffer.o ConnectionManager.o dummyserver.o PacketDecoder.o PacketGenerator.o ClientInformation.o
-	${CC} PacketDecoder.o PacketGenerator.o ClientInformation.o ConnectionManager.o dummyserver.o PacketBuffer.o -o server -lenet -lboost_thread -g
-
-dummyserver.o: dummyserver.cc
-	${CC} -c dummyserver.cc -o dummyserver.o -g ${INC}
-# Compilation commands:
-ConnectionManager.o: ConnectionManager.cc ConnectionManager.h
-	${CC} -c ConnectionManager.cc -o ConnectionManager.o -g ${INC}
-ClientConnection.o: ClientConnection.cc ClientConnection.h
-	${CC} -c ClientConnection.cc -o ClientConnection.o -g ${INC}
-
-PacketBuffer.o: PacketBuffer.cc
-	${CC} -c PacketBuffer.cc -o PacketBuffer.o -g ${INC}
-PacketGenerator.o: PacketGenerator.cc
-	${CC} -c PacketGenerator.cc -o PacketGenerator.o -g ${INC}
-PacketDecoder.o: PacketDecoder.cc
-	${CC} -c PacketDecoder.cc -o PacketDecoder.o -g ${INC}
-Client.o: Client.cc
-	${CC} -c Client.cc -g ${INC}
-Server.o: Server.cc
-	${CC} -c Server.cc -g ${INC}
-Synchronisable.o: Synchronisable.cc
-	${CC} -c Synchronisable.cc -g ${INC}
-GameStateManager.o: GameStateManager.cc
-	${CC} -c GameStateManager.cc -g ${INC}
-ClientInformation.o: ClientInformation.cc
-	${CC} -c ClientInformation.cc -g ${INC}
-
-clean:
-	rm -rf *.o
-
-client_old: PacketGenerator.o dummyclient.cc
-	${CC} dummyclient.cc PacketGenerator.o -o client -lenet -g ${INC}
-client: PacketGenerator.o ClientConnection.o PacketBuffer.o dummyclient2.cc 
-	${CC} dummyclient2.cc PacketGenerator.o PacketBuffer.o ClientConnection.o -o client -lenet -lboost_thread -g ${INC}
-
-chatserver: Server.o ConnectionManager.o PacketGenerator.o PacketDecoder.o PacketBuffer.o ClientInformation.o GameStateManager.o
-	${CC} dummyserver3.cc Server.o ConnectionManager.o PacketGenerator.o PacketBuffer.o GameStateManager.o ClientInformation.o -o chatserver -lenet -lboost_thread -g ${INC}
Index: /code/branches/buildsystem3/src/network/NetworkPrereqs.h
===================================================================
--- /code/branches/buildsystem3/src/network/NetworkPrereqs.h	(revision 2663)
+++ /code/branches/buildsystem3/src/network/NetworkPrereqs.h	(revision 2664)
@@ -35,10 +35,10 @@
 #define _NetworkPrereqs_H__
 
-#include "util/OrxonoxPlatform.h"
+#include "OrxonoxConfig.h"
 
 //-----------------------------------------------------------------------
 // Shared library settings
 //-----------------------------------------------------------------------
-#if (ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32) && !defined( NETWORK_STATIC_BUILD )
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined( NETWORK_STATIC_BUILD )
 #  ifdef NETWORK_SHARED_BUILD
 #    define _NetworkExport __declspec(dllexport)
Index: /code/branches/buildsystem3/src/network/packet/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/network/packet/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/network/packet/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,3 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(NETWORK_SRC_FILES
   Packet.cc
   Chat.cc
@@ -8,4 +8,2 @@
   DeleteObjects.cc
 )
-
-ADD_SOURCE_FILES(SRC_FILES)
Index: /code/branches/buildsystem3/src/network/packet/Packet.cc
===================================================================
--- /code/branches/buildsystem3/src/network/packet/Packet.cc	(revision 2663)
+++ /code/branches/buildsystem3/src/network/packet/Packet.cc	(revision 2664)
@@ -167,5 +167,5 @@
   assert(ClientInformation::findClient(&peer->address)->getID() != (unsigned int)-2 || !Host::isServer());
   unsigned int clientID = ClientInformation::findClient(&peer->address)->getID();
-  Packet *p;
+  Packet *p = 0;
   COUT(5) << "packet type: " << *(ENUM::Type *)&data[_PACKETID] << std::endl;
   switch( *(ENUM::Type *)(data + _PACKETID) )
Index: /code/branches/buildsystem3/src/network/packet/Packet.h
===================================================================
--- /code/branches/buildsystem3/src/network/packet/Packet.h	(revision 2663)
+++ /code/branches/buildsystem3/src/network/packet/Packet.h	(revision 2664)
@@ -34,6 +34,4 @@
 #include <enet/enet.h>
 #include <boost/thread/recursive_mutex.hpp>
-
-#include "util/Integers.h"
 
 namespace orxonox {
Index: /code/branches/buildsystem3/src/ogreceguirenderer/AUTHORS
===================================================================
--- /code/branches/buildsystem3/src/ogreceguirenderer/AUTHORS	(revision 2664)
+++ /code/branches/buildsystem3/src/ogreceguirenderer/AUTHORS	(revision 2664)
@@ -0,0 +1,106 @@
+AUTHORS
+=======
+
+OGRE Team 
+---------
+Steve Streeting	(sinbad)              
+Thomas Muldowney (temas)
+James O'Sullivan (_mental_)
+Wladimir J. van der Laan (miathan6/wumpus)
+
+Feature Contributors
+--------------------
+The following list includes developers who have contributed features to OGRE:
+
+Contributor                             Subject Areas 
+-----------                             --------------------------------------
+Adrian Cearnau (cearny)               : Codecs, dynamic library loading
+Jon Anderson (janders)                : octree plugin
+Martin Persson                        : Nature plugin
+Jesse Rusak (jder) 	  				  : Mac OSX port
+Etienne Mallard (earthquakeproof)	  : 3D Studio Model Exporter
+Banania								  : ditto
+Paolo Gavocanov (cTh) 				  : Initial D3D9 port, Meshviewer, 
+                                        3D Studio Scene Exporter
+Ivica Aracic (macross/bytelord)       : Ogre4J, Maya exporter, .scene format
+Jeff Leigh							  : Sky enhancements, debug overlay
+Jose A Milan (jamilan/spoke)          : Paging landscape plugin
+Tuan Kuranes (kuranes)                : ditto
+Stephan Kaiser (psyclonist)           : OgreFsrad, OgreLMTS, .scene format
+Philippe Culet                        : Attaching objects to bones
+Jon L. Griffeth (silent3)             : GUI enhancements
+Dan Sonnemann (oberleutnantdan)       : Timers
+Amit Mathew                           : Profiler
+Dennis Verbeek                        : Lightwave exporter
+David Whittaker                       : Displacement mapping terrain
+Chris Groskopf (staringmonkey)        : OgreTok
+Jeff Doyle (nfz)                      : ATI_fragment_shader compiler, 
+                                        paging landscape
+Patrick Kooman                        : Overlay editor
+Doug Wolanick (icetec)                : DotSceneOctree exporter & plugin
+John Van Vliet (granite/fifty1)       : Maya exporter
+Marcin Zukowski (eru)                 : Demo_CubeMapping and Demo_Water
+Jens Hoffmann                         : Blender exporter
+Michael Reimpell                      : Blender exporter
+Sam le Pirate                         : BMP support
+Attila Tajti (attis)                  : Wings3D exporter
+? (Firestorm)                         : Particle scale and rotate affectors
+Lee Sandberg                          : Hardware occlusion query support
+Phillip Castaneda (pjcast)            : External texture sources / dynamic
+										textures
+Henry Goffin (qsilver)				  : Ultra-fast scaling code in 
+										OgreImageResampler.h
+Federico Di Gregorio (fog)			  : Debian packaging
+
+Others
+------
+The following people have been notable in their support of OGRE through the
+fixing of bugs, testing patches, and various other miscellaneous contributions:
+
+Timo Keller (norondion) 
+Kai-Peter Backman
+Daniel Wessl?n
+Benny Kramek (wolfman8k) 
+Riku Nurminen (rakkis)
+Christopher John Gilbert (thegilb)
+Martin Pollard (xmp)
+Nikita Mikros (santanopoulos)
+Chris Heald (antiarc)
+Michael Casaday
+Evgeni Popov
+Chris McGuirk (leedgitar)
+Te'ja (thiveertm)
+Keith Jackson
+G Nikolakis
+Genva
+Christian Lindequist Larsen (DWORD)
+Chris Heald (Antiarc)
+Green Eyed Monster (monster)
+
+
+
+
+If we've forgotten you in the above list, please contact us!
+
+See Readme.html in the Docs folder for more details, in particular information on the media supplied with the demos.
+
+-----
+
+Copyright 1999-2004 The OGRE Team.
+
+This file is part of OGRE (Object-Oriented Graphics Rendering Engine).
+
+OGRE is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+OGRE 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 Lesser General Public License
+along with OGRE; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
Index: /code/branches/buildsystem3/src/ogreceguirenderer/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/ogreceguirenderer/CMakeLists.txt	(revision 2664)
+++ /code/branches/buildsystem3/src/ogreceguirenderer/CMakeLists.txt	(revision 2664)
@@ -0,0 +1,38 @@
+ #
+ #             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.
+ #
+
+SET(OCR_FILES
+  OgreCEGUIRenderer.h
+  OgreCEGUIResourceProvider.h
+  OgreCEGUITexture.h
+
+  OgreCEGUIRenderer.cpp
+  OgreCEGUIResourceProvider.cpp
+  OgreCEGUITexture.cpp
+)
+GENERATE_SOURCE_GROUPS(${OCR_FILES})
+
+ADD_LIBRARY(ogreceguirenderer_orxonox SHARED ${OCR_FILES})
+SET_TARGET_PROPERTIES(ogreceguirenderer_orxonox PROPERTIES DEFINE_SYMBOL "OGRE_GUIRENDERER_EXPORTS")
+TARGET_LINK_LIBRARIES(ogreceguirenderer_orxonox
+  ${OGRE_LIBRARY}
+  ${CEGUI_LIBRARY}
+)
+
+ORXONOX_INSTALL(ogreceguirenderer_orxonox)
Index: /code/branches/buildsystem3/src/ogreceguirenderer/COPYING
===================================================================
--- /code/branches/buildsystem3/src/ogreceguirenderer/COPYING	(revision 2664)
+++ /code/branches/buildsystem3/src/ogreceguirenderer/COPYING	(revision 2664)
@@ -0,0 +1,514 @@
+		  GNU LESSER GENERAL PUBLIC LICENSE
+		       Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL.  It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+			    Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+  This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it.  You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+  When we speak of free software, we are referring to freedom of use,
+not price.  Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+  To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights.  These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+  For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you.  You must make sure that they, too, receive or can get the source
+code.  If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it.  And you must show them these terms so they know their rights.
+
+  We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+  To protect each distributor, we want to make it very clear that
+there is no warranty for the free library.  Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+
+  Finally, software patents pose a constant threat to the existence of
+any free program.  We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder.  Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+  Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License.  This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License.  We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+  When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library.  The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom.  The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+  We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License.  It also provides other free software developers Less
+of an advantage over competing non-free programs.  These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries.  However, the Lesser license provides advantages in certain
+special circumstances.
+
+  For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard.  To achieve this, non-free programs must be
+allowed to use the library.  A more frequent case is that a free
+library does the same job as widely used non-free libraries.  In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+  In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software.  For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+  Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.  Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library".  The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+
+		  GNU LESSER GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+  A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+  The "Library", below, refers to any such software library or work
+which has been distributed under these terms.  A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language.  (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+  "Source code" for a work means the preferred form of the work for
+making modifications to it.  For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+  Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it).  Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+  
+  1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+  You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+
+  2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) The modified work must itself be a software library.
+
+    b) You must cause the files modified to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    c) You must cause the whole of the work to be licensed at no
+    charge to all third parties under the terms of this License.
+
+    d) If a facility in the modified Library refers to a function or a
+    table of data to be supplied by an application program that uses
+    the facility, other than as an argument passed when the facility
+    is invoked, then you must make a good faith effort to ensure that,
+    in the event an application does not supply such function or
+    table, the facility still operates, and performs whatever part of
+    its purpose remains meaningful.
+
+    (For example, a function in a library to compute square roots has
+    a purpose that is entirely well-defined independent of the
+    application.  Therefore, Subsection 2d requires that any
+    application-supplied function or table used by this function must
+    be optional: if the application does not supply it, the square
+    root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library.  To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License.  (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.)  Do not make any other change in
+these notices.
+
+
+  Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+  This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+  4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+  If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library".  Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+  However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library".  The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+  When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library.  The
+threshold for this to be true is not precisely defined by law.
+
+  If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work.  (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+  Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+
+  6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+  You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License.  You must supply a copy of this License.  If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License.  Also, you must do one
+of these things:
+
+    a) Accompany the work with the complete corresponding
+    machine-readable source code for the Library including whatever
+    changes were used in the work (which must be distributed under
+    Sections 1 and 2 above); and, if the work is an executable linked
+    with the Library, with the complete machine-readable "work that
+    uses the Library", as object code and/or source code, so that the
+    user can modify the Library and then relink to produce a modified
+    executable containing the modified Library.  (It is understood
+    that the user who changes the contents of definitions files in the
+    Library will not necessarily be able to recompile the application
+    to use the modified definitions.)
+
+    b) Use a suitable shared library mechanism for linking with the
+    Library.  A suitable mechanism is one that (1) uses at run time a
+    copy of the library already present on the user's computer system,
+    rather than copying library functions into the executable, and (2)
+    will operate properly with a modified version of the library, if
+    the user installs one, as long as the modified version is
+    interface-compatible with the version that the work was made with.
+
+    c) Accompany the work with a written offer, valid for at
+    least three years, to give the same user the materials
+    specified in Subsection 6a, above, for a charge no more
+    than the cost of performing this distribution.
+
+    d) If distribution of the work is made by offering access to copy
+    from a designated place, offer equivalent access to copy the above
+    specified materials from the same place.
+
+    e) Verify that the user has already received a copy of these
+    materials or that you have already sent this user a copy.
+
+  For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it.  However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+  It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system.  Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+
+  7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+    a) Accompany the combined library with a copy of the same work
+    based on the Library, uncombined with any other library
+    facilities.  This must be distributed under the terms of the
+    Sections above.
+
+    b) Give prominent notice with the combined library of the fact
+    that part of it is a work based on the Library, and explaining
+    where to find the accompanying uncombined form of the same work.
+
+  8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License.  Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License.  However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+  9. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Library or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+  10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+
+  11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded.  In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+  13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation.  If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+
+  14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission.  For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this.  Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+			    NO WARRANTY
+
+  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+		     END OF TERMS AND CONDITIONS
+
+
+           How to Apply These Terms to Your New Libraries
+
+  If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change.  You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+  To apply these terms, attach the following notices to the library.  It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+    <one line to give the library's name and a brief idea of what it does.>
+    Copyright (C) <year>  <name of author>
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary.  Here is a sample; alter the names:
+
+  Yoyodyne, Inc., hereby disclaims all copyright interest in the
+  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+  <signature of Ty Coon>, 1 April 1990
+  Ty Coon, President of Vice
+
+That's all there is to it!
+
+
+
Index: /code/branches/buildsystem3/src/ogreceguirenderer/OgreCEGUIRenderer.cpp
===================================================================
--- /code/branches/buildsystem3/src/ogreceguirenderer/OgreCEGUIRenderer.cpp	(revision 2664)
+++ /code/branches/buildsystem3/src/ogreceguirenderer/OgreCEGUIRenderer.cpp	(revision 2664)
@@ -0,0 +1,789 @@
+/************************************************************************
+	filename: 	OgreCEGUIRenderer.cpp
+	created:	11/5/2004
+	author:		Paul D Turner
+	
+	purpose:	Implementation of Renderer class for Ogre engine
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+
+#include <CEGUIImagesetManager.h>
+#include <CEGUIImageset.h>
+#include <CEGUIImage.h>
+#include <CEGUIExceptions.h>
+#include <CEGUISystem.h>
+
+#include "OgreCEGUIRenderer.h"
+#include "OgreCEGUITexture.h"
+#include "OgreCEGUIResourceProvider.h"
+
+#include <OgreRenderSystem.h>
+#include <OgreRoot.h>
+#include <OgreHardwareBufferManager.h>
+#include <OgreRenderWindow.h>
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*************************************************************************
+	Constants definitions
+*************************************************************************/
+const size_t	OgreCEGUIRenderer::VERTEX_PER_QUAD			= 6;
+const size_t	OgreCEGUIRenderer::VERTEX_PER_TRIANGLE		= 3;
+const size_t	OgreCEGUIRenderer::VERTEXBUFFER_INITIAL_CAPACITY	= 256;
+const size_t    OgreCEGUIRenderer::UNDERUSED_FRAME_THRESHOLD = 50000; // halfs buffer every 8 minutes on 100fps
+
+/*************************************************************************
+	Utility function to create a render operation and vertex buffer to render quads
+*************************************************************************/
+static void createQuadRenderOp(Ogre::RenderOperation &d_render_op, 
+    Ogre::HardwareVertexBufferSharedPtr &d_buffer, size_t nquads)
+{
+    using namespace Ogre;
+    // Create and initialise the Ogre specific parts required for use in rendering later.
+	d_render_op.vertexData = new VertexData;
+	d_render_op.vertexData->vertexStart = 0;
+
+	// setup vertex declaration for the vertex format we use
+	VertexDeclaration* vd = d_render_op.vertexData->vertexDeclaration;
+	size_t vd_offset = 0;
+	vd->addElement(0, vd_offset, VET_FLOAT3, VES_POSITION);
+	vd_offset += VertexElement::getTypeSize(VET_FLOAT3);
+	vd->addElement(0, vd_offset, VET_COLOUR, VES_DIFFUSE);
+	vd_offset += VertexElement::getTypeSize(VET_COLOUR);
+	vd->addElement(0, vd_offset, VET_FLOAT2, VES_TEXTURE_COORDINATES);
+
+	// create hardware vertex buffer
+	d_buffer = HardwareBufferManager::getSingleton().createVertexBuffer(vd->getVertexSize(0), nquads,  
+        HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE, false);
+
+	// bind vertex buffer
+	d_render_op.vertexData->vertexBufferBinding->setBinding(0, d_buffer);
+
+	// complete render operation basic initialisation
+	d_render_op.operationType = RenderOperation::OT_TRIANGLE_LIST;
+	d_render_op.useIndexes = false;
+}
+
+static void destroyQuadRenderOp(Ogre::RenderOperation &d_render_op, 
+    Ogre::HardwareVertexBufferSharedPtr &d_buffer)
+{
+    delete d_render_op.vertexData;
+    d_render_op.vertexData = 0;
+    d_buffer.setNull();
+}
+
+/*************************************************************************
+	Constructor
+*************************************************************************/
+OgreCEGUIRenderer::OgreCEGUIRenderer(Ogre::RenderWindow* window, Ogre::uint8 queue_id, bool post_queue, uint max_quads)
+{
+	constructor_impl(window, queue_id, post_queue, max_quads);
+}
+
+
+/*************************************************************************
+	Constructor (specifying scene manager)
+*************************************************************************/
+OgreCEGUIRenderer::OgreCEGUIRenderer(Ogre::RenderWindow* window, Ogre::uint8 queue_id, bool post_queue, uint max_quads, Ogre::SceneManager* scene_manager)
+{
+	constructor_impl(window, queue_id, post_queue, max_quads);
+
+	// hook into ogre rendering system
+	setTargetSceneManager(scene_manager);
+}
+
+
+/*************************************************************************
+	Destructor
+*************************************************************************/
+OgreCEGUIRenderer::~OgreCEGUIRenderer(void)
+{
+	setTargetSceneManager(NULL);
+
+	if (d_ourlistener)
+	{
+		delete d_ourlistener;
+	}
+
+	// cleanup vertex data we allocated in constructor
+	destroyQuadRenderOp(d_render_op, d_buffer);
+    destroyQuadRenderOp(d_direct_render_op, d_direct_buffer);
+
+	destroyAllTextures();
+}
+
+
+/*************************************************************************
+	add's a quad to the list to be rendered
+*************************************************************************/
+void OgreCEGUIRenderer::addQuad(const Rect& dest_rect, float z, const Texture* tex, const Rect& texture_rect, const ColourRect& colours, QuadSplitMode quad_split_mode)
+{
+	// if not queueing, render directly (as in, right now!). This is used for the mouse cursor.
+	if (!d_queueing)
+	{
+		renderQuadDirect(dest_rect, z, tex, texture_rect, colours, quad_split_mode);
+	}
+	else
+	{
+		d_sorted = false;
+		QuadInfo quad;
+		
+		// set quad position, flipping y co-ordinates, and applying appropriate texel origin offset
+		quad.position.d_left	= dest_rect.d_left;
+		quad.position.d_right	= dest_rect.d_right;
+		quad.position.d_top		= d_display_area.getHeight() - dest_rect.d_top;
+		quad.position.d_bottom	= d_display_area.getHeight() - dest_rect.d_bottom;
+		quad.position.offset(d_texelOffset);
+
+		// convert quad co-ordinates for a -1 to 1 co-ordinate system.
+		quad.position.d_left	/= (d_display_area.getWidth() * 0.5f);
+		quad.position.d_right	/= (d_display_area.getWidth() * 0.5f);
+		quad.position.d_top		/= (d_display_area.getHeight() * 0.5f);
+		quad.position.d_bottom	/= (d_display_area.getHeight() * 0.5f);
+		quad.position.offset(Point(-1.0f, -1.0f));
+
+		quad.z				= -1 + z;
+		quad.texture		= ((OgreCEGUITexture*)tex)->getOgreTexture();
+		quad.texPosition	= texture_rect;
+
+		// covert colours for ogre, note that top / bottom are switched.
+		quad.topLeftCol		= colourToOgre(colours.d_bottom_left);
+		quad.topRightCol	= colourToOgre(colours.d_bottom_right);
+		quad.bottomLeftCol	= colourToOgre(colours.d_top_left);
+		quad.bottomRightCol	= colourToOgre(colours.d_top_right);
+		
+		// set quad split mode
+		quad.splitMode = quad_split_mode;
+
+		d_quadlist.insert(quad);
+	}
+}
+
+
+
+/*************************************************************************
+perform final rendering for all queued renderable quads.
+*************************************************************************/
+void OgreCEGUIRenderer::doRender(void)
+{
+    // Render if overlays enabled and the quad list is not empty
+	if (d_render_sys->_getViewport()->getOverlaysEnabled() && !d_quadlist.empty())
+	{
+        /// Quad list needs to be sorted and thus the vertex buffer rebuilt. If not, we can
+        /// reuse the vertex buffer resulting in a nice speed gain.
+        if(!d_sorted)
+        {
+            sortQuads();
+            /// Resize vertex buffer if it is too small
+            size_t size = d_buffer->getNumVertices();
+            size_t requestedSize = d_quadlist.size()*VERTEX_PER_QUAD;
+            if(size < requestedSize)
+            {
+                /// Double buffer size until smaller than requested size
+                while(size < requestedSize)
+                    size = size * 2;
+                /// Reallocate the buffer
+                destroyQuadRenderOp(d_render_op, d_buffer);
+                createQuadRenderOp(d_render_op, d_buffer, size);
+            }
+            else if(requestedSize < size/2 && d_underused_framecount >= UNDERUSED_FRAME_THRESHOLD)
+            {
+                /// Resize vertex buffer if it has been to big for too long
+                size = size / 2;
+                destroyQuadRenderOp(d_render_op, d_buffer);
+                createQuadRenderOp(d_render_op, d_buffer, size);
+                /// Reset underused framecount so it takes another UNDERUSED_FRAME_THRESHOLD to half again
+                d_underused_framecount = 0;
+            }
+            /// Fill the buffer
+            QuadVertex*	buffmem;
+            buffmem = (QuadVertex*)d_buffer->lock(Ogre::HardwareVertexBuffer::HBL_DISCARD);
+            // iterate over each quad in the list
+            for (QuadList::iterator i = d_quadlist.begin(); i != d_quadlist.end(); ++i)
+            {
+                const QuadInfo& quad = (*i);
+                // setup Vertex 1...
+                buffmem->x = quad.position.d_left;
+                buffmem->y = quad.position.d_bottom;
+                buffmem->z = quad.z;
+                buffmem->diffuse = quad.topLeftCol;
+                buffmem->tu1 = quad.texPosition.d_left;
+                buffmem->tv1 = quad.texPosition.d_bottom;
+                ++buffmem;
+    
+                // setup Vertex 2...
+                
+                // top-left to bottom-right diagonal
+                if (quad.splitMode == TopLeftToBottomRight)
+                {
+                    buffmem->x = quad.position.d_right;
+                    buffmem->y = quad.position.d_bottom;
+                    buffmem->z = quad.z;
+                    buffmem->diffuse = quad.topRightCol;
+                    buffmem->tu1 = quad.texPosition.d_right;
+                    buffmem->tv1 = quad.texPosition.d_bottom;
+                }
+                // bottom-left to top-right diagonal
+                else
+                {
+                    buffmem->x = quad.position.d_right;
+                    buffmem->y = quad.position.d_top;
+                    buffmem->z = quad.z;
+                    buffmem->diffuse = quad.bottomRightCol;
+                    buffmem->tu1 = quad.texPosition.d_right;
+                    buffmem->tv1 = quad.texPosition.d_top;
+                }
+                ++buffmem;
+    
+                // setup Vertex 3...
+                buffmem->x = quad.position.d_left;
+                buffmem->y = quad.position.d_top;
+                buffmem->z = quad.z;
+                buffmem->diffuse = quad.bottomLeftCol;
+                buffmem->tu1 = quad.texPosition.d_left;
+                buffmem->tv1 = quad.texPosition.d_top;
+                ++buffmem;
+    
+                // setup Vertex 4...
+                buffmem->x = quad.position.d_right;
+                buffmem->y = quad.position.d_bottom;
+                buffmem->z = quad.z;
+                buffmem->diffuse = quad.topRightCol;
+                buffmem->tu1 = quad.texPosition.d_right;
+                buffmem->tv1 = quad.texPosition.d_bottom;
+                ++buffmem;
+    
+                // setup Vertex 5...
+                buffmem->x = quad.position.d_right;
+                buffmem->y = quad.position.d_top;
+                buffmem->z = quad.z;
+                buffmem->diffuse = quad.bottomRightCol;
+                buffmem->tu1 = quad.texPosition.d_right;
+                buffmem->tv1 = quad.texPosition.d_top;
+                ++buffmem;
+    
+                // setup Vertex 6...
+                
+                // top-left to bottom-right diagonal
+                if (quad.splitMode == TopLeftToBottomRight)
+                {
+                    buffmem->x = quad.position.d_left;
+                    buffmem->y = quad.position.d_top;
+                    buffmem->z = quad.z;
+                    buffmem->diffuse = quad.bottomLeftCol;
+                    buffmem->tu1 = quad.texPosition.d_left;
+                    buffmem->tv1 = quad.texPosition.d_top;
+                }
+                // bottom-left to top-right diagonal
+                else
+                {
+                    buffmem->x = quad.position.d_left;
+                    buffmem->y = quad.position.d_bottom;
+                    buffmem->z = quad.z;
+                    buffmem->diffuse = quad.topLeftCol;
+                    buffmem->tu1 = quad.texPosition.d_left;
+                    buffmem->tv1 = quad.texPosition.d_bottom;
+                }
+                ++buffmem;
+            }
+    
+            // ensure we leave the buffer in the unlocked state
+            d_buffer->unlock();
+        }
+        
+        /// Render the buffer
+        d_bufferPos = 0;
+		bool first = true;
+
+        // Iterate over each quad in the list and render it
+        QuadList::iterator i = d_quadlist.begin();
+        while(i != d_quadlist.end())
+        {
+            
+            d_currTexture = i->texture;
+            d_render_op.vertexData->vertexStart = d_bufferPos;
+            for (; i != d_quadlist.end(); ++i)
+            {
+                const QuadInfo& quad = (*i);
+                if (d_currTexture != quad.texture)
+				{
+                    /// If it has a different texture, render this quad in next operation
+					/// also need to reset render states
+					first = true;
+		            break;
+				}
+                d_bufferPos += VERTEX_PER_QUAD;
+            }
+            d_render_op.vertexData->vertexCount = d_bufferPos - d_render_op.vertexData->vertexStart;
+            /// Set texture, and do the render
+            d_render_sys->_setTexture(0, true, d_currTexture);
+			if (first)
+			{
+				initRenderStates();
+				first = false;
+			}
+            d_render_sys->_render(d_render_op);
+        }
+
+	}
+    /// Count frames to check if utilization of vertex buffer was below half the capacity for 500,000 frames
+    if(d_bufferPos < d_buffer->getNumVertices()/2)
+       d_underused_framecount++;
+    else
+       d_underused_framecount = 0;
+}
+
+
+/*************************************************************************
+	clear the queue
+*************************************************************************/
+void OgreCEGUIRenderer::clearRenderList(void)
+{
+	d_sorted = true;
+	d_quadlist.clear();
+}
+
+
+/*************************************************************************
+	create an empty texture
+*************************************************************************/
+Texture* OgreCEGUIRenderer::createTexture(void)
+{
+	OgreCEGUITexture* tex = new OgreCEGUITexture(this);
+	d_texturelist.push_back(tex);
+	return tex;
+}
+
+
+/*************************************************************************
+	create a texture and load it with the specified file.
+*************************************************************************/
+Texture* OgreCEGUIRenderer::createTexture(const String& filename, const String& resourceGroup)
+{
+	OgreCEGUITexture* tex = (OgreCEGUITexture*)createTexture();
+	tex->loadFromFile(filename, resourceGroup);
+
+	return tex;
+}
+
+
+/*************************************************************************
+	create a texture and set it to the specified size
+*************************************************************************/
+Texture* OgreCEGUIRenderer::createTexture(float size)
+{
+	OgreCEGUITexture* tex = (OgreCEGUITexture*)createTexture();
+	tex->setOgreTextureSize((uint)size);
+
+	return tex;
+}
+
+
+/*************************************************************************
+	destroy the given texture
+*************************************************************************/
+void OgreCEGUIRenderer::destroyTexture(Texture* texture)
+{
+	if (texture != NULL)
+	{
+		OgreCEGUITexture* tex = (OgreCEGUITexture*)texture;
+
+		d_texturelist.remove(tex);
+		delete tex;
+	}
+}
+
+
+/*************************************************************************
+	destroy all textures still active
+*************************************************************************/
+void OgreCEGUIRenderer::destroyAllTextures(void)
+{
+	while (!d_texturelist.empty())
+	{
+		destroyTexture(*(d_texturelist.begin()));
+	}
+}
+
+
+/*************************************************************************
+	setup states etc	
+*************************************************************************/
+void OgreCEGUIRenderer::initRenderStates(void)
+{
+	using namespace Ogre;
+
+	// set-up matrices
+	d_render_sys->_setWorldMatrix(Matrix4::IDENTITY);
+	d_render_sys->_setViewMatrix(Matrix4::IDENTITY);
+	d_render_sys->_setProjectionMatrix(Matrix4::IDENTITY);
+
+	// initialise render settings
+	d_render_sys->setLightingEnabled(false);
+	d_render_sys->_setDepthBufferParams(false, false);
+	d_render_sys->_setDepthBias(0, 0);
+	d_render_sys->_setCullingMode(CULL_NONE);
+	d_render_sys->_setFog(FOG_NONE);
+	d_render_sys->_setColourBufferWriteEnabled(true, true, true, true);
+	d_render_sys->unbindGpuProgram(GPT_FRAGMENT_PROGRAM);
+	d_render_sys->unbindGpuProgram(GPT_VERTEX_PROGRAM);
+	d_render_sys->setShadingType(SO_GOURAUD);
+	d_render_sys->_setPolygonMode(PM_SOLID);
+
+	// initialise texture settings
+	d_render_sys->_setTextureCoordCalculation(0, TEXCALC_NONE);
+	d_render_sys->_setTextureCoordSet(0, 0);
+	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);
+	d_render_sys->_setAlphaRejectSettings(CMPF_ALWAYS_PASS, 0);
+	d_render_sys->_setTextureBlendMode(0, d_colourBlendMode);
+	d_render_sys->_setTextureBlendMode(0, d_alphaBlendMode);
+	d_render_sys->_disableTextureUnitsFrom(1);
+
+	// enable alpha blending
+	d_render_sys->_setSceneBlending(SBF_SOURCE_ALPHA, SBF_ONE_MINUS_SOURCE_ALPHA);
+}
+
+
+ 
+/*************************************************************************
+	sort quads list according to texture	
+*************************************************************************/
+void OgreCEGUIRenderer::sortQuads(void)
+{
+	if (!d_sorted)
+	{
+		d_sorted = true;
+	}
+
+}
+
+/*************************************************************************
+render a quad directly to the display
+*************************************************************************/
+void OgreCEGUIRenderer::renderQuadDirect(const Rect& dest_rect, float z, const Texture* tex, const Rect& texture_rect, const ColourRect& colours, QuadSplitMode quad_split_mode)
+{
+	if (d_render_sys->_getViewport()->getOverlaysEnabled())
+	{
+		z = -1 + z;
+
+		Rect final_rect;
+
+		// set quad position, flipping y co-ordinates, and applying appropriate texel origin offset
+		final_rect.d_left	= dest_rect.d_left;
+		final_rect.d_right	= dest_rect.d_right;
+		final_rect.d_top	= d_display_area.getHeight() - dest_rect.d_top;
+		final_rect.d_bottom	= d_display_area.getHeight() - dest_rect.d_bottom;
+		final_rect.offset(d_texelOffset);
+
+		// convert quad co-ordinates for a -1 to 1 co-ordinate system.
+		final_rect.d_left	/= (d_display_area.getWidth() * 0.5f);
+		final_rect.d_right	/= (d_display_area.getWidth() * 0.5f);
+		final_rect.d_top	/= (d_display_area.getHeight() * 0.5f);
+		final_rect.d_bottom	/= (d_display_area.getHeight() * 0.5f);
+		final_rect.offset(Point(-1.0f, -1.0f));
+
+		// convert colours for ogre, note that top / bottom are switched.
+        uint32 topLeftCol	= colourToOgre(colours.d_bottom_left);
+        uint32 topRightCol	= colourToOgre(colours.d_bottom_right);
+        uint32 bottomLeftCol	= colourToOgre(colours.d_top_left);
+        uint32 bottomRightCol= colourToOgre(colours.d_top_right);
+
+		QuadVertex*	buffmem = (QuadVertex*)d_direct_buffer->lock(Ogre::HardwareVertexBuffer::HBL_DISCARD);
+
+		// setup Vertex 1...
+		buffmem->x	= final_rect.d_left;
+		buffmem->y	= final_rect. d_bottom;
+		buffmem->z	= z;
+		buffmem->diffuse = topLeftCol;
+		buffmem->tu1	= texture_rect.d_left;
+		buffmem->tv1	= texture_rect.d_bottom;
+		++buffmem;
+
+		// setup Vertex 2...
+		
+		// top-left to bottom-right diagonal
+		if (quad_split_mode == TopLeftToBottomRight)
+		{
+			buffmem->x	= final_rect.d_right;
+			buffmem->y = final_rect.d_bottom;
+			buffmem->z	= z;
+			buffmem->diffuse = topRightCol;
+			buffmem->tu1	= texture_rect.d_right;
+			buffmem->tv1	= texture_rect.d_bottom;
+			++buffmem;
+		}
+		// bottom-left to top-right diagonal
+		else
+		{
+			buffmem->x	= final_rect.d_right;
+			buffmem->y = final_rect.d_top;
+			buffmem->z	= z;
+			buffmem->diffuse = bottomRightCol;
+			buffmem->tu1	= texture_rect.d_right;
+			buffmem->tv1	= texture_rect.d_top;
+			++buffmem;
+		}
+
+		// setup Vertex 3...
+		buffmem->x	= final_rect.d_left;
+		buffmem->y	= final_rect.d_top;
+		buffmem->z	= z;
+		buffmem->diffuse = bottomLeftCol;
+		buffmem->tu1	= texture_rect.d_left;
+		buffmem->tv1	= texture_rect.d_top;
+		++buffmem;
+
+		// setup Vertex 4...
+		buffmem->x	= final_rect.d_right;
+		buffmem->y	= final_rect.d_bottom;
+		buffmem->z	= z;
+		buffmem->diffuse = topRightCol;
+		buffmem->tu1	= texture_rect.d_right;
+		buffmem->tv1	= texture_rect.d_bottom;
+		++buffmem;
+
+		// setup Vertex 5...
+		buffmem->x	= final_rect.d_right;
+		buffmem->y	= final_rect.d_top;
+		buffmem->z	= z;
+		buffmem->diffuse = bottomRightCol;
+		buffmem->tu1	= texture_rect.d_right;
+		buffmem->tv1	= texture_rect.d_top;
+		++buffmem;
+
+		// setup Vertex 6...
+		
+		// top-left to bottom-right diagonal
+		if (quad_split_mode == TopLeftToBottomRight)
+		{
+			buffmem->x	= final_rect.d_left;
+			buffmem->y = final_rect.d_top;
+			buffmem->z	= z;
+			buffmem->diffuse = bottomLeftCol;
+			buffmem->tu1	= texture_rect.d_left;
+			buffmem->tv1	= texture_rect.d_top;
+		}
+		// bottom-left to top-right diagonal
+		else
+		{
+			buffmem->x	= final_rect.d_left;
+			buffmem->y = final_rect.d_bottom;
+			buffmem->z	= z;
+			buffmem->diffuse = topLeftCol;
+			buffmem->tu1	= texture_rect.d_left;
+			buffmem->tv1	= texture_rect.d_bottom;
+		}
+
+		d_direct_buffer->unlock();
+
+        //
+		// perform rendering...
+		//
+		d_render_sys->_setTexture(0, true, ((OgreCEGUITexture*)tex)->getOgreTexture()->getName());
+		initRenderStates();
+		d_direct_render_op.vertexData->vertexCount = VERTEX_PER_QUAD;
+		d_render_sys->_render(d_direct_render_op);
+	}
+
+}
+
+/*************************************************************************
+	convert ARGB colour value to whatever the Ogre render system is
+	expecting.	
+*************************************************************************/
+uint32 OgreCEGUIRenderer::colourToOgre(const colour& col) const
+{
+	Ogre::ColourValue cv(col.getRed(), col.getGreen(), col.getBlue(), col.getAlpha());
+
+    uint32 final;
+	d_render_sys->convertColourValue(cv, &final);
+
+	return final;
+}
+
+
+/*************************************************************************
+	Set the scene manager to be used for rendering the GUI.	
+*************************************************************************/
+void OgreCEGUIRenderer::setTargetSceneManager(Ogre::SceneManager* scene_manager)
+{
+	// unhook from current scene manager.
+	if (d_sceneMngr != NULL)
+	{
+		d_sceneMngr->removeRenderQueueListener(d_ourlistener);
+		d_sceneMngr = NULL;
+	}
+
+	// hook new scene manager if that is not NULL
+	if (scene_manager != NULL)
+	{
+		d_sceneMngr = scene_manager;
+		d_sceneMngr->addRenderQueueListener(d_ourlistener);
+	}
+
+}
+
+
+/*************************************************************************
+	Set the target render queue for GUI rendering.	
+*************************************************************************/
+void OgreCEGUIRenderer::setTargetRenderQueue(Ogre::uint8 queue_id, bool post_queue)
+{
+	d_queue_id		= queue_id;
+	d_post_queue	= post_queue;
+
+	if (d_ourlistener != NULL)
+	{
+		d_ourlistener->setTargetRenderQueue(queue_id);
+		d_ourlistener->setPostRenderQueue(post_queue);
+	}
+
+}
+
+
+/*************************************************************************
+	perform main work of the constructor
+*************************************************************************/
+void OgreCEGUIRenderer::constructor_impl(Ogre::RenderWindow* window, Ogre::uint8 queue_id, bool post_queue, uint max_quads)
+{
+	using namespace Ogre;
+
+	// initialise the renderer fields
+	d_queueing		= true;
+	d_queue_id		= queue_id;
+	d_currTexture.isNull();
+	d_post_queue	= post_queue;
+	d_sceneMngr		= NULL;
+	d_bufferPos		= 0;
+	d_sorted		= true;
+	d_ogre_root		= Root::getSingletonPtr();
+	d_render_sys	= d_ogre_root->getRenderSystem();
+    // set ID string
+    d_identifierString = "CEGUI::OgreRenderer - Official Ogre based renderer module for CEGUI";
+
+	// Create and initialise the Ogre specific parts required for use in rendering later.
+    // Main GUI
+    createQuadRenderOp(d_render_op, d_buffer, VERTEXBUFFER_INITIAL_CAPACITY);
+    d_underused_framecount = 0;
+
+    // Mouse cursor
+    createQuadRenderOp(d_direct_render_op, d_direct_buffer, VERTEX_PER_QUAD);
+
+	// Discover display settings and setup d_display_area
+	d_display_area.d_left	= 0;
+	d_display_area.d_top	= 0;
+	d_display_area.d_right	= window->getWidth();
+	d_display_area.d_bottom	= window->getHeight();
+
+	// initialise required texel offset
+	d_texelOffset = Point((float)d_render_sys->getHorizontalTexelOffset(), -(float)d_render_sys->getVerticalTexelOffset());
+
+	// create listener which will handler the rendering side of things for us.
+	d_ourlistener = new CEGUIRQListener(this, queue_id, post_queue);
+
+	// Initialise blending modes to be used.
+	d_colourBlendMode.blendType	= Ogre::LBT_COLOUR;
+	d_colourBlendMode.source1	= Ogre::LBS_TEXTURE;
+	d_colourBlendMode.source2	= Ogre::LBS_DIFFUSE;
+	d_colourBlendMode.operation	= Ogre::LBX_MODULATE;
+
+	d_alphaBlendMode.blendType	= Ogre::LBT_ALPHA;
+	d_alphaBlendMode.source1	= Ogre::LBS_TEXTURE;
+	d_alphaBlendMode.source2	= Ogre::LBS_DIFFUSE;
+	d_alphaBlendMode.operation	= Ogre::LBX_MODULATE;
+
+	d_uvwAddressMode.u = Ogre::TextureUnitState::TAM_CLAMP;
+	d_uvwAddressMode.v = Ogre::TextureUnitState::TAM_CLAMP;
+	d_uvwAddressMode.w = Ogre::TextureUnitState::TAM_CLAMP;
+}
+
+
+/*************************************************************************
+	Create a texture from an existing Ogre::TexturePtr object	
+*************************************************************************/
+Texture* OgreCEGUIRenderer::createTexture(Ogre::TexturePtr& texture)
+{
+	OgreCEGUITexture* t = (OgreCEGUITexture*)createTexture();
+
+	if (!texture.isNull())
+	{
+		t->setOgreTexture(texture);
+	}
+
+	return t;
+
+}
+
+/*************************************************************************
+	Create a resource provider object
+*************************************************************************/
+ResourceProvider* OgreCEGUIRenderer::createResourceProvider(void)
+{
+    d_resourceProvider = new OgreCEGUIResourceProvider();
+    return d_resourceProvider;
+}
+
+/*************************************************************************
+Set the size of the display in pixels.	
+*************************************************************************/
+void OgreCEGUIRenderer::setDisplaySize(const Size& sz)
+{
+	if (d_display_area.getSize() != sz)
+	{
+		d_display_area.setSize(sz);
+
+		EventArgs args;
+		fireEvent(EventDisplaySizeChanged, args, EventNamespace);
+	}
+
+}
+
+/*************************************************************************
+	Callback from Ogre invoked before other stuff in our target queue
+	is rendered
+*************************************************************************/
+void CEGUIRQListener::renderQueueStarted(Ogre::uint8 id, const Ogre::String& invocation, 
+										 bool& skipThisQueue)
+{
+	if ((!d_post_queue) && (d_queue_id == id))
+	{
+		CEGUI::System::getSingleton().renderGUI();
+	}
+
+}
+
+
+/*************************************************************************
+Callback from Ogre invoked after other stuff in our target queue
+is rendered
+*************************************************************************/
+void CEGUIRQListener::renderQueueEnded(Ogre::uint8 id, const Ogre::String& invocation, bool& repeatThisQueue)
+{
+	if ((d_post_queue) && (d_queue_id == id))
+	{
+		CEGUI::System::getSingleton().renderGUI();
+	}
+
+}
+
+} // End of  CEGUI namespace section
Index: /code/branches/buildsystem3/src/ogreceguirenderer/OgreCEGUIRenderer.h
===================================================================
--- /code/branches/buildsystem3/src/ogreceguirenderer/OgreCEGUIRenderer.h	(revision 2664)
+++ /code/branches/buildsystem3/src/ogreceguirenderer/OgreCEGUIRenderer.h	(revision 2664)
@@ -0,0 +1,464 @@
+/************************************************************************
+	filename: 	OgreCEGUIRenderer.h
+	created:	11/5/2004
+	author:		Paul D Turner
+
+	purpose:	Interface for main Ogre GUI renderer class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+/*************************************************************************
+	This file contains code that is specific to Ogre (http://www.ogre3d.org)
+*************************************************************************/
+#ifndef _OgreCEGUIRenderer_h_
+#define _OgreCEGUIRenderer_h_
+
+#include <CEGUIBase.h>
+#include <CEGUIRenderer.h>
+#include <CEGUITexture.h>
+
+#include <OgreRenderQueueListener.h>
+#include <OgreSceneManagerEnumerator.h>
+#include <OgreTextureUnitState.h>
+
+#if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32) && !defined(OGRE_STATIC_LIB)
+#   ifdef OGRE_GUIRENDERER_EXPORTS
+#       define OGRE_GUIRENDERER_API __declspec(dllexport)
+#   else
+#       if defined(__MINGW32__)
+#           define OGRE_GUIRENDERER_API
+#       else
+#           define OGRE_GUIRENDERER_API __declspec(dllimport)
+#       endif
+#   endif
+#elif defined ( OGRE_GCC_VISIBILITY )
+#    define OGRE_GUIRENDERER_API  __attribute__ ((visibility("default")))
+#else
+#    define OGRE_GUIRENDERER_API
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*************************************************************************
+	Forward refs
+*************************************************************************/
+class OgreCEGUITexture;
+class OgreCEGUIRenderer;
+
+
+/*!
+\brief
+	RenderQueueListener based class used to hook into the ogre rendering system
+*/
+class _OgrePrivate CEGUIRQListener : public Ogre::RenderQueueListener
+{
+public:
+	CEGUIRQListener(OgreCEGUIRenderer* renderer, Ogre::uint8 queue_id, bool post_queue)
+	{
+		d_renderer		= renderer;
+		d_queue_id		= queue_id;
+		d_post_queue	= post_queue;
+	}
+
+	virtual ~CEGUIRQListener() {}
+
+	virtual void	renderQueueStarted(Ogre::uint8 id, const Ogre::String& invocation, bool& skipThisQueue);
+	virtual void	renderQueueEnded(Ogre::uint8 id, const Ogre::String& invocation, bool& repeatThisQueue);
+
+	// methods for adjusting target queue settings
+	void	setTargetRenderQueue(Ogre::uint8 queue_id)		{d_queue_id = queue_id;}
+	void	setPostRenderQueue(bool post_queue)		{d_post_queue = post_queue;}
+
+private:
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	OgreCEGUIRenderer*				d_renderer;		//!< CEGUI renderer object for Ogre.
+	Ogre::uint8	d_queue_id;		//!< ID of the queue that we are hooked into
+	bool						d_post_queue;	//!< true if we render after everything else in our queue.
+};
+
+
+/*!
+\brief
+	Renderer class to interface with Ogre engine.
+*/
+class OGRE_GUIRENDERER_API OgreCEGUIRenderer : public Renderer
+{
+public:
+	/*!
+	\brief
+		Constructor for renderer class that uses Ogre for rendering. Note that if
+		you use this option you must call setTargetSceneManager before rendering.
+
+	\param window
+		Pointer to an Ogre::RenderWindow object.
+
+	\param queue_id
+		Ogre::uint8 value that specifies where the GUI should appear in the ogre rendering output.
+
+	\param post_queue
+		set to true to have GUI rendered after render queue \a queue_id, or false to have the GUI rendered before render queue
+		\a queue_id.
+
+	\param max_quads
+		Obsolete.  Set to 0.
+
+	*/
+	OgreCEGUIRenderer(Ogre::RenderWindow* window,
+		Ogre::uint8 queue_id = Ogre::RENDER_QUEUE_OVERLAY,
+		bool post_queue = false, uint max_quads = 0);
+
+
+	/*!
+	\brief
+		Constructor for renderer class that uses Ogre for rendering.
+
+	\param window
+		Pointer to an Ogre::RenderWindow object.
+
+	\param queue_id
+		Ogre::uint8 value that specifies where the GUI should appear in the ogre rendering output.
+
+	\param post_queue
+		set to true to have GUI rendered after render queue \a queue_id, or false to have the GUI rendered before render queue
+		\a queue_id.
+
+	\param max_quads
+		Obsolete.  Set to 0.
+
+	\param scene_manager
+		Pointer to an Ogre::SceneManager object that is to be used for GUI rendering.
+	*/
+	OgreCEGUIRenderer(Ogre::RenderWindow* window, Ogre::uint8 queue_id, bool post_queue, uint max_quads, Ogre::SceneManager* scene_manager);
+
+
+	/*!
+	\brief
+		Destructor for Ogre renderer.
+	*/
+	virtual ~OgreCEGUIRenderer(void);
+
+
+
+	// add's a quad to the list to be rendered
+	virtual	void	addQuad(const Rect& dest_rect, float z, const Texture* tex, const Rect& texture_rect, const ColourRect& colours, QuadSplitMode quad_split_mode);
+
+	// perform final rendering for all queued renderable quads.
+	virtual	void	doRender(void);
+
+	// clear the queue
+	virtual	void	clearRenderList(void);
+
+
+	/*!
+	\brief
+		Enable or disable the queueing of quads from this point on.
+
+		This only affects queueing.  If queueing is turned off, any calls to addQuad will cause the quad to be rendered directly.  Note that
+		disabling queueing will not cause currently queued quads to be rendered, nor is the queue cleared - at any time the queue can still
+		be drawn by calling doRender, and the list can be cleared by calling clearRenderList.  Re-enabling the queue causes subsequent quads
+		to be added as if queueing had never been disabled.
+
+	\param setting
+		true to enable queueing, or false to disable queueing (see notes above).
+
+	\return
+		Nothing
+	*/
+	virtual void	setQueueingEnabled(bool setting)		{d_queueing = setting;}
+
+
+	// create an empty texture
+	virtual	Texture*	createTexture(void);
+
+	// create a texture and load it with the specified file.
+	virtual	Texture*	createTexture(const String& filename, const String& resourceGroup = "General");
+
+	// create a texture and set it to the specified size
+	virtual	Texture*	createTexture(float size);
+
+    // create an OGRE resource provider.
+    virtual ResourceProvider* createResourceProvider(void);
+
+	// destroy the given texture
+	virtual	void		destroyTexture(Texture* texture);
+
+	// destroy all textures still active
+	virtual void		destroyAllTextures(void);
+
+
+	/*!
+	\brief
+		Return whether queueing is enabled.
+
+	\return
+		true if queueing is enabled, false if queueing is disabled.
+	*/
+	virtual bool	isQueueingEnabled(void) const	{return d_queueing;}
+
+
+	/*!
+	\brief
+	Return the current width of the display in pixels
+
+	\return
+	float value equal to the current width of the display in pixels.
+	*/
+	virtual float	getWidth(void) const		{return d_display_area.getWidth();}
+
+
+	/*!
+	\brief
+	Return the current height of the display in pixels
+
+	\return
+	float value equal to the current height of the display in pixels.
+	*/
+	virtual float	getHeight(void) const		{return d_display_area.getHeight();}
+
+
+	/*!
+	\brief
+	Return the size of the display in pixels
+
+	\return
+	Size object describing the dimensions of the current display.
+	*/
+	virtual Size	getSize(void) const			{return d_display_area.getSize();}
+
+
+	/*!
+	\brief
+	Return a Rect describing the screen
+
+	\return
+	A Rect object that describes the screen area.  Typically, the top-left values are always 0, and the size of the area described is
+	equal to the screen resolution.
+	*/
+	virtual Rect	getRect(void) const			{return d_display_area;}
+
+
+	/*!
+	\brief
+		Return the maximum texture size available
+
+	\return
+		Size of the maximum supported texture in pixels (textures are always assumed to be square)
+	*/
+	virtual	uint	getMaxTextureSize(void) const		{return 2048;}		// TODO: Change to proper value
+
+
+	/*!
+	\brief
+		Return the horizontal display resolution dpi
+
+	\return
+		horizontal resolution of the display in dpi.
+	*/
+	virtual	uint	getHorzScreenDPI(void) const	{return 96;}
+
+
+	/*!
+	\brief
+		Return the vertical display resolution dpi
+
+	\return
+		vertical resolution of the display in dpi.
+	*/
+	virtual	uint	getVertScreenDPI(void) const	{return 96;}
+
+
+	/*!
+	\brief
+		Set the scene manager to be used for rendering the GUI.
+
+		The GUI system will be unhooked from the current scene manager and attached to what ever
+		is specified here.
+
+	\param scene_manager
+		Pointer to an Ogre::SceneManager object that is the new target Ogre::SceneManager to be
+		used for GUI rendering.
+
+	\return
+		Nothing.
+	*/
+	void	setTargetSceneManager(Ogre::SceneManager* scene_manager);
+
+
+	/*!
+	\brief
+		Set the target render queue for GUI rendering.
+
+	\param queue_id
+		Ogre::uint8 value specifying the render queue that the GUI system should attach to.
+
+	\param post_queue
+		- true to specify that the GUI should render after everything else in render queue \a queue_id.
+		- false to specify the GUI should render before everything else in render queue \a queue_id.
+
+	\return
+		Nothing.
+	*/
+	void	setTargetRenderQueue(Ogre::uint8 queue_id, bool post_queue);
+
+
+	/*!
+	\brief
+		Create a texture from an existing Ogre::TexturePtr object.
+
+	\note
+		If you want to use an Ogre::RenderTexture (for putting rendered output onto Gui elements or other
+		advanced techniques), you can get the Ogre::TexturePtr to be used by calling Ogre::TextureManager::getByName()
+		passing the name returned from Ogre::RenderTexture::getName() (and casting the result as necessary).
+
+	\param texture
+		pointer to an Ogre::TexturePtr object to be used as the basis for the new CEGUI::Texture
+
+	\return
+		Pointer to the newly created CEGUI::TexturePtr object.
+	*/
+	Texture*	createTexture(Ogre::TexturePtr& texture);
+
+
+	/*!
+	\brief
+	Set the size of the display in pixels.
+
+	You do not have to call this method under normal operation as the system
+	will automatically extract the size from the current view port.
+
+	\note
+	This method will cause the EventDisplaySizeChanged event to fire if the
+	display size has changed.
+
+	\param sz
+	Size object describing the size of the display.
+
+	\return
+	Nothing.
+	*/
+	void	setDisplaySize(const Size& sz);
+
+
+private:
+	/************************************************************************
+		Implementation Constants
+	************************************************************************/
+	static const size_t    VERTEX_PER_QUAD;						 //!< number of vertices per quad
+	static const size_t    VERTEX_PER_TRIANGLE;					 //!< number of vertices for a triangle
+    static const size_t    VERTEXBUFFER_INITIAL_CAPACITY;		 //!< initial capacity of the allocated vertex buffer
+    static const size_t    UNDERUSED_FRAME_THRESHOLD;            //!< number of frames to wait before shrinking buffer
+
+	/*************************************************************************
+	    Implementation Structs & classes
+	*************************************************************************/
+	/*!
+	\brief
+		structure used for all vertices.
+	*/
+	struct QuadVertex {
+		float x, y, z;			//!< The position for the vertex.
+		Ogre::RGBA diffuse;		//!< colour of the vertex
+		float tu1, tv1;			//!< texture coordinates
+	};
+
+	/*!
+	\brief
+		structure holding details about a quad to be drawn
+	*/
+	struct QuadInfo
+	{
+		Ogre::TexturePtr		texture;
+		Rect				position;
+		float				z;
+		Rect				texPosition;
+        uint32		        topLeftCol;
+        uint32		        topRightCol;
+        uint32		        bottomLeftCol;
+        uint32		        bottomRightCol;
+
+        QuadSplitMode		splitMode;
+
+		bool operator<(const QuadInfo& other) const
+		{
+			// this is intentionally reversed.
+			return z > other.z;
+		}
+	};
+
+
+	/*************************************************************************
+	    Implementation Methods
+	*************************************************************************/
+	// setup states etc
+	void	initRenderStates(void);
+
+	// sort quads list according to texture
+	void	sortQuads(void);
+
+	// render a quad directly to the display
+	void	renderQuadDirect(const Rect& dest_rect, float z, const Texture* tex, const Rect& texture_rect, const ColourRect& colours, QuadSplitMode quad_split_mode);
+
+	// convert colour value to whatever the Ogre render system is expecting.
+    uint32    colourToOgre(const colour& col) const;
+
+	// perform main work of the constructor.  This does everything except the final hook into the render system.
+	void	constructor_impl(Ogre::RenderWindow* window, Ogre::uint8 queue_id, bool post_queue, uint max_quads);
+
+
+	/*************************************************************************
+	    Implementation Data
+	*************************************************************************/
+	Rect				d_display_area;
+
+	typedef std::multiset<QuadInfo>		QuadList;
+	QuadList d_quadlist;
+	bool	 d_queueing;		//!< setting for queueing control.
+
+	// Ogre specific bits.
+	Ogre::Root*					d_ogre_root;		//!< pointer to the Ogre root object that we attach to
+	Ogre::RenderSystem*			d_render_sys;		//!< Pointer to the render system for Ogre.
+	Ogre::uint8	d_queue_id;			//!< ID of the queue that we are hooked into
+	Ogre::TexturePtr			d_currTexture;		//!< currently set texture;
+	Ogre::RenderOperation		d_render_op;		//!< Ogre render operation we use to do our stuff.
+	Ogre::HardwareVertexBufferSharedPtr	d_buffer;	//!< vertex buffer to queue sprite rendering
+    size_t d_underused_framecount;                  //!< Number of frames elapsed since buffer utilization was above half the capacity
+    Ogre::RenderOperation		d_direct_render_op;		//!< Renderop for cursor
+	Ogre::HardwareVertexBufferSharedPtr	d_direct_buffer;	//!< Renderop for cursor
+	Ogre::SceneManager*			d_sceneMngr;		//!< The scene manager we are hooked into.
+	Ogre::LayerBlendModeEx		d_colourBlendMode;	//!< Controls colour blending mode used.
+	Ogre::LayerBlendModeEx		d_alphaBlendMode;	//!< Controls alpha blending mode used.
+	Ogre::TextureUnitState::UVWAddressingMode d_uvwAddressMode;
+
+	CEGUIRQListener*			d_ourlistener;
+	bool						d_post_queue;		//!< true if we render after everything else in our queue.
+	size_t						d_bufferPos;		//!< index into buffer where next vertex should be put.
+	bool						d_sorted;			//!< true when data in quad list is sorted.
+	Point						d_texelOffset;		//!< Offset required for proper texel mapping.
+
+	std::list<OgreCEGUITexture*> d_texturelist;		//!< List used to track textures.
+};
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _OgreCEGUIRenderer_h_
Index: /code/branches/buildsystem3/src/ogreceguirenderer/OgreCEGUIResourceProvider.cpp
===================================================================
--- /code/branches/buildsystem3/src/ogreceguirenderer/OgreCEGUIResourceProvider.cpp	(revision 2664)
+++ /code/branches/buildsystem3/src/ogreceguirenderer/OgreCEGUIResourceProvider.cpp	(revision 2664)
@@ -0,0 +1,97 @@
+/************************************************************************
+	filename: 	OgreCEGUIResourceProvider.cpp
+	created:	8/7/2004
+	author:		James '_mental_' O'Sullivan
+
+	purpose:	Implements the Resource Provider common functionality
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#include "OgreCEGUIResourceProvider.h"
+
+#include <CEGUIExceptions.h>
+#include <OgreArchiveManager.h>
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    OgreCEGUIResourceProvider::OgreCEGUIResourceProvider() : ResourceProvider()
+    {
+        // set deafult resource group for Ogre
+        d_defaultResourceGroup = Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME.c_str();
+    }
+
+//    void OgreResourceProvider::loadInputSourceContainer(const String& filename, InputSourceContainer& output)
+//   {
+//        Ogre::DataStreamPtr input = Ogre::ResourceGroupManager::getSingleton().openResource(filename.c_str());
+//
+//		if (input.isNull())
+//		{
+//			throw InvalidRequestException((utf8*)
+//				"Scheme::Scheme - Filename supplied for Scheme loading must be valid");
+//		}
+//
+//       XERCES_CPP_NAMESPACE_USE
+//        size_t buffsz = input->size();
+//        unsigned char* mem = reinterpret_cast<unsigned char*>(XMLPlatformUtils::fgArrayMemoryManager->allocate(buffsz));
+//        memcpy(mem, input.getPointer()->getAsString().c_str(), buffsz);
+//        InputSource* mInputSource = new MemBufInputSource(mem, buffsz, filename.c_str(), true);
+//        input.setNull();
+//
+//       output.setData(mInputSource);
+//    }
+
+    void OgreCEGUIResourceProvider::loadRawDataContainer(const String& filename, RawDataContainer& output,  const String& resourceGroup)
+    {
+        String orpGroup;
+        if (resourceGroup.empty())
+            orpGroup = d_defaultResourceGroup.empty() ? Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME.c_str() : d_defaultResourceGroup;
+        else
+            orpGroup = resourceGroup;
+
+        Ogre::DataStreamPtr input =
+            Ogre::ResourceGroupManager::getSingleton().openResource(filename.c_str(), orpGroup.c_str());
+
+		if (input.isNull())
+		{
+            throw InvalidRequestException((utf8*)
+                "OgreCEGUIResourceProvider::loadRawDataContainer - Unable to open resource file '" + filename + (utf8*)"' in resource group '" + orpGroup + (utf8*)"'.");
+        }
+
+		Ogre::String buf = input->getAsString();
+		const size_t memBuffSize = buf.length();
+
+        unsigned char* mem = new unsigned char[memBuffSize];
+        memcpy(mem, buf.c_str(), memBuffSize);
+
+        output.setData(mem);
+        output.setSize(memBuffSize);
+    }
+
+	void OgreCEGUIResourceProvider::unloadRawDataContainer(RawDataContainer& data)
+	{
+		if (data.getDataPtr())
+		{
+			delete[] data.getDataPtr();
+			data.setData(0);
+			data.setSize(0);
+		}
+	}
+} // End of  CEGUI namespace section
Index: /code/branches/buildsystem3/src/ogreceguirenderer/OgreCEGUIResourceProvider.h
===================================================================
--- /code/branches/buildsystem3/src/ogreceguirenderer/OgreCEGUIResourceProvider.h	(revision 2664)
+++ /code/branches/buildsystem3/src/ogreceguirenderer/OgreCEGUIResourceProvider.h	(revision 2664)
@@ -0,0 +1,52 @@
+/************************************************************************
+	filename: 	CEGUIOgreResourceProvider.h
+	created:	8/7/2004
+	author:		James '_mental_' O'Sullivan
+	
+	purpose:	Defines abstract base class for CEGUIData objects
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _OgreCEGUIResourceProvider_h_
+#define _OgreCEGUIResourceProvider_h_
+
+#include <CEGUIResourceProvider.h>
+#include "OgreCEGUIRenderer.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+class _OgrePrivate OgreCEGUIResourceProvider : public ResourceProvider
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	OgreCEGUIResourceProvider();
+
+	~OgreCEGUIResourceProvider(void) {}
+
+//    void loadInputSourceContainer(const String& filename, InputSourceContainer& output);
+    void loadRawDataContainer(const String& filename, RawDataContainer& output, const String& resourceGroup);
+    void unloadRawDataContainer(RawDataContainer& output);
+};
+
+} // End of  CEGUI namespace section
+
+#endif	// end of guard _OgreCEGUIResourceProvider_h_
Index: /code/branches/buildsystem3/src/ogreceguirenderer/OgreCEGUITexture.cpp
===================================================================
--- /code/branches/buildsystem3/src/ogreceguirenderer/OgreCEGUITexture.cpp	(revision 2664)
+++ /code/branches/buildsystem3/src/ogreceguirenderer/OgreCEGUITexture.cpp	(revision 2664)
@@ -0,0 +1,268 @@
+/************************************************************************
+	filename: 	OgreCEGUITexture.cpp
+	created:	11/5/2004
+	author:		Paul D Turner
+	
+	purpose:	Implementation of Texture using Ogre engine
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+
+#include <CEGUISystem.h>
+#include <CEGUIExceptions.h>
+#include "OgreCEGUITexture.h"
+#include "OgreCEGUIRenderer.h"
+
+#include <OgreTextureManager.h>
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*************************************************************************
+	Static data definition / initialisation
+*************************************************************************/
+uint32 OgreCEGUITexture::d_texturenumber		= 0;
+
+
+/*************************************************************************
+	Constructor
+*************************************************************************/
+OgreCEGUITexture::OgreCEGUITexture(Renderer* owner) :
+	Texture(owner)
+{
+	d_ogre_texture.setNull();
+	d_isLinked = false;
+}
+
+
+/*************************************************************************
+	Destructor
+*************************************************************************/
+OgreCEGUITexture::~OgreCEGUITexture(void)
+{
+	freeOgreTexture();
+}
+
+
+/*************************************************************************
+	Loads the specified image file into the texture.  The texture is
+	resized as required to hold the image.	
+*************************************************************************/
+void OgreCEGUITexture::loadFromFile(const String& filename, const String& resourceGroup)
+{
+	using namespace Ogre;
+
+	// unload old ogre texture
+	freeOgreTexture();
+
+	// create / load a new ogre texture from the specified image
+	try
+	{
+		TextureManager& textureManager = TextureManager::getSingleton();
+
+		// see if texture already exists
+		Ogre::TexturePtr ogreTexture = (Ogre::TexturePtr)textureManager.getByName(filename.c_str());
+
+		if (!ogreTexture.isNull())
+		{
+			// texture already exists, so create a 'linked' texture (ensures texture is not destroyed twice)
+			d_ogre_texture = ogreTexture;
+			d_isLinked = true;
+		}
+		// texture does not already exist, so load it in
+		else
+		{
+            String orpGroup;
+            if (resourceGroup.empty())
+            {
+                const String& defGrp = CEGUI::System::getSingleton().getResourceProvider()->getDefaultResourceGroup();
+                orpGroup = defGrp.empty() ? Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME.c_str() : defGrp;
+            }
+            else
+            {
+                orpGroup = resourceGroup;
+            }
+
+			d_ogre_texture = TextureManager::getSingleton().load(filename.c_str(), orpGroup.c_str(), TEX_TYPE_2D, 0, 1.0f);
+			d_isLinked = false;
+		}
+
+	}
+	catch(Ogre::Exception e)
+	{
+		throw RendererException((utf8*)"Failed to create Texture object from file '" + filename + "'. Additional Information:\n" + e.getFullDescription().c_str());
+	}
+
+	// if we got a pointer cache some details
+	if (!d_ogre_texture.isNull())
+	{
+		d_width		= d_ogre_texture->getWidth();
+		d_height	= d_ogre_texture->getHeight();
+	}
+	// no texture from image so throw.
+	else
+	{
+		throw RendererException((utf8*)"Failed to create Texture object from file '" + filename + "'.  Ogre returned a NULL pointer.");
+	}
+
+}
+
+
+/*************************************************************************
+	Loads (copies) an image in memory into the texture.  The texture is
+	resized as required to hold the image.	
+*************************************************************************/
+
+void _byteSwap(unsigned char* b, int n)
+{
+    register int i = 0;
+    register int j = n-1;
+    while (i<j)
+    {
+        std::swap(b[i], b[j]);
+        i++, j--;
+    }
+}
+#define byteSwap(x) _byteSwap((unsigned char*) &x,sizeof(x))
+
+void OgreCEGUITexture::loadFromMemory(const void* buffPtr, uint buffWidth, uint buffHeight, PixelFormat pixelFormat)
+{
+	using namespace Ogre;
+
+	// get rid of old texture
+	freeOgreTexture();
+
+	// wrap input buffer with an Ogre DataChunk
+    uint32 bytesize = ((buffWidth * sizeof(uint32)) * buffHeight);
+
+#if OGRE_ENDIAN == OGRE_ENDIAN_BIG
+    uint32* swappedBuffer = new uint32[bytesize/4];
+    memcpy(swappedBuffer, buffPtr, bytesize);
+
+    for (int i=0; i < bytesize/4; i++)
+        byteSwap(swappedBuffer[i]);
+
+    DataStreamPtr odc(new MemoryDataStream(static_cast<void*>(swappedBuffer), bytesize, false));
+#else
+	DataStreamPtr odc(new MemoryDataStream(const_cast<void*>(buffPtr), bytesize, false));
+#endif
+
+	// get pixel type for the target texture - the elements here might look wrong, but is just
+	// differences in definition (at the core level, between GL and D3D).
+	Ogre::PixelFormat targetFmt =
+		(pixelFormat == PF_RGBA) ? Ogre::PF_A8R8G8B8 : Ogre::PF_R8G8B8;
+
+	// try to create a Ogre::Texture from the input data
+	d_ogre_texture = TextureManager::getSingleton().loadRawData(getUniqueName(), "General", odc, buffWidth, buffHeight, targetFmt , TEX_TYPE_2D, 0, 1.0f);
+
+	// if we got a pointer cache some details
+	if (!d_ogre_texture.isNull())
+	{
+		d_width		= d_ogre_texture->getWidth();
+		d_height	= d_ogre_texture->getHeight();
+	}
+	// no texture from memory so throw.
+	else
+	{
+		throw RendererException((utf8*)"Failed to create Texture object from memory:  Ogre returned a NULL Ogre::Texture pointer.");
+	}
+
+}
+
+
+/*************************************************************************
+	set the size of the internal Ogre texture.  Previous Ogre texture
+	is lost.	
+*************************************************************************/
+void OgreCEGUITexture::setOgreTextureSize(uint size)
+{
+	using namespace Ogre;
+
+	// unload any current Ogre::Texture
+	freeOgreTexture();
+
+	// Try to create an empty texture of the given size
+	d_ogre_texture = TextureManager::getSingleton().createManual(getUniqueName(), "General", TEX_TYPE_2D, size, size, 0, PF_A8R8G8B8, TU_DEFAULT);
+
+	// if we got a pointer cache some details
+	if (!d_ogre_texture.isNull())
+	{
+		d_width		= d_ogre_texture->getWidth();
+		d_height	= d_ogre_texture->getHeight();
+	}
+	// no texture so throw.
+	else
+	{
+		throw RendererException((utf8*)"Failed to create texture of specified size: Ogre::Texture creation failed.");
+	}
+
+}
+
+
+/*************************************************************************
+	safely free Ogre::Texture texture (can be called multiple times with
+	no ill effect)
+*************************************************************************/
+void OgreCEGUITexture::freeOgreTexture(void)
+{
+	if ((!d_ogre_texture.isNull()) && !d_isLinked)
+	{
+		Ogre::TextureManager::getSingleton().remove(d_ogre_texture->getHandle());
+	}
+	d_ogre_texture.setNull();
+}
+
+
+/*************************************************************************
+	return a Ogre::string that contains a unique name.	
+*************************************************************************/
+Ogre::String OgreCEGUITexture::getUniqueName(void)
+{
+	Ogre::String str;
+
+#ifdef CEGUI_USEOLDOGRESTRING
+	str << "_cegui_ogre_" << d_texturenumber;
+#else
+	Ogre::StringUtil::StrStreamType strstream;
+	strstream << "_cegui_ogre_" << d_texturenumber;
+	str = strstream.str();
+#endif
+
+	++d_texturenumber;
+
+	return str;
+}
+
+
+/*************************************************************************
+	Set the internal Ogre::Texture object.
+*************************************************************************/
+void OgreCEGUITexture::setOgreTexture(Ogre::TexturePtr& texture)
+{
+	freeOgreTexture();
+
+	d_ogre_texture = texture;
+	d_width	 = d_ogre_texture->getWidth();
+	d_height = d_ogre_texture->getHeight();
+	d_isLinked = true;
+}
+
+
+} // End of  CEGUI namespace section
+
Index: /code/branches/buildsystem3/src/ogreceguirenderer/OgreCEGUITexture.h
===================================================================
--- /code/branches/buildsystem3/src/ogreceguirenderer/OgreCEGUITexture.h	(revision 2664)
+++ /code/branches/buildsystem3/src/ogreceguirenderer/OgreCEGUITexture.h	(revision 2664)
@@ -0,0 +1,179 @@
+/************************************************************************
+	filename: 	OgreCEGUITexture.h
+	created:	11/5/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to Texture implemented via Ogre engine
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library 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
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _OgreCEGUITexture_h_
+#define _OgreCEGUITexture_h_
+
+#include <CEGUIBase.h>
+#include <CEGUIRenderer.h>
+#include <CEGUITexture.h>
+#include "OgreCEGUIRenderer.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Texture class that is created by OgreCEGUIRenderer objects
+*/
+class _OgrePrivate OgreCEGUITexture : public Texture
+{
+private:
+	/*************************************************************************
+		Friends (to allow construction and destruction)
+	*************************************************************************/
+	friend	Texture* OgreCEGUIRenderer::createTexture(void);
+	friend	Texture* OgreCEGUIRenderer::createTexture(const String& filename, const String& resourceGroup);
+	friend	Texture* OgreCEGUIRenderer::createTexture(float size);
+	friend	void	 OgreCEGUIRenderer::destroyTexture(Texture* texture);
+
+
+	/*************************************************************************
+		Construction & Destruction (by Renderer object only)
+	*************************************************************************/
+	OgreCEGUITexture(Renderer* owner);
+	virtual ~OgreCEGUITexture(void);
+
+public:
+	/*!
+	\brief
+		Returns the current pixel width of the texture
+
+	\return
+		ushort value that is the current width of the texture in pixels
+	*/
+	virtual	ushort	getWidth(void) const		{return d_width;}
+
+
+	/*!
+	\brief
+		Returns the current pixel height of the texture
+
+	\return
+		ushort value that is the current height of the texture in pixels
+	*/
+	virtual	ushort	getHeight(void) const		{return d_height;}
+
+
+	/*!
+	\brief
+		Loads the specified image file into the texture.  The texture is resized as required to hold the image.
+
+	\param filename
+		The filename of the image file that is to be loaded into the texture
+
+	\return
+		Nothing.
+	*/
+	virtual void	loadFromFile(const String& filename, const String& resourceGroup);
+
+
+	/*!
+	\brief
+		Loads (copies) an image in memory into the texture.  The texture is resized as required to hold the image.
+	
+	\param buffPtr
+		Pointer to the buffer containing the image data
+	
+	\param buffWidth
+		Width of the buffer (in pixels as specified by \a pixelFormat )
+	
+	\param buffHeight
+		Height of the buffer (in pixels as specified by \a pixelFormat )
+	
+	\param pixelFormat
+	PixelFormat value describing the format contained in \a buffPtr
+	
+	\return
+		Nothing.
+	*/
+	virtual void	loadFromMemory(const void* buffPtr, uint buffWidth, uint buffHeight, PixelFormat pixelFormat);
+
+
+	/*!
+	\brief
+		Return a pointer to the internal Ogre::Texture object
+
+	\return
+		Pointer to the Ogre::Texture object currently being used by this Texture object
+	*/
+	Ogre::TexturePtr	getOgreTexture(void) const		{return d_ogre_texture;}
+
+
+	/*!
+	\brief
+		set the size of the internal Ogre texture.  Previous Ogre texture is lost.
+
+	\param size
+		pixel size of the new internal texture.  This will be rounded up to a power of 2.
+
+	\return
+		Nothing.
+	*/
+	void	setOgreTextureSize(uint size);
+
+
+	/*!
+	\brief
+		Set the internal Ogre::TexturePtr object.
+
+	\param texture
+		Reference to an Ogre::TexturePtr object that is to be used by this Texture object.
+
+	\return
+		Nothing.
+	*/
+	void	setOgreTexture(Ogre::TexturePtr& texture);
+
+
+private:
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	// safely free Ogre::Texture texture (can be called multiple times with no ill effect)
+	void	freeOgreTexture(void);
+
+	// return a Ogre::string that contains a unique name.
+	Ogre::String	getUniqueName(void);
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	static	uint32          d_texturenumber;	//!< Counter used to provide unique texture names.
+
+	Ogre::TexturePtr		d_ogre_texture;		//!< The 'real' texture.
+
+	ushort					d_width;			//!< cached width of the texture
+	ushort					d_height;			//!< cached height of the texture
+
+	bool	d_isLinked;		//!< True if we are linked to a texture we did not actually create.
+};
+
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _OgreCEGUITexture_h_
Index: /code/branches/buildsystem3/src/ogreceguirenderer/VERSION
===================================================================
--- /code/branches/buildsystem3/src/ogreceguirenderer/VERSION	(revision 2664)
+++ /code/branches/buildsystem3/src/ogreceguirenderer/VERSION	(revision 2664)
@@ -0,0 +1,22 @@
+This library is part of the OGRE v1.4.9 source.
+
+-----
+
+Copyright 1999-2004 The OGRE Team.
+
+This file is part of OGRE (Object-Oriented Graphics Rendering Engine).
+
+OGRE is free software; you can redistribute it and/or modify
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2, or (at your option)
+any later version.
+
+OGRE 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 Lesser General Public License
+along with OGRE; see the file COPYING.  If not, write to
+the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
Index: /code/branches/buildsystem3/src/ogreceguirenderer/changes_orxonox.diff
===================================================================
--- /code/branches/buildsystem3/src/ogreceguirenderer/changes_orxonox.diff	(revision 2664)
+++ /code/branches/buildsystem3/src/ogreceguirenderer/changes_orxonox.diff	(revision 2664)
@@ -0,0 +1,84 @@
+--- OgreCEGUIRenderer.cpp	Wed Jan 28 21:14:09 2009
++++ OgreCEGUIRenderer.cpp	Wed Jan 28 21:07:10 2009
+@@ -24,11 +24,11 @@
+     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *************************************************************************/
+ 
+-#include <CEGUI/CEGUIImagesetManager.h>
+-#include <CEGUI/CEGUIImageset.h>
+-#include <CEGUI/CEGUIImage.h>
+-#include <CEGUI/CEGUIExceptions.h>
+-#include <CEGUI/CEGUISystem.h>
++#include <CEGUIImagesetManager.h>
++#include <CEGUIImageset.h>
++#include <CEGUIImage.h>
++#include <CEGUIExceptions.h>
++#include <CEGUISystem.h>
+ 
+ #include "OgreCEGUIRenderer.h"
+ #include "OgreCEGUITexture.h"
+--- OgreCEGUIRenderer.h	Wed Jan 28 21:14:09 2009
++++ OgreCEGUIRenderer.h	Wed Jan 28 21:06:46 2009
+@@ -29,9 +29,9 @@
+ #ifndef _OgreCEGUIRenderer_h_
+ #define _OgreCEGUIRenderer_h_
+ 
+-#include <CEGUI/CEGUIBase.h>
+-#include <CEGUI/CEGUIRenderer.h>
+-#include <CEGUI/CEGUITexture.h>
++#include <CEGUIBase.h>
++#include <CEGUIRenderer.h>
++#include <CEGUITexture.h>
+ 
+ #include <OgreRenderQueueListener.h>
+ #include <OgreSceneManagerEnumerator.h>
+--- OgreCEGUIResourceProvider.cpp	Wed Jan 28 21:14:09 2009
++++ OgreCEGUIResourceProvider.cpp	Wed Jan 28 21:07:15 2009
+@@ -25,7 +25,7 @@
+ *************************************************************************/
+ #include "OgreCEGUIResourceProvider.h"
+ 
+-#include <CEGUI/CEGUIExceptions.h>
++#include <CEGUIExceptions.h>
+ #include <OgreArchiveManager.h>
+ 
+ 
+--- OgreCEGUIResourceProvider.h	Wed Jan 28 21:14:09 2009
++++ OgreCEGUIResourceProvider.h	Wed Jan 28 21:06:51 2009
+@@ -26,7 +26,7 @@
+ #ifndef _OgreCEGUIResourceProvider_h_
+ #define _OgreCEGUIResourceProvider_h_
+ 
+-#include <CEGUI/CEGUIResourceProvider.h>
++#include <CEGUIResourceProvider.h>
+ #include "OgreCEGUIRenderer.h"
+ 
+ // Start of CEGUI namespace section
+--- OgreCEGUITexture.cpp	Wed Jan 28 21:14:09 2009
++++ OgreCEGUITexture.cpp	Wed Jan 28 21:07:21 2009
+@@ -24,8 +24,8 @@
+     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *************************************************************************/
+ 
+-#include <CEGUI/CEGUISystem.h>
+-#include <CEGUI/CEGUIExceptions.h>
++#include <CEGUISystem.h>
++#include <CEGUIExceptions.h>
+ #include "OgreCEGUITexture.h"
+ #include "OgreCEGUIRenderer.h"
+ 
+--- OgreCEGUITexture.h	Wed Jan 28 21:14:09 2009
++++ OgreCEGUITexture.h	Wed Jan 28 21:07:06 2009
+@@ -26,9 +26,9 @@
+ #ifndef _OgreCEGUITexture_h_
+ #define _OgreCEGUITexture_h_
+ 
+-#include <CEGUI/CEGUIBase.h>
+-#include <CEGUI/CEGUIRenderer.h>
+-#include <CEGUI/CEGUITexture.h>
++#include <CEGUIBase.h>
++#include <CEGUIRenderer.h>
++#include <CEGUITexture.h>
+ #include "OgreCEGUIRenderer.h"
+ 
+ // Start of CEGUI namespace section
Index: /code/branches/buildsystem3/src/ois/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/ois/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/ois/CMakeLists.txt	(revision 2664)
@@ -1,5 +1,37 @@
-INCLUDE_DIRECTORIES(.)
+ #
+ #             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.
+ #
 
-SET( OIS_SRC_FILES
+SET_SOURCE_FILES(OIS_FILES
+  OIS.h
+  OISConfig.h
+  OISEffect.h
+  OISEvents.h
+  OISException.h
+  OISFactoryCreator.h
+  OISForceFeedback.h
+  OISInputManager.h
+  OISInterface.h
+  OISJoyStick.h
+  OISKeyboard.h
+  OISMouse.h
+  OISObject.h
+  OISPrereqs.h
+
   OISEffect.cpp
   OISException.cpp
@@ -10,40 +42,23 @@
   OISObject.cpp
 )
+IF(WIN32)
+  ADD_SUBDIRECTORY(win32)
+ELSEIF(APPLE)
+  ADD_SUBDIRECTORY(mac)
+ELSEIF(UNIX)
+  ADD_SUBDIRECTORY(linux)
+ENDIF()
+
+GENERATE_SOURCE_GROUPS(${OIS_FILES})
+
+REMOVE_COMPILER_FLAGS("-DUNICODE -D_UNICODE" MSVC)
+INCLUDE_DIRECTORIES(.)
+
+ADD_LIBRARY(ois_orxonox SHARED ${OIS_FILES})
+SET_TARGET_PROPERTIES(ois_orxonox PROPERTIES DEFINE_SYMBOL "OIS_NONCLIENT_BUILD")
 
 IF(WIN32)
-  SET( OIS_SRC_FILES ${OIS_SRC_FILES}
-    win32/Win32ForceFeedback.cpp
-    win32/Win32InputManager.cpp
-    win32/Win32JoyStick.cpp
-    win32/Win32KeyBoard.cpp
-    win32/Win32Mouse.cpp
-  )
-ELSEIF (APPLE)
-  SET( OIS_SRC_FILES ${OIS_SRC_FILES}
-    mac/MacHelpers.cpp
-    mac/MacHIDManager.cpp
-    mac/MacInputManager.cpp
-    mac/MacKeyboard.cpp
-    mac/MacMouse.cpp
-  )
-ELSEIF (UNIX)
-  SET( OIS_SRC_FILES ${OIS_SRC_FILES}
-    linux/EventHelpers.cpp
-    linux/LinuxForceFeedback.cpp
-    linux/LinuxInputManager.cpp
-    linux/LinuxJoyStickEvents.cpp
-    linux/LinuxKeyboard.cpp
-    linux/LinuxMouse.cpp
-  )
-ENDIF (WIN32)
+  TARGET_LINK_LIBRARIES(ois_orxonox ${DIRECTX_LIBRARIES})
+ENDIF()
 
-ADD_LIBRARY( ois_orxonox SHARED ${OIS_SRC_FILES} )
-
-IF(WIN32)
-  LINK_DIRECTORIES(${DirectX_LIB_DIR})
-  TARGET_LINK_LIBRARIES( ois_orxonox
-    dxguid
-    dinput8
-  )
-ENDIF(WIN32)
-
+ORXONOX_INSTALL(ois_orxonox)
Index: /code/branches/buildsystem3/src/ois/OISException.cpp
===================================================================
--- /code/branches/buildsystem3/src/ois/OISException.cpp	(revision 2663)
+++ /code/branches/buildsystem3/src/ois/OISException.cpp	(revision 2664)
@@ -26,7 +26,7 @@
 
 //----------------------------------------------------------------------------//
-/*const char* Exception::what() const throw()
+const char* Exception::what() const throw()
 {
 	return eText;
 }
-*/
+
Index: /code/branches/buildsystem3/src/ois/OISException.h
===================================================================
--- /code/branches/buildsystem3/src/ois/OISException.h	(revision 2663)
+++ /code/branches/buildsystem3/src/ois/OISException.h	(revision 2664)
@@ -58,6 +58,7 @@
 			: eType(err), eLine(line), eFile(file), eText(str) {}
 
-		virtual const char* what() const throw()
-            { return eText; }
+		~Exception() throw() {}
+
+		virtual const char* what() const throw();
 
 		//! The type of exception raised
Index: /code/branches/buildsystem3/src/ois/VERSION
===================================================================
--- /code/branches/buildsystem3/src/ois/VERSION	(revision 2664)
+++ /code/branches/buildsystem3/src/ois/VERSION	(revision 2664)
@@ -0,0 +1,3 @@
+OIS v1_2 CVS updated on 2009/01/24
+Note that this is not CVS HEAD, but v1_2 branch!
+
Index: /code/branches/buildsystem3/src/ois/linux/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/ois/linux/CMakeLists.txt	(revision 2664)
+++ /code/branches/buildsystem3/src/ois/linux/CMakeLists.txt	(revision 2664)
@@ -0,0 +1,16 @@
+ADD_SOURCE_FILES(OIS_FILES
+  EventHelpers.h
+  LinuxForceFeedback.h
+  LinuxInputManager.h
+  LinuxJoyStickEvents.h
+  LinuxKeyboard.h
+  LinuxMouse.h
+  LinuxPrereqs.h
+
+  EventHelpers.cpp
+  LinuxForceFeedback.cpp
+  LinuxInputManager.cpp
+  LinuxJoyStickEvents.cpp
+  LinuxKeyboard.cpp
+  LinuxMouse.cpp
+)
Index: /code/branches/buildsystem3/src/ois/linux/LinuxKeyboard.cpp
===================================================================
--- /code/branches/buildsystem3/src/ois/linux/LinuxKeyboard.cpp	(revision 2663)
+++ /code/branches/buildsystem3/src/ois/linux/LinuxKeyboard.cpp	(revision 2664)
@@ -283,5 +283,5 @@
 	}
 
-	for(unsigned int i = 1; i < len; i++)
+	for(int i = 1; i < len; i++)
 		val = (val << 6) | (buf[i] & 0x3F);
 
@@ -303,8 +303,5 @@
 
 	while( XPending(display) > 0 )
-	{
-		XNextEvent(display, &event);
-
-		if( KeyPress == event.type )
+	{ 		XNextEvent(display, &event);  		if( KeyPress == event.type )
 		{
 			unsigned int character = 0;
@@ -335,6 +332,5 @@
 			if( event.xkey.state & Mod1Mask && key == XK_Tab )
 				linMan->_setGrabState(false);
-		}
-		else if( KeyRelease == event.type )
+		} 		else if( KeyRelease == event.type )
 		{
 			//Mask out the modifier states X sets.. or we will get improper values
@@ -344,6 +340,5 @@
 			//Else, it is a valid key release
 			XLookupString(&event.xkey,NULL,0,&key,NULL);
-			_injectKeyUp(key);
-		}
+			_injectKeyUp(key); 		}
 	}
 
Index: /code/branches/buildsystem3/src/ois/mac/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/ois/mac/CMakeLists.txt	(revision 2664)
+++ /code/branches/buildsystem3/src/ois/mac/CMakeLists.txt	(revision 2664)
@@ -0,0 +1,14 @@
+ADD_SOURCE_FILES(OIS_FILES
+  MacHelpers.h
+  MacHIDManager.h
+  MacInputManager.h
+  MacKeyboard.h
+  MacMouse.h
+  MacPrereqs.h
+
+  MacHelpers.cpp
+  MacHIDManager.cpp
+  MacInputManager.cpp
+  MacKeyboard.cpp
+  MacMouse.cpp
+)
Index: /code/branches/buildsystem3/src/ois/win32/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/ois/win32/CMakeLists.txt	(revision 2664)
+++ /code/branches/buildsystem3/src/ois/win32/CMakeLists.txt	(revision 2664)
@@ -0,0 +1,14 @@
+ADD_SOURCE_FILES(OIS_FILES
+  Win32ForceFeedback.h
+  Win32InputManager.h
+  Win32JoyStick.h
+  Win32KeyBoard.h
+  Win32Mouse.h
+  Win32Prereqs.h
+
+  Win32ForceFeedback.cpp
+  Win32InputManager.cpp
+  Win32JoyStick.cpp
+  Win32KeyBoard.cpp
+  Win32Mouse.cpp
+)
Index: /code/branches/buildsystem3/src/orxonox/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,22 @@
-SET( ORXONOX_SRC_FILES
+ #
+ #             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.
+ #
+
+SET_SOURCE_FILES(ORXONOX_SRC_FILES
   CameraManager.cc
   GraphicsEngine.cc
@@ -7,46 +26,47 @@
   PlayerManager.cc
   Settings.cc
-  
-  tolua/tolua_bind.cc
 )
+ADD_SUBDIRECTORY(gamestates)
+ADD_SUBDIRECTORY(gui)
+ADD_SUBDIRECTORY(objects)
+ADD_SUBDIRECTORY(overlays)
+ADD_SUBDIRECTORY(tools)
+GET_ALL_HEADER_FILES(ORXONOX_HDR_FILES)
+SET(ORXONOX_FILES ${ORXONOX_SRC_FILES} ${ORXONOX_HDR_FILES})
 
-ADD_SOURCE_DIRECTORY(ORXONOX_SRC_FILES gamestates)
-ADD_SOURCE_DIRECTORY(ORXONOX_SRC_FILES gui)
-ADD_SOURCE_DIRECTORY(ORXONOX_SRC_FILES objects)
-ADD_SOURCE_DIRECTORY(ORXONOX_SRC_FILES overlays)
-ADD_SOURCE_DIRECTORY(ORXONOX_SRC_FILES tools)
+GENERATE_SOURCE_GROUPS(${ORXONOX_FILES})
+GENERATE_TOLUA_BINDINGS(Orxonox ORXONOX_FILES INPUTFILES gui/GUIManager.h)
 
-GET_TARGET_PROPERTY(TOLUA_EXE tolua_orxonox LOCATION)
-ADD_CUSTOM_COMMAND(
-  OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/tolua/tolua_bind.cc ${CMAKE_CURRENT_SOURCE_DIR}/tolua/tolua_bind.h
-  COMMAND ${TOLUA_EXE} -n Orxonox -o ../../src/orxonox/tolua/tolua_bind.cc -H ../../src/orxonox/tolua/tolua_bind.h ../../src/orxonox/tolua/tolua.pkg
-  DEPENDS
-    tolua_orxonox
-    tolua/tolua.pkg
-    gui/GUIManager.h
-  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib
-)
+# Not using precompiled header files: Avoid dependencies
+INCLUDE_DIRECTORIES(pch/nopch)
 
+IF(GCC_NO_SYSTEM_HEADER_SUPPORT)
+  # Get around displaying a few hundred lines of warning code
+  SET_SOURCE_FILES_PROPERTIES(gamestates/GSGraphics.cc PROPERTIES COMPILE_FLAGS "-w")
+ENDIF()
 
-ADD_EXECUTABLE( orxonox ${ORXONOX_SRC_FILES} )
+ADD_EXECUTABLE(orxonox ${ORXONOX_FILES})
+GET_TARGET_PROPERTY(_exec_loc orxonox LOCATION)
+GET_FILENAME_COMPONENT(_exec_name ${_exec_loc} NAME)
+SET(ORXONOX_EXECUTABLE_NAME ${_exec_name} CACHE INTERNAL "")
 
 IF(NETWORKTRAFFIC_TESTING_ENABLED)
-
-  SET( ORXONOXS_SRC_FILES
+  SET(ORXONOXS_SRC_FILES
     GraphicsEngine.cc
     objects/Camera.cc
     CameraManager.cc
   )
-
-  ADD_LIBRARY(orxonoxs SHARED ${ORXONOX_SRC_FILES})
+  ADD_LIBRARY(orxonoxs SHARED ${ORXONOXS_SRC_FILES})
 ENDIF(NETWORKTRAFFIC_TESTING_ENABLED)
 
-TARGET_LINK_LIBRARIES( orxonox
-  ${OGRE_LIBRARIES}
-  ${CEGUI_LIBRARIES}
-  lua_orxonox
-  ceguilua_orxonox
-  tinyxml_orxonox
-  tolualib_orxonox
+TARGET_LINK_LIBRARIES(orxonox
+  ${OGRE_LIBRARY}
+  ${CEGUI_LIBRARY}
+  ${LUA_LIBRARIES}
+  ${CEGUILUA_LIBRARY}
+  ${Boost_SYSTEM_LIBRARY}
+  ogreceguirenderer_orxonox
+  tinyxml++_orxonox
+  tolua++_orxonox
   BulletDynamics
   BulletCollision
@@ -54,6 +74,25 @@
   util
   core
-  audio
   network
+  #audio
 )
 
+# When using Visual Studio we want to use the output directory as working
+# directory and we also want to specify where the external dlls
+# (lua, ogre, etc.) are. The problem hereby is that these information cannot
+# be specified in CMake because they are not stored in the actual project file.
+# This workaround will create a configured *.vcproj.user file that holds the
+# right values. When starting the solution for the first time,
+# these get written to the *vcproj.yourPCname.yourname.user
+IF(MSVC)
+  IF(CMAKE_CL_64)
+    SET(MSVC_PLATFORM "x64")
+  ELSE()
+    SET(MSVC_PLATFORM "Win32")
+  ENDIF()
+  STRING(REGEX REPLACE "^Visual Studio ([0-9][0-9]?) .*$" "\\1"
+         VISUAL_STUDIO_VERSION_SIMPLE "${CMAKE_GENERATOR}")
+  CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/orxonox.vcproj.user" "${CMAKE_CURRENT_BINARY_DIR}/orxonox.vcproj.user")
+ENDIF(MSVC)
+
+ORXONOX_INSTALL(orxonox)
Index: /code/branches/buildsystem3/src/orxonox/Main.cc
===================================================================
--- /code/branches/buildsystem3/src/orxonox/Main.cc	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/Main.cc	(revision 2664)
@@ -38,5 +38,5 @@
 #include <cassert>
 
-#include "util/OrxonoxPlatform.h"
+#include "OrxonoxConfig.h"
 #include "util/Debug.h"
 #include "util/SignalHandler.h"
@@ -57,5 +57,5 @@
 #include "gamestates/GSIOConsole.h"
 
-#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE
+#ifdef ORXONOX_PLATFORM_APPLE
 #include <CoreFoundation/CoreFoundation.h>
 
Index: /code/branches/buildsystem3/src/orxonox/OrxonoxPrereqs.h
===================================================================
--- /code/branches/buildsystem3/src/orxonox/OrxonoxPrereqs.h	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/OrxonoxPrereqs.h	(revision 2664)
@@ -35,10 +35,11 @@
 #define _OrxonoxPrereqs_H__
 
-#include "util/OrxonoxPlatform.h"
+#include "OrxonoxConfig.h"
 
 //-----------------------------------------------------------------------
 // Shared library settings
 //-----------------------------------------------------------------------
-#if (ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32) && !(defined(ORXONOX_STATIC_BUILD) || defined(ORXONOX_NO_EXPORTS))
+#define ORXONOX_NO_EXPORTS // This is an executable that needs no exports
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !(defined(ORXONOX_STATIC_BUILD) || defined(ORXONOX_NO_EXPORTS))
 #  ifdef ORXONOX_SHARED_BUILD
 #    define _OrxonoxExport __declspec(dllexport)
Index: de/branches/buildsystem3/src/orxonox/OrxonoxStableHeaders.h
===================================================================
--- /code/branches/buildsystem3/src/orxonox/OrxonoxStableHeaders.h	(revision 2663)
+++ 	(revision )
@@ -1,107 +1,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
- @brief Contains the frequently used header files of our own writing
- */
-
-#ifndef _OrxonoxStableHeaders_H__
-#define _OrxonoxStableHeaders_H__
-
-#include "util/OrxonoxPlatform.h"
-
-#if defined(ORXONOX_ENABLE_PCH)
-
-// including std headers here is useless since they're already precompiled
-
-#ifndef WIN32_LEAN_AND_MEAN
-// prevent Ogre from including winsock.h that messes with winsock2.h from enet
-#  define WIN32_LEAN_AND_MEAN
-#endif
-#include <Ogre.h>
-#include <CEGUI.h>
-#include <boost/thread/recursive_mutex.hpp>
-//#include <boost/thread/mutex.hpp>
-//#include <boost/thread/condition.hpp>
-//#include <boost/thread/thread.hpp>
-#include <boost/static_assert.hpp>
-
-#include "BulletDynamics/Dynamics/btRigidBody.h"
-#include "ois/OIS.h"
-#include "tinyxml/ticpp.h"
-#include "tinyxml/tinyxml.h"
-#include "tolua/tolua++.h"
-
-//Get around Windows hackery (windows.h is included by Ogre.h)
-#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 
-#  ifdef max
-#    undef max
-#  endif
-#  ifdef min
-#    undef min
-#  endif
-#endif
-
-//----------- Our files ----------
-//--------------------------------
-//// only include when not debugging so that we may find issues with missing headers quicker
-//#if defined(NDEBUG)
-
-#include "util/Convert.h"
-#include "util/Debug.h"
-#include "util/Exception.h"
-#include "util/Math.h"
-#include "util/Multitype.h"
-#include "util/Sleep.h"
-#include "util/String.h"
-#include "util/SubString.h"
-
-#include "core/BaseObject.h"
-#include "core/ConsoleCommand.h"
-#include "core/CoreIncludes.h"
-#include "core/ConfigValueIncludes.h"
-#include "core/CommandExecutor.h"
-#include "core/Core.h"
-#include "core/Executor.h"
-#include "core/ObjectList.h"
-#include "core/Super.h"
-#include "core/XMLIncludes.h"
-#include "core/XMLPort.h"
-#include "core/input/SimpleInputState.h"
-#include "core/input/InputManager.h"
-
-#include "network/synchronisable/Synchronisable.h"
-
-//#include "Settings.h"
-
-//#endif /* ifdef NDEBUG */
-
-#endif /* defined(ORXONOX_ENABLE_PCH) */
-
-#endif /* _OrxonoxStableHeaders_H__ */
Index: de/branches/buildsystem3/src/orxonox/PrecompiledHeaderFiles.cc
===================================================================
--- /code/branches/buildsystem3/src/orxonox/PrecompiledHeaderFiles.cc	(revision 2663)
+++ 	(revision )
@@ -1,34 +1,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
- @brief This file actually generates the precompiled header file
- */
-
-#include "OrxonoxStableHeaders.h"
Index: /code/branches/buildsystem3/src/orxonox/Settings.cc
===================================================================
--- /code/branches/buildsystem3/src/orxonox/Settings.cc	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/Settings.cc	(revision 2664)
@@ -63,5 +63,5 @@
     void Settings::setConfigValues()
     {
-        SetConfigValue(dataPath_, "../../media/").description("Relative path to the game data.").callback(this, &Settings::dataPathChanged);
+        SetConfigValue(dataPath_, ORXONOX_MEDIA_PATH).description("Relative path to the game data.").callback(this, &Settings::dataPathChanged);
     }
 
Index: /code/branches/buildsystem3/src/orxonox/gamestates/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/gamestates/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/gamestates/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,3 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   GSDedicated.cc
   GSClient.cc
@@ -10,4 +10,2 @@
   GSStandalone.cc
 )
-
-ADD_SOURCE_FILES(SRC_FILES)
Index: /code/branches/buildsystem3/src/orxonox/gamestates/GSGraphics.cc
===================================================================
--- /code/branches/buildsystem3/src/orxonox/gamestates/GSGraphics.cc	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/gamestates/GSGraphics.cc	(revision 2664)
@@ -31,4 +31,6 @@
 
 #include <fstream>
+#include <boost/filesystem.hpp>
+
 #include <OgreCompositorManager.h>
 #include <OgreConfigFile.h>
@@ -45,4 +47,6 @@
 #include "util/Debug.h"
 #include "util/Exception.h"
+#include "util/String.h"
+#include "util/SubString.h"
 #include "core/ConsoleCommand.h"
 #include "core/ConfigValueIncludes.h"
@@ -92,6 +96,8 @@
         SetConfigValue(ogreConfigFile_,  "ogre.cfg")
             .description("Location of the Ogre config file");
-        SetConfigValue(ogrePluginsFile_, "plugins.cfg")
-            .description("Location of the Ogre plugins file");
+        SetConfigValue(ogrePluginsFolder_, ORXONOX_OGRE_PLUGINS_FOLDER)
+            .description("Folder where the Ogre plugins are located.");
+        SetConfigValue(ogrePlugins_, ORXONOX_OGRE_PLUGINS)
+            .description("Comma separated list of all plugins to load.");
         SetConfigValue(ogreLogFile_,     "ogre.log")
             .description("Logfile for messages from Ogre. Use \"\" to suppress log file creation.");
@@ -115,6 +121,11 @@
         // Ogre setup procedure
         setupOgre();
+        // load all the required plugins for Ogre
+        loadOgrePlugins();
+        // read resource declaration file
         this->declareResources();
-        this->loadRenderer();    // creates the render window
+        // Reads ogre config and creates the render window
+        this->loadRenderer();
+
         // TODO: Spread this so that this call only initialises things needed for the Console and GUI
         this->initialiseResources();
@@ -200,5 +211,5 @@
         delete this->ogreRoot_;
 
-//#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
+//#ifdef ORXONOX_PLATFORM_WINDOWS
         // delete the ogre log and the logManager (since we have created it).
         this->ogreLogger_->getDefaultLog()->removeListener(this);
@@ -277,5 +288,5 @@
 
         // TODO: LogManager doesn't work on oli platform. The why is yet unknown.
-//#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
+//#ifdef ORXONOX_PLATFORM_WINDOWS
         // create a new logManager
         ogreLogger_ = new Ogre::LogManager();
@@ -297,9 +308,4 @@
         COUT(4) << "Creating Ogre Root..." << std::endl;
 
-        if (ogrePluginsFile_ == "")
-        {
-            COUT(2) << "Warning: Ogre plugins file set to \"\". Defaulting to plugins.cfg" << std::endl;
-            ModifyConfigValue(ogrePluginsFile_, tset, "plugins.cfg");
-        }
         if (ogreConfigFile_ == "")
         {
@@ -326,8 +332,9 @@
             probe.close();
 
-        ogreRoot_ = new Ogre::Root(ogrePluginsFile_, ogreConfigFile_, ogreLogFile_);
+        // Leave plugins file empty. We're going to do that part manually later
+        ogreRoot_ = new Ogre::Root("", ogreConfigFile_, ogreLogFile_);
 
 #if 0 // Ogre 1.4.3 doesn't yet support setDebugOutputEnabled(.)
-#if ORXONOX_PLATFORM != ORXONOX_PLATFORM_WIN32
+#ifndef ORXONOX_PLATFORM_WINDOWS
         // tame the ogre ouput so we don't get all the mess in the console
         Ogre::Log* defaultLog = Ogre::LogManager::getSingleton().getDefaultLog();
@@ -339,4 +346,17 @@
 
         COUT(3) << "Ogre set up done." << std::endl;
+    }
+
+    void GSGraphics::loadOgrePlugins()
+    {
+        // just to make sure the next statement doesn't segfault
+        if (ogrePluginsFolder_ == "")
+            ogrePluginsFolder_ = ".";
+
+        boost::filesystem::path folder(ogrePluginsFolder_);
+        // Do some SubString magic to get the comma separated list of plugins
+        SubString plugins(ogrePlugins_, ",", " ", false, 92, false, 34, false, 40, 41, false, '\0');
+        for (unsigned int i = 0; i < plugins.size(); ++i)
+            ogreRoot_->loadPlugin((folder / plugins[i]).native_file_string());
     }
 
Index: /code/branches/buildsystem3/src/orxonox/gamestates/GSGraphics.h
===================================================================
--- /code/branches/buildsystem3/src/orxonox/gamestates/GSGraphics.h	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/gamestates/GSGraphics.h	(revision 2664)
@@ -60,4 +60,5 @@
 
         void setupOgre();
+        void loadOgrePlugins();
         void declareResources();
         void loadRenderer();
@@ -98,5 +99,6 @@
         std::string           resourceFile_;             //!< resources file name
         std::string           ogreConfigFile_;           //!< ogre config file name
-        std::string           ogrePluginsFile_;          //!< ogre plugins file name
+        std::string           ogrePluginsFolder_;        //!< Folder where the Ogre plugins are located
+        std::string           ogrePlugins_;              //!< Comma separated list of all plugins to load
         std::string           ogreLogFile_;              //!< log file name for Ogre log messages
         int                   ogreLogLevelTrivial_;      //!< Corresponding Orxonx debug level for LL_TRIVIAL
Index: /code/branches/buildsystem3/src/orxonox/gamestates/GSRoot.cc
===================================================================
--- /code/branches/buildsystem3/src/orxonox/gamestates/GSRoot.cc	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/gamestates/GSRoot.cc	(revision 2664)
@@ -46,5 +46,5 @@
 #include "Settings.h"
 
-#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
+#ifdef ORXONOX_PLATFORM_WINDOWS
 #  ifndef WIN32_LEAN_AND_MEAN
 #    define WIN32_LEAN_AND_MEAN
@@ -269,5 +269,5 @@
     void GSRoot::setThreadAffinity(unsigned int limitToCPU)
     {
-#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
+#ifdef ORXONOX_PLATFORM_WINDOWS
         // Get the current process core mask
         DWORD procMask;
Index: /code/branches/buildsystem3/src/orxonox/gui/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/gui/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/gui/CMakeLists.txt	(revision 2664)
@@ -1,8 +1,3 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   GUIManager.cc
-  OgreCEGUIRenderer.cpp
-  OgreCEGUIResourceProvider.cpp
-  OgreCEGUITexture.cpp
 )
-
-ADD_SOURCE_FILES(SRC_FILES)
Index: /code/branches/buildsystem3/src/orxonox/gui/GUIManager.cc
===================================================================
--- /code/branches/buildsystem3/src/orxonox/gui/GUIManager.cc	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/gui/GUIManager.cc	(revision 2664)
@@ -39,15 +39,22 @@
 #include <OgreRoot.h>
 #include <CEGUI.h>
-#include "ceguilua/CEGUILua.h"
+#include <ogreceguirenderer/OgreCEGUIRenderer.h>
+#ifdef CEGUILUA_USE_INTERNAL_LIBRARY
+#   include <ceguilua/CEGUILua.h>
+#else
+#   include <CEGUILua.h>
+#endif
+
 #include "util/Exception.h"
 #include "core/input/InputManager.h"
 #include "core/input/SimpleInputState.h"
-#include "core/tolua/tolua_bind.h"
 #include "core/ConsoleCommand.h"
 #include "core/Core.h"
-#include "tolua/tolua_bind.h"
-#include "OgreCEGUIRenderer.h"
-
-#include "lua/lua.hpp"
+#include "ToluaBindCore.h"
+#include "ToluaBindOrxonox.h"
+
+extern "C" {
+#include <lua.h>
+}
 
 namespace orxonox
@@ -100,5 +107,5 @@
 	        lua_pushnil(luaState_);
 	        lua_setglobal(luaState_, "Core");
-            // TODO: deleting the script module fails an assertation.
+            // TODO: deleting the script module fails an assertion.
             // However there is not much we can do about it since it occurs too when
             // we don't open Core or Orxonox. Might be a CEGUI issue.
Index: /code/branches/buildsystem3/src/orxonox/gui/GUIManager.h
===================================================================
--- /code/branches/buildsystem3/src/orxonox/gui/GUIManager.h	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/gui/GUIManager.h	(revision 2664)
@@ -42,15 +42,17 @@
 #include "core/input/InputInterfaces.h"
 
-namespace orxonox // tolua_export
-{ // tolua_export
+// tolua_begin
+namespace orxonox
+{
     /**
     @brief
         Provides a simple interface to CEGUI with tolua methods and console commands
     */
-    class _OrxonoxExport GUIManager : public KeyHandler, public MouseHandler
-    /*
-    class GUIManager { // tolua_export
-    */
+    class _OrxonoxExport GUIManager
+// tolua_end
+        : public KeyHandler, public MouseHandler
+// tolua_begin
     {
+// tolua_end
     public:
         enum State
Index: de/branches/buildsystem3/src/orxonox/gui/OgreCEGUIRenderer.cpp
===================================================================
--- /code/branches/buildsystem3/src/orxonox/gui/OgreCEGUIRenderer.cpp	(revision 2663)
+++ 	(revision )
@@ -1,803 +1,0 @@
-/************************************************************************
-    filename: 	OgreCEGUIRenderer.cpp
-    created:	11/5/2004
-    author:		Paul D Turner
-    
-    purpose:	Implementation of Renderer class for Ogre engine
-*************************************************************************/
-/*************************************************************************
-    Crazy Eddie's GUI System (http://www.cegui.org.uk)
-    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library 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
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*************************************************************************/
-
-#include "OrxonoxStableHeaders.h"
-#include <CEGUIImagesetManager.h>
-#include <CEGUIImageset.h>
-#include <CEGUIImage.h>
-#include <CEGUIExceptions.h>
-#include <CEGUISystem.h>
-
-#include "OgreCEGUIRenderer.h"
-#include "OgreCEGUITexture.h"
-#include "OgreCEGUIResourceProvider.h"
-
-#include <OgreRenderSystem.h>
-#include <OgreRoot.h>
-#include <OgreHardwareBufferManager.h>
-#include <OgreRenderWindow.h>
-
-// Start of CEGUI namespace section
-namespace CEGUI
-{
-/*************************************************************************
-    Constants definitions
-*************************************************************************/
-const size_t	OgreCEGUIRenderer::VERTEX_PER_QUAD			= 6;
-const size_t	OgreCEGUIRenderer::VERTEX_PER_TRIANGLE		= 3;
-const size_t	OgreCEGUIRenderer::VERTEXBUFFER_INITIAL_CAPACITY	= 256;
-const size_t    OgreCEGUIRenderer::UNDERUSED_FRAME_THRESHOLD = 50000; // halfs buffer every 8 minutes on 100fps
-
-/*************************************************************************
-    Utility function to create a render operation and vertex buffer to render quads
-*************************************************************************/
-static void createQuadRenderOp(Ogre::RenderOperation &d_render_op, 
-    Ogre::HardwareVertexBufferSharedPtr &d_buffer, size_t nquads)
-{
-    using namespace Ogre;
-    // Create and initialise the Ogre specific parts required for use in rendering later.
-    d_render_op.vertexData = new VertexData;
-    d_render_op.vertexData->vertexStart = 0;
-
-    // setup vertex declaration for the vertex format we use
-    VertexDeclaration* vd = d_render_op.vertexData->vertexDeclaration;
-    size_t vd_offset = 0;
-    vd->addElement(0, vd_offset, VET_FLOAT3, VES_POSITION);
-    vd_offset += VertexElement::getTypeSize(VET_FLOAT3);
-    vd->addElement(0, vd_offset, VET_COLOUR, VES_DIFFUSE);
-    vd_offset += VertexElement::getTypeSize(VET_COLOUR);
-    vd->addElement(0, vd_offset, VET_FLOAT2, VES_TEXTURE_COORDINATES);
-
-    // create hardware vertex buffer
-    d_buffer = HardwareBufferManager::getSingleton().createVertexBuffer(vd->getVertexSize(0), nquads,  
-        HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE, false);
-
-    // bind vertex buffer
-    d_render_op.vertexData->vertexBufferBinding->setBinding(0, d_buffer);
-
-    // complete render operation basic initialisation
-    d_render_op.operationType = RenderOperation::OT_TRIANGLE_LIST;
-    d_render_op.useIndexes = false;
-}
-
-static void destroyQuadRenderOp(Ogre::RenderOperation &d_render_op, 
-    Ogre::HardwareVertexBufferSharedPtr &d_buffer)
-{
-    delete d_render_op.vertexData;
-    d_render_op.vertexData = 0;
-    d_buffer.setNull();
-}
-
-/*************************************************************************
-    Constructor
-*************************************************************************/
-OgreCEGUIRenderer::OgreCEGUIRenderer(Ogre::RenderWindow* window, Ogre::uint8 queue_id, bool post_queue, uint max_quads)
-{
-    constructor_impl(window, queue_id, post_queue, max_quads);
-}
-
-
-/*************************************************************************
-    Constructor (specifying scene manager)
-*************************************************************************/
-OgreCEGUIRenderer::OgreCEGUIRenderer(Ogre::RenderWindow* window, Ogre::uint8 queue_id, bool post_queue, uint max_quads, Ogre::SceneManager* scene_manager)
-{
-    constructor_impl(window, queue_id, post_queue, max_quads);
-
-    // hook into ogre rendering system
-    setTargetSceneManager(scene_manager);
-}
-
-
-/*************************************************************************
-    Destructor
-*************************************************************************/
-OgreCEGUIRenderer::~OgreCEGUIRenderer(void)
-{
-    setTargetSceneManager(NULL);
-
-    if (d_ourlistener)
-    {
-        delete d_ourlistener;
-    }
-
-    // cleanup vertex data we allocated in constructor
-    destroyQuadRenderOp(d_render_op, d_buffer);
-    destroyQuadRenderOp(d_direct_render_op, d_direct_buffer);
-
-    destroyAllTextures();
-}
-
-
-/*************************************************************************
-    add's a quad to the list to be rendered
-*************************************************************************/
-void OgreCEGUIRenderer::addQuad(const Rect& dest_rect, float z, const Texture* tex, const Rect& texture_rect, const ColourRect& colours, QuadSplitMode quad_split_mode)
-{
-    // if not queueing, render directly (as in, right now!). This is used for the mouse cursor.
-    if (!d_queueing)
-    {
-        renderQuadDirect(dest_rect, z, tex, texture_rect, colours, quad_split_mode);
-    }
-    else
-    {
-        d_sorted = false;
-        QuadInfo quad;
-        
-        // set quad position, flipping y co-ordinates, and applying appropriate texel origin offset
-        quad.position.d_left	= dest_rect.d_left;
-        quad.position.d_right	= dest_rect.d_right;
-        quad.position.d_top		= d_display_area.getHeight() - dest_rect.d_top;
-        quad.position.d_bottom	= d_display_area.getHeight() - dest_rect.d_bottom;
-        quad.position.offset(d_texelOffset);
-
-        // convert quad co-ordinates for a -1 to 1 co-ordinate system.
-        quad.position.d_left	/= (d_display_area.getWidth() * 0.5f);
-        quad.position.d_right	/= (d_display_area.getWidth() * 0.5f);
-        quad.position.d_top		/= (d_display_area.getHeight() * 0.5f);
-        quad.position.d_bottom	/= (d_display_area.getHeight() * 0.5f);
-        quad.position.offset(Point(-1.0f, -1.0f));
-
-        quad.z				= -1 + z;
-        quad.texture		= ((OgreCEGUITexture*)tex)->getOgreTexture();
-        quad.texPosition	= texture_rect;
-
-        // covert colours for ogre, note that top / bottom are switched.
-        quad.topLeftCol		= colourToOgre(colours.d_bottom_left);
-        quad.topRightCol	= colourToOgre(colours.d_bottom_right);
-        quad.bottomLeftCol	= colourToOgre(colours.d_top_left);
-        quad.bottomRightCol	= colourToOgre(colours.d_top_right);
-        
-        // set quad split mode
-        quad.splitMode = quad_split_mode;
-
-        d_quadlist.insert(quad);
-    }
-}
-
-
-
-/*************************************************************************
-perform final rendering for all queued renderable quads.
-*************************************************************************/
-void OgreCEGUIRenderer::doRender(void)
-{
-    // Render if overlays enabled and the quad list is not empty
-
-    // ORXONOX CHANGE: Even render when OverlaysEnabled is deactivated
-    // The reason is that we don't want the HUD to be shown in the viewport of the
-    // GUI (uses its own viewport to be able render on top of all viewports).
-    // But since we don't use overlays in the GUI, it doesn't matter.
-    // ORXONOX REVERT: Changes are not in place anymore, but might be in the future!
-    if (d_render_sys->_getViewport()->getOverlaysEnabled() && !d_quadlist.empty())
-    //if (!d_quadlist.empty())
-    {
-        /// Quad list needs to be sorted and thus the vertex buffer rebuilt. If not, we can
-        /// reuse the vertex buffer resulting in a nice speed gain.
-        if(!d_sorted)
-        {
-            sortQuads();
-            /// Resize vertex buffer if it is too small
-            size_t size = d_buffer->getNumVertices();
-            size_t requestedSize = d_quadlist.size()*VERTEX_PER_QUAD;
-            if(size < requestedSize)
-            {
-                /// Double buffer size until smaller than requested size
-                while(size < requestedSize)
-                    size = size * 2;
-                /// Reallocate the buffer
-                destroyQuadRenderOp(d_render_op, d_buffer);
-                createQuadRenderOp(d_render_op, d_buffer, size);
-            }
-            else if(requestedSize < size/2 && d_underused_framecount >= UNDERUSED_FRAME_THRESHOLD)
-            {
-                /// Resize vertex buffer if it has been to big for too long
-                size = size / 2;
-                destroyQuadRenderOp(d_render_op, d_buffer);
-                createQuadRenderOp(d_render_op, d_buffer, size);
-                /// Reset underused framecount so it takes another UNDERUSED_FRAME_THRESHOLD to half again
-                d_underused_framecount = 0;
-            }
-            /// Fill the buffer
-            QuadVertex*	buffmem;
-            buffmem = (QuadVertex*)d_buffer->lock(Ogre::HardwareVertexBuffer::HBL_DISCARD);
-            // iterate over each quad in the list
-            for (QuadList::iterator i = d_quadlist.begin(); i != d_quadlist.end(); ++i)
-            {
-                const QuadInfo& quad = (*i);
-                // setup Vertex 1...
-                buffmem->x = quad.position.d_left;
-                buffmem->y = quad.position.d_bottom;
-                buffmem->z = quad.z;
-                buffmem->diffuse = quad.topLeftCol;
-                buffmem->tu1 = quad.texPosition.d_left;
-                buffmem->tv1 = quad.texPosition.d_bottom;
-                ++buffmem;
-    
-                // setup Vertex 2...
-                
-                // top-left to bottom-right diagonal
-                if (quad.splitMode == TopLeftToBottomRight)
-                {
-                    buffmem->x = quad.position.d_right;
-                    buffmem->y = quad.position.d_bottom;
-                    buffmem->z = quad.z;
-                    buffmem->diffuse = quad.topRightCol;
-                    buffmem->tu1 = quad.texPosition.d_right;
-                    buffmem->tv1 = quad.texPosition.d_bottom;
-                }
-                // bottom-left to top-right diagonal
-                else
-                {
-                    buffmem->x = quad.position.d_right;
-                    buffmem->y = quad.position.d_top;
-                    buffmem->z = quad.z;
-                    buffmem->diffuse = quad.bottomRightCol;
-                    buffmem->tu1 = quad.texPosition.d_right;
-                    buffmem->tv1 = quad.texPosition.d_top;
-                }
-                ++buffmem;
-    
-                // setup Vertex 3...
-                buffmem->x = quad.position.d_left;
-                buffmem->y = quad.position.d_top;
-                buffmem->z = quad.z;
-                buffmem->diffuse = quad.bottomLeftCol;
-                buffmem->tu1 = quad.texPosition.d_left;
-                buffmem->tv1 = quad.texPosition.d_top;
-                ++buffmem;
-    
-                // setup Vertex 4...
-                buffmem->x = quad.position.d_right;
-                buffmem->y = quad.position.d_bottom;
-                buffmem->z = quad.z;
-                buffmem->diffuse = quad.topRightCol;
-                buffmem->tu1 = quad.texPosition.d_right;
-                buffmem->tv1 = quad.texPosition.d_bottom;
-                ++buffmem;
-    
-                // setup Vertex 5...
-                buffmem->x = quad.position.d_right;
-                buffmem->y = quad.position.d_top;
-                buffmem->z = quad.z;
-                buffmem->diffuse = quad.bottomRightCol;
-                buffmem->tu1 = quad.texPosition.d_right;
-                buffmem->tv1 = quad.texPosition.d_top;
-                ++buffmem;
-    
-                // setup Vertex 6...
-                
-                // top-left to bottom-right diagonal
-                if (quad.splitMode == TopLeftToBottomRight)
-                {
-                    buffmem->x = quad.position.d_left;
-                    buffmem->y = quad.position.d_top;
-                    buffmem->z = quad.z;
-                    buffmem->diffuse = quad.bottomLeftCol;
-                    buffmem->tu1 = quad.texPosition.d_left;
-                    buffmem->tv1 = quad.texPosition.d_top;
-                }
-                // bottom-left to top-right diagonal
-                else
-                {
-                    buffmem->x = quad.position.d_left;
-                    buffmem->y = quad.position.d_bottom;
-                    buffmem->z = quad.z;
-                    buffmem->diffuse = quad.topLeftCol;
-                    buffmem->tu1 = quad.texPosition.d_left;
-                    buffmem->tv1 = quad.texPosition.d_bottom;
-                }
-                ++buffmem;
-            }
-    
-            // ensure we leave the buffer in the unlocked state
-            d_buffer->unlock();
-        }
-        
-        /// Render the buffer
-        d_bufferPos = 0;
-        bool first = true;
-
-        // Iterate over each quad in the list and render it
-        QuadList::iterator i = d_quadlist.begin();
-        while(i != d_quadlist.end())
-        {
-            
-            d_currTexture = i->texture;
-            d_render_op.vertexData->vertexStart = d_bufferPos;
-            for (; i != d_quadlist.end(); ++i)
-            {
-                const QuadInfo& quad = (*i);
-                if (d_currTexture != quad.texture)
-                {
-                    /// If it has a different texture, render this quad in next operation
-                    /// also need to reset render states
-                    first = true;
-                    break;
-                }
-                d_bufferPos += VERTEX_PER_QUAD;
-            }
-            d_render_op.vertexData->vertexCount = d_bufferPos - d_render_op.vertexData->vertexStart;
-            /// Set texture, and do the render
-            d_render_sys->_setTexture(0, true, d_currTexture);
-            if (first)
-            {
-                initRenderStates();
-                first = false;
-            }
-            d_render_sys->_render(d_render_op);
-        }
-
-    }
-    /// Count frames to check if utilization of vertex buffer was below half the capacity for 500,000 frames
-    if(d_bufferPos < d_buffer->getNumVertices()/2)
-       d_underused_framecount++;
-    else
-       d_underused_framecount = 0;
-}
-
-
-/*************************************************************************
-    clear the queue
-*************************************************************************/
-void OgreCEGUIRenderer::clearRenderList(void)
-{
-    d_sorted = true;
-    d_quadlist.clear();
-}
-
-
-/*************************************************************************
-    create an empty texture
-*************************************************************************/
-Texture* OgreCEGUIRenderer::createTexture(void)
-{
-    OgreCEGUITexture* tex = new OgreCEGUITexture(this);
-    d_texturelist.push_back(tex);
-    return tex;
-}
-
-
-/*************************************************************************
-    create a texture and load it with the specified file.
-*************************************************************************/
-Texture* OgreCEGUIRenderer::createTexture(const String& filename, const String& resourceGroup)
-{
-    OgreCEGUITexture* tex = (OgreCEGUITexture*)createTexture();
-    tex->loadFromFile(filename, resourceGroup);
-
-    return tex;
-}
-
-
-/*************************************************************************
-    create a texture and set it to the specified size
-*************************************************************************/
-Texture* OgreCEGUIRenderer::createTexture(float size)
-{
-    OgreCEGUITexture* tex = (OgreCEGUITexture*)createTexture();
-    tex->setOgreTextureSize((uint)size);
-
-    return tex;
-}
-
-
-/*************************************************************************
-    destroy the given texture
-*************************************************************************/
-void OgreCEGUIRenderer::destroyTexture(Texture* texture)
-{
-    if (texture != NULL)
-    {
-        OgreCEGUITexture* tex = (OgreCEGUITexture*)texture;
-
-        d_texturelist.remove(tex);
-        delete tex;
-    }
-}
-
-
-/*************************************************************************
-    destroy all textures still active
-*************************************************************************/
-void OgreCEGUIRenderer::destroyAllTextures(void)
-{
-    while (!d_texturelist.empty())
-    {
-        destroyTexture(*(d_texturelist.begin()));
-    }
-}
-
-
-/*************************************************************************
-    setup states etc	
-*************************************************************************/
-void OgreCEGUIRenderer::initRenderStates(void)
-{
-    using namespace Ogre;
-
-    // set-up matrices
-    d_render_sys->_setWorldMatrix(Matrix4::IDENTITY);
-    d_render_sys->_setViewMatrix(Matrix4::IDENTITY);
-    d_render_sys->_setProjectionMatrix(Matrix4::IDENTITY);
-
-    // initialise render settings
-    d_render_sys->setLightingEnabled(false);
-    d_render_sys->_setDepthBufferParams(false, false);
-    d_render_sys->_setDepthBias(0, 0);
-    d_render_sys->_setCullingMode(CULL_NONE);
-    d_render_sys->_setFog(FOG_NONE);
-    d_render_sys->_setColourBufferWriteEnabled(true, true, true, true);
-    d_render_sys->unbindGpuProgram(GPT_FRAGMENT_PROGRAM);
-    d_render_sys->unbindGpuProgram(GPT_VERTEX_PROGRAM);
-    d_render_sys->setShadingType(SO_GOURAUD);
-    d_render_sys->_setPolygonMode(PM_SOLID);
-
-    // initialise texture settings
-    d_render_sys->_setTextureCoordCalculation(0, TEXCALC_NONE);
-    d_render_sys->_setTextureCoordSet(0, 0);
-    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);
-    d_render_sys->_setAlphaRejectSettings(CMPF_ALWAYS_PASS, 0);
-    d_render_sys->_setTextureBlendMode(0, d_colourBlendMode);
-    d_render_sys->_setTextureBlendMode(0, d_alphaBlendMode);
-    d_render_sys->_disableTextureUnitsFrom(1);
-
-    // enable alpha blending
-    d_render_sys->_setSceneBlending(SBF_SOURCE_ALPHA, SBF_ONE_MINUS_SOURCE_ALPHA);
-}
-
-
- 
-/*************************************************************************
-    sort quads list according to texture	
-*************************************************************************/
-void OgreCEGUIRenderer::sortQuads(void)
-{
-    if (!d_sorted)
-    {
-        d_sorted = true;
-    }
-
-}
-
-/*************************************************************************
-render a quad directly to the display
-*************************************************************************/
-void OgreCEGUIRenderer::renderQuadDirect(const Rect& dest_rect, float z, const Texture* tex, const Rect& texture_rect, const ColourRect& colours, QuadSplitMode quad_split_mode)
-{
-    // ORXONOX CHANGE: Even render when OverlaysEnabled is deactivated
-    // The reason is that we don't want the HUD to be shown in the viewport of the
-    // GUI (uses its own viewport to be able render on top of all viewports).
-    // But since we don't use overlays in the GUI, it doesn't matter.
-    // ORXONOX REVERT: Changes are not in place anymore, but might be in the future!
-    if (d_render_sys->_getViewport()->getOverlaysEnabled())
-    //if (true)
-    {
-        z = -1 + z;
-
-        Rect final_rect;
-
-        // set quad position, flipping y co-ordinates, and applying appropriate texel origin offset
-        final_rect.d_left	= dest_rect.d_left;
-        final_rect.d_right	= dest_rect.d_right;
-        final_rect.d_top	= d_display_area.getHeight() - dest_rect.d_top;
-        final_rect.d_bottom	= d_display_area.getHeight() - dest_rect.d_bottom;
-        final_rect.offset(d_texelOffset);
-
-        // convert quad co-ordinates for a -1 to 1 co-ordinate system.
-        final_rect.d_left	/= (d_display_area.getWidth() * 0.5f);
-        final_rect.d_right	/= (d_display_area.getWidth() * 0.5f);
-        final_rect.d_top	/= (d_display_area.getHeight() * 0.5f);
-        final_rect.d_bottom	/= (d_display_area.getHeight() * 0.5f);
-        final_rect.offset(Point(-1.0f, -1.0f));
-
-        // convert colours for ogre, note that top / bottom are switched.
-        uint32 topLeftCol	= colourToOgre(colours.d_bottom_left);
-        uint32 topRightCol	= colourToOgre(colours.d_bottom_right);
-        uint32 bottomLeftCol	= colourToOgre(colours.d_top_left);
-        uint32 bottomRightCol= colourToOgre(colours.d_top_right);
-
-        QuadVertex*	buffmem = (QuadVertex*)d_direct_buffer->lock(Ogre::HardwareVertexBuffer::HBL_DISCARD);
-
-        // setup Vertex 1...
-        buffmem->x	= final_rect.d_left;
-        buffmem->y	= final_rect. d_bottom;
-        buffmem->z	= z;
-        buffmem->diffuse = topLeftCol;
-        buffmem->tu1	= texture_rect.d_left;
-        buffmem->tv1	= texture_rect.d_bottom;
-        ++buffmem;
-
-        // setup Vertex 2...
-        
-        // top-left to bottom-right diagonal
-        if (quad_split_mode == TopLeftToBottomRight)
-        {
-            buffmem->x	= final_rect.d_right;
-            buffmem->y = final_rect.d_bottom;
-            buffmem->z	= z;
-            buffmem->diffuse = topRightCol;
-            buffmem->tu1	= texture_rect.d_right;
-            buffmem->tv1	= texture_rect.d_bottom;
-            ++buffmem;
-        }
-        // bottom-left to top-right diagonal
-        else
-        {
-            buffmem->x	= final_rect.d_right;
-            buffmem->y = final_rect.d_top;
-            buffmem->z	= z;
-            buffmem->diffuse = bottomRightCol;
-            buffmem->tu1	= texture_rect.d_right;
-            buffmem->tv1	= texture_rect.d_top;
-            ++buffmem;
-        }
-
-        // setup Vertex 3...
-        buffmem->x	= final_rect.d_left;
-        buffmem->y	= final_rect.d_top;
-        buffmem->z	= z;
-        buffmem->diffuse = bottomLeftCol;
-        buffmem->tu1	= texture_rect.d_left;
-        buffmem->tv1	= texture_rect.d_top;
-        ++buffmem;
-
-        // setup Vertex 4...
-        buffmem->x	= final_rect.d_right;
-        buffmem->y	= final_rect.d_bottom;
-        buffmem->z	= z;
-        buffmem->diffuse = topRightCol;
-        buffmem->tu1	= texture_rect.d_right;
-        buffmem->tv1	= texture_rect.d_bottom;
-        ++buffmem;
-
-        // setup Vertex 5...
-        buffmem->x	= final_rect.d_right;
-        buffmem->y	= final_rect.d_top;
-        buffmem->z	= z;
-        buffmem->diffuse = bottomRightCol;
-        buffmem->tu1	= texture_rect.d_right;
-        buffmem->tv1	= texture_rect.d_top;
-        ++buffmem;
-
-        // setup Vertex 6...
-        
-        // top-left to bottom-right diagonal
-        if (quad_split_mode == TopLeftToBottomRight)
-        {
-            buffmem->x	= final_rect.d_left;
-            buffmem->y = final_rect.d_top;
-            buffmem->z	= z;
-            buffmem->diffuse = bottomLeftCol;
-            buffmem->tu1	= texture_rect.d_left;
-            buffmem->tv1	= texture_rect.d_top;
-        }
-        // bottom-left to top-right diagonal
-        else
-        {
-            buffmem->x	= final_rect.d_left;
-            buffmem->y = final_rect.d_bottom;
-            buffmem->z	= z;
-            buffmem->diffuse = topLeftCol;
-            buffmem->tu1	= texture_rect.d_left;
-            buffmem->tv1	= texture_rect.d_bottom;
-        }
-
-        d_direct_buffer->unlock();
-
-        //
-        // perform rendering...
-        //
-        d_render_sys->_setTexture(0, true, ((OgreCEGUITexture*)tex)->getOgreTexture()->getName());
-        initRenderStates();
-        d_direct_render_op.vertexData->vertexCount = VERTEX_PER_QUAD;
-        d_render_sys->_render(d_direct_render_op);
-    }
-
-}
-
-/*************************************************************************
-    convert ARGB colour value to whatever the Ogre render system is
-    expecting.	
-*************************************************************************/
-uint32 OgreCEGUIRenderer::colourToOgre(const colour& col) const
-{
-    Ogre::ColourValue cv(col.getRed(), col.getGreen(), col.getBlue(), col.getAlpha());
-
-    uint32 final;
-    d_render_sys->convertColourValue(cv, &final);
-
-    return final;
-}
-
-
-/*************************************************************************
-    Set the scene manager to be used for rendering the GUI.	
-*************************************************************************/
-void OgreCEGUIRenderer::setTargetSceneManager(Ogre::SceneManager* scene_manager)
-{
-    // unhook from current scene manager.
-    if (d_sceneMngr != NULL)
-    {
-        d_sceneMngr->removeRenderQueueListener(d_ourlistener);
-        d_sceneMngr = NULL;
-    }
-
-    // hook new scene manager if that is not NULL
-    if (scene_manager != NULL)
-    {
-        d_sceneMngr = scene_manager;
-        d_sceneMngr->addRenderQueueListener(d_ourlistener);
-    }
-
-}
-
-
-/*************************************************************************
-    Set the target render queue for GUI rendering.	
-*************************************************************************/
-void OgreCEGUIRenderer::setTargetRenderQueue(Ogre::uint8 queue_id, bool post_queue)
-{
-    d_queue_id		= queue_id;
-    d_post_queue	= post_queue;
-
-    if (d_ourlistener != NULL)
-    {
-        d_ourlistener->setTargetRenderQueue(queue_id);
-        d_ourlistener->setPostRenderQueue(post_queue);
-    }
-
-}
-
-
-/*************************************************************************
-    perform main work of the constructor
-*************************************************************************/
-void OgreCEGUIRenderer::constructor_impl(Ogre::RenderWindow* window, Ogre::uint8 queue_id, bool post_queue, uint max_quads)
-{
-    using namespace Ogre;
-
-    // initialise the renderer fields
-    d_queueing		= true;
-    d_queue_id		= queue_id;
-    d_currTexture.isNull();
-    d_post_queue	= post_queue;
-    d_sceneMngr		= NULL;
-    d_bufferPos		= 0;
-    d_sorted		= true;
-    d_ogre_root		= Root::getSingletonPtr();
-    d_render_sys	= d_ogre_root->getRenderSystem();
-    // set ID string
-    d_identifierString = "CEGUI::OgreRenderer - Official Ogre based renderer module for CEGUI";
-
-    // Create and initialise the Ogre specific parts required for use in rendering later.
-    // Main GUI
-    createQuadRenderOp(d_render_op, d_buffer, VERTEXBUFFER_INITIAL_CAPACITY);
-    d_underused_framecount = 0;
-
-    // Mouse cursor
-    createQuadRenderOp(d_direct_render_op, d_direct_buffer, VERTEX_PER_QUAD);
-
-    // Discover display settings and setup d_display_area
-    d_display_area.d_left	= 0;
-    d_display_area.d_top	= 0;
-    d_display_area.d_right	= window->getWidth();
-    d_display_area.d_bottom	= window->getHeight();
-
-    // initialise required texel offset
-    d_texelOffset = Point((float)d_render_sys->getHorizontalTexelOffset(), -(float)d_render_sys->getVerticalTexelOffset());
-
-    // create listener which will handler the rendering side of things for us.
-    d_ourlistener = new CEGUIRQListener(this, queue_id, post_queue);
-
-    // Initialise blending modes to be used.
-    d_colourBlendMode.blendType	= Ogre::LBT_COLOUR;
-    d_colourBlendMode.source1	= Ogre::LBS_TEXTURE;
-    d_colourBlendMode.source2	= Ogre::LBS_DIFFUSE;
-    d_colourBlendMode.operation	= Ogre::LBX_MODULATE;
-
-    d_alphaBlendMode.blendType	= Ogre::LBT_ALPHA;
-    d_alphaBlendMode.source1	= Ogre::LBS_TEXTURE;
-    d_alphaBlendMode.source2	= Ogre::LBS_DIFFUSE;
-    d_alphaBlendMode.operation	= Ogre::LBX_MODULATE;
-
-    d_uvwAddressMode.u = Ogre::TextureUnitState::TAM_CLAMP;
-    d_uvwAddressMode.v = Ogre::TextureUnitState::TAM_CLAMP;
-    d_uvwAddressMode.w = Ogre::TextureUnitState::TAM_CLAMP;
-}
-
-
-/*************************************************************************
-    Create a texture from an existing Ogre::TexturePtr object	
-*************************************************************************/
-Texture* OgreCEGUIRenderer::createTexture(Ogre::TexturePtr& texture)
-{
-    OgreCEGUITexture* t = (OgreCEGUITexture*)createTexture();
-
-    if (!texture.isNull())
-    {
-        t->setOgreTexture(texture);
-    }
-
-    return t;
-
-}
-
-/*************************************************************************
-    Create a resource provider object
-*************************************************************************/
-ResourceProvider* OgreCEGUIRenderer::createResourceProvider(void)
-{
-    d_resourceProvider = new OgreCEGUIResourceProvider();
-    return d_resourceProvider;
-}
-
-/*************************************************************************
-Set the size of the display in pixels.	
-*************************************************************************/
-void OgreCEGUIRenderer::setDisplaySize(const Size& sz)
-{
-    if (d_display_area.getSize() != sz)
-    {
-        d_display_area.setSize(sz);
-
-        EventArgs args;
-        fireEvent(EventDisplaySizeChanged, args, EventNamespace);
-    }
-
-}
-
-/*************************************************************************
-    Callback from Ogre invoked before other stuff in our target queue
-    is rendered
-*************************************************************************/
-void CEGUIRQListener::renderQueueStarted(Ogre::uint8 id, const Ogre::String& invocation, 
-                                         bool& skipThisQueue)
-{
-    if ((!d_post_queue) && (d_queue_id == id))
-    {
-        CEGUI::System::getSingleton().renderGUI();
-    }
-
-}
-
-
-/*************************************************************************
-Callback from Ogre invoked after other stuff in our target queue
-is rendered
-*************************************************************************/
-void CEGUIRQListener::renderQueueEnded(Ogre::uint8 id, const Ogre::String& invocation, bool& repeatThisQueue)
-{
-    if ((d_post_queue) && (d_queue_id == id))
-    {
-        CEGUI::System::getSingleton().renderGUI();
-    }
-
-}
-
-} // End of  CEGUI namespace section
Index: de/branches/buildsystem3/src/orxonox/gui/OgreCEGUIRenderer.h
===================================================================
--- /code/branches/buildsystem3/src/orxonox/gui/OgreCEGUIRenderer.h	(revision 2663)
+++ 	(revision )
@@ -1,465 +1,0 @@
-/************************************************************************
-    filename: 	OgreCEGUIRenderer.h
-    created:	11/5/2004
-    author:		Paul D Turner
-
-    purpose:	Interface for main Ogre GUI renderer class
-*************************************************************************/
-/*************************************************************************
-    Crazy Eddie's GUI System (http://www.cegui.org.uk)
-    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library 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
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*************************************************************************/
-/*************************************************************************
-    This file contains code that is specific to Ogre (http://www.ogre3d.org)
-*************************************************************************/
-#ifndef _OgreCEGUIRenderer_H__
-#define _OgreCEGUIRenderer_H__
-
-#include <CEGUIBase.h>
-#include <CEGUIRenderer.h>
-#include <CEGUITexture.h>
-
-#include <OgreRenderQueueListener.h>
-#include <OgreSceneManagerEnumerator.h>
-#include <OgreTextureUnitState.h>
-
-/** CHANGES MADE BY ORXONOX TO FIT DLL IMPORT/EXPORT **/
-#if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32) && !(defined(ORXONOX_STATIC_BUILD) || defined(ORXONOX_NO_EXPORTS))
-#   ifdef ORXONOX_SHARED_BUILD
-#       define OGRE_GUIRENDERER_API __declspec(dllexport)
-#   else
-#       if defined(__MINGW32__)
-#           define OGRE_GUIRENDERER_API
-#       else
-#           define OGRE_GUIRENDERER_API __declspec(dllimport)
-#       endif
-#   endif
-#elif defined ( OGRE_GCC_VISIBILITY )
-#    define OGRE_GUIRENDERER_API  __attribute__ ((visibility("default")))
-#else
-#    define OGRE_GUIRENDERER_API
-#endif
-
-
-// Start of CEGUI namespace section
-namespace CEGUI
-{
-/*************************************************************************
-    Forward refs
-*************************************************************************/
-class OgreCEGUITexture;
-class OgreCEGUIRenderer;
-
-
-/*!
-\brief
-    RenderQueueListener based class used to hook into the ogre rendering system
-*/
-class _OgrePrivate CEGUIRQListener : public Ogre::RenderQueueListener
-{
-public:
-    CEGUIRQListener(OgreCEGUIRenderer* renderer, Ogre::uint8 queue_id, bool post_queue)
-    {
-        d_renderer		= renderer;
-        d_queue_id		= queue_id;
-        d_post_queue	= post_queue;
-    }
-
-    virtual ~CEGUIRQListener() {}
-
-    virtual void	renderQueueStarted(Ogre::uint8 id, const Ogre::String& invocation, bool& skipThisQueue);
-    virtual void	renderQueueEnded(Ogre::uint8 id, const Ogre::String& invocation, bool& repeatThisQueue);
-
-    // methods for adjusting target queue settings
-    void	setTargetRenderQueue(Ogre::uint8 queue_id)		{d_queue_id = queue_id;}
-    void	setPostRenderQueue(bool post_queue)		{d_post_queue = post_queue;}
-
-private:
-    /*************************************************************************
-        Implementation Data
-    *************************************************************************/
-    OgreCEGUIRenderer*				d_renderer;		//!< CEGUI renderer object for Ogre.
-    Ogre::uint8	d_queue_id;		//!< ID of the queue that we are hooked into
-    bool						d_post_queue;	//!< true if we render after everything else in our queue.
-};
-
-
-/*!
-\brief
-    Renderer class to interface with Ogre engine.
-*/
-class OGRE_GUIRENDERER_API OgreCEGUIRenderer : public Renderer
-{
-public:
-    /*!
-    \brief
-        Constructor for renderer class that uses Ogre for rendering. Note that if
-        you use this option you must call setTargetSceneManager before rendering.
-
-    \param window
-        Pointer to an Ogre::RenderWindow object.
-
-    \param queue_id
-        Ogre::uint8 value that specifies where the GUI should appear in the ogre rendering output.
-
-    \param post_queue
-        set to true to have GUI rendered after render queue \a queue_id, or false to have the GUI rendered before render queue
-        \a queue_id.
-
-    \param max_quads
-        Obsolete.  Set to 0.
-
-    */
-    OgreCEGUIRenderer(Ogre::RenderWindow* window,
-        Ogre::uint8 queue_id = Ogre::RENDER_QUEUE_OVERLAY,
-        bool post_queue = false, uint max_quads = 0);
-
-
-    /*!
-    \brief
-        Constructor for renderer class that uses Ogre for rendering.
-
-    \param window
-        Pointer to an Ogre::RenderWindow object.
-
-    \param queue_id
-        Ogre::uint8 value that specifies where the GUI should appear in the ogre rendering output.
-
-    \param post_queue
-        set to true to have GUI rendered after render queue \a queue_id, or false to have the GUI rendered before render queue
-        \a queue_id.
-
-    \param max_quads
-        Obsolete.  Set to 0.
-
-    \param scene_manager
-        Pointer to an Ogre::SceneManager object that is to be used for GUI rendering.
-    */
-    OgreCEGUIRenderer(Ogre::RenderWindow* window, Ogre::uint8 queue_id, bool post_queue, uint max_quads, Ogre::SceneManager* scene_manager);
-
-
-    /*!
-    \brief
-        Destructor for Ogre renderer.
-    */
-    virtual ~OgreCEGUIRenderer(void);
-
-
-
-    // add's a quad to the list to be rendered
-    virtual	void	addQuad(const Rect& dest_rect, float z, const Texture* tex, const Rect& texture_rect, const ColourRect& colours, QuadSplitMode quad_split_mode);
-
-    // perform final rendering for all queued renderable quads.
-    virtual	void	doRender(void);
-
-    // clear the queue
-    virtual	void	clearRenderList(void);
-
-
-    /*!
-    \brief
-        Enable or disable the queueing of quads from this point on.
-
-        This only affects queueing.  If queueing is turned off, any calls to addQuad will cause the quad to be rendered directly.  Note that
-        disabling queueing will not cause currently queued quads to be rendered, nor is the queue cleared - at any time the queue can still
-        be drawn by calling doRender, and the list can be cleared by calling clearRenderList.  Re-enabling the queue causes subsequent quads
-        to be added as if queueing had never been disabled.
-
-    \param setting
-        true to enable queueing, or false to disable queueing (see notes above).
-
-    \return
-        Nothing
-    */
-    virtual void	setQueueingEnabled(bool setting)		{d_queueing = setting;}
-
-
-    // create an empty texture
-    virtual	Texture*	createTexture(void);
-
-    // create a texture and load it with the specified file.
-    virtual	Texture*	createTexture(const String& filename, const String& resourceGroup = "General");
-
-    // create a texture and set it to the specified size
-    virtual	Texture*	createTexture(float size);
-
-    // create an OGRE resource provider.
-    virtual ResourceProvider* createResourceProvider(void);
-
-    // destroy the given texture
-    virtual	void		destroyTexture(Texture* texture);
-
-    // destroy all textures still active
-    virtual void		destroyAllTextures(void);
-
-
-    /*!
-    \brief
-        Return whether queueing is enabled.
-
-    \return
-        true if queueing is enabled, false if queueing is disabled.
-    */
-    virtual bool	isQueueingEnabled(void) const	{return d_queueing;}
-
-
-    /*!
-    \brief
-    Return the current width of the display in pixels
-
-    \return
-    float value equal to the current width of the display in pixels.
-    */
-    virtual float	getWidth(void) const		{return d_display_area.getWidth();}
-
-
-    /*!
-    \brief
-    Return the current height of the display in pixels
-
-    \return
-    float value equal to the current height of the display in pixels.
-    */
-    virtual float	getHeight(void) const		{return d_display_area.getHeight();}
-
-
-    /*!
-    \brief
-    Return the size of the display in pixels
-
-    \return
-    Size object describing the dimensions of the current display.
-    */
-    virtual Size	getSize(void) const			{return d_display_area.getSize();}
-
-
-    /*!
-    \brief
-    Return a Rect describing the screen
-
-    \return
-    A Rect object that describes the screen area.  Typically, the top-left values are always 0, and the size of the area described is
-    equal to the screen resolution.
-    */
-    virtual Rect	getRect(void) const			{return d_display_area;}
-
-
-    /*!
-    \brief
-        Return the maximum texture size available
-
-    \return
-        Size of the maximum supported texture in pixels (textures are always assumed to be square)
-    */
-    virtual	uint	getMaxTextureSize(void) const		{return 2048;}		// TODO: Change to proper value
-
-
-    /*!
-    \brief
-        Return the horizontal display resolution dpi
-
-    \return
-        horizontal resolution of the display in dpi.
-    */
-    virtual	uint	getHorzScreenDPI(void) const	{return 96;}
-
-
-    /*!
-    \brief
-        Return the vertical display resolution dpi
-
-    \return
-        vertical resolution of the display in dpi.
-    */
-    virtual	uint	getVertScreenDPI(void) const	{return 96;}
-
-
-    /*!
-    \brief
-        Set the scene manager to be used for rendering the GUI.
-
-        The GUI system will be unhooked from the current scene manager and attached to what ever
-        is specified here.
-
-    \param scene_manager
-        Pointer to an Ogre::SceneManager object that is the new target Ogre::SceneManager to be
-        used for GUI rendering.
-
-    \return
-        Nothing.
-    */
-    void	setTargetSceneManager(Ogre::SceneManager* scene_manager);
-
-
-    /*!
-    \brief
-        Set the target render queue for GUI rendering.
-
-    \param queue_id
-        Ogre::uint8 value specifying the render queue that the GUI system should attach to.
-
-    \param post_queue
-        - true to specify that the GUI should render after everything else in render queue \a queue_id.
-        - false to specify the GUI should render before everything else in render queue \a queue_id.
-
-    \return
-        Nothing.
-    */
-    void	setTargetRenderQueue(Ogre::uint8 queue_id, bool post_queue);
-
-
-    /*!
-    \brief
-        Create a texture from an existing Ogre::TexturePtr object.
-
-    \note
-        If you want to use an Ogre::RenderTexture (for putting rendered output onto Gui elements or other
-        advanced techniques), you can get the Ogre::TexturePtr to be used by calling Ogre::TextureManager::getByName()
-        passing the name returned from Ogre::RenderTexture::getName() (and casting the result as necessary).
-
-    \param texture
-        pointer to an Ogre::TexturePtr object to be used as the basis for the new CEGUI::Texture
-
-    \return
-        Pointer to the newly created CEGUI::TexturePtr object.
-    */
-    Texture*	createTexture(Ogre::TexturePtr& texture);
-
-
-    /*!
-    \brief
-    Set the size of the display in pixels.
-
-    You do not have to call this method under normal operation as the system
-    will automatically extract the size from the current view port.
-
-    \note
-    This method will cause the EventDisplaySizeChanged event to fire if the
-    display size has changed.
-
-    \param sz
-    Size object describing the size of the display.
-
-    \return
-    Nothing.
-    */
-    void	setDisplaySize(const Size& sz);
-
-
-private:
-    /************************************************************************
-        Implementation Constants
-    ************************************************************************/
-    static const size_t    VERTEX_PER_QUAD;						 //!< number of vertices per quad
-    static const size_t    VERTEX_PER_TRIANGLE;					 //!< number of vertices for a triangle
-    static const size_t    VERTEXBUFFER_INITIAL_CAPACITY;		 //!< initial capacity of the allocated vertex buffer
-    static const size_t    UNDERUSED_FRAME_THRESHOLD;            //!< number of frames to wait before shrinking buffer
-
-    /*************************************************************************
-        Implementation Structs & classes
-    *************************************************************************/
-    /*!
-    \brief
-        structure used for all vertices.
-    */
-    struct QuadVertex {
-        float x, y, z;			//!< The position for the vertex.
-        Ogre::RGBA diffuse;		//!< colour of the vertex
-        float tu1, tv1;			//!< texture coordinates
-    };
-
-    /*!
-    \brief
-        structure holding details about a quad to be drawn
-    */
-    struct QuadInfo
-    {
-        Ogre::TexturePtr		texture;
-        Rect				position;
-        float				z;
-        Rect				texPosition;
-        uint32		        topLeftCol;
-        uint32		        topRightCol;
-        uint32		        bottomLeftCol;
-        uint32		        bottomRightCol;
-
-        QuadSplitMode		splitMode;
-
-        bool operator<(const QuadInfo& other) const
-        {
-            // this is intentionally reversed.
-            return z > other.z;
-        }
-    };
-
-
-    /*************************************************************************
-        Implementation Methods
-    *************************************************************************/
-    // setup states etc
-    void	initRenderStates(void);
-
-    // sort quads list according to texture
-    void	sortQuads(void);
-
-    // render a quad directly to the display
-    void	renderQuadDirect(const Rect& dest_rect, float z, const Texture* tex, const Rect& texture_rect, const ColourRect& colours, QuadSplitMode quad_split_mode);
-
-    // convert colour value to whatever the Ogre render system is expecting.
-    uint32    colourToOgre(const colour& col) const;
-
-    // perform main work of the constructor.  This does everything except the final hook into the render system.
-    void	constructor_impl(Ogre::RenderWindow* window, Ogre::uint8 queue_id, bool post_queue, uint max_quads);
-
-
-    /*************************************************************************
-        Implementation Data
-    *************************************************************************/
-    Rect				d_display_area;
-
-    typedef std::multiset<QuadInfo>		QuadList;
-    QuadList d_quadlist;
-    bool	 d_queueing;		//!< setting for queueing control.
-
-    // Ogre specific bits.
-    Ogre::Root*					d_ogre_root;		//!< pointer to the Ogre root object that we attach to
-    Ogre::RenderSystem*			d_render_sys;		//!< Pointer to the render system for Ogre.
-    Ogre::uint8	d_queue_id;			//!< ID of the queue that we are hooked into
-    Ogre::TexturePtr			d_currTexture;		//!< currently set texture;
-    Ogre::RenderOperation		d_render_op;		//!< Ogre render operation we use to do our stuff.
-    Ogre::HardwareVertexBufferSharedPtr	d_buffer;	//!< vertex buffer to queue sprite rendering
-    size_t d_underused_framecount;                  //!< Number of frames elapsed since buffer utilization was above half the capacity
-    Ogre::RenderOperation		d_direct_render_op;		//!< Renderop for cursor
-    Ogre::HardwareVertexBufferSharedPtr	d_direct_buffer;	//!< Renderop for cursor
-    Ogre::SceneManager*			d_sceneMngr;		//!< The scene manager we are hooked into.
-    Ogre::LayerBlendModeEx		d_colourBlendMode;	//!< Controls colour blending mode used.
-    Ogre::LayerBlendModeEx		d_alphaBlendMode;	//!< Controls alpha blending mode used.
-    Ogre::TextureUnitState::UVWAddressingMode d_uvwAddressMode;
-
-    CEGUIRQListener*			d_ourlistener;
-    bool						d_post_queue;		//!< true if we render after everything else in our queue.
-    size_t						d_bufferPos;		//!< index into buffer where next vertex should be put.
-    bool						d_sorted;			//!< true when data in quad list is sorted.
-    Point						d_texelOffset;		//!< Offset required for proper texel mapping.
-
-    std::list<OgreCEGUITexture*> d_texturelist;		//!< List used to track textures.
-};
-
-} // End of  CEGUI namespace section
-
-
-#endif	// end of guard _OgreCEGUIRenderer_H__
Index: de/branches/buildsystem3/src/orxonox/gui/OgreCEGUIResourceProvider.cpp
===================================================================
--- /code/branches/buildsystem3/src/orxonox/gui/OgreCEGUIResourceProvider.cpp	(revision 2663)
+++ 	(revision )
@@ -1,98 +1,0 @@
-/************************************************************************
-    filename: 	OgreCEGUIResourceProvider.cpp
-    created:	8/7/2004
-    author:		James '_mental_' O'Sullivan
-
-    purpose:	Implements the Resource Provider common functionality
-*************************************************************************/
-/*************************************************************************
-    Crazy Eddie's GUI System (http://www.cegui.org.uk)
-    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library 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
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*************************************************************************/
-#include "OrxonoxStableHeaders.h"
-#include "OgreCEGUIResourceProvider.h"
-
-#include <CEGUIExceptions.h>
-#include <OgreArchiveManager.h>
-
-
-// Start of CEGUI namespace section
-namespace CEGUI
-{
-    OgreCEGUIResourceProvider::OgreCEGUIResourceProvider() : ResourceProvider()
-    {
-        // set deafult resource group for Ogre
-        d_defaultResourceGroup = Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME.c_str();
-    }
-
-//    void OgreResourceProvider::loadInputSourceContainer(const String& filename, InputSourceContainer& output)
-//   {
-//        Ogre::DataStreamPtr input = Ogre::ResourceGroupManager::getSingleton().openResource(filename.c_str());
-//
-//		if (input.isNull())
-//		{
-//			throw InvalidRequestException((utf8*)
-//				"Scheme::Scheme - Filename supplied for Scheme loading must be valid");
-//		}
-//
-//       XERCES_CPP_NAMESPACE_USE
-//        size_t buffsz = input->size();
-//        unsigned char* mem = reinterpret_cast<unsigned char*>(XMLPlatformUtils::fgArrayMemoryManager->allocate(buffsz));
-//        memcpy(mem, input.getPointer()->getAsString().c_str(), buffsz);
-//        InputSource* mInputSource = new MemBufInputSource(mem, buffsz, filename.c_str(), true);
-//        input.setNull();
-//
-//       output.setData(mInputSource);
-//    }
-
-    void OgreCEGUIResourceProvider::loadRawDataContainer(const String& filename, RawDataContainer& output,  const String& resourceGroup)
-    {
-        String orpGroup;
-        if (resourceGroup.empty())
-            orpGroup = d_defaultResourceGroup.empty() ? Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME.c_str() : d_defaultResourceGroup;
-        else
-            orpGroup = resourceGroup;
-
-        Ogre::DataStreamPtr input =
-            Ogre::ResourceGroupManager::getSingleton().openResource(filename.c_str(), orpGroup.c_str());
-
-        if (input.isNull())
-        {
-            throw InvalidRequestException((utf8*)
-                "OgreCEGUIResourceProvider::loadRawDataContainer - Unable to open resource file '" + filename + (utf8*)"' in resource group '" + orpGroup + (utf8*)"'.");
-        }
-
-        Ogre::String buf = input->getAsString();
-        const size_t memBuffSize = buf.length();
-
-        unsigned char* mem = new unsigned char[memBuffSize];
-        memcpy(mem, buf.c_str(), memBuffSize);
-
-        output.setData(mem);
-        output.setSize(memBuffSize);
-    }
-
-    void OgreCEGUIResourceProvider::unloadRawDataContainer(RawDataContainer& data)
-    {
-        if (data.getDataPtr())
-        {
-            delete[] data.getDataPtr();
-            data.setData(0);
-            data.setSize(0);
-        }
-    }
-} // End of  CEGUI namespace section
Index: de/branches/buildsystem3/src/orxonox/gui/OgreCEGUIResourceProvider.h
===================================================================
--- /code/branches/buildsystem3/src/orxonox/gui/OgreCEGUIResourceProvider.h	(revision 2663)
+++ 	(revision )
@@ -1,52 +1,0 @@
-/************************************************************************
-    filename: 	CEGUIOgreResourceProvider.h
-    created:	8/7/2004
-    author:		James '_mental_' O'Sullivan
-    
-    purpose:	Defines abstract base class for CEGUIData objects
-*************************************************************************/
-/*************************************************************************
-    Crazy Eddie's GUI System (http://www.cegui.org.uk)
-    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library 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
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*************************************************************************/
-#ifndef _OgreCEGUIResourceProvider_H__
-#define _OgreCEGUIResourceProvider_H__
-
-#include <CEGUIResourceProvider.h>
-#include "OgreCEGUIRenderer.h"
-
-// Start of CEGUI namespace section
-namespace CEGUI
-{
-class _OgrePrivate OgreCEGUIResourceProvider : public ResourceProvider
-{
-public:
-    /*************************************************************************
-        Construction and Destruction
-    *************************************************************************/
-    OgreCEGUIResourceProvider();
-
-    ~OgreCEGUIResourceProvider(void) {}
-
-//    void loadInputSourceContainer(const String& filename, InputSourceContainer& output);
-    void loadRawDataContainer(const String& filename, RawDataContainer& output, const String& resourceGroup);
-    void unloadRawDataContainer(RawDataContainer& output);
-};
-
-} // End of  CEGUI namespace section
-
-#endif	// end of guard _OgreCEGUIResourceProvider_H__
Index: de/branches/buildsystem3/src/orxonox/gui/OgreCEGUITexture.cpp
===================================================================
--- /code/branches/buildsystem3/src/orxonox/gui/OgreCEGUITexture.cpp	(revision 2663)
+++ 	(revision )
@@ -1,269 +1,0 @@
-/************************************************************************
-    filename: 	OgreCEGUITexture.cpp
-    created:	11/5/2004
-    author:		Paul D Turner
-    
-    purpose:	Implementation of Texture using Ogre engine
-*************************************************************************/
-/*************************************************************************
-    Crazy Eddie's GUI System (http://www.cegui.org.uk)
-    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library 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
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*************************************************************************/
-
-#include "OrxonoxStableHeaders.h"
-#include <CEGUISystem.h>
-#include <CEGUIExceptions.h>
-#include "OgreCEGUITexture.h"
-#include "OgreCEGUIRenderer.h"
-
-#include <OgreTextureManager.h>
-
-// Start of CEGUI namespace section
-namespace CEGUI
-{
-/*************************************************************************
-    Static data definition / initialisation
-*************************************************************************/
-uint32 OgreCEGUITexture::d_texturenumber		= 0;
-
-
-/*************************************************************************
-    Constructor
-*************************************************************************/
-OgreCEGUITexture::OgreCEGUITexture(Renderer* owner) :
-    Texture(owner)
-{
-    d_ogre_texture.setNull();
-    d_isLinked = false;
-}
-
-
-/*************************************************************************
-    Destructor
-*************************************************************************/
-OgreCEGUITexture::~OgreCEGUITexture(void)
-{
-    freeOgreTexture();
-}
-
-
-/*************************************************************************
-    Loads the specified image file into the texture.  The texture is
-    resized as required to hold the image.	
-*************************************************************************/
-void OgreCEGUITexture::loadFromFile(const String& filename, const String& resourceGroup)
-{
-    using namespace Ogre;
-
-    // unload old ogre texture
-    freeOgreTexture();
-
-    // create / load a new ogre texture from the specified image
-    try
-    {
-        TextureManager& textureManager = TextureManager::getSingleton();
-
-        // see if texture already exists
-        Ogre::TexturePtr ogreTexture = (Ogre::TexturePtr)textureManager.getByName(filename.c_str());
-
-        if (!ogreTexture.isNull())
-        {
-            // texture already exists, so create a 'linked' texture (ensures texture is not destroyed twice)
-            d_ogre_texture = ogreTexture;
-            d_isLinked = true;
-        }
-        // texture does not already exist, so load it in
-        else
-        {
-            String orpGroup;
-            if (resourceGroup.empty())
-            {
-                const String& defGrp = CEGUI::System::getSingleton().getResourceProvider()->getDefaultResourceGroup();
-                orpGroup = defGrp.empty() ? Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME.c_str() : defGrp;
-            }
-            else
-            {
-                orpGroup = resourceGroup;
-            }
-
-            d_ogre_texture = TextureManager::getSingleton().load(filename.c_str(), orpGroup.c_str(), TEX_TYPE_2D, 0, 1.0f);
-            d_isLinked = false;
-        }
-
-    }
-    catch(Ogre::Exception e)
-    {
-        throw RendererException((utf8*)"Failed to create Texture object from file '" + filename + "'. Additional Information:\n" + e.getFullDescription().c_str());
-    }
-
-    // if we got a pointer cache some details
-    if (!d_ogre_texture.isNull())
-    {
-        d_width		= d_ogre_texture->getWidth();
-        d_height	= d_ogre_texture->getHeight();
-    }
-    // no texture from image so throw.
-    else
-    {
-        throw RendererException((utf8*)"Failed to create Texture object from file '" + filename + "'.  Ogre returned a NULL pointer.");
-    }
-
-}
-
-
-/*************************************************************************
-    Loads (copies) an image in memory into the texture.  The texture is
-    resized as required to hold the image.	
-*************************************************************************/
-
-void _byteSwap(unsigned char* b, int n)
-{
-    register int i = 0;
-    register int j = n-1;
-    while (i<j)
-    {
-        std::swap(b[i], b[j]);
-        i++, j--;
-    }
-}
-#define byteSwap(x) _byteSwap((unsigned char*) &x,sizeof(x))
-
-void OgreCEGUITexture::loadFromMemory(const void* buffPtr, uint buffWidth, uint buffHeight, PixelFormat pixelFormat)
-{
-    using namespace Ogre;
-
-    // get rid of old texture
-    freeOgreTexture();
-
-    // wrap input buffer with an Ogre DataChunk
-    uint32 bytesize = ((buffWidth * sizeof(uint32)) * buffHeight);
-
-#if OGRE_ENDIAN == OGRE_ENDIAN_BIG
-    uint32* swappedBuffer = new uint32[bytesize/4];
-    memcpy(swappedBuffer, buffPtr, bytesize);
-
-    for (int i=0; i < bytesize/4; i++)
-        byteSwap(swappedBuffer[i]);
-
-    DataStreamPtr odc(new MemoryDataStream(static_cast<void*>(swappedBuffer), bytesize, false));
-#else
-    DataStreamPtr odc(new MemoryDataStream(const_cast<void*>(buffPtr), bytesize, false));
-#endif
-
-    // get pixel type for the target texture - the elements here might look wrong, but is just
-    // differences in definition (at the core level, between GL and D3D).
-    Ogre::PixelFormat targetFmt =
-        (pixelFormat == PF_RGBA) ? Ogre::PF_A8R8G8B8 : Ogre::PF_R8G8B8;
-
-    // try to create a Ogre::Texture from the input data
-    d_ogre_texture = TextureManager::getSingleton().loadRawData(getUniqueName(), "General", odc, buffWidth, buffHeight, targetFmt , TEX_TYPE_2D, 0, 1.0f);
-
-    // if we got a pointer cache some details
-    if (!d_ogre_texture.isNull())
-    {
-        d_width		= d_ogre_texture->getWidth();
-        d_height	= d_ogre_texture->getHeight();
-    }
-    // no texture from memory so throw.
-    else
-    {
-        throw RendererException((utf8*)"Failed to create Texture object from memory:  Ogre returned a NULL Ogre::Texture pointer.");
-    }
-
-}
-
-
-/*************************************************************************
-    set the size of the internal Ogre texture.  Previous Ogre texture
-    is lost.	
-*************************************************************************/
-void OgreCEGUITexture::setOgreTextureSize(uint size)
-{
-    using namespace Ogre;
-
-    // unload any current Ogre::Texture
-    freeOgreTexture();
-
-    // Try to create an empty texture of the given size
-    d_ogre_texture = TextureManager::getSingleton().createManual(getUniqueName(), "General", TEX_TYPE_2D, size, size, 0, PF_A8R8G8B8, TU_DEFAULT);
-
-    // if we got a pointer cache some details
-    if (!d_ogre_texture.isNull())
-    {
-        d_width		= d_ogre_texture->getWidth();
-        d_height	= d_ogre_texture->getHeight();
-    }
-    // no texture so throw.
-    else
-    {
-        throw RendererException((utf8*)"Failed to create texture of specified size: Ogre::Texture creation failed.");
-    }
-
-}
-
-
-/*************************************************************************
-    safely free Ogre::Texture texture (can be called multiple times with
-    no ill effect)
-*************************************************************************/
-void OgreCEGUITexture::freeOgreTexture(void)
-{
-    if ((!d_ogre_texture.isNull()) && !d_isLinked)
-    {
-        Ogre::TextureManager::getSingleton().remove(d_ogre_texture->getHandle());
-    }
-    d_ogre_texture.setNull();
-}
-
-
-/*************************************************************************
-    return a Ogre::string that contains a unique name.	
-*************************************************************************/
-Ogre::String OgreCEGUITexture::getUniqueName(void)
-{
-    Ogre::String str;
-
-#ifdef CEGUI_USEOLDOGRESTRING
-    str << "_cegui_ogre_" << d_texturenumber;
-#else
-    Ogre::StringUtil::StrStreamType strstream;
-    strstream << "_cegui_ogre_" << d_texturenumber;
-    str = strstream.str();
-#endif
-
-    ++d_texturenumber;
-
-    return str;
-}
-
-
-/*************************************************************************
-    Set the internal Ogre::Texture object.
-*************************************************************************/
-void OgreCEGUITexture::setOgreTexture(Ogre::TexturePtr& texture)
-{
-    freeOgreTexture();
-
-    d_ogre_texture = texture;
-    d_width	 = d_ogre_texture->getWidth();
-    d_height = d_ogre_texture->getHeight();
-    d_isLinked = true;
-}
-
-
-} // End of  CEGUI namespace section
-
Index: de/branches/buildsystem3/src/orxonox/gui/OgreCEGUITexture.h
===================================================================
--- /code/branches/buildsystem3/src/orxonox/gui/OgreCEGUITexture.h	(revision 2663)
+++ 	(revision )
@@ -1,179 +1,0 @@
-/************************************************************************
-    filename: 	OgreCEGUITexture.h
-    created:	11/5/2004
-    author:		Paul D Turner
-    
-    purpose:	Interface to Texture implemented via Ogre engine
-*************************************************************************/
-/*************************************************************************
-    Crazy Eddie's GUI System (http://www.cegui.org.uk)
-    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library 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
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*************************************************************************/
-#ifndef _OgreCEGUITexture_H__
-#define _OgreCEGUITexture_H__
-
-#include <CEGUIBase.h>
-#include <CEGUIRenderer.h>
-#include <CEGUITexture.h>
-#include "OgreCEGUIRenderer.h"
-
-// Start of CEGUI namespace section
-namespace CEGUI
-{
-/*!
-\brief
-    Texture class that is created by OgreCEGUIRenderer objects
-*/
-class _OgrePrivate OgreCEGUITexture : public Texture
-{
-private:
-    /*************************************************************************
-        Friends (to allow construction and destruction)
-    *************************************************************************/
-    friend	Texture* OgreCEGUIRenderer::createTexture(void);
-    friend	Texture* OgreCEGUIRenderer::createTexture(const String& filename, const String& resourceGroup);
-    friend	Texture* OgreCEGUIRenderer::createTexture(float size);
-    friend	void	 OgreCEGUIRenderer::destroyTexture(Texture* texture);
-
-
-    /*************************************************************************
-        Construction & Destruction (by Renderer object only)
-    *************************************************************************/
-    OgreCEGUITexture(Renderer* owner);
-    virtual ~OgreCEGUITexture(void);
-
-public:
-    /*!
-    \brief
-        Returns the current pixel width of the texture
-
-    \return
-        ushort value that is the current width of the texture in pixels
-    */
-    virtual	ushort	getWidth(void) const		{return d_width;}
-
-
-    /*!
-    \brief
-        Returns the current pixel height of the texture
-
-    \return
-        ushort value that is the current height of the texture in pixels
-    */
-    virtual	ushort	getHeight(void) const		{return d_height;}
-
-
-    /*!
-    \brief
-        Loads the specified image file into the texture.  The texture is resized as required to hold the image.
-
-    \param filename
-        The filename of the image file that is to be loaded into the texture
-
-    \return
-        Nothing.
-    */
-    virtual void	loadFromFile(const String& filename, const String& resourceGroup);
-
-
-    /*!
-    \brief
-        Loads (copies) an image in memory into the texture.  The texture is resized as required to hold the image.
-    
-    \param buffPtr
-        Pointer to the buffer containing the image data
-    
-    \param buffWidth
-        Width of the buffer (in pixels as specified by \a pixelFormat )
-    
-    \param buffHeight
-        Height of the buffer (in pixels as specified by \a pixelFormat )
-    
-    \param pixelFormat
-    PixelFormat value describing the format contained in \a buffPtr
-    
-    \return
-        Nothing.
-    */
-    virtual void	loadFromMemory(const void* buffPtr, uint buffWidth, uint buffHeight, PixelFormat pixelFormat);
-
-
-    /*!
-    \brief
-        Return a pointer to the internal Ogre::Texture object
-
-    \return
-        Pointer to the Ogre::Texture object currently being used by this Texture object
-    */
-    Ogre::TexturePtr	getOgreTexture(void) const		{return d_ogre_texture;}
-
-
-    /*!
-    \brief
-        set the size of the internal Ogre texture.  Previous Ogre texture is lost.
-
-    \param size
-        pixel size of the new internal texture.  This will be rounded up to a power of 2.
-
-    \return
-        Nothing.
-    */
-    void	setOgreTextureSize(uint size);
-
-
-    /*!
-    \brief
-        Set the internal Ogre::TexturePtr object.
-
-    \param texture
-        Reference to an Ogre::TexturePtr object that is to be used by this Texture object.
-
-    \return
-        Nothing.
-    */
-    void	setOgreTexture(Ogre::TexturePtr& texture);
-
-
-private:
-    /*************************************************************************
-        Implementation Functions
-    *************************************************************************/
-    // safely free Ogre::Texture texture (can be called multiple times with no ill effect)
-    void	freeOgreTexture(void);
-
-    // return a Ogre::string that contains a unique name.
-    Ogre::String	getUniqueName(void);
-
-
-    /*************************************************************************
-        Implementation Data
-    *************************************************************************/
-    static	uint32          d_texturenumber;	//!< Counter used to provide unique texture names.
-
-    Ogre::TexturePtr		d_ogre_texture;		//!< The 'real' texture.
-
-    ushort					d_width;			//!< cached width of the texture
-    ushort					d_height;			//!< cached height of the texture
-
-    bool	d_isLinked;		//!< True if we are linked to a texture we did not actually create.
-};
-
-
-} // End of  CEGUI namespace section
-
-
-#endif	// end of guard _OgreCEGUITexture_H__
Index: /code/branches/buildsystem3/src/orxonox/objects/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/objects/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/objects/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,3 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   EventListener.cc
   EventDispatcher.cc
@@ -14,13 +14,11 @@
 )
 
-ADD_SOURCE_DIRECTORY(SRC_FILES collisionshapes)
-ADD_SOURCE_DIRECTORY(SRC_FILES controllers)
-ADD_SOURCE_DIRECTORY(SRC_FILES gametypes)
-ADD_SOURCE_DIRECTORY(SRC_FILES infos)
-ADD_SOURCE_DIRECTORY(SRC_FILES items)
-ADD_SOURCE_DIRECTORY(SRC_FILES pickup)
-ADD_SOURCE_DIRECTORY(SRC_FILES quest)
-ADD_SOURCE_DIRECTORY(SRC_FILES weaponSystem)
-ADD_SOURCE_DIRECTORY(SRC_FILES worldentities)
+ADD_SUBDIRECTORY(collisionshapes)
+ADD_SUBDIRECTORY(controllers)
+ADD_SUBDIRECTORY(gametypes)
+ADD_SUBDIRECTORY(infos)
+ADD_SUBDIRECTORY(pickup)
+ADD_SUBDIRECTORY(quest)
+ADD_SUBDIRECTORY(weaponSystem)
+ADD_SUBDIRECTORY(worldentities)
 
-ADD_SOURCE_FILES(SRC_FILES)
Index: /code/branches/buildsystem3/src/orxonox/objects/controllers/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/objects/controllers/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/objects/controllers/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,3 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   Controller.cc
   HumanController.cc
@@ -6,4 +6,2 @@
   ScriptController.cc
 )
-
-ADD_SOURCE_FILES(SRC_FILES)
Index: /code/branches/buildsystem3/src/orxonox/objects/gametypes/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/objects/gametypes/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/objects/gametypes/CMakeLists.txt	(revision 2664)
@@ -1,5 +1,3 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   Gametype.cc
 )
-
-ADD_SOURCE_FILES(SRC_FILES)
Index: /code/branches/buildsystem3/src/orxonox/objects/infos/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/objects/infos/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/objects/infos/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,3 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   Bot.cc
   Info.cc
@@ -6,4 +6,2 @@
   GametypeInfo.cc
 )
-
-ADD_SOURCE_FILES(SRC_FILES)
Index: /code/branches/buildsystem3/src/orxonox/objects/pickup/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/objects/pickup/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/objects/pickup/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,3 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   PickupSpawner.cc
   BaseItem.cc
@@ -5,4 +5,2 @@
   ShipEquipment.cc
 )
-
-ADD_SOURCE_FILES(SRC_FILES)
Index: /code/branches/buildsystem3/src/orxonox/objects/quest/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/objects/quest/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/objects/quest/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,3 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   AddQuest.cc
   AddQuestHint.cc
@@ -18,4 +18,2 @@
   Rewardable.cc
 )
-
-ADD_SOURCE_FILES(SRC_FILES)
Index: /code/branches/buildsystem3/src/orxonox/objects/weaponSystem/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/objects/weaponSystem/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/objects/weaponSystem/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,3 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   Munition.cc
   Weapon.cc
@@ -8,7 +8,5 @@
 )
 
-ADD_SOURCE_DIRECTORY(SRC_FILES munitions)
-ADD_SOURCE_DIRECTORY(SRC_FILES projectiles)
-ADD_SOURCE_DIRECTORY(SRC_FILES weapons)
-
-ADD_SOURCE_FILES(SRC_FILES)
+ADD_SUBDIRECTORY(munitions)
+ADD_SUBDIRECTORY(projectiles)
+ADD_SUBDIRECTORY(weapons)
Index: /code/branches/buildsystem3/src/orxonox/objects/weaponSystem/munitions/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/objects/weaponSystem/munitions/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/objects/weaponSystem/munitions/CMakeLists.txt	(revision 2664)
@@ -1,5 +1,3 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   LaserGunMunition.cc
 )
-
-ADD_SOURCE_FILES(SRC_FILES)
Index: /code/branches/buildsystem3/src/orxonox/objects/weaponSystem/projectiles/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/objects/weaponSystem/projectiles/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/objects/weaponSystem/projectiles/CMakeLists.txt	(revision 2664)
@@ -1,7 +1,5 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   BillboardProjectile.cc
   ParticleProjectile.cc
   Projectile.cc
 )
-
-ADD_SOURCE_FILES(SRC_FILES)
Index: /code/branches/buildsystem3/src/orxonox/objects/weaponSystem/weapons/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/objects/weaponSystem/weapons/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/objects/weaponSystem/weapons/CMakeLists.txt	(revision 2664)
@@ -1,7 +1,5 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   Fusion.cc
   LaserGun.cc
 #  Missile.cc
 )
-
-ADD_SOURCE_FILES(SRC_FILES)
Index: /code/branches/buildsystem3/src/orxonox/objects/worldentities/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/objects/worldentities/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/objects/worldentities/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,3 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   WorldEntity.cc
   StaticEntity.cc
@@ -21,6 +21,4 @@
 )
 
-ADD_SOURCE_DIRECTORY(SRC_FILES pawns)
-ADD_SOURCE_DIRECTORY(SRC_FILES triggers)
-
-ADD_SOURCE_FILES(SRC_FILES)
+ADD_SUBDIRECTORY(pawns)
+ADD_SUBDIRECTORY(triggers)
Index: /code/branches/buildsystem3/src/orxonox/objects/worldentities/pawns/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/objects/worldentities/pawns/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/objects/worldentities/pawns/CMakeLists.txt	(revision 2664)
@@ -1,7 +1,5 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   Spectator.cc
   Pawn.cc
   SpaceShip.cc
 )
-
-ADD_SOURCE_FILES(SRC_FILES)
Index: /code/branches/buildsystem3/src/orxonox/objects/worldentities/triggers/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/objects/worldentities/triggers/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/objects/worldentities/triggers/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,3 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   Trigger.cc
   DistanceTrigger.cc
@@ -5,4 +5,2 @@
   PlayerTrigger.cc
 )
-
-ADD_SOURCE_FILES(SRC_FILES)
Index: /code/branches/buildsystem3/src/orxonox/orxonox.vcproj.user
===================================================================
--- /code/branches/buildsystem3/src/orxonox/orxonox.vcproj.user	(revision 2664)
+++ /code/branches/buildsystem3/src/orxonox/orxonox.vcproj.user	(revision 2664)
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioUserFile
+	ProjectType="Visual C++"
+	Version="${VISUAL_STUDIO_VERSION_SIMPLE}.00"
+	ShowAllFiles="false"
+	>
+	<Configurations>
+		<Configuration
+			Name="Debug|${MSVC_PLATFORM}"
+			>
+			<DebugSettings
+				WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
+				Environment="Path=${ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"
+				EnvironmentMerge="true"
+			/>
+		</Configuration>
+		<Configuration
+			Name="Release|${MSVC_PLATFORM}"
+			>
+			<DebugSettings
+				WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
+				Environment="Path=${ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"
+				EnvironmentMerge="true"
+			/>
+		</Configuration>
+		<Configuration
+			Name="MinSizeRel|${MSVC_PLATFORM}"
+			>
+			<DebugSettings
+				WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
+				Environment="Path=${ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"
+				EnvironmentMerge="true"
+			/>
+		</Configuration>
+		<Configuration
+			Name="RelWithDebInfo|${MSVC_PLATFORM}"
+			>
+			<DebugSettings
+				WorkingDirectory="${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$(OutDir)"
+				Environment="Path=${ORXONOX_RUNTIME_LIBRARY_DIRECTORY}"
+				EnvironmentMerge="true"
+			/>
+		</Configuration>
+	</Configurations>
+</VisualStudioUserFile>
Index: /code/branches/buildsystem3/src/orxonox/overlays/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/overlays/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/overlays/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,3 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   OrxonoxOverlay.cc
   OverlayGroup.cc
@@ -5,9 +5,8 @@
 )
 
-ADD_SOURCE_DIRECTORY(SRC_FILES console)
-ADD_SOURCE_DIRECTORY(SRC_FILES debug)
-ADD_SOURCE_DIRECTORY(SRC_FILES hud)
-ADD_SOURCE_DIRECTORY(SRC_FILES notifications)
-ADD_SOURCE_DIRECTORY(SRC_FILES stats)
+ADD_SUBDIRECTORY(console)
+ADD_SUBDIRECTORY(debug)
+ADD_SUBDIRECTORY(hud)
+ADD_SUBDIRECTORY(notifications)
+ADD_SUBDIRECTORY(stats)
 
-ADD_SOURCE_FILES(SRC_FILES)
Index: /code/branches/buildsystem3/src/orxonox/overlays/console/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/overlays/console/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/overlays/console/CMakeLists.txt	(revision 2664)
@@ -1,5 +1,3 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   InGameConsole.cc
 )
-
-ADD_SOURCE_FILES(SRC_FILES)
Index: /code/branches/buildsystem3/src/orxonox/overlays/debug/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/overlays/debug/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/overlays/debug/CMakeLists.txt	(revision 2664)
@@ -1,6 +1,4 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   DebugFPSText.cc
   DebugRTRText.cc
 )
-
-ADD_SOURCE_FILES(SRC_FILES)
Index: /code/branches/buildsystem3/src/orxonox/overlays/hud/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/overlays/hud/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/overlays/hud/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,3 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   HUDBar.cc
   HUDNavigation.cc
@@ -8,4 +8,2 @@
   GametypeStatus.cc
 )
-
-ADD_SOURCE_FILES(SRC_FILES)
Index: /code/branches/buildsystem3/src/orxonox/overlays/hud/HUDBar.cc
===================================================================
--- /code/branches/buildsystem3/src/orxonox/overlays/hud/HUDBar.cc	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/overlays/hud/HUDBar.cc	(revision 2664)
@@ -117,6 +117,8 @@
             if (this->colours_.size() > 0)
             {
-                ColourValue colour1, colour2 = (*this->colours_.rbegin()).second;
-                float value1, value2 = (*this->colours_.rbegin()).first;
+                ColourValue colour1(0, 0, 0, 1);
+                ColourValue colour2 = (*this->colours_.rbegin()).second;
+                float value1(0);
+                float value2 = (*this->colours_.rbegin()).first;
                 for (std::map<float, ColourValue>::reverse_iterator it = this->colours_.rbegin(); it != this->colours_.rend(); ++it)
                 {
Index: /code/branches/buildsystem3/src/orxonox/pch/havepch/OrxonoxStableHeaders.h
===================================================================
--- /code/branches/buildsystem3/src/orxonox/pch/havepch/OrxonoxStableHeaders.h	(revision 2664)
+++ /code/branches/buildsystem3/src/orxonox/pch/havepch/OrxonoxStableHeaders.h	(revision 2664)
@@ -0,0 +1,104 @@
+/*
+ *   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
+ @brief Contains the frequently used header files of our own writing
+ */
+
+#ifndef _OrxonoxStableHeaders_H__
+#define _OrxonoxStableHeaders_H__
+
+#include "util/OrxonoxPlatform.h"
+
+#if defined(ORXONOX_ENABLE_PCH)
+
+// including std headers here is useless since they're already precompiled
+
+#ifndef WIN32_LEAN_AND_MEAN
+// prevent Ogre from including winsock.h that messes with winsock2.h from enet
+#  define WIN32_LEAN_AND_MEAN
+#endif
+#include <Ogre.h>
+#include <CEGUI.h>
+#include "ois/OIS.h"
+#include <boost/thread/recursive_mutex.hpp>
+//#include <boost/thread/mutex.hpp>
+//#include <boost/thread/condition.hpp>
+//#include <boost/thread/thread.hpp>
+#include <boost/static_assert.hpp>
+#include <ticpp.h>
+#include <tolua++.h>
+
+//Get around Windows hackery (windows.h is included by Ogre.h)
+#ifdef ORXONOX_PLATFORM_WINDOWS 
+#  ifdef max
+#    undef max
+#  endif
+#  ifdef min
+#    undef min
+#  endif
+#endif
+
+//----------- Our files ----------
+//--------------------------------
+//// only include when not debugging so that we may find issues with missing headers quicker
+//#if defined(NDEBUG)
+
+#include "util/Convert.h"
+#include "util/Debug.h"
+#include "util/Exception.h"
+#include "util/Math.h"
+#include "util/Multitype.h"
+#include "util/Sleep.h"
+#include "util/String.h"
+#include "util/SubString.h"
+
+#include "core/BaseObject.h"
+#include "core/ConsoleCommand.h"
+#include "core/CoreIncludes.h"
+#include "core/ConfigValueIncludes.h"
+#include "core/CommandExecutor.h"
+#include "core/Core.h"
+#include "core/Executor.h"
+#include "core/ObjectList.h"
+#include "core/Super.h"
+#include "core/XMLIncludes.h"
+#include "core/XMLPort.h"
+#include "core/input/SimpleInputState.h"
+#include "core/input/InputManager.h"
+
+#include "network/Synchronisable.h"
+
+#include "Settings.h"
+
+//#endif /* ifdef NDEBUG */
+
+#endif /* defined(ORXONOX_ENABLE_PCH) */
+
+#endif /* _OrxonoxStableHeaders_H__ */
Index: /code/branches/buildsystem3/src/orxonox/pch/havepch/PrecompiledHeaderFiles.cc
===================================================================
--- /code/branches/buildsystem3/src/orxonox/pch/havepch/PrecompiledHeaderFiles.cc	(revision 2664)
+++ /code/branches/buildsystem3/src/orxonox/pch/havepch/PrecompiledHeaderFiles.cc	(revision 2664)
@@ -0,0 +1,34 @@
+/*
+ *   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
+ @brief This file actually generates the precompiled header file
+ */
+
+#include "OrxonoxStableHeaders.h"
Index: /code/branches/buildsystem3/src/orxonox/pch/nopch/OrxonoxStableHeaders.h
===================================================================
--- /code/branches/buildsystem3/src/orxonox/pch/nopch/OrxonoxStableHeaders.h	(revision 2664)
+++ /code/branches/buildsystem3/src/orxonox/pch/nopch/OrxonoxStableHeaders.h	(revision 2664)
@@ -0,0 +1,39 @@
+/*
+ *   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
+ @brief Contains nothing. Used as dummy file when not having precompiled header files.
+ */
+
+#ifndef _OrxonoxStableHeaders_H__
+#define _OrxonoxStableHeaders_H__
+
+#include "OrxonoxConfig.h"
+
+#endif /* _OrxonoxStableHeaders_H__ */
Index: /code/branches/buildsystem3/src/orxonox/tools/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/orxonox/tools/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/orxonox/tools/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,3 @@
-SET( SRC_FILES
+ADD_SOURCE_FILES(ORXONOX_SRC_FILES
   BillboardSet.cc
   Mesh.cc
@@ -8,4 +8,2 @@
   WindowEventListener.cc
 )
-
-ADD_SOURCE_FILES(SRC_FILES)
Index: /code/branches/buildsystem3/src/tinyxml/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/tinyxml/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/tinyxml/CMakeLists.txt	(revision 2664)
@@ -1,9 +1,39 @@
-SET( TINYXML_SRC_FILES
-  ticpp.cc
-  tinystr.cc
-  tinyxml.cc
-  tinyxmlerror.cc
-  tinyxmlparser.cc
+ #
+ #             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.
+ #
+
+SET(TINYXML++_FILES
+  ticpp.h
+  ticpprc.h
+  tinystr.h
+  tinyxml.h
+
+  ticpp.cpp
+  tinystr.cpp
+  tinyxml.cpp
+  tinyxmlerror.cpp
+  tinyxmlparser.cpp
 )
+GENERATE_SOURCE_GROUPS(${TINYXML++_FILES})
 
-ADD_LIBRARY(tinyxml_orxonox SHARED ${TINYXML_SRC_FILES})
+IF(MSVC)
+  ADD_LIBRARY(tinyxml++_orxonox STATIC ${TINYXML++_FILES})
+ELSE()
+  ADD_LIBRARY(tinyxml++_orxonox SHARED ${TINYXML++_FILES})
+  ORXONOX_INSTALL(tinyxml++_orxonox)
+ENDIF()
Index: /code/branches/buildsystem3/src/tinyxml/VERSION
===================================================================
--- /code/branches/buildsystem3/src/tinyxml/VERSION	(revision 2664)
+++ /code/branches/buildsystem3/src/tinyxml/VERSION	(revision 2664)
@@ -0,0 +1,1 @@
+TinyXML++ trunk checkout revision 98.
Index: /code/branches/buildsystem3/src/tinyxml/changes.txt
===================================================================
--- /code/branches/buildsystem3/src/tinyxml/changes.txt	(revision 2664)
+++ /code/branches/buildsystem3/src/tinyxml/changes.txt	(revision 2664)
@@ -0,0 +1,269 @@
+Changes in version 1.0.1:
+- Fixed comment tags which were outputing as '<?--' instead of 
+  the correct '<!--'.
+- Implemented the Next and Prev methods of the TiXmlAttribute class.
+- Renamed 'LastAttribtute' to 'LastAttribute'
+- Fixed bad pointer to 'isspace' that could occur while parsing text.
+- Errors finding beginning and end of tags no longer throw it into an
+  infinite loop. (Hopefully.)
+
+Changes in version 1.0.2
+- Minor documentation fixes.
+
+Changes in version 1.0.3
+- After nodes are added to a document, they return a pointer
+  to the new node instead of a bool for success.
+- Elements can be constructed with a value, which is the
+  element name. Every element must have a value or it will be
+  invalid, but the code changes to enforce this are not fully
+  in place.
+
+Changes in version 1.1.0
+- Added the	TiXmlAttributeSet class to pull the attributes into
+  a seperate container.
+- Moved the doubly liked list out of XmlBase. Now XmlBase only
+  requires the Print() function and defines some utility functions.
+- Moved errors into a seperate file. (With the idea of internationalization
+  to the other latin-1 languages.)
+- Added the "NodeType"
+- Fixed white space parsing in text to conform with the standard. 
+  Basically, all white space becomes just one space.
+- Added the TiXmlDeclaration class to read xml declarations.
+
+Changes in version 1.2.0
+- Removed the factory. The factory was not really in the spirit 
+  of small and simple, confused the code, and was of limited value.
+- Added FirstChildElement and NextSiblingElement, because they
+  are such common functions.
+- Re-wrote the example to test and demonstrate more functionality.
+
+Changes in version 1.2.1
+- Fixed a bug where comments couldn't be inside elements.
+- Loading now clears out existing XML rather than appending.
+- Added the "Clear" method on a node to delete all its children.
+
+Changes in version 1.2.2
+- Fixed TiXmlAttribute::Previous actually returning "next." Thanks
+  to Rickard Troedsson for the bug fix.
+
+Changes in version 1.2.3
+- Added the TIXML prefix to the error strings to resolve conflicts
+  with #defines in OS headers. Thanks to Steve Lhomme.
+- Fixed a delete buf that should be a delete [] buf. 
+  Thanks to Ephi Sinowitz.
+
+Changes in version 1.2.4
+- ReplaceChild() was almost guarenteed to fail. Should be fixed,
+  thanks to Joe Smith. Joe also pointed out that the Print() functions
+  should take stream references: I agree, and would like to overload
+  the Print() method to take either format, but I don't want to do 
+  this in a dot release.
+- Some compilers seem to need an extra <ctype.h> include. Thanks
+  to Steve Lhomme for that.
+
+Changes in version 2.0.0 BETA
+- Made the ToXXX() casts safe if 'this' is null. 
+  When "LoadFile" is called with a filename, the value will correctly get set.
+  Thanks to Brian Yoder.
+- Fixed bug where isalpha() and isalnum() would get called with a negative value for 
+  high ascii numbers. Thanks to Alesky Aksenov.
+- Fixed some errors codes that were not getting set.
+- Made methods "const" that were not.
+- Added a switch to enable or disable the ignoring of white space. ( TiXmlDocument::SetIgnoreWhiteSpace() )
+- Greater standardization and code re-use in the parser.
+- Added a stream out operator.
+- Added a stream in operator.
+- Entity support, of predefined entites. &#x entities are untouched by input or output.
+- Improved text out formatting.
+- Fixed ReplaceChild bug, thanks to Tao Chen.
+
+Changes in version 2.0.1
+- Fixed hanging on loading a 0 length file. Thanks to Jeff Scozzafava.
+- Fixed crashing on InsertBeforeChild and InsertAfterChild. Also possibility of bad links being
+  created by same function. Thanks to Frank De prins.
+- Added missing licence text. Thanks to Lars Willemsens.
+- Added <ctype.h> include, at the suggestion of Steve Walters.
+
+Changes in version 2.1.0
+- Yves Berquin brings us the STL switch. The forum on SourceForge, and various emails to
+  me, have long debated all out STL vs. no STL at all. And now you can have it both ways.
+  TinyXml will compile either way.
+
+Changes in version 2.1.1
+- Compilation warnings.
+
+Changes in version 2.1.2
+- Uneeded code is not compiled in the STL case.
+- Changed headers so that STL can be turned on or off in tinyxml.h
+
+Changes in version 2.1.3
+- Fixed non-const reference in API; now uses a pointer.
+- Copy constructor of TiXmlString not checking for assignment to self.
+- Nimrod Cohen found a truly evil bug in the STL implementation that occurs
+  when a string is converted to a c_str and then assigned to self. Search for
+  STL_STRING_BUG for a full description. I'm asserting this is a Microsoft STL
+  bug, since &string and string.c_str() should never be the same. Nevertheless,
+  the code works around it.
+- Urivan Saaib pointed out a compiler conflict, where the C headers define
+  the isblank macro, which was wiping out the TiXmlString::isblank() method.
+  The method was unused and has been removed.
+
+Changes in version 2.1.4
+- Reworked the entity code. Entities were not correctly surving round trip input and output.
+  Will now automatically create entities for high ascii in output.
+
+Changes in version 2.1.5
+- Bug fix by kylotan : infinite loop on some input (tinyxmlparser.cpp rev 1.27)
+- Contributed by Ivica Aracic (bytelord) : 1 new VC++ project to compile versions as static libraries (tinyxml_lib.dsp), 
+  and an example usage in xmltest.dsp
+  (Patch request ID 678605)
+- A suggestion by Ronald Fenner Jr (dormlock) to add #include <istream> and <ostream> for Apple's Project Builder 
+  (Patch request ID 697642)
+- A patch from ohommes that allows to parse correctly dots in element names and attribute names
+  (Patch request 602600 and kylotan 701728)
+- A patch from  hermitgeek ( James ) and wasteland for improper error reporting
+- Reviewed by Lee, with the following changes:
+	- Got sick of fighting the STL/non-STL thing in the windows build. Broke
+	  them out as seperate projects.
+	- I have too long not included the dsw. Added.
+	- TinyXmlText had a protected Print. Odd.
+	- Made LinkEndChild public, with docs and appropriate warnings.
+	- Updated the docs.
+
+2.2.0
+- Fixed an uninitialized pointer in the TiXmlAttributes
+- Fixed STL compilation problem in MinGW (and gcc 3?) - thanks Brian Yoder for finding this one
+- Fixed a syntax error in TiXmlDeclaration - thanks Brian Yoder
+- Fletcher Dunn proposed and submitted new error handling that tracked the row and column. Lee
+  modified it to not have performance impact.
+- General cleanup suggestions from Fletcher Dunn.
+- In error handling, general errors will no longer clear the error state of specific ones.
+- Fix error in documentation : comments starting with "<?--" instead of "<!--" (thanks ion_pulse)
+- Added the TiXmlHandle. An easy, safe way to browse XML DOMs with less code.
+- Added QueryAttribute calls which have better error messaging. (Proposed by Fletcher Dunn)
+- Nodes and attributes can now print themselves to strings. (Yves suggestion)
+- Fixed bug where entities with one character would confuse parser. (Thanks Roman)
+
+2.2.1
+- Additional testing (no more bugs found to be fixed in this release)
+- Significant performance improvement to the cursor code.
+
+2.3.0
+- User Data are now defined in TiXmlBase instead of TiXmlNode
+- Character Entities are now UCS-2
+- Character Entities can be decimal or hexadecimal
+- UTF-8 conversion.
+- Fixed many, many bugs.
+
+2.3.1
+- Fixed bug in handling nulls embedded in the input.
+- Make UTF-8 parser tolerant of bad text encoding.
+- Added encoding detection. 
+- Many fixes and input from John-Philip Leonard Johansson (JP) and Ellers, 
+  including UTF-8 feedback, bug reports, and patches. Thanks!
+- Added version # constants - a suggestion from JP and Ellers.
+- [ 979180 ] Missing ; in entity reference, fix from Rob Laveaux.
+- Copy constructors and assignment have been a long time coming. Thanks to
+  Fokke and JP.
+
+2.3.2
+- Made the IsAlpha and IsAlphaNum much more tolerant of non-UTF-8 encodings. Thanks
+  Volker Boerchers for finding the issue.
+- Ran the program though the magnificent Valgrind - http://valgrind.kde.org - to check
+  for memory errors. Fixed some minor issues.
+
+2.3.3
+- Fixed crash when test program was run from incorrect directory.
+- Fixed bug 1070717 - empty document not returned correctly - thanks Katsuhisa Yuasa.
+- Bug 1079301 resolved - deprecated stdlib calls. Thanks Adrian Boeing.
+- Bug 1035218 fixed - documentation errors. Xunji Luo
+- Other bug fixes have accumulated and been fixed on the way as well; my apologies to
+  authors not credited!
+- Big fix / addition is to correctly return const values. TinyXml could basically
+  remove const in a method like this: TiXmlElement* Foo() const, where the returned element
+  was a pointer to internal data. That is now: const TiXmlElement* Foo() const and
+  TiXmlElement* Foo().
+
+2.3.4
+- Fixed additional const errors, thanks Kent Gibson.
+- Correctly re-enable warnings after tinyxml header. Thanks Cory Nelson.
+- Variety of type cleanup and warning fixes. Thanks Warren Stevens.
+- Cleaned up unneeded constructor calls in TinyString - thanks to Geoff Carlton and
+  the discussion group on sourceforge.
+
+2.4.0
+- Improved string class, thanks Tyge Lovset (whose name gets mangled in English - sorry)
+- Type cast compiler warning, thanks Rob van den Bogaard
+- Added GetText() convenience function. Thanks Ilya Parniuk & Andrew Ellers for input.
+- Many thanks to marlonism for finding an infinite loop in bad xml.
+- A patch to cleanup warnings from Robert Gebis.
+- Added ValueStr() to get the value of a node as a string.
+- TiXmlText can now parse and output as CDATA
+- Additional string improvement from James (z2895)
+- Removed extraneous 'const', thanks David Aldrich
+- First pass at switching to the "safe" stdlib functions. Many people have suggested and
+  pushed on this, but Warren Stevens put together the first proposal.
+- TinyXml now will do EOL normalization before parsing, consistent with the W3C XML spec.
+- Documents loaded with the UTF-8 BOM will now save with the UTF-8 BOM. Good suggestion 
+  from 'instructor_'
+- Ellers submitted his very popular tutorials, which have been added to the distribution.
+
+2.4.1
+- Fixed CDATA output formatting
+- Fixed memory allocators in TinyString to work with overloaded new/delete
+
+2.4.2
+- solosnake pointed out that TIXML_LOG causes problems on an XBOX. The definition in the header
+  was superflous and was moved inside of DEBUG_PARSING
+
+2.4.3
+- Fixed a test bug that caused a crash in 'xmltest'. TinyXML was fine, but it isn't good
+  to ship with a broken test suite.
+- Started converting some functions to not cast between std::string and const char* 
+  quite as often.
+- Added FILE* versions of the document loads - good suggestion from Wade Brainerd
+- Empty documents might not always return the errors they should. [1398915] Thanks to igor v.
+- Added some asserts for multiply adding a node, regardng bug [1391937] suggested by Paco Arjonilla.
+
+2.4.4
+- Bug find thanks to andre-gross found a memory leak that occured when a document failed to load.
+- Bug find (and good analysis) by VirtualJim who found a case where attribute parsing 
+  should be throwing an error and wasn't.
+- Steve Hyatt suggested the QueryValueAttribute method, which is now implemented.
+- DavidA identified a chunk of dead code.
+- Andrew Baxter sent in some compiler warnings that were good clean up points.
+
+2.5
+- Added the Visit() API. Many thanks to both Andrew Ellerton and John-Philip for all their
+  work, code, suggestion, and just general pushing that it should be done.
+- Removed existing streaming code and use TiXmlPrinter instead.
+- [ tinyxml-Bugs-1527079 ] Compile error in tinystr.cpp fixed, thanks to Paul Suggs
+- [ tinyxml-Bugs-1522890 ] SaveFile has no error checks fixed, thanks to Ivan Dobrokotov
+- Ivan Dobrokotov also reported redundant memory allocation in the Attribute() method, which
+  upon investigation was a mess. The attribute should now be fixed for both const char* and 
+  std::string, and the return types match the input parameters.
+- Feature [ 1511105 ] Make TiXmlComment constructor accept a string / char*, implemented.
+  Thanks to Karl Itschen for the feedback.
+- [ 1480108 ] Stream parsing fails when CDATA contains tags was found by Tobias Grimm, who also
+  submitted a test case and patch. A significant bug in CDATA streaming (operator>>) has now
+  been fixed.
+
+2.5.2
+- Lieven, and others, pointed out a missing const-cast that upset the Open Watcom compiler.
+  Should now be fixed.
+- ErrorRow and ErrorCol should have been const, and weren't. Fixed thanks to Dmitry Polutov.
+
+2.5.3
+- zloe_zlo identified a missing string specialization for QueryValueAttribute() [ 1695429 ]. Worked
+  on this bug, but not sure how to fix it in a safe, cross-compiler way.
+- increased warning level to 4 and turned on detect 64 bit portability issues for VC2005.
+  May address [ 1677737 ] VS2005: /Wp64 warnings
+- grosheck identified several problems with the Document copy. Many thanks for [ 1660367 ]
+- Nice catch, and suggested fix, be Gilad Novik on the Printer dropping entities.
+  "[ 1600650 ] Bug when printing xml text" is now fixed.
+- A subtle fix from Nicos Gollan in the tinystring initializer: 
+  [ 1581449 ] Fix initialiser of TiXmlString::nullrep_
+- Great catch, although there isn't a submitter for the bug. [ 1475201 ] TinyXML parses entities in comments. 
+  Comments should not, in fact, parse entities. Fixed the code path and added tests.
+- We were not catching all the returns from ftell. Thanks to Bernard for catching that.
+  
Index: /code/branches/buildsystem3/src/tinyxml/changes_orxonox.diff
===================================================================
--- /code/branches/buildsystem3/src/tinyxml/changes_orxonox.diff	(revision 2664)
+++ /code/branches/buildsystem3/src/tinyxml/changes_orxonox.diff	(revision 2664)
@@ -0,0 +1,18 @@
+--- ticpp.h	Tue Nov  4 21:55:49 2008
++++ ticpp.h	Sat Jan 10 14:48:41 2009
+@@ -1229,6 +1229,7 @@
+ 
+ 		T* m_tiXmlPointer;		/**< Internal pointer to the TiXml Class which is being wrapped */
+ 
++    public:
+ 		/**
+ 		@internal
+ 		Gets the internal TinyXML pointer.
+@@ -1240,6 +1241,7 @@
+ 			ValidatePointer();
+ 			return m_tiXmlPointer;
+ 		}
++    protected:
+ 
+ 		/**
+ 		@internal
Index: /code/branches/buildsystem3/src/tinyxml/readme.txt
===================================================================
--- /code/branches/buildsystem3/src/tinyxml/readme.txt	(revision 2664)
+++ /code/branches/buildsystem3/src/tinyxml/readme.txt	(revision 2664)
@@ -0,0 +1,531 @@
+/** @mainpage
+
+<h1> TinyXML </h1>
+
+TinyXML is a simple, small, C++ XML parser that can be easily 
+integrated into other programs.
+
+<h2> What it does. </h2>
+	
+In brief, TinyXML parses an XML document, and builds from that a 
+Document Object Model (DOM) that can be read, modified, and saved.
+
+XML stands for "eXtensible Markup Language." It allows you to create 
+your own document markups. Where HTML does a very good job of marking 
+documents for browsers, XML allows you to define any kind of document 
+markup, for example a document that describes a "to do" list for an 
+organizer application. XML is a very structured and convenient format.
+All those random file formats created to store application data can 
+all be replaced with XML. One parser for everything.
+
+The best place for the complete, correct, and quite frankly hard to
+read spec is at <a href="http://www.w3.org/TR/2004/REC-xml-20040204/">
+http://www.w3.org/TR/2004/REC-xml-20040204/</a>. An intro to XML
+(that I really like) can be found at 
+<a href="http://skew.org/xml/tutorial/">http://skew.org/xml/tutorial</a>.
+
+There are different ways to access and interact with XML data.
+TinyXML uses a Document Object Model (DOM), meaning the XML data is parsed
+into a C++ objects that can be browsed and manipulated, and then 
+written to disk or another output stream. You can also construct an XML document 
+from scratch with C++ objects and write this to disk or another output
+stream.
+
+TinyXML is designed to be easy and fast to learn. It is two headers 
+and four cpp files. Simply add these to your project and off you go. 
+There is an example file - xmltest.cpp - to get you started. 
+
+TinyXML is released under the ZLib license, 
+so you can use it in open source or commercial code. The details
+of the license are at the top of every source file.
+
+TinyXML attempts to be a flexible parser, but with truly correct and
+compliant XML output. TinyXML should compile on any reasonably C++
+compliant system. It does not rely on exceptions or RTTI. It can be 
+compiled with or without STL support. TinyXML fully supports
+the UTF-8 encoding, and the first 64k character entities.
+
+
+<h2> What it doesn't do. </h2>
+
+TinyXML doesn't parse or use DTDs (Document Type Definitions) or XSLs
+(eXtensible Stylesheet Language.) There are other parsers out there 
+(check out www.sourceforge.org, search for XML) that are much more fully
+featured. But they are also much bigger, take longer to set up in
+your project, have a higher learning curve, and often have a more
+restrictive license. If you are working with browsers or have more
+complete XML needs, TinyXML is not the parser for you.
+
+The following DTD syntax will not parse at this time in TinyXML:
+
+@verbatim
+	<!DOCTYPE Archiv [
+	 <!ELEMENT Comment (#PCDATA)>
+	]>
+@endverbatim
+
+because TinyXML sees this as a !DOCTYPE node with an illegally 
+embedded !ELEMENT node. This may be addressed in the future.
+
+<h2> Tutorials. </h2>
+
+For the impatient, here are some tutorials to get you going. A great way to get started, 
+but it is worth your time to read this (very short) manual completely.
+
+- @subpage ticppTutorial
+- @subpage tutorial0
+
+<h2> Code Status.  </h2>
+
+TinyXML is mature, tested code. It is very stable. If you find
+bugs, please file a bug report on the sourceforge web site
+(www.sourceforge.net/projects/tinyxml). We'll get them straightened 
+out as soon as possible.
+
+There are some areas of improvement; please check sourceforge if you are
+interested in working on TinyXML.
+
+<h2> Related Projects </h2>
+
+TinyXML projects you may find useful! (Descriptions provided by the projects.)
+
+<ul>
+<li> <b>TinyXPath</b> (http://tinyxpath.sourceforge.net). TinyXPath is a small footprint 
+     XPath syntax decoder, written in C++.</li>
+<li> <b>@subpage ticpp</b> (http://code.google.com/p/ticpp/). TinyXML++ is a completely new 
+     interface to TinyXML that uses MANY of the C++ strengths. Templates, 
+	 exceptions, and much better error handling.</li>
+</ul>
+
+<h2> Features </h2>
+
+<h3> Using STL </h3>
+
+TinyXML can be compiled to use or not use STL. When using STL, TinyXML
+uses the std::string class, and fully supports std::istream, std::ostream,
+operator<<, and operator>>. Many API methods have both 'const char*' and
+'const std::string&' forms.
+
+When STL support is compiled out, no STL files are included whatsoever. All
+the string classes are implemented by TinyXML itself. API methods
+all use the 'const char*' form for input.
+
+Use the compile time #define:
+
+	TIXML_USE_STL
+
+to compile one version or the other. This can be passed by the compiler,
+or set as the first line of "tinyxml.h".
+
+Note: If compiling the test code in Linux, setting the environment
+variable TINYXML_USE_STL=YES/NO will control STL compilation. In the
+Windows project file, STL and non STL targets are provided. In your project,
+It's probably easiest to add the line "#define TIXML_USE_STL" as the first
+line of tinyxml.h.
+
+<h3> UTF-8 </h3>
+
+TinyXML supports UTF-8 allowing to manipulate XML files in any language. TinyXML
+also supports "legacy mode" - the encoding used before UTF-8 support and
+probably best described as "extended ascii".
+
+Normally, TinyXML will try to detect the correct encoding and use it. However,
+by setting the value of TIXML_DEFAULT_ENCODING in the header file, TinyXML
+can be forced to always use one encoding.
+
+TinyXML will assume Legacy Mode until one of the following occurs:
+<ol>
+	<li> If the non-standard but common "UTF-8 lead bytes" (0xef 0xbb 0xbf)
+		 begin the file or data stream, TinyXML will read it as UTF-8. </li>
+	<li> If the declaration tag is read, and it has an encoding="UTF-8", then
+		 TinyXML will read it as UTF-8. </li>
+	<li> If the declaration tag is read, and it has no encoding specified, then TinyXML will 
+		 read it as UTF-8. </li>
+	<li> If the declaration tag is read, and it has an encoding="something else", then TinyXML 
+		 will read it as Legacy Mode. In legacy mode, TinyXML will work as it did before. It's 
+		 not clear what that mode does exactly, but old content should keep working.</li>
+	<li> Until one of the above criteria is met, TinyXML runs in Legacy Mode.</li>
+</ol>
+
+What happens if the encoding is incorrectly set or detected? TinyXML will try
+to read and pass through text seen as improperly encoded. You may get some strange results or 
+mangled characters. You may want to force TinyXML to the correct mode.
+
+You may force TinyXML to Legacy Mode by using LoadFile( TIXML_ENCODING_LEGACY ) or
+LoadFile( filename, TIXML_ENCODING_LEGACY ). You may force it to use legacy mode all
+the time by setting TIXML_DEFAULT_ENCODING = TIXML_ENCODING_LEGACY. Likewise, you may 
+force it to TIXML_ENCODING_UTF8 with the same technique.
+
+For English users, using English XML, UTF-8 is the same as low-ASCII. You
+don't need to be aware of UTF-8 or change your code in any way. You can think
+of UTF-8 as a "superset" of ASCII.
+
+UTF-8 is not a double byte format - but it is a standard encoding of Unicode!
+TinyXML does not use or directly support wchar, TCHAR, or Microsoft's _UNICODE at this time. 
+It is common to see the term "Unicode" improperly refer to UTF-16, a wide byte encoding
+of unicode. This is a source of confusion.
+
+For "high-ascii" languages - everything not English, pretty much - TinyXML can
+handle all languages, at the same time, as long as the XML is encoded
+in UTF-8. That can be a little tricky, older programs and operating systems
+tend to use the "default" or "traditional" code page. Many apps (and almost all
+modern ones) can output UTF-8, but older or stubborn (or just broken) ones
+still output text in the default code page. 
+
+For example, Japanese systems traditionally use SHIFT-JIS encoding. 
+Text encoded as SHIFT-JIS can not be read by TinyXML. 
+A good text editor can import SHIFT-JIS and then save as UTF-8.
+
+The <a href="http://skew.org/xml/tutorial/">Skew.org link</a> does a great
+job covering the encoding issue.
+
+The test file "utf8test.xml" is an XML containing English, Spanish, Russian,
+and Simplified Chinese. (Hopefully they are translated correctly). The file
+"utf8test.gif" is a screen capture of the XML file, rendered in IE. Note that
+if you don't have the correct fonts (Simplified Chinese or Russian) on your
+system, you won't see output that matches the GIF file even if you can parse
+it correctly. Also note that (at least on my Windows machine) console output
+is in a Western code page, so that Print() or printf() cannot correctly display
+the file. This is not a bug in TinyXML - just an OS issue. No data is lost or 
+destroyed by TinyXML. The console just doesn't render UTF-8.
+
+
+<h3> Entities </h3>
+TinyXML recognizes the pre-defined "character entities", meaning special
+characters. Namely:
+
+@verbatim
+	&amp;	&
+	&lt;	<
+	&gt;	>
+	&quot;	"
+	&apos;	'
+@endverbatim
+
+These are recognized when the XML document is read, and translated to there
+UTF-8 equivalents. For instance, text with the XML of:
+
+@verbatim
+	Far &amp; Away
+@endverbatim
+
+will have the Value() of "Far & Away" when queried from the TiXmlText object,
+and will be written back to the XML stream/file as an ampersand. Older versions
+of TinyXML "preserved" character entities, but the newer versions will translate
+them into characters.
+
+Additionally, any character can be specified by its Unicode code point:
+The syntax "&#xA0;" or "&#160;" are both to the non-breaking space characher.
+
+<h3> Printing </h3>
+TinyXML can print output in several different ways that all have strengths and limitations.
+
+- Print( FILE* ). Output to a std-C stream, which includes all C files as well as stdout.
+	- "Pretty prints", but you don't have control over printing options.
+	- The output is streamed directly to the FILE object, so there is no memory overhead
+	  in the TinyXML code.
+	- used by Print() and SaveFile()
+
+- operator<<. Output to a c++ stream.
+	- Integrates with standart C++ iostreams.
+	- Outputs in "network printing" mode without line breaks. Good for network transmission
+	  and moving XML between C++ objects, but hard for a human to read.
+
+- TiXmlPrinter. Output to a std::string or memory buffer.
+	- API is less concise
+	- Future printing options will be put here.
+	- Printing may change slightly in future versions as it is refined and expanded.
+
+<h3> Streams </h3>
+With TIXML_USE_STL on TinyXML supports C++ streams (operator <<,>>) streams as well
+as C (FILE*) streams. There are some differences that you may need to be aware of.
+
+C style output:
+	- based on FILE*
+	- the Print() and SaveFile() methods
+
+	Generates formatted output, with plenty of white space, intended to be as 
+	human-readable as possible. They are very fast, and tolerant of ill formed 
+	XML documents. For example, an XML document that contains 2 root elements 
+	and 2 declarations, will still print.
+
+C style input:
+	- based on FILE*
+	- the Parse() and LoadFile() methods
+
+	A fast, tolerant read. Use whenever you don't need the C++ streams.
+
+C++ style output:
+	- based on std::ostream
+	- operator<<
+
+	Generates condensed output, intended for network transmission rather than
+	readability. Depending on your system's implementation of the ostream class,
+	these may be somewhat slower. (Or may not.) Not tolerant of ill formed XML:
+	a document should contain the correct one root element. Additional root level
+	elements will not be streamed out.
+
+C++ style input:
+	- based on std::istream
+	- operator>>
+
+	Reads XML from a stream, making it useful for network transmission. The tricky
+	part is knowing when the XML document is complete, since there will almost
+	certainly be other data in the stream. TinyXML will assume the XML data is
+	complete after it reads the root element. Put another way, documents that
+	are ill-constructed with more than one root element will not read correctly.
+	Also note that operator>> is somewhat slower than Parse, due to both 
+	implementation of the STL and limitations of TinyXML.
+
+<h3> White space </h3>
+The world simply does not agree on whether white space should be kept, or condensed.
+For example, pretend the '_' is a space, and look at "Hello____world". HTML, and 
+at least some XML parsers, will interpret this as "Hello_world". They condense white
+space. Some XML parsers do not, and will leave it as "Hello____world". (Remember
+to keep pretending the _ is a space.) Others suggest that __Hello___world__ should become
+Hello___world.
+
+It's an issue that hasn't been resolved to my satisfaction. TinyXML supports the
+first 2 approaches. Call TiXmlBase::SetCondenseWhiteSpace( bool ) to set the desired behavior.
+The default is to condense white space.
+
+If you change the default, you should call TiXmlBase::SetCondenseWhiteSpace( bool )
+before making any calls to Parse XML data, and I don't recommend changing it after
+it has been set.
+
+
+<h3> Handles </h3>
+
+Where browsing an XML document in a robust way, it is important to check
+for null returns from method calls. An error safe implementation can
+generate a lot of code like:
+
+@verbatim
+TiXmlElement* root = document.FirstChildElement( "Document" );
+if ( root )
+{
+	TiXmlElement* element = root->FirstChildElement( "Element" );
+	if ( element )
+	{
+		TiXmlElement* child = element->FirstChildElement( "Child" );
+		if ( child )
+		{
+			TiXmlElement* child2 = child->NextSiblingElement( "Child" );
+			if ( child2 )
+			{
+				// Finally do something useful.
+@endverbatim
+
+Handles have been introduced to clean this up. Using the TiXmlHandle class,
+the previous code reduces to:
+
+@verbatim
+TiXmlHandle docHandle( &document );
+TiXmlElement* child2 = docHandle.FirstChild( "Document" ).FirstChild( "Element" ).Child( "Child", 1 ).ToElement();
+if ( child2 )
+{
+	// do something useful
+@endverbatim
+
+Which is much easier to deal with. See TiXmlHandle for more information.
+
+
+<h3> Row and Column tracking </h3>
+Being able to track nodes and attributes back to their origin location
+in source files can be very important for some applications. Additionally,
+knowing where parsing errors occured in the original source can be very
+time saving.
+
+TinyXML can tracks the row and column origin of all nodes and attributes
+in a text file. The TiXmlBase::Row() and TiXmlBase::Column() methods return
+the origin of the node in the source text. The correct tabs can be 
+configured in TiXmlDocument::SetTabSize().
+
+
+<h2> Using and Installing </h2>
+
+To Compile and Run xmltest:
+
+A Linux Makefile and a Windows Visual C++ .dsw file is provided. 
+Simply compile and run. It will write the file demotest.xml to your 
+disk and generate output on the screen. It also tests walking the
+DOM by printing out the number of nodes found using different 
+techniques.
+
+The Linux makefile is very generic and runs on many systems - it 
+is currently tested on mingw and
+MacOSX. You do not need to run 'make depend'. The dependecies have been
+hard coded.
+
+<h3>Windows project file for VC6</h3>
+<ul>
+<li>tinyxml:		tinyxml library, non-STL </li>
+<li>tinyxmlSTL:		tinyxml library, STL </li>
+<li>tinyXmlTest:	test app, non-STL </li>
+<li>tinyXmlTestSTL: test app, STL </li>
+</ul>
+
+<h3>Makefile</h3>
+At the top of the makefile you can set:
+
+PROFILE, DEBUG, and TINYXML_USE_STL. Details (such that they are) are in
+the makefile.
+
+In the tinyxml directory, type "make clean" then "make". The executable
+file 'xmltest' will be created.
+
+
+
+<h3>To Use in an Application:</h3>
+
+Add tinyxml.cpp, tinyxml.h, tinyxmlerror.cpp, tinyxmlparser.cpp, tinystr.cpp, and tinystr.h to your
+project or make file. That's it! It should compile on any reasonably
+compliant C++ system. You do not need to enable exceptions or
+RTTI for TinyXML.
+
+
+<h2> How TinyXML works.  </h2>
+
+An example is probably the best way to go. Take:
+@verbatim
+	<?xml version="1.0" standalone=no>
+	<!-- Our to do list data -->
+	<ToDo>
+		<Item priority="1"> Go to the <bold>Toy store!</bold></Item>
+		<Item priority="2"> Do bills</Item>
+	</ToDo>
+@endverbatim
+
+Its not much of a To Do list, but it will do. To read this file 
+(say "demo.xml") you would create a document, and parse it in:
+@verbatim
+	TiXmlDocument doc( "demo.xml" );
+	doc.LoadFile();
+@endverbatim
+
+And its ready to go. Now lets look at some lines and how they 
+relate to the DOM.
+
+@verbatim
+<?xml version="1.0" standalone=no>
+@endverbatim
+
+	The first line is a declaration, and gets turned into the
+	TiXmlDeclaration class. It will be the first child of the
+	document node.
+	
+	This is the only directive/special tag parsed by by TinyXML.
+	Generally directive tags are stored in TiXmlUnknown so the 
+	commands wont be lost when it is saved back to disk.
+
+@verbatim
+<!-- Our to do list data -->
+@endverbatim
+
+	A comment. Will become a TiXmlComment object.
+
+@verbatim
+<ToDo>
+@endverbatim
+
+	The "ToDo" tag defines a TiXmlElement object. This one does not have 
+	any attributes, but does contain 2 other elements.
+
+@verbatim
+<Item priority="1"> 
+@endverbatim
+
+	Creates another TiXmlElement which is a child of the "ToDo" element. 
+	This element has 1 attribute, with the name "priority" and the value 
+	"1".
+
+@verbatim
+Go to the
+@endverbatim 
+
+	A TiXmlText. This is a leaf node and cannot contain other nodes. 
+	It is a child of the "Item" TiXmlElement.
+
+@verbatim
+<bold>
+@endverbatim
+
+	
+	Another TiXmlElement, this one a child of the "Item" element.
+
+Etc.
+
+Looking at the entire object tree, you end up with:
+@verbatim
+TiXmlDocument					"demo.xml"
+	TiXmlDeclaration			"version='1.0'" "standalone=no"
+	TiXmlComment				" Our to do list data"
+	TiXmlElement				"ToDo"
+		TiXmlElement			"Item" Attribtutes: priority = 1
+			TiXmlText			"Go to the "
+			TiXmlElement		"bold"
+				TiXmlText		"Toy store!"
+		TiXmlElement			"Item" Attributes: priority=2
+			TiXmlText			"Do bills"
+@endverbatim
+
+<h2> Documentation </h2>
+
+The documentation is build with Doxygen, using the 'dox' 
+configuration file.
+
+<h2> License </h2>
+
+TinyXML is released under the zlib license:
+
+This software is provided 'as-is', without any express or implied 
+warranty. In no event will the authors be held liable for any 
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any 
+purpose, including commercial applications, and to alter it and 
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must 
+not claim that you wrote the original software. If you use this 
+software in a product, an acknowledgment in the product documentation 
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and 
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source 
+distribution.
+
+<h2> References  </h2>
+
+The World Wide Web Consortium is the definitive standard body for 
+XML, and there web pages contain huge amounts of information. 
+
+The definitive spec: <a href="http://www.w3.org/TR/2004/REC-xml-20040204/">
+http://www.w3.org/TR/2004/REC-xml-20040204/</a>
+
+I also recommend "XML Pocket Reference" by Robert Eckstein and published by 
+OReilly...the book that got the whole thing started.
+
+<h2> Contributors, Contacts, and a Brief History </h2>
+
+Thanks very much to everyone who sends suggestions, bugs, ideas, and 
+encouragement. It all helps, and makes this project fun. A special thanks
+to the contributors on the web pages that keep it lively.
+
+So many people have sent in bugs and ideas, that rather than list here 
+we try to give credit due in the "changes.txt" file.
+
+TinyXML was originally written by Lee Thomason. (Often the "I" still
+in the documentation.) Lee reviews changes and releases new versions,
+with the help of Yves Berquin, Andrew Ellerton, and the tinyXml community.
+
+We appreciate your suggestions, and would love to know if you 
+use TinyXML. Hopefully you will enjoy it and find it useful. 
+Please post questions, comments, file bugs, or contact us at:
+
+www.sourceforge.net/projects/tinyxml
+
+Lee Thomason, Yves Berquin, Andrew Ellerton
+*/
Index: de/branches/buildsystem3/src/tinyxml/ticpp.cc
===================================================================
--- /code/branches/buildsystem3/src/tinyxml/ticpp.cc	(revision 2663)
+++ 	(revision )
@@ -1,1139 +1,0 @@
-#define TIXML_USE_TICPP
-
-/*
-http://code.google.com/p/ticpp/
-Copyright (c) 2006 Ryan Pusztai, Ryan Mulder
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal in
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
-the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
-COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
-IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-/*
-Modifications by the orxonox team:
-In function: void Document::Parse( const std::string& xml, bool throwIfParseError, TiXmlEncoding encoding )
-     change: Added row and column number to the error description.
-     author: Reto Grieder
-*/
-
-#ifdef TIXML_USE_TICPP
-
-#include "ticpp.h"
-#include "ticpprc.h"
-#include "tinyxml.h"
-#include <sstream>
-
-using namespace ticpp;
-
-// In the following Visitor functions, casting away const should be safe, as the object can only be referred to by a const &
-bool Visitor::VisitEnter( const TiXmlDocument& doc )
-{
-	return VisitEnter( Document( const_cast< TiXmlDocument* >( &doc ) ) );
-}
-
-bool Visitor::VisitExit( const TiXmlDocument& doc )
-{
-	return VisitEnter( Document( const_cast< TiXmlDocument* >( &doc ) ) );
-}
-
-bool Visitor::VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute )
-{
-	if ( 0 != firstAttribute )
-	{
-		Attribute attribute( const_cast< TiXmlAttribute* >( firstAttribute ) );
-		return VisitEnter( Element( const_cast< TiXmlElement* >( &element ) ), &attribute );
-	}
-	else
-	{
-		return VisitEnter( Element( const_cast< TiXmlElement* >( &element ) ), 0 );
-	}
-}
-
-bool Visitor::VisitExit( const TiXmlElement& element )
-{
-	return VisitExit( Element( const_cast< TiXmlElement* >( &element ) ) );
-}
-
-bool Visitor::Visit( const TiXmlDeclaration& declaration )
-{
-	return Visit( Declaration( const_cast< TiXmlDeclaration* >( &declaration ) ) );
-}
-
-bool Visitor::Visit( const TiXmlStylesheetReference& stylesheet )
-{
-	return Visit( StylesheetReference( const_cast< TiXmlStylesheetReference* >( &stylesheet ) ) );
-}
-
-bool Visitor::Visit( const TiXmlText& text )
-{
-	return Visit( Text( const_cast< TiXmlText* >( &text ) ) );
-}
-
-bool Visitor::Visit( const TiXmlComment& comment )
-{
-	return Visit( Comment( const_cast< TiXmlComment* >( &comment ) ) );
-}
-
-Attribute::Attribute()
-{
-	SetTiXmlPointer( new TiXmlAttribute() );
-	m_impRC->InitRef();
-}
-
-Attribute::Attribute( TiXmlAttribute* attribute )
-{
-	SetTiXmlPointer( attribute );
-	m_impRC->IncRef();
-}
-
-Attribute::Attribute( const std::string& name, const std::string& value )
-{
-	SetTiXmlPointer( new TiXmlAttribute( name, value ) );
-	m_impRC->InitRef();
-}
-
-void Attribute::operator=( const Attribute& copy )
-{
-	// Dropping the reference to the old object
-	this->m_impRC->DecRef();
-
-	// Pointing to the new Object
-	SetTiXmlPointer( copy.m_tiXmlPointer );
-
-	// The internal tixml pointer changed in the above line
-	this->m_impRC->IncRef();
-}
-
-Attribute::Attribute( const Attribute& copy ) : Base()
-{
-	// Dropping the reference to the old object
-	this->m_impRC->DecRef();
-
-	// Pointing to the new Object
-	SetTiXmlPointer( copy.m_tiXmlPointer );
-
-	// The internal tixml pointer changed in the above line
-	this->m_impRC->IncRef();
-}
-
-Attribute::~Attribute()
-{
-	m_impRC->DecRef();
-}
-
-std::string Attribute::Value() const
-{
-	ValidatePointer();
-	return m_tiXmlPointer->ValueStr();
-}
-
-std::string Attribute::Name() const
-{
-	ValidatePointer();
-	return m_tiXmlPointer->Name();
-}
-
-Attribute* Attribute::Next( bool throwIfNoAttribute ) const
-{
-	ValidatePointer();
-	TiXmlAttribute* attribute = m_tiXmlPointer->Next();
-	if ( 0 == attribute )
-	{
-		if ( throwIfNoAttribute )
-		{
-			TICPPTHROW( "No more attributes found" )
-		}
-		else
-		{
-			return 0;
-		}
-	}
-
-	Attribute* temp = new Attribute( attribute );
-	m_spawnedWrappers.push_back( temp );
-
-	return temp;
-}
-
-Attribute* Attribute::Previous( bool throwIfNoAttribute ) const
-{
-	ValidatePointer();
-	TiXmlAttribute* attribute = m_tiXmlPointer->Previous();
-	if ( 0 == attribute )
-	{
-		if ( throwIfNoAttribute )
-		{
-			TICPPTHROW( "No more attributes found" )
-		}
-		else
-		{
-			return 0;
-		}
-	}
-
-	Attribute* temp = new Attribute( attribute );
-	m_spawnedWrappers.push_back( temp );
-
-	return temp;
-}
-
-void Attribute::IterateNext( const std::string&, Attribute** next ) const
-{
-	*next = Next( false );
-}
-
-void Attribute::IteratePrevious( const std::string&, Attribute** previous ) const
-{
-	*previous = Previous( false );
-}
-
-void Attribute::Print( FILE* file, int depth ) const
-{
-	ValidatePointer();
-	m_tiXmlPointer->Print( file, depth );
-}
-
-void Attribute::SetTiXmlPointer( TiXmlAttribute* newPointer )
-{
-	m_tiXmlPointer = newPointer;
-	SetImpRC( newPointer );
-}
-
-//*****************************************************************************
-
-Node* Node::NodeFactory( TiXmlNode* tiXmlNode, bool throwIfNull, bool rememberSpawnedWrapper ) const
-{
-	if ( 0 == tiXmlNode )
-	{
-		if ( throwIfNull )
-		{
-			TICPPTHROW( "tiXmlNode is NULL" )
-		}
-		else
-		{
-			return 0;
-		}
-	}
-
-	Node* temp;
-	switch ( tiXmlNode->Type() )
-	{
-		case TiXmlNode::DOCUMENT:
-			temp = new Document( tiXmlNode->ToDocument() );
-			break;
-
-		case TiXmlNode::ELEMENT:
-			temp = new Element( tiXmlNode->ToElement() );
-			break;
-
-		case TiXmlNode::COMMENT:
-			temp = new Comment( tiXmlNode->ToComment() );
-			break;
-
-		case TiXmlNode::TEXT:
-			temp = new Text( tiXmlNode->ToText() );
-			break;
-
-		case TiXmlNode::DECLARATION:
-			temp = new Declaration( tiXmlNode->ToDeclaration() );
-			break;
-
-		case TiXmlNode::STYLESHEETREFERENCE:
-			temp = new StylesheetReference( tiXmlNode->ToStylesheetReference() );
-			break;
-
-		default:
-			TICPPTHROW( "Type is unsupported" )
-	}
-
-	if ( rememberSpawnedWrapper )
-	{
-		m_spawnedWrappers.push_back( temp );
-	}
-	return temp;
-}
-
-
-std::string Node::Value() const
-{
-	return GetTiXmlPointer()->ValueStr();
-}
-
-void Node::Clear()
-{
-	GetTiXmlPointer()->Clear();
-}
-
-Node* Node::Parent( bool throwIfNoParent ) const
-{
-	TiXmlNode* parent = GetTiXmlPointer()->Parent();
-	if ( ( 0 == parent ) && throwIfNoParent )
-	{
-		TICPPTHROW( "No parent exists" );
-	}
-
-	return NodeFactory( parent, false );
-}
-
-Node* Node::FirstChild( bool throwIfNoChildren ) const
-{
-	return FirstChild( "", throwIfNoChildren );
-}
-
-Node* Node::FirstChild( const std::string& value, bool throwIfNoChildren ) const
-{
-	return FirstChild( value.c_str(), throwIfNoChildren );
-}
-
-Node* Node::FirstChild( const char* value, bool throwIfNoChildren ) const
-{
-	TiXmlNode* childNode;
-	if ( 0 == strlen( value ) )
-	{
-		childNode = GetTiXmlPointer()->FirstChild();
-	}
-	else
-	{
-		childNode = GetTiXmlPointer()->FirstChild( value );
-	}
-
-	if ( ( 0 == childNode ) && throwIfNoChildren )
-	{
-		TICPPTHROW( "Child with the value of \"" << value << "\" not found" );
-	}
-
-	return NodeFactory( childNode, false );
-}
-
-Node* Node::LastChild( bool throwIfNoChildren ) const
-{
-	return LastChild( "", throwIfNoChildren );
-}
-
-Node* Node::LastChild( const std::string& value, bool throwIfNoChildren ) const
-{
-	return LastChild( value.c_str(), throwIfNoChildren );
-}
-
-Node* Node::LastChild( const char* value, bool throwIfNoChildren ) const
-{
-	TiXmlNode* childNode;
-	if ( 0 == strlen( value ) )
-	{
-		childNode = GetTiXmlPointer()->LastChild();
-	}
-	else
-	{
-		childNode = GetTiXmlPointer()->LastChild( value );
-	}
-
-	if ( ( 0 == childNode ) && throwIfNoChildren )
-	{
-		TICPPTHROW( "Child with the value of \"" << value << "\" not found" );
-	}
-
-	return NodeFactory( childNode, false );
-}
-
-Node* Node::IterateChildren ( Node* previous ) const
-{
-	TiXmlNode* pointer;
-	if ( 0 == previous )
-	{
-		pointer = GetTiXmlPointer()->IterateChildren( 0 );
-	}
-	else
-	{
-		pointer = GetTiXmlPointer()->IterateChildren( previous->GetTiXmlPointer() );
-	}
-
-	return NodeFactory( pointer, false );
-}
-
-Node* Node::IterateChildren( const std::string& value, Node* previous ) const
-{
-	TiXmlNode* pointer;
-	if ( 0 == previous )
-	{
-		pointer = GetTiXmlPointer()->IterateChildren( value, 0 );
-	}
-	else
-	{
-		pointer = GetTiXmlPointer()->IterateChildren( value, previous->GetTiXmlPointer() );
-	}
-
-	return NodeFactory( pointer, false );
-}
-
-Node* Node::InsertEndChild( Node& addThis )
-{
-	if ( addThis.Type() == TiXmlNode::DOCUMENT )
-	{
-		TICPPTHROW( "Node is a Document and can't be inserted" );
-	}
-
-	// Increment reference count when adding to the tree
-	addThis.m_impRC->IncRef();
-
-	TiXmlNode* pointer = GetTiXmlPointer()->InsertEndChild( *addThis.GetTiXmlPointer() );
-	if ( 0 == pointer )
-	{
-		TICPPTHROW( "Node can't be inserted" );
-	}
-
-	return NodeFactory( pointer );
-}
-
-Node* Node::LinkEndChild( Node* childNode )
-{
-	if ( childNode->Type() == TiXmlNode::DOCUMENT )
-	{
-		TICPPTHROW( "Node is a Document and can't be linked" );
-	}
-
-	// Increment reference count when adding to the tree
-	childNode->m_impRC->IncRef();
-
-	if ( 0 == GetTiXmlPointer()->LinkEndChild( childNode->GetTiXmlPointer() ) )
-	{
-		TICPPTHROW( "Node can't be linked" );
-	}
-
-	return childNode;
-}
-
-Node* Node::InsertBeforeChild( Node* beforeThis, Node& addThis )
-{
-	if ( addThis.Type() == TiXmlNode::DOCUMENT )
-	{
-		TICPPTHROW( "Node is a Document and can't be inserted" );
-	}
-
-	// Increment reference count when adding to the tree
-	addThis.m_impRC->IncRef();
-
-	TiXmlNode* pointer = GetTiXmlPointer()->InsertBeforeChild( beforeThis->GetTiXmlPointer(), *addThis.GetTiXmlPointer() );
-	if ( 0 == pointer )
-	{
-		TICPPTHROW( "Node can't be inserted" );
-	}
-
-	return NodeFactory( pointer );
-}
-
-Node* Node::InsertAfterChild( Node* afterThis, Node& addThis )
-{
-	if ( addThis.Type() == TiXmlNode::DOCUMENT )
-	{
-		TICPPTHROW( "Node is a Document and can't be inserted" );
-	}
-
-	// Increment reference count when adding to the tree
-	addThis.m_impRC->IncRef();
-
-	TiXmlNode* pointer = GetTiXmlPointer()->InsertAfterChild( afterThis->GetTiXmlPointer(), *addThis.GetTiXmlPointer() );
-	if ( 0 == pointer )
-	{
-		TICPPTHROW( "Node can't be inserted" );
-	}
-
-	return NodeFactory( pointer );
-}
-
-Node* Node::ReplaceChild( Node* replaceThis, Node& withThis )
-{
-	if ( withThis.Type() == TiXmlNode::DOCUMENT )
-	{
-		TICPPTHROW( "Node is a Document and can't be inserted" );
-	}
-
-	// Increment reference count when adding to the tree
-	withThis.m_impRC->IncRef();
-
-	TiXmlNode* pointer = GetTiXmlPointer()->ReplaceChild( replaceThis->GetTiXmlPointer(), *withThis.GetTiXmlPointer() );
-	if ( 0 == pointer )
-	{
-		TICPPTHROW( "Node can't be inserted" );
-	}
-
-	return NodeFactory( pointer );
-}
-
-void Node::RemoveChild( Node* removeThis )
-{
-	if  ( !GetTiXmlPointer()->RemoveChild( removeThis->GetTiXmlPointer() ) )
-	{
-		TICPPTHROW( "Node to remove (" << removeThis->Value() << ") is not a child of this Node (" << Value() << ")" )
-	}
-}
-
-Node* Node::PreviousSibling( bool throwIfNoSiblings ) const
-{
-	return PreviousSibling( "", throwIfNoSiblings );
-}
-
-Node* Node::PreviousSibling( const std::string& value, bool throwIfNoSiblings ) const
-{
-	return PreviousSibling( value.c_str(), throwIfNoSiblings );
-}
-
-Node* Node::PreviousSibling( const char* value, bool throwIfNoSiblings ) const
-{
-	TiXmlNode* sibling;
-	if ( 0 == strlen( value ) )
-	{
-		sibling = GetTiXmlPointer()->PreviousSibling();
-	}
-	else
-	{
-		sibling = GetTiXmlPointer()->PreviousSibling( value );
-	}
-
-	if ( ( 0 == sibling ) && throwIfNoSiblings )
-	{
-		TICPPTHROW( "No Siblings found with value, '" << value << "', Prior to this Node (" << Value() << ")" )
-	}
-
-	return NodeFactory( sibling, false );
-}
-
-Node* Node::NextSibling( bool throwIfNoSiblings ) const
-{
-	return NextSibling( "", throwIfNoSiblings );
-}
-
-Node* Node::NextSibling( const std::string& value, bool throwIfNoSiblings ) const
-{
-	return NextSibling( value.c_str(), throwIfNoSiblings );
-}
-
-Node* Node::NextSibling( const char* value, bool throwIfNoSiblings ) const
-{
-	TiXmlNode* sibling;
-	if ( 0 == strlen( value ) )
-	{
-		sibling = GetTiXmlPointer()->NextSibling();
-	}
-	else
-	{
-		sibling = GetTiXmlPointer()->NextSibling( value );
-	}
-
-	if ( ( 0 == sibling ) && throwIfNoSiblings )
-	{
-		TICPPTHROW( "No Siblings found with value, '" << value << "', After this Node (" << Value() << ")" )
-	}
-
-	return NodeFactory( sibling, false );
-}
-
-Element* Node::NextSiblingElement( bool throwIfNoSiblings ) const
-{
-	return NextSiblingElement( "", throwIfNoSiblings );
-}
-
-Element* Node::NextSiblingElement( const std::string& value, bool throwIfNoSiblings ) const
-{
-	return NextSiblingElement( value.c_str(), throwIfNoSiblings );
-}
-
-Element* Node::NextSiblingElement( const char* value, bool throwIfNoSiblings ) const
-{
-	TiXmlElement* sibling;
-	if ( 0 == strlen( value ) )
-	{
-		sibling = GetTiXmlPointer()->NextSiblingElement();
-	}
-	else
-	{
-		sibling = GetTiXmlPointer()->NextSiblingElement( value );
-	}
-
-	if ( 0 == sibling )
-	{
-		if ( throwIfNoSiblings )
-		{
-			TICPPTHROW( "No Element Siblings found with value, '" << value << "', After this Node (" << Value() << ")" )
-		}
-		else
-		{
-			return 0;
-		}
-	}
-
-	Element* temp = new Element( sibling );
-	m_spawnedWrappers.push_back( temp );
-
-	return temp;
-}
-
-Element* Node::FirstChildElement( bool throwIfNoChildren ) const
-{
-	return FirstChildElement( "", throwIfNoChildren );
-}
-
-Element* Node::FirstChildElement( const std::string& value, bool throwIfNoChildren ) const
-{
-	return FirstChildElement( value.c_str(), throwIfNoChildren );
-}
-
-Element* Node::FirstChildElement( const char* value, bool throwIfNoChildren ) const
-{
-	TiXmlElement* element;
-	if ( 0 == strlen( value ) )
-	{
-		element = GetTiXmlPointer()->FirstChildElement();
-	}
-	else
-	{
-		element = GetTiXmlPointer()->FirstChildElement( value );
-	}
-
-	if ( 0 == element )
-	{
-		if( throwIfNoChildren )
-		{
-			TICPPTHROW( "Element (" << Value() << ") does NOT contain a child with the value of '" << value << "'" )
-		}
-		else
-		{
-			return 0;
-		}
-	}
-
-	Element* temp = new Element( element );
-	m_spawnedWrappers.push_back( temp );
-
-	return temp;
-}
-
-int Node::Type() const
-{
-	return GetTiXmlPointer()->Type();
-}
-
-Document* Node::GetDocument( bool throwIfNoDocument ) const
-{
-	TiXmlDocument* doc = GetTiXmlPointer()->GetDocument();
-	if ( 0 == doc )
-	{
-		if( throwIfNoDocument )
-		{
-			TICPPTHROW( "This node (" << Value() << ") is not linked under a document" )
-		}
-		else
-		{
-			return 0;
-		}
-	}
-	Document* temp = new Document( doc );
-	m_spawnedWrappers.push_back( temp );
-
-	return temp;
-}
-
-bool Node::NoChildren() const
-{
-	return GetTiXmlPointer()->NoChildren();
-}
-
-Document* Node::ToDocument() const
-{
-	TiXmlDocument* doc = GetTiXmlPointer()->ToDocument();
-	if ( 0 == doc )
-	{
-		TICPPTHROW( "This node (" << Value() << ") is not a Document" )
-	}
-	Document* temp = new Document( doc );
-	m_spawnedWrappers.push_back( temp );
-
-	return temp;
-}
-
-Element* Node::ToElement() const
-{
-	TiXmlElement* doc = GetTiXmlPointer()->ToElement();
-	if ( 0 == doc )
-	{
-		TICPPTHROW( "This node (" << Value() << ") is not a Element" )
-	}
-	Element* temp = new Element( doc );
-	m_spawnedWrappers.push_back( temp );
-
-	return temp;
-}
-
-Comment* Node::ToComment() const
-{
-	TiXmlComment* doc = GetTiXmlPointer()->ToComment();
-	if ( 0 == doc )
-	{
-		TICPPTHROW( "This node (" << Value() << ") is not a Comment" )
-	}
-	Comment* temp = new Comment( doc );
-	m_spawnedWrappers.push_back( temp );
-
-	return temp;
-}
-
-Text* Node::ToText() const
-{
-	TiXmlText* doc = GetTiXmlPointer()->ToText();
-	if ( 0 == doc )
-	{
-		TICPPTHROW( "This node (" << Value() << ") is not a Text" )
-	}
-	Text* temp = new Text( doc );
-	m_spawnedWrappers.push_back( temp );
-
-	return temp;
-}
-
-Declaration* Node::ToDeclaration() const
-{
-	TiXmlDeclaration* doc = GetTiXmlPointer()->ToDeclaration();
-	if ( 0 == doc )
-	{
-		TICPPTHROW( "This node (" << Value() << ") is not a Declaration" )
-	}
-	Declaration* temp = new Declaration( doc );
-	m_spawnedWrappers.push_back( temp );
-
-	return temp;
-}
-
-StylesheetReference* Node::ToStylesheetReference() const
-{
-	TiXmlStylesheetReference* doc = GetTiXmlPointer()->ToStylesheetReference();
-	if ( 0 == doc )
-	{
-		TICPPTHROW( "This node (" << Value() << ") is not a StylesheetReference" )
-	}
-	StylesheetReference* temp = new StylesheetReference( doc );
-	m_spawnedWrappers.push_back( temp );
-
-	return temp;
-}
-
-std::auto_ptr< Node > Node::Clone() const
-{
-	TiXmlNode* node = GetTiXmlPointer()->Clone();
-	if ( 0 == node )
-	{
-		TICPPTHROW( "Node could not be cloned" );
-	}
-	std::auto_ptr< Node > temp( NodeFactory( node, false, false ) );
-
-	// Take ownership of the memory from TiXml
-	temp->m_impRC->InitRef();
-
-	return temp;
-}
-
-bool Node::Accept( TiXmlVisitor* visitor ) const
-{
-	return GetTiXmlPointer()->Accept( visitor );
-}
-
-//*****************************************************************************
-
-Comment::Comment()
-: NodeImp< TiXmlComment >( new TiXmlComment() )
-{
-	m_impRC->InitRef();
-}
-
-Comment::Comment( TiXmlComment* comment )
-: NodeImp< TiXmlComment >( comment )
-{
-}
-
-Comment::Comment( const std::string& comment )
-: NodeImp< TiXmlComment >( new TiXmlComment() )
-{
-	m_impRC->InitRef();
-	m_tiXmlPointer->SetValue( comment );
-}
-
-//*****************************************************************************
-
-Text::Text()
-: NodeImp< TiXmlText >( new TiXmlText("") )
-{
-	m_impRC->InitRef();
-}
-
-
-Text::Text( const std::string& value )
-: NodeImp< TiXmlText >( new TiXmlText( value ) )
-{
-	m_impRC->InitRef();
-}
-
-Text::Text( TiXmlText* text )
-: NodeImp< TiXmlText >( text )
-{
-}
-
-
-//*****************************************************************************
-
-Document::Document()
-: NodeImp< TiXmlDocument >( new TiXmlDocument() )
-{
-	m_impRC->InitRef();
-}
-
-Document::Document( TiXmlDocument* document )
-: NodeImp< TiXmlDocument >( document )
-{
-}
-
-Document::Document( const char* documentName )
-: NodeImp< TiXmlDocument >( new TiXmlDocument( documentName ) )
-{
-	m_impRC->InitRef();
-}
-
-Document::Document( const std::string& documentName )
-: NodeImp< TiXmlDocument >( new TiXmlDocument( documentName ) )
-{
-	m_impRC->InitRef();
-}
-
-void Document::LoadFile( TiXmlEncoding encoding )
-{
-	if ( !m_tiXmlPointer->LoadFile( encoding ) )
-	{
-		TICPPTHROW( "Couldn't load " << m_tiXmlPointer->Value() );
-	}
-}
-
-void Document::SaveFile( void ) const
-{
-	if ( !m_tiXmlPointer->SaveFile() )
-	{
-		TICPPTHROW( "Couldn't save " << m_tiXmlPointer->Value() );
-	}
-}
-
-void Document::LoadFile( const std::string& filename, TiXmlEncoding encoding )
-{
-	if ( !m_tiXmlPointer->LoadFile( filename.c_str(), encoding ) )
-	{
-		TICPPTHROW( "Couldn't load " << filename );
-	}
-}
-
-void Document::LoadFile( const char* filename, TiXmlEncoding encoding )
-{
-	if ( !m_tiXmlPointer->LoadFile( filename, encoding ) )
-	{
-		TICPPTHROW( "Couldn't load " << filename );
-	}
-}
-
-void Document::SaveFile( const std::string& filename ) const
-{
-	if ( !m_tiXmlPointer->SaveFile( filename.c_str() ) )
-	{
-		TICPPTHROW( "Couldn't save " << filename );
-	}
-}
-
-void Document::Parse( const std::string& xml, bool throwIfParseError, TiXmlEncoding encoding )
-{
-	m_tiXmlPointer->Parse( xml.c_str(), 0, encoding );
-	if( throwIfParseError && m_tiXmlPointer->Error() )
-	{
-		TICPPTHROW( "Error parsing xml: " << m_tiXmlPointer->ErrorDesc()
-            << " In row " << m_tiXmlPointer->ErrorRow() << ", column " << m_tiXmlPointer->ErrorCol() << ".");
-	}
-}
-
-//*****************************************************************************
-
-Element::Element()
-: NodeImp< TiXmlElement >( new TiXmlElement( "DefaultValueCausedByCreatingAnElementWithNoParameters" ) )
-{
-	m_impRC->InitRef();
-}
-
-Element::Element( const std::string& value )
-: NodeImp< TiXmlElement >( new TiXmlElement( value ) )
-{
-	m_impRC->InitRef();
-}
-
-Element::Element( const char* value )
-: NodeImp< TiXmlElement >( new TiXmlElement( value ) )
-{
-	m_impRC->InitRef();
-}
-
-Element::Element( TiXmlElement* element )
-: NodeImp< TiXmlElement >( element )
-{
-}
-
-Attribute* Element::FirstAttribute( bool throwIfNoAttributes ) const
-{
-	ValidatePointer();
-	TiXmlAttribute* attribute = m_tiXmlPointer->FirstAttribute();
-	if ( ( 0 == attribute ) && throwIfNoAttributes )
-	{
-		TICPPTHROW( "This Element (" << Value() << ") has no attributes" )
-	}
-
-	if ( 0 == attribute )
-	{
-		if( throwIfNoAttributes )
-		{
-			TICPPTHROW( "Element (" << Value() << ") has no attributes" )
-		}
-		else
-		{
-			return 0;
-		}
-	}
-
-	Attribute* temp = new Attribute( attribute );
-	m_spawnedWrappers.push_back( temp );
-
-	return temp;
-}
-
-Attribute* Element::LastAttribute( bool throwIfNoAttributes ) const
-{
-	ValidatePointer();
-	TiXmlAttribute* attribute = m_tiXmlPointer->LastAttribute();
-	if ( ( 0 == attribute ) && throwIfNoAttributes )
-	{
-		TICPPTHROW( "This Element (" << Value() << ") has no attributes" )
-	}
-
-	if ( 0 == attribute )
-	{
-		if( throwIfNoAttributes )
-		{
-			TICPPTHROW( "Element (" << Value() << ") has no attributes" )
-		}
-		else
-		{
-			return 0;
-		}
-	}
-
-	Attribute* temp = new Attribute( attribute );
-	m_spawnedWrappers.push_back( temp );
-
-	return temp;
-}
-
-std::string Element::GetAttributeOrDefault( const std::string& name, const std::string& defaultValue ) const
-{
-	std::string value;
-	if ( !GetAttributeImp( name, &value ) )
-	{
-		return defaultValue;
-	}
-	return value;
-}
-
-std::string Element::GetAttribute( const std::string& name ) const
-{
-	return GetAttributeOrDefault( name, std::string() );
-}
-
-bool Element::GetAttributeImp( const std::string& name, std::string* value ) const
-{
-	ValidatePointer();
-
-	// Get value from TinyXML, if the attribute exists
-	const char* retVal = m_tiXmlPointer->Attribute( name.c_str() );
-
-	// TinyXML returns NULL if the attribute doesn't exist
-	if ( 0 == retVal )
-	{
-		return false;
-	}
-	else
-	{
-		*value = retVal;
-		return true;
-	}
-}
-
-bool Element::GetTextImp( std::string* value ) const
-{
-	ValidatePointer();
-
-	// Get value from TinyXML, if the attribute exists
-	const char* retVal = m_tiXmlPointer->GetText();
-
-	// TinyXML returns NULL if the attribute doesn't exist
-	if ( 0 == retVal )
-	{
-		return false;
-	}
-	else
-	{
-		*value = retVal;
-		return true;
-	}
-}
-
-//*****************************************************************************
-
-Declaration::Declaration()
-: NodeImp< TiXmlDeclaration >( new TiXmlDeclaration() )
-{
-	m_impRC->InitRef();
-}
-
-Declaration::Declaration( TiXmlDeclaration* declaration )
-: NodeImp< TiXmlDeclaration >( declaration )
-{
-}
-
-Declaration::Declaration( const std::string& version, const std::string& encoding, const std::string& standalone )
-: NodeImp< TiXmlDeclaration >( new TiXmlDeclaration( version, encoding, standalone ) )
-{
-	m_impRC->InitRef();
-}
-
-std::string Declaration::Version() const
-{
-	return m_tiXmlPointer->Version();
-}
-
-std::string Declaration::Encoding() const
-{
-	return m_tiXmlPointer->Encoding();
-}
-
-std::string Declaration::Standalone() const
-{
-	return m_tiXmlPointer->Standalone();
-}
-
-//*****************************************************************************
-
-StylesheetReference::StylesheetReference()
-: NodeImp< TiXmlStylesheetReference >( new TiXmlStylesheetReference() )
-{
-	m_impRC->InitRef();
-}
-
-StylesheetReference::StylesheetReference( TiXmlStylesheetReference* stylesheetReference )
-: NodeImp< TiXmlStylesheetReference >( stylesheetReference )
-{
-}
-
-StylesheetReference::StylesheetReference( const std::string& type, const std::string& href )
-: NodeImp< TiXmlStylesheetReference >( new TiXmlStylesheetReference( type, href ) )
-{
-	m_impRC->InitRef();
-}
-
-std::string StylesheetReference::Type() const
-{
-	return m_tiXmlPointer->Type();
-}
-
-std::string StylesheetReference::Href() const
-{
-	return m_tiXmlPointer->Href();
-}
-
-//*****************************************************************************
-
-Exception::Exception(const std::string &details)
-:
-m_details( details )
-{
-
-}
-
-Exception::~Exception() throw()
-{
-}
-
-const char* Exception::what() const throw()
-{
-	return m_details.c_str();
-}
-
-//*****************************************************************************
-
-TiCppRC::TiCppRC()
-{
-	// Spawn reference counter for this object
-	m_tiRC = new TiCppRCImp( this );
-}
-
-TiCppRC::~TiCppRC()
-{
-	// Set pointer held by reference counter to NULL
-	this->m_tiRC->Nullify();
-
-	// Decrement reference - so reference counter will delete itself if necessary
-	this->m_tiRC->DecRef();
-}
-
-//*****************************************************************************
-
-TiCppRCImp::TiCppRCImp( TiCppRC* tiCppRC )
-	: m_count( 1 ), m_tiCppRC ( tiCppRC )
-{
-}
-
-void TiCppRCImp::IncRef()
-{
-	m_count++;
-}
-
-void TiCppRCImp::DecRef()
-{
-	m_count--;
-	if ( 0 == m_count )
-	{
-		delete m_tiCppRC;
-		delete this;
-	}
-}
-
-void TiCppRCImp::InitRef()
-{
-	m_count = 1;
-}
-
-void TiCppRCImp::Nullify()
-{
-	m_tiCppRC = 0;
-}
-
-TiCppRC* TiCppRCImp::Get()
-{
-	return m_tiCppRC;
-}
-
-bool TiCppRCImp::IsNull()
-{
-	return 0 == m_tiCppRC;
-}
-
-#endif // TIXML_USE_TICPP
Index: /code/branches/buildsystem3/src/tinyxml/ticpp.cpp
===================================================================
--- /code/branches/buildsystem3/src/tinyxml/ticpp.cpp	(revision 2664)
+++ /code/branches/buildsystem3/src/tinyxml/ticpp.cpp	(revision 2664)
@@ -0,0 +1,1150 @@
+/*
+http://code.google.com/p/ticpp/
+Copyright (c) 2006 Ryan Pusztai, Ryan Mulder
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+*/
+
+#ifdef TIXML_USE_TICPP
+
+#include "ticpp.h"
+#include "ticpprc.h"
+#include "tinyxml.h"
+#include <sstream>
+
+using namespace ticpp;
+
+// In the following Visitor functions, casting away const should be safe, as the object can only be referred to by a const &
+bool Visitor::VisitEnter( const TiXmlDocument& doc )
+{
+	return VisitEnter( Document( const_cast< TiXmlDocument* >( &doc ) ) );
+}
+
+bool Visitor::VisitExit( const TiXmlDocument& doc )
+{
+	return VisitEnter( Document( const_cast< TiXmlDocument* >( &doc ) ) );
+}
+
+bool Visitor::VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute )
+{
+	if ( 0 != firstAttribute )
+	{
+		Attribute attribute( const_cast< TiXmlAttribute* >( firstAttribute ) );
+		return VisitEnter( Element( const_cast< TiXmlElement* >( &element ) ), &attribute );
+	}
+	else
+	{
+		return VisitEnter( Element( const_cast< TiXmlElement* >( &element ) ), 0 );
+	}
+}
+
+bool Visitor::VisitExit( const TiXmlElement& element )
+{
+	return VisitExit( Element( const_cast< TiXmlElement* >( &element ) ) );
+}
+
+bool Visitor::Visit( const TiXmlDeclaration& declaration )
+{
+	return Visit( Declaration( const_cast< TiXmlDeclaration* >( &declaration ) ) );
+}
+
+bool Visitor::Visit( const TiXmlStylesheetReference& stylesheet )
+{
+	return Visit( StylesheetReference( const_cast< TiXmlStylesheetReference* >( &stylesheet ) ) );
+}
+
+bool Visitor::Visit( const TiXmlText& text )
+{
+	return Visit( Text( const_cast< TiXmlText* >( &text ) ) );
+}
+
+bool Visitor::Visit( const TiXmlComment& comment )
+{
+	return Visit( Comment( const_cast< TiXmlComment* >( &comment ) ) );
+}
+
+Attribute::Attribute()
+{
+	SetTiXmlPointer( new TiXmlAttribute() );
+	m_impRC->InitRef();
+}
+
+Attribute::Attribute( TiXmlAttribute* attribute )
+{
+	SetTiXmlPointer( attribute );
+	m_impRC->IncRef();
+}
+
+Attribute::Attribute( const std::string& name, const std::string& value )
+{
+	SetTiXmlPointer( new TiXmlAttribute( name, value ) );
+	m_impRC->InitRef();
+}
+
+void Attribute::operator=( const Attribute& copy )
+{
+	// Dropping the reference to the old object
+	this->m_impRC->DecRef();
+
+	// Pointing to the new Object
+	SetTiXmlPointer( copy.m_tiXmlPointer );
+
+	// The internal tixml pointer changed in the above line
+	this->m_impRC->IncRef();
+}
+
+Attribute::Attribute( const Attribute& copy ) : Base()
+{
+	// Dropping the reference to the old object
+	this->m_impRC->DecRef();
+
+	// Pointing to the new Object
+	SetTiXmlPointer( copy.m_tiXmlPointer );
+
+	// The internal tixml pointer changed in the above line
+	this->m_impRC->IncRef();
+}
+
+Attribute::~Attribute()
+{
+	m_impRC->DecRef();
+}
+
+std::string Attribute::Value() const
+{
+	ValidatePointer();
+	return m_tiXmlPointer->ValueStr();
+}
+
+std::string Attribute::Name() const
+{
+	ValidatePointer();
+	return m_tiXmlPointer->Name();
+}
+
+Attribute* Attribute::Next( bool throwIfNoAttribute ) const
+{
+	ValidatePointer();
+	TiXmlAttribute* attribute = m_tiXmlPointer->Next();
+	if ( 0 == attribute )
+	{
+		if ( throwIfNoAttribute )
+		{
+			TICPPTHROW( "No more attributes found" )
+		}
+		else
+		{
+			return 0;
+		}
+	}
+
+	Attribute* temp = new Attribute( attribute );
+	attribute->m_spawnedWrappers.push_back( temp );
+
+	return temp;
+}
+
+Attribute* Attribute::Previous( bool throwIfNoAttribute ) const
+{
+	ValidatePointer();
+	TiXmlAttribute* attribute = m_tiXmlPointer->Previous();
+	if ( 0 == attribute )
+	{
+		if ( throwIfNoAttribute )
+		{
+			TICPPTHROW( "No more attributes found" )
+		}
+		else
+		{
+			return 0;
+		}
+	}
+
+	Attribute* temp = new Attribute( attribute );
+	attribute->m_spawnedWrappers.push_back( temp );
+
+	return temp;
+}
+
+void Attribute::IterateNext( const std::string&, Attribute** next ) const
+{
+	*next = Next( false );
+}
+
+void Attribute::IteratePrevious( const std::string&, Attribute** previous ) const
+{
+	*previous = Previous( false );
+}
+
+void Attribute::Print( FILE* file, int depth ) const
+{
+	ValidatePointer();
+	m_tiXmlPointer->Print( file, depth );
+}
+
+void Attribute::SetTiXmlPointer( TiXmlAttribute* newPointer )
+{
+	m_tiXmlPointer = newPointer;
+	SetImpRC( newPointer );
+}
+
+//*****************************************************************************
+
+Node* Node::NodeFactory( TiXmlNode* tiXmlNode, bool throwIfNull, bool rememberSpawnedWrapper ) const
+{
+	if ( 0 == tiXmlNode )
+	{
+		if ( throwIfNull )
+		{
+			TICPPTHROW( "tiXmlNode is NULL" )
+		}
+		else
+		{
+			return 0;
+		}
+	}
+
+	Node* temp;
+	switch ( tiXmlNode->Type() )
+	{
+		case TiXmlNode::DOCUMENT:
+			temp = new Document( tiXmlNode->ToDocument() );
+			break;
+
+		case TiXmlNode::ELEMENT:
+			temp = new Element( tiXmlNode->ToElement() );
+			break;
+
+		case TiXmlNode::COMMENT:
+			temp = new Comment( tiXmlNode->ToComment() );
+			break;
+
+		case TiXmlNode::TEXT:
+			temp = new Text( tiXmlNode->ToText() );
+			break;
+
+		case TiXmlNode::DECLARATION:
+			temp = new Declaration( tiXmlNode->ToDeclaration() );
+			break;
+
+		case TiXmlNode::STYLESHEETREFERENCE:
+			temp = new StylesheetReference( tiXmlNode->ToStylesheetReference() );
+			break;
+
+		default:
+			TICPPTHROW( "Type is unsupported" )
+	}
+
+	if ( rememberSpawnedWrapper )
+	{
+		tiXmlNode->m_spawnedWrappers.push_back( temp );
+	}
+	return temp;
+}
+
+
+std::string Node::Value() const
+{
+	return GetTiXmlPointer()->ValueStr();
+}
+
+void Node::Clear()
+{
+	GetTiXmlPointer()->Clear();
+}
+
+Node* Node::Parent( bool throwIfNoParent ) const
+{
+	TiXmlNode* parent = GetTiXmlPointer()->Parent();
+	if ( ( 0 == parent ) && throwIfNoParent )
+	{
+		TICPPTHROW( "No parent exists" );
+	}
+
+	return NodeFactory( parent, false );
+}
+
+Node* Node::FirstChild( bool throwIfNoChildren ) const
+{
+	return FirstChild( "", throwIfNoChildren );
+}
+
+Node* Node::FirstChild( const std::string& value, bool throwIfNoChildren ) const
+{
+	return FirstChild( value.c_str(), throwIfNoChildren );
+}
+
+Node* Node::FirstChild( const char* value, bool throwIfNoChildren ) const
+{
+	TiXmlNode* childNode;
+	if ( 0 == strlen( value ) )
+	{
+		childNode = GetTiXmlPointer()->FirstChild();
+	}
+	else
+	{
+		childNode = GetTiXmlPointer()->FirstChild( value );
+	}
+
+	if ( ( 0 == childNode ) && throwIfNoChildren )
+	{
+		TICPPTHROW( "Child with the value of \"" << value << "\" not found" );
+	}
+
+	return NodeFactory( childNode, false );
+}
+
+Node* Node::LastChild( bool throwIfNoChildren ) const
+{
+	return LastChild( "", throwIfNoChildren );
+}
+
+Node* Node::LastChild( const std::string& value, bool throwIfNoChildren ) const
+{
+	return LastChild( value.c_str(), throwIfNoChildren );
+}
+
+Node* Node::LastChild( const char* value, bool throwIfNoChildren ) const
+{
+	TiXmlNode* childNode;
+	if ( 0 == strlen( value ) )
+	{
+		childNode = GetTiXmlPointer()->LastChild();
+	}
+	else
+	{
+		childNode = GetTiXmlPointer()->LastChild( value );
+	}
+
+	if ( ( 0 == childNode ) && throwIfNoChildren )
+	{
+		TICPPTHROW( "Child with the value of \"" << value << "\" not found" );
+	}
+
+	return NodeFactory( childNode, false );
+}
+
+Node* Node::IterateChildren ( Node* previous ) const
+{
+	TiXmlNode* pointer;
+	if ( 0 == previous )
+	{
+		pointer = GetTiXmlPointer()->IterateChildren( 0 );
+	}
+	else
+	{
+		pointer = GetTiXmlPointer()->IterateChildren( previous->GetTiXmlPointer() );
+	}
+
+	return NodeFactory( pointer, false );
+}
+
+Node* Node::IterateChildren( const std::string& value, Node* previous ) const
+{
+	TiXmlNode* pointer;
+	if ( 0 == previous )
+	{
+		pointer = GetTiXmlPointer()->IterateChildren( value, 0 );
+	}
+	else
+	{
+		pointer = GetTiXmlPointer()->IterateChildren( value, previous->GetTiXmlPointer() );
+	}
+
+	return NodeFactory( pointer, false );
+}
+
+Node* Node::InsertEndChild( Node& addThis )
+{
+	if ( addThis.Type() == TiXmlNode::DOCUMENT )
+	{
+		TICPPTHROW( "Node is a Document and can't be inserted" );
+	}
+
+	TiXmlNode* pointer = GetTiXmlPointer()->InsertEndChild( *addThis.GetTiXmlPointer() );
+	if ( 0 == pointer )
+	{
+		TICPPTHROW( "Node can't be inserted" );
+	}
+
+	return NodeFactory( pointer );
+}
+
+Node* Node::LinkEndChild( Node* childNode )
+{
+	if ( childNode->Type() == TiXmlNode::DOCUMENT )
+	{
+		TICPPTHROW( "Node is a Document and can't be linked" );
+	}
+
+	// Increment reference count when adding to the tree
+	childNode->m_impRC->IncRef();
+
+	if ( 0 == GetTiXmlPointer()->LinkEndChild( childNode->GetTiXmlPointer() ) )
+	{
+		TICPPTHROW( "Node can't be linked" );
+	}
+
+	return childNode;
+}
+
+Node* Node::InsertBeforeChild( Node* beforeThis, Node& addThis )
+{
+	if ( addThis.Type() == TiXmlNode::DOCUMENT )
+	{
+		TICPPTHROW( "Node is a Document and can't be inserted" );
+	}
+
+	// Increment reference count when adding to the tree
+	addThis.m_impRC->IncRef();
+
+	TiXmlNode* pointer = GetTiXmlPointer()->InsertBeforeChild( beforeThis->GetTiXmlPointer(), *addThis.GetTiXmlPointer() );
+	if ( 0 == pointer )
+	{
+		TICPPTHROW( "Node can't be inserted" );
+	}
+
+	return NodeFactory( pointer );
+}
+
+Node* Node::InsertAfterChild( Node* afterThis, Node& addThis )
+{
+	if ( addThis.Type() == TiXmlNode::DOCUMENT )
+	{
+		TICPPTHROW( "Node is a Document and can't be inserted" );
+	}
+
+	// Increment reference count when adding to the tree
+	addThis.m_impRC->IncRef();
+
+	TiXmlNode* pointer = GetTiXmlPointer()->InsertAfterChild( afterThis->GetTiXmlPointer(), *addThis.GetTiXmlPointer() );
+	if ( 0 == pointer )
+	{
+		TICPPTHROW( "Node can't be inserted" );
+	}
+
+	return NodeFactory( pointer );
+}
+
+Node* Node::ReplaceChild( Node* replaceThis, Node& withThis )
+{
+	if ( withThis.Type() == TiXmlNode::DOCUMENT )
+	{
+		TICPPTHROW( "Node is a Document and can't be inserted" );
+	}
+
+	// Increment reference count when adding to the tree
+	withThis.m_impRC->IncRef();
+
+	TiXmlNode* pointer = GetTiXmlPointer()->ReplaceChild( replaceThis->GetTiXmlPointer(), *withThis.GetTiXmlPointer() );
+	if ( 0 == pointer )
+	{
+		TICPPTHROW( "Node can't be inserted" );
+	}
+
+	return NodeFactory( pointer );
+}
+
+void Node::RemoveChild( Node* removeThis )
+{
+	if  ( !GetTiXmlPointer()->RemoveChild( removeThis->GetTiXmlPointer() ) )
+	{
+		TICPPTHROW( "Node to remove (" << removeThis->Value() << ") is not a child of this Node (" << Value() << ")" )
+	}
+}
+
+Node* Node::PreviousSibling( bool throwIfNoSiblings ) const
+{
+	return PreviousSibling( "", throwIfNoSiblings );
+}
+
+Node* Node::PreviousSibling( const std::string& value, bool throwIfNoSiblings ) const
+{
+	return PreviousSibling( value.c_str(), throwIfNoSiblings );
+}
+
+Node* Node::PreviousSibling( const char* value, bool throwIfNoSiblings ) const
+{
+	TiXmlNode* sibling;
+	if ( 0 == strlen( value ) )
+	{
+		sibling = GetTiXmlPointer()->PreviousSibling();
+	}
+	else
+	{
+		sibling = GetTiXmlPointer()->PreviousSibling( value );
+	}
+
+	if ( ( 0 == sibling ) && throwIfNoSiblings )
+	{
+		TICPPTHROW( "No Siblings found with value, '" << value << "', Prior to this Node (" << Value() << ")" )
+	}
+
+	return NodeFactory( sibling, false );
+}
+
+Node* Node::NextSibling( bool throwIfNoSiblings ) const
+{
+	return NextSibling( "", throwIfNoSiblings );
+}
+
+Node* Node::NextSibling( const std::string& value, bool throwIfNoSiblings ) const
+{
+	return NextSibling( value.c_str(), throwIfNoSiblings );
+}
+
+Node* Node::NextSibling( const char* value, bool throwIfNoSiblings ) const
+{
+	TiXmlNode* sibling;
+	if ( 0 == strlen( value ) )
+	{
+		sibling = GetTiXmlPointer()->NextSibling();
+	}
+	else
+	{
+		sibling = GetTiXmlPointer()->NextSibling( value );
+	}
+
+	if ( ( 0 == sibling ) && throwIfNoSiblings )
+	{
+		TICPPTHROW( "No Siblings found with value, '" << value << "', After this Node (" << Value() << ")" )
+	}
+
+	return NodeFactory( sibling, false );
+}
+
+Element* Node::NextSiblingElement( bool throwIfNoSiblings ) const
+{
+	return NextSiblingElement( "", throwIfNoSiblings );
+}
+
+Element* Node::NextSiblingElement( const std::string& value, bool throwIfNoSiblings ) const
+{
+	return NextSiblingElement( value.c_str(), throwIfNoSiblings );
+}
+
+Element* Node::NextSiblingElement( const char* value, bool throwIfNoSiblings ) const
+{
+	TiXmlElement* sibling;
+	if ( 0 == strlen( value ) )
+	{
+		sibling = GetTiXmlPointer()->NextSiblingElement();
+	}
+	else
+	{
+		sibling = GetTiXmlPointer()->NextSiblingElement( value );
+	}
+
+	if ( 0 == sibling )
+	{
+		if ( throwIfNoSiblings )
+		{
+			TICPPTHROW( "No Element Siblings found with value, '" << value << "', After this Node (" << Value() << ")" )
+		}
+		else
+		{
+			return 0;
+		}
+	}
+
+	Element* temp = new Element( sibling );
+	sibling->m_spawnedWrappers.push_back( temp );
+
+	return temp;
+}
+
+Element* Node::FirstChildElement( bool throwIfNoChildren ) const
+{
+	return FirstChildElement( "", throwIfNoChildren );
+}
+
+Element* Node::FirstChildElement( const std::string& value, bool throwIfNoChildren ) const
+{
+	return FirstChildElement( value.c_str(), throwIfNoChildren );
+}
+
+Element* Node::FirstChildElement( const char* value, bool throwIfNoChildren ) const
+{
+	TiXmlElement* element;
+	if ( 0 == strlen( value ) )
+	{
+		element = GetTiXmlPointer()->FirstChildElement();
+	}
+	else
+	{
+		element = GetTiXmlPointer()->FirstChildElement( value );
+	}
+
+	if ( 0 == element )
+	{
+		if( throwIfNoChildren )
+		{
+			TICPPTHROW( "Element (" << Value() << ") does NOT contain a child with the value of '" << value << "'" )
+		}
+		else
+		{
+			return 0;
+		}
+	}
+
+	Element* temp = new Element( element );
+	element->m_spawnedWrappers.push_back( temp );
+
+	return temp;
+}
+
+int Node::Type() const
+{
+	return GetTiXmlPointer()->Type();
+}
+
+Document* Node::GetDocument( bool throwIfNoDocument ) const
+{
+	TiXmlDocument* doc = GetTiXmlPointer()->GetDocument();
+	if ( 0 == doc )
+	{
+		if( throwIfNoDocument )
+		{
+			TICPPTHROW( "This node (" << Value() << ") is not linked under a document" )
+		}
+		else
+		{
+			return 0;
+		}
+	}
+	Document* temp = new Document( doc );
+	doc->m_spawnedWrappers.push_back( temp );
+
+	return temp;
+}
+
+bool Node::NoChildren() const
+{
+	return GetTiXmlPointer()->NoChildren();
+}
+
+Document* Node::ToDocument() const
+{
+	TiXmlDocument* doc = GetTiXmlPointer()->ToDocument();
+	if ( 0 == doc )
+	{
+		TICPPTHROW( "This node (" << Value() << ") is not a Document" )
+	}
+	Document* temp = new Document( doc );
+	doc->m_spawnedWrappers.push_back( temp );
+
+	return temp;
+}
+
+Element* Node::ToElement() const
+{
+	TiXmlElement* doc = GetTiXmlPointer()->ToElement();
+	if ( 0 == doc )
+	{
+		TICPPTHROW( "This node (" << Value() << ") is not a Element" )
+	}
+	Element* temp = new Element( doc );
+	doc->m_spawnedWrappers.push_back( temp );
+
+	return temp;
+}
+
+Comment* Node::ToComment() const
+{
+	TiXmlComment* doc = GetTiXmlPointer()->ToComment();
+	if ( 0 == doc )
+	{
+		TICPPTHROW( "This node (" << Value() << ") is not a Comment" )
+	}
+	Comment* temp = new Comment( doc );
+	doc->m_spawnedWrappers.push_back( temp );
+
+	return temp;
+}
+
+Text* Node::ToText() const
+{
+	TiXmlText* doc = GetTiXmlPointer()->ToText();
+	if ( 0 == doc )
+	{
+		TICPPTHROW( "This node (" << Value() << ") is not a Text" )
+	}
+	Text* temp = new Text( doc );
+	doc->m_spawnedWrappers.push_back( temp );
+
+	return temp;
+}
+
+Declaration* Node::ToDeclaration() const
+{
+	TiXmlDeclaration* doc = GetTiXmlPointer()->ToDeclaration();
+	if ( 0 == doc )
+	{
+		TICPPTHROW( "This node (" << Value() << ") is not a Declaration" )
+	}
+	Declaration* temp = new Declaration( doc );
+	doc->m_spawnedWrappers.push_back( temp );
+
+	return temp;
+}
+
+StylesheetReference* Node::ToStylesheetReference() const
+{
+	TiXmlStylesheetReference* doc = GetTiXmlPointer()->ToStylesheetReference();
+	if ( 0 == doc )
+	{
+		TICPPTHROW( "This node (" << Value() << ") is not a StylesheetReference" )
+	}
+	StylesheetReference* temp = new StylesheetReference( doc );
+	doc->m_spawnedWrappers.push_back( temp );
+
+	return temp;
+}
+
+std::auto_ptr< Node > Node::Clone() const
+{
+	TiXmlNode* node = GetTiXmlPointer()->Clone();
+	if ( 0 == node )
+	{
+		TICPPTHROW( "Node could not be cloned" );
+	}
+	std::auto_ptr< Node > temp( NodeFactory( node, false, false ) );
+
+	// Take ownership of the memory from TiXml
+	temp->m_impRC->InitRef();
+
+	return temp;
+}
+
+bool Node::Accept( TiXmlVisitor* visitor ) const
+{
+	return GetTiXmlPointer()->Accept( visitor );
+}
+
+//*****************************************************************************
+
+Comment::Comment()
+: NodeImp< TiXmlComment >( new TiXmlComment() )
+{
+	m_impRC->InitRef();
+}
+
+Comment::Comment( TiXmlComment* comment )
+: NodeImp< TiXmlComment >( comment )
+{
+}
+
+Comment::Comment( const std::string& comment )
+: NodeImp< TiXmlComment >( new TiXmlComment() )
+{
+	m_impRC->InitRef();
+	m_tiXmlPointer->SetValue( comment );
+}
+
+//*****************************************************************************
+
+Text::Text()
+: NodeImp< TiXmlText >( new TiXmlText("") )
+{
+	m_impRC->InitRef();
+}
+
+
+Text::Text( const std::string& value )
+: NodeImp< TiXmlText >( new TiXmlText( value ) )
+{
+	m_impRC->InitRef();
+}
+
+Text::Text( TiXmlText* text )
+: NodeImp< TiXmlText >( text )
+{
+}
+
+
+//*****************************************************************************
+
+Document::Document()
+: NodeImp< TiXmlDocument >( new TiXmlDocument() )
+{
+	m_impRC->InitRef();
+}
+
+Document::Document( TiXmlDocument* document )
+: NodeImp< TiXmlDocument >( document )
+{
+}
+
+Document::Document( const char* documentName )
+: NodeImp< TiXmlDocument >( new TiXmlDocument( documentName ) )
+{
+	m_impRC->InitRef();
+}
+
+Document::Document( const std::string& documentName )
+: NodeImp< TiXmlDocument >( new TiXmlDocument( documentName ) )
+{
+	m_impRC->InitRef();
+}
+
+void Document::LoadFile( TiXmlEncoding encoding )
+{
+	if ( !m_tiXmlPointer->LoadFile( encoding ) )
+	{
+		TICPPTHROW( "Couldn't load " << m_tiXmlPointer->Value() );
+	}
+}
+
+void Document::SaveFile( void ) const
+{
+	if ( !m_tiXmlPointer->SaveFile() )
+	{
+		TICPPTHROW( "Couldn't save " << m_tiXmlPointer->Value() );
+	}
+}
+
+void Document::LoadFile( const std::string& filename, TiXmlEncoding encoding )
+{
+	if ( !m_tiXmlPointer->LoadFile( filename.c_str(), encoding ) )
+	{
+		TICPPTHROW( "Couldn't load " << filename );
+	}
+}
+
+void Document::LoadFile( const char* filename, TiXmlEncoding encoding )
+{
+	if ( !m_tiXmlPointer->LoadFile( filename, encoding ) )
+	{
+		TICPPTHROW( "Couldn't load " << filename );
+	}
+}
+
+void Document::SaveFile( const std::string& filename ) const
+{
+	if ( !m_tiXmlPointer->SaveFile( filename.c_str() ) )
+	{
+		TICPPTHROW( "Couldn't save " << filename );
+	}
+}
+
+void Document::Parse( const std::string& xml, bool throwIfParseError, TiXmlEncoding encoding )
+{
+	m_tiXmlPointer->Parse( xml.c_str(), 0, encoding );
+	if( throwIfParseError && m_tiXmlPointer->Error() )
+	{
+		TICPPTHROW( "Error parsing xml." );
+	}
+}
+
+//*****************************************************************************
+
+Element::Element()
+: NodeImp< TiXmlElement >( new TiXmlElement( "DefaultValueCausedByCreatingAnElementWithNoParameters" ) )
+{
+	m_impRC->InitRef();
+}
+
+Element::Element( const std::string& value )
+: NodeImp< TiXmlElement >( new TiXmlElement( value ) )
+{
+	m_impRC->InitRef();
+}
+
+Element::Element( const char* value )
+: NodeImp< TiXmlElement >( new TiXmlElement( value ) )
+{
+	m_impRC->InitRef();
+}
+
+Element::Element( TiXmlElement* element )
+: NodeImp< TiXmlElement >( element )
+{
+}
+
+Attribute* Element::FirstAttribute( bool throwIfNoAttributes ) const
+{
+	ValidatePointer();
+	TiXmlAttribute* attribute = m_tiXmlPointer->FirstAttribute();
+	if ( ( 0 == attribute ) && throwIfNoAttributes )
+	{
+		TICPPTHROW( "This Element (" << Value() << ") has no attributes" )
+	}
+
+	if ( 0 == attribute )
+	{
+		if( throwIfNoAttributes )
+		{
+			TICPPTHROW( "Element (" << Value() << ") has no attributes" )
+		}
+		else
+		{
+			return 0;
+		}
+	}
+
+	Attribute* temp = new Attribute( attribute );
+	attribute->m_spawnedWrappers.push_back( temp );
+
+	return temp;
+}
+
+Attribute* Element::LastAttribute( bool throwIfNoAttributes ) const
+{
+	ValidatePointer();
+	TiXmlAttribute* attribute = m_tiXmlPointer->LastAttribute();
+	if ( ( 0 == attribute ) && throwIfNoAttributes )
+	{
+		TICPPTHROW( "This Element (" << Value() << ") has no attributes" )
+	}
+
+	if ( 0 == attribute )
+	{
+		if( throwIfNoAttributes )
+		{
+			TICPPTHROW( "Element (" << Value() << ") has no attributes" )
+		}
+		else
+		{
+			return 0;
+		}
+	}
+
+	Attribute* temp = new Attribute( attribute );
+	attribute->m_spawnedWrappers.push_back( temp );
+
+	return temp;
+}
+
+std::string Element::GetAttributeOrDefault( const std::string& name, const std::string& defaultValue ) const
+{
+	std::string value;
+	if ( !GetAttributeImp( name, &value ) )
+	{
+		return defaultValue;
+	}
+	return value;
+}
+
+std::string Element::GetAttribute( const std::string& name ) const
+{
+	return GetAttributeOrDefault( name, std::string() );
+}
+
+bool Element::HasAttribute( const std::string& name ) const
+{
+	ValidatePointer();
+	return ( 0 != m_tiXmlPointer->Attribute( name.c_str() ) );
+}
+
+void Element::RemoveAttribute( const std::string& name )
+{
+	ValidatePointer();
+	m_tiXmlPointer->RemoveAttribute( name.c_str() );
+}
+
+bool Element::GetAttributeImp( const std::string& name, std::string* value ) const
+{
+	ValidatePointer();
+
+	// Get value from TinyXML, if the attribute exists
+	const char* retVal = m_tiXmlPointer->Attribute( name.c_str() );
+
+	// TinyXML returns NULL if the attribute doesn't exist
+	if ( 0 == retVal )
+	{
+		return false;
+	}
+	else
+	{
+		*value = retVal;
+		return true;
+	}
+}
+
+bool Element::GetTextImp( std::string* value ) const
+{
+	ValidatePointer();
+
+	// Get value from TinyXML, if the attribute exists
+	const char* retVal = m_tiXmlPointer->GetText();
+
+	// TinyXML returns NULL if the attribute doesn't exist
+	if ( 0 == retVal )
+	{
+		return false;
+	}
+	else
+	{
+		*value = retVal;
+		return true;
+	}
+}
+
+//*****************************************************************************
+
+Declaration::Declaration()
+: NodeImp< TiXmlDeclaration >( new TiXmlDeclaration() )
+{
+	m_impRC->InitRef();
+}
+
+Declaration::Declaration( TiXmlDeclaration* declaration )
+: NodeImp< TiXmlDeclaration >( declaration )
+{
+}
+
+Declaration::Declaration( const std::string& version, const std::string& encoding, const std::string& standalone )
+: NodeImp< TiXmlDeclaration >( new TiXmlDeclaration( version, encoding, standalone ) )
+{
+	m_impRC->InitRef();
+}
+
+std::string Declaration::Version() const
+{
+	return m_tiXmlPointer->Version();
+}
+
+std::string Declaration::Encoding() const
+{
+	return m_tiXmlPointer->Encoding();
+}
+
+std::string Declaration::Standalone() const
+{
+	return m_tiXmlPointer->Standalone();
+}
+
+//*****************************************************************************
+
+StylesheetReference::StylesheetReference()
+: NodeImp< TiXmlStylesheetReference >( new TiXmlStylesheetReference() )
+{
+	m_impRC->InitRef();
+}
+
+StylesheetReference::StylesheetReference( TiXmlStylesheetReference* stylesheetReference )
+: NodeImp< TiXmlStylesheetReference >( stylesheetReference )
+{
+}
+
+StylesheetReference::StylesheetReference( const std::string& type, const std::string& href )
+: NodeImp< TiXmlStylesheetReference >( new TiXmlStylesheetReference( type, href ) )
+{
+	m_impRC->InitRef();
+}
+
+std::string StylesheetReference::Type() const
+{
+	return m_tiXmlPointer->Type();
+}
+
+std::string StylesheetReference::Href() const
+{
+	return m_tiXmlPointer->Href();
+}
+
+//*****************************************************************************
+
+Exception::Exception(const std::string &details)
+:
+m_details( details )
+{
+
+}
+
+Exception::~Exception() throw()
+{
+}
+
+const char* Exception::what() const throw()
+{
+	return m_details.c_str();
+}
+
+//*****************************************************************************
+
+TiCppRC::TiCppRC()
+{
+	// Spawn reference counter for this object
+	m_tiRC = new TiCppRCImp( this );
+}
+
+void TiCppRC::DeleteSpawnedWrappers()
+{
+	std::vector< Base* >::reverse_iterator wrapper;
+	for ( wrapper = m_spawnedWrappers.rbegin(); wrapper != m_spawnedWrappers.rend(); ++wrapper )
+	{
+		delete *wrapper;
+	}
+	m_spawnedWrappers.clear();
+}
+		
+TiCppRC::~TiCppRC()
+{	
+	DeleteSpawnedWrappers();
+	
+	// Set pointer held by reference counter to NULL
+	this->m_tiRC->Nullify();
+
+	// Decrement reference - so reference counter will delete itself if necessary
+	this->m_tiRC->DecRef();
+}
+
+//*****************************************************************************
+
+TiCppRCImp::TiCppRCImp( TiCppRC* tiCppRC )
+	: m_count( 1 ), m_tiCppRC ( tiCppRC )
+{
+}
+
+void TiCppRCImp::IncRef()
+{
+	m_count++;
+}
+
+void TiCppRCImp::DecRef()
+{
+	m_count--;
+	if ( 0 == m_count )
+	{
+		delete m_tiCppRC;
+		delete this;
+	}
+}
+
+void TiCppRCImp::InitRef()
+{
+	m_count = 1;
+}
+
+void TiCppRCImp::Nullify()
+{
+	m_tiCppRC = 0;
+}
+
+TiCppRC* TiCppRCImp::Get()
+{
+	return m_tiCppRC;
+}
+
+bool TiCppRCImp::IsNull()
+{
+	return 0 == m_tiCppRC;
+}
+
+#endif // TIXML_USE_TICPP
Index: /code/branches/buildsystem3/src/tinyxml/ticpp.h
===================================================================
--- /code/branches/buildsystem3/src/tinyxml/ticpp.h	(revision 2663)
+++ /code/branches/buildsystem3/src/tinyxml/ticpp.h	(revision 2664)
@@ -1,4 +1,2 @@
-#define TIXML_USE_TICPP
-
 /*
 http://code.google.com/p/ticpp/
@@ -30,5 +28,4 @@
 @date		04/11/2006
 
-@version  0.04b by nico@orxonox.net: gcc-4.3 compilation hotfixes
 @version	0.04a by edam@waxworlds.org: based Exception based on std::exception; added stream
 					<< and >> support; added Document::Parse(); bug fix; improved THROW() macro.
@@ -94,4 +91,5 @@
 		file = file.substr( file.find_last_of( "\\/" ) + 1 );				\
 		full_message << message << " <" << file << "@" << __LINE__ << ">";	\
+		full_message << BuildDetailedErrorString();							\
 		throw Exception( full_message.str() );								\
 	}
@@ -221,9 +219,50 @@
 
 		/**
+		Compare internal TiXml pointers to determine is both are wrappers around the same node
+		*/
+		bool operator == ( const Base& rhs ) const
+		{
+			return ( GetBasePointer() == rhs.GetBasePointer() );
+		}
+		
+		/**
+		Compare internal TiXml pointers to determine is both are wrappers around the same node
+		*/
+		bool operator != ( const Base& rhs ) const
+		{
+			return ( GetBasePointer() != rhs.GetBasePointer() );
+		}
+		
+		/**
+		Builds detailed error string using TiXmlDocument::Error() and others
+		*/
+		std::string BuildDetailedErrorString() const
+		{
+			std::ostringstream full_message;
+			#ifndef TICPP_NO_RTTI
+			TiXmlNode* node = dynamic_cast< TiXmlNode* >( GetBasePointer() );
+			if ( node != 0 )
+			{
+				TiXmlDocument* doc = node->GetDocument();
+				if ( doc != 0 )
+				{
+					if ( doc->Error() )
+					{
+						full_message 	<< "\nDescription: " << doc->ErrorDesc()
+										<< "\nFile: " << (strlen( doc->Value() ) > 0 ? doc->Value() : "<unnamed-file>") 
+										<< "\nLine: " << doc->ErrorRow() 
+										<< "\nColumn: " << doc->ErrorCol();
+					}
+				}
+			}
+			#endif
+			return full_message.str();
+		}
+
+		/**
 		Destructor
 		*/
 		virtual ~Base()
 		{
-			DeleteSpawnedWrappers();
 		}
 
@@ -231,6 +270,4 @@
 		mutable TiCppRCImp* m_impRC;	/**< Holds status of internal TiXmlPointer - use this to determine if object has been deleted already */
 
-		mutable std::vector< Base* > m_spawnedWrappers; /**< Remember all wrappers that we've created with 'new' - ( e.g. NodeFactory, FirstChildElement, etc. )*/
-
 		/**
 		@internal
@@ -250,19 +287,5 @@
 				TICPPTHROW( "Internal TiXml Pointer is NULL" );
 			}
-		}
-
-		/**
-		@internal
-		Delete all container objects we've spawned with 'new'.
-		*/
-		void DeleteSpawnedWrappers()
-		{
-			std::vector< Base* >::reverse_iterator wrapper;
-			for ( wrapper = m_spawnedWrappers.rbegin(); wrapper != m_spawnedWrappers.rend(); ++wrapper )
-			{
-				delete *wrapper;
-			}
-			m_spawnedWrappers.clear();
-		}
+		}		
 
 		/**
@@ -875,4 +898,5 @@
 		bool NoChildren() const;
 
+		#ifndef TICPP_NO_RTTI
 		/**
 		Pointer conversion ( NOT OBJECT CONVERSION ) - replaces TiXmlNode::ToElement, TiXmlNode::ToDocument, TiXmlNode::ToComment, etc.
@@ -895,4 +919,5 @@
 			return pointer;
 		}
+		#endif
 
 		/**
@@ -1085,6 +1110,6 @@
 
 		/// Constructor
-		Iterator( const Iterator& it, const std::string& value  = "" )
-			: m_p( it.m_p ), m_value( value )
+		Iterator( const Iterator& it )
+			: m_p( it.m_p ), m_value( it.m_value )
 		{
 		}
@@ -1103,4 +1128,5 @@
 		{
 			m_p = it.m_p;
+			m_value = it.m_value;
 			return *this;
 		}
@@ -1121,7 +1147,9 @@
 
 		/** Sets internal pointer to the Next Sibling, or Iterator::END, if there are no more siblings */
-		Iterator& operator++(int)
-		{
-			return this->operator ++();
+		Iterator operator++(int)
+		{
+			Iterator tmp(*this);
+			++(*this);
+			return tmp;
 		}
 
@@ -1134,13 +1162,23 @@
 
 		/** Sets internal pointer to the Previous Sibling, or Iterator::END, if there are no prior siblings */
-		Iterator& operator--(int)
-		{
-			return this->operator --();
+		Iterator operator--(int)
+		{			
+			Iterator tmp(*this);
+			--(*this);
+			return tmp;
 		}
 
 		/** Compares internal pointer */
-		bool operator!=( T* p ) const
-		{
-			return m_p != p;
+		bool operator!=( const T* p ) const
+		{
+			if ( m_p == p )
+			{
+				return false;
+			}
+			if ( 0 == m_p || 0 == p )
+			{
+				return true;
+			}
+			return *m_p != *p;
 		}
 
@@ -1148,5 +1186,5 @@
 		bool operator!=( const Iterator& it ) const
 		{
-			return m_p != it.m_p;
+			return operator!=( it.m_p );
 		}
 
@@ -1154,5 +1192,13 @@
 		bool operator==( T* p ) const
 		{
-			return m_p == p;
+			if ( m_p == p )
+			{
+				return true;
+			}
+			if ( 0 == m_p || 0 == p )
+			{
+				return false;
+			}
+			return *m_p == *p;
 		}
 
@@ -1160,5 +1206,5 @@
 		bool operator==( const Iterator& it ) const
 		{
-			return m_p == it.m_p;
+			return operator==( it.m_p );
 		}
 
@@ -1220,5 +1266,9 @@
 			if ( 0 == tiXmlPointer )
 			{
-				TICPPTHROW( "Can not create a " << typeid( T ).name() );
+				#ifdef TICPP_NO_RTTI
+					TICPPTHROW( "Can not create TinyXML objext" );
+				#else
+					TICPPTHROW( "Can not create a " << typeid( T ).name() );
+				#endif
 			}
 			SetTiXmlPointer( tiXmlPointer );
@@ -1233,6 +1283,4 @@
 		virtual void operator=( const NodeImp<T>& copy )
 		{
-			DeleteSpawnedWrappers();
-
 			// Dropping the reference to the old object
 			this->m_impRC->DecRef();
@@ -1267,6 +1315,4 @@
 		virtual ~NodeImp()
 		{
-			// The spawnedWrappers need to be deleted before m_tiXmlPointer
-			DeleteSpawnedWrappers();
 			m_impRC->DecRef();
 		}
@@ -1685,4 +1731,35 @@
 
 		/**
+		Returns an attribute of @a name from an element.
+		Uses FromString to convert the string to the type of choice.
+
+		@param name				The name of the attribute you are querying.
+		@param throwIfNotFound	[DEF]	If true, will throw an exception if the attribute doesn't exist
+		@throws Exception When the attribute doesn't exist and throwIfNotFound is true
+		@see GetAttributeOrDefault
+		*/
+		template < class T >
+			T GetAttribute( const std::string& name, bool throwIfNotFound = true ) const
+		{
+			// Get the attribute's value as a std::string
+			std::string temp;
+			T value;
+			if ( !GetAttributeImp( name, &temp ) )
+			{
+				if ( throwIfNotFound )
+				{
+					TICPPTHROW( "Attribute does not exist" );
+				}
+			}
+			else
+			{
+				// Stream the value from the string to T
+				FromString( temp, &value );
+			}
+
+			return value;
+		}
+
+		/**
 		Gets an attribute of @a name from an element.
 		Uses FromString to convert the string to the type of choice.
@@ -1727,4 +1804,19 @@
 		std::string GetAttribute( const std::string& name ) const;
 
+		/**
+		Returns true, if attribute exists
+
+		@param name The name of the attribute you are checking.
+		@return Existence of attribute
+		*/
+		bool HasAttribute( const std::string& name ) const;
+
+		/**
+		Removes attribute from element.
+
+		@param name The name of the attribute to remove.
+		*/
+		void RemoveAttribute( const std::string& name );
+
 	private:
 
Index: /code/branches/buildsystem3/src/tinyxml/ticpprc.h
===================================================================
--- /code/branches/buildsystem3/src/tinyxml/ticpprc.h	(revision 2663)
+++ /code/branches/buildsystem3/src/tinyxml/ticpprc.h	(revision 2664)
@@ -1,4 +1,2 @@
-#define TIXML_USE_TICPP
-
 /*
 http://code.google.com/p/ticpp/
@@ -28,4 +26,5 @@
 #define TICPPRC_INCLUDED
 
+#include <vector>
 
 // Forward declare ticpp::Node, so it can be made a friend of TiCppRC
@@ -64,4 +63,11 @@
 	*/
 	virtual ~TiCppRC();
+	
+	std::vector< ticpp::Base* > m_spawnedWrappers; /**< Remember all wrappers that we've created with 'new' - ( e.g. NodeFactory, FirstChildElement, etc. )*/
+
+	/**
+	Delete all container objects we've spawned with 'new'.
+	*/
+	void DeleteSpawnedWrappers();
 };
 
Index: de/branches/buildsystem3/src/tinyxml/tinystr.cc
===================================================================
--- /code/branches/buildsystem3/src/tinyxml/tinystr.cc	(revision 2663)
+++ 	(revision )
@@ -1,116 +1,0 @@
-/*
-www.sourceforge.net/projects/tinyxml
-Original file by Yves Berquin.
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any
-damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any
-purpose, including commercial applications, and to alter it and
-redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must
-not claim that you wrote the original software. If you use this
-software in a product, an acknowledgment in the product documentation
-would be appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and
-must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
-distribution.
-*/
-
-/*
- * THIS FILE WAS ALTERED BY Tyge Løvset, 7. April 2005.
- */
-
-
-#ifndef TIXML_USE_STL
-
-#include "tinystr.h"
-
-// Error value for find primitive
-const TiXmlString::size_type TiXmlString::npos = static_cast< TiXmlString::size_type >(-1);
-
-
-// Null rep.
-TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, { '\0' } };
-
-
-void TiXmlString::reserve (size_type cap)
-{
-	if (cap > capacity())
-	{
-		TiXmlString tmp;
-		tmp.init(length(), cap);
-		memcpy(tmp.start(), data(), length());
-		swap(tmp);
-	}
-}
-
-
-TiXmlString& TiXmlString::assign(const char* str, size_type len)
-{
-	size_type cap = capacity();
-	if (len > cap || cap > 3*(len + 8))
-	{
-		TiXmlString tmp;
-		tmp.init(len);
-		memcpy(tmp.start(), str, len);
-		swap(tmp);
-	}
-	else
-	{
-		memmove(start(), str, len);
-		set_size(len);
-	}
-	return *this;
-}
-
-
-TiXmlString& TiXmlString::append(const char* str, size_type len)
-{
-	size_type newsize = length() + len;
-	if (newsize > capacity())
-	{
-		reserve (newsize + capacity());
-	}
-	memmove(finish(), str, len);
-	set_size(newsize);
-	return *this;
-}
-
-
-TiXmlString operator + (const TiXmlString & a, const TiXmlString & b)
-{
-	TiXmlString tmp;
-	tmp.reserve(a.length() + b.length());
-	tmp += a;
-	tmp += b;
-	return tmp;
-}
-
-TiXmlString operator + (const TiXmlString & a, const char* b)
-{
-	TiXmlString tmp;
-	TiXmlString::size_type b_len = static_cast<TiXmlString::size_type>( strlen(b) );
-	tmp.reserve(a.length() + b_len);
-	tmp += a;
-	tmp.append(b, b_len);
-	return tmp;
-}
-
-TiXmlString operator + (const char* a, const TiXmlString & b)
-{
-	TiXmlString tmp;
-	TiXmlString::size_type a_len = static_cast<TiXmlString::size_type>( strlen(a) );
-	tmp.reserve(a_len + b.length());
-	tmp.append(a, a_len);
-	tmp += b;
-	return tmp;
-}
-
-
-#endif	// TIXML_USE_STL
Index: /code/branches/buildsystem3/src/tinyxml/tinystr.cpp
===================================================================
--- /code/branches/buildsystem3/src/tinyxml/tinystr.cpp	(revision 2664)
+++ /code/branches/buildsystem3/src/tinyxml/tinystr.cpp	(revision 2664)
@@ -0,0 +1,116 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original file by Yves Berquin.
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+
+/*
+ * THIS FILE WAS ALTERED BY Tyge Løvset, 7. April 2005.
+ */
+
+
+#ifndef TIXML_USE_STL
+
+#include "tinystr.h"
+
+// Error value for find primitive
+const TiXmlString::size_type TiXmlString::npos = static_cast< TiXmlString::size_type >(-1);
+
+
+// Null rep.
+TiXmlString::Rep TiXmlString::nullrep_ = { 0, 0, { '\0' } };
+
+
+void TiXmlString::reserve (size_type cap)
+{
+	if (cap > capacity())
+	{
+		TiXmlString tmp;
+		tmp.init(length(), cap);
+		memcpy(tmp.start(), data(), length());
+		swap(tmp);
+	}
+}
+
+
+TiXmlString& TiXmlString::assign(const char* str, size_type len)
+{
+	size_type cap = capacity();
+	if (len > cap || cap > 3*(len + 8))
+	{
+		TiXmlString tmp;
+		tmp.init(len);
+		memcpy(tmp.start(), str, len);
+		swap(tmp);
+	}
+	else
+	{
+		memmove(start(), str, len);
+		set_size(len);
+	}
+	return *this;
+}
+
+
+TiXmlString& TiXmlString::append(const char* str, size_type len)
+{
+	size_type newsize = length() + len;
+	if (newsize > capacity())
+	{
+		reserve (newsize + capacity());
+	}
+	memmove(finish(), str, len);
+	set_size(newsize);
+	return *this;
+}
+
+
+TiXmlString operator + (const TiXmlString & a, const TiXmlString & b)
+{
+	TiXmlString tmp;
+	tmp.reserve(a.length() + b.length());
+	tmp += a;
+	tmp += b;
+	return tmp;
+}
+
+TiXmlString operator + (const TiXmlString & a, const char* b)
+{
+	TiXmlString tmp;
+	TiXmlString::size_type b_len = static_cast<TiXmlString::size_type>( strlen(b) );
+	tmp.reserve(a.length() + b_len);
+	tmp += a;
+	tmp.append(b, b_len);
+	return tmp;
+}
+
+TiXmlString operator + (const char* a, const TiXmlString & b)
+{
+	TiXmlString tmp;
+	TiXmlString::size_type a_len = static_cast<TiXmlString::size_type>( strlen(a) );
+	tmp.reserve(a_len + b.length());
+	tmp.append(a, a_len);
+	tmp += b;
+	return tmp;
+}
+
+
+#endif	// TIXML_USE_STL
Index: de/branches/buildsystem3/src/tinyxml/tinyxml.cc
===================================================================
--- /code/branches/buildsystem3/src/tinyxml/tinyxml.cc	(revision 2663)
+++ 	(revision )
@@ -1,1961 +1,0 @@
-/*
-www.sourceforge.net/projects/tinyxml
-Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any
-damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any
-purpose, including commercial applications, and to alter it and
-redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must
-not claim that you wrote the original software. If you use this
-software in a product, an acknowledgment in the product documentation
-would be appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and
-must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
-distribution.
-*/
-#include "tinyxml.h"
-
-#include <ctype.h>
-
-#ifdef TIXML_USE_STL
-#include <sstream>
-#include <iostream>
-#endif
-
-
-bool TiXmlBase::condenseWhiteSpace = true;
-
-// Microsoft compiler security
-FILE* TiXmlFOpen( const char* filename, const char* mode )
-{
-	#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
-		FILE* fp = 0;
-		errno_t err = fopen_s( &fp, filename, mode );
-		if ( !err && fp )
-			return fp;
-		return 0;
-	#else
-		return fopen( filename, mode );
-	#endif
-}
-
-void TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString )
-{
-	int i=0;
-
-	while( i<(int)str.length() )
-	{
-		unsigned char c = (unsigned char) str[i];
-
-		if (    c == '&'
-		     && i < ( (int)str.length() - 2 )
-			 && str[i+1] == '#'
-			 && str[i+2] == 'x' )
-		{
-			// Hexadecimal character reference.
-			// Pass through unchanged.
-			// &#xA9;	-- copyright symbol, for example.
-			//
-			// The -1 is a bug fix from Rob Laveaux. It keeps
-			// an overflow from happening if there is no ';'.
-			// There are actually 2 ways to exit this loop -
-			// while fails (error case) and break (semicolon found).
-			// However, there is no mechanism (currently) for
-			// this function to return an error.
-			while ( i<(int)str.length()-1 )
-			{
-				outString->append( str.c_str() + i, 1 );
-				++i;
-				if ( str[i] == ';' )
-					break;
-			}
-		}
-		else if ( c == '&' )
-		{
-			outString->append( entity[0].str, entity[0].strLength );
-			++i;
-		}
-		else if ( c == '<' )
-		{
-			outString->append( entity[1].str, entity[1].strLength );
-			++i;
-		}
-		else if ( c == '>' )
-		{
-			outString->append( entity[2].str, entity[2].strLength );
-			++i;
-		}
-		else if ( c == '\"' )
-		{
-			outString->append( entity[3].str, entity[3].strLength );
-			++i;
-		}
-		else if ( c == '\'' )
-		{
-			outString->append( entity[4].str, entity[4].strLength );
-			++i;
-		}
-		else if ( c < 32 )
-		{
-			// Easy pass at non-alpha/numeric/symbol
-			// Below 32 is symbolic.
-			char buf[ 32 ];
-
-			#if defined(TIXML_SNPRINTF)
-				TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) );
-			#else
-				sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) );
-			#endif
-
-			//*ME:	warning C4267: convert 'size_t' to 'int'
-			//*ME:	Int-Cast to make compiler happy ...
-			outString->append( buf, (int)strlen( buf ) );
-			++i;
-		}
-		else
-		{
-			//char realc = (char) c;
-			//outString->append( &realc, 1 );
-			*outString += (char) c;	// somewhat more efficient function call.
-			++i;
-		}
-	}
-}
-
-
-TiXmlNode::TiXmlNode( NodeType _type ) : TiXmlBase()
-{
-	parent = 0;
-	type = _type;
-	firstChild = 0;
-	lastChild = 0;
-	prev = 0;
-	next = 0;
-}
-
-
-TiXmlNode::~TiXmlNode()
-{
-	TiXmlNode* node = firstChild;
-	TiXmlNode* temp = 0;
-
-	while ( node )
-	{
-		temp = node;
-		node = node->next;
-		delete temp;
-	}
-}
-
-
-void TiXmlNode::CopyTo( TiXmlNode* target ) const
-{
-	target->SetValue (value.c_str() );
-	target->userData = userData;
-}
-
-
-void TiXmlNode::Clear()
-{
-	TiXmlNode* node = firstChild;
-	TiXmlNode* temp = 0;
-
-	while ( node )
-	{
-		temp = node;
-		node = node->next;
-		delete temp;
-	}
-
-	firstChild = 0;
-	lastChild = 0;
-}
-
-
-TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node )
-{
-	assert( node->parent == 0 || node->parent == this );
-	assert( node->GetDocument() == 0 || node->GetDocument() == this->GetDocument() );
-
-	if ( node->Type() == TiXmlNode::DOCUMENT )
-	{
-		delete node;
-		if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
-		return 0;
-	}
-
-	node->parent = this;
-
-	node->prev = lastChild;
-	node->next = 0;
-
-	if ( lastChild )
-		lastChild->next = node;
-	else
-		firstChild = node;			// it was an empty list.
-
-	lastChild = node;
-	return node;
-}
-
-
-TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis )
-{
-	if ( addThis.Type() == TiXmlNode::DOCUMENT )
-	{
-		if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
-		return 0;
-	}
-	TiXmlNode* node = addThis.Clone();
-	if ( !node )
-		return 0;
-
-	return LinkEndChild( node );
-}
-
-
-TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis )
-{
-	if ( !beforeThis || beforeThis->parent != this ) {
-		return 0;
-	}
-	if ( addThis.Type() == TiXmlNode::DOCUMENT )
-	{
-		if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
-		return 0;
-	}
-
-	TiXmlNode* node = addThis.Clone();
-	if ( !node )
-		return 0;
-	node->parent = this;
-
-	node->next = beforeThis;
-	node->prev = beforeThis->prev;
-	if ( beforeThis->prev )
-	{
-		beforeThis->prev->next = node;
-	}
-	else
-	{
-		assert( firstChild == beforeThis );
-		firstChild = node;
-	}
-	beforeThis->prev = node;
-	return node;
-}
-
-
-TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis )
-{
-	if ( !afterThis || afterThis->parent != this ) {
-		return 0;
-	}
-	if ( addThis.Type() == TiXmlNode::DOCUMENT )
-	{
-		if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
-		return 0;
-	}
-
-	TiXmlNode* node = addThis.Clone();
-	if ( !node )
-		return 0;
-	node->parent = this;
-
-	node->prev = afterThis;
-	node->next = afterThis->next;
-	if ( afterThis->next )
-	{
-		afterThis->next->prev = node;
-	}
-	else
-	{
-		assert( lastChild == afterThis );
-		lastChild = node;
-	}
-	afterThis->next = node;
-	return node;
-}
-
-
-TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis )
-{
-	if ( replaceThis->parent != this )
-		return 0;
-
-	TiXmlNode* node = withThis.Clone();
-	if ( !node )
-		return 0;
-
-	node->next = replaceThis->next;
-	node->prev = replaceThis->prev;
-
-	if ( replaceThis->next )
-		replaceThis->next->prev = node;
-	else
-		lastChild = node;
-
-	if ( replaceThis->prev )
-		replaceThis->prev->next = node;
-	else
-		firstChild = node;
-
-	delete replaceThis;
-	node->parent = this;
-	return node;
-}
-
-
-bool TiXmlNode::RemoveChild( TiXmlNode* removeThis )
-{
-	if ( removeThis->parent != this )
-	{
-		assert( 0 );
-		return false;
-	}
-
-	if ( removeThis->next )
-		removeThis->next->prev = removeThis->prev;
-	else
-		lastChild = removeThis->prev;
-
-	if ( removeThis->prev )
-		removeThis->prev->next = removeThis->next;
-	else
-		firstChild = removeThis->next;
-
-	delete removeThis;
-	return true;
-}
-
-const TiXmlNode* TiXmlNode::FirstChild( const char * _value ) const
-{
-	const TiXmlNode* node;
-	for ( node = firstChild; node; node = node->next )
-	{
-		if ( strcmp( node->Value(), _value ) == 0 )
-			return node;
-	}
-	return 0;
-}
-
-
-const TiXmlNode* TiXmlNode::LastChild( const char * _value ) const
-{
-	const TiXmlNode* node;
-	for ( node = lastChild; node; node = node->prev )
-	{
-		if ( strcmp( node->Value(), _value ) == 0 )
-			return node;
-	}
-	return 0;
-}
-
-
-const TiXmlNode* TiXmlNode::IterateChildren( const TiXmlNode* previous ) const
-{
-	if ( !previous )
-	{
-		return FirstChild();
-	}
-	else
-	{
-		assert( previous->parent == this );
-		return previous->NextSibling();
-	}
-}
-
-
-const TiXmlNode* TiXmlNode::IterateChildren( const char * val, const TiXmlNode* previous ) const
-{
-	if ( !previous )
-	{
-		return FirstChild( val );
-	}
-	else
-	{
-		assert( previous->parent == this );
-		return previous->NextSibling( val );
-	}
-}
-
-
-const TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const
-{
-	const TiXmlNode* node;
-	for ( node = next; node; node = node->next )
-	{
-		if ( strcmp( node->Value(), _value ) == 0 )
-			return node;
-	}
-	return 0;
-}
-
-
-const TiXmlNode* TiXmlNode::PreviousSibling( const char * _value ) const
-{
-	const TiXmlNode* node;
-	for ( node = prev; node; node = node->prev )
-	{
-		if ( strcmp( node->Value(), _value ) == 0 )
-			return node;
-	}
-	return 0;
-}
-
-
-void TiXmlElement::RemoveAttribute( const char * name )
-{
-    #ifdef TIXML_USE_STL
-	TIXML_STRING str( name );
-	TiXmlAttribute* node = attributeSet.Find( str );
-	#else
-	TiXmlAttribute* node = attributeSet.Find( name );
-	#endif
-	if ( node )
-	{
-		attributeSet.Remove( node );
-		delete node;
-	}
-}
-
-const TiXmlElement* TiXmlNode::FirstChildElement() const
-{
-	const TiXmlNode* node;
-
-	for (	node = FirstChild();
-			node;
-			node = node->NextSibling() )
-	{
-		if ( node->ToElement() )
-			return node->ToElement();
-	}
-	return 0;
-}
-
-
-const TiXmlElement* TiXmlNode::FirstChildElement( const char * _value ) const
-{
-	const TiXmlNode* node;
-
-	for (	node = FirstChild( _value );
-			node;
-			node = node->NextSibling( _value ) )
-	{
-		if ( node->ToElement() )
-			return node->ToElement();
-	}
-	return 0;
-}
-
-
-const TiXmlElement* TiXmlNode::NextSiblingElement() const
-{
-	const TiXmlNode* node;
-
-	for (	node = NextSibling();
-			node;
-			node = node->NextSibling() )
-	{
-		if ( node->ToElement() )
-			return node->ToElement();
-	}
-	return 0;
-}
-
-
-const TiXmlElement* TiXmlNode::NextSiblingElement( const char * _value ) const
-{
-	const TiXmlNode* node;
-
-	for (	node = NextSibling( _value );
-			node;
-			node = node->NextSibling( _value ) )
-	{
-		if ( node->ToElement() )
-			return node->ToElement();
-	}
-	return 0;
-}
-
-
-const TiXmlDocument* TiXmlNode::GetDocument() const
-{
-	const TiXmlNode* node;
-
-	for( node = this; node; node = node->parent )
-	{
-		if ( node->ToDocument() )
-			return node->ToDocument();
-	}
-	return 0;
-}
-
-
-TiXmlElement::TiXmlElement (const char * _value)
-	: TiXmlNode( TiXmlNode::ELEMENT )
-{
-	firstChild = lastChild = 0;
-	value = _value;
-}
-
-
-#ifdef TIXML_USE_STL
-TiXmlElement::TiXmlElement( const std::string& _value )
-	: TiXmlNode( TiXmlNode::ELEMENT )
-{
-	firstChild = lastChild = 0;
-	value = _value;
-}
-#endif
-
-
-TiXmlElement::TiXmlElement( const TiXmlElement& copy)
-	: TiXmlNode( TiXmlNode::ELEMENT )
-{
-	firstChild = lastChild = 0;
-	copy.CopyTo( this );
-}
-
-
-void TiXmlElement::operator=( const TiXmlElement& base )
-{
-	ClearThis();
-	base.CopyTo( this );
-}
-
-
-TiXmlElement::~TiXmlElement()
-{
-	ClearThis();
-}
-
-
-void TiXmlElement::ClearThis()
-{
-	Clear();
-	while( attributeSet.First() )
-	{
-		TiXmlAttribute* node = attributeSet.First();
-		attributeSet.Remove( node );
-		delete node;
-	}
-}
-
-
-const char* TiXmlElement::Attribute( const char* name ) const
-{
-	const TiXmlAttribute* node = attributeSet.Find( name );
-	if ( node )
-		return node->Value();
-	return 0;
-}
-
-
-#ifdef TIXML_USE_STL
-const std::string* TiXmlElement::Attribute( const std::string& name ) const
-{
-	const TiXmlAttribute* node = attributeSet.Find( name );
-	if ( node )
-		return &node->ValueStr();
-	return 0;
-}
-#endif
-
-
-const char* TiXmlElement::Attribute( const char* name, int* i ) const
-{
-	const char* s = Attribute( name );
-	if ( i )
-	{
-		if ( s ) {
-			*i = atoi( s );
-		}
-		else {
-			*i = 0;
-		}
-	}
-	return s;
-}
-
-
-#ifdef TIXML_USE_STL
-const std::string* TiXmlElement::Attribute( const std::string& name, int* i ) const
-{
-	const std::string* s = Attribute( name );
-	if ( i )
-	{
-		if ( s ) {
-			*i = atoi( s->c_str() );
-		}
-		else {
-			*i = 0;
-		}
-	}
-	return s;
-}
-#endif
-
-
-const char* TiXmlElement::Attribute( const char* name, double* d ) const
-{
-	const char* s = Attribute( name );
-	if ( d )
-	{
-		if ( s ) {
-			*d = atof( s );
-		}
-		else {
-			*d = 0;
-		}
-	}
-	return s;
-}
-
-
-#ifdef TIXML_USE_STL
-const std::string* TiXmlElement::Attribute( const std::string& name, double* d ) const
-{
-	const std::string* s = Attribute( name );
-	if ( d )
-	{
-		if ( s ) {
-			*d = atof( s->c_str() );
-		}
-		else {
-			*d = 0;
-		}
-	}
-	return s;
-}
-#endif
-
-
-int TiXmlElement::QueryIntAttribute( const char* name, int* ival ) const
-{
-	const TiXmlAttribute* node = attributeSet.Find( name );
-	if ( !node )
-		return TIXML_NO_ATTRIBUTE;
-	return node->QueryIntValue( ival );
-}
-
-
-#ifdef TIXML_USE_STL
-int TiXmlElement::QueryIntAttribute( const std::string& name, int* ival ) const
-{
-	const TiXmlAttribute* node = attributeSet.Find( name );
-	if ( !node )
-		return TIXML_NO_ATTRIBUTE;
-	return node->QueryIntValue( ival );
-}
-#endif
-
-
-int TiXmlElement::QueryDoubleAttribute( const char* name, double* dval ) const
-{
-	const TiXmlAttribute* node = attributeSet.Find( name );
-	if ( !node )
-		return TIXML_NO_ATTRIBUTE;
-	return node->QueryDoubleValue( dval );
-}
-
-
-#ifdef TIXML_USE_STL
-int TiXmlElement::QueryDoubleAttribute( const std::string& name, double* dval ) const
-{
-	const TiXmlAttribute* node = attributeSet.Find( name );
-	if ( !node )
-		return TIXML_NO_ATTRIBUTE;
-	return node->QueryDoubleValue( dval );
-}
-#endif
-
-
-void TiXmlElement::SetAttribute( const char * name, int val )
-{
-	char buf[64];
-	#if defined(TIXML_SNPRINTF)
-		TIXML_SNPRINTF( buf, sizeof(buf), "%d", val );
-	#else
-		sprintf( buf, "%d", val );
-	#endif
-	SetAttribute( name, buf );
-}
-
-
-#ifdef TIXML_USE_STL
-void TiXmlElement::SetAttribute( const std::string& name, int val )
-{
-   std::ostringstream oss;
-   oss << val;
-   SetAttribute( name, oss.str() );
-}
-#endif
-
-
-void TiXmlElement::SetDoubleAttribute( const char * name, double val )
-{
-	char buf[256];
-	#if defined(TIXML_SNPRINTF)
-		TIXML_SNPRINTF( buf, sizeof(buf), "%f", val );
-	#else
-		sprintf( buf, "%f", val );
-	#endif
-	SetAttribute( name, buf );
-}
-
-
-void TiXmlElement::SetAttribute( const char * cname, const char * cvalue )
-{
-    #ifdef TIXML_USE_STL
-	TIXML_STRING _name( cname );
-	TIXML_STRING _value( cvalue );
-	#else
-	const char* _name = cname;
-	const char* _value = cvalue;
-	#endif
-
-	TiXmlAttribute* node = attributeSet.Find( _name );
-	if ( node )
-	{
-		node->SetValue( _value );
-		return;
-	}
-
-	TiXmlAttribute* attrib = new TiXmlAttribute( cname, cvalue );
-	if ( attrib )
-	{
-		attributeSet.Add( attrib );
-	}
-	else
-	{
-		TiXmlDocument* document = GetDocument();
-		if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
-	}
-}
-
-
-#ifdef TIXML_USE_STL
-void TiXmlElement::SetAttribute( const std::string& name, const std::string& _value )
-{
-	TiXmlAttribute* node = attributeSet.Find( name );
-	if ( node )
-	{
-		node->SetValue( _value );
-		return;
-	}
-
-	TiXmlAttribute* attrib = new TiXmlAttribute( name, _value );
-	if ( attrib )
-	{
-		attributeSet.Add( attrib );
-	}
-	else
-	{
-		TiXmlDocument* document = GetDocument();
-		if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
-	}
-}
-#endif
-
-
-void TiXmlElement::Print( FILE* cfile, int depth ) const
-{
-	int i;
-	assert( cfile );
-	for ( i=0; i<depth; i++ ) {
-		fprintf( cfile, "    " );
-	}
-
-	fprintf( cfile, "<%s", value.c_str() );
-
-	const TiXmlAttribute* attrib;
-	for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
-	{
-		fprintf( cfile, " " );
-		attrib->Print( cfile, depth );
-	}
-
-	// There are 3 different formatting approaches:
-	// 1) An element without children is printed as a <foo /> node
-	// 2) An element with only a text child is printed as <foo> text </foo>
-	// 3) An element with children is printed on multiple lines.
-	TiXmlNode* node;
-	if ( !firstChild )
-	{
-		fprintf( cfile, " />" );
-	}
-	else if ( firstChild == lastChild && firstChild->ToText() )
-	{
-		fprintf( cfile, ">" );
-		firstChild->Print( cfile, depth + 1 );
-		fprintf( cfile, "</%s>", value.c_str() );
-	}
-	else
-	{
-		fprintf( cfile, ">" );
-
-		for ( node = firstChild; node; node=node->NextSibling() )
-		{
-			if ( !node->ToText() )
-			{
-				fprintf( cfile, "\n" );
-			}
-			node->Print( cfile, depth+1 );
-		}
-		fprintf( cfile, "\n" );
-		for( i=0; i<depth; ++i ) {
-			fprintf( cfile, "    " );
-		}
-		fprintf( cfile, "</%s>", value.c_str() );
-	}
-}
-
-
-void TiXmlElement::CopyTo( TiXmlElement* target ) const
-{
-	// superclass:
-	TiXmlNode::CopyTo( target );
-
-	// Element class:
-	// Clone the attributes, then clone the children.
-	const TiXmlAttribute* attribute = 0;
-	for(	attribute = attributeSet.First();
-	attribute;
-	attribute = attribute->Next() )
-	{
-		target->SetAttribute( attribute->Name(), attribute->Value() );
-	}
-
-	TiXmlNode* node = 0;
-	for ( node = firstChild; node; node = node->NextSibling() )
-	{
-		target->LinkEndChild( node->Clone() );
-	}
-}
-
-bool TiXmlElement::Accept( TiXmlVisitor* visitor ) const
-{
-	if ( visitor->VisitEnter( *this, attributeSet.First() ) )
-	{
-		for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() )
-		{
-			if ( !node->Accept( visitor ) )
-				break;
-		}
-	}
-	return visitor->VisitExit( *this );
-}
-
-
-TiXmlNode* TiXmlElement::Clone() const
-{
-	TiXmlElement* clone = new TiXmlElement( Value() );
-	if ( !clone )
-		return 0;
-
-	CopyTo( clone );
-	return clone;
-}
-
-
-const char* TiXmlElement::GetText() const
-{
-	const TiXmlNode* child = this->FirstChild();
-	if ( child ) {
-		const TiXmlText* childText = child->ToText();
-		if ( childText ) {
-			return childText->Value();
-		}
-	}
-	return 0;
-}
-
-
-TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::DOCUMENT )
-{
-	tabsize = 4;
-	useMicrosoftBOM = false;
-	ClearError();
-}
-
-TiXmlDocument::TiXmlDocument( const char * documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
-{
-	tabsize = 4;
-	useMicrosoftBOM = false;
-	value = documentName;
-	ClearError();
-}
-
-
-#ifdef TIXML_USE_STL
-TiXmlDocument::TiXmlDocument( const std::string& documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
-{
-	tabsize = 4;
-	useMicrosoftBOM = false;
-    value = documentName;
-	ClearError();
-}
-#endif
-
-
-TiXmlDocument::TiXmlDocument( const TiXmlDocument& copy ) : TiXmlNode( TiXmlNode::DOCUMENT )
-{
-	copy.CopyTo( this );
-}
-
-
-void TiXmlDocument::operator=( const TiXmlDocument& copy )
-{
-	Clear();
-	copy.CopyTo( this );
-}
-
-
-bool TiXmlDocument::LoadFile( TiXmlEncoding encoding )
-{
-	// See STL_STRING_BUG below.
-	//StringToBuffer buf( value );
-
-	return LoadFile( Value(), encoding );
-}
-
-
-bool TiXmlDocument::SaveFile() const
-{
-	// See STL_STRING_BUG below.
-//	StringToBuffer buf( value );
-//
-//	if ( buf.buffer && SaveFile( buf.buffer ) )
-//		return true;
-//
-//	return false;
-	return SaveFile( Value() );
-}
-
-bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding )
-{
-	// There was a really terrifying little bug here. The code:
-	//		value = filename
-	// in the STL case, cause the assignment method of the std::string to
-	// be called. What is strange, is that the std::string had the same
-	// address as it's c_str() method, and so bad things happen. Looks
-	// like a bug in the Microsoft STL implementation.
-	// Add an extra string to avoid the crash.
-	TIXML_STRING filename( _filename );
-	value = filename;
-
-	// reading in binary mode so that tinyxml can normalize the EOL
-	FILE* file = TiXmlFOpen( value.c_str (), "rb" );
-
-	if ( file )
-	{
-		bool result = LoadFile( file, encoding );
-		fclose( file );
-		return result;
-	}
-	else
-	{
-		SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN );
-		return false;
-	}
-}
-
-bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding )
-{
-	if ( !file )
-	{
-		SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN );
-		return false;
-	}
-
-	// Delete the existing data:
-	Clear();
-	location.Clear();
-
-	// Get the file size, so we can pre-allocate the string. HUGE speed impact.
-	long length = 0;
-	fseek( file, 0, SEEK_END );
-	length = ftell( file );
-	fseek( file, 0, SEEK_SET );
-
-	// Strange case, but good to handle up front.
-	if ( length <= 0 )
-	{
-		SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
-		return false;
-	}
-
-	// If we have a file, assume it is all one big XML file, and read it in.
-	// The document parser may decide the document ends sooner than the entire file, however.
-	TIXML_STRING data;
-	data.reserve( length );
-
-	// Subtle bug here. TinyXml did use fgets. But from the XML spec:
-	// 2.11 End-of-Line Handling
-	// <snip>
-	// <quote>
-	// ...the XML processor MUST behave as if it normalized all line breaks in external
-	// parsed entities (including the document entity) on input, before parsing, by translating
-	// both the two-character sequence #xD #xA and any #xD that is not followed by #xA to
-	// a single #xA character.
-	// </quote>
-	//
-	// It is not clear fgets does that, and certainly isn't clear it works cross platform.
-	// Generally, you expect fgets to translate from the convention of the OS to the c/unix
-	// convention, and not work generally.
-
-	/*
-	while( fgets( buf, sizeof(buf), file ) )
-	{
-		data += buf;
-	}
-	*/
-
-	char* buf = new char[ length+1 ];
-	buf[0] = 0;
-
-	if ( fread( buf, length, 1, file ) != 1 ) {
-		delete [] buf;
-		SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN );
-		return false;
-	}
-
-	const char* lastPos = buf;
-	const char* p = buf;
-
-	buf[length] = 0;
-	while( *p ) {
-		assert( p < (buf+length) );
-		if ( *p == 0xa ) {
-			// Newline character. No special rules for this. Append all the characters
-			// since the last string, and include the newline.
-			data.append( lastPos, (p-lastPos+1) );	// append, include the newline
-			++p;									// move past the newline
-			lastPos = p;							// and point to the new buffer (may be 0)
-			assert( p <= (buf+length) );
-		}
-		else if ( *p == 0xd ) {
-			// Carriage return. Append what we have so far, then
-			// handle moving forward in the buffer.
-			if ( (p-lastPos) > 0 ) {
-				data.append( lastPos, p-lastPos );	// do not add the CR
-			}
-			data += (char)0xa;						// a proper newline
-
-			if ( *(p+1) == 0xa ) {
-				// Carriage return - new line sequence
-				p += 2;
-				lastPos = p;
-				assert( p <= (buf+length) );
-			}
-			else {
-				// it was followed by something else...that is presumably characters again.
-				++p;
-				lastPos = p;
-				assert( p <= (buf+length) );
-			}
-		}
-		else {
-			++p;
-		}
-	}
-	// Handle any left over characters.
-	if ( p-lastPos ) {
-		data.append( lastPos, p-lastPos );
-	}
-	delete [] buf;
-	buf = 0;
-
-	Parse( data.c_str(), 0, encoding );
-
-	if (  Error() )
-        return false;
-    else
-		return true;
-}
-
-
-bool TiXmlDocument::SaveFile( const char * filename ) const
-{
-	// The old c stuff lives on...
-	FILE* fp = TiXmlFOpen( filename, "w" );
-	if ( fp )
-	{
-		bool result = SaveFile( fp );
-		fclose( fp );
-		return result;
-	}
-	return false;
-}
-
-
-bool TiXmlDocument::SaveFile( FILE* fp ) const
-{
-	if ( useMicrosoftBOM )
-	{
-		const unsigned char TIXML_UTF_LEAD_0 = 0xefU;
-		const unsigned char TIXML_UTF_LEAD_1 = 0xbbU;
-		const unsigned char TIXML_UTF_LEAD_2 = 0xbfU;
-
-		fputc( TIXML_UTF_LEAD_0, fp );
-		fputc( TIXML_UTF_LEAD_1, fp );
-		fputc( TIXML_UTF_LEAD_2, fp );
-	}
-	Print( fp, 0 );
-	return (ferror(fp) == 0);
-}
-
-
-void TiXmlDocument::CopyTo( TiXmlDocument* target ) const
-{
-	TiXmlNode::CopyTo( target );
-
-	target->error = error;
-	target->errorId = errorId;
-	target->errorDesc = errorDesc;
-	target->tabsize = tabsize;
-	target->errorLocation = errorLocation;
-	target->useMicrosoftBOM = useMicrosoftBOM;
-
-	TiXmlNode* node = 0;
-	for ( node = firstChild; node; node = node->NextSibling() )
-	{
-		target->LinkEndChild( node->Clone() );
-	}
-}
-
-
-TiXmlNode* TiXmlDocument::Clone() const
-{
-	TiXmlDocument* clone = new TiXmlDocument();
-	if ( !clone )
-		return 0;
-
-	CopyTo( clone );
-	return clone;
-}
-
-
-void TiXmlDocument::Print( FILE* cfile, int depth ) const
-{
-	assert( cfile );
-	for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() )
-	{
-		node->Print( cfile, depth );
-		fprintf( cfile, "\n" );
-	}
-}
-
-
-bool TiXmlDocument::Accept( TiXmlVisitor* visitor ) const
-{
-	if ( visitor->VisitEnter( *this ) )
-	{
-		for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() )
-		{
-			if ( !node->Accept( visitor ) )
-				break;
-		}
-	}
-	return visitor->VisitExit( *this );
-}
-
-
-const TiXmlAttribute* TiXmlAttribute::Next() const
-{
-	// We are using knowledge of the sentinel. The sentinel
-	// have a value or name.
-	if ( next->value.empty() && next->name.empty() )
-		return 0;
-	return next;
-}
-
-/*
-TiXmlAttribute* TiXmlAttribute::Next()
-{
-	// We are using knowledge of the sentinel. The sentinel
-	// have a value or name.
-	if ( next->value.empty() && next->name.empty() )
-		return 0;
-	return next;
-}
-*/
-
-const TiXmlAttribute* TiXmlAttribute::Previous() const
-{
-	// We are using knowledge of the sentinel. The sentinel
-	// have a value or name.
-	if ( prev->value.empty() && prev->name.empty() )
-		return 0;
-	return prev;
-}
-
-/*
-TiXmlAttribute* TiXmlAttribute::Previous()
-{
-	// We are using knowledge of the sentinel. The sentinel
-	// have a value or name.
-	if ( prev->value.empty() && prev->name.empty() )
-		return 0;
-	return prev;
-}
-*/
-
-void TiXmlAttribute::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const
-{
-	TIXML_STRING n, v;
-
-	EncodeString( name, &n );
-	EncodeString( value, &v );
-
-	if (value.find ('\"') == TIXML_STRING::npos) {
-		if ( cfile ) {
-		fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() );
-		}
-		if ( str ) {
-			(*str) += n; (*str) += "=\""; (*str) += v; (*str) += "\"";
-		}
-	}
-	else {
-		if ( cfile ) {
-		fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() );
-		}
-		if ( str ) {
-			(*str) += n; (*str) += "='"; (*str) += v; (*str) += "'";
-		}
-	}
-}
-
-
-int TiXmlAttribute::QueryIntValue( int* ival ) const
-{
-	if ( TIXML_SSCANF( value.c_str(), "%d", ival ) == 1 )
-		return TIXML_SUCCESS;
-	return TIXML_WRONG_TYPE;
-}
-
-int TiXmlAttribute::QueryDoubleValue( double* dval ) const
-{
-	if ( TIXML_SSCANF( value.c_str(), "%lf", dval ) == 1 )
-		return TIXML_SUCCESS;
-	return TIXML_WRONG_TYPE;
-}
-
-void TiXmlAttribute::SetIntValue( int _value )
-{
-	char buf [64];
-	#if defined(TIXML_SNPRINTF)
-		TIXML_SNPRINTF(buf, sizeof(buf), "%d", _value);
-	#else
-		sprintf (buf, "%d", _value);
-	#endif
-	SetValue (buf);
-}
-
-void TiXmlAttribute::SetDoubleValue( double _value )
-{
-	char buf [256];
-	#if defined(TIXML_SNPRINTF)
-		TIXML_SNPRINTF( buf, sizeof(buf), "%lf", _value);
-	#else
-		sprintf (buf, "%lf", _value);
-	#endif
-	SetValue (buf);
-}
-
-int TiXmlAttribute::IntValue() const
-{
-	return atoi (value.c_str ());
-}
-
-double  TiXmlAttribute::DoubleValue() const
-{
-	return atof (value.c_str ());
-}
-
-
-TiXmlComment::TiXmlComment( const TiXmlComment& copy ) : TiXmlNode( TiXmlNode::COMMENT )
-{
-	copy.CopyTo( this );
-}
-
-
-void TiXmlComment::operator=( const TiXmlComment& base )
-{
-	Clear();
-	base.CopyTo( this );
-}
-
-
-void TiXmlComment::Print( FILE* cfile, int depth ) const
-{
-	assert( cfile );
-	for ( int i=0; i<depth; i++ )
-	{
-		fprintf( cfile,  "    " );
-	}
-	fprintf( cfile, "<!--%s-->", value.c_str() );
-}
-
-
-void TiXmlComment::CopyTo( TiXmlComment* target ) const
-{
-	TiXmlNode::CopyTo( target );
-}
-
-
-bool TiXmlComment::Accept( TiXmlVisitor* visitor ) const
-{
-	return visitor->Visit( *this );
-}
-
-
-TiXmlNode* TiXmlComment::Clone() const
-{
-	TiXmlComment* clone = new TiXmlComment();
-
-	if ( !clone )
-		return 0;
-
-	CopyTo( clone );
-	return clone;
-}
-
-
-void TiXmlText::Print( FILE* cfile, int depth ) const
-{
-	assert( cfile );
-	if ( cdata )
-	{
-		int i;
-		fprintf( cfile, "\n" );
-		for ( i=0; i<depth; i++ ) {
-			fprintf( cfile, "    " );
-		}
-		fprintf( cfile, "<![CDATA[%s]]>\n", value.c_str() );	// unformatted output
-	}
-	else
-	{
-		TIXML_STRING buffer;
-		EncodeString( value, &buffer );
-		fprintf( cfile, "%s", buffer.c_str() );
-	}
-}
-
-
-void TiXmlText::CopyTo( TiXmlText* target ) const
-{
-	TiXmlNode::CopyTo( target );
-	target->cdata = cdata;
-}
-
-
-bool TiXmlText::Accept( TiXmlVisitor* visitor ) const
-{
-	return visitor->Visit( *this );
-}
-
-
-TiXmlNode* TiXmlText::Clone() const
-{
-	TiXmlText* clone = 0;
-	clone = new TiXmlText( "" );
-
-	if ( !clone )
-		return 0;
-
-	CopyTo( clone );
-	return clone;
-}
-
-
-TiXmlDeclaration::TiXmlDeclaration( const char * _version,
-									const char * _encoding,
-									const char * _standalone )
-	: TiXmlNode( TiXmlNode::DECLARATION )
-{
-	version = _version;
-	encoding = _encoding;
-	standalone = _standalone;
-}
-
-
-#ifdef TIXML_USE_STL
-TiXmlDeclaration::TiXmlDeclaration(	const std::string& _version,
-									const std::string& _encoding,
-									const std::string& _standalone )
-	: TiXmlNode( TiXmlNode::DECLARATION )
-{
-	version = _version;
-	encoding = _encoding;
-	standalone = _standalone;
-}
-#endif
-
-
-TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy )
-	: TiXmlNode( TiXmlNode::DECLARATION )
-{
-	copy.CopyTo( this );
-}
-
-
-void TiXmlDeclaration::operator=( const TiXmlDeclaration& copy )
-{
-	Clear();
-	copy.CopyTo( this );
-}
-
-
-void TiXmlDeclaration::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const
-{
-	if ( cfile ) fprintf( cfile, "<?xml " );
-	if ( str )	 (*str) += "<?xml ";
-
-	if ( !version.empty() ) {
-		if ( cfile ) fprintf (cfile, "version=\"%s\" ", version.c_str ());
-		if ( str ) { (*str) += "version=\""; (*str) += version; (*str) += "\" "; }
-	}
-	if ( !encoding.empty() ) {
-		if ( cfile ) fprintf (cfile, "encoding=\"%s\" ", encoding.c_str ());
-		if ( str ) { (*str) += "encoding=\""; (*str) += encoding; (*str) += "\" "; }
-	}
-	if ( !standalone.empty() ) {
-		if ( cfile ) fprintf (cfile, "standalone=\"%s\" ", standalone.c_str ());
-		if ( str ) { (*str) += "standalone=\""; (*str) += standalone; (*str) += "\" "; }
-	}
-	if ( cfile ) fprintf( cfile, "?>" );
-	if ( str )	 (*str) += "?>";
-}
-
-
-void TiXmlDeclaration::CopyTo( TiXmlDeclaration* target ) const
-{
-	TiXmlNode::CopyTo( target );
-
-	target->version = version;
-	target->encoding = encoding;
-	target->standalone = standalone;
-}
-
-
-bool TiXmlDeclaration::Accept( TiXmlVisitor* visitor ) const
-{
-	return visitor->Visit( *this );
-}
-
-
-TiXmlNode* TiXmlDeclaration::Clone() const
-{
-	TiXmlDeclaration* clone = new TiXmlDeclaration();
-
-	if ( !clone )
-		return 0;
-
-	CopyTo( clone );
-	return clone;
-}
-
-TiXmlStylesheetReference::TiXmlStylesheetReference( const char * _type,
-													const char * _href )
-	: TiXmlNode( TiXmlNode::STYLESHEETREFERENCE )
-{
-	type = _type;
-	href = _href;
-}
-
-
-#ifdef TIXML_USE_STL
-TiXmlStylesheetReference::TiXmlStylesheetReference(	const std::string& _type,
-													const std::string& _href )
-	: TiXmlNode( TiXmlNode::STYLESHEETREFERENCE )
-{
-	type = _type;
-	href = _href;
-}
-#endif
-
-
-TiXmlStylesheetReference::TiXmlStylesheetReference( const TiXmlStylesheetReference& copy )
-	: TiXmlNode( TiXmlNode::STYLESHEETREFERENCE )
-{
-	copy.CopyTo( this );
-}
-
-
-void TiXmlStylesheetReference::operator=( const TiXmlStylesheetReference& copy )
-{
-	Clear();
-	copy.CopyTo( this );
-}
-
-
-void TiXmlStylesheetReference::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const
-{
-	if ( cfile ) fprintf( cfile, "<?xml-stylesheet " );
-	if ( str )	 (*str) += "<?xml-stylesheet ";
-
-	if ( !type.empty() ) {
-		if ( cfile ) fprintf (cfile, "type=\"%s\" ", type.c_str ());
-		if ( str ) { (*str) += "type=\""; (*str) += type; (*str) += "\" "; }
-	}
-	if ( !href.empty() ) {
-		if ( cfile ) fprintf (cfile, "href=\"%s\" ", href.c_str ());
-		if ( str ) { (*str) += "href=\""; (*str) += href; (*str) += "\" "; }
-	}
-	if ( cfile ) fprintf (cfile, "?>");
-	if ( str )	 (*str) += "?>";
-}
-
-void TiXmlStylesheetReference::CopyTo( TiXmlStylesheetReference* target ) const
-{
-	TiXmlNode::CopyTo( target );
-
-	target->type = type;
-	target->href = href;
-}
-
-bool TiXmlStylesheetReference::Accept( TiXmlVisitor* visitor ) const
-{
-	return visitor->Visit( *this );
-}
-
-TiXmlNode* TiXmlStylesheetReference::Clone() const
-{
-	TiXmlStylesheetReference* clone = new TiXmlStylesheetReference();
-
-	if ( !clone )
-		return 0;
-
-	CopyTo( clone );
-	return clone;
-}
-
-void TiXmlUnknown::Print( FILE* cfile, int depth ) const
-{
-	for ( int i=0; i<depth; i++ )
-		fprintf( cfile, "    " );
-	fprintf( cfile, "<%s>", value.c_str() );
-}
-
-
-void TiXmlUnknown::CopyTo( TiXmlUnknown* target ) const
-{
-	TiXmlNode::CopyTo( target );
-}
-
-
-bool TiXmlUnknown::Accept( TiXmlVisitor* visitor ) const
-{
-	return visitor->Visit( *this );
-}
-
-
-TiXmlNode* TiXmlUnknown::Clone() const
-{
-	TiXmlUnknown* clone = new TiXmlUnknown();
-
-	if ( !clone )
-		return 0;
-
-	CopyTo( clone );
-	return clone;
-}
-
-
-TiXmlAttributeSet::TiXmlAttributeSet()
-{
-	sentinel.next = &sentinel;
-	sentinel.prev = &sentinel;
-}
-
-
-TiXmlAttributeSet::~TiXmlAttributeSet()
-{
-	assert( sentinel.next == &sentinel );
-	assert( sentinel.prev == &sentinel );
-}
-
-
-void TiXmlAttributeSet::Add( TiXmlAttribute* addMe )
-{
-    #ifdef TIXML_USE_STL
-	assert( !Find( TIXML_STRING( addMe->Name() ) ) );	// Shouldn't be multiply adding to the set.
-	#else
-	assert( !Find( addMe->Name() ) );	// Shouldn't be multiply adding to the set.
-	#endif
-
-	addMe->next = &sentinel;
-	addMe->prev = sentinel.prev;
-
-	sentinel.prev->next = addMe;
-	sentinel.prev      = addMe;
-}
-
-void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe )
-{
-	TiXmlAttribute* node;
-
-	for( node = sentinel.next; node != &sentinel; node = node->next )
-	{
-		if ( node == removeMe )
-		{
-			node->prev->next = node->next;
-			node->next->prev = node->prev;
-			node->next = 0;
-			node->prev = 0;
-			return;
-		}
-	}
-	assert( 0 );		// we tried to remove a non-linked attribute.
-}
-
-
-#ifdef TIXML_USE_STL
-const TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name ) const
-{
-	for( const TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
-	{
-		if ( node->name == name )
-			return node;
-	}
-	return 0;
-}
-
-/*
-TiXmlAttribute*	TiXmlAttributeSet::Find( const std::string& name )
-{
-	for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
-	{
-		if ( node->name == name )
-			return node;
-	}
-	return 0;
-}
-*/
-#endif
-
-
-const TiXmlAttribute* TiXmlAttributeSet::Find( const char* name ) const
-{
-	for( const TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
-	{
-		if ( strcmp( node->name.c_str(), name ) == 0 )
-			return node;
-	}
-	return 0;
-}
-
-/*
-TiXmlAttribute*	TiXmlAttributeSet::Find( const char* name )
-{
-	for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
-	{
-		if ( strcmp( node->name.c_str(), name ) == 0 )
-			return node;
-	}
-	return 0;
-}
-*/
-
-#ifdef TIXML_USE_STL
-std::istream& operator>> (std::istream & in, TiXmlNode & base)
-{
-	TIXML_STRING tag;
-	tag.reserve( 8 * 1000 );
-	base.StreamIn( &in, &tag );
-
-	base.Parse( tag.c_str(), 0, TIXML_DEFAULT_ENCODING );
-	return in;
-}
-#endif
-
-
-#ifdef TIXML_USE_STL
-std::ostream& operator<< (std::ostream & out, const TiXmlNode & base)
-{
-	TiXmlPrinter printer;
-	printer.SetStreamPrinting();
-	base.Accept( &printer );
-	out << printer.Str();
-
-	return out;
-}
-
-
-std::string& operator<< (std::string& out, const TiXmlNode& base )
-{
-	TiXmlPrinter printer;
-	printer.SetStreamPrinting();
-	base.Accept( &printer );
-	out.append( printer.Str() );
-
-	return out;
-}
-#endif
-
-
-TiXmlHandle TiXmlHandle::FirstChild() const
-{
-	if ( node )
-	{
-		TiXmlNode* child = node->FirstChild();
-		if ( child )
-			return TiXmlHandle( child );
-	}
-	return TiXmlHandle( 0 );
-}
-
-
-TiXmlHandle TiXmlHandle::FirstChild( const char * value ) const
-{
-	if ( node )
-	{
-		TiXmlNode* child = node->FirstChild( value );
-		if ( child )
-			return TiXmlHandle( child );
-	}
-	return TiXmlHandle( 0 );
-}
-
-
-TiXmlHandle TiXmlHandle::FirstChildElement() const
-{
-	if ( node )
-	{
-		TiXmlElement* child = node->FirstChildElement();
-		if ( child )
-			return TiXmlHandle( child );
-	}
-	return TiXmlHandle( 0 );
-}
-
-
-TiXmlHandle TiXmlHandle::FirstChildElement( const char * value ) const
-{
-	if ( node )
-	{
-		TiXmlElement* child = node->FirstChildElement( value );
-		if ( child )
-			return TiXmlHandle( child );
-	}
-	return TiXmlHandle( 0 );
-}
-
-
-TiXmlHandle TiXmlHandle::Child( int count ) const
-{
-	if ( node )
-	{
-		int i;
-		TiXmlNode* child = node->FirstChild();
-		for (	i=0;
-				child && i<count;
-				child = child->NextSibling(), ++i )
-		{
-			// nothing
-		}
-		if ( child )
-			return TiXmlHandle( child );
-	}
-	return TiXmlHandle( 0 );
-}
-
-
-TiXmlHandle TiXmlHandle::Child( const char* value, int count ) const
-{
-	if ( node )
-	{
-		int i;
-		TiXmlNode* child = node->FirstChild( value );
-		for (	i=0;
-				child && i<count;
-				child = child->NextSibling( value ), ++i )
-		{
-			// nothing
-		}
-		if ( child )
-			return TiXmlHandle( child );
-	}
-	return TiXmlHandle( 0 );
-}
-
-
-TiXmlHandle TiXmlHandle::ChildElement( int count ) const
-{
-	if ( node )
-	{
-		int i;
-		TiXmlElement* child = node->FirstChildElement();
-		for (	i=0;
-				child && i<count;
-				child = child->NextSiblingElement(), ++i )
-		{
-			// nothing
-		}
-		if ( child )
-			return TiXmlHandle( child );
-	}
-	return TiXmlHandle( 0 );
-}
-
-
-TiXmlHandle TiXmlHandle::ChildElement( const char* value, int count ) const
-{
-	if ( node )
-	{
-		int i;
-		TiXmlElement* child = node->FirstChildElement( value );
-		for (	i=0;
-				child && i<count;
-				child = child->NextSiblingElement( value ), ++i )
-		{
-			// nothing
-		}
-		if ( child )
-			return TiXmlHandle( child );
-	}
-	return TiXmlHandle( 0 );
-}
-
-
-bool TiXmlPrinter::VisitEnter( const TiXmlDocument& )
-{
-	return true;
-}
-
-bool TiXmlPrinter::VisitExit( const TiXmlDocument& )
-{
-	return true;
-}
-
-bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute )
-{
-	DoIndent();
-	buffer += "<";
-	buffer += element.Value();
-
-	for( const TiXmlAttribute* attrib = firstAttribute; attrib; attrib = attrib->Next() )
-	{
-		buffer += " ";
-		attrib->Print( 0, 0, &buffer );
-	}
-
-	if ( !element.FirstChild() )
-	{
-		buffer += " />";
-		DoLineBreak();
-	}
-	else
-	{
-		buffer += ">";
-		if (    element.FirstChild()->ToText()
-			  && element.LastChild() == element.FirstChild()
-			  && element.FirstChild()->ToText()->CDATA() == false )
-		{
-			simpleTextPrint = true;
-			// no DoLineBreak()!
-		}
-		else
-		{
-			DoLineBreak();
-		}
-	}
-	++depth;
-	return true;
-}
-
-
-bool TiXmlPrinter::VisitExit( const TiXmlElement& element )
-{
-	--depth;
-	if ( !element.FirstChild() )
-	{
-		// nothing.
-	}
-	else
-	{
-		if ( simpleTextPrint )
-		{
-			simpleTextPrint = false;
-		}
-		else
-		{
-			DoIndent();
-		}
-		buffer += "</";
-		buffer += element.Value();
-		buffer += ">";
-		DoLineBreak();
-	}
-	return true;
-}
-
-
-bool TiXmlPrinter::Visit( const TiXmlText& text )
-{
-	if ( text.CDATA() )
-	{
-		DoIndent();
-		buffer += "<![CDATA[";
-		buffer += text.Value();
-		buffer += "]]>";
-		DoLineBreak();
-	}
-	else if ( simpleTextPrint )
-	{
-		TIXML_STRING str;
-		TiXmlBase::EncodeString( text.ValueTStr(), &str );
-		buffer += str;
-	}
-	else
-	{
-		DoIndent();
-		TIXML_STRING str;
-		TiXmlBase::EncodeString( text.ValueTStr(), &str );
-		buffer += str;
-		DoLineBreak();
-	}
-	return true;
-}
-
-
-bool TiXmlPrinter::Visit( const TiXmlDeclaration& declaration )
-{
-	DoIndent();
-	declaration.Print( 0, 0, &buffer );
-	DoLineBreak();
-	return true;
-}
-
-
-bool TiXmlPrinter::Visit( const TiXmlComment& comment )
-{
-	DoIndent();
-	buffer += "<!--";
-	buffer += comment.Value();
-	buffer += "-->";
-	DoLineBreak();
-	return true;
-}
-
-
-bool TiXmlPrinter::Visit( const TiXmlUnknown& unknown )
-{
-	DoIndent();
-	buffer += "<";
-	buffer += unknown.Value();
-	buffer += ">";
-	DoLineBreak();
-	return true;
-}
-
Index: /code/branches/buildsystem3/src/tinyxml/tinyxml.cpp
===================================================================
--- /code/branches/buildsystem3/src/tinyxml/tinyxml.cpp	(revision 2664)
+++ /code/branches/buildsystem3/src/tinyxml/tinyxml.cpp	(revision 2664)
@@ -0,0 +1,1961 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+#include "tinyxml.h"
+
+#include <ctype.h>
+
+#ifdef TIXML_USE_STL
+#include <sstream>
+#include <iostream>
+#endif
+
+
+bool TiXmlBase::condenseWhiteSpace = true;
+
+// Microsoft compiler security
+FILE* TiXmlFOpen( const char* filename, const char* mode )
+{
+	#if defined(_MSC_VER) && (_MSC_VER >= 1400 )
+		FILE* fp = 0;
+		errno_t err = fopen_s( &fp, filename, mode );
+		if ( !err && fp )
+			return fp;
+		return 0;
+	#else
+		return fopen( filename, mode );
+	#endif
+}
+
+void TiXmlBase::EncodeString( const TIXML_STRING& str, TIXML_STRING* outString )
+{
+	int i=0;
+
+	while( i<(int)str.length() )
+	{
+		unsigned char c = (unsigned char) str[i];
+
+		if (    c == '&'
+		     && i < ( (int)str.length() - 2 )
+			 && str[i+1] == '#'
+			 && str[i+2] == 'x' )
+		{
+			// Hexadecimal character reference.
+			// Pass through unchanged.
+			// &#xA9;	-- copyright symbol, for example.
+			//
+			// The -1 is a bug fix from Rob Laveaux. It keeps
+			// an overflow from happening if there is no ';'.
+			// There are actually 2 ways to exit this loop -
+			// while fails (error case) and break (semicolon found).
+			// However, there is no mechanism (currently) for
+			// this function to return an error.
+			while ( i<(int)str.length()-1 )
+			{
+				outString->append( str.c_str() + i, 1 );
+				++i;
+				if ( str[i] == ';' )
+					break;
+			}
+		}
+		else if ( c == '&' )
+		{
+			outString->append( entity[0].str, entity[0].strLength );
+			++i;
+		}
+		else if ( c == '<' )
+		{
+			outString->append( entity[1].str, entity[1].strLength );
+			++i;
+		}
+		else if ( c == '>' )
+		{
+			outString->append( entity[2].str, entity[2].strLength );
+			++i;
+		}
+		else if ( c == '\"' )
+		{
+			outString->append( entity[3].str, entity[3].strLength );
+			++i;
+		}
+		else if ( c == '\'' )
+		{
+			outString->append( entity[4].str, entity[4].strLength );
+			++i;
+		}
+		else if ( c < 32 )
+		{
+			// Easy pass at non-alpha/numeric/symbol
+			// Below 32 is symbolic.
+			char buf[ 32 ];
+
+			#if defined(TIXML_SNPRINTF)
+				TIXML_SNPRINTF( buf, sizeof(buf), "&#x%02X;", (unsigned) ( c & 0xff ) );
+			#else
+				sprintf( buf, "&#x%02X;", (unsigned) ( c & 0xff ) );
+			#endif
+
+			//*ME:	warning C4267: convert 'size_t' to 'int'
+			//*ME:	Int-Cast to make compiler happy ...
+			outString->append( buf, (int)strlen( buf ) );
+			++i;
+		}
+		else
+		{
+			//char realc = (char) c;
+			//outString->append( &realc, 1 );
+			*outString += (char) c;	// somewhat more efficient function call.
+			++i;
+		}
+	}
+}
+
+
+TiXmlNode::TiXmlNode( NodeType _type ) : TiXmlBase()
+{
+	parent = 0;
+	type = _type;
+	firstChild = 0;
+	lastChild = 0;
+	prev = 0;
+	next = 0;
+}
+
+
+TiXmlNode::~TiXmlNode()
+{
+	TiXmlNode* node = firstChild;
+	TiXmlNode* temp = 0;
+
+	while ( node )
+	{
+		temp = node;
+		node = node->next;
+		delete temp;
+	}
+}
+
+
+void TiXmlNode::CopyTo( TiXmlNode* target ) const
+{
+	target->SetValue (value.c_str() );
+	target->userData = userData;
+}
+
+
+void TiXmlNode::Clear()
+{
+	TiXmlNode* node = firstChild;
+	TiXmlNode* temp = 0;
+
+	while ( node )
+	{
+		temp = node;
+		node = node->next;
+		delete temp;
+	}
+
+	firstChild = 0;
+	lastChild = 0;
+}
+
+
+TiXmlNode* TiXmlNode::LinkEndChild( TiXmlNode* node )
+{
+	assert( node->parent == 0 || node->parent == this );
+	assert( node->GetDocument() == 0 || node->GetDocument() == this->GetDocument() );
+
+	if ( node->Type() == TiXmlNode::DOCUMENT )
+	{
+		delete node;
+		if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
+		return 0;
+	}
+
+	node->parent = this;
+
+	node->prev = lastChild;
+	node->next = 0;
+
+	if ( lastChild )
+		lastChild->next = node;
+	else
+		firstChild = node;			// it was an empty list.
+
+	lastChild = node;
+	return node;
+}
+
+
+TiXmlNode* TiXmlNode::InsertEndChild( const TiXmlNode& addThis )
+{
+	if ( addThis.Type() == TiXmlNode::DOCUMENT )
+	{
+		if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
+		return 0;
+	}
+	TiXmlNode* node = addThis.Clone();
+	if ( !node )
+		return 0;
+
+	return LinkEndChild( node );
+}
+
+
+TiXmlNode* TiXmlNode::InsertBeforeChild( TiXmlNode* beforeThis, const TiXmlNode& addThis )
+{
+	if ( !beforeThis || beforeThis->parent != this ) {
+		return 0;
+	}
+	if ( addThis.Type() == TiXmlNode::DOCUMENT )
+	{
+		if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
+		return 0;
+	}
+
+	TiXmlNode* node = addThis.Clone();
+	if ( !node )
+		return 0;
+	node->parent = this;
+
+	node->next = beforeThis;
+	node->prev = beforeThis->prev;
+	if ( beforeThis->prev )
+	{
+		beforeThis->prev->next = node;
+	}
+	else
+	{
+		assert( firstChild == beforeThis );
+		firstChild = node;
+	}
+	beforeThis->prev = node;
+	return node;
+}
+
+
+TiXmlNode* TiXmlNode::InsertAfterChild( TiXmlNode* afterThis, const TiXmlNode& addThis )
+{
+	if ( !afterThis || afterThis->parent != this ) {
+		return 0;
+	}
+	if ( addThis.Type() == TiXmlNode::DOCUMENT )
+	{
+		if ( GetDocument() ) GetDocument()->SetError( TIXML_ERROR_DOCUMENT_TOP_ONLY, 0, 0, TIXML_ENCODING_UNKNOWN );
+		return 0;
+	}
+
+	TiXmlNode* node = addThis.Clone();
+	if ( !node )
+		return 0;
+	node->parent = this;
+
+	node->prev = afterThis;
+	node->next = afterThis->next;
+	if ( afterThis->next )
+	{
+		afterThis->next->prev = node;
+	}
+	else
+	{
+		assert( lastChild == afterThis );
+		lastChild = node;
+	}
+	afterThis->next = node;
+	return node;
+}
+
+
+TiXmlNode* TiXmlNode::ReplaceChild( TiXmlNode* replaceThis, const TiXmlNode& withThis )
+{
+	if ( replaceThis->parent != this )
+		return 0;
+
+	TiXmlNode* node = withThis.Clone();
+	if ( !node )
+		return 0;
+
+	node->next = replaceThis->next;
+	node->prev = replaceThis->prev;
+
+	if ( replaceThis->next )
+		replaceThis->next->prev = node;
+	else
+		lastChild = node;
+
+	if ( replaceThis->prev )
+		replaceThis->prev->next = node;
+	else
+		firstChild = node;
+
+	delete replaceThis;
+	node->parent = this;
+	return node;
+}
+
+
+bool TiXmlNode::RemoveChild( TiXmlNode* removeThis )
+{
+	if ( removeThis->parent != this )
+	{
+		assert( 0 );
+		return false;
+	}
+
+	if ( removeThis->next )
+		removeThis->next->prev = removeThis->prev;
+	else
+		lastChild = removeThis->prev;
+
+	if ( removeThis->prev )
+		removeThis->prev->next = removeThis->next;
+	else
+		firstChild = removeThis->next;
+
+	delete removeThis;
+	return true;
+}
+
+const TiXmlNode* TiXmlNode::FirstChild( const char * _value ) const
+{
+	const TiXmlNode* node;
+	for ( node = firstChild; node; node = node->next )
+	{
+		if ( strcmp( node->Value(), _value ) == 0 )
+			return node;
+	}
+	return 0;
+}
+
+
+const TiXmlNode* TiXmlNode::LastChild( const char * _value ) const
+{
+	const TiXmlNode* node;
+	for ( node = lastChild; node; node = node->prev )
+	{
+		if ( strcmp( node->Value(), _value ) == 0 )
+			return node;
+	}
+	return 0;
+}
+
+
+const TiXmlNode* TiXmlNode::IterateChildren( const TiXmlNode* previous ) const
+{
+	if ( !previous )
+	{
+		return FirstChild();
+	}
+	else
+	{
+		assert( previous->parent == this );
+		return previous->NextSibling();
+	}
+}
+
+
+const TiXmlNode* TiXmlNode::IterateChildren( const char * val, const TiXmlNode* previous ) const
+{
+	if ( !previous )
+	{
+		return FirstChild( val );
+	}
+	else
+	{
+		assert( previous->parent == this );
+		return previous->NextSibling( val );
+	}
+}
+
+
+const TiXmlNode* TiXmlNode::NextSibling( const char * _value ) const
+{
+	const TiXmlNode* node;
+	for ( node = next; node; node = node->next )
+	{
+		if ( strcmp( node->Value(), _value ) == 0 )
+			return node;
+	}
+	return 0;
+}
+
+
+const TiXmlNode* TiXmlNode::PreviousSibling( const char * _value ) const
+{
+	const TiXmlNode* node;
+	for ( node = prev; node; node = node->prev )
+	{
+		if ( strcmp( node->Value(), _value ) == 0 )
+			return node;
+	}
+	return 0;
+}
+
+
+void TiXmlElement::RemoveAttribute( const char * name )
+{
+    #ifdef TIXML_USE_STL
+	TIXML_STRING str( name );
+	TiXmlAttribute* node = attributeSet.Find( str );
+	#else
+	TiXmlAttribute* node = attributeSet.Find( name );
+	#endif
+	if ( node )
+	{
+		attributeSet.Remove( node );
+		delete node;
+	}
+}
+
+const TiXmlElement* TiXmlNode::FirstChildElement() const
+{
+	const TiXmlNode* node;
+
+	for (	node = FirstChild();
+			node;
+			node = node->NextSibling() )
+	{
+		if ( node->ToElement() )
+			return node->ToElement();
+	}
+	return 0;
+}
+
+
+const TiXmlElement* TiXmlNode::FirstChildElement( const char * _value ) const
+{
+	const TiXmlNode* node;
+
+	for (	node = FirstChild( _value );
+			node;
+			node = node->NextSibling( _value ) )
+	{
+		if ( node->ToElement() )
+			return node->ToElement();
+	}
+	return 0;
+}
+
+
+const TiXmlElement* TiXmlNode::NextSiblingElement() const
+{
+	const TiXmlNode* node;
+
+	for (	node = NextSibling();
+			node;
+			node = node->NextSibling() )
+	{
+		if ( node->ToElement() )
+			return node->ToElement();
+	}
+	return 0;
+}
+
+
+const TiXmlElement* TiXmlNode::NextSiblingElement( const char * _value ) const
+{
+	const TiXmlNode* node;
+
+	for (	node = NextSibling( _value );
+			node;
+			node = node->NextSibling( _value ) )
+	{
+		if ( node->ToElement() )
+			return node->ToElement();
+	}
+	return 0;
+}
+
+
+const TiXmlDocument* TiXmlNode::GetDocument() const
+{
+	const TiXmlNode* node;
+
+	for( node = this; node; node = node->parent )
+	{
+		if ( node->ToDocument() )
+			return node->ToDocument();
+	}
+	return 0;
+}
+
+
+TiXmlElement::TiXmlElement (const char * _value)
+	: TiXmlNode( TiXmlNode::ELEMENT )
+{
+	firstChild = lastChild = 0;
+	value = _value;
+}
+
+
+#ifdef TIXML_USE_STL
+TiXmlElement::TiXmlElement( const std::string& _value )
+	: TiXmlNode( TiXmlNode::ELEMENT )
+{
+	firstChild = lastChild = 0;
+	value = _value;
+}
+#endif
+
+
+TiXmlElement::TiXmlElement( const TiXmlElement& copy)
+	: TiXmlNode( TiXmlNode::ELEMENT )
+{
+	firstChild = lastChild = 0;
+	copy.CopyTo( this );
+}
+
+
+void TiXmlElement::operator=( const TiXmlElement& base )
+{
+	ClearThis();
+	base.CopyTo( this );
+}
+
+
+TiXmlElement::~TiXmlElement()
+{
+	ClearThis();
+}
+
+
+void TiXmlElement::ClearThis()
+{
+	Clear();
+	while( attributeSet.First() )
+	{
+		TiXmlAttribute* node = attributeSet.First();
+		attributeSet.Remove( node );
+		delete node;
+	}
+}
+
+
+const char* TiXmlElement::Attribute( const char* name ) const
+{
+	const TiXmlAttribute* node = attributeSet.Find( name );
+	if ( node )
+		return node->Value();
+	return 0;
+}
+
+
+#ifdef TIXML_USE_STL
+const std::string* TiXmlElement::Attribute( const std::string& name ) const
+{
+	const TiXmlAttribute* node = attributeSet.Find( name );
+	if ( node )
+		return &node->ValueStr();
+	return 0;
+}
+#endif
+
+
+const char* TiXmlElement::Attribute( const char* name, int* i ) const
+{
+	const char* s = Attribute( name );
+	if ( i )
+	{
+		if ( s ) {
+			*i = atoi( s );
+		}
+		else {
+			*i = 0;
+		}
+	}
+	return s;
+}
+
+
+#ifdef TIXML_USE_STL
+const std::string* TiXmlElement::Attribute( const std::string& name, int* i ) const
+{
+	const std::string* s = Attribute( name );
+	if ( i )
+	{
+		if ( s ) {
+			*i = atoi( s->c_str() );
+		}
+		else {
+			*i = 0;
+		}
+	}
+	return s;
+}
+#endif
+
+
+const char* TiXmlElement::Attribute( const char* name, double* d ) const
+{
+	const char* s = Attribute( name );
+	if ( d )
+	{
+		if ( s ) {
+			*d = atof( s );
+		}
+		else {
+			*d = 0;
+		}
+	}
+	return s;
+}
+
+
+#ifdef TIXML_USE_STL
+const std::string* TiXmlElement::Attribute( const std::string& name, double* d ) const
+{
+	const std::string* s = Attribute( name );
+	if ( d )
+	{
+		if ( s ) {
+			*d = atof( s->c_str() );
+		}
+		else {
+			*d = 0;
+		}
+	}
+	return s;
+}
+#endif
+
+
+int TiXmlElement::QueryIntAttribute( const char* name, int* ival ) const
+{
+	const TiXmlAttribute* node = attributeSet.Find( name );
+	if ( !node )
+		return TIXML_NO_ATTRIBUTE;
+	return node->QueryIntValue( ival );
+}
+
+
+#ifdef TIXML_USE_STL
+int TiXmlElement::QueryIntAttribute( const std::string& name, int* ival ) const
+{
+	const TiXmlAttribute* node = attributeSet.Find( name );
+	if ( !node )
+		return TIXML_NO_ATTRIBUTE;
+	return node->QueryIntValue( ival );
+}
+#endif
+
+
+int TiXmlElement::QueryDoubleAttribute( const char* name, double* dval ) const
+{
+	const TiXmlAttribute* node = attributeSet.Find( name );
+	if ( !node )
+		return TIXML_NO_ATTRIBUTE;
+	return node->QueryDoubleValue( dval );
+}
+
+
+#ifdef TIXML_USE_STL
+int TiXmlElement::QueryDoubleAttribute( const std::string& name, double* dval ) const
+{
+	const TiXmlAttribute* node = attributeSet.Find( name );
+	if ( !node )
+		return TIXML_NO_ATTRIBUTE;
+	return node->QueryDoubleValue( dval );
+}
+#endif
+
+
+void TiXmlElement::SetAttribute( const char * name, int val )
+{
+	char buf[64];
+	#if defined(TIXML_SNPRINTF)
+		TIXML_SNPRINTF( buf, sizeof(buf), "%d", val );
+	#else
+		sprintf( buf, "%d", val );
+	#endif
+	SetAttribute( name, buf );
+}
+
+
+#ifdef TIXML_USE_STL
+void TiXmlElement::SetAttribute( const std::string& name, int val )
+{
+   std::ostringstream oss;
+   oss << val;
+   SetAttribute( name, oss.str() );
+}
+#endif
+
+
+void TiXmlElement::SetDoubleAttribute( const char * name, double val )
+{
+	char buf[256];
+	#if defined(TIXML_SNPRINTF)
+		TIXML_SNPRINTF( buf, sizeof(buf), "%f", val );
+	#else
+		sprintf( buf, "%f", val );
+	#endif
+	SetAttribute( name, buf );
+}
+
+
+void TiXmlElement::SetAttribute( const char * cname, const char * cvalue )
+{
+    #ifdef TIXML_USE_STL
+	TIXML_STRING _name( cname );
+	TIXML_STRING _value( cvalue );
+	#else
+	const char* _name = cname;
+	const char* _value = cvalue;
+	#endif
+
+	TiXmlAttribute* node = attributeSet.Find( _name );
+	if ( node )
+	{
+		node->SetValue( _value );
+		return;
+	}
+
+	TiXmlAttribute* attrib = new TiXmlAttribute( cname, cvalue );
+	if ( attrib )
+	{
+		attributeSet.Add( attrib );
+	}
+	else
+	{
+		TiXmlDocument* document = GetDocument();
+		if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
+	}
+}
+
+
+#ifdef TIXML_USE_STL
+void TiXmlElement::SetAttribute( const std::string& name, const std::string& _value )
+{
+	TiXmlAttribute* node = attributeSet.Find( name );
+	if ( node )
+	{
+		node->SetValue( _value );
+		return;
+	}
+
+	TiXmlAttribute* attrib = new TiXmlAttribute( name, _value );
+	if ( attrib )
+	{
+		attributeSet.Add( attrib );
+	}
+	else
+	{
+		TiXmlDocument* document = GetDocument();
+		if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
+	}
+}
+#endif
+
+
+void TiXmlElement::Print( FILE* cfile, int depth ) const
+{
+	int i;
+	assert( cfile );
+	for ( i=0; i<depth; i++ ) {
+		fprintf( cfile, "    " );
+	}
+
+	fprintf( cfile, "<%s", value.c_str() );
+
+	const TiXmlAttribute* attrib;
+	for ( attrib = attributeSet.First(); attrib; attrib = attrib->Next() )
+	{
+		fprintf( cfile, " " );
+		attrib->Print( cfile, depth );
+	}
+
+	// There are 3 different formatting approaches:
+	// 1) An element without children is printed as a <foo /> node
+	// 2) An element with only a text child is printed as <foo> text </foo>
+	// 3) An element with children is printed on multiple lines.
+	TiXmlNode* node;
+	if ( !firstChild )
+	{
+		fprintf( cfile, " />" );
+	}
+	else if ( firstChild == lastChild && firstChild->ToText() )
+	{
+		fprintf( cfile, ">" );
+		firstChild->Print( cfile, depth + 1 );
+		fprintf( cfile, "</%s>", value.c_str() );
+	}
+	else
+	{
+		fprintf( cfile, ">" );
+
+		for ( node = firstChild; node; node=node->NextSibling() )
+		{
+			if ( !node->ToText() )
+			{
+				fprintf( cfile, "\n" );
+			}
+			node->Print( cfile, depth+1 );
+		}
+		fprintf( cfile, "\n" );
+		for( i=0; i<depth; ++i ) {
+			fprintf( cfile, "    " );
+		}
+		fprintf( cfile, "</%s>", value.c_str() );
+	}
+}
+
+
+void TiXmlElement::CopyTo( TiXmlElement* target ) const
+{
+	// superclass:
+	TiXmlNode::CopyTo( target );
+
+	// Element class:
+	// Clone the attributes, then clone the children.
+	const TiXmlAttribute* attribute = 0;
+	for(	attribute = attributeSet.First();
+	attribute;
+	attribute = attribute->Next() )
+	{
+		target->SetAttribute( attribute->Name(), attribute->Value() );
+	}
+
+	TiXmlNode* node = 0;
+	for ( node = firstChild; node; node = node->NextSibling() )
+	{
+		target->LinkEndChild( node->Clone() );
+	}
+}
+
+bool TiXmlElement::Accept( TiXmlVisitor* visitor ) const
+{
+	if ( visitor->VisitEnter( *this, attributeSet.First() ) )
+	{
+		for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() )
+		{
+			if ( !node->Accept( visitor ) )
+				break;
+		}
+	}
+	return visitor->VisitExit( *this );
+}
+
+
+TiXmlNode* TiXmlElement::Clone() const
+{
+	TiXmlElement* clone = new TiXmlElement( Value() );
+	if ( !clone )
+		return 0;
+
+	CopyTo( clone );
+	return clone;
+}
+
+
+const char* TiXmlElement::GetText() const
+{
+	const TiXmlNode* child = this->FirstChild();
+	if ( child ) {
+		const TiXmlText* childText = child->ToText();
+		if ( childText ) {
+			return childText->Value();
+		}
+	}
+	return 0;
+}
+
+
+TiXmlDocument::TiXmlDocument() : TiXmlNode( TiXmlNode::DOCUMENT )
+{
+	tabsize = 4;
+	useMicrosoftBOM = false;
+	ClearError();
+}
+
+TiXmlDocument::TiXmlDocument( const char * documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
+{
+	tabsize = 4;
+	useMicrosoftBOM = false;
+	value = documentName;
+	ClearError();
+}
+
+
+#ifdef TIXML_USE_STL
+TiXmlDocument::TiXmlDocument( const std::string& documentName ) : TiXmlNode( TiXmlNode::DOCUMENT )
+{
+	tabsize = 4;
+	useMicrosoftBOM = false;
+    value = documentName;
+	ClearError();
+}
+#endif
+
+
+TiXmlDocument::TiXmlDocument( const TiXmlDocument& copy ) : TiXmlNode( TiXmlNode::DOCUMENT )
+{
+	copy.CopyTo( this );
+}
+
+
+void TiXmlDocument::operator=( const TiXmlDocument& copy )
+{
+	Clear();
+	copy.CopyTo( this );
+}
+
+
+bool TiXmlDocument::LoadFile( TiXmlEncoding encoding )
+{
+	// See STL_STRING_BUG below.
+	//StringToBuffer buf( value );
+
+	return LoadFile( Value(), encoding );
+}
+
+
+bool TiXmlDocument::SaveFile() const
+{
+	// See STL_STRING_BUG below.
+//	StringToBuffer buf( value );
+//
+//	if ( buf.buffer && SaveFile( buf.buffer ) )
+//		return true;
+//
+//	return false;
+	return SaveFile( Value() );
+}
+
+bool TiXmlDocument::LoadFile( const char* _filename, TiXmlEncoding encoding )
+{
+	// There was a really terrifying little bug here. The code:
+	//		value = filename
+	// in the STL case, cause the assignment method of the std::string to
+	// be called. What is strange, is that the std::string had the same
+	// address as it's c_str() method, and so bad things happen. Looks
+	// like a bug in the Microsoft STL implementation.
+	// Add an extra string to avoid the crash.
+	TIXML_STRING filename( _filename );
+	value = filename;
+
+	// reading in binary mode so that tinyxml can normalize the EOL
+	FILE* file = TiXmlFOpen( value.c_str (), "rb" );
+
+	if ( file )
+	{
+		bool result = LoadFile( file, encoding );
+		fclose( file );
+		return result;
+	}
+	else
+	{
+		SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN );
+		return false;
+	}
+}
+
+bool TiXmlDocument::LoadFile( FILE* file, TiXmlEncoding encoding )
+{
+	if ( !file )
+	{
+		SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN );
+		return false;
+	}
+
+	// Delete the existing data:
+	Clear();
+	location.Clear();
+
+	// Get the file size, so we can pre-allocate the string. HUGE speed impact.
+	long length = 0;
+	fseek( file, 0, SEEK_END );
+	length = ftell( file );
+	fseek( file, 0, SEEK_SET );
+
+	// Strange case, but good to handle up front.
+	if ( length <= 0 )
+	{
+		SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
+		return false;
+	}
+
+	// If we have a file, assume it is all one big XML file, and read it in.
+	// The document parser may decide the document ends sooner than the entire file, however.
+	TIXML_STRING data;
+	data.reserve( length );
+
+	// Subtle bug here. TinyXml did use fgets. But from the XML spec:
+	// 2.11 End-of-Line Handling
+	// <snip>
+	// <quote>
+	// ...the XML processor MUST behave as if it normalized all line breaks in external
+	// parsed entities (including the document entity) on input, before parsing, by translating
+	// both the two-character sequence #xD #xA and any #xD that is not followed by #xA to
+	// a single #xA character.
+	// </quote>
+	//
+	// It is not clear fgets does that, and certainly isn't clear it works cross platform.
+	// Generally, you expect fgets to translate from the convention of the OS to the c/unix
+	// convention, and not work generally.
+
+	/*
+	while( fgets( buf, sizeof(buf), file ) )
+	{
+		data += buf;
+	}
+	*/
+
+	char* buf = new char[ length+1 ];
+	buf[0] = 0;
+
+	if ( fread( buf, length, 1, file ) != 1 ) {
+		delete [] buf;
+		SetError( TIXML_ERROR_OPENING_FILE, 0, 0, TIXML_ENCODING_UNKNOWN );
+		return false;
+	}
+
+	const char* lastPos = buf;
+	const char* p = buf;
+
+	buf[length] = 0;
+	while( *p ) {
+		assert( p < (buf+length) );
+		if ( *p == 0xa ) {
+			// Newline character. No special rules for this. Append all the characters
+			// since the last string, and include the newline.
+			data.append( lastPos, (p-lastPos+1) );	// append, include the newline
+			++p;									// move past the newline
+			lastPos = p;							// and point to the new buffer (may be 0)
+			assert( p <= (buf+length) );
+		}
+		else if ( *p == 0xd ) {
+			// Carriage return. Append what we have so far, then
+			// handle moving forward in the buffer.
+			if ( (p-lastPos) > 0 ) {
+				data.append( lastPos, p-lastPos );	// do not add the CR
+			}
+			data += (char)0xa;						// a proper newline
+
+			if ( *(p+1) == 0xa ) {
+				// Carriage return - new line sequence
+				p += 2;
+				lastPos = p;
+				assert( p <= (buf+length) );
+			}
+			else {
+				// it was followed by something else...that is presumably characters again.
+				++p;
+				lastPos = p;
+				assert( p <= (buf+length) );
+			}
+		}
+		else {
+			++p;
+		}
+	}
+	// Handle any left over characters.
+	if ( p-lastPos ) {
+		data.append( lastPos, p-lastPos );
+	}
+	delete [] buf;
+	buf = 0;
+
+	Parse( data.c_str(), 0, encoding );
+
+	if (  Error() )
+        return false;
+    else
+		return true;
+}
+
+
+bool TiXmlDocument::SaveFile( const char * filename ) const
+{
+	// The old c stuff lives on...
+	FILE* fp = TiXmlFOpen( filename, "w" );
+	if ( fp )
+	{
+		bool result = SaveFile( fp );
+		fclose( fp );
+		return result;
+	}
+	return false;
+}
+
+
+bool TiXmlDocument::SaveFile( FILE* fp ) const
+{
+	if ( useMicrosoftBOM )
+	{
+		const unsigned char TIXML_UTF_LEAD_0 = 0xefU;
+		const unsigned char TIXML_UTF_LEAD_1 = 0xbbU;
+		const unsigned char TIXML_UTF_LEAD_2 = 0xbfU;
+
+		fputc( TIXML_UTF_LEAD_0, fp );
+		fputc( TIXML_UTF_LEAD_1, fp );
+		fputc( TIXML_UTF_LEAD_2, fp );
+	}
+	Print( fp, 0 );
+	return (ferror(fp) == 0);
+}
+
+
+void TiXmlDocument::CopyTo( TiXmlDocument* target ) const
+{
+	TiXmlNode::CopyTo( target );
+
+	target->error = error;
+	target->errorId = errorId;
+	target->errorDesc = errorDesc;
+	target->tabsize = tabsize;
+	target->errorLocation = errorLocation;
+	target->useMicrosoftBOM = useMicrosoftBOM;
+
+	TiXmlNode* node = 0;
+	for ( node = firstChild; node; node = node->NextSibling() )
+	{
+		target->LinkEndChild( node->Clone() );
+	}
+}
+
+
+TiXmlNode* TiXmlDocument::Clone() const
+{
+	TiXmlDocument* clone = new TiXmlDocument();
+	if ( !clone )
+		return 0;
+
+	CopyTo( clone );
+	return clone;
+}
+
+
+void TiXmlDocument::Print( FILE* cfile, int depth ) const
+{
+	assert( cfile );
+	for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() )
+	{
+		node->Print( cfile, depth );
+		fprintf( cfile, "\n" );
+	}
+}
+
+
+bool TiXmlDocument::Accept( TiXmlVisitor* visitor ) const
+{
+	if ( visitor->VisitEnter( *this ) )
+	{
+		for ( const TiXmlNode* node=FirstChild(); node; node=node->NextSibling() )
+		{
+			if ( !node->Accept( visitor ) )
+				break;
+		}
+	}
+	return visitor->VisitExit( *this );
+}
+
+
+const TiXmlAttribute* TiXmlAttribute::Next() const
+{
+	// We are using knowledge of the sentinel. The sentinel
+	// have a value or name.
+	if ( next->value.empty() && next->name.empty() )
+		return 0;
+	return next;
+}
+
+/*
+TiXmlAttribute* TiXmlAttribute::Next()
+{
+	// We are using knowledge of the sentinel. The sentinel
+	// have a value or name.
+	if ( next->value.empty() && next->name.empty() )
+		return 0;
+	return next;
+}
+*/
+
+const TiXmlAttribute* TiXmlAttribute::Previous() const
+{
+	// We are using knowledge of the sentinel. The sentinel
+	// have a value or name.
+	if ( prev->value.empty() && prev->name.empty() )
+		return 0;
+	return prev;
+}
+
+/*
+TiXmlAttribute* TiXmlAttribute::Previous()
+{
+	// We are using knowledge of the sentinel. The sentinel
+	// have a value or name.
+	if ( prev->value.empty() && prev->name.empty() )
+		return 0;
+	return prev;
+}
+*/
+
+void TiXmlAttribute::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const
+{
+	TIXML_STRING n, v;
+
+	EncodeString( name, &n );
+	EncodeString( value, &v );
+
+	if (value.find ('\"') == TIXML_STRING::npos) {
+		if ( cfile ) {
+		fprintf (cfile, "%s=\"%s\"", n.c_str(), v.c_str() );
+		}
+		if ( str ) {
+			(*str) += n; (*str) += "=\""; (*str) += v; (*str) += "\"";
+		}
+	}
+	else {
+		if ( cfile ) {
+		fprintf (cfile, "%s='%s'", n.c_str(), v.c_str() );
+		}
+		if ( str ) {
+			(*str) += n; (*str) += "='"; (*str) += v; (*str) += "'";
+		}
+	}
+}
+
+
+int TiXmlAttribute::QueryIntValue( int* ival ) const
+{
+	if ( TIXML_SSCANF( value.c_str(), "%d", ival ) == 1 )
+		return TIXML_SUCCESS;
+	return TIXML_WRONG_TYPE;
+}
+
+int TiXmlAttribute::QueryDoubleValue( double* dval ) const
+{
+	if ( TIXML_SSCANF( value.c_str(), "%lf", dval ) == 1 )
+		return TIXML_SUCCESS;
+	return TIXML_WRONG_TYPE;
+}
+
+void TiXmlAttribute::SetIntValue( int _value )
+{
+	char buf [64];
+	#if defined(TIXML_SNPRINTF)
+		TIXML_SNPRINTF(buf, sizeof(buf), "%d", _value);
+	#else
+		sprintf (buf, "%d", _value);
+	#endif
+	SetValue (buf);
+}
+
+void TiXmlAttribute::SetDoubleValue( double _value )
+{
+	char buf [256];
+	#if defined(TIXML_SNPRINTF)
+		TIXML_SNPRINTF( buf, sizeof(buf), "%lf", _value);
+	#else
+		sprintf (buf, "%lf", _value);
+	#endif
+	SetValue (buf);
+}
+
+int TiXmlAttribute::IntValue() const
+{
+	return atoi (value.c_str ());
+}
+
+double  TiXmlAttribute::DoubleValue() const
+{
+	return atof (value.c_str ());
+}
+
+
+TiXmlComment::TiXmlComment( const TiXmlComment& copy ) : TiXmlNode( TiXmlNode::COMMENT )
+{
+	copy.CopyTo( this );
+}
+
+
+void TiXmlComment::operator=( const TiXmlComment& base )
+{
+	Clear();
+	base.CopyTo( this );
+}
+
+
+void TiXmlComment::Print( FILE* cfile, int depth ) const
+{
+	assert( cfile );
+	for ( int i=0; i<depth; i++ )
+	{
+		fprintf( cfile,  "    " );
+	}
+	fprintf( cfile, "<!--%s-->", value.c_str() );
+}
+
+
+void TiXmlComment::CopyTo( TiXmlComment* target ) const
+{
+	TiXmlNode::CopyTo( target );
+}
+
+
+bool TiXmlComment::Accept( TiXmlVisitor* visitor ) const
+{
+	return visitor->Visit( *this );
+}
+
+
+TiXmlNode* TiXmlComment::Clone() const
+{
+	TiXmlComment* clone = new TiXmlComment();
+
+	if ( !clone )
+		return 0;
+
+	CopyTo( clone );
+	return clone;
+}
+
+
+void TiXmlText::Print( FILE* cfile, int depth ) const
+{
+	assert( cfile );
+	if ( cdata )
+	{
+		int i;
+		fprintf( cfile, "\n" );
+		for ( i=0; i<depth; i++ ) {
+			fprintf( cfile, "    " );
+		}
+		fprintf( cfile, "<![CDATA[%s]]>\n", value.c_str() );	// unformatted output
+	}
+	else
+	{
+		TIXML_STRING buffer;
+		EncodeString( value, &buffer );
+		fprintf( cfile, "%s", buffer.c_str() );
+	}
+}
+
+
+void TiXmlText::CopyTo( TiXmlText* target ) const
+{
+	TiXmlNode::CopyTo( target );
+	target->cdata = cdata;
+}
+
+
+bool TiXmlText::Accept( TiXmlVisitor* visitor ) const
+{
+	return visitor->Visit( *this );
+}
+
+
+TiXmlNode* TiXmlText::Clone() const
+{
+	TiXmlText* clone = 0;
+	clone = new TiXmlText( "" );
+
+	if ( !clone )
+		return 0;
+
+	CopyTo( clone );
+	return clone;
+}
+
+
+TiXmlDeclaration::TiXmlDeclaration( const char * _version,
+									const char * _encoding,
+									const char * _standalone )
+	: TiXmlNode( TiXmlNode::DECLARATION )
+{
+	version = _version;
+	encoding = _encoding;
+	standalone = _standalone;
+}
+
+
+#ifdef TIXML_USE_STL
+TiXmlDeclaration::TiXmlDeclaration(	const std::string& _version,
+									const std::string& _encoding,
+									const std::string& _standalone )
+	: TiXmlNode( TiXmlNode::DECLARATION )
+{
+	version = _version;
+	encoding = _encoding;
+	standalone = _standalone;
+}
+#endif
+
+
+TiXmlDeclaration::TiXmlDeclaration( const TiXmlDeclaration& copy )
+	: TiXmlNode( TiXmlNode::DECLARATION )
+{
+	copy.CopyTo( this );
+}
+
+
+void TiXmlDeclaration::operator=( const TiXmlDeclaration& copy )
+{
+	Clear();
+	copy.CopyTo( this );
+}
+
+
+void TiXmlDeclaration::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const
+{
+	if ( cfile ) fprintf( cfile, "<?xml " );
+	if ( str )	 (*str) += "<?xml ";
+
+	if ( !version.empty() ) {
+		if ( cfile ) fprintf (cfile, "version=\"%s\" ", version.c_str ());
+		if ( str ) { (*str) += "version=\""; (*str) += version; (*str) += "\" "; }
+	}
+	if ( !encoding.empty() ) {
+		if ( cfile ) fprintf (cfile, "encoding=\"%s\" ", encoding.c_str ());
+		if ( str ) { (*str) += "encoding=\""; (*str) += encoding; (*str) += "\" "; }
+	}
+	if ( !standalone.empty() ) {
+		if ( cfile ) fprintf (cfile, "standalone=\"%s\" ", standalone.c_str ());
+		if ( str ) { (*str) += "standalone=\""; (*str) += standalone; (*str) += "\" "; }
+	}
+	if ( cfile ) fprintf( cfile, "?>" );
+	if ( str )	 (*str) += "?>";
+}
+
+
+void TiXmlDeclaration::CopyTo( TiXmlDeclaration* target ) const
+{
+	TiXmlNode::CopyTo( target );
+
+	target->version = version;
+	target->encoding = encoding;
+	target->standalone = standalone;
+}
+
+
+bool TiXmlDeclaration::Accept( TiXmlVisitor* visitor ) const
+{
+	return visitor->Visit( *this );
+}
+
+
+TiXmlNode* TiXmlDeclaration::Clone() const
+{
+	TiXmlDeclaration* clone = new TiXmlDeclaration();
+
+	if ( !clone )
+		return 0;
+
+	CopyTo( clone );
+	return clone;
+}
+
+TiXmlStylesheetReference::TiXmlStylesheetReference( const char * _type,
+													const char * _href )
+	: TiXmlNode( TiXmlNode::STYLESHEETREFERENCE )
+{
+	type = _type;
+	href = _href;
+}
+
+
+#ifdef TIXML_USE_STL
+TiXmlStylesheetReference::TiXmlStylesheetReference(	const std::string& _type,
+													const std::string& _href )
+	: TiXmlNode( TiXmlNode::STYLESHEETREFERENCE )
+{
+	type = _type;
+	href = _href;
+}
+#endif
+
+
+TiXmlStylesheetReference::TiXmlStylesheetReference( const TiXmlStylesheetReference& copy )
+	: TiXmlNode( TiXmlNode::STYLESHEETREFERENCE )
+{
+	copy.CopyTo( this );
+}
+
+
+void TiXmlStylesheetReference::operator=( const TiXmlStylesheetReference& copy )
+{
+	Clear();
+	copy.CopyTo( this );
+}
+
+
+void TiXmlStylesheetReference::Print( FILE* cfile, int /*depth*/, TIXML_STRING* str ) const
+{
+	if ( cfile ) fprintf( cfile, "<?xml-stylesheet " );
+	if ( str )	 (*str) += "<?xml-stylesheet ";
+
+	if ( !type.empty() ) {
+		if ( cfile ) fprintf (cfile, "type=\"%s\" ", type.c_str ());
+		if ( str ) { (*str) += "type=\""; (*str) += type; (*str) += "\" "; }
+	}
+	if ( !href.empty() ) {
+		if ( cfile ) fprintf (cfile, "href=\"%s\" ", href.c_str ());
+		if ( str ) { (*str) += "href=\""; (*str) += href; (*str) += "\" "; }
+	}
+	if ( cfile ) fprintf (cfile, "?>");
+	if ( str )	 (*str) += "?>";
+}
+
+void TiXmlStylesheetReference::CopyTo( TiXmlStylesheetReference* target ) const
+{
+	TiXmlNode::CopyTo( target );
+
+	target->type = type;
+	target->href = href;
+}
+
+bool TiXmlStylesheetReference::Accept( TiXmlVisitor* visitor ) const
+{
+	return visitor->Visit( *this );
+}
+
+TiXmlNode* TiXmlStylesheetReference::Clone() const
+{
+	TiXmlStylesheetReference* clone = new TiXmlStylesheetReference();
+
+	if ( !clone )
+		return 0;
+
+	CopyTo( clone );
+	return clone;
+}
+
+void TiXmlUnknown::Print( FILE* cfile, int depth ) const
+{
+	for ( int i=0; i<depth; i++ )
+		fprintf( cfile, "    " );
+	fprintf( cfile, "<%s>", value.c_str() );
+}
+
+
+void TiXmlUnknown::CopyTo( TiXmlUnknown* target ) const
+{
+	TiXmlNode::CopyTo( target );
+}
+
+
+bool TiXmlUnknown::Accept( TiXmlVisitor* visitor ) const
+{
+	return visitor->Visit( *this );
+}
+
+
+TiXmlNode* TiXmlUnknown::Clone() const
+{
+	TiXmlUnknown* clone = new TiXmlUnknown();
+
+	if ( !clone )
+		return 0;
+
+	CopyTo( clone );
+	return clone;
+}
+
+
+TiXmlAttributeSet::TiXmlAttributeSet()
+{
+	sentinel.next = &sentinel;
+	sentinel.prev = &sentinel;
+}
+
+
+TiXmlAttributeSet::~TiXmlAttributeSet()
+{
+	assert( sentinel.next == &sentinel );
+	assert( sentinel.prev == &sentinel );
+}
+
+
+void TiXmlAttributeSet::Add( TiXmlAttribute* addMe )
+{
+    #ifdef TIXML_USE_STL
+	assert( !Find( TIXML_STRING( addMe->Name() ) ) );	// Shouldn't be multiply adding to the set.
+	#else
+	assert( !Find( addMe->Name() ) );	// Shouldn't be multiply adding to the set.
+	#endif
+
+	addMe->next = &sentinel;
+	addMe->prev = sentinel.prev;
+
+	sentinel.prev->next = addMe;
+	sentinel.prev      = addMe;
+}
+
+void TiXmlAttributeSet::Remove( TiXmlAttribute* removeMe )
+{
+	TiXmlAttribute* node;
+
+	for( node = sentinel.next; node != &sentinel; node = node->next )
+	{
+		if ( node == removeMe )
+		{
+			node->prev->next = node->next;
+			node->next->prev = node->prev;
+			node->next = 0;
+			node->prev = 0;
+			return;
+		}
+	}
+	assert( 0 );		// we tried to remove a non-linked attribute.
+}
+
+
+#ifdef TIXML_USE_STL
+const TiXmlAttribute* TiXmlAttributeSet::Find( const std::string& name ) const
+{
+	for( const TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
+	{
+		if ( node->name == name )
+			return node;
+	}
+	return 0;
+}
+
+/*
+TiXmlAttribute*	TiXmlAttributeSet::Find( const std::string& name )
+{
+	for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
+	{
+		if ( node->name == name )
+			return node;
+	}
+	return 0;
+}
+*/
+#endif
+
+
+const TiXmlAttribute* TiXmlAttributeSet::Find( const char* name ) const
+{
+	for( const TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
+	{
+		if ( strcmp( node->name.c_str(), name ) == 0 )
+			return node;
+	}
+	return 0;
+}
+
+/*
+TiXmlAttribute*	TiXmlAttributeSet::Find( const char* name )
+{
+	for( TiXmlAttribute* node = sentinel.next; node != &sentinel; node = node->next )
+	{
+		if ( strcmp( node->name.c_str(), name ) == 0 )
+			return node;
+	}
+	return 0;
+}
+*/
+
+#ifdef TIXML_USE_STL
+std::istream& operator>> (std::istream & in, TiXmlNode & base)
+{
+	TIXML_STRING tag;
+	tag.reserve( 8 * 1000 );
+	base.StreamIn( &in, &tag );
+
+	base.Parse( tag.c_str(), 0, TIXML_DEFAULT_ENCODING );
+	return in;
+}
+#endif
+
+
+#ifdef TIXML_USE_STL
+std::ostream& operator<< (std::ostream & out, const TiXmlNode & base)
+{
+	TiXmlPrinter printer;
+	printer.SetStreamPrinting();
+	base.Accept( &printer );
+	out << printer.Str();
+
+	return out;
+}
+
+
+std::string& operator<< (std::string& out, const TiXmlNode& base )
+{
+	TiXmlPrinter printer;
+	printer.SetStreamPrinting();
+	base.Accept( &printer );
+	out.append( printer.Str() );
+
+	return out;
+}
+#endif
+
+
+TiXmlHandle TiXmlHandle::FirstChild() const
+{
+	if ( node )
+	{
+		TiXmlNode* child = node->FirstChild();
+		if ( child )
+			return TiXmlHandle( child );
+	}
+	return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::FirstChild( const char * value ) const
+{
+	if ( node )
+	{
+		TiXmlNode* child = node->FirstChild( value );
+		if ( child )
+			return TiXmlHandle( child );
+	}
+	return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::FirstChildElement() const
+{
+	if ( node )
+	{
+		TiXmlElement* child = node->FirstChildElement();
+		if ( child )
+			return TiXmlHandle( child );
+	}
+	return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::FirstChildElement( const char * value ) const
+{
+	if ( node )
+	{
+		TiXmlElement* child = node->FirstChildElement( value );
+		if ( child )
+			return TiXmlHandle( child );
+	}
+	return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::Child( int count ) const
+{
+	if ( node )
+	{
+		int i;
+		TiXmlNode* child = node->FirstChild();
+		for (	i=0;
+				child && i<count;
+				child = child->NextSibling(), ++i )
+		{
+			// nothing
+		}
+		if ( child )
+			return TiXmlHandle( child );
+	}
+	return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::Child( const char* value, int count ) const
+{
+	if ( node )
+	{
+		int i;
+		TiXmlNode* child = node->FirstChild( value );
+		for (	i=0;
+				child && i<count;
+				child = child->NextSibling( value ), ++i )
+		{
+			// nothing
+		}
+		if ( child )
+			return TiXmlHandle( child );
+	}
+	return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::ChildElement( int count ) const
+{
+	if ( node )
+	{
+		int i;
+		TiXmlElement* child = node->FirstChildElement();
+		for (	i=0;
+				child && i<count;
+				child = child->NextSiblingElement(), ++i )
+		{
+			// nothing
+		}
+		if ( child )
+			return TiXmlHandle( child );
+	}
+	return TiXmlHandle( 0 );
+}
+
+
+TiXmlHandle TiXmlHandle::ChildElement( const char* value, int count ) const
+{
+	if ( node )
+	{
+		int i;
+		TiXmlElement* child = node->FirstChildElement( value );
+		for (	i=0;
+				child && i<count;
+				child = child->NextSiblingElement( value ), ++i )
+		{
+			// nothing
+		}
+		if ( child )
+			return TiXmlHandle( child );
+	}
+	return TiXmlHandle( 0 );
+}
+
+
+bool TiXmlPrinter::VisitEnter( const TiXmlDocument& )
+{
+	return true;
+}
+
+bool TiXmlPrinter::VisitExit( const TiXmlDocument& )
+{
+	return true;
+}
+
+bool TiXmlPrinter::VisitEnter( const TiXmlElement& element, const TiXmlAttribute* firstAttribute )
+{
+	DoIndent();
+	buffer += "<";
+	buffer += element.Value();
+
+	for( const TiXmlAttribute* attrib = firstAttribute; attrib; attrib = attrib->Next() )
+	{
+		buffer += " ";
+		attrib->Print( 0, 0, &buffer );
+	}
+
+	if ( !element.FirstChild() )
+	{
+		buffer += " />";
+		DoLineBreak();
+	}
+	else
+	{
+		buffer += ">";
+		if (    element.FirstChild()->ToText()
+			  && element.LastChild() == element.FirstChild()
+			  && element.FirstChild()->ToText()->CDATA() == false )
+		{
+			simpleTextPrint = true;
+			// no DoLineBreak()!
+		}
+		else
+		{
+			DoLineBreak();
+		}
+	}
+	++depth;
+	return true;
+}
+
+
+bool TiXmlPrinter::VisitExit( const TiXmlElement& element )
+{
+	--depth;
+	if ( !element.FirstChild() )
+	{
+		// nothing.
+	}
+	else
+	{
+		if ( simpleTextPrint )
+		{
+			simpleTextPrint = false;
+		}
+		else
+		{
+			DoIndent();
+		}
+		buffer += "</";
+		buffer += element.Value();
+		buffer += ">";
+		DoLineBreak();
+	}
+	return true;
+}
+
+
+bool TiXmlPrinter::Visit( const TiXmlText& text )
+{
+	if ( text.CDATA() )
+	{
+		DoIndent();
+		buffer += "<![CDATA[";
+		buffer += text.Value();
+		buffer += "]]>";
+		DoLineBreak();
+	}
+	else if ( simpleTextPrint )
+	{
+		TIXML_STRING str;
+		TiXmlBase::EncodeString( text.ValueTStr(), &str );
+		buffer += str;
+	}
+	else
+	{
+		DoIndent();
+		TIXML_STRING str;
+		TiXmlBase::EncodeString( text.ValueTStr(), &str );
+		buffer += str;
+		DoLineBreak();
+	}
+	return true;
+}
+
+
+bool TiXmlPrinter::Visit( const TiXmlDeclaration& declaration )
+{
+	DoIndent();
+	declaration.Print( 0, 0, &buffer );
+	DoLineBreak();
+	return true;
+}
+
+
+bool TiXmlPrinter::Visit( const TiXmlComment& comment )
+{
+	DoIndent();
+	buffer += "<!--";
+	buffer += comment.Value();
+	buffer += "-->";
+	DoLineBreak();
+	return true;
+}
+
+
+bool TiXmlPrinter::Visit( const TiXmlUnknown& unknown )
+{
+	DoIndent();
+	buffer += "<";
+	buffer += unknown.Value();
+	buffer += ">";
+	DoLineBreak();
+	return true;
+}
+
Index: /code/branches/buildsystem3/src/tinyxml/tinyxml.h
===================================================================
--- /code/branches/buildsystem3/src/tinyxml/tinyxml.h	(revision 2663)
+++ /code/branches/buildsystem3/src/tinyxml/tinyxml.h	(revision 2664)
@@ -1,4 +1,2 @@
-#define TIXML_USE_TICPP
-
 /*
 www.sourceforge.net/projects/tinyxml
Index: de/branches/buildsystem3/src/tinyxml/tinyxmlerror.cc
===================================================================
--- /code/branches/buildsystem3/src/tinyxml/tinyxmlerror.cc	(revision 2663)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
-www.sourceforge.net/projects/tinyxml
-Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
-
-This software is provided 'as-is', without any express or implied 
-warranty. In no event will the authors be held liable for any 
-damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any 
-purpose, including commercial applications, and to alter it and 
-redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must
-not claim that you wrote the original software. If you use this
-software in a product, an acknowledgment in the product documentation
-would be appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and
-must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
-distribution.
-*/
-
-#include "tinyxml.h"
-
-// The goal of the seperate error file is to make the first
-// step towards localization. tinyxml (currently) only supports
-// english error messages, but the could now be translated.
-//
-// It also cleans up the code a bit.
-//
-
-const char* TiXmlBase::errorString[ TIXML_ERROR_STRING_COUNT ] =
-{
-	"No error",
-	"Error",
-	"Failed to open file",
-	"Memory allocation failed.",
-	"Error parsing Element.",
-	"Failed to read Element name",
-	"Error reading Element value.",
-	"Error reading Attributes.",
-	"Error: empty tag.",
-	"Error reading end tag.",
-	"Error parsing Unknown.",
-	"Error parsing Comment.",
-	"Error parsing Declaration.",
-	"Error document empty.",
-	"Error null (0) or unexpected EOF found in input stream.",
-	"Error parsing CDATA.",
-	"Error when TiXmlDocument added to document, because TiXmlDocument can only be at the root.",
-};
Index: /code/branches/buildsystem3/src/tinyxml/tinyxmlerror.cpp
===================================================================
--- /code/branches/buildsystem3/src/tinyxml/tinyxmlerror.cpp	(revision 2664)
+++ /code/branches/buildsystem3/src/tinyxml/tinyxmlerror.cpp	(revision 2664)
@@ -0,0 +1,53 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original code (2.0 and earlier )copyright (c) 2000-2006 Lee Thomason (www.grinninglizard.com)
+
+This software is provided 'as-is', without any express or implied 
+warranty. In no event will the authors be held liable for any 
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any 
+purpose, including commercial applications, and to alter it and 
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+
+#include "tinyxml.h"
+
+// The goal of the seperate error file is to make the first
+// step towards localization. tinyxml (currently) only supports
+// english error messages, but the could now be translated.
+//
+// It also cleans up the code a bit.
+//
+
+const char* TiXmlBase::errorString[ TIXML_ERROR_STRING_COUNT ] =
+{
+	"No error",
+	"Error",
+	"Failed to open file",
+	"Memory allocation failed.",
+	"Error parsing Element.",
+	"Failed to read Element name",
+	"Error reading Element value.",
+	"Error reading Attributes.",
+	"Error: empty tag.",
+	"Error reading end tag.",
+	"Error parsing Unknown.",
+	"Error parsing Comment.",
+	"Error parsing Declaration.",
+	"Error document empty.",
+	"Error null (0) or unexpected EOF found in input stream.",
+	"Error parsing CDATA.",
+	"Error when TiXmlDocument added to document, because TiXmlDocument can only be at the root.",
+};
Index: de/branches/buildsystem3/src/tinyxml/tinyxmlparser.cc
===================================================================
--- /code/branches/buildsystem3/src/tinyxml/tinyxmlparser.cc	(revision 2663)
+++ 	(revision )
@@ -1,1722 +1,0 @@
-/*
-www.sourceforge.net/projects/tinyxml
-Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any
-damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any
-purpose, including commercial applications, and to alter it and
-redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must
-not claim that you wrote the original software. If you use this
-software in a product, an acknowledgment in the product documentation
-would be appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and
-must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
-distribution.
-*/
-
-#include <ctype.h>
-#include <stddef.h>
-
-#include "tinyxml.h"
-
-//#define DEBUG_PARSER
-#if defined( DEBUG_PARSER )
-#	if defined( DEBUG ) && defined( _MSC_VER )
-#		include <windows.h>
-#		define TIXML_LOG OutputDebugString
-#	else
-#		define TIXML_LOG printf
-#	endif
-#endif
-
-// Note tha "PutString" hardcodes the same list. This
-// is less flexible than it appears. Changing the entries
-// or order will break putstring.
-TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] =
-{
-	{ "&amp;",  5, '&' },
-	{ "&lt;",   4, '<' },
-	{ "&gt;",   4, '>' },
-	{ "&quot;", 6, '\"' },
-	{ "&apos;", 6, '\'' }
-};
-
-// Bunch of unicode info at:
-//		http://www.unicode.org/faq/utf_bom.html
-// Including the basic of this table, which determines the #bytes in the
-// sequence from the lead byte. 1 placed for invalid sequences --
-// although the result will be junk, pass it through as much as possible.
-// Beware of the non-characters in UTF-8:
-//				ef bb bf (Microsoft "lead bytes")
-//				ef bf be
-//				ef bf bf
-
-const unsigned char TIXML_UTF_LEAD_0 = 0xefU;
-const unsigned char TIXML_UTF_LEAD_1 = 0xbbU;
-const unsigned char TIXML_UTF_LEAD_2 = 0xbfU;
-
-const int TiXmlBase::utf8ByteTable[256] =
-{
-	//	0	1	2	3	4	5	6	7	8	9	a	b	c	d	e	f
-		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0x00
-		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0x10
-		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0x20
-		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0x30
-		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0x40
-		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0x50
-		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0x60
-		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0x70	End of ASCII range
-		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0x80 0x80 to 0xc1 invalid
-		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0x90
-		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0xa0
-		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0xb0
-		1,	1,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	// 0xc0 0xc2 to 0xdf 2 byte
-		2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	// 0xd0
-		3,	3,	3,	3,	3,	3,	3,	3,	3,	3,	3,	3,	3,	3,	3,	3,	// 0xe0 0xe0 to 0xef 3 byte
-		4,	4,	4,	4,	4,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1	// 0xf0 0xf0 to 0xf4 4 byte, 0xf5 and higher invalid
-};
-
-
-void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length )
-{
-	const unsigned long BYTE_MASK = 0xBF;
-	const unsigned long BYTE_MARK = 0x80;
-	const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
-
-	if (input < 0x80)
-		*length = 1;
-	else if ( input < 0x800 )
-		*length = 2;
-	else if ( input < 0x10000 )
-		*length = 3;
-	else if ( input < 0x200000 )
-		*length = 4;
-	else
-		{ *length = 0; return; }	// This code won't covert this correctly anyway.
-
-	output += *length;
-
-	// Scary scary fall throughs.
-	switch (*length)
-	{
-		case 4:
-			--output;
-			*output = (char)((input | BYTE_MARK) & BYTE_MASK);
-			input >>= 6;
-		case 3:
-			--output;
-			*output = (char)((input | BYTE_MARK) & BYTE_MASK);
-			input >>= 6;
-		case 2:
-			--output;
-			*output = (char)((input | BYTE_MARK) & BYTE_MASK);
-			input >>= 6;
-		case 1:
-			--output;
-			*output = (char)(input | FIRST_BYTE_MARK[*length]);
-	}
-}
-
-
-/*static*/ int TiXmlBase::IsAlpha( unsigned char anyByte, TiXmlEncoding /*encoding*/ )
-{
-	// This will only work for low-ascii, everything else is assumed to be a valid
-	// letter. I'm not sure this is the best approach, but it is quite tricky trying
-	// to figure out alhabetical vs. not across encoding. So take a very
-	// conservative approach.
-
-//	if ( encoding == TIXML_ENCODING_UTF8 )
-//	{
-		if ( anyByte < 127 )
-			return isalpha( anyByte );
-		else
-			return 1;	// What else to do? The unicode set is huge...get the english ones right.
-//	}
-//	else
-//	{
-//		return isalpha( anyByte );
-//	}
-}
-
-
-/*static*/ int TiXmlBase::IsAlphaNum( unsigned char anyByte, TiXmlEncoding /*encoding*/ )
-{
-	// This will only work for low-ascii, everything else is assumed to be a valid
-	// letter. I'm not sure this is the best approach, but it is quite tricky trying
-	// to figure out alhabetical vs. not across encoding. So take a very
-	// conservative approach.
-
-//	if ( encoding == TIXML_ENCODING_UTF8 )
-//	{
-		if ( anyByte < 127 )
-			return isalnum( anyByte );
-		else
-			return 1;	// What else to do? The unicode set is huge...get the english ones right.
-//	}
-//	else
-//	{
-//		return isalnum( anyByte );
-//	}
-}
-
-
-class TiXmlParsingData
-{
-	friend class TiXmlDocument;
-  public:
-	void Stamp( const char* now, TiXmlEncoding encoding );
-
-	const TiXmlCursor& Cursor()	{ return cursor; }
-
-  private:
-	// Only used by the document!
-	TiXmlParsingData( const char* start, int _tabsize, int row, int col )
-	{
-		assert( start );
-		stamp = start;
-		tabsize = _tabsize;
-		cursor.row = row;
-		cursor.col = col;
-	}
-
-	TiXmlCursor		cursor;
-	const char*		stamp;
-	int				tabsize;
-};
-
-
-void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding )
-{
-	assert( now );
-
-	// Do nothing if the tabsize is 0.
-	if ( tabsize < 1 )
-	{
-		return;
-	}
-
-	// Get the current row, column.
-	int row = cursor.row;
-	int col = cursor.col;
-	const char* p = stamp;
-	assert( p );
-
-	while ( p < now )
-	{
-		// Treat p as unsigned, so we have a happy compiler.
-		const unsigned char* pU = (const unsigned char*)p;
-
-		// Code contributed by Fletcher Dunn: (modified by lee)
-		switch (*pU) {
-			case 0:
-				// We *should* never get here, but in case we do, don't
-				// advance past the terminating null character, ever
-				return;
-
-			case '\r':
-				// bump down to the next line
-				++row;
-				col = 0;
-				// Eat the character
-				++p;
-
-				// Check for \r\n sequence, and treat this as a single character
-				if (*p == '\n') {
-					++p;
-				}
-				break;
-
-			case '\n':
-				// bump down to the next line
-				++row;
-				col = 0;
-
-				// Eat the character
-				++p;
-
-				// Check for \n\r sequence, and treat this as a single
-				// character.  (Yes, this bizarre thing does occur still
-				// on some arcane platforms...)
-				if (*p == '\r') {
-					++p;
-				}
-				break;
-
-			case '\t':
-				// Eat the character
-				++p;
-
-				// Skip to next tab stop
-				col = (col / tabsize + 1) * tabsize;
-				break;
-
-			case TIXML_UTF_LEAD_0:
-				if ( encoding == TIXML_ENCODING_UTF8 )
-				{
-					if ( *(p+1) && *(p+2) )
-					{
-						// In these cases, don't advance the column. These are
-						// 0-width spaces.
-						if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 )
-							p += 3;
-						else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU )
-							p += 3;
-						else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU )
-							p += 3;
-						else
-							{ p +=3; ++col; }	// A normal character.
-					}
-				}
-				else
-				{
-					++p;
-					++col;
-				}
-				break;
-
-			default:
-				if ( encoding == TIXML_ENCODING_UTF8 )
-				{
-					// Eat the 1 to 4 byte utf8 character.
-					int step = TiXmlBase::utf8ByteTable[*((const unsigned char*)p)];
-					if ( step == 0 )
-						step = 1;		// Error case from bad encoding, but handle gracefully.
-					p += step;
-
-					// Just advance one column, of course.
-					++col;
-				}
-				else
-				{
-					++p;
-					++col;
-				}
-				break;
-		}
-	}
-	cursor.row = row;
-	cursor.col = col;
-	assert( cursor.row >= -1 );
-	assert( cursor.col >= -1 );
-	stamp = p;
-	assert( stamp );
-}
-
-
-const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding )
-{
-	if ( !p || !*p )
-	{
-		return 0;
-	}
-	if ( encoding == TIXML_ENCODING_UTF8 )
-	{
-		while ( *p )
-		{
-			const unsigned char* pU = (const unsigned char*)p;
-
-			// Skip the stupid Microsoft UTF-8 Byte order marks
-			if (	*(pU+0)==TIXML_UTF_LEAD_0
-				 && *(pU+1)==TIXML_UTF_LEAD_1
-				 && *(pU+2)==TIXML_UTF_LEAD_2 )
-			{
-				p += 3;
-				continue;
-			}
-			else if(*(pU+0)==TIXML_UTF_LEAD_0
-				 && *(pU+1)==0xbfU
-				 && *(pU+2)==0xbeU )
-			{
-				p += 3;
-				continue;
-			}
-			else if(*(pU+0)==TIXML_UTF_LEAD_0
-				 && *(pU+1)==0xbfU
-				 && *(pU+2)==0xbfU )
-			{
-				p += 3;
-				continue;
-			}
-
-			if ( IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' )		// Still using old rules for white space.
-				++p;
-			else
-				break;
-		}
-	}
-	else
-	{
-		while ( *p && IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' )
-			++p;
-	}
-
-	return p;
-}
-
-#ifdef TIXML_USE_STL
-/*static*/ bool TiXmlBase::StreamWhiteSpace( std::istream * in, TIXML_STRING * tag )
-{
-	for( ;; )
-	{
-		if ( !in->good() ) return false;
-
-		int c = in->peek();
-		// At this scope, we can't get to a document. So fail silently.
-		if ( !IsWhiteSpace( c ) || c <= 0 )
-			return true;
-
-		*tag += (char) in->get();
-	}
-}
-
-/*static*/ bool TiXmlBase::StreamTo( std::istream * in, int character, TIXML_STRING * tag )
-{
-	//assert( character > 0 && character < 128 );	// else it won't work in utf-8
-	while ( in->good() )
-	{
-		int c = in->peek();
-		if ( c == character )
-			return true;
-		if ( c <= 0 )		// Silent failure: can't get document at this scope
-			return false;
-
-		in->get();
-		*tag += (char) c;
-	}
-	return false;
-}
-#endif
-
-// One of TinyXML's more performance demanding functions. Try to keep the memory overhead down. The
-// "assign" optimization removes over 10% of the execution time.
-//
-const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncoding encoding )
-{
-	// Oddly, not supported on some comilers,
-	//name->clear();
-	// So use this:
-	*name = "";
-	assert( p );
-
-	// Names start with letters or underscores.
-	// Of course, in unicode, tinyxml has no idea what a letter *is*. The
-	// algorithm is generous.
-	//
-	// After that, they can be letters, underscores, numbers,
-	// hyphens, or colons. (Colons are valid ony for namespaces,
-	// but tinyxml can't tell namespaces from names.)
-	if (    p && *p
-		 && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) )
-	{
-		const char* start = p;
-		while(		p && *p
-				&&	(		IsAlphaNum( (unsigned char ) *p, encoding )
-						 || *p == '_'
-						 || *p == '-'
-						 || *p == '.'
-						 || *p == ':' ) )
-		{
-			//(*name) += *p; // expensive
-			++p;
-		}
-		if ( p-start > 0 ) {
-			name->assign( start, p-start );
-		}
-		return p;
-	}
-	return 0;
-}
-
-const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXmlEncoding encoding )
-{
-	// Presume an entity, and pull it out.
-    TIXML_STRING ent;
-	int i;
-	*length = 0;
-
-	if ( *(p+1) && *(p+1) == '#' && *(p+2) )
-	{
-		unsigned long ucs = 0;
-		ptrdiff_t delta = 0;
-		unsigned mult = 1;
-
-		if ( *(p+2) == 'x' )
-		{
-			// Hexadecimal.
-			if ( !*(p+3) ) return 0;
-
-			const char* q = p+3;
-			q = strchr( q, ';' );
-
-			if ( !q || !*q ) return 0;
-
-			delta = q-p;
-			--q;
-
-			while ( *q != 'x' )
-			{
-				if ( *q >= '0' && *q <= '9' )
-					ucs += mult * (*q - '0');
-				else if ( *q >= 'a' && *q <= 'f' )
-					ucs += mult * (*q - 'a' + 10);
-				else if ( *q >= 'A' && *q <= 'F' )
-					ucs += mult * (*q - 'A' + 10 );
-				else
-					return 0;
-				mult *= 16;
-				--q;
-			}
-		}
-		else
-		{
-			// Decimal.
-			if ( !*(p+2) ) return 0;
-
-			const char* q = p+2;
-			q = strchr( q, ';' );
-
-			if ( !q || !*q ) return 0;
-
-			delta = q-p;
-			--q;
-
-			while ( *q != '#' )
-			{
-				if ( *q >= '0' && *q <= '9' )
-					ucs += mult * (*q - '0');
-				else
-					return 0;
-				mult *= 10;
-				--q;
-			}
-		}
-		if ( encoding == TIXML_ENCODING_UTF8 )
-		{
-			// convert the UCS to UTF-8
-			ConvertUTF32ToUTF8( ucs, value, length );
-		}
-		else
-		{
-			*value = (char)ucs;
-			*length = 1;
-		}
-		return p + delta + 1;
-	}
-
-	// Now try to match it.
-	for( i=0; i<NUM_ENTITY; ++i )
-	{
-		if ( strncmp( entity[i].str, p, entity[i].strLength ) == 0 )
-		{
-			assert( strlen( entity[i].str ) == entity[i].strLength );
-			*value = entity[i].chr;
-			*length = 1;
-			return ( p + entity[i].strLength );
-		}
-	}
-
-	// So it wasn't an entity, its unrecognized, or something like that.
-	*value = *p;	// Don't put back the last one, since we return it!
-	//*length = 1;	// Leave unrecognized entities - this doesn't really work.
-					// Just writes strange XML.
-	return p+1;
-}
-
-
-bool TiXmlBase::StringEqual( const char* p,
-							 const char* tag,
-							 bool ignoreCase,
-							 TiXmlEncoding encoding )
-{
-	assert( p );
-	assert( tag );
-	if ( !p || !*p )
-	{
-		assert( 0 );
-		return false;
-	}
-
-	const char* q = p;
-
-	if ( ignoreCase )
-	{
-		while ( *q && *tag && ToLower( *q, encoding ) == ToLower( *tag, encoding ) )
-		{
-			++q;
-			++tag;
-		}
-
-		if ( *tag == 0 )
-			return true;
-	}
-	else
-	{
-		while ( *q && *tag && *q == *tag )
-		{
-			++q;
-			++tag;
-		}
-
-		if ( *tag == 0 )		// Have we found the end of the tag, and everything equal?
-			return true;
-	}
-	return false;
-}
-
-const char* TiXmlBase::ReadText(	const char* p,
-									TIXML_STRING * text,
-									bool trimWhiteSpace,
-									const char* endTag,
-									bool caseInsensitive,
-									TiXmlEncoding encoding )
-{
-    *text = "";
-	if (    !trimWhiteSpace			// certain tags always keep whitespace
-		 || !condenseWhiteSpace )	// if true, whitespace is always kept
-	{
-		// Keep all the white space.
-		while (	   p && *p
-				&& !StringEqual( p, endTag, caseInsensitive, encoding )
-			  )
-		{
-			int len;
-			char cArr[4] = { 0, 0, 0, 0 };
-			p = GetChar( p, cArr, &len, encoding );
-			text->append( cArr, len );
-		}
-	}
-	else
-	{
-		bool whitespace = false;
-
-		// Remove leading white space:
-		p = SkipWhiteSpace( p, encoding );
-		while (	   p && *p
-				&& !StringEqual( p, endTag, caseInsensitive, encoding ) )
-		{
-			if ( *p == '\r' || *p == '\n' )
-			{
-				whitespace = true;
-				++p;
-			}
-			else if ( IsWhiteSpace( *p ) )
-			{
-				whitespace = true;
-				++p;
-			}
-			else
-			{
-				// If we've found whitespace, add it before the
-				// new character. Any whitespace just becomes a space.
-				if ( whitespace )
-				{
-					(*text) += ' ';
-					whitespace = false;
-				}
-				int len;
-				char cArr[4] = { 0, 0, 0, 0 };
-				p = GetChar( p, cArr, &len, encoding );
-				if ( len == 1 )
-					(*text) += cArr[0];	// more efficient
-				else
-					text->append( cArr, len );
-			}
-		}
-	}
-	if ( p )
-		p += strlen( endTag );
-	return p;
-}
-
-#ifdef TIXML_USE_STL
-
-void TiXmlDocument::StreamIn( std::istream * in, TIXML_STRING * tag )
-{
-	// The basic issue with a document is that we don't know what we're
-	// streaming. Read something presumed to be a tag (and hope), then
-	// identify it, and call the appropriate stream method on the tag.
-	//
-	// This "pre-streaming" will never read the closing ">" so the
-	// sub-tag can orient itself.
-
-	if ( !StreamTo( in, '<', tag ) )
-	{
-		SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
-		return;
-	}
-
-	while ( in->good() )
-	{
-		int tagIndex = (int) tag->length();
-		while ( in->good() && in->peek() != '>' )
-		{
-			int c = in->get();
-			if ( c <= 0 )
-			{
-				SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
-				break;
-			}
-			(*tag) += (char) c;
-		}
-
-		if ( in->good() )
-		{
-			// We now have something we presume to be a node of
-			// some sort. Identify it, and call the node to
-			// continue streaming.
-			TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING );
-
-			if ( node )
-			{
-				node->StreamIn( in, tag );
-				bool isElement = node->ToElement() != 0;
-				delete node;
-				node = 0;
-
-				// If this is the root element, we're done. Parsing will be
-				// done by the >> operator.
-				if ( isElement )
-				{
-					return;
-				}
-			}
-			else
-			{
-				SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN );
-				return;
-			}
-		}
-	}
-	// We should have returned sooner.
-	SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN );
-}
-
-#endif
-
-const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiXmlEncoding encoding )
-{
-	ClearError();
-
-	// Parse away, at the document level. Since a document
-	// contains nothing but other tags, most of what happens
-	// here is skipping white space.
-	if ( !p || !*p )
-	{
-		SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
-		return 0;
-	}
-
-	// Note that, for a document, this needs to come
-	// before the while space skip, so that parsing
-	// starts from the pointer we are given.
-	location.Clear();
-	if ( prevData )
-	{
-		location.row = prevData->cursor.row;
-		location.col = prevData->cursor.col;
-	}
-	else
-	{
-		location.row = 0;
-		location.col = 0;
-	}
-	TiXmlParsingData data( p, TabSize(), location.row, location.col );
-	location = data.Cursor();
-
-	if ( encoding == TIXML_ENCODING_UNKNOWN )
-	{
-		// Check for the Microsoft UTF-8 lead bytes.
-		const unsigned char* pU = (const unsigned char*)p;
-		if (	*(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0
-			 && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1
-			 && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 )
-		{
-			encoding = TIXML_ENCODING_UTF8;
-			useMicrosoftBOM = true;
-		}
-	}
-
-    p = SkipWhiteSpace( p, encoding );
-	if ( !p )
-	{
-		SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
-		return 0;
-	}
-
-	while ( p && *p )
-	{
-		TiXmlNode* node = Identify( p, encoding );
-		if ( node )
-		{
-			p = node->Parse( p, &data, encoding );
-			LinkEndChild( node );
-		}
-		else
-		{
-			break;
-		}
-
-		// Did we get encoding info?
-		if (    encoding == TIXML_ENCODING_UNKNOWN
-			 && node->ToDeclaration() )
-		{
-			TiXmlDeclaration* dec = node->ToDeclaration();
-			const char* enc = dec->Encoding();
-			assert( enc );
-
-			if ( *enc == 0 )
-				encoding = TIXML_ENCODING_UTF8;
-			else if ( StringEqual( enc, "UTF-8", true, TIXML_ENCODING_UNKNOWN ) )
-				encoding = TIXML_ENCODING_UTF8;
-			else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) )
-				encoding = TIXML_ENCODING_UTF8;	// incorrect, but be nice
-			else
-				encoding = TIXML_ENCODING_LEGACY;
-		}
-
-		p = SkipWhiteSpace( p, encoding );
-	}
-
-	// Was this empty?
-	if ( !firstChild ) {
-		SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding );
-		return 0;
-	}
-
-	// All is well.
-	return p;
-}
-
-void TiXmlDocument::SetError( int err, const char* pError, TiXmlParsingData* data, TiXmlEncoding encoding )
-{
-	// The first error in a chain is more accurate - don't set again!
-	if ( error )
-		return;
-
-	assert( err > 0 && err < TIXML_ERROR_STRING_COUNT );
-	error   = true;
-	errorId = err;
-	errorDesc = errorString[ errorId ];
-
-	errorLocation.Clear();
-	if ( pError && data )
-	{
-		data->Stamp( pError, encoding );
-		errorLocation = data->Cursor();
-	}
-}
-
-
-TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding )
-{
-	TiXmlNode* returnNode = 0;
-
-	p = SkipWhiteSpace( p, encoding );
-	if( !p || !*p || *p != '<' )
-	{
-		return 0;
-	}
-
-	TiXmlDocument* doc = GetDocument();
-	p = SkipWhiteSpace( p, encoding );
-
-	if ( !p || !*p )
-	{
-		return 0;
-	}
-
-	// What is this thing?
-	// - Elements start with a letter or underscore, but xml is reserved.
-	// - Comments: <!--
-	// - Decleration: <?xml
-	// - StylesheetReference <?xml-stylesheet
-	// - Everthing else is unknown to tinyxml.
-	//
-
-	const char* xmlHeader = { "<?xml" };
-	const char* xmlSSHeader = { "<?xml-stylesheet" };
-	const char* commentHeader = { "<!--" };
-	const char* dtdHeader = { "<!" };
-	const char* cdataHeader = { "<![CDATA[" };
-
-	if ( StringEqual( p, xmlSSHeader, true, encoding ) )
-	{
-		#ifdef DEBUG_PARSER
-			TIXML_LOG( "XML parsing Stylesheet Reference\n" );
-		#endif
-		returnNode = new TiXmlStylesheetReference();
-	}
-	else if ( StringEqual( p, xmlHeader, true, encoding ) )
-	{
-		#ifdef DEBUG_PARSER
-			TIXML_LOG( "XML parsing Declaration\n" );
-		#endif
-		returnNode = new TiXmlDeclaration();
-	}
-	else if ( StringEqual( p, commentHeader, false, encoding ) )
-	{
-		#ifdef DEBUG_PARSER
-			TIXML_LOG( "XML parsing Comment\n" );
-		#endif
-		returnNode = new TiXmlComment();
-	}
-	else if ( StringEqual( p, cdataHeader, false, encoding ) )
-	{
-		#ifdef DEBUG_PARSER
-			TIXML_LOG( "XML parsing CDATA\n" );
-		#endif
-		TiXmlText* text = new TiXmlText( "" );
-		text->SetCDATA( true );
-		returnNode = text;
-	}
-	else if ( StringEqual( p, dtdHeader, false, encoding ) )
-	{
-		#ifdef DEBUG_PARSER
-			TIXML_LOG( "XML parsing Unknown(1)\n" );
-		#endif
-		returnNode = new TiXmlUnknown();
-	}
-	else if (    IsAlpha( *(p+1), encoding )
-			  || *(p+1) == '_' )
-	{
-		#ifdef DEBUG_PARSER
-			TIXML_LOG( "XML parsing Element\n" );
-		#endif
-		returnNode = new TiXmlElement( "" );
-	}
-	else
-	{
-		#ifdef DEBUG_PARSER
-			TIXML_LOG( "XML parsing Unknown(2)\n" );
-		#endif
-		returnNode = new TiXmlUnknown();
-	}
-
-	if ( returnNode )
-	{
-		// Set the parent, so it can report errors
-		returnNode->parent = this;
-	}
-	else
-	{
-		if ( doc )
-			doc->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
-	}
-	return returnNode;
-}
-
-#ifdef TIXML_USE_STL
-
-void TiXmlElement::StreamIn (std::istream * in, TIXML_STRING * tag)
-{
-	// We're called with some amount of pre-parsing. That is, some of "this"
-	// element is in "tag". Go ahead and stream to the closing ">"
-	while( in->good() )
-	{
-		int c = in->get();
-		if ( c <= 0 )
-		{
-			TiXmlDocument* document = GetDocument();
-			if ( document )
-				document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
-			return;
-		}
-		(*tag) += (char) c ;
-
-		if ( c == '>' )
-			break;
-	}
-
-	if ( tag->length() < 3 ) return;
-
-	// Okay...if we are a "/>" tag, then we're done. We've read a complete tag.
-	// If not, identify and stream.
-
-	if (    tag->at( tag->length() - 1 ) == '>'
-		 && tag->at( tag->length() - 2 ) == '/' )
-	{
-		// All good!
-		return;
-	}
-	else if ( tag->at( tag->length() - 1 ) == '>' )
-	{
-		// There is more. Could be:
-		//		text
-		//		cdata text (which looks like another node)
-		//		closing tag
-		//		another node.
-		for ( ;; )
-		{
-			StreamWhiteSpace( in, tag );
-
-			// Do we have text?
-			if ( in->good() && in->peek() != '<' )
-			{
-				// Yep, text.
-				TiXmlText text( "" );
-				text.StreamIn( in, tag );
-
-				// What follows text is a closing tag or another node.
-				// Go around again and figure it out.
-				continue;
-			}
-
-			// We now have either a closing tag...or another node.
-			// We should be at a "<", regardless.
-			if ( !in->good() ) return;
-			assert( in->peek() == '<' );
-			int tagIndex = (int) tag->length();
-
-			bool closingTag = false;
-			bool firstCharFound = false;
-
-			for( ;; )
-			{
-				if ( !in->good() )
-					return;
-
-				int c = in->peek();
-				if ( c <= 0 )
-				{
-					TiXmlDocument* document = GetDocument();
-					if ( document )
-						document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
-					return;
-				}
-
-				if ( c == '>' )
-					break;
-
-				*tag += (char) c;
-				in->get();
-
-				// Early out if we find the CDATA id.
-				if ( c == '[' && tag->size() >= 9 )
-				{
-					size_t len = tag->size();
-					const char* start = tag->c_str() + len - 9;
-					if ( strcmp( start, "<![CDATA[" ) == 0 ) {
-						assert( !closingTag );
-						break;
-					}
-				}
-
-				if ( !firstCharFound && c != '<' && !IsWhiteSpace( c ) )
-				{
-					firstCharFound = true;
-					if ( c == '/' )
-						closingTag = true;
-				}
-			}
-			// If it was a closing tag, then read in the closing '>' to clean up the input stream.
-			// If it was not, the streaming will be done by the tag.
-			if ( closingTag )
-			{
-				if ( !in->good() )
-					return;
-
-				int c = in->get();
-				if ( c <= 0 )
-				{
-					TiXmlDocument* document = GetDocument();
-					if ( document )
-						document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
-					return;
-				}
-				assert( c == '>' );
-				*tag += (char) c;
-
-				// We are done, once we've found our closing tag.
-				return;
-			}
-			else
-			{
-				// If not a closing tag, id it, and stream.
-				const char* tagloc = tag->c_str() + tagIndex;
-				TiXmlNode* node = Identify( tagloc, TIXML_DEFAULT_ENCODING );
-				if ( !node )
-					return;
-				node->StreamIn( in, tag );
-				delete node;
-				node = 0;
-
-				// No return: go around from the beginning: text, closing tag, or node.
-			}
-		}
-	}
-}
-#endif
-
-const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
-{
-	p = SkipWhiteSpace( p, encoding );
-	TiXmlDocument* document = GetDocument();
-
-	if ( !p || !*p )
-	{
-		if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, 0, 0, encoding );
-		return 0;
-	}
-
-	if ( data )
-	{
-		data->Stamp( p, encoding );
-		location = data->Cursor();
-	}
-
-	if ( *p != '<' )
-	{
-		if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, p, data, encoding );
-		return 0;
-	}
-
-	p = SkipWhiteSpace( p+1, encoding );
-
-	// Read the name.
-	const char* pErr = p;
-
-    p = ReadName( p, &value, encoding );
-	if ( !p || !*p )
-	{
-		if ( document )	document->SetError( TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, pErr, data, encoding );
-		return 0;
-	}
-
-    TIXML_STRING endTag ("</");
-	endTag += value;
-	endTag += ">";
-
-	// Check for and read attributes. Also look for an empty
-	// tag or an end tag.
-	while ( p && *p )
-	{
-		pErr = p;
-		p = SkipWhiteSpace( p, encoding );
-		if ( !p || !*p )
-		{
-			if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding );
-			return 0;
-		}
-		if ( *p == '/' )
-		{
-			++p;
-			// Empty tag.
-			if ( *p  != '>' )
-			{
-				if ( document ) document->SetError( TIXML_ERROR_PARSING_EMPTY, p, data, encoding );
-				return 0;
-			}
-			return (p+1);
-		}
-		else if ( *p == '>' )
-		{
-			// Done with attributes (if there were any.)
-			// Read the value -- which can include other
-			// elements -- read the end tag, and return.
-			++p;
-			p = ReadValue( p, data, encoding );		// Note this is an Element method, and will set the error if one happens.
-			if ( !p || !*p ) {
-				// We were looking for the end tag, but found nothing.
-				// Fix for [ 1663758 ] Failure to report error on bad XML
-				if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding );
-				return 0;
-			}
-
-			// We should find the end tag now
-			if ( StringEqual( p, endTag.c_str(), false, encoding ) )
-			{
-				p += endTag.length();
-				return p;
-			}
-			else
-			{
-				if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding );
-				return 0;
-			}
-		}
-		else
-		{
-			// Try to read an attribute:
-			TiXmlAttribute* attrib = new TiXmlAttribute();
-			if ( !attrib )
-			{
-				if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, pErr, data, encoding );
-				return 0;
-			}
-
-			attrib->SetDocument( document );
-			pErr = p;
-			p = attrib->Parse( p, data, encoding );
-
-			if ( !p || !*p )
-			{
-				if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding );
-				delete attrib;
-				return 0;
-			}
-
-			// Handle the strange case of double attributes:
-			#ifdef TIXML_USE_STL
-			TiXmlAttribute* node = attributeSet.Find( attrib->NameTStr() );
-			#else
-			TiXmlAttribute* node = attributeSet.Find( attrib->Name() );
-			#endif
-			if ( node )
-			{
-				node->SetValue( attrib->Value() );
-				delete attrib;
-				return 0;
-			}
-
-			attributeSet.Add( attrib );
-		}
-	}
-	return p;
-}
-
-
-const char* TiXmlElement::ReadValue( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
-{
-	TiXmlDocument* document = GetDocument();
-
-	// Read in text and elements in any order.
-	const char* pWithWhiteSpace = p;
-	p = SkipWhiteSpace( p, encoding );
-
-	while ( p && *p )
-	{
-		if ( *p != '<' )
-		{
-			// Take what we have, make a text element.
-			TiXmlText* textNode = new TiXmlText( "" );
-
-			if ( !textNode )
-			{
-				if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, encoding );
-				    return 0;
-			}
-
-			if ( TiXmlBase::IsWhiteSpaceCondensed() )
-			{
-				p = textNode->Parse( p, data, encoding );
-			}
-			else
-			{
-				// Special case: we want to keep the white space
-				// so that leading spaces aren't removed.
-				p = textNode->Parse( pWithWhiteSpace, data, encoding );
-			}
-
-			if ( !textNode->Blank() )
-				LinkEndChild( textNode );
-			else
-				delete textNode;
-		}
-		else
-		{
-			// We hit a '<'
-			// Have we hit a new element or an end tag? This could also be
-			// a TiXmlText in the "CDATA" style.
-			if ( StringEqual( p, "</", false, encoding ) )
-			{
-				return p;
-			}
-			else
-			{
-				TiXmlNode* node = Identify( p, encoding );
-				if ( node )
-				{
-					p = node->Parse( p, data, encoding );
-					LinkEndChild( node );
-				}
-				else
-				{
-					return 0;
-				}
-			}
-		}
-		pWithWhiteSpace = p;
-		p = SkipWhiteSpace( p, encoding );
-	}
-
-	if ( !p )
-	{
-		if ( document ) document->SetError( TIXML_ERROR_READING_ELEMENT_VALUE, 0, 0, encoding );
-	}
-	return p;
-}
-
-
-#ifdef TIXML_USE_STL
-void TiXmlUnknown::StreamIn( std::istream * in, TIXML_STRING * tag )
-{
-	while ( in->good() )
-	{
-		int c = in->get();
-		if ( c <= 0 )
-		{
-			TiXmlDocument* document = GetDocument();
-			if ( document )
-				document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
-			return;
-		}
-		(*tag) += (char) c;
-
-		if ( c == '>' )
-		{
-			// All is well.
-			return;
-		}
-	}
-}
-#endif
-
-
-const char* TiXmlUnknown::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
-{
-	TiXmlDocument* document = GetDocument();
-	p = SkipWhiteSpace( p, encoding );
-
-	if ( data )
-	{
-		data->Stamp( p, encoding );
-		location = data->Cursor();
-	}
-	if ( !p || !*p || *p != '<' )
-	{
-		if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN, p, data, encoding );
-		return 0;
-	}
-	++p;
-    value = "";
-
-	while ( p && *p && *p != '>' )
-	{
-		value += *p;
-		++p;
-	}
-
-	if ( !p )
-	{
-		if ( document )	document->SetError( TIXML_ERROR_PARSING_UNKNOWN, 0, 0, encoding );
-	}
-	if ( *p == '>' )
-		return p+1;
-	return p;
-}
-
-#ifdef TIXML_USE_STL
-void TiXmlComment::StreamIn( std::istream * in, TIXML_STRING * tag )
-{
-	while ( in->good() )
-	{
-		int c = in->get();
-		if ( c <= 0 )
-		{
-			TiXmlDocument* document = GetDocument();
-			if ( document )
-				document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
-			return;
-		}
-
-		(*tag) += (char) c;
-
-		if ( c == '>'
-			 && tag->at( tag->length() - 2 ) == '-'
-			 && tag->at( tag->length() - 3 ) == '-' )
-		{
-			// All is well.
-			return;
-		}
-	}
-}
-#endif
-
-
-const char* TiXmlComment::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
-{
-	TiXmlDocument* document = GetDocument();
-	value = "";
-
-	p = SkipWhiteSpace( p, encoding );
-
-	if ( data )
-	{
-		data->Stamp( p, encoding );
-		location = data->Cursor();
-	}
-	const char* startTag = "<!--";
-	const char* endTag   = "-->";
-
-	if ( !StringEqual( p, startTag, false, encoding ) )
-	{
-		document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding );
-		return 0;
-	}
-	p += strlen( startTag );
-
-	// [ 1475201 ] TinyXML parses entities in comments
-	// Oops - ReadText doesn't work, because we don't want to parse the entities.
-	// p = ReadText( p, &value, false, endTag, false, encoding );
-	//
-	// from the XML spec:
-	/*
-	 [Definition: Comments may appear anywhere in a document outside other markup; in addition,
-	              they may appear within the document type declaration at places allowed by the grammar.
-				  They are not part of the document's character data; an XML processor MAY, but need not,
-				  make it possible for an application to retrieve the text of comments. For compatibility,
-				  the string "--" (double-hyphen) MUST NOT occur within comments.] Parameter entity
-				  references MUST NOT be recognized within comments.
-
-				  An example of a comment:
-
-				  <!-- declarations for <head> & <body> -->
-	*/
-
-    value = "";
-	// Keep all the white space.
-	while (	p && *p && !StringEqual( p, endTag, false, encoding ) )
-	{
-		value.append( p, 1 );
-		++p;
-	}
-	if ( p )
-		p += strlen( endTag );
-
-	return p;
-}
-
-
-const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
-{
-	p = SkipWhiteSpace( p, encoding );
-	if ( !p || !*p ) return 0;
-
-//	int tabsize = 4;
-//	if ( document )
-//		tabsize = document->TabSize();
-
-	if ( data )
-	{
-		data->Stamp( p, encoding );
-		location = data->Cursor();
-	}
-	// Read the name, the '=' and the value.
-	const char* pErr = p;
-	p = ReadName( p, &name, encoding );
-	if ( !p || !*p )
-	{
-		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding );
-		return 0;
-	}
-	p = SkipWhiteSpace( p, encoding );
-	if ( !p || !*p || *p != '=' )
-	{
-		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
-		return 0;
-	}
-
-	++p;	// skip '='
-	p = SkipWhiteSpace( p, encoding );
-	if ( !p || !*p )
-	{
-		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
-		return 0;
-	}
-
-	const char* end;
-	const char SINGLE_QUOTE = '\'';
-	const char DOUBLE_QUOTE = '\"';
-
-	if ( *p == SINGLE_QUOTE )
-	{
-		++p;
-		end = "\'";		// single quote in string
-		p = ReadText( p, &value, false, end, false, encoding );
-	}
-	else if ( *p == DOUBLE_QUOTE )
-	{
-		++p;
-		end = "\"";		// double quote in string
-		p = ReadText( p, &value, false, end, false, encoding );
-	}
-	else
-	{
-		// All attribute values should be in single or double quotes.
-		// But this is such a common error that the parser will try
-		// its best, even without them.
-		value = "";
-		while (    p && *p											// existence
-				&& !IsWhiteSpace( *p ) && *p != '\n' && *p != '\r'	// whitespace
-				&& *p != '/' && *p != '>' )							// tag end
-		{
-			if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) {
-				// [ 1451649 ] Attribute values with trailing quotes not handled correctly
-				// We did not have an opening quote but seem to have a
-				// closing one. Give up and throw an error.
-				if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
-				return 0;
-			}
-			value += *p;
-			++p;
-		}
-	}
-	return p;
-}
-
-#ifdef TIXML_USE_STL
-void TiXmlText::StreamIn( std::istream * in, TIXML_STRING * tag )
-{
-	while ( in->good() )
-	{
-		int c = in->peek();
-		if ( !cdata && (c == '<' ) )
-		{
-			return;
-		}
-		if ( c <= 0 )
-		{
-			TiXmlDocument* document = GetDocument();
-			if ( document )
-				document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
-			return;
-		}
-
-		(*tag) += (char) c;
-		in->get();	// "commits" the peek made above
-
-		if ( cdata && c == '>' && tag->size() >= 3 ) {
-			size_t len = tag->size();
-			if ( (*tag)[len-2] == ']' && (*tag)[len-3] == ']' ) {
-				// terminator of cdata.
-				return;
-			}
-		}
-	}
-}
-#endif
-
-const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
-{
-	value = "";
-	TiXmlDocument* document = GetDocument();
-
-	if ( data )
-	{
-		data->Stamp( p, encoding );
-		location = data->Cursor();
-	}
-
-	const char* const startTag = "<![CDATA[";
-	const char* const endTag   = "]]>";
-
-	if ( cdata || StringEqual( p, startTag, false, encoding ) )
-	{
-		cdata = true;
-
-		if ( !StringEqual( p, startTag, false, encoding ) )
-		{
-			document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding );
-			return 0;
-		}
-		p += strlen( startTag );
-
-		// Keep all the white space, ignore the encoding, etc.
-		while (	   p && *p
-				&& !StringEqual( p, endTag, false, encoding )
-			  )
-		{
-			value += *p;
-			++p;
-		}
-
-		TIXML_STRING dummy;
-		p = ReadText( p, &dummy, false, endTag, false, encoding );
-		return p;
-	}
-	else
-	{
-		bool ignoreWhite = true;
-
-		const char* end = "<";
-		p = ReadText( p, &value, ignoreWhite, end, false, encoding );
-		if ( p )
-			return p-1;	// don't truncate the '<'
-		return 0;
-	}
-}
-
-#ifdef TIXML_USE_STL
-void TiXmlDeclaration::StreamIn( std::istream * in, TIXML_STRING * tag )
-{
-	while ( in->good() )
-	{
-		int c = in->get();
-		if ( c <= 0 )
-		{
-			TiXmlDocument* document = GetDocument();
-			if ( document )
-				document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
-			return;
-		}
-		(*tag) += (char) c;
-
-		if ( c == '>' )
-		{
-			// All is well.
-			return;
-		}
-	}
-}
-#endif
-
-const char* TiXmlDeclaration::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding _encoding )
-{
-	p = SkipWhiteSpace( p, _encoding );
-	// Find the beginning, find the end, and look for
-	// the stuff in-between.
-	TiXmlDocument* document = GetDocument();
-	if ( !p || !*p || !StringEqual( p, "<?xml", true, _encoding ) )
-	{
-		if ( document ) document->SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding );
-		return 0;
-	}
-	if ( data )
-	{
-		data->Stamp( p, _encoding );
-		location = data->Cursor();
-	}
-	p += 5;
-
-	version = "";
-	encoding = "";
-	standalone = "";
-
-	while ( p && *p )
-	{
-		if ( *p == '>' )
-		{
-			++p;
-			return p;
-		}
-
-		p = SkipWhiteSpace( p, _encoding );
-		if ( StringEqual( p, "version", true, _encoding ) )
-		{
-			TiXmlAttribute attrib;
-			p = attrib.Parse( p, data, _encoding );
-			version = attrib.Value();
-		}
-		else if ( StringEqual( p, "encoding", true, _encoding ) )
-		{
-			TiXmlAttribute attrib;
-			p = attrib.Parse( p, data, _encoding );
-			encoding = attrib.Value();
-		}
-		else if ( StringEqual( p, "standalone", true, _encoding ) )
-		{
-			TiXmlAttribute attrib;
-			p = attrib.Parse( p, data, _encoding );
-			standalone = attrib.Value();
-		}
-		else
-		{
-			// Read over whatever it is.
-			while( p && *p && *p != '>' && !IsWhiteSpace( *p ) )
-				++p;
-		}
-	}
-	return 0;
-}
-
-bool TiXmlText::Blank() const
-{
-	for ( unsigned i=0; i<value.length(); i++ )
-		if ( !IsWhiteSpace( value[i] ) )
-			return false;
-	return true;
-}
-
-#ifdef TIXML_USE_STL
-void TiXmlStylesheetReference::StreamIn( std::istream * in, TIXML_STRING * tag )
-{
-	while ( in->good() )
-	{
-		int c = in->get();
-		if ( c <= 0 )
-		{
-			TiXmlDocument* document = GetDocument();
-			if ( document )
-				document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
-			return;
-		}
-		(*tag) += (char) c;
-
-		if ( c == '>' )
-		{
-			// All is well.
-			return;
-		}
-	}
-}
-#endif
-
-const char* TiXmlStylesheetReference::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding _encoding )
-{
-	p = SkipWhiteSpace( p, _encoding );
-	// Find the beginning, find the end, and look for
-	// the stuff in-between.
-	TiXmlDocument* document = GetDocument();
-	if ( !p || !*p || !StringEqual( p, "<?xml-stylesheet", true, _encoding ) )
-	{
-		if ( document ) document->SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding );
-		return 0;
-	}
-	if ( data )
-	{
-		data->Stamp( p, _encoding );
-		location = data->Cursor();
-	}
-	p += 5;
-
-	type = "";
-	href = "";
-
-	while ( p && *p )
-	{
-		if ( *p == '>' )
-		{
-			++p;
-			return p;
-		}
-
-		p = SkipWhiteSpace( p, _encoding );
-		if ( StringEqual( p, "type", true, _encoding ) )
-		{
-			TiXmlAttribute attrib;
-			p = attrib.Parse( p, data, _encoding );
-			type = attrib.Value();
-		}
-		else if ( StringEqual( p, "href", true, _encoding ) )
-		{
-			TiXmlAttribute attrib;
-			p = attrib.Parse( p, data, _encoding );
-			href = attrib.Value();
-		}
-		else
-		{
-			// Read over whatever it is.
-			while( p && *p && *p != '>' && !IsWhiteSpace( *p ) )
-				++p;
-		}
-	}
-	return 0;
-}
Index: /code/branches/buildsystem3/src/tinyxml/tinyxmlparser.cpp
===================================================================
--- /code/branches/buildsystem3/src/tinyxml/tinyxmlparser.cpp	(revision 2664)
+++ /code/branches/buildsystem3/src/tinyxml/tinyxmlparser.cpp	(revision 2664)
@@ -0,0 +1,1722 @@
+/*
+www.sourceforge.net/projects/tinyxml
+Original code (2.0 and earlier )copyright (c) 2000-2002 Lee Thomason (www.grinninglizard.com)
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
+*/
+
+#include <ctype.h>
+#include <stddef.h>
+
+#include "tinyxml.h"
+
+//#define DEBUG_PARSER
+#if defined( DEBUG_PARSER )
+#	if defined( DEBUG ) && defined( _MSC_VER )
+#		include <windows.h>
+#		define TIXML_LOG OutputDebugString
+#	else
+#		define TIXML_LOG printf
+#	endif
+#endif
+
+// Note tha "PutString" hardcodes the same list. This
+// is less flexible than it appears. Changing the entries
+// or order will break putstring.
+TiXmlBase::Entity TiXmlBase::entity[ NUM_ENTITY ] =
+{
+	{ "&amp;",  5, '&' },
+	{ "&lt;",   4, '<' },
+	{ "&gt;",   4, '>' },
+	{ "&quot;", 6, '\"' },
+	{ "&apos;", 6, '\'' }
+};
+
+// Bunch of unicode info at:
+//		http://www.unicode.org/faq/utf_bom.html
+// Including the basic of this table, which determines the #bytes in the
+// sequence from the lead byte. 1 placed for invalid sequences --
+// although the result will be junk, pass it through as much as possible.
+// Beware of the non-characters in UTF-8:
+//				ef bb bf (Microsoft "lead bytes")
+//				ef bf be
+//				ef bf bf
+
+const unsigned char TIXML_UTF_LEAD_0 = 0xefU;
+const unsigned char TIXML_UTF_LEAD_1 = 0xbbU;
+const unsigned char TIXML_UTF_LEAD_2 = 0xbfU;
+
+const int TiXmlBase::utf8ByteTable[256] =
+{
+	//	0	1	2	3	4	5	6	7	8	9	a	b	c	d	e	f
+		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0x00
+		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0x10
+		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0x20
+		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0x30
+		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0x40
+		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0x50
+		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0x60
+		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0x70	End of ASCII range
+		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0x80 0x80 to 0xc1 invalid
+		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0x90
+		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0xa0
+		1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	// 0xb0
+		1,	1,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	// 0xc0 0xc2 to 0xdf 2 byte
+		2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	2,	// 0xd0
+		3,	3,	3,	3,	3,	3,	3,	3,	3,	3,	3,	3,	3,	3,	3,	3,	// 0xe0 0xe0 to 0xef 3 byte
+		4,	4,	4,	4,	4,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1,	1	// 0xf0 0xf0 to 0xf4 4 byte, 0xf5 and higher invalid
+};
+
+
+void TiXmlBase::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length )
+{
+	const unsigned long BYTE_MASK = 0xBF;
+	const unsigned long BYTE_MARK = 0x80;
+	const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
+
+	if (input < 0x80)
+		*length = 1;
+	else if ( input < 0x800 )
+		*length = 2;
+	else if ( input < 0x10000 )
+		*length = 3;
+	else if ( input < 0x200000 )
+		*length = 4;
+	else
+		{ *length = 0; return; }	// This code won't covert this correctly anyway.
+
+	output += *length;
+
+	// Scary scary fall throughs.
+	switch (*length)
+	{
+		case 4:
+			--output;
+			*output = (char)((input | BYTE_MARK) & BYTE_MASK);
+			input >>= 6;
+		case 3:
+			--output;
+			*output = (char)((input | BYTE_MARK) & BYTE_MASK);
+			input >>= 6;
+		case 2:
+			--output;
+			*output = (char)((input | BYTE_MARK) & BYTE_MASK);
+			input >>= 6;
+		case 1:
+			--output;
+			*output = (char)(input | FIRST_BYTE_MARK[*length]);
+	}
+}
+
+
+/*static*/ int TiXmlBase::IsAlpha( unsigned char anyByte, TiXmlEncoding /*encoding*/ )
+{
+	// This will only work for low-ascii, everything else is assumed to be a valid
+	// letter. I'm not sure this is the best approach, but it is quite tricky trying
+	// to figure out alhabetical vs. not across encoding. So take a very
+	// conservative approach.
+
+//	if ( encoding == TIXML_ENCODING_UTF8 )
+//	{
+		if ( anyByte < 127 )
+			return isalpha( anyByte );
+		else
+			return 1;	// What else to do? The unicode set is huge...get the english ones right.
+//	}
+//	else
+//	{
+//		return isalpha( anyByte );
+//	}
+}
+
+
+/*static*/ int TiXmlBase::IsAlphaNum( unsigned char anyByte, TiXmlEncoding /*encoding*/ )
+{
+	// This will only work for low-ascii, everything else is assumed to be a valid
+	// letter. I'm not sure this is the best approach, but it is quite tricky trying
+	// to figure out alhabetical vs. not across encoding. So take a very
+	// conservative approach.
+
+//	if ( encoding == TIXML_ENCODING_UTF8 )
+//	{
+		if ( anyByte < 127 )
+			return isalnum( anyByte );
+		else
+			return 1;	// What else to do? The unicode set is huge...get the english ones right.
+//	}
+//	else
+//	{
+//		return isalnum( anyByte );
+//	}
+}
+
+
+class TiXmlParsingData
+{
+	friend class TiXmlDocument;
+  public:
+	void Stamp( const char* now, TiXmlEncoding encoding );
+
+	const TiXmlCursor& Cursor()	{ return cursor; }
+
+  private:
+	// Only used by the document!
+	TiXmlParsingData( const char* start, int _tabsize, int row, int col )
+	{
+		assert( start );
+		stamp = start;
+		tabsize = _tabsize;
+		cursor.row = row;
+		cursor.col = col;
+	}
+
+	TiXmlCursor		cursor;
+	const char*		stamp;
+	int				tabsize;
+};
+
+
+void TiXmlParsingData::Stamp( const char* now, TiXmlEncoding encoding )
+{
+	assert( now );
+
+	// Do nothing if the tabsize is 0.
+	if ( tabsize < 1 )
+	{
+		return;
+	}
+
+	// Get the current row, column.
+	int row = cursor.row;
+	int col = cursor.col;
+	const char* p = stamp;
+	assert( p );
+
+	while ( p < now )
+	{
+		// Treat p as unsigned, so we have a happy compiler.
+		const unsigned char* pU = (const unsigned char*)p;
+
+		// Code contributed by Fletcher Dunn: (modified by lee)
+		switch (*pU) {
+			case 0:
+				// We *should* never get here, but in case we do, don't
+				// advance past the terminating null character, ever
+				return;
+
+			case '\r':
+				// bump down to the next line
+				++row;
+				col = 0;
+				// Eat the character
+				++p;
+
+				// Check for \r\n sequence, and treat this as a single character
+				if (*p == '\n') {
+					++p;
+				}
+				break;
+
+			case '\n':
+				// bump down to the next line
+				++row;
+				col = 0;
+
+				// Eat the character
+				++p;
+
+				// Check for \n\r sequence, and treat this as a single
+				// character.  (Yes, this bizarre thing does occur still
+				// on some arcane platforms...)
+				if (*p == '\r') {
+					++p;
+				}
+				break;
+
+			case '\t':
+				// Eat the character
+				++p;
+
+				// Skip to next tab stop
+				col = (col / tabsize + 1) * tabsize;
+				break;
+
+			case TIXML_UTF_LEAD_0:
+				if ( encoding == TIXML_ENCODING_UTF8 )
+				{
+					if ( *(p+1) && *(p+2) )
+					{
+						// In these cases, don't advance the column. These are
+						// 0-width spaces.
+						if ( *(pU+1)==TIXML_UTF_LEAD_1 && *(pU+2)==TIXML_UTF_LEAD_2 )
+							p += 3;
+						else if ( *(pU+1)==0xbfU && *(pU+2)==0xbeU )
+							p += 3;
+						else if ( *(pU+1)==0xbfU && *(pU+2)==0xbfU )
+							p += 3;
+						else
+							{ p +=3; ++col; }	// A normal character.
+					}
+				}
+				else
+				{
+					++p;
+					++col;
+				}
+				break;
+
+			default:
+				if ( encoding == TIXML_ENCODING_UTF8 )
+				{
+					// Eat the 1 to 4 byte utf8 character.
+					int step = TiXmlBase::utf8ByteTable[*((const unsigned char*)p)];
+					if ( step == 0 )
+						step = 1;		// Error case from bad encoding, but handle gracefully.
+					p += step;
+
+					// Just advance one column, of course.
+					++col;
+				}
+				else
+				{
+					++p;
+					++col;
+				}
+				break;
+		}
+	}
+	cursor.row = row;
+	cursor.col = col;
+	assert( cursor.row >= -1 );
+	assert( cursor.col >= -1 );
+	stamp = p;
+	assert( stamp );
+}
+
+
+const char* TiXmlBase::SkipWhiteSpace( const char* p, TiXmlEncoding encoding )
+{
+	if ( !p || !*p )
+	{
+		return 0;
+	}
+	if ( encoding == TIXML_ENCODING_UTF8 )
+	{
+		while ( *p )
+		{
+			const unsigned char* pU = (const unsigned char*)p;
+
+			// Skip the stupid Microsoft UTF-8 Byte order marks
+			if (	*(pU+0)==TIXML_UTF_LEAD_0
+				 && *(pU+1)==TIXML_UTF_LEAD_1
+				 && *(pU+2)==TIXML_UTF_LEAD_2 )
+			{
+				p += 3;
+				continue;
+			}
+			else if(*(pU+0)==TIXML_UTF_LEAD_0
+				 && *(pU+1)==0xbfU
+				 && *(pU+2)==0xbeU )
+			{
+				p += 3;
+				continue;
+			}
+			else if(*(pU+0)==TIXML_UTF_LEAD_0
+				 && *(pU+1)==0xbfU
+				 && *(pU+2)==0xbfU )
+			{
+				p += 3;
+				continue;
+			}
+
+			if ( IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' )		// Still using old rules for white space.
+				++p;
+			else
+				break;
+		}
+	}
+	else
+	{
+		while ( *p && IsWhiteSpace( *p ) || *p == '\n' || *p =='\r' )
+			++p;
+	}
+
+	return p;
+}
+
+#ifdef TIXML_USE_STL
+/*static*/ bool TiXmlBase::StreamWhiteSpace( std::istream * in, TIXML_STRING * tag )
+{
+	for( ;; )
+	{
+		if ( !in->good() ) return false;
+
+		int c = in->peek();
+		// At this scope, we can't get to a document. So fail silently.
+		if ( !IsWhiteSpace( c ) || c <= 0 )
+			return true;
+
+		*tag += (char) in->get();
+	}
+}
+
+/*static*/ bool TiXmlBase::StreamTo( std::istream * in, int character, TIXML_STRING * tag )
+{
+	//assert( character > 0 && character < 128 );	// else it won't work in utf-8
+	while ( in->good() )
+	{
+		int c = in->peek();
+		if ( c == character )
+			return true;
+		if ( c <= 0 )		// Silent failure: can't get document at this scope
+			return false;
+
+		in->get();
+		*tag += (char) c;
+	}
+	return false;
+}
+#endif
+
+// One of TinyXML's more performance demanding functions. Try to keep the memory overhead down. The
+// "assign" optimization removes over 10% of the execution time.
+//
+const char* TiXmlBase::ReadName( const char* p, TIXML_STRING * name, TiXmlEncoding encoding )
+{
+	// Oddly, not supported on some comilers,
+	//name->clear();
+	// So use this:
+	*name = "";
+	assert( p );
+
+	// Names start with letters or underscores.
+	// Of course, in unicode, tinyxml has no idea what a letter *is*. The
+	// algorithm is generous.
+	//
+	// After that, they can be letters, underscores, numbers,
+	// hyphens, or colons. (Colons are valid ony for namespaces,
+	// but tinyxml can't tell namespaces from names.)
+	if (    p && *p
+		 && ( IsAlpha( (unsigned char) *p, encoding ) || *p == '_' ) )
+	{
+		const char* start = p;
+		while(		p && *p
+				&&	(		IsAlphaNum( (unsigned char ) *p, encoding )
+						 || *p == '_'
+						 || *p == '-'
+						 || *p == '.'
+						 || *p == ':' ) )
+		{
+			//(*name) += *p; // expensive
+			++p;
+		}
+		if ( p-start > 0 ) {
+			name->assign( start, p-start );
+		}
+		return p;
+	}
+	return 0;
+}
+
+const char* TiXmlBase::GetEntity( const char* p, char* value, int* length, TiXmlEncoding encoding )
+{
+	// Presume an entity, and pull it out.
+    TIXML_STRING ent;
+	int i;
+	*length = 0;
+
+	if ( *(p+1) && *(p+1) == '#' && *(p+2) )
+	{
+		unsigned long ucs = 0;
+		ptrdiff_t delta = 0;
+		unsigned mult = 1;
+
+		if ( *(p+2) == 'x' )
+		{
+			// Hexadecimal.
+			if ( !*(p+3) ) return 0;
+
+			const char* q = p+3;
+			q = strchr( q, ';' );
+
+			if ( !q || !*q ) return 0;
+
+			delta = q-p;
+			--q;
+
+			while ( *q != 'x' )
+			{
+				if ( *q >= '0' && *q <= '9' )
+					ucs += mult * (*q - '0');
+				else if ( *q >= 'a' && *q <= 'f' )
+					ucs += mult * (*q - 'a' + 10);
+				else if ( *q >= 'A' && *q <= 'F' )
+					ucs += mult * (*q - 'A' + 10 );
+				else
+					return 0;
+				mult *= 16;
+				--q;
+			}
+		}
+		else
+		{
+			// Decimal.
+			if ( !*(p+2) ) return 0;
+
+			const char* q = p+2;
+			q = strchr( q, ';' );
+
+			if ( !q || !*q ) return 0;
+
+			delta = q-p;
+			--q;
+
+			while ( *q != '#' )
+			{
+				if ( *q >= '0' && *q <= '9' )
+					ucs += mult * (*q - '0');
+				else
+					return 0;
+				mult *= 10;
+				--q;
+			}
+		}
+		if ( encoding == TIXML_ENCODING_UTF8 )
+		{
+			// convert the UCS to UTF-8
+			ConvertUTF32ToUTF8( ucs, value, length );
+		}
+		else
+		{
+			*value = (char)ucs;
+			*length = 1;
+		}
+		return p + delta + 1;
+	}
+
+	// Now try to match it.
+	for( i=0; i<NUM_ENTITY; ++i )
+	{
+		if ( strncmp( entity[i].str, p, entity[i].strLength ) == 0 )
+		{
+			assert( strlen( entity[i].str ) == entity[i].strLength );
+			*value = entity[i].chr;
+			*length = 1;
+			return ( p + entity[i].strLength );
+		}
+	}
+
+	// So it wasn't an entity, its unrecognized, or something like that.
+	*value = *p;	// Don't put back the last one, since we return it!
+	//*length = 1;	// Leave unrecognized entities - this doesn't really work.
+					// Just writes strange XML.
+	return p+1;
+}
+
+
+bool TiXmlBase::StringEqual( const char* p,
+							 const char* tag,
+							 bool ignoreCase,
+							 TiXmlEncoding encoding )
+{
+	assert( p );
+	assert( tag );
+	if ( !p || !*p )
+	{
+		assert( 0 );
+		return false;
+	}
+
+	const char* q = p;
+
+	if ( ignoreCase )
+	{
+		while ( *q && *tag && ToLower( *q, encoding ) == ToLower( *tag, encoding ) )
+		{
+			++q;
+			++tag;
+		}
+
+		if ( *tag == 0 )
+			return true;
+	}
+	else
+	{
+		while ( *q && *tag && *q == *tag )
+		{
+			++q;
+			++tag;
+		}
+
+		if ( *tag == 0 )		// Have we found the end of the tag, and everything equal?
+			return true;
+	}
+	return false;
+}
+
+const char* TiXmlBase::ReadText(	const char* p,
+									TIXML_STRING * text,
+									bool trimWhiteSpace,
+									const char* endTag,
+									bool caseInsensitive,
+									TiXmlEncoding encoding )
+{
+    *text = "";
+	if (    !trimWhiteSpace			// certain tags always keep whitespace
+		 || !condenseWhiteSpace )	// if true, whitespace is always kept
+	{
+		// Keep all the white space.
+		while (	   p && *p
+				&& !StringEqual( p, endTag, caseInsensitive, encoding )
+			  )
+		{
+			int len;
+			char cArr[4] = { 0, 0, 0, 0 };
+			p = GetChar( p, cArr, &len, encoding );
+			text->append( cArr, len );
+		}
+	}
+	else
+	{
+		bool whitespace = false;
+
+		// Remove leading white space:
+		p = SkipWhiteSpace( p, encoding );
+		while (	   p && *p
+				&& !StringEqual( p, endTag, caseInsensitive, encoding ) )
+		{
+			if ( *p == '\r' || *p == '\n' )
+			{
+				whitespace = true;
+				++p;
+			}
+			else if ( IsWhiteSpace( *p ) )
+			{
+				whitespace = true;
+				++p;
+			}
+			else
+			{
+				// If we've found whitespace, add it before the
+				// new character. Any whitespace just becomes a space.
+				if ( whitespace )
+				{
+					(*text) += ' ';
+					whitespace = false;
+				}
+				int len;
+				char cArr[4] = { 0, 0, 0, 0 };
+				p = GetChar( p, cArr, &len, encoding );
+				if ( len == 1 )
+					(*text) += cArr[0];	// more efficient
+				else
+					text->append( cArr, len );
+			}
+		}
+	}
+	if ( p )
+		p += strlen( endTag );
+	return p;
+}
+
+#ifdef TIXML_USE_STL
+
+void TiXmlDocument::StreamIn( std::istream * in, TIXML_STRING * tag )
+{
+	// The basic issue with a document is that we don't know what we're
+	// streaming. Read something presumed to be a tag (and hope), then
+	// identify it, and call the appropriate stream method on the tag.
+	//
+	// This "pre-streaming" will never read the closing ">" so the
+	// sub-tag can orient itself.
+
+	if ( !StreamTo( in, '<', tag ) )
+	{
+		SetError( TIXML_ERROR_PARSING_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
+		return;
+	}
+
+	while ( in->good() )
+	{
+		int tagIndex = (int) tag->length();
+		while ( in->good() && in->peek() != '>' )
+		{
+			int c = in->get();
+			if ( c <= 0 )
+			{
+				SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+				break;
+			}
+			(*tag) += (char) c;
+		}
+
+		if ( in->good() )
+		{
+			// We now have something we presume to be a node of
+			// some sort. Identify it, and call the node to
+			// continue streaming.
+			TiXmlNode* node = Identify( tag->c_str() + tagIndex, TIXML_DEFAULT_ENCODING );
+
+			if ( node )
+			{
+				node->StreamIn( in, tag );
+				bool isElement = node->ToElement() != 0;
+				delete node;
+				node = 0;
+
+				// If this is the root element, we're done. Parsing will be
+				// done by the >> operator.
+				if ( isElement )
+				{
+					return;
+				}
+			}
+			else
+			{
+				SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN );
+				return;
+			}
+		}
+	}
+	// We should have returned sooner.
+	SetError( TIXML_ERROR, 0, 0, TIXML_ENCODING_UNKNOWN );
+}
+
+#endif
+
+const char* TiXmlDocument::Parse( const char* p, TiXmlParsingData* prevData, TiXmlEncoding encoding )
+{
+	ClearError();
+
+	// Parse away, at the document level. Since a document
+	// contains nothing but other tags, most of what happens
+	// here is skipping white space.
+	if ( !p || !*p )
+	{
+		SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
+		return 0;
+	}
+
+	// Note that, for a document, this needs to come
+	// before the while space skip, so that parsing
+	// starts from the pointer we are given.
+	location.Clear();
+	if ( prevData )
+	{
+		location.row = prevData->cursor.row;
+		location.col = prevData->cursor.col;
+	}
+	else
+	{
+		location.row = 0;
+		location.col = 0;
+	}
+	TiXmlParsingData data( p, TabSize(), location.row, location.col );
+	location = data.Cursor();
+
+	if ( encoding == TIXML_ENCODING_UNKNOWN )
+	{
+		// Check for the Microsoft UTF-8 lead bytes.
+		const unsigned char* pU = (const unsigned char*)p;
+		if (	*(pU+0) && *(pU+0) == TIXML_UTF_LEAD_0
+			 && *(pU+1) && *(pU+1) == TIXML_UTF_LEAD_1
+			 && *(pU+2) && *(pU+2) == TIXML_UTF_LEAD_2 )
+		{
+			encoding = TIXML_ENCODING_UTF8;
+			useMicrosoftBOM = true;
+		}
+	}
+
+    p = SkipWhiteSpace( p, encoding );
+	if ( !p )
+	{
+		SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, TIXML_ENCODING_UNKNOWN );
+		return 0;
+	}
+
+	while ( p && *p )
+	{
+		TiXmlNode* node = Identify( p, encoding );
+		if ( node )
+		{
+			p = node->Parse( p, &data, encoding );
+			LinkEndChild( node );
+		}
+		else
+		{
+			break;
+		}
+
+		// Did we get encoding info?
+		if (    encoding == TIXML_ENCODING_UNKNOWN
+			 && node->ToDeclaration() )
+		{
+			TiXmlDeclaration* dec = node->ToDeclaration();
+			const char* enc = dec->Encoding();
+			assert( enc );
+
+			if ( *enc == 0 )
+				encoding = TIXML_ENCODING_UTF8;
+			else if ( StringEqual( enc, "UTF-8", true, TIXML_ENCODING_UNKNOWN ) )
+				encoding = TIXML_ENCODING_UTF8;
+			else if ( StringEqual( enc, "UTF8", true, TIXML_ENCODING_UNKNOWN ) )
+				encoding = TIXML_ENCODING_UTF8;	// incorrect, but be nice
+			else
+				encoding = TIXML_ENCODING_LEGACY;
+		}
+
+		p = SkipWhiteSpace( p, encoding );
+	}
+
+	// Was this empty?
+	if ( !firstChild ) {
+		SetError( TIXML_ERROR_DOCUMENT_EMPTY, 0, 0, encoding );
+		return 0;
+	}
+
+	// All is well.
+	return p;
+}
+
+void TiXmlDocument::SetError( int err, const char* pError, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+	// The first error in a chain is more accurate - don't set again!
+	if ( error )
+		return;
+
+	assert( err > 0 && err < TIXML_ERROR_STRING_COUNT );
+	error   = true;
+	errorId = err;
+	errorDesc = errorString[ errorId ];
+
+	errorLocation.Clear();
+	if ( pError && data )
+	{
+		data->Stamp( pError, encoding );
+		errorLocation = data->Cursor();
+	}
+}
+
+
+TiXmlNode* TiXmlNode::Identify( const char* p, TiXmlEncoding encoding )
+{
+	TiXmlNode* returnNode = 0;
+
+	p = SkipWhiteSpace( p, encoding );
+	if( !p || !*p || *p != '<' )
+	{
+		return 0;
+	}
+
+	TiXmlDocument* doc = GetDocument();
+	p = SkipWhiteSpace( p, encoding );
+
+	if ( !p || !*p )
+	{
+		return 0;
+	}
+
+	// What is this thing?
+	// - Elements start with a letter or underscore, but xml is reserved.
+	// - Comments: <!--
+	// - Decleration: <?xml
+	// - StylesheetReference <?xml-stylesheet
+	// - Everthing else is unknown to tinyxml.
+	//
+
+	const char* xmlHeader = { "<?xml" };
+	const char* xmlSSHeader = { "<?xml-stylesheet" };
+	const char* commentHeader = { "<!--" };
+	const char* dtdHeader = { "<!" };
+	const char* cdataHeader = { "<![CDATA[" };
+
+	if ( StringEqual( p, xmlSSHeader, true, encoding ) )
+	{
+		#ifdef DEBUG_PARSER
+			TIXML_LOG( "XML parsing Stylesheet Reference\n" );
+		#endif
+		returnNode = new TiXmlStylesheetReference();
+	}
+	else if ( StringEqual( p, xmlHeader, true, encoding ) )
+	{
+		#ifdef DEBUG_PARSER
+			TIXML_LOG( "XML parsing Declaration\n" );
+		#endif
+		returnNode = new TiXmlDeclaration();
+	}
+	else if ( StringEqual( p, commentHeader, false, encoding ) )
+	{
+		#ifdef DEBUG_PARSER
+			TIXML_LOG( "XML parsing Comment\n" );
+		#endif
+		returnNode = new TiXmlComment();
+	}
+	else if ( StringEqual( p, cdataHeader, false, encoding ) )
+	{
+		#ifdef DEBUG_PARSER
+			TIXML_LOG( "XML parsing CDATA\n" );
+		#endif
+		TiXmlText* text = new TiXmlText( "" );
+		text->SetCDATA( true );
+		returnNode = text;
+	}
+	else if ( StringEqual( p, dtdHeader, false, encoding ) )
+	{
+		#ifdef DEBUG_PARSER
+			TIXML_LOG( "XML parsing Unknown(1)\n" );
+		#endif
+		returnNode = new TiXmlUnknown();
+	}
+	else if (    IsAlpha( *(p+1), encoding )
+			  || *(p+1) == '_' )
+	{
+		#ifdef DEBUG_PARSER
+			TIXML_LOG( "XML parsing Element\n" );
+		#endif
+		returnNode = new TiXmlElement( "" );
+	}
+	else
+	{
+		#ifdef DEBUG_PARSER
+			TIXML_LOG( "XML parsing Unknown(2)\n" );
+		#endif
+		returnNode = new TiXmlUnknown();
+	}
+
+	if ( returnNode )
+	{
+		// Set the parent, so it can report errors
+		returnNode->parent = this;
+	}
+	else
+	{
+		if ( doc )
+			doc->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, TIXML_ENCODING_UNKNOWN );
+	}
+	return returnNode;
+}
+
+#ifdef TIXML_USE_STL
+
+void TiXmlElement::StreamIn (std::istream * in, TIXML_STRING * tag)
+{
+	// We're called with some amount of pre-parsing. That is, some of "this"
+	// element is in "tag". Go ahead and stream to the closing ">"
+	while( in->good() )
+	{
+		int c = in->get();
+		if ( c <= 0 )
+		{
+			TiXmlDocument* document = GetDocument();
+			if ( document )
+				document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+			return;
+		}
+		(*tag) += (char) c ;
+
+		if ( c == '>' )
+			break;
+	}
+
+	if ( tag->length() < 3 ) return;
+
+	// Okay...if we are a "/>" tag, then we're done. We've read a complete tag.
+	// If not, identify and stream.
+
+	if (    tag->at( tag->length() - 1 ) == '>'
+		 && tag->at( tag->length() - 2 ) == '/' )
+	{
+		// All good!
+		return;
+	}
+	else if ( tag->at( tag->length() - 1 ) == '>' )
+	{
+		// There is more. Could be:
+		//		text
+		//		cdata text (which looks like another node)
+		//		closing tag
+		//		another node.
+		for ( ;; )
+		{
+			StreamWhiteSpace( in, tag );
+
+			// Do we have text?
+			if ( in->good() && in->peek() != '<' )
+			{
+				// Yep, text.
+				TiXmlText text( "" );
+				text.StreamIn( in, tag );
+
+				// What follows text is a closing tag or another node.
+				// Go around again and figure it out.
+				continue;
+			}
+
+			// We now have either a closing tag...or another node.
+			// We should be at a "<", regardless.
+			if ( !in->good() ) return;
+			assert( in->peek() == '<' );
+			int tagIndex = (int) tag->length();
+
+			bool closingTag = false;
+			bool firstCharFound = false;
+
+			for( ;; )
+			{
+				if ( !in->good() )
+					return;
+
+				int c = in->peek();
+				if ( c <= 0 )
+				{
+					TiXmlDocument* document = GetDocument();
+					if ( document )
+						document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+					return;
+				}
+
+				if ( c == '>' )
+					break;
+
+				*tag += (char) c;
+				in->get();
+
+				// Early out if we find the CDATA id.
+				if ( c == '[' && tag->size() >= 9 )
+				{
+					size_t len = tag->size();
+					const char* start = tag->c_str() + len - 9;
+					if ( strcmp( start, "<![CDATA[" ) == 0 ) {
+						assert( !closingTag );
+						break;
+					}
+				}
+
+				if ( !firstCharFound && c != '<' && !IsWhiteSpace( c ) )
+				{
+					firstCharFound = true;
+					if ( c == '/' )
+						closingTag = true;
+				}
+			}
+			// If it was a closing tag, then read in the closing '>' to clean up the input stream.
+			// If it was not, the streaming will be done by the tag.
+			if ( closingTag )
+			{
+				if ( !in->good() )
+					return;
+
+				int c = in->get();
+				if ( c <= 0 )
+				{
+					TiXmlDocument* document = GetDocument();
+					if ( document )
+						document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+					return;
+				}
+				assert( c == '>' );
+				*tag += (char) c;
+
+				// We are done, once we've found our closing tag.
+				return;
+			}
+			else
+			{
+				// If not a closing tag, id it, and stream.
+				const char* tagloc = tag->c_str() + tagIndex;
+				TiXmlNode* node = Identify( tagloc, TIXML_DEFAULT_ENCODING );
+				if ( !node )
+					return;
+				node->StreamIn( in, tag );
+				delete node;
+				node = 0;
+
+				// No return: go around from the beginning: text, closing tag, or node.
+			}
+		}
+	}
+}
+#endif
+
+const char* TiXmlElement::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+	p = SkipWhiteSpace( p, encoding );
+	TiXmlDocument* document = GetDocument();
+
+	if ( !p || !*p )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, 0, 0, encoding );
+		return 0;
+	}
+
+	if ( data )
+	{
+		data->Stamp( p, encoding );
+		location = data->Cursor();
+	}
+
+	if ( *p != '<' )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, p, data, encoding );
+		return 0;
+	}
+
+	p = SkipWhiteSpace( p+1, encoding );
+
+	// Read the name.
+	const char* pErr = p;
+
+    p = ReadName( p, &value, encoding );
+	if ( !p || !*p )
+	{
+		if ( document )	document->SetError( TIXML_ERROR_FAILED_TO_READ_ELEMENT_NAME, pErr, data, encoding );
+		return 0;
+	}
+
+    TIXML_STRING endTag ("</");
+	endTag += value;
+	endTag += ">";
+
+	// Check for and read attributes. Also look for an empty
+	// tag or an end tag.
+	while ( p && *p )
+	{
+		pErr = p;
+		p = SkipWhiteSpace( p, encoding );
+		if ( !p || !*p )
+		{
+			if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding );
+			return 0;
+		}
+		if ( *p == '/' )
+		{
+			++p;
+			// Empty tag.
+			if ( *p  != '>' )
+			{
+				if ( document ) document->SetError( TIXML_ERROR_PARSING_EMPTY, p, data, encoding );
+				return 0;
+			}
+			return (p+1);
+		}
+		else if ( *p == '>' )
+		{
+			// Done with attributes (if there were any.)
+			// Read the value -- which can include other
+			// elements -- read the end tag, and return.
+			++p;
+			p = ReadValue( p, data, encoding );		// Note this is an Element method, and will set the error if one happens.
+			if ( !p || !*p ) {
+				// We were looking for the end tag, but found nothing.
+				// Fix for [ 1663758 ] Failure to report error on bad XML
+				if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding );
+				return 0;
+			}
+
+			// We should find the end tag now
+			if ( StringEqual( p, endTag.c_str(), false, encoding ) )
+			{
+				p += endTag.length();
+				return p;
+			}
+			else
+			{
+				if ( document ) document->SetError( TIXML_ERROR_READING_END_TAG, p, data, encoding );
+				return 0;
+			}
+		}
+		else
+		{
+			// Try to read an attribute:
+			TiXmlAttribute* attrib = new TiXmlAttribute();
+			if ( !attrib )
+			{
+				if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, pErr, data, encoding );
+				return 0;
+			}
+
+			attrib->SetDocument( document );
+			pErr = p;
+			p = attrib->Parse( p, data, encoding );
+
+			if ( !p || !*p )
+			{
+				if ( document ) document->SetError( TIXML_ERROR_PARSING_ELEMENT, pErr, data, encoding );
+				delete attrib;
+				return 0;
+			}
+
+			// Handle the strange case of double attributes:
+			#ifdef TIXML_USE_STL
+			TiXmlAttribute* node = attributeSet.Find( attrib->NameTStr() );
+			#else
+			TiXmlAttribute* node = attributeSet.Find( attrib->Name() );
+			#endif
+			if ( node )
+			{
+				node->SetValue( attrib->Value() );
+				delete attrib;
+				return 0;
+			}
+
+			attributeSet.Add( attrib );
+		}
+	}
+	return p;
+}
+
+
+const char* TiXmlElement::ReadValue( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+	TiXmlDocument* document = GetDocument();
+
+	// Read in text and elements in any order.
+	const char* pWithWhiteSpace = p;
+	p = SkipWhiteSpace( p, encoding );
+
+	while ( p && *p )
+	{
+		if ( *p != '<' )
+		{
+			// Take what we have, make a text element.
+			TiXmlText* textNode = new TiXmlText( "" );
+
+			if ( !textNode )
+			{
+				if ( document ) document->SetError( TIXML_ERROR_OUT_OF_MEMORY, 0, 0, encoding );
+				    return 0;
+			}
+
+			if ( TiXmlBase::IsWhiteSpaceCondensed() )
+			{
+				p = textNode->Parse( p, data, encoding );
+			}
+			else
+			{
+				// Special case: we want to keep the white space
+				// so that leading spaces aren't removed.
+				p = textNode->Parse( pWithWhiteSpace, data, encoding );
+			}
+
+			if ( !textNode->Blank() )
+				LinkEndChild( textNode );
+			else
+				delete textNode;
+		}
+		else
+		{
+			// We hit a '<'
+			// Have we hit a new element or an end tag? This could also be
+			// a TiXmlText in the "CDATA" style.
+			if ( StringEqual( p, "</", false, encoding ) )
+			{
+				return p;
+			}
+			else
+			{
+				TiXmlNode* node = Identify( p, encoding );
+				if ( node )
+				{
+					p = node->Parse( p, data, encoding );
+					LinkEndChild( node );
+				}
+				else
+				{
+					return 0;
+				}
+			}
+		}
+		pWithWhiteSpace = p;
+		p = SkipWhiteSpace( p, encoding );
+	}
+
+	if ( !p )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_READING_ELEMENT_VALUE, 0, 0, encoding );
+	}
+	return p;
+}
+
+
+#ifdef TIXML_USE_STL
+void TiXmlUnknown::StreamIn( std::istream * in, TIXML_STRING * tag )
+{
+	while ( in->good() )
+	{
+		int c = in->get();
+		if ( c <= 0 )
+		{
+			TiXmlDocument* document = GetDocument();
+			if ( document )
+				document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+			return;
+		}
+		(*tag) += (char) c;
+
+		if ( c == '>' )
+		{
+			// All is well.
+			return;
+		}
+	}
+}
+#endif
+
+
+const char* TiXmlUnknown::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+	TiXmlDocument* document = GetDocument();
+	p = SkipWhiteSpace( p, encoding );
+
+	if ( data )
+	{
+		data->Stamp( p, encoding );
+		location = data->Cursor();
+	}
+	if ( !p || !*p || *p != '<' )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_PARSING_UNKNOWN, p, data, encoding );
+		return 0;
+	}
+	++p;
+    value = "";
+
+	while ( p && *p && *p != '>' )
+	{
+		value += *p;
+		++p;
+	}
+
+	if ( !p )
+	{
+		if ( document )	document->SetError( TIXML_ERROR_PARSING_UNKNOWN, 0, 0, encoding );
+	}
+	if ( *p == '>' )
+		return p+1;
+	return p;
+}
+
+#ifdef TIXML_USE_STL
+void TiXmlComment::StreamIn( std::istream * in, TIXML_STRING * tag )
+{
+	while ( in->good() )
+	{
+		int c = in->get();
+		if ( c <= 0 )
+		{
+			TiXmlDocument* document = GetDocument();
+			if ( document )
+				document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+			return;
+		}
+
+		(*tag) += (char) c;
+
+		if ( c == '>'
+			 && tag->at( tag->length() - 2 ) == '-'
+			 && tag->at( tag->length() - 3 ) == '-' )
+		{
+			// All is well.
+			return;
+		}
+	}
+}
+#endif
+
+
+const char* TiXmlComment::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+	TiXmlDocument* document = GetDocument();
+	value = "";
+
+	p = SkipWhiteSpace( p, encoding );
+
+	if ( data )
+	{
+		data->Stamp( p, encoding );
+		location = data->Cursor();
+	}
+	const char* startTag = "<!--";
+	const char* endTag   = "-->";
+
+	if ( !StringEqual( p, startTag, false, encoding ) )
+	{
+		document->SetError( TIXML_ERROR_PARSING_COMMENT, p, data, encoding );
+		return 0;
+	}
+	p += strlen( startTag );
+
+	// [ 1475201 ] TinyXML parses entities in comments
+	// Oops - ReadText doesn't work, because we don't want to parse the entities.
+	// p = ReadText( p, &value, false, endTag, false, encoding );
+	//
+	// from the XML spec:
+	/*
+	 [Definition: Comments may appear anywhere in a document outside other markup; in addition,
+	              they may appear within the document type declaration at places allowed by the grammar.
+				  They are not part of the document's character data; an XML processor MAY, but need not,
+				  make it possible for an application to retrieve the text of comments. For compatibility,
+				  the string "--" (double-hyphen) MUST NOT occur within comments.] Parameter entity
+				  references MUST NOT be recognized within comments.
+
+				  An example of a comment:
+
+				  <!-- declarations for <head> & <body> -->
+	*/
+
+    value = "";
+	// Keep all the white space.
+	while (	p && *p && !StringEqual( p, endTag, false, encoding ) )
+	{
+		value.append( p, 1 );
+		++p;
+	}
+	if ( p )
+		p += strlen( endTag );
+
+	return p;
+}
+
+
+const char* TiXmlAttribute::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+	p = SkipWhiteSpace( p, encoding );
+	if ( !p || !*p ) return 0;
+
+//	int tabsize = 4;
+//	if ( document )
+//		tabsize = document->TabSize();
+
+	if ( data )
+	{
+		data->Stamp( p, encoding );
+		location = data->Cursor();
+	}
+	// Read the name, the '=' and the value.
+	const char* pErr = p;
+	p = ReadName( p, &name, encoding );
+	if ( !p || !*p )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, pErr, data, encoding );
+		return 0;
+	}
+	p = SkipWhiteSpace( p, encoding );
+	if ( !p || !*p || *p != '=' )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
+		return 0;
+	}
+
+	++p;	// skip '='
+	p = SkipWhiteSpace( p, encoding );
+	if ( !p || !*p )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
+		return 0;
+	}
+
+	const char* end;
+	const char SINGLE_QUOTE = '\'';
+	const char DOUBLE_QUOTE = '\"';
+
+	if ( *p == SINGLE_QUOTE )
+	{
+		++p;
+		end = "\'";		// single quote in string
+		p = ReadText( p, &value, false, end, false, encoding );
+	}
+	else if ( *p == DOUBLE_QUOTE )
+	{
+		++p;
+		end = "\"";		// double quote in string
+		p = ReadText( p, &value, false, end, false, encoding );
+	}
+	else
+	{
+		// All attribute values should be in single or double quotes.
+		// But this is such a common error that the parser will try
+		// its best, even without them.
+		value = "";
+		while (    p && *p											// existence
+				&& !IsWhiteSpace( *p ) && *p != '\n' && *p != '\r'	// whitespace
+				&& *p != '/' && *p != '>' )							// tag end
+		{
+			if ( *p == SINGLE_QUOTE || *p == DOUBLE_QUOTE ) {
+				// [ 1451649 ] Attribute values with trailing quotes not handled correctly
+				// We did not have an opening quote but seem to have a
+				// closing one. Give up and throw an error.
+				if ( document ) document->SetError( TIXML_ERROR_READING_ATTRIBUTES, p, data, encoding );
+				return 0;
+			}
+			value += *p;
+			++p;
+		}
+	}
+	return p;
+}
+
+#ifdef TIXML_USE_STL
+void TiXmlText::StreamIn( std::istream * in, TIXML_STRING * tag )
+{
+	while ( in->good() )
+	{
+		int c = in->peek();
+		if ( !cdata && (c == '<' ) )
+		{
+			return;
+		}
+		if ( c <= 0 )
+		{
+			TiXmlDocument* document = GetDocument();
+			if ( document )
+				document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+			return;
+		}
+
+		(*tag) += (char) c;
+		in->get();	// "commits" the peek made above
+
+		if ( cdata && c == '>' && tag->size() >= 3 ) {
+			size_t len = tag->size();
+			if ( (*tag)[len-2] == ']' && (*tag)[len-3] == ']' ) {
+				// terminator of cdata.
+				return;
+			}
+		}
+	}
+}
+#endif
+
+const char* TiXmlText::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding encoding )
+{
+	value = "";
+	TiXmlDocument* document = GetDocument();
+
+	if ( data )
+	{
+		data->Stamp( p, encoding );
+		location = data->Cursor();
+	}
+
+	const char* const startTag = "<![CDATA[";
+	const char* const endTag   = "]]>";
+
+	if ( cdata || StringEqual( p, startTag, false, encoding ) )
+	{
+		cdata = true;
+
+		if ( !StringEqual( p, startTag, false, encoding ) )
+		{
+			document->SetError( TIXML_ERROR_PARSING_CDATA, p, data, encoding );
+			return 0;
+		}
+		p += strlen( startTag );
+
+		// Keep all the white space, ignore the encoding, etc.
+		while (	   p && *p
+				&& !StringEqual( p, endTag, false, encoding )
+			  )
+		{
+			value += *p;
+			++p;
+		}
+
+		TIXML_STRING dummy;
+		p = ReadText( p, &dummy, false, endTag, false, encoding );
+		return p;
+	}
+	else
+	{
+		bool ignoreWhite = true;
+
+		const char* end = "<";
+		p = ReadText( p, &value, ignoreWhite, end, false, encoding );
+		if ( p )
+			return p-1;	// don't truncate the '<'
+		return 0;
+	}
+}
+
+#ifdef TIXML_USE_STL
+void TiXmlDeclaration::StreamIn( std::istream * in, TIXML_STRING * tag )
+{
+	while ( in->good() )
+	{
+		int c = in->get();
+		if ( c <= 0 )
+		{
+			TiXmlDocument* document = GetDocument();
+			if ( document )
+				document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+			return;
+		}
+		(*tag) += (char) c;
+
+		if ( c == '>' )
+		{
+			// All is well.
+			return;
+		}
+	}
+}
+#endif
+
+const char* TiXmlDeclaration::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding _encoding )
+{
+	p = SkipWhiteSpace( p, _encoding );
+	// Find the beginning, find the end, and look for
+	// the stuff in-between.
+	TiXmlDocument* document = GetDocument();
+	if ( !p || !*p || !StringEqual( p, "<?xml", true, _encoding ) )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding );
+		return 0;
+	}
+	if ( data )
+	{
+		data->Stamp( p, _encoding );
+		location = data->Cursor();
+	}
+	p += 5;
+
+	version = "";
+	encoding = "";
+	standalone = "";
+
+	while ( p && *p )
+	{
+		if ( *p == '>' )
+		{
+			++p;
+			return p;
+		}
+
+		p = SkipWhiteSpace( p, _encoding );
+		if ( StringEqual( p, "version", true, _encoding ) )
+		{
+			TiXmlAttribute attrib;
+			p = attrib.Parse( p, data, _encoding );
+			version = attrib.Value();
+		}
+		else if ( StringEqual( p, "encoding", true, _encoding ) )
+		{
+			TiXmlAttribute attrib;
+			p = attrib.Parse( p, data, _encoding );
+			encoding = attrib.Value();
+		}
+		else if ( StringEqual( p, "standalone", true, _encoding ) )
+		{
+			TiXmlAttribute attrib;
+			p = attrib.Parse( p, data, _encoding );
+			standalone = attrib.Value();
+		}
+		else
+		{
+			// Read over whatever it is.
+			while( p && *p && *p != '>' && !IsWhiteSpace( *p ) )
+				++p;
+		}
+	}
+	return 0;
+}
+
+bool TiXmlText::Blank() const
+{
+	for ( unsigned i=0; i<value.length(); i++ )
+		if ( !IsWhiteSpace( value[i] ) )
+			return false;
+	return true;
+}
+
+#ifdef TIXML_USE_STL
+void TiXmlStylesheetReference::StreamIn( std::istream * in, TIXML_STRING * tag )
+{
+	while ( in->good() )
+	{
+		int c = in->get();
+		if ( c <= 0 )
+		{
+			TiXmlDocument* document = GetDocument();
+			if ( document )
+				document->SetError( TIXML_ERROR_EMBEDDED_NULL, 0, 0, TIXML_ENCODING_UNKNOWN );
+			return;
+		}
+		(*tag) += (char) c;
+
+		if ( c == '>' )
+		{
+			// All is well.
+			return;
+		}
+	}
+}
+#endif
+
+const char* TiXmlStylesheetReference::Parse( const char* p, TiXmlParsingData* data, TiXmlEncoding _encoding )
+{
+	p = SkipWhiteSpace( p, _encoding );
+	// Find the beginning, find the end, and look for
+	// the stuff in-between.
+	TiXmlDocument* document = GetDocument();
+	if ( !p || !*p || !StringEqual( p, "<?xml-stylesheet", true, _encoding ) )
+	{
+		if ( document ) document->SetError( TIXML_ERROR_PARSING_DECLARATION, 0, 0, _encoding );
+		return 0;
+	}
+	if ( data )
+	{
+		data->Stamp( p, _encoding );
+		location = data->Cursor();
+	}
+	p += 5;
+
+	type = "";
+	href = "";
+
+	while ( p && *p )
+	{
+		if ( *p == '>' )
+		{
+			++p;
+			return p;
+		}
+
+		p = SkipWhiteSpace( p, _encoding );
+		if ( StringEqual( p, "type", true, _encoding ) )
+		{
+			TiXmlAttribute attrib;
+			p = attrib.Parse( p, data, _encoding );
+			type = attrib.Value();
+		}
+		else if ( StringEqual( p, "href", true, _encoding ) )
+		{
+			TiXmlAttribute attrib;
+			p = attrib.Parse( p, data, _encoding );
+			href = attrib.Value();
+		}
+		else
+		{
+			// Read over whatever it is.
+			while( p && *p && *p != '>' && !IsWhiteSpace( *p ) )
+				++p;
+		}
+	}
+	return 0;
+}
Index: /code/branches/buildsystem3/src/tolua/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/tolua/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,27 @@
-SET (TOLUALIB_SRC_FILES
+ #
+ #             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.
+ #
+
+################### Tolua++ library ###################
+
+SET(TOLUA++_FILES
+  tolua_event.h
+  tolua++.h
+
   tolua_event.c
   tolua_is.c
@@ -6,68 +30,49 @@
   tolua_to.c
 )
+GENERATE_SOURCE_GROUPS(${TOLUA++_FILES})
 
-ADD_LIBRARY (tolualib_orxonox SHARED ${TOLUALIB_SRC_FILES})
+ADD_COMPILER_FLAGS("-w44996" MSVC)
 
-TARGET_LINK_LIBRARIES (tolualib_orxonox
-  lua_orxonox
-)
+ADD_LIBRARY(tolua++_orxonox SHARED ${TOLUA++_FILES})
+SET_TARGET_PROPERTIES(tolua++_orxonox PROPERTIES DEFINE_SYMBOL "TOLUA_SHARED_BUILD")
+TARGET_LINK_LIBRARIES(tolua++_orxonox ${LUA_LIBRARIES})
+
+ORXONOX_INSTALL(tolua++_orxonox)
 
 
-SET (TOLUAGEN_SRC_FILES
-  tolua.c
-  toluabind.c
+################## Tolua++ generator ##################
+
+ADD_EXECUTABLE(tolua++app_orxonox tolua.c)
+TARGET_LINK_LIBRARIES(tolua++app_orxonox tolua++_orxonox ${LUA_LIBRARIES})
+
+OPTION(TOLUA_PARSER_RELEASE "Disable all debug messages from tolua bind files for Release and MinSizeRel build types." FALSE)
+
+# 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_DEPENDENCIES
+  tolua++app_orxonox
+  ${CMAKE_CURRENT_SOURCE_DIR}/all-${LUA_VERSION}.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/compat-5.1.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/compat.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/basic.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/feature.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/verbatim.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/code.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/typedef.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/container.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/package.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/module.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/namespace.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/define.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/enumerate.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/declaration.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/variable.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/array.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/function.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/operator.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/class.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/clean.lua
+  ${CMAKE_CURRENT_SOURCE_DIR}/lua/doit.lua
+
+  CACHE INTERNAL ""
 )
-
-ADD_EXECUTABLE (toluagen_orxonox ${TOLUAGEN_SRC_FILES})
-
-TARGET_LINK_LIBRARIES (toluagen_orxonox
-  lua_orxonox
-  tolualib_orxonox
-  m
-)
-
-
-SET (TOLUA_PACKAGE "../../src/tolua/tolua-5.1.pkg")
-GET_TARGET_PROPERTY(TOLUAGEN_EXE toluagen_orxonox LOCATION)
-ADD_CUSTOM_COMMAND(
-  OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/toluabind_orxonox.c
-  COMMAND ${TOLUAGEN_EXE} -n tolua -o ../../src/tolua/toluabind_orxonox.c -H ../../src/tolua/toluabind_orxonox.h ${TOLUA_PACKAGE}
-  DEPENDS
-    toluagen_orxonox
-    tolua-5.1.pkg
-    lua/compat-5.1.lua
-    lua/compat.lua
-    lua/basic.lua
-    lua/feature.lua
-    lua/verbatim.lua
-    lua/code.lua
-    lua/typedef.lua
-    lua/container.lua
-    lua/package.lua
-    lua/module.lua
-    lua/namespace.lua
-    lua/define.lua
-    lua/enumerate.lua
-    lua/declaration.lua
-    lua/variable.lua
-    lua/array.lua
-    lua/function.lua
-    lua/operator.lua
-    lua/class.lua
-    lua/clean.lua
-    lua/doit.lua
-  WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/lib
-)
-
-SET (TOLUAEXE_SRC_FILES
-  tolua.c
-  toluabind_orxonox.c
-)
-
-ADD_EXECUTABLE (tolua_orxonox ${TOLUAEXE_SRC_FILES})
-
-TARGET_LINK_LIBRARIES (tolua_orxonox
-  lua_orxonox
-  tolualib_orxonox
-  m
-)
Index: /code/branches/buildsystem3/src/tolua/MANUAL
===================================================================
--- /code/branches/buildsystem3/src/tolua/MANUAL	(revision 2664)
+++ /code/branches/buildsystem3/src/tolua/MANUAL	(revision 2664)
@@ -0,0 +1,58 @@
+This tolua++ is modified with support for exception handling, and more will
+likely come over time.
+
+So to avoid forgetting how it works and what's new, all added features will
+be documented in full in this file:
+
+***********************
+* Exception handling: *
+***********************
+A new function modifier 'tolua_throws' has been added. It goes the same place
+as 'tolua_outside' etc. - so before the function name and return type.
+
+Two "types" of exceptions are supported internally, but they can be customized
+by making the tolua++ binary execute a Lua script before parsing with the '-L'
+command line option.
+Look in '../LuaScriptModule/package/exceptions.lua' to see the format. It's
+fairly simple and gives you alot of control.
+
+You always have 'std::exception' and 'any' (which means ...) available.
+
+This first example would be valid in a .pkg file for tolua++, and would ensure
+that any exceptions based on 'std::exception' thrown by the real C++ function
+would result in return value of 'nil' in Lua:
+
+	tolua_throws|std::exception,nil| void I_Throw:StdException();
+
+Inside the pipes the exception name follow by return values (or actions) are
+listed. The syntax is like so:
+
+	tolua_throws|<exceptionName>[,<ret1>[,<ret2> ... [, <retN>]]]|[<exceptionName>...|]
+
+The return values can by any of the following:
+* nil
+* message (the exception message, or 'Unknown' if not possible.
+* true
+* false
+* error (can only be used alone, will contain the exception is possible)
+
+In case no return values are specified, it will default to: 'nil, message'.
+
+Example 1: 
+----------
+Returns 'nil, false' for all exceptions:
+
+	tolua_throws|any,nil,false|
+
+Example 2:
+----------
+Returns 'nil, message' if a 'std::exception' is thrown:
+
+	tolua_throws|std::exception,nil,message|
+
+Example 3:
+----------
+If a CEGUI::Exception is thrown, return 'nil, message'.
+If any other kind of exception is thrown abort (error).
+
+	tolua_throws|CEGUI::Exception|any,error|
Index: /code/branches/buildsystem3/src/tolua/README
===================================================================
--- /code/branches/buildsystem3/src/tolua/README	(revision 2664)
+++ /code/branches/buildsystem3/src/tolua/README	(revision 2664)
@@ -0,0 +1,32 @@
+This is tolua++-1.0
+
+* What is tolua++?
+  tolua++ is an extension of toLua, a tool to integrate C/C++ code with
+  Lua. tolua++ includes new features oriented to c++, such as class
+  templates.
+
+  tolua is a tool that greatly simplifies the integration of C/C++ code 
+  with Lua. Based on a "cleaned" header file, tolua automatically generates 
+  the binding code to access C/C++ features from Lua. Using Lua-5.0 API and
+  metamethod facilities, the current version automatically maps C/C++ 
+  constants, external variables, functions, namespace, classes, and methods 
+  to Lua. It also provides facilities to create Lua modules.
+
+* Availability
+  tolua is freely available; 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.
+
+  tolua can be downloaded from the sites below:
+            http://www.codenix.com/~tolua/
+            http://www.codenix.com/~tolua/tolua++-1.0.tar.bz2
+
+* Installation
+  See INSTALL.
+
+* Contacting the author
+  tolua has been designed and implemented by Waldemar Celes.
+  tolua++ is maintained by Ariel Manzur.
+  Send your comments, bug reports and anything else to 
+  tolua@codenix.com
Index: /code/branches/buildsystem3/src/tolua/VERSION
===================================================================
--- /code/branches/buildsystem3/src/tolua/VERSION	(revision 2664)
+++ /code/branches/buildsystem3/src/tolua/VERSION	(revision 2664)
@@ -0,0 +1,9 @@
+Tolua++ v1.0.92 with changes:
+
+- Exception handling by CEGUI team
+- Corrected all indentation by Orxonox
+- Added more command line arguments by Orxonox
+- Several small changes considering the output files by Orxonox
+
+The changes to the C source files are stored in changes_orxonox.diff
+
Index: /code/branches/buildsystem3/src/tolua/all-5.0.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/all-5.0.lua	(revision 2664)
+++ /code/branches/buildsystem3/src/tolua/all-5.0.lua	(revision 2664)
@@ -0,0 +1,28 @@
+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
Index: /code/branches/buildsystem3/src/tolua/all-5.1.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/all-5.1.lua	(revision 2664)
+++ /code/branches/buildsystem3/src/tolua/all-5.1.lua	(revision 2664)
@@ -0,0 +1,29 @@
+dofile(path.."lua/compat-5.1.lua")
+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
Index: /code/branches/buildsystem3/src/tolua/changes_orxonox.diff
===================================================================
--- /code/branches/buildsystem3/src/tolua/changes_orxonox.diff	(revision 2664)
+++ /code/branches/buildsystem3/src/tolua/changes_orxonox.diff	(revision 2664)
@@ -0,0 +1,182 @@
+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
+@@ -4,6 +4,8 @@
+ ** TeCGraf/PUC-Rio
+ ** Aug 2003
+ ** $Id:$
++** Extension by Orxonox (Reto Grieder) to support working directory
++** and direct usage of lua files. (2008)
+ */
+ 
+ /* This code is free software; you can redistribute it and/or modify it.
+@@ -33,6 +35,8 @@
+          "  -o  file : set output file; default is stdout.\n"
+          "  -H  file : create include file.\n"
+          "  -n  name : set package name; default is input file root name.\n"
++         "  -w  directory : set working directory; default is location of package file.\n"
++         "  -s  file : specify source lua code for the parser; all.lua is default.\n"
+          "  -p       : parse only.\n"
+          "  -P       : parse and print structure information (for debug).\n"
+          "  -S       : disable support for c++ strings.\n"
+@@ -64,12 +68,12 @@
+ }
+ 
+ static void add_extra (lua_State* L, char* value) {
+-	int len;
+-	lua_getglobal(L, "_extra_parameters");
+-	len = luaL_getn(L, -1);
+-	lua_pushstring(L, value);
+-	lua_rawseti(L, -2, len+1);
+-	lua_pop(L, 1);
++ int len;
++ lua_getglobal(L, "_extra_parameters");
++ len = luaL_getn(L, -1);
++ lua_pushstring(L, value);
++ lua_rawseti(L, -2, len+1);
++ lua_pop(L, 1);
+ };
+ 
+ static void error (char* o)
+@@ -81,6 +85,9 @@
+ 
+ int main (int argc, char* argv[])
+ {
++ char* working_directory = "";
++ char* lua_source = "";
++
+  #ifdef LUA_VERSION_NUM /* lua 5.1 */
+  lua_State* L = luaL_newstate();
+  luaL_openlibs(L);
+@@ -97,6 +104,7 @@
+  lua_pushstring(L,TOLUA_VERSION); lua_setglobal(L,"TOLUA_VERSION");
+  lua_pushstring(L,LUA_VERSION); lua_setglobal(L,"TOLUA_LUA_VERSION");
+ 
++
+  if (argc==1)
+  {
+   help();
+@@ -124,6 +132,14 @@
+      case 'o': setfield(L,t,"o",argv[++i]); break;
+      case 'n': setfield(L,t,"n",argv[++i]); break;
+      case 'H': setfield(L,t,"H",argv[++i]); break;
++     case 'w':
++      working_directory = argv[++i];
++      setfield(L,t,"w",argv[i]);
++      break;
++     case 's':
++      lua_source = argv[++i];
++      setfield(L,t,"s",argv[i]);
++      break;
+      case 'S': setfield(L,t,"S",""); break;
+      case '1': setfield(L,t,"1",""); break;
+      case 'L': setfield(L,t,"L",argv[++i]); break;
+@@ -143,25 +159,53 @@
+   }
+   lua_pop(L,1);
+  }
+-/* #define TOLUA_SCRIPT_RUN */
+-#ifndef TOLUA_SCRIPT_RUN
++
+  {
+-  int tolua_tolua_open (lua_State* L);
+-  tolua_tolua_open(L);
+- }
++  char path[BUFSIZ];
++  char file[BUFSIZ];
++  path[0] = '\0';
++  file[0] = '\0';
++
++  if (strlen(lua_source) > 0 &&
++      lua_source[0] != '/' &&
++      lua_source[0] != '\\' &&
++      strlen(lua_source) > 1 &&
++      lua_source[1] != ':')
++  {
++   /* Relative path, prefix working directory */
++   strcpy(path, working_directory);
++   /* Make sure there is '\\' or '/' at the end of the path */
++   if (strlen(path) > 0)
++   {
++    char last = path[strlen(path) - 1];
++    if (last != '\\' && last != '/')
++     strcat(path, "/");
++   }
++  }
++
++  strcat(path, lua_source);
++
++  /* Extract the full path */
++  {
++   char* p;
++   p = strrchr(path, '/');
++   if (p == NULL)
++    p = strrchr(path, '\\');
++   p = (p == NULL) ? path : p + 1;
++   strcpy(file, p);
++   *p = '\0';
++  }
++  if (strlen(file) == 0)
++   strcpy(file, "all.lua");
++
++  lua_pushstring(L, path);
++  lua_setglobal(L, "path");
++  strcat(path, file);
++#ifdef LUA_VERSION_NUM /* lua 5.1 */
++  luaL_dofile(L, path);
+ #else
+- {
+-  char* p;
+-  char  path[BUFSIZ];
+-  strcpy(path,argv[0]);
+-  p = strrchr(path,'/');
+-  if (p==NULL) p = strrchr(path,'\\');
+-  p = (p==NULL) ? path : p+1;
+-  sprintf(p,"%s","../src/bin/lua/");
+-  lua_pushstring(L,path); lua_setglobal(L,"path");
+-		strcat(path,"all.lua");
+-  lua_dofile(L,path);
+- }
++  lua_dofile(L, path);
+ #endif
++ }
+  return 0;
+ }
Index: /code/branches/buildsystem3/src/tolua/lua/array.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/array.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/array.lua	(revision 2664)
@@ -21,18 +21,18 @@
 -- Print method
 function classArray:print (ident,close)
- print(ident.."Array{")
- print(ident.." mod  = '"..self.mod.."',")
- print(ident.." type = '"..self.type.."',")
- print(ident.." ptr  = '"..self.ptr.."',")
- print(ident.." name = '"..self.name.."',")
- print(ident.." def  = '"..self.def.."',")
- print(ident.." dim  = '"..self.dim.."',")
- print(ident.." ret  = '"..self.ret.."',")
- print(ident.."}"..close)
+    print(ident.."Array{")
+    print(ident.." mod  = '"..self.mod.."',")
+    print(ident.." type = '"..self.type.."',")
+    print(ident.." ptr  = '"..self.ptr.."',")
+    print(ident.." name = '"..self.name.."',")
+    print(ident.." def  = '"..self.def.."',")
+    print(ident.." dim  = '"..self.dim.."',")
+    print(ident.." ret  = '"..self.ret.."',")
+    print(ident.."}"..close)
 end
 
 -- check if it is a variable
 function classArray:isvariable ()
- return true
+    return true
 end
 
@@ -40,181 +40,180 @@
 -- get variable value
 function classArray:getvalue (class,static)
- if class and static then
-  return class..'::'..self.name..'[tolua_index]'
- elseif class then
-  return 'self->'..self.name..'[tolua_index]'
- else
-  return self.name..'[tolua_index]'
- end
+    if class and static then
+        return class..'::'..self.name..'[tolua_index]'
+    elseif class then
+        return 'self->'..self.name..'[tolua_index]'
+    else
+        return self.name..'[tolua_index]'
+    end
 end
 
 -- Write binding functions
 function classArray:supcode ()
- local class = self:inclass()
-
- -- get function ------------------------------------------------
- if class then
-  output("/* get function:",self.name," of class ",class," */")
- else
-  output("/* get function:",self.name," */")
- end
- self.cgetname = self:cfuncname("tolua_get")
- output("#ifndef TOLUA_DISABLE_"..self.cgetname)
- output("\nstatic int",self.cgetname,"(lua_State* tolua_S)")
- output("{")
- output(" int tolua_index;")
-
- -- declare self, if the case
- local _,_,static = strfind(self.mod,'^%s*(static)')
- if class and static==nil then
-  output(' ',self.parent.type,'*','self;')
-  output(' lua_pushstring(tolua_S,".self");')
-  output(' lua_rawget(tolua_S,1);')
-  output(' self = ')
-  output('(',self.parent.type,'*) ')
-  output('lua_touserdata(tolua_S,-1);')
- elseif static then
-  _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)')
- end
-
- -- check index
-	output('#ifndef TOLUA_RELEASE\n')
-	output(' {')
-	output('  tolua_Error tolua_err;')
- output('  if (!tolua_isnumber(tolua_S,2,0,&tolua_err))')
- output('   tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err);')
-	output(' }')
-	output('#endif\n')
-	if flags['1'] then -- for compatibility with tolua5 ?
-		output(' tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;')
-	else
-		output(' tolua_index = (int)tolua_tonumber(tolua_S,2,0);')
-	end
-	output('#ifndef TOLUA_RELEASE\n')
-	if self.dim and self.dim ~= '' then
-	  output(' if (tolua_index<0 || tolua_index>='..self.dim..')')
-	else
-	  output(' if (tolua_index<0)')
-	end
- output('  tolua_error(tolua_S,"array indexing out of range.",NULL);')
-	output('#endif\n')
-
- -- return value
- local t,ct = isbasic(self.type)
- if t then
-  output(' tolua_push'..t..'(tolua_S,(',ct,')'..self:getvalue(class,static)..');')
- else
-		t = self.type
-  if self.ptr == '&' or self.ptr == '' then
-   output(' tolua_pushusertype(tolua_S,(void*)&'..self:getvalue(class,static)..',"',t,'");')
-  else
-   output(' tolua_pushusertype(tolua_S,(void*)'..self:getvalue(class,static)..',"',t,'");')
-  end
- end
- output(' return 1;')
- output('}')
- output('#endif //#ifndef TOLUA_DISABLE\n')
- output('\n')
-
- -- set function ------------------------------------------------
- if not strfind(self.type,'const') then
-  if class then
-   output("/* set function:",self.name," of class ",class," */")
-  else
-   output("/* set function:",self.name," */")
-  end
-  self.csetname = self:cfuncname("tolua_set")
-  output("#ifndef TOLUA_DISABLE_"..self.csetname)
-  output("\nstatic int",self.csetname,"(lua_State* tolua_S)")
-  output("{")
-
-  -- declare index
-  output(' int tolua_index;')
-
-  -- declare self, if the case
-  local _,_,static = strfind(self.mod,'^%s*(static)')
-  if class and static==nil then
-   output(' ',self.parent.type,'*','self;')
-   output(' lua_pushstring(tolua_S,".self");')
-   output(' lua_rawget(tolua_S,1);')
-   output(' self = ')
-   output('(',self.parent.type,'*) ')
-   output('lua_touserdata(tolua_S,-1);')
-  elseif static then
-   _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)')
-  end
-
-  -- check index
-	 output('#ifndef TOLUA_RELEASE\n')
-	 output(' {')
-	 output('  tolua_Error tolua_err;')
-  output('  if (!tolua_isnumber(tolua_S,2,0,&tolua_err))')
-  output('   tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err);')
-		output(' }')
-		output('#endif\n')
-
-	if flags['1'] then -- for compatibility with tolua5 ?
-		output(' tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;')
-	else
-		output(' tolua_index = (int)tolua_tonumber(tolua_S,2,0);')
-	end
-
-	 output('#ifndef TOLUA_RELEASE\n')
-	if self.dim and self.dim ~= '' then
-	  output(' if (tolua_index<0 || tolua_index>='..self.dim..')')
-	else
-	  output(' if (tolua_index<0)')
-	end
-  output('  tolua_error(tolua_S,"array indexing out of range.",NULL);')
-		output('#endif\n')
-
-  -- assign value
-  local ptr = ''
-  if self.ptr~='' then ptr = '*' end
-  output(' ')
-  if class and static then
-   output(class..'::'..self.name..'[tolua_index]')
-  elseif class then
-   output('self->'..self.name..'[tolua_index]')
-  else
-   output(self.name..'[tolua_index]')
-  end
-  local t = isbasic(self.type)
-  output(' = ')
-  if not t and ptr=='' then output('*') end
-  output('((',self.mod,self.type)
-  if not t then
-   output('*')
-  end
-  output(') ')
-  local def = 0
-  if self.def ~= '' then def = self.def end
-  if t then
-   output('tolua_to'..t,'(tolua_S,3,',def,'));')
-  else
-   output('tolua_tousertype(tolua_S,3,',def,'));')
-  end
-  output(' return 0;')
-  output('}')
-  output('#endif //#ifndef TOLUA_DISABLE\n')
-  output('\n')
- end
-
+    local class = self:inclass()
+
+    -- get function ------------------------------------------------
+    if class then
+        output("/* get function:",self.name," of class ",class," */")
+    else
+        output("/* get function:",self.name," */")
+    end
+    self.cgetname = self:cfuncname("tolua_get")
+    output("#ifndef TOLUA_DISABLE_"..self.cgetname)
+    output("\nstatic int",self.cgetname,"(lua_State* tolua_S)")
+    output("{")
+    output(" int tolua_index;")
+
+    -- declare self, if the case
+    local _,_,static = strfind(self.mod,'^%s*(static)')
+    if class and static==nil then
+        output(' ',self.parent.type,'*','self;')
+        output(' lua_pushstring(tolua_S,".self");')
+        output(' lua_rawget(tolua_S,1);')
+        output(' self = ')
+        output('(',self.parent.type,'*) ')
+        output('lua_touserdata(tolua_S,-1);')
+    elseif static then
+        _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)')
+    end
+
+    -- check index
+    output('#ifndef TOLUA_RELEASE\n')
+    output(' {')
+    output('  tolua_Error tolua_err;')
+    output('  if (!tolua_isnumber(tolua_S,2,0,&tolua_err))')
+    output('   tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err);')
+    output(' }')
+    output('#endif\n')
+    if flags['1'] then -- for compatibility with tolua5 ?
+        output(' tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;')
+    else
+        output(' tolua_index = (int)tolua_tonumber(tolua_S,2,0);')
+    end
+    output('#ifndef TOLUA_RELEASE\n')
+    if self.dim and self.dim ~= '' then
+        output(' if (tolua_index<0 || tolua_index>='..self.dim..')')
+    else
+        output(' if (tolua_index<0)')
+    end
+    output('  tolua_error(tolua_S,"array indexing out of range.",NULL);')
+    output('#endif\n')
+
+    -- return value
+    local t,ct = isbasic(self.type)
+    if t then
+        output(' tolua_push'..t..'(tolua_S,(',ct,')'..self:getvalue(class,static)..');')
+    else
+        t = self.type
+        if self.ptr == '&' or self.ptr == '' then
+            output(' tolua_pushusertype(tolua_S,(void*)&'..self:getvalue(class,static)..',"',t,'");')
+        else
+            output(' tolua_pushusertype(tolua_S,(void*)'..self:getvalue(class,static)..',"',t,'");')
+        end
+    end
+    output(' return 1;')
+    output('}')
+    output('#endif //#ifndef TOLUA_DISABLE\n')
+    output('\n')
+
+    -- set function ------------------------------------------------
+    if not strfind(self.type,'const') then
+        if class then
+            output("/* set function:",self.name," of class ",class," */")
+        else
+            output("/* set function:",self.name," */")
+        end
+        self.csetname = self:cfuncname("tolua_set")
+        output("#ifndef TOLUA_DISABLE_"..self.csetname)
+        output("\nstatic int",self.csetname,"(lua_State* tolua_S)")
+        output("{")
+
+        -- declare index
+        output(' int tolua_index;')
+
+        -- declare self, if the case
+        local _,_,static = strfind(self.mod,'^%s*(static)')
+        if class and static==nil then
+            output(' ',self.parent.type,'*','self;')
+            output(' lua_pushstring(tolua_S,".self");')
+            output(' lua_rawget(tolua_S,1);')
+            output(' self = ')
+            output('(',self.parent.type,'*) ')
+            output('lua_touserdata(tolua_S,-1);')
+        elseif static then
+            _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)')
+        end
+
+        -- check index
+        output('#ifndef TOLUA_RELEASE\n')
+        output(' {')
+        output('  tolua_Error tolua_err;')
+        output('  if (!tolua_isnumber(tolua_S,2,0,&tolua_err))')
+        output('   tolua_error(tolua_S,"#vinvalid type in array indexing.",&tolua_err);')
+        output(' }')
+        output('#endif\n')
+
+        if flags['1'] then -- for compatibility with tolua5 ?
+            output(' tolua_index = (int)tolua_tonumber(tolua_S,2,0)-1;')
+        else
+            output(' tolua_index = (int)tolua_tonumber(tolua_S,2,0);')
+        end
+
+        output('#ifndef TOLUA_RELEASE\n')
+        if self.dim and self.dim ~= '' then
+            output(' if (tolua_index<0 || tolua_index>='..self.dim..')')
+        else
+            output(' if (tolua_index<0)')
+        end
+        output('  tolua_error(tolua_S,"array indexing out of range.",NULL);')
+        output('#endif\n')
+
+        -- assign value
+        local ptr = ''
+        if self.ptr~='' then ptr = '*' end
+            output(' ')
+        if class and static then
+            output(class..'::'..self.name..'[tolua_index]')
+        elseif class then
+            output('self->'..self.name..'[tolua_index]')
+        else
+            output(self.name..'[tolua_index]')
+        end
+        local t = isbasic(self.type)
+        output(' = ')
+        if not t and ptr=='' then output('*') end
+        output('((',self.mod,self.type)
+        if not t then
+            output('*')
+        end
+        output(') ')
+        local def = 0
+        if self.def ~= '' then def = self.def end
+        if t then
+            output('tolua_to'..t,'(tolua_S,3,',def,'));')
+        else
+            output('tolua_tousertype(tolua_S,3,',def,'));')
+        end
+        output(' return 0;')
+        output('}')
+        output('#endif //#ifndef TOLUA_DISABLE\n')
+        output('\n')
+    end
 end
 
 function classArray:register (pre)
- pre = pre or ''
- if self.csetname then
-  output(pre..'tolua_array(tolua_S,"'..self.lname..'",'..self.cgetname..','..self.csetname..');')
- else
-  output(pre..'tolua_array(tolua_S,"'..self.lname..'",'..self.cgetname..',NULL);')
- end
+    pre = pre or ''
+    if self.csetname then
+        output(pre..'tolua_array(tolua_S,"'..self.lname..'",'..self.cgetname..','..self.csetname..');')
+    else
+        output(pre..'tolua_array(tolua_S,"'..self.lname..'",'..self.cgetname..',NULL);')
+    end
 end
 
 -- Internal constructor
 function _Array (t)
- setmetatable(t,classArray)
- append(t)
- return t
+    setmetatable(t,classArray)
+    append(t)
+    return t
 end
 
@@ -222,6 +221,6 @@
 -- Expects a string representing the variable declaration.
 function Array (s)
- return _Array (Declaration(s,'var'))
-end
-
-
+    return _Array (Declaration(s,'var'))
+end
+
+
Index: /code/branches/buildsystem3/src/tolua/lua/basic.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/basic.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/basic.lua	(revision 2664)
@@ -16,31 +16,31 @@
 -- and all occurrences of "void*" will be replaced by "_userdata"
 _basic = {
- ['void'] = '',
- ['char'] = 'number',
- ['int'] = 'number',
- ['short'] = 'number',
- ['long'] = 'number',
- ['unsigned'] = 'number',
- ['float'] = 'number',
- ['double'] = 'number',
- ['_cstring'] = 'string',
- ['_userdata'] = 'userdata',
- ['char*'] = 'string',
- ['void*'] = 'userdata',
- ['bool'] = 'boolean',
- ['lua_Object'] = 'value',
- ['LUA_VALUE'] = 'value',    -- for compatibility with tolua 4.0
- ['lua_State*'] = 'state',
- ['_lstate'] = 'state',
- ['lua_Function'] = 'value',
+    ['void'] = '',
+    ['char'] = 'number',
+    ['int'] = 'number',
+    ['short'] = 'number',
+    ['long'] = 'number',
+    ['unsigned'] = 'number',
+    ['float'] = 'number',
+    ['double'] = 'number',
+    ['_cstring'] = 'string',
+    ['_userdata'] = 'userdata',
+    ['char*'] = 'string',
+    ['void*'] = 'userdata',
+    ['bool'] = 'boolean',
+    ['lua_Object'] = 'value',
+    ['LUA_VALUE'] = 'value',    -- for compatibility with tolua 4.0
+    ['lua_State*'] = 'state',
+    ['_lstate'] = 'state',
+    ['lua_Function'] = 'value',
 }
 
 _basic_ctype = {
- number = "lua_Number",
- string = "const char*",
- userdata = "void*",
- boolean = "bool",
- value = "int",
- state = "lua_State*",
+    number = "lua_Number",
+    string = "const char*",
+    userdata = "void*",
+    boolean = "bool",
+    value = "int",
+    state = "lua_State*",
 }
 
@@ -68,107 +68,107 @@
 _renaming = {}
 function appendrenaming (s)
- local b,e,old,new = strfind(s,"%s*(.-)%s*@%s*(.-)%s*$")
-	if not b then
-	 error("#Invalid renaming syntax; it should be of the form: pattern@pattern")
-	end
-	tinsert(_renaming,{old=old, new=new})
+    local b,e,old,new = strfind(s,"%s*(.-)%s*@%s*(.-)%s*$")
+    if not b then
+        error("#Invalid renaming syntax; it should be of the form: pattern@pattern")
+    end
+    tinsert(_renaming,{old=old, new=new})
 end
 
 function applyrenaming (s)
-	for i=1,getn(_renaming) do
-	 local m,n = gsub(s,_renaming[i].old,_renaming[i].new)
-		if n ~= 0 then
-		 return m
-		end
-	end
-	return nil
+    for i=1,getn(_renaming) do
+        local m,n = gsub(s,_renaming[i].old,_renaming[i].new)
+        if n ~= 0 then
+            return m
+        end
+    end
+    return nil
 end
 
 -- Error handler
 function tolua_error (s,f)
-if _curr_code then
-	print("***curr code for error is "..tostring(_curr_code))
-	print(debug.traceback())
-end
- local out = _OUTPUT
- _OUTPUT = _STDERR
- if strsub(s,1,1) == '#' then
-  write("\n** tolua: "..strsub(s,2)..".\n\n")
-  if _curr_code then
-   local _,_,s = strfind(_curr_code,"^%s*(.-\n)") -- extract first line
-   if s==nil then s = _curr_code end
-   s = gsub(s,"_userdata","void*") -- return with 'void*'
-   s = gsub(s,"_cstring","char*")  -- return with 'char*'
-   s = gsub(s,"_lstate","lua_State*")  -- return with 'lua_State*'
-   write("Code being processed:\n"..s.."\n")
-  end
- else
- if not f then f = "(f is nil)" end
-  print("\n** tolua internal error: "..f..s..".\n\n")
-  return
- end
- _OUTPUT = out
+    if _curr_code then
+        print("***curr code for error is "..tostring(_curr_code))
+        print(debug.traceback())
+    end
+    local out = _OUTPUT
+    _OUTPUT = _STDERR
+    if strsub(s,1,1) == '#' then
+        write("\n** tolua: "..strsub(s,2)..".\n\n")
+        if _curr_code then
+            local _,_,s = strfind(_curr_code,"^%s*(.-\n)") -- extract first line
+            if s==nil then s = _curr_code end
+            s = gsub(s,"_userdata","void*") -- return with 'void*'
+            s = gsub(s,"_cstring","char*")  -- return with 'char*'
+            s = gsub(s,"_lstate","lua_State*")  -- return with 'lua_State*'
+            write("Code being processed:\n"..s.."\n")
+        end
+    else
+        if not f then f = "(f is nil)" end
+        print("\n** tolua internal error: "..f..s..".\n\n")
+        return
+    end
+    _OUTPUT = out
 end
 
 function warning (msg)
- local out = _OUTPUT
- _OUTPUT = _STDERR
- write("\n** tolua warning: "..msg..".\n\n")
- _OUTPUT = out
+    local out = _OUTPUT
+    _OUTPUT = _STDERR
+    write("\n** tolua warning: "..msg..".\n\n")
+    _OUTPUT = out
 end
 
 -- register an user defined type: returns full type
 function regtype (t)
-	--if isbasic(t) then
-	--	return t
-	--end
-	local ft = findtype(t)
-
-	if not _usertype[ft] then
-		return appendusertype(t)
-	end
-	return ft
+    --if isbasic(t) then
+    --    return t
+    --end
+    local ft = findtype(t)
+
+    if not _usertype[ft] then
+        return appendusertype(t)
+    end
+    return ft
 end
 
 -- return type name: returns full type
 function typevar(type)
-	if type == '' or type == 'void' then
-		return type
-	else
-		local ft = findtype(type)
-		if ft then
-			return ft
-		end
-		_usertype[type] = type
-		return type
-	end
+    if type == '' or type == 'void' then
+        return type
+    else
+        local ft = findtype(type)
+        if ft then
+            return ft
+        end
+        _usertype[type] = type
+        return type
+    end
 end
 
 -- check if basic type
 function isbasic (type)
- local t = gsub(type,'const ','')
- local m,t = applytypedef('', t)
- local b = _basic[t]
- if b then
-  return b,_basic_ctype[b]
- end
- return nil
+    local t = gsub(type,'const ','')
+    local m,t = applytypedef('', t)
+    local b = _basic[t]
+    if b then
+        return b,_basic_ctype[b]
+    end
+    return nil
 end
 
 -- split string using a token
 function split (s,t)
- local l = {n=0}
- local f = function (s)
-  l.n = l.n + 1
-  l[l.n] = s
-  return ""
- end
- local p = "%s*(.-)%s*"..t.."%s*"
- s = gsub(s,"^%s+","")
- s = gsub(s,"%s+$","")
- s = gsub(s,p,f)
- l.n = l.n + 1
- l[l.n] = gsub(s,"(%s%s*)$","")
- return l
+    local l = {n=0}
+    local f = function (s)
+        l.n = l.n + 1
+        l[l.n] = s
+        return ""
+    end
+    local p = "%s*(.-)%s*"..t.."%s*"
+    s = gsub(s,"^%s+","")
+    s = gsub(s,"%s+$","")
+    s = gsub(s,p,f)
+    l.n = l.n + 1
+    l[l.n] = gsub(s,"(%s%s*)$","")
+    return l
 end
 
@@ -178,59 +178,59 @@
 function split_c_tokens(s, pat)
 
-	s = string.gsub(s, "^%s*", "")
-	s = string.gsub(s, "%s*$", "")
-
-	local token_begin = 1
-	local token_end = 1
-	local ofs = 1
-	local ret = {n=0}
-
-	function add_token(ofs)
-
-		local t = string.sub(s, token_begin, ofs)
-		t = string.gsub(t, "^%s*", "")
-		t = string.gsub(t, "%s*$", "")
-		ret.n = ret.n + 1
-		ret[ret.n] = t
-	end
-
-	while ofs <= string.len(s) do
-
-		local sub = string.sub(s, ofs, -1)
-		local b,e = string.find(sub, "^"..pat)
-		if b then
-			add_token(ofs-1)
-			ofs = ofs+e
-			token_begin = ofs
-		else
-			local char = string.sub(s, ofs, ofs)
-			if char == "(" or char == "<" then
-
-				local block
-				if char == "(" then block = "^%b()" end
-				if char == "<" then block = "^%b<>" end
-
-				b,e = string.find(sub, block)
-				if not b then
-					-- unterminated block?
-					ofs = ofs+1
-				else
-					ofs = ofs + e
-				end
-
-			else
-				ofs = ofs+1
-			end
-		end
-
-	end
-	add_token(ofs)
-	--if ret.n == 0 then
-
-	--	ret.n=1
-	--	ret[1] = ""
-	--end
-
-	return ret
+    s = string.gsub(s, "^%s*", "")
+    s = string.gsub(s, "%s*$", "")
+
+    local token_begin = 1
+    local token_end = 1
+    local ofs = 1
+    local ret = {n=0}
+
+    function add_token(ofs)
+
+        local t = string.sub(s, token_begin, ofs)
+        t = string.gsub(t, "^%s*", "")
+        t = string.gsub(t, "%s*$", "")
+        ret.n = ret.n + 1
+        ret[ret.n] = t
+    end
+
+    while ofs <= string.len(s) do
+
+        local sub = string.sub(s, ofs, -1)
+        local b,e = string.find(sub, "^"..pat)
+        if b then
+            add_token(ofs-1)
+            ofs = ofs+e
+            token_begin = ofs
+        else
+            local char = string.sub(s, ofs, ofs)
+            if char == "(" or char == "<" then
+
+                local block
+                if char == "(" then block = "^%b()" end
+                if char == "<" then block = "^%b<>" end
+
+                b,e = string.find(sub, block)
+                if not b then
+                    -- unterminated block?
+                    ofs = ofs+1
+                else
+                    ofs = ofs + e
+                end
+
+            else
+                ofs = ofs+1
+            end
+        end
+
+    end
+    add_token(ofs)
+    --if ret.n == 0 then
+
+    --    ret.n=1
+    --    ret[1] = ""
+    --end
+
+    return ret
 
 end
@@ -238,73 +238,73 @@
 -- concatenate strings of a table
 function concat (t,f,l,jstr)
-	jstr = jstr or " "
- local s = ''
- local i=f
- while i<=l do
-  s = s..t[i]
-  i = i+1
-  if i <= l then s = s..jstr end
- end
- return s
+    jstr = jstr or " "
+    local s = ''
+    local i=f
+    while i<=l do
+        s = s..t[i]
+        i = i+1
+        if i <= l then s = s..jstr end
+    end
+    return s
 end
 
 -- concatenate all parameters, following output rules
 function concatparam (line, ...)
- local i=1
- while i<=arg.n do
-  if _cont and not strfind(_cont,'[%(,"]') and
-     strfind(arg[i],"^[%a_~]") then
-	    line = line .. ' '
-  end
-  line = line .. arg[i]
-  if arg[i] ~= '' then
-   _cont = strsub(arg[i],-1,-1)
-  end
-  i = i+1
- end
- if strfind(arg[arg.n],"[%/%)%;%{%}]$") then
-  _cont=nil line = line .. '\n'
- end
-	return line
+    local i=1
+    while i<=arg.n do
+        if _cont and not strfind(_cont,'[%(,"]') and
+            strfind(arg[i],"^[%a_~]") then
+            line = line .. ' '
+        end
+        line = line .. arg[i]
+        if arg[i] ~= '' then
+            _cont = strsub(arg[i],-1,-1)
+        end
+        i = i+1
+    end
+    if strfind(arg[arg.n],"[%/%)%;%{%}]$") then
+        _cont=nil line = line .. '\n'
+    end
+    return line
 end
 
 -- output line
 function output (...)
- local i=1
- while i<=arg.n do
-  if _cont and not strfind(_cont,'[%(,"]') and
-     strfind(arg[i],"^[%a_~]") then
-	    write(' ')
-  end
-  write(arg[i])
-  if arg[i] ~= '' then
-   _cont = strsub(arg[i],-1,-1)
-  end
-  i = i+1
- end
- if strfind(arg[arg.n],"[%/%)%;%{%}]$") then
-  _cont=nil write('\n')
- end
+    local i=1
+    while i<=arg.n do
+        if _cont and not strfind(_cont,'[%(,"]') and
+            strfind(arg[i],"^[%a_~]") then
+            write(' ')
+        end
+        write(arg[i])
+        if arg[i] ~= '' then
+            _cont = strsub(arg[i],-1,-1)
+        end
+        i = i+1
+    end
+    if strfind(arg[arg.n],"[%/%)%;%{%}]$") then
+        _cont=nil write('\n')
+    end
 end
 
 function get_property_methods(ptype, name)
 
-	if get_property_methods_hook and get_property_methods_hook(ptype,name) then
-		return get_property_methods_hook(ptype, name)
-	end
-
-	if ptype == "default" then -- get_name, set_name
-		return "get_"..name, "set_"..name
-	end
-
-	if ptype == "qt" then -- name, setName
-		return name, "set"..string.upper(string.sub(name, 1, 1))..string.sub(name, 2, -1)
-	end
-
-	if ptype == "overload" then -- name, name
-		return name,name
-	end
-
-	return nil
+    if get_property_methods_hook and get_property_methods_hook(ptype,name) then
+        return get_property_methods_hook(ptype, name)
+    end
+
+    if ptype == "default" then -- get_name, set_name
+        return "get_"..name, "set_"..name
+    end
+
+    if ptype == "qt" then -- name, setName
+        return name, "set"..string.upper(string.sub(name, 1, 1))..string.sub(name, 2, -1)
+    end
+
+    if ptype == "overload" then -- name, name
+        return name,name
+    end
+
+    return nil
 end
 
@@ -315,5 +315,5 @@
 -- takes the package object as the parameter
 function preprocess_hook(p)
-	-- p.code has all the input code from the pkg
+    -- p.code has all the input code from the pkg
 end
 
@@ -351,6 +351,6 @@
 function parser_hook(s)
 
-	return nil
-end
-
-
+    return nil
+end
+
+
Index: /code/branches/buildsystem3/src/tolua/lua/class.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/class.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/class.lua	(revision 2664)
@@ -18,10 +18,10 @@
 --    {i}  = list of members
 classClass = {
- classtype = 'class',
- name = '',
- base = '',
- type = '',
- btype = '',
- ctype = '',
+    classtype = 'class',
+    name = '',
+    base = '',
+    type = '',
+    btype = '',
+    ctype = '',
 }
 classClass.__index = classClass
@@ -31,75 +31,75 @@
 -- register class
 function classClass:register (pre)
-	if not self:check_public_access() then
-		return
-	end
-
- pre = pre or ''
- push(self)
-	if _collect[self.type] then
-		output(pre,'#ifdef __cplusplus\n')
-  output(pre..'tolua_cclass(tolua_S,"'..self.lname..'","'..self.type..'","'..self.btype..'",'.._collect[self.type]..');')
-		output(pre,'#else\n')
-  output(pre..'tolua_cclass(tolua_S,"'..self.lname..'","'..self.type..'","'..self.btype..'",NULL);')
-		output(pre,'#endif\n')
-	else
-  output(pre..'tolua_cclass(tolua_S,"'..self.lname..'","'..self.type..'","'..self.btype..'",NULL);')
-	end
-	if self.extra_bases then
-		for k,base in ipairs(self.extra_bases) do
-			-- not now
-   --output(pre..' tolua_addbase(tolua_S, "'..self.type..'", "'..base..'");')
-		end
-	end
- output(pre..'tolua_beginmodule(tolua_S,"'..self.lname..'");')
- local i=1
- while self[i] do
-  self[i]:register(pre..' ')
-  i = i+1
- end
- output(pre..'tolua_endmodule(tolua_S);')
-	pop()
+    if not self:check_public_access() then
+        return
+    end
+
+    pre = pre or ''
+    push(self)
+    if _collect[self.type] then
+        output(pre,'#ifdef __cplusplus\n')
+        output(pre..'tolua_cclass(tolua_S,"'..self.lname..'","'..self.type..'","'..self.btype..'",'.._collect[self.type]..');')
+        output(pre,'#else\n')
+        output(pre..'tolua_cclass(tolua_S,"'..self.lname..'","'..self.type..'","'..self.btype..'",NULL);')
+        output(pre,'#endif\n')
+    else
+        output(pre..'tolua_cclass(tolua_S,"'..self.lname..'","'..self.type..'","'..self.btype..'",NULL);')
+    end
+    if self.extra_bases then
+        for k,base in ipairs(self.extra_bases) do
+            -- not now
+            --output(pre..' tolua_addbase(tolua_S, "'..self.type..'", "'..base..'");')
+        end
+    end
+    output(pre..'tolua_beginmodule(tolua_S,"'..self.lname..'");')
+    local i=1
+    while self[i] do
+        self[i]:register(pre..' ')
+        i = i+1
+    end
+    output(pre..'tolua_endmodule(tolua_S);')
+    pop()
 end
 
 -- return collection requirement
 function classClass:requirecollection (t)
-	if self.flags.protected_destructor then
-		return false
-	end
- push(self)
-	local r = false
- local i=1
- while self[i] do
-  r = self[i]:requirecollection(t) or r
-  i = i+1
- end
-	pop()
-	-- only class that exports destructor can be appropriately collected
-	-- classes that export constructors need to have a collector (overrided by -D flag on command line)
-	if self._delete or ((not flags['D']) and self._new) then
-		--t[self.type] = "tolua_collect_" .. gsub(self.type,"::","_")
-		t[self.type] = "tolua_collect_" .. clean_template(self.type)
-		r = true
-	end
- return r
+    if self.flags.protected_destructor then
+        return false
+    end
+    push(self)
+    local r = false
+    local i=1
+    while self[i] do
+        r = self[i]:requirecollection(t) or r
+        i = i+1
+    end
+    pop()
+    -- only class that exports destructor can be appropriately collected
+    -- classes that export constructors need to have a collector (overrided by -D flag on command line)
+    if self._delete or ((not flags['D']) and self._new) then
+        --t[self.type] = "tolua_collect_" .. gsub(self.type,"::","_")
+        t[self.type] = "tolua_collect_" .. clean_template(self.type)
+        r = true
+    end
+    return r
 end
 
 -- output tags
 function classClass:decltype ()
- push(self)
-	self.type = regtype(self.original_name or self.name)
-	self.btype = typevar(self.base)
-	self.ctype = 'const '..self.type
-	if self.extra_bases then
-		for i=1,table.getn(self.extra_bases) do
-			self.extra_bases[i] = typevar(self.extra_bases[i])
-		end
-	end
- local i=1
- while self[i] do
-  self[i]:decltype()
-  i = i+1
- end
-	pop()
+    push(self)
+    self.type = regtype(self.original_name or self.name)
+    self.btype = typevar(self.base)
+    self.ctype = 'const '..self.type
+    if self.extra_bases then
+        for i=1,table.getn(self.extra_bases) do
+            self.extra_bases[i] = typevar(self.extra_bases[i])
+        end
+    end
+    local i=1
+    while self[i] do
+        self[i]:decltype()
+        i = i+1
+    end
+    pop()
 end
 
@@ -107,29 +107,29 @@
 -- Print method
 function classClass:print (ident,close)
- print(ident.."Class{")
- print(ident.." name = '"..self.name.."',")
- print(ident.." base = '"..self.base.."';")
- print(ident.." lname = '"..self.lname.."',")
- print(ident.." type = '"..self.type.."',")
- print(ident.." btype = '"..self.btype.."',")
- print(ident.." ctype = '"..self.ctype.."',")
- local i=1
- while self[i] do
-  self[i]:print(ident.." ",",")
-  i = i+1
- end
- print(ident.."}"..close)
+    print(ident.."Class{")
+    print(ident.." name = '"..self.name.."',")
+    print(ident.." base = '"..self.base.."';")
+    print(ident.." lname = '"..self.lname.."',")
+    print(ident.." type = '"..self.type.."',")
+    print(ident.." btype = '"..self.btype.."',")
+    print(ident.." ctype = '"..self.ctype.."',")
+    local i=1
+    while self[i] do
+        self[i]:print(ident.." ",",")
+        i = i+1
+    end
+    print(ident.."}"..close)
 end
 
 function classClass:set_protected_destructor(p)
-	self.flags.protected_destructor = self.flags.protected_destructor or p
+self.flags.protected_destructor = self.flags.protected_destructor or p
 end
 
 -- Internal constructor
 function _Class (t)
- setmetatable(t,classClass)
- t:buildnames()
- append(t)
- return t
+    setmetatable(t,classClass)
+    t:buildnames()
+    append(t)
+    return t
 end
 
@@ -138,83 +138,83 @@
 function Class (n,p,b)
 
-	if table.getn(p) > 1 then
-		b = string.sub(b, 1, -2)
-		for i=2,table.getn(p),1 do
-			b = b.."\n tolua_inherits "..p[i].." __"..p[i].."__;\n"
-		end
-		b = b.."\n}"
-	end
-
-	-- check for template
-	b = string.gsub(b, "^{%s*TEMPLATE_BIND", "{\nTOLUA_TEMPLATE_BIND")
-	local t,_,T,I = string.find(b, "^{%s*TOLUA_TEMPLATE_BIND%s*%(+%s*\"?([^\",]*)\"?%s*,%s*([^%)]*)%s*%)+")
-	if t then
-
-		-- remove quotes
-		I = string.gsub(I, "\"", "")
-		T = string.gsub(T, "\"", "")
-		-- get type list
-		local types = split_c_tokens(I, ",")
-		-- remove TEMPLATE_BIND line
-		local bs = string.gsub(b, "^{%s*TOLUA_TEMPLATE_BIND[^\n]*\n", "{\n")
-
-		-- replace
-		for i =1 , types.n do
-
-			local Tl = split(T, " ")
-			local Il = split_c_tokens(types[i], " ")
-			local bI = bs
-			local pI = {}
-			for j = 1,Tl.n do
-				Tl[j] = findtype(Tl[j]) or Tl[j]
-				bI = string.gsub(bI, "([^_%w])"..Tl[j].."([^_%w])", "%1"..Il[j].."%2")
-				if p then
-					for i=1,table.getn(p) do
-						pI[i] = string.gsub(p[i], "([^_%w]?)"..Tl[j].."([^_%w]?)", "%1"..Il[j].."%2")
-					end
-				end
-			end
-			--local append = "<"..string.gsub(types[i], "%s+", ",")..">"
-			local append = "<"..concat(Il, 1, table.getn(Il), ",")..">"
-			append = string.gsub(append, "%s*,%s*", ",")
-			append = string.gsub(append, ">>", "> >")
-			for i=1,table.getn(pI) do
-				--pI[i] = string.gsub(pI[i], ">>", "> >")
-				pI[i] = resolve_template_types(pI[i])
-			end
-			bI = string.gsub(bI, ">>", "> >")
-			Class(n..append, pI, bI)
-		end
-		return
-	end
-
-	local mbase
-
-	if p then
-		mbase = table.remove(p, 1)
-		if not p[1] then p = nil end
-	end
-
-	mbase = mbase and resolve_template_types(mbase)
-
-	local c
-	local oname = string.gsub(n, "@.*$", "")
-	oname = getnamespace(classContainer.curr)..oname
-
-	if _global_classes[oname] then
-		c = _global_classes[oname]
-		if mbase and ((not c.base) or c.base == "") then
-			c.base = mbase
-		end
-	else
-		c = _Class(_Container{name=n, base=mbase, extra_bases=p})
-
-		local ft = getnamespace(c.parent)..c.original_name
-		append_global_type(ft, c)
-	end
-
-	push(c)
-	c:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces
-	pop()
-end
-
+    if table.getn(p) > 1 then
+        b = string.sub(b, 1, -2)
+        for i=2,table.getn(p),1 do
+            b = b.."\n tolua_inherits "..p[i].." __"..p[i].."__;\n"
+        end
+        b = b.."\n}"
+    end
+
+    -- check for template
+    b = string.gsub(b, "^{%s*TEMPLATE_BIND", "{\nTOLUA_TEMPLATE_BIND")
+    local t,_,T,I = string.find(b, "^{%s*TOLUA_TEMPLATE_BIND%s*%(+%s*\"?([^\",]*)\"?%s*,%s*([^%)]*)%s*%)+")
+    if t then
+
+        -- remove quotes
+        I = string.gsub(I, "\"", "")
+        T = string.gsub(T, "\"", "")
+        -- get type list
+        local types = split_c_tokens(I, ",")
+        -- remove TEMPLATE_BIND line
+        local bs = string.gsub(b, "^{%s*TOLUA_TEMPLATE_BIND[^\n]*\n", "{\n")
+
+        -- replace
+        for i =1 , types.n do
+
+            local Tl = split(T, " ")
+            local Il = split_c_tokens(types[i], " ")
+            local bI = bs
+            local pI = {}
+            for j = 1,Tl.n do
+                Tl[j] = findtype(Tl[j]) or Tl[j]
+                bI = string.gsub(bI, "([^_%w])"..Tl[j].."([^_%w])", "%1"..Il[j].."%2")
+                if p then
+                    for i=1,table.getn(p) do
+                        pI[i] = string.gsub(p[i], "([^_%w]?)"..Tl[j].."([^_%w]?)", "%1"..Il[j].."%2")
+                    end
+                end
+            end
+            --local append = "<"..string.gsub(types[i], "%s+", ",")..">"
+            local append = "<"..concat(Il, 1, table.getn(Il), ",")..">"
+            append = string.gsub(append, "%s*,%s*", ",")
+            append = string.gsub(append, ">>", "> >")
+            for i=1,table.getn(pI) do
+                --pI[i] = string.gsub(pI[i], ">>", "> >")
+                pI[i] = resolve_template_types(pI[i])
+            end
+            bI = string.gsub(bI, ">>", "> >")
+            Class(n..append, pI, bI)
+        end
+        return
+    end
+
+    local mbase
+
+    if p then
+        mbase = table.remove(p, 1)
+        if not p[1] then p = nil end
+    end
+
+    mbase = mbase and resolve_template_types(mbase)
+
+    local c
+    local oname = string.gsub(n, "@.*$", "")
+    oname = getnamespace(classContainer.curr)..oname
+
+    if _global_classes[oname] then
+        c = _global_classes[oname]
+        if mbase and ((not c.base) or c.base == "") then
+            c.base = mbase
+        end
+    else
+        c = _Class(_Container{name=n, base=mbase, extra_bases=p})
+
+        local ft = getnamespace(c.parent)..c.original_name
+        append_global_type(ft, c)
+    end
+
+    push(c)
+    c:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces
+    pop()
+end
+
Index: /code/branches/buildsystem3/src/tolua/lua/clean.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/clean.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/clean.lua	(revision 2664)
@@ -10,70 +10,70 @@
 
 MASK = { -- the substitution order is important
- {ESC1, "\\'"},
- {ESC2, '\\"'},
- {STR1, "'"},
- {STR2, '"'},
- {STR3, "%[%["},
- {STR4, "%]%]"},
- {REM , "%-%-"},
+    {ESC1, "\\'"},
+    {ESC2, '\\"'},
+    {STR1, "'"},
+    {STR2, '"'},
+    {STR3, "%[%["},
+    {STR4, "%]%]"},
+    {REM , "%-%-"},
 }
 
 function mask (s)
- for i = 1,getn(MASK)  do
-  s = gsub(s,MASK[i][2],MASK[i][1])
- end
- return s
+    for i = 1,getn(MASK)  do
+        s = gsub(s,MASK[i][2],MASK[i][1])
+    end
+    return s
 end
 
 function unmask (s)
- for i = 1,getn(MASK)  do
-  s = gsub(s,MASK[i][1],MASK[i][2])
- end
- return s
+    for i = 1,getn(MASK)  do
+        s = gsub(s,MASK[i][1],MASK[i][2])
+    end
+    return s
 end
 
 function clean (s)
- -- check for compilation error
- local code = "return function ()\n" .. s .. "\n end"
- if not dostring(code) then
-  return nil
- end
+    -- check for compilation error
+    local code = "return function ()\n" .. s .. "\n end"
+    if not dostring(code) then
+        return nil
+    end
 
- if flags['C'] then
- 	return s
- end
+    if flags['C'] then
+        return s
+    end
 
- local S = "" -- saved string
+    local S = "" -- saved string
 
- s = mask(s)
+    s = mask(s)
 
- -- remove blanks and comments
- while 1 do
-  local b,e,d = strfind(s,ANY)
-  if b then
-   S = S..strsub(s,1,b-1)
-   s = strsub(s,b+1)
-   if d==STR1 or d==STR2 then
-    e = strfind(s,d)
-    S = S ..d..strsub(s,1,e)
-    s = strsub(s,e+1)
-   elseif d==STR3 then
-    e = strfind(s,STR4)
-    S = S..d..strsub(s,1,e)
-    s = strsub(s,e+1)
-   elseif d==REM then
-    s = gsub(s,"[^\n]*(\n?)","%1",1)
-   end
-  else
-   S = S..s
-   break
-  end
- end
- -- eliminate unecessary spaces
- S = gsub(S,"[ \t]+"," ")
- S = gsub(S,"[ \t]*\n[ \t]*","\n")
-	S = gsub(S,"\n+","\n")
- S = unmask(S)
- return S
+    -- remove blanks and comments
+    while 1 do
+        local b,e,d = strfind(s,ANY)
+        if b then
+            S = S..strsub(s,1,b-1)
+            s = strsub(s,b+1)
+            if d==STR1 or d==STR2 then
+                e = strfind(s,d)
+                S = S ..d..strsub(s,1,e)
+                s = strsub(s,e+1)
+            elseif d==STR3 then
+                e = strfind(s,STR4)
+                S = S..d..strsub(s,1,e)
+                s = strsub(s,e+1)
+            elseif d==REM then
+                s = gsub(s,"[^\n]*(\n?)","%1",1)
+            end
+        else
+            S = S..s
+            break
+        end
+    end
+    -- eliminate unecessary spaces
+    S = gsub(S,"[ \t]+"," ")
+    S = gsub(S,"[ \t]*\n[ \t]*","\n")
+    S = gsub(S,"\n+","\n")
+    S = unmask(S)
+    return S
 end
 
Index: /code/branches/buildsystem3/src/tolua/lua/code.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/code.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/code.lua	(revision 2664)
@@ -19,5 +19,5 @@
 --   text = text code
 classCode = {
- text = '',
+    text = '',
 }
 classCode.__index = classCode
@@ -26,46 +26,50 @@
 -- register code
 function classCode:register (pre)
- pre = pre or ''
- -- clean Lua code
- local s = clean(self.text)
- if not s then
-  --print(self.text)
-  error("parser error in embedded code")
- end
+    pre = pre or ''
+    -- clean Lua code
+    local s = clean(self.text)
+    if not s then
+        --print(self.text)
+        error("parser error in embedded code")
+    end
 
- -- get first line
- local _, _, first_line=string.find(self.text, "^([^\n\r]*)")
- if string.find(first_line, "^%s*%-%-") then
-	 if string.find(first_line, "^%-%-##") then
-		first_line = string.gsub(first_line, "^%-%-##", "")
-		if flags['C'] then
-			s = string.gsub(s, "^%-%-##[^\n\r]*\n", "")
-		end
-	 end
- else
- 	first_line = ""
- end
+    -- get first line
+    local _, _, first_line=string.find(self.text, "^([^\n\r]*)")
+    if string.find(first_line, "^%s*%-%-") then
+        if string.find(first_line, "^%-%-##") then
+            first_line = string.gsub(first_line, "^%-%-##", "")
+            if flags['C'] then
+                s = string.gsub(s, "^%-%-##[^\n\r]*\n", "")
+            end
+        end
+    else
+        first_line = ""
+    end
 
- -- convert to C
- output('\n'..pre..'{ /* begin embedded lua code */\n')
- output(pre..' int top = lua_gettop(tolua_S);')
- output(pre..' static unsigned char B[] = {\n   ')
- local t={n=0}
- local b = gsub(s,'(.)',function (c)
-                         local e = ''
-                         t.n=t.n+1 if t.n==15 then t.n=0 e='\n'..pre..'  ' end
-                         return format('%3u,%s',strbyte(c),e)
-                        end
-               )
- output(b..strbyte(" "))
- output('\n'..pre..' };\n')
- if first_line and first_line ~= "" then
- 	output(pre..' tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: '..first_line..'");')
- else
- 	output(pre..' tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua: embedded Lua code '..code_n..'");')
- end
- output(pre..' lua_settop(tolua_S, top);')
- output(pre..'} /* end of embedded lua code */\n\n')
- code_n = code_n +1
+    -- convert to C
+    output('\n'..pre..'{ /* begin embedded lua code */\n')
+    output(pre..' int top = lua_gettop(tolua_S);')
+    output(pre..' static unsigned char B[] = {\n   ')
+    local t={n=0}
+    local b = gsub(s, '(.)',
+        function (c)
+            local e = ''
+            t.n=t.n+1
+            if t.n==15 then
+             t.n=0 e='\n'..pre..'  '
+            end
+            return format('%3u,%s',strbyte(c),e)
+        end
+    )
+    output(b..strbyte(" "))
+    output('\n'..pre..' };\n')
+    if first_line and first_line ~= "" then
+        output(pre..' tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: '..first_line..'");')
+    else
+        output(pre..' tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua: embedded Lua code '..code_n..'");')
+    end
+    output(pre..' lua_settop(tolua_S, top);')
+    output(pre..'} /* end of embedded lua code */\n\n')
+    code_n = code_n +1
 end
 
@@ -73,7 +77,7 @@
 -- Print method
 function classCode:print (ident,close)
- print(ident.."Code{")
- print(ident.." text = [["..self.text.."]],")
- print(ident.."}"..close)
+    print(ident.."Code{")
+    print(ident.." text = [["..self.text.."]],")
+    print(ident.."}"..close)
 end
 
@@ -81,7 +85,7 @@
 -- Internal constructor
 function _Code (t)
- setmetatable(t,classCode)
- append(t)
- return t
+    setmetatable(t,classCode)
+    append(t)
+    return t
 end
 
@@ -89,7 +93,7 @@
 -- Expects a string representing the code text
 function Code (l)
- return _Code {
-  text = l
- }
+    return _Code {
+        text = l
+    }
 end
 
Index: /code/branches/buildsystem3/src/tolua/lua/compat-5.1.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/compat-5.1.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/compat-5.1.lua	(revision 2664)
@@ -1,31 +1,30 @@
 if string.find(_VERSION, "5%.0") then
-	return
+    return
 end
 
 -- "loadfile"
 local function pp_dofile(path)
+    local loaded = false
+    local getfile = function()
 
-	local loaded = false
-	local getfile = function()
+        if loaded then
+            return
+        else
+            local file,err = io.open(path)
+            if not file then
+                error("error loading file "..path..": "..err)
+            end
+            local ret = file:read("*a")
+            file:close()
 
-		if loaded then
-			return
-		else
-			local file,err = io.open(path)
-			if not file then
-				error("error loading file "..path..": "..err)
-			end
-			local ret = file:read("*a")
-			file:close()
+            ret = string.gsub(ret, "%.%.%.%s*%)", "...) local arg = {n=select('#', ...), ...};")
 
-			ret = string.gsub(ret, "%.%.%.%s*%)", "...) local arg = {n=select('#', ...), ...};")
+            loaded = true
+            return ret
+        end
+    end
 
-			loaded = true
-			return ret
-		end
-	end
-
-	local f = load(getfile, path)
-	return f()
+    local f = load(getfile, path)
+    return f()
 end
 
@@ -38,9 +37,9 @@
 local ogsub = string.gsub
 local function compgsub(a,b,c,d)
-  if type(c) == "function" then
-    local oc = c
-    c = function (...) return oc(...) or '' end
-  end
-  return ogsub(a,b,c,d)
+    if type(c) == "function" then
+        local oc = c
+        c = function (...) return oc(...) or '' end
+    end
+    return ogsub(a,b,c,d)
 end
 string.repl = ogsub
Index: /code/branches/buildsystem3/src/tolua/lua/compat.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/compat.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/compat.lua	(revision 2664)
@@ -34,9 +34,9 @@
 
 function do_ (f, err)
-  if not f then print(err); return end
-  local a,b = pcall(f)
-  if not a then print(b); return nil
-  else return b or true
-  end
+    if not f then print(err); return end
+    local a,b = pcall(f)
+    if not a then print(b); return nil
+    else return b or true
+    end
 end
 
@@ -141,53 +141,53 @@
 
 function flush (f)
-  if f then f:flush()
-  else _OUTPUT:flush()
-  end
+    if f then f:flush()
+    else _OUTPUT:flush()
+    end
 end
 
 function readfrom (name)
-  if name == nil then
-    local f, err, cod = io.close(_INPUT)
-    _INPUT = io.stdin
-    return f, err, cod
-  else
-    local f, err, cod = io.open(name, "r")
-    _INPUT = f or _INPUT
-    return f, err, cod
-  end
+    if name == nil then
+        local f, err, cod = io.close(_INPUT)
+        _INPUT = io.stdin
+        return f, err, cod
+    else
+        local f, err, cod = io.open(name, "r")
+        _INPUT = f or _INPUT
+        return f, err, cod
+    end
 end
 
 function writeto (name)
-  if name == nil then
-    local f, err, cod = io.close(_OUTPUT)
-    _OUTPUT = io.stdout
-    return f, err, cod
-  else
-    local f, err, cod = io.open(name, "w")
-    _OUTPUT = f or _OUTPUT
-    return f, err, cod
-  end
+    if name == nil then
+        local f, err, cod = io.close(_OUTPUT)
+        _OUTPUT = io.stdout
+        return f, err, cod
+    else
+        local f, err, cod = io.open(name, "w")
+        _OUTPUT = f or _OUTPUT
+        return f, err, cod
+    end
 end
 
 function appendto (name)
-  local f, err, cod = io.open(name, "a")
-  _OUTPUT = f or _OUTPUT
-  return f, err, cod
+    local f, err, cod = io.open(name, "a")
+    _OUTPUT = f or _OUTPUT
+    return f, err, cod
 end
 
 function read (...)
-  local f = _INPUT
-  if rawtype(arg[1]) == 'userdata' then
-    f = tab.remove(arg, 1)
-  end
-  return f:read(unpack(arg))
+    local f = _INPUT
+    if rawtype(arg[1]) == 'userdata' then
+        f = tab.remove(arg, 1)
+    end
+    return f:read(unpack(arg))
 end
 
 function write (...)
-  local f = _OUTPUT
-  if rawtype(arg[1]) == 'userdata' then
-    f = tab.remove(arg, 1)
-  end
-  return f:write(unpack(arg))
+    local f = _OUTPUT
+    if rawtype(arg[1]) == 'userdata' then
+        f = tab.remove(arg, 1)
+    end
+    return f:write(unpack(arg))
 end
 
Index: /code/branches/buildsystem3/src/tolua/lua/container.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/container.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/container.lua	(revision 2664)
@@ -19,5 +19,5 @@
 classContainer =
 {
- curr = nil,
+    curr = nil,
 }
 classContainer.__index = classContainer
@@ -26,11 +26,11 @@
 -- output tags
 function classContainer:decltype ()
- push(self)
- local i=1
- while self[i] do
-  self[i]:decltype()
-  i = i+1
- end
- pop()
+    push(self)
+    local i=1
+    while self[i] do
+        self[i]:decltype()
+        i = i+1
+    end
+    pop()
 end
 
@@ -39,123 +39,123 @@
 function classContainer:supcode ()
 
-	if not self:check_public_access() then
-		return
-	end
-
- push(self)
- local i=1
- while self[i] do
-  if self[i]:check_public_access() then
-  	self[i]:supcode()
-  end
-  i = i+1
- end
- pop()
+    if not self:check_public_access() then
+        return
+    end
+
+    push(self)
+    local i=1
+    while self[i] do
+        if self[i]:check_public_access() then
+            self[i]:supcode()
+        end
+        i = i+1
+    end
+    pop()
 end
 
 function classContainer:hasvar ()
- local i=1
- while self[i] do
-  if self[i]:isvariable() then
-		 return 1
-		end
-  i = i+1
- end
-	return 0
+    local i=1
+    while self[i] do
+        if self[i]:isvariable() then
+            return 1
+        end
+        i = i+1
+    end
+    return 0
 end
 
 -- Internal container constructor
 function _Container (self)
- setmetatable(self,classContainer)
- self.n = 0
- self.typedefs = {tolua_n=0}
- self.usertypes = {}
- self.enums = {tolua_n=0}
- self.lnames = {}
- return self
+    setmetatable(self,classContainer)
+    self.n = 0
+    self.typedefs = {tolua_n=0}
+    self.usertypes = {}
+    self.enums = {tolua_n=0}
+    self.lnames = {}
+    return self
 end
 
 -- push container
 function push (t)
-	t.prox = classContainer.curr
- classContainer.curr = t
+    t.prox = classContainer.curr
+    classContainer.curr = t
 end
 
 -- pop container
 function pop ()
---print("name",classContainer.curr.name)
---foreach(classContainer.curr.usertypes,print)
---print("______________")
- classContainer.curr = classContainer.curr.prox
+    --print("name",classContainer.curr.name)
+    --foreach(classContainer.curr.usertypes,print)
+    --print("______________")
+    classContainer.curr = classContainer.curr.prox
 end
 
 -- get current namespace
 function getcurrnamespace ()
-	return getnamespace(classContainer.curr)
+    return getnamespace(classContainer.curr)
 end
 
 -- append to current container
 function append (t)
- return classContainer.curr:append(t)
+    return classContainer.curr:append(t)
 end
 
 -- append typedef to current container
 function appendtypedef (t)
- return classContainer.curr:appendtypedef(t)
+    return classContainer.curr:appendtypedef(t)
 end
 
 -- append usertype to current container
 function appendusertype (t)
- return classContainer.curr:appendusertype(t)
+    return classContainer.curr:appendusertype(t)
 end
 
 -- append enum to current container
 function appendenum (t)
- return classContainer.curr:appendenum(t)
+    return classContainer.curr:appendenum(t)
 end
 
 -- substitute typedef
 function applytypedef (mod,type)
- return classContainer.curr:applytypedef(mod,type)
+    return classContainer.curr:applytypedef(mod,type)
 end
 
 -- check if is type
 function findtype (type)
- local t = classContainer.curr:findtype(type)
-	return t
+    local t = classContainer.curr:findtype(type)
+    return t
 end
 
 -- check if is typedef
 function istypedef (type)
- return classContainer.curr:istypedef(type)
+    return classContainer.curr:istypedef(type)
 end
 
 -- get fulltype (with namespace)
 function fulltype (t)
- local curr =  classContainer.curr
-	while curr do
-	 if curr then
-		 if curr.typedefs and curr.typedefs[t] then
-		  return curr.typedefs[t]
-		 elseif curr.usertypes and curr.usertypes[t] then
-		  return curr.usertypes[t]
-			end
-		end
-	 curr = curr.prox
-	end
-	return t
+    local curr =  classContainer.curr
+    while curr do
+        if curr then
+            if curr.typedefs and curr.typedefs[t] then
+                return curr.typedefs[t]
+            elseif curr.usertypes and curr.usertypes[t] then
+                return curr.usertypes[t]
+            end
+        end
+        curr = curr.prox
+    end
+    return t
 end
 
 -- checks if it requires collection
 function classContainer:requirecollection (t)
- push(self)
- local i=1
-	local r = false
- while self[i] do
-  r = self[i]:requirecollection(t) or r
-  i = i+1
- end
-	pop()
-	return r
+    push(self)
+    local i=1
+    local r = false
+    while self[i] do
+        r = self[i]:requirecollection(t) or r
+        i = i+1
+    end
+    pop()
+    return r
 end
 
@@ -163,142 +163,141 @@
 -- get namesapce
 function getnamespace (curr)
-	local namespace = ''
-	while curr do
-	 if curr and
-		   ( curr.classtype == 'class' or curr.classtype == 'namespace')
-		then
-		 namespace = (curr.original_name or curr.name) .. '::' .. namespace
-		 --namespace = curr.name .. '::' .. namespace
-		end
-	 curr = curr.prox
-	end
-	return namespace
+    local namespace = ''
+    while curr do
+        if curr and
+            ( curr.classtype == 'class' or curr.classtype == 'namespace')
+        then
+            namespace = (curr.original_name or curr.name) .. '::' .. namespace
+            --namespace = curr.name .. '::' .. namespace
+        end
+        curr = curr.prox
+    end
+    return namespace
 end
 
 -- get namespace (only namespace)
 function getonlynamespace ()
- local curr = classContainer.curr
-	local namespace = ''
-	while curr do
-		if curr.classtype == 'class' then
-		 return namespace
-		elseif curr.classtype == 'namespace' then
-		 namespace = curr.name .. '::' .. namespace
-		end
-	 curr = curr.prox
-	end
-	return namespace
+    local curr = classContainer.curr
+    local namespace = ''
+    while curr do
+        if curr.classtype == 'class' then
+            return namespace
+        elseif curr.classtype == 'namespace' then
+            namespace = curr.name .. '::' .. namespace
+        end
+        curr = curr.prox
+    end
+    return namespace
 end
 
 -- check if is enum
 function isenum (type)
- return classContainer.curr:isenum(type)
+    return classContainer.curr:isenum(type)
 end
 
 -- append feature to container
 function classContainer:append (t)
- self.n = self.n + 1
- self[self.n] = t
- t.parent = self
+    self.n = self.n + 1
+    self[self.n] = t
+    t.parent = self
 end
 
 -- append typedef
 function classContainer:appendtypedef (t)
- local namespace = getnamespace(classContainer.curr)
- self.typedefs.tolua_n = self.typedefs.tolua_n + 1
- self.typedefs[self.typedefs.tolua_n] = t
-	self.typedefs[t.utype] = namespace .. t.utype
-	global_typedefs[namespace..t.utype] = t
-	t.ftype = findtype(t.type) or t.type
-	--print("appending typedef "..t.utype.." as "..namespace..t.utype.." with ftype "..t.ftype)
-	append_global_type(namespace..t.utype)
-	if t.ftype and isenum(t.ftype) then
-
-		global_enums[namespace..t.utype] = true
-	end
+    local namespace = getnamespace(classContainer.curr)
+    self.typedefs.tolua_n = self.typedefs.tolua_n + 1
+    self.typedefs[self.typedefs.tolua_n] = t
+    self.typedefs[t.utype] = namespace .. t.utype
+    global_typedefs[namespace..t.utype] = t
+    t.ftype = findtype(t.type) or t.type
+    --print("appending typedef "..t.utype.." as "..namespace..t.utype.." with ftype "..t.ftype)
+    append_global_type(namespace..t.utype)
+    if t.ftype and isenum(t.ftype) then
+        global_enums[namespace..t.utype] = true
+    end
 end
 
 -- append usertype: return full type
 function classContainer:appendusertype (t)
-	local container
-	if t == (self.original_name or self.name) then
-		container = self.prox
-	else
-		container = self
-	end
-	local ft = getnamespace(container) .. t
-	container.usertypes[t] = ft
-	_usertype[ft] = ft
-	return ft
+    local container
+    if t == (self.original_name or self.name) then
+        container = self.prox
+    else
+        container = self
+    end
+    local ft = getnamespace(container) .. t
+    container.usertypes[t] = ft
+    _usertype[ft] = ft
+    return ft
 end
 
 -- append enum
 function classContainer:appendenum (t)
- local namespace = getnamespace(classContainer.curr)
- self.enums.tolua_n = self.enums.tolua_n + 1
- self.enums[self.enums.tolua_n] = t
-	global_enums[namespace..t.name] = t
+    local namespace = getnamespace(classContainer.curr)
+    self.enums.tolua_n = self.enums.tolua_n + 1
+    self.enums[self.enums.tolua_n] = t
+    global_enums[namespace..t.name] = t
 end
 
 -- determine lua function name overload
 function classContainer:overload (lname)
- if not self.lnames[lname] then
-  self.lnames[lname] = 0
- else
-  self.lnames[lname] = self.lnames[lname] + 1
- end
- return format("%02d",self.lnames[lname])
+    if not self.lnames[lname] then
+        self.lnames[lname] = 0
+    else
+        self.lnames[lname] = self.lnames[lname] + 1
+    end
+    return format("%02d",self.lnames[lname])
 end
 
 -- applies typedef: returns the 'the facto' modifier and type
 function classContainer:applytypedef (mod,type)
-	if global_typedefs[type] then
-		--print("found typedef "..global_typedefs[type].type)
-		local mod1, type1 = global_typedefs[type].mod, global_typedefs[type].ftype
-		local mod2, type2 = applytypedef(mod.." "..mod1, type1)
-		--return mod2 .. ' ' .. mod1, type2
-		return mod2, type2
-	end
-	do return mod,type end
+    if global_typedefs[type] then
+        --print("found typedef "..global_typedefs[type].type)
+        local mod1, type1 = global_typedefs[type].mod, global_typedefs[type].ftype
+        local mod2, type2 = applytypedef(mod.." "..mod1, type1)
+        --return mod2 .. ' ' .. mod1, type2
+        return mod2, type2
+    end
+    do return mod,type end
 end
 
 -- check if it is a typedef
 function classContainer:istypedef (type)
- local env = self
- while env do
-  if env.typedefs then
-   local i=1
-   while env.typedefs[i] do
-    if env.typedefs[i].utype == type then
-         return type
-        end
-        i = i+1
-   end
-  end
-  env = env.parent
- end
- return nil
+    local env = self
+    while env do
+        if env.typedefs then
+            local i=1
+            while env.typedefs[i] do
+                if env.typedefs[i].utype == type then
+                    return type
+                end
+                i = i+1
+            end
+        end
+        env = env.parent
+    end
+    return nil
 end
 
 function find_enum_var(var)
 
-	if tonumber(var) then return var end
-
-	local c = classContainer.curr
-	while c do
-		local ns = getnamespace(c)
-		for k,v in pairs(_global_enums) do
-			if match_type(var, v, ns) then
-				return v
-			end
-		end
-		if c.base and c.base ~= '' then
-			c = _global_classes[c:findtype(c.base)]
-		else
-			c = nil
-		end
-	end
-
-	return var
+    if tonumber(var) then return var end
+
+    local c = classContainer.curr
+    while c do
+        local ns = getnamespace(c)
+        for k,v in pairs(_global_enums) do
+            if match_type(var, v, ns) then
+                return v
+            end
+        end
+        if c.base and c.base ~= '' then
+            c = _global_classes[c:findtype(c.base)]
+        else
+            c = nil
+        end
+    end
+
+    return var
 end
 
@@ -306,108 +305,108 @@
 function classContainer:findtype (t)
 
-	t = string.gsub(t, "=.*", "")
-	if _basic[t] then
-	 return t
-	end
-
-	local _,_,em = string.find(t, "([&%*])%s*$")
-	t = string.gsub(t, "%s*([&%*])%s*$", "")
-	p = self
-	while p and type(p)=='table' do
-		local st = getnamespace(p)
-
-		for i=_global_types.n,1,-1 do -- in reverse order
-
-			if match_type(t, _global_types[i], st) then
-				return _global_types[i]..(em or "")
-			end
-		end
-		if p.base and p.base ~= '' and p.base ~= t then
-			--print("type is "..t..", p is "..p.base.." self.type is "..self.type.." self.name is "..self.name)
-			p = _global_classes[p:findtype(p.base)]
-		else
-			p = nil
-		end
-	end
-
-	return nil
+    t = string.gsub(t, "=.*", "")
+    if _basic[t] then
+     return t
+    end
+
+    local _,_,em = string.find(t, "([&%*])%s*$")
+    t = string.gsub(t, "%s*([&%*])%s*$", "")
+    p = self
+    while p and type(p)=='table' do
+        local st = getnamespace(p)
+
+        for i=_global_types.n,1,-1 do -- in reverse order
+
+            if match_type(t, _global_types[i], st) then
+                return _global_types[i]..(em or "")
+            end
+        end
+        if p.base and p.base ~= '' and p.base ~= t then
+            --print("type is "..t..", p is "..p.base.." self.type is "..self.type.." self.name is "..self.name)
+            p = _global_classes[p:findtype(p.base)]
+        else
+            p = nil
+        end
+    end
+
+    return nil
 end
 
 function append_global_type(t, class)
-	_global_types.n = _global_types.n +1
-	_global_types[_global_types.n] = t
-	_global_types_hash[t] = 1
-	if class then append_class_type(t, class) end
+    _global_types.n = _global_types.n +1
+    _global_types[_global_types.n] = t
+    _global_types_hash[t] = 1
+    if class then append_class_type(t, class) end
 end
 
 function append_class_type(t,class)
-	if _global_classes[t] then
-		class.flags = _global_classes[t].flags
-		class.lnames = _global_classes[t].lnames
-		if _global_classes[t].base and (_global_classes[t].base ~= '') then
-			class.base = _global_classes[t].base or class.base
-		end
-	end
-	_global_classes[t] = class
-	class.flags = class.flags or {}
+    if _global_classes[t] then
+        class.flags = _global_classes[t].flags
+        class.lnames = _global_classes[t].lnames
+        if _global_classes[t].base and (_global_classes[t].base ~= '') then
+            class.base = _global_classes[t].base or class.base
+        end
+    end
+    _global_classes[t] = class
+    class.flags = class.flags or {}
 end
 
 function match_type(childtype, regtype, st)
 --print("findtype "..childtype..", "..regtype..", "..st)
-	local b,e = string.find(regtype, childtype, -string.len(childtype), true)
-	if b then
-
-		if e == string.len(regtype) and
-				(b == 1 or (string.sub(regtype, b-1, b-1) == ':' and
-				string.sub(regtype, 1, b-1) == string.sub(st, 1, b-1))) then
-			return true
-		end
-	end
-
-	return false
+    local b,e = string.find(regtype, childtype, -string.len(childtype), true)
+    if b then
+
+        if e == string.len(regtype) and
+                (b == 1 or (string.sub(regtype, b-1, b-1) == ':' and
+                string.sub(regtype, 1, b-1) == string.sub(st, 1, b-1))) then
+            return true
+        end
+    end
+
+    return false
 end
 
 function findtype_on_childs(self, t)
 
-	local tchild
-	if self.classtype == 'class' or self.classtype == 'namespace' then
-		for k,v in ipairs(self) do
-			if v.classtype == 'class' or v.classtype == 'namespace' then
-				if v.typedefs and v.typedefs[t] then
-				 return v.typedefs[t]
-				elseif v.usertypes and v.usertypes[t] then
-				 return v.usertypes[t]
-				end
-				tchild = findtype_on_childs(v, t)
-				if tchild then return tchild end
-			end
-		end
-	end
-	return nil
+    local tchild
+    if self.classtype == 'class' or self.classtype == 'namespace' then
+        for k,v in ipairs(self) do
+            if v.classtype == 'class' or v.classtype == 'namespace' then
+                if v.typedefs and v.typedefs[t] then
+                 return v.typedefs[t]
+                elseif v.usertypes and v.usertypes[t] then
+                 return v.usertypes[t]
+                end
+                tchild = findtype_on_childs(v, t)
+                if tchild then return tchild end
+            end
+        end
+    end
+    return nil
 
 end
 
 function classContainer:isenum (type)
- if global_enums[type] then
-	return type
- else
- 	return false
- end
-
- local basetype = gsub(type,"^.*::","")
- local env = self
- while env do
-  if env.enums then
-   local i=1
-   while env.enums[i] do
-    if env.enums[i].name == basetype then
-         return true
-        end
-        i = i+1
-   end
-  end
-  env = env.parent
- end
- return false
+    if global_enums[type] then
+        return type
+    else
+        return false
+    end
+
+    local basetype = gsub(type,"^.*::","")
+    local env = self
+    while env do
+        if env.enums then
+            local i=1
+            while env.enums[i] do
+                if env.enums[i].name == basetype then
+                    return true
+                end
+                i = i+1
+            end
+        end
+        env = env.parent
+    end
+    return false
 end
 
@@ -416,327 +415,327 @@
 -- parse chunk
 function classContainer:doparse (s)
---print ("parse "..s)
-
- -- try the parser hook
- do
- 	local sub = parser_hook(s)
- 	if sub then
- 		return sub
- 	end
- end
-
- -- try the null statement
- do
- 	local b,e,code = string.find(s, "^%s*;")
- 	if b then
- 		return strsub(s,e+1)
- 	end
- end
-
- -- try empty verbatim line
- do
- 	local b,e,code = string.find(s, "^%s*$\n")
- 	if b then
- 		return strsub(s,e+1)
- 	end
- end
-
- -- try Lua code
- do
-  local b,e,code = strfind(s,"^%s*(%b\1\2)")
-  if b then
-   Code(strsub(code,2,-2))
-   return strsub(s,e+1)
-  end
- end
-
- -- try C code
- do
-  local b,e,code = strfind(s,"^%s*(%b\3\4)")
-  if b then
-	code = '{'..strsub(code,2,-2)..'\n}\n'
-	Verbatim(code,'r')        -- verbatim code for 'r'egister fragment
-	return strsub(s,e+1)
-  end
- end
-
- -- try C code for preamble section
- do
- 	local b,e,code = string.find(s, "^%s*(%b\5\6)")
- 	if b then
- 		code = string.sub(code, 2, -2).."\n"
-		Verbatim(code, '')
-		return string.sub(s, e+1)
- 	end
- end
-
- -- try default_property directive
- do
- 	local b,e,ptype = strfind(s, "^%s*TOLUA_PROPERTY_TYPE%s*%(+%s*([^%)%s]*)%s*%)+%s*;?")
- 	if b then
- 		if not ptype or ptype == "" then
- 			ptype = "default"
- 		end
- 		self:set_property_type(ptype)
-	 	return strsub(s, e+1)
- 	end
- end
-
- -- try protected_destructor directive
- do
- 	local b,e = string.find(s, "^%s*TOLUA_PROTECTED_DESTRUCTOR%s*;?")
-	if b then
-		if self.set_protected_destructor then
-	 		self:set_protected_destructor(true)
-	 	end
- 		return strsub(s, e+1)
- 	end
- end
-
- -- try 'extern' keyword
- do
- 	local b,e = string.find(s, "^%s*extern%s+")
- 	if b then
-		-- do nothing
- 		return strsub(s, e+1)
- 	end
- end
-	
- -- try 'virtual' keyworkd
- do
- 	local b,e = string.find(s, "^%s*virtual%s+")
- 	if b then
- 		methodisvirtual = true
- 		return strsub(s, e+1)
- 	end
- end
-
- -- try labels (public, private, etc)
- do
- 	local b,e = string.find(s, "^%s*%w*%s*:[^:]")
- 	if b then
- 		return strsub(s, e) -- preserve the [^:]
- 	end
- end
-
- -- try module
- do
-  local b,e,name,body = strfind(s,"^%s*module%s%s*([_%w][_%w]*)%s*(%b{})%s*")
-  if b then
-   _curr_code = strsub(s,b,e)
-   Module(name,body)
-   return strsub(s,e+1)
-  end
- end
-
- -- try namesapce
- do
-  local b,e,name,body = strfind(s,"^%s*namespace%s%s*([_%w][_%w]*)%s*(%b{})%s*;?")
-  if b then
-   _curr_code = strsub(s,b,e)
-   Namespace(name,body)
-   return strsub(s,e+1)
-  end
- end
-
- -- try define
- do
-  local b,e,name = strfind(s,"^%s*#define%s%s*([^%s]*)[^\n]*\n%s*")
-  if b then
-   _curr_code = strsub(s,b,e)
-   Define(name)
-   return strsub(s,e+1)
-  end
- end
-
- -- try enumerates
-
- do
-  local b,e,name,body,varname = strfind(s,"^%s*enum%s+(%S*)%s*(%b{})%s*([^%s;]*)%s*;?%s*")
-  if b then
-   --error("#Sorry, declaration of enums and variables on the same statement is not supported.\nDeclare your variable separately (example: '"..name.." "..varname..";')")
-   _curr_code = strsub(s,b,e)
-   Enumerate(name,body,varname)
-   return strsub(s,e+1)
-  end
- end
-
--- do
---  local b,e,name,body = strfind(s,"^%s*enum%s+(%S*)%s*(%b{})%s*;?%s*")
---  if b then
---   _curr_code = strsub(s,b,e)
---   Enumerate(name,body)
---  return strsub(s,e+1)
---  end
--- end
-
- do
-  local b,e,body,name = strfind(s,"^%s*typedef%s+enum[^{]*(%b{})%s*([%w_][^%s]*)%s*;%s*")
-  if b then
-   _curr_code = strsub(s,b,e)
-   Enumerate(name,body)
-   return strsub(s,e+1)
-  end
- end
-
- -- try operator
- do
-  local b,e,decl,kind,arg,const = strfind(s,"^%s*([_%w][_%w%s%*&:<>,]-%s+operator)%s*([^%s][^%s]*)%s*(%b())%s*(c?o?n?s?t?)%s*;%s*")
-  if not b then
-		 -- try inline
-   b,e,decl,kind,arg,const = strfind(s,"^%s*([_%w][_%w%s%*&:<>,]-%s+operator)%s*([^%s][^%s]*)%s*(%b())%s*(c?o?n?s?t?)[%s\n]*%b{}%s*;?%s*")
-  end
-  if not b then
-  	-- try cast operator
-  	b,e,decl,kind,arg,const = strfind(s, "^%s*(operator)%s+([%w_:%d<>%*%&%s]+)%s*(%b())%s*(c?o?n?s?t?)");
-  	if b then
-  		local _,ie = string.find(s, "^%s*%b{}", e+1)
-  		if ie then
-  			e = ie
-  		end
-  	end
-  end
-  if b then
-   _curr_code = strsub(s,b,e)
-   Operator(decl,kind,arg,const)
-   return strsub(s,e+1)
-  end
- end
-
- -- try function
- do
-  --local b,e,decl,arg,const = strfind(s,"^%s*([~_%w][_@%w%s%*&:<>]*[_%w])%s*(%b())%s*(c?o?n?s?t?)%s*=?%s*0?%s*;%s*")
-  local b,e,decl,arg,const,virt = strfind(s,"^%s*([^%(\n]+)%s*(%b())%s*(c?o?n?s?t?)%s*(=?%s*0?)%s*;%s*")
-  if not b then
-  	-- try function with template
-  	b,e,decl,arg,const = strfind(s,"^%s*([~_%w][_@%w%s%*&:<>]*[_%w]%b<>)%s*(%b())%s*(c?o?n?s?t?)%s*=?%s*0?%s*;%s*")
-  end
-  if not b then
-   -- try a single letter function name
-   b,e,decl,arg,const = strfind(s,"^%s*([_%w])%s*(%b())%s*(c?o?n?s?t?)%s*;%s*")
-  end
-  if b then
-  	if virt and string.find(virt, "[=0]") then
-  		if self.flags then
-  			self.flags.pure_virtual = true
-  		end
-  	end
-   _curr_code = strsub(s,b,e)
-   Function(decl,arg,const)
-   return strsub(s,e+1)
-  end
- end
-
- -- try inline function
- do
-  local b,e,decl,arg,const = strfind(s,"^%s*([^%(\n]+)%s*(%b())%s*(c?o?n?s?t?)[^;{]*%b{}%s*;?%s*")
-  --local b,e,decl,arg,const = strfind(s,"^%s*([~_%w][_@%w%s%*&:<>]*[_%w>])%s*(%b())%s*(c?o?n?s?t?)[^;]*%b{}%s*;?%s*")
-  if not b then
-   -- try a single letter function name
-   b,e,decl,arg,const = strfind(s,"^%s*([_%w])%s*(%b())%s*(c?o?n?s?t?).-%b{}%s*;?%s*")
-  end
-  if b then
-   _curr_code = strsub(s,b,e)
-   Function(decl,arg,const)
-   return strsub(s,e+1)
-  end
- end
-
- -- try class
- do
-	 local b,e,name,base,body
-		base = '' body = ''
-		b,e,name = strfind(s,"^%s*class%s*([_%w][_%w@]*)%s*;")  -- dummy class
-		if not b then
-			b,e,name = strfind(s,"^%s*struct%s*([_%w][_%w@]*)%s*;")    -- dummy struct
-			if not b then
-				b,e,name,base,body = strfind(s,"^%s*class%s*([_%w][_%w@]*)%s*(.-)%s*(%b{})%s*;%s*")
-				if not b then
-					b,e,name,base,body = strfind(s,"^%s*struct%s*([_%w][_%w@]*)%s*(.-)%s*(%b{})%s*;%s*")
-					if not b then
-						b,e,name,base,body = strfind(s,"^%s*union%s*([_%w][_%w@]*)%s*(.-)%s*(%b{})%s*;%s*")
-						if not b then
-							base = ''
-							b,e,body,name = strfind(s,"^%s*typedef%s%s*struct%s%s*[_%w]*%s*(%b{})%s*([_%w][_%w@]*)%s*;%s*")
-						end
-					end
-				end
-			end
-		end
-		if b then
-			if base ~= '' then
-				base = string.gsub(base, "^%s*:%s*", "")
-				base = string.gsub(base, "%s*public%s*", "")
-				base = split(base, ",")
-				--local b,e
-				--b,e,base = strfind(base,".-([_%w][_%w<>,:]*)$")
-			else
-				base = {}
-			end
-			_curr_code = strsub(s,b,e)
-			Class(name,base,body)
-			return strsub(s,e+1)
-		end
-	end
-
- -- try typedef
- do
-  local b,e,types = strfind(s,"^%s*typedef%s%s*(.-)%s*;%s*")
-  if b then
-   _curr_code = strsub(s,b,e)
-   Typedef(types)
-   return strsub(s,e+1)
-  end
- end
-
- -- try variable
- do
-  local b,e,decl = strfind(s,"^%s*([_%w][_@%s%w%d%*&:<>,]*[_%w%d])%s*;%s*")
-  if b then
-   _curr_code = strsub(s,b,e)
-
-	local list = split_c_tokens(decl, ",")
-	Variable(list[1])
-	if list.n > 1 then
-		local _,_,type = strfind(list[1], "(.-)%s+([^%s]*)$");
-
-		local i =2;
-		while list[i] do
-			Variable(type.." "..list[i])
-			i=i+1
-		end
-	end
-   --Variable(decl)
-   return strsub(s,e+1)
-  end
- end
-
-	-- try string
- do
-  local b,e,decl = strfind(s,"^%s*([_%w]?[_%s%w%d]-char%s+[_@%w%d]*%s*%[%s*%S+%s*%])%s*;%s*")
-  if b then
-   _curr_code = strsub(s,b,e)
-   Variable(decl)
-   return strsub(s,e+1)
-  end
- end
-
- -- try array
- do
-  local b,e,decl = strfind(s,"^%s*([_%w][][_@%s%w%d%*&:]*[]_%w%d])%s*;%s*")
-  if b then
-   _curr_code = strsub(s,b,e)
-   Array(decl)
-   return strsub(s,e+1)
-  end
- end
-
- -- no matching
- if gsub(s,"%s%s*","") ~= "" then
-  _curr_code = s
-  error("#parse error")
- else
-  return ""
- end
+    --print ("parse "..s)
+
+    -- try the parser hook
+    do
+        local sub = parser_hook(s)
+        if sub then
+            return sub
+        end
+    end
+
+    -- try the null statement
+    do
+        local b,e,code = string.find(s, "^%s*;")
+        if b then
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try empty verbatim line
+    do
+        local b,e,code = string.find(s, "^%s*$\n")
+        if b then
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try Lua code
+    do
+        local b,e,code = strfind(s,"^%s*(%b\1\2)")
+        if b then
+            Code(strsub(code,2,-2))
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try C code
+    do
+        local b,e,code = strfind(s,"^%s*(%b\3\4)")
+        if b then
+            code = '{'..strsub(code,2,-2)..'\n}\n'
+            Verbatim(code,'r')        -- verbatim code for 'r'egister fragment
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try C code for preamble section
+    do
+        local b,e,code = string.find(s, "^%s*(%b\5\6)")
+        if b then
+            code = string.sub(code, 2, -2).."\n"
+            Verbatim(code, '')
+            return string.sub(s, e+1)
+        end
+    end
+
+    -- try default_property directive
+    do
+        local b,e,ptype = strfind(s, "^%s*TOLUA_PROPERTY_TYPE%s*%(+%s*([^%)%s]*)%s*%)+%s*;?")
+        if b then
+            if not ptype or ptype == "" then
+                ptype = "default"
+            end
+            self:set_property_type(ptype)
+            return strsub(s, e+1)
+        end
+    end
+
+    -- try protected_destructor directive
+    do
+        local b,e = string.find(s, "^%s*TOLUA_PROTECTED_DESTRUCTOR%s*;?")
+        if b then
+            if self.set_protected_destructor then
+                self:set_protected_destructor(true)
+            end
+            return strsub(s, e+1)
+        end
+    end
+
+    -- try 'extern' keyword
+    do
+        local b,e = string.find(s, "^%s*extern%s+")
+        if b then
+            -- do nothing
+            return strsub(s, e+1)
+        end
+    end
+
+    -- try 'virtual' keyworkd
+    do
+        local b,e = string.find(s, "^%s*virtual%s+")
+        if b then
+            methodisvirtual = true
+            return strsub(s, e+1)
+        end
+    end
+
+    -- try labels (public, private, etc)
+    do
+        local b,e = string.find(s, "^%s*%w*%s*:[^:]")
+        if b then
+            return strsub(s, e) -- preserve the [^:]
+        end
+    end
+
+    -- try module
+    do
+        local b,e,name,body = strfind(s,"^%s*module%s%s*([_%w][_%w]*)%s*(%b{})%s*")
+        if b then
+            _curr_code = strsub(s,b,e)
+            Module(name,body)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try namesapce
+    do
+        local b,e,name,body = strfind(s,"^%s*namespace%s%s*([_%w][_%w]*)%s*(%b{})%s*;?")
+        if b then
+            _curr_code = strsub(s,b,e)
+            Namespace(name,body)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try define
+    do
+        local b,e,name = strfind(s,"^%s*#define%s%s*([^%s]*)[^\n]*\n%s*")
+        if b then
+            _curr_code = strsub(s,b,e)
+            Define(name)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try enumerates
+
+    do
+        local b,e,name,body,varname = strfind(s,"^%s*enum%s+(%S*)%s*(%b{})%s*([^%s;]*)%s*;?%s*")
+        if b then
+            --error("#Sorry, declaration of enums and variables on the same statement is not supported.\nDeclare your variable separately (example: '"..name.." "..varname..";')")
+            _curr_code = strsub(s,b,e)
+            Enumerate(name,body,varname)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- do
+    --    local b,e,name,body = strfind(s,"^%s*enum%s+(%S*)%s*(%b{})%s*;?%s*")
+    --    if b then
+    --        _curr_code = strsub(s,b,e)
+    --        Enumerate(name,body)
+    --        return strsub(s,e+1)
+    --    end
+    -- end
+
+    do
+        local b,e,body,name = strfind(s,"^%s*typedef%s+enum[^{]*(%b{})%s*([%w_][^%s]*)%s*;%s*")
+        if b then
+        _curr_code = strsub(s,b,e)
+        Enumerate(name,body)
+        return strsub(s,e+1)
+        end
+    end
+
+    -- try operator
+    do
+        local b,e,decl,kind,arg,const = strfind(s,"^%s*([_%w][_%w%s%*&:<>,]-%s+operator)%s*([^%s][^%s]*)%s*(%b())%s*(c?o?n?s?t?)%s*;%s*")
+        if not b then
+            -- try inline
+            b,e,decl,kind,arg,const = strfind(s,"^%s*([_%w][_%w%s%*&:<>,]-%s+operator)%s*([^%s][^%s]*)%s*(%b())%s*(c?o?n?s?t?)[%s\n]*%b{}%s*;?%s*")
+        end
+        if not b then
+            -- try cast operator
+            b,e,decl,kind,arg,const = strfind(s, "^%s*(operator)%s+([%w_:%d<>%*%&%s]+)%s*(%b())%s*(c?o?n?s?t?)");
+            if b then
+                local _,ie = string.find(s, "^%s*%b{}", e+1)
+                if ie then
+                    e = ie
+                end
+            end
+        end
+        if b then
+            _curr_code = strsub(s,b,e)
+            Operator(decl,kind,arg,const)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try function
+    do
+        --local b,e,decl,arg,const = strfind(s,"^%s*([~_%w][_@%w%s%*&:<>]*[_%w])%s*(%b())%s*(c?o?n?s?t?)%s*=?%s*0?%s*;%s*")
+        local b,e,decl,arg,const,virt = strfind(s,"^%s*([^%(\n]+)%s*(%b())%s*(c?o?n?s?t?)%s*(=?%s*0?)%s*;%s*")
+        if not b then
+            -- try function with template
+            b,e,decl,arg,const = strfind(s,"^%s*([~_%w][_@%w%s%*&:<>]*[_%w]%b<>)%s*(%b())%s*(c?o?n?s?t?)%s*=?%s*0?%s*;%s*")
+        end
+        if not b then
+            -- try a single letter function name
+            b,e,decl,arg,const = strfind(s,"^%s*([_%w])%s*(%b())%s*(c?o?n?s?t?)%s*;%s*")
+        end
+        if b then
+            if virt and string.find(virt, "[=0]") then
+                if self.flags then
+                    self.flags.pure_virtual = true
+                end
+            end
+            _curr_code = strsub(s,b,e)
+            Function(decl,arg,const)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try inline function
+    do
+        local b,e,decl,arg,const = strfind(s,"^%s*([^%(\n]+)%s*(%b())%s*(c?o?n?s?t?)[^;{]*%b{}%s*;?%s*")
+        --local b,e,decl,arg,const = strfind(s,"^%s*([~_%w][_@%w%s%*&:<>]*[_%w>])%s*(%b())%s*(c?o?n?s?t?)[^;]*%b{}%s*;?%s*")
+        if not b then
+            -- try a single letter function name
+            b,e,decl,arg,const = strfind(s,"^%s*([_%w])%s*(%b())%s*(c?o?n?s?t?).-%b{}%s*;?%s*")
+        end
+        if b then
+            _curr_code = strsub(s,b,e)
+            Function(decl,arg,const)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try class
+    do
+        local b,e,name,base,body
+        base = '' body = ''
+        b,e,name = strfind(s,"^%s*class%s*([_%w][_%w@]*)%s*;")  -- dummy class
+        if not b then
+            b,e,name = strfind(s,"^%s*struct%s*([_%w][_%w@]*)%s*;")    -- dummy struct
+            if not b then
+                b,e,name,base,body = strfind(s,"^%s*class%s*([_%w][_%w@]*)%s*(.-)%s*(%b{})%s*;%s*")
+                if not b then
+                    b,e,name,base,body = strfind(s,"^%s*struct%s*([_%w][_%w@]*)%s*(.-)%s*(%b{})%s*;%s*")
+                    if not b then
+                        b,e,name,base,body = strfind(s,"^%s*union%s*([_%w][_%w@]*)%s*(.-)%s*(%b{})%s*;%s*")
+                        if not b then
+                            base = ''
+                            b,e,body,name = strfind(s,"^%s*typedef%s%s*struct%s%s*[_%w]*%s*(%b{})%s*([_%w][_%w@]*)%s*;%s*")
+                        end
+                    end
+                end
+            end
+        end
+        if b then
+            if base ~= '' then
+                base = string.gsub(base, "^%s*:%s*", "")
+                base = string.gsub(base, "%s*public%s*", "")
+                base = split(base, ",")
+                --local b,e
+                --b,e,base = strfind(base,".-([_%w][_%w<>,:]*)$")
+            else
+                base = {}
+            end
+            _curr_code = strsub(s,b,e)
+            Class(name,base,body)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try typedef
+    do
+        local b,e,types = strfind(s,"^%s*typedef%s%s*(.-)%s*;%s*")
+        if b then
+            _curr_code = strsub(s,b,e)
+            Typedef(types)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try variable
+    do
+        local b,e,decl = strfind(s,"^%s*([_%w][_@%s%w%d%*&:<>,]*[_%w%d])%s*;%s*")
+        if b then
+            _curr_code = strsub(s,b,e)
+
+            local list = split_c_tokens(decl, ",")
+            Variable(list[1])
+            if list.n > 1 then
+                local _,_,type = strfind(list[1], "(.-)%s+([^%s]*)$");
+
+                local i =2;
+                while list[i] do
+                    Variable(type.." "..list[i])
+                    i=i+1
+                end
+            end
+            --Variable(decl)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try string
+    do
+        local b,e,decl = strfind(s,"^%s*([_%w]?[_%s%w%d]-char%s+[_@%w%d]*%s*%[%s*%S+%s*%])%s*;%s*")
+        if b then
+            _curr_code = strsub(s,b,e)
+            Variable(decl)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- try array
+    do
+        local b,e,decl = strfind(s,"^%s*([_%w][][_@%s%w%d%*&:]*[]_%w%d])%s*;%s*")
+        if b then
+            _curr_code = strsub(s,b,e)
+            Array(decl)
+            return strsub(s,e+1)
+        end
+    end
+
+    -- no matching
+    if gsub(s,"%s%s*","") ~= "" then
+        _curr_code = s
+        error("#parse error")
+    else
+        return ""
+    end
 
 end
@@ -744,10 +743,10 @@
 function classContainer:parse (s)
 
-	self.curr_member_access = nil
-
- while s ~= '' do
-  s = self:doparse(s)
-  methodisvirtual = false
- end
+    self.curr_member_access = nil
+
+    while s ~= '' do
+        s = self:doparse(s)
+        methodisvirtual = false
+    end
 end
 
@@ -757,15 +756,15 @@
 function get_property_type()
 
-	return classContainer.curr:get_property_type()
+    return classContainer.curr:get_property_type()
 end
 
 function classContainer:set_property_type(ptype)
-	ptype = string.gsub(ptype, "^%s*", "")
-	ptype = string.gsub(ptype, "%s*$", "")
-
-	self.property_type = ptype
+    ptype = string.gsub(ptype, "^%s*", "")
+    ptype = string.gsub(ptype, "%s*$", "")
+
+    self.property_type = ptype
 end
 
 function classContainer:get_property_type()
-	return self.property_type or (self.parent and self.parent:get_property_type()) or "default"
-end
+    return self.property_type or (self.parent and self.parent:get_property_type()) or "default"
+end
Index: /code/branches/buildsystem3/src/tolua/lua/custom.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/custom.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/custom.lua	(revision 2664)
@@ -1,27 +1,27 @@
 
 function extract_code(fn,s)
-	local code = ""
-	if fn then
-		code = '\n$#include "'..fn..'"\n'
-	end
-	s= "\n" .. s .. "\n" -- add blank lines as sentinels
-	local _,e,c,t = strfind(s, "\n([^\n]-)SCRIPT_([%w_]*)[^\n]*\n")
-	while e do
-		t = strlower(t)
-		if t == "bind_begin" then
-			_,e,c = strfind(s,"(.-)\n[^\n]*SCRIPT_BIND_END[^\n]*\n",e)
-			if not e then
-			 tolua_error("Unbalanced 'SCRIPT_BIND_BEGIN' directive in header file")
-			end
-		end
-		if t == "bind_class" or t == "bind_block" then
-			local b
-			_,e,c,b = string.find(s, "([^{]-)(%b{})", e)
-			c = c..'{\n'..extract_code(nil, b)..'\n};\n'
-		end
-		code = code .. c .. "\n"
-	 _,e,c,t = strfind(s, "\n([^\n]-)SCRIPT_([%w_]*)[^\n]*\n",e)
-	end
-	return code
+    local code = ""
+    if fn then
+        code = '\n$#include "'..fn..'"\n'
+    end
+    s= "\n" .. s .. "\n" -- add blank lines as sentinels
+    local _,e,c,t = strfind(s, "\n([^\n]-)SCRIPT_([%w_]*)[^\n]*\n")
+    while e do
+        t = strlower(t)
+        if t == "bind_begin" then
+            _,e,c = strfind(s,"(.-)\n[^\n]*SCRIPT_BIND_END[^\n]*\n",e)
+            if not e then
+             tolua_error("Unbalanced 'SCRIPT_BIND_BEGIN' directive in header file")
+            end
+        end
+        if t == "bind_class" or t == "bind_block" then
+            local b
+            _,e,c,b = string.find(s, "([^{]-)(%b{})", e)
+            c = c..'{\n'..extract_code(nil, b)..'\n};\n'
+        end
+        code = code .. c .. "\n"
+     _,e,c,t = strfind(s, "\n([^\n]-)SCRIPT_([%w_]*)[^\n]*\n",e)
+    end
+    return code
 end
 
@@ -33,13 +33,13 @@
 
 function include_file_hook(p, filename)
-	do return end
+    do return end
 --print("FILENAME is "..filename)
-	p.code = string.gsub(p.code, "\n%s*SigC::Signal", "\n\ttolua_readonly SigC::Signal")
-	p.code = string.gsub(p.code, "#ifdef __cplusplus\nextern \"C\" {\n#endif", "")
-	p.code = string.gsub(p.code, "#ifdef __cplusplus\n};?\n#endif", "")
-	p.code = string.gsub(p.code, "DECLSPEC", "")
-	p.code = string.gsub(p.code, "SDLCALL", "")
-	p.code = string.gsub(p.code, "DLLINTERFACE", "")
-	p.code = string.gsub(p.code, "#define[^\n]*_[hH]_?%s*\n", "\n")
+    p.code = string.gsub(p.code, "\n%s*SigC::Signal", "\n\ttolua_readonly SigC::Signal")
+    p.code = string.gsub(p.code, "#ifdef __cplusplus\nextern \"C\" {\n#endif", "")
+    p.code = string.gsub(p.code, "#ifdef __cplusplus\n};?\n#endif", "")
+    p.code = string.gsub(p.code, "DECLSPEC", "")
+    p.code = string.gsub(p.code, "SDLCALL", "")
+    p.code = string.gsub(p.code, "DLLINTERFACE", "")
+    p.code = string.gsub(p.code, "#define[^\n]*_[hH]_?%s*\n", "\n")
 --print("code is "..p.code)
 end
Index: /code/branches/buildsystem3/src/tolua/lua/custom_hide.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/custom_hide.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/custom_hide.lua	(revision 2664)
@@ -1,21 +1,21 @@
 -- extract code with tolua_hide, and also
 function extract_code(fn,s)
-	local code = '\n$#include "'..fn..'"\n'
-	s= "\n" .. s .. "\n" -- add blank lines as sentinels
-	local _,e,c,t = strfind(s, "\n([^\n]-)[Tt][Oo][Ll][Uu][Aa]_([^%s]*)[^\n]*\n")
-	while e do
-		t = strlower(t)
-		if t == "begin" then
-			_,e,c = strfind(s,"(.-)\n[^\n]*[Tt][Oo][Ll][Uu][Aa]_[Ee][Nn][Dd][^\n]*\n",e)
-			if not e then
-			 tolua_error("Unbalanced 'tolua_begin' directive in header file")
-			end
-		end
-		c = c.."\n"
-		c = string.gsub(c, "\n[^\n]*[Tt][Oo][Ll][Uu][Aa]_[hH][iI][Dd][eE][^\n]*\n", "\n");
-		c = string.gsub(c, "#define[^%(\n]*%(.-\n", "\n")
-		code = code .. c
-	 _,e,c,t = strfind(s, "\n([^\n]-)[Tt][Oo][Ll][Uu][Aa]_([^%s]*)[^\n]*\n",e)
-	end
-	return code
+    local code = '\n$#include "'..fn..'"\n'
+    s= "\n" .. s .. "\n" -- add blank lines as sentinels
+    local _,e,c,t = strfind(s, "\n([^\n]-)[Tt][Oo][Ll][Uu][Aa]_([^%s]*)[^\n]*\n")
+    while e do
+        t = strlower(t)
+        if t == "begin" then
+            _,e,c = strfind(s,"(.-)\n[^\n]*[Tt][Oo][Ll][Uu][Aa]_[Ee][Nn][Dd][^\n]*\n",e)
+            if not e then
+             tolua_error("Unbalanced 'tolua_begin' directive in header file")
+            end
+        end
+        c = c.."\n"
+        c = string.gsub(c, "\n[^\n]*[Tt][Oo][Ll][Uu][Aa]_[hH][iI][Dd][eE][^\n]*\n", "\n");
+        c = string.gsub(c, "#define[^%(\n]*%(.-\n", "\n")
+        code = code .. c
+     _,e,c,t = strfind(s, "\n([^\n]-)[Tt][Oo][Ll][Uu][Aa]_([^%s]*)[^\n]*\n",e)
+    end
+    return code
 end
Index: /code/branches/buildsystem3/src/tolua/lua/declaration.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/declaration.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/declaration.lua	(revision 2664)
@@ -22,11 +22,11 @@
 --  ret  = "*" or "&", if value is to be returned (only for arguments)
 classDeclaration = {
- mod = '',
- type = '',
- ptr = '',
- name = '',
- dim = '',
- ret = '',
- def = ''
+    mod = '',
+    type = '',
+    ptr = '',
+    name = '',
+    dim = '',
+    ret = '',
+    def = ''
 }
 classDeclaration.__index = classDeclaration
@@ -35,7 +35,7 @@
 -- Create an unique variable name
 function create_varname ()
- if not _varnumber then _varnumber = 0 end
- _varnumber = _varnumber + 1
- return "tolua_var_".._varnumber
+    if not _varnumber then _varnumber = 0 end
+    _varnumber = _varnumber + 1
+    return "tolua_var_".._varnumber
 end
 
@@ -44,45 +44,45 @@
 function classDeclaration:checkname ()
 
- if strsub(self.name,1,1) == '[' and not findtype(self.type) then
-  self.name = self.type..self.name
-  local m = split(self.mod,'%s%s*')
-  self.type = m[m.n]
-  self.mod = concat(m,1,m.n-1)
- end
-
- local t = split(self.name,'=')
- if t.n==2 then
-  self.name = t[1]
-  self.def = find_enum_var(t[t.n])
- end
-
- local b,e,d = strfind(self.name,"%[(.-)%]")
- if b then
-  self.name = strsub(self.name,1,b-1)
-  self.dim = find_enum_var(d)
- end
-
-
- if self.type ~= '' and self.type ~= 'void' and self.name == '' then
-  self.name = create_varname()
- elseif self.kind=='var' then
-  if self.type=='' and self.name~='' then
-   self.type = self.type..self.name
-   self.name = create_varname()
-  elseif findtype(self.name) then
-   if self.type=='' then self.type = self.name
-   else self.type = self.type..' '..self.name end
-   self.name = create_varname()
-  end
- end
-
- -- adjust type of string
- if self.type == 'char' and self.dim ~= '' then
-	 self.type = 'char*'
- end
-
-	if self.kind and self.kind == 'var' then
-		self.name = string.gsub(self.name, ":.*$", "") -- ???
-	end
+    if strsub(self.name,1,1) == '[' and not findtype(self.type) then
+        self.name = self.type..self.name
+        local m = split(self.mod,'%s%s*')
+        self.type = m[m.n]
+        self.mod = concat(m,1,m.n-1)
+    end
+
+    local t = split(self.name,'=')
+    if t.n==2 then
+        self.name = t[1]
+        self.def = find_enum_var(t[t.n])
+    end
+
+    local b,e,d = strfind(self.name,"%[(.-)%]")
+    if b then
+        self.name = strsub(self.name,1,b-1)
+        self.dim = find_enum_var(d)
+    end
+
+
+    if self.type ~= '' and self.type ~= 'void' and self.name == '' then
+        self.name = create_varname()
+    elseif self.kind=='var' then
+        if self.type=='' and self.name~='' then
+            self.type = self.type..self.name
+            self.name = create_varname()
+        elseif findtype(self.name) then
+            if self.type=='' then self.type = self.name
+            else self.type = self.type..' '..self.name end
+            self.name = create_varname()
+        end
+    end
+
+    -- adjust type of string
+    if self.type == 'char' and self.dim ~= '' then
+        self.type = 'char*'
+    end
+
+    if self.kind and self.kind == 'var' then
+        self.name = string.gsub(self.name, ":.*$", "") -- ???
+    end
 end
 
@@ -91,39 +91,39 @@
 function classDeclaration:checktype ()
 
- -- check if there is a pointer to basic type
- local basic = isbasic(self.type)
- if self.kind == 'func' and basic=='number' and string.find(self.ptr, "%*") then
- 	self.type = '_userdata'
- 	self.ptr = ""
- end
- if basic and self.ptr~='' then
-  self.ret = self.ptr
-  self.ptr = nil
-  if isbasic(self.type) == 'number' then
-  	self.return_userdata = true
-  end
- end
-
- -- check if there is array to be returned
- if self.dim~='' and self.ret~='' then
-   error('#invalid parameter: cannot return an array of values')
- end
- -- restore 'void*' and 'string*'
- if self.type == '_userdata' then self.type = 'void*'
- elseif self.type == '_cstring' then self.type = 'char*'
- elseif self.type == '_lstate' then self.type = 'lua_State*'
- end
-
- -- resolve types inside the templates
- if self.type then
-	 self.type = resolve_template_types(self.type)
- end
-
---
--- -- if returning value, automatically set default value
--- if self.ret ~= '' and self.def == '' then
---  self.def = '0'
--- end
---
+    -- check if there is a pointer to basic type
+    local basic = isbasic(self.type)
+    if self.kind == 'func' and basic=='number' and string.find(self.ptr, "%*") then
+        self.type = '_userdata'
+        self.ptr = ""
+    end
+    if basic and self.ptr~='' then
+        self.ret = self.ptr
+        self.ptr = nil
+        if isbasic(self.type) == 'number' then
+            self.return_userdata = true
+        end
+    end
+
+    -- check if there is array to be returned
+    if self.dim~='' and self.ret~='' then
+        error('#invalid parameter: cannot return an array of values')
+    end
+    -- restore 'void*' and 'string*'
+    if self.type == '_userdata' then self.type = 'void*'
+    elseif self.type == '_cstring' then self.type = 'char*'
+    elseif self.type == '_lstate' then self.type = 'lua_State*'
+    end
+
+    -- resolve types inside the templates
+    if self.type then
+        self.type = resolve_template_types(self.type)
+    end
+
+    --
+    -- -- if returning value, automatically set default value
+    -- if self.ret ~= '' and self.def == '' then
+    --  self.def = '0'
+    -- end
+    --
 
 end
@@ -131,56 +131,56 @@
 function resolve_template_types(type)
 
-	if isbasic(type) then
-		return type
-	end
-	local b,_,m = string.find(type, "(%b<>)")
-	if b then
-
-		m = split_c_tokens(string.sub(m, 2, -2), ",")
-		for i=1, table.getn(m) do
-			m[i] = string.gsub(m[i],"%s*([%*&])", "%1")
-			m[i] = findtype(m[i]) or m[i]
-			m[i] = resolve_template_types(m[i])
-		end
-
-		local b,i
-		type,b,i = break_template(type)
-		local template_part = "<"..string.gsub(concat(m, 1, m.n), " ", ",")..">"
-		type = rebuild_template(type, b, template_part)
-		type = string.gsub(type, ">>", "> >")
-	end
-	return type
+    if isbasic(type) then
+        return type
+    end
+    local b,_,m = string.find(type, "(%b<>)")
+    if b then
+
+        m = split_c_tokens(string.sub(m, 2, -2), ",")
+        for i=1, table.getn(m) do
+            m[i] = string.gsub(m[i],"%s*([%*&])", "%1")
+            m[i] = findtype(m[i]) or m[i]
+            m[i] = resolve_template_types(m[i])
+        end
+
+        local b,i
+        type,b,i = break_template(type)
+        local template_part = "<"..string.gsub(concat(m, 1, m.n), " ", ",")..">"
+        type = rebuild_template(type, b, template_part)
+        type = string.gsub(type, ">>", "> >")
+    end
+    return type
 end
 
 function break_template(s)
-	local b,e,timpl = string.find(s, "(%b<>)")
-	if timpl then
-		s = string.gsub(s, "%b<>", "")
-		return s, b, timpl
-	else
-		return s, 0, nil
-	end
+    local b,e,timpl = string.find(s, "(%b<>)")
+    if timpl then
+        s = string.gsub(s, "%b<>", "")
+        return s, b, timpl
+    else
+        return s, 0, nil
+    end
 end
 
 function rebuild_template(s, b, timpl)
 
-	if b == 0 then
-		return s
-	end
-
-	return string.sub(s, 1, b-1)..timpl..string.sub(s, b, -1)
+    if b == 0 then
+        return s
+    end
+
+    return string.sub(s, 1, b-1)..timpl..string.sub(s, b, -1)
 end
 
 -- Print method
 function classDeclaration:print (ident,close)
- print(ident.."Declaration{")
- print(ident.." mod  = '"..self.mod.."',")
- print(ident.." type = '"..self.type.."',")
- print(ident.." ptr  = '"..self.ptr.."',")
- print(ident.." name = '"..self.name.."',")
- print(ident.." dim  = '"..self.dim.."',")
- print(ident.." def  = '"..self.def.."',")
- print(ident.." ret  = '"..self.ret.."',")
- print(ident.."}"..close)
+    print(ident.."Declaration{")
+    print(ident.." mod  = '"..self.mod.."',")
+    print(ident.." type = '"..self.type.."',")
+    print(ident.." ptr  = '"..self.ptr.."',")
+    print(ident.." name = '"..self.name.."',")
+    print(ident.." dim  = '"..self.dim.."',")
+    print(ident.." def  = '"..self.def.."',")
+    print(ident.." ret  = '"..self.ret.."',")
+    print(ident.."}"..close)
 end
 
@@ -188,12 +188,12 @@
 function classDeclaration:requirecollection (t)
  if self.mod ~= 'const' and
-	    self.dim and self.dim ~= '' and
-				 not isbasic(self.type) and
-				 self.ptr == '' then
-		local type = gsub(self.type,"%s*const%s+","")
-		t[type] = "tolua_collect_" .. clean_template(type)
-		return true
-	end
-	return false
+        self.dim and self.dim ~= '' and
+                 not isbasic(self.type) and
+                 self.ptr == '' then
+        local type = gsub(self.type,"%s*const%s+","")
+        t[type] = "tolua_collect_" .. clean_template(type)
+        return true
+    end
+    return false
 end
 
@@ -201,9 +201,9 @@
 function classDeclaration:decltype ()
 
-	self.type = typevar(self.type)
-	if strfind(self.mod,'const') then
-		self.type = 'const '..self.type
-		self.mod = gsub(self.mod,'const%s*','')
-	end
+    self.type = typevar(self.type)
+    if strfind(self.mod,'const') then
+        self.type = 'const '..self.type
+        self.mod = gsub(self.mod,'const%s*','')
+    end
 end
 
@@ -211,203 +211,203 @@
 -- output type checking
 function classDeclaration:outchecktype (narg)
- local def
- local t = isbasic(self.type)
- if self.def~='' then
-  def = 1
- else
-  def = 0
- end
- if self.dim ~= '' then
-	--if t=='string' then
-	--	return 'tolua_isstringarray(tolua_S,'..narg..','..def..',&tolua_err)'
-	--else
-	return 'tolua_istable(tolua_S,'..narg..',0,&tolua_err)'
- 	--end
- elseif t then
-	return 'tolua_is'..t..'(tolua_S,'..narg..','..def..',&tolua_err)'
- else
-  return 'tolua_isusertype(tolua_S,'..narg..',"'..self.type..'",'..def..',&tolua_err)'
- end
+    local def
+    local t = isbasic(self.type)
+    if self.def~='' then
+        def = 1
+    else
+        def = 0
+    end
+    if self.dim ~= '' then
+        --if t=='string' then
+        --    return 'tolua_isstringarray(tolua_S,'..narg..','..def..',&tolua_err)'
+        --else
+        return 'tolua_istable(tolua_S,'..narg..',0,&tolua_err)'
+        --end
+    elseif t then
+        return 'tolua_is'..t..'(tolua_S,'..narg..','..def..',&tolua_err)'
+    else
+        return 'tolua_isusertype(tolua_S,'..narg..',"'..self.type..'",'..def..',&tolua_err)'
+    end
 end
 
 function classDeclaration:builddeclaration (narg, cplusplus)
- local array = self.dim ~= '' and tonumber(self.dim)==nil
-	local line = ""
- local ptr = ''
-	local mod
-	local type = self.type
- if self.dim ~= '' then
-	 type = gsub(self.type,'const%s+','')  -- eliminates const modifier for arrays
- end
- if self.ptr~='' and not isbasic(type) then ptr = '*' end
- line = concatparam(line," ",self.mod,type,ptr)
- if array then
-  line = concatparam(line,'*')
- end
- line = concatparam(line,self.name)
- if self.dim ~= '' then
-  if tonumber(self.dim)~=nil then
-   line = concatparam(line,'[',self.dim,'];')
-  else
-	if cplusplus then
-		line = concatparam(line,' = new',type,ptr,'['..self.dim..'];')
-	else
-		line = concatparam(line,' = (',type,ptr,'*)',
-		'malloc((',self.dim,')*sizeof(',type,ptr,'));')
-	end
-  end
- else
-  local t = isbasic(type)
-  line = concatparam(line,' = ')
-  if t == 'state' then
-  	line = concatparam(line, 'tolua_S;')
-  else
-  	--print("t is "..tostring(t)..", ptr is "..tostring(self.ptr))
-  	if t == 'number' and string.find(self.ptr, "%*") then
-  		t = 'userdata'
-  	end
-	if not t and ptr=='' then line = concatparam(line,'*') end
-	line = concatparam(line,'((',self.mod,type)
-	if not t then
-		line = concatparam(line,'*')
-	end
-	line = concatparam(line,') ')
-			if isenum(type) then
-			line = concatparam(line,'(int) ')
-			end
-	local def = 0
-	if self.def ~= '' then
-		def = self.def
-		if (ptr == '' or self.ptr == '&') and not t then
-			def = "(void*)&(const "..type..")"..def
-		end
-	end
-	if t then
-	line = concatparam(line,'tolua_to'..t,'(tolua_S,',narg,',',def,'));')
-	else
-	line = concatparam(line,'tolua_tousertype(tolua_S,',narg,',',def,'));')
-	end
-  end
- end
-	return line
+    local array = self.dim ~= '' and tonumber(self.dim)==nil
+    local line = ""
+    local ptr = ''
+    local mod
+    local type = self.type
+    if self.dim ~= '' then
+        type = gsub(self.type,'const%s+','')  -- eliminates const modifier for arrays
+    end
+    if self.ptr~='' and not isbasic(type) then ptr = '*' end
+    line = concatparam(line," ",self.mod,type,ptr)
+    if array then
+        line = concatparam(line,'*')
+    end
+    line = concatparam(line,self.name)
+    if self.dim ~= '' then
+        if tonumber(self.dim)~=nil then
+            line = concatparam(line,'[',self.dim,'];')
+        else
+            if cplusplus then
+                line = concatparam(line,' = new',type,ptr,'['..self.dim..'];')
+            else
+                line = concatparam(line,' = (',type,ptr,'*)',
+                'malloc((',self.dim,')*sizeof(',type,ptr,'));')
+            end
+        end
+    else
+    local t = isbasic(type)
+    line = concatparam(line,' = ')
+    if t == 'state' then
+        line = concatparam(line, 'tolua_S;')
+    else
+        --print("t is "..tostring(t)..", ptr is "..tostring(self.ptr))
+        if t == 'number' and string.find(self.ptr, "%*") then
+            t = 'userdata'
+        end
+        if not t and ptr=='' then line = concatparam(line,'*') end
+            line = concatparam(line,'((',self.mod,type)
+            if not t then
+                line = concatparam(line,'*')
+            end
+            line = concatparam(line,') ')
+            if isenum(type) then
+                line = concatparam(line,'(int) ')
+            end
+            local def = 0
+            if self.def ~= '' then
+                def = self.def
+                if (ptr == '' or self.ptr == '&') and not t then
+                    def = "(void*)&(const "..type..")"..def
+                end
+            end
+            if t then
+                line = concatparam(line,'tolua_to'..t,'(tolua_S,',narg,',',def,'));')
+            else
+                line = concatparam(line,'tolua_tousertype(tolua_S,',narg,',',def,'));')
+            end
+        end
+    end
+    return line
 end
 
 -- Declare variable
 function classDeclaration:declare (narg)
- if self.dim ~= '' and tonumber(self.dim)==nil then
-	 output('#ifdef __cplusplus\n')
-		output(self:builddeclaration(narg,true))
-		output('#else\n')
-		output(self:builddeclaration(narg,false))
-	 output('#endif\n')
-	else
-		output(self:builddeclaration(narg,false))
-	end
+    if self.dim ~= '' and tonumber(self.dim)==nil then
+        output('#ifdef __cplusplus\n')
+        output(self:builddeclaration(narg,true))
+        output('#else\n')
+        output(self:builddeclaration(narg,false))
+        output('#endif\n')
+    else
+        output(self:builddeclaration(narg,false))
+    end
 end
 
 -- Get parameter value
 function classDeclaration:getarray (narg)
- if self.dim ~= '' then
-	 local type = gsub(self.type,'const ','')
-  output('  {')
-	 output('#ifndef TOLUA_RELEASE\n')
-  local def; if self.def~='' then def=1 else def=0 end
-		local t = isbasic(type)
-		if (t) then
-   output('   if (!tolua_is'..t..'array(tolua_S,',narg,',',self.dim,',',def,',&tolua_err))')
-		else
-   output('   if (!tolua_isusertypearray(tolua_S,',narg,',"',type,'",',self.dim,',',def,',&tolua_err))')
-		end
-  output('    goto tolua_lerror;')
-  output('   else\n')
-	 output('#endif\n')
-  output('   {')
-  output('    int i;')
-  output('    for(i=0; i<'..self.dim..';i++)')
-  local t = isbasic(type)
-  local ptr = ''
-  if self.ptr~='' then ptr = '*' end
-  output('   ',self.name..'[i] = ')
-  if not t and ptr=='' then output('*') end
-  output('((',type)
-  if not t then
-   output('*')
-  end
-  output(') ')
-  local def = 0
-  if self.def ~= '' then def = self.def end
-  if t then
-   output('tolua_tofield'..t..'(tolua_S,',narg,',i+1,',def,'));')
-  else
-   output('tolua_tofieldusertype(tolua_S,',narg,',i+1,',def,'));')
-  end
-  output('   }')
-  output('  }')
- end
+    if self.dim ~= '' then
+        local type = gsub(self.type,'const ','')
+        output('  {')
+        output('#ifndef TOLUA_RELEASE\n')
+        local def; if self.def~='' then def=1 else def=0 end
+        local t = isbasic(type)
+        if (t) then
+            output('   if (!tolua_is'..t..'array(tolua_S,',narg,',',self.dim,',',def,',&tolua_err))')
+        else
+            output('   if (!tolua_isusertypearray(tolua_S,',narg,',"',type,'",',self.dim,',',def,',&tolua_err))')
+        end
+        output('    goto tolua_lerror;')
+        output('   else\n')
+        output('#endif\n')
+        output('   {')
+        output('    int i;')
+        output('    for(i=0; i<'..self.dim..';i++)')
+        local t = isbasic(type)
+        local ptr = ''
+        if self.ptr~='' then ptr = '*' end
+        output('   ',self.name..'[i] = ')
+        if not t and ptr=='' then output('*') end
+        output('((',type)
+        if not t then
+            output('*')
+        end
+        output(') ')
+        local def = 0
+        if self.def ~= '' then def = self.def end
+        if t then
+            output('tolua_tofield'..t..'(tolua_S,',narg,',i+1,',def,'));')
+        else
+            output('tolua_tofieldusertype(tolua_S,',narg,',i+1,',def,'));')
+        end
+        output('   }')
+        output('  }')
+    end
 end
 
 -- Get parameter value
 function classDeclaration:setarray (narg)
- if not strfind(self.type,'const%s+') and self.dim ~= '' then
-	 local type = gsub(self.type,'const ','')
-  output('  {')
-  output('   int i;')
-  output('   for(i=0; i<'..self.dim..';i++)')
-  local t,ct = isbasic(type)
-  if t then
-   output('    tolua_pushfield'..t..'(tolua_S,',narg,',i+1,(',ct,')',self.name,'[i]);')
-  else
-   if self.ptr == '' then
-     output('   {')
-     output('#ifdef __cplusplus\n')
-     output('    void* tolua_obj = new',type,'(',self.name,'[i]);')
-     output('    tolua_pushfieldusertype_and_takeownership(tolua_S,',narg,',i+1,tolua_obj,"',type,'");')
-     output('#else\n')
-     output('    void* tolua_obj = tolua_copy(tolua_S,(void*)&',self.name,'[i],sizeof(',type,'));')
-     output('    tolua_pushfieldusertype(tolua_S,',narg,',i+1,tolua_obj,"',type,'");')
-     output('#endif\n')
-     output('   }')
-   else
-    output('   tolua_pushfieldusertype(tolua_S,',narg,',i+1,(void*)',self.name,'[i],"',type,'");')
-   end
-  end
-  output('  }')
- end
+    if not strfind(self.type,'const%s+') and self.dim ~= '' then
+        local type = gsub(self.type,'const ','')
+        output('  {')
+        output('   int i;')
+        output('   for(i=0; i<'..self.dim..';i++)')
+        local t,ct = isbasic(type)
+        if t then
+            output('    tolua_pushfield'..t..'(tolua_S,',narg,',i+1,(',ct,')',self.name,'[i]);')
+        else
+            if self.ptr == '' then
+                output('   {')
+                output('#ifdef __cplusplus\n')
+                output('    void* tolua_obj = new',type,'(',self.name,'[i]);')
+                output('    tolua_pushfieldusertype_and_takeownership(tolua_S,',narg,',i+1,tolua_obj,"',type,'");')
+                output('#else\n')
+                output('    void* tolua_obj = tolua_copy(tolua_S,(void*)&',self.name,'[i],sizeof(',type,'));')
+                output('    tolua_pushfieldusertype(tolua_S,',narg,',i+1,tolua_obj,"',type,'");')
+                output('#endif\n')
+                output('   }')
+            else
+                output('   tolua_pushfieldusertype(tolua_S,',narg,',i+1,(void*)',self.name,'[i],"',type,'");')
+            end
+        end
+        output('  }')
+    end
 end
 
 -- Free dynamically allocated array
 function classDeclaration:freearray ()
- if self.dim ~= '' and tonumber(self.dim)==nil then
-	 output('#ifdef __cplusplus\n')
-		output('  delete []',self.name,';')
-	 output('#else\n')
-  output('  free(',self.name,');')
-	 output('#endif\n')
- end
+    if self.dim ~= '' and tonumber(self.dim)==nil then
+        output('#ifdef __cplusplus\n')
+        output('  delete []',self.name,';')
+        output('#else\n')
+        output('  free(',self.name,');')
+        output('#endif\n')
+    end
 end
 
 -- Pass parameter
 function classDeclaration:passpar ()
- if self.ptr=='&' and not isbasic(self.type) then
-  output('*'..self.name)
- elseif self.ret=='*' then
-  output('&'..self.name)
- else
-  output(self.name)
- end
+    if self.ptr=='&' and not isbasic(self.type) then
+        output('*'..self.name)
+    elseif self.ret=='*' then
+        output('&'..self.name)
+    else
+        output(self.name)
+    end
 end
 
 -- Return parameter value
 function classDeclaration:retvalue ()
- if self.ret ~= '' then
-  local t,ct = isbasic(self.type)
-  if t and t~='' then
-   output('   tolua_push'..t..'(tolua_S,(',ct,')'..self.name..');')
-  else
-   output('   tolua_pushusertype(tolua_S,(void*)'..self.name..',"',self.type,'");')
-  end
-  return 1
- end
- return 0
+    if self.ret ~= '' then
+        local t,ct = isbasic(self.type)
+        if t and t~='' then
+            output('   tolua_push'..t..'(tolua_S,(',ct,')'..self.name..');')
+        else
+            output('   tolua_pushusertype(tolua_S,(void*)'..self.name..',"',self.type,'");')
+        end
+        return 1
+    end
+    return 0
 end
 
@@ -415,18 +415,18 @@
 function _Declaration (t)
 
- setmetatable(t,classDeclaration)
- t:buildnames()
- t:checkname()
- t:checktype()
- local ft = findtype(t.type) or t.type
- if not isenum(ft) then
-	t.mod, t.type = applytypedef(t.mod, ft)
- end
-
- if t.kind=="var" and (string.find(t.mod, "tolua_property%s") or string.find(t.mod, "tolua_property$")) then
- 	t.mod = string.gsub(t.mod, "tolua_property", "tolua_property__"..get_property_type())
- end
-
- return t
+    setmetatable(t,classDeclaration)
+    t:buildnames()
+    t:checkname()
+    t:checktype()
+    local ft = findtype(t.type) or t.type
+    if not isenum(ft) then
+        t.mod, t.type = applytypedef(t.mod, ft)
+    end
+
+    if t.kind=="var" and (string.find(t.mod, "tolua_property%s") or string.find(t.mod, "tolua_property$")) then
+        t.mod = string.gsub(t.mod, "tolua_property", "tolua_property__"..get_property_type())
+    end
+
+    return t
 end
 
@@ -436,132 +436,132 @@
 function Declaration (s,kind,is_parameter)
 
- -- eliminate spaces if default value is provided
- s = gsub(s,"%s*=%s*","=")
- s = gsub(s, "%s*<", "<")
-
- local defb,tmpdef
- defb,_,tmpdef = string.find(s, "(=.*)$")
- if defb then
- 	s = string.gsub(s, "=.*$", "")
- else
- 	tmpdef = ''
- end
- if kind == "var" then
-  -- check the form: void
-  if s == '' or s == 'void' then
-   return _Declaration{type = 'void', kind = kind, is_parameter = is_parameter}
-  end
- end
-
- -- check the form: mod type*& name
- local t = split_c_tokens(s,'%*%s*&')
- if t.n == 2 then
-  if kind == 'func' then
-   error("#invalid function return type: "..s)
-  end
-  --local m = split(t[1],'%s%s*')
-  local m = split_c_tokens(t[1],'%s+')
-  return _Declaration{
-   name = t[2]..tmpdef,
-   ptr = '*',
-   ret = '&',
-   --type = rebuild_template(m[m.n], tb, timpl),
-   type = m[m.n],
-   mod = concat(m,1,m.n-1),
-   is_parameter = is_parameter,
-   kind = kind
-  }
- end
-
- -- check the form: mod type** name
- t = split_c_tokens(s,'%*%s*%*')
- if t.n == 2 then
-  if kind == 'func' then
-   error("#invalid function return type: "..s)
-  end
-  --local m = split(t[1],'%s%s*')
-  local m = split_c_tokens(t[1],'%s+')
-  return _Declaration{
-   name = t[2]..tmpdef,
-   ptr = '*',
-   ret = '*',
-   --type = rebuild_template(m[m.n], tb, timpl),
-   type = m[m.n],
-   mod = concat(m,1,m.n-1),
-   is_parameter = is_parameter,
-   kind = kind
-  }
- end
-
- -- check the form: mod type& name
- t = split_c_tokens(s,'&')
- if t.n == 2 then
-  --local m = split(t[1],'%s%s*')
-  local m = split_c_tokens(t[1],'%s+')
-  return _Declaration{
-   name = t[2]..tmpdef,
-   ptr = '&',
-   --type = rebuild_template(m[m.n], tb, timpl),
-   type = m[m.n],
-   mod = concat(m,1,m.n-1),
-   is_parameter = is_parameter,
-   kind = kind
-  }
- end
-
- -- check the form: mod type* name
- local s1 = gsub(s,"(%b\[\])",function (n) return gsub(n,'%*','\1') end)
- t = split_c_tokens(s1,'%*')
- if t.n == 2 then
-  t[2] = gsub(t[2],'\1','%*') -- restore * in dimension expression
-  --local m = split(t[1],'%s%s*')
-  local m = split_c_tokens(t[1],'%s+')
-  return _Declaration{
-   name = t[2]..tmpdef,
-   ptr = '*',
-   type = m[m.n],
-   --type = rebuild_template(m[m.n], tb, timpl),
-   mod = concat(m,1,m.n-1)   ,
-   is_parameter = is_parameter,
-   kind = kind
-  }
- end
-
- if kind == 'var' then
-  -- check the form: mod type name
-  --t = split(s,'%s%s*')
-  t = split_c_tokens(s,'%s+')
-  local v
-  if findtype(t[t.n]) then v = create_varname() else v = t[t.n]; t.n = t.n-1 end
-  return _Declaration{
-   name = v..tmpdef,
-   --type = rebuild_template(t[t.n], tb, timpl),
-   type = t[t.n],
-   mod = concat(t,1,t.n-1),
-   is_parameter = is_parameter,
-   kind = kind
-  }
-
- else -- kind == "func"
-
-  -- check the form: mod type name
-  --t = split(s,'%s%s*')
-  t = split_c_tokens(s,'%s+')
-  local v = t[t.n]  -- last word is the function name
-  local tp,md
-  if t.n>1 then
-   tp = t[t.n-1]
-   md = concat(t,1,t.n-2)
-  end
-  --if tp then tp = rebuild_template(tp, tb, timpl) end
-  return _Declaration{
-   name = v,
-   type = tp,
-   mod = md,
-   is_parameter = is_parameter,
-   kind = kind
-  }
- end
-
-end
-
+    -- eliminate spaces if default value is provided
+    s = gsub(s,"%s*=%s*","=")
+    s = gsub(s, "%s*<", "<")
+
+    local defb,tmpdef
+    defb,_,tmpdef = string.find(s, "(=.*)$")
+    if defb then
+        s = string.gsub(s, "=.*$", "")
+    else
+        tmpdef = ''
+    end
+    if kind == "var" then
+        -- check the form: void
+        if s == '' or s == 'void' then
+            return _Declaration{type = 'void', kind = kind, is_parameter = is_parameter}
+        end
+    end
+
+    -- check the form: mod type*& name
+    local t = split_c_tokens(s,'%*%s*&')
+    if t.n == 2 then
+        if kind == 'func' then
+            error("#invalid function return type: "..s)
+        end
+        --local m = split(t[1],'%s%s*')
+        local m = split_c_tokens(t[1],'%s+')
+        return _Declaration {
+            name = t[2]..tmpdef,
+            ptr = '*',
+            ret = '&',
+            --type = rebuild_template(m[m.n], tb, timpl),
+            type = m[m.n],
+            mod = concat(m,1,m.n-1),
+            is_parameter = is_parameter,
+            kind = kind
+        }
+    end
+
+    -- check the form: mod type** name
+    t = split_c_tokens(s,'%*%s*%*')
+    if t.n == 2 then
+        if kind == 'func' then
+            error("#invalid function return type: "..s)
+        end
+        --local m = split(t[1],'%s%s*')
+        local m = split_c_tokens(t[1],'%s+')
+        return _Declaration {
+            name = t[2]..tmpdef,
+            ptr = '*',
+            ret = '*',
+            --type = rebuild_template(m[m.n], tb, timpl),
+            type = m[m.n],
+            mod = concat(m,1,m.n-1),
+            is_parameter = is_parameter,
+            kind = kind
+        }
+    end
+
+    -- check the form: mod type& name
+    t = split_c_tokens(s,'&')
+    if t.n == 2 then
+        --local m = split(t[1],'%s%s*')
+        local m = split_c_tokens(t[1],'%s+')
+        return _Declaration {
+            name = t[2]..tmpdef,
+            ptr = '&',
+            --type = rebuild_template(m[m.n], tb, timpl),
+            type = m[m.n],
+            mod = concat(m,1,m.n-1),
+            is_parameter = is_parameter,
+            kind = kind
+        }
+    end
+
+    -- check the form: mod type* name
+    local s1 = gsub(s,"(%b\[\])",function (n) return gsub(n,'%*','\1') end)
+    t = split_c_tokens(s1,'%*')
+    if t.n == 2 then
+        t[2] = gsub(t[2],'\1','%*') -- restore * in dimension expression
+        --local m = split(t[1],'%s%s*')
+        local m = split_c_tokens(t[1],'%s+')
+        return _Declaration {
+            name = t[2]..tmpdef,
+            ptr = '*',
+            type = m[m.n],
+            --type = rebuild_template(m[m.n], tb, timpl),
+            mod = concat(m,1,m.n-1)   ,
+            is_parameter = is_parameter,
+            kind = kind
+        }
+    end
+
+    if kind == 'var' then
+        -- check the form: mod type name
+        --t = split(s,'%s%s*')
+        t = split_c_tokens(s,'%s+')
+        local v
+        if findtype(t[t.n]) then v = create_varname() else v = t[t.n]; t.n = t.n-1 end
+        return _Declaration {
+            name = v..tmpdef,
+            --type = rebuild_template(t[t.n], tb, timpl),
+            type = t[t.n],
+            mod = concat(t,1,t.n-1),
+            is_parameter = is_parameter,
+            kind = kind
+        }
+
+    else -- kind == "func"
+
+        -- check the form: mod type name
+        --t = split(s,'%s%s*')
+        t = split_c_tokens(s,'%s+')
+        local v = t[t.n]  -- last word is the function name
+        local tp,md
+        if t.n>1 then
+            tp = t[t.n-1]
+            md = concat(t,1,t.n-2)
+        end
+        --if tp then tp = rebuild_template(tp, tb, timpl) end
+        return _Declaration {
+            name = v,
+            type = tp,
+            mod = md,
+            is_parameter = is_parameter,
+            kind = kind
+        }
+    end
+
+end
+
Index: /code/branches/buildsystem3/src/tolua/lua/define.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/define.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/define.lua	(revision 2664)
@@ -16,5 +16,5 @@
 --   name = constant name
 classDefine = {
- name = '',
+    name = '',
 }
 classDefine.__index = classDefine
@@ -23,18 +23,18 @@
 -- register define
 function classDefine:register (pre)
-	if not self:check_public_access() then
-		return
-	end
+    if not self:check_public_access() then
+        return
+    end
 
- pre = pre or ''
- output(pre..'tolua_constant(tolua_S,"'..self.lname..'",'..self.name..');')
+    pre = pre or ''
+    output(pre..'tolua_constant(tolua_S,"'..self.lname..'",'..self.name..');')
 end
 
 -- Print method
 function classDefine:print (ident,close)
- print(ident.."Define{")
- print(ident.." name = '"..self.name.."',")
- print(ident.." lname = '"..self.lname.."',")
- print(ident.."}"..close)
+    print(ident.."Define{")
+    print(ident.." name = '"..self.name.."',")
+    print(ident.." lname = '"..self.lname.."',")
+    print(ident.."}"..close)
 end
 
@@ -42,13 +42,13 @@
 -- Internal constructor
 function _Define (t)
- setmetatable(t,classDefine)
- t:buildnames()
+    setmetatable(t,classDefine)
+    t:buildnames()
 
- if t.name == '' then
-  error("#invalid define")
- end
+    if t.name == '' then
+        error("#invalid define")
+    end
 
- append(t)
- return t
+    append(t)
+    return t
 end
 
@@ -56,7 +56,7 @@
 -- Expects a string representing the constant name
 function Define (n)
- return _Define{
-  name = n
- }
+    return _Define {
+        name = n
+    }
 end
 
Index: /code/branches/buildsystem3/src/tolua/lua/doit.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/doit.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/doit.lua	(revision 2664)
@@ -14,82 +14,113 @@
 function parse_extra()
 
-	for k,v in ipairs(_extra_parameters or {}) do
-		
-		local b,e,name,value = string.find(v, "^([^=])=(.*)$")
-		if b then
-			_extra_parameters[name] = value
-		else
-			_extra_parameters[v] = true
-		end
-	end
+    for k,v in ipairs(_extra_parameters or {}) do
+        
+        local b,e,name,value = string.find(v, "^([^=])=(.*)$")
+        if b then
+            _extra_parameters[name] = value
+        else
+            _extra_parameters[v] = true
+        end
+    end
 end
 
 function doit ()
-	-- define package name, if not provided
-	if not flags.n then
-		if flags.f then
-			flags.n = gsub(flags.f,"%..*$","")
-			_,_,flags.n = string.find(flags.n, "([^/\\]*)$")
-		else
-			error("#no package name nor input file provided")
-		end
-	end
+    -- define package name, if not provided
+    if not flags.n then
+        if flags.f then
+            flags.n = gsub(flags.f,"%..*$","")
+            _,_,flags.n = string.find(flags.n, "([^/\\]*)$")
+        else
+            error("#no package name nor input file provided")
+        end
+    end
 
-	-- parse table with extra paramters
-	parse_extra()
+    -- parse table with extra paramters
+    parse_extra()
 
-	-- do this after setting the package name
-	if flags['L'] then
-		dofile(flags['L'])
-	end
+    -- get potential working directory
+    if not flags.w then
+        flags.w = ''
+    end
 
-	-- add cppstring
-	if not flags['S'] then
-		_basic['string'] = 'cppstring'
-		_basic['std::string'] = 'cppstring'
-		_basic_ctype.cppstring = 'const char*'
-	end
+    -- do this after setting the package name
+    if flags.L then
+        if string.sub(flags.L, 1, 1) == '/' or string.sub(flags.L, 1, 1) == '\\' or (string.len(flags.L) > 1 and string.sub(flags.L, 2, 2) == ':') then
+            dofile(flags.L)
+        else
+            dofile(flags.w..'/'..flags.L)
+        end
+    end
 
-	-- proccess package
-	local p  = Package(flags.n,flags.f)
+    -- add cppstring
+    if not flags.S then
+        _basic['string'] = 'cppstring'
+        _basic['std::string'] = 'cppstring'
+        _basic_ctype.cppstring = 'const char*'
+    end
 
-	if flags.p then
-		return        -- only parse
-	end
+    -- proccess package
+    local file
+    if flags.f then
+        if string.sub(flags.f, 1, 1) == '/' or string.sub(flags.f, 1, 1) == '\\' or (string.len(flags.f) > 1 and string.sub(flags.f, 2, 2) == ':') then
+            file = flags.f
+        else
+            file = flags.w..'/'..flags.f
+        end
+    else
+        file = flags.f
+    end
+    local p  = Package(flags.n, file)
 
-	if flags.o then
-		local st,msg = writeto(flags.o)
-		if not st then
-			error('#'..msg)
-		end
-	end
+    if flags.p then
+        return        -- only parse
+    end
 
-	p:decltype()
-	if flags.P then
-		p:print()
-	else
-		p:preamble()
-		p:supcode()
-		p:register()
-		push(p)
-		post_output_hook(p)
-		pop()
-	end
+    if flags.o then
+        local file
+        if string.sub(flags.o, 1, 1) == '/' or string.sub(flags.o, 1, 1) == '\\' or (string.len(flags.o) > 1 and string.sub(flags.o, 2, 2) == ':') then
+            file = flags.o
+        else
+            file = flags.w..'/'..flags.o
+        end
+        local st,msg = writeto(file)
+        if not st then
+            error('#'..msg)
+        end
+    end
 
-	if flags.o then
-		writeto()
-	end
+    p:decltype()
+    if flags.P then
+        p:print()
+    else
+        p:preamble()
+        p:supcode()
+        p:register()
+        push(p)
+        post_output_hook(p)
+        pop()
+    end
 
-	-- write header file
-	if not flags.P then
-		if flags.H then
-			local st,msg = writeto(flags.H)
-			if not st then
-				error('#'..msg)
-			end
-			p:header()
-			writeto()
-		end
-	end
+    if flags.o then
+        writeto()
+    end
+
+    -- write header file
+    if not flags.P then
+        if flags.H then
+            local file
+            if string.sub(flags.H, 1, 1) == '/' or string.sub(flags.H, 1, 1) == '\\' or (string.len(flags.H) > 1 and string.sub(flags.H, 2, 2) == ':') then
+                file = flags.H
+            else
+                file = flags.w..'/'..flags.H
+            end
+            local st,msg = writeto(file)
+            if not st then
+                error('#'..msg)
+            end
+            p:header()
+            writeto()
+        end
+    end
 end
 
Index: /code/branches/buildsystem3/src/tolua/lua/enumerate.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/enumerate.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/enumerate.lua	(revision 2664)
@@ -22,40 +22,40 @@
 -- register enumeration
 function classEnumerate:register (pre)
- pre = pre or ''
- local nspace = getnamespace(classContainer.curr)
- local i=1
- while self[i] do
-  output(pre..'tolua_constant(tolua_S,"'..self.lnames[i]..'",'..nspace..self[i]..');')
-  i = i+1
- end
+    pre = pre or ''
+    local nspace = getnamespace(classContainer.curr)
+    local i=1
+    while self[i] do
+        output(pre..'tolua_constant(tolua_S,"'..self.lnames[i]..'",'..nspace..self[i]..');')
+        i = i+1
+    end
 end
 
 -- Print method
 function classEnumerate:print (ident,close)
- print(ident.."Enumerate{")
- print(ident.." name = "..self.name)
- local i=1
- while self[i] do
-  print(ident.." '"..self[i].."'("..self.lnames[i].."),")
-  i = i+1
- end
- print(ident.."}"..close)
+    print(ident.."Enumerate{")
+    print(ident.." name = "..self.name)
+    local i=1
+    while self[i] do
+        print(ident.." '"..self[i].."'("..self.lnames[i].."),")
+        i = i+1
+    end
+    print(ident.."}"..close)
 end
 
 -- Internal constructor
 function _Enumerate (t,varname)
- setmetatable(t,classEnumerate)
- append(t)
- appendenum(t)
-	 if varname and varname ~= "" then
-		if t.name ~= "" then
-			Variable(t.name.." "..varname)
-		else
-			local ns = getcurrnamespace()
-			warning("Variable "..ns..varname.." of type <anonymous enum> is declared as read-only")
-			Variable("tolua_readonly int "..varname)
-		end
-	end
-return t
+    setmetatable(t,classEnumerate)
+    append(t)
+    appendenum(t)
+    if varname and varname ~= "" then
+        if t.name ~= "" then
+            Variable(t.name.." "..varname)
+        else
+            local ns = getcurrnamespace()
+            warning("Variable "..ns..varname.." of type <anonymous enum> is declared as read-only")
+            Variable("tolua_readonly int "..varname)
+        end
+    end
+    return t
 end
 
@@ -63,33 +63,33 @@
 -- Expects a string representing the enumerate body
 function Enumerate (n,b,varname)
-	b = string.gsub(b, ",[%s\n]*}", "\n}") -- eliminate last ','
- local t = split(strsub(b,2,-2),',') -- eliminate braces
- local i = 1
- local e = {n=0}
- while t[i] do
-  local tt = split(t[i],'=')  -- discard initial value
-  e.n = e.n + 1
-  e[e.n] = tt[1]
-  i = i+1
- end
- -- set lua names
- i  = 1
- e.lnames = {}
- local ns = getcurrnamespace()
- while e[i] do
-  local t = split(e[i],'@')
-  e[i] = t[1]
-		if not t[2] then
-		 t[2] = applyrenaming(t[1])
-		end
-  e.lnames[i] = t[2] or t[1]
-  _global_enums[ ns..e[i] ] = (ns..e[i])
-  i = i+1
- end
-	e.name = n
-	if n ~= "" then
-		Typedef("int "..n)
-	end
- return _Enumerate(e, varname)
+    b = string.gsub(b, ",[%s\n]*}", "\n}") -- eliminate last ','
+    local t = split(strsub(b,2,-2),',') -- eliminate braces
+    local i = 1
+    local e = {n=0}
+    while t[i] do
+        local tt = split(t[i],'=')  -- discard initial value
+        e.n = e.n + 1
+        e[e.n] = tt[1]
+        i = i+1
+    end
+    -- set lua names
+    i  = 1
+    e.lnames = {}
+    local ns = getcurrnamespace()
+    while e[i] do
+        local t = split(e[i],'@')
+        e[i] = t[1]
+        if not t[2] then
+            t[2] = applyrenaming(t[1])
+        end
+        e.lnames[i] = t[2] or t[1]
+        _global_enums[ ns..e[i] ] = (ns..e[i])
+        i = i+1
+    end
+    e.name = n
+    if n ~= "" then
+        Typedef("int "..n)
+    end
+    return _Enumerate(e, varname)
 end
 
Index: /code/branches/buildsystem3/src/tolua/lua/feature.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/feature.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/feature.lua	(revision 2664)
@@ -40,49 +40,49 @@
 -- check if it requires collection
 function classFeature:requirecollection (t)
- return false
+    return false
 end
 
 -- build names
 function classFeature:buildnames ()
- if self.name and self.name~='' then
-  local n = split(self.name,'@')
-  self.name = n[1]
-  if not n[2] then
-   n[2] = applyrenaming(n[1])
-  end
-  self.lname = n[2] or gsub(n[1],"%[.-%]","")
-  self.original_name = self.name
-  self.lname = clean_template(self.lname)
- end
- if not self.is_parameter then
-	 self.name = getonlynamespace() .. self.name
- end
+    if self.name and self.name~='' then
+        local n = split(self.name,'@')
+        self.name = n[1]
+        if not n[2] then
+            n[2] = applyrenaming(n[1])
+        end
+        self.lname = n[2] or gsub(n[1],"%[.-%]","")
+        self.original_name = self.name
+        self.lname = clean_template(self.lname)
+    end
+    if not self.is_parameter then
+        self.name = getonlynamespace() .. self.name
+    end
 
- local parent = classContainer.curr
- if parent then
- 	self.access = parent.curr_member_access
- else
- end
+    local parent = classContainer.curr
+    if parent then
+        self.access = parent.curr_member_access
+    else
+    end
 end
 
 function classFeature:check_public_access()
 
-	if self.access and self.access ~= 0 then
-		return false
-	end
+    if self.access and self.access ~= 0 then
+        return false
+    end
 
-	local parent = classContainer.curr
-	while parent do
-		if parent.access and parent.access ~= 0 then
-			return false
-		end
-		parent = parent.prox
-	end
-	return true
+    local parent = classContainer.curr
+    while parent do
+        if parent.access and parent.access ~= 0 then
+            return false
+        end
+        parent = parent.prox
+    end
+    return true
 end
 
 function clean_template(t)
 
-	return string.gsub(t, "[<>:, %*]", "_")
+    return string.gsub(t, "[<>:, %*]", "_")
 end
 
@@ -90,26 +90,26 @@
 -- it returns the container class name or nil.
 function classFeature:incontainer (which)
- if self.parent then
-  local parent = self.parent
-  while parent do
-   if parent.classtype == which then
-    return parent.name
-   end
-   parent = parent.parent
-  end
- end
- return nil
+    if self.parent then
+        local parent = self.parent
+        while parent do
+            if parent.classtype == which then
+                return parent.name
+            end
+            parent = parent.parent
+        end
+    end
+    return nil
 end
 
 function classFeature:inclass ()
- return self:incontainer('class')
+    return self:incontainer('class')
 end
 
 function classFeature:inmodule ()
- return self:incontainer('module')
+    return self:incontainer('module')
 end
 
 function classFeature:innamespace ()
- return self:incontainer('namespace')
+    return self:incontainer('namespace')
 end
 
@@ -118,11 +118,11 @@
 function classFeature:cfuncname (n)
 
- if self.parent then
-  n = self.parent:cfuncname(n)
- end
+    if self.parent then
+        n = self.parent:cfuncname(n)
+    end
 
-  n = string.gsub(n..'_'.. (self.lname or self.name), "[<>:, \.%*&]", "_")
+    n = string.gsub(n..'_'.. (self.lname or self.name), "[<>:, \.%*&]", "_")
 
-  return n
+    return n
 end
 
Index: /code/branches/buildsystem3/src/tolua/lua/function.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/function.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/function.lua	(revision 2664)
@@ -52,7 +52,7 @@
     if e.ret == "nil" then
         output("catch(",nameToEcho," CEGUIDeadException(",exceptionDefs[e.name].var,"))\n{\n")
-	else
-    	output("catch(",nameToEcho,exceptionDefs[e.name].var,")\n{\n")
-	end
+    else
+        output("catch(",nameToEcho,exceptionDefs[e.name].var,")\n{\n")
+    end
 
     -- if just a nil
@@ -141,10 +141,10 @@
 --  const = if it is a method receiving a const "this".
 classFunction = {
- mod = '',
- type = '',
- ptr = '',
- name = '',
- args = {n=0},
- const = '',
+    mod = '',
+    type = '',
+    ptr = '',
+    name = '',
+    args = {n=0},
+    const = '',
 }
 classFunction.__index = classFunction
@@ -153,14 +153,14 @@
 -- declare tags
 function classFunction:decltype ()
- self.type = typevar(self.type)
- if strfind(self.mod,'const') then
-	 self.type = 'const '..self.type
-		self.mod = gsub(self.mod,'const','')
-	end
- local i=1
- while self.args[i] do
-  self.args[i]:decltype()
-  i = i+1
- end
+    self.type = typevar(self.type)
+    if strfind(self.mod,'const') then
+        self.type = 'const '..self.type
+        self.mod = gsub(self.mod,'const','')
+    end
+    local i=1
+    while self.args[i] do
+        self.args[i]:decltype()
+        i = i+1
+    end
 end
 
@@ -170,328 +170,328 @@
 function classFunction:supcode (local_constructor)
 
- local overload = strsub(self.cname,-2,-1) - 1  -- indicate overloaded func
- local nret = 0      -- number of returned values
- local class = self:inclass()
- local _,_,static = strfind(self.mod,'^%s*(static)')
- if class then
-
- 	if self.name == 'new' and self.parent.flags.pure_virtual then
- 		-- no constructor for classes with pure virtual methods
- 		return
- 	end
-
- 	if local_constructor then
-		output("/* method: new_local of class ",class," */")
-	else
-		output("/* method:",self.name," of class ",class," */")
-	end
- else
-  output("/* function:",self.name," */")
- end
-
- if local_constructor then
-  output("#ifndef TOLUA_DISABLE_"..self.cname.."_local")
-  output("\nstatic int",self.cname.."_local","(lua_State* tolua_S)")
- else
-  output("#ifndef TOLUA_DISABLE_"..self.cname)
-  output("\nstatic int",self.cname,"(lua_State* tolua_S)")
- end
- output("{")
-
- -- check types
-	if overload < 0 then
-	 output('#ifndef TOLUA_RELEASE\n')
-	end
-	output(' tolua_Error tolua_err;')
- output(' if (\n')
- -- check self
- local narg
- if class then narg=2 else narg=1 end
- if class then
-		local func = 'tolua_isusertype'
-		local type = self.parent.type
-		if self.name=='new' or static~=nil then
-			func = 'tolua_isusertable'
-			type = self.parent.type
-		end
-		if self.const ~= '' then
-			type = "const "..type
-		end
-		output('     !'..func..'(tolua_S,1,"'..type..'",0,&tolua_err) ||\n')
- end
- -- check args
- if self.args[1].type ~= 'void' then
-  local i=1
-  while self.args[i] do
-   local btype = isbasic(self.args[i].type)
-   if btype ~= 'value' and btype ~= 'state' then
-    output('     !'..self.args[i]:outchecktype(narg)..' ||\n')
-   end
-   if btype ~= 'state' then
-	   narg = narg+1
-   end
-   i = i+1
-  end
- end
- -- check end of list
- output('     !tolua_isnoobj(tolua_S,'..narg..',&tolua_err)\n )')
-	output('  goto tolua_lerror;')
-
- output(' else\n')
-	if overload < 0 then
-	 output('#endif\n')
-	end
-	output(' {')
-
- -- declare self, if the case
- local narg
- if class then narg=2 else narg=1 end
- if class and self.name~='new' and static==nil then
-  output(' ',self.const,self.parent.type,'*','self = ')
-  output('(',self.const,self.parent.type,'*) ')
-  output('tolua_tousertype(tolua_S,1,0);')
- elseif static then
-  _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)')
- end
- -- declare parameters
- if self.args[1].type ~= 'void' then
-  local i=1
-  while self.args[i] do
-   self.args[i]:declare(narg)
-   if isbasic(self.args[i].type) ~= "state" then
-	   narg = narg+1
-   end
-   i = i+1
-  end
- end
-
- -- check self
- if class and self.name~='new' and static==nil then
-	 output('#ifndef TOLUA_RELEASE\n')
-  output('  if (!self) tolua_error(tolua_S,"invalid \'self\' in function \''..self.name..'\'",NULL);');
-	 output('#endif\n')
- end
-
- -- get array element values
- if class then narg=2 else narg=1 end
- if self.args[1].type ~= 'void' then
-  local i=1
-  while self.args[i] do
-   self.args[i]:getarray(narg)
-   narg = narg+1
-   i = i+1
-  end
- end
-
- --------------------------------------------------
- -- CEGUILua mod
- -- init exception handling
- local throws = false
- do
-  local pattern = "tolua_throws|.*|"
-  local i,j = string.find(self.mod, pattern)
-  if i then
-   throws = {}
-   -- ensure table is empty.  Used to be: table.setn(throws,0)
-   for x in pairs(throws) do
-     throws[x] = nil
-   end
-   local excepts = string.sub(self.mod, i+12,j)
-   local epattern = "|.-|"
-   local i,j = string.find(excepts, epattern)
-   while i do
-    local e = string.sub(excepts,i+1,j-1)
-    local _,_,name,rest = string.find(e, "([%w:_]+),?(.*)")
-    table.insert(throws,{name=name, ret=rest})
-    i,j = string.find(excepts, epattern, j)
-   end
-   self.mod = string.gsub(self.mod, pattern, "")
-  end
- end
- local exRaiseError = false
- --------------------------------------------------
-
- local out = string.find(self.mod, "tolua_outside")
-
- ---------------
- -- CEGUILua mod
- -- remove "tolua_outside" from self.mod
- if out then
-    self.mod = string.gsub(self.mod, "tolua_outside", "")
- end
-
- -- call function
- if class and self.name=='delete' then
-  output('  delete self;')
- elseif class and self.name == 'operator&[]' then
-  if flags['1'] then -- for compatibility with tolua5 ?
-	output('  self->operator[](',self.args[1].name,'-1) = ',self.args[2].name,';')
-  else
-    output('  self->operator[](',self.args[1].name,') = ',self.args[2].name,';')
-  end
- else
-  -- CEGUILua mod begin- throws
-  if throws then
-    for i=1,table.getn(throws) do
-        if string.find(throws[i].ret, "error") then
-            output("char errorBuffer["..exceptionMessageBufferSize.."];\n")
-            output("bool errorDoIt = false;\n")
-            exRaiseError = true
-            break
-        end
-    end
-    output("try\n")
-  end
-  -- CEGUILua mod end - throws
-  output('  {')
-  if self.type ~= '' and self.type ~= 'void' then
-   output('  ',self.mod,self.type,self.ptr,'tolua_ret = ')
-   output('(',self.mod,self.type,self.ptr,') ')
-  else
-   output('  ')
-  end
-  if class and self.name=='new' then
-   output('new',self.type,'(')
-  elseif class and static then
-	if out then
-		output(self.name,'(')
-	else
-		output(class..'::'..self.name,'(')
-	end
-  elseif class then
-	if out then
-		output(self.name,'(')
-	else
-	  if self.cast_operator then
-	  	output('static_cast<',self.mod,self.type,self.ptr,'>(*self')
-	  else
-		output('self->'..self.name,'(')
-	  end
-	end
-  else
-   output(self.name,'(')
-  end
-
-  if out and not static then
-  	output('self')
-	if self.args[1] and self.args[1].name ~= '' then
-		output(',')
-	end
-  end
-  -- write parameters
-  local i=1
-  while self.args[i] do
-   self.args[i]:passpar()
-   i = i+1
-   if self.args[i] then
-    output(',')
-   end
-  end
-
-  if class and self.name == 'operator[]' and flags['1'] then
-	output('-1);')
-  else
-	output(');')
-  end
-
-  -- return values
-  if self.type ~= '' and self.type ~= 'void' then
-   nret = nret + 1
-   local t,ct = isbasic(self.type)
-   if t then
-   	if self.cast_operator and _basic_raw_push[t] then
-		output('   ',_basic_raw_push[t],'(tolua_S,(',ct,')tolua_ret);')
-   	else
-	    output('   tolua_push'..t..'(tolua_S,(',ct,')tolua_ret);')
-	end
-   else
-			 t = self.type
-			 new_t = string.gsub(t, "const%s+", "")
-    if self.ptr == '' then
-     output('   {')
-     output('#ifdef __cplusplus\n')
-     output('    void* tolua_obj = new',new_t,'(tolua_ret);')
-     output('    tolua_pushusertype_and_takeownership(tolua_S,tolua_obj,"',t,'");')
-     output('#else\n')
-     output('    void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(',t,'));')
-     output('    tolua_pushusertype_and_takeownership(tolua_S,tolua_obj,"',t,'");')
-     output('#endif\n')
-     output('   }')
-    elseif self.ptr == '&' then
-     output('   tolua_pushusertype(tolua_S,(void*)&tolua_ret,"',t,'");')
-    else
-    	if local_constructor then
-	  output('   tolua_pushusertype_and_takeownership(tolua_S,(void *)tolua_ret,"',t,'");')
-    	else
-		     output('   tolua_pushusertype(tolua_S,(void*)tolua_ret,"',t,'");')
-	    end
-    end
-   end
-  end
-  local i=1
-  while self.args[i] do
-   nret = nret + self.args[i]:retvalue()
-   i = i+1
-  end
-  output('  }')
-
-  ------------------------------------------
-  -- CEGUILua mod
-  -- finish exception handling
-  -- catch
-  if throws then
-   outputExceptionCatchBlocks(self.name, throws, exRaiseError)
-  end
-  ------------------------------------------
-
-  -- set array element values
-  if class then narg=2 else narg=1 end
-  if self.args[1].type ~= 'void' then
-   local i=1
-   while self.args[i] do
-    self.args[i]:setarray(narg)
-    narg = narg+1
-    i = i+1
-   end
-  end
-
-  -- free dynamically allocated array
-  if self.args[1].type ~= 'void' then
-   local i=1
-   while self.args[i] do
-    self.args[i]:freearray()
-    i = i+1
-   end
-  end
- end
-
- output(' }')
- output(' return '..nret..';')
-
- -- call overloaded function or generate error
-	if overload < 0 then
-
-		output('#ifndef TOLUA_RELEASE\n')
-		output('tolua_lerror:\n')
-		output(' tolua_error(tolua_S,"#ferror in function \''..self.lname..'\'.",&tolua_err);')
-		output(' return 0;')
-		output('#endif\n')
-	else
-		local _local = ""
-		if local_constructor then
-			_local = "_local"
-		end
-		output('tolua_lerror:\n')
-		output(' return '..strsub(self.cname,1,-3)..format("%02d",overload).._local..'(tolua_S);')
-	end
- output('}')
- output('#endif //#ifndef TOLUA_DISABLE\n')
- output('\n')
-
-	-- recursive call to write local constructor
-	if class and self.name=='new' and not local_constructor then
-
-		self:supcode(1)
-	end
+    local overload = strsub(self.cname,-2,-1) - 1  -- indicate overloaded func
+    local nret = 0      -- number of returned values
+    local class = self:inclass()
+    local _,_,static = strfind(self.mod,'^%s*(static)')
+    if class then
+
+        if self.name == 'new' and self.parent.flags.pure_virtual then
+            -- no constructor for classes with pure virtual methods
+            return
+        end
+
+        if local_constructor then
+           output("/* method: new_local of class ",class," */")
+       else
+           output("/* method:",self.name," of class ",class," */")
+       end
+    else
+        output("/* function:",self.name," */")
+    end
+
+    if local_constructor then
+        output("#ifndef TOLUA_DISABLE_"..self.cname.."_local")
+        output("\nstatic int",self.cname.."_local","(lua_State* tolua_S)")
+    else
+        output("#ifndef TOLUA_DISABLE_"..self.cname)
+        output("\nstatic int",self.cname,"(lua_State* tolua_S)")
+    end
+    output("{")
+
+    -- check types
+    if overload < 0 then
+        output('#ifndef TOLUA_RELEASE\n')
+    end
+    output(' tolua_Error tolua_err;')
+    output(' if (\n')
+    -- check self
+    local narg
+    if class then narg=2 else narg=1 end
+    if class then
+        local func = 'tolua_isusertype'
+        local type = self.parent.type
+        if self.name=='new' or static~=nil then
+            func = 'tolua_isusertable'
+            type = self.parent.type
+        end
+        if self.const ~= '' then
+            type = "const "..type
+        end
+        output('     !'..func..'(tolua_S,1,"'..type..'",0,&tolua_err) ||\n')
+    end
+    -- check args
+    if self.args[1].type ~= 'void' then
+        local i=1
+        while self.args[i] do
+            local btype = isbasic(self.args[i].type)
+            if btype ~= 'value' and btype ~= 'state' then
+                output('     !'..self.args[i]:outchecktype(narg)..' ||\n')
+            end
+            if btype ~= 'state' then
+                narg = narg+1
+            end
+            i = i+1
+        end
+    end
+    -- check end of list
+    output('     !tolua_isnoobj(tolua_S,'..narg..',&tolua_err)\n )')
+    output('  goto tolua_lerror;')
+
+    output(' else\n')
+    if overload < 0 then
+        output('#endif\n')
+    end
+    output(' {')
+
+    -- declare self, if the case
+    local narg
+    if class then narg=2 else narg=1 end
+    if class and self.name~='new' and static==nil then
+        output(' ',self.const,self.parent.type,'*','self = ')
+        output('(',self.const,self.parent.type,'*) ')
+        output('tolua_tousertype(tolua_S,1,0);')
+    elseif static then
+        _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)')
+    end
+    -- declare parameters
+    if self.args[1].type ~= 'void' then
+        local i=1
+        while self.args[i] do
+            self.args[i]:declare(narg)
+            if isbasic(self.args[i].type) ~= "state" then
+                narg = narg+1
+            end
+            i = i+1
+        end
+    end
+
+    -- check self
+    if class and self.name~='new' and static==nil then
+        output('#ifndef TOLUA_RELEASE\n')
+        output('  if (!self) tolua_error(tolua_S,"invalid \'self\' in function \''..self.name..'\'",NULL);');
+        output('#endif\n')
+    end
+
+    -- get array element values
+    if class then narg=2 else narg=1 end
+    if self.args[1].type ~= 'void' then
+        local i=1
+        while self.args[i] do
+            self.args[i]:getarray(narg)
+            narg = narg+1
+            i = i+1
+        end
+    end
+
+    --------------------------------------------------
+    -- CEGUILua mod
+    -- init exception handling
+    local throws = false
+    do
+        local pattern = "tolua_throws|.*|"
+        local i,j = string.find(self.mod, pattern)
+        if i then
+            throws = {}
+            -- ensure table is empty.  Used to be: table.setn(throws,0)
+            for x in pairs(throws) do
+                throws[x] = nil
+            end
+            local excepts = string.sub(self.mod, i+12,j)
+            local epattern = "|.-|"
+            local i,j = string.find(excepts, epattern)
+            while i do
+                local e = string.sub(excepts,i+1,j-1)
+                local _,_,name,rest = string.find(e, "([%w:_]+),?(.*)")
+                table.insert(throws,{name=name, ret=rest})
+                i,j = string.find(excepts, epattern, j)
+            end
+            self.mod = string.gsub(self.mod, pattern, "")
+        end
+    end
+    local exRaiseError = false
+    --------------------------------------------------
+
+    local out = string.find(self.mod, "tolua_outside")
+
+    ---------------
+    -- CEGUILua mod
+    -- remove "tolua_outside" from self.mod
+    if out then
+        self.mod = string.gsub(self.mod, "tolua_outside", "")
+    end
+
+    -- call function
+    if class and self.name=='delete' then
+        output('  delete self;')
+    elseif class and self.name == 'operator&[]' then
+        if flags['1'] then -- for compatibility with tolua5 ?
+            output('  self->operator[](',self.args[1].name,'-1) = ',self.args[2].name,';')
+        else
+            output('  self->operator[](',self.args[1].name,') = ',self.args[2].name,';')
+        end
+    else
+    -- CEGUILua mod begin- throws
+    if throws then
+        for i=1,table.getn(throws) do
+            if string.find(throws[i].ret, "error") then
+                output("char errorBuffer["..exceptionMessageBufferSize.."];\n")
+                output("bool errorDoIt = false;\n")
+                exRaiseError = true
+                break
+            end
+        end
+        output("try\n")
+    end
+    -- CEGUILua mod end - throws
+    output('  {')
+    if self.type ~= '' and self.type ~= 'void' then
+        output('  ',self.mod,self.type,self.ptr,'tolua_ret = ')
+        output('(',self.mod,self.type,self.ptr,') ')
+    else
+        output('  ')
+    end
+    if class and self.name=='new' then
+        output('new',self.type,'(')
+    elseif class and static then
+        if out then
+            output(self.name,'(')
+        else
+            output(class..'::'..self.name,'(')
+        end
+    elseif class then
+        if out then
+            output(self.name,'(')
+        else
+            if self.cast_operator then
+                output('static_cast<',self.mod,self.type,self.ptr,'>(*self')
+            else
+                output('self->'..self.name,'(')
+            end
+        end
+    else
+        output(self.name,'(')
+    end
+
+    if out and not static then
+        output('self')
+        if self.args[1] and self.args[1].name ~= '' then
+            output(',')
+        end
+    end
+    -- write parameters
+    local i=1
+    while self.args[i] do
+        self.args[i]:passpar()
+        i = i+1
+        if self.args[i] then
+            output(',')
+        end
+    end
+
+    if class and self.name == 'operator[]' and flags['1'] then
+        output('-1);')
+    else
+        output(');')
+    end
+
+    -- return values
+    if self.type ~= '' and self.type ~= 'void' then
+        nret = nret + 1
+        local t,ct = isbasic(self.type)
+        if t then
+            if self.cast_operator and _basic_raw_push[t] then
+                output('   ',_basic_raw_push[t],'(tolua_S,(',ct,')tolua_ret);')
+            else
+                output('   tolua_push'..t..'(tolua_S,(',ct,')tolua_ret);')
+            end
+            else
+                t = self.type
+                new_t = string.gsub(t, "const%s+", "")
+                if self.ptr == '' then
+                    output('   {')
+                    output('#ifdef __cplusplus\n')
+                    output('    void* tolua_obj = new',new_t,'(tolua_ret);')
+                    output('    tolua_pushusertype_and_takeownership(tolua_S,tolua_obj,"',t,'");')
+                    output('#else\n')
+                    output('    void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(',t,'));')
+                    output('    tolua_pushusertype_and_takeownership(tolua_S,tolua_obj,"',t,'");')
+                    output('#endif\n')
+                    output('   }')
+                elseif self.ptr == '&' then
+                    output('   tolua_pushusertype(tolua_S,(void*)&tolua_ret,"',t,'");')
+                else
+                    if local_constructor then
+                        output('   tolua_pushusertype_and_takeownership(tolua_S,(void *)tolua_ret,"',t,'");')
+                    else
+                        output('   tolua_pushusertype(tolua_S,(void*)tolua_ret,"',t,'");')
+                    end
+                end
+            end
+        end
+        local i=1
+        while self.args[i] do
+            nret = nret + self.args[i]:retvalue()
+            i = i+1
+        end
+        output('  }')
+
+        ------------------------------------------
+        -- CEGUILua mod
+        -- finish exception handling
+        -- catch
+        if throws then
+            outputExceptionCatchBlocks(self.name, throws, exRaiseError)
+        end
+        ------------------------------------------
+
+        -- set array element values
+        if class then narg=2 else narg=1 end
+        if self.args[1].type ~= 'void' then
+            local i=1
+            while self.args[i] do
+                self.args[i]:setarray(narg)
+                narg = narg+1
+                i = i+1
+            end
+        end
+
+        -- free dynamically allocated array
+        if self.args[1].type ~= 'void' then
+            local i=1
+            while self.args[i] do
+                self.args[i]:freearray()
+                i = i+1
+            end
+        end
+    end
+
+    output(' }')
+    output(' return '..nret..';')
+
+    -- call overloaded function or generate error
+    if overload < 0 then
+
+        output('#ifndef TOLUA_RELEASE\n')
+        output('tolua_lerror:\n')
+        output(' tolua_error(tolua_S,"#ferror in function \''..self.lname..'\'.",&tolua_err);')
+        output(' return 0;')
+        output('#endif\n')
+    else
+        local _local = ""
+        if local_constructor then
+            _local = "_local"
+        end
+        output('tolua_lerror:\n')
+        output(' return '..strsub(self.cname,1,-3)..format("%02d",overload).._local..'(tolua_S);')
+    end
+    output('}')
+    output('#endif //#ifndef TOLUA_DISABLE\n')
+    output('\n')
+
+    -- recursive call to write local constructor
+    if class and self.name=='new' and not local_constructor then
+
+        self:supcode(1)
+    end
 
 end
@@ -501,61 +501,61 @@
 function classFunction:register (pre)
 
-	if not self:check_public_access() then
-		return
-	end
-
- 	if self.name == 'new' and self.parent.flags.pure_virtual then
- 		-- no constructor for classes with pure virtual methods
- 		return
- 	end
-
- output(pre..'tolua_function(tolua_S,"'..self.lname..'",'..self.cname..');')
-  if self.name == 'new' then
-	  output(pre..'tolua_function(tolua_S,"new_local",'..self.cname..'_local);')
-	  output(pre..'tolua_function(tolua_S,".call",'..self.cname..'_local);')
-	  --output(' tolua_set_call_event(tolua_S,'..self.cname..'_local, "'..self.parent.type..'");')
-  end
+    if not self:check_public_access() then
+        return
+    end
+
+    if self.name == 'new' and self.parent.flags.pure_virtual then
+        -- no constructor for classes with pure virtual methods
+        return
+    end
+
+    output(pre..'tolua_function(tolua_S,"'..self.lname..'",'..self.cname..');')
+    if self.name == 'new' then
+        output(pre..'tolua_function(tolua_S,"new_local",'..self.cname..'_local);')
+        output(pre..'tolua_function(tolua_S,".call",'..self.cname..'_local);')
+        --output(' tolua_set_call_event(tolua_S,'..self.cname..'_local, "'..self.parent.type..'");')
+    end
 end
 
 -- Print method
 function classFunction:print (ident,close)
- print(ident.."Function{")
- print(ident.." mod  = '"..self.mod.."',")
- print(ident.." type = '"..self.type.."',")
- print(ident.." ptr  = '"..self.ptr.."',")
- print(ident.." name = '"..self.name.."',")
- print(ident.." lname = '"..self.lname.."',")
- print(ident.." const = '"..self.const.."',")
- print(ident.." cname = '"..self.cname.."',")
- print(ident.." lname = '"..self.lname.."',")
- print(ident.." args = {")
- local i=1
- while self.args[i] do
-  self.args[i]:print(ident.."  ",",")
-  i = i+1
- end
- print(ident.." }")
- print(ident.."}"..close)
+    print(ident.."Function{")
+    print(ident.." mod  = '"..self.mod.."',")
+    print(ident.." type = '"..self.type.."',")
+    print(ident.." ptr  = '"..self.ptr.."',")
+    print(ident.." name = '"..self.name.."',")
+    print(ident.." lname = '"..self.lname.."',")
+    print(ident.." const = '"..self.const.."',")
+    print(ident.." cname = '"..self.cname.."',")
+    print(ident.." lname = '"..self.lname.."',")
+    print(ident.." args = {")
+    local i=1
+    while self.args[i] do
+        self.args[i]:print(ident.."  ",",")
+        i = i+1
+    end
+    print(ident.." }")
+    print(ident.."}"..close)
 end
 
 -- check if it returns an object by value
 function classFunction:requirecollection (t)
-	local r = false
-	if self.type ~= '' and not isbasic(self.type) and self.ptr=='' then
-		local type = gsub(self.type,"%s*const%s+","")
-	 t[type] = "tolua_collect_" .. clean_template(type)
-	 r = true
-	end
-	local i=1
-	while self.args[i] do
-		r = self.args[i]:requirecollection(t) or r
-		i = i+1
-	end
-	return r
+    local r = false
+    if self.type ~= '' and not isbasic(self.type) and self.ptr=='' then
+        local type = gsub(self.type,"%s*const%s+","")
+        t[type] = "tolua_collect_" .. clean_template(type)
+        r = true
+    end
+    local i=1
+    while self.args[i] do
+        r = self.args[i]:requirecollection(t) or r
+        i = i+1
+    end
+    return r
 end
 
 -- determine lua function name overload
 function classFunction:overload ()
- return self.parent:overload(self.lname)
+    return self.parent:overload(self.lname)
 end
 
@@ -563,44 +563,44 @@
 function param_object(par) -- returns true if the parameter has an object as its default value
 
-	if not string.find(par, '=') then return false end -- it has no default value
-
-	local _,_,def = string.find(par, "=(.*)$")
-
-	if string.find(par, "|") then -- a list of flags
-
-		return true
-	end
-
-	if string.find(par, "%*") then -- it's a pointer with a default value
-
-		if string.find(par, '=%s*new') then -- it's a pointer with an instance as default parameter.. is that valid?
-			return true
-		end
-		return false -- default value is 'NULL' or something
-	end
-
-
-	if string.find(par, "[%(&]") then
-		return true
-	end -- default value is a constructor call (most likely for a const reference)
-
-	--if string.find(par, "&") then
-
-	--	if string.find(def, ":") or string.find(def, "^%s*new%s+") then
-
-	--		-- it's a reference with default to something like Class::member, or 'new Class'
-	--		return true
-	--	end
-	--end
-
-	return false -- ?
+    if not string.find(par, '=') then return false end -- it has no default value
+
+    local _,_,def = string.find(par, "=(.*)$")
+
+    if string.find(par, "|") then -- a list of flags
+
+        return true
+    end
+
+    if string.find(par, "%*") then -- it's a pointer with a default value
+
+        if string.find(par, '=%s*new') then -- it's a pointer with an instance as default parameter.. is that valid?
+            return true
+        end
+        return false -- default value is 'NULL' or something
+    end
+
+
+    if string.find(par, "[%(&]") then
+        return true
+    end -- default value is a constructor call (most likely for a const reference)
+
+    --if string.find(par, "&") then
+
+    --    if string.find(def, ":") or string.find(def, "^%s*new%s+") then
+
+    --        -- it's a reference with default to something like Class::member, or 'new Class'
+    --        return true
+    --    end
+    --end
+
+    return false -- ?
 end
 
 function strip_last_arg(all_args, last_arg) -- strips the default value from the last argument
 
-	local _,_,s_arg = string.find(last_arg, "^([^=]+)")
-	last_arg = string.gsub(last_arg, "([%%%(%)])", "%%%1");
-	all_args = string.gsub(all_args, "%s*,%s*"..last_arg.."%s*%)%s*$", ")")
-	return all_args, s_arg
+    local _,_,s_arg = string.find(last_arg, "^([^=]+)")
+    last_arg = string.gsub(last_arg, "([%%%(%)])", "%%%1");
+    all_args = string.gsub(all_args, "%s*,%s*"..last_arg.."%s*%)%s*$", ")")
+    return all_args, s_arg
 end
 
@@ -609,27 +609,27 @@
 -- Internal constructor
 function _Function (t)
- setmetatable(t,classFunction)
-
- if t.const ~= 'const' and t.const ~= '' then
-  error("#invalid 'const' specification")
- end
-
- append(t)
- if t:inclass() then
- --print ('t.name is '..t.name..', parent.name is '..t.parent.name)
-  if string.gsub(t.name, "%b<>", "") == string.gsub(t.parent.original_name or t.parent.name, "%b<>", "") then
-   t.name = 'new'
-   t.lname = 'new'
-   t.parent._new = true
-   t.type = t.parent.name
-   t.ptr = '*'
-  elseif string.gsub(t.name, "%b<>", "") == '~'..string.gsub(t.parent.original_name or t.parent.name, "%b<>", "") then
-   t.name = 'delete'
-   t.lname = 'delete'
-   t.parent._delete = true
-  end
- end
- t.cname = t:cfuncname("tolua")..t:overload(t)
- return t
+    setmetatable(t,classFunction)
+
+    if t.const ~= 'const' and t.const ~= '' then
+        error("#invalid 'const' specification")
+    end
+
+    append(t)
+    if t:inclass() then
+        --print ('t.name is '..t.name..', parent.name is '..t.parent.name)
+        if string.gsub(t.name, "%b<>", "") == string.gsub(t.parent.original_name or t.parent.name, "%b<>", "") then
+            t.name = 'new'
+            t.lname = 'new'
+            t.parent._new = true
+            t.type = t.parent.name
+            t.ptr = '*'
+        elseif string.gsub(t.name, "%b<>", "") == '~'..string.gsub(t.parent.original_name or t.parent.name, "%b<>", "") then
+            t.name = 'delete'
+            t.lname = 'delete'
+            t.parent._delete = true
+        end
+    end
+    t.cname = t:cfuncname("tolua")..t:overload(t)
+    return t
 end
 
@@ -639,81 +639,81 @@
 -- the "const" or empty string.
 function Function (d,a,c)
- --local t = split(strsub(a,2,-2),',') -- eliminate braces
- --local t = split_params(strsub(a,2,-2))
-
-	if not flags['W'] and string.find(a, "%.%.%.%s*%)") then
-
-		warning("Functions with variable arguments (`...') are not supported. Ignoring "..d..a..c)
-		return nil
-	end
-
-
- local i=1
- local l = {n=0}
-
- 	a = string.gsub(a, "%s*([%(%)])%s*", "%1")
-	local t,strip,last = strip_pars(strsub(a,2,-2));
-	if strip then
-		--local ns = string.sub(strsub(a,1,-2), 1, -(string.len(last)+1))
-		local ns = join(t, ",", 1, last-1)
-
-		ns = "("..string.gsub(ns, "%s*,%s*$", "")..')'
-		--ns = strip_defaults(ns)
-
-		Function(d, ns, c)
-		for i=1,last do
-			t[i] = string.gsub(t[i], "=.*$", "")
-		end
-	end
-
- while t[i] do
-  l.n = l.n+1
-  l[l.n] = Declaration(t[i],'var',true)
-  i = i+1
- end
- local f = Declaration(d,'func')
- f.args = l
- f.const = c
- return _Function(f)
+    --local t = split(strsub(a,2,-2),',') -- eliminate braces
+    --local t = split_params(strsub(a,2,-2))
+
+    if not flags['W'] and string.find(a, "%.%.%.%s*%)") then
+
+        warning("Functions with variable arguments (`...') are not supported. Ignoring "..d..a..c)
+        return nil
+    end
+
+
+    local i=1
+    local l = {n=0}
+
+    a = string.gsub(a, "%s*([%(%)])%s*", "%1")
+    local t,strip,last = strip_pars(strsub(a,2,-2));
+    if strip then
+        --local ns = string.sub(strsub(a,1,-2), 1, -(string.len(last)+1))
+        local ns = join(t, ",", 1, last-1)
+
+        ns = "("..string.gsub(ns, "%s*,%s*$", "")..')'
+        --ns = strip_defaults(ns)
+
+        Function(d, ns, c)
+        for i=1,last do
+            t[i] = string.gsub(t[i], "=.*$", "")
+        end
+    end
+
+    while t[i] do
+        l.n = l.n+1
+        l[l.n] = Declaration(t[i],'var',true)
+        i = i+1
+    end
+    local f = Declaration(d,'func')
+    f.args = l
+    f.const = c
+    return _Function(f)
 end
 
 function join(t, sep, first, last)
 
-	first = first or 1
-	last = last or table.getn(t)
-	local lsep = ""
-	local ret = ""
-	local loop = false
-	for i = first,last do
-
-		ret = ret..lsep..t[i]
-		lsep = sep
-		loop = true
-	end
-	if not loop then
-		return ""
-	end
-
-	return ret
+    first = first or 1
+    last = last or table.getn(t)
+    local lsep = ""
+    local ret = ""
+    local loop = false
+    for i = first,last do
+
+        ret = ret..lsep..t[i]
+        lsep = sep
+        loop = true
+    end
+    if not loop then
+        return ""
+    end
+
+    return ret
 end
 
 function strip_pars(s)
 
-	local t = split_c_tokens(s, ',')
-	local strip = false
-	local last
-
-	for i=t.n,1,-1 do
-
-		if not strip and param_object(t[i]) then
-			last = i
-			strip = true
-		end
-		--if strip then
-		--	t[i] = string.gsub(t[i], "=.*$", "")
-		--end
-	end
-
-	return t,strip,last
+    local t = split_c_tokens(s, ',')
+    local strip = false
+    local last
+
+    for i=t.n,1,-1 do
+
+        if not strip and param_object(t[i]) then
+            last = i
+            strip = true
+        end
+        --if strip then
+        --    t[i] = string.gsub(t[i], "=.*$", "")
+        --end
+    end
+
+    return t,strip,last
 
 end
@@ -721,17 +721,17 @@
 function strip_defaults(s)
 
-	s = string.gsub(s, "^%(", "")
-	s = string.gsub(s, "%)$", "")
-
-	local t = split_c_tokens(s, ",")
-	local sep, ret = "",""
-	for i=1,t.n do
-		t[i] = string.gsub(t[i], "=.*$", "")
-		ret = ret..sep..t[i]
-		sep = ","
-	end
-
-	return "("..ret..")"
-end
-
-
+    s = string.gsub(s, "^%(", "")
+    s = string.gsub(s, "%)$", "")
+
+    local t = split_c_tokens(s, ",")
+    local sep, ret = "",""
+    for i=1,t.n do
+        t[i] = string.gsub(t[i], "=.*$", "")
+        ret = ret..sep..t[i]
+        sep = ","
+    end
+
+    return "("..ret..")"
+end
+
+
Index: /code/branches/buildsystem3/src/tolua/lua/module.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/module.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/module.lua	(revision 2664)
@@ -17,5 +17,5 @@
 --    {i} = list of objects in the module.
 classModule = {
- classtype = 'module'
+    classtype = 'module'
 }
 classModule.__index = classModule
@@ -24,34 +24,34 @@
 -- register module
 function classModule:register (pre)
- pre = pre or ''
- push(self)
- output(pre..'tolua_module(tolua_S,"'..self.name..'",',self:hasvar(),');')
- output(pre..'tolua_beginmodule(tolua_S,"'..self.name..'");')
- local i=1
- while self[i] do
-  self[i]:register(pre..' ')
-  i = i+1
- end
- output(pre..'tolua_endmodule(tolua_S);')
-	pop()
+    pre = pre or ''
+    push(self)
+    output(pre..'tolua_module(tolua_S,"'..self.name..'",',self:hasvar(),');')
+    output(pre..'tolua_beginmodule(tolua_S,"'..self.name..'");')
+    local i=1
+    while self[i] do
+        self[i]:register(pre..' ')
+        i = i+1
+    end
+    output(pre..'tolua_endmodule(tolua_S);')
+    pop()
 end
 
 -- Print method
 function classModule:print (ident,close)
- print(ident.."Module{")
- print(ident.." name = '"..self.name.."';")
- local i=1
- while self[i] do
-  self[i]:print(ident.." ",",")
-  i = i+1
- end
- print(ident.."}"..close)
+    print(ident.."Module{")
+    print(ident.." name = '"..self.name.."';")
+    local i=1
+    while self[i] do
+        self[i]:print(ident.." ",",")
+        i = i+1
+    end
+    print(ident.."}"..close)
 end
 
 -- Internal constructor
 function _Module (t)
- setmetatable(t,classModule)
- append(t)
- return t
+    setmetatable(t,classModule)
+    append(t)
+    return t
 end
 
@@ -59,9 +59,9 @@
 -- Expects two string representing the module name and body.
 function Module (n,b)
- local t = _Module(_Container{name=n})
- push(t)
- t:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces
- pop()
- return t
+    local t = _Module(_Container{name=n})
+    push(t)
+    t:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces
+    pop()
+    return t
 end
 
Index: /code/branches/buildsystem3/src/tolua/lua/namespace.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/namespace.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/namespace.lua	(revision 2664)
@@ -17,6 +17,6 @@
 --    {i}  = list of members
 classNamespace = {
- classtype = 'namespace',
- name = '',
+    classtype = 'namespace',
+    name = '',
 }
 classNamespace.__index = classNamespace
@@ -25,19 +25,19 @@
 -- Print method
 function classNamespace:print (ident,close)
- print(ident.."Namespace{")
- print(ident.." name = '"..self.name.."',")
- local i=1
- while self[i] do
-  self[i]:print(ident.." ",",")
-  i = i+1
- end
- print(ident.."}"..close)
+    print(ident.."Namespace{")
+    print(ident.." name = '"..self.name.."',")
+    local i=1
+    while self[i] do
+        self[i]:print(ident.." ",",")
+        i = i+1
+    end
+    print(ident.."}"..close)
 end
 
 -- Internal constructor
 function _Namespace (t)
- setmetatable(t,classNamespace)
- append(t)
- return t
+    setmetatable(t,classNamespace)
+    append(t)
+    return t
 end
 
@@ -45,8 +45,8 @@
 -- Expects the name and the body of the namespace.
 function Namespace (n,b)
- local c = _Namespace(_Container{name=n})
- push(c)
- c:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces
- pop()
+    local c = _Namespace(_Container{name=n})
+    push(c)
+    c:parse(strsub(b,2,strlen(b)-1)) -- eliminate braces
+    pop()
 end
 
Index: /code/branches/buildsystem3/src/tolua/lua/operator.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/operator.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/operator.lua	(revision 2664)
@@ -16,5 +16,5 @@
 --  kind = set of character representing the operator (as it appers in C++ code)
 classOperator = {
- kind = '',
+    kind = '',
 }
 classOperator.__index = classOperator
@@ -22,138 +22,139 @@
 
 -- table to transform operator kind into the appropriate tag method name
-_TM = {['+'] = 'add',
-       ['-'] = 'sub',
-       ['*'] = 'mul',
-       ['/'] = 'div',
-       ['<'] = 'lt',
-       ['<='] = 'le',
-       ['=='] = 'eq',
-       ['[]'] = 'geti',
-       ['&[]'] = 'seti',
-       --['->'] = 'flechita',
-      }
+_TM = {
+    ['+'] = 'add',
+    ['-'] = 'sub',
+    ['*'] = 'mul',
+    ['/'] = 'div',
+    ['<'] = 'lt',
+    ['<='] = 'le',
+    ['=='] = 'eq',
+    ['[]'] = 'geti',
+    ['&[]'] = 'seti',
+    --['->'] = 'flechita',
+}
 
 
 -- Print method
 function classOperator:print (ident,close)
- print(ident.."Operator{")
- print(ident.." kind  = '"..self.kind.."',")
- print(ident.." mod  = '"..self.mod.."',")
- print(ident.." type = '"..self.type.."',")
- print(ident.." ptr  = '"..self.ptr.."',")
- print(ident.." name = '"..self.name.."',")
- print(ident.." const = '"..self.const.."',")
- print(ident.." cname = '"..self.cname.."',")
- print(ident.." lname = '"..self.lname.."',")
- print(ident.." args = {")
- local i=1
- while self.args[i] do
-  self.args[i]:print(ident.."  ",",")
-  i = i+1
- end
- print(ident.." }")
- print(ident.."}"..close)
+    print(ident.."Operator{")
+    print(ident.." kind  = '"..self.kind.."',")
+    print(ident.." mod  = '"..self.mod.."',")
+    print(ident.." type = '"..self.type.."',")
+    print(ident.." ptr  = '"..self.ptr.."',")
+    print(ident.." name = '"..self.name.."',")
+    print(ident.." const = '"..self.const.."',")
+    print(ident.." cname = '"..self.cname.."',")
+    print(ident.." lname = '"..self.lname.."',")
+    print(ident.." args = {")
+    local i=1
+    while self.args[i] do
+        self.args[i]:print(ident.."  ",",")
+        i = i+1
+    end
+    print(ident.." }")
+    print(ident.."}"..close)
 end
 
 function classOperator:supcode_tmp()
 
-	if not _TM[self.kind] then
-		return classFunction.supcode(self)
-	end
-
-	-- no overload, no parameters, always inclass
-	output("/* method:",self.name," of class ",self:inclass()," */")
-
-	output("#ifndef TOLUA_DISABLE_"..self.cname)
-	output("\nstatic int",self.cname,"(lua_State* tolua_S)")
-
-	if overload < 0 then
-	 output('#ifndef TOLUA_RELEASE\n')
-	end
-	output(' tolua_Error tolua_err;')
-	output(' if (\n')
-	-- check self
-	output('     !'..'tolua_isusertype(tolua_S,1,"'..self.parent.type..'",0,&tolua_err) ||\n')
-	output('     !tolua_isnoobj(tolua_S,2,&tolua_err)\n )')
-	output('  goto tolua_lerror;')
-
-	output(' else\n')
-	output('#endif\n') -- tolua_release
-	output(' {')
-
-	-- declare self
-	output(' ',self.const,self.parent.type,'*','self = ')
-	output('(',self.const,self.parent.type,'*) ')
-	output('tolua_tousertype(tolua_S,1,0);')
-
-	-- check self
-	output('#ifndef TOLUA_RELEASE\n')
-	output('  if (!self) tolua_error(tolua_S,"invalid \'self\' in function \''..self.name..'\'",NULL);');
-	output('#endif\n')
-
-	-- cast self
-	output('  ',self.mod,self.type,self.ptr,'tolua_ret = ')
-	output('(',self.mod,self.type,self.ptr,')(*self);')
-
-	-- return value
-	local t,ct = isbasic(self.type)
-	if t then
-		output('   tolua_push'..t..'(tolua_S,(',ct,')tolua_ret);')
-	else
-		t = self.type
-		new_t = string.gsub(t, "const%s+", "")
-		if self.ptr == '' then
-			output('   {')
-			output('#ifdef __cplusplus\n')
-			output('    void* tolua_obj = new',new_t,'(tolua_ret);')
-			output('    tolua_pushusertype_and_takeownership(tolua_S,tolua_obj,"',t,'");')
-			output('#else\n')
-			output('    void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(',t,'));')
-			output('    tolua_pushusertype_and_takeownership(tolua_S,tolua_obj,"',t,'");')
-			output('#endif\n')
-			output('   }')
-		elseif self.ptr == '&' then
-			output('   tolua_pushusertype(tolua_S,(void*)&tolua_ret,"',t,'");')
-		else
-			if local_constructor then
-				output('   tolua_pushusertype_and_takeownership(tolua_S,(void *)tolua_ret,"',t,'");')
-			else
-				output('   tolua_pushusertype(tolua_S,(void*)tolua_ret,"',t,'");')
-			end
-		end
-	end
-
-	output('  }')
-	output(' return 1;')
-
-	output('#ifndef TOLUA_RELEASE\n')
-	output('tolua_lerror:\n')
-	output(' tolua_error(tolua_S,"#ferror in function \''..self.lname..'\'.",&tolua_err);')
-	output(' return 0;')
-	output('#endif\n')
-
-
-	output('}')
-	output('#endif //#ifndef TOLUA_DISABLE\n')
-	output('\n')
+    if not _TM[self.kind] then
+        return classFunction.supcode(self)
+    end
+
+    -- no overload, no parameters, always inclass
+    output("/* method:",self.name," of class ",self:inclass()," */")
+
+    output("#ifndef TOLUA_DISABLE_"..self.cname)
+    output("\nstatic int",self.cname,"(lua_State* tolua_S)")
+
+    if overload < 0 then
+        output('#ifndef TOLUA_RELEASE\n')
+    end
+    output(' tolua_Error tolua_err;')
+    output(' if (\n')
+    -- check self
+    output('     !'..'tolua_isusertype(tolua_S,1,"'..self.parent.type..'",0,&tolua_err) ||\n')
+    output('     !tolua_isnoobj(tolua_S,2,&tolua_err)\n )')
+    output('  goto tolua_lerror;')
+
+    output(' else\n')
+    output('#endif\n') -- tolua_release
+    output(' {')
+
+    -- declare self
+    output(' ',self.const,self.parent.type,'*','self = ')
+    output('(',self.const,self.parent.type,'*) ')
+    output('tolua_tousertype(tolua_S,1,0);')
+
+    -- check self
+    output('#ifndef TOLUA_RELEASE\n')
+    output('  if (!self) tolua_error(tolua_S,"invalid \'self\' in function \''..self.name..'\'",NULL);');
+    output('#endif\n')
+
+    -- cast self
+    output('  ',self.mod,self.type,self.ptr,'tolua_ret = ')
+    output('(',self.mod,self.type,self.ptr,')(*self);')
+
+    -- return value
+    local t,ct = isbasic(self.type)
+    if t then
+        output('   tolua_push'..t..'(tolua_S,(',ct,')tolua_ret);')
+    else
+        t = self.type
+        new_t = string.gsub(t, "const%s+", "")
+        if self.ptr == '' then
+            output('   {')
+            output('#ifdef __cplusplus\n')
+            output('    void* tolua_obj = new',new_t,'(tolua_ret);')
+            output('    tolua_pushusertype_and_takeownership(tolua_S,tolua_obj,"',t,'");')
+            output('#else\n')
+            output('    void* tolua_obj = tolua_copy(tolua_S,(void*)&tolua_ret,sizeof(',t,'));')
+            output('    tolua_pushusertype_and_takeownership(tolua_S,tolua_obj,"',t,'");')
+            output('#endif\n')
+            output('   }')
+        elseif self.ptr == '&' then
+            output('   tolua_pushusertype(tolua_S,(void*)&tolua_ret,"',t,'");')
+        else
+            if local_constructor then
+                output('   tolua_pushusertype_and_takeownership(tolua_S,(void *)tolua_ret,"',t,'");')
+            else
+                output('   tolua_pushusertype(tolua_S,(void*)tolua_ret,"',t,'");')
+            end
+        end
+    end
+
+    output('  }')
+    output(' return 1;')
+
+    output('#ifndef TOLUA_RELEASE\n')
+    output('tolua_lerror:\n')
+    output(' tolua_error(tolua_S,"#ferror in function \''..self.lname..'\'.",&tolua_err);')
+    output(' return 0;')
+    output('#endif\n')
+
+
+    output('}')
+    output('#endif //#ifndef TOLUA_DISABLE\n')
+    output('\n')
 end
 
 -- Internal constructor
 function _Operator (t)
- setmetatable(t,classOperator)
-
- if t.const ~= 'const' and t.const ~= '' then
-  error("#invalid 'const' specification")
- end
-
- append(t)
- if not t:inclass() then
-  error("#operator can only be defined as class member")
- end
-
- --t.name = t.name .. "_" .. (_TM[t.kind] or t.kind)
- t.cname = t:cfuncname("tolua")..t:overload(t)
- t.name = "operator" .. t.kind  -- set appropriate calling name
- return t
+    setmetatable(t,classOperator)
+
+    if t.const ~= 'const' and t.const ~= '' then
+        error("#invalid 'const' specification")
+    end
+
+    append(t)
+    if not t:inclass() then
+        error("#operator can only be defined as class member")
+    end
+
+    --t.name = t.name .. "_" .. (_TM[t.kind] or t.kind)
+    t.cname = t:cfuncname("tolua")..t:overload(t)
+    t.name = "operator" .. t.kind  -- set appropriate calling name
+    return t
 end
 
@@ -161,54 +162,54 @@
 function Operator (d,k,a,c)
 
-	local op_k = string.gsub(k, "^%s*", "")
-	op_k = string.gsub(k, "%s*$", "")
-	--if string.find(k, "^[%w_:%d<>%*%&]+$") then
-	if d == "operator" and k ~= '' then
-
-		d = k.." operator"
-	elseif not _TM[op_k] then
-
-		if flags['W'] then
-			error("tolua: no support for operator" .. f.kind)
-		else
-			warning("No support for operator "..op_k..", ignoring")
-			return nil
-		end
-	end
-
-	local ref = ''
- local t = split_c_tokens(strsub(a,2,strlen(a)-1),',') -- eliminate braces
- local i=1
- local l = {n=0}
- while t[i] do
-  l.n = l.n+1
-  l[l.n] = Declaration(t[i],'var')
-  i = i+1
- end
- if k == '[]' then
-	 local _
-	 _, _, ref = strfind(d,'(&)')
-  d = gsub(d,'&','')
- elseif k=='&[]' then
-  l.n = l.n+1
-  l[l.n] = Declaration(d,'var')
-  l[l.n].name = 'tolua_value'
- end
- local f = Declaration(d,'func')
- if k == '[]' and (l[1]==nil or isbasic(l[1].type)~='number') then
-  error('operator[] can only be defined for numeric index.')
- end
- f.args = l
- f.const = c
- f.kind = op_k
- f.lname = "."..(_TM[f.kind] or f.kind)
- if not _TM[f.kind] then
- 	f.cast_operator = true
- end
- if f.kind == '[]' and ref=='&' and f.const~='const' then
-  Operator(d,'&'..k,a,c) 	-- create correspoding set operator
- end
- return _Operator(f)
-end
-
-
+    local op_k = string.gsub(k, "^%s*", "")
+    op_k = string.gsub(k, "%s*$", "")
+    --if string.find(k, "^[%w_:%d<>%*%&]+$") then
+    if d == "operator" and k ~= '' then
+
+        d = k.." operator"
+    elseif not _TM[op_k] then
+
+        if flags['W'] then
+            error("tolua: no support for operator" .. f.kind)
+        else
+            warning("No support for operator "..op_k..", ignoring")
+            return nil
+        end
+    end
+
+    local ref = ''
+    local t = split_c_tokens(strsub(a,2,strlen(a)-1),',') -- eliminate braces
+    local i=1
+    local l = {n=0}
+    while t[i] do
+        l.n = l.n+1
+        l[l.n] = Declaration(t[i],'var')
+        i = i+1
+    end
+    if k == '[]' then
+        local _
+        _, _, ref = strfind(d,'(&)')
+        d = gsub(d,'&','')
+    elseif k=='&[]' then
+        l.n = l.n+1
+        l[l.n] = Declaration(d,'var')
+        l[l.n].name = 'tolua_value'
+    end
+    local f = Declaration(d,'func')
+    if k == '[]' and (l[1]==nil or isbasic(l[1].type)~='number') then
+        error('operator[] can only be defined for numeric index.')
+    end
+    f.args = l
+    f.const = c
+    f.kind = op_k
+    f.lname = "."..(_TM[f.kind] or f.kind)
+    if not _TM[f.kind] then
+        f.cast_operator = true
+    end
+    if f.kind == '[]' and ref=='&' and f.const~='const' then
+        Operator(d,'&'..k,a,c)     -- create correspoding set operator
+    end
+    return _Operator(f)
+end
+
+
Index: /code/branches/buildsystem3/src/tolua/lua/package.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/package.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/package.lua	(revision 2664)
@@ -17,5 +17,5 @@
 --    {i} = list of objects in the package.
 classPackage = {
- classtype = 'package'
+    classtype = 'package'
 }
 classPackage.__index = classPackage
@@ -24,153 +24,144 @@
 -- Print method
 function classPackage:print ()
- print("Package: "..self.name)
- local i=1
- while self[i] do
-  self[i]:print("","")
-  i = i+1
- end
+    print("Package: "..self.name)
+    local i=1
+    while self[i] do
+        self[i]:print("","")
+        i = i+1
+    end
 end
 
 function classPackage:preprocess ()
 
- -- avoid preprocessing embedded Lua code
- local L = {}
- self.code = gsub(self.code,"\n%s*%$%[","\1") -- deal with embedded lua code
- self.code = gsub(self.code,"\n%s*%$%]","\2")
- self.code = gsub(self.code,"(%b\1\2)",       function (c)
+    -- avoid preprocessing embedded Lua code
+    local L = {}
+    self.code = gsub(self.code,"\n%s*%$%[","\1") -- deal with embedded lua code
+    self.code = gsub(self.code,"\n%s*%$%]","\2")
+    self.code = gsub(self.code,"(%b\1\2)", function (c)
                                                tinsert(L,c)
                                                return "\n#["..getn(L).."]#"
-                                              end)
- -- avoid preprocessing embedded C code
- local C = {}
- self.code = gsub(self.code,"\n%s*%$%<","\3") -- deal with embedded C code
- self.code = gsub(self.code,"\n%s*%$%>","\4")
- self.code = gsub(self.code,"(%b\3\4)",       function (c)
+                                           end
+    )
+    -- avoid preprocessing embedded C code
+    local C = {}
+    self.code = gsub(self.code,"\n%s*%$%<","\3") -- deal with embedded C code
+    self.code = gsub(self.code,"\n%s*%$%>","\4")
+    self.code = gsub(self.code,"(%b\3\4)", function (c)
                                                tinsert(C,c)
                                                return "\n#<"..getn(C)..">#"
-                                              end)
- -- avoid preprocessing embedded C code
- self.code = gsub(self.code,"\n%s*%$%{","\5") -- deal with embedded C code
- self.code = gsub(self.code,"\n%s*%$%}","\6")
- self.code = gsub(self.code,"(%b\5\6)",       function (c)
+                                           end
+    )
+    -- avoid preprocessing embedded C code
+    self.code = gsub(self.code,"\n%s*%$%{","\5") -- deal with embedded C code
+    self.code = gsub(self.code,"\n%s*%$%}","\6")
+    self.code = gsub(self.code,"(%b\5\6)", function (c)
                                                tinsert(C,c)
                                                return "\n#<"..getn(C)..">#"
-                                              end)
-
- --self.code = gsub(self.code,"\n%s*#[^d][^\n]*\n", "\n\n") -- eliminate preprocessor directives that don't start with 'd'
- self.code = gsub(self.code,"\n[ \t]*#[ \t]*[^d%<%[]", "\n//") -- eliminate preprocessor directives that don't start with 'd'
-
- -- avoid preprocessing verbatim lines
- local V = {}
- self.code = gsub(self.code,"\n(%s*%$[^%[%]][^\n]*)",function (v)
-                                               tinsert(V,v)
-                                               return "\n#"..getn(V).."#"
-                                              end)
-
- -- perform global substitution
-
- self.code = gsub(self.code,"(//[^\n]*)","")     -- eliminate C++ comments
- self.code = gsub(self.code,"/%*","\1")
- self.code = gsub(self.code,"%*/","\2")
- self.code = gsub(self.code,"%b\1\2","")
- self.code = gsub(self.code,"\1","/%*")
- self.code = gsub(self.code,"\2","%*/")
- self.code = gsub(self.code,"%s*@%s*","@") -- eliminate spaces beside @
- self.code = gsub(self.code,"%s?inline(%s)","%1") -- eliminate 'inline' keyword
- --self.code = gsub(self.code,"%s?extern(%s)","%1") -- eliminate 'extern' keyword
- --self.code = gsub(self.code,"%s?virtual(%s)","%1") -- eliminate 'virtual' keyword
- --self.code = gsub(self.code,"public:","") -- eliminate 'public:' keyword
- self.code = gsub(self.code,"([^%w_])void%s*%*","%1_userdata ") -- substitute 'void*'
- self.code = gsub(self.code,"([^%w_])void%s*%*","%1_userdata ") -- substitute 'void*'
- self.code = gsub(self.code,"([^%w_])char%s*%*","%1_cstring ")  -- substitute 'char*'
- self.code = gsub(self.code,"([^%w_])lua_State%s*%*","%1_lstate ")  -- substitute 'lua_State*'
-
- -- restore embedded Lua code
- self.code = gsub(self.code,"%#%[(%d+)%]%#",function (n)
-                                              return L[tonumber(n)]
-                                            end)
- -- restore embedded C code
- self.code = gsub(self.code,"%#%<(%d+)%>%#",function (n)
-                                             return C[tonumber(n)]
-                                            end)
- -- restore verbatim lines
- self.code = gsub(self.code,"%#(%d+)%#",function (n)
-                                         return V[tonumber(n)]
-                                        end)
-
- self.code = string.gsub(self.code, "\n%s*%$([^\n]+)", function (l)
-											Verbatim(l.."\n")
-											return "\n"
-										  end)
+                                           end
+    )
+
+    --self.code = gsub(self.code,"\n%s*#[^d][^\n]*\n", "\n\n") -- eliminate preprocessor directives that don't start with 'd'
+    self.code = gsub(self.code,"\n[ \t]*#[ \t]*[^d%<%[]", "\n//") -- eliminate preprocessor directives that don't start with 'd'
+
+    -- avoid preprocessing verbatim lines
+    local V = {}
+    self.code = gsub(self.code,"\n(%s*%$[^%[%]][^\n]*)", function (v)
+                                                             tinsert(V,v)
+                                                             return "\n#"..getn(V).."#"
+                                                         end
+    )
+
+    -- perform global substitution
+
+    self.code = gsub(self.code,"(//[^\n]*)","")     -- eliminate C++ comments
+    self.code = gsub(self.code,"/%*","\1")
+    self.code = gsub(self.code,"%*/","\2")
+    self.code = gsub(self.code,"%b\1\2","")
+    self.code = gsub(self.code,"\1","/%*")
+    self.code = gsub(self.code,"\2","%*/")
+    self.code = gsub(self.code,"%s*@%s*","@") -- eliminate spaces beside @
+    self.code = gsub(self.code,"%s?inline(%s)","%1") -- eliminate 'inline' keyword
+    --self.code = gsub(self.code,"%s?extern(%s)","%1") -- eliminate 'extern' keyword
+    --self.code = gsub(self.code,"%s?virtual(%s)","%1") -- eliminate 'virtual' keyword
+    --self.code = gsub(self.code,"public:","") -- eliminate 'public:' keyword
+    self.code = gsub(self.code,"([^%w_])void%s*%*","%1_userdata ") -- substitute 'void*'
+    self.code = gsub(self.code,"([^%w_])void%s*%*","%1_userdata ") -- substitute 'void*'
+    self.code = gsub(self.code,"([^%w_])char%s*%*","%1_cstring ")  -- substitute 'char*'
+    self.code = gsub(self.code,"([^%w_])lua_State%s*%*","%1_lstate ")  -- substitute 'lua_State*'
+
+    -- restore embedded Lua code
+    self.code = gsub(self.code,"%#%[(%d+)%]%#", function (n)
+                                                    return L[tonumber(n)]
+                                                end
+    )
+    -- restore embedded C code
+    self.code = gsub(self.code,"%#%<(%d+)%>%#", function (n)
+                                                    return C[tonumber(n)]
+                                                end
+    )
+    -- restore verbatim lines
+    self.code = gsub(self.code,"%#(%d+)%#", function (n)
+                                                return V[tonumber(n)]
+                                            end
+    )
+
+    self.code = string.gsub(self.code, "\n%s*%$([^\n]+)", function (l)
+                                                              Verbatim(l.."\n")
+                                                              return "\n"
+                                                          end
+    )
 end
 
 -- translate verbatim
 function classPackage:preamble ()
- output('/*\n')
- output('** Lua binding: '..self.name..'\n')
- output('** Generated automatically by '..TOLUA_VERSION..' on '..date()..'.\n')
- output('*/\n\n')
-
-	output('#ifndef __cplusplus\n')
-	output('#include "stdlib.h"\n')
-	output('#endif\n')
-	output('#include "string.h"\n\n')
- output('#include "tolua/tolua++.h"\n\n')
-
- if not flags.h then
---  local temp = string.reverse(flags.H)
---  local start1, end1 = string.find(temp, '/')
---  local start2, end2 = string.find(temp, '\\')
---  local res
---  if not start1 == nil then
---   if not start2 == nil then
---    if start1 > start2 then
---     res = string.sub(temp, 1, start2)
---    else
---     res = string.sub(temp, 1, start1)
---    end
---   else
---    res = string.sub(temp, 1, start1)
---   end
---  elseif not start2 == nil then
---   res = string.sub(temp, 1, start2)
---  end
---  res = string.reverse(res)
-  output('#include "tolua_bind.h"')
-  output('\n')
- end
-
- local i=1
- while self[i] do
-  self[i]:preamble()
-  i = i+1
- end
-
-	if self:requirecollection(_collect) then
-		output('\n')
-		output('/* function to release collected object via destructor */')
-		output('#ifdef __cplusplus\n')
-		for i,v in pairs(_collect) do
-		 output('\nstatic int '..v..' (lua_State* tolua_S)')
-			output('{')
-			output(' '..i..'* self = ('..i..'*) tolua_tousertype(tolua_S,1,0);')
-			output('	delete self;')
-			output('	return 0;')
-			output('}')
-		end
-		output('#endif\n\n')
-	end
-
- output('\n')
- output('/* function to register type */')
- output('static void tolua_reg_types (lua_State* tolua_S)')
- output('{')
- foreach(_usertype,function(n,v) output(' tolua_usertype(tolua_S,"',v,'");') end)
-	if flags.t then
-		output("#ifndef Mtolua_typeid\n#define Mtolua_typeid(L,TI,T)\n#endif\n")
-		foreach(_usertype,function(n,v) output(' Mtolua_typeid(tolua_S,typeid(',v,'), "',v,'");') end)
-	end
- output('}')
- output('\n')
+    output('/*\n')
+    output('** Lua binding: '..self.name..'\n')
+    output('** Generated automatically by '..TOLUA_VERSION..' on '..date()..'.\n')
+    output('*/\n\n')
+
+    output('#ifndef __cplusplus\n')
+    output('#include <stdlib.h>\n')
+    output('#endif\n')
+    output('#include <string.h>\n\n')
+    output('#include <tolua/tolua++.h>\n\n')
+
+    if flags.H then
+        local header = gsub(flags.H, '^.-([%w_]*%.[%w_]*)$', '%1')
+        local package_lower = string.lower(self.name)
+        output('#include "'..header..'"\n')
+    end
+
+    local i=1
+    while self[i] do
+        self[i]:preamble()
+        i = i+1
+    end
+
+    if self:requirecollection(_collect) then
+        output('\n')
+        output('/* function to release collected object via destructor */')
+        output('#ifdef __cplusplus\n')
+        for i,v in pairs(_collect) do
+            output('\nstatic int '..v..' (lua_State* tolua_S)')
+            output('{')
+            output(' '..i..'* self = ('..i..'*) tolua_tousertype(tolua_S,1,0);')
+            output('    delete self;')
+            output('    return 0;')
+            output('}')
+        end
+        output('#endif\n\n')
+    end
+
+    output('\n')
+    output('/* function to register type */')
+    output('static void tolua_reg_types (lua_State* tolua_S)')
+    output('{')
+    foreach(_usertype,function(n,v) output(' tolua_usertype(tolua_S,"',v,'");') end)
+    if flags.t then
+        output("#ifndef Mtolua_typeid\n#define Mtolua_typeid(L,TI,T)\n#endif\n")
+        foreach(_usertype,function(n,v) output(' Mtolua_typeid(tolua_S,typeid(',v,'), "',v,'");') end)
+    end
+    output('}')
+    output('\n')
 end
 
@@ -178,50 +169,52 @@
 -- write package open function
 function classPackage:register (pre)
- pre = pre or ''
- push(self)
- output(pre.."/* Open function */")
- output(pre.."int tolua_"..self.name.."_open (lua_State* tolua_S)")
- output(pre.."{")
- output(pre.." tolua_open(tolua_S);")
- output(pre.." tolua_reg_types(tolua_S);")
- output(pre.." tolua_module(tolua_S,NULL,",self:hasvar(),");")
- output(pre.." tolua_beginmodule(tolua_S,NULL);")
- local i=1
- while self[i] do
-  self[i]:register(pre.."  ")
-  i = i+1
- end
- output(pre.." tolua_endmodule(tolua_S);")
- output(pre.." return 1;")
- output(pre.."}")
-
- output("\n\n")
- output("#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501\n");
- output(pre.."int luaopen_"..self.name.." (lua_State* tolua_S) {")
- output(pre.." return tolua_"..self.name.."_open(tolua_S);")
- output(pre.."};")
- output("#endif\n\n")
-
-	pop()
+    pre = pre or ''
+    push(self)
+    output(pre.."/* Open function */")
+    output(pre.."int tolua_"..self.name.."_open (lua_State* tolua_S)")
+    output(pre.."{")
+    output(pre.." tolua_open(tolua_S);")
+    output(pre.." tolua_reg_types(tolua_S);")
+    output(pre.." tolua_module(tolua_S,NULL,",self:hasvar(),");")
+    output(pre.." tolua_beginmodule(tolua_S,NULL);")
+    local i=1
+    while self[i] do
+        self[i]:register(pre.."  ")
+        i = i+1
+    end
+    output(pre.." tolua_endmodule(tolua_S);")
+    output(pre.." return 1;")
+    output(pre.."}")
+
+    output("\n\n")
+    output("#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501\n");
+    output(pre.."int luaopen_"..self.name.." (lua_State* tolua_S) {")
+    output(pre.." return tolua_"..self.name.."_open(tolua_S);")
+    output(pre.."};")
+    output("#endif\n\n")
+
+    pop()
 end
 
 -- write header file
 function classPackage:header ()
- output('/*\n') output('** Lua binding: '..self.name..'\n')
- output('** Generated automatically by '..TOLUA_VERSION..' on '..date()..'.\n')
- output('*/\n\n')
-
- if not flags.h then
-  output('#include "../'..self.name..'Prereqs.h"\n')
-  output('/* Exported function */')
-  output('_'..self.name..'Export int  tolua_'..self.name..'_open (lua_State* tolua_S);')
-  output('\n')
- end
+    output('/*\n') output('** Lua binding: '..self.name..'\n')
+    output('** Generated automatically by '..TOLUA_VERSION..' on '..date()..'.\n')
+    output('*/\n\n')
+
+    if flags.H then
+        local package_lower = string.lower(self.name)
+        output('#include "'..package_lower..'/'..self.name..'Prereqs.h"\n')
+        output('/* Exported function */')
+        output('_'..self.name..'Export')
+        output('int  tolua_'..self.name..'_open (lua_State* tolua_S);')
+        output('\n')
+    end
 end
 
 -- Internal constructor
 function _Package (self)
- setmetatable(self,classPackage)
- return self
+    setmetatable(self,classPackage)
+    return self
 end
 
@@ -229,19 +222,23 @@
 -- *** Thanks to Ariel Manzur for fixing bugs in nested directives ***
 function extract_code(fn,s)
-	local code = '\n$#include "'..fn..'"\n'
-	s= "\n" .. s .. "\n" -- add blank lines as sentinels
-	local _,e,c,t = strfind(s, "\n([^\n]-)[Tt][Oo][Ll][Uu][Aa]_([^%s]*)[^\n]*\n")
-	while e do
-		t = strlower(t)
-		if t == "begin" then
-			_,e,c = strfind(s,"(.-)\n[^\n]*[Tt][Oo][Ll][Uu][Aa]_[Ee][Nn][Dd][^\n]*\n",e)
-			if not e then
-			 tolua_error("Unbalanced 'tolua_begin' directive in header file")
-			end
-		end
-		code = code .. c .. "\n"
-	 _,e,c,t = strfind(s, "\n([^\n]-)[Tt][Oo][Ll][Uu][Aa]_([^%s]*)[^\n]*\n",e)
-	end
-	return code
+    local code = '\n$#include "'..string.lower(flags.n)..'/'..fn..'"\n'
+    s= "\n" .. s .. "\n" -- add blank lines as sentinels
+
+    -- eliminate export macro problems in class declarations
+    s = gsub(s, ' _%w*Export ', ' ')
+
+    local _,e,c,t = strfind(s, "\n([^\n]-)[Tt][Oo][Ll][Uu][Aa]_([^%s]*)[^\n]*\n")
+    while e do
+        t = strlower(t)
+        if t == "begin" then
+            _,e,c = strfind(s,"(.-)\n[^\n]*[Tt][Oo][Ll][Uu][Aa]_[Ee][Nn][Dd][^\n]*\n",e)
+            if not e then
+             tolua_error("Unbalanced 'tolua_begin' directive in header file")
+            end
+        end
+        code = code .. c .. "\n"
+        _,e,c,t = strfind(s, "\n([^\n]-)[Tt][Oo][Ll][Uu][Aa]_([^%s]*)[^\n]*\n",e)
+    end
+    return code
 end
 
@@ -249,68 +246,93 @@
 -- Expects the package name, the file extension, and the file text.
 function Package (name,fn)
- local ext = "pkg"
-
- -- open input file, if any
- if fn then
-  local st, msg = readfrom(flags.f)
-  if not st then
-   error('#'..msg)
-  end
-		local _; _, _, ext = strfind(fn,".*%.(.*)$")
- end
- local code = "\n" .. read('*a')
-	if ext == 'h' or ext == 'hpp' then
-	 code = extract_code(fn,code)
-	end
-
- -- close file
- if fn then
-  readfrom()
- end
-
- -- deal with include directive
- local nsubst
- repeat
-  code,nsubst = gsub(code,'\n%s*%$(.)file%s*"(.-)"([^\n]*)\n',
-		function (kind,fn,extra)
-			local _, _, ext = strfind(fn,".*%.(.*)$")
-			local fp,msg = openfile(fn,'r')
-			if not fp then
-				error('#'..msg..': '..fn)
-			end
-			local s = read(fp,'*a')
-			closefile(fp)
-			if kind == 'c' or kind == 'h' then
-				return extract_code(fn,s)
-			elseif kind == 'p' then
-				return "\n\n" .. s
-			elseif kind == 'l' then
-				return "\n$[--##"..fn.."\n" .. s .. "\n$]\n"
-			elseif kind == 'i' then
-				local t = {code=s}
-				extra = string.gsub(extra, "^%s*,%s*", "")
-				local pars = split_c_tokens(extra, ",")
-				include_file_hook(t, fn, unpack(pars))
-				return "\n\n" .. t.code
-			else
-				error('#Invalid include directive (use $cfile, $pfile, $lfile or $ifile)')
-			end
-		end)
- until nsubst==0
-
- -- deal with renaming directive
- repeat -- I don't know why this is necesary
-	code,nsubst = gsub(code,'\n%s*%$renaming%s*(.-)%s*\n', function (r) appendrenaming(r) return "\n" end)
- until nsubst == 0
-
- local t = _Package(_Container{name=name, code=code})
- push(t)
- preprocess_hook(t)
- t:preprocess()
- preparse_hook(t)
- t:parse(t.code)
- pop()
- return t
-end
-
-
+    local ext = "pkg"
+
+    -- open input file, if any
+    if fn then
+        local file
+        if flags.f then
+            if string.sub(flags.f, 1, 1) == '/' or string.sub(flags.f, 1, 1) == '\\' or (string.len(flags.f) > 1 and string.sub(flags.f, 2, 2) == ':') then
+                file = flags.f
+            else
+                file = flags.w..'/'..flags.f
+            end
+        else
+            file = flags.f
+        end
+        local st, msg = readfrom(file)
+        if not st then
+            error('#'..msg..' path: '..flags.f)
+        end
+        local _; _, _, ext = strfind(fn,".*%.(.*)$")
+    end
+    local code = "\n" .. read('*a')
+    if ext == 'h' or ext == 'hpp' then
+        code = extract_code(fn,code)
+    end
+
+    -- close file
+    if fn then
+        readfrom()
+    end
+
+    -- prepare working directory
+    local current_path
+    if not flags.w and flags.f then
+        current_path = gsub(flags.f, '(/)[^/]*%.?[^/]*$', '%1')
+    elseif flags.w then
+        if not (string.sub(flags.w, string.len(flags.w)) == '/') then
+            current_path = flags.w..'/'
+        else
+            current_path = flags.w
+        end
+    else
+        current_path = ''
+    end
+
+    -- deal with include directive
+    local nsubst
+    repeat
+        code,nsubst = gsub(code,'\n%s*%$(.)file%s*"(.-)"([^\n]*)\n',
+            function (kind,fn,extra)
+                local _, _, ext = strfind(fn,".*%.(.*)$")
+                local fp,msg = openfile(current_path..fn,'r')
+                if not fp then
+                    error('#'..msg..': '..fn)
+                end
+                local s = read(fp,'*a')
+                closefile(fp)
+                if kind == 'c' or kind == 'h' then
+                    return extract_code(fn,s)
+                elseif kind == 'p' then
+                    return "\n\n" .. s
+                elseif kind == 'l' then
+                    return "\n$[--##"..fn.."\n" .. s .. "\n$]\n"
+                elseif kind == 'i' then
+                    local t = {code=s}
+                    extra = string.gsub(extra, "^%s*,%s*", "")
+                    local pars = split_c_tokens(extra, ",")
+                    include_file_hook(t, fn, unpack(pars))
+                    return "\n\n" .. t.code
+                else
+                    error('#Invalid include directive (use $cfile, $pfile, $lfile or $ifile)')
+                end
+            end
+        )
+    until nsubst==0
+
+    -- deal with renaming directive
+    repeat -- I don't know why this is necesary
+        code,nsubst = gsub(code,'\n%s*%$renaming%s*(.-)%s*\n', function (r) appendrenaming(r) return "\n" end)
+    until nsubst == 0
+
+    local t = _Package(_Container{name=name, code=code})
+    push(t)
+    preprocess_hook(t)
+    t:preprocess()
+    preparse_hook(t)
+    t:parse(t.code)
+    pop()
+    return t
+end
+
+
Index: /code/branches/buildsystem3/src/tolua/lua/typedef.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/typedef.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/typedef.lua	(revision 2664)
@@ -21,7 +21,7 @@
 --   mod = modifiers to the 'de facto' type
 classTypedef = {
- utype = '',
- mod = '',
- type = ''
+    utype = '',
+    mod = '',
+    type = ''
 }
 classTypedef.__index = classTypedef
@@ -29,22 +29,22 @@
 -- Print method
 function classTypedef:print (ident,close)
- print(ident.."Typedef{")
- print(ident.." utype = '"..self.utype.."',")
- print(ident.." mod = '"..self.mod.."',")
- print(ident.." type = '"..self.type.."',")
- print(ident.."}"..close)
+    print(ident.."Typedef{")
+    print(ident.." utype = '"..self.utype.."',")
+    print(ident.." mod = '"..self.mod.."',")
+    print(ident.." type = '"..self.type.."',")
+    print(ident.."}"..close)
 end
 
 -- Return it's not a variable
 function classTypedef:isvariable ()
- return false
+    return false
 end
 
 -- Internal constructor
 function _Typedef (t)
- setmetatable(t,classTypedef)
- t.type = resolve_template_types(t.type)
- appendtypedef(t)
- return t
+    setmetatable(t,classTypedef)
+    t.type = resolve_template_types(t.type)
+    appendtypedef(t)
+    return t
 end
 
@@ -52,19 +52,19 @@
 -- Expects one string representing the type definition.
 function Typedef (s)
- if strfind(string.gsub(s, '%b<>', ''),'[%*&]') then
-  tolua_error("#invalid typedef: pointers (and references) are not supported")
- end
- local o = {mod = ''}
- if string.find(s, "[<>]") then
- 	_,_,o.type,o.utype = string.find(s, "^%s*([^<>]+%b<>[^%s]*)%s+(.-)$")
- else
- 	local t = split(gsub(s,"%s%s*"," ")," ")
- 	o = {
-	  utype = t[t.n],
-	  type = t[t.n-1],
-	  mod = concat(t,1,t.n-2),
-	 }
- end
- return _Typedef(o)
+    if strfind(string.gsub(s, '%b<>', ''),'[%*&]') then
+        tolua_error("#invalid typedef: pointers (and references) are not supported")
+    end
+    local o = {mod = ''}
+    if string.find(s, "[<>]") then
+        _,_,o.type,o.utype = string.find(s, "^%s*([^<>]+%b<>[^%s]*)%s+(.-)$")
+    else
+        local t = split(gsub(s,"%s%s*"," ")," ")
+        o = {
+            utype = t[t.n],
+            type = t[t.n-1],
+            mod = concat(t,1,t.n-2),
+        }
+    end
+    return _Typedef(o)
 end
 
Index: /code/branches/buildsystem3/src/tolua/lua/variable.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/variable.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/variable.lua	(revision 2664)
@@ -15,6 +15,6 @@
 -- Stores all fields present in a declaration.
 classVariable = {
- _get = {},   -- mapped get functions
- _set = {},   -- mapped set functions
+    _get = {},   -- mapped get functions
+    _set = {},   -- mapped set functions
 }
 classVariable.__index = classVariable
@@ -23,43 +23,43 @@
 -- Print method
 function classVariable:print (ident,close)
- print(ident.."Variable{")
- print(ident.." mod  = '"..self.mod.."',")
- print(ident.." type = '"..self.type.."',")
- print(ident.." ptr  = '"..self.ptr.."',")
- print(ident.." name = '"..self.name.."',")
- if self.dim then print(ident.." dim = '"..self.dim.."',") end
- print(ident.." def  = '"..self.def.."',")
- print(ident.." ret  = '"..self.ret.."',")
- print(ident.."}"..close)
+    print(ident.."Variable{")
+    print(ident.." mod  = '"..self.mod.."',")
+    print(ident.." type = '"..self.type.."',")
+    print(ident.." ptr  = '"..self.ptr.."',")
+    print(ident.." name = '"..self.name.."',")
+    if self.dim then print(ident.." dim = '"..self.dim.."',") end
+    print(ident.." def  = '"..self.def.."',")
+    print(ident.." ret  = '"..self.ret.."',")
+    print(ident.."}"..close)
 end
 
 -- Generates C function name
 function classVariable:cfuncname (prefix)
- local parent = ""
- local unsigned = ""
- local ptr = ""
-
- local p = self:inmodule() or self:innamespace() or self:inclass()
-
- if p then
- 	if self.parent.classtype == 'class' then
-		parent = "_" .. self.parent.type
-	else
-	  parent = "_" .. p
-	end
- end
-
- if strfind(self.mod,"(unsigned)") then
-  unsigned = "_unsigned"
- end
-
- if self.ptr == "*" then ptr = "_ptr"
- elseif self.ptr == "&" then ptr = "_ref"
- end
-
- local name =  prefix .. parent .. unsigned .. "_" .. gsub(self.lname or self.name,".*::","") .. ptr
-
-	name = clean_template(name)
- return name
+    local parent = ""
+    local unsigned = ""
+    local ptr = ""
+
+    local p = self:inmodule() or self:innamespace() or self:inclass()
+
+    if p then
+        if self.parent.classtype == 'class' then
+            parent = "_" .. self.parent.type
+        else
+            parent = "_" .. p
+        end
+    end
+
+    if strfind(self.mod,"(unsigned)") then
+        unsigned = "_unsigned"
+    end
+
+    if self.ptr == "*" then ptr = "_ptr"
+    elseif self.ptr == "&" then ptr = "_ref"
+    end
+
+    local name =  prefix .. parent .. unsigned .. "_" .. gsub(self.lname or self.name,".*::","") .. ptr
+
+    name = clean_template(name)
+    return name
 
 end
@@ -67,5 +67,5 @@
 -- check if it is a variable
 function classVariable:isvariable ()
- return true
+    return true
 end
 
@@ -73,30 +73,30 @@
 function classVariable:getvalue (class,static, prop_get)
 
-	local name
-	if prop_get then
-
-		name = prop_get.."()"
-	else
-		name = self.name
-	end
-
-	if class and static then
-	 return self.parent.type..'::'..name
-	elseif class then
-	 return 'self->'..name
-	else
-	 return name
-	end
+    local name
+    if prop_get then
+
+        name = prop_get.."()"
+    else
+        name = self.name
+    end
+
+    if class and static then
+        return self.parent.type..'::'..name
+    elseif class then
+        return 'self->'..name
+    else
+        return name
+    end
 end
 
 -- get variable pointer value
 function classVariable:getpointervalue (class,static)
- if class and static then
-  return class..'::p'
- elseif class then
-  return 'self->p'
- else
-  return 'p'
- end
+    if class and static then
+        return class..'::p'
+    elseif class then
+        return 'self->p'
+    else
+        return 'p'
+    end
 end
 
@@ -106,155 +106,155 @@
  local class = self:inclass()
 
-	local prop_get,prop_set
-	if string.find(self.mod, 'tolua_property') then
-
-		_,_,type = string.find(self.mod, "tolua_property__([^%s]*)")
-		type = type or "default"
-		prop_get,prop_set = get_property_methods(type, self.name)
-		self.mod = string.gsub(self.mod, "tolua_property[^%s]*", "")
-	end
-
- -- get function ------------------------------------------------
- if class then
-  output("/* get function:",self.name," of class ",class," */")
- else
-  output("/* get function:",self.name," */")
- end
- self.cgetname = self:cfuncname("tolua_get")
- output("#ifndef TOLUA_DISABLE_"..self.cgetname)
- output("\nstatic int",self.cgetname,"(lua_State* tolua_S)")
- output("{")
-
- -- declare self, if the case
- local _,_,static = strfind(self.mod,'^%s*(static)')
- if class and static==nil then
-  output(' ',self.parent.type,'*','self = ')
-  output('(',self.parent.type,'*) ')
-  output('tolua_tousertype(tolua_S,1,0);')
- elseif static then
-  _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)')
- end
-
-
- -- check self value
- if class and static==nil then
-	 output('#ifndef TOLUA_RELEASE\n')
-  output('  if (!self) tolua_error(tolua_S,"invalid \'self\' in accessing variable \''..self.name..'\'",NULL);');
-		output('#endif\n')
- end
-
- -- return value
- if string.find(self.mod, 'tolua_inherits') then
- 	output('#ifdef __cplusplus\n')
-	output('  tolua_pushusertype(tolua_S,(void*)static_cast<'..self.type..'*>(self), "',self.type,'");')
-	output('#else\n')
-	output('  tolua_pushusertype(tolua_S,(void*)(('..self.type..'*)self), "',self.type,'");')
-	output('#endif\n')
- else
-	local t,ct = isbasic(self.type)
-	if t then
-		output('  tolua_push'..t..'(tolua_S,(',ct,')'..self:getvalue(class,static,prop_get)..');')
-	else
-		t = self.type
-		if self.ptr == '&' or self.ptr == '' then
-			output('  tolua_pushusertype(tolua_S,(void*)&'..self:getvalue(class,static,prop_get)..',"',t,'");')
-		else
-			output('  tolua_pushusertype(tolua_S,(void*)'..self:getvalue(class,static,prop_get)..',"',t,'");')
-		end
-	end
- end
- output(' return 1;')
- output('}')
- output('#endif //#ifndef TOLUA_DISABLE\n')
- output('\n')
-
- -- set function ------------------------------------------------
- if not (strfind(self.type,'const%s+') or string.find(self.mod, 'tolua_readonly') or string.find(self.mod, 'tolua_inherits'))  then
-  if class then
-   output("/* set function:",self.name," of class ",class," */")
-  else
-   output("/* set function:",self.name," */")
-  end
-  self.csetname = self:cfuncname("tolua_set")
-  output("#ifndef TOLUA_DISABLE_"..self.csetname)
-  output("\nstatic int",self.csetname,"(lua_State* tolua_S)")
-  output("{")
-
-  -- declare self, if the case
-  if class and static==nil then
-   output(' ',self.parent.type,'*','self = ')
-   output('(',self.parent.type,'*) ')
-   output('tolua_tousertype(tolua_S,1,0);')
-   -- check self value
-		end
-  -- check types
-		output('#ifndef TOLUA_RELEASE\n')
-		output('  tolua_Error tolua_err;')
-  if class and static==nil then
-   output('  if (!self) tolua_error(tolua_S,"invalid \'self\' in accessing variable \''..self.name..'\'",NULL);');
-  elseif static then
-   _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)')
-  end
-
-  -- check variable type
-  output('  if (!'..self:outchecktype(2)..')')
-  output('   tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);')
-		output('#endif\n')
-
-  -- assign value
-		local def = 0
-		if self.def ~= '' then def = self.def end
-		if self.type == 'char*' and self.dim ~= '' then -- is string
-		 output(' strncpy(')
-			if class and static then
-				output(self.parent.type..'::'..self.name)
-			elseif class then
-				output('self->'..self.name)
-			else
-				output(self.name)
-			end
-			output(',tolua_tostring(tolua_S,2,',def,'),',self.dim,'-1);')
-		else
-			local ptr = ''
-			if self.ptr~='' then ptr = '*' end
-			output(' ')
-			local name = prop_set or self.name
-			if class and static then
-				output(self.parent.type..'::'..name)
-			elseif class then
-				output('self->'..name)
-			else
-				output(name)
-			end
-			local t = isbasic(self.type)
-			if prop_set then
-				output('(')
-			else
-				output(' = ')
-			end
-			if not t and ptr=='' then output('*') end
-			output('((',self.mod,self.type)
-			if not t then
-				output('*')
-			end
-			output(') ')
-			if t then
-				if isenum(self.type) then
-					output('(int) ')
-				end
-				output('tolua_to'..t,'(tolua_S,2,',def,'))')
-			else
-				output('tolua_tousertype(tolua_S,2,',def,'))')
-			end
-			if prop_set then
-				output(")")
-			end
-			output(";")
-		end
-  output(' return 0;')
-  output('}')
-  output('#endif //#ifndef TOLUA_DISABLE\n')
-  output('\n')
- end
+    local prop_get,prop_set
+    if string.find(self.mod, 'tolua_property') then
+
+        _,_,type = string.find(self.mod, "tolua_property__([^%s]*)")
+        type = type or "default"
+        prop_get,prop_set = get_property_methods(type, self.name)
+        self.mod = string.gsub(self.mod, "tolua_property[^%s]*", "")
+    end
+
+    -- get function ------------------------------------------------
+    if class then
+        output("/* get function:",self.name," of class ",class," */")
+    else
+        output("/* get function:",self.name," */")
+    end
+    self.cgetname = self:cfuncname("tolua_get")
+    output("#ifndef TOLUA_DISABLE_"..self.cgetname)
+    output("\nstatic int",self.cgetname,"(lua_State* tolua_S)")
+    output("{")
+
+    -- declare self, if the case
+    local _,_,static = strfind(self.mod,'^%s*(static)')
+    if class and static==nil then
+        output(' ',self.parent.type,'*','self = ')
+        output('(',self.parent.type,'*) ')
+        output('tolua_tousertype(tolua_S,1,0);')
+    elseif static then
+        _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)')
+    end
+
+
+    -- check self value
+    if class and static==nil then
+        output('#ifndef TOLUA_RELEASE\n')
+        output('  if (!self) tolua_error(tolua_S,"invalid \'self\' in accessing variable \''..self.name..'\'",NULL);');
+        output('#endif\n')
+    end
+
+    -- return value
+    if string.find(self.mod, 'tolua_inherits') then
+        output('#ifdef __cplusplus\n')
+        output('  tolua_pushusertype(tolua_S,(void*)static_cast<'..self.type..'*>(self), "',self.type,'");')
+        output('#else\n')
+        output('  tolua_pushusertype(tolua_S,(void*)(('..self.type..'*)self), "',self.type,'");')
+        output('#endif\n')
+    else
+        local t,ct = isbasic(self.type)
+        if t then
+            output('  tolua_push'..t..'(tolua_S,(',ct,')'..self:getvalue(class,static,prop_get)..');')
+        else
+            t = self.type
+            if self.ptr == '&' or self.ptr == '' then
+                output('  tolua_pushusertype(tolua_S,(void*)&'..self:getvalue(class,static,prop_get)..',"',t,'");')
+            else
+                output('  tolua_pushusertype(tolua_S,(void*)'..self:getvalue(class,static,prop_get)..',"',t,'");')
+            end
+        end
+    end
+    output(' return 1;')
+    output('}')
+    output('#endif //#ifndef TOLUA_DISABLE\n')
+    output('\n')
+
+    -- set function ------------------------------------------------
+    if not (strfind(self.type,'const%s+') or string.find(self.mod, 'tolua_readonly') or string.find(self.mod, 'tolua_inherits'))  then
+    if class then
+        output("/* set function:",self.name," of class ",class," */")
+    else
+        output("/* set function:",self.name," */")
+    end
+    self.csetname = self:cfuncname("tolua_set")
+    output("#ifndef TOLUA_DISABLE_"..self.csetname)
+    output("\nstatic int",self.csetname,"(lua_State* tolua_S)")
+    output("{")
+
+    -- declare self, if the case
+    if class and static==nil then
+        output(' ',self.parent.type,'*','self = ')
+        output('(',self.parent.type,'*) ')
+        output('tolua_tousertype(tolua_S,1,0);')
+        -- check self value
+    end
+    -- check types
+    output('#ifndef TOLUA_RELEASE\n')
+    output('  tolua_Error tolua_err;')
+    if class and static==nil then
+        output('  if (!self) tolua_error(tolua_S,"invalid \'self\' in accessing variable \''..self.name..'\'",NULL);');
+    elseif static then
+        _,_,self.mod = strfind(self.mod,'^%s*static%s%s*(.*)')
+    end
+
+    -- check variable type
+    output('  if (!'..self:outchecktype(2)..')')
+    output('   tolua_error(tolua_S,"#vinvalid type in variable assignment.",&tolua_err);')
+    output('#endif\n')
+
+    -- assign value
+    local def = 0
+    if self.def ~= '' then def = self.def end
+    if self.type == 'char*' and self.dim ~= '' then -- is string
+        output(' strncpy(')
+        if class and static then
+            output(self.parent.type..'::'..self.name)
+            elseif class then
+                output('self->'..self.name)
+            else
+                output(self.name)
+            end
+            output(',tolua_tostring(tolua_S,2,',def,'),',self.dim,'-1);')
+        else
+            local ptr = ''
+            if self.ptr~='' then ptr = '*' end
+            output(' ')
+            local name = prop_set or self.name
+            if class and static then
+                output(self.parent.type..'::'..name)
+            elseif class then
+                output('self->'..name)
+            else
+                output(name)
+            end
+            local t = isbasic(self.type)
+            if prop_set then
+                output('(')
+            else
+                output(' = ')
+            end
+            if not t and ptr=='' then output('*') end
+            output('((',self.mod,self.type)
+            if not t then
+                output('*')
+            end
+            output(') ')
+            if t then
+                if isenum(self.type) then
+                    output('(int) ')
+                end
+                output('tolua_to'..t,'(tolua_S,2,',def,'))')
+            else
+                output('tolua_tousertype(tolua_S,2,',def,'))')
+            end
+            if prop_set then
+                output(")")
+            end
+            output(";")
+        end
+        output(' return 0;')
+        output('}')
+        output('#endif //#ifndef TOLUA_DISABLE\n')
+        output('\n')
+    end
 
 end
@@ -262,27 +262,27 @@
 function classVariable:register (pre)
 
-	if not self:check_public_access() then
-		return
-	end
- pre = pre or ''
- local parent = self:inmodule() or self:innamespace() or self:inclass()
- if not parent then
-  if classVariable._warning==nil then
-   warning("Mapping variable to global may degrade performance")
-   classVariable._warning = 1
-  end
- end
- if self.csetname then
-  output(pre..'tolua_variable(tolua_S,"'..self.lname..'",'..self.cgetname..','..self.csetname..');')
- else
-  output(pre..'tolua_variable(tolua_S,"'..self.lname..'",'..self.cgetname..',NULL);')
- end
+    if not self:check_public_access() then
+        return
+    end
+    pre = pre or ''
+    local parent = self:inmodule() or self:innamespace() or self:inclass()
+    if not parent then
+        if classVariable._warning==nil then
+            warning("Mapping variable to global may degrade performance")
+            classVariable._warning = 1
+        end
+    end
+    if self.csetname then
+        output(pre..'tolua_variable(tolua_S,"'..self.lname..'",'..self.cgetname..','..self.csetname..');')
+    else
+        output(pre..'tolua_variable(tolua_S,"'..self.lname..'",'..self.cgetname..',NULL);')
+    end
 end
 
 -- Internal constructor
 function _Variable (t)
- setmetatable(t,classVariable)
- append(t)
- return t
+    setmetatable(t,classVariable)
+    append(t)
+    return t
 end
 
@@ -290,6 +290,6 @@
 -- Expects a string representing the variable declaration.
 function Variable (s)
- return _Variable (Declaration(s,'var'))
-end
-
-
+    return _Variable (Declaration(s,'var'))
+end
+
+
Index: /code/branches/buildsystem3/src/tolua/lua/verbatim.lua
===================================================================
--- /code/branches/buildsystem3/src/tolua/lua/verbatim.lua	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/lua/verbatim.lua	(revision 2664)
@@ -17,6 +17,6 @@
 --   line = line text
 classVerbatim = {
- line = '',
-	cond = nil,    -- condition: where to generate the code (s=suport, r=register)
+    line = '',
+    cond = nil,    -- condition: where to generate the code (s=suport, r=register)
 }
 classVerbatim.__index = classVerbatim
@@ -25,22 +25,22 @@
 -- preamble verbatim
 function classVerbatim:preamble ()
- if self.cond == '' then
-  write(self.line)
- end
+    if self.cond == '' then
+        write(self.line)
+    end
 end
 
 -- support code
 function classVerbatim:supcode ()
- if strfind(self.cond,'s') then
-  write(self.line)
-  write('\n')
- end
+    if strfind(self.cond,'s') then
+        write(self.line)
+        write('\n')
+    end
 end
 
 -- register code
 function classVerbatim:register (pre)
- if strfind(self.cond,'r') then
-  write(self.line)
- end
+    if strfind(self.cond,'r') then
+        write(self.line)
+    end
 end
 
@@ -48,15 +48,15 @@
 -- Print method
 function classVerbatim:print (ident,close)
- print(ident.."Verbatim{")
- print(ident.." line = '"..self.line.."',")
- print(ident.."}"..close)
-end
+    print(ident.."Verbatim{")
+    print(ident.." line = '"..self.line.."',")
+    print(ident.."}"..close)
+    end
 
 
 -- Internal constructor
 function _Verbatim (t)
- setmetatable(t,classVerbatim)
- append(t)
- return t
+    setmetatable(t,classVerbatim)
+    append(t)
+    return t
 end
 
@@ -64,14 +64,14 @@
 -- Expects a string representing the text line
 function Verbatim (l,cond)
- if strsub(l,1,1) == "'" then
-  l = strsub(l,2)
- elseif strsub(l,1,1) == '$' then
-  cond = 'sr'       -- generates in both suport and register fragments
-  l = strsub(l,2)
- end
- return _Verbatim {
-  line = l,
-  cond = cond or '',
- }
+    if strsub(l,1,1) == "'" then
+        l = strsub(l,2)
+    elseif strsub(l,1,1) == '$' then
+        cond = 'sr'       -- generates in both suport and register fragments
+        l = strsub(l,2)
+    end
+    return _Verbatim {
+        line = l,
+        cond = cond or '',
+    }
 end
 
Index: /code/branches/buildsystem3/src/tolua/tolua++.h
===================================================================
--- /code/branches/buildsystem3/src/tolua/tolua++.h	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/tolua++.h	(revision 2664)
@@ -65,6 +65,6 @@
 typedef int lua_Object;
 
-#include "lua/lua.h"
-#include "lua/lauxlib.h"
+#include "lua.h"
+#include "lauxlib.h"
 
 struct tolua_Error
Index: de/branches/buildsystem3/src/tolua/tolua-5.1.pkg
===================================================================
--- /code/branches/buildsystem3/src/tolua/tolua-5.1.pkg	(revision 2663)
+++ 	(revision )
@@ -1,30 +1,0 @@
-$lfile "../../src/tolua/lua/compat-5.1.lua"
-$lfile "../../src/tolua/lua/compat.lua"
-$lfile "../../src/tolua/lua/basic.lua"
-$lfile "../../src/tolua/lua/feature.lua"
-$lfile "../../src/tolua/lua/verbatim.lua"
-$lfile "../../src/tolua/lua/code.lua"
-$lfile "../../src/tolua/lua/typedef.lua"
-$lfile "../../src/tolua/lua/container.lua"
-$lfile "../../src/tolua/lua/package.lua"
-$lfile "../../src/tolua/lua/module.lua"
-$lfile "../../src/tolua/lua/namespace.lua"
-$lfile "../../src/tolua/lua/define.lua"
-$lfile "../../src/tolua/lua/enumerate.lua"
-$lfile "../../src/tolua/lua/declaration.lua"
-$lfile "../../src/tolua/lua/variable.lua"
-$lfile "../../src/tolua/lua/array.lua"
-$lfile "../../src/tolua/lua/function.lua"
-$lfile "../../src/tolua/lua/operator.lua"
-$lfile "../../src/tolua/lua/class.lua"
-$lfile "../../src/tolua/lua/clean.lua"
-$lfile "../../src/tolua/lua/doit.lua"
-
-$[
-local err,msg = pcall(doit)
-if not err then
- local _,_,label,msg = strfind(msg,"(.-:.-:%s*)(.*)")
- tolua_error(msg,label)
- print(debug.traceback())
-end
-$]
Index: /code/branches/buildsystem3/src/tolua/tolua.c
===================================================================
--- /code/branches/buildsystem3/src/tolua/tolua.c	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/tolua.c	(revision 2664)
@@ -5,4 +5,6 @@
 ** Aug 2003
 ** $Id:$
+** Extension by Orxonox (Reto Grieder) to support working directory
+** and direct usage of lua files. (2008)
 */
 
@@ -15,7 +17,7 @@
 #include "tolua++.h"
 
-#include "lua/lua.h"
-#include "lua/lualib.h"
-#include "lua/lauxlib.h"
+#include "lua.h"
+#include "lualib.h"
+#include "lauxlib.h"
 
 #include <stdio.h>
@@ -34,4 +36,6 @@
          "  -H  file : create include file.\n"
          "  -n  name : set package name; default is input file root name.\n"
+         "  -w  directory : set working directory; default is location of package file.\n"
+         "  -s  file : specify source lua code for the parser; all.lua is default.\n"
          "  -p       : parse only.\n"
          "  -P       : parse and print structure information (for debug).\n"
@@ -65,10 +69,10 @@
 
 static void add_extra (lua_State* L, char* value) {
-	int len;
-	lua_getglobal(L, "_extra_parameters");
-	len = luaL_getn(L, -1);
-	lua_pushstring(L, value);
-	lua_rawseti(L, -2, len+1);
-	lua_pop(L, 1);
+ int len;
+ lua_getglobal(L, "_extra_parameters");
+ len = luaL_getn(L, -1);
+ lua_pushstring(L, value);
+ lua_rawseti(L, -2, len+1);
+ lua_pop(L, 1);
 };
 
@@ -82,4 +86,7 @@
 int main (int argc, char* argv[])
 {
+ char* working_directory = "";
+ char* lua_source = "";
+
  #ifdef LUA_VERSION_NUM /* lua 5.1 */
  lua_State* L = luaL_newstate();
@@ -97,4 +104,5 @@
  lua_pushstring(L,TOLUA_VERSION); lua_setglobal(L,"TOLUA_VERSION");
  lua_pushstring(L,LUA_VERSION); lua_setglobal(L,"TOLUA_LUA_VERSION");
+
 
  if (argc==1)
@@ -125,4 +133,12 @@
      case 'n': setfield(L,t,"n",argv[++i]); break;
      case 'H': setfield(L,t,"H",argv[++i]); break;
+     case 'w':
+      working_directory = argv[++i];
+      setfield(L,t,"w",argv[i]);
+      break;
+     case 's':
+      lua_source = argv[++i];
+      setfield(L,t,"s",argv[i]);
+      break;
      case 'S': setfield(L,t,"S",""); break;
      case '1': setfield(L,t,"1",""); break;
@@ -144,24 +160,52 @@
   lua_pop(L,1);
  }
-/* #define TOLUA_SCRIPT_RUN */
-#ifndef TOLUA_SCRIPT_RUN
+
  {
-  int tolua_tolua_open (lua_State* L);
-  tolua_tolua_open(L);
+  char path[BUFSIZ];
+  char file[BUFSIZ];
+  path[0] = '\0';
+  file[0] = '\0';
+
+  if (strlen(lua_source) > 0 &&
+      lua_source[0] != '/' &&
+      lua_source[0] != '\\' &&
+      strlen(lua_source) > 1 &&
+      lua_source[1] != ':')
+  {
+   /* Relative path, prefix working directory */
+   strcpy(path, working_directory);
+   /* Make sure there is '\\' or '/' at the end of the path */
+   if (strlen(path) > 0)
+   {
+    char last = path[strlen(path) - 1];
+    if (last != '\\' && last != '/')
+     strcat(path, "/");
+   }
+  }
+
+  strcat(path, lua_source);
+
+  /* Extract the full path */
+  {
+   char* p;
+   p = strrchr(path, '/');
+   if (p == NULL)
+    p = strrchr(path, '\\');
+   p = (p == NULL) ? path : p + 1;
+   strcpy(file, p);
+   *p = '\0';
+  }
+  if (strlen(file) == 0)
+   strcpy(file, "all.lua");
+
+  lua_pushstring(L, path);
+  lua_setglobal(L, "path");
+  strcat(path, file);
+#ifdef LUA_VERSION_NUM /* lua 5.1 */
+  luaL_dofile(L, path);
+#else
+  lua_dofile(L, path);
+#endif
  }
-#else
- {
-  char* p;
-  char  path[BUFSIZ];
-  strcpy(path,argv[0]);
-  p = strrchr(path,'/');
-  if (p==NULL) p = strrchr(path,'\\');
-  p = (p==NULL) ? path : p+1;
-  sprintf(p,"%s","../src/bin/lua/");
-  lua_pushstring(L,path); lua_setglobal(L,"path");
-		strcat(path,"all.lua");
-  lua_dofile(L,path);
- }
-#endif
  return 0;
 }
Index: /code/branches/buildsystem3/src/tolua/tolua_is.c
===================================================================
--- /code/branches/buildsystem3/src/tolua/tolua_is.c	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/tolua_is.c	(revision 2664)
@@ -14,5 +14,5 @@
 
 #include "tolua++.h"
-#include "lua/lauxlib.h"
+#include "lauxlib.h"
 
 #include <stdlib.h>
Index: /code/branches/buildsystem3/src/tolua/tolua_map.c
===================================================================
--- /code/branches/buildsystem3/src/tolua/tolua_map.c	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/tolua_map.c	(revision 2664)
@@ -15,5 +15,5 @@
 #include "tolua++.h"
 #include "tolua_event.h"
-#include "lua/lauxlib.h"
+#include "lauxlib.h"
 
 #include <string.h>
Index: /code/branches/buildsystem3/src/tolua/tolua_push.c
===================================================================
--- /code/branches/buildsystem3/src/tolua/tolua_push.c	(revision 2663)
+++ /code/branches/buildsystem3/src/tolua/tolua_push.c	(revision 2664)
@@ -14,5 +14,5 @@
 
 #include "tolua++.h"
-#include "lua/lauxlib.h"
+#include "lauxlib.h"
 
 #include <stdlib.h>
Index: de/branches/buildsystem3/src/tolua/toluabind.c
===================================================================
--- /code/branches/buildsystem3/src/tolua/toluabind.c	(revision 2663)
+++ 	(revision )
@@ -1,7628 +1,0 @@
-/*
-** Lua binding: tolua
-** Generated automatically by tolua++-1.0.91 on Wed Apr 26 22:30:14 2006.
-*/
-
-#ifndef __cplusplus
-#include "stdlib.h"
-#endif
-#include "string.h"
-
-#include "tolua++.h"
-
-/* Exported function */
-int  tolua_tolua_open (lua_State* tolua_S);
-
-
-/* function to register type */
-static void tolua_reg_types (lua_State* tolua_S)
-{
-}
-
-/* Open function */
-int tolua_tolua_open (lua_State* tolua_S)
-{
- tolua_open(tolua_S);
- tolua_reg_types(tolua_S);
- tolua_module(tolua_S,NULL,0);
- tolua_beginmodule(tolua_S,NULL);
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-   105,102, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,
-     95, 86, 69, 82, 83, 73, 79, 78, 44, 32, 34, 53, 37, 46, 48,
-     34, 41, 32,116,104,101,110, 13, 10,  9,114,101,116,117,114,
-    110, 13, 10,101,110,100, 13, 10, 13, 10, 45, 45, 32, 34,108,
-    111, 97,100,102,105,108,101, 34, 13, 10,108,111, 99, 97,108,
-     32,102,117,110, 99,116,105,111,110, 32,112,112, 95,100,111,
-    102,105,108,101, 40,112, 97,116,104, 41, 13, 10, 13, 10,  9,
-    108,111, 99, 97,108, 32,108,111, 97,100,101,100, 32, 61, 32,
-    102, 97,108,115,101, 13, 10,  9,108,111, 99, 97,108, 32,103,
-    101,116,102,105,108,101, 32, 61, 32,102,117,110, 99,116,105,
-    111,110, 40, 41, 13, 10, 13, 10,  9,  9,105,102, 32,108,111,
-     97,100,101,100, 32,116,104,101,110, 13, 10,  9,  9,  9,114,
-    101,116,117,114,110, 13, 10,  9,  9,101,108,115,101, 13, 10,
-      9,  9,  9,108,111, 99, 97,108, 32,102,105,108,101, 44,101,
-    114,114, 32, 61, 32,105,111, 46,111,112,101,110, 40,112, 97,
-    116,104, 41, 13, 10,  9,  9,  9,105,102, 32,110,111,116, 32,
-    102,105,108,101, 32,116,104,101,110, 13, 10,  9,  9,  9,  9,
-    101,114,114,111,114, 40, 34,101,114,114,111,114, 32,108,111,
-     97,100,105,110,103, 32,102,105,108,101, 32, 34, 46, 46,112,
-     97,116,104, 46, 46, 34, 58, 32, 34, 46, 46,101,114,114, 41,
-     13, 10,  9,  9,  9,101,110,100, 13, 10,  9,  9,  9,108,111,
-     99, 97,108, 32,114,101,116, 32, 61, 32,102,105,108,101, 58,
-    114,101, 97,100, 40, 34, 42, 97, 34, 41, 13, 10,  9,  9,  9,
-    102,105,108,101, 58, 99,108,111,115,101, 40, 41, 13, 10, 13,
-     10,  9,  9,  9,114,101,116, 32, 61, 32,115,116,114,105,110,
-    103, 46,103,115,117, 98, 40,114,101,116, 44, 32, 34, 37, 46,
-     37, 46, 37, 46, 37,115, 42, 37, 41, 34, 44, 32, 34, 46, 46,
-     46, 41, 32,108,111, 99, 97,108, 32, 97,114,103, 32, 61, 32,
-    123,110, 61,115,101,108,101, 99,116, 40, 39, 35, 39, 44, 32,
-     46, 46, 46, 41, 44, 32, 46, 46, 46,125, 59, 34, 41, 13, 10,
-     13, 10,  9,  9,  9,108,111, 97,100,101,100, 32, 61, 32,116,
-    114,117,101, 13, 10,  9,  9,  9,114,101,116,117,114,110, 32,
-    114,101,116, 13, 10,  9,  9,101,110,100, 13, 10,  9,101,110,
-    100, 13, 10, 13, 10,  9,108,111, 99, 97,108, 32,102, 32, 61,
-     32,108,111, 97,100, 40,103,101,116,102,105,108,101, 44, 32,
-    112, 97,116,104, 41, 13, 10,  9,114,101,116,117,114,110, 32,
-    102, 40, 41, 13, 10,101,110,100, 13, 10, 13, 10,111,108,100,
-     95,100,111,102,105,108,101, 32, 61, 32,100,111,102,105,108,
-    101, 13, 10,100,111,102,105,108,101, 32, 61, 32,112,112, 95,
-    100,111,102,105,108,101, 13, 10, 13, 10, 13, 10, 45, 45, 32,
-    115,116,114,105,110,103, 46,103,115,117, 98, 13, 10, 45, 45,
-     91, 91, 13, 10,108,111, 99, 97,108, 32,111,103,115,117, 98,
-     32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 13,
-     10,108,111, 99, 97,108, 32,102,117,110, 99,116,105,111,110,
-     32, 99,111,109,112,103,115,117, 98, 40, 97, 44, 98, 44, 99,
-     44,100, 41, 13, 10, 32, 32,105,102, 32,116,121,112,101, 40,
-     99, 41, 32, 61, 61, 32, 34,102,117,110, 99,116,105,111,110,
-     34, 32,116,104,101,110, 13, 10, 32, 32, 32, 32,108,111, 99,
-     97,108, 32,111, 99, 32, 61, 32, 99, 13, 10, 32, 32, 32, 32,
-     99, 32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40, 46,
-     46, 46, 41, 32,114,101,116,117,114,110, 32,111, 99, 40, 46,
-     46, 46, 41, 32,111,114, 32, 39, 39, 32,101,110,100, 13, 10,
-     32, 32,101,110,100, 13, 10, 32, 32,114,101,116,117,114,110,
-     32,111,103,115,117, 98, 40, 97, 44, 98, 44, 99, 44,100, 41,
-     13, 10,101,110,100, 13, 10,115,116,114,105,110,103, 46,114,
-    101,112,108, 32, 61, 32,111,103,115,117, 98, 13, 10, 45, 45,
-     93, 93, 13, 10, 13, 10, 45, 45,115,116,114,105,110,103, 46,
-    103,115,117, 98, 32, 61, 32, 99,111,109,112,103,115,117, 98,
-     13,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/compat-5.1.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 82,101, 97,108,
-     32,103,108,111, 98, 97,108,115, 10, 45, 45, 32, 95, 65, 76,
-     69, 82, 84, 10, 45, 45, 32, 95, 69, 82, 82, 79, 82, 77, 69,
-     83, 83, 65, 71, 69, 10, 45, 45, 32, 95, 86, 69, 82, 83, 73,
-     79, 78, 10, 45, 45, 32, 95, 71, 10, 45, 45, 32, 97,115,115,
-    101,114,116, 10, 45, 45, 32,101,114,114,111,114, 10, 45, 45,
-     32,109,101,116, 97,116, 97, 98,108,101, 10, 45, 45, 32,110,
-    101,120,116, 10, 45, 45, 32,112,114,105,110,116, 10, 45, 45,
-     32,114,101,113,117,105,114,101, 10, 45, 45, 32,116,111,110,
-    117,109, 98,101,114, 10, 45, 45, 32,116,111,115,116,114,105,
-    110,103, 10, 45, 45, 32,116,121,112,101, 10, 45, 45, 32,117,
-    110,112, 97, 99,107, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10,
-     45, 45, 32, 99,111,108,108,101, 99,116,103, 97,114, 98, 97,
-    103,101, 10, 45, 45, 32,103, 99,105,110,102,111, 10, 10, 45,
-     45, 32,103,108,111, 98, 97,108,115, 10, 10, 45, 45, 32, 99,
-     97,108,108, 32, 32, 32, 45, 62, 32,112,114,111,116,101, 99,
-    116, 40,102, 44, 32,101,114,114, 41, 10, 45, 45, 32,108,111,
-     97,100,102,105,108,101, 10, 45, 45, 32,108,111, 97,100,115,
-    116,114,105,110,103, 10, 10, 45, 45, 32,114, 97,119,103,101,
-    116, 10, 45, 45, 32,114, 97,119,115,101,116, 10, 10, 45, 45,
-     32,103,101,116, 97,114,103,115, 32, 61, 32, 77, 97,105,110,
-     46,103,101,116, 97,114,103,115, 32, 63, 63, 10, 10,114, 97,
-    119,116,121,112,101, 32, 61, 32,116,121,112,101, 10, 10,102,
-    117,110, 99,116,105,111,110, 32,100,111, 95, 32, 40,102, 44,
-     32,101,114,114, 41, 10, 32, 32,105,102, 32,110,111,116, 32,
-    102, 32,116,104,101,110, 32,112,114,105,110,116, 40,101,114,
-    114, 41, 59, 32,114,101,116,117,114,110, 32,101,110,100, 10,
-     32, 32,108,111, 99, 97,108, 32, 97, 44, 98, 32, 61, 32,112,
-     99, 97,108,108, 40,102, 41, 10, 32, 32,105,102, 32,110,111,
-    116, 32, 97, 32,116,104,101,110, 32,112,114,105,110,116, 40,
-     98, 41, 59, 32,114,101,116,117,114,110, 32,110,105,108, 10,
-     32, 32,101,108,115,101, 32,114,101,116,117,114,110, 32, 98,
-     32,111,114, 32,116,114,117,101, 10, 32, 32,101,110,100, 10,
-    101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,100,
-    111,115,116,114,105,110,103, 40,115, 41, 32,114,101,116,117,
-    114,110, 32,100,111, 95, 40,108,111, 97,100,115,116,114,105,
-    110,103, 40,115, 41, 41, 32,101,110,100, 10, 45, 45, 32,102,
-    117,110, 99,116,105,111,110, 32,100,111,102,105,108,101, 40,
-    115, 41, 32,114,101,116,117,114,110, 32,100,111, 95, 40,108,
-    111, 97,100,102,105,108,101, 40,115, 41, 41, 32,101,110,100,
-     10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 84, 97,
-     98,108,101, 32,108,105, 98,114, 97,114,121, 10,108,111, 99,
-     97,108, 32,116, 97, 98, 32, 61, 32,116, 97, 98,108,101, 10,
-    102,111,114,101, 97, 99,104, 32, 61, 32,116, 97, 98, 46,102,
-    111,114,101, 97, 99,104, 10,102,111,114,101, 97, 99,104,105,
-     32, 61, 32,116, 97, 98, 46,102,111,114,101, 97, 99,104,105,
-     10,103,101,116,110, 32, 61, 32,116, 97, 98, 46,103,101,116,
-    110, 10,116,105,110,115,101,114,116, 32, 61, 32,116, 97, 98,
-     46,105,110,115,101,114,116, 10,116,114,101,109,111,118,101,
-     32, 61, 32,116, 97, 98, 46,114,101,109,111,118,101, 10,115,
-    111,114,116, 32, 61, 32,116, 97, 98, 46,115,111,114,116, 10,
-     10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45, 32, 68,101, 98,
-    117,103, 32,108,105, 98,114, 97,114,121, 10,108,111, 99, 97,
-    108, 32,100, 98,103, 32, 61, 32,100,101, 98,117,103, 10,103,
-    101,116,105,110,102,111, 32, 61, 32,100, 98,103, 46,103,101,
-    116,105,110,102,111, 10,103,101,116,108,111, 99, 97,108, 32,
-     61, 32,100, 98,103, 46,103,101,116,108,111, 99, 97,108, 10,
-    115,101,116, 99, 97,108,108,104,111,111,107, 32, 61, 32,102,
-    117,110, 99,116,105,111,110, 32, 40, 41, 32,101,114,114,111,
-    114, 34, 96,115,101,116, 99, 97,108,108,104,111,111,107, 39,
-     32,105,115, 32,100,101,112,114,101, 99, 97,116,101,100, 34,
-     32,101,110,100, 10,115,101,116,108,105,110,101,104,111,111,
-    107, 32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40, 41,
-     32,101,114,114,111,114, 34, 96,115,101,116,108,105,110,101,
-    104,111,111,107, 39, 32,105,115, 32,100,101,112,114,101, 99,
-     97,116,101,100, 34, 32,101,110,100, 10,115,101,116,108,111,
-     99, 97,108, 32, 61, 32,100, 98,103, 46,115,101,116,108,111,
-     99, 97,108, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 45, 45,
-     32,109, 97,116,104, 32,108,105, 98,114, 97,114,121, 10,108,
-    111, 99, 97,108, 32,109, 97,116,104, 32, 61, 32,109, 97,116,
-    104, 10, 97, 98,115, 32, 61, 32,109, 97,116,104, 46, 97, 98,
-    115, 10, 97, 99,111,115, 32, 61, 32,102,117,110, 99,116,105,
-    111,110, 32, 40,120, 41, 32,114,101,116,117,114,110, 32,109,
-     97,116,104, 46,100,101,103, 40,109, 97,116,104, 46, 97, 99,
-    111,115, 40,120, 41, 41, 32,101,110,100, 10, 97,115,105,110,
-     32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40,120, 41,
-     32,114,101,116,117,114,110, 32,109, 97,116,104, 46,100,101,
-    103, 40,109, 97,116,104, 46, 97,115,105,110, 40,120, 41, 41,
-     32,101,110,100, 10, 97,116, 97,110, 32, 61, 32,102,117,110,
-     99,116,105,111,110, 32, 40,120, 41, 32,114,101,116,117,114,
-    110, 32,109, 97,116,104, 46,100,101,103, 40,109, 97,116,104,
-     46, 97,116, 97,110, 40,120, 41, 41, 32,101,110,100, 10, 97,
-    116, 97,110, 50, 32, 61, 32,102,117,110, 99,116,105,111,110,
-     32, 40,120, 44,121, 41, 32,114,101,116,117,114,110, 32,109,
-     97,116,104, 46,100,101,103, 40,109, 97,116,104, 46, 97,116,
-     97,110, 50, 40,120, 44,121, 41, 41, 32,101,110,100, 10, 99,
-    101,105,108, 32, 61, 32,109, 97,116,104, 46, 99,101,105,108,
-     10, 99,111,115, 32, 61, 32,102,117,110, 99,116,105,111,110,
-     32, 40,120, 41, 32,114,101,116,117,114,110, 32,109, 97,116,
-    104, 46, 99,111,115, 40,109, 97,116,104, 46,114, 97,100, 40,
-    120, 41, 41, 32,101,110,100, 10,100,101,103, 32, 61, 32,109,
-     97,116,104, 46,100,101,103, 10,101,120,112, 32, 61, 32,109,
-     97,116,104, 46,101,120,112, 10,102,108,111,111,114, 32, 61,
-     32,109, 97,116,104, 46,102,108,111,111,114, 10,102,114,101,
-    120,112, 32, 61, 32,109, 97,116,104, 46,102,114,101,120,112,
-     10,108,100,101,120,112, 32, 61, 32,109, 97,116,104, 46,108,
-    100,101,120,112, 10,108,111,103, 32, 61, 32,109, 97,116,104,
-     46,108,111,103, 10,108,111,103, 49, 48, 32, 61, 32,109, 97,
-    116,104, 46,108,111,103, 49, 48, 10,109, 97,120, 32, 61, 32,
-    109, 97,116,104, 46,109, 97,120, 10,109,105,110, 32, 61, 32,
-    109, 97,116,104, 46,109,105,110, 10,109,111,100, 32, 61, 32,
-    109, 97,116,104, 46,109,111,100, 10, 80, 73, 32, 61, 32,109,
-     97,116,104, 46,112,105, 10, 45, 45, 63, 63, 63, 32,112,111,
-    119, 32, 61, 32,109, 97,116,104, 46,112,111,119, 32, 32, 10,
-    114, 97,100, 32, 61, 32,109, 97,116,104, 46,114, 97,100, 10,
-    114, 97,110,100,111,109, 32, 61, 32,109, 97,116,104, 46,114,
-     97,110,100,111,109, 10,114, 97,110,100,111,109,115,101,101,
-    100, 32, 61, 32,109, 97,116,104, 46,114, 97,110,100,111,109,
-    115,101,101,100, 10,115,105,110, 32, 61, 32,102,117,110, 99,
-    116,105,111,110, 32, 40,120, 41, 32,114,101,116,117,114,110,
-     32,109, 97,116,104, 46,115,105,110, 40,109, 97,116,104, 46,
-    114, 97,100, 40,120, 41, 41, 32,101,110,100, 10,115,113,114,
-    116, 32, 61, 32,109, 97,116,104, 46,115,113,114,116, 10,116,
-     97,110, 32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40,
-    120, 41, 32,114,101,116,117,114,110, 32,109, 97,116,104, 46,
-    116, 97,110, 40,109, 97,116,104, 46,114, 97,100, 40,120, 41,
-     41, 32,101,110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10,
-     45, 45, 32,115,116,114,105,110,103, 32,108,105, 98,114, 97,
-    114,121, 10,108,111, 99, 97,108, 32,115,116,114, 32, 61, 32,
-    115,116,114,105,110,103, 10,115,116,114, 98,121,116,101, 32,
-     61, 32,115,116,114, 46, 98,121,116,101, 10,115,116,114, 99,
-    104, 97,114, 32, 61, 32,115,116,114, 46, 99,104, 97,114, 10,
-    115,116,114,102,105,110,100, 32, 61, 32,115,116,114, 46,102,
-    105,110,100, 10,102,111,114,109, 97,116, 32, 61, 32,115,116,
-    114, 46,102,111,114,109, 97,116, 10,103,115,117, 98, 32, 61,
-     32,115,116,114, 46,103,115,117, 98, 10,115,116,114,108,101,
-    110, 32, 61, 32,115,116,114, 46,108,101,110, 10,115,116,114,
-    108,111,119,101,114, 32, 61, 32,115,116,114, 46,108,111,119,
-    101,114, 10,115,116,114,114,101,112, 32, 61, 32,115,116,114,
-     46,114,101,112, 10,115,116,114,115,117, 98, 32, 61, 32,115,
-    116,114, 46,115,117, 98, 10,115,116,114,117,112,112,101,114,
-     32, 61, 32,115,116,114, 46,117,112,112,101,114, 10, 10, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 10, 45, 45, 32,111,115, 32,108,105,
-     98,114, 97,114,121, 10, 99,108,111, 99,107, 32, 61, 32,111,
-    115, 46, 99,108,111, 99,107, 10,100, 97,116,101, 32, 61, 32,
-    111,115, 46,100, 97,116,101, 10,100,105,102,102,116,105,109,
-    101, 32, 61, 32,111,115, 46,100,105,102,102,116,105,109,101,
-     10,101,120,101, 99,117,116,101, 32, 61, 32,111,115, 46,101,
-    120,101, 99,117,116,101, 32, 45, 45, 63, 10,101,120,105,116,
-     32, 61, 32,111,115, 46,101,120,105,116, 10,103,101,116,101,
-    110,118, 32, 61, 32,111,115, 46,103,101,116,101,110,118, 10,
-    114,101,109,111,118,101, 32, 61, 32,111,115, 46,114,101,109,
-    111,118,101, 10,114,101,110, 97,109,101, 32, 61, 32,111,115,
-     46,114,101,110, 97,109,101, 10,115,101,116,108,111, 99, 97,
-    108,101, 32, 61, 32,111,115, 46,115,101,116,108,111, 99, 97,
-    108,101, 10,116,105,109,101, 32, 61, 32,111,115, 46,116,105,
-    109,101, 10,116,109,112,110, 97,109,101, 32, 61, 32,111,115,
-     46,116,109,112,110, 97,109,101, 10, 10, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 10, 45, 45, 32, 99,111,109,112, 97,116,105, 98,105,
-    108,105,116,121, 32,111,110,108,121, 10,103,101,116,103,108,
-    111, 98, 97,108, 32, 61, 32,102,117,110, 99,116,105,111,110,
-     32, 40,110, 41, 32,114,101,116,117,114,110, 32, 95, 71, 91,
-    110, 93, 32,101,110,100, 10,115,101,116,103,108,111, 98, 97,
-    108, 32, 61, 32,102,117,110, 99,116,105,111,110, 32, 40,110,
-     44,118, 41, 32, 95, 71, 91,110, 93, 32, 61, 32,118, 32,101,
-    110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 10,108,111,
-     99, 97,108, 32,105,111, 44, 32,116, 97, 98, 32, 61, 32,105,
-    111, 44, 32,116, 97, 98,108,101, 10, 10, 45, 45, 32, 73, 79,
-     32,108,105, 98,114, 97,114,121, 32, 40,102,105,108,101,115,
-     41, 10, 95, 83, 84, 68, 73, 78, 32, 61, 32,105,111, 46,115,
-    116,100,105,110, 10, 95, 83, 84, 68, 69, 82, 82, 32, 61, 32,
-    105,111, 46,115,116,100,101,114,114, 10, 95, 83, 84, 68, 79,
-     85, 84, 32, 61, 32,105,111, 46,115,116,100,111,117,116, 10,
-     95, 73, 78, 80, 85, 84, 32, 61, 32,105,111, 46,115,116,100,
-    105,110, 10, 95, 79, 85, 84, 80, 85, 84, 32, 61, 32,105,111,
-     46,115,116,100,111,117,116, 10,115,101,101,107, 32, 61, 32,
-    105,111, 46,115,116,100,105,110, 46,115,101,101,107, 32, 32,
-     32, 45, 45, 32,115,105, 99,107, 32, 59, 45, 41, 10,116,109,
-    112,102,105,108,101, 32, 61, 32,105,111, 46,116,109,112,102,
-    105,108,101, 10, 99,108,111,115,101,102,105,108,101, 32, 61,
-     32,105,111, 46, 99,108,111,115,101, 10,111,112,101,110,102,
-    105,108,101, 32, 61, 32,105,111, 46,111,112,101,110, 10, 10,
-    102,117,110, 99,116,105,111,110, 32,102,108,117,115,104, 32,
-     40,102, 41, 10, 32, 32,105,102, 32,102, 32,116,104,101,110,
-     32,102, 58,102,108,117,115,104, 40, 41, 10, 32, 32,101,108,
-    115,101, 32, 95, 79, 85, 84, 80, 85, 84, 58,102,108,117,115,
-    104, 40, 41, 10, 32, 32,101,110,100, 10,101,110,100, 10, 10,
-    102,117,110, 99,116,105,111,110, 32,114,101, 97,100,102,114,
-    111,109, 32, 40,110, 97,109,101, 41, 10, 32, 32,105,102, 32,
-    110, 97,109,101, 32, 61, 61, 32,110,105,108, 32,116,104,101,
-    110, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,102, 44, 32,
-    101,114,114, 44, 32, 99,111,100, 32, 61, 32,105,111, 46, 99,
-    108,111,115,101, 40, 95, 73, 78, 80, 85, 84, 41, 10, 32, 32,
-     32, 32, 95, 73, 78, 80, 85, 84, 32, 61, 32,105,111, 46,115,
-    116,100,105,110, 10, 32, 32, 32, 32,114,101,116,117,114,110,
-     32,102, 44, 32,101,114,114, 44, 32, 99,111,100, 10, 32, 32,
-    101,108,115,101, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,
-    102, 44, 32,101,114,114, 44, 32, 99,111,100, 32, 61, 32,105,
-    111, 46,111,112,101,110, 40,110, 97,109,101, 44, 32, 34,114,
-     34, 41, 10, 32, 32, 32, 32, 95, 73, 78, 80, 85, 84, 32, 61,
-     32,102, 32,111,114, 32, 95, 73, 78, 80, 85, 84, 10, 32, 32,
-     32, 32,114,101,116,117,114,110, 32,102, 44, 32,101,114,114,
-     44, 32, 99,111,100, 10, 32, 32,101,110,100, 10,101,110,100,
-     10, 10,102,117,110, 99,116,105,111,110, 32,119,114,105,116,
-    101,116,111, 32, 40,110, 97,109,101, 41, 10, 32, 32,105,102,
-     32,110, 97,109,101, 32, 61, 61, 32,110,105,108, 32,116,104,
-    101,110, 10, 32, 32, 32, 32,108,111, 99, 97,108, 32,102, 44,
-     32,101,114,114, 44, 32, 99,111,100, 32, 61, 32,105,111, 46,
-     99,108,111,115,101, 40, 95, 79, 85, 84, 80, 85, 84, 41, 10,
-     32, 32, 32, 32, 95, 79, 85, 84, 80, 85, 84, 32, 61, 32,105,
-    111, 46,115,116,100,111,117,116, 10, 32, 32, 32, 32,114,101,
-    116,117,114,110, 32,102, 44, 32,101,114,114, 44, 32, 99,111,
-    100, 10, 32, 32,101,108,115,101, 10, 32, 32, 32, 32,108,111,
-     99, 97,108, 32,102, 44, 32,101,114,114, 44, 32, 99,111,100,
-     32, 61, 32,105,111, 46,111,112,101,110, 40,110, 97,109,101,
-     44, 32, 34,119, 34, 41, 10, 32, 32, 32, 32, 95, 79, 85, 84,
-     80, 85, 84, 32, 61, 32,102, 32,111,114, 32, 95, 79, 85, 84,
-     80, 85, 84, 10, 32, 32, 32, 32,114,101,116,117,114,110, 32,
-    102, 44, 32,101,114,114, 44, 32, 99,111,100, 10, 32, 32,101,
-    110,100, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,
-    110, 32, 97,112,112,101,110,100,116,111, 32, 40,110, 97,109,
-    101, 41, 10, 32, 32,108,111, 99, 97,108, 32,102, 44, 32,101,
-    114,114, 44, 32, 99,111,100, 32, 61, 32,105,111, 46,111,112,
-    101,110, 40,110, 97,109,101, 44, 32, 34, 97, 34, 41, 10, 32,
-     32, 95, 79, 85, 84, 80, 85, 84, 32, 61, 32,102, 32,111,114,
-     32, 95, 79, 85, 84, 80, 85, 84, 10, 32, 32,114,101,116,117,
-    114,110, 32,102, 44, 32,101,114,114, 44, 32, 99,111,100, 10,
-    101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,114,
-    101, 97,100, 32, 40, 46, 46, 46, 41, 10, 32, 32,108,111, 99,
-     97,108, 32,102, 32, 61, 32, 95, 73, 78, 80, 85, 84, 10, 32,
-     32,105,102, 32,114, 97,119,116,121,112,101, 40, 97,114,103,
-     91, 49, 93, 41, 32, 61, 61, 32, 39,117,115,101,114,100, 97,
-    116, 97, 39, 32,116,104,101,110, 10, 32, 32, 32, 32,102, 32,
-     61, 32,116, 97, 98, 46,114,101,109,111,118,101, 40, 97,114,
-    103, 44, 32, 49, 41, 10, 32, 32,101,110,100, 10, 32, 32,114,
-    101,116,117,114,110, 32,102, 58,114,101, 97,100, 40,117,110,
-    112, 97, 99,107, 40, 97,114,103, 41, 41, 10,101,110,100, 10,
-     10,102,117,110, 99,116,105,111,110, 32,119,114,105,116,101,
-     32, 40, 46, 46, 46, 41, 10, 32, 32,108,111, 99, 97,108, 32,
-    102, 32, 61, 32, 95, 79, 85, 84, 80, 85, 84, 10, 32, 32,105,
-    102, 32,114, 97,119,116,121,112,101, 40, 97,114,103, 91, 49,
-     93, 41, 32, 61, 61, 32, 39,117,115,101,114,100, 97,116, 97,
-     39, 32,116,104,101,110, 10, 32, 32, 32, 32,102, 32, 61, 32,
-    116, 97, 98, 46,114,101,109,111,118,101, 40, 97,114,103, 44,
-     32, 49, 41, 10, 32, 32,101,110,100, 10, 32, 32,114,101,116,
-    117,114,110, 32,102, 58,119,114,105,116,101, 40,117,110,112,
-     97, 99,107, 40, 97,114,103, 41, 41, 10,101,110,100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/compat.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    45, 45, 32,116,111,108,117, 97, 58, 32, 98, 97,115,105, 99,
-     32,117,116,105,108,105,116,121, 32,102,117,110, 99,116,105,
-    111,110,115, 10, 45, 45, 32, 87,114,105,116,116,101,110, 32,
-     98,121, 32, 87, 97,108,100,101,109, 97,114, 32, 67,101,108,
-    101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,102, 47, 80,
-     85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,108, 32, 49,
-     57, 57, 56, 10, 45, 45, 32, 76, 97,115,116, 32,117,112,100,
-     97,116,101, 58, 32, 65,112,114, 32, 50, 48, 48, 51, 10, 45,
-     45, 32, 36, 73,100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,
-    105,115, 32, 99,111,100,101, 32,105,115, 32,102,114,101,101,
-     32,115,111,102,116,119, 97,114,101, 59, 32,121,111,117, 32,
-     99, 97,110, 32,114,101,100,105,115,116,114,105, 98,117,116,
-    101, 32,105,116, 32, 97,110,100, 47,111,114, 32,109,111,100,
-    105,102,121, 32,105,116, 46, 10, 45, 45, 32, 84,104,101, 32,
-    115,111,102,116,119, 97,114,101, 32,112,114,111,118,105,100,
-    101,100, 32,104,101,114,101,117,110,100,101,114, 32,105,115,
-     32,111,110, 32, 97,110, 32, 34, 97,115, 32,105,115, 34, 32,
-     98, 97,115,105,115, 44, 32, 97,110,100, 10, 45, 45, 32,116,
-    104,101, 32, 97,117,116,104,111,114, 32,104, 97,115, 32,110,
-    111, 32,111, 98,108,105,103, 97,116,105,111,110, 32,116,111,
-     32,112,114,111,118,105,100,101, 32,109, 97,105,110,116,101,
-    110, 97,110, 99,101, 44, 32,115,117,112,112,111,114,116, 44,
-     32,117,112,100, 97,116,101,115, 44, 10, 45, 45, 32,101,110,
-    104, 97,110, 99,101,109,101,110,116,115, 44, 32,111,114, 32,
-    109,111,100,105,102,105, 99, 97,116,105,111,110,115, 46, 10,
-     10, 10, 45, 45, 32, 66, 97,115,105, 99, 32, 67, 32,116,121,
-    112,101,115, 32, 97,110,100, 32,116,104,101,105,114, 32, 99,
-    111,114,114,101,115,112,111,110,100,105,110,103, 32, 76,117,
-     97, 32,116,121,112,101,115, 10, 45, 45, 32, 65,108,108, 32,
-    111, 99, 99,117,114,114,101,110, 99,101,115, 32,111,102, 32,
-     34, 99,104, 97,114, 42, 34, 32,119,105,108,108, 32, 98,101,
-     32,114,101,112,108, 97, 99,101,100, 32, 98,121, 32, 34, 95,
-     99,115,116,114,105,110,103, 34, 44, 10, 45, 45, 32, 97,110,
-    100, 32, 97,108,108, 32,111, 99, 99,117,114,114,101,110, 99,
-    101,115, 32,111,102, 32, 34,118,111,105,100, 42, 34, 32,119,
-    105,108,108, 32, 98,101, 32,114,101,112,108, 97, 99,101,100,
-     32, 98,121, 32, 34, 95,117,115,101,114,100, 97,116, 97, 34,
-     10, 95, 98, 97,115,105, 99, 32, 61, 32,123, 10, 32, 91, 39,
-    118,111,105,100, 39, 93, 32, 61, 32, 39, 39, 44, 10, 32, 91,
-     39, 99,104, 97,114, 39, 93, 32, 61, 32, 39,110,117,109, 98,
-    101,114, 39, 44, 10, 32, 91, 39,105,110,116, 39, 93, 32, 61,
-     32, 39,110,117,109, 98,101,114, 39, 44, 10, 32, 91, 39,115,
-    104,111,114,116, 39, 93, 32, 61, 32, 39,110,117,109, 98,101,
-    114, 39, 44, 10, 32, 91, 39,108,111,110,103, 39, 93, 32, 61,
-     32, 39,110,117,109, 98,101,114, 39, 44, 10, 32, 91, 39,117,
-    110,115,105,103,110,101,100, 39, 93, 32, 61, 32, 39,110,117,
-    109, 98,101,114, 39, 44, 10, 32, 91, 39,102,108,111, 97,116,
-     39, 93, 32, 61, 32, 39,110,117,109, 98,101,114, 39, 44, 10,
-     32, 91, 39,100,111,117, 98,108,101, 39, 93, 32, 61, 32, 39,
-    110,117,109, 98,101,114, 39, 44, 10, 32, 91, 39, 95, 99,115,
-    116,114,105,110,103, 39, 93, 32, 61, 32, 39,115,116,114,105,
-    110,103, 39, 44, 10, 32, 91, 39, 95,117,115,101,114,100, 97,
-    116, 97, 39, 93, 32, 61, 32, 39,117,115,101,114,100, 97,116,
-     97, 39, 44, 10, 32, 91, 39, 99,104, 97,114, 42, 39, 93, 32,
-     61, 32, 39,115,116,114,105,110,103, 39, 44, 10, 32, 91, 39,
-    118,111,105,100, 42, 39, 93, 32, 61, 32, 39,117,115,101,114,
-    100, 97,116, 97, 39, 44, 10, 32, 91, 39, 98,111,111,108, 39,
-     93, 32, 61, 32, 39, 98,111,111,108,101, 97,110, 39, 44, 10,
-     32, 91, 39,108,117, 97, 95, 79, 98,106,101, 99,116, 39, 93,
-     32, 61, 32, 39,118, 97,108,117,101, 39, 44, 10, 32, 91, 39,
-     76, 85, 65, 95, 86, 65, 76, 85, 69, 39, 93, 32, 61, 32, 39,
-    118, 97,108,117,101, 39, 44, 32, 32, 32, 32, 45, 45, 32,102,
-    111,114, 32, 99,111,109,112, 97,116,105, 98,105,108,105,116,
-    121, 32,119,105,116,104, 32,116,111,108,117, 97, 32, 52, 46,
-     48, 10, 32, 91, 39,108,117, 97, 95, 83,116, 97,116,101, 42,
-     39, 93, 32, 61, 32, 39,115,116, 97,116,101, 39, 44, 10, 32,
-     91, 39, 95,108,115,116, 97,116,101, 39, 93, 32, 61, 32, 39,
-    115,116, 97,116,101, 39, 44, 10, 32, 91, 39,108,117, 97, 95,
-     70,117,110, 99,116,105,111,110, 39, 93, 32, 61, 32, 39,118,
-     97,108,117,101, 39, 44, 10,125, 10, 10, 95, 98, 97,115,105,
-     99, 95, 99,116,121,112,101, 32, 61, 32,123, 10, 32,110,117,
-    109, 98,101,114, 32, 61, 32, 34,108,117, 97, 95, 78,117,109,
-     98,101,114, 34, 44, 10, 32,115,116,114,105,110,103, 32, 61,
-     32, 34, 99,111,110,115,116, 32, 99,104, 97,114, 42, 34, 44,
-     10, 32,117,115,101,114,100, 97,116, 97, 32, 61, 32, 34,118,
-    111,105,100, 42, 34, 44, 10, 32, 98,111,111,108,101, 97,110,
-     32, 61, 32, 34, 98,111,111,108, 34, 44, 10, 32,118, 97,108,
-    117,101, 32, 61, 32, 34,105,110,116, 34, 44, 10, 32,115,116,
-     97,116,101, 32, 61, 32, 34,108,117, 97, 95, 83,116, 97,116,
-    101, 42, 34, 44, 10,125, 10, 10, 45, 45, 32,102,117,110, 99,
-    116,105,111,110,115, 32,116,104,101, 32, 97,114,101, 32,117,
-    115,101,100, 32,116,111, 32,100,111, 32, 97, 32, 39,114, 97,
-    119, 32,112,117,115,104, 39, 32,111,102, 32, 98, 97,115,105,
-     99, 32,116,121,112,101,115, 10, 95, 98, 97,115,105, 99, 95,
-    114, 97,119, 95,112,117,115,104, 32, 61, 32,123,125, 10, 10,
-     45, 45, 32, 76,105,115,116, 32,111,102, 32,117,115,101,114,
-     32,100,101,102,105,110,101,100, 32,116,121,112,101,115, 10,
-     45, 45, 32, 69, 97, 99,104, 32,116,121,112,101, 32, 99,111,
-    114,114,101,115,112,111,110,100,115, 32,116,111, 32, 97, 32,
-    118, 97,114,105, 97, 98,108,101, 32,110, 97,109,101, 32,116,
-    104, 97,116, 32,115,116,111,114,101,115, 32,105,116,115, 32,
-    116, 97,103, 32,118, 97,108,117,101, 46, 10, 95,117,115,101,
-    114,116,121,112,101, 32, 61, 32,123,125, 10, 10, 45, 45, 32,
-     76,105,115,116, 32,111,102, 32,116,121,112,101,115, 32,116,
-    104, 97,116, 32,104, 97,118,101, 32,116,111, 32, 98,101, 32,
-     99,111,108,108,101, 99,116,101,100, 10, 95, 99,111,108,108,
-    101, 99,116, 32, 61, 32,123,125, 10, 10, 45, 45, 32, 76,105,
-    115,116, 32,111,102, 32,116,121,112,101,115, 10, 95,103,108,
-    111, 98, 97,108, 95,116,121,112,101,115, 32, 61, 32,123,110,
-     61, 48,125, 10, 95,103,108,111, 98, 97,108, 95,116,121,112,
-    101,115, 95,104, 97,115,104, 32, 61, 32,123,125, 10, 10, 45,
-     45, 32,108,105,115,116, 32,111,102, 32, 99,108, 97,115,115,
-    101,115, 10, 95,103,108,111, 98, 97,108, 95, 99,108, 97,115,
-    115,101,115, 32, 61, 32,123,125, 10, 10, 45, 45, 32, 76,105,
-    115,116, 32,111,102, 32,101,110,117,109, 32, 99,111,110,115,
-    116, 97,110,116,115, 10, 95,103,108,111, 98, 97,108, 95,101,
-    110,117,109,115, 32, 61, 32,123,125, 10, 10, 45, 45, 32, 76,
-    105,115,116, 32,111,102, 32, 97,117,116,111, 32,114,101,110,
-     97,109,105,110,103, 10, 95,114,101,110, 97,109,105,110,103,
-     32, 61, 32,123,125, 10,102,117,110, 99,116,105,111,110, 32,
-     97,112,112,101,110,100,114,101,110, 97,109,105,110,103, 32,
-     40,115, 41, 10, 32,108,111, 99, 97,108, 32, 98, 44,101, 44,
-    111,108,100, 44,110,101,119, 32, 61, 32,115,116,114,102,105,
-    110,100, 40,115, 44, 34, 37,115, 42, 40, 46, 45, 41, 37,115,
-     42, 64, 37,115, 42, 40, 46, 45, 41, 37,115, 42, 36, 34, 41,
-     10,  9,105,102, 32,110,111,116, 32, 98, 32,116,104,101,110,
-     10,  9, 32,101,114,114,111,114, 40, 34, 35, 73,110,118, 97,
-    108,105,100, 32,114,101,110, 97,109,105,110,103, 32,115,121,
-    110,116, 97,120, 59, 32,105,116, 32,115,104,111,117,108,100,
-     32, 98,101, 32,111,102, 32,116,104,101, 32,102,111,114,109,
-     58, 32,112, 97,116,116,101,114,110, 64,112, 97,116,116,101,
-    114,110, 34, 41, 10,  9,101,110,100, 10,  9,116,105,110,115,
-    101,114,116, 40, 95,114,101,110, 97,109,105,110,103, 44,123,
-    111,108,100, 61,111,108,100, 44, 32,110,101,119, 61,110,101,
-    119,125, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,105,
-    111,110, 32, 97,112,112,108,121,114,101,110, 97,109,105,110,
-    103, 32, 40,115, 41, 10,  9,102,111,114, 32,105, 61, 49, 44,
-    103,101,116,110, 40, 95,114,101,110, 97,109,105,110,103, 41,
-     32,100,111, 10,  9, 32,108,111, 99, 97,108, 32,109, 44,110,
-     32, 61, 32,103,115,117, 98, 40,115, 44, 95,114,101,110, 97,
-    109,105,110,103, 91,105, 93, 46,111,108,100, 44, 95,114,101,
-    110, 97,109,105,110,103, 91,105, 93, 46,110,101,119, 41, 10,
-      9,  9,105,102, 32,110, 32,126, 61, 32, 48, 32,116,104,101,
-    110, 10,  9,  9, 32,114,101,116,117,114,110, 32,109, 10,  9,
-      9,101,110,100, 10,  9,101,110,100, 10,  9,114,101,116,117,
-    114,110, 32,110,105,108, 10,101,110,100, 10, 10, 45, 45, 32,
-     69,114,114,111,114, 32,104, 97,110,100,108,101,114, 10,102,
-    117,110, 99,116,105,111,110, 32,116,111,108,117, 97, 95,101,
-    114,114,111,114, 32, 40,115, 44,102, 41, 10,105,102, 32, 95,
-     99,117,114,114, 95, 99,111,100,101, 32,116,104,101,110, 10,
-      9,112,114,105,110,116, 40, 34, 42, 42, 42, 99,117,114,114,
-     32, 99,111,100,101, 32,102,111,114, 32,101,114,114,111,114,
-     32,105,115, 32, 34, 46, 46,116,111,115,116,114,105,110,103,
-     40, 95, 99,117,114,114, 95, 99,111,100,101, 41, 41, 10,  9,
-    112,114,105,110,116, 40,100,101, 98,117,103, 46,116,114, 97,
-     99,101, 98, 97, 99,107, 40, 41, 41, 10,101,110,100, 10, 32,
-    108,111, 99, 97,108, 32,111,117,116, 32, 61, 32, 95, 79, 85,
-     84, 80, 85, 84, 10, 32, 95, 79, 85, 84, 80, 85, 84, 32, 61,
-     32, 95, 83, 84, 68, 69, 82, 82, 10, 32,105,102, 32,115,116,
-    114,115,117, 98, 40,115, 44, 49, 44, 49, 41, 32, 61, 61, 32,
-     39, 35, 39, 32,116,104,101,110, 10, 32, 32,119,114,105,116,
-    101, 40, 34, 92,110, 42, 42, 32,116,111,108,117, 97, 58, 32,
-     34, 46, 46,115,116,114,115,117, 98, 40,115, 44, 50, 41, 46,
-     46, 34, 46, 92,110, 92,110, 34, 41, 10, 32, 32,105,102, 32,
-     95, 99,117,114,114, 95, 99,111,100,101, 32,116,104,101,110,
-     10, 32, 32, 32,108,111, 99, 97,108, 32, 95, 44, 95, 44,115,
-     32, 61, 32,115,116,114,102,105,110,100, 40, 95, 99,117,114,
-    114, 95, 99,111,100,101, 44, 34, 94, 37,115, 42, 40, 46, 45,
-     92,110, 41, 34, 41, 32, 45, 45, 32,101,120,116,114, 97, 99,
-    116, 32,102,105,114,115,116, 32,108,105,110,101, 10, 32, 32,
-     32,105,102, 32,115, 61, 61,110,105,108, 32,116,104,101,110,
-     32,115, 32, 61, 32, 95, 99,117,114,114, 95, 99,111,100,101,
-     32,101,110,100, 10, 32, 32, 32,115, 32, 61, 32,103,115,117,
-     98, 40,115, 44, 34, 95,117,115,101,114,100, 97,116, 97, 34,
-     44, 34,118,111,105,100, 42, 34, 41, 32, 45, 45, 32,114,101,
-    116,117,114,110, 32,119,105,116,104, 32, 39,118,111,105,100,
-     42, 39, 10, 32, 32, 32,115, 32, 61, 32,103,115,117, 98, 40,
-    115, 44, 34, 95, 99,115,116,114,105,110,103, 34, 44, 34, 99,
-    104, 97,114, 42, 34, 41, 32, 32, 45, 45, 32,114,101,116,117,
-    114,110, 32,119,105,116,104, 32, 39, 99,104, 97,114, 42, 39,
-     10, 32, 32, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44,
-     34, 95,108,115,116, 97,116,101, 34, 44, 34,108,117, 97, 95,
-     83,116, 97,116,101, 42, 34, 41, 32, 32, 45, 45, 32,114,101,
-    116,117,114,110, 32,119,105,116,104, 32, 39,108,117, 97, 95,
-     83,116, 97,116,101, 42, 39, 10, 32, 32, 32,119,114,105,116,
-    101, 40, 34, 67,111,100,101, 32, 98,101,105,110,103, 32,112,
-    114,111, 99,101,115,115,101,100, 58, 92,110, 34, 46, 46,115,
-     46, 46, 34, 92,110, 34, 41, 10, 32, 32,101,110,100, 10, 32,
-    101,108,115,101, 10, 32,105,102, 32,110,111,116, 32,102, 32,
-    116,104,101,110, 32,102, 32, 61, 32, 34, 40,102, 32,105,115,
-     32,110,105,108, 41, 34, 32,101,110,100, 10, 32, 32,112,114,
-    105,110,116, 40, 34, 92,110, 42, 42, 32,116,111,108,117, 97,
-     32,105,110,116,101,114,110, 97,108, 32,101,114,114,111,114,
-     58, 32, 34, 46, 46,102, 46, 46,115, 46, 46, 34, 46, 92,110,
-     92,110, 34, 41, 10, 32, 32,114,101,116,117,114,110, 10, 32,
-    101,110,100, 10, 32, 95, 79, 85, 84, 80, 85, 84, 32, 61, 32,
-    111,117,116, 10,101,110,100, 10, 10,102,117,110, 99,116,105,
-    111,110, 32,119, 97,114,110,105,110,103, 32, 40,109,115,103,
-     41, 10, 32,108,111, 99, 97,108, 32,111,117,116, 32, 61, 32,
-     95, 79, 85, 84, 80, 85, 84, 10, 32, 95, 79, 85, 84, 80, 85,
-     84, 32, 61, 32, 95, 83, 84, 68, 69, 82, 82, 10, 32,119,114,
-    105,116,101, 40, 34, 92,110, 42, 42, 32,116,111,108,117, 97,
-     32,119, 97,114,110,105,110,103, 58, 32, 34, 46, 46,109,115,
-    103, 46, 46, 34, 46, 92,110, 92,110, 34, 41, 10, 32, 95, 79,
-     85, 84, 80, 85, 84, 32, 61, 32,111,117,116, 10,101,110,100,
-     10, 10, 45, 45, 32,114,101,103,105,115,116,101,114, 32, 97,
-    110, 32,117,115,101,114, 32,100,101,102,105,110,101,100, 32,
-    116,121,112,101, 58, 32,114,101,116,117,114,110,115, 32,102,
-    117,108,108, 32,116,121,112,101, 10,102,117,110, 99,116,105,
-    111,110, 32,114,101,103,116,121,112,101, 32, 40,116, 41, 10,
-      9, 45, 45,105,102, 32,105,115, 98, 97,115,105, 99, 40,116,
-     41, 32,116,104,101,110, 10,  9, 45, 45,  9,114,101,116,117,
-    114,110, 32,116, 10,  9, 45, 45,101,110,100, 10,  9,108,111,
-     99, 97,108, 32,102,116, 32, 61, 32,102,105,110,100,116,121,
-    112,101, 40,116, 41, 10, 10,  9,105,102, 32,110,111,116, 32,
-     95,117,115,101,114,116,121,112,101, 91,102,116, 93, 32,116,
-    104,101,110, 10,  9,  9,114,101,116,117,114,110, 32, 97,112,
-    112,101,110,100,117,115,101,114,116,121,112,101, 40,116, 41,
-     10,  9,101,110,100, 10,  9,114,101,116,117,114,110, 32,102,
-    116, 10,101,110,100, 10, 10, 45, 45, 32,114,101,116,117,114,
-    110, 32,116,121,112,101, 32,110, 97,109,101, 58, 32,114,101,
-    116,117,114,110,115, 32,102,117,108,108, 32,116,121,112,101,
-     10,102,117,110, 99,116,105,111,110, 32,116,121,112,101,118,
-     97,114, 40,116,121,112,101, 41, 10,  9,105,102, 32,116,121,
-    112,101, 32, 61, 61, 32, 39, 39, 32,111,114, 32,116,121,112,
-    101, 32, 61, 61, 32, 39,118,111,105,100, 39, 32,116,104,101,
-    110, 10,  9,  9,114,101,116,117,114,110, 32,116,121,112,101,
-     10,  9,101,108,115,101, 10,  9,  9,108,111, 99, 97,108, 32,
-    102,116, 32, 61, 32,102,105,110,100,116,121,112,101, 40,116,
-    121,112,101, 41, 10,  9,  9,105,102, 32,102,116, 32,116,104,
-    101,110, 10,  9,  9,  9,114,101,116,117,114,110, 32,102,116,
-     10,  9,  9,101,110,100, 10,  9,  9, 95,117,115,101,114,116,
-    121,112,101, 91,116,121,112,101, 93, 32, 61, 32,116,121,112,
-    101, 10,  9,  9,114,101,116,117,114,110, 32,116,121,112,101,
-     10,  9,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 99,
-    104,101, 99,107, 32,105,102, 32, 98, 97,115,105, 99, 32,116,
-    121,112,101, 10,102,117,110, 99,116,105,111,110, 32,105,115,
-     98, 97,115,105, 99, 32, 40,116,121,112,101, 41, 10, 32,108,
-    111, 99, 97,108, 32,116, 32, 61, 32,103,115,117, 98, 40,116,
-    121,112,101, 44, 39, 99,111,110,115,116, 32, 39, 44, 39, 39,
-     41, 10, 32,108,111, 99, 97,108, 32,109, 44,116, 32, 61, 32,
-     97,112,112,108,121,116,121,112,101,100,101,102, 40, 39, 39,
-     44, 32,116, 41, 10, 32,108,111, 99, 97,108, 32, 98, 32, 61,
-     32, 95, 98, 97,115,105, 99, 91,116, 93, 10, 32,105,102, 32,
-     98, 32,116,104,101,110, 10, 32, 32,114,101,116,117,114,110,
-     32, 98, 44, 95, 98, 97,115,105, 99, 95, 99,116,121,112,101,
-     91, 98, 93, 10, 32,101,110,100, 10, 32,114,101,116,117,114,
-    110, 32,110,105,108, 10,101,110,100, 10, 10, 45, 45, 32,115,
-    112,108,105,116, 32,115,116,114,105,110,103, 32,117,115,105,
-    110,103, 32, 97, 32,116,111,107,101,110, 10,102,117,110, 99,
-    116,105,111,110, 32,115,112,108,105,116, 32, 40,115, 44,116,
-     41, 10, 32,108,111, 99, 97,108, 32,108, 32, 61, 32,123,110,
-     61, 48,125, 10, 32,108,111, 99, 97,108, 32,102, 32, 61, 32,
-    102,117,110, 99,116,105,111,110, 32, 40,115, 41, 10, 32, 32,
-    108, 46,110, 32, 61, 32,108, 46,110, 32, 43, 32, 49, 10, 32,
-     32,108, 91,108, 46,110, 93, 32, 61, 32,115, 10, 32, 32,114,
-    101,116,117,114,110, 32, 34, 34, 10, 32,101,110,100, 10, 32,
-    108,111, 99, 97,108, 32,112, 32, 61, 32, 34, 37,115, 42, 40,
-     46, 45, 41, 37,115, 42, 34, 46, 46,116, 46, 46, 34, 37,115,
-     42, 34, 10, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44,
-     34, 94, 37,115, 43, 34, 44, 34, 34, 41, 10, 32,115, 32, 61,
-     32,103,115,117, 98, 40,115, 44, 34, 37,115, 43, 36, 34, 44,
-     34, 34, 41, 10, 32,115, 32, 61, 32,103,115,117, 98, 40,115,
-     44,112, 44,102, 41, 10, 32,108, 46,110, 32, 61, 32,108, 46,
-    110, 32, 43, 32, 49, 10, 32,108, 91,108, 46,110, 93, 32, 61,
-     32,103,115,117, 98, 40,115, 44, 34, 40, 37,115, 37,115, 42,
-     41, 36, 34, 44, 34, 34, 41, 10, 32,114,101,116,117,114,110,
-     32,108, 10,101,110,100, 10, 10, 45, 45, 32,115,112,108,105,
-    116,115, 32, 97, 32,115,116,114,105,110,103, 32,117,115,105,
-    110,103, 32, 97, 32,112, 97,116,116,101,114,110, 44, 32, 99,
-    111,110,115,105,100,101,114,105,110,103, 32,116,104,101, 32,
-    115,112, 97, 99,105, 97,108, 32, 99, 97,115,101,115, 32,111,
-    102, 32, 67, 32, 99,111,100,101, 32, 40,116,101,109,112,108,
-     97,116,101,115, 44, 32,102,117,110, 99,116,105,111,110, 32,
-    112, 97,114, 97,109,101,116,101,114,115, 44, 32,101,116, 99,
-     41, 10, 45, 45, 32,112, 97,116,116,101,114,110, 32, 99, 97,
-    110, 39,116, 32, 99,111,110,116, 97,105,110, 32,116,104,101,
-     32, 39, 94, 39, 32, 40, 97,115, 32,117,115,101,100, 32,116,
-    111, 32,105,100,101,110,116,105,102,121, 32,116,104,101, 32,
-     98,101,103,105,110,105,110,103, 32,111,102, 32,116,104,101,
-     32,108,105,110,101, 41, 10, 45, 45, 32, 97,108,115,111, 32,
-    115,116,114,105,112,115, 32,119,104,105,116,101,115,112, 97,
-     99,101, 10,102,117,110, 99,116,105,111,110, 32,115,112,108,
-    105,116, 95, 99, 95,116,111,107,101,110,115, 40,115, 44, 32,
-    112, 97,116, 41, 10, 10,  9,115, 32, 61, 32,115,116,114,105,
-    110,103, 46,103,115,117, 98, 40,115, 44, 32, 34, 94, 37,115,
-     42, 34, 44, 32, 34, 34, 41, 10,  9,115, 32, 61, 32,115,116,
-    114,105,110,103, 46,103,115,117, 98, 40,115, 44, 32, 34, 37,
-    115, 42, 36, 34, 44, 32, 34, 34, 41, 10, 10,  9,108,111, 99,
-     97,108, 32,116,111,107,101,110, 95, 98,101,103,105,110, 32,
-     61, 32, 49, 10,  9,108,111, 99, 97,108, 32,116,111,107,101,
-    110, 95,101,110,100, 32, 61, 32, 49, 10,  9,108,111, 99, 97,
-    108, 32,111,102,115, 32, 61, 32, 49, 10,  9,108,111, 99, 97,
-    108, 32,114,101,116, 32, 61, 32,123,110, 61, 48,125, 10, 10,
-      9,102,117,110, 99,116,105,111,110, 32, 97,100,100, 95,116,
-    111,107,101,110, 40,111,102,115, 41, 10, 10,  9,  9,108,111,
-     99, 97,108, 32,116, 32, 61, 32,115,116,114,105,110,103, 46,
-    115,117, 98, 40,115, 44, 32,116,111,107,101,110, 95, 98,101,
-    103,105,110, 44, 32,111,102,115, 41, 10,  9,  9,116, 32, 61,
-     32,115,116,114,105,110,103, 46,103,115,117, 98, 40,116, 44,
-     32, 34, 94, 37,115, 42, 34, 44, 32, 34, 34, 41, 10,  9,  9,
-    116, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98,
-     40,116, 44, 32, 34, 37,115, 42, 36, 34, 44, 32, 34, 34, 41,
-     10,  9,  9,114,101,116, 46,110, 32, 61, 32,114,101,116, 46,
-    110, 32, 43, 32, 49, 10,  9,  9,114,101,116, 91,114,101,116,
-     46,110, 93, 32, 61, 32,116, 10,  9,101,110,100, 10, 10,  9,
-    119,104,105,108,101, 32,111,102,115, 32, 60, 61, 32,115,116,
-    114,105,110,103, 46,108,101,110, 40,115, 41, 32,100,111, 10,
-     10,  9,  9,108,111, 99, 97,108, 32,115,117, 98, 32, 61, 32,
-    115,116,114,105,110,103, 46,115,117, 98, 40,115, 44, 32,111,
-    102,115, 44, 32, 45, 49, 41, 10,  9,  9,108,111, 99, 97,108,
-     32, 98, 44,101, 32, 61, 32,115,116,114,105,110,103, 46,102,
-    105,110,100, 40,115,117, 98, 44, 32, 34, 94, 34, 46, 46,112,
-     97,116, 41, 10,  9,  9,105,102, 32, 98, 32,116,104,101,110,
-     10,  9,  9,  9, 97,100,100, 95,116,111,107,101,110, 40,111,
-    102,115, 45, 49, 41, 10,  9,  9,  9,111,102,115, 32, 61, 32,
-    111,102,115, 43,101, 10,  9,  9,  9,116,111,107,101,110, 95,
-     98,101,103,105,110, 32, 61, 32,111,102,115, 10,  9,  9,101,
-    108,115,101, 10,  9,  9,  9,108,111, 99, 97,108, 32, 99,104,
-     97,114, 32, 61, 32,115,116,114,105,110,103, 46,115,117, 98,
-     40,115, 44, 32,111,102,115, 44, 32,111,102,115, 41, 10,  9,
-      9,  9,105,102, 32, 99,104, 97,114, 32, 61, 61, 32, 34, 40,
-     34, 32,111,114, 32, 99,104, 97,114, 32, 61, 61, 32, 34, 60,
-     34, 32,116,104,101,110, 10, 10,  9,  9,  9,  9,108,111, 99,
-     97,108, 32, 98,108,111, 99,107, 10,  9,  9,  9,  9,105,102,
-     32, 99,104, 97,114, 32, 61, 61, 32, 34, 40, 34, 32,116,104,
-    101,110, 32, 98,108,111, 99,107, 32, 61, 32, 34, 94, 37, 98,
-     40, 41, 34, 32,101,110,100, 10,  9,  9,  9,  9,105,102, 32,
-     99,104, 97,114, 32, 61, 61, 32, 34, 60, 34, 32,116,104,101,
-    110, 32, 98,108,111, 99,107, 32, 61, 32, 34, 94, 37, 98, 60,
-     62, 34, 32,101,110,100, 10, 10,  9,  9,  9,  9, 98, 44,101,
-     32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,
-    115,117, 98, 44, 32, 98,108,111, 99,107, 41, 10,  9,  9,  9,
-      9,105,102, 32,110,111,116, 32, 98, 32,116,104,101,110, 10,
-      9,  9,  9,  9,  9, 45, 45, 32,117,110,116,101,114,109,105,
-    110, 97,116,101,100, 32, 98,108,111, 99,107, 63, 10,  9,  9,
-      9,  9,  9,111,102,115, 32, 61, 32,111,102,115, 43, 49, 10,
-      9,  9,  9,  9,101,108,115,101, 10,  9,  9,  9,  9,  9,111,
-    102,115, 32, 61, 32,111,102,115, 32, 43, 32,101, 10,  9,  9,
-      9,  9,101,110,100, 10, 10,  9,  9,  9,101,108,115,101, 10,
-      9,  9,  9,  9,111,102,115, 32, 61, 32,111,102,115, 43, 49,
-     10,  9,  9,  9,101,110,100, 10,  9,  9,101,110,100, 10, 10,
-      9,101,110,100, 10,  9, 97,100,100, 95,116,111,107,101,110,
-     40,111,102,115, 41, 10,  9, 45, 45,105,102, 32,114,101,116,
-     46,110, 32, 61, 61, 32, 48, 32,116,104,101,110, 10, 10,  9,
-     45, 45,  9,114,101,116, 46,110, 61, 49, 10,  9, 45, 45,  9,
-    114,101,116, 91, 49, 93, 32, 61, 32, 34, 34, 10,  9, 45, 45,
-    101,110,100, 10, 10,  9,114,101,116,117,114,110, 32,114,101,
-    116, 10, 10,101,110,100, 10, 10, 45, 45, 32, 99,111,110, 99,
-     97,116,101,110, 97,116,101, 32,115,116,114,105,110,103,115,
-     32,111,102, 32, 97, 32,116, 97, 98,108,101, 10,102,117,110,
-     99,116,105,111,110, 32, 99,111,110, 99, 97,116, 32, 40,116,
-     44,102, 44,108, 44,106,115,116,114, 41, 10,  9,106,115,116,
-    114, 32, 61, 32,106,115,116,114, 32,111,114, 32, 34, 32, 34,
-     10, 32,108,111, 99, 97,108, 32,115, 32, 61, 32, 39, 39, 10,
-     32,108,111, 99, 97,108, 32,105, 61,102, 10, 32,119,104,105,
-    108,101, 32,105, 60, 61,108, 32,100,111, 10, 32, 32,115, 32,
-     61, 32,115, 46, 46,116, 91,105, 93, 10, 32, 32,105, 32, 61,
-     32,105, 43, 49, 10, 32, 32,105,102, 32,105, 32, 60, 61, 32,
-    108, 32,116,104,101,110, 32,115, 32, 61, 32,115, 46, 46,106,
-    115,116,114, 32,101,110,100, 10, 32,101,110,100, 10, 32,114,
-    101,116,117,114,110, 32,115, 10,101,110,100, 10, 10, 45, 45,
-     32, 99,111,110, 99, 97,116,101,110, 97,116,101, 32, 97,108,
-    108, 32,112, 97,114, 97,109,101,116,101,114,115, 44, 32,102,
-    111,108,108,111,119,105,110,103, 32,111,117,116,112,117,116,
-     32,114,117,108,101,115, 10,102,117,110, 99,116,105,111,110,
-     32, 99,111,110, 99, 97,116,112, 97,114, 97,109, 32, 40,108,
-    105,110,101, 44, 32, 46, 46, 46, 41, 10, 32,108,111, 99, 97,
-    108, 32,105, 61, 49, 10, 32,119,104,105,108,101, 32,105, 60,
-     61, 97,114,103, 46,110, 32,100,111, 10, 32, 32,105,102, 32,
-     95, 99,111,110,116, 32, 97,110,100, 32,110,111,116, 32,115,
-    116,114,102,105,110,100, 40, 95, 99,111,110,116, 44, 39, 91,
-     37, 40, 44, 34, 93, 39, 41, 32, 97,110,100, 10, 32, 32, 32,
-     32, 32,115,116,114,102,105,110,100, 40, 97,114,103, 91,105,
-     93, 44, 34, 94, 91, 37, 97, 95,126, 93, 34, 41, 32,116,104,
-    101,110, 10,  9, 32, 32, 32, 32,108,105,110,101, 32, 61, 32,
-    108,105,110,101, 32, 46, 46, 32, 39, 32, 39, 10, 32, 32,101,
-    110,100, 10, 32, 32,108,105,110,101, 32, 61, 32,108,105,110,
-    101, 32, 46, 46, 32, 97,114,103, 91,105, 93, 10, 32, 32,105,
-    102, 32, 97,114,103, 91,105, 93, 32,126, 61, 32, 39, 39, 32,
-    116,104,101,110, 10, 32, 32, 32, 95, 99,111,110,116, 32, 61,
-     32,115,116,114,115,117, 98, 40, 97,114,103, 91,105, 93, 44,
-     45, 49, 44, 45, 49, 41, 10, 32, 32,101,110,100, 10, 32, 32,
-    105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,105,
-    102, 32,115,116,114,102,105,110,100, 40, 97,114,103, 91, 97,
-    114,103, 46,110, 93, 44, 34, 91, 37, 47, 37, 41, 37, 59, 37,
-    123, 37,125, 93, 36, 34, 41, 32,116,104,101,110, 10, 32, 32,
-     95, 99,111,110,116, 61,110,105,108, 32,108,105,110,101, 32,
-     61, 32,108,105,110,101, 32, 46, 46, 32, 39, 92,110, 39, 10,
-     32,101,110,100, 10,  9,114,101,116,117,114,110, 32,108,105,
-    110,101, 10,101,110,100, 10, 10, 45, 45, 32,111,117,116,112,
-    117,116, 32,108,105,110,101, 10,102,117,110, 99,116,105,111,
-    110, 32,111,117,116,112,117,116, 32, 40, 46, 46, 46, 41, 10,
-     32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,
-    108,101, 32,105, 60, 61, 97,114,103, 46,110, 32,100,111, 10,
-     32, 32,105,102, 32, 95, 99,111,110,116, 32, 97,110,100, 32,
-    110,111,116, 32,115,116,114,102,105,110,100, 40, 95, 99,111,
-    110,116, 44, 39, 91, 37, 40, 44, 34, 93, 39, 41, 32, 97,110,
-    100, 10, 32, 32, 32, 32, 32,115,116,114,102,105,110,100, 40,
-     97,114,103, 91,105, 93, 44, 34, 94, 91, 37, 97, 95,126, 93,
-     34, 41, 32,116,104,101,110, 10,  9, 32, 32, 32, 32,119,114,
-    105,116,101, 40, 39, 32, 39, 41, 10, 32, 32,101,110,100, 10,
-     32, 32,119,114,105,116,101, 40, 97,114,103, 91,105, 93, 41,
-     10, 32, 32,105,102, 32, 97,114,103, 91,105, 93, 32,126, 61,
-     32, 39, 39, 32,116,104,101,110, 10, 32, 32, 32, 95, 99,111,
-    110,116, 32, 61, 32,115,116,114,115,117, 98, 40, 97,114,103,
-     91,105, 93, 44, 45, 49, 44, 45, 49, 41, 10, 32, 32,101,110,
-    100, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,
-    100, 10, 32,105,102, 32,115,116,114,102,105,110,100, 40, 97,
-    114,103, 91, 97,114,103, 46,110, 93, 44, 34, 91, 37, 47, 37,
-     41, 37, 59, 37,123, 37,125, 93, 36, 34, 41, 32,116,104,101,
-    110, 10, 32, 32, 95, 99,111,110,116, 61,110,105,108, 32,119,
-    114,105,116,101, 40, 39, 92,110, 39, 41, 10, 32,101,110,100,
-     10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,
-    103,101,116, 95,112,114,111,112,101,114,116,121, 95,109,101,
-    116,104,111,100,115, 40,112,116,121,112,101, 44, 32,110, 97,
-    109,101, 41, 10, 10,  9,105,102, 32,103,101,116, 95,112,114,
-    111,112,101,114,116,121, 95,109,101,116,104,111,100,115, 95,
-    104,111,111,107, 32, 97,110,100, 32,103,101,116, 95,112,114,
-    111,112,101,114,116,121, 95,109,101,116,104,111,100,115, 95,
-    104,111,111,107, 40,112,116,121,112,101, 44,110, 97,109,101,
-     41, 32,116,104,101,110, 10,  9,  9,114,101,116,117,114,110,
-     32,103,101,116, 95,112,114,111,112,101,114,116,121, 95,109,
-    101,116,104,111,100,115, 95,104,111,111,107, 40,112,116,121,
-    112,101, 44, 32,110, 97,109,101, 41, 10,  9,101,110,100, 10,
-     10,  9,105,102, 32,112,116,121,112,101, 32, 61, 61, 32, 34,
-    100,101,102, 97,117,108,116, 34, 32,116,104,101,110, 32, 45,
-     45, 32,103,101,116, 95,110, 97,109,101, 44, 32,115,101,116,
-     95,110, 97,109,101, 10,  9,  9,114,101,116,117,114,110, 32,
-     34,103,101,116, 95, 34, 46, 46,110, 97,109,101, 44, 32, 34,
-    115,101,116, 95, 34, 46, 46,110, 97,109,101, 10,  9,101,110,
-    100, 10, 10,  9,105,102, 32,112,116,121,112,101, 32, 61, 61,
-     32, 34,113,116, 34, 32,116,104,101,110, 32, 45, 45, 32,110,
-     97,109,101, 44, 32,115,101,116, 78, 97,109,101, 10,  9,  9,
-    114,101,116,117,114,110, 32,110, 97,109,101, 44, 32, 34,115,
-    101,116, 34, 46, 46,115,116,114,105,110,103, 46,117,112,112,
-    101,114, 40,115,116,114,105,110,103, 46,115,117, 98, 40,110,
-     97,109,101, 44, 32, 49, 44, 32, 49, 41, 41, 46, 46,115,116,
-    114,105,110,103, 46,115,117, 98, 40,110, 97,109,101, 44, 32,
-     50, 44, 32, 45, 49, 41, 10,  9,101,110,100, 10, 10,  9,105,
-    102, 32,112,116,121,112,101, 32, 61, 61, 32, 34,111,118,101,
-    114,108,111, 97,100, 34, 32,116,104,101,110, 32, 45, 45, 32,
-    110, 97,109,101, 44, 32,110, 97,109,101, 10,  9,  9,114,101,
-    116,117,114,110, 32,110, 97,109,101, 44,110, 97,109,101, 10,
-      9,101,110,100, 10, 10,  9,114,101,116,117,114,110, 32,110,
-    105,108, 10,101,110,100, 10, 10, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 32,116,104,101, 32,104,111,111,
-    107,115, 10, 10, 45, 45, 32, 99, 97,108,108,101,100, 32,114,
-    105,103,104,116, 32, 97,102,116,101,114, 32,112,114,111, 99,
-    101,115,115,105,110,103, 32,116,104,101, 32, 36, 91,105, 99,
-    104,108, 93,102,105,108,101, 32,100,105,114,101, 99,116,105,
-    118,101,115, 44, 10, 45, 45, 32,114,105,103,104,116, 32, 98,
-    101,102,111,114,101, 32,112,114,111, 99,101,115,115,105,110,
-    103, 32, 97,110,121,116,104,105,110,103, 32,101,108,115,101,
-     10, 45, 45, 32,116, 97,107,101,115, 32,116,104,101, 32,112,
-     97, 99,107, 97,103,101, 32,111, 98,106,101, 99,116, 32, 97,
-    115, 32,116,104,101, 32,112, 97,114, 97,109,101,116,101,114,
-     10,102,117,110, 99,116,105,111,110, 32,112,114,101,112,114,
-    111, 99,101,115,115, 95,104,111,111,107, 40,112, 41, 10,  9,
-     45, 45, 32,112, 46, 99,111,100,101, 32,104, 97,115, 32, 97,
-    108,108, 32,116,104,101, 32,105,110,112,117,116, 32, 99,111,
-    100,101, 32,102,114,111,109, 32,116,104,101, 32,112,107,103,
-     10,101,110,100, 10, 10, 10, 45, 45, 32, 99, 97,108,108,101,
-    100, 32,102,111,114, 32,101,118,101,114,121, 32, 36,105,102,
-    105,108,101, 32,100,105,114,101, 99,116,105,118,101, 10, 45,
-     45, 32,116, 97,107,101,115, 32, 97, 32,116, 97, 98,108,101,
-     32,119,105,116,104, 32, 97, 32,115,116,114,105,110,103, 32,
-     99, 97,108,108,101,100, 32, 39, 99,111,100,101, 39, 32,105,
-    110,115,105,100,101, 44, 32,116,104,101, 32,102,105,108,101,
-    110, 97,109,101, 44, 32, 97,110,100, 32, 97,110,121, 32,101,
-    120,116,114, 97, 32, 97,114,103,117,109,101,110,116,115, 10,
-     45, 45, 32,112, 97,115,115,101,100, 32,116,111, 32, 36,105,
-    102,105,108,101, 46, 32,110,111, 32,114,101,116,117,114,110,
-     32,118, 97,108,117,101, 10,102,117,110, 99,116,105,111,110,
-     32,105,110, 99,108,117,100,101, 95,102,105,108,101, 95,104,
-    111,111,107, 40,116, 44, 32,102,105,108,101,110, 97,109,101,
-     44, 32, 46, 46, 46, 41, 10, 10,101,110,100, 10, 10, 45, 45,
-     32, 99, 97,108,108,101,100, 32, 97,102,116,101,114, 32,112,
-    114,111, 99,101,115,115,105,110,103, 32, 97,110,121,116,104,
-    105,110,103, 32,116,104, 97,116, 39,115, 32,110,111,116, 32,
-     99,111,100,101, 32, 40,108,105,107,101, 32, 39, 36,114,101,
-    110, 97,109,105,110,103, 39, 44, 32, 99,111,109,109,101,110,
-    116,115, 44, 32,101,116, 99, 41, 10, 45, 45, 32, 97,110,100,
-     32,114,105,103,104,116, 32, 98,101,102,111,114,101, 32,112,
-     97,114,115,105,110,103, 32,116,104,101, 32, 97, 99,116,117,
-     97,108, 32, 99,111,100,101, 46, 10, 45, 45, 32,116, 97,107,
-    101,115, 32,116,104,101, 32, 80, 97, 99,107, 97,103,101, 32,
-    111, 98,106,101, 99,116, 32,119,105,116,104, 32, 97,108,108,
-     32,116,104,101, 32, 99,111,100,101, 32,111,110, 32,116,104,
-    101, 32, 39, 99,111,100,101, 39, 32,107,101,121, 46, 32,110,
-    111, 32,114,101,116,117,114,110, 32,118, 97,108,117,101, 10,
-    102,117,110, 99,116,105,111,110, 32,112,114,101,112, 97,114,
-    115,101, 95,104,111,111,107, 40,112, 97, 99,107, 97,103,101,
-     41, 10, 10,101,110,100, 10, 10, 10, 45, 45, 32, 99, 97,108,
-    108,101,100, 32, 97,102,116,101,114, 32,119,114,105,116,105,
-    110,103, 32, 97,108,108, 32,116,104,101, 32,111,117,116,112,
-    117,116, 46, 10, 45, 45, 32,116, 97,107,101,115, 32,116,104,
-    101, 32, 80, 97, 99,107, 97,103,101, 32,111, 98,106,101, 99,
-    116, 10,102,117,110, 99,116,105,111,110, 32,112,111,115,116,
-     95,111,117,116,112,117,116, 95,104,111,111,107, 40,112, 97,
-     99,107, 97,103,101, 41, 10, 10,101,110,100, 10, 10, 10, 45,
-     45, 32, 99, 97,108,108,101,100, 32,102,114,111,109, 32, 39,
-    103,101,116, 95,112,114,111,112,101,114,116,121, 95,109,101,
-    116,104,111,100,115, 39, 32,116,111, 32,103,101,116, 32,116,
-    104,101, 32,109,101,116,104,111,100,115, 32,116,111, 32,114,
-    101,116,114,105,101,118,101, 32, 97, 32,112,114,111,112,101,
-    114,116,121, 10, 45, 45, 32, 97, 99, 99,111,114,100,105,110,
-    103, 32,116,111, 32,105,116,115, 32,116,121,112,101, 10,102,
-    117,110, 99,116,105,111,110, 32,103,101,116, 95,112,114,111,
-    112,101,114,116,121, 95,109,101,116,104,111,100,115, 95,104,
-    111,111,107, 40,112,114,111,112,101,114,116,121, 95,116,121,
-    112,101, 44, 32,110, 97,109,101, 41, 10, 10,101,110,100, 10,
-     10, 45, 45, 32, 99, 97,108,108,101,100, 32,102,114,111,109,
-     32, 67,108, 97,115,115, 67,111,110,116, 97,105,110,101,114,
-     58,100,111,112, 97,114,115,101, 32,119,105,116,104, 32,116,
-    104,101, 32,115,116,114,105,110,103, 32, 98,101,105,110,103,
-     32,112, 97,114,115,101,100, 10, 45, 45, 32,114,101,116,117,
-    114,110, 32,110,105,108, 44, 32,111,114, 32, 97, 32,115,117,
-     98,115,116,114,105,110,103, 10,102,117,110, 99,116,105,111,
-    110, 32,112, 97,114,115,101,114, 95,104,111,111,107, 40,115,
-     41, 10, 10,  9,114,101,116,117,114,110, 32,110,105,108, 10,
-    101,110,100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/basic.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    45, 45, 32,116,111,108,117, 97, 58, 32, 97, 98,115,116,114,
-     97, 99,116, 32,102,101, 97,116,117,114,101, 32, 99,108, 97,
-    115,115, 10, 45, 45, 32, 87,114,105,116,116,101,110, 32, 98,
-    121, 32, 87, 97,108,100,101,109, 97,114, 32, 67,101,108,101,
-    115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,102, 47, 80, 85,
-     67, 45, 82,105,111, 10, 45, 45, 32, 74,117,108, 32, 49, 57,
-     57, 56, 10, 45, 45, 32, 36, 73,100, 58, 32, 36, 10, 10, 45,
-     45, 32, 84,104,105,115, 32, 99,111,100,101, 32,105,115, 32,
-    102,114,101,101, 32,115,111,102,116,119, 97,114,101, 59, 32,
-    121,111,117, 32, 99, 97,110, 32,114,101,100,105,115,116,114,
-    105, 98,117,116,101, 32,105,116, 32, 97,110,100, 47,111,114,
-     32,109,111,100,105,102,121, 32,105,116, 46, 10, 45, 45, 32,
-     84,104,101, 32,115,111,102,116,119, 97,114,101, 32,112,114,
-    111,118,105,100,101,100, 32,104,101,114,101,117,110,100,101,
-    114, 32,105,115, 32,111,110, 32, 97,110, 32, 34, 97,115, 32,
-    105,115, 34, 32, 98, 97,115,105,115, 44, 32, 97,110,100, 10,
-     45, 45, 32,116,104,101, 32, 97,117,116,104,111,114, 32,104,
-     97,115, 32,110,111, 32,111, 98,108,105,103, 97,116,105,111,
-    110, 32,116,111, 32,112,114,111,118,105,100,101, 32,109, 97,
-    105,110,116,101,110, 97,110, 99,101, 44, 32,115,117,112,112,
-    111,114,116, 44, 32,117,112,100, 97,116,101,115, 44, 10, 45,
-     45, 32,101,110,104, 97,110, 99,101,109,101,110,116,115, 44,
-     32,111,114, 32,109,111,100,105,102,105, 99, 97,116,105,111,
-    110,115, 46, 10, 10, 10, 45, 45, 32, 70,101, 97,116,117,114,
-    101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,
-    101,115,101,110,116,115, 32,116,104,101, 32, 98, 97,115,101,
-     32, 99,108, 97,115,115, 32,111,102, 32, 97,108,108, 32,109,
-     97,112,112,101,100, 32,102,101, 97,116,117,114,101, 46, 10,
-     99,108, 97,115,115, 70,101, 97,116,117,114,101, 32, 61, 32,
-    123, 10,125, 10, 99,108, 97,115,115, 70,101, 97,116,117,114,
-    101, 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,
-    115,115, 70,101, 97,116,117,114,101, 10, 10, 45, 45, 32,119,
-    114,105,116,101, 32,115,117,112,112,111,114,116, 32, 99,111,
-    100,101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,
-    115,115, 70,101, 97,116,117,114,101, 58,115,117,112, 99,111,
-    100,101, 32, 40, 41, 10,101,110,100, 10, 10, 45, 45, 32,111,
-    117,116,112,117,116, 32,116, 97,103, 10,102,117,110, 99,116,
-    105,111,110, 32, 99,108, 97,115,115, 70,101, 97,116,117,114,
-    101, 58,100,101, 99,108,116,121,112,101, 32, 40, 41, 10,101,
-    110,100, 10, 10, 45, 45, 32,114,101,103,105,115,116,101,114,
-     32,102,101, 97,116,117,114,101, 10,102,117,110, 99,116,105,
-    111,110, 32, 99,108, 97,115,115, 70,101, 97,116,117,114,101,
-     58,114,101,103,105,115,116,101,114, 32, 40,112,114,101, 41,
-     10,101,110,100, 10, 10, 45, 45, 32,116,114, 97,110,115,108,
-     97,116,101, 32,118,101,114, 98, 97,116,105,109, 10,102,117,
-    110, 99,116,105,111,110, 32, 99,108, 97,115,115, 70,101, 97,
-    116,117,114,101, 58,112,114,101, 97,109, 98,108,101, 32, 40,
-     41, 10,101,110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107,
-     32,105,102, 32,105,116, 32,105,115, 32, 97, 32,118, 97,114,
-    105, 97, 98,108,101, 10,102,117,110, 99,116,105,111,110, 32,
-     99,108, 97,115,115, 70,101, 97,116,117,114,101, 58,105,115,
-    118, 97,114,105, 97, 98,108,101, 32, 40, 41, 10, 32,114,101,
-    116,117,114,110, 32,102, 97,108,115,101, 10,101,110,100, 10,
-     10, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,105,116,
-     32,114,101,113,117,105,114,101,115, 32, 99,111,108,108,101,
-     99,116,105,111,110, 10,102,117,110, 99,116,105,111,110, 32,
-     99,108, 97,115,115, 70,101, 97,116,117,114,101, 58,114,101,
-    113,117,105,114,101, 99,111,108,108,101, 99,116,105,111,110,
-     32, 40,116, 41, 10, 32,114,101,116,117,114,110, 32,102, 97,
-    108,115,101, 10,101,110,100, 10, 10, 45, 45, 32, 98,117,105,
-    108,100, 32,110, 97,109,101,115, 10,102,117,110, 99,116,105,
-    111,110, 32, 99,108, 97,115,115, 70,101, 97,116,117,114,101,
-     58, 98,117,105,108,100,110, 97,109,101,115, 32, 40, 41, 10,
-     32,105,102, 32,115,101,108,102, 46,110, 97,109,101, 32, 97,
-    110,100, 32,115,101,108,102, 46,110, 97,109,101,126, 61, 39,
-     39, 32,116,104,101,110, 10, 32, 32,108,111, 99, 97,108, 32,
-    110, 32, 61, 32,115,112,108,105,116, 40,115,101,108,102, 46,
-    110, 97,109,101, 44, 39, 64, 39, 41, 10, 32, 32,115,101,108,
-    102, 46,110, 97,109,101, 32, 61, 32,110, 91, 49, 93, 10, 32,
-     32,105,102, 32,110,111,116, 32,110, 91, 50, 93, 32,116,104,
-    101,110, 10, 32, 32, 32,110, 91, 50, 93, 32, 61, 32, 97,112,
-    112,108,121,114,101,110, 97,109,105,110,103, 40,110, 91, 49,
-     93, 41, 10, 32, 32,101,110,100, 10, 32, 32,115,101,108,102,
-     46,108,110, 97,109,101, 32, 61, 32,110, 91, 50, 93, 32,111,
-    114, 32,103,115,117, 98, 40,110, 91, 49, 93, 44, 34, 37, 91,
-     46, 45, 37, 93, 34, 44, 34, 34, 41, 10, 32, 32,115,101,108,
-    102, 46,111,114,105,103,105,110, 97,108, 95,110, 97,109,101,
-     32, 61, 32,115,101,108,102, 46,110, 97,109,101, 10, 32, 32,
-    115,101,108,102, 46,108,110, 97,109,101, 32, 61, 32, 99,108,
-    101, 97,110, 95,116,101,109,112,108, 97,116,101, 40,115,101,
-    108,102, 46,108,110, 97,109,101, 41, 10, 32,101,110,100, 10,
-     32,105,102, 32,110,111,116, 32,115,101,108,102, 46,105,115,
-     95,112, 97,114, 97,109,101,116,101,114, 32,116,104,101,110,
-     10,  9, 32,115,101,108,102, 46,110, 97,109,101, 32, 61, 32,
-    103,101,116,111,110,108,121,110, 97,109,101,115,112, 97, 99,
-    101, 40, 41, 32, 46, 46, 32,115,101,108,102, 46,110, 97,109,
-    101, 10, 32,101,110,100, 10, 10, 32,108,111, 99, 97,108, 32,
-    112, 97,114,101,110,116, 32, 61, 32, 99,108, 97,115,115, 67,
-    111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 10, 32,
-    105,102, 32,112, 97,114,101,110,116, 32,116,104,101,110, 10,
-     32,  9,115,101,108,102, 46, 97, 99, 99,101,115,115, 32, 61,
-     32,112, 97,114,101,110,116, 46, 99,117,114,114, 95,109,101,
-    109, 98,101,114, 95, 97, 99, 99,101,115,115, 10, 32,101,108,
-    115,101, 10, 32,101,110,100, 10,101,110,100, 10, 10,102,117,
-    110, 99,116,105,111,110, 32, 99,108, 97,115,115, 70,101, 97,
-    116,117,114,101, 58, 99,104,101, 99,107, 95,112,117, 98,108,
-    105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 10, 10,  9,105,
-    102, 32,115,101,108,102, 46, 97, 99, 99,101,115,115, 32, 97,
-    110,100, 32,115,101,108,102, 46, 97, 99, 99,101,115,115, 32,
-    126, 61, 32, 48, 32,116,104,101,110, 10,  9,  9,114,101,116,
-    117,114,110, 32,102, 97,108,115,101, 10,  9,101,110,100, 10,
-     10,  9,108,111, 99, 97,108, 32,112, 97,114,101,110,116, 32,
-     61, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,
-    114, 46, 99,117,114,114, 10,  9,119,104,105,108,101, 32,112,
-     97,114,101,110,116, 32,100,111, 10,  9,  9,105,102, 32,112,
-     97,114,101,110,116, 46, 97, 99, 99,101,115,115, 32, 97,110,
-    100, 32,112, 97,114,101,110,116, 46, 97, 99, 99,101,115,115,
-     32,126, 61, 32, 48, 32,116,104,101,110, 10,  9,  9,  9,114,
-    101,116,117,114,110, 32,102, 97,108,115,101, 10,  9,  9,101,
-    110,100, 10,  9,  9,112, 97,114,101,110,116, 32, 61, 32,112,
-     97,114,101,110,116, 46,112,114,111,120, 10,  9,101,110,100,
-     10,  9,114,101,116,117,114,110, 32,116,114,117,101, 10,101,
-    110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, 99,108,
-    101, 97,110, 95,116,101,109,112,108, 97,116,101, 40,116, 41,
-     10, 10,  9,114,101,116,117,114,110, 32,115,116,114,105,110,
-    103, 46,103,115,117, 98, 40,116, 44, 32, 34, 91, 60, 62, 58,
-     44, 32, 37, 42, 93, 34, 44, 32, 34, 95, 34, 41, 10,101,110,
-    100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,
-    102,101, 97,116,117,114,101, 32,105,115, 32,105,110,115,105,
-    100,101, 32, 97, 32, 99,111,110,116, 97,105,110,101,114, 32,
-    100,101,102,105,110,105,116,105,111,110, 10, 45, 45, 32,105,
-    116, 32,114,101,116,117,114,110,115, 32,116,104,101, 32, 99,
-    111,110,116, 97,105,110,101,114, 32, 99,108, 97,115,115, 32,
-    110, 97,109,101, 32,111,114, 32,110,105,108, 46, 10,102,117,
-    110, 99,116,105,111,110, 32, 99,108, 97,115,115, 70,101, 97,
-    116,117,114,101, 58,105,110, 99,111,110,116, 97,105,110,101,
-    114, 32, 40,119,104,105, 99,104, 41, 10, 32,105,102, 32,115,
-    101,108,102, 46,112, 97,114,101,110,116, 32,116,104,101,110,
-     10, 32, 32,108,111, 99, 97,108, 32,112, 97,114,101,110,116,
-     32, 61, 32,115,101,108,102, 46,112, 97,114,101,110,116, 10,
-     32, 32,119,104,105,108,101, 32,112, 97,114,101,110,116, 32,
-    100,111, 10, 32, 32, 32,105,102, 32,112, 97,114,101,110,116,
-     46, 99,108, 97,115,115,116,121,112,101, 32, 61, 61, 32,119,
-    104,105, 99,104, 32,116,104,101,110, 10, 32, 32, 32, 32,114,
-    101,116,117,114,110, 32,112, 97,114,101,110,116, 46,110, 97,
-    109,101, 10, 32, 32, 32,101,110,100, 10, 32, 32, 32,112, 97,
-    114,101,110,116, 32, 61, 32,112, 97,114,101,110,116, 46,112,
-     97,114,101,110,116, 10, 32, 32,101,110,100, 10, 32,101,110,
-    100, 10, 32,114,101,116,117,114,110, 32,110,105,108, 10,101,
-    110,100, 10, 10,102,117,110, 99,116,105,111,110, 32, 99,108,
-     97,115,115, 70,101, 97,116,117,114,101, 58,105,110, 99,108,
-     97,115,115, 32, 40, 41, 10, 32,114,101,116,117,114,110, 32,
-    115,101,108,102, 58,105,110, 99,111,110,116, 97,105,110,101,
-    114, 40, 39, 99,108, 97,115,115, 39, 41, 10,101,110,100, 10,
-     10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115,
-     70,101, 97,116,117,114,101, 58,105,110,109,111,100,117,108,
-    101, 32, 40, 41, 10, 32,114,101,116,117,114,110, 32,115,101,
-    108,102, 58,105,110, 99,111,110,116, 97,105,110,101,114, 40,
-     39,109,111,100,117,108,101, 39, 41, 10,101,110,100, 10, 10,
-    102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 70,
-    101, 97,116,117,114,101, 58,105,110,110, 97,109,101,115,112,
-     97, 99,101, 32, 40, 41, 10, 32,114,101,116,117,114,110, 32,
-    115,101,108,102, 58,105,110, 99,111,110,116, 97,105,110,101,
-    114, 40, 39,110, 97,109,101,115,112, 97, 99,101, 39, 41, 10,
-    101,110,100, 10, 10, 45, 45, 32,114,101,116,117,114,110, 32,
-     67, 32, 98,105,110,100,105,110,103, 32,102,117,110, 99,116,
-    105,111,110, 32,110, 97,109,101, 32, 98, 97,115,101,100, 32,
-    111,110, 32,110, 97,109,101, 10, 45, 45, 32,116,104,101, 32,
-     99,108,105,101,110,116, 32,115,112,101, 99,105,102,105,101,
-    115, 32, 97, 32,112,114,101,102,105,120, 10,102,117,110, 99,
-    116,105,111,110, 32, 99,108, 97,115,115, 70,101, 97,116,117,
-    114,101, 58, 99,102,117,110, 99,110, 97,109,101, 32, 40,110,
-     41, 10, 10, 32,105,102, 32,115,101,108,102, 46,112, 97,114,
-    101,110,116, 32,116,104,101,110, 10, 32, 32,110, 32, 61, 32,
-    115,101,108,102, 46,112, 97,114,101,110,116, 58, 99,102,117,
-    110, 99,110, 97,109,101, 40,110, 41, 10, 32,101,110,100, 10,
-     10, 32, 32,110, 32, 61, 32,115,116,114,105,110,103, 46,103,
-    115,117, 98, 40,110, 46, 46, 39, 95, 39, 46, 46, 32, 40,115,
-    101,108,102, 46,108,110, 97,109,101, 32,111,114, 32,115,101,
-    108,102, 46,110, 97,109,101, 41, 44, 32, 34, 91, 60, 62, 58,
-     44, 32, 92, 46, 37, 42, 38, 93, 34, 44, 32, 34, 95, 34, 41,
-     10, 10, 32, 32,114,101,116,117,114,110, 32,110, 10,101,110,
-    100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/feature.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    45, 45, 32,116,111,108,117, 97, 58, 32,118,101,114, 98, 97,
-    116,105,109, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,
-    105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109,
-     97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67,
-     71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45,
-     32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,
-    100, 58, 32,118,101,114, 98, 97,116,105,109, 46,108,117, 97,
-     44,118, 32, 49, 46, 51, 32, 50, 48, 48, 48, 47, 48, 49, 47,
-     50, 52, 32, 50, 48, 58, 52, 49, 58, 49, 54, 32, 99,101,108,
-    101,115, 32, 69,120,112, 32, 36, 10, 10, 45, 45, 32, 84,104,
-    105,115, 32, 99,111,100,101, 32,105,115, 32,102,114,101,101,
-     32,115,111,102,116,119, 97,114,101, 59, 32,121,111,117, 32,
-     99, 97,110, 32,114,101,100,105,115,116,114,105, 98,117,116,
-    101, 32,105,116, 32, 97,110,100, 47,111,114, 32,109,111,100,
-    105,102,121, 32,105,116, 46, 10, 45, 45, 32, 84,104,101, 32,
-    115,111,102,116,119, 97,114,101, 32,112,114,111,118,105,100,
-    101,100, 32,104,101,114,101,117,110,100,101,114, 32,105,115,
-     32,111,110, 32, 97,110, 32, 34, 97,115, 32,105,115, 34, 32,
-     98, 97,115,105,115, 44, 32, 97,110,100, 10, 45, 45, 32,116,
-    104,101, 32, 97,117,116,104,111,114, 32,104, 97,115, 32,110,
-    111, 32,111, 98,108,105,103, 97,116,105,111,110, 32,116,111,
-     32,112,114,111,118,105,100,101, 32,109, 97,105,110,116,101,
-    110, 97,110, 99,101, 44, 32,115,117,112,112,111,114,116, 44,
-     32,117,112,100, 97,116,101,115, 44, 10, 45, 45, 32,101,110,
-    104, 97,110, 99,101,109,101,110,116,115, 44, 32,111,114, 32,
-    109,111,100,105,102,105, 99, 97,116,105,111,110,115, 46, 10,
-     10, 10, 10, 45, 45, 32, 86,101,114, 98, 97,116,105,109, 32,
-     99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,101,115,
-    101,110,116,115, 32, 97, 32,108,105,110,101, 32,116,114, 97,
-    110,115,108, 97,116,101,100, 32,100,105,114,101, 99,116,101,
-    100, 32,116,111, 32,116,104,101, 32, 98,105,110,100,105,110,
-    103, 32,102,105,108,101, 46, 10, 45, 45, 32, 84,104,101, 32,
-    102,111,108,108,111,119,105,110,103, 32,102,105,108,100,115,
-     32, 97,114,101, 32,115,116,111,114,101,100, 58, 10, 45, 45,
-     32, 32, 32,108,105,110,101, 32, 61, 32,108,105,110,101, 32,
-    116,101,120,116, 10, 99,108, 97,115,115, 86,101,114, 98, 97,
-    116,105,109, 32, 61, 32,123, 10, 32,108,105,110,101, 32, 61,
-     32, 39, 39, 44, 10,  9, 99,111,110,100, 32, 61, 32,110,105,
-    108, 44, 32, 32, 32, 32, 45, 45, 32, 99,111,110,100,105,116,
-    105,111,110, 58, 32,119,104,101,114,101, 32,116,111, 32,103,
-    101,110,101,114, 97,116,101, 32,116,104,101, 32, 99,111,100,
-    101, 32, 40,115, 61,115,117,112,111,114,116, 44, 32,114, 61,
-    114,101,103,105,115,116,101,114, 41, 10,125, 10, 99,108, 97,
-    115,115, 86,101,114, 98, 97,116,105,109, 46, 95, 95,105,110,
-    100,101,120, 32, 61, 32, 99,108, 97,115,115, 86,101,114, 98,
-     97,116,105,109, 10,115,101,116,109,101,116, 97,116, 97, 98,
-    108,101, 40, 99,108, 97,115,115, 86,101,114, 98, 97,116,105,
-    109, 44, 99,108, 97,115,115, 70,101, 97,116,117,114,101, 41,
-     10, 10, 45, 45, 32,112,114,101, 97,109, 98,108,101, 32,118,
-    101,114, 98, 97,116,105,109, 10,102,117,110, 99,116,105,111,
-    110, 32, 99,108, 97,115,115, 86,101,114, 98, 97,116,105,109,
-     58,112,114,101, 97,109, 98,108,101, 32, 40, 41, 10, 32,105,
-    102, 32,115,101,108,102, 46, 99,111,110,100, 32, 61, 61, 32,
-     39, 39, 32,116,104,101,110, 10, 32, 32,119,114,105,116,101,
-     40,115,101,108,102, 46,108,105,110,101, 41, 10, 32,101,110,
-    100, 10,101,110,100, 10, 10, 45, 45, 32,115,117,112,112,111,
-    114,116, 32, 99,111,100,101, 10,102,117,110, 99,116,105,111,
-    110, 32, 99,108, 97,115,115, 86,101,114, 98, 97,116,105,109,
-     58,115,117,112, 99,111,100,101, 32, 40, 41, 10, 32,105,102,
-     32,115,116,114,102,105,110,100, 40,115,101,108,102, 46, 99,
-    111,110,100, 44, 39,115, 39, 41, 32,116,104,101,110, 10, 32,
-     32,119,114,105,116,101, 40,115,101,108,102, 46,108,105,110,
-    101, 41, 10, 32, 32,119,114,105,116,101, 40, 39, 92,110, 39,
-     41, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32,
-    114,101,103,105,115,116,101,114, 32, 99,111,100,101, 10,102,
-    117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 86,101,
-    114, 98, 97,116,105,109, 58,114,101,103,105,115,116,101,114,
-     32, 40,112,114,101, 41, 10, 32,105,102, 32,115,116,114,102,
-    105,110,100, 40,115,101,108,102, 46, 99,111,110,100, 44, 39,
-    114, 39, 41, 32,116,104,101,110, 10, 32, 32,119,114,105,116,
-    101, 40,115,101,108,102, 46,108,105,110,101, 41, 10, 32,101,
-    110,100, 10,101,110,100, 10, 10, 10, 45, 45, 32, 80,114,105,
-    110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116,
-    105,111,110, 32, 99,108, 97,115,115, 86,101,114, 98, 97,116,
-    105,109, 58,112,114,105,110,116, 32, 40,105,100,101,110,116,
-     44, 99,108,111,115,101, 41, 10, 32,112,114,105,110,116, 40,
-    105,100,101,110,116, 46, 46, 34, 86,101,114, 98, 97,116,105,
-    109,123, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,
-    110,116, 46, 46, 34, 32,108,105,110,101, 32, 61, 32, 39, 34,
-     46, 46,115,101,108,102, 46,108,105,110,101, 46, 46, 34, 39,
-     44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,
-    116, 46, 46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,
-    101,110,100, 10, 10, 10, 45, 45, 32, 73,110,116,101,114,110,
-     97,108, 32, 99,111,110,115,116,114,117, 99,116,111,114, 10,
-    102,117,110, 99,116,105,111,110, 32, 95, 86,101,114, 98, 97,
-    116,105,109, 32, 40,116, 41, 10, 32,115,101,116,109,101,116,
-     97,116, 97, 98,108,101, 40,116, 44, 99,108, 97,115,115, 86,
-    101,114, 98, 97,116,105,109, 41, 10, 32, 97,112,112,101,110,
-    100, 40,116, 41, 10, 32,114,101,116,117,114,110, 32,116, 10,
-    101,110,100, 10, 10, 45, 45, 32, 67,111,110,115,116,114,117,
-     99,116,111,114, 10, 45, 45, 32, 69,120,112,101, 99,116,115,
-     32, 97, 32,115,116,114,105,110,103, 32,114,101,112,114,101,
-    115,101,110,116,105,110,103, 32,116,104,101, 32,116,101,120,
-    116, 32,108,105,110,101, 10,102,117,110, 99,116,105,111,110,
-     32, 86,101,114, 98, 97,116,105,109, 32, 40,108, 44, 99,111,
-    110,100, 41, 10, 32,105,102, 32,115,116,114,115,117, 98, 40,
-    108, 44, 49, 44, 49, 41, 32, 61, 61, 32, 34, 39, 34, 32,116,
-    104,101,110, 10, 32, 32,108, 32, 61, 32,115,116,114,115,117,
-     98, 40,108, 44, 50, 41, 10, 32,101,108,115,101,105,102, 32,
-    115,116,114,115,117, 98, 40,108, 44, 49, 44, 49, 41, 32, 61,
-     61, 32, 39, 36, 39, 32,116,104,101,110, 10, 32, 32, 99,111,
-    110,100, 32, 61, 32, 39,115,114, 39, 32, 32, 32, 32, 32, 32,
-     32, 45, 45, 32,103,101,110,101,114, 97,116,101,115, 32,105,
-    110, 32, 98,111,116,104, 32,115,117,112,111,114,116, 32, 97,
-    110,100, 32,114,101,103,105,115,116,101,114, 32,102,114, 97,
-    103,109,101,110,116,115, 10, 32, 32,108, 32, 61, 32,115,116,
-    114,115,117, 98, 40,108, 44, 50, 41, 10, 32,101,110,100, 10,
-     32,114,101,116,117,114,110, 32, 95, 86,101,114, 98, 97,116,
-    105,109, 32,123, 10, 32, 32,108,105,110,101, 32, 61, 32,108,
-     44, 10, 32, 32, 99,111,110,100, 32, 61, 32, 99,111,110,100,
-     32,111,114, 32, 39, 39, 44, 10, 32,125, 10,101,110,100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/verbatim.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    45, 45, 32,116,111,108,117, 97, 58, 32, 99,111,100,101, 32,
-     99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,116,101,
-    110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, 32, 67,
-    101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,102,
-     47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,108,
-     32, 49, 57, 57, 57, 10, 45, 45, 32, 36, 73,100, 58, 32, 36,
-     10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,101, 32,
-    105,115, 32,102,114,101,101, 32,115,111,102,116,119, 97,114,
-    101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,100,105,
-    115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,110,100,
-     47,111,114, 32,109,111,100,105,102,121, 32,105,116, 46, 10,
-     45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,114,101,
-     32,112,114,111,118,105,100,101,100, 32,104,101,114,101,117,
-    110,100,101,114, 32,105,115, 32,111,110, 32, 97,110, 32, 34,
-     97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, 32, 97,
-    110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,104,111,
-    114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,103, 97,
-    116,105,111,110, 32,116,111, 32,112,114,111,118,105,100,101,
-     32,109, 97,105,110,116,101,110, 97,110, 99,101, 44, 32,115,
-    117,112,112,111,114,116, 44, 32,117,112,100, 97,116,101,115,
-     44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,101,110,
-    116,115, 44, 32,111,114, 32,109,111,100,105,102,105, 99, 97,
-    116,105,111,110,115, 46, 10, 10, 45, 45, 32,103,108,111, 98,
-     97,108, 10, 99,111,100,101, 95,110, 32, 61, 32, 49, 10, 10,
-     45, 45, 32, 67,111,100,101, 32, 99,108, 97,115,115, 10, 45,
-     45, 32, 82,101,112,114,101,115,101,110,116,115, 32, 76,117,
-     97, 32, 99,111,100,101, 32,116,111, 32, 98,101, 32, 99,111,
-    109,112,105,108,101,100, 32, 97,110,100, 32,105,110, 99,108,
-    117,100,101,100, 10, 45, 45, 32,105,110, 32,116,104,101, 32,
-    105,110,105,116,105, 97,108,105,122, 97,116,105,111,110, 32,
-    102,117,110, 99,116,105,111,110, 46, 10, 45, 45, 32, 84,104,
-    101, 32,102,111,108,108,111,119,105,110,103, 32,102,105,101,
-    108,100,115, 32, 97,114,101, 32,115,116,111,114,101,100, 58,
-     10, 45, 45, 32, 32, 32,116,101,120,116, 32, 61, 32,116,101,
-    120,116, 32, 99,111,100,101, 10, 99,108, 97,115,115, 67,111,
-    100,101, 32, 61, 32,123, 10, 32,116,101,120,116, 32, 61, 32,
-     39, 39, 44, 10,125, 10, 99,108, 97,115,115, 67,111,100,101,
-     46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,115,
-    115, 67,111,100,101, 10,115,101,116,109,101,116, 97,116, 97,
-     98,108,101, 40, 99,108, 97,115,115, 67,111,100,101, 44, 99,
-    108, 97,115,115, 70,101, 97,116,117,114,101, 41, 10, 10, 45,
-     45, 32,114,101,103,105,115,116,101,114, 32, 99,111,100,101,
-     10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115,
-     67,111,100,101, 58,114,101,103,105,115,116,101,114, 32, 40,
-    112,114,101, 41, 10, 32,112,114,101, 32, 61, 32,112,114,101,
-     32,111,114, 32, 39, 39, 10, 32, 45, 45, 32, 99,108,101, 97,
-    110, 32, 76,117, 97, 32, 99,111,100,101, 10, 32,108,111, 99,
-     97,108, 32,115, 32, 61, 32, 99,108,101, 97,110, 40,115,101,
-    108,102, 46,116,101,120,116, 41, 10, 32,105,102, 32,110,111,
-    116, 32,115, 32,116,104,101,110, 10, 32, 32, 45, 45,112,114,
-    105,110,116, 40,115,101,108,102, 46,116,101,120,116, 41, 10,
-     32, 32,101,114,114,111,114, 40, 34,112, 97,114,115,101,114,
-     32,101,114,114,111,114, 32,105,110, 32,101,109, 98,101,100,
-    100,101,100, 32, 99,111,100,101, 34, 41, 10, 32,101,110,100,
-     10, 10, 32, 45, 45, 32,103,101,116, 32,102,105,114,115,116,
-     32,108,105,110,101, 10, 32,108,111, 99, 97,108, 32, 95, 44,
-     32, 95, 44, 32,102,105,114,115,116, 95,108,105,110,101, 61,
-    115,116,114,105,110,103, 46,102,105,110,100, 40,115,101,108,
-    102, 46,116,101,120,116, 44, 32, 34, 94, 40, 91, 94, 92,110,
-     92,114, 93, 42, 41, 34, 41, 10, 32,105,102, 32,115,116,114,
-    105,110,103, 46,102,105,110,100, 40,102,105,114,115,116, 95,
-    108,105,110,101, 44, 32, 34, 94, 37,115, 42, 37, 45, 37, 45,
-     34, 41, 32,116,104,101,110, 10,  9, 32,105,102, 32,115,116,
-    114,105,110,103, 46,102,105,110,100, 40,102,105,114,115,116,
-     95,108,105,110,101, 44, 32, 34, 94, 37, 45, 37, 45, 35, 35,
-     34, 41, 32,116,104,101,110, 10,  9,  9,102,105,114,115,116,
-     95,108,105,110,101, 32, 61, 32,115,116,114,105,110,103, 46,
-    103,115,117, 98, 40,102,105,114,115,116, 95,108,105,110,101,
-     44, 32, 34, 94, 37, 45, 37, 45, 35, 35, 34, 44, 32, 34, 34,
-     41, 10,  9,  9,105,102, 32,102,108, 97,103,115, 91, 39, 67,
-     39, 93, 32,116,104,101,110, 10,  9,  9,  9,115, 32, 61, 32,
-    115,116,114,105,110,103, 46,103,115,117, 98, 40,115, 44, 32,
-     34, 94, 37, 45, 37, 45, 35, 35, 91, 94, 92,110, 92,114, 93,
-     42, 92,110, 34, 44, 32, 34, 34, 41, 10,  9,  9,101,110,100,
-     10,  9, 32,101,110,100, 10, 32,101,108,115,101, 10, 32,  9,
-    102,105,114,115,116, 95,108,105,110,101, 32, 61, 32, 34, 34,
-     10, 32,101,110,100, 10, 10, 32, 45, 45, 32, 99,111,110,118,
-    101,114,116, 32,116,111, 32, 67, 10, 32,111,117,116,112,117,
-    116, 40, 39, 92,110, 39, 46, 46,112,114,101, 46, 46, 39,123,
-     32, 47, 42, 32, 98,101,103,105,110, 32,101,109, 98,101,100,
-    100,101,100, 32,108,117, 97, 32, 99,111,100,101, 32, 42, 47,
-     92,110, 39, 41, 10, 32,111,117,116,112,117,116, 40,112,114,
-    101, 46, 46, 39, 32,105,110,116, 32,116,111,112, 32, 61, 32,
-    108,117, 97, 95,103,101,116,116,111,112, 40,116,111,108,117,
-     97, 95, 83, 41, 59, 39, 41, 10, 32,111,117,116,112,117,116,
-     40,112,114,101, 46, 46, 39, 32,115,116, 97,116,105, 99, 32,
-    117,110,115,105,103,110,101,100, 32, 99,104, 97,114, 32, 66,
-     91, 93, 32, 61, 32,123, 92,110, 32, 32, 32, 39, 41, 10, 32,
-    108,111, 99, 97,108, 32,116, 61,123,110, 61, 48,125, 10, 32,
-    108,111, 99, 97,108, 32, 98, 32, 61, 32,103,115,117, 98, 40,
-    115, 44, 39, 40, 46, 41, 39, 44,102,117,110, 99,116,105,111,
-    110, 32, 40, 99, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32,108,111, 99, 97,108, 32,101, 32, 61, 32, 39, 39, 10, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32,116, 46,110, 61,116, 46,
-    110, 43, 49, 32,105,102, 32,116, 46,110, 61, 61, 49, 53, 32,
-    116,104,101,110, 32,116, 46,110, 61, 48, 32,101, 61, 39, 92,
-    110, 39, 46, 46,112,114,101, 46, 46, 39, 32, 32, 39, 32,101,
-    110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101,
-    116,117,114,110, 32,102,111,114,109, 97,116, 40, 39, 37, 51,
-    117, 44, 37,115, 39, 44,115,116,114, 98,121,116,101, 40, 99,
-     41, 44,101, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,
-    110,100, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 41, 10, 32,111,117,116,112,117,116, 40, 98, 46,
-     46,115,116,114, 98,121,116,101, 40, 34, 32, 34, 41, 41, 10,
-     32,111,117,116,112,117,116, 40, 39, 92,110, 39, 46, 46,112,
-    114,101, 46, 46, 39, 32,125, 59, 92,110, 39, 41, 10, 32,105,
-    102, 32,102,105,114,115,116, 95,108,105,110,101, 32, 97,110,
-    100, 32,102,105,114,115,116, 95,108,105,110,101, 32,126, 61,
-     32, 34, 34, 32,116,104,101,110, 10, 32,  9,111,117,116,112,
-    117,116, 40,112,114,101, 46, 46, 39, 32,116,111,108,117, 97,
-     95,100,111, 98,117,102,102,101,114, 40,116,111,108,117, 97,
-     95, 83, 44, 40, 99,104, 97,114, 42, 41, 66, 44,115,105,122,
-    101,111,102, 40, 66, 41, 44, 34,116,111,108,117, 97, 32,101,
-    109, 98,101,100,100,101,100, 58, 32, 39, 46, 46,102,105,114,
-    115,116, 95,108,105,110,101, 46, 46, 39, 34, 41, 59, 39, 41,
-     10, 32,101,108,115,101, 10, 32,  9,111,117,116,112,117,116,
-     40,112,114,101, 46, 46, 39, 32,116,111,108,117, 97, 95,100,
-    111, 98,117,102,102,101,114, 40,116,111,108,117, 97, 95, 83,
-     44, 40, 99,104, 97,114, 42, 41, 66, 44,115,105,122,101,111,
-    102, 40, 66, 41, 44, 34,116,111,108,117, 97, 58, 32,101,109,
-     98,101,100,100,101,100, 32, 76,117, 97, 32, 99,111,100,101,
-     32, 39, 46, 46, 99,111,100,101, 95,110, 46, 46, 39, 34, 41,
-     59, 39, 41, 10, 32,101,110,100, 10, 32,111,117,116,112,117,
-    116, 40,112,114,101, 46, 46, 39, 32,108,117, 97, 95,115,101,
-    116,116,111,112, 40,116,111,108,117, 97, 95, 83, 44, 32,116,
-    111,112, 41, 59, 39, 41, 10, 32,111,117,116,112,117,116, 40,
-    112,114,101, 46, 46, 39,125, 32, 47, 42, 32,101,110,100, 32,
-    111,102, 32,101,109, 98,101,100,100,101,100, 32,108,117, 97,
-     32, 99,111,100,101, 32, 42, 47, 92,110, 92,110, 39, 41, 10,
-     32, 99,111,100,101, 95,110, 32, 61, 32, 99,111,100,101, 95,
-    110, 32, 43, 49, 10,101,110,100, 10, 10, 10, 45, 45, 32, 80,
-    114,105,110,116, 32,109,101,116,104,111,100, 10,102,117,110,
-     99,116,105,111,110, 32, 99,108, 97,115,115, 67,111,100,101,
-     58,112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,
-    108,111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,
-    101,110,116, 46, 46, 34, 67,111,100,101,123, 34, 41, 10, 32,
-    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,
-    116,101,120,116, 32, 61, 32, 91, 91, 34, 46, 46,115,101,108,
-    102, 46,116,101,120,116, 46, 46, 34, 93, 93, 44, 34, 41, 10,
-     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,
-    125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100, 10,
-     10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99,
-    111,110,115,116,114,117, 99,116,111,114, 10,102,117,110, 99,
-    116,105,111,110, 32, 95, 67,111,100,101, 32, 40,116, 41, 10,
-     32,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116,
-     44, 99,108, 97,115,115, 67,111,100,101, 41, 10, 32, 97,112,
-    112,101,110,100, 40,116, 41, 10, 32,114,101,116,117,114,110,
-     32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67,111,110,115,
-    116,114,117, 99,116,111,114, 10, 45, 45, 32, 69,120,112,101,
-     99,116,115, 32, 97, 32,115,116,114,105,110,103, 32,114,101,
-    112,114,101,115,101,110,116,105,110,103, 32,116,104,101, 32,
-     99,111,100,101, 32,116,101,120,116, 10,102,117,110, 99,116,
-    105,111,110, 32, 67,111,100,101, 32, 40,108, 41, 10, 32,114,
-    101,116,117,114,110, 32, 95, 67,111,100,101, 32,123, 10, 32,
-     32,116,101,120,116, 32, 61, 32,108, 10, 32,125, 10,101,110,
-    100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/code.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    45, 45, 32,116,111,108,117, 97, 58, 32,116,121,112,101,100,
-    101,102, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,
-    116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,
-    114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,
-    114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32,
-     74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100,
-     58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,
-    100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,116,
-    119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,
-    101,100,105,115,116,114,105, 98,117,116,101, 32,105,116, 32,
-     97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,105,
-    116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119,
-     97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,101,
-    114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,
-    110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115,
-     44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,
-    116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,
-    105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,118,
-    105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,101,
-     44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100, 97,
-    116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,
-    109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,102,
-    105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 10, 45, 45,
-     32, 84,121,112,101,100,101,102, 32, 99,108, 97,115,115, 10,
-     45, 45, 32, 82,101,112,114,101,115,101,110,116,115, 32, 97,
-     32,116,121,112,101, 32,115,121,110,111,110,121,109, 46, 10,
-     45, 45, 32, 84,104,101, 32, 39,100,101, 32,102, 97, 99,116,
-    111, 39, 32,116,121,112,101, 32,114,101,112,108, 97, 99,101,
-    115, 32,116,104,101, 32,116,121,112,101,100,101,102, 32, 98,
-    101,102,111,114,101, 32,116,104,101, 10, 45, 45, 32,114,101,
-    109, 97,105,110,105,110,103, 32, 99,111,100,101, 32,105,115,
-     32,112, 97,114,115,101,100, 46, 10, 45, 45, 32, 84,104,101,
-     32,102,111,108,108,111,119,105,110,103, 32,102,105,101,108,
-    100,115, 32, 97,114,101, 32,115,116,111,114,101,100, 58, 10,
-     45, 45, 32, 32, 32,117,116,121,112,101, 32, 61, 32,116,121,
-    112,101,100,101,102, 32,110, 97,109,101, 10, 45, 45, 32, 32,
-     32,116,121,112,101, 32, 61, 32, 39,116,104,101, 32,102, 97,
-     99,116,111, 39, 32,116,121,112,101, 10, 45, 45, 32, 32, 32,
-    109,111,100, 32, 61, 32,109,111,100,105,102,105,101,114,115,
-     32,116,111, 32,116,104,101, 32, 39,100,101, 32,102, 97, 99,
-    116,111, 39, 32,116,121,112,101, 10, 99,108, 97,115,115, 84,
-    121,112,101,100,101,102, 32, 61, 32,123, 10, 32,117,116,121,
-    112,101, 32, 61, 32, 39, 39, 44, 10, 32,109,111,100, 32, 61,
-     32, 39, 39, 44, 10, 32,116,121,112,101, 32, 61, 32, 39, 39,
-     10,125, 10, 99,108, 97,115,115, 84,121,112,101,100,101,102,
-     46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,115,
-    115, 84,121,112,101,100,101,102, 10, 10, 45, 45, 32, 80,114,
-    105,110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,
-    116,105,111,110, 32, 99,108, 97,115,115, 84,121,112,101,100,
-    101,102, 58,112,114,105,110,116, 32, 40,105,100,101,110,116,
-     44, 99,108,111,115,101, 41, 10, 32,112,114,105,110,116, 40,
-    105,100,101,110,116, 46, 46, 34, 84,121,112,101,100,101,102,
-    123, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,
-    116, 46, 46, 34, 32,117,116,121,112,101, 32, 61, 32, 39, 34,
-     46, 46,115,101,108,102, 46,117,116,121,112,101, 46, 46, 34,
-     39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,
-    110,116, 46, 46, 34, 32,109,111,100, 32, 61, 32, 39, 34, 46,
-     46,115,101,108,102, 46,109,111,100, 46, 46, 34, 39, 44, 34,
-     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,
-     46, 34, 32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,
-    101,108,102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34, 41,
-     10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46,
-     34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100,
-     10, 10, 45, 45, 32, 82,101,116,117,114,110, 32,105,116, 39,
-    115, 32,110,111,116, 32, 97, 32,118, 97,114,105, 97, 98,108,
-    101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,
-    115, 84,121,112,101,100,101,102, 58,105,115,118, 97,114,105,
-     97, 98,108,101, 32, 40, 41, 10, 32,114,101,116,117,114,110,
-     32,102, 97,108,115,101, 10,101,110,100, 10, 10, 45, 45, 32,
-     73,110,116,101,114,110, 97,108, 32, 99,111,110,115,116,114,
-    117, 99,116,111,114, 10,102,117,110, 99,116,105,111,110, 32,
-     95, 84,121,112,101,100,101,102, 32, 40,116, 41, 10, 32,115,
-    101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44, 99,
-    108, 97,115,115, 84,121,112,101,100,101,102, 41, 10, 32,116,
-     46,116,121,112,101, 32, 61, 32,114,101,115,111,108,118,101,
-     95,116,101,109,112,108, 97,116,101, 95,116,121,112,101,115,
-     40,116, 46,116,121,112,101, 41, 10, 32, 97,112,112,101,110,
-    100,116,121,112,101,100,101,102, 40,116, 41, 10, 32,114,101,
-    116,117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32,
-     67,111,110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32,
-     69,120,112,101, 99,116,115, 32,111,110,101, 32,115,116,114,
-    105,110,103, 32,114,101,112,114,101,115,101,110,116,105,110,
-    103, 32,116,104,101, 32,116,121,112,101, 32,100,101,102,105,
-    110,105,116,105,111,110, 46, 10,102,117,110, 99,116,105,111,
-    110, 32, 84,121,112,101,100,101,102, 32, 40,115, 41, 10, 32,
-    105,102, 32,115,116,114,102,105,110,100, 40,115,116,114,105,
-    110,103, 46,103,115,117, 98, 40,115, 44, 32, 39, 37, 98, 60,
-     62, 39, 44, 32, 39, 39, 41, 44, 39, 91, 37, 42, 38, 93, 39,
-     41, 32,116,104,101,110, 10, 32, 32,116,111,108,117, 97, 95,
-    101,114,114,111,114, 40, 34, 35,105,110,118, 97,108,105,100,
-     32,116,121,112,101,100,101,102, 58, 32,112,111,105,110,116,
-    101,114,115, 32, 40, 97,110,100, 32,114,101,102,101,114,101,
-    110, 99,101,115, 41, 32, 97,114,101, 32,110,111,116, 32,115,
-    117,112,112,111,114,116,101,100, 34, 41, 10, 32,101,110,100,
-     10, 32,108,111, 99, 97,108, 32,111, 32, 61, 32,123,109,111,
-    100, 32, 61, 32, 39, 39,125, 10, 32,105,102, 32,115,116,114,
-    105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 91, 60,
-     62, 93, 34, 41, 32,116,104,101,110, 10, 32,  9, 95, 44, 95,
-     44,111, 46,116,121,112,101, 44,111, 46,117,116,121,112,101,
-     32, 61, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,
-    115, 44, 32, 34, 94, 37,115, 42, 40, 91, 94, 60, 62, 93, 43,
-     37, 98, 60, 62, 91, 94, 37,115, 93, 42, 41, 37,115, 43, 40,
-     46, 45, 41, 36, 34, 41, 10, 32,101,108,115,101, 10, 32,  9,
-    108,111, 99, 97,108, 32,116, 32, 61, 32,115,112,108,105,116,
-     40,103,115,117, 98, 40,115, 44, 34, 37,115, 37,115, 42, 34,
-     44, 34, 32, 34, 41, 44, 34, 32, 34, 41, 10, 32,  9,111, 32,
-     61, 32,123, 10,  9, 32, 32,117,116,121,112,101, 32, 61, 32,
-    116, 91,116, 46,110, 93, 44, 10,  9, 32, 32,116,121,112,101,
-     32, 61, 32,116, 91,116, 46,110, 45, 49, 93, 44, 10,  9, 32,
-     32,109,111,100, 32, 61, 32, 99,111,110, 99, 97,116, 40,116,
-     44, 49, 44,116, 46,110, 45, 50, 41, 44, 10,  9, 32,125, 10,
-     32,101,110,100, 10, 32,114,101,116,117,114,110, 32, 95, 84,
-    121,112,101,100,101,102, 40,111, 41, 10,101,110,100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/typedef.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    45, 45, 32,116,111,108,117, 97, 58, 32, 99,111,110,116, 97,
-    105,110,101,114, 32, 97, 98,115,116,114, 97, 99,116, 32, 99,
-    108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,116,101,110,
-     32, 98,121, 32, 87, 97,108,100,101,109, 97,114, 32, 67,101,
-    108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,102, 47,
-     80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,108, 32,
-     49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, 58, 32, 36, 10,
-     10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,101, 32,105,
-    115, 32,102,114,101,101, 32,115,111,102,116,119, 97,114,101,
-     59, 32,121,111,117, 32, 99, 97,110, 32,114,101,100,105,115,
-    116,114,105, 98,117,116,101, 32,105,116, 32, 97,110,100, 47,
-    111,114, 32,109,111,100,105,102,121, 32,105,116, 46, 10, 45,
-     45, 32, 84,104,101, 32,115,111,102,116,119, 97,114,101, 32,
-    112,114,111,118,105,100,101,100, 32,104,101,114,101,117,110,
-    100,101,114, 32,105,115, 32,111,110, 32, 97,110, 32, 34, 97,
-    115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, 32, 97,110,
-    100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,104,111,114,
-     32,104, 97,115, 32,110,111, 32,111, 98,108,105,103, 97,116,
-    105,111,110, 32,116,111, 32,112,114,111,118,105,100,101, 32,
-    109, 97,105,110,116,101,110, 97,110, 99,101, 44, 32,115,117,
-    112,112,111,114,116, 44, 32,117,112,100, 97,116,101,115, 44,
-     10, 45, 45, 32,101,110,104, 97,110, 99,101,109,101,110,116,
-    115, 44, 32,111,114, 32,109,111,100,105,102,105, 99, 97,116,
-    105,111,110,115, 46, 10, 10, 45, 45, 32,116, 97, 98,108,101,
-     32,116,111, 32,115,116,111,114,101, 32,110, 97,109,101,115,
-    112, 97, 99,101,100, 32,116,121,112,101,100,101,102,115, 47,
-    101,110,117,109,115, 32,105,110, 32,103,108,111, 98, 97,108,
-     32,115, 99,111,112,101, 10,103,108,111, 98, 97,108, 95,116,
-    121,112,101,100,101,102,115, 32, 61, 32,123,125, 10,103,108,
-    111, 98, 97,108, 95,101,110,117,109,115, 32, 61, 32,123,125,
-     10, 10, 45, 45, 32, 67,111,110,116, 97,105,110,101,114, 32,
-     99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,101,115,
-    101,110,116,115, 32, 97, 32, 99,111,110,116, 97,105,110,101,
-    114, 32,111,102, 32,102,101, 97,116,117,114,101,115, 32,116,
-    111, 32, 98,101, 32, 98,111,117,110,100, 10, 45, 45, 32,116,
-    111, 32,108,117, 97, 46, 10, 99,108, 97,115,115, 67,111,110,
-    116, 97,105,110,101,114, 32, 61, 10,123, 10, 32, 99,117,114,
-    114, 32, 61, 32,110,105,108, 44, 10,125, 10, 99,108, 97,115,
-    115, 67,111,110,116, 97,105,110,101,114, 46, 95, 95,105,110,
-    100,101,120, 32, 61, 32, 99,108, 97,115,115, 67,111,110,116,
-     97,105,110,101,114, 10,115,101,116,109,101,116, 97,116, 97,
-     98,108,101, 40, 99,108, 97,115,115, 67,111,110,116, 97,105,
-    110,101,114, 44, 99,108, 97,115,115, 70,101, 97,116,117,114,
-    101, 41, 10, 10, 45, 45, 32,111,117,116,112,117,116, 32,116,
-     97,103,115, 10,102,117,110, 99,116,105,111,110, 32, 99,108,
-     97,115,115, 67,111,110,116, 97,105,110,101,114, 58,100,101,
-     99,108,116,121,112,101, 32, 40, 41, 10, 32,112,117,115,104,
-     40,115,101,108,102, 41, 10, 32,108,111, 99, 97,108, 32,105,
-     61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,102, 91,
-    105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 91,105, 93,
-     58,100,101, 99,108,116,121,112,101, 40, 41, 10, 32, 32,105,
-     32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,112,111,
-    112, 40, 41, 10,101,110,100, 10, 10, 10, 45, 45, 32,119,114,
-    105,116,101, 32,115,117,112,112,111,114,116, 32, 99,111,100,
-    101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,
-    115, 67,111,110,116, 97,105,110,101,114, 58,115,117,112, 99,
-    111,100,101, 32, 40, 41, 10, 10,  9,105,102, 32,110,111,116,
-     32,115,101,108,102, 58, 99,104,101, 99,107, 95,112,117, 98,
-    108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 32,116,104,
-    101,110, 10,  9,  9,114,101,116,117,114,110, 10,  9,101,110,
-    100, 10, 10, 32,112,117,115,104, 40,115,101,108,102, 41, 10,
-     32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,
-    108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, 32,
-     32,105,102, 32,115,101,108,102, 91,105, 93, 58, 99,104,101,
-     99,107, 95,112,117, 98,108,105, 99, 95, 97, 99, 99,101,115,
-    115, 40, 41, 32,116,104,101,110, 10, 32, 32,  9,115,101,108,
-    102, 91,105, 93, 58,115,117,112, 99,111,100,101, 40, 41, 10,
-     32, 32,101,110,100, 10, 32, 32,105, 32, 61, 32,105, 43, 49,
-     10, 32,101,110,100, 10, 32,112,111,112, 40, 41, 10,101,110,
-    100, 10, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,
-    115,115, 67,111,110,116, 97,105,110,101,114, 58,104, 97,115,
-    118, 97,114, 32, 40, 41, 10, 32,108,111, 99, 97,108, 32,105,
-     61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,102, 91,
-    105, 93, 32,100,111, 10, 32, 32,105,102, 32,115,101,108,102,
-     91,105, 93, 58,105,115,118, 97,114,105, 97, 98,108,101, 40,
-     41, 32,116,104,101,110, 10,  9,  9, 32,114,101,116,117,114,
-    110, 32, 49, 10,  9,  9,101,110,100, 10, 32, 32,105, 32, 61,
-     32,105, 43, 49, 10, 32,101,110,100, 10,  9,114,101,116,117,
-    114,110, 32, 48, 10,101,110,100, 10, 10, 45, 45, 32, 73,110,
-    116,101,114,110, 97,108, 32, 99,111,110,116, 97,105,110,101,
-    114, 32, 99,111,110,115,116,114,117, 99,116,111,114, 10,102,
-    117,110, 99,116,105,111,110, 32, 95, 67,111,110,116, 97,105,
-    110,101,114, 32, 40,115,101,108,102, 41, 10, 32,115,101,116,
-    109,101,116, 97,116, 97, 98,108,101, 40,115,101,108,102, 44,
-     99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 41,
-     10, 32,115,101,108,102, 46,110, 32, 61, 32, 48, 10, 32,115,
-    101,108,102, 46,116,121,112,101,100,101,102,115, 32, 61, 32,
-    123,116,111,108,117, 97, 95,110, 61, 48,125, 10, 32,115,101,
-    108,102, 46,117,115,101,114,116,121,112,101,115, 32, 61, 32,
-    123,125, 10, 32,115,101,108,102, 46,101,110,117,109,115, 32,
-     61, 32,123,116,111,108,117, 97, 95,110, 61, 48,125, 10, 32,
-    115,101,108,102, 46,108,110, 97,109,101,115, 32, 61, 32,123,
-    125, 10, 32,114,101,116,117,114,110, 32,115,101,108,102, 10,
-    101,110,100, 10, 10, 45, 45, 32,112,117,115,104, 32, 99,111,
-    110,116, 97,105,110,101,114, 10,102,117,110, 99,116,105,111,
-    110, 32,112,117,115,104, 32, 40,116, 41, 10,  9,116, 46,112,
-    114,111,120, 32, 61, 32, 99,108, 97,115,115, 67,111,110,116,
-     97,105,110,101,114, 46, 99,117,114,114, 10, 32, 99,108, 97,
-    115,115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,
-    114, 32, 61, 32,116, 10,101,110,100, 10, 10, 45, 45, 32,112,
-    111,112, 32, 99,111,110,116, 97,105,110,101,114, 10,102,117,
-    110, 99,116,105,111,110, 32,112,111,112, 32, 40, 41, 10, 45,
-     45,112,114,105,110,116, 40, 34,110, 97,109,101, 34, 44, 99,
-    108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 46, 99,
-    117,114,114, 46,110, 97,109,101, 41, 10, 45, 45,102,111,114,
-    101, 97, 99,104, 40, 99,108, 97,115,115, 67,111,110,116, 97,
-    105,110,101,114, 46, 99,117,114,114, 46,117,115,101,114,116,
-    121,112,101,115, 44,112,114,105,110,116, 41, 10, 45, 45,112,
-    114,105,110,116, 40, 34, 95, 95, 95, 95, 95, 95, 95, 95, 95,
-     95, 95, 95, 95, 95, 34, 41, 10, 32, 99,108, 97,115,115, 67,
-    111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 32, 61,
-     32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114,
-     46, 99,117,114,114, 46,112,114,111,120, 10,101,110,100, 10,
-     10, 45, 45, 32,103,101,116, 32, 99,117,114,114,101,110,116,
-     32,110, 97,109,101,115,112, 97, 99,101, 10,102,117,110, 99,
-    116,105,111,110, 32,103,101,116, 99,117,114,114,110, 97,109,
-    101,115,112, 97, 99,101, 32, 40, 41, 10,  9,114,101,116,117,
-    114,110, 32,103,101,116,110, 97,109,101,115,112, 97, 99,101,
-     40, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114,
-     46, 99,117,114,114, 41, 10,101,110,100, 10, 10, 45, 45, 32,
-     97,112,112,101,110,100, 32,116,111, 32, 99,117,114,114,101,
-    110,116, 32, 99,111,110,116, 97,105,110,101,114, 10,102,117,
-    110, 99,116,105,111,110, 32, 97,112,112,101,110,100, 32, 40,
-    116, 41, 10, 32,114,101,116,117,114,110, 32, 99,108, 97,115,
-    115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114,
-     58, 97,112,112,101,110,100, 40,116, 41, 10,101,110,100, 10,
-     10, 45, 45, 32, 97,112,112,101,110,100, 32,116,121,112,101,
-    100,101,102, 32,116,111, 32, 99,117,114,114,101,110,116, 32,
-     99,111,110,116, 97,105,110,101,114, 10,102,117,110, 99,116,
-    105,111,110, 32, 97,112,112,101,110,100,116,121,112,101,100,
-    101,102, 32, 40,116, 41, 10, 32,114,101,116,117,114,110, 32,
-     99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 46,
-     99,117,114,114, 58, 97,112,112,101,110,100,116,121,112,101,
-    100,101,102, 40,116, 41, 10,101,110,100, 10, 10, 45, 45, 32,
-     97,112,112,101,110,100, 32,117,115,101,114,116,121,112,101,
-     32,116,111, 32, 99,117,114,114,101,110,116, 32, 99,111,110,
-    116, 97,105,110,101,114, 10,102,117,110, 99,116,105,111,110,
-     32, 97,112,112,101,110,100,117,115,101,114,116,121,112,101,
-     32, 40,116, 41, 10, 32,114,101,116,117,114,110, 32, 99,108,
-     97,115,115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,
-    114,114, 58, 97,112,112,101,110,100,117,115,101,114,116,121,
-    112,101, 40,116, 41, 10,101,110,100, 10, 10, 45, 45, 32, 97,
-    112,112,101,110,100, 32,101,110,117,109, 32,116,111, 32, 99,
-    117,114,114,101,110,116, 32, 99,111,110,116, 97,105,110,101,
-    114, 10,102,117,110, 99,116,105,111,110, 32, 97,112,112,101,
-    110,100,101,110,117,109, 32, 40,116, 41, 10, 32,114,101,116,
-    117,114,110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,
-    110,101,114, 46, 99,117,114,114, 58, 97,112,112,101,110,100,
-    101,110,117,109, 40,116, 41, 10,101,110,100, 10, 10, 45, 45,
-     32,115,117, 98,115,116,105,116,117,116,101, 32,116,121,112,
-    101,100,101,102, 10,102,117,110, 99,116,105,111,110, 32, 97,
-    112,112,108,121,116,121,112,101,100,101,102, 32, 40,109,111,
-    100, 44,116,121,112,101, 41, 10, 32,114,101,116,117,114,110,
-     32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114,
-     46, 99,117,114,114, 58, 97,112,112,108,121,116,121,112,101,
-    100,101,102, 40,109,111,100, 44,116,121,112,101, 41, 10,101,
-    110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102,
-     32,105,115, 32,116,121,112,101, 10,102,117,110, 99,116,105,
-    111,110, 32,102,105,110,100,116,121,112,101, 32, 40,116,121,
-    112,101, 41, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,
-     99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 46,
-     99,117,114,114, 58,102,105,110,100,116,121,112,101, 40,116,
-    121,112,101, 41, 10,  9,114,101,116,117,114,110, 32,116, 10,
-    101,110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,
-    102, 32,105,115, 32,116,121,112,101,100,101,102, 10,102,117,
-    110, 99,116,105,111,110, 32,105,115,116,121,112,101,100,101,
-    102, 32, 40,116,121,112,101, 41, 10, 32,114,101,116,117,114,
-    110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,
-    114, 46, 99,117,114,114, 58,105,115,116,121,112,101,100,101,
-    102, 40,116,121,112,101, 41, 10,101,110,100, 10, 10, 45, 45,
-     32,103,101,116, 32,102,117,108,108,116,121,112,101, 32, 40,
-    119,105,116,104, 32,110, 97,109,101,115,112, 97, 99,101, 41,
-     10,102,117,110, 99,116,105,111,110, 32,102,117,108,108,116,
-    121,112,101, 32, 40,116, 41, 10, 32,108,111, 99, 97,108, 32,
-     99,117,114,114, 32, 61, 32, 32, 99,108, 97,115,115, 67,111,
-    110,116, 97,105,110,101,114, 46, 99,117,114,114, 10,  9,119,
-    104,105,108,101, 32, 99,117,114,114, 32,100,111, 10,  9, 32,
-    105,102, 32, 99,117,114,114, 32,116,104,101,110, 10,  9,  9,
-     32,105,102, 32, 99,117,114,114, 46,116,121,112,101,100,101,
-    102,115, 32, 97,110,100, 32, 99,117,114,114, 46,116,121,112,
-    101,100,101,102,115, 91,116, 93, 32,116,104,101,110, 10,  9,
-      9, 32, 32,114,101,116,117,114,110, 32, 99,117,114,114, 46,
-    116,121,112,101,100,101,102,115, 91,116, 93, 10,  9,  9, 32,
-    101,108,115,101,105,102, 32, 99,117,114,114, 46,117,115,101,
-    114,116,121,112,101,115, 32, 97,110,100, 32, 99,117,114,114,
-     46,117,115,101,114,116,121,112,101,115, 91,116, 93, 32,116,
-    104,101,110, 10,  9,  9, 32, 32,114,101,116,117,114,110, 32,
-     99,117,114,114, 46,117,115,101,114,116,121,112,101,115, 91,
-    116, 93, 10,  9,  9,  9,101,110,100, 10,  9,  9,101,110,100,
-     10,  9, 32, 99,117,114,114, 32, 61, 32, 99,117,114,114, 46,
-    112,114,111,120, 10,  9,101,110,100, 10,  9,114,101,116,117,
-    114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 99,104,
-    101, 99,107,115, 32,105,102, 32,105,116, 32,114,101,113,117,
-    105,114,101,115, 32, 99,111,108,108,101, 99,116,105,111,110,
-     10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115,
-     67,111,110,116, 97,105,110,101,114, 58,114,101,113,117,105,
-    114,101, 99,111,108,108,101, 99,116,105,111,110, 32, 40,116,
-     41, 10, 32,112,117,115,104, 40,115,101,108,102, 41, 10, 32,
-    108,111, 99, 97,108, 32,105, 61, 49, 10,  9,108,111, 99, 97,
-    108, 32,114, 32, 61, 32,102, 97,108,115,101, 10, 32,119,104,
-    105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10,
-     32, 32,114, 32, 61, 32,115,101,108,102, 91,105, 93, 58,114,
-    101,113,117,105,114,101, 99,111,108,108,101, 99,116,105,111,
-    110, 40,116, 41, 32,111,114, 32,114, 10, 32, 32,105, 32, 61,
-     32,105, 43, 49, 10, 32,101,110,100, 10,  9,112,111,112, 40,
-     41, 10,  9,114,101,116,117,114,110, 32,114, 10,101,110,100,
-     10, 10, 10, 45, 45, 32,103,101,116, 32,110, 97,109,101,115,
-     97,112, 99,101, 10,102,117,110, 99,116,105,111,110, 32,103,
-    101,116,110, 97,109,101,115,112, 97, 99,101, 32, 40, 99,117,
-    114,114, 41, 10,  9,108,111, 99, 97,108, 32,110, 97,109,101,
-    115,112, 97, 99,101, 32, 61, 32, 39, 39, 10,  9,119,104,105,
-    108,101, 32, 99,117,114,114, 32,100,111, 10,  9, 32,105,102,
-     32, 99,117,114,114, 32, 97,110,100, 10,  9,  9, 32, 32, 32,
-     40, 32, 99,117,114,114, 46, 99,108, 97,115,115,116,121,112,
-    101, 32, 61, 61, 32, 39, 99,108, 97,115,115, 39, 32,111,114,
-     32, 99,117,114,114, 46, 99,108, 97,115,115,116,121,112,101,
-     32, 61, 61, 32, 39,110, 97,109,101,115,112, 97, 99,101, 39,
-     41, 10,  9,  9,116,104,101,110, 10,  9,  9, 32,110, 97,109,
-    101,115,112, 97, 99,101, 32, 61, 32, 40, 99,117,114,114, 46,
-    111,114,105,103,105,110, 97,108, 95,110, 97,109,101, 32,111,
-    114, 32, 99,117,114,114, 46,110, 97,109,101, 41, 32, 46, 46,
-     32, 39, 58, 58, 39, 32, 46, 46, 32,110, 97,109,101,115,112,
-     97, 99,101, 10,  9,  9, 32, 45, 45,110, 97,109,101,115,112,
-     97, 99,101, 32, 61, 32, 99,117,114,114, 46,110, 97,109,101,
-     32, 46, 46, 32, 39, 58, 58, 39, 32, 46, 46, 32,110, 97,109,
-    101,115,112, 97, 99,101, 10,  9,  9,101,110,100, 10,  9, 32,
-     99,117,114,114, 32, 61, 32, 99,117,114,114, 46,112,114,111,
-    120, 10,  9,101,110,100, 10,  9,114,101,116,117,114,110, 32,
-    110, 97,109,101,115,112, 97, 99,101, 10,101,110,100, 10, 10,
-     45, 45, 32,103,101,116, 32,110, 97,109,101,115,112, 97, 99,
-    101, 32, 40,111,110,108,121, 32,110, 97,109,101,115,112, 97,
-     99,101, 41, 10,102,117,110, 99,116,105,111,110, 32,103,101,
-    116,111,110,108,121,110, 97,109,101,115,112, 97, 99,101, 32,
-     40, 41, 10, 32,108,111, 99, 97,108, 32, 99,117,114,114, 32,
-     61, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,
-    114, 46, 99,117,114,114, 10,  9,108,111, 99, 97,108, 32,110,
-     97,109,101,115,112, 97, 99,101, 32, 61, 32, 39, 39, 10,  9,
-    119,104,105,108,101, 32, 99,117,114,114, 32,100,111, 10,  9,
-      9,105,102, 32, 99,117,114,114, 46, 99,108, 97,115,115,116,
-    121,112,101, 32, 61, 61, 32, 39, 99,108, 97,115,115, 39, 32,
-    116,104,101,110, 10,  9,  9, 32,114,101,116,117,114,110, 32,
-    110, 97,109,101,115,112, 97, 99,101, 10,  9,  9,101,108,115,
-    101,105,102, 32, 99,117,114,114, 46, 99,108, 97,115,115,116,
-    121,112,101, 32, 61, 61, 32, 39,110, 97,109,101,115,112, 97,
-     99,101, 39, 32,116,104,101,110, 10,  9,  9, 32,110, 97,109,
-    101,115,112, 97, 99,101, 32, 61, 32, 99,117,114,114, 46,110,
-     97,109,101, 32, 46, 46, 32, 39, 58, 58, 39, 32, 46, 46, 32,
-    110, 97,109,101,115,112, 97, 99,101, 10,  9,  9,101,110,100,
-     10,  9, 32, 99,117,114,114, 32, 61, 32, 99,117,114,114, 46,
-    112,114,111,120, 10,  9,101,110,100, 10,  9,114,101,116,117,
-    114,110, 32,110, 97,109,101,115,112, 97, 99,101, 10,101,110,
-    100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,
-    105,115, 32,101,110,117,109, 10,102,117,110, 99,116,105,111,
-    110, 32,105,115,101,110,117,109, 32, 40,116,121,112,101, 41,
-     10, 32,114,101,116,117,114,110, 32, 99,108, 97,115,115, 67,
-    111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 58,105,
-    115,101,110,117,109, 40,116,121,112,101, 41, 10,101,110,100,
-     10, 10, 45, 45, 32, 97,112,112,101,110,100, 32,102,101, 97,
-    116,117,114,101, 32,116,111, 32, 99,111,110,116, 97,105,110,
-    101,114, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,
-    115,115, 67,111,110,116, 97,105,110,101,114, 58, 97,112,112,
-    101,110,100, 32, 40,116, 41, 10, 32,115,101,108,102, 46,110,
-     32, 61, 32,115,101,108,102, 46,110, 32, 43, 32, 49, 10, 32,
-    115,101,108,102, 91,115,101,108,102, 46,110, 93, 32, 61, 32,
-    116, 10, 32,116, 46,112, 97,114,101,110,116, 32, 61, 32,115,
-    101,108,102, 10,101,110,100, 10, 10, 45, 45, 32, 97,112,112,
-    101,110,100, 32,116,121,112,101,100,101,102, 10,102,117,110,
-     99,116,105,111,110, 32, 99,108, 97,115,115, 67,111,110,116,
-     97,105,110,101,114, 58, 97,112,112,101,110,100,116,121,112,
-    101,100,101,102, 32, 40,116, 41, 10, 32,108,111, 99, 97,108,
-     32,110, 97,109,101,115,112, 97, 99,101, 32, 61, 32,103,101,
-    116,110, 97,109,101,115,112, 97, 99,101, 40, 99,108, 97,115,
-    115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114,
-     41, 10, 32,115,101,108,102, 46,116,121,112,101,100,101,102,
-    115, 46,116,111,108,117, 97, 95,110, 32, 61, 32,115,101,108,
-    102, 46,116,121,112,101,100,101,102,115, 46,116,111,108,117,
-     97, 95,110, 32, 43, 32, 49, 10, 32,115,101,108,102, 46,116,
-    121,112,101,100,101,102,115, 91,115,101,108,102, 46,116,121,
-    112,101,100,101,102,115, 46,116,111,108,117, 97, 95,110, 93,
-     32, 61, 32,116, 10,  9,115,101,108,102, 46,116,121,112,101,
-    100,101,102,115, 91,116, 46,117,116,121,112,101, 93, 32, 61,
-     32,110, 97,109,101,115,112, 97, 99,101, 32, 46, 46, 32,116,
-     46,117,116,121,112,101, 10,  9,103,108,111, 98, 97,108, 95,
-    116,121,112,101,100,101,102,115, 91,110, 97,109,101,115,112,
-     97, 99,101, 46, 46,116, 46,117,116,121,112,101, 93, 32, 61,
-     32,116, 10,  9,116, 46,102,116,121,112,101, 32, 61, 32,102,
-    105,110,100,116,121,112,101, 40,116, 46,116,121,112,101, 41,
-     32,111,114, 32,116, 46,116,121,112,101, 10,  9, 45, 45,112,
-    114,105,110,116, 40, 34, 97,112,112,101,110,100,105,110,103,
-     32,116,121,112,101,100,101,102, 32, 34, 46, 46,116, 46,117,
-    116,121,112,101, 46, 46, 34, 32, 97,115, 32, 34, 46, 46,110,
-     97,109,101,115,112, 97, 99,101, 46, 46,116, 46,117,116,121,
-    112,101, 46, 46, 34, 32,119,105,116,104, 32,102,116,121,112,
-    101, 32, 34, 46, 46,116, 46,102,116,121,112,101, 41, 10,  9,
-     97,112,112,101,110,100, 95,103,108,111, 98, 97,108, 95,116,
-    121,112,101, 40,110, 97,109,101,115,112, 97, 99,101, 46, 46,
-    116, 46,117,116,121,112,101, 41, 10,  9,105,102, 32,116, 46,
-    102,116,121,112,101, 32, 97,110,100, 32,105,115,101,110,117,
-    109, 40,116, 46,102,116,121,112,101, 41, 32,116,104,101,110,
-     10, 10,  9,  9,103,108,111, 98, 97,108, 95,101,110,117,109,
-    115, 91,110, 97,109,101,115,112, 97, 99,101, 46, 46,116, 46,
-    117,116,121,112,101, 93, 32, 61, 32,116,114,117,101, 10,  9,
-    101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 97,112,112,
-    101,110,100, 32,117,115,101,114,116,121,112,101, 58, 32,114,
-    101,116,117,114,110, 32,102,117,108,108, 32,116,121,112,101,
-     10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115,
-     67,111,110,116, 97,105,110,101,114, 58, 97,112,112,101,110,
-    100,117,115,101,114,116,121,112,101, 32, 40,116, 41, 10,  9,
-    108,111, 99, 97,108, 32, 99,111,110,116, 97,105,110,101,114,
-     10,  9,105,102, 32,116, 32, 61, 61, 32, 40,115,101,108,102,
-     46,111,114,105,103,105,110, 97,108, 95,110, 97,109,101, 32,
-    111,114, 32,115,101,108,102, 46,110, 97,109,101, 41, 32,116,
-    104,101,110, 10,  9,  9, 99,111,110,116, 97,105,110,101,114,
-     32, 61, 32,115,101,108,102, 46,112,114,111,120, 10,  9,101,
-    108,115,101, 10,  9,  9, 99,111,110,116, 97,105,110,101,114,
-     32, 61, 32,115,101,108,102, 10,  9,101,110,100, 10,  9,108,
-    111, 99, 97,108, 32,102,116, 32, 61, 32,103,101,116,110, 97,
-    109,101,115,112, 97, 99,101, 40, 99,111,110,116, 97,105,110,
-    101,114, 41, 32, 46, 46, 32,116, 10,  9, 99,111,110,116, 97,
-    105,110,101,114, 46,117,115,101,114,116,121,112,101,115, 91,
-    116, 93, 32, 61, 32,102,116, 10,  9, 95,117,115,101,114,116,
-    121,112,101, 91,102,116, 93, 32, 61, 32,102,116, 10,  9,114,
-    101,116,117,114,110, 32,102,116, 10,101,110,100, 10, 10, 45,
-     45, 32, 97,112,112,101,110,100, 32,101,110,117,109, 10,102,
-    117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67,111,
-    110,116, 97,105,110,101,114, 58, 97,112,112,101,110,100,101,
-    110,117,109, 32, 40,116, 41, 10, 32,108,111, 99, 97,108, 32,
-    110, 97,109,101,115,112, 97, 99,101, 32, 61, 32,103,101,116,
-    110, 97,109,101,115,112, 97, 99,101, 40, 99,108, 97,115,115,
-     67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 41,
-     10, 32,115,101,108,102, 46,101,110,117,109,115, 46,116,111,
-    108,117, 97, 95,110, 32, 61, 32,115,101,108,102, 46,101,110,
-    117,109,115, 46,116,111,108,117, 97, 95,110, 32, 43, 32, 49,
-     10, 32,115,101,108,102, 46,101,110,117,109,115, 91,115,101,
-    108,102, 46,101,110,117,109,115, 46,116,111,108,117, 97, 95,
-    110, 93, 32, 61, 32,116, 10,  9,103,108,111, 98, 97,108, 95,
-    101,110,117,109,115, 91,110, 97,109,101,115,112, 97, 99,101,
-     46, 46,116, 46,110, 97,109,101, 93, 32, 61, 32,116, 10,101,
-    110,100, 10, 10, 45, 45, 32,100,101,116,101,114,109,105,110,
-    101, 32,108,117, 97, 32,102,117,110, 99,116,105,111,110, 32,
-    110, 97,109,101, 32,111,118,101,114,108,111, 97,100, 10,102,
-    117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67,111,
-    110,116, 97,105,110,101,114, 58,111,118,101,114,108,111, 97,
-    100, 32, 40,108,110, 97,109,101, 41, 10, 32,105,102, 32,110,
-    111,116, 32,115,101,108,102, 46,108,110, 97,109,101,115, 91,
-    108,110, 97,109,101, 93, 32,116,104,101,110, 10, 32, 32,115,
-    101,108,102, 46,108,110, 97,109,101,115, 91,108,110, 97,109,
-    101, 93, 32, 61, 32, 48, 10, 32,101,108,115,101, 10, 32, 32,
-    115,101,108,102, 46,108,110, 97,109,101,115, 91,108,110, 97,
-    109,101, 93, 32, 61, 32,115,101,108,102, 46,108,110, 97,109,
-    101,115, 91,108,110, 97,109,101, 93, 32, 43, 32, 49, 10, 32,
-    101,110,100, 10, 32,114,101,116,117,114,110, 32,102,111,114,
-    109, 97,116, 40, 34, 37, 48, 50,100, 34, 44,115,101,108,102,
-     46,108,110, 97,109,101,115, 91,108,110, 97,109,101, 93, 41,
-     10,101,110,100, 10, 10, 45, 45, 32, 97,112,112,108,105,101,
-    115, 32,116,121,112,101,100,101,102, 58, 32,114,101,116,117,
-    114,110,115, 32,116,104,101, 32, 39,116,104,101, 32,102, 97,
-     99,116,111, 39, 32,109,111,100,105,102,105,101,114, 32, 97,
-    110,100, 32,116,121,112,101, 10,102,117,110, 99,116,105,111,
-    110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,
-    114, 58, 97,112,112,108,121,116,121,112,101,100,101,102, 32,
-     40,109,111,100, 44,116,121,112,101, 41, 10,  9,105,102, 32,
-    103,108,111, 98, 97,108, 95,116,121,112,101,100,101,102,115,
-     91,116,121,112,101, 93, 32,116,104,101,110, 10,  9,  9, 45,
-     45,112,114,105,110,116, 40, 34,102,111,117,110,100, 32,116,
-    121,112,101,100,101,102, 32, 34, 46, 46,103,108,111, 98, 97,
-    108, 95,116,121,112,101,100,101,102,115, 91,116,121,112,101,
-     93, 46,116,121,112,101, 41, 10,  9,  9,108,111, 99, 97,108,
-     32,109,111,100, 49, 44, 32,116,121,112,101, 49, 32, 61, 32,
-    103,108,111, 98, 97,108, 95,116,121,112,101,100,101,102,115,
-     91,116,121,112,101, 93, 46,109,111,100, 44, 32,103,108,111,
-     98, 97,108, 95,116,121,112,101,100,101,102,115, 91,116,121,
-    112,101, 93, 46,102,116,121,112,101, 10,  9,  9,108,111, 99,
-     97,108, 32,109,111,100, 50, 44, 32,116,121,112,101, 50, 32,
-     61, 32, 97,112,112,108,121,116,121,112,101,100,101,102, 40,
-    109,111,100, 46, 46, 34, 32, 34, 46, 46,109,111,100, 49, 44,
-     32,116,121,112,101, 49, 41, 10,  9,  9, 45, 45,114,101,116,
-    117,114,110, 32,109,111,100, 50, 32, 46, 46, 32, 39, 32, 39,
-     32, 46, 46, 32,109,111,100, 49, 44, 32,116,121,112,101, 50,
-     10,  9,  9,114,101,116,117,114,110, 32,109,111,100, 50, 44,
-     32,116,121,112,101, 50, 10,  9,101,110,100, 10,  9,100,111,
-     32,114,101,116,117,114,110, 32,109,111,100, 44,116,121,112,
-    101, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 99,
-    104,101, 99,107, 32,105,102, 32,105,116, 32,105,115, 32, 97,
-     32,116,121,112,101,100,101,102, 10,102,117,110, 99,116,105,
-    111,110, 32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,
-    101,114, 58,105,115,116,121,112,101,100,101,102, 32, 40,116,
-    121,112,101, 41, 10, 32,108,111, 99, 97,108, 32,101,110,118,
-     32, 61, 32,115,101,108,102, 10, 32,119,104,105,108,101, 32,
-    101,110,118, 32,100,111, 10, 32, 32,105,102, 32,101,110,118,
-     46,116,121,112,101,100,101,102,115, 32,116,104,101,110, 10,
-     32, 32, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32, 32,
-     32,119,104,105,108,101, 32,101,110,118, 46,116,121,112,101,
-    100,101,102,115, 91,105, 93, 32,100,111, 10, 32, 32, 32, 32,
-    105,102, 32,101,110,118, 46,116,121,112,101,100,101,102,115,
-     91,105, 93, 46,117,116,121,112,101, 32, 61, 61, 32,116,121,
-    112,101, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32,
-     32, 32,114,101,116,117,114,110, 32,116,121,112,101, 10, 32,
-     32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,
-     32, 32, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32, 32, 32,
-    101,110,100, 10, 32, 32,101,110,100, 10, 32, 32,101,110,118,
-     32, 61, 32,101,110,118, 46,112, 97,114,101,110,116, 10, 32,
-    101,110,100, 10, 32,114,101,116,117,114,110, 32,110,105,108,
-     10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,
-    102,105,110,100, 95,101,110,117,109, 95,118, 97,114, 40,118,
-     97,114, 41, 10, 10,  9,105,102, 32,116,111,110,117,109, 98,
-    101,114, 40,118, 97,114, 41, 32,116,104,101,110, 32,114,101,
-    116,117,114,110, 32,118, 97,114, 32,101,110,100, 10, 10,  9,
-    108,111, 99, 97,108, 32, 99, 32, 61, 32, 99,108, 97,115,115,
-     67,111,110,116, 97,105,110,101,114, 46, 99,117,114,114, 10,
-      9,119,104,105,108,101, 32, 99, 32,100,111, 10,  9,  9,108,
-    111, 99, 97,108, 32,110,115, 32, 61, 32,103,101,116,110, 97,
-    109,101,115,112, 97, 99,101, 40, 99, 41, 10,  9,  9,102,111,
-    114, 32,107, 44,118, 32,105,110, 32,112, 97,105,114,115, 40,
-     95,103,108,111, 98, 97,108, 95,101,110,117,109,115, 41, 32,
-    100,111, 10,  9,  9,  9,105,102, 32,109, 97,116, 99,104, 95,
-    116,121,112,101, 40,118, 97,114, 44, 32,118, 44, 32,110,115,
-     41, 32,116,104,101,110, 10,  9,  9,  9,  9,114,101,116,117,
-    114,110, 32,118, 10,  9,  9,  9,101,110,100, 10,  9,  9,101,
-    110,100, 10,  9,  9,105,102, 32, 99, 46, 98, 97,115,101, 32,
-     97,110,100, 32, 99, 46, 98, 97,115,101, 32,126, 61, 32, 39,
-     39, 32,116,104,101,110, 10,  9,  9,  9, 99, 32, 61, 32, 95,
-    103,108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91,
-     99, 58,102,105,110,100,116,121,112,101, 40, 99, 46, 98, 97,
-    115,101, 41, 93, 10,  9,  9,101,108,115,101, 10,  9,  9,  9,
-     99, 32, 61, 32,110,105,108, 10,  9,  9,101,110,100, 10,  9,
-    101,110,100, 10, 10,  9,114,101,116,117,114,110, 32,118, 97,
-    114, 10,101,110,100, 10, 10, 45, 45, 32, 99,104,101, 99,107,
-     32,105,102, 32,105,115, 32, 97, 32,114,101,103,105,115,116,
-    101,114,101,100, 32,116,121,112,101, 58, 32,114,101,116,117,
-    114,110, 32,102,117,108,108, 32,116,121,112,101, 32,111,114,
-     32,110,105,108, 10,102,117,110, 99,116,105,111,110, 32, 99,
-    108, 97,115,115, 67,111,110,116, 97,105,110,101,114, 58,102,
-    105,110,100,116,121,112,101, 32, 40,116, 41, 10, 10,  9,116,
-     32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,
-    116, 44, 32, 34, 61, 46, 42, 34, 44, 32, 34, 34, 41, 10,  9,
-    105,102, 32, 95, 98, 97,115,105, 99, 91,116, 93, 32,116,104,
-    101,110, 10,  9, 32,114,101,116,117,114,110, 32,116, 10,  9,
-    101,110,100, 10, 10,  9,108,111, 99, 97,108, 32, 95, 44, 95,
-     44,101,109, 32, 61, 32,115,116,114,105,110,103, 46,102,105,
-    110,100, 40,116, 44, 32, 34, 40, 91, 38, 37, 42, 93, 41, 37,
-    115, 42, 36, 34, 41, 10,  9,116, 32, 61, 32,115,116,114,105,
-    110,103, 46,103,115,117, 98, 40,116, 44, 32, 34, 37,115, 42,
-     40, 91, 38, 37, 42, 93, 41, 37,115, 42, 36, 34, 44, 32, 34,
-     34, 41, 10,  9,112, 32, 61, 32,115,101,108,102, 10,  9,119,
-    104,105,108,101, 32,112, 32, 97,110,100, 32,116,121,112,101,
-     40,112, 41, 61, 61, 39,116, 97, 98,108,101, 39, 32,100,111,
-     10,  9,  9,108,111, 99, 97,108, 32,115,116, 32, 61, 32,103,
-    101,116,110, 97,109,101,115,112, 97, 99,101, 40,112, 41, 10,
-     10,  9,  9,102,111,114, 32,105, 61, 95,103,108,111, 98, 97,
-    108, 95,116,121,112,101,115, 46,110, 44, 49, 44, 45, 49, 32,
-    100,111, 32, 45, 45, 32,105,110, 32,114,101,118,101,114,115,
-    101, 32,111,114,100,101,114, 10, 10,  9,  9,  9,105,102, 32,
-    109, 97,116, 99,104, 95,116,121,112,101, 40,116, 44, 32, 95,
-    103,108,111, 98, 97,108, 95,116,121,112,101,115, 91,105, 93,
-     44, 32,115,116, 41, 32,116,104,101,110, 10,  9,  9,  9,  9,
-    114,101,116,117,114,110, 32, 95,103,108,111, 98, 97,108, 95,
-    116,121,112,101,115, 91,105, 93, 46, 46, 40,101,109, 32,111,
-    114, 32, 34, 34, 41, 10,  9,  9,  9,101,110,100, 10,  9,  9,
-    101,110,100, 10,  9,  9,105,102, 32,112, 46, 98, 97,115,101,
-     32, 97,110,100, 32,112, 46, 98, 97,115,101, 32,126, 61, 32,
-     39, 39, 32, 97,110,100, 32,112, 46, 98, 97,115,101, 32,126,
-     61, 32,116, 32,116,104,101,110, 10,  9,  9,  9, 45, 45,112,
-    114,105,110,116, 40, 34,116,121,112,101, 32,105,115, 32, 34,
-     46, 46,116, 46, 46, 34, 44, 32,112, 32,105,115, 32, 34, 46,
-     46,112, 46, 98, 97,115,101, 46, 46, 34, 32,115,101,108,102,
-     46,116,121,112,101, 32,105,115, 32, 34, 46, 46,115,101,108,
-    102, 46,116,121,112,101, 46, 46, 34, 32,115,101,108,102, 46,
-    110, 97,109,101, 32,105,115, 32, 34, 46, 46,115,101,108,102,
-     46,110, 97,109,101, 41, 10,  9,  9,  9,112, 32, 61, 32, 95,
-    103,108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91,
-    112, 58,102,105,110,100,116,121,112,101, 40,112, 46, 98, 97,
-    115,101, 41, 93, 10,  9,  9,101,108,115,101, 10,  9,  9,  9,
-    112, 32, 61, 32,110,105,108, 10,  9,  9,101,110,100, 10,  9,
-    101,110,100, 10, 10,  9,114,101,116,117,114,110, 32,110,105,
-    108, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110,
-     32, 97,112,112,101,110,100, 95,103,108,111, 98, 97,108, 95,
-    116,121,112,101, 40,116, 44, 32, 99,108, 97,115,115, 41, 10,
-      9, 95,103,108,111, 98, 97,108, 95,116,121,112,101,115, 46,
-    110, 32, 61, 32, 95,103,108,111, 98, 97,108, 95,116,121,112,
-    101,115, 46,110, 32, 43, 49, 10,  9, 95,103,108,111, 98, 97,
-    108, 95,116,121,112,101,115, 91, 95,103,108,111, 98, 97,108,
-     95,116,121,112,101,115, 46,110, 93, 32, 61, 32,116, 10,  9,
-     95,103,108,111, 98, 97,108, 95,116,121,112,101,115, 95,104,
-     97,115,104, 91,116, 93, 32, 61, 32, 49, 10,  9,105,102, 32,
-     99,108, 97,115,115, 32,116,104,101,110, 32, 97,112,112,101,
-    110,100, 95, 99,108, 97,115,115, 95,116,121,112,101, 40,116,
-     44, 32, 99,108, 97,115,115, 41, 32,101,110,100, 10,101,110,
-    100, 10, 10,102,117,110, 99,116,105,111,110, 32, 97,112,112,
-    101,110,100, 95, 99,108, 97,115,115, 95,116,121,112,101, 40,
-    116, 44, 99,108, 97,115,115, 41, 10,  9,105,102, 32, 95,103,
-    108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91,116,
-     93, 32,116,104,101,110, 10,  9,  9, 99,108, 97,115,115, 46,
-    102,108, 97,103,115, 32, 61, 32, 95,103,108,111, 98, 97,108,
-     95, 99,108, 97,115,115,101,115, 91,116, 93, 46,102,108, 97,
-    103,115, 10,  9,  9, 99,108, 97,115,115, 46,108,110, 97,109,
-    101,115, 32, 61, 32, 95,103,108,111, 98, 97,108, 95, 99,108,
-     97,115,115,101,115, 91,116, 93, 46,108,110, 97,109,101,115,
-     10,  9,  9,105,102, 32, 95,103,108,111, 98, 97,108, 95, 99,
-    108, 97,115,115,101,115, 91,116, 93, 46, 98, 97,115,101, 32,
-     97,110,100, 32, 40, 95,103,108,111, 98, 97,108, 95, 99,108,
-     97,115,115,101,115, 91,116, 93, 46, 98, 97,115,101, 32,126,
-     61, 32, 39, 39, 41, 32,116,104,101,110, 10,  9,  9,  9, 99,
-    108, 97,115,115, 46, 98, 97,115,101, 32, 61, 32, 95,103,108,
-    111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91,116, 93,
-     46, 98, 97,115,101, 32,111,114, 32, 99,108, 97,115,115, 46,
-     98, 97,115,101, 10,  9,  9,101,110,100, 10,  9,101,110,100,
-     10,  9, 95,103,108,111, 98, 97,108, 95, 99,108, 97,115,115,
-    101,115, 91,116, 93, 32, 61, 32, 99,108, 97,115,115, 10,  9,
-     99,108, 97,115,115, 46,102,108, 97,103,115, 32, 61, 32, 99,
-    108, 97,115,115, 46,102,108, 97,103,115, 32,111,114, 32,123,
-    125, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110,
-     32,109, 97,116, 99,104, 95,116,121,112,101, 40, 99,104,105,
-    108,100,116,121,112,101, 44, 32,114,101,103,116,121,112,101,
-     44, 32,115,116, 41, 10, 45, 45,112,114,105,110,116, 40, 34,
-    102,105,110,100,116,121,112,101, 32, 34, 46, 46, 99,104,105,
-    108,100,116,121,112,101, 46, 46, 34, 44, 32, 34, 46, 46,114,
-    101,103,116,121,112,101, 46, 46, 34, 44, 32, 34, 46, 46,115,
-    116, 41, 10,  9,108,111, 99, 97,108, 32, 98, 44,101, 32, 61,
-     32,115,116,114,105,110,103, 46,102,105,110,100, 40,114,101,
-    103,116,121,112,101, 44, 32, 99,104,105,108,100,116,121,112,
-    101, 44, 32, 45,115,116,114,105,110,103, 46,108,101,110, 40,
-     99,104,105,108,100,116,121,112,101, 41, 44, 32,116,114,117,
-    101, 41, 10,  9,105,102, 32, 98, 32,116,104,101,110, 10, 10,
-      9,  9,105,102, 32,101, 32, 61, 61, 32,115,116,114,105,110,
-    103, 46,108,101,110, 40,114,101,103,116,121,112,101, 41, 32,
-     97,110,100, 10,  9,  9,  9,  9, 40, 98, 32, 61, 61, 32, 49,
-     32,111,114, 32, 40,115,116,114,105,110,103, 46,115,117, 98,
-     40,114,101,103,116,121,112,101, 44, 32, 98, 45, 49, 44, 32,
-     98, 45, 49, 41, 32, 61, 61, 32, 39, 58, 39, 32, 97,110,100,
-     10,  9,  9,  9,  9,115,116,114,105,110,103, 46,115,117, 98,
-     40,114,101,103,116,121,112,101, 44, 32, 49, 44, 32, 98, 45,
-     49, 41, 32, 61, 61, 32,115,116,114,105,110,103, 46,115,117,
-     98, 40,115,116, 44, 32, 49, 44, 32, 98, 45, 49, 41, 41, 41,
-     32,116,104,101,110, 10,  9,  9,  9,114,101,116,117,114,110,
-     32,116,114,117,101, 10,  9,  9,101,110,100, 10,  9,101,110,
-    100, 10, 10,  9,114,101,116,117,114,110, 32,102, 97,108,115,
-    101, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110,
-     32,102,105,110,100,116,121,112,101, 95,111,110, 95, 99,104,
-    105,108,100,115, 40,115,101,108,102, 44, 32,116, 41, 10, 10,
-      9,108,111, 99, 97,108, 32,116, 99,104,105,108,100, 10,  9,
-    105,102, 32,115,101,108,102, 46, 99,108, 97,115,115,116,121,
-    112,101, 32, 61, 61, 32, 39, 99,108, 97,115,115, 39, 32,111,
-    114, 32,115,101,108,102, 46, 99,108, 97,115,115,116,121,112,
-    101, 32, 61, 61, 32, 39,110, 97,109,101,115,112, 97, 99,101,
-     39, 32,116,104,101,110, 10,  9,  9,102,111,114, 32,107, 44,
-    118, 32,105,110, 32,105,112, 97,105,114,115, 40,115,101,108,
-    102, 41, 32,100,111, 10,  9,  9,  9,105,102, 32,118, 46, 99,
-    108, 97,115,115,116,121,112,101, 32, 61, 61, 32, 39, 99,108,
-     97,115,115, 39, 32,111,114, 32,118, 46, 99,108, 97,115,115,
-    116,121,112,101, 32, 61, 61, 32, 39,110, 97,109,101,115,112,
-     97, 99,101, 39, 32,116,104,101,110, 10,  9,  9,  9,  9,105,
-    102, 32,118, 46,116,121,112,101,100,101,102,115, 32, 97,110,
-    100, 32,118, 46,116,121,112,101,100,101,102,115, 91,116, 93,
-     32,116,104,101,110, 10,  9,  9,  9,  9, 32,114,101,116,117,
-    114,110, 32,118, 46,116,121,112,101,100,101,102,115, 91,116,
-     93, 10,  9,  9,  9,  9,101,108,115,101,105,102, 32,118, 46,
-    117,115,101,114,116,121,112,101,115, 32, 97,110,100, 32,118,
-     46,117,115,101,114,116,121,112,101,115, 91,116, 93, 32,116,
-    104,101,110, 10,  9,  9,  9,  9, 32,114,101,116,117,114,110,
-     32,118, 46,117,115,101,114,116,121,112,101,115, 91,116, 93,
-     10,  9,  9,  9,  9,101,110,100, 10,  9,  9,  9,  9,116, 99,
-    104,105,108,100, 32, 61, 32,102,105,110,100,116,121,112,101,
-     95,111,110, 95, 99,104,105,108,100,115, 40,118, 44, 32,116,
-     41, 10,  9,  9,  9,  9,105,102, 32,116, 99,104,105,108,100,
-     32,116,104,101,110, 32,114,101,116,117,114,110, 32,116, 99,
-    104,105,108,100, 32,101,110,100, 10,  9,  9,  9,101,110,100,
-     10,  9,  9,101,110,100, 10,  9,101,110,100, 10,  9,114,101,
-    116,117,114,110, 32,110,105,108, 10, 10,101,110,100, 10, 10,
-    102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67,
-    111,110,116, 97,105,110,101,114, 58,105,115,101,110,117,109,
-     32, 40,116,121,112,101, 41, 10, 32,105,102, 32,103,108,111,
-     98, 97,108, 95,101,110,117,109,115, 91,116,121,112,101, 93,
-     32,116,104,101,110, 10,  9,114,101,116,117,114,110, 32,116,
-    121,112,101, 10, 32,101,108,115,101, 10, 32,  9,114,101,116,
-    117,114,110, 32,102, 97,108,115,101, 10, 32,101,110,100, 10,
-     10, 32,108,111, 99, 97,108, 32, 98, 97,115,101,116,121,112,
-    101, 32, 61, 32,103,115,117, 98, 40,116,121,112,101, 44, 34,
-     94, 46, 42, 58, 58, 34, 44, 34, 34, 41, 10, 32,108,111, 99,
-     97,108, 32,101,110,118, 32, 61, 32,115,101,108,102, 10, 32,
-    119,104,105,108,101, 32,101,110,118, 32,100,111, 10, 32, 32,
-    105,102, 32,101,110,118, 46,101,110,117,109,115, 32,116,104,
-    101,110, 10, 32, 32, 32,108,111, 99, 97,108, 32,105, 61, 49,
-     10, 32, 32, 32,119,104,105,108,101, 32,101,110,118, 46,101,
-    110,117,109,115, 91,105, 93, 32,100,111, 10, 32, 32, 32, 32,
-    105,102, 32,101,110,118, 46,101,110,117,109,115, 91,105, 93,
-     46,110, 97,109,101, 32, 61, 61, 32, 98, 97,115,101,116,121,
-    112,101, 32,116,104,101,110, 10, 32, 32, 32, 32, 32, 32, 32,
-     32, 32,114,101,116,117,114,110, 32,116,114,117,101, 10, 32,
-     32, 32, 32, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32, 32,
-     32, 32, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32, 32, 32,
-    101,110,100, 10, 32, 32,101,110,100, 10, 32, 32,101,110,118,
-     32, 61, 32,101,110,118, 46,112, 97,114,101,110,116, 10, 32,
-    101,110,100, 10, 32,114,101,116,117,114,110, 32,102, 97,108,
-    115,101, 10,101,110,100, 10, 10,109,101,116,104,111,100,105,
-    115,118,105,114,116,117, 97,108, 32, 61, 32,102, 97,108,115,
-    101, 32, 45, 45, 32, 97, 32,103,108,111, 98, 97,108, 10, 10,
-     45, 45, 32,112, 97,114,115,101, 32, 99,104,117,110,107, 10,
-    102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67,
-    111,110,116, 97,105,110,101,114, 58,100,111,112, 97,114,115,
-    101, 32, 40,115, 41, 10, 45, 45,112,114,105,110,116, 32, 40,
-     34,112, 97,114,115,101, 32, 34, 46, 46,115, 41, 10, 10, 32,
-     45, 45, 32,116,114,121, 32,116,104,101, 32,112, 97,114,115,
-    101,114, 32,104,111,111,107, 10, 32,100,111, 10, 32,  9,108,
-    111, 99, 97,108, 32,115,117, 98, 32, 61, 32,112, 97,114,115,
-    101,114, 95,104,111,111,107, 40,115, 41, 10, 32,  9,105,102,
-     32,115,117, 98, 32,116,104,101,110, 10, 32,  9,  9,114,101,
-    116,117,114,110, 32,115,117, 98, 10, 32,  9,101,110,100, 10,
-     32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32,116,
-    104,101, 32,110,117,108,108, 32,115,116, 97,116,101,109,101,
-    110,116, 10, 32,100,111, 10, 32,  9,108,111, 99, 97,108, 32,
-     98, 44,101, 44, 99,111,100,101, 32, 61, 32,115,116,114,105,
-    110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 94, 37,115,
-     42, 59, 34, 41, 10, 32,  9,105,102, 32, 98, 32,116,104,101,
-    110, 10, 32,  9,  9,114,101,116,117,114,110, 32,115,116,114,
-    115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32,  9,101,110,
-    100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,121,
-     32,101,109,112,116,121, 32,118,101,114, 98, 97,116,105,109,
-     32,108,105,110,101, 10, 32,100,111, 10, 32,  9,108,111, 99,
-     97,108, 32, 98, 44,101, 44, 99,111,100,101, 32, 61, 32,115,
-    116,114,105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34,
-     94, 37,115, 42, 36, 92,110, 34, 41, 10, 32,  9,105,102, 32,
-     98, 32,116,104,101,110, 10, 32,  9,  9,114,101,116,117,114,
-    110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41,
-     10, 32,  9,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45,
-     45, 32,116,114,121, 32, 76,117, 97, 32, 99,111,100,101, 10,
-     32,100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101,
-     44, 99,111,100,101, 32, 61, 32,115,116,114,102,105,110,100,
-     40,115, 44, 34, 94, 37,115, 42, 40, 37, 98, 92, 49, 92, 50,
-     41, 34, 41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110,
-     10, 32, 32, 32, 67,111,100,101, 40,115,116,114,115,117, 98,
-     40, 99,111,100,101, 44, 50, 44, 45, 50, 41, 41, 10, 32, 32,
-     32,114,101,116,117,114,110, 32,115,116,114,115,117, 98, 40,
-    115, 44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101,
-    110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32, 67, 32, 99,
-    111,100,101, 10, 32,100,111, 10, 32, 32,108,111, 99, 97,108,
-     32, 98, 44,101, 44, 99,111,100,101, 32, 61, 32,115,116,114,
-    102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 37, 98,
-     92, 51, 92, 52, 41, 34, 41, 10, 32, 32,105,102, 32, 98, 32,
-    116,104,101,110, 10,  9, 99,111,100,101, 32, 61, 32, 39,123,
-     39, 46, 46,115,116,114,115,117, 98, 40, 99,111,100,101, 44,
-     50, 44, 45, 50, 41, 46, 46, 39, 92,110,125, 92,110, 39, 10,
-      9, 86,101,114, 98, 97,116,105,109, 40, 99,111,100,101, 44,
-     39,114, 39, 41, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 32,
-    118,101,114, 98, 97,116,105,109, 32, 99,111,100,101, 32,102,
-    111,114, 32, 39,114, 39,101,103,105,115,116,101,114, 32,102,
-    114, 97,103,109,101,110,116, 10,  9,114,101,116,117,114,110,
-     32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10,
-     32, 32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45,
-     32,116,114,121, 32, 67, 32, 99,111,100,101, 32,102,111,114,
-     32,112,114,101, 97,109, 98,108,101, 32,115,101, 99,116,105,
-    111,110, 10, 32,100,111, 10, 32,  9,108,111, 99, 97,108, 32,
-     98, 44,101, 44, 99,111,100,101, 32, 61, 32,115,116,114,105,
-    110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 94, 37,115,
-     42, 40, 37, 98, 92, 53, 92, 54, 41, 34, 41, 10, 32,  9,105,
-    102, 32, 98, 32,116,104,101,110, 10, 32,  9,  9, 99,111,100,
-    101, 32, 61, 32,115,116,114,105,110,103, 46,115,117, 98, 40,
-     99,111,100,101, 44, 32, 50, 44, 32, 45, 50, 41, 46, 46, 34,
-     92,110, 34, 10,  9,  9, 86,101,114, 98, 97,116,105,109, 40,
-     99,111,100,101, 44, 32, 39, 39, 41, 10,  9,  9,114,101,116,
-    117,114,110, 32,115,116,114,105,110,103, 46,115,117, 98, 40,
-    115, 44, 32,101, 43, 49, 41, 10, 32,  9,101,110,100, 10, 32,
-    101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32,100,101,
-    102, 97,117,108,116, 95,112,114,111,112,101,114,116,121, 32,
-    100,105,114,101, 99,116,105,118,101, 10, 32,100,111, 10, 32,
-      9,108,111, 99, 97,108, 32, 98, 44,101, 44,112,116,121,112,
-    101, 32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 32,
-     34, 94, 37,115, 42, 84, 79, 76, 85, 65, 95, 80, 82, 79, 80,
-     69, 82, 84, 89, 95, 84, 89, 80, 69, 37,115, 42, 37, 40, 43,
-     37,115, 42, 40, 91, 94, 37, 41, 37,115, 93, 42, 41, 37,115,
-     42, 37, 41, 43, 37,115, 42, 59, 63, 34, 41, 10, 32,  9,105,
-    102, 32, 98, 32,116,104,101,110, 10, 32,  9,  9,105,102, 32,
-    110,111,116, 32,112,116,121,112,101, 32,111,114, 32,112,116,
-    121,112,101, 32, 61, 61, 32, 34, 34, 32,116,104,101,110, 10,
-     32,  9,  9,  9,112,116,121,112,101, 32, 61, 32, 34,100,101,
-    102, 97,117,108,116, 34, 10, 32,  9,  9,101,110,100, 10, 32,
-      9,  9,115,101,108,102, 58,115,101,116, 95,112,114,111,112,
-    101,114,116,121, 95,116,121,112,101, 40,112,116,121,112,101,
-     41, 10,  9, 32,  9,114,101,116,117,114,110, 32,115,116,114,
-    115,117, 98, 40,115, 44, 32,101, 43, 49, 41, 10, 32,  9,101,
-    110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,
-    121, 32,112,114,111,116,101, 99,116,101,100, 95,100,101,115,
-    116,114,117, 99,116,111,114, 32,100,105,114,101, 99,116,105,
-    118,101, 10, 32,100,111, 10, 32,  9,108,111, 99, 97,108, 32,
-     98, 44,101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,
-    110,100, 40,115, 44, 32, 34, 94, 37,115, 42, 84, 79, 76, 85,
-     65, 95, 80, 82, 79, 84, 69, 67, 84, 69, 68, 95, 68, 69, 83,
-     84, 82, 85, 67, 84, 79, 82, 37,115, 42, 59, 63, 34, 41, 10,
-      9,105,102, 32, 98, 32,116,104,101,110, 10,  9,  9,105,102,
-     32,115,101,108,102, 46,115,101,116, 95,112,114,111,116,101,
-     99,116,101,100, 95,100,101,115,116,114,117, 99,116,111,114,
-     32,116,104,101,110, 10,  9, 32,  9,  9,115,101,108,102, 58,
-    115,101,116, 95,112,114,111,116,101, 99,116,101,100, 95,100,
-    101,115,116,114,117, 99,116,111,114, 40,116,114,117,101, 41,
-     10,  9, 32,  9,101,110,100, 10, 32,  9,  9,114,101,116,117,
-    114,110, 32,115,116,114,115,117, 98, 40,115, 44, 32,101, 43,
-     49, 41, 10, 32,  9,101,110,100, 10, 32,101,110,100, 10, 10,
-     32, 45, 45, 32,116,114,121, 32, 39,101,120,116,101,114,110,
-     39, 32,107,101,121,119,111,114,100, 10, 32,100,111, 10, 32,
-      9,108,111, 99, 97,108, 32, 98, 44,101, 32, 61, 32,115,116,
-    114,105,110,103, 46,102,105,110,100, 40,115, 44, 32, 34, 94,
-     37,115, 42,101,120,116,101,114,110, 37,115, 43, 34, 41, 10,
-     32,  9,105,102, 32, 98, 32,116,104,101,110, 10,  9,  9, 45,
-     45, 32,100,111, 32,110,111,116,104,105,110,103, 10, 32,  9,
-      9,114,101,116,117,114,110, 32,115,116,114,115,117, 98, 40,
-    115, 44, 32,101, 43, 49, 41, 10, 32,  9,101,110,100, 10, 32,
-    101,110,100, 10,  9, 10, 32, 45, 45, 32,116,114,121, 32, 39,
-    118,105,114,116,117, 97,108, 39, 32,107,101,121,119,111,114,
-    107,100, 10, 32,100,111, 10, 32,  9,108,111, 99, 97,108, 32,
-     98, 44,101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,
-    110,100, 40,115, 44, 32, 34, 94, 37,115, 42,118,105,114,116,
-    117, 97,108, 37,115, 43, 34, 41, 10, 32,  9,105,102, 32, 98,
-     32,116,104,101,110, 10, 32,  9,  9,109,101,116,104,111,100,
-    105,115,118,105,114,116,117, 97,108, 32, 61, 32,116,114,117,
-    101, 10, 32,  9,  9,114,101,116,117,114,110, 32,115,116,114,
-    115,117, 98, 40,115, 44, 32,101, 43, 49, 41, 10, 32,  9,101,
-    110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,116,114,
-    121, 32,108, 97, 98,101,108,115, 32, 40,112,117, 98,108,105,
-     99, 44, 32,112,114,105,118, 97,116,101, 44, 32,101,116, 99,
-     41, 10, 32,100,111, 10, 32,  9,108,111, 99, 97,108, 32, 98,
-     44,101, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,
-    100, 40,115, 44, 32, 34, 94, 37,115, 42, 37,119, 42, 37,115,
-     42, 58, 91, 94, 58, 93, 34, 41, 10, 32,  9,105,102, 32, 98,
-     32,116,104,101,110, 10, 32,  9,  9,114,101,116,117,114,110,
-     32,115,116,114,115,117, 98, 40,115, 44, 32,101, 41, 32, 45,
-     45, 32,112,114,101,115,101,114,118,101, 32,116,104,101, 32,
-     91, 94, 58, 93, 10, 32,  9,101,110,100, 10, 32,101,110,100,
-     10, 10, 32, 45, 45, 32,116,114,121, 32,109,111,100,117,108,
-    101, 10, 32,100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98,
-     44,101, 44,110, 97,109,101, 44, 98,111,100,121, 32, 61, 32,
-    115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42,
-    109,111,100,117,108,101, 37,115, 37,115, 42, 40, 91, 95, 37,
-    119, 93, 91, 95, 37,119, 93, 42, 41, 37,115, 42, 40, 37, 98,
-    123,125, 41, 37,115, 42, 34, 41, 10, 32, 32,105,102, 32, 98,
-     32,116,104,101,110, 10, 32, 32, 32, 95, 99,117,114,114, 95,
-     99,111,100,101, 32, 61, 32,115,116,114,115,117, 98, 40,115,
-     44, 98, 44,101, 41, 10, 32, 32, 32, 77,111,100,117,108,101,
-     40,110, 97,109,101, 44, 98,111,100,121, 41, 10, 32, 32, 32,
-    114,101,116,117,114,110, 32,115,116,114,115,117, 98, 40,115,
-     44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101,110,
-    100, 10, 10, 32, 45, 45, 32,116,114,121, 32,110, 97,109,101,
-    115, 97,112, 99,101, 10, 32,100,111, 10, 32, 32,108,111, 99,
-     97,108, 32, 98, 44,101, 44,110, 97,109,101, 44, 98,111,100,
-    121, 32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34,
-     94, 37,115, 42,110, 97,109,101,115,112, 97, 99,101, 37,115,
-     37,115, 42, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 93, 42,
-     41, 37,115, 42, 40, 37, 98,123,125, 41, 37,115, 42, 59, 63,
-     34, 41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, 10,
-     32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32, 61,
-     32,115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10,
-     32, 32, 32, 78, 97,109,101,115,112, 97, 99,101, 40,110, 97,
-    109,101, 44, 98,111,100,121, 41, 10, 32, 32, 32,114,101,116,
-    117,114,110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43,
-     49, 41, 10, 32, 32,101,110,100, 10, 32,101,110,100, 10, 10,
-     32, 45, 45, 32,116,114,121, 32,100,101,102,105,110,101, 10,
-     32,100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101,
-     44,110, 97,109,101, 32, 61, 32,115,116,114,102,105,110,100,
-     40,115, 44, 34, 94, 37,115, 42, 35,100,101,102,105,110,101,
-     37,115, 37,115, 42, 40, 91, 94, 37,115, 93, 42, 41, 91, 94,
-     92,110, 93, 42, 92,110, 37,115, 42, 34, 41, 10, 32, 32,105,
-    102, 32, 98, 32,116,104,101,110, 10, 32, 32, 32, 95, 99,117,
-    114,114, 95, 99,111,100,101, 32, 61, 32,115,116,114,115,117,
-     98, 40,115, 44, 98, 44,101, 41, 10, 32, 32, 32, 68,101,102,
-    105,110,101, 40,110, 97,109,101, 41, 10, 32, 32, 32,114,101,
-    116,117,114,110, 32,115,116,114,115,117, 98, 40,115, 44,101,
-     43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101,110,100, 10,
-     10, 32, 45, 45, 32,116,114,121, 32,101,110,117,109,101,114,
-     97,116,101,115, 10, 10, 32,100,111, 10, 32, 32,108,111, 99,
-     97,108, 32, 98, 44,101, 44,110, 97,109,101, 44, 98,111,100,
-    121, 44,118, 97,114,110, 97,109,101, 32, 61, 32,115,116,114,
-    102,105,110,100, 40,115, 44, 34, 94, 37,115, 42,101,110,117,
-    109, 37,115, 43, 40, 37, 83, 42, 41, 37,115, 42, 40, 37, 98,
-    123,125, 41, 37,115, 42, 40, 91, 94, 37,115, 59, 93, 42, 41,
-     37,115, 42, 59, 63, 37,115, 42, 34, 41, 10, 32, 32,105,102,
-     32, 98, 32,116,104,101,110, 10, 32, 32, 32, 45, 45,101,114,
-    114,111,114, 40, 34, 35, 83,111,114,114,121, 44, 32,100,101,
-     99,108, 97,114, 97,116,105,111,110, 32,111,102, 32,101,110,
-    117,109,115, 32, 97,110,100, 32,118, 97,114,105, 97, 98,108,
-    101,115, 32,111,110, 32,116,104,101, 32,115, 97,109,101, 32,
-    115,116, 97,116,101,109,101,110,116, 32,105,115, 32,110,111,
-    116, 32,115,117,112,112,111,114,116,101,100, 46, 92,110, 68,
-    101, 99,108, 97,114,101, 32,121,111,117,114, 32,118, 97,114,
-    105, 97, 98,108,101, 32,115,101,112, 97,114, 97,116,101,108,
-    121, 32, 40,101,120, 97,109,112,108,101, 58, 32, 39, 34, 46,
-     46,110, 97,109,101, 46, 46, 34, 32, 34, 46, 46,118, 97,114,
-    110, 97,109,101, 46, 46, 34, 59, 39, 41, 34, 41, 10, 32, 32,
-     32, 95, 99,117,114,114, 95, 99,111,100,101, 32, 61, 32,115,
-    116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10, 32, 32,
-     32, 69,110,117,109,101,114, 97,116,101, 40,110, 97,109,101,
-     44, 98,111,100,121, 44,118, 97,114,110, 97,109,101, 41, 10,
-     32, 32, 32,114,101,116,117,114,110, 32,115,116,114,115,117,
-     98, 40,115, 44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10,
-     32,101,110,100, 10, 10, 45, 45, 32,100,111, 10, 45, 45, 32,
-     32,108,111, 99, 97,108, 32, 98, 44,101, 44,110, 97,109,101,
-     44, 98,111,100,121, 32, 61, 32,115,116,114,102,105,110,100,
-     40,115, 44, 34, 94, 37,115, 42,101,110,117,109, 37,115, 43,
-     40, 37, 83, 42, 41, 37,115, 42, 40, 37, 98,123,125, 41, 37,
-    115, 42, 59, 63, 37,115, 42, 34, 41, 10, 45, 45, 32, 32,105,
-    102, 32, 98, 32,116,104,101,110, 10, 45, 45, 32, 32, 32, 95,
-     99,117,114,114, 95, 99,111,100,101, 32, 61, 32,115,116,114,
-    115,117, 98, 40,115, 44, 98, 44,101, 41, 10, 45, 45, 32, 32,
-     32, 69,110,117,109,101,114, 97,116,101, 40,110, 97,109,101,
-     44, 98,111,100,121, 41, 10, 45, 45, 32, 32,114,101,116,117,
-    114,110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49,
-     41, 10, 45, 45, 32, 32,101,110,100, 10, 45, 45, 32,101,110,
-    100, 10, 10, 32,100,111, 10, 32, 32,108,111, 99, 97,108, 32,
-     98, 44,101, 44, 98,111,100,121, 44,110, 97,109,101, 32, 61,
-     32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115,
-     42,116,121,112,101,100,101,102, 37,115, 43,101,110,117,109,
-     91, 94,123, 93, 42, 40, 37, 98,123,125, 41, 37,115, 42, 40,
-     91, 37,119, 95, 93, 91, 94, 37,115, 93, 42, 41, 37,115, 42,
-     59, 37,115, 42, 34, 41, 10, 32, 32,105,102, 32, 98, 32,116,
-    104,101,110, 10, 32, 32, 32, 95, 99,117,114,114, 95, 99,111,
-    100,101, 32, 61, 32,115,116,114,115,117, 98, 40,115, 44, 98,
-     44,101, 41, 10, 32, 32, 32, 69,110,117,109,101,114, 97,116,
-    101, 40,110, 97,109,101, 44, 98,111,100,121, 41, 10, 32, 32,
-     32,114,101,116,117,114,110, 32,115,116,114,115,117, 98, 40,
-    115, 44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101,
-    110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32,111,112,101,
-    114, 97,116,111,114, 10, 32,100,111, 10, 32, 32,108,111, 99,
-     97,108, 32, 98, 44,101, 44,100,101, 99,108, 44,107,105,110,
-    100, 44, 97,114,103, 44, 99,111,110,115,116, 32, 61, 32,115,
-    116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, 40,
-     91, 95, 37,119, 93, 91, 95, 37,119, 37,115, 37, 42, 38, 58,
-     60, 62, 44, 93, 45, 37,115, 43,111,112,101,114, 97,116,111,
-    114, 41, 37,115, 42, 40, 91, 94, 37,115, 93, 91, 94, 37,115,
-     93, 42, 41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42,
-     40, 99, 63,111, 63,110, 63,115, 63,116, 63, 41, 37,115, 42,
-     59, 37,115, 42, 34, 41, 10, 32, 32,105,102, 32,110,111,116,
-     32, 98, 32,116,104,101,110, 10,  9,  9, 32, 45, 45, 32,116,
-    114,121, 32,105,110,108,105,110,101, 10, 32, 32, 32, 98, 44,
-    101, 44,100,101, 99,108, 44,107,105,110,100, 44, 97,114,103,
-     44, 99,111,110,115,116, 32, 61, 32,115,116,114,102,105,110,
-    100, 40,115, 44, 34, 94, 37,115, 42, 40, 91, 95, 37,119, 93,
-     91, 95, 37,119, 37,115, 37, 42, 38, 58, 60, 62, 44, 93, 45,
-     37,115, 43,111,112,101,114, 97,116,111,114, 41, 37,115, 42,
-     40, 91, 94, 37,115, 93, 91, 94, 37,115, 93, 42, 41, 37,115,
-     42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111, 63,
-    110, 63,115, 63,116, 63, 41, 91, 37,115, 92,110, 93, 42, 37,
-     98,123,125, 37,115, 42, 59, 63, 37,115, 42, 34, 41, 10, 32,
-     32,101,110,100, 10, 32, 32,105,102, 32,110,111,116, 32, 98,
-     32,116,104,101,110, 10, 32, 32,  9, 45, 45, 32,116,114,121,
-     32, 99, 97,115,116, 32,111,112,101,114, 97,116,111,114, 10,
-     32, 32,  9, 98, 44,101, 44,100,101, 99,108, 44,107,105,110,
-    100, 44, 97,114,103, 44, 99,111,110,115,116, 32, 61, 32,115,
-    116,114,102,105,110,100, 40,115, 44, 32, 34, 94, 37,115, 42,
-     40,111,112,101,114, 97,116,111,114, 41, 37,115, 43, 40, 91,
-     37,119, 95, 58, 37,100, 60, 62, 37, 42, 37, 38, 37,115, 93,
-     43, 41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40,
-     99, 63,111, 63,110, 63,115, 63,116, 63, 41, 34, 41, 59, 10,
-     32, 32,  9,105,102, 32, 98, 32,116,104,101,110, 10, 32, 32,
-      9,  9,108,111, 99, 97,108, 32, 95, 44,105,101, 32, 61, 32,
-    115,116,114,105,110,103, 46,102,105,110,100, 40,115, 44, 32,
-     34, 94, 37,115, 42, 37, 98,123,125, 34, 44, 32,101, 43, 49,
-     41, 10, 32, 32,  9,  9,105,102, 32,105,101, 32,116,104,101,
-    110, 10, 32, 32,  9,  9,  9,101, 32, 61, 32,105,101, 10, 32,
-     32,  9,  9,101,110,100, 10, 32, 32,  9,101,110,100, 10, 32,
-     32,101,110,100, 10, 32, 32,105,102, 32, 98, 32,116,104,101,
-    110, 10, 32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,101,
-     32, 61, 32,115,116,114,115,117, 98, 40,115, 44, 98, 44,101,
-     41, 10, 32, 32, 32, 79,112,101,114, 97,116,111,114, 40,100,
-    101, 99,108, 44,107,105,110,100, 44, 97,114,103, 44, 99,111,
-    110,115,116, 41, 10, 32, 32, 32,114,101,116,117,114,110, 32,
-    115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32,
-     32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32,
-    116,114,121, 32,102,117,110, 99,116,105,111,110, 10, 32,100,
-    111, 10, 32, 32, 45, 45,108,111, 99, 97,108, 32, 98, 44,101,
-     44,100,101, 99,108, 44, 97,114,103, 44, 99,111,110,115,116,
-     32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94,
-     37,115, 42, 40, 91,126, 95, 37,119, 93, 91, 95, 64, 37,119,
-     37,115, 37, 42, 38, 58, 60, 62, 93, 42, 91, 95, 37,119, 93,
-     41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99,
-     63,111, 63,110, 63,115, 63,116, 63, 41, 37,115, 42, 61, 63,
-     37,115, 42, 48, 63, 37,115, 42, 59, 37,115, 42, 34, 41, 10,
-     32, 32,108,111, 99, 97,108, 32, 98, 44,101, 44,100,101, 99,
-    108, 44, 97,114,103, 44, 99,111,110,115,116, 44,118,105,114,
-    116, 32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 34,
-     94, 37,115, 42, 40, 91, 94, 37, 40, 92,110, 93, 43, 41, 37,
-    115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,111,
-     63,110, 63,115, 63,116, 63, 41, 37,115, 42, 40, 61, 63, 37,
-    115, 42, 48, 63, 41, 37,115, 42, 59, 37,115, 42, 34, 41, 10,
-     32, 32,105,102, 32,110,111,116, 32, 98, 32,116,104,101,110,
-     10, 32, 32,  9, 45, 45, 32,116,114,121, 32,102,117,110, 99,
-    116,105,111,110, 32,119,105,116,104, 32,116,101,109,112,108,
-     97,116,101, 10, 32, 32,  9, 98, 44,101, 44,100,101, 99,108,
-     44, 97,114,103, 44, 99,111,110,115,116, 32, 61, 32,115,116,
-    114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 91,
-    126, 95, 37,119, 93, 91, 95, 64, 37,119, 37,115, 37, 42, 38,
-     58, 60, 62, 93, 42, 91, 95, 37,119, 93, 37, 98, 60, 62, 41,
-     37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99, 63,
-    111, 63,110, 63,115, 63,116, 63, 41, 37,115, 42, 61, 63, 37,
-    115, 42, 48, 63, 37,115, 42, 59, 37,115, 42, 34, 41, 10, 32,
-     32,101,110,100, 10, 32, 32,105,102, 32,110,111,116, 32, 98,
-     32,116,104,101,110, 10, 32, 32, 32, 45, 45, 32,116,114,121,
-     32, 97, 32,115,105,110,103,108,101, 32,108,101,116,116,101,
-    114, 32,102,117,110, 99,116,105,111,110, 32,110, 97,109,101,
-     10, 32, 32, 32, 98, 44,101, 44,100,101, 99,108, 44, 97,114,
-    103, 44, 99,111,110,115,116, 32, 61, 32,115,116,114,102,105,
-    110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 91, 95, 37,119,
-     93, 41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40,
-     99, 63,111, 63,110, 63,115, 63,116, 63, 41, 37,115, 42, 59,
-     37,115, 42, 34, 41, 10, 32, 32,101,110,100, 10, 32, 32,105,
-    102, 32, 98, 32,116,104,101,110, 10, 32, 32,  9,105,102, 32,
-    118,105,114,116, 32, 97,110,100, 32,115,116,114,105,110,103,
-     46,102,105,110,100, 40,118,105,114,116, 44, 32, 34, 91, 61,
-     48, 93, 34, 41, 32,116,104,101,110, 10, 32, 32,  9,  9,105,
-    102, 32,115,101,108,102, 46,102,108, 97,103,115, 32,116,104,
-    101,110, 10, 32, 32,  9,  9,  9,115,101,108,102, 46,102,108,
-     97,103,115, 46,112,117,114,101, 95,118,105,114,116,117, 97,
-    108, 32, 61, 32,116,114,117,101, 10, 32, 32,  9,  9,101,110,
-    100, 10, 32, 32,  9,101,110,100, 10, 32, 32, 32, 95, 99,117,
-    114,114, 95, 99,111,100,101, 32, 61, 32,115,116,114,115,117,
-     98, 40,115, 44, 98, 44,101, 41, 10, 32, 32, 32, 70,117,110,
-     99,116,105,111,110, 40,100,101, 99,108, 44, 97,114,103, 44,
-     99,111,110,115,116, 41, 10, 32, 32, 32,114,101,116,117,114,
-    110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43, 49, 41,
-     10, 32, 32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45,
-     45, 32,116,114,121, 32,105,110,108,105,110,101, 32,102,117,
-    110, 99,116,105,111,110, 10, 32,100,111, 10, 32, 32,108,111,
-     99, 97,108, 32, 98, 44,101, 44,100,101, 99,108, 44, 97,114,
-    103, 44, 99,111,110,115,116, 32, 61, 32,115,116,114,102,105,
-    110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 91, 94, 37, 40,
-     92,110, 93, 43, 41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,
-    115, 42, 40, 99, 63,111, 63,110, 63,115, 63,116, 63, 41, 91,
-     94, 59,123, 93, 42, 37, 98,123,125, 37,115, 42, 59, 63, 37,
-    115, 42, 34, 41, 10, 32, 32, 45, 45,108,111, 99, 97,108, 32,
-     98, 44,101, 44,100,101, 99,108, 44, 97,114,103, 44, 99,111,
-    110,115,116, 32, 61, 32,115,116,114,102,105,110,100, 40,115,
-     44, 34, 94, 37,115, 42, 40, 91,126, 95, 37,119, 93, 91, 95,
-     64, 37,119, 37,115, 37, 42, 38, 58, 60, 62, 93, 42, 91, 95,
-     37,119, 62, 93, 41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,
-    115, 42, 40, 99, 63,111, 63,110, 63,115, 63,116, 63, 41, 91,
-     94, 59, 93, 42, 37, 98,123,125, 37,115, 42, 59, 63, 37,115,
-     42, 34, 41, 10, 32, 32,105,102, 32,110,111,116, 32, 98, 32,
-    116,104,101,110, 10, 32, 32, 32, 45, 45, 32,116,114,121, 32,
-     97, 32,115,105,110,103,108,101, 32,108,101,116,116,101,114,
-     32,102,117,110, 99,116,105,111,110, 32,110, 97,109,101, 10,
-     32, 32, 32, 98, 44,101, 44,100,101, 99,108, 44, 97,114,103,
-     44, 99,111,110,115,116, 32, 61, 32,115,116,114,102,105,110,
-    100, 40,115, 44, 34, 94, 37,115, 42, 40, 91, 95, 37,119, 93,
-     41, 37,115, 42, 40, 37, 98, 40, 41, 41, 37,115, 42, 40, 99,
-     63,111, 63,110, 63,115, 63,116, 63, 41, 46, 45, 37, 98,123,
-    125, 37,115, 42, 59, 63, 37,115, 42, 34, 41, 10, 32, 32,101,
-    110,100, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110, 10,
-     32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32, 61,
-     32,115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41, 10,
-     32, 32, 32, 70,117,110, 99,116,105,111,110, 40,100,101, 99,
-    108, 44, 97,114,103, 44, 99,111,110,115,116, 41, 10, 32, 32,
-     32,114,101,116,117,114,110, 32,115,116,114,115,117, 98, 40,
-    115, 44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101,
-    110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32, 99,108, 97,
-    115,115, 10, 32,100,111, 10,  9, 32,108,111, 99, 97,108, 32,
-     98, 44,101, 44,110, 97,109,101, 44, 98, 97,115,101, 44, 98,
-    111,100,121, 10,  9,  9, 98, 97,115,101, 32, 61, 32, 39, 39,
-     32, 98,111,100,121, 32, 61, 32, 39, 39, 10,  9,  9, 98, 44,
-    101, 44,110, 97,109,101, 32, 61, 32,115,116,114,102,105,110,
-    100, 40,115, 44, 34, 94, 37,115, 42, 99,108, 97,115,115, 37,
-    115, 42, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 64, 93, 42,
-     41, 37,115, 42, 59, 34, 41, 32, 32, 45, 45, 32,100,117,109,
-    109,121, 32, 99,108, 97,115,115, 10,  9,  9,105,102, 32,110,
-    111,116, 32, 98, 32,116,104,101,110, 10,  9,  9,  9, 98, 44,
-    101, 44,110, 97,109,101, 32, 61, 32,115,116,114,102,105,110,
-    100, 40,115, 44, 34, 94, 37,115, 42,115,116,114,117, 99,116,
-     37,115, 42, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 64, 93,
-     42, 41, 37,115, 42, 59, 34, 41, 32, 32, 32, 32, 45, 45, 32,
-    100,117,109,109,121, 32,115,116,114,117, 99,116, 10,  9,  9,
-      9,105,102, 32,110,111,116, 32, 98, 32,116,104,101,110, 10,
-      9,  9,  9,  9, 98, 44,101, 44,110, 97,109,101, 44, 98, 97,
-    115,101, 44, 98,111,100,121, 32, 61, 32,115,116,114,102,105,
-    110,100, 40,115, 44, 34, 94, 37,115, 42, 99,108, 97,115,115,
-     37,115, 42, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 64, 93,
-     42, 41, 37,115, 42, 40, 46, 45, 41, 37,115, 42, 40, 37, 98,
-    123,125, 41, 37,115, 42, 59, 37,115, 42, 34, 41, 10,  9,  9,
-      9,  9,105,102, 32,110,111,116, 32, 98, 32,116,104,101,110,
-     10,  9,  9,  9,  9,  9, 98, 44,101, 44,110, 97,109,101, 44,
-     98, 97,115,101, 44, 98,111,100,121, 32, 61, 32,115,116,114,
-    102,105,110,100, 40,115, 44, 34, 94, 37,115, 42,115,116,114,
-    117, 99,116, 37,115, 42, 40, 91, 95, 37,119, 93, 91, 95, 37,
-    119, 64, 93, 42, 41, 37,115, 42, 40, 46, 45, 41, 37,115, 42,
-     40, 37, 98,123,125, 41, 37,115, 42, 59, 37,115, 42, 34, 41,
-     10,  9,  9,  9,  9,  9,105,102, 32,110,111,116, 32, 98, 32,
-    116,104,101,110, 10,  9,  9,  9,  9,  9,  9, 98, 44,101, 44,
-    110, 97,109,101, 44, 98, 97,115,101, 44, 98,111,100,121, 32,
-     61, 32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,
-    115, 42,117,110,105,111,110, 37,115, 42, 40, 91, 95, 37,119,
-     93, 91, 95, 37,119, 64, 93, 42, 41, 37,115, 42, 40, 46, 45,
-     41, 37,115, 42, 40, 37, 98,123,125, 41, 37,115, 42, 59, 37,
-    115, 42, 34, 41, 10,  9,  9,  9,  9,  9,  9,105,102, 32,110,
-    111,116, 32, 98, 32,116,104,101,110, 10,  9,  9,  9,  9,  9,
-      9,  9, 98, 97,115,101, 32, 61, 32, 39, 39, 10,  9,  9,  9,
-      9,  9,  9,  9, 98, 44,101, 44, 98,111,100,121, 44,110, 97,
-    109,101, 32, 61, 32,115,116,114,102,105,110,100, 40,115, 44,
-     34, 94, 37,115, 42,116,121,112,101,100,101,102, 37,115, 37,
-    115, 42,115,116,114,117, 99,116, 37,115, 37,115, 42, 91, 95,
-     37,119, 93, 42, 37,115, 42, 40, 37, 98,123,125, 41, 37,115,
-     42, 40, 91, 95, 37,119, 93, 91, 95, 37,119, 64, 93, 42, 41,
-     37,115, 42, 59, 37,115, 42, 34, 41, 10,  9,  9,  9,  9,  9,
-      9,101,110,100, 10,  9,  9,  9,  9,  9,101,110,100, 10,  9,
-      9,  9,  9,101,110,100, 10,  9,  9,  9,101,110,100, 10,  9,
-      9,101,110,100, 10,  9,  9,105,102, 32, 98, 32,116,104,101,
-    110, 10,  9,  9,  9,105,102, 32, 98, 97,115,101, 32,126, 61,
-     32, 39, 39, 32,116,104,101,110, 10,  9,  9,  9,  9, 98, 97,
-    115,101, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117,
-     98, 40, 98, 97,115,101, 44, 32, 34, 94, 37,115, 42, 58, 37,
-    115, 42, 34, 44, 32, 34, 34, 41, 10,  9,  9,  9,  9, 98, 97,
-    115,101, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117,
-     98, 40, 98, 97,115,101, 44, 32, 34, 37,115, 42,112,117, 98,
-    108,105, 99, 37,115, 42, 34, 44, 32, 34, 34, 41, 10,  9,  9,
-      9,  9, 98, 97,115,101, 32, 61, 32,115,112,108,105,116, 40,
-     98, 97,115,101, 44, 32, 34, 44, 34, 41, 10,  9,  9,  9,  9,
-     45, 45,108,111, 99, 97,108, 32, 98, 44,101, 10,  9,  9,  9,
-      9, 45, 45, 98, 44,101, 44, 98, 97,115,101, 32, 61, 32,115,
-    116,114,102,105,110,100, 40, 98, 97,115,101, 44, 34, 46, 45,
-     40, 91, 95, 37,119, 93, 91, 95, 37,119, 60, 62, 44, 58, 93,
-     42, 41, 36, 34, 41, 10,  9,  9,  9,101,108,115,101, 10,  9,
-      9,  9,  9, 98, 97,115,101, 32, 61, 32,123,125, 10,  9,  9,
-      9,101,110,100, 10,  9,  9,  9, 95, 99,117,114,114, 95, 99,
-    111,100,101, 32, 61, 32,115,116,114,115,117, 98, 40,115, 44,
-     98, 44,101, 41, 10,  9,  9,  9, 67,108, 97,115,115, 40,110,
-     97,109,101, 44, 98, 97,115,101, 44, 98,111,100,121, 41, 10,
-      9,  9,  9,114,101,116,117,114,110, 32,115,116,114,115,117,
-     98, 40,115, 44,101, 43, 49, 41, 10,  9,  9,101,110,100, 10,
-      9,101,110,100, 10, 10, 32, 45, 45, 32,116,114,121, 32,116,
-    121,112,101,100,101,102, 10, 32,100,111, 10, 32, 32,108,111,
-     99, 97,108, 32, 98, 44,101, 44,116,121,112,101,115, 32, 61,
-     32,115,116,114,102,105,110,100, 40,115, 44, 34, 94, 37,115,
-     42,116,121,112,101,100,101,102, 37,115, 37,115, 42, 40, 46,
-     45, 41, 37,115, 42, 59, 37,115, 42, 34, 41, 10, 32, 32,105,
-    102, 32, 98, 32,116,104,101,110, 10, 32, 32, 32, 95, 99,117,
-    114,114, 95, 99,111,100,101, 32, 61, 32,115,116,114,115,117,
-     98, 40,115, 44, 98, 44,101, 41, 10, 32, 32, 32, 84,121,112,
-    101,100,101,102, 40,116,121,112,101,115, 41, 10, 32, 32, 32,
-    114,101,116,117,114,110, 32,115,116,114,115,117, 98, 40,115,
-     44,101, 43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101,110,
-    100, 10, 10, 32, 45, 45, 32,116,114,121, 32,118, 97,114,105,
-     97, 98,108,101, 10, 32,100,111, 10, 32, 32,108,111, 99, 97,
-    108, 32, 98, 44,101, 44,100,101, 99,108, 32, 61, 32,115,116,
-    114,102,105,110,100, 40,115, 44, 34, 94, 37,115, 42, 40, 91,
-     95, 37,119, 93, 91, 95, 64, 37,115, 37,119, 37,100, 37, 42,
-     38, 58, 60, 62, 44, 93, 42, 91, 95, 37,119, 37,100, 93, 41,
-     37,115, 42, 59, 37,115, 42, 34, 41, 10, 32, 32,105,102, 32,
-     98, 32,116,104,101,110, 10, 32, 32, 32, 95, 99,117,114,114,
-     95, 99,111,100,101, 32, 61, 32,115,116,114,115,117, 98, 40,
-    115, 44, 98, 44,101, 41, 10, 10,  9,108,111, 99, 97,108, 32,
-    108,105,115,116, 32, 61, 32,115,112,108,105,116, 95, 99, 95,
-    116,111,107,101,110,115, 40,100,101, 99,108, 44, 32, 34, 44,
-     34, 41, 10,  9, 86, 97,114,105, 97, 98,108,101, 40,108,105,
-    115,116, 91, 49, 93, 41, 10,  9,105,102, 32,108,105,115,116,
-     46,110, 32, 62, 32, 49, 32,116,104,101,110, 10,  9,  9,108,
-    111, 99, 97,108, 32, 95, 44, 95, 44,116,121,112,101, 32, 61,
-     32,115,116,114,102,105,110,100, 40,108,105,115,116, 91, 49,
-     93, 44, 32, 34, 40, 46, 45, 41, 37,115, 43, 40, 91, 94, 37,
-    115, 93, 42, 41, 36, 34, 41, 59, 10, 10,  9,  9,108,111, 99,
-     97,108, 32,105, 32, 61, 50, 59, 10,  9,  9,119,104,105,108,
-    101, 32,108,105,115,116, 91,105, 93, 32,100,111, 10,  9,  9,
-      9, 86, 97,114,105, 97, 98,108,101, 40,116,121,112,101, 46,
-     46, 34, 32, 34, 46, 46,108,105,115,116, 91,105, 93, 41, 10,
-      9,  9,  9,105, 61,105, 43, 49, 10,  9,  9,101,110,100, 10,
-      9,101,110,100, 10, 32, 32, 32, 45, 45, 86, 97,114,105, 97,
-     98,108,101, 40,100,101, 99,108, 41, 10, 32, 32, 32,114,101,
-    116,117,114,110, 32,115,116,114,115,117, 98, 40,115, 44,101,
-     43, 49, 41, 10, 32, 32,101,110,100, 10, 32,101,110,100, 10,
-     10,  9, 45, 45, 32,116,114,121, 32,115,116,114,105,110,103,
-     10, 32,100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,
-    101, 44,100,101, 99,108, 32, 61, 32,115,116,114,102,105,110,
-    100, 40,115, 44, 34, 94, 37,115, 42, 40, 91, 95, 37,119, 93,
-     63, 91, 95, 37,115, 37,119, 37,100, 93, 45, 99,104, 97,114,
-     37,115, 43, 91, 95, 64, 37,119, 37,100, 93, 42, 37,115, 42,
-     37, 91, 37,115, 42, 37, 83, 43, 37,115, 42, 37, 93, 41, 37,
-    115, 42, 59, 37,115, 42, 34, 41, 10, 32, 32,105,102, 32, 98,
-     32,116,104,101,110, 10, 32, 32, 32, 95, 99,117,114,114, 95,
-     99,111,100,101, 32, 61, 32,115,116,114,115,117, 98, 40,115,
-     44, 98, 44,101, 41, 10, 32, 32, 32, 86, 97,114,105, 97, 98,
-    108,101, 40,100,101, 99,108, 41, 10, 32, 32, 32,114,101,116,
-    117,114,110, 32,115,116,114,115,117, 98, 40,115, 44,101, 43,
-     49, 41, 10, 32, 32,101,110,100, 10, 32,101,110,100, 10, 10,
-     32, 45, 45, 32,116,114,121, 32, 97,114,114, 97,121, 10, 32,
-    100,111, 10, 32, 32,108,111, 99, 97,108, 32, 98, 44,101, 44,
-    100,101, 99,108, 32, 61, 32,115,116,114,102,105,110,100, 40,
-    115, 44, 34, 94, 37,115, 42, 40, 91, 95, 37,119, 93, 91, 93,
-     91, 95, 64, 37,115, 37,119, 37,100, 37, 42, 38, 58, 93, 42,
-     91, 93, 95, 37,119, 37,100, 93, 41, 37,115, 42, 59, 37,115,
-     42, 34, 41, 10, 32, 32,105,102, 32, 98, 32,116,104,101,110,
-     10, 32, 32, 32, 95, 99,117,114,114, 95, 99,111,100,101, 32,
-     61, 32,115,116,114,115,117, 98, 40,115, 44, 98, 44,101, 41,
-     10, 32, 32, 32, 65,114,114, 97,121, 40,100,101, 99,108, 41,
-     10, 32, 32, 32,114,101,116,117,114,110, 32,115,116,114,115,
-    117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, 32,101,110,100,
-     10, 32,101,110,100, 10, 10, 32, 45, 45, 32,110,111, 32,109,
-     97,116, 99,104,105,110,103, 10, 32,105,102, 32,103,115,117,
-     98, 40,115, 44, 34, 37,115, 37,115, 42, 34, 44, 34, 34, 41,
-     32,126, 61, 32, 34, 34, 32,116,104,101,110, 10, 32, 32, 95,
-     99,117,114,114, 95, 99,111,100,101, 32, 61, 32,115, 10, 32,
-     32,101,114,114,111,114, 40, 34, 35,112, 97,114,115,101, 32,
-    101,114,114,111,114, 34, 41, 10, 32,101,108,115,101, 10, 32,
-     32,114,101,116,117,114,110, 32, 34, 34, 10, 32,101,110,100,
-     10, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110,
-     32, 99,108, 97,115,115, 67,111,110,116, 97,105,110,101,114,
-     58,112, 97,114,115,101, 32, 40,115, 41, 10, 10,  9,115,101,
-    108,102, 46, 99,117,114,114, 95,109,101,109, 98,101,114, 95,
-     97, 99, 99,101,115,115, 32, 61, 32,110,105,108, 10, 10, 32,
-    119,104,105,108,101, 32,115, 32,126, 61, 32, 39, 39, 32,100,
-    111, 10, 32, 32,115, 32, 61, 32,115,101,108,102, 58,100,111,
-    112, 97,114,115,101, 40,115, 41, 10, 32, 32,109,101,116,104,
-    111,100,105,115,118,105,114,116,117, 97,108, 32, 61, 32,102,
-     97,108,115,101, 10, 32,101,110,100, 10,101,110,100, 10, 10,
-     10, 45, 45, 32,112,114,111,112,101,114,116,121, 32,116,121,
-    112,101,115, 10, 10,102,117,110, 99,116,105,111,110, 32,103,
-    101,116, 95,112,114,111,112,101,114,116,121, 95,116,121,112,
-    101, 40, 41, 10, 10,  9,114,101,116,117,114,110, 32, 99,108,
-     97,115,115, 67,111,110,116, 97,105,110,101,114, 46, 99,117,
-    114,114, 58,103,101,116, 95,112,114,111,112,101,114,116,121,
-     95,116,121,112,101, 40, 41, 10,101,110,100, 10, 10,102,117,
-    110, 99,116,105,111,110, 32, 99,108, 97,115,115, 67,111,110,
-    116, 97,105,110,101,114, 58,115,101,116, 95,112,114,111,112,
-    101,114,116,121, 95,116,121,112,101, 40,112,116,121,112,101,
-     41, 10,  9,112,116,121,112,101, 32, 61, 32,115,116,114,105,
-    110,103, 46,103,115,117, 98, 40,112,116,121,112,101, 44, 32,
-     34, 94, 37,115, 42, 34, 44, 32, 34, 34, 41, 10,  9,112,116,
-    121,112,101, 32, 61, 32,115,116,114,105,110,103, 46,103,115,
-    117, 98, 40,112,116,121,112,101, 44, 32, 34, 37,115, 42, 36,
-     34, 44, 32, 34, 34, 41, 10, 10,  9,115,101,108,102, 46,112,
-    114,111,112,101,114,116,121, 95,116,121,112,101, 32, 61, 32,
-    112,116,121,112,101, 10,101,110,100, 10, 10,102,117,110, 99,
-    116,105,111,110, 32, 99,108, 97,115,115, 67,111,110,116, 97,
-    105,110,101,114, 58,103,101,116, 95,112,114,111,112,101,114,
-    116,121, 95,116,121,112,101, 40, 41, 10,  9,114,101,116,117,
-    114,110, 32,115,101,108,102, 46,112,114,111,112,101,114,116,
-    121, 95,116,121,112,101, 32,111,114, 32, 40,115,101,108,102,
-     46,112, 97,114,101,110,116, 32, 97,110,100, 32,115,101,108,
-    102, 46,112, 97,114,101,110,116, 58,103,101,116, 95,112,114,
-    111,112,101,114,116,121, 95,116,121,112,101, 40, 41, 41, 32,
-    111,114, 32, 34,100,101,102, 97,117,108,116, 34, 10,101,110,
-    100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/container.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    45, 45, 32,116,111,108,117, 97, 58, 32,112, 97, 99,107, 97,
-    103,101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,
-    116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,
-    114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,
-    114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32,
-     74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100,
-     58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,
-    100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,116,
-    119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,
-    101,100,105,115,116,114,105, 98,117,116,101, 32,105,116, 32,
-     97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,105,
-    116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119,
-     97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,101,
-    114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,
-    110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115,
-     44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,
-    116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,
-    105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,118,
-    105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,101,
-     44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100, 97,
-    116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,
-    109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,102,
-    105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 10, 45, 45,
-     32, 80, 97, 99,107, 97,103,101, 32, 99,108, 97,115,115, 10,
-     45, 45, 32, 82,101,112,114,101,115,101,110,116,115, 32,116,
-    104,101, 32,119,104,111,108,101, 32,112, 97, 99,107, 97,103,
-    101, 32, 98,101,105,110,103, 32, 98,111,117,110,100, 46, 10,
-     45, 45, 32, 84,104,101, 32,102,111,108,108,111,119,105,110,
-    103, 32,102,105,101,108,100,115, 32, 97,114,101, 32,115,116,
-    111,114,101,100, 58, 10, 45, 45, 32, 32, 32, 32,123,105,125,
-     32, 61, 32,108,105,115,116, 32,111,102, 32,111, 98,106,101,
-     99,116,115, 32,105,110, 32,116,104,101, 32,112, 97, 99,107,
-     97,103,101, 46, 10, 99,108, 97,115,115, 80, 97, 99,107, 97,
-    103,101, 32, 61, 32,123, 10, 32, 99,108, 97,115,115,116,121,
-    112,101, 32, 61, 32, 39,112, 97, 99,107, 97,103,101, 39, 10,
-    125, 10, 99,108, 97,115,115, 80, 97, 99,107, 97,103,101, 46,
-     95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,115,115,
-     80, 97, 99,107, 97,103,101, 10,115,101,116,109,101,116, 97,
-    116, 97, 98,108,101, 40, 99,108, 97,115,115, 80, 97, 99,107,
-     97,103,101, 44, 99,108, 97,115,115, 67,111,110,116, 97,105,
-    110,101,114, 41, 10, 10, 45, 45, 32, 80,114,105,110,116, 32,
-    109,101,116,104,111,100, 10,102,117,110, 99,116,105,111,110,
-     32, 99,108, 97,115,115, 80, 97, 99,107, 97,103,101, 58,112,
-    114,105,110,116, 32, 40, 41, 10, 32,112,114,105,110,116, 40,
-     34, 80, 97, 99,107, 97,103,101, 58, 32, 34, 46, 46,115,101,
-    108,102, 46,110, 97,109,101, 41, 10, 32,108,111, 99, 97,108,
-     32,105, 61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,
-    102, 91,105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 91,
-    105, 93, 58,112,114,105,110,116, 40, 34, 34, 44, 34, 34, 41,
-     10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100,
-     10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,
-     99,108, 97,115,115, 80, 97, 99,107, 97,103,101, 58,112,114,
-    101,112,114,111, 99,101,115,115, 32, 40, 41, 10, 10, 32, 45,
-     45, 32, 97,118,111,105,100, 32,112,114,101,112,114,111, 99,
-    101,115,115,105,110,103, 32,101,109, 98,101,100,100,101,100,
-     32, 76,117, 97, 32, 99,111,100,101, 10, 32,108,111, 99, 97,
-    108, 32, 76, 32, 61, 32,123,125, 10, 32,115,101,108,102, 46,
-     99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,108,
-    102, 46, 99,111,100,101, 44, 34, 92,110, 37,115, 42, 37, 36,
-     37, 91, 34, 44, 34, 92, 49, 34, 41, 32, 45, 45, 32,100,101,
-     97,108, 32,119,105,116,104, 32,101,109, 98,101,100,100,101,
-    100, 32,108,117, 97, 32, 99,111,100,101, 10, 32,115,101,108,
-    102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,
-    101,108,102, 46, 99,111,100,101, 44, 34, 92,110, 37,115, 42,
-     37, 36, 37, 93, 34, 44, 34, 92, 50, 34, 41, 10, 32,115,101,
-    108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,
-    115,101,108,102, 46, 99,111,100,101, 44, 34, 40, 37, 98, 92,
-     49, 92, 50, 41, 34, 44, 32, 32, 32, 32, 32, 32, 32,102,117,
-    110, 99,116,105,111,110, 32, 40, 99, 41, 10, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,116,105,
-    110,115,101,114,116, 40, 76, 44, 99, 41, 10, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101,
-    116,117,114,110, 32, 34, 92,110, 35, 91, 34, 46, 46,103,101,
-    116,110, 40, 76, 41, 46, 46, 34, 93, 35, 34, 10, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,110,
-    100, 41, 10, 32, 45, 45, 32, 97,118,111,105,100, 32,112,114,
-    101,112,114,111, 99,101,115,115,105,110,103, 32,101,109, 98,
-    101,100,100,101,100, 32, 67, 32, 99,111,100,101, 10, 32,108,
-    111, 99, 97,108, 32, 67, 32, 61, 32,123,125, 10, 32,115,101,
-    108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,
-    115,101,108,102, 46, 99,111,100,101, 44, 34, 92,110, 37,115,
-     42, 37, 36, 37, 60, 34, 44, 34, 92, 51, 34, 41, 32, 45, 45,
-     32,100,101, 97,108, 32,119,105,116,104, 32,101,109, 98,101,
-    100,100,101,100, 32, 67, 32, 99,111,100,101, 10, 32,115,101,
-    108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,
-    115,101,108,102, 46, 99,111,100,101, 44, 34, 92,110, 37,115,
-     42, 37, 36, 37, 62, 34, 44, 34, 92, 52, 34, 41, 10, 32,115,
-    101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98,
-     40,115,101,108,102, 46, 99,111,100,101, 44, 34, 40, 37, 98,
-     92, 51, 92, 52, 41, 34, 44, 32, 32, 32, 32, 32, 32, 32,102,
-    117,110, 99,116,105,111,110, 32, 40, 99, 41, 10, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,116,
-    105,110,115,101,114,116, 40, 67, 44, 99, 41, 10, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,
-    101,116,117,114,110, 32, 34, 92,110, 35, 60, 34, 46, 46,103,
-    101,116,110, 40, 67, 41, 46, 46, 34, 62, 35, 34, 10, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,101,
-    110,100, 41, 10, 32, 45, 45, 32, 97,118,111,105,100, 32,112,
-    114,101,112,114,111, 99,101,115,115,105,110,103, 32,101,109,
-     98,101,100,100,101,100, 32, 67, 32, 99,111,100,101, 10, 32,
-    115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117,
-     98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 92,110,
-     37,115, 42, 37, 36, 37,123, 34, 44, 34, 92, 53, 34, 41, 32,
-     45, 45, 32,100,101, 97,108, 32,119,105,116,104, 32,101,109,
-     98,101,100,100,101,100, 32, 67, 32, 99,111,100,101, 10, 32,
-    115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117,
-     98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 92,110,
-     37,115, 42, 37, 36, 37,125, 34, 44, 34, 92, 54, 34, 41, 10,
-     32,115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,
-    117, 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 40,
-     37, 98, 92, 53, 92, 54, 41, 34, 44, 32, 32, 32, 32, 32, 32,
-     32,102,117,110, 99,116,105,111,110, 32, 40, 99, 41, 10, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32,116,105,110,115,101,114,116, 40, 67, 44, 99, 41, 10, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32,114,101,116,117,114,110, 32, 34, 92,110, 35, 60, 34, 46,
-     46,103,101,116,110, 40, 67, 41, 46, 46, 34, 62, 35, 34, 10,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32,101,110,100, 41, 10, 10, 32, 45, 45,115,101,108,102, 46,
-     99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,108,
-    102, 46, 99,111,100,101, 44, 34, 92,110, 37,115, 42, 35, 91,
-     94,100, 93, 91, 94, 92,110, 93, 42, 92,110, 34, 44, 32, 34,
-     92,110, 92,110, 34, 41, 32, 45, 45, 32,101,108,105,109,105,
-    110, 97,116,101, 32,112,114,101,112,114,111, 99,101,115,115,
-    111,114, 32,100,105,114,101, 99,116,105,118,101,115, 32,116,
-    104, 97,116, 32,100,111,110, 39,116, 32,115,116, 97,114,116,
-     32,119,105,116,104, 32, 39,100, 39, 10, 32,115,101,108,102,
-     46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,
-    108,102, 46, 99,111,100,101, 44, 34, 92,110, 91, 32, 92,116,
-     93, 42, 35, 91, 32, 92,116, 93, 42, 91, 94,100, 37, 60, 37,
-     91, 93, 34, 44, 32, 34, 92,110, 47, 47, 34, 41, 32, 45, 45,
-     32,101,108,105,109,105,110, 97,116,101, 32,112,114,101,112,
-    114,111, 99,101,115,115,111,114, 32,100,105,114,101, 99,116,
-    105,118,101,115, 32,116,104, 97,116, 32,100,111,110, 39,116,
-     32,115,116, 97,114,116, 32,119,105,116,104, 32, 39,100, 39,
-     10, 10, 32, 45, 45, 32, 97,118,111,105,100, 32,112,114,101,
-    112,114,111, 99,101,115,115,105,110,103, 32,118,101,114, 98,
-     97,116,105,109, 32,108,105,110,101,115, 10, 32,108,111, 99,
-     97,108, 32, 86, 32, 61, 32,123,125, 10, 32,115,101,108,102,
-     46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,
-    108,102, 46, 99,111,100,101, 44, 34, 92,110, 40, 37,115, 42,
-     37, 36, 91, 94, 37, 91, 37, 93, 93, 91, 94, 92,110, 93, 42,
-     41, 34, 44,102,117,110, 99,116,105,111,110, 32, 40,118, 41,
-     10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32,116,105,110,115,101,114,116, 40, 86, 44,118, 41,
-     10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32,114,101,116,117,114,110, 32, 34, 92,110, 35, 34,
-     46, 46,103,101,116,110, 40, 86, 41, 46, 46, 34, 35, 34, 10,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32,101,110,100, 41, 10, 10, 32, 45, 45, 32,112,101,114,102,
-    111,114,109, 32,103,108,111, 98, 97,108, 32,115,117, 98,115,
-    116,105,116,117,116,105,111,110, 10, 10, 32,115,101,108,102,
-     46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,
-    108,102, 46, 99,111,100,101, 44, 34, 40, 47, 47, 91, 94, 92,
-    110, 93, 42, 41, 34, 44, 34, 34, 41, 32, 32, 32, 32, 32, 45,
-     45, 32,101,108,105,109,105,110, 97,116,101, 32, 67, 43, 43,
-     32, 99,111,109,109,101,110,116,115, 10, 32,115,101,108,102,
-     46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,
-    108,102, 46, 99,111,100,101, 44, 34, 47, 37, 42, 34, 44, 34,
-     92, 49, 34, 41, 10, 32,115,101,108,102, 46, 99,111,100,101,
-     32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,111,
-    100,101, 44, 34, 37, 42, 47, 34, 44, 34, 92, 50, 34, 41, 10,
-     32,115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,
-    117, 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 37,
-     98, 92, 49, 92, 50, 34, 44, 34, 34, 41, 10, 32,115,101,108,
-    102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,
-    101,108,102, 46, 99,111,100,101, 44, 34, 92, 49, 34, 44, 34,
-     47, 37, 42, 34, 41, 10, 32,115,101,108,102, 46, 99,111,100,
-    101, 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,
-    111,100,101, 44, 34, 92, 50, 34, 44, 34, 37, 42, 47, 34, 41,
-     10, 32,115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,
-    115,117, 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34,
-     37,115, 42, 64, 37,115, 42, 34, 44, 34, 64, 34, 41, 32, 45,
-     45, 32,101,108,105,109,105,110, 97,116,101, 32,115,112, 97,
-     99,101,115, 32, 98,101,115,105,100,101, 32, 64, 10, 32,115,
-    101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98,
-     40,115,101,108,102, 46, 99,111,100,101, 44, 34, 37,115, 63,
-    105,110,108,105,110,101, 40, 37,115, 41, 34, 44, 34, 37, 49,
-     34, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101,
-     32, 39,105,110,108,105,110,101, 39, 32,107,101,121,119,111,
-    114,100, 10, 32, 45, 45,115,101,108,102, 46, 99,111,100,101,
-     32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,111,
-    100,101, 44, 34, 37,115, 63,101,120,116,101,114,110, 40, 37,
-    115, 41, 34, 44, 34, 37, 49, 34, 41, 32, 45, 45, 32,101,108,
-    105,109,105,110, 97,116,101, 32, 39,101,120,116,101,114,110,
-     39, 32,107,101,121,119,111,114,100, 10, 32, 45, 45,115,101,
-    108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,
-    115,101,108,102, 46, 99,111,100,101, 44, 34, 37,115, 63,118,
-    105,114,116,117, 97,108, 40, 37,115, 41, 34, 44, 34, 37, 49,
-     34, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101,
-     32, 39,118,105,114,116,117, 97,108, 39, 32,107,101,121,119,
-    111,114,100, 10, 32, 45, 45,115,101,108,102, 46, 99,111,100,
-    101, 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,
-    111,100,101, 44, 34,112,117, 98,108,105, 99, 58, 34, 44, 34,
-     34, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101,
-     32, 39,112,117, 98,108,105, 99, 58, 39, 32,107,101,121,119,
-    111,114,100, 10, 32,115,101,108,102, 46, 99,111,100,101, 32,
-     61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,111,100,
-    101, 44, 34, 40, 91, 94, 37,119, 95, 93, 41,118,111,105,100,
-     37,115, 42, 37, 42, 34, 44, 34, 37, 49, 95,117,115,101,114,
-    100, 97,116, 97, 32, 34, 41, 32, 45, 45, 32,115,117, 98,115,
-    116,105,116,117,116,101, 32, 39,118,111,105,100, 42, 39, 10,
-     32,115,101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,
-    117, 98, 40,115,101,108,102, 46, 99,111,100,101, 44, 34, 40,
-     91, 94, 37,119, 95, 93, 41,118,111,105,100, 37,115, 42, 37,
-     42, 34, 44, 34, 37, 49, 95,117,115,101,114,100, 97,116, 97,
-     32, 34, 41, 32, 45, 45, 32,115,117, 98,115,116,105,116,117,
-    116,101, 32, 39,118,111,105,100, 42, 39, 10, 32,115,101,108,
-    102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,
-    101,108,102, 46, 99,111,100,101, 44, 34, 40, 91, 94, 37,119,
-     95, 93, 41, 99,104, 97,114, 37,115, 42, 37, 42, 34, 44, 34,
-     37, 49, 95, 99,115,116,114,105,110,103, 32, 34, 41, 32, 32,
-     45, 45, 32,115,117, 98,115,116,105,116,117,116,101, 32, 39,
-     99,104, 97,114, 42, 39, 10, 32,115,101,108,102, 46, 99,111,
-    100,101, 32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46,
-     99,111,100,101, 44, 34, 40, 91, 94, 37,119, 95, 93, 41,108,
-    117, 97, 95, 83,116, 97,116,101, 37,115, 42, 37, 42, 34, 44,
-     34, 37, 49, 95,108,115,116, 97,116,101, 32, 34, 41, 32, 32,
-     45, 45, 32,115,117, 98,115,116,105,116,117,116,101, 32, 39,
-    108,117, 97, 95, 83,116, 97,116,101, 42, 39, 10, 10, 32, 45,
-     45, 32,114,101,115,116,111,114,101, 32,101,109, 98,101,100,
-    100,101,100, 32, 76,117, 97, 32, 99,111,100,101, 10, 32,115,
-    101,108,102, 46, 99,111,100,101, 32, 61, 32,103,115,117, 98,
-     40,115,101,108,102, 46, 99,111,100,101, 44, 34, 37, 35, 37,
-     91, 40, 37,100, 43, 41, 37, 93, 37, 35, 34, 44,102,117,110,
-     99,116,105,111,110, 32, 40,110, 41, 10, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,101,116,117,
-    114,110, 32, 76, 91,116,111,110,117,109, 98,101,114, 40,110,
-     41, 93, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32,101,110,100, 41, 10, 32, 45, 45, 32,114,101,115,116,
-    111,114,101, 32,101,109, 98,101,100,100,101,100, 32, 67, 32,
-     99,111,100,101, 10, 32,115,101,108,102, 46, 99,111,100,101,
-     32, 61, 32,103,115,117, 98, 40,115,101,108,102, 46, 99,111,
-    100,101, 44, 34, 37, 35, 37, 60, 40, 37,100, 43, 41, 37, 62,
-     37, 35, 34, 44,102,117,110, 99,116,105,111,110, 32, 40,110,
-     41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32,114,101,116,117,114,110, 32, 67, 91,116,111,110,117,
-    109, 98,101,114, 40,110, 41, 93, 10, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32,101,110,100, 41, 10, 32, 45,
-     45, 32,114,101,115,116,111,114,101, 32,118,101,114, 98, 97,
-    116,105,109, 32,108,105,110,101,115, 10, 32,115,101,108,102,
-     46, 99,111,100,101, 32, 61, 32,103,115,117, 98, 40,115,101,
-    108,102, 46, 99,111,100,101, 44, 34, 37, 35, 40, 37,100, 43,
-     41, 37, 35, 34, 44,102,117,110, 99,116,105,111,110, 32, 40,
-    110, 41, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,114,
-    101,116,117,114,110, 32, 86, 91,116,111,110,117,109, 98,101,
-    114, 40,110, 41, 93, 10, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-     32,101,110,100, 41, 10, 10, 32,115,101,108,102, 46, 99,111,
-    100,101, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117,
-     98, 40,115,101,108,102, 46, 99,111,100,101, 44, 32, 34, 92,
-    110, 37,115, 42, 37, 36, 40, 91, 94, 92,110, 93, 43, 41, 34,
-     44, 32,102,117,110, 99,116,105,111,110, 32, 40,108, 41, 10,
-      9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9, 86,101,114, 98,
-     97,116,105,109, 40,108, 46, 46, 34, 92,110, 34, 41, 10,  9,
-      9,  9,  9,  9,  9,  9,  9,  9,  9,  9,114,101,116,117,114,
-    110, 32, 34, 92,110, 34, 10,  9,  9,  9,  9,  9,  9,  9,  9,
-      9,  9, 32, 32,101,110,100, 41, 10,101,110,100, 10, 10, 45,
-     45, 32,116,114, 97,110,115,108, 97,116,101, 32,118,101,114,
-     98, 97,116,105,109, 10,102,117,110, 99,116,105,111,110, 32,
-     99,108, 97,115,115, 80, 97, 99,107, 97,103,101, 58,112,114,
-    101, 97,109, 98,108,101, 32, 40, 41, 10, 32,111,117,116,112,
-    117,116, 40, 39, 47, 42, 92,110, 39, 41, 10, 32,111,117,116,
-    112,117,116, 40, 39, 42, 42, 32, 76,117, 97, 32, 98,105,110,
-    100,105,110,103, 58, 32, 39, 46, 46,115,101,108,102, 46,110,
-     97,109,101, 46, 46, 39, 92,110, 39, 41, 10, 32,111,117,116,
-    112,117,116, 40, 39, 42, 42, 32, 71,101,110,101,114, 97,116,
-    101,100, 32, 97,117,116,111,109, 97,116,105, 99, 97,108,108,
-    121, 32, 98,121, 32, 39, 46, 46, 84, 79, 76, 85, 65, 95, 86,
-     69, 82, 83, 73, 79, 78, 46, 46, 39, 32,111,110, 32, 39, 46,
-     46,100, 97,116,101, 40, 41, 46, 46, 39, 46, 92,110, 39, 41,
-     10, 32,111,117,116,112,117,116, 40, 39, 42, 47, 92,110, 92,
-    110, 39, 41, 10, 10,  9,111,117,116,112,117,116, 40, 39, 35,
-    105,102,110,100,101,102, 32, 95, 95, 99,112,108,117,115,112,
-    108,117,115, 92,110, 39, 41, 10,  9,111,117,116,112,117,116,
-     40, 39, 35,105,110, 99,108,117,100,101, 32, 34,115,116,100,
-    108,105, 98, 46,104, 34, 92,110, 39, 41, 10,  9,111,117,116,
-    112,117,116, 40, 39, 35,101,110,100,105,102, 92,110, 39, 41,
-     10,  9,111,117,116,112,117,116, 40, 39, 35,105,110, 99,108,
-    117,100,101, 32, 34,115,116,114,105,110,103, 46,104, 34, 92,
-    110, 92,110, 39, 41, 10, 32,111,117,116,112,117,116, 40, 39,
-     35,105,110, 99,108,117,100,101, 32, 34,116,111,108,117, 97,
-     43, 43, 46,104, 34, 92,110, 92,110, 39, 41, 10, 10, 32,105,
-    102, 32,110,111,116, 32,102,108, 97,103,115, 46,104, 32,116,
-    104,101,110, 10, 32, 32,111,117,116,112,117,116, 40, 39, 47,
-     42, 32, 69,120,112,111,114,116,101,100, 32,102,117,110, 99,
-    116,105,111,110, 32, 42, 47, 39, 41, 10, 32, 32,111,117,116,
-    112,117,116, 40, 39, 84, 79, 76, 85, 65, 95, 65, 80, 73, 32,
-    105,110,116, 32, 32,116,111,108,117, 97, 95, 39, 46, 46,115,
-    101,108,102, 46,110, 97,109,101, 46, 46, 39, 95,111,112,101,
-    110, 32, 40,108,117, 97, 95, 83,116, 97,116,101, 42, 32,116,
-    111,108,117, 97, 95, 83, 41, 59, 39, 41, 10, 32, 32,111,117,
-    116,112,117,116, 40, 39, 92,110, 39, 41, 10, 32,101,110,100,
-     10, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,
-    104,105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,111,
-     10, 32, 32,115,101,108,102, 91,105, 93, 58,112,114,101, 97,
-    109, 98,108,101, 40, 41, 10, 32, 32,105, 32, 61, 32,105, 43,
-     49, 10, 32,101,110,100, 10, 10,  9,105,102, 32,115,101,108,
-    102, 58,114,101,113,117,105,114,101, 99,111,108,108,101, 99,
-    116,105,111,110, 40, 95, 99,111,108,108,101, 99,116, 41, 32,
-    116,104,101,110, 10,  9,  9,111,117,116,112,117,116, 40, 39,
-     92,110, 39, 41, 10,  9,  9,111,117,116,112,117,116, 40, 39,
-     47, 42, 32,102,117,110, 99,116,105,111,110, 32,116,111, 32,
-    114,101,108,101, 97,115,101, 32, 99,111,108,108,101, 99,116,
-    101,100, 32,111, 98,106,101, 99,116, 32,118,105, 97, 32,100,
-    101,115,116,114,117, 99,116,111,114, 32, 42, 47, 39, 41, 10,
-      9,  9,111,117,116,112,117,116, 40, 39, 35,105,102,100,101,
-    102, 32, 95, 95, 99,112,108,117,115,112,108,117,115, 92,110,
-     39, 41, 10,  9,  9,102,111,114, 32,105, 44,118, 32,105,110,
-     32,112, 97,105,114,115, 40, 95, 99,111,108,108,101, 99,116,
-     41, 32,100,111, 10,  9,  9, 32,111,117,116,112,117,116, 40,
-     39, 92,110,115,116, 97,116,105, 99, 32,105,110,116, 32, 39,
-     46, 46,118, 46, 46, 39, 32, 40,108,117, 97, 95, 83,116, 97,
-    116,101, 42, 32,116,111,108,117, 97, 95, 83, 41, 39, 41, 10,
-      9,  9,  9,111,117,116,112,117,116, 40, 39,123, 39, 41, 10,
-      9,  9,  9,111,117,116,112,117,116, 40, 39, 32, 39, 46, 46,
-    105, 46, 46, 39, 42, 32,115,101,108,102, 32, 61, 32, 40, 39,
-     46, 46,105, 46, 46, 39, 42, 41, 32,116,111,108,117, 97, 95,
-    116,111,117,115,101,114,116,121,112,101, 40,116,111,108,117,
-     97, 95, 83, 44, 49, 44, 48, 41, 59, 39, 41, 10,  9,  9,  9,
-    111,117,116,112,117,116, 40, 39,  9,100,101,108,101,116,101,
-     32,115,101,108,102, 59, 39, 41, 10,  9,  9,  9,111,117,116,
-    112,117,116, 40, 39,  9,114,101,116,117,114,110, 32, 48, 59,
-     39, 41, 10,  9,  9,  9,111,117,116,112,117,116, 40, 39,125,
-     39, 41, 10,  9,  9,101,110,100, 10,  9,  9,111,117,116,112,
-    117,116, 40, 39, 35,101,110,100,105,102, 92,110, 92,110, 39,
-     41, 10,  9,101,110,100, 10, 10, 32,111,117,116,112,117,116,
-     40, 39, 92,110, 39, 41, 10, 32,111,117,116,112,117,116, 40,
-     39, 47, 42, 32,102,117,110, 99,116,105,111,110, 32,116,111,
-     32,114,101,103,105,115,116,101,114, 32,116,121,112,101, 32,
-     42, 47, 39, 41, 10, 32,111,117,116,112,117,116, 40, 39,115,
-    116, 97,116,105, 99, 32,118,111,105,100, 32,116,111,108,117,
-     97, 95,114,101,103, 95,116,121,112,101,115, 32, 40,108,117,
-     97, 95, 83,116, 97,116,101, 42, 32,116,111,108,117, 97, 95,
-     83, 41, 39, 41, 10, 32,111,117,116,112,117,116, 40, 39,123,
-     39, 41, 10, 32,102,111,114,101, 97, 99,104, 40, 95,117,115,
-    101,114,116,121,112,101, 44,102,117,110, 99,116,105,111,110,
-     40,110, 44,118, 41, 32,111,117,116,112,117,116, 40, 39, 32,
-    116,111,108,117, 97, 95,117,115,101,114,116,121,112,101, 40,
-    116,111,108,117, 97, 95, 83, 44, 34, 39, 44,118, 44, 39, 34,
-     41, 59, 39, 41, 32,101,110,100, 41, 10,  9,105,102, 32,102,
-    108, 97,103,115, 46,116, 32,116,104,101,110, 10,  9,  9,111,
-    117,116,112,117,116, 40, 34, 35,105,102,110,100,101,102, 32,
-     77,116,111,108,117, 97, 95,116,121,112,101,105,100, 92,110,
-     35,100,101,102,105,110,101, 32, 77,116,111,108,117, 97, 95,
-    116,121,112,101,105,100, 40, 76, 44, 84, 73, 44, 84, 41, 92,
-    110, 35,101,110,100,105,102, 92,110, 34, 41, 10,  9,  9,102,
-    111,114,101, 97, 99,104, 40, 95,117,115,101,114,116,121,112,
-    101, 44,102,117,110, 99,116,105,111,110, 40,110, 44,118, 41,
-     32,111,117,116,112,117,116, 40, 39, 32, 77,116,111,108,117,
-     97, 95,116,121,112,101,105,100, 40,116,111,108,117, 97, 95,
-     83, 44,116,121,112,101,105,100, 40, 39, 44,118, 44, 39, 41,
-     44, 32, 34, 39, 44,118, 44, 39, 34, 41, 59, 39, 41, 32,101,
-    110,100, 41, 10,  9,101,110,100, 10, 32,111,117,116,112,117,
-    116, 40, 39,125, 39, 41, 10, 32,111,117,116,112,117,116, 40,
-     39, 92,110, 39, 41, 10,101,110,100, 10, 10, 45, 45, 32,114,
-    101,103,105,115,116,101,114, 32,112, 97, 99,107, 97,103,101,
-     10, 45, 45, 32,119,114,105,116,101, 32,112, 97, 99,107, 97,
-    103,101, 32,111,112,101,110, 32,102,117,110, 99,116,105,111,
-    110, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,
-    115, 80, 97, 99,107, 97,103,101, 58,114,101,103,105,115,116,
-    101,114, 32, 40,112,114,101, 41, 10, 32,112,114,101, 32, 61,
-     32,112,114,101, 32,111,114, 32, 39, 39, 10, 32,112,117,115,
-    104, 40,115,101,108,102, 41, 10, 32,111,117,116,112,117,116,
-     40,112,114,101, 46, 46, 34, 47, 42, 32, 79,112,101,110, 32,
-    102,117,110, 99,116,105,111,110, 32, 42, 47, 34, 41, 10, 32,
-    111,117,116,112,117,116, 40,112,114,101, 46, 46, 34, 84, 79,
-     76, 85, 65, 95, 65, 80, 73, 32,105,110,116, 32,116,111,108,
-    117, 97, 95, 34, 46, 46,115,101,108,102, 46,110, 97,109,101,
-     46, 46, 34, 95,111,112,101,110, 32, 40,108,117, 97, 95, 83,
-    116, 97,116,101, 42, 32,116,111,108,117, 97, 95, 83, 41, 34,
-     41, 10, 32,111,117,116,112,117,116, 40,112,114,101, 46, 46,
-     34,123, 34, 41, 10, 32,111,117,116,112,117,116, 40,112,114,
-    101, 46, 46, 34, 32,116,111,108,117, 97, 95,111,112,101,110,
-     40,116,111,108,117, 97, 95, 83, 41, 59, 34, 41, 10, 32,111,
-    117,116,112,117,116, 40,112,114,101, 46, 46, 34, 32,116,111,
-    108,117, 97, 95,114,101,103, 95,116,121,112,101,115, 40,116,
-    111,108,117, 97, 95, 83, 41, 59, 34, 41, 10, 32,111,117,116,
-    112,117,116, 40,112,114,101, 46, 46, 34, 32,116,111,108,117,
-     97, 95,109,111,100,117,108,101, 40,116,111,108,117, 97, 95,
-     83, 44, 78, 85, 76, 76, 44, 34, 44,115,101,108,102, 58,104,
-     97,115,118, 97,114, 40, 41, 44, 34, 41, 59, 34, 41, 10, 32,
-    111,117,116,112,117,116, 40,112,114,101, 46, 46, 34, 32,116,
-    111,108,117, 97, 95, 98,101,103,105,110,109,111,100,117,108,
-    101, 40,116,111,108,117, 97, 95, 83, 44, 78, 85, 76, 76, 41,
-     59, 34, 41, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10,
-     32,119,104,105,108,101, 32,115,101,108,102, 91,105, 93, 32,
-    100,111, 10, 32, 32,115,101,108,102, 91,105, 93, 58,114,101,
-    103,105,115,116,101,114, 40,112,114,101, 46, 46, 34, 32, 32,
-     34, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,
-    110,100, 10, 32,111,117,116,112,117,116, 40,112,114,101, 46,
-     46, 34, 32,116,111,108,117, 97, 95,101,110,100,109,111,100,
-    117,108,101, 40,116,111,108,117, 97, 95, 83, 41, 59, 34, 41,
-     10, 32,111,117,116,112,117,116, 40,112,114,101, 46, 46, 34,
-     32,114,101,116,117,114,110, 32, 49, 59, 34, 41, 10, 32,111,
-    117,116,112,117,116, 40,112,114,101, 46, 46, 34,125, 34, 41,
-     10, 10, 32,111,117,116,112,117,116, 40, 34, 92,110, 92,110,
-     34, 41, 10, 32,111,117,116,112,117,116, 40, 34, 35,105,102,
-     32,100,101,102,105,110,101,100, 40, 76, 85, 65, 95, 86, 69,
-     82, 83, 73, 79, 78, 95, 78, 85, 77, 41, 32, 38, 38, 32, 76,
-     85, 65, 95, 86, 69, 82, 83, 73, 79, 78, 95, 78, 85, 77, 32,
-     62, 61, 32, 53, 48, 49, 92,110, 34, 41, 59, 10, 32,111,117,
-    116,112,117,116, 40,112,114,101, 46, 46, 34, 84, 79, 76, 85,
-     65, 95, 65, 80, 73, 32,105,110,116, 32,108,117, 97,111,112,
-    101,110, 95, 34, 46, 46,115,101,108,102, 46,110, 97,109,101,
-     46, 46, 34, 32, 40,108,117, 97, 95, 83,116, 97,116,101, 42,
-     32,116,111,108,117, 97, 95, 83, 41, 32,123, 34, 41, 10, 32,
-    111,117,116,112,117,116, 40,112,114,101, 46, 46, 34, 32,114,
-    101,116,117,114,110, 32,116,111,108,117, 97, 95, 34, 46, 46,
-    115,101,108,102, 46,110, 97,109,101, 46, 46, 34, 95,111,112,
-    101,110, 40,116,111,108,117, 97, 95, 83, 41, 59, 34, 41, 10,
-     32,111,117,116,112,117,116, 40,112,114,101, 46, 46, 34,125,
-     59, 34, 41, 10, 32,111,117,116,112,117,116, 40, 34, 35,101,
-    110,100,105,102, 92,110, 92,110, 34, 41, 10, 10,  9,112,111,
-    112, 40, 41, 10,101,110,100, 10, 10, 45, 45, 32,119,114,105,
-    116,101, 32,104,101, 97,100,101,114, 32,102,105,108,101, 10,
-    102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 80,
-     97, 99,107, 97,103,101, 58,104,101, 97,100,101,114, 32, 40,
-     41, 10, 32,111,117,116,112,117,116, 40, 39, 47, 42, 92,110,
-     39, 41, 32,111,117,116,112,117,116, 40, 39, 42, 42, 32, 76,
-    117, 97, 32, 98,105,110,100,105,110,103, 58, 32, 39, 46, 46,
-    115,101,108,102, 46,110, 97,109,101, 46, 46, 39, 92,110, 39,
-     41, 10, 32,111,117,116,112,117,116, 40, 39, 42, 42, 32, 71,
-    101,110,101,114, 97,116,101,100, 32, 97,117,116,111,109, 97,
-    116,105, 99, 97,108,108,121, 32, 98,121, 32, 39, 46, 46, 84,
-     79, 76, 85, 65, 95, 86, 69, 82, 83, 73, 79, 78, 46, 46, 39,
-     32,111,110, 32, 39, 46, 46,100, 97,116,101, 40, 41, 46, 46,
-     39, 46, 92,110, 39, 41, 10, 32,111,117,116,112,117,116, 40,
-     39, 42, 47, 92,110, 92,110, 39, 41, 10, 10, 32,105,102, 32,
-    110,111,116, 32,102,108, 97,103,115, 46,104, 32,116,104,101,
-    110, 10, 32, 32,111,117,116,112,117,116, 40, 39, 47, 42, 32,
-     69,120,112,111,114,116,101,100, 32,102,117,110, 99,116,105,
-    111,110, 32, 42, 47, 39, 41, 10, 32, 32,111,117,116,112,117,
-    116, 40, 39, 84, 79, 76, 85, 65, 95, 65, 80, 73, 32,105,110,
-    116, 32, 32,116,111,108,117, 97, 95, 39, 46, 46,115,101,108,
-    102, 46,110, 97,109,101, 46, 46, 39, 95,111,112,101,110, 32,
-     40,108,117, 97, 95, 83,116, 97,116,101, 42, 32,116,111,108,
-    117, 97, 95, 83, 41, 59, 39, 41, 10, 32, 32,111,117,116,112,
-    117,116, 40, 39, 92,110, 39, 41, 10, 32,101,110,100, 10,101,
-    110,100, 10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108,
-     32, 99,111,110,115,116,114,117, 99,116,111,114, 10,102,117,
-    110, 99,116,105,111,110, 32, 95, 80, 97, 99,107, 97,103,101,
-     32, 40,115,101,108,102, 41, 10, 32,115,101,116,109,101,116,
-     97,116, 97, 98,108,101, 40,115,101,108,102, 44, 99,108, 97,
-    115,115, 80, 97, 99,107, 97,103,101, 41, 10, 32,114,101,116,
-    117,114,110, 32,115,101,108,102, 10,101,110,100, 10, 10, 45,
-     45, 32, 80, 97,114,115,101, 32, 67, 32,104,101, 97,100,101,
-    114, 32,102,105,108,101, 32,119,105,116,104, 32,116,111,108,
-    117, 97, 32,100,105,114,101, 99,116,105,118,101,115, 10, 45,
-     45, 32, 42, 42, 42, 32, 84,104, 97,110,107,115, 32,116,111,
-     32, 65,114,105,101,108, 32, 77, 97,110,122,117,114, 32,102,
-    111,114, 32,102,105,120,105,110,103, 32, 98,117,103,115, 32,
-    105,110, 32,110,101,115,116,101,100, 32,100,105,114,101, 99,
-    116,105,118,101,115, 32, 42, 42, 42, 10,102,117,110, 99,116,
-    105,111,110, 32,101,120,116,114, 97, 99,116, 95, 99,111,100,
-    101, 40,102,110, 44,115, 41, 10,  9,108,111, 99, 97,108, 32,
-     99,111,100,101, 32, 61, 32, 39, 92,110, 36, 35,105,110, 99,
-    108,117,100,101, 32, 34, 39, 46, 46,102,110, 46, 46, 39, 34,
-     92,110, 39, 10,  9,115, 61, 32, 34, 92,110, 34, 32, 46, 46,
-     32,115, 32, 46, 46, 32, 34, 92,110, 34, 32, 45, 45, 32, 97,
-    100,100, 32, 98,108, 97,110,107, 32,108,105,110,101,115, 32,
-     97,115, 32,115,101,110,116,105,110,101,108,115, 10,  9,108,
-    111, 99, 97,108, 32, 95, 44,101, 44, 99, 44,116, 32, 61, 32,
-    115,116,114,102,105,110,100, 40,115, 44, 32, 34, 92,110, 40,
-     91, 94, 92,110, 93, 45, 41, 91, 84,116, 93, 91, 79,111, 93,
-     91, 76,108, 93, 91, 85,117, 93, 91, 65, 97, 93, 95, 40, 91,
-     94, 37,115, 93, 42, 41, 91, 94, 92,110, 93, 42, 92,110, 34,
-     41, 10,  9,119,104,105,108,101, 32,101, 32,100,111, 10,  9,
-      9,116, 32, 61, 32,115,116,114,108,111,119,101,114, 40,116,
-     41, 10,  9,  9,105,102, 32,116, 32, 61, 61, 32, 34, 98,101,
-    103,105,110, 34, 32,116,104,101,110, 10,  9,  9,  9, 95, 44,
-    101, 44, 99, 32, 61, 32,115,116,114,102,105,110,100, 40,115,
-     44, 34, 40, 46, 45, 41, 92,110, 91, 94, 92,110, 93, 42, 91,
-     84,116, 93, 91, 79,111, 93, 91, 76,108, 93, 91, 85,117, 93,
-     91, 65, 97, 93, 95, 91, 69,101, 93, 91, 78,110, 93, 91, 68,
-    100, 93, 91, 94, 92,110, 93, 42, 92,110, 34, 44,101, 41, 10,
-      9,  9,  9,105,102, 32,110,111,116, 32,101, 32,116,104,101,
-    110, 10,  9,  9,  9, 32,116,111,108,117, 97, 95,101,114,114,
-    111,114, 40, 34, 85,110, 98, 97,108, 97,110, 99,101,100, 32,
-     39,116,111,108,117, 97, 95, 98,101,103,105,110, 39, 32,100,
-    105,114,101, 99,116,105,118,101, 32,105,110, 32,104,101, 97,
-    100,101,114, 32,102,105,108,101, 34, 41, 10,  9,  9,  9,101,
-    110,100, 10,  9,  9,101,110,100, 10,  9,  9, 99,111,100,101,
-     32, 61, 32, 99,111,100,101, 32, 46, 46, 32, 99, 32, 46, 46,
-     32, 34, 92,110, 34, 10,  9, 32, 95, 44,101, 44, 99, 44,116,
-     32, 61, 32,115,116,114,102,105,110,100, 40,115, 44, 32, 34,
-     92,110, 40, 91, 94, 92,110, 93, 45, 41, 91, 84,116, 93, 91,
-     79,111, 93, 91, 76,108, 93, 91, 85,117, 93, 91, 65, 97, 93,
-     95, 40, 91, 94, 37,115, 93, 42, 41, 91, 94, 92,110, 93, 42,
-     92,110, 34, 44,101, 41, 10,  9,101,110,100, 10,  9,114,101,
-    116,117,114,110, 32, 99,111,100,101, 10,101,110,100, 10, 10,
-     45, 45, 32, 67,111,110,115,116,114,117, 99,116,111,114, 10,
-     45, 45, 32, 69,120,112,101, 99,116,115, 32,116,104,101, 32,
-    112, 97, 99,107, 97,103,101, 32,110, 97,109,101, 44, 32,116,
-    104,101, 32,102,105,108,101, 32,101,120,116,101,110,115,105,
-    111,110, 44, 32, 97,110,100, 32,116,104,101, 32,102,105,108,
-    101, 32,116,101,120,116, 46, 10,102,117,110, 99,116,105,111,
-    110, 32, 80, 97, 99,107, 97,103,101, 32, 40,110, 97,109,101,
-     44,102,110, 41, 10, 32,108,111, 99, 97,108, 32,101,120,116,
-     32, 61, 32, 34,112,107,103, 34, 10, 10, 32, 45, 45, 32,111,
-    112,101,110, 32,105,110,112,117,116, 32,102,105,108,101, 44,
-     32,105,102, 32, 97,110,121, 10, 32,105,102, 32,102,110, 32,
-    116,104,101,110, 10, 32, 32,108,111, 99, 97,108, 32,115,116,
-     44, 32,109,115,103, 32, 61, 32,114,101, 97,100,102,114,111,
-    109, 40,102,108, 97,103,115, 46,102, 41, 10, 32, 32,105,102,
-     32,110,111,116, 32,115,116, 32,116,104,101,110, 10, 32, 32,
-     32,101,114,114,111,114, 40, 39, 35, 39, 46, 46,109,115,103,
-     41, 10, 32, 32,101,110,100, 10,  9,  9,108,111, 99, 97,108,
-     32, 95, 59, 32, 95, 44, 32, 95, 44, 32,101,120,116, 32, 61,
-     32,115,116,114,102,105,110,100, 40,102,110, 44, 34, 46, 42,
-     37, 46, 40, 46, 42, 41, 36, 34, 41, 10, 32,101,110,100, 10,
-     32,108,111, 99, 97,108, 32, 99,111,100,101, 32, 61, 32, 34,
-     92,110, 34, 32, 46, 46, 32,114,101, 97,100, 40, 39, 42, 97,
-     39, 41, 10,  9,105,102, 32,101,120,116, 32, 61, 61, 32, 39,
-    104, 39, 32,111,114, 32,101,120,116, 32, 61, 61, 32, 39,104,
-    112,112, 39, 32,116,104,101,110, 10,  9, 32, 99,111,100,101,
-     32, 61, 32,101,120,116,114, 97, 99,116, 95, 99,111,100,101,
-     40,102,110, 44, 99,111,100,101, 41, 10,  9,101,110,100, 10,
-     10, 32, 45, 45, 32, 99,108,111,115,101, 32,102,105,108,101,
-     10, 32,105,102, 32,102,110, 32,116,104,101,110, 10, 32, 32,
-    114,101, 97,100,102,114,111,109, 40, 41, 10, 32,101,110,100,
-     10, 10, 32, 45, 45, 32,100,101, 97,108, 32,119,105,116,104,
-     32,105,110, 99,108,117,100,101, 32,100,105,114,101, 99,116,
-    105,118,101, 10, 32,108,111, 99, 97,108, 32,110,115,117, 98,
-    115,116, 10, 32,114,101,112,101, 97,116, 10, 32, 32, 99,111,
-    100,101, 44,110,115,117, 98,115,116, 32, 61, 32,103,115,117,
-     98, 40, 99,111,100,101, 44, 39, 92,110, 37,115, 42, 37, 36,
-     40, 46, 41,102,105,108,101, 37,115, 42, 34, 40, 46, 45, 41,
-     34, 40, 91, 94, 92,110, 93, 42, 41, 92,110, 39, 44, 10,  9,
-      9,102,117,110, 99,116,105,111,110, 32, 40,107,105,110,100,
-     44,102,110, 44,101,120,116,114, 97, 41, 10,  9,  9,  9,108,
-    111, 99, 97,108, 32, 95, 44, 32, 95, 44, 32,101,120,116, 32,
-     61, 32,115,116,114,102,105,110,100, 40,102,110, 44, 34, 46,
-     42, 37, 46, 40, 46, 42, 41, 36, 34, 41, 10,  9,  9,  9,108,
-    111, 99, 97,108, 32,102,112, 44,109,115,103, 32, 61, 32,111,
-    112,101,110,102,105,108,101, 40,102,110, 44, 39,114, 39, 41,
-     10,  9,  9,  9,105,102, 32,110,111,116, 32,102,112, 32,116,
-    104,101,110, 10,  9,  9,  9,  9,101,114,114,111,114, 40, 39,
-     35, 39, 46, 46,109,115,103, 46, 46, 39, 58, 32, 39, 46, 46,
-    102,110, 41, 10,  9,  9,  9,101,110,100, 10,  9,  9,  9,108,
-    111, 99, 97,108, 32,115, 32, 61, 32,114,101, 97,100, 40,102,
-    112, 44, 39, 42, 97, 39, 41, 10,  9,  9,  9, 99,108,111,115,
-    101,102,105,108,101, 40,102,112, 41, 10,  9,  9,  9,105,102,
-     32,107,105,110,100, 32, 61, 61, 32, 39, 99, 39, 32,111,114,
-     32,107,105,110,100, 32, 61, 61, 32, 39,104, 39, 32,116,104,
-    101,110, 10,  9,  9,  9,  9,114,101,116,117,114,110, 32,101,
-    120,116,114, 97, 99,116, 95, 99,111,100,101, 40,102,110, 44,
-    115, 41, 10,  9,  9,  9,101,108,115,101,105,102, 32,107,105,
-    110,100, 32, 61, 61, 32, 39,112, 39, 32,116,104,101,110, 10,
-      9,  9,  9,  9,114,101,116,117,114,110, 32, 34, 92,110, 92,
-    110, 34, 32, 46, 46, 32,115, 10,  9,  9,  9,101,108,115,101,
-    105,102, 32,107,105,110,100, 32, 61, 61, 32, 39,108, 39, 32,
-    116,104,101,110, 10,  9,  9,  9,  9,114,101,116,117,114,110,
-     32, 34, 92,110, 36, 91, 45, 45, 35, 35, 34, 46, 46,102,110,
-     46, 46, 34, 92,110, 34, 32, 46, 46, 32,115, 32, 46, 46, 32,
-     34, 92,110, 36, 93, 92,110, 34, 10,  9,  9,  9,101,108,115,
-    101,105,102, 32,107,105,110,100, 32, 61, 61, 32, 39,105, 39,
-     32,116,104,101,110, 10,  9,  9,  9,  9,108,111, 99, 97,108,
-     32,116, 32, 61, 32,123, 99,111,100,101, 61,115,125, 10,  9,
-      9,  9,  9,101,120,116,114, 97, 32, 61, 32,115,116,114,105,
-    110,103, 46,103,115,117, 98, 40,101,120,116,114, 97, 44, 32,
-     34, 94, 37,115, 42, 44, 37,115, 42, 34, 44, 32, 34, 34, 41,
-     10,  9,  9,  9,  9,108,111, 99, 97,108, 32,112, 97,114,115,
-     32, 61, 32,115,112,108,105,116, 95, 99, 95,116,111,107,101,
-    110,115, 40,101,120,116,114, 97, 44, 32, 34, 44, 34, 41, 10,
-      9,  9,  9,  9,105,110, 99,108,117,100,101, 95,102,105,108,
-    101, 95,104,111,111,107, 40,116, 44, 32,102,110, 44, 32,117,
-    110,112, 97, 99,107, 40,112, 97,114,115, 41, 41, 10,  9,  9,
-      9,  9,114,101,116,117,114,110, 32, 34, 92,110, 92,110, 34,
-     32, 46, 46, 32,116, 46, 99,111,100,101, 10,  9,  9,  9,101,
-    108,115,101, 10,  9,  9,  9,  9,101,114,114,111,114, 40, 39,
-     35, 73,110,118, 97,108,105,100, 32,105,110, 99,108,117,100,
-    101, 32,100,105,114,101, 99,116,105,118,101, 32, 40,117,115,
-    101, 32, 36, 99,102,105,108,101, 44, 32, 36,112,102,105,108,
-    101, 44, 32, 36,108,102,105,108,101, 32,111,114, 32, 36,105,
-    102,105,108,101, 41, 39, 41, 10,  9,  9,  9,101,110,100, 10,
-      9,  9,101,110,100, 41, 10, 32,117,110,116,105,108, 32,110,
-    115,117, 98,115,116, 61, 61, 48, 10, 10, 32, 45, 45, 32,100,
-    101, 97,108, 32,119,105,116,104, 32,114,101,110, 97,109,105,
-    110,103, 32,100,105,114,101, 99,116,105,118,101, 10, 32,114,
-    101,112,101, 97,116, 32, 45, 45, 32, 73, 32,100,111,110, 39,
-    116, 32,107,110,111,119, 32,119,104,121, 32,116,104,105,115,
-     32,105,115, 32,110,101, 99,101,115, 97,114,121, 10,  9, 99,
-    111,100,101, 44,110,115,117, 98,115,116, 32, 61, 32,103,115,
-    117, 98, 40, 99,111,100,101, 44, 39, 92,110, 37,115, 42, 37,
-     36,114,101,110, 97,109,105,110,103, 37,115, 42, 40, 46, 45,
-     41, 37,115, 42, 92,110, 39, 44, 32,102,117,110, 99,116,105,
-    111,110, 32, 40,114, 41, 32, 97,112,112,101,110,100,114,101,
-    110, 97,109,105,110,103, 40,114, 41, 32,114,101,116,117,114,
-    110, 32, 34, 92,110, 34, 32,101,110,100, 41, 10, 32,117,110,
-    116,105,108, 32,110,115,117, 98,115,116, 32, 61, 61, 32, 48,
-     10, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32, 95, 80,
-     97, 99,107, 97,103,101, 40, 95, 67,111,110,116, 97,105,110,
-    101,114,123,110, 97,109,101, 61,110, 97,109,101, 44, 32, 99,
-    111,100,101, 61, 99,111,100,101,125, 41, 10, 32,112,117,115,
-    104, 40,116, 41, 10, 32,112,114,101,112,114,111, 99,101,115,
-    115, 95,104,111,111,107, 40,116, 41, 10, 32,116, 58,112,114,
-    101,112,114,111, 99,101,115,115, 40, 41, 10, 32,112,114,101,
-    112, 97,114,115,101, 95,104,111,111,107, 40,116, 41, 10, 32,
-    116, 58,112, 97,114,115,101, 40,116, 46, 99,111,100,101, 41,
-     10, 32,112,111,112, 40, 41, 10, 32,114,101,116,117,114,110,
-     32,116, 10,101,110,100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/package.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    45, 45, 32,116,111,108,117, 97, 58, 32,109,111,100,117,108,
-    101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,
-    116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114,
-     32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114,
-     97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,
-    117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, 58,
-     32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,
-    101, 32,105,115, 32,102,114,101,101, 32,115,111,102,116,119,
-     97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,
-    100,105,115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,
-    110,100, 47,111,114, 32,109,111,100,105,102,121, 32,105,116,
-     46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,
-    114,101, 32,112,114,111,118,105,100,101,100, 32,104,101,114,
-    101,117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,110,
-     32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44,
-     32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,
-    104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,
-    103, 97,116,105,111,110, 32,116,111, 32,112,114,111,118,105,
-    100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,101, 44,
-     32,115,117,112,112,111,114,116, 44, 32,117,112,100, 97,116,
-    101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,
-    101,110,116,115, 44, 32,111,114, 32,109,111,100,105,102,105,
-     99, 97,116,105,111,110,115, 46, 10, 10, 10, 10, 45, 45, 32,
-     77,111,100,117,108,101, 32, 99,108, 97,115,115, 10, 45, 45,
-     32, 82,101,112,114,101,115,101,110,116,115, 32,109,111,100,
-    117,108,101, 46, 10, 45, 45, 32, 84,104,101, 32,102,111,108,
-    108,111,119,105,110,103, 32,102,105,101,108,100,115, 32, 97,
-    114,101, 32,115,116,111,114,101,100, 58, 10, 45, 45, 32, 32,
-     32, 32,123,105,125, 32, 61, 32,108,105,115,116, 32,111,102,
-     32,111, 98,106,101, 99,116,115, 32,105,110, 32,116,104,101,
-     32,109,111,100,117,108,101, 46, 10, 99,108, 97,115,115, 77,
-    111,100,117,108,101, 32, 61, 32,123, 10, 32, 99,108, 97,115,
-    115,116,121,112,101, 32, 61, 32, 39,109,111,100,117,108,101,
-     39, 10,125, 10, 99,108, 97,115,115, 77,111,100,117,108,101,
-     46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,115,
-    115, 77,111,100,117,108,101, 10,115,101,116,109,101,116, 97,
-    116, 97, 98,108,101, 40, 99,108, 97,115,115, 77,111,100,117,
-    108,101, 44, 99,108, 97,115,115, 67,111,110,116, 97,105,110,
-    101,114, 41, 10, 10, 45, 45, 32,114,101,103,105,115,116,101,
-    114, 32,109,111,100,117,108,101, 10,102,117,110, 99,116,105,
-    111,110, 32, 99,108, 97,115,115, 77,111,100,117,108,101, 58,
-    114,101,103,105,115,116,101,114, 32, 40,112,114,101, 41, 10,
-     32,112,114,101, 32, 61, 32,112,114,101, 32,111,114, 32, 39,
-     39, 10, 32,112,117,115,104, 40,115,101,108,102, 41, 10, 32,
-    111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,111,
-    108,117, 97, 95,109,111,100,117,108,101, 40,116,111,108,117,
-     97, 95, 83, 44, 34, 39, 46, 46,115,101,108,102, 46,110, 97,
-    109,101, 46, 46, 39, 34, 44, 39, 44,115,101,108,102, 58,104,
-     97,115,118, 97,114, 40, 41, 44, 39, 41, 59, 39, 41, 10, 32,
-    111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,111,
-    108,117, 97, 95, 98,101,103,105,110,109,111,100,117,108,101,
-     40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101,
-    108,102, 46,110, 97,109,101, 46, 46, 39, 34, 41, 59, 39, 41,
-     10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,
-    105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10,
-     32, 32,115,101,108,102, 91,105, 93, 58,114,101,103,105,115,
-    116,101,114, 40,112,114,101, 46, 46, 39, 32, 39, 41, 10, 32,
-     32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,
-    111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,116,111,
-    108,117, 97, 95,101,110,100,109,111,100,117,108,101, 40,116,
-    111,108,117, 97, 95, 83, 41, 59, 39, 41, 10,  9,112,111,112,
-     40, 41, 10,101,110,100, 10, 10, 45, 45, 32, 80,114,105,110,
-    116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116,105,
-    111,110, 32, 99,108, 97,115,115, 77,111,100,117,108,101, 58,
-    112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108,
-    111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101,
-    110,116, 46, 46, 34, 77,111,100,117,108,101,123, 34, 41, 10,
-     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,
-     32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,
-    102, 46,110, 97,109,101, 46, 46, 34, 39, 59, 34, 41, 10, 32,
-    108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108,
-    101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, 32, 32,
-    115,101,108,102, 91,105, 93, 58,112,114,105,110,116, 40,105,
-    100,101,110,116, 46, 46, 34, 32, 34, 44, 34, 44, 34, 41, 10,
-     32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10,
-     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,
-    125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100, 10,
-     10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99,111,
-    110,115,116,114,117, 99,116,111,114, 10,102,117,110, 99,116,
-    105,111,110, 32, 95, 77,111,100,117,108,101, 32, 40,116, 41,
-     10, 32,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,
-    116, 44, 99,108, 97,115,115, 77,111,100,117,108,101, 41, 10,
-     32, 97,112,112,101,110,100, 40,116, 41, 10, 32,114,101,116,
-    117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67,
-    111,110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32, 69,
-    120,112,101, 99,116,115, 32,116,119,111, 32,115,116,114,105,
-    110,103, 32,114,101,112,114,101,115,101,110,116,105,110,103,
-     32,116,104,101, 32,109,111,100,117,108,101, 32,110, 97,109,
-    101, 32, 97,110,100, 32, 98,111,100,121, 46, 10,102,117,110,
-     99,116,105,111,110, 32, 77,111,100,117,108,101, 32, 40,110,
-     44, 98, 41, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,
-     95, 77,111,100,117,108,101, 40, 95, 67,111,110,116, 97,105,
-    110,101,114,123,110, 97,109,101, 61,110,125, 41, 10, 32,112,
-    117,115,104, 40,116, 41, 10, 32,116, 58,112, 97,114,115,101,
-     40,115,116,114,115,117, 98, 40, 98, 44, 50, 44,115,116,114,
-    108,101,110, 40, 98, 41, 45, 49, 41, 41, 32, 45, 45, 32,101,
-    108,105,109,105,110, 97,116,101, 32, 98,114, 97, 99,101,115,
-     10, 32,112,111,112, 40, 41, 10, 32,114,101,116,117,114,110,
-     32,116, 10,101,110,100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/module.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    45, 45, 32,116,111,108,117, 97, 58, 32,110, 97,109,101,115,
-    112, 97, 99,101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,
-    114,105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,
-    109, 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101,
-     67, 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45,
-     45, 32, 74,117,108, 32, 50, 48, 48, 51, 10, 45, 45, 32, 36,
-     73,100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32,
-     99,111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,
-    102,116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110,
-     32,114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,
-    116, 32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121,
-     32,105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,
-    116,119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,
-    104,101,114,101,117,110,100,101,114, 32,105,115, 32,111,110,
-     32, 97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,
-    105,115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32,
-     97,117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111,
-     98,108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,
-    111,118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110,
-     99,101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,
-    100, 97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110,
-     99,101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,
-    105,102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45,
-     45, 32, 78, 97,109,101,115,112, 97, 99,101, 32, 99,108, 97,
-    115,115, 10, 45, 45, 32, 82,101,112,114,101,115,101,110,116,
-    115, 32, 97, 32,110, 97,109,101,115, 97,112, 99,101, 32,100,
-    101,102,105,110,105,116,105,111,110, 46, 10, 45, 45, 32, 83,
-    116,111,114,101,115, 32,116,104,101, 32,102,111,108,108,111,
-    119,105,110,103, 32,102,105,101,108,100,115, 58, 10, 45, 45,
-     32, 32, 32, 32,110, 97,109,101, 32, 61, 32, 99,108, 97,115,
-    115, 32,110, 97,109,101, 10, 45, 45, 32, 32, 32, 32,123,105,
-    125, 32, 32, 61, 32,108,105,115,116, 32,111,102, 32,109,101,
-    109, 98,101,114,115, 10, 99,108, 97,115,115, 78, 97,109,101,
-    115,112, 97, 99,101, 32, 61, 32,123, 10, 32, 99,108, 97,115,
-    115,116,121,112,101, 32, 61, 32, 39,110, 97,109,101,115,112,
-     97, 99,101, 39, 44, 10, 32,110, 97,109,101, 32, 61, 32, 39,
-     39, 44, 10,125, 10, 99,108, 97,115,115, 78, 97,109,101,115,
-    112, 97, 99,101, 46, 95, 95,105,110,100,101,120, 32, 61, 32,
-     99,108, 97,115,115, 78, 97,109,101,115,112, 97, 99,101, 10,
-    115,101,116,109,101,116, 97,116, 97, 98,108,101, 40, 99,108,
-     97,115,115, 78, 97,109,101,115,112, 97, 99,101, 44, 99,108,
-     97,115,115, 77,111,100,117,108,101, 41, 10, 10, 45, 45, 32,
-     80,114,105,110,116, 32,109,101,116,104,111,100, 10,102,117,
-    110, 99,116,105,111,110, 32, 99,108, 97,115,115, 78, 97,109,
-    101,115,112, 97, 99,101, 58,112,114,105,110,116, 32, 40,105,
-    100,101,110,116, 44, 99,108,111,115,101, 41, 10, 32,112,114,
-    105,110,116, 40,105,100,101,110,116, 46, 46, 34, 78, 97,109,
-    101,115,112, 97, 99,101,123, 34, 41, 10, 32,112,114,105,110,
-    116, 40,105,100,101,110,116, 46, 46, 34, 32,110, 97,109,101,
-     32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,110, 97,109,
-    101, 46, 46, 34, 39, 44, 34, 41, 10, 32,108,111, 99, 97,108,
-     32,105, 61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,
-    102, 91,105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 91,
-    105, 93, 58,112,114,105,110,116, 40,105,100,101,110,116, 46,
-     46, 34, 32, 34, 44, 34, 44, 34, 41, 10, 32, 32,105, 32, 61,
-     32,105, 43, 49, 10, 32,101,110,100, 10, 32,112,114,105,110,
-    116, 40,105,100,101,110,116, 46, 46, 34,125, 34, 46, 46, 99,
-    108,111,115,101, 41, 10,101,110,100, 10, 10, 45, 45, 32, 73,
-    110,116,101,114,110, 97,108, 32, 99,111,110,115,116,114,117,
-     99,116,111,114, 10,102,117,110, 99,116,105,111,110, 32, 95,
-     78, 97,109,101,115,112, 97, 99,101, 32, 40,116, 41, 10, 32,
-    115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44,
-     99,108, 97,115,115, 78, 97,109,101,115,112, 97, 99,101, 41,
-     10, 32, 97,112,112,101,110,100, 40,116, 41, 10, 32,114,101,
-    116,117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32,
-     67,111,110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32,
-     69,120,112,101, 99,116,115, 32,116,104,101, 32,110, 97,109,
-    101, 32, 97,110,100, 32,116,104,101, 32, 98,111,100,121, 32,
-    111,102, 32,116,104,101, 32,110, 97,109,101,115,112, 97, 99,
-    101, 46, 10,102,117,110, 99,116,105,111,110, 32, 78, 97,109,
-    101,115,112, 97, 99,101, 32, 40,110, 44, 98, 41, 10, 32,108,
-    111, 99, 97,108, 32, 99, 32, 61, 32, 95, 78, 97,109,101,115,
-    112, 97, 99,101, 40, 95, 67,111,110,116, 97,105,110,101,114,
-    123,110, 97,109,101, 61,110,125, 41, 10, 32,112,117,115,104,
-     40, 99, 41, 10, 32, 99, 58,112, 97,114,115,101, 40,115,116,
-    114,115,117, 98, 40, 98, 44, 50, 44,115,116,114,108,101,110,
-     40, 98, 41, 45, 49, 41, 41, 32, 45, 45, 32,101,108,105,109,
-    105,110, 97,116,101, 32, 98,114, 97, 99,101,115, 10, 32,112,
-    111,112, 40, 41, 10,101,110,100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/namespace.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    45, 45, 32,116,111,108,117, 97, 58, 32,100,101,102,105,110,
-    101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,
-    116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114,
-     32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114,
-     97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,
-    117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, 58,
-     32,100,101,102,105,110,101, 46,108,117, 97, 44,118, 32, 49,
-     46, 50, 32, 49, 57, 57, 57, 47, 48, 55, 47, 50, 56, 32, 50,
-     50, 58, 50, 49, 58, 48, 56, 32, 99,101,108,101,115, 32, 69,
-    120,112, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,
-    111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,
-    116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,
-    114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,116,
-     32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,
-    105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,
-    119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,
-    101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32,
-     97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,
-    115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,
-    117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,
-    108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,
-    118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,
-    101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100,
-     97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,
-    101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,
-    102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45,
-     32, 68,101,102,105,110,101, 32, 99,108, 97,115,115, 10, 45,
-     45, 32, 82,101,112,114,101,115,101,110,116,115, 32, 97, 32,
-    110,117,109,101,114,105, 99, 32, 99,111,110,115,116, 32,100,
-    101,102,105,110,105,116,105,111,110, 10, 45, 45, 32, 84,104,
-    101, 32,102,111,108,108,111,119,105,110,103, 32,102,105,108,
-    100,115, 32, 97,114,101, 32,115,116,111,114,101,100, 58, 10,
-     45, 45, 32, 32, 32,110, 97,109,101, 32, 61, 32, 99,111,110,
-    115,116, 97,110,116, 32,110, 97,109,101, 10, 99,108, 97,115,
-    115, 68,101,102,105,110,101, 32, 61, 32,123, 10, 32,110, 97,
-    109,101, 32, 61, 32, 39, 39, 44, 10,125, 10, 99,108, 97,115,
-    115, 68,101,102,105,110,101, 46, 95, 95,105,110,100,101,120,
-     32, 61, 32, 99,108, 97,115,115, 68,101,102,105,110,101, 10,
-    115,101,116,109,101,116, 97,116, 97, 98,108,101, 40, 99,108,
-     97,115,115, 68,101,102,105,110,101, 44, 99,108, 97,115,115,
-     70,101, 97,116,117,114,101, 41, 10, 10, 45, 45, 32,114,101,
-    103,105,115,116,101,114, 32,100,101,102,105,110,101, 10,102,
-    117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 68,101,
-    102,105,110,101, 58,114,101,103,105,115,116,101,114, 32, 40,
-    112,114,101, 41, 10,  9,105,102, 32,110,111,116, 32,115,101,
-    108,102, 58, 99,104,101, 99,107, 95,112,117, 98,108,105, 99,
-     95, 97, 99, 99,101,115,115, 40, 41, 32,116,104,101,110, 10,
-      9,  9,114,101,116,117,114,110, 10,  9,101,110,100, 10, 10,
-     32,112,114,101, 32, 61, 32,112,114,101, 32,111,114, 32, 39,
-     39, 10, 32,111,117,116,112,117,116, 40,112,114,101, 46, 46,
-     39,116,111,108,117, 97, 95, 99,111,110,115,116, 97,110,116,
-     40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101,
-    108,102, 46,108,110, 97,109,101, 46, 46, 39, 34, 44, 39, 46,
-     46,115,101,108,102, 46,110, 97,109,101, 46, 46, 39, 41, 59,
-     39, 41, 10,101,110,100, 10, 10, 45, 45, 32, 80,114,105,110,
-    116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116,105,
-    111,110, 32, 99,108, 97,115,115, 68,101,102,105,110,101, 58,
-    112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108,
-    111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101,
-    110,116, 46, 46, 34, 68,101,102,105,110,101,123, 34, 41, 10,
-     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,
-     32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,
-    102, 46,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,
-    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,
-    108,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,
-    102, 46,108,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10,
-     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,
-    125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100, 10,
-     10, 10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99,
-    111,110,115,116,114,117, 99,116,111,114, 10,102,117,110, 99,
-    116,105,111,110, 32, 95, 68,101,102,105,110,101, 32, 40,116,
-     41, 10, 32,115,101,116,109,101,116, 97,116, 97, 98,108,101,
-     40,116, 44, 99,108, 97,115,115, 68,101,102,105,110,101, 41,
-     10, 32,116, 58, 98,117,105,108,100,110, 97,109,101,115, 40,
-     41, 10, 10, 32,105,102, 32,116, 46,110, 97,109,101, 32, 61,
-     61, 32, 39, 39, 32,116,104,101,110, 10, 32, 32,101,114,114,
-    111,114, 40, 34, 35,105,110,118, 97,108,105,100, 32,100,101,
-    102,105,110,101, 34, 41, 10, 32,101,110,100, 10, 10, 32, 97,
-    112,112,101,110,100, 40,116, 41, 10, 32,114,101,116,117,114,
-    110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67,111,110,
-    115,116,114,117, 99,116,111,114, 10, 45, 45, 32, 69,120,112,
-    101, 99,116,115, 32, 97, 32,115,116,114,105,110,103, 32,114,
-    101,112,114,101,115,101,110,116,105,110,103, 32,116,104,101,
-     32, 99,111,110,115,116, 97,110,116, 32,110, 97,109,101, 10,
-    102,117,110, 99,116,105,111,110, 32, 68,101,102,105,110,101,
-     32, 40,110, 41, 10, 32,114,101,116,117,114,110, 32, 95, 68,
-    101,102,105,110,101,123, 10, 32, 32,110, 97,109,101, 32, 61,
-     32,110, 10, 32,125, 10,101,110,100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/define.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    45, 45, 32,116,111,108,117, 97, 58, 32,101,110,117,109,101,
-    114, 97,116,101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,
-    114,105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,
-    109, 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101,
-     67, 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45,
-     45, 32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36,
-     73,100, 58, 32,101,110,117,109,101,114, 97,116,101, 46,108,
-    117, 97, 44,118, 32, 49, 46, 51, 32, 50, 48, 48, 48, 47, 48,
-     49, 47, 50, 52, 32, 50, 48, 58, 52, 49, 58, 49, 53, 32, 99,
-    101,108,101,115, 32, 69,120,112, 32, 36, 10, 10, 45, 45, 32,
-     84,104,105,115, 32, 99,111,100,101, 32,105,115, 32,102,114,
-    101,101, 32,115,111,102,116,119, 97,114,101, 59, 32,121,111,
-    117, 32, 99, 97,110, 32,114,101,100,105,115,116,114,105, 98,
-    117,116,101, 32,105,116, 32, 97,110,100, 47,111,114, 32,109,
-    111,100,105,102,121, 32,105,116, 46, 10, 45, 45, 32, 84,104,
-    101, 32,115,111,102,116,119, 97,114,101, 32,112,114,111,118,
-    105,100,101,100, 32,104,101,114,101,117,110,100,101,114, 32,
-    105,115, 32,111,110, 32, 97,110, 32, 34, 97,115, 32,105,115,
-     34, 32, 98, 97,115,105,115, 44, 32, 97,110,100, 10, 45, 45,
-     32,116,104,101, 32, 97,117,116,104,111,114, 32,104, 97,115,
-     32,110,111, 32,111, 98,108,105,103, 97,116,105,111,110, 32,
-    116,111, 32,112,114,111,118,105,100,101, 32,109, 97,105,110,
-    116,101,110, 97,110, 99,101, 44, 32,115,117,112,112,111,114,
-    116, 44, 32,117,112,100, 97,116,101,115, 44, 10, 45, 45, 32,
-    101,110,104, 97,110, 99,101,109,101,110,116,115, 44, 32,111,
-    114, 32,109,111,100,105,102,105, 99, 97,116,105,111,110,115,
-     46, 10, 10, 10, 45, 45, 32, 69,110,117,109,101,114, 97,116,
-    101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,
-    101,115,101,110,116,115, 32,101,110,117,109,101,114, 97,116,
-    105,111,110, 10, 45, 45, 32, 84,104,101, 32,102,111,108,108,
-    111,119,105,110,103, 32,102,105,101,108,100,115, 32, 97,114,
-    101, 32,115,116,111,114,101,100, 58, 10, 45, 45, 32, 32, 32,
-     32,123,105,125, 32, 61, 32,108,105,115,116, 32,111,102, 32,
-     99,111,110,115,116, 97,110,116, 32,110, 97,109,101,115, 10,
-     99,108, 97,115,115, 69,110,117,109,101,114, 97,116,101, 32,
-     61, 32,123, 10,125, 10, 99,108, 97,115,115, 69,110,117,109,
-    101,114, 97,116,101, 46, 95, 95,105,110,100,101,120, 32, 61,
-     32, 99,108, 97,115,115, 69,110,117,109,101,114, 97,116,101,
-     10,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40, 99,
-    108, 97,115,115, 69,110,117,109,101,114, 97,116,101, 44, 99,
-    108, 97,115,115, 70,101, 97,116,117,114,101, 41, 10, 10, 45,
-     45, 32,114,101,103,105,115,116,101,114, 32,101,110,117,109,
-    101,114, 97,116,105,111,110, 10,102,117,110, 99,116,105,111,
-    110, 32, 99,108, 97,115,115, 69,110,117,109,101,114, 97,116,
-    101, 58,114,101,103,105,115,116,101,114, 32, 40,112,114,101,
-     41, 10, 32,112,114,101, 32, 61, 32,112,114,101, 32,111,114,
-     32, 39, 39, 10, 32,108,111, 99, 97,108, 32,110,115,112, 97,
-     99,101, 32, 61, 32,103,101,116,110, 97,109,101,115,112, 97,
-     99,101, 40, 99,108, 97,115,115, 67,111,110,116, 97,105,110,
-    101,114, 46, 99,117,114,114, 41, 10, 32,108,111, 99, 97,108,
-     32,105, 61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,
-    102, 91,105, 93, 32,100,111, 10, 32, 32,111,117,116,112,117,
-    116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97, 95, 99,
-    111,110,115,116, 97,110,116, 40,116,111,108,117, 97, 95, 83,
-     44, 34, 39, 46, 46,115,101,108,102, 46,108,110, 97,109,101,
-    115, 91,105, 93, 46, 46, 39, 34, 44, 39, 46, 46,110,115,112,
-     97, 99,101, 46, 46,115,101,108,102, 91,105, 93, 46, 46, 39,
-     41, 59, 39, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10,
-     32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 80,114,
-    105,110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,
-    116,105,111,110, 32, 99,108, 97,115,115, 69,110,117,109,101,
-    114, 97,116,101, 58,112,114,105,110,116, 32, 40,105,100,101,
-    110,116, 44, 99,108,111,115,101, 41, 10, 32,112,114,105,110,
-    116, 40,105,100,101,110,116, 46, 46, 34, 69,110,117,109,101,
-    114, 97,116,101,123, 34, 41, 10, 32,112,114,105,110,116, 40,
-    105,100,101,110,116, 46, 46, 34, 32,110, 97,109,101, 32, 61,
-     32, 34, 46, 46,115,101,108,102, 46,110, 97,109,101, 41, 10,
-     32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,
-    108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10, 32,
-     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,
-     32, 39, 34, 46, 46,115,101,108,102, 91,105, 93, 46, 46, 34,
-     39, 40, 34, 46, 46,115,101,108,102, 46,108,110, 97,109,101,
-    115, 91,105, 93, 46, 46, 34, 41, 44, 34, 41, 10, 32, 32,105,
-     32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,112,114,
-    105,110,116, 40,105,100,101,110,116, 46, 46, 34,125, 34, 46,
-     46, 99,108,111,115,101, 41, 10,101,110,100, 10, 10, 45, 45,
-     32, 73,110,116,101,114,110, 97,108, 32, 99,111,110,115,116,
-    114,117, 99,116,111,114, 10,102,117,110, 99,116,105,111,110,
-     32, 95, 69,110,117,109,101,114, 97,116,101, 32, 40,116, 44,
-    118, 97,114,110, 97,109,101, 41, 10, 32,115,101,116,109,101,
-    116, 97,116, 97, 98,108,101, 40,116, 44, 99,108, 97,115,115,
-     69,110,117,109,101,114, 97,116,101, 41, 10, 32, 97,112,112,
-    101,110,100, 40,116, 41, 10, 32, 97,112,112,101,110,100,101,
-    110,117,109, 40,116, 41, 10,  9, 32,105,102, 32,118, 97,114,
-    110, 97,109,101, 32, 97,110,100, 32,118, 97,114,110, 97,109,
-    101, 32,126, 61, 32, 34, 34, 32,116,104,101,110, 10,  9,  9,
-    105,102, 32,116, 46,110, 97,109,101, 32,126, 61, 32, 34, 34,
-     32,116,104,101,110, 10,  9,  9,  9, 86, 97,114,105, 97, 98,
-    108,101, 40,116, 46,110, 97,109,101, 46, 46, 34, 32, 34, 46,
-     46,118, 97,114,110, 97,109,101, 41, 10,  9,  9,101,108,115,
-    101, 10,  9,  9,  9,108,111, 99, 97,108, 32,110,115, 32, 61,
-     32,103,101,116, 99,117,114,114,110, 97,109,101,115,112, 97,
-     99,101, 40, 41, 10,  9,  9,  9,119, 97,114,110,105,110,103,
-     40, 34, 86, 97,114,105, 97, 98,108,101, 32, 34, 46, 46,110,
-    115, 46, 46,118, 97,114,110, 97,109,101, 46, 46, 34, 32,111,
-    102, 32,116,121,112,101, 32, 60, 97,110,111,110,121,109,111,
-    117,115, 32,101,110,117,109, 62, 32,105,115, 32,100,101, 99,
-    108, 97,114,101,100, 32, 97,115, 32,114,101, 97,100, 45,111,
-    110,108,121, 34, 41, 10,  9,  9,  9, 86, 97,114,105, 97, 98,
-    108,101, 40, 34,116,111,108,117, 97, 95,114,101, 97,100,111,
-    110,108,121, 32,105,110,116, 32, 34, 46, 46,118, 97,114,110,
-     97,109,101, 41, 10,  9,  9,101,110,100, 10,  9,101,110,100,
-     10,114,101,116,117,114,110, 32,116, 10,101,110,100, 10, 10,
-     45, 45, 32, 67,111,110,115,116,114,117, 99,116,111,114, 10,
-     45, 45, 32, 69,120,112,101, 99,116,115, 32, 97, 32,115,116,
-    114,105,110,103, 32,114,101,112,114,101,115,101,110,116,105,
-    110,103, 32,116,104,101, 32,101,110,117,109,101,114, 97,116,
-    101, 32, 98,111,100,121, 10,102,117,110, 99,116,105,111,110,
-     32, 69,110,117,109,101,114, 97,116,101, 32, 40,110, 44, 98,
-     44,118, 97,114,110, 97,109,101, 41, 10,  9, 98, 32, 61, 32,
-    115,116,114,105,110,103, 46,103,115,117, 98, 40, 98, 44, 32,
-     34, 44, 91, 37,115, 92,110, 93, 42,125, 34, 44, 32, 34, 92,
-    110,125, 34, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,
-    116,101, 32,108, 97,115,116, 32, 39, 44, 39, 10, 32,108,111,
-     99, 97,108, 32,116, 32, 61, 32,115,112,108,105,116, 40,115,
-    116,114,115,117, 98, 40, 98, 44, 50, 44, 45, 50, 41, 44, 39,
-     44, 39, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,
-    101, 32, 98,114, 97, 99,101,115, 10, 32,108,111, 99, 97,108,
-     32,105, 32, 61, 32, 49, 10, 32,108,111, 99, 97,108, 32,101,
-     32, 61, 32,123,110, 61, 48,125, 10, 32,119,104,105,108,101,
-     32,116, 91,105, 93, 32,100,111, 10, 32, 32,108,111, 99, 97,
-    108, 32,116,116, 32, 61, 32,115,112,108,105,116, 40,116, 91,
-    105, 93, 44, 39, 61, 39, 41, 32, 32, 45, 45, 32,100,105,115,
-     99, 97,114,100, 32,105,110,105,116,105, 97,108, 32,118, 97,
-    108,117,101, 10, 32, 32,101, 46,110, 32, 61, 32,101, 46,110,
-     32, 43, 32, 49, 10, 32, 32,101, 91,101, 46,110, 93, 32, 61,
-     32,116,116, 91, 49, 93, 10, 32, 32,105, 32, 61, 32,105, 43,
-     49, 10, 32,101,110,100, 10, 32, 45, 45, 32,115,101,116, 32,
-    108,117, 97, 32,110, 97,109,101,115, 10, 32,105, 32, 32, 61,
-     32, 49, 10, 32,101, 46,108,110, 97,109,101,115, 32, 61, 32,
-    123,125, 10, 32,108,111, 99, 97,108, 32,110,115, 32, 61, 32,
-    103,101,116, 99,117,114,114,110, 97,109,101,115,112, 97, 99,
-    101, 40, 41, 10, 32,119,104,105,108,101, 32,101, 91,105, 93,
-     32,100,111, 10, 32, 32,108,111, 99, 97,108, 32,116, 32, 61,
-     32,115,112,108,105,116, 40,101, 91,105, 93, 44, 39, 64, 39,
-     41, 10, 32, 32,101, 91,105, 93, 32, 61, 32,116, 91, 49, 93,
-     10,  9,  9,105,102, 32,110,111,116, 32,116, 91, 50, 93, 32,
-    116,104,101,110, 10,  9,  9, 32,116, 91, 50, 93, 32, 61, 32,
-     97,112,112,108,121,114,101,110, 97,109,105,110,103, 40,116,
-     91, 49, 93, 41, 10,  9,  9,101,110,100, 10, 32, 32,101, 46,
-    108,110, 97,109,101,115, 91,105, 93, 32, 61, 32,116, 91, 50,
-     93, 32,111,114, 32,116, 91, 49, 93, 10, 32, 32, 95,103,108,
-    111, 98, 97,108, 95,101,110,117,109,115, 91, 32,110,115, 46,
-     46,101, 91,105, 93, 32, 93, 32, 61, 32, 40,110,115, 46, 46,
-    101, 91,105, 93, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49,
-     10, 32,101,110,100, 10,  9,101, 46,110, 97,109,101, 32, 61,
-     32,110, 10,  9,105,102, 32,110, 32,126, 61, 32, 34, 34, 32,
-    116,104,101,110, 10,  9,  9, 84,121,112,101,100,101,102, 40,
-     34,105,110,116, 32, 34, 46, 46,110, 41, 10,  9,101,110,100,
-     10, 32,114,101,116,117,114,110, 32, 95, 69,110,117,109,101,
-    114, 97,116,101, 40,101, 44, 32,118, 97,114,110, 97,109,101,
-     41, 10,101,110,100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/enumerate.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    45, 45, 32,116,111,108,117, 97, 58, 32,100,101, 99,108, 97,
-    114, 97,116,105,111,110, 32, 99,108, 97,115,115, 10, 45, 45,
-     32, 87,114,105,116,116,101,110, 32, 98,121, 32, 87, 97,108,
-    100,101,109, 97,114, 32, 67,101,108,101,115, 10, 45, 45, 32,
-     84,101, 67, 71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111,
-     10, 45, 45, 32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45,
-     32, 36, 73,100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,
-    115, 32, 99,111,100,101, 32,105,115, 32,102,114,101,101, 32,
-    115,111,102,116,119, 97,114,101, 59, 32,121,111,117, 32, 99,
-     97,110, 32,114,101,100,105,115,116,114,105, 98,117,116,101,
-     32,105,116, 32, 97,110,100, 47,111,114, 32,109,111,100,105,
-    102,121, 32,105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,
-    111,102,116,119, 97,114,101, 32,112,114,111,118,105,100,101,
-    100, 32,104,101,114,101,117,110,100,101,114, 32,105,115, 32,
-    111,110, 32, 97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98,
-     97,115,105,115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,
-    101, 32, 97,117,116,104,111,114, 32,104, 97,115, 32,110,111,
-     32,111, 98,108,105,103, 97,116,105,111,110, 32,116,111, 32,
-    112,114,111,118,105,100,101, 32,109, 97,105,110,116,101,110,
-     97,110, 99,101, 44, 32,115,117,112,112,111,114,116, 44, 32,
-    117,112,100, 97,116,101,115, 44, 10, 45, 45, 32,101,110,104,
-     97,110, 99,101,109,101,110,116,115, 44, 32,111,114, 32,109,
-    111,100,105,102,105, 99, 97,116,105,111,110,115, 46, 10, 10,
-     10, 45, 45, 32, 68,101, 99,108, 97,114, 97,116,105,111,110,
-     32, 99,108, 97,115,115, 10, 45, 45, 32, 82,101,112,114,101,
-    115,101,110,116,115, 32,118, 97,114,105, 97, 98,108,101, 44,
-     32,102,117,110, 99,116,105,111,110, 44, 32,111,114, 32, 97,
-    114,103,117,109,101,110,116, 32,100,101, 99,108, 97,114, 97,
-    116,105,111,110, 46, 10, 45, 45, 32, 83,116,111,114,101,115,
-     32,116,104,101, 32,102,111,108,108,111,119,105,110,103, 32,
-    102,105,101,108,100,115, 58, 10, 45, 45, 32, 32,109,111,100,
-     32, 32, 61, 32,116,121,112,101, 32,109,111,100,105,102,105,
-    101,114,115, 10, 45, 45, 32, 32,116,121,112,101, 32, 61, 32,
-    116,121,112,101, 10, 45, 45, 32, 32,112,116,114, 32, 32, 61,
-     32, 34, 42, 34, 32,111,114, 32, 34, 38, 34, 44, 32,105,102,
-     32,114,101,112,114,101,115,101,110,116,105,110,103, 32, 97,
-     32,112,111,105,110,116,101,114, 32,111,114, 32, 97, 32,114,
-    101,102,101,114,101,110, 99,101, 10, 45, 45, 32, 32,110, 97,
-    109,101, 32, 61, 32,110, 97,109,101, 10, 45, 45, 32, 32,100,
-    105,109, 32, 32, 61, 32,100,105,109,101,110,115,105,111,110,
-     44, 32,105,102, 32, 97, 32,118,101, 99,116,111,114, 10, 45,
-     45, 32, 32,100,101,102, 32, 32, 61, 32,100,101,102, 97,117,
-    108,116, 32,118, 97,108,117,101, 44, 32,105,102, 32, 97,110,
-    121, 32, 40,111,110,108,121, 32,102,111,114, 32, 97,114,103,
-    117,109,101,110,116,115, 41, 10, 45, 45, 32, 32,114,101,116,
-     32, 32, 61, 32, 34, 42, 34, 32,111,114, 32, 34, 38, 34, 44,
-     32,105,102, 32,118, 97,108,117,101, 32,105,115, 32,116,111,
-     32, 98,101, 32,114,101,116,117,114,110,101,100, 32, 40,111,
-    110,108,121, 32,102,111,114, 32, 97,114,103,117,109,101,110,
-    116,115, 41, 10, 99,108, 97,115,115, 68,101, 99,108, 97,114,
-     97,116,105,111,110, 32, 61, 32,123, 10, 32,109,111,100, 32,
-     61, 32, 39, 39, 44, 10, 32,116,121,112,101, 32, 61, 32, 39,
-     39, 44, 10, 32,112,116,114, 32, 61, 32, 39, 39, 44, 10, 32,
-    110, 97,109,101, 32, 61, 32, 39, 39, 44, 10, 32,100,105,109,
-     32, 61, 32, 39, 39, 44, 10, 32,114,101,116, 32, 61, 32, 39,
-     39, 44, 10, 32,100,101,102, 32, 61, 32, 39, 39, 10,125, 10,
-     99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,
-    110, 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,
-    115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 10,115,
-    101,116,109,101,116, 97,116, 97, 98,108,101, 40, 99,108, 97,
-    115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 44, 99,
-    108, 97,115,115, 70,101, 97,116,117,114,101, 41, 10, 10, 45,
-     45, 32, 67,114,101, 97,116,101, 32, 97,110, 32,117,110,105,
-    113,117,101, 32,118, 97,114,105, 97, 98,108,101, 32,110, 97,
-    109,101, 10,102,117,110, 99,116,105,111,110, 32, 99,114,101,
-     97,116,101, 95,118, 97,114,110, 97,109,101, 32, 40, 41, 10,
-     32,105,102, 32,110,111,116, 32, 95,118, 97,114,110,117,109,
-     98,101,114, 32,116,104,101,110, 32, 95,118, 97,114,110,117,
-    109, 98,101,114, 32, 61, 32, 48, 32,101,110,100, 10, 32, 95,
-    118, 97,114,110,117,109, 98,101,114, 32, 61, 32, 95,118, 97,
-    114,110,117,109, 98,101,114, 32, 43, 32, 49, 10, 32,114,101,
-    116,117,114,110, 32, 34,116,111,108,117, 97, 95,118, 97,114,
-     95, 34, 46, 46, 95,118, 97,114,110,117,109, 98,101,114, 10,
-    101,110,100, 10, 10, 45, 45, 32, 67,104,101, 99,107, 32,100,
-    101, 99,108, 97,114, 97,116,105,111,110, 32,110, 97,109,101,
-     10, 45, 45, 32, 73,116, 32, 97,108,115,111, 32,105,100,101,
-    110,116,105,102,105,101,115, 32,100,101,102, 97,117,108,116,
-     32,118, 97,108,117,101,115, 10,102,117,110, 99,116,105,111,
-    110, 32, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116,
-    105,111,110, 58, 99,104,101, 99,107,110, 97,109,101, 32, 40,
-     41, 10, 10, 32,105,102, 32,115,116,114,115,117, 98, 40,115,
-    101,108,102, 46,110, 97,109,101, 44, 49, 44, 49, 41, 32, 61,
-     61, 32, 39, 91, 39, 32, 97,110,100, 32,110,111,116, 32,102,
-    105,110,100,116,121,112,101, 40,115,101,108,102, 46,116,121,
-    112,101, 41, 32,116,104,101,110, 10, 32, 32,115,101,108,102,
-     46,110, 97,109,101, 32, 61, 32,115,101,108,102, 46,116,121,
-    112,101, 46, 46,115,101,108,102, 46,110, 97,109,101, 10, 32,
-     32,108,111, 99, 97,108, 32,109, 32, 61, 32,115,112,108,105,
-    116, 40,115,101,108,102, 46,109,111,100, 44, 39, 37,115, 37,
-    115, 42, 39, 41, 10, 32, 32,115,101,108,102, 46,116,121,112,
-    101, 32, 61, 32,109, 91,109, 46,110, 93, 10, 32, 32,115,101,
-    108,102, 46,109,111,100, 32, 61, 32, 99,111,110, 99, 97,116,
-     40,109, 44, 49, 44,109, 46,110, 45, 49, 41, 10, 32,101,110,
-    100, 10, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,115,
-    112,108,105,116, 40,115,101,108,102, 46,110, 97,109,101, 44,
-     39, 61, 39, 41, 10, 32,105,102, 32,116, 46,110, 61, 61, 50,
-     32,116,104,101,110, 10, 32, 32,115,101,108,102, 46,110, 97,
-    109,101, 32, 61, 32,116, 91, 49, 93, 10, 32, 32,115,101,108,
-    102, 46,100,101,102, 32, 61, 32,102,105,110,100, 95,101,110,
-    117,109, 95,118, 97,114, 40,116, 91,116, 46,110, 93, 41, 10,
-     32,101,110,100, 10, 10, 32,108,111, 99, 97,108, 32, 98, 44,
-    101, 44,100, 32, 61, 32,115,116,114,102,105,110,100, 40,115,
-    101,108,102, 46,110, 97,109,101, 44, 34, 37, 91, 40, 46, 45,
-     41, 37, 93, 34, 41, 10, 32,105,102, 32, 98, 32,116,104,101,
-    110, 10, 32, 32,115,101,108,102, 46,110, 97,109,101, 32, 61,
-     32,115,116,114,115,117, 98, 40,115,101,108,102, 46,110, 97,
-    109,101, 44, 49, 44, 98, 45, 49, 41, 10, 32, 32,115,101,108,
-    102, 46,100,105,109, 32, 61, 32,102,105,110,100, 95,101,110,
-    117,109, 95,118, 97,114, 40,100, 41, 10, 32,101,110,100, 10,
-     10, 10, 32,105,102, 32,115,101,108,102, 46,116,121,112,101,
-     32,126, 61, 32, 39, 39, 32, 97,110,100, 32,115,101,108,102,
-     46,116,121,112,101, 32,126, 61, 32, 39,118,111,105,100, 39,
-     32, 97,110,100, 32,115,101,108,102, 46,110, 97,109,101, 32,
-     61, 61, 32, 39, 39, 32,116,104,101,110, 10, 32, 32,115,101,
-    108,102, 46,110, 97,109,101, 32, 61, 32, 99,114,101, 97,116,
-    101, 95,118, 97,114,110, 97,109,101, 40, 41, 10, 32,101,108,
-    115,101,105,102, 32,115,101,108,102, 46,107,105,110,100, 61,
-     61, 39,118, 97,114, 39, 32,116,104,101,110, 10, 32, 32,105,
-    102, 32,115,101,108,102, 46,116,121,112,101, 61, 61, 39, 39,
-     32, 97,110,100, 32,115,101,108,102, 46,110, 97,109,101,126,
-     61, 39, 39, 32,116,104,101,110, 10, 32, 32, 32,115,101,108,
-    102, 46,116,121,112,101, 32, 61, 32,115,101,108,102, 46,116,
-    121,112,101, 46, 46,115,101,108,102, 46,110, 97,109,101, 10,
-     32, 32, 32,115,101,108,102, 46,110, 97,109,101, 32, 61, 32,
-     99,114,101, 97,116,101, 95,118, 97,114,110, 97,109,101, 40,
-     41, 10, 32, 32,101,108,115,101,105,102, 32,102,105,110,100,
-    116,121,112,101, 40,115,101,108,102, 46,110, 97,109,101, 41,
-     32,116,104,101,110, 10, 32, 32, 32,105,102, 32,115,101,108,
-    102, 46,116,121,112,101, 61, 61, 39, 39, 32,116,104,101,110,
-     32,115,101,108,102, 46,116,121,112,101, 32, 61, 32,115,101,
-    108,102, 46,110, 97,109,101, 10, 32, 32, 32,101,108,115,101,
-     32,115,101,108,102, 46,116,121,112,101, 32, 61, 32,115,101,
-    108,102, 46,116,121,112,101, 46, 46, 39, 32, 39, 46, 46,115,
-    101,108,102, 46,110, 97,109,101, 32,101,110,100, 10, 32, 32,
-     32,115,101,108,102, 46,110, 97,109,101, 32, 61, 32, 99,114,
-    101, 97,116,101, 95,118, 97,114,110, 97,109,101, 40, 41, 10,
-     32, 32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45,
-     32, 97,100,106,117,115,116, 32,116,121,112,101, 32,111,102,
-     32,115,116,114,105,110,103, 10, 32,105,102, 32,115,101,108,
-    102, 46,116,121,112,101, 32, 61, 61, 32, 39, 99,104, 97,114,
-     39, 32, 97,110,100, 32,115,101,108,102, 46,100,105,109, 32,
-    126, 61, 32, 39, 39, 32,116,104,101,110, 10,  9, 32,115,101,
-    108,102, 46,116,121,112,101, 32, 61, 32, 39, 99,104, 97,114,
-     42, 39, 10, 32,101,110,100, 10, 10,  9,105,102, 32,115,101,
-    108,102, 46,107,105,110,100, 32, 97,110,100, 32,115,101,108,
-    102, 46,107,105,110,100, 32, 61, 61, 32, 39,118, 97,114, 39,
-     32,116,104,101,110, 10,  9,  9,115,101,108,102, 46,110, 97,
-    109,101, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117,
-     98, 40,115,101,108,102, 46,110, 97,109,101, 44, 32, 34, 58,
-     46, 42, 36, 34, 44, 32, 34, 34, 41, 32, 45, 45, 32, 63, 63,
-     63, 10,  9,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32,
-     67,104,101, 99,107, 32,100,101, 99,108, 97,114, 97,116,105,
-    111,110, 32,116,121,112,101, 10, 45, 45, 32, 83,117, 98,115,
-    116,105,116,117,116,101,115, 32,116,121,112,101,100,101,102,
-     39,115, 46, 10,102,117,110, 99,116,105,111,110, 32, 99,108,
-     97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 58,
-     99,104,101, 99,107,116,121,112,101, 32, 40, 41, 10, 10, 32,
-     45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,116,104,101,
-    114,101, 32,105,115, 32, 97, 32,112,111,105,110,116,101,114,
-     32,116,111, 32, 98, 97,115,105, 99, 32,116,121,112,101, 10,
-     32,108,111, 99, 97,108, 32, 98, 97,115,105, 99, 32, 61, 32,
-    105,115, 98, 97,115,105, 99, 40,115,101,108,102, 46,116,121,
-    112,101, 41, 10, 32,105,102, 32,115,101,108,102, 46,107,105,
-    110,100, 32, 61, 61, 32, 39,102,117,110, 99, 39, 32, 97,110,
-    100, 32, 98, 97,115,105, 99, 61, 61, 39,110,117,109, 98,101,
-    114, 39, 32, 97,110,100, 32,115,116,114,105,110,103, 46,102,
-    105,110,100, 40,115,101,108,102, 46,112,116,114, 44, 32, 34,
-     37, 42, 34, 41, 32,116,104,101,110, 10, 32,  9,115,101,108,
-    102, 46,116,121,112,101, 32, 61, 32, 39, 95,117,115,101,114,
-    100, 97,116, 97, 39, 10, 32,  9,115,101,108,102, 46,112,116,
-    114, 32, 61, 32, 34, 34, 10, 32,101,110,100, 10, 32,105,102,
-     32, 98, 97,115,105, 99, 32, 97,110,100, 32,115,101,108,102,
-     46,112,116,114,126, 61, 39, 39, 32,116,104,101,110, 10, 32,
-     32,115,101,108,102, 46,114,101,116, 32, 61, 32,115,101,108,
-    102, 46,112,116,114, 10, 32, 32,115,101,108,102, 46,112,116,
-    114, 32, 61, 32,110,105,108, 10, 32, 32,105,102, 32,105,115,
-     98, 97,115,105, 99, 40,115,101,108,102, 46,116,121,112,101,
-     41, 32, 61, 61, 32, 39,110,117,109, 98,101,114, 39, 32,116,
-    104,101,110, 10, 32, 32,  9,115,101,108,102, 46,114,101,116,
-    117,114,110, 95,117,115,101,114,100, 97,116, 97, 32, 61, 32,
-    116,114,117,101, 10, 32, 32,101,110,100, 10, 32,101,110,100,
-     10, 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,
-    116,104,101,114,101, 32,105,115, 32, 97,114,114, 97,121, 32,
-    116,111, 32, 98,101, 32,114,101,116,117,114,110,101,100, 10,
-     32,105,102, 32,115,101,108,102, 46,100,105,109,126, 61, 39,
-     39, 32, 97,110,100, 32,115,101,108,102, 46,114,101,116,126,
-     61, 39, 39, 32,116,104,101,110, 10, 32, 32, 32,101,114,114,
-    111,114, 40, 39, 35,105,110,118, 97,108,105,100, 32,112, 97,
-    114, 97,109,101,116,101,114, 58, 32, 99, 97,110,110,111,116,
-     32,114,101,116,117,114,110, 32, 97,110, 32, 97,114,114, 97,
-    121, 32,111,102, 32,118, 97,108,117,101,115, 39, 41, 10, 32,
-    101,110,100, 10, 32, 45, 45, 32,114,101,115,116,111,114,101,
-     32, 39,118,111,105,100, 42, 39, 32, 97,110,100, 32, 39,115,
-    116,114,105,110,103, 42, 39, 10, 32,105,102, 32,115,101,108,
-    102, 46,116,121,112,101, 32, 61, 61, 32, 39, 95,117,115,101,
-    114,100, 97,116, 97, 39, 32,116,104,101,110, 32,115,101,108,
-    102, 46,116,121,112,101, 32, 61, 32, 39,118,111,105,100, 42,
-     39, 10, 32,101,108,115,101,105,102, 32,115,101,108,102, 46,
-    116,121,112,101, 32, 61, 61, 32, 39, 95, 99,115,116,114,105,
-    110,103, 39, 32,116,104,101,110, 32,115,101,108,102, 46,116,
-    121,112,101, 32, 61, 32, 39, 99,104, 97,114, 42, 39, 10, 32,
-    101,108,115,101,105,102, 32,115,101,108,102, 46,116,121,112,
-    101, 32, 61, 61, 32, 39, 95,108,115,116, 97,116,101, 39, 32,
-    116,104,101,110, 32,115,101,108,102, 46,116,121,112,101, 32,
-     61, 32, 39,108,117, 97, 95, 83,116, 97,116,101, 42, 39, 10,
-     32,101,110,100, 10, 10, 32, 45, 45, 32,114,101,115,111,108,
-    118,101, 32,116,121,112,101,115, 32,105,110,115,105,100,101,
-     32,116,104,101, 32,116,101,109,112,108, 97,116,101,115, 10,
-     32,105,102, 32,115,101,108,102, 46,116,121,112,101, 32,116,
-    104,101,110, 10,  9, 32,115,101,108,102, 46,116,121,112,101,
-     32, 61, 32,114,101,115,111,108,118,101, 95,116,101,109,112,
-    108, 97,116,101, 95,116,121,112,101,115, 40,115,101,108,102,
-     46,116,121,112,101, 41, 10, 32,101,110,100, 10, 10, 45, 45,
-     10, 45, 45, 32, 45, 45, 32,105,102, 32,114,101,116,117,114,
-    110,105,110,103, 32,118, 97,108,117,101, 44, 32, 97,117,116,
-    111,109, 97,116,105, 99, 97,108,108,121, 32,115,101,116, 32,
-    100,101,102, 97,117,108,116, 32,118, 97,108,117,101, 10, 45,
-     45, 32,105,102, 32,115,101,108,102, 46,114,101,116, 32,126,
-     61, 32, 39, 39, 32, 97,110,100, 32,115,101,108,102, 46,100,
-    101,102, 32, 61, 61, 32, 39, 39, 32,116,104,101,110, 10, 45,
-     45, 32, 32,115,101,108,102, 46,100,101,102, 32, 61, 32, 39,
-     48, 39, 10, 45, 45, 32,101,110,100, 10, 45, 45, 10, 10,101,
-    110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,114,101,
-    115,111,108,118,101, 95,116,101,109,112,108, 97,116,101, 95,
-    116,121,112,101,115, 40,116,121,112,101, 41, 10, 10,  9,105,
-    102, 32,105,115, 98, 97,115,105, 99, 40,116,121,112,101, 41,
-     32,116,104,101,110, 10,  9,  9,114,101,116,117,114,110, 32,
-    116,121,112,101, 10,  9,101,110,100, 10,  9,108,111, 99, 97,
-    108, 32, 98, 44, 95, 44,109, 32, 61, 32,115,116,114,105,110,
-    103, 46,102,105,110,100, 40,116,121,112,101, 44, 32, 34, 40,
-     37, 98, 60, 62, 41, 34, 41, 10,  9,105,102, 32, 98, 32,116,
-    104,101,110, 10, 10,  9,  9,109, 32, 61, 32,115,112,108,105,
-    116, 95, 99, 95,116,111,107,101,110,115, 40,115,116,114,105,
-    110,103, 46,115,117, 98, 40,109, 44, 32, 50, 44, 32, 45, 50,
-     41, 44, 32, 34, 44, 34, 41, 10,  9,  9,102,111,114, 32,105,
-     61, 49, 44, 32,116, 97, 98,108,101, 46,103,101,116,110, 40,
-    109, 41, 32,100,111, 10,  9,  9,  9,109, 91,105, 93, 32, 61,
-     32,115,116,114,105,110,103, 46,103,115,117, 98, 40,109, 91,
-    105, 93, 44, 34, 37,115, 42, 40, 91, 37, 42, 38, 93, 41, 34,
-     44, 32, 34, 37, 49, 34, 41, 10,  9,  9,  9,109, 91,105, 93,
-     32, 61, 32,102,105,110,100,116,121,112,101, 40,109, 91,105,
-     93, 41, 32,111,114, 32,109, 91,105, 93, 10,  9,  9,  9,109,
-     91,105, 93, 32, 61, 32,114,101,115,111,108,118,101, 95,116,
-    101,109,112,108, 97,116,101, 95,116,121,112,101,115, 40,109,
-     91,105, 93, 41, 10,  9,  9,101,110,100, 10, 10,  9,  9,108,
-    111, 99, 97,108, 32, 98, 44,105, 10,  9,  9,116,121,112,101,
-     44, 98, 44,105, 32, 61, 32, 98,114,101, 97,107, 95,116,101,
-    109,112,108, 97,116,101, 40,116,121,112,101, 41, 10,  9,  9,
-    108,111, 99, 97,108, 32,116,101,109,112,108, 97,116,101, 95,
-    112, 97,114,116, 32, 61, 32, 34, 60, 34, 46, 46,115,116,114,
-    105,110,103, 46,103,115,117, 98, 40, 99,111,110, 99, 97,116,
-     40,109, 44, 32, 49, 44, 32,109, 46,110, 41, 44, 32, 34, 32,
-     34, 44, 32, 34, 44, 34, 41, 46, 46, 34, 62, 34, 10,  9,  9,
-    116,121,112,101, 32, 61, 32,114,101, 98,117,105,108,100, 95,
-    116,101,109,112,108, 97,116,101, 40,116,121,112,101, 44, 32,
-     98, 44, 32,116,101,109,112,108, 97,116,101, 95,112, 97,114,
-    116, 41, 10,  9,  9,116,121,112,101, 32, 61, 32,115,116,114,
-    105,110,103, 46,103,115,117, 98, 40,116,121,112,101, 44, 32,
-     34, 62, 62, 34, 44, 32, 34, 62, 32, 62, 34, 41, 10,  9,101,
-    110,100, 10,  9,114,101,116,117,114,110, 32,116,121,112,101,
-     10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110, 32,
-     98,114,101, 97,107, 95,116,101,109,112,108, 97,116,101, 40,
-    115, 41, 10,  9,108,111, 99, 97,108, 32, 98, 44,101, 44,116,
-    105,109,112,108, 32, 61, 32,115,116,114,105,110,103, 46,102,
-    105,110,100, 40,115, 44, 32, 34, 40, 37, 98, 60, 62, 41, 34,
-     41, 10,  9,105,102, 32,116,105,109,112,108, 32,116,104,101,
-    110, 10,  9,  9,115, 32, 61, 32,115,116,114,105,110,103, 46,
-    103,115,117, 98, 40,115, 44, 32, 34, 37, 98, 60, 62, 34, 44,
-     32, 34, 34, 41, 10,  9,  9,114,101,116,117,114,110, 32,115,
-     44, 32, 98, 44, 32,116,105,109,112,108, 10,  9,101,108,115,
-    101, 10,  9,  9,114,101,116,117,114,110, 32,115, 44, 32, 48,
-     44, 32,110,105,108, 10,  9,101,110,100, 10,101,110,100, 10,
-     10,102,117,110, 99,116,105,111,110, 32,114,101, 98,117,105,
-    108,100, 95,116,101,109,112,108, 97,116,101, 40,115, 44, 32,
-     98, 44, 32,116,105,109,112,108, 41, 10, 10,  9,105,102, 32,
-     98, 32, 61, 61, 32, 48, 32,116,104,101,110, 10,  9,  9,114,
-    101,116,117,114,110, 32,115, 10,  9,101,110,100, 10, 10,  9,
-    114,101,116,117,114,110, 32,115,116,114,105,110,103, 46,115,
-    117, 98, 40,115, 44, 32, 49, 44, 32, 98, 45, 49, 41, 46, 46,
-    116,105,109,112,108, 46, 46,115,116,114,105,110,103, 46,115,
-    117, 98, 40,115, 44, 32, 98, 44, 32, 45, 49, 41, 10,101,110,
-    100, 10, 10, 45, 45, 32, 80,114,105,110,116, 32,109,101,116,
-    104,111,100, 10,102,117,110, 99,116,105,111,110, 32, 99,108,
-     97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 58,
-    112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108,
-    111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101,
-    110,116, 46, 46, 34, 68,101, 99,108, 97,114, 97,116,105,111,
-    110,123, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,
-    110,116, 46, 46, 34, 32,109,111,100, 32, 32, 61, 32, 39, 34,
-     46, 46,115,101,108,102, 46,109,111,100, 46, 46, 34, 39, 44,
-     34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116,
-     46, 46, 34, 32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,
-    115,101,108,102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34,
-     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,
-     46, 34, 32,112,116,114, 32, 32, 61, 32, 39, 34, 46, 46,115,
-    101,108,102, 46,112,116,114, 46, 46, 34, 39, 44, 34, 41, 10,
-     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,
-     32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,
-    102, 46,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,
-    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,
-    100,105,109, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102,
-     46,100,105,109, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,
-    105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,100,101,
-    102, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,100,
-    101,102, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,
-    116, 40,105,100,101,110,116, 46, 46, 34, 32,114,101,116, 32,
-     32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,114,101,116,
-     46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,
-    105,100,101,110,116, 46, 46, 34,125, 34, 46, 46, 99,108,111,
-    115,101, 41, 10,101,110,100, 10, 10, 45, 45, 32, 99,104,101,
-     99,107, 32,105,102, 32, 97,114,114, 97,121, 32,111,102, 32,
-    118, 97,108,117,101,115, 32, 97,114,101, 32,114,101,116,117,
-    114,110,101,100, 32,116,111, 32, 76,117, 97, 10,102,117,110,
-     99,116,105,111,110, 32, 99,108, 97,115,115, 68,101, 99,108,
-     97,114, 97,116,105,111,110, 58,114,101,113,117,105,114,101,
-     99,111,108,108,101, 99,116,105,111,110, 32, 40,116, 41, 10,
-     32,105,102, 32,115,101,108,102, 46,109,111,100, 32,126, 61,
-     32, 39, 99,111,110,115,116, 39, 32, 97,110,100, 10,  9, 32,
-     32, 32, 32,115,101,108,102, 46,100,105,109, 32, 97,110,100,
-     32,115,101,108,102, 46,100,105,109, 32,126, 61, 32, 39, 39,
-     32, 97,110,100, 10,  9,  9,  9,  9, 32,110,111,116, 32,105,
-    115, 98, 97,115,105, 99, 40,115,101,108,102, 46,116,121,112,
-    101, 41, 32, 97,110,100, 10,  9,  9,  9,  9, 32,115,101,108,
-    102, 46,112,116,114, 32, 61, 61, 32, 39, 39, 32,116,104,101,
-    110, 10,  9,  9,108,111, 99, 97,108, 32,116,121,112,101, 32,
-     61, 32,103,115,117, 98, 40,115,101,108,102, 46,116,121,112,
-    101, 44, 34, 37,115, 42, 99,111,110,115,116, 37,115, 43, 34,
-     44, 34, 34, 41, 10,  9,  9,116, 91,116,121,112,101, 93, 32,
-     61, 32, 34,116,111,108,117, 97, 95, 99,111,108,108,101, 99,
-    116, 95, 34, 32, 46, 46, 32, 99,108,101, 97,110, 95,116,101,
-    109,112,108, 97,116,101, 40,116,121,112,101, 41, 10,  9,  9,
-    114,101,116,117,114,110, 32,116,114,117,101, 10,  9,101,110,
-    100, 10,  9,114,101,116,117,114,110, 32,102, 97,108,115,101,
-     10,101,110,100, 10, 10, 45, 45, 32,100,101, 99,108, 97,114,
-    101, 32,116, 97,103, 10,102,117,110, 99,116,105,111,110, 32,
-     99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,
-    110, 58,100,101, 99,108,116,121,112,101, 32, 40, 41, 10, 10,
-      9,115,101,108,102, 46,116,121,112,101, 32, 61, 32,116,121,
-    112,101,118, 97,114, 40,115,101,108,102, 46,116,121,112,101,
-     41, 10,  9,105,102, 32,115,116,114,102,105,110,100, 40,115,
-    101,108,102, 46,109,111,100, 44, 39, 99,111,110,115,116, 39,
-     41, 32,116,104,101,110, 10,  9,  9,115,101,108,102, 46,116,
-    121,112,101, 32, 61, 32, 39, 99,111,110,115,116, 32, 39, 46,
-     46,115,101,108,102, 46,116,121,112,101, 10,  9,  9,115,101,
-    108,102, 46,109,111,100, 32, 61, 32,103,115,117, 98, 40,115,
-    101,108,102, 46,109,111,100, 44, 39, 99,111,110,115,116, 37,
-    115, 42, 39, 44, 39, 39, 41, 10,  9,101,110,100, 10,101,110,
-    100, 10, 10, 10, 45, 45, 32,111,117,116,112,117,116, 32,116,
-    121,112,101, 32, 99,104,101, 99,107,105,110,103, 10,102,117,
-    110, 99,116,105,111,110, 32, 99,108, 97,115,115, 68,101, 99,
-    108, 97,114, 97,116,105,111,110, 58,111,117,116, 99,104,101,
-     99,107,116,121,112,101, 32, 40,110, 97,114,103, 41, 10, 32,
-    108,111, 99, 97,108, 32,100,101,102, 10, 32,108,111, 99, 97,
-    108, 32,116, 32, 61, 32,105,115, 98, 97,115,105, 99, 40,115,
-    101,108,102, 46,116,121,112,101, 41, 10, 32,105,102, 32,115,
-    101,108,102, 46,100,101,102,126, 61, 39, 39, 32,116,104,101,
-    110, 10, 32, 32,100,101,102, 32, 61, 32, 49, 10, 32,101,108,
-    115,101, 10, 32, 32,100,101,102, 32, 61, 32, 48, 10, 32,101,
-    110,100, 10, 32,105,102, 32,115,101,108,102, 46,100,105,109,
-     32,126, 61, 32, 39, 39, 32,116,104,101,110, 10,  9, 45, 45,
-    105,102, 32,116, 61, 61, 39,115,116,114,105,110,103, 39, 32,
-    116,104,101,110, 10,  9, 45, 45,  9,114,101,116,117,114,110,
-     32, 39,116,111,108,117, 97, 95,105,115,115,116,114,105,110,
-    103, 97,114,114, 97,121, 40,116,111,108,117, 97, 95, 83, 44,
-     39, 46, 46,110, 97,114,103, 46, 46, 39, 44, 39, 46, 46,100,
-    101,102, 46, 46, 39, 44, 38,116,111,108,117, 97, 95,101,114,
-    114, 41, 39, 10,  9, 45, 45,101,108,115,101, 10,  9,114,101,
-    116,117,114,110, 32, 39,116,111,108,117, 97, 95,105,115,116,
-     97, 98,108,101, 40,116,111,108,117, 97, 95, 83, 44, 39, 46,
-     46,110, 97,114,103, 46, 46, 39, 44, 48, 44, 38,116,111,108,
-    117, 97, 95,101,114,114, 41, 39, 10, 32,  9, 45, 45,101,110,
-    100, 10, 32,101,108,115,101,105,102, 32,116, 32,116,104,101,
-    110, 10,  9,114,101,116,117,114,110, 32, 39,116,111,108,117,
-     97, 95,105,115, 39, 46, 46,116, 46, 46, 39, 40,116,111,108,
-    117, 97, 95, 83, 44, 39, 46, 46,110, 97,114,103, 46, 46, 39,
-     44, 39, 46, 46,100,101,102, 46, 46, 39, 44, 38,116,111,108,
-    117, 97, 95,101,114,114, 41, 39, 10, 32,101,108,115,101, 10,
-     32, 32,114,101,116,117,114,110, 32, 39,116,111,108,117, 97,
-     95,105,115,117,115,101,114,116,121,112,101, 40,116,111,108,
-    117, 97, 95, 83, 44, 39, 46, 46,110, 97,114,103, 46, 46, 39,
-     44, 34, 39, 46, 46,115,101,108,102, 46,116,121,112,101, 46,
-     46, 39, 34, 44, 39, 46, 46,100,101,102, 46, 46, 39, 44, 38,
-    116,111,108,117, 97, 95,101,114,114, 41, 39, 10, 32,101,110,
-    100, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,110,
-     32, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116,105,
-    111,110, 58, 98,117,105,108,100,100,101, 99,108, 97,114, 97,
-    116,105,111,110, 32, 40,110, 97,114,103, 44, 32, 99,112,108,
-    117,115,112,108,117,115, 41, 10, 32,108,111, 99, 97,108, 32,
-     97,114,114, 97,121, 32, 61, 32,115,101,108,102, 46,100,105,
-    109, 32,126, 61, 32, 39, 39, 32, 97,110,100, 32,116,111,110,
-    117,109, 98,101,114, 40,115,101,108,102, 46,100,105,109, 41,
-     61, 61,110,105,108, 10,  9,108,111, 99, 97,108, 32,108,105,
-    110,101, 32, 61, 32, 34, 34, 10, 32,108,111, 99, 97,108, 32,
-    112,116,114, 32, 61, 32, 39, 39, 10,  9,108,111, 99, 97,108,
-     32,109,111,100, 10,  9,108,111, 99, 97,108, 32,116,121,112,
-    101, 32, 61, 32,115,101,108,102, 46,116,121,112,101, 10, 32,
-    105,102, 32,115,101,108,102, 46,100,105,109, 32,126, 61, 32,
-     39, 39, 32,116,104,101,110, 10,  9, 32,116,121,112,101, 32,
-     61, 32,103,115,117, 98, 40,115,101,108,102, 46,116,121,112,
-    101, 44, 39, 99,111,110,115,116, 37,115, 43, 39, 44, 39, 39,
-     41, 32, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101,
-    115, 32, 99,111,110,115,116, 32,109,111,100,105,102,105,101,
-    114, 32,102,111,114, 32, 97,114,114, 97,121,115, 10, 32,101,
-    110,100, 10, 32,105,102, 32,115,101,108,102, 46,112,116,114,
-    126, 61, 39, 39, 32, 97,110,100, 32,110,111,116, 32,105,115,
-     98, 97,115,105, 99, 40,116,121,112,101, 41, 32,116,104,101,
-    110, 32,112,116,114, 32, 61, 32, 39, 42, 39, 32,101,110,100,
-     10, 32,108,105,110,101, 32, 61, 32, 99,111,110, 99, 97,116,
-    112, 97,114, 97,109, 40,108,105,110,101, 44, 34, 32, 34, 44,
-    115,101,108,102, 46,109,111,100, 44,116,121,112,101, 44,112,
-    116,114, 41, 10, 32,105,102, 32, 97,114,114, 97,121, 32,116,
-    104,101,110, 10, 32, 32,108,105,110,101, 32, 61, 32, 99,111,
-    110, 99, 97,116,112, 97,114, 97,109, 40,108,105,110,101, 44,
-     39, 42, 39, 41, 10, 32,101,110,100, 10, 32,108,105,110,101,
-     32, 61, 32, 99,111,110, 99, 97,116,112, 97,114, 97,109, 40,
-    108,105,110,101, 44,115,101,108,102, 46,110, 97,109,101, 41,
-     10, 32,105,102, 32,115,101,108,102, 46,100,105,109, 32,126,
-     61, 32, 39, 39, 32,116,104,101,110, 10, 32, 32,105,102, 32,
-    116,111,110,117,109, 98,101,114, 40,115,101,108,102, 46,100,
-    105,109, 41,126, 61,110,105,108, 32,116,104,101,110, 10, 32,
-     32, 32,108,105,110,101, 32, 61, 32, 99,111,110, 99, 97,116,
-    112, 97,114, 97,109, 40,108,105,110,101, 44, 39, 91, 39, 44,
-    115,101,108,102, 46,100,105,109, 44, 39, 93, 59, 39, 41, 10,
-     32, 32,101,108,115,101, 10,  9,105,102, 32, 99,112,108,117,
-    115,112,108,117,115, 32,116,104,101,110, 10,  9,  9,108,105,
-    110,101, 32, 61, 32, 99,111,110, 99, 97,116,112, 97,114, 97,
-    109, 40,108,105,110,101, 44, 39, 32, 61, 32,110,101,119, 39,
-     44,116,121,112,101, 44,112,116,114, 44, 39, 91, 39, 46, 46,
-    115,101,108,102, 46,100,105,109, 46, 46, 39, 93, 59, 39, 41,
-     10,  9,101,108,115,101, 10,  9,  9,108,105,110,101, 32, 61,
-     32, 99,111,110, 99, 97,116,112, 97,114, 97,109, 40,108,105,
-    110,101, 44, 39, 32, 61, 32, 40, 39, 44,116,121,112,101, 44,
-    112,116,114, 44, 39, 42, 41, 39, 44, 10,  9,  9, 39,109, 97,
-    108,108,111, 99, 40, 40, 39, 44,115,101,108,102, 46,100,105,
-    109, 44, 39, 41, 42,115,105,122,101,111,102, 40, 39, 44,116,
-    121,112,101, 44,112,116,114, 44, 39, 41, 41, 59, 39, 41, 10,
-      9,101,110,100, 10, 32, 32,101,110,100, 10, 32,101,108,115,
-    101, 10, 32, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,105,
-    115, 98, 97,115,105, 99, 40,116,121,112,101, 41, 10, 32, 32,
-    108,105,110,101, 32, 61, 32, 99,111,110, 99, 97,116,112, 97,
-    114, 97,109, 40,108,105,110,101, 44, 39, 32, 61, 32, 39, 41,
-     10, 32, 32,105,102, 32,116, 32, 61, 61, 32, 39,115,116, 97,
-    116,101, 39, 32,116,104,101,110, 10, 32, 32,  9,108,105,110,
-    101, 32, 61, 32, 99,111,110, 99, 97,116,112, 97,114, 97,109,
-     40,108,105,110,101, 44, 32, 39,116,111,108,117, 97, 95, 83,
-     59, 39, 41, 10, 32, 32,101,108,115,101, 10, 32, 32,  9, 45,
-     45,112,114,105,110,116, 40, 34,116, 32,105,115, 32, 34, 46,
-     46,116,111,115,116,114,105,110,103, 40,116, 41, 46, 46, 34,
-     44, 32,112,116,114, 32,105,115, 32, 34, 46, 46,116,111,115,
-    116,114,105,110,103, 40,115,101,108,102, 46,112,116,114, 41,
-     41, 10, 32, 32,  9,105,102, 32,116, 32, 61, 61, 32, 39,110,
-    117,109, 98,101,114, 39, 32, 97,110,100, 32,115,116,114,105,
-    110,103, 46,102,105,110,100, 40,115,101,108,102, 46,112,116,
-    114, 44, 32, 34, 37, 42, 34, 41, 32,116,104,101,110, 10, 32,
-     32,  9,  9,116, 32, 61, 32, 39,117,115,101,114,100, 97,116,
-     97, 39, 10, 32, 32,  9,101,110,100, 10,  9,105,102, 32,110,
-    111,116, 32,116, 32, 97,110,100, 32,112,116,114, 61, 61, 39,
-     39, 32,116,104,101,110, 32,108,105,110,101, 32, 61, 32, 99,
-    111,110, 99, 97,116,112, 97,114, 97,109, 40,108,105,110,101,
-     44, 39, 42, 39, 41, 32,101,110,100, 10,  9,108,105,110,101,
-     32, 61, 32, 99,111,110, 99, 97,116,112, 97,114, 97,109, 40,
-    108,105,110,101, 44, 39, 40, 40, 39, 44,115,101,108,102, 46,
-    109,111,100, 44,116,121,112,101, 41, 10,  9,105,102, 32,110,
-    111,116, 32,116, 32,116,104,101,110, 10,  9,  9,108,105,110,
-    101, 32, 61, 32, 99,111,110, 99, 97,116,112, 97,114, 97,109,
-     40,108,105,110,101, 44, 39, 42, 39, 41, 10,  9,101,110,100,
-     10,  9,108,105,110,101, 32, 61, 32, 99,111,110, 99, 97,116,
-    112, 97,114, 97,109, 40,108,105,110,101, 44, 39, 41, 32, 39,
-     41, 10,  9,  9,  9,105,102, 32,105,115,101,110,117,109, 40,
-    116,121,112,101, 41, 32,116,104,101,110, 10,  9,  9,  9,108,
-    105,110,101, 32, 61, 32, 99,111,110, 99, 97,116,112, 97,114,
-     97,109, 40,108,105,110,101, 44, 39, 40,105,110,116, 41, 32,
-     39, 41, 10,  9,  9,  9,101,110,100, 10,  9,108,111, 99, 97,
-    108, 32,100,101,102, 32, 61, 32, 48, 10,  9,105,102, 32,115,
-    101,108,102, 46,100,101,102, 32,126, 61, 32, 39, 39, 32,116,
-    104,101,110, 10,  9,  9,100,101,102, 32, 61, 32,115,101,108,
-    102, 46,100,101,102, 10,  9,  9,105,102, 32, 40,112,116,114,
-     32, 61, 61, 32, 39, 39, 32,111,114, 32,115,101,108,102, 46,
-    112,116,114, 32, 61, 61, 32, 39, 38, 39, 41, 32, 97,110,100,
-     32,110,111,116, 32,116, 32,116,104,101,110, 10,  9,  9,  9,
-    100,101,102, 32, 61, 32, 34, 40,118,111,105,100, 42, 41, 38,
-     40, 99,111,110,115,116, 32, 34, 46, 46,116,121,112,101, 46,
-     46, 34, 41, 34, 46, 46,100,101,102, 10,  9,  9,101,110,100,
-     10,  9,101,110,100, 10,  9,105,102, 32,116, 32,116,104,101,
-    110, 10,  9,108,105,110,101, 32, 61, 32, 99,111,110, 99, 97,
-    116,112, 97,114, 97,109, 40,108,105,110,101, 44, 39,116,111,
-    108,117, 97, 95,116,111, 39, 46, 46,116, 44, 39, 40,116,111,
-    108,117, 97, 95, 83, 44, 39, 44,110, 97,114,103, 44, 39, 44,
-     39, 44,100,101,102, 44, 39, 41, 41, 59, 39, 41, 10,  9,101,
-    108,115,101, 10,  9,108,105,110,101, 32, 61, 32, 99,111,110,
-     99, 97,116,112, 97,114, 97,109, 40,108,105,110,101, 44, 39,
-    116,111,108,117, 97, 95,116,111,117,115,101,114,116,121,112,
-    101, 40,116,111,108,117, 97, 95, 83, 44, 39, 44,110, 97,114,
-    103, 44, 39, 44, 39, 44,100,101,102, 44, 39, 41, 41, 59, 39,
-     41, 10,  9,101,110,100, 10, 32, 32,101,110,100, 10, 32,101,
-    110,100, 10,  9,114,101,116,117,114,110, 32,108,105,110,101,
-     10,101,110,100, 10, 10, 45, 45, 32, 68,101, 99,108, 97,114,
-    101, 32,118, 97,114,105, 97, 98,108,101, 10,102,117,110, 99,
-    116,105,111,110, 32, 99,108, 97,115,115, 68,101, 99,108, 97,
-    114, 97,116,105,111,110, 58,100,101, 99,108, 97,114,101, 32,
-     40,110, 97,114,103, 41, 10, 32,105,102, 32,115,101,108,102,
-     46,100,105,109, 32,126, 61, 32, 39, 39, 32, 97,110,100, 32,
-    116,111,110,117,109, 98,101,114, 40,115,101,108,102, 46,100,
-    105,109, 41, 61, 61,110,105,108, 32,116,104,101,110, 10,  9,
-     32,111,117,116,112,117,116, 40, 39, 35,105,102,100,101,102,
-     32, 95, 95, 99,112,108,117,115,112,108,117,115, 92,110, 39,
-     41, 10,  9,  9,111,117,116,112,117,116, 40,115,101,108,102,
-     58, 98,117,105,108,100,100,101, 99,108, 97,114, 97,116,105,
-    111,110, 40,110, 97,114,103, 44,116,114,117,101, 41, 41, 10,
-      9,  9,111,117,116,112,117,116, 40, 39, 35,101,108,115,101,
-     92,110, 39, 41, 10,  9,  9,111,117,116,112,117,116, 40,115,
-    101,108,102, 58, 98,117,105,108,100,100,101, 99,108, 97,114,
-     97,116,105,111,110, 40,110, 97,114,103, 44,102, 97,108,115,
-    101, 41, 41, 10,  9, 32,111,117,116,112,117,116, 40, 39, 35,
-    101,110,100,105,102, 92,110, 39, 41, 10,  9,101,108,115,101,
-     10,  9,  9,111,117,116,112,117,116, 40,115,101,108,102, 58,
-     98,117,105,108,100,100,101, 99,108, 97,114, 97,116,105,111,
-    110, 40,110, 97,114,103, 44,102, 97,108,115,101, 41, 41, 10,
-      9,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32, 71,101,
-    116, 32,112, 97,114, 97,109,101,116,101,114, 32,118, 97,108,
-    117,101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,
-    115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 58,103,
-    101,116, 97,114,114, 97,121, 32, 40,110, 97,114,103, 41, 10,
-     32,105,102, 32,115,101,108,102, 46,100,105,109, 32,126, 61,
-     32, 39, 39, 32,116,104,101,110, 10,  9, 32,108,111, 99, 97,
-    108, 32,116,121,112,101, 32, 61, 32,103,115,117, 98, 40,115,
-    101,108,102, 46,116,121,112,101, 44, 39, 99,111,110,115,116,
-     32, 39, 44, 39, 39, 41, 10, 32, 32,111,117,116,112,117,116,
-     40, 39, 32, 32,123, 39, 41, 10,  9, 32,111,117,116,112,117,
-    116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85,
-     65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10, 32,
-     32,108,111, 99, 97,108, 32,100,101,102, 59, 32,105,102, 32,
-    115,101,108,102, 46,100,101,102,126, 61, 39, 39, 32,116,104,
-    101,110, 32,100,101,102, 61, 49, 32,101,108,115,101, 32,100,
-    101,102, 61, 48, 32,101,110,100, 10,  9,  9,108,111, 99, 97,
-    108, 32,116, 32, 61, 32,105,115, 98, 97,115,105, 99, 40,116,
-    121,112,101, 41, 10,  9,  9,105,102, 32, 40,116, 41, 32,116,
-    104,101,110, 10, 32, 32, 32,111,117,116,112,117,116, 40, 39,
-     32, 32, 32,105,102, 32, 40, 33,116,111,108,117, 97, 95,105,
-    115, 39, 46, 46,116, 46, 46, 39, 97,114,114, 97,121, 40,116,
-    111,108,117, 97, 95, 83, 44, 39, 44,110, 97,114,103, 44, 39,
-     44, 39, 44,115,101,108,102, 46,100,105,109, 44, 39, 44, 39,
-     44,100,101,102, 44, 39, 44, 38,116,111,108,117, 97, 95,101,
-    114,114, 41, 41, 39, 41, 10,  9,  9,101,108,115,101, 10, 32,
-     32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,105,102,
-     32, 40, 33,116,111,108,117, 97, 95,105,115,117,115,101,114,
-    116,121,112,101, 97,114,114, 97,121, 40,116,111,108,117, 97,
-     95, 83, 44, 39, 44,110, 97,114,103, 44, 39, 44, 34, 39, 44,
-    116,121,112,101, 44, 39, 34, 44, 39, 44,115,101,108,102, 46,
-    100,105,109, 44, 39, 44, 39, 44,100,101,102, 44, 39, 44, 38,
-    116,111,108,117, 97, 95,101,114,114, 41, 41, 39, 41, 10,  9,
-      9,101,110,100, 10, 32, 32,111,117,116,112,117,116, 40, 39,
-     32, 32, 32, 32,103,111,116,111, 32,116,111,108,117, 97, 95,
-    108,101,114,114,111,114, 59, 39, 41, 10, 32, 32,111,117,116,
-    112,117,116, 40, 39, 32, 32, 32,101,108,115,101, 92,110, 39,
-     41, 10,  9, 32,111,117,116,112,117,116, 40, 39, 35,101,110,
-    100,105,102, 92,110, 39, 41, 10, 32, 32,111,117,116,112,117,
-    116, 40, 39, 32, 32, 32,123, 39, 41, 10, 32, 32,111,117,116,
-    112,117,116, 40, 39, 32, 32, 32, 32,105,110,116, 32,105, 59,
-     39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32,
-     32, 32,102,111,114, 40,105, 61, 48, 59, 32,105, 60, 39, 46,
-     46,115,101,108,102, 46,100,105,109, 46, 46, 39, 59,105, 43,
-     43, 41, 39, 41, 10, 32, 32,108,111, 99, 97,108, 32,116, 32,
-     61, 32,105,115, 98, 97,115,105, 99, 40,116,121,112,101, 41,
-     10, 32, 32,108,111, 99, 97,108, 32,112,116,114, 32, 61, 32,
-     39, 39, 10, 32, 32,105,102, 32,115,101,108,102, 46,112,116,
-    114,126, 61, 39, 39, 32,116,104,101,110, 32,112,116,114, 32,
-     61, 32, 39, 42, 39, 32,101,110,100, 10, 32, 32,111,117,116,
-    112,117,116, 40, 39, 32, 32, 32, 39, 44,115,101,108,102, 46,
-    110, 97,109,101, 46, 46, 39, 91,105, 93, 32, 61, 32, 39, 41,
-     10, 32, 32,105,102, 32,110,111,116, 32,116, 32, 97,110,100,
-     32,112,116,114, 61, 61, 39, 39, 32,116,104,101,110, 32,111,
-    117,116,112,117,116, 40, 39, 42, 39, 41, 32,101,110,100, 10,
-     32, 32,111,117,116,112,117,116, 40, 39, 40, 40, 39, 44,116,
-    121,112,101, 41, 10, 32, 32,105,102, 32,110,111,116, 32,116,
-     32,116,104,101,110, 10, 32, 32, 32,111,117,116,112,117,116,
-     40, 39, 42, 39, 41, 10, 32, 32,101,110,100, 10, 32, 32,111,
-    117,116,112,117,116, 40, 39, 41, 32, 39, 41, 10, 32, 32,108,
-    111, 99, 97,108, 32,100,101,102, 32, 61, 32, 48, 10, 32, 32,
-    105,102, 32,115,101,108,102, 46,100,101,102, 32,126, 61, 32,
-     39, 39, 32,116,104,101,110, 32,100,101,102, 32, 61, 32,115,
-    101,108,102, 46,100,101,102, 32,101,110,100, 10, 32, 32,105,
-    102, 32,116, 32,116,104,101,110, 10, 32, 32, 32,111,117,116,
-    112,117,116, 40, 39,116,111,108,117, 97, 95,116,111,102,105,
-    101,108,100, 39, 46, 46,116, 46, 46, 39, 40,116,111,108,117,
-     97, 95, 83, 44, 39, 44,110, 97,114,103, 44, 39, 44,105, 43,
-     49, 44, 39, 44,100,101,102, 44, 39, 41, 41, 59, 39, 41, 10,
-     32, 32,101,108,115,101, 10, 32, 32, 32,111,117,116,112,117,
-    116, 40, 39,116,111,108,117, 97, 95,116,111,102,105,101,108,
-    100,117,115,101,114,116,121,112,101, 40,116,111,108,117, 97,
-     95, 83, 44, 39, 44,110, 97,114,103, 44, 39, 44,105, 43, 49,
-     44, 39, 44,100,101,102, 44, 39, 41, 41, 59, 39, 41, 10, 32,
-     32,101,110,100, 10, 32, 32,111,117,116,112,117,116, 40, 39,
-     32, 32, 32,125, 39, 41, 10, 32, 32,111,117,116,112,117,116,
-     40, 39, 32, 32,125, 39, 41, 10, 32,101,110,100, 10,101,110,
-    100, 10, 10, 45, 45, 32, 71,101,116, 32,112, 97,114, 97,109,
-    101,116,101,114, 32,118, 97,108,117,101, 10,102,117,110, 99,
-    116,105,111,110, 32, 99,108, 97,115,115, 68,101, 99,108, 97,
-    114, 97,116,105,111,110, 58,115,101,116, 97,114,114, 97,121,
-     32, 40,110, 97,114,103, 41, 10, 32,105,102, 32,110,111,116,
-     32,115,116,114,102,105,110,100, 40,115,101,108,102, 46,116,
-    121,112,101, 44, 39, 99,111,110,115,116, 37,115, 43, 39, 41,
-     32, 97,110,100, 32,115,101,108,102, 46,100,105,109, 32,126,
-     61, 32, 39, 39, 32,116,104,101,110, 10,  9, 32,108,111, 99,
-     97,108, 32,116,121,112,101, 32, 61, 32,103,115,117, 98, 40,
-    115,101,108,102, 46,116,121,112,101, 44, 39, 99,111,110,115,
-    116, 32, 39, 44, 39, 39, 41, 10, 32, 32,111,117,116,112,117,
-    116, 40, 39, 32, 32,123, 39, 41, 10, 32, 32,111,117,116,112,
-    117,116, 40, 39, 32, 32, 32,105,110,116, 32,105, 59, 39, 41,
-     10, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,102,
-    111,114, 40,105, 61, 48, 59, 32,105, 60, 39, 46, 46,115,101,
-    108,102, 46,100,105,109, 46, 46, 39, 59,105, 43, 43, 41, 39,
-     41, 10, 32, 32,108,111, 99, 97,108, 32,116, 44, 99,116, 32,
-     61, 32,105,115, 98, 97,115,105, 99, 40,116,121,112,101, 41,
-     10, 32, 32,105,102, 32,116, 32,116,104,101,110, 10, 32, 32,
-     32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,116,111,
-    108,117, 97, 95,112,117,115,104,102,105,101,108,100, 39, 46,
-     46,116, 46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 39,
-     44,110, 97,114,103, 44, 39, 44,105, 43, 49, 44, 40, 39, 44,
-     99,116, 44, 39, 41, 39, 44,115,101,108,102, 46,110, 97,109,
-    101, 44, 39, 91,105, 93, 41, 59, 39, 41, 10, 32, 32,101,108,
-    115,101, 10, 32, 32, 32,105,102, 32,115,101,108,102, 46,112,
-    116,114, 32, 61, 61, 32, 39, 39, 32,116,104,101,110, 10, 32,
-     32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,
-    123, 39, 41, 10, 32, 32, 32, 32, 32,111,117,116,112,117,116,
-     40, 39, 35,105,102,100,101,102, 32, 95, 95, 99,112,108,117,
-    115,112,108,117,115, 92,110, 39, 41, 10, 32, 32, 32, 32, 32,
-    111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,118,111,105,
-    100, 42, 32,116,111,108,117, 97, 95,111, 98,106, 32, 61, 32,
-    110,101,119, 39, 44,116,121,112,101, 44, 39, 40, 39, 44,115,
-    101,108,102, 46,110, 97,109,101, 44, 39, 91,105, 93, 41, 59,
-     39, 41, 10, 32, 32, 32, 32, 32,111,117,116,112,117,116, 40,
-     39, 32, 32, 32, 32,116,111,108,117, 97, 95,112,117,115,104,
-    102,105,101,108,100,117,115,101,114,116,121,112,101, 95, 97,
-    110,100, 95,116, 97,107,101,111,119,110,101,114,115,104,105,
-    112, 40,116,111,108,117, 97, 95, 83, 44, 39, 44,110, 97,114,
-    103, 44, 39, 44,105, 43, 49, 44,116,111,108,117, 97, 95,111,
-     98,106, 44, 34, 39, 44,116,121,112,101, 44, 39, 34, 41, 59,
-     39, 41, 10, 32, 32, 32, 32, 32,111,117,116,112,117,116, 40,
-     39, 35,101,108,115,101, 92,110, 39, 41, 10, 32, 32, 32, 32,
-     32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,118,111,
-    105,100, 42, 32,116,111,108,117, 97, 95,111, 98,106, 32, 61,
-     32,116,111,108,117, 97, 95, 99,111,112,121, 40,116,111,108,
-    117, 97, 95, 83, 44, 40,118,111,105,100, 42, 41, 38, 39, 44,
-    115,101,108,102, 46,110, 97,109,101, 44, 39, 91,105, 93, 44,
-    115,105,122,101,111,102, 40, 39, 44,116,121,112,101, 44, 39,
-     41, 41, 59, 39, 41, 10, 32, 32, 32, 32, 32,111,117,116,112,
-    117,116, 40, 39, 32, 32, 32, 32,116,111,108,117, 97, 95,112,
-    117,115,104,102,105,101,108,100,117,115,101,114,116,121,112,
-    101, 40,116,111,108,117, 97, 95, 83, 44, 39, 44,110, 97,114,
-    103, 44, 39, 44,105, 43, 49, 44,116,111,108,117, 97, 95,111,
-     98,106, 44, 34, 39, 44,116,121,112,101, 44, 39, 34, 41, 59,
-     39, 41, 10, 32, 32, 32, 32, 32,111,117,116,112,117,116, 40,
-     39, 35,101,110,100,105,102, 92,110, 39, 41, 10, 32, 32, 32,
-     32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,125, 39,
-     41, 10, 32, 32, 32,101,108,115,101, 10, 32, 32, 32, 32,111,
-    117,116,112,117,116, 40, 39, 32, 32, 32,116,111,108,117, 97,
-     95,112,117,115,104,102,105,101,108,100,117,115,101,114,116,
-    121,112,101, 40,116,111,108,117, 97, 95, 83, 44, 39, 44,110,
-     97,114,103, 44, 39, 44,105, 43, 49, 44, 40,118,111,105,100,
-     42, 41, 39, 44,115,101,108,102, 46,110, 97,109,101, 44, 39,
-     91,105, 93, 44, 34, 39, 44,116,121,112,101, 44, 39, 34, 41,
-     59, 39, 41, 10, 32, 32, 32,101,110,100, 10, 32, 32,101,110,
-    100, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32,125,
-     39, 41, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45,
-     32, 70,114,101,101, 32,100,121,110, 97,109,105, 99, 97,108,
-    108,121, 32, 97,108,108,111, 99, 97,116,101,100, 32, 97,114,
-    114, 97,121, 10,102,117,110, 99,116,105,111,110, 32, 99,108,
-     97,115,115, 68,101, 99,108, 97,114, 97,116,105,111,110, 58,
-    102,114,101,101, 97,114,114, 97,121, 32, 40, 41, 10, 32,105,
-    102, 32,115,101,108,102, 46,100,105,109, 32,126, 61, 32, 39,
-     39, 32, 97,110,100, 32,116,111,110,117,109, 98,101,114, 40,
-    115,101,108,102, 46,100,105,109, 41, 61, 61,110,105,108, 32,
-    116,104,101,110, 10,  9, 32,111,117,116,112,117,116, 40, 39,
-     35,105,102,100,101,102, 32, 95, 95, 99,112,108,117,115,112,
-    108,117,115, 92,110, 39, 41, 10,  9,  9,111,117,116,112,117,
-    116, 40, 39, 32, 32,100,101,108,101,116,101, 32, 91, 93, 39,
-     44,115,101,108,102, 46,110, 97,109,101, 44, 39, 59, 39, 41,
-     10,  9, 32,111,117,116,112,117,116, 40, 39, 35,101,108,115,
-    101, 92,110, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40,
-     39, 32, 32,102,114,101,101, 40, 39, 44,115,101,108,102, 46,
-    110, 97,109,101, 44, 39, 41, 59, 39, 41, 10,  9, 32,111,117,
-    116,112,117,116, 40, 39, 35,101,110,100,105,102, 92,110, 39,
-     41, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32,
-     80, 97,115,115, 32,112, 97,114, 97,109,101,116,101,114, 10,
-    102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115, 68,
-    101, 99,108, 97,114, 97,116,105,111,110, 58,112, 97,115,115,
-    112, 97,114, 32, 40, 41, 10, 32,105,102, 32,115,101,108,102,
-     46,112,116,114, 61, 61, 39, 38, 39, 32, 97,110,100, 32,110,
-    111,116, 32,105,115, 98, 97,115,105, 99, 40,115,101,108,102,
-     46,116,121,112,101, 41, 32,116,104,101,110, 10, 32, 32,111,
-    117,116,112,117,116, 40, 39, 42, 39, 46, 46,115,101,108,102,
-     46,110, 97,109,101, 41, 10, 32,101,108,115,101,105,102, 32,
-    115,101,108,102, 46,114,101,116, 61, 61, 39, 42, 39, 32,116,
-    104,101,110, 10, 32, 32,111,117,116,112,117,116, 40, 39, 38,
-     39, 46, 46,115,101,108,102, 46,110, 97,109,101, 41, 10, 32,
-    101,108,115,101, 10, 32, 32,111,117,116,112,117,116, 40,115,
-    101,108,102, 46,110, 97,109,101, 41, 10, 32,101,110,100, 10,
-    101,110,100, 10, 10, 45, 45, 32, 82,101,116,117,114,110, 32,
-    112, 97,114, 97,109,101,116,101,114, 32,118, 97,108,117,101,
-     10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,115,
-     68,101, 99,108, 97,114, 97,116,105,111,110, 58,114,101,116,
-    118, 97,108,117,101, 32, 40, 41, 10, 32,105,102, 32,115,101,
-    108,102, 46,114,101,116, 32,126, 61, 32, 39, 39, 32,116,104,
-    101,110, 10, 32, 32,108,111, 99, 97,108, 32,116, 44, 99,116,
-     32, 61, 32,105,115, 98, 97,115,105, 99, 40,115,101,108,102,
-     46,116,121,112,101, 41, 10, 32, 32,105,102, 32,116, 32, 97,
-    110,100, 32,116,126, 61, 39, 39, 32,116,104,101,110, 10, 32,
-     32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,116,111,
-    108,117, 97, 95,112,117,115,104, 39, 46, 46,116, 46, 46, 39,
-     40,116,111,108,117, 97, 95, 83, 44, 40, 39, 44, 99,116, 44,
-     39, 41, 39, 46, 46,115,101,108,102, 46,110, 97,109,101, 46,
-     46, 39, 41, 59, 39, 41, 10, 32, 32,101,108,115,101, 10, 32,
-     32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,116,111,
-    108,117, 97, 95,112,117,115,104,117,115,101,114,116,121,112,
-    101, 40,116,111,108,117, 97, 95, 83, 44, 40,118,111,105,100,
-     42, 41, 39, 46, 46,115,101,108,102, 46,110, 97,109,101, 46,
-     46, 39, 44, 34, 39, 44,115,101,108,102, 46,116,121,112,101,
-     44, 39, 34, 41, 59, 39, 41, 10, 32, 32,101,110,100, 10, 32,
-     32,114,101,116,117,114,110, 32, 49, 10, 32,101,110,100, 10,
-     32,114,101,116,117,114,110, 32, 48, 10,101,110,100, 10, 10,
-     45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99,111,110,
-    115,116,114,117, 99,116,111,114, 10,102,117,110, 99,116,105,
-    111,110, 32, 95, 68,101, 99,108, 97,114, 97,116,105,111,110,
-     32, 40,116, 41, 10, 10, 32,115,101,116,109,101,116, 97,116,
-     97, 98,108,101, 40,116, 44, 99,108, 97,115,115, 68,101, 99,
-    108, 97,114, 97,116,105,111,110, 41, 10, 32,116, 58, 98,117,
-    105,108,100,110, 97,109,101,115, 40, 41, 10, 32,116, 58, 99,
-    104,101, 99,107,110, 97,109,101, 40, 41, 10, 32,116, 58, 99,
-    104,101, 99,107,116,121,112,101, 40, 41, 10, 32,108,111, 99,
-     97,108, 32,102,116, 32, 61, 32,102,105,110,100,116,121,112,
-    101, 40,116, 46,116,121,112,101, 41, 32,111,114, 32,116, 46,
-    116,121,112,101, 10, 32,105,102, 32,110,111,116, 32,105,115,
-    101,110,117,109, 40,102,116, 41, 32,116,104,101,110, 10,  9,
-    116, 46,109,111,100, 44, 32,116, 46,116,121,112,101, 32, 61,
-     32, 97,112,112,108,121,116,121,112,101,100,101,102, 40,116,
-     46,109,111,100, 44, 32,102,116, 41, 10, 32,101,110,100, 10,
-     10, 32,105,102, 32,116, 46,107,105,110,100, 61, 61, 34,118,
-     97,114, 34, 32, 97,110,100, 32, 40,115,116,114,105,110,103,
-     46,102,105,110,100, 40,116, 46,109,111,100, 44, 32, 34,116,
-    111,108,117, 97, 95,112,114,111,112,101,114,116,121, 37,115,
-     34, 41, 32,111,114, 32,115,116,114,105,110,103, 46,102,105,
-    110,100, 40,116, 46,109,111,100, 44, 32, 34,116,111,108,117,
-     97, 95,112,114,111,112,101,114,116,121, 36, 34, 41, 41, 32,
-    116,104,101,110, 10, 32,  9,116, 46,109,111,100, 32, 61, 32,
-    115,116,114,105,110,103, 46,103,115,117, 98, 40,116, 46,109,
-    111,100, 44, 32, 34,116,111,108,117, 97, 95,112,114,111,112,
-    101,114,116,121, 34, 44, 32, 34,116,111,108,117, 97, 95,112,
-    114,111,112,101,114,116,121, 95, 95, 34, 46, 46,103,101,116,
-     95,112,114,111,112,101,114,116,121, 95,116,121,112,101, 40,
-     41, 41, 10, 32,101,110,100, 10, 10, 32,114,101,116,117,114,
-    110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67,111,110,
-    115,116,114,117, 99,116,111,114, 10, 45, 45, 32, 69,120,112,
-    101, 99,116,115, 32,116,104,101, 32,115,116,114,105,110,103,
-     32,100,101, 99,108, 97,114, 97,116,105,111,110, 46, 10, 45,
-     45, 32, 84,104,101, 32,107,105,110,100, 32,111,102, 32,100,
-    101, 99,108, 97,114, 97,116,105,111,110, 32, 99, 97,110, 32,
-     98,101, 32, 34,118, 97,114, 34, 32,111,114, 32, 34,102,117,
-    110, 99, 34, 46, 10,102,117,110, 99,116,105,111,110, 32, 68,
-    101, 99,108, 97,114, 97,116,105,111,110, 32, 40,115, 44,107,
-    105,110,100, 44,105,115, 95,112, 97,114, 97,109,101,116,101,
-    114, 41, 10, 10, 32, 45, 45, 32,101,108,105,109,105,110, 97,
-    116,101, 32,115,112, 97, 99,101,115, 32,105,102, 32,100,101,
-    102, 97,117,108,116, 32,118, 97,108,117,101, 32,105,115, 32,
-    112,114,111,118,105,100,101,100, 10, 32,115, 32, 61, 32,103,
-    115,117, 98, 40,115, 44, 34, 37,115, 42, 61, 37,115, 42, 34,
-     44, 34, 61, 34, 41, 10, 32,115, 32, 61, 32,103,115,117, 98,
-     40,115, 44, 32, 34, 37,115, 42, 60, 34, 44, 32, 34, 60, 34,
-     41, 10, 10, 32,108,111, 99, 97,108, 32,100,101,102, 98, 44,
-    116,109,112,100,101,102, 10, 32,100,101,102, 98, 44, 95, 44,
-    116,109,112,100,101,102, 32, 61, 32,115,116,114,105,110,103,
-     46,102,105,110,100, 40,115, 44, 32, 34, 40, 61, 46, 42, 41,
-     36, 34, 41, 10, 32,105,102, 32,100,101,102, 98, 32,116,104,
-    101,110, 10, 32,  9,115, 32, 61, 32,115,116,114,105,110,103,
-     46,103,115,117, 98, 40,115, 44, 32, 34, 61, 46, 42, 36, 34,
-     44, 32, 34, 34, 41, 10, 32,101,108,115,101, 10, 32,  9,116,
-    109,112,100,101,102, 32, 61, 32, 39, 39, 10, 32,101,110,100,
-     10, 32,105,102, 32,107,105,110,100, 32, 61, 61, 32, 34,118,
-     97,114, 34, 32,116,104,101,110, 10, 32, 32, 45, 45, 32, 99,
-    104,101, 99,107, 32,116,104,101, 32,102,111,114,109, 58, 32,
-    118,111,105,100, 10, 32, 32,105,102, 32,115, 32, 61, 61, 32,
-     39, 39, 32,111,114, 32,115, 32, 61, 61, 32, 39,118,111,105,
-    100, 39, 32,116,104,101,110, 10, 32, 32, 32,114,101,116,117,
-    114,110, 32, 95, 68,101, 99,108, 97,114, 97,116,105,111,110,
-    123,116,121,112,101, 32, 61, 32, 39,118,111,105,100, 39, 44,
-     32,107,105,110,100, 32, 61, 32,107,105,110,100, 44, 32,105,
-    115, 95,112, 97,114, 97,109,101,116,101,114, 32, 61, 32,105,
-    115, 95,112, 97,114, 97,109,101,116,101,114,125, 10, 32, 32,
-    101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45, 32, 99,
-    104,101, 99,107, 32,116,104,101, 32,102,111,114,109, 58, 32,
-    109,111,100, 32,116,121,112,101, 42, 38, 32,110, 97,109,101,
-     10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,115,112,108,
-    105,116, 95, 99, 95,116,111,107,101,110,115, 40,115, 44, 39,
-     37, 42, 37,115, 42, 38, 39, 41, 10, 32,105,102, 32,116, 46,
-    110, 32, 61, 61, 32, 50, 32,116,104,101,110, 10, 32, 32,105,
-    102, 32,107,105,110,100, 32, 61, 61, 32, 39,102,117,110, 99,
-     39, 32,116,104,101,110, 10, 32, 32, 32,101,114,114,111,114,
-     40, 34, 35,105,110,118, 97,108,105,100, 32,102,117,110, 99,
-    116,105,111,110, 32,114,101,116,117,114,110, 32,116,121,112,
-    101, 58, 32, 34, 46, 46,115, 41, 10, 32, 32,101,110,100, 10,
-     32, 32, 45, 45,108,111, 99, 97,108, 32,109, 32, 61, 32,115,
-    112,108,105,116, 40,116, 91, 49, 93, 44, 39, 37,115, 37,115,
-     42, 39, 41, 10, 32, 32,108,111, 99, 97,108, 32,109, 32, 61,
-     32,115,112,108,105,116, 95, 99, 95,116,111,107,101,110,115,
-     40,116, 91, 49, 93, 44, 39, 37,115, 43, 39, 41, 10, 32, 32,
-    114,101,116,117,114,110, 32, 95, 68,101, 99,108, 97,114, 97,
-    116,105,111,110,123, 10, 32, 32, 32,110, 97,109,101, 32, 61,
-     32,116, 91, 50, 93, 46, 46,116,109,112,100,101,102, 44, 10,
-     32, 32, 32,112,116,114, 32, 61, 32, 39, 42, 39, 44, 10, 32,
-     32, 32,114,101,116, 32, 61, 32, 39, 38, 39, 44, 10, 32, 32,
-     32, 45, 45,116,121,112,101, 32, 61, 32,114,101, 98,117,105,
-    108,100, 95,116,101,109,112,108, 97,116,101, 40,109, 91,109,
-     46,110, 93, 44, 32,116, 98, 44, 32,116,105,109,112,108, 41,
-     44, 10, 32, 32, 32,116,121,112,101, 32, 61, 32,109, 91,109,
-     46,110, 93, 44, 10, 32, 32, 32,109,111,100, 32, 61, 32, 99,
-    111,110, 99, 97,116, 40,109, 44, 49, 44,109, 46,110, 45, 49,
-     41, 44, 10, 32, 32, 32,105,115, 95,112, 97,114, 97,109,101,
-    116,101,114, 32, 61, 32,105,115, 95,112, 97,114, 97,109,101,
-    116,101,114, 44, 10, 32, 32, 32,107,105,110,100, 32, 61, 32,
-    107,105,110,100, 10, 32, 32,125, 10, 32,101,110,100, 10, 10,
-     32, 45, 45, 32, 99,104,101, 99,107, 32,116,104,101, 32,102,
-    111,114,109, 58, 32,109,111,100, 32,116,121,112,101, 42, 42,
-     32,110, 97,109,101, 10, 32,116, 32, 61, 32,115,112,108,105,
-    116, 95, 99, 95,116,111,107,101,110,115, 40,115, 44, 39, 37,
-     42, 37,115, 42, 37, 42, 39, 41, 10, 32,105,102, 32,116, 46,
-    110, 32, 61, 61, 32, 50, 32,116,104,101,110, 10, 32, 32,105,
-    102, 32,107,105,110,100, 32, 61, 61, 32, 39,102,117,110, 99,
-     39, 32,116,104,101,110, 10, 32, 32, 32,101,114,114,111,114,
-     40, 34, 35,105,110,118, 97,108,105,100, 32,102,117,110, 99,
-    116,105,111,110, 32,114,101,116,117,114,110, 32,116,121,112,
-    101, 58, 32, 34, 46, 46,115, 41, 10, 32, 32,101,110,100, 10,
-     32, 32, 45, 45,108,111, 99, 97,108, 32,109, 32, 61, 32,115,
-    112,108,105,116, 40,116, 91, 49, 93, 44, 39, 37,115, 37,115,
-     42, 39, 41, 10, 32, 32,108,111, 99, 97,108, 32,109, 32, 61,
-     32,115,112,108,105,116, 95, 99, 95,116,111,107,101,110,115,
-     40,116, 91, 49, 93, 44, 39, 37,115, 43, 39, 41, 10, 32, 32,
-    114,101,116,117,114,110, 32, 95, 68,101, 99,108, 97,114, 97,
-    116,105,111,110,123, 10, 32, 32, 32,110, 97,109,101, 32, 61,
-     32,116, 91, 50, 93, 46, 46,116,109,112,100,101,102, 44, 10,
-     32, 32, 32,112,116,114, 32, 61, 32, 39, 42, 39, 44, 10, 32,
-     32, 32,114,101,116, 32, 61, 32, 39, 42, 39, 44, 10, 32, 32,
-     32, 45, 45,116,121,112,101, 32, 61, 32,114,101, 98,117,105,
-    108,100, 95,116,101,109,112,108, 97,116,101, 40,109, 91,109,
-     46,110, 93, 44, 32,116, 98, 44, 32,116,105,109,112,108, 41,
-     44, 10, 32, 32, 32,116,121,112,101, 32, 61, 32,109, 91,109,
-     46,110, 93, 44, 10, 32, 32, 32,109,111,100, 32, 61, 32, 99,
-    111,110, 99, 97,116, 40,109, 44, 49, 44,109, 46,110, 45, 49,
-     41, 44, 10, 32, 32, 32,105,115, 95,112, 97,114, 97,109,101,
-    116,101,114, 32, 61, 32,105,115, 95,112, 97,114, 97,109,101,
-    116,101,114, 44, 10, 32, 32, 32,107,105,110,100, 32, 61, 32,
-    107,105,110,100, 10, 32, 32,125, 10, 32,101,110,100, 10, 10,
-     32, 45, 45, 32, 99,104,101, 99,107, 32,116,104,101, 32,102,
-    111,114,109, 58, 32,109,111,100, 32,116,121,112,101, 38, 32,
-    110, 97,109,101, 10, 32,116, 32, 61, 32,115,112,108,105,116,
-     95, 99, 95,116,111,107,101,110,115, 40,115, 44, 39, 38, 39,
-     41, 10, 32,105,102, 32,116, 46,110, 32, 61, 61, 32, 50, 32,
-    116,104,101,110, 10, 32, 32, 45, 45,108,111, 99, 97,108, 32,
-    109, 32, 61, 32,115,112,108,105,116, 40,116, 91, 49, 93, 44,
-     39, 37,115, 37,115, 42, 39, 41, 10, 32, 32,108,111, 99, 97,
-    108, 32,109, 32, 61, 32,115,112,108,105,116, 95, 99, 95,116,
-    111,107,101,110,115, 40,116, 91, 49, 93, 44, 39, 37,115, 43,
-     39, 41, 10, 32, 32,114,101,116,117,114,110, 32, 95, 68,101,
-     99,108, 97,114, 97,116,105,111,110,123, 10, 32, 32, 32,110,
-     97,109,101, 32, 61, 32,116, 91, 50, 93, 46, 46,116,109,112,
-    100,101,102, 44, 10, 32, 32, 32,112,116,114, 32, 61, 32, 39,
-     38, 39, 44, 10, 32, 32, 32, 45, 45,116,121,112,101, 32, 61,
-     32,114,101, 98,117,105,108,100, 95,116,101,109,112,108, 97,
-    116,101, 40,109, 91,109, 46,110, 93, 44, 32,116, 98, 44, 32,
-    116,105,109,112,108, 41, 44, 10, 32, 32, 32,116,121,112,101,
-     32, 61, 32,109, 91,109, 46,110, 93, 44, 10, 32, 32, 32,109,
-    111,100, 32, 61, 32, 99,111,110, 99, 97,116, 40,109, 44, 49,
-     44,109, 46,110, 45, 49, 41, 44, 10, 32, 32, 32,105,115, 95,
-    112, 97,114, 97,109,101,116,101,114, 32, 61, 32,105,115, 95,
-    112, 97,114, 97,109,101,116,101,114, 44, 10, 32, 32, 32,107,
-    105,110,100, 32, 61, 32,107,105,110,100, 10, 32, 32,125, 10,
-     32,101,110,100, 10, 10, 32, 45, 45, 32, 99,104,101, 99,107,
-     32,116,104,101, 32,102,111,114,109, 58, 32,109,111,100, 32,
-    116,121,112,101, 42, 32,110, 97,109,101, 10, 32,108,111, 99,
-     97,108, 32,115, 49, 32, 61, 32,103,115,117, 98, 40,115, 44,
-     34, 40, 37, 98, 92, 91, 92, 93, 41, 34, 44,102,117,110, 99,
-    116,105,111,110, 32, 40,110, 41, 32,114,101,116,117,114,110,
-     32,103,115,117, 98, 40,110, 44, 39, 37, 42, 39, 44, 39, 92,
-     49, 39, 41, 32,101,110,100, 41, 10, 32,116, 32, 61, 32,115,
-    112,108,105,116, 95, 99, 95,116,111,107,101,110,115, 40,115,
-     49, 44, 39, 37, 42, 39, 41, 10, 32,105,102, 32,116, 46,110,
-     32, 61, 61, 32, 50, 32,116,104,101,110, 10, 32, 32,116, 91,
-     50, 93, 32, 61, 32,103,115,117, 98, 40,116, 91, 50, 93, 44,
-     39, 92, 49, 39, 44, 39, 37, 42, 39, 41, 32, 45, 45, 32,114,
-    101,115,116,111,114,101, 32, 42, 32,105,110, 32,100,105,109,
-    101,110,115,105,111,110, 32,101,120,112,114,101,115,115,105,
-    111,110, 10, 32, 32, 45, 45,108,111, 99, 97,108, 32,109, 32,
-     61, 32,115,112,108,105,116, 40,116, 91, 49, 93, 44, 39, 37,
-    115, 37,115, 42, 39, 41, 10, 32, 32,108,111, 99, 97,108, 32,
-    109, 32, 61, 32,115,112,108,105,116, 95, 99, 95,116,111,107,
-    101,110,115, 40,116, 91, 49, 93, 44, 39, 37,115, 43, 39, 41,
-     10, 32, 32,114,101,116,117,114,110, 32, 95, 68,101, 99,108,
-     97,114, 97,116,105,111,110,123, 10, 32, 32, 32,110, 97,109,
-    101, 32, 61, 32,116, 91, 50, 93, 46, 46,116,109,112,100,101,
-    102, 44, 10, 32, 32, 32,112,116,114, 32, 61, 32, 39, 42, 39,
-     44, 10, 32, 32, 32,116,121,112,101, 32, 61, 32,109, 91,109,
-     46,110, 93, 44, 10, 32, 32, 32, 45, 45,116,121,112,101, 32,
-     61, 32,114,101, 98,117,105,108,100, 95,116,101,109,112,108,
-     97,116,101, 40,109, 91,109, 46,110, 93, 44, 32,116, 98, 44,
-     32,116,105,109,112,108, 41, 44, 10, 32, 32, 32,109,111,100,
-     32, 61, 32, 99,111,110, 99, 97,116, 40,109, 44, 49, 44,109,
-     46,110, 45, 49, 41, 32, 32, 32, 44, 10, 32, 32, 32,105,115,
-     95,112, 97,114, 97,109,101,116,101,114, 32, 61, 32,105,115,
-     95,112, 97,114, 97,109,101,116,101,114, 44, 10, 32, 32, 32,
-    107,105,110,100, 32, 61, 32,107,105,110,100, 10, 32, 32,125,
-     10, 32,101,110,100, 10, 10, 32,105,102, 32,107,105,110,100,
-     32, 61, 61, 32, 39,118, 97,114, 39, 32,116,104,101,110, 10,
-     32, 32, 45, 45, 32, 99,104,101, 99,107, 32,116,104,101, 32,
-    102,111,114,109, 58, 32,109,111,100, 32,116,121,112,101, 32,
-    110, 97,109,101, 10, 32, 32, 45, 45,116, 32, 61, 32,115,112,
-    108,105,116, 40,115, 44, 39, 37,115, 37,115, 42, 39, 41, 10,
-     32, 32,116, 32, 61, 32,115,112,108,105,116, 95, 99, 95,116,
-    111,107,101,110,115, 40,115, 44, 39, 37,115, 43, 39, 41, 10,
-     32, 32,108,111, 99, 97,108, 32,118, 10, 32, 32,105,102, 32,
-    102,105,110,100,116,121,112,101, 40,116, 91,116, 46,110, 93,
-     41, 32,116,104,101,110, 32,118, 32, 61, 32, 99,114,101, 97,
-    116,101, 95,118, 97,114,110, 97,109,101, 40, 41, 32,101,108,
-    115,101, 32,118, 32, 61, 32,116, 91,116, 46,110, 93, 59, 32,
-    116, 46,110, 32, 61, 32,116, 46,110, 45, 49, 32,101,110,100,
-     10, 32, 32,114,101,116,117,114,110, 32, 95, 68,101, 99,108,
-     97,114, 97,116,105,111,110,123, 10, 32, 32, 32,110, 97,109,
-    101, 32, 61, 32,118, 46, 46,116,109,112,100,101,102, 44, 10,
-     32, 32, 32, 45, 45,116,121,112,101, 32, 61, 32,114,101, 98,
-    117,105,108,100, 95,116,101,109,112,108, 97,116,101, 40,116,
-     91,116, 46,110, 93, 44, 32,116, 98, 44, 32,116,105,109,112,
-    108, 41, 44, 10, 32, 32, 32,116,121,112,101, 32, 61, 32,116,
-     91,116, 46,110, 93, 44, 10, 32, 32, 32,109,111,100, 32, 61,
-     32, 99,111,110, 99, 97,116, 40,116, 44, 49, 44,116, 46,110,
-     45, 49, 41, 44, 10, 32, 32, 32,105,115, 95,112, 97,114, 97,
-    109,101,116,101,114, 32, 61, 32,105,115, 95,112, 97,114, 97,
-    109,101,116,101,114, 44, 10, 32, 32, 32,107,105,110,100, 32,
-     61, 32,107,105,110,100, 10, 32, 32,125, 10, 10, 32,101,108,
-    115,101, 32, 45, 45, 32,107,105,110,100, 32, 61, 61, 32, 34,
-    102,117,110, 99, 34, 10, 10, 32, 32, 45, 45, 32, 99,104,101,
-     99,107, 32,116,104,101, 32,102,111,114,109, 58, 32,109,111,
-    100, 32,116,121,112,101, 32,110, 97,109,101, 10, 32, 32, 45,
-     45,116, 32, 61, 32,115,112,108,105,116, 40,115, 44, 39, 37,
-    115, 37,115, 42, 39, 41, 10, 32, 32,116, 32, 61, 32,115,112,
-    108,105,116, 95, 99, 95,116,111,107,101,110,115, 40,115, 44,
-     39, 37,115, 43, 39, 41, 10, 32, 32,108,111, 99, 97,108, 32,
-    118, 32, 61, 32,116, 91,116, 46,110, 93, 32, 32, 45, 45, 32,
-    108, 97,115,116, 32,119,111,114,100, 32,105,115, 32,116,104,
-    101, 32,102,117,110, 99,116,105,111,110, 32,110, 97,109,101,
-     10, 32, 32,108,111, 99, 97,108, 32,116,112, 44,109,100, 10,
-     32, 32,105,102, 32,116, 46,110, 62, 49, 32,116,104,101,110,
-     10, 32, 32, 32,116,112, 32, 61, 32,116, 91,116, 46,110, 45,
-     49, 93, 10, 32, 32, 32,109,100, 32, 61, 32, 99,111,110, 99,
-     97,116, 40,116, 44, 49, 44,116, 46,110, 45, 50, 41, 10, 32,
-     32,101,110,100, 10, 32, 32, 45, 45,105,102, 32,116,112, 32,
-    116,104,101,110, 32,116,112, 32, 61, 32,114,101, 98,117,105,
-    108,100, 95,116,101,109,112,108, 97,116,101, 40,116,112, 44,
-     32,116, 98, 44, 32,116,105,109,112,108, 41, 32,101,110,100,
-     10, 32, 32,114,101,116,117,114,110, 32, 95, 68,101, 99,108,
-     97,114, 97,116,105,111,110,123, 10, 32, 32, 32,110, 97,109,
-    101, 32, 61, 32,118, 44, 10, 32, 32, 32,116,121,112,101, 32,
-     61, 32,116,112, 44, 10, 32, 32, 32,109,111,100, 32, 61, 32,
-    109,100, 44, 10, 32, 32, 32,105,115, 95,112, 97,114, 97,109,
-    101,116,101,114, 32, 61, 32,105,115, 95,112, 97,114, 97,109,
-    101,116,101,114, 44, 10, 32, 32, 32,107,105,110,100, 32, 61,
-     32,107,105,110,100, 10, 32, 32,125, 10, 32,101,110,100, 10,
-     10,101,110,100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/declaration.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    45, 45, 32,116,111,108,117, 97, 58, 32,118, 97,114,105, 97,
-     98,108,101, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,
-    105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109,
-     97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67,
-     71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45,
-     32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,
-    100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,
-    111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,
-    116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,
-    114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,116,
-     32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,
-    105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,
-    119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,
-    101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32,
-     97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,
-    115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,
-    117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,
-    108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,
-    118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,
-    101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100,
-     97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,
-    101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,
-    102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45,
-     32, 86, 97,114,105, 97, 98,108,101, 32, 99,108, 97,115,115,
-     10, 45, 45, 32, 82,101,112,114,101,115,101,110,116,115, 32,
-     97, 32,101,120,116,101,114,110, 32,118, 97,114,105, 97, 98,
-    108,101, 32,111,114, 32, 97, 32,112,117, 98,108,105, 99, 32,
-    109,101,109, 98,101,114, 32,111,102, 32, 97, 32, 99,108, 97,
-    115,115, 46, 10, 45, 45, 32, 83,116,111,114,101,115, 32, 97,
-    108,108, 32,102,105,101,108,100,115, 32,112,114,101,115,101,
-    110,116, 32,105,110, 32, 97, 32,100,101, 99,108, 97,114, 97,
-    116,105,111,110, 46, 10, 99,108, 97,115,115, 86, 97,114,105,
-     97, 98,108,101, 32, 61, 32,123, 10, 32, 95,103,101,116, 32,
-     61, 32,123,125, 44, 32, 32, 32, 45, 45, 32,109, 97,112,112,
-    101,100, 32,103,101,116, 32,102,117,110, 99,116,105,111,110,
-    115, 10, 32, 95,115,101,116, 32, 61, 32,123,125, 44, 32, 32,
-     32, 45, 45, 32,109, 97,112,112,101,100, 32,115,101,116, 32,
-    102,117,110, 99,116,105,111,110,115, 10,125, 10, 99,108, 97,
-    115,115, 86, 97,114,105, 97, 98,108,101, 46, 95, 95,105,110,
-    100,101,120, 32, 61, 32, 99,108, 97,115,115, 86, 97,114,105,
-     97, 98,108,101, 10,115,101,116,109,101,116, 97,116, 97, 98,
-    108,101, 40, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,
-    101, 44, 99,108, 97,115,115, 68,101, 99,108, 97,114, 97,116,
-    105,111,110, 41, 10, 10, 45, 45, 32, 80,114,105,110,116, 32,
-    109,101,116,104,111,100, 10,102,117,110, 99,116,105,111,110,
-     32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,101, 58,
-    112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108,
-    111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101,
-    110,116, 46, 46, 34, 86, 97,114,105, 97, 98,108,101,123, 34,
-     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,
-     46, 34, 32,109,111,100, 32, 32, 61, 32, 39, 34, 46, 46,115,
-    101,108,102, 46,109,111,100, 46, 46, 34, 39, 44, 34, 41, 10,
-     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,
-     32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,
-    102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,
-    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,
-    112,116,114, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102,
-     46,112,116,114, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,
-    105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,110, 97,
-    109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,110,
-     97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,105,102, 32,
-    115,101,108,102, 46,100,105,109, 32,116,104,101,110, 32,112,
-    114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,100,
-    105,109, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,100,
-    105,109, 46, 46, 34, 39, 44, 34, 41, 32,101,110,100, 10, 32,
-    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,
-    100,101,102, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102,
-     46,100,101,102, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,
-    105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,114,101,
-    116, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,114,
-    101,116, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,
-    116, 40,105,100,101,110,116, 46, 46, 34,125, 34, 46, 46, 99,
-    108,111,115,101, 41, 10,101,110,100, 10, 10, 45, 45, 32, 71,
-    101,110,101,114, 97,116,101,115, 32, 67, 32,102,117,110, 99,
-    116,105,111,110, 32,110, 97,109,101, 10,102,117,110, 99,116,
-    105,111,110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,
-    108,101, 58, 99,102,117,110, 99,110, 97,109,101, 32, 40,112,
-    114,101,102,105,120, 41, 10, 32,108,111, 99, 97,108, 32,112,
-     97,114,101,110,116, 32, 61, 32, 34, 34, 10, 32,108,111, 99,
-     97,108, 32,117,110,115,105,103,110,101,100, 32, 61, 32, 34,
-     34, 10, 32,108,111, 99, 97,108, 32,112,116,114, 32, 61, 32,
-     34, 34, 10, 10, 32,108,111, 99, 97,108, 32,112, 32, 61, 32,
-    115,101,108,102, 58,105,110,109,111,100,117,108,101, 40, 41,
-     32,111,114, 32,115,101,108,102, 58,105,110,110, 97,109,101,
-    115,112, 97, 99,101, 40, 41, 32,111,114, 32,115,101,108,102,
-     58,105,110, 99,108, 97,115,115, 40, 41, 10, 10, 32,105,102,
-     32,112, 32,116,104,101,110, 10, 32,  9,105,102, 32,115,101,
-    108,102, 46,112, 97,114,101,110,116, 46, 99,108, 97,115,115,
-    116,121,112,101, 32, 61, 61, 32, 39, 99,108, 97,115,115, 39,
-     32,116,104,101,110, 10,  9,  9,112, 97,114,101,110,116, 32,
-     61, 32, 34, 95, 34, 32, 46, 46, 32,115,101,108,102, 46,112,
-     97,114,101,110,116, 46,116,121,112,101, 10,  9,101,108,115,
-    101, 10,  9, 32, 32,112, 97,114,101,110,116, 32, 61, 32, 34,
-     95, 34, 32, 46, 46, 32,112, 10,  9,101,110,100, 10, 32,101,
-    110,100, 10, 10, 32,105,102, 32,115,116,114,102,105,110,100,
-     40,115,101,108,102, 46,109,111,100, 44, 34, 40,117,110,115,
-    105,103,110,101,100, 41, 34, 41, 32,116,104,101,110, 10, 32,
-     32,117,110,115,105,103,110,101,100, 32, 61, 32, 34, 95,117,
-    110,115,105,103,110,101,100, 34, 10, 32,101,110,100, 10, 10,
-     32,105,102, 32,115,101,108,102, 46,112,116,114, 32, 61, 61,
-     32, 34, 42, 34, 32,116,104,101,110, 32,112,116,114, 32, 61,
-     32, 34, 95,112,116,114, 34, 10, 32,101,108,115,101,105,102,
-     32,115,101,108,102, 46,112,116,114, 32, 61, 61, 32, 34, 38,
-     34, 32,116,104,101,110, 32,112,116,114, 32, 61, 32, 34, 95,
-    114,101,102, 34, 10, 32,101,110,100, 10, 10, 32,108,111, 99,
-     97,108, 32,110, 97,109,101, 32, 61, 32, 32,112,114,101,102,
-    105,120, 32, 46, 46, 32,112, 97,114,101,110,116, 32, 46, 46,
-     32,117,110,115,105,103,110,101,100, 32, 46, 46, 32, 34, 95,
-     34, 32, 46, 46, 32,103,115,117, 98, 40,115,101,108,102, 46,
-    108,110, 97,109,101, 32,111,114, 32,115,101,108,102, 46,110,
-     97,109,101, 44, 34, 46, 42, 58, 58, 34, 44, 34, 34, 41, 32,
-     46, 46, 32,112,116,114, 10, 10,  9,110, 97,109,101, 32, 61,
-     32, 99,108,101, 97,110, 95,116,101,109,112,108, 97,116,101,
-     40,110, 97,109,101, 41, 10, 32,114,101,116,117,114,110, 32,
-    110, 97,109,101, 10, 10,101,110,100, 10, 10, 45, 45, 32, 99,
-    104,101, 99,107, 32,105,102, 32,105,116, 32,105,115, 32, 97,
-     32,118, 97,114,105, 97, 98,108,101, 10,102,117,110, 99,116,
-    105,111,110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,
-    108,101, 58,105,115,118, 97,114,105, 97, 98,108,101, 32, 40,
-     41, 10, 32,114,101,116,117,114,110, 32,116,114,117,101, 10,
-    101,110,100, 10, 10, 45, 45, 32,103,101,116, 32,118, 97,114,
-    105, 97, 98,108,101, 32,118, 97,108,117,101, 10,102,117,110,
-     99,116,105,111,110, 32, 99,108, 97,115,115, 86, 97,114,105,
-     97, 98,108,101, 58,103,101,116,118, 97,108,117,101, 32, 40,
-     99,108, 97,115,115, 44,115,116, 97,116,105, 99, 44, 32,112,
-    114,111,112, 95,103,101,116, 41, 10, 10,  9,108,111, 99, 97,
-    108, 32,110, 97,109,101, 10,  9,105,102, 32,112,114,111,112,
-     95,103,101,116, 32,116,104,101,110, 10, 10,  9,  9,110, 97,
-    109,101, 32, 61, 32,112,114,111,112, 95,103,101,116, 46, 46,
-     34, 40, 41, 34, 10,  9,101,108,115,101, 10,  9,  9,110, 97,
-    109,101, 32, 61, 32,115,101,108,102, 46,110, 97,109,101, 10,
-      9,101,110,100, 10, 10,  9,105,102, 32, 99,108, 97,115,115,
-     32, 97,110,100, 32,115,116, 97,116,105, 99, 32,116,104,101,
-    110, 10,  9, 32,114,101,116,117,114,110, 32,115,101,108,102,
-     46,112, 97,114,101,110,116, 46,116,121,112,101, 46, 46, 39,
-     58, 58, 39, 46, 46,110, 97,109,101, 10,  9,101,108,115,101,
-    105,102, 32, 99,108, 97,115,115, 32,116,104,101,110, 10,  9,
-     32,114,101,116,117,114,110, 32, 39,115,101,108,102, 45, 62,
-     39, 46, 46,110, 97,109,101, 10,  9,101,108,115,101, 10,  9,
-     32,114,101,116,117,114,110, 32,110, 97,109,101, 10,  9,101,
-    110,100, 10,101,110,100, 10, 10, 45, 45, 32,103,101,116, 32,
-    118, 97,114,105, 97, 98,108,101, 32,112,111,105,110,116,101,
-    114, 32,118, 97,108,117,101, 10,102,117,110, 99,116,105,111,
-    110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,101,
-     58,103,101,116,112,111,105,110,116,101,114,118, 97,108,117,
-    101, 32, 40, 99,108, 97,115,115, 44,115,116, 97,116,105, 99,
-     41, 10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,100,
-     32,115,116, 97,116,105, 99, 32,116,104,101,110, 10, 32, 32,
-    114,101,116,117,114,110, 32, 99,108, 97,115,115, 46, 46, 39,
-     58, 58,112, 39, 10, 32,101,108,115,101,105,102, 32, 99,108,
-     97,115,115, 32,116,104,101,110, 10, 32, 32,114,101,116,117,
-    114,110, 32, 39,115,101,108,102, 45, 62,112, 39, 10, 32,101,
-    108,115,101, 10, 32, 32,114,101,116,117,114,110, 32, 39,112,
-     39, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32,
-     87,114,105,116,101, 32, 98,105,110,100,105,110,103, 32,102,
-    117,110, 99,116,105,111,110,115, 10,102,117,110, 99,116,105,
-    111,110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,
-    101, 58,115,117,112, 99,111,100,101, 32, 40, 41, 10, 10, 32,
-    108,111, 99, 97,108, 32, 99,108, 97,115,115, 32, 61, 32,115,
-    101,108,102, 58,105,110, 99,108, 97,115,115, 40, 41, 10, 10,
-      9,108,111, 99, 97,108, 32,112,114,111,112, 95,103,101,116,
-     44,112,114,111,112, 95,115,101,116, 10,  9,105,102, 32,115,
-    116,114,105,110,103, 46,102,105,110,100, 40,115,101,108,102,
-     46,109,111,100, 44, 32, 39,116,111,108,117, 97, 95,112,114,
-    111,112,101,114,116,121, 39, 41, 32,116,104,101,110, 10, 10,
-      9,  9, 95, 44, 95, 44,116,121,112,101, 32, 61, 32,115,116,
-    114,105,110,103, 46,102,105,110,100, 40,115,101,108,102, 46,
-    109,111,100, 44, 32, 34,116,111,108,117, 97, 95,112,114,111,
-    112,101,114,116,121, 95, 95, 40, 91, 94, 37,115, 93, 42, 41,
-     34, 41, 10,  9,  9,116,121,112,101, 32, 61, 32,116,121,112,
-    101, 32,111,114, 32, 34,100,101,102, 97,117,108,116, 34, 10,
-      9,  9,112,114,111,112, 95,103,101,116, 44,112,114,111,112,
-     95,115,101,116, 32, 61, 32,103,101,116, 95,112,114,111,112,
-    101,114,116,121, 95,109,101,116,104,111,100,115, 40,116,121,
-    112,101, 44, 32,115,101,108,102, 46,110, 97,109,101, 41, 10,
-      9,  9,115,101,108,102, 46,109,111,100, 32, 61, 32,115,116,
-    114,105,110,103, 46,103,115,117, 98, 40,115,101,108,102, 46,
-    109,111,100, 44, 32, 34,116,111,108,117, 97, 95,112,114,111,
-    112,101,114,116,121, 91, 94, 37,115, 93, 42, 34, 44, 32, 34,
-     34, 41, 10,  9,101,110,100, 10, 10, 32, 45, 45, 32,103,101,
-    116, 32,102,117,110, 99,116,105,111,110, 32, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10,
-     32,105,102, 32, 99,108, 97,115,115, 32,116,104,101,110, 10,
-     32, 32,111,117,116,112,117,116, 40, 34, 47, 42, 32,103,101,
-    116, 32,102,117,110, 99,116,105,111,110, 58, 34, 44,115,101,
-    108,102, 46,110, 97,109,101, 44, 34, 32,111,102, 32, 99,108,
-     97,115,115, 32, 34, 44, 99,108, 97,115,115, 44, 34, 32, 42,
-     47, 34, 41, 10, 32,101,108,115,101, 10, 32, 32,111,117,116,
-    112,117,116, 40, 34, 47, 42, 32,103,101,116, 32,102,117,110,
-     99,116,105,111,110, 58, 34, 44,115,101,108,102, 46,110, 97,
-    109,101, 44, 34, 32, 42, 47, 34, 41, 10, 32,101,110,100, 10,
-     32,115,101,108,102, 46, 99,103,101,116,110, 97,109,101, 32,
-     61, 32,115,101,108,102, 58, 99,102,117,110, 99,110, 97,109,
-    101, 40, 34,116,111,108,117, 97, 95,103,101,116, 34, 41, 10,
-     32,111,117,116,112,117,116, 40, 34, 35,105,102,110,100,101,
-    102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69,
-     95, 34, 46, 46,115,101,108,102, 46, 99,103,101,116,110, 97,
-    109,101, 41, 10, 32,111,117,116,112,117,116, 40, 34, 92,110,
-    115,116, 97,116,105, 99, 32,105,110,116, 34, 44,115,101,108,
-    102, 46, 99,103,101,116,110, 97,109,101, 44, 34, 40,108,117,
-     97, 95, 83,116, 97,116,101, 42, 32,116,111,108,117, 97, 95,
-     83, 41, 34, 41, 10, 32,111,117,116,112,117,116, 40, 34,123,
-     34, 41, 10, 10, 32, 45, 45, 32,100,101, 99,108, 97,114,101,
-     32,115,101,108,102, 44, 32,105,102, 32,116,104,101, 32, 99,
-     97,115,101, 10, 32,108,111, 99, 97,108, 32, 95, 44, 95, 44,
-    115,116, 97,116,105, 99, 32, 61, 32,115,116,114,102,105,110,
-    100, 40,115,101,108,102, 46,109,111,100, 44, 39, 94, 37,115,
-     42, 40,115,116, 97,116,105, 99, 41, 39, 41, 10, 32,105,102,
-     32, 99,108, 97,115,115, 32, 97,110,100, 32,115,116, 97,116,
-    105, 99, 61, 61,110,105,108, 32,116,104,101,110, 10, 32, 32,
-    111,117,116,112,117,116, 40, 39, 32, 39, 44,115,101,108,102,
-     46,112, 97,114,101,110,116, 46,116,121,112,101, 44, 39, 42,
-     39, 44, 39,115,101,108,102, 32, 61, 32, 39, 41, 10, 32, 32,
-    111,117,116,112,117,116, 40, 39, 40, 39, 44,115,101,108,102,
-     46,112, 97,114,101,110,116, 46,116,121,112,101, 44, 39, 42,
-     41, 32, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39,
-    116,111,108,117, 97, 95,116,111,117,115,101,114,116,121,112,
-    101, 40,116,111,108,117, 97, 95, 83, 44, 49, 44, 48, 41, 59,
-     39, 41, 10, 32,101,108,115,101,105,102, 32,115,116, 97,116,
-    105, 99, 32,116,104,101,110, 10, 32, 32, 95, 44, 95, 44,115,
-    101,108,102, 46,109,111,100, 32, 61, 32,115,116,114,102,105,
-    110,100, 40,115,101,108,102, 46,109,111,100, 44, 39, 94, 37,
-    115, 42,115,116, 97,116,105, 99, 37,115, 37,115, 42, 40, 46,
-     42, 41, 39, 41, 10, 32,101,110,100, 10, 10, 10, 32, 45, 45,
-     32, 99,104,101, 99,107, 32,115,101,108,102, 32,118, 97,108,
-    117,101, 10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,
-    100, 32,115,116, 97,116,105, 99, 61, 61,110,105,108, 32,116,
-    104,101,110, 10,  9, 32,111,117,116,112,117,116, 40, 39, 35,
-    105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 82, 69,
-     76, 69, 65, 83, 69, 92,110, 39, 41, 10, 32, 32,111,117,116,
-    112,117,116, 40, 39, 32, 32,105,102, 32, 40, 33,115,101,108,
-    102, 41, 32,116,111,108,117, 97, 95,101,114,114,111,114, 40,
-    116,111,108,117, 97, 95, 83, 44, 34,105,110,118, 97,108,105,
-    100, 32, 92, 39,115,101,108,102, 92, 39, 32,105,110, 32, 97,
-     99, 99,101,115,115,105,110,103, 32,118, 97,114,105, 97, 98,
-    108,101, 32, 92, 39, 39, 46, 46,115,101,108,102, 46,110, 97,
-    109,101, 46, 46, 39, 92, 39, 34, 44, 78, 85, 76, 76, 41, 59,
-     39, 41, 59, 10,  9,  9,111,117,116,112,117,116, 40, 39, 35,
-    101,110,100,105,102, 92,110, 39, 41, 10, 32,101,110,100, 10,
-     10, 32, 45, 45, 32,114,101,116,117,114,110, 32,118, 97,108,
-    117,101, 10, 32,105,102, 32,115,116,114,105,110,103, 46,102,
-    105,110,100, 40,115,101,108,102, 46,109,111,100, 44, 32, 39,
-    116,111,108,117, 97, 95,105,110,104,101,114,105,116,115, 39,
-     41, 32,116,104,101,110, 10, 32,  9,111,117,116,112,117,116,
-     40, 39, 35,105,102,100,101,102, 32, 95, 95, 99,112,108,117,
-    115,112,108,117,115, 92,110, 39, 41, 10,  9,111,117,116,112,
-    117,116, 40, 39, 32, 32,116,111,108,117, 97, 95,112,117,115,
-    104,117,115,101,114,116,121,112,101, 40,116,111,108,117, 97,
-     95, 83, 44, 40,118,111,105,100, 42, 41,115,116, 97,116,105,
-     99, 95, 99, 97,115,116, 60, 39, 46, 46,115,101,108,102, 46,
-    116,121,112,101, 46, 46, 39, 42, 62, 40,115,101,108,102, 41,
-     44, 32, 34, 39, 44,115,101,108,102, 46,116,121,112,101, 44,
-     39, 34, 41, 59, 39, 41, 10,  9,111,117,116,112,117,116, 40,
-     39, 35,101,108,115,101, 92,110, 39, 41, 10,  9,111,117,116,
-    112,117,116, 40, 39, 32, 32,116,111,108,117, 97, 95,112,117,
-    115,104,117,115,101,114,116,121,112,101, 40,116,111,108,117,
-     97, 95, 83, 44, 40,118,111,105,100, 42, 41, 40, 40, 39, 46,
-     46,115,101,108,102, 46,116,121,112,101, 46, 46, 39, 42, 41,
-    115,101,108,102, 41, 44, 32, 34, 39, 44,115,101,108,102, 46,
-    116,121,112,101, 44, 39, 34, 41, 59, 39, 41, 10,  9,111,117,
-    116,112,117,116, 40, 39, 35,101,110,100,105,102, 92,110, 39,
-     41, 10, 32,101,108,115,101, 10,  9,108,111, 99, 97,108, 32,
-    116, 44, 99,116, 32, 61, 32,105,115, 98, 97,115,105, 99, 40,
-    115,101,108,102, 46,116,121,112,101, 41, 10,  9,105,102, 32,
-    116, 32,116,104,101,110, 10,  9,  9,111,117,116,112,117,116,
-     40, 39, 32, 32,116,111,108,117, 97, 95,112,117,115,104, 39,
-     46, 46,116, 46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44,
-     40, 39, 44, 99,116, 44, 39, 41, 39, 46, 46,115,101,108,102,
-     58,103,101,116,118, 97,108,117,101, 40, 99,108, 97,115,115,
-     44,115,116, 97,116,105, 99, 44,112,114,111,112, 95,103,101,
-    116, 41, 46, 46, 39, 41, 59, 39, 41, 10,  9,101,108,115,101,
-     10,  9,  9,116, 32, 61, 32,115,101,108,102, 46,116,121,112,
-    101, 10,  9,  9,105,102, 32,115,101,108,102, 46,112,116,114,
-     32, 61, 61, 32, 39, 38, 39, 32,111,114, 32,115,101,108,102,
-     46,112,116,114, 32, 61, 61, 32, 39, 39, 32,116,104,101,110,
-     10,  9,  9,  9,111,117,116,112,117,116, 40, 39, 32, 32,116,
-    111,108,117, 97, 95,112,117,115,104,117,115,101,114,116,121,
-    112,101, 40,116,111,108,117, 97, 95, 83, 44, 40,118,111,105,
-    100, 42, 41, 38, 39, 46, 46,115,101,108,102, 58,103,101,116,
-    118, 97,108,117,101, 40, 99,108, 97,115,115, 44,115,116, 97,
-    116,105, 99, 44,112,114,111,112, 95,103,101,116, 41, 46, 46,
-     39, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10,  9,
-      9,101,108,115,101, 10,  9,  9,  9,111,117,116,112,117,116,
-     40, 39, 32, 32,116,111,108,117, 97, 95,112,117,115,104,117,
-    115,101,114,116,121,112,101, 40,116,111,108,117, 97, 95, 83,
-     44, 40,118,111,105,100, 42, 41, 39, 46, 46,115,101,108,102,
-     58,103,101,116,118, 97,108,117,101, 40, 99,108, 97,115,115,
-     44,115,116, 97,116,105, 99, 44,112,114,111,112, 95,103,101,
-    116, 41, 46, 46, 39, 44, 34, 39, 44,116, 44, 39, 34, 41, 59,
-     39, 41, 10,  9,  9,101,110,100, 10,  9,101,110,100, 10, 32,
-    101,110,100, 10, 32,111,117,116,112,117,116, 40, 39, 32,114,
-    101,116,117,114,110, 32, 49, 59, 39, 41, 10, 32,111,117,116,
-    112,117,116, 40, 39,125, 39, 41, 10, 32,111,117,116,112,117,
-    116, 40, 39, 35,101,110,100,105,102, 32, 47, 47, 35,105,102,
-    110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65,
-     66, 76, 69, 92,110, 39, 41, 10, 32,111,117,116,112,117,116,
-     40, 39, 92,110, 39, 41, 10, 10, 32, 45, 45, 32,115,101,116,
-     32,102,117,110, 99,116,105,111,110, 32, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 32,
-    105,102, 32,110,111,116, 32, 40,115,116,114,102,105,110,100,
-     40,115,101,108,102, 46,116,121,112,101, 44, 39, 99,111,110,
-    115,116, 37,115, 43, 39, 41, 32,111,114, 32,115,116,114,105,
-    110,103, 46,102,105,110,100, 40,115,101,108,102, 46,109,111,
-    100, 44, 32, 39,116,111,108,117, 97, 95,114,101, 97,100,111,
-    110,108,121, 39, 41, 32,111,114, 32,115,116,114,105,110,103,
-     46,102,105,110,100, 40,115,101,108,102, 46,109,111,100, 44,
-     32, 39,116,111,108,117, 97, 95,105,110,104,101,114,105,116,
-    115, 39, 41, 41, 32, 32,116,104,101,110, 10, 32, 32,105,102,
-     32, 99,108, 97,115,115, 32,116,104,101,110, 10, 32, 32, 32,
-    111,117,116,112,117,116, 40, 34, 47, 42, 32,115,101,116, 32,
-    102,117,110, 99,116,105,111,110, 58, 34, 44,115,101,108,102,
-     46,110, 97,109,101, 44, 34, 32,111,102, 32, 99,108, 97,115,
-    115, 32, 34, 44, 99,108, 97,115,115, 44, 34, 32, 42, 47, 34,
-     41, 10, 32, 32,101,108,115,101, 10, 32, 32, 32,111,117,116,
-    112,117,116, 40, 34, 47, 42, 32,115,101,116, 32,102,117,110,
-     99,116,105,111,110, 58, 34, 44,115,101,108,102, 46,110, 97,
-    109,101, 44, 34, 32, 42, 47, 34, 41, 10, 32, 32,101,110,100,
-     10, 32, 32,115,101,108,102, 46, 99,115,101,116,110, 97,109,
-    101, 32, 61, 32,115,101,108,102, 58, 99,102,117,110, 99,110,
-     97,109,101, 40, 34,116,111,108,117, 97, 95,115,101,116, 34,
-     41, 10, 32, 32,111,117,116,112,117,116, 40, 34, 35,105,102,
-    110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65,
-     66, 76, 69, 95, 34, 46, 46,115,101,108,102, 46, 99,115,101,
-    116,110, 97,109,101, 41, 10, 32, 32,111,117,116,112,117,116,
-     40, 34, 92,110,115,116, 97,116,105, 99, 32,105,110,116, 34,
-     44,115,101,108,102, 46, 99,115,101,116,110, 97,109,101, 44,
-     34, 40,108,117, 97, 95, 83,116, 97,116,101, 42, 32,116,111,
-    108,117, 97, 95, 83, 41, 34, 41, 10, 32, 32,111,117,116,112,
-    117,116, 40, 34,123, 34, 41, 10, 10, 32, 32, 45, 45, 32,100,
-    101, 99,108, 97,114,101, 32,115,101,108,102, 44, 32,105,102,
-     32,116,104,101, 32, 99, 97,115,101, 10, 32, 32,105,102, 32,
-     99,108, 97,115,115, 32, 97,110,100, 32,115,116, 97,116,105,
-     99, 61, 61,110,105,108, 32,116,104,101,110, 10, 32, 32, 32,
-    111,117,116,112,117,116, 40, 39, 32, 39, 44,115,101,108,102,
-     46,112, 97,114,101,110,116, 46,116,121,112,101, 44, 39, 42,
-     39, 44, 39,115,101,108,102, 32, 61, 32, 39, 41, 10, 32, 32,
-     32,111,117,116,112,117,116, 40, 39, 40, 39, 44,115,101,108,
-    102, 46,112, 97,114,101,110,116, 46,116,121,112,101, 44, 39,
-     42, 41, 32, 39, 41, 10, 32, 32, 32,111,117,116,112,117,116,
-     40, 39,116,111,108,117, 97, 95,116,111,117,115,101,114,116,
-    121,112,101, 40,116,111,108,117, 97, 95, 83, 44, 49, 44, 48,
-     41, 59, 39, 41, 10, 32, 32, 32, 45, 45, 32, 99,104,101, 99,
-    107, 32,115,101,108,102, 32,118, 97,108,117,101, 10,  9,  9,
-    101,110,100, 10, 32, 32, 45, 45, 32, 99,104,101, 99,107, 32,
-    116,121,112,101,115, 10,  9,  9,111,117,116,112,117,116, 40,
-     39, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95,
-     82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,  9,  9,111,
-    117,116,112,117,116, 40, 39, 32, 32,116,111,108,117, 97, 95,
-     69,114,114,111,114, 32,116,111,108,117, 97, 95,101,114,114,
-     59, 39, 41, 10, 32, 32,105,102, 32, 99,108, 97,115,115, 32,
-     97,110,100, 32,115,116, 97,116,105, 99, 61, 61,110,105,108,
-     32,116,104,101,110, 10, 32, 32, 32,111,117,116,112,117,116,
-     40, 39, 32, 32,105,102, 32, 40, 33,115,101,108,102, 41, 32,
-    116,111,108,117, 97, 95,101,114,114,111,114, 40,116,111,108,
-    117, 97, 95, 83, 44, 34,105,110,118, 97,108,105,100, 32, 92,
-     39,115,101,108,102, 92, 39, 32,105,110, 32, 97, 99, 99,101,
-    115,115,105,110,103, 32,118, 97,114,105, 97, 98,108,101, 32,
-     92, 39, 39, 46, 46,115,101,108,102, 46,110, 97,109,101, 46,
-     46, 39, 92, 39, 34, 44, 78, 85, 76, 76, 41, 59, 39, 41, 59,
-     10, 32, 32,101,108,115,101,105,102, 32,115,116, 97,116,105,
-     99, 32,116,104,101,110, 10, 32, 32, 32, 95, 44, 95, 44,115,
-    101,108,102, 46,109,111,100, 32, 61, 32,115,116,114,102,105,
-    110,100, 40,115,101,108,102, 46,109,111,100, 44, 39, 94, 37,
-    115, 42,115,116, 97,116,105, 99, 37,115, 37,115, 42, 40, 46,
-     42, 41, 39, 41, 10, 32, 32,101,110,100, 10, 10, 32, 32, 45,
-     45, 32, 99,104,101, 99,107, 32,118, 97,114,105, 97, 98,108,
-    101, 32,116,121,112,101, 10, 32, 32,111,117,116,112,117,116,
-     40, 39, 32, 32,105,102, 32, 40, 33, 39, 46, 46,115,101,108,
-    102, 58,111,117,116, 99,104,101, 99,107,116,121,112,101, 40,
-     50, 41, 46, 46, 39, 41, 39, 41, 10, 32, 32,111,117,116,112,
-    117,116, 40, 39, 32, 32, 32,116,111,108,117, 97, 95,101,114,
-    114,111,114, 40,116,111,108,117, 97, 95, 83, 44, 34, 35,118,
-    105,110,118, 97,108,105,100, 32,116,121,112,101, 32,105,110,
-     32,118, 97,114,105, 97, 98,108,101, 32, 97,115,115,105,103,
-    110,109,101,110,116, 46, 34, 44, 38,116,111,108,117, 97, 95,
-    101,114,114, 41, 59, 39, 41, 10,  9,  9,111,117,116,112,117,
-    116, 40, 39, 35,101,110,100,105,102, 92,110, 39, 41, 10, 10,
-     32, 32, 45, 45, 32, 97,115,115,105,103,110, 32,118, 97,108,
-    117,101, 10,  9,  9,108,111, 99, 97,108, 32,100,101,102, 32,
-     61, 32, 48, 10,  9,  9,105,102, 32,115,101,108,102, 46,100,
-    101,102, 32,126, 61, 32, 39, 39, 32,116,104,101,110, 32,100,
-    101,102, 32, 61, 32,115,101,108,102, 46,100,101,102, 32,101,
-    110,100, 10,  9,  9,105,102, 32,115,101,108,102, 46,116,121,
-    112,101, 32, 61, 61, 32, 39, 99,104, 97,114, 42, 39, 32, 97,
-    110,100, 32,115,101,108,102, 46,100,105,109, 32,126, 61, 32,
-     39, 39, 32,116,104,101,110, 32, 45, 45, 32,105,115, 32,115,
-    116,114,105,110,103, 10,  9,  9, 32,111,117,116,112,117,116,
-     40, 39, 32,115,116,114,110, 99,112,121, 40, 39, 41, 10,  9,
-      9,  9,105,102, 32, 99,108, 97,115,115, 32, 97,110,100, 32,
-    115,116, 97,116,105, 99, 32,116,104,101,110, 10,  9,  9,  9,
-      9,111,117,116,112,117,116, 40,115,101,108,102, 46,112, 97,
-    114,101,110,116, 46,116,121,112,101, 46, 46, 39, 58, 58, 39,
-     46, 46,115,101,108,102, 46,110, 97,109,101, 41, 10,  9,  9,
-      9,101,108,115,101,105,102, 32, 99,108, 97,115,115, 32,116,
-    104,101,110, 10,  9,  9,  9,  9,111,117,116,112,117,116, 40,
-     39,115,101,108,102, 45, 62, 39, 46, 46,115,101,108,102, 46,
-    110, 97,109,101, 41, 10,  9,  9,  9,101,108,115,101, 10,  9,
-      9,  9,  9,111,117,116,112,117,116, 40,115,101,108,102, 46,
-    110, 97,109,101, 41, 10,  9,  9,  9,101,110,100, 10,  9,  9,
-      9,111,117,116,112,117,116, 40, 39, 44,116,111,108,117, 97,
-     95,116,111,115,116,114,105,110,103, 40,116,111,108,117, 97,
-     95, 83, 44, 50, 44, 39, 44,100,101,102, 44, 39, 41, 44, 39,
-     44,115,101,108,102, 46,100,105,109, 44, 39, 45, 49, 41, 59,
-     39, 41, 10,  9,  9,101,108,115,101, 10,  9,  9,  9,108,111,
-     99, 97,108, 32,112,116,114, 32, 61, 32, 39, 39, 10,  9,  9,
-      9,105,102, 32,115,101,108,102, 46,112,116,114,126, 61, 39,
-     39, 32,116,104,101,110, 32,112,116,114, 32, 61, 32, 39, 42,
-     39, 32,101,110,100, 10,  9,  9,  9,111,117,116,112,117,116,
-     40, 39, 32, 39, 41, 10,  9,  9,  9,108,111, 99, 97,108, 32,
-    110, 97,109,101, 32, 61, 32,112,114,111,112, 95,115,101,116,
-     32,111,114, 32,115,101,108,102, 46,110, 97,109,101, 10,  9,
-      9,  9,105,102, 32, 99,108, 97,115,115, 32, 97,110,100, 32,
-    115,116, 97,116,105, 99, 32,116,104,101,110, 10,  9,  9,  9,
-      9,111,117,116,112,117,116, 40,115,101,108,102, 46,112, 97,
-    114,101,110,116, 46,116,121,112,101, 46, 46, 39, 58, 58, 39,
-     46, 46,110, 97,109,101, 41, 10,  9,  9,  9,101,108,115,101,
-    105,102, 32, 99,108, 97,115,115, 32,116,104,101,110, 10,  9,
-      9,  9,  9,111,117,116,112,117,116, 40, 39,115,101,108,102,
-     45, 62, 39, 46, 46,110, 97,109,101, 41, 10,  9,  9,  9,101,
-    108,115,101, 10,  9,  9,  9,  9,111,117,116,112,117,116, 40,
-    110, 97,109,101, 41, 10,  9,  9,  9,101,110,100, 10,  9,  9,
-      9,108,111, 99, 97,108, 32,116, 32, 61, 32,105,115, 98, 97,
-    115,105, 99, 40,115,101,108,102, 46,116,121,112,101, 41, 10,
-      9,  9,  9,105,102, 32,112,114,111,112, 95,115,101,116, 32,
-    116,104,101,110, 10,  9,  9,  9,  9,111,117,116,112,117,116,
-     40, 39, 40, 39, 41, 10,  9,  9,  9,101,108,115,101, 10,  9,
-      9,  9,  9,111,117,116,112,117,116, 40, 39, 32, 61, 32, 39,
-     41, 10,  9,  9,  9,101,110,100, 10,  9,  9,  9,105,102, 32,
-    110,111,116, 32,116, 32, 97,110,100, 32,112,116,114, 61, 61,
-     39, 39, 32,116,104,101,110, 32,111,117,116,112,117,116, 40,
-     39, 42, 39, 41, 32,101,110,100, 10,  9,  9,  9,111,117,116,
-    112,117,116, 40, 39, 40, 40, 39, 44,115,101,108,102, 46,109,
-    111,100, 44,115,101,108,102, 46,116,121,112,101, 41, 10,  9,
-      9,  9,105,102, 32,110,111,116, 32,116, 32,116,104,101,110,
-     10,  9,  9,  9,  9,111,117,116,112,117,116, 40, 39, 42, 39,
-     41, 10,  9,  9,  9,101,110,100, 10,  9,  9,  9,111,117,116,
-    112,117,116, 40, 39, 41, 32, 39, 41, 10,  9,  9,  9,105,102,
-     32,116, 32,116,104,101,110, 10,  9,  9,  9,  9,105,102, 32,
-    105,115,101,110,117,109, 40,115,101,108,102, 46,116,121,112,
-    101, 41, 32,116,104,101,110, 10,  9,  9,  9,  9,  9,111,117,
-    116,112,117,116, 40, 39, 40,105,110,116, 41, 32, 39, 41, 10,
-      9,  9,  9,  9,101,110,100, 10,  9,  9,  9,  9,111,117,116,
-    112,117,116, 40, 39,116,111,108,117, 97, 95,116,111, 39, 46,
-     46,116, 44, 39, 40,116,111,108,117, 97, 95, 83, 44, 50, 44,
-     39, 44,100,101,102, 44, 39, 41, 41, 39, 41, 10,  9,  9,  9,
-    101,108,115,101, 10,  9,  9,  9,  9,111,117,116,112,117,116,
-     40, 39,116,111,108,117, 97, 95,116,111,117,115,101,114,116,
-    121,112,101, 40,116,111,108,117, 97, 95, 83, 44, 50, 44, 39,
-     44,100,101,102, 44, 39, 41, 41, 39, 41, 10,  9,  9,  9,101,
-    110,100, 10,  9,  9,  9,105,102, 32,112,114,111,112, 95,115,
-    101,116, 32,116,104,101,110, 10,  9,  9,  9,  9,111,117,116,
-    112,117,116, 40, 34, 41, 34, 41, 10,  9,  9,  9,101,110,100,
-     10,  9,  9,  9,111,117,116,112,117,116, 40, 34, 59, 34, 41,
-     10,  9,  9,101,110,100, 10, 32, 32,111,117,116,112,117,116,
-     40, 39, 32,114,101,116,117,114,110, 32, 48, 59, 39, 41, 10,
-     32, 32,111,117,116,112,117,116, 40, 39,125, 39, 41, 10, 32,
-     32,111,117,116,112,117,116, 40, 39, 35,101,110,100,105,102,
-     32, 47, 47, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85,
-     65, 95, 68, 73, 83, 65, 66, 76, 69, 92,110, 39, 41, 10, 32,
-     32,111,117,116,112,117,116, 40, 39, 92,110, 39, 41, 10, 32,
-    101,110,100, 10, 10,101,110,100, 10, 10,102,117,110, 99,116,
-    105,111,110, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,
-    108,101, 58,114,101,103,105,115,116,101,114, 32, 40,112,114,
-    101, 41, 10, 10,  9,105,102, 32,110,111,116, 32,115,101,108,
-    102, 58, 99,104,101, 99,107, 95,112,117, 98,108,105, 99, 95,
-     97, 99, 99,101,115,115, 40, 41, 32,116,104,101,110, 10,  9,
-      9,114,101,116,117,114,110, 10,  9,101,110,100, 10, 32,112,
-    114,101, 32, 61, 32,112,114,101, 32,111,114, 32, 39, 39, 10,
-     32,108,111, 99, 97,108, 32,112, 97,114,101,110,116, 32, 61,
-     32,115,101,108,102, 58,105,110,109,111,100,117,108,101, 40,
-     41, 32,111,114, 32,115,101,108,102, 58,105,110,110, 97,109,
-    101,115,112, 97, 99,101, 40, 41, 32,111,114, 32,115,101,108,
-    102, 58,105,110, 99,108, 97,115,115, 40, 41, 10, 32,105,102,
-     32,110,111,116, 32,112, 97,114,101,110,116, 32,116,104,101,
-    110, 10, 32, 32,105,102, 32, 99,108, 97,115,115, 86, 97,114,
-    105, 97, 98,108,101, 46, 95,119, 97,114,110,105,110,103, 61,
-     61,110,105,108, 32,116,104,101,110, 10, 32, 32, 32,119, 97,
-    114,110,105,110,103, 40, 34, 77, 97,112,112,105,110,103, 32,
-    118, 97,114,105, 97, 98,108,101, 32,116,111, 32,103,108,111,
-     98, 97,108, 32,109, 97,121, 32,100,101,103,114, 97,100,101,
-     32,112,101,114,102,111,114,109, 97,110, 99,101, 34, 41, 10,
-     32, 32, 32, 99,108, 97,115,115, 86, 97,114,105, 97, 98,108,
-    101, 46, 95,119, 97,114,110,105,110,103, 32, 61, 32, 49, 10,
-     32, 32,101,110,100, 10, 32,101,110,100, 10, 32,105,102, 32,
-    115,101,108,102, 46, 99,115,101,116,110, 97,109,101, 32,116,
-    104,101,110, 10, 32, 32,111,117,116,112,117,116, 40,112,114,
-    101, 46, 46, 39,116,111,108,117, 97, 95,118, 97,114,105, 97,
-     98,108,101, 40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46,
-     46,115,101,108,102, 46,108,110, 97,109,101, 46, 46, 39, 34,
-     44, 39, 46, 46,115,101,108,102, 46, 99,103,101,116,110, 97,
-    109,101, 46, 46, 39, 44, 39, 46, 46,115,101,108,102, 46, 99,
-    115,101,116,110, 97,109,101, 46, 46, 39, 41, 59, 39, 41, 10,
-     32,101,108,115,101, 10, 32, 32,111,117,116,112,117,116, 40,
-    112,114,101, 46, 46, 39,116,111,108,117, 97, 95,118, 97,114,
-    105, 97, 98,108,101, 40,116,111,108,117, 97, 95, 83, 44, 34,
-     39, 46, 46,115,101,108,102, 46,108,110, 97,109,101, 46, 46,
-     39, 34, 44, 39, 46, 46,115,101,108,102, 46, 99,103,101,116,
-    110, 97,109,101, 46, 46, 39, 44, 78, 85, 76, 76, 41, 59, 39,
-     41, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45, 32,
-     73,110,116,101,114,110, 97,108, 32, 99,111,110,115,116,114,
-    117, 99,116,111,114, 10,102,117,110, 99,116,105,111,110, 32,
-     95, 86, 97,114,105, 97, 98,108,101, 32, 40,116, 41, 10, 32,
-    115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44,
-     99,108, 97,115,115, 86, 97,114,105, 97, 98,108,101, 41, 10,
-     32, 97,112,112,101,110,100, 40,116, 41, 10, 32,114,101,116,
-    117,114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67,
-    111,110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32, 69,
-    120,112,101, 99,116,115, 32, 97, 32,115,116,114,105,110,103,
-     32,114,101,112,114,101,115,101,110,116,105,110,103, 32,116,
-    104,101, 32,118, 97,114,105, 97, 98,108,101, 32,100,101, 99,
-    108, 97,114, 97,116,105,111,110, 46, 10,102,117,110, 99,116,
-    105,111,110, 32, 86, 97,114,105, 97, 98,108,101, 32, 40,115,
-     41, 10, 32,114,101,116,117,114,110, 32, 95, 86, 97,114,105,
-     97, 98,108,101, 32, 40, 68,101, 99,108, 97,114, 97,116,105,
-    111,110, 40,115, 44, 39,118, 97,114, 39, 41, 41, 10,101,110,
-    100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/variable.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    45, 45, 32,116,111,108,117, 97, 58, 32, 97,114,114, 97,121,
-     32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,116,
-    101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, 32,
-     67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,
-    102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,
-    108, 32, 49, 57, 57, 57, 10, 45, 45, 32, 36, 73,100, 58, 32,
-     97,114,114, 97,121, 46,108,117, 97, 44,118, 32, 49, 46, 49,
-     32, 50, 48, 48, 48, 47, 49, 49, 47, 48, 54, 32, 50, 50, 58,
-     48, 51, 58, 53, 55, 32, 99,101,108,101,115, 32, 69,120,112,
-     32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,
-    101, 32,105,115, 32,102,114,101,101, 32,115,111,102,116,119,
-     97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,
-    100,105,115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,
-    110,100, 47,111,114, 32,109,111,100,105,102,121, 32,105,116,
-     46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,
-    114,101, 32,112,114,111,118,105,100,101,100, 32,104,101,114,
-    101,117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,110,
-     32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44,
-     32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,
-    104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,
-    103, 97,116,105,111,110, 32,116,111, 32,112,114,111,118,105,
-    100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,101, 44,
-     32,115,117,112,112,111,114,116, 44, 32,117,112,100, 97,116,
-    101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,
-    101,110,116,115, 44, 32,111,114, 32,109,111,100,105,102,105,
-     99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45, 32, 65,
-    114,114, 97,121, 32, 99,108, 97,115,115, 10, 45, 45, 32, 82,
-    101,112,114,101,115,101,110,116,115, 32, 97, 32,101,120,116,
-    101,114,110, 32, 97,114,114, 97,121, 32,118, 97,114,105, 97,
-     98,108,101, 32,111,114, 32, 97, 32,112,117, 98,108,105, 99,
-     32,109,101,109, 98,101,114, 32,111,102, 32, 97, 32, 99,108,
-     97,115,115, 46, 10, 45, 45, 32, 83,116,111,114,101,115, 32,
-     97,108,108, 32,102,105,101,108,100,115, 32,112,114,101,115,
-    101,110,116, 32,105,110, 32, 97, 32,100,101, 99,108, 97,114,
-     97,116,105,111,110, 46, 10, 99,108, 97,115,115, 65,114,114,
-     97,121, 32, 61, 32,123, 10,125, 10, 99,108, 97,115,115, 65,
-    114,114, 97,121, 46, 95, 95,105,110,100,101,120, 32, 61, 32,
-     99,108, 97,115,115, 65,114,114, 97,121, 10,115,101,116,109,
-    101,116, 97,116, 97, 98,108,101, 40, 99,108, 97,115,115, 65,
-    114,114, 97,121, 44, 99,108, 97,115,115, 68,101, 99,108, 97,
-    114, 97,116,105,111,110, 41, 10, 10, 45, 45, 32, 80,114,105,
-    110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116,
-    105,111,110, 32, 99,108, 97,115,115, 65,114,114, 97,121, 58,
-    112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108,
-    111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101,
-    110,116, 46, 46, 34, 65,114,114, 97,121,123, 34, 41, 10, 32,
-    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,
-    109,111,100, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102,
-     46,109,111,100, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,
-    105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,116,121,
-    112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,116,
-    121,112,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,
-    110,116, 40,105,100,101,110,116, 46, 46, 34, 32,112,116,114,
-     32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,112,116,
-    114, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116,
-     40,105,100,101,110,116, 46, 46, 34, 32,110, 97,109,101, 32,
-     61, 32, 39, 34, 46, 46,115,101,108,102, 46,110, 97,109,101,
-     46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,
-    105,100,101,110,116, 46, 46, 34, 32,100,101,102, 32, 32, 61,
-     32, 39, 34, 46, 46,115,101,108,102, 46,100,101,102, 46, 46,
-     34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,
-    101,110,116, 46, 46, 34, 32,100,105,109, 32, 32, 61, 32, 39,
-     34, 46, 46,115,101,108,102, 46,100,105,109, 46, 46, 34, 39,
-     44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,
-    116, 46, 46, 34, 32,114,101,116, 32, 32, 61, 32, 39, 34, 46,
-     46,115,101,108,102, 46,114,101,116, 46, 46, 34, 39, 44, 34,
-     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,
-     46, 34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,
-    100, 10, 10, 45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,
-    105,116, 32,105,115, 32, 97, 32,118, 97,114,105, 97, 98,108,
-    101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,
-    115, 65,114,114, 97,121, 58,105,115,118, 97,114,105, 97, 98,
-    108,101, 32, 40, 41, 10, 32,114,101,116,117,114,110, 32,116,
-    114,117,101, 10,101,110,100, 10, 10, 10, 45, 45, 32,103,101,
-    116, 32,118, 97,114,105, 97, 98,108,101, 32,118, 97,108,117,
-    101, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,
-    115, 65,114,114, 97,121, 58,103,101,116,118, 97,108,117,101,
-     32, 40, 99,108, 97,115,115, 44,115,116, 97,116,105, 99, 41,
-     10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,100, 32,
-    115,116, 97,116,105, 99, 32,116,104,101,110, 10, 32, 32,114,
-    101,116,117,114,110, 32, 99,108, 97,115,115, 46, 46, 39, 58,
-     58, 39, 46, 46,115,101,108,102, 46,110, 97,109,101, 46, 46,
-     39, 91,116,111,108,117, 97, 95,105,110,100,101,120, 93, 39,
-     10, 32,101,108,115,101,105,102, 32, 99,108, 97,115,115, 32,
-    116,104,101,110, 10, 32, 32,114,101,116,117,114,110, 32, 39,
-    115,101,108,102, 45, 62, 39, 46, 46,115,101,108,102, 46,110,
-     97,109,101, 46, 46, 39, 91,116,111,108,117, 97, 95,105,110,
-    100,101,120, 93, 39, 10, 32,101,108,115,101, 10, 32, 32,114,
-    101,116,117,114,110, 32,115,101,108,102, 46,110, 97,109,101,
-     46, 46, 39, 91,116,111,108,117, 97, 95,105,110,100,101,120,
-     93, 39, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45,
-     32, 87,114,105,116,101, 32, 98,105,110,100,105,110,103, 32,
-    102,117,110, 99,116,105,111,110,115, 10,102,117,110, 99,116,
-    105,111,110, 32, 99,108, 97,115,115, 65,114,114, 97,121, 58,
-    115,117,112, 99,111,100,101, 32, 40, 41, 10, 32,108,111, 99,
-     97,108, 32, 99,108, 97,115,115, 32, 61, 32,115,101,108,102,
-     58,105,110, 99,108, 97,115,115, 40, 41, 10, 10, 32, 45, 45,
-     32,103,101,116, 32,102,117,110, 99,116,105,111,110, 32, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 10, 32,105,102, 32, 99,108, 97,115,115, 32,116,104,
-    101,110, 10, 32, 32,111,117,116,112,117,116, 40, 34, 47, 42,
-     32,103,101,116, 32,102,117,110, 99,116,105,111,110, 58, 34,
-     44,115,101,108,102, 46,110, 97,109,101, 44, 34, 32,111,102,
-     32, 99,108, 97,115,115, 32, 34, 44, 99,108, 97,115,115, 44,
-     34, 32, 42, 47, 34, 41, 10, 32,101,108,115,101, 10, 32, 32,
-    111,117,116,112,117,116, 40, 34, 47, 42, 32,103,101,116, 32,
-    102,117,110, 99,116,105,111,110, 58, 34, 44,115,101,108,102,
-     46,110, 97,109,101, 44, 34, 32, 42, 47, 34, 41, 10, 32,101,
-    110,100, 10, 32,115,101,108,102, 46, 99,103,101,116,110, 97,
-    109,101, 32, 61, 32,115,101,108,102, 58, 99,102,117,110, 99,
-    110, 97,109,101, 40, 34,116,111,108,117, 97, 95,103,101,116,
-     34, 41, 10, 32,111,117,116,112,117,116, 40, 34, 35,105,102,
-    110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65,
-     66, 76, 69, 95, 34, 46, 46,115,101,108,102, 46, 99,103,101,
-    116,110, 97,109,101, 41, 10, 32,111,117,116,112,117,116, 40,
-     34, 92,110,115,116, 97,116,105, 99, 32,105,110,116, 34, 44,
-    115,101,108,102, 46, 99,103,101,116,110, 97,109,101, 44, 34,
-     40,108,117, 97, 95, 83,116, 97,116,101, 42, 32,116,111,108,
-    117, 97, 95, 83, 41, 34, 41, 10, 32,111,117,116,112,117,116,
-     40, 34,123, 34, 41, 10, 32,111,117,116,112,117,116, 40, 34,
-     32,105,110,116, 32,116,111,108,117, 97, 95,105,110,100,101,
-    120, 59, 34, 41, 10, 10, 32, 45, 45, 32,100,101, 99,108, 97,
-    114,101, 32,115,101,108,102, 44, 32,105,102, 32,116,104,101,
-     32, 99, 97,115,101, 10, 32,108,111, 99, 97,108, 32, 95, 44,
-     95, 44,115,116, 97,116,105, 99, 32, 61, 32,115,116,114,102,
-    105,110,100, 40,115,101,108,102, 46,109,111,100, 44, 39, 94,
-     37,115, 42, 40,115,116, 97,116,105, 99, 41, 39, 41, 10, 32,
-    105,102, 32, 99,108, 97,115,115, 32, 97,110,100, 32,115,116,
-     97,116,105, 99, 61, 61,110,105,108, 32,116,104,101,110, 10,
-     32, 32,111,117,116,112,117,116, 40, 39, 32, 39, 44,115,101,
-    108,102, 46,112, 97,114,101,110,116, 46,116,121,112,101, 44,
-     39, 42, 39, 44, 39,115,101,108,102, 59, 39, 41, 10, 32, 32,
-    111,117,116,112,117,116, 40, 39, 32,108,117, 97, 95,112,117,
-    115,104,115,116,114,105,110,103, 40,116,111,108,117, 97, 95,
-     83, 44, 34, 46,115,101,108,102, 34, 41, 59, 39, 41, 10, 32,
-     32,111,117,116,112,117,116, 40, 39, 32,108,117, 97, 95,114,
-     97,119,103,101,116, 40,116,111,108,117, 97, 95, 83, 44, 49,
-     41, 59, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39,
-     32,115,101,108,102, 32, 61, 32, 39, 41, 10, 32, 32,111,117,
-    116,112,117,116, 40, 39, 40, 39, 44,115,101,108,102, 46,112,
-     97,114,101,110,116, 46,116,121,112,101, 44, 39, 42, 41, 32,
-     39, 41, 10, 32, 32,111,117,116,112,117,116, 40, 39,108,117,
-     97, 95,116,111,117,115,101,114,100, 97,116, 97, 40,116,111,
-    108,117, 97, 95, 83, 44, 45, 49, 41, 59, 39, 41, 10, 32,101,
-    108,115,101,105,102, 32,115,116, 97,116,105, 99, 32,116,104,
-    101,110, 10, 32, 32, 95, 44, 95, 44,115,101,108,102, 46,109,
-    111,100, 32, 61, 32,115,116,114,102,105,110,100, 40,115,101,
-    108,102, 46,109,111,100, 44, 39, 94, 37,115, 42,115,116, 97,
-    116,105, 99, 37,115, 37,115, 42, 40, 46, 42, 41, 39, 41, 10,
-     32,101,110,100, 10, 10, 32, 45, 45, 32, 99,104,101, 99,107,
-     32,105,110,100,101,120, 10,  9,111,117,116,112,117,116, 40,
-     39, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95,
-     82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,  9,111,117,
-    116,112,117,116, 40, 39, 32,123, 39, 41, 10,  9,111,117,116,
-    112,117,116, 40, 39, 32, 32,116,111,108,117, 97, 95, 69,114,
-    114,111,114, 32,116,111,108,117, 97, 95,101,114,114, 59, 39,
-     41, 10, 32,111,117,116,112,117,116, 40, 39, 32, 32,105,102,
-     32, 40, 33,116,111,108,117, 97, 95,105,115,110,117,109, 98,
-    101,114, 40,116,111,108,117, 97, 95, 83, 44, 50, 44, 48, 44,
-     38,116,111,108,117, 97, 95,101,114,114, 41, 41, 39, 41, 10,
-     32,111,117,116,112,117,116, 40, 39, 32, 32, 32,116,111,108,
-    117, 97, 95,101,114,114,111,114, 40,116,111,108,117, 97, 95,
-     83, 44, 34, 35,118,105,110,118, 97,108,105,100, 32,116,121,
-    112,101, 32,105,110, 32, 97,114,114, 97,121, 32,105,110,100,
-    101,120,105,110,103, 46, 34, 44, 38,116,111,108,117, 97, 95,
-    101,114,114, 41, 59, 39, 41, 10,  9,111,117,116,112,117,116,
-     40, 39, 32,125, 39, 41, 10,  9,111,117,116,112,117,116, 40,
-     39, 35,101,110,100,105,102, 92,110, 39, 41, 10,  9,105,102,
-     32,102,108, 97,103,115, 91, 39, 49, 39, 93, 32,116,104,101,
-    110, 32, 45, 45, 32,102,111,114, 32, 99,111,109,112, 97,116,
-    105, 98,105,108,105,116,121, 32,119,105,116,104, 32,116,111,
-    108,117, 97, 53, 32, 63, 10,  9,  9,111,117,116,112,117,116,
-     40, 39, 32,116,111,108,117, 97, 95,105,110,100,101,120, 32,
-     61, 32, 40,105,110,116, 41,116,111,108,117, 97, 95,116,111,
-    110,117,109, 98,101,114, 40,116,111,108,117, 97, 95, 83, 44,
-     50, 44, 48, 41, 45, 49, 59, 39, 41, 10,  9,101,108,115,101,
-     10,  9,  9,111,117,116,112,117,116, 40, 39, 32,116,111,108,
-    117, 97, 95,105,110,100,101,120, 32, 61, 32, 40,105,110,116,
-     41,116,111,108,117, 97, 95,116,111,110,117,109, 98,101,114,
-     40,116,111,108,117, 97, 95, 83, 44, 50, 44, 48, 41, 59, 39,
-     41, 10,  9,101,110,100, 10,  9,111,117,116,112,117,116, 40,
-     39, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95,
-     82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,  9,105,102,
-     32,115,101,108,102, 46,100,105,109, 32, 97,110,100, 32,115,
-    101,108,102, 46,100,105,109, 32,126, 61, 32, 39, 39, 32,116,
-    104,101,110, 10,  9, 32, 32,111,117,116,112,117,116, 40, 39,
-     32,105,102, 32, 40,116,111,108,117, 97, 95,105,110,100,101,
-    120, 60, 48, 32,124,124, 32,116,111,108,117, 97, 95,105,110,
-    100,101,120, 62, 61, 39, 46, 46,115,101,108,102, 46,100,105,
-    109, 46, 46, 39, 41, 39, 41, 10,  9,101,108,115,101, 10,  9,
-     32, 32,111,117,116,112,117,116, 40, 39, 32,105,102, 32, 40,
-    116,111,108,117, 97, 95,105,110,100,101,120, 60, 48, 41, 39,
-     41, 10,  9,101,110,100, 10, 32,111,117,116,112,117,116, 40,
-     39, 32, 32,116,111,108,117, 97, 95,101,114,114,111,114, 40,
-    116,111,108,117, 97, 95, 83, 44, 34, 97,114,114, 97,121, 32,
-    105,110,100,101,120,105,110,103, 32,111,117,116, 32,111,102,
-     32,114, 97,110,103,101, 46, 34, 44, 78, 85, 76, 76, 41, 59,
-     39, 41, 10,  9,111,117,116,112,117,116, 40, 39, 35,101,110,
-    100,105,102, 92,110, 39, 41, 10, 10, 32, 45, 45, 32,114,101,
-    116,117,114,110, 32,118, 97,108,117,101, 10, 32,108,111, 99,
-     97,108, 32,116, 44, 99,116, 32, 61, 32,105,115, 98, 97,115,
-    105, 99, 40,115,101,108,102, 46,116,121,112,101, 41, 10, 32,
-    105,102, 32,116, 32,116,104,101,110, 10, 32, 32,111,117,116,
-    112,117,116, 40, 39, 32,116,111,108,117, 97, 95,112,117,115,
-    104, 39, 46, 46,116, 46, 46, 39, 40,116,111,108,117, 97, 95,
-     83, 44, 40, 39, 44, 99,116, 44, 39, 41, 39, 46, 46,115,101,
-    108,102, 58,103,101,116,118, 97,108,117,101, 40, 99,108, 97,
-    115,115, 44,115,116, 97,116,105, 99, 41, 46, 46, 39, 41, 59,
-     39, 41, 10, 32,101,108,115,101, 10,  9,  9,116, 32, 61, 32,
-    115,101,108,102, 46,116,121,112,101, 10, 32, 32,105,102, 32,
-    115,101,108,102, 46,112,116,114, 32, 61, 61, 32, 39, 38, 39,
-     32,111,114, 32,115,101,108,102, 46,112,116,114, 32, 61, 61,
-     32, 39, 39, 32,116,104,101,110, 10, 32, 32, 32,111,117,116,
-    112,117,116, 40, 39, 32,116,111,108,117, 97, 95,112,117,115,
-    104,117,115,101,114,116,121,112,101, 40,116,111,108,117, 97,
-     95, 83, 44, 40,118,111,105,100, 42, 41, 38, 39, 46, 46,115,
-    101,108,102, 58,103,101,116,118, 97,108,117,101, 40, 99,108,
-     97,115,115, 44,115,116, 97,116,105, 99, 41, 46, 46, 39, 44,
-     34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10, 32, 32,101,
-    108,115,101, 10, 32, 32, 32,111,117,116,112,117,116, 40, 39,
-     32,116,111,108,117, 97, 95,112,117,115,104,117,115,101,114,
-    116,121,112,101, 40,116,111,108,117, 97, 95, 83, 44, 40,118,
-    111,105,100, 42, 41, 39, 46, 46,115,101,108,102, 58,103,101,
-    116,118, 97,108,117,101, 40, 99,108, 97,115,115, 44,115,116,
-     97,116,105, 99, 41, 46, 46, 39, 44, 34, 39, 44,116, 44, 39,
-     34, 41, 59, 39, 41, 10, 32, 32,101,110,100, 10, 32,101,110,
-    100, 10, 32,111,117,116,112,117,116, 40, 39, 32,114,101,116,
-    117,114,110, 32, 49, 59, 39, 41, 10, 32,111,117,116,112,117,
-    116, 40, 39,125, 39, 41, 10, 32,111,117,116,112,117,116, 40,
-     39, 35,101,110,100,105,102, 32, 47, 47, 35,105,102,110,100,
-    101,102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76,
-     69, 92,110, 39, 41, 10, 32,111,117,116,112,117,116, 40, 39,
-     92,110, 39, 41, 10, 10, 32, 45, 45, 32,115,101,116, 32,102,
-    117,110, 99,116,105,111,110, 32, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
-     45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 10, 32,105,102,
-     32,110,111,116, 32,115,116,114,102,105,110,100, 40,115,101,
-    108,102, 46,116,121,112,101, 44, 39, 99,111,110,115,116, 39,
-     41, 32,116,104,101,110, 10, 32, 32,105,102, 32, 99,108, 97,
-    115,115, 32,116,104,101,110, 10, 32, 32, 32,111,117,116,112,
-    117,116, 40, 34, 47, 42, 32,115,101,116, 32,102,117,110, 99,
-    116,105,111,110, 58, 34, 44,115,101,108,102, 46,110, 97,109,
-    101, 44, 34, 32,111,102, 32, 99,108, 97,115,115, 32, 34, 44,
-     99,108, 97,115,115, 44, 34, 32, 42, 47, 34, 41, 10, 32, 32,
-    101,108,115,101, 10, 32, 32, 32,111,117,116,112,117,116, 40,
-     34, 47, 42, 32,115,101,116, 32,102,117,110, 99,116,105,111,
-    110, 58, 34, 44,115,101,108,102, 46,110, 97,109,101, 44, 34,
-     32, 42, 47, 34, 41, 10, 32, 32,101,110,100, 10, 32, 32,115,
-    101,108,102, 46, 99,115,101,116,110, 97,109,101, 32, 61, 32,
-    115,101,108,102, 58, 99,102,117,110, 99,110, 97,109,101, 40,
-     34,116,111,108,117, 97, 95,115,101,116, 34, 41, 10, 32, 32,
-    111,117,116,112,117,116, 40, 34, 35,105,102,110,100,101,102,
-     32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69, 95,
-     34, 46, 46,115,101,108,102, 46, 99,115,101,116,110, 97,109,
-    101, 41, 10, 32, 32,111,117,116,112,117,116, 40, 34, 92,110,
-    115,116, 97,116,105, 99, 32,105,110,116, 34, 44,115,101,108,
-    102, 46, 99,115,101,116,110, 97,109,101, 44, 34, 40,108,117,
-     97, 95, 83,116, 97,116,101, 42, 32,116,111,108,117, 97, 95,
-     83, 41, 34, 41, 10, 32, 32,111,117,116,112,117,116, 40, 34,
-    123, 34, 41, 10, 10, 32, 32, 45, 45, 32,100,101, 99,108, 97,
-    114,101, 32,105,110,100,101,120, 10, 32, 32,111,117,116,112,
-    117,116, 40, 39, 32,105,110,116, 32,116,111,108,117, 97, 95,
-    105,110,100,101,120, 59, 39, 41, 10, 10, 32, 32, 45, 45, 32,
-    100,101, 99,108, 97,114,101, 32,115,101,108,102, 44, 32,105,
-    102, 32,116,104,101, 32, 99, 97,115,101, 10, 32, 32,108,111,
-     99, 97,108, 32, 95, 44, 95, 44,115,116, 97,116,105, 99, 32,
-     61, 32,115,116,114,102,105,110,100, 40,115,101,108,102, 46,
-    109,111,100, 44, 39, 94, 37,115, 42, 40,115,116, 97,116,105,
-     99, 41, 39, 41, 10, 32, 32,105,102, 32, 99,108, 97,115,115,
-     32, 97,110,100, 32,115,116, 97,116,105, 99, 61, 61,110,105,
-    108, 32,116,104,101,110, 10, 32, 32, 32,111,117,116,112,117,
-    116, 40, 39, 32, 39, 44,115,101,108,102, 46,112, 97,114,101,
-    110,116, 46,116,121,112,101, 44, 39, 42, 39, 44, 39,115,101,
-    108,102, 59, 39, 41, 10, 32, 32, 32,111,117,116,112,117,116,
-     40, 39, 32,108,117, 97, 95,112,117,115,104,115,116,114,105,
-    110,103, 40,116,111,108,117, 97, 95, 83, 44, 34, 46,115,101,
-    108,102, 34, 41, 59, 39, 41, 10, 32, 32, 32,111,117,116,112,
-    117,116, 40, 39, 32,108,117, 97, 95,114, 97,119,103,101,116,
-     40,116,111,108,117, 97, 95, 83, 44, 49, 41, 59, 39, 41, 10,
-     32, 32, 32,111,117,116,112,117,116, 40, 39, 32,115,101,108,
-    102, 32, 61, 32, 39, 41, 10, 32, 32, 32,111,117,116,112,117,
-    116, 40, 39, 40, 39, 44,115,101,108,102, 46,112, 97,114,101,
-    110,116, 46,116,121,112,101, 44, 39, 42, 41, 32, 39, 41, 10,
-     32, 32, 32,111,117,116,112,117,116, 40, 39,108,117, 97, 95,
-    116,111,117,115,101,114,100, 97,116, 97, 40,116,111,108,117,
-     97, 95, 83, 44, 45, 49, 41, 59, 39, 41, 10, 32, 32,101,108,
-    115,101,105,102, 32,115,116, 97,116,105, 99, 32,116,104,101,
-    110, 10, 32, 32, 32, 95, 44, 95, 44,115,101,108,102, 46,109,
-    111,100, 32, 61, 32,115,116,114,102,105,110,100, 40,115,101,
-    108,102, 46,109,111,100, 44, 39, 94, 37,115, 42,115,116, 97,
-    116,105, 99, 37,115, 37,115, 42, 40, 46, 42, 41, 39, 41, 10,
-     32, 32,101,110,100, 10, 10, 32, 32, 45, 45, 32, 99,104,101,
-     99,107, 32,105,110,100,101,120, 10,  9, 32,111,117,116,112,
-    117,116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76,
-     85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,
-      9, 32,111,117,116,112,117,116, 40, 39, 32,123, 39, 41, 10,
-      9, 32,111,117,116,112,117,116, 40, 39, 32, 32,116,111,108,
-    117, 97, 95, 69,114,114,111,114, 32,116,111,108,117, 97, 95,
-    101,114,114, 59, 39, 41, 10, 32, 32,111,117,116,112,117,116,
-     40, 39, 32, 32,105,102, 32, 40, 33,116,111,108,117, 97, 95,
-    105,115,110,117,109, 98,101,114, 40,116,111,108,117, 97, 95,
-     83, 44, 50, 44, 48, 44, 38,116,111,108,117, 97, 95,101,114,
-    114, 41, 41, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40,
-     39, 32, 32, 32,116,111,108,117, 97, 95,101,114,114,111,114,
-     40,116,111,108,117, 97, 95, 83, 44, 34, 35,118,105,110,118,
-     97,108,105,100, 32,116,121,112,101, 32,105,110, 32, 97,114,
-    114, 97,121, 32,105,110,100,101,120,105,110,103, 46, 34, 44,
-     38,116,111,108,117, 97, 95,101,114,114, 41, 59, 39, 41, 10,
-      9,  9,111,117,116,112,117,116, 40, 39, 32,125, 39, 41, 10,
-      9,  9,111,117,116,112,117,116, 40, 39, 35,101,110,100,105,
-    102, 92,110, 39, 41, 10, 10,  9,105,102, 32,102,108, 97,103,
-    115, 91, 39, 49, 39, 93, 32,116,104,101,110, 32, 45, 45, 32,
-    102,111,114, 32, 99,111,109,112, 97,116,105, 98,105,108,105,
-    116,121, 32,119,105,116,104, 32,116,111,108,117, 97, 53, 32,
-     63, 10,  9,  9,111,117,116,112,117,116, 40, 39, 32,116,111,
-    108,117, 97, 95,105,110,100,101,120, 32, 61, 32, 40,105,110,
-    116, 41,116,111,108,117, 97, 95,116,111,110,117,109, 98,101,
-    114, 40,116,111,108,117, 97, 95, 83, 44, 50, 44, 48, 41, 45,
-     49, 59, 39, 41, 10,  9,101,108,115,101, 10,  9,  9,111,117,
-    116,112,117,116, 40, 39, 32,116,111,108,117, 97, 95,105,110,
-    100,101,120, 32, 61, 32, 40,105,110,116, 41,116,111,108,117,
-     97, 95,116,111,110,117,109, 98,101,114, 40,116,111,108,117,
-     97, 95, 83, 44, 50, 44, 48, 41, 59, 39, 41, 10,  9,101,110,
-    100, 10, 10,  9, 32,111,117,116,112,117,116, 40, 39, 35,105,
-    102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 82, 69, 76,
-     69, 65, 83, 69, 92,110, 39, 41, 10,  9,105,102, 32,115,101,
-    108,102, 46,100,105,109, 32, 97,110,100, 32,115,101,108,102,
-     46,100,105,109, 32,126, 61, 32, 39, 39, 32,116,104,101,110,
-     10,  9, 32, 32,111,117,116,112,117,116, 40, 39, 32,105,102,
-     32, 40,116,111,108,117, 97, 95,105,110,100,101,120, 60, 48,
-     32,124,124, 32,116,111,108,117, 97, 95,105,110,100,101,120,
-     62, 61, 39, 46, 46,115,101,108,102, 46,100,105,109, 46, 46,
-     39, 41, 39, 41, 10,  9,101,108,115,101, 10,  9, 32, 32,111,
-    117,116,112,117,116, 40, 39, 32,105,102, 32, 40,116,111,108,
-    117, 97, 95,105,110,100,101,120, 60, 48, 41, 39, 41, 10,  9,
-    101,110,100, 10, 32, 32,111,117,116,112,117,116, 40, 39, 32,
-     32,116,111,108,117, 97, 95,101,114,114,111,114, 40,116,111,
-    108,117, 97, 95, 83, 44, 34, 97,114,114, 97,121, 32,105,110,
-    100,101,120,105,110,103, 32,111,117,116, 32,111,102, 32,114,
-     97,110,103,101, 46, 34, 44, 78, 85, 76, 76, 41, 59, 39, 41,
-     10,  9,  9,111,117,116,112,117,116, 40, 39, 35,101,110,100,
-    105,102, 92,110, 39, 41, 10, 10, 32, 32, 45, 45, 32, 97,115,
-    115,105,103,110, 32,118, 97,108,117,101, 10, 32, 32,108,111,
-     99, 97,108, 32,112,116,114, 32, 61, 32, 39, 39, 10, 32, 32,
-    105,102, 32,115,101,108,102, 46,112,116,114,126, 61, 39, 39,
-     32,116,104,101,110, 32,112,116,114, 32, 61, 32, 39, 42, 39,
-     32,101,110,100, 10, 32, 32,111,117,116,112,117,116, 40, 39,
-     32, 39, 41, 10, 32, 32,105,102, 32, 99,108, 97,115,115, 32,
-     97,110,100, 32,115,116, 97,116,105, 99, 32,116,104,101,110,
-     10, 32, 32, 32,111,117,116,112,117,116, 40, 99,108, 97,115,
-    115, 46, 46, 39, 58, 58, 39, 46, 46,115,101,108,102, 46,110,
-     97,109,101, 46, 46, 39, 91,116,111,108,117, 97, 95,105,110,
-    100,101,120, 93, 39, 41, 10, 32, 32,101,108,115,101,105,102,
-     32, 99,108, 97,115,115, 32,116,104,101,110, 10, 32, 32, 32,
-    111,117,116,112,117,116, 40, 39,115,101,108,102, 45, 62, 39,
-     46, 46,115,101,108,102, 46,110, 97,109,101, 46, 46, 39, 91,
-    116,111,108,117, 97, 95,105,110,100,101,120, 93, 39, 41, 10,
-     32, 32,101,108,115,101, 10, 32, 32, 32,111,117,116,112,117,
-    116, 40,115,101,108,102, 46,110, 97,109,101, 46, 46, 39, 91,
-    116,111,108,117, 97, 95,105,110,100,101,120, 93, 39, 41, 10,
-     32, 32,101,110,100, 10, 32, 32,108,111, 99, 97,108, 32,116,
-     32, 61, 32,105,115, 98, 97,115,105, 99, 40,115,101,108,102,
-     46,116,121,112,101, 41, 10, 32, 32,111,117,116,112,117,116,
-     40, 39, 32, 61, 32, 39, 41, 10, 32, 32,105,102, 32,110,111,
-    116, 32,116, 32, 97,110,100, 32,112,116,114, 61, 61, 39, 39,
-     32,116,104,101,110, 32,111,117,116,112,117,116, 40, 39, 42,
-     39, 41, 32,101,110,100, 10, 32, 32,111,117,116,112,117,116,
-     40, 39, 40, 40, 39, 44,115,101,108,102, 46,109,111,100, 44,
-    115,101,108,102, 46,116,121,112,101, 41, 10, 32, 32,105,102,
-     32,110,111,116, 32,116, 32,116,104,101,110, 10, 32, 32, 32,
-    111,117,116,112,117,116, 40, 39, 42, 39, 41, 10, 32, 32,101,
-    110,100, 10, 32, 32,111,117,116,112,117,116, 40, 39, 41, 32,
-     39, 41, 10, 32, 32,108,111, 99, 97,108, 32,100,101,102, 32,
-     61, 32, 48, 10, 32, 32,105,102, 32,115,101,108,102, 46,100,
-    101,102, 32,126, 61, 32, 39, 39, 32,116,104,101,110, 32,100,
-    101,102, 32, 61, 32,115,101,108,102, 46,100,101,102, 32,101,
-    110,100, 10, 32, 32,105,102, 32,116, 32,116,104,101,110, 10,
-     32, 32, 32,111,117,116,112,117,116, 40, 39,116,111,108,117,
-     97, 95,116,111, 39, 46, 46,116, 44, 39, 40,116,111,108,117,
-     97, 95, 83, 44, 51, 44, 39, 44,100,101,102, 44, 39, 41, 41,
-     59, 39, 41, 10, 32, 32,101,108,115,101, 10, 32, 32, 32,111,
-    117,116,112,117,116, 40, 39,116,111,108,117, 97, 95,116,111,
-    117,115,101,114,116,121,112,101, 40,116,111,108,117, 97, 95,
-     83, 44, 51, 44, 39, 44,100,101,102, 44, 39, 41, 41, 59, 39,
-     41, 10, 32, 32,101,110,100, 10, 32, 32,111,117,116,112,117,
-    116, 40, 39, 32,114,101,116,117,114,110, 32, 48, 59, 39, 41,
-     10, 32, 32,111,117,116,112,117,116, 40, 39,125, 39, 41, 10,
-     32, 32,111,117,116,112,117,116, 40, 39, 35,101,110,100,105,
-    102, 32, 47, 47, 35,105,102,110,100,101,102, 32, 84, 79, 76,
-     85, 65, 95, 68, 73, 83, 65, 66, 76, 69, 92,110, 39, 41, 10,
-     32, 32,111,117,116,112,117,116, 40, 39, 92,110, 39, 41, 10,
-     32,101,110,100, 10, 10,101,110,100, 10, 10,102,117,110, 99,
-    116,105,111,110, 32, 99,108, 97,115,115, 65,114,114, 97,121,
-     58,114,101,103,105,115,116,101,114, 32, 40,112,114,101, 41,
-     10, 32,112,114,101, 32, 61, 32,112,114,101, 32,111,114, 32,
-     39, 39, 10, 32,105,102, 32,115,101,108,102, 46, 99,115,101,
-    116,110, 97,109,101, 32,116,104,101,110, 10, 32, 32,111,117,
-    116,112,117,116, 40,112,114,101, 46, 46, 39,116,111,108,117,
-     97, 95, 97,114,114, 97,121, 40,116,111,108,117, 97, 95, 83,
-     44, 34, 39, 46, 46,115,101,108,102, 46,108,110, 97,109,101,
-     46, 46, 39, 34, 44, 39, 46, 46,115,101,108,102, 46, 99,103,
-    101,116,110, 97,109,101, 46, 46, 39, 44, 39, 46, 46,115,101,
-    108,102, 46, 99,115,101,116,110, 97,109,101, 46, 46, 39, 41,
-     59, 39, 41, 10, 32,101,108,115,101, 10, 32, 32,111,117,116,
-    112,117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97,
-     95, 97,114,114, 97,121, 40,116,111,108,117, 97, 95, 83, 44,
-     34, 39, 46, 46,115,101,108,102, 46,108,110, 97,109,101, 46,
-     46, 39, 34, 44, 39, 46, 46,115,101,108,102, 46, 99,103,101,
-    116,110, 97,109,101, 46, 46, 39, 44, 78, 85, 76, 76, 41, 59,
-     39, 41, 10, 32,101,110,100, 10,101,110,100, 10, 10, 45, 45,
-     32, 73,110,116,101,114,110, 97,108, 32, 99,111,110,115,116,
-    114,117, 99,116,111,114, 10,102,117,110, 99,116,105,111,110,
-     32, 95, 65,114,114, 97,121, 32, 40,116, 41, 10, 32,115,101,
-    116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44, 99,108,
-     97,115,115, 65,114,114, 97,121, 41, 10, 32, 97,112,112,101,
-    110,100, 40,116, 41, 10, 32,114,101,116,117,114,110, 32,116,
-     10,101,110,100, 10, 10, 45, 45, 32, 67,111,110,115,116,114,
-    117, 99,116,111,114, 10, 45, 45, 32, 69,120,112,101, 99,116,
-    115, 32, 97, 32,115,116,114,105,110,103, 32,114,101,112,114,
-    101,115,101,110,116,105,110,103, 32,116,104,101, 32,118, 97,
-    114,105, 97, 98,108,101, 32,100,101, 99,108, 97,114, 97,116,
-    105,111,110, 46, 10,102,117,110, 99,116,105,111,110, 32, 65,
-    114,114, 97,121, 32, 40,115, 41, 10, 32,114,101,116,117,114,
-    110, 32, 95, 65,114,114, 97,121, 32, 40, 68,101, 99,108, 97,
-    114, 97,116,105,111,110, 40,115, 44, 39,118, 97,114, 39, 41,
-     41, 10,101,110,100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/array.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    45, 45, 32,116,111,108,117, 97, 58, 32,102,117,110, 99,116,
-    105,111,110, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,
-    105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109,
-     97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67,
-     71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45,
-     32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,
-    100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,
-    111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,
-    116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,
-    114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,116,
-     32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,
-    105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,
-    119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,
-    101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32,
-     97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,
-    115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,
-    117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,
-    108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,
-    118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,
-    101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100,
-     97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,
-    101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,
-    102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 10, 45,
-     45, 32, 70,117,110, 99,116,105,111,110, 32, 99,108, 97,115,
-    115, 10, 45, 45, 32, 82,101,112,114,101,115,101,110,116,115,
-     32, 97, 32,102,117,110, 99,116,105,111,110, 32,111,114, 32,
-     97, 32, 99,108, 97,115,115, 32,109,101,116,104,111,100, 46,
-     10, 45, 45, 32, 84,104,101, 32,102,111,108,108,111,119,105,
-    110,103, 32,102,105,101,108,100,115, 32, 97,114,101, 32,115,
-    116,111,114,101,100, 58, 10, 45, 45, 32, 32,109,111,100, 32,
-     32, 61, 32,116,121,112,101, 32,109,111,100,105,102,105,101,
-    114,115, 10, 45, 45, 32, 32,116,121,112,101, 32, 61, 32,116,
-    121,112,101, 10, 45, 45, 32, 32,112,116,114, 32, 32, 61, 32,
-     34, 42, 34, 32,111,114, 32, 34, 38, 34, 44, 32,105,102, 32,
-    114,101,112,114,101,115,101,110,116,105,110,103, 32, 97, 32,
-    112,111,105,110,116,101,114, 32,111,114, 32, 97, 32,114,101,
-    102,101,114,101,110, 99,101, 10, 45, 45, 32, 32,110, 97,109,
-    101, 32, 61, 32,110, 97,109,101, 10, 45, 45, 32, 32,108,110,
-     97,109,101, 32, 61, 32,108,117, 97, 32,110, 97,109,101, 10,
-     45, 45, 32, 32, 97,114,103,115, 32, 32, 61, 32,108,105,115,
-    116, 32,111,102, 32, 97,114,103,117,109,101,110,116, 32,100,
-    101, 99,108, 97,114, 97,116,105,111,110,115, 10, 45, 45, 32,
-     32, 99,111,110,115,116, 32, 61, 32,105,102, 32,105,116, 32,
-    105,115, 32, 97, 32,109,101,116,104,111,100, 32,114,101, 99,
-    101,105,118,105,110,103, 32, 97, 32, 99,111,110,115,116, 32,
-     34,116,104,105,115, 34, 46, 10, 99,108, 97,115,115, 70,117,
-    110, 99,116,105,111,110, 32, 61, 32,123, 10, 32,109,111,100,
-     32, 61, 32, 39, 39, 44, 10, 32,116,121,112,101, 32, 61, 32,
-     39, 39, 44, 10, 32,112,116,114, 32, 61, 32, 39, 39, 44, 10,
-     32,110, 97,109,101, 32, 61, 32, 39, 39, 44, 10, 32, 97,114,
-    103,115, 32, 61, 32,123,110, 61, 48,125, 44, 10, 32, 99,111,
-    110,115,116, 32, 61, 32, 39, 39, 44, 10,125, 10, 99,108, 97,
-    115,115, 70,117,110, 99,116,105,111,110, 46, 95, 95,105,110,
-    100,101,120, 32, 61, 32, 99,108, 97,115,115, 70,117,110, 99,
-    116,105,111,110, 10,115,101,116,109,101,116, 97,116, 97, 98,
-    108,101, 40, 99,108, 97,115,115, 70,117,110, 99,116,105,111,
-    110, 44, 99,108, 97,115,115, 70,101, 97,116,117,114,101, 41,
-     10, 10, 45, 45, 32,100,101, 99,108, 97,114,101, 32,116, 97,
-    103,115, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,
-    115,115, 70,117,110, 99,116,105,111,110, 58,100,101, 99,108,
-    116,121,112,101, 32, 40, 41, 10, 32,115,101,108,102, 46,116,
-    121,112,101, 32, 61, 32,116,121,112,101,118, 97,114, 40,115,
-    101,108,102, 46,116,121,112,101, 41, 10, 32,105,102, 32,115,
-    116,114,102,105,110,100, 40,115,101,108,102, 46,109,111,100,
-     44, 39, 99,111,110,115,116, 39, 41, 32,116,104,101,110, 10,
-      9, 32,115,101,108,102, 46,116,121,112,101, 32, 61, 32, 39,
-     99,111,110,115,116, 32, 39, 46, 46,115,101,108,102, 46,116,
-    121,112,101, 10,  9,  9,115,101,108,102, 46,109,111,100, 32,
-     61, 32,103,115,117, 98, 40,115,101,108,102, 46,109,111,100,
-     44, 39, 99,111,110,115,116, 39, 44, 39, 39, 41, 10,  9,101,
-    110,100, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,
-    119,104,105,108,101, 32,115,101,108,102, 46, 97,114,103,115,
-     91,105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 46, 97,
-    114,103,115, 91,105, 93, 58,100,101, 99,108,116,121,112,101,
-     40, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,
-    110,100, 10,101,110,100, 10, 10, 10, 45, 45, 32, 87,114,105,
-    116,101, 32, 98,105,110,100,105,110,103, 32,102,117,110, 99,
-    116,105,111,110, 10, 45, 45, 32, 79,117,116,112,117,116,115,
-     32, 67, 47, 67, 43, 43, 32, 98,105,110,100,105,110,103, 32,
-    102,117,110, 99,116,105,111,110, 46, 10,102,117,110, 99,116,
-    105,111,110, 32, 99,108, 97,115,115, 70,117,110, 99,116,105,
-    111,110, 58,115,117,112, 99,111,100,101, 32, 40,108,111, 99,
-     97,108, 95, 99,111,110,115,116,114,117, 99,116,111,114, 41,
-     10, 10, 32,108,111, 99, 97,108, 32,111,118,101,114,108,111,
-     97,100, 32, 61, 32,115,116,114,115,117, 98, 40,115,101,108,
-    102, 46, 99,110, 97,109,101, 44, 45, 50, 44, 45, 49, 41, 32,
-     45, 32, 49, 32, 32, 45, 45, 32,105,110,100,105, 99, 97,116,
-    101, 32,111,118,101,114,108,111, 97,100,101,100, 32,102,117,
-    110, 99, 10, 32,108,111, 99, 97,108, 32,110,114,101,116, 32,
-     61, 32, 48, 32, 32, 32, 32, 32, 32, 45, 45, 32,110,117,109,
-     98,101,114, 32,111,102, 32,114,101,116,117,114,110,101,100,
-     32,118, 97,108,117,101,115, 10, 32,108,111, 99, 97,108, 32,
-     99,108, 97,115,115, 32, 61, 32,115,101,108,102, 58,105,110,
-     99,108, 97,115,115, 40, 41, 10, 32,108,111, 99, 97,108, 32,
-     95, 44, 95, 44,115,116, 97,116,105, 99, 32, 61, 32,115,116,
-    114,102,105,110,100, 40,115,101,108,102, 46,109,111,100, 44,
-     39, 94, 37,115, 42, 40,115,116, 97,116,105, 99, 41, 39, 41,
-     10, 32,105,102, 32, 99,108, 97,115,115, 32,116,104,101,110,
-     10, 10, 32,  9,105,102, 32,115,101,108,102, 46,110, 97,109,
-    101, 32, 61, 61, 32, 39,110,101,119, 39, 32, 97,110,100, 32,
-    115,101,108,102, 46,112, 97,114,101,110,116, 46,102,108, 97,
-    103,115, 46,112,117,114,101, 95,118,105,114,116,117, 97,108,
-     32,116,104,101,110, 10, 32,  9,  9, 45, 45, 32,110,111, 32,
-     99,111,110,115,116,114,117, 99,116,111,114, 32,102,111,114,
-     32, 99,108, 97,115,115,101,115, 32,119,105,116,104, 32,112,
-    117,114,101, 32,118,105,114,116,117, 97,108, 32,109,101,116,
-    104,111,100,115, 10, 32,  9,  9,114,101,116,117,114,110, 10,
-     32,  9,101,110,100, 10, 10, 32,  9,105,102, 32,108,111, 99,
-     97,108, 95, 99,111,110,115,116,114,117, 99,116,111,114, 32,
-    116,104,101,110, 10,  9,  9,111,117,116,112,117,116, 40, 34,
-     47, 42, 32,109,101,116,104,111,100, 58, 32,110,101,119, 95,
-    108,111, 99, 97,108, 32,111,102, 32, 99,108, 97,115,115, 32,
-     34, 44, 99,108, 97,115,115, 44, 34, 32, 42, 47, 34, 41, 10,
-      9,101,108,115,101, 10,  9,  9,111,117,116,112,117,116, 40,
-     34, 47, 42, 32,109,101,116,104,111,100, 58, 34, 44,115,101,
-    108,102, 46,110, 97,109,101, 44, 34, 32,111,102, 32, 99,108,
-     97,115,115, 32, 34, 44, 99,108, 97,115,115, 44, 34, 32, 42,
-     47, 34, 41, 10,  9,101,110,100, 10, 32,101,108,115,101, 10,
-     32, 32,111,117,116,112,117,116, 40, 34, 47, 42, 32,102,117,
-    110, 99,116,105,111,110, 58, 34, 44,115,101,108,102, 46,110,
-     97,109,101, 44, 34, 32, 42, 47, 34, 41, 10, 32,101,110,100,
-     10, 10, 32,105,102, 32,108,111, 99, 97,108, 95, 99,111,110,
-    115,116,114,117, 99,116,111,114, 32,116,104,101,110, 10, 32,
-     32,111,117,116,112,117,116, 40, 34, 35,105,102,110,100,101,
-    102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69,
-     95, 34, 46, 46,115,101,108,102, 46, 99,110, 97,109,101, 46,
-     46, 34, 95,108,111, 99, 97,108, 34, 41, 10, 32, 32,111,117,
-    116,112,117,116, 40, 34, 92,110,115,116, 97,116,105, 99, 32,
-    105,110,116, 34, 44,115,101,108,102, 46, 99,110, 97,109,101,
-     46, 46, 34, 95,108,111, 99, 97,108, 34, 44, 34, 40,108,117,
-     97, 95, 83,116, 97,116,101, 42, 32,116,111,108,117, 97, 95,
-     83, 41, 34, 41, 10, 32,101,108,115,101, 10, 32, 32,111,117,
-    116,112,117,116, 40, 34, 35,105,102,110,100,101,102, 32, 84,
-     79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69, 95, 34, 46,
-     46,115,101,108,102, 46, 99,110, 97,109,101, 41, 10, 32, 32,
-    111,117,116,112,117,116, 40, 34, 92,110,115,116, 97,116,105,
-     99, 32,105,110,116, 34, 44,115,101,108,102, 46, 99,110, 97,
-    109,101, 44, 34, 40,108,117, 97, 95, 83,116, 97,116,101, 42,
-     32,116,111,108,117, 97, 95, 83, 41, 34, 41, 10, 32,101,110,
-    100, 10, 32,111,117,116,112,117,116, 40, 34,123, 34, 41, 10,
-     10, 32, 45, 45, 32, 99,104,101, 99,107, 32,116,121,112,101,
-    115, 10,  9,105,102, 32,111,118,101,114,108,111, 97,100, 32,
-     60, 32, 48, 32,116,104,101,110, 10,  9, 32,111,117,116,112,
-    117,116, 40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76,
-     85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,
-      9,101,110,100, 10,  9,111,117,116,112,117,116, 40, 39, 32,
-    116,111,108,117, 97, 95, 69,114,114,111,114, 32,116,111,108,
-    117, 97, 95,101,114,114, 59, 39, 41, 10, 32,111,117,116,112,
-    117,116, 40, 39, 32,105,102, 32, 40, 92,110, 39, 41, 10, 32,
-     45, 45, 32, 99,104,101, 99,107, 32,115,101,108,102, 10, 32,
-    108,111, 99, 97,108, 32,110, 97,114,103, 10, 32,105,102, 32,
-     99,108, 97,115,115, 32,116,104,101,110, 32,110, 97,114,103,
-     61, 50, 32,101,108,115,101, 32,110, 97,114,103, 61, 49, 32,
-    101,110,100, 10, 32,105,102, 32, 99,108, 97,115,115, 32,116,
-    104,101,110, 10,  9,  9,108,111, 99, 97,108, 32,102,117,110,
-     99, 32, 61, 32, 39,116,111,108,117, 97, 95,105,115,117,115,
-    101,114,116,121,112,101, 39, 10,  9,  9,108,111, 99, 97,108,
-     32,116,121,112,101, 32, 61, 32,115,101,108,102, 46,112, 97,
-    114,101,110,116, 46,116,121,112,101, 10,  9,  9,105,102, 32,
-    115,101,108,102, 46,110, 97,109,101, 61, 61, 39,110,101,119,
-     39, 32,111,114, 32,115,116, 97,116,105, 99,126, 61,110,105,
-    108, 32,116,104,101,110, 10,  9,  9,  9,102,117,110, 99, 32,
-     61, 32, 39,116,111,108,117, 97, 95,105,115,117,115,101,114,
-    116, 97, 98,108,101, 39, 10,  9,  9,  9,116,121,112,101, 32,
-     61, 32,115,101,108,102, 46,112, 97,114,101,110,116, 46,116,
-    121,112,101, 10,  9,  9,101,110,100, 10,  9,  9,105,102, 32,
-    115,101,108,102, 46, 99,111,110,115,116, 32,126, 61, 32, 39,
-     39, 32,116,104,101,110, 10,  9,  9,  9,116,121,112,101, 32,
-     61, 32, 34, 99,111,110,115,116, 32, 34, 46, 46,116,121,112,
-    101, 10,  9,  9,101,110,100, 10,  9,  9,111,117,116,112,117,
-    116, 40, 39, 32, 32, 32, 32, 32, 33, 39, 46, 46,102,117,110,
-     99, 46, 46, 39, 40,116,111,108,117, 97, 95, 83, 44, 49, 44,
-     34, 39, 46, 46,116,121,112,101, 46, 46, 39, 34, 44, 48, 44,
-     38,116,111,108,117, 97, 95,101,114,114, 41, 32,124,124, 92,
-    110, 39, 41, 10, 32,101,110,100, 10, 32, 45, 45, 32, 99,104,
-    101, 99,107, 32, 97,114,103,115, 10, 32,105,102, 32,115,101,
-    108,102, 46, 97,114,103,115, 91, 49, 93, 46,116,121,112,101,
-     32,126, 61, 32, 39,118,111,105,100, 39, 32,116,104,101,110,
-     10, 32, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32, 32,
-    119,104,105,108,101, 32,115,101,108,102, 46, 97,114,103,115,
-     91,105, 93, 32,100,111, 10, 32, 32, 32,108,111, 99, 97,108,
-     32, 98,116,121,112,101, 32, 61, 32,105,115, 98, 97,115,105,
-     99, 40,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 46,
-    116,121,112,101, 41, 10, 32, 32, 32,105,102, 32, 98,116,121,
-    112,101, 32,126, 61, 32, 39,118, 97,108,117,101, 39, 32, 97,
-    110,100, 32, 98,116,121,112,101, 32,126, 61, 32, 39,115,116,
-     97,116,101, 39, 32,116,104,101,110, 10, 32, 32, 32, 32,111,
-    117,116,112,117,116, 40, 39, 32, 32, 32, 32, 32, 33, 39, 46,
-     46,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 58,111,
-    117,116, 99,104,101, 99,107,116,121,112,101, 40,110, 97,114,
-    103, 41, 46, 46, 39, 32,124,124, 92,110, 39, 41, 10, 32, 32,
-     32,101,110,100, 10, 32, 32, 32,105,102, 32, 98,116,121,112,
-    101, 32,126, 61, 32, 39,115,116, 97,116,101, 39, 32,116,104,
-    101,110, 10,  9, 32, 32, 32,110, 97,114,103, 32, 61, 32,110,
-     97,114,103, 43, 49, 10, 32, 32, 32,101,110,100, 10, 32, 32,
-     32,105, 32, 61, 32,105, 43, 49, 10, 32, 32,101,110,100, 10,
-     32,101,110,100, 10, 32, 45, 45, 32, 99,104,101, 99,107, 32,
-    101,110,100, 32,111,102, 32,108,105,115,116, 10, 32,111,117,
-    116,112,117,116, 40, 39, 32, 32, 32, 32, 32, 33,116,111,108,
-    117, 97, 95,105,115,110,111,111, 98,106, 40,116,111,108,117,
-     97, 95, 83, 44, 39, 46, 46,110, 97,114,103, 46, 46, 39, 44,
-     38,116,111,108,117, 97, 95,101,114,114, 41, 92,110, 32, 41,
-     39, 41, 10,  9,111,117,116,112,117,116, 40, 39, 32, 32,103,
-    111,116,111, 32,116,111,108,117, 97, 95,108,101,114,114,111,
-    114, 59, 39, 41, 10, 10, 32,111,117,116,112,117,116, 40, 39,
-     32,101,108,115,101, 92,110, 39, 41, 10,  9,105,102, 32,111,
-    118,101,114,108,111, 97,100, 32, 60, 32, 48, 32,116,104,101,
-    110, 10,  9, 32,111,117,116,112,117,116, 40, 39, 35,101,110,
-    100,105,102, 92,110, 39, 41, 10,  9,101,110,100, 10,  9,111,
-    117,116,112,117,116, 40, 39, 32,123, 39, 41, 10, 10, 32, 45,
-     45, 32,100,101, 99,108, 97,114,101, 32,115,101,108,102, 44,
-     32,105,102, 32,116,104,101, 32, 99, 97,115,101, 10, 32,108,
-    111, 99, 97,108, 32,110, 97,114,103, 10, 32,105,102, 32, 99,
-    108, 97,115,115, 32,116,104,101,110, 32,110, 97,114,103, 61,
-     50, 32,101,108,115,101, 32,110, 97,114,103, 61, 49, 32,101,
-    110,100, 10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,
-    100, 32,115,101,108,102, 46,110, 97,109,101,126, 61, 39,110,
-    101,119, 39, 32, 97,110,100, 32,115,116, 97,116,105, 99, 61,
-     61,110,105,108, 32,116,104,101,110, 10, 32, 32,111,117,116,
-    112,117,116, 40, 39, 32, 39, 44,115,101,108,102, 46, 99,111,
-    110,115,116, 44,115,101,108,102, 46,112, 97,114,101,110,116,
-     46,116,121,112,101, 44, 39, 42, 39, 44, 39,115,101,108,102,
-     32, 61, 32, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40,
-     39, 40, 39, 44,115,101,108,102, 46, 99,111,110,115,116, 44,
-    115,101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,
-    101, 44, 39, 42, 41, 32, 39, 41, 10, 32, 32,111,117,116,112,
-    117,116, 40, 39,116,111,108,117, 97, 95,116,111,117,115,101,
-    114,116,121,112,101, 40,116,111,108,117, 97, 95, 83, 44, 49,
-     44, 48, 41, 59, 39, 41, 10, 32,101,108,115,101,105,102, 32,
-    115,116, 97,116,105, 99, 32,116,104,101,110, 10, 32, 32, 95,
-     44, 95, 44,115,101,108,102, 46,109,111,100, 32, 61, 32,115,
-    116,114,102,105,110,100, 40,115,101,108,102, 46,109,111,100,
-     44, 39, 94, 37,115, 42,115,116, 97,116,105, 99, 37,115, 37,
-    115, 42, 40, 46, 42, 41, 39, 41, 10, 32,101,110,100, 10, 32,
-     45, 45, 32,100,101, 99,108, 97,114,101, 32,112, 97,114, 97,
-    109,101,116,101,114,115, 10, 32,105,102, 32,115,101,108,102,
-     46, 97,114,103,115, 91, 49, 93, 46,116,121,112,101, 32,126,
-     61, 32, 39,118,111,105,100, 39, 32,116,104,101,110, 10, 32,
-     32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32, 32,119,104,
-    105,108,101, 32,115,101,108,102, 46, 97,114,103,115, 91,105,
-     93, 32,100,111, 10, 32, 32, 32,115,101,108,102, 46, 97,114,
-    103,115, 91,105, 93, 58,100,101, 99,108, 97,114,101, 40,110,
-     97,114,103, 41, 10, 32, 32, 32,105,102, 32,105,115, 98, 97,
-    115,105, 99, 40,115,101,108,102, 46, 97,114,103,115, 91,105,
-     93, 46,116,121,112,101, 41, 32,126, 61, 32, 34,115,116, 97,
-    116,101, 34, 32,116,104,101,110, 10,  9, 32, 32, 32,110, 97,
-    114,103, 32, 61, 32,110, 97,114,103, 43, 49, 10, 32, 32, 32,
-    101,110,100, 10, 32, 32, 32,105, 32, 61, 32,105, 43, 49, 10,
-     32, 32,101,110,100, 10, 32,101,110,100, 10, 10, 32, 45, 45,
-     32, 99,104,101, 99,107, 32,115,101,108,102, 10, 32,105,102,
-     32, 99,108, 97,115,115, 32, 97,110,100, 32,115,101,108,102,
-     46,110, 97,109,101,126, 61, 39,110,101,119, 39, 32, 97,110,
-    100, 32,115,116, 97,116,105, 99, 61, 61,110,105,108, 32,116,
-    104,101,110, 10,  9, 32,111,117,116,112,117,116, 40, 39, 35,
-    105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 82, 69,
-     76, 69, 65, 83, 69, 92,110, 39, 41, 10, 32, 32,111,117,116,
-    112,117,116, 40, 39, 32, 32,105,102, 32, 40, 33,115,101,108,
-    102, 41, 32,116,111,108,117, 97, 95,101,114,114,111,114, 40,
-    116,111,108,117, 97, 95, 83, 44, 34,105,110,118, 97,108,105,
-    100, 32, 92, 39,115,101,108,102, 92, 39, 32,105,110, 32,102,
-    117,110, 99,116,105,111,110, 32, 92, 39, 39, 46, 46,115,101,
-    108,102, 46,110, 97,109,101, 46, 46, 39, 92, 39, 34, 44, 78,
-     85, 76, 76, 41, 59, 39, 41, 59, 10,  9, 32,111,117,116,112,
-    117,116, 40, 39, 35,101,110,100,105,102, 92,110, 39, 41, 10,
-     32,101,110,100, 10, 10, 32, 45, 45, 32,103,101,116, 32, 97,
-    114,114, 97,121, 32,101,108,101,109,101,110,116, 32,118, 97,
-    108,117,101,115, 10, 32,105,102, 32, 99,108, 97,115,115, 32,
-    116,104,101,110, 32,110, 97,114,103, 61, 50, 32,101,108,115,
-    101, 32,110, 97,114,103, 61, 49, 32,101,110,100, 10, 32,105,
-    102, 32,115,101,108,102, 46, 97,114,103,115, 91, 49, 93, 46,
-    116,121,112,101, 32,126, 61, 32, 39,118,111,105,100, 39, 32,
-    116,104,101,110, 10, 32, 32,108,111, 99, 97,108, 32,105, 61,
-     49, 10, 32, 32,119,104,105,108,101, 32,115,101,108,102, 46,
-     97,114,103,115, 91,105, 93, 32,100,111, 10, 32, 32, 32,115,
-    101,108,102, 46, 97,114,103,115, 91,105, 93, 58,103,101,116,
-     97,114,114, 97,121, 40,110, 97,114,103, 41, 10, 32, 32, 32,
-    110, 97,114,103, 32, 61, 32,110, 97,114,103, 43, 49, 10, 32,
-     32, 32,105, 32, 61, 32,105, 43, 49, 10, 32, 32,101,110,100,
-     10, 32,101,110,100, 10, 10, 32,108,111, 99, 97,108, 32,111,
-    117,116, 32, 61, 32,115,116,114,105,110,103, 46,102,105,110,
-    100, 40,115,101,108,102, 46,109,111,100, 44, 32, 34,116,111,
-    108,117, 97, 95,111,117,116,115,105,100,101, 34, 41, 10, 32,
-     45, 45, 32, 99, 97,108,108, 32,102,117,110, 99,116,105,111,
-    110, 10, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,100,
-     32,115,101,108,102, 46,110, 97,109,101, 61, 61, 39,100,101,
-    108,101,116,101, 39, 32,116,104,101,110, 10, 32, 32,111,117,
-    116,112,117,116, 40, 39, 32, 32,100,101,108,101,116,101, 32,
-    115,101,108,102, 59, 39, 41, 10, 32,101,108,115,101,105,102,
-     32, 99,108, 97,115,115, 32, 97,110,100, 32,115,101,108,102,
-     46,110, 97,109,101, 32, 61, 61, 32, 39,111,112,101,114, 97,
-    116,111,114, 38, 91, 93, 39, 32,116,104,101,110, 10, 32, 32,
-    105,102, 32,102,108, 97,103,115, 91, 39, 49, 39, 93, 32,116,
-    104,101,110, 32, 45, 45, 32,102,111,114, 32, 99,111,109,112,
-     97,116,105, 98,105,108,105,116,121, 32,119,105,116,104, 32,
-    116,111,108,117, 97, 53, 32, 63, 10,  9,111,117,116,112,117,
-    116, 40, 39, 32, 32,115,101,108,102, 45, 62,111,112,101,114,
-     97,116,111,114, 91, 93, 40, 39, 44,115,101,108,102, 46, 97,
-    114,103,115, 91, 49, 93, 46,110, 97,109,101, 44, 39, 45, 49,
-     41, 32, 61, 32, 39, 44,115,101,108,102, 46, 97,114,103,115,
-     91, 50, 93, 46,110, 97,109,101, 44, 39, 59, 39, 41, 10, 32,
-     32,101,108,115,101, 10, 32, 32, 32, 32,111,117,116,112,117,
-    116, 40, 39, 32, 32,115,101,108,102, 45, 62,111,112,101,114,
-     97,116,111,114, 91, 93, 40, 39, 44,115,101,108,102, 46, 97,
-    114,103,115, 91, 49, 93, 46,110, 97,109,101, 44, 39, 41, 32,
-     61, 32, 39, 44,115,101,108,102, 46, 97,114,103,115, 91, 50,
-     93, 46,110, 97,109,101, 44, 39, 59, 39, 41, 10, 32, 32,101,
-    110,100, 10, 32,101,108,115,101, 10, 32, 32,111,117,116,112,
-    117,116, 40, 39, 32, 32,123, 39, 41, 10, 32, 32,105,102, 32,
-    115,101,108,102, 46,116,121,112,101, 32,126, 61, 32, 39, 39,
-     32, 97,110,100, 32,115,101,108,102, 46,116,121,112,101, 32,
-    126, 61, 32, 39,118,111,105,100, 39, 32,116,104,101,110, 10,
-     32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 39, 44,
-    115,101,108,102, 46,109,111,100, 44,115,101,108,102, 46,116,
-    121,112,101, 44,115,101,108,102, 46,112,116,114, 44, 39,116,
-    111,108,117, 97, 95,114,101,116, 32, 61, 32, 39, 41, 10, 32,
-     32, 32,111,117,116,112,117,116, 40, 39, 40, 39, 44,115,101,
-    108,102, 46,109,111,100, 44,115,101,108,102, 46,116,121,112,
-    101, 44,115,101,108,102, 46,112,116,114, 44, 39, 41, 32, 39,
-     41, 10, 32, 32,101,108,115,101, 10, 32, 32, 32,111,117,116,
-    112,117,116, 40, 39, 32, 32, 39, 41, 10, 32, 32,101,110,100,
-     10, 32, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,100,
-     32,115,101,108,102, 46,110, 97,109,101, 61, 61, 39,110,101,
-    119, 39, 32,116,104,101,110, 10, 32, 32, 32,111,117,116,112,
-    117,116, 40, 39,110,101,119, 39, 44,115,101,108,102, 46,116,
-    121,112,101, 44, 39, 40, 39, 41, 10, 32, 32,101,108,115,101,
-    105,102, 32, 99,108, 97,115,115, 32, 97,110,100, 32,115,116,
-     97,116,105, 99, 32,116,104,101,110, 10,  9,105,102, 32,111,
-    117,116, 32,116,104,101,110, 10,  9,  9,111,117,116,112,117,
-    116, 40,115,101,108,102, 46,110, 97,109,101, 44, 39, 40, 39,
-     41, 10,  9,101,108,115,101, 10,  9,  9,111,117,116,112,117,
-    116, 40, 99,108, 97,115,115, 46, 46, 39, 58, 58, 39, 46, 46,
-    115,101,108,102, 46,110, 97,109,101, 44, 39, 40, 39, 41, 10,
-      9,101,110,100, 10, 32, 32,101,108,115,101,105,102, 32, 99,
-    108, 97,115,115, 32,116,104,101,110, 10,  9,105,102, 32,111,
-    117,116, 32,116,104,101,110, 10,  9,  9,111,117,116,112,117,
-    116, 40,115,101,108,102, 46,110, 97,109,101, 44, 39, 40, 39,
-     41, 10,  9,101,108,115,101, 10,  9, 32, 32,105,102, 32,115,
-    101,108,102, 46, 99, 97,115,116, 95,111,112,101,114, 97,116,
-    111,114, 32,116,104,101,110, 10,  9, 32, 32,  9,111,117,116,
-    112,117,116, 40, 39,115,116, 97,116,105, 99, 95, 99, 97,115,
-    116, 60, 39, 44,115,101,108,102, 46,109,111,100, 44,115,101,
-    108,102, 46,116,121,112,101, 44,115,101,108,102, 46,112,116,
-    114, 44, 39, 62, 40, 42,115,101,108,102, 39, 41, 10,  9, 32,
-     32,101,108,115,101, 10,  9,  9,111,117,116,112,117,116, 40,
-     39,115,101,108,102, 45, 62, 39, 46, 46,115,101,108,102, 46,
-    110, 97,109,101, 44, 39, 40, 39, 41, 10,  9, 32, 32,101,110,
-    100, 10,  9,101,110,100, 10, 32, 32,101,108,115,101, 10, 32,
-     32, 32,111,117,116,112,117,116, 40,115,101,108,102, 46,110,
-     97,109,101, 44, 39, 40, 39, 41, 10, 32, 32,101,110,100, 10,
-     10, 32, 32,105,102, 32,111,117,116, 32, 97,110,100, 32,110,
-    111,116, 32,115,116, 97,116,105, 99, 32,116,104,101,110, 10,
-     32, 32,  9,111,117,116,112,117,116, 40, 39,115,101,108,102,
-     39, 41, 10,  9,105,102, 32,115,101,108,102, 46, 97,114,103,
-    115, 91, 49, 93, 32, 97,110,100, 32,115,101,108,102, 46, 97,
-    114,103,115, 91, 49, 93, 46,110, 97,109,101, 32,126, 61, 32,
-     39, 39, 32,116,104,101,110, 10,  9,  9,111,117,116,112,117,
-    116, 40, 39, 44, 39, 41, 10,  9,101,110,100, 10, 32, 32,101,
-    110,100, 10, 32, 32, 45, 45, 32,119,114,105,116,101, 32,112,
-     97,114, 97,109,101,116,101,114,115, 10, 32, 32,108,111, 99,
-     97,108, 32,105, 61, 49, 10, 32, 32,119,104,105,108,101, 32,
-    115,101,108,102, 46, 97,114,103,115, 91,105, 93, 32,100,111,
-     10, 32, 32, 32,115,101,108,102, 46, 97,114,103,115, 91,105,
-     93, 58,112, 97,115,115,112, 97,114, 40, 41, 10, 32, 32, 32,
-    105, 32, 61, 32,105, 43, 49, 10, 32, 32, 32,105,102, 32,115,
-    101,108,102, 46, 97,114,103,115, 91,105, 93, 32,116,104,101,
-    110, 10, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 44,
-     39, 41, 10, 32, 32, 32,101,110,100, 10, 32, 32,101,110,100,
-     10, 10, 32, 32,105,102, 32, 99,108, 97,115,115, 32, 97,110,
-    100, 32,115,101,108,102, 46,110, 97,109,101, 32, 61, 61, 32,
-     39,111,112,101,114, 97,116,111,114, 91, 93, 39, 32, 97,110,
-    100, 32,102,108, 97,103,115, 91, 39, 49, 39, 93, 32,116,104,
-    101,110, 10,  9,111,117,116,112,117,116, 40, 39, 45, 49, 41,
-     59, 39, 41, 10, 32, 32,101,108,115,101, 10,  9,111,117,116,
-    112,117,116, 40, 39, 41, 59, 39, 41, 10, 32, 32,101,110,100,
-     10, 10, 32, 32, 45, 45, 32,114,101,116,117,114,110, 32,118,
-     97,108,117,101,115, 10, 32, 32,105,102, 32,115,101,108,102,
-     46,116,121,112,101, 32,126, 61, 32, 39, 39, 32, 97,110,100,
-     32,115,101,108,102, 46,116,121,112,101, 32,126, 61, 32, 39,
-    118,111,105,100, 39, 32,116,104,101,110, 10, 32, 32, 32,110,
-    114,101,116, 32, 61, 32,110,114,101,116, 32, 43, 32, 49, 10,
-     32, 32, 32,108,111, 99, 97,108, 32,116, 44, 99,116, 32, 61,
-     32,105,115, 98, 97,115,105, 99, 40,115,101,108,102, 46,116,
-    121,112,101, 41, 10, 32, 32, 32,105,102, 32,116, 32,116,104,
-    101,110, 10, 32, 32, 32,  9,105,102, 32,115,101,108,102, 46,
-     99, 97,115,116, 95,111,112,101,114, 97,116,111,114, 32, 97,
-    110,100, 32, 95, 98, 97,115,105, 99, 95,114, 97,119, 95,112,
-    117,115,104, 91,116, 93, 32,116,104,101,110, 10,  9,  9,111,
-    117,116,112,117,116, 40, 39, 32, 32, 32, 39, 44, 95, 98, 97,
-    115,105, 99, 95,114, 97,119, 95,112,117,115,104, 91,116, 93,
-     44, 39, 40,116,111,108,117, 97, 95, 83, 44, 40, 39, 44, 99,
-    116, 44, 39, 41,116,111,108,117, 97, 95,114,101,116, 41, 59,
-     39, 41, 10, 32, 32, 32,  9,101,108,115,101, 10,  9, 32, 32,
-     32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,116,111,
-    108,117, 97, 95,112,117,115,104, 39, 46, 46,116, 46, 46, 39,
-     40,116,111,108,117, 97, 95, 83, 44, 40, 39, 44, 99,116, 44,
-     39, 41,116,111,108,117, 97, 95,114,101,116, 41, 59, 39, 41,
-     10,  9,101,110,100, 10, 32, 32, 32,101,108,115,101, 10,  9,
-      9,  9, 32,116, 32, 61, 32,115,101,108,102, 46,116,121,112,
-    101, 10,  9,  9,  9, 32,110,101,119, 95,116, 32, 61, 32,115,
-    116,114,105,110,103, 46,103,115,117, 98, 40,116, 44, 32, 34,
-     99,111,110,115,116, 37,115, 43, 34, 44, 32, 34, 34, 41, 10,
-     32, 32, 32, 32,105,102, 32,115,101,108,102, 46,112,116,114,
-     32, 61, 61, 32, 39, 39, 32,116,104,101,110, 10, 32, 32, 32,
-     32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,123, 39,
-     41, 10, 32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39,
-     35,105,102,100,101,102, 32, 95, 95, 99,112,108,117,115,112,
-    108,117,115, 92,110, 39, 41, 10, 32, 32, 32, 32, 32,111,117,
-    116,112,117,116, 40, 39, 32, 32, 32, 32,118,111,105,100, 42,
-     32,116,111,108,117, 97, 95,111, 98,106, 32, 61, 32,110,101,
-    119, 39, 44,110,101,119, 95,116, 44, 39, 40,116,111,108,117,
-     97, 95,114,101,116, 41, 59, 39, 41, 10, 32, 32, 32, 32, 32,
-    111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,116,111,108,
-    117, 97, 95,112,117,115,104,117,115,101,114,116,121,112,101,
-     95, 97,110,100, 95,116, 97,107,101,111,119,110,101,114,115,
-    104,105,112, 40,116,111,108,117, 97, 95, 83, 44,116,111,108,
-    117, 97, 95,111, 98,106, 44, 34, 39, 44,116, 44, 39, 34, 41,
-     59, 39, 41, 10, 32, 32, 32, 32, 32,111,117,116,112,117,116,
-     40, 39, 35,101,108,115,101, 92,110, 39, 41, 10, 32, 32, 32,
-     32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,118,
-    111,105,100, 42, 32,116,111,108,117, 97, 95,111, 98,106, 32,
-     61, 32,116,111,108,117, 97, 95, 99,111,112,121, 40,116,111,
-    108,117, 97, 95, 83, 44, 40,118,111,105,100, 42, 41, 38,116,
-    111,108,117, 97, 95,114,101,116, 44,115,105,122,101,111,102,
-     40, 39, 44,116, 44, 39, 41, 41, 59, 39, 41, 10, 32, 32, 32,
-     32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,116,
-    111,108,117, 97, 95,112,117,115,104,117,115,101,114,116,121,
-    112,101, 95, 97,110,100, 95,116, 97,107,101,111,119,110,101,
-    114,115,104,105,112, 40,116,111,108,117, 97, 95, 83, 44,116,
-    111,108,117, 97, 95,111, 98,106, 44, 34, 39, 44,116, 44, 39,
-     34, 41, 59, 39, 41, 10, 32, 32, 32, 32, 32,111,117,116,112,
-    117,116, 40, 39, 35,101,110,100,105,102, 92,110, 39, 41, 10,
-     32, 32, 32, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32,
-     32,125, 39, 41, 10, 32, 32, 32, 32,101,108,115,101,105,102,
-     32,115,101,108,102, 46,112,116,114, 32, 61, 61, 32, 39, 38,
-     39, 32,116,104,101,110, 10, 32, 32, 32, 32, 32,111,117,116,
-    112,117,116, 40, 39, 32, 32, 32,116,111,108,117, 97, 95,112,
-    117,115,104,117,115,101,114,116,121,112,101, 40,116,111,108,
-    117, 97, 95, 83, 44, 40,118,111,105,100, 42, 41, 38,116,111,
-    108,117, 97, 95,114,101,116, 44, 34, 39, 44,116, 44, 39, 34,
-     41, 59, 39, 41, 10, 32, 32, 32, 32,101,108,115,101, 10, 32,
-     32, 32, 32,  9,105,102, 32,108,111, 99, 97,108, 95, 99,111,
-    110,115,116,114,117, 99,116,111,114, 32,116,104,101,110, 10,
-      9, 32, 32,111,117,116,112,117,116, 40, 39, 32, 32, 32,116,
-    111,108,117, 97, 95,112,117,115,104,117,115,101,114,116,121,
-    112,101, 95, 97,110,100, 95,116, 97,107,101,111,119,110,101,
-    114,115,104,105,112, 40,116,111,108,117, 97, 95, 83, 44, 40,
-    118,111,105,100, 32, 42, 41,116,111,108,117, 97, 95,114,101,
-    116, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10, 32,
-     32, 32, 32,  9,101,108,115,101, 10,  9,  9, 32, 32, 32, 32,
-     32,111,117,116,112,117,116, 40, 39, 32, 32, 32,116,111,108,
-    117, 97, 95,112,117,115,104,117,115,101,114,116,121,112,101,
-     40,116,111,108,117, 97, 95, 83, 44, 40,118,111,105,100, 42,
-     41,116,111,108,117, 97, 95,114,101,116, 44, 34, 39, 44,116,
-     44, 39, 34, 41, 59, 39, 41, 10,  9, 32, 32, 32, 32,101,110,
-    100, 10, 32, 32, 32, 32,101,110,100, 10, 32, 32, 32,101,110,
-    100, 10, 32, 32,101,110,100, 10, 32, 32,108,111, 99, 97,108,
-     32,105, 61, 49, 10, 32, 32,119,104,105,108,101, 32,115,101,
-    108,102, 46, 97,114,103,115, 91,105, 93, 32,100,111, 10, 32,
-     32, 32,110,114,101,116, 32, 61, 32,110,114,101,116, 32, 43,
-     32,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 58,114,
-    101,116,118, 97,108,117,101, 40, 41, 10, 32, 32, 32,105, 32,
-     61, 32,105, 43, 49, 10, 32, 32,101,110,100, 10, 32, 32,111,
-    117,116,112,117,116, 40, 39, 32, 32,125, 39, 41, 10, 10, 32,
-     32, 45, 45, 32,115,101,116, 32, 97,114,114, 97,121, 32,101,
-    108,101,109,101,110,116, 32,118, 97,108,117,101,115, 10, 32,
-     32,105,102, 32, 99,108, 97,115,115, 32,116,104,101,110, 32,
-    110, 97,114,103, 61, 50, 32,101,108,115,101, 32,110, 97,114,
-    103, 61, 49, 32,101,110,100, 10, 32, 32,105,102, 32,115,101,
-    108,102, 46, 97,114,103,115, 91, 49, 93, 46,116,121,112,101,
-     32,126, 61, 32, 39,118,111,105,100, 39, 32,116,104,101,110,
-     10, 32, 32, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,
-     32, 32,119,104,105,108,101, 32,115,101,108,102, 46, 97,114,
-    103,115, 91,105, 93, 32,100,111, 10, 32, 32, 32, 32,115,101,
-    108,102, 46, 97,114,103,115, 91,105, 93, 58,115,101,116, 97,
-    114,114, 97,121, 40,110, 97,114,103, 41, 10, 32, 32, 32, 32,
-    110, 97,114,103, 32, 61, 32,110, 97,114,103, 43, 49, 10, 32,
-     32, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32, 32, 32,101,
-    110,100, 10, 32, 32,101,110,100, 10, 10, 32, 32, 45, 45, 32,
-    102,114,101,101, 32,100,121,110, 97,109,105, 99, 97,108,108,
-    121, 32, 97,108,108,111, 99, 97,116,101,100, 32, 97,114,114,
-     97,121, 10, 32, 32,105,102, 32,115,101,108,102, 46, 97,114,
-    103,115, 91, 49, 93, 46,116,121,112,101, 32,126, 61, 32, 39,
-    118,111,105,100, 39, 32,116,104,101,110, 10, 32, 32, 32,108,
-    111, 99, 97,108, 32,105, 61, 49, 10, 32, 32, 32,119,104,105,
-    108,101, 32,115,101,108,102, 46, 97,114,103,115, 91,105, 93,
-     32,100,111, 10, 32, 32, 32, 32,115,101,108,102, 46, 97,114,
-    103,115, 91,105, 93, 58,102,114,101,101, 97,114,114, 97,121,
-     40, 41, 10, 32, 32, 32, 32,105, 32, 61, 32,105, 43, 49, 10,
-     32, 32, 32,101,110,100, 10, 32, 32,101,110,100, 10, 32,101,
-    110,100, 10, 10, 32,111,117,116,112,117,116, 40, 39, 32,125,
-     39, 41, 10, 32,111,117,116,112,117,116, 40, 39, 32,114,101,
-    116,117,114,110, 32, 39, 46, 46,110,114,101,116, 46, 46, 39,
-     59, 39, 41, 10, 10, 32, 45, 45, 32, 99, 97,108,108, 32,111,
-    118,101,114,108,111, 97,100,101,100, 32,102,117,110, 99,116,
-    105,111,110, 32,111,114, 32,103,101,110,101,114, 97,116,101,
-     32,101,114,114,111,114, 10,  9,105,102, 32,111,118,101,114,
-    108,111, 97,100, 32, 60, 32, 48, 32,116,104,101,110, 10, 10,
-      9,  9,111,117,116,112,117,116, 40, 39, 35,105,102,110,100,
-    101,102, 32, 84, 79, 76, 85, 65, 95, 82, 69, 76, 69, 65, 83,
-     69, 92,110, 39, 41, 10,  9,  9,111,117,116,112,117,116, 40,
-     39,116,111,108,117, 97, 95,108,101,114,114,111,114, 58, 92,
-    110, 39, 41, 10,  9,  9,111,117,116,112,117,116, 40, 39, 32,
-    116,111,108,117, 97, 95,101,114,114,111,114, 40,116,111,108,
-    117, 97, 95, 83, 44, 34, 35,102,101,114,114,111,114, 32,105,
-    110, 32,102,117,110, 99,116,105,111,110, 32, 92, 39, 39, 46,
-     46,115,101,108,102, 46,108,110, 97,109,101, 46, 46, 39, 92,
-     39, 46, 34, 44, 38,116,111,108,117, 97, 95,101,114,114, 41,
-     59, 39, 41, 10,  9,  9,111,117,116,112,117,116, 40, 39, 32,
-    114,101,116,117,114,110, 32, 48, 59, 39, 41, 10,  9,  9,111,
-    117,116,112,117,116, 40, 39, 35,101,110,100,105,102, 92,110,
-     39, 41, 10,  9,101,108,115,101, 10,  9,  9,108,111, 99, 97,
-    108, 32, 95,108,111, 99, 97,108, 32, 61, 32, 34, 34, 10,  9,
-      9,105,102, 32,108,111, 99, 97,108, 95, 99,111,110,115,116,
-    114,117, 99,116,111,114, 32,116,104,101,110, 10,  9,  9,  9,
-     95,108,111, 99, 97,108, 32, 61, 32, 34, 95,108,111, 99, 97,
-    108, 34, 10,  9,  9,101,110,100, 10,  9,  9,111,117,116,112,
-    117,116, 40, 39,116,111,108,117, 97, 95,108,101,114,114,111,
-    114, 58, 92,110, 39, 41, 10,  9,  9,111,117,116,112,117,116,
-     40, 39, 32,114,101,116,117,114,110, 32, 39, 46, 46,115,116,
-    114,115,117, 98, 40,115,101,108,102, 46, 99,110, 97,109,101,
-     44, 49, 44, 45, 51, 41, 46, 46,102,111,114,109, 97,116, 40,
-     34, 37, 48, 50,100, 34, 44,111,118,101,114,108,111, 97,100,
-     41, 46, 46, 95,108,111, 99, 97,108, 46, 46, 39, 40,116,111,
-    108,117, 97, 95, 83, 41, 59, 39, 41, 10,  9,101,110,100, 10,
-     32,111,117,116,112,117,116, 40, 39,125, 39, 41, 10, 32,111,
-    117,116,112,117,116, 40, 39, 35,101,110,100,105,102, 32, 47,
-     47, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95,
-     68, 73, 83, 65, 66, 76, 69, 92,110, 39, 41, 10, 32,111,117,
-    116,112,117,116, 40, 39, 92,110, 39, 41, 10, 10,  9, 45, 45,
-     32,114,101, 99,117,114,115,105,118,101, 32, 99, 97,108,108,
-     32,116,111, 32,119,114,105,116,101, 32,108,111, 99, 97,108,
-     32, 99,111,110,115,116,114,117, 99,116,111,114, 10,  9,105,
-    102, 32, 99,108, 97,115,115, 32, 97,110,100, 32,115,101,108,
-    102, 46,110, 97,109,101, 61, 61, 39,110,101,119, 39, 32, 97,
-    110,100, 32,110,111,116, 32,108,111, 99, 97,108, 95, 99,111,
-    110,115,116,114,117, 99,116,111,114, 32,116,104,101,110, 10,
-     10,  9,  9,115,101,108,102, 58,115,117,112, 99,111,100,101,
-     40, 49, 41, 10,  9,101,110,100, 10, 10,101,110,100, 10, 10,
-     10, 45, 45, 32,114,101,103,105,115,116,101,114, 32,102,117,
-    110, 99,116,105,111,110, 10,102,117,110, 99,116,105,111,110,
-     32, 99,108, 97,115,115, 70,117,110, 99,116,105,111,110, 58,
-    114,101,103,105,115,116,101,114, 32, 40,112,114,101, 41, 10,
-     10,  9,105,102, 32,110,111,116, 32,115,101,108,102, 58, 99,
-    104,101, 99,107, 95,112,117, 98,108,105, 99, 95, 97, 99, 99,
-    101,115,115, 40, 41, 32,116,104,101,110, 10,  9,  9,114,101,
-    116,117,114,110, 10,  9,101,110,100, 10, 10, 32,  9,105,102,
-     32,115,101,108,102, 46,110, 97,109,101, 32, 61, 61, 32, 39,
-    110,101,119, 39, 32, 97,110,100, 32,115,101,108,102, 46,112,
-     97,114,101,110,116, 46,102,108, 97,103,115, 46,112,117,114,
-    101, 95,118,105,114,116,117, 97,108, 32,116,104,101,110, 10,
-     32,  9,  9, 45, 45, 32,110,111, 32, 99,111,110,115,116,114,
-    117, 99,116,111,114, 32,102,111,114, 32, 99,108, 97,115,115,
-    101,115, 32,119,105,116,104, 32,112,117,114,101, 32,118,105,
-    114,116,117, 97,108, 32,109,101,116,104,111,100,115, 10, 32,
-      9,  9,114,101,116,117,114,110, 10, 32,  9,101,110,100, 10,
-     10, 32,111,117,116,112,117,116, 40,112,114,101, 46, 46, 39,
-    116,111,108,117, 97, 95,102,117,110, 99,116,105,111,110, 40,
-    116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101,108,
-    102, 46,108,110, 97,109,101, 46, 46, 39, 34, 44, 39, 46, 46,
-    115,101,108,102, 46, 99,110, 97,109,101, 46, 46, 39, 41, 59,
-     39, 41, 10, 32, 32,105,102, 32,115,101,108,102, 46,110, 97,
-    109,101, 32, 61, 61, 32, 39,110,101,119, 39, 32,116,104,101,
-    110, 10,  9, 32, 32,111,117,116,112,117,116, 40,112,114,101,
-     46, 46, 39,116,111,108,117, 97, 95,102,117,110, 99,116,105,
-    111,110, 40,116,111,108,117, 97, 95, 83, 44, 34,110,101,119,
-     95,108,111, 99, 97,108, 34, 44, 39, 46, 46,115,101,108,102,
-     46, 99,110, 97,109,101, 46, 46, 39, 95,108,111, 99, 97,108,
-     41, 59, 39, 41, 10,  9, 32, 32,111,117,116,112,117,116, 40,
-    112,114,101, 46, 46, 39,116,111,108,117, 97, 95,102,117,110,
-     99,116,105,111,110, 40,116,111,108,117, 97, 95, 83, 44, 34,
-     46, 99, 97,108,108, 34, 44, 39, 46, 46,115,101,108,102, 46,
-     99,110, 97,109,101, 46, 46, 39, 95,108,111, 99, 97,108, 41,
-     59, 39, 41, 10,  9, 32, 32, 45, 45,111,117,116,112,117,116,
-     40, 39, 32,116,111,108,117, 97, 95,115,101,116, 95, 99, 97,
-    108,108, 95,101,118,101,110,116, 40,116,111,108,117, 97, 95,
-     83, 44, 39, 46, 46,115,101,108,102, 46, 99,110, 97,109,101,
-     46, 46, 39, 95,108,111, 99, 97,108, 44, 32, 34, 39, 46, 46,
-    115,101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,
-    101, 46, 46, 39, 34, 41, 59, 39, 41, 10, 32, 32,101,110,100,
-     10,101,110,100, 10, 10, 45, 45, 32, 80,114,105,110,116, 32,
-    109,101,116,104,111,100, 10,102,117,110, 99,116,105,111,110,
-     32, 99,108, 97,115,115, 70,117,110, 99,116,105,111,110, 58,
-    112,114,105,110,116, 32, 40,105,100,101,110,116, 44, 99,108,
-    111,115,101, 41, 10, 32,112,114,105,110,116, 40,105,100,101,
-    110,116, 46, 46, 34, 70,117,110, 99,116,105,111,110,123, 34,
-     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,
-     46, 34, 32,109,111,100, 32, 32, 61, 32, 39, 34, 46, 46,115,
-    101,108,102, 46,109,111,100, 46, 46, 34, 39, 44, 34, 41, 10,
-     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,
-     32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,
-    102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,
-    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,
-    112,116,114, 32, 32, 61, 32, 39, 34, 46, 46,115,101,108,102,
-     46,112,116,114, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,
-    105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,110, 97,
-    109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,110,
-     97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,
-    110,116, 40,105,100,101,110,116, 46, 46, 34, 32,108,110, 97,
-    109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,108,
-    110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,
-    105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32, 99,111,
-    110,115,116, 32, 61, 32, 39, 34, 46, 46,115,101,108,102, 46,
-     99,111,110,115,116, 46, 46, 34, 39, 44, 34, 41, 10, 32,112,
-    114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32, 99,
-    110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,102,
-     46, 99,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,
-    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,
-    108,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,
-    102, 46,108,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10,
-     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,
-     32, 97,114,103,115, 32, 61, 32,123, 34, 41, 10, 32,108,111,
-     99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108,101, 32,
-    115,101,108,102, 46, 97,114,103,115, 91,105, 93, 32,100,111,
-     10, 32, 32,115,101,108,102, 46, 97,114,103,115, 91,105, 93,
-     58,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,
-     32, 32, 34, 44, 34, 44, 34, 41, 10, 32, 32,105, 32, 61, 32,
-    105, 43, 49, 10, 32,101,110,100, 10, 32,112,114,105,110,116,
-     40,105,100,101,110,116, 46, 46, 34, 32,125, 34, 41, 10, 32,
-    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,125,
-     34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100, 10, 10,
-     45, 45, 32, 99,104,101, 99,107, 32,105,102, 32,105,116, 32,
-    114,101,116,117,114,110,115, 32, 97,110, 32,111, 98,106,101,
-     99,116, 32, 98,121, 32,118, 97,108,117,101, 10,102,117,110,
-     99,116,105,111,110, 32, 99,108, 97,115,115, 70,117,110, 99,
-    116,105,111,110, 58,114,101,113,117,105,114,101, 99,111,108,
-    108,101, 99,116,105,111,110, 32, 40,116, 41, 10,  9,108,111,
-     99, 97,108, 32,114, 32, 61, 32,102, 97,108,115,101, 10,  9,
-    105,102, 32,115,101,108,102, 46,116,121,112,101, 32,126, 61,
-     32, 39, 39, 32, 97,110,100, 32,110,111,116, 32,105,115, 98,
-     97,115,105, 99, 40,115,101,108,102, 46,116,121,112,101, 41,
-     32, 97,110,100, 32,115,101,108,102, 46,112,116,114, 61, 61,
-     39, 39, 32,116,104,101,110, 10,  9,  9,108,111, 99, 97,108,
-     32,116,121,112,101, 32, 61, 32,103,115,117, 98, 40,115,101,
-    108,102, 46,116,121,112,101, 44, 34, 37,115, 42, 99,111,110,
-    115,116, 37,115, 43, 34, 44, 34, 34, 41, 10,  9, 32,116, 91,
-    116,121,112,101, 93, 32, 61, 32, 34,116,111,108,117, 97, 95,
-     99,111,108,108,101, 99,116, 95, 34, 32, 46, 46, 32, 99,108,
-    101, 97,110, 95,116,101,109,112,108, 97,116,101, 40,116,121,
-    112,101, 41, 10,  9, 32,114, 32, 61, 32,116,114,117,101, 10,
-      9,101,110,100, 10,  9,108,111, 99, 97,108, 32,105, 61, 49,
-     10,  9,119,104,105,108,101, 32,115,101,108,102, 46, 97,114,
-    103,115, 91,105, 93, 32,100,111, 10,  9,  9,114, 32, 61, 32,
-    115,101,108,102, 46, 97,114,103,115, 91,105, 93, 58,114,101,
-    113,117,105,114,101, 99,111,108,108,101, 99,116,105,111,110,
-     40,116, 41, 32,111,114, 32,114, 10,  9,  9,105, 32, 61, 32,
-    105, 43, 49, 10,  9,101,110,100, 10,  9,114,101,116,117,114,
-    110, 32,114, 10,101,110,100, 10, 10, 45, 45, 32,100,101,116,
-    101,114,109,105,110,101, 32,108,117, 97, 32,102,117,110, 99,
-    116,105,111,110, 32,110, 97,109,101, 32,111,118,101,114,108,
-    111, 97,100, 10,102,117,110, 99,116,105,111,110, 32, 99,108,
-     97,115,115, 70,117,110, 99,116,105,111,110, 58,111,118,101,
-    114,108,111, 97,100, 32, 40, 41, 10, 32,114,101,116,117,114,
-    110, 32,115,101,108,102, 46,112, 97,114,101,110,116, 58,111,
-    118,101,114,108,111, 97,100, 40,115,101,108,102, 46,108,110,
-     97,109,101, 41, 10,101,110,100, 10, 10, 10,102,117,110, 99,
-    116,105,111,110, 32,112, 97,114, 97,109, 95,111, 98,106,101,
-     99,116, 40,112, 97,114, 41, 32, 45, 45, 32,114,101,116,117,
-    114,110,115, 32,116,114,117,101, 32,105,102, 32,116,104,101,
-     32,112, 97,114, 97,109,101,116,101,114, 32,104, 97,115, 32,
-     97,110, 32,111, 98,106,101, 99,116, 32, 97,115, 32,105,116,
-    115, 32,100,101,102, 97,117,108,116, 32,118, 97,108,117,101,
-     10, 10,  9,105,102, 32,110,111,116, 32,115,116,114,105,110,
-    103, 46,102,105,110,100, 40,112, 97,114, 44, 32, 39, 61, 39,
-     41, 32,116,104,101,110, 32,114,101,116,117,114,110, 32,102,
-     97,108,115,101, 32,101,110,100, 32, 45, 45, 32,105,116, 32,
-    104, 97,115, 32,110,111, 32,100,101,102, 97,117,108,116, 32,
-    118, 97,108,117,101, 10, 10,  9,108,111, 99, 97,108, 32, 95,
-     44, 95, 44,100,101,102, 32, 61, 32,115,116,114,105,110,103,
-     46,102,105,110,100, 40,112, 97,114, 44, 32, 34, 61, 40, 46,
-     42, 41, 36, 34, 41, 10, 10,  9,105,102, 32,115,116,114,105,
-    110,103, 46,102,105,110,100, 40,112, 97,114, 44, 32, 34,124,
-     34, 41, 32,116,104,101,110, 32, 45, 45, 32, 97, 32,108,105,
-    115,116, 32,111,102, 32,102,108, 97,103,115, 10, 10,  9,  9,
-    114,101,116,117,114,110, 32,116,114,117,101, 10,  9,101,110,
-    100, 10, 10,  9,105,102, 32,115,116,114,105,110,103, 46,102,
-    105,110,100, 40,112, 97,114, 44, 32, 34, 37, 42, 34, 41, 32,
-    116,104,101,110, 32, 45, 45, 32,105,116, 39,115, 32, 97, 32,
-    112,111,105,110,116,101,114, 32,119,105,116,104, 32, 97, 32,
-    100,101,102, 97,117,108,116, 32,118, 97,108,117,101, 10, 10,
-      9,  9,105,102, 32,115,116,114,105,110,103, 46,102,105,110,
-    100, 40,112, 97,114, 44, 32, 39, 61, 37,115, 42,110,101,119,
-     39, 41, 32,116,104,101,110, 32, 45, 45, 32,105,116, 39,115,
-     32, 97, 32,112,111,105,110,116,101,114, 32,119,105,116,104,
-     32, 97,110, 32,105,110,115,116, 97,110, 99,101, 32, 97,115,
-     32,100,101,102, 97,117,108,116, 32,112, 97,114, 97,109,101,
-    116,101,114, 46, 46, 32,105,115, 32,116,104, 97,116, 32,118,
-     97,108,105,100, 63, 10,  9,  9,  9,114,101,116,117,114,110,
-     32,116,114,117,101, 10,  9,  9,101,110,100, 10,  9,  9,114,
-    101,116,117,114,110, 32,102, 97,108,115,101, 32, 45, 45, 32,
-    100,101,102, 97,117,108,116, 32,118, 97,108,117,101, 32,105,
-    115, 32, 39, 78, 85, 76, 76, 39, 32,111,114, 32,115,111,109,
-    101,116,104,105,110,103, 10,  9,101,110,100, 10, 10, 10,  9,
-    105,102, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,
-    112, 97,114, 44, 32, 34, 91, 37, 40, 38, 93, 34, 41, 32,116,
-    104,101,110, 10,  9,  9,114,101,116,117,114,110, 32,116,114,
-    117,101, 10,  9,101,110,100, 32, 45, 45, 32,100,101,102, 97,
-    117,108,116, 32,118, 97,108,117,101, 32,105,115, 32, 97, 32,
-     99,111,110,115,116,114,117, 99,116,111,114, 32, 99, 97,108,
-    108, 32, 40,109,111,115,116, 32,108,105,107,101,108,121, 32,
-    102,111,114, 32, 97, 32, 99,111,110,115,116, 32,114,101,102,
-    101,114,101,110, 99,101, 41, 10, 10,  9, 45, 45,105,102, 32,
-    115,116,114,105,110,103, 46,102,105,110,100, 40,112, 97,114,
-     44, 32, 34, 38, 34, 41, 32,116,104,101,110, 10, 10,  9, 45,
-     45,  9,105,102, 32,115,116,114,105,110,103, 46,102,105,110,
-    100, 40,100,101,102, 44, 32, 34, 58, 34, 41, 32,111,114, 32,
-    115,116,114,105,110,103, 46,102,105,110,100, 40,100,101,102,
-     44, 32, 34, 94, 37,115, 42,110,101,119, 37,115, 43, 34, 41,
-     32,116,104,101,110, 10, 10,  9, 45, 45,  9,  9, 45, 45, 32,
-    105,116, 39,115, 32, 97, 32,114,101,102,101,114,101,110, 99,
-    101, 32,119,105,116,104, 32,100,101,102, 97,117,108,116, 32,
-    116,111, 32,115,111,109,101,116,104,105,110,103, 32,108,105,
-    107,101, 32, 67,108, 97,115,115, 58, 58,109,101,109, 98,101,
-    114, 44, 32,111,114, 32, 39,110,101,119, 32, 67,108, 97,115,
-    115, 39, 10,  9, 45, 45,  9,  9,114,101,116,117,114,110, 32,
-    116,114,117,101, 10,  9, 45, 45,  9,101,110,100, 10,  9, 45,
-     45,101,110,100, 10, 10,  9,114,101,116,117,114,110, 32,102,
-     97,108,115,101, 32, 45, 45, 32, 63, 10,101,110,100, 10, 10,
-    102,117,110, 99,116,105,111,110, 32,115,116,114,105,112, 95,
-    108, 97,115,116, 95, 97,114,103, 40, 97,108,108, 95, 97,114,
-    103,115, 44, 32,108, 97,115,116, 95, 97,114,103, 41, 32, 45,
-     45, 32,115,116,114,105,112,115, 32,116,104,101, 32,100,101,
-    102, 97,117,108,116, 32,118, 97,108,117,101, 32,102,114,111,
-    109, 32,116,104,101, 32,108, 97,115,116, 32, 97,114,103,117,
-    109,101,110,116, 10, 10,  9,108,111, 99, 97,108, 32, 95, 44,
-     95, 44,115, 95, 97,114,103, 32, 61, 32,115,116,114,105,110,
-    103, 46,102,105,110,100, 40,108, 97,115,116, 95, 97,114,103,
-     44, 32, 34, 94, 40, 91, 94, 61, 93, 43, 41, 34, 41, 10,  9,
-    108, 97,115,116, 95, 97,114,103, 32, 61, 32,115,116,114,105,
-    110,103, 46,103,115,117, 98, 40,108, 97,115,116, 95, 97,114,
-    103, 44, 32, 34, 40, 91, 37, 37, 37, 40, 37, 41, 93, 41, 34,
-     44, 32, 34, 37, 37, 37, 49, 34, 41, 59, 10,  9, 97,108,108,
-     95, 97,114,103,115, 32, 61, 32,115,116,114,105,110,103, 46,
-    103,115,117, 98, 40, 97,108,108, 95, 97,114,103,115, 44, 32,
-     34, 37,115, 42, 44, 37,115, 42, 34, 46, 46,108, 97,115,116,
-     95, 97,114,103, 46, 46, 34, 37,115, 42, 37, 41, 37,115, 42,
-     36, 34, 44, 32, 34, 41, 34, 41, 10,  9,114,101,116,117,114,
-    110, 32, 97,108,108, 95, 97,114,103,115, 44, 32,115, 95, 97,
-    114,103, 10,101,110,100, 10, 10, 10, 10, 45, 45, 32, 73,110,
-    116,101,114,110, 97,108, 32, 99,111,110,115,116,114,117, 99,
-    116,111,114, 10,102,117,110, 99,116,105,111,110, 32, 95, 70,
-    117,110, 99,116,105,111,110, 32, 40,116, 41, 10, 32,115,101,
-    116,109,101,116, 97,116, 97, 98,108,101, 40,116, 44, 99,108,
-     97,115,115, 70,117,110, 99,116,105,111,110, 41, 10, 10, 32,
-    105,102, 32,116, 46, 99,111,110,115,116, 32,126, 61, 32, 39,
-     99,111,110,115,116, 39, 32, 97,110,100, 32,116, 46, 99,111,
-    110,115,116, 32,126, 61, 32, 39, 39, 32,116,104,101,110, 10,
-     32, 32,101,114,114,111,114, 40, 34, 35,105,110,118, 97,108,
-    105,100, 32, 39, 99,111,110,115,116, 39, 32,115,112,101, 99,
-    105,102,105, 99, 97,116,105,111,110, 34, 41, 10, 32,101,110,
-    100, 10, 10, 32, 97,112,112,101,110,100, 40,116, 41, 10, 32,
-    105,102, 32,116, 58,105,110, 99,108, 97,115,115, 40, 41, 32,
-    116,104,101,110, 10, 32, 45, 45,112,114,105,110,116, 32, 40,
-     39,116, 46,110, 97,109,101, 32,105,115, 32, 39, 46, 46,116,
-     46,110, 97,109,101, 46, 46, 39, 44, 32,112, 97,114,101,110,
-    116, 46,110, 97,109,101, 32,105,115, 32, 39, 46, 46,116, 46,
-    112, 97,114,101,110,116, 46,110, 97,109,101, 41, 10, 32, 32,
-    105,102, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,
-    116, 46,110, 97,109,101, 44, 32, 34, 37, 98, 60, 62, 34, 44,
-     32, 34, 34, 41, 32, 61, 61, 32,115,116,114,105,110,103, 46,
-    103,115,117, 98, 40,116, 46,112, 97,114,101,110,116, 46,111,
-    114,105,103,105,110, 97,108, 95,110, 97,109,101, 32,111,114,
-     32,116, 46,112, 97,114,101,110,116, 46,110, 97,109,101, 44,
-     32, 34, 37, 98, 60, 62, 34, 44, 32, 34, 34, 41, 32,116,104,
-    101,110, 10, 32, 32, 32,116, 46,110, 97,109,101, 32, 61, 32,
-     39,110,101,119, 39, 10, 32, 32, 32,116, 46,108,110, 97,109,
-    101, 32, 61, 32, 39,110,101,119, 39, 10, 32, 32, 32,116, 46,
-    112, 97,114,101,110,116, 46, 95,110,101,119, 32, 61, 32,116,
-    114,117,101, 10, 32, 32, 32,116, 46,116,121,112,101, 32, 61,
-     32,116, 46,112, 97,114,101,110,116, 46,110, 97,109,101, 10,
-     32, 32, 32,116, 46,112,116,114, 32, 61, 32, 39, 42, 39, 10,
-     32, 32,101,108,115,101,105,102, 32,115,116,114,105,110,103,
-     46,103,115,117, 98, 40,116, 46,110, 97,109,101, 44, 32, 34,
-     37, 98, 60, 62, 34, 44, 32, 34, 34, 41, 32, 61, 61, 32, 39,
-    126, 39, 46, 46,115,116,114,105,110,103, 46,103,115,117, 98,
-     40,116, 46,112, 97,114,101,110,116, 46,111,114,105,103,105,
-    110, 97,108, 95,110, 97,109,101, 32,111,114, 32,116, 46,112,
-     97,114,101,110,116, 46,110, 97,109,101, 44, 32, 34, 37, 98,
-     60, 62, 34, 44, 32, 34, 34, 41, 32,116,104,101,110, 10, 32,
-     32, 32,116, 46,110, 97,109,101, 32, 61, 32, 39,100,101,108,
-    101,116,101, 39, 10, 32, 32, 32,116, 46,108,110, 97,109,101,
-     32, 61, 32, 39,100,101,108,101,116,101, 39, 10, 32, 32, 32,
-    116, 46,112, 97,114,101,110,116, 46, 95,100,101,108,101,116,
-    101, 32, 61, 32,116,114,117,101, 10, 32, 32,101,110,100, 10,
-     32,101,110,100, 10, 32,116, 46, 99,110, 97,109,101, 32, 61,
-     32,116, 58, 99,102,117,110, 99,110, 97,109,101, 40, 34,116,
-    111,108,117, 97, 34, 41, 46, 46,116, 58,111,118,101,114,108,
-    111, 97,100, 40,116, 41, 10, 32,114,101,116,117,114,110, 32,
-    116, 10,101,110,100, 10, 10, 45, 45, 32, 67,111,110,115,116,
-    114,117, 99,116,111,114, 10, 45, 45, 32, 69,120,112,101, 99,
-    116,115, 32,116,104,114,101,101, 32,115,116,114,105,110,103,
-    115, 58, 32,111,110,101, 32,114,101,112,114,101,115,101,110,
-    116,105,110,103, 32,116,104,101, 32,102,117,110, 99,116,105,
-    111,110, 32,100,101, 99,108, 97,114, 97,116,105,111,110, 44,
-     10, 45, 45, 32, 97,110,111,116,104,101,114, 32,114,101,112,
-    114,101,115,101,110,116,105,110,103, 32,116,104,101, 32, 97,
-    114,103,117,109,101,110,116, 32,108,105,115,116, 44, 32, 97,
-    110,100, 32,116,104,101, 32,116,104,105,114,100, 32,114,101,
-    112,114,101,115,101,110,116,105,110,103, 10, 45, 45, 32,116,
-    104,101, 32, 34, 99,111,110,115,116, 34, 32,111,114, 32,101,
-    109,112,116,121, 32,115,116,114,105,110,103, 46, 10,102,117,
-    110, 99,116,105,111,110, 32, 70,117,110, 99,116,105,111,110,
-     32, 40,100, 44, 97, 44, 99, 41, 10, 32, 45, 45,108,111, 99,
-     97,108, 32,116, 32, 61, 32,115,112,108,105,116, 40,115,116,
-    114,115,117, 98, 40, 97, 44, 50, 44, 45, 50, 41, 44, 39, 44,
-     39, 41, 32, 45, 45, 32,101,108,105,109,105,110, 97,116,101,
-     32, 98,114, 97, 99,101,115, 10, 32, 45, 45,108,111, 99, 97,
-    108, 32,116, 32, 61, 32,115,112,108,105,116, 95,112, 97,114,
-     97,109,115, 40,115,116,114,115,117, 98, 40, 97, 44, 50, 44,
-     45, 50, 41, 41, 10, 10,  9,105,102, 32,110,111,116, 32,102,
-    108, 97,103,115, 91, 39, 87, 39, 93, 32, 97,110,100, 32,115,
-    116,114,105,110,103, 46,102,105,110,100, 40, 97, 44, 32, 34,
-     37, 46, 37, 46, 37, 46, 37,115, 42, 37, 41, 34, 41, 32,116,
-    104,101,110, 10, 10,  9,  9,119, 97,114,110,105,110,103, 40,
-     34, 70,117,110, 99,116,105,111,110,115, 32,119,105,116,104,
-     32,118, 97,114,105, 97, 98,108,101, 32, 97,114,103,117,109,
-    101,110,116,115, 32, 40, 96, 46, 46, 46, 39, 41, 32, 97,114,
-    101, 32,110,111,116, 32,115,117,112,112,111,114,116,101,100,
-     46, 32, 73,103,110,111,114,105,110,103, 32, 34, 46, 46,100,
-     46, 46, 97, 46, 46, 99, 41, 10,  9,  9,114,101,116,117,114,
-    110, 32,110,105,108, 10,  9,101,110,100, 10, 10, 10, 32,108,
-    111, 99, 97,108, 32,105, 61, 49, 10, 32,108,111, 99, 97,108,
-     32,108, 32, 61, 32,123,110, 61, 48,125, 10, 10, 32,  9, 97,
-     32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,
-     97, 44, 32, 34, 37,115, 42, 40, 91, 37, 40, 37, 41, 93, 41,
-     37,115, 42, 34, 44, 32, 34, 37, 49, 34, 41, 10,  9,108,111,
-     99, 97,108, 32,116, 44,115,116,114,105,112, 44,108, 97,115,
-    116, 32, 61, 32,115,116,114,105,112, 95,112, 97,114,115, 40,
-    115,116,114,115,117, 98, 40, 97, 44, 50, 44, 45, 50, 41, 41,
-     59, 10,  9,105,102, 32,115,116,114,105,112, 32,116,104,101,
-    110, 10,  9,  9, 45, 45,108,111, 99, 97,108, 32,110,115, 32,
-     61, 32,115,116,114,105,110,103, 46,115,117, 98, 40,115,116,
-    114,115,117, 98, 40, 97, 44, 49, 44, 45, 50, 41, 44, 32, 49,
-     44, 32, 45, 40,115,116,114,105,110,103, 46,108,101,110, 40,
-    108, 97,115,116, 41, 43, 49, 41, 41, 10,  9,  9,108,111, 99,
-     97,108, 32,110,115, 32, 61, 32,106,111,105,110, 40,116, 44,
-     32, 34, 44, 34, 44, 32, 49, 44, 32,108, 97,115,116, 45, 49,
-     41, 10, 10,  9,  9,110,115, 32, 61, 32, 34, 40, 34, 46, 46,
-    115,116,114,105,110,103, 46,103,115,117, 98, 40,110,115, 44,
-     32, 34, 37,115, 42, 44, 37,115, 42, 36, 34, 44, 32, 34, 34,
-     41, 46, 46, 39, 41, 39, 10,  9,  9, 45, 45,110,115, 32, 61,
-     32,115,116,114,105,112, 95,100,101,102, 97,117,108,116,115,
-     40,110,115, 41, 10, 10,  9,  9, 70,117,110, 99,116,105,111,
-    110, 40,100, 44, 32,110,115, 44, 32, 99, 41, 10,  9,  9,102,
-    111,114, 32,105, 61, 49, 44,108, 97,115,116, 32,100,111, 10,
-      9,  9,  9,116, 91,105, 93, 32, 61, 32,115,116,114,105,110,
-    103, 46,103,115,117, 98, 40,116, 91,105, 93, 44, 32, 34, 61,
-     46, 42, 36, 34, 44, 32, 34, 34, 41, 10,  9,  9,101,110,100,
-     10,  9,101,110,100, 10, 10, 32,119,104,105,108,101, 32,116,
-     91,105, 93, 32,100,111, 10, 32, 32,108, 46,110, 32, 61, 32,
-    108, 46,110, 43, 49, 10, 32, 32,108, 91,108, 46,110, 93, 32,
-     61, 32, 68,101, 99,108, 97,114, 97,116,105,111,110, 40,116,
-     91,105, 93, 44, 39,118, 97,114, 39, 44,116,114,117,101, 41,
-     10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100,
-     10, 32,108,111, 99, 97,108, 32,102, 32, 61, 32, 68,101, 99,
-    108, 97,114, 97,116,105,111,110, 40,100, 44, 39,102,117,110,
-     99, 39, 41, 10, 32,102, 46, 97,114,103,115, 32, 61, 32,108,
-     10, 32,102, 46, 99,111,110,115,116, 32, 61, 32, 99, 10, 32,
-    114,101,116,117,114,110, 32, 95, 70,117,110, 99,116,105,111,
-    110, 40,102, 41, 10,101,110,100, 10, 10,102,117,110, 99,116,
-    105,111,110, 32,106,111,105,110, 40,116, 44, 32,115,101,112,
-     44, 32,102,105,114,115,116, 44, 32,108, 97,115,116, 41, 10,
-     10,  9,102,105,114,115,116, 32, 61, 32,102,105,114,115,116,
-     32,111,114, 32, 49, 10,  9,108, 97,115,116, 32, 61, 32,108,
-     97,115,116, 32,111,114, 32,116, 97, 98,108,101, 46,103,101,
-    116,110, 40,116, 41, 10,  9,108,111, 99, 97,108, 32,108,115,
-    101,112, 32, 61, 32, 34, 34, 10,  9,108,111, 99, 97,108, 32,
-    114,101,116, 32, 61, 32, 34, 34, 10,  9,108,111, 99, 97,108,
-     32,108,111,111,112, 32, 61, 32,102, 97,108,115,101, 10,  9,
-    102,111,114, 32,105, 32, 61, 32,102,105,114,115,116, 44,108,
-     97,115,116, 32,100,111, 10, 10,  9,  9,114,101,116, 32, 61,
-     32,114,101,116, 46, 46,108,115,101,112, 46, 46,116, 91,105,
-     93, 10,  9,  9,108,115,101,112, 32, 61, 32,115,101,112, 10,
-      9,  9,108,111,111,112, 32, 61, 32,116,114,117,101, 10,  9,
-    101,110,100, 10,  9,105,102, 32,110,111,116, 32,108,111,111,
-    112, 32,116,104,101,110, 10,  9,  9,114,101,116,117,114,110,
-     32, 34, 34, 10,  9,101,110,100, 10, 10,  9,114,101,116,117,
-    114,110, 32,114,101,116, 10,101,110,100, 10, 10,102,117,110,
-     99,116,105,111,110, 32,115,116,114,105,112, 95,112, 97,114,
-    115, 40,115, 41, 10, 10,  9,108,111, 99, 97,108, 32,116, 32,
-     61, 32,115,112,108,105,116, 95, 99, 95,116,111,107,101,110,
-    115, 40,115, 44, 32, 39, 44, 39, 41, 10,  9,108,111, 99, 97,
-    108, 32,115,116,114,105,112, 32, 61, 32,102, 97,108,115,101,
-     10,  9,108,111, 99, 97,108, 32,108, 97,115,116, 10, 10,  9,
-    102,111,114, 32,105, 61,116, 46,110, 44, 49, 44, 45, 49, 32,
-    100,111, 10, 10,  9,  9,105,102, 32,110,111,116, 32,115,116,
-    114,105,112, 32, 97,110,100, 32,112, 97,114, 97,109, 95,111,
-     98,106,101, 99,116, 40,116, 91,105, 93, 41, 32,116,104,101,
-    110, 10,  9,  9,  9,108, 97,115,116, 32, 61, 32,105, 10,  9,
-      9,  9,115,116,114,105,112, 32, 61, 32,116,114,117,101, 10,
-      9,  9,101,110,100, 10,  9,  9, 45, 45,105,102, 32,115,116,
-    114,105,112, 32,116,104,101,110, 10,  9,  9, 45, 45,  9,116,
-     91,105, 93, 32, 61, 32,115,116,114,105,110,103, 46,103,115,
-    117, 98, 40,116, 91,105, 93, 44, 32, 34, 61, 46, 42, 36, 34,
-     44, 32, 34, 34, 41, 10,  9,  9, 45, 45,101,110,100, 10,  9,
-    101,110,100, 10, 10,  9,114,101,116,117,114,110, 32,116, 44,
-    115,116,114,105,112, 44,108, 97,115,116, 10, 10,101,110,100,
-     10, 10,102,117,110, 99,116,105,111,110, 32,115,116,114,105,
-    112, 95,100,101,102, 97,117,108,116,115, 40,115, 41, 10, 10,
-      9,115, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117,
-     98, 40,115, 44, 32, 34, 94, 37, 40, 34, 44, 32, 34, 34, 41,
-     10,  9,115, 32, 61, 32,115,116,114,105,110,103, 46,103,115,
-    117, 98, 40,115, 44, 32, 34, 37, 41, 36, 34, 44, 32, 34, 34,
-     41, 10, 10,  9,108,111, 99, 97,108, 32,116, 32, 61, 32,115,
-    112,108,105,116, 95, 99, 95,116,111,107,101,110,115, 40,115,
-     44, 32, 34, 44, 34, 41, 10,  9,108,111, 99, 97,108, 32,115,
-    101,112, 44, 32,114,101,116, 32, 61, 32, 34, 34, 44, 34, 34,
-     10,  9,102,111,114, 32,105, 61, 49, 44,116, 46,110, 32,100,
-    111, 10,  9,  9,116, 91,105, 93, 32, 61, 32,115,116,114,105,
-    110,103, 46,103,115,117, 98, 40,116, 91,105, 93, 44, 32, 34,
-     61, 46, 42, 36, 34, 44, 32, 34, 34, 41, 10,  9,  9,114,101,
-    116, 32, 61, 32,114,101,116, 46, 46,115,101,112, 46, 46,116,
-     91,105, 93, 10,  9,  9,115,101,112, 32, 61, 32, 34, 44, 34,
-     10,  9,101,110,100, 10, 10,  9,114,101,116,117,114,110, 32,
-     34, 40, 34, 46, 46,114,101,116, 46, 46, 34, 41, 34, 10,101,
-    110,100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/function.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    45, 45, 32,116,111,108,117, 97, 58, 32,111,112,101,114, 97,
-    116,111,114, 32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,
-    105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109,
-     97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67,
-     71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45,
-     32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,
-    100, 58, 32, 36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,
-    111,100,101, 32,105,115, 32,102,114,101,101, 32,115,111,102,
-    116,119, 97,114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,
-    114,101,100,105,115,116,114,105, 98,117,116,101, 32,105,116,
-     32, 97,110,100, 47,111,114, 32,109,111,100,105,102,121, 32,
-    105,116, 46, 10, 45, 45, 32, 84,104,101, 32,115,111,102,116,
-    119, 97,114,101, 32,112,114,111,118,105,100,101,100, 32,104,
-    101,114,101,117,110,100,101,114, 32,105,115, 32,111,110, 32,
-     97,110, 32, 34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,
-    115, 44, 32, 97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,
-    117,116,104,111,114, 32,104, 97,115, 32,110,111, 32,111, 98,
-    108,105,103, 97,116,105,111,110, 32,116,111, 32,112,114,111,
-    118,105,100,101, 32,109, 97,105,110,116,101,110, 97,110, 99,
-    101, 44, 32,115,117,112,112,111,114,116, 44, 32,117,112,100,
-     97,116,101,115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,
-    101,109,101,110,116,115, 44, 32,111,114, 32,109,111,100,105,
-    102,105, 99, 97,116,105,111,110,115, 46, 10, 10, 10, 45, 45,
-     32, 79,112,101,114, 97,116,111,114, 32, 99,108, 97,115,115,
-     10, 45, 45, 32, 82,101,112,114,101,115,101,110,116,115, 32,
-     97,110, 32,111,112,101,114, 97,116,111,114, 32,102,117,110,
-     99,116,105,111,110, 32,111,114, 32, 97, 32, 99,108, 97,115,
-    115, 32,111,112,101,114, 97,116,111,114, 32,109,101,116,104,
-    111,100, 46, 10, 45, 45, 32, 73,116, 32,115,116,111,114,101,
-    115, 32,116,104,101, 32,115, 97,109,101, 32,102,105,101,108,
-    100,115, 32, 97,115, 32,102,117,110, 99,116,105,111,110,115,
-     32,100,111, 32,112,108,117,115, 58, 10, 45, 45, 32, 32,107,
-    105,110,100, 32, 61, 32,115,101,116, 32,111,102, 32, 99,104,
-     97,114, 97, 99,116,101,114, 32,114,101,112,114,101,115,101,
-    110,116,105,110,103, 32,116,104,101, 32,111,112,101,114, 97,
-    116,111,114, 32, 40, 97,115, 32,105,116, 32, 97,112,112,101,
-    114,115, 32,105,110, 32, 67, 43, 43, 32, 99,111,100,101, 41,
-     10, 99,108, 97,115,115, 79,112,101,114, 97,116,111,114, 32,
-     61, 32,123, 10, 32,107,105,110,100, 32, 61, 32, 39, 39, 44,
-     10,125, 10, 99,108, 97,115,115, 79,112,101,114, 97,116,111,
-    114, 46, 95, 95,105,110,100,101,120, 32, 61, 32, 99,108, 97,
-    115,115, 79,112,101,114, 97,116,111,114, 10,115,101,116,109,
-    101,116, 97,116, 97, 98,108,101, 40, 99,108, 97,115,115, 79,
-    112,101,114, 97,116,111,114, 44, 99,108, 97,115,115, 70,117,
-    110, 99,116,105,111,110, 41, 10, 10, 45, 45, 32,116, 97, 98,
-    108,101, 32,116,111, 32,116,114, 97,110,115,102,111,114,109,
-     32,111,112,101,114, 97,116,111,114, 32,107,105,110,100, 32,
-    105,110,116,111, 32,116,104,101, 32, 97,112,112,114,111,112,
-    114,105, 97,116,101, 32,116, 97,103, 32,109,101,116,104,111,
-    100, 32,110, 97,109,101, 10, 95, 84, 77, 32, 61, 32,123, 91,
-     39, 43, 39, 93, 32, 61, 32, 39, 97,100,100, 39, 44, 10, 32,
-     32, 32, 32, 32, 32, 32, 91, 39, 45, 39, 93, 32, 61, 32, 39,
-    115,117, 98, 39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 91, 39,
-     42, 39, 93, 32, 61, 32, 39,109,117,108, 39, 44, 10, 32, 32,
-     32, 32, 32, 32, 32, 91, 39, 47, 39, 93, 32, 61, 32, 39,100,
-    105,118, 39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 91, 39, 60,
-     39, 93, 32, 61, 32, 39,108,116, 39, 44, 10, 32, 32, 32, 32,
-     32, 32, 32, 91, 39, 60, 61, 39, 93, 32, 61, 32, 39,108,101,
-     39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 91, 39, 61, 61, 39,
-     93, 32, 61, 32, 39,101,113, 39, 44, 10, 32, 32, 32, 32, 32,
-     32, 32, 91, 39, 91, 93, 39, 93, 32, 61, 32, 39,103,101,116,
-    105, 39, 44, 10, 32, 32, 32, 32, 32, 32, 32, 91, 39, 38, 91,
-     93, 39, 93, 32, 61, 32, 39,115,101,116,105, 39, 44, 10, 32,
-     32, 32, 32, 32, 32, 32, 45, 45, 91, 39, 45, 62, 39, 93, 32,
-     61, 32, 39,102,108,101, 99,104,105,116, 97, 39, 44, 10, 32,
-     32, 32, 32, 32, 32,125, 10, 10, 10, 45, 45, 32, 80,114,105,
-    110,116, 32,109,101,116,104,111,100, 10,102,117,110, 99,116,
-    105,111,110, 32, 99,108, 97,115,115, 79,112,101,114, 97,116,
-    111,114, 58,112,114,105,110,116, 32, 40,105,100,101,110,116,
-     44, 99,108,111,115,101, 41, 10, 32,112,114,105,110,116, 40,
-    105,100,101,110,116, 46, 46, 34, 79,112,101,114, 97,116,111,
-    114,123, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,
-    110,116, 46, 46, 34, 32,107,105,110,100, 32, 32, 61, 32, 39,
-     34, 46, 46,115,101,108,102, 46,107,105,110,100, 46, 46, 34,
-     39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,
-    110,116, 46, 46, 34, 32,109,111,100, 32, 32, 61, 32, 39, 34,
-     46, 46,115,101,108,102, 46,109,111,100, 46, 46, 34, 39, 44,
-     34, 41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116,
-     46, 46, 34, 32,116,121,112,101, 32, 61, 32, 39, 34, 46, 46,
-    115,101,108,102, 46,116,121,112,101, 46, 46, 34, 39, 44, 34,
-     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,
-     46, 34, 32,112,116,114, 32, 32, 61, 32, 39, 34, 46, 46,115,
-    101,108,102, 46,112,116,114, 46, 46, 34, 39, 44, 34, 41, 10,
-     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,
-     32,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,108,
-    102, 46,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41, 10, 32,
-    112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34, 32,
-     99,111,110,115,116, 32, 61, 32, 39, 34, 46, 46,115,101,108,
-    102, 46, 99,111,110,115,116, 46, 46, 34, 39, 44, 34, 41, 10,
-     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,
-     32, 99,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,101,
-    108,102, 46, 99,110, 97,109,101, 46, 46, 34, 39, 44, 34, 41,
-     10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46,
-     34, 32,108,110, 97,109,101, 32, 61, 32, 39, 34, 46, 46,115,
-    101,108,102, 46,108,110, 97,109,101, 46, 46, 34, 39, 44, 34,
-     41, 10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46,
-     46, 34, 32, 97,114,103,115, 32, 61, 32,123, 34, 41, 10, 32,
-    108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108,
-    101, 32,115,101,108,102, 46, 97,114,103,115, 91,105, 93, 32,
-    100,111, 10, 32, 32,115,101,108,102, 46, 97,114,103,115, 91,
-    105, 93, 58,112,114,105,110,116, 40,105,100,101,110,116, 46,
-     46, 34, 32, 32, 34, 44, 34, 44, 34, 41, 10, 32, 32,105, 32,
-     61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,112,114,105,
-    110,116, 40,105,100,101,110,116, 46, 46, 34, 32,125, 34, 41,
-     10, 32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46,
-     34,125, 34, 46, 46, 99,108,111,115,101, 41, 10,101,110,100,
-     10, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,115,
-    115, 79,112,101,114, 97,116,111,114, 58,115,117,112, 99,111,
-    100,101, 95,116,109,112, 40, 41, 10, 10,  9,105,102, 32,110,
-    111,116, 32, 95, 84, 77, 91,115,101,108,102, 46,107,105,110,
-    100, 93, 32,116,104,101,110, 10,  9,  9,114,101,116,117,114,
-    110, 32, 99,108, 97,115,115, 70,117,110, 99,116,105,111,110,
-     46,115,117,112, 99,111,100,101, 40,115,101,108,102, 41, 10,
-      9,101,110,100, 10, 10,  9, 45, 45, 32,110,111, 32,111,118,
-    101,114,108,111, 97,100, 44, 32,110,111, 32,112, 97,114, 97,
-    109,101,116,101,114,115, 44, 32, 97,108,119, 97,121,115, 32,
-    105,110, 99,108, 97,115,115, 10,  9,111,117,116,112,117,116,
-     40, 34, 47, 42, 32,109,101,116,104,111,100, 58, 34, 44,115,
-    101,108,102, 46,110, 97,109,101, 44, 34, 32,111,102, 32, 99,
-    108, 97,115,115, 32, 34, 44,115,101,108,102, 58,105,110, 99,
-    108, 97,115,115, 40, 41, 44, 34, 32, 42, 47, 34, 41, 10, 10,
-      9,111,117,116,112,117,116, 40, 34, 35,105,102,110,100,101,
-    102, 32, 84, 79, 76, 85, 65, 95, 68, 73, 83, 65, 66, 76, 69,
-     95, 34, 46, 46,115,101,108,102, 46, 99,110, 97,109,101, 41,
-     10,  9,111,117,116,112,117,116, 40, 34, 92,110,115,116, 97,
-    116,105, 99, 32,105,110,116, 34, 44,115,101,108,102, 46, 99,
-    110, 97,109,101, 44, 34, 40,108,117, 97, 95, 83,116, 97,116,
-    101, 42, 32,116,111,108,117, 97, 95, 83, 41, 34, 41, 10, 10,
-      9,105,102, 32,111,118,101,114,108,111, 97,100, 32, 60, 32,
-     48, 32,116,104,101,110, 10,  9, 32,111,117,116,112,117,116,
-     40, 39, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65,
-     95, 82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,  9,101,
-    110,100, 10,  9,111,117,116,112,117,116, 40, 39, 32,116,111,
-    108,117, 97, 95, 69,114,114,111,114, 32,116,111,108,117, 97,
-     95,101,114,114, 59, 39, 41, 10,  9,111,117,116,112,117,116,
-     40, 39, 32,105,102, 32, 40, 92,110, 39, 41, 10,  9, 45, 45,
-     32, 99,104,101, 99,107, 32,115,101,108,102, 10,  9,111,117,
-    116,112,117,116, 40, 39, 32, 32, 32, 32, 32, 33, 39, 46, 46,
-     39,116,111,108,117, 97, 95,105,115,117,115,101,114,116,121,
-    112,101, 40,116,111,108,117, 97, 95, 83, 44, 49, 44, 34, 39,
-     46, 46,115,101,108,102, 46,112, 97,114,101,110,116, 46,116,
-    121,112,101, 46, 46, 39, 34, 44, 48, 44, 38,116,111,108,117,
-     97, 95,101,114,114, 41, 32,124,124, 92,110, 39, 41, 10,  9,
-    111,117,116,112,117,116, 40, 39, 32, 32, 32, 32, 32, 33,116,
-    111,108,117, 97, 95,105,115,110,111,111, 98,106, 40,116,111,
-    108,117, 97, 95, 83, 44, 50, 44, 38,116,111,108,117, 97, 95,
-    101,114,114, 41, 92,110, 32, 41, 39, 41, 10,  9,111,117,116,
-    112,117,116, 40, 39, 32, 32,103,111,116,111, 32,116,111,108,
-    117, 97, 95,108,101,114,114,111,114, 59, 39, 41, 10, 10,  9,
-    111,117,116,112,117,116, 40, 39, 32,101,108,115,101, 92,110,
-     39, 41, 10,  9,111,117,116,112,117,116, 40, 39, 35,101,110,
-    100,105,102, 92,110, 39, 41, 32, 45, 45, 32,116,111,108,117,
-     97, 95,114,101,108,101, 97,115,101, 10,  9,111,117,116,112,
-    117,116, 40, 39, 32,123, 39, 41, 10, 10,  9, 45, 45, 32,100,
-    101, 99,108, 97,114,101, 32,115,101,108,102, 10,  9,111,117,
-    116,112,117,116, 40, 39, 32, 39, 44,115,101,108,102, 46, 99,
-    111,110,115,116, 44,115,101,108,102, 46,112, 97,114,101,110,
-    116, 46,116,121,112,101, 44, 39, 42, 39, 44, 39,115,101,108,
-    102, 32, 61, 32, 39, 41, 10,  9,111,117,116,112,117,116, 40,
-     39, 40, 39, 44,115,101,108,102, 46, 99,111,110,115,116, 44,
-    115,101,108,102, 46,112, 97,114,101,110,116, 46,116,121,112,
-    101, 44, 39, 42, 41, 32, 39, 41, 10,  9,111,117,116,112,117,
-    116, 40, 39,116,111,108,117, 97, 95,116,111,117,115,101,114,
-    116,121,112,101, 40,116,111,108,117, 97, 95, 83, 44, 49, 44,
-     48, 41, 59, 39, 41, 10, 10,  9, 45, 45, 32, 99,104,101, 99,
-    107, 32,115,101,108,102, 10,  9,111,117,116,112,117,116, 40,
-     39, 35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95,
-     82, 69, 76, 69, 65, 83, 69, 92,110, 39, 41, 10,  9,111,117,
-    116,112,117,116, 40, 39, 32, 32,105,102, 32, 40, 33,115,101,
-    108,102, 41, 32,116,111,108,117, 97, 95,101,114,114,111,114,
-     40,116,111,108,117, 97, 95, 83, 44, 34,105,110,118, 97,108,
-    105,100, 32, 92, 39,115,101,108,102, 92, 39, 32,105,110, 32,
-    102,117,110, 99,116,105,111,110, 32, 92, 39, 39, 46, 46,115,
-    101,108,102, 46,110, 97,109,101, 46, 46, 39, 92, 39, 34, 44,
-     78, 85, 76, 76, 41, 59, 39, 41, 59, 10,  9,111,117,116,112,
-    117,116, 40, 39, 35,101,110,100,105,102, 92,110, 39, 41, 10,
-     10,  9, 45, 45, 32, 99, 97,115,116, 32,115,101,108,102, 10,
-      9,111,117,116,112,117,116, 40, 39, 32, 32, 39, 44,115,101,
-    108,102, 46,109,111,100, 44,115,101,108,102, 46,116,121,112,
-    101, 44,115,101,108,102, 46,112,116,114, 44, 39,116,111,108,
-    117, 97, 95,114,101,116, 32, 61, 32, 39, 41, 10,  9,111,117,
-    116,112,117,116, 40, 39, 40, 39, 44,115,101,108,102, 46,109,
-    111,100, 44,115,101,108,102, 46,116,121,112,101, 44,115,101,
-    108,102, 46,112,116,114, 44, 39, 41, 40, 42,115,101,108,102,
-     41, 59, 39, 41, 10, 10,  9, 45, 45, 32,114,101,116,117,114,
-    110, 32,118, 97,108,117,101, 10,  9,108,111, 99, 97,108, 32,
-    116, 44, 99,116, 32, 61, 32,105,115, 98, 97,115,105, 99, 40,
-    115,101,108,102, 46,116,121,112,101, 41, 10,  9,105,102, 32,
-    116, 32,116,104,101,110, 10,  9,  9,111,117,116,112,117,116,
-     40, 39, 32, 32, 32,116,111,108,117, 97, 95,112,117,115,104,
-     39, 46, 46,116, 46, 46, 39, 40,116,111,108,117, 97, 95, 83,
-     44, 40, 39, 44, 99,116, 44, 39, 41,116,111,108,117, 97, 95,
-    114,101,116, 41, 59, 39, 41, 10,  9,101,108,115,101, 10,  9,
-      9,116, 32, 61, 32,115,101,108,102, 46,116,121,112,101, 10,
-      9,  9,110,101,119, 95,116, 32, 61, 32,115,116,114,105,110,
-    103, 46,103,115,117, 98, 40,116, 44, 32, 34, 99,111,110,115,
-    116, 37,115, 43, 34, 44, 32, 34, 34, 41, 10,  9,  9,105,102,
-     32,115,101,108,102, 46,112,116,114, 32, 61, 61, 32, 39, 39,
-     32,116,104,101,110, 10,  9,  9,  9,111,117,116,112,117,116,
-     40, 39, 32, 32, 32,123, 39, 41, 10,  9,  9,  9,111,117,116,
-    112,117,116, 40, 39, 35,105,102,100,101,102, 32, 95, 95, 99,
-    112,108,117,115,112,108,117,115, 92,110, 39, 41, 10,  9,  9,
-      9,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,118,111,
-    105,100, 42, 32,116,111,108,117, 97, 95,111, 98,106, 32, 61,
-     32,110,101,119, 39, 44,110,101,119, 95,116, 44, 39, 40,116,
-    111,108,117, 97, 95,114,101,116, 41, 59, 39, 41, 10,  9,  9,
-      9,111,117,116,112,117,116, 40, 39, 32, 32, 32, 32,116,111,
-    108,117, 97, 95,112,117,115,104,117,115,101,114,116,121,112,
-    101, 95, 97,110,100, 95,116, 97,107,101,111,119,110,101,114,
-    115,104,105,112, 40,116,111,108,117, 97, 95, 83, 44,116,111,
-    108,117, 97, 95,111, 98,106, 44, 34, 39, 44,116, 44, 39, 34,
-     41, 59, 39, 41, 10,  9,  9,  9,111,117,116,112,117,116, 40,
-     39, 35,101,108,115,101, 92,110, 39, 41, 10,  9,  9,  9,111,
-    117,116,112,117,116, 40, 39, 32, 32, 32, 32,118,111,105,100,
-     42, 32,116,111,108,117, 97, 95,111, 98,106, 32, 61, 32,116,
-    111,108,117, 97, 95, 99,111,112,121, 40,116,111,108,117, 97,
-     95, 83, 44, 40,118,111,105,100, 42, 41, 38,116,111,108,117,
-     97, 95,114,101,116, 44,115,105,122,101,111,102, 40, 39, 44,
-    116, 44, 39, 41, 41, 59, 39, 41, 10,  9,  9,  9,111,117,116,
-    112,117,116, 40, 39, 32, 32, 32, 32,116,111,108,117, 97, 95,
-    112,117,115,104,117,115,101,114,116,121,112,101, 95, 97,110,
-    100, 95,116, 97,107,101,111,119,110,101,114,115,104,105,112,
-     40,116,111,108,117, 97, 95, 83, 44,116,111,108,117, 97, 95,
-    111, 98,106, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41,
-     10,  9,  9,  9,111,117,116,112,117,116, 40, 39, 35,101,110,
-    100,105,102, 92,110, 39, 41, 10,  9,  9,  9,111,117,116,112,
-    117,116, 40, 39, 32, 32, 32,125, 39, 41, 10,  9,  9,101,108,
-    115,101,105,102, 32,115,101,108,102, 46,112,116,114, 32, 61,
-     61, 32, 39, 38, 39, 32,116,104,101,110, 10,  9,  9,  9,111,
-    117,116,112,117,116, 40, 39, 32, 32, 32,116,111,108,117, 97,
-     95,112,117,115,104,117,115,101,114,116,121,112,101, 40,116,
-    111,108,117, 97, 95, 83, 44, 40,118,111,105,100, 42, 41, 38,
-    116,111,108,117, 97, 95,114,101,116, 44, 34, 39, 44,116, 44,
-     39, 34, 41, 59, 39, 41, 10,  9,  9,101,108,115,101, 10,  9,
-      9,  9,105,102, 32,108,111, 99, 97,108, 95, 99,111,110,115,
-    116,114,117, 99,116,111,114, 32,116,104,101,110, 10,  9,  9,
-      9,  9,111,117,116,112,117,116, 40, 39, 32, 32, 32,116,111,
-    108,117, 97, 95,112,117,115,104,117,115,101,114,116,121,112,
-    101, 95, 97,110,100, 95,116, 97,107,101,111,119,110,101,114,
-    115,104,105,112, 40,116,111,108,117, 97, 95, 83, 44, 40,118,
-    111,105,100, 32, 42, 41,116,111,108,117, 97, 95,114,101,116,
-     44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39, 41, 10,  9,  9,
-      9,101,108,115,101, 10,  9,  9,  9,  9,111,117,116,112,117,
-    116, 40, 39, 32, 32, 32,116,111,108,117, 97, 95,112,117,115,
-    104,117,115,101,114,116,121,112,101, 40,116,111,108,117, 97,
-     95, 83, 44, 40,118,111,105,100, 42, 41,116,111,108,117, 97,
-     95,114,101,116, 44, 34, 39, 44,116, 44, 39, 34, 41, 59, 39,
-     41, 10,  9,  9,  9,101,110,100, 10,  9,  9,101,110,100, 10,
-      9,101,110,100, 10, 10,  9,111,117,116,112,117,116, 40, 39,
-     32, 32,125, 39, 41, 10,  9,111,117,116,112,117,116, 40, 39,
-     32,114,101,116,117,114,110, 32, 49, 59, 39, 41, 10, 10,  9,
-    111,117,116,112,117,116, 40, 39, 35,105,102,110,100,101,102,
-     32, 84, 79, 76, 85, 65, 95, 82, 69, 76, 69, 65, 83, 69, 92,
-    110, 39, 41, 10,  9,111,117,116,112,117,116, 40, 39,116,111,
-    108,117, 97, 95,108,101,114,114,111,114, 58, 92,110, 39, 41,
-     10,  9,111,117,116,112,117,116, 40, 39, 32,116,111,108,117,
-     97, 95,101,114,114,111,114, 40,116,111,108,117, 97, 95, 83,
-     44, 34, 35,102,101,114,114,111,114, 32,105,110, 32,102,117,
-    110, 99,116,105,111,110, 32, 92, 39, 39, 46, 46,115,101,108,
-    102, 46,108,110, 97,109,101, 46, 46, 39, 92, 39, 46, 34, 44,
-     38,116,111,108,117, 97, 95,101,114,114, 41, 59, 39, 41, 10,
-      9,111,117,116,112,117,116, 40, 39, 32,114,101,116,117,114,
-    110, 32, 48, 59, 39, 41, 10,  9,111,117,116,112,117,116, 40,
-     39, 35,101,110,100,105,102, 92,110, 39, 41, 10, 10, 10,  9,
-    111,117,116,112,117,116, 40, 39,125, 39, 41, 10,  9,111,117,
-    116,112,117,116, 40, 39, 35,101,110,100,105,102, 32, 47, 47,
-     35,105,102,110,100,101,102, 32, 84, 79, 76, 85, 65, 95, 68,
-     73, 83, 65, 66, 76, 69, 92,110, 39, 41, 10,  9,111,117,116,
-    112,117,116, 40, 39, 92,110, 39, 41, 10,101,110,100, 10, 10,
-     45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99,111,110,
-    115,116,114,117, 99,116,111,114, 10,102,117,110, 99,116,105,
-    111,110, 32, 95, 79,112,101,114, 97,116,111,114, 32, 40,116,
-     41, 10, 32,115,101,116,109,101,116, 97,116, 97, 98,108,101,
-     40,116, 44, 99,108, 97,115,115, 79,112,101,114, 97,116,111,
-    114, 41, 10, 10, 32,105,102, 32,116, 46, 99,111,110,115,116,
-     32,126, 61, 32, 39, 99,111,110,115,116, 39, 32, 97,110,100,
-     32,116, 46, 99,111,110,115,116, 32,126, 61, 32, 39, 39, 32,
-    116,104,101,110, 10, 32, 32,101,114,114,111,114, 40, 34, 35,
-    105,110,118, 97,108,105,100, 32, 39, 99,111,110,115,116, 39,
-     32,115,112,101, 99,105,102,105, 99, 97,116,105,111,110, 34,
-     41, 10, 32,101,110,100, 10, 10, 32, 97,112,112,101,110,100,
-     40,116, 41, 10, 32,105,102, 32,110,111,116, 32,116, 58,105,
-    110, 99,108, 97,115,115, 40, 41, 32,116,104,101,110, 10, 32,
-     32,101,114,114,111,114, 40, 34, 35,111,112,101,114, 97,116,
-    111,114, 32, 99, 97,110, 32,111,110,108,121, 32, 98,101, 32,
-    100,101,102,105,110,101,100, 32, 97,115, 32, 99,108, 97,115,
-    115, 32,109,101,109, 98,101,114, 34, 41, 10, 32,101,110,100,
-     10, 10, 32, 45, 45,116, 46,110, 97,109,101, 32, 61, 32,116,
-     46,110, 97,109,101, 32, 46, 46, 32, 34, 95, 34, 32, 46, 46,
-     32, 40, 95, 84, 77, 91,116, 46,107,105,110,100, 93, 32,111,
-    114, 32,116, 46,107,105,110,100, 41, 10, 32,116, 46, 99,110,
-     97,109,101, 32, 61, 32,116, 58, 99,102,117,110, 99,110, 97,
-    109,101, 40, 34,116,111,108,117, 97, 34, 41, 46, 46,116, 58,
-    111,118,101,114,108,111, 97,100, 40,116, 41, 10, 32,116, 46,
-    110, 97,109,101, 32, 61, 32, 34,111,112,101,114, 97,116,111,
-    114, 34, 32, 46, 46, 32,116, 46,107,105,110,100, 32, 32, 45,
-     45, 32,115,101,116, 32, 97,112,112,114,111,112,114,105, 97,
-    116,101, 32, 99, 97,108,108,105,110,103, 32,110, 97,109,101,
-     10, 32,114,101,116,117,114,110, 32,116, 10,101,110,100, 10,
-     10, 45, 45, 32, 67,111,110,115,116,114,117, 99,116,111,114,
-     10,102,117,110, 99,116,105,111,110, 32, 79,112,101,114, 97,
-    116,111,114, 32, 40,100, 44,107, 44, 97, 44, 99, 41, 10, 10,
-      9,108,111, 99, 97,108, 32,111,112, 95,107, 32, 61, 32,115,
-    116,114,105,110,103, 46,103,115,117, 98, 40,107, 44, 32, 34,
-     94, 37,115, 42, 34, 44, 32, 34, 34, 41, 10,  9,111,112, 95,
-    107, 32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98,
-     40,107, 44, 32, 34, 37,115, 42, 36, 34, 44, 32, 34, 34, 41,
-     10,  9, 45, 45,105,102, 32,115,116,114,105,110,103, 46,102,
-    105,110,100, 40,107, 44, 32, 34, 94, 91, 37,119, 95, 58, 37,
-    100, 60, 62, 37, 42, 37, 38, 93, 43, 36, 34, 41, 32,116,104,
-    101,110, 10,  9,105,102, 32,100, 32, 61, 61, 32, 34,111,112,
-    101,114, 97,116,111,114, 34, 32, 97,110,100, 32,107, 32,126,
-     61, 32, 39, 39, 32,116,104,101,110, 10, 10,  9,  9,100, 32,
-     61, 32,107, 46, 46, 34, 32,111,112,101,114, 97,116,111,114,
-     34, 10,  9,101,108,115,101,105,102, 32,110,111,116, 32, 95,
-     84, 77, 91,111,112, 95,107, 93, 32,116,104,101,110, 10, 10,
-      9,  9,105,102, 32,102,108, 97,103,115, 91, 39, 87, 39, 93,
-     32,116,104,101,110, 10,  9,  9,  9,101,114,114,111,114, 40,
-     34,116,111,108,117, 97, 58, 32,110,111, 32,115,117,112,112,
-    111,114,116, 32,102,111,114, 32,111,112,101,114, 97,116,111,
-    114, 34, 32, 46, 46, 32,102, 46,107,105,110,100, 41, 10,  9,
-      9,101,108,115,101, 10,  9,  9,  9,119, 97,114,110,105,110,
-    103, 40, 34, 78,111, 32,115,117,112,112,111,114,116, 32,102,
-    111,114, 32,111,112,101,114, 97,116,111,114, 32, 34, 46, 46,
-    111,112, 95,107, 46, 46, 34, 44, 32,105,103,110,111,114,105,
-    110,103, 34, 41, 10,  9,  9,  9,114,101,116,117,114,110, 32,
-    110,105,108, 10,  9,  9,101,110,100, 10,  9,101,110,100, 10,
-     10,  9,108,111, 99, 97,108, 32,114,101,102, 32, 61, 32, 39,
-     39, 10, 32,108,111, 99, 97,108, 32,116, 32, 61, 32,115,112,
-    108,105,116, 95, 99, 95,116,111,107,101,110,115, 40,115,116,
-    114,115,117, 98, 40, 97, 44, 50, 44,115,116,114,108,101,110,
-     40, 97, 41, 45, 49, 41, 44, 39, 44, 39, 41, 32, 45, 45, 32,
-    101,108,105,109,105,110, 97,116,101, 32, 98,114, 97, 99,101,
-    115, 10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,108,
-    111, 99, 97,108, 32,108, 32, 61, 32,123,110, 61, 48,125, 10,
-     32,119,104,105,108,101, 32,116, 91,105, 93, 32,100,111, 10,
-     32, 32,108, 46,110, 32, 61, 32,108, 46,110, 43, 49, 10, 32,
-     32,108, 91,108, 46,110, 93, 32, 61, 32, 68,101, 99,108, 97,
-    114, 97,116,105,111,110, 40,116, 91,105, 93, 44, 39,118, 97,
-    114, 39, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49, 10, 32,
-    101,110,100, 10, 32,105,102, 32,107, 32, 61, 61, 32, 39, 91,
-     93, 39, 32,116,104,101,110, 10,  9, 32,108,111, 99, 97,108,
-     32, 95, 10,  9, 32, 95, 44, 32, 95, 44, 32,114,101,102, 32,
-     61, 32,115,116,114,102,105,110,100, 40,100, 44, 39, 40, 38,
-     41, 39, 41, 10, 32, 32,100, 32, 61, 32,103,115,117, 98, 40,
-    100, 44, 39, 38, 39, 44, 39, 39, 41, 10, 32,101,108,115,101,
-    105,102, 32,107, 61, 61, 39, 38, 91, 93, 39, 32,116,104,101,
-    110, 10, 32, 32,108, 46,110, 32, 61, 32,108, 46,110, 43, 49,
-     10, 32, 32,108, 91,108, 46,110, 93, 32, 61, 32, 68,101, 99,
-    108, 97,114, 97,116,105,111,110, 40,100, 44, 39,118, 97,114,
-     39, 41, 10, 32, 32,108, 91,108, 46,110, 93, 46,110, 97,109,
-    101, 32, 61, 32, 39,116,111,108,117, 97, 95,118, 97,108,117,
-    101, 39, 10, 32,101,110,100, 10, 32,108,111, 99, 97,108, 32,
-    102, 32, 61, 32, 68,101, 99,108, 97,114, 97,116,105,111,110,
-     40,100, 44, 39,102,117,110, 99, 39, 41, 10, 32,105,102, 32,
-    107, 32, 61, 61, 32, 39, 91, 93, 39, 32, 97,110,100, 32, 40,
-    108, 91, 49, 93, 61, 61,110,105,108, 32,111,114, 32,105,115,
-     98, 97,115,105, 99, 40,108, 91, 49, 93, 46,116,121,112,101,
-     41,126, 61, 39,110,117,109, 98,101,114, 39, 41, 32,116,104,
-    101,110, 10, 32, 32,101,114,114,111,114, 40, 39,111,112,101,
-    114, 97,116,111,114, 91, 93, 32, 99, 97,110, 32,111,110,108,
-    121, 32, 98,101, 32,100,101,102,105,110,101,100, 32,102,111,
-    114, 32,110,117,109,101,114,105, 99, 32,105,110,100,101,120,
-     46, 39, 41, 10, 32,101,110,100, 10, 32,102, 46, 97,114,103,
-    115, 32, 61, 32,108, 10, 32,102, 46, 99,111,110,115,116, 32,
-     61, 32, 99, 10, 32,102, 46,107,105,110,100, 32, 61, 32,111,
-    112, 95,107, 10, 32,102, 46,108,110, 97,109,101, 32, 61, 32,
-     34, 46, 34, 46, 46, 40, 95, 84, 77, 91,102, 46,107,105,110,
-    100, 93, 32,111,114, 32,102, 46,107,105,110,100, 41, 10, 32,
-    105,102, 32,110,111,116, 32, 95, 84, 77, 91,102, 46,107,105,
-    110,100, 93, 32,116,104,101,110, 10, 32,  9,102, 46, 99, 97,
-    115,116, 95,111,112,101,114, 97,116,111,114, 32, 61, 32,116,
-    114,117,101, 10, 32,101,110,100, 10, 32,105,102, 32,102, 46,
-    107,105,110,100, 32, 61, 61, 32, 39, 91, 93, 39, 32, 97,110,
-    100, 32,114,101,102, 61, 61, 39, 38, 39, 32, 97,110,100, 32,
-    102, 46, 99,111,110,115,116,126, 61, 39, 99,111,110,115,116,
-     39, 32,116,104,101,110, 10, 32, 32, 79,112,101,114, 97,116,
-    111,114, 40,100, 44, 39, 38, 39, 46, 46,107, 44, 97, 44, 99,
-     41, 32,  9, 45, 45, 32, 99,114,101, 97,116,101, 32, 99,111,
-    114,114,101,115,112,111,100,105,110,103, 32,115,101,116, 32,
-    111,112,101,114, 97,116,111,114, 10, 32,101,110,100, 10, 32,
-    114,101,116,117,114,110, 32, 95, 79,112,101,114, 97,116,111,
-    114, 40,102, 41, 10,101,110,100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/operator.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    45, 45, 32,116,111,108,117, 97, 58, 32, 99,108, 97,115,115,
-     32, 99,108, 97,115,115, 10, 45, 45, 32, 87,114,105,116,116,
-    101,110, 32, 98,121, 32, 87, 97,108,100,101,109, 97,114, 32,
-     67,101,108,101,115, 10, 45, 45, 32, 84,101, 67, 71,114, 97,
-    102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45, 32, 74,117,
-    108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 36, 73,100, 58, 32,
-     36, 10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,101,
-     32,105,115, 32,102,114,101,101, 32,115,111,102,116,119, 97,
-    114,101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,100,
-    105,115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,110,
-    100, 47,111,114, 32,109,111,100,105,102,121, 32,105,116, 46,
-     10, 45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,114,
-    101, 32,112,114,111,118,105,100,101,100, 32,104,101,114,101,
-    117,110,100,101,114, 32,105,115, 32,111,110, 32, 97,110, 32,
-     34, 97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, 32,
-     97,110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,104,
-    111,114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,103,
-     97,116,105,111,110, 32,116,111, 32,112,114,111,118,105,100,
-    101, 32,109, 97,105,110,116,101,110, 97,110, 99,101, 44, 32,
-    115,117,112,112,111,114,116, 44, 32,117,112,100, 97,116,101,
-    115, 44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,101,
-    110,116,115, 44, 32,111,114, 32,109,111,100,105,102,105, 99,
-     97,116,105,111,110,115, 46, 10, 10, 10, 45, 45, 32, 67,108,
-     97,115,115, 32, 99,108, 97,115,115, 10, 45, 45, 32, 82,101,
-    112,114,101,115,101,110,116,115, 32, 97, 32, 99,108, 97,115,
-    115, 32,100,101,102,105,110,105,116,105,111,110, 46, 10, 45,
-     45, 32, 83,116,111,114,101,115, 32,116,104,101, 32,102,111,
-    108,108,111,119,105,110,103, 32,102,105,101,108,100,115, 58,
-     10, 45, 45, 32, 32, 32, 32,110, 97,109,101, 32, 61, 32, 99,
-    108, 97,115,115, 32,110, 97,109,101, 10, 45, 45, 32, 32, 32,
-     32, 98, 97,115,101, 32, 61, 32, 99,108, 97,115,115, 32, 98,
-     97,115,101, 44, 32,105,102, 32, 97,110,121, 32, 40,111,110,
-    108,121, 32,115,105,110,103,108,101, 32,105,110,104,101,114,
-    105,116, 97,110, 99,101, 32,105,115, 32,115,117,112,112,111,
-    114,116,101,100, 41, 10, 45, 45, 32, 32, 32, 32,123,105,125,
-     32, 32, 61, 32,108,105,115,116, 32,111,102, 32,109,101,109,
-     98,101,114,115, 10, 99,108, 97,115,115, 67,108, 97,115,115,
-     32, 61, 32,123, 10, 32, 99,108, 97,115,115,116,121,112,101,
-     32, 61, 32, 39, 99,108, 97,115,115, 39, 44, 10, 32,110, 97,
-    109,101, 32, 61, 32, 39, 39, 44, 10, 32, 98, 97,115,101, 32,
-     61, 32, 39, 39, 44, 10, 32,116,121,112,101, 32, 61, 32, 39,
-     39, 44, 10, 32, 98,116,121,112,101, 32, 61, 32, 39, 39, 44,
-     10, 32, 99,116,121,112,101, 32, 61, 32, 39, 39, 44, 10,125,
-     10, 99,108, 97,115,115, 67,108, 97,115,115, 46, 95, 95,105,
-    110,100,101,120, 32, 61, 32, 99,108, 97,115,115, 67,108, 97,
-    115,115, 10,115,101,116,109,101,116, 97,116, 97, 98,108,101,
-     40, 99,108, 97,115,115, 67,108, 97,115,115, 44, 99,108, 97,
-    115,115, 67,111,110,116, 97,105,110,101,114, 41, 10, 10, 10,
-     45, 45, 32,114,101,103,105,115,116,101,114, 32, 99,108, 97,
-    115,115, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,
-    115,115, 67,108, 97,115,115, 58,114,101,103,105,115,116,101,
-    114, 32, 40,112,114,101, 41, 10,  9,105,102, 32,110,111,116,
-     32,115,101,108,102, 58, 99,104,101, 99,107, 95,112,117, 98,
-    108,105, 99, 95, 97, 99, 99,101,115,115, 40, 41, 32,116,104,
-    101,110, 10,  9,  9,114,101,116,117,114,110, 10,  9,101,110,
-    100, 10, 10, 32,112,114,101, 32, 61, 32,112,114,101, 32,111,
-    114, 32, 39, 39, 10, 32,112,117,115,104, 40,115,101,108,102,
-     41, 10,  9,105,102, 32, 95, 99,111,108,108,101, 99,116, 91,
-    115,101,108,102, 46,116,121,112,101, 93, 32,116,104,101,110,
-     10,  9,  9,111,117,116,112,117,116, 40,112,114,101, 44, 39,
-     35,105,102,100,101,102, 32, 95, 95, 99,112,108,117,115,112,
-    108,117,115, 92,110, 39, 41, 10, 32, 32,111,117,116,112,117,
-    116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97, 95, 99,
-     99,108, 97,115,115, 40,116,111,108,117, 97, 95, 83, 44, 34,
-     39, 46, 46,115,101,108,102, 46,108,110, 97,109,101, 46, 46,
-     39, 34, 44, 34, 39, 46, 46,115,101,108,102, 46,116,121,112,
-    101, 46, 46, 39, 34, 44, 34, 39, 46, 46,115,101,108,102, 46,
-     98,116,121,112,101, 46, 46, 39, 34, 44, 39, 46, 46, 95, 99,
-    111,108,108,101, 99,116, 91,115,101,108,102, 46,116,121,112,
-    101, 93, 46, 46, 39, 41, 59, 39, 41, 10,  9,  9,111,117,116,
-    112,117,116, 40,112,114,101, 44, 39, 35,101,108,115,101, 92,
-    110, 39, 41, 10, 32, 32,111,117,116,112,117,116, 40,112,114,
-    101, 46, 46, 39,116,111,108,117, 97, 95, 99, 99,108, 97,115,
-    115, 40,116,111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,
-    101,108,102, 46,108,110, 97,109,101, 46, 46, 39, 34, 44, 34,
-     39, 46, 46,115,101,108,102, 46,116,121,112,101, 46, 46, 39,
-     34, 44, 34, 39, 46, 46,115,101,108,102, 46, 98,116,121,112,
-    101, 46, 46, 39, 34, 44, 78, 85, 76, 76, 41, 59, 39, 41, 10,
-      9,  9,111,117,116,112,117,116, 40,112,114,101, 44, 39, 35,
-    101,110,100,105,102, 92,110, 39, 41, 10,  9,101,108,115,101,
-     10, 32, 32,111,117,116,112,117,116, 40,112,114,101, 46, 46,
-     39,116,111,108,117, 97, 95, 99, 99,108, 97,115,115, 40,116,
-    111,108,117, 97, 95, 83, 44, 34, 39, 46, 46,115,101,108,102,
-     46,108,110, 97,109,101, 46, 46, 39, 34, 44, 34, 39, 46, 46,
-    115,101,108,102, 46,116,121,112,101, 46, 46, 39, 34, 44, 34,
-     39, 46, 46,115,101,108,102, 46, 98,116,121,112,101, 46, 46,
-     39, 34, 44, 78, 85, 76, 76, 41, 59, 39, 41, 10,  9,101,110,
-    100, 10,  9,105,102, 32,115,101,108,102, 46,101,120,116,114,
-     97, 95, 98, 97,115,101,115, 32,116,104,101,110, 10,  9,  9,
-    102,111,114, 32,107, 44, 98, 97,115,101, 32,105,110, 32,105,
-    112, 97,105,114,115, 40,115,101,108,102, 46,101,120,116,114,
-     97, 95, 98, 97,115,101,115, 41, 32,100,111, 10,  9,  9,  9,
-     45, 45, 32,110,111,116, 32,110,111,119, 10, 32, 32, 32, 45,
-     45,111,117,116,112,117,116, 40,112,114,101, 46, 46, 39, 32,
-    116,111,108,117, 97, 95, 97,100,100, 98, 97,115,101, 40,116,
-    111,108,117, 97, 95, 83, 44, 32, 34, 39, 46, 46,115,101,108,
-    102, 46,116,121,112,101, 46, 46, 39, 34, 44, 32, 34, 39, 46,
-     46, 98, 97,115,101, 46, 46, 39, 34, 41, 59, 39, 41, 10,  9,
-      9,101,110,100, 10,  9,101,110,100, 10, 32,111,117,116,112,
-    117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97, 95,
-     98,101,103,105,110,109,111,100,117,108,101, 40,116,111,108,
-    117, 97, 95, 83, 44, 34, 39, 46, 46,115,101,108,102, 46,108,
-    110, 97,109,101, 46, 46, 39, 34, 41, 59, 39, 41, 10, 32,108,
-    111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,105,108,101,
-     32,115,101,108,102, 91,105, 93, 32,100,111, 10, 32, 32,115,
-    101,108,102, 91,105, 93, 58,114,101,103,105,115,116,101,114,
-     40,112,114,101, 46, 46, 39, 32, 39, 41, 10, 32, 32,105, 32,
-     61, 32,105, 43, 49, 10, 32,101,110,100, 10, 32,111,117,116,
-    112,117,116, 40,112,114,101, 46, 46, 39,116,111,108,117, 97,
-     95,101,110,100,109,111,100,117,108,101, 40,116,111,108,117,
-     97, 95, 83, 41, 59, 39, 41, 10,  9,112,111,112, 40, 41, 10,
-    101,110,100, 10, 10, 45, 45, 32,114,101,116,117,114,110, 32,
-     99,111,108,108,101, 99,116,105,111,110, 32,114,101,113,117,
-    105,114,101,109,101,110,116, 10,102,117,110, 99,116,105,111,
-    110, 32, 99,108, 97,115,115, 67,108, 97,115,115, 58,114,101,
-    113,117,105,114,101, 99,111,108,108,101, 99,116,105,111,110,
-     32, 40,116, 41, 10,  9,105,102, 32,115,101,108,102, 46,102,
-    108, 97,103,115, 46,112,114,111,116,101, 99,116,101,100, 95,
-    100,101,115,116,114,117, 99,116,111,114, 32,116,104,101,110,
-     10,  9,  9,114,101,116,117,114,110, 32,102, 97,108,115,101,
-     10,  9,101,110,100, 10, 32,112,117,115,104, 40,115,101,108,
-    102, 41, 10,  9,108,111, 99, 97,108, 32,114, 32, 61, 32,102,
-     97,108,115,101, 10, 32,108,111, 99, 97,108, 32,105, 61, 49,
-     10, 32,119,104,105,108,101, 32,115,101,108,102, 91,105, 93,
-     32,100,111, 10, 32, 32,114, 32, 61, 32,115,101,108,102, 91,
-    105, 93, 58,114,101,113,117,105,114,101, 99,111,108,108,101,
-     99,116,105,111,110, 40,116, 41, 32,111,114, 32,114, 10, 32,
-     32,105, 32, 61, 32,105, 43, 49, 10, 32,101,110,100, 10,  9,
-    112,111,112, 40, 41, 10,  9, 45, 45, 32,111,110,108,121, 32,
-     99,108, 97,115,115, 32,116,104, 97,116, 32,101,120,112,111,
-    114,116,115, 32,100,101,115,116,114,117, 99,116,111,114, 32,
-     99, 97,110, 32, 98,101, 32, 97,112,112,114,111,112,114,105,
-     97,116,101,108,121, 32, 99,111,108,108,101, 99,116,101,100,
-     10,  9, 45, 45, 32, 99,108, 97,115,115,101,115, 32,116,104,
-     97,116, 32,101,120,112,111,114,116, 32, 99,111,110,115,116,
-    114,117, 99,116,111,114,115, 32,110,101,101,100, 32,116,111,
-     32,104, 97,118,101, 32, 97, 32, 99,111,108,108,101, 99,116,
-    111,114, 32, 40,111,118,101,114,114,105,100,101,100, 32, 98,
-    121, 32, 45, 68, 32,102,108, 97,103, 32,111,110, 32, 99,111,
-    109,109, 97,110,100, 32,108,105,110,101, 41, 10,  9,105,102,
-     32,115,101,108,102, 46, 95,100,101,108,101,116,101, 32,111,
-    114, 32, 40, 40,110,111,116, 32,102,108, 97,103,115, 91, 39,
-     68, 39, 93, 41, 32, 97,110,100, 32,115,101,108,102, 46, 95,
-    110,101,119, 41, 32,116,104,101,110, 10,  9,  9, 45, 45,116,
-     91,115,101,108,102, 46,116,121,112,101, 93, 32, 61, 32, 34,
-    116,111,108,117, 97, 95, 99,111,108,108,101, 99,116, 95, 34,
-     32, 46, 46, 32,103,115,117, 98, 40,115,101,108,102, 46,116,
-    121,112,101, 44, 34, 58, 58, 34, 44, 34, 95, 34, 41, 10,  9,
-      9,116, 91,115,101,108,102, 46,116,121,112,101, 93, 32, 61,
-     32, 34,116,111,108,117, 97, 95, 99,111,108,108,101, 99,116,
-     95, 34, 32, 46, 46, 32, 99,108,101, 97,110, 95,116,101,109,
-    112,108, 97,116,101, 40,115,101,108,102, 46,116,121,112,101,
-     41, 10,  9,  9,114, 32, 61, 32,116,114,117,101, 10,  9,101,
-    110,100, 10, 32,114,101,116,117,114,110, 32,114, 10,101,110,
-    100, 10, 10, 45, 45, 32,111,117,116,112,117,116, 32,116, 97,
-    103,115, 10,102,117,110, 99,116,105,111,110, 32, 99,108, 97,
-    115,115, 67,108, 97,115,115, 58,100,101, 99,108,116,121,112,
-    101, 32, 40, 41, 10, 32,112,117,115,104, 40,115,101,108,102,
-     41, 10,  9,115,101,108,102, 46,116,121,112,101, 32, 61, 32,
-    114,101,103,116,121,112,101, 40,115,101,108,102, 46,111,114,
-    105,103,105,110, 97,108, 95,110, 97,109,101, 32,111,114, 32,
-    115,101,108,102, 46,110, 97,109,101, 41, 10,  9,115,101,108,
-    102, 46, 98,116,121,112,101, 32, 61, 32,116,121,112,101,118,
-     97,114, 40,115,101,108,102, 46, 98, 97,115,101, 41, 10,  9,
-    115,101,108,102, 46, 99,116,121,112,101, 32, 61, 32, 39, 99,
-    111,110,115,116, 32, 39, 46, 46,115,101,108,102, 46,116,121,
-    112,101, 10,  9,105,102, 32,115,101,108,102, 46,101,120,116,
-    114, 97, 95, 98, 97,115,101,115, 32,116,104,101,110, 10,  9,
-      9,102,111,114, 32,105, 61, 49, 44,116, 97, 98,108,101, 46,
-    103,101,116,110, 40,115,101,108,102, 46,101,120,116,114, 97,
-     95, 98, 97,115,101,115, 41, 32,100,111, 10,  9,  9,  9,115,
-    101,108,102, 46,101,120,116,114, 97, 95, 98, 97,115,101,115,
-     91,105, 93, 32, 61, 32,116,121,112,101,118, 97,114, 40,115,
-    101,108,102, 46,101,120,116,114, 97, 95, 98, 97,115,101,115,
-     91,105, 93, 41, 10,  9,  9,101,110,100, 10,  9,101,110,100,
-     10, 32,108,111, 99, 97,108, 32,105, 61, 49, 10, 32,119,104,
-    105,108,101, 32,115,101,108,102, 91,105, 93, 32,100,111, 10,
-     32, 32,115,101,108,102, 91,105, 93, 58,100,101, 99,108,116,
-    121,112,101, 40, 41, 10, 32, 32,105, 32, 61, 32,105, 43, 49,
-     10, 32,101,110,100, 10,  9,112,111,112, 40, 41, 10,101,110,
-    100, 10, 10, 10, 45, 45, 32, 80,114,105,110,116, 32,109,101,
-    116,104,111,100, 10,102,117,110, 99,116,105,111,110, 32, 99,
-    108, 97,115,115, 67,108, 97,115,115, 58,112,114,105,110,116,
-     32, 40,105,100,101,110,116, 44, 99,108,111,115,101, 41, 10,
-     32,112,114,105,110,116, 40,105,100,101,110,116, 46, 46, 34,
-     67,108, 97,115,115,123, 34, 41, 10, 32,112,114,105,110,116,
-     40,105,100,101,110,116, 46, 46, 34, 32,110, 97,109,101, 32,
-     61, 32, 39, 34, 46, 46,115,101,108,102, 46,110, 97,109,101,
-     46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,
-    105,100,101,110,116, 46, 46, 34, 32, 98, 97,115,101, 32, 61,
-     32, 39, 34, 46, 46,115,101,108,102, 46, 98, 97,115,101, 46,
-     46, 34, 39, 59, 34, 41, 10, 32,112,114,105,110,116, 40,105,
-    100,101,110,116, 46, 46, 34, 32,108,110, 97,109,101, 32, 61,
-     32, 39, 34, 46, 46,115,101,108,102, 46,108,110, 97,109,101,
-     46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,
-    105,100,101,110,116, 46, 46, 34, 32,116,121,112,101, 32, 61,
-     32, 39, 34, 46, 46,115,101,108,102, 46,116,121,112,101, 46,
-     46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,105,
-    100,101,110,116, 46, 46, 34, 32, 98,116,121,112,101, 32, 61,
-     32, 39, 34, 46, 46,115,101,108,102, 46, 98,116,121,112,101,
-     46, 46, 34, 39, 44, 34, 41, 10, 32,112,114,105,110,116, 40,
-    105,100,101,110,116, 46, 46, 34, 32, 99,116,121,112,101, 32,
-     61, 32, 39, 34, 46, 46,115,101,108,102, 46, 99,116,121,112,
-    101, 46, 46, 34, 39, 44, 34, 41, 10, 32,108,111, 99, 97,108,
-     32,105, 61, 49, 10, 32,119,104,105,108,101, 32,115,101,108,
-    102, 91,105, 93, 32,100,111, 10, 32, 32,115,101,108,102, 91,
-    105, 93, 58,112,114,105,110,116, 40,105,100,101,110,116, 46,
-     46, 34, 32, 34, 44, 34, 44, 34, 41, 10, 32, 32,105, 32, 61,
-     32,105, 43, 49, 10, 32,101,110,100, 10, 32,112,114,105,110,
-    116, 40,105,100,101,110,116, 46, 46, 34,125, 34, 46, 46, 99,
-    108,111,115,101, 41, 10,101,110,100, 10, 10,102,117,110, 99,
-    116,105,111,110, 32, 99,108, 97,115,115, 67,108, 97,115,115,
-     58,115,101,116, 95,112,114,111,116,101, 99,116,101,100, 95,
-    100,101,115,116,114,117, 99,116,111,114, 40,112, 41, 10,  9,
-    115,101,108,102, 46,102,108, 97,103,115, 46,112,114,111,116,
-    101, 99,116,101,100, 95,100,101,115,116,114,117, 99,116,111,
-    114, 32, 61, 32,115,101,108,102, 46,102,108, 97,103,115, 46,
-    112,114,111,116,101, 99,116,101,100, 95,100,101,115,116,114,
-    117, 99,116,111,114, 32,111,114, 32,112, 10,101,110,100, 10,
-     10, 45, 45, 32, 73,110,116,101,114,110, 97,108, 32, 99,111,
-    110,115,116,114,117, 99,116,111,114, 10,102,117,110, 99,116,
-    105,111,110, 32, 95, 67,108, 97,115,115, 32, 40,116, 41, 10,
-     32,115,101,116,109,101,116, 97,116, 97, 98,108,101, 40,116,
-     44, 99,108, 97,115,115, 67,108, 97,115,115, 41, 10, 32,116,
-     58, 98,117,105,108,100,110, 97,109,101,115, 40, 41, 10, 32,
-     97,112,112,101,110,100, 40,116, 41, 10, 32,114,101,116,117,
-    114,110, 32,116, 10,101,110,100, 10, 10, 45, 45, 32, 67,111,
-    110,115,116,114,117, 99,116,111,114, 10, 45, 45, 32, 69,120,
-    112,101, 99,116,115, 32,116,104,101, 32,110, 97,109,101, 44,
-     32,116,104,101, 32, 98, 97,115,101, 32, 40, 97,114,114, 97,
-    121, 41, 32, 97,110,100, 32,116,104,101, 32, 98,111,100,121,
-     32,111,102, 32,116,104,101, 32, 99,108, 97,115,115, 46, 10,
-    102,117,110, 99,116,105,111,110, 32, 67,108, 97,115,115, 32,
-     40,110, 44,112, 44, 98, 41, 10, 10,  9,105,102, 32,116, 97,
-     98,108,101, 46,103,101,116,110, 40,112, 41, 32, 62, 32, 49,
-     32,116,104,101,110, 10,  9,  9, 98, 32, 61, 32,115,116,114,
-    105,110,103, 46,115,117, 98, 40, 98, 44, 32, 49, 44, 32, 45,
-     50, 41, 10,  9,  9,102,111,114, 32,105, 61, 50, 44,116, 97,
-     98,108,101, 46,103,101,116,110, 40,112, 41, 44, 49, 32,100,
-    111, 10,  9,  9,  9, 98, 32, 61, 32, 98, 46, 46, 34, 92,110,
-     32,116,111,108,117, 97, 95,105,110,104,101,114,105,116,115,
-     32, 34, 46, 46,112, 91,105, 93, 46, 46, 34, 32, 95, 95, 34,
-     46, 46,112, 91,105, 93, 46, 46, 34, 95, 95, 59, 92,110, 34,
-     10,  9,  9,101,110,100, 10,  9,  9, 98, 32, 61, 32, 98, 46,
-     46, 34, 92,110,125, 34, 10,  9,101,110,100, 10, 10,  9, 45,
-     45, 32, 99,104,101, 99,107, 32,102,111,114, 32,116,101,109,
-    112,108, 97,116,101, 10,  9, 98, 32, 61, 32,115,116,114,105,
-    110,103, 46,103,115,117, 98, 40, 98, 44, 32, 34, 94,123, 37,
-    115, 42, 84, 69, 77, 80, 76, 65, 84, 69, 95, 66, 73, 78, 68,
-     34, 44, 32, 34,123, 92,110, 84, 79, 76, 85, 65, 95, 84, 69,
-     77, 80, 76, 65, 84, 69, 95, 66, 73, 78, 68, 34, 41, 10,  9,
-    108,111, 99, 97,108, 32,116, 44, 95, 44, 84, 44, 73, 32, 61,
-     32,115,116,114,105,110,103, 46,102,105,110,100, 40, 98, 44,
-     32, 34, 94,123, 37,115, 42, 84, 79, 76, 85, 65, 95, 84, 69,
-     77, 80, 76, 65, 84, 69, 95, 66, 73, 78, 68, 37,115, 42, 37,
-     40, 43, 37,115, 42, 92, 34, 63, 40, 91, 94, 92, 34, 44, 93,
-     42, 41, 92, 34, 63, 37,115, 42, 44, 37,115, 42, 40, 91, 94,
-     37, 41, 93, 42, 41, 37,115, 42, 37, 41, 43, 34, 41, 10,  9,
-    105,102, 32,116, 32,116,104,101,110, 10, 10,  9,  9, 45, 45,
-     32,114,101,109,111,118,101, 32,113,117,111,116,101,115, 10,
-      9,  9, 73, 32, 61, 32,115,116,114,105,110,103, 46,103,115,
-    117, 98, 40, 73, 44, 32, 34, 92, 34, 34, 44, 32, 34, 34, 41,
-     10,  9,  9, 84, 32, 61, 32,115,116,114,105,110,103, 46,103,
-    115,117, 98, 40, 84, 44, 32, 34, 92, 34, 34, 44, 32, 34, 34,
-     41, 10,  9,  9, 45, 45, 32,103,101,116, 32,116,121,112,101,
-     32,108,105,115,116, 10,  9,  9,108,111, 99, 97,108, 32,116,
-    121,112,101,115, 32, 61, 32,115,112,108,105,116, 95, 99, 95,
-    116,111,107,101,110,115, 40, 73, 44, 32, 34, 44, 34, 41, 10,
-      9,  9, 45, 45, 32,114,101,109,111,118,101, 32, 84, 69, 77,
-     80, 76, 65, 84, 69, 95, 66, 73, 78, 68, 32,108,105,110,101,
-     10,  9,  9,108,111, 99, 97,108, 32, 98,115, 32, 61, 32,115,
-    116,114,105,110,103, 46,103,115,117, 98, 40, 98, 44, 32, 34,
-     94,123, 37,115, 42, 84, 79, 76, 85, 65, 95, 84, 69, 77, 80,
-     76, 65, 84, 69, 95, 66, 73, 78, 68, 91, 94, 92,110, 93, 42,
-     92,110, 34, 44, 32, 34,123, 92,110, 34, 41, 10, 10,  9,  9,
-     45, 45, 32,114,101,112,108, 97, 99,101, 10,  9,  9,102,111,
-    114, 32,105, 32, 61, 49, 32, 44, 32,116,121,112,101,115, 46,
-    110, 32,100,111, 10, 10,  9,  9,  9,108,111, 99, 97,108, 32,
-     84,108, 32, 61, 32,115,112,108,105,116, 40, 84, 44, 32, 34,
-     32, 34, 41, 10,  9,  9,  9,108,111, 99, 97,108, 32, 73,108,
-     32, 61, 32,115,112,108,105,116, 95, 99, 95,116,111,107,101,
-    110,115, 40,116,121,112,101,115, 91,105, 93, 44, 32, 34, 32,
-     34, 41, 10,  9,  9,  9,108,111, 99, 97,108, 32, 98, 73, 32,
-     61, 32, 98,115, 10,  9,  9,  9,108,111, 99, 97,108, 32,112,
-     73, 32, 61, 32,123,125, 10,  9,  9,  9,102,111,114, 32,106,
-     32, 61, 32, 49, 44, 84,108, 46,110, 32,100,111, 10,  9,  9,
-      9,  9, 84,108, 91,106, 93, 32, 61, 32,102,105,110,100,116,
-    121,112,101, 40, 84,108, 91,106, 93, 41, 32,111,114, 32, 84,
-    108, 91,106, 93, 10,  9,  9,  9,  9, 98, 73, 32, 61, 32,115,
-    116,114,105,110,103, 46,103,115,117, 98, 40, 98, 73, 44, 32,
-     34, 40, 91, 94, 95, 37,119, 93, 41, 34, 46, 46, 84,108, 91,
-    106, 93, 46, 46, 34, 40, 91, 94, 95, 37,119, 93, 41, 34, 44,
-     32, 34, 37, 49, 34, 46, 46, 73,108, 91,106, 93, 46, 46, 34,
-     37, 50, 34, 41, 10,  9,  9,  9,  9,105,102, 32,112, 32,116,
-    104,101,110, 10,  9,  9,  9,  9,  9,102,111,114, 32,105, 61,
-     49, 44,116, 97, 98,108,101, 46,103,101,116,110, 40,112, 41,
-     32,100,111, 10,  9,  9,  9,  9,  9,  9,112, 73, 91,105, 93,
-     32, 61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,
-    112, 91,105, 93, 44, 32, 34, 40, 91, 94, 95, 37,119, 93, 63,
-     41, 34, 46, 46, 84,108, 91,106, 93, 46, 46, 34, 40, 91, 94,
-     95, 37,119, 93, 63, 41, 34, 44, 32, 34, 37, 49, 34, 46, 46,
-     73,108, 91,106, 93, 46, 46, 34, 37, 50, 34, 41, 10,  9,  9,
-      9,  9,  9,101,110,100, 10,  9,  9,  9,  9,101,110,100, 10,
-      9,  9,  9,101,110,100, 10,  9,  9,  9, 45, 45,108,111, 99,
-     97,108, 32, 97,112,112,101,110,100, 32, 61, 32, 34, 60, 34,
-     46, 46,115,116,114,105,110,103, 46,103,115,117, 98, 40,116,
-    121,112,101,115, 91,105, 93, 44, 32, 34, 37,115, 43, 34, 44,
-     32, 34, 44, 34, 41, 46, 46, 34, 62, 34, 10,  9,  9,  9,108,
-    111, 99, 97,108, 32, 97,112,112,101,110,100, 32, 61, 32, 34,
-     60, 34, 46, 46, 99,111,110, 99, 97,116, 40, 73,108, 44, 32,
-     49, 44, 32,116, 97, 98,108,101, 46,103,101,116,110, 40, 73,
-    108, 41, 44, 32, 34, 44, 34, 41, 46, 46, 34, 62, 34, 10,  9,
-      9,  9, 97,112,112,101,110,100, 32, 61, 32,115,116,114,105,
-    110,103, 46,103,115,117, 98, 40, 97,112,112,101,110,100, 44,
-     32, 34, 37,115, 42, 44, 37,115, 42, 34, 44, 32, 34, 44, 34,
-     41, 10,  9,  9,  9, 97,112,112,101,110,100, 32, 61, 32,115,
-    116,114,105,110,103, 46,103,115,117, 98, 40, 97,112,112,101,
-    110,100, 44, 32, 34, 62, 62, 34, 44, 32, 34, 62, 32, 62, 34,
-     41, 10,  9,  9,  9,102,111,114, 32,105, 61, 49, 44,116, 97,
-     98,108,101, 46,103,101,116,110, 40,112, 73, 41, 32,100,111,
-     10,  9,  9,  9,  9, 45, 45,112, 73, 91,105, 93, 32, 61, 32,
-    115,116,114,105,110,103, 46,103,115,117, 98, 40,112, 73, 91,
-    105, 93, 44, 32, 34, 62, 62, 34, 44, 32, 34, 62, 32, 62, 34,
-     41, 10,  9,  9,  9,  9,112, 73, 91,105, 93, 32, 61, 32,114,
-    101,115,111,108,118,101, 95,116,101,109,112,108, 97,116,101,
-     95,116,121,112,101,115, 40,112, 73, 91,105, 93, 41, 10,  9,
-      9,  9,101,110,100, 10,  9,  9,  9, 98, 73, 32, 61, 32,115,
-    116,114,105,110,103, 46,103,115,117, 98, 40, 98, 73, 44, 32,
-     34, 62, 62, 34, 44, 32, 34, 62, 32, 62, 34, 41, 10,  9,  9,
-      9, 67,108, 97,115,115, 40,110, 46, 46, 97,112,112,101,110,
-    100, 44, 32,112, 73, 44, 32, 98, 73, 41, 10,  9,  9,101,110,
-    100, 10,  9,  9,114,101,116,117,114,110, 10,  9,101,110,100,
-     10, 10,  9,108,111, 99, 97,108, 32,109, 98, 97,115,101, 10,
-     10,  9,105,102, 32,112, 32,116,104,101,110, 10,  9,  9,109,
-     98, 97,115,101, 32, 61, 32,116, 97, 98,108,101, 46,114,101,
-    109,111,118,101, 40,112, 44, 32, 49, 41, 10,  9,  9,105,102,
-     32,110,111,116, 32,112, 91, 49, 93, 32,116,104,101,110, 32,
-    112, 32, 61, 32,110,105,108, 32,101,110,100, 10,  9,101,110,
-    100, 10, 10,  9,109, 98, 97,115,101, 32, 61, 32,109, 98, 97,
-    115,101, 32, 97,110,100, 32,114,101,115,111,108,118,101, 95,
-    116,101,109,112,108, 97,116,101, 95,116,121,112,101,115, 40,
-    109, 98, 97,115,101, 41, 10, 10,  9,108,111, 99, 97,108, 32,
-     99, 10,  9,108,111, 99, 97,108, 32,111,110, 97,109,101, 32,
-     61, 32,115,116,114,105,110,103, 46,103,115,117, 98, 40,110,
-     44, 32, 34, 64, 46, 42, 36, 34, 44, 32, 34, 34, 41, 10,  9,
-    111,110, 97,109,101, 32, 61, 32,103,101,116,110, 97,109,101,
-    115,112, 97, 99,101, 40, 99,108, 97,115,115, 67,111,110,116,
-     97,105,110,101,114, 46, 99,117,114,114, 41, 46, 46,111,110,
-     97,109,101, 10, 10,  9,105,102, 32, 95,103,108,111, 98, 97,
-    108, 95, 99,108, 97,115,115,101,115, 91,111,110, 97,109,101,
-     93, 32,116,104,101,110, 10,  9,  9, 99, 32, 61, 32, 95,103,
-    108,111, 98, 97,108, 95, 99,108, 97,115,115,101,115, 91,111,
-    110, 97,109,101, 93, 10,  9,  9,105,102, 32,109, 98, 97,115,
-    101, 32, 97,110,100, 32, 40, 40,110,111,116, 32, 99, 46, 98,
-     97,115,101, 41, 32,111,114, 32, 99, 46, 98, 97,115,101, 32,
-     61, 61, 32, 34, 34, 41, 32,116,104,101,110, 10,  9,  9,  9,
-     99, 46, 98, 97,115,101, 32, 61, 32,109, 98, 97,115,101, 10,
-      9,  9,101,110,100, 10,  9,101,108,115,101, 10,  9,  9, 99,
-     32, 61, 32, 95, 67,108, 97,115,115, 40, 95, 67,111,110,116,
-     97,105,110,101,114,123,110, 97,109,101, 61,110, 44, 32, 98,
-     97,115,101, 61,109, 98, 97,115,101, 44, 32,101,120,116,114,
-     97, 95, 98, 97,115,101,115, 61,112,125, 41, 10, 10,  9,  9,
-    108,111, 99, 97,108, 32,102,116, 32, 61, 32,103,101,116,110,
-     97,109,101,115,112, 97, 99,101, 40, 99, 46,112, 97,114,101,
-    110,116, 41, 46, 46, 99, 46,111,114,105,103,105,110, 97,108,
-     95,110, 97,109,101, 10,  9,  9, 97,112,112,101,110,100, 95,
-    103,108,111, 98, 97,108, 95,116,121,112,101, 40,102,116, 44,
-     32, 99, 41, 10,  9,101,110,100, 10, 10,  9,112,117,115,104,
-     40, 99, 41, 10,  9, 99, 58,112, 97,114,115,101, 40,115,116,
-    114,115,117, 98, 40, 98, 44, 50, 44,115,116,114,108,101,110,
-     40, 98, 41, 45, 49, 41, 41, 32, 45, 45, 32,101,108,105,109,
-    105,110, 97,116,101, 32, 98,114, 97, 99,101,115, 10,  9,112,
-    111,112, 40, 41, 10,101,110,100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/class.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    45, 45, 32,109, 97,114,107, 32,117,112, 32, 99,111,109,109,
-    101,110,116,115, 32, 97,110,100, 32,115,116,114,105,110,103,
-    115, 10, 83, 84, 82, 49, 32, 61, 32, 34, 92, 48, 48, 49, 34,
-     10, 83, 84, 82, 50, 32, 61, 32, 34, 92, 48, 48, 50, 34, 10,
-     83, 84, 82, 51, 32, 61, 32, 34, 92, 48, 48, 51, 34, 10, 83,
-     84, 82, 52, 32, 61, 32, 34, 92, 48, 48, 52, 34, 10, 82, 69,
-     77, 32, 32, 61, 32, 34, 92, 48, 48, 53, 34, 10, 65, 78, 89,
-     32, 32, 61, 32, 34, 40, 91, 92, 48, 48, 49, 45, 92, 48, 48,
-     53, 93, 41, 34, 10, 69, 83, 67, 49, 32, 61, 32, 34, 92, 48,
-     48, 54, 34, 10, 69, 83, 67, 50, 32, 61, 32, 34, 92, 48, 48,
-     55, 34, 10, 10, 77, 65, 83, 75, 32, 61, 32,123, 32, 45, 45,
-     32,116,104,101, 32,115,117, 98,115,116,105,116,117,116,105,
-    111,110, 32,111,114,100,101,114, 32,105,115, 32,105,109,112,
-    111,114,116, 97,110,116, 10, 32,123, 69, 83, 67, 49, 44, 32,
-     34, 92, 92, 39, 34,125, 44, 10, 32,123, 69, 83, 67, 50, 44,
-     32, 39, 92, 92, 34, 39,125, 44, 10, 32,123, 83, 84, 82, 49,
-     44, 32, 34, 39, 34,125, 44, 10, 32,123, 83, 84, 82, 50, 44,
-     32, 39, 34, 39,125, 44, 10, 32,123, 83, 84, 82, 51, 44, 32,
-     34, 37, 91, 37, 91, 34,125, 44, 10, 32,123, 83, 84, 82, 52,
-     44, 32, 34, 37, 93, 37, 93, 34,125, 44, 10, 32,123, 82, 69,
-     77, 32, 44, 32, 34, 37, 45, 37, 45, 34,125, 44, 10,125, 10,
-     10,102,117,110, 99,116,105,111,110, 32,109, 97,115,107, 32,
-     40,115, 41, 10, 32,102,111,114, 32,105, 32, 61, 32, 49, 44,
-    103,101,116,110, 40, 77, 65, 83, 75, 41, 32, 32,100,111, 10,
-     32, 32,115, 32, 61, 32,103,115,117, 98, 40,115, 44, 77, 65,
-     83, 75, 91,105, 93, 91, 50, 93, 44, 77, 65, 83, 75, 91,105,
-     93, 91, 49, 93, 41, 10, 32,101,110,100, 10, 32,114,101,116,
-    117,114,110, 32,115, 10,101,110,100, 10, 10,102,117,110, 99,
-    116,105,111,110, 32,117,110,109, 97,115,107, 32, 40,115, 41,
-     10, 32,102,111,114, 32,105, 32, 61, 32, 49, 44,103,101,116,
-    110, 40, 77, 65, 83, 75, 41, 32, 32,100,111, 10, 32, 32,115,
-     32, 61, 32,103,115,117, 98, 40,115, 44, 77, 65, 83, 75, 91,
-    105, 93, 91, 49, 93, 44, 77, 65, 83, 75, 91,105, 93, 91, 50,
-     93, 41, 10, 32,101,110,100, 10, 32,114,101,116,117,114,110,
-     32,115, 10,101,110,100, 10, 10,102,117,110, 99,116,105,111,
-    110, 32, 99,108,101, 97,110, 32, 40,115, 41, 10, 32, 45, 45,
-     32, 99,104,101, 99,107, 32,102,111,114, 32, 99,111,109,112,
-    105,108, 97,116,105,111,110, 32,101,114,114,111,114, 10, 32,
-    108,111, 99, 97,108, 32, 99,111,100,101, 32, 61, 32, 34,114,
-    101,116,117,114,110, 32,102,117,110, 99,116,105,111,110, 32,
-     40, 41, 92,110, 34, 32, 46, 46, 32,115, 32, 46, 46, 32, 34,
-     92,110, 32,101,110,100, 34, 10, 32,105,102, 32,110,111,116,
-     32,100,111,115,116,114,105,110,103, 40, 99,111,100,101, 41,
-     32,116,104,101,110, 10, 32, 32,114,101,116,117,114,110, 32,
-    110,105,108, 10, 32,101,110,100, 10, 10, 32,105,102, 32,102,
-    108, 97,103,115, 91, 39, 67, 39, 93, 32,116,104,101,110, 10,
-     32,  9,114,101,116,117,114,110, 32,115, 10, 32,101,110,100,
-     10, 10, 32,108,111, 99, 97,108, 32, 83, 32, 61, 32, 34, 34,
-     32, 45, 45, 32,115, 97,118,101,100, 32,115,116,114,105,110,
-    103, 10, 10, 32,115, 32, 61, 32,109, 97,115,107, 40,115, 41,
-     10, 10, 32, 45, 45, 32,114,101,109,111,118,101, 32, 98,108,
-     97,110,107,115, 32, 97,110,100, 32, 99,111,109,109,101,110,
-    116,115, 10, 32,119,104,105,108,101, 32, 49, 32,100,111, 10,
-     32, 32,108,111, 99, 97,108, 32, 98, 44,101, 44,100, 32, 61,
-     32,115,116,114,102,105,110,100, 40,115, 44, 65, 78, 89, 41,
-     10, 32, 32,105,102, 32, 98, 32,116,104,101,110, 10, 32, 32,
-     32, 83, 32, 61, 32, 83, 46, 46,115,116,114,115,117, 98, 40,
-    115, 44, 49, 44, 98, 45, 49, 41, 10, 32, 32, 32,115, 32, 61,
-     32,115,116,114,115,117, 98, 40,115, 44, 98, 43, 49, 41, 10,
-     32, 32, 32,105,102, 32,100, 61, 61, 83, 84, 82, 49, 32,111,
-    114, 32,100, 61, 61, 83, 84, 82, 50, 32,116,104,101,110, 10,
-     32, 32, 32, 32,101, 32, 61, 32,115,116,114,102,105,110,100,
-     40,115, 44,100, 41, 10, 32, 32, 32, 32, 83, 32, 61, 32, 83,
-     32, 46, 46,100, 46, 46,115,116,114,115,117, 98, 40,115, 44,
-     49, 44,101, 41, 10, 32, 32, 32, 32,115, 32, 61, 32,115,116,
-    114,115,117, 98, 40,115, 44,101, 43, 49, 41, 10, 32, 32, 32,
-    101,108,115,101,105,102, 32,100, 61, 61, 83, 84, 82, 51, 32,
-    116,104,101,110, 10, 32, 32, 32, 32,101, 32, 61, 32,115,116,
-    114,102,105,110,100, 40,115, 44, 83, 84, 82, 52, 41, 10, 32,
-     32, 32, 32, 83, 32, 61, 32, 83, 46, 46,100, 46, 46,115,116,
-    114,115,117, 98, 40,115, 44, 49, 44,101, 41, 10, 32, 32, 32,
-     32,115, 32, 61, 32,115,116,114,115,117, 98, 40,115, 44,101,
-     43, 49, 41, 10, 32, 32, 32,101,108,115,101,105,102, 32,100,
-     61, 61, 82, 69, 77, 32,116,104,101,110, 10, 32, 32, 32, 32,
-    115, 32, 61, 32,103,115,117, 98, 40,115, 44, 34, 91, 94, 92,
-    110, 93, 42, 40, 92,110, 63, 41, 34, 44, 34, 37, 49, 34, 44,
-     49, 41, 10, 32, 32, 32,101,110,100, 10, 32, 32,101,108,115,
-    101, 10, 32, 32, 32, 83, 32, 61, 32, 83, 46, 46,115, 10, 32,
-     32, 32, 98,114,101, 97,107, 10, 32, 32,101,110,100, 10, 32,
-    101,110,100, 10, 32, 45, 45, 32,101,108,105,109,105,110, 97,
-    116,101, 32,117,110,101, 99,101,115,115, 97,114,121, 32,115,
-    112, 97, 99,101,115, 10, 32, 83, 32, 61, 32,103,115,117, 98,
-     40, 83, 44, 34, 91, 32, 92,116, 93, 43, 34, 44, 34, 32, 34,
-     41, 10, 32, 83, 32, 61, 32,103,115,117, 98, 40, 83, 44, 34,
-     91, 32, 92,116, 93, 42, 92,110, 91, 32, 92,116, 93, 42, 34,
-     44, 34, 92,110, 34, 41, 10,  9, 83, 32, 61, 32,103,115,117,
-     98, 40, 83, 44, 34, 92,110, 43, 34, 44, 34, 92,110, 34, 41,
-     10, 32, 83, 32, 61, 32,117,110,109, 97,115,107, 40, 83, 41,
-     10, 32,114,101,116,117,114,110, 32, 83, 10,101,110,100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/clean.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    45, 45, 32, 71,101,110,101,114, 97,116,101, 32, 98,105,110,
-    100,105,110,103, 32, 99,111,100,101, 10, 45, 45, 32, 87,114,
-    105,116,116,101,110, 32, 98,121, 32, 87, 97,108,100,101,109,
-     97,114, 32, 67,101,108,101,115, 10, 45, 45, 32, 84,101, 67,
-     71,114, 97,102, 47, 80, 85, 67, 45, 82,105,111, 10, 45, 45,
-     32, 74,117,108, 32, 49, 57, 57, 56, 10, 45, 45, 32, 76, 97,
-    115,116, 32,117,112,100, 97,116,101, 58, 32, 65,112,114, 32,
-     50, 48, 48, 51, 10, 45, 45, 32, 36, 73,100, 58, 32, 36, 10,
-     10, 10, 45, 45, 32, 84,104,105,115, 32, 99,111,100,101, 32,
-    105,115, 32,102,114,101,101, 32,115,111,102,116,119, 97,114,
-    101, 59, 32,121,111,117, 32, 99, 97,110, 32,114,101,100,105,
-    115,116,114,105, 98,117,116,101, 32,105,116, 32, 97,110,100,
-     47,111,114, 32,109,111,100,105,102,121, 32,105,116, 46, 10,
-     45, 45, 32, 84,104,101, 32,115,111,102,116,119, 97,114,101,
-     32,112,114,111,118,105,100,101,100, 32,104,101,114,101,117,
-    110,100,101,114, 32,105,115, 32,111,110, 32, 97,110, 32, 34,
-     97,115, 32,105,115, 34, 32, 98, 97,115,105,115, 44, 32, 97,
-    110,100, 10, 45, 45, 32,116,104,101, 32, 97,117,116,104,111,
-    114, 32,104, 97,115, 32,110,111, 32,111, 98,108,105,103, 97,
-    116,105,111,110, 32,116,111, 32,112,114,111,118,105,100,101,
-     32,109, 97,105,110,116,101,110, 97,110, 99,101, 44, 32,115,
-    117,112,112,111,114,116, 44, 32,117,112,100, 97,116,101,115,
-     44, 10, 45, 45, 32,101,110,104, 97,110, 99,101,109,101,110,
-    116,115, 44, 32,111,114, 32,109,111,100,105,102,105, 99, 97,
-    116,105,111,110,115, 46, 10, 10,102,117,110, 99,116,105,111,
-    110, 32,112, 97,114,115,101, 95,101,120,116,114, 97, 40, 41,
-     10, 10,  9,102,111,114, 32,107, 44,118, 32,105,110, 32,105,
-    112, 97,105,114,115, 40, 95,101,120,116,114, 97, 95,112, 97,
-    114, 97,109,101,116,101,114,115, 32,111,114, 32,123,125, 41,
-     32,100,111, 10,  9,  9, 10,  9,  9,108,111, 99, 97,108, 32,
-     98, 44,101, 44,110, 97,109,101, 44,118, 97,108,117,101, 32,
-     61, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,118,
-     44, 32, 34, 94, 40, 91, 94, 61, 93, 41, 61, 40, 46, 42, 41,
-     36, 34, 41, 10,  9,  9,105,102, 32, 98, 32,116,104,101,110,
-     10,  9,  9,  9, 95,101,120,116,114, 97, 95,112, 97,114, 97,
-    109,101,116,101,114,115, 91,110, 97,109,101, 93, 32, 61, 32,
-    118, 97,108,117,101, 10,  9,  9,101,108,115,101, 10,  9,  9,
-      9, 95,101,120,116,114, 97, 95,112, 97,114, 97,109,101,116,
-    101,114,115, 91,118, 93, 32, 61, 32,116,114,117,101, 10,  9,
-      9,101,110,100, 10,  9,101,110,100, 10,101,110,100, 10, 10,
-    102,117,110, 99,116,105,111,110, 32,100,111,105,116, 32, 40,
-     41, 10,  9, 45, 45, 32,100,101,102,105,110,101, 32,112, 97,
-     99,107, 97,103,101, 32,110, 97,109,101, 44, 32,105,102, 32,
-    110,111,116, 32,112,114,111,118,105,100,101,100, 10,  9,105,
-    102, 32,110,111,116, 32,102,108, 97,103,115, 46,110, 32,116,
-    104,101,110, 10,  9,  9,105,102, 32,102,108, 97,103,115, 46,
-    102, 32,116,104,101,110, 10,  9,  9,  9,102,108, 97,103,115,
-     46,110, 32, 61, 32,103,115,117, 98, 40,102,108, 97,103,115,
-     46,102, 44, 34, 37, 46, 46, 42, 36, 34, 44, 34, 34, 41, 10,
-      9,  9,  9, 95, 44, 95, 44,102,108, 97,103,115, 46,110, 32,
-     61, 32,115,116,114,105,110,103, 46,102,105,110,100, 40,102,
-    108, 97,103,115, 46,110, 44, 32, 34, 40, 91, 94, 47, 92, 92,
-     93, 42, 41, 36, 34, 41, 10,  9,  9,101,108,115,101, 10,  9,
-      9,  9,101,114,114,111,114, 40, 34, 35,110,111, 32,112, 97,
-     99,107, 97,103,101, 32,110, 97,109,101, 32,110,111,114, 32,
-    105,110,112,117,116, 32,102,105,108,101, 32,112,114,111,118,
-    105,100,101,100, 34, 41, 10,  9,  9,101,110,100, 10,  9,101,
-    110,100, 10, 10,  9, 45, 45, 32,112, 97,114,115,101, 32,116,
-     97, 98,108,101, 32,119,105,116,104, 32,101,120,116,114, 97,
-     32,112, 97,114, 97,109,116,101,114,115, 10,  9,112, 97,114,
-    115,101, 95,101,120,116,114, 97, 40, 41, 10, 10,  9, 45, 45,
-     32,100,111, 32,116,104,105,115, 32, 97,102,116,101,114, 32,
-    115,101,116,116,105,110,103, 32,116,104,101, 32,112, 97, 99,
-    107, 97,103,101, 32,110, 97,109,101, 10,  9,105,102, 32,102,
-    108, 97,103,115, 91, 39, 76, 39, 93, 32,116,104,101,110, 10,
-      9,  9,100,111,102,105,108,101, 40,102,108, 97,103,115, 91,
-     39, 76, 39, 93, 41, 10,  9,101,110,100, 10, 10,  9, 45, 45,
-     32, 97,100,100, 32, 99,112,112,115,116,114,105,110,103, 10,
-      9,105,102, 32,110,111,116, 32,102,108, 97,103,115, 91, 39,
-     83, 39, 93, 32,116,104,101,110, 10,  9,  9, 95, 98, 97,115,
-    105, 99, 91, 39,115,116,114,105,110,103, 39, 93, 32, 61, 32,
-     39, 99,112,112,115,116,114,105,110,103, 39, 10,  9,  9, 95,
-     98, 97,115,105, 99, 91, 39,115,116,100, 58, 58,115,116,114,
-    105,110,103, 39, 93, 32, 61, 32, 39, 99,112,112,115,116,114,
-    105,110,103, 39, 10,  9,  9, 95, 98, 97,115,105, 99, 95, 99,
-    116,121,112,101, 46, 99,112,112,115,116,114,105,110,103, 32,
-     61, 32, 39, 99,111,110,115,116, 32, 99,104, 97,114, 42, 39,
-     10,  9,101,110,100, 10, 10,  9, 45, 45, 32,112,114,111, 99,
-     99,101,115,115, 32,112, 97, 99,107, 97,103,101, 10,  9,108,
-    111, 99, 97,108, 32,112, 32, 32, 61, 32, 80, 97, 99,107, 97,
-    103,101, 40,102,108, 97,103,115, 46,110, 44,102,108, 97,103,
-    115, 46,102, 41, 10, 10,  9,105,102, 32,102,108, 97,103,115,
-     46,112, 32,116,104,101,110, 10,  9,  9,114,101,116,117,114,
-    110, 32, 32, 32, 32, 32, 32, 32, 32, 45, 45, 32,111,110,108,
-    121, 32,112, 97,114,115,101, 10,  9,101,110,100, 10, 10,  9,
-    105,102, 32,102,108, 97,103,115, 46,111, 32,116,104,101,110,
-     10,  9,  9,108,111, 99, 97,108, 32,115,116, 44,109,115,103,
-     32, 61, 32,119,114,105,116,101,116,111, 40,102,108, 97,103,
-    115, 46,111, 41, 10,  9,  9,105,102, 32,110,111,116, 32,115,
-    116, 32,116,104,101,110, 10,  9,  9,  9,101,114,114,111,114,
-     40, 39, 35, 39, 46, 46,109,115,103, 41, 10,  9,  9,101,110,
-    100, 10,  9,101,110,100, 10, 10,  9,112, 58,100,101, 99,108,
-    116,121,112,101, 40, 41, 10,  9,105,102, 32,102,108, 97,103,
-    115, 46, 80, 32,116,104,101,110, 10,  9,  9,112, 58,112,114,
-    105,110,116, 40, 41, 10,  9,101,108,115,101, 10,  9,  9,112,
-     58,112,114,101, 97,109, 98,108,101, 40, 41, 10,  9,  9,112,
-     58,115,117,112, 99,111,100,101, 40, 41, 10,  9,  9,112, 58,
-    114,101,103,105,115,116,101,114, 40, 41, 10,  9,  9,112,117,
-    115,104, 40,112, 41, 10,  9,  9,112,111,115,116, 95,111,117,
-    116,112,117,116, 95,104,111,111,107, 40,112, 41, 10,  9,  9,
-    112,111,112, 40, 41, 10,  9,101,110,100, 10, 10,  9,105,102,
-     32,102,108, 97,103,115, 46,111, 32,116,104,101,110, 10,  9,
-      9,119,114,105,116,101,116,111, 40, 41, 10,  9,101,110,100,
-     10, 10,  9, 45, 45, 32,119,114,105,116,101, 32,104,101, 97,
-    100,101,114, 32,102,105,108,101, 10,  9,105,102, 32,110,111,
-    116, 32,102,108, 97,103,115, 46, 80, 32,116,104,101,110, 10,
-      9,  9,105,102, 32,102,108, 97,103,115, 46, 72, 32,116,104,
-    101,110, 10,  9,  9,  9,108,111, 99, 97,108, 32,115,116, 44,
-    109,115,103, 32, 61, 32,119,114,105,116,101,116,111, 40,102,
-    108, 97,103,115, 46, 72, 41, 10,  9,  9,  9,105,102, 32,110,
-    111,116, 32,115,116, 32,116,104,101,110, 10,  9,  9,  9,  9,
-    101,114,114,111,114, 40, 39, 35, 39, 46, 46,109,115,103, 41,
-     10,  9,  9,  9,101,110,100, 10,  9,  9,  9,112, 58,104,101,
-     97,100,101,114, 40, 41, 10,  9,  9,  9,119,114,105,116,101,
-    116,111, 40, 41, 10,  9,  9,101,110,100, 10,  9,101,110,100,
-     10,101,110,100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua embedded: src/bin/lua/doit.lua");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
-
-  { /* begin embedded lua code */
-   int top = lua_gettop(tolua_S);
-   static unsigned char B[] = {
-    10,108,111, 99, 97,108, 32,101,114,114, 44,109,115,103, 32,
-     61, 32,112, 99, 97,108,108, 40,100,111,105,116, 41, 10,105,
-    102, 32,110,111,116, 32,101,114,114, 32,116,104,101,110, 10,
-     32,108,111, 99, 97,108, 32, 95, 44, 95, 44,108, 97, 98,101,
-    108, 44,109,115,103, 32, 61, 32,115,116,114,102,105,110,100,
-     40,109,115,103, 44, 34, 40, 46, 45, 58, 46, 45, 58, 37,115,
-     42, 41, 40, 46, 42, 41, 34, 41, 10, 32,116,111,108,117, 97,
-     95,101,114,114,111,114, 40,109,115,103, 44,108, 97, 98,101,
-    108, 41, 10, 32,112,114,105,110,116, 40,100,101, 98,117,103,
-     46,116,114, 97, 99,101, 98, 97, 99,107, 40, 41, 41, 10,101,
-    110,100,32
-   };
-   tolua_dobuffer(tolua_S,(char*)B,sizeof(B),"tolua: embedded Lua code 22");
-   lua_settop(tolua_S, top);
-  } /* end of embedded lua code */
-
- tolua_endmodule(tolua_S);
- return 1;
-}
-
-
-#if defined(LUA_VERSION_NUM) && LUA_VERSION_NUM >= 501
- int luaopen_tolua (lua_State* tolua_S) {
- return tolua_tolua_open(tolua_S);
-};
-#endif
-
Index: de/branches/buildsystem3/src/tolua/toluabind.h
===================================================================
--- /code/branches/buildsystem3/src/tolua/toluabind.h	(revision 2663)
+++ 	(revision )
@@ -1,8 +1,0 @@
-/*
-** Lua binding: tolua
-** Generated automatically by tolua++-1.0.91 on Wed Apr 26 22:30:15 2006.
-*/
-
-/* Exported function */
-TOLUA_API int  tolua_tolua_open (lua_State* tolua_S);
-
Index: /code/branches/buildsystem3/src/util/CMakeLists.txt
===================================================================
--- /code/branches/buildsystem3/src/util/CMakeLists.txt	(revision 2663)
+++ /code/branches/buildsystem3/src/util/CMakeLists.txt	(revision 2664)
@@ -1,3 +1,41 @@
-SET(UTIL_SRC_FILES
+ #
+ #             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.
+ #
+
+SET_SOURCE_FILES(UTIL_FILES
+  CRC32.h
+  Clipboard.h
+  Convert.h
+  Debug.h
+  Exception.h
+  ExprParser.h
+  Math.h
+  MathConvert.h
+  MultiType.h
+  MultiTypeValue.h
+  OutputBuffer.h
+  OutputHandler.h
+  SignalHandler.h
+  Sleep.h
+  String.h
+  SubString.h
+  UtilPrereqs.h
+  mbool.h
+
   Clipboard.cc
   CRC32.cc
@@ -12,8 +50,25 @@
   SubString.cc
 )
+#GET_ALL_HEADER_FILES(UTIL_HDR_FILES)
+#SET(UTIL_FILES ${UTIL_SRC_FILES} ${UTIL_HDR_FILES})
+GENERATE_SOURCE_GROUPS(${UTIL_FILES})
+# Also add OrxonoxConfig to have it least somewhere in the IDE
+LIST(APPEND UTIL_FILES
+  ${CMAKE_BINARY_DIR}/src/OrxonoxConfig.h
+  ${CMAKE_SOURCE_DIR}/src/OrxonoxConfig.h.in
+)
+SOURCE_GROUP("" FILES
+  ${CMAKE_BINARY_DIR}/src/OrxonoxConfig.h
+  ${CMAKE_SOURCE_DIR}/src/OrxonoxConfig.h.in
+)
 
-ADD_LIBRARY(util SHARED ${UTIL_SRC_FILES})
+IF(GCC_NO_SYSTEM_HEADER_SUPPORT)
+  # Get around displaying a few hundred lines of warning code
+  SET_SOURCE_FILES_PROPERTIES(MultiType.cc PROPERTIES COMPILE_FLAGS "-w")
+ENDIF()
 
-TARGET_LINK_LIBRARIES(util
-  ${OGRE_LIBRARIES}
-)
+ADD_LIBRARY(util SHARED ${UTIL_FILES})
+SET_TARGET_PROPERTIES(util PROPERTIES DEFINE_SYMBOL "UTIL_SHARED_BUILD")
+TARGET_LINK_LIBRARIES(util ${OGRE_LIBRARY})
+
+ORXONOX_INSTALL(util)
Index: /code/branches/buildsystem3/src/util/CRC32.h
===================================================================
--- /code/branches/buildsystem3/src/util/CRC32.h	(revision 2663)
+++ /code/branches/buildsystem3/src/util/CRC32.h	(revision 2664)
@@ -32,5 +32,4 @@
 #include "UtilPrereqs.h"
 #include <iostream>
-#include "Integers.h"
 
 namespace orxonox
Index: /code/branches/buildsystem3/src/util/Clipboard.cc
===================================================================
--- /code/branches/buildsystem3/src/util/Clipboard.cc	(revision 2663)
+++ /code/branches/buildsystem3/src/util/Clipboard.cc	(revision 2664)
@@ -36,5 +36,5 @@
 #include "Clipboard.h"
 
-#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
+#ifdef ORXONOX_PLATFORM_WINDOWS
 
 /////////////
@@ -104,5 +104,5 @@
 }
 
-#else /* ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 */
+#else /* ORXONOX_PLATFORM_WINDOWS */
 
 /////////////
@@ -135,3 +135,3 @@
 }
 
-#endif /* ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 */
+#endif /* ORXONOX_PLATFORM_WINDOWS */
Index: /code/branches/buildsystem3/src/util/Convert.h
===================================================================
--- /code/branches/buildsystem3/src/util/Convert.h	(revision 2663)
+++ /code/branches/buildsystem3/src/util/Convert.h	(revision 2664)
@@ -50,5 +50,5 @@
 // This is however exactly what convertValue does, so we need to suppress these warnings.
 // They only occur when using the ImplicitConversion template.
-#if ORXONOX_COMPILER == ORXONOX_COMPILER_GNUC
+#ifdef ORXONOX_COMPILER_GCC
 #  pragma GCC system_header
 #endif
@@ -63,5 +63,5 @@
 
 // disable warnings about possible loss of data
-#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
+#ifdef ORXONOX_COMPILER_MSVC
 #  pragma warning(push)
 #  pragma warning(disable:4244)
@@ -88,5 +88,5 @@
 }
 
-#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
+#ifdef ORXONOX_COMPILER_MSVC
 #  pragma warning(pop)
 #endif
Index: de/branches/buildsystem3/src/util/Integers.h
===================================================================
--- /code/branches/buildsystem3/src/util/Integers.h	(revision 2663)
+++ 	(revision )
@@ -1,55 +1,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
- @brief
-    Defines fixed with integers
- */
-
-#ifndef _Integers_H__
-#define _Integers_H__
-
-#include "OrxonoxPlatform.h"
-
-/* Define fixed with integers
- * Note: This is not in a namespace to make it available everywhere!*/
-#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
-typedef __int8            int8_t;
-typedef __int16           int16_t;
-typedef __int32           int32_t;
-typedef __int64           int64_t;
-typedef unsigned __int8   uint8_t;
-typedef unsigned __int16  uint16_t;
-typedef unsigned __int32  uint32_t;
-typedef unsigned __int64  uint64_t;
-#else
-# include <inttypes.h>
-#endif
-
-#endif /* _Integers_H__ */
Index: /code/branches/buildsystem3/src/util/Math.h
===================================================================
--- /code/branches/buildsystem3/src/util/Math.h	(revision 2663)
+++ /code/branches/buildsystem3/src/util/Math.h	(revision 2664)
@@ -52,5 +52,5 @@
 
 //Get around Windows hackery
-#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
+#ifdef ORXONOX_PLATFORM_WINDOWS
 #  ifdef max
 #    undef max
Index: de/branches/buildsystem3/src/util/OrxonoxPlatform.h
===================================================================
--- /code/branches/buildsystem3/src/util/OrxonoxPlatform.h	(revision 2663)
+++ 	(revision )
@@ -1,274 +1,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:
- *      ...
- *   Co-authors:
- *      Reto Grieder
- *
- *   Original code: OgrePlatform.h, licensed under the LGPL. The code
- *   has changed quite a bit however.
- *
- */
-
-/**
- @file
- @brief
-    Various constants for compiler, architecture and platform.
- */
-
-#ifndef _OrxonoxPlatform_H__
-#define _OrxonoxPlatform_H__
-
-/* Initial platform/compiler-related stuff to set. */
-
-#define ORXONOX_PLATFORM_WIN32 1
-#define ORXONOX_PLATFORM_LINUX 2
-#define ORXONOX_PLATFORM_APPLE 3
-
-#define ORXONOX_COMPILER_MSVC 1
-#define ORXONOX_COMPILER_GNUC 2
-#define ORXONOX_COMPILER_BORL 3
-
-#define ORXONOX_ENDIAN_LITTLE 1
-#define ORXONOX_ENDIAN_BIG 2
-
-#define ORXONOX_ARCHITECTURE_32 1
-#define ORXONOX_ARCHITECTURE_64 2
-
-
-/* Finds the compiler type and version. */
-
-#if defined( _MSC_VER )
-#  define ORXONOX_COMPILER ORXONOX_COMPILER_MSVC
-#  define ORXONOX_COMP_VER _MSC_VER
-
-#elif defined( __GNUC__ )
-#  define ORXONOX_COMPILER ORXONOX_COMPILER_GNUC
-#  define ORXONOX_COMP_VER (((__GNUC__)*100) + \
-        (__GNUC_MINOR__*10) + \
-        __GNUC_PATCHLEVEL__)
-
-#elif defined( __BORLANDC__ )
-#  define ORXONOX_COMPILER ORXONOX_COMPILER_BORL
-#  define ORXONOX_COMP_VER __BCPLUSPLUS__
-
-#else
-#  pragma error "No known compiler. Abort! Abort!"
-
-#endif
-
-
-/* See if we can use __forceinline or if we need to use __inline instead */
-#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
-#  if ORXONOX_COMP_VER >= 1200
-#    define FORCEINLINE __forceinline
-#  endif
-#elif defined(__MINGW32__)
-#  if !defined(FORCEINLINE)
-#    define FORCEINLINE __inline
-#  endif
-#else
-#  define FORCEINLINE __inline
-#endif
-
-/* Finds the current platform */
-#if defined( __WIN32__ ) || defined( _WIN32 )
-#  define ORXONOX_PLATFORM ORXONOX_PLATFORM_WIN32
-#elif defined( __APPLE_CC__)
-#  define ORXONOX_PLATFORM ORXONOX_PLATFORM_APPLE
-#else
-#  define ORXONOX_PLATFORM ORXONOX_PLATFORM_LINUX
-#endif
-
-/* Find the arch type */
-#if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__)
-#  define ORXONOX_ARCH_TYPE ORXONOX_ARCHITECTURE_64
-#else
-#  define ORXONOX_ARCH_TYPE ORXONOX_ARCHITECTURE_32
-#endif
-
-/* Try to define function information */
-#ifndef __FUNCTIONNAME__
-#  if ORXONOX_COMPILER == ORXONOX_COMPILER_BORL
-#    define __FUNCTIONNAME__ __FUNC__
-#  elif ORXONOX_COMPILER == ORXONOX_COMPILER_GNUC
-#    define __FUNCTIONNAME__ __PRETTY_FUNCTION__
-#  elif ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
-#    define __FUNCTIONNAME__ __FUNCTION__
-#  else
-#    define __FUNCTIONNAME__
-#  endif
-#endif
-
-/* Determine whether we're building in debug mode */
-#if defined(_DEBUG) || defined(DEBUG)
-#  define ORXONOX_DEBUG_MODE 1
-#else
-#  define ORXONOX_DEBUG_MODE 0
-#endif
-
-/* Define configurable floating point type */
-namespace orxonox
-{
-#ifdef ORXONOX_DOUBLE_PRECISION
-    typedef double Real;
-#else
-    typedef float  Real;
-#endif
-}
-
-//-----------------------------------------------------------------------
-// Version Information
-//-----------------------------------------------------------------------
-
-#define ORXONOX_VERSION_MAJOR 0
-#define ORXONOX_VERSION_MINOR 1
-#define ORXONOX_VERSION_PATCH 2
-#define ORXONOX_VERSION_SUFFIX ""
-#define ORXONOX_VERSION_NAME "Bellatrix"
-
-#define ORXONOX_VERSION ((ORXONOX_VERSION_MAJOR << 16) | (ORXONOX_VERSION_MINOR << 8) | ORXONOX_VERSION_PATCH)
-
-
-/*---------------------------------
- * Windows Settings
- *-------------------------------*/
-#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
-/* Disable unicode support on MingW at the moment, poorly supported in stdlibc++
- * STLPORT fixes this though so allow if found
- * MinGW C++ Toolkit supports unicode and sets the define __MINGW32_TOOLKIT_UNICODE__ in _mingw.h */
-#  if defined( __MINGW32__ ) && !defined(_STLPORT_VERSION)
-#    include<_mingw.h>
-#    if defined(__MINGW32_TOOLBOX_UNICODE__)
-#      define ORXONOX_UNICODE_SUPPORT 1
-#    else
-#      define ORXONOX_UNICODE_SUPPORT 0
-#    endif
-#  else
-#    define ORXONOX_UNICODE_SUPPORT 1
-#  endif
-#endif /* Platform Win32 */
-
-
-/*---------------------------------
- * Linux/Apple Settings
- *-------------------------------*/
-#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_LINUX || ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE
-
-/* A quick define to overcome different names for the same function */
-#  define stricmp strcasecmp
-
-/* TODO: Check what this actually is and whether we need it or not */
-#if 0
-#  if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE
-#    define ORXONOX_PLATFORM_LIB "OrxonoxPlatform.bundle"
-#  else
-/* ORXONOX_PLATFORM_LINUX */
-#    define ORXONOX_PLATFORM_LIB "libOrxonoxPlatform.so"
-#  endif
-#endif
-
-/* Always enable unicode support for the moment
- * Perhaps disable in old versions of gcc if necessary */
-#  define ORXONOX_UNICODE_SUPPORT 1
-
-#endif /* Patform Linux/Apple */
-
-
-/*---------------------------------
- * Apple Settings
- *-------------------------------*/
-/* For apple, we always have a custom config.h file */
-#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_APPLE
-#  include "config.h"
-#endif
-
-
-/*---------------------------------
- * Visual Studio Settings
- *-------------------------------*/
-#if ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC
-/* Turn off warnings generated by long std templates
- * This warns about truncation to 255 characters in debug/browse info */
-/*#   pragma warning (disable : 4786)*/
-
-/* Turn off warnings generated by long std templates
- * This warns about truncation to 255 characters in debug/browse info */
-/*#   pragma warning (disable : 4503)*/
-
-/* disable: conversion from 'double' to 'float', possible loss of data
- * disable: conversion from 'ogg_int64_t' to 'long', possible loss of data
- * This has been dealt with in base_properties of the solution since the
- * warning primarily occurs in library header files (which are mostly
- * included before OrxonoxPlatform.h is) */
-/*#   pragma warning (disable : 4244)*/
-
-/* disable: "conversion from 'size_t' to 'unsigned int', possible loss of data */
-/*#   pragma warning (disable : 4267)*/
-
-/* disable: "truncation from 'double' to 'float' */
-/*#   pragma warning (disable : 4305)*/
-
-/* set to level 4: "<type> needs to have dll-interface to be used by clients'
- * Happens on STL member variables which are not public therefore is ok */
-#   pragma warning (disable : 4251)
-
-/* disable: 'MultiTypeString' : multiple assignment operators specified
- * Used in MultiType and works fine so far */
-/*#   pragma warning (disable : 4522)*/
-
-/* disable: "non dll-interface class used as base for dll-interface class"
- * Happens when deriving from Singleton because bug in compiler ignores
- * template export */
-/*#   pragma warning (disable : 4275)*/
-
-/* disable: "C++ Exception Specification ignored"
- * This is because MSVC 6 did not implement all the C++ exception
- * specifications in the ANSI C++ draft. */
-/*#   pragma warning( disable : 4290 )*/
-
-/* disable: "no suitable definition provided for explicit template
- * instantiation request" Occurs in VC7 for no justifiable reason on all
- * #includes of Singleton */
-/*#   pragma warning( disable: 4661)*/
-
-/* disable: deprecation warnings when using CRT calls in VC8
- * These show up on all C runtime lib code in VC8, disable since they clutter
- * the warnings with things we may not be able to do anything about (e.g.
- * generated code from nvparse etc). I doubt very much that these calls
- * will ever be actually removed from VC anyway, it would break too much code. */
-/*# pragma warning( disable: 4996)*/
-
-/* disable: "conditional expression constant", always occurs on
- * ORXONOX_MUTEX_CONDITIONAL when no threading enabled */
-/*#   pragma warning (disable : 201)*/
-
-
-/* Define the english written operators like and, or, xor */
-#include <iso646.h>
-
-/* include visual leak detector to search for memory leaks */
-/* #include <vld.h> */
-
-#endif /* ORXONOX_COMPILER == ORXONOX_COMPILER_MSVC */
-
-#endif /* _OrxonoxPlatform_H__ */
Index: /code/branches/buildsystem3/src/util/SignalHandler.cc
===================================================================
--- /code/branches/buildsystem3/src/util/SignalHandler.cc	(revision 2663)
+++ /code/branches/buildsystem3/src/util/SignalHandler.cc	(revision 2664)
@@ -44,5 +44,5 @@
 }
 
-#if ORXONOX_PLATFORM != ORXONOX_PLATFORM_WIN32
+#ifdef ORXONOX_PLATFORM_LINUX
 
 #include <wait.h>
@@ -353,3 +353,3 @@
 }
 
-#endif /* ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 */
+#endif /* ORXONOX_PLATFORM_LINUX */
Index: /code/branches/buildsystem3/src/util/SignalHandler.h
===================================================================
--- /code/branches/buildsystem3/src/util/SignalHandler.h	(revision 2663)
+++ /code/branches/buildsystem3/src/util/SignalHandler.h	(revision 2664)
@@ -46,5 +46,5 @@
 }
 
-#if ORXONOX_PLATFORM != ORXONOX_PLATFORM_WIN32
+#ifdef ORXONOX_PLATFORM_LINUX
 #include <signal.h>
 
@@ -97,5 +97,5 @@
 }
 
-#else /* ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 */
+#else /* ORXONOX_PLATFORM_LINUX */
 
 namespace orxonox
@@ -116,5 +116,5 @@
 }
 
-#endif /* ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32 */
+#endif /* ORXONOX_PLATFORM_LINUX */
 
 #endif /* _SignalHandler_H__ */
Index: /code/branches/buildsystem3/src/util/Sleep.h
===================================================================
--- /code/branches/buildsystem3/src/util/Sleep.h	(revision 2663)
+++ /code/branches/buildsystem3/src/util/Sleep.h	(revision 2664)
@@ -36,7 +36,7 @@
 #define _Sleep_H__
 
-#include "OrxonoxPlatform.h"
+#include "UtilPrereqs.h"
 
-#if ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32
+#ifdef ORXONOX_PLATFORM_WINDOWS
 #include <winbase.h>
 
Index: /code/branches/buildsystem3/src/util/UtilPrereqs.h
===================================================================
--- /code/branches/buildsystem3/src/util/UtilPrereqs.h	(revision 2663)
+++ /code/branches/buildsystem3/src/util/UtilPrereqs.h	(revision 2664)
@@ -35,10 +35,10 @@
 #define _UtilPrereqs_H__
 
-#include "util/OrxonoxPlatform.h"
+#include "OrxonoxConfig.h"
 
 //-----------------------------------------------------------------------
 // Shared library settings
 //-----------------------------------------------------------------------
-#if (ORXONOX_PLATFORM == ORXONOX_PLATFORM_WIN32) && !defined( UTIL_STATIC_BUILD )
+#if defined(ORXONOX_PLATFORM_WINDOWS) && !defined( UTIL_STATIC_BUILD )
 #  ifdef UTIL_SHARED_BUILD
 #    define _UtilExport __declspec(dllexport)
Index: de/branches/buildsystem3/updateMedia.sh
===================================================================
--- /code/branches/buildsystem3/updateMedia.sh	(revision 2663)
+++ 	(revision )
@@ -1,5 +1,0 @@
-#!/bin/bash
-dir=${pwd}
-cd ../media
-svn up
-cd $dir
