亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? testresource.cpp

?? ecos實時嵌入式操作系統(tǒng)
?? CPP
字號:
//####COPYRIGHTBEGIN####//                                                                          // ----------------------------------------------------------------------------// Copyright (C) 1998, 1999, 2000 Red Hat, Inc.//// This program is part of the eCos host tools.//// This program is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by the Free // Software Foundation; either version 2 of the License, or (at your option) // any later version.// // This program is distributed in the hope that it will be useful, but WITHOUT // ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for // more details.// // You should have received a copy of the GNU General Public License along with// this program; if not, write to the Free Software Foundation, Inc., // 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.//// ----------------------------------------------------------------------------//                                                                          //####COPYRIGHTEND####//=================================================================////        TestResource.cpp////        Resource test class////=================================================================//=================================================================//#####DESCRIPTIONBEGIN####//// Author(s):     sdf// Contributors:  sdf// Date:          1999-04-01// Description:   This class abstracts a test resource for use in the testing infrastructure// Usage:////####DESCRIPTIONEND#####include "eCosStd.h"#include "eCosTestUtils.h"#include "eCosTrace.h"#include "Subprocess.h"#include "TestResource.h"CTestResource *CTestResource::pFirstInstance=0;unsigned int CTestResource::nCount=0;String CTestResource::strResourceHostPort;CTestResource::CTestResource(LPCTSTR pszHostPort, LPCTSTR target, LPCTSTR  pszDownloadPort, int nBaud, LPCTSTR pszResetString):  m_strReset(pszResetString),  m_bInUse(false),  m_nBaud(nBaud),  m_strPort(pszDownloadPort),  m_bLocked(false),  m_Target(target){  CeCosSocket::ParseHostPort(pszHostPort,m_strHost,m_nPort);  VTRACE(_T("@@@ Created resource %08x %s\n"),(unsigned int)this,(LPCTSTR)Image());  Chain();}CTestResource::~CTestResource(){  ENTERCRITICAL;  VTRACE(_T("@@@ Destroy resource %08x %s\n"),this,(LPCTSTR)Image());  if(m_pPrevInstance || m_pNextInstance){    nCount--;  }  if(pFirstInstance==this){    pFirstInstance=m_pNextInstance;  }  if(m_pPrevInstance){    m_pPrevInstance->m_pNextInstance=m_pNextInstance;  }  if(m_pNextInstance){    m_pNextInstance->m_pPrevInstance=m_pPrevInstance;  }  LEAVECRITICAL;}// Find the resource matching the given host:port specification// Returns 0 if no such host:port foundCTestResource * CTestResource::Lookup(LPCTSTR pszHostPort){  CTestResource *pResource=NULL;  ENTERCRITICAL;  String strHost;  int nPort;  if(CeCosSocket::ParseHostPort(pszHostPort,strHost,nPort)){    for(pResource=pFirstInstance;pResource;pResource=pResource->m_pNextInstance){      if(nPort==pResource->TcpIPPort() && CeCosSocket::SameHost(strHost,pResource->Host())){        break;      }    }  }  LEAVECRITICAL;  return pResource;}unsigned int CTestResource::GetMatchCount (const CeCosTest::ExecutionParameters &e,bool bIgnoreLocking){  unsigned int i=0;  ENTERCRITICAL;  for(const CTestResource *pResource=pFirstInstance;pResource;pResource=pResource->m_pNextInstance){    if(pResource->Matches(e,bIgnoreLocking)){      i++;    }  }  LEAVECRITICAL;  return i;}bool CTestResource::GetMatches (const CeCosTest::ExecutionParameters &e, StringArray &arstr, bool bIgnoreLocking){  bool rc=false;  arstr.clear();  if(Load()){    ENTERCRITICAL;    for(CTestResource *pResource=pFirstInstance;pResource;pResource=pResource->m_pNextInstance){		  if(pResource->Matches(e,bIgnoreLocking)){        arstr.push_back(pResource->HostPort());      }    }    LEAVECRITICAL;    rc=true;  }  return rc;}void CTestResource::DeleteAllInstances(){  ENTERCRITICAL;  while(pFirstInstance){    delete pFirstInstance;  }  LEAVECRITICAL;}bool CTestResource::LoadFromDirectory (LPCTSTR psz){  bool rc=true;  ENTERCRITICAL;  DeleteAllInstances();  // Find all the files in directory "psz" and load from each of them  TCHAR szOrigDir[256];  _tgetcwd(szOrigDir,sizeof szOrigDir-1);  if(0==_tchdir(psz)){    String strFile;    void *pHandle;    for(bool b=CeCosTestUtils::StartSearch(pHandle,strFile);b;b=CeCosTestUtils::NextFile(pHandle,strFile)){      if(CeCosTestUtils::IsFile(strFile)){        CTestResource *pResource=new CTestResource(_T(""),_T(""));        CTestResourceProperties prop(pResource);        prop.LoadFromFile(strFile);      }    }    CeCosTestUtils::EndSearch(pHandle);  } else {    TRACE(_T("Failed to change to %s from %s\n"),psz,szOrigDir);  }  _tchdir(szOrigDir);  LEAVECRITICAL;    return rc;}bool CTestResource::SaveToDirectory (LPCTSTR pszDir){  bool rc=false;      ENTERCRITICAL;  {    // Delete all the files under directory "pszDir"    void *pHandle;    TCHAR szOrigDir[256];    _tgetcwd(szOrigDir,sizeof szOrigDir-1);    if(0==_tchdir(pszDir)){      String strFile;      for(bool b=CeCosTestUtils::StartSearch(pHandle,strFile);b;b=CeCosTestUtils::NextFile(pHandle,strFile)){        if(CeCosTestUtils::IsFile(strFile)){          _tunlink(strFile);        }      }      CeCosTestUtils::EndSearch(pHandle);      rc=true;      for(CTestResource *pResource=pFirstInstance;pResource;pResource=pResource->m_pNextInstance){        CTestResourceProperties prop(pResource);        rc&=prop.SaveToFile(pResource->FileName());      }    } else {      fprintf(stderr,"Failed to change to %s from %s\n",pszDir,szOrigDir);    }    _tchdir(szOrigDir);  }    LEAVECRITICAL;    return rc;}#ifdef _WIN32bool CTestResource::LoadFromRegistry(HKEY key,LPCTSTR psz){  // Find all the keys under "psz" and load from each of them  bool rc=false;      ENTERCRITICAL;  HKEY hKey;  if(ERROR_SUCCESS==RegOpenKeyEx ((HKEY)key, psz, 0L, KEY_ENUMERATE_SUB_KEYS, &hKey)){		TCHAR szName[256];    DWORD dwSizeName=sizeof szName;    FILETIME ftLastWriteTime;    for(DWORD dwIndex=0;ERROR_SUCCESS==RegEnumKeyEx(hKey, dwIndex, szName, &dwSizeName, NULL, NULL, NULL, &ftLastWriteTime); dwIndex++){      CTestResource *pResource=new CTestResource(_T(""),_T(""));      String strKey;      strKey.Format(_T("%s\\%s"),psz,szName);      CTestResourceProperties prop1(pResource);      prop1.LoadFromRegistry(key,strKey);      dwSizeName=sizeof szName;    }    RegCloseKey(hKey);  }  LEAVECRITICAL;  return rc;}bool CTestResource::SaveToRegistry(HKEY key,LPCTSTR psz){  bool rc=false;      ENTERCRITICAL;  // Delete all the keys under "psz"  HKEY hKey;  if(ERROR_SUCCESS==RegOpenKeyEx ((HKEY)key, psz, 0L, KEY_ENUMERATE_SUB_KEYS, &hKey)){    TCHAR szName[256];    DWORD dwSizeName=sizeof szName;    FILETIME ftLastWriteTime;    DWORD dwIndex;    if(ERROR_SUCCESS==RegQueryInfoKey(hKey,0,0,0,&dwIndex,0,0,0,0,0,0,0)){      while((signed)--dwIndex>=0){        if(ERROR_SUCCESS!=RegEnumKeyEx(hKey, dwIndex, szName, &dwSizeName, NULL, NULL, NULL, &ftLastWriteTime) ||          ERROR_SUCCESS!=RegDeleteKey(hKey,szName)){          rc=false;        }        dwSizeName=sizeof szName;      }    }    RegCloseKey(hKey);  }  rc=true;  for(CTestResource *pResource=pFirstInstance;pResource;pResource=pResource->m_pNextInstance){    CTestResourceProperties prop1(pResource);    rc&=prop1.SaveToRegistry(key,pResource->FileName());  }  LEAVECRITICAL;  return rc;}#endifCTestResource::CTestResourceProperties::CTestResourceProperties(CTestResource *pResource){  Add(_T("Baud"),       pResource->m_nBaud);  Add(_T("BoardId"),    pResource->m_strBoardID);  Add(_T("Date"),       pResource->m_strDate);  Add(_T("Email"),      pResource->m_strEmail);  Add(_T("Host"),       pResource->m_strHost);  Add(_T("Port"),       pResource->m_nPort);  Add(_T("Locked"),     pResource->m_bLocked);  Add(_T("Originator"), pResource->m_strUser);  Add(_T("Reason"),     pResource->m_strReason);  Add(_T("Reset"),      pResource->m_strReset);  Add(_T("Serial"),     pResource->m_strPort);  Add(_T("Target"),     pResource->m_Target);  Add(_T("User"),       pResource->m_strUser);}bool CTestResource::Lock(){  if(!m_bLocked){    m_bLocked=true;    return true;  } else {    return false;  }}bool CTestResource::Unlock(){  if(m_bLocked){    m_bLocked=false;    return true;  } else {    return false;  }}bool CTestResource::LoadSocket(LPCTSTR pszResourceHostPort,Duration dTimeout/*=10*1000*/){  bool rc=false;  ENTERCRITICAL;  CTestResource *pResource;  // If the resource is in use, we don't dare delete it!  for(pResource=CTestResource::First();pResource;pResource=pResource->Next()){    pResource->m_bFlag=false;  }  CeCosSocket sock;  if(sock.Connect(pszResourceHostPort,dTimeout)){    // Write the message to the socket    int nRequest=0; // read    if(!sock.sendInteger(nRequest)){      ERROR(_T("Failed to write to socket\n"));    } else {      int nResources;      if(sock.recvInteger(nResources,_T(""),dTimeout)){        rc=true;        while(nResources--){          String strImage;          if(sock.recvString(strImage,_T(""),dTimeout)){            VTRACE(_T("Recv \"%s\"\n"),(LPCTSTR)strImage);            CTestResource tmp;            tmp.FromStr(strImage);            CTestResource *pResource=Lookup(tmp.HostPort());            if(0==pResource){              pResource=new CTestResource(_T(""),_T(""));            }            pResource->FromStr(strImage);            pResource->m_bFlag=true;          } else {            rc=false;            break;          }        }      }    }  }  // If the resource is in use, we don't dare delete it!  CTestResource *pNext;  for(pResource=CTestResource::First();pResource;pResource=pNext){    pNext=pResource->Next();    if(!pResource->m_bFlag && !pResource->m_bInUse){      delete pResource;    }  }    LEAVECRITICAL;  return rc;}bool CTestResource::SaveSocket(LPCTSTR pszResourceHostPort,Duration dTimeout){  bool rc=true;  ENTERCRITICAL;  CeCosSocket sock(pszResourceHostPort, dTimeout);  if(sock.Ok()){    // Write the message to the socket    int nRequest=1; //write    if(!sock.sendInteger(nRequest, _T(""),dTimeout)){      ERROR(_T("Failed to write to socket\n"));      rc=false;    } else {      int nResources=0;      CTestResource *pResource;      for(pResource=CTestResource::First();pResource;pResource=pResource->Next()){        nResources++;      }      if(sock.sendInteger(nResources,_T("resource count"),dTimeout)){        for(pResource=CTestResource::First();pResource;pResource=pResource->Next()){          String strImage;          CTestResourceProperties prop(pResource);          strImage=prop.MakeCommandString();          TRACE(_T("Send \"%s\"\n"),(LPCTSTR)strImage);          if(!sock.sendString (strImage, _T("reply"),dTimeout)){            rc=false;            break;          }        }      } else {        rc=false;      }    }  } else {    rc=false;  }  LEAVECRITICAL;  return rc;}/*void CTestResource::Image(String &str){  CTestResourceProperties prop(this);  str=prop.MakeCommandString();  VTRACE(_T("Make command string %s\n"),(LPCTSTR)str);}*/bool CTestResource::FromStr(LPCTSTR pszImage){  CTestResourceProperties prop(this);  prop.LoadFromCommandString(pszImage);  VTRACE(_T("From command string %s\n"),pszImage);  return true;}void CTestResource::Chain(){  ENTERCRITICAL;  nCount++;  m_pNextInstance=pFirstInstance;  if(m_pNextInstance){    m_pNextInstance->m_pPrevInstance=this;  }  m_pPrevInstance=0;  pFirstInstance=this;  LEAVECRITICAL;}bool CTestResource::Matches  (const CeCosTest::ExecutionParameters &e,bool bIgnoreLocking) const{  return (bIgnoreLocking||(!m_bLocked)) && (0==_tcsicmp(e.PlatformName(),m_Target)); };CeCosTest::ServerStatus CTestResource::Query() {  CeCosTest::ExecutionParameters e(CeCosTest::ExecutionParameters::QUERY,m_Target);  CeCosSocket *pSock=0;  CeCosTest::ServerStatus s=CeCosTest::Connect(HostPort(),pSock,e,m_strInfo);  delete pSock;  return s;}int CTestResource::Count(const CeCosTest::ExecutionParameters &e){  int nCount=0;  for(const CTestResource *p=pFirstInstance;p;p=p->m_pNextInstance){    if(p->Matches(e)){      nCount++;    }  }  return nCount;}bool CTestResource::Use(){  bool rc;  ENTERCRITICAL;  if(m_bInUse){    rc=false;  } else {    m_bInUse=true;    rc=true;  }  LEAVECRITICAL;  return rc;}CTestResource *CTestResource::GetResource (const CeCosTest::ExecutionParameters &e){  CTestResource *p=0;  if(0==Count(e)){    ERROR(_T("GetResource: no candidates available\n"));  } else {    ENTERCRITICAL;    for(p=pFirstInstance;p;p=p->m_pNextInstance){      if(p->Matches(e) && !p->m_bInUse){        TRACE(_T("Acquired %s\n"),p->Serial());				    p->Use();            break;      }    }    LEAVECRITICAL;  }  return p;}const String CTestResource::Image() const{  String str;  str.Format(_T("%10s %20s %8s"),(LPCTSTR)HostPort(),(LPCTSTR)Target(),(LPCTSTR)Serial());  if(IsLocked()){    str+=_T(" [RL]");  }  return str;}bool CTestResource::Matches(LPCTSTR pszHostPort, const CeCosTest::ExecutionParameters &e){  bool rc=false;  ENTERCRITICAL;  if(Load()){    CTestResource *pResource=Lookup(pszHostPort);    if(pResource){      rc=pResource->Matches(e);    }  }  LEAVECRITICAL;  return rc;}CResetAttributes::ResetResult CTestResource::Reset(LogFunc *pfnLog, void *pfnLogparam){  String strReset;  strReset.Format(_T("port(%s,%d) %s"),Serial(),Baud(),ResetString());  return CResetAttributes(strReset).Reset(pfnLog,pfnLogparam);}CResetAttributes::ResetResult CTestResource::Reset(String &str){  return Reset(StringLogFunc,&str);}void CALLBACK CTestResource::StringLogFunc (void *pParam,LPCTSTR psz){  *((String *)pParam)+=psz;}CResetAttributes::ResetResult CTestResource::RemoteReset(LogFunc *pfnLog, void *pfnLogparam){  String strHost;  int nPort;  CeCosSocket::ParseHostPort(HostPort(),strHost,nPort);  String strCmd;  strCmd.Format(_T("rsh %s x10reset %s\n"),(LPCTSTR)strHost,ResetString());  pfnLog(pfnLogparam,strCmd);  CSubprocess sp;  sp.Run(pfnLog,pfnLogparam,strCmd);  return CResetAttributes::RESET_OK; // FIXME}String CTestResource::FileName() const{  String strHost;  int nPort;  CeCosSocket::ParseHostPort(HostPort(),strHost,nPort);  return String::SFormat(_T("%s-%d"),(LPCTSTR)strHost,nPort);}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
99re8在线精品视频免费播放| 性欧美大战久久久久久久久| 国产乱码一区二区三区| 精品国产乱码久久久久久久久| 免费观看在线综合| 欧美精品一区二区不卡 | 欧美四级电影网| 亚洲一区二区欧美| 欧美一区二区三区日韩视频| 奇米影视7777精品一区二区| 精品国产成人在线影院 | 国产精品一二三四区| 久久久久久久久久久99999| 国产盗摄女厕一区二区三区| 国产精品久久久久天堂| 在线观看日韩国产| 偷拍一区二区三区四区| 精品粉嫩aⅴ一区二区三区四区| 午夜婷婷国产麻豆精品| 欧美成人一区二区三区片免费 | 亚洲一区二区精品久久av| 91麻豆精品国产| 国产高清精品在线| 亚洲一区在线看| 精品国产伦一区二区三区观看方式| 国产a精品视频| 亚洲国产精品一区二区www在线| 日韩一区二区三区四区五区六区| 国产自产高清不卡| 亚洲精品欧美二区三区中文字幕| 欧美精品日日鲁夜夜添| 国产伦精品一区二区三区在线观看| 国产精品福利一区二区| 91精品国产美女浴室洗澡无遮挡| 国产高清无密码一区二区三区| 亚洲精品国产a| 欧美成人精品福利| 欧美性感一类影片在线播放| 国产在线不卡视频| 亚洲图片欧美色图| 中文字幕欧美国产| 欧美日韩成人一区| 免费成人在线视频观看| 亚洲图片另类小说| 久久久激情视频| 欧美日本一道本在线视频| 成人激情免费电影网址| 美日韩一级片在线观看| 亚洲激情网站免费观看| 久久久久久久国产精品影院| 欧美日韩精品二区第二页| jizzjizzjizz欧美| 激情都市一区二区| 日精品一区二区三区| 亚洲男人都懂的| 国产亚洲欧美一区在线观看| 3d成人动漫网站| 在线精品国精品国产尤物884a| 国产999精品久久| 久久www免费人成看片高清| 亚洲成年人网站在线观看| 国产精品久久二区二区| 国产人成亚洲第一网站在线播放| 欧美精品一二三区| 欧美撒尿777hd撒尿| 91浏览器打开| 99九九99九九九视频精品| 国产电影一区二区三区| 精品中文字幕一区二区小辣椒| 婷婷成人综合网| 亚洲成人av在线电影| 亚洲欧美日韩国产另类专区| 国产精品毛片高清在线完整版| 欧美精品一区二区三区高清aⅴ | 亚洲女爱视频在线| 国产精品免费看片| 久久精品亚洲麻豆av一区二区| 日韩一级黄色片| 日韩午夜激情视频| 日韩欧美中文字幕精品| 国产精品免费视频观看| 久久久精品人体av艺术| 精品欧美乱码久久久久久1区2区| 欧美一级日韩免费不卡| 欧美一级淫片007| 欧美一个色资源| 日韩免费性生活视频播放| 欧美一卡二卡在线观看| 精品久久久久99| 久久精品夜色噜噜亚洲a∨| 久久久不卡影院| 国产欧美一区二区精品婷婷| 久久久国产精品不卡| 亚洲欧美在线视频| 一区二区三区国产豹纹内裤在线 | 日韩一区和二区| 欧美精品一区二区三区在线| 中文字幕久久午夜不卡| 中文字幕制服丝袜成人av| 亚洲乱码中文字幕综合| 午夜日韩在线观看| 精品一区二区三区在线观看国产 | 欧美日韩一级片网站| 日韩一区国产二区欧美三区| 欧美不卡激情三级在线观看| 国产欧美一区二区精品婷婷| 亚洲视频图片小说| 婷婷一区二区三区| 国产综合色产在线精品| 99天天综合性| 777a∨成人精品桃花网| 国产欧美一区二区精品秋霞影院| 综合久久国产九一剧情麻豆| 午夜私人影院久久久久| 国产一区二区不卡在线| 91极品美女在线| 精品国产一二三| 亚洲色图制服诱惑 | 91无套直看片红桃| 91麻豆精品国产91久久久使用方法 | 精品在线观看视频| av一二三不卡影片| 欧美日韩国产在线观看| 久久久99久久| 亚洲国产aⅴ天堂久久| 国产麻豆欧美日韩一区| 欧美亚洲禁片免费| 国产区在线观看成人精品| 亚洲不卡在线观看| 成人午夜精品一区二区三区| 欧美精品日韩一区| 一区在线播放视频| 精品一区二区三区欧美| 在线观看视频一区二区| 欧美激情资源网| 日韩不卡手机在线v区| 91官网在线观看| 国产人久久人人人人爽| 久国产精品韩国三级视频| 欧美在线免费观看视频| 国产精品网站在线观看| 久久 天天综合| 久久久久久久久久久电影| 亚洲成人av资源| 91福利视频在线| 国产精品乱码久久久久久 | 国产制服丝袜一区| 欧美精品777| 一片黄亚洲嫩模| 99免费精品在线观看| 久久免费偷拍视频| 麻豆精品一区二区综合av| 欧美亚洲国产怡红院影院| 国产精品国产精品国产专区不蜜| 久久国产麻豆精品| 日韩久久精品一区| 日韩av电影天堂| 欧美疯狂性受xxxxx喷水图片| 亚洲日本va在线观看| 成人午夜在线视频| 国产欧美日本一区二区三区| 韩日欧美一区二区三区| 精品福利一区二区三区| 久久se这里有精品| 久久综合久久综合久久| 狠狠v欧美v日韩v亚洲ⅴ| 日韩欧美亚洲国产另类| 美女网站在线免费欧美精品| 欧美精品vⅰdeose4hd| 日韩综合在线视频| 欧美二区三区91| 日本一区中文字幕| 日韩一二三四区| 久久电影网电视剧免费观看| 日韩欧美国产综合| 精品系列免费在线观看| 久久久久久久性| 成人免费av网站| 中文字幕巨乱亚洲| 91视视频在线直接观看在线看网页在线看| 亚洲国产精品传媒在线观看| av高清不卡在线| 有坂深雪av一区二区精品| 欧美日韩国产一二三| 蜜臀av一区二区在线免费观看 | 亚洲国产成人av| 欧美一区2区视频在线观看| 韩国视频一区二区| 国产精品你懂的在线| 欧美主播一区二区三区美女| 日韩中文字幕一区二区三区| 日韩无一区二区| 成人av在线电影| 亚洲一二三四久久| 日韩欧美国产1| 99re这里只有精品首页| 亚洲一二三四久久| 欧美v日韩v国产v| 99精品桃花视频在线观看| 亚洲成人黄色影院|