コード例 #1
0
ファイル: ExtentAllocator.cpp プロジェクト: mmuman/haiku
void
CachedExtent::Info() const
{
	const char* extentType = "allocated tree block";
	if (IsAllocated() == false && IsData() == false)
		extentType = "free tree block";
	else if (IsAllocated() == false && IsData() == true)
		extentType = "free data extent";
	else if (IsAllocated() == true && IsData() == true)
		extentType = "allocated data extent";

	TRACE("%s at %" B_PRIu64 " length %" B_PRIu64 " refCount %i\n",
		extentType, offset, length, refCount);
}
コード例 #2
0
void CSoundInstanceStream::Resume() const
{
	if (!IsData())
		return;

	AIL_pause_stream(m_stream, 0);
}
コード例 #3
0
void CSoundInstanceStream::SetVolume(float volume) const
{
	if (!IsData())
		return;

	volume = max(0.0f, min(1.0f, volume));
	AIL_set_stream_volume_levels(m_stream, volume, volume);
}
コード例 #4
0
void CSoundInstanceStream::Stop()
{
	if (!IsData())
		return;

	AIL_close_stream(m_stream);
	m_stream = NULL;
}
コード例 #5
0
void CSoundInstanceStream::Play(int count, DWORD dwPlayCycleTimeLimit) const
{
	if (!IsData())
		return;

	AIL_set_stream_loop_count(m_stream, count);
	AIL_start_stream(m_stream);
}
コード例 #6
0
ファイル: convert.cpp プロジェクト: djdron/zxtune
 bool ConvertFromString(const String& str, DataType& res)
 {
   if (IsData(str))
   {
     DataFromString(str, res);
     return true;
   }
   return false;
 }
コード例 #7
0
ファイル: convert.cpp プロジェクト: djdron/zxtune
 bool ConvertFromString(const String& str, StringType& res)
 {
   if (!IsInteger(str) && !IsData(str))
   {
     res = StringFromString(str);
     return true;
   }
   return false;
 }
コード例 #8
0
void CSoundInstanceStream::GetVolume(float& rfVolume) const
{
	float tmp;

	if (!IsData())
		return;

	AIL_stream_volume_levels(m_stream, &rfVolume, &tmp);
}
コード例 #9
0
ファイル: DDE_EXEC.CPP プロジェクト: ChrisMoreton/Test3
flag CDdeExec::EO_WriteSubsData(CXMsgLst &XM, flag FirstBlock, flag LastBlock)
  {
//dbgp("SubsData:Wrt ");
  while (XM.MsgAvail())
    {
    CXM_ObjectData *pX = XM.ObjectData();
    CPkDataItem * pPItem = pX->FirstItem();
    int iIndex = pX->Index;
    Dde.Lock();
    if (iIndex<SubsData.GetSize())
      {
      CDdeAdviseBlk *p = SubsData[iIndex];
//dbgp(" %i", iIndex);
      //if (p->pItem && pPItem->Value() && IsData(pPItem->Value()->Type()))
      if (p->pItem && pPItem->Contains(PDI_Value) && IsData(pPItem->Value()->Type()))
        {
//dbgp(" %s", (LPCTSTR)p->pItem->m_strName);
        // Fetch On First Pass
        //if (pPItem->Contains(PDI_CnvInfo) && p->sCnvTxt.Length() > 0)
        CCnvIndex iCnv = p->pItem->iCnvIndex;
        if (p->sCnvTxt.Length()>0 && (iCnv)==0)
          p->sValue.Set("#Conversion not expected");
        else
          {
          if (p->sCnvTxt() && Cnvs[iCnv]->Find(p->sCnvTxt())==NULL)
            p->sValue.Set("#Unknown conversion '%s's", p->sCnvTxt());
          else
            p->sValue = pPItem->Value()->GetString("%i", "%g", iCnv, p->sCnvTxt());
          }
        StatsCnt[0]++;

        PostThreadMessage(dwThreadId, wm_SyscadDdeCommand, MAKEWPARAM(DDE_POSTADVISE, (WORD)iIndex), (LPARAM)p);
        }
      else
        {
        dbgp("Skipping DDE Data subscription change");
        if (p->pItem)
          dbgp(" %s", (LPCTSTR)p->pItem->m_strName);
        dbgpln("");
        }
      }
    Dde.Release();
    }
//dbgpln("");
  CScdDDEManager::pTheMngr->UpdateStatusWnd((WPARAM)SUB_UPDATE_EOWRITE);
  return True;
  }
