• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PMC_data函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中PMC_data函数的典型用法代码示例。如果您正苦于以下问题:C++ PMC_data函数的具体用法?C++ PMC_data怎么用?C++ PMC_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了PMC_data函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: gc_free

/* This Parrot-specific addition to the API is used to free an object. */
static void gc_free(PARROT_INTERP, PMC *obj) {
    P6opaqueREPRData *repr_data = (P6opaqueREPRData *)STABLE(obj)->REPR_data;
	if (repr_data->allocation_size)
		Parrot_gc_free_fixed_size_storage(interp, repr_data->allocation_size, PMC_data(obj));
	else
		mem_sys_free(PMC_data(obj));
    PMC_data(obj) = NULL;
}
开发者ID:ruz,项目名称:nqp,代码行数:9,代码来源:P6opaque.c


示例2: repr_clone

/* 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);
}
开发者ID:plobsing,项目名称:nqp,代码行数:10,代码来源:KnowHOWREPR.c


示例3: gc_free

/* This Parrot-specific addition to the API is used to free an object. */
static void gc_free(PARROT_INTERP, PMC *obj) {
    NFAInstance *nfa = (NFAInstance *)PMC_data(obj);
    INTVAL i;
    for (i = 0; i < nfa->body.num_states; i++)
        if (nfa->body.states[i])
            mem_sys_free(nfa->body.states[i]);
    mem_sys_free(nfa->body.num_state_edges);
    mem_sys_free(nfa);
    PMC_data(obj) = NULL;
}
开发者ID:bdw,项目名称:nqp,代码行数:11,代码来源:NFA.c


示例4: name

/* Introspects the name. */
static void name(PARROT_INTERP, PMC *nci) {
    PMC * unused;
    PMC    *capture = Parrot_pcc_get_signature(interp, CURRENT_CONTEXT(interp));
    PMC    *self    = VTABLE_get_pmc_keyed_int(interp, capture, 0);
    STRING *name    = ((KnowHOWREPRInstance *)PMC_data(self))->body.name;
    unused = Parrot_pcc_build_call_from_c_args(interp, capture, "S", name);
}
开发者ID:gitpan,项目名称:Rakudo-Star,代码行数:8,代码来源:knowhow_bootstrapper.c


示例5: new_type

/* Creates a new type with this HOW as its meta-object. */
static void new_type(PARROT_INTERP, PMC *nci) {
    PMC * unused;
    /* We first create a new HOW instance. */
    PMC *capture = Parrot_pcc_get_signature(interp, CURRENT_CONTEXT(interp));
    PMC *self    = VTABLE_get_pmc_keyed_int(interp, capture, 0);
    PMC *HOW     = REPR(self)->allocate(interp, STABLE(self));
    
    /* See if we have a representation name; if not default to P6opaque. */
    STRING *repr_name = VTABLE_exists_keyed_str(interp, capture, repr_str) ?
        VTABLE_get_string_keyed_str(interp, capture, repr_str) :
        p6opaque_str;
        
    /* Create a new type object of the desired REPR. (Note that we can't
     * default to KnowHOWREPR here, since it doesn't know how to actually
     * store attributes, it's just for bootstrapping knowhow's. */
    REPROps *repr_to_use = REPR_get_by_name(interp, repr_name);
    PMC     *type_object = repr_to_use->type_object_for(interp, HOW);
    
    /* See if we were given a name; put it into the meta-object if so. */
    STRING *name = VTABLE_exists_keyed_str(interp, capture, name_str) ?
        VTABLE_get_string_keyed_str(interp, capture, name_str) :
        empty_str;
    REPR(HOW)->initialize(interp, STABLE(HOW), OBJECT_BODY(HOW));
    ((KnowHOWREPRInstance *)PMC_data(HOW))->body.name = name;
    PARROT_GC_WRITE_BARRIER(interp, HOW);
    
    /* Set .WHO to an empty hash. */
    STABLE(type_object)->WHO = Parrot_pmc_new(interp, enum_class_Hash);
    PARROT_GC_WRITE_BARRIER(interp, STABLE_PMC(type_object));

    /* Put it into capture to act as return value. */
    unused = Parrot_pcc_build_call_from_c_args(interp, capture, "P", type_object);
}
开发者ID:gitpan,项目名称:Rakudo-Star,代码行数:34,代码来源:knowhow_bootstrapper.c


