コード例 #1
0
void VsRegistry::buildGroupObjects() {
  VsLog::debugLog() <<"VsRegistry::buildGroupObjects - Entering." <<std::endl;
  for (std::map<std::string, VsGroup*>::const_iterator it = allGroups.begin();
      it != allGroups.end(); it++) {
    VsGroup* group = it->second;
    VsLog::debugLog() <<"VsRegistry::buildGroupObjects - Building object " <<group->getFullName() <<std::endl;
    
    //What is the declared type of this group?
    VsAttribute* typeAtt = group->getAttribute(VsSchema::typeAtt);
    if (!typeAtt) {
      VsLog::warningLog() <<"VsRegistry::buildGroupObjects - unable to find attribute " <<VsSchema::typeAtt
        <<".  Skipping object " <<group->getFullName() <<std::endl;
      continue;
    }
    
    std::string type;
    typeAtt->getStringValue(&type);
    VsLog::debugLog() <<"VsRegistry::buildGroupObjects - group is of type " <<type <<std::endl;
    if (type == VsSchema::meshKey) {
      VsMesh::buildObject(group);
    } else if (type == VsSchema::vsVarsKey) {
      buildExpressions(group);
    } else if (type == VsSchema::timeKey) {
      loadTime(group);
    } else if (type == VsSchema::runInfoKey) {
      loadRunInfo(group);
    } else {
      VsLog::debugLog() <<"VsRegistry::buildGroupObjects - object is of unrecognized type " <<type <<std::endl;
    }
  }
    
  VsLog::debugLog() <<"VsRegistry::buildGroupObjects - Returning." <<std::endl;
}
コード例 #2
0
void SettingsGeneral::on_revertChangesButton_clicked()
{
	loadLanguage();
    loadConfirmOpenOrder();
    loadCloseToTray();
	loadUpdates();
    loadTime();

	ui.revertChangesButton->setEnabled(false);
	ui.saveButton->setEnabled(false);
}
コード例 #3
0
ファイル: RTC.c プロジェクト: lieb005/PICProjects
void initRTC()
{
	rtcMenu.digits = DIG0_7;
	rtcMenu.state = ddd_hhmm;
	rtcMenu.num_states = DATEVIEWS;
	rtcMenu.printFn = &printRTC;

	date.month = 1;
	date.day = 1;
	date.year = 2013;
	date.hour = 0;
	date.minute = 0;
	date.second = 0;

	EECON1 = EECFG;
	LATC6 = 1;
	loadTime();
	LATC6 = 0;
}
コード例 #4
0
SettingsGeneral::SettingsGeneral()
	: QWidget()
{
	ui.setupUi(this);
    iniSettings=new QSettings(baseValues.iniFileName,QSettings::IniFormat,this);
    mainSettings=new QSettings(appDataDir+"/QtBitcoinTrader.cfg",QSettings::IniFormat);

	loadLanguage();
    loadConfirmOpenOrder();
    loadCloseToTray();
	loadUpdates();
    loadTime();

    ui.revertChangesButton->setEnabled(false);
    ui.saveButton->setEnabled(false);

#ifdef Q_OS_MAC
    ui.closeToTrayLabel->setVisible(false);
    ui.closeToTrayCheckBox->setVisible(false);
#endif
}
コード例 #5
0
void VsRegistry::buildDatasetObjects() {
  VsLog::debugLog() <<"VsRegistry::buildDatasetObjects() - Entering."  <<std::endl;

  //First pass just do meshes
  //But remember the variables for second pass
  std::vector<VsDataset*> varDatasets;
  std::vector<VsDataset*> varWithMeshDatasets;
  for (std::map<std::string, VsDataset*>::const_iterator it = allDatasets.begin();
     it != allDatasets.end(); it++)  {
    VsDataset* dataset = it->second;
    VsLog::debugLog() <<"VsRegistry::buildDatasetObjects() - looking at dataset " <<dataset->getFullName() <<std::endl;

    //Try to determine the type of the object
    std::string type;    
    VsAttribute* typeAtt = dataset->getAttribute(VsSchema::typeAtt);
    if (!typeAtt) {
      VsLog::warningLog() <<"VsRegistry::buildDatasetObjects() - unable to find attribute " <<VsSchema::typeAtt <<std::endl;
      
      //If the object contains the "vsMesh" attribute, then it is probably intended to be a variable
      //So continue with that assumption
      VsLog::warningLog() <<"VsRegistry::buildDatasetObjects() - Second chance - looking for attribute " <<VsSchema::meshAtt <<std::endl;
      VsAttribute* meshAtt = dataset->getAttribute(VsSchema::meshAtt);
      if (meshAtt) {
        VsLog::warningLog() <<"VsRegistry::buildDatasetObjects() - Found attribute " <<VsSchema::meshAtt <<" assuming that this is a variable." <<std::endl;
        type = VsSchema::varKey;
      } else {
        VsLog::warningLog() <<"VsRegistry::buildDatasetObjects() - Did not find attribute " <<VsSchema::meshAtt
                  <<", second chance option has failed.  Skipping object: " <<dataset->getFullName() <<std::endl;
        continue;
      }
    } else {
      typeAtt->getStringValue(&type);
    }
    
    VsLog::debugLog() <<"VsRegistry::buildDatasetObjects() - object is of type " <<type <<std::endl;
    if (type == VsSchema::meshKey) {
      VsMesh::buildObject(dataset);
    } else if (type == VsSchema::varKey) {
      VsLog::debugLog() <<"VsRegistry::buildDatasetObjects() - Variables are built in second pass. Skipping for now." <<std::endl;
      varDatasets.push_back(dataset);
    } else if (type == VsSchema::varWithMeshKey) {
      VsLog::debugLog() <<"VsRegistry::buildDatasetObjects() - VariableWithMesh are built in second pass. Skipping for now." <<std::endl;
      varWithMeshDatasets.push_back(dataset);
    } else {
      VsLog::debugLog() <<"VsRegistry::buildDatasetObjects() - object is of unknown type!" <<std::endl;
    }
  }

  //Second pass to do all variables
  for (std::vector<VsDataset*>::const_iterator it = varDatasets.begin();
       it != varDatasets.end(); it++)  {
    VsDataset* dataset = *it;
    
    VsVariable* var = VsVariable::buildObject(dataset);
    if (var && (var->getTimeGroup() != NULL)) {
      loadTime(var->getTimeGroup());
    }
  }

  //Second pass to do all variables with mesh
  for (std::vector<VsDataset*>::const_iterator it = varWithMeshDatasets.begin();
       it != varWithMeshDatasets.end(); it++)  {
    VsDataset* dataset = *it;
    VsLog::debugLog() <<"VsRegistry::buildDatasetObjects() - looking at varWithMesh dataset " <<dataset->getFullName() <<std::endl;
    
    VsVariableWithMesh* var = VsVariableWithMesh::buildObject(dataset);
    if (var && (var->getTimeGroup() != NULL)) {
      loadTime(var->getTimeGroup());
    }
  }
  
  VsLog::debugLog() <<"VsRegistry::buildDatasetObjects() - Returning."  <<std::endl;
 }
