示例#1
0
文件: simi.c 项目: TronicLabs/sdcc
/*-----------------------------------------------------------------*/
void simReset (void)
{
  invalidateCache(XMEM_CACHE);
  invalidateCache(IMEM_CACHE);
  invalidateCache(SREG_CACHE);
  sendSim("res\n");
  waitForSim(100, NULL);
}
示例#2
0
void QNetworkAccessHttpBackend::postRequest()
{
    bool loadedFromCache = false;
    QHttpNetworkRequest httpRequest;
    switch (operation()) {
    case QNetworkAccessManager::GetOperation:
        httpRequest.setOperation(QHttpNetworkRequest::Get);
        validateCache(httpRequest, loadedFromCache);
        break;

    case QNetworkAccessManager::HeadOperation:
        httpRequest.setOperation(QHttpNetworkRequest::Head);
        validateCache(httpRequest, loadedFromCache);
        break;

    case QNetworkAccessManager::PostOperation:
        invalidateCache();
        httpRequest.setOperation(QHttpNetworkRequest::Post);
        uploadDevice = new QNetworkAccessHttpBackendIODevice(this);
        break;

    case QNetworkAccessManager::PutOperation:
        invalidateCache();
        httpRequest.setOperation(QHttpNetworkRequest::Put);
        uploadDevice = new QNetworkAccessHttpBackendIODevice(this);
        break;

    default:
        break;                  // can't happen
    }

    httpRequest.setData(uploadDevice);
    httpRequest.setUrl(url());

    QList<QByteArray> headers = request().rawHeaderList();
    foreach (const QByteArray &header, headers)
        httpRequest.setHeaderField(header, request().rawHeader(header));

    if (loadedFromCache) {
        QNetworkAccessBackend::finished();
        return;    // no need to send the request! :)
    }

    httpReply = http->sendRequest(httpRequest);
    httpReply->setParent(this);
#ifndef QT_NO_OPENSSL
    if (pendingSslConfiguration)
        httpReply->setSslConfiguration(*pendingSslConfiguration);
    if (pendingIgnoreSslErrors)
        httpReply->ignoreSslErrors();
#endif

    connect(httpReply, SIGNAL(readyRead()), SLOT(replyReadyRead()));
    connect(httpReply, SIGNAL(finished()), SLOT(replyFinished()));
    connect(httpReply, SIGNAL(finishedWithError(QNetworkReply::NetworkError,QString)),
            SLOT(httpError(QNetworkReply::NetworkError,QString)));
    connect(httpReply, SIGNAL(headerChanged()), SLOT(replyHeaderChanged()));
}
示例#3
0
/*!
  \brief Set the color of the symbol

  Change the color of the brush for symbol types with a filled area.
  For all other symbol types the color will be assigned to the pen.

  \param color Color

  \sa setBrush(), setPen(), brush(), pen()
*/
void QwtSymbol::setColor( const QColor &color )
{
    switch ( d_data->style )
    {
        case QwtSymbol::Ellipse:
        case QwtSymbol::Rect:
        case QwtSymbol::Diamond:
        case QwtSymbol::Triangle:
        case QwtSymbol::UTriangle:
        case QwtSymbol::DTriangle:
        case QwtSymbol::RTriangle:
        case QwtSymbol::LTriangle:
        case QwtSymbol::Star2:
        case QwtSymbol::Hexagon:
        {
            if ( d_data->brush.color() != color )
            {
                d_data->brush.setColor( color );
                invalidateCache();
            }
            break;
        }
        case QwtSymbol::Cross:
        case QwtSymbol::XCross:
        case QwtSymbol::HLine:
        case QwtSymbol::VLine:
        case QwtSymbol::Star1:
        {
            if ( d_data->pen.color() != color )
            {
                d_data->pen.setColor( color );
                invalidateCache();
            }
            break;
        }
        default:
        {
            if ( d_data->brush.color() != color ||
                d_data->pen.color() != color )
            {
                invalidateCache();
            }

            d_data->brush.setColor( color );
            d_data->pen.setColor( color );
        }
    }
}
void stNaiveConnectivity_addEdge(stNaiveConnectivity *connectivity, void *node1, void *node2) {
    invalidateCache(connectivity);

    struct adjacency *newEdge1 = malloc(sizeof(struct adjacency));
    struct adjacency *newEdge2 = malloc(sizeof(struct adjacency));
    newEdge1->toNode = node2;
    newEdge2->toNode = node1;
    newEdge1->inverse = newEdge2;
    newEdge2->inverse = newEdge1;
    newEdge1->prev = NULL;
    newEdge2->prev = NULL;

    struct adjacency *adjList1 = stHash_search(connectivity->nodesToAdjList, node1);
    if (adjList1 == NULL) {
        newEdge1->next = NULL;
    } else {
        newEdge1->next = adjList1;
        adjList1->prev = newEdge1;
    }
    stHash_remove(connectivity->nodesToAdjList, node1);
    stHash_insert(connectivity->nodesToAdjList, node1, newEdge1);

    struct adjacency *adjList2 = stHash_search(connectivity->nodesToAdjList, node2);
    if (adjList2 == NULL) {
        newEdge2->next = NULL;
    } else {
        newEdge2->next = adjList2;
        adjList2->prev = newEdge2;
    }
    stHash_remove(connectivity->nodesToAdjList, node2);
    stHash_insert(connectivity->nodesToAdjList, node2, newEdge2);
}
NABoolean NAList<T>::getLast(T &elem)
{
  if (this->entries() > 0)
    {
      // copy last element
      elem = this->usedEntry(last_);

      // remove the last element from the list
      NACollection<T>::remove(last_);

      // fix up the list pointers
      if (first_ == last_)
	first_ = last_ = NULL_COLL_INDEX;
      else
	{
	  last_ = this->findUsage(last_);
	  this->setUsage(last_, NULL_COLL_INDEX);
	}

      // invalidate the cache, if necessary
      if (userIndexCache_ >= this->entries())
	invalidateCache();

      return TRUE;
    }
  else
    return FALSE;
}
示例#6
0
void AreaStore::setCacheParams(bool enabled, u8 block_radius, size_t limit)
{
	m_cache_enabled = enabled;
	m_cacheblock_radius = MYMAX(block_radius, 16);
	m_res_cache.setLimit(MYMAX(limit, 20));
	invalidateCache();
}
示例#7
0
文件: simi.c 项目: TronicLabs/sdcc
int simSetValue (unsigned int addr,char mem, unsigned int size, unsigned long val)
{
  unsigned int i;
  char cachenr;
  char buffer[40];
  char *s;

  if ( size <= 0 )
      return 0;

  cachenr = getMemString(buffer, 1, &addr, mem, size);
  if ( cachenr < NMEM_CACHE )
    {
      invalidateCache(cachenr);
    }
  s = buffer + strlen(buffer) -1;
  for ( i = 0 ; i < size ; i++ )
    {
      sprintf(s," 0x%lx", val & 0xff);
      s += strlen(s);
      val >>= 8;
    }
  sprintf(s,"\n");
  sendSim(buffer);
  waitForSim(100,NULL);
  simResponse();
  return 0;
}
示例#8
0
/*!
  Specify the symbol style

  \param style Style
  \sa style()
*/
void QwtSymbol::setStyle( QwtSymbol::Style style )
{
    if ( d_data->style != style )
    {
        d_data->style = style;
        invalidateCache();
    }
}
示例#9
0
/*!
  En/Disable the pin point alignment

  \param on Enabled, when on is true
  \sa setPinPoint(), isPinPointEnabled()
 */