示例6: methods

/* Introspects the methods. For now just hand back real method table. */
static void methods(PARROT_INTERP, PMC *nci) {
    PMC * unused;
    PMC    *capture = Parrot_pcc_get_signature(interp, CURRENT_CONTEXT(interp));
    PMC    *self    = VTABLE_get_pmc_keyed_int(interp, capture, 0);
    PMC    *meths   = ((KnowHOWREPRInstance *)PMC_data(self))->body.methods;
    unused = Parrot_pcc_build_call_from_c_args(interp, capture, "P", meths);
}
开发者ID:gitpan,项目名称:Rakudo-Star,代码行数:8,代码来源:knowhow_bootstrapper.c


示例7: is_attribute_initialized

/* Checks if an attribute has been initialized. */
static INTVAL is_attribute_initialized(PARROT_INTERP, PMC *obj, PMC *class_handle, STRING *name, INTVAL hint) {
    HashAttrStoreInstance *instance = (HashAttrStoreInstance *)PMC_data(obj);
    if (!instance->store)
        Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
                                    "Cannot access attributes in a type object");
    return VTABLE_exists_keyed_str(interp, instance->store, name);
}
开发者ID:felliott,项目名称:nqp,代码行数:8,代码来源:HashAttrStore.c


示例8: bind_attribute

/* Binds the given value to the specified attribute. */
static void bind_attribute(PARROT_INTERP, PMC *obj, PMC *class_handle, STRING *name, INTVAL hint, PMC *value) {
    HashAttrStoreInstance *instance = (HashAttrStoreInstance *)PMC_data(obj);
    if (!instance->store)
        Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
                                    "Cannot access attributes in a type object");
    VTABLE_set_pmc_keyed_str(interp, instance->store, name, value);
}
开发者ID:felliott,项目名称:nqp,代码行数:8,代码来源:HashAttrStore.c


示例9: get_attribute

/* Gets the current value for an attribute. */
static PMC * get_attribute(PARROT_INTERP, PMC *obj, PMC *class_handle, STRING *name, INTVAL hint) {
    P6opaqueInstance *instance  = (P6opaqueInstance *)PMC_data(obj);
    P6opaqueREPRData *repr_data = (P6opaqueREPRData *)STABLE(obj)->REPR_data;
    INTVAL            slot;

    /* Ensure it is a defined object. */
    if (!instance->spill)
        Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
                "Cannot access attributes in a type object");

    /* Try the slot allocation first. */
    slot = try_get_slot(interp, repr_data, class_handle, name);
    if (slot >= 0) {
        PMC *result = get_pmc_at_offset(instance, repr_data->attribute_offsets[slot]);
        if (result) {
            return result;
        }
        else {
            /* Maybe we know how to auto-viv it to a container. */
            if (repr_data->auto_viv_values) {
                PMC *value = repr_data->auto_viv_values[slot];
                if (value != NULL) {
                    value = REPR(value)->clone(interp, value);
                    set_pmc_at_offset(instance, repr_data->attribute_offsets[slot], value);
                    return value;
                }
            }
            return PMCNULL;
        }
    }
    
    /* Otherwise, complain that the attribute doesn't exist. */
    no_such_attribute(interp, "get", class_handle, name);
}
开发者ID:ruz,项目名称:nqp,代码行数:35,代码来源:P6opaque.c


示例10: gc_mark

/* This Parrot-specific addition to the API is used to mark an object. */
static void gc_mark(PARROT_INTERP, PMC *obj) {
    UninstantiableInstance *instance = (UninstantiableInstance *)PMC_data(obj);
    if (!PMC_IS_NULL(instance->common.stable))
        Parrot_gc_mark_PMC_alive(interp, instance->common.stable);
    if (!PMC_IS_NULL(instance->common.sc))
        Parrot_gc_mark_PMC_alive(interp, instance->common.sc);
}
开发者ID:Benabik,项目名称:nqp,代码行数:8,代码来源:Uninstantiable.c


