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

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


#ifndef PARROT_PMC_CLASS_H_GUARD
#define PARROT_PMC_CLASS_H_GUARD

PARROT_EXPORT VTABLE* Parrot_Class_update_vtable(ARGMOD(VTABLE*));
PARROT_EXPORT VTABLE* Parrot_Class_ro_update_vtable(ARGMOD(VTABLE*));
PARROT_EXPORT VTABLE* Parrot_Class_get_vtable(PARROT_INTERP);
PARROT_EXPORT VTABLE* Parrot_Class_ro_get_vtable(PARROT_INTERP);
PARROT_EXPORT PMC*    Parrot_Class_get_mro(PARROT_INTERP, ARGIN_NULLOK(PMC* mro));
PARROT_EXPORT Hash*   Parrot_Class_get_isa(PARROT_INTERP, ARGIN_NULLOK(Hash* isa));

/* Class PMC's underlying struct. */
typedef struct Parrot_Class_attributes {
    INTVAL id;
    STRING * name;
    STRING * fullname;
    PMC * _namespace;
    INTVAL instantiated;
    PMC * parents;
    PMC * all_parents;
    PMC * roles;
    PMC * methods;
    PMC * vtable_overrides;
    PMC * attrib_metadata;
    PMC * attrib_index;
    PMC * attrib_cache;
    PMC * resolve_method;
    PMC  * parent_overrides;
    PMC  * meth_cache;
    Hash * isa_cache;
} Parrot_Class_attributes;

/* Macro to access underlying structure of a Class PMC. */
#define PARROT_CLASS(o) ((Parrot_Class_attributes *) PMC_data(o))


/* Generated macro accessors for 'id' attribute of Class PMC. */
#define GETATTR_Class_id(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Class_attributes *)PMC_data(pmc))->id; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "id")); \
            (dest) = (PMC_IS_NULL(attr_value) ? (INTVAL) 0: VTABLE_get_integer(interp, attr_value)); \
        } \
    } while (0)

#define SETATTR_Class_id(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            PMC * const attr_value = Parrot_pmc_new_init_int(interp, enum_class_Integer, value); \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "id"), attr_value); \
        } \
        else \
            ((Parrot_Class_attributes *)PMC_data(pmc))->id = (value); \
    } while (0)


/* Generated macro accessors for 'name' attribute of Class PMC. */
#define GETATTR_Class_name(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Class_attributes *)PMC_data(pmc))->name; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "name")); \
            (dest) =  (PMC_IS_NULL(attr_value) ? (STRING *)NULL : VTABLE_get_string(interp, attr_value)); \
        } \
    } while (0)

#define SETATTR_Class_name(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            PMC * const attr_value = Parrot_pmc_new(interp, enum_class_String); \
            VTABLE_set_string_native(interp, attr_value, value); \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "name"), attr_value); \
        } \
        else \
            ((Parrot_Class_attributes *)PMC_data(pmc))->name = (value); \
    } while (0)


/* Generated macro accessors for 'fullname' attribute of Class PMC. */
#define GETATTR_Class_fullname(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Class_attributes *)PMC_data(pmc))->fullname; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "fullname")); \
            (dest) =  (PMC_IS_NULL(attr_value) ? (STRING *)NULL : VTABLE_get_string(interp, attr_value)); \
        } \
    } while (0)

#define SETATTR_Class_fullname(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            PMC * const attr_value = Parrot_pmc_new(interp, enum_class_String); \
            VTABLE_set_string_native(interp, attr_value, value); \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "fullname"), attr_value); \
        } \
        else \
            ((Parrot_Class_attributes *)PMC_data(pmc))->fullname = (value); \
    } while (0)


/* Generated macro accessors for '_namespace' attribute of Class PMC. */
#define GETATTR_Class__namespace(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Class_attributes *)PMC_data(pmc))->_namespace; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "_namespace")); \
        } \
    } while (0)

#define SETATTR_Class__namespace(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "_namespace"), value); \
        } \
        else \
            ((Parrot_Class_attributes *)PMC_data(pmc))->_namespace = (value); \
    } while (0)


/* Generated macro accessors for 'instantiated' attribute of Class PMC. */
#define GETATTR_Class_instantiated(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Class_attributes *)PMC_data(pmc))->instantiated; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "instantiated")); \
            (dest) = (PMC_IS_NULL(attr_value) ? (INTVAL) 0: VTABLE_get_integer(interp, attr_value)); \
        } \
    } while (0)

#define SETATTR_Class_instantiated(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            PMC * const attr_value = Parrot_pmc_new_init_int(interp, enum_class_Integer, value); \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "instantiated"), attr_value); \
        } \
        else \
            ((Parrot_Class_attributes *)PMC_data(pmc))->instantiated = (value); \
    } while (0)


