コード例 #1
0
ファイル: vm.c プロジェクト: Juxi/aseba
void AsebaVMEmitNodeSpecificError(AsebaVMState *vm, const char* message)
{
	uint16 msgLen = strlen(message);
#if defined(__GNUC__)
	uint8 buffer[msgLen+3];
#elif defined(_MSC_VER)
	uint8 * buffer = _alloca(msgLen+3);
#else
	#error "Please provide a stack memory allocator for your compiler"
#endif
	
	if (AsebaVMErrorCB)
		AsebaVMErrorCB(vm, message);
	
	vm->flags = ASEBA_VM_STEP_BY_STEP_MASK;
	
	((uint16*)buffer)[0] = bswap16(vm->pc);
	buffer[2] = (uint8)msgLen;
	memcpy(buffer+3, message, msgLen);
	
	AsebaSendMessage(vm, ASEBA_MESSAGE_NODE_SPECIFIC_ERROR, buffer, msgLen+3);
}
コード例 #2
0
extern "C" void AsebaSendMessageWords(AsebaVMState *vm, uint16 type, const uint16* data, uint16 count)
{
	AsebaSendMessage(vm, type, data, count*2);
}