Skip to content

Commit

Permalink
Propose a method to have parameterized goals #12
Browse files Browse the repository at this point in the history
  • Loading branch information
xonixx committed Mar 22, 2021
1 parent e1aa442 commit 1d77ce6
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions makesure.awk
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ BEGIN {
split("",ReachedIf) # name -> condition line
split("",ScriptNames) # list
split("",ScriptsByName) # name -> ""
split("",Script) # script name -> body
split("",Script) # name -> body
split("",ScriptFile) # name -> file
Mode = "prelude" # prelude/goal/script
srand()
prepareArgs()
Expand Down Expand Up @@ -152,12 +153,14 @@ function adjustOptions() {
delete Options["timing"]
}

function handlePreludeEnd() { if (isPrelude()) adjustOptions() }
function started(mode) {
if (isPrelude()) adjustOptions()
if ("script" == Mode) createScriptFile()
Mode = mode
}

function handleGoal( goal_name) {
handlePreludeEnd()

Mode = "goal"
started("goal")

goal_name = trim($2)
if (length(goal_name) == 0) {
Expand All @@ -171,9 +174,7 @@ function handleGoal( goal_name) {
}

function handleScript( script_name) {
handlePreludeEnd()

Mode = "script"
started("script")

script_name = trim($2)
if (length(script_name) == 0) {
Expand Down

0 comments on commit 1d77ce6

Please sign in to comment.