当前位置: 首页>>代码示例>>C++>>正文


C++ IOCLONE函数代码示例

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


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

示例1: IoMessage_locals_valueArgAt_

IoObject *IoCFFIPointer_castTo(IoCFFIPointer *self, IoObject *locals, IoMessage *m)
{
    IoObject *toType = IoMessage_locals_valueArgAt_(m, locals, 0);
    IoObject *o = IoState_on_doCString_withLabel_(IOSTATE, toType, "?typeString", "IoCFFIPointer_castTo");

    if(!ISNIL(o)) {
        char *typeStr = CSTRING(o);

        switch(typeStr[0]) {
            case '^':
                toType = IOCLONE(toType);
                *(DATA(toType)->valuePointer) = *((void **)IoCFFIDataType_ValuePointerFromObject_(toType, self));
                return toType;
            case '*':
                toType = IOCLONE(toType);
                IoCFFIDataType_rawSetValue(toType, self);
                return toType;
            default:
                IoState_error_(IOSTATE, m, "Wrong type to cast to.");
                break;
        }
    }
    else {
        // Mm... well, if the type to cast to does not have a typeString slot,
        // it should be an Io Object, so the address stored here is a pointer to an
        // Io Object. Simply cast the pointer and return it... dangerous but...
        
        IoObject *obj = (IoObject *)*(DATA(self)->valuePointer);
        if(ISOBJECT(obj))
            return (IoObject *)*(DATA(self)->valuePointer);
    }

    return IONIL(self);
}
开发者ID:akimd,项目名称:io,代码行数:34,代码来源:IoCFFIPointer.c

示例2: IOCLONE

IoCFFIArray *IoCFFIArray_with(IoCFFIArray *self, IoObject *locals, IoMessage *m)
{
	IoCFFIDataType *type;
	int size, i;
	ffi_type *item_type;
	IoCFFIArray *o = IOCLONE(self);

	IoState_on_doCString_withLabel_(IoObject_state(o), o, "init", "IoCFFIArray_with");

	type = IOCLONE(IoMessage_locals_valueArgAt_(m, locals, 0));
	IoObject_setSlot_to_(o, IOSYMBOL("arrayType"), type);

	size = IoMessage_locals_intArgAt_(m, locals, 1);
	DATA(o)->arraySize = size;

	item_type = IoCFFIDataType_ffiType(type);
	DATA(o)->itemSize = item_type->size;

	// Fake libffi to think we are a Struct
	DATA(o)->ffiType.size = 0;
	DATA(o)->ffiType.alignment = 0;
	DATA(o)->ffiType.type = FFI_TYPE_STRUCT;
	DATA(o)->ffiType.elements = io_calloc(size + 1, sizeof(ffi_type *));
	DATA(o)->needToFreeFFIType = 1;
	for ( i = 0 ; i < size ; i++ ) {
		DATA(o)->ffiType.elements[i] = item_type;
	}
	DATA(o)->ffiType.elements[size] = NULL;

	ffi_cif cif;
	ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &(DATA(o)->ffiType), NULL);

	return o;
}
开发者ID:bomma,项目名称:io,代码行数:34,代码来源:IoCFFIArray.c

示例3: IoObject_rawClonePrimitive

IoBox *IoBox_rawClone(IoBox *proto)
{
	IoBox *self = IoObject_rawClonePrimitive(proto);
	IoObject_setDataPointer_(self, calloc(1, sizeof(IoBoxData)));

	DATA(self)->origin = IOCLONE(DATA(proto)->origin);
	DATA(self)->size   = IOCLONE(DATA(proto)->size);
	return self;
}
开发者ID:ADTSH,项目名称:io,代码行数:9,代码来源:IoBox.c

示例4: IoObject_rawClonePrimitive

