public bool ExecuteEndDo(ActionProgramRun ap)             // WHILE at end of DO..WHILE
        {
            if (ap.IsExecuteOn)                                   // if executing
            {
                if (condition == null)
                {
                    condition = new ConditionLists();
                    if (condition.Read(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
        }
        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
        }
示例#3
0
        public bool ExecuteEndFor(ActionProgramRun ap)   // only called if Push pos is set.  break clears the push pos
        {
            if (values != null)
            {
                if (count < values.Count)
                {
                    ap.Goto(ap.PushPos + 1);
                    ap[expmacroname] = values[count++];
                    System.Diagnostics.Debug.WriteLine("New value " + ap[expmacroname]);

                    return(true);
                }
                else
                {
                    values = null;
                }
            }

            return(false);
        }