e32tools/elf2e32/source/parametermanager.cpp
changeset 20 f2446ffbf2b5
parent 11 d610106f78c9
--- a/e32tools/elf2e32/source/parametermanager.cpp	Fri Jun 04 13:19:09 2010 +0100
+++ b/e32tools/elf2e32/source/parametermanager.cpp	Sun Jun 13 16:27:09 2010 +0100
@@ -9,6 +9,7 @@
 // Nokia Corporation - initial contribution.
 //
 // Contributors:
+// Mike Kinghan, mikek@symbian.org, for Symbian Foundation, 2010
 //
 // Description:
 // Implementation of the Class ParameterManager for the elf2e32 tool
@@ -24,7 +25,7 @@
 #include "pl_common.h"
 #include "parametermanager.h"
 #include "errorhandler.h"
-#include <iostream>
+#include <iostream>
 #include <cstdlib>
 
 #include "h_utl.h"
@@ -111,7 +112,8 @@
 	iCustomDllTarget(false),
 	iSymNamedLookup(false),
 	iDebuggable(false),
-	iSmpSafe(false)
+	iSmpSafe(false),
+	iAsmDialect(EGas)
 {
 	iArgumentCount = aArgc;
 	ParamList temp(aArgv, aArgv+aArgc);
@@ -430,6 +432,12 @@
 		(void*)ParameterManager::ParseSmpSafe,
 		"SMP Safe",
 	},
+	{
+		"asm",
+		(void*)ParameterManager::ParseAsmDialect,
+		"Dialect of arm assembly to write for the --dump option. "
+		"Either \"gas\" (GNU as: default) or \"armas\" (RVCT as)",
+	},
 	{ 
 		"help", 
 		(void *)ParameterManager::ParamHelp,
@@ -1509,6 +1517,21 @@
 }
 
 /**
+This function indicates the asm assembly dialect that will be written for the
+--dump option, as determined by the specified or default value of the --asm
+option.
+
+@internalComponent
+@released
+
+@return EArmas if --asm=armas was passed, else EGas
+*/
+EAsmDialect ParameterManager::AsmDialect()
+{
+	return iAsmDialect;
+}
+
+/**
 This function extracts the filename from the absolute path that is given as input.
 
 @internalComponent
@@ -2847,6 +2870,23 @@
 	aPM->SetSmpSafe(true); 
 }
 
+DEFINE_PARAM_PARSER(ParameterManager::ParseAsmDialect)
+{
+	INITIALISE_PARAM_PARSER;
+	if (!strcmp(aValue,"gas"))
+	{
+		aPM->SetAsmDialect(EGas); 
+	}
+	else if (!strcmp(aValue,"armas"))
+	{
+		aPM->SetSmpSafe(EArmas); 
+	}
+	else
+	{
+		throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, "--asm");
+	} 
+}
+
 static const ParameterManager::TargetTypeDesc DefaultTargetTypes[] =
 {
 	{ "DLL", EDll },
@@ -3729,3 +3769,18 @@
 {
 	iSmpSafe = aVal;
 }
+
+/**
+This function sets iAsmDialect if --asm is passed in.
+
+@internalComponent
+@released
+
+@param aVal
+A member of enum EAsmDialect
+*/
+void ParameterManager::SetAsmDialect(EAsmDialect aAsmDialect)
+{
+	iAsmDialect = aAsmDialect;
+}
+