Example #1
0
void GarbageCollector::ArrangeCollection()
{
    ResolveReferences();

    do
    {
        // find node, which does not depend on anything

        wxNode* pItemNode = FindReferenceFreeItemNode();

        if ( pItemNode )
        {
            // append it to the list, where items are contained
            // in the increasing order of dependencies

            mRegularLst.Append( pItemNode->GetData() );

            mAllNodes.DeleteNode( pItemNode );

            // remove references to this current "least-dependent" node
            // from reference lists of all the other nodes

            RemoveReferencesToNode( pItemNode );
        }
        else
        {
            // otherwise, what is left - all nodes, which
            // are involved into cycled chains (rings)

            wxNode* pNode = mAllNodes.GetFirst();

            while( pNode )
            {
                mCycledLst.Append( pNode->GetData() );

                pNode = pNode->GetNext();
            }

            mAllNodes.Clear();
            break;
        }

        // continue search for "least-dependent" nodes

    } while(1);
}
Example #2
0
void Interpret(int argc, char *argv[])
{
   printf("   Loading and Resolving References ...\n");
   InitializeInterpreter(argc, argv);

   CodeFile = fopen(CodeFileName,"r");

   if (CodeFile == NULL)
     printf("%s NOT FOUND. \n",CodeFileName);
   else 
   {
      ReadCode(CodeFile);

      if (ResolveReferences())       /*Mini Loader Here*/ 
      {  
         printf("   Begin Execution:\n");
         Execute();
         printf("   End Execution.\n");
      } 
      else
         printf("Execution Inhibited.\n");
   }
}
void SFManager::mexpr2SFCCondition( SFC::CompoundStatement compoundStatement, const std::string &expression ) {

	std::string newExpression = ResolveReferences( compoundStatement, expression );
	::mexpr2SFCCondition( compoundStatement, newExpression, true, true );
}
void SFManager::mstat2SFC( SFC::CompoundStatement compoundStatement, const std::string &statement ) {

	std::string newStatement = ResolveReferences( compoundStatement, statement );
	::mstat2SFC( compoundStatement, newStatement, true, true, getFunctionHash() );
}
  bool DebugDatabase::ResolveReferences(const std::set<ObjectOSMRef>& ids,
                                        const std::set<ObjectFileRef>& fileOffsets,
                                        std::map<ObjectOSMRef,ObjectFileRef>& idFileOffsetMap,
                                        std::map<ObjectFileRef,ObjectOSMRef>& fileOffsetIdMap)
  {
    bool haveToScanNodes=false;
    bool haveToScanAreas=false;
    bool haveToScanWays=false;

    for (std::set<ObjectOSMRef>::const_iterator ref=ids.begin();
         ref!=ids.end();
         ++ref) {
      if (haveToScanNodes && haveToScanAreas && haveToScanWays) {
        break;
      }

      switch (ref->GetType()) {
      case osmRefNone:
        break;
      case osmRefNode:
        haveToScanNodes=true;
        break;
      case osmRefWay:
        haveToScanAreas=true;
        haveToScanWays=true;
        break;
      case osmRefRelation:
        haveToScanAreas=true;
        break;
      }

    }

    for (std::set<ObjectFileRef>::const_iterator ref=fileOffsets.begin();
         ref!=fileOffsets.end();
         ++ref) {
      if (haveToScanNodes && haveToScanAreas && haveToScanWays) {
        break;
      }

      switch (ref->GetType()) {
      case refNone:
        break;
      case refNode:
        haveToScanNodes=true;
        break;
      case refWay:
        haveToScanWays=true;
        break;
      case refArea:
        haveToScanAreas=true;
        break;
      }
    }

    if (haveToScanNodes) {
      if (!ResolveReferences("nodes.idmap",
                             refNode,
                             ids,
                             fileOffsets,
                             idFileOffsetMap,
                             fileOffsetIdMap)) {
        return false;
      }
    }

    if (haveToScanAreas) {
      if (!ResolveReferences("areas.idmap",
                             refArea,
                             ids,
                             fileOffsets,
                             idFileOffsetMap,
                             fileOffsetIdMap)) {
        return false;
      }
    }

    if (haveToScanWays) {
      if (!ResolveReferences("ways.idmap",
                             refWay,
                             ids,
                             fileOffsets,
                             idFileOffsetMap,
                             fileOffsetIdMap)) {
        return false;
      }
    }

    return true;
  }