Example #1
0
void CollectVariables::visitVariable(const TIntermSymbol *variable,
                                     std::vector<InterfaceBlock> *infoList) const
{
    InterfaceBlock interfaceBlock;
    const TInterfaceBlock *blockType = variable->getType().getInterfaceBlock();
    ASSERT(blockType);

    interfaceBlock.name = blockType->name().c_str();
    interfaceBlock.mappedName = TIntermTraverser::hash(variable->getSymbol(), mHashFunction).c_str();
    interfaceBlock.instanceName = (blockType->hasInstanceName() ? blockType->instanceName().c_str() : "");
    interfaceBlock.arraySize = variable->getArraySize();
    interfaceBlock.isRowMajorLayout = (blockType->matrixPacking() == EmpRowMajor);
    interfaceBlock.layout = GetBlockLayoutType(blockType->blockStorage());

    // Gather field information
    const TFieldList &fieldList = blockType->fields();

    for (size_t fieldIndex = 0; fieldIndex < fieldList.size(); ++fieldIndex)
    {
        const TField &field = *fieldList[fieldIndex];
        const TString &fullFieldName = InterfaceBlockFieldName(*blockType, field);
        const TType &fieldType = *field.type();

        GetVariableTraverser traverser(mSymbolTable);
        traverser.traverse(fieldType, fullFieldName, &interfaceBlock.fields);

        interfaceBlock.fields.back().isRowMajorLayout = (fieldType.getLayoutQualifier().matrixPacking == EmpRowMajor);
    }

    infoList->push_back(interfaceBlock);
}
Example #2
0
void ArcApp::MakeFileList(NameMap& files)
{
    DirTraverser traverser(files, *m_factory);

    for (size_t i = 0; i < m_args.size(); ++i) {
#ifndef __WXMSW__
        wxString name = m_args[i];
#else
        // on Windows expand wildcards
        wxString name = wxFindFirstFile(m_args[i], 0);
        if (name.empty())
            wxLogError(_T("file not found '%s'"), m_args[i].c_str());
        while (!name.empty()) {
#endif
            // if the name is a directory recursively add all it's contents
            if (wxDirExists(name)) {
                if (traverser.OnDir(name) == wxDIR_CONTINUE) {
                    wxDir dir(name);
                    if (dir.IsOpened())
                        dir.Traverse(traverser);
                }
            } else {
                traverser.OnFile(name);
            }
#ifdef __WXMSW__
            name = wxFindNextFile();
        }
#endif
    }

    if (files.empty())
        wxLogWarning(_T("nothing to do"));
}
bool EditorConfig::Load()
{
	m_fileName = wxFileName(wxT("config/liteeditor.xml"));
	m_fileName.MakeAbsolute();

	if(!m_fileName.FileExists()){
		//create a new empty file with this name so the load function will not 
		//fail
		wxFFile file(m_fileName.GetFullPath(), wxT("a"));
		if(file.IsOpened()){
			file.Close();
		}
	} // if(!m_fileName.FileExists())

	//load the main configuration file
	if(!m_doc->Load(m_fileName.GetFullPath())){
		return false;
	}
	//load all lexer configuration files
	DirTraverser traverser(wxT("*.xml"));
	wxDir dir(wxT("lexers/"));
	dir.Traverse(traverser);

	wxArrayString files = traverser.GetFiles();
	m_lexers.clear();
	for(size_t i=0; i<files.GetCount(); i++){
		LexerConfPtr lexer(new LexerConf(files.Item(i)));
		m_lexers[lexer->GetName()] = lexer;
	}
	return true;
}
void EmulateGLFragColorBroadcast(TIntermBlock *root,
                                 int maxDrawBuffers,
                                 std::vector<sh::OutputVariable> *outputVariables,
                                 TSymbolTable *symbolTable,
                                 int shaderVersion)
{
    ASSERT(maxDrawBuffers > 1);
    GLFragColorBroadcastTraverser traverser(maxDrawBuffers, symbolTable, shaderVersion);
    root->traverse(&traverser);
    if (traverser.isGLFragColorUsed())
    {
        traverser.updateTree();
        traverser.broadcastGLFragColor(root);
        for (auto &var : *outputVariables)
        {
            if (var.name == "gl_FragColor")
            {
                // TODO(zmo): Find a way to keep the original variable information.
                var.name       = "gl_FragData";
                var.mappedName = "gl_FragData";
                var.arraySize  = maxDrawBuffers;
            }
        }
    }
}
Example #5
0
    void execute(const FutureMap& input, PromiseMap& output) const
    {
        const UniqueFutureMap uniqueInputs(input.getFutures());

        const auto& frustum = uniqueInputs.get<Frustum>("Frustum");
        const auto& frame = uniqueInputs.get<uint32_t>("Frame");
        const auto& range = uniqueInputs.get<Range>("DataRange");
        const auto& params =
            uniqueInputs.get<VolumeRendererParameters>("Params");
        const auto& vp = uniqueInputs.get<PixelViewport>("Viewport");
        const auto& clipPlanes = uniqueInputs.get<ClipPlanes>("ClipPlanes");

        const uint32_t windowHeight = vp[3];
        const float sse = params.getScreenSpaceError();
        const uint32_t minLOD = params.getMinLod();
        const uint32_t maxLOD =
            std::min(params.getMaxLod(),
                     _dataSource.getVolumeInfo().rootNode.getDepth() - 1);

        SelectVisibles visitor(frustum, windowHeight, sse, minLOD, maxLOD,
                               range, clipPlanes);

        DFSTraversal traverser(_dataSource);
        traverser.traverse(visitor, frame);

        output.set("VisibleNodes", visitor.getVisibles());
        output.set("Params", params);
    }
