Package org.perl6.nqp.sixmodel

Examples of org.perl6.nqp.sixmodel.StorageSpec


        Ops.invokeDirect(tc, meth, new CallSiteDescriptor(new byte[] { ARG_OBJ }, null), new Object[] { st.WHAT });
        data.elem_type = Ops.decont(Ops.result_o(tc.resultFrame()), tc);
        if (data.elem_type == null)
            ExceptionHandling.dieInternal(tc, "CArray representation expects a non-null return value from the 'of' method, specifying the element type");

        StorageSpec ss = data.elem_type.st.REPR.get_storage_spec(tc, data.elem_type.st);
        data.elem_size = ss.bits;
        if (ss.boxed_primitive == StorageSpec.BP_INT) {
            if (ss.bits == 8) {
                data.jna_size = Native.getNativeSize(Byte.class);
            }
View Full Code Here


    }
    public static String unbox_s(SixModelObject obj, ThreadContext tc) {
        return decont(obj, tc).get_str(tc);
    }
    public static long isint(SixModelObject obj, ThreadContext tc) {
        StorageSpec ss = decont(obj, tc).st.REPR.get_storage_spec(tc, obj.st);
        return (ss.can_box & StorageSpec.CAN_BOX_INT) == 0 ? 0 : 1;
    }
View Full Code Here

    public static long isint(SixModelObject obj, ThreadContext tc) {
        StorageSpec ss = decont(obj, tc).st.REPR.get_storage_spec(tc, obj.st);
        return (ss.can_box & StorageSpec.CAN_BOX_INT) == 0 ? 0 : 1;
    }
    public static long isnum(SixModelObject obj, ThreadContext tc) {
        StorageSpec ss = decont(obj, tc).st.REPR.get_storage_spec(tc, obj.st);
        return (ss.can_box & StorageSpec.CAN_BOX_NUM) == 0 ? 0 : 1;
    }
View Full Code Here

    public static long isnum(SixModelObject obj, ThreadContext tc) {
        StorageSpec ss = decont(obj, tc).st.REPR.get_storage_spec(tc, obj.st);
        return (ss.can_box & StorageSpec.CAN_BOX_NUM) == 0 ? 0 : 1;
    }
    public static long isstr(SixModelObject obj, ThreadContext tc) {
        StorageSpec ss = decont(obj, tc).st.REPR.get_storage_spec(tc, obj.st);
        return (ss.can_box & StorageSpec.CAN_BOX_STR) == 0 ? 0 : 1;
    }
View Full Code Here

    /* Smart coercions. */
    public static String smart_stringify(SixModelObject obj, ThreadContext tc) {
        obj = decont(obj, tc);

        // If it can unbox to a string, that wins right off.
        StorageSpec ss = obj.st.REPR.get_storage_spec(tc, obj.st);
        if ((ss.can_box & StorageSpec.CAN_BOX_STR) != 0 && !(obj instanceof TypeObject))
            return obj.get_str(tc);

        // If it has a Str method, that wins.
        // We could put this in the generated code, but it's here to avoid the
View Full Code Here

    }
    public static double smart_numify(SixModelObject obj, ThreadContext tc) {
        obj = decont(obj, tc);

        // If it can unbox as an int or a num, that wins right off.
        StorageSpec ss = obj.st.REPR.get_storage_spec(tc, obj.st);
        if ((ss.can_box & StorageSpec.CAN_BOX_INT) != 0)
            return (double)obj.get_int(tc);
        if ((ss.can_box & StorageSpec.CAN_BOX_NUM) != 0)
            return obj.get_num(tc);
View Full Code Here

        final int numElems = (int) arr.elems(tc);
        Object[] args = new Object[numElems];

        for (int i = 0; i < numElems; i++) {
            SixModelObject obj = arr.at_pos_boxed(tc, i);
            StorageSpec ss = obj.st.REPR.get_storage_spec(tc, obj.st);
            if ((ss.can_box & StorageSpec.CAN_BOX_INT) != 0) {
                args[i] = Long.valueOf(obj.get_int(tc));
            } else if ((ss.can_box & StorageSpec.CAN_BOX_NUM) != 0) {
                args[i] = Double.valueOf(obj.get_num(tc));
            } else if ((ss.can_box & StorageSpec.CAN_BOX_STR) != 0) {
View Full Code Here

import org.perl6.nqp.sixmodel.TypeObject;

public class P6str extends REPR {
    public SixModelObject type_object_for(ThreadContext tc, SixModelObject HOW) {
        STable st = new STable(this, HOW);
        SixModelObject obj = new TypeObject();
        obj.st = st;
        st.WHAT = obj;
        return st.WHAT;
    }
View Full Code Here

import org.perl6.nqp.sixmodel.TypeObject;

public class VMException extends REPR {
    public SixModelObject type_object_for(ThreadContext tc, SixModelObject HOW) {
        STable st = new STable(this, HOW);
        SixModelObject obj = new TypeObject();
        obj.st = st;
        st.WHAT = obj;
        return st.WHAT;
    }
View Full Code Here

import org.perl6.nqp.runtime.ThreadContext;

public class CStruct extends REPR {
    public SixModelObject type_object_for(ThreadContext tc, SixModelObject HOW) {
        STable st = new STable(this, HOW);
        SixModelObject obj = new TypeObject();
        obj.st = st;
        st.WHAT = obj;
        return st.WHAT;
    }
View Full Code Here

TOP

Related Classes of org.perl6.nqp.sixmodel.StorageSpec

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.