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

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


#ifndef PARROT_PMC_SUB_H_GUARD
#define PARROT_PMC_SUB_H_GUARD

PARROT_EXPORT VTABLE* Parrot_Sub_update_vtable(ARGMOD(VTABLE*));
PARROT_EXPORT VTABLE* Parrot_Sub_ro_update_vtable(ARGMOD(VTABLE*));
PARROT_EXPORT VTABLE* Parrot_Sub_get_vtable(PARROT_INTERP);
PARROT_EXPORT VTABLE* Parrot_Sub_ro_get_vtable(PARROT_INTERP);
PARROT_EXPORT PMC*    Parrot_Sub_get_mro(PARROT_INTERP, ARGMOD(PMC* mro));
PARROT_EXPORT Hash*   Parrot_Sub_get_isa(PARROT_INTERP, ARGMOD_NULLOK(Hash* isa));

/* Sub PMC's underlying struct. */
typedef struct Parrot_Sub_attributes {
    PackFile_ByteCode * seg;
    size_t start_offs;
    size_t end_offs;
    INTVAL HLL_id;
    PMC               * namespace_name;
    PMC               * namespace_stash;
    STRING            * name;
    STRING            * method_name;
    STRING            * ns_entry_name;
    STRING            * subid;
    INTVAL vtable_index;
    PMC               * multi_signature;
    UINTVAL n_regs_used[4];
    PMC               * lex_info;
    PMC               * outer_sub;
    PMC               * ctx;
    UINTVAL comp_flags;
    Parrot_sub_arginfo * arg_info;
    PMC               * outer_ctx;
} Parrot_Sub_attributes;

/* Macro to access underlying structure of a Sub PMC. */
#define PARROT_SUB(o) ((Parrot_Sub_attributes *) PMC_data(o))


/* Generated macro accessors for 'seg' attribute of Sub PMC. */
#define GETATTR_Sub_seg(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Sub_attributes *)PMC_data(pmc))->seg; \
        } \
        else { \
            Parrot_ex_throw_from_c_noargs(interp, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'PackFile_ByteCode *' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
    } while (0)
#define SETATTR_Sub_seg(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            Parrot_ex_throw_from_c_noargs(interp, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'PackFile_ByteCode *' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
        else \
            ((Parrot_Sub_attributes *)PMC_data(pmc))->seg = (value); \
    } while (0)


/* Generated macro accessors for 'start_offs' attribute of Sub PMC. */
#define GETATTR_Sub_start_offs(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Sub_attributes *)PMC_data(pmc))->start_offs; \
        } \
        else { \
            Parrot_ex_throw_from_c_noargs(interp, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'size_t' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
    } while (0)
#define SETATTR_Sub_start_offs(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            Parrot_ex_throw_from_c_noargs(interp, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'size_t' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
        else \
            ((Parrot_Sub_attributes *)PMC_data(pmc))->start_offs = (value); \
    } while (0)


/* Generated macro accessors for 'end_offs' attribute of Sub PMC. */
#define GETATTR_Sub_end_offs(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Sub_attributes *)PMC_data(pmc))->end_offs; \
        } \
        else { \
            Parrot_ex_throw_from_c_noargs(interp, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'size_t' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
    } while (0)
#define SETATTR_Sub_end_offs(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            Parrot_ex_throw_from_c_noargs(interp, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'size_t' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
        else \
            ((Parrot_Sub_attributes *)PMC_data(pmc))->end_offs = (value); \
    } while (0)


/* Generated macro accessors for 'HLL_id' attribute of Sub PMC. */
#define GETATTR_Sub_HLL_id(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Sub_attributes *)PMC_data(pmc))->HLL_id; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "HLL_id")); \
            (dest) = (PMC_IS_NULL(attr_value) ? (INTVAL) 0: VTABLE_get_integer(interp, attr_value)); \
        } \
    } while (0)
#define SETATTR_Sub_HLL_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, "HLL_id"), attr_value); \
        } \
        else \
            ((Parrot_Sub_attributes *)PMC_data(pmc))->HLL_id = (value); \
    } while (0)


