Пример #1
0
    void FinishInterpreter(CPU cpu)
    {
        XValue[]      vv = cpu.PopToMarker();
        XArrayGeneric a  = new XArrayGeneric(XType.ARRAY_OBJECT);

        a.Init(new XBufferGen(vv), 0, vv.Length);
        cpu.Push(new XValue(a));
    }
Пример #2
0
    /*
     * Warning: this function does not check compatibility of values
     * with the destination type.
     */
    internal static XArrayGeneric Concat(
        XType type, params XArrayGeneric[] aa)
    {
        List <XValue> r = new List <XValue>();

        foreach (XArrayGeneric a in aa)
        {
            int n = a.Length;
            for (int i = 0; i < n; i++)
            {
                r.Add(a[i]);
            }
        }
        XArrayGeneric xag = new XArrayGeneric(type);
        XBuffer       xb  = new XBufferGen(r.ToArray());

        xag.Init(xb, 0, r.Count);
        return(xag);
    }
Пример #3
0
    /*
     * Implementation of std::concat (on arrays of objects).
     */
    internal void NativeConcatArrayObject(CPU cpu)
    {
        XArrayGeneric b    = cpu.Pop().XObject as XArrayGeneric;
        XArrayGeneric a    = cpu.Pop().XObject as XArrayGeneric;
        int           alen = a.Length;
        int           blen = b.Length;
        XBuffer       xb   = new XBufferGen(a.Length + b.Length);

        for (int i = 0; i < alen; i++)
        {
            xb.Set(i, a[i]);
        }
        for (int i = 0; i < blen; i++)
        {
            xb.Set(alen + i, b[i]);
        }
        XArrayGeneric c = new XArrayGeneric(XType.ARRAY_OBJECT);

        c.Init(xb, 0, alen + blen);
        cpu.Push(new XValue(c));
    }