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

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


#ifndef PARROT_PMC_ARRAYITERATOR_H_GUARD
#define PARROT_PMC_ARRAYITERATOR_H_GUARD

PARROT_EXPORT VTABLE* Parrot_ArrayIterator_update_vtable(ARGMOD(VTABLE*));
PARROT_EXPORT VTABLE* Parrot_ArrayIterator_ro_update_vtable(ARGMOD(VTABLE*));
PARROT_EXPORT VTABLE* Parrot_ArrayIterator_get_vtable(PARROT_INTERP);
PARROT_EXPORT VTABLE* Parrot_ArrayIterator_ro_get_vtable(PARROT_INTERP);
PARROT_EXPORT PMC*    Parrot_ArrayIterator_get_mro(PARROT_INTERP, ARGMOD(PMC* mro));
PARROT_EXPORT Hash*   Parrot_ArrayIterator_get_isa(PARROT_INTERP, ARGMOD_NULLOK(Hash* isa));

/* ArrayIterator PMC's underlying struct. */
typedef struct Parrot_ArrayIterator_attributes {
    PMC    * array;
    INTVAL pos;
    INTVAL length;
    INTVAL reverse;
} Parrot_ArrayIterator_attributes;

/* Macro to access underlying structure of a ArrayIterator PMC. */
#define PARROT_ARRAYITERATOR(o) ((Parrot_ArrayIterator_attributes *) PMC_data(o))


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

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


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

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


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

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


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

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


#endif /* PARROT_PMC_ARRAYITERATOR_H_GUARD */

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

