本文整理汇总了C++中popthenPush函数的典型用法代码示例。如果您正苦于以下问题:C++ popthenPush函数的具体用法?C++ popthenPush怎么用?C++ popthenPush使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了popthenPush函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: primitiveSoundPlaySamples
primitiveSoundPlaySamples(void)
{
// SoundPlugin>>#primitiveSoundPlaySamples
unsigned *buf;
sqInt frameCount;
sqInt framesPlayed;
sqInt startIndex;
sqInt _return_value;
frameCount = stackIntegerValue(2);
success(isWords(stackValue(1)));
buf = ((unsigned *) (firstIndexableField(stackValue(1))));
startIndex = stackIntegerValue(0);
if (failed()) {
return null;
}
success((startIndex >= 1)
&& (((startIndex + frameCount) - 1) <= (slotSizeOf(((sqInt)(long)(buf) - BaseHeaderSize)))));
if (!(failed())) {
framesPlayed = snd_PlaySamplesFromAtLength(frameCount, (void *)buf, startIndex - 1);
success(framesPlayed >= 0);
}
_return_value = positive32BitIntegerFor(framesPlayed);
if (failed()) {
return null;
}
popthenPush(4, _return_value);
return null;
}
示例2: primitiveErrorAndLog
primitiveErrorAndLog(void)
{
char *log;
sqInt logLen;
sqInt logObj;
char *logObjData;
sqInt resultObj;
logLen = 0;
log = getlog((&logLen));
resultObj = instantiateClassindexableSize(classArray(), 2);
if (resultObj == 0) {
primitiveFailFor(PrimErrNoMemory);
return null;
}
storePointerofObjectwithValue(0, resultObj, integerObjectOf(errorAcorn()));
if (logLen > 0) {
pushRemappableOop(resultObj);
logObj = instantiateClassindexableSize(classString(), logLen);
if (failed()) {
popRemappableOop();
primitiveFailFor(PrimErrNoMemory);
return null;
}
resultObj = popRemappableOop();
logObjData = arrayValueOf(logObj);
memcpy(logObjData, log, logLen);
storePointerofObjectwithValue(1, resultObj, logObj);
}
popthenPush(1, resultObj);
if (failed()) {
return null;
}
return null;
}
示例3: primitiveGetMacintoshFileTypeAndCreatorFrom
primitiveGetMacintoshFileTypeAndCreatorFrom(void)
{
char *aFileName;
char creator[8];
sqInt i;
sqInt keyLength;
sqInt oop;
char *ptr;
success(isBytes(stackValue(0)));
aFileName = ((char *) (firstIndexableField(stackValue(0))));
if (failed()) {
return null;
}
keyLength = byteSizeOf(((sqInt)(sqIntptr_t)(aFileName) - BaseHeaderSize));
sqInternetGetMacintoshFileTypeAndCreatorFromkeySizeinto(aFileName, keyLength, creator);
oop = instantiateClassindexableSize(classString(), 8);
ptr = firstIndexableField(oop);
for (i = 0; i <= 7; i += 1) {
ptr[i] = (creator[i]);
}
if (failed()) {
return null;
}
popthenPush(2, oop);
return null;
}
示例4: primitiveResetCPU
primitiveResetCPU(void)
{
void *cpu;
sqInt cpuAlien;
sqInt maybeErr;
cpuAlien = stackValue(0);
if (failed()) {
return null;
}
if (((cpu = ((longAt(cpuAlien + BaseHeaderSize)) > 0
? (cpuAlien + BaseHeaderSize) + BytesPerOop
: longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))) == 0) {
primitiveFailFor(PrimErrBadReceiver);
return null;
}
maybeErr = resetCPU(cpu);
if (maybeErr != 0) {
primitiveFailFor(PrimErrInappropriate);
return null;
}
if (failed()) {
return null;
}
popthenPush(1, cpuAlien);
return null;
}
示例5: primitiveAtPut
primitiveAtPut(void)
{
float *floatPtr;
double floatValue;
sqInt index;
sqInt rcvr;
sqInt value;
value = stackValue(0);
if (isIntegerObject(value)) {
floatValue = ((double) (integerValueOf(value)) );
}
else {
floatValue = floatValueOf(value);
}
index = stackIntegerValue(1);
rcvr = stackValue(2);
if (!((!(failed()))
&& ((isWords(rcvr))
&& ((index > 0)
&& (index <= (slotSizeOf(rcvr))))))) {
return primitiveFail();
}
floatPtr = firstIndexableField(rcvr);
floatPtr[index - 1] = (((float) floatValue));
popthenPush(3, value);
return 0;
}
示例6: primitiveSerialPortRead
primitiveSerialPortRead(void)
{
// SerialPlugin>>#primitiveSerialPortRead
char *array;
sqInt arrayPtr;
sqInt bytesRead;
sqInt count;
sqInt portNum;
sqInt startIndex;
sqInt _return_value;
portNum = stackIntegerValue(3);
success(isBytes(stackValue(2)));
array = ((char *) (firstIndexableField(stackValue(2))));
startIndex = stackIntegerValue(1);
count = stackIntegerValue(0);
if (failed()) {
return null;
}
success((startIndex >= 1)
&& (((startIndex + count) - 1) <= (byteSizeOf(((sqInt)(long)(array) - 4)))));
arrayPtr = ((((sqInt)array)) + startIndex) - 1;
bytesRead = serialPortReadInto( portNum, count, arrayPtr);
_return_value = integerObjectOf(bytesRead);
if (failed()) {
return null;
}
popthenPush(5, _return_value);
return null;
}
示例7: primitiveSerialPortWrite
primitiveSerialPortWrite(void)
{
char *array;
char * arrayPtr;
sqInt bytesWritten;
sqInt count;
sqInt portNum;
sqInt startIndex;
sqInt _return_value;
bytesWritten = 0;
portNum = stackIntegerValue(3);
success(isBytes(stackValue(2)));
array = ((char *) (firstIndexableField(stackValue(2))));
startIndex = stackIntegerValue(1);
count = stackIntegerValue(0);
if (failed()) {
return null;
}
success((startIndex >= 1)
&& (((startIndex + count) - 1) <= (byteSizeOf(((sqInt)(sqIntptr_t)(array) - BaseHeaderSize)))));
if (!(failed())) {
arrayPtr = (array + startIndex) - 1;
bytesWritten = serialPortWriteFrom(portNum, count, arrayPtr);
}
if (failed()) {
return null;
}
_return_value = integerObjectOf(bytesWritten);
popthenPush(5, _return_value);
return null;
}
示例8: primitiveSoundInsertSamples
primitiveSoundInsertSamples(void)
{
// SoundPlugin>>#primitiveSoundInsertSamples
unsigned *buf;
sqInt frameCount;
sqInt framesPlayed;
sqInt leadTime;
sqInt _return_value;
frameCount = stackIntegerValue(2);
success(isWords(stackValue(1)));
buf = ((unsigned *) (firstIndexableField(stackValue(1))));
leadTime = stackIntegerValue(0);
if (failed()) {
return null;
}
success(frameCount <= (slotSizeOf(((sqInt)(long)(buf) - BaseHeaderSize))));
if (!(failed())) {
framesPlayed = snd_InsertSamplesFromLeadTime(frameCount, (void *)buf, leadTime);
success(framesPlayed >= 0);
}
_return_value = positive32BitIntegerFor(framesPlayed);
if (failed()) {
return null;
}
popthenPush(4, _return_value);
return null;
}
示例9: primitiveSum
primitiveSum(void)
{
// FloatArrayPlugin>>#primitiveSum
sqInt i;
sqInt length;
sqInt rcvr;
float *rcvrPtr;
double sum;
rcvr = stackObjectValue(0);
if (failed()) {
return null;
}
success(isWords(rcvr));
if (failed()) {
return null;
}
length = stSizeOf(rcvr);
rcvrPtr = ((float *) (firstIndexableField(rcvr)));
sum = 0.0;
for (i = 0; i <= (length - 1); i += 1) {
sum += ((double) (rcvrPtr[i]));
}
popthenPush(1, floatObjectOf(sum));
}
示例10: primitiveLength
primitiveLength(void)
{
// FloatArrayPlugin>>#primitiveLength
sqInt i;
sqInt length;
sqInt rcvr;
float *rcvrPtr;
double result;
rcvr = stackObjectValue(0);
if (failed()) {
return null;
}
success(isWords(rcvr));
if (failed()) {
return null;
}
length = stSizeOf(rcvr);
success(1);
rcvrPtr = ((float *) (firstIndexableField(rcvr)));
result = 0.0;
for (i = 0; i <= (length - 1); i += 1) {
result += (((double) (rcvrPtr[i]))) * (((double) (rcvrPtr[i])));
}
result = sqrt(result);
popthenPush(1, floatObjectOf(result));
}
示例11: primitiveAtPut
primitiveAtPut(void)
{
// FloatArrayPlugin>>#primitiveAtPut
float *floatPtr;
double floatValue;
sqInt index;
sqInt rcvr;
sqInt value;
value = stackValue(0);
if (isIntegerObject(value)) {
floatValue = ((double) (integerValueOf(value)) );
}
else {
floatValue = floatValueOf(value);
}
index = stackIntegerValue(1);
rcvr = stackObjectValue(2);
if (failed()) {
return null;
}
success(isWords(rcvr));
success((index > 0)
&& (index <= (slotSizeOf(rcvr))));
if (failed()) {
return null;
}
floatPtr = firstIndexableField(rcvr);
floatPtr[index - 1] = (((float) floatValue));
if (!(failed())) {
popthenPush(3, value);
}
}
示例12: primitiveGetStringKeyedBy
primitiveGetStringKeyedBy(void)
{
char *aKey;
char aString[1025];
sqInt i;
sqInt keyLength;
sqInt oop;
char *ptr;
sqInt size;
success(isBytes(stackValue(0)));
aKey = ((char *) (firstIndexableField(stackValue(0))));
if (failed()) {
return null;
}
keyLength = byteSizeOf(((sqInt)(sqIntptr_t)(aKey) - BaseHeaderSize));
size = sqInternetConfigurationGetStringKeyedBykeySizeinto(aKey, keyLength, aString);
oop = instantiateClassindexableSize(classString(), size);
ptr = firstIndexableField(oop);
for (i = 0; i < size; i += 1) {
ptr[i] = (aString[i]);
}
if (failed()) {
return null;
}
popthenPush(2, oop);
return null;
}
示例13: primitiveVMOffsetToUTC
primitiveVMOffsetToUTC(void)
{
sqInt _return_value;
_return_value = integerObjectOf((sqLocGetVMOffsetToUTC()));
popthenPush(1, _return_value);
return null;
}
示例14: primitiveTimezoneOffset
primitiveTimezoneOffset(void)
{
sqInt _return_value;
_return_value = integerObjectOf((sqLocGetTimezoneOffset()));
popthenPush(1, _return_value);
return null;
}
示例15: primitiveDisassembleAtInMemory
primitiveDisassembleAtInMemory(void)
{
usqIntptr_t address;
void *cpu;
sqInt cpuAlien;
sqInt instrLenOrErr;
sqInt log;
sqInt logLen;
sqInt logObj;
sqInt logObjData;
char *memory;
sqInt resultObj;
logLen = 0;
address = (BytesPerOop == 4
? positive32BitValueOf(stackValue(1))
: positive64BitValueOf(stackValue(1)));
success(isWordsOrBytes(stackValue(0)));
memory = ((char *) (firstIndexableField(stackValue(0))));
cpuAlien = stackValue(2);
if (failed()) {
return null;
}
if (((cpu = ((longAt(cpuAlien + BaseHeaderSize)) > 0
? (cpuAlien + BaseHeaderSize) + BytesPerOop
: longAt((cpuAlien + BaseHeaderSize) + BytesPerOop)))) == 0) {
primitiveFailFor(PrimErrBadReceiver);
return null;
}
instrLenOrErr = disassembleForAtInSize(cpu, address, memory, byteSizeOf(((sqInt)(sqIntptr_t)(memory) - BaseHeaderSize)));
if (instrLenOrErr < 0) {
primitiveFailFor(PrimErrInappropriate);
return null;
}
log = getlog((&logLen));
resultObj = instantiateClassindexableSize(classArray(), 2);
if (resultObj == 0) {
primitiveFailFor(PrimErrNoMemory);
return null;
}
pushRemappableOop(resultObj);
logObj = instantiateClassindexableSize(classString(), logLen);
if (failed()) {
popRemappableOop();
primitiveFailFor(PrimErrNoMemory);
return null;
}
logObjData = arrayValueOf(logObj);
memcpy(logObjData, log, logLen);
resultObj = popRemappableOop();
storePointerofObjectwithValue(0, resultObj, integerObjectOf(instrLenOrErr));
storePointerofObjectwithValue(1, resultObj, logObj);
if (failed()) {
return null;
}
popthenPush(3, resultObj);
return null;
}