webruby 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/webruby +36 -0
- data/driver/driver.c +50 -0
- data/driver/main.c +40 -0
- data/lib/webruby/app.rb +13 -0
- data/lib/webruby/config.rb +61 -0
- data/lib/webruby/environment.rb +32 -0
- data/lib/webruby/rake/files.rake +66 -0
- data/lib/webruby/rake/general.rake +22 -0
- data/lib/webruby/rake/mruby.rake +44 -0
- data/lib/webruby/utility.rb +132 -0
- data/lib/webruby.rb +10 -0
- data/modules/emscripten/AUTHORS +89 -0
- data/modules/emscripten/LICENSE +68 -0
- data/modules/emscripten/README.markdown +14 -0
- data/modules/emscripten/cmake/Platform/Emscripten.cmake +61 -0
- data/modules/emscripten/cmake/Platform/Emscripten_unix.cmake +24 -0
- data/modules/emscripten/em++ +12 -0
- data/modules/emscripten/em++.bat +2 -0
- data/modules/emscripten/em-config +24 -0
- data/modules/emscripten/em-config.bat +2 -0
- data/modules/emscripten/emar +24 -0
- data/modules/emscripten/emar.bat +2 -0
- data/modules/emscripten/emcc +1744 -0
- data/modules/emscripten/emcc.bat +2 -0
- data/modules/emscripten/emcc.py +5 -0
- data/modules/emscripten/emconfigure +27 -0
- data/modules/emscripten/emconfigure.bat +2 -0
- data/modules/emscripten/emlibtool +11 -0
- data/modules/emscripten/emlibtool.bat +2 -0
- data/modules/emscripten/emlink.py +293 -0
- data/modules/emscripten/emmake +29 -0
- data/modules/emscripten/emmake.bat +2 -0
- data/modules/emscripten/emranlib +9 -0
- data/modules/emscripten/emranlib.bat +2 -0
- data/modules/emscripten/emscons +20 -0
- data/modules/emscripten/emscripten.py +835 -0
- data/modules/emscripten/patches/README +4 -0
- data/modules/emscripten/patches/series +2 -0
- data/modules/emscripten/scons-tools/closure.py +28 -0
- data/modules/emscripten/scons-tools/emscripten.py +359 -0
- data/modules/emscripten/scons-tools/llvm.py +33 -0
- data/modules/emscripten/src/analyzer.js +1695 -0
- data/modules/emscripten/src/compiler.html +48 -0
- data/modules/emscripten/src/compiler.js +298 -0
- data/modules/emscripten/src/corruptionCheck.js +98 -0
- data/modules/emscripten/src/determinstic.js +20 -0
- data/modules/emscripten/src/embind/embind.js +1677 -0
- data/modules/emscripten/src/embind/emval.js +283 -0
- data/modules/emscripten/src/experimental/allow_loopvars_from_memsetcpy_inasm.diff +97 -0
- data/modules/emscripten/src/experimental/batching.diff +44 -0
- data/modules/emscripten/src/experimental/functypeopt.diff +113 -0
- data/modules/emscripten/src/experimental/multiple_heaps.diff +175 -0
- data/modules/emscripten/src/experimental/noncallgraphprofiling.diff +197 -0
- data/modules/emscripten/src/experimental/optimize_memcpy_for_ta1.diff +124 -0
- data/modules/emscripten/src/experimental/remove__label__s.diff +140 -0
- data/modules/emscripten/src/experimental/renderer_cache_hash.diff +99 -0
- data/modules/emscripten/src/experimental/sdl_key_forwarding.diff +57 -0
- data/modules/emscripten/src/experimental/simplifyGeneratedFunctionsDetection.diff +336 -0
- data/modules/emscripten/src/experimental/stringCache.diff +147 -0
- data/modules/emscripten/src/fastLong.js +299 -0
- data/modules/emscripten/src/framework.js +257 -0
- data/modules/emscripten/src/gl-matrix.js +1952 -0
- data/modules/emscripten/src/headless.js +904 -0
- data/modules/emscripten/src/intertyper.js +1050 -0
- data/modules/emscripten/src/jsifier.js +1827 -0
- data/modules/emscripten/src/library.js +8270 -0
- data/modules/emscripten/src/library_browser.js +911 -0
- data/modules/emscripten/src/library_egl.js +491 -0
- data/modules/emscripten/src/library_gc.js +236 -0
- data/modules/emscripten/src/library_gl.js +4452 -0
- data/modules/emscripten/src/library_glfw.js +576 -0
- data/modules/emscripten/src/library_glut.js +449 -0
- data/modules/emscripten/src/library_jansson.js +320 -0
- data/modules/emscripten/src/library_openal.js +602 -0
- data/modules/emscripten/src/library_sdl.js +2024 -0
- data/modules/emscripten/src/library_strtok_r.c +97 -0
- data/modules/emscripten/src/library_xlib.js +23 -0
- data/modules/emscripten/src/long.js +1609 -0
- data/modules/emscripten/src/modules.js +491 -0
- data/modules/emscripten/src/parseTools.js +2474 -0
- data/modules/emscripten/src/postamble.js +170 -0
- data/modules/emscripten/src/postamble_sharedlib.js +16 -0
- data/modules/emscripten/src/preamble.js +914 -0
- data/modules/emscripten/src/preamble_sharedlib.js +25 -0
- data/modules/emscripten/src/relooper/README.markdown +14 -0
- data/modules/emscripten/src/relooper/Relooper.cpp +1236 -0
- data/modules/emscripten/src/relooper/Relooper.h +250 -0
- data/modules/emscripten/src/relooper/doit.sh +70 -0
- data/modules/emscripten/src/relooper/emscripten/glue.js +57 -0
- data/modules/emscripten/src/relooper/emscripten/test.js +44 -0
- data/modules/emscripten/src/relooper/fuzzer.py +116 -0
- data/modules/emscripten/src/relooper/ministring.h +35 -0
- data/modules/emscripten/src/relooper/paper.pdf +0 -0
- data/modules/emscripten/src/relooper/test.cpp +262 -0
- data/modules/emscripten/src/relooper/test.txt +155 -0
- data/modules/emscripten/src/relooper/test2.c +44 -0
- data/modules/emscripten/src/relooper/test2.txt +12 -0
- data/modules/emscripten/src/relooper/test3.c +42 -0
- data/modules/emscripten/src/relooper/test3.txt +27 -0
- data/modules/emscripten/src/relooper/test4.cpp +40 -0
- data/modules/emscripten/src/relooper/test4.txt +23 -0
- data/modules/emscripten/src/relooper/test5.cpp +40 -0
- data/modules/emscripten/src/relooper/test5.txt +32 -0
- data/modules/emscripten/src/relooper/test6.cpp +31 -0
- data/modules/emscripten/src/relooper/test6.txt +12 -0
- data/modules/emscripten/src/relooper/test_dead.cpp +28 -0
- data/modules/emscripten/src/relooper/test_dead.txt +9 -0
- data/modules/emscripten/src/relooper/test_debug.cpp +30 -0
- data/modules/emscripten/src/relooper/test_debug.txt +128 -0
- data/modules/emscripten/src/relooper/test_fuzz1.cpp +52 -0
- data/modules/emscripten/src/relooper/test_fuzz1.txt +32 -0
- data/modules/emscripten/src/relooper/test_fuzz2.cpp +34 -0
- data/modules/emscripten/src/relooper/test_fuzz2.txt +13 -0
- data/modules/emscripten/src/relooper/test_fuzz3.cpp +36 -0
- data/modules/emscripten/src/relooper/test_fuzz3.txt +9 -0
- data/modules/emscripten/src/relooper/test_fuzz4.cpp +38 -0
- data/modules/emscripten/src/relooper/test_fuzz4.txt +19 -0
- data/modules/emscripten/src/relooper/test_fuzz5.cpp +57 -0
- data/modules/emscripten/src/relooper/test_fuzz5.txt +52 -0
- data/modules/emscripten/src/relooper/test_fuzz6.cpp +322 -0
- data/modules/emscripten/src/relooper/test_fuzz6.txt +108 -0
- data/modules/emscripten/src/relooper/test_inf.cpp +813 -0
- data/modules/emscripten/src/relooper/test_inf.txt +385 -0
- data/modules/emscripten/src/relooper/testit.sh +62 -0
- data/modules/emscripten/src/relooper/updateit.sh +17 -0
- data/modules/emscripten/src/relooper.js +11516 -0
- data/modules/emscripten/src/relooper.js.raw.js +11511 -0
- data/modules/emscripten/src/runtime.js +546 -0
- data/modules/emscripten/src/settings.js +1284 -0
- data/modules/emscripten/src/shell.html +92 -0
- data/modules/emscripten/src/shell.js +153 -0
- data/modules/emscripten/src/shell_sharedlib.js +12 -0
- data/modules/emscripten/src/socket.io.js +3870 -0
- data/modules/emscripten/src/utility.js +379 -0
- data/modules/emscripten/src/wrtcp.js +821 -0
- data/modules/emscripten/system/include/AL/al.h +172 -0
- data/modules/emscripten/system/include/AL/alc.h +84 -0
- data/modules/emscripten/system/include/EGL/egl.h +329 -0
- data/modules/emscripten/system/include/EGL/eglext.h +398 -0
- data/modules/emscripten/system/include/EGL/eglplatform.h +141 -0
- data/modules/emscripten/system/include/GL/freeglut_std.h +628 -0
- data/modules/emscripten/system/include/GL/gl.h +2241 -0
- data/modules/emscripten/system/include/GL/glew.h +6 -0
- data/modules/emscripten/system/include/GL/glext.h +11127 -0
- data/modules/emscripten/system/include/GL/glfw.h +518 -0
- data/modules/emscripten/system/include/GL/glu.h +353 -0
- data/modules/emscripten/system/include/GL/glut.h +21 -0
- data/modules/emscripten/system/include/GLES/gl.h +770 -0
- data/modules/emscripten/system/include/GLES/glext.h +1278 -0
- data/modules/emscripten/system/include/GLES/glplatform.h +30 -0
- data/modules/emscripten/system/include/GLES2/gl2.h +621 -0
- data/modules/emscripten/system/include/GLES2/gl2ext.h +803 -0
- data/modules/emscripten/system/include/GLES2/gl2platform.h +30 -0
- data/modules/emscripten/system/include/KHR/khrplatform.h +277 -0
- data/modules/emscripten/system/include/SDL/COPYING +19 -0
- data/modules/emscripten/system/include/SDL/SDL.h +162 -0
- data/modules/emscripten/system/include/SDL/SDL_assert.h +241 -0
- data/modules/emscripten/system/include/SDL/SDL_atomic.h +318 -0
- data/modules/emscripten/system/include/SDL/SDL_audio.h +509 -0
- data/modules/emscripten/system/include/SDL/SDL_blendmode.h +60 -0
- data/modules/emscripten/system/include/SDL/SDL_clipboard.h +75 -0
- data/modules/emscripten/system/include/SDL/SDL_compat.h +365 -0
- data/modules/emscripten/system/include/SDL/SDL_config.h +48 -0
- data/modules/emscripten/system/include/SDL/SDL_config.h.in +297 -0
- data/modules/emscripten/system/include/SDL/SDL_config_android.h +133 -0
- data/modules/emscripten/system/include/SDL/SDL_config_iphoneos.h +148 -0
- data/modules/emscripten/system/include/SDL/SDL_config_macosx.h +172 -0
- data/modules/emscripten/system/include/SDL/SDL_config_minimal.h +74 -0
- data/modules/emscripten/system/include/SDL/SDL_config_nintendods.h +129 -0
- data/modules/emscripten/system/include/SDL/SDL_config_pandora.h +125 -0
- data/modules/emscripten/system/include/SDL/SDL_config_windows.h +207 -0
- data/modules/emscripten/system/include/SDL/SDL_config_wiz.h +119 -0
- data/modules/emscripten/system/include/SDL/SDL_copying.h +20 -0
- data/modules/emscripten/system/include/SDL/SDL_cpuinfo.h +150 -0
- data/modules/emscripten/system/include/SDL/SDL_endian.h +248 -0
- data/modules/emscripten/system/include/SDL/SDL_error.h +77 -0
- data/modules/emscripten/system/include/SDL/SDL_events.h +639 -0
- data/modules/emscripten/system/include/SDL/SDL_gesture.h +91 -0
- data/modules/emscripten/system/include/SDL/SDL_gfxPrimitives.h +246 -0
- data/modules/emscripten/system/include/SDL/SDL_haptic.h +1200 -0
- data/modules/emscripten/system/include/SDL/SDL_hints.h +206 -0
- data/modules/emscripten/system/include/SDL/SDL_image.h +138 -0
- data/modules/emscripten/system/include/SDL/SDL_input.h +87 -0
- data/modules/emscripten/system/include/SDL/SDL_joystick.h +208 -0
- data/modules/emscripten/system/include/SDL/SDL_keyboard.h +169 -0
- data/modules/emscripten/system/include/SDL/SDL_keycode.h +344 -0
- data/modules/emscripten/system/include/SDL/SDL_loadso.h +85 -0
- data/modules/emscripten/system/include/SDL/SDL_log.h +211 -0
- data/modules/emscripten/system/include/SDL/SDL_main.h +98 -0
- data/modules/emscripten/system/include/SDL/SDL_mixer.h +634 -0
- data/modules/emscripten/system/include/SDL/SDL_mouse.h +213 -0
- data/modules/emscripten/system/include/SDL/SDL_mutex.h +248 -0
- data/modules/emscripten/system/include/SDL/SDL_name.h +11 -0
- data/modules/emscripten/system/include/SDL/SDL_opengl.h +11116 -0
- data/modules/emscripten/system/include/SDL/SDL_opengles.h +38 -0
- data/modules/emscripten/system/include/SDL/SDL_opengles2.h +38 -0
- data/modules/emscripten/system/include/SDL/SDL_pixels.h +423 -0
- data/modules/emscripten/system/include/SDL/SDL_platform.h +160 -0
- data/modules/emscripten/system/include/SDL/SDL_power.h +79 -0
- data/modules/emscripten/system/include/SDL/SDL_quit.h +58 -0
- data/modules/emscripten/system/include/SDL/SDL_rect.h +136 -0
- data/modules/emscripten/system/include/SDL/SDL_render.h +615 -0
- data/modules/emscripten/system/include/SDL/SDL_revision.h +2 -0
- data/modules/emscripten/system/include/SDL/SDL_revision.h.orig +2 -0
- data/modules/emscripten/system/include/SDL/SDL_rotozoom.h +123 -0
- data/modules/emscripten/system/include/SDL/SDL_rwops.h +220 -0
- data/modules/emscripten/system/include/SDL/SDL_scancode.h +398 -0
- data/modules/emscripten/system/include/SDL/SDL_shape.h +147 -0
- data/modules/emscripten/system/include/SDL/SDL_stdinc.h +764 -0
- data/modules/emscripten/system/include/SDL/SDL_surface.h +499 -0
- data/modules/emscripten/system/include/SDL/SDL_syswm.h +241 -0
- data/modules/emscripten/system/include/SDL/SDL_thread.h +182 -0
- data/modules/emscripten/system/include/SDL/SDL_timer.h +108 -0
- data/modules/emscripten/system/include/SDL/SDL_touch.h +124 -0
- data/modules/emscripten/system/include/SDL/SDL_ttf.h +249 -0
- data/modules/emscripten/system/include/SDL/SDL_types.h +29 -0
- data/modules/emscripten/system/include/SDL/SDL_version.h +166 -0
- data/modules/emscripten/system/include/SDL/SDL_video.h +820 -0
- data/modules/emscripten/system/include/SDL/begin_code.h +135 -0
- data/modules/emscripten/system/include/SDL/close_code.h +37 -0
- data/modules/emscripten/system/include/X11/X.h +717 -0
- data/modules/emscripten/system/include/X11/Xatom.h +79 -0
- data/modules/emscripten/system/include/X11/Xfuncproto.h +127 -0
- data/modules/emscripten/system/include/X11/Xlib.h +4023 -0
- data/modules/emscripten/system/include/X11/Xosdefs.h +116 -0
- data/modules/emscripten/system/include/X11/Xutil.h +826 -0
- data/modules/emscripten/system/include/X11/keysym.h +73 -0
- data/modules/emscripten/system/include/X11/keysymdef.h +2389 -0
- data/modules/emscripten/system/include/bsd/float.h +91 -0
- data/modules/emscripten/system/include/bsd/readme.txt +2 -0
- data/modules/emscripten/system/include/bsd/sys/mman.h +180 -0
- data/modules/emscripten/system/include/bsd/sys/utsname.h +70 -0
- data/modules/emscripten/system/include/dlfcn.h +31 -0
- data/modules/emscripten/system/include/emscripten/bind.h +1210 -0
- data/modules/emscripten/system/include/emscripten/emscripten.h +388 -0
- data/modules/emscripten/system/include/emscripten/val.h +311 -0
- data/modules/emscripten/system/include/emscripten/wire.h +393 -0
- data/modules/emscripten/system/include/err.h +95 -0
- data/modules/emscripten/system/include/execinfo.h +44 -0
- data/modules/emscripten/system/include/features.h +3 -0
- data/modules/emscripten/system/include/gc.h +70 -0
- data/modules/emscripten/system/include/gfx/png.h +3798 -0
- data/modules/emscripten/system/include/gfx/pngconf.h +1665 -0
- data/modules/emscripten/system/include/gfx/tiff.h +654 -0
- data/modules/emscripten/system/include/gfx/tiffconf.h +104 -0
- data/modules/emscripten/system/include/gfx/tiffio.h +526 -0
- data/modules/emscripten/system/include/gfx/tiffvers.h +9 -0
- data/modules/emscripten/system/include/jansson.h +323 -0
- data/modules/emscripten/system/include/jansson_config.h +54 -0
- data/modules/emscripten/system/include/libc/_ansi.h +135 -0
- data/modules/emscripten/system/include/libc/_syslist.h +40 -0
- data/modules/emscripten/system/include/libc/alloca.h +21 -0
- data/modules/emscripten/system/include/libc/ar.h +69 -0
- data/modules/emscripten/system/include/libc/argz.h +33 -0
- data/modules/emscripten/system/include/libc/assert.h +46 -0
- data/modules/emscripten/system/include/libc/complex.h +124 -0
- data/modules/emscripten/system/include/libc/ctype.h +196 -0
- data/modules/emscripten/system/include/libc/dirent.h +16 -0
- data/modules/emscripten/system/include/libc/endian.h +3 -0
- data/modules/emscripten/system/include/libc/envlock.h +15 -0
- data/modules/emscripten/system/include/libc/envz.h +16 -0
- data/modules/emscripten/system/include/libc/errno.h +11 -0
- data/modules/emscripten/system/include/libc/fastmath.h +13 -0
- data/modules/emscripten/system/include/libc/fcntl.h +1 -0
- data/modules/emscripten/system/include/libc/fnmatch.h +55 -0
- data/modules/emscripten/system/include/libc/getopt.h +196 -0
- data/modules/emscripten/system/include/libc/glob.h +89 -0
- data/modules/emscripten/system/include/libc/grp.h +94 -0
- data/modules/emscripten/system/include/libc/iconv.h +62 -0
- data/modules/emscripten/system/include/libc/ieeefp.h +256 -0
- data/modules/emscripten/system/include/libc/ifaddrs.h +64 -0
- data/modules/emscripten/system/include/libc/inttypes.h +290 -0
- data/modules/emscripten/system/include/libc/iso646.h +43 -0
- data/modules/emscripten/system/include/libc/langinfo.h +316 -0
- data/modules/emscripten/system/include/libc/libgen.h +23 -0
- data/modules/emscripten/system/include/libc/limits.h +155 -0
- data/modules/emscripten/system/include/libc/locale.h +80 -0
- data/modules/emscripten/system/include/libc/machine/_default_types.h +121 -0
- data/modules/emscripten/system/include/libc/machine/_types.h +8 -0
- data/modules/emscripten/system/include/libc/machine/ansi.h +1 -0
- data/modules/emscripten/system/include/libc/machine/endian.h +31 -0
- data/modules/emscripten/system/include/libc/machine/fastmath.h +100 -0
- data/modules/emscripten/system/include/libc/machine/ieeefp.h +376 -0
- data/modules/emscripten/system/include/libc/machine/malloc.h +8 -0
- data/modules/emscripten/system/include/libc/machine/param.h +1 -0
- data/modules/emscripten/system/include/libc/machine/setjmp-dj.h +43 -0
- data/modules/emscripten/system/include/libc/machine/setjmp.h +361 -0
- data/modules/emscripten/system/include/libc/machine/stdlib.h +8 -0
- data/modules/emscripten/system/include/libc/machine/termios.h +1 -0
- data/modules/emscripten/system/include/libc/machine/time.h +19 -0
- data/modules/emscripten/system/include/libc/machine/types.h +30 -0
- data/modules/emscripten/system/include/libc/malloc.h +169 -0
- data/modules/emscripten/system/include/libc/math.h +594 -0
- data/modules/emscripten/system/include/libc/newlib.h +2 -0
- data/modules/emscripten/system/include/libc/paths.h +7 -0
- data/modules/emscripten/system/include/libc/process.h +44 -0
- data/modules/emscripten/system/include/libc/pthread.h +362 -0
- data/modules/emscripten/system/include/libc/pwd.h +78 -0
- data/modules/emscripten/system/include/libc/readme.txt +3 -0
- data/modules/emscripten/system/include/libc/reent.h +183 -0
- data/modules/emscripten/system/include/libc/regdef.h +7 -0
- data/modules/emscripten/system/include/libc/regex.h +102 -0
- data/modules/emscripten/system/include/libc/sched.h +97 -0
- data/modules/emscripten/system/include/libc/search.h +59 -0
- data/modules/emscripten/system/include/libc/setjmp.h +20 -0
- data/modules/emscripten/system/include/libc/signal.h +30 -0
- data/modules/emscripten/system/include/libc/stdarg.h +50 -0
- data/modules/emscripten/system/include/libc/stddef.h +64 -0
- data/modules/emscripten/system/include/libc/stdint.h +493 -0
- data/modules/emscripten/system/include/libc/stdio.h +694 -0
- data/modules/emscripten/system/include/libc/stdlib.h +230 -0
- data/modules/emscripten/system/include/libc/string.h +105 -0
- data/modules/emscripten/system/include/libc/strings.h +35 -0
- data/modules/emscripten/system/include/libc/sys/_default_fcntl.h +223 -0
- data/modules/emscripten/system/include/libc/sys/_types.h +93 -0
- data/modules/emscripten/system/include/libc/sys/cdefs.h +123 -0
- data/modules/emscripten/system/include/libc/sys/config.h +255 -0
- data/modules/emscripten/system/include/libc/sys/custom_file.h +2 -0
- data/modules/emscripten/system/include/libc/sys/dir.h +10 -0
- data/modules/emscripten/system/include/libc/sys/dirent.h +58 -0
- data/modules/emscripten/system/include/libc/sys/errno.h +190 -0
- data/modules/emscripten/system/include/libc/sys/fcntl.h +4 -0
- data/modules/emscripten/system/include/libc/sys/features.h +212 -0
- data/modules/emscripten/system/include/libc/sys/file.h +2 -0
- data/modules/emscripten/system/include/libc/sys/iconvnls.h +77 -0
- data/modules/emscripten/system/include/libc/sys/lock.h +24 -0
- data/modules/emscripten/system/include/libc/sys/param.h +25 -0
- data/modules/emscripten/system/include/libc/sys/queue.h +471 -0
- data/modules/emscripten/system/include/libc/sys/reent.h +843 -0
- data/modules/emscripten/system/include/libc/sys/resource.h +59 -0
- data/modules/emscripten/system/include/libc/sys/sched.h +67 -0
- data/modules/emscripten/system/include/libc/sys/signal.h +314 -0
- data/modules/emscripten/system/include/libc/sys/stat.h +222 -0
- data/modules/emscripten/system/include/libc/sys/stdio.h +27 -0
- data/modules/emscripten/system/include/libc/sys/string.h +2 -0
- data/modules/emscripten/system/include/libc/sys/syslimits.h +65 -0
- data/modules/emscripten/system/include/libc/sys/termios.h +280 -0
- data/modules/emscripten/system/include/libc/sys/time.h +85 -0
- data/modules/emscripten/system/include/libc/sys/timeb.h +39 -0
- data/modules/emscripten/system/include/libc/sys/times.h +28 -0
- data/modules/emscripten/system/include/libc/sys/ttydefaults.h +97 -0
- data/modules/emscripten/system/include/libc/sys/types.h +481 -0
- data/modules/emscripten/system/include/libc/sys/unistd.h +514 -0
- data/modules/emscripten/system/include/libc/sys/utime.h +26 -0
- data/modules/emscripten/system/include/libc/sys/wait.h +40 -0
- data/modules/emscripten/system/include/libc/tar.h +39 -0
- data/modules/emscripten/system/include/libc/termios.h +7 -0
- data/modules/emscripten/system/include/libc/time.h +273 -0
- data/modules/emscripten/system/include/libc/unctrl.h +46 -0
- data/modules/emscripten/system/include/libc/unistd.h +6 -0
- data/modules/emscripten/system/include/libc/utime.h +12 -0
- data/modules/emscripten/system/include/libc/utmp.h +8 -0
- data/modules/emscripten/system/include/libc/wchar.h +194 -0
- data/modules/emscripten/system/include/libc/wctype.h +47 -0
- data/modules/emscripten/system/include/libc/wordexp.h +53 -0
- data/modules/emscripten/system/include/libcxx/CREDITS.TXT +91 -0
- data/modules/emscripten/system/include/libcxx/LICENSE.txt +76 -0
- data/modules/emscripten/system/include/libcxx/__bit_reference +1268 -0
- data/modules/emscripten/system/include/libcxx/__config +485 -0
- data/modules/emscripten/system/include/libcxx/__debug +193 -0
- data/modules/emscripten/system/include/libcxx/__functional_03 +2130 -0
- data/modules/emscripten/system/include/libcxx/__functional_base +437 -0
- data/modules/emscripten/system/include/libcxx/__functional_base_03 +1087 -0
- data/modules/emscripten/system/include/libcxx/__hash_table +1945 -0
- data/modules/emscripten/system/include/libcxx/__locale +1435 -0
- data/modules/emscripten/system/include/libcxx/__mutex_base +438 -0
- data/modules/emscripten/system/include/libcxx/__split_buffer +654 -0
- data/modules/emscripten/system/include/libcxx/__sso_allocator +77 -0
- data/modules/emscripten/system/include/libcxx/__std_stream +317 -0
- data/modules/emscripten/system/include/libcxx/__tree +2293 -0
- data/modules/emscripten/system/include/libcxx/__tuple +305 -0
- data/modules/emscripten/system/include/libcxx/__tuple_03 +27 -0
- data/modules/emscripten/system/include/libcxx/__undef_min_max +19 -0
- data/modules/emscripten/system/include/libcxx/algorithm +5458 -0
- data/modules/emscripten/system/include/libcxx/array +341 -0
- data/modules/emscripten/system/include/libcxx/atomic +1521 -0
- data/modules/emscripten/system/include/libcxx/bitset +1081 -0
- data/modules/emscripten/system/include/libcxx/cassert +25 -0
- data/modules/emscripten/system/include/libcxx/ccomplex +29 -0
- data/modules/emscripten/system/include/libcxx/cctype +164 -0
- data/modules/emscripten/system/include/libcxx/cerrno +393 -0
- data/modules/emscripten/system/include/libcxx/cfenv +82 -0
- data/modules/emscripten/system/include/libcxx/cfloat +78 -0
- data/modules/emscripten/system/include/libcxx/chrono +898 -0
- data/modules/emscripten/system/include/libcxx/cinttypes +259 -0
- data/modules/emscripten/system/include/libcxx/ciso646 +25 -0
- data/modules/emscripten/system/include/libcxx/climits +48 -0
- data/modules/emscripten/system/include/libcxx/clocale +53 -0
- data/modules/emscripten/system/include/libcxx/cmath +1683 -0
- data/modules/emscripten/system/include/libcxx/codecvt +547 -0
- data/modules/emscripten/system/include/libcxx/complex +1526 -0
- data/modules/emscripten/system/include/libcxx/complex.h +35 -0
- data/modules/emscripten/system/include/libcxx/condition_variable +256 -0
- data/modules/emscripten/system/include/libcxx/csetjmp +52 -0
- data/modules/emscripten/system/include/libcxx/csignal +58 -0
- data/modules/emscripten/system/include/libcxx/cstdarg +48 -0
- data/modules/emscripten/system/include/libcxx/cstdbool +32 -0
- data/modules/emscripten/system/include/libcxx/cstddef +103 -0
- data/modules/emscripten/system/include/libcxx/cstdint +191 -0
- data/modules/emscripten/system/include/libcxx/cstdio +175 -0
- data/modules/emscripten/system/include/libcxx/cstdlib +172 -0
- data/modules/emscripten/system/include/libcxx/cstring +112 -0
- data/modules/emscripten/system/include/libcxx/ctgmath +29 -0
- data/modules/emscripten/system/include/libcxx/ctime +72 -0
- data/modules/emscripten/system/include/libcxx/cwchar +208 -0
- data/modules/emscripten/system/include/libcxx/cwctype +213 -0
- data/modules/emscripten/system/include/libcxx/deque +2846 -0
- data/modules/emscripten/system/include/libcxx/exception +250 -0
- data/modules/emscripten/system/include/libcxx/ext/__hash +46 -0
- data/modules/emscripten/system/include/libcxx/ext/hash_map +1003 -0
- data/modules/emscripten/system/include/libcxx/ext/hash_set +657 -0
- data/modules/emscripten/system/include/libcxx/forward_list +1636 -0
- data/modules/emscripten/system/include/libcxx/fstream +1415 -0
- data/modules/emscripten/system/include/libcxx/functional +2063 -0
- data/modules/emscripten/system/include/libcxx/future +2505 -0
- data/modules/emscripten/system/include/libcxx/initializer_list +105 -0
- data/modules/emscripten/system/include/libcxx/iomanip +504 -0
- data/modules/emscripten/system/include/libcxx/ios +988 -0
- data/modules/emscripten/system/include/libcxx/iosfwd +194 -0
- data/modules/emscripten/system/include/libcxx/iostream +60 -0
- data/modules/emscripten/system/include/libcxx/istream +1713 -0
- data/modules/emscripten/system/include/libcxx/iterator +1869 -0
- data/modules/emscripten/system/include/libcxx/limits +809 -0
- data/modules/emscripten/system/include/libcxx/list +2275 -0
- data/modules/emscripten/system/include/libcxx/locale +4591 -0
- data/modules/emscripten/system/include/libcxx/map +1924 -0
- data/modules/emscripten/system/include/libcxx/memory +5437 -0
- data/modules/emscripten/system/include/libcxx/mutex +566 -0
- data/modules/emscripten/system/include/libcxx/new +117 -0
- data/modules/emscripten/system/include/libcxx/numeric +197 -0
- data/modules/emscripten/system/include/libcxx/ostream +1286 -0
- data/modules/emscripten/system/include/libcxx/queue +717 -0
- data/modules/emscripten/system/include/libcxx/random +6750 -0
- data/modules/emscripten/system/include/libcxx/ratio +487 -0
- data/modules/emscripten/system/include/libcxx/readme.txt +1 -0
- data/modules/emscripten/system/include/libcxx/regex +6439 -0
- data/modules/emscripten/system/include/libcxx/scoped_allocator +578 -0
- data/modules/emscripten/system/include/libcxx/set +1025 -0
- data/modules/emscripten/system/include/libcxx/sstream +888 -0
- data/modules/emscripten/system/include/libcxx/stack +292 -0
- data/modules/emscripten/system/include/libcxx/stdexcept +162 -0
- data/modules/emscripten/system/include/libcxx/streambuf +564 -0
- data/modules/emscripten/system/include/libcxx/string +3987 -0
- data/modules/emscripten/system/include/libcxx/strstream +400 -0
- data/modules/emscripten/system/include/libcxx/support/solaris/floatingpoint.h +5 -0
- data/modules/emscripten/system/include/libcxx/support/solaris/wchar.h +38 -0
- data/modules/emscripten/system/include/libcxx/support/solaris/xlocale.h +146 -0
- data/modules/emscripten/system/include/libcxx/support/win32/limits_win32.h +79 -0
- data/modules/emscripten/system/include/libcxx/support/win32/locale_win32.h +116 -0
- data/modules/emscripten/system/include/libcxx/support/win32/math_win32.h +113 -0
- data/modules/emscripten/system/include/libcxx/support/win32/support.h +115 -0
- data/modules/emscripten/system/include/libcxx/system_error +636 -0
- data/modules/emscripten/system/include/libcxx/tgmath.h +29 -0
- data/modules/emscripten/system/include/libcxx/thread +459 -0
- data/modules/emscripten/system/include/libcxx/tuple +1092 -0
- data/modules/emscripten/system/include/libcxx/type_traits +3040 -0
- data/modules/emscripten/system/include/libcxx/typeindex +103 -0
- data/modules/emscripten/system/include/libcxx/typeinfo +124 -0
- data/modules/emscripten/system/include/libcxx/unordered_map +1864 -0
- data/modules/emscripten/system/include/libcxx/unordered_set +1144 -0
- data/modules/emscripten/system/include/libcxx/utility +583 -0
- data/modules/emscripten/system/include/libcxx/valarray +4779 -0
- data/modules/emscripten/system/include/libcxx/vector +3228 -0
- data/modules/emscripten/system/include/memory.h +10 -0
- data/modules/emscripten/system/include/mntent.h +23 -0
- data/modules/emscripten/system/include/net/arpa/inet.h +32 -0
- data/modules/emscripten/system/include/net/arpa/nameser.h +535 -0
- data/modules/emscripten/system/include/net/arpa/nameser_compat.h +187 -0
- data/modules/emscripten/system/include/net/if.h +87 -0
- data/modules/emscripten/system/include/net/netinet/in.h +166 -0
- data/modules/emscripten/system/include/net/netinet/tcp.h +246 -0
- data/modules/emscripten/system/include/net/resolv.h +389 -0
- data/modules/emscripten/system/include/netdb.h +94 -0
- data/modules/emscripten/system/include/nl_types.h +19 -0
- data/modules/emscripten/system/include/poll.h +3 -0
- data/modules/emscripten/system/include/pty.h +6 -0
- data/modules/emscripten/system/include/semaphore.h +31 -0
- data/modules/emscripten/system/include/spawn.h +105 -0
- data/modules/emscripten/system/include/stdbool.h +16 -0
- data/modules/emscripten/system/include/sys/bitypes.h +3 -0
- data/modules/emscripten/system/include/sys/io.h +14 -0
- data/modules/emscripten/system/include/sys/ioctl.h +26 -0
- data/modules/emscripten/system/include/sys/poll.h +31 -0
- data/modules/emscripten/system/include/sys/select.h +14 -0
- data/modules/emscripten/system/include/sys/socket.h +101 -0
- data/modules/emscripten/system/include/sys/socketvar.h +3 -0
- data/modules/emscripten/system/include/sys/statvfs.h +32 -0
- data/modules/emscripten/system/include/sys/sysctl.h +14 -0
- data/modules/emscripten/system/include/sys/uio.h +22 -0
- data/modules/emscripten/system/include/sys/un.h +66 -0
- data/modules/emscripten/system/include/sysexits.h +108 -0
- data/modules/emscripten/system/include/unwind.h +154 -0
- data/modules/emscripten/system/include/xlocale.h +47 -0
- data/modules/emscripten/system/include/zconf.h +428 -0
- data/modules/emscripten/system/include/zlib.h +1613 -0
- data/modules/emscripten/system/lib/compiler-rt/LICENSE.TXT +97 -0
- data/modules/emscripten/system/lib/compiler-rt/divdi3.c +47 -0
- data/modules/emscripten/system/lib/compiler-rt/int_endianness.h +116 -0
- data/modules/emscripten/system/lib/compiler-rt/int_lib.h +46 -0
- data/modules/emscripten/system/lib/compiler-rt/int_math.h +67 -0
- data/modules/emscripten/system/lib/compiler-rt/int_types.h +140 -0
- data/modules/emscripten/system/lib/compiler-rt/int_util.h +29 -0
- data/modules/emscripten/system/lib/compiler-rt/muldi3.c +56 -0
- data/modules/emscripten/system/lib/compiler-rt/readme.txt +20 -0
- data/modules/emscripten/system/lib/compiler-rt/udivdi3.c +36 -0
- data/modules/emscripten/system/lib/compiler-rt/udivmoddi4.c +251 -0
- data/modules/emscripten/system/lib/debugging.cpp +24 -0
- data/modules/emscripten/system/lib/dlmalloc.c +6299 -0
- data/modules/emscripten/system/lib/embind/bind.cpp +63 -0
- data/modules/emscripten/system/lib/libc/gen/err.c +49 -0
- data/modules/emscripten/system/lib/libc/gen/errx.c +49 -0
- data/modules/emscripten/system/lib/libc/gen/verr.c +58 -0
- data/modules/emscripten/system/lib/libc/gen/verrx.c +51 -0
- data/modules/emscripten/system/lib/libc/gen/vwarn.c +55 -0
- data/modules/emscripten/system/lib/libc/gen/vwarnx.c +48 -0
- data/modules/emscripten/system/lib/libc/gen/warn.c +49 -0
- data/modules/emscripten/system/lib/libc/gen/warnx.c +49 -0
- data/modules/emscripten/system/lib/libc/musl/COPYRIGHT +92 -0
- data/modules/emscripten/system/lib/libc/musl/readme.txt +1 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/alpha.h +125 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswalnum.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswalpha.c +14 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswblank.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswcntrl.c +10 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswctype.c +63 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswdigit.c +9 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswgraph.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswlower.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswprint.c +19 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswpunct.c +12 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswspace.c +19 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswupper.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/iswxdigit.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/nonspacing.h +62 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/punct.h +109 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/towctrans.c +268 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/wcswidth.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/wctrans.c +16 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/wcwidth.c +29 -0
- data/modules/emscripten/system/lib/libc/musl/src/ctype/wide.h +42 -0
- data/modules/emscripten/system/lib/libc/musl/src/internal/libc.c +22 -0
- data/modules/emscripten/system/lib/libc/musl/src/internal/libc.h +71 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/btowc.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/internal.c +38 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/internal.h +22 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mblen.c +17 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbrlen.c +18 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbrtowc.c +57 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbsinit.c +17 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbsnrtowcs.c +65 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbsrtowcs.c +100 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbstowcs.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/mbtowc.c +53 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/wcrtomb.c +38 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/wcsnrtombs.c +52 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/wcsrtombs.c +58 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/wcstombs.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/wctob.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/multibyte/wctomb.c +18 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcpcpy.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcpncpy.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcscasecmp.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcscasecmp_l.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcscat.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcschr.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcscmp.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcscpy.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcscspn.c +10 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsdup.c +11 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcslen.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsncasecmp.c +9 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsncasecmp_l.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsncat.c +10 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsncmp.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsncpy.c +9 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsnlen.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcspbrk.c +7 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsrchr.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsspn.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcsstr.c +108 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcstok.c +12 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wcswcs.c +6 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wmemchr.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wmemcmp.c +8 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wmemcpy.c +9 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wmemmove.c +12 -0
- data/modules/emscripten/system/lib/libc/musl/src/string/wmemset.c +9 -0
- data/modules/emscripten/system/lib/libc/stdlib/getopt_long.c +511 -0
- data/modules/emscripten/system/lib/libc/stdlib/strtod.c +305 -0
- data/modules/emscripten/system/lib/libc.symbols +81 -0
- data/modules/emscripten/system/lib/libcextra.symbols +61 -0
- data/modules/emscripten/system/lib/libcxx/CREDITS.TXT +91 -0
- data/modules/emscripten/system/lib/libcxx/LICENSE.txt +76 -0
- data/modules/emscripten/system/lib/libcxx/algorithm.cpp +83 -0
- data/modules/emscripten/system/lib/libcxx/bind.cpp +30 -0
- data/modules/emscripten/system/lib/libcxx/chrono.cpp +132 -0
- data/modules/emscripten/system/lib/libcxx/condition_variable.cpp +81 -0
- data/modules/emscripten/system/lib/libcxx/debug.cpp +504 -0
- data/modules/emscripten/system/lib/libcxx/exception.cpp +226 -0
- data/modules/emscripten/system/lib/libcxx/future.cpp +285 -0
- data/modules/emscripten/system/lib/libcxx/hash.cpp +564 -0
- data/modules/emscripten/system/lib/libcxx/ios.cpp +455 -0
- data/modules/emscripten/system/lib/libcxx/iostream.cpp +68 -0
- data/modules/emscripten/system/lib/libcxx/locale.cpp +6093 -0
- data/modules/emscripten/system/lib/libcxx/memory.cpp +223 -0
- data/modules/emscripten/system/lib/libcxx/mutex.cpp +250 -0
- data/modules/emscripten/system/lib/libcxx/new.cpp +205 -0
- data/modules/emscripten/system/lib/libcxx/random.cpp +48 -0
- data/modules/emscripten/system/lib/libcxx/readme.txt +1 -0
- data/modules/emscripten/system/lib/libcxx/regex.cpp +325 -0
- data/modules/emscripten/system/lib/libcxx/stdexcept.cpp +196 -0
- data/modules/emscripten/system/lib/libcxx/string.cpp +687 -0
- data/modules/emscripten/system/lib/libcxx/strstream.cpp +329 -0
- data/modules/emscripten/system/lib/libcxx/support/solaris/README +4 -0
- data/modules/emscripten/system/lib/libcxx/support/solaris/mbsnrtowcs.inc +76 -0
- data/modules/emscripten/system/lib/libcxx/support/solaris/wcsnrtombs.inc +93 -0
- data/modules/emscripten/system/lib/libcxx/support/solaris/xlocale.c +245 -0
- data/modules/emscripten/system/lib/libcxx/support/win32/locale_win32.cpp +94 -0
- data/modules/emscripten/system/lib/libcxx/support/win32/support.cpp +70 -0
- data/modules/emscripten/system/lib/libcxx/symbols +2927 -0
- data/modules/emscripten/system/lib/libcxx/system_error.cpp +201 -0
- data/modules/emscripten/system/lib/libcxx/thread.cpp +208 -0
- data/modules/emscripten/system/lib/libcxx/typeinfo.cpp +60 -0
- data/modules/emscripten/system/lib/libcxx/utility.cpp +17 -0
- data/modules/emscripten/system/lib/libcxx/valarray.cpp +54 -0
- data/modules/emscripten/system/lib/libcxxabi/CREDITS.TXT +38 -0
- data/modules/emscripten/system/lib/libcxxabi/LICENSE.TXT +76 -0
- data/modules/emscripten/system/lib/libcxxabi/include/cxa_demangle.h +167 -0
- data/modules/emscripten/system/lib/libcxxabi/include/cxxabi.h +175 -0
- data/modules/emscripten/system/lib/libcxxabi/lib/buildit +99 -0
- data/modules/emscripten/system/lib/libcxxabi/readme.txt +1 -0
- data/modules/emscripten/system/lib/libcxxabi/src/abort_message.cpp +50 -0
- data/modules/emscripten/system/lib/libcxxabi/src/abort_message.h +33 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_aux_runtime.cpp +34 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_demangle.cpp +11036 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_exception.cpp +622 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_exception.hpp +123 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_exception_storage.cpp +91 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_guard.cpp +231 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_handlers.cpp +125 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_handlers.hpp +54 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_new_delete.cpp +242 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_personality.cpp +1055 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_unexpected.cpp +27 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_vector.cpp +367 -0
- data/modules/emscripten/system/lib/libcxxabi/src/cxa_virtual.cpp +31 -0
- data/modules/emscripten/system/lib/libcxxabi/src/exception.cpp +41 -0
- data/modules/emscripten/system/lib/libcxxabi/src/fallback_malloc.ipp +174 -0
- data/modules/emscripten/system/lib/libcxxabi/src/private_typeinfo.cpp +1146 -0
- data/modules/emscripten/system/lib/libcxxabi/src/private_typeinfo.h +248 -0
- data/modules/emscripten/system/lib/libcxxabi/src/stdexcept.cpp +169 -0
- data/modules/emscripten/system/lib/libcxxabi/src/typeinfo.cpp +53 -0
- data/modules/emscripten/system/lib/libcxxabi/symbols +236 -0
- data/modules/emscripten/system/lib/sdl.cpp +13 -0
- data/modules/emscripten/system/lib/sdl.symbols +1 -0
- data/modules/emscripten/tests/hello_world.js +92 -0
- data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/CppHeaderParser.py +2347 -0
- data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/__init__.py +4 -0
- data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/doc/CppHeaderParser.html +657 -0
- data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/examples/SampleClass.h +147 -0
- data/modules/emscripten/third_party/CppHeaderParser/CppHeaderParser/examples/readSampleClass.py +74 -0
- data/modules/emscripten/third_party/CppHeaderParser/PKG-INFO +249 -0
- data/modules/emscripten/third_party/CppHeaderParser/README.html +544 -0
- data/modules/emscripten/third_party/CppHeaderParser/README.txt +226 -0
- data/modules/emscripten/third_party/CppHeaderParser/setup.py +43 -0
- data/modules/emscripten/third_party/ansidecl.h +371 -0
- data/modules/emscripten/third_party/closure-compiler/COPYING +202 -0
- data/modules/emscripten/third_party/closure-compiler/README +292 -0
- data/modules/emscripten/third_party/closure-compiler/compiler.jar +0 -0
- data/modules/emscripten/third_party/closure-compiler/readme.txt +3 -0
- data/modules/emscripten/third_party/cp-demangle.h +161 -0
- data/modules/emscripten/third_party/demangle.h +549 -0
- data/modules/emscripten/third_party/demangler.py +49 -0
- data/modules/emscripten/third_party/gcc_demangler.c +4226 -0
- data/modules/emscripten/third_party/gcc_demangler.js +21282 -0
- data/modules/emscripten/third_party/jni/emjvm.cpp +133 -0
- data/modules/emscripten/third_party/jni/emjvm.h +8 -0
- data/modules/emscripten/third_party/jni/emjvm.js +185 -0
- data/modules/emscripten/third_party/jni/jni.h +1154 -0
- data/modules/emscripten/third_party/libiberty.h +634 -0
- data/modules/emscripten/third_party/lzma.js/README.markdown +37 -0
- data/modules/emscripten/third_party/lzma.js/doit.sh +37 -0
- data/modules/emscripten/third_party/lzma.js/lzip/AUTHORS +7 -0
- data/modules/emscripten/third_party/lzma.js/lzip/COPYING +676 -0
- data/modules/emscripten/third_party/lzma.js/lzip/ChangeLog +201 -0
- data/modules/emscripten/third_party/lzma.js/lzip/INSTALL +56 -0
- data/modules/emscripten/third_party/lzma.js/lzip/Makefile +160 -0
- data/modules/emscripten/third_party/lzma.js/lzip/Makefile.in +138 -0
- data/modules/emscripten/third_party/lzma.js/lzip/NEWS +22 -0
- data/modules/emscripten/third_party/lzma.js/lzip/README +77 -0
- data/modules/emscripten/third_party/lzma.js/lzip/arg_parser.cc +204 -0
- data/modules/emscripten/third_party/lzma.js/lzip/arg_parser.h +106 -0
- data/modules/emscripten/third_party/lzma.js/lzip/configure +192 -0
- data/modules/emscripten/third_party/lzma.js/lzip/decoder.cc +252 -0
- data/modules/emscripten/third_party/lzma.js/lzip/decoder.h +268 -0
- data/modules/emscripten/third_party/lzma.js/lzip/encoder.cc +643 -0
- data/modules/emscripten/third_party/lzma.js/lzip/encoder.h +582 -0
- data/modules/emscripten/third_party/lzma.js/lzip/fast_encoder.cc +378 -0
- data/modules/emscripten/third_party/lzma.js/lzip/fast_encoder.h +171 -0
- data/modules/emscripten/third_party/lzma.js/lzip/lzip.h +264 -0
- data/modules/emscripten/third_party/lzma.js/lzip/main.cc +545 -0
- data/modules/emscripten/third_party/lzma.js/lzma-decoder.js +27 -0
- data/modules/emscripten/third_party/lzma.js/lzma-full.js +27 -0
- data/modules/emscripten/third_party/lzma.js/native_test.sh +5 -0
- data/modules/emscripten/third_party/lzma.js/post.js +13 -0
- data/modules/emscripten/third_party/lzma.js/pre.js +13 -0
- data/modules/emscripten/third_party/lzma.js/test-decoder.js +39 -0
- data/modules/emscripten/third_party/lzma.js/test-full.html +9 -0
- data/modules/emscripten/third_party/lzma.js/test-full.js +78 -0
- data/modules/emscripten/third_party/ply/ANNOUNCE +40 -0
- data/modules/emscripten/third_party/ply/CHANGES +1093 -0
- data/modules/emscripten/third_party/ply/PKG-INFO +22 -0
- data/modules/emscripten/third_party/ply/README +271 -0
- data/modules/emscripten/third_party/ply/TODO +16 -0
- data/modules/emscripten/third_party/ply/doc/internal.html +874 -0
- data/modules/emscripten/third_party/ply/doc/makedoc.py +194 -0
- data/modules/emscripten/third_party/ply/doc/ply.html +3262 -0
- data/modules/emscripten/third_party/ply/example/BASIC/README +79 -0
- data/modules/emscripten/third_party/ply/example/BASIC/basic.py +71 -0
- data/modules/emscripten/third_party/ply/example/BASIC/basiclex.py +74 -0
- data/modules/emscripten/third_party/ply/example/BASIC/basiclog.py +79 -0
- data/modules/emscripten/third_party/ply/example/BASIC/basinterp.py +441 -0
- data/modules/emscripten/third_party/ply/example/BASIC/basparse.py +424 -0
- data/modules/emscripten/third_party/ply/example/BASIC/dim.bas +14 -0
- data/modules/emscripten/third_party/ply/example/BASIC/func.bas +5 -0
- data/modules/emscripten/third_party/ply/example/BASIC/gcd.bas +22 -0
- data/modules/emscripten/third_party/ply/example/BASIC/gosub.bas +13 -0
- data/modules/emscripten/third_party/ply/example/BASIC/hello.bas +4 -0
- data/modules/emscripten/third_party/ply/example/BASIC/linear.bas +17 -0
- data/modules/emscripten/third_party/ply/example/BASIC/maxsin.bas +12 -0
- data/modules/emscripten/third_party/ply/example/BASIC/powers.bas +13 -0
- data/modules/emscripten/third_party/ply/example/BASIC/rand.bas +4 -0
- data/modules/emscripten/third_party/ply/example/BASIC/sales.bas +20 -0
- data/modules/emscripten/third_party/ply/example/BASIC/sears.bas +18 -0
- data/modules/emscripten/third_party/ply/example/BASIC/sqrt1.bas +5 -0
- data/modules/emscripten/third_party/ply/example/BASIC/sqrt2.bas +4 -0
- data/modules/emscripten/third_party/ply/example/GardenSnake/GardenSnake.py +709 -0
- data/modules/emscripten/third_party/ply/example/GardenSnake/README +5 -0
- data/modules/emscripten/third_party/ply/example/README +10 -0
- data/modules/emscripten/third_party/ply/example/ansic/README +2 -0
- data/modules/emscripten/third_party/ply/example/ansic/clex.py +164 -0
- data/modules/emscripten/third_party/ply/example/ansic/cparse.py +863 -0
- data/modules/emscripten/third_party/ply/example/calc/calc.py +107 -0
- data/modules/emscripten/third_party/ply/example/calcdebug/calc.py +113 -0
- data/modules/emscripten/third_party/ply/example/classcalc/calc.py +157 -0
- data/modules/emscripten/third_party/ply/example/cleanup.sh +2 -0
- data/modules/emscripten/third_party/ply/example/closurecalc/calc.py +130 -0
- data/modules/emscripten/third_party/ply/example/hedit/hedit.py +48 -0
- data/modules/emscripten/third_party/ply/example/newclasscalc/calc.py +160 -0
- data/modules/emscripten/third_party/ply/example/optcalc/README +9 -0
- data/modules/emscripten/third_party/ply/example/optcalc/calc.py +119 -0
- data/modules/emscripten/third_party/ply/example/unicalc/calc.py +117 -0
- data/modules/emscripten/third_party/ply/example/yply/README +41 -0
- data/modules/emscripten/third_party/ply/example/yply/ylex.py +112 -0
- data/modules/emscripten/third_party/ply/example/yply/yparse.py +217 -0
- data/modules/emscripten/third_party/ply/example/yply/yply.py +53 -0
- data/modules/emscripten/third_party/ply/ply/__init__.py +4 -0
- data/modules/emscripten/third_party/ply/ply/cpp.py +898 -0
- data/modules/emscripten/third_party/ply/ply/ctokens.py +133 -0
- data/modules/emscripten/third_party/ply/ply/lex.py +1058 -0
- data/modules/emscripten/third_party/ply/ply/yacc.py +3276 -0
- data/modules/emscripten/third_party/ply/setup.py +31 -0
- data/modules/emscripten/third_party/ply/test/README +7 -0
- data/modules/emscripten/third_party/ply/test/calclex.py +49 -0
- data/modules/emscripten/third_party/ply/test/cleanup.sh +4 -0
- data/modules/emscripten/third_party/ply/test/lex_closure.py +54 -0
- data/modules/emscripten/third_party/ply/test/lex_doc1.py +26 -0
- data/modules/emscripten/third_party/ply/test/lex_dup1.py +29 -0
- data/modules/emscripten/third_party/ply/test/lex_dup2.py +33 -0
- data/modules/emscripten/third_party/ply/test/lex_dup3.py +31 -0
- data/modules/emscripten/third_party/ply/test/lex_empty.py +20 -0
- data/modules/emscripten/third_party/ply/test/lex_error1.py +24 -0
- data/modules/emscripten/third_party/ply/test/lex_error2.py +26 -0
- data/modules/emscripten/third_party/ply/test/lex_error3.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_error4.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_hedit.py +47 -0
- data/modules/emscripten/third_party/ply/test/lex_ignore.py +31 -0
- data/modules/emscripten/third_party/ply/test/lex_ignore2.py +29 -0
- data/modules/emscripten/third_party/ply/test/lex_literal1.py +25 -0
- data/modules/emscripten/third_party/ply/test/lex_literal2.py +25 -0
- data/modules/emscripten/third_party/ply/test/lex_many_tokens.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_module.py +10 -0
- data/modules/emscripten/third_party/ply/test/lex_module_import.py +42 -0
- data/modules/emscripten/third_party/ply/test/lex_object.py +55 -0
- data/modules/emscripten/third_party/ply/test/lex_opt_alias.py +54 -0
- data/modules/emscripten/third_party/ply/test/lex_optimize.py +50 -0
- data/modules/emscripten/third_party/ply/test/lex_optimize2.py +50 -0
- data/modules/emscripten/third_party/ply/test/lex_optimize3.py +52 -0
- data/modules/emscripten/third_party/ply/test/lex_re1.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_re2.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_re3.py +29 -0
- data/modules/emscripten/third_party/ply/test/lex_rule1.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_rule2.py +29 -0
- data/modules/emscripten/third_party/ply/test/lex_rule3.py +27 -0
- data/modules/emscripten/third_party/ply/test/lex_state1.py +40 -0
- data/modules/emscripten/third_party/ply/test/lex_state2.py +40 -0
- data/modules/emscripten/third_party/ply/test/lex_state3.py +42 -0
- data/modules/emscripten/third_party/ply/test/lex_state4.py +41 -0
- data/modules/emscripten/third_party/ply/test/lex_state5.py +40 -0
- data/modules/emscripten/third_party/ply/test/lex_state_noerror.py +39 -0
- data/modules/emscripten/third_party/ply/test/lex_state_norule.py +40 -0
- data/modules/emscripten/third_party/ply/test/lex_state_try.py +45 -0
- data/modules/emscripten/third_party/ply/test/lex_token1.py +19 -0
- data/modules/emscripten/third_party/ply/test/lex_token2.py +22 -0
- data/modules/emscripten/third_party/ply/test/lex_token3.py +24 -0
- data/modules/emscripten/third_party/ply/test/lex_token4.py +26 -0
- data/modules/emscripten/third_party/ply/test/lex_token5.py +31 -0
- data/modules/emscripten/third_party/ply/test/lex_token_dup.py +29 -0
- data/modules/emscripten/third_party/ply/test/testlex.py +606 -0
- data/modules/emscripten/third_party/ply/test/testyacc.py +347 -0
- data/modules/emscripten/third_party/ply/test/yacc_badargs.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_badid.py +77 -0
- data/modules/emscripten/third_party/ply/test/yacc_badprec.py +64 -0
- data/modules/emscripten/third_party/ply/test/yacc_badprec2.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_badprec3.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_badrule.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_badtok.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_dup.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_error1.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_error2.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_error3.py +67 -0
- data/modules/emscripten/third_party/ply/test/yacc_error4.py +72 -0
- data/modules/emscripten/third_party/ply/test/yacc_inf.py +56 -0
- data/modules/emscripten/third_party/ply/test/yacc_literal.py +69 -0
- data/modules/emscripten/third_party/ply/test/yacc_misplaced.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_missing1.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_nested.py +33 -0
- data/modules/emscripten/third_party/ply/test/yacc_nodoc.py +67 -0
- data/modules/emscripten/third_party/ply/test/yacc_noerror.py +66 -0
- data/modules/emscripten/third_party/ply/test/yacc_nop.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_notfunc.py +66 -0
- data/modules/emscripten/third_party/ply/test/yacc_notok.py +67 -0
- data/modules/emscripten/third_party/ply/test/yacc_prec1.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_rr.py +72 -0
- data/modules/emscripten/third_party/ply/test/yacc_rr_unused.py +30 -0
- data/modules/emscripten/third_party/ply/test/yacc_simple.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_sr.py +63 -0
- data/modules/emscripten/third_party/ply/test/yacc_term1.py +68 -0
- data/modules/emscripten/third_party/ply/test/yacc_unused.py +77 -0
- data/modules/emscripten/third_party/ply/test/yacc_unused_rule.py +72 -0
- data/modules/emscripten/third_party/ply/test/yacc_uprec.py +63 -0
- data/modules/emscripten/third_party/ply/test/yacc_uprec2.py +63 -0
- data/modules/emscripten/third_party/readme.txt +7 -0
- data/modules/emscripten/third_party/websockify/CHANGES.txt +23 -0
- data/modules/emscripten/third_party/websockify/LICENSE.txt +16 -0
- data/modules/emscripten/third_party/websockify/MANIFEST.in +1 -0
- data/modules/emscripten/third_party/websockify/Makefile +11 -0
- data/modules/emscripten/third_party/websockify/README.md +168 -0
- data/modules/emscripten/third_party/websockify/Windows/Windows Service Readme.txt +39 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/Program.cs +24 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/ProjectInstaller.Designer.cs +61 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/ProjectInstaller.cs +19 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/ProjectInstaller.resx +129 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/Properties/AssemblyInfo.cs +36 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/Service1.Designer.cs +37 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/Service1.cs +41 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/noVNC Websocket.csproj +75 -0
- data/modules/emscripten/third_party/websockify/Windows/noVNC Websocket Service Project/noVNC Websocket.sln +20 -0
- data/modules/emscripten/third_party/websockify/docs/LICENSE.GPL-3 +621 -0
- data/modules/emscripten/third_party/websockify/docs/LICENSE.LGPL-3 +165 -0
- data/modules/emscripten/third_party/websockify/docs/LICENSE.MPL-2.0 +373 -0
- data/modules/emscripten/third_party/websockify/docs/TODO +9 -0
- data/modules/emscripten/third_party/websockify/docs/flash_policy.txt +4 -0
- data/modules/emscripten/third_party/websockify/docs/latency_results.txt +114 -0
- data/modules/emscripten/third_party/websockify/docs/notes +17 -0
- data/modules/emscripten/third_party/websockify/docs/release.txt +9 -0
- data/modules/emscripten/third_party/websockify/docs/websockify.1 +110 -0
- data/modules/emscripten/third_party/websockify/include/VT100.js +919 -0
- data/modules/emscripten/third_party/websockify/include/base64.js +114 -0
- data/modules/emscripten/third_party/websockify/include/keysym.js +99 -0
- data/modules/emscripten/third_party/websockify/include/util.js +359 -0
- data/modules/emscripten/third_party/websockify/include/web-socket-js/README.txt +109 -0
- data/modules/emscripten/third_party/websockify/include/web-socket-js/WebSocketMain.swf +0 -0
- data/modules/emscripten/third_party/websockify/include/web-socket-js/swfobject.js +4 -0
- data/modules/emscripten/third_party/websockify/include/web-socket-js/web_socket.js +391 -0
- data/modules/emscripten/third_party/websockify/include/websock.js +422 -0
- data/modules/emscripten/third_party/websockify/include/webutil.js +216 -0
- data/modules/emscripten/third_party/websockify/include/wsirc.js +235 -0
- data/modules/emscripten/third_party/websockify/include/wstelnet.js +335 -0
- data/modules/emscripten/third_party/websockify/other/Makefile +14 -0
- data/modules/emscripten/third_party/websockify/other/README.md +51 -0
- data/modules/emscripten/third_party/websockify/other/launch.sh +108 -0
- data/modules/emscripten/third_party/websockify/other/project.clj +13 -0
- data/modules/emscripten/third_party/websockify/other/websocket.c +802 -0
- data/modules/emscripten/third_party/websockify/other/websocket.h +84 -0
- data/modules/emscripten/third_party/websockify/other/websocket.rb +456 -0
- data/modules/emscripten/third_party/websockify/other/websockify.c +385 -0
- data/modules/emscripten/third_party/websockify/other/websockify.clj +233 -0
- data/modules/emscripten/third_party/websockify/other/websockify.js +196 -0
- data/modules/emscripten/third_party/websockify/other/websockify.rb +171 -0
- data/modules/emscripten/third_party/websockify/other/wswrap +22 -0
- data/modules/emscripten/third_party/websockify/rebind +18 -0
- data/modules/emscripten/third_party/websockify/rebind.c +94 -0
- data/modules/emscripten/third_party/websockify/run +5 -0
- data/modules/emscripten/third_party/websockify/setup.py +30 -0
- data/modules/emscripten/third_party/websockify/tests/b64_vs_utf8.py +29 -0
- data/modules/emscripten/third_party/websockify/tests/base64.html +91 -0
- data/modules/emscripten/third_party/websockify/tests/base64.js +12 -0
- data/modules/emscripten/third_party/websockify/tests/echo.html +148 -0
- data/modules/emscripten/third_party/websockify/tests/echo.py +75 -0
- data/modules/emscripten/third_party/websockify/tests/echo.rb +62 -0
- data/modules/emscripten/third_party/websockify/tests/latency.html +290 -0
- data/modules/emscripten/third_party/websockify/tests/latency.py +75 -0
- data/modules/emscripten/third_party/websockify/tests/load.html +250 -0
- data/modules/emscripten/third_party/websockify/tests/load.py +167 -0
- data/modules/emscripten/third_party/websockify/tests/plain_echo.html +168 -0
- data/modules/emscripten/third_party/websockify/tests/simple.html +68 -0
- data/modules/emscripten/third_party/websockify/tests/utf8-list.py +22 -0
- data/modules/emscripten/third_party/websockify/websockify/__init__.py +2 -0
- data/modules/emscripten/third_party/websockify/websockify/websocket.py +982 -0
- data/modules/emscripten/third_party/websockify/websockify/websocketproxy.py +393 -0
- data/modules/emscripten/third_party/websockify/websockify.py +5 -0
- data/modules/emscripten/third_party/websockify/wsirc.html +99 -0
- data/modules/emscripten/third_party/websockify/wstelnet.html +74 -0
- data/modules/emscripten/tools/__init__.py +0 -0
- data/modules/emscripten/tools/__init__.pyc +0 -0
- data/modules/emscripten/tools/autodebugger.py +289 -0
- data/modules/emscripten/tools/autodebugger_c.py +37 -0
- data/modules/emscripten/tools/autodebugger_indenter.py +18 -0
- data/modules/emscripten/tools/autodebugger_js.py +47 -0
- data/modules/emscripten/tools/autodediffer.py +60 -0
- data/modules/emscripten/tools/bindings_generator.py +832 -0
- data/modules/emscripten/tools/bisect_pair.py +88 -0
- data/modules/emscripten/tools/cache.py +198 -0
- data/modules/emscripten/tools/cache.pyc +0 -0
- data/modules/emscripten/tools/clean_webconsole.py +34 -0
- data/modules/emscripten/tools/crunch-worker.js +124 -0
- data/modules/emscripten/tools/diff_autodebugger.py +15 -0
- data/modules/emscripten/tools/eliminator/asm-eliminator-test-output.js +5129 -0
- data/modules/emscripten/tools/eliminator/asm-eliminator-test.js +6861 -0
- data/modules/emscripten/tools/eliminator/eliminator-test-output.js +6122 -0
- data/modules/emscripten/tools/eliminator/eliminator-test.js +8856 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/README.html +888 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/README.org +463 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/bin/uglifyjs +317 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/docstyle.css +75 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/lib/object-ast.js +75 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/lib/parse-js.js +1363 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/lib/process.js +2005 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/lib/squeeze-more.js +51 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/package.json +22 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/beautify.js +28 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/testparser.js +402 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/array1.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/array2.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/array3.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/array4.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/assignment.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/concatstring.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/const.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/empty-blocks.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/forstatement.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/if.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/ifreturn.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/ifreturn2.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue10.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue11.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue13.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue14.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue16.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue17.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue20.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue21.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue25.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue27.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue28.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue29.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue30.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue34.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue4.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue48.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue50.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue53.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue54.1.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue68.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue69.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/issue9.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/mangle.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/strict-equals.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/var.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/expected/with.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/array1.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/array2.js +4 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/array3.js +4 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/array4.js +6 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/assignment.js +20 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/concatstring.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/const.js +5 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/empty-blocks.js +4 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/forstatement.js +10 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/if.js +6 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/ifreturn.js +9 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/ifreturn2.js +16 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue10.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue11.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue13.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue14.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue16.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue17.js +4 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue20.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue21.js +6 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue25.js +7 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue27.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue28.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue29.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue30.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue34.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue4.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue48.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue50.js +9 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue53.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue54.1.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue68.js +5 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue69.js +1 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/issue9.js +4 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/mangle.js +5 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/strict-equals.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/var.js +3 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/compress/test/with.js +2 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/test/unit/scripts.js +55 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/tmp/hoist.js +33 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/tmp/instrument.js +97 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/tmp/instrument2.js +138 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/tmp/test.js +16 -0
- data/modules/emscripten/tools/eliminator/node_modules/uglify-js/uglify-js.js +17 -0
- data/modules/emscripten/tools/eliminator/safe-eliminator-test-output.js +85 -0
- data/modules/emscripten/tools/eliminator/safe-eliminator-test.js +103 -0
- data/modules/emscripten/tools/emconfiguren.py +19 -0
- data/modules/emscripten/tools/emmaken.py +230 -0
- data/modules/emscripten/tools/emmakenxx.py +18 -0
- data/modules/emscripten/tools/exec_llvm.py +50 -0
- data/modules/emscripten/tools/file2json.py +49 -0
- data/modules/emscripten/tools/file_packager.py +649 -0
- data/modules/emscripten/tools/find_bigfuncs.py +23 -0
- data/modules/emscripten/tools/find_bigis.py +18 -0
- data/modules/emscripten/tools/fix_closure.py +88 -0
- data/modules/emscripten/tools/ie7_fix.py +14 -0
- data/modules/emscripten/tools/js-optimizer.js +3440 -0
- data/modules/emscripten/tools/js_optimizer.py +341 -0
- data/modules/emscripten/tools/js_optimizer.pyc +0 -0
- data/modules/emscripten/tools/jsrun.py +27 -0
- data/modules/emscripten/tools/jsrun.pyc +0 -0
- data/modules/emscripten/tools/ll-strip.py +56 -0
- data/modules/emscripten/tools/make_file.py +19 -0
- data/modules/emscripten/tools/make_minigzip.py +13 -0
- data/modules/emscripten/tools/namespacer.py +95 -0
- data/modules/emscripten/tools/nativize_llvm.py +34 -0
- data/modules/emscripten/tools/node_modules/source-map/CHANGELOG.md +58 -0
- data/modules/emscripten/tools/node_modules/source-map/LICENSE +28 -0
- data/modules/emscripten/tools/node_modules/source-map/Makefile.dryice.js +166 -0
- data/modules/emscripten/tools/node_modules/source-map/README.md +347 -0
- data/modules/emscripten/tools/node_modules/source-map/build/assert-shim.js +56 -0
- data/modules/emscripten/tools/node_modules/source-map/build/mini-require.js +152 -0
- data/modules/emscripten/tools/node_modules/source-map/build/prefix-source-map.jsm +20 -0
- data/modules/emscripten/tools/node_modules/source-map/build/prefix-utils.jsm +18 -0
- data/modules/emscripten/tools/node_modules/source-map/build/suffix-browser.js +8 -0
- data/modules/emscripten/tools/node_modules/source-map/build/suffix-source-map.jsm +6 -0
- data/modules/emscripten/tools/node_modules/source-map/build/suffix-utils.jsm +21 -0
- data/modules/emscripten/tools/node_modules/source-map/build/test-prefix.js +8 -0
- data/modules/emscripten/tools/node_modules/source-map/build/test-suffix.js +3 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/array-set.js +96 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/base64-vlq.js +144 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/base64.js +42 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/binary-search.js +81 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/source-map-consumer.js +430 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/source-map-generator.js +381 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/source-node.js +353 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map/util.js +117 -0
- data/modules/emscripten/tools/node_modules/source-map/lib/source-map.js +8 -0
- data/modules/emscripten/tools/node_modules/source-map/node_modules/amdefine/LICENSE +58 -0
- data/modules/emscripten/tools/node_modules/source-map/node_modules/amdefine/README.md +119 -0
- data/modules/emscripten/tools/node_modules/source-map/node_modules/amdefine/amdefine.js +299 -0
- data/modules/emscripten/tools/node_modules/source-map/node_modules/amdefine/package.json +33 -0
- data/modules/emscripten/tools/node_modules/source-map/package.json +74 -0
- data/modules/emscripten/tools/node_modules/source-map/test/run-tests.js +73 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-api.js +26 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-array-set.js +71 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-base64-vlq.js +24 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-base64.js +35 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-binary-search.js +54 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-dog-fooding.js +72 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-source-map-consumer.js +306 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-source-map-generator.js +391 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/test-source-node.js +282 -0
- data/modules/emscripten/tools/node_modules/source-map/test/source-map/util.js +152 -0
- data/modules/emscripten/tools/reproduceriter.js +216 -0
- data/modules/emscripten/tools/reproduceriter.py +160 -0
- data/modules/emscripten/tools/response_file.py +28 -0
- data/modules/emscripten/tools/response_file.pyc +0 -0
- data/modules/emscripten/tools/scan_js.py +20 -0
- data/modules/emscripten/tools/scan_ll.py +18 -0
- data/modules/emscripten/tools/scons/site_scons/site_tools/emscripten/__init__.py +3 -0
- data/modules/emscripten/tools/scons/site_scons/site_tools/emscripten/emscripten.py +46 -0
- data/modules/emscripten/tools/settings_template_readonly.py +47 -0
- data/modules/emscripten/tools/shared.py +1437 -0
- data/modules/emscripten/tools/shared.pyc +0 -0
- data/modules/emscripten/tools/source-maps/sourcemap2json.js +15 -0
- data/modules/emscripten/tools/source-maps/sourcemapper.js +177 -0
- data/modules/emscripten/tools/split.py +97 -0
- data/modules/emscripten/tools/tempfiles.py +40 -0
- data/modules/emscripten/tools/tempfiles.pyc +0 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-last-output.js +75 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-last.js +91 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-outline-output.js +570 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-outline.js +606 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-pre-output.js +540 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-pre.js +550 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-regs-min-output.js +36 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-regs-min.js +37 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-regs-output.js +106 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-regs.js +110 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-relocate-output.js +9 -0
- data/modules/emscripten/tools/test-js-optimizer-asm-relocate.js +12 -0
- data/modules/emscripten/tools/test-js-optimizer-output.js +291 -0
- data/modules/emscripten/tools/test-js-optimizer-regs-output.js +232 -0
- data/modules/emscripten/tools/test-js-optimizer-regs.js +237 -0
- data/modules/emscripten/tools/test-js-optimizer-t2-output.js +91 -0
- data/modules/emscripten/tools/test-js-optimizer-t2.js +92 -0
- data/modules/emscripten/tools/test-js-optimizer-t2c-output.js +17 -0
- data/modules/emscripten/tools/test-js-optimizer-t2c.js +18 -0
- data/modules/emscripten/tools/test-js-optimizer-t3-output.js +49 -0
- data/modules/emscripten/tools/test-js-optimizer-t3.js +50 -0
- data/modules/emscripten/tools/test-js-optimizer.js +401 -0
- data/modules/mruby/AUTHORS +18 -0
- data/modules/mruby/CONTRIBUTING.md +65 -0
- data/modules/mruby/ChangeLog +15 -0
- data/modules/mruby/INSTALL +29 -0
- data/modules/mruby/LEGAL +6 -0
- data/modules/mruby/MITL +20 -0
- data/modules/mruby/Makefile +18 -0
- data/modules/mruby/NEWS +13 -0
- data/modules/mruby/README.md +116 -0
- data/modules/mruby/Rakefile +114 -0
- data/modules/mruby/TODO +11 -0
- data/modules/mruby/benchmark/ao-render.rb +315 -0
- data/modules/mruby/benchmark/bm_so_lists.rb +47 -0
- data/modules/mruby/benchmark/fib39.rb +8 -0
- data/modules/mruby/build_config.rb +88 -0
- data/modules/mruby/doc/compile/README.md +376 -0
- data/modules/mruby/doc/mrbgems/README.md +254 -0
- data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/README.md +4 -0
- data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/mrbgem.rake +23 -0
- data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/mrblib/example.rb +5 -0
- data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/src/example.c +20 -0
- data/modules/mruby/examples/mrbgems/c_and_ruby_extension_example/test/example.rb +7 -0
- data/modules/mruby/examples/mrbgems/c_extension_example/README.md +4 -0
- data/modules/mruby/examples/mrbgems/c_extension_example/mrbgem.rake +23 -0
- data/modules/mruby/examples/mrbgems/c_extension_example/src/example.c +20 -0
- data/modules/mruby/examples/mrbgems/c_extension_example/test/example.c +7 -0
- data/modules/mruby/examples/mrbgems/c_extension_example/test/example.rb +3 -0
- data/modules/mruby/examples/mrbgems/ruby_extension_example/README.md +4 -0
- data/modules/mruby/examples/mrbgems/ruby_extension_example/mrbgem.rake +23 -0
- data/modules/mruby/examples/mrbgems/ruby_extension_example/mrblib/example.rb +5 -0
- data/modules/mruby/examples/mrbgems/ruby_extension_example/test/example.rb +3 -0
- data/modules/mruby/examples/targets/ArduinoDue.rb +65 -0
- data/modules/mruby/examples/targets/chipKitMax32.rb +68 -0
- data/modules/mruby/include/mrbconf.h +87 -0
- data/modules/mruby/include/mruby/array.h +63 -0
- data/modules/mruby/include/mruby/class.h +75 -0
- data/modules/mruby/include/mruby/compile.h +176 -0
- data/modules/mruby/include/mruby/data.h +53 -0
- data/modules/mruby/include/mruby/dump.h +151 -0
- data/modules/mruby/include/mruby/gc.h +17 -0
- data/modules/mruby/include/mruby/hash.h +54 -0
- data/modules/mruby/include/mruby/irep.h +40 -0
- data/modules/mruby/include/mruby/khash.h +257 -0
- data/modules/mruby/include/mruby/numeric.h +32 -0
- data/modules/mruby/include/mruby/proc.h +62 -0
- data/modules/mruby/include/mruby/range.h +35 -0
- data/modules/mruby/include/mruby/string.h +78 -0
- data/modules/mruby/include/mruby/value.h +483 -0
- data/modules/mruby/include/mruby/variable.h +78 -0
- data/modules/mruby/include/mruby.h +388 -0
- data/modules/mruby/minirake +477 -0
- data/modules/mruby/mrbgems/default.gembox +61 -0
- data/modules/mruby/mrbgems/full-core.gembox +9 -0
- data/modules/mruby/mrbgems/mruby-array-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-array-ext/mrblib/array.rb +204 -0
- data/modules/mruby/mrbgems/mruby-array-ext/src/array.c +140 -0
- data/modules/mruby/mrbgems/mruby-array-ext/test/array.rb +109 -0
- data/modules/mruby/mrbgems/mruby-bin-mirb/mrbgem.rake +5 -0
- data/modules/mruby/mrbgems/mruby-bin-mirb/tools/mirb/mirb.c +365 -0
- data/modules/mruby/mrbgems/mruby-bin-mruby/mrbgem.rake +5 -0
- data/modules/mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c +243 -0
- data/modules/mruby/mrbgems/mruby-enum-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-enum-ext/mrblib/enum.rb +164 -0
- data/modules/mruby/mrbgems/mruby-enum-ext/test/enum.rb +44 -0
- data/modules/mruby/mrbgems/mruby-eval/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-eval/src/eval.c +23 -0
- data/modules/mruby/mrbgems/mruby-fiber/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-fiber/src/fiber.c +251 -0
- data/modules/mruby/mrbgems/mruby-fiber/test/fiber.rb +64 -0
- data/modules/mruby/mrbgems/mruby-hash-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-hash-ext/mrblib/hash.rb +13 -0
- data/modules/mruby/mrbgems/mruby-hash-ext/src/hash-ext.c +62 -0
- data/modules/mruby/mrbgems/mruby-hash-ext/test/hash.rb +26 -0
- data/modules/mruby/mrbgems/mruby-math/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-math/src/math.c +685 -0
- data/modules/mruby/mrbgems/mruby-math/test/math.rb +136 -0
- data/modules/mruby/mrbgems/mruby-numeric-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-numeric-ext/src/numeric_ext.c +31 -0
- data/modules/mruby/mrbgems/mruby-numeric-ext/test/numeric.rb +10 -0
- data/modules/mruby/mrbgems/mruby-object-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-object-ext/src/object.c +108 -0
- data/modules/mruby/mrbgems/mruby-object-ext/test/nil.rb +11 -0
- data/modules/mruby/mrbgems/mruby-object-ext/test/object.rb +9 -0
- data/modules/mruby/mrbgems/mruby-objectspace/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-objectspace/src/mruby_objectspace.c +117 -0
- data/modules/mruby/mrbgems/mruby-objectspace/test/objectspace.rb +38 -0
- data/modules/mruby/mrbgems/mruby-print/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-print/mrblib/print.rb +64 -0
- data/modules/mruby/mrbgems/mruby-print/src/print.c +44 -0
- data/modules/mruby/mrbgems/mruby-proc-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-proc-ext/mrblib/proc.rb +40 -0
- data/modules/mruby/mrbgems/mruby-proc-ext/src/proc.c +97 -0
- data/modules/mruby/mrbgems/mruby-proc-ext/test/proc.rb +41 -0
- data/modules/mruby/mrbgems/mruby-random/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-random/src/mt19937ar.c +193 -0
- data/modules/mruby/mrbgems/mruby-random/src/mt19937ar.h +48 -0
- data/modules/mruby/mrbgems/mruby-random/src/random.c +231 -0
- data/modules/mruby/mrbgems/mruby-random/src/random.h +12 -0
- data/modules/mruby/mrbgems/mruby-random/test/random.rb +32 -0
- data/modules/mruby/mrbgems/mruby-range-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-range-ext/src/range.c +141 -0
- data/modules/mruby/mrbgems/mruby-range-ext/test/range.rb +20 -0
- data/modules/mruby/mrbgems/mruby-sprintf/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-sprintf/src/kernel.c +30 -0
- data/modules/mruby/mrbgems/mruby-sprintf/src/sprintf.c +1102 -0
- data/modules/mruby/mrbgems/mruby-sprintf/test/sprintf.rb +3 -0
- data/modules/mruby/mrbgems/mruby-string-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-string-ext/mrblib/string.rb +52 -0
- data/modules/mruby/mrbgems/mruby-string-ext/src/string.c +175 -0
- data/modules/mruby/mrbgems/mruby-string-ext/test/string.rb +112 -0
- data/modules/mruby/mrbgems/mruby-struct/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-struct/mrblib/struct.rb +50 -0
- data/modules/mruby/mrbgems/mruby-struct/src/struct.c +818 -0
- data/modules/mruby/mrbgems/mruby-struct/test/struct.rb +77 -0
- data/modules/mruby/mrbgems/mruby-symbol-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-symbol-ext/mrblib/symbol.rb +9 -0
- data/modules/mruby/mrbgems/mruby-symbol-ext/src/symbol.c +55 -0
- data/modules/mruby/mrbgems/mruby-symbol-ext/test/symbol.rb +12 -0
- data/modules/mruby/mrbgems/mruby-time/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-time/src/time.c +749 -0
- data/modules/mruby/mrbgems/mruby-time/test/time.rb +201 -0
- data/modules/mruby/mrbgems/mruby-toplevel-ext/mrbgem.rake +4 -0
- data/modules/mruby/mrbgems/mruby-toplevel-ext/mrblib/toplevel.rb +11 -0
- data/modules/mruby/mrbgems/mruby-toplevel-ext/test/toplevel.rb +24 -0
- data/modules/mruby/mrblib/array.rb +111 -0
- data/modules/mruby/mrblib/class.rb +26 -0
- data/modules/mruby/mrblib/compar.rb +104 -0
- data/modules/mruby/mrblib/enum.rb +398 -0
- data/modules/mruby/mrblib/error.rb +66 -0
- data/modules/mruby/mrblib/hash.rb +193 -0
- data/modules/mruby/mrblib/init_mrblib.c +14 -0
- data/modules/mruby/mrblib/kernel.rb +46 -0
- data/modules/mruby/mrblib/mrblib.rake +18 -0
- data/modules/mruby/mrblib/numeric.rb +101 -0
- data/modules/mruby/mrblib/print.rb +18 -0
- data/modules/mruby/mrblib/range.rb +40 -0
- data/modules/mruby/mrblib/string.rb +145 -0
- data/modules/mruby/src/array.c +1150 -0
- data/modules/mruby/src/backtrace.c +73 -0
- data/modules/mruby/src/class.c +1942 -0
- data/modules/mruby/src/codegen.c +2864 -0
- data/modules/mruby/src/compar.c +13 -0
- data/modules/mruby/src/crc.c +38 -0
- data/modules/mruby/src/dump.c +542 -0
- data/modules/mruby/src/enum.c +14 -0
- data/modules/mruby/src/error.c +454 -0
- data/modules/mruby/src/error.h +18 -0
- data/modules/mruby/src/etc.c +204 -0
- data/modules/mruby/src/gc.c +1542 -0
- data/modules/mruby/src/hash.c +1261 -0
- data/modules/mruby/src/init.c +62 -0
- data/modules/mruby/src/kernel.c +1105 -0
- data/modules/mruby/src/keywords +50 -0
- data/modules/mruby/src/lex.def +212 -0
- data/modules/mruby/src/load.c +629 -0
- data/modules/mruby/src/mruby_core.rake +28 -0
- data/modules/mruby/src/node.h +117 -0
- data/modules/mruby/src/numeric.c +1418 -0
- data/modules/mruby/src/object.c +593 -0
- data/modules/mruby/src/opcode.h +160 -0
- data/modules/mruby/src/parse.y +6050 -0
- data/modules/mruby/src/pool.c +190 -0
- data/modules/mruby/src/print.c +71 -0
- data/modules/mruby/src/proc.c +209 -0
- data/modules/mruby/src/range.c +442 -0
- data/modules/mruby/src/re.h +13 -0
- data/modules/mruby/src/state.c +200 -0
- data/modules/mruby/src/string.c +2580 -0
- data/modules/mruby/src/symbol.c +456 -0
- data/modules/mruby/src/value_array.h +27 -0
- data/modules/mruby/src/variable.c +1147 -0
- data/modules/mruby/src/vm.c +2129 -0
- data/modules/mruby/tasks/libmruby.rake +18 -0
- data/modules/mruby/tasks/mrbgem_spec.rake +297 -0
- data/modules/mruby/tasks/mrbgems.rake +85 -0
- data/modules/mruby/tasks/mrbgems_test.rake +88 -0
- data/modules/mruby/tasks/mruby_build.rake +211 -0
- data/modules/mruby/tasks/mruby_build_commands.rake +287 -0
- data/modules/mruby/tasks/mruby_build_gem.rake +67 -0
- data/modules/mruby/tasks/ruby_ext.rake +70 -0
- data/modules/mruby/tasks/toolchains/androideabi.rake +126 -0
- data/modules/mruby/tasks/toolchains/clang.rake +8 -0
- data/modules/mruby/tasks/toolchains/gcc.rake +21 -0
- data/modules/mruby/tasks/toolchains/vs2010.rake +3 -0
- data/modules/mruby/tasks/toolchains/vs2012.rake +44 -0
- data/modules/mruby/test/README.md +7 -0
- data/modules/mruby/test/assert.rb +238 -0
- data/modules/mruby/test/driver.c +118 -0
- data/modules/mruby/test/init_mrbtest.c +24 -0
- data/modules/mruby/test/mrbtest.rake +47 -0
- data/modules/mruby/test/report.rb +4 -0
- data/modules/mruby/test/t/argumenterror.rb +21 -0
- data/modules/mruby/test/t/array.rb +309 -0
- data/modules/mruby/test/t/basicobject.rb +11 -0
- data/modules/mruby/test/t/bs_block.rb +489 -0
- data/modules/mruby/test/t/bs_literal.rb +38 -0
- data/modules/mruby/test/t/class.rb +219 -0
- data/modules/mruby/test/t/comparable.rb +72 -0
- data/modules/mruby/test/t/enumerable.rb +108 -0
- data/modules/mruby/test/t/exception.rb +337 -0
- data/modules/mruby/test/t/false.rb +33 -0
- data/modules/mruby/test/t/float.rb +145 -0
- data/modules/mruby/test/t/gc.rb +45 -0
- data/modules/mruby/test/t/hash.rb +310 -0
- data/modules/mruby/test/t/indexerror.rb +10 -0
- data/modules/mruby/test/t/integer.rb +222 -0
- data/modules/mruby/test/t/kernel.rb +425 -0
- data/modules/mruby/test/t/literals.rb +287 -0
- data/modules/mruby/test/t/localjumperror.rb +13 -0
- data/modules/mruby/test/t/methods.rb +109 -0
- data/modules/mruby/test/t/module.rb +344 -0
- data/modules/mruby/test/t/nameerror.rb +32 -0
- data/modules/mruby/test/t/nil.rb +29 -0
- data/modules/mruby/test/t/nomethoderror.rb +13 -0
- data/modules/mruby/test/t/numeric.rb +29 -0
- data/modules/mruby/test/t/object.rb +11 -0
- data/modules/mruby/test/t/proc.rb +56 -0
- data/modules/mruby/test/t/range.rb +82 -0
- data/modules/mruby/test/t/rangeerror.rb +10 -0
- data/modules/mruby/test/t/regexperror.rb +4 -0
- data/modules/mruby/test/t/runtimeerror.rb +6 -0
- data/modules/mruby/test/t/standarderror.rb +10 -0
- data/modules/mruby/test/t/string.rb +483 -0
- data/modules/mruby/test/t/symbol.rb +27 -0
- data/modules/mruby/test/t/syntax.rb +67 -0
- data/modules/mruby/test/t/true.rb +33 -0
- data/modules/mruby/test/t/typeerror.rb +11 -0
- data/modules/mruby/tools/mrbc/mrbc.c +318 -0
- data/modules/mruby/tools/mrbc/mrbc.rake +14 -0
- data/modules/mruby/travis_config.rb +6 -0
- data/modules/mrubymix/LICENSE +21 -0
- data/modules/mrubymix/README.md +6 -0
- data/modules/mrubymix/bin/mrubymix +29 -0
- data/modules/mrubymix/lib/mrubymix.rb +93 -0
- data/modules/mrubymix/mrubymix.gemspec +13 -0
- data/scripts/gen_gems_config.rb +185 -0
- data/scripts/gen_post.rb +104 -0
- data/templates/minimal/Rakefile +36 -0
- data/templates/minimal/app/app.rb +3 -0
- metadata +1408 -0
|
@@ -0,0 +1,2024 @@
|
|
|
1
|
+
//"use strict";
|
|
2
|
+
|
|
3
|
+
// See browser tests for examples (tests/runner.py, search for sdl_). Run with
|
|
4
|
+
// python tests/runner.py browser
|
|
5
|
+
|
|
6
|
+
// Notes:
|
|
7
|
+
// SDL_VIDEORESIZE: This is sent when the canvas is resized. Note that the user
|
|
8
|
+
// cannot manually do so, so this is only sent when the
|
|
9
|
+
// program manually resizes it (emscripten_set_canvas_size
|
|
10
|
+
// or otherwise).
|
|
11
|
+
|
|
12
|
+
var LibrarySDL = {
|
|
13
|
+
$SDL__deps: ['$FS', '$Browser'],
|
|
14
|
+
$SDL: {
|
|
15
|
+
defaults: {
|
|
16
|
+
width: 320,
|
|
17
|
+
height: 200,
|
|
18
|
+
copyOnLock: true
|
|
19
|
+
},
|
|
20
|
+
|
|
21
|
+
version: null,
|
|
22
|
+
|
|
23
|
+
surfaces: {},
|
|
24
|
+
// A pool of freed canvas elements. Reusing them avoids GC pauses.
|
|
25
|
+
canvasPool: [],
|
|
26
|
+
events: [],
|
|
27
|
+
fonts: [null],
|
|
28
|
+
|
|
29
|
+
// The currently preloaded audio elements ready to be played
|
|
30
|
+
audios: [null],
|
|
31
|
+
// The currently playing audio element. There's only one music track.
|
|
32
|
+
music: {
|
|
33
|
+
audio: null,
|
|
34
|
+
volume: 1.0
|
|
35
|
+
},
|
|
36
|
+
mixerFrequency: 22050,
|
|
37
|
+
mixerFormat: 0x8010, // AUDIO_S16LSB
|
|
38
|
+
mixerNumChannels: 2,
|
|
39
|
+
mixerChunkSize: 1024,
|
|
40
|
+
channelMinimumNumber: 0,
|
|
41
|
+
|
|
42
|
+
GL: false, // Set to true if we call SDL_SetVideoMode with SDL_OPENGL, and if so, we do not create 2D canvases&contexts for blitting
|
|
43
|
+
// Note that images loaded before SDL_SetVideoMode will not get this optimization
|
|
44
|
+
|
|
45
|
+
keyboardState: null,
|
|
46
|
+
keyboardMap: {},
|
|
47
|
+
|
|
48
|
+
textInput: false,
|
|
49
|
+
|
|
50
|
+
startTime: null,
|
|
51
|
+
buttonState: 0,
|
|
52
|
+
modState: 0,
|
|
53
|
+
DOMButtons: [0, 0, 0],
|
|
54
|
+
|
|
55
|
+
DOMEventToSDLEvent: {},
|
|
56
|
+
|
|
57
|
+
keyCodes: { // DOM code ==> SDL code. See https://developer.mozilla.org/en/Document_Object_Model_%28DOM%29/KeyboardEvent and SDL_keycode.h
|
|
58
|
+
46: 127, // SDLK_DEL == '\177'
|
|
59
|
+
38: 1106, // up arrow
|
|
60
|
+
40: 1105, // down arrow
|
|
61
|
+
37: 1104, // left arrow
|
|
62
|
+
39: 1103, // right arrow
|
|
63
|
+
|
|
64
|
+
33: 1099, // pagedup
|
|
65
|
+
34: 1102, // pagedown
|
|
66
|
+
|
|
67
|
+
17: 1248, // control (right, or left)
|
|
68
|
+
18: 1250, // alt
|
|
69
|
+
173: 45, // minus
|
|
70
|
+
16: 1249, // shift
|
|
71
|
+
|
|
72
|
+
96: 88 | 1<<10, // keypad 0
|
|
73
|
+
97: 89 | 1<<10, // keypad 1
|
|
74
|
+
98: 90 | 1<<10, // keypad 2
|
|
75
|
+
99: 91 | 1<<10, // keypad 3
|
|
76
|
+
100: 92 | 1<<10, // keypad 4
|
|
77
|
+
101: 93 | 1<<10, // keypad 5
|
|
78
|
+
102: 94 | 1<<10, // keypad 6
|
|
79
|
+
103: 95 | 1<<10, // keypad 7
|
|
80
|
+
104: 96 | 1<<10, // keypad 8
|
|
81
|
+
105: 97 | 1<<10, // keypad 9
|
|
82
|
+
|
|
83
|
+
112: 58 | 1<<10, // F1
|
|
84
|
+
113: 59 | 1<<10, // F2
|
|
85
|
+
114: 60 | 1<<10, // F3
|
|
86
|
+
115: 61 | 1<<10, // F4
|
|
87
|
+
116: 62 | 1<<10, // F5
|
|
88
|
+
117: 63 | 1<<10, // F6
|
|
89
|
+
118: 64 | 1<<10, // F7
|
|
90
|
+
119: 65 | 1<<10, // F8
|
|
91
|
+
120: 66 | 1<<10, // F9
|
|
92
|
+
121: 67 | 1<<10, // F10
|
|
93
|
+
122: 68 | 1<<10, // F11
|
|
94
|
+
123: 69 | 1<<10, // F12
|
|
95
|
+
|
|
96
|
+
188: 44, // comma
|
|
97
|
+
190: 46, // period
|
|
98
|
+
191: 47, // slash (/)
|
|
99
|
+
192: 96, // backtick/backquote (`)
|
|
100
|
+
},
|
|
101
|
+
|
|
102
|
+
scanCodes: { // SDL keycode ==> SDL scancode. See SDL_scancode.h
|
|
103
|
+
97: 4, // A
|
|
104
|
+
98: 5,
|
|
105
|
+
99: 6,
|
|
106
|
+
100: 7,
|
|
107
|
+
101: 8,
|
|
108
|
+
102: 9,
|
|
109
|
+
103: 10,
|
|
110
|
+
104: 11,
|
|
111
|
+
105: 12,
|
|
112
|
+
106: 13,
|
|
113
|
+
107: 14,
|
|
114
|
+
108: 15,
|
|
115
|
+
109: 16,
|
|
116
|
+
110: 17,
|
|
117
|
+
111: 18,
|
|
118
|
+
112: 19,
|
|
119
|
+
113: 20,
|
|
120
|
+
114: 21,
|
|
121
|
+
115: 22,
|
|
122
|
+
116: 23,
|
|
123
|
+
117: 24,
|
|
124
|
+
118: 25,
|
|
125
|
+
119: 26,
|
|
126
|
+
120: 27,
|
|
127
|
+
121: 28,
|
|
128
|
+
122: 29, // Z
|
|
129
|
+
44: 54, // comma
|
|
130
|
+
46: 55, // period
|
|
131
|
+
47: 56, // slash
|
|
132
|
+
49: 30, // 1
|
|
133
|
+
50: 31,
|
|
134
|
+
51: 32,
|
|
135
|
+
52: 33,
|
|
136
|
+
53: 34,
|
|
137
|
+
54: 35,
|
|
138
|
+
55: 36,
|
|
139
|
+
56: 37,
|
|
140
|
+
57: 38, // 9
|
|
141
|
+
48: 39, // 0
|
|
142
|
+
13: 40, // return
|
|
143
|
+
9: 43, // tab
|
|
144
|
+
27: 41, // escape
|
|
145
|
+
32: 44, // space
|
|
146
|
+
92: 49, // backslash
|
|
147
|
+
305: 224, // ctrl
|
|
148
|
+
308: 226, // alt
|
|
149
|
+
},
|
|
150
|
+
|
|
151
|
+
structs: {
|
|
152
|
+
Rect: Runtime.generateStructInfo([
|
|
153
|
+
['i32', 'x'], ['i32', 'y'], ['i32', 'w'], ['i32', 'h'],
|
|
154
|
+
]),
|
|
155
|
+
PixelFormat: Runtime.generateStructInfo([
|
|
156
|
+
['i32', 'format'],
|
|
157
|
+
['void*', 'palette'], ['i8', 'BitsPerPixel'], ['i8', 'BytesPerPixel'],
|
|
158
|
+
['i8', 'padding1'], ['i8', 'padding2'],
|
|
159
|
+
['i32', 'Rmask'], ['i32', 'Gmask'], ['i32', 'Bmask'], ['i32', 'Amask'],
|
|
160
|
+
['i8', 'Rloss'], ['i8', 'Gloss'], ['i8', 'Bloss'], ['i8', 'Aloss'],
|
|
161
|
+
['i8', 'Rshift'], ['i8', 'Gshift'], ['i8', 'Bshift'], ['i8', 'Ashift']
|
|
162
|
+
]),
|
|
163
|
+
KeyboardEvent: Runtime.generateStructInfo([
|
|
164
|
+
['i32', 'type'],
|
|
165
|
+
['i32', 'windowID'],
|
|
166
|
+
['i8', 'state'],
|
|
167
|
+
['i8', 'repeat'],
|
|
168
|
+
['i8', 'padding2'],
|
|
169
|
+
['i8', 'padding3'],
|
|
170
|
+
['i32', 'keysym']
|
|
171
|
+
]),
|
|
172
|
+
keysym: Runtime.generateStructInfo([
|
|
173
|
+
['i32', 'scancode'],
|
|
174
|
+
['i32', 'sym'],
|
|
175
|
+
['i16', 'mod'],
|
|
176
|
+
['i32', 'unicode']
|
|
177
|
+
]),
|
|
178
|
+
TextInputEvent: Runtime.generateStructInfo([
|
|
179
|
+
['i32', 'type'],
|
|
180
|
+
['i32', 'windowID'],
|
|
181
|
+
['b256', 'text'],
|
|
182
|
+
]),
|
|
183
|
+
MouseMotionEvent: Runtime.generateStructInfo([
|
|
184
|
+
['i32', 'type'],
|
|
185
|
+
['i32', 'windowID'],
|
|
186
|
+
['i8', 'state'],
|
|
187
|
+
['i8', 'padding1'],
|
|
188
|
+
['i8', 'padding2'],
|
|
189
|
+
['i8', 'padding3'],
|
|
190
|
+
['i32', 'x'],
|
|
191
|
+
['i32', 'y'],
|
|
192
|
+
['i32', 'xrel'],
|
|
193
|
+
['i32', 'yrel']
|
|
194
|
+
]),
|
|
195
|
+
MouseButtonEvent: Runtime.generateStructInfo([
|
|
196
|
+
['i32', 'type'],
|
|
197
|
+
['i32', 'windowID'],
|
|
198
|
+
['i8', 'button'],
|
|
199
|
+
['i8', 'state'],
|
|
200
|
+
['i8', 'padding1'],
|
|
201
|
+
['i8', 'padding2'],
|
|
202
|
+
['i32', 'x'],
|
|
203
|
+
['i32', 'y']
|
|
204
|
+
]),
|
|
205
|
+
ResizeEvent: Runtime.generateStructInfo([
|
|
206
|
+
['i32', 'type'],
|
|
207
|
+
['i32', 'w'],
|
|
208
|
+
['i32', 'h']
|
|
209
|
+
]),
|
|
210
|
+
AudioSpec: Runtime.generateStructInfo([
|
|
211
|
+
['i32', 'freq'],
|
|
212
|
+
['i16', 'format'],
|
|
213
|
+
['i8', 'channels'],
|
|
214
|
+
['i8', 'silence'],
|
|
215
|
+
['i16', 'samples'],
|
|
216
|
+
['i32', 'size'],
|
|
217
|
+
['void*', 'callback'],
|
|
218
|
+
['void*', 'userdata']
|
|
219
|
+
]),
|
|
220
|
+
version: Runtime.generateStructInfo([
|
|
221
|
+
['i8', 'major'],
|
|
222
|
+
['i8', 'minor'],
|
|
223
|
+
['i8', 'patch']
|
|
224
|
+
])
|
|
225
|
+
},
|
|
226
|
+
|
|
227
|
+
loadRect: function(rect) {
|
|
228
|
+
return {
|
|
229
|
+
x: {{{ makeGetValue('rect + SDL.structs.Rect.x', '0', 'i32') }}},
|
|
230
|
+
y: {{{ makeGetValue('rect + SDL.structs.Rect.y', '0', 'i32') }}},
|
|
231
|
+
w: {{{ makeGetValue('rect + SDL.structs.Rect.w', '0', 'i32') }}},
|
|
232
|
+
h: {{{ makeGetValue('rect + SDL.structs.Rect.h', '0', 'i32') }}}
|
|
233
|
+
};
|
|
234
|
+
},
|
|
235
|
+
|
|
236
|
+
// Load SDL color into a CSS-style color specification
|
|
237
|
+
loadColorToCSSRGB: function(color) {
|
|
238
|
+
var rgba = {{{ makeGetValue('color', '0', 'i32') }}};
|
|
239
|
+
return 'rgb(' + (rgba&255) + ',' + ((rgba >> 8)&255) + ',' + ((rgba >> 16)&255) + ')';
|
|
240
|
+
},
|
|
241
|
+
loadColorToCSSRGBA: function(color) {
|
|
242
|
+
var rgba = {{{ makeGetValue('color', '0', 'i32') }}};
|
|
243
|
+
return 'rgba(' + (rgba&255) + ',' + ((rgba >> 8)&255) + ',' + ((rgba >> 16)&255) + ',' + (((rgba >> 24)&255)/255) + ')';
|
|
244
|
+
},
|
|
245
|
+
|
|
246
|
+
translateColorToCSSRGBA: function(rgba) {
|
|
247
|
+
return 'rgba(' + (rgba&0xff) + ',' + (rgba>>8 & 0xff) + ',' + (rgba>>16 & 0xff) + ',' + (rgba>>>24)/0xff + ')';
|
|
248
|
+
},
|
|
249
|
+
|
|
250
|
+
translateRGBAToCSSRGBA: function(r, g, b, a) {
|
|
251
|
+
return 'rgba(' + (r&0xff) + ',' + (g&0xff) + ',' + (b&0xff) + ',' + (a&0xff)/255 + ')';
|
|
252
|
+
},
|
|
253
|
+
|
|
254
|
+
translateRGBAToColor: function(r, g, b, a) {
|
|
255
|
+
return r | g << 8 | b << 16 | a << 24;
|
|
256
|
+
},
|
|
257
|
+
|
|
258
|
+
makeSurface: function(width, height, flags, usePageCanvas, source, rmask, gmask, bmask, amask) {
|
|
259
|
+
flags = flags || 0;
|
|
260
|
+
var surf = _malloc(14*Runtime.QUANTUM_SIZE); // SDL_Surface has 14 fields of quantum size
|
|
261
|
+
var buffer = _malloc(width*height*4); // TODO: only allocate when locked the first time
|
|
262
|
+
var pixelFormat = _malloc(18*Runtime.QUANTUM_SIZE);
|
|
263
|
+
flags |= 1; // SDL_HWSURFACE - this tells SDL_MUSTLOCK that this needs to be locked
|
|
264
|
+
|
|
265
|
+
//surface with SDL_HWPALETTE flag is 8bpp surface (1 byte)
|
|
266
|
+
var is_SDL_HWPALETTE = flags & 0x00200000;
|
|
267
|
+
var bpp = is_SDL_HWPALETTE ? 1 : 4;
|
|
268
|
+
|
|
269
|
+
{{{ makeSetValue('surf+Runtime.QUANTUM_SIZE*0', '0', 'flags', 'i32') }}} // SDL_Surface.flags
|
|
270
|
+
{{{ makeSetValue('surf+Runtime.QUANTUM_SIZE*1', '0', 'pixelFormat', 'void*') }}} // SDL_Surface.format TODO
|
|
271
|
+
{{{ makeSetValue('surf+Runtime.QUANTUM_SIZE*2', '0', 'width', 'i32') }}} // SDL_Surface.w
|
|
272
|
+
{{{ makeSetValue('surf+Runtime.QUANTUM_SIZE*3', '0', 'height', 'i32') }}} // SDL_Surface.h
|
|
273
|
+
{{{ makeSetValue('surf+Runtime.QUANTUM_SIZE*4', '0', 'width * bpp', 'i32') }}} // SDL_Surface.pitch, assuming RGBA or indexed for now,
|
|
274
|
+
// since that is what ImageData gives us in browsers
|
|
275
|
+
{{{ makeSetValue('surf+Runtime.QUANTUM_SIZE*5', '0', 'buffer', 'void*') }}} // SDL_Surface.pixels
|
|
276
|
+
{{{ makeSetValue('surf+Runtime.QUANTUM_SIZE*6', '0', '0', 'i32*') }}} // SDL_Surface.offset
|
|
277
|
+
|
|
278
|
+
{{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.format', '0', '-2042224636', 'i32') }}} // SDL_PIXELFORMAT_RGBA8888
|
|
279
|
+
{{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.palette', '0', '0', 'i32') }}} // TODO
|
|
280
|
+
{{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.BitsPerPixel', '0', 'bpp * 8', 'i8') }}}
|
|
281
|
+
{{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.BytesPerPixel', '0', 'bpp', 'i8') }}}
|
|
282
|
+
|
|
283
|
+
{{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.Rmask', '0', 'rmask || 0x000000ff', 'i32') }}}
|
|
284
|
+
{{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.Gmask', '0', 'gmask || 0x0000ff00', 'i32') }}}
|
|
285
|
+
{{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.Bmask', '0', 'bmask || 0x00ff0000', 'i32') }}}
|
|
286
|
+
{{{ makeSetValue('pixelFormat + SDL.structs.PixelFormat.Amask', '0', 'amask || 0xff000000', 'i32') }}}
|
|
287
|
+
|
|
288
|
+
// Decide if we want to use WebGL or not
|
|
289
|
+
var useWebGL = (flags & 0x04000000) != 0; // SDL_OPENGL
|
|
290
|
+
SDL.GL = SDL.GL || useWebGL;
|
|
291
|
+
var canvas;
|
|
292
|
+
if (!usePageCanvas) {
|
|
293
|
+
if (SDL.canvasPool.length > 0) {
|
|
294
|
+
canvas = SDL.canvasPool.pop();
|
|
295
|
+
} else {
|
|
296
|
+
canvas = document.createElement('canvas');
|
|
297
|
+
}
|
|
298
|
+
canvas.width = width;
|
|
299
|
+
canvas.height = height;
|
|
300
|
+
} else {
|
|
301
|
+
canvas = Module['canvas'];
|
|
302
|
+
}
|
|
303
|
+
var ctx = Browser.createContext(canvas, useWebGL, usePageCanvas);
|
|
304
|
+
SDL.surfaces[surf] = {
|
|
305
|
+
width: width,
|
|
306
|
+
height: height,
|
|
307
|
+
canvas: canvas,
|
|
308
|
+
ctx: ctx,
|
|
309
|
+
surf: surf,
|
|
310
|
+
buffer: buffer,
|
|
311
|
+
pixelFormat: pixelFormat,
|
|
312
|
+
alpha: 255,
|
|
313
|
+
flags: flags,
|
|
314
|
+
locked: 0,
|
|
315
|
+
usePageCanvas: usePageCanvas,
|
|
316
|
+
source: source,
|
|
317
|
+
|
|
318
|
+
isFlagSet: function (flag) {
|
|
319
|
+
return flags & flag;
|
|
320
|
+
}
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
return surf;
|
|
324
|
+
},
|
|
325
|
+
|
|
326
|
+
// Copy data from the C++-accessible storage to the canvas backing
|
|
327
|
+
// for surface with HWPALETTE flag(8bpp depth)
|
|
328
|
+
copyIndexedColorData: function(surfData, rX, rY, rW, rH) {
|
|
329
|
+
// HWPALETTE works with palette
|
|
330
|
+
// setted by SDL_SetColors
|
|
331
|
+
if (!surfData.colors) {
|
|
332
|
+
return;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
var fullWidth = Module['canvas'].width;
|
|
336
|
+
var fullHeight = Module['canvas'].height;
|
|
337
|
+
|
|
338
|
+
var startX = rX || 0;
|
|
339
|
+
var startY = rY || 0;
|
|
340
|
+
var endX = (rW || (fullWidth - startX)) + startX;
|
|
341
|
+
var endY = (rH || (fullHeight - startY)) + startY;
|
|
342
|
+
|
|
343
|
+
var buffer = surfData.buffer;
|
|
344
|
+
var data = surfData.image.data;
|
|
345
|
+
var colors = surfData.colors;
|
|
346
|
+
|
|
347
|
+
for (var y = startY; y < endY; ++y) {
|
|
348
|
+
var indexBase = y * fullWidth;
|
|
349
|
+
var colorBase = indexBase * 4;
|
|
350
|
+
for (var x = startX; x < endX; ++x) {
|
|
351
|
+
// HWPALETTE have only 256 colors (not rgba)
|
|
352
|
+
var index = {{{ makeGetValue('buffer + indexBase + x', '0', 'i8', null, true) }}} * 3;
|
|
353
|
+
var colorOffset = colorBase + x * 4;
|
|
354
|
+
|
|
355
|
+
data[colorOffset ] = colors[index ];
|
|
356
|
+
data[colorOffset +1] = colors[index +1];
|
|
357
|
+
data[colorOffset +2] = colors[index +2];
|
|
358
|
+
//unused: data[colorOffset +3] = color[index +3];
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
},
|
|
362
|
+
|
|
363
|
+
freeSurface: function(surf) {
|
|
364
|
+
var info = SDL.surfaces[surf];
|
|
365
|
+
if (!info.usePageCanvas && info.canvas) SDL.canvasPool.push(info.canvas);
|
|
366
|
+
_free(info.buffer);
|
|
367
|
+
_free(info.pixelFormat);
|
|
368
|
+
_free(surf);
|
|
369
|
+
SDL.surfaces[surf] = null;
|
|
370
|
+
},
|
|
371
|
+
|
|
372
|
+
touchX:0, touchY: 0,
|
|
373
|
+
|
|
374
|
+
receiveEvent: function(event) {
|
|
375
|
+
switch(event.type) {
|
|
376
|
+
case 'touchstart':
|
|
377
|
+
event.preventDefault();
|
|
378
|
+
var touch = event.touches[0];
|
|
379
|
+
touchX = touch.pageX;
|
|
380
|
+
touchY = touch.pageY;
|
|
381
|
+
var event = {
|
|
382
|
+
type: 'mousedown',
|
|
383
|
+
button: 0,
|
|
384
|
+
pageX: touchX,
|
|
385
|
+
pageY: touchY
|
|
386
|
+
};
|
|
387
|
+
SDL.DOMButtons[0] = 1;
|
|
388
|
+
SDL.events.push(event);
|
|
389
|
+
break;
|
|
390
|
+
case 'touchmove':
|
|
391
|
+
event.preventDefault();
|
|
392
|
+
var touch = event.touches[0];
|
|
393
|
+
touchX = touch.pageX;
|
|
394
|
+
touchY = touch.pageY;
|
|
395
|
+
event = {
|
|
396
|
+
type: 'mousemove',
|
|
397
|
+
button: 0,
|
|
398
|
+
pageX: touchX,
|
|
399
|
+
pageY: touchY
|
|
400
|
+
};
|
|
401
|
+
SDL.events.push(event);
|
|
402
|
+
break;
|
|
403
|
+
case 'touchend':
|
|
404
|
+
event.preventDefault();
|
|
405
|
+
event = {
|
|
406
|
+
type: 'mouseup',
|
|
407
|
+
button: 0,
|
|
408
|
+
pageX: touchX,
|
|
409
|
+
pageY: touchY
|
|
410
|
+
};
|
|
411
|
+
SDL.DOMButtons[0] = 0;
|
|
412
|
+
SDL.events.push(event);
|
|
413
|
+
break;
|
|
414
|
+
case 'mousemove':
|
|
415
|
+
if (Browser.pointerLock) {
|
|
416
|
+
// workaround for firefox bug 750111
|
|
417
|
+
if ('mozMovementX' in event) {
|
|
418
|
+
event['movementX'] = event['mozMovementX'];
|
|
419
|
+
event['movementY'] = event['mozMovementY'];
|
|
420
|
+
}
|
|
421
|
+
// workaround for Firefox bug 782777
|
|
422
|
+
if (event['movementX'] == 0 && event['movementY'] == 0) {
|
|
423
|
+
// ignore a mousemove event if it doesn't contain any movement info
|
|
424
|
+
// (without pointer lock, we infer movement from pageX/pageY, so this check is unnecessary)
|
|
425
|
+
event.preventDefault();
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
// fall through
|
|
430
|
+
case 'keydown': case 'keyup': case 'keypress': case 'mousedown': case 'mouseup': case 'DOMMouseScroll': case 'mousewheel':
|
|
431
|
+
if (event.type == 'DOMMouseScroll' || event.type == 'mousewheel') {
|
|
432
|
+
var button = (event.type == 'DOMMouseScroll' ? event.detail : -event.wheelDelta) > 0 ? 4 : 3;
|
|
433
|
+
var event2 = {
|
|
434
|
+
type: 'mousedown',
|
|
435
|
+
button: button,
|
|
436
|
+
pageX: event.pageX,
|
|
437
|
+
pageY: event.pageY
|
|
438
|
+
};
|
|
439
|
+
SDL.events.push(event2);
|
|
440
|
+
event = {
|
|
441
|
+
type: 'mouseup',
|
|
442
|
+
button: button,
|
|
443
|
+
pageX: event.pageX,
|
|
444
|
+
pageY: event.pageY
|
|
445
|
+
};
|
|
446
|
+
} else if (event.type == 'mousedown') {
|
|
447
|
+
SDL.DOMButtons[event.button] = 1;
|
|
448
|
+
} else if (event.type == 'mouseup') {
|
|
449
|
+
// ignore extra ups, can happen if we leave the canvas while pressing down, then return,
|
|
450
|
+
// since we add a mouseup in that case
|
|
451
|
+
if (!SDL.DOMButtons[event.button]) {
|
|
452
|
+
event.preventDefault();
|
|
453
|
+
return;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
SDL.DOMButtons[event.button] = 0;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
if (event.type == 'keypress' && !SDL.textInput) {
|
|
460
|
+
break;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
SDL.events.push(event);
|
|
464
|
+
break;
|
|
465
|
+
case 'mouseout':
|
|
466
|
+
// Un-press all pressed mouse buttons, because we might miss the release outside of the canvas
|
|
467
|
+
for (var i = 0; i < 3; i++) {
|
|
468
|
+
if (SDL.DOMButtons[i]) {
|
|
469
|
+
SDL.events.push({
|
|
470
|
+
type: 'mouseup',
|
|
471
|
+
button: i,
|
|
472
|
+
pageX: event.pageX,
|
|
473
|
+
pageY: event.pageY
|
|
474
|
+
});
|
|
475
|
+
SDL.DOMButtons[i] = 0;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
break;
|
|
479
|
+
case 'blur':
|
|
480
|
+
case 'visibilitychange': {
|
|
481
|
+
// Un-press all pressed keys: TODO
|
|
482
|
+
for (var code in SDL.keyboardMap) {
|
|
483
|
+
SDL.events.push({
|
|
484
|
+
type: 'keyup',
|
|
485
|
+
keyCode: SDL.keyboardMap[code]
|
|
486
|
+
});
|
|
487
|
+
}
|
|
488
|
+
break;
|
|
489
|
+
}
|
|
490
|
+
case 'unload':
|
|
491
|
+
if (Browser.mainLoop.runner) {
|
|
492
|
+
SDL.events.push(event);
|
|
493
|
+
// Force-run a main event loop, since otherwise this event will never be caught!
|
|
494
|
+
Browser.mainLoop.runner();
|
|
495
|
+
}
|
|
496
|
+
return;
|
|
497
|
+
case 'resize':
|
|
498
|
+
SDL.events.push(event);
|
|
499
|
+
break;
|
|
500
|
+
}
|
|
501
|
+
if (SDL.events.length >= 10000) {
|
|
502
|
+
Module.printErr('SDL event queue full, dropping events');
|
|
503
|
+
SDL.events = SDL.events.slice(0, 10000);
|
|
504
|
+
}
|
|
505
|
+
// manually triggered resize event doesn't have a preventDefault member
|
|
506
|
+
if (event.preventDefault) {
|
|
507
|
+
event.preventDefault();
|
|
508
|
+
}
|
|
509
|
+
return;
|
|
510
|
+
},
|
|
511
|
+
|
|
512
|
+
makeCEvent: function(event, ptr) {
|
|
513
|
+
if (typeof event === 'number') {
|
|
514
|
+
// This is a pointer to a native C event that was SDL_PushEvent'ed
|
|
515
|
+
_memcpy(ptr, event, SDL.structs.KeyboardEvent.__size__); // XXX
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
switch(event.type) {
|
|
520
|
+
case 'keydown': case 'keyup': {
|
|
521
|
+
var down = event.type === 'keydown';
|
|
522
|
+
//Module.print('Received key event: ' + event.keyCode);
|
|
523
|
+
var key = event.keyCode;
|
|
524
|
+
if (key >= 65 && key <= 90) {
|
|
525
|
+
key += 32; // make lowercase for SDL
|
|
526
|
+
} else {
|
|
527
|
+
key = SDL.keyCodes[event.keyCode] || event.keyCode;
|
|
528
|
+
}
|
|
529
|
+
var scan;
|
|
530
|
+
if (key >= 1024) {
|
|
531
|
+
scan = key - 1024;
|
|
532
|
+
} else {
|
|
533
|
+
scan = SDL.scanCodes[key] || key;
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
var code = SDL.keyCodes[event.keyCode] || event.keyCode;
|
|
537
|
+
{{{ makeSetValue('SDL.keyboardState', 'code', 'down', 'i8') }}};
|
|
538
|
+
if (down) {
|
|
539
|
+
SDL.keyboardMap[code] = event.keyCode; // save the DOM input, which we can use to unpress it during blur
|
|
540
|
+
} else {
|
|
541
|
+
delete SDL.keyboardMap[code];
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
// TODO: lmeta, rmeta, numlock, capslock, KMOD_MODE, KMOD_RESERVED
|
|
545
|
+
SDL.modState = ({{{ makeGetValue('SDL.keyboardState', '1248', 'i8') }}} ? 0x0040 | 0x0080 : 0) | // KMOD_LCTRL & KMOD_RCTRL
|
|
546
|
+
({{{ makeGetValue('SDL.keyboardState', '1249', 'i8') }}} ? 0x0001 | 0x0002 : 0) | // KMOD_LSHIFT & KMOD_RSHIFT
|
|
547
|
+
({{{ makeGetValue('SDL.keyboardState', '1250', 'i8') }}} ? 0x0100 | 0x0200 : 0); // KMOD_LALT & KMOD_RALT
|
|
548
|
+
|
|
549
|
+
{{{ makeSetValue('ptr', 'SDL.structs.KeyboardEvent.type', 'SDL.DOMEventToSDLEvent[event.type]', 'i32') }}}
|
|
550
|
+
{{{ makeSetValue('ptr', 'SDL.structs.KeyboardEvent.state', 'down ? 1 : 0', 'i8') }}}
|
|
551
|
+
{{{ makeSetValue('ptr', 'SDL.structs.KeyboardEvent.repeat', '0', 'i8') }}} // TODO
|
|
552
|
+
{{{ makeSetValue('ptr', 'SDL.structs.KeyboardEvent.keysym + SDL.structs.keysym.scancode', 'scan', 'i32') }}}
|
|
553
|
+
{{{ makeSetValue('ptr', 'SDL.structs.KeyboardEvent.keysym + SDL.structs.keysym.sym', 'key', 'i32') }}}
|
|
554
|
+
{{{ makeSetValue('ptr', 'SDL.structs.KeyboardEvent.keysym + SDL.structs.keysym.mod', 'SDL.modState', 'i32') }}}
|
|
555
|
+
{{{ makeSetValue('ptr', 'SDL.structs.KeyboardEvent.keysym + SDL.structs.keysym.unicode', 'key', 'i32') }}}
|
|
556
|
+
|
|
557
|
+
break;
|
|
558
|
+
}
|
|
559
|
+
case 'keypress': {
|
|
560
|
+
{{{ makeSetValue('ptr', 'SDL.structs.TextInputEvent.type', 'SDL.DOMEventToSDLEvent[event.type]', 'i32') }}}
|
|
561
|
+
// Not filling in windowID for now
|
|
562
|
+
var cStr = intArrayFromString(String.fromCharCode(event.charCode));
|
|
563
|
+
for (var i = 0; i < cStr.length; ++i) {
|
|
564
|
+
{{{ makeSetValue('ptr', 'SDL.structs.TextInputEvent.text + i', 'cStr[i]', 'i8') }}};
|
|
565
|
+
}
|
|
566
|
+
break;
|
|
567
|
+
}
|
|
568
|
+
case 'mousedown': case 'mouseup':
|
|
569
|
+
if (event.type == 'mousedown') {
|
|
570
|
+
// SDL_BUTTON(x) is defined as (1 << ((x)-1)). SDL buttons are 1-3,
|
|
571
|
+
// and DOM buttons are 0-2, so this means that the below formula is
|
|
572
|
+
// correct.
|
|
573
|
+
SDL.buttonState |= 1 << event.button;
|
|
574
|
+
} else if (event.type == 'mouseup') {
|
|
575
|
+
SDL.buttonState &= ~(1 << event.button);
|
|
576
|
+
}
|
|
577
|
+
// fall through
|
|
578
|
+
case 'mousemove': {
|
|
579
|
+
Browser.calculateMouseEvent(event);
|
|
580
|
+
if (event.type != 'mousemove') {
|
|
581
|
+
var down = event.type === 'mousedown';
|
|
582
|
+
{{{ makeSetValue('ptr', 'SDL.structs.MouseButtonEvent.type', 'SDL.DOMEventToSDLEvent[event.type]', 'i32') }}};
|
|
583
|
+
{{{ makeSetValue('ptr', 'SDL.structs.MouseButtonEvent.button', 'event.button+1', 'i8') }}}; // DOM buttons are 0-2, SDL 1-3
|
|
584
|
+
{{{ makeSetValue('ptr', 'SDL.structs.MouseButtonEvent.state', 'down ? 1 : 0', 'i8') }}};
|
|
585
|
+
{{{ makeSetValue('ptr', 'SDL.structs.MouseButtonEvent.x', 'Browser.mouseX', 'i32') }}};
|
|
586
|
+
{{{ makeSetValue('ptr', 'SDL.structs.MouseButtonEvent.y', 'Browser.mouseY', 'i32') }}};
|
|
587
|
+
} else {
|
|
588
|
+
{{{ makeSetValue('ptr', 'SDL.structs.MouseMotionEvent.type', 'SDL.DOMEventToSDLEvent[event.type]', 'i32') }}};
|
|
589
|
+
{{{ makeSetValue('ptr', 'SDL.structs.MouseMotionEvent.state', 'SDL.buttonState', 'i8') }}};
|
|
590
|
+
{{{ makeSetValue('ptr', 'SDL.structs.MouseMotionEvent.x', 'Browser.mouseX', 'i32') }}};
|
|
591
|
+
{{{ makeSetValue('ptr', 'SDL.structs.MouseMotionEvent.y', 'Browser.mouseY', 'i32') }}};
|
|
592
|
+
{{{ makeSetValue('ptr', 'SDL.structs.MouseMotionEvent.xrel', 'Browser.mouseMovementX', 'i32') }}};
|
|
593
|
+
{{{ makeSetValue('ptr', 'SDL.structs.MouseMotionEvent.yrel', 'Browser.mouseMovementY', 'i32') }}};
|
|
594
|
+
}
|
|
595
|
+
break;
|
|
596
|
+
}
|
|
597
|
+
case 'unload': {
|
|
598
|
+
{{{ makeSetValue('ptr', 'SDL.structs.KeyboardEvent.type', 'SDL.DOMEventToSDLEvent[event.type]', 'i32') }}};
|
|
599
|
+
break;
|
|
600
|
+
}
|
|
601
|
+
case 'resize': {
|
|
602
|
+
{{{ makeSetValue('ptr', 'SDL.structs.KeyboardEvent.type', 'SDL.DOMEventToSDLEvent[event.type]', 'i32') }}};
|
|
603
|
+
{{{ makeSetValue('ptr', 'SDL.structs.ResizeEvent.w', 'event.w', 'i32') }}};
|
|
604
|
+
{{{ makeSetValue('ptr', 'SDL.structs.ResizeEvent.h', 'event.h', 'i32') }}};
|
|
605
|
+
break;
|
|
606
|
+
}
|
|
607
|
+
default: throw 'Unhandled SDL event: ' + event.type;
|
|
608
|
+
}
|
|
609
|
+
},
|
|
610
|
+
|
|
611
|
+
estimateTextWidth: function(fontData, text) {
|
|
612
|
+
var h = fontData.size;
|
|
613
|
+
var fontString = h + 'px ' + fontData.name;
|
|
614
|
+
var tempCtx = SDL.ttfContext;
|
|
615
|
+
#if ASSERTIONS
|
|
616
|
+
assert(tempCtx, 'TTF_Init must have been called');
|
|
617
|
+
#endif
|
|
618
|
+
tempCtx.save();
|
|
619
|
+
tempCtx.font = fontString;
|
|
620
|
+
var ret = tempCtx.measureText(text).width | 0;
|
|
621
|
+
tempCtx.restore();
|
|
622
|
+
return ret;
|
|
623
|
+
},
|
|
624
|
+
|
|
625
|
+
// Sound
|
|
626
|
+
|
|
627
|
+
// Channels are a SDL abstraction for allowing multiple sound tracks to be
|
|
628
|
+
// played at the same time. We don't need to actually implement the mixing
|
|
629
|
+
// since the browser engine handles that for us. Therefore, in JS we just
|
|
630
|
+
// maintain a list of channels and return IDs for them to the SDL consumer.
|
|
631
|
+
allocateChannels: function(num) { // called from Mix_AllocateChannels and init
|
|
632
|
+
if (SDL.numChannels && SDL.numChannels >= num) return;
|
|
633
|
+
SDL.numChannels = num;
|
|
634
|
+
SDL.channels = [];
|
|
635
|
+
for (var i = 0; i < num; i++) {
|
|
636
|
+
SDL.channels[i] = {
|
|
637
|
+
audio: null,
|
|
638
|
+
volume: 1.0
|
|
639
|
+
};
|
|
640
|
+
}
|
|
641
|
+
},
|
|
642
|
+
|
|
643
|
+
setGetVolume: function(info, volume) {
|
|
644
|
+
if (!info) return 0;
|
|
645
|
+
var ret = info.volume * 128; // MIX_MAX_VOLUME
|
|
646
|
+
if (volume != -1) {
|
|
647
|
+
info.volume = volume / 128;
|
|
648
|
+
if (info.audio) info.audio.volume = info.volume;
|
|
649
|
+
}
|
|
650
|
+
return ret;
|
|
651
|
+
},
|
|
652
|
+
|
|
653
|
+
// Debugging
|
|
654
|
+
|
|
655
|
+
debugSurface: function(surfData) {
|
|
656
|
+
console.log('dumping surface ' + [surfData.surf, surfData.source, surfData.width, surfData.height]);
|
|
657
|
+
var image = surfData.ctx.getImageData(0, 0, surfData.width, surfData.height);
|
|
658
|
+
var data = image.data;
|
|
659
|
+
var num = Math.min(surfData.width, surfData.height);
|
|
660
|
+
for (var i = 0; i < num; i++) {
|
|
661
|
+
console.log(' diagonal ' + i + ':' + [data[i*surfData.width*4 + i*4 + 0], data[i*surfData.width*4 + i*4 + 1], data[i*surfData.width*4 + i*4 + 2], data[i*surfData.width*4 + i*4 + 3]]);
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
},
|
|
665
|
+
|
|
666
|
+
SDL_Linked_Version: function() {
|
|
667
|
+
if (SDL.version === null) {
|
|
668
|
+
SDL.version = _malloc(SDL.structs.version.__size__);
|
|
669
|
+
{{{ makeSetValue('SDL.version + SDL.structs.version.major', '0', '1', 'i8') }}}
|
|
670
|
+
{{{ makeSetValue('SDL.version + SDL.structs.version.minor', '0', '3', 'i8') }}}
|
|
671
|
+
{{{ makeSetValue('SDL.version + SDL.structs.version.patch', '0', '0', 'i8') }}}
|
|
672
|
+
}
|
|
673
|
+
return SDL.version;
|
|
674
|
+
},
|
|
675
|
+
|
|
676
|
+
SDL_Init: function(what) {
|
|
677
|
+
SDL.startTime = Date.now();
|
|
678
|
+
// capture all key events. we just keep down and up, but also capture press to prevent default actions
|
|
679
|
+
if (!Module['doNotCaptureKeyboard']) {
|
|
680
|
+
document.addEventListener("keydown", SDL.receiveEvent);
|
|
681
|
+
document.addEventListener("keyup", SDL.receiveEvent);
|
|
682
|
+
document.addEventListener("keypress", SDL.receiveEvent);
|
|
683
|
+
document.addEventListener("blur", SDL.receiveEvent);
|
|
684
|
+
document.addEventListener("visibilitychange", SDL.receiveEvent);
|
|
685
|
+
}
|
|
686
|
+
window.addEventListener("unload", SDL.receiveEvent);
|
|
687
|
+
SDL.keyboardState = _malloc(0x10000); // Our SDL needs 512, but 64K is safe for older SDLs
|
|
688
|
+
_memset(SDL.keyboardState, 0, 0x10000);
|
|
689
|
+
// Initialize this structure carefully for closure
|
|
690
|
+
SDL.DOMEventToSDLEvent['keydown'] = 0x300 /* SDL_KEYDOWN */;
|
|
691
|
+
SDL.DOMEventToSDLEvent['keyup'] = 0x301 /* SDL_KEYUP */;
|
|
692
|
+
SDL.DOMEventToSDLEvent['keypress'] = 0x303 /* SDL_TEXTINPUT */;
|
|
693
|
+
SDL.DOMEventToSDLEvent['mousedown'] = 0x401 /* SDL_MOUSEBUTTONDOWN */;
|
|
694
|
+
SDL.DOMEventToSDLEvent['mouseup'] = 0x402 /* SDL_MOUSEBUTTONUP */;
|
|
695
|
+
SDL.DOMEventToSDLEvent['mousemove'] = 0x400 /* SDL_MOUSEMOTION */;
|
|
696
|
+
SDL.DOMEventToSDLEvent['unload'] = 0x100 /* SDL_QUIT */;
|
|
697
|
+
SDL.DOMEventToSDLEvent['resize'] = 0x7001 /* SDL_VIDEORESIZE/SDL_EVENT_COMPAT2 */;
|
|
698
|
+
return 0; // success
|
|
699
|
+
},
|
|
700
|
+
|
|
701
|
+
SDL_WasInit__deps: ['SDL_Init'],
|
|
702
|
+
SDL_WasInit: function() {
|
|
703
|
+
if (SDL.startTime === null) {
|
|
704
|
+
_SDL_Init();
|
|
705
|
+
}
|
|
706
|
+
return 1;
|
|
707
|
+
},
|
|
708
|
+
|
|
709
|
+
SDL_GetVideoInfo: function() {
|
|
710
|
+
// %struct.SDL_VideoInfo = type { i32, i32, %struct.SDL_PixelFormat*, i32, i32 } - 5 fields of quantum size
|
|
711
|
+
var ret = _malloc(5*Runtime.QUANTUM_SIZE);
|
|
712
|
+
{{{ makeSetValue('ret+Runtime.QUANTUM_SIZE*0', '0', '0', 'i32') }}} // TODO
|
|
713
|
+
{{{ makeSetValue('ret+Runtime.QUANTUM_SIZE*1', '0', '0', 'i32') }}} // TODO
|
|
714
|
+
{{{ makeSetValue('ret+Runtime.QUANTUM_SIZE*2', '0', '0', 'void*') }}}
|
|
715
|
+
{{{ makeSetValue('ret+Runtime.QUANTUM_SIZE*3', '0', 'Module["canvas"].width', 'i32') }}}
|
|
716
|
+
{{{ makeSetValue('ret+Runtime.QUANTUM_SIZE*4', '0', 'Module["canvas"].height', 'i32') }}}
|
|
717
|
+
return ret;
|
|
718
|
+
},
|
|
719
|
+
|
|
720
|
+
SDL_ListModes: function(format, flags) {
|
|
721
|
+
return -1; // -1 == all modes are ok. TODO
|
|
722
|
+
},
|
|
723
|
+
|
|
724
|
+
SDL_VideoModeOK: function(width, height, depth, flags) {
|
|
725
|
+
// SDL_VideoModeOK returns 0 if the requested mode is not supported under any bit depth, or returns the
|
|
726
|
+
// bits-per-pixel of the closest available mode with the given width, height and requested surface flags
|
|
727
|
+
return depth; // all modes are ok.
|
|
728
|
+
},
|
|
729
|
+
|
|
730
|
+
SDL_VideoDriverName: function(buf, max_size) {
|
|
731
|
+
if (SDL.startTime === null) {
|
|
732
|
+
return 0; //return NULL
|
|
733
|
+
}
|
|
734
|
+
//driverName - emscripten_sdl_driver
|
|
735
|
+
var driverName = [101, 109, 115, 99, 114, 105, 112, 116, 101,
|
|
736
|
+
110, 95, 115, 100, 108, 95, 100, 114, 105, 118, 101, 114];
|
|
737
|
+
|
|
738
|
+
var index = 0;
|
|
739
|
+
var size = driverName.length;
|
|
740
|
+
|
|
741
|
+
if (max_size <= size) {
|
|
742
|
+
size = max_size - 1; //-1 cause null-terminator
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
while (index < size) {
|
|
746
|
+
var value = driverName[index];
|
|
747
|
+
{{{ makeSetValue('buf', 'index', 'value', 'i8') }}};
|
|
748
|
+
index++;
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
{{{ makeSetValue('buf', 'index', '0', 'i8') }}};
|
|
752
|
+
return buf;
|
|
753
|
+
},
|
|
754
|
+
|
|
755
|
+
SDL_SetVideoMode: function(width, height, depth, flags) {
|
|
756
|
+
['mousedown', 'mouseup', 'mousemove', 'DOMMouseScroll', 'mousewheel', 'mouseout'].forEach(function(event) {
|
|
757
|
+
Module['canvas'].addEventListener(event, SDL.receiveEvent, true);
|
|
758
|
+
});
|
|
759
|
+
Browser.setCanvasSize(width, height, true);
|
|
760
|
+
// Free the old surface first.
|
|
761
|
+
if (SDL.screen) {
|
|
762
|
+
SDL.freeSurface(SDL.screen);
|
|
763
|
+
SDL.screen = null;
|
|
764
|
+
}
|
|
765
|
+
SDL.screen = SDL.makeSurface(width, height, flags, true, 'screen');
|
|
766
|
+
if (!SDL.addedResizeListener) {
|
|
767
|
+
SDL.addedResizeListener = true;
|
|
768
|
+
Browser.resizeListeners.push(function(w, h) {
|
|
769
|
+
SDL.receiveEvent({
|
|
770
|
+
type: 'resize',
|
|
771
|
+
w: w,
|
|
772
|
+
h: h
|
|
773
|
+
});
|
|
774
|
+
});
|
|
775
|
+
}
|
|
776
|
+
return SDL.screen;
|
|
777
|
+
},
|
|
778
|
+
|
|
779
|
+
SDL_GetVideoSurface: function() {
|
|
780
|
+
return SDL.screen;
|
|
781
|
+
},
|
|
782
|
+
|
|
783
|
+
SDL_QuitSubSystem: function(flags) {
|
|
784
|
+
Module.print('SDL_QuitSubSystem called (and ignored)');
|
|
785
|
+
},
|
|
786
|
+
|
|
787
|
+
SDL_Quit: function() {
|
|
788
|
+
for (var i = 0; i < SDL.numChannels; ++i) {
|
|
789
|
+
if (SDL.channels[i].audio) {
|
|
790
|
+
SDL.channels[i].audio.pause();
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
if (SDL.music.audio) {
|
|
794
|
+
SDL.music.audio.pause();
|
|
795
|
+
}
|
|
796
|
+
Module.print('SDL_Quit called (and ignored)');
|
|
797
|
+
},
|
|
798
|
+
|
|
799
|
+
// Copy data from the canvas backing to a C++-accessible storage
|
|
800
|
+
SDL_LockSurface: function(surf) {
|
|
801
|
+
var surfData = SDL.surfaces[surf];
|
|
802
|
+
|
|
803
|
+
surfData.locked++;
|
|
804
|
+
if (surfData.locked > 1) return 0;
|
|
805
|
+
|
|
806
|
+
surfData.image = surfData.ctx.getImageData(0, 0, surfData.width, surfData.height);
|
|
807
|
+
if (surf == SDL.screen) {
|
|
808
|
+
var data = surfData.image.data;
|
|
809
|
+
var num = data.length;
|
|
810
|
+
for (var i = 0; i < num/4; i++) {
|
|
811
|
+
data[i*4+3] = 255; // opacity, as canvases blend alpha
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
if (SDL.defaults.copyOnLock) {
|
|
816
|
+
// Copy pixel data to somewhere accessible to 'C/C++'
|
|
817
|
+
if (surfData.isFlagSet(0x00200000 /* SDL_HWPALETTE */)) {
|
|
818
|
+
// If this is neaded then
|
|
819
|
+
// we should compact the data from 32bpp to 8bpp index.
|
|
820
|
+
// I think best way to implement this is use
|
|
821
|
+
// additional colorMap hash (color->index).
|
|
822
|
+
// Something like this:
|
|
823
|
+
//
|
|
824
|
+
// var size = surfData.width * surfData.height;
|
|
825
|
+
// var data = '';
|
|
826
|
+
// for (var i = 0; i<size; i++) {
|
|
827
|
+
// var color = SDL.translateRGBAToColor(
|
|
828
|
+
// surfData.image.data[i*4 ],
|
|
829
|
+
// surfData.image.data[i*4 +1],
|
|
830
|
+
// surfData.image.data[i*4 +2],
|
|
831
|
+
// 255);
|
|
832
|
+
// var index = surfData.colorMap[color];
|
|
833
|
+
// {{{ makeSetValue('surfData.buffer', 'i', 'index', 'i8') }}};
|
|
834
|
+
// }
|
|
835
|
+
throw 'CopyOnLock is not supported for SDL_LockSurface with SDL_HWPALETTE flag set' + new Error().stack;
|
|
836
|
+
} else {
|
|
837
|
+
#if USE_TYPED_ARRAYS == 2
|
|
838
|
+
HEAPU8.set(surfData.image.data, surfData.buffer);
|
|
839
|
+
#else
|
|
840
|
+
var num2 = surfData.image.data.length;
|
|
841
|
+
for (var i = 0; i < num2; i++) {
|
|
842
|
+
{{{ makeSetValue('surfData.buffer', 'i', 'surfData.image.data[i]', 'i8') }}};
|
|
843
|
+
}
|
|
844
|
+
#endif
|
|
845
|
+
}
|
|
846
|
+
}
|
|
847
|
+
|
|
848
|
+
// Mark in C/C++-accessible SDL structure
|
|
849
|
+
// SDL_Surface has the following fields: Uint32 flags, SDL_PixelFormat *format; int w, h; Uint16 pitch; void *pixels; ...
|
|
850
|
+
// So we have fields all of the same size, and 5 of them before us.
|
|
851
|
+
// TODO: Use macros like in library.js
|
|
852
|
+
{{{ makeSetValue('surf', '5*Runtime.QUANTUM_SIZE', 'surfData.buffer', 'void*') }}};
|
|
853
|
+
|
|
854
|
+
return 0;
|
|
855
|
+
},
|
|
856
|
+
|
|
857
|
+
// Copy data from the C++-accessible storage to the canvas backing
|
|
858
|
+
SDL_UnlockSurface: function(surf) {
|
|
859
|
+
assert(!SDL.GL); // in GL mode we do not keep around 2D canvases and contexts
|
|
860
|
+
|
|
861
|
+
var surfData = SDL.surfaces[surf];
|
|
862
|
+
|
|
863
|
+
surfData.locked--;
|
|
864
|
+
if (surfData.locked > 0) return;
|
|
865
|
+
|
|
866
|
+
// Copy pixel data to image
|
|
867
|
+
if (surfData.isFlagSet(0x00200000 /* SDL_HWPALETTE */)) {
|
|
868
|
+
SDL.copyIndexedColorData(surfData);
|
|
869
|
+
} else if (!surfData.colors) {
|
|
870
|
+
var data = surfData.image.data;
|
|
871
|
+
var buffer = surfData.buffer;
|
|
872
|
+
#if USE_TYPED_ARRAYS == 2
|
|
873
|
+
assert(buffer % 4 == 0, 'Invalid buffer offset: ' + buffer);
|
|
874
|
+
var src = buffer >> 2;
|
|
875
|
+
var dst = 0;
|
|
876
|
+
var isScreen = surf == SDL.screen;
|
|
877
|
+
var data32 = new Uint32Array(data.buffer);
|
|
878
|
+
var num = data32.length;
|
|
879
|
+
while (dst < num) {
|
|
880
|
+
// HEAP32[src++] is an optimization. Instead, we could do {{{ makeGetValue('buffer', 'dst', 'i32') }}};
|
|
881
|
+
data32[dst++] = HEAP32[src++] | (isScreen ? 0xff000000 : 0);
|
|
882
|
+
}
|
|
883
|
+
#else
|
|
884
|
+
var num = surfData.image.data.length;
|
|
885
|
+
for (var i = 0; i < num; i++) {
|
|
886
|
+
// We may need to correct signs here. Potentially you can hardcode a write of 255 to alpha, say, and
|
|
887
|
+
// the compiler may decide to write -1 in the llvm bitcode...
|
|
888
|
+
data[i] = {{{ makeGetValue('buffer', 'i', 'i8', null, true) }}};
|
|
889
|
+
if (i % 4 == 3) data[i] = 0xff;
|
|
890
|
+
}
|
|
891
|
+
#endif
|
|
892
|
+
} else {
|
|
893
|
+
var width = Module['canvas'].width;
|
|
894
|
+
var height = Module['canvas'].height;
|
|
895
|
+
var s = surfData.buffer;
|
|
896
|
+
var data = surfData.image.data;
|
|
897
|
+
var colors = surfData.colors;
|
|
898
|
+
for (var y = 0; y < height; y++) {
|
|
899
|
+
var base = y*width*4;
|
|
900
|
+
for (var x = 0; x < width; x++) {
|
|
901
|
+
// See comment above about signs
|
|
902
|
+
var val = {{{ makeGetValue('s++', '0', 'i8', null, true) }}} * 3;
|
|
903
|
+
var start = base + x*4;
|
|
904
|
+
data[start] = colors[val];
|
|
905
|
+
data[start+1] = colors[val+1];
|
|
906
|
+
data[start+2] = colors[val+2];
|
|
907
|
+
}
|
|
908
|
+
s += width*3;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
// Copy to canvas
|
|
912
|
+
surfData.ctx.putImageData(surfData.image, 0, 0);
|
|
913
|
+
// Note that we save the image, so future writes are fast. But, memory is not yet released
|
|
914
|
+
},
|
|
915
|
+
|
|
916
|
+
SDL_Flip: function(surf) {
|
|
917
|
+
// We actually do this in Unlock, since the screen surface has as its canvas
|
|
918
|
+
// backing the page canvas element
|
|
919
|
+
},
|
|
920
|
+
|
|
921
|
+
SDL_UpdateRect: function(surf, x, y, w, h) {
|
|
922
|
+
// We actually do the whole screen in Unlock...
|
|
923
|
+
},
|
|
924
|
+
|
|
925
|
+
SDL_UpdateRects: function(surf, numrects, rects) {
|
|
926
|
+
// We actually do the whole screen in Unlock...
|
|
927
|
+
},
|
|
928
|
+
|
|
929
|
+
SDL_Delay: function(delay) {
|
|
930
|
+
abort('SDL_Delay called! Potential infinite loop, quitting.');
|
|
931
|
+
},
|
|
932
|
+
|
|
933
|
+
SDL_WM_SetCaption: function(title, icon) {
|
|
934
|
+
title = title && Pointer_stringify(title);
|
|
935
|
+
icon = icon && Pointer_stringify(icon);
|
|
936
|
+
},
|
|
937
|
+
|
|
938
|
+
SDL_EnableKeyRepeat: function(delay, interval) {
|
|
939
|
+
// TODO
|
|
940
|
+
},
|
|
941
|
+
|
|
942
|
+
SDL_GetKeyboardState: function() {
|
|
943
|
+
return SDL.keyboardState;
|
|
944
|
+
},
|
|
945
|
+
|
|
946
|
+
SDL_GetKeyState__deps: ['SDL_GetKeyboardState'],
|
|
947
|
+
SDL_GetKeyState: function() {
|
|
948
|
+
return _SDL_GetKeyboardState();
|
|
949
|
+
},
|
|
950
|
+
|
|
951
|
+
SDL_GetKeyName: function(key) {
|
|
952
|
+
if (!SDL.keyName) {
|
|
953
|
+
SDL.keyName = allocate(intArrayFromString('unknown key'), 'i8', ALLOC_NORMAL);
|
|
954
|
+
}
|
|
955
|
+
return SDL.keyName;
|
|
956
|
+
},
|
|
957
|
+
|
|
958
|
+
SDL_GetModState: function() {
|
|
959
|
+
return SDL.modState;
|
|
960
|
+
},
|
|
961
|
+
|
|
962
|
+
SDL_GetMouseState: function(x, y) {
|
|
963
|
+
if (x) {{{ makeSetValue('x', '0', 'Browser.mouseX', 'i32') }}};
|
|
964
|
+
if (y) {{{ makeSetValue('y', '0', 'Browser.mouseY', 'i32') }}};
|
|
965
|
+
return SDL.buttonState;
|
|
966
|
+
},
|
|
967
|
+
|
|
968
|
+
SDL_WarpMouse: function(x, y) {
|
|
969
|
+
return; // TODO: implement this in a non-buggy way. Need to keep relative mouse movements correct after calling this
|
|
970
|
+
var rect = Module["canvas"].getBoundingClientRect();
|
|
971
|
+
SDL.events.push({
|
|
972
|
+
type: 'mousemove',
|
|
973
|
+
pageX: x + (window.scrollX + rect.left),
|
|
974
|
+
pageY: y + (window.scrollY + rect.top)
|
|
975
|
+
});
|
|
976
|
+
},
|
|
977
|
+
|
|
978
|
+
SDL_ShowCursor: function(toggle) {
|
|
979
|
+
switch (toggle) {
|
|
980
|
+
case 0: // SDL_DISABLE
|
|
981
|
+
if (Browser.isFullScreen) { // only try to lock the pointer when in full screen mode
|
|
982
|
+
Module['canvas'].requestPointerLock();
|
|
983
|
+
return 0;
|
|
984
|
+
} else { // else return SDL_ENABLE to indicate the failure
|
|
985
|
+
return 1;
|
|
986
|
+
}
|
|
987
|
+
break;
|
|
988
|
+
case 1: // SDL_ENABLE
|
|
989
|
+
Module['canvas'].exitPointerLock();
|
|
990
|
+
return 1;
|
|
991
|
+
break;
|
|
992
|
+
case -1: // SDL_QUERY
|
|
993
|
+
return !Browser.pointerLock;
|
|
994
|
+
break;
|
|
995
|
+
default:
|
|
996
|
+
console.log( "SDL_ShowCursor called with unknown toggle parameter value: " + toggle + "." );
|
|
997
|
+
break;
|
|
998
|
+
}
|
|
999
|
+
},
|
|
1000
|
+
|
|
1001
|
+
SDL_GetError: function() {
|
|
1002
|
+
if (!SDL.errorMessage) {
|
|
1003
|
+
SDL.errorMessage = allocate(intArrayFromString("unknown SDL-emscripten error"), 'i8', ALLOC_NORMAL);
|
|
1004
|
+
}
|
|
1005
|
+
return SDL.errorMessage;
|
|
1006
|
+
},
|
|
1007
|
+
|
|
1008
|
+
SDL_CreateRGBSurface: function(flags, width, height, depth, rmask, gmask, bmask, amask) {
|
|
1009
|
+
return SDL.makeSurface(width, height, flags, false, 'CreateRGBSurface', rmask, gmask, bmask, amask);
|
|
1010
|
+
},
|
|
1011
|
+
|
|
1012
|
+
SDL_CreateRGBSurfaceFrom: function(pixels, width, height, depth, pitch, rmask, gmask, bmask, amask) {
|
|
1013
|
+
// TODO: Actually fill pixel data to created surface.
|
|
1014
|
+
// TODO: Take into account depth and pitch parameters.
|
|
1015
|
+
console.log('TODO: Partially unimplemented SDL_CreateRGBSurfaceFrom called!');
|
|
1016
|
+
return SDL.makeSurface(width, height, 0, false, 'CreateRGBSurfaceFrom', rmask, gmask, bmask, amask);
|
|
1017
|
+
},
|
|
1018
|
+
|
|
1019
|
+
SDL_DisplayFormatAlpha: function(surf) {
|
|
1020
|
+
var oldData = SDL.surfaces[surf];
|
|
1021
|
+
var ret = SDL.makeSurface(oldData.width, oldData.height, oldData.flags, false, 'copy:' + oldData.source);
|
|
1022
|
+
var newData = SDL.surfaces[ret];
|
|
1023
|
+
//newData.ctx.putImageData(oldData.ctx.getImageData(0, 0, oldData.width, oldData.height), 0, 0);
|
|
1024
|
+
newData.ctx.drawImage(oldData.canvas, 0, 0);
|
|
1025
|
+
return ret;
|
|
1026
|
+
},
|
|
1027
|
+
|
|
1028
|
+
SDL_FreeSurface: function(surf) {
|
|
1029
|
+
if (surf) SDL.freeSurface(surf);
|
|
1030
|
+
},
|
|
1031
|
+
|
|
1032
|
+
SDL_UpperBlit: function(src, srcrect, dst, dstrect) {
|
|
1033
|
+
var srcData = SDL.surfaces[src];
|
|
1034
|
+
var dstData = SDL.surfaces[dst];
|
|
1035
|
+
var sr, dr;
|
|
1036
|
+
if (srcrect) {
|
|
1037
|
+
sr = SDL.loadRect(srcrect);
|
|
1038
|
+
} else {
|
|
1039
|
+
sr = { x: 0, y: 0, w: srcData.width, h: srcData.height };
|
|
1040
|
+
}
|
|
1041
|
+
if (dstrect) {
|
|
1042
|
+
dr = SDL.loadRect(dstrect);
|
|
1043
|
+
} else {
|
|
1044
|
+
dr = { x: 0, y: 0, w: -1, h: -1 };
|
|
1045
|
+
}
|
|
1046
|
+
dstData.ctx.drawImage(srcData.canvas, sr.x, sr.y, sr.w, sr.h, dr.x, dr.y, sr.w, sr.h);
|
|
1047
|
+
if (dst != SDL.screen) {
|
|
1048
|
+
// XXX As in IMG_Load, for compatibility we write out |pixels|
|
|
1049
|
+
console.log('WARNING: copying canvas data to memory for compatibility');
|
|
1050
|
+
_SDL_LockSurface(dst);
|
|
1051
|
+
dstData.locked--; // The surface is not actually locked in this hack
|
|
1052
|
+
}
|
|
1053
|
+
return 0;
|
|
1054
|
+
},
|
|
1055
|
+
|
|
1056
|
+
SDL_FillRect: function(surf, rect, color) {
|
|
1057
|
+
var surfData = SDL.surfaces[surf];
|
|
1058
|
+
assert(!surfData.locked); // but we could unlock and re-lock if we must..
|
|
1059
|
+
|
|
1060
|
+
if (surfData.isFlagSet(0x00200000 /* SDL_HWPALETTE */)) {
|
|
1061
|
+
//in SDL_HWPALETTE color is index (0..255)
|
|
1062
|
+
//so we should translate 1 byte value to
|
|
1063
|
+
//32 bit canvas
|
|
1064
|
+
var index = color * 3;
|
|
1065
|
+
color = SDL.translateRGBAToColor(surfData.colors[index], surfData.colors[index +1], surfData.colors[index +2], 255);
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
var r = rect ? SDL.loadRect(rect) : { x: 0, y: 0, w: surfData.width, h: surfData.height };
|
|
1069
|
+
surfData.ctx.save();
|
|
1070
|
+
surfData.ctx.fillStyle = SDL.translateColorToCSSRGBA(color);
|
|
1071
|
+
surfData.ctx.fillRect(r.x, r.y, r.w, r.h);
|
|
1072
|
+
surfData.ctx.restore();
|
|
1073
|
+
return 0;
|
|
1074
|
+
},
|
|
1075
|
+
|
|
1076
|
+
SDL_BlitSurface__deps: ['SDL_UpperBlit'],
|
|
1077
|
+
SDL_BlitSurface: function(src, srcrect, dst, dstrect) {
|
|
1078
|
+
return _SDL_UpperBlit(src, srcrect, dst, dstrect);
|
|
1079
|
+
},
|
|
1080
|
+
|
|
1081
|
+
zoomSurface: function(src, x, y, smooth) {
|
|
1082
|
+
var srcData = SDL.surfaces[src];
|
|
1083
|
+
var w = srcData.width * x;
|
|
1084
|
+
var h = srcData.height * y;
|
|
1085
|
+
var ret = SDL.makeSurface(Math.abs(w), Math.abs(h), srcData.flags, false, 'zoomSurface');
|
|
1086
|
+
var dstData = SDL.surfaces[ret];
|
|
1087
|
+
if (x >= 0 && y >= 0) dstData.ctx.drawImage(srcData.canvas, 0, 0, w, h);
|
|
1088
|
+
else {
|
|
1089
|
+
dstData.ctx.save();
|
|
1090
|
+
dstData.ctx.scale(x < 0 ? -1 : 1, y < 0 ? -1 : 1);
|
|
1091
|
+
dstData.ctx.drawImage(srcData.canvas, w < 0 ? w : 0, h < 0 ? h : 0, Math.abs(w), Math.abs(h));
|
|
1092
|
+
// XXX I think this should work according to the spec, but currently
|
|
1093
|
+
// fails on FF: dstData.ctx.drawImage(srcData.canvas, 0, 0, w, h);
|
|
1094
|
+
dstData.ctx.restore();
|
|
1095
|
+
}
|
|
1096
|
+
return ret;
|
|
1097
|
+
},
|
|
1098
|
+
|
|
1099
|
+
rotozoomSurface: function(src, angle, zoom, smooth) {
|
|
1100
|
+
var srcData = SDL.surfaces[src];
|
|
1101
|
+
var w = srcData.width * zoom;
|
|
1102
|
+
var h = srcData.height * zoom;
|
|
1103
|
+
var diagonal = Math.ceil(Math.sqrt(Math.pow(w, 2) + Math.pow(h, 2)));
|
|
1104
|
+
var ret = SDL.makeSurface(diagonal, diagonal, srcData.flags, false, 'rotozoomSurface');
|
|
1105
|
+
var dstData = SDL.surfaces[ret];
|
|
1106
|
+
dstData.ctx.translate(diagonal / 2, diagonal / 2);
|
|
1107
|
+
dstData.ctx.rotate(angle * Math.PI / 180);
|
|
1108
|
+
dstData.ctx.drawImage(srcData.canvas, -w / 2, -h / 2, w, h);
|
|
1109
|
+
return ret;
|
|
1110
|
+
},
|
|
1111
|
+
|
|
1112
|
+
SDL_SetAlpha: function(surf, flag, alpha) {
|
|
1113
|
+
SDL.surfaces[surf].alpha = alpha;
|
|
1114
|
+
},
|
|
1115
|
+
|
|
1116
|
+
SDL_SetColorKey: function(surf, flag, key) {
|
|
1117
|
+
// SetColorKey assigns one color to be rendered as transparent. I don't
|
|
1118
|
+
// think the canvas API allows for anything like this, and iterating through
|
|
1119
|
+
// each pixel to replace that color seems prohibitively expensive.
|
|
1120
|
+
Runtime.warnOnce('SDL_SetColorKey is a no-op for performance reasons');
|
|
1121
|
+
return 0;
|
|
1122
|
+
},
|
|
1123
|
+
|
|
1124
|
+
SDL_GetTicks: function() {
|
|
1125
|
+
return Math.floor(Date.now() - SDL.startTime);
|
|
1126
|
+
},
|
|
1127
|
+
|
|
1128
|
+
SDL_PollEvent: function(ptr) {
|
|
1129
|
+
if (SDL.events.length === 0) return 0;
|
|
1130
|
+
if (ptr) {
|
|
1131
|
+
SDL.makeCEvent(SDL.events.shift(), ptr);
|
|
1132
|
+
}
|
|
1133
|
+
return 1;
|
|
1134
|
+
},
|
|
1135
|
+
|
|
1136
|
+
SDL_PushEvent: function(ptr) {
|
|
1137
|
+
SDL.events.push(ptr); // XXX Should we copy it? Not clear from API
|
|
1138
|
+
return 0;
|
|
1139
|
+
},
|
|
1140
|
+
|
|
1141
|
+
SDL_PeepEvents: function(events, numEvents, action, from, to) {
|
|
1142
|
+
switch(action) {
|
|
1143
|
+
case 2: { // SDL_GETEVENT
|
|
1144
|
+
assert(numEvents == 1);
|
|
1145
|
+
var got = 0;
|
|
1146
|
+
while (SDL.events.length > 0 && numEvents > 0) {
|
|
1147
|
+
var type = SDL.DOMEventToSDLEvent[SDL.events[0].type];
|
|
1148
|
+
if (type < from || type > to) break;
|
|
1149
|
+
SDL.makeCEvent(SDL.events.shift(), events);
|
|
1150
|
+
got++;
|
|
1151
|
+
numEvents--;
|
|
1152
|
+
// events += sizeof(..)
|
|
1153
|
+
}
|
|
1154
|
+
return got;
|
|
1155
|
+
}
|
|
1156
|
+
default: throw 'SDL_PeepEvents does not yet support that action: ' + action;
|
|
1157
|
+
}
|
|
1158
|
+
},
|
|
1159
|
+
|
|
1160
|
+
SDL_PumpEvents: function(){},
|
|
1161
|
+
|
|
1162
|
+
SDL_SetColors: function(surf, colors, firstColor, nColors) {
|
|
1163
|
+
var surfData = SDL.surfaces[surf];
|
|
1164
|
+
|
|
1165
|
+
// we should create colors array
|
|
1166
|
+
// only once cause client code
|
|
1167
|
+
// often wants to change portion
|
|
1168
|
+
// of palette not all palette.
|
|
1169
|
+
if (!surfData.colors) {
|
|
1170
|
+
surfData.colors = new Uint8Array(256 * 3); //256 RGB colors
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
for (var i = firstColor; i < firstColor + nColors; i++) {
|
|
1174
|
+
var index = i *3;
|
|
1175
|
+
surfData.colors[index] = {{{ makeGetValue('colors', 'i*4', 'i8', null, true) }}};
|
|
1176
|
+
surfData.colors[index +1] = {{{ makeGetValue('colors', 'i*4 +1', 'i8', null, true) }}};
|
|
1177
|
+
surfData.colors[index +2] = {{{ makeGetValue('colors', 'i*4 +2', 'i8', null, true) }}};
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1180
|
+
return 1;
|
|
1181
|
+
},
|
|
1182
|
+
|
|
1183
|
+
SDL_MapRGB: function(fmt, r, g, b) {
|
|
1184
|
+
// Canvas screens are always RGBA. We assume the machine is little-endian.
|
|
1185
|
+
return r&0xff|(g&0xff)<<8|(b&0xff)<<16|0xff000000;
|
|
1186
|
+
},
|
|
1187
|
+
|
|
1188
|
+
SDL_MapRGBA: function(fmt, r, g, b, a) {
|
|
1189
|
+
// Canvas screens are always RGBA. We assume the machine is little-endian.
|
|
1190
|
+
return r&0xff|(g&0xff)<<8|(b&0xff)<<16|(a&0xff)<<24;
|
|
1191
|
+
},
|
|
1192
|
+
|
|
1193
|
+
SDL_GetAppState: function() {
|
|
1194
|
+
var state = 0;
|
|
1195
|
+
|
|
1196
|
+
if (Browser.pointerLock) {
|
|
1197
|
+
state |= 0x01; // SDL_APPMOUSEFOCUS
|
|
1198
|
+
}
|
|
1199
|
+
if (document.hasFocus()) {
|
|
1200
|
+
state |= 0x02; // SDL_APPINPUTFOCUS
|
|
1201
|
+
}
|
|
1202
|
+
state |= 0x04; // SDL_APPACTIVE
|
|
1203
|
+
|
|
1204
|
+
return state;
|
|
1205
|
+
},
|
|
1206
|
+
|
|
1207
|
+
SDL_WM_GrabInput: function() {},
|
|
1208
|
+
|
|
1209
|
+
SDL_WM_ToggleFullScreen: function(surf) {
|
|
1210
|
+
if (Browser.isFullScreen) {
|
|
1211
|
+
Module['canvas'].cancelFullScreen();
|
|
1212
|
+
return 1;
|
|
1213
|
+
} else {
|
|
1214
|
+
return 0;
|
|
1215
|
+
}
|
|
1216
|
+
},
|
|
1217
|
+
|
|
1218
|
+
// SDL_Image
|
|
1219
|
+
|
|
1220
|
+
IMG_Init: function(flags) {
|
|
1221
|
+
return flags; // We support JPG, PNG, TIF because browsers do
|
|
1222
|
+
},
|
|
1223
|
+
|
|
1224
|
+
IMG_Load__deps: ['SDL_LockSurface'],
|
|
1225
|
+
IMG_Load: function(filename) {
|
|
1226
|
+
filename = FS.standardizePath(Pointer_stringify(filename));
|
|
1227
|
+
if (filename[0] == '/') {
|
|
1228
|
+
// Convert the path to relative
|
|
1229
|
+
filename = filename.substr(1);
|
|
1230
|
+
}
|
|
1231
|
+
var raw = Module["preloadedImages"][filename];
|
|
1232
|
+
if (!raw) {
|
|
1233
|
+
if (raw === null) Module.printErr('Trying to reuse preloaded image, but freePreloadedMediaOnUse is set!');
|
|
1234
|
+
Runtime.warnOnce('Cannot find preloaded image ' + filename);
|
|
1235
|
+
return 0;
|
|
1236
|
+
}
|
|
1237
|
+
if (Module['freePreloadedMediaOnUse']) {
|
|
1238
|
+
Module["preloadedImages"][filename] = null;
|
|
1239
|
+
}
|
|
1240
|
+
var surf = SDL.makeSurface(raw.width, raw.height, 0, false, 'load:' + filename);
|
|
1241
|
+
var surfData = SDL.surfaces[surf];
|
|
1242
|
+
surfData.ctx.globalCompositeOperation = "copy";
|
|
1243
|
+
surfData.ctx.drawImage(raw, 0, 0, raw.width, raw.height, 0, 0, raw.width, raw.height);
|
|
1244
|
+
surfData.ctx.globalCompositeOperation = "source-over";
|
|
1245
|
+
// XXX SDL does not specify that loaded images must have available pixel data, in fact
|
|
1246
|
+
// there are cases where you just want to blit them, so you just need the hardware
|
|
1247
|
+
// accelerated version. However, code everywhere seems to assume that the pixels
|
|
1248
|
+
// are in fact available, so we retrieve it here. This does add overhead though.
|
|
1249
|
+
_SDL_LockSurface(surf);
|
|
1250
|
+
surfData.locked--; // The surface is not actually locked in this hack
|
|
1251
|
+
if (SDL.GL) {
|
|
1252
|
+
// After getting the pixel data, we can free the canvas and context if we do not need to do 2D canvas blitting
|
|
1253
|
+
surfData.canvas = surfData.ctx = null;
|
|
1254
|
+
}
|
|
1255
|
+
return surf;
|
|
1256
|
+
},
|
|
1257
|
+
SDL_LoadBMP: 'IMG_Load',
|
|
1258
|
+
SDL_LoadBMP_RW: 'IMG_Load',
|
|
1259
|
+
IMG_Load_RW: 'IMG_Load',
|
|
1260
|
+
|
|
1261
|
+
// SDL_Audio
|
|
1262
|
+
|
|
1263
|
+
// TODO fix SDL_OpenAudio, and add some tests for it. It's currently broken.
|
|
1264
|
+
SDL_OpenAudio: function(desired, obtained) {
|
|
1265
|
+
SDL.allocateChannels(32);
|
|
1266
|
+
|
|
1267
|
+
SDL.audio = {
|
|
1268
|
+
freq: {{{ makeGetValue('desired', 'SDL.structs.AudioSpec.freq', 'i32', 0, 1) }}},
|
|
1269
|
+
format: {{{ makeGetValue('desired', 'SDL.structs.AudioSpec.format', 'i16', 0, 1) }}},
|
|
1270
|
+
channels: {{{ makeGetValue('desired', 'SDL.structs.AudioSpec.channels', 'i8', 0, 1) }}},
|
|
1271
|
+
samples: {{{ makeGetValue('desired', 'SDL.structs.AudioSpec.samples', 'i16', 0, 1) }}},
|
|
1272
|
+
callback: {{{ makeGetValue('desired', 'SDL.structs.AudioSpec.callback', 'void*', 0, 1) }}},
|
|
1273
|
+
userdata: {{{ makeGetValue('desired', 'SDL.structs.AudioSpec.userdata', 'void*', 0, 1) }}},
|
|
1274
|
+
paused: true,
|
|
1275
|
+
timer: null
|
|
1276
|
+
};
|
|
1277
|
+
|
|
1278
|
+
if (obtained) {
|
|
1279
|
+
{{{ makeSetValue('obtained', 'SDL.structs.AudioSpec.freq', 'SDL.audio.freq', 'i32') }}}; // no good way for us to know if the browser can really handle this
|
|
1280
|
+
{{{ makeSetValue('obtained', 'SDL.structs.AudioSpec.format', 33040, 'i16') }}}; // float, signed, 16-bit
|
|
1281
|
+
{{{ makeSetValue('obtained', 'SDL.structs.AudioSpec.channels', 'SDL.audio.channels', 'i8') }}};
|
|
1282
|
+
{{{ makeSetValue('obtained', 'SDL.structs.AudioSpec.silence', makeGetValue('desired', 'SDL.structs.AudioSpec.silence', 'i8', 0, 1), 'i8') }}}; // unclear if browsers can provide this
|
|
1283
|
+
{{{ makeSetValue('obtained', 'SDL.structs.AudioSpec.samples', 'SDL.audio.samples', 'i16') }}};
|
|
1284
|
+
{{{ makeSetValue('obtained', 'SDL.structs.AudioSpec.callback', 'SDL.audio.callback', '*') }}};
|
|
1285
|
+
{{{ makeSetValue('obtained', 'SDL.structs.AudioSpec.userdata', 'SDL.audio.userdata', '*') }}};
|
|
1286
|
+
}
|
|
1287
|
+
|
|
1288
|
+
var totalSamples = SDL.audio.samples*SDL.audio.channels;
|
|
1289
|
+
SDL.audio.bufferSize = totalSamples*2; // hardcoded 16-bit audio
|
|
1290
|
+
SDL.audio.buffer = _malloc(SDL.audio.bufferSize);
|
|
1291
|
+
SDL.audio.caller = function() {
|
|
1292
|
+
Runtime.dynCall('viii', SDL.audio.callback, [SDL.audio.userdata, SDL.audio.buffer, SDL.audio.bufferSize]);
|
|
1293
|
+
SDL.audio.pushAudio(SDL.audio.buffer, SDL.audio.bufferSize);
|
|
1294
|
+
};
|
|
1295
|
+
// Mozilla Audio API. TODO: Other audio APIs
|
|
1296
|
+
try {
|
|
1297
|
+
SDL.audio.mozOutput = new Audio();
|
|
1298
|
+
SDL.audio.mozOutput['mozSetup'](SDL.audio.channels, SDL.audio.freq); // use string attributes on mozOutput for closure compiler
|
|
1299
|
+
SDL.audio.mozBuffer = new Float32Array(totalSamples);
|
|
1300
|
+
SDL.audio.pushAudio = function(ptr, size) {
|
|
1301
|
+
var mozBuffer = SDL.audio.mozBuffer;
|
|
1302
|
+
for (var i = 0; i < totalSamples; i++) {
|
|
1303
|
+
mozBuffer[i] = ({{{ makeGetValue('ptr', 'i*2', 'i16', 0, 0) }}}) / 0x8000; // hardcoded 16-bit audio, signed (TODO: reSign if not ta2?)
|
|
1304
|
+
}
|
|
1305
|
+
SDL.audio.mozOutput['mozWriteAudio'](mozBuffer);
|
|
1306
|
+
}
|
|
1307
|
+
} catch(e) {
|
|
1308
|
+
SDL.audio = null;
|
|
1309
|
+
}
|
|
1310
|
+
if (!SDL.audio) return -1;
|
|
1311
|
+
return 0;
|
|
1312
|
+
},
|
|
1313
|
+
|
|
1314
|
+
SDL_PauseAudio: function(pauseOn) {
|
|
1315
|
+
if (SDL.audio.paused !== pauseOn) {
|
|
1316
|
+
SDL.audio.timer = pauseOn ? SDL.audio.timer && clearInterval(SDL.audio.timer) : Browser.safeSetInterval(SDL.audio.caller, 1/35);
|
|
1317
|
+
}
|
|
1318
|
+
SDL.audio.paused = pauseOn;
|
|
1319
|
+
},
|
|
1320
|
+
|
|
1321
|
+
SDL_CloseAudio__deps: ['SDL_PauseAudio', 'free'],
|
|
1322
|
+
SDL_CloseAudio: function() {
|
|
1323
|
+
if (SDL.audio) {
|
|
1324
|
+
_SDL_PauseAudio(1);
|
|
1325
|
+
_free(SDL.audio.buffer);
|
|
1326
|
+
SDL.audio = null;
|
|
1327
|
+
}
|
|
1328
|
+
},
|
|
1329
|
+
|
|
1330
|
+
SDL_LockAudio: function() {},
|
|
1331
|
+
SDL_UnlockAudio: function() {},
|
|
1332
|
+
|
|
1333
|
+
SDL_CreateMutex: function() { return 0 },
|
|
1334
|
+
SDL_LockMutex: function() {},
|
|
1335
|
+
SDL_UnlockMutex: function() {},
|
|
1336
|
+
SDL_mutexP: function() { return 0 },
|
|
1337
|
+
SDL_mutexV: function() { return 0 },
|
|
1338
|
+
SDL_DestroyMutex: function() {},
|
|
1339
|
+
|
|
1340
|
+
SDL_CreateCond: function() { return 0 },
|
|
1341
|
+
SDL_CondSignal: function() {},
|
|
1342
|
+
SDL_CondWait: function() {},
|
|
1343
|
+
SDL_DestroyCond: function() {},
|
|
1344
|
+
|
|
1345
|
+
SDL_StartTextInput: function() {
|
|
1346
|
+
SDL.textInput = true;
|
|
1347
|
+
},
|
|
1348
|
+
SDL_StopTextInput: function() {
|
|
1349
|
+
SDL.textInput = false;
|
|
1350
|
+
},
|
|
1351
|
+
|
|
1352
|
+
// SDL Mixer
|
|
1353
|
+
|
|
1354
|
+
Mix_Init: function(flags) {
|
|
1355
|
+
if (!flags) return 0;
|
|
1356
|
+
return 8; /* MIX_INIT_OGG */
|
|
1357
|
+
},
|
|
1358
|
+
Mix_Quit: function(){},
|
|
1359
|
+
|
|
1360
|
+
Mix_OpenAudio: function(frequency, format, channels, chunksize) {
|
|
1361
|
+
SDL.allocateChannels(32);
|
|
1362
|
+
// Just record the values for a later call to Mix_QuickLoad_RAW
|
|
1363
|
+
SDL.mixerFrequency = frequency;
|
|
1364
|
+
SDL.mixerFormat = format;
|
|
1365
|
+
SDL.mixerNumChannels = channels;
|
|
1366
|
+
SDL.mixerChunkSize = chunksize;
|
|
1367
|
+
return 0;
|
|
1368
|
+
},
|
|
1369
|
+
|
|
1370
|
+
Mix_CloseAudio: 'SDL_CloseAudio',
|
|
1371
|
+
|
|
1372
|
+
Mix_AllocateChannels: function(num) {
|
|
1373
|
+
SDL.allocateChannels(num);
|
|
1374
|
+
return num;
|
|
1375
|
+
},
|
|
1376
|
+
|
|
1377
|
+
Mix_ChannelFinished: function(func) {
|
|
1378
|
+
SDL.channelFinished = func;
|
|
1379
|
+
},
|
|
1380
|
+
|
|
1381
|
+
Mix_Volume: function(channel, volume) {
|
|
1382
|
+
if (channel == -1) {
|
|
1383
|
+
for (var i = 0; i < SDL.numChannels-1; i++) {
|
|
1384
|
+
_Mix_Volume(i, volume);
|
|
1385
|
+
}
|
|
1386
|
+
return _Mix_Volume(SDL.numChannels-1, volume);
|
|
1387
|
+
}
|
|
1388
|
+
return SDL.setGetVolume(SDL.channels[channel], volume);
|
|
1389
|
+
},
|
|
1390
|
+
|
|
1391
|
+
Mix_SetPanning: function() {
|
|
1392
|
+
return 0; // error
|
|
1393
|
+
},
|
|
1394
|
+
|
|
1395
|
+
Mix_LoadWAV_RW: function(filename, freesrc) {
|
|
1396
|
+
filename = FS.standardizePath(Pointer_stringify(filename));
|
|
1397
|
+
var raw = Module["preloadedAudios"][filename];
|
|
1398
|
+
if (!raw) {
|
|
1399
|
+
if (raw === null) Module.printErr('Trying to reuse preloaded audio, but freePreloadedMediaOnUse is set!');
|
|
1400
|
+
Runtime.warnOnce('Cannot find preloaded audio ' + filename);
|
|
1401
|
+
return 0;
|
|
1402
|
+
}
|
|
1403
|
+
if (Module['freePreloadedMediaOnUse']) {
|
|
1404
|
+
Module["preloadedAudios"][filename] = null;
|
|
1405
|
+
}
|
|
1406
|
+
var id = SDL.audios.length;
|
|
1407
|
+
// Keep the loaded audio in the audio arrays, ready for playback
|
|
1408
|
+
SDL.audios.push({
|
|
1409
|
+
source: filename,
|
|
1410
|
+
audio: raw
|
|
1411
|
+
});
|
|
1412
|
+
return id;
|
|
1413
|
+
},
|
|
1414
|
+
|
|
1415
|
+
Mix_QuickLoad_RAW: function(mem, len) {
|
|
1416
|
+
var audio = new Audio();
|
|
1417
|
+
// Record the number of channels and frequency for later usage
|
|
1418
|
+
audio.numChannels = SDL.mixerNumChannels;
|
|
1419
|
+
audio.frequency = SDL.mixerFrequency;
|
|
1420
|
+
var numSamples = len >> 1; // len is the length in bytes, and the array contains 16-bit PCM values
|
|
1421
|
+
var buffer = new Float32Array(numSamples);
|
|
1422
|
+
for (var i = 0; i < numSamples; ++i) {
|
|
1423
|
+
buffer[i] = ({{{ makeGetValue('mem', 'i*2', 'i16', 0, 0) }}}) / 0x8000; // hardcoded 16-bit audio, signed (TODO: reSign if not ta2?)
|
|
1424
|
+
}
|
|
1425
|
+
// FIXME: doesn't make sense to keep the audio element in the buffer
|
|
1426
|
+
var id = SDL.audios.length;
|
|
1427
|
+
SDL.audios.push({
|
|
1428
|
+
source: '',
|
|
1429
|
+
audio: audio,
|
|
1430
|
+
buffer: buffer
|
|
1431
|
+
});
|
|
1432
|
+
return id;
|
|
1433
|
+
},
|
|
1434
|
+
|
|
1435
|
+
Mix_FreeChunk: function(id) {
|
|
1436
|
+
SDL.audios[id] = null;
|
|
1437
|
+
},
|
|
1438
|
+
Mix_ReserveChannels: function(num) {
|
|
1439
|
+
SDL.channelMinimumNumber = num;
|
|
1440
|
+
},
|
|
1441
|
+
Mix_PlayChannel: function(channel, id, loops) {
|
|
1442
|
+
// TODO: handle loops
|
|
1443
|
+
|
|
1444
|
+
// Get the audio element associated with the ID
|
|
1445
|
+
var info = SDL.audios[id];
|
|
1446
|
+
if (!info) return -1;
|
|
1447
|
+
var audio = info.audio;
|
|
1448
|
+
if (!audio) return -1;
|
|
1449
|
+
|
|
1450
|
+
// If the user asks us to allocate a channel automatically, get the first
|
|
1451
|
+
// free one.
|
|
1452
|
+
if (channel == -1) {
|
|
1453
|
+
for (var i = SDL.channelMinimumNumber; i < SDL.numChannels; i++) {
|
|
1454
|
+
if (!SDL.channels[i].audio) {
|
|
1455
|
+
channel = i;
|
|
1456
|
+
break;
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
if (channel == -1) {
|
|
1460
|
+
Module.printErr('All ' + SDL.numChannels + ' channels in use!');
|
|
1461
|
+
return -1;
|
|
1462
|
+
}
|
|
1463
|
+
}
|
|
1464
|
+
// We clone the audio node to utilize the preloaded audio buffer, since
|
|
1465
|
+
// the browser has already preloaded the audio file.
|
|
1466
|
+
var channelInfo = SDL.channels[channel];
|
|
1467
|
+
channelInfo.audio = audio = audio.cloneNode(true);
|
|
1468
|
+
audio.numChannels = info.audio.numChannels;
|
|
1469
|
+
audio.frequency = info.audio.frequency;
|
|
1470
|
+
// TODO: handle N loops. Behavior matches Mix_PlayMusic
|
|
1471
|
+
audio.loop = loops != 0;
|
|
1472
|
+
audio['onended'] = function() { // TODO: cache these
|
|
1473
|
+
channelInfo.audio = null;
|
|
1474
|
+
if (SDL.channelFinished) {
|
|
1475
|
+
Runtime.getFuncWrapper(SDL.channelFinished, 'vi')(channel);
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
// Either play the element, or load the dynamic data into it
|
|
1479
|
+
if (info.buffer) {
|
|
1480
|
+
var contextCtor = null;
|
|
1481
|
+
if (audio && ('mozSetup' in audio)) { // Audio Data API
|
|
1482
|
+
try {
|
|
1483
|
+
audio['mozSetup'](audio.numChannels, audio.frequency);
|
|
1484
|
+
audio["mozWriteAudio"](info.buffer);
|
|
1485
|
+
} catch (e) {
|
|
1486
|
+
// Workaround for Firefox bug 783052
|
|
1487
|
+
// ignore this exception!
|
|
1488
|
+
}
|
|
1489
|
+
/*
|
|
1490
|
+
} else if (contextCtor = (window.AudioContext || // WebAudio API
|
|
1491
|
+
window.webkitAudioContext)) {
|
|
1492
|
+
var currentIndex = 0;
|
|
1493
|
+
var numChannels = parseInt(audio.numChannels);
|
|
1494
|
+
var context = new contextCtor();
|
|
1495
|
+
var source = context.createBufferSource();
|
|
1496
|
+
source.loop = false;
|
|
1497
|
+
source.buffer = context.createBuffer(numChannels, 1, audio.frequency);
|
|
1498
|
+
var jsNode = context.createJavaScriptNode(2048, numChannels, numChannels);
|
|
1499
|
+
jsNode.onaudioprocess = function(event) {
|
|
1500
|
+
var buffers = new Array(numChannels);
|
|
1501
|
+
for (var i = 0; i < numChannels; ++i) {
|
|
1502
|
+
buffers[i] = event.outputBuffer.getChannelData(i);
|
|
1503
|
+
}
|
|
1504
|
+
var remaining = info.buffer.length - currentIndex;
|
|
1505
|
+
if (remaining > 2048) {
|
|
1506
|
+
remaining = 2048;
|
|
1507
|
+
}
|
|
1508
|
+
for (var i = 0; i < remaining;) {
|
|
1509
|
+
for (var j = 0; j < numChannels; ++j) {
|
|
1510
|
+
buffers[j][i] = info.buffer[currentIndex + i + j] * audio.volume;
|
|
1511
|
+
}
|
|
1512
|
+
i += j;
|
|
1513
|
+
}
|
|
1514
|
+
currentIndex += remaining * numChannels;
|
|
1515
|
+
for (var i = remaining; i < 2048;) {
|
|
1516
|
+
for (var j = 0; j < numChannels; ++j) {
|
|
1517
|
+
buffers[j][i] = 0; // silence
|
|
1518
|
+
}
|
|
1519
|
+
i += j;
|
|
1520
|
+
}
|
|
1521
|
+
};
|
|
1522
|
+
source.connect(jsNode);
|
|
1523
|
+
jsNode.connect(context.destination);
|
|
1524
|
+
source.noteOn(0);
|
|
1525
|
+
*/
|
|
1526
|
+
}
|
|
1527
|
+
} else {
|
|
1528
|
+
audio.play();
|
|
1529
|
+
}
|
|
1530
|
+
audio.volume = channelInfo.volume;
|
|
1531
|
+
return channel;
|
|
1532
|
+
},
|
|
1533
|
+
Mix_PlayChannelTimed: 'Mix_PlayChannel', // XXX ignore Timing
|
|
1534
|
+
|
|
1535
|
+
Mix_FadingChannel: function(channel) {
|
|
1536
|
+
return 0; // MIX_NO_FADING, TODO
|
|
1537
|
+
},
|
|
1538
|
+
|
|
1539
|
+
Mix_HaltChannel: function(channel) {
|
|
1540
|
+
function halt(channel) {
|
|
1541
|
+
var info = SDL.channels[channel];
|
|
1542
|
+
if (info.audio) {
|
|
1543
|
+
info.audio.pause();
|
|
1544
|
+
info.audio = null;
|
|
1545
|
+
}
|
|
1546
|
+
if (SDL.channelFinished) {
|
|
1547
|
+
Runtime.getFuncWrapper(SDL.channelFinished, 'vi')(channel);
|
|
1548
|
+
}
|
|
1549
|
+
}
|
|
1550
|
+
if (channel != -1) {
|
|
1551
|
+
halt(channel);
|
|
1552
|
+
} else {
|
|
1553
|
+
for (var i = 0; i < SDL.channels.length; ++i) halt(i);
|
|
1554
|
+
}
|
|
1555
|
+
return 0;
|
|
1556
|
+
},
|
|
1557
|
+
|
|
1558
|
+
Mix_HookMusicFinished__deps: ['Mix_HaltMusic'],
|
|
1559
|
+
Mix_HookMusicFinished: function(func) {
|
|
1560
|
+
SDL.hookMusicFinished = func;
|
|
1561
|
+
if (SDL.music.audio) { // ensure the callback will be called, if a music is already playing
|
|
1562
|
+
SDL.music.audio['onended'] = _Mix_HaltMusic;
|
|
1563
|
+
}
|
|
1564
|
+
},
|
|
1565
|
+
|
|
1566
|
+
Mix_VolumeMusic: function(volume) {
|
|
1567
|
+
return SDL.setGetVolume(SDL.music, volume);
|
|
1568
|
+
},
|
|
1569
|
+
|
|
1570
|
+
Mix_LoadMUS: 'Mix_LoadWAV_RW',
|
|
1571
|
+
Mix_LoadMUS_RW: 'Mix_LoadWAV_RW',
|
|
1572
|
+
|
|
1573
|
+
Mix_FreeMusic: 'Mix_FreeChunk',
|
|
1574
|
+
|
|
1575
|
+
Mix_PlayMusic__deps: ['Mix_HaltMusic'],
|
|
1576
|
+
Mix_PlayMusic: function(id, loops) {
|
|
1577
|
+
loops = Math.max(loops, 1);
|
|
1578
|
+
var audio = SDL.audios[id].audio;
|
|
1579
|
+
if (!audio) return 0;
|
|
1580
|
+
audio.loop = loops != 0; // TODO: handle N loops for finite N
|
|
1581
|
+
if (SDL.audios[id].buffer) {
|
|
1582
|
+
audio["mozWriteAudio"](SDL.audios[id].buffer);
|
|
1583
|
+
} else {
|
|
1584
|
+
audio.play();
|
|
1585
|
+
}
|
|
1586
|
+
audio.volume = SDL.music.volume;
|
|
1587
|
+
audio['onended'] = _Mix_HaltMusic; // will send callback
|
|
1588
|
+
if (SDL.music.audio) {
|
|
1589
|
+
if (!SDL.music.audio.paused) {
|
|
1590
|
+
Module.printErr('Music is already playing. ' + SDL.music.source);
|
|
1591
|
+
}
|
|
1592
|
+
SDL.music.audio.pause();
|
|
1593
|
+
}
|
|
1594
|
+
SDL.music.audio = audio;
|
|
1595
|
+
return 0;
|
|
1596
|
+
},
|
|
1597
|
+
|
|
1598
|
+
Mix_PauseMusic: function() {
|
|
1599
|
+
var audio = SDL.music.audio;
|
|
1600
|
+
if (!audio) return 0;
|
|
1601
|
+
audio.pause();
|
|
1602
|
+
return 0;
|
|
1603
|
+
},
|
|
1604
|
+
|
|
1605
|
+
Mix_ResumeMusic: function() {
|
|
1606
|
+
var audio = SDL.music.audio;
|
|
1607
|
+
if (!audio) return 0;
|
|
1608
|
+
audio.play();
|
|
1609
|
+
return 0;
|
|
1610
|
+
},
|
|
1611
|
+
|
|
1612
|
+
Mix_HaltMusic: function() {
|
|
1613
|
+
var audio = SDL.music.audio;
|
|
1614
|
+
if (!audio) return 0;
|
|
1615
|
+
audio.src = audio.src; // rewind
|
|
1616
|
+
audio.pause();
|
|
1617
|
+
SDL.music.audio = null;
|
|
1618
|
+
if (SDL.hookMusicFinished) {
|
|
1619
|
+
Runtime.dynCall('v', SDL.hookMusicFinished);
|
|
1620
|
+
}
|
|
1621
|
+
return 0;
|
|
1622
|
+
},
|
|
1623
|
+
|
|
1624
|
+
Mix_FadeInMusicPos: 'Mix_PlayMusic', // XXX ignore fading in effect
|
|
1625
|
+
|
|
1626
|
+
Mix_FadeOutMusic: 'Mix_HaltMusic', // XXX ignore fading out effect
|
|
1627
|
+
|
|
1628
|
+
Mix_PlayingMusic: function() {
|
|
1629
|
+
return (SDL.music.audio && !SDL.music.audio.paused) ? 1 : 0;
|
|
1630
|
+
},
|
|
1631
|
+
|
|
1632
|
+
// http://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer_38.html#SEC38
|
|
1633
|
+
// "Note: Does not check if the channel has been paused."
|
|
1634
|
+
Mix_Playing: function(channel) {
|
|
1635
|
+
if (channel === -1) {
|
|
1636
|
+
var count = 0;
|
|
1637
|
+
for (var i = 0; i < SDL.channels.length; i++) {
|
|
1638
|
+
count += _Mix_Playing(i);
|
|
1639
|
+
}
|
|
1640
|
+
return count;
|
|
1641
|
+
}
|
|
1642
|
+
var info = SDL.channels[channel];
|
|
1643
|
+
if (info && info.audio && !info.audio.paused) {
|
|
1644
|
+
return 1;
|
|
1645
|
+
}
|
|
1646
|
+
return 0;
|
|
1647
|
+
},
|
|
1648
|
+
|
|
1649
|
+
Mix_Pause: function(channel) {
|
|
1650
|
+
if (channel === -1) {
|
|
1651
|
+
for (var i = 0; i<SDL.channels.length;i++) {
|
|
1652
|
+
_Mix_Pause(i);
|
|
1653
|
+
}
|
|
1654
|
+
return;
|
|
1655
|
+
}
|
|
1656
|
+
var info = SDL.channels[channel];
|
|
1657
|
+
if (info && info.audio) {
|
|
1658
|
+
info.audio.pause();
|
|
1659
|
+
} else {
|
|
1660
|
+
Module.printErr('Mix_Pause: no sound found for channel: ' + channel);
|
|
1661
|
+
}
|
|
1662
|
+
},
|
|
1663
|
+
|
|
1664
|
+
// http://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer_39.html#SEC39
|
|
1665
|
+
Mix_Paused: function(channel) {
|
|
1666
|
+
if (channel === -1) {
|
|
1667
|
+
var pausedCount = 0;
|
|
1668
|
+
for (var i = 0; i<SDL.channels.length;i++) {
|
|
1669
|
+
pausedCount += _Mix_Paused(i);
|
|
1670
|
+
}
|
|
1671
|
+
return pausedCount;
|
|
1672
|
+
}
|
|
1673
|
+
var info = SDL.channels[channel];
|
|
1674
|
+
if (info && info.audio && info.audio.paused) {
|
|
1675
|
+
return 1;
|
|
1676
|
+
}
|
|
1677
|
+
return 0;
|
|
1678
|
+
},
|
|
1679
|
+
|
|
1680
|
+
Mix_PausedMusic: function() {
|
|
1681
|
+
return (SDL.music.audio && SDL.music.audio.paused) ? 1 : 0;
|
|
1682
|
+
},
|
|
1683
|
+
|
|
1684
|
+
// http://www.libsdl.org/projects/SDL_mixer/docs/SDL_mixer_33.html#SEC33
|
|
1685
|
+
Mix_Resume: function(channel) {
|
|
1686
|
+
if (channel === -1) {
|
|
1687
|
+
for (var i = 0; i<SDL.channels.length;i++) {
|
|
1688
|
+
_Mix_Resume(i);
|
|
1689
|
+
}
|
|
1690
|
+
return;
|
|
1691
|
+
}
|
|
1692
|
+
var info = SDL.channels[channel];
|
|
1693
|
+
if (info && info.audio) {
|
|
1694
|
+
info.audio.play();
|
|
1695
|
+
}
|
|
1696
|
+
},
|
|
1697
|
+
|
|
1698
|
+
// SDL TTF
|
|
1699
|
+
|
|
1700
|
+
TTF_Init: function() {
|
|
1701
|
+
var canvas = document.createElement('canvas');
|
|
1702
|
+
SDL.ttfContext = canvas.getContext('2d');
|
|
1703
|
+
return 0;
|
|
1704
|
+
},
|
|
1705
|
+
|
|
1706
|
+
TTF_OpenFont: function(filename, size) {
|
|
1707
|
+
filename = FS.standardizePath(Pointer_stringify(filename));
|
|
1708
|
+
var id = SDL.fonts.length;
|
|
1709
|
+
SDL.fonts.push({
|
|
1710
|
+
name: filename, // but we don't actually do anything with it..
|
|
1711
|
+
size: size
|
|
1712
|
+
});
|
|
1713
|
+
return id;
|
|
1714
|
+
},
|
|
1715
|
+
|
|
1716
|
+
TTF_CloseFont: function(font) {
|
|
1717
|
+
SDL.fonts[font] = null;
|
|
1718
|
+
},
|
|
1719
|
+
|
|
1720
|
+
TTF_RenderText_Solid: function(font, text, color) {
|
|
1721
|
+
// XXX the font and color are ignored
|
|
1722
|
+
text = Pointer_stringify(text) || ' '; // if given an empty string, still return a valid surface
|
|
1723
|
+
var fontData = SDL.fonts[font];
|
|
1724
|
+
var w = SDL.estimateTextWidth(fontData, text);
|
|
1725
|
+
var h = fontData.size;
|
|
1726
|
+
var color = SDL.loadColorToCSSRGB(color); // XXX alpha breaks fonts?
|
|
1727
|
+
var fontString = h + 'px ' + fontData.name;
|
|
1728
|
+
var surf = SDL.makeSurface(w, h, 0, false, 'text:' + text); // bogus numbers..
|
|
1729
|
+
var surfData = SDL.surfaces[surf];
|
|
1730
|
+
surfData.ctx.save();
|
|
1731
|
+
surfData.ctx.fillStyle = color;
|
|
1732
|
+
surfData.ctx.font = fontString;
|
|
1733
|
+
surfData.ctx.textBaseline = 'top';
|
|
1734
|
+
surfData.ctx.fillText(text, 0, 0);
|
|
1735
|
+
surfData.ctx.restore();
|
|
1736
|
+
return surf;
|
|
1737
|
+
},
|
|
1738
|
+
TTF_RenderText_Blended: 'TTF_RenderText_Solid', // XXX ignore blending vs. solid
|
|
1739
|
+
TTF_RenderText_Shaded: 'TTF_RenderText_Solid', // XXX ignore blending vs. solid
|
|
1740
|
+
TTF_RenderUTF8_Solid: 'TTF_RenderText_Solid',
|
|
1741
|
+
|
|
1742
|
+
TTF_SizeText: function(font, text, w, h) {
|
|
1743
|
+
var fontData = SDL.fonts[font];
|
|
1744
|
+
if (w) {
|
|
1745
|
+
{{{ makeSetValue('w', '0', 'SDL.estimateTextWidth(fontData, Pointer_stringify(text))', 'i32') }}};
|
|
1746
|
+
}
|
|
1747
|
+
if (h) {
|
|
1748
|
+
{{{ makeSetValue('h', '0', 'fontData.size', 'i32') }}};
|
|
1749
|
+
}
|
|
1750
|
+
return 0;
|
|
1751
|
+
},
|
|
1752
|
+
|
|
1753
|
+
TTF_FontAscent: function(font) {
|
|
1754
|
+
var fontData = SDL.fonts[font];
|
|
1755
|
+
return Math.floor(fontData.size*0.98); // XXX
|
|
1756
|
+
},
|
|
1757
|
+
|
|
1758
|
+
TTF_FontDescent: function(font) {
|
|
1759
|
+
var fontData = SDL.fonts[font];
|
|
1760
|
+
return Math.floor(fontData.size*0.02); // XXX
|
|
1761
|
+
},
|
|
1762
|
+
|
|
1763
|
+
// SDL gfx
|
|
1764
|
+
|
|
1765
|
+
$SDL_gfx: {
|
|
1766
|
+
drawRectangle: function(surf, x1, y1, x2, y2, action, cssColor) {
|
|
1767
|
+
x1 = x1 << 16 >> 16;
|
|
1768
|
+
y1 = y1 << 16 >> 16;
|
|
1769
|
+
x2 = x2 << 16 >> 16;
|
|
1770
|
+
y2 = y2 << 16 >> 16;
|
|
1771
|
+
var surfData = SDL.surfaces[surf];
|
|
1772
|
+
assert(!surfData.locked); // but we could unlock and re-lock if we must..
|
|
1773
|
+
// TODO: if ctx does not change, leave as is, and also do not re-set xStyle etc.
|
|
1774
|
+
var x = x1 < x2 ? x1 : x2;
|
|
1775
|
+
var y = y1 < y2 ? y1 : y2;
|
|
1776
|
+
var w = Math.abs(x2 - x1);
|
|
1777
|
+
var h = Math.abs(y2 - y1);
|
|
1778
|
+
surfData.ctx.save();
|
|
1779
|
+
surfData.ctx[action + 'Style'] = cssColor;
|
|
1780
|
+
surfData.ctx[action + 'Rect'](x, y, w, h);
|
|
1781
|
+
surfData.ctx.restore();
|
|
1782
|
+
},
|
|
1783
|
+
drawLine: function(surf, x1, y1, x2, y2, cssColor) {
|
|
1784
|
+
x1 = x1 << 16 >> 16;
|
|
1785
|
+
y1 = y1 << 16 >> 16;
|
|
1786
|
+
x2 = x2 << 16 >> 16;
|
|
1787
|
+
y2 = y2 << 16 >> 16;
|
|
1788
|
+
var surfData = SDL.surfaces[surf];
|
|
1789
|
+
assert(!surfData.locked); // but we could unlock and re-lock if we must..
|
|
1790
|
+
surfData.ctx.save();
|
|
1791
|
+
surfData.ctx.strokeStyle = cssColor;
|
|
1792
|
+
surfData.ctx.beginPath();
|
|
1793
|
+
surfData.ctx.moveTo(x1, y1);
|
|
1794
|
+
surfData.ctx.lineTo(x2, y2);
|
|
1795
|
+
surfData.ctx.stroke();
|
|
1796
|
+
surfData.ctx.restore();
|
|
1797
|
+
},
|
|
1798
|
+
// See http://stackoverflow.com/questions/2172798/how-to-draw-an-oval-in-html5-canvas
|
|
1799
|
+
drawEllipse: function(surf, x, y, rx, ry, action, cssColor) {
|
|
1800
|
+
x = x << 16 >> 16;
|
|
1801
|
+
y = y << 16 >> 16;
|
|
1802
|
+
rx = rx << 16 >> 16;
|
|
1803
|
+
ry = ry << 16 >> 16;
|
|
1804
|
+
var surfData = SDL.surfaces[surf];
|
|
1805
|
+
assert(!surfData.locked); // but we could unlock and re-lock if we must..
|
|
1806
|
+
|
|
1807
|
+
surfData.ctx.save();
|
|
1808
|
+
surfData.ctx.beginPath();
|
|
1809
|
+
surfData.ctx.translate(x, y);
|
|
1810
|
+
surfData.ctx.scale(rx, ry);
|
|
1811
|
+
surfData.ctx.arc(0, 0, 1, 0, 2 * Math.PI);
|
|
1812
|
+
surfData.ctx.restore();
|
|
1813
|
+
|
|
1814
|
+
surfData.ctx.save();
|
|
1815
|
+
surfData.ctx[action + 'Style'] = cssColor;
|
|
1816
|
+
surfData.ctx[action]();
|
|
1817
|
+
surfData.ctx.restore();
|
|
1818
|
+
},
|
|
1819
|
+
// the gfx library uses something different from the rest of SDL...
|
|
1820
|
+
translateColorToCSSRGBA: function(rgba) {
|
|
1821
|
+
return 'rgba(' + (rgba>>>24) + ',' + (rgba>>16 & 0xff) + ',' + (rgba>>8 & 0xff) + ',' + (rgba&0xff) + ')';
|
|
1822
|
+
}
|
|
1823
|
+
},
|
|
1824
|
+
|
|
1825
|
+
boxColor__deps: ['$SDL_gfx'],
|
|
1826
|
+
boxColor: function(surf, x1, y1, x2, y2, color) {
|
|
1827
|
+
return SDL_gfx.drawRectangle(surf, x1, y1, x2, y2, 'fill', SDL_gfx.translateColorToCSSRGBA(color));
|
|
1828
|
+
},
|
|
1829
|
+
|
|
1830
|
+
boxRGBA__deps: ['$SDL_gfx'],
|
|
1831
|
+
boxRGBA: function(surf, x1, y1, x2, y2, r, g, b, a) {
|
|
1832
|
+
return SDL_gfx.drawRectangle(surf, x1, y1, x2, y2, 'fill', SDL.translateRGBAToCSSRGBA(r, g, b, a));
|
|
1833
|
+
},
|
|
1834
|
+
|
|
1835
|
+
rectangleColor__deps: ['$SDL_gfx'],
|
|
1836
|
+
rectangleColor: function(surf, x1, y1, x2, y2, color) {
|
|
1837
|
+
return SDL_gfx.drawRectangle(surf, x1, y1, x2, y2, 'stroke', SDL_gfx.translateColorToCSSRGBA(color));
|
|
1838
|
+
},
|
|
1839
|
+
|
|
1840
|
+
rectangleRGBA__deps: ['$SDL_gfx'],
|
|
1841
|
+
rectangleRGBA: function(surf, x1, y1, x2, y2, r, g, b, a) {
|
|
1842
|
+
return SDL_gfx.drawRectangle(surf, x1, y1, x2, y2, 'stroke', SDL.translateRGBAToCSSRGBA(r, g, b, a));
|
|
1843
|
+
},
|
|
1844
|
+
|
|
1845
|
+
ellipseColor__deps: ['$SDL_gfx'],
|
|
1846
|
+
ellipseColor: function(surf, x, y, rx, ry, color) {
|
|
1847
|
+
return SDL_gfx.drawEllipse(surf, x, y, rx, ry, 'stroke', SDL_gfx.translateColorToCSSRGBA(color));
|
|
1848
|
+
},
|
|
1849
|
+
|
|
1850
|
+
ellipseRGBA__deps: ['$SDL_gfx'],
|
|
1851
|
+
ellipseRGBA: function(surf, x, y, rx, ry, r, g, b, a) {
|
|
1852
|
+
return SDL_gfx.drawEllipse(surf, x, y, rx, ry, 'stroke', SDL.translateRGBAToCSSRGBA(r, g, b, a));
|
|
1853
|
+
},
|
|
1854
|
+
|
|
1855
|
+
filledEllipseColor__deps: ['$SDL_gfx'],
|
|
1856
|
+
filledEllipseColor: function(surf, x, y, rx, ry, color) {
|
|
1857
|
+
return SDL_gfx.drawEllipse(surf, x, y, rx, ry, 'fill', SDL_gfx.translateColorToCSSRGBA(color));
|
|
1858
|
+
},
|
|
1859
|
+
|
|
1860
|
+
filledEllipseRGBA__deps: ['$SDL_gfx'],
|
|
1861
|
+
filledEllipseRGBA: function(surf, x, y, rx, ry, r, g, b, a) {
|
|
1862
|
+
return SDL_gfx.drawEllipse(surf, x, y, rx, ry, 'fill', SDL.translateRGBAToCSSRGBA(r, g, b, a));
|
|
1863
|
+
},
|
|
1864
|
+
|
|
1865
|
+
lineColor__deps: ['$SDL_gfx'],
|
|
1866
|
+
lineColor: function(surf, x1, y1, x2, y2, color) {
|
|
1867
|
+
return SDL_gfx.drawLine(surf, x1, y1, x2, y2, SDL_gfx.translateColorToCSSRGBA(color));
|
|
1868
|
+
},
|
|
1869
|
+
|
|
1870
|
+
lineRGBA__deps: ['$SDL_gfx'],
|
|
1871
|
+
lineRGBA: function(surf, x1, y1, x2, y2, r, g, b, a) {
|
|
1872
|
+
return SDL_gfx.drawLine(surf, x1, y1, x2, y2, SDL.translateRGBAToCSSRGBA(r, g, b, a));
|
|
1873
|
+
},
|
|
1874
|
+
|
|
1875
|
+
pixelRGBA__deps: ['boxRGBA'],
|
|
1876
|
+
pixelRGBA: function(surf, x1, y1, r, g, b, a) {
|
|
1877
|
+
// This cannot be fast, to render many pixels this way!
|
|
1878
|
+
_boxRGBA(surf, x1, y1, x1, y1, r, g, b, a);
|
|
1879
|
+
},
|
|
1880
|
+
|
|
1881
|
+
// GL
|
|
1882
|
+
|
|
1883
|
+
SDL_GL_SetAttribute: function(attr, value) {
|
|
1884
|
+
console.log('TODO: SDL_GL_SetAttribute');
|
|
1885
|
+
},
|
|
1886
|
+
|
|
1887
|
+
SDL_GL_GetProcAddress__deps: ['$GLEmulation'],
|
|
1888
|
+
SDL_GL_GetProcAddress: function(name_) {
|
|
1889
|
+
return GLEmulation.getProcAddress(Pointer_stringify(name_));
|
|
1890
|
+
},
|
|
1891
|
+
|
|
1892
|
+
SDL_GL_SwapBuffers: function() {},
|
|
1893
|
+
|
|
1894
|
+
// SDL 2
|
|
1895
|
+
|
|
1896
|
+
SDL_GL_ExtensionSupported: function(extension) {
|
|
1897
|
+
return Module.ctx.getExtension(extension) | 0;
|
|
1898
|
+
},
|
|
1899
|
+
|
|
1900
|
+
SDL_DestroyWindow: function(window) {},
|
|
1901
|
+
|
|
1902
|
+
SDL_DestroyRenderer: function(renderer) {},
|
|
1903
|
+
|
|
1904
|
+
SDL_GetWindowFlags: function(x, y) {
|
|
1905
|
+
if (Browser.isFullScreen) {
|
|
1906
|
+
return 1;
|
|
1907
|
+
}
|
|
1908
|
+
|
|
1909
|
+
return 0;
|
|
1910
|
+
},
|
|
1911
|
+
|
|
1912
|
+
SDL_GL_SwapWindow: function(window) {},
|
|
1913
|
+
|
|
1914
|
+
SDL_GL_MakeCurrent: function(window, context) {},
|
|
1915
|
+
|
|
1916
|
+
SDL_GL_DeleteContext: function(context) {},
|
|
1917
|
+
|
|
1918
|
+
SDL_GL_SetSwapInterval: function(state) {},
|
|
1919
|
+
|
|
1920
|
+
SDL_SetWindowTitle: function(window, title) {
|
|
1921
|
+
if (title) document.title = Pointer_stringify(title);
|
|
1922
|
+
},
|
|
1923
|
+
|
|
1924
|
+
SDL_GetWindowSize: function(window, width, height){
|
|
1925
|
+
var w = Module['canvas'].width;
|
|
1926
|
+
var h = Module['canvas'].height;
|
|
1927
|
+
if (width) {{{ makeSetValue('width', '0', 'w', 'i32') }}};
|
|
1928
|
+
if (height) {{{ makeSetValue('height', '0', 'h', 'i32') }}};
|
|
1929
|
+
},
|
|
1930
|
+
|
|
1931
|
+
SDL_LogSetOutputFunction: function(callback, userdata) {},
|
|
1932
|
+
|
|
1933
|
+
SDL_SetWindowFullscreen: function(window, fullscreen) {
|
|
1934
|
+
if (Browser.isFullScreen) {
|
|
1935
|
+
Module['canvas'].cancelFullScreen();
|
|
1936
|
+
return 1;
|
|
1937
|
+
} else {
|
|
1938
|
+
return 0;
|
|
1939
|
+
}
|
|
1940
|
+
},
|
|
1941
|
+
|
|
1942
|
+
SDL_GetWindowFlags: function() {},
|
|
1943
|
+
|
|
1944
|
+
SDL_ClearError: function() {},
|
|
1945
|
+
|
|
1946
|
+
SDL_getenv: 'getenv',
|
|
1947
|
+
|
|
1948
|
+
// TODO
|
|
1949
|
+
|
|
1950
|
+
SDL_SetGamma: function(r, g, b) {
|
|
1951
|
+
return -1;
|
|
1952
|
+
},
|
|
1953
|
+
|
|
1954
|
+
SDL_SetGammaRamp: function (redTable, greenTable, blueTable) {
|
|
1955
|
+
return -1;
|
|
1956
|
+
},
|
|
1957
|
+
|
|
1958
|
+
// Joysticks
|
|
1959
|
+
|
|
1960
|
+
SDL_NumJoysticks: function() { return 0 },
|
|
1961
|
+
|
|
1962
|
+
SDL_JoystickOpen: function(deviceIndex) { return 0 },
|
|
1963
|
+
|
|
1964
|
+
SDL_JoystickGetButton: function(joystick, button) { return 0 },
|
|
1965
|
+
|
|
1966
|
+
// Misc
|
|
1967
|
+
|
|
1968
|
+
SDL_InitSubSystem: function(flags) { return 0 },
|
|
1969
|
+
|
|
1970
|
+
SDL_RWFromFile: function(filename, mode) {
|
|
1971
|
+
return filename; // XXX We just forward the filename
|
|
1972
|
+
},
|
|
1973
|
+
|
|
1974
|
+
SDL_EnableUNICODE: function(on) {
|
|
1975
|
+
var ret = SDL.unicode || 0;
|
|
1976
|
+
SDL.unicode = on;
|
|
1977
|
+
return ret;
|
|
1978
|
+
},
|
|
1979
|
+
|
|
1980
|
+
SDL_AddTimer: function(interval, callback, param) {
|
|
1981
|
+
return window.setTimeout(function() {
|
|
1982
|
+
Runtime.dynCall('iii', callback, [interval, param]);
|
|
1983
|
+
}, interval);
|
|
1984
|
+
},
|
|
1985
|
+
SDL_RemoveTimer: function(id) {
|
|
1986
|
+
window.clearTimeout(id);
|
|
1987
|
+
return true;
|
|
1988
|
+
},
|
|
1989
|
+
|
|
1990
|
+
SDL_CreateThread: function() {
|
|
1991
|
+
throw 'SDL threads cannot be supported in the web platform because they assume shared state. See emscripten_create_worker etc. for a message-passing concurrency model that does let you run code in another thread.'
|
|
1992
|
+
},
|
|
1993
|
+
|
|
1994
|
+
SDL_WaitThread: function() { throw 'SDL_WaitThread' },
|
|
1995
|
+
SDL_GetThreadID: function() { throw 'SDL_GetThreadID' },
|
|
1996
|
+
SDL_ThreadID: function() { throw 'SDL_ThreadID' },
|
|
1997
|
+
SDL_AllocRW: function() { throw 'SDL_AllocRW: TODO' },
|
|
1998
|
+
SDL_FreeRW: function() { throw 'SDL_FreeRW: TODO' },
|
|
1999
|
+
SDL_CondBroadcast: function() { throw 'SDL_CondBroadcast: TODO' },
|
|
2000
|
+
SDL_CondWaitTimeout: function() { throw 'SDL_CondWaitTimeout: TODO' },
|
|
2001
|
+
SDL_WM_IconifyWindow: function() { throw 'SDL_WM_IconifyWindow TODO' },
|
|
2002
|
+
|
|
2003
|
+
Mix_SetPostMix: function() { throw 'Mix_SetPostMix: TODO' },
|
|
2004
|
+
Mix_QuerySpec: function() { throw 'Mix_QuerySpec: TODO' },
|
|
2005
|
+
Mix_FadeInChannelTimed: function() { throw 'Mix_FadeInChannelTimed' },
|
|
2006
|
+
Mix_FadeOutChannel: function() { throw 'Mix_FadeOutChannel' },
|
|
2007
|
+
|
|
2008
|
+
Mix_Linked_Version: function() { throw 'Mix_Linked_Version: TODO' },
|
|
2009
|
+
SDL_SaveBMP_RW: function() { throw 'SDL_SaveBMP_RW: TODO' },
|
|
2010
|
+
|
|
2011
|
+
SDL_WM_SetIcon: function() { /* This function would set the application window icon surface, which doesn't apply for web canvases, so a no-op. */ },
|
|
2012
|
+
SDL_HasRDTSC: function() { return 0; },
|
|
2013
|
+
SDL_HasMMX: function() { return 0; },
|
|
2014
|
+
SDL_HasMMXExt: function() { return 0; },
|
|
2015
|
+
SDL_Has3DNow: function() { return 0; },
|
|
2016
|
+
SDL_Has3DNowExt: function() { return 0; },
|
|
2017
|
+
SDL_HasSSE: function() { return 0; },
|
|
2018
|
+
SDL_HasSSE2: function() { return 0; },
|
|
2019
|
+
SDL_HasAltiVec: function() { return 0; }
|
|
2020
|
+
};
|
|
2021
|
+
|
|
2022
|
+
autoAddDeps(LibrarySDL, '$SDL');
|
|
2023
|
+
mergeInto(LibraryManager.library, LibrarySDL);
|
|
2024
|
+
|