コード例 #1
0
//=============================================================================
// Fill
//=============================================================================
StatusCode TupleToolSelResults::fill( Tuples::Tuple& tup)
{
  const std::string prefix = fullName();
  bool test = true;
  for ( std::vector<std::string>::const_iterator s = m_selections.begin() ;
        s != m_selections.end(); ++s )
  {
    test &= tup->column(prefix+(*s),m_selTool->isSelected(*s));
    if (!test)
    {
      err() << "Cannot fill variable name " << prefix+(*s) << endmsg ;
      break;
    }
  }
  return StatusCode(test) ;
}
コード例 #2
0
ファイル: srckey.cpp プロジェクト: DerPapst/hhvm
std::string show(SrcKey sk) {
  auto func = sk.func();
  auto unit = sk.unit();
  const char *filepath = "*anonFile*";
  if (unit->filepath()->data() && unit->filepath()->size()) {
    filepath = unit->filepath()->data();
  }
  return folly::sformat("{}:{} in {}(id 0x{:#x})@{: >6}{}{}",
                        filepath, unit->getLineNumber(sk.offset()),
                        func->isPseudoMain() ? "pseudoMain"
                                             : func->fullName()->data(),
                        (uint32_t)sk.funcID(), sk.offset(),
                        sk.resumed()  ? "r" : "",
                        sk.hasThis()  ? "t" : "",
                        sk.prologue() ? "p" : "");
}
コード例 #3
0
ファイル: dirview.cpp プロジェクト: BackupTheBerlios/kinneret
void Directory::setOpen(bool o)
{
	if (o) setPixmap(folderOpen);
	else setPixmap(folderClosed);

	if (o && !childCount())
	{
		QString s(fullName());
		QDir thisDir(s);

		if (!thisDir.isReadable())
		{
			readable = FALSE;
			setExpandable(FALSE);
			return;
		}

		listView()->setUpdatesEnabled(FALSE);
        const QFileInfoList * files = thisDir.entryInfoList();
        
		if (files)
		{
			QFileInfoListIterator it(*files);
			QFileInfo * fi;
			
			while((fi = it.current()) != 0)
			{
				++it;
				if (fi->fileName() == "." || fi->fileName() == ".." ); // nothing
				else if (fi->isSymLink() && !showDirsOnly)
				{
					FileItem *item = new FileItem(this, fi->fileName(), "Symbolic Link" );
					item->setPixmap(fileNormal);
				}
				
				else if (fi->isDir()) (void)new Directory(this, fi->fileName());
				else if (!showDirsOnly)
				{
					FileItem *item = new FileItem(this, fi->fileName(), fi->isFile() ? "File" : "Special");
					item->setPixmap(fileNormal);
				}
			}
		}
		listView()->setUpdatesEnabled(TRUE);
	}
	QListViewItem::setOpen(o);
}
コード例 #4
0
String c_AsyncFunctionWaitHandle::getName() {
  switch (getState()) {
    case STATE_BLOCKED:
    case STATE_READY:
    case STATE_RUNNING: {
      auto func = actRec()->func();
      if (!actRec()->getThisOrClass() ||
          func->cls()->attrs() & AttrNoOverride) {
        auto name = func->fullName();
        if (func->isClosureBody()) {
          const char* p = strchr(name->data(), ':');
          if (p) {
            return
              concat(String(name->data(), p + 1 - name->data(), CopyString),
                     s__closure_);
          } else {
            return s__closure_;
          }
        }
        return String{const_cast<StringData*>(name)};
      }
      String funcName;
      if (actRec()->func()->isClosureBody()) {
        // Can we do better than this?
        funcName = s__closure_;
      } else {
        funcName = const_cast<StringData*>(actRec()->func()->name());
      }

      String clsName;
      if (actRec()->hasThis()) {
        clsName = const_cast<StringData*>(actRec()->getThis()->
                                          getVMClass()->name());
      } else if (actRec()->hasClass()) {
        clsName = const_cast<StringData*>(actRec()->getClass()->name());
      } else {
        return funcName;
      }

      return concat3(clsName, "::", funcName);
    }

    default:
      raise_fatal_error(
          "Invariant violation: encountered unexpected state");
  }
}
コード例 #5
0
ファイル: KoStyleStack.cpp プロジェクト: KDE/calligra-history
inline bool KoStyleStack::hasProperty(const QString &nsURI, const QString &name, const QString *detail) const
{
    QString fullName(name);
    if (detail) {
        fullName += '-';
        fullName += *detail;
    }
    QList<KoXmlElement>::ConstIterator it = m_stack.end();
    while (it != m_stack.begin()) {
        --it;
        const KoXmlElement properties = KoXml::namedItemNS(*it, m_styleNSURI, m_propertiesTagName);
        if (properties.hasAttributeNS(nsURI, name) ||
                (detail && properties.hasAttributeNS(nsURI, fullName)))
            return true;
    }
    return false;
}
コード例 #6
0
ファイル: exception.cpp プロジェクト: NielsHolst/UniSim
QString Exception::message() const
{
    QString msg = _message;
    if (concerning) {
        msg += "\nConcerning: " + fullName(concerning);
        auto conc = const_cast<QObject*>(concerning);
        Model *model = dynamic_cast<Model*>(conc);
        if (model) {
            auto calendars = model->seekMany<Model*>("calendar");
            if (calendars.size() == 1) {
                auto step = calendars.at(0)->peekValuePtr<int>("totalTimeSteps");
                if (step)
                    msg += "\n In integration step: " + QString::number(*step);
            }
        }
    }
    return msg;
}
コード例 #7
0
ファイル: typename.cpp プロジェクト: svenslaggare/StackLang
std::unique_ptr<TypeName> TypeName::makeFull(const TypeName* const typeName, std::shared_ptr<SymbolTable> symbolTable) {
	if (typeName->isArray()) {
		auto elementTypeName = makeFull(typeName->elementTypeName(), symbolTable);
		return std::unique_ptr<TypeName>(new TypeName(elementTypeName->name() + "[]", std::move(elementTypeName)));
	} else {
		std::string fullTypeName;

		auto typeSymbol = std::dynamic_pointer_cast<ClassSymbol>(Helpers::findSymbolInNamespace(symbolTable, typeName->name()));

		if (typeSymbol != nullptr) {
			fullTypeName = typeSymbol->fullName();
		} else {
			fullTypeName = typeName->name();
		}

		return std::unique_ptr<TypeName>(new TypeName(fullTypeName));
	}
}
コード例 #8
0
/**
 * Writes the header and source files for a template.
 *
 * @param tdfFile		the parsed template definition file
 * @param path			path to write the file to
 *
 * @return 0 on success, -1 on error
 */
