e32tools/elf2e32/source/parametermanager.cpp
changeset 20 f2446ffbf2b5
parent 11 d610106f78c9
equal deleted inserted replaced
19:d2fccb2bbe1a 20:f2446ffbf2b5
     7 //
     7 //
     8 // Initial Contributors:
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
     9 // Nokia Corporation - initial contribution.
    10 //
    10 //
    11 // Contributors:
    11 // Contributors:
       
    12 // Mike Kinghan, mikek@symbian.org, for Symbian Foundation, 2010
    12 //
    13 //
    13 // Description:
    14 // Description:
    14 // Implementation of the Class ParameterManager for the elf2e32 tool
    15 // Implementation of the Class ParameterManager for the elf2e32 tool
    15 // @internalComponent
    16 // @internalComponent
    16 // @released
    17 // @released
   109 	
   110 	
   110 	iExcludeUnwantedExports(false),
   111 	iExcludeUnwantedExports(false),
   111 	iCustomDllTarget(false),
   112 	iCustomDllTarget(false),
   112 	iSymNamedLookup(false),
   113 	iSymNamedLookup(false),
   113 	iDebuggable(false),
   114 	iDebuggable(false),
   114 	iSmpSafe(false)
   115 	iSmpSafe(false),
       
   116 	iAsmDialect(EGas)
   115 {
   117 {
   116 	iArgumentCount = aArgc;
   118 	iArgumentCount = aArgc;
   117 	ParamList temp(aArgv, aArgv+aArgc);
   119 	ParamList temp(aArgv, aArgv+aArgc);
   118 	iParamList = temp;
   120 	iParamList = temp;
   119 	iCapability.iCaps[0] = 0;	
   121 	iCapability.iCaps[0] = 0;	
   427 	},
   429 	},
   428 	{
   430 	{
   429 		"smpsafe",
   431 		"smpsafe",
   430 		(void*)ParameterManager::ParseSmpSafe,
   432 		(void*)ParameterManager::ParseSmpSafe,
   431 		"SMP Safe",
   433 		"SMP Safe",
       
   434 	},
       
   435 	{
       
   436 		"asm",
       
   437 		(void*)ParameterManager::ParseAsmDialect,
       
   438 		"Dialect of arm assembly to write for the --dump option. "
       
   439 		"Either \"gas\" (GNU as: default) or \"armas\" (RVCT as)",
   432 	},
   440 	},
   433 	{ 
   441 	{ 
   434 		"help", 
   442 		"help", 
   435 		(void *)ParameterManager::ParamHelp,
   443 		(void *)ParameterManager::ParamHelp,
   436 		0,
   444 		0,
  1507 {
  1515 {
  1508 	return iSmpSafe;
  1516 	return iSmpSafe;
  1509 }
  1517 }
  1510 
  1518 
  1511 /**
  1519 /**
       
  1520 This function indicates the asm assembly dialect that will be written for the
       
  1521 --dump option, as determined by the specified or default value of the --asm
       
  1522 option.
       
  1523 
       
  1524 @internalComponent
       
  1525 @released
       
  1526 
       
  1527 @return EArmas if --asm=armas was passed, else EGas
       
  1528 */
       
  1529 EAsmDialect ParameterManager::AsmDialect()
       
  1530 {
       
  1531 	return iAsmDialect;
       
  1532 }
       
  1533 
       
  1534 /**
  1512 This function extracts the filename from the absolute path that is given as input.
  1535 This function extracts the filename from the absolute path that is given as input.
  1513 
  1536 
  1514 @internalComponent
  1537 @internalComponent
  1515 @released
  1538 @released
  1516 
  1539 
  2843 DEFINE_PARAM_PARSER(ParameterManager::ParseSmpSafe)
  2866 DEFINE_PARAM_PARSER(ParameterManager::ParseSmpSafe)
  2844 {
  2867 {
  2845 	INITIALISE_PARAM_PARSER;
  2868 	INITIALISE_PARAM_PARSER;
  2846 	CheckInput(aValue, "--smpsafe");
  2869 	CheckInput(aValue, "--smpsafe");
  2847 	aPM->SetSmpSafe(true); 
  2870 	aPM->SetSmpSafe(true); 
       
  2871 }
       
  2872 
       
  2873 DEFINE_PARAM_PARSER(ParameterManager::ParseAsmDialect)
       
  2874 {
       
  2875 	INITIALISE_PARAM_PARSER;
       
  2876 	if (!strcmp(aValue,"gas"))
       
  2877 	{
       
  2878 		aPM->SetAsmDialect(EGas); 
       
  2879 	}
       
  2880 	else if (!strcmp(aValue,"armas"))
       
  2881 	{
       
  2882 		aPM->SetSmpSafe(EArmas); 
       
  2883 	}
       
  2884 	else
       
  2885 	{
       
  2886 		throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, "--asm");
       
  2887 	} 
  2848 }
  2888 }
  2849 
  2889 
  2850 static const ParameterManager::TargetTypeDesc DefaultTargetTypes[] =
  2890 static const ParameterManager::TargetTypeDesc DefaultTargetTypes[] =
  2851 {
  2891 {
  2852 	{ "DLL", EDll },
  2892 	{ "DLL", EDll },
  3727 
  3767 
  3728 void ParameterManager::SetSmpSafe(bool aVal)
  3768 void ParameterManager::SetSmpSafe(bool aVal)
  3729 {
  3769 {
  3730 	iSmpSafe = aVal;
  3770 	iSmpSafe = aVal;
  3731 }
  3771 }
       
  3772 
       
  3773 /**
       
  3774 This function sets iAsmDialect if --asm is passed in.
       
  3775 
       
  3776 @internalComponent
       
  3777 @released
       
  3778 
       
  3779 @param aVal
       
  3780 A member of enum EAsmDialect
       
  3781 */
       
  3782 void ParameterManager::SetAsmDialect(EAsmDialect aAsmDialect)
       
  3783 {
       
  3784 	iAsmDialect = aAsmDialect;
       
  3785 }
       
  3786