void QwtSymbol::setPinPointEnabled( bool on )
{
    if ( d_data->isPinPointEnabled != on )
    {
        d_data->isPinPointEnabled = on;
        invalidateCache();
    }
}
示例#10
0
/*!
   Set the symbol's size
   \param size Size

   \sa size()
*/
void QwtSymbol::setSize( const QSize &size )
{
    if ( size.isValid() && size != d_data->size )
    {
        d_data->size = size;
        invalidateCache();
    }
}
示例#11
0
/*!
  Change the cache policy

  The default policy is AutoCache

  \param policy Cache policy
  \sa CachePolicy, cachePolicy()
*/
void QwtSymbol::setCachePolicy(
    QwtSymbol::CachePolicy policy )
{
    if ( d_data->cache.policy != policy )
    {
        d_data->cache.policy = policy;
        invalidateCache();
    }
}
示例#12
0
/*!
  Set the text 

  The label will be aligned to the plot canvas according to
  the alignment flags of text.

  \param text Text to be displayed

  \sa text(), QwtText::renderFlags()
*/
void QwtPlotTextLabel::setText( const QwtText &text )
{
    if ( d_data->text != text )
    {
        d_data->text = text;

        invalidateCache();
        itemChanged();
    }
}
void ThermoPhase::resetHf298(size_t k) {
    if (k != npos) {
        m_spthermo->resetHf298(k);
    } else {
        for (size_t k = 0; k < nSpecies(); k++) {
            m_spthermo->resetHf298(k);
        }
    }
    invalidateCache();
}
示例#14
0
/*!
  Assign a pen

  The pen is used to draw the symbol's outline.

  \param pen Pen
  \sa pen(), setBrush()
*/
void QwtSymbol::setPen( const QPen &pen )
{
    if ( pen != d_data->pen )
    {
        d_data->pen = pen;
        invalidateCache();

        if ( d_data->style == QwtSymbol::Path )
            d_data->path.graphic.reset();
    }
}
示例#15
0
/*!
  \brief Assign a brush

  The brush is used to draw the interior of the symbol.
  \param brush Brush

  \sa brush()
*/
void QwtSymbol::setBrush( const QBrush &brush )
{
    if ( brush != d_data->brush )
    {
        d_data->brush = brush;
        invalidateCache();

        if ( d_data->style == QwtSymbol::Path )
            d_data->path.graphic.reset();
    }
}
示例#16
0
/*!
  Change the color map

  Often it is useful to display the mapping between intensities and
  colors as an additional plot axis, showing a color bar.

  \param colorMap Color Map

  \sa colorMap(), QwtScaleWidget::setColorBarEnabled(),
      QwtScaleWidget::setColorMap()
*/
void QwtPlotSpectrogram::setColorMap( QwtColorMap *colorMap )
{
    if ( d_data->colorMap != colorMap )
    {
        delete d_data->colorMap;
        d_data->colorMap = colorMap;
    }

    invalidateCache();
    itemChanged();
}
示例#17
0
void Kinetics::resizeSpecies()
{
    m_kk = 0;
    m_start.resize(nPhases());

    for (size_t i = 0; i < m_thermo.size(); i++) {
        m_start[i] = m_kk; // global index of first species of phase i
        m_kk += m_thermo[i]->nSpecies();
    }
    invalidateCache();
}
示例#18
0
/*!
  Set the data to be displayed

  \param data Spectrogram Data
  \sa data()
*/
void QwtPlotSpectrogram::setData( QwtRasterData *data )
{
    if ( data != d_data->data )
    {
        delete d_data->data;
        d_data->data = data;

        invalidateCache();
        itemChanged();
    }
}
示例#19
0
/*!
  Change the cache policy

  The default policy is NoCache

  \param policy Cache policy
  \sa CachePolicy, cachePolicy()
*/
void QwtPlotRasterItem::setCachePolicy(
    QwtPlotRasterItem::CachePolicy policy )
{
    if ( d_data->cache.policy != policy )
    {
        d_data->cache.policy = policy;

        invalidateCache();
        itemChanged();
    }
}
示例#20
0
bool SpatialAreaStore::insertArea(Area *a)
{
	if (a->id == U32_MAX)
		a->id = getNextId();
	if (!areas_map.insert(std::make_pair(a->id, *a)).second)
		// ID is not unique
		return false;
	m_tree->insertData(0, nullptr, get_spatial_region(a->minedge, a->maxedge), a->id);
	invalidateCache();
	return true;
}
void LatticeSolidPhase::modifyOneHf298SS(const size_t k, const doublereal Hf298New)
{
    for (size_t n = 0; n < m_lattice.size(); n++) {
        if (lkstart_[n+1] < k) {
            size_t kk = k-lkstart_[n];
            MultiSpeciesThermo& l_spthermo = m_lattice[n]->speciesThermo();
            l_spthermo.modifyOneHf298(kk, Hf298New);
        }
    }
    invalidateCache();
    _updateThermo();
}
示例#22
0
bool VectorAreaStore::insertArea(Area *a)
{
	if (a->id == U32_MAX)
		a->id = getNextId();
	std::pair<AreaMap::iterator, bool> res =
			areas_map.insert(std::make_pair(a->id, *a));
	if (!res.second)
		// ID is not unique
		return false;
	m_areas.push_back(&res.first->second);
	invalidateCache();
	return true;
}
示例#23
0
/*!
  \brief Set and enable a pin point

  The position of a complex symbol is not always aligned to its center
  ( f.e an arrow, where the peak points to a position ). The pin point
  defines the position inside of a Pixmap, Graphic, SvgDocument 
  or PainterPath symbol where the represented point has to
  be aligned to.
  
  \param pos Position
  \param enable En/Disable the pin point alignment

  \sa pinPoint(), setPinPointEnabled()
 */