int writeTemplate(TemplateDefinitionFile &tdfFile, const Filename &path)
{
int result;

//	std::string oldTemplateName = tdfFile.getTemplateName();
//	std::string oldBaseName = tdfFile.getBaseName();

	Filename fullName(NULL, path.getPath().c_str(), tdfFile.getTemplateName().c_str(),
		NULL);

	writeTemplateHeader(tdfFile, fullName);
	result = writeTemplateSource(tdfFile, fullName);

//	tdfFile.setTemplateName(oldTemplateName);
//	tdfFile.setBaseName(oldBaseName);

	return result;
}	// writeTemplate
コード例 #9
0
QString StyleStack::attribute( const QString& name, const QString& detail ) const
{
    QString fullName( name );
    fullName += '-';
    fullName += detail;
    QList<QDomElement>::ConstIterator it = m_stack.end();
    while ( it != m_stack.begin() )
    {
        --it;
        QDomElement properties = searchAttribute( *it, m_nodeNames, name, fullName );
        if ( properties.hasAttribute( fullName ) )
            return properties.attribute( fullName );
        if ( properties.hasAttribute( name ) )
            return properties.attribute( name );
    }

    return QString::null;
}
コード例 #10
0
nsresult 
nsCharsetConverterManager::GetList(const nsACString& aCategory,
                                   const nsACString& aPrefix,
                                   nsIUTF8StringEnumerator** aResult)
{
  if (aResult == NULL) 
    return NS_ERROR_NULL_POINTER;
  *aResult = NULL;

  nsresult rv;

  nsCOMPtr<nsICategoryManager> catman = do_GetService(NS_CATEGORYMANAGER_CONTRACTID, &rv);
  if (NS_FAILED(rv))
    return rv;

  nsTArray<nsCString>* array = new nsTArray<nsCString>;
  if (!array)
    return NS_ERROR_OUT_OF_MEMORY;
  
  nsCOMPtr<nsISimpleEnumerator> enumerator;
  catman->EnumerateCategory(PromiseFlatCString(aCategory).get(), 
                            getter_AddRefs(enumerator));

  bool hasMore;
  while (NS_SUCCEEDED(enumerator->HasMoreElements(&hasMore)) && hasMore) {
    nsCOMPtr<nsISupports> supports;
    if (NS_FAILED(enumerator->GetNext(getter_AddRefs(supports))))
      continue;
    
    nsCOMPtr<nsISupportsCString> supStr = do_QueryInterface(supports);
    if (!supStr)
      continue;

    nsCAutoString name;
    if (NS_FAILED(supStr->GetData(name)))
      continue;

    nsCAutoString fullName(aPrefix);
    fullName.Append(name);
    NS_ENSURE_TRUE(array->AppendElement(fullName), NS_ERROR_OUT_OF_MEMORY);
  }
    
  return NS_NewAdoptingUTF8StringEnumerator(aResult, array);
}
コード例 #11
0
void applistModel::constructappslist()
{
    LS("applistModel::constructappslist() >>");

    int err = m_session.GetAllApps();
    if(KErrNone != err)
        return;

    TApaAppInfo appInfo;
    err = m_session.GetNextApp(appInfo);

    while(err == KErrNone)
        {
        TApaAppCapabilityBuf buf;
        m_session.GetAppCapability(buf, appInfo.iUid);
        if(buf().iAppIsHidden == EFalse && appInfo.iUid.iUid != APPUID)
            {
            QString caption((QChar*)appInfo.iCaption.Ptr(),appInfo.iCaption.Length());
            QString fullName((QChar*)appInfo.iFullName.Ptr(),appInfo.iFullName.Length());
            LS(caption);

            if(!caption.isEmpty())
                {
                AppEntry p;
                p.caption = caption;
                p.fullName = fullName;
                p.uid = appInfo.iUid.iUid;
                p.rank = 1; //does not matter. should be same value for alphabatical sorting
                m_appslist->append(p);
                }
            }

        err = m_session.GetNextApp(appInfo);
        }

    for(int i=0; i < m_appslist->count();i++)
        m_uidlist.append(m_appslist->at(i).uid);

    qSort(m_appslist->begin(), m_appslist->end(), appentrylessthan2);
    emit modelReady();

    LS("applistModel::constructappslist() <<");
}
コード例 #12
0
ファイル: ConfigDumper.cpp プロジェクト: hengne/d0wmass
  void ConfigDumper::finish()
  {
    if (_dumpToROOTDir) {
      out() << "========================================" << std::endl;
      out() << "ConfigDumper[" << name() << "]:"
	    << " Dumping configuration to current ROOT directory" << std::endl;
      out() << "   (using name '" << _dumpName << "')" << std::endl;
      if (TDirectory* dir = getDirectory()) {
	Config config(name());
	config.dumpConfig(dir,_dumpName);
      } else {
	// Could not find a directory to store things.
	err() << fullName() << ": No valid directory" << std::endl;
      } // else
      out() << "========================================" << std::endl;
    } // if

    return;
  }
