Esempio n. 1
0
/* __testc::AGetInt64(v)
   Wrapper for AGetInt64() C API function. Return a string representation of
   the integer. */
static AValue TestC_AGetInt64(AThread *t, AValue *frame)
{
    AInt64 i = AGetInt64(t, frame[0]);
    char buf[100];

    /* sprintf(buf, "%lld", i) would be simpler but not as portable. */
    Int64ToStr(buf, i);

    return AMakeStr(t, buf);
}
Esempio n. 2
0
  bool Record()
  {
    bool Result = (FState != Opened);
    if (Result)
    {
      if (FLog->FLogging && (FState != Cancelled))
      {
        const wchar_t * Name = ActionName();
        UnicodeString Attrs;
        if (FRecursive)
        {
          Attrs = L" recursive=\"true\"";
        }
        FLog->AddIndented(FORMAT(L"<%s%s>", Name,  Attrs.c_str()));
        for (intptr_t Index = 0; Index < FNames->GetCount(); ++Index)
        {
          UnicodeString Value = FValues->GetString(Index);
          if (Value.IsEmpty())
          {
            FLog->AddIndented(FORMAT(L"  <%s />", FNames->GetString(Index).c_str()));
          }
          else
          {
            FLog->AddIndented(FORMAT(L"  <%s value=\"%s\" />",
              FNames->GetString(Index).c_str(), XmlAttributeEscape(Value).c_str()));
          }
        }
        if (FFileList != nullptr)
        {
          FLog->AddIndented(L"  <files>");
          for (intptr_t Index = 0; Index < FFileList->GetCount(); ++Index)
          {
            TRemoteFile * File = FFileList->GetFile(Index);

            FLog->AddIndented(L"    <file>");
            FLog->AddIndented(FORMAT(L"      <filename value=\"%s\" />", XmlAttributeEscape(File->GetFileName()).c_str()));
            FLog->AddIndented(FORMAT(L"      <type value=\"%s\" />", XmlAttributeEscape(File->GetType()).c_str()));
            if (!File->GetIsDirectory())
            {
              FLog->AddIndented(FORMAT(L"      <size value=\"%s\" />", Int64ToStr(File->GetSize()).c_str()));
            }
            FLog->AddIndented(FORMAT(L"      <modification value=\"%s\" />", StandardTimestamp(File->GetModification()).c_str()));
            FLog->AddIndented(FORMAT(L"      <permissions value=\"%s\" />", XmlAttributeEscape(File->GetRights()->GetText()).c_str()));
            FLog->AddIndented(L"    </file>");
          }
          FLog->AddIndented(L"  </files>");
        }
        if (FFile != nullptr)
        {
          FLog->AddIndented(L"  <file>");
          FLog->AddIndented(FORMAT(L"    <type value=\"%s\" />", XmlAttributeEscape(FFile->GetType()).c_str()));
          if (!FFile->GetIsDirectory())
          {
            FLog->AddIndented(FORMAT(L"    <size value=\"%s\" />", Int64ToStr(FFile->GetSize()).c_str()));
          }
          FLog->AddIndented(FORMAT(L"    <modification value=\"%s\" />", StandardTimestamp(FFile->GetModification()).c_str()));
          FLog->AddIndented(FORMAT(L"    <permissions value=\"%s\" />", XmlAttributeEscape(FFile->GetRights()->GetText()).c_str()));
          FLog->AddIndented(L"  </file>");
        }
        if (FState == RolledBack)
        {
          if (FErrorMessages != nullptr)
          {
            FLog->AddIndented(L"  <result success=\"false\">");
            FLog->AddMessages(L"    ", FErrorMessages);
            FLog->AddIndented(L"  </result>");
          }
          else
          {
            FLog->AddIndented(L"  <result success=\"false\" />");
          }
        }
        else
        {
          FLog->AddIndented(L"  <result success=\"true\" />");
        }
        FLog->AddIndented(FORMAT(L"</%s>", Name));
      }
      delete this;
    }
    return Result;
  }
