diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/intertyper.js | 6 | ||||
-rw-r--r-- | src/library_egl.js | 9 | ||||
-rw-r--r-- | src/library_glut.js | 2 |
3 files changed, 14 insertions, 3 deletions
diff --git a/src/intertyper.js b/src/intertyper.js index abfbdacb..dd6e5522 100644 --- a/src/intertyper.js +++ b/src/intertyper.js @@ -700,6 +700,12 @@ function intertyper(data, sidePass, baseLineNums) { item.intertype = 'value'; if (tokensLeft[0].text == 'sideeffect') tokensLeft.splice(0, 1); item.ident = tokensLeft[0].text.substr(1, tokensLeft[0].text.length-2) || ';'; // use ; for empty inline assembly + var i = 0; + splitTokenList(tokensLeft[3].item.tokens).map(function(element) { + var ident = toNiceIdent(element[1].text); + var type = element[0].text; + item.ident = item.ident.replace(new RegExp('\\$' + i++, 'g'), ident); + }); return { forward: null, ret: [item], item: item }; } if (item.ident.substr(-2) == '()') { diff --git a/src/library_egl.js b/src/library_egl.js index 0ccb13e6..0e96e92f 100644 --- a/src/library_egl.js +++ b/src/library_egl.js @@ -260,8 +260,13 @@ var LibraryEGL = { } EGL.windowID = _glutCreateWindow(); - EGL.setErrorCode(0x3000 /* EGL_SUCCESS */); - return 62004; // Magic ID for Emscripten EGLContext + if (EGL.windowID != 0) { + EGL.setErrorCode(0x3000 /* EGL_SUCCESS */); + return 62004; // Magic ID for Emscripten EGLContext + } else { + EGL.setErrorCode(0x3009 /* EGL_BAD_MATCH */); // By the EGL 1.4 spec, an implementation that does not support GLES2 (WebGL in this case), this error code is set. + return 0; /* EGL_NO_CONTEXT */ + } }, eglDestroyContext__deps: ['glutDestroyWindow', '$GL'], diff --git a/src/library_glut.js b/src/library_glut.js index 36d47787..29957e6f 100644 --- a/src/library_glut.js +++ b/src/library_glut.js @@ -385,7 +385,7 @@ var LibraryGLUT = { glutCreateWindow__deps: ['$Browser'], glutCreateWindow: function(name) { Module.ctx = Browser.createContext(Module['canvas'], true, true); - return 1; + return Module.ctx ? 1 /* a new GLUT window ID for the created context */ : 0 /* failure */; }, glutDestroyWindow__deps: ['$Browser'], |