/* Generated macro accessors for 'namespace_name' attribute of Sub PMC. */
#define GETATTR_Sub_namespace_name(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Sub_attributes *)PMC_data(pmc))->namespace_name; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "namespace_name")); \
        } \
    } while (0)
#define SETATTR_Sub_namespace_name(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "namespace_name"), value); \
        } \
        else \
            ((Parrot_Sub_attributes *)PMC_data(pmc))->namespace_name = (value); \
    } while (0)


/* Generated macro accessors for 'namespace_stash' attribute of Sub PMC. */
#define GETATTR_Sub_namespace_stash(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Sub_attributes *)PMC_data(pmc))->namespace_stash; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "namespace_stash")); \
        } \
    } while (0)
#define SETATTR_Sub_namespace_stash(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "namespace_stash"), value); \
        } \
        else \
            ((Parrot_Sub_attributes *)PMC_data(pmc))->namespace_stash = (value); \
    } while (0)


/* Generated macro accessors for 'name' attribute of Sub PMC. */
#define GETATTR_Sub_name(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Sub_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_Sub_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_Sub_attributes *)PMC_data(pmc))->name = (value); \
    } while (0)


/* Generated macro accessors for 'method_name' attribute of Sub PMC. */
#define GETATTR_Sub_method_name(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Sub_attributes *)PMC_data(pmc))->method_name; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "method_name")); \
            (dest) =  (PMC_IS_NULL(attr_value) ? (STRING *)NULL : VTABLE_get_string(interp, attr_value)); \
        } \
    } while (0)
#define SETATTR_Sub_method_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, "method_name"), attr_value); \
        } \
        else \
            ((Parrot_Sub_attributes *)PMC_data(pmc))->method_name = (value); \
    } while (0)


/* Generated macro accessors for 'ns_entry_name' attribute of Sub PMC. */
#define GETATTR_Sub_ns_entry_name(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Sub_attributes *)PMC_data(pmc))->ns_entry_name; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "ns_entry_name")); \
            (dest) =  (PMC_IS_NULL(attr_value) ? (STRING *)NULL : VTABLE_get_string(interp, attr_value)); \
        } \
    } while (0)
#define SETATTR_Sub_ns_entry_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, "ns_entry_name"), attr_value); \
        } \
        else \
            ((Parrot_Sub_attributes *)PMC_data(pmc))->ns_entry_name = (value); \
    } while (0)


/* Generated macro accessors for 'subid' attribute of Sub PMC. */
#define GETATTR_Sub_subid(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Sub_attributes *)PMC_data(pmc))->subid; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "subid")); \
            (dest) =  (PMC_IS_NULL(attr_value) ? (STRING *)NULL : VTABLE_get_string(interp, attr_value)); \
        } \
    } while (0)
#define SETATTR_Sub_subid(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, "subid"), attr_value); \
        } \
        else \
            ((Parrot_Sub_attributes *)PMC_data(pmc))->subid = (value); \
    } while (0)


/* Generated macro accessors for 'vtable_index' attribute of Sub PMC. */
#define GETATTR_Sub_vtable_index(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Sub_attributes *)PMC_data(pmc))->vtable_index; \
        } \
        else { \
            PMC * const attr_value = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "vtable_index")); \
            (dest) = (PMC_IS_NULL(attr_value) ? (INTVAL) 0: VTABLE_get_integer(interp, attr_value)); \
        } \
    } while (0)
#define SETATTR_Sub_vtable_index(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, "vtable_index"), attr_value); \
        } \
        else \
            ((Parrot_Sub_attributes *)PMC_data(pmc))->vtable_index = (value); \
    } while (0)


/* Generated macro accessors for 'multi_signature' attribute of Sub PMC. */
#define GETATTR_Sub_multi_signature(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Sub_attributes *)PMC_data(pmc))->multi_signature; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "multi_signature")); \
        } \
    } while (0)
#define SETATTR_Sub_multi_signature(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "multi_signature"), value); \
        } \
        else \
            ((Parrot_Sub_attributes *)PMC_data(pmc))->multi_signature = (value); \
    } while (0)