コード例 #10
0
ファイル: COPYBLK.CPP プロジェクト: abcweizhuo/Test3
int CCopyBlock::WriteTagValues(CSVector& Tags)
  {
  ASSERT(pEO && bSrcDatalib && eSrc==CB_SelectedTag);
  CProfINIFile PF(CfgFiles(), (char*)CopyBlkFileName);
  if (!CheckCopyBlockVer(PF, true))
    return 0;
  Strng_List sStrList;
  int WriteCnt = 0;
  char Buff[2];
  Buff[0] = 0;
  Buff[1] = 0;
  PF.WrSection(TempBlockName, Buff);
  char* p = Buff;
  for (int i=0; i<Tags.GetSize(); i++)
    {
    CXM_ObjectData ObjData;
    CXM_Route Route;
    CXM_ObjectTag ObjTag(Tags[i](), TABOpt_AllInfoOnce);//TABOpt_Parms);
    if (pEO->XReadTaggedItem(ObjTag, ObjData, Route))
      {
      CPkDataItem * pItem = ObjData.FirstItem();
      byte cType = pItem->Type();
      if (IsData(cType))
        {
        WriteCnt++;
        if (IsIntData(cType) && pItem->Contains(PDI_StrList))
          {
          const long strIndex = pItem->Value()->GetLong();
          pItem->GetStrList(sStrList);
          pStrng pS = (sStrList.Length()>0) ? sStrList.AtIndexVal(strIndex) : NULL;
          if (pS)
            PF.WrStr(TempBlockName, Tags[i](), pS->Str());
          else
            PF.WrLong(TempBlockName, Tags[i](), strIndex);
          }
        else if (IsStrng(cType))
          PF.WrStr(TempBlockName, Tags[i](), pItem->Value()->GetString());
        else if (IsFloatData(cType))
          PF.WrDouble(TempBlockName, Tags[i](), pItem->Value()->GetDouble());
        else
          PF.WrLong(TempBlockName, Tags[i](), pItem->Value()->GetLong());
        }
      }
    }
  return WriteCnt;
  }
コード例 #11
0
ファイル: CHNGTAG.CPP プロジェクト: ChrisMoreton/Test3
flag CCopyTagBlkDlg::BuildTree()
  {
  m_CopyTree.DeleteAllItems();

#if 1

  if (sTag.Len()>0)
    {
    TV_INSERTSTRUCT Ins;
    Ins.hParent             = TVI_ROOT;       
    Ins.hInsertAfter        = TVI_LAST;//TVI_SORT;  
    Ins.item.mask           = TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE;
    Ins.item.state          = 0;
    Ins.item.stateMask      = 0;
    Ins.item.hItem          = NULL;
    Ins.item.pszText        = NULL;         
    Ins.item.cchTextMax     = 0;      
    Ins.item.iImage         = 0;          
    Ins.item.iSelectedImage = 0;  
    Ins.item.cChildren      = 0;       
    Ins.item.lParam         = 0;
    CTagTree TT;
    TT.Build(sTag());
    TT.PopulateTree(m_CopyTree, Ins, isParm, 0);//, ButtonFld);
    }

#else

  int iLvl=0;
  const int MaxItems = 256;
  HTREEITEM hItem[MaxItems], hRoot=NULL;
  for (iLvl=0; iLvl<MaxItems; iLvl++)
    hItem[iLvl]=NULL;

  Strng Txt;
  int PrvLvl=0;
  for (int di = 0; (di < AW.NData); di++ )
    {
    rAccNdData d = AW.Data[di];
//    dbgpln("Fld %3i Typ:%-16s S:%i E:%i Lvl:%3i :%s",
//          di, tt_TypeString(d.iType), d.iStrtFld, d.iEndFld, d.iLvl, d.sSymOrTag());

    ASSERT(d.iLvl<MaxItems);
    for (int i=PrvLvl+1; i<=d.iLvl; i++)
      hItem[i] = NULL;

    if (!IsLayout(d.iType) && 
        !IsStructEnd(d.iType) && 
        (!IsData(d.iType)/* || (d.fIsParam && !bBlocksOnly)*/))
      {
      TV_INSERTSTRUCT Ins;
      Ins.hParent        = TVI_ROOT;       
      Ins.hInsertAfter   = TVI_LAST;  
      Ins.item.mask      = TVIF_TEXT|TVIF_PARAM;
      Ins.item.state     = 0;
      Ins.item.stateMask = 0;

      if (IsData(d.iType))
        Txt.Set("%s (%s)", d.sSymOrTag(), d.sValue());
      else
        Txt = d.sSymOrTag();
      Ins.item.hItem          = NULL;
      Ins.item.pszText        = Txt();         
      Ins.item.cchTextMax     = 0;      
      Ins.item.iImage         = 0;          
      Ins.item.iSelectedImage = 0;  
      Ins.item.cChildren      = 0;       
      Ins.item.lParam         = MAKELPARAM((WORD)di, (WORD)0);
   
      if (d.iLvl>0)
        {
        int i = d.iLvl-1;
        while (i>0 && hItem[i]==NULL)
          i--;
        Ins.hParent = hItem[i];
        hItem[d.iLvl] = m_CopyTree.InsertItem(&Ins);
        }
      else
        {
        hItem[d.iLvl] = m_CopyTree.InsertItem(&Ins);
        hRoot = hItem[d.iLvl];
        }
      }
    
    PrvLvl = d.iLvl;
    }

#endif

  if (m_CopyTree.GetRootItem())
    m_CopyTree.Expand(m_CopyTree.GetRootItem(), TVM_EXPAND);
  return m_CopyTree.GetCount()>0;
  }