void QwtSymbol::setPinPoint( const QPointF &pos, bool enable )
{
    if ( d_data->pinPoint != pos )
    {
        d_data->pinPoint = pos;
        if ( d_data->isPinPointEnabled )
        {
            invalidateCache();
        }
    }

    setPinPointEnabled( enable );
}
void stNaiveConnectivity_removeNode(stNaiveConnectivity *connectivity, void *node) {
    invalidateCache(connectivity);

    struct adjacency *adjList = stHash_search(connectivity->nodesToAdjList, node);

    while (adjList != NULL) {
        struct adjacency *next = adjList->next; // Have to do this beforehand -- adjList will be freed by next line!
        stNaiveConnectivity_removeEdge(connectivity, node, adjList->toNode);
        adjList = next;
    }

    stHash_remove(connectivity->nodesToAdjList, node);
}
示例#25
0
bool SpatialAreaStore::removeArea(u32 id)
{
	std::map<u32, Area>::iterator itr = areas_map.find(id);
	if (itr != areas_map.end()) {
		Area *a = &itr->second;
		bool result = m_tree->deleteData(get_spatial_region(a->minedge,
			a->maxedge), id);
		areas_map.erase(itr);
		invalidateCache();
		return result;
	} else {
		return false;
	}
}
// Remove and free an edge properly.
static void removeEdgeFromAdjList(stNaiveConnectivity *connectivity, void *node, struct adjacency *adj) {
    invalidateCache(connectivity);

    if (adj->next != NULL) {
        adj->next->prev = adj->prev;
    }

    if (adj->prev != NULL) {
        adj->prev->next = adj->next;
    } else {
        stHash_remove(connectivity->nodesToAdjList, node);
        stHash_insert(connectivity->nodesToAdjList, node, adj->next);
    }
    free(adj);
}
示例#27
0
void Phase::modifySpecies(size_t k, shared_ptr<Species> spec)
{
    if (speciesName(k) != spec->name) {
        throw CanteraError("Phase::modifySpecies",
            "New species name '{}' does not match existing name '{}'",
                           spec->name, speciesName(k));
    }
    const shared_ptr<Species>& old = m_species[spec->name];
    if (spec->composition != old->composition) {
        throw CanteraError("Phase::modifySpecies",
            "New composition for '{}' does not match existing composition",
            spec->name);
    }
    m_species[spec->name] = spec;
    invalidateCache();
}
示例#28
0
void Clock::constraintsEvent(Plasma::Constraints constraints)
{
    ClockApplet::constraintsEvent(constraints);

    if (constraints & Plasma::SizeConstraint) {
        invalidateCache();
    }

    if (constraints & Plasma::FormFactorConstraint) {
        if (formFactor() == Plasma::Planar || formFactor() == Plasma::MediaCenter) {
            setPreferredSize(256, 256);
        } else {
            setPreferredSize(-1, -1);
        }
    }
}
void LatticeSolidPhase::resetHf298(const size_t k)
{
    if (k != npos) {
        for (size_t n = 0; n < m_lattice.size(); n++) {
            if (lkstart_[n+1] < k) {
                size_t kk = k-lkstart_[n];
                m_lattice[n]->speciesThermo().resetHf298(kk);
            }
        }
    } else {
        for (size_t n = 0; n < m_lattice.size(); n++) {
            m_lattice[n]->speciesThermo().resetHf298(npos);
        }
    }
    invalidateCache();
    _updateThermo();
}
示例#30
0
bool VectorAreaStore::removeArea(u32 id)
{
	AreaMap::iterator it = areas_map.find(id);
	if (it == areas_map.end())
		return false;
	Area *a = &it->second;
	for (std::vector<Area *>::iterator v_it = m_areas.begin();
			v_it != m_areas.end(); ++v_it) {
		if (*v_it == a) {
			m_areas.erase(v_it);
			break;
		}
	}
	areas_map.erase(it);
	invalidateCache();
	return true;
}