Exemplo n.º 1
0
        public static bool RemoveAttribute(ICarriesAttributes obj, Func<QKeyValue, bool> cond)
        {
            QKeyValue curr = obj.Attributes;
            bool removed = false;

            while (curr != null && cond(curr))
            {
                curr = curr.Next;
                removed = true;
            }
            obj.Attributes = curr;
            while (curr != null)
            {
                QKeyValue next = curr.Next;
                while (next != null && cond(next))
                {
                    next = next.Next;
                    removed = true;
                }
                curr.Next = next;
                curr = next;
            }

            return removed;
        }
Exemplo n.º 2
0
        public static bool RemoveAttribute(ICarriesAttributes obj, Func <QKeyValue, bool> cond)
        {
            QKeyValue curr    = obj.Attributes;
            bool      removed = false;

            while (curr != null && cond(curr))
            {
                curr    = curr.Next;
                removed = true;
            }
            obj.Attributes = curr;
            while (curr != null)
            {
                QKeyValue next = curr.Next;
                while (next != null && cond(next))
                {
                    next    = next.Next;
                    removed = true;
                }
                curr.Next = next;
                curr      = next;
            }

            return(removed);
        }
Exemplo n.º 3
0
        public static bool HasCivlAttribute(this ICarriesAttributes obj)
        {
            for (var kv = obj.Attributes; kv != null; kv = kv.Next)
            {
                if (CIVL_ATTRIBUTES.Contains(kv.Key) || LINEAR_ATTRIBUTES.Contains(kv.Key))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemplo n.º 4
0
        public static List <QKeyValue> FindAllAttributes(this ICarriesAttributes obj, string name)
        {
            var attributes = new List <QKeyValue>();

            for (var kv = obj.Attributes; kv != null; kv = kv.Next)
            {
                if (kv.Key == name)
                {
                    attributes.Add(kv);
                }
            }
            return(attributes);
        }
        public static HashSet <string> FindInstantiationHints(ICarriesAttributes o)
        {
            var labels = new HashSet <string>();
            var iter   = o.Attributes;

            while (iter != null)
            {
                if (iter.Key == "pool")
                {
                    iter.Params.OfType <string>().Iter(x => labels.Add(x));
                }
                iter = iter.Next;
            }
            return(labels);
        }
        private void FindInstantiationSources(ICarriesAttributes o, string attrName)
        {
            var iter = o.Attributes;

            while (iter != null)
            {
                if (iter.Key == attrName)
                {
                    var label    = iter.Params[0] as string;
                    var instance = iter.Params[1] as Expr;
                    if (label != null && instance != null)
                    {
                        hasInstances = true;
                    }
                }
                iter = iter.Next;
            }
        }
Exemplo n.º 7
0
 public static void RemoveLayerAttribute(ICarriesAttributes obj)
 {
     RemoveAttribute(obj, kv => kv.Key == LAYER);
 }
Exemplo n.º 8
0
 public static void RemoveLinearAttribute(ICarriesAttributes obj)
 {
     RemoveAttribute(obj,
                     kv => kv.Key == LINEAR || kv.Key == LINEAR_IN || kv.Key == LINEAR_OUT);
 }
Exemplo n.º 9
0
 public static void RemoveYieldsAttribute(ICarriesAttributes obj)
 {
     RemoveAttribute(obj, kv => kv.Key == YIELDS);
 }
Exemplo n.º 10
0
 public static void RemoveMoverAttribute(ICarriesAttributes obj)
 {
     RemoveAttribute(obj,
                     kv => kv.Key == ATOMIC || kv.Key == LEFT || kv.Key == RIGHT || kv.Key == BOTH);
 }
Exemplo n.º 11
0
 public static void RemoveLinearAttributes(ICarriesAttributes obj)
 {
     RemoveAttributes(obj, LINEAR_ATTRIBUTES);
 }
Exemplo n.º 12
0
 public static void RemoveYieldsAttribute(ICarriesAttributes obj)
 {
     RemoveAttribute(obj, kv => kv.Key == YIELDS);
 }
Exemplo n.º 13
0
 public static void RemoveAttributes(ICarriesAttributes obj, ICollection <string> keys)
 {
     RemoveAttributes(obj, kv => keys.Contains(kv.Key));
 }
Exemplo n.º 14
0
 public static void RemoveCivlAttributes(ICarriesAttributes obj)
 {
     RemoveAttributes(obj, CIVL_ATTRIBUTES);
 }
Exemplo n.º 15
0
 public static void RemoveMoverAttribute(ICarriesAttributes obj)
 {
     RemoveAttribute(obj,
         kv => kv.Key == ATOMIC || kv.Key == LEFT || kv.Key == RIGHT || kv.Key == BOTH);
 }
Exemplo n.º 16
0
 public static void RemoveRefinesAttribute(ICarriesAttributes obj)
 {
     RemoveAttribute(obj, kv => kv.Key == REFINES);
 }
Exemplo n.º 17
0
        public static Dictionary <string, HashSet <VCExpr> > FindInstantiationSources(ICarriesAttributes o, string attrName, Boogie2VCExprTranslator exprTranslator)
        {
            var freshInstances = new Dictionary <string, HashSet <VCExpr> >();
            var iter           = o.Attributes;

            while (iter != null)
            {
                if (iter.Key == attrName)
                {
                    var label    = iter.Params[0] as string;
                    var instance = iter.Params[1] as Expr;
                    if (label != null && instance != null)
                    {
                        if (!freshInstances.ContainsKey(label))
                        {
                            freshInstances[label] = new HashSet <VCExpr>();
                        }
                        freshInstances[label].Add(exprTranslator.Translate(instance));
                    }
                }
                iter = iter.Next;
            }
            return(freshInstances);
        }
Exemplo n.º 18
0
 public static void RemoveLayerAttribute(ICarriesAttributes obj)
 {
     RemoveAttribute(obj, kv => kv.Key == LAYER);
 }
Exemplo n.º 19
0
 public static void RemoveLinearAttribute(ICarriesAttributes obj)
 {
     RemoveAttribute(obj,
         kv => kv.Key == LINEAR || kv.Key == LINEAR_IN || kv.Key == LINEAR_OUT);
 }
Exemplo n.º 20
0
 public static void RemoveWitnessAttribute(ICarriesAttributes obj)
 {
     RemoveAttribute(obj, kv => kv.Key == WITNESS);
 }
Exemplo n.º 21
0
 public static bool HasAttribute(this ICarriesAttributes obj, string attribute)
 {
     return(QKeyValue.FindBoolAttribute(obj.Attributes, attribute));
 }