コード例 #12
0
ファイル: Arithmetic1.cpp プロジェクト: FuangCao/cavan
int compute1(long double &a,string s,int angle=0)//算术综合运算
{
    if(!check_b(s))
        return 0;
    Stack<long double> ss(20);
    Stack<char> sf(20);
    int i=0,j;
    string s1,s2;
    char c;
    long double b;
    while(IsUselessChar(s[i]))
        i++;
    if(s[i]=='-')
    {
        ss.PushStack(-1);
        sf.PushStack('*');
        i++;
    }
    else if(s[i]=='+')
        i++;
    while(s[i])
    {
        s2="\0";
        if(IsUselessChar(s[i]))
            i++;
        else if(IsBracket(s[i])==1)
        {
            if(i>0&&!IsOperator1(s[i-1]))
                if(!sf.PushStack('*'))
                    return 0;
            s2=GetBracketData(s,i);
            if(!compute1(a,s2,angle)||!ss.PushStack(a))
                return 0;
        }
        else if(IsOperator1(s[i]))
        {
            if(s[i]=='!')
            {
                if(!ss.PopStack(b)||!factorial(a,(int)b)||!ss.PushStack(a))
                    return 0;
                i++;
                continue;
            }
            while(sf.GetTopData(c))
            {
                if(PRI(s[i])>PRI(c))
                    break;
                if(!ss.PopStack(b)||!ss.PopStack(a)||!sf.PopStack(c)||!Account1(a,b,c)||!ss.PushStack(a))
                    return 0;
            }
            if(!sf.PushStack(s[i++]))
                return 0;
        }
        else if(IsData(s[i])==1)
        {
            while(IsData(s[i])==1)
                s2+=s[i++];
            if(!ss.PushStack(string_double(s2)))
                return 0;
        }
        else if(s[i]=='S')
        {
            if(i>0&&!IsOperator1(s[i-1]))
                if(!sf.PushStack('*'))
                    return 0;
            s2="\0";
            for(j=0; j<4&&s[i]; j++,i++)
                s2+=s[i];
            if(s2!="Sqrt"||IsBracket(s[i])!=1)
                return 0;
            s2=GetBracketData(s,i);
            s1="\0";
            for(j=0; s2[j]; j++)
            {
                if(IsBracket(s2[j])==1)
                    s1+="("+GetBracketData(s2,j)+")";
                if(s2[j]==',')
                {
                    j++;
                    break;
                }
                else
                    s1+=s2[j];
            }
            if(!compute1(a,s1,angle))
                return 0;
            s1="\0";
            for(; s2[j]; j++)
                s1+=s2[j];
            if(!compute1(b,s1,angle)||!Sqrt(a,b)||!ss.PushStack(a))
                return 0;
        }
        else if(s[i]>='a'&&s[i]<='z'||s[i]=='L')
        {
            s1="\0";
            if(i>0&&!IsOperator1(s[i-1]))
                if(!sf.PushStack('*'))
                    return 0;
            while(s[i]>='a'&&s[i]<='z'||s[i]=='L'||s[i]=='^')
            {
                s1+=s[i++];
                if(s[i-1]=='e'&&s[i]!='^')
                    s1+='^';
            }
            if(s[i-1]=='e')
                s2="1";
            else if(IsBracket(s[i])==1)
                s2=GetBracketData(s,i);
            else if(IsData(s[i])==1)
            {
                while(s[i])
                {
                    if(IsData(s[i])==1)
                        s2+=s[i++];
                    else
                        break;
                }
            }
            else if(s[i]=='P'||s[i+1]=='i')
                s2="Pi";
            else if(s[i]=='S')
            {
                for(j=0; j<4&&s[i]; j++,i++)
                    s2+=s[i];
                if(s2!="Sqrt"||IsBracket(s[i])!=1)
                    return 0;
                s2+="("+GetBracketData(s,i)+")";
            }
            else
                return 0;
            if(!compute1(a,s2,angle)||!compute3(b,s1,a,angle)||!ss.PushStack(b))
                return 0;
        }
        else if(s[i]=='P')
        {
            if(i>0&&!IsOperator1(s[i-1])&&!sf.PushStack('*')||!ss.PushStack(P))
                return 0;
            i+=2;
        }
        else
            return 0;
    }
    while(sf.PopStack(c))
        if(!ss.PopStack(b)||!ss.PopStack(a)||!Account1(a,b,c)||!ss.PushStack(a))
            return 0;
    if(!ss.PopStack(a)||ss.State()>=0)
        return 0;
    return 1;
}