aboutsummaryrefslogtreecommitdiff
path: root/system/lib/embind/bind.cpp
diff options
context:
space:
mode:
authorChad Austin <chad@imvu.com>2013-03-06 14:21:43 -0800
committerJukka Jylänki <jujjyl@gmail.com>2013-04-12 14:25:02 +0300
commitba6204bd5ca458a3999b5f6f056b267bb1d92fed (patch)
tree4c0f3a1329c1c5dfa96e859139139dc4d7a71372 /system/lib/embind/bind.cpp
parentec62a534e990b20a3ff85cf7aa6da96e6f41e446 (diff)
Rewrite how dependent type registrations are implemented. This reduces code size both in JS and C++. There are some known bugs. I'll get to those soon.
Diffstat (limited to 'system/lib/embind/bind.cpp')
-rwxr-xr-xsystem/lib/embind/bind.cpp47
1 files changed, 20 insertions, 27 deletions
diff --git a/system/lib/embind/bind.cpp b/system/lib/embind/bind.cpp
index cbff7cf1..6c792f78 100755
--- a/system/lib/embind/bind.cpp
+++ b/system/lib/embind/bind.cpp
@@ -66,33 +66,6 @@ namespace __cxxabiv1 {
namespace emscripten {
namespace internal {
- void registerStandardTypes() {
- static bool first = true;
- if (first) {
- first = false;
-
- _embind_register_void(TypeID<void>::get(), "void");
-
- _embind_register_bool(TypeID<bool>::get(), "bool", true, false);
-
- _embind_register_integer(TypeID<char>::get(), "char");
- _embind_register_integer(TypeID<signed char>::get(), "signed char");
- _embind_register_integer(TypeID<unsigned char>::get(), "unsigned char");
- _embind_register_integer(TypeID<signed short>::get(), "short");
- _embind_register_integer(TypeID<unsigned short>::get(), "unsigned short");
- _embind_register_integer(TypeID<signed int>::get(), "int");
- _embind_register_integer(TypeID<unsigned int>::get(), "unsigned int");
- _embind_register_integer(TypeID<signed long>::get(), "long");
- _embind_register_integer(TypeID<unsigned long>::get(), "unsigned long");
-
- _embind_register_float(TypeID<float>::get(), "float");
- _embind_register_float(TypeID<double>::get(), "double");
-
- _embind_register_cstring(TypeID<std::string>::get(), "std::string");
- _embind_register_emval(TypeID<val>::get(), "emscripten::val");
- }
- }
-
// __getDerivationPath returns an array of type_info pointers describing the derivation chain starting with
// the derived type and proceeding toward (and ending with) the base type. Types are only included if they
// appear on all possible derivation paths.
@@ -216,6 +189,26 @@ namespace emscripten {
}
EMSCRIPTEN_BINDINGS(([]() {
+ _embind_register_void(TypeID<void>::get(), "void");
+
+ _embind_register_bool(TypeID<bool>::get(), "bool", true, false);
+
+ _embind_register_integer(TypeID<char>::get(), "char");
+ _embind_register_integer(TypeID<signed char>::get(), "signed char");
+ _embind_register_integer(TypeID<unsigned char>::get(), "unsigned char");
+ _embind_register_integer(TypeID<signed short>::get(), "short");
+ _embind_register_integer(TypeID<unsigned short>::get(), "unsigned short");
+ _embind_register_integer(TypeID<signed int>::get(), "int");
+ _embind_register_integer(TypeID<unsigned int>::get(), "unsigned int");
+ _embind_register_integer(TypeID<signed long>::get(), "long");
+ _embind_register_integer(TypeID<unsigned long>::get(), "unsigned long");
+
+ _embind_register_float(TypeID<float>::get(), "float");
+ _embind_register_float(TypeID<double>::get(), "double");
+
+ _embind_register_cstring(TypeID<std::string>::get(), "std::string");
+ _embind_register_emval(TypeID<val>::get(), "emscripten::val");
+
// We bind __getDerivationPath in order to take advantage of the std::vector to Javascript array
// conversion for the return value. This has the unfortunate side-effect of exposing it to third party
// developers, but perhaps the double underscore will scare them away from calling it.