Skip to content

Commit

Permalink
Support interpolation including parameterized goal params #153
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Jan 2, 2024
1 parent 91d6fbe commit c813c37
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
4 changes: 4 additions & 0 deletions dbg.awk
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
function dbgA(name, arr, i,v) { print "--- " name ": "; for (i in arr) { v = arr[i];gsub(SUBSEP,",",i);printf "%6s : %s\n", i, v }}
function dbgAS(name, arr, i,v,keys,ki) { print "--- " name ": ";
for (i in arr) { arrPush(keys,i) }
quicksort(keys,0,arrLen(keys)-1)
for (ki=0;ki < arrLen(keys);ki++) { v = arr[i=keys[ki]];gsub(SUBSEP,",",i);printf "%8s : %s\n", i, v }}
function dbgAO(name, arr, i) { print "--- " name ": "; for (i = 0; i in arr; i++) printf "%2s : %s\n", i, arr[i] }
function dbgLine( i) { print "--- NR=" NR; for (i=1; i<=NF; i++) printf "%2s : %s\n", i, $i }
function indent(ind) {
Expand Down
10 changes: 6 additions & 4 deletions makesure.awk
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ function instantiateGoals( i,l,goalName) {
# args: { F => "file1" }
#
function instantiate(goal,args,newArgs, i,j,depArg,depArgType,dep,goalNameInstantiated,argsCnt,gi,gii,argsCode,a) { # -> goalNameInstantiated
indent(IDepth++); print "instantiating " goal " { " renderArgs(args) "} ..."
# indent(IDepth++); print "instantiating " goal " { " renderArgs(args) "} ..."

goalNameInstantiated = instantiateGoalName(goal, args)

Expand Down Expand Up @@ -668,15 +668,16 @@ function instantiate(goal,args,newArgs, i,j,depArg,depArgType,dep,goalNameInst
argsCnt = 0
if (gi in DependencyArgsNR) {
# already should not fails syntax - we don't check result code
delete a
parseCli_2(Lines[DependencyArgsNR[gi]],args,Vars,a)
# print "$$ "Lines[DependencyArgsNR[gi]]
# print "## "(a[-7]-3)", "argsCnt
# dbgA("a",a)
# dbgAS("a",a)

argsCnt = a[-7]-3 # TODO comment
}

print "## "argsCnt","GoalParamsCnt[dep]
# print "## "argsCnt","GoalParamsCnt[dep]
# we do not report wrong args count for unknown deps
if (dep in GoalsByName && argsCnt != GoalParamsCnt[dep])
addErrorDedup("wrong args count for '" dep "'", DependenciesLineNo[gi])
Expand Down Expand Up @@ -705,10 +706,11 @@ function instantiate(goal,args,newArgs, i,j,depArg,depArgType,dep,goalNameInst
gii = goalNameInstantiated SUBSEP i
Dependencies[gii] = instantiate(dep, newArgs)
DependenciesLineNo[gii] = DependenciesLineNo[gi]
delete DependencyArgsNR[gi]
# DependencyArgsCnt[gii] = 0
}

IDepth--
# IDepth--
return goalNameInstantiated
}
function instantiateGoalName(goal, args, res,cnt,i) {
Expand Down

0 comments on commit c813c37

Please sign in to comment.