IoAudioDevice *IoAudioDevice_rawClone(IoAudioDevice *proto)
{
	IoObject *self = IoObject_rawClonePrimitive(proto);
	IoObject_setDataPointer_(self, calloc(1, sizeof(IoAudioDeviceData)));
	DATA(self)->writeBuffer = IOCLONE(DATA(proto)->writeBuffer);
	DATA(self)->readBuffer = IOCLONE(DATA(proto)->readBuffer);
	DATA(self)->audioDevice = AudioDevice_new();
	return self;
}
开发者ID:Akiyah,项目名称:io,代码行数:9,代码来源:IoAudioDevice.c

示例5: IoObject_rawClonePrimitive

IoGLScissor *IoGLScissor_rawClone(IoGLScissor *proto)
{
	IoObject *self = IoObject_rawClonePrimitive(proto);
	IoObject_setDataPointer_(self, cpalloc(IoObject_dataPointer(proto), sizeof(IoGLScissorData)));

	DATA(self)->rect    = IOCLONE(DATA(proto)->rect);
	DATA(self)->tmpRect = IOCLONE(DATA(proto)->tmpRect);
	return self;
}
开发者ID:Akiyah,项目名称:io,代码行数:9,代码来源:IoGLScissor.c

示例6: IoObject_rawClonePrimitive

IoAVCodec *IoAVCodec_rawClone(IoAVCodec *proto)
{
	IoObject *self = IoObject_rawClonePrimitive(proto);
	IoObject_setDataPointer_(self, calloc(1, sizeof(IoAVCodecData)));

	DATA(self)->inputBuffer        = IOCLONE(DATA(proto)->inputBuffer);
	DATA(self)->outputBuffer       = IOCLONE(DATA(proto)->outputBuffer);

	return self;
}
开发者ID:BMeph,项目名称:io,代码行数:10,代码来源:IoAVCodec.c

示例7: IoObject_rawClonePrimitive

IoMP3Decoder *IoMP3Decoder_rawClone(IoMP3Decoder *proto) 
{ 
	IoObject *self = IoObject_rawClonePrimitive(proto);
	IoObject_setDataPointer_(self, calloc(1, sizeof(IoMP3DecoderData)));
	
	DATA(self)->willProcessMessage = DATA(proto)->willProcessMessage;
	DATA(self)->didProcessMessage = DATA(proto)->didProcessMessage;
	DATA(self)->inputBuffer  = IOCLONE(DATA(proto)->inputBuffer);
	DATA(self)->outputBuffer = IOCLONE(DATA(proto)->outputBuffer);
	DATA(self)->tmpInputBa = UArray_new();
	
	IoState_addValue_(IOSTATE, self);
	return self; 
}
开发者ID:Akiyah,项目名称:io,代码行数:14,代码来源:IoMP3Decoder.c

示例8: checkStatus_

IoCairoSurface *IoCairoSurface_newWithRawSurface_(void *state, IoMessage *m, cairo_surface_t *surface)
{
	IoObject *self = 0;
	IoStateProtoFunc *initFunc = 0;

	checkStatus_(state, m, cairo_surface_status(surface));

	switch(cairo_surface_get_type(surface))
	{
		case CAIRO_SURFACE_TYPE_IMAGE:
			initFunc = IoCairoImageSurface_proto;
			break;
		case CAIRO_SURFACE_TYPE_PS:
			initFunc = IoCairoPSSurface_proto;
			break;
		case CAIRO_SURFACE_TYPE_PDF:
			initFunc = IoCairoPDFSurface_proto;
			break;
		case CAIRO_SURFACE_TYPE_SVG:
			initFunc = IoCairoSVGSurface_proto;
			break;
	default:
			IoState_error_(state, 0, "Unsupported surface type");
	}

	self = IOCLONE(IoState_protoWithId_(state, protoId));
	IoObject_setDataPointer_(self, surface);
	return self;
}
开发者ID:AlexGensek,项目名称:io,代码行数:29,代码来源:IoCairoSurface.c

示例9: IoState_protoWithInitFunction_

