RemoteSource::~RemoteSource() { unload(); }
void ofxShader::setup(string shaderName) { unload(); string fragmentName = shaderName + ".frag"; string vertexName = shaderName + ".vert"; setup(fragmentName, vertexName); }
// --------------------------------------------------------------------------- // Destructeur // ----------- bViewContainer::~bViewContainer(){ unload(); }
Cartridge::Cartridge() { loaded = false; unload(); }
int main(int argc, char* argv[]) { // check for correct number of args if (argc != 2 && argc != 3) { printf("Usage: speller [dictionary] text\n"); return 1; } // structs for timing data struct rusage before, after; // benchmarks double ti_load = 0.0, ti_check = 0.0, ti_size = 0.0, ti_unload = 0.0; // determine dictionary to use char* dictionary = (argc == 3) ? argv[1] : DICTIONARY; // load dictionary getrusage(RUSAGE_SELF, &before); bool loaded = load(dictionary); getrusage(RUSAGE_SELF, &after); // abort if dictionary not loaded if (!loaded) { printf("Could not load %s.\n", dictionary); return 1; } // calculate time to load dictionary ti_load = calculate(&before, &after); // try to open text char* text = (argc == 3) ? argv[2] : argv[1]; FILE* fp = fopen(text, "r"); if (fp == NULL) { printf("Could not open %s.\n", text); unload(); return 1; } // prepare to report misspellings printf("\nMISSPELLED WORDS\n"); // prepare to spell-check int index = 0, misspellings = 0, words = 0; char word[LENGTH+1]; // spell-check each word in text for (int c = fgetc(fp); c != EOF; c = fgetc(fp)) { // allow only alphabetical characters and apostrophes if (isalpha(c) || (c == '\'' && index > 0)) { // append character to word word[index] = c; index++; // ignore alphabetical strings too long to be words if (index > LENGTH) { // consume remainder of alphabetical string while ((c = fgetc(fp)) != EOF && isalpha(c)); // prepare for new word index = 0; } } // ignore words with numbers (like MS Word can) else if (isdigit(c)) { // consume remainder of alphanumeric string while ((c = fgetc(fp)) != EOF && isalnum(c)); // prepare for new word index = 0; } // we must have found a whole word else if (index > 0) { // terminate current word word[index] = '\0'; // update counter words++; // check word's spelling getrusage(RUSAGE_SELF, &before); bool misspelled = !check(word); getrusage(RUSAGE_SELF, &after); // update benchmark ti_check += calculate(&before, &after); // print word if misspelled if (misspelled) { printf("%s\n", word); misspellings++; } // prepare for next word index = 0; } } // check whether there was an error if (ferror(fp)) { fclose(fp); printf("Error reading %s.\n", text); unload(); return 1; } // close text fclose(fp); // determine dictionary's size getrusage(RUSAGE_SELF, &before); unsigned int n = size(); getrusage(RUSAGE_SELF, &after); // calculate time to determine dictionary's size ti_size = calculate(&before, &after); // unload dictionary getrusage(RUSAGE_SELF, &before); bool unloaded = unload(); getrusage(RUSAGE_SELF, &after); // abort if dictionary not unloaded if (!unloaded) { printf("Could not unload %s.\n", dictionary); return 1; } // calculate time to unload dictionary ti_unload = calculate(&before, &after); // report benchmarks printf("\nWORDS MISSPELLED: %d\n", misspellings); printf("WORDS IN DICTIONARY: %d\n", n); printf("WORDS IN TEXT: %d\n", words); printf("TIME IN load: %.2f\n", ti_load); printf("TIME IN check: %.2f\n", ti_check); printf("TIME IN size: %.2f\n", ti_size); printf("TIME IN unload: %.2f\n", ti_unload); printf("TIME IN TOTAL: %.2f\n\n", ti_load + ti_check + ti_size + ti_unload); // that's all folks return 0; }
SSoundBuffer::~SSoundBuffer() { unload(); }
int ConcreteD::setTrialStrain(double strain, double strainRate) { TLoadState = CLoadState; TStress = CStress; TTangent = CTangent; TDc = CDc; TDt = CDt; TDcp = CDcp; TDtp = CDtp; TEpp = CEpp; TRc = CRc; TRt = CRt; TStrain = strain; double dStrain = strain-CStrain; if (fabs(dStrain) < DBL_EPSILON) {return 0;} if(TStrain>TEpp) //Tension { if(TLoadState==0) //On the envelope { if(dStrain>0.0) //Tension { envelope(); return 0; } else { TLoadState=1; //unloading, reloading unload(); return 0; } }else { if(TStrain-TEpp<TRt) {unload(); return 0;} else {TLoadState=0; //On the envelope envelope(); return 0;} } } //ÊÜѹ else { if(TLoadState==0) //On the envelope { if(dStrain<0.0) { envelope(); return 0; } else { TLoadState=1; //unloading, reloading unload(); return 0; } }else { if(TStrain>TRc) {unload(); return 0;} else {TLoadState=0; //On the envelope envelope(); return 0;} } } }
MFKitInfo::~MFKitInfo() { unload(); Resource::unref(style_); }
Area::~Area() { unload(); }
ofFmodSoundPlayer::~ofFmodSoundPlayer(){ unload(); }
//----------------------------------------------------------------------- FileSystemArchive::~FileSystemArchive() { unload(); }
//*********************************************************************************************** CParticleWorkspace::CNode::~CNode() { unload(); }
void UmlComponentView::html(Q3CString pfix, unsigned int rank, unsigned int level) { UmlItem::html(pfix, rank, "Component View", level, "view"); unload(FALSE, FALSE); }
bool device_image_interface::load_internal(const char *path, bool is_create, int create_format, option_resolution *create_args, bool just_load) { UINT32 open_plan[4]; int i; bool softload = FALSE; m_from_swlist = FALSE; // if the path contains no period, we are using softlists, so we won't create an image std::string pathstr(path); bool filename_has_period = (pathstr.find_last_of('.') != -1) ? TRUE : FALSE; /* first unload the image */ unload(); /* clear any possible error messages */ clear_error(); /* we are now loading */ m_is_loading = TRUE; /* record the filename */ m_err = set_image_filename(path); if (m_err) goto done; if (core_opens_image_file()) { /* Check if there's a software list defined for this device and use that if we're not creating an image */ if (!filename_has_period && !just_load) { softload = load_software_part(path, m_software_part_ptr); if (softload) { m_software_info_ptr = &m_software_part_ptr->info(); m_software_list_name.assign(m_software_info_ptr->list().list_name()); m_full_software_name.assign(m_software_part_ptr->info().shortname()); // if we had launched from softlist with a specified part, e.g. "shortname:part" // we would have recorded the wrong name, so record it again based on software_info if (m_software_info_ptr && !m_full_software_name.empty()) m_err = set_image_filename(m_full_software_name.c_str()); // check if image should be read-only const char *read_only = get_feature("read_only"); if (read_only && !strcmp(read_only, "true")) { make_readonly(); } m_from_swlist = TRUE; } } if (is_create || filename_has_period) { /* determine open plan */ determine_open_plan(is_create, open_plan); /* attempt to open the file in various ways */ for (i = 0; !m_file && open_plan[i]; i++) { /* open the file */ m_err = load_image_by_path(open_plan[i], path); if (m_err && (m_err != IMAGE_ERROR_FILENOTFOUND)) goto done; } } /* Copy some image information when we have been loaded through a software list */ if ( m_software_info_ptr ) { // sanitize if (m_software_info_ptr->longname() == nullptr || m_software_info_ptr->publisher() == nullptr || m_software_info_ptr->year() == nullptr) fatalerror("Each entry in an XML list must have all of the following fields: description, publisher, year!\n"); // store m_longname = m_software_info_ptr->longname(); m_manufacturer = m_software_info_ptr->publisher(); m_year = m_software_info_ptr->year(); //m_playable = m_software_info_ptr->supported(); } /* did we fail to find the file? */ if (!is_loaded() && !softload) { m_err = IMAGE_ERROR_FILENOTFOUND; goto done; } } /* call device load or create */ m_create_format = create_format; m_create_args = create_args; if (m_init_phase==FALSE) { m_err = (image_error_t)finish_load(); if (m_err) goto done; } /* success! */ done: if (just_load) { if(m_err) clear(); return m_err ? IMAGE_INIT_FAIL : IMAGE_INIT_PASS; } if (m_err!=0) { if (!m_init_phase) { if (device().machine().phase() == MACHINE_PHASE_RUNNING) device().popmessage("Error: Unable to %s image '%s': %s", is_create ? "create" : "load", path, error()); else osd_printf_error("Error: Unable to %s image '%s': %s\n", is_create ? "create" : "load", path, error()); } clear(); } else { /* do we need to reset the CPU? only schedule it if load/create is successful */ if (device().machine().time() > attotime::zero && is_reset_on_load()) device().machine().schedule_hard_reset(); else { if (!m_init_phase) { if (device().machine().phase() == MACHINE_PHASE_RUNNING) device().popmessage("Image '%s' was successfully %s.", path, is_create ? "created" : "loaded"); else osd_printf_info("Image '%s' was successfully %s.\n", path, is_create ? "created" : "loaded"); } } } return m_err ? IMAGE_INIT_FAIL : IMAGE_INIT_PASS; }
AndroidArchive::~AndroidArchive() { unload(); }
//-------------------------------------------------------------------------------- // Dtor //-------------------------------------------------------------------------------- TeapotRenderer::~TeapotRenderer() { unload(); }
void TestController::refreshModel() { unload(); load(); }
CBitbases::~CBitbases(void) { unload(); }
//----------------------------------------------------------------------- void ArchiveManager::unload(Archive* arch) { unload(arch->getName()); }
void MediaPluginGStreamer010::receiveMessage(const char *message_string) { //std::cerr << "MediaPluginGStreamer010::receiveMessage: received message: \"" << message_string << "\"" << std::endl; LLPluginMessage message_in; if(message_in.parse(message_string) >= 0) { std::string message_class = message_in.getClass(); std::string message_name = message_in.getName(); if(message_class == LLPLUGIN_MESSAGE_CLASS_BASE) { if(message_name == "init") { LLPluginMessage message("base", "init_response"); LLSD versions = LLSD::emptyMap(); versions[LLPLUGIN_MESSAGE_CLASS_BASE] = LLPLUGIN_MESSAGE_CLASS_BASE_VERSION; versions[LLPLUGIN_MESSAGE_CLASS_MEDIA] = LLPLUGIN_MESSAGE_CLASS_MEDIA_VERSION; versions[LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME] = LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME_VERSION; message.setValueLLSD("versions", versions); if ( load() ) { DEBUGMSG("GStreamer010 media instance set up"); } else { WARNMSG("GStreamer010 media instance failed to set up"); } message.setValue("plugin_version", getVersion()); sendMessage(message); } else if(message_name == "idle") { // no response is necessary here. double time = message_in.getValueReal("time"); // Convert time to milliseconds for update() update((int)(time * 1000.0f)); } else if(message_name == "cleanup") { unload(); closedown(); } else if(message_name == "shm_added") { SharedSegmentInfo info; info.mAddress = message_in.getValuePointer("address"); info.mSize = (size_t)message_in.getValueS32("size"); std::string name = message_in.getValue("name"); std::ostringstream str; INFOMSG("MediaPluginGStreamer010::receiveMessage: shared memory added, name: %s, size: %d, address: %p", name.c_str(), int(info.mSize), info.mAddress); mSharedSegments.insert(SharedSegmentMap::value_type(name, info)); } else if(message_name == "shm_remove") { std::string name = message_in.getValue("name"); DEBUGMSG("MediaPluginGStreamer010::receiveMessage: shared memory remove, name = %s", name.c_str()); SharedSegmentMap::iterator iter = mSharedSegments.find(name); if(iter != mSharedSegments.end()) { if(mPixels == iter->second.mAddress) { // This is the currently active pixel buffer. Make sure we stop drawing to it. mPixels = NULL; mTextureSegmentName.clear(); // Make sure the movie decoder is no longer pointed at the shared segment. sizeChanged(); } mSharedSegments.erase(iter); } else { WARNMSG("MediaPluginGStreamer010::receiveMessage: unknown shared memory region!"); } // Send the response so it can be cleaned up. LLPluginMessage message("base", "shm_remove_response"); message.setValue("name", name); sendMessage(message); } else { std::ostringstream str; INFOMSG("MediaPluginGStreamer010::receiveMessage: unknown base message: %s", message_name.c_str()); } } else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA) { if(message_name == "init") { // Plugin gets to decide the texture parameters to use. LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "texture_params"); // lame to have to decide this now, it depends on the movie. Oh well. mDepth = 4; mCurrentWidth = 1; mCurrentHeight = 1; mPreviousWidth = 1; mPreviousHeight = 1; mNaturalWidth = 1; mNaturalHeight = 1; mWidth = 1; mHeight = 1; mTextureWidth = 1; mTextureHeight = 1; message.setValueU32("format", GL_RGBA); message.setValueU32("type", GL_UNSIGNED_INT_8_8_8_8_REV); message.setValueS32("depth", mDepth); message.setValueS32("default_width", mWidth); message.setValueS32("default_height", mHeight); message.setValueU32("internalformat", GL_RGBA8); message.setValueBoolean("coords_opengl", true); // true == use OpenGL-style coordinates, false == (0,0) is upper left. message.setValueBoolean("allow_downsample", true); // we respond with grace and performance if asked to downscale sendMessage(message); } else if(message_name == "size_change") { std::string name = message_in.getValue("name"); S32 width = message_in.getValueS32("width"); S32 height = message_in.getValueS32("height"); S32 texture_width = message_in.getValueS32("texture_width"); S32 texture_height = message_in.getValueS32("texture_height"); std::ostringstream str; INFOMSG("---->Got size change instruction from application with shm name: %s - size is %d x %d", name.c_str(), width, height); LLPluginMessage message(LLPLUGIN_MESSAGE_CLASS_MEDIA, "size_change_response"); message.setValue("name", name); message.setValueS32("width", width); message.setValueS32("height", height); message.setValueS32("texture_width", texture_width); message.setValueS32("texture_height", texture_height); sendMessage(message); if(!name.empty()) { // Find the shared memory region with this name SharedSegmentMap::iterator iter = mSharedSegments.find(name); if(iter != mSharedSegments.end()) { INFOMSG("*** Got size change with matching shm, new size is %d x %d", width, height); INFOMSG("*** Got size change with matching shm, texture size size is %d x %d", texture_width, texture_height); mPixels = (unsigned char*)iter->second.mAddress; mTextureSegmentName = name; mWidth = width; mHeight = height; if (texture_width > 1 || texture_height > 1) // not a dummy size from the app, a real explicit forced size { INFOMSG("**** = REAL RESIZE REQUEST FROM APP"); GST_OBJECT_LOCK(mVideoSink); mVideoSink->resize_forced_always = true; mVideoSink->resize_try_width = texture_width; mVideoSink->resize_try_height = texture_height; GST_OBJECT_UNLOCK(mVideoSink); } mTextureWidth = texture_width; mTextureHeight = texture_height; } } } else if(message_name == "load_uri") { std::string uri = message_in.getValue("uri"); navigateTo( uri ); sendStatus(); } else if(message_name == "mouse_event") { std::string event = message_in.getValue("event"); S32 x = message_in.getValueS32("x"); S32 y = message_in.getValueS32("y"); if(event == "down") { mouseDown(x, y); } else if(event == "up") { mouseUp(x, y); } else if(event == "move") { mouseMove(x, y); }; }; } else if(message_class == LLPLUGIN_MESSAGE_CLASS_MEDIA_TIME) { if(message_name == "stop") { stop(); } else if(message_name == "start") { double rate = 0.0; if(message_in.hasValue("rate")) { rate = message_in.getValueReal("rate"); } // NOTE: we don't actually support rate. play(rate); } else if(message_name == "pause") { pause(); } else if(message_name == "seek") { double time = message_in.getValueReal("time"); // defer the actual seek in case we haven't // really truly started yet in which case there // is nothing to seek upon mSeekWanted = true; mSeekDestination = time; } else if(message_name == "set_loop") { bool loop = message_in.getValueBoolean("loop"); mIsLooping = loop; } else if(message_name == "set_volume") { double volume = message_in.getValueReal("volume"); setVolume(volume); } } else { INFOMSG("MediaPluginGStreamer010::receiveMessage: unknown message class: %s", message_class.c_str()); } } }
//----------------------------------------------------------------------- ZipArchive::~ZipArchive() { unload(); }
bool UmlAttribute::write_if_needed(FileOut & out) { switch (_lang) { case Uml: parent()->write(out); out.indent(); out << "<UML:Attribute name=\"" << name() << '"'; break; case Cpp: if (cppDecl().isEmpty()) return FALSE; parent()->write(out); out.indent(); out << "<UML:Attribute name=\"" << true_name(cppDecl()) << '"'; break; default: // Java if (javaDecl().isEmpty()) return FALSE; parent()->write(out); out.indent(); out << "<UML:Attribute name=\"" << true_name(javaDecl()) << '"'; break; } out.id(this); switch (_lang) { case Uml: write_visibility(out); break; case Cpp: write_visibility(out, (cppVisibility() == DefaultVisibility) ? visibility() : cppVisibility()); break; default: // Java if (javaDecl().find("${visibility}") != -1) write_visibility(out, visibility()); break; } write_scope(out); out << ">\n"; out.indent(+1); const UmlTypeSpec & t = type(); if ((t.type != 0) || !t.explicit_type.isEmpty()) { out.indent(); out << "<UML:StructuralFeature.type>\n"; out.indent(); out << "\t<UML:DataType"; switch (_lang) { case Uml: if (t.type != 0) out.idref(t.type); else out.idref_datatype(t.explicit_type); break; case Cpp: write_cpp_type(out); break; default: // java write_java_type(out); } out << "/>\n"; out.indent(); out << "</UML:StructuralFeature.type>\n"; } write_stereotype(out); write_annotation(out); write_description_properties(out); out.indent(-1); out.indent(); out << "</UML:Attribute>\n"; unload(); return TRUE; }
Cartridge::~Cartridge() { unload(); }
kdTree::~kdTree() { unload(); }
virtual ~Resource( void ) { unload(); }
bool kdTree::load(const u::string &file) { unload(); auto fp = u::fopen(file, "rt"); if (!fp.get()) return false; // This is a minimal OBJ loader which makes assumptions about the format. // Specifically it assumes the format looks like that of a Cube2 exported // map. It expects "g slot%d" for texture slots. It expects the vertex data // is already in triangulated format as well. const u::string *textureReference = nullptr; for (u::string line; u::getline(fp, line); ) { float x0, y0, z0, x1, y1, z1, w; int v0, v1, v2, t0, t1, t2, i; int s0, s1, s2; int slot; if (u::sscanf(line, "v %f %f %f", &x0, &y0, &z0) == 3) { m_vertices.push_back({ x0, y0, z0 }); } else if (u::sscanf(line, "vt %f %f", &x0, &y0) == 2 || u::sscanf(line, "vt %f %f %f", &x0, &y0, &z0) == 3) { m_texCoords.push_back({ x0, y0 }); } else if (u::sscanf(line, "ent %i %f %f %f %f %f %f %f", &i, &x0, &y0, &z0, &x1, &y1, &z1, &w) == 8) { kdEnt ent; ent.id = i; ent.origin = { x0, y0, z0 }; ent.rotation = { x1, y1, z1, w }; m_entities.push_back(ent); } else if (u::sscanf(line, "f %i/%i %i/%i %i/%i", &v0, &t0, &v1, &t1, &v2, &t2) == 6 || u::sscanf(line, "f %i/%i/%i %i/%i/%i %i/%i/%i", &v0, &t0, &s0, &v1, &t1, &s1, &v2, &t2, &s2) == 9) { kdTriangle triangle; triangle.m_textureReference = textureReference; triangle.m_vertices[0] = v0 - 1; triangle.m_vertices[1] = v1 - 1; triangle.m_vertices[2] = v2 - 1; triangle.m_texCoords[0] = t0 - 1; triangle.m_texCoords[1] = t1 - 1; triangle.m_texCoords[2] = t2 - 1; triangle.generatePlane(this); m_triangles.push_back(triangle); } else if (u::sscanf(line, "f %i %i %i", &v0, &v1, &v2) == 3) { kdTriangle triangle; triangle.m_textureReference = textureReference; triangle.m_vertices[0] = v0 - 1; triangle.m_vertices[1] = v1 - 1; triangle.m_vertices[2] = v2 - 1; triangle.generatePlane(this); m_triangles.push_back(triangle); } else if (u::sscanf(line, "g slot%d", &slot) == 1) { m_textureCount++; auto format = u::format("textures/%d", slot); auto find = m_textures.find(format); if (find == m_textures.end()) find = m_textures.insert(format).first; textureReference = &*find; } } m_nodeCount = 0; m_leafCount = 0; u::vector<int> indices; indices.reserve(m_triangles.size()); for (size_t i = 0; i < m_triangles.size(); i++) indices.push_back(i); m_root = new kdNode(this, indices, 0); return true; }
ofxShader::~ofxShader() { unload(); }
xPrimitiveElement::~xPrimitiveElement() { unload(); }
Cursor::~Cursor() { unload(); }
Kss_Emu::~Kss_Emu() { unload(); }