From 346eff6bf33079bf8dc24be38eb31fe718874bad Mon Sep 17 00:00:00 2001 From: xonix Date: Sun, 22 Jan 2023 01:18:46 +0200 Subject: [PATCH] Parameterized goals #115 --- makesure.awk | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/makesure.awk b/makesure.awk index ceb56d6..cf6b39b 100755 --- a/makesure.awk +++ b/makesure.awk @@ -117,8 +117,8 @@ function prepareArgs( i,arg) { Options["timing"] } -#function dbgA(name, arr, i) { print "--- " name ": "; for (i in arr) printf "%2s : %s\n", i, arr[i] } -#function dbgAO(name, arr, i) { print "--- " name ": "; for (i=0;i in arr;i++) printf "%2s : %s\n", i, arr[i] } +function dbgA(name, arr, i) { print "--- " name ": "; for (i in arr) printf "%2s : %s\n", i, arr[i] } +function dbgAO(name, arr, i) { print "--- " name ": "; for (i=0;i in arr;i++) printf "%2s : %s\n", i, arr[i] } #function indent(ind) { # printf "%" ind*2 "s", "" #} @@ -413,7 +413,7 @@ body,goalBody,goalBodies,resolvedGoals,exitCode, t0,t1,t2, goalTimed, list) { topologicalSort(0,GoalNames) # first do topological sort disregarding @reached_if to catch loops -# instantiateGoals() + instantiateGoals() # printDepsTree("a") @@ -633,7 +633,10 @@ function instantiate(goal,args,newArgs, i,j,depArg,depArgType,dep,goalNameInst arrPush(GoalNames, goalNameInstantiated) copyKey(goal,goalNameInstantiated,GoalsByName) copyKey(goal,goalNameInstantiated,DependenciesCnt) - copyKey(goal,goalNameInstantiated,CodePre) # TODO attach dependency var values + copyKey(goal,goalNameInstantiated,CodePre) + for (i in args) { + CodePre[goalNameInstantiated] = addL(CodePre[goalNameInstantiated], i "=" args[i]) + } copyKey(goal,goalNameInstantiated,Code) copyKey(goal,goalNameInstantiated,Doc) copyKey(goal,goalNameInstantiated,ReachedIf)