void* SystemHeadersThread::Entry()
{
    wxArrayString dirs;
    {
        wxCriticalSectionLocker locker(*m_SystemHeadersThreadCS);
        for (size_t i=0; i<m_IncludeDirs.GetCount(); ++i)
        {
            if (m_SystemHeadersMap.find(m_IncludeDirs[i]) == m_SystemHeadersMap.end())
            {
                dirs.Add(m_IncludeDirs[i]);
                m_SystemHeadersMap[m_IncludeDirs[i]] = StringSet();
            }
        }
    }
    // collect header files in each dir, this is done by HeaderDirTraverser
    for (size_t i=0; i<dirs.GetCount(); ++i)
    {
        if ( TestDestroy() )
            break;

        // check the dir is ready for traversing
        wxDir dir(dirs[i]);
        if ( !dir.IsOpened() )
        {
            CodeBlocksThreadEvent evt(wxEVT_COMMAND_MENU_SELECTED, idSystemHeadersThreadError);
            evt.SetClientData(this);
            evt.SetString(wxString::Format(_T("SystemHeadersThread: Unable to open: %s"), dirs[i].wx_str()));
            wxPostEvent(m_Parent, evt);
            continue;
        }

        TRACE(_T("SystemHeadersThread: Launching dir traverser for: %s"), dirs[i].wx_str());

        HeaderDirTraverser traverser(this, m_SystemHeadersThreadCS, m_SystemHeadersMap, dirs[i]);
        dir.Traverse(traverser, wxEmptyString, wxDIR_FILES | wxDIR_DIRS);

        TRACE(_T("SystemHeadersThread: Dir traverser finished for: %s"), dirs[i].wx_str());

        if ( TestDestroy() )
            break;

        CodeBlocksThreadEvent evt(wxEVT_COMMAND_MENU_SELECTED, idSystemHeadersThreadUpdate);
        evt.SetClientData(this);
        evt.SetString(wxString::Format(_T("SystemHeadersThread: %s , %lu"), dirs[i].wx_str(), static_cast<unsigned long>(m_SystemHeadersMap[dirs[i]].size())));
        wxPostEvent(m_Parent, evt);
    }

    if ( !TestDestroy() )
    {
        CodeBlocksThreadEvent evt(wxEVT_COMMAND_MENU_SELECTED, idSystemHeadersThreadFinish);
        evt.SetClientData(this);
        if (!dirs.IsEmpty())
            evt.SetString(wxString::Format(_T("SystemHeadersThread: Total number of paths: %lu"), static_cast<unsigned long>(dirs.GetCount())));
        wxPostEvent(m_Parent, evt);
    }

    TRACE(_T("SystemHeadersThread: Done."));

    return NULL;
}
Example #7
0
void SearchThread::GetFiles(const SearchData* data, wxArrayString& files)
{
    std::set<wxString> scannedFiles;

    const wxArrayString& rootDirs = data->GetRootDirs();
    files = data->GetFiles();

    // Remove files that do not match our search criteria
    FilterFiles(files, data);

    // Populate "scannedFiles" with list of files to scan
    scannedFiles.insert(files.begin(), files.end());

    for(size_t i = 0; i < rootDirs.size(); ++i) {
        // make sure it's really a dir (not a fifo, etc.)
        DirTraverser traverser(data->GetExtensions());
        wxDir dir(rootDirs.Item(i));
        dir.Traverse(traverser);
        wxArrayString& someFiles = traverser.GetFiles();

        for(size_t j = 0; j < someFiles.Count(); ++j) {
            if(scannedFiles.count(someFiles.Item(j)) == 0) {
                files.Add(someFiles.Item(j));
                scannedFiles.insert(someFiles.Item(j));
            }
        }
    }

    files.clear();
    std::for_each(scannedFiles.begin(), scannedFiles.end(), [&](const wxString& file) { files.Add(file); });
}
void SimplifyLoopConditions(TIntermNode *root,
                            unsigned int conditionsToSimplifyMask,
                            TSymbolTable *symbolTable)
{
    SimplifyLoopConditionsTraverser traverser(conditionsToSimplifyMask, symbolTable);
    root->traverse(&traverser);
    traverser.updateTree();
}
void RewriteAtomicFunctionExpressions(TIntermNode *root,
                                      TSymbolTable *symbolTable,
                                      int shaderVersion)
{
    RewriteAtomicFunctionExpressionsTraverser traverser(symbolTable, shaderVersion);
    traverser.traverse(root);
    traverser.updateTree();
}
Example #10
0
bool wxFileSystemWatcherBase::AddTree(const wxFileName& path, int events,
                                      const wxString& filespec)
{
    if (!path.DirExists())
        return false;

    // OPT could be optimised if we stored information about relationships
    // between paths
    class AddTraverser : public wxDirTraverser
    {
    public:
        AddTraverser(wxFileSystemWatcherBase* watcher, int events,
                     const wxString& filespec) :
            m_watcher(watcher), m_events(events), m_filespec(filespec)
        {
        }

        virtual wxDirTraverseResult OnFile(const wxString& WXUNUSED(filename))
        {
            // There is no need to watch individual files as we watch the
            // parent directory which will notify us about any changes in them.
            return wxDIR_CONTINUE;
        }

        virtual wxDirTraverseResult OnDir(const wxString& dirname)
        {
            if ( m_watcher->AddAny(wxFileName::DirName(dirname),
                                   m_events, wxFSWPath_Tree, m_filespec) )
            {
                wxLogTrace(wxTRACE_FSWATCHER,
                   "--- AddTree adding directory '%s' ---", dirname);
            }
            return wxDIR_CONTINUE;
        }

    private:
        wxFileSystemWatcherBase* m_watcher;
        int m_events;
        wxString m_filespec;
    };

    wxDir dir(path.GetFullPath());
    // Prevent asserts or infinite loops in trees containing symlinks
    int flags = wxDIR_DIRS;
    if ( !path.ShouldFollowLink() )
    {
        flags |= wxDIR_NO_FOLLOW;
    }
    AddTraverser traverser(this, events, filespec);
    dir.Traverse(traverser, filespec, flags);

    // Add the path itself explicitly as Traverse() doesn't return it.
    AddAny(path.GetPathWithSep(), events, wxFSWPath_Tree, filespec);

    return true;
}
Example #11
0
TString UniformHLSL::interfaceBlocksHeader(const ReferencedSymbols &referencedInterfaceBlocks)
{
    TString interfaceBlocks;

    for (ReferencedSymbols::const_iterator interfaceBlockIt = referencedInterfaceBlocks.begin();
         interfaceBlockIt != referencedInterfaceBlocks.end(); interfaceBlockIt++)
    {
        const TType &nodeType = interfaceBlockIt->second->getType();
        const TInterfaceBlock &interfaceBlock = *nodeType.getInterfaceBlock();
        const TFieldList &fieldList = interfaceBlock.fields();

        unsigned int arraySize = static_cast<unsigned int>(interfaceBlock.arraySize());
        InterfaceBlock activeBlock(interfaceBlock.name().c_str(), arraySize, mInterfaceBlockRegister);
        for (unsigned int typeIndex = 0; typeIndex < fieldList.size(); typeIndex++)
        {
            const TField &field = *fieldList[typeIndex];
            const TString &fullFieldName = InterfaceBlockFieldName(interfaceBlock, field);

            bool isRowMajor = (field.type()->getLayoutQualifier().matrixPacking == EmpRowMajor);
            GetInterfaceBlockFieldTraverser traverser(&activeBlock.fields, isRowMajor);
            traverser.traverse(*field.type(), fullFieldName);
        }

        mInterfaceBlockRegisterMap[activeBlock.name] = mInterfaceBlockRegister;
        mInterfaceBlockRegister += std::max(1u, arraySize);

        BlockLayoutType blockLayoutType = GetBlockLayoutType(interfaceBlock.blockStorage());
        SetBlockLayout(&activeBlock, blockLayoutType);

        if (interfaceBlock.matrixPacking() == EmpRowMajor)
        {
            activeBlock.isRowMajorLayout = true;
        }

        mActiveInterfaceBlocks.push_back(activeBlock);

        if (interfaceBlock.hasInstanceName())
        {
            interfaceBlocks += interfaceBlockStructString(interfaceBlock);
        }

        if (arraySize > 0)
        {
            for (unsigned int arrayIndex = 0; arrayIndex < arraySize; arrayIndex++)
            {
                interfaceBlocks += interfaceBlockString(interfaceBlock, activeBlock.registerIndex + arrayIndex, arrayIndex);
            }
        }
        else
        {
            interfaceBlocks += interfaceBlockString(interfaceBlock, activeBlock.registerIndex, GL_INVALID_INDEX);
        }
    }

    return (interfaceBlocks.empty() ? "" : ("// Interface Blocks\n\n" + interfaceBlocks));
}
Example #12
0
bool operator == (const Inspector & a, const Inspector & b)
{
    bool equal(a.type().getId() == b.type().getId());
    if (equal) {
        switch (a.type().getId()) {
        case NIX::ID:
            break;
        case BOOL::ID:
            equal = a.asBool() == b.asBool();
            break;
        case LONG::ID:
            equal = a.asLong() == b.asLong();
            break;
        case DOUBLE::ID:
            equal = a.asDouble() == b.asDouble();
            break;
        case STRING::ID:
            equal = a.asString() == b.asString();
            break;
        case DATA::ID:
            equal = a.asData() == b.asData();
            break;
        case ARRAY::ID:
            {
                EqualArray traverser(b);
                a.traverse(traverser);
                equal = traverser.isEqual() && (a.entries() == b.entries());
            }
            break;
        case OBJECT::ID:
            {
                EqualObject traverser(b);
                a.traverse(traverser);
                equal = traverser.isEqual() && (a.fields() == b.fields());
            }
            break;
        default:
            assert(false);
            break;
        }
    }
    return equal;
}
Example #13
0
void FoldExpressions(TIntermBlock *root, TDiagnostics *diagnostics)
{
    FoldExpressionsTraverser traverser(diagnostics);
    do
    {
        traverser.nextIteration();
        root->traverse(&traverser);
        traverser.updateTree();
    } while (traverser.didReplace());
}
Example #14
0
wxArrayString& PHPProject::GetFiles(wxProgressDialog* progress)
{
    if(m_files.IsEmpty()) {
        FilesCollector traverser(m_importFileSpec, m_excludeFolders, progress);
        wxDir dir(GetFilename().GetPath());
        dir.Traverse(traverser);
        m_files.swap(traverser.GetFilesAndFolders());
        m_files.Sort();
    }
    return m_files;
}
Example #15
0
void RemovePow(TIntermNode *root, TSymbolTable *symbolTable)
{
    RemovePowTraverser traverser(symbolTable);
    // Iterate as necessary, and reset the traverser between iterations.
    do
    {
        traverser.nextIteration();
        root->traverse(&traverser);
        traverser.updateTree();
    } while (traverser.needAnotherIteration());
}
void SplitSequenceOperator(TIntermNode *root, int patternsToSplitMask, TSymbolTable *symbolTable)
{
    SplitSequenceOperatorTraverser traverser(patternsToSplitMask, symbolTable);
    // Separate one expression at a time, and reset the traverser between iterations.
    do
    {
        traverser.nextIteration();
        root->traverse(&traverser);
        if (traverser.foundExpressionToSplit())
            traverser.updateTree();
    } while (traverser.foundExpressionToSplit());
}
Example #17
0
int main(int argc, char **argv)
{
    EventList eventlist;
    ProcessList processes;

    long ev_EndSimulation = 0;
    
    Traverser traverser(&eventlist);
    ColdTestCell cell1(&eventlist,&traverser);
    ColdTestCell cell2(&eventlist, &traverser);
    ColdTestCell cell3(&eventlist, &traverser);
    Source supply(&eventlist, &traverser);
    Sink derig(&eventlist);

    processes.push_back(&traverser);
    processes.push_back(&cell1);
    processes.push_back(&cell2);
    processes.push_back(&cell3);
    processes.push_back(&supply);
    processes.push_back(&derig);
    
    // Connect up production layout
    
    traverser.cell1(&cell1);
    traverser.cell2(&cell2);
    traverser.cell3(&cell3);
    traverser.infeed(&supply);
    traverser.outfeed(&derig);

    // Initialise the processes

    eventlist.push(new Event(100000,
                             nullptr,
                             ev_EndSimulation)); // End Simulation Event
    bool change;
    do {
        change = false;
        for (ProcessList::iterator i = processes.begin();
                 i != processes.end(); i++)
            change |= (*i)->run(); // Run each process until no change
    } while (change);


    // Run the event management loop.
    while (Event *event = eventlist.top()) {
        eventlist.pop(); // Remove the top element from the list
        SimulationTime += event->getTime(); // Advance simulation time
        if (event->getEventType() == ev_EndSimulation)
            break;
        event->getProcess()->HandleEvent(event);
        delete event; // no longer needed
    }
}
void UnfoldShortCircuitToIf(TIntermNode *root, TSymbolTable *symbolTable)
{
    UnfoldShortCircuitTraverser traverser(symbolTable);
    // Unfold one operator at a time, and reset the traverser between iterations.
    do
    {
        traverser.nextIteration();
        root->traverse(&traverser);
        if (traverser.foundShortCircuit())
            traverser.updateTree();
    } while (traverser.foundShortCircuit());
}
void SeparateExpressionsReturningArrays(TIntermNode *root, TSymbolTable *symbolTable)
{
    SeparateExpressionsTraverser traverser(symbolTable);
    // Separate one expression at a time, and reset the traverser between iterations.
    do
    {
        traverser.nextIteration();
        root->traverse(&traverser);
        if (traverser.foundArrayExpression())
            traverser.updateTree();
    } while (traverser.foundArrayExpression());
}
std::vector<wxString> t4p::ConfigTagDetectorActionClass::DetectorScripts() {
    std::vector<wxString> scripts;
    t4p::RecursiveDirTraverserClass traverser(scripts);
    wxDir globalDir;
    if (globalDir.Open(t4p::ConfigTagDetectorsGlobalAsset().GetFullPath())) {
        globalDir.Traverse(traverser, wxEmptyString, wxDIR_DIRS | wxDIR_FILES);
    }
    wxDir localDir;
    if (localDir.Open(t4p::ConfigTagDetectorsLocalAsset().GetFullPath())) {
        localDir.Traverse(traverser, wxEmptyString, wxDIR_DIRS | wxDIR_FILES);
    }
    return  scripts;
}
/**
* @brief Computes OptimFuncInfo for the function specified by its CFG.
*
* @param[in] module Module which contains the function specified by its CFG.
* @param[in] cio The used call info obtainer.
* @param[in] va The used analysis of values.
* @param[in] cfg CFG that should be traversed.
* @param[in] va Analysis of values.
*
* @par Preconditions
*  - @a module, @a cio, @a va, and @a cfg are non-null
*  - @a cio has been initialized
*  - @a va is in a valid state
*
* This function leaves @a va in a valid state.
*/
ShPtr<OptimFuncInfo> OptimFuncInfoCFGTraversal::getOptimFuncInfo(
		ShPtr<Module> module, ShPtr<OptimCallInfoObtainer> cio,
		ShPtr<ValueAnalysis> va, ShPtr<CFG> cfg) {
	PRECONDITION_NON_NULL(module);
	PRECONDITION_NON_NULL(cio);
	PRECONDITION_NON_NULL(va);
	PRECONDITION_NON_NULL(cfg);
	PRECONDITION(va->isInValidState(), "it is not in a valid state");

	ShPtr<OptimFuncInfoCFGTraversal> traverser(new OptimFuncInfoCFGTraversal(
		module, cio, va, cfg));
	return traverser->performComputation();
}
bool copyDirectory(wxString& path, wxString& item, wxString& pathNew, void* parent, onThreadBeginCopyFileCallBackFunc onBeginCopyFile = NULL, onThreadEndCopyFileCallBackFunc onEndCopyFile = NULL)
{
    wxString newItem = (path == pathNew ? "Copy of " + item : item);
    
   if (!wxDir::Exists(pathNew + "\\" + newItem))
      wxMkdir(pathNew + "\\" + newItem);      
        
   wxDir dir(path + "\\" + newItem);
  
   wxDirTraverserSimple traverser(path, pathNew, item, parent, onBeginCopyFile, onEndCopyFile);
   dir.Traverse(traverser);
   return true;
}
/**
* @brief Returns @c true if the given variable @a var is modified prior to
*        every read access to it in @a cfg, starting from @a startStmt.
*
* @param[in] var Variable whose modification is looked for.
* @param[in] startStmt Statement from which the traversal should start.
* @param[in] cfg CFG that should be traversed.
* @param[in] va Analysis of values.
* @param[in] cio Obtainer of information about function calls.
*
* @par Preconditions
*  - @a var, @a stmt, @a cfg, @a va are non-null
*  - @a va is in a valid state
*  - @a cio is initialized
*
* This function leaves @a va in a valid state.
*
* If the variable is not modified at all, this function also returns @c false.
*/
bool ModifiedBeforeReadCFGTraversal::isModifiedBeforeEveryRead(ShPtr<Variable> var,
		ShPtr<Statement> startStmt, ShPtr<CFG> cfg, ShPtr<ValueAnalysis> va,
		ShPtr<CallInfoObtainer> cio) {
	PRECONDITION_NON_NULL(var);
	PRECONDITION_NON_NULL(startStmt);
	PRECONDITION_NON_NULL(cfg);
	PRECONDITION_NON_NULL(va);
	PRECONDITION(va->isInValidState(), "it is not in a valid state");
	PRECONDITION(cio->isInitialized(), "it is not initialized");

	ShPtr<ModifiedBeforeReadCFGTraversal> traverser(
		new ModifiedBeforeReadCFGTraversal(var, cfg, va, cio));
	bool wasModified(traverser->performTraversal(startStmt));
	return wasModified && traverser->wasModifiedBeforeEveryRead;
}
Example #24
0
bool wxFileSystemWatcherBase::AddTree(const wxFileName& path, int events,
                                      const wxString& filter)
{
    if (!path.DirExists())
        return false;

    // OPT could be optimised if we stored information about relationships
    // between paths
    class AddTraverser : public wxDirTraverser
    {
    public:
        AddTraverser(wxFileSystemWatcherBase* watcher, int events) :
            m_watcher(watcher), m_events(events)
        {
        }

        // CHECK we choose which files to delegate to Add(), maybe we should pass
        // all of them to Add() and let it choose? this is useful when adding a
        // file to a dir that is already watched, then not only should we know
        // about that, but Add() should also behave well then
        virtual wxDirTraverseResult OnFile(const wxString& WXUNUSED(filename))
        {
            return wxDIR_CONTINUE;
        }

        virtual wxDirTraverseResult OnDir(const wxString& dirname)
        {
            wxLogTrace(wxTRACE_FSWATCHER, "--- AddTree adding '%s' ---",
                                                                    dirname);
            // we add as much as possible and ignore errors
            m_watcher->Add(wxFileName(dirname), m_events);
            return wxDIR_CONTINUE;
        }

    private:
        wxFileSystemWatcherBase* m_watcher;
        int m_events;
        wxString m_filter;
    };

    wxDir dir(path.GetFullPath());
    AddTraverser traverser(this, events);
    dir.Traverse(traverser, filter);

    return true;
}
Example #25
0
void RemoveDynamicIndexing(TIntermNode *root,
                           unsigned int *temporaryIndex,
                           const TSymbolTable &symbolTable,
                           int shaderVersion)
{
    RemoveDynamicIndexingTraverser traverser(symbolTable, shaderVersion);
    ASSERT(temporaryIndex != nullptr);
    traverser.useTemporaryIndex(temporaryIndex);
    do
    {
        traverser.nextIteration();
        root->traverse(&traverser);
        traverser.updateTree();
    } while (traverser.usedTreeInsertion());
    traverser.insertHelperDefinitions(root);
    traverser.updateTree();
}
void RemoveDynamicIndexing(TIntermNode *root, TSymbolTable *symbolTable, int shaderVersion)
{
    RemoveDynamicIndexingTraverser traverser(symbolTable, shaderVersion);
    do
    {
        traverser.nextIteration();
        root->traverse(&traverser);
        traverser.updateTree();
    } while (traverser.usedTreeInsertion());
    // TOOD([email protected]): It might be nicer to add the helper definitions also in the middle
    // of traversal. Now the tree ends up in an inconsistent state in the middle, since there are
    // function call nodes with no corresponding definition nodes. This needs special handling in
    // TIntermLValueTrackingTraverser, and creates intricacies that are not easily apparent from a
    // superficial reading of the code.
    traverser.insertHelperDefinitions(root);
    traverser.updateTree();
}
void SplitSequenceOperator(TIntermNode *root,
                           int patternsToSplitMask,
                           unsigned int *temporaryIndex,
                           const TSymbolTable &symbolTable,
                           int shaderVersion)
{
    SplitSequenceOperatorTraverser traverser(patternsToSplitMask, symbolTable, shaderVersion);
    ASSERT(temporaryIndex != nullptr);
    traverser.useTemporaryIndex(temporaryIndex);
    // Separate one expression at a time, and reset the traverser between iterations.
    do
    {
        traverser.nextIteration();
        root->traverse(&traverser);
        if (traverser.foundExpressionToSplit())
            traverser.updateTree();
    } while (traverser.foundExpressionToSplit());
}
void SimplifyLoopConditions(TIntermNode *root,
                            unsigned int conditionsToSimplifyMask,
                            unsigned int *temporaryIndex,
                            const TSymbolTable &symbolTable,
                            int shaderVersion)
{
    SimplifyLoopConditionsTraverser traverser(conditionsToSimplifyMask, symbolTable, shaderVersion);
    ASSERT(temporaryIndex != nullptr);
    traverser.useTemporaryIndex(temporaryIndex);
    // Process one loop at a time, and reset the traverser between iterations.
    do
    {
        traverser.nextIteration();
        root->traverse(&traverser);
        if (traverser.foundLoopToChange())
            traverser.updateTree();
    } while (traverser.foundLoopToChange());
}
Example #29
0
/* static */
size_t wxDir::GetAllFiles(const wxString& dirname,
                          wxArrayString *files,
                          const wxString& filespec,
                          int flags)
{
    wxCHECK_MSG( files, (size_t)-1, wxT("NULL pointer in wxDir::GetAllFiles") );

    size_t nFiles = 0;

    wxDir dir(dirname);
    if ( dir.IsOpened() )
    {
        wxDirTraverserSimple traverser(*files);

        nFiles += dir.Traverse(traverser, filespec, flags);
    }

    return nFiles;
}
Example #30
0
bool TCompiler::limitExpressionComplexity(TIntermNode* root)
{
    TMaxDepthTraverser traverser(maxExpressionComplexity+1);
    root->traverse(&traverser);

    if (traverser.getMaxDepth() > maxExpressionComplexity)
    {
        infoSink.info << "Expression too complex.";
        return false;
    }

    if (!ValidateMaxParameters::validate(root, maxFunctionParameters))
    {
        infoSink.info << "Function has too many parameters.";
        return false;
    }

    return true;
}