/* Generated macro accessors for 'parents' attribute of Class PMC. */
#define GETATTR_Class_parents(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Class_attributes *)PMC_data(pmc))->parents; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "parents")); \
        } \
    } while (0)

#define SETATTR_Class_parents(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "parents"), value); \
        } \
        else \
            ((Parrot_Class_attributes *)PMC_data(pmc))->parents = (value); \
    } while (0)


/* Generated macro accessors for 'all_parents' attribute of Class PMC. */
#define GETATTR_Class_all_parents(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Class_attributes *)PMC_data(pmc))->all_parents; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "all_parents")); \
        } \
    } while (0)

#define SETATTR_Class_all_parents(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "all_parents"), value); \
        } \
        else \
            ((Parrot_Class_attributes *)PMC_data(pmc))->all_parents = (value); \
    } while (0)


/* Generated macro accessors for 'roles' attribute of Class PMC. */
#define GETATTR_Class_roles(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Class_attributes *)PMC_data(pmc))->roles; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "roles")); \
        } \
    } while (0)

#define SETATTR_Class_roles(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "roles"), value); \
        } \
        else \
            ((Parrot_Class_attributes *)PMC_data(pmc))->roles = (value); \
    } while (0)


/* Generated macro accessors for 'methods' attribute of Class PMC. */
#define GETATTR_Class_methods(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Class_attributes *)PMC_data(pmc))->methods; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "methods")); \
        } \
    } while (0)

#define SETATTR_Class_methods(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "methods"), value); \
        } \
        else \
            ((Parrot_Class_attributes *)PMC_data(pmc))->methods = (value); \
    } while (0)


/* Generated macro accessors for 'vtable_overrides' attribute of Class PMC. */
#define GETATTR_Class_vtable_overrides(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Class_attributes *)PMC_data(pmc))->vtable_overrides; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "vtable_overrides")); \
        } \
    } while (0)

#define SETATTR_Class_vtable_overrides(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "vtable_overrides"), value); \
        } \
        else \
            ((Parrot_Class_attributes *)PMC_data(pmc))->vtable_overrides = (value); \
    } while (0)


/* Generated macro accessors for 'attrib_metadata' attribute of Class PMC. */
#define GETATTR_Class_attrib_metadata(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Class_attributes *)PMC_data(pmc))->attrib_metadata; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "attrib_metadata")); \
        } \
    } while (0)

#define SETATTR_Class_attrib_metadata(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "attrib_metadata"), value); \
        } \
        else \
            ((Parrot_Class_attributes *)PMC_data(pmc))->attrib_metadata = (value); \
    } while (0)


/* Generated macro accessors for 'attrib_index' attribute of Class PMC. */
#define GETATTR_Class_attrib_index(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Class_attributes *)PMC_data(pmc))->attrib_index; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "attrib_index")); \
        } \
    } while (0)

#define SETATTR_Class_attrib_index(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "attrib_index"), value); \
        } \
        else \
            ((Parrot_Class_attributes *)PMC_data(pmc))->attrib_index = (value); \
    } while (0)


/* Generated macro accessors for 'attrib_cache' attribute of Class PMC. */
#define GETATTR_Class_attrib_cache(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Class_attributes *)PMC_data(pmc))->attrib_cache; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "attrib_cache")); \
        } \
    } while (0)

#define SETATTR_Class_attrib_cache(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "attrib_cache"), value); \
        } \
        else \
            ((Parrot_Class_attributes *)PMC_data(pmc))->attrib_cache = (value); \
    } while (0)


/* Generated macro accessors for 'resolve_method' attribute of Class PMC. */
#define GETATTR_Class_resolve_method(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Class_attributes *)PMC_data(pmc))->resolve_method; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "resolve_method")); \
        } \
    } while (0)

#define SETATTR_Class_resolve_method(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "resolve_method"), value); \
        } \
        else \
            ((Parrot_Class_attributes *)PMC_data(pmc))->resolve_method = (value); \
    } while (0)


/* Generated macro accessors for 'parent_overrides' attribute of Class PMC. */
#define GETATTR_Class_parent_overrides(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Class_attributes *)PMC_data(pmc))->parent_overrides; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "parent_overrides")); \
        } \
    } while (0)

#define SETATTR_Class_parent_overrides(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "parent_overrides"), value); \
        } \
        else \
            ((Parrot_Class_attributes *)PMC_data(pmc))->parent_overrides = (value); \
    } while (0)


/* Generated macro accessors for 'meth_cache' attribute of Class PMC. */
#define GETATTR_Class_meth_cache(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Class_attributes *)PMC_data(pmc))->meth_cache; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "meth_cache")); \
        } \
    } while (0)

#define SETATTR_Class_meth_cache(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "meth_cache"), value); \
        } \
        else \
            ((Parrot_Class_attributes *)PMC_data(pmc))->meth_cache = (value); \
    } while (0)


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

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


#endif /* PARROT_PMC_CLASS_H_GUARD */

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

