cdlcompiler/src/CdlCompiler.cpp
changeset 1 b700e12870ca
parent 0 f58d6ec98e88
equal deleted inserted replaced
0:f58d6ec98e88 1:b700e12870ca
    20 #include <algorithm>
    20 #include <algorithm>
    21 #include <iostream>
    21 #include <iostream>
    22 #include <list>
    22 #include <list>
    23 #include <sstream>
    23 #include <sstream>
    24 #include <iomanip>
    24 #include <iomanip>
       
    25 #include <memory>
       
    26 
       
    27 #ifdef __MSVCRT__
    25 #include <direct.h>
    28 #include <direct.h>
    26 #include <cdlcompilertoolkit/cdltkutil.h>
    29 #endif
    27 #include <cdlcompilertoolkit/cdltkprocess.h>
    30 
       
    31 #include <CdlCompilerToolkit/CdlTkUtil.h>
       
    32 #include <CdlCompilerToolkit/CdlTkProcess.h>
       
    33 #include <CdlCompilerToolkit/CdlCompat.h>
    28 using namespace std;
    34 using namespace std;
    29 using namespace CdlCompilerToolkit;
    35 using namespace CdlCompilerToolkit;
    30 
    36 
    31 #ifndef _DEBUG
    37 #ifndef _DEBUG
    32 #define EXCEPTION_HANDLING
    38 #define EXCEPTION_HANDLING
   212 
   218 
   213 	++pArg;
   219 	++pArg;
   214 	if (pArg == aArgs.end())
   220 	if (pArg == aArgs.end())
   215 		throw MainArgsErr("Missing package instance id");
   221 		throw MainArgsErr("Missing package instance id");
   216 
   222 
   217 	if (count_if(pArg->begin(), pArg->end(), CdlTkUtil::IsNumeric) == pArg->size())
   223 	if (count_if(pArg->begin(), pArg->end(), CdlTkUtil::IsNumeric) == static_cast<signed int>( pArg->size()) )
   218 		{
   224 		{
   219 		pckg.SetId(CdlTkUtil::ParseInt(*pArg));
   225 		pckg.SetId(CdlTkUtil::ParseInt(*pArg));
   220 		++pArg;
   226 		++pArg;
   221 		}
   227 		}
   222 
   228 
   365 
   371 
   366 class CCompareModeChecker : public MCdlTkApiCheckObserver
   372 class CCompareModeChecker : public MCdlTkApiCheckObserver
   367 	{
   373 	{
   368 public:
   374 public:
   369 	CCompareModeChecker(const string& aLeft, const string& aRight);
   375 	CCompareModeChecker(const string& aLeft, const string& aRight);
       
   376 	virtual ~CCompareModeChecker();
   370 	virtual void StartCheck();
   377 	virtual void StartCheck();
   371 	virtual void CheckComplete();
   378 	virtual void CheckComplete();
   372 	virtual void ApiInBoth(const CCdlTkApi& aApi);
   379 	virtual void ApiInBoth(const CCdlTkApi& aApi);
   373 	virtual void ApiNotInLeft(const CCdlTkApi& aApi);
   380 	virtual void ApiNotInLeft(const CCdlTkApi& aApi);
   374 	virtual void ApiNotInRight(const CCdlTkApi& aApi);
   381 	virtual void ApiNotInRight(const CCdlTkApi& aApi);
   375 
   382 	
   376 private:
   383 private:
   377 	int iErrs;
   384 	int iErrs;
   378 	string iLeft;
   385 	string iLeft;
   379 	string iRight;
   386 	string iRight;
   380 	};
   387 	};
   381 
   388 
   382 CCompareModeChecker::CCompareModeChecker(const string& aLeft, const string& aRight)
   389 CCompareModeChecker::CCompareModeChecker(const string& aLeft, const string& aRight)
   383 : iLeft(aLeft), iRight(aRight)
   390 : iLeft(aLeft), iRight(aRight)
   384 	{
   391 	{
   385 	}
   392 	}
       
   393 
       
   394 CCompareModeChecker:: ~CCompareModeChecker()
       
   395     {
       
   396 
       
   397     }
   386 
   398 
   387 void CCompareModeChecker::StartCheck()
   399 void CCompareModeChecker::StartCheck()
   388 	{
   400 	{
   389 	iErrs = 0;
   401 	iErrs = 0;
   390 	}
   402 	}
   567 	// process mode arg
   579 	// process mode arg
   568 	auto_ptr<CCompilerMode> mode;
   580 	auto_ptr<CCompilerMode> mode;
   569 	if (*pArg == "client")
   581 	if (*pArg == "client")
   570 		{
   582 		{
   571 		mode = auto_ptr<CCompilerMode>(new CClientMode);
   583 		mode = auto_ptr<CCompilerMode>(new CClientMode);
   572 		CdlTkUtil::SetOutputPath(CdlTkUtil::CurrentDrive() + "\\epoc32\\include\\");
   584 		CdlTkUtil::SetOutputPath(CdlTkUtil::CurrentDrive() +PATHSEP+"epoc32"+PATHSEP+"include"+PATHSEP);
   573 		}
   585 		}
   574 	else if (*pArg == "instance")
   586 	else if (*pArg == "instance")
   575 		{
   587 		{
   576 		mode = auto_ptr<CCompilerMode>(new CInstanceMode);
   588 		mode = auto_ptr<CCompilerMode>(new CInstanceMode);
   577 		}
   589 		}