示例11: repr_clone

/* 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);
}
开发者ID:ruz,项目名称:nqp,代码行数:18,代码来源:P6opaque.c


示例12: gc_mark

/* This Parrot-specific addition to the API is used to mark an object. */
static void gc_mark(PARROT_INTERP, PMC *obj) {
    P6strInstance *instance = (P6strInstance *)PMC_data(obj);
    if (!PMC_IS_NULL(instance->common.stable))
        Parrot_gc_mark_PMC_alive(interp, instance->common.stable);
    if (!PMC_IS_NULL(instance->common.sc))
        Parrot_gc_mark_PMC_alive(interp, instance->common.sc);
    if (!STRING_IS_NULL(instance->value))
        Parrot_gc_mark_STRING_alive(interp, instance->value);
}
开发者ID:plobsing,项目名称:nqp,代码行数:10,代码来源:P6str.c


示例13: gc_free

/* This Parrot-specific addition to the API is used to free an object. */
static void gc_free(PARROT_INTERP, PMC *obj) {
    P6opaqueREPRData *repr_data = (P6opaqueREPRData *)STABLE(obj)->REPR_data;
    INTVAL i;

    /* Cleanup any nested reprs that need it. */
    if (repr_data->gc_cleanup_slots) {
        for (i = 0; repr_data->gc_cleanup_slots[i] >= 0; i++) {
            INTVAL  offset = repr_data->attribute_offsets[repr_data->gc_cleanup_slots[i]];
            STable *st     = repr_data->flattened_stables[repr_data->gc_cleanup_slots[i]];
            st->REPR->gc_cleanup(interp, st, (char *)OBJECT_BODY(obj) + offset);
        }
    }
    if (repr_data->allocation_size && !PObj_flag_TEST(private0, obj))
        Parrot_gc_free_fixed_size_storage(interp, repr_data->allocation_size, PMC_data(obj));
    else
        mem_sys_free(PMC_data(obj));
    PMC_data(obj) = NULL;
}
开发者ID:fgomezrdz,项目名称:nqp,代码行数:19,代码来源:P6opaque.c


示例14: repr_clone

/* Clone. Clone object body and the attribute storage hash. */
static PMC * repr_clone(PARROT_INTERP, PMC *to_clone) {
    HashAttrStoreInstance *obj;

    /* Allocate and set up object instance. */
    obj = (HashAttrStoreInstance *) Parrot_gc_allocate_fixed_size_storage(interp, sizeof(HashAttrStoreInstance));
    obj->common.stable = STABLE_PMC(to_clone);
    obj->store = VTABLE_clone(interp, ((HashAttrStoreInstance *)PMC_data(to_clone))->store);

    return wrap_object(interp, obj);
}
开发者ID:felliott,项目名称:nqp,代码行数:11,代码来源:HashAttrStore.c


示例15: gc_mark

/* This Parrot-specific addition to the API is used to mark an object. */
static void gc_mark(PARROT_INTERP, PMC *obj) {
    HashAttrStoreInstance *instance = (HashAttrStoreInstance *)PMC_data(obj);

    /* Mark STable. */
    if (!PMC_IS_NULL(instance->common.stable))
        Parrot_gc_mark_PMC_alive(interp, instance->common.stable);

    /* Mark store */
    if (!PMC_IS_NULL(instance->store))
        Parrot_gc_mark_PMC_alive(interp, instance->store);
}
开发者ID:felliott,项目名称:nqp,代码行数:12,代码来源:HashAttrStore.c


示例16: gc_mark

/* This Parrot-specific addition to the API is used to mark an object. */
static void gc_mark(PARROT_INTERP, PMC *obj) {
    KnowHOWREPRInstance *instance = (KnowHOWREPRInstance *)PMC_data(obj);
    if (!PMC_IS_NULL(instance->common.stable))
        Parrot_gc_mark_PMC_alive(interp, instance->common.stable);
    if (!PMC_IS_NULL(instance->common.sc))
        Parrot_gc_mark_PMC_alive(interp, instance->common.sc);
    if (!PMC_IS_NULL(instance->methods))
        Parrot_gc_mark_PMC_alive(interp, instance->methods);
    if (!PMC_IS_NULL(instance->attributes))
        Parrot_gc_mark_PMC_alive(interp, instance->attributes);
}
开发者ID:plobsing,项目名称:nqp,代码行数:12,代码来源:KnowHOWREPR.c


