Exemplo n.º 1
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);
    }
Exemplo n.º 2
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));
    }