IoODEBody *IoODEBody_newBodyProtoWithWorld(void *state, IoODEWorld *world)
{
	IoODEBody *proto = IoState_protoWithInitFunction_(state, IoODEBody_proto);
	IoODEBody *self = IOCLONE(proto);
	WORLD = world;
	return self;
}
开发者ID:cdcarter,项目名称:io,代码行数:7,代码来源:IoODEBody.c

示例10: CNUMBER

IoCFFIArray *IoCFFIArray_atPut(IoCFFIArray *self, IoObject *locals, IoMessage *m)
{
	int pos;
	IoObject *value, *arrayType, *d;
	char *ptr;

	pos = CNUMBER(IoMessage_locals_numberArgAt_(m, locals, 0));
	value = IoMessage_locals_valueArgAt_(m, locals, 1);

	if ( pos >= DATA(self)->arraySize ) {
		IoState_error_(IOSTATE, m, "index out of bounds");
		return IONIL(self);
	}

	arrayType = IoObject_getSlot_(self, IOSYMBOL("arrayType"));
	ptr = ((char *)DATA(self)->buffer) + (DATA(self)->itemSize * pos);

	d = IOCLONE(arrayType);
	IoCFFIDataType_rawSetValue(d, value);
	memcpy(ptr, (void *)IoCFFIDataType_ValuePointerFromObject_(self, d), DATA(self)->itemSize);

	if ( DATA(self)->keepValuesRefs ) {
		DATA(self)->keepValuesRefs[pos] = IOREF(d);
	}

	return self;
}
开发者ID:bomma,项目名称:io,代码行数:27,代码来源:IoCFFIArray.c

示例11: printf

// _new creates a new object from this prototype
IoObject *IoSVN_new(void *state)
{
	printf("IoSVN_new\n");

	IoObject *proto = IoState_protoWithInitFunction_(state, IoSVN_proto);
	return IOCLONE(proto);
}
开发者ID:omf,项目名称:iosvnnative,代码行数:8,代码来源:IoSVN.c

示例12: IoState_protoWithInitFunction_

IoCoroutine *IoCoroutine_new(void *state)
{
	IoObject *proto = IoState_protoWithInitFunction_((IoState *)state, IoCoroutine_proto);
	IoObject *self = IOCLONE(proto);
	//printf("IoCoroutine_new %p\n", (void *)self);
	return self;
}
开发者ID:jdp,项目名称:io,代码行数:7,代码来源:IoCoroutine.c

示例13: IoState_protoWithInitFunction_

IoNumber *IoNumber_newWithDouble_(void *state, double n)
{
	IoNumber *proto = IoState_protoWithInitFunction_((IoState *)state, IoNumber_proto);
	IoNumber *self = IOCLONE(proto); // since Numbers have no refs, we can avoid IOCLONE
	DATA(self) = n;
	return self;
}
开发者ID:Akiyah,项目名称:io,代码行数:7,代码来源:IoNumber.c

示例14: IOCLONE

IoCairoFontOptions *IoCairoFontOptions_newWithRawFontOptions_(void *state, IoMessage *m, cairo_font_options_t *options)
{
	IoCairoFontOptions *self = IOCLONE(IoState_protoWithId_(state, proto));
	IoObject_setDataPointer_(self, options);
	CHECK_STATUS(self);
	return self;
}
开发者ID:AlexGensek,项目名称:io,代码行数:7,代码来源:IoCairoFontOptions.c

示例15: IoState_protoWithInitFunction_

IoODEJoint *IoODEJoint_newProtoCommon(void *state, IoStateProtoFunc *func, IoODEJointGroup *jointGroup)
{
	IoODEJoint *proto = IoState_protoWithInitFunction_(state, func);
	IoODEJoint *self = IOCLONE(proto);
	JOINTGROUP = jointGroup;
	return self;
}
开发者ID:Akiyah,项目名称:io,代码行数:7,代码来源:IoODEJoint.c


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