diff options
author | Chad Austin <chad@imvu.com> | 2013-04-16 17:53:38 -0700 |
---|---|---|
committer | Jukka Jylänki <jujjyl@gmail.com> | 2013-04-18 20:08:18 +0300 |
commit | e5c04828c4c2eaec83cf25b83067064db2270c2e (patch) | |
tree | 5cffdf75236d2bb98674ace9c4c4bdb4226dff4c /system | |
parent | 775f840e378eba5a9a8053857113a40efb980fb7 (diff) |
fix readLatin1String to actually cover the range of latin-1 characters and add support for interned string symbols to emscripten::val
Diffstat (limited to 'system')
-rw-r--r-- | system/include/emscripten/val.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/system/include/emscripten/val.h b/system/include/emscripten/val.h index 1fccd434..42d8d375 100644 --- a/system/include/emscripten/val.h +++ b/system/include/emscripten/val.h @@ -8,6 +8,8 @@ namespace emscripten { namespace internal { // Implemented in JavaScript. Don't call these directly. extern "C" { + void _emval_register_symbol(const char*); + typedef struct _EM_VAL* EM_VAL; void _emval_incref(EM_VAL value); @@ -54,6 +56,25 @@ namespace emscripten { } } + class symbol { + public: + symbol() = delete; + + // I so wish I could require the argument to be a string literal + symbol(const char* address) + : address(address) + { + internal::_emval_register_symbol(address); + } + + operator const char*() const { + return address; + } + + private: + const char* address; + }; + class val { public: // missing operators: |