/* Initializes the P6opaque representation. */ REPROps * P6opaque_initialize(PARROT_INTERP) { /* Allocate and populate the representation function table. */ this_repr = mem_allocate_zeroed_typed(REPROps); this_repr->type_object_for = type_object_for; this_repr->allocate = allocate; this_repr->initialize = initialize; this_repr->copy_to = copy_to; this_repr->attr_funcs = mem_allocate_typed(REPROps_Attribute); this_repr->attr_funcs->get_attribute_boxed = get_attribute_boxed; this_repr->attr_funcs->get_attribute_ref = get_attribute_ref; this_repr->attr_funcs->bind_attribute_boxed = bind_attribute_boxed; this_repr->attr_funcs->bind_attribute_ref = bind_attribute_ref; this_repr->attr_funcs->is_attribute_initialized = is_attribute_initialized; this_repr->attr_funcs->hint_for = hint_for; this_repr->box_funcs = mem_allocate_typed(REPROps_Boxing); this_repr->box_funcs->set_int = set_int; this_repr->box_funcs->get_int = get_int; this_repr->box_funcs->set_num = set_num; this_repr->box_funcs->get_num = get_num; this_repr->box_funcs->set_str = set_str; this_repr->box_funcs->get_str = get_str; this_repr->box_funcs->get_boxed_ref = get_boxed_ref; this_repr->gc_mark = gc_mark; this_repr->gc_free = gc_free; this_repr->gc_mark_repr_data = gc_mark_repr_data; this_repr->gc_free_repr_data = gc_free_repr_data; this_repr->get_storage_spec = get_storage_spec; this_repr->change_type = change_type; this_repr->serialize = serialize; this_repr->deserialize = deserialize; this_repr->serialize_repr_data = serialize_repr_data; this_repr->deserialize_repr_data = deserialize_repr_data; smo_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "SixModelObject", 0)); return this_repr; }
/* Initializes the P6opaque representation. */ REPROps * P6opaque_initialize(PARROT_INTERP) { /* Allocate and populate the representation function table. */ this_repr = mem_allocate_zeroed_typed(REPROps); this_repr->type_object_for = type_object_for; this_repr->instance_of = instance_of; this_repr->defined = defined; this_repr->get_attribute = get_attribute; this_repr->get_attribute_int = get_attribute_int; this_repr->get_attribute_num = get_attribute_num; this_repr->get_attribute_str = get_attribute_str; this_repr->bind_attribute = bind_attribute; this_repr->bind_attribute_int = bind_attribute_int; this_repr->bind_attribute_num = bind_attribute_num; this_repr->bind_attribute_str = bind_attribute_str; this_repr->hint_for = hint_for; this_repr->clone = repr_clone; this_repr->set_int = set_int; this_repr->get_int = get_int; this_repr->set_num = set_num; this_repr->get_num = get_num; this_repr->set_str = set_str; this_repr->get_str = get_str; this_repr->gc_mark = gc_mark; this_repr->gc_free = gc_free; this_repr->gc_mark_repr = gc_mark_repr; this_repr->gc_free_repr = gc_free_repr; this_repr->get_storage_spec = get_storage_spec; this_repr->is_attribute_initialized = is_attribute_initialized; this_repr->change_type = change_type; return this_repr; }
/* Initializes the P6bigint representation. */ REPROps * P6bigint_initialize(PARROT_INTERP, PMC * (* wrap_object_func_ptr) (PARROT_INTERP, void *obj), PMC * (* create_stable_func_ptr) (PARROT_INTERP, REPROps *REPR, PMC *HOW)) { /* Stash away functions passed wrapping functions. */ wrap_object_func = wrap_object_func_ptr; create_stable_func = create_stable_func_ptr; /* Allocate and populate the representation function table. */ this_repr = mem_allocate_zeroed_typed(REPROps); this_repr->type_object_for = type_object_for; this_repr->allocate = allocate; this_repr->initialize = initialize; this_repr->copy_to = copy_to; this_repr->box_funcs = mem_allocate_typed(REPROps_Boxing); this_repr->box_funcs->set_int = set_int; this_repr->box_funcs->get_int = get_int; this_repr->box_funcs->set_num = set_num; this_repr->box_funcs->get_num = get_num; this_repr->box_funcs->set_str = set_str; this_repr->box_funcs->get_str = get_str; this_repr->box_funcs->get_boxed_ref = get_boxed_ref; this_repr->gc_free = gc_free; this_repr->gc_cleanup = gc_cleanup; this_repr->get_storage_spec = get_storage_spec; return this_repr; }
/* Initializes the P6bigint representation. */ REPROps * P6bigint_initialize(PARROT_INTERP, wrap_object_t wrap_object_func_ptr, create_stable_t create_stable_func_ptr) { UNUSED(interp); /* Stash away functions passed wrapping functions. */ wrap_object_func = wrap_object_func_ptr; create_stable_func = create_stable_func_ptr; /* Allocate and populate the representation function table. */ this_repr = mem_allocate_zeroed_typed(REPROps); this_repr->type_object_for = type_object_for; this_repr->compose = compose; this_repr->allocate = allocate; this_repr->initialize = initialize; this_repr->copy_to = copy_to; this_repr->box_funcs = mem_allocate_typed(REPROps_Boxing); this_repr->box_funcs->set_int = set_int; this_repr->box_funcs->get_int = get_int; this_repr->box_funcs->set_num = set_num; this_repr->box_funcs->get_num = get_num; this_repr->box_funcs->set_str = set_str; this_repr->box_funcs->get_str = get_str; this_repr->box_funcs->get_boxed_ref = get_boxed_ref; this_repr->gc_free = gc_free; this_repr->gc_cleanup = gc_cleanup; this_repr->get_storage_spec = get_storage_spec; this_repr->serialize = serialize; this_repr->deserialize = deserialize; return this_repr; }
/* Initializes the HashAttrStore representation. */ PMC * HashAttrStore_initialize(PARROT_INTERP) { /* Allocate and populate the representation function table. */ REPRCommonalities *repr = mem_allocate_zeroed_typed(REPRCommonalities); repr->type_object_for = type_object_for; repr->instance_of = instance_of; repr->defined = defined; repr->get_attribute = get_attribute; repr->get_attribute_int = get_attribute_int; repr->get_attribute_num = get_attribute_num; repr->get_attribute_str = get_attribute_str; repr->bind_attribute = bind_attribute; repr->bind_attribute_int = bind_attribute_int; repr->bind_attribute_num = bind_attribute_num; repr->bind_attribute_str = bind_attribute_str; repr->hint_for = hint_for; repr->clone = repr_clone; repr->set_int = set_int; repr->get_int = get_int; repr->set_num = set_num; repr->get_num = get_num; repr->set_str = set_str; repr->get_str = get_str; repr->gc_mark = gc_mark; repr->gc_free = gc_free; repr->get_storage_spec = get_storage_spec; repr->is_attribute_initialized = is_attribute_initialized; /* Wrap it in a PMC. */ return (this_repr = wrap_repr(interp, repr)); }
/* Initializes the P6num representation. */ REPROps * P6num_initialize(PARROT_INTERP) { UNUSED(interp); /* Allocate and populate the representation function table. */ this_repr = mem_allocate_zeroed_typed(REPROps); this_repr->type_object_for = type_object_for; this_repr->compose = compose; this_repr->allocate = allocate; this_repr->initialize = initialize; this_repr->copy_to = copy_to; this_repr->box_funcs = mem_allocate_typed(REPROps_Boxing); this_repr->box_funcs->set_int = set_int; this_repr->box_funcs->get_int = get_int; this_repr->box_funcs->set_num = set_num; this_repr->box_funcs->get_num = get_num; this_repr->box_funcs->set_str = set_str; this_repr->box_funcs->get_str = get_str; this_repr->box_funcs->get_boxed_ref = get_boxed_ref; this_repr->gc_free = gc_free; this_repr->get_storage_spec = get_storage_spec; this_repr->serialize = serialize; this_repr->deserialize = deserialize; this_repr->serialize_repr_data = serialize_repr_data; this_repr->deserialize_repr_data = deserialize_repr_data; return this_repr; }
/* Creates a new instance based on the type object. */ static PMC * instance_of(PARROT_INTERP, PMC *WHAT) { KnowHOWREPRInstance *obj = mem_allocate_zeroed_typed(KnowHOWREPRInstance); obj->common.stable = STABLE_PMC(WHAT); obj->methods = pmc_new(interp, enum_class_Hash); obj->attributes = pmc_new(interp, enum_class_ResizablePMCArray); return wrap_object(interp, obj); }
/* Clones the current object. This involves cloning the method and * attribute lists and copying the (immutable string) name. */ static PMC * repr_clone(PARROT_INTERP, PMC *to_clone) { KnowHOWREPRInstance *obj = mem_allocate_zeroed_typed(KnowHOWREPRInstance); obj->common.stable = STABLE_PMC(to_clone); obj->methods = VTABLE_clone(interp, ((KnowHOWREPRInstance *)PMC_data(to_clone))->methods); obj->attributes = VTABLE_clone(interp, ((KnowHOWREPRInstance *)PMC_data(to_clone))->attributes); obj->name = ((KnowHOWREPRInstance *)PMC_data(to_clone))->name; return wrap_object(interp, obj); }
PARROT_EXPORT PARROT_CANNOT_RETURN_NULL Parrot_Pointer_Array * Parrot_pa_new(PARROT_INTERP) { ASSERT_ARGS(Parrot_pa_new) Parrot_Pointer_Array *res = mem_allocate_zeroed_typed(Parrot_Pointer_Array); return res; }
/* Creates a new type object of this representation, and associates it with * the given HOW. */ static PMC * type_object_for(PARROT_INTERP, PMC *HOW) { /* Create new object instance. */ P6opaqueInstance *obj = mem_allocate_zeroed_typed(P6opaqueInstance); /* Build an STable. */ PMC *st_pmc = create_stable(interp, this_repr, HOW); STable *st = STABLE_STRUCT(st_pmc); /* Create REPR data structure and hand it off the STable. */ st->REPR_data = mem_allocate_zeroed_typed(P6opaqueREPRData); /* Create type object and point it back at the STable. Note that we * do *not* populate the spill pointer at all, we leave it null. A * non-null value (even PMCNULL) is what indicates we have a defined * object. Yes, I know, it's sick. */ obj->common.stable = st_pmc; st->WHAT = wrap_object(interp, obj); PARROT_GC_WRITE_BARRIER(interp, st_pmc); return st->WHAT; }
/* Creates a new type object of this representation, and associates it with * the given HOW. */ static PMC * type_object_for(PARROT_INTERP, PMC *HOW) { /* Create new object instance. */ P6opaqueInstance *obj = mem_allocate_zeroed_typed(P6opaqueInstance); /* Build an STable. */ PMC *st_pmc = create_stable(interp, this_repr, HOW); STable *st = STABLE_STRUCT(st_pmc); /* Create REPR data structure and hand it off the STable. */ st->REPR_data = mem_allocate_zeroed_typed(P6opaqueREPRData); /* Create type object and point it back at the STable. */ obj->common.stable = st_pmc; st->WHAT = wrap_object(interp, obj); PARROT_GC_WRITE_BARRIER(interp, st_pmc); /* Flag it as a type object. */ MARK_AS_TYPE_OBJECT(st->WHAT); return st->WHAT; }
/* Serializes the REPR data. */ static void deserialize_repr_data(PARROT_INTERP, STable *st, SerializationReader *reader) { P6numREPRData *repr_data = (P6numREPRData *) (st->REPR_data = mem_allocate_zeroed_typed(P6numREPRData)); /* Only read in REPR data for serialization format greater than version 1. * In version 1, just set default values. */ if (reader->root.version >= 2) { repr_data->bits = reader->read_int(interp, reader); } else { repr_data->bits = sizeof(INTVAL)*8; } }
/* Initializes the VMIter representation. */ REPROps * VMIter_initialize(PARROT_INTERP) { /* Allocate and populate the representation function table. */ this_repr = mem_allocate_zeroed_typed(REPROps); this_repr->type_object_for = type_object_for; this_repr->compose = compose; this_repr->allocate = allocate; this_repr->initialize = initialize; this_repr->copy_to = copy_to; this_repr->gc_free = gc_free; this_repr->get_storage_spec = get_storage_spec; return this_repr; }
/* Creates a new type object of this representation, and associates it with * the given HOW. */ static PMC * type_object_for(PARROT_INTERP, PMC *HOW) { /* Create new object instance. */ P6numInstance *obj = mem_allocate_zeroed_typed(P6numInstance); P6numREPRData *repr_data = mem_allocate_zeroed_typed(P6numREPRData); /* Build an STable. */ PMC *st_pmc = create_stable(interp, this_repr, HOW); STable *st = STABLE_STRUCT(st_pmc); /* Set default bit width value in the REPR data and attach it to the * STable. */ repr_data->bits = sizeof(FLOATVAL)*8; st->REPR_data = repr_data; /* Create type object and point it back at the STable. */ obj->common.stable = st_pmc; st->WHAT = wrap_object(interp, obj); PARROT_GC_WRITE_BARRIER(interp, st_pmc); /* Flag it as a type object. */ MARK_AS_TYPE_OBJECT(st->WHAT); return st->WHAT; }
/* Creates a new type object of this representation, and associates it with * the given HOW. */ static PMC * type_object_for(PARROT_INTERP, PMC *HOW) { /* Create new type object instance. */ UninstantiableInstance *obj = mem_allocate_zeroed_typed(UninstantiableInstance); /* Build an STable. */ PMC *st_pmc = create_stable(interp, this_repr, HOW); STable *st = STABLE_STRUCT(st_pmc); /* Create type object and point it back at the STable. */ obj->common.stable = st_pmc; st->WHAT = wrap_object(interp, obj); PARROT_GC_WRITE_BARRIER(interp, st_pmc); return st->WHAT; }
/* Creates a new type object of this representation, and associates it with * the given HOW. */ static PMC * type_object_for(PARROT_INTERP, PMC *HOW) { /* Create new object instance. */ HashAttrStoreInstance *obj = mem_allocate_zeroed_typed(HashAttrStoreInstance); /* Build an STable. */ PMC *st_pmc = create_stable(interp, this_repr, HOW); STable *st = STABLE_STRUCT(st_pmc); /* Create type object and point it back at the STable. We leave the * hash store pointer null to flag it's the type object. */ obj->common.stable = st_pmc; st->WHAT = wrap_object(interp, obj); PARROT_GC_WRITE_BARRIER(interp, st_pmc); return st->WHAT; }
/* Initializes the KnowHOWREPR representation. */ REPROps * KnowHOWREPR_initialize(PARROT_INTERP) { UNUSED(interp); /* Allocate and populate the representation function table. */ this_repr = mem_allocate_zeroed_typed(REPROps); this_repr->type_object_for = type_object_for; this_repr->compose = compose; this_repr->allocate = allocate; this_repr->initialize = initialize; this_repr->copy_to = copy_to; this_repr->gc_mark = gc_mark; this_repr->gc_free = gc_free; this_repr->get_storage_spec = get_storage_spec; this_repr->serialize = serialize; this_repr->deserialize = deserialize; return this_repr; }
/* Clones the current object. */ static PMC * repr_clone(PARROT_INTERP, PMC *to_clone) { P6opaqueInstance *obj; P6opaqueREPRData *repr_data = (P6opaqueREPRData *)STABLE(to_clone)->REPR_data; if (defined(interp, to_clone)) { obj = (P6opaqueInstance *)Parrot_gc_allocate_fixed_size_storage(interp, repr_data->allocation_size); memcpy(obj, PMC_data(to_clone), repr_data->allocation_size); if (!PMC_IS_NULL(obj->spill)) obj->spill = VTABLE_clone(interp, obj->spill); } else { obj = mem_allocate_zeroed_typed(P6opaqueInstance); memcpy(obj, PMC_data(to_clone), sizeof(P6opaqueInstance)); } return wrap_object(interp, obj); }
/* Creates a new type object of this representation, and associates it with * the given HOW. */ static PMC * type_object_for(PARROT_INTERP, PMC *HOW) { /* Create new object instance. */ NativeCallInstance *obj = mem_allocate_zeroed_typed(NativeCallInstance); /* Build an STable. */ PMC *st_pmc = create_stable_func(interp, this_repr, HOW); STable *st = STABLE_STRUCT(st_pmc); /* Create type object and point it back at the STable. */ obj->common.stable = st_pmc; st->WHAT = wrap_object_func(interp, obj); PARROT_GC_WRITE_BARRIER(interp, st_pmc); /* Flag it as a type object. */ MARK_AS_TYPE_OBJECT(st->WHAT); return st->WHAT; }
REPROps *CStr_initialize(PARROT_INTERP, wrap_object_t wrap_object_func_ptr, create_stable_t create_stable_func_ptr) { /* Stash away functions passed wrapping functions. */ wrap_object_func = wrap_object_func_ptr; create_stable_func = create_stable_func_ptr; /* Allocate and populate the representation function table. */ this_repr = mem_allocate_zeroed_typed(REPROps); this_repr->type_object_for = type_object_for; this_repr->allocate = allocate; this_repr->initialize = initialize; this_repr->gc_free = gc_free; this_repr->get_storage_spec = get_storage_spec; this_repr->box_funcs = mem_allocate_typed(REPROps_Boxing); this_repr->box_funcs->set_str = set_str; return this_repr; }
/* Creates a new instance based on the type object. */ static PMC * allocate(PARROT_INTERP, STable *st) { P6strInstance *obj = mem_allocate_zeroed_typed(P6strInstance); obj->common.stable = st->stable_pmc; return wrap_object(interp, obj); }
/* Creates a new instance based on the type object. */ static PMC * allocate(PARROT_INTERP, STable *st) { KnowHOWREPRInstance *obj = mem_allocate_zeroed_typed(KnowHOWREPRInstance); if (st) obj->common.stable = st->stable_pmc; return wrap_object(interp, obj); }
=item C<Parrot_Pointer_Array * Parrot_pa_new(PARROT_INTERP)> Allocate new Pointer_Array. =cut */ PARROT_EXPORT PARROT_MALLOC PARROT_CANNOT_RETURN_NULL Parrot_Pointer_Array * Parrot_pa_new(PARROT_INTERP) { ASSERT_ARGS(Parrot_pa_new) Parrot_Pointer_Array * const res = mem_allocate_zeroed_typed(Parrot_Pointer_Array); return res; } /* =item C<void Parrot_pa_destroy(PARROT_INTERP, Parrot_Pointer_Array *self)> Destroy Pointer_Arra and free allocated memory. =cut */ PARROT_EXPORT void
/* Clones the current object. */ static PMC * repr_clone(PARROT_INTERP, PMC *to_clone) { UninstantiableInstance *obj = mem_allocate_zeroed_typed(UninstantiableInstance); obj->common.stable = STABLE_PMC(to_clone); return wrap_object(interp, obj); }
/* Creates a new instance based on the type object. */ static PMC * instance_of(PARROT_INTERP, PMC *WHAT) { P6intInstance *obj = mem_allocate_zeroed_typed(P6intInstance); obj->common.stable = STABLE_PMC(WHAT); obj->value = 0; return wrap_object(interp, obj); }
/* Clones the current object; simply copies the value. */ static PMC * repr_clone(PARROT_INTERP, PMC *to_clone) { P6intInstance *obj = mem_allocate_zeroed_typed(P6intInstance); obj->common.stable = STABLE_PMC(to_clone); obj->value = ((P6intInstance *)PMC_data(to_clone))->value; return wrap_object(interp, obj); }