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

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


#ifndef PARROT_PMC_CONTINUATION_H_GUARD
#define PARROT_PMC_CONTINUATION_H_GUARD

PARROT_EXPORT VTABLE* Parrot_Continuation_update_vtable(ARGMOD(VTABLE*));
PARROT_EXPORT VTABLE* Parrot_Continuation_ro_update_vtable(ARGMOD(VTABLE*));
PARROT_EXPORT VTABLE* Parrot_Continuation_get_vtable(PARROT_INTERP);
PARROT_EXPORT VTABLE* Parrot_Continuation_ro_get_vtable(PARROT_INTERP);
PARROT_EXPORT PMC*    Parrot_Continuation_get_mro(PARROT_INTERP, ARGMOD(PMC* mro));
PARROT_EXPORT Hash*   Parrot_Continuation_get_isa(PARROT_INTERP, ARGMOD_NULLOK(Hash* isa));

/* Continuation PMC's underlying struct. */
typedef struct Parrot_Continuation_attributes {
    PackFile_ByteCode * seg;
    opcode_t          * address;
    PMC               * to_ctx;
    PMC               * to_call_object;
    PMC               * from_ctx;
    INTVAL runloop_id;
    INTVAL invoked;
} Parrot_Continuation_attributes;

/* Macro to access underlying structure of a Continuation PMC. */
#define PARROT_CONTINUATION(o) ((Parrot_Continuation_attributes *) PMC_data(o))


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

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


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

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


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

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


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

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


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

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


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

#define SETATTR_Continuation_runloop_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, "runloop_id"), attr_value); \
        } \
        else \
            ((Parrot_Continuation_attributes *)PMC_data(pmc))->runloop_id = (value); \
    } while (0)


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

#define SETATTR_Continuation_invoked(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, "invoked"), attr_value); \
        } \
        else \
            ((Parrot_Continuation_attributes *)PMC_data(pmc))->invoked = (value); \
    } while (0)


#endif /* PARROT_PMC_CONTINUATION_H_GUARD */

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

