aboutsummaryrefslogtreecommitdiff
path: root/system/include
diff options
context:
space:
mode:
Diffstat (limited to 'system/include')
-rw-r--r--system/include/EGL/eglplatform.h2
-rw-r--r--system/include/SDL/COPYING5
-rw-r--r--system/include/SDL/SDL_config_minimal.h2
-rw-r--r--system/include/SDL/SDL_events.h70
-rw-r--r--system/include/SDL/SDL_stdinc.h2
-rw-r--r--system/include/SDL/SDL_touch.h92
-rw-r--r--system/include/emscripten/bind.h37
-rw-r--r--system/include/emscripten/emscripten.h99
-rw-r--r--system/include/emscripten/html5.h25
-rw-r--r--system/include/emscripten/val.h200
-rw-r--r--system/include/emscripten/wire.h66
-rw-r--r--system/include/execinfo.h44
-rw-r--r--system/include/gc.h2
-rw-r--r--system/include/jansson.h2
-rw-r--r--system/include/unwind.h154
15 files changed, 403 insertions, 399 deletions
diff --git a/system/include/EGL/eglplatform.h b/system/include/EGL/eglplatform.h
index 2db2cc47..77e885a8 100644
--- a/system/include/EGL/eglplatform.h
+++ b/system/include/EGL/eglplatform.h
@@ -75,7 +75,7 @@ typedef HDC EGLNativeDisplayType;
typedef HBITMAP EGLNativePixmapType;
typedef HWND EGLNativeWindowType;
-#elif defined(EMSCRIPTEN)
+#elif defined(__EMSCRIPTEN__)
typedef int EGLNativeDisplayType;
typedef int EGLNativeWindowType;
diff --git a/system/include/SDL/COPYING b/system/include/SDL/COPYING
index 15639581..71cc7e42 100644
--- a/system/include/SDL/COPYING
+++ b/system/include/SDL/COPYING
@@ -17,3 +17,8 @@ freely, subject to the following restrictions:
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
+
+---
+
+ Portions of these headers taken from SDL2 (where noted)
+ Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
diff --git a/system/include/SDL/SDL_config_minimal.h b/system/include/SDL/SDL_config_minimal.h
index ea0cec10..18951f18 100644
--- a/system/include/SDL/SDL_config_minimal.h
+++ b/system/include/SDL/SDL_config_minimal.h
@@ -33,7 +33,7 @@
#include <stddef.h>
#include <stdarg.h>
-#if !defined(EMSCRIPTEN) && !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
+#if !defined(__EMSCRIPTEN__) && !defined(_STDINT_H_) && (!defined(HAVE_STDINT_H) || !_HAVE_STDINT_H)
typedef unsigned int size_t;
typedef signed char int8_t;
typedef unsigned char uint8_t;
diff --git a/system/include/SDL/SDL_events.h b/system/include/SDL/SDL_events.h
index 8be00ceb..183ea4b2 100644
--- a/system/include/SDL/SDL_events.h
+++ b/system/include/SDL/SDL_events.h
@@ -2,6 +2,9 @@
Simple DirectMedia Layer
Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
+ Portions of these headers taken from SDL2 (where noted)
+ Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
+
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
@@ -182,33 +185,43 @@ typedef struct SDL_TextInputEvent
/**
* \brief Mouse motion event structure (event.motion.*)
*/
+/*================================= IMPORTANT ================================
+ The version of SDL_MouseMotionEvent that comes in these (emscripten)
+ headers is taken from the finalized version of SDL2
+ ============================================================================*/
+
typedef struct SDL_MouseMotionEvent
{
Uint32 type; /**< ::SDL_MOUSEMOTION */
+ Uint32 timestamp;
Uint32 windowID; /**< The window with mouse focus, if any */
- Uint8 state; /**< The current button state */
- Uint8 padding1;
- Uint8 padding2;
- Uint8 padding3;
- int x; /**< X coordinate, relative to window */
- int y; /**< Y coordinate, relative to window */
- int xrel; /**< The relative motion in the X direction */
- int yrel; /**< The relative motion in the Y direction */
+ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
+ Uint32 state; /**< The current button state */
+ Sint32 x; /**< X coordinate, relative to window */
+ Sint32 y; /**< Y coordinate, relative to window */
+ Sint32 xrel; /**< The relative motion in the X direction */
+ Sint32 yrel; /**< The relative motion in the Y direction */
} SDL_MouseMotionEvent;
/**
* \brief Mouse button event structure (event.button.*)
*/
+/*================================= IMPORTANT ================================
+ The version of SDL_MouseButtonEvent that comes in these (emscripten)
+ headers is taken from the finalized version of SDL2
+ ============================================================================*/
typedef struct SDL_MouseButtonEvent
{
Uint32 type; /**< ::SDL_MOUSEBUTTONDOWN or ::SDL_MOUSEBUTTONUP */
+ Uint32 timestamp;
Uint32 windowID; /**< The window with mouse focus, if any */
+ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
Uint8 button; /**< The mouse button index */
Uint8 state; /**< ::SDL_PRESSED or ::SDL_RELEASED */
Uint8 padding1;
Uint8 padding2;
- int x; /**< X coordinate, relative to window */
- int y; /**< Y coordinate, relative to window */
+ Sint32 x; /**< X coordinate, relative to window */
+ Sint32 y; /**< Y coordinate, relative to window */
} SDL_MouseButtonEvent;
/**
@@ -217,9 +230,11 @@ typedef struct SDL_MouseButtonEvent
typedef struct SDL_MouseWheelEvent
{
Uint32 type; /**< ::SDL_MOUSEWHEEL */
+ Uint32 timestamp;
Uint32 windowID; /**< The window with mouse focus, if any */
- int x; /**< The amount scrolled horizontally */
- int y; /**< The amount scrolled vertically */
+ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */
+ Sint32 x; /**< The amount scrolled horizontally */
+ Sint32 y; /**< The amount scrolled vertically */
} SDL_MouseWheelEvent;
/**
@@ -281,24 +296,25 @@ typedef struct SDL_JoyButtonEvent
/**
- * \brief Touch finger motion/finger event structure (event.tmotion.*)
+ * \brief Touch finger motion/finger event structure (event.tfinger.*)
*/
+
+/*================================= IMPORTANT ================================
+ The version of SDL_TouchFingerEvent that comes in these (emscripten)
+ headers is taken from the finalized version of SDL2
+ ============================================================================*/
+
typedef struct SDL_TouchFingerEvent
{
- Uint32 type; /**< ::SDL_FINGERMOTION OR
- SDL_FINGERDOWN OR SDL_FINGERUP*/
- Uint32 windowID; /**< The window with mouse focus, if any */
- SDL_TouchID touchId; /**< The touch device id */
+ Uint32 type; /**< ::SDL_FINGERMOTION or ::SDL_FINGERDOWN or ::SDL_FINGERUP */
+ Uint32 timestamp;
+ SDL_TouchID touchId; /**< The touch device id */
SDL_FingerID fingerId;
- Uint8 state; /**< The current button state */
- Uint8 padding1;
- Uint8 padding2;
- Uint8 padding3;
- Uint16 x;
- Uint16 y;
- Sint16 dx;
- Sint16 dy;
- Uint16 pressure;
+ float x; /**< Normalized in the range 0...1 */
+ float y; /**< Normalized in the range 0...1 */
+ float dx; /**< Normalized in the range 0...1 */
+ float dy; /**< Normalized in the range 0...1 */
+ float pressure; /**< Normalized in the range 0...1 */
} SDL_TouchFingerEvent;
@@ -434,7 +450,7 @@ typedef union SDL_Event
SDL_QuitEvent quit; /**< Quit request event data */
SDL_UserEvent user; /**< Custom event data */
SDL_SysWMEvent syswm; /**< System dependent window event data */
- SDL_TouchFingerEvent tfinger; /**< Touch finger event data */
+ SDL_TouchFingerEvent tfinger; /**< SDL2 Touch finger event data */
SDL_TouchButtonEvent tbutton; /**< Touch button event data */
SDL_MultiGestureEvent mgesture; /**< Multi Finger Gesture data */
SDL_DollarGestureEvent dgesture; /**< Multi Finger Gesture data */
diff --git a/system/include/SDL/SDL_stdinc.h b/system/include/SDL/SDL_stdinc.h
index c4ce7ccd..508ecdb4 100644
--- a/system/include/SDL/SDL_stdinc.h
+++ b/system/include/SDL/SDL_stdinc.h
@@ -65,7 +65,7 @@
#endif
#if defined(HAVE_INTTYPES_H)
# include <inttypes.h>
-#elif defined(EMSCRIPTEN) || defined(HAVE_STDINT_H)
+#elif defined(__EMSCRIPTEN__) || defined(HAVE_STDINT_H)
# include <stdint.h>
#endif
#ifdef HAVE_CTYPE_H
diff --git a/system/include/SDL/SDL_touch.h b/system/include/SDL/SDL_touch.h
index 587efcbf..fe238f10 100644
--- a/system/include/SDL/SDL_touch.h
+++ b/system/include/SDL/SDL_touch.h
@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -19,9 +19,15 @@
3. This notice may not be removed or altered from any source distribution.
*/
+/*
+ ================================= IMPORTANT ================================
+ This header taken from SDL2
+ ============================================================================
+*/
+
/**
* \file SDL_touch.h
- *
+ *
* Include file for SDL touch event handling.
*/
@@ -35,90 +41,52 @@
#include "begin_code.h"
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
-/* *INDENT-OFF* */
extern "C" {
-/* *INDENT-ON* */
#endif
-
typedef Sint64 SDL_TouchID;
typedef Sint64 SDL_FingerID;
+typedef struct SDL_Finger
+{
+ SDL_FingerID id;
+ float x;
+ float y;
+ float pressure;
+} SDL_Finger;
-struct SDL_Finger {
- SDL_FingerID id;
- Uint16 x;
- Uint16 y;
- Uint16 pressure;
- Uint16 xdelta;
- Uint16 ydelta;
- Uint16 last_x, last_y,last_pressure; /* the last reported coordinates */
- SDL_bool down;
-};
-
-typedef struct SDL_Touch SDL_Touch;
-typedef struct SDL_Finger SDL_Finger;
-
-
-struct SDL_Touch {
-
- /* Free the touch when it's time */
- void (*FreeTouch) (SDL_Touch * touch);
-
- /* data common for tablets */
- float pressure_max, pressure_min;
- float x_max,x_min;
- float y_max,y_min;
- Uint16 xres,yres,pressureres;
- float native_xres,native_yres,native_pressureres;
- float tilt; /* for future use */
- float rotation; /* for future use */
-
- /* Data common to all touch */
- SDL_TouchID id;
- SDL_Window *focus;
-
- char *name;
- Uint8 buttonstate;
- SDL_bool relative_mode;
- SDL_bool flush_motion;
-
- int num_fingers;
- int max_fingers;
- SDL_Finger** fingers;
-
- void *driverdata;
-};
-
+/* Used as the device ID for mouse events simulated with touch input */
+#define SDL_TOUCH_MOUSEID ((Uint32)-1)
/* Function prototypes */
/**
- * \brief Get the touch object at the given id.
- *
- *
+ * \brief Get the number of registered touch devices.
*/
- extern DECLSPEC SDL_Touch* SDLCALL SDL_GetTouch(SDL_TouchID id);
+extern DECLSPEC int SDLCALL SDL_GetNumTouchDevices(void);
+/**
+ * \brief Get the touch ID with the given index, or 0 if the index is invalid.
+ */
+extern DECLSPEC SDL_TouchID SDLCALL SDL_GetTouchDevice(int index);
+/**
+ * \brief Get the number of active fingers for a given touch device.
+ */
+extern DECLSPEC int SDLCALL SDL_GetNumTouchFingers(SDL_TouchID touchID);
/**
- * \brief Get the finger object of the given touch, at the given id.
- *
- *
+ * \brief Get the finger object of the given touch, with the given index.
*/
- extern
- DECLSPEC SDL_Finger* SDLCALL SDL_GetFinger(SDL_Touch *touch, SDL_FingerID id);
+extern DECLSPEC SDL_Finger * SDLCALL SDL_GetTouchFinger(SDL_TouchID touchID, int index);
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
-/* *INDENT-OFF* */
}
-/* *INDENT-ON* */
#endif
#include "close_code.h"
-#endif /* _SDL_mouse_h */
+#endif /* _SDL_touch_h */
/* vi: set ts=4 sw=4 expandtab: */
diff --git a/system/include/emscripten/bind.h b/system/include/emscripten/bind.h
index 390533f3..0699715c 100644
--- a/system/include/emscripten/bind.h
+++ b/system/include/emscripten/bind.h
@@ -17,8 +17,6 @@ namespace emscripten {
BY_EMVAL = 2,
};
-#define EMSCRIPTEN_ALWAYS_INLINE __attribute__((always_inline))
-
namespace internal {
typedef long GenericEnumValue;
@@ -35,18 +33,21 @@ namespace emscripten {
void _embind_register_bool(
TYPEID boolType,
const char* name,
+ size_t size,
bool trueValue,
bool falseValue);
void _embind_register_integer(
TYPEID integerType,
const char* name,
+ size_t size,
long minRange,
unsigned long maxRange);
void _embind_register_float(
TYPEID floatType,
- const char* name);
+ const char* name,
+ size_t size);
void _embind_register_std_string(
TYPEID stringType,
@@ -163,7 +164,9 @@ namespace emscripten {
void _embind_register_enum(
TYPEID enumType,
- const char* name);
+ const char* name,
+ size_t size,
+ bool isSigned);
void _embind_register_enum_value(
TYPEID enumType,
@@ -810,7 +813,7 @@ namespace emscripten {
// NOTE: this returns the class type, not the pointer type
template<typename T>
inline TYPEID getActualType(T* ptr) {
- return reinterpret_cast<TYPEID>(&typeid(*ptr));
+ return getLightTypeID(*ptr);
};
}
@@ -848,15 +851,15 @@ namespace emscripten {
template<typename T>
struct SmartPtrIfNeeded {
template<typename U>
- SmartPtrIfNeeded(U& cls) {
- cls.template smart_ptr<T>();
+ SmartPtrIfNeeded(U& cls, const char* smartPtrName) {
+ cls.template smart_ptr<T>(smartPtrName);
}
};
template<typename T>
struct SmartPtrIfNeeded<T*> {
template<typename U>
- SmartPtrIfNeeded(U&) {
+ SmartPtrIfNeeded(U&, const char*) {
}
};
};
@@ -887,7 +890,7 @@ namespace emscripten {
}
template<typename PointerType>
- const class_& smart_ptr() const {
+ const class_& smart_ptr(const char* name) const {
using namespace internal;
typedef smart_ptr_trait<PointerType> PointerTrait;
@@ -898,7 +901,7 @@ namespace emscripten {
_embind_register_smart_ptr(
TypeID<PointerType>::get(),
TypeID<PointeeType>::get(),
- typeid(PointerType).name(),
+ name,
PointerTrait::get_sharing_policy(),
reinterpret_cast<GenericFunction>(&PointerTrait::get),
reinterpret_cast<GenericFunction>(&PointerTrait::construct_null),
@@ -930,10 +933,10 @@ namespace emscripten {
}
template<typename SmartPtr, typename... Args, typename... Policies>
- const class_& smart_ptr_constructor(SmartPtr (*factory)(Args...), Policies...) const {
+ const class_& smart_ptr_constructor(const char* smartPtrName, SmartPtr (*factory)(Args...), Policies...) const {
using namespace internal;
- smart_ptr<SmartPtr>();
+ smart_ptr<SmartPtr>(smartPtrName);
typename WithPolicies<Policies...>::template ArgTypeList<SmartPtr, Args...> args;
_embind_register_class_constructor(
@@ -946,12 +949,12 @@ namespace emscripten {
}
template<typename WrapperType, typename PointerType = WrapperType*>
- const class_& allow_subclass() const {
+ const class_& allow_subclass(const char* wrapperClassName, const char* pointerName = "<UnknownPointerName>") const {
using namespace internal;
- auto cls = class_<WrapperType, base<ClassType>>(typeid(WrapperType).name())
+ auto cls = class_<WrapperType, base<ClassType>>(wrapperClassName)
;
- SmartPtrIfNeeded<PointerType> _(cls);
+ SmartPtrIfNeeded<PointerType> _(cls, pointerName);
return class_function(
"implement",
@@ -1182,7 +1185,9 @@ namespace emscripten {
enum_(const char* name) {
_embind_register_enum(
internal::TypeID<EnumType>::get(),
- name);
+ name,
+ sizeof(EnumType),
+ std::is_signed<typename std::underlying_type<EnumType>::type>::value);
}
enum_& value(const char* name, EnumType value) {
diff --git a/system/include/emscripten/emscripten.h b/system/include/emscripten/emscripten.h
index b92d920c..73836018 100644
--- a/system/include/emscripten/emscripten.h
+++ b/system/include/emscripten/emscripten.h
@@ -14,7 +14,7 @@
extern "C" {
#endif
-#if !EMSCRIPTEN
+#if !__EMSCRIPTEN__
#include <SDL/SDL.h> /* for SDL_Delay in async_call */
#endif
@@ -40,10 +40,15 @@ extern "C" {
#define EM_ASM(...) emscripten_asm_const(#__VA_ARGS__)
/*
- * Input-output versions of EM_ASM. EM_ASM_INT receives arguments of
- * either int or double type and returns an int; EM_ASM_DOUBLE
- * receives similar arguments (int or double) but returns a double.
- * Arguments arrive as $0, $1 etc; output value should be returned:
+ * Input-output versions of EM_ASM.
+ *
+ * EM_ASM_ (an extra _ is added) or EM_ASM_ARGS allow sending values
+ * (ints or doubles) into the code. If you also want a return value,
+ * EM_ASM_INT receives arguments (of int or double type)
+ * and returns an int; EM_ASM_DOUBLE does the same and returns
+ * a double.
+ *
+ * Arguments arrive as $0, $1 etc. The output value should be returned:
*
* int x = EM_ASM_INT({
* console.log('I received: ' + [$0, $1]);
@@ -54,18 +59,16 @@ extern "C" {
* (int or double) but *not* to pass any values, you can use
* EM_ASM_INT_V and EM_ASM_DOUBLE_V respectively.
*/
+#define EM_ASM_(code, ...) emscripten_asm_const_int(#code, __VA_ARGS__)
+#define EM_ASM_ARGS(code, ...) emscripten_asm_const_int(#code, __VA_ARGS__)
#define EM_ASM_INT(code, ...) emscripten_asm_const_int(#code, __VA_ARGS__)
#define EM_ASM_DOUBLE(code, ...) emscripten_asm_const_double(#code, __VA_ARGS__)
#define EM_ASM_INT_V(code) emscripten_asm_const_int(#code)
#define EM_ASM_DOUBLE_V(code) emscripten_asm_const_double(#code)
/*
- * Forces LLVM to not dead-code-eliminate a function. Note that
- * you still need to use EXPORTED_FUNCTIONS so it stays alive
- * in JS, e.g.
- * emcc -s EXPORTED_FUNCTIONS=["_main", "_myfunc"]
- * and in the source file
- * void EMSCRIPTEN_KEEPALIVE myfunc() {..}
+ * Forces LLVM to not dead-code-eliminate a function. This also
+ * exports the function, as if you added it to EXPORTED_FUNCTIONS.
*/
#define EMSCRIPTEN_KEEPALIVE __attribute__((used))
@@ -94,7 +97,7 @@ extern void emscripten_async_run_script(const char *script, int millis);
* for this is to load an asset module, that is, the output of the
* file packager.
*/
-extern void emscripten_async_load_script(const char *script, void (*onload)(), void (*onerror)());
+extern void emscripten_async_load_script(const char *script, void (*onload)(void), void (*onerror)(void));
/*
* Set a C function as the main event loop. The JS environment
@@ -135,12 +138,12 @@ extern void emscripten_async_load_script(const char *script, void (*onload)(), v
* you created an object on the stack, it will be cleaned up
* before the main loop will be called the first time.
*/
-#if EMSCRIPTEN
-extern void emscripten_set_main_loop(void (*func)(), int fps, int simulate_infinite_loop);
+#if __EMSCRIPTEN__
+extern void emscripten_set_main_loop(void (*func)(void), int fps, int simulate_infinite_loop);
extern void emscripten_set_main_loop_arg(void (*func)(void*), void *arg, int fps, int simulate_infinite_loop);
-extern void emscripten_pause_main_loop();
-extern void emscripten_resume_main_loop();
-extern void emscripten_cancel_main_loop();
+extern void emscripten_pause_main_loop(void);
+extern void emscripten_resume_main_loop(void);
+extern void emscripten_cancel_main_loop(void);
#else
#define emscripten_set_main_loop(func, fps, simulateInfiniteLoop) \
while (1) { func(); usleep(1000000/fps); }
@@ -160,7 +163,7 @@ extern void emscripten_cancel_main_loop();
* are not counted, do not block the main loop, and can fire
* at specific time in the future.
*/
-#if EMSCRIPTEN
+#if __EMSCRIPTEN__
extern void _emscripten_push_main_loop_blocker(void (*func)(void *), void *arg, const char *name);
extern void _emscripten_push_uncounted_main_loop_blocker(void (*func)(void *), void *arg, const char *name);
#else
@@ -182,7 +185,7 @@ inline void _emscripten_push_uncounted_main_loop_blocker(void (*func)(void *), v
* to 10, then push 10 blockers, as they complete the user will
* see x/10 and so forth.
*/
-#if EMSCRIPTEN
+#if __EMSCRIPTEN__
extern void emscripten_set_main_loop_expected_blockers(int num);
#else
inline void emscripten_set_main_loop_expected_blockers(int num) {}
@@ -197,7 +200,7 @@ inline void emscripten_set_main_loop_expected_blockers(int num) {}
* If millis is negative, the browser's requestAnimationFrame
* mechanism is used.
*/
-#if EMSCRIPTEN
+#if __EMSCRIPTEN__
extern void emscripten_async_call(void (*func)(void *), void *arg, int millis);
#else
inline void emscripten_async_call(void (*func)(void *), void *arg, int millis) {
@@ -212,7 +215,7 @@ inline void emscripten_async_call(void (*func)(void *), void *arg, int millis) {
* etc. are not run). This is implicitly performed when you do
* an asynchronous operation like emscripten_async_call.
*/
-extern void emscripten_exit_with_live_runtime();
+extern void emscripten_exit_with_live_runtime(void);
/*
* Hide the OS mouse cursor over the canvas. Note that SDL's
@@ -220,7 +223,7 @@ extern void emscripten_exit_with_live_runtime();
* the OS one. This command is useful to hide the OS cursor
* if your app draws its own cursor.
*/
-void emscripten_hide_mouse();
+void emscripten_hide_mouse(void);
/*
* Resizes the pixel width and height of the <canvas> element
@@ -241,11 +244,11 @@ void emscripten_get_canvas_size(int *width, int *height, int *isFullscreen);
* absolute time, and is only meaningful in comparison to
* other calls to this function. The unit is ms.
*/
-#if EMSCRIPTEN
-double emscripten_get_now();
+#if __EMSCRIPTEN__
+double emscripten_get_now(void);
#else
#include <time.h>
-double emscripten_get_now() {
+double emscripten_get_now(void) {
return (1000*clock())/(double)CLOCKS_PER_SEC;
}
#endif
@@ -253,7 +256,7 @@ double emscripten_get_now() {
/*
* Simple random number generation in [0, 1), maps to Math.random().
*/
-float emscripten_random();
+float emscripten_random(void);
/*
* This macro-looking function will cause Emscripten to
@@ -321,6 +324,28 @@ void emscripten_async_wget_data(const char* url, void *arg, void (*onload)(void*
void emscripten_async_wget2(const char* url, const char* file, const char* requesttype, const char* param, void *arg, void (*onload)(void*, const char*), void (*onerror)(void*, int), void (*onprogress)(void*, int));
/*
+ * More feature-complete version of emscripten_async_wget_data. Note:
+ * this version is experimental.
+ *
+ * The requesttype is 'GET' or 'POST',
+ * If is post request, param is the post parameter
+ * like key=value&key2=value2.
+ * The param 'arg' is a pointer will be pass to the callback
+ * The free param tells the runtime whether to free the returned buffer
+ after onload is complete. If false freeing the buffer is the receiver's
+ responsibility.
+ * The callbacks are called with an object pointer give in parameter.
+ * When file is ready then 'onload' callback will called with a pointer to
+ the buffer in memory and the size in bytes.
+ * During the download 'onprogress' callback will called. The first argument is
+ the number of bytes loaded. The second argument is the total size in bytes,
+ or zero if the size is unavailable.
+ * If any error occurred 'onerror' will called with the HTTP status code
+ and a string with the status description.
+ */
+void emscripten_async_wget2_data(const char* url, const char* requesttype, const char* param, void *arg, int free, void (*onload)(void*, void*, unsigned), void (*onerror)(void*, int, const char*), void (*onprogress)(void*, int, int));
+
+/*
* Prepare a file in asynchronous way. This does just the
* preparation part of emscripten_async_wget, that is, it
* works on file data already present, and asynchronously
@@ -398,10 +423,17 @@ void emscripten_destroy_worker(worker_handle worker);
void emscripten_call_worker(worker_handle worker, const char *funcname, char *data, int size, void (*callback)(char *, int, void*), void *arg);
/*
- * Sends a response when in a worker call. Should only be
- * called once in each call.
+ * Sends a response when in a worker call. Both functions post a message
+ * back to the thread which called the worker. The _respond_provisionally
+ * variant can be invoked multiple times, which will queue up messages to
+ * be posted to the worker's creator. Eventually, the _respond variant must
+ * be invoked, which will disallow further messages and free framework
+ * resources previously allocated for this worker call. (Calling the
+ * provisional version is optional, but you must call the non-provisional
+ * one to avoid leaks.)
*/
void emscripten_worker_respond(char *data, int size);
+void emscripten_worker_respond_provisionally(char *data, int size);
/*
* Checks how many responses are being waited for from a worker. This
@@ -445,7 +477,18 @@ void emscripten_set_network_backend(int backend);
*/
int emscripten_get_compiler_setting(const char *name);
+/*
+ * Emits
+ * debugger;
+ * inline in the code, which tells the JS engine to invoke
+ * the debugger if it gets there.
+ */
+void emscripten_debugger();
+
+
+/* ===================================== */
/* Internal APIs. Be careful with these. */
+/* ===================================== */
/*
* Profiling tools.
diff --git a/system/include/emscripten/html5.h b/system/include/emscripten/html5.h
index 06c647bf..db81725a 100644
--- a/system/include/emscripten/html5.h
+++ b/system/include/emscripten/html5.h
@@ -123,6 +123,10 @@ extern "C" {
/*
* The event structure passed in keyboard events keypress, keydown and keyup.
* https://dvcs.w3.org/hg/dom3events/raw-file/tip/html/DOM3-Events.html#keys
+ *
+ * Note that since the DOM Level 3 Events spec is very recent at the time of writing (2014-03), uniform
+ * support for the different fields in the spec is still in flux. Be sure to check the results in multiple
+ * browsers. See the unmerged pull request #2222 for an example way on how to interpret the legacy key events.
*/
typedef struct EmscriptenKeyboardEvent {
// The printed representation of the pressed key.
@@ -144,14 +148,18 @@ typedef struct EmscriptenKeyboardEvent {
EM_UTF8 locale[32];
// The following fields are values from previous versions of the DOM key events specifications.
// See https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent?redirectlocale=en-US&redirectslug=DOM%2FKeyboardEvent
- // The character representation of the key.
+ // The character representation of the key. This is the field 'char' from the docs, but renamed to charValue to avoid a C reserved word.
+ // Warning: This attribute has been dropped from DOM Level 3 events.
EM_UTF8 charValue[32];
// The Unicode reference number of the key; this attribute is used only by the keypress event. For keys whose char attribute
// contains multiple characters, this is the Unicode value of the first character in that attribute.
+ // Warning: This attribute is deprecated, you should use the field 'key' instead, if available.
unsigned long charCode;
// A system and implementation dependent numerical code identifying the unmodified value of the pressed key.
+ // Warning: This attribute is deprecated, you should use the field 'key' instead, if available.
unsigned long keyCode;
// A system and implementation dependent numeric code identifying the unmodified value of the pressed key; this is usually the same as keyCode.
+ // Warning: This attribute is deprecated, you should use the field 'key' instead, if available.
unsigned long which;
} EmscriptenKeyboardEvent;
@@ -376,7 +384,7 @@ extern EMSCRIPTEN_RESULT emscripten_lock_orientation(int allowedOrientations);
/*
* Allows the screen to turn again into any orientation.
*/
-extern EMSCRIPTEN_RESULT emscripten_unlock_orientation();
+extern EMSCRIPTEN_RESULT emscripten_unlock_orientation(void);
/*
* The event structure passed in the fullscreenchange event.
@@ -388,9 +396,16 @@ typedef struct EmscriptenFullscreenChangeEvent {
// Specifies if the current page has the ability to display elements fullscreen.
EM_BOOL fullscreenEnabled;
// The nodeName of the target HTML Element that is in full screen mode. See https://developer.mozilla.org/en-US/docs/Web/API/Node.nodeName
+ // If isFullscreen is false, then nodeName, id and elementWidth/Height specify information about the element that just exited fullscreen mode.
EM_UTF8 nodeName[128];
// The HTML Element ID of the target HTML element that is in full screen mode.
EM_UTF8 id[128];
+ // The new pixel size of the element that changed fullscreen status.
+ int elementWidth;
+ int elementHeight;
+ // The size of the whole screen, in pixels.
+ int screenWidth;
+ int screenHeight;
} EmscriptenFullscreenChangeEvent;
/*
@@ -413,7 +428,7 @@ extern EMSCRIPTEN_RESULT emscripten_request_fullscreen(const char *target, int d
/*
* Returns back to windowed browsing mode.
*/
-extern EMSCRIPTEN_RESULT emscripten_exit_fullscreen();
+extern EMSCRIPTEN_RESULT emscripten_exit_fullscreen(void);
/*
* The event structure passed in the pointerlockchange event.
@@ -449,7 +464,7 @@ extern EMSCRIPTEN_RESULT emscripten_request_pointerlock(const char *target, int
/*
* Exits pointer lock state and restores the mouse cursor to be visible again.
*/
-extern EMSCRIPTEN_RESULT emscripten_exit_pointerlock();
+extern EMSCRIPTEN_RESULT emscripten_exit_pointerlock(void);
#define EMSCRIPTEN_VISIBILITY_HIDDEN 0
#define EMSCRIPTEN_VISIBILITY_VISIBLE 1
@@ -566,7 +581,7 @@ extern EMSCRIPTEN_RESULT emscripten_set_gamepaddisconnected_callback(void *userD
* Returns the number of gamepads connected to the system or EMSCRIPTEN_RESULT_NOT_SUPPORTED if the current browser does not support gamepads.
* Note: A gamepad does not show up as connected until a button on it is pressed.
*/
-extern int emscripten_get_num_gamepads();
+extern int emscripten_get_num_gamepads(void);
/*
* Returns a snapshot of the current gamepad state.
*/
diff --git a/system/include/emscripten/val.h b/system/include/emscripten/val.h
index 19b1beb1..e217c959 100644
--- a/system/include/emscripten/val.h
+++ b/system/include/emscripten/val.h
@@ -2,6 +2,7 @@
#include <stdint.h> // uintptr_t
#include <emscripten/wire.h>
+#include <array>
#include <vector>
namespace emscripten {
@@ -12,12 +13,10 @@ namespace emscripten {
typedef struct _EM_VAL* EM_VAL;
typedef struct _EM_DESTRUCTORS* EM_DESTRUCTORS;
+ typedef struct _EM_METHOD_CALLER* EM_METHOD_CALLER;
+ typedef double EM_GENERIC_WIRE_TYPE;
+ typedef const void* EM_VAR_ARGS;
- // TODO: functions returning this are reinterpret_cast
- // into the correct return type. this needs some thought
- // for asm.js.
- typedef void _POLYMORPHIC_RESULT;
-
void _emval_incref(EM_VAL value);
void _emval_decref(EM_VAL value);
@@ -28,37 +27,45 @@ namespace emscripten {
EM_VAL _emval_undefined();
EM_VAL _emval_null();
EM_VAL _emval_new_cstring(const char*);
- void _emval_take_value(TYPEID type/*, ...*/);
+
+ EM_VAL _emval_take_value(TYPEID type, EM_VAR_ARGS argv);
EM_VAL _emval_new(
EM_VAL value,
unsigned argCount,
- internal::TYPEID argTypes[]
- /*, ... */);
+ internal::TYPEID argTypes[],
+ EM_VAR_ARGS argv);
EM_VAL _emval_get_global(const char* name);
EM_VAL _emval_get_module_property(const char* name);