Переглянути джерело

Merge branch 'release/v0.2.0'

Iñigo Valentin 3 днів тому
батько
коміт
b18a6c66e6
100 змінених файлів з 4436 додано та 8842 видалено
  1. 29 0
      .github/agents/build-fixer.agent.md
  2. 30 0
      .github/agents/ff7-format-researcher.agent.md
  3. 57 0
      .github/copilot-instructions.md
  4. 43 0
      .github/instructions/cpp-style.instructions.md
  5. 23 0
      .github/instructions/ff7-data-formats.instructions.md
  6. 27 0
      .github/instructions/lua-style.instructions.md
  7. 21 0
      .github/instructions/tests.instructions.md
  8. 15 0
      .github/prompts/build.prompt.md
  9. 19 0
      .github/prompts/new-data-format.prompt.md
  10. 16 0
      .github/prompts/test.prompt.md
  11. 45 3
      CMakeLists.txt
  12. 15 7
      data/data/config/config.cfg
  13. 4 0
      data/data/screens/_screens.xml
  14. 292 0
      data/data/screens/battle/battle_fx.lua
  15. 72 0
      data/data/screens/battle/battle_fx.xml
  16. 20 0
      data/data/screens/fade/fade.lua
  17. 2 0
      data/data/screens/fade/fade.xml
  18. 64 0
      data/data/screens/game_over/game_over.lua
  19. 9 0
      data/data/screens/game_over/game_over.xml
  20. 4 0
      data/data/scripts/_scripts.xml
  21. 65 3
      data/data/scripts/battle.lua
  22. 471 0
      data/data/scripts/battle/battle_ai_vm.lua
  23. 2428 217
      data/data/scripts/battle/battle_ui.lua
  24. 12 8
      data/data/scripts/config.lua
  25. 42 0
      data/data/scripts/debug_data.lua
  26. 48 0
      data/data/scripts/field.lua
  27. 110 108
      data/data/scripts/menu/begin_menu.lua
  28. 5 5
      data/data/scripts/menu/equip_menu.lua
  29. 14 14
      data/data/scripts/menu/item_menu.lua
  30. 6 6
      data/data/scripts/menu/main_menu.lua
  31. 7 7
      data/data/scripts/menu/materia_menu.lua
  32. 6 3
      data/data/scripts/menu/name_menu.lua
  33. 3 3
      data/data/scripts/menu/pause_menu.lua
  34. 3 3
      data/data/scripts/menu/save_menu.lua
  35. 85 0
      data/data/scripts/worldmap/triangle_triggers.lua
  36. 319 0
      data/data/scripts/worldmap/vehicles.lua
  37. 1 0
      data/data/texts/english/menu.xml
  38. 1 1
      debian/control
  39. 2 0
      debian/install
  40. 1 1
      doc/BUILD.md
  41. 0 27
      lib/CMakeLists.txt
  42. 0 4
      lib/luabind/.gitignore
  43. 0 65
      lib/luabind/INSTALL
  44. 0 248
      lib/luabind/Jamroot
  45. 0 22
      lib/luabind/LICENSE
  46. 0 167
      lib/luabind/luabind/adopt_policy.hpp
  47. 0 112
      lib/luabind/luabind/back_reference.hpp
  48. 0 37
      lib/luabind/luabind/back_reference_fwd.hpp
  49. 0 942
      lib/luabind/luabind/class.hpp
  50. 0 50
      lib/luabind/luabind/class_info.hpp
  51. 0 137
      lib/luabind/luabind/config.hpp
  52. 0 143
      lib/luabind/luabind/container_policy.hpp
  53. 0 61
      lib/luabind/luabind/copy_policy.hpp
  54. 0 119
      lib/luabind/luabind/dependency_policy.hpp
  55. 0 330
      lib/luabind/luabind/detail/call.hpp
  56. 0 259
      lib/luabind/luabind/detail/call_0x.hpp
  57. 0 541
      lib/luabind/luabind/detail/call_function.hpp
  58. 0 425
      lib/luabind/luabind/detail/call_member.hpp
  59. 0 66
      lib/luabind/luabind/detail/call_operator_iterate.hpp
  60. 0 85
      lib/luabind/luabind/detail/class_registry.hpp
  61. 0 211
      lib/luabind/luabind/detail/class_rep.hpp
  62. 0 142
      lib/luabind/luabind/detail/constructor.hpp
  63. 0 41
      lib/luabind/luabind/detail/conversion_storage.hpp
  64. 0 92
      lib/luabind/luabind/detail/convert_to_lua.hpp
  65. 0 55
      lib/luabind/luabind/detail/debug.hpp
  66. 0 266
      lib/luabind/luabind/detail/decorate_type.hpp
  67. 0 193
      lib/luabind/luabind/detail/deduce_signature.hpp
  68. 0 123
      lib/luabind/luabind/detail/enum_maker.hpp
  69. 0 188
      lib/luabind/luabind/detail/format_signature.hpp
  70. 0 53
      lib/luabind/luabind/detail/garbage_collector.hpp
  71. 0 107
      lib/luabind/luabind/detail/has_get_pointer.hpp
  72. 0 35
      lib/luabind/luabind/detail/index_tuple.hpp
  73. 0 168
      lib/luabind/luabind/detail/inheritance.hpp
  74. 0 124
      lib/luabind/luabind/detail/instance_holder.hpp
  75. 0 60
      lib/luabind/luabind/detail/link_compatibility.hpp
  76. 0 105
      lib/luabind/luabind/detail/make_instance.hpp
  77. 0 44
      lib/luabind/luabind/detail/most_derived.hpp
  78. 0 52
      lib/luabind/luabind/detail/object_call.hpp
  79. 0 132
      lib/luabind/luabind/detail/object_rep.hpp
  80. 0 45
      lib/luabind/luabind/detail/open.hpp
  81. 0 79
      lib/luabind/luabind/detail/operator_id.hpp
  82. 0 119
      lib/luabind/luabind/detail/other.hpp
  83. 0 36
      lib/luabind/luabind/detail/pcall.hpp
  84. 0 54
      lib/luabind/luabind/detail/pointee_sizeof.hpp
  85. 0 40
      lib/luabind/luabind/detail/pointee_typeid.hpp
  86. 0 1035
      lib/luabind/luabind/detail/policy.hpp
  87. 0 85
      lib/luabind/luabind/detail/primitives.hpp
  88. 0 33
      lib/luabind/luabind/detail/property.hpp
  89. 0 112
      lib/luabind/luabind/detail/ref.hpp
  90. 0 74
      lib/luabind/luabind/detail/signature_match.hpp
  91. 0 52
      lib/luabind/luabind/detail/stack_utils.hpp
  92. 0 190
      lib/luabind/luabind/detail/typetraits.hpp
  93. 0 34
      lib/luabind/luabind/detail/yes_no.hpp
  94. 0 72
      lib/luabind/luabind/discard_result_policy.hpp
  95. 0 93
      lib/luabind/luabind/error.hpp
  96. 0 110
      lib/luabind/luabind/exception_handler.hpp
  97. 0 42
      lib/luabind/luabind/from_stack.hpp
  98. 0 62
      lib/luabind/luabind/function.hpp
  99. 0 16
      lib/luabind/luabind/get_main_thread.hpp
  100. 0 39
      lib/luabind/luabind/get_pointer.hpp

+ 29 - 0
.github/agents/build-fixer.agent.md

@@ -0,0 +1,29 @@
+---
+description: "Use when the CMake configure, build, or v-gears-tests fail. Diagnoses compiler, linker, and dependency errors, then applies minimal style-compliant fixes."
+tools: [read, search, edit, execute]
+argument-hint: "Paste the build error or describe the failure"
+---
+
+You are a specialist at fixing V-Gears build and test failures. Your job is to get the build green with the smallest possible change.
+
+## Constraints
+
+- DO NOT silence errors by disabling warnings, sanitizers, or tests.
+- DO NOT upgrade dependencies, compilers, or the C++ standard — the project is C++14.
+- DO NOT rewrite the CMake `USE_DETERMINISTIC_FALLBACKS` logic; it exists on purpose.
+- DO NOT touch `lib/` (bundled third-party) unless the failure is provably there.
+- Follow `doc/STYLE.md` for any code change; keep diffs minimal and consistent with surrounding code.
+
+## Approach
+
+1. Reproduce: run the failing command yourself (`cmake --build build -j$(nproc)` or `ctest --test-dir build --output-on-failure`) and capture the complete first error — never guess from a summary.
+2. Form one specific hypothesis about the root cause before editing; read the relevant sources/CMake files to confirm it.
+3. Apply the minimal fix and rebuild only the affected target first, then the full build.
+4. If the same error persists after two fix attempts, stop editing and re-read the full compiler output — do not loop.
+5. For sanitizer (`build-asan`) failures, remember that system LuaJIT is an uninstrumented dependency, and `vptr:*/OgreSingleton.h` is a known UBSAN false positive to suppress, not fix.
+
+## Output Format
+
+- **Root cause** — one paragraph.
+- **Fix** — files changed and why.
+- **Verification** — exact commands run and their results.

+ 30 - 0
.github/agents/ff7-format-researcher.agent.md

@@ -0,0 +1,30 @@
+---
+description: "Use when researching how an FF7 binary file format works, how an existing parser/serializer in src/data implements it, or what the installer decompiler emits. Read-only investigation that returns findings with file references."
+tools: [read, search]
+---
+
+You are a specialist at investigating FF7 binary formats in the V-Gears codebase. Your job is to answer questions about format layouts, existing parsers, and decompiler behavior — nothing else.
+
+## Constraints
+
+- DO NOT edit, create, or delete any file. You are strictly read-only.
+- DO NOT run builds, tests, or any shell commands.
+- DO NOT suggest adding original game data or extracted assets to the repo.
+- ONLY investigate and report.
+
+## Approach
+
+1. Check the format documentation in `doc/code/FFVII/` first.
+2. Find the relevant parser triplet in `src/data/` (`*File`, `*FileSerializer`, `*FileManager`) and read the serializer for the authoritative byte layout.
+3. For installer/decompiler questions, read `src/installer/` and the matching instruction classes under `src/installer/decompiler/`.
+4. Cross-check with the test suite in `test/` — tests often show minimal usage examples.
+5. `_OLD/` contains legacy q-gears code useful as historical reference only; flag it as such if you use it.
+
+## Output Format
+
+Return a concise report with:
+
+- **Answer** — direct answer to the question asked.
+- **Layout/behavior** — field offsets, types, and endianness if relevant, or the call flow for behavior questions.
+- **References** — workspace file paths with line numbers for every claim.
+- **Open questions** — anything not determinable from the code or docs.

+ 57 - 0
.github/copilot-instructions.md

@@ -0,0 +1,57 @@
+# V-Gears Project Guidelines
+
+V-Gears is a free, cross-platform reimplementation of the Final Fantasy VII engine (C++14), continued from the stalled q-gears project. It runs the user's own original game data on modern systems — it is not an emulator and ships no game assets.
+
+## Legal Boundary (never cross)
+
+- NEVER add copyrighted game data to the repo: no ripped textures, models, audio, field scripts, kernel text, or any other extracted asset.
+- Game data is extracted locally by the `v-gears-installer` from the user's own copy of the game, at install time, on the user's machine only.
+- Do not commit screenshots or conversion outputs containing game assets.
+
+## Architecture
+
+- `src/common/` — application base class and file utilities shared by all targets.
+- `src/core/` — engine runtime: audio, console, entities, walkmesh, UI, particles, savemap, `ScriptManager` (Lua bindings via sol2 and system LuaJIT).
+- `src/data/` — FF7 binary format parsers (LGP, LZS, HRC, TEX, field files, worldmap TXZ...). Most formats follow a triplet: `*File` (data), `*FileSerializer` (read/write), `*FileManager` (Ogre resource loading).
+- `src/installer/` — Qt data installer (`v-gears-installer`); includes the script `decompiler/` that converts field/world scripts into Lua and the SfxDump audio converter.
+- `src/map/`, `src/modules/`, `src/viewer/` — field map code, game modules (e.g. worldmap), and the model viewer.
+- `src/third_party/sol/` — vendored sol2 single header. Do not restyle, modernize, or refactor it.
+- LuaJIT is a system dependency.
+- `test/` — Boost.Test suite mirroring `src/` paths; sources are listed manually in `test/CMakeLists.txt`.
+- `data/` — runtime configuration only (Ogre plugins/resources cfgs). Not game data.
+- `doc/` — all guides; `doc/code/FFVII/` documents the original binary formats.
+- `_OLD/` — legacy q-gears code kept for reference. Do not modify or reuse without asking.
+
+## Build and Test
+
+Dependencies and details: see [doc/BUILD.md](../doc/BUILD.md).
+
+```bash
+cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug       # configure once
+cmake --build build -j$(nproc)                      # build everything
+cmake --build build --target v-gears-tests -j$(nproc)
+ctest --test-dir build --output-on-failure          # run the test suite
+```
+
+- Always build out-of-source (`build/`, `build-normal/`, `build-asan/`); never in-tree.
+- Main targets: `v-gears` (engine), `v-gears-installer` (data installer), `v-gears-tests`.
+- CMake option `USE_DETERMINISTIC_FALLBACKS` (default `ON`) pragmatically finds libraries; set it `OFF` for clean dependency diagnosis or packaging.
+- Binaries are picky about working directory and cfg files — read [doc/RUN.md](../doc/RUN.md) before launching anything.
+
+## Code Style
+
+Follow [doc/STYLE.md](../doc/STYLE.md) (C++) and [doc/STYLE-LUA.md](../doc/STYLE-LUA.md). Non-negotiable core rules:
+
+- C++14 only. No newer standard features, no GNU/compiler-specific extensions.
+- Files `PascalCase.cpp` / `.h`; types and functions `PascalCase`; variables `snake_case`; class data members `trailing_underscore_`; constants and enumerators `UPPER_SNAKE_CASE`.
+- `#pragma once` include guards; include order: C++ stdlib → C system → other libraries → related header → V-Gears headers.
+- `const` before the type, `nullptr`, prefix `++i`, `explicit` single-argument constructors, `override` on overridden virtuals.
+- Readability over performance; consistency with surrounding code beats personal preference.
+
+## Sanitizer Builds (ASAN/UBSAN)
+
+Verified working recipe — keep these quirks intact:
+
+1. Configure `build-asan` with `-DCMAKE_C_FLAGS='-fsanitize=address,undefined -fno-omit-frame-pointer -g'` (same for CXX flags, plus `-DCMAKE_EXE_LINKER_FLAGS='-fsanitize=address,undefined'`). System LuaJIT is used as an uninstrumented dependency.
+2. Build the project normally with the sanitizer flags enabled.
+3. Run with a UBSAN suppression for `vptr:*/OgreSingleton.h` — a false positive inherent to OGRE's singleton pattern, not a real bug.

+ 43 - 0
.github/instructions/cpp-style.instructions.md

@@ -0,0 +1,43 @@
+---
+description: "Use when writing or editing C++ code (.cpp/.h files). V-Gears C++14 style rules: naming, includes, const usage, casts, class layout, and documentation."
+applyTo: ["**/*.cpp", "**/*.h"]
+---
+
+# V-Gears C++ Style Essentials
+
+Full guide: [doc/STYLE.md](../../doc/STYLE.md). Key rules enforced on every change:
+
+## Language
+
+- C++14 only — nothing newer, no GNU extensions. Must compile with the project's existing toolchain.
+- Exceptions are allowed; specify `noexcept` when useful and correct.
+- Avoid RTTI (`dynamic_cast`, `typeid`) except in tests. Avoid macros, complicated templates, and forward declarations (acceptable only to break include loops).
+
+## Naming
+
+- Types, functions, methods: `PascalCase` (`MyExcitingClass`, `AddTableEntry()`).
+- Variables and parameters: `snake_case`; private/protected class members get a trailing underscore (`data_member_`).
+- Constants and enumerators: `UPPER_SNAKE_CASE`.
+- Files: `PascalCase.cpp` / `PascalCase.h`; every `.cpp` has a matching `.h` except `main()` files and tests.
+
+## Files and Includes
+
+- `#pragma once` for include guards. Headers must be self-contained.
+- Include order, no blank lines between groups: C++ stdlib → C system → other libraries → related header → other V-Gears headers. No relative paths in includes.
+- Don't inline functions except trivial ones (~10 lines, no loops/switches).
+- Give `.cpp`-only code internal linkage with `static`; never in headers.
+
+## Code Constructs
+
+- `const` before the type: `const int* foo`, not `int const* foo`.
+- `nullptr` for pointers, `'\0'` for chars, `sizeof(varname)` over `sizeof(type)`.
+- C++ casts (`static_cast<>`), never C-style casts except to `void`.
+- Prefix `++i` unless postfix semantics are needed.
+- `explicit` single-argument constructors; `override` (or rarely `final`) on all overridden virtuals.
+- Classes: data members private; section order `public:` → `protected:` → `private:`; structs only for passive data.
+- Prefer return values over output parameters; inputs before outputs in parameter lists; keep functions short (~80 lines max).
+
+## Documentation
+
+- Document classes and functions with Doxygen JavaDoc-style comments, as in the existing code.
+- Comment tricky/non-obvious code with proper sentences, capitalization, and punctuation.

+ 23 - 0
.github/instructions/ff7-data-formats.instructions.md

@@ -0,0 +1,23 @@
+---
+description: "Use when working on FF7 binary format parsers, serializers, resource managers, LGP/LZS archives, the data installer, or the script decompiler. Covers the File/Serializer/Manager triplet pattern and known installer gotchas."
+applyTo: ["src/data/**", "src/installer/**", "test/data/**", "test/installer/**"]
+---
+
+# FF7 Data Formats and Installer
+
+## Parser Triplet Pattern
+
+Most formats in `src/data/` follow this structure — mirror it when adding formats:
+
+- `XFile` — plain data container for the parsed format.
+- `XFileSerializer` — reads/writes the binary layout (derives from `VGearsSerializer`).
+- `XFileManager` — Ogre `ResourceManager` integration (singleton + `Resource`).
+
+Format documentation lives in [doc/code/FFVII/](../../../doc/code/FFVII/). Check there and at existing similar parsers (e.g. `src/data/worldmap/TxzFile*`) before writing a new one.
+
+## Installer Gotchas (verified, don't regress)
+
+- World map HRC loads must create meshes via `HRCFile::GetMeshFileName()` (i.e. `NameLookup::model(splitBase(hrc_name)) + ".mesh"`). Do NOT use `FF7Data::GetWorldMapModelName()` — that friendly-name table can diverge from the actual Ogre mesh resource name and triggers `FileNotFoundException` (e.g. `barrier.mesh`).
+- `WorldInstaller::ExportMesh()` expects a directory prefix, not a full filename prefix.
+- The decompiler (`src/installer/decompiler/`) emits Lua — keep output close to [doc/STYLE-LUA.md](../../../doc/STYLE-LUA.md), but it is exempt from strict conformance.
+- The installer is Qt-based and handles copyrighted game data at runtime on the user's machine: never write code that copies extracted assets into the repo or build tree.

+ 27 - 0
.github/instructions/lua-style.instructions.md

@@ -0,0 +1,27 @@
+---
+description: "Use when writing or editing Lua scripts (.lua files). V-Gears Lua style: indentation, naming, locals, end terminators, doxygen comments."
+applyTo: "**/*.lua"
+---
+
+# V-Gears Lua Style Essentials
+
+Full guide: [doc/STYLE-LUA.md](../../doc/STYLE-LUA.md).
+
+- Indent with four spaces. Never use tabs.
+- Variables: short `snake_case` (`front_color`); larger scope → more descriptive names.
+- Functions and classes: `PascalCase`. Constants: `ALL_CAPS`. Module names: all `lowercase`.
+- Always use `local` for variables and functions; avoid globals.
+- Always close blocks with `end`; on long blocks, annotate the closing `end` with a comment (`end -- if`).
+- One space after `--` in comments.
+- Document every block of code with doxygen-style docstrings:
+
+```lua
+--[[
+ Retrieves a bit variable.
+ @param bank Memory bank (0-index, as in game).
+ @return 1 or 0
+]]
+```
+
+- Test for non-`nil` idiomatically: `if line then`, not `if line ~= nil then`.
+- Note: Lua generated by the installer's script decompiler follows these rules on a best-effort basis — do not hand-reformat large generated files.

+ 21 - 0
.github/instructions/tests.instructions.md

@@ -0,0 +1,21 @@
+---
+description: "Use when writing, adding, or fixing tests in the test/ directory. Covers Boost.Test conventions, registering test sources in test/CMakeLists.txt, and running the v-gears-tests suite."
+applyTo: "test/**"
+---
+
+# V-Gears Testing Conventions
+
+- Tests use Boost.Test with dynamic linking (`BOOST_TEST_DYN_LINK`); the suite builds as the `v-gears-tests` target and is registered with CTest.
+- Test files mirror the path of the code under test (`test/data/VGearsLGPArchive.cpp` tests `src/data/VGearsLGPArchive.cpp`). Follow this existing convention for placement.
+- Every new test source file must be added manually to `SOURCE_FILES` in [test/CMakeLists.txt](../../test/CMakeLists.txt) — there is no globbing.
+- RTTI (`dynamic_cast`, `typeid`) is allowed in tests even though production code avoids it.
+- Never use original game data in tests. Construct binary fixtures in-code (byte buffers, temp files) instead.
+
+## Running
+
+```bash
+cmake --build build --target v-gears-tests -j$(nproc)
+ctest --test-dir build --output-on-failure
+```
+
+The test binary can also be run directly from the build output directory to filter individual test cases.

+ 15 - 0
.github/prompts/build.prompt.md

@@ -0,0 +1,15 @@
+---
+description: "Configure and build V-Gears with CMake (engine, installer, or test suite)"
+agent: "agent"
+argument-hint: "Optional target or build type, e.g. 'v-gears-installer Release'"
+---
+
+Build the V-Gears project:
+
+1. If no `build/` directory or cache exists, configure first:
+   `cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug`
+   (Use the build type the user asked for, Debug by default. Never build in-tree.)
+2. Build with `cmake --build build -j$(nproc)`, optionally restricted to the requested target (`v-gears`, `v-gears-installer`, `v-gears-tests`).
+3. If compilation fails, read the full error output, fix the root cause following `doc/STYLE.md` and the scoped instructions (C++14 only), and rebuild.
+4. For dependency lookup problems, try `-DUSE_DETERMINISTIC_FALLBACKS=OFF` on a fresh configure to get clean diagnostics before changing any CMake code.
+5. Report the final build status and the location of the produced binaries.

+ 19 - 0
.github/prompts/new-data-format.prompt.md

@@ -0,0 +1,19 @@
+---
+description: "Scaffold a new FF7 data format parser (File/Serializer/Manager triplet) following project conventions"
+agent: "agent"
+argument-hint: "Format name and target directory, e.g. 'XYZ in src/data/worldmap'"
+---
+
+Scaffold a new FF7 binary format parser for the format named by the user:
+
+1. Research first:
+   - Check `doc/code/FFVII/` for documentation of the format.
+   - Read the most similar existing triplet in `src/data/` (e.g. `TxzFile.h/.cpp`, `TxzFileSerializer.h/.cpp`, `TxzFileManager.h/.cpp` in `src/data/worldmap/`) and mirror its structure, base classes, and Doxygen comment style exactly.
+2. Create the triplet in the requested directory:
+   - `XFile` — passive data container for the parsed format.
+   - `XFileSerializer` — binary read/write, deriving from the same serializer base as its neighbors.
+   - `XFileManager` — Ogre `ResourceManager` singleton integration, matching the existing pattern.
+3. Follow `doc/STYLE.md` strictly: C++14, `PascalCase` types, `snake_case` variables with trailing underscore for members, `#pragma once`, correct include order.
+4. Register the new sources in the appropriate `src/CMakeLists.txt` source list (no globbing — add them explicitly, in the same grouped style as neighboring entries).
+5. Do not add or reference original game data; document the binary layout from `doc/code/FFVII/` knowledge in the header comments instead.
+6. Build the affected target to verify it compiles.

+ 16 - 0
.github/prompts/test.prompt.md

@@ -0,0 +1,16 @@
+---
+description: "Build and run the v-gears-tests Boost.Test suite, then diagnose any failures"
+agent: "agent"
+argument-hint: "Optional: specific test case or area to focus on"
+---
+
+Build and run the V-Gears test suite:
+
+1. Build the test target: `cmake --build build --target v-gears-tests -j$(nproc)`
+   (configure `build/` first if it doesn't exist: `cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug`).
+2. Run the suite: `ctest --test-dir build --output-on-failure`.
+3. For each failure, read the failing test and the code under test, fix the root cause, and rerun.
+   - Tests use Boost.Test with dynamic linking.
+   - New test sources must be registered manually in `test/CMakeLists.txt`.
+   - Never use original game data in tests — build fixtures in code.
+4. Report pass/fail counts and summarize what was fixed.

+ 45 - 3
CMakeLists.txt

@@ -1,7 +1,7 @@
 # Minimum required CMake and project declaration
 cmake_minimum_required(VERSION 3.5)
 # Enable both C and CXX languages so C and C++ toolchains are configured.
-project(V-Gears VERSION 0.1.19 LANGUAGES C CXX)
+project(V-Gears VERSION 0.2.0 LANGUAGES C CXX)
 
 # Provide a central common include for project-wide policies and defaults.
 list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake")
@@ -47,15 +47,57 @@ if(NOT CMAKE_BUILD_TYPE)
     set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build" FORCE)
 endif()
 
-# First, build external libraries (luabind and luajit).
-add_subdirectory(lib)
+# LuaJIT is a system dependency; sol2 is header-only.
+find_package(PkgConfig QUIET)
+if(PKG_CONFIG_FOUND)
+    pkg_check_modules(LUAJIT QUIET luajit)
+endif()
+
+if(LUAJIT_FOUND)
+    set(VGEARS_LUAJIT_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIRS})
+    set(VGEARS_LUAJIT_LIBRARIES ${LUAJIT_LINK_LIBRARIES})
+else()
+    find_path(VGEARS_LUAJIT_INCLUDE_DIR
+        NAMES lua.hpp
+        PATH_SUFFIXES luajit-2.1 luajit-2.0 luajit-5.1
+    )
+    find_library(VGEARS_LUAJIT_LIBRARY
+        NAMES luajit-5.1 luajit-2.1 luajit
+    )
+    if(NOT VGEARS_LUAJIT_INCLUDE_DIR OR NOT VGEARS_LUAJIT_LIBRARY)
+        message(FATAL_ERROR
+            "LuaJIT development files were not found. Install libluajit-5.1-dev "
+            "or set VGEARS_LUAJIT_INCLUDE_DIR and VGEARS_LUAJIT_LIBRARY."
+        )
+    endif()
+    set(VGEARS_LUAJIT_INCLUDE_DIRS ${VGEARS_LUAJIT_INCLUDE_DIR})
+    set(VGEARS_LUAJIT_LIBRARIES ${VGEARS_LUAJIT_LIBRARY})
+endif()
 
 # Build v-gears (and, if requested, the installer).
 add_subdirectory(src)
 
 # If requested, build tests
 if(BUILD_TESTS)
+    enable_testing()
     add_subdirectory(test)
 endif()
 
+# Install Linux desktop integration assets for the installer so desktop shells
+# can map the running window to its icon.
+if(UNIX AND NOT APPLE AND BUILD_INSTALLER)
+    install(
+        FILES ${CMAKE_SOURCE_DIR}/v-gears-installer.desktop
+        DESTINATION share/applications
+    )
+    install(
+        FILES ${CMAKE_SOURCE_DIR}/v-gears-installer.png
+        DESTINATION share/icons/hicolor/256x256/apps
+    )
+    install(
+        FILES ${CMAKE_SOURCE_DIR}/v-gears-installer.png
+        DESTINATION share/pixmaps
+    )
+endif()
+
 # TODO: Generate Installer (.msi, .deb, .appImage...)

+ 15 - 7
data/data/config/config.cfg

@@ -2,17 +2,17 @@ set camera_speed 10.05
 camera_free true
 set_log_level 2
 set console_notification false
-set debug_fps false
-set debug_entity 1
+set debug_fps true
+set debug_entity 2
 set debug_trigger true
 set debug_walkmesh true
 set debug_script 1
-set debug_ui 2
+set debug_ui 0
 resolution 1024 768 0
 
 bind F11 "toggle timer_scale_game 0.0 1.0"
-bind NumAdd "increment timer_scale_game 0.0 1.0 0.1"
-bind NumSub "increment timer_scale_game 0.0 1.0 -0.1"
+bind NumAdd "increment timer_scale_game 0.0 4.0 0.5"
+bind NumSub "increment timer_scale_game 0.0 4.0 -0.5"
 
 bind LAlt+F4 "quit"
 bind RAlt+F4 "quit"
@@ -36,11 +36,19 @@ bind F12 "screenshot"
 
 set_language english
 
-bind_game_event Space "message_ok"
 bind_game_event Up "message_up"
 bind_game_event Down "message_down"
 
-bind_game_event Space "interact"
+bind_game_event Enter "CONFIRM"
+bind_game_event Space "CONFIRM"
+bind_game_event Escape "CANCEL"
+bind_game_event M "MENU"
+bind_game_event BackSpace "EXTRA"
+bind_game_event P "START"
+bind_game_event V "SELECT"
+bind_game_event PGDN "R1"
+bind_game_event PGUP "L1"
+
 bind_game_event LCtrl "run"
 bind_game_event Up "walk_up"
 bind_game_event Right "walk_right"

+ 4 - 0
data/data/screens/_screens.xml

@@ -20,6 +20,10 @@
     <!-- Battle UI -->
     <prototype file_name="screens/battle/prototypes.xml" />
     <screen file_name="screens/battle/battle.xml" />
+    <screen file_name="screens/battle/battle_fx.xml" />
+
+    <!-- Game over screen -->
+    <screen file_name="screens/game_over/game_over.xml" />
 
     <!-- Fade effect for map changer -->
     <screen file_name="screens/fade/fade.xml" />

+ 292 - 0
data/data/screens/battle/battle_fx.lua

@@ -0,0 +1,292 @@
+if UiContainer == nil then UiContainer = {} end
+
+--- Battle visual effects.
+--
+-- Simple generic effects: bursts of coloured particles by element, screen flashes and floating
+-- numbers. Everything is made with the sprites and text areas of the BattleFx screen, moved from
+-- here every frame. Positions of the scene are projected to the UI with camera_manager.
+UiContainer.BattleFx = {
+
+    --- Size of the pools of the screen. Must match battle_fx.xml.
+    PARTICLES = 60,
+    NUMBERS = 8,
+
+    --- Height, in scene units, above the position of a combatant where effects are shown.
+    BODY_HEIGHT = 1.6,
+
+    --- Effects of each element: colour, particle count, speed (UI units per second), gravity (UI
+    -- units per second squared, negative makes them rise), size, life (seconds) and the flash
+    -- (colour and strength) of the spells of the element. "converge" makes the particles come to
+    -- the center instead of leaving it.
+    ELEMENTS = {
+        [0] = {colour = {1, 0.55, 0.1}, count = 24, speed = 90, gravity = -140, size = 10, life = 0.9, flash = {1, 0.5, 0.1, 0.3}},
+        [1] = {colour = {0.6, 0.9, 1}, count = 18, speed = 110, gravity = 180, size = 8, life = 0.8, flash = {0.6, 0.9, 1, 0.3}},
+        [2] = {colour = {1, 1, 0.4}, count = 16, speed = 260, gravity = 0, size = 6, life = 0.35, flash = {1, 1, 0.6, 0.55}},
+        [3] = {colour = {0.65, 0.45, 0.25}, count = 18, speed = 140, gravity = 320, size = 9, life = 0.9, up = true},
+        [4] = {colour = {0.5, 0.9, 0.3}, count = 16, speed = 50, gravity = -70, size = 9, life = 1.1, flash = {0.5, 0.9, 0.3, 0.2}},
+        [5] = {colour = {0.6, 0.3, 0.9}, count = 20, speed = 120, gravity = 0, size = 8, life = 0.8, converge = true, flash = {0.3, 0.1, 0.5, 0.35}},
+        [6] = {colour = {0.3, 0.6, 1}, count = 20, speed = 90, gravity = 240, size = 8, life = 0.9, flash = {0.3, 0.6, 1, 0.25}},
+        [7] = {colour = {0.8, 1, 0.9}, count = 16, speed = 240, gravity = 0, size = 5, life = 0.5, flash = {0.8, 1, 0.9, 0.2}},
+        [8] = {colour = {1, 1, 0.85}, count = 22, speed = 70, gravity = -100, size = 9, life = 1.0, flash = {1, 1, 0.9, 0.45}},
+    },
+
+    --- Effect of healing.
+    HEAL = {colour = {0.4, 1, 0.55}, count = 16, speed = 45, gravity = -80, size = 9, life = 1.0, flash = {0.4, 1, 0.55, 0.2}},
+
+    --- Effect of attacks without an element.
+    PHYSICAL = {colour = {1, 1, 1}, count = 9, speed = 150, gravity = 260, size = 6, life = 0.35},
+
+    --- Colours of the floating numbers.
+    COLOUR_DAMAGE = {1, 1, 1},
+    COLOUR_HEAL = {0.4, 1, 0.5},
+    COLOUR_MP = {0.5, 0.7, 1},
+    COLOUR_MISS = {0.7, 0.7, 0.7},
+
+    --- Active particles and numbers.
+    particles = {},
+    numbers = {},
+
+    --- Active screen flash.
+    flash_state = nil,
+
+    --- Game time of the last update.
+    last_time = 0,
+
+    --- Shows the effects screen and clears everything.
+    show = function(self)
+        self:clear()
+        self.last_time = timer:get_game_time_total()
+        ui_manager:get_widget("BattleFx"):set_visible(true)
+    end,
+
+    --- Hides the effects screen.
+    hide = function(self)
+        self:clear()
+        ui_manager:get_widget("BattleFx"):set_visible(false)
+    end,
+
+    --- Removes every effect.
+    clear = function(self)
+        for _, particle in pairs(self.particles) do ui_manager:get_widget("BattleFx.P" .. tostring(particle.index)):set_visible(false) end
+        for _, number in pairs(self.numbers) do ui_manager:get_widget("BattleFx.N" .. tostring(number.index)):set_visible(false) end
+        ui_manager:get_widget("BattleFx.Flash"):set_visible(false)
+        self.particles = {}
+        self.numbers = {}
+        self.flash_state = nil
+    end,
+
+    --- Gets the position of a combatant in the UI.
+    --
+    -- @param side Battle.TargetGroup.PARTY or ENEMIES.
+    -- @param index Index of the combatant.
+    -- @param height Height above the combatant, in scene units.
+    -- @return X and Y in UI units, nil if the combatant has no entity.
+    get_position = function(self, side, index, height)
+        local entity = UiContainer.BattleUi:get_entity(side, index)
+        if entity == nil then return nil end
+        local x, y, z = entity:get_position()
+        local ux, uy = camera_manager:project_to_ui(x, y, z + height)
+        return ux, uy
+    end,
+
+    --- Finds a free particle of the pool.
+    free_particle = function(self)
+        for i = 1, self.PARTICLES do
+            if self.particles[i] == nil then return i end
+        end
+        return nil
+    end,
+
+    --- Creates a particle.
+    --
+    -- @param p Table with x, y, vx, vy (per second), gravity, life, size, colour and alpha.
+    spawn = function(self, p)
+        local i = self:free_particle()
+        if i == nil then do return end end
+        p.index = i
+        p.age = 0
+        self.particles[i] = p
+        local widget = ui_manager:get_widget("BattleFx.P" .. tostring(i))
+        widget:set_colour(p.colour[1], p.colour[2], p.colour[3])
+        widget:set_alpha(p.alpha or 1)
+        widget:set_width(0, p.size)
+        widget:set_height(0, p.size)
+        widget:set_x(0, p.x - p.size / 2)
+        widget:set_y(0, p.y - p.size / 2)
+        widget:set_visible(true)
+    end,
+
+    --- Creates a burst of particles from a preset around a position.
+    burst = function(self, preset, x, y)
+        for _ = 1, preset.count do
+            local angle = math.random() * 2 * math.pi
+            local speed = preset.speed * (0.4 + 0.6 * math.random())
+            local vx, vy = math.cos(angle) * speed, math.sin(angle) * speed
+            local px, py = x, y
+            if preset.converge then
+                -- Start on a ring and move to the center.
+                px, py = x - vx * 0.5, y - vy * 0.5
+                vx, vy = vx, vy
+            end
+            if preset.up then vy = -math.abs(vy) * 1.3 end
+            -- Slightly different tones.
+            local shade = 0.8 + 0.2 * math.random()
+            self:spawn({
+                x = px, y = py, vx = vx, vy = vy, gravity = preset.gravity,
+                life = preset.life * (0.7 + 0.5 * math.random()), size = preset.size * (0.6 + 0.6 * math.random()),
+                colour = {preset.colour[1] * shade, preset.colour[2] * shade, preset.colour[3] * shade},
+            })
+        end
+    end,
+
+    --- Shows a screen flash that fades out.
+    --
+    -- @param colour Table with r, g, b.
+    -- @param strength Starting alpha.
+    -- @param life Seconds it lasts.
+    flash = function(self, colour, strength, life)
+        self.flash_state = {colour = colour, strength = strength, life = life or 0.35, age = 0}
+        local widget = ui_manager:get_widget("BattleFx.Flash")
+        widget:set_colour(colour[1], colour[2], colour[3])
+        widget:set_alpha(strength)
+        widget:set_visible(true)
+    end,
+
+    --- Gets the effect preset of an attack, for the element it has or if it heals.
+    get_preset = function(self, attack, heals)
+        if heals then return self.HEAL end
+        if attack ~= nil and attack.elements ~= nil and #attack.elements > 0 then
+            return self.ELEMENTS[attack.elements[1]] or self.PHYSICAL
+        end
+        return self.PHYSICAL
+    end,
+
+    --- Effect of casting a spell: sparks around the caster.
+    cast = function(self, attack, side, index)
+        -- Only magic is cast. Other attacks just hit.
+        if attack == nil or attack.id == nil or attack.id < 0 or (attack.damage.formula or 0) ~= 2 then do return end end
+        local x, y = self:get_position(side, index, self.BODY_HEIGHT)
+        if x == nil then do return end end
+        local preset = self:get_preset(attack, (attack.damage.modifier or 0) == 5 and (attack.damage.formula or 0) == 2)
+        for _ = 1, 8 do
+            local angle = math.random() * 2 * math.pi
+            self:spawn({
+                x = x + math.cos(angle) * 30, y = y + math.sin(angle) * 30,
+                vx = -math.cos(angle) * 40, vy = -math.sin(angle) * 40 - 30, gravity = 0,
+                life = 0.8, size = 7, colour = preset.colour,
+            })
+        end
+    end,
+
+    --- Effect of an attack that hits a target: particles and, for spells, a screen flash.
+    --
+    -- @param attack Attack data.
+    -- @param result The result of the attack, as in BattleUi.calculate_attack.
+    hit = function(self, attack, side, index, result)
+        local x, y = self:get_position(side, index, self.BODY_HEIGHT)
+        if x == nil then do return end end
+        local preset = self:get_preset(attack, result.amount < 0)
+        self:burst(preset, x, y)
+        if preset.flash ~= nil and attack.id ~= nil and attack.id >= 0 then
+            self:flash({preset.flash[1], preset.flash[2], preset.flash[3]}, preset.flash[4], 0.4)
+        end
+    end,
+
+    --- Shows a floating text over a combatant.
+    --
+    -- @param text The text to show.
+    -- @param colour Table with r, g, b.
+    text = function(self, side, index, text, colour)
+        local x, y = self:get_position(side, index, self.BODY_HEIGHT + 0.6)
+        if x == nil then do return end end
+        local slot = nil
+        for i = 1, self.NUMBERS do
+            if self.numbers[i] == nil then slot = i break end
+        end
+        -- If all are used, take the one that has been there the longest.
+        if slot == nil then
+            local oldest = 1
+            for i = 2, self.NUMBERS do
+                if self.numbers[i].age > self.numbers[oldest].age then oldest = i end
+            end
+            slot = oldest
+        end
+        -- Spread the numbers of the same target a bit so they don't pile up.
+        self.numbers[slot] = {
+            index = slot, x = x + (math.random() - 0.5) * 40 - 7 * #text / 2, y = y - 10 * math.random(),
+            age = 0, life = 1.1, text = text, colour = colour,
+        }
+        local number = self.numbers[slot]
+        local widget = ui_manager:get_widget("BattleFx.N" .. tostring(slot))
+        -- The colour is applied when the text is set.
+        widget:set_colour(colour[1], colour[2], colour[3])
+        widget:set_alpha(1)
+        widget:set_text(text)
+        widget:set_x(0, number.x)
+        widget:set_y(0, number.y)
+        widget:set_visible(true)
+    end,
+
+    --- Shows the HP or MP lost or recovered by a combatant.
+    --
+    -- @param amount Positive for damage, negative for recovery.
+    -- @param mp True if it's MP.
+    number = function(self, side, index, amount, mp)
+        local colour = self.COLOUR_DAMAGE
+        if amount < 0 then colour = self.COLOUR_HEAL end
+        if mp then colour = self.COLOUR_MP end
+        self:text(side, index, tostring(math.abs(amount)), colour)
+    end,
+
+    --- Advances the effects.
+    --
+    -- @param now Game time.
+    update = function(self, now)
+        local dt = math.max(0, math.min(0.1, now - self.last_time))
+        self.last_time = now
+        for i, p in pairs(self.particles) do
+            p.age = p.age + dt
+            local widget = ui_manager:get_widget("BattleFx.P" .. tostring(i))
+            if p.age >= p.life then
+                widget:set_visible(false)
+                self.particles[i] = nil
+            else
+                p.x = p.x + p.vx * dt
+                p.y = p.y + p.vy * dt
+                p.vy = p.vy + p.gravity * dt
+                local fade = 1 - p.age / p.life
+                widget:set_alpha((p.alpha or 1) * fade)
+                widget:set_x(0, p.x - p.size / 2)
+                widget:set_y(0, p.y - p.size / 2)
+            end
+        end
+        for i, n in pairs(self.numbers) do
+            n.age = n.age + dt
+            local widget = ui_manager:get_widget("BattleFx.N" .. tostring(i))
+            if n.age >= n.life then
+                widget:set_visible(false)
+                self.numbers[i] = nil
+            else
+                -- Rise, and fade out in the last part. Text colour is baked when it's set, so the
+                -- text is set again with the new alpha.
+                local alpha = math.min(1, (n.life - n.age) / (n.life * 0.4))
+                widget:set_colour(n.colour[1], n.colour[2], n.colour[3])
+                widget:set_alpha(alpha)
+                widget:set_text(n.text)
+                widget:set_x(0, n.x)
+                widget:set_y(0, n.y - 45 * (n.age / n.life))
+            end
+        end
+        local f = self.flash_state
+        if f ~= nil then
+            f.age = f.age + dt
+            local widget = ui_manager:get_widget("BattleFx.Flash")
+            if f.age >= f.life then
+                widget:set_visible(false)
+                self.flash_state = nil
+            else
+                widget:set_alpha(f.strength * (1 - f.age / f.life))
+            end
+        end
+    end,
+}

+ 72 - 0
data/data/screens/battle/battle_fx.xml

@@ -0,0 +1,72 @@
+<screen name="BattleFx" script="screens/battle/battle_fx.lua" visible="false">
+    <!-- Battle visual effects: a screen flash, a pool of particles and a pool of floating numbers. -->
+    <sprite name="Flash" x="0" y="0" width="100%" height="100%" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P1" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P2" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P3" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P4" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P5" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P6" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P7" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P8" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P9" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P10" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P11" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P12" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P13" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P14" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P15" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P16" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P17" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P18" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P19" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P20" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P21" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P22" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P23" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P24" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P25" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P26" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P27" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P28" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P29" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P30" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P31" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P32" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P33" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P34" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P35" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P36" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P37" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P38" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P39" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P40" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P41" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P42" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P43" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P44" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P45" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P46" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P47" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P48" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P49" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P50" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P51" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P52" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P53" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P54" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P55" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P56" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P57" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P58" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P59" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <sprite name="P60" x="0" y="0" width="8" height="8" colour="1 1 1" alpha="0" visible="false" />
+    <text_area name="N1" x="0" y="0" scale="1.4 1.4" font="FFVIIFont" visible="false" />
+    <text_area name="N2" x="0" y="0" scale="1.4 1.4" font="FFVIIFont" visible="false" />
+    <text_area name="N3" x="0" y="0" scale="1.4 1.4" font="FFVIIFont" visible="false" />
+    <text_area name="N4" x="0" y="0" scale="1.4 1.4" font="FFVIIFont" visible="false" />
+    <text_area name="N5" x="0" y="0" scale="1.4 1.4" font="FFVIIFont" visible="false" />
+    <text_area name="N6" x="0" y="0" scale="1.4 1.4" font="FFVIIFont" visible="false" />
+    <text_area name="N7" x="0" y="0" scale="1.4 1.4" font="FFVIIFont" visible="false" />
+    <text_area name="N8" x="0" y="0" scale="1.4 1.4" font="FFVIIFont" visible="false" />
+</screen>

+ 20 - 0
data/data/screens/fade/fade.lua

@@ -13,6 +13,26 @@ UiContainer.Fade = {
 
 
 
+    --- Transition from the field or the world map to the battle in Battle.pending_id.
+    --
+    -- The screen flashes white and the battle starts under the flash, which BattleUi.show reveals.
+    battle_transition = function( self )
+        -- The player can't move during the transition. It's unlocked when the battle ends, unless
+        -- the player was already locked.
+        Battle.locked_by_transition = not entity_manager:is_player_locked()
+        player_lock( true )
+        local fade = ui_manager:get_widget( "Fade.Screen" )
+        fade:set_colour( 1, 1, 1 )
+        fade:play_animation_stop( "BattleFlash" )
+        fade:animation_sync()
+        battle_manager:start_battle( Battle.pending_id )
+        -- The battle takes over the screen, so the cover of the field goes away.
+        fade:set_alpha( 0 )
+        fade:set_colour( 0, 0, 0 )
+        UiContainer.BattleUi.show( UiContainer.BattleUi )
+        return 0
+    end,
+
     fade_out = function( self )
         local fade = ui_manager:get_widget( "Fade.Screen" )
         fade:play_animation_stop( "FadeOut" )

+ 2 - 0
data/data/screens/fade/fade.xml

@@ -2,5 +2,7 @@
     <sprite name="Screen" x="0" y="0" width="100%" height="100%" colour="" alpha="0" visible="true">
         <animation name="FadeIn" length="1" alpha="0:1, 1:0" />
         <animation name="FadeOut" length="1" alpha="0:0, 1:1" />
+        <!-- Battle transition: the screen flashes white a few times. -->
+        <animation name="BattleFlash" length="0.9" alpha="0:0, 0.1:1, 0.2:0.15, 0.3:1, 0.4:0.15, 0.5:1, 0.9:1" />
     </sprite>
 </screen>

+ 64 - 0
data/data/screens/game_over/game_over.lua

@@ -0,0 +1,64 @@
+if UiContainer == nil then UiContainer = {} end
+
+--- The game over screen.
+--
+-- Shown when the whole party dies in battle. It fades to black, plays the game over music, and
+-- when the player confirms, goes back to the begin menu.
+UiContainer.GameOver = {
+
+    --- Music to play. Name as in the musics file (57 is the game over music of the original game).
+    MUSIC = "57",
+
+    --- Indicates that the screen is being shown.
+    active = false,
+
+    --- Indicates that the screen is fully shown and can be dismissed.
+    ready = false,
+
+    --- Shows the game over screen.
+    show = function(self)
+        self.active = true
+        self.ready = false
+        UiContainer.current_menu = "game_over"
+        ui_manager:get_widget("GameOver.Container.Text"):set_visible(false)
+        ui_manager:get_widget("GameOver"):set_visible(true)
+        audio_manager:play_music(self.MUSIC)
+        local background = ui_manager:get_widget("GameOver.Background")
+        background:play_animation_stop("FadeIn")
+        background:animation_sync()
+        ui_manager:get_widget("GameOver.Container.Text"):set_visible(true)
+        self.ready = true
+        return 0
+    end,
+
+    --- Handles button events.
+    --
+    -- Confirming, once the screen is shown, leaves it.
+    on_button = function(self, button, event)
+        if self.active == false or self.ready == false then do return 0 end end
+        if button == Config.ACTIONS.CONFIRM then self:leave() end
+        return 0
+    end,
+
+    --- Leaves the game over screen and goes back to the begin menu.
+    --
+    -- TODO: Reload the last save, as the original game does. For now the party is healed, so the
+    -- debug battles of the begin menu can be started again.
+    leave = function(self)
+        self.active = false
+        self.ready = false
+        ui_manager:get_widget("GameOver.Container.Text"):set_visible(false)
+        ui_manager:get_widget("GameOver"):set_visible(false)
+        for i = 1, Party.MAX do
+            if Party[i] ~= nil then
+                local stats = Characters[Party[i]].stats
+                stats.hp.current = stats.hp.max or stats.hp.base
+            end
+        end
+        Battle.finish()
+        MenuSettings.pause_available = false
+        UiContainer.current_menu = ""
+        script:request_end_sync(Script.UI, "BeginMenu", "show", 0)
+        return 0
+    end,
+}

+ 9 - 0
data/data/screens/game_over/game_over.xml

@@ -0,0 +1,9 @@
+<screen name="GameOver" script="screens/game_over/game_over.lua" visible="false">
+    <!-- Black background, fades in over the battle. -->
+    <sprite name="Background" x="0" y="0" width="100%" height="100%" colour="0 0 0" alpha="0" visible="true">
+        <animation name="FadeIn" length="1.5" alpha="0:0, 1.5:1" />
+    </sprite>
+    <widget name="Container" width="368" height="240" origin_x="50%" origin_y="50%" align="center" valign="middle" scale="2.61 3" visible="true">
+        <text_area name="Text" x="148" y="110" text_name="GameOverText" font="FFVIIFont" visible="false" />
+    </widget>
+</screen>

+ 4 - 0
data/data/scripts/_scripts.xml

@@ -21,11 +21,15 @@
     <script file="gamedata/initial_savemap.lua" />
 
     <script file="scripts/field.lua" />
+    <script file="scripts/worldmap/triangle_triggers.lua" />
+    <script file="scripts/worldmap/vehicles.lua" />
     <script file="scripts/battle_ai.lua" />
+    <script file="scripts/battle/battle_ai_vm.lua" />
     <script file="scripts/menu/menu_helpers.lua" />
 
     <!-- TODO: Debugging pourposes only -->
     <script file="scripts/debug_data.lua" />
 
     <system_script name="MapChanger" />
+    <system_script name="WorldMap" />
 </scripts>

+ 65 - 3
data/data/scripts/battle.lua

@@ -170,19 +170,72 @@ Battle.logic_script = {
     end,
 }
 
+--- Flags set by the field opcode BTLMD (battle_manager:set_mode).
+Battle.Mode = {
+    NO_RESULTS = 0x80,
+    ARENA = 0x40,
+    NO_VICTORY_MUSIC = 0x20,
+    NO_ESCAPE = 0x08,
+    PREEMPTIVE = 0x04,
+    TIMED = 0x02,
+    NO_GAME_OVER = 0x100,
+}
+
+--- Checks if a BTLMD flag is set for the current battle.
+Battle.has_mode = function(flag)
+    return math.floor(battle_manager:get_mode() / flag) % 2 == 1
+end
+
 --- Starts a battle.
 --
 -- @param id Battle ID.
 Battle.start = function(id)
-    battle_manager:start_battle(id)
-    script:request_end_sync(Script.UI, "BattleUi", "show", 0)
+    Battle.pending_id = id
+    script:request_end_sync(Script.UI, "Fade", "battle_transition", 0)
     return 0
 end
 
+--- Starts a battle right away, with no transition. It can be called from the battle tick, so it
+-- doesn't yield. Used for battles that follow another battle.
+--
+-- @param id Battle ID.
+Battle.chain = function(id)
+    battle_manager:start_battle(id)
+    script:request(Script.UI, "BattleUi", "show", 0)
+end
+
+--- Random encounters.
+Encounter = {
+
+    --- Indicates that the current battle is a random encounter.
+    active = false,
+}
+
+--- Starts a random encounter.
+--
+-- Called by the engine when the player walks into one. It isn't a script, so it can't yield.
+-- @param id Battle ID.
+Encounter.start = function(id)
+    -- The player can't walk during the battle.
+    player_lock(true)
+    Encounter.active = true
+    Battle.pending_id = id
+    script:request(Script.UI, "Fade", "battle_transition", 0)
+end
+
 --- Ends a battle.
 Battle.finish = function()
     battle_manager:end_battle()
-    script:request_end_sync(Script.UI, "BattleUi", "hide", 0)
+    -- Random encounters give control back to the player.
+    if Encounter.active then
+        Encounter.active = false
+        player_lock(false)
+    elseif Battle.locked_by_transition then
+        player_lock(false)
+    end
+    Battle.locked_by_transition = false
+    -- Not "request_end_sync": this can be called from the battle tick, which can't yield.
+    script:request(Script.UI, "BattleUi", "hide", 0)
     return 0
 end
 
@@ -446,3 +499,12 @@ Battle.add_random_modifier_and_zero_check = function( damage )
 
     return random_damage
 end
+
+--- Opcodes of the world map scripts that deal with battles.
+SetBattleLock = function(locked)
+    world_map_module:set_encounters_locked(locked ~= 0)
+end
+
+TriggerBattle = function(id)
+    Encounter.start(id)
+end

+ 471 - 0
data/data/scripts/battle/battle_ai_vm.lua

@@ -0,0 +1,471 @@
+--- Interpreter of the enemy AI scripts of the original game.
+--
+-- The scripts are bytecode for a stack machine (see the opcode list below). Memory is addressed by
+-- bit: addresses below 0x2000 are variables of the actor that owns the script, 0x2000 to 0x3FFF
+-- are values of the battle shared by every actor and 0x4000 to 0x433F are values of each actor
+-- (HP, MP, level, statuses...), selected with an actor mask.
+--
+-- The interpreter doesn't know about the battle: it asks a host for every global and actor value,
+-- and notifies it of actions and texts. The host must have the functions:
+--
+--   host:read_global(address, size)         Value of a global address.
+--   host:write_global(address, size, value)
+--   host:read_actor(actor, field, size)     Value of an actor field (address minus 0x4000).
+--   host:write_actor(actor, field, size, value)
+--   host:action(owner, type, id)             An action was requested, see BattleAI.ACTION. The targets
+--                                            are the last value written to the global 0x2070.
+--   host.owner                               Actor running the script (set by the interpreter).
+--   host:text(owner, bytes)                 A text has to be shown (FF7 encoded text).
+--   host:mp_cost(id)                        MP cost of an attack.
+--   host:memory_bank(write, offset, value)  Access to the game memory banks (1 and 2).
+--
+-- Value sizes are 0 (bit), 1 (byte), 2 (word) and 3 (dword).
+
+BattleAI = {}
+
+--- Types of actions requested with the action opcode.
+BattleAI.ACTION = {
+    ENEMY_ATTACK = 0x20,
+    RUN_SCRIPT = 0x22,
+    SHOW_TEXT = 0x24,
+}
+
+--- Slots of the scripts of an enemy.
+BattleAI.SLOT = {
+    INIT = 0, MAIN = 1, COUNTER_GENERAL = 2, COUNTER_DEATH = 3, COUNTER_PHYSICAL = 4,
+    COUNTER_MAGIC = 5, BATTLE_END = 6, PRE_TURN = 7, EVENT_1 = 8,
+}
+
+--- Bytes used to store each value size.
+BattleAI.SIZE_BYTES = {[0] = 1, 1, 2, 4}
+
+--- Maximum number of instructions in a script run, to stop endless loops.
+BattleAI.MAX_STEPS = 20000
+
+--- Persistent variables (addresses 0x0000 to 0x03FF) of every actor, by actor index. They keep
+-- their values between scripts.
+BattleAI.variables = {}
+
+--- Clears the persistent variables, at the beginning of a battle.
+function BattleAI.reset()
+    BattleAI.variables = {}
+end
+
+--- Gets the table of bytes with the variables of an actor.
+local function variables_of(actor)
+    local vars = BattleAI.variables[actor]
+    if vars == nil then
+        vars = {}
+        BattleAI.variables[actor] = vars
+    end
+    return vars
+end
+
+--- Reads a value of memory with the byte array of the variables of an actor.
+local function read_bytes(bytes, address, size)
+    local byte_index = math.floor(address / 8)
+    if size == 0 then
+        return math.floor((bytes[byte_index] or 0) / 2 ^ (address % 8)) % 2
+    end
+    local value = 0
+    for i = BattleAI.SIZE_BYTES[size] - 1, 0, -1 do
+        value = value * 256 + (bytes[byte_index + i] or 0)
+    end
+    return value
+end
+
+--- Writes a value to the byte array of the variables of an actor.
+local function write_bytes(bytes, address, size, value)
+    local byte_index = math.floor(address / 8)
+    if size == 0 then
+        local bit = 2 ^ (address % 8)
+        local current = bytes[byte_index] or 0
+        local has = math.floor(current / bit) % 2
+        if (value ~= 0) and has == 0 then current = current + bit
+        elseif (value == 0) and has == 1 then current = current - bit
+        end
+        bytes[byte_index] = current
+        return
+    end
+    value = math.floor(value)
+    if value < 0 then value = value + 2 ^ 32 end
+    for i = 0, BattleAI.SIZE_BYTES[size] - 1 do
+        bytes[byte_index + i] = value % 256
+        value = math.floor(value / 256)
+    end
+end
+
+--- Counts the actors of a mask in order, calling a function with their indexes.
+local function each_actor(mask, fn)
+    mask = math.floor(mask)
+    for actor = 0, 31 do
+        if math.floor(mask / 2 ^ actor) % 2 == 1 then fn(actor) end
+    end
+end
+
+--- Bitwise operations on non negative integers (Lua 5.1 has none).
+local function band(a, b)
+    local result, bit = 0, 1
+    a, b = math.floor(a), math.floor(b)
+    while a > 0 and b > 0 do
+        if a % 2 == 1 and b % 2 == 1 then result = result + bit end
+        a, b, bit = math.floor(a / 2), math.floor(b / 2), bit * 2
+    end
+    return result
+end
+
+local function bor(a, b)
+    local result, bit = 0, 1
+    a, b = math.floor(a), math.floor(b)
+    while a > 0 or b > 0 do
+        if a % 2 == 1 or b % 2 == 1 then result = result + bit end
+        a, b, bit = math.floor(a / 2), math.floor(b / 2), bit * 2
+    end
+    return result
+end
+
+local function bnot(a, bits)
+    return 2 ^ bits - 1 - math.floor(a)
+end
+
+BattleAI.band = band
+BattleAI.bor = bor
+
+--- The context of a script run: the owner, the host and the stack.
+local Context = {}
+Context.__index = Context
+
+--- Reads the value of a memory address for an owner or an actor.
+--
+-- @param actor Actor whose actor fields or variables are read.
+function Context:read(address, size, actor)
+    if address < 0x2000 then
+        return read_bytes(variables_of(actor), address, size)
+    elseif address < 0x4000 then
+        return self.host:read_global(address, size)
+    end
+    return self.host:read_actor(actor, address - 0x4000, size)
+end
+
+--- Writes a value to a memory address, of an actor or its variables.
+function Context:write(address, size, value, actor)
+    if address < 0x2000 then
+        write_bytes(variables_of(actor), address, size, value)
+    elseif address < 0x4000 then
+        self.host:write_global(address, size, value)
+    else
+        self.host:write_actor(actor, address - 0x4000, size, value)
+    end
+end
+
+--- Gets the number a stack entry stands for.
+--
+-- Addresses give their value, and entries that stand for several actors the value of the first.
+function Context:value_of(entry)
+    if entry.kind == "value" then return entry.v end
+    if entry.kind == "address" then
+        if entry.mask ~= nil then return self:first_value(entry) end
+        return self:read(entry.address, entry.size, self.owner)
+    end
+    return self:first_value(entry)
+end
+
+--- Gets the value of the first actor of a masked entry.
+function Context:first_value(entry)
+    local result = 0
+    for actor = 0, 31 do
+        if math.floor(entry.mask / 2 ^ actor) % 2 == 1 then
+            return self:read(entry.address, entry.size, actor)
+        end
+    end
+    return result
+end
+
+--- Pushes a value.
+function Context:push(entry)
+    self.top = self.top + 1
+    self.stack[self.top] = entry
+end
+
+--- Pops an entry from the stack.
+function Context:pop()
+    local entry = self.stack[self.top]
+    if entry == nil then error("AI script: the stack is empty") end
+    self.stack[self.top] = nil
+    self.top = self.top - 1
+    return entry
+end
+
+--- Pushes a plain number.
+function Context:push_value(size, value)
+    self:push({kind = "value", size = size, v = value})
+end
+
+--- Gets the actor mask an entry stands for (values are masks, addresses give their value).
+function Context:mask_of(entry)
+    return math.floor(self:value_of(entry))
+end
+
+--- Compares two entries with an operator, for the comparison opcodes.
+--
+-- If one of them has an actor mask, the result is the mask of the actors that pass the comparison.
+-- Otherwise it's 1 or 0.
+local function compare(op, a, b)
+    if op == 0x40 then return a == b
+    elseif op == 0x41 then return a ~= b
+    elseif op == 0x42 then return a >= b
+    elseif op == 0x43 then return a <= b
+    elseif op == 0x44 then return a > b
+    elseif op == 0x45 then return a < b
+    end
+    return false
+end
+
+function Context:compare(op, second, first)
+    -- "first" is the first pop (the right operand), "second" the second pop.
+    local left_masked = second.mask ~= nil and (second.kind == "multi" or second.kind == "address")
+    local right_masked = first.mask ~= nil and (first.kind == "multi" or first.kind == "address")
+    if not left_masked and not right_masked then
+        return {kind = "value", size = 0, v = compare(op, self:value_of(second), self:value_of(first)) and 1 or 0}
+    end
+    local mask = left_masked and second.mask or first.mask
+    if left_masked and right_masked then mask = band(second.mask, first.mask) end
+    local passed = 0
+    each_actor(mask, function(actor)
+        local a = left_masked and self:read(second.address, second.size, actor) or self:value_of(second)
+        local b = right_masked and self:read(first.address, first.size, actor) or self:value_of(first)
+        if compare(op, a, b) then passed = passed + 2 ^ actor end
+    end)
+    return {kind = "value", size = 2, v = passed}
+end
+
+--- Runs a script.
+--
+-- @param code The bytecode, as a string.
+-- @param owner Index of the actor that owns the script.
+-- @param host The host of the interpreter.
+-- @return True if it finished, false if it was stopped (error or too many instructions).
+function BattleAI.run(code, owner, host)
+    -- The host needs to know who is running the script to answer about "self".
+    host.owner = owner
+    local ctx = setmetatable({owner = owner, host = host, stack = {}, top = 0}, Context)
+    local pc = 0
+    local steps = 0
+    local length = #code
+    local function byte(i) return code:byte(i + 1) end
+    local function word(i) return byte(i) + byte(i + 1) * 256 end
+    while pc < length do
+        steps = steps + 1
+        if steps > BattleAI.MAX_STEPS then return false, "too many instructions" end
+        local op = byte(pc)
+        local hi, lo = math.floor(op / 16), op % 16
+        if hi == 0 and lo <= 3 then
+            -- Push the value at an address. Actor fields remember their address, so they can be
+            -- masked with actors later.
+            local address = word(pc + 1)
+            ctx:push({kind = "value", size = lo, v = ctx:read(address, lo, owner), address = address})
+            pc = pc + 3
+        elseif hi == 1 and lo <= 3 then
+            ctx:push({kind = "address", size = lo, address = word(pc + 1)})
+            pc = pc + 3
+        elseif op >= 0x60 and op <= 0x62 then
+            local size = op - 0x5F
+            local value = 0
+            for i = size - 1, 0, -1 do value = value * 256 + byte(pc + 1 + i) end
+            ctx:push_value(size, value)
+            pc = pc + 1 + size
+        elseif op >= 0x30 and op <= 0x37 then
+            if op == 0x37 then
+                local a = ctx:pop()
+                ctx:push_value(2, bnot(ctx:value_of(a), 16))
+            else
+                local b = ctx:pop()
+                local a = ctx:pop()
+                local x, y = ctx:value_of(a), ctx:value_of(b)
+                local r
+                if op == 0x30 then r = x + y
+                elseif op == 0x31 then r = x - y
+                elseif op == 0x32 then r = x * y
+                elseif op == 0x33 then r = y ~= 0 and math.floor(x / y) or 0
+                elseif op == 0x34 then r = y ~= 0 and x % y or 0
+                elseif op == 0x35 then r = band(x, y)
+                else r = bor(x, y)
+                end
+                ctx:push_value(math.max(a.size or 2, b.size or 2, 2), r)
+            end
+            pc = pc + 1
+        elseif op >= 0x40 and op <= 0x45 then
+            local first = ctx:pop()
+            local second = ctx:pop()
+            ctx:push(ctx:compare(op, second, first))
+            pc = pc + 1
+        elseif op >= 0x50 and op <= 0x52 then
+            if op == 0x52 then
+                local a = ctx:pop()
+                ctx:push_value(0, ctx:value_of(a) == 0 and 1 or 0)
+            else
+                local b = ctx:pop()
+                local a = ctx:pop()
+                local x, y = ctx:value_of(a) ~= 0, ctx:value_of(b) ~= 0
+                local r
+                if op == 0x50 then r = x and y else r = x or y end
+                ctx:push_value(0, r and 1 or 0)
+            end
+            pc = pc + 1
+        elseif op == 0x70 then
+            -- Jump if the value is zero.
+            local a = ctx:pop()
+            if ctx:value_of(a) == 0 then pc = word(pc + 1) else pc = pc + 3 end
+        elseif op == 0x71 then
+            -- Jump if the value is different from the top of the stack (switch cases).
+            local a = ctx:pop()
+            local top = ctx.stack[ctx.top]
+            if top == nil or ctx:value_of(a) ~= ctx:value_of(top) then pc = word(pc + 1) else pc = pc + 3 end
+        elseif op == 0x72 then
+            pc = word(pc + 1)
+        elseif op == 0x73 then
+            return true
+        elseif op == 0x74 or op == 0x75 then
+            ctx:pop()
+            pc = pc + 1
+        elseif op >= 0x80 and op <= 0x87 then
+            if op == 0x80 then
+                -- The first pop is masked by the second: an address or a value of an actor field
+                -- is for those actors, two plain values are ANDed.
+                local first = ctx:pop()
+                local second = ctx:pop()
+                local mask = ctx:mask_of(second)
+                if first.kind == "address" then
+                    ctx:push({kind = "address", size = first.size, address = first.address, mask = mask})
+                elseif first.address ~= nil and (first.address >= 0x4000 or first.address < 0x2000) then
+                    ctx:push({kind = "multi", size = first.size, address = first.address, mask = mask})
+                else
+                    ctx:push_value(math.max(first.size or 2, 2), band(ctx:value_of(first), mask))
+                end
+            elseif op == 0x81 then
+                ctx:push_value(2, host:random(65536))
+            elseif op == 0x82 then
+                -- A random one of the bits that are on.
+                local mask = ctx:mask_of(ctx:pop())
+                local bits = {}
+                each_actor(mask, function(actor) table.insert(bits, actor) end)
+                if #bits == 0 then ctx:push_value(2, 0)
+                else ctx:push_value(2, 2 ^ bits[host:random(#bits) + 1])
+                end
+            elseif op == 0x83 then
+                local a = ctx:pop()
+                local value = math.floor(ctx:value_of(a))
+                if a.size == 1 or a.size == 0 then
+                    local count = 0
+                    each_actor(value, function() count = count + 1 end)
+                    ctx:push_value(1, count)
+                else
+                    -- The first bit that is on, as a value with only that bit.
+                    local result = 0
+                    for bit = 0, 31 do
+                        if math.floor(value / 2 ^ bit) % 2 == 1 then result = 2 ^ bit break end
+                    end
+                    ctx:push_value(2, result)
+                end
+            elseif op == 0x84 or op == 0x85 then
+                -- The actors with the highest (or lowest) value of a masked entry.
+                local a = ctx:pop()
+                local best, mask = nil, 0
+                if a.mask ~= nil then
+                    each_actor(a.mask, function(actor)
+                        local value = ctx:read(a.address, a.size, actor)
+                        if best == nil or (op == 0x84 and value > best) or (op == 0x85 and value < best) then
+                            best, mask = value, 2 ^ actor
+                        elseif value == best then
+                            mask = mask + 2 ^ actor
+                        end
+                    end)
+                end
+                ctx:push_value(2, mask)
+            elseif op == 0x86 then
+                local a = ctx:pop()
+                ctx:push_value(2, host:mp_cost(math.floor(ctx:value_of(a))))
+            else
+                local a = ctx:pop()
+                ctx:push_value(2, 2 ^ math.floor(ctx:value_of(a)))
+            end
+            pc = pc + 1
+        elseif op == 0x90 then
+            -- Store the value on top of the address below it. Entries with an actor mask store
+            -- the value in every actor of the mask.
+            local value = ctx:pop()
+            local target = ctx:pop()
+            if target.kind ~= "address" then
+                -- Some scripts push the value first: swap if so.
+                if value.kind == "address" then value, target = target, value end
+            end
+            if target.kind == "address" then
+                local v = ctx:value_of(value)
+                if target.mask ~= nil then
+                    each_actor(target.mask, function(actor) ctx:write(target.address, target.size, v, actor) end)
+                else
+                    ctx:write(target.address, target.size, v, owner)
+                end
+            end
+            pc = pc + 1
+        elseif op == 0x91 then
+            ctx:pop()
+            pc = pc + 1
+        elseif op == 0x92 then
+            local id = ctx:pop()
+            local kind = ctx:pop()
+            host:action(owner, math.floor(ctx:value_of(kind)), math.floor(ctx:value_of(id)))
+            pc = pc + 1
+        elseif op == 0x93 then
+            -- A text, in the FF7 encoding, finished with 0xFF.
+            local stop = pc + 1
+            while stop < length and byte(stop) ~= 0xFF do stop = stop + 1 end
+            host:text(owner, code:sub(pc + 2, stop))
+            pc = stop + 1
+        elseif op == 0x94 then
+            -- Copy the state of some actors to others. Not used by the battle yet.
+            ctx:pop()
+            ctx:pop()
+            pc = pc + 1
+        elseif op == 0x95 then
+            -- Access to the memory banks 1 and 2 of the game: read or write, at an offset.
+            local offset = ctx:pop()
+            local write = ctx:pop()
+            host:memory_bank(ctx:value_of(write) == 1, ctx:value_of(offset))
+            pc = pc + 1
+        elseif op == 0x96 then
+            ctx:pop()
+            ctx:pop()
+            ctx:push_value(2, 0)
+            pc = pc + 1
+        elseif op == 0xA0 then
+            -- Debug text, with one value for each "%d". Skipped.
+            local stop = pc + 2
+            while stop < length and byte(stop) ~= 0 do stop = stop + 1 end
+            local text = code:sub(pc + 3, stop)
+            for _ in text:gmatch("%%d") do ctx:pop() end
+            pc = stop + 1
+        elseif op == 0xA1 then
+            ctx:pop()
+            ctx:pop()
+            pc = pc + 1
+        else
+            -- Anything else does nothing.
+            pc = pc + 1
+        end
+    end
+    return true
+end
+
+--- Runs a script protected from errors.
+--
+-- @return True if it finished correctly.
+function BattleAI.run_safe(code, owner, host)
+    local ok, result, reason = pcall(BattleAI.run, code, owner, host)
+    if not ok then
+        print("AI script error: " .. tostring(result))
+        return false
+    end
+    if result == false then print("AI script stopped: " .. tostring(reason)) end
+    return result
+end

Різницю між файлами не показано, бо вона завелика
+ 2428 - 217
data/data/scripts/battle/battle_ui.lua


+ 12 - 8
data/data/scripts/config.lua

@@ -4,14 +4,18 @@ Config = {
         RIGHT = "Right",
         UP = "Up",
         DOWN = "Down",
-        ACTION = "Enter",
-        CANCEL = "Escape",
-        EXTRA = "BackSpace",
-        MENU = "M",
-        PAUSE = "P",
-        SELECT = "V",
-        PGDN = "PGDN",
-        PDUP = "PGUP",
+    },
+    ACTIONS = {
+        CONFIRM = "CONFIRM",
+        CANCEL = "CANCEL",
+        MENU = "MENU",
+        EXTRA = "EXTRA",
+        START = "START",
+        SELECT = "SELECT",
+        R1 = "R1",
+        R2 = "R2",
+        L1 = "L1",
+        L2 = "L2",
     },
     WINDOW = {
         TOP_LEFT = {

+ 42 - 0
data/data/scripts/debug_data.lua

@@ -66,6 +66,48 @@ for i = 1, 24 do -- E. Skill list
         Characters[0].armor.materia[2].skills[i] = false
     end
 end
+-- Magic for testing. Materia IDs: Fire 49, Ice 50, Earth 51, Lightning 52, Restore 53, Heal 54,
+-- Revive 55, Poison 60. AP is enough to reach the highest level.
+Characters[0].weapon.materia[1] = {id = 49, ap = 100000}
+Characters[0].armor.materia[1] = {id = 53, ap = 100000}
+Characters[2].weapon.materia[0] = {id = 50, ap = 100000}
+Characters[2].weapon.materia[1] = {id = 52, ap = 100000}
+Characters[2].armor.materia[0] = {id = 54, ap = 100000}
+Characters[2].armor.materia[1] = {id = 55, ap = 100000}
+Characters[3].weapon.materia[0] = {id = 53, ap = 100000}
+Characters[3].weapon.materia[1] = {id = 49, ap = 100000}
+Characters[3].armor.materia[0] = {id = 60, ap = 100000}
+Characters[3].armor.materia[1] = {id = 51, ap = 100000}
+-- Status magic: Seal 56 (Sleepel, Silence), Mystify 57 (Confu, Berserk), Transform 58 (Mini, Toad),
+-- Time 65 (Haste, Slow, Stop), Destruct 68 (DeBarrier, DeSpell, Death). Cloud already has Barrier
+-- (62) in his armor.
+Characters[0].weapon.materia[2] = {id = 65, ap = 100000}
+Characters[0].weapon.materia[3] = {id = 56, ap = 100000}
+Characters[2].armor.materia[2] = {id = 68, ap = 100000}
+Characters[2].armor.materia[3] = {id = 57, ap = 100000}
+Characters[3].armor.materia[2] = {id = 58, ap = 100000}
+-- Summons: Choco/Mog 74, Shiva 75, Ifrit 76, Ramuh 77, Titan 78, Odin 79, Leviathan 80, Bahamut 81,
+-- Kjata 82, Alexander 83, Phoenix 84, Neo Bahamut 85, Hades 86, Typhoon 87, Bahamut ZERO 88,
+-- Knights of Round 89, Master Summon 90. They cost between 14 and 250 MP.
+Characters[0].weapon.materia[4] = {id = 75, ap = 100000} -- Shiva
+Characters[0].weapon.materia[5] = {id = 76, ap = 100000} -- Ifrit
+Characters[2].weapon.materia[2] = {id = 77, ap = 100000} -- Ramuh
+Characters[2].weapon.materia[3] = {id = 74, ap = 100000} -- Choco/Mog
+Characters[3].weapon.materia[2] = {id = 84, ap = 100000} -- Phoenix
+Characters[3].weapon.materia[3] = {id = 81, ap = 100000} -- Bahamut
+-- Items to try: Potion, Hi-Potion, Ether, Phoenix Down, Antidote, Echo Screen, Hyper, Tranquilizer,
+-- Remedy, Speed Drink, Grenade, Shrapnel, Molotov.
+for _, item in ipairs({{0, 6}, {1, 4}, {3, 4}, {7, 4}, {8, 3}, {12, 3}, {13, 2}, {14, 2}, {15, 2}, {17, 3}, {20, 5}, {21, 3}, {53, 3}}) do
+    Inventory.add_item(item[1], item[2])
+end
+-- Uncomment to have enough MP to cast anything, summons included.
+--[[
+for _, c in ipairs({0, 2, 3}) do
+    Characters[c].stats.mp.base = 999
+    Characters[c].stats.mp.max = 999
+    Characters[c].stats.mp.current = 999
+end
+]]
 Materia.add(4)
 Materia.add(44)
 Materia.add(12)

+ 48 - 0
data/data/scripts/field.lua

@@ -14,6 +14,44 @@ load_field_map_request = function(map_name, point_name)
     end
 end
 
+dispatch_menu = function(menu_id, parameter)
+    menu_id = tonumber(menu_id)
+    parameter = tonumber(parameter)
+    if not menu_id or not parameter then
+        return
+    end
+
+    if menu_id == 5 then
+        ending_credits()
+    elseif menu_id == 6 then
+        if parameter == 64 then
+            name_chocobo()
+        else
+            name_character(parameter)
+        end
+    elseif menu_id == 7 then
+        if parameter == 1 then
+            Party.split_teams(3)
+        elseif parameter == 2 then
+            Party.split_teams(2)
+        else
+            Party.choose_party()
+        end
+    elseif menu_id == 8 then
+        open_shop(parameter)
+    elseif menu_id == 9 then
+        open_menu("party")
+    elseif menu_id == 14 then
+        open_menu("save")
+    elseif menu_id == 15 then
+        Party.steal_materia()
+    elseif menu_id == 18 then
+        Characters.remove_materia(parameter)
+    elseif menu_id == 19 then
+        Characters.restore_materia(parameter)
+    end
+end
+
 --- Assigns an entity to a playable character.
 --
 -- @param entity_name The entity name.
@@ -34,6 +72,14 @@ set_entity_to_character = function(entity_name, character_id)
         end
 
         entity_manager:set_player_entity(entity_name)
+        local world_map_entry = System.MapChanger.world_map_entry
+        if world_map_entry then
+            entity_manager:place_player_at_field_entry(
+                world_map_entry.x, world_map_entry.y,
+                world_map_entry.triangle, world_map_entry.direction
+            )
+            System.MapChanger.world_map_entry = nil
+        end
     end
     entity_manager:set_entity_to_character(entity_name, character_id)
 end
@@ -272,6 +318,8 @@ System["MapChanger"] = {
     --- Point of the map to change to.
     point_name = "",
 
+    world_map_entry = nil,
+
     --- ID of the current field.
     current_map_name = "",
 

+ 110 - 108
data/data/scripts/menu/begin_menu.lua

@@ -1,34 +1,34 @@
 if UiContainer == nil then UiContainer = {} end
 
---- The begin menu
-UiContainer.BeginMenu = {
+    --- The begin menu
+    UiContainer.BeginMenu = {
 
-    --- Current cursor position
-    position = 1,
+        --- Current cursor position
+        position = 1,
 
-    -- Max cursor position
-    position_total = 7,
+        -- Max cursor position
+        position_total = 7,
 
-    --- Run when the menu is created.
-    --
-    -- Sets this menu as the one beind displayed.
-    on_start = function(self)
+        --- Run when the menu is created.
+        --
+        -- Sets this menu as the one beind displayed.
+        on_start = function(self)
         UiContainer.current_menu = "begin"
         local cursor = ui_manager:get_widget("BeginMenu.Container.Cursor")
         cursor:set_default_animation("Position" .. self.position)
         return 0
-    end,
+        end,
 
 
-    --- Handles button events.
-    --
-    -- Handles directional Up, Down and Enter keys.
-    -- @param button Pressed button string key. Config.CONTROLS.UP, Config.CONTROLS.LEFT, Config.CONTROLS.ACTION and Config.CONTROLS.CANCEL are handled.
-    -- @param event Trigger event. Normally, "Press".
-    on_button = function(self, button, event)
+        --- Handles button events.
+        --
+        -- Handles directional Up, Down and Enter keys.
+        -- @param button Pressed direction or action name.
+        -- @param event Trigger event. Normally, "Press".
+        on_button = function(self, button, event)
         if UiContainer.current_menu == "begin" then
             local cursor = ui_manager:get_widget("BeginMenu.Container.Cursor")
-            if button == Config.CONTROLS.ACTION and event == "Press" then
+            if button == Config.ACTIONS.CONFIRM and event == "Press" then
                 if self.position == 1 then -- New game
                     audio_manager:play_sound("Window")
                     generate_control_key()
@@ -37,103 +37,105 @@ UiContainer.BeginMenu = {
                     --console("debug_walkmesh true")
                     script:request_end_sync(Script.UI, "BeginMenu", "hide", 0)
                     MenuSettings.pause_available = true
-                elseif self.position == 2 then -- Load, show save menu.
-                    audio_manager:play_sound("Cursor")
-                    UiContainer.SaveMenu.operation = "load"
-                    script:request_end_sync(Script.UI, "SaveMenu", "show", 0)
-                elseif self.position == 3 then
-                    -- NMKIN_3 START
-                    Data.progress_game = 27
-                    load_field_map_request("nmkin_3", "")
-                    console("camera_free false")
-                    console("debug_walkmesh true")
-                    script:wait(1)
-                    script:request_end_sync(Script.UI, "BeginMenu", "hide", 0)
-                    entity_manager:get_entity("Cloud"):set_position(-1.090750, 15.310307, 17.281244)
-                    entity_manager:set_player_entity("Cloud")
-                    script:wait(1)
-                    entity_manager:get_player_entity():set_position(-1.093750, 15.320307, 17.281244)
-                    entity_manager:get_entity("Cloud"):jump_to_position(0.46875, 14.9922, -1, 1, 42) -- Triangle 42, 2 steps.
-                    entity_manager:get_entity("Cloud"):jump_sync()
-                    entity_manager:player_lock(false)
-                    MenuSettings.pause_available = true
-                    -- NMKIN_3 END
-                    -- NMKIN_4 START
-                    --[[Data.progress_game = 14
-                    --load_field_map_request("nmkin_4", "")
-                    map("nmkin_4")
-                    console("camera_free false")
-                    console("debug_walkmesh true")
-                    script:wait(1.5)
-                    script:request_end_sync(Script.UI, "BeginMenu", "hide", 0)
-                    entity_manager:get_entity("Cloud"):set_position(-0.820312, 0.500000, 17.281244)
-                    entity_manager:set_player_entity("Cloud")
-                    set_party(0, 1, 4)
-                    script:wait(0.5)
-                    entity_manager:get_player_entity():set_position(-0.820312, 0.500000, 17.281244)
-                    entity_manager:get_entity("Cloud"):jump_to_position(-0.800312, 0.500000, -1, 1) -- Triangle 42, 2 steps.
-                    entity_manager:get_entity("Cloud"):jump_sync()
-                    entity_manager:player_lock(false)
-                    print("TRIANGLE " .. entity_manager:get_entity("Cloud"):get_move_triangle_id())
-                    MenuSettings.pause_available = true]]
-                    -- NMKIN_4 END
-                elseif self.position == 4 then
-                    script:request_end_sync(Script.UI, "BeginMenu", "hide", 0)
-                    console("camera_free true")
-                    console("debug_walkmesh true")
-                    map("test_2")
-                    MenuSettings.pause_available = true
-                elseif self.position == 5 then
-                    script:request_end_sync(Script.UI, "BeginMenu", "hide", 0)
-                    console("camera_free true")
-                    world_map_module:init()
-                elseif self.position == 6 then
-                    load_field_map_request("startmap", "")
-                    console("camera_free false")
-                    console("debug_walkmesh false")
-                    script:request_end_sync(Script.UI, "BeginMenu", "hide", 0)
-                    MenuSettings.pause_available = true
-                elseif self.position == 7 then
-                    --load_field_map_request("startmap", "")
-                    console("camera_free false")
-                    console("debug_walkmesh false")
-                    script:request_end_sync(Script.UI, "BeginMenu", "hide", 0)
-                    set_party(0, 2, 3)
-                    Battle.start(220)
-                    MenuSettings.pause_available = true
-                end
-            elseif button == Config.CONTROLS.DOWN then
-                audio_manager:play_sound("Cursor")
-                self.position = self.position + 1
-                if self.position > self.position_total then
-                    self.position = 1;
-                end
-                cursor:set_default_animation("Position" .. self.position)
-            elseif button == Config.CONTROLS.UP then
-                audio_manager:play_sound("Cursor")
-                self.position = self.position - 1
-                if self.position <= 0 then
-                    self.position = self.position_total;
-                end
-                cursor:set_default_animation("Position" .. self.position)
-            end
+                    elseif self.position == 2 then -- Load, show save menu.
+                        audio_manager:play_sound("Cursor")
+                        UiContainer.SaveMenu.operation = "load"
+                        script:request_end_sync(Script.UI, "SaveMenu", "show", 0)
+                        elseif self.position == 3 then
+                            -- NMKIN_3 START
+                            Data.progress_game = 27
+                            load_field_map_request("nmkin_3", "")
+                            console("camera_free false")
+                            console("debug_walkmesh true")
+                            script:wait(1)
+                            script:request_end_sync(Script.UI, "BeginMenu", "hide", 0)
+                            entity_manager:get_entity("Cloud"):set_position(-1.090750, 15.310307, 17.281244)
+                            entity_manager:set_player_entity("Cloud")
+                            script:wait(1)
+                            entity_manager:get_player_entity():set_position(-1.093750, 15.320307, 17.281244)
+                            entity_manager:get_entity("Cloud"):jump_to_position(0.46875, 14.9922, -1, 1, 42) -- Triangle 42, 2 steps.
+                            entity_manager:get_entity("Cloud"):jump_sync()
+                            entity_manager:player_lock(false)
+                            MenuSettings.pause_available = true
+                            -- NMKIN_3 END
+                            -- NMKIN_4 START
+                            --[[Data.progress_game = 14
+                            --load_field_map_request("nmkin_4", "")
+                            map("nmkin_4")
+                            console("camera_free false")
+                            console("debug_walkmesh true")
+                            script:wait(1.5)
+                            script:request_end_sync(Script.UI, "BeginMenu", "hide", 0)
+                            entity_manager:get_entity("Cloud"):set_position(-0.820312, 0.500000, 17.281244)
+                            entity_manager:set_player_entity("Cloud")
+                            set_party(0, 1, 4)
+                            script:wait(0.5)
+                            entity_manager:get_player_entity():set_position(-0.820312, 0.500000, 17.281244)
+                            entity_manager:get_entity("Cloud"):jump_to_position(-0.800312, 0.500000, -1, 1) -- Triangle 42, 2 steps.
+                            entity_manager:get_entity("Cloud"):jump_sync()
+                            entity_manager:player_lock(false)
+                            print("TRIANGLE " .. entity_manager:get_entity("Cloud"):get_move_triangle_id())
+                            MenuSettings.pause_available = true]]
+                            -- NMKIN_4 END
+                            elseif self.position == 4 then
+                                script:request_end_sync(Script.UI, "BeginMenu", "hide", 0)
+                                console("camera_free true")
+                                console("debug_walkmesh true")
+                                map("test_2")
+                                MenuSettings.pause_available = true
+                                elseif self.position == 5 then
+                                    script:request_end_sync(Script.UI, "BeginMenu", "hide", 0)
+                                    console("camera_free true")
+                                    console("debug_entity 2")
+                                    MenuSettings.pause_available = true
+                                    world_map_module:init()
+                                    elseif self.position == 6 then
+                                        load_field_map_request("startmap", "")
+                                        console("camera_free false")
+                                        console("debug_walkmesh false")
+                                        script:request_end_sync(Script.UI, "BeginMenu", "hide", 0)
+                                        MenuSettings.pause_available = true
+                                        elseif self.position == 7 then
+                                            --load_field_map_request("startmap", "")
+                                            console("camera_free false")
+                                            console("debug_walkmesh false")
+                                            script:request_end_sync(Script.UI, "BeginMenu", "hide", 0)
+                                            set_party(0, 2, 3)
+                                            Battle.start(372) -- Single level 2 MP, easy test battle
+                                            MenuSettings.pause_available = true
+                                            end
+                                            elseif button == Config.CONTROLS.DOWN then
+                                                audio_manager:play_sound("Cursor")
+                                                self.position = self.position + 1
+                                                if self.position > self.position_total then
+                                                    self.position = 1;
+        end
+        cursor:set_default_animation("Position" .. self.position)
+        elseif button == Config.CONTROLS.UP then
+            audio_manager:play_sound("Cursor")
+            self.position = self.position - 1
+            if self.position <= 0 then
+                self.position = self.position_total;
+        end
+        cursor:set_default_animation("Position" .. self.position)
+        end
         end
         return 0
-    end,
+        end,
 
-    --- Opens the save menu.
-    show = function(self)
+        --- Opens the save menu.
+        show = function(self)
         UiContainer.current_menu = "begin"
         ui_manager:get_widget("BeginMenu"):set_visible(true)
         return 0;
-    end,
+        end,
 
-    --- Hiddens the begin menu.
-    --
-    -- It doesn't do anything else.
-    hide = function(self)
+        --- Hiddens the begin menu.
+        --
+        -- It doesn't do anything else.
+        hide = function(self)
         UiContainer.current_menu = ""
         ui_manager:get_widget("BeginMenu"):set_visible(false)
         return 0;
-    end,
-}
+        end,
+    }

+ 5 - 5
data/data/scripts/menu/equip_menu.lua

@@ -56,14 +56,14 @@ UiContainer.EquipMenu = {
     --- Handles button events.
     --
     -- For the current submenu, handles directional keys, enter and escape events.
-    -- @param button Pressed button string key. Config.CONTROLS.UP, Config.CONTROLS.LEFT, Config.CONTROLS.ACTION and Config.CONTROLS.CANCEL are handled.
+    -- @param button Pressed direction or action name.
     -- @param event Trigger event. Normally, "Press".
     on_button = function(self, button, event)
         if UiContainer.current_menu == "equip" then
             if UiContainer.current_submenu == "" then
                 -- TODO: Handle L1/R1 (change character)
                 -- TODO: Handle square: Materia menu
-                if button == Config.CONTROLS.CANCEL and event == "Press" then
+                if button == Config.ACTIONS.CANCEL and event == "Press" then
                     audio_manager:play_sound("Back")
                     UiContainer.current_menu = "main"
                     script:request_end_sync(Script.UI, "EquipMenu", "hide", 0)
@@ -83,7 +83,7 @@ UiContainer.EquipMenu = {
                     end
                     ui_manager:get_widget("EquipMenu.Container.Character.Cursor"):set_default_animation("Position" .. self.equip_position)
                     self.populate_details(self, false)
-                elseif button == Config.CONTROLS.ACTION then
+                elseif button == Config.ACTIONS.CONFIRM then
                     if self.equip_position == 1 then
                         self.selecting_slot = Inventory.ITEM_TYPE.WEAPON
                     elseif self.equip_position == 2 then
@@ -105,7 +105,7 @@ UiContainer.EquipMenu = {
                 elseif self.selecting_slot == Inventory.ITEM_TYPE.ACCESSORY then
                     list = self.avail_accessories
                 end
-                if button == Config.CONTROLS.CANCEL and event == "Press" then
+                if button == Config.ACTIONS.CANCEL and event == "Press" then
                     audio_manager:play_sound("Back")
                     self.submenu_none(self)
                 elseif button == Config.CONTROLS.DOWN then
@@ -146,7 +146,7 @@ UiContainer.EquipMenu = {
                     end
                     self.populate_details(self, true)
                     self.calculate_stat_diffs(self)
-                elseif button == Config.CONTROLS.ACTION and event == "Press" then
+                elseif button == Config.ACTIONS.CONFIRM and event == "Press" then
                     -- Equip the seleced item
                     local item_id = nil
                     if self.selecting_slot == Inventory.ITEM_TYPE.WEAPON then

+ 14 - 14
data/data/scripts/menu/item_menu.lua

@@ -81,12 +81,12 @@ UiContainer.ItemMenu = {
     --- Handles button events.
     --
     -- For the current submenu, handles directional keys, enter and escape events.
-    -- @param button Pressed button string key. Config.CONTROLS.UP, Config.CONTROLS.LEFT, Config.CONTROLS.ACTION and Config.CONTROLS.CANCEL are handled.
+    -- @param button Pressed direction or action name.
     -- @param event Trigger event. Normally, "Press".
     on_button = function(self, button, event)
         if UiContainer.current_menu == "item" then
             if UiContainer.current_submenu == "bar_selection" then
-                if button == Config.CONTROLS.CANCEL and event == "Press" then
+                if button == Config.ACTIONS.CANCEL and event == "Press" then
                     audio_manager:play_sound("Back")
                     UiContainer.current_menu = "main"
                     script:request_end_sync(Script.UI, "ItemMenu", "hide", 0)
@@ -116,7 +116,7 @@ UiContainer.ItemMenu = {
                     else
                         ui_manager:get_widget("ItemMenu.Container.KeyItems"):set_visible(false)
                     end
-                elseif button == Config.CONTROLS.ACTION then
+                elseif button == Config.ACTIONS.CONFIRM then
                     if self.bar_position == 1 then
                         self.submenu_items(self)
                     elseif self.bar_position == 2 then
@@ -131,7 +131,7 @@ UiContainer.ItemMenu = {
                     return 0
                 end
             elseif UiContainer.current_submenu == "order_selection" then
-                if button == Config.CONTROLS.CANCEL and event == "Press" then
+                if button == Config.ACTIONS.CANCEL and event == "Press" then
                     audio_manager:play_sound("Back")
                     self.submenu_bar(self)
                 elseif button == Config.CONTROLS.DOWN then
@@ -148,7 +148,7 @@ UiContainer.ItemMenu = {
                         self.order_cursor_position = self.order_cursor_position_total
                     end
                     ui_manager:get_widget("ItemMenu.Container.ItemOrder.Cursor"):set_default_animation("Position" .. self.order_cursor_position)
-                elseif button == Config.CONTROLS.ACTION then
+                elseif button == Config.ACTIONS.CONFIRM then
                     audio_manager:play_sound("Cursor")
                     if self.order_cursor_position == 1 then
                         Inventory.sort(Inventory.ORDER.CUSTOM)
@@ -219,7 +219,7 @@ UiContainer.ItemMenu = {
                     else
                         desc_label:set_text("")
                     end
-                elseif button == Config.CONTROLS.PGDN then -- TODO: Also, the bind to R1
+                elseif button == Config.ACTIONS.R1 then
                     if self.first_item_in_window + self.item_cursor_position_total < self.inventory_size - self.item_cursor_position_total then
                         audio_manager:play_sound("Cursor")
                         self.item_cursor_item_selected = self.item_cursor_item_selected + self.item_cursor_position_total
@@ -233,7 +233,7 @@ UiContainer.ItemMenu = {
                     else
                         audio_manager:play_sound("Error")
                     end
-                elseif button == Config.CONTROLS.PGUP then -- TODO: Also, the bind to L1
+                elseif button == Config.ACTIONS.L1 then
                     if self.first_item_in_window - self.item_cursor_position_total > 1 then
                         audio_manager:play_sound("Cursor")
                         self.item_cursor_item_selected = self.item_cursor_item_selected - self.item_cursor_position_total
@@ -247,12 +247,12 @@ UiContainer.ItemMenu = {
                     else
                         audio_manager:play_sound("Error")
                     end
-                elseif button == Config.CONTROLS.CANCEL and event == "Press" then
+                elseif button == Config.ACTIONS.CANCEL and event == "Press" then
                     audio_manager:play_sound("Back")
                     self.submenu_bar(self)
                     UiContainer.current_submenu = "bar_selection"
                     ui_manager:get_widget("ItemMenu.Container.ItemList.Cursor"):set_visible(false)
-                elseif button == Config.CONTROLS.ACTION then
+                elseif button == Config.ACTIONS.CONFIRM then
                     if Game.Items[Inventory[self.item_cursor_item_selected].item].menu == 1 then
                         audio_manager:play_sound("Cursor")
                         self.item_in_use = Inventory[self.item_cursor_item_selected].item
@@ -290,10 +290,10 @@ UiContainer.ItemMenu = {
                         end
                         ui_manager:get_widget("ItemMenu.Container.ItemMenuCharacters.Cursor"):set_default_animation("Position" .. self.char_position)
                     end
-                elseif button == Config.CONTROLS.CANCEL then
+                elseif button == Config.ACTIONS.CANCEL then
                     audio_manager:play_sound("Back")
                     self.submenu_items(self)
-                elseif button == Config.CONTROLS.ACTION then
+                elseif button == Config.ACTIONS.CONFIRM then
                     local use_result = false
                     if self.item_in_use_party == true then
                         use_result = self.use_item(self, self.item_in_use, nil)
@@ -415,7 +415,7 @@ UiContainer.ItemMenu = {
                     else
                         ui_manager:get_widget("ItemMenu.Container.ItemMenuSecondBar.ItemText"):set_text("")
                     end
-                elseif button == Config.CONTROLS.PGDN then -- TODO: Also, the bind to R1
+                elseif button == Config.ACTIONS.R1 then
                     if self.first_key_item_row_in_window + self.key_items_cursor_y_position_total < self.key_items_total_rows - self.key_items_cursor_y_position_total then
                         audio_manager:play_sound("Cursor")
                         self.first_key_item_row_in_window = self.first_key_item_row_in_window + self.key_items_cursor_y_position_total
@@ -430,7 +430,7 @@ UiContainer.ItemMenu = {
                     else
                         audio_manager:play_sound("Error")
                     end
-                elseif button == Config.CONTROLS.PGUP then -- TODO: Also, the bind to L1
+                elseif button == Config.ACTIONS.L1 then
                     if self.first_key_item_row_in_window + self.key_items_cursor_y_position_total > 1 then
                         audio_manager:play_sound("Cursor")
                         self.first_key_item_row_in_window = self.first_key_item_row_in_window - self.key_items_cursor_y_position_total
@@ -445,7 +445,7 @@ UiContainer.ItemMenu = {
                     else
                         audio_manager:play_sound("Cursor")
                     end
-                elseif button == Config.CONTROLS.CANCEL then
+                elseif button == Config.ACTIONS.CANCEL then
                     audio_manager:play_sound("Back")
                     self.submenu_bar(self)
                 end

+ 6 - 6
data/data/scripts/menu/main_menu.lua

@@ -30,7 +30,7 @@ UiContainer.MainMenu = {
     --- Handles button events.
     --
     -- For the current submenu, handles directional keys, enter and escape events.
-    -- @param button Pressed button string key. Config.CONTROLS.UP, Config.CONTROLS.LEFT, Config.CONTROLS.ACTION and Config.CONTROLS.CANCEL are handled.
+    -- @param button Pressed direction or action name.
     -- @param event Trigger event. Normally, "Press".
     on_button = function(self, button, event)
         if UiContainer.current_menu == "main" then
@@ -40,10 +40,10 @@ UiContainer.MainMenu = {
             local timegil = ui_manager:get_widget("MainMenu.Container.TimeGil")
             local location = ui_manager:get_widget("MainMenu.Container.Location")
             if UiContainer.current_submenu == "" then
-                if button == Config.CONTROLS.CANCEL and event == "Press" then
+                if button == Config.ACTIONS.CANCEL and event == "Press" then
                     audio_manager:play_sound("Back")
                     script:request_end_sync(Script.UI, "MainMenu", "hide", 0)
-                elseif button == Config.CONTROLS.ACTION and event == "Press" then
+                elseif button == Config.ACTIONS.CONFIRM and event == "Press" then
                     if self.position == 1 then -- Item menu
                         audio_manager:play_sound("Cursor")
                         script:request_end_sync(Script.UI, "ItemMenu", "show", 0)
@@ -79,7 +79,7 @@ UiContainer.MainMenu = {
                     menu_cursor:set_default_animation("Position" .. self.position)
                 end
             elseif UiContainer.current_submenu == "main_character" then
-                if button == Config.CONTROLS.CANCEL and event == "Press" then
+                if button == Config.ACTIONS.CANCEL and event == "Press" then
                     audio_manager:play_sound("Back")
                     UiContainer.current_submenu = ""
                     ui_manager:get_widget("MainMenu.Container.Characters.Cursor"):set_visible(false)
@@ -99,7 +99,7 @@ UiContainer.MainMenu = {
                         self.character_position = self.character_position_total
                     end
                     ui_manager:get_widget("MainMenu.Container.Characters.Cursor"):set_default_animation("Position" .. self.character_position)
-                elseif button == Config.CONTROLS.ACTION then
+                elseif button == Config.ACTIONS.CONFIRM then
                     -- TODO: Check for empty character.
                     audio_manager:play_sound("Cursor")
                     if self.select_character_for_menu == 2 then -- Magic menu
@@ -120,7 +120,7 @@ UiContainer.MainMenu = {
                 end
             end
         elseif ui_manager:get_widget("MainMenu"):is_visible() == false and MenuSettings.available == true then
-            if button == Config.CONTROLS.CANCEL and event == "Press" then
+            if button == Config.ACTIONS.MENU and event == "Press" then
                 audio_manager:play_sound("Back")
                 script:request_end_sync(Script.UI, "MainMenu", "show", 0)
             end

+ 7 - 7
data/data/scripts/menu/materia_menu.lua

@@ -40,14 +40,14 @@ UiContainer.MateriaMenu = {
     --- Handles button events.
     --
     -- For the current submenu, handles directional keys, enter and escape events.
-    -- @param button Pressed button string key. Config.CONTROLS.UP, Config.CONTROLS.LEFT, Config.CONTROLS.ACTION and Config.CONTROLS.CANCEL are handled.
+    -- @param button Pressed direction or action name.
     -- @param event Trigger event. Normally, "Press".
     on_button = function(self, button, event)
         if UiContainer.current_menu == "materia" then
             if UiContainer.current_submenu == "" then
                 -- TODO: Handle L1/R1 (change character)
                 -- TODO: Handle square: Materia menu
-                if button == Config.CONTROLS.CANCEL and event == "Press" then
+                if button == Config.ACTIONS.CANCEL and event == "Press" then
                     audio_manager:play_sound("Back")
                     UiContainer.current_menu = "main"
                     script:request_end_sync(Script.UI, "MateriaMenu", "hide", 0)
@@ -83,7 +83,7 @@ UiContainer.MateriaMenu = {
                     end
                     ui_manager:get_widget("MateriaMenu.Container.Character.Cursor"):set_default_animation("Position" .. self.header_position_row .. "-" .. self.header_position)
                     self.populate_details(self, false)
-                elseif button == Config.CONTROLS.ACTION then
+                elseif button == Config.ACTIONS.CONFIRM then
                     if self.header_position_row == 1 and self.header_position == 1 then
                         -- TODO: Command menu
                     elseif self.header_position_row == 2 and self.header_position == 1 then
@@ -141,7 +141,7 @@ UiContainer.MateriaMenu = {
                     ui_manager:get_widget("MateriaMenu.Container.List.Cursor"):set_default_animation("Position" .. self.list_position)
                     -- Show details
                     self.populate_details(self, true)
-                elseif button == Config.CONTROLS.PGDN then -- TODO: Also, the bind to R1
+                elseif button == Config.ACTIONS.R1 then
                     if self.list_first_visible + self.list_position_total < self.list_size - self.list_position_total then
                         audio_manager:play_sound("Cursor")
                         self.list_first_visible = self.list_first_visible + self.list_position_total
@@ -150,7 +150,7 @@ UiContainer.MateriaMenu = {
                     else
                         audio_manager:play_sound("Error")
                     end
-                elseif button == Config.CONTROLS.PGUP then -- TODO: Also, the bind to L1
+                elseif button == Config.ACTIONS.L1 then
                     if self.list_first_visible - self.list_position_total > 1 then
                         audio_manager:play_sound("Cursor")
                         self.list_first_visible = self.list_first_visible - self.list_position_total
@@ -159,10 +159,10 @@ UiContainer.MateriaMenu = {
                     else
                         audio_manager:play_sound("Error")
                     end
-                elseif button == Config.CONTROLS.CANCEL and event == "Press" then
+                elseif button == Config.ACTIONS.CANCEL and event == "Press" then
                     audio_manager:play_sound("Back")
                     self.submenu_none(self)
-                elseif button == Config.CONTROLS.ACTION then
+                elseif button == Config.ACTIONS.CONFIRM then
                     -- TODO: Replace for "Equip materia" sound.
                     audio_manager:play_sound("Cursor")
                     self.equip_materia(self)

+ 6 - 3
data/data/scripts/menu/name_menu.lua

@@ -48,8 +48,11 @@ UiContainer.NameMenu = {
     -- For the current submenu, handles directional keys, enter and escape events.
     -- @param button Pressed button string key. "Up", "Left", "Enter" and "Escape" are handled.
     -- @param event Trigger event. Normally, "Press".
-    on_button = function(self, button, event)
+    on_button = function(self, button, event, source_key)
         if UiContainer.current_menu == "name" then
+            if button == Config.ACTIONS.CONFIRM and source_key == "Space" and UiContainer.current_submenu == "" then
+                return 0
+            end
             if UiContainer.current_submenu == "confirm" then
                 if button == "Right" then
                     audio_manager:play_sound("Cursor")
@@ -65,7 +68,7 @@ UiContainer.NameMenu = {
                         self.confirm_position = self.confirm_position_total
                     end
                     ui_manager:get_widget("NameMenu.Container.Confirm.Cursor"):set_default_animation("Position" .. self.confirm_position)
-                elseif button == "Enter" then
+                elseif button == Config.ACTIONS.CONFIRM then
                     audio_manager:play_sound("Cursor")
                     if self.confirm_position == 2 then -- Back
                         UiContainer.current_submenu = ""
@@ -115,7 +118,7 @@ UiContainer.NameMenu = {
                     else
                         audio_manager:play_sound("Error")
                     end
-                elseif button == "Enter" then
+                elseif button == Config.ACTIONS.CONFIRM then
                     if self.options_position == 1 then -- Clear name.
                         audio_manager:play_sound("Cursor")
                         self.name = ""

+ 3 - 3
data/data/scripts/menu/pause_menu.lua

@@ -21,9 +21,9 @@ UiContainer.PauseMenu = {
     on_button = function( self, button, event )
         if System:is_paused() == true then
             local menu_cursor = ui_manager:get_widget( "PauseMenu.Menu.Cursor" )
-            if button == Config.CONTROLS.PAUSE and event == "Press" then
+            if button == Config.ACTIONS.START and event == "Press" then
                 System:unpause()
-            elseif button == "Enter" and event == "Press" then
+            elseif button == Config.ACTIONS.CONFIRM and event == "Press" then
                 audio_manager:play_sound("Cursor")
                 script:request_end_sync( Script.UI, "PauseMenu", "hide", 0 )
                 if self.position == 2 then
@@ -49,7 +49,7 @@ UiContainer.PauseMenu = {
                 menu_cursor:set_default_animation( "Position" .. self.position )
             end
         elseif System:is_paused() == false then
-            if button == Config.CONTROLS.PAUSE and event == "Press" then
+            if button == Config.ACTIONS.START and event == "Press" then
                 System:pause()
             end
         end

+ 3 - 3
data/data/scripts/menu/save_menu.lua

@@ -28,15 +28,15 @@ UiContainer.SaveMenu = {
     --- Handles button events.
     --
     -- For the current submenu, handles directional keys, enter and escape events.
-    -- @param button Pressed button string key. Config.CONTROLS.UP, Config.CONTROLS.LEFT, Config.CONTROLS.ACTION and Config.CONTROLS.CANCEL are handled.
+    -- @param button Pressed direction or action name.
     -- @param event Trigger event. Normally, "Press".
     on_button = function(self, button, event)
         if UiContainer.current_menu == "save" then
             if UiContainer.current_submenu == "" then
-                if button == Config.CONTROLS.CANCEL and event == "Press" then
+                if button == Config.ACTIONS.CANCEL and event == "Press" then
                     audio_manager:play_sound("Back")
                     script:request_end_sync(Script.UI, "SaveMenu", "hide", 0)
-                elseif button == Config.CONTROLS.ACTION then
+                elseif button == Config.ACTIONS.CONFIRM then
                     self.action(self, self.first_visible - 1 + self.position)
                 elseif button == Config.CONTROLS.DOWN then
                     if self.position < self.position_total and self.first_visible + self.position < self.max_slots then

+ 85 - 0
data/data/scripts/worldmap/triangle_triggers.lua

@@ -0,0 +1,85 @@
+System.WorldMap = {
+    triangle_triggers = {},
+    triangle_functions = {},
+    field_table = {},
+
+    --[[
+    Registers a callback for a WM0 mesh function.
+    @param mesh_x World-map mesh X coordinate (0-35).
+    @param mesh_y World-map mesh Y coordinate (0-27).
+    @param function_id Triangle mesh function ID (0-4).
+    @param callback Function called when the player enters the trigger.
+    @return True when registered, false for invalid input.
+    ]]
+    register_triangle_trigger = function(self, mesh_x, mesh_y, function_id, callback)
+        if type(mesh_x) ~= "number" or mesh_x < 0 or mesh_x > 35
+          or type(mesh_y) ~= "number" or mesh_y < 0 or mesh_y > 27
+          or type(function_id) ~= "number" or function_id < 0 or function_id > 4
+          or type(callback) ~= "function" then
+            return false
+        end
+
+        local mesh_triggers = self.triangle_triggers[mesh_y]
+        if not mesh_triggers then
+            mesh_triggers = {}
+            self.triangle_triggers[mesh_y] = mesh_triggers
+        end
+        local function_triggers = mesh_triggers[mesh_x]
+        if not function_triggers then
+            function_triggers = {}
+            mesh_triggers[mesh_x] = function_triggers
+        end
+        function_triggers[function_id] = callback
+        return true
+    end,
+
+    --[[
+    Dispatches an entered WM0 mesh function to its registered callback.
+    @param self World-map system script table.
+    @param mesh_index Linear mesh index (mesh_y * 36 + mesh_x).
+    @param function_id Triangle mesh function ID.
+    ]]
+    on_triangle_enter = function(self, mesh_index, function_id)
+        mesh_index = tonumber(mesh_index)
+        function_id = tonumber(function_id)
+        if not mesh_index or not function_id then
+            return
+        end
+
+        local mesh_x = mesh_index % 36
+        local mesh_y = math.floor(mesh_index / 36)
+        local mesh_triggers = self.triangle_triggers[mesh_y]
+        local function_triggers = mesh_triggers and mesh_triggers[mesh_x]
+        local callback = function_triggers and function_triggers[function_id]
+        if callback then
+            callback(mesh_x, mesh_y, function_id)
+            return
+        end
+
+        local mesh_functions = self.triangle_functions[mesh_index]
+        local function_index = mesh_functions and mesh_functions[function_id]
+        local world_function = function_index
+          and self["world_function_" .. tostring(function_index)]
+        if world_function then
+            world_function(self)
+        else
+            print(
+                "No world-map function for mesh " .. mesh_index
+                .. ", function " .. function_id
+            )
+        end
+    end,
+}
+
+EnterFieldScene = function(field_table_id, scenario)
+    local field_table = System.WorldMap.field_table[tonumber(field_table_id)]
+    local entry = field_table and field_table[tonumber(scenario)]
+    if not entry then
+        print("No installed field entry for FIELD.TBL record " .. tostring(field_table_id))
+        return 0
+    end
+
+    System.MapChanger.world_map_entry = entry
+    load_field_map_request(entry.field, "")
+    return 0
+end

+ 319 - 0
data/data/scripts/worldmap/vehicles.lua

@@ -0,0 +1,319 @@
+EntityContainer = EntityContainer or {}
+
+local function show_vehicle_error(message)
+    print(message)
+    if not dialog:show_message(message) then
+        return false
+    end
+    return true
+end
+
+local Vehicle = {}
+Vehicle.__index = Vehicle
+
+Vehicle.terrains = {}
+Vehicle.board = function(self)
+    show_vehicle_error("Vehicle.board must be implemented by the vehicle.")
+    return false
+end
+Vehicle.unboard = function(self)
+    show_vehicle_error("Vehicle.unboard must be implemented by the vehicle.")
+    return false
+end
+Vehicle.on_interact = function(self)
+    self:board()
+end
+
+--[[
+Creates a vehicle that inherits the Vehicle interface.
+@param entity_name Managed world-map entity name.
+@param terrains Walkmap terrain type names this vehicle can travel.
+@param rise_amount Height offset applied when boarding.
+@return The vehicle script table.
+]]
+local function extend_vehicle(entity_name, terrains, rise_amount, unboarding_terrains)
+    return setmetatable({
+        entity_name = entity_name,
+        terrains = terrains,
+        unboarding_terrains = unboarding_terrains or terrains,
+        rise_amount = rise_amount,
+    }, Vehicle)
+end
+
+local function is_unboarding_terrain_allowed(vehicle)
+    local terrain_name = world_map_module:get_terrain_type_under_entity(vehicle.entity_name)
+    for _, allowed_terrain in ipairs(vehicle.unboarding_terrains) do
+        if terrain_name == allowed_terrain then
+            return true
+        end
+    end
+    return false, terrain_name
+end
+
+--[[
+Copies a terrain list so a Chocobo color change does not mutate a shared profile.
+@param terrains Terrain type names to copy.
+@return A new terrain list.
+]]
+local function copy_terrain_list(terrains)
+    local copy = {}
+    for _, terrain_name in ipairs(terrains) do
+        table.insert(copy, terrain_name)
+    end
+    return copy
+end
+
+local yellow_chocobo_terrains = {
+    "GRASS", "FOREST", "SWAMP", "DESERT", "WASTELAND", "SNOW", "RIVERSIDE",
+    "COREL_BRIDGE", "WUTAI_BRIDGE", "HILL_SIDE", "BEACH", "CANYON", "MOUNTAIN_PASS",
+    "GOLD_SAUCER_DESERT_BORDER", "BRIDGE_HEAD",
+}
+local green_chocobo_terrains = copy_terrain_list(yellow_chocobo_terrains)
+table.insert(green_chocobo_terrains, "MOUNTAIN")
+table.insert(green_chocobo_terrains, "CLIFF")
+local blue_chocobo_terrains = copy_terrain_list(yellow_chocobo_terrains)
+table.insert(blue_chocobo_terrains, "RIVER_CROSSING")
+table.insert(blue_chocobo_terrains, "RIVER")
+table.insert(blue_chocobo_terrains, "WATER")
+local black_chocobo_terrains = copy_terrain_list(green_chocobo_terrains)
+table.insert(black_chocobo_terrains, "RIVER_CROSSING")
+table.insert(black_chocobo_terrains, "RIVER")
+table.insert(black_chocobo_terrains, "WATER")
+local gold_chocobo_terrains = {
+    "GRASS", "FOREST", "MOUNTAIN", "SEA_DEEP_WATER", "RIVER_CROSSING", "RIVER", "WATER",
+    "SWAMP", "DESERT", "WASTELAND", "SNOW", "RIVERSIDE", "CLIFF", "COREL_BRIDGE",
+    "WUTAI_BRIDGE", "UNUSED_1", "HILL_SIDE", "BEACH", "SUBMARINE_PEN", "CANYON",
+    "MOUNTAIN_PASS", "UNKNOWN_1", "WATERFALL", "UNUSED_2", "GOLD_SAUCER_DESERT", "JUNGLE",
+    "SEA", "NORTHERND_CAVE", "GOLD_SAUCER_DESERT_BORDER", "BRIDGE_HEAD", "BACK_ENTRANCE",
+    "UNUSED_3",
+}
+local chocobo_terrains_by_color = {
+    YELLOW = yellow_chocobo_terrains,
+    GREEN = green_chocobo_terrains,
+    BLUE = blue_chocobo_terrains,
+    BLACK = black_chocobo_terrains,
+    GOLD = gold_chocobo_terrains,
+}
+
+EntityContainer["WorldMapHighwind"] = extend_vehicle(
+    "WorldMapHighwind",
+    {
+        "GRASS", "FOREST", "MOUNTAIN", "SEA_DEEP_WATER", "RIVER_CROSSING", "RIVER",
+        "WATER", "SWAMP", "DESERT", "WASTELAND", "SNOW", "RIVERSIDE", "CLIFF",
+        "COREL_BRIDGE", "WUTAI_BRIDGE", "HILL_SIDE", "BEACH", "SUBMARINE_PEN", "CANYON",
+        "MOUNTAIN_PASS", "UNKNOWN_1", "WATERFALL", "GOLD_SAUCER_DESERT", "JUNGLE", "SEA",
+        "NORTHERND_CAVE", "GOLD_SAUCER_DESERT_BORDER", "BRIDGE_HEAD", "BACK_ENTRANCE",
+    },
+    0.75,
+    {"GRASS", "NORTHERND_CAVE"}
+)
+EntityContainer["WorldMapHighwind"].board = function(self)
+    local player_entity = entity_manager:get_player_entity()
+    local vehicle_entity = entity_manager:get_entity(self.entity_name)
+    if not player_entity or not vehicle_entity then
+        return false
+    end
+    local player_name = player_entity:get_name()
+    if player_name ~= "WorldMapCloud" and player_name ~= "WorldMapChocobo" then
+        show_vehicle_error("Leave your current vehicle before boarding another.")
+        return false
+    end
+    vehicle_entity:move_by(0, self.rise_amount, 0)
+    player_entity:set_visible(false)
+    player_entity:set_solid(false)
+    player_entity:set_talkable(false)
+    world_map_module:clear_vehicle_terrains()
+    for _, terrain_name in ipairs(self.terrains) do
+        world_map_module:add_vehicle_terrain(terrain_name)
+    end
+    entity_manager:set_player_entity(self.entity_name)
+    return true
+end
+EntityContainer["WorldMapHighwind"].unboard = function(self)
+    if not is_unboarding_terrain_allowed(self) then
+        show_vehicle_error("The Highwind cannot be unboarded on this terrain.")
+        return false
+    end
+    if not world_map_module:unboard_vehicle(self.entity_name) then
+        return false
+    end
+
+    local vehicle_entity = entity_manager:get_entity(self.entity_name)
+    if vehicle_entity then
+        vehicle_entity:move_by(0, -self.rise_amount, 0)
+    end
+    return true
+end
+
+EntityContainer["WorldMapBuggy"] = extend_vehicle(
+    "WorldMapBuggy",
+    {
+        "GRASS", "FOREST", "SWAMP", "DESERT", "WASTELAND", "SNOW", "RIVERSIDE",
+        "COREL_BRIDGE", "WUTAI_BRIDGE", "HILL_SIDE", "BEACH", "RIVER_CROSSING", "CANYON",
+        "MOUNTAIN_PASS", "GOLD_SAUCER_DESERT", "JUNGLE", "GOLD_SAUCER_DESERT_BORDER",
+        "BRIDGE_HEAD", "BACK_ENTRANCE",
+    },
+    0,
+    {
+        "GRASS", "FOREST", "WASTELAND", "SNOW", "SWAMP", "DESERT", "COREL_BRIDGE",
+        "HILL_SIDE", "BEACH", "CANYON", "MOUNTAIN_PASS", "JUNGLE",
+    }
+)
+EntityContainer["WorldMapBuggy"].board = function(self)
+    local player_entity = entity_manager:get_player_entity()
+    local vehicle_entity = entity_manager:get_entity(self.entity_name)
+    if not player_entity or not vehicle_entity then
+        return false
+    end
+    if player_entity:get_name() ~= "WorldMapCloud" then
+        show_vehicle_error("Leave your current vehicle before boarding another.")
+        return false
+    end
+    player_entity:set_visible(false)
+    player_entity:set_solid(false)
+    player_entity:set_talkable(false)
+    world_map_module:clear_vehicle_terrains()
+    for _, terrain_name in ipairs(self.terrains) do
+        world_map_module:add_vehicle_terrain(terrain_name)
+    end
+    entity_manager:set_player_entity(self.entity_name)
+    return true
+end
+EntityContainer["WorldMapBuggy"].unboard = function(self)
+    if not is_unboarding_terrain_allowed(self) then
+        show_vehicle_error("The Buggy cannot be unboarded on this terrain.")
+        return false
+    end
+    return world_map_module:unboard_vehicle(self.entity_name)
+end
+
+EntityContainer["WorldMapChocobo"] = extend_vehicle(
+    "WorldMapChocobo",
+    copy_terrain_list(chocobo_terrains_by_color.YELLOW),
+    0,
+    {
+        "GRASS", "FOREST", "WASTELAND", "SNOW", "SWAMP", "DESERT", "COREL_BRIDGE",
+        "HILL_SIDE", "BEACH", "CANYON", "MOUNTAIN_PASS", "JUNGLE",
+    }
+)
+EntityContainer["WorldMapChocobo"].color = "YELLOW"
+EntityContainer["WorldMapChocobo"].set_color = function(self, color)
+    if type(color) ~= "string" then
+        return false
+    end
+
+    local color_name = string.upper(color)
+    local terrains = chocobo_terrains_by_color[color_name]
+    if not terrains then
+        show_vehicle_error("Unknown Chocobo color: " .. color_name)
+        return false
+    end
+
+    self.color = color_name
+    self.terrains = copy_terrain_list(terrains)
+    local player_entity = entity_manager:get_player_entity()
+    if player_entity and player_entity:get_name() == self.entity_name then
+        world_map_module:clear_vehicle_terrains()
+        for _, terrain_name in ipairs(self.terrains) do
+            world_map_module:add_vehicle_terrain(terrain_name)
+        end
+    end
+    return true
+end
+EntityContainer["WorldMapChocobo"].board = function(self)
+    local player_entity = entity_manager:get_player_entity()
+    local vehicle_entity = entity_manager:get_entity(self.entity_name)
+    if not player_entity or not vehicle_entity then
+        return false
+    end
+    if player_entity:get_name() ~= "WorldMapCloud" then
+        show_vehicle_error("Leave your current vehicle before boarding another.")
+        return false
+    end
+    player_entity:set_visible(false)
+    player_entity:set_solid(false)
+    player_entity:set_talkable(false)
+    world_map_module:clear_vehicle_terrains()
+    for _, terrain_name in ipairs(self.terrains) do
+        world_map_module:add_vehicle_terrain(terrain_name)
+    end
+    entity_manager:set_player_entity(self.entity_name)
+    return true
+end
+EntityContainer["WorldMapChocobo"].unboard = function(self)
+    if not is_unboarding_terrain_allowed(self) then
+        show_vehicle_error("The Chocobo cannot be unboarded on this terrain.")
+        return false
+    end
+    return world_map_module:unboard_vehicle(self.entity_name)
+end
+
+EntityContainer["WorldMapSubmarine"] = extend_vehicle(
+    "WorldMapSubmarine",
+    {"SEA_DEEP_WATER", "SEA", "SUBMARINE_PEN"},
+    0,
+    {"SUBMARINE_PEN"}
+)
+EntityContainer["WorldMapSubmarine"].board = function(self)
+    local player_entity = entity_manager:get_player_entity()
+    local vehicle_entity = entity_manager:get_entity(self.entity_name)
+    if not player_entity or not vehicle_entity then
+        return false
+    end
+    if player_entity:get_name() ~= "WorldMapCloud" then
+        show_vehicle_error("Leave your current vehicle before boarding another.")
+        return false
+    end
+    player_entity:set_visible(false)
+    player_entity:set_solid(false)
+    player_entity:set_talkable(false)
+    world_map_module:clear_vehicle_terrains()
+    for _, terrain_name in ipairs(self.terrains) do
+        world_map_module:add_vehicle_terrain(terrain_name)
+    end
+    entity_manager:set_player_entity(self.entity_name)
+    return true
+end
+EntityContainer["WorldMapSubmarine"].unboard = function(self)
+    if not is_unboarding_terrain_allowed(self) then
+        show_vehicle_error("The Submarine cannot be unboarded on this terrain.")
+        return false
+    end
+    return world_map_module:unboard_vehicle(self.entity_name)
+end
+
+EntityContainer["WorldMapTinyBronco"] = extend_vehicle(
+    "WorldMapTinyBronco",
+    {
+        "RIVERSIDE", "BEACH", "RIVER_CROSSING", "RIVER", "WATER",
+    },
+    0,
+    {"BEACH", "RIVERSIDE"}
+)
+EntityContainer["WorldMapTinyBronco"].board = function(self)
+    local player_entity = entity_manager:get_player_entity()
+    local vehicle_entity = entity_manager:get_entity(self.entity_name)
+    if not player_entity or not vehicle_entity then
+        return false
+    end
+    if player_entity:get_name() ~= "WorldMapCloud" then
+        show_vehicle_error("Leave your current vehicle before boarding another.")
+        return false
+    end
+    player_entity:set_visible(false)
+    player_entity:set_solid(false)
+    player_entity:set_talkable(false)
+    world_map_module:clear_vehicle_terrains()
+    for _, terrain_name in ipairs(self.terrains) do
+        world_map_module:add_vehicle_terrain(terrain_name)
+    end
+    entity_manager:set_player_entity(self.entity_name)
+    return true
+end
+EntityContainer["WorldMapTinyBronco"].unboard = function(self)
+    if not is_unboarding_terrain_allowed(self) then
+        show_vehicle_error("The Tiny Bronco cannot be unboarded on this terrain.")
+        return false
+    end
+    return world_map_module:unboard_vehicle(self.entity_name)
+end

+ 1 - 0
data/data/texts/english/menu.xml

@@ -135,5 +135,6 @@
     <text name="BattleUiMp">MP</text>
     <text name="BattleUiLimit">LIMIT</text>
     <text name="BattleUiTime">TIME</text>
+    <text name="GameOverText">GAME OVER</text>
     <text name="BattleUiDebugExit">Debug: Press 'K' to end battle.</text>
 </texts>

+ 1 - 1
debian/control

@@ -2,7 +2,7 @@ Source: v-gears
 Section: games
 Priority: extra
 Maintainer: I�igo Valentin <i@inigovalentin.com>
-Build-Depends: debhelper(>= 7.0.50~),libogre-1.12-dev, libtiyxml-dev, cmake, cdbs, libois-dev, libboost-program-options-dev, libboost-filesystem-dev, libvorbis-dev, libopenal-dev, libboost-test-dev, zlib1g-dev, libqt5core5a, libqt5widgets5
+Build-Depends: debhelper(>= 7.0.50~),libogre-1.12-dev, libtiyxml-dev, cmake, cdbs, libois-dev, libboost-program-options-dev, libboost-filesystem-dev, libvorbis-dev, libopenal-dev, libboost-test-dev, zlib1g-dev, libqt5core5a, libqt5widgets5, libluajit-5.1-dev
 Standards-Version: 3.9.5
 Homepage: https://v-gears.inigovalentin.com
 Vcs-Git: git://https://github.com/v-gears/v-gears.git

+ 2 - 0
debian/install

@@ -1,4 +1,6 @@
 v-gears.desktop /usr/share/applications
 v-gears.png /usr/share/pixmaps
+v-gears-installer.desktop /usr/share/applications
+v-gears-installer.png /usr/share/pixmaps
 v-gears-launcher /usr/bin
 output/resources.cfg /usr/share/v-gears

+ 1 - 1
doc/BUILD.md

@@ -4,7 +4,7 @@
 If you are runind Debian (or derivates), you can install the required dependencies by running as root
 
 ```bash
-apt install g++ cmake libqt5widgets5 qtbase5-dev zlib1g-dev libogre-1.12-dev libois-dev libvorbis-dev libboost-dev libboost-program-options-dev libboost-test-dev libboost-filesystem-dev libboost-thread-dev lua5.2 liblua5.2-dev libluabind-dev luajit libopenal-dev libtinyxml-dev
+apt install g++ cmake libqt5widgets5 qtbase5-dev zlib1g-dev libogre-1.12-dev libois-dev libvorbis-dev libboost-dev libboost-program-options-dev libboost-test-dev libboost-filesystem-dev libboost-thread-dev libopenal-dev libtinyxml-dev libluajit-5.1-dev
 ```
 
 ## Deterministic fallbacks

+ 0 - 27
lib/CMakeLists.txt

@@ -1,27 +0,0 @@
-add_subdirectory(luajit) # LuaJIT has its own configuration.
-
-add_subdirectory(sfxdump) # SFXDump has its own configuration.
-
-# Collect luabind sources and headers explicitly and create a modern target.
-file(GLOB_RECURSE LUABIND_SRC_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
-    "luabind/src/*.cpp"
-    "luabind/src/*.c"
-)
-file(GLOB_RECURSE LUABIND_HEADER_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
-    "luabind/luabind/*.h"
-    "luabind/luabind/*.hpp"
-    "luabind/luabind/detail/*.h"
-    "luabind/luabind/detail/*.hpp"
-)
-
-add_library(libluabind STATIC ${LUABIND_SRC_FILES} ${LUABIND_HEADER_FILES})
-
-target_include_directories(libluabind
-    PUBLIC
-        ${CMAKE_CURRENT_SOURCE_DIR}/luabind
-        ${CMAKE_CURRENT_SOURCE_DIR}/luajit/src
-        ${CMAKE_CURRENT_SOURCE_DIR}/luabind/luabind
-        ${CMAKE_CURRENT_SOURCE_DIR}/luabind/luabind/detail
-)
-
-set_target_properties(libluabind PROPERTIES FOLDER "lib")

+ 0 - 4
lib/luabind/.gitignore

@@ -1,4 +0,0 @@
-bin.v2
-bin
-doc/*.html
-doc/version.rst

+ 0 - 65
lib/luabind/INSTALL

@@ -1,65 +0,0 @@
-luabind installation
-====================
-
-The build system used by luabind is Boost Build V2, which can be found
-at:
-
-  http://www.boost.org/doc/tools/build/index.html
-
-The installation instructions are available at:
-
-  http://www.boost.org/doc/tools/build/doc/html/bbv2/installation.html
-
-If you are using Debian or Ubuntu, you can simply install the
-"boost-build" package:
-
-  $ sudo apt-get install boost-build
-
-Other distributions may have similar packages.
-
-On Windows, you can download pre-built "bjam" binaries, and follow the
-installation instructions on the page linked above.
-
-
-Windows
--------
-
-The environment variable "BOOST_ROOT" must be set to the directory where Boost
-was extracted. "LUA_PATH" must be set to a directory where Lua binaries and
-headers reside. The recommended way to get the Lua libraries is to download the
-"DLL and Includes" package from:
-
-  http://luabinaries.luaforge.net/download.html
-
-With these enviroment variables properly set:
-
-  $ set BOOST_ROOT=...
-  $ set LUA_PATH=...
-  $ bjam stage
-
-Will build the default library variants and place them in a directory called
-"stage". This can be controlled with the "--stagedir" option:
-
-  $ bjam --stagedir=libs stage
-
-Would place the libraries in a "libs" directory.
-
-Note that there is nothing magic going on here. If you don't want to
-build the libraries this way, or run the tests, there is nothing
-stopping you from using whatever build system you want. For example,
-simply dropping the source files in a Visual Studio project should just
-work. The only requirement is that "LUABIND_DYNAMIC_LINK" must be
-defined when building and linking to a shared library.
-
-\*nix
------
-
-  $ bjam install
-
-Will build and install the default library variants, and install them together
-with the header files to the default prefix, which is "/usr/local". The install
-prefix can be controlled with the "--prefix" option. For example:
-
-  $ bjam --prefix=/usr install
-
-Will install to "/usr/lib" and "/usr/include".

+ 0 - 248
lib/luabind/Jamroot

@@ -1,248 +0,0 @@
-import docutils ;
-import os ;
-import errors ;
-import notfile ;
-import package ;
-import path ;
-import virtual-target ;
-
-VERSION = 0.9.0 ;
-BOOST_ROOT = [ os.environ BOOST_ROOT ] ;
-
-rule debug-message ( txt * )
-{
-    if --debug-build in [ modules.peek : ARGV ]
-    {
-        echo [luabind DEBUG] $(txt) ;
-    }
-}
-
-debug-message figuring out which libraries to link to... ;
-debug-message os.name is [ os.name ] ;
-
-if [ os.name ] = NT
-{
-    if ! $(BOOST_ROOT)
-    {
-        errors.user-error "*** BOOST_ROOT must be set to a Boost installation." ;
-    }
-
-    LUA_PATH = [ os.environ LUA_PATH ] ;
-
-    if ! $(LUA_PATH)
-    {
-        errors.user-error "*** LUA_PATH must be set." ;
-    }
-
-    local includes = [ GLOB $(LUA_PATH)/include $(LUA_PATH)/src : lua.h ] ;
-
-    if ! $(includes)
-    {
-        errors.user-error "*** Unable to determine Lua include directory." ;
-    }
-
-    includes = $(includes:D) ;
-
-    debug-message found include directory in $(includes) ;
-
-    if [ GLOB $(LUA_PATH) : lib ]
-    {
-        lib lua : : <link>static <name>lua5.1 <search>$(LUA_PATH)/lib/static : : <include>$(includes) ;
-        lib lua : : <link>shared <name>lua5.1 <search>$(LUA_PATH)/lib : : <include>$(includes) ;
-    }
-    else if [ GLOB $(LUA_PATH) : lua5.1.dll ]
-    {
-        lib lua : : <name>lua5.1 <search>$(LUA_PATH) : : <include>$(includes) ;
-    }
-}
-else if [ os.name ] in LINUX MACOSX FREEBSD
-{
-    LUA_PATH = [ os.environ LUA_PATH ] ;
-    HOME = [ os.environ HOME ] ;
-
-    local possible-prefixes =
-        $(LUA_PATH) $(HOME)/Library/Frameworks /Library/Frameworks /usr /usr/local /opt/local /opt ;
-
-    local possible-suffixes =
-        include/lua5.1 include/lua51 include/lua include ;
-
-    local includes = [ GLOB $(possible-prefixes)/$(possible-suffixes) : lua.h ] ;
-
-    if ! $(includes)
-    {
-        errors.user-error "*** Unable to determine Lua include directory." ;
-    }
-
-    local includes = $(includes[1]:D) ;
-    local prefix = $(includes:D) ;
-
-    if $(prefix:B) = "include"
-    {
-        prefix = $(prefix:D) ;
-    }
-
-    local lib = $(prefix)/lib ;
-
-    local names = liblua5.1 liblua51 liblua ;
-    local extensions = .a .so ;
-
-    library = [ GLOB $(lib)/lua51 $(lib)/lua5.1 $(lib)/lua $(lib) :
-        $(names)$(extensions) ] ;
-    lib-name = [ MATCH "lib(.*)" : $(library[1]:B) ] ;
-
-    debug-message prefix: $(prefix) ;
-    debug-message includes: $(includes) ;
-    debug-message lib: $(library:D) ;
-    debug-message candidates: $(library) ;
-    debug-message linking to: $(lib-name) ;
-
-    if ! $(lib-name)
-    {
-        errors.user-error "*** Unable to find Lua library." ;
-    }
-
-    lib m : : <link>shared ;
-    if [ os.name ] = LINUX
-    {
-        lib dl : : <link>shared ;
-    }
-    else
-    {
-        alias dl ;
-    }
-    lib lua : m dl : <name>$(lib-name) <search>$(library:D) : : <include>$(includes) ;
-}
-
-rule tag-names ( name : type ? : property-set )
-{
-    if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB &&
-        [ $(property-set).get <variant> ] = debug
-    {
-        name = $(name)d ;
-    }
-
-    local result = [ virtual-target.add-prefix-and-suffix $(name) : $(type) : $(property-set) ] ;
-
-    if $(type) = SHARED_LIB &&
-        ( ! ( [ $(property-set).get <target-os> ] in windows cygwin darwin aix ) &&
-          ! ( [ $(property-set).get <toolset> ] in pgi ) )
-    {
-        result = $(result).$(VERSION) ;
-    }
-
-    return $(result) ;
-}
-
-SOURCES =
-    class.cpp
-    class_info.cpp
-    class_registry.cpp
-    class_rep.cpp
-    create_class.cpp
-    error.cpp
-    exception_handler.cpp
-    function.cpp
-    inheritance.cpp
-    link_compatibility.cpp
-    object_rep.cpp
-    open.cpp
-    pcall.cpp
-    scope.cpp
-    stack_content_by_name.cpp
-    weak_ref.cpp
-    wrapper_base.cpp ;
-
-usage-requirements =
-    <library>lua
-    <toolset>msvc,<link>shared:<cxxflags>/wd4251
-    <link>shared:<define>LUABIND_DYNAMIC_LINK
-    <tag>@tag-names ;
-
-lib luabind
-    : src/$(SOURCES)
-    # requirements
-    : <include>. <include>$(BOOST_ROOT)
-      $(usage-requirements)
-    # default-build
-    :
-    # usage-requirements
-    : <include>. <include>$(BOOST_ROOT)
-      $(usage-requirements)
-    ;
-
-alias test
-  : test//test
-  # requirements
-  :
-  # default-build
-  : <link>static <link>shared release debug ;
-
-explicit test ;
-
-rule git-describe ( )
-{
-    local result = [ SHELL "git describe HEAD 2>&1" : exit-status ] ;
-
-    if $(result[2]) = 0
-    {
-        return [ MATCH "^v([a-zA-Z.0-9\\-]+)" : $(result[1]) ] ;
-    }
-}
-
-version-tag = [ git-describe ] ;
-
-if $(version-tag)
-{
-    actions make-version-file
-    {
-        echo ".. |version| replace:: $(version-tag)" > doc/version.rst
-    }
-
-    notfile make-version-file : @make-version-file ;
-}
-else
-{
-    alias make-version-file ;
-}
-
-if docs in [ modules.peek : ARGV ] 
-{
-    local result = [ SHELL "rst2html.py --version 2>&1" : exit-status ] ;
-    if $(result[2]) = 0
-    {
-        found-rst2html = rst2html.py ;
-    }
-}
-
-html docs.html
-  : doc/docs.rst
-  : <dependency>make-version-file
-    <docutils-cmd>$(found-rst2html)
-    <docutils-html>"--traceback -gdt --stylesheet=style.css --link-stylesheet" ;
-
-stage docs : docs.html : <location>doc ;
-explicit docs docs.html make-version-file ;
-
-headers = [ path.glob-tree luabind : *.hpp ] ;
-
-package.install install
-  : <install-header-subdir>luabind
-    <install-source-root>luabind
-    <install-no-version-symlinks>on
-  :
-  : luabind
-  : $(headers)
-  ;
-
-local stage-locate = [ MATCH "^--stagedir=(.*)" : [ modules.peek : ARGV ] ] ;
-stage-locate ?= stage ;
-
-install stage
-  : luabind
-  : <location>$(stage-locate)
-    <install-no-version-symlinks>on
-    <install-dependencies>on
-    <install-type>LIB
-  ;
-
-explicit stage ;

+ 0 - 22
lib/luabind/LICENSE

@@ -1,22 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-

+ 0 - 167
lib/luabind/luabind/adopt_policy.hpp

@@ -1,167 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_ADOPT_POLICY_HPP_INCLUDED
-#define LUABIND_ADOPT_POLICY_HPP_INCLUDED
-
-#include <luabind/config.hpp>
-#include <luabind/wrapper_base.hpp>
-#include <luabind/detail/policy.hpp>
-#include <luabind/back_reference_fwd.hpp>
-#include <luabind/wrapper_base.hpp>
-#include <boost/type_traits/is_polymorphic.hpp>
-
-namespace luabind { namespace detail 
-{
-    template <class T>
-    void adjust_backref_ownership(T* ptr, mpl::true_)
-    {
-        if (wrap_base* p = dynamic_cast<wrap_base*>(ptr))
-        {
-            wrapped_self_t& wrapper = wrap_access::ref(*p);
-            wrapper.get(wrapper.state());
-            wrapper.m_strong_ref.set(wrapper.state());
-        }
-    }
-
-    inline void adjust_backref_ownership(void*, mpl::false_)
-    {}
-
-	template <class Pointer, class Direction = lua_to_cpp>
-    struct adopt_pointer : pointer_converter
-	{
-		typedef adopt_pointer type;
-
-        int const consumed_args(...)
-        {
-            return 1;
-        }
-
-		template<class T>
-		T* apply(lua_State* L, by_pointer<T>, int index)
-		{
-            T* ptr = pointer_converter::apply(
-                L, LUABIND_DECORATE_TYPE(T*), index);
-
-            object_rep* obj = static_cast<object_rep*>(
-                lua_touserdata(L, index));
-            obj->release();
-
-            adjust_backref_ownership(ptr, boost::is_polymorphic<T>());
-
-            return ptr;
-		}
-
-		template<class T>
-		int match(lua_State* L, by_pointer<T>, int index)
-		{
-            return pointer_converter::match(
-                L, LUABIND_DECORATE_TYPE(T*), index);
-		}
-
-		template<class T>
-		void converter_postcall(lua_State*, T, int) {}
-	};
-
-    template <class Pointer, class T>
-    struct pointer_or_default
-    {
-        typedef Pointer type;
-    };
-
-    template <class T>
-    struct pointer_or_default<void, T>
-    {
-        typedef std::auto_ptr<T> type;
-    };
-
-	template <class Pointer>
-	struct adopt_pointer<Pointer, cpp_to_lua>
-	{
-		typedef adopt_pointer type;
-
-		template<class T>
-		void apply(lua_State* L, T* ptr)
-		{
-			if (ptr == 0) 
-			{
-				lua_pushnil(L);
-				return;
-			}
-
-			// if there is a back_reference, then the
-			// ownership will be removed from the
-			// back reference and put on the lua stack.
-			if (luabind::move_back_reference(L, ptr))
-				return;
-
-            typedef typename pointer_or_default<Pointer, T>::type
-                pointer_type;
-
-            make_instance(L, pointer_type(ptr));
-		}
-	};
-
-	template <int N, class Pointer = void>
-	struct adopt_policy : conversion_policy<N>
-	{
-//		BOOST_STATIC_CONSTANT(int, index = N);
-
-		static void precall(lua_State*, const index_map&) {}
-		static void postcall(lua_State*, const index_map&) {}
-
-		struct only_accepts_nonconst_pointers {};
-
-		template<class T, class Direction>
-		struct apply
-		{
-			typedef luabind::detail::is_nonconst_pointer<T> is_nonconst_p;
-			typedef typename boost::mpl::if_<
-                is_nonconst_p
-              , adopt_pointer<Pointer, Direction>
-              , only_accepts_nonconst_pointers
-            >::type type;
-		};
-	};
-
-}}
-
-namespace luabind
-{
-	template<int N>
-	detail::policy_cons<detail::adopt_policy<N>, detail::null_type> 
-	adopt(LUABIND_PLACEHOLDER_ARG(N))
-	{ 
-		return detail::policy_cons<detail::adopt_policy<N>, detail::null_type>(); 
-	}
-
-    template <class Pointer, int N>
-    detail::policy_cons<detail::adopt_policy<N, Pointer>, detail::null_type>
-    adopt(LUABIND_PLACEHOLDER_ARG(N))
-    {
-        return detail::policy_cons<detail::adopt_policy<N, Pointer>, detail::null_type>();
-    }
-}
-
-#endif // LUABIND_ADOPT_POLICY_HPP_INCLUDE
-

+ 0 - 112
lib/luabind/luabind/back_reference.hpp

@@ -1,112 +0,0 @@
-// Copyright (c) 2004 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-#ifndef LUABIND_BACK_REFERENCE_040510_HPP
-#define LUABIND_BACK_REFERENCE_040510_HPP
-
-#include <luabind/lua_include.hpp>
-#include <luabind/wrapper_base.hpp>
-#include <luabind/detail/has_get_pointer.hpp>
-#include <luabind/get_pointer.hpp>
-#include <boost/type_traits/is_polymorphic.hpp>
-#include <boost/type_traits/is_const.hpp>
-#include <boost/mpl/if.hpp>
-
-namespace luabind {
-
-namespace detail
-{
-  namespace mpl = boost::mpl;
- 
-  template<class T>
-  wrap_base const* get_back_reference_aux0(T const* p, mpl::true_)
-  {
-      return dynamic_cast<wrap_base const*>(p);
-  }
-
-  template<class T>
-  wrap_base const* get_back_reference_aux0(T const*, mpl::false_)
-  {
-      return 0;
-  }
-
-  template<class T>
-  wrap_base const* get_back_reference_aux1(T const* p)
-  {
-      return get_back_reference_aux0(p, boost::is_polymorphic<T>());
-  }
-
-  template<class T>
-  wrap_base const* get_back_reference_aux2(T const& x, mpl::true_)
-  {
-      return get_back_reference_aux1(get_pointer(x));
-  }
-
-  template<class T>
-  wrap_base const* get_back_reference_aux2(T const& x, mpl::false_)
-  {
-      return get_back_reference_aux1(&x);
-  }
-
-  template<class T>
-  wrap_base const* get_back_reference(T const& x)
-  {
-      return detail::get_back_reference_aux2(
-          x
-        , has_get_pointer<T>()
-      );
-  }
-  
-} // namespace detail
-
-template<class T>
-bool get_back_reference(lua_State* L, T const& x)
-{
-#ifndef LUABIND_NO_RTTI
-    if (wrap_base const* w = detail::get_back_reference(x))
-    {
-        detail::wrap_access::ref(*w).get(L);
-        return true;
-    }
-#endif
-    return false;
-}
-
-template<class T>
-bool move_back_reference(lua_State* L, T const& x)
-{
-#ifndef LUABIND_NO_RTTI
-    if (wrap_base* w = const_cast<wrap_base*>(detail::get_back_reference(x)))
-    {
-        assert(detail::wrap_access::ref(*w).m_strong_ref.is_valid());
-        detail::wrap_access::ref(*w).get(L);
-        detail::wrap_access::ref(*w).m_strong_ref.reset();
-        return true;
-    }
-#endif
-    return false;
-}
-
-} // namespace luabind
-
-#endif // LUABIND_BACK_REFERENCE_040510_HPP
-

+ 0 - 37
lib/luabind/luabind/back_reference_fwd.hpp

@@ -1,37 +0,0 @@
-// Copyright (c) 2004 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-#ifndef LUABIND_BACK_REFERENCE_FWD_040510_HPP
-#define LUABIND_BACK_REFERENCE_FWD_040510_HPP
-
-namespace luabind {
-
-template<class T>
-bool get_back_reference(lua_State* L, T const& x);
-
-template<class T>
-bool move_back_reference(lua_State* L, T const& x);
-
-} // namespace luabind
-
-#endif // LUABIND_BACK_REFERENCE_FWD_040510_HPP
-

+ 0 - 942
lib/luabind/luabind/class.hpp

@@ -1,942 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_CLASS_HPP_INCLUDED
-#define LUABIND_CLASS_HPP_INCLUDED
-
-/*
-	ISSUES:
-	------------------------------------------------------
-
-	* solved for member functions, not application operator *
-	if we have a base class that defines a function a derived class must be able to
-	override that function (not just overload). Right now we just add the other overload
-	to the overloads list and will probably get an ambiguity. If we want to support this
-	each method_rep must include a vector of type_info pointers for each parameter.
-	Operators do not have this problem, since operators always have to have
-	it's own type as one of the arguments, no ambiguity can occur. Application
-	operator, on the other hand, would have this problem.
-	Properties cannot be overloaded, so they should always be overridden.
-	If this is to work for application operator, we really need to specify if an application
-	operator is const or not.
-
-	If one class registers two functions with the same name and the same
-	signature, there's currently no error. The last registered function will
-	be the one that's used.
-	How do we know which class registered the function? If the function was
-	defined by the base class, it is a legal operation, to override it.
-	we cannot look at the pointer offset, since it always will be zero for one of the bases.
-
-
-
-	TODO:
-	------------------------------------------------------
-
- 	finish smart pointer support
-		* the adopt policy should not be able to adopt pointers to held_types. This
-		must be prohibited.
-		* name_of_type must recognize holder_types and not return "custom"
-
-	document custom policies, custom converters
-
-	store the instance object for policies.
-
-	support the __concat metamethod. This is a bit tricky, since it cannot be
-	treated as a normal operator. It is a binary operator but we want to use the
-	__tostring implementation for both arguments.
-	
-*/
-
-#include <luabind/prefix.hpp>
-#include <luabind/config.hpp>
-
-#include <string>
-#include <cassert>
-
-#ifndef LUABIND_CPP0x
-#include <boost/preprocessor/repetition/enum_params.hpp>
-#include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
-#include <boost/preprocessor/repetition/repeat.hpp>
-#endif
-#include <boost/type_traits/is_same.hpp>
-#include <boost/type_traits/is_member_object_pointer.hpp>
-#include <boost/mpl/apply.hpp>
-#include <boost/mpl/lambda.hpp>
-#include <boost/mpl/logical.hpp>
-#include <boost/mpl/find_if.hpp>
-#include <boost/mpl/eval_if.hpp>
-#include <boost/mpl/logical.hpp>
-#include <boost/mpl/vector/vector10.hpp>
-
-#include <luabind/config.hpp>
-#include <luabind/scope.hpp>
-#include <luabind/back_reference.hpp>
-#include <luabind/function.hpp>
-#include <luabind/dependency_policy.hpp>
-#include <luabind/detail/constructor.hpp>
-#include <luabind/detail/call.hpp>
-#include <luabind/detail/deduce_signature.hpp>
-#include <luabind/detail/primitives.hpp>
-#include <luabind/detail/property.hpp>
-#include <luabind/detail/typetraits.hpp>
-#include <luabind/detail/class_rep.hpp>
-#include <luabind/detail/call.hpp>
-#include <luabind/detail/object_rep.hpp>
-#include <luabind/detail/call_member.hpp>
-#include <luabind/detail/enum_maker.hpp>
-#include <luabind/detail/operator_id.hpp>
-#include <luabind/detail/pointee_typeid.hpp>
-#include <luabind/detail/link_compatibility.hpp>
-#include <luabind/detail/inheritance.hpp>
-#include <luabind/detail/signature_match.hpp>
-#include <luabind/no_dependency.hpp>
-#include <luabind/typeid.hpp>
-
-// to remove the 'this' used in initialization list-warning
-#ifdef _MSC_VER
-#pragma warning(push)
-#pragma warning(disable: 4355)
-#endif
-
-namespace boost
-{
-
-  template <class T> class shared_ptr;
-
-} // namespace boost
-
-namespace luabind
-{	
-	namespace detail
-	{
-		struct unspecified {};
-
-		template<class Derived> struct operator_;
-
-		struct you_need_to_define_a_get_const_holder_function_for_your_smart_ptr {};
-	}
-
-	template<class T, class X1 = detail::unspecified, class X2 = detail::unspecified, class X3 = detail::unspecified>
-	struct class_;
-
-	// TODO: this function will only be invoked if the user hasn't defined a correct overload
-	// maybe we should have a static assert in here?
-	inline detail::you_need_to_define_a_get_const_holder_function_for_your_smart_ptr*
-	get_const_holder(...)
-	{
-		return 0;
-	}
-
-	template <class T>
-	boost::shared_ptr<T const>* get_const_holder(boost::shared_ptr<T>*)
-	{
-		return 0;
-	}
-
-# ifdef LUABIND_CPP0x
-
-    template <class... Args>
-    struct bases
-    {};
-
-    typedef bases<> no_bases;
-
-# else
-
-    template <
-        BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(
-            LUABIND_MAX_BASES, class A, detail::null_type)
-    >
-    struct bases
-    {};
-
-    typedef bases<detail::null_type> no_bases;
-
-# endif // LUABIND_CPP0x
-
-	namespace detail
-	{
-        template <class T>
-        struct is_bases
-          : mpl::false_
-        {};
-
-# ifdef LUABIND_CPP0x
-        template <class... Args>
-        struct is_bases<bases<Args...> >
-          : mpl::true_
-        {};
-# else
-        template <BOOST_PP_ENUM_PARAMS(LUABIND_MAX_BASES, class A)>
-        struct is_bases<bases<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_BASES, A)> >
-          : mpl::true_
-        {};
-# endif
-
-        template <class T, class P>
-        struct is_unspecified
-          : mpl::apply1<P, T>
-        {};
-
-        template <class P>
-        struct is_unspecified<unspecified, P>
-          : mpl::true_
-        {};
-
-        template <class P>
-        struct is_unspecified_mfn
-        {
-            template <class T>
-            struct apply
-              : is_unspecified<T, P>
-            {};
-        };
-
-		template<class Predicate>
-		struct get_predicate
-		{
-            typedef mpl::protect<is_unspecified_mfn<Predicate> > type;
-		};
-
-        template <class Result, class Default>
-        struct result_or_default
-        {
-            typedef Result type;
-        };
-
-        template <class Default>
-        struct result_or_default<unspecified, Default>
-        {
-            typedef Default type;
-        };
-
-		template<class Parameters, class Predicate, class DefaultValue>
-		struct extract_parameter
-		{
-			typedef typename get_predicate<Predicate>::type pred;
-			typedef typename boost::mpl::find_if<Parameters, pred>::type iterator;
-            typedef typename result_or_default<
-                typename iterator::type, DefaultValue
-            >::type type;
-		};
-
-		// prints the types of the values on the stack, in the
-		// range [start_index, lua_gettop()]
-
-		LUABIND_API std::string stack_content_by_name(lua_State* L, int start_index);
-	
-		struct LUABIND_API create_class
-		{
-			static int stage1(lua_State* L);
-			static int stage2(lua_State* L);
-		};
-
-	} // detail
-
-	namespace detail {
-
-		template<class T>
-		struct static_scope
-		{
-			static_scope(T& self_) : self(self_)
-			{
-			}
-
-			T& operator[](scope s) const
-			{
-				self.add_inner_scope(s);
-				return self;
-			}
-
-		private:
-			template<class U> void operator,(U const&) const;
-			void operator=(static_scope const&);
-			
-			T& self;
-		};
-
-		struct class_registration;
-
-		struct LUABIND_API class_base : scope
-		{
-		public:
-			class_base(char const* name);		
-
-			struct base_desc
-			{
-				type_id type;
-				int ptr_offset;
-			};
-
-			void init(
-                type_id const& type, class_id id
-              , type_id const& wrapped_type, class_id wrapper_id);
-
-            void add_base(type_id const& base, cast_function cast);
-
-			void add_member(registration* member);
-			void add_default_member(registration* member);
-
-			const char* name() const;
-
-			void add_static_constant(const char* name, int val);
-			void add_inner_scope(scope& s);
-
-            void add_cast(class_id src, class_id target, cast_function cast);
-
-		private:
-			class_registration* m_registration;
-		};
-
-// MSVC complains about member being sensitive to alignment (C4121)
-// when F is a pointer to member of a class with virtual bases.
-# ifdef BOOST_MSVC
-#  pragma pack(push)
-#  pragma pack(16)
-# endif
-
-		template <class Class, class F, class Policies>
-		struct memfun_registration : registration
-		{
-			memfun_registration(char const* name, F f, Policies const& policies)
-			  : name(name)
-			  , f(f)
-			  , policies(policies)
-			{}
-
-			void register_(lua_State* L) const
-			{
-				object fn = make_function(
-					L, f, deduce_signature(f, (Class*)0), policies);
-
-				add_overload(
-					object(from_stack(L, -1))
-				  , name
-				  , fn
-				);
-			}
-
-			char const* name;
-			F f;
-			Policies policies;
-		};
-
-# ifdef BOOST_MSVC
-#  pragma pack(pop)
-# endif
-
-        template <class P, class T>
-        struct default_pointer
-        {
-            typedef P type;
-        };
-
-        template <class T>
-        struct default_pointer<null_type, T>
-        {
-            typedef std::auto_ptr<T> type;
-        };
-
-        template <class Class, class Pointer, class Signature, class Policies>
-        struct constructor_registration : registration
-        {
-            constructor_registration(Policies const& policies)
-              : policies(policies)
-            {}
-
-            void register_(lua_State* L) const
-            {
-                typedef typename default_pointer<Pointer, Class>::type pointer;
-
-                object fn = make_function(
-                    L
-                  , construct<Class, pointer, Signature>(), Signature()
-                  , policies
-                );
-
-                add_overload(
-                    object(from_stack(L, -1))
-                  , "__init"
-                  , fn
-                );
-            }
-
-            Policies policies;
-        };
-
-        template <class T>
-        struct reference_result
-          : mpl::if_<
-                mpl::or_<boost::is_pointer<T>, is_primitive<T> >
-              , T
-              , typename boost::add_reference<T>::type
-            >
-        {};
-
-        template <class T>
-        struct reference_argument
-          : mpl::if_<
-                mpl::or_<boost::is_pointer<T>, is_primitive<T> >
-              , T
-              , typename boost::add_reference<
-                    typename boost::add_const<T>::type
-                >::type
-            >
-        {};
-
-        template <class T, class Policies>
-        struct inject_dependency_policy
-          : mpl::if_<
-                mpl::or_<
-                    is_primitive<T>
-                  , has_policy<Policies, detail::no_dependency_policy>
-                >
-              , Policies
-              , policy_cons<dependency_policy<0, 1>, Policies>
-            >
-        {};
-
-        template <
-            class Class
-          , class Get, class GetPolicies
-          , class Set = null_type, class SetPolicies = null_type
-        >
-        struct property_registration : registration
-        {
-            property_registration(
-                char const* name
-              , Get const& get
-              , GetPolicies const& get_policies
-              , Set const& set = Set()
-              , SetPolicies const& set_policies = SetPolicies()
-            )
-              : name(name)
-              , get(get)
-              , get_policies(get_policies)
-              , set(set)
-              , set_policies(set_policies)
-            {}
-
-            void register_(lua_State* L) const
-            {
-                object context(from_stack(L, -1));
-                register_aux(
-                    L
-                  , context
-                  , make_get(L, get, boost::is_member_object_pointer<Get>())
-                  , set
-                );
-            }
-
-            template <class F>
-            object make_get(lua_State* L, F const& f, mpl::false_) const
-            {
-                return make_function(
-                    L, f, deduce_signature(f, (Class*)0), get_policies);
-            }
-
-            template <class T, class D>
-            object make_get(lua_State* L, D T::* mem_ptr, mpl::true_) const
-            {
-                typedef typename reference_result<D>::type result_type;
-                typedef typename inject_dependency_policy<
-                    D, GetPolicies>::type policies;
-
-                return make_function(
-                    L
-                  , access_member_ptr<T, D, result_type>(mem_ptr)
-                  , mpl::vector2<result_type, Class const&>()
-                  , policies()
-                );
-            }
-
-            template <class F>
-            object make_set(lua_State* L, F const& f, mpl::false_) const
-            {
-                return make_function(
-                    L, f, deduce_signature(f, (Class*)0), set_policies);
-            }
-
-            template <class T, class D>
-            object make_set(lua_State* L, D T::* mem_ptr, mpl::true_) const
-            {
-                typedef typename reference_argument<D>::type argument_type;
-
-                return make_function(
-                    L
-                  , access_member_ptr<T, D>(mem_ptr)
-                  , mpl::vector3<void, Class&, argument_type>()
-                  , set_policies
-                );
-            }
-
-            template <class S>
-            void register_aux(
-                lua_State* L, object const& context
-              , object const& get_, S const&) const
-            {
-                context[name] = property(
-                    get_
-                  , make_set(L, set, boost::is_member_object_pointer<Set>())
-                );
-            }
-
-            void register_aux(
-                lua_State*, object const& context
-              , object const& get_, null_type) const
-            {
-                context[name] = property(get_);
-            }
-
-            char const* name;
-            Get get;
-            GetPolicies get_policies;
-            Set set;
-            SetPolicies set_policies;
-        };
-
-	} // namespace detail
-
-	// registers a class in the lua environment
-	template<class T, class X1, class X2, class X3>
-	struct class_: detail::class_base 
-	{
-		typedef class_<T, X1, X2, X3> self_t;
-
-	private:
-
-		template<class A, class B, class C, class D>
-		class_(const class_<A,B,C,D>&);
-
-	public:
-
-        typedef boost::mpl::vector4<X1, X2, X3, detail::unspecified> parameters_type;
-
-		// WrappedType MUST inherit from T
-		typedef typename detail::extract_parameter<
-		    parameters_type
-		  , boost::is_base_and_derived<T, boost::mpl::_>
-		  , detail::null_type
-		>::type WrappedType;
-
-		typedef typename detail::extract_parameter<
-		    parameters_type
-		  , boost::mpl::not_<
-		        boost::mpl::or_<
-                    detail::is_bases<boost::mpl::_>
-                  , boost::is_base_and_derived<boost::mpl::_, T>
-                  , boost::is_base_and_derived<T, boost::mpl::_>
-				>
-			>
-		  , detail::null_type
-		>::type HeldType;
-
-        template <class Src, class Target>
-        void add_downcast(Src*, Target*, boost::mpl::true_)
-        {
-            add_cast(
-                detail::registered_class<Src>::id
-              , detail::registered_class<Target>::id
-              , detail::dynamic_cast_<Src, Target>::execute
-            );
-        }
-
-        template <class Src, class Target>
-        void add_downcast(Src*, Target*, boost::mpl::false_)
-        {}
-
-		// this function generates conversion information
-		// in the given class_rep structure. It will be able
-		// to implicitly cast to the given template type
-		template<class To>
-		void gen_base_info(detail::type_<To>)
-		{
-            add_base(typeid(To), detail::static_cast_<T, To>::execute);
-            add_cast(
-                detail::registered_class<T>::id
-              , detail::registered_class<To>::id
-              , detail::static_cast_<T, To>::execute
-            );
-
-            add_downcast((To*)0, (T*)0, boost::is_polymorphic<To>());
-		}
-
-		void gen_base_info(detail::type_<detail::null_type>)
-		{}
-
-# ifndef LUABIND_CPP0x
-
-#define LUABIND_GEN_BASE_INFO(z, n, text) gen_base_info(detail::type_<BaseClass##n>());
-
-		template<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_BASES, class BaseClass)>
-		void generate_baseclass_list(detail::type_<bases<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_BASES, BaseClass)> >)
-		{
-			BOOST_PP_REPEAT(LUABIND_MAX_BASES, LUABIND_GEN_BASE_INFO, _)
-		}
-
-#undef LUABIND_GEN_BASE_INFO
-
-# else // !LUABIND_CPP0x
-
-        template <class... Args>
-        void ignore(Args&&...)
-        {}
-
-        template <class... Bases>
-        void generate_baseclass_list(detail::type_<bases<Bases...> >)
-        {
-            ignore((gen_base_info(detail::type_<Bases>()), 0)...);
-        }
-
-# endif // !LUABIND_CPP0x
-
-		class_(const char* name): class_base(name), scope(*this)
-		{
-#ifndef NDEBUG
-			detail::check_link_compatibility();
-#endif
-		   	init(); 
-		}
-
-		template<class F>
-		class_& def(const char* name, F f)
-		{
-			return this->virtual_def(
-				name, f, detail::null_type()
-			  , detail::null_type(), boost::mpl::true_());
-		}
-
-		// virtual functions
-		template<class F, class DefaultOrPolicies>
-		class_& def(char const* name, F fn, DefaultOrPolicies default_or_policies)
-		{
-			return this->virtual_def(
-				name, fn, default_or_policies, detail::null_type()
-			  , LUABIND_MSVC_TYPENAME detail::is_policy_cons<DefaultOrPolicies>::type());
-		}
-
-		template<class F, class Default, class Policies>
-		class_& def(char const* name, F fn
-			, Default default_, Policies const& policies)
-		{
-			return this->virtual_def(
-				name, fn, default_
-			  , policies, boost::mpl::false_());
-		}
-
-# ifdef LUABIND_CPP0x
-
-        template <class... Args, class Policies = detail::null_type>
-        class_& def(constructor<Args...>, Policies const& policies = Policies())
-        {
-            return this->def_constructor((constructor<Args...>*)0, policies);
-        }
-
-# else
-
-		template<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_ARITY, class A)>
-		class_& def(constructor<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_ARITY, A)> sig)
-		{
-            return this->def_constructor(&sig, detail::null_type());
-		}
-
-		template<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_ARITY, class A), class Policies>
-		class_& def(constructor<BOOST_PP_ENUM_PARAMS(LUABIND_MAX_ARITY, A)> sig, const Policies& policies)
-		{
-            return this->def_constructor(&sig, policies);
-		}
-
-# endif // LUABIND_CPP0x
-
-        template <class Getter>
-        class_& property(const char* name, Getter g)
-        {
-            this->add_member(
-                new detail::property_registration<T, Getter, detail::null_type>(
-                    name, g, detail::null_type()));
-            return *this;
-        }
-
-        template <class Getter, class MaybeSetter>
-        class_& property(const char* name, Getter g, MaybeSetter s)
-        {
-            return property_impl(
-                name, g, s
-              , boost::mpl::bool_<detail::is_policy_cons<MaybeSetter>::value>()
-            );
-        }
-
-        template<class Getter, class Setter, class GetPolicies>
-        class_& property(const char* name, Getter g, Setter s, const GetPolicies& get_policies)
-        {
-            typedef detail::property_registration<
-                T, Getter, GetPolicies, Setter, detail::null_type
-            > registration_type;
-
-            this->add_member(
-                new registration_type(name, g, get_policies, s));
-            return *this;
-        }
-
-        template<class Getter, class Setter, class GetPolicies, class SetPolicies>
-        class_& property(
-            const char* name
-          , Getter g, Setter s
-          , GetPolicies const& get_policies
-          , SetPolicies const& set_policies)
-        {
-            typedef detail::property_registration<
-                T, Getter, GetPolicies, Setter, SetPolicies
-            > registration_type;
-
-            this->add_member(
-                new registration_type(name, g, get_policies, s, set_policies));
-            return *this;
-        }
-
-        template <class C, class D>
-        class_& def_readonly(const char* name, D C::*mem_ptr)
-        {
-            typedef detail::property_registration<T, D C::*, detail::null_type>
-                registration_type;
-
-            this->add_member(
-                new registration_type(name, mem_ptr, detail::null_type()));
-            return *this;
-        }
-
-        template <class C, class D, class Policies>
-        class_& def_readonly(const char* name, D C::*mem_ptr, Policies const& policies)
-        {
-            typedef detail::property_registration<T, D C::*, Policies>
-                registration_type;
-
-            this->add_member(
-                new registration_type(name, mem_ptr, policies));
-            return *this;
-        }
-
-        template <class C, class D>
-        class_& def_readwrite(const char* name, D C::*mem_ptr)
-        {
-            typedef detail::property_registration<
-                T, D C::*, detail::null_type, D C::*
-            > registration_type;
-
-            this->add_member(
-                new registration_type(
-                    name, mem_ptr, detail::null_type(), mem_ptr));
-            return *this;
-        }
-
-        template <class C, class D, class GetPolicies>
-        class_& def_readwrite(
-            const char* name, D C::*mem_ptr, GetPolicies const& get_policies)
-        {
-            typedef detail::property_registration<
-                T, D C::*, GetPolicies, D C::*
-            > registration_type;
-
-            this->add_member(
-                new registration_type(
-                    name, mem_ptr, get_policies, mem_ptr));
-            return *this;
-        }
-
-        template <class C, class D, class GetPolicies, class SetPolicies>
-        class_& def_readwrite(
-            const char* name
-          , D C::*mem_ptr
-          , GetPolicies const& get_policies
-          , SetPolicies const& set_policies
-        )
-        {
-            typedef detail::property_registration<
-                T, D C::*, GetPolicies, D C::*, SetPolicies
-            > registration_type;
-
-            this->add_member(
-                new registration_type(
-                    name, mem_ptr, get_policies, mem_ptr, set_policies));
-            return *this;
-        }
-
-		template<class Derived, class Policies>
-		class_& def(detail::operator_<Derived>, Policies const& policies)
-		{
-			return this->def(
-				Derived::name()
-			  , &Derived::template apply<T, Policies>::execute
-			  , policies
-			);
-		}
-
-		template<class Derived>
-		class_& def(detail::operator_<Derived>)
-		{
-			return this->def(
-				Derived::name()
-			  , &Derived::template apply<T, detail::null_type>::execute
-			);
-		}
-
-		detail::enum_maker<self_t> enum_(const char*)
-		{
-			return detail::enum_maker<self_t>(*this);
-		}
-		
-		detail::static_scope<self_t> scope;
-		
-	private:
-		void operator=(class_ const&);
-
-        void add_wrapper_cast(detail::null_type*)
-        {}
-
-        template <class U>
-        void add_wrapper_cast(U*)
-        {
-            add_cast(
-                detail::registered_class<U>::id
-              , detail::registered_class<T>::id
-              , detail::static_cast_<U,T>::execute
-            );
-
-            add_downcast((T*)0, (U*)0, boost::is_polymorphic<T>());
-        }
-
-		void init()
-		{
-			typedef typename detail::extract_parameter<
-					parameters_type
-				,	boost::mpl::or_<
-							detail::is_bases<boost::mpl::_>
-						,	boost::is_base_and_derived<boost::mpl::_, T>
-					>
-				,	no_bases
-			>::type bases_t;
-
-			typedef typename 
-				boost::mpl::if_<detail::is_bases<bases_t>
-					,	bases_t
-					,	bases<bases_t>
-				>::type Base;
-	
-            class_base::init(
-                typeid(T)
-              , detail::registered_class<T>::id
-              , typeid(WrappedType)
-              , detail::registered_class<WrappedType>::id
-            );
-
-            add_wrapper_cast((WrappedType*)0);
-
-			generate_baseclass_list(detail::type_<Base>());
-		}
-
-		template<class Getter, class GetPolicies>
-		class_& property_impl(const char* name,
-									 Getter g,
-									 GetPolicies policies,
-									 boost::mpl::bool_<true>)
-		{
-            this->add_member(
-                new detail::property_registration<T, Getter, GetPolicies>(
-                    name, g, policies));
-			return *this;
-		}
-
-		template<class Getter, class Setter>
-		class_& property_impl(const char* name,
-									 Getter g,
-									 Setter s,
-									 boost::mpl::bool_<false>)
-		{
-            typedef detail::property_registration<
-                T, Getter, detail::null_type, Setter, detail::null_type
-            > registration_type;
-
-            this->add_member(
-                new registration_type(name, g, detail::null_type(), s));
-			return *this;
-		}
-
-		// these handle default implementation of virtual functions
-		template<class F, class Policies>
-		class_& virtual_def(char const* name, F const& fn
-			, Policies const&, detail::null_type, boost::mpl::true_)
-		{
-			this->add_member(
-				new detail::memfun_registration<T, F, Policies>(
-					name, fn, Policies()));
-			return *this;
-		}
-
-		template<class F, class Default, class Policies>
-		class_& virtual_def(char const* name, F const& fn
-			, Default const& default_, Policies const&, boost::mpl::false_)
-		{
-			this->add_member(
-				new detail::memfun_registration<T, F, Policies>(
-					name, fn, Policies()));
-
-			this->add_default_member(
-				new detail::memfun_registration<T, Default, Policies>(
-					name, default_, Policies()));
-
-			return *this;
-		}
-
-        template<class Signature, class Policies>
-		class_& def_constructor(Signature*, Policies const&)
-        {
-            typedef typename Signature::signature signature;
-
-            typedef typename boost::mpl::if_<
-                boost::is_same<WrappedType, detail::null_type>
-              , T
-              , WrappedType
-            >::type construct_type;
-
-            this->add_member(
-                new detail::constructor_registration<
-                    construct_type, HeldType, signature, Policies>(
-                        Policies()));
-
-            this->add_default_member(
-                new detail::constructor_registration<
-                    construct_type, HeldType, signature, Policies>(
-                        Policies()));
-
-            return *this;
-        }
-	};
-
-}
-
-#ifdef _MSC_VER
-#pragma warning(pop)
-#endif
-
-#endif // LUABIND_CLASS_HPP_INCLUDED
-

+ 0 - 50
lib/luabind/luabind/class_info.hpp

@@ -1,50 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_CLASS_INFO_HPP_INCLUDED
-#define LUABIND_CLASS_INFO_HPP_INCLUDED
-
-#include <luabind/prefix.hpp>
-#include <luabind/lua_include.hpp>
-#include <luabind/luabind.hpp>
-#include <luabind/object.hpp>
-
-namespace luabind
-{
-	struct LUABIND_API class_info
-	{	
-		std::string name;
-		object methods;
-		object attributes;
-	};
-
-    LUABIND_API class_info get_class_info(argument const&);
-
-    // returns a table of bound class names
-    LUABIND_API object get_class_names(lua_State* L);
-
-	LUABIND_API void bind_class_info(lua_State*);
-}
-
-#endif
-

+ 0 - 137
lib/luabind/luabind/config.hpp

@@ -1,137 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_CONFIG_HPP_INCLUDED
-#define LUABIND_CONFIG_HPP_INCLUDED
-
-#include <boost/config.hpp>
-
-#ifdef BOOST_MSVC
-	#define LUABIND_ANONYMOUS_FIX static
-#else
-	#define LUABIND_ANONYMOUS_FIX
-#endif
-
-#if defined (BOOST_MSVC) && (BOOST_MSVC <= 1200)
-
-#define for if (false) {} else for
-
-#include <cstring>
-
-namespace std
-{
-	using ::strlen;
-	using ::strcmp;
-	using ::type_info;
-}
-
-#endif
-
-
-#if defined (BOOST_MSVC) && (BOOST_MSVC <= 1300)
-	#define LUABIND_MSVC_TYPENAME
-#else
-	#define LUABIND_MSVC_TYPENAME typename
-#endif
-
-// the maximum number of arguments of functions that's
-// registered. Must at least be 2
-#ifndef LUABIND_MAX_ARITY
-	#define LUABIND_MAX_ARITY 10
-#elif LUABIND_MAX_ARITY <= 1
-	#undef LUABIND_MAX_ARITY
-	#define LUABIND_MAX_ARITY 2
-#endif
-
-// the maximum number of classes one class
-// can derive from
-// max bases must at least be 1
-#ifndef LUABIND_MAX_BASES
-	#define LUABIND_MAX_BASES 4
-#elif LUABIND_MAX_BASES <= 0
-	#undef LUABIND_MAX_BASES
-	#define LUABIND_MAX_BASES 1
-#endif
-
-// LUABIND_NO_ERROR_CHECKING
-// define this to remove all error checks
-// this will improve performance and memory
-// footprint.
-// if it is defined matchers will only be called on
-// overloaded functions, functions that's
-// not overloaded will be called directly. The
-// parameters on the lua stack are assumed
-// to match those of the function.
-// exceptions will still be catched when there's
-// no error checking.
-
-// LUABIND_NOT_THREADSAFE
-// this define will make luabind non-thread safe. That is,
-// it will rely on a static variable. You can still have
-// multiple lua states and use coroutines, but only
-// one of your real threads may run lua code.
-
-// LUABIND_NO_EXCEPTIONS
-// this define will disable all usage of try, catch and throw in
-// luabind. This will in many cases disable runtime-errors, such
-// as invalid casts, when calling lua-functions that fails or
-// returns values that cannot be converted by the given policy.
-// Luabind requires that no function called directly or indirectly
-// by luabind throws an exception (throwing exceptions through
-// C code has undefined behavior, lua is written in C).
-
-#ifdef LUABIND_DYNAMIC_LINK
-# ifdef BOOST_WINDOWS
-#  ifdef LUABIND_BUILDING
-#   define LUABIND_API __declspec(dllexport)
-#  else
-#   define LUABIND_API __declspec(dllimport)
-#  endif
-# else
-#  if defined(_GNUC_) && _GNUC_ >=4
-#   define LUABIND_API __attribute__ ((visibility("default")))
-#  endif
-# endif
-#endif
-
-#ifndef LUABIND_API
-# define LUABIND_API
-#endif
-
-#if !defined(LUABIND_CPP0x) \
- && !defined(BOOST_NO_DECLTYPE) \
- && !defined(BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS) \
- && !defined(BOOST_NO_VARIADIC_TEMPLATES)
-
-# define LUABIND_CPP0x
-
-#endif
-
-namespace luabind {
-
-LUABIND_API void disable_super_deprecation();
-
-} // namespace luabind
-
-#endif // LUABIND_CONFIG_HPP_INCLUDED
-

+ 0 - 143
lib/luabind/luabind/container_policy.hpp

@@ -1,143 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_CONTAINER_POLICY_HPP_INCLUDED
-#define LUABIND_CONTAINER_POLICY_HPP_INCLUDED
-
-#include <luabind/config.hpp>
-#include <luabind/detail/policy.hpp>
-#include <boost/mpl/apply_wrap.hpp>
-
-namespace luabind { namespace detail {
-
-	namespace mpl = boost::mpl;
-
-	template<class Policies>
-	struct container_converter_lua_to_cpp
-	{
-        int const consumed_args(...)
-        {
-            return 1;
-        }
-
-        template<class T>
-		T apply(lua_State* L, by_const_reference<T>, int index)
-		{
-			typedef typename T::value_type value_type;
-
-			typedef typename find_conversion_policy<1, Policies>::type converter_policy;
-			typename mpl::apply_wrap2<converter_policy,value_type,lua_to_cpp>::type converter;
-
-			T container;
-
-			lua_pushnil(L);
-			while (lua_next(L, index))
-			{
-				container.push_back(converter.apply(L, LUABIND_DECORATE_TYPE(value_type), -1));
-				lua_pop(L, 1); // pop value
-			}
-
-			return container;
-		}
-
-		template<class T>
-		T apply(lua_State* L, by_value<T>, int index)
-		{
-			return apply(L, by_const_reference<T>(), index);
-		}
-
-		template<class T>
-		static int match(lua_State* L, by_const_reference<T>, int index)
-		{
-			if (lua_istable(L, index)) return 0; else return -1;
-		}
-
-		template<class T>
-		void converter_postcall(lua_State*, T, int) {}
-	};
-
-	template<class Policies>
-	struct container_converter_cpp_to_lua
-	{
-		template<class T>
-		void apply(lua_State* L, const T& container)
-		{
-			typedef typename T::value_type value_type;
-
-			typedef typename find_conversion_policy<1, Policies>::type converter_policy;
-			typename mpl::apply_wrap2<converter_policy,value_type,lua_to_cpp>::type converter;
-
-			lua_newtable(L);
-
-			int index = 1;
-
-			for (typename T::const_iterator i = container.begin(); i != container.end(); ++i)
-			{
-				converter.apply(L, *i);
-				lua_rawseti(L, -2, index);
-				++index;
-			}
-		}
-	};
-
-	template<int N, class Policies>
-//	struct container_policy : converter_policy_tag
-	struct container_policy : conversion_policy<N>
-	{
-//		BOOST_STATIC_CONSTANT(int, index = N);
-
-		static void precall(lua_State*, const index_map&) {}
-		static void postcall(lua_State*, const index_map&) {}
-
-		struct only_accepts_nonconst_pointers {};
-
-		template<class T, class Direction>
-		struct apply
-		{
-			typedef typename boost::mpl::if_<boost::is_same<lua_to_cpp, Direction>
-				, container_converter_lua_to_cpp<Policies>
-				, container_converter_cpp_to_lua<Policies>
-			>::type type;
-		};
-	};
-
-}}
-
-namespace luabind
-{
-	template<int N>
-	detail::policy_cons<detail::container_policy<N, detail::null_type>, detail::null_type> 
-	container(LUABIND_PLACEHOLDER_ARG(N)) 
-	{ 
-		return detail::policy_cons<detail::container_policy<N, detail::null_type>, detail::null_type>(); 
-	}
-
-	template<int N, class Policies>
-	detail::policy_cons<detail::container_policy<N, Policies>, detail::null_type> 
-	container(LUABIND_PLACEHOLDER_ARG(N), const Policies&) 
-	{ 
-		return detail::policy_cons<detail::container_policy<N, Policies>, detail::null_type>(); 
-	}
-}
-
-#endif // LUABIND_CONTAINER_POLICY_HPP_INCLUDED

+ 0 - 61
lib/luabind/luabind/copy_policy.hpp

@@ -1,61 +0,0 @@
-// Copyright Daniel Wallin 2008. Use, modification and distribution is
-// subject to the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef LUABIND_COPY_POLICY_081021_HPP
-# define LUABIND_COPY_POLICY_081021_HPP
-
-# include <luabind/detail/policy.hpp>
-
-namespace luabind {
-
-namespace detail
-{
-
-  struct copy_converter
-  {
-      template <class T>
-      void apply(lua_State* L, T const& x)
-      {
-          value_converter().apply(L, x);
-      }
-
-      template <class T>
-      void apply(lua_State* L, T* x)
-      {
-          if (!x)
-              lua_pushnil(L);
-          else
-              apply(L, *x);
-      }
-  };
-
-  template <int N>
-  struct copy_policy : conversion_policy<N>
-  {
-      static void precall(lua_State*, index_map const&)
-      {}
-
-      static void postcall(lua_State*, index_map const&)
-      {}
-
-      template <class T, class Direction>
-      struct apply
-      {
-          typedef copy_converter type;
-      };
-  };
-
-} // namespace detail
-
-template <int N>
-detail::policy_cons<detail::copy_policy<N>, detail::null_type>
-copy(LUABIND_PLACEHOLDER_ARG(N))
-{
-    return detail::policy_cons<detail::copy_policy<N>, detail::null_type>();
-}
-
-} // namespace luabind
-
-#endif // LUABIND_COPY_POLICY_081021_HPP
-

+ 0 - 119
lib/luabind/luabind/dependency_policy.hpp

@@ -1,119 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_DEPENDENCY_POLICY_HPP_INCLUDED
-#define LUABIND_DEPENDENCY_POLICY_HPP_INCLUDED
-
-#include <luabind/config.hpp>
-#include <luabind/detail/policy.hpp>
-
-namespace luabind { namespace detail 
-{
-	// makes A dependent on B, meaning B will outlive A.
-	// internally A stores a reference to B
-	template<int A, int B>
-	struct dependency_policy
-	{
-		static void postcall(lua_State* L, const index_map& indices)
-		{
-			int nurse_index = indices[A];
-			int patient = indices[B];
-
-			object_rep* nurse = static_cast<object_rep*>(lua_touserdata(L, nurse_index));
-
-			// If the nurse isn't an object_rep, just make this a nop.
-			if (nurse == 0)
-				return;
-
-			nurse->add_dependency(L, patient);
-		}
-	};
-
-}}
-
-#if defined (BOOST_MSVC) && (BOOST_MSVC <= 1200)
-
-namespace luabind
-{
-	// most absurd workaround of all time?
-	namespace detail
-	{
-		template<int N>
-		struct size_char_array
-		{
-			char storage[N + 2];
-		};
-
-		template<int N>
-		size_char_array<N> deduce_size(LUABIND_PLACEHOLDER_ARG(N));
-
-		template<class T>
-		struct get_index_workaround
-		{
-			static T t;
-			BOOST_STATIC_CONSTANT(int, value = sizeof(deduce_size(t)) - 2);
-		};
-	}
-
-	template<class A, class B>
-	detail::policy_cons<detail::dependency_policy<detail::get_index_workaround<A>::value
-		, detail::get_index_workaround<B>::value>, detail::null_type> dependency(A,B)
-	{
-		return detail::policy_cons<detail::dependency_policy<
-			detail::get_index_workaround<A>::value, detail::get_index_workaround<B>::value>
-			, detail::null_type>();
-	}
-
-	template<class A>
-	detail::policy_cons<detail::dependency_policy<0
-		, detail::get_index_workaround<A>::value>, detail::null_type>
-	return_internal_reference(A)
-	{
-		return detail::policy_cons<detail::dependency_policy<0
-			, detail::get_index_workaround<A>::value>, detail::null_type>();
-	}
-}
-
-#else
-
-namespace luabind
-{
-	template<int A, int B>
-	detail::policy_cons<detail::dependency_policy<A, B>, detail::null_type>
-	dependency(LUABIND_PLACEHOLDER_ARG(A), LUABIND_PLACEHOLDER_ARG(B))
-	{
-		return detail::policy_cons<detail::dependency_policy<A, B>, detail::null_type>();
-	}
-
-	template<int A>
-	detail::policy_cons<detail::dependency_policy<0, A>, detail::null_type>
-	return_internal_reference(LUABIND_PLACEHOLDER_ARG(A))
-	{
-		return detail::policy_cons<detail::dependency_policy<0, A>, detail::null_type>();
-	}
-}
-
-#endif
-
-#endif // LUABIND_DEPENDENCY_POLICY_HPP_INCLUDED
-

+ 0 - 330
lib/luabind/luabind/detail/call.hpp

@@ -1,330 +0,0 @@
-// Copyright Daniel Wallin 2008. Use, modification and distribution is
-// subject to the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#if !BOOST_PP_IS_ITERATING
-
-# ifndef LUABIND_CALL2_080911_HPP
-#  define LUABIND_CALL2_080911_HPP
-
-#  include <luabind/config.hpp>
-
-#  ifdef LUABIND_CPP0x
-#   include <luabind/detail/call_0x.hpp>
-#  else
-
-#  include <boost/mpl/apply_wrap.hpp>
-#  include <boost/mpl/begin_end.hpp>
-#  include <boost/mpl/deref.hpp>
-#  include <boost/mpl/front.hpp>
-#  include <boost/mpl/long.hpp>
-#  include <boost/mpl/size.hpp>
-#  include <boost/preprocessor/control/if.hpp>
-#  include <boost/preprocessor/iteration/iterate.hpp>
-#  include <boost/preprocessor/iteration/local.hpp>
-#  include <boost/preprocessor/repetition/enum.hpp>
-#  include <boost/preprocessor/repetition/enum_trailing_params.hpp>
-#  include <boost/type_traits/is_void.hpp>
-
-#  include <luabind/detail/policy.hpp>
-#  include <luabind/yield_policy.hpp>
-
-namespace luabind { namespace detail {
-
-struct invoke_context;
-
-struct LUABIND_API function_object
-{
-    function_object(lua_CFunction entry)
-      : entry(entry)
-      , next(0)
-    {}
-
-    virtual ~function_object()
-    {}
-
-    virtual int call(
-        lua_State* L, invoke_context& ctx) const = 0;
-    virtual void format_signature(lua_State* L, char const* function) const = 0;
-
-    lua_CFunction entry;
-    std::string name;
-    function_object* next;
-    object keepalive;
-};
-
-struct LUABIND_API invoke_context
-{
-    invoke_context()
-      : best_score((std::numeric_limits<int>::max)())
-      , candidate_index(0)
-    {}
-
-    operator bool() const
-    {
-        return candidate_index == 1;
-    }
-
-    void format_error(lua_State* L, function_object const* overloads) const;
-
-    int best_score;
-    function_object const* candidates[10];
-    int candidate_index;
-};
-
-template <class F, class Signature, class Policies, class IsVoid>
-inline int invoke0(
-    lua_State* L, function_object const& self, invoke_context& ctx
-  , F const& f, Signature, Policies const& policies, IsVoid, mpl::true_)
-{
-    return invoke_member(
-        L, self, ctx, f, Signature(), policies
-      , mpl::long_<mpl::size<Signature>::value - 1>(), IsVoid()
-    );
-}
-
-template <class F, class Signature, class Policies, class IsVoid>
-inline int invoke0(
-    lua_State* L, function_object const& self, invoke_context& ctx,
-    F const& f, Signature, Policies const& policies, IsVoid, mpl::false_)
-{
-    return invoke_normal(
-        L, self, ctx, f, Signature(), policies
-      , mpl::long_<mpl::size<Signature>::value - 1>(), IsVoid()
-    );
-}
-
-template <class F, class Signature, class Policies>
-inline int invoke(
-    lua_State* L, function_object const& self, invoke_context& ctx
-  , F const& f, Signature, Policies const& policies)
-{
-    return invoke0(
-        L, self, ctx, f, Signature(), policies
-      , boost::is_void<typename mpl::front<Signature>::type>()
-      , boost::is_member_function_pointer<F>()
-   );
-}
-
-inline int maybe_yield_aux(lua_State*, int results, mpl::false_)
-{
-    return results;
-}
-
-inline int maybe_yield_aux(lua_State* L, int results, mpl::true_)
-{
-    return lua_yield(L, results);
-}
-
-template <class Policies>
-int maybe_yield(lua_State* L, int results, Policies*)
-{
-    return maybe_yield_aux(
-        L, results, has_policy<Policies, yield_policy>());
-}
-
-inline int sum_scores(int const* first, int const* last)
-{
-    int result = 0;
-
-    for (; first != last; ++first)
-    {
-        if (*first < 0)
-            return *first;
-        result += *first;
-    }
-
-    return result;
-}
-
-#  define LUABIND_INVOKE_NEXT_ITER(n) \
-    typename mpl::next< \
-        BOOST_PP_IF( \
-            n, BOOST_PP_CAT(iter,BOOST_PP_DEC(n)), first) \
-    >::type
-
-#  define LUABIND_INVOKE_NEXT_INDEX(n) \
-    BOOST_PP_IF( \
-        n \
-      , BOOST_PP_CAT(index,BOOST_PP_DEC(n)) + \
-            BOOST_PP_CAT(c,BOOST_PP_DEC(n)).consumed_args() \
-      , 1 \
-    )
-
-#  define LUABIND_INVOKE_COMPUTE_ARITY(n) + BOOST_PP_CAT(c,n).consumed_args()
-
-#  define LUABIND_INVOKE_DECLARE_CONVERTER(n) \
-    typedef LUABIND_INVOKE_NEXT_ITER(n) BOOST_PP_CAT(iter,n); \
-    typedef typename mpl::deref<BOOST_PP_CAT(iter,n)>::type \
-        BOOST_PP_CAT(a,n); \
-    typedef typename find_conversion_policy<n + 1, Policies>::type \
-        BOOST_PP_CAT(p,n); \
-    typename mpl::apply_wrap2< \
-        BOOST_PP_CAT(p,n), BOOST_PP_CAT(a,n), lua_to_cpp>::type BOOST_PP_CAT(c,n); \
-    int const BOOST_PP_CAT(index,n) = LUABIND_INVOKE_NEXT_INDEX(n);
-
-#  define LUABIND_INVOKE_COMPUTE_SCORE(n)                                   \
-    , BOOST_PP_CAT(c,n).match(                                              \
-        L, LUABIND_DECORATE_TYPE(BOOST_PP_CAT(a,n)), BOOST_PP_CAT(index,n))
-
-#  define LUABIND_INVOKE_ARG(z, n, base) \
-    BOOST_PP_CAT(c,base(n)).apply( \
-        L, LUABIND_DECORATE_TYPE(BOOST_PP_CAT(a,base(n))), BOOST_PP_CAT(index,base(n)))
-
-#  define LUABIND_INVOKE_CONVERTER_POSTCALL(n) \
-    BOOST_PP_CAT(c,n).converter_postcall( \
-        L, LUABIND_DECORATE_TYPE(BOOST_PP_CAT(a,n)), BOOST_PP_CAT(index,n));
-
-#  define BOOST_PP_ITERATION_PARAMS_1 \
-    (3, (0, LUABIND_MAX_ARITY, <luabind/detail/call.hpp>))
-#  include BOOST_PP_ITERATE()
-
-#  define LUABIND_INVOKE_VOID
-#  define BOOST_PP_ITERATION_PARAMS_1 \
-    (3, (0, LUABIND_MAX_ARITY, <luabind/detail/call.hpp>))
-#  include BOOST_PP_ITERATE()
-
-#  undef LUABIND_INVOKE_VOID
-#  define LUABIND_INVOKE_MEMBER
-#  define BOOST_PP_ITERATION_PARAMS_1 \
-    (3, (0, LUABIND_MAX_ARITY, <luabind/detail/call.hpp>))
-#  include BOOST_PP_ITERATE()
-
-#  define LUABIND_INVOKE_VOID
-#  define BOOST_PP_ITERATION_PARAMS_1 \
-    (3, (0, LUABIND_MAX_ARITY, <luabind/detail/call.hpp>))
-#  include BOOST_PP_ITERATE()
-
-}} // namespace luabind::detail
-
-# endif // LUABIND_CPP0x
-
-# endif // LUABIND_CALL2_080911_HPP
-
-#else // BOOST_PP_IS_ITERATING
-
-# ifdef LUABIND_INVOKE_MEMBER
-#  define N BOOST_PP_INC(BOOST_PP_ITERATION())
-# else
-#  define N BOOST_PP_ITERATION()
-# endif
-
-template <class F, class Signature, class Policies>
-inline int
-# ifdef LUABIND_INVOKE_MEMBER
-invoke_member
-# else
-invoke_normal
-# endif
-(
-    lua_State* L, function_object const& self, invoke_context& ctx
-  , F const& f, Signature, Policies const&, mpl::long_<N>
-# ifdef LUABIND_INVOKE_VOID
-  , mpl::true_
-# else
-  , mpl::false_
-# endif
-)
-{
-    typedef typename mpl::begin<Signature>::type first;
-# ifndef LUABIND_INVOKE_VOID
-    typedef typename mpl::deref<first>::type result_type;
-    typedef typename find_conversion_policy<0, Policies>::type result_policy;
-    typename mpl::apply_wrap2<
-        result_policy, result_type, cpp_to_lua>::type result_converter;
-# endif
-
-# if N > 0
-#  define BOOST_PP_LOCAL_MACRO(n) LUABIND_INVOKE_DECLARE_CONVERTER(n)
-#  define BOOST_PP_LOCAL_LIMITS (0,N-1)
-#  include BOOST_PP_LOCAL_ITERATE()
-# endif
-
-    int const arity = 0
-# if N > 0
-#  define BOOST_PP_LOCAL_MACRO(n) LUABIND_INVOKE_COMPUTE_ARITY(n)
-#  define BOOST_PP_LOCAL_LIMITS (0,N-1)
-#  include BOOST_PP_LOCAL_ITERATE()
-# endif
-    ;
-
-    int const arguments = lua_gettop(L);
-
-    int score = -1;
-
-    if (arity == arguments)
-    {
-        int const scores[] = {
-            0
-# if N > 0
-#  define BOOST_PP_LOCAL_MACRO(n) LUABIND_INVOKE_COMPUTE_SCORE(n)
-#  define BOOST_PP_LOCAL_LIMITS (0,N-1)
-#  include BOOST_PP_LOCAL_ITERATE()
-# endif
-        };
-
-        score = sum_scores(scores + 1, scores + 1 + N);
-    }
-
-    if (score >= 0 && score < ctx.best_score)
-    {
-        ctx.best_score = score;
-        ctx.candidates[0] = &self;
-        ctx.candidate_index = 1;
-    }
-    else if (score == ctx.best_score)
-    {
-        ctx.candidates[ctx.candidate_index++] = &self;
-    }
-
-    int results = 0;
-
-    if (self.next)
-    {
-        results = self.next->call(L, ctx);
-    }
-
-    if (score == ctx.best_score && ctx.candidate_index == 1)
-    {
-# ifndef LUABIND_INVOKE_VOID
-        result_converter.apply(
-            L,
-# endif
-# ifdef LUABIND_INVOKE_MEMBER
-            (c0.apply(L, LUABIND_DECORATE_TYPE(a0), index0).*f)(
-                BOOST_PP_ENUM(BOOST_PP_DEC(N), LUABIND_INVOKE_ARG, BOOST_PP_INC)
-            )
-# else
-#  define LUABIND_INVOKE_IDENTITY(x) x
-            f(
-                BOOST_PP_ENUM(N, LUABIND_INVOKE_ARG, LUABIND_INVOKE_IDENTITY)
-            )
-#  undef LUABIND_INVOKE_IDENTITY
-# endif
-# ifndef LUABIND_INVOKE_VOID
-        )
-# endif
-        ;
-
-# if N > 0
-#  define BOOST_PP_LOCAL_MACRO(n) LUABIND_INVOKE_CONVERTER_POSTCALL(n)
-#  define BOOST_PP_LOCAL_LIMITS (0,N-1)
-#  include BOOST_PP_LOCAL_ITERATE()
-# endif
-
-        results = maybe_yield(L, lua_gettop(L) - arguments, (Policies*)0);
-
-        int const indices[] = {
-            arguments + results BOOST_PP_ENUM_TRAILING_PARAMS(N, index)
-        };
-
-        policy_list_postcall<Policies>::apply(L, indices);
-    }
-
-    return results;
-}
-
-# undef N
-
-#endif
-

+ 0 - 259
lib/luabind/luabind/detail/call_0x.hpp

@@ -1,259 +0,0 @@
-// Copyright Daniel Wallin 2010. Use, modification and distribution is
-// subject to the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef LUABIND_DETAIL_CALL_0X_100630_HPP
-# define LUABIND_DETAIL_CALL_0X_100630_HPP
-
-# include <luabind/config.hpp>
-# include <luabind/vector.hpp>
-# include <luabind/yield_policy.hpp>
-# include <luabind/detail/policy.hpp>
-# include <luabind/detail/index_tuple.hpp>
-# include <type_traits>
-
-namespace luabind { namespace detail {
-
-struct invoke_context;
-
-struct LUABIND_API function_object
-{
-    function_object(lua_CFunction entry)
-      : entry(entry)
-      , next(0)
-    {}
-
-    virtual ~function_object()
-    {}
-
-    virtual int call(
-        lua_State* L, invoke_context& ctx) const = 0;
-    virtual void format_signature(lua_State* L, char const* function) const = 0;
-
-    lua_CFunction entry;
-    std::string name;
-    function_object* next;
-    object keepalive;
-};
-
-struct LUABIND_API invoke_context
-{
-    invoke_context()
-      : best_score((std::numeric_limits<int>::max)())
-      , candidate_index(0)
-    {}
-
-    operator bool() const
-    {
-        return candidate_index == 1;
-    }
-
-    void format_error(lua_State* L, function_object const* overloads) const;
-
-    int best_score;
-    function_object const* candidates[10];
-    int candidate_index;
-};
-
-template <class F, class... Args, class Policies>
-inline int invoke(
-    lua_State* L, function_object const& self, invoke_context& ctx
-  , F const& f, vector<Args...>, Policies const& policies)
-{
-    return invoke_aux(
-        L, self, ctx, f, policies, vector<Args...>()
-      , typename make_index_tuple<sizeof...(Args) - 1>::type()
-    );
-}
-
-template <int N, class T, class Policies>
-struct make_arg_converter
-{
-    typedef typename find_conversion_policy<N + 1, Policies>::type generator;
-    typedef typename mpl::apply_wrap2<generator, T, lua_to_cpp>::type type;
-};
-
-template <class R, class Policies>
-struct make_result_converter
-{
-    typedef typename find_conversion_policy<0, Policies>::type generator;
-    typedef typename mpl::apply_wrap2<generator, R, cpp_to_lua>::type type;
-};
-
-struct void_result
-{};
-
-template <class Policies>
-struct make_result_converter<void, Policies>
-{
-    typedef void_result type;
-};
-
-template <class F, class Policies, class R, class... Args, int... Indices>
-inline int invoke_aux(
-    lua_State* L, function_object const& self, invoke_context& ctx
-  , F const& f, Policies const& policies
-  , vector<R, Args...>, index_tuple<Indices...>)
-{
-    typename make_result_converter<R, Policies>::type result_converter;
-
-    return invoke_actual(
-        L, self, ctx, f, policies
-      , vector<R, Args...>(), index_tuple<Indices...>(), result_converter
-      , typename make_arg_converter<Indices, Args, Policies>::type()...
-    );
-}
-
-inline int sum_scores(int const* first, int const* last)
-{
-    int result = 0;
-
-    for (; first != last; ++first)
-    {
-        if (*first < 0)
-            return *first;
-        result += *first;
-    }
-
-    return result;
-}
-
-template <class T, class Converter>
-int compute_score(lua_State* L, Converter& converter, int index)
-{
-    return converter.match(L, LUABIND_DECORATE_TYPE(T), index);
-}
-
-inline int compute_indices(int*, int base)
-{
-    return base;
-}
-
-template <class Converter, class... Rest>
-int compute_indices(
-    int* target, int base, Converter& converter, Rest&... rest)
-{
-    *target = base;
-    return compute_indices(target + 1, base + converter.consumed_args(), rest...);
-}
-
-template <class F, class ResultConverter, class... Args>
-void invoke_function(
-    lua_State* L, F const& f, std::false_type, ResultConverter& result_converter
-  , Args&&... args)
-{
-    result_converter.apply(L, f(std::forward<Args>(args)...));
-}
-
-template <class F, class... Args>
-void invoke_function(
-    lua_State* L, F const& f, std::false_type, void_result, Args&&... args)
-{
-    f(std::forward<Args>(args)...);
-}
-
-template <class F, class ResultConverter, class This, class... Args>
-void invoke_function(
-    lua_State* L, F const& f, std::true_type, ResultConverter& result_converter
-  , This&& this_, Args&&... args)
-{
-    result_converter.apply(L, (this_.*f)(std::forward<Args>(args)...));
-}
-
-template <class F, class This, class... Args>
-void invoke_function(
-    lua_State* L, F const& f, std::true_type, void_result, This&& this_, Args&&... args)
-{
-    (this_.*f)(std::forward<Args>(args)...);
-}
-
-inline int maybe_yield_aux(lua_State*, int results, mpl::false_)
-{
-    return results;
-}
-
-inline int maybe_yield_aux(lua_State* L, int results, mpl::true_)
-{
-    return lua_yield(L, results);
-}
-
-template <class Policies>
-int maybe_yield(lua_State* L, int results, Policies*)
-{
-    return maybe_yield_aux(
-        L, results, has_policy<Policies, yield_policy>());
-}
-
-// Helper that ignores everything passed to it. Used so that we can invoke
-// postcall on converters in a parameter pack expansion.
-template <class... T>
-void ignore(T&&...)
-{}
-
-template <
-    class F, class Policies, class R, class... Args, int... Indices
-  , class ResultConverter, class... Converters
->
-inline int invoke_actual(
-    lua_State* L, function_object const& self, invoke_context& ctx
-  , F const& f, Policies const& policies
-  , vector<R, Args...>, index_tuple<Indices...>
-  , ResultConverter& result_converter, Converters&&... converters)
-{
-    int indices[sizeof...(Args) + 1];
-    int const arity = compute_indices(indices + 1, 1, converters...) - 1;
-
-    int const arguments = lua_gettop(L);
-    int score = -1;
-
-    if (arity == arguments)
-    {
-        int const scores[] = {
-            compute_score<Args>(L, converters, indices[Indices + 1])...
-        };
-
-        score = sum_scores(scores, scores + sizeof...(Args));
-    }
-
-    if (score >= 0 && score < ctx.best_score)
-    {
-        ctx.best_score = score;
-        ctx.candidates[0] = &self;
-        ctx.candidate_index = 1;
-    }
-    else if (score == ctx.best_score)
-    {
-        ctx.candidates[ctx.candidate_index++] = &self;
-    }
-
-    int results = 0;
-
-    if (self.next)
-    {
-        results = self.next->call(L, ctx);
-    }
-
-    if (score == ctx.best_score && ctx.candidate_index == 1)
-    {
-        invoke_function(
-            L, f, std::is_member_function_pointer<F>(), result_converter
-          , converters.apply(L, LUABIND_DECORATE_TYPE(Args), indices[Indices + 1])...
-        );
-
-        ignore(
-            (converters.converter_postcall(
-                L, LUABIND_DECORATE_TYPE(Args), indices[Indices + 1]), 0)...
-        );
-
-        results = maybe_yield(L, lua_gettop(L) - arguments, (Policies*)0);
-        indices[0] = arguments + results;
-
-        policy_list_postcall<Policies>::apply(L, indices);
-    }
-
-    return results;
-}
-
-}} // namespace luabind::detail
-
-#endif // LUABIND_DETAIL_CALL_0X_100630_HPP

+ 0 - 541
lib/luabind/luabind/detail/call_function.hpp

@@ -1,541 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#if !BOOST_PP_IS_ITERATING
-
-#ifndef LUABIND_CALL_FUNCTION_HPP_INCLUDED
-#define LUABIND_CALL_FUNCTION_HPP_INCLUDED
-
-#include <luabind/config.hpp>
-
-#include <boost/mpl/if.hpp>
-#include <boost/tuple/tuple.hpp>
-#include <boost/mpl/or.hpp>
-#ifndef LUABIND_CPP0x
-# include <boost/preprocessor/repeat.hpp>
-# include <boost/preprocessor/iteration/iterate.hpp>
-# include <boost/preprocessor/repetition/enum.hpp>
-# include <boost/preprocessor/repetition/enum_params.hpp>
-# include <boost/preprocessor/repetition/enum_binary_params.hpp>
-# include <boost/preprocessor/punctuation/comma_if.hpp>
-#endif
-
-#include <luabind/error.hpp>
-#include <luabind/detail/convert_to_lua.hpp>
-#include <luabind/detail/pcall.hpp>
-
-namespace luabind
-{
-	namespace detail
-	{
-
-		// if the proxy_function_caller returns non-void
-			template<class Ret, class Tuple>
-			class proxy_function_caller
-			{
-//			friend class luabind::object;
-			public:
-
-				typedef int(*function_t)(lua_State*, int, int);
-
-				proxy_function_caller(
-					lua_State* L
-					, int params
-					, function_t fun
-					, const Tuple args)
-					: m_state(L)
-					, m_params(params)
-					, m_fun(fun)
-					, m_args(args)
-					, m_called(false)
-				{
-				}
-
-				proxy_function_caller(const proxy_function_caller& rhs)
-					: m_state(rhs.m_state)
-					, m_params(rhs.m_params)
-					, m_fun(rhs.m_fun)
-					, m_args(rhs.m_args)
-					, m_called(rhs.m_called)
-				{
-					rhs.m_called = true;
-				}
-
-				~proxy_function_caller()
-				{
-					if (m_called) return;
-
-					m_called = true;
-					lua_State* L = m_state;
-
-					int top = lua_gettop(L);
-
-					push_args_from_tuple<1>::apply(L, m_args);
-# ifdef LUABIND_CPP0x
-                    if (m_fun(L, std::tuple_size<Tuple>::value, 0))
-# else
-					if (m_fun(L, boost::tuples::length<Tuple>::value, 0))
-# endif
-					{
-						assert(lua_gettop(L) == top - m_params + 1);
-#ifndef LUABIND_NO_EXCEPTIONS
-						throw luabind::error(L);
-#else
-						error_callback_fun e = get_error_callback();
-						if (e) e(L);
-
-						assert(0 && "the lua function threw an error and exceptions are disabled."
-									" If you want to handle the error you can use luabind::set_error_callback()");
-						std::terminate();
-
-#endif
-					}
-
-					// pops the return values from the function call
-					stack_pop pop(L, lua_gettop(L) - top + m_params);
-				}
-
-				operator Ret()
-				{
-					typename mpl::apply_wrap2<default_policy,Ret,lua_to_cpp>::type converter;
-
-					m_called = true;
-					lua_State* L = m_state;
-
-					int top = lua_gettop(L);
-
-					push_args_from_tuple<1>::apply(L, m_args);
-# ifdef LUABIND_CPP0x
-                    if (m_fun(L, std::tuple_size<Tuple>::value, 1))
-# else
-					if (m_fun(L, boost::tuples::length<Tuple>::value, 1))
-# endif
-					{
-						assert(lua_gettop(L) == top - m_params + 1);
-#ifndef LUABIND_NO_EXCEPTIONS
-						throw luabind::error(L); 
-#else
-						error_callback_fun e = get_error_callback();
-						if (e) e(L);
-	
-						assert(0 && "the lua function threw an error and exceptions are disabled."
-								" If you want to handle the error you can use luabind::set_error_callback()");
-						std::terminate();
-#endif
-					}
-
-					// pops the return values from the function call
-					stack_pop pop(L, lua_gettop(L) - top + m_params);
-
-					if (converter.match(L, LUABIND_DECORATE_TYPE(Ret), -1) < 0)
-					{
-#ifndef LUABIND_NO_EXCEPTIONS
-						throw cast_failed(L, typeid(Ret));
-#else
-						cast_failed_callback_fun e = get_cast_failed_callback();
-						if (e) e(L, typeid(Ret));
-
-						assert(0 && "the lua function's return value could not be converted."
-									" If you want to handle the error you can use luabind::set_error_callback()");
-						std::terminate();
-#endif
-					}
-					return converter.apply(L, LUABIND_DECORATE_TYPE(Ret), -1);
-				}
-
-				template<class Policies>
-				Ret operator[](const Policies& p)
-				{
-					typedef typename detail::find_conversion_policy<0, Policies>::type converter_policy;
-					typename mpl::apply_wrap2<converter_policy,Ret,lua_to_cpp>::type converter;
-
-					m_called = true;
-					lua_State* L = m_state;
-
-					int top = lua_gettop(L);
-
-					detail::push_args_from_tuple<1>::apply(L, m_args, p);
-# ifdef LUABIND_CPP0x
-                    if (m_fun(L, std::tuple_size<Tuple>::value, 1))
-# else
-					if (m_fun(L, boost::tuples::length<Tuple>::value, 1))
-# endif
-					{ 
-						assert(lua_gettop(L) == top - m_params + 1);
-#ifndef LUABIND_NO_EXCEPTIONS
-						throw error(L);
-#else
-						error_callback_fun e = get_error_callback();
-						if (e) e(L);
-	
-						assert(0 && "the lua function threw an error and exceptions are disabled."
-								" If you want to handle the error you can use luabind::set_error_callback()");
-						std::terminate();
-#endif
-					}
-
-					// pops the return values from the function call
-					stack_pop pop(L, lua_gettop(L) - top + m_params);
-
-					if (converter.match(L, LUABIND_DECORATE_TYPE(Ret), -1) < 0)
-					{
-#ifndef LUABIND_NO_EXCEPTIONS
-						throw cast_failed(L, typeid(Ret));
-#else
-						cast_failed_callback_fun e = get_cast_failed_callback();
-						if (e) e(L, typeid(Ret));
-
-						assert(0 && "the lua function's return value could not be converted."
-									" If you want to handle the error you can use luabind::set_error_callback()");
-						std::terminate();
-
-#endif
-					}
-
-					return converter.apply(L, LUABIND_DECORATE_TYPE(Ret), -1);
-				}
-
-			private:
-
-				lua_State* m_state;
-				int m_params;
-				function_t m_fun;
-				Tuple m_args;
-				mutable bool m_called;
-
-			};
-
-		// if the proxy_member_caller returns void
-			template<class Tuple>
-			class proxy_function_void_caller
-			{
-			public:
-
-				typedef int(*function_t)(lua_State*, int, int);
-
-				proxy_function_void_caller(
-					lua_State* L
-					, int params
-					, function_t fun
-					, const Tuple args)
-					: m_state(L)
-					, m_params(params)
-					, m_fun(fun)
-					, m_args(args)
-					, m_called(false)
-				{
-				}
-
-				proxy_function_void_caller(const proxy_function_void_caller& rhs)
-					: m_state(rhs.m_state)
-					, m_params(rhs.m_params)
-					, m_fun(rhs.m_fun)
-					, m_args(rhs.m_args)
-					, m_called(rhs.m_called)
-				{
-					rhs.m_called = true;
-				}
-
-				~proxy_function_void_caller()
-				{
-					if (m_called) return;
-
-					m_called = true;
-					lua_State* L = m_state;
-
-					int top = lua_gettop(L);
-
-					push_args_from_tuple<1>::apply(L, m_args);
-# ifdef LUABIND_CPP0x
-                    if (m_fun(L, std::tuple_size<Tuple>::value, 0))
-# else
-					if (m_fun(L, boost::tuples::length<Tuple>::value, 0))
-# endif
-					{
-						assert(lua_gettop(L) == top - m_params + 1);
-#ifndef LUABIND_NO_EXCEPTIONS
-						throw luabind::error(L);
-#else
-						error_callback_fun e = get_error_callback();
-						if (e) e(L);
-	
-						assert(0 && "the lua function threw an error and exceptions are disabled."
-								" If you want to handle the error you can use luabind::set_error_callback()");
-						std::terminate();
-#endif
-					}
-					// pops the return values from the function call
-					stack_pop pop(L, lua_gettop(L) - top + m_params);
-				}
-
-				template<class Policies>
-				void operator[](const Policies& p)
-				{
-					m_called = true;
-					lua_State* L = m_state;
-
-					int top = lua_gettop(L);
-
-					detail::push_args_from_tuple<1>::apply(L, m_args, p);
-# ifdef LUABIND_CPP0x
-                    if (m_fun(L, std::tuple_size<Tuple>::value, 0))
-# else
-					if (m_fun(L, boost::tuples::length<Tuple>::value, 0))
-# endif
-					{
-						assert(lua_gettop(L) == top - m_params + 1);
-#ifndef LUABIND_NO_EXCEPTIONS
-						throw error(L);
-#else
-						error_callback_fun e = get_error_callback();
-						if (e) e(L);
-	
-						assert(0 && "the lua function threw an error and exceptions are disabled."
-							" If you want to handle the error you can use luabind::set_error_callback()");
-						std::terminate();
-#endif
-					}
-					// pops the return values from the function call
-					stack_pop pop(L, lua_gettop(L) - top + m_params);
-				}
-
-			private:
-
-				lua_State* m_state;
-				int m_params;
-				function_t m_fun;
-				Tuple m_args;
-				mutable bool m_called;
-
-			};
-
-	}
-
-# ifdef LUABIND_CPP0x
-
-
-namespace detail
-{
-
-  template <class R, class... Args>
-  struct make_proxy
-  {
-      typedef proxy_function_caller<R, std::tuple<Args const*...> > type;
-  };
-
-  template <class... Args>
-  struct make_proxy<void, Args...>
-  {
-      typedef proxy_function_void_caller<std::tuple<Args const*...> > type;
-  };
-
-} // namespace detail
-
-template <class R, class... Args>
-typename detail::make_proxy<R, Args...>::type call_function(
-    lua_State* L, char const* name, Args const&... args)
-{
-    assert(name && "luabind::call_function() expects a function name");
-
-    lua_pushstring(L, name);
-    lua_gettable(L, LUA_GLOBALSINDEX);
-
-    typedef typename detail::make_proxy<R, Args...>::type proxy_type;
-    return proxy_type(L, 1, &detail::pcall, std::tuple<Args const*...>(&args...));
-}
-
-template <class R, class... Args>
-typename detail::make_proxy<R, Args...>::type call_function(
-    object const& obj, Args const&... args)
-{
-    obj.push(obj.interpreter());
-
-    typedef typename detail::make_proxy<R, Args...>::type proxy_type;
-    return proxy_type(
-        obj.interpreter(), 1, &detail::pcall, std::tuple<Args const*...>(&args...));
-}
-
-template <class R, class... Args>
-typename detail::make_proxy<R, Args...>::type resume_function(
-    lua_State* L, char const* name, Args const&... args)
-{
-    assert(name && "luabind::call_function() expects a function name");
-
-    lua_pushstring(L, name);
-    lua_gettable(L, LUA_GLOBALSINDEX);
-
-    typedef typename detail::make_proxy<R, Args...>::type proxy_type;
-    return proxy_type(L, 1, &detail::resume_impl, std::tuple<Args const*...>(&args...));
-}
-
-template <class R, class... Args>
-typename detail::make_proxy<R, Args...>::type resume_function(
-    object const& obj, Args const&... args)
-{
-    obj.push(obj.interpreter());
-
-    typedef typename detail::make_proxy<R, Args...>::type proxy_type;
-    return proxy_type(
-        obj.interpreter(), 1, &detail::resume_impl, std::tuple<Args const*...>(&args...));
-}
-
-template <class R, class... Args>
-typename detail::make_proxy<R, Args...>::type resume(
-    lua_State* L, Args const&... args)
-{
-    typedef typename detail::make_proxy<R, Args...>::type proxy_type;
-    return proxy_type(
-        L, 0, &detail::resume_impl, std::tuple<Args const*...>(&args...));
-}
-
-# else // LUABIND_CPP0x
-
-	#define BOOST_PP_ITERATION_PARAMS_1 (4, (0, LUABIND_MAX_ARITY, <luabind/detail/call_function.hpp>, 1))
-	#include BOOST_PP_ITERATE()
-
-# endif // LUABIND_CPP0x
-
-}
-
-#endif // LUABIND_CALL_FUNCTION_HPP_INCLUDED
-
-#else
-#if BOOST_PP_ITERATION_FLAGS() == 1
-
-#define LUABIND_TUPLE_PARAMS(z, n, data) const A##n *
-#define LUABIND_OPERATOR_PARAMS(z, n, data) const A##n & a##n
-
-
-	template<class Ret BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)>
-	typename boost::mpl::if_<boost::is_void<Ret>
-			, luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
-			, luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type
-	call_function(lua_State* L, const char* name BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _) )
-	{
-		assert(name && "luabind::call_function() expects a function name");
-		typedef boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> tuple_t;
-#if BOOST_PP_ITERATION() == 0
-		tuple_t args;
-#else
-		tuple_t args(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), &a));
-#endif
-		typedef typename boost::mpl::if_<boost::is_void<Ret>
-			, luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
-			, luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type proxy_type;
-
-		lua_pushstring(L, name);
-		lua_gettable(L, LUA_GLOBALSINDEX);
-
-		return proxy_type(L, 1, &detail::pcall, args);
-	}
-
-	template<class Ret BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)>
-	typename boost::mpl::if_<boost::is_void<Ret>
-			, luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
-			, luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type
-	call_function(luabind::object const& obj BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _) )
-	{
-		typedef boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> tuple_t;
-#if BOOST_PP_ITERATION() == 0
-		tuple_t args;
-#else
-		tuple_t args(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), &a));
-#endif
-		typedef typename boost::mpl::if_<boost::is_void<Ret>
-			, luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
-			, luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type proxy_type;
-
-		obj.push(obj.interpreter());
-		return proxy_type(obj.interpreter(), 1, &detail::pcall, args);
-	}
-
-	template<class Ret BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)>
-	typename boost::mpl::if_<boost::is_void<Ret>
-			, luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
-			, luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type
-	resume_function(lua_State* L, const char* name BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _) )
-	{
-		assert(name && "luabind::resume_function() expects a function name");
-		typedef boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> tuple_t;
-#if BOOST_PP_ITERATION() == 0
-		tuple_t args;
-#else
-		tuple_t args(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), &a));
-#endif
-		typedef typename boost::mpl::if_<boost::is_void<Ret>
-			, luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
-			, luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type proxy_type;
-
-		lua_pushstring(L, name);
-		lua_gettable(L, LUA_GLOBALSINDEX);
-
-		return proxy_type(L, 1, &detail::resume_impl, args);
-	}
-
-	template<class Ret BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)>
-	typename boost::mpl::if_<boost::is_void<Ret>
-			, luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
-			, luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type
-	resume_function(luabind::object const& obj BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _) )
-	{
-		typedef boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> tuple_t;
-#if BOOST_PP_ITERATION() == 0
-		tuple_t args;
-#else
-		tuple_t args(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), &a));
-#endif
-		typedef typename boost::mpl::if_<boost::is_void<Ret>
-			, luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
-			, luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type proxy_type;
-
-		obj.push(obj.interpreter());
-		return proxy_type(obj.interpreter(), 1, &detail::resume_impl, args);
-	}
-
-	template<class Ret BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)>
-	typename boost::mpl::if_<boost::is_void<Ret>
-			, luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
-			, luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type
-	resume(lua_State* L BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _) )
-	{
-		typedef boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> tuple_t;
-#if BOOST_PP_ITERATION() == 0
-		tuple_t args;
-#else
-		tuple_t args(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), &a));
-#endif
-		typedef typename boost::mpl::if_<boost::is_void<Ret>
-			, luabind::detail::proxy_function_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
-			, luabind::detail::proxy_function_caller<Ret, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type proxy_type;
-
-		return proxy_type(L, 0, &detail::resume_impl, args);
-	}
-
-
-#undef LUABIND_OPERATOR_PARAMS
-#undef LUABIND_TUPLE_PARAMS
-
-
-#endif
-#endif
-

+ 0 - 425
lib/luabind/luabind/detail/call_member.hpp

@@ -1,425 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#if !BOOST_PP_IS_ITERATING
-
-#ifndef LUABIND_CALL_MEMBER_HPP_INCLUDED
-#define LUABIND_CALL_MEMBER_HPP_INCLUDED
-
-#include <luabind/config.hpp>
-#include <luabind/detail/convert_to_lua.hpp>
-#include <luabind/detail/pcall.hpp>
-#include <luabind/error.hpp>
-#include <luabind/detail/stack_utils.hpp>
-#include <luabind/object.hpp> // TODO: REMOVE DEPENDENCY
-
-#ifndef LUABIND_CPP0x
-# include <boost/tuple/tuple.hpp>
-
-# include <boost/preprocessor/control/if.hpp>
-# include <boost/preprocessor/facilities/expand.hpp>
-# include <boost/preprocessor/repetition/enum.hpp>
-#else
-# include <tuple>
-#endif
-
-#include <boost/mpl/apply_wrap.hpp>
-
-namespace luabind
-{
-	namespace detail
-	{
-
-		namespace mpl = boost::mpl;
-
-		// if the proxy_member_caller returns non-void
-			template<class Ret, class Tuple>
-			class proxy_member_caller
-			{
-//			friend class luabind::object;
-			public:
-
-				proxy_member_caller(lua_State* L_, const Tuple args)
-					: L(L_)
-					, m_args(args)
-					, m_called(false)
-				{
-				}
-
-				proxy_member_caller(const proxy_member_caller& rhs)
-					: L(rhs.L)
-					, m_args(rhs.m_args)
-					, m_called(rhs.m_called)
-				{
-					rhs.m_called = true;
-				}
-
-				~proxy_member_caller()
-				{
-					if (m_called) return;
-
-					m_called = true;
-
-					// don't count the function and self-reference
-					// since those will be popped by pcall
-					int top = lua_gettop(L) - 2;
-
-					// pcall will pop the function and self reference
-					// and all the parameters
-
-					push_args_from_tuple<1>::apply(L, m_args);
-# ifdef LUABIND_CPP0x
-                    if (pcall(L, std::tuple_size<Tuple>::value + 1, 0))
-# else
-					if (pcall(L, boost::tuples::length<Tuple>::value + 1, 0))
-# endif
-					{
-						assert(lua_gettop(L) == top + 1);
-#ifndef LUABIND_NO_EXCEPTIONS
-						throw luabind::error(L);
-#else
-						error_callback_fun e = get_error_callback();
-						if (e) e(L);
-	
-						assert(0 && "the lua function threw an error and exceptions are disabled."
-								"If you want to handle this error use luabind::set_error_callback()");
-						std::terminate();
-#endif
-					}
-					// pops the return values from the function
-					stack_pop pop(L, lua_gettop(L) - top);
-				}
-
-				operator Ret()
-				{
-					typename mpl::apply_wrap2<default_policy,Ret,lua_to_cpp>::type converter;
-
-					m_called = true;
-
-					// don't count the function and self-reference
-					// since those will be popped by pcall
-					int top = lua_gettop(L) - 2;
-
-					// pcall will pop the function and self reference
-					// and all the parameters
-					push_args_from_tuple<1>::apply(L, m_args);
-# ifdef LUABIND_CPP0x
-                    if (pcall(L, std::tuple_size<Tuple>::value + 1, 1))
-# else
-					if (pcall(L, boost::tuples::length<Tuple>::value + 1, 1))
-# endif
-					{
-						assert(lua_gettop(L) == top + 1);
-#ifndef LUABIND_NO_EXCEPTIONS
-						throw luabind::error(L); 
-#else
-						error_callback_fun e = get_error_callback();
-						if (e) e(L);
-	
-						assert(0 && "the lua function threw an error and exceptions are disabled."
-							"If you want to handle this error use luabind::set_error_callback()");
-						std::terminate();
-#endif
-					}
-
-					// pops the return values from the function
-					stack_pop pop(L, lua_gettop(L) - top);
-
-					if (converter.match(L, LUABIND_DECORATE_TYPE(Ret), -1) < 0)
-					{
-						assert(lua_gettop(L) == top + 1);
-#ifndef LUABIND_NO_EXCEPTIONS
-						throw cast_failed(L, typeid(Ret));
-#else
-						cast_failed_callback_fun e = get_cast_failed_callback();
-						if (e) e(L, typeid(Ret));
-
-						assert(0 && "the lua function's return value could not be converted."
-							"If you want to handle this error use luabind::set_error_callback()");
-						std::terminate();
-#endif
-					}
-
-					return converter.apply(L, LUABIND_DECORATE_TYPE(Ret), -1);
-				}
-
-				template<class Policies>
-				Ret operator[](const Policies& p)
-				{
-					typedef typename find_conversion_policy<0, Policies>::type converter_policy;
-					typename mpl::apply_wrap2<converter_policy,Ret,lua_to_cpp>::type converter;
-
-					m_called = true;
-
-					// don't count the function and self-reference
-					// since those will be popped by pcall
-					int top = lua_gettop(L) - 2;
-
-					// pcall will pop the function and self reference
-					// and all the parameters
-
-					detail::push_args_from_tuple<1>::apply(L, m_args, p);
-# ifdef LUABIND_CPP0x
-                    if (pcall(L, std::tuple_size<Tuple>::value + 1, 1))
-# else
-					if (pcall(L, boost::tuples::length<Tuple>::value + 1, 1))
-# endif
-					{
-						assert(lua_gettop(L) == top + 1);
-#ifndef LUABIND_NO_EXCEPTIONS
-						throw error(L);
-#else
-						error_callback_fun e = get_error_callback();
-						if (e) e(L);
-	
-						assert(0 && "the lua function threw an error and exceptions are disabled."
-							"If you want to handle this error use luabind::set_error_callback()");
-						std::terminate();
-#endif
-					}
-
-					// pops the return values from the function
-					stack_pop pop(L, lua_gettop(L) - top);
-
-					if (converter.match(L, LUABIND_DECORATE_TYPE(Ret), -1) < 0)
-					{
-						assert(lua_gettop(L) == top + 1);
-#ifndef LUABIND_NO_EXCEPTIONS
-						throw cast_failed(L, typeid(Ret));
-#else
-						cast_failed_callback_fun e = get_cast_failed_callback();
-						if (e) e(L, typeid(Ret));
-
-						assert(0 && "the lua function's return value could not be converted."
-							"If you want to handle this error use luabind::set_error_callback()");
-						std::terminate();
-#endif
-					}
-
-					return converter.apply(L, LUABIND_DECORATE_TYPE(Ret), -1);
-				}
-
-			private:
-
-				lua_State* L;
-				Tuple m_args;
-				mutable bool m_called;
-
-			};
-
-		// if the proxy_member_caller returns void
-			template<class Tuple>
-			class proxy_member_void_caller
-			{
-			friend class luabind::object;
-			public:
-
-				proxy_member_void_caller(lua_State* L_, const Tuple args)
-					: L(L_)
-					, m_args(args)
-					, m_called(false)
-				{
-				}
-
-				proxy_member_void_caller(const proxy_member_void_caller& rhs)
-					: L(rhs.L)
-					, m_args(rhs.m_args)
-					, m_called(rhs.m_called)
-				{
-					rhs.m_called = true;
-				}
-
-				~proxy_member_void_caller()
-				{
-					if (m_called) return;
-
-					m_called = true;
-
-					// don't count the function and self-reference
-					// since those will be popped by pcall
-					int top = lua_gettop(L) - 2;
-
-					// pcall will pop the function and self reference
-					// and all the parameters
-
-					push_args_from_tuple<1>::apply(L, m_args);
-# ifdef LUABIND_CPP0x
-                    if (pcall(L, std::tuple_size<Tuple>::value + 1, 0))
-# else
-					if (pcall(L, boost::tuples::length<Tuple>::value + 1, 0))
-# endif
-					{
-						assert(lua_gettop(L) == top + 1);
-#ifndef LUABIND_NO_EXCEPTIONS
-						throw luabind::error(L);
-#else
-						error_callback_fun e = get_error_callback();
-						if (e) e(L);
-	
-						assert(0 && "the lua function threw an error and exceptions are disabled."
-							"If you want to handle this error use luabind::set_error_callback()");
-						std::terminate();
-#endif
-					}
-					// pops the return values from the function
-					stack_pop pop(L, lua_gettop(L) - top);
-				}
-
-				template<class Policies>
-				void operator[](const Policies& p)
-				{
-					m_called = true;
-
-					// don't count the function and self-reference
-					// since those will be popped by pcall
-					int top = lua_gettop(L) - 2;
-
-					// pcall will pop the function and self reference
-					// and all the parameters
-
-					detail::push_args_from_tuple<1>::apply(L, m_args, p);
-# ifdef LUABIND_CPP0x
-                    if (pcall(L, std::tuple_size<Tuple>::value + 1, 0))
-# else
-					if (pcall(L, boost::tuples::length<Tuple>::value + 1, 0))
-# endif
-					{
-						assert(lua_gettop(L) == top + 1);
-#ifndef LUABIND_NO_EXCEPTIONS
-						throw error(L);
-#else
-						error_callback_fun e = get_error_callback();
-						if (e) e(L);
-	
-						assert(0 && "the lua function threw an error and exceptions are disabled."
-							"If you want to handle this error use luabind::set_error_callback()");
-						std::terminate();
-#endif
-					}
-					// pops the return values from the function
-					stack_pop pop(L, lua_gettop(L) - top);
-				}
-
-			private:
-				lua_State* L;
-				Tuple m_args;
-				mutable bool m_called;
-
-			};
-
-	} // detail
-
-# ifdef LUABIND_CPP0x
-
-namespace detail
-{
-
-  template <class R, class... Args>
-  struct make_member_proxy
-  {
-      typedef proxy_member_caller<R, std::tuple<Args const*...> > type;
-  };
-
-  template <class... Args>
-  struct make_member_proxy<void, Args...>
-  {
-      typedef proxy_member_void_caller<std::tuple<Args const*...> > type;
-  };
-
-} // namespace detail
-
-template <class R, class... Args>
-typename detail::make_member_proxy<R, Args...>::type call_member(
-    object const& obj, char const* name, Args const&... args)
-{
-    // get the function
-    obj.push(obj.interpreter());
-    lua_pushstring(obj.interpreter(), name);
-    lua_gettable(obj.interpreter(), -2);
-    // duplicate the self-object
-    lua_pushvalue(obj.interpreter(), -2);
-    // remove the bottom self-object
-    lua_remove(obj.interpreter(), -3);
-
-    typedef typename detail::make_member_proxy<R, Args...>::type proxy_type;
-    return proxy_type(obj.interpreter(), std::tuple<Args const*...>(&args...));
-}
-
-# else // LUABIND_CPP0x
-
-	#define BOOST_PP_ITERATION_PARAMS_1 (4, (0, LUABIND_MAX_ARITY, <luabind/detail/call_member.hpp>, 1))
-	#include BOOST_PP_ITERATE()
-
-# endif
-
-}
-
-#endif // LUABIND_CALL_MEMBER_HPP_INCLUDED
-
-#else
-#if BOOST_PP_ITERATION_FLAGS() == 1
-
-#define LUABIND_TUPLE_PARAMS(z, n, data) const A##n *
-#define LUABIND_OPERATOR_PARAMS(z, n, data) const A##n & a##n
-
-	template<class R BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), class A)>
-	typename boost::mpl::if_<boost::is_void<R>
-			, luabind::detail::proxy_member_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
-			, luabind::detail::proxy_member_caller<R, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type
-	call_member(object const& obj, const char* name BOOST_PP_COMMA_IF(BOOST_PP_ITERATION()) BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_OPERATOR_PARAMS, _))
-	{
-		typedef boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> tuple_t;
-#if BOOST_PP_ITERATION() == 0
-		tuple_t args;
-#else
-		tuple_t args(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), &a));
-#endif
-
-		typedef typename boost::mpl::if_<boost::is_void<R>
-			, luabind::detail::proxy_member_void_caller<boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> >
-			, luabind::detail::proxy_member_caller<R, boost::tuples::tuple<BOOST_PP_ENUM(BOOST_PP_ITERATION(), LUABIND_TUPLE_PARAMS, _)> > >::type proxy_type;
-
-		// this will be cleaned up by the proxy object
-		// once the call has been made
-
-		// get the function
-		obj.push(obj.interpreter());
-		lua_pushstring(obj.interpreter(), name);
-		lua_gettable(obj.interpreter(), -2);
-		// duplicate the self-object
-		lua_pushvalue(obj.interpreter(), -2);
-		// remove the bottom self-object
-		lua_remove(obj.interpreter(), -3);
-
-		// now the function and self objects
-		// are on the stack. These will both
-		// be popped by pcall
-		return proxy_type(obj.interpreter(), args);
-	}
-
-#undef LUABIND_OPERATOR_PARAMS
-#undef LUABIND_TUPLE_PARAMS
-
-#endif
-#endif
-

+ 0 - 66
lib/luabind/luabind/detail/call_operator_iterate.hpp

@@ -1,66 +0,0 @@
-// Copyright (c) 2004 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-#define N BOOST_PP_ITERATION()
-
-#define LUABIND_UNWRAP_PARAMETER(z, n, _) \
-    typename detail::unwrap_parameter_type<T, BOOST_PP_CAT(A, n)>::type \
-        BOOST_PP_CAT(_, n)
-
-template<class Self BOOST_PP_ENUM_TRAILING_PARAMS(N, class A)>
-struct BOOST_PP_CAT(call_operator, N) 
-    : detail::operator_<
-          BOOST_PP_CAT(call_operator, N)<
-              Self BOOST_PP_ENUM_TRAILING_PARAMS(N, A)
-          >
-      >
-{
-    BOOST_PP_CAT(call_operator, N)(int) {}
-
-    template<class T, class Policies>
-    struct apply
-    {
-        static void execute(
-            lua_State* L
-          , typename detail::unwrap_parameter_type<T, Self>::type self
-            BOOST_PP_ENUM_TRAILING(N, LUABIND_UNWRAP_PARAMETER, _)
-        )
-        {
-            using namespace detail;
-            operator_result(
-                L
-#if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
-              , self(BOOST_PP_ENUM_PARAMS(N, _))
-#else
-              , (self(BOOST_PP_ENUM_PARAMS(N, _)), detail::operator_void_return())
-#endif
-              , (Policies*)0
-            );
-        } 
-    };
-
-    static char const* name() { return "__call"; }
-};
-
-#undef LUABIND_UNWRAP_PARAMETER
-#undef N
-

+ 0 - 85
lib/luabind/luabind/detail/class_registry.hpp

@@ -1,85 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_CLASS_REGISTRY_HPP_INCLUDED
-#define LUABIND_CLASS_REGISTRY_HPP_INCLUDED
-
-#include <map>
-
-#include <luabind/config.hpp>
-#include <luabind/open.hpp>
-#include <luabind/typeid.hpp>
-
-namespace luabind { namespace detail
-{
-	class class_rep;
-
-	struct LUABIND_API class_registry
-	{
-		class_registry(lua_State* L);
-
-		static class_registry* get_registry(lua_State* L);
-
-		int cpp_instance() const { return m_instance_metatable; }
-		int cpp_class() const { return m_cpp_class_metatable; }
-
-		int lua_instance() const { return m_instance_metatable; }
-		int lua_class() const { return m_lua_class_metatable; }
-		int lua_function() const { return m_lua_function_metatable; }
-
-		void add_class(type_id const& info, class_rep* crep);
-
-		class_rep* find_class(type_id const& info) const;
-
-        std::map<type_id, class_rep*> const& get_classes() const
-        {
-            return m_classes;
-        }
-
-	private:
-
-		std::map<type_id, class_rep*> m_classes;
-
-		// this is a lua reference that points to the lua table
-		// that is to be used as meta table for all C++ class 
-		// instances. It is a kind of v-table.
-		int m_instance_metatable;
-
-		// this is a lua reference to the metatable to be used
-		// for all classes defined in C++.
-		int m_cpp_class_metatable;
-
-		// this is a lua reference to the metatable to be used
-		// for all classes defined in lua
-		int m_lua_class_metatable;
-
-		// this metatable only contains a destructor
-		// for luabind::Detail::free_functions::function_rep
-		int m_lua_function_metatable;
-
-	};
-
-}}
-
-#endif // LUABIND_CLASS_REGISTRY_HPP_INCLUDED
-

+ 0 - 211
lib/luabind/luabind/detail/class_rep.hpp

@@ -1,211 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_CLASS_REP_HPP_INCLUDED
-#define LUABIND_CLASS_REP_HPP_INCLUDED
-
-#include <boost/limits.hpp>
-
-#include <string>
-#include <utility>
-#include <vector>
-
-#include <luabind/config.hpp>
-#include <luabind/lua_include.hpp>
-#include <luabind/detail/garbage_collector.hpp>
-#include <luabind/detail/operator_id.hpp>
-#include <luabind/detail/class_registry.hpp>
-#include <luabind/error.hpp>
-#include <luabind/handle.hpp>
-#include <luabind/detail/primitives.hpp>
-#include <luabind/typeid.hpp>
-#include <luabind/detail/ref.hpp>
-
-namespace luabind { namespace detail
-{
-
-	LUABIND_API std::string stack_content_by_name(lua_State* L, int start_index);
-
-	struct class_registration;
-
-	struct conversion_storage;
-
-	// This function is used as a tag to identify "properties".
-	LUABIND_API int property_tag(lua_State*);
-
-	// this is class-specific information, poor man's vtable
-	// this is allocated statically (removed by the compiler)
-	// a pointer to this structure is stored in the lua tables'
-	// metatable with the name __classrep
-	// it is used when matching parameters to function calls
-	// to determine possible implicit casts
-	// it is also used when finding the best match for overloaded
-	// methods
-
-    class cast_graph;
-    class class_id_map;
-
-	class LUABIND_API class_rep
-	{
-	friend struct class_registration;
-	friend int super_callback(lua_State*);
-//TODO: avoid the lua-prefix
-	friend int lua_class_gettable(lua_State*);
-	friend int lua_class_settable(lua_State*);
-	friend int static_class_gettable(lua_State*);
-	public:
-
-		enum class_type
-		{
-			cpp_class = 0,
-			lua_class = 1
-		};
-
-		// EXPECTS THE TOP VALUE ON THE LUA STACK TO
-		// BE THE USER DATA WHERE THIS CLASS IS BEING
-		// INSTANTIATED!
-		class_rep(type_id const& type
-			, const char* name
-			, lua_State* L
-        );
-
-		// used when creating a lua class
-		// EXPECTS THE TOP VALUE ON THE LUA STACK TO
-		// BE THE USER DATA WHERE THIS CLASS IS BEING
-		// INSTANTIATED!
-		class_rep(lua_State* L, const char* name);
-
-		~class_rep();
-
-		std::pair<void*,void*> allocate(lua_State* L) const;
-
-		// this is called as metamethod __call on the class_rep.
-		static int constructor_dispatcher(lua_State* L);
-
-		struct base_info
-		{
-			int pointer_offset; // the offset added to the pointer to obtain a basepointer (due to multiple-inheritance)
-			class_rep* base;
-		};
-
-		void add_base_class(const base_info& binfo);
-
-		const std::vector<base_info>& bases() const throw() { return m_bases; }
-
-		void set_type(type_id const& t) { m_type = t; }
-		type_id const& type() const throw() { return m_type; }
-
-		const char* name() const throw() { return name_; }
-
-		// the lua reference to the metatable for this class' instances
-		int metatable_ref() const throw() { return m_instance_metatable; }
-
-		void get_table(lua_State* L) const { m_table.push(L); }
-		void get_default_table(lua_State* L) const { m_default_table.push(L); }
-
-		class_type get_class_type() const { return m_class_type; }
-
-		void add_static_constant(const char* name, int val);
-
-		static int super_callback(lua_State* L);
-
-		static int lua_settable_dispatcher(lua_State* L);
-
-		// called from the metamethod for __index
-		// obj is the object pointer
-		static int static_class_gettable(lua_State* L);
-
-		bool has_operator_in_lua(lua_State*, int id);
-
-        cast_graph const& casts() const
-        {
-            return *m_casts;
-        }
-
-        class_id_map const& classes() const
-        {
-            return *m_classes;
-        }
-
-	private:
-
-		void cache_operators(lua_State*);
-
-		// this is a pointer to the type_info structure for
-		// this type
-		// warning: this may be a problem when using dll:s, since
-		// typeid() may actually return different pointers for the same
-		// type.
-		type_id m_type;
-
-		// a list of info for every class this class derives from
-		// the information stored here is sufficient to do
-		// type casts to the base classes
-		std::vector<base_info> m_bases;
-
-		// the class' name (as given when registered to lua with class_)
-		const char* name_;
-
-		// a reference to this structure itself. Since this struct
-		// is kept inside lua (to let lua collect it when lua_close()
-		// is called) we need to lock it to prevent collection.
-		// the actual reference is not currently used.
-		detail::lua_reference m_self_ref;
-
-		// this should always be used when accessing
-		// members in instances of a class.
-		// this table contains c closures for all
-		// member functions in this class, they
-		// may point to both static and virtual functions
-		handle m_table;
-
-		// this table contains default implementations of the
-		// virtual functions in m_table.
-		handle m_default_table;
-
-		// the type of this class.. determines if it's written in c++ or lua
-		class_type m_class_type;
-
-		// this is a lua reference that points to the lua table
-		// that is to be used as meta table for all instances
-		// of this class.
-		int m_instance_metatable;
-
-		std::map<const char*, int, ltstr> m_static_constants;
-
-		// the first time an operator is invoked
-		// we check the associated lua table
-		// and cache the result
-		int m_operator_cache;
-
-        cast_graph* m_casts;
-        class_id_map* m_classes;
-	};
-
-	bool is_class_rep(lua_State* L, int index);
-
-}}
-
-//#include <luabind/detail/overload_rep_impl.hpp>
-
-#endif // LUABIND_CLASS_REP_HPP_INCLUDED

+ 0 - 142
lib/luabind/luabind/detail/constructor.hpp

@@ -1,142 +0,0 @@
-// Copyright Daniel Wallin 2008. Use, modification and distribution is
-// subject to the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#if !BOOST_PP_IS_ITERATING
-
-# ifndef LUABIND_DETAIL_CONSTRUCTOR_081018_HPP
-#  define LUABIND_DETAIL_CONSTRUCTOR_081018_HPP
-
-#  include <luabind/get_main_thread.hpp>
-#  include <luabind/object.hpp>
-#  include <luabind/wrapper_base.hpp>
-#  include <luabind/detail/inheritance.hpp>
-
-#  ifndef LUABIND_CPP0x
-#   include <boost/preprocessor/iteration/iterate.hpp>
-#   include <boost/preprocessor/iteration/local.hpp>
-#   include <boost/preprocessor/repetition/enum_params.hpp>
-#   include <boost/preprocessor/repetition/enum_binary_params.hpp>
-#  endif
-
-namespace luabind { namespace detail {
-
-inline void inject_backref(lua_State*, void*, void*)
-{}
-
-template <class T>
-void inject_backref(lua_State* L, T* p, wrap_base*)
-{
-    weak_ref(get_main_thread(L), L, 1).swap(wrap_access::ref(*p));
-}
-
-#  ifdef LUABIND_CPP0x
-
-template <class T, class Pointer, class Signature>
-struct construct;
-
-template <class T, class Pointer, class R, class Self, class... Args>
-struct construct<T, Pointer, vector<R, Self, Args...> >
-{
-    typedef pointer_holder<Pointer, T> holder_type;
-
-    void operator()(argument const& self_, Args... args) const
-    {
-        object_rep* self = touserdata<object_rep>(self_);
-
-        std::auto_ptr<T> instance(new T(args...));
-        inject_backref(self_.interpreter(), instance.get(), instance.get());
-
-        void* naked_ptr = instance.get();
-        Pointer ptr(instance.release());
-
-        void* storage = self->allocate(sizeof(holder_type));
-
-        self->set_instance(new (storage) holder_type(
-            ptr, registered_class<T>::id, naked_ptr));
-    }
-};
-
-#   else // LUABIND_CPP0x
-
-template <std::size_t Arity, class T, class Pointer, class Signature>
-struct construct_aux;
-
-template <class T, class Pointer, class Signature>
-struct construct
-  : construct_aux<mpl::size<Signature>::value - 2, T, Pointer, Signature>
-{};
-
-template <class T, class Pointer, class Signature>
-struct construct_aux<0, T, Pointer, Signature>
-{
-    typedef pointer_holder<Pointer, T> holder_type;
-
-    void operator()(argument const& self_) const
-    {
-        object_rep* self = touserdata<object_rep>(self_);
-
-        std::auto_ptr<T> instance(new T);
-        inject_backref(self_.interpreter(), instance.get(), instance.get());
-
-        void* naked_ptr = instance.get();
-        Pointer ptr(instance.release());
-
-        void* storage = self->allocate(sizeof(holder_type));
-
-        self->set_instance(new (storage) holder_type(
-            ptr, registered_class<T>::id, naked_ptr));
-    }
-};
-
-#  define BOOST_PP_ITERATION_PARAMS_1 \
-    (3, (1, LUABIND_MAX_ARITY, <luabind/detail/constructor.hpp>))
-#  include BOOST_PP_ITERATE()
-
-#  endif // LUABIND_CPP0x
-
-}} // namespace luabind::detail
-
-# endif // LUABIND_DETAIL_CONSTRUCTOR_081018_HPP
-
-#else // !BOOST_PP_IS_ITERATING
-
-# define N BOOST_PP_ITERATION()
-
-template <class T, class Pointer, class Signature>
-struct construct_aux<N, T, Pointer, Signature>
-{
-    typedef typename mpl::begin<Signature>::type first;
-    typedef typename mpl::next<first>::type iter0;
-
-# define BOOST_PP_LOCAL_MACRO(n) \
-    typedef typename mpl::next< \
-        BOOST_PP_CAT(iter,BOOST_PP_DEC(n))>::type BOOST_PP_CAT(iter,n); \
-    typedef typename BOOST_PP_CAT(iter,n)::type BOOST_PP_CAT(a,BOOST_PP_DEC(n));
-
-# define BOOST_PP_LOCAL_LIMITS (1,N)
-# include BOOST_PP_LOCAL_ITERATE()
-
-    typedef pointer_holder<Pointer, T> holder_type;
-
-    void operator()(argument const& self_, BOOST_PP_ENUM_BINARY_PARAMS(N,a,_)) const
-    {
-        object_rep* self = touserdata<object_rep>(self_);
-
-        std::auto_ptr<T> instance(new T(BOOST_PP_ENUM_PARAMS(N,_)));
-        inject_backref(self_.interpreter(), instance.get(), instance.get());
-
-        void* naked_ptr = instance.get();
-        Pointer ptr(instance.release());
-
-        void* storage = self->allocate(sizeof(holder_type));
-
-        self->set_instance(new (storage) holder_type(
-            ptr, registered_class<T>::id, naked_ptr));
-    }
-};
-
-# undef N
-
-#endif
-

+ 0 - 41
lib/luabind/luabind/detail/conversion_storage.hpp

@@ -1,41 +0,0 @@
-// Copyright Daniel Wallin 2008. Use, modification and distribution is
-// subject to the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef LUABIND_CONVERSION_STORAGE_080930_HPP
-# define LUABIND_CONVERSION_STORAGE_080930_HPP
-
-# include <luabind/config.hpp>
-# include <boost/aligned_storage.hpp>
-
-namespace luabind { namespace detail {
-
-typedef void(*destruction_function)(void*);
-
-// This is used by the converters in policy.hpp, and
-// class_rep::convert_to as temporary storage when constructing
-// holders.
-
-struct conversion_storage
-{
-    conversion_storage()
-      : destructor(0)
-    {}
-
-    ~conversion_storage()
-    {
-        if (destructor)
-            destructor(&data);
-    }
-
-    // Unfortunately the converters currently doesn't have access to
-    // the actual type being converted when this is instantiated, so
-    // we have to guess a max size.
-    boost::aligned_storage<128> data;
-    destruction_function destructor;
-};
-
-}} // namespace luabind::detail
-
-#endif // LUABIND_CONVERSION_STORAGE_080930_HPP
-

+ 0 - 92
lib/luabind/luabind/detail/convert_to_lua.hpp

@@ -1,92 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_CONVERT_TO_LUA_HPP_INCLUDED
-#define LUABIND_CONVERT_TO_LUA_HPP_INCLUDED
-
-#include <luabind/config.hpp>
-#include <luabind/detail/policy.hpp>
-#include <boost/ref.hpp>
-
-#include <boost/mpl/apply_wrap.hpp>
-
-namespace luabind { namespace detail
-{
-	template<bool IsReferenceWrapper = false>
-	struct unwrap_ref
-	{
-		template<class T>
-		static const T& get(const T& r) { return r; }
-
-		template<class T>
-		struct apply
-		{
-			typedef T type;
-		};
-	};
-
-	template<>
-	struct unwrap_ref<true>
-	{
-		template<class T>
-		static T& get(const boost::reference_wrapper<T>& r) { return r.get(); }
-
-		template<class T>
-		struct apply
-		{
-			typedef typename T::type& type;
-		};
-	};
-
-	namespace mpl = boost::mpl;
-	
-	template<class T>
-	void convert_to_lua(lua_State* L, const T& v)
-	{
-		typedef typename mpl::apply_wrap1<
-			unwrap_ref<boost::is_reference_wrapper<T>::value>
-		  , T
-		>::type value_type;
-
-		typename mpl::apply_wrap2<default_policy,value_type,cpp_to_lua>::type converter;
-
-		converter.apply(L, unwrap_ref<boost::is_reference_wrapper<T>::value>::get(v));
-	}
-
-	template<int Index, class T, class Policies>
-	void convert_to_lua_p(lua_State* L, const T& v, const Policies&)
-	{
-		typedef typename mpl::apply_wrap1<
-			unwrap_ref<boost::is_reference_wrapper<T>::value>
-		  , T
-		>::type value_type;
-
-		typedef typename find_conversion_policy<Index, Policies>::type converter_policy;
-		typename mpl::apply_wrap2<converter_policy,value_type,cpp_to_lua>::type converter;
-
-		converter.apply(L, unwrap_ref<boost::is_reference_wrapper<T>::value>::get(v));
-	}
-}}
-
-#endif
-

+ 0 - 55
lib/luabind/luabind/detail/debug.hpp

@@ -1,55 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-#ifndef LUABIND_DEBUG_HPP_INCLUDED
-#define LUABIND_DEBUG_HPP_INCLUDED
-
-#ifndef NDEBUG
-
-#include <luabind/lua_include.hpp>
-#include <cassert>
-
-namespace luabind { namespace detail
-{
-	struct stack_checker_type
-	{
-		stack_checker_type(lua_State* L)
-			: m_L(L)
-			, m_stack(lua_gettop(m_L))
-		{}
-
-		~stack_checker_type()
-		{
-			assert(m_stack == lua_gettop(m_L));
-		}
-
-		lua_State* m_L;
-		int m_stack;
-	};
-
-}}
-#define LUABIND_CHECK_STACK(L) luabind::detail::stack_checker_type stack_checker_object(L)
-#else
-#define LUABIND_CHECK_STACK(L) do {} while (0)
-#endif
-
-#endif // LUABIND_DEBUG_HPP_INCLUDED

+ 0 - 266
lib/luabind/luabind/detail/decorate_type.hpp

@@ -1,266 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_DECORATE_TYPE_HPP_INCLUDED
-#define LUABIND_DECORATE_TYPE_HPP_INCLUDED
-
-#include <luabind/config.hpp>
-#include <luabind/detail/primitives.hpp>
-
-namespace luabind { namespace detail
-{
-
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-
-	template<class T>
-	struct decorated_type
-	{
-		static by_value<T> t;
-		static inline by_value<T>& get() { return /*by_value<T>()*/t; }
-	};
-
-	template<class T>
-	by_value<T> decorated_type<T>::t;
-
-	template<class T>
-	struct decorated_type<T*>
-	{
-		static by_pointer<T> t;
-		static inline by_pointer<T>& get() { return /*by_pointer<T>()*/t; }
-	};
-
-	template<class T>
-	by_pointer<T> decorated_type<T*>::t;
-
-	template<class T>
-	struct decorated_type<const T*>
-	{
-		static by_const_pointer<T> t;
-		static inline by_const_pointer<T> get() { return /*by_const_pointer<T>()*/t; }
-	};
-
-	template<class T>
-	by_const_pointer<T> decorated_type<const T*>::t;
-
-	template<class T>
-	struct decorated_type<const T* const>
-	{
-		static by_const_pointer<T> t;
-		static inline by_const_pointer<T>& get() { return /*by_const_pointer<T>()*/t; }
-	};
-
-	template<class T>
-	by_const_pointer<T> decorated_type<const T* const>::t;
-
-	template<class T>
-	struct decorated_type<T&>
-	{
-		static by_reference<T> t;
-		static inline by_reference<T>& get() { return /*by_reference<T>()*/t; }
-	};
-
-	template<class T>
-	by_reference<T> decorated_type<T&>::t;
-
-	template<class T>
-	struct decorated_type<const T&>
-	{
-		static by_const_reference<T> t;
-		static inline by_const_reference<T>& get() { return /*by_const_reference<T>()*/t; }
-	};
-
-	template<class T>
-	by_const_reference<T> decorated_type<const T&>::t;
-
-	#define LUABIND_DECORATE_TYPE(t) luabind::detail::decorated_type<t>::get()
-
-#else
-
-#include <boost/type_traits/is_array.hpp>
-
-	namespace
-	{
-		LUABIND_ANONYMOUS_FIX char decorated_type_array[64];
-	}
-
-	template<class T>
-	struct decorated_type_cref_impl
-	{
-#if defined(BOOST_MSVC) && BOOST_MSVC == 1200
-		template<class U>
-		static by_const_reference<U> get(const U&)
-		{
-			return by_const_reference<U>();
-		}
-		static T data() { return reinterpret_cast<T>(decorated_type_array); }
-#else
-	
-		static void(*data())(T)
-		{ return (void(*)(T))0; }
-
-		template<class U>
-		static by_const_reference<U> get(void(*f)(const U&))
-		{ return by_const_reference<U>(); }
-#endif
-	};
-
-	template<class T>
-	struct decorated_type_ref_impl
-	{
-#if defined(BOOST_MSVC) && BOOST_MSVC == 1200
-		template<class U>
-		static by_reference<U> get(U&)
-		{
-			return by_reference<U>();
-		}
-		static T data() { return reinterpret_cast<T>(decorated_type_array); }
-#else
-		static void(*data())(T)
-		{ return (void(*)(T))0; }
-
-		template<class U>
-		static by_reference<U> get(void(*)(U&))
-		{ return by_reference<U>(); }
-#endif
-	};
-
-	template<class T>
-	struct decorated_type_cptr_impl
-	{
-#if defined(BOOST_MSVC) && BOOST_MSVC == 1200
-		template<class U>
-		static by_const_pointer<U> get(const U*)
-		{
-			return by_const_pointer<U>();
-		}
-		static T& data() { return reinterpret_cast<T&>(decorated_type_array); }
-#else
-		static void(*data())(T)
-		{ return (void(*)(T))0; }
-
-		template<class U>
-		static by_const_pointer<U> get(void(*)(const U*))
-		{ return by_const_pointer<U>(); }
-#endif
-	};
-
-	template<class T>
-	struct decorated_type_ptr_impl
-	{
-#if defined(BOOST_MSVC) && BOOST_MSVC == 1200
-		template<class U>
-		static by_pointer<U> get(U*)
-		{
-			return by_pointer<U>();
-		}
-		static T& data() { return reinterpret_cast<T&>(decorated_type_array); }
-#else
-		static void(*data())(T)
-		{ return (void(*)(T))0; }
-
-		template<class U>
-		static by_pointer<U> get(void(*)(U*))
-		{ return by_pointer<U>(); }
-#endif
-	};
-
-	template<class T>
-	struct decorated_type_value_impl
-	{
-#if defined(BOOST_MSVC) && BOOST_MSVC == 1200
-		template<class U>
-		static by_value<U> get(U&)
-		{
-			return by_value<U>();
-		}
-		static T& data() { return reinterpret_cast<T&>(decorated_type_array); }
-#else
-		static void(*data())(T&)
-		{ return (void(*)(T&))0; }
-
-		template<class U>
-		static by_value<U> get(void(*)(U&))
-		{ return by_value<U>(); }
-#endif
-	};
-
-	template<>
-	struct decorated_type_value_impl<void>
-	{
-		static by_value<void> get(int)
-		{
-			return by_value<void>();
-		}
-		static int data() { return 0; }
-	};
-
-	template<class T>
-	struct decorated_type_array_impl
-	{
-		template<class U>
-		static by_pointer<U> get(U*)
-		{
-			return by_pointer<U>();
-		}
-
-		template<class U>
-		static by_pointer<U> get(void(*)(U))
-		{ return by_pointer<U>(); }
-
-		static T& data() { return reinterpret_cast<T&>(decorated_type_array); }
-	};
-
-	template<class T>
-	struct decorated_type
-//		: boost::mpl::if_<boost::is_array<T>
-//			,	decorated_type_array_impl<T>
-		:		boost::mpl::if_<luabind::detail::is_const_reference<T>
-					, decorated_type_cref_impl<T>
-					, typename boost::mpl::if_<luabind::detail::is_nonconst_reference<T>
-						, decorated_type_ref_impl<T>
-						, typename boost::mpl::if_<luabind::detail::is_nonconst_pointer<T>
-							, decorated_type_ptr_impl<T>
-							, typename boost::mpl::if_<luabind::detail::is_const_pointer<T>
-								, decorated_type_cptr_impl<T>
-								, decorated_type_value_impl<T>
-					>::type
-				>::type
-			>::type
-		>::type
-//	>::type
-	{
-	};
-
-#if defined(BOOST_MSVC) && BOOST_MSVC == 1200
-	#define LUABIND_DECORATE_TYPE(t) luabind::detail::decorated_type<t>::get(luabind::detail::decorated_type<t>::data())
-#else
-//	#define LUABIND_DECORATE_TYPE(t) luabind::detail::decorated_type<t>::get((void(*)(type<t>))0)
-	#define LUABIND_DECORATE_TYPE(t) luabind::detail::decorated_type<t>::get(luabind::detail::decorated_type<t>::data())
-		//#define LUABIND_DECORATE_TYPE(t) luabind::detail::decorated_type<t>::get(type<t>())
-#endif
-
-#endif
-
-}}
-
-#endif // LUABIND_DECORATE_TYPE_HPP_INCLUDED

+ 0 - 193
lib/luabind/luabind/detail/deduce_signature.hpp

@@ -1,193 +0,0 @@
-// Copyright Daniel Wallin 2008. Use, modification and distribution is
-// subject to the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#if !BOOST_PP_IS_ITERATING
-
-# ifndef LUABIND_DEDUCE_SIGNATURE_080911_HPP
-#  define LUABIND_DEDUCE_SIGNATURE_080911_HPP
-
-#  include <luabind/detail/most_derived.hpp>
-#  include <luabind/vector.hpp>
-
-#  ifndef LUABIND_CPP0x
-#   if LUABIND_MAX_ARITY <= 8
-#    include <boost/mpl/vector/vector10.hpp>
-#   else
-#    include <boost/mpl/vector/vector50.hpp>
-#   endif
-#   include <boost/preprocessor/cat.hpp>
-#   include <boost/preprocessor/iteration/iterate.hpp>
-#   include <boost/preprocessor/repetition/enum_params.hpp>
-#  endif
-
-namespace luabind { namespace detail {
-
-#  ifdef LUABIND_CPP0x
-
-template <class R, class... Args>
-vector<R, Args...> deduce_signature(R(*)(Args...), ...)
-{
-    return vector<R, Args...>();
-}
-
-template <class R, class T, class... Args>
-vector<R, T&, Args...> deduce_signature(R(T::*)(Args...))
-{
-    return vector<R, T&, Args...>();
-}
-
-template <class R, class T, class Wrapped, class... Args>
-vector<R, typename most_derived<T,Wrapped>::type&, Args...>
-deduce_signature(R(T::*)(Args...), Wrapped*)
-{
-    return vector<R, typename most_derived<T,Wrapped>::type&, Args...>();
-}
-
-template <class R, class T, class... Args>
-vector<R, T const&, Args...> deduce_signature(R(T::*)(Args...) const)
-{
-    return vector<R, T const&, Args...>();
-}
-
-template <class R, class T, class Wrapped, class... Args>
-vector<R, typename most_derived<T,Wrapped>::type const&, Args...>
-deduce_signature(R(T::*)(Args...) const, Wrapped*)
-{
-    return vector<R, typename most_derived<T,Wrapped>::type const&, Args...>();
-}
-
-// This is primarily intended to catch C++0x lambda closures. It figures out
-// the signature of a function object, and strips the object type from the
-// resulting signature:
-//
-//   vector<void, unspecified const&, ...>
-//
-//     into
-//
-//   vector<void, ...>
-//
-// This overload is all luabind needs to correctly handle monomorphic function
-// objects with a fixed signature such as C++0x lambdas. The standard doesn't
-// explicitly say that an implementation isn't allowed to add additional
-// overloads of operator() to the closure type, in practice however, noone
-// seems to.
-
-template <class Signature>
-struct strip_this_argument;
-
-template <class R, class T, class... Args>
-struct strip_this_argument<vector<R, T, Args...> >
-{
-    typedef vector<R, Args...> type;
-};
-
-template <class F>
-typename strip_this_argument<
-    decltype(deduce_signature(&F::operator()))
->::type deduce_signature(F const&)
-{
-    return typename strip_this_argument<
-        decltype(deduce_signature(&F::operator()))>::type();
-}
-
-#  else // LUABIND_CPP0x
-
-namespace mpl = boost::mpl;
-
-template <class R>
-mpl::vector1<R> deduce_signature(R(*)(), ...)
-{
-    return mpl::vector1<R>();
-}
-
-template <class R, class T>
-mpl::vector2<R,T&> deduce_signature(R(T::*)())
-{
-    return mpl::vector2<R,T&>();
-}
-
-template <class R, class T, class Wrapped>
-mpl::vector2<R,typename most_derived<T,Wrapped>::type&>
-deduce_signature(R(T::*)(), Wrapped*)
-{
-    return mpl::vector2<R,typename most_derived<T,Wrapped>::type&>();
-}
-
-template <class R, class T>
-mpl::vector2<R,T const&> deduce_signature(R(T::*)() const)
-{
-    return mpl::vector2<R,T const&>();
-}
-
-template <class R, class T, class Wrapped>
-mpl::vector2<R,typename most_derived<T,Wrapped>::type const&>
-deduce_signature(R(T::*)() const, Wrapped*)
-{
-    return mpl::vector2<R,typename most_derived<T,Wrapped>::type const&>();
-}
-
-#  define BOOST_PP_ITERATION_PARAMS_1 \
-    (3, (1, LUABIND_MAX_ARITY, <luabind/detail/deduce_signature.hpp>))
-#  include BOOST_PP_ITERATE()
-
-#  endif // LUABIND_CPP0x
-
-}} // namespace luabind::detail
-
-# endif // LUABIND_DEDUCE_SIGNATURE_080911_HPP
-
-#else // BOOST_PP_IS_ITERATING
-
-# define N BOOST_PP_ITERATION()
-# define NPLUS1 BOOST_PP_INC(N)
-
-template <class R, BOOST_PP_ENUM_PARAMS(N,class A)>
-BOOST_PP_CAT(mpl::vector,NPLUS1)<R, BOOST_PP_ENUM_PARAMS(N,A)>
-deduce_signature(R(*)(BOOST_PP_ENUM_PARAMS(N,A)), ...)
-{
-    return BOOST_PP_CAT(mpl::vector,NPLUS1)<R,BOOST_PP_ENUM_PARAMS(N,A)>();
-}
-
-# define NPLUS2 BOOST_PP_INC(NPLUS1)
-
-template <class R, class T, BOOST_PP_ENUM_PARAMS(N,class A)>
-BOOST_PP_CAT(mpl::vector,NPLUS2)<R, T&, BOOST_PP_ENUM_PARAMS(N,A)>
-deduce_signature(R(T::*)(BOOST_PP_ENUM_PARAMS(N,A)))
-{
-    return BOOST_PP_CAT(mpl::vector,NPLUS2)<R,T&,BOOST_PP_ENUM_PARAMS(N,A)>();
-}
-
-template <class R, class T, BOOST_PP_ENUM_PARAMS(N,class A), class Wrapped>
-BOOST_PP_CAT(mpl::vector,NPLUS2)<
-    R, typename most_derived<T,Wrapped>::type&, BOOST_PP_ENUM_PARAMS(N,A)
->
-deduce_signature(R(T::*)(BOOST_PP_ENUM_PARAMS(N,A)), Wrapped*)
-{
-    return BOOST_PP_CAT(mpl::vector,NPLUS2)<
-        R,typename most_derived<T,Wrapped>::type&,BOOST_PP_ENUM_PARAMS(N,A)>();
-}
-
-template <class R, class T, BOOST_PP_ENUM_PARAMS(N,class A)>
-BOOST_PP_CAT(mpl::vector,NPLUS2)<R, T const&, BOOST_PP_ENUM_PARAMS(N,A)>
-deduce_signature(R(T::*)(BOOST_PP_ENUM_PARAMS(N,A)) const)
-{
-    return BOOST_PP_CAT(mpl::vector,NPLUS2)<R,T const&,BOOST_PP_ENUM_PARAMS(N,A)>();
-}
-
-template <class R, class T, BOOST_PP_ENUM_PARAMS(N,class A), class Wrapped>
-BOOST_PP_CAT(mpl::vector,NPLUS2)<
-    R, typename most_derived<T,Wrapped>::type const&, BOOST_PP_ENUM_PARAMS(N,A)
->
-deduce_signature(R(T::*)(BOOST_PP_ENUM_PARAMS(N,A)) const, Wrapped*)
-{
-    return BOOST_PP_CAT(mpl::vector,NPLUS2)<
-        R,typename most_derived<T,Wrapped>::type const&,BOOST_PP_ENUM_PARAMS(N,A)>();
-}
-
-# undef NPLUS2
-# undef NPLUS1
-# undef N
-
-#endif  // BOOST_PP_IS_ITERATING
-

+ 0 - 123
lib/luabind/luabind/detail/enum_maker.hpp

@@ -1,123 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_ENUM_MAKER_HPP_INCLUDED
-#define LUABIND_ENUM_MAKER_HPP_INCLUDED
-
-#include <vector>
-#include <string>
-
-#include <luabind/config.hpp>
-#include <luabind/detail/class_rep.hpp>
-
-namespace luabind
-{
-	struct value;
-
-	struct value_vector : public std::vector<value>
-	{
-		// a bug in intel's compiler forces us to declare these constructors explicitly.
-		value_vector();
-		virtual ~value_vector();
-		value_vector(const value_vector& v);
-		value_vector& operator,(const value& rhs);
-	};
-
-	struct value
-	{
-	friend class std::vector<value>;
-		template<class T>
-		value(const char* name, T v)
-			: name_(name)
-			, val_(v)
-		{}
-
-		const char* name_;
-		int val_;
-
-		value_vector operator,(const value& rhs) const
-		{
-			value_vector v;
-
-			v.push_back(*this);
-			v.push_back(rhs);
-
-			return v;
-		}
-
-	private: 
-
-		value() {}
-	};
-
-	inline value_vector::value_vector()
-		: std::vector<value>()
-	{
-	}
-
-	inline value_vector::~value_vector() {}
-
-	inline value_vector::value_vector(const value_vector& rhs)
-		: std::vector<value>(rhs)
-	{
-	}
-
-	inline value_vector& value_vector::operator,(const value& rhs)
-	{
-		push_back(rhs);
-		return *this;
-	}
-
-	namespace detail
-	{
-		template<class From>
-		struct enum_maker
-		{
-			explicit enum_maker(From& from): from_(from) {}
-
-			From& operator[](const value& val)
-			{
-				from_.add_static_constant(val.name_, val.val_);
-				return from_;
-			}
-			
-			From& operator[](const value_vector& values)
-			{
-				for (value_vector::const_iterator i = values.begin(); i != values.end(); ++i)
-				{
-					from_.add_static_constant(i->name_, i->val_);
-				}
-
-				return from_;
-			}
-
-			From& from_;
-
-		private:
-            void operator=(enum_maker const&); // C4512, assignment operator could not be generated
-			template<class T> void operator,(T const&) const;
-		};
-	}
-}
-
-#endif // LUABIND_ENUM_MAKER_HPP_INCLUDED

+ 0 - 188
lib/luabind/luabind/detail/format_signature.hpp

@@ -1,188 +0,0 @@
-// Copyright Daniel Wallin 2008. Use, modification and distribution is
-// subject to the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef LUABIND_FORMAT_SIGNATURE_081014_HPP
-# define LUABIND_FORMAT_SIGNATURE_081014_HPP
-
-# include <luabind/config.hpp>
-# include <luabind/lua_include.hpp>
-# include <luabind/typeid.hpp>
-
-# include <boost/mpl/begin_end.hpp>
-# include <boost/mpl/next.hpp>
-# include <boost/mpl/size.hpp>
-
-namespace luabind { namespace adl
-{
-
-  class object;
-  class argument;
-  template <class Base>
-  struct table;
-
-} // namespace adl
-
-using adl::object;
-using adl::argument;
-using adl::table;
-
-} // namespace luabind
-
-namespace luabind { namespace detail {
-
-LUABIND_API std::string get_class_name(lua_State* L, type_id const& i);
-
-template <class T>
-struct type_to_string
-{
-    static void get(lua_State* L)
-    {
-        lua_pushstring(L, get_class_name(L, typeid(T)).c_str());
-    }
-};
-
-template <class T>
-struct type_to_string<T*>
-{
-    static void get(lua_State* L)
-    {
-        type_to_string<T>::get(L);
-        lua_pushstring(L, "*");
-        lua_concat(L, 2);
-    }
-};
-
-template <class T>
-struct type_to_string<T&>
-{
-    static void get(lua_State* L)
-    {
-        type_to_string<T>::get(L);
-        lua_pushstring(L, "&");
-        lua_concat(L, 2);
-    }
-};
-
-template <class T>
-struct type_to_string<T const>
-{
-    static void get(lua_State* L)
-    {
-        type_to_string<T>::get(L);
-        lua_pushstring(L, " const");
-        lua_concat(L, 2);
-    }
-};
-
-# define LUABIND_TYPE_TO_STRING(x) \
-    template <> \
-    struct type_to_string<x> \
-    { \
-        static void get(lua_State* L) \
-        { \
-            lua_pushstring(L, #x); \
-        } \
-    };
-
-# define LUABIND_INTEGRAL_TYPE_TO_STRING(x) \
-    LUABIND_TYPE_TO_STRING(x) \
-    LUABIND_TYPE_TO_STRING(unsigned x)
-
-LUABIND_INTEGRAL_TYPE_TO_STRING(char)
-LUABIND_INTEGRAL_TYPE_TO_STRING(short)
-LUABIND_INTEGRAL_TYPE_TO_STRING(int)
-LUABIND_INTEGRAL_TYPE_TO_STRING(long)
-
-LUABIND_TYPE_TO_STRING(void)
-LUABIND_TYPE_TO_STRING(bool)
-LUABIND_TYPE_TO_STRING(std::string)
-LUABIND_TYPE_TO_STRING(lua_State)
-
-LUABIND_TYPE_TO_STRING(luabind::object)
-LUABIND_TYPE_TO_STRING(luabind::argument)
-
-# undef LUABIND_INTEGRAL_TYPE_TO_STRING
-# undef LUABIND_TYPE_TO_STRING
-
-template <class Base>
-struct type_to_string<table<Base> >
-{
-    static void get(lua_State* L)
-    {
-        lua_pushstring(L, "table");
-    }
-};
-
-# ifndef LUABIND_CPP0x
-
-template <class End>
-void format_signature_aux(lua_State*, bool, End, End)
-{}
-
-template <class Iter, class End>
-void format_signature_aux(lua_State* L, bool first, Iter, End end)
-{
-    if (!first)
-        lua_pushstring(L, ",");
-    type_to_string<typename Iter::type>::get(L);
-    format_signature_aux(L, false, typename mpl::next<Iter>::type(), end);
-}
-
-template <class Signature>
-void format_signature(lua_State* L, char const* function, Signature)
-{
-    typedef typename mpl::begin<Signature>::type first;
-
-    type_to_string<typename first::type>::get(L);
-
-    lua_pushstring(L, " ");
-    lua_pushstring(L, function);
-
-    lua_pushstring(L, "(");
-    format_signature_aux(
-        L
-      , true
-      , typename mpl::next<first>::type()
-      , typename mpl::end<Signature>::type()
-    );
-    lua_pushstring(L, ")");
-
-    lua_concat(L, static_cast<int>(mpl::size<Signature>()) * 2 + 2);
-}
-
-# else // LUABIND_CPP0x
-
-inline void format_signature_aux(lua_State*, vector<>, bool)
-{}
-
-template <class T, class... Args>
-void format_signature_aux(lua_State* L, vector<T, Args...>, bool first = true)
-{
-    if (!first)
-        lua_pushstring(L, ",");
-    type_to_string<T>::get(L);
-    format_signature_aux(L, vector<Args...>(), false);
-}
-
-template <class R, class... Args>
-void format_signature(lua_State* L, char const* function, vector<R, Args...>)
-{
-    type_to_string<R>::get(L);
-
-    lua_pushstring(L, " ");
-    lua_pushstring(L, function);
-
-    lua_pushstring(L, "(");
-    format_signature_aux(L, vector<R, Args...>());
-    lua_pushstring(L, ")");
-
-    lua_concat(L, (sizeof...(Args) + 1) * 2 + 2);
-}
-
-# endif // LUABIND_CPP0x
-
-}} // namespace luabind::detail
-
-#endif // LUABIND_FORMAT_SIGNATURE_081014_HPP
-

+ 0 - 53
lib/luabind/luabind/detail/garbage_collector.hpp

@@ -1,53 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_GARBAGE_COLLECTOR_HPP_INCLUDED
-#define LUABIND_GARBAGE_COLLECTOR_HPP_INCLUDED
-
-#include <luabind/config.hpp>
-
-namespace luabind { namespace detail
-{
-	// function that is used as __gc metafunction on several objects
-	template<class T>
-	inline int garbage_collector(lua_State* L)
-	{
-		T* obj = static_cast<T*>(lua_touserdata(L, -1));
-		obj->~T();
-		return 0;
-	}
-
-	template<class T>
-	struct garbage_collector_s
-	{
-		static int apply(lua_State* L)
-		{
-			T* obj = static_cast<T*>(lua_touserdata(L, -1));
-			obj->~T();
-			return 0;
-		}
-	};
-
-}}
-
-#endif // LUABIND_GARBAGE_COLLECTOR_HPP_INCLUDED

+ 0 - 107
lib/luabind/luabind/detail/has_get_pointer.hpp

@@ -1,107 +0,0 @@
-// Copyright (c) 2005 Daniel Wallin
-
-// 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.
-
-#ifndef LUABIND_HAS_GET_POINTER_051022_HPP
-# define LUABIND_HAS_GET_POINTER_051022_HPP
-
-# include <boost/type_traits/add_reference.hpp>
-
-# ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
-#  include <memory>
-# endif
-
-namespace luabind { namespace detail { 
-
-namespace has_get_pointer_
-{
-
-  struct any 
-  { 
-      template<class T> any(T const&);
-  };
-
-  struct no_overload_tag 
-  {};
-
-  typedef char (&yes)[1];
-  typedef char (&no)[2];
-
-  no_overload_tag operator,(no_overload_tag, int);
-
-//
-// On compilers with ADL, we need these generic overloads in this
-// namespace as well as in luabind::. Otherwise get_pointer(any)
-// will be found before them.
-//
-# ifndef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
-
-  template<class T>
-  T* get_pointer(T const volatile*);
-
-  template<class T>
-  T* get_pointer(std::auto_ptr<T> const&);
-
-# endif
-
-//
-// On compilers that doesn't support ADL, the overload below has to
-// live in luabind::.
-//
-# ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
-}} // namespace detail::has_get_pointer_
-# endif
-
-detail::has_get_pointer_::no_overload_tag 
-  get_pointer(detail::has_get_pointer_::any);
-
-# ifdef BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
-namespace detail { namespace has_get_pointer_ 
-{
-# endif
-
-  template<class T>
-  yes check(T const&);
-  no check(no_overload_tag);
-
-  template<class T>
-  struct impl
-  {
-      static typename boost::add_reference<T>::type x;
-
-      BOOST_STATIC_CONSTANT(bool,
-          value = sizeof(has_get_pointer_::check( (get_pointer(x),0) )) == 1
-      );
-
-      typedef boost::mpl::bool_<value> type;
-  };
-
-} // namespace has_get_pointer_
-
-template<class T>
-struct has_get_pointer
-  : has_get_pointer_::impl<T>::type
-{};
-
-}} // namespace luabind::detail
-
-#endif // LUABIND_HAS_GET_POINTER_051022_HPP
-

+ 0 - 35
lib/luabind/luabind/detail/index_tuple.hpp

@@ -1,35 +0,0 @@
-// Copyright Daniel Wallin 2010. Use, modification and distribution is
-// subject to the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef LUABIND_DETAIL_INDEX_TUPLE_100629_HPP
-# define LUABIND_DETAIL_INDEX_TUPLE_100629_HPP
-
-namespace luabind { namespace detail {
-
-template <int... N>
-struct index_tuple
-{};
-
-template <int N, int I, class Indices>
-struct make_index_tuple_aux;
-
-template <int N, int I, int... Indices>
-struct make_index_tuple_aux<N, I, index_tuple<Indices...> >
-  : make_index_tuple_aux<N - 1, I + 1, index_tuple<Indices..., I> >
-{};
-
-template <int I, int... Indices>
-struct make_index_tuple_aux<0, I, index_tuple<Indices...> >
-{
-    typedef index_tuple<Indices...> type;
-};
-
-template <int N>
-struct make_index_tuple
-  : make_index_tuple_aux<N, 0, index_tuple<> >
-{};
-
-}} // namespace luabind::detail
-
-#endif // LUABIND_DETAIL_INDEX_TUPLE_100629_HPP

+ 0 - 168
lib/luabind/luabind/detail/inheritance.hpp

@@ -1,168 +0,0 @@
-// Copyright Daniel Wallin 2009. Use, modification and distribution is
-// subject to the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef LUABIND_INHERITANCE_090217_HPP
-# define LUABIND_INHERITANCE_090217_HPP
-
-# include <cassert>
-# include <limits>
-# include <map>
-# include <memory>
-# include <vector>
-# include <luabind/typeid.hpp>
-# include <boost/scoped_ptr.hpp>
-
-namespace luabind { namespace detail {
-
-typedef void*(*cast_function)(void*);
-typedef std::size_t class_id;
-
-class_id const unknown_class = (std::numeric_limits<class_id>::max)();
-
-class class_rep;
-
-class LUABIND_API cast_graph
-{
-public:
-    cast_graph();
-    ~cast_graph();
-
-    // `src` and `p` here describe the *most derived* object. This means that
-    // for a polymorphic type, the pointer must be cast with
-    // dynamic_cast<void*> before being passed in here, and `src` has to
-    // match typeid(*p).
-    std::pair<void*, int> cast(
-        void* p, class_id src, class_id target
-      , class_id dynamic_id, void const* dynamic_ptr) const;
-    void insert(class_id src, class_id target, cast_function cast);
-
-private:
-    class impl;
-    boost::scoped_ptr<impl> m_impl;
-};
-
-// Maps a type_id to a class_id. Note that this actually partitions the
-// id-space into two, using one half for "local" ids; ids that are used only as
-// keys into the conversion cache. This is needed because we need a unique key
-// even for types that hasn't been registered explicitly.
-class LUABIND_API class_id_map
-{
-public:
-    class_id_map();
-
-    class_id get(type_id const& type) const;
-    class_id get_local(type_id const& type);
-    void put(class_id id, type_id const& type);
-
-private:
-    typedef std::map<type_id, class_id> map_type;
-    map_type m_classes;
-    class_id m_local_id;
-
-    static class_id const local_id_base;
-};
-
-inline class_id_map::class_id_map()
-  : m_local_id(local_id_base)
-{}
-
-inline class_id class_id_map::get(type_id const& type) const
-{
-    map_type::const_iterator i = m_classes.find(type);
-    if (i == m_classes.end() || i->second >= local_id_base)
-        return unknown_class;
-    return i->second;
-}
-
-inline class_id class_id_map::get_local(type_id const& type)
-{
-    std::pair<map_type::iterator, bool> result = m_classes.insert(
-        std::make_pair(type, 0));
-
-    if (result.second)
-        result.first->second = m_local_id++;
-
-    assert(m_local_id >= local_id_base);
-
-    return result.first->second;
-}
-
-inline void class_id_map::put(class_id id, type_id const& type)
-{
-    assert(id < local_id_base);
-
-    std::pair<map_type::iterator, bool> result = m_classes.insert(
-        std::make_pair(type, 0));
-
-    assert(
-        result.second
-        || result.first->second == id
-        || result.first->second >= local_id_base
-    );
-
-    result.first->second = id;
-}
-
-class class_map
-{
-public:
-    class_rep* get(class_id id) const;
-    void put(class_id id, class_rep* cls);
-
-private:
-    std::vector<class_rep*> m_classes;
-};
-
-inline class_rep* class_map::get(class_id id) const
-{
-    if (id >= m_classes.size())
-        return 0;
-    return m_classes[id];
-}
-
-inline void class_map::put(class_id id, class_rep* cls)
-{
-    if (id >= m_classes.size())
-        m_classes.resize(id + 1);
-    m_classes[id] = cls;
-}
-
-template <class S, class T>
-struct static_cast_
-{
-    static void* execute(void* p)
-    {
-        return static_cast<T*>(static_cast<S*>(p));
-    }
-};
-
-template <class S, class T>
-struct dynamic_cast_
-{
-    static void* execute(void* p)
-    {
-        return dynamic_cast<T*>(static_cast<S*>(p));
-    }
-};
-
-// Thread safe class_id allocation.
-LUABIND_API class_id allocate_class_id(type_id const& cls);
-
-template <class T>
-struct registered_class
-{
-    static class_id const id;
-};
-
-template <class T>
-class_id const registered_class<T>::id = allocate_class_id(typeid(T));
-
-template <class T>
-struct registered_class<T const>
-  : registered_class<T>
-{};
-
-}} // namespace luabind::detail
-
-#endif // LUABIND_INHERITANCE_090217_HPP

+ 0 - 124
lib/luabind/luabind/detail/instance_holder.hpp

@@ -1,124 +0,0 @@
-// Copyright Daniel Wallin 2008. Use, modification and distribution is
-// subject to the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef LUABIND_INSTANCE_HOLDER_081024_HPP
-# define LUABIND_INSTANCE_HOLDER_081024_HPP
-
-# include <luabind/detail/inheritance.hpp>
-# include <luabind/get_pointer.hpp>
-# include <luabind/typeid.hpp>
-# include <boost/type_traits/is_polymorphic.hpp>
-# include <stdexcept>
-
-namespace luabind { namespace detail {
-
-class instance_holder
-{
-public:
-    instance_holder(bool pointee_const)
-      : m_pointee_const(pointee_const)
-    {}
-
-    virtual ~instance_holder()
-    {}
-
-    virtual std::pair<void*, int> get(
-        cast_graph const& casts, class_id target) const = 0;
-
-    virtual void release() = 0;
-
-    bool pointee_const() const
-    {
-        return m_pointee_const;
-    }
-
-private:
-    bool m_pointee_const;
-};
-
-namespace mpl = boost::mpl;
-
-inline mpl::false_ check_const_pointer(void*)
-{
-    return mpl::false_();
-}
-
-inline mpl::true_ check_const_pointer(void const*)
-{
-    return mpl::true_();
-}
-
-template <class T>
-void release_ownership(std::auto_ptr<T>& p)
-{
-    p.release();
-}
-
-template <class P>
-void release_ownership(P const&)
-{
-    throw std::runtime_error(
-        "luabind: smart pointer does not allow ownership transfer");
-}
-
-template <class T>
-class_id static_class_id(T*)
-{
-    return registered_class<T>::id;
-}
-
-template <class P, class Pointee = void const>
-class pointer_holder : public instance_holder
-{
-public:
-    pointer_holder(
-        P p, class_id dynamic_id, void* dynamic_ptr
-    )
-      : instance_holder(check_const_pointer(false ? get_pointer(p) : 0))
-      , p(p)
-      , weak(0)
-      , dynamic_id(dynamic_id)
-      , dynamic_ptr(dynamic_ptr)
-    {}
-
-    std::pair<void*, int> get(cast_graph const& casts, class_id target) const
-    {
-        if (target == registered_class<P>::id)
-            return std::pair<void*, int>(&this->p, 0);
-
-        void* naked_ptr = const_cast<void*>(static_cast<void const*>(
-            weak ? weak : get_pointer(p)));
-
-        if (!naked_ptr)
-            return std::pair<void*, int>((void*)0, 0);
-
-        return casts.cast(
-            naked_ptr
-          , static_class_id(false ? get_pointer(p) : 0)
-          , target
-          , dynamic_id
-          , dynamic_ptr
-        );
-    }
-
-    void release()
-    {
-        weak = const_cast<void*>(static_cast<void const*>(
-            get_pointer(p)));
-        release_ownership(p);
-    }
-
-private:
-    mutable P p;
-    // weak will hold a possibly stale pointer to the object owned
-    // by p once p has released it's owership. This is a workaround
-    // to make adopt() work with virtual function wrapper classes.
-    void* weak;
-    class_id dynamic_id;
-    void* dynamic_ptr;
-};
-
-}} // namespace luabind::detail
-
-#endif // LUABIND_INSTANCE_HOLDER_081024_HPP

+ 0 - 60
lib/luabind/luabind/detail/link_compatibility.hpp

@@ -1,60 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-#ifndef LUABIND_LINK_COMPATIBILITY_HPP_INCLUDED
-#define LUABIND_LINK_COMPATIBILITY_HPP_INCLUDED
-
-#include <luabind/config.hpp>
-
-namespace luabind { namespace detail
-{
-
-#ifdef LUABIND_NOT_THREADSAFE
-	LUABIND_API void not_threadsafe_defined_conflict();
-#else
-	LUABIND_API void not_threadsafe_not_defined_conflict();
-#endif
-
-#ifdef LUABIND_NO_ERROR_CHECKING
-	LUABIND_API void no_error_checking_defined_conflict();
-#else
-	LUABIND_API void no_error_checking_not_defined_conflict();
-#endif
-
-	inline void check_link_compatibility()
-	{
-	#ifdef LUABIND_NOT_THREADSAFE
-		not_threadsafe_defined_conflict();
-	#else
-		not_threadsafe_not_defined_conflict();
-	#endif
-
-	#ifdef LUABIND_NO_ERROR_CHECKING
-		no_error_checking_defined_conflict();
-	#else
-		no_error_checking_not_defined_conflict();
-	#endif
-	}
-
-}}
-
-#endif

+ 0 - 105
lib/luabind/luabind/detail/make_instance.hpp

@@ -1,105 +0,0 @@
-// Copyright Daniel Wallin 2009. Use, modification and distribution is
-// subject to the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef LUABIND_DETAIL_MAKE_INSTANCE_090310_HPP
-# define LUABIND_DETAIL_MAKE_INSTANCE_090310_HPP
-
-# include <boost/type_traits/is_polymorphic.hpp>
-# include <luabind/detail/inheritance.hpp>
-# include <luabind/detail/object_rep.hpp>
-
-namespace luabind { namespace detail {
-
-template <class T>
-std::pair<class_id, void*> get_dynamic_class_aux(
-    lua_State* L, T const* p, mpl::true_)
-{
-    lua_pushliteral(L, "__luabind_class_id_map");
-    lua_rawget(L, LUA_REGISTRYINDEX);
-
-    class_id_map& class_ids = *static_cast<class_id_map*>(
-        lua_touserdata(L, -1));
-
-    lua_pop(L, 1);
-
-    return std::make_pair(
-        class_ids.get_local(typeid(*p))
-      , dynamic_cast<void*>(const_cast<T*>(p))
-    );
-}
-
-template <class T>
-std::pair<class_id, void*> get_dynamic_class_aux(
-    lua_State*, T const* p, mpl::false_)
-{
-    return std::make_pair(registered_class<T>::id, (void*)p);
-}
-
-template <class T>
-std::pair<class_id, void*> get_dynamic_class(lua_State* L, T* p)
-{
-    return get_dynamic_class_aux(L, p, boost::is_polymorphic<T>());
-}
-
-template <class T>
-class_rep* get_pointee_class(class_map const& classes, T*)
-{
-    return classes.get(registered_class<T>::id);
-}
-
-template <class P>
-class_rep* get_pointee_class(lua_State* L, P const& p, class_id dynamic_id)
-{
-    lua_pushliteral(L, "__luabind_class_map");
-    lua_rawget(L, LUA_REGISTRYINDEX);
-
-    class_map const& classes = *static_cast<class_map*>(
-        lua_touserdata(L, -1));
-
-    lua_pop(L, 1);
-
-    class_rep* cls = classes.get(dynamic_id);
-
-    if (!cls)
-        cls = get_pointee_class(classes, get_pointer(p));
-
-    return cls;
-}
-
-// Create an appropriate instance holder for the given pointer like object.
-template <class P>
-void make_instance(lua_State* L, P p)
-{
-    std::pair<class_id, void*> dynamic = get_dynamic_class(L, get_pointer(p));
-
-    class_rep* cls = get_pointee_class(L, p, dynamic.first);
-
-    if (!cls)
-    {
-        throw std::runtime_error("Trying to use unregistered class");
-    }
-
-    object_rep* instance = push_new_instance(L, cls);
-
-    typedef pointer_holder<P> holder_type;
-
-    void* storage = instance->allocate(sizeof(holder_type));
-
-    try
-    {
-        new (storage) holder_type(p, dynamic.first, dynamic.second);
-    }
-    catch (...)
-    {
-        instance->deallocate(storage);
-        lua_pop(L, 1);
-        throw;
-    }
-
-    instance->set_instance(static_cast<holder_type*>(storage));
-}
-
-}} // namespace luabind::detail
-
-#endif // LUABIND_DETAIL_MAKE_INSTANCE_090310_HPP

+ 0 - 44
lib/luabind/luabind/detail/most_derived.hpp

@@ -1,44 +0,0 @@
-// Copyright (c) 2005 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-#ifndef MOST_DERIVED_051018_HPP
-# define MOST_DERIVED_051018_HPP
-
-# include <boost/mpl/if.hpp>
-# include <boost/type_traits/is_base_and_derived.hpp>
-
-namespace luabind { namespace detail {
-
-template<class Class, class WrappedClass>
-struct most_derived
-{
-    typedef typename boost::mpl::if_<
-        boost::is_base_and_derived<Class, WrappedClass>
-      , WrappedClass
-      , Class
-    >::type type;
-};
-
-}} // namespace luabind::detail
-
-#endif // MOST_DERIVED_051018_HPP
-

+ 0 - 52
lib/luabind/luabind/detail/object_call.hpp

@@ -1,52 +0,0 @@
-// Copyright (c) 2005 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-#if !BOOST_PP_IS_ITERATING
-# error Do not include object_call.hpp directly!
-#endif
-
-#include <boost/preprocessor/repetition/enum_params.hpp>
-#include <boost/preprocessor/repetition/enum_binary_params.hpp>
-#include <boost/preprocessor/facilities/intercept.hpp>
-
-#define N BOOST_PP_ITERATION()
-
-template<BOOST_PP_ENUM_PARAMS(N, class A)>
-call_proxy<
-    Derived
-  , boost::tuples::tuple<
-        BOOST_PP_ENUM_BINARY_PARAMS(N, A, const* BOOST_PP_INTERCEPT)
-    >
-> operator()(BOOST_PP_ENUM_BINARY_PARAMS(N, A, const& a))
-{
-    typedef boost::tuples::tuple<
-        BOOST_PP_ENUM_BINARY_PARAMS(N, A, const* BOOST_PP_INTERCEPT)
-    > arguments;
-
-    return call_proxy<Derived, arguments>(
-        derived()
-      , arguments(BOOST_PP_ENUM_PARAMS(N, &a))
-    );
-}
-
-#undef N
-

+ 0 - 132
lib/luabind/luabind/detail/object_rep.hpp

@@ -1,132 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_OBJECT_REP_HPP_INCLUDED
-#define LUABIND_OBJECT_REP_HPP_INCLUDED
-
-#include <cstdlib>
-#include <boost/aligned_storage.hpp>
-#include <luabind/config.hpp>
-#include <luabind/detail/class_rep.hpp>
-#include <luabind/detail/instance_holder.hpp>
-#include <luabind/detail/ref.hpp>
-
-namespace luabind { namespace detail
-{
-	void finalize(lua_State* L, class_rep* crep);
-
-	// this class is allocated inside lua for each pointer.
-	// it contains the actual c++ object-pointer.
-	// it also tells if it is const or not.
-	class LUABIND_API object_rep
-	{
-	public:
-		object_rep(instance_holder* instance, class_rep* crep);
-		~object_rep();
-
-		const class_rep* crep() const { return m_classrep; }
-		class_rep* crep() { return m_classrep; }
-
-		void set_instance(instance_holder* instance) { m_instance = instance; }
-
-		void add_dependency(lua_State* L, int index);
-        void release_dependency_refs(lua_State* L);
-
-		std::pair<void*, int> get_instance(class_id target) const
-		{
-			if (m_instance == 0)
-				return std::pair<void*, int>((void*)0, -1);
-			return m_instance->get(m_classrep->casts(), target);
-		}
-
-		bool is_const() const
-		{
-			return m_instance && m_instance->pointee_const();
-		}
-
-        void release()
-        {
-            if (m_instance)
-                m_instance->release();
-        }
-
-		void* allocate(std::size_t size)
-		{
-			if (size <= 32)
-				return &m_instance_buffer;
-			return std::malloc(size);
-		}
-
-		void deallocate(void* storage)
-		{
-			if (storage == &m_instance_buffer)
-				return;
-			std::free(storage);
-		}
-
-	private:
-
-	object_rep(object_rep const&)
-	{}
-
-	void operator=(object_rep const&)
-	{}
-
-        instance_holder* m_instance;
-        boost::aligned_storage<32> m_instance_buffer;
-		class_rep* m_classrep; // the class information about this object's type
-        std::size_t m_dependency_cnt; // counts dependencies
-	};
-
-	template<class T>
-	struct delete_s
-	{
-		static void apply(void* ptr)
-		{
-			delete static_cast<T*>(ptr);
-		}
-	};
-
-	template<class T>
-	struct destruct_only_s
-	{
-		static void apply(void* ptr)
-		{
-			// Removes unreferenced formal parameter warning on VC7.
-			(void)ptr;
-#ifndef NDEBUG
-			int completeness_check[sizeof(T)];
-			(void)completeness_check;
-#endif
-			static_cast<T*>(ptr)->~T();
-		}
-	};
-
-    LUABIND_API object_rep* get_instance(lua_State* L, int index);
-    LUABIND_API void push_instance_metatable(lua_State* L);
-    LUABIND_API object_rep* push_new_instance(lua_State* L, class_rep* cls);
-
-}}
-
-#endif // LUABIND_OBJECT_REP_HPP_INCLUDED
-

+ 0 - 45
lib/luabind/luabind/detail/open.hpp

@@ -1,45 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_OPEN_HPP_INCLUDED
-#define LUABIND_OPEN_HPP_INCLUDED
-
-#include <luabind/config.hpp>
-
-namespace luabind
-{
-	namespace detail
-	{
-		LUABIND_API void add_operator_to_metatable(lua_State* L, int op_index);
-		LUABIND_API int create_cpp_class_metatable(lua_State* L);
-		LUABIND_API int create_cpp_instance_metatable(lua_State* L);
-		LUABIND_API int create_lua_class_metatable(lua_State* L);
-		LUABIND_API int create_lua_instance_metatable(lua_State* L);
-		LUABIND_API int create_lua_function_metatable(lua_State* L);
-	}
-
-	LUABIND_API void open(lua_State* L);
-}
-
-#endif // LUABIND_OPEN_HPP_INCLUDED
-

+ 0 - 79
lib/luabind/luabind/detail/operator_id.hpp

@@ -1,79 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_OPERATOR_ID_HPP_INCLUDED
-#define LUABIND_OPERATOR_ID_HPP_INCLUDED
-
-#include <luabind/config.hpp>
-
-namespace luabind { namespace detail {
-
-	enum operator_id
-	{
-		op_add = 0,
-		op_sub,
-		op_mul,
-		op_div,
-		op_pow,
-		op_lt,
-		op_le,
-		op_eq,
-		op_call,
-		op_unm,
-		op_tostring,
-        op_concat,
-		op_len,
-
-		number_of_operators
-	};
-
-	inline const char* get_operator_name(int i)
-	{
-		static const char* a[number_of_operators] = {
-            "__add", "__sub", "__mul", "__div", "__pow", 
-            "__lt", "__le", "__eq", "__call", "__unm", 
-            "__tostring", "__concat", "__len" };
-		return a[i];
-	}
-
-	inline const char* get_operator_symbol(int i)
-	{
-		static const char* a[number_of_operators] = {
-            "+", "-", "*", "/", "^", "<", 
-            "<=", "==", "()", "- (unary)", 
-            "tostring", "..", "#" };
-		return a[i];
-	}
-
-	inline bool is_unary(int i)
-	{
-		// the reason why unary minus is not considered a unary operator here is
-		// that it always is given two parameters, where the second parameter always
-		// is nil.
-		return i == op_tostring;
-	}
-
-
-}}
-
-#endif // LUABIND_OPERATOR_ID_HPP_INCLUDED

+ 0 - 119
lib/luabind/luabind/detail/other.hpp

@@ -1,119 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_OTHER_HPP_INCLUDED
-#define LUABIND_OTHER_HPP_INCLUDED
-
-// header derived from source code found in Boost.Python
-
-// Copyright David Abrahams 2002. 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 <luabind/config.hpp>
-#include <boost/config.hpp>
-
-namespace luabind
-{
-	template<class T>
-	struct other
-	{
-		typedef T type;
-	};
-}
-
-#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-namespace luabind { namespace detail
-{
-	template<typename T>
-	class unwrap_other
-	{
-	public:
-			typedef T type;
-	};
-
-	template<typename T>
-	class unwrap_other<other<T> >
-	{
-	public:
-			typedef T type;
-	};
-}} // namespace luabind::detail
-
-# else // no partial specialization
-
-#include <boost/type.hpp>
-
-namespace luabind { namespace detail
-{
-	typedef char (&yes_other_t)[1];
-	typedef char (&no_other_t)[2];
-
-	no_other_t is_other_test(...);
-
-	template<typename T>
-	yes_other_t is_other_test(type_< other<T> >);
-
-	template<bool wrapped>
-	struct other_unwrapper
-	{
-			template <class T>
-			struct apply
-			{
-					typedef T type;
-			};
-	};
-
-	template<>
-	struct other_unwrapper<true>
-	{
-			template <class T>
-			struct apply
-			{
-					typedef typename T::type type;
-			};
-	};
-
-	template<typename T>
-	class is_other
-	{
-	 public:
-			BOOST_STATIC_CONSTANT(
-					bool, value = (
-							sizeof(detail::is_other_test(type_<T>()))
-							== sizeof(detail::yes_other_t)));
-	};
-
-	template <typename T>
-	class unwrap_other
-			: public detail::other_unwrapper<
-			is_other<T>::value
-	>::template apply<T>
-	{};
-
-}} // namespace luabind::detail
-#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-
-#endif // LUABIND_OTHER_HPP_INCLUDED

+ 0 - 36
lib/luabind/luabind/detail/pcall.hpp

@@ -1,36 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-#ifndef LUABIND_PCALL_HPP_INCLUDED
-#define LUABIND_PCALL_HPP_INCLUDED
-
-#include <luabind/config.hpp>
-
-struct lua_State;
-
-namespace luabind { namespace detail
-{
-	LUABIND_API int pcall(lua_State *L, int nargs, int nresults);
-	LUABIND_API int resume_impl(lua_State *L, int nargs, int nresults);
-}}
-
-#endif

+ 0 - 54
lib/luabind/luabind/detail/pointee_sizeof.hpp

@@ -1,54 +0,0 @@
-// Copyright (c) 2004 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-#ifndef POINTEE_SIZEOF_040211_HPP
-#define POINTEE_SIZEOF_040211_HPP
-
-#include <boost/mpl/int.hpp>
-
-namespace luabind {
-
-    namespace detail {
-
-    template<class T> T& deref_type(T(*)(), int);
-    template<class T> T& deref_type(T*(*)(), long);
-
-    } // namespace detail
-
-    // returns the indirect sizeof U, as in
-    //    sizeof(T*) = sizeof(T)
-    //    sizeof(T&) = sizeof(T)
-    //    sizeof(T)  = sizeof(T)
-    template<class T>
-    struct pointee_sizeof
-    {
-        BOOST_STATIC_CONSTANT(int, value = (
-            sizeof(detail::deref_type((T(*)())0), 0L)
-        ));
-
-        typedef boost::mpl::int_<value> type;
-    };
-
-} // namespace luabind
-
-#endif // POINTEE_SIZEOF_040211_HPP
-

+ 0 - 40
lib/luabind/luabind/detail/pointee_typeid.hpp

@@ -1,40 +0,0 @@
-// Copyright (c) 2004 Daniel Wallin
-
-// 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.
-
-#ifndef POINTEE_TYPEID_040211_HPP
-#define POINTEE_TYPEID_040211_HPP
-
-#include <luabind/config.hpp>
-#include <luabind/typeid.hpp>
-
-namespace luabind { namespace detail {
-
-    template<class T>
-    type_id pointee_typeid(T*)
-    {
-        return typeid(T);
-    }
-
-}} // namespace luabind::detail
-
-#endif // POINTEE_TYPEID_040211_HPP
-

+ 0 - 1035
lib/luabind/luabind/detail/policy.hpp

@@ -1,1035 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_POLICY_HPP_INCLUDED
-#define LUABIND_POLICY_HPP_INCLUDED
-
-#include <luabind/config.hpp>
-
-#include <typeinfo>
-#include <string>
-#include <memory>
-
-#include <boost/type_traits/is_enum.hpp>
-#include <boost/type_traits/is_array.hpp>
-#include <boost/mpl/bool.hpp>
-#include <boost/mpl/integral_c.hpp>
-#include <boost/mpl/equal_to.hpp>
-#include <boost/mpl/eval_if.hpp>
-#include <boost/mpl/or.hpp>
-#include <boost/type_traits/add_reference.hpp>
-#include <boost/type_traits/remove_reference.hpp>
-#include <boost/type_traits/is_pointer.hpp>
-#include <boost/type_traits/is_base_and_derived.hpp>
-#include <boost/bind/arg.hpp>
-#include <boost/bind/placeholders.hpp>
-#include <boost/limits.hpp>
-#include <boost/tuple/tuple.hpp>
-#include <boost/version.hpp>
-
-#include <luabind/detail/class_registry.hpp>
-#include <luabind/detail/primitives.hpp>
-#include <luabind/detail/object_rep.hpp>
-#include <luabind/detail/typetraits.hpp>
-#include <luabind/detail/debug.hpp>
-#include <luabind/detail/class_rep.hpp>
-#include <luabind/detail/has_get_pointer.hpp>
-#include <luabind/detail/make_instance.hpp>
-
-#include <boost/type_traits/add_reference.hpp>
-
-#include <luabind/detail/decorate_type.hpp>
-#include <luabind/weak_ref.hpp>
-#include <luabind/back_reference_fwd.hpp>
-
-#include <luabind/value_wrapper.hpp>
-#include <luabind/from_stack.hpp>
-#include <luabind/typeid.hpp>
-
-namespace luabind
-{
-	namespace detail
-	{
-		struct conversion_policy_base {};
-	}
-
-	template<int N, bool HasArg = true>
-	struct conversion_policy : detail::conversion_policy_base
-	{
-		BOOST_STATIC_CONSTANT(int, index = N);
-		BOOST_STATIC_CONSTANT(bool, has_arg = HasArg);
-	};
-
-	class index_map
-	{
-	public:
-		index_map(const int* m): m_map(m) {}
-
-		int operator[](int index) const
-		{
-			return m_map[index];
-		}
-
-	private:
-		const int* m_map;
-	};
-
-//	 template<class T> class functor;
-	 class weak_ref;
-}
-
-namespace luabind { namespace detail
-{
-	template<class H, class T>
-	struct policy_cons
-	{
-		typedef H head;
-		typedef T tail;
-
-		template<class U>
-		policy_cons<U, policy_cons<H,T> > operator,(policy_cons<U,detail::null_type>)
-		{
-			return policy_cons<U, policy_cons<H,T> >();
-		}
-
-		template<class U>
-		policy_cons<U, policy_cons<H,T> > operator+(policy_cons<U,detail::null_type>)
-		{
-			return policy_cons<U, policy_cons<H,T> >();
-		}
-
-		template<class U>
-		policy_cons<U, policy_cons<H,T> > operator|(policy_cons<U,detail::null_type>)
-		{
-			return policy_cons<U, policy_cons<H,T> >();
-		}
-	};
-
-	struct indirection_layer
-	{
-		template<class T>
-		indirection_layer(const T&);
-	};
-
-	yes_t is_policy_cons_test(const null_type&);
-	template<class H, class T>
-	yes_t is_policy_cons_test(const policy_cons<H,T>&);
-	no_t is_policy_cons_test(...);
-
-	template<class T>
-	struct is_policy_cons
-	{
-		static const T& t;
-
-		BOOST_STATIC_CONSTANT(bool, value = 
-			sizeof(is_policy_cons_test(t)) == sizeof(yes_t));
-
-		typedef boost::mpl::bool_<value> type;
-	};	
-
-	template<bool>
-	struct is_string_literal
-	{
-		static no_t helper(indirection_layer);
-		static yes_t helper(const char*);
-	};
-
-	template<>
-	struct is_string_literal<false>
-	{
-		static no_t helper(indirection_layer);
-	};
-	
-
-    namespace mpl = boost::mpl;
-
-    template <class T, class Clone>
-    void make_pointee_instance(lua_State* L, T& x, mpl::true_, Clone)
-    {
-        if (get_pointer(x))
-        {
-            make_instance(L, x);
-        }
-        else
-        {
-            lua_pushnil(L);
-        }
-    }
-
-    template <class T>
-    void make_pointee_instance(lua_State* L, T& x, mpl::false_, mpl::true_)
-    {
-        std::auto_ptr<T> ptr(new T(x));
-        make_instance(L, ptr);
-    }
-
-    template <class T>
-    void make_pointee_instance(lua_State* L, T& x, mpl::false_, mpl::false_)
-    {
-        make_instance(L, &x);
-    }
-
-    template <class T, class Clone>
-    void make_pointee_instance(lua_State* L, T& x, Clone)
-    {
-        make_pointee_instance(L, x, has_get_pointer<T>(), Clone());
-    }
-
-// ********** pointer converter ***********
-
-	struct pointer_converter
-	{
-		typedef pointer_converter type;
-        typedef mpl::false_ is_native;
-
-        pointer_converter()
-          : result(0)
-        {}
-
-        void* result;
-
-        int const consumed_args(...)
-        {
-            return 1;
-        }
-
-		template<class T>
-		void apply(lua_State* L, T* ptr)
-		{
-			if (ptr == 0) 
-			{
-				lua_pushnil(L);
-				return;
-			}
-
-			if (luabind::get_back_reference(L, ptr))
-				return;
-
-            make_instance(L, ptr);
-		}
-
-		template<class T>
-		T* apply(lua_State*, by_pointer<T>, int)
-		{
-            return static_cast<T*>(result);
-		}
-
-		template<class T>
-		int match(lua_State* L, by_pointer<T>, int index)
-		{
-			if (lua_isnil(L, index)) return 0;
-			object_rep* obj = get_instance(L, index);
-			if (obj == 0) return -1;
-
-            if (obj->is_const())
-                return -1;
-
-            std::pair<void*, int> s = obj->get_instance(registered_class<T>::id);
-            result = s.first;
-            return s.second;
-		}
-
-		template<class T>
-		void converter_postcall(lua_State*, by_pointer<T>, int) 
-		{}
-	};
-
-// ******* value converter *******
-
-	struct value_converter
-	{
-		typedef value_converter type;
-        typedef mpl::false_ is_native;
-
-        int const consumed_args(...)
-        {
-            return 1;
-        }
-
-        value_converter()
-          : result(0)
-        {}
-
-        void* result;
-
-		template<class T>
-		void apply(lua_State* L, T x)
-		{
-			if (luabind::get_back_reference(L, x))
-				return;
-
-            make_pointee_instance(L, x, mpl::true_());
-		}
-
-		template<class T>
-		T apply(lua_State*, by_value<T>, int)
-		{
-            return *static_cast<T*>(result);
-		}
-
-		template<class T>
-		int match(lua_State* L, by_value<T>, int index)
-		{
-			// special case if we get nil in, try to match the holder type
-			if (lua_isnil(L, index))
-				return -1;
-
-			object_rep* obj = get_instance(L, index);
-			if (obj == 0) return -1;
-
-            std::pair<void*, int> s = obj->get_instance(registered_class<T>::id);
-            result = s.first;
-            return s.second;
-		}
-
-		template<class T>
-		void converter_postcall(lua_State*, T, int) {}
-	};
-
-// ******* const pointer converter *******
-
-    struct const_pointer_converter
-	{
-		typedef const_pointer_converter type;
-        typedef mpl::false_ is_native;
-
-        int const consumed_args(...)
-        {
-            return 1;
-        }
-
-        const_pointer_converter()
-          : result(0)
-        {}
-
-        void* result;
-
-		template<class T>
-		void apply(lua_State* L, const T* ptr)
-		{
-			if (ptr == 0) 
-			{
-				lua_pushnil(L);
-				return;
-			}
-
-			if (luabind::get_back_reference(L, ptr))
-				return;
-
-            make_instance(L, ptr);
-		}
-
-		template<class T>
-		T const* apply(lua_State*, by_const_pointer<T>, int)
-		{
-			return static_cast<T const*>(result);
-		}
-
-		template<class T>
-		int match(lua_State* L, by_const_pointer<T>, int index)
-		{
-			if (lua_isnil(L, index)) return 0;
-			object_rep* obj = get_instance(L, index);
-			if (obj == 0) return -1; // if the type is not one of our own registered types, classify it as a non-match
-            std::pair<void*, int> s = obj->get_instance(registered_class<T>::id);
-            if (s.second >= 0 && !obj->is_const())
-                s.second += 10;
-            result = s.first;
-            return s.second;
-		}
-
-        template<class T>
-        void converter_postcall(lua_State*, T, int) {}
-	};
-
-// ******* reference converter *******
-
-    struct ref_converter : pointer_converter
-	{
-		typedef ref_converter type;
-        typedef mpl::false_ is_native;
-
-        int const consumed_args(...)
-        {
-            return 1;
-        }
-
-		template<class T>
-		void apply(lua_State* L, T& ref)
-		{
-			if (luabind::get_back_reference(L, ref))
-				return;
-
-            make_pointee_instance(L, ref, mpl::false_());
-		}
-
-		template<class T>
-		T& apply(lua_State* L, by_reference<T>, int index)
-		{
-			assert(!lua_isnil(L, index));
-            return *pointer_converter::apply(L, by_pointer<T>(), index);
-		}
-
-		template<class T>
-		int match(lua_State* L, by_reference<T>, int index)
-		{
-            object_rep* obj = get_instance(L, index);
-            if (obj == 0) return -1;
-
-            if (obj->is_const())
-                return -1;
-
-            std::pair<void*, int> s = obj->get_instance(registered_class<T>::id);
-            result = s.first;
-            return s.second;
-		}
-
-		template<class T>
-		void converter_postcall(lua_State*, T, int) {}
-	};
-
-// ******** const reference converter *********
-
-	struct const_ref_converter
-	{
-		typedef const_ref_converter type;
-        typedef mpl::false_ is_native;
-
-        int const consumed_args(...)
-        {
-            return 1;
-        }
-
-        const_ref_converter()
-          : result(0)
-        {}
-
-        void* result;
-
-		template<class T>
-		void apply(lua_State* L, T const& ref)
-		{
-			if (luabind::get_back_reference(L, ref))
-				return;
-
-            make_pointee_instance(L, ref, mpl::false_());
-		}
-
-		template<class T>
-		T const& apply(lua_State*, by_const_reference<T>, int)
-		{
-			return *static_cast<T*>(result);
-		}
-
-		template<class T>
-		int match(lua_State* L, by_const_reference<T>, int index)
-		{
-			object_rep* obj = get_instance(L, index);
-			if (obj == 0) return -1; // if the type is not one of our own registered types, classify it as a non-match
-
-            std::pair<void*, int> s = obj->get_instance(registered_class<T>::id);
-            if (s.second >= 0 && !obj->is_const())
-                s.second += 10;
-            result = s.first;
-            return s.second;
-		}
-
-		template<class T>
-		void converter_postcall(lua_State*, by_const_reference<T>, int)
-		{
-		}
-	};
-
-	// ****** enum converter ********
-
-	struct enum_converter
-	{
-		typedef enum_converter type;
-        typedef mpl::true_ is_native;
-
-        int const consumed_args(...)
-        {
-            return 1;
-        }
-		
-		void apply(lua_State* L, int val)
-		{
-			lua_pushnumber(L, val);
-		}
-
-		template<class T>
-		T apply(lua_State* L, by_value<T>, int index)
-		{
-			return static_cast<T>(static_cast<int>(lua_tonumber(L, index)));
-		}
-		
-		template<class T>
-		static int match(lua_State* L, by_value<T>, int index)
-		{
-			if (lua_isnumber(L, index)) return 0; else return -1;
-		}
-
-		template<class T>
-		T apply(lua_State* L, by_const_reference<T>, int index)
-		{
-			return static_cast<T>(static_cast<int>(lua_tonumber(L, index)));
-		}
-
-		template<class T>
-		static int match(lua_State* L, by_const_reference<T>, int index)
-		{
-			if (lua_isnumber(L, index)) return 0; else return -1;
-		}
-
-		template<class T>
-		void converter_postcall(lua_State*, T, int) {}
-	};
-
-	template <class U>
-	struct value_wrapper_converter
-	{
-		typedef value_wrapper_converter<U> type;
-		typedef mpl::true_ is_native;
-
-        int const consumed_args(...)
-        {
-            return 1;
-        }
-
-		template<class T>
-		T apply(lua_State* L, by_const_reference<T>, int index)
-		{
-			return T(from_stack(L, index));
-		}
-
-		template<class T>
-		T apply(lua_State* L, by_value<T>, int index)
-		{
-			return apply(L, by_const_reference<T>(), index);
-		}
-
-		template<class T>
-		static int match(lua_State* L, by_const_reference<T>, int index)
-		{
-			return value_wrapper_traits<T>::check(L, index) 
-                ? (std::numeric_limits<int>::max)() / LUABIND_MAX_ARITY
-                : -1;
-		}
-
-		template<class T>
-		static int match(lua_State* L, by_value<T>, int index)
-		{
-			return match(L, by_const_reference<T>(), index);
-		}
-
-		void converter_postcall(...) {}
-
-		template<class T>
-		void apply(lua_State* interpreter, T const& value_wrapper)
-		{
-			value_wrapper_traits<T>::unwrap(interpreter, value_wrapper);
-		}
-    };
-
-    template <class T>
-    struct default_converter_generator
-      : mpl::eval_if<
-            is_value_wrapper_arg<T>
-          , value_wrapper_converter<T>
-          , mpl::eval_if<
-                boost::is_enum<typename boost::remove_reference<T>::type>
-              , enum_converter
-              , mpl::eval_if<
-                    is_nonconst_pointer<T>
-                  , pointer_converter
-                  , mpl::eval_if<
-                        is_const_pointer<T>
-                      , const_pointer_converter
-                      , mpl::eval_if<
-                            is_nonconst_reference<T>
-                          , ref_converter
-                          , mpl::eval_if<
-                                is_const_reference<T>
-                              , const_ref_converter
-                              , value_converter
-                            >
-                        >
-                    >
-                >
-            >
-        >
-    {};
-
-} // namespace detail
-
-// *********** default_policy *****************
-
-template <class T>
-struct default_converter
-  : detail::default_converter_generator<T>::type
-{};
-
-template <class T, class Derived = default_converter<T> >
-struct native_converter_base
-{
-    typedef boost::mpl::true_ is_native;
-
-    int const consumed_args(...)
-    {
-        return 1;
-    }
-
-    template <class U>
-    void converter_postcall(lua_State*, U const&, int)
-    {}
-
-    int match(lua_State* L, detail::by_value<T>, int index)
-    {
-        return derived().compute_score(L, index);
-    }
-
-    int match(lua_State* L, detail::by_value<T const>, int index)
-    {
-        return derived().compute_score(L, index);
-    }
-
-    int match(lua_State* L, detail::by_const_reference<T>, int index)
-    {
-        return derived().compute_score(L, index);
-    }
-
-    T apply(lua_State* L, detail::by_value<T>, int index)
-    {
-        return derived().from(L, index);
-    }
-
-    T apply(lua_State* L, detail::by_value<T const>, int index)
-    {
-        return derived().from(L, index);
-    }
-
-    T apply(lua_State* L, detail::by_const_reference<T>, int index)
-    {
-        return derived().from(L, index);
-    }
-
-    void apply(lua_State* L, T const& value)
-    {
-        derived().to(L, value);
-    }
-
-    Derived& derived()
-    {
-        return static_cast<Derived&>(*this);
-    }
-};
-
-template <class T>
-lua_Integer as_lua_integer(T v)
-{
-    return static_cast<lua_Integer>(v);
-}
-
-template <class T>
-lua_Number as_lua_number(T v)
-{
-    return static_cast<lua_Number>(v);
-}
-
-# define LUABIND_NUMBER_CONVERTER(type, kind) \
-    template <> \
-struct default_converter<type> \
-  : native_converter_base<type> \
-{ \
-    int compute_score(lua_State* L, int index) \
-    { \
-        return lua_type(L, index) == LUA_TNUMBER ? 0 : -1; \
-    }; \
-    \
-    type from(lua_State* L, int index) \
-    { \
-        return static_cast<type>(BOOST_PP_CAT(lua_to, kind)(L, index)); \
-    } \
-    \
-    void to(lua_State* L, type const& value) \
-    { \
-        BOOST_PP_CAT(lua_push, kind)(L, BOOST_PP_CAT(as_lua_, kind)(value)); \
-    } \
-}; \
-\
-template <> \
-struct default_converter<type const> \
-  : default_converter<type> \
-{}; \
-\
-template <> \
-struct default_converter<type const&> \
-  : default_converter<type> \
-{};
-
-LUABIND_NUMBER_CONVERTER(char, integer)
-LUABIND_NUMBER_CONVERTER(signed char, integer)
-LUABIND_NUMBER_CONVERTER(unsigned char, integer)
-LUABIND_NUMBER_CONVERTER(signed short, integer)
-LUABIND_NUMBER_CONVERTER(unsigned short, integer)
-LUABIND_NUMBER_CONVERTER(signed int, integer)
-
-LUABIND_NUMBER_CONVERTER(unsigned int, number)
-LUABIND_NUMBER_CONVERTER(unsigned long, number)
-
-LUABIND_NUMBER_CONVERTER(signed long, integer)
-LUABIND_NUMBER_CONVERTER(float, number)
-LUABIND_NUMBER_CONVERTER(double, number)
-LUABIND_NUMBER_CONVERTER(long double, number)
-
-# undef LUABIND_NUMBER_CONVERTER
-
-template <>
-struct default_converter<bool>
-  : native_converter_base<bool>
-{
-    static int compute_score(lua_State* L, int index)
-    {
-        return lua_type(L, index) == LUA_TBOOLEAN ? 0 : -1;
-    }
-
-    bool from(lua_State* L, int index)
-    {
-        return lua_toboolean(L, index) == 1;
-    }
-
-    void to(lua_State* L, bool value)
-    {
-        lua_pushboolean(L, value);
-    }
-};
-
-template <>
-struct default_converter<bool const>
-  : default_converter<bool>
-{};
-
-template <>
-struct default_converter<bool const&>
-  : default_converter<bool>
-{};
-
-template <>
-struct default_converter<std::string>
-  : native_converter_base<std::string>
-{
-    static int compute_score(lua_State* L, int index)
-    {
-        return lua_type(L, index) == LUA_TSTRING ? 0 : -1;
-    }
-
-    std::string from(lua_State* L, int index)
-    {
-        return std::string(lua_tostring(L, index), lua_strlen(L, index));
-    }
-
-    void to(lua_State* L, std::string const& value)
-    {
-        lua_pushlstring(L, value.data(), value.size());
-    }
-};
-
-template <>
-struct default_converter<std::string const>
-  : default_converter<std::string>
-{};
-
-template <>
-struct default_converter<std::string const&>
-  : default_converter<std::string>
-{};
-
-template <>
-struct default_converter<char const*>
-{
-    typedef boost::mpl::true_ is_native;
-
-    int const consumed_args(...)
-    {
-        return 1;
-    }
-
-    template <class U>
-    static int match(lua_State* L, U, int index)
-    {
-        int type = lua_type(L, index);
-        return (type == LUA_TSTRING || type == LUA_TNIL) ? 0 : -1;
-    }
-
-    template <class U>
-    char const* apply(lua_State* L, U, int index)
-    {
-        return lua_tostring(L, index);
-    }
-
-    void apply(lua_State* L, char const* str)
-    {
-        lua_pushstring(L, str);
-    }
-
-    template <class U>
-    void converter_postcall(lua_State*, U, int)
-    {}
-};
-
-template <>
-struct default_converter<const char* const>
-  : default_converter<char const*>
-{};
-
-template <>
-struct default_converter<char*>
-  : default_converter<char const*>
-{};
-
-template <std::size_t N>
-struct default_converter<char const[N]>
-  : default_converter<char const*>
-{};
-
-template <std::size_t N>
-struct default_converter<char[N]>
-  : default_converter<char const*>
-{};
-
-template <>
-struct default_converter<lua_State*>
-{
-    int const consumed_args(...)
-    {
-        return 0;
-    }
-
-    template <class U>
-    lua_State* apply(lua_State* L, U, int)
-    {
-        return L;
-    }
-
-    template <class U>
-    static int match(lua_State*, U, int)
-    {
-        return 0;
-    }
-
-    template <class U>
-    void converter_postcall(lua_State*, U, int) {}
-};
-
-namespace detail
-{
-
-	struct default_policy : converter_policy_tag
-	{
-		BOOST_STATIC_CONSTANT(bool, has_arg = true);
-
-		template<class T>
-		static void precall(lua_State*, T, int) {}
-
-		template<class T, class Direction>
-		struct apply
-		{
-            typedef default_converter<T> type;
-        };
-	};
-
-    template<class T>
-    struct is_primitive
-      : default_converter<T>::is_native
-    {};
-
-// ============== new policy system =================
-
-	template<int, class> struct find_conversion_policy;
-
-	template<bool IsConverter = false>
-	struct find_conversion_impl
-	{
-		template<int N, class Policies>
-		struct apply
-		{
-			typedef typename find_conversion_policy<N, typename Policies::tail>::type type;
-		};
-	};
-
-	template<>
-	struct find_conversion_impl<true>
-	{
-		template<int N, class Policies>
-		struct apply
-		{
-			typedef typename Policies::head head;
-			typedef typename Policies::tail tail;
-
-			BOOST_STATIC_CONSTANT(bool, found = (N == head::index));
-
-			typedef typename
-				boost::mpl::if_c<found
-					, head
-					, typename find_conversion_policy<N, tail>::type
-				>::type type;
-		};
-	};
-
-	template<class Policies>
-	struct find_conversion_impl2
-	{
-		template<int N>
-		struct apply
-			: find_conversion_impl<
-				boost::is_base_and_derived<conversion_policy_base, typename Policies::head>::value
-			>::template apply<N, Policies>
-		{
-		};
-	};
-
-	template<>
-	struct find_conversion_impl2<detail::null_type>
-	{
-		template<int N>
-		struct apply
-		{
-			typedef default_policy type;
-		};
-	};
-
-	template<int N, class Policies>
-	struct find_conversion_policy : find_conversion_impl2<Policies>::template apply<N>
-	{
-	};
-
-	template<class List>
-	struct policy_list_postcall
-	{
-		typedef typename List::head head;
-		typedef typename List::tail tail;
-
-		static void apply(lua_State* L, const index_map& i)
-		{
-			head::postcall(L, i);
-			policy_list_postcall<tail>::apply(L, i);
-		}
-	};
-
-	template<>
-	struct policy_list_postcall<detail::null_type>
-	{
-		static void apply(lua_State*, const index_map&) {}
-	};
-
-// ==================================================
-
-// ************** precall and postcall on policy_cons *********************
-
-
-	template<class List>
-	struct policy_precall
-	{
-		typedef typename List::head head;
-		typedef typename List::tail tail;
-
-		static void apply(lua_State* L, int index)
-		{
-			head::precall(L, index);
-			policy_precall<tail>::apply(L, index);
-		}
-	};
-
-	template<>
-	struct policy_precall<detail::null_type>
-	{
-		static void apply(lua_State*, int) {}
-	};
-
-	template<class List>
-	struct policy_postcall
-	{
-		typedef typename List::head head;
-		typedef typename List::tail tail;
-
-		static void apply(lua_State* L, int index)
-		{
-			head::postcall(L, index);
-			policy_postcall<tail>::apply(L, index);
-		}
-	};
-
-	template<>
-	struct policy_postcall<detail::null_type>
-	{
-		static void apply(lua_State*, int) {}
-	};
-
-    template <class Policies, class Sought>
-    struct has_policy
-      : mpl::if_<
-            boost::is_same<typename Policies::head, Sought>
-          , mpl::true_
-          , has_policy<typename Policies::tail, Sought>
-        >::type
-    {};
-
-    template <class Sought>
-    struct has_policy<null_type, Sought>
-      : mpl::false_
-    {};
-
-}} // namespace luabind::detail
-
-
-namespace luabind { namespace
-{
-#if defined(__GNUC__) && ( \
-    (BOOST_VERSION < 103500) \
- || (BOOST_VERSION < 103900 && (__GNUC__ * 100 + __GNUC_MINOR__ <= 400)) \
- || (__GNUC__ * 100 + __GNUC_MINOR__ < 400))
-  static inline boost::arg<0> return_value()
-  {
-	  return boost::arg<0>();
-  }
-
-  static inline boost::arg<0> result()
-  {
-	  return boost::arg<0>();
-  }
-# define LUABIND_PLACEHOLDER_ARG(N) boost::arg<N>(*)()
-#elif defined(BOOST_MSVC) || defined(__MWERKS__) \
-  || (BOOST_VERSION >= 103900 && defined(__GNUC__) \
-        && (__GNUC__ * 100 + __GNUC_MINOR__ == 400))
-  static boost::arg<0> return_value;
-  static boost::arg<0> result;
-# define LUABIND_PLACEHOLDER_ARG(N) boost::arg<N>
-#else
-  boost::arg<0> return_value;
-  boost::arg<0> result;
-# define LUABIND_PLACEHOLDER_ARG(N) boost::arg<N>
-#endif
-}}
-
-#endif // LUABIND_POLICY_HPP_INCLUDED
-

+ 0 - 85
lib/luabind/luabind/detail/primitives.hpp

@@ -1,85 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_PRIMITIVES_HPP_INCLUDED
-#define LUABIND_PRIMITIVES_HPP_INCLUDED
-
-#include <algorithm>
-#include <cstring>
-
-#include <luabind/config.hpp>
-#include <luabind/detail/yes_no.hpp>
-
-namespace luabind { namespace detail
-{
-	template<class T>
-	struct identity
-	{
-		typedef T type;
-	};
-
-	template<class T>
-    struct type_ {};
-
-	struct null_type {};
-
-/*	typedef char yes_t;
-	typedef double no_t;*/
-
-	struct lua_to_cpp {};
-	struct cpp_to_lua {};
-
-	template<class T> struct by_value {};
-	template<class T> struct by_reference {};
-	template<class T> struct by_const_reference {};
-	template<class T> struct by_pointer {};
-	template<class T> struct by_const_pointer {};
-
-	struct converter_policy_tag {};
-
-	struct ltstr
-	{
-		bool operator()(const char* s1, const char* s2) const { return std::strcmp(s1, s2) < 0; }
-	};
-
-	template<int N>
-	struct aligned 
-	{
-		char storage[N];
-	};
-
-	// returns the offset added to a Derived* when cast to a Base*
-	// TODO: return ptrdiff
-	template<class Derived, class Base>
-	int ptr_offset(type_<Derived>, type_<Base>)
-	{
-		aligned<sizeof(Derived)> obj;
-		Derived* ptr = reinterpret_cast<Derived*>(&obj);
-
-		return int(static_cast<char*>(static_cast<void*>(static_cast<Base*>(ptr)))
-		- static_cast<char*>(static_cast<void*>(ptr)));
-	}
-
-}}
-
-#endif // LUABIND_PRIMITIVES_HPP_INCLUDED

+ 0 - 33
lib/luabind/luabind/detail/property.hpp

@@ -1,33 +0,0 @@
-// Copyright Daniel Wallin 2008. Use, modification and distribution is
-// subject to the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef LUABIND_PROPERTY_081020_HPP
-# define LUABIND_PROPERTY_081020_HPP
-
-namespace luabind { namespace detail {
-
-template <class Class, class T, class Result = T>
-struct access_member_ptr
-{
-    access_member_ptr(T Class::* mem_ptr)
-      : mem_ptr(mem_ptr)
-    {}
-
-    Result operator()(Class const& x) const
-    {
-        return const_cast<Class&>(x).*mem_ptr;
-    }
-
-    void operator()(Class& x, T const& value) const
-    {
-        x.*mem_ptr = value;
-    }
-
-    T Class::* mem_ptr;
-};
-
-}} // namespace luabind::detail
-
-#endif // LUABIND_PROPERTY_081020_HPP
-

+ 0 - 112
lib/luabind/luabind/detail/ref.hpp

@@ -1,112 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_REF_HPP_INCLUDED
-#define LUABIND_REF_HPP_INCLUDED
-
-#include <cassert>
-#include <algorithm>
-
-#include <luabind/config.hpp>
-#include <luabind/lua_include.hpp>
-
-namespace luabind
-{
-
-namespace detail
-{
-
-	struct lua_reference
-	{
-		lua_reference(lua_State* L_ = 0)
-			: L(L_)
-			, m_ref(LUA_NOREF)
-		{}
-		lua_reference(lua_reference const& r)
-			: L(r.L)
-			, m_ref(LUA_NOREF)
-		{
-			if (!r.is_valid()) return;
-			r.get(L);
-			set(L);
-		}
-		~lua_reference() { reset(); }
-
-		lua_State* state() const { return L; }
-
-		void operator=(lua_reference const& r)
-		{
-			// TODO: self assignment problems
-			reset();
-			if (!r.is_valid()) return;
-			r.get(r.state());
-			set(r.state());
-		}
-
-		bool is_valid() const
-		{ return m_ref != LUA_NOREF; }
-
-		void set(lua_State* L_)
-		{
-			reset();
-			L = L_;
-			m_ref = luaL_ref(L, LUA_REGISTRYINDEX);
-		}
-
-		void replace(lua_State* L_)
-		{
-			lua_rawseti(L_, LUA_REGISTRYINDEX, m_ref);
-		}
-
-		// L may not be the same pointer as
-		// was used when creating this reference
-		// since it may be a thread that shares
-		// the same globals table.
-		void get(lua_State* L_) const
-		{
-			assert(m_ref != LUA_NOREF);
-			assert(L_);
-			lua_rawgeti(L_, LUA_REGISTRYINDEX, m_ref);
-		}
-
-		void reset()
-		{
-			if (L && m_ref != LUA_NOREF) luaL_unref(L, LUA_REGISTRYINDEX, m_ref);
-			m_ref = LUA_NOREF;
-		}
-
-		void swap(lua_reference& r)
-		{
-			assert(r.L == L);
-			std::swap(r.m_ref, m_ref);
-		}
-
-	private:
-		lua_State* L;
-		int m_ref;
-	};
-
-}}
-
-#endif // LUABIND_REF_HPP_INCLUDED
-

+ 0 - 74
lib/luabind/luabind/detail/signature_match.hpp

@@ -1,74 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-#ifndef LUABIND_SIGNATURE_MATCH_HPP_INCLUDED
-#define LUABIND_SIGNATURE_MATCH_HPP_INCLUDED
-
-#include <luabind/config.hpp>
-
-#include <boost/config.hpp>
-#ifndef LUABIND_CPP0x
-# include <boost/preprocessor/repetition/enum_params.hpp>
-# include <boost/preprocessor/repetition/enum_params_with_a_default.hpp>
-# include <boost/preprocessor/cat.hpp>
-# include <boost/preprocessor/arithmetic/inc.hpp>
-# include <boost/mpl/vector.hpp>
-# include <boost/mpl/size.hpp>
-# include <boost/mpl/remove.hpp>
-#endif
-
-namespace luabind
-{
-
-	namespace adl
-	{
-		class argument;
-	}
-
-# ifdef LUABIND_CPP0x
-
-    template <class... Args>
-    struct constructor
-    {
-        typedef vector<void, argument const&, Args...> signature;
-    };
-
-# else
-
-	template<BOOST_PP_ENUM_PARAMS_WITH_A_DEFAULT(LUABIND_MAX_ARITY, class A, detail::null_type)>
-	struct constructor
-	{
-		typedef BOOST_PP_CAT(
-			boost::mpl::vector, BOOST_PP_INC(BOOST_PP_INC(LUABIND_MAX_ARITY)))<
-				void, argument const&, BOOST_PP_ENUM_PARAMS(LUABIND_MAX_ARITY, A)
-		> signature0;
-
-		typedef typename boost::mpl::remove<
-			signature0, detail::null_type>::type signature;
-	};
-
-# endif // LUABIND_CPP0x
-
-}
-
-#endif // LUABIND_SIGNATURE_MATCH_HPP_INCLUDED
-

+ 0 - 52
lib/luabind/luabind/detail/stack_utils.hpp

@@ -1,52 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-#ifndef LUABIND_STACK_UTILS_HPP_INCLUDED
-#define LUABIND_STACK_UTILS_HPP_INCLUDED
-
-#include <cassert>
-
-namespace luabind { namespace detail
-{
-
-	struct stack_pop
-	{
-		stack_pop(lua_State* L, int n)
-			: m_state(L)
-			, m_n(n)
-			{
-			}
-
-		~stack_pop() 
-		{
-			lua_pop(m_state, m_n);
-		}
-
-	private:
-
-		lua_State* m_state;
-		int m_n;
-	};
-}}
-
-#endif // LUABIND_STACK_UTILS_HPP_INCLUDED
-

+ 0 - 190
lib/luabind/luabind/detail/typetraits.hpp

@@ -1,190 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_TYPETRAITS_HPP_INCLUDED
-#define LUABIND_TYPETRAITS_HPP_INCLUDED
-
-#include <luabind/config.hpp>
-#include <boost/mpl/if.hpp>
-#include <boost/type_traits/is_reference.hpp>
-#include <boost/type_traits/is_const.hpp>
-#include <luabind/detail/primitives.hpp>
-
-namespace luabind { namespace detail 
-{
-
-#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
-
-	template<class T>
-	struct is_const_type
-	{
-		typedef typename boost::mpl::if_<boost::is_const<T>
-			, yes_t
-			, no_t
-		>::type type;
-	};
-
-	template<bool is_Reference = false>
-	struct is_const_reference_helper
-	{
-		template<class>
-		struct apply
-		{
-			enum
-			{
-				value = false
-			};
-		};
-	};
-
-	template<class T>
-	typename is_const_type<T>::type is_const_reference_tester(T&);
-	no_t is_const_reference_tester(...);
-
-	template<>
-	struct is_const_reference_helper<true>
-	{
-		template<class T>
-		struct apply
-		{
-			static T getT();
-
-			enum
-			{
-				value = sizeof(is_const_reference_tester(getT())) == sizeof(yes_t)
-			};
-		};
-	};
-
-	template<class T>
-	struct is_const_reference
-		: is_const_reference_helper<boost::is_reference<T>::value>::template apply<T>
-	{
-		typedef boost::mpl::bool_<value> type;
-	};
-
-#else
-
-	template<class T>
-	struct is_const_reference
-	{
-		enum { value = false };
-		typedef boost::mpl::bool_<value> type;
-	};
-
-	template<class T>
-	struct is_const_reference<const T&>
-	{
-		enum { value = true };
-		typedef boost::mpl::bool_<value> type;
-	};
-
-#endif
-
-
-	template<class T>
-	struct is_nonconst_reference
-	{
-		enum
-		{
-			value = boost::is_reference<T>::value && !is_const_reference<T>::value
-		};
-		typedef boost::mpl::bool_<value> type;
-	};
-
-	template<class A>
-	yes_t is_const_pointer_helper(void(*)(const A*));
-	no_t is_const_pointer_helper(...);
-
-	template<class T>
-	struct is_const_pointer
-	{
-		enum { value = sizeof(is_const_pointer_helper((void(*)(T))0)) == sizeof(yes_t) };
-		typedef boost::mpl::bool_<value> type;
-	};
-
-	template<class A>
-	yes_t is_nonconst_pointer_helper(void(*)(A*));
-	no_t is_nonconst_pointer_helper(...);
-
-	template<class T>
-	struct is_nonconst_pointer
-	{
-		enum { value = sizeof(is_nonconst_pointer_helper((void(*)(T))0)) == sizeof(yes_t) && !is_const_pointer<T>::value };
-		typedef boost::mpl::bool_<value> type;
-	};
-/*
-	template<class T>
-	struct is_constructable_from_helper
-	{
-		static yes_t check(const T&);
-		static no_t check(...);
-	};
-
-	template<class T, class From>
-	struct is_constructable_from
-	{
-		static From getFrom();
-
-		enum
-		{
-			value = sizeof(is_constructable_from_helper<T>::check(getFrom())) == sizeof(yes_t)
-		};
-	};
-
-	template<class T>
-	struct is_const_member_function_helper
-	{
-		static no_t test(...);
-		template<class R>
-		static yes_t test(R(T::*)() const);
-		template<class R, class A1>
-		static yes_t test(R(T::*)(A1) const);
-		template<class R, class A1, class A2>
-		static yes_t test(R(T::*)(A1,A2) const);
-		template<class R, class A1, class A2, class A3>
-		static yes_t test(R(T::*)(A1,A2,A3) const);
-	};
-
-	template<class T, class U>
-	struct is_const_member_function
-	{
-		static U getU();
-
-		enum
-		{
-			value = sizeof(is_const_member_function_helper<T>::test(getU())) == sizeof(yes_t)
-		};
-	};
-*/
-
-	template<int v1, int v2>
-	struct max_c
-	{
-		enum { value = (v1>v2)?v1:v2 };
-	};
-
-}}
-
-#endif // LUABIND_TYPETRAITS_HPP_INCLUDED
-

+ 0 - 34
lib/luabind/luabind/detail/yes_no.hpp

@@ -1,34 +0,0 @@
-// Copyright (c) 2004 Daniel Wallin
-
-// 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.
-
-#ifndef YES_NO_040211_HPP
-#define YES_NO_040211_HPP
-
-namespace luabind { namespace detail {
-
-    typedef char(&yes_t)[1];
-    typedef char(&no_t)[2];
-
-}} // namespace luabind::detail
-
-#endif // YES_NO_040211_HPP
-

+ 0 - 72
lib/luabind/luabind/discard_result_policy.hpp

@@ -1,72 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-
-#ifndef LUABIND_DISCARD_RESULT_POLICY_HPP_INCLUDED
-#define LUABIND_DISCARD_RESULT_POLICY_HPP_INCLUDED
-
-#include <luabind/config.hpp>
-#include <luabind/detail/policy.hpp>
-
-namespace luabind { namespace detail 
-{
-	struct discard_converter
-	{
-		template<class T>
-		void apply(lua_State*, T) {}
-	};
-
-	struct discard_result_policy : conversion_policy<0>
-	{
-		static void precall(lua_State*, const index_map&) {}
-		static void postcall(lua_State*, const index_map&) {}
-
-		struct can_only_convert_from_cpp_to_lua {};
-
-		template<class T, class Direction>
-		struct apply
-		{
-			typedef typename boost::mpl::if_<boost::is_same<Direction, cpp_to_lua>
-				, discard_converter
-				, can_only_convert_from_cpp_to_lua
-			>::type type;
-		};
-	};
-
-}}
-
-namespace luabind
-{
-  detail::policy_cons<
-      detail::discard_result_policy, detail::null_type> const discard_result = {};
-
-  namespace detail
-  {
-    inline void ignore_unused_discard_result()
-    {
-        (void)discard_result;
-    }
-  }
-}
-
-#endif // LUABIND_DISCARD_RESULT_POLICY_HPP_INCLUDED
-

+ 0 - 93
lib/luabind/luabind/error.hpp

@@ -1,93 +0,0 @@
-// Copyright (c) 2003 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-#ifndef LUABIND_ERROR_HPP_INCLUDED
-#define LUABIND_ERROR_HPP_INCLUDED
-
-#include <luabind/prefix.hpp>
-#include <exception>
-#include <luabind/config.hpp>
-#include <luabind/typeid.hpp>
-
-struct lua_State;
-
-namespace luabind
-{
-
-#ifndef LUABIND_NO_EXCEPTIONS
-
-	// this exception usually means that the lua function you called
-	// from C++ failed with an error code. You will have to
-	// read the error code from the top of the lua stack
-	// the reason why this exception class doesn't contain
-	// the message itself is that std::string's copy constructor
-	// may throw, if the copy constructor of an exception that is
-	// being thrown throws another exception, terminate will be called
-	// and the entire application is killed.
-	class LUABIND_API error : public std::exception
-	{
-	public:
-		explicit error(lua_State* L): m_L(L) {}
-		lua_State* state() const throw() { return m_L; }
-		virtual const char* what() const throw()
-		{
-			return "lua runtime error";
-		}
-	private:
-		lua_State* m_L;
-	};
-
-	// if an object_cast<>() fails, this is thrown
-	// it is also thrown if the return value of
-	// a lua function cannot be converted
-	class LUABIND_API cast_failed : public std::exception
-	{
-	public:
-		cast_failed(lua_State* L, type_id const& i): m_L(L), m_info(i) {}
-		lua_State* state() const throw() { return m_L; }
-		type_id info() const throw() { return m_info; }
-		virtual const char* what() const throw() { return "unable to make cast"; }
-	private:
-		lua_State* m_L;
-		type_id m_info;
-	};
-
-#else
-
-	typedef void(*error_callback_fun)(lua_State*);
-	typedef void(*cast_failed_callback_fun)(lua_State*, type_id const&);
-
-	LUABIND_API void set_error_callback(error_callback_fun e);
-	LUABIND_API void set_cast_failed_callback(cast_failed_callback_fun c);
-	LUABIND_API error_callback_fun get_error_callback();
-	LUABIND_API cast_failed_callback_fun get_cast_failed_callback();
-
-#endif
-
-	typedef int(*pcall_callback_fun)(lua_State*);
-	LUABIND_API void set_pcall_callback(pcall_callback_fun e);
-	LUABIND_API pcall_callback_fun get_pcall_callback();
-
-}
-
-#endif // LUABIND_ERROR_HPP_INCLUDED
-

+ 0 - 110
lib/luabind/luabind/exception_handler.hpp

@@ -1,110 +0,0 @@
-// Copyright Daniel Wallin 2005. Use, modification and distribution is
-// subject to the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef LUABIND_EXCEPTION_HANDLER_050601_HPP
-# define LUABIND_EXCEPTION_HANDLER_050601_HPP
-
-# include <luabind/lua_include.hpp>
-# include <luabind/config.hpp>
-# include <boost/optional.hpp>
-# include <boost/type.hpp>
-
-# if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
-#  include <boost/mpl/if.hpp>
-#  include <boost/type_traits/is_pointer.hpp>
-# endif
-
-namespace luabind {
-
-# ifndef LUABIND_NO_EXCEPTIONS
-
-namespace detail
-{
-
-  struct LUABIND_API exception_handler_base
-  {
-      exception_handler_base()
-        : next(0)
-      {}
-
-      virtual ~exception_handler_base() {}
-      virtual void handle(lua_State*) const = 0;
-
-      void try_next(lua_State*) const;
-
-      exception_handler_base* next;
-  };
-
-  namespace mpl = boost::mpl;
-
-  template<class E, class Handler>
-  struct exception_handler : exception_handler_base
-  {
-#  if BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
-      typedef typename mpl::if_<
-          boost::is_pointer<E>, E, E const&
-      >::type argument;
-#  else
-      typedef E const& argument;
-#  endif
-
-      exception_handler(Handler handler)
-        : handler(handler)
-      {}
-
-      void handle(lua_State* L) const
-      {
-          try
-          {
-              try_next(L);
-          }
-          catch (argument e)
-          {
-              handler(L, e);
-          }
-      }
-
-      Handler handler;
-  };
-
-  LUABIND_API void handle_exception_aux(lua_State* L);
-  LUABIND_API void register_exception_handler(exception_handler_base*);
-
-} // namespace detail
-
-# endif
-
-template<class E, class Handler>
-void register_exception_handler(Handler handler, boost::type<E>* = 0)
-{
-# ifndef LUABIND_NO_EXCEPTIONS
-    detail::register_exception_handler(
-        new detail::exception_handler<E, Handler>(handler)
-    );
-# endif
-}
-
-template<class R, class F>
-boost::optional<R> handle_exceptions(lua_State* L, F fn, boost::type<R>* = 0)
-{
-# ifndef LUABIND_NO_EXCEPTIONS
-    try
-    {
-        return fn();
-    }
-    catch (...)
-    {
-        detail::handle_exception_aux(L);
-    }
-
-    return boost::optional<R>();
-# else
-    return fn();
-# endif
-}
-
-} // namespace luabind
-
-#endif // LUABIND_EXCEPTION_HANDLER_050601_HPP
-

+ 0 - 42
lib/luabind/luabind/from_stack.hpp

@@ -1,42 +0,0 @@
-// Copyright (c) 2005 Daniel Wallin and Arvid Norberg
-
-// 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.
-
-#ifndef LUABIND_FROM_STACK_050715_HPP
-#define LUABIND_FROM_STACK_050715_HPP
-
-namespace luabind {
-
-struct from_stack
-{
-    from_stack(lua_State* interpreter, int index)
-      : interpreter(interpreter)
-      , index(index)
-    {}
-
-    lua_State* interpreter;
-    int index;
-};
-
-} // namespace luabind
-
-#endif // LUABIND_FROM_STACK_050715_HPP
-

+ 0 - 62
lib/luabind/luabind/function.hpp

@@ -1,62 +0,0 @@
-// Copyright Daniel Wallin 2008. Use, modification and distribution is
-// subject to the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef LUABIND_FUNCTION2_081014_HPP
-# define LUABIND_FUNCTION2_081014_HPP
-
-# include <luabind/make_function.hpp>
-# include <luabind/scope.hpp>
-# include <luabind/detail/call_function.hpp>
-
-namespace luabind {
-
-namespace detail
-{
-
-  template <class F, class Policies>
-  struct function_registration : registration
-  {
-      function_registration(char const* name, F f, Policies const& policies)
-        : name(name)
-        , f(f)
-        , policies(policies)
-      {}
-
-      void register_(lua_State* L) const
-      {
-          object fn = make_function(L, f, deduce_signature(f), policies);
-
-          add_overload(
-              object(from_stack(L, -1))
-            , name
-            , fn
-          );
-      }
-
-      char const* name;
-      F f;
-      Policies policies;
-  };
-
-  LUABIND_API bool is_luabind_function(lua_State* L, int index);
-
-} // namespace detail
-
-template <class F, class Policies>
-scope def(char const* name, F f, Policies const& policies)
-{
-    return scope(std::auto_ptr<detail::registration>(
-        new detail::function_registration<F, Policies>(name, f, policies)));
-}
-
-template <class F>
-scope def(char const* name, F f)
-{
-    return def(name, f, detail::null_type());
-}
-
-} // namespace luabind
-
-#endif // LUABIND_FUNCTION2_081014_HPP
-

+ 0 - 16
lib/luabind/luabind/get_main_thread.hpp

@@ -1,16 +0,0 @@
-// Copyright Daniel Wallin 2009. Use, modification and distribution is
-// subject to the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef LUABIND_GET_MAIN_THREAD_090321_HPP
-# define LUABIND_GET_MAIN_THREAD_090321_HPP
-
-# include <luabind/config.hpp>
-
-namespace luabind {
-
-LUABIND_API lua_State* get_main_thread(lua_State* L);
-
-} // namespace luabind
-
-#endif // LUABIND_GET_MAIN_THREAD_090321_HPP

+ 0 - 39
lib/luabind/luabind/get_pointer.hpp

@@ -1,39 +0,0 @@
-// Copyright (c) 2005 Daniel Wallin
-
-// 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.
-
-#ifndef LUABIND_GET_POINTER_051023_HPP
-# define LUABIND_GET_POINTER_051023_HPP
-
-//
-// We need these overloads in the luabind namespace.
-//
-
-# include <boost/get_pointer.hpp>
-
-namespace luabind {
-
-using boost::get_pointer;
-
-} // namespace luabind
-
-#endif // LUABIND_GET_POINTER_051023_HPP
-

Деякі файли не було показано, через те що забагато файлів було змінено