Example #1
0
        public Macro(string label, HMIStatement statement)  // Persist
        {
            this.search  = QuelleControlConfig.search.CreateCopy;
            this.display = QuelleControlConfig.display.CreateCopy;

            this.label     = HMIStatement.SquenchText(label);
            this.expansion = "";
            if (statement != null)
            {
                var searches = (from key in statement.segmentation.Keys orderby key select statement.segmentation[key]);
                foreach (var clause in searches)
                {
                    if (clause.verb == Search.FIND)
                    {
                        var find = new QClauseSearch((Search)clause);
                        if (find.segment.Length > 0)
                        {
                            if (this.expansion.Length > 0)
                            {
                                this.expansion += " ; ";
                            }
                            if (find.polarity == '-')
                            {
                                this.expansion += "-- ";
                            }
                            this.expansion += HMIStatement.SquenchText(find.segment);
                        }
                    }
                }
            }
            // statement.Notify("warning", "There is no active search statement; This label will only preserve control variables if any are activated");

            this.Persist();
        }
Example #2
0
        static IExpand Create(string label, HMIStatement statement)
        {
            if (string.IsNullOrEmpty(label) || (statement == null || statement.segmentation.Count < 1))
            {
                return(null);
            }

            if (char.IsLetter(label[0]))
            {
                return(new Macro(label, statement));   // Persist
            }
            var isNumeric = false;

            for (int c = 0; c < label.Length; c++)
            {
                isNumeric = char.IsDigit(label[c]);
                if (!isNumeric)
                {
                    break;
                }
            }
            return(isNumeric ? new History(UInt32.Parse(label), statement) : null);
        }
Example #3
0
 public Guid Add(HMIStatement statement)
 {
     return(Guid.Empty);
 }