这篇教程C++ stackValue函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中stackValue函数的典型用法代码示例。如果您正苦于以下问题:C++ stackValue函数的具体用法?C++ stackValue怎么用?C++ stackValue使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了stackValue函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: primitiveSerialPortReadprimitiveSerialPortRead(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;}
开发者ID:JeanBaptisteArnaud,项目名称:RaspLocalDebug,代码行数:30,
示例2: primitiveSoundPlaySamplesprimitiveSoundPlaySamples(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;}
开发者ID:JeanBaptisteArnaud,项目名称:synologyPharo,代码行数:29,
示例3: primitiveSoundInsertSamplesprimitiveSoundInsertSamples(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;}
开发者ID:JeanBaptisteArnaud,项目名称:synologyPharo,代码行数:28,
示例4: primitiveCreateRendererprimitiveCreateRenderer(void){ // B3DAcceleratorPlugin>>#primitiveCreateRenderer sqInt allowHardware; sqInt allowSoftware; sqInt h; sqInt result; sqInt w; sqInt x; sqInt y; if (!((methodArgumentCount()) == 6)) { return primitiveFail(); } h = stackIntegerValue(0); w = stackIntegerValue(1); y = stackIntegerValue(2); x = stackIntegerValue(3); allowHardware = booleanValueOf(stackValue(4)); allowSoftware = booleanValueOf(stackValue(5)); if (failed()) { return null; } result = b3dxCreateRenderer(allowSoftware, allowHardware, x, y, w, h); if (result < 0) {return primitiveFail(); } pop(7); return pushInteger(result);}
开发者ID:JeanBaptisteArnaud,项目名称:RaspLocalDebug,代码行数:30,
示例5: primitiveSerialPortWriteprimitiveSerialPortWrite(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;}
开发者ID:johnnyzz,项目名称:pharo-vm,代码行数:32,
示例6: primitiveAtPutprimitiveAtPut(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;}
开发者ID:johnnyzz,项目名称:pharo-vm,代码行数:28,
示例7: primitiveFileCopyNamedToprimitiveFileCopyNamedTo(void){ // FileCopyPlugin>>#primitiveFileCopyNamedTo char *dstName; sqInt dstSz; sqInt ok; char *srcName; sqInt srcSz; success(isBytes(stackValue(1))); srcName = ((char *) (firstIndexableField(stackValue(1)))); success(isBytes(stackValue(0))); dstName = ((char *) (firstIndexableField(stackValue(0)))); if (failed()) { return null; } srcSz = slotSizeOf(((sqInt)(long)(srcName) - 4)); dstSz = slotSizeOf(((sqInt)(long)(dstName) - 4)); ok = sqCopyFilesizetosize(srcName, srcSz, dstName, dstSz); if (!ok) {primitiveFail(); } if (failed()) { return null; } pop(2); return null;}
开发者ID:JeanBaptisteArnaud,项目名称:RaspLocalDebug,代码行数:28,
示例8: primitiveFlushICacheFromToprimitiveFlushICacheFromTo(void){ void *cpu; sqInt cpuAlien; usqIntptr_t endAddress; usqIntptr_t startAddress; startAddress = (BytesPerOop == 4 ? positive32BitValueOf(stackValue(1)) : positive64BitValueOf(stackValue(1))); endAddress = (BytesPerOop == 4 ? positive32BitValueOf(stackValue(0)) : positive64BitValueOf(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; } flushICacheFromTo(cpu, startAddress, endAddress); if (failed()) { return null; } pop(2); return null;}
开发者ID:johnnyzz,项目名称:pharo-vm,代码行数:30,
示例9: primitiveGetStringKeyedByprimitiveGetStringKeyedBy(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;}
开发者ID:estebanlm,项目名称:pharo-vm,代码行数:28,
示例10: primitiveEqualprimitiveEqual(void){ sqInt arg; float *argPtr; sqInt i; sqInt length; sqInt rcvr; float *rcvrPtr; arg = stackValue(0); rcvr = stackValue(1); if (!((isWords(arg)) && (isWords(rcvr)))) { return primitiveFail(); } pop(2); if (!(((length = stSizeOf(arg))) == (stSizeOf(rcvr)))) { return pushBool(0); } rcvrPtr = ((float *) (firstIndexableField(rcvr))); argPtr = ((float *) (firstIndexableField(arg))); for (i = 0; i < length; i += 1) { if (!((rcvrPtr[i]) == (argPtr[i]))) { return pushBool(0); } } return pushBool(1);}
开发者ID:johnnyzz,项目名称:pharo-vm,代码行数:28,
示例11: primitiveSetFogprimitiveSetFog(void){ // B3DAcceleratorPlugin>>#primitiveSetFog double density; sqInt fogType; sqInt handle; sqInt result; sqInt rgba; double start; double stop; if (!((methodArgumentCount()) == 6)) { return primitiveFail(); } rgba = positive32BitValueOf(stackValue(0)); stop = floatValueOf(stackValue(1)); start = floatValueOf(stackValue(2)); density = floatValueOf(stackValue(3)); fogType = stackIntegerValue(4); handle = stackIntegerValue(5); if (failed()) { return null; } result = b3dxSetFog(handle, fogType, density, start, stop, rgba); if (!result) {return primitiveFail(); } return pop(6);}
开发者ID:JeanBaptisteArnaud,项目名称:RaspLocalDebug,代码行数:29,
示例12: primitiveFileTruncateprimitiveFileTruncate(void){ // FilePlugin>>#primitiveFileTruncate SQFile *file; sqInt objectPointer; sqInt sz; squeakFileOffsetType truncatePosition; if (!(isIntegerObject(stackValue(0)))) { sz = sizeof(squeakFileOffsetType); if ((byteSizeOf(stackValue(0))) > sz) { return primitiveFail(); } } truncatePosition = positive64BitValueOf(stackValue(0)); /* begin fileValueOf: */ objectPointer = stackValue(1); if (!((isBytes(objectPointer)) && ((byteSizeOf(objectPointer)) == (sizeof(SQFile))))) { primitiveFail(); file = null; goto l1; } file = firstIndexableField(objectPointer);l1: /* end fileValueOf: */; if (!(failed())) { sqFileTruncate(file, truncatePosition); } if (!(failed())) { pop(2); }}
开发者ID:JeanBaptisteArnaud,项目名称:synologyPharo,代码行数:32,
示例13: primitiveDotProductprimitiveDotProduct(void){ sqInt arg; float *argPtr; sqInt i; sqInt length; sqInt rcvr; float *rcvrPtr; double result; arg = stackValue(0); rcvr = stackValue(1); if (!((isWords(arg)) && ((isWords(rcvr)) && (((length = stSizeOf(arg))) == (stSizeOf(rcvr)))))) { return primitiveFail(); } rcvrPtr = ((float *) (firstIndexableField(rcvr))); argPtr = ((float *) (firstIndexableField(arg))); result = 0.0; for (i = 0; i < length; i += 1) { result += (((double) (rcvrPtr[i]))) * (((double) (argPtr[i]))); } pop(2); pushFloat(result); return 0;}
开发者ID:johnnyzz,项目名称:pharo-vm,代码行数:27,
示例14: primitiveDivFloatArrayprimitiveDivFloatArray(void){ sqInt arg; float *argPtr; sqInt i; sqInt length; sqInt rcvr; float *rcvrPtr; arg = stackValue(0); rcvr = stackValue(1); if (!((isWords(arg)) && ((isWords(rcvr)) && (((length = stSizeOf(arg))) == (stSizeOf(rcvr)))))) { return primitiveFail(); } rcvrPtr = ((float *) (firstIndexableField(rcvr))); /* Check if any of the argument's values is zero */ argPtr = ((float *) (firstIndexableField(arg))); for (i = 0; i < length; i += 1) { if ((intAtPointer(((char*) (argPtr + i)))) == 0) { return primitiveFail(); } } for (i = 0; i < length; i += 1) { rcvrPtr[i] = ((((double) (rcvrPtr[i]))) / (((double) (argPtr[i])))); } pop(1); return 0;}
开发者ID:johnnyzz,项目名称:pharo-vm,代码行数:31,
示例15: primitiveGetMacintoshFileTypeAndCreatorFromprimitiveGetMacintoshFileTypeAndCreatorFrom(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;}
开发者ID:estebanlm,项目名称:pharo-vm,代码行数:27,
示例16: primitiveDisassembleAtInMemoryprimitiveDisassembleAtInMemory(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;}
开发者ID:johnnyzz,项目名称:pharo-vm,代码行数:58,
示例17: primitiveAsyncFileWriteStartprimitiveAsyncFileWriteStart(void){ // AsynchFilePlugin>>#primitiveAsyncFileWriteStart sqInt buffer; sqInt bufferPtr; sqInt bufferSize; sqInt count; AsyncFile *f; sqInt fHandle; sqInt fPosition; sqInt num; sqInt start; sqInt startIndex; fHandle = stackValue(4); fPosition = stackIntegerValue(3); buffer = stackValue(2); start = stackIntegerValue(1); num = stackIntegerValue(0); if (failed()) { return null; } f = asyncFileValueOf(fHandle); if (failed()) { return null; } count = num; startIndex = start; /* in bytes or words */bufferSize = slotSizeOf(buffer); if (isWords(buffer)) { /* covert word counts to byte counts */ /* covert word counts to byte counts */count = count * 4; startIndex = ((startIndex - 1) * 4) + 1; bufferSize = bufferSize * 4; } success((startIndex >= 1) && (((startIndex + count) - 1) <= bufferSize)); /* adjust for zero-origin indexing */bufferPtr = ((((int) (firstIndexableField(buffer)))) + startIndex) - 1; if (!(failed())) { asyncFileWriteStart(f, fPosition, bufferPtr, count); } if (failed()) { return null; } pop(5); return null;}
开发者ID:JeanBaptisteArnaud,项目名称:RaspLocalDebug,代码行数:58,
示例18: primitiveFailureOop* __fastcall Interpreter::primitivePerform(CompiledMethod& , unsigned argCount){ SymbolOTE* performSelector = m_oopMessageSelector; // Save in case we need to restore SymbolOTE* selectorToPerform = reinterpret_cast<SymbolOTE*>(stackValue(argCount-1)); if (ObjectMemoryIsIntegerObject(selectorToPerform)) return primitiveFailure(1); m_oopMessageSelector = selectorToPerform; Oop newReceiver = stackValue(argCount); // lookupMethodInClass returns the Oop of the new CompiledMethod // if the selector is found, or Pointers.DoesNotUnderstand if the class // does not understand the selector. We succeed if either the argument // count of the returned method matches that passed to this primitive, // or if the selector is not understood, because by this time the // detection of the 'does not understand' will have triggered // the create of a Message object (see createActualMessage) into // which all the arguments will have been moved, and which then replaces // those arguments on the Smalltalk context stack. i.e. the primitive // will succeed if the message is not understood, but will result in // the execution of doesNotUnderstand: rather than the selector we've // been asked to perform. This works because // after a doesNotUnderstand detection, the stack has a Message at stack // top, the selector is still there, and argCount is now 1. Consequently // the Message gets shuffled over the selector, and doesNotUnderstand is // sent MethodOTE* methodPointer = findNewMethodInClass(ObjectMemory::fetchClassOf(newReceiver), (argCount-1)); CompiledMethod* method = methodPointer->m_location; if (method->m_header.argumentCount == (argCount-1) || m_oopMessageSelector == Pointers.DoesNotUnderstandSelector) { // Shuffle arguments down over the selector (use argumentCount of // method found which may not equal argCount) const unsigned methodArgCount = method->m_header.argumentCount; // #pragma message("primitivePerform: Instead of shuffling args down 1, why not just deduct 1 from calling frames suspended SP after exec?") Oop* const sp = m_registers.m_stackPointer - methodArgCount; // We don't need to count down the overwritten oop anymore, since we don't ref. count stack ops // Not worth overhead of calling memmove here since argumentCount // normally small for (unsigned i=0;i<methodArgCount;i++) sp[i] = sp[i+1]; popStack(); executeNewMethod(methodPointer, methodArgCount); return primitiveSuccess(0); } else { // The argument count did not match, so drop out into the Smalltalk // having restored the selector ASSERT(m_oopMessageSelector!=Pointers.DoesNotUnderstandSelector); m_oopMessageSelector = performSelector; return primitiveFailure(0); }}
开发者ID:brunobuzzi,项目名称:DolphinVM,代码行数:57,
示例19: primitiveAsyncFileReadResultprimitiveAsyncFileReadResult(void){ // AsynchFilePlugin>>#primitiveAsyncFileReadResult sqInt buffer; sqInt bufferPtr; sqInt bufferSize; sqInt count; AsyncFile *f; sqInt fhandle; sqInt num; sqInt r; sqInt start; sqInt startIndex; sqInt _return_value; fhandle = stackValue(3); buffer = stackValue(2); start = stackIntegerValue(1); num = stackIntegerValue(0); if (failed()) { return null; } f = asyncFileValueOf(fhandle); count = num; startIndex = start; /* in bytes or words */bufferSize = slotSizeOf(buffer); if (isWords(buffer)) { /* covert word counts to byte counts */ /* covert word counts to byte counts */count = count * 4; startIndex = ((startIndex - 1) * 4) + 1; bufferSize = bufferSize * 4; } success((startIndex >= 1) && (((startIndex + count) - 1) <= bufferSize)); /* adjust for zero-origin indexing */bufferPtr = ((((int) (firstIndexableField(buffer)))) + startIndex) - 1; if (!(failed())) { r = asyncFileReadResult(f, bufferPtr, count); } _return_value = integerObjectOf(r); if (failed()) { return null; } popthenPush(5, _return_value); return null;}
开发者ID:JeanBaptisteArnaud,项目名称:RaspLocalDebug,代码行数:56,
示例20: stackTop// Locate the next occurrence of the given character in the receiver between the specified indices.BOOL __fastcall Interpreter::primitiveStringNextIndexOfFromTo(){ Oop integerPointer = stackTop(); if (!ObjectMemoryIsIntegerObject(integerPointer)) return primitiveFailure(0); // to not an integer const SMALLINTEGER to = ObjectMemoryIntegerValueOf(integerPointer); integerPointer = stackValue(1); if (!ObjectMemoryIsIntegerObject(integerPointer)) return primitiveFailure(1); // from not an integer SMALLINTEGER from = ObjectMemoryIntegerValueOf(integerPointer); Oop valuePointer = stackValue(2); StringOTE* receiverPointer = reinterpret_cast<StringOTE*>(stackValue(3)); Oop answer = ZeroPointer; if ((ObjectMemory::fetchClassOf(valuePointer) == Pointers.ClassCharacter) && to >= from) { ASSERT(!receiverPointer->isPointers()); // Search a byte object const SMALLINTEGER length = receiverPointer->bytesSize(); // We can only be in here if to>=from, so if to>=1, then => from >= 1 // furthermore if to <= length then => from <= length if (from < 1 || to > length) return primitiveFailure(2); // Search is in bounds, lets do it CharOTE* oteChar = reinterpret_cast<CharOTE*>(valuePointer); Character* charObj = oteChar->m_location; const char charValue = static_cast<char>(ObjectMemoryIntegerValueOf(charObj->m_asciiValue)); String* chars = receiverPointer->m_location; from--; while (from < to) { if (chars->m_characters[from++] == charValue) { answer = ObjectMemoryIntegerObjectOf(from); break; } } } stackValue(3) = answer; pop(3); return primitiveSuccess();}
开发者ID:krodelin,项目名称:DolphinVM,代码行数:52,
示例21: primitiveFileReadprimitiveFileRead(void){ // FilePlugin>>#primitiveFileRead sqInt array; sqInt bytesRead; size_t count; size_t elementSize; SQFile *file; sqInt objectPointer; sqInt retryCount; size_t startIndex; retryCount = 0; count = positive32BitValueOf(stackValue(0)); startIndex = positive32BitValueOf(stackValue(1)); while (1) {array = stackValue(2); /* begin fileValueOf: */ objectPointer = stackValue(3); if (!((isBytes(objectPointer)) && ((byteSizeOf(objectPointer)) == (sizeof(SQFile))))) { primitiveFail(); file = null; goto l1; } file = firstIndexableField(objectPointer); l1: /* end fileValueOf: */; if ((failed()) || (!(isWordsOrBytes(array)))) { return primitiveFailFor(PrimErrBadArgument); } elementSize = (isWords(array) ? 4 : 1); if (!((startIndex >= 1) && (((startIndex + count) - 1) <= (slotSizeOf(array))))) { return primitiveFailFor(PrimErrBadIndex); } bytesRead = sqFileReadIntoAt(file, count * elementSize, ((char *) (firstIndexableField(array))), (startIndex - 1) * elementSize); if (!(((primitiveFailureCode()) == PrimErrObjectMayMove) && (((retryCount += 1)) <= 2))) break; tenuringIncrementalGC(); primitiveFailFor(PrimNoErr); } if (!(failed())) { popthenPush(5, integerObjectOf(bytesRead / elementSize)); }}
开发者ID:JeanBaptisteArnaud,项目名称:synologyPharo,代码行数:48,
示例22: primitiveOSFileHandleprimitiveOSFileHandle(void){ sqInt fileNo; sqInt sqFileOop; sqFileOop = stackValue(0); if (!((((isBytes(sqFileOop)) && ((byteSizeOf(sqFileOop)) == (sizeof(SQFile)))) && ((getThisSessionID()) == (sessionIdentifierFromSqFile(arrayValueOf(sqFileOop))))) && (isNonNullSQFile(sqFileOop)))) { return primitiveFail(); } /* begin fileDescriptorFrom: */ if (!((((isBytes(sqFileOop)) && ((byteSizeOf(sqFileOop)) == (sizeof(SQFile)))) && ((getThisSessionID()) == (sessionIdentifierFromSqFile(arrayValueOf(sqFileOop))))) && (isNonNullSQFile(sqFileOop)))) { fileNo = -1; goto l1; } fileNo = fileno(fileHandleFrom(sqFileOop));l1: /* end fileDescriptorFrom: */; pop(2); pushInteger(fileNo); return 0;}
开发者ID:johnnyzz,项目名称:pharo-vm,代码行数:26,
示例23: primitiveAioSuspendprimitiveAioSuspend(void){ sqInt exceptionWatch; sqInt fd; sqInt flags; sqInt readWatch; sqInt writeWatch; if ((nilObject()) == (stackValue(3))) { return primitiveFail(); } fd = stackIntegerValue(3); if (fd < 0) { return primitiveFail(); } exceptionWatch = stackObjectValue(2); readWatch = stackObjectValue(1); writeWatch = stackObjectValue(0); flags = 0; if (exceptionWatch == (trueObject())) { flags = flags | (AIO_X); } if (readWatch == (trueObject())) { flags = flags | (AIO_R); } if (writeWatch == (trueObject())) { flags = flags | (AIO_W); } aioSuspend(fd, flags); pop(5); pushInteger(flags); return 0;}
开发者ID:johnnyzz,项目名称:pharo-vm,代码行数:33,
示例24: primitiveAioEnableprimitiveAioEnable(void){ static int eventSemaphoreIndices[FD_SETSIZE]; sqInt externalObject; sqInt fd; sqInt flags; sqInt semaIndex; if ((nilObject()) == (stackValue(2))) { return primitiveFail(); } fd = stackIntegerValue(2); if (fd < 0) { return primitiveFail(); } semaIndex = stackIntegerValue(1); eventSemaphoreIndices[semaIndex] = semaIndex; externalObject = stackObjectValue(0); if (externalObject == (trueObject())) { flags = AIO_EXT; } else { flags = 0; } aioEnable(fd, &(eventSemaphoreIndices[semaIndex]), flags); pop(4); pushInteger(semaIndex); return 0;}
开发者ID:johnnyzz,项目名称:pharo-vm,代码行数:29,
示例25: primitiveFileDeleteprimitiveFileDelete(void){ // FilePlugin>>#primitiveFileDelete char *nameIndex; sqInt namePointer; sqInt nameSize; sqInt okToDelete; namePointer = stackValue(0); if (!(isBytes(namePointer))) { return primitiveFail(); } nameIndex = firstIndexableField(namePointer); /* If the security plugin can be loaded, use it to check for permission. If not, assume it's ok */ nameSize = byteSizeOf(namePointer); if (sCDFfn != 0) { okToDelete = ((sqInt (*)(char *, sqInt))sCDFfn)(nameIndex, nameSize); if (!okToDelete) {return primitiveFail(); } } sqFileDeleteNameSize(nameIndex, nameSize); if (!(failed())) { pop(1); }}
开发者ID:JeanBaptisteArnaud,项目名称:synologyPharo,代码行数:29,
示例26: primitiveFileAtEndprimitiveFileAtEnd(void){ // FilePlugin>>#primitiveFileAtEnd sqInt atEnd; SQFile *file; sqInt objectPointer; /* begin fileValueOf: */ objectPointer = stackValue(0); if (!((isBytes(objectPointer)) && ((byteSizeOf(objectPointer)) == (sizeof(SQFile))))) { primitiveFail(); file = null; goto l1; } file = firstIndexableField(objectPointer);l1: /* end fileValueOf: */; if (!(failed())) { atEnd = sqFileAtEnd(file); } if (!(failed())) { pop(2); pushBool(atEnd); }}
开发者ID:JeanBaptisteArnaud,项目名称:synologyPharo,代码行数:25,
示例27: primitiveDirectoryDeleteprimitiveDirectoryDelete(void){ // FilePlugin>>#primitiveDirectoryDelete sqInt dirName; char *dirNameIndex; sqInt dirNameSize; sqInt okToDelete; dirName = stackValue(0); if (!(isBytes(dirName))) { return primitiveFail(); } dirNameIndex = firstIndexableField(dirName); /* If the security plugin can be loaded, use it to check for permission. If not, assume it's ok */ dirNameSize = byteSizeOf(dirName); if (sCDPfn != 0) { okToDelete = ((sqInt (*)(char *, sqInt))sCDPfn)(dirNameIndex, dirNameSize); if (!okToDelete) {return primitiveFail(); } } if (!(dir_Delete(dirNameIndex, dirNameSize))) { return primitiveFail(); } pop(1);}
开发者ID:JeanBaptisteArnaud,项目名称:synologyPharo,代码行数:29,
示例28: primitiveNormalizeprimitiveNormalize(void){ sqInt i; double len; sqInt length; sqInt rcvr; float *rcvrPtr; rcvr = stackValue(0); if (!(isWords(rcvr))) { primitiveFailFor(PrimErrBadReceiver); } length = stSizeOf(rcvr); rcvrPtr = ((float *) (firstIndexableField(rcvr))); len = 0.0; for (i = 0; i < length; i += 1) { len += (((double) (rcvrPtr[i]))) * (((double) (rcvrPtr[i]))); } if (!(len > 0.0)) { primitiveFailFor(PrimErrBadReceiver); } len = sqrt(len); for (i = 0; i < length; i += 1) { rcvrPtr[i] = ((((double) (rcvrPtr[i]))) / len); } return 0;}
开发者ID:johnnyzz,项目名称:pharo-vm,代码行数:27,
示例29: primitiveResetCPUprimitiveResetCPU(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;}
开发者ID:johnnyzz,项目名称:pharo-vm,代码行数:27,
注:本文中的stackValue函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ stack_destroy函数代码示例 C++ stackPushINT函数代码示例 |