Exemple #1
0
        public override void Evaluate()
        {
            Expression e = new Expression(RegexMatch.Groups[1].Value, ParentContext);

            if (e.IsNull())
            {
                StdOut("NULL");
                State = ExecutionState.DONE;
            }
            else
            {
                StdOut(e.ToString());
                State = ExecutionState.DONE;
            }
        }
Exemple #2
0
        public override void Evaluate()
        {
            Expression e = new Expression(RegexMatch.Groups[1].Value, ParentContext);
            Expression ex = new Expression(RegexMatch.Groups[2].Value, ParentContext);
            Expression ey = new Expression(RegexMatch.Groups[3].Value, ParentContext);

            if (e.IsNull()) throw new kOSException("Null value in print statement");

            int x, y;

            if (Int32.TryParse(ex.GetValue().ToString(), out x) && Int32.TryParse(ey.GetValue().ToString(), out y))
            {
                Put(e.GetValue().ToString(), x, y);
            }
            else
            {
                throw new kOSException("Non-numeric value assigned to numeric function");
            }

            State = ExecutionState.DONE;
        }
Exemple #3
0
        public override void Evaluate()
        {
            Expression e  = new Expression(RegexMatch.Groups[1].Value, ParentContext);
            Expression ex = new Expression(RegexMatch.Groups[2].Value, ParentContext);
            Expression ey = new Expression(RegexMatch.Groups[3].Value, ParentContext);

            if (e.IsNull())
            {
                throw new kOSException("Null value in print statement");
            }

            int x, y;

            if (Int32.TryParse(ex.GetValue().ToString(), out x) && Int32.TryParse(ey.GetValue().ToString(), out y))
            {
                Put(e.GetValue().ToString(), x, y);
            }
            else
            {
                throw new kOSException("Non-numeric value assigned to numeric function");
            }

            State = ExecutionState.DONE;
        }
Exemple #4
0
        public override void Evaluate()
        {
            // For now only log to the archive.
            String volumeName = "Archive";
            Volume targetVolume = GetVolume(volumeName);

            // If the archive is out of ranch, the signal is lost in space.
            if (!targetVolume.CheckRange())
            {
                State = ExecutionState.DONE;
                return;
            }

            String targetFile = RegexMatch.Groups[1].Value.Trim();
            Expression e = new Expression(RegexMatch.Groups[2].Value, ParentContext);

            if (e.IsNull())
            {
                State = ExecutionState.DONE;
            }
            else
            {
                targetVolume.AppendToName(targetFile, e.ToString());
                State = ExecutionState.DONE;
            }
        }
        public override void Evaluate()
        {
            // Todo: let the user specify a volume "LOG something TO file ON volume"
            Volume targetVolume = SelectedVolume;

            // If the archive is out of reach, the signal is lost in space.
            if (!targetVolume.CheckRange())
            {
                State = ExecutionState.DONE;
                return;
            }

            String targetFile = RegexMatch.Groups[2].Value.Trim();
            Expression e = new Expression(RegexMatch.Groups[1].Value, ParentContext);

            if (e.IsNull())
            {
                State = ExecutionState.DONE;
            }
            else
            {
                targetVolume.AppendToFile(targetFile, e.ToString());
                State = ExecutionState.DONE;
            }
        }