/* Generated macro accessors for 'n_regs_used' attribute of Sub PMC. */
#define GETATTR_Sub_n_regs_used(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Sub_attributes *)PMC_data(pmc))->n_regs_used; \
        } \
        else { \
            Parrot_ex_throw_from_c_noargs(interp, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'UINTVAL' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
    } while (0)
#define SETATTR_Sub_n_regs_used(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            Parrot_ex_throw_from_c_noargs(interp, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'UINTVAL' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
        else \
            ((Parrot_Sub_attributes *)PMC_data(pmc))->n_regs_used = (value); \
    } while (0)


/* Generated macro accessors for 'lex_info' attribute of Sub PMC. */
#define GETATTR_Sub_lex_info(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Sub_attributes *)PMC_data(pmc))->lex_info; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "lex_info")); \
        } \
    } while (0)
#define SETATTR_Sub_lex_info(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "lex_info"), value); \
        } \
        else \
            ((Parrot_Sub_attributes *)PMC_data(pmc))->lex_info = (value); \
    } while (0)


/* Generated macro accessors for 'outer_sub' attribute of Sub PMC. */
#define GETATTR_Sub_outer_sub(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Sub_attributes *)PMC_data(pmc))->outer_sub; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "outer_sub")); \
        } \
    } while (0)
#define SETATTR_Sub_outer_sub(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "outer_sub"), value); \
        } \
        else \
            ((Parrot_Sub_attributes *)PMC_data(pmc))->outer_sub = (value); \
    } while (0)


/* Generated macro accessors for 'ctx' attribute of Sub PMC. */
#define GETATTR_Sub_ctx(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Sub_attributes *)PMC_data(pmc))->ctx; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "ctx")); \
        } \
    } while (0)
#define SETATTR_Sub_ctx(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "ctx"), value); \
        } \
        else \
            ((Parrot_Sub_attributes *)PMC_data(pmc))->ctx = (value); \
    } while (0)


/* Generated macro accessors for 'comp_flags' attribute of Sub PMC. */
#define GETATTR_Sub_comp_flags(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Sub_attributes *)PMC_data(pmc))->comp_flags; \
        } \
        else { \
            Parrot_ex_throw_from_c_noargs(interp, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'UINTVAL' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
    } while (0)
#define SETATTR_Sub_comp_flags(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            Parrot_ex_throw_from_c_noargs(interp, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'UINTVAL' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
        else \
            ((Parrot_Sub_attributes *)PMC_data(pmc))->comp_flags = (value); \
    } while (0)


/* Generated macro accessors for 'arg_info' attribute of Sub PMC. */
#define GETATTR_Sub_arg_info(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Sub_attributes *)PMC_data(pmc))->arg_info; \
        } \
        else { \
            Parrot_ex_throw_from_c_noargs(interp, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'Parrot_sub_arginfo *' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
    } while (0)
#define SETATTR_Sub_arg_info(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            Parrot_ex_throw_from_c_noargs(interp, EXCEPTION_INVALID_OPERATION, \
                "Attributes of type 'Parrot_sub_arginfo *' cannot be " \
                "subclassed from a high-level PMC."); \
        } \
        else \
            ((Parrot_Sub_attributes *)PMC_data(pmc))->arg_info = (value); \
    } while (0)


/* Generated macro accessors for 'outer_ctx' attribute of Sub PMC. */
#define GETATTR_Sub_outer_ctx(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_Sub_attributes *)PMC_data(pmc))->outer_ctx; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "outer_ctx")); \
        } \
    } while (0)
#define SETATTR_Sub_outer_ctx(interp, pmc, value) \
    do { \
        if (PObj_is_object_TEST(pmc)) { \
            VTABLE_set_attr_str(interp, pmc, \
                              Parrot_str_new_constant(interp, "outer_ctx"), value); \
        } \
        else \
            ((Parrot_Sub_attributes *)PMC_data(pmc))->outer_ctx = (value); \
    } while (0)


#endif /* PARROT_PMC_SUB_H_GUARD */

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

