|
|
@ -27,7 +27,8 @@ function preprocess(inFilename, outFilename, defines) { |
|
|
|
} |
|
|
|
} |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
var writeLine = typeof outFilename === 'function' ? outFilename : function(line) { |
|
|
|
var writeLine = typeof outFilename === 'function' ? outFilename : |
|
|
|
|
|
|
|
function(line) { |
|
|
|
out += line + '\n'; |
|
|
|
out += line + '\n'; |
|
|
|
} |
|
|
|
} |
|
|
|
function include(file) { |
|
|
|
function include(file) { |
|
|
@ -47,7 +48,8 @@ function preprocess(inFilename, outFilename, defines) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var s, state = 0, stack = []; |
|
|
|
var s, state = 0, stack = []; |
|
|
|
var control = /^(?:\/\/|<!--)\s*#(if|else|endif|expand|include)(?:\s+(.*?)(?:-->)?$)?/; |
|
|
|
var control = |
|
|
|
|
|
|
|
/^(?:\/\/|<!--)\s*#(if|else|endif|expand|include)(?:\s+(.*?)(?:-->)?$)?/; |
|
|
|
var lineNumber = 0; |
|
|
|
var lineNumber = 0; |
|
|
|
while ((s = readLine()) !== null) { |
|
|
|
while ((s = readLine()) !== null) { |
|
|
|
++lineNumber; |
|
|
|
++lineNumber; |
|
|
@ -83,7 +85,7 @@ function preprocess(inFilename, outFilename, defines) { |
|
|
|
if (state === 0) { |
|
|
|
if (state === 0) { |
|
|
|
writeLine(s); |
|
|
|
writeLine(s); |
|
|
|
} else if (state === 3) { |
|
|
|
} else if (state === 3) { |
|
|
|
writeLine(s.replace(/^\/\/|^<!--|-->/g, " ")); |
|
|
|
writeLine(s.replace(/^\/\/|^<!--|-->/g, ' ')); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -96,11 +98,11 @@ exports.preprocess = preprocess; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* Simplifies common build steps. |
|
|
|
* Simplifies common build steps. |
|
|
|
* @param setup |
|
|
|
* @param {object} setup |
|
|
|
* .defines defines for preprocessors |
|
|
|
* .defines defines for preprocessors |
|
|
|
* .copy array of arrays of source and destination pairs of files to copy |
|
|
|
* .copy array of arrays of source and destination pairs of files to copy |
|
|
|
* .preprocess array of arrays of source and destination pairs of files |
|
|
|
* .preprocess array of arrays of source and destination pairs of files |
|
|
|
* run through preprocessor |
|
|
|
* run through preprocessor. |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
function build(setup) { |
|
|
|
function build(setup) { |
|
|
|
var defines = setup.defines; |
|
|
|
var defines = setup.defines; |
|
|
|