diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-01-18 10:15:28 -0800 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-01-18 10:15:28 -0800 |
commit | 514455525bf4f8e4e72ccdef7d3f88b26fbc77e5 (patch) | |
tree | fac7943f216b8d40d7a4021d53d4b6649e4dee18 | |
parent | e1fe780c97060da9d8be70a2391d19e0834879b4 (diff) |
handle #if !X in preprocessor
-rw-r--r-- | src/library_gl.js | 14 | ||||
-rw-r--r-- | src/parseTools.js | 6 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/library_gl.js b/src/library_gl.js index 781a07d9..bf4cccce 100644 --- a/src/library_gl.js +++ b/src/library_gl.js @@ -2380,7 +2380,7 @@ var LibraryGL = { // GL Immediate mode // See comment in GLEmulation.init() -#if FULL_ES2 == 0 +#if !FULL_ES2 $GLImmediate__postset: 'GLImmediate.setupFuncs(); Browser.moduleContextCreatedCallbacks.push(function() { GLImmediate.init() });', #endif $GLImmediate__deps: ['$Browser', '$GL', '$GLEmulation'], @@ -3547,13 +3547,13 @@ var LibraryGL = { } keyView.next((enabledAttributesKey << 2) | fogParam); -#if GL_FFP_ONLY == 0 +#if !GL_FFP_ONLY // By cur program: keyView.next(GL.currProgram); if (!GL.currProgram) { #endif GLImmediate.TexEnvJIT.traverseState(keyView); -#if GL_FFP_ONLY == 0 +#if !GL_FFP_ONLY } #endif @@ -3940,7 +3940,7 @@ var LibraryGL = { GLctx.enableVertexAttribArray(this.colorLocation); #endif } -#if GL_FFP_ONLY == 0 +#if !GL_FFP_ONLY else if (this.hasColor) { GLctx.disableVertexAttribArray(this.colorLocation); GLctx.vertexAttrib4fv(this.colorLocation, GLImmediate.clientColor); @@ -3955,7 +3955,7 @@ var LibraryGL = { }, cleanup: function cleanup() { -#if GL_FFP_ONLY == 0 +#if !GL_FFP_ONLY GLctx.disableVertexAttribArray(this.positionLocation); if (this.hasTextures) { for (var i = 0; i < GLImmediate.MAX_TEXTURES; i++) { @@ -4342,8 +4342,8 @@ var LibraryGL = { GLctx.bindBuffer(GLctx.ELEMENT_ARRAY_BUFFER, GL.buffers[GL.currElementArrayBuffer] || null); } -#if GL_UNSAFE_OPTS == 0 -#if GL_FFP_ONLY == 0 +#if !GL_UNSAFE_OPTS +#if !GL_FFP_ONLY renderer.cleanup(); #endif #endif diff --git a/src/parseTools.js b/src/parseTools.js index 1c70a018..e09cd2e2 100644 --- a/src/parseTools.js +++ b/src/parseTools.js @@ -46,7 +46,11 @@ function preprocess(text) { error('unsupported preprecessor op ' + op); } } else { - showStack.push(ident in this && this[ident] > 0); + if (ident[0] === '!') { + showStack.push(!(this[ident.substr(1)] > 0)); + } else { + showStack.push(ident in this && this[ident] > 0); + } } } else if (line[2] == 'n') { // include var included = read(line.substr(line.indexOf(' ')+1)); |