Skip to content

Commit 2ba018e

Browse files
committed
Diminish the notion of prelude #84
1 parent e44ab6f commit 2ba018e

File tree

1 file changed

+14
-7
lines changed

1 file changed

+14
-7
lines changed

makesure.awk

+14-7
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,8 @@ function handleDefineLine(line, kv,l) {
150150
splitKV(line, kv)
151151

152152
if (!(kv[0] in DefineOverrides)) {
153-
handleCodeLine(l = line "; export " kv[0])
154-
handleCodeLine("echo " quoteArg(l) " >> " DefinesFile)
153+
addCodeLine(l = line "; export " kv[0])
154+
addCodeLine("echo " quoteArg(l) " >> " DefinesFile)
155155
}
156156
}
157157

@@ -540,22 +540,29 @@ function getMyDir(makesurefilePath) {
540540
return executeGetLine("cd \"$(dirname " quoteArg(makesurefilePath) ")\";pwd")
541541
}
542542

543-
function handleCodeLine(line, goalName, name, i) {
543+
function handleCodeLine(line) {
544+
if (isPrelude() && line !~ /^#/ && trim(line) != "" && !ShellInPreludeErrorShown++)
545+
addError("Shell code is not allowed in prelude area")
546+
else
547+
addCodeLine(line)
548+
}
549+
550+
function addCodeLine(line, goalName, name, i) {
544551
if ("lib" == Mode) {
545552
name = currentLibName()
546553
#print "Append line for '" name "': " line
547554
Lib[name] = addL(Lib[name], line)
548555
} else if ("goal_glob" == Mode) {
549556
for (i=0; i < GlobCnt; i++){
550557
if (!Code[goalName = globGoal(i)])
551-
addCodeLine(goalName, makeGlobVarsCode(i))
552-
addCodeLine(goalName, line)
558+
addCodeLineToGoal(goalName, makeGlobVarsCode(i))
559+
addCodeLineToGoal(goalName, line)
553560
}
554561
} else
555-
addCodeLine(currentGoalName(), line)
562+
addCodeLineToGoal(currentGoalName(), line)
556563
}
557564

558-
function addCodeLine(name, line) {
565+
function addCodeLineToGoal(name, line) {
559566
#print "Append line for '" name "': " line
560567
Code[name] = addL(Code[name], line)
561568
}

0 commit comments

Comments
 (0)