示例17: set_str

/* Used with boxing. Sets a string value, for representations that can hold
 * one. */
static void set_str(PARROT_INTERP, PMC *obj, STRING *value) {
    P6opaqueInstance *instance  = (P6opaqueInstance *)PMC_data(obj);
    P6opaqueREPRData *repr_data = (P6opaqueREPRData *)STABLE(obj)->REPR_data;
    if (repr_data->unbox_str_offset) {
        set_str_at_offset(instance, repr_data->unbox_str_offset, value);
    }
    else {
        Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
            "This type cannot box a native string");
    }
}
开发者ID:ruz,项目名称:nqp,代码行数:13,代码来源:P6opaque.c


示例18: Parrot_pmc_get_type_str

/* Gets the list of possible candidates to dispatch too. */
static PMC *get_dispatchees(PARROT_INTERP, PMC *dispatcher) {
    if (!smo_id)
        smo_id = Parrot_pmc_get_type_str(interp, Parrot_str_new(interp, "SixModelObject", 0));
    if (dispatcher->vtable->base_type == enum_class_Sub && PARROT_SUB(dispatcher)->multi_signature->vtable->base_type == smo_id) {
        NQP_Routine *r = (NQP_Routine *)PMC_data(PARROT_SUB(dispatcher)->multi_signature);
        return r->dispatchees;
    }
    else {
        Parrot_ex_throw_from_c_args(interp, 0, 1,
            "Could not find multi-dispatch list");
    }
}
开发者ID:fgomezrdz,项目名称:nqp,代码行数:13,代码来源:multi_dispatch.c


示例19: compose

/* Composes the meta-object. */
static void compose(PARROT_INTERP, PMC *nci) {
    PMC * unused;
    PMC    *capture = Parrot_pcc_get_signature(interp, CURRENT_CONTEXT(interp));
    PMC    *self    = VTABLE_get_pmc_keyed_int(interp, capture, 0);
    PMC    *obj     = VTABLE_get_pmc_keyed_int(interp, capture, 1);
    STABLE(obj)->method_cache            = ((KnowHOWREPRInstance *)PMC_data(self))->body.methods;
    STABLE(obj)->mode_flags              = METHOD_CACHE_AUTHORITATIVE;
    STABLE(obj)->type_check_cache_length = 1;
    STABLE(obj)->type_check_cache        = (PMC **)mem_sys_allocate(sizeof(PMC *));
    STABLE(obj)->type_check_cache[0]     = obj;
    unused = Parrot_pcc_build_call_from_c_args(interp, capture, "P", obj);
}
开发者ID:gitpan,项目名称:Rakudo-Star,代码行数:13,代码来源:knowhow_bootstrapper.c


示例20: find_method

/* Finds a method. */
static void find_method(PARROT_INTERP, PMC *nci) {
    PMC * unused;
    /* Get methods table out of meta-object and look up method. */
    PMC    *capture = Parrot_pcc_get_signature(interp, CURRENT_CONTEXT(interp));
    PMC    *self    = VTABLE_get_pmc_keyed_int(interp, capture, 0);
    PMC    *methods = ((KnowHOWREPRInstance *)PMC_data(self))->body.methods;
    STRING *name    = VTABLE_get_string_keyed_int(interp, capture, 2);
    PMC    *method  = VTABLE_get_pmc_keyed_str(interp, methods, name);

    /* Put into capture to act as return value. */
    unused = Parrot_pcc_build_call_from_c_args(interp, capture, "P", method);
}
开发者ID:gitpan,项目名称:Rakudo-Star,代码行数:13,代码来源:knowhow_bootstrapper.c



注:本文中的PMC_data函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PMD_DRV_LOG函数代码示例发布时间:2022-05-30
下一篇:
C++ PMC_IS_NULL函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap