Extend the amount of macros emitted to account for the / N loss

This commit is contained in:
Reece Wilson 2021-10-06 20:46:37 +01:00
parent ec44036a09
commit f1a0a78d3f
2 changed files with 3624 additions and 22 deletions

File diff suppressed because one or more lines are too long

View File

@ -42,7 +42,7 @@ var textBuffer = ""
textBuffer +=
`/**
* X-Macro alternative. Defines AU_FE_N(expandable, ...args*N)
* X-Macro alternative. Defines AU_FOR_EACH_N(expandable, ...args*N)
* Autogenerated by forEach.js; do not modify"
*/
@ -52,7 +52,9 @@ textBuffer +=
forN(subn, function(subN) {
if (!subN) return
var suffix = subN != 1 ? "_" + (subN): ""
forN(n, function(i) {
var re = n * subN
forN(re, function(i) {
if (i == 0) textBuffer += `#define AU_FE_0${suffix}(prefix) \n`
else {
var X = formatNParamPattern(subN, "X")
@ -72,14 +74,14 @@ forN(subn, function(subN) {
}
})
var GET_MACRO_PARAMS = formatNParamPattern(n, "_")
var GET_MACRO_PARAMS = formatNParamPattern(re, "_")
textBuffer += `#define AU_GET_MACRO${suffix}(${GET_MACRO_PARAMS}, NAME,...) NAME\n`
var params = formatNParamPatternReverseSuffix(n, "AU_FE_", suffix)
var params = formatNParamPatternReverseSuffix(re, "AU_FE_", suffix)
var finalLine = `#define AU_FOR_EACH${suffix}(action, ...) AU_FE_EXPAND(AU_GET_MACRO${suffix}(_whydoweneedthis, __VA_ARGS__, ${params})(action,__VA_ARGS__))`
textBuffer += finalLine
textBuffer += "\n\n"
})
fs.writeFileSync("./AuroraForEach.hpp", textBuffer)
fs.writeFileSync("./Include/AuroraForEach.hpp", textBuffer)