/for {
if ($1 isnum) {
set %place 1
while ($gettok($3-,%place,59) != $null) {
;executes each section seperately, divided by $chr(59)
set %tok $gettok($3-,%place,59)
set %subplace 1
if (%place == 1) {
;first section. Initializes variables, in "variable = value" format. Each statement seperated by commas.
while ($gettok(%tok, %subplace, 44) != $null) {
set %subtok $remove($gettok(%tok, %subplace, 44),$chr(32))
set $+(%,$gettok(%subtok,1,61)) $gettok(%subtok,2,61)
inc %subplace
}
}
else if (%place == 2) {
set %tok $gettok($3-,%place,59)
set %evalfirst $gettok(%tok,1,32)
set %evalmid $gettok(%tok,2,32)
set %evallast $gettok(%tok,3,32)
set %evalwhile $gettok(%tok,1,32) $gettok(%tok,2,32) $gettok(%tok,3,32)
}
else if (%place == 3) {
;anything made within the third section is done at the end. Can have more than one command with seperation of either | or ,
if ($replace($gettok($3-,%place,59),$chr(44),$chr(124)),1 != $null) {
set %exec $replace($gettok($3-,%place,59),$chr(44),$chr(124))
}
}
inc %place
}
set %forcount $1
while (for !isin $read($2,%forcount)) {
inc %forcount
}
inc %forcount
write -c for.txt 0
while (:FOREND !isin $read($2,%forcount)) {
write for.txt $read($2,%forcount)
msg # $read($2,%forcount)
inc %forcount
}
msg # %evalfirst %evalmid %evallast
while (%evalwhile) {
echo -a got here
set %forcount 1
while ($read(for.txt,%forcount) != $null) {
msg # got here
/ $+ $read(for.txt,%forcount)
/ $+ %exec
inc %forcount
}
}
}
}