コード例 #13
0
ファイル: FileBrowser.cpp プロジェクト: Penguinum/lmms
Directory::Directory(const QString & filename, const QString & path,
						const QString & filter ) :
	QTreeWidgetItem( QStringList( filename ), TypeDirectoryItem ),
	m_directories( path ),
	m_filter( filter )
{
	initPixmaps();

	setChildIndicatorPolicy( QTreeWidgetItem::ShowIndicator );

	if( !QDir( fullName() ).isReadable() )
	{
		setIcon( 0, *s_folderLockedPixmap );
	}
	else
	{
		setIcon( 0, *s_folderPixmap );
	}
}
コード例 #14
0
bool KoStyleStack::hasAttributeNS( const char* nsURI, const char* name, const char* detail ) const
{
    QString fullName( name );
    if ( detail )
    {
        fullName += '-';
        fullName += detail;
    }
    QValueList<QDomElement>::ConstIterator it = m_stack.end();
    while ( it != m_stack.begin() )
    {
        --it;
        QDomElement properties = KoDom::namedItemNS( *it, m_styleNSURI, m_propertiesTagName );
        if ( properties.hasAttributeNS( nsURI, name ) ||
             ( detail && properties.hasAttributeNS( nsURI, fullName ) ) )
            return true;
    }
    return false;
}
コード例 #15
0
bool KoStyleStack::hasAttribute( const QString& name, const QString& detail ) const
{
    QString fullName( name );
    if ( !detail.isEmpty() )
    {
        fullName += '-';
        fullName += detail;
    }
    QValueList<QDomElement>::ConstIterator it = m_stack.end();
    while ( it != m_stack.begin() )
    {
        --it;
        QDomElement properties = (*it).namedItem( "style:"+m_propertiesTagName ).toElement();
        if ( properties.hasAttribute( name ) ||
             ( !detail.isEmpty() && properties.hasAttribute( fullName ) ) )
            return true;
    }
    return false;
}
コード例 #16
0
void
XMLEditCodeGeneratorWindow::generateOne()
{
    static const char *xmlTools[] = {"xml2atts", "xml2java", "xml2python",
       "xml2window", "xml2cmake", "xml2info", "xml2avt"};

    cleanupProcess();

    if(useTools[toolIndex])
    {
        // Create a new process.
        currentProcess = new QProcess(this);
        QString xmlTool(PathToVisIt() + xmlTools[toolIndex]);
        
        QStringList arguments;
        arguments << "-clobber";
        
        arguments << xmlFile;

        // Set the process's working directory.
        QDir d(xmlFile);
        QString fullName(d.filePath(d.absolutePath()));
        int slash = fullName.lastIndexOf("/");
        if(slash == -1)
            slash = fullName.lastIndexOf("\\");
        if(slash != -1)
        {
            QString dirName(fullName.left(slash));
            currentProcess->setWorkingDirectory(dirName);
        }

        connect(currentProcess, SIGNAL(readyReadStandardOutput()), 
                this, SLOT(readProcessStdout()));
        connect(currentProcess, SIGNAL(readyReadStandardError()), 
                this, SLOT(readProcessStderr()));
        if(toolIndex < ID_XML2AVT)
        {
            connect(currentProcess, SIGNAL(finished(int, QProcess::ExitStatus)),
                    this, SLOT(generateOne()));
        }
        else
        {
コード例 #17
0
ファイル: print.cpp プロジェクト: MarcReis/hiphop-php
static void printConst(std::ostream& os, IRInstruction* inst) {
  os << color(ANSI_COLOR_LIGHT_BLUE);
  SCOPE_EXIT { os << color(ANSI_COLOR_END); };

  auto t = inst->typeParam();
  auto c = inst->extra<DefConst>();
  if (t == Type::Int) {
    os << c->as<int64_t>();
  } else if (t == Type::Dbl) {
    os << c->as<double>();
  } else if (t == Type::Bool) {
    os << (c->as<bool>() ? "true" : "false");
  } else if (t.isString()) {
    auto str = c->as<const StringData*>();
    os << "\""
       << Util::escapeStringForCPP(str->data(), str->size())
       << "\"";
  } else if (t.isArray()) {
    auto arr = inst->extra<DefConst>()->as<const ArrayData*>();
    if (arr->empty()) {
      os << "array()";
    } else {
      os << "Array(" << arr << ")";
    }
  } else if (t.isNull() || t.subtypeOf(Type::Nullptr)) {
    os << t.toString();
  } else if (t.subtypeOf(Type::Func)) {
    auto func = c->as<const Func*>();
    os << "Func(" << (func ? func->fullName()->data() : "0") << ")";
  } else if (t.subtypeOf(Type::Cls)) {
    auto cls = c->as<const Class*>();
    os << "Cls(" << (cls ? cls->name()->data() : "0") << ")";
  } else if (t.subtypeOf(Type::NamedEntity)) {
    auto ne = c->as<const NamedEntity*>();
    os << "NamedEntity(" << ne << ")";
  } else if (t.subtypeOf(Type::TCA)) {
    TCA tca = c->as<TCA>();
    auto name = Util::getNativeFunctionName(tca);
    SCOPE_EXIT { free(name); };
    os << folly::format("TCA: {}({})", tca,
      boost::trim_copy(std::string(name)));
  } else if (t.subtypeOf(Type::None)) {
コード例 #18
0
ファイル: AppenderFile.cpp プロジェクト: Caydan/WoWSCore548
FILE* AppenderFile::OpenFile(std::string const &filename, std::string const &mode, bool backup)
{
    std::string fullName(logDir + filename);
    if (backup)
    {
        CloseFile();
        std::string newName(fullName);
        newName.push_back('.');
        newName.append(LogMessage::getTimeStr(time(NULL)));
        rename(fullName.c_str(), newName.c_str()); // no error handling... if we couldn't make a backup, just ignore
    }

    if (FILE* ret = fopen(fullName.c_str(), mode.c_str()))
    {
        fileSize = ftell(ret);
        return ret;
    }

    return NULL;
}
コード例 #19
0
ファイル: polydataobject.cpp プロジェクト: IbisNeuronav/Ibis
void PolyDataObject::Export()
{
    Q_ASSERT( this->GetManager() );
    QString surfaceName(this->Name);
    surfaceName.append(".vtk");
    this->SetDataFileName(surfaceName);
    QString fullName(this->GetManager()->GetSceneDirectory());
    fullName.append("/");
    fullName.append(surfaceName);
    QString saveName = Application::GetInstance().GetFileNameSave( tr("Save Object"), fullName, tr("*.vtk") );
    if(saveName.isEmpty())
        return;
    if (QFile::exists(saveName))
    {
        int ret = QMessageBox::warning(0, tr("Save PolyDataObject"), saveName,
                                       QMessageBox::Yes | QMessageBox::Default,
                                       QMessageBox::No | QMessageBox::Escape);
        if (ret == QMessageBox::No)
            return;
    }
    this->SavePolyData( saveName );
}
コード例 #20
0
ファイル: linguistgenerator.cpp プロジェクト: Fale/qtmoko
QList<QDomElement> LinguistGenerator::generateIndexSections(
                   QDomDocument &document, const Node *node, CodeMarker *marker)
{
    QList<QDomElement> contexts;

    if (node->isInnerNode()) {
        const InnerNode *inner = static_cast<const InnerNode *>(node);

        foreach (const Node *child, inner->childNodes()) {
            // Recurse to generate a DOM element for this child node and all
            // its children.
            contexts += generateIndexSections(document, child, marker);
        }
/*
        foreach (const Node *child, inner->relatedNodes()) {
            QDomElement childElement = generateIndexSections(document, child, marker);
            element.appendChild(childElement);
        }
*/
    }

    // Add documentation to this node if it exists.
    if (!node->doc().isEmpty()) {

        QString nodeName = fullName(node);
        QString signature;

        if (node->type() == Node::Function) {
            QStringList pieces;
            const FunctionNode *functionNode = static_cast<const FunctionNode*>(node);
            foreach (const Parameter &parameter, functionNode->parameters()) {
                QString typeString = parameter.leftType() + parameter.rightType();
                if (typeString.split(" ").size() > 1)
                    pieces.append(typeString + parameter.name());
                else
                    pieces.append(typeString + " " + parameter.name());
            }
            signature = "(" + pieces.join(", ") + ")";
        }
コード例 #21
0
ファイル: drawBeamSpotGraphs.C プロジェクト: wa01/usercode
void drawTimeDifference (TDirectory* directory, TH1* refHisto, const char* fname=0)
{
  TGraphErrors* graphX = (TGraphErrors*)directory->Get("x");
  if ( graphX==0 )  return;
  TH1I* hFirst = (TH1I*)directory->Get("firstTime");
  TH1I* hLast = (TH1I*)directory->Get("lastTime");
  if ( hFirst==0 || hLast==0 )  return;

  std::string fullName("cDeltaT");
  if ( fname )  fullName += fname;
  else  fullName += directory->GetName();
  TCanvas* c = new TCanvas(fullName.c_str(),fullName.c_str());
  TH1* h = refHisto->Clone("DeltaT");
  h->Reset();
  h->SetTitle("DeltaT");

  TGraph* graph = new TGraph();
  graph->SetName("gDeltaT");

  double xg,yg;
  for ( unsigned int i=1; i<=hFirst->GetNbinsX(); ++i ) {
    std::time_t t1 = hFirst->GetAt(i);
    std::time_t t2 = hLast->GetAt(i);
    TTimeStamp ts1(hFirst->GetAt(i));
    std::cout << "Fit started at " << ts1.AsString() << std::endl;
    graphX->GetPoint(i-1,xg,yg);
    graph->SetPoint(i-1,xg,difftime(t2,t1));
  }

  double xmin,xmax,ymin,ymax;
  graph->ComputeRange(xmin,ymin,xmax,ymax);
  h->SetMinimum(0.);
  h->SetMaximum((ymax+ymin)/2.+2.*(ymax-ymin)/2.);
  h->Draw();
  graph->SetMarkerStyle(20);
//   graph->SetMarkerColor(2);
//   graph->SetLineColor(2);
  graph->Draw("P");
}
コード例 #22
0
void TypeAnnotation::shapeTypeName(std::string& name) const {
  name += "HH\\shape(";
  TypeAnnotationPtr shapeField = m_typeArgs;
  auto sep = "";
  while (shapeField) {
    name += sep;

    if (shapeField->isClsCnsShapeField()) {
      folly::toAppend(shapeField->m_name, &name);
    } else {
      folly::toAppend("'", shapeField->m_name, "'", &name);
    }
    auto fieldValue = shapeField->m_typeArgs;
    assert(fieldValue);
    folly::toAppend("=>", fieldValue->fullName(), &name);

    sep = ", ";
    shapeField = shapeField->m_typeList;
  }

  name += ")";
}
コード例 #23
0
ファイル: mist_block.cpp プロジェクト: bacek/xscript
void
MistBlock::call(boost::shared_ptr<Context> ctx, boost::shared_ptr<InvokeContext> invoke_ctx) const throw (std::exception) {
    assert(worker_.get());
    
    const ArgList *args = invoke_ctx->getArgList();
    assert(args);

    const std::vector<std::string> *params = NULL;
    const CommonArgList *common_args = dynamic_cast<const CommonArgList*>(args);
    if (common_args) {
        params = &common_args->args();
    }
    else {
        const StringArgList* string_args = dynamic_cast<const StringArgList*>(args);
        assert(string_args);
        params = &string_args->args();
    }

    XmlNodeHelper result;
    try {
        if (worker_->isAttachStylesheet() && !args->empty()) {
            std::auto_ptr<MistWorker> worker = worker_->clone();
            worker->attachData(fullName(args->at(0)));
            result = worker->run(ctx.get(), *params);
        }
        else {
            result = worker_->run(ctx.get(), *params);
        }
    }
    catch(const std::invalid_argument &e) {
        throwBadArityError();
    }
    
    XmlDocHelper doc(xmlNewDoc((const xmlChar*) "1.0"));
    XmlUtils::throwUnless(NULL != doc.get());

    xmlDocSetRootElement(doc.get(), result.release());
    invoke_ctx->resultDoc(doc);
}
コード例 #24
0
ファイル: ThreadPool.cpp プロジェクト: PsyCommando/ppmdu
void PooledThread::start(Thread::Priority priority, Runnable& target, const std::string& name)
{
	FastMutex::ScopedLock lock(_mutex);

	std::string fullName(name);
	if (name.empty())
	{
		fullName = _name;
	}
	else
	{
		fullName.append(" (");
		fullName.append(_name);
		fullName.append(")");
	}
	_thread.setName(fullName);
	_thread.setPriority(priority);
	
	poco_assert (_pTarget == 0);

	_pTarget = &target;
	_targetReady.set();
}
コード例 #25
0
string SoundPlugin::messageSound(unsigned type, SoundUserData *data)
{
    CommandDef *def = core->messageTypes.find(type);
    if (def){
        MessageDef *mdef = (MessageDef*)(def->param);
        if (mdef->base_type)
            type = mdef->base_type;
    }
    string sound;
    if (data)
        sound = get_str(data->Receive, type);
    if (sound == "-")
        return "";
    if (sound.empty()){
        def = core->messageTypes.find(type);
        if ((def == NULL) || (def->icon == NULL))
            return "";
        sound = def->icon;
        sound += ".wav";
        sound = fullName(sound.c_str());
    }
    return sound;
}
コード例 #26
0
ファイル: drawBeamSpotGraphs.C プロジェクト: wa01/usercode
void drawEventDifference (TDirectory* directory, TH1* refHisto, const char* fname=0)
{
  TGraphErrors* graphX = (TGraphErrors*)directory->Get("x");
  if ( graphX==0 )  return;
  TH1I* hFirst = (TH1I*)directory->Get("firstEvent");
  TH1I* hLast = (TH1I*)directory->Get("lastEvent");
  if ( hFirst==0 || hLast==0 )  return;

  std::string fullName("cDeltaE");
  if ( fname )  fullName += fname;
  else  fullName += directory->GetName();
  TCanvas* c = new TCanvas(fullName.c_str(),fullName.c_str());
  TH1* h = refHisto->Clone("DeltaE");
  h->Reset();
  h->SetTitle("DeltaE");

  TGraph* graph = new TGraph();
  graph->SetName("gDeltaE");

  double xg,yg;
  for ( unsigned int i=1; i<=hFirst->GetNbinsX(); ++i ) {
    int e1 = hFirst->GetAt(i);
    int e2 = hLast->GetAt(i);
    graphX->GetPoint(i-1,xg,yg);
    graph->SetPoint(i-1,xg,e2-e1);
  }

  double xmin,xmax,ymin,ymax;
  graph->ComputeRange(xmin,ymin,xmax,ymax);
  h->SetMinimum(0.);
  h->SetMaximum((ymax+ymin)/2.+2.*(ymax-ymin)/2.);
  h->Draw();
  graph->SetMarkerStyle(20);
//   graph->SetMarkerColor(2);
//   graph->SetLineColor(2);
  graph->Draw("P");
}
コード例 #27
0
ファイル: unwind.cpp プロジェクト: fredemmott/hhvm
UnwindAction checkHandlers(const EHEnt* eh,
                           const ActRec* const fp,
                           PC& pc,
                           Fault& fault) {
  auto const func = fp->m_func;
  ITRACE(1, "checkHandlers: func {} ({})\n",
         func->fullName()->data(),
         func->unit()->filepath()->data());

  for (int i = 0;; ++i) {
    // Skip the initial m_handledCount - 1 handlers that were
    // considered before.
    if (fault.m_handledCount <= i) {
      fault.m_handledCount++;
      switch (eh->m_type) {
      case EHEnt::Type::Fault:
        ITRACE(1, "checkHandlers: entering fault at {}: save {}\n",
               eh->m_handler,
               func->unit()->offsetOf(pc));
        pc = func->unit()->at(eh->m_handler);
        DEBUGGER_ATTACHED_ONLY(phpDebuggerExceptionHandlerHook());
        return UnwindAction::ResumeVM;
      case EHEnt::Type::Catch:
        ITRACE(1, "checkHandlers: entering catch at {}\n", eh->m_handler);
        pc = func->unit()->at(eh->m_handler);
        DEBUGGER_ATTACHED_ONLY(phpDebuggerExceptionHandlerHook());
        return UnwindAction::ResumeVM;
      }
    }
    if (eh->m_parentIndex != -1) {
      eh = &func->ehtab()[eh->m_parentIndex];
    } else {
      break;
    }
  }
  return UnwindAction::Propagate;
}
コード例 #28
0
ファイル: drawBeamSpotPdfs.C プロジェクト: wa01/usercode
void drawBeamSpotPdfs (TDirectory* directory, const char* coord,
			const char* fname)
{
  TH3* obsHisto = directory->Get("PVobs");
  TH3* estHisto = directory->Get("PVest");
  if ( obsHisto==0 || estHisto==0 )  return;
  
  std::string fullName("PV");
  fullName += coord;
  if ( fname )  fullName += fname;
  else  fullName += directory->GetName();
  TCanvas* c = new TCanvas(fullName.c_str(),fullName.c_str());
  c->SetLogy(true);
  TH1* obsHisto1D = obsHisto->Project3D(coord);
  TH1* estHisto1D = estHisto->Project3D(coord);
  TAxis* xaxis = obsHisto1D->GetXaxis();
  string atitle("Primary vertex ");
  atitle += coord;
  atitle += " [cm]";
  xaxis->SetTitle(atitle.c_str());
  if ( c->GetLogy() )  obsHisto1D->SetMinimum(0.5);
  obsHisto1D->SetMarkerStyle(21);
//   obsHisto1D->SetLineColor(2);
//   obsHisto1D->SetMarkerColor(2);
  obsHisto1D->Draw("E0");
  estHisto1D->SetLineColor(2);
  estHisto1D->SetLineWidth(2);
  estHisto1D->Draw("hist same c");

  if ( strcmp(coord,"x") || strcmp(coord,"y") )  xaxis->SetNdivisions(508);

  string epsName = fullName + ".eps";
  c->SaveAs(epsName.c_str());
  string pngName = fullName + ".png";
  c->SaveAs(pngName.c_str());
  
}
コード例 #29
0
ファイル: costitem.cpp プロジェクト: KDE/kcachegrind
void ProfileCostArray::maxCost(ProfileCostArray* item)
{
    int i;

    if (!item) return;

    // we have to update the other item if needed
    // because we access the item costs directly
    if (item->_dirty) item->update();

    // make sure we have enough space allocated
    reserve(item->_count);

    if (item->_count < _count) {
        for (i = 0; i<item->_count; ++i)
            if (_cost[i] < item->_cost[i]) _cost[i] = item->_cost[i];
    }
    else {
        for (i = 0; i<_count; ++i)
            if (_cost[i] < item->_cost[i]) _cost[i] = item->_cost[i];
        for (; i<item->_count; ++i)
            _cost[i] = item->_cost[i];
        _count = item->_count;
    }

    Q_ASSERT(_count <= _allocCount);
    invalidate();

#if TRACE_DEBUG
    _dirty = false; // do not recurse !
    qDebug("%s added cost item\n %s\n  now %s",
           qPrintable( fullName() ), qPrintable(item->fullName()),
           qPrintable( ProfileCostArray::costString(0) ));
    _dirty = true; // because of invalidate()
#endif
}
コード例 #30
0
ファイル: KoStyleStack.cpp プロジェクト: KDE/calligra-history
inline QString KoStyleStack::property(const QString &nsURI, const QString &name, const QString *detail) const
{
    QString fullName(name);
    if (detail) {
        fullName += '-';
        fullName += *detail;
    }
    QList<KoXmlElement>::ConstIterator it = m_stack.end();
    while (it != m_stack.begin()) {
        --it;
        KoXmlElement properties = KoXml::namedItemNS(*it, m_styleNSURI, m_propertiesTagName);
        if (detail) {
            QString attribute(properties.attributeNS(nsURI, fullName));
            if (!attribute.isEmpty()) {
                return attribute;
            }
        }
        QString attribute(properties.attributeNS(nsURI, name));
        if (!attribute.isEmpty()) {
            return attribute;
        }
    }
    return QString();
}