コード例 #6
0
ファイル: unit-cache.cpp プロジェクト: facebook/hhvm
CachedUnit loadUnitNonRepoAuth(StringData* requestedPath,
                               const struct stat* statInfo,
                               OptLog& ent,
                               const Native::FuncTable& nativeFuncs,
                               const RepoOptions& options,
                               FileLoadFlags& flags) {
  LogTimer loadTime("load_ms", ent);
  if (strstr(requestedPath->data(), "://") != nullptr) {
    // URL-based units are not currently cached in memory, but the Repo still
    // caches them on disk.
    return createUnitFromUrl(requestedPath, nativeFuncs, flags);
  }

  rqtrace::EventGuard trace{"WRITE_UNIT"};

  // The string we're using as a key must be static, because we're using it as
  // a key in the cache (across requests).
  auto const path =
    makeStaticString(
      // XXX: it seems weird we have to do this even though we already ran
      // resolveVmInclude.
      (FileUtil::isAbsolutePath(requestedPath->toCppString())
       ?  String{requestedPath}
        : String(SourceRootInfo::GetCurrentSourceRoot()) + StrNR(requestedPath)
      ).get()
    );

  auto const rpath = [&] () -> const StringData* {
    if (RuntimeOption::CheckSymLink) {
      std::string rp = StatCache::realpath(path->data());
      if (rp.size() != 0) {
        if (rp.size() != path->size() ||
            memcmp(rp.data(), path->data(), rp.size())) {
          return makeStaticString(rp);
        }
      }
    }
    return path;
  }();

  Stream::Wrapper* w = nullptr;
  auto& cache = getNonRepoCache(rpath, w);

  assertx(
    !w || &cache != &s_nonRepoUnitCache ||
    !RuntimeOption::EvalUnixServerQuarantineUnits
  );

  // Freeing a unit while holding the tbb lock would cause a rank violation when
  // recycle-tc is enabled as reclaiming dead functions requires that the code
  // and metadata locks be acquired.
  Unit* releaseUnit = nullptr;
  SCOPE_EXIT { if (releaseUnit) delete releaseUnit; };

  auto const updateAndUnlock = [] (auto& cachedUnit, auto p) {
    auto old = cachedUnit.update_and_unlock(std::move(p));
    if (old) {
      // We don't need to do anything explicitly; the copy_ptr
      // destructor will take care of it.
      Treadmill::enqueue([unit_to_delete = std::move(old)] () {});
    }
  };

  auto cuptr = [&] {
    NonRepoUnitCache::const_accessor rpathAcc;

    cache.insert(rpathAcc, rpath);
    auto& cachedUnit = rpathAcc->second.cachedUnit;
    if (auto const tmp = cachedUnit.copy()) {
      if (!isChanged(tmp, statInfo, options)) {
        flags = FileLoadFlags::kHitMem;
        if (ent) ent->setStr("type", "cache_hit_readlock");
        return tmp;
      }
    }

    cachedUnit.lock_for_update();
    try {
      if (auto const tmp = cachedUnit.copy()) {
        if (!isChanged(tmp, statInfo, options)) {
          cachedUnit.unlock();
          flags = FileLoadFlags::kWaited;
          if (ent) ent->setStr("type", "cache_hit_writelock");
          return tmp;
        }
        if (ent) ent->setStr("type", "cache_stale");
      } else {
        if (ent) ent->setStr("type", "cache_miss");
      }

      trace.finish();
      auto const cu = createUnitFromFile(rpath, &releaseUnit, w, ent,
                                         nativeFuncs, options, flags);
      auto const isICE = cu.unit && cu.unit->isICE();
      auto p = copy_ptr<CachedUnitWithFree>(cu, statInfo, isICE, options);
      // Don't cache the unit if it was created in response to an internal error
      // in ExternCompiler. Such units represent transient events.
      if (UNLIKELY(isICE)) {
        cachedUnit.unlock();
        return p;
      }
      updateAndUnlock(cachedUnit, p);
      return p;
    } catch (...) {
      cachedUnit.unlock();
      throw;
    }
  }();

  auto const ret = cuptr->cu;

  if (!ret.unit || !ret.unit->isICE()) {
    if (path != rpath) {
      NonRepoUnitCache::const_accessor pathAcc;
      cache.insert(pathAcc, path);
      if (pathAcc->second.cachedUnit.get().get() != cuptr) {
        auto& cachedUnit = pathAcc->second.cachedUnit;
        cachedUnit.lock_for_update();
        updateAndUnlock(cachedUnit, std::move(cuptr));
      }
    }
  }

  return ret;
}