Esempio n. 1
0
void
MatchTableIndirectWS::groups_insert(grp_hdl_t grp)
{
  assert(grp <= group_entries.size());

  if(grp == group_entries.size()) {
    group_entries.emplace_back();
  }
  else {
    group_entries[grp] = GroupInfo();
  }

  index_ref_count.set(IndirectIndex::make_grp_index(grp), 0);
}
Esempio n. 2
0
	bool WinGroups::cache(const ustring& dom)
	{
		// Cache all groups.
		const DWORD dwLevel = 1, dwPrefMaxLen = MAX_PREFERRED_LENGTH;
		DWORD dwEntriesRead = 0, dwTotalEntries = 0;
		ULONG_PTR dwResumeHandle = 0;
		NET_API_STATUS nStatus;
		clear();
		m_dom = dom;
		do {
			PLOCALGROUP_INFO_1 info = nullptr;
			nStatus = ::NetLocalGroupEnum(m_dom.c_str(), dwLevel, (PBYTE*)&info, dwPrefMaxLen, &dwEntriesRead, &dwTotalEntries, &dwResumeHandle);
			if (NERR_Success == nStatus || ERROR_MORE_DATA == nStatus) {
				PLOCALGROUP_INFO_1 ptr = info;
				for (DWORD i = 0; i < dwEntriesRead && ptr; ++i, ++ptr) {
					push_back(GroupInfo(ptr));
				}
			}
			if (info)
				::NetApiBufferFree(info);
		} while (ERROR_MORE_DATA == nStatus);
		return (NERR_Success == nStatus);
	}
void ClangCodeCompletionModel::completionInvoked(
    KTextEditor::View* const view
  , const KTextEditor::Range& range
  , const InvocationType /*invocationType*/
  )
{
    m_current_view = view;
    auto* const doc = view->document();
    const auto& url = doc->url();
    if (!url.isValid() || url.isEmpty())
    {
        /// \todo Turn into a popup
        kWarning() << "U have to have a document on a disk before use code completion";
        return;
    }
    kDebug(DEBUG_AREA) << "Comletion requested at " << range << "for" << doc->text(range);

    // Remove everything collected before
    m_groups.clear();

    try
    {
        auto& unit = m_plugin->getTranslationUnitByDocument(doc);
        // Show some SPAM in a tool view
        m_diagnostic_model.append(
            clang::diagnostic_message{
                clang::location{doc->url(), range.start().line() + 1, range.start().column() + 1}
              , "Completion point"
              , clang::diagnostic_message::type::debug
              }
          );
        // Obtain diagnostic if any
        {
            auto diag = unit.getLastDiagnostic();
            if (!diag.empty())
                m_diagnostic_model.append(
                    std::make_move_iterator(begin(diag))
                  , std::make_move_iterator(end(diag))
                  );
        }
        // Try to make a completion
        auto completions = unit.completeAt(
            unsigned(range.start().line() + 1)              // NOTE Kate count lines starting from 0
          , unsigned(range.start().column() + 1)            // NOTE Kate count columns starting from 0
          , m_plugin->config().completionFlags()
          , m_plugin->unsavedFiles()
          , m_plugin->config().sanitizeCompletions()
              ? m_plugin->config().sanitizeRules()
              : PluginConfiguration::sanitize_rules_list_type()
          );
        // Obtain diagnostic if any
        {
            auto diag = unit.getLastDiagnostic();
            if (!diag.empty())
                m_diagnostic_model.append(
                    std::make_move_iterator(begin(diag))
                  , std::make_move_iterator(end(diag))
                  );
        }

        // Transform a plain list into hierarchy grouped by a parent context
        std::map<QString, GroupInfo> grouped_completions;
        for (auto&& comp : completions)
        {
            // Find a group for current item
            auto it = grouped_completions.find(comp.parentText());
            if (it == end(grouped_completions))
            {
                // No group yet, let create a new one
                it = grouped_completions.insert(std::make_pair(comp.parentText(), GroupInfo())).first;
            }
            // Add a current item to the list of completions in the current group
            it->second.m_completions.emplace_back(std::move(comp));
        }
        // Convert the collected map to a vector
        m_groups.reserve(grouped_completions.size());
        std::transform(
            std::make_move_iterator(begin(grouped_completions))
          , std::make_move_iterator(end(grouped_completions))
          , std::back_inserter(m_groups)
          , [](std::pair<const QString, GroupInfo>&& p) { return std::move(p); }
          );
    }
    catch (const TranslationUnit::Exception& e)
    {
        m_diagnostic_model.append(
            clang::diagnostic_message(
                QString("Fail to make a code completion: %1").arg(e.what())
              , clang::diagnostic_message::type::error
              )
          );
    }
}
Esempio n. 4
0
 void RunContext::testGroupEnded(std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount) {
     m_reporter->testGroupEnded(TestGroupStats(GroupInfo(testSpec, groupIndex, groupsCount), totals, aborting()));
 }
 void testGroupStarting( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount ) {
     m_reporter->testGroupStarting( GroupInfo( testSpec, groupIndex, groupsCount ) );
 }
