public bool ExecuteEndLoop(ActionProgramRun ap) // only called if executing { if (inloop) // if in a count, we were executing at the loop, either on or off { if (--loopcount > 0) // any count left? { ap.Goto(ap.PushPos + 1); // back to LOOP+1, keep level int c = 0; if (ap[loopvar].InvariantParse(out c)) // update LOOP level variable.. don't if they have mucked it up { ap[loopvar] = (c + 1).ToString(System.Globalization.CultureInfo.InvariantCulture); } return(true); } else { inloop = false; // turn off check flag, and we just exit the loop normally } } else { ap.ReportError("Internal error - END Loop is saying not counting when run"); } return(false); // not executing the LOOP, so we just let the standard code drop the level. Position will not be pushed }
public bool ExecuteEndDo(ActionProgramRun ap) // WHILE at end of DO..WHILE { if (ap.IsExecuteOn) // if executing { if (condition == null) { condition = new ConditionLists(); if (condition.FromString(UserData) != null) { ap.ReportError("While condition in Do..While is not correctly formed"); return(true); } } string errlist; bool? condres = condition.CheckAll(ap.functions.vars, out errlist, null, ap.functions); // may return null.. and will return errlist if (errlist == null) { bool res = condres.HasValue && condres.Value; if (res) { ap.Goto(ap.PushPos + 1); // back to DO+1, keep level return(true); // Else drop the level, and finish the do. } } else { ap.ReportError(errlist); } } return(false); // not executing the DO, so we just let the standard code drop the level. Position will not be pushed }