CSSCursorImageValue::~CSSCursorImageValue() { #if ENABLE(SVG) const String& url = getStringValue(); if (!isSVGCursorIdentifier(url)) return; HashSet<SVGElement*>::const_iterator it = m_referencedElements.begin(); HashSet<SVGElement*>::const_iterator end = m_referencedElements.end(); for (; it != end; ++it) { SVGElement* referencedElement = *it; referencedElement->cursorImageValueRemoved(); if (SVGCursorElement* cursorElement = resourceReferencedByCursorElement(url, referencedElement->document())) cursorElement->removeClient(referencedElement); } #endif }
/** Returns the value that is adressed by the section/key pair as a int. If the key could not be found in this section defaultValue is returned. If no defaultValue is specified then 0 is returned. If the value could not be converted to an int 0 is returned. \param section sectionname \param key keyname \param defaultValue default value for defaultValue is 0 \return The read number, defaultValue or 0 */ int IniFile::getIntValue(std::string section, std::string key, int defaultValue ) { std::string value = getStringValue(section,key,""); if(value.size() == 0) { return defaultValue; } long ret; if(value.at(0) == '-') { ret = -(atol(value.c_str()+1)); } else if (value.at(0) == '+') { ret = atol(value.c_str()+1); } else { ret = atol(value.c_str()); } return ret; }
/** Returns the value that is adressed by the section/key pair as a boolean. If the key could not be found in this section defaultValue is returned. If no defaultValue is specified then false is returned. If the value is one of "true", "enabled", "on" or "1" then true is returned; if it is one of "false", "disabled", "off" or "0" than false is returned; otherwise defaultValue is returned. \param section sectionname \param key keyname \param defaultValue default value for defaultValue is 0 \return true for "true", "enabled", "on" and "1"<br>false for "false", "disabled", "off" and "0" */ bool IniFile::getBoolValue(std::string section, std::string key, bool defaultValue) { std::string value = getStringValue(section,key,""); if(value.size() == 0) { return defaultValue; } // convert std::string to lower case transform(value.begin(),value.end(), value.begin(), ::tolower); if((value == "true") || (value == "enabled") || (value == "on") || (value == "1")) { return true; } else if((value == "false") || (value == "disabled") || (value == "off") || (value == "0")) { return false; } else { return defaultValue; } }
int tellstdfunc::GDSread::execute() { std::string filename = getStringValue(); telldata::ttlist* topcells; if (expandFileName(filename)) { std::list<std::string> top_cell_list; if (DATC->GDSparse(filename)) { // add GDS tab in the browser browsers::addGDStab(); // GDSin::GdsFile* AGDSDB = DATC->lockGDS(); GDSin::GDSHierTree* root = AGDSDB->hierTree()->GetFirstRoot(TARGETDB_LIB); assert(root); do { top_cell_list.push_back(std::string(root->GetItem()->name())); } while (NULL != (root = root->GetNextRoot(TARGETDB_LIB))); DATC->unlockGDS(); topcells = DEBUG_NEW telldata::ttlist(telldata::tn_string); for (std::list<std::string>::const_iterator CN = top_cell_list.begin(); CN != top_cell_list.end(); CN ++) topcells->add(DEBUG_NEW telldata::ttstring(*CN)); LogFile << LogFile.getFN() << "(\""<< filename << "\");"; LogFile.flush(); } else { std::string info = "File \"" + filename + "\" doesn't seem to appear a valid GDSII file"; tell_log(console::MT_ERROR,info); } } else { std::string info = "Filename \"" + filename + "\" can't be expanded properly"; tell_log(console::MT_ERROR,info); } // Make sure you always return what you have to return - a list in this case even if // it's empty. Otherwise the following tell function will crash, because it can't // retrieve from the operand stack the required number of parameters. Empty list // is still a list and everybody should deal with them OPstack.push(topcells); return EXEC_NEXT; }
// Create random values for keys static void initKeyValues(const KeyDesc* key) { // Don't create values for missing keys if (key->mMissing) return; short arrayCount = 1; // Default to 1 value switch (key->mType) { case kIntArray: // Get number of values in array arrayCount = getArrayCount(); // Fall into... case kInt: { // Allocate memory for array key->mpValue = new int[arrayCount]; key->mValueCount = arrayCount; // Add values to array while (arrayCount > 0) { --arrayCount; static_cast<int*>(key->mpValue)[arrayCount] = getIntValue(); } } break; case kFloatArray: // Get number of values in array arrayCount = getArrayCount(); // Fall into... case kFloat: { // Allocate memory for array key->mpValue = new float[arrayCount]; key->mValueCount = arrayCount; // Add values to array while (arrayCount > 0) { --arrayCount; static_cast<float*>(key->mpValue)[arrayCount] = getFloatValue(); } } break; case kString: { // Get the string key->mValueCount = 1; key->mpValue = getStringValue(); } } }
int tellstdfunc::stdCELLAREF_D::execute() { real stepY = getOpValue(); real stepX = getOpValue(); word row = getWordValue(); word col = getWordValue(); std::string name = getStringValue(); // check that target cell exists - otherwise tmp_draw can't obviously work. // there is another more extensive check when the cell is added, there the circular // references are checked as well laydata::tdtdesign* ATDB = DATC->lockDB(false); laydata::tdtcell *excell = static_cast<laydata::tdtcell*>(ATDB->checkcell(name)); DATC->unlockDB(); if (NULL == excell) { std::string news = "Can't find cell \""; news += name; news += "\" "; tell_log(console::MT_ERROR,news); return EXEC_ABORT; } real DBscale = DATC->DBscale(); int4b istepX = (int4b)rint(stepX * DBscale); int4b istepY = (int4b)rint(stepY * DBscale); // stop the thread and wait for input from the GUI if (!tellstdfunc::waitGUInput(console::op_abind, &OPstack, name, CTM(), istepX, istepY,col,row)) return EXEC_ABORT; // get the data from the stack telldata::ttbnd *bnd = static_cast<telldata::ttbnd*>(OPstack.top());OPstack.pop(); OPstack.push(DEBUG_NEW telldata::ttstring(name)); OPstack.push(DEBUG_NEW telldata::ttpnt(bnd->p())); OPstack.push(DEBUG_NEW telldata::ttreal(bnd->rot())); OPstack.push(DEBUG_NEW telldata::ttbool(bnd->flx())); OPstack.push(DEBUG_NEW telldata::ttreal(bnd->sc())); OPstack.push(DEBUG_NEW telldata::ttint(col)); OPstack.push(DEBUG_NEW telldata::ttint(row)); OPstack.push(DEBUG_NEW telldata::ttreal(stepX)); OPstack.push(DEBUG_NEW telldata::ttreal(stepY)); delete bnd; return stdCELLAREF::execute(); }
int tellstdfunc::TDTread::execute() { std::string filename = getStringValue(); if (expandFileName(filename)) { nameList top_cell_list; if (DATC->TDTread(filename)) { std::string info = "Generating cell hierarchy ..."; tell_log(console::MT_INFO,info); laydata::tdtdesign* ATDB = DATC->lockDB(false); laydata::TDTHierTree* root = ATDB->hiertree()->GetFirstRoot(); do { top_cell_list.push_back(std::string(root->GetItem()->name())); } while (NULL != (root = root->GetNextRoot())); ATDB->btreeAddMember = &browsers::treeAddMember; ATDB->btreeRemoveMember = &browsers::treeRemoveMember; browsers::addTDTtab(ATDB->name(), ATDB->hiertree()); info = "... done"; tell_log(console::MT_INFO,info); TpdTime timec(ATDB->created()); TpdTime timeu(ATDB->lastUpdated()); updateLayerDefinitions(ATDB, top_cell_list); DATC->unlockDB(); info = "... DB unlocked"; tell_log(console::MT_INFO,info); LogFile << LogFile.getFN() << "(\""<< filename << "\",\"" << timec() << "\",\"" << timeu() << "\");"; LogFile.flush(); // reset UNDO buffers; UNDOcmdQ.clear(); while (!UNDOPstack.empty()) { delete UNDOPstack.front(); UNDOPstack.pop_front(); } } } else { std::string info = "Filename \"" + filename + "\" can't be expanded properly"; tell_log(console::MT_ERROR,info); } return EXEC_NEXT; }
int tellstdfunc::stdADDTEXT_D::execute() { real magn = getOpValue(); std::string name = getStringValue(); CTM ftrans; ftrans.Scale(magn,magn); // stop the thread and wait for input from the GUI if (!tellstdfunc::waitGUInput(console::op_tbind, &OPstack, name, ftrans)) return EXEC_ABORT; // get the data from the stack telldata::ttbnd *bnd = static_cast<telldata::ttbnd*>(OPstack.top());OPstack.pop(); OPstack.push(DEBUG_NEW telldata::ttstring(name)); OPstack.push(CurrentLayer()); OPstack.push(DEBUG_NEW telldata::ttpnt(bnd->p())); OPstack.push(DEBUG_NEW telldata::ttreal(bnd->rot())); OPstack.push(DEBUG_NEW telldata::ttbool(bnd->flx())); OPstack.push(DEBUG_NEW telldata::ttreal(bnd->sc())); delete bnd; return stdADDTEXT::execute(); }
int tellstdfunc::TDTread::execute() { std::string filename = getStringValue(); if (expandFileName(filename)) { if (DATC->TDTread(filename)) { laydata::tdtdesign* ATDB = DATC->lockDB(false); // Initialize call back functions ATDB->btreeAddMember = &browsers::treeAddMember; ATDB->btreeRemoveMember = &browsers::treeRemoveMember; // time stamps TpdTime timec(ATDB->created()); TpdTime timeu(ATDB->lastUpdated()); // Gatering the used layers & update the layer definitions std::list<std::string> top_cell_list; laydata::TDTHierTree* root = ATDB->hiertree()->GetFirstRoot(TARGETDB_LIB); do { top_cell_list.push_back(std::string(root->GetItem()->name())); } while (NULL != (root = root->GetNextRoot(TARGETDB_LIB))); updateLayerDefinitions( DATC->TEDLIB(), top_cell_list, TARGETDB_LIB); DATC->unlockDB(); // populate the hierarchy browser browsers::addTDTtab(true); // LogFile << LogFile.getFN() << "(\""<< filename << "\",\"" << timec() << "\",\"" << timeu() << "\");"; LogFile.flush(); // reset UNDO buffers; UNDOcmdQ.clear(); while (!UNDOPstack.empty()) { delete UNDOPstack.front(); UNDOPstack.pop_front(); } } } else { std::string info = "Filename \"" + filename + "\" can't be expanded properly"; tell_log(console::MT_ERROR,info); } return EXEC_NEXT; }
int tellstdfunc::TDTsaveas::execute() { std::string filename = getStringValue(); if (expandFileName(filename)) { laydata::tdtdesign* ATDB = DATC->lockDB(false); ATDB->try_unselect_all(); DATC->TDTwrite(filename.c_str()); TpdTime timec(ATDB->created()); TpdTime timeu(ATDB->lastUpdated()); DATC->unlockDB(); LogFile << LogFile.getFN() << "(\""<< filename << "\" , \"" << timec() << "\" , \"" << timeu() << "\");"; LogFile.flush(); } else { std::string info = "Filename \"" + filename + "\" can't be expanded properly"; tell_log(console::MT_ERROR,info); } return EXEC_NEXT; }
int tellstdfunc::stdNEWCELL::execute() { std::string nm = getStringValue(); laydata::tdtdesign* ATDB = DATC->lockDB(false); laydata::tdtcell* new_cell = ATDB->addcell(nm); DATC->unlockDB(); if (NULL != new_cell) { UNDOcmdQ.push_front(this); UNDOPstack.push_front(DEBUG_NEW telldata::ttstring(nm)); LogFile << LogFile.getFN() << "(\""<< nm << "\");"; LogFile.flush(); } else { std::string news = "Cell \""; news += nm; news += "\" already exists"; tell_log(console::MT_ERROR,news); } return EXEC_NEXT; }
static TCHAR* getInstalledWebKitDirectory() { LPCTSTR installPathKeyString = TEXT("SOFTWARE\\Apple Computer, Inc.\\Safari"); LPCTSTR installPathWin64KeyString = TEXT("SOFTWARE\\Wow6432Node\\Apple Computer, Inc.\\Safari"); HKEY installPathKey = 0; LONG error = RegOpenKeyEx(HKEY_LOCAL_MACHINE, installPathKeyString, 0, KEY_READ, &installPathKey); if (error != ERROR_SUCCESS) error = RegOpenKeyEx(HKEY_LOCAL_MACHINE, installPathWin64KeyString, 0, KEY_READ, &installPathKey); if (error != ERROR_SUCCESS) { LOG_WARNING(TEXT("Failed to open registry key %s\n"), installPathKeyString); return 0; } LPTSTR webKitPath = getStringValue(installPathKey, TEXT("InstallDir")); RegCloseKey(installPathKey); if (!webKitPath) { LOG_WARNING(TEXT("Couldn't retrieve value for registry key %s\n"), installPathKeyString); return 0; } return webKitPath; }
int tellstdfunc::GDSreportlay::execute() { std::string name = getStringValue(); GDSin::GDSFile* AGDSDB = DATC->lockGDS(); GDSin::GDSstructure *src_structure = AGDSDB->GetStructure(name.c_str()); std::ostringstream ost; if (!src_structure) { ost << "GDS structure named \"" << name << "\" does not exists"; tell_log(console::MT_ERROR,ost.str()); } else { ost << "GDS layers found in \"" << name <<"\": "; for(int i = 0 ; i < GDS_MAX_LAYER ; i++) if (src_structure->Get_Allay(i)) ost << i << " "; tell_log(console::MT_INFO,ost.str()); LogFile << LogFile.getFN() << "(\""<< name << "\");"; LogFile.flush(); } DATC->unlockGDS(); // DATC->reportGDSlay(name.c_str()); return EXEC_NEXT; }
int tellstdfunc::stdCELLREF::execute() { UNDOcmdQ.push_front(this); // get the parameters from the operand stack real magn = getOpValue(); bool flip = getBoolValue(); real angle = getOpValue(); telldata::ttpnt *rpnt = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop(); std::string name = getStringValue(); real DBscale = DATC->DBscale(); CTM ori(TP(rpnt->x(), rpnt->y(), DBscale), magn,angle,flip); laydata::tdtdesign* ATDB = DATC->lockDB(); telldata::ttlayout* cl = DEBUG_NEW telldata::ttlayout(ATDB->addcellref(name,ori), 0); DATC->unlockDB(); OPstack.push(cl); UNDOPstack.push_front(cl->selfcopy()); LogFile << LogFile.getFN() << "(\""<< name << "\"," << *rpnt << "," << angle << "," << LogFile._2bool(flip) << "," << magn <<");"; LogFile.flush(); delete rpnt; RefreshGL(); return EXEC_NEXT; }
int tellstdfunc::stdREPORTLAY::execute() { bool recursive = getBoolValue(); std::string cellname = getStringValue(); laydata::ListOfWords ull; laydata::tdtdesign* ATDB = DATC->lockDB(); bool success = ATDB->collect_usedlays(cellname, recursive, ull); DATC->unlockDB(); telldata::ttlist* tllull = DEBUG_NEW telldata::ttlist(telldata::tn_int); if (success) { for(laydata::ListOfWords::const_iterator CL = ull.begin() ; CL != ull.end();CL++ ) tllull->add(DEBUG_NEW telldata::ttint(*CL)); ull.clear(); } else { std::string news = "cell \""; news += cellname; news += "\" doesn't exists"; tell_log(console::MT_ERROR,news); } OPstack.push(tllull); return EXEC_NEXT; }
//! //! //! \return True, if successful loading of ogre mesh //! False, otherwise. //! bool Model2SceneNode::loadMesh () { // destroy an existing OGRE entity for the mesh destroyEntity(); QString filename = getStringValue("Geometry File"); if (filename == "") { Log::debug(QString("Geometry file has not been set yet. (\"%1\")").arg(m_name), "Model2SceneNode::loadMesh"); return false; } // check if the file exists if (!QFile::exists(filename)) { Log::error(QString("Mesh file \"%1\" not found.").arg(filename), "Model2SceneNode::loadMesh"); return false; } // split the absolute filename to path and base filename int lastSlashIndex = filename.lastIndexOf('/'); QString path = ""; if (lastSlashIndex > -1) { path = filename.mid(0, lastSlashIndex); filename = filename.mid(lastSlashIndex + 1); } if (!filename.endsWith(".mesh")) { Log::error("The geometry file has to be an OGRE mesh file.", "Model2SceneNode::loadMesh"); return false; } // destroy old resource group and generate new one QString resourceGroupName = QString::fromStdString(createUniqueName("ResourceGroup_" + filename + "_Model2SceneNode")); OgreTools::destroyResourceGroup(m_oldResourceGroupName); m_oldResourceGroupName = resourceGroupName; OgreTools::createResourceGroup(resourceGroupName, path); // recreating the entity createEntity(m_name, filename); Log::info(QString("Mesh file \"%1\" loaded.").arg(filename), "Model2SceneNode::loadMesh"); return true; }
int tellstdfunc::GDSread::execute() { std::string filename = getStringValue(); if (expandFileName(filename)) { std::list<std::string> top_cell_list; if (DATC->GDSparse(filename)) { // add GDS tab in the browser browsers::addGDStab(); // GDSin::GDSFile* AGDSDB = DATC->lockGDS(); GDSin::GDSHierTree* root = AGDSDB->hiertree()->GetFirstRoot(TARGETDB_LIB); assert(root); do { top_cell_list.push_back(std::string(root->GetItem()->Get_StrName())); } while (NULL != (root = root->GetNextRoot(TARGETDB_LIB))); DATC->unlockGDS(); telldata::ttlist* topcells = DEBUG_NEW telldata::ttlist(telldata::tn_string); for (std::list<std::string>::const_iterator CN = top_cell_list.begin(); CN != top_cell_list.end(); CN ++) topcells->add(DEBUG_NEW telldata::ttstring(*CN)); OPstack.push(topcells); LogFile << LogFile.getFN() << "(\""<< filename << "\");"; LogFile.flush(); } else { std::string info = "File \"" + filename + "\" doesn't seem to appear a valid GDSII file"; tell_log(console::MT_ERROR,info); } } else { std::string info = "Filename \"" + filename + "\" can't be expanded properly"; tell_log(console::MT_ERROR,info); } return EXEC_NEXT; }
bool MLProperty::operator== (const MLProperty& b) const { bool r = false; if(mType == b.getType()) { switch(mType) { case kUndefinedProperty: r = true; break; case kFloatProperty: r = (getFloatValue() == b.getFloatValue()); break; case kStringProperty: r = (getStringValue() == b.getStringValue()); break; case kSignalProperty: r = (getSignalValue() == b.getSignalValue()); break; } } return r; }
int tellstdfunc::CIFreportlay::execute() { std::string name = getStringValue(); CIFin::CifFile* ACIFDB = DATC->lockCIF(); CIFin::CifStructure *src_structure = ACIFDB->getStructure(name.c_str()); std::ostringstream ost; if (!src_structure) { ost << "CIF structure named \"" << name << "\" does not exists"; tell_log(console::MT_ERROR,ost.str()); } else { nameList cifLayers; src_structure->collectLayers(cifLayers,true); ost << "CIF layers found in \"" << name <<"\"" << std::endl; for (nameList::iterator NLI = cifLayers.begin(); NLI != cifLayers.end(); NLI++) ost << *NLI << std::endl; tell_log(console::MT_INFO,ost.str()); LogFile << LogFile.getFN() << "(\""<< name << "\");"; LogFile.flush(); } DATC->unlockCIF(); return EXEC_NEXT; }
int tellstdfunc::stdCELLREF::execute() { // get the parameters from the operand stack real magn = getOpValue(); bool flip = getBoolValue(); real angle = getOpValue(); telldata::ttpnt *rpnt = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop(); std::string name = getStringValue(); real DBscale = DATC->DBscale(); CTM ori(TP(rpnt->x(), rpnt->y(), DBscale), magn,angle,flip); // check that target cell exists - otherwise tmp_draw can't obviously work. // there is another more extensive check when the cell is added, there the circular // references are checked as well laydata::CellDefin strdefn; if (DATC->getCellNamePair(name, strdefn)) { UNDOcmdQ.push_front(this); laydata::tdtdesign* ATDB = DATC->lockDB(); telldata::ttlayout* cl = DEBUG_NEW telldata::ttlayout(ATDB->addcellref(strdefn,ori), REF_LAY); DATC->unlockDB(); OPstack.push(cl); UNDOPstack.push_front(cl->selfcopy()); LogFile << LogFile.getFN() << "(\""<< name << "\"," << *rpnt << "," << angle << "," << LogFile._2bool(flip) << "," << magn <<");"; LogFile.flush(); delete rpnt; RefreshGL(); return EXEC_NEXT; } else { std::string news = "Cell \""; news += name; news += "\" is not defined"; tell_log(console::MT_ERROR,news); delete rpnt; return EXEC_ABORT; } }
int tellstdfunc::stdADDTEXT::execute() { // get the parameters from the operand stack UNDOcmdQ.push_front(this); real magn = getOpValue(); bool flip = getBoolValue(); real angle = getOpValue(); telldata::ttpnt *rpnt = static_cast<telldata::ttpnt*>(OPstack.top());OPstack.pop(); word la = getWordValue(); UNDOPstack.push_front(DEBUG_NEW telldata::ttint(la)); std::string text = getStringValue(); real DBscale = DATC->DBscale(); CTM ori(TP(rpnt->x(), rpnt->y(), DBscale), magn*DBscale/OPENGL_FONT_UNIT,angle,flip); laydata::tdtdesign* ATDB = DATC->lockDB(); telldata::ttlayout* tx = DEBUG_NEW telldata::ttlayout(ATDB->addtext(la, text, ori), la); DATC->unlockDB(); OPstack.push(tx);UNDOPstack.push_front(tx->selfcopy()); LogFile << LogFile.getFN() << "(\"" << text << "\"," << la << "," << *rpnt << "," << angle << "," << LogFile._2bool(flip) << "," << magn << ");"; LogFile.flush(); delete rpnt; RefreshGL(); return EXEC_NEXT; }
int tellstdfunc::stdCHANGEREF::execute() { std::string newref = getStringValue(); laydata::shapeList* cells4u = NULL; laydata::tdtdesign* ATDB = DATC->lockDB(); bool refok = ATDB->checkValidRef(newref); if (refok) cells4u = ATDB->ungroup_prep(DATC->TEDLIB()); DATC->unlockDB(); if (refok) { if (cells4u->empty()) { tell_log(console::MT_ERROR,"No cell references selected"); delete cells4u; } else { ATDB = DATC->lockDB(); laydata::atticList* undol2 = ATDB->changeref(cells4u, newref); DATC->unlockDB(); assert(NULL != undol2); UNDOcmdQ.push_front(this); // Push the list of the cells to be ungroupped first laydata::atticList undol; undol[0] = cells4u; UNDOPstack.push_front(make_ttlaylist(&undol)); UNDOPstack.push_front(make_ttlaylist(undol2)); delete cells4u; delete undol2; LogFile << LogFile.getFN() << "(\"" << newref << "\");"; LogFile.flush(); RefreshGL(); } } return EXEC_NEXT; }
void searchCurrentJavaRegistry(LauncherProperties * props, BOOL access64key) { DWORD i=0; WCHAR ** keys = JAVA_REGISTRY_KEYS; DWORD k=0; WCHAR * buffer = newpWCHAR(MAX_LEN_VALUE_NAME); HKEY rootKeys [2] = {HKEY_LOCAL_MACHINE, HKEY_CURRENT_USER}; DWORD rootKeysNumber = sizeof(rootKeys)/sizeof(HKEY); DWORD keysNumber = sizeof(JAVA_REGISTRY_KEYS)/sizeof(WCHAR*); DWORD status = ERROR_OK; writeMessageA(props, OUTPUT_LEVEL_NORMAL, 0, "Search java in CurrentVersion values...", 1); for ( k = 0; k < rootKeysNumber; k++) { for(i=0; i < keysNumber;i++) { if(isTerminated(props)) { return; } else { WCHAR * value = getStringValue(rootKeys[k], keys[i], CURRENT_VERSION, access64key); if(value!=NULL) { WCHAR *javaHome = getStringValuePC(rootKeys[k], keys[i], value, JAVA_HOME, access64key); writeMessageA(props, OUTPUT_LEVEL_NORMAL, 0, "... ", 0); writeMessageA(props, OUTPUT_LEVEL_NORMAL, 0, (rootKeys[k]==HKEY_LOCAL_MACHINE) ? "HKEY_LOCAL_MACHINE" : "HKEY_CURRENT_USER", 0); writeMessageA(props, OUTPUT_LEVEL_NORMAL, 0, "\\", 0); writeMessageW(props, OUTPUT_LEVEL_NORMAL, 0, keys[i], 0); writeMessageA(props, OUTPUT_LEVEL_NORMAL, 0, "\\", 0); writeMessageW(props, OUTPUT_LEVEL_NORMAL, 0, CURRENT_VERSION, 0); writeMessageA(props, OUTPUT_LEVEL_NORMAL, 0, "->", 0); writeMessageW(props, OUTPUT_LEVEL_NORMAL, 0, value, 0); writeMessageA(props, OUTPUT_LEVEL_NORMAL, 0, "[", 0); writeMessageW(props, OUTPUT_LEVEL_NORMAL, 0, JAVA_HOME, 0); writeMessageA(props, OUTPUT_LEVEL_NORMAL, 0, "] = ", 0); writeMessageW(props, OUTPUT_LEVEL_NORMAL, 0, javaHome, 1); FREE(value); trySetCompatibleJava(javaHome, props); FREE(javaHome); if(props->java!=NULL) { FREE(buffer); return; } } } } } // we found no CurrentVersion java... just search for other possible keys writeMessageA(props, OUTPUT_LEVEL_NORMAL, 0, "Search java in other values...", 1); for(k=0;k<rootKeysNumber;k++) { for(i=0;i<keysNumber;i++) { HKEY hkey = 0; DWORD index = 0 ; if (RegOpenKeyExW(rootKeys[k], keys[i], 0, KEY_READ | ((access64key && IsWow64) ? KEY_WOW64_64KEY : 0), &hkey) == ERROR_SUCCESS) { DWORD number = 0; if (RegQueryInfoKeyW(hkey, NULL, NULL, NULL, &number, NULL, NULL, NULL, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { DWORD err = 0; do { DWORD size = MAX_LEN_VALUE_NAME; buffer[0] = 0; err = RegEnumKeyExW(hkey, index, buffer, &size, NULL, NULL, NULL, NULL); if (err == ERROR_SUCCESS) { WCHAR * javaHome = getJavaHomeValue(keys[i], buffer, access64key); status = ERROR_OK; writeMessageA(props, OUTPUT_LEVEL_NORMAL, 0, (rootKeys[k]==HKEY_LOCAL_MACHINE) ? "HKEY_LOCAL_MACHINE" : "HKEY_CURRENT_USER", 0); writeMessageA(props, OUTPUT_LEVEL_NORMAL, 0, "\\", 0); writeMessageW(props, OUTPUT_LEVEL_NORMAL, 0, keys[i], 0); writeMessageA(props, OUTPUT_LEVEL_NORMAL, 0, "\\", 0); writeMessageW(props, OUTPUT_LEVEL_NORMAL, 0, buffer, 0); writeMessageA(props, OUTPUT_LEVEL_NORMAL, 0, "[", 0); writeMessageW(props, OUTPUT_LEVEL_NORMAL, 0, JAVA_HOME, 0); writeMessageA(props, OUTPUT_LEVEL_NORMAL, 0, "] = ", 0); writeMessageW(props, OUTPUT_LEVEL_NORMAL, 0, javaHome, 1); trySetCompatibleJava(javaHome, props); FREE(javaHome); if(props->java!=NULL) { i = keysNumber; // to the end of cycles k = rootKeysNumber; break; } } index++; } while (err == ERROR_SUCCESS); } } if (hkey != 0) { RegCloseKey(hkey); } } } FREE(buffer); return; }
void tellstdfunc::stdREMOVECELL::undo_cleanup() { getStringValue(UNDOPstack, false); telldata::ttlist* pl = static_cast<telldata::ttlist*>(UNDOPstack.back());UNDOPstack.pop_back(); delete pl; }
void tellstdfunc::stdNEWCELL::undo_cleanup() { getStringValue(UNDOPstack, false); }
/* * Because there are times when it's useful to have a nice * human-readable form of the contents of this instance. Most of the * time this means that it's used for debugging, but it could be used * for just about anything. In these cases, it's nice not to have to * worry about the ownership of the representation, so this returns * a CKString. */ CKString CKUUID::toString() const { return getStringValue(); }
//----------------------------------------------------------------------------- int main( int argc, char* argv[] ) //----------------------------------------------------------------------------- { HDMR hDMR = INVALID_ID; HDRV hDrv = INVALID_ID; HDEV hDevice = INVALID_ID; TDMR_ERROR result = DMR_NO_ERROR; CaptureParameter captureParams; unsigned int i = 0; HOBJ hPropFamily = INVALID_ID; char* pStringBuffer = NULL; UserSuppliedHeapBuffer* pUserSuppliedBuffer = 0; int requestNr = INVALID_ID; int requestUsed = INVALID_ID; int bufferSize = 0; RequestResult ReqRes; ImageBuffer* pIB = 0; const int REQUEST_TO_USE = 2; // get rid of warnings argc = argc; argv = argv; // try to initialise the library. if( ( result = DMR_Init( &hDMR ) ) != DMR_NO_ERROR ) { printf( "DMR_Init failed (code: %d)\n", result ); END_APPLICATION; } getDeviceFromUserInput( &hDevice, 0, 1 ); if( ( hPropFamily = getDeviceProp( hDevice, "Family" ) ) == INVALID_ID ) { printf( "Failed to obtain device family property for device %d.\n", i ); END_APPLICATION; } getStringValue( hPropFamily, &pStringBuffer, 0 ); free( pStringBuffer ); pStringBuffer = 0; // try to initialise this device if( ( result = DMR_OpenDevice( hDevice, &hDrv ) ) != DMR_NO_ERROR ) { printf( "DMR_OpenDevice failed (code: %d)\n", result ); printf( "DMR_Close: %d\n", DMR_Close() ); END_APPLICATION; } #ifdef USE_MV_DISPLAY_LIB // create a window to display the captured images captureParams.hDisp = mvDispWindowCreate( "CaptureToUserMemory sample(plain 'C')" ); captureParams.pDisp = mvDispWindowGetDisplayHandle( captureParams.hDisp ); mvDispWindowShow( captureParams.hDisp ); #endif // #ifdef USE_MV_DISPLAY_LIB captureParams.hDrv = hDrv; captureParams.pFirstHeapBuffer = 0; captureParams.requestCount = 0; captureParams.ppRequests = 0; // try to locate the frames per second property if( ( captureParams.hFramesPerSecond = getStatisticProp( hDrv, "FramesPerSecond" ) ) == INVALID_ID ) { printf( "Couldn't locate 'FramesPerSecond' property! Unable to continue!\n" ); END_APPLICATION; } if( ( captureParams.hRequestCount = getSystemSettingProp( hDrv, "RequestCount" ) ) == INVALID_ID ) { printf( "Couldn't locate 'RequestCount' property! Unable to continue!\n" ); END_APPLICATION; } if( ( captureParams.hCaptureBufferAlignment = getInfoProp( hDrv, "CaptureBufferAlignment" ) ) == INVALID_ID ) { printf( "Couldn't locate 'CaptureBufferAlignment' property! Unable to continue!\n" ); END_APPLICATION; } if( ( captureParams.hRequestControl_Mode = getRequestCtrlProp( hDrv, "Base", "Mode" ) ) == INVALID_ID ) { printf( "Couldn't locate request controls 'Mode' property! Unable to continue!\n" ); END_APPLICATION; } if( ( captureParams.hRequestControl_RequestToUse = getRequestCtrlProp( hDrv, "Base", "RequestToUse" ) ) == INVALID_ID ) { printf( "Couldn't locate request controls 'RequestToUse' property! Unable to continue!\n" ); END_APPLICATION; } allocateRequests( &captureParams ); //============================================================================= //========= Capture loop into memory managed by the driver (default) ========== //============================================================================= printf( "The device will try to capture continuously into memory automatically allocated be the device driver..\n" ); printf( "This is the default behaviour.\n" ); captureParams.boUserSuppliedMemoryUsed = 0; captureLoop( &captureParams ); //============================================================================= //========= Capture loop into memory managed by the user (advanced) =========== //============================================================================= printf( "The device will now try to capture continuously into user supplied memory.\n" ); captureParams.boUserSuppliedMemoryUsed = 1; // find out the size of the resulting buffer by requesting a dummy request setPropI( captureParams.hRequestControl_Mode, ircmTrial, 0 ); DMR_ImageRequestSingle( captureParams.hDrv, 0, 0 ); // waitFor will return as fast as possible. No 'real' image will be taken // but a request object that contains a dummy image with the format, dimensions // and other information will be returned, that is (apart from the pixel data) // similar to any 'real' image that would be captured with the current settings result = DMR_ImageRequestWaitFor( captureParams.hDrv, -1, 0, &requestNr ); if( result == DMR_NO_ERROR ) { // check if the request contains a valid image result = DMR_GetImageRequestResultEx( hDrv, requestNr, &ReqRes, sizeof( ReqRes ), 0, 0 ); if( ( result == DMR_NO_ERROR ) && ( ReqRes.result == rrOK ) ) { // obtain the buffer size needed in the current configuration bufferSize = getPropI( captureParams.ppRequests[requestNr]->hImageSize_, 0 ) + getPropI( captureParams.ppRequests[requestNr]->hImageFooterSize_, 0 ); /// switch back to 'normal' capture mode setPropI( captureParams.hRequestControl_Mode, ircmManual, 0 ); // unlock this request to make it usable for the driver again DMR_ImageRequestUnlock( captureParams.hDrv, requestNr ); result = createCaptureBuffers( &captureParams, bufferSize, getPropI( captureParams.hCaptureBufferAlignment, 0 ) ); if( result != 0 ) { printf( "An error occurred while setting up the user supplied buffers(error code: %s).\n", DMR_ErrorCodeToString( result ) ); END_APPLICATION; } } else { printf( "Internal error(Request result: %08x! This should not happen an is a driver fault! Unable to continue.\n", ReqRes.result ); END_APPLICATION; } } else { printf( "Internal error! This should not happen an is a driver fault! Unable to continue.\n" ); END_APPLICATION; } captureLoop( &captureParams ); //============================================================================= //========= unregister user supplied buffers again ============================ //============================================================================= freeCaptureBuffers( &captureParams ); //============================================================================= //========= Capture loop into memory managed by the driver again (default) ==== //============================================================================= captureParams.boUserSuppliedMemoryUsed = 0; printf( "The device will try to capture continuously into memory automatically allocated be the device driver again.\n" ); printf( "This is the default behaviour.\n" ); captureLoop( &captureParams ); //============================================================================= //========= Capture into a specific buffer managed by the user (advanced) ===== //============================================================================= // by default the driver will decide which request will be used for an acquisition // requested by the user. However sometimes it can be necessary to make sure that a // certain request object will be used... printf( "Now the device will try to capture one frame into a specific user supplied buffer.\n" ); pUserSuppliedBuffer = UserSuppliedHeapBuffer_Alloc( bufferSize, getPropI( captureParams.hCaptureBufferAlignment, 0 ) ); // we want to use request number 'REQUEST_TO_USE' (zero based) for this acquisition thus we have to make sure // that there are at least 'REQUEST_TO_USE + 1' requests if( getPropI( captureParams.hRequestCount, 0 ) < REQUEST_TO_USE ) { setPropI( captureParams.hRequestCount, REQUEST_TO_USE + 1, 0 ); allocateRequests( &captureParams ); } // associate a user supplied buffer with this request result = DMR_ImageRequestConfigure( captureParams.hDrv, REQUEST_TO_USE, 0, 0 ); if( result != DMR_NO_ERROR ) { printf( "An error occurred while setting request number %d in configuration mode: %s.\n", REQUEST_TO_USE, DMR_ErrorCodeToString( result ) ); printf( "Press [ENTER] to end the continuous acquisition.\n" ); getchar(); } setPropI( captureParams.ppRequests[REQUEST_TO_USE]->hImageMemoryMode_, rimmUser, 0 ); setPropP( captureParams.ppRequests[REQUEST_TO_USE]->hImageData_, pUserSuppliedBuffer->pBufAligned_, 0 ); setPropI( captureParams.ppRequests[REQUEST_TO_USE]->hImageSize_, pUserSuppliedBuffer->bufSize_, 0 ); if( ( result = DMR_ImageRequestUnlock( captureParams.hDrv, captureParams.ppRequests[REQUEST_TO_USE]->nr_ ) ) != DMR_NO_ERROR ) { printf( "An error occurred while unlocking request number %d: %s.\n", captureParams.ppRequests[REQUEST_TO_USE]->nr_, DMR_ErrorCodeToString( result ) ); freeCaptureBuffers( &captureParams ); END_APPLICATION; } // define that 'REQUEST_TO_USE' is used for the next acquisition setPropI( captureParams.hRequestControl_RequestToUse, REQUEST_TO_USE, 0 ); // and capture the image requestUsed = INVALID_ID; result = DMR_ImageRequestSingle( captureParams.hDrv, 0, &requestUsed ); if( result != DMR_NO_ERROR ) { printf( "An error occurred while requesting an image for request number %d: (%s).\n", REQUEST_TO_USE, DMR_ErrorCodeToString( result ) ); printf( "Press [ENTER] to end the continuous acquisition.\n" ); END_APPLICATION; } if( requestUsed != REQUEST_TO_USE ) { printf( "ERROR! An acquisition into buffer %d was requested, but the driver did use %d for this acquisition.\n", REQUEST_TO_USE, requestUsed ); } manuallyStartAcquisitionIfNeeded( hDrv ); result = DMR_ImageRequestWaitFor( captureParams.hDrv, -1, 0, &requestNr ); manuallyStopAcquisitionIfNeeded( hDrv ); if( result == DMR_NO_ERROR ) { // check if the request contains a valid image result = DMR_GetImageRequestResultEx( hDrv, requestNr, &ReqRes, sizeof( ReqRes ), 0, 0 ); if( ( result == DMR_NO_ERROR ) && ( ReqRes.result == rrOK ) ) { if( ( result = DMR_GetImageRequestBuffer( hDrv, requestNr, &pIB ) ) == DMR_NO_ERROR ) { #ifdef USE_MV_DISPLAY_LIB // display the captured image mvDispSetImageFromImageBuffer( captureParams.pDisp, pIB ); mvDispUpdate( captureParams.pDisp ); #else printf( "Frame captured into request number %d(%dx%d).\n", requestNr, pIB->iWidth, pIB->iHeight ); #endif // #ifdef USE_MV_DISPLAY_LIB } else { printf( "DMR_GetImageRequestBuffer: ERROR! Code %d\n", result ); } } else { printf( "Acquisition into a specific buffer was not successful. Request result: 0x%08x.\n", ReqRes.result ); } } else { printf( "Waiting for a frame captured into a specific buffer failed: %s.\n", DMR_ErrorCodeToString( result ) ); } #ifdef USE_MV_DISPLAY_LIB mvDispWindowDestroy( captureParams.hDisp ); #endif // #ifdef USE_MV_DISPLAY_LIB freeRequests( &captureParams ); freeCaptureBuffers( &captureParams ); printf( "DMR_ReleaseImageRequestBufferDesc: %s.\n", DMR_ErrorCodeToString( DMR_ReleaseImageRequestBufferDesc( &pIB ) ) ); printf( "DMR_CloseDevice: %s\n", DMR_ErrorCodeToString( DMR_CloseDevice( hDrv, hDevice ) ) ); printf( "DMR_Close: %s\n", DMR_ErrorCodeToString( DMR_Close() ) ); END_APPLICATION; }
/********************************************************************************** * AUTHOR : Thanigai Murugan K * DATE : 30-AUG-2005 * NAME : processCommandLineArgs * DESCRIPTION : Processes all the command line arguments. Report an error if value is * missing for any command line option * ARGUMENTS : None * RETURNS : 0 on Success and -1 on Error * NOTES : * CHANGE HISTROY * Author Date Description of change *************************************************************************************/ int processCommandLineArgs() { bool bProfileAssumed = true; // Minimum MIN_ARGS arguments must... if(globalArgCount >= MIN_ARGS) { if(LTKSTRCMP(globalArg[1], OPTION_VERSION) == 0) { bVersionRequest = true; return 0; } } for(int i = 1; i < globalArgCount; i++) { if((LTKSTRCMP(globalArg[i], OPTION_HELP1) == 0) || (LTKSTRCMP(globalArg[i], OPTION_HELP2) == 0)) { return -1; } if(LTKSTRCMP(globalArg[i], OPTION_VERSION) == 0) { bVersionRequest = true; return 0; } if(LTKSTRCMP(globalArg[i], OPTION_NUMCHOICES) == 0) { if(getIntValue(i, &numChoices) != 0) { printf("\nInvalid or no value specified for -numchoices option.\n"); return -1; } else { i++; continue;} } if(LTKSTRCMP(globalArg[i], OPTION_TEST) == 0) { char tempVal[MAX_PATH], tempMode[124]; strcpy(tempMode, globalArg[i]); // Now get the list file name if(getStringValue(i, tempVal) != 0) { printf("\nMissing list file name for %s option.\n", globalArg[i]); return -1; } i++; if(LTKSTRCMP(tempMode, OPTION_TEST)==0) { strcpy(strTestLstFile, tempVal); } continue; } if(LTKSTRCMP(globalArg[i], OPTION_PERF) == 0) { if(globalArgCount <= MIN_ARGS) { printf("\n Option %s can only be combined with other options.\n", globalArg[i]); return -1; } else { bComputePerformance = true; continue;} } if(LTKSTRCMP(globalArg[i], OPTION_PROJECT) == 0) { if(getStringValue(i, strProjectName) != 0) { printf("\nInvalid or no value specified for -project option.\n"); return -1; } else { i++; continue;} } if(LTKSTRCMP(globalArg[i], OPTION_PROFILE) == 0) { if(getStringValue(i, strProfileName) != 0) { printf("\nInvalid or no value specified for -profile option.\n"); return -1; } else { i++; bProfileAssumed = false; continue;} } if(LTKSTRCMP(globalArg[i], OPTION_OUTPUT) == 0) { if(getStringValue(i, strOutputFileName) != 0) { printf("\nInvalid or no value specified for -output option.\n"); return -1; } else { i++; continue;} } if(LTKSTRCMP(globalArg[i], OPTION_LOGFILE) == 0) { if(getStringValue(i, strLogFile) != 0) { printf("\nInvalid or no value specified for -logfile option.\n"); return -1; } else { i++; continue;} } if(LTKSTRCMP(globalArg[i], LIPI_ROOT) == 0) { if(getStringValue(i, strLipiRootPath) != 0) { printf("\nInvalid or no value specified for -lipiroot option.\n"); return -1; } else { i++; continue;} } if(LTKSTRCMP(globalArg[i], OPTION_LOGLEVEL) == 0) { if(getStringValue(i, strLogLevel) != 0) { printf("\nInvalid or no value specified for -loglevel option.\n"); return -1; } else { i++; continue; } } printf("\nInvalid or Unknown option.\n"); return -1; } if(LTKSTRCMP(strProjectName, "") == 0) { printf("\nNo project name specified using -project.\n"); return -1; } if(ValidateCommandLineArgs() != 0) return -1; if(LTKSTRCMP(strProfileName, "") == 0) strcpy(strProfileName, DEFAULT_PROFILE); if(bProfileAssumed) printf("\n Profile not specified, assuming %s profile.\n", DEFAULT_PROFILE); return 0; }
float INI::getFloatValue(const char* index, const char *name) { const char *str = getStringValue(index, name); if(str == NULL) {cout<<"notfound"<<endl; return -1.0;} return atof(str); }
void TextField::setMaxLength(int length) { _textFieldRenderer->setMaxLength(length); setText(getStringValue()); }