void PipelineComposer::composeViewport(Viewport *port)
{
    // setup viewport
    GLint 
        pl=port->calcPixelLeft(), 
        pr=port->calcPixelRight(),
        pb=port->calcPixelBottom(), 
        pt=port->calcPixelTop();
    GLint pw=pr-pl+1,ph=pt-pb+1;
    bool full = port->calcIsFullWindow();
    glViewport(pl, pb, pw, ph);
    glScissor(pl, pb, pw, ph);
    if(! full)
        glEnable(GL_SCISSOR_TEST);

    GLboolean depth = glIsEnabled(GL_DEPTH_TEST);
    GLboolean blend = glIsEnabled(GL_BLEND);

//    glDisable(GL_DEPTH_TEST);
    glPushMatrix();
    glLoadIdentity();
    glMatrixMode(GL_PROJECTION);
    glPushMatrix();
    glLoadIdentity();
    glOrtho(0, port->calcPixelWidth(),
            0, port->calcPixelHeight(),-1,1);
    if(getAlpha())
    {
        glEnable(GL_BLEND);
        glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
    }

    // only one buffer for the client
    if(isClient())
        _composeTilePtr = _readTilePtr;

    _readTilesX = (port->calcPixelWidth()  - 1) / getTileSize() + 1;
    _readTilesY = (port->calcPixelHeight() - 1) / getTileSize() + 1;

    _tileBufferSize = getTileSize()*getTileSize()*8+sizeof(TileBuffer);
    _workingTile.resize(_tileBufferSize);

    // resize
    _readTilePtr->resize(_tileBufferSize * _readTilesX * _readTilesY);

    if(isClient())
    {
        while(_groupInfo.size() < serverCount())
        {
            _groupInfoPool.push_back(GroupInfo());
            _groupInfo.push_back(&(*_groupInfoPool.rbegin()));
        }
        _groupInfo.resize(serverCount());
    }
    
    _statistics.bytesIn  = 0;
    _statistics.bytesOut = 0;
    _statistics.occluded = 0;
    _statistics.noDepth  = 0;
    _statistics.noGeo    = 0;
    _statistics.clipped  = 0;

    if(!getPipelined())
    {
        _composeTilesX  = _readTilesX;
        _composeTilesY  = _readTilesY;
    }
    if(getShort())
    {
        UInt16 colorDummy;
//        UInt16 depthDummy;
        UInt32 depthDummy;
//        _depthType   = GL_UNSIGNED_SHORT;
        _depthType   = GL_UNSIGNED_INT;
        _colorFormat = GL_RGB;
        _colorType   = GL_UNSIGNED_SHORT_5_6_5;
        
        readBuffer(depthDummy,colorDummy,port);
        if(!getPipelined() || isClient())
            composeBuffer(depthDummy,colorDummy);
    }
    else
    {
        if(getAlpha())
        {
            UInt32 colorDummy;
            UInt32 depthDummy;
            _depthType   = GL_UNSIGNED_INT;
            _colorFormat = GL_RGBA;
            _colorType   = GL_UNSIGNED_BYTE;
            readBuffer(depthDummy,colorDummy,port);
            if(!getPipelined() || isClient())
                composeBuffer(depthDummy,colorDummy);
        }
        else
        {
            RGBValue colorDummy;
            UInt32   depthDummy;
            _depthType   = GL_UNSIGNED_INT;
            _colorFormat = GL_RGB;
            _colorType   = GL_UNSIGNED_BYTE;
            readBuffer(depthDummy,colorDummy,port);
            if(!getPipelined() || isClient())
                composeBuffer(depthDummy,colorDummy);
        }
    }

    if(getStatistics())
    {
        if(isClient())
        {
            double      pixelReadTime = 0;
            double      sortTime      = 0;
            UInt32      maxIn      = _statistics.bytesIn;
            UInt32      maxOut     = _statistics.bytesOut;
            UInt32      maxIO      = maxIn + maxOut;
            UInt32      sumOut     = _statistics.bytesOut;
            UInt32      clipped    = 0;
            Connection::Channel channel;
            GroupConnection *server;
            Statistics  statistics;
            server = clusterWindow()->getNetwork()->getMainGroupConnection();
            for(UInt32 i=0 ; i<serverCount() ;++i)
            {
                channel = server->selectChannel();
                server->subSelection(channel);
                server->get(&statistics,sizeof(Statistics));
                sumOut += statistics.bytesOut;
                if(statistics.pixelReadTime > pixelReadTime) {
                    pixelReadTime = statistics.pixelReadTime;
                    sortTime = statistics.sortTime;
                }
                if(statistics.bytesOut > maxOut)
                    maxOut = statistics.bytesOut;
                if(statistics.bytesIn > maxIn)
                    maxIn = statistics.bytesIn;
                if(statistics.bytesIn + statistics.bytesOut > maxIO)
                    maxIO = statistics.bytesIn + statistics.bytesOut;
                clipped += statistics.clipped;
            }
            server->resetSelection();
            printf("pixel read time  : %1.5lf\n",pixelReadTime);
            printf("sort Time        : %1.5lf\n",sortTime);
            printf("compose Time     : %1.5lf\n",_statistics.composeTime);
            printf("Transfered bytes : %10d\n",sumOut);
            printf("Max out          : %10d\n",maxOut);
            printf("Max in           : %10d\n",maxIn);
            printf("Max io           : %10d\n",maxIO);
            printf("occluded         : %10d\n",_statistics.occluded);
            printf("Layerd           : %10d\n",_statistics.noDepth);
            printf("Empty            : %10d\n",_statistics.noGeo-clipped);
            printf("Clipped          : %10d\n",clipped);
            printf("DepthAndColor    : %10d\n",serverCount()*_composeTilesX*_composeTilesY-
                   _statistics.occluded-
                   _statistics.noDepth-
                   _statistics.noGeo);
        }
        else
        {
            Connection *client = clusterWindow()->getNetwork()->getMainConnection();
            client->put(&_statistics,sizeof(Statistics));
            client->flush();
        }
    }

    glPopMatrix();
    glMatrixMode(GL_MODELVIEW);
    glPopMatrix();
    glEnable(GL_DEPTH_TEST);

    // reset state
    if(depth && !glIsEnabled(GL_DEPTH_TEST))
        glEnable(GL_DEPTH_TEST);
    if(!blend && glIsEnabled(GL_BLEND))
        glDisable(GL_BLEND);
}
Esempio n. 7
0
void VMSummary::UpdateGroupInfo(s32 _iMajorID, s32 _iMinorID, s32 _iMaxGroup, const GroupUpdateParam& _pUpdateParam)
{
	std::stringstream ss;
	ss << "RP(" << _iMajorID << ", " << _iMinorID << ")";
	GroupInfoMapIterator it = m_GroupInfoMap.find(ss.str());
	if(it == m_GroupInfoMap.end())
	{
		if(_pUpdateParam.m_AddorRemove)
		{
			it = m_GroupInfoMap.insert(std::pair<GroupName, GroupInfo>(ss.str(), GroupInfo())).first;
		}
		else
		{
			return;
		}
	}
	GroupInfo& info = (*it).second;
	s32 myGroup = _pUpdateParam.m_MyGroup;
	if(_pUpdateParam.m_AddorRemove)
	{
		if(_iMaxGroup != info.m_Groups.size())
		{
			info.m_Groups.resize(_iMaxGroup);

			std::string name = ss.str();
			Event evt((EventType_t)E_ET_GroupSizeChanged);
			evt.AddParam(name.c_str());
			GameEngine::GetGameEngine()->GetEventMod()->SendEvent(&evt);
		}
		if(myGroup >= 0 && myGroup < _iMaxGroup)
		{
			info.m_TotalVups++;

			GroupInfoData& data = info.m_Groups[myGroup];
			data.m_iCurVUPsInGroup++;
			data.m_iMaxVUPsInGroup = _pUpdateParam.m_MaxNumberInGroup;
			data.m_VUPsPassport.push_back(_pUpdateParam.m_VUPsPassport);
		}
	}
	else
	{
		if(myGroup >= 0 && myGroup < info.m_Groups.size())
		{
			GroupInfoData& data = info.m_Groups[myGroup];
			data.m_iCurVUPsInGroup--;
			//data.m_iMaxVUPsInGroup = _pUpdateParam.m_MaxNumberInGroup;
			std::deque<UDTSOCKET>::iterator itPassport = find(data.m_VUPsPassport.begin(), data.m_VUPsPassport.end(), _pUpdateParam.m_VUPsPassport);
			if(itPassport != data.m_VUPsPassport.end())
			{
				data.m_VUPsPassport.erase(itPassport);
			}
			info.m_TotalVups--;
		}
		if(!info.m_TotalVups)
		{
			m_GroupInfoMap.erase(it);

			std::string name = ss.str();
			Event evt((EventType_t)E_ET_GroupSizeChanged);
			evt.AddParam(name.c_str());
			GameEngine::GetGameEngine()->GetEventMod()->SendEvent(&evt);
		}
	}
}