/* ex: set ro ft=c: -*- buffer-read-only:t -*-
 * !!!!!!!   DO NOT EDIT THIS FILE   !!!!!!!
 *
 * This file is generated automatically from './src/pmc/structview.pmc'
 * by tools/build/pmc2c.pl.
 *
 * Any changes made here will be lost!
 *
 */

/* HEADERIZER HFILE: none */
/* HEADERIZER STOP */


#ifndef PARROT_PMC_STRUCTVIEW_H_GUARD
#define PARROT_PMC_STRUCTVIEW_H_GUARD

typedef enum {
    int_access = 1,
    unaligned_access,
    num_access,
    str_access,
    pmc_access
} elt_access_t;

typedef struct elt_desc_t {
    elt_access_t     access;
    PARROT_DATA_TYPE type;
    size_t           byte_offset;
    unsigned char    bit_offset;
    size_t           size;
} elt_desc_t;
PARROT_EXPORT VTABLE* Parrot_StructView_update_vtable(ARGMOD(VTABLE*));
PARROT_EXPORT VTABLE* Parrot_StructView_ro_update_vtable(ARGMOD(VTABLE*));
PARROT_EXPORT VTABLE* Parrot_StructView_get_vtable(PARROT_INTERP);
PARROT_EXPORT VTABLE* Parrot_StructView_ro_get_vtable(PARROT_INTERP);
PARROT_EXPORT PMC*    Parrot_StructView_get_mro(PARROT_INTERP, ARGMOD(PMC* mro));
PARROT_EXPORT Hash*   Parrot_StructView_get_isa(PARROT_INTERP, ARGMOD_NULLOK(Hash* isa));

/* StructView PMC's underlying struct. */
typedef struct Parrot_StructView_attributes {
    PARROT_DATA_TYPE pack_type;
    size_t n_elts;
    elt_desc_t       * elts;
    size_t align;
    size_t size;
} Parrot_StructView_attributes;

/* Macro to access underlying structure of a StructView PMC. */
#define PARROT_STRUCTVIEW(o) ((Parrot_StructView_attributes *) PMC_data(o))


/* Generated macro accessors for 'pack_type' attribute of StructView PMC. */
#define GETATTR_StructView_pack_type(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_StructView_attributes *)PMC_data(pmc))->pack_type; \
        } \
        else { \
            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'PARROT_DATA_TYPE' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
    } while (0)

#define SETATTR_StructView_pack_type(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'PARROT_DATA_TYPE' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
        else \
            ((Parrot_StructView_attributes *)PMC_data(pmc))->pack_type = (value); \
    } while (0)


/* Generated macro accessors for 'n_elts' attribute of StructView PMC. */
#define GETATTR_StructView_n_elts(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_StructView_attributes *)PMC_data(pmc))->n_elts; \
        } \
        else { \
            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'size_t' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
    } while (0)

#define SETATTR_StructView_n_elts(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'size_t' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
        else \
            ((Parrot_StructView_attributes *)PMC_data(pmc))->n_elts = (value); \
    } while (0)


/* Generated macro accessors for 'elts' attribute of StructView PMC. */
#define GETATTR_StructView_elts(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_StructView_attributes *)PMC_data(pmc))->elts; \
        } \
        else { \
            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'elt_desc_t       *' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
    } while (0)

#define SETATTR_StructView_elts(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'elt_desc_t       *' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
        else \
            ((Parrot_StructView_attributes *)PMC_data(pmc))->elts = (value); \
    } while (0)


/* Generated macro accessors for 'align' attribute of StructView PMC. */
#define GETATTR_StructView_align(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_StructView_attributes *)PMC_data(pmc))->align; \
        } \
        else { \
            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'size_t' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
    } while (0)

#define SETATTR_StructView_align(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'size_t' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
        else \
            ((Parrot_StructView_attributes *)PMC_data(pmc))->align = (value); \
    } while (0)


/* Generated macro accessors for 'size' attribute of StructView PMC. */
#define GETATTR_StructView_size(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_StructView_attributes *)PMC_data(pmc))->size; \
        } \
        else { \
            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'size_t' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
    } while (0)

#define SETATTR_StructView_size(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'size_t' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
        else \
            ((Parrot_StructView_attributes *)PMC_data(pmc))->size = (value); \
    } while (0)


#endif /* PARROT_PMC_STRUCTVIEW_H_GUARD */

/*
 * Local variables:
 *   c-file-style: "parrot"
 * End:
 * vim: expandtab shiftwidth=4:
 */

