本文整理汇总了C++中slotRawPtr函数的典型用法代码示例。如果您正苦于以下问题:C++ slotRawPtr函数的具体用法?C++ slotRawPtr怎么用?C++ slotRawPtr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了slotRawPtr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: prTempoClock_SetTempoAtBeat
int prTempoClock_SetTempoAtBeat(struct VMGlobals *g, int numArgsPushed)
{
PyrSlot *a = g->sp - 2;
PyrSlot *b = g->sp - 1;
PyrSlot *c = g->sp;
TempoClock *clock = (TempoClock*)slotRawPtr(&slotRawObject(a)->slots[1]);
if (!clock) {
error("clock is not running.\n");
return errFailed;
}
double tempo, beat;
int err = slotDoubleVal(b, &tempo);
if (err) return errFailed;
if (tempo <= 0.) {
error("invalid tempo %g\n", tempo);
return errFailed;
}
err = slotDoubleVal(c, &beat);
if (err) return errFailed;
clock->SetTempoAtBeat(tempo, beat);
return errNone;
}
示例2: prFilePutFloatLE
int prFilePutFloatLE(struct VMGlobals *g, int numArgsPushed)
{
PyrSlot *a, *b;
PyrFile *pfile;
FILE *file;
a = g->sp - 1;
b = g->sp;
pfile = (PyrFile*)slotRawObject(a);
file = (FILE*)slotRawPtr(&pfile->fileptr);
if (file == NULL) {
dumpObjectSlot(a);
return errFailed;
}
float val;
int err = slotFloatVal(b, &val);
if (err) return err;
SC_IOStream<FILE*> scio(file);
scio.writeFloat_le(val);
return errNone;
}
示例3: prTempoClock_SetAll
int prTempoClock_SetAll(struct VMGlobals *g, int numArgsPushed)
{
PyrSlot *a = g->sp - 3;
PyrSlot *b = g->sp - 2;
PyrSlot *c = g->sp - 1;
PyrSlot *d = g->sp;
TempoClock *clock = (TempoClock*)slotRawPtr(&slotRawObject(a)->slots[1]);
if (!clock) {
error("clock is not running.\n");
return errFailed;
}
double tempo, beat, secs;
int err = slotDoubleVal(b, &tempo);
if (err) return errFailed;
err = slotDoubleVal(c, &beat);
if (err) return errFailed;
err = slotDoubleVal(d, &secs);
if (err) return errFailed;
clock->SetAll(tempo, beat, secs);
return errNone;
}
示例4: prSFWrite
int prSFWrite(struct VMGlobals *g, int numArgsPushed)
{
PyrSlot *a, *b;
a = g->sp - 1;
b = g->sp;
SNDFILE *file = (SNDFILE*)slotRawPtr(&slotRawObject(a)->slots[0]);
if (!isKindOfSlot(b, class_rawarray)) return errWrongType;
switch (slotRawObject(b)->obj_format) {
case obj_int16 :
sf_write_short(file, (short*)slotRawInt8Array(b)->b, slotRawObject(b)->size);
break;
case obj_int32 :
sf_write_int(file, (int*)slotRawInt8Array(b)->b, slotRawObject(b)->size);
break;
case obj_float :
sf_write_float(file, (float*)slotRawInt8Array(b)->b, slotRawObject(b)->size);
break;
case obj_double :
sf_write_double(file, (double*)slotRawInt8Array(b)->b, slotRawObject(b)->size);
break;
default:
error("sample format not supported.\n");
return errFailed;
}
return errNone;
}
示例5: prSetControlBusValues
int prSetControlBusValues(VMGlobals *g, int numArgsPushed)
{
PyrSlot *a = g->sp - 2;
PyrSlot *b = g->sp - 1;
PyrSlot *c = g->sp;
assert(IsObj(a));
PyrObject * self = slotRawObject(a);
int ptrIndex = 0;
PyrSlot * ptrSlot = self->slots + ptrIndex;
if (NotPtr(ptrSlot))
return errFailed;
if (!IsInt(b))
return errFailed;
int busIndex = slotRawInt(b);
if (!IsObj(c))
return errFailed;
PyrObject * values = slotRawObject(c);
server_shared_memory_client * client = (server_shared_memory_client*)slotRawPtr(ptrSlot);
float * control_busses = client->get_control_busses() + busIndex;
for (int i = 0; i != values->size; ++i) {
float value;
int error = slotFloatVal(values->slots + i, &value);
if (error != errNone)
return error;
control_busses[i] = value;
}
return errNone;
}
示例6: prSetControlBusValue
int prSetControlBusValue(VMGlobals *g, int numArgsPushed)
{
PyrSlot *a = g->sp - 2;
PyrSlot *b = g->sp - 1;
PyrSlot *c = g->sp;
assert(IsObj(a));
PyrObject * self = slotRawObject(a);
int ptrIndex = 0;
PyrSlot * ptrSlot = self->slots + ptrIndex;
if (NotPtr(ptrSlot))
return errFailed;
if (!IsInt(b))
return errFailed;
int busIndex = slotRawInt(b);
if (NotPtr(ptrSlot))
return errFailed;
float value;
int error = slotFloatVal(c, &value);
if (error != errNone)
return error;
server_shared_memory_client * client = (server_shared_memory_client*)slotRawPtr(ptrSlot);
client->get_control_busses()[busIndex] = value;
return errNone;
}
示例7: prTempoClock_Sched
int prTempoClock_Sched(struct VMGlobals *g, int numArgsPushed)
{
PyrSlot *a = g->sp - 2;
PyrSlot *b = g->sp - 1;
PyrSlot *c = g->sp;
double delta, beats;
int err;
TempoClock *clock = (TempoClock*)slotRawPtr(&slotRawObject(a)->slots[1]);
if (!clock) {
error("clock is not running.\n");
return errFailed;
}
if (!SlotEq(&g->thread->clock, a)) {
beats = clock->ElapsedBeats();
//post("shouldn't call TempoClock-sched from a different clock. Use schedAbs.\n");
//return errFailed;
} else {
err = slotDoubleVal(&g->thread->beats, &beats);
if (err) return errNone; // return nil OK, just don't schedule
}
err = slotDoubleVal(b, &delta);
if (err) return errNone; // return nil OK, just don't schedule
beats += delta;
if (beats == dInfinity)
return errNone; // return nil OK, just don't schedule
clock->Add(beats, c);
return errNone;
}
示例8: prTempoClock_Dump
int prTempoClock_Dump(struct VMGlobals *g, int numArgsPushed)
{
PyrSlot *a = g->sp;
TempoClock *clock = (TempoClock*)slotRawPtr(&slotRawObject(a)->slots[1]);
if (clock) clock->Dump();
return errNone;
}
示例9: finalize_image_object
int finalize_image_object( struct VMGlobals *g, struct PyrObject *obj )
{
SharedImage *shared_image_ptr =
reinterpret_cast<SharedImage*>( slotRawPtr(obj->slots) );
delete shared_image_ptr;
SetNil( obj->slots+0 );
return errNone;
}
示例10: read
static QObjectProxy* read( PyrSlot *slot )
{
PyrSlot *proxySlot = slotRawObject( slot )->slots;
if( IsPtr( proxySlot ) )
return (QObjectProxy*) slotRawPtr( proxySlot );
else
return 0;
}
示例11: qcDebugMsg
int QcTreeWidget::Item::finalize( VMGlobals *g, PyrObject *obj )
{
qcDebugMsg(1,"finalizing QTreeViewItem!");
if( IsPtr( obj->slots+0 ) ) {
QcTreeWidget::ItemPtr *ptr = static_cast<QcTreeWidget::ItemPtr*>( slotRawPtr(obj->slots+0) );
delete ptr;
}
return errNone;
}
示例12: returnFromBlock
HOT void returnFromBlock(VMGlobals *g)
{
PyrFrame *curframe;
PyrFrame *returnFrame;
PyrFrame *homeContext;
PyrBlock *block;
PyrMethod *meth;
PyrMethodRaw *methraw;
PyrMethodRaw *blockraw;
//if (gTraceInterpreter) postfl("->returnFromBlock\n");
//printf("->returnFromBlock\n");
#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
CallStackSanity(g, "returnFromBlock");
#endif
curframe = g->frame;
//again:
returnFrame = slotRawFrame(&curframe->caller);
if (returnFrame) {
block = slotRawBlock(&curframe->method);
blockraw = METHRAW(block);
g->frame = returnFrame;
g->ip = (unsigned char *)slotRawPtr(&returnFrame->ip);
g->block = slotRawBlock(&returnFrame->method);
homeContext = slotRawFrame(&returnFrame->homeContext);
meth = slotRawMethod(&homeContext->method);
methraw = METHRAW(meth);
slotCopy(&g->receiver, &homeContext->vars[0]); //??
g->method = meth;
meth = slotRawMethod(&curframe->method);
methraw = METHRAW(meth);
if (!methraw->needsHeapContext) {
g->gc->Free(curframe);
} else {
SetInt(&curframe->caller, 0);
}
} else {
////// this should never happen .
error("return from Function at top of call stack.\n");
g->method = NULL;
g->block = NULL;
g->frame = NULL;
g->sp = g->gc->Stack()->slots - 1;
longjmp(g->escapeInterpreter, 1);
}
//if (gTraceInterpreter) postfl("<-returnFromBlock\n");
#ifdef GC_SANITYCHECK
g->gc->SanityCheck();
CallStackSanity(g, "returnFromBlock");
#endif
}
示例13: prNetAddr_Disconnect
static int prNetAddr_Disconnect(VMGlobals *g, int numArgsPushed)
{
PyrSlot* netAddrSlot = g->sp;
PyrObject* netAddrObj = slotRawObject(netAddrSlot);
SC_TcpClientPort *comPort = (SC_TcpClientPort*)slotRawPtr(netAddrObj->slots + ivxNetAddr_Socket);
if (comPort) comPort->Close();
return errNone;
}
示例14: prTempoClock_Free
int prTempoClock_Free(struct VMGlobals *g, int numArgsPushed)
{
PyrSlot *a = g->sp;
TempoClock *clock = (TempoClock*)slotRawPtr(&slotRawObject(a)->slots[1]);
if (!clock) return errNone; // not running
SetNil(slotRawObject(a)->slots + 1);
clock->StopReq();
return errNone;
}
示例15: prFileFlush
int prFileFlush(struct VMGlobals *g, int numArgsPushed)
{
PyrSlot *a;
PyrFile *pfile;
FILE *file;
a = g->sp;
pfile = (PyrFile*)slotRawObject(a);
file = (FILE*)slotRawPtr(&pfile->fileptr);
if (file != NULL) fflush(file);
return errNone;
}