示例#1
0
文件: P6int.c 项目: felliott/nqp
/* Initializes the P6int representation. */
PMC * P6int_initialize(PARROT_INTERP) {
    /* Allocate and populate the representation function table. */
    REPRCommonalities *repr = mem_allocate_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->gc_mark_repr = NULL;
    repr->gc_free_repr = NULL;
    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));
}
示例#2
0
文件: CPointer.c 项目: TiMBuS/nqp
/* Initializes the CPointer representation. */
REPROps * CPointer_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->get_storage_spec = get_storage_spec;
    return this_repr;
}
示例#3
0
文件: P6str.c 项目: plobsing/nqp
/* Initializes the P6str representation. */
REPROps * P6str_initialize(PARROT_INTERP) {
    /* Allocate and populate the representation function table. */
    this_repr = mem_allocate_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 = NULL;
    this_repr->gc_free_repr = NULL;
    this_repr->get_storage_spec = get_storage_spec;
    this_repr->is_attribute_initialized = is_attribute_initialized;
    return this_repr;
}
示例#4
0
文件: P6num.c 项目: TiMBuS/nqp
/* 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;
}
示例#5
0
/* Set default associative functions on a REPR that lacks them. */
static void add_default_ass_funcs(PARROT_INTERP, REPROps *repr) {
    UNUSED(interp);
    repr->ass_funcs = mem_allocate_typed(REPROps_Associative);
    repr->ass_funcs->at_key_boxed = default_at_key_boxed;
    repr->ass_funcs->bind_key_boxed = default_bind_key_boxed;
    repr->ass_funcs->exists_key = default_exists_key;
    repr->ass_funcs->delete_key = default_delete_key;
}
示例#6
0
/* Set default attribute functions on a REPR that lacks them. */
static void add_default_attr_funcs(PARROT_INTERP, REPROps *repr) {
    repr->attr_funcs = mem_allocate_typed(REPROps_Attribute);
    repr->attr_funcs->get_attribute_boxed = default_get_attribute_boxed;
    repr->attr_funcs->get_attribute_ref = default_get_attribute_ref;
    repr->attr_funcs->bind_attribute_boxed = default_bind_attribute_boxed;
    repr->attr_funcs->bind_attribute_ref = default_bind_attribute_ref;
    repr->attr_funcs->is_attribute_initialized = default_is_attribute_initialized;
    repr->attr_funcs->hint_for = default_hint_for;
}
示例#7
0
/* Set default boxing functions on a REPR that lacks them. */
static void add_default_box_funcs(PARROT_INTERP, REPROps *repr) {
    repr->box_funcs = mem_allocate_typed(REPROps_Boxing);
    repr->box_funcs->set_int = default_set_int;
    repr->box_funcs->get_int = default_get_int;
    repr->box_funcs->set_num = default_set_num;
    repr->box_funcs->get_num = default_get_num;
    repr->box_funcs->set_str = default_set_str;
    repr->box_funcs->get_str = default_get_str;
    repr->box_funcs->get_boxed_ref = default_get_boxed_ref;
}
示例#8
0
static void
allocate_more_chunks(PARROT_INTERP, ARGIN(Parrot_Pointer_Array *self))
{
    ASSERT_ARGS(allocate_more_chunks)
    self->current_chunk = self->total_chunks++;
    mem_realloc_n_typed(self->chunks,
            self->total_chunks,
            Parrot_Pointer_Array_Chunk*);
    self->chunks[self->current_chunk] = mem_allocate_typed(Parrot_Pointer_Array_Chunk);
    self->chunks[self->current_chunk]->num_free  = CELL_PER_CHUNK;
    self->chunks[self->current_chunk]->next_free = 0;
}
示例#9
0
/* Set default positional functions on a REPR that lacks them. */
static void add_default_pos_funcs(PARROT_INTERP, REPROps *repr) {
    UNUSED(interp);
    repr->pos_funcs = mem_allocate_typed(REPROps_Positional);
    repr->pos_funcs->at_pos_native = default_at_pos_native;
    repr->pos_funcs->at_pos_boxed = default_at_pos_boxed;
    repr->pos_funcs->bind_pos_native = default_bind_pos_native;
    repr->pos_funcs->bind_pos_boxed = default_bind_pos_boxed;
    repr->pos_funcs->push_boxed = default_push_boxed;
    repr->pos_funcs->pop_boxed = default_pop_boxed;
    repr->pos_funcs->unshift_boxed = default_unshift_boxed;
    repr->pos_funcs->shift_boxed = default_shift_boxed;
    repr->pos_funcs->get_elem_stable = default_get_elem_stable;
}
示例#10
0
/* Set default indexing functions on a REPR that lacks them. */
static void add_default_idx_funcs(PARROT_INTERP, REPROps *repr) {
    repr->idx_funcs = mem_allocate_typed(REPROps_Indexing);
    repr->idx_funcs->at_pos_ref = default_at_pos_ref;
    repr->idx_funcs->at_pos_boxed = default_at_pos_boxed;
    repr->idx_funcs->bind_pos_ref = default_bind_pos_ref;
    repr->idx_funcs->bind_pos_boxed = default_bind_pos_boxed;
    repr->idx_funcs->elems = default_elems;
    repr->idx_funcs->preallocate = default_preallocate;
    repr->idx_funcs->trim_to = default_trim_to;
    repr->idx_funcs->make_hole = default_make_hole;
    repr->idx_funcs->delete_elems = default_delete_elems;
    repr->idx_funcs->get_elem_stable = default_get_elem_stable;
}
示例#11
0
void
Parrot_runcore_exec_init(PARROT_INTERP)
{
    ASSERT_ARGS(Parrot_runcore_exec_init)

    Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
    coredata->name             = CONST_STRING(interp, "exec");
    coredata->id               = PARROT_EXEC_CORE;
    coredata->opinit           = PARROT_CORE_OPLIB_INIT;
    coredata->runops           = runops_exec_core;
    coredata->destroy          = NULL;
    coredata->prepare_run      = NULL;
    coredata->flags            = 0;

    Parrot_runcore_register(interp, coredata);
}
示例#12
0
void
Parrot_runcore_debugger_init(PARROT_INTERP)
{
    ASSERT_ARGS(Parrot_runcore_debugger_init)

    Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
    coredata->name             = CONST_STRING(interp, "debugger");
    coredata->id               = PARROT_DEBUGGER_CORE;
    coredata->opinit           = PARROT_CORE_OPLIB_INIT;
    coredata->prepare_run      = init_prederef;
    coredata->runops           = runops_debugger_core;
    coredata->destroy          = NULL;
    coredata->flags            = 0;

    PARROT_RUNCORE_FUNC_TABLE_SET(coredata);

    Parrot_runcore_register(interp, coredata);
}
示例#13
0
void
Parrot_runcore_switch_init(PARROT_INTERP)
{
    ASSERT_ARGS(Parrot_runcore_switch_init)

    Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
    coredata->name             = CONST_STRING(interp, "switch");
    coredata->id               = PARROT_SWITCH_CORE;
    coredata->opinit           = PARROT_CORE_SWITCH_OPLIB_INIT;
    coredata->runops           = runops_switch_core;
    coredata->prepare_run      = init_prederef;
    coredata->destroy          = NULL;
    coredata->flags            = 0;

    PARROT_RUNCORE_PREDEREF_OPS_SET(coredata);

    Parrot_runcore_register(interp, coredata);
}
示例#14
0
void
Parrot_runcore_cgoto_init(PARROT_INTERP)
{
    ASSERT_ARGS(Parrot_runcore_cgoto_init)

    Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
    coredata->name             = CONST_STRING(interp, "cgoto");
    coredata->id               = PARROT_CGOTO_CORE;
    coredata->opinit           = PARROT_CORE_CG_OPLIB_INIT;
    coredata->runops           = runops_cgoto_core;
    coredata->destroy          = NULL;
    coredata->prepare_run      = NULL;
    coredata->flags            = 0;

    PARROT_RUNCORE_FUNC_TABLE_SET(coredata);
    PARROT_RUNCORE_CGOTO_OPS_SET(coredata);

    Parrot_runcore_register(interp, coredata);
}
示例#15
0
文件: CStr.c 项目: fgomezrdz/nqp
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;
}
示例#16
0
void
Parrot_runcore_cgp_init(PARROT_INTERP)
{
    ASSERT_ARGS(Parrot_runcore_cgp_init)

    Parrot_runcore_t *coredata = mem_allocate_typed(Parrot_runcore_t);
    coredata->name             = CONST_STRING(interp, "cgp");
    coredata->id               = PARROT_CGP_CORE;
    coredata->opinit           = PARROT_CORE_CGP_OPLIB_INIT;
    coredata->prepare_run      = init_prederef;
    coredata->runops           = runops_cgp_core;
    coredata->flags            = 0;

    coredata->destroy          = NULL;

    PARROT_RUNCORE_CGOTO_OPS_SET(coredata);
    PARROT_RUNCORE_EVENT_CHECK_SET(coredata);
    PARROT_RUNCORE_PREDEREF_OPS_SET(coredata);

    Parrot_runcore_register(interp, coredata);
}