本文整理汇总了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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}