Beispiel #1
0
 public Umarci
 (
     PftContext context
 )
 {
     Context = context;
 }
Beispiel #2
0
 public override void Execute
 (
     PftContext context
 )
 {
     // Really nothing to do!
 }
Beispiel #3
0
 public string Evaluate
 (
     PftContext context
 )
 {
     return(context.Evaluate(this));
 }
Beispiel #4
0
 public override void Execute
 (
     PftContext context
 )
 {
     context.WriteLine();
 }
Beispiel #5
0
        public PftContext
        (
            PftContext parent
        )
        {
            _parent = parent;

            PftOutputBuffer parentBuffer = (parent == null)
                ? null
                : parent.Output;

            Output = new PftOutputBuffer(parentBuffer);

            Globals = (parent == null)
                ? new PftGlobalManager()
                : parent.Globals;

            Record = (parent == null)
                ? new IrbisRecord()
                : parent.Record;

            Client = (parent == null)
                ? new ManagedClient64()
                : parent.Client;
        }
Beispiel #6
0
 public override bool Evaluate
 (
     PftContext context
 )
 {
     return(Inner.Evaluate(context));
 }
Beispiel #7
0
 public PftFormatter
 (
     PftContext context
 )
 {
     Context = context;
 }
Beispiel #8
0
 public override void Execute
 (
     PftContext context
 )
 {
     Arguments.Execute(context);
 }
Beispiel #9
0
        public override bool Evaluate
        (
            PftContext context
        )
        {
            Left.Execute(context);
            Right.Execute(context);
            // ReSharper disable CompareOfFloatsByEqualityOperator
            switch (Op)
            {
            case "=":
                return(Left.Value == Right.Value);

            case "<>":
                return(Left.Value != Right.Value);

            case ">":
                return(Left.Value > Right.Value);

            case ">=":
                return(Left.Value >= Right.Value);

            case "<":
                return(Left.Value < Right.Value);

            case "<=":
                return(Left.Value <= Right.Value);
            }
            // ReSharper restore CompareOfFloatsByEqualityOperator

            throw new ArgumentException();
        }
Beispiel #10
0
 public override void Execute
 (
     PftContext context
 )
 {
     context.Write(RealText);
 }
Beispiel #11
0
 public override void Execute
 (
     PftContext context
 )
 {
     context.Output.RemoveEmptyLine();
 }
Beispiel #12
0
        /// <summary>
        /// Возможность вычислить значение без записи
        /// в выходной буфер.
        /// </summary>
        /// <param name="context"></param>
        /// <returns></returns>
        public string Evaluate
        (
            PftContext context
        )
        {
            string result;

            if (Group != null)
            {
                if (Group.GroupIndex >= Group.GroupItems.Length)
                {
                    result = string.Empty;
                }
                else
                {
                    RecordField[] fields =
                    {
                        Group.GroupItems[Group.GroupIndex]
                    };
                    result = Field.FormatSingle(fields);
                }
            }
            else
            {
                result = Field.FormatSingle(context.Record);
            }

            return(result);
        }
        public PftContext
        (
            PftFormatter formatter,
            PftContext parent
        )
        {
            _formatter = formatter;

            _parent = parent;

            PftOutputBuffer parentBuffer = (parent == null)
                ? null
                : parent.Output;

            Output = new PftOutputBuffer(parentBuffer);

            Globals = (parent == null)
                ? new PftGlobalManager()
                : parent.Globals;

            // Переменные в каждом контексте свои
            Variables = new PftVariableManager();

            // Процедуры в каждом контексте свои
            Procedures = new PftProcedureManager();

            Record = (parent == null)
                ? new IrbisRecord()
                : parent.Record;

            Client = (parent == null)
                ? new ManagedClient64()
                : parent.Client;
        }
Beispiel #14
0
 public Unifor
 (
     PftContext context
 )
 {
     Context = context;
 }
Beispiel #15
0
        public override void Execute
        (
            PftContext context
        )
        {
            if (SimpleValue != null)
            {
                SimpleValue.Execute(context);
                Value = SimpleValue.Value;
            }
            else
            {
                Left.Execute(context);
                Right.Execute(context);
                switch (Op)
                {
                case "+":
                    Value = Left.Value + Right.Value;
                    break;

                case "-":
                    Value = Left.Value - Right.Value;
                    break;

                case "*":
                    Value = Left.Value * Right.Value;
                    break;

                case "/":
                    Value = Left.Value / Right.Value;
                    break;
                }
            }
        }
Beispiel #16
0
 public override void Execute
 (
     PftContext context
 )
 {
     context.OutputMode = OutputMode;
     context.UpperMode  = UpperMode;
 }
Beispiel #17
0
        public override void Execute
        (
            PftContext context
        )
        {
            string text = context.Evaluate(Statement);

            Trace.WriteLine(text);
        }
Beispiel #18
0
        public override void Execute
        (
            PftContext context
        )
        {
            string text = context.Evaluate(Statement);

            context.Output.Error.WriteLine(text);
        }
Beispiel #19
0
        public override void Execute
        (
            PftContext context
        )
        {
            string text = Reference.FormatSingle(context.Globals.Get(Index));

            context.Write(text);
        }
 public override void Execute
 (
     PftContext context
 )
 {
     Value = (context.Record == null)
         ? 0
         : context.Record.Mfn;
 }
Beispiel #21
0
 public Unifor
 (
     PftContext context,
     PftGroupStatement grp
 )
 {
     Context = context;
     Group   = grp;
 }
        public override void Execute
        (
            PftContext context
        )
        {
            string argument = context.Evaluate(Argument);

            Value = ExtractNumber(argument);
        }
Beispiel #23
0
 public Umarci
 (
     PftContext context,
     PftGroupStatement grp
 )
 {
     Context = context;
     Group   = grp;
 }
Beispiel #24
0
        public string Evaluate
        (
            PftContext context
        )
        {
            string result = context.Evaluate(this);

            return(result);
        }
Beispiel #25
0
        public override void Execute
        (
            PftContext context
        )
        {
            string text = Evaluate(context);

            context.Write(text);
        }
        public override void Execute
        (
            PftContext context
        )
        {
            string text = context.Evaluate(Argument);

            double[] values = ExtractNumbers(text);
            Value = values.Min();
        }
Beispiel #27
0
        public override bool Evaluate
        (
            PftContext context
        )
        {
            string formatted = Field.Field.FormatSingle(context.Record);
            bool   result    = string.IsNullOrEmpty(formatted) != MustPresent;

            return(result);
        }
Beispiel #28
0
 public override bool Execute
 (
     PftContext context
 )
 {
     return(Arguments.Execute
            (
                context
            ));
 }
Beispiel #29
0
        public string Evaluate
        (
            PftAst ast
        )
        {
            PftContext copy = Push();

            ast.Execute(copy);
            return(copy.ToString());
        }
Beispiel #30
0
 public override void Execute
 (
     PftContext context
 )
 {
     if (!context.Output.HaveEmptyLine())
     {
         context.WriteLine();
     }
 }