Esempio n. 3
0
//---------------------------------------------------------------------------
UnicodeString TFileMasks::TParams::ToString() const
{
  return UnicodeString(L"[") + Int64ToStr(Size) + L"/" + DateTimeToString(Modification) + L"]";
}
Esempio n. 4
0
void vcCPElementGroup::Print_VHDL(ostream& ofile)
{

  // if it has a dead transition, tie it to false.
  if(this->_has_dead_transition)
    {
      ofile << "cp_elements(" << this->Get_Group_Index() << ") <= false;" << endl;
      return;
    }


  if(!(this->_is_join || this->_is_fork))
    {
      if(this->_has_input_transition)
	{
	  this->Print_DP_To_CP_VHDL_Link(ofile);
	}
      else
	{
	  if(_predecessors.size() > 1)
	    {
	      ofile << "cp_elements(" << this->Get_Group_Index() << ") <= OrReduce(";	      // write the symbol as an OR of all incoming symbols.

	      bool first_one = true;
	      for(set<vcCPElementGroup*>::iterator iter = this->_predecessors.begin(),
		    fiter = _predecessors.end();
		  iter != fiter;
		  iter++)
		{
		  if(!first_one)
		    {
		      ofile << " & ";
		    }
		  else
		    first_one = false;
		  
		  ofile << "cp_elements(" << (*iter)->Get_Group_Index() << ")";
		}
	      ofile << ");" << endl;
	    }
	  else if(_predecessors.size() == 1)
	    {
	      ofile << "cp_elements(" << this->Get_Group_Index() << ") <= ";	      
	      ofile << "cp_elements(" << (*(_predecessors.begin()))->Get_Group_Index() << ");" << endl;
	    }
	  else if(_predecessors.size() == 0)
	    {
	      if(!this->_is_cp_entry)
		{
		  vcSystem::Warning("CP element " + Int64ToStr(this->Get_Group_Index()) + " has no predecessors.. tie to false");
		  ofile << "cp_elements(" << this->Get_Group_Index() << ") <= false; " << endl;	      		  
		}
	    }
	}
    }
  else
    {
      // instantiate join element.
      if(_predecessors.size() > 1)
	{
	  ofile << "cpelement_group_" << this->Get_Group_Index() << " : Block -- { " << endl;
	  ofile << "signal predecessors: BooleanArray(" 
		<< _predecessors.size()-1 << " downto 0);" << endl;
	  ofile << "-- }" << endl << "begin -- {" << endl;
	  
	  ofile << "predecessors <= (" ;
	  bool first_one = true;
	  for(set<vcCPElementGroup*>::iterator iter = this->_predecessors.begin(),
		fiter = _predecessors.end();
	      iter != fiter;
	      iter++)
	    {
	      if(!first_one)
		{
		  ofile << " & ";
		}
	      else
		first_one = false;
	      
	      ofile << "cp_elements(" << (*iter)->Get_Group_Index() << ")";
	      
	    }
	  ofile << ");" << endl;

          string bypass_str = (vcSystem::_min_clock_period_flag ? "false" : "true");
          //string bypass_str = "true";
	  if(this->_input_transition != NULL)
	    {
	      ofile << "jI: join_with_input -- {" << endl
		    << "generic map ( bypass => " << bypass_str << ")" << endl
		    << "port map( -- {"
		    << "preds => predecessors," << endl
		    << "symbol_in => " << this->_input_transition->Get_DP_To_CP_Symbol() << "," << endl
		    << "symbol_out => cp_elements(" << this->Get_Group_Index() << ")," << endl
		    << "clk => clk," << endl
		    << "reset => reset); -- }}" << endl;
	    }
	  else
	    {
	      ofile << "jNoI: join -- {" << endl
		    << "generic map ( bypass => " << bypass_str << ")" << endl
		    << "port map( -- {"
		    << "preds => predecessors," << endl
		    << "symbol_out => cp_elements(" << this->Get_Group_Index() << ")," << endl
		    << "clk => clk," << endl
		    << "reset => reset); -- }}" << endl;
	    }
		  
	  ofile << "-- }" << endl << "end Block;" << endl;
	}
      else if(_predecessors.size() == 1)
	{
	  if(this->_has_input_transition)
	    {
	      ofile << "cp_elements(" << this->Get_Group_Index() << ") <= ";
	      ofile <<  _input_transition->Get_DP_To_CP_Symbol() << ";" << endl;
	    }
	  else
	    {
	      ofile << "cp_elements(" << this->Get_Group_Index() << ") <= ";	      
	      ofile << "cp_elements(" << (*(_predecessors.begin()))->Get_Group_Index() << ");" << endl;
	    }
	}
    }

	  
	  
  for(int idx = 0, fidx = _output_transitions.size(); idx < fidx; idx++)
    {
      this->Print_CP_To_DP_VHDL_Link(idx, ofile);
    }
}