Uint16 UNIX_ComputerSystem::getPrimaryStatus() const { return Uint16(DEFAULT_PRIMARY_STATUS); }
void CIMError::setErrorType(ErrorTypeEnum value, bool null) { Set(_inst, "ErrorType", Uint16(value), null); }
void CIMError::setErrorSourceFormat(ErrorSourceFormatEnum value, bool null) { Set(_inst, "ErrorSourceFormat", Uint16(value), null); }
void Split_UDP_Socket::send(const IPaddress &ip, const std::string &data) { send(ip, data.c_str(), Uint16(data.size())); }
bool Joystick::setVibration(float left, float right, float duration) { left = std::min(std::max(left, 0.0f), 1.0f); right = std::min(std::max(right, 0.0f), 1.0f); if (left == 0.0f && right == 0.0f) return setVibration(); if (!checkCreateHaptic()) return false; Uint32 length = SDL_HAPTIC_INFINITY; if (duration >= 0.0f) { float maxduration = std::numeric_limits<Uint32>::max() / 1000.0f; length = Uint32(std::min(duration, maxduration) * 1000); } bool success = false; unsigned int features = SDL_HapticQuery(haptic); int axes = SDL_HapticNumAxes(haptic); if ((features & SDL_HAPTIC_LEFTRIGHT) != 0) { memset(&vibration.effect, 0, sizeof(SDL_HapticEffect)); vibration.effect.type = SDL_HAPTIC_LEFTRIGHT; vibration.effect.leftright.length = length; vibration.effect.leftright.large_magnitude = Uint16(left * LOVE_UINT16_MAX); vibration.effect.leftright.small_magnitude = Uint16(right * LOVE_UINT16_MAX); success = runVibrationEffect(); } // Some gamepad drivers only give support for controlling individual motors // through a custom FF effect. if (!success && isGamepad() && (features & SDL_HAPTIC_CUSTOM) && axes == 2) { // NOTE: this may cause issues with drivers which support custom effects // but aren't similar to https://github.com/d235j/360Controller . // Custom effect data is clamped to 0x7FFF in SDL. vibration.data[0] = vibration.data[2] = Uint16(left * 0x7FFF); vibration.data[1] = vibration.data[3] = Uint16(right * 0x7FFF); memset(&vibration.effect, 0, sizeof(SDL_HapticEffect)); vibration.effect.type = SDL_HAPTIC_CUSTOM; vibration.effect.custom.length = length; vibration.effect.custom.channels = 2; vibration.effect.custom.period = 10; vibration.effect.custom.samples = 2; vibration.effect.custom.data = vibration.data; success = runVibrationEffect(); } // Fall back to a simple sine wave if all else fails. This only supports a // single strength value. if (!success && (features & SDL_HAPTIC_SINE) != 0) { memset(&vibration.effect, 0, sizeof(SDL_HapticEffect)); vibration.effect.type = SDL_HAPTIC_SINE; vibration.effect.periodic.length = length; vibration.effect.periodic.period = 10; float strength = std::max(left, right); vibration.effect.periodic.magnitude = Sint16(strength * 0x7FFF); success = runVibrationEffect(); } if (success) { vibration.left = left; vibration.right = right; if (length == SDL_HAPTIC_INFINITY) vibration.endtime = SDL_HAPTIC_INFINITY; else vibration.endtime = SDL_GetTicks() + length; } else { vibration.left = vibration.right = 0.0f; vibration.endtime = SDL_HAPTIC_INFINITY; } return success; }
Uint16 ZoneMap::addEntity(Entity p_entity) { m_entities.push_back(p_entity); return Uint16(m_entities.size()); }
Uint16 ZoneMap::getEntitySize() { return Uint16(m_entities.size()); }
Uint16 UNIX_ComputerSystem::getPowerState() const { return Uint16(0); }
Uint16 UNIX_ComputerSystem::getWakeUpType() const { return Uint16(0); }
Uint16 UNIX_ComputerSystem::getTransitioningToState() const { return Uint16(0); }
Uint16 UNIX_ComputerSystem::getResetCapability() const { return Uint16(0); }
Uint16 UNIX_ComputerSystem::getEnabledDefault() const { return Uint16(0); }
Uint16 UNIX_ComputerSystem::getRequestedState() const { return Uint16(0); }
Uint16 UNIX_ComputerSystem::getEnabledState() const { return Uint16(DEFAULT_ENABLED_STATE); }
Uint16 UNIX_AssociatedProtocolController::getAccessState() const { return Uint16(0); }
Uint16 UNIX_ClassifierFilterSet::getFilterListPosition() const { return Uint16(0); }
void ZoneMap::save(std::string p_zoneName) { std::cout << "Saving map map\\zones\\" << p_zoneName << "... "; m_mapName = p_zoneName; std::ofstream _file; _mkdir(std::string("map").c_str()); _mkdir(std::string("map\\zones").c_str()); _mkdir(std::string("map\\zones\\" + m_mapName).c_str()); _mkdir(std::string("map\\zones\\" + m_mapName + "\\entities").c_str()); // Save Info _file.open(std::string("map\\zones\\" + m_mapName + "\\Info.cfg"), std::ios::binary); { FileExt::writeShort(_file, m_mapSize.x); FileExt::writeShort(_file, m_mapSize.y); } _file.close(); // Save Ground _file.open(std::string("map\\zones\\" + m_mapName + "\\Ground.tmf"), std::ios::binary); { Uint16 _tCount = 0; Uint16 _tile = m_tileData[0][0][0]; for(Uint16 y = 0; y < m_mapSize.y; y++) { for(Uint16 x = 0; x < m_mapSize.x; x++) { if(_tile == m_tileData[0][x][y] && _tCount < 255) _tCount++; else { FileExt::writeShort(_file, _tCount); FileExt::writeShort(_file, _tile); _tCount = 1; _tile = m_tileData[0][x][y]; } } } if(_tCount != 0) { FileExt::writeShort(_file, _tCount); FileExt::writeShort(_file, _tile); } } _file.close(); // Save World _file.open(std::string("map\\zones\\" + m_mapName + "\\World.tmf"), std::ios::binary); { FileExt::writeShort(_file, Uint16(m_worldObjects.size())); std::vector<Uint8> _objData; for(Uint16 i = 0; i < Uint16(m_worldObjects.size()); i++) { FileExt::writeChar(_file, Uint8(m_worldObjects[i].m_name.length())); for(Uint16 j = 0; j < Uint16(min(m_worldObjects[i].m_name.length(), 128)); j++) FileExt::writeChar(_file, Uint8(m_worldObjects[i].m_name[j])); FileExt::writeShort(_file, Uint8(m_worldObjects[i].m_interactionType)); FileExt::writeShort(_file, Uint8(m_worldObjects[i].m_tileTex)); switch(m_worldObjects[i].m_interactionType) { case 0: // NONE break; case 1: // SOLID break; case 2: // SWITCH FileExt::writeChar(_file, Uint8(m_worldObjects[i].m_frequency)); break; case 3: // SOLID SWITCH FileExt::writeChar(_file, Uint8(m_worldObjects[i].m_frequency)); break; case 4: // PORTAL FileExt::writeChar(_file, Uint8(m_worldObjects[i].m_frequency)); FileExt::writeChar(_file, Uint8(m_worldObjects[i].m_portalDest.length())); for(Uint16 j = 0; j < Uint16(min(m_worldObjects[i].m_portalDest.length(), 128)); j++) FileExt::writeChar(_file, Uint8(m_worldObjects[i].m_portalDest[j])); FileExt::writeShort(_file, Uint8(m_worldObjects[i].m_destX)); FileExt::writeShort(_file, Uint8(m_worldObjects[i].m_destY)); break; case 5: // DIRECTION FileExt::writeChar(_file, Uint8(m_worldObjects[i].m_direction)); break; case 6: // LIGHT FileExt::writeChar(_file, Uint8(m_worldObjects[i].m_lightValue)); break; } } Uint16 _tCount = 0; Uint16 _tile = m_tileData[1][0][0]; for(Uint16 y = 0; y < m_mapSize.y; y++) { for(Uint16 x = 0; x < m_mapSize.x; x++) { if(_tile == m_tileData[1][x][y] && _tCount < 255) _tCount++; else { FileExt::writeShort(_file, _tCount); FileExt::writeShort(_file, _tile); _tCount = 1; _tile = m_tileData[1][x][y]; } } } if(_tCount != 0) { FileExt::writeShort(_file, _tCount); FileExt::writeShort(_file, _tile); } } _file.close(); // Save Sky _file.open(std::string("map\\zones\\" + m_mapName + "\\Sky.tmf"), std::ios::binary); { Uint16 _tCount = 0; Uint16 _tile = m_tileData[2][0][0]; for(Uint16 y = 0; y < m_mapSize.y; y++) { for(Uint16 x = 0; x < m_mapSize.x; x++) { if(_tile == m_tileData[2][x][y] && _tCount < 255) _tCount++; else { FileExt::writeShort(_file, _tCount); FileExt::writeShort(_file, _tile); _tCount = 1; _tile = m_tileData[2][x][y]; } } } if(_tCount != 0) { FileExt::writeShort(_file, _tCount); FileExt::writeShort(_file, _tile); } } _file.close(); // Save Entity Name and Position _file.open(std::string("map\\zones\\" + m_mapName + "\\Entity.tmf"), std::ios::binary); { FileExt::writeShort(_file, Uint16(m_entities.size())); Entity _en; for(Uint16 i = 0; i < m_entities.size(); i++) { _en = m_entities[i]; FileExt::writeShort(_file, Uint16(_en.m_name.length())); for(Uint16 j = 0; j < _en.m_name.length(); j++) FileExt::writeChar(_file, _en.m_name[j]); FileExt::writeShort(_file, _en.m_pos.x); FileExt::writeShort(_file, _en.m_pos.y); _mkdir(std::string("map\\zones\\" + m_mapName + "\\entities\\" + m_entities[i].m_name).c_str()); } } _file.close(); // Save Entity Info for(Uint16 i = 1; i < Uint16(m_entities.size()); i++) { _file.open(std::string("map\\zones\\" + m_mapName + "\\entities\\" + m_entities[i].m_name + "\\Info.cfg"), std::ios::binary); { FileExt::writeChar(_file, m_entities[i].m_entityType); FileExt::writeShort(_file, Uint16(m_entities[i].m_entityTex.getName().length())); for(Uint16 j = 0; j < m_entities[i].m_entityTex.getName().length(); j++) FileExt::writeChar(_file, m_entities[i].m_entityTex.getName()[j]); FileExt::writeShort(_file, Uint16(m_entities[i].m_entityTexId)); } _file.close(); } // Save Entity Interact Scripts for(Uint16 i = 0; i < Uint16(m_entities.size()); i++) { _file.open(std::string("map\\zones\\" + m_mapName + "\\entities\\" + m_entities[i].m_name + "\\Interact"), std::ios::binary); { for(Uint16 j = 0; j < m_entities[i].m_interact.length(); j++) FileExt::writeChar(_file, m_entities[i].m_interact[j]); } _file.close(); } // Save Entity Idle Script for(Uint16 i = 0; i < Uint16(m_entities.size()); i++) { _file.open(std::string("map\\zones\\" + m_mapName + "\\entities\\" + m_entities[i].m_name + "\\Idle"), std::ios::binary); { for(Uint16 j = 0; j < m_entities[i].m_idle.length(); j++) FileExt::writeChar(_file, m_entities[i].m_idle[j]); } _file.close(); } std::cout << "Complete." << std::endl; }
void drive_resolve_primitive() { const char* env = getenv("PEGASUS_HOME"); String repositoryDir(env); repositoryDir.append("/repository"); //String repositoryDir("c:/pegasus-cvs/pegasus/repository"); CIMNamespaceName _ns("root/cimv2"); CIMRepository *_rep = new CIMRepository(repositoryDir); RepositoryQueryContext _query(_ns, _rep); RepositoryQueryContext _query1(_ns, _rep); try { const CQLIdentifier _Id1(String("CIM_OperatingSystem")); _query.insertClassPath(_Id1); const CIMName _cimName(String("CIM_OperatingSystem")); CIMInstance _i1(_cimName); CIMProperty _p1(CIMName("Description"),CIMValue(String("Dave Rules"))); CIMProperty _p2(CIMName("EnabledState"),CIMValue(Uint16(2))); CIMProperty _p3(CIMName("CurrentTimeZone"),CIMValue(Sint16(-600))); CIMProperty _p4(CIMName("TimeOfLastStateChange"), CIMValue(CIMDateTime(String("20040811105625.000000-360")))); _i1.addProperty(_p1); _i1.addProperty(_p2); _i1.addProperty(_p3); _i1.addProperty(_p4); CQLChainedIdentifier ci1( String("CIM_OperatingSystem.CIM_OperatingSystem::Description")); CQLChainedIdentifier ci2(String("CIM_OperatingSystem.CIM_OperatingSystem::EnabledState")); CQLChainedIdentifier ci3( String("CIM_OperatingSystem.CIM_OperatingSystem::CurrentTimeZone")); CQLChainedIdentifier ci4( String("CIM_OperatingSystem.CIM_OperatingSystem::TimeOfLastStateChange")); CQLChainedIdentifier ci5(String( "CIM_OperatingSystem.CIM_EnabledLogicalElement::TimeOfLastStateChange")); CQLChainedIdentifier ci7(String("CIM_OperatingSystem")); CQLChainedIdentifier ci9(String( "CIM_EnabledLogicalElement.CIM_OperatingSystem::CSCreationClassName")); CQLChainedIdentifier ci10(String("CIM_OperatingSystem.CIM_OperatingSystem::Bubba")); CQLValue a1(ci1); CQLValue a2(ci2); CQLValue a3(ci3); CQLValue a4(ci4); CQLValue a5(ci5); CQLValue a7(ci7); CQLValue a9(ci9); CQLValue a10(ci10); CQLValue a11(_query.getClass(CIMName("CIM_OperatingSystem"))); a1.resolve(_i1, _query); a2.resolve(_i1, _query); a3.resolve(_i1, _query); a4.resolve(_i1, _query); a5.resolve(_i1, _query); a7.resolve(_i1, _query); a10.resolve(_i1, _query1); a9.resolve(_i1, _query); PEGASUS_TEST_ASSERT(a1 == CQLValue(String("Dave Rules"))); PEGASUS_TEST_ASSERT(a2 == CQLValue(Uint64(2))); PEGASUS_TEST_ASSERT(a3 == CQLValue(Sint64(-600))); PEGASUS_TEST_ASSERT(a4 == CQLValue( CIMDateTime(String("20040811105625.000000-360")))); PEGASUS_TEST_ASSERT(a5 == CQLValue( CIMDateTime(String("20040811105625.000000-360")))); //PEGASUS_TEST_ASSERT(a7 == CQLValue(_i1)); PEGASUS_TEST_ASSERT(a9.isNull()); PEGASUS_TEST_ASSERT(a10.isNull()); } catch(Exception & e) { cout << e.getMessage() << endl; PEGASUS_TEST_ASSERT(0); } delete _rep; return; }
bool ZoneMap::load(std::string p_zoneName) { std::cout << "Loading map map\\zones\\" << p_zoneName << "... "; std::ifstream _file; _file.open(std::string("map\\zones\\" + p_zoneName + "\\Info.cfg").c_str(), std::ios::binary); { if(!_file.good()) { std::cout << "No Info.cfg file found." << std::endl; return false; } } _file.close(); _file.open(std::string("map\\zones\\" + p_zoneName + "\\Ground.tmf").c_str(), std::ios::binary); { if(!_file.good()) { std::cout << "No Ground.tmf file found." << std::endl; return false; } } _file.close(); _file.open(std::string("map\\zones\\" + p_zoneName + "\\World.tmf").c_str(), std::ios::binary); { if(!_file.good()) { std::cout << "No World.tmf file found." << std::endl; return false; } } _file.close(); _file.open(std::string("map\\zones\\" + p_zoneName + "\\Entity.tmf").c_str(), std::ios::binary); { if(!_file.good()) { std::cout << "No Entity.tmf file found." << std::endl; return false; } } _file.close(); _file.open(std::string("map\\zones\\" + p_zoneName + "\\Sky.tmf").c_str(), std::ios::binary); { if(!_file.good()) { std::cout << "No Sky.tmf file found." << std::endl; return false; } } _file.close(); clear(); m_mapName = p_zoneName; Uint32 _length, _index; char* _data; _file.open(std::string("map\\zones\\" + p_zoneName + "\\Info.cfg").c_str(), std::ios::binary); { _index = 0; _file.seekg(0, _file.end); _length = Uint32(_file.tellg()); _file.seekg(0, _file.beg); _data = new char[_length]; _file.read(_data, _length); m_mapSize.x = FileExt::readShort(_data, _index); m_mapSize.y = FileExt::readShort(_data, _index); init(); delete[] _data; } _file.close(); Uint16 _tileCount; Uint16 _tileId, _mapIndex; _file.open(std::string("map\\zones\\" + p_zoneName + "\\Ground.tmf").c_str(), std::ios::binary); { _mapIndex = 0; _index = 0; _file.seekg(0, _file.end); _length = Uint32(_file.tellg()); _file.seekg(0, _file.beg); _data = new char[_length]; _file.read(_data, _length); while(_mapIndex < m_mapSize.x * m_mapSize.y && _index < _length) { _tileCount = FileExt::readShort(_data, _index); _tileId = FileExt::readShort(_data, _index); for(Uint16 i = 0; i < _tileCount; i++) { m_tileData[0][_mapIndex % m_mapSize.x][int(floor(GLfloat(_mapIndex) / m_mapSize.x))] = _tileId; _mapIndex++; } } delete[] _data; } _file.close(); _file.open(std::string("map\\zones\\" + p_zoneName + "\\World.tmf").c_str(), std::ios::binary); { _mapIndex = 0; _index = 0; _file.seekg(0, _file.end); _length = Uint32(_file.tellg()); _file.seekg(0, _file.beg); _data = new char[_length]; _file.read(_data, _length); Uint16 _objCount = FileExt::readShort(_data, _index); Uint16 _objNameLen = 0; std::string _objName; Uint16 _interactionType, _tileTex; m_worldObjects.clear(); for(Uint16 i = 0; i < _objCount; i++) { _objName = ""; _objNameLen = FileExt::readChar(_data, _index); for(Uint16 j = 0; j < Uint16(_objNameLen); j++) _objName = _objName + char(FileExt::readChar(_data, _index)); _interactionType = FileExt::readShort(_data, _index); _tileTex = FileExt::readShort(_data, _index); m_worldObjects.push_back(WorldObject(_objName, _interactionType, _tileTex)); switch(m_worldObjects[i].m_interactionType) { case 0: // NONE break; case 1: // SOLID break; case 2: // SWITCH m_worldObjects[i].m_frequency = FileExt::readChar(_data, _index); break; case 3: // SOLID SWITCH m_worldObjects[i].m_frequency = FileExt::readChar(_data, _index); break; case 4: // PORTAL m_worldObjects[i].m_frequency = FileExt::readChar(_data, _index); _objName = ""; _objNameLen = FileExt::readChar(_data, _index); for(Uint16 j = 0; j < Uint16(_objNameLen); j++) _objName = _objName + char(FileExt::readChar(_data, _index)); m_worldObjects[i].m_portalDest = _objName; m_worldObjects[i].m_destX = FileExt::readShort(_data, _index); m_worldObjects[i].m_destY = FileExt::readShort(_data, _index); break; case 5: // DIRECTION m_worldObjects[i].m_direction = FileExt::readChar(_data, _index); break; case 6: // LIGHT m_worldObjects[i].m_lightValue = FileExt::readChar(_data, _index); break; } } while(_mapIndex < m_mapSize.x * m_mapSize.y && _index < _length) { _tileCount = FileExt::readShort(_data, _index); _tileId = FileExt::readShort(_data, _index); for(Uint16 i = 0; i < _tileCount; i++) { m_tileData[1][_mapIndex % m_mapSize.x][int(floor(GLfloat(_mapIndex) / m_mapSize.x))] = _tileId; if(m_worldObjects[_tileId].m_interactionType == 6) addLight(LightNode(_mapIndex % m_mapSize.x, floor(GLfloat(_mapIndex) / m_mapSize.x), m_worldObjects[_tileId].m_lightValue)); _mapIndex++; } } delete[] _data; } _file.close(); _file.open(std::string("map\\zones\\" + p_zoneName + "\\Sky.tmf").c_str(), std::ios::binary); { _mapIndex = 0; _index = 0; _file.seekg(0, _file.end); _length = Uint32(_file.tellg()); _file.seekg(0, _file.beg); _data = new char[_length]; _file.read(_data, _length); while(_mapIndex < m_mapSize.x * m_mapSize.y && _index < _length) { _tileCount = FileExt::readShort(_data, _index); _tileId = FileExt::readShort(_data, _index); for(Uint16 i = 0; i < _tileCount; i++) { m_tileData[2][_mapIndex % m_mapSize.x][int(floor(GLfloat(_mapIndex) / m_mapSize.x))] = _tileId; _mapIndex++; } } delete[] _data; } _file.close(); _file.open(std::string("map\\zones\\" + p_zoneName + "\\Entity.tmf").c_str(), std::ios::binary); { _mapIndex = 0; _index = 0; _file.seekg(0, _file.end); _length = Uint32(_file.tellg()); _file.seekg(0, _file.beg); _data = new char[_length]; _file.read(_data, _length); Uint16 _objCount = FileExt::readShort(_data, _index); Uint16 _objNameLen = 0; std::string _objName; Uint16 _texNameLen = 0; std::string _texName; m_entities.clear(); for(Uint16 i = 0; i < _objCount; i++) { _objName = ""; _objNameLen = FileExt::readShort(_data, _index); for(Uint16 j = 0; j < Uint16(_objNameLen); j++) _objName = _objName + char(FileExt::readChar(_data, _index)); m_entities.push_back(Entity(_objName)); m_entities[i].m_pos.x = FileExt::readShort(_data, _index); m_entities[i].m_pos.y = FileExt::readShort(_data, _index); } delete[] _data; } _file.close(); Uint16 _texNameLen = 0; std::string _texName = ""; for(Uint16 i = 0; i < m_entities.size(); i++) { _file.open(std::string("map\\zones\\" + p_zoneName + "\\entities\\" + m_entities[i].m_name + "\\Info.cfg").c_str(), std::ios::binary); { if(!_file.good()) continue; _index = 0; _file.seekg(0, _file.end); _length = Uint32(_file.tellg()); _file.seekg(0, _file.beg); _data = new char[_length]; _file.read(_data, _length); m_entities[i].m_entityType = FileExt::readChar(_data, _index); _texNameLen = FileExt::readShort(_data, _index); _texName = ""; for(Uint16 i = 0; i < _texNameLen; i++) _texName += FileExt::readChar(_data, _index); m_entities[i].m_entityTex = LTexture::getInstance().getImage(_texName); m_entities[i].m_entityTex.setName(_texName); m_entities[i].m_entityTexId = FileExt::readShort(_data, _index); delete[] _data; } _file.close(); } for(Uint16 i = 1; i < m_entities.size(); i++) { _file.open(std::string("map\\zones\\" + p_zoneName + "\\entities\\" + m_entities[i].m_name + "\\Interact").c_str(), std::ios::binary); { if(!_file.good()) continue; _index = 0; _file.seekg(0, _file.end); _length = Uint32(_file.tellg()); _file.seekg(0, _file.beg); _data = new char[_length]; _file.read(_data, _length); for(Uint16 j = 0; j < _length; j++) m_entities[i].m_interact += FileExt::readChar(_data, _index); delete[] _data; } _file.close(); } for(Uint16 i = 1; i < m_entities.size(); i++) { _file.open(std::string("map\\zones\\" + p_zoneName + "\\entities\\" + m_entities[i].m_name + "\\Idle").c_str(), std::ios::binary); { if(!_file.good()) continue; _index = 0; _file.seekg(0, _file.end); _length = Uint32(_file.tellg()); _file.seekg(0, _file.beg); _data = new char[_length]; _file.read(_data, _length); for(Uint16 j = 0; j < _length; j++) m_entities[i].m_idle += FileExt::readChar(_data, _index); delete[] _data; } _file.close(); } std::cout << "Complete." << std::endl; return true; }
void drive_resolve_specialChars() { const char* env = getenv("PEGASUS_HOME"); String repositoryDir(env); repositoryDir.append("/repository"); //String repositoryDir("c:/pegasus-cvs/pegasus/repository"); CIMNamespaceName _ns("root/cimv2"); CIMRepository *_rep = new CIMRepository(repositoryDir); RepositoryQueryContext _query(_ns, _rep); RepositoryQueryContext _query1(_ns, _rep); try { const CQLIdentifier _Id1(String("CIM_OperatingSystem")); _query.insertClassPath(_Id1); const CIMName _cimName(String("CIM_OperatingSystem")); CIMInstance _i1(_cimName); CIMProperty _p1(CIMName("OSType"),CIMValue(Uint16(11))); CIMProperty _p2(CIMName("Status"),CIMValue(String("Degraded"))); Array<Uint16> array16; array16.append(Uint16(0)); array16.append(Uint16(1)); array16.append(Uint16(2)); array16.append(Uint16(3)); CIMProperty _p3(CIMName("OperationalStatus"),CIMValue(array16)); _i1.addProperty(_p1); _i1.addProperty(_p2); _i1.addProperty(_p3); CQLChainedIdentifier ci1(String("CIM_OperatingSystem.OSType#OS400")); CQLChainedIdentifier ci2(String("CIM_OperatingSystem.OSType#LINUX")); CQLChainedIdentifier ci3(String("CIM_OperatingSystem.Status#Degraded")); CQLChainedIdentifier ci5(String("CIM_OperatingSystem.Status#BOGUS")); CQLChainedIdentifier ci6( String("CIM_OperatingSystem.CIM_OperatingSystem::" "OperationalStatus[2]")); CQLValue a1(ci1); CQLValue a2(ci2); CQLValue a3(ci3); CQLValue a5(ci5); CQLValue a6(ci6); a1.resolve(_i1, _query); a2.resolve(_i1, _query); a6.resolve(_i1, _query); try { a3.resolve(_i1, _query); PEGASUS_TEST_ASSERT(0); } catch(...) { PEGASUS_TEST_ASSERT(1); } try { a5.resolve(_i1, _query); PEGASUS_TEST_ASSERT(0); } catch(...) { PEGASUS_TEST_ASSERT(1); } PEGASUS_TEST_ASSERT(a1 == CQLValue(Uint64(11))); PEGASUS_TEST_ASSERT(a2 == CQLValue(Uint64(36))); PEGASUS_TEST_ASSERT(a6 == CQLValue(Uint64(2))); } catch(Exception & e) { cout << e.getMessage() << endl; PEGASUS_TEST_ASSERT(0); } delete _rep; return; }
void TCP_Socket::send(const std::string &data) { send(data.c_str(), Uint16(data.size())); }
void drive_operation() { // Uint64 tests CQLValue a1(Uint64(10)); CQLValue a2(Uint64(15)); CQLValue a3(Uint64(25)); CQLValue a4(Uint64(30)); CQLValue a5(Uint64(150)); PEGASUS_TEST_ASSERT(a1 != a2); PEGASUS_TEST_ASSERT(a5 == a5); PEGASUS_TEST_ASSERT(a1 < a2); PEGASUS_TEST_ASSERT(a2 >= a1); PEGASUS_TEST_ASSERT(a1 <= a2); PEGASUS_TEST_ASSERT(a2 > a1); // Sint64 tests CQLValue b1(Sint64(10)); CQLValue b2(Sint64(15)); CQLValue b3(Sint64(25)); CQLValue b4(Sint64(30)); CQLValue b5(Sint64(150)); PEGASUS_TEST_ASSERT(b1 != b2); PEGASUS_TEST_ASSERT(b5 == b5); PEGASUS_TEST_ASSERT(b1 < b2); PEGASUS_TEST_ASSERT(b2 >= b1); PEGASUS_TEST_ASSERT(b1 <= b2); PEGASUS_TEST_ASSERT(b2 > b1); // Real64 tests CQLValue c1(Real64(10.00)); CQLValue c2(Real64(15.00)); CQLValue c3(Real64(25.00)); CQLValue c4(Real64(30.00)); CQLValue c5(Real64(150.00)); PEGASUS_TEST_ASSERT(c1 != c2); PEGASUS_TEST_ASSERT(c5 == c5); PEGASUS_TEST_ASSERT(c1 < c2); PEGASUS_TEST_ASSERT(c2 >= c1); PEGASUS_TEST_ASSERT(c1 <= c2); PEGASUS_TEST_ASSERT(c2 > c1); // Misc PEGASUS_TEST_ASSERT(a1 == b1); PEGASUS_TEST_ASSERT(a1 == c1); PEGASUS_TEST_ASSERT(b1 == a1); PEGASUS_TEST_ASSERT(b1 == c1); PEGASUS_TEST_ASSERT(c1 == a1); PEGASUS_TEST_ASSERT(c1 == b1); PEGASUS_TEST_ASSERT(a2 != b1); PEGASUS_TEST_ASSERT(a2 != c1); PEGASUS_TEST_ASSERT(b2 != a1); PEGASUS_TEST_ASSERT(b2 != c1); PEGASUS_TEST_ASSERT(c2 != a1); PEGASUS_TEST_ASSERT(c2 != b1); PEGASUS_TEST_ASSERT(a2 >= b1); PEGASUS_TEST_ASSERT(a2 >= c1); PEGASUS_TEST_ASSERT(b2 >= a1); PEGASUS_TEST_ASSERT(b2 >= c1); PEGASUS_TEST_ASSERT(c2 >= a1); PEGASUS_TEST_ASSERT(c2 >= b1); PEGASUS_TEST_ASSERT(a2 <= b3); PEGASUS_TEST_ASSERT(a2 <= c3); PEGASUS_TEST_ASSERT(b2 <= a3); PEGASUS_TEST_ASSERT(b2 <= c3); PEGASUS_TEST_ASSERT(c2 <= a3); PEGASUS_TEST_ASSERT(c2 <= b3); PEGASUS_TEST_ASSERT(a2 > b1); PEGASUS_TEST_ASSERT(a2 > c1); PEGASUS_TEST_ASSERT(b2 > a1); PEGASUS_TEST_ASSERT(b2 > c1); PEGASUS_TEST_ASSERT(c2 > a1); PEGASUS_TEST_ASSERT(c2 > b1); PEGASUS_TEST_ASSERT(a2 < b3); PEGASUS_TEST_ASSERT(a2 < c3); PEGASUS_TEST_ASSERT(b2 < a3); PEGASUS_TEST_ASSERT(b2 < c3); PEGASUS_TEST_ASSERT(c2 < a3); PEGASUS_TEST_ASSERT(c2 < b3); //Overflow testing CQLValue real1(Real64(0.00000001)); CQLValue sint1(Sint64(-1)); CQLValue uint1(Sint64(1)); CQLValue uint2(Uint64(0)); PEGASUS_TEST_ASSERT(uint1 > sint1); PEGASUS_TEST_ASSERT(real1 > sint1); PEGASUS_TEST_ASSERT(uint2 > sint1); PEGASUS_TEST_ASSERT(real1 > uint2); CQLValue real2(Real64(25.00000000000001)); CQLValue real3(Real64(24.99999999999999)); CQLValue sint2(Sint64(25)); CQLValue uint3(Uint64(25)); PEGASUS_TEST_ASSERT(real2 > real3); PEGASUS_TEST_ASSERT(real2 > sint2); PEGASUS_TEST_ASSERT(real2 > uint3); PEGASUS_TEST_ASSERT(real3 < sint2); PEGASUS_TEST_ASSERT(real3 < uint3); // String tests CQLValue d1(String("HELLO")); CQLValue d2(String("HEL")); CQLValue d3(String("LO")); CQLValue d4(String("AHELLO")); CQLValue d5(String("ZHELLO")); PEGASUS_TEST_ASSERT(d1 == d2 + d3); PEGASUS_TEST_ASSERT(d1 != d2 + d4); PEGASUS_TEST_ASSERT(d1 <= d5); PEGASUS_TEST_ASSERT(d1 < d5); PEGASUS_TEST_ASSERT(d1 >= d4); PEGASUS_TEST_ASSERT(d1 > d4); String str1("0x10"); String str2("10"); String str3("10B"); String str4("10.10"); CQLValue e1( str1, CQLValue::Hex); CQLValue e2( str2, CQLValue::Decimal); CQLValue e3( str3, CQLValue::Binary); CQLValue e4( str4, CQLValue::Real); CQLValue e5(Uint64(16)); CQLValue e6(Uint64(10)); CQLValue e7(Uint64(2)); CQLValue e8(Real64(10.10)); PEGASUS_TEST_ASSERT(e1 == e5); PEGASUS_TEST_ASSERT(e2 == e6); PEGASUS_TEST_ASSERT(e3 == e7); PEGASUS_TEST_ASSERT(e4 == e8); Array<Uint64> array1; array1.append(1); array1.append(2); array1.append(3); array1.append(4); array1.append(5); array1.append(6); array1.append(7); array1.append(8); array1.append(9); array1.append(10); Array<Sint64> array2; array2.append(1); array2.append(2); array2.append(3); array2.append(4); array2.append(5); array2.append(6); array2.append(7); array2.append(8); array2.append(9); array2.append(10); array2.append(3); Array<Real64> array3; array3.append(1.00); array3.append(2.00); array3.append(3.00); array3.append(9.00); array3.append(10.00); array3.append(3.00); array3.append(4.00); array3.append(5.00); array3.append(6.00); array3.append(7.00); array3.append(8.00); Array<Uint64> array4; array4.append(1); array4.append(23); array4.append(3); array4.append(4); array4.append(5); array4.append(6); array4.append(7); array4.append(88); array4.append(9); array4.append(10); Array<Sint64> array5; array5.append(-1); array5.append(2); array5.append(3); array5.append(4); array5.append(5); array5.append(-6); array5.append(7); array5.append(8); array5.append(9); array5.append(10); array5.append(-3); Array<Real64> array6; array6.append(1.23); array6.append(2.00); array6.append(3.00); array6.append(9.00); array6.append(10.00); array6.append(3.00); array6.append(4.14); array6.append(5.00); array6.append(6.00); array6.append(7.00); array6.append(8.00); CIMValue cv1(array1); CIMValue cv2(array2); CIMValue cv3(array3); CIMValue cv4(array4); CIMValue cv5(array5); CIMValue cv6(array6); CQLValue vr1(cv1); CQLValue vr2(cv1); CQLValue vr3(cv2); CQLValue vr4(cv3); CQLValue vr5(cv4); CQLValue vr6(cv5); CQLValue vr7(cv6); PEGASUS_TEST_ASSERT(vr1 == vr2); PEGASUS_TEST_ASSERT(vr1 == vr3); PEGASUS_TEST_ASSERT(vr1 == vr4); PEGASUS_TEST_ASSERT(vr4 == vr3); PEGASUS_TEST_ASSERT(vr1 != vr5); PEGASUS_TEST_ASSERT(vr3 != vr6); PEGASUS_TEST_ASSERT(vr4 != vr7); const CIMName _cimName(String("CIM_OperatingSystem")); CIMInstance _i1(_cimName); CIMProperty _p1(CIMName("Description"),CIMValue(String("Dave Rules"))); CIMProperty _p2(CIMName("EnabledState"),CIMValue(Uint16(2))); CIMProperty _p3(CIMName("CurrentTimeZone"),CIMValue(Sint16(-600))); CIMProperty _p4(CIMName("TimeOfLastStateChange"), CIMValue(CIMDateTime(String("20040811105625.000000-360")))); _i1.addProperty(_p1); _i1.addProperty(_p2); _i1.addProperty(_p3); _i1.addProperty(_p4); CIMInstance _i2(_cimName); CIMProperty _p5(CIMName("Description"), CIMValue(String("Dave Rules Everything"))); CIMProperty _p6(CIMName("EnabledState"),CIMValue(Uint16(2))); CIMProperty _p7(CIMName("CurrentTimeZone"),CIMValue(Sint16(-600))); CIMProperty _p8(CIMName("TimeOfLastStateChange"), CIMValue(CIMDateTime(String("20040811105625.000000-360")))); _i2.addProperty(_p5); _i2.addProperty(_p6); _i2.addProperty(_p7); _i2.addProperty(_p8); CQLValue cql1(_i1); CQLValue cql2(_i1); CQLValue cql3(_i2); CQLValue cql4(_i2); //PEGASUS_TEST_ASSERT(cql1 == cql1); return; }
int main(int argc, char **argv) { std::fprintf(stdout, "==========================================\n" #ifdef HARDWARE_OPL3 " libADLMIDI demo utility (HW OPL)\n" #else " libADLMIDI demo utility\n" #endif "==========================================\n\n"); flushout(stdout); if(argc < 2 || std::string(argv[1]) == "--help" || std::string(argv[1]) == "-h") { std::printf( "Usage: adlmidi <midifilename> [ <options> ] [ <bank> [ <numchips> [ <numfourops>] ] ]\n" " -p Enables adlib percussion instrument mode\n" " -t Enables tremolo amplification mode\n" " -v Enables vibrato amplification mode\n" " -s Enables scaling of modulator volumes\n" " -frb Enables full-ranged CC74 XG Brightness controller\n" " -nl Quit without looping\n" " -w Write WAV file rather than playing\n" " -mb Run the test of multibank over embedded. 62, 14, 68, and 74'th banks will be combined into one\n" " --solo <track> Selects a solo track to play\n" " --only <track1,...,trackN> Selects a subset of tracks to play\n" #ifndef HARDWARE_OPL3 " -fp Enables full-panning stereo support\n" " --emu-nuked Uses Nuked OPL3 v 1.8 emulator\n" " --emu-nuked7 Uses Nuked OPL3 v 1.7.4 emulator\n" " --emu-dosbox Uses DosBox 0.74 OPL3 emulator\n" #endif "\n" "Where <bank> - number of embeeded bank or filepath to custom WOPL bank file\n" "\n" "Note: To create WOPL bank files use OPL Bank Editor you can get here: \n" "https://github.com/Wohlstand/OPL3BankEditor\n" "\n" ); // Get count of embedded banks (no initialization needed) int banksCount = adl_getBanksCount(); //Get pointer to list of embedded bank names const char *const *banknames = adl_getBankNames(); if(banksCount > 0) { std::printf(" Available embedded banks by number:\n\n"); for(int a = 0; a < banksCount; ++a) std::printf("%10s%2u = %s\n", a ? "" : "Banks:", a, banknames[a]); std::printf( "\n" " Use banks 2-5 to play Descent \"q\" soundtracks.\n" " Look up the relevant bank number from descent.sng.\n" "\n" " The fourth parameter can be used to specify the number\n" " of four-op channels to use. Each four-op channel eats\n" " the room of two regular channels. Use as many as required.\n" " The Doom & Hexen sets require one or two, while\n" " Miles four-op set requires the maximum of numcards*6.\n" "\n" ); } else { std::printf(" This build of libADLMIDI has no embedded banks!\n\n"); } flushout(stdout); return 0; } long sampleRate = 44100; #ifndef HARDWARE_OPL3 //const unsigned MaxSamplesAtTime = 512; // 512=dbopl limitation // How long is SDL buffer, in seconds? // The smaller the value, the more often SDL_AudioCallBack() // is called. const double AudioBufferLength = 0.08; // How much do WE buffer, in seconds? The smaller the value, // the more prone to sound chopping we are. const double OurHeadRoomLength = 0.1; // The lag between visual content and audio content equals // the sum of these two buffers. #ifndef OUTPUT_WAVE_ONLY SDL_AudioSpec spec; SDL_AudioSpec obtained; spec.freq = (int)sampleRate; spec.format = AUDIO_S16SYS; spec.channels = 2; spec.samples = Uint16((double)spec.freq * AudioBufferLength); spec.callback = SDL_AudioCallbackX; #endif //OUTPUT_WAVE_ONLY #endif //HARDWARE_OPL3 ADL_MIDIPlayer *myDevice; //Initialize libADLMIDI and create the instance (you can initialize multiple of them!) myDevice = adl_init(sampleRate); if(myDevice == NULL) { printError("Failed to init MIDI device!\n"); return 1; } //Set internal debug messages hook to print all libADLMIDI's internal debug messages adl_setDebugMessageHook(myDevice, debugPrint, NULL); /* * Set library options by parsing of command line arguments */ bool multibankFromEnbededTest = false; #ifndef OUTPUT_WAVE_ONLY bool recordWave = false; int loopEnabled = 1; #endif #ifndef HARDWARE_OPL3 int emulator = ADLMIDI_EMU_NUKED; #endif size_t soloTrack = ~(size_t)0; std::vector<size_t> onlyTracks; #if !defined(HARDWARE_OPL3) && !defined(OUTPUT_WAVE_ONLY) g_audioFormat.type = ADLMIDI_SampleType_S16; g_audioFormat.containerSize = sizeof(Sint16); g_audioFormat.sampleOffset = sizeof(Sint16) * 2; #endif while(argc > 2) { bool had_option = false; if(!std::strcmp("-p", argv[2])) adl_setPercMode(myDevice, 1);//Turn on AdLib percussion mode else if(!std::strcmp("-v", argv[2])) adl_setHVibrato(myDevice, 1);//Force turn on deep vibrato #if !defined(OUTPUT_WAVE_ONLY) && !defined(HARDWARE_OPL3) else if(!std::strcmp("-w", argv[2])) { //Current Wave output implementation allows only SINT16 output g_audioFormat.type = ADLMIDI_SampleType_S16; g_audioFormat.containerSize = sizeof(Sint16); g_audioFormat.sampleOffset = sizeof(Sint16) * 2; recordWave = true;//Record library output into WAV file } else if(!std::strcmp("-s8", argv[2]) && !recordWave) spec.format = AUDIO_S8; else if(!std::strcmp("-u8", argv[2]) && !recordWave) spec.format = AUDIO_U8; else if(!std::strcmp("-s16", argv[2]) && !recordWave) spec.format = AUDIO_S16; else if(!std::strcmp("-u16", argv[2]) && !recordWave) spec.format = AUDIO_U16; else if(!std::strcmp("-s32", argv[2]) && !recordWave) spec.format = AUDIO_S32; else if(!std::strcmp("-f32", argv[2]) && !recordWave) spec.format = AUDIO_F32; #endif else if(!std::strcmp("-t", argv[2])) adl_setHTremolo(myDevice, 1);//Force turn on deep tremolo else if(!std::strcmp("-frb", argv[2])) adl_setFullRangeBrightness(myDevice, 1);//Turn on a full-ranged XG CC74 Brightness #ifndef OUTPUT_WAVE_ONLY else if(!std::strcmp("-nl", argv[2])) loopEnabled = 0; //Enable loop #endif #ifndef HARDWARE_OPL3 else if(!std::strcmp("--emu-nuked", argv[2])) emulator = ADLMIDI_EMU_NUKED; else if(!std::strcmp("--emu-nuked7", argv[2])) emulator = ADLMIDI_EMU_NUKED_174; else if(!std::strcmp("--emu-dosbox", argv[2])) emulator = ADLMIDI_EMU_DOSBOX; #endif else if(!std::strcmp("-fp", argv[2])) adl_setSoftPanEnabled(myDevice, 1); else if(!std::strcmp("-mb", argv[2])) multibankFromEnbededTest = true; else if(!std::strcmp("-s", argv[2])) adl_setScaleModulators(myDevice, 1);//Turn on modulators scaling by volume else if(!std::strcmp("--solo", argv[2])) { if(argc <= 3) { printError("The option --solo requires an argument!\n"); return 1; } soloTrack = std::strtoul(argv[3], NULL, 0); had_option = true; } else if(!std::strcmp("--only", argv[2])) { if(argc <= 3) { printError("The option --only requires an argument!\n"); return 1; } const char *strp = argv[3]; unsigned long value; unsigned size; bool err = std::sscanf(strp, "%lu%n", &value, &size) != 1; while(!err && *(strp += size)) { onlyTracks.push_back(value); err = std::sscanf(strp, ",%lu%n", &value, &size) != 1; } if(err) { printError("Invalid argument to --only!\n"); return 1; } onlyTracks.push_back(value); had_option = true; } else break; std::copy(argv + (had_option ? 4 : 3), argv + argc, argv + 2); argc -= (had_option ? 2 : 1); } #ifndef OUTPUT_WAVE_ONLY //Turn loop on/off (for WAV recording loop must be disabled!) adl_setLoopEnabled(myDevice, recordWave ? 0 : loopEnabled); #endif #ifdef DEBUG_TRACE_ALL_EVENTS //Hook all MIDI events are ticking while generating an output buffer if(!recordWave) adl_setRawEventHook(myDevice, debugPrintEvent, NULL); #endif #ifndef HARDWARE_OPL3 adl_switchEmulator(myDevice, emulator); #endif std::fprintf(stdout, " - Library version %s\n", adl_linkedLibraryVersion()); #ifdef HARDWARE_OPL3 std::fprintf(stdout, " - Hardware OPL3 chip in use\n"); #else std::fprintf(stdout, " - %s Emulator in use\n", adl_chipEmulatorName(myDevice)); #endif #if !defined(HARDWARE_OPL3) && !defined(OUTPUT_WAVE_ONLY) if(!recordWave) { // Set up SDL if(SDL_OpenAudio(&spec, &obtained) < 0) { std::fprintf(stderr, "\nERROR: Couldn't open audio: %s\n\n", SDL_GetError()); //return 1; } if(spec.samples != obtained.samples) { std::fprintf(stderr, " - Audio wanted (format=%s,samples=%u,rate=%u,channels=%u);\n" " - Audio obtained (format=%s,samples=%u,rate=%u,channels=%u)\n", SDLAudioToStr(spec.format), spec.samples, spec.freq, spec.channels, SDLAudioToStr(obtained.format), obtained.samples, obtained.freq, obtained.channels); } switch(obtained.format) { case AUDIO_S8: g_audioFormat.type = ADLMIDI_SampleType_S8; g_audioFormat.containerSize = sizeof(Sint8); g_audioFormat.sampleOffset = sizeof(Sint8) * 2; break; case AUDIO_U8: g_audioFormat.type = ADLMIDI_SampleType_U8; g_audioFormat.containerSize = sizeof(Uint8); g_audioFormat.sampleOffset = sizeof(Uint8) * 2; break; case AUDIO_S16: g_audioFormat.type = ADLMIDI_SampleType_S16; g_audioFormat.containerSize = sizeof(Sint16); g_audioFormat.sampleOffset = sizeof(Sint16) * 2; break; case AUDIO_U16: g_audioFormat.type = ADLMIDI_SampleType_U16; g_audioFormat.containerSize = sizeof(Uint16); g_audioFormat.sampleOffset = sizeof(Uint16) * 2; break; case AUDIO_S32: g_audioFormat.type = ADLMIDI_SampleType_S32; g_audioFormat.containerSize = sizeof(Sint32); g_audioFormat.sampleOffset = sizeof(Sint32) * 2; break; case AUDIO_F32: g_audioFormat.type = ADLMIDI_SampleType_F32; g_audioFormat.containerSize = sizeof(float); g_audioFormat.sampleOffset = sizeof(float) * 2; break; } } #endif if(argc >= 3) { if(is_number(argv[2])) { int bankno = std::atoi(argv[2]); //Choose one of embedded banks if(adl_setBank(myDevice, bankno) != 0) { printError(adl_errorInfo(myDevice)); return 1; } std::fprintf(stdout, " - Use embedded bank #%d [%s]\n", bankno, adl_getBankNames()[bankno]); } else { std::string bankPath = argv[2]; std::fprintf(stdout, " - Use custom bank [%s]...", bankPath.c_str()); flushout(stdout); //Open external bank file (WOPL format is supported) //to create or edit them, use OPL3 Bank Editor you can take here https://github.com/Wohlstand/OPL3BankEditor if(adl_openBankFile(myDevice, bankPath.c_str()) != 0) { std::fprintf(stdout, "FAILED!\n"); flushout(stdout); printError(adl_errorInfo(myDevice)); return 1; } std::fprintf(stdout, "OK!\n"); } } if(multibankFromEnbededTest) { ADL_BankId id[] = { {0, 0, 0}, /*62*/ // isPercussion, MIDI bank MSB, LSB {0, 8, 0}, /*14*/ // Use as MSB-8 {1, 0, 0}, /*68*/ {1, 0, 25} /*74*/ }; int banks[] = { 62, 14, 68, 74 }; for(size_t i = 0; i < 4; i++) { ADL_Bank bank; if(adl_getBank(myDevice, &id[i], ADLMIDI_Bank_Create, &bank) < 0) { printError(adl_errorInfo(myDevice)); return 1; } if(adl_loadEmbeddedBank(myDevice, &bank, banks[i]) < 0) { printError(adl_errorInfo(myDevice)); return 1; } } std::fprintf(stdout, " - Ran a test of multibank over embedded\n"); } #ifndef HARDWARE_OPL3 int numOfChips = 4; if(argc >= 4) numOfChips = std::atoi(argv[3]); //Set count of concurrent emulated chips count to excite channels limit of one chip if(adl_setNumChips(myDevice, numOfChips) != 0) { printError(adl_errorInfo(myDevice)); return 1; } std::fprintf(stdout, " - Number of chips %d\n", adl_getNumChips(myDevice)); #else int numOfChips = 1; adl_setNumChips(myDevice, numOfChips); #endif if(argc >= 5) { //Set total count of 4-operator channels between all emulated chips if(adl_setNumFourOpsChn(myDevice, std::atoi(argv[4])) != 0) { printError(adl_errorInfo(myDevice)); return 1; } } std::fprintf(stdout, " - Number of four-ops %d\n", adl_getNumFourOpsChn(myDevice)); std::string musPath = argv[1]; //Open MIDI file to play if(adl_openFile(myDevice, musPath.c_str()) != 0) { printError(adl_errorInfo(myDevice)); return 2; } std::fprintf(stdout, " - Track count: %lu\n", (unsigned long)adl_trackCount(myDevice)); if(soloTrack != ~(size_t)0) { std::fprintf(stdout, " - Solo track: %lu\n", (unsigned long)soloTrack); adl_setTrackOptions(myDevice, soloTrack, ADLMIDI_TrackOption_Solo); } if(!onlyTracks.empty()) { size_t count = adl_trackCount(myDevice); for(size_t track = 0; track < count; ++track) adl_setTrackOptions(myDevice, track, ADLMIDI_TrackOption_Off); std::fprintf(stdout, " - Only tracks:"); for(size_t i = 0, n = onlyTracks.size(); i < n; ++i) { size_t track = onlyTracks[i]; adl_setTrackOptions(myDevice, track, ADLMIDI_TrackOption_On); std::fprintf(stdout, " %lu", (unsigned long)track); } std::fprintf(stdout, "\n"); } std::fprintf(stdout, " - File [%s] opened!\n", musPath.c_str()); flushout(stdout); #ifndef HARDWARE_OPL3 signal(SIGINT, sighandler); signal(SIGTERM, sighandler); # if !defined(_WIN32) && !defined(__WATCOMC__) signal(SIGHUP, sighandler); # endif #else//HARDWARE_OPL3 static const unsigned NewTimerFreq = 209; unsigned TimerPeriod = 0x1234DDul / NewTimerFreq; #ifdef __DJGPP__ //disable(); outportb(0x43, 0x34); outportb(0x40, TimerPeriod & 0xFF); outportb(0x40, TimerPeriod >> 8); //enable(); #endif//__DJGPP__ #ifdef __WATCOMC__ std::fprintf(stdout, " - Initializing BIOS timer...\n"); flushout(stdout); //disable(); outp(0x43, 0x34); outp(0x40, TimerPeriod & 0xFF); outp(0x40, TimerPeriod >> 8); //enable(); std::fprintf(stdout, " - Ok!\n"); flushout(stdout); #endif//__WATCOMC__ unsigned long BIOStimer_begin = BIOStimer; double tick_delay = 0.0; #endif//HARDWARE_OPL3 double total = adl_totalTimeLength(myDevice); #ifndef OUTPUT_WAVE_ONLY double loopStart = adl_loopStartTime(myDevice); double loopEnd = adl_loopEndTime(myDevice); char totalHMS[25]; char loopStartHMS[25]; char loopEndHMS[25]; secondsToHMSM(total, totalHMS, 25); if(loopStart >= 0.0 && loopEnd >= 0.0) { secondsToHMSM(loopStart, loopStartHMS, 25); secondsToHMSM(loopEnd, loopEndHMS, 25); } # ifndef HARDWARE_OPL3 if(!recordWave) # endif { std::fprintf(stdout, " - Loop is turned %s\n", loopEnabled ? "ON" : "OFF"); if(loopStart >= 0.0 && loopEnd >= 0.0) std::fprintf(stdout, " - Has loop points: %s ... %s\n", loopStartHMS, loopEndHMS); std::fprintf(stdout, "\n==========================================\n"); flushout(stdout); # ifndef HARDWARE_OPL3 SDL_PauseAudio(0); # endif # ifdef DEBUG_SEEKING_TEST int delayBeforeSeek = 50; std::fprintf(stdout, "DEBUG: === Random position set test is active! ===\n"); flushout(stdout); # endif # ifndef HARDWARE_OPL3 Uint8 buff[16384]; # endif char posHMS[25]; uint64_t milliseconds_prev = -1; while(!stop) { # ifndef HARDWARE_OPL3 size_t got = (size_t)adl_playFormat(myDevice, 4096, buff, buff + g_audioFormat.containerSize, &g_audioFormat) * g_audioFormat.containerSize; if(got <= 0) break; # endif # ifdef DEBUG_TRACE_ALL_CHANNELS enum { TerminalColumns = 80 }; char channelText[TerminalColumns + 1]; char channelAttr[TerminalColumns + 1]; adl_describeChannels(myDevice, channelText, channelAttr, sizeof(channelText)); std::fprintf(stdout, "%*s\r", TerminalColumns, ""); // erase the line std::fprintf(stdout, "%s\n", channelText); # endif # ifndef DEBUG_TRACE_ALL_EVENTS double time_pos = adl_positionTell(myDevice); std::fprintf(stdout, " \r"); uint64_t milliseconds = static_cast<uint64_t>(time_pos * 1000.0); if(milliseconds != milliseconds_prev) { secondsToHMSM(time_pos, posHMS, 25); std::fprintf(stdout, " \r"); std::fprintf(stdout, "Time position: %s / %s\r", posHMS, totalHMS); flushout(stdout); milliseconds_prev = milliseconds; } # endif # ifndef HARDWARE_OPL3 g_audioBuffer_lock.Lock(); size_t pos = g_audioBuffer.size(); g_audioBuffer.resize(pos + got); for(size_t p = 0; p < got; ++p) g_audioBuffer[pos + p] = buff[p]; g_audioBuffer_lock.Unlock(); const SDL_AudioSpec &spec = obtained; while(g_audioBuffer.size() > static_cast<size_t>(spec.samples + (spec.freq * g_audioFormat.sampleOffset) * OurHeadRoomLength)) { SDL_Delay(1); } # ifdef DEBUG_SEEKING_TEST if(delayBeforeSeek-- <= 0) { delayBeforeSeek = rand() % 50; double seekTo = double((rand() % int(adl_totalTimeLength(myDevice)) - delayBeforeSeek - 1 )); adl_positionSeek(myDevice, seekTo); } # endif # else//HARDWARE_OPL3 const double mindelay = 1.0 / NewTimerFreq; //__asm__ volatile("sti\nhlt"); //usleep(10000); #ifdef __DJGPP__ __dpmi_yield(); #endif #ifdef __WATCOMC__ //dpmi_dos_yield(); mch_delay((unsigned int)(tick_delay * 1000.0)); #endif static unsigned long PrevTimer = BIOStimer; const unsigned long CurTimer = BIOStimer; const double eat_delay = (CurTimer - PrevTimer) / (double)NewTimerFreq; PrevTimer = CurTimer; tick_delay = adl_tickEvents(myDevice, eat_delay, mindelay); if(adl_atEnd(myDevice) && tick_delay <= 0) stop = true; if(kbhit()) { // Quit on ESC key! int c = getch(); if(c == 27) stop = true; } # endif//HARDWARE_OPL3 } std::fprintf(stdout, " \n\n"); # ifndef HARDWARE_OPL3 SDL_CloseAudio(); # endif } #endif //OUTPUT_WAVE_ONLY #ifndef HARDWARE_OPL3 # ifndef OUTPUT_WAVE_ONLY else # endif //OUTPUT_WAVE_ONLY { std::string wave_out = musPath + ".wav"; std::fprintf(stdout, " - Recording WAV file %s...\n", wave_out.c_str()); std::fprintf(stdout, "\n==========================================\n"); flushout(stdout); if(wave_open(sampleRate, wave_out.c_str()) == 0) { wave_enable_stereo(); short buff[4096]; int complete_prev = -1; while(!stop) { size_t got = (size_t)adl_play(myDevice, 4096, buff); if(got <= 0) break; wave_write(buff, (long)got); int complete = static_cast<int>(std::floor(100.0 * adl_positionTell(myDevice) / total)); flushout(stdout); if(complete_prev != complete) { std::fprintf(stdout, " \r"); std::fprintf(stdout, "Recording WAV... [%d%% completed]\r", complete); std::fflush(stdout); complete_prev = complete; } } wave_close(); std::fprintf(stdout, " \n\n"); if(stop) std::fprintf(stdout, "Interrupted! Recorded WAV is incomplete, but playable!\n"); else std::fprintf(stdout, "Completed!\n"); flushout(stdout); } else { adl_close(myDevice); return 1; } } #endif //HARDWARE_OPL3 #ifdef HARDWARE_OPL3 #ifdef __DJGPP__ // Fix the skewed clock and reset BIOS tick rate _farpokel(_dos_ds, 0x46C, BIOStimer_begin + (BIOStimer - BIOStimer_begin) * (0x1234DD / 65536.0) / NewTimerFreq); //disable(); outportb(0x43, 0x34); outportb(0x40, 0); outportb(0x40, 0); //enable(); #endif #ifdef __WATCOMC__ outp(0x43, 0x34); outp(0x40, 0); outp(0x40, 0); #endif adl_panic(myDevice); //Shut up all sustaining notes #endif adl_close(myDevice); return 0; }
void Font_FT::init(const String &filepath) { TTF_Font *font = TTF_OpenFont(filepath.c_str(), int(get_text_height() * m_vratio + 0.5f)); if(!font) throw Font_Init_Failure(); /*** Set Style ***/ if(is_bold() && is_italic()) TTF_SetFontStyle(font, TTF_STYLE_BOLD | TTF_STYLE_ITALIC); else if(is_bold()) TTF_SetFontStyle(font, TTF_STYLE_BOLD); else if(is_italic()) TTF_SetFontStyle(font, TTF_STYLE_ITALIC); /*** Determine Width & Height ***/ float font_width = 0; float font_height = 0; SDL_Color color2 = {0xFF, 0xFF, 0xFF, 0xFF}; SDL_Surface *source[256] = {0}; for(unsigned char c = 1; c; ++c) { Core::assert_no_error(); //char t[2] = {c, '\0'}; //source[c] = TTF_RenderText_Blended(font, t, color2); source[c] = TTF_RenderGlyph_Blended(font, c, color2); Core::print_error(); font_width = std::max(font_width, float(source[c] ? source[c]->w : 0)); font_height = std::max(font_height, float(source[c] ? source[c]->h : 0)); } /*** Initialize Intermediate SDL Surface ***/ const int next_w = int(pow(2.0f, ceil(log(float(16 * font_width))/log(2.0f)))), next_h = int(pow(2.0f, ceil(log(float(16 * font_height))/log(2.0f)))); SDL_Surface *font_surface = SDL_CreateRGBSurface(SDL_SWSURFACE, next_w, next_h, 32, source[END_OF_TIME]->format->Rmask, source[END_OF_TIME]->format->Gmask, source[END_OF_TIME]->format->Bmask, source[END_OF_TIME]->format->Amask); if(!font_surface) { for(unsigned char c = 1; c; ++c) SDL_FreeSurface(source[c]); TTF_CloseFont(font); if(next_h > 1024) { m_vratio /= 2.0f; init(filepath); return; } else throw Font_Init_Failure(); } SDL_LockSurface(font_surface); SDL_FillRect(font_surface, 0, SDL_MapRGBA(font_surface->format, 0, 0, 0, SDL_ALPHA_TRANSPARENT)); SDL_UnlockSurface(font_surface); /*** Initialize Glyphs ***/ SDL_Rect dstrect = {0, 0, Uint16(font_width), Uint16(font_height)}; m_glyph[0] = 0; for(unsigned char c = 1; c; ++c) { dstrect.x = Sint16((c % 16) * font_width); dstrect.y = Sint16((c / 16) * font_height); m_glyph[c] = new Glyph(font, c, source[c], font_surface, dstrect, next_w, next_h, m_vratio); } /*** Correct Transparency ***/ const Uint32 transparent_white = font_surface->format->Rmask | font_surface->format->Gmask | font_surface->format->Bmask; for(int i = 0; i < font_surface->h; ++i) for(Uint32 * src = reinterpret_cast<Uint32 *>(font_surface->pixels) + i * font_surface->pitch / 4, * src_end = src + font_surface->w; src != src_end; ++src) if(*src & font_surface->format->Rmask) *src = transparent_white | ((*src & font_surface->format->Rmask) >> font_surface->format->Rshift << font_surface->format->Ashift); /*** Initialize Final Texture ***/ m_texture = get_Video().create_Texture(font_surface, false); TTF_CloseFont(font); }
void _generateIndication ( IndicationResponseHandler * handler, const String & identifier) { if (_enabled) { CIMInstance indicationInstance (CIMName ("FailureTestIndication")); CIMObjectPath path; path.setNameSpace ("test/testProvider"); path.setClassName ("FailureTestIndication"); indicationInstance.setPath (path); indicationInstance.addProperty (CIMProperty ("IndicationIdentifier", identifier)); CIMDateTime currentDateTime = CIMDateTime::getCurrentDateTime (); indicationInstance.addProperty (CIMProperty ("IndicationTime", currentDateTime)); Array <String> correlatedIndications; indicationInstance.addProperty (CIMProperty ("CorrelatedIndications", correlatedIndications)); indicationInstance.addProperty (CIMProperty ("Description", String ("Failure Test Indication"))); indicationInstance.addProperty (CIMProperty ("AlertingManagedElement", System::getFullyQualifiedHostName ())); indicationInstance.addProperty (CIMProperty ("AlertingElementFormat", Uint16 (0))); indicationInstance.addProperty (CIMProperty ("AlertType", Uint16 (1))); indicationInstance.addProperty (CIMProperty ("OtherAlertType", String ("Test"))); indicationInstance.addProperty (CIMProperty ("PerceivedSeverity", Uint16 (2))); indicationInstance.addProperty (CIMProperty ("ProbableCause", Uint16 (1))); indicationInstance.addProperty (CIMProperty ("ProbableCauseDescription", String ("Test"))); indicationInstance.addProperty (CIMProperty ("Trending", Uint16 (4))); Array <String> recommendedActions; recommendedActions.append ("Test"); indicationInstance.addProperty (CIMProperty ("RecommendedActions", recommendedActions)); indicationInstance.addProperty (CIMProperty ("EventID", String ("Test"))); CIMDateTime eventTime = CIMDateTime::getCurrentDateTime (); indicationInstance.addProperty (CIMProperty ("EventTime", eventTime)); indicationInstance.addProperty (CIMProperty ("SystemCreationClassName", System::getSystemCreationClassName ())); indicationInstance.addProperty (CIMProperty ("SystemName", System::getFullyQualifiedHostName ())); indicationInstance.addProperty (CIMProperty ("ProviderName", _providerName)); CIMIndication cimIndication (indicationInstance); handler->deliver (cimIndication); } }
int16_t Int16() { return int16_t(Uint16()); }
void CIMError::setPerceivedSeverity( PerceivedSeverityEnum value, bool null) { Set(_inst, "PerceivedSeverity", Uint16(value), null); }
int main(int argc, char** argv) { #ifdef IO verbose = getenv("PEGASUS_TEST_VERBOSE") ? true : false; if (verbose) cout << "Test CIMValue. To turn off display, compile with IO undefined\n"; #endif // Test the primitive CIMValue types with test01 test01(Boolean(true)); test01(Boolean(false)); test01(Char16('Z')); test01(Uint8(77)); test01(Sint8(-77)); test01(Sint16(77)); test01(Uint16(-77)); test01(Sint32(77)); test01(Uint32(-77)); test01(Sint64(77)); test01(Uint64(-77)); test01(Real32(1.5)); test01(Real64(55.5)); test01(Uint64(123456789)); test01(Sint64(-123456789)); test01(String("Hello world")); test01(CIMDateTime("19991224120000.000000+360")); test01(CIMObjectPath( "//host1:77/root/test:Class1.key1=\"key1Value\",key2=\"key2Value\"")); // Create and populate a declaration context: const CIMNamespaceName NAMESPACE = CIMNamespaceName ("/zzz"); SimpleDeclContext* context = new SimpleDeclContext; context->addQualifierDecl( NAMESPACE, CIMQualifierDecl(CIMName ("counter"), false, CIMScope::PROPERTY)); context->addQualifierDecl( NAMESPACE, CIMQualifierDecl(CIMName ("classcounter"), false, CIMScope::CLASS)); context->addQualifierDecl( NAMESPACE, CIMQualifierDecl(CIMName ("min"), String(), CIMScope::PROPERTY)); context->addQualifierDecl( NAMESPACE, CIMQualifierDecl(CIMName ("max"), String(), CIMScope::PROPERTY)); context->addQualifierDecl(NAMESPACE, CIMQualifierDecl(CIMName ("Description"), String(), CIMScope::PROPERTY)); CIMClass class1(CIMName ("MyClass")); class1 .addProperty(CIMProperty(CIMName ("count"), Uint32(55)) .addQualifier(CIMQualifier(CIMName ("counter"), true)) .addQualifier(CIMQualifier(CIMName ("min"), String("0"))) .addQualifier(CIMQualifier(CIMName ("max"), String("1")))) .addProperty(CIMProperty(CIMName ("message"), String("Hello")) .addQualifier(CIMQualifier(CIMName ("description"), String("My Message")))) .addProperty(CIMProperty(CIMName ("ratio"), Real32(1.5))); Resolver::resolveClass (class1, context, NAMESPACE); context->addClass(NAMESPACE, class1); // Test a CIMObject that is a CIMClass test01(CIMObject(class1)); // Test a CIMObject that is a CIMInstance CIMInstance instance1(CIMName ("MyClass")); instance1.addQualifier(CIMQualifier(CIMName ("classcounter"), true)); instance1.addProperty(CIMProperty(CIMName ("message"), String("Goodbye"))); Resolver::resolveInstance (instance1, context, NAMESPACE, true); test01(CIMObject(instance1)); testEmbeddedValue<CIMObject>(instance1); testEmbeddedValue<CIMInstance>(instance1); // Test CIMValue arrays Array<Uint8> arr1; arr1.append(11); arr1.append(22); arr1.append(23); test02(arr1); Array<Uint16> arr2; arr2.append(333); arr2.append(444); arr2.append(445); test02(arr2); Array<Uint32> arr3; arr3.append(5555); arr3.append(6666); arr3.append(6667); test02(arr3); Array<Uint64> arr4; arr4.append(123456789); arr4.append(987654321); arr4.append(987654322); test02(arr4); Array<Sint8> arr5; arr5.append(-11); arr5.append(-22); arr5.append(-23); test02(arr5); Array<Sint16> arr6; arr6.append(333); arr6.append(444); arr6.append(555); test02(arr6); Array<Sint32> arr7; arr7.append(555); arr7.append(666); arr7.append(777); test02(arr7); Array<Sint64> arr8; arr8.append(-123456789); arr8.append(-987654321); arr8.append(-987654321); test02(arr8); Array<Boolean> arr9; arr9.append(true); arr9.append(false); arr9.append(false); test02(arr9); Array<Real32> arr10; arr10.append(1.55F); arr10.append(2.66F); arr10.append(3.77F); test02(arr10); Array<Real64> arr11; arr11.append(55.55); arr11.append(66.66); arr11.append(77.77); test02(arr11); Array<Char16> arr12; arr12.append('X'); arr12.append('Y'); arr12.append('Z'); test02(arr12); Array<String> arr13; arr13.append("One"); arr13.append("Two"); arr13.append("Three"); test02(arr13); Array<CIMDateTime> arr14; arr14.append(CIMDateTime ("20020130120000.000000+360")); arr14.append(CIMDateTime ("20020201120000.000000+360")); arr14.append(CIMDateTime ("20020202120000.000000+360")); test02(arr14); Array<CIMObjectPath> arr15; arr15.append(CIMObjectPath( "//host1:77/root/test:Class1.key1=\"key1Value\",key2=\"key2Value\"")); arr15.append(CIMObjectPath( "//host2:88/root/static:Class2.keyA=\"keyAValue\",keyB=" "\"keyBValue\"")); arr15.append(CIMObjectPath( "//host3:99/root/test/static:Class3.keyX=\"keyXValue\"," "keyY=\"keyYValue\"")); test02(arr15); testEmbeddedValueArray<CIMObject>(instance1, NAMESPACE, context); testEmbeddedValueArray<CIMInstance>(instance1, NAMESPACE, context); // Calling remaining Array tests.. CIMDateTime D1("19991224120000.000000+100"); Array<CIMDateTime> arrD1(10,D1); CIMDateTime *D2 = new CIMDateTime("19991224120000.000000+100"); Array<CIMDateTime> arrD2(D2,1); test03(arrD1, arrD2, D2, CIMDateTime("19991224120000.000000+100"), CIMDateTime("29991224120000.000000+100")); delete D2; CIMName cimname1("yourName"); Array<CIMName> arrcimname1(10,cimname1); CIMName *cimname2 = new CIMName("yourName"); Array<CIMName> arrcimname2(cimname2,1); test03(arrcimname1, arrcimname2, cimname2, CIMName("yourName"), CIMName("myName")); delete cimname2; CIMKeyBinding cimbind1(cimname1, "myKey", CIMKeyBinding::STRING); CIMKeyBinding cimbind2(cimname1, "yourKey", CIMKeyBinding::STRING); Array<CIMKeyBinding> arrcimbind1(10,cimbind1); CIMKeyBinding *cimbind3 = new CIMKeyBinding(cimname1, "myKey", CIMKeyBinding::STRING); Array<CIMKeyBinding> arrcimbind2(cimbind3,1); test03(arrcimbind1, arrcimbind2, cimbind3, cimbind1, cimbind2 ); delete cimbind3; CIMNamespaceName cimnamespace1("root/SampleProvider"); Array<CIMNamespaceName> arrcimnamespace1(10,cimnamespace1); CIMNamespaceName *cimnamespace2 = new CIMNamespaceName( "root/SampleProvider"); Array<CIMNamespaceName> arrcimnamespace2(cimnamespace2,1); test03(arrcimnamespace1, arrcimnamespace2, cimnamespace2, CIMNamespaceName("root/SampleProvider"), CIMNamespaceName("root/SampleProvider2")); delete cimnamespace2; Array<Boolean> arrB1(10,true); Boolean *b = new Boolean(true); Array<Boolean> arrB2(b,1); Array<Boolean> arrB3(2); Boolean b1 = true, b2=false; test03(arrB1, arrB2, b, Boolean(true),Boolean(false)); delete b; Array<Real32> arrreal321(10); Real32 creal321(2.5); Array<Real32> arrreal322(10, creal321); Real32 *creal322 = new Real32(2.5); Array<Real32> arrreal323(creal322,1); Array<Real32> arrreal324(arrreal321); test03(arrreal322, arrreal323, creal322,Real32(2.5),Real32(3.5)); delete creal322; Array<Real64> arrreal641(10); Real64 creal641(20000.54321); Array<Real64> arrreal642(10, creal641); Real64 *creal642 = new Real64(20000.54321); Array<Real64> arrreal643(creal642,1); Array<Real64> arrreal644(arrreal641); test03(arrreal642, arrreal643, creal642,Real64(20000.54321), Real64(30000.54321)); delete creal642; Array<Sint16> arrSint161(10); Sint16 cSint161(-2000); Array<Sint16> arrSint162(10, cSint161); Sint16 *cSint162 = new Sint16(-2000); Array<Sint16> arrSint163(cSint162,1); Array<Sint16> arrSint164(arrSint161); test03(arrSint162, arrSint163, cSint162, Sint16(-2000), Sint16(-3000)); delete cSint162; Array<Sint32> arrSint321(10); Sint32 cSint321(-200000000); Array<Sint32> arrSint322(10, cSint321); Sint32 *cSint322 = new Sint32(-200000000); Array<Sint32> arrSint323(cSint322,1); Array<Sint32> arrSint324(arrSint321); test03(arrSint322, arrSint323, cSint322, Sint32(-200000000), Sint32(-300000000)); delete cSint322; Array<Sint64> arrSint641(10); Sint64 cSint641(Sint64(-2000000)*Sint64(10000000) ); Array<Sint64> arrSint642(10, cSint641); Sint64 *cSint642 = new Sint64(Sint64(-2000000)*Sint64(10000000)); Array<Sint64> arrSint643(cSint642,1); Array<Sint64> arrSint644(arrSint641); test03(arrSint642, arrSint643, cSint642,Sint64(-2000000)*Sint64(10000000), Sint64(-3000000)*Sint64(10000000)); delete cSint642; Array<Sint8> arrSint81(10); Sint8 cSint81(-20); Array<Sint8> arrSint82(10, cSint81); Sint8 *cSint82 = new Sint8(-20); Array<Sint8> arrSint83(cSint82,1); Array<Sint8> arrSint84(arrSint81); test03(arrSint82, arrSint83, cSint82, Sint8(-20), Sint8(-22)); delete cSint82; Array<Uint16> arrUint161(10); Uint16 cUint161(200); Array<Uint16> arrUint162(10, cUint161); Uint16 *cUint162 = new Uint16(200); Array<Uint16> arrUint163(cUint162,1); Array<Uint16> arrUint164(arrUint161); test03(arrUint162, arrUint163, cUint162, Uint16(200), Uint16(255)); delete cUint162; Array<Uint32> arrUint321(10); Uint32 cUint321(2000); Array<Uint32> arrUint322(10, cUint321); Uint32 *cUint322 = new Uint32(2000); Array<Uint32> arrUint323(cUint322,1); Array<Uint32> arrUint324(arrUint321); test03(arrUint322, arrUint323, cUint322, Uint32(2000), Uint32(3000)); delete cUint322; Array<Uint64> arrUint641(10); Uint64 cUint641(Uint64(2000000)*Uint64(10000000)); Array<Uint64> arrUint642(10, cUint641); Uint64 *cUint642 = new Uint64(Uint64(2000000)*Uint64(10000000)); Array<Uint64> arrUint643(cUint642,1); Array<Uint64> arrUint644(arrUint641); test03(arrUint642, arrUint643, cUint642,Uint64(2000000)*Uint64(10000000), Uint64(255000)*Uint64(10000000)); delete cUint642; Array<Uint8> arrUint81(10); Uint8 cUint81(200); Array<Uint8> arrUint82(10, cUint81); Uint8 *cUint82 = new Uint8(200); Array<Uint8> arrUint83(cUint82,1); Array<Uint8> arrUint84(arrUint81); test03(arrUint82, arrUint83, cUint82, Uint8(200), Uint8(255)); delete cUint82; Array<Char16> arrChar161(10); Char16 cChar161('Z'); Array<Char16> arrChar162(10, cChar161); Char16 *cChar162 = new Char16('Z'); Array<Char16> arrChar163(cChar162,1); Array<Char16> arrChar164(arrChar161); test03(arrChar162, arrChar163, cChar162, Char16('Z'), Char16('z')); delete cChar162; delete context; cout << argv[0] << " +++++ passed all tests" << endl; return 0; }
Sdl2Application::InputEvent::Modifiers Sdl2Application::MouseMoveEvent::modifiers() { if(modifiersLoaded) return _modifiers; modifiersLoaded = true; return _modifiers = fixedModifiers(Uint16(SDL_GetModState())); }
Uint16 UNIX_ComputerSystem::getOperatingStatus() const { return Uint16(DEFAULT_OPERATING_STATUS); }