e32tools/elf2e32/source/parametermanager.cpp
changeset 0 044383f39525
child 589 851206cea67b
child 590 360bd6b35136
child 606 30b30f9da0b7
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Implementation of the Class ParameterManager for the elf2e32 tool
       
    15 // @internalComponent
       
    16 // @released
       
    17 // 
       
    18 //
       
    19 
       
    20 // This must go before ParameterManager.h
       
    21 #define __INCLUDE_CAPABILITY_NAMES__
       
    22 #include <e32capability.h>
       
    23 
       
    24 #include "pl_common.h"
       
    25 #include "parametermanager.h"
       
    26 #include "errorhandler.h"
       
    27 #include <iostream>
       
    28 
       
    29 #include "h_utl.h"
       
    30 #include "h_ver.h"
       
    31 /**
       
    32 Constructor for the ParameterManager.
       
    33 
       
    34 @internalComponent
       
    35 @released
       
    36 
       
    37 @param aArgc
       
    38  The number of command line arguments passed into the program
       
    39 @param aArgv
       
    40  The listing of all the arguments
       
    41 */
       
    42 ParameterManager::ParameterManager(int aArgc, char** aArgv) :
       
    43 	iArgc(aArgc),
       
    44 	iArgv(aArgv),
       
    45 	iImageLocation(0), 
       
    46 	iImageName(0),
       
    47 	iTargetTypeOption(false), 
       
    48 	iDefFileInOption(false),
       
    49 	iDefFileOutOption(false), 
       
    50 	iFileDumpOption(false),		
       
    51 	iDSOFileOutOption(false), 
       
    52 	iOutFileOption(false),
       
    53 	iElfFileInOption(false),
       
    54 	iE32ImageInOption(false),			
       
    55 	iLinkAsOption(false),
       
    56 	iUid1Option(false), 	
       
    57 	iSecureIDOption(false), 
       
    58 	iVendorIDOption(false),
       
    59 	iUID1(0), 
       
    60 	iUID2(0), 
       
    61 	iUID3(0),
       
    62 	iSecureID(0),
       
    63 	iVendorID(0),
       
    64 	iCompress(true),
       
    65 	iCompressionMethod(KUidCompressionDeflate),
       
    66 	iFixedAddress(false),
       
    67 	iHeapCommittedSize(0x1000),
       
    68 	iHeapReservedSize(0x100000),	
       
    69 	iStackCommittedSize(0x2000),
       
    70 	iUnfrozen(false),
       
    71 	iIgnoreNonCallable(false),
       
    72 	iTargetTypeName(ETargetTypeNotSet),	
       
    73 	iDefOutput(0),
       
    74 	iDSOOutput(0),	
       
    75 	iOutFileName(0),
       
    76 	iDefInput(0),		
       
    77 	iElfInput(0),
       
    78 	iE32Input(0),
       
    79 	iLinkDLLName(0),
       
    80 	iDumpOptions(EDumpDefaults),
       
    81 	iFileDumpSubOptions(0),	
       
    82 	iSysDefOption(false),
       
    83 	iLogFileName(0),
       
    84 	iLogFileOption(false),
       
    85 	iMessageFileName(0),
       
    86 	iMessageFileOption(false),		
       
    87 	iDumpMessageFileName(0),	
       
    88 	iDumpMessageFileOption(false),
       
    89 	iDllDataP(false),	
       
    90 	iLibPathList (0),	
       
    91 	iSysDefCount (0),	
       
    92 	iPriorityOption(false),
       
    93 	iPriorityVal((TProcessPriority)0),
       
    94 	iVersion(0x000a0000u),
       
    95 	iVersionOption(false),
       
    96 	iCallEntryPoint(true),
       
    97 	iFPU(0),
       
    98 	iFPUOption(false),
       
    99 	iArgumentCount(0),
       
   100 
       
   101 	iCodePaged(false),
       
   102 	iCodeUnpaged(false),
       
   103 	iCodeDefaultPaged(false),
       
   104 
       
   105 	iDataPaged(false),
       
   106 	iDataUnpaged(false),
       
   107 	iDataDefaultPaged(false),
       
   108 	
       
   109 	iExcludeUnwantedExports(false),
       
   110 	iCustomDllTarget(false),
       
   111 	iSymNamedLookup(false),
       
   112 	iDebuggable(false),
       
   113 	iSmpSafe(false)
       
   114 {
       
   115 	iArgumentCount = aArgc;
       
   116 	ParamList temp(aArgv, aArgv+aArgc);
       
   117 	iParamList = temp;
       
   118 	iCapability.iCaps[0] = 0;	
       
   119 	iCapability.iCaps[1] = 0;
       
   120 }
       
   121 
       
   122 /**
       
   123 Destructor for the ParameterManager.
       
   124 
       
   125 @internalComponent
       
   126 @released
       
   127 */
       
   128 ParameterManager::~ParameterManager()
       
   129 {
       
   130 	DELETE_PTR_ARRAY(iImageLocation);
       
   131 }
       
   132 
       
   133 /**
       
   134 Function to check if the given value is a valid number (decimal value)
       
   135 
       
   136 @internalComponent
       
   137 @released
       
   138 
       
   139 @param aArg
       
   140 Value to be checked
       
   141 @return True if the provided value is a decimal value.
       
   142 */
       
   143 static bool IsAllDigits(const char * aArg)
       
   144 {
       
   145 	const char * p = aArg;
       
   146 	while (*p)
       
   147 	{
       
   148 		if (!isdigit(*p++)) return false;
       
   149 	}
       
   150 	return true;	
       
   151 }
       
   152 
       
   153 /**
       
   154 Function to check if the given value is a valid number (Hexadecimal value)
       
   155 
       
   156 @internalComponent
       
   157 @released
       
   158 
       
   159 @param aArg
       
   160 Value to be checked
       
   161 @return True if the provided value is a hexadecimal value.
       
   162 */
       
   163 static bool IsAllXDigits(const char * aArg)
       
   164 {
       
   165 	const char * p = aArg;
       
   166 	while (*p)
       
   167 	{
       
   168 		if (!isxdigit(*p++)) return false;
       
   169 	}
       
   170 	return true;	
       
   171 }
       
   172 
       
   173 /**
       
   174 Function to check if the given value is a valid number (Decimal or Hexadecimal value)
       
   175 
       
   176 @internalComponent
       
   177 @released
       
   178 
       
   179 @param aVal
       
   180 Holds the validated number.
       
   181 @param aArg
       
   182 Value to be checked
       
   183 @return True if the provided value is a valid number.
       
   184 */
       
   185 static bool GetUInt(UINT & aVal, const char * aArg)
       
   186 {
       
   187 	char * final = (char *)aArg;
       
   188 	// try base 10 first
       
   189 	if (IsAllDigits(aArg))
       
   190 	{
       
   191 		aVal = strtoul(aArg, &final, 10);
       
   192 		if (aArg != final) return true;
       
   193 		// now try as hex
       
   194 	}
       
   195 	if (aArg[0] == '0' && (aArg[1] == 'x' || aArg[1] == 'X'))
       
   196 	{
       
   197 		aArg += 2;
       
   198 		if (IsAllXDigits(aArg))
       
   199 		{
       
   200 			final = (char *)aArg ;
       
   201 			aVal = strtoul(aArg, &final, 16);
       
   202 			if (aArg != final) return true;
       
   203 		}
       
   204 	}
       
   205 
       
   206 	return false;
       
   207 }
       
   208 
       
   209 const char * ParameterManager::iParamPrefix = "--";
       
   210 const char * ParameterManager::iParamShortPrefix = "-";
       
   211 const char ParameterManager::iParamEquals = '=';
       
   212 
       
   213 // Option Map
       
   214 const ParameterManager::OptionDesc ParameterManager::iOptions[] = 
       
   215 {
       
   216 	{ 
       
   217 		"definput", 
       
   218 		(void *)ParameterManager::ParseDefInput,
       
   219 		"Input DEF File",
       
   220 	},
       
   221 	{ 
       
   222 		"defoutput", 
       
   223 		(void *)ParameterManager::ParseDefOutput,
       
   224 		"Output DEF File",
       
   225 	},
       
   226 	{ 
       
   227 		"elfinput", 
       
   228 		(void *)ParameterManager::ParseElfInput,
       
   229 		"Input ELF File",
       
   230 	},
       
   231 	{ 
       
   232 		"output", 
       
   233 		(void *)ParameterManager::ParseOutput,
       
   234 		"Output E32 Image",
       
   235 	},
       
   236 	{ 
       
   237 		"dso", 
       
   238 		(void *)ParameterManager::ParseDSOOutput,
       
   239 		"Output import DSO File",
       
   240 	},
       
   241 	{ 
       
   242 		"targettype", 
       
   243 		(void *)ParameterManager::ParseTargetTypeName,
       
   244 		"Target Type",
       
   245 	},
       
   246 	{ 
       
   247 		"linkas", 
       
   248 		(void *)ParameterManager::ParseLinkAs,
       
   249 		"name",
       
   250 	},
       
   251 	{ 
       
   252 		"uid1", 
       
   253 		(void *)ParameterManager::ParseUID1,
       
   254 		"UID 1",
       
   255 	},
       
   256 	{ 
       
   257 		"uid2", 
       
   258 		(void *)ParameterManager::ParseUID2,
       
   259 		"UID 2",
       
   260 	},
       
   261 	{ 
       
   262 		"uid3", 
       
   263 		(void *)ParameterManager::ParseUID3,
       
   264 		"UID 3",
       
   265 	},
       
   266 	{ 
       
   267 		"sid", 
       
   268 		(void *)ParameterManager::ParseSecureId,
       
   269 		"Secure ID",
       
   270 	},
       
   271 	{ 
       
   272 		"vid", 
       
   273 		(void *)ParameterManager::ParseVendorId,
       
   274 		"Vendor ID",
       
   275 	},
       
   276 	{ 
       
   277 		"fixedaddress", 
       
   278 		(void *)ParameterManager::ParseFixedAddress,
       
   279 		"Has fixed address",
       
   280 		},
       
   281 	{ 
       
   282 		"uncompressed", 
       
   283 		(void *)ParameterManager::ParseUncompressed,
       
   284 		"Don't compress output e32image",
       
   285 		},
       
   286 	{
       
   287 		"compressionmethod",
       
   288 		(void*)ParameterManager::ParseCompressionMethod,
       
   289 		"Input compression method [none|inflate|bytepair]\n\t\tnone     no compress the image.\
       
   290 		\n\t\tinflate  compress image with Inflate algorithm.\
       
   291 		\n\t\tbytepair tcompress image with BytePair Pak algorithm."
       
   292 	},
       
   293 	{ 
       
   294 		"heap", 
       
   295 		(void *)ParameterManager::ParseHeap,
       
   296 		"Heap committed and reserved size in bytes(.EXEs only)",
       
   297 	},
       
   298 	{ 
       
   299 		"stack", 
       
   300 		(void *)ParameterManager::ParseStackCommitted,
       
   301 		"Stack size in bytes(.EXEs only)",
       
   302 	},
       
   303 	{ 
       
   304 		"unfrozen", 
       
   305 		(void *)ParameterManager::ParseUnfrozen,
       
   306 		"Don't treat input dot-def file as frozen",
       
   307 	},
       
   308 	{ 
       
   309 		"ignorenoncallable", 
       
   310 		(void *)ParameterManager::ParseIgnoreNonCallable,
       
   311 		"Suppress implicit exports",
       
   312 	},
       
   313 	{
       
   314 		"capability",
       
   315 		(void *)ParameterManager::ParseCapability,
       
   316 		"capability option",
       
   317 	},
       
   318 	{ 
       
   319 		"libpath", 
       
   320 		(void *)ParameterManager::ParseLibPaths,
       
   321 		"A semi-colon separated search path list to locate import DSOs",
       
   322 	},
       
   323 	{
       
   324 		"sysdef",
       
   325 		(void *)ParameterManager::ParseSysDefs,
       
   326 		"A semi-colon separated Pre Defined Symbols to be exported and the ordinal number",
       
   327 	},
       
   328 	{
       
   329 		"log",
       
   330 		(void *)ParameterManager::ParseLogFile,
       
   331 		"Output Log Message",
       
   332 	},
       
   333 	{
       
   334 		"messagefile",
       
   335 		(void *)ParameterManager::ParseMessageFile,
       
   336 		"Input Message File",
       
   337 	},
       
   338 	{
       
   339 		"dumpmessagefile",
       
   340 		(void *)ParameterManager::ParseDumpMessageFile,
       
   341 		"Output Message File",
       
   342 	},
       
   343 	{
       
   344 		"dlldata", 
       
   345 		(void *)ParameterManager::ParseAllowDllData,
       
   346 		"Allow writable static data in DLL",
       
   347 	},
       
   348 	{
       
   349 		"dump",
       
   350 		(void *)ParameterManager::ParseFileDump,
       
   351 		"Input dump options [hscdeit] --e32input <filename>\n\tFlags for dump:\n\t\th Header \
       
   352 		 \n\t\ts Security info\n\t\tc Code section\n\t\td Data section \
       
   353 		 \n\t\te Export info\n\t\ti Import table\n\t\tt Symbol Info",
       
   354 	},
       
   355 	{
       
   356 		"e32input",
       
   357 		(void *)ParameterManager::ParseE32ImageInput,
       
   358 		"Input E32 Image File Name",
       
   359 	},
       
   360 	{
       
   361 		"priority",
       
   362 		(void *)ParameterManager::ParsePriority,
       
   363 		"Input Priority",
       
   364 	},
       
   365 	{
       
   366 		"version",
       
   367 		(void *)ParameterManager::ParseVersion,
       
   368 		"Module Version",
       
   369 	},
       
   370 	{
       
   371 		"callentry",
       
   372 		(void *)ParameterManager::ParseCallEntryPoint,
       
   373 		"Call Entry Point",
       
   374 	},
       
   375 	{
       
   376 		"fpu",
       
   377 		(void *)ParameterManager::ParseFPU,
       
   378 		"FPU type [softvfp|vfpv2]",
       
   379 	},
       
   380 	{
       
   381         "codepaging",
       
   382 		(void *)ParameterManager::ParseCodePaging,
       
   383 		"Code Paging Strategy [paged|unpaged|default]",
       
   384 	},
       
   385 	{
       
   386         "datapaging",
       
   387 		(void *)ParameterManager::ParseDataPaging,
       
   388 		"Data Paging Strategy [paged|unpaged|default]",
       
   389 	},
       
   390 
       
   391 	{
       
   392 		"paged",
       
   393 		(void *)ParameterManager::ParsePaged,
       
   394 		"This option is deprecated. Use --codepaging=paged instead.",
       
   395 	},
       
   396 	{
       
   397 		"unpaged",
       
   398 		(void *)ParameterManager::ParseUnpaged,
       
   399 		"This option is deprecated. Use --codepaging=unpaged instead.",
       
   400 	},
       
   401 	{
       
   402 		"defaultpaged",
       
   403 		(void *)ParameterManager::ParseDefaultPaged,
       
   404 		"This option is deprecated. Use --codepaging=default instead.",
       
   405 	},
       
   406 
       
   407 	{
       
   408 		"excludeunwantedexports",
       
   409 		(void *)ParameterManager::ParseExcludeUnwantedExports,
       
   410 		"Exclude Unwanted Exports",
       
   411 	},
       
   412 	{
       
   413 		"customdlltarget",
       
   414 		(void *)ParameterManager::ParseIsCustomDllTarget,
       
   415 		"Custom Dll Target",
       
   416 	},
       
   417 	{
       
   418 		"namedlookup",
       
   419 		(void*)ParameterManager::ParseSymNamedLookup,
       
   420 		"Enable named lookup of symbols",
       
   421 	},
       
   422 	{
       
   423 		"debuggable",
       
   424 		(void*)ParameterManager::ParseDebuggable,
       
   425 		"Debuggable by run-mode debug subsystem",
       
   426 	},
       
   427 	{
       
   428 		"smpsafe",
       
   429 		(void*)ParameterManager::ParseSmpSafe,
       
   430 		"SMP Safe",
       
   431 	},
       
   432 	{ 
       
   433 		"help", 
       
   434 		(void *)ParameterManager::ParamHelp,
       
   435 		0,
       
   436 	},
       
   437 };
       
   438 
       
   439 // Map for the short options (abbreviation)
       
   440 const ParameterManager::OptionDesc ParameterManager::iShortOptions[] =
       
   441 {
       
   442 	{ 
       
   443 		"h", 
       
   444 		(void *)ParameterManager::ParamHelp,
       
   445 		0,
       
   446 	},
       
   447 };
       
   448 
       
   449 /**
       
   450 This function finds the total number of options with normal prefix ('--')
       
   451 
       
   452 @internalComponent
       
   453 @released
       
   454 
       
   455 @return the total number of options with normal prefix '--' in the option list.
       
   456 */
       
   457 int ParameterManager::NumOptions()
       
   458 {
       
   459 	return (sizeof(iOptions) / sizeof(OptionDesc));
       
   460 }
       
   461 
       
   462 /**
       
   463 This function finds the total number of options with short prefix ('-')
       
   464 
       
   465 @internalComponent
       
   466 @released
       
   467 
       
   468 @return the total number of options with short prefix '-' in the option list.
       
   469 */
       
   470 int ParameterManager::NumShortOptions()
       
   471 {
       
   472 	return (sizeof(iShortOptions) / sizeof(OptionDesc));
       
   473 }
       
   474 
       
   475 /**
       
   476 This function initializes the option list, options preceeded by '--' and '-'
       
   477 
       
   478 @internalComponent
       
   479 @released
       
   480 */
       
   481 void ParameterManager::InitParamParser()
       
   482 {
       
   483 	int lim = NumOptions();
       
   484 	int shortoptionlim = NumShortOptions();
       
   485 	int i;
       
   486 
       
   487  	for (i = 0; i < lim; i++)
       
   488 	{
       
   489 		string aOption = iOptions[i].iName;
       
   490 		iOptionMap[aOption] = &iOptions[i];
       
   491 	}
       
   492 
       
   493 	for (i = 0; i < shortoptionlim; i++)
       
   494 	{
       
   495 		string aShortOption = iShortOptions[i].iName;
       
   496 		iShortOptionMap[aShortOption] = &iShortOptions[i];
       
   497 	}
       
   498 }
       
   499 
       
   500 /**
       
   501 This function parses the command line options and identifies the input parameters.
       
   502 If no options or if --log is the only option passed in, then usage information will 
       
   503 be displayed.
       
   504 
       
   505 @internalComponent
       
   506 @released
       
   507 */
       
   508 void ParameterManager::ParameterAnalyser()
       
   509 {
       
   510 	InitParamParser();
       
   511 	const OptionDesc * aHelpDesc = iOptionMap["help"];
       
   512 	int prefixLen = strlen(iParamPrefix);
       
   513 	int prefixShortLen = strlen(iParamShortPrefix);
       
   514 	int ArgCount = iArgumentCount-1;
       
   515 	RecordImageLocation();
       
   516 	ParamList::iterator p = iParamList.begin()+1;
       
   517 
       
   518 	int OnlyLoggingOption = 0;
       
   519 	
       
   520 	// Have to have some arguments. Otherwise, assume this is a request for --help and display the usage information
       
   521 	if (p == iParamList.end())
       
   522 	{
       
   523 		ParserFn parser = (ParserFn)aHelpDesc->iParser ;
       
   524 		parser(this, "help", 0, aHelpDesc);
       
   525 	}
       
   526 
       
   527 	if ( (ArgCount ==1) && (!strncmp(*p,"--log",5)) )
       
   528 		OnlyLoggingOption = 1;
       
   529 
       
   530 	for (; p != iParamList.end(); p++)
       
   531 	{
       
   532 		int Prefix=0, ShortPrefix=0;
       
   533 		ArgCount--;
       
   534 		
       
   535 
       
   536 		// Check if the option provided is correct and display help on getting incorrect options
       
   537 		try 
       
   538 		{
       
   539 			if (!strncmp(*p, iParamPrefix, prefixLen))
       
   540 				Prefix = 1;
       
   541 			else if (!strncmp(*p, iParamShortPrefix, prefixShortLen))
       
   542 				ShortPrefix = 1;
       
   543 			else // Option is neither preceeded by '-' or by '--'
       
   544 				throw ParameterParserError(OPTIONNAMEERROR,*p);
       
   545 		}
       
   546 		catch (ErrorHandler& error) 
       
   547 		{ 
       
   548 			error.Report();
       
   549 			ParserFn parser = (ParserFn)aHelpDesc->iParser ;
       
   550 			parser(this, *p, 0, 0);
       
   551 		}
       
   552 		
       
   553 		char *option;
       
   554 		const OptionDesc * aDesc;
       
   555 		char * optval=NULL;
       
   556 
       
   557 		// Get the option name excluding the prefix, '-' or '--'if (Prefix)
       
   558 		if (Prefix)
       
   559 			{
       
   560  			option = *p + prefixLen;
       
   561 			}
       
   562  		else
       
   563 			{
       
   564 			option = *p + prefixShortLen;
       
   565 			}
       
   566 
       
   567 		char * pos = strchr(*p, iParamEquals);
       
   568 
       
   569 		char *end = pos ? pos : *p + strlen(*p);
       
   570 
       
   571 		string aName(option, end);
       
   572 		string optionval;
       
   573 
       
   574 		if (pos)
       
   575 		{
       
   576 			if (*end != 0 && (*(end+1) != NULL) )
       
   577 			{
       
   578 			// Check to ensure that optval points to the correct option value
       
   579 				optval=end+1;
       
   580 			}
       
   581 			if ( ((p+1) != iParamList.end()) && (**(p+1) != '-') )
       
   582 			{
       
   583 				pos = 0;
       
   584 			}
       
   585 		}
       
   586 		if ( !pos)
       
   587 		{
       
   588 			// The option is not immediately preceeded by '='
       
   589 			// Space may be used to separate the input option and the paramters
       
   590 			// '=' may be enclosed within space
       
   591 			//if ((p+1) != iParamList.end())
       
   592 			if (ArgCount != 0) //To find if we have consumed all the arguments
       
   593 			{
       
   594 				while ( ((p+1) != iParamList.end()) && (**(p+1) != '-') )
       
   595 				{
       
   596 					end = *(p+1);
       
   597 					if (*end == '=') 
       
   598 					{
       
   599 						if ( (*(end+1) != ' ') && (*(end+1) != NULL) )
       
   600 							// This is the case where '=' is preceeded by space.
       
   601 							optionval += end+1;
       
   602 					}
       
   603 					else
       
   604 					{
       
   605 						optionval += end;
       
   606 					}
       
   607 					p++;
       
   608 					ArgCount-- ;
       
   609 				}
       
   610 				if (optionval.length())
       
   611 				{
       
   612 					if (optval)
       
   613   						strcat(optval, optionval.c_str());
       
   614   					else
       
   615   					{
       
   616   						optval = new char[optionval.length()+1];
       
   617   						strcpy(optval, optionval.c_str());
       
   618   					}
       
   619 				}				
       
   620 			}
       
   621 		}
       
   622 	
       
   623 		if (Prefix)
       
   624 			aDesc = iOptionMap[aName];
       
   625 		else
       
   626 			aDesc = iShortOptionMap[aName];
       
   627 
       
   628 		ParserFn parser = aDesc ?(ParserFn)aDesc->iParser : (ParserFn)aHelpDesc->iParser ;
       
   629 		// NB aDesc might be NULL which tells help to exit with error.
       
   630 		try
       
   631 		{
       
   632 			if (!aDesc)
       
   633 				throw ParameterParserError(OPTIONNAMEERROR,*p);
       
   634 		}
       
   635 		catch (ErrorHandler& error) 
       
   636 		{ 
       
   637 			error.Report();
       
   638 			ParserFn parser = (ParserFn)aHelpDesc->iParser ;
       
   639 			parser(this, "help", 0, 0);
       
   640 		}
       
   641 
       
   642 		// If --log is the only option provided, then display the usage information
       
   643 		if (OnlyLoggingOption)
       
   644 		{
       
   645 			parser(this, (char *)aName.c_str(), optval, aDesc);
       
   646 			parser = (ParserFn)aHelpDesc->iParser ;
       
   647 			parser(this, "help", 0, 0);
       
   648 		}
       
   649 
       
   650 		parser(this, const_cast<char*>(aName.c_str()), optval, aDesc);
       
   651 	}
       
   652 }
       
   653 
       
   654 /**
       
   655 This function extracts the path
       
   656 
       
   657 @internalComponent
       
   658 @released
       
   659 
       
   660 @param aPathName
       
   661 The file path name
       
   662 
       
   663 @return the Path in case of valid path name, else 0.
       
   664 
       
   665 */
       
   666 char * ParameterManager::Path(char * aPathName)
       
   667 {
       
   668 	string str(aPathName);
       
   669 	size_t pos = str.find_last_of(DirectorySeparator());
       
   670 
       
   671 	if (pos < str.size())
       
   672 	{
       
   673 		char * aPath = new char[pos+2];
       
   674 		memcpy(aPath, aPathName, pos+1);
       
   675 		aPath[pos+1] = 0;
       
   676 		return aPath;
       
   677 	}
       
   678 	else
       
   679 		return (char *)0;
       
   680 }
       
   681 
       
   682 
       
   683 /**
       
   684 This function extracts the location where the image is to be dumped and the image name.
       
   685 
       
   686 @internalComponent
       
   687 @released
       
   688 */
       
   689 void ParameterManager::RecordImageLocation()
       
   690 {
       
   691 	iImageLocation = Path(iArgv[0]);
       
   692 	iImageName = FileName(iArgv[0]);
       
   693 }
       
   694 
       
   695 /**
       
   696 This function finds out if the --definput option is passed to the program.
       
   697 
       
   698 @internalComponent
       
   699 @released
       
   700 
       
   701 @return True if --definput option is passed in or False.
       
   702 */
       
   703 bool ParameterManager::DefFileInOption()
       
   704 {
       
   705 	return iDefFileInOption;
       
   706 }
       
   707 
       
   708 /**
       
   709 This function finds out if the --e32input option is passed to the program.
       
   710 
       
   711 @internalComponent
       
   712 @released
       
   713 
       
   714 @return True if --e32input option is passed in or False.
       
   715 */
       
   716 bool ParameterManager::E32ImageInOption()
       
   717 {
       
   718 	return iE32ImageInOption;
       
   719 }
       
   720 
       
   721 /**
       
   722 This function finds out if the --elfinput option is passed to the program.
       
   723 
       
   724 @internalComponent
       
   725 @released
       
   726 
       
   727 @return True if --elfinput option is passed in or False.
       
   728 */
       
   729 bool ParameterManager::ElfFileInOption()
       
   730 {
       
   731 	return iElfFileInOption;
       
   732 }
       
   733 
       
   734 /**
       
   735 This function finds out if the --dso option is passed to the program.
       
   736 
       
   737 @internalComponent
       
   738 @released
       
   739 
       
   740 @return True if --dso option is passed in or False.
       
   741 */
       
   742 bool ParameterManager::DSOFileOutOption()
       
   743 {
       
   744 	return iDSOFileOutOption;
       
   745 }
       
   746 
       
   747 /**
       
   748 This function finds out if the --defoutput option is passed to the program.
       
   749 
       
   750 @internalComponent
       
   751 @released
       
   752 
       
   753 @return True if --defoutput option is passed in or False.
       
   754 */
       
   755 bool ParameterManager::DefFileOutOption()
       
   756 {
       
   757 	return iDefFileOutOption;
       
   758 }
       
   759 
       
   760 /**
       
   761 This function finds out if the --output option is passed to the program.
       
   762 
       
   763 
       
   764 @internalComponent
       
   765 @released
       
   766 
       
   767 @return true if --output option is passed else return False.
       
   768 */
       
   769 bool ParameterManager::E32OutOption()
       
   770 {
       
   771 	return iOutFileOption;
       
   772 }
       
   773 
       
   774 /**
       
   775 This function finds out if the --linkas option is passed to the program.
       
   776 
       
   777 @internalComponent
       
   778 @released
       
   779 
       
   780 @return True if --linkas option is passed in or False.
       
   781 */
       
   782 bool ParameterManager::LinkAsOption()
       
   783 {
       
   784 	return iLinkAsOption;
       
   785 }
       
   786 
       
   787 
       
   788 /**
       
   789 This function finds out if the --UID1 option is passed to the program.
       
   790 
       
   791 @internalComponent
       
   792 @released
       
   793 
       
   794 @return True if --UID1 option is passed in or False.
       
   795 */
       
   796 bool ParameterManager::Uid1Option()
       
   797 {
       
   798 	return iUid1Option;
       
   799 }
       
   800 
       
   801 /**
       
   802 This function finds out if the --sid option is passed to the program.
       
   803 
       
   804 @internalComponent
       
   805 @released
       
   806 
       
   807 @return True if --sid option is passed in or False.
       
   808 */
       
   809 bool ParameterManager::SecureIdOption()
       
   810 {
       
   811 	return iSecureIDOption;
       
   812 }
       
   813 
       
   814 /**
       
   815 This function finds out if the --vid option is passed to the program.
       
   816 
       
   817 @internalComponent
       
   818 @released
       
   819 
       
   820 @return True if --vid option is passed in or False.
       
   821 */
       
   822 bool ParameterManager::VendorIdOption()
       
   823 {
       
   824 	return iVendorIDOption;
       
   825 }
       
   826 
       
   827 /**
       
   828 This function finds out if the --log option is passed to the program.
       
   829 
       
   830 @internalComponent
       
   831 @released
       
   832 
       
   833 @return True if --log option is passed in or False.
       
   834 */
       
   835 bool ParameterManager::LogFileOption()
       
   836 {
       
   837 	return iLogFileOption;
       
   838 }
       
   839 
       
   840 /**
       
   841 This function finds out if the --messagefile option is passed to the program.
       
   842 
       
   843 @internalComponent
       
   844 @released
       
   845 
       
   846 @return True if --messagefile option is passed in or False.
       
   847 */
       
   848 bool ParameterManager::MessageFileOption()
       
   849 {
       
   850 	return iMessageFileOption;
       
   851 }
       
   852 
       
   853 /**
       
   854 This function finds out if the --dumpmessagefile option is passed to the program.
       
   855 
       
   856 @internalComponent
       
   857 @released
       
   858 
       
   859 @return True if --dumpmessagefile option is passed in or False.
       
   860 */
       
   861 bool ParameterManager::DumpMessageFileOption()
       
   862 {
       
   863 	return iDumpMessageFileOption;
       
   864 }
       
   865 
       
   866 /**
       
   867 This function finds out if the --fixedaddress option is passed to the program.
       
   868 
       
   869 @internalComponent
       
   870 @released
       
   871 
       
   872 @return True if --fixedaddress option is passed in or False.
       
   873 */
       
   874 bool ParameterManager::FixedAddress()
       
   875 {
       
   876 	return iFixedAddress;
       
   877 }
       
   878 
       
   879 /**
       
   880 This function finds out if the --uncompressed option is passed to the program.
       
   881 
       
   882 @internalComponent
       
   883 @released
       
   884 
       
   885 @return True if --uncompressed option is passed in or False.
       
   886 */
       
   887 bool ParameterManager::Compress()
       
   888 {
       
   889 	return iCompress;
       
   890 }
       
   891 
       
   892 
       
   893 /**
       
   894 This function finds out if the --compressionmethod option is passed to the program.
       
   895 
       
   896 @internalComponent
       
   897 @released
       
   898 
       
   899 @return UId if --compressionmethod option is passed in or UId of deflate compressor (compatibility).
       
   900 */
       
   901 UINT ParameterManager::CompressionMethod()
       
   902 {
       
   903 	return iCompressionMethod;
       
   904 }
       
   905 
       
   906 
       
   907 /**
       
   908 This function finds out if the --unfrozen option is passed to the program.
       
   909 
       
   910 @internalComponent
       
   911 @released
       
   912 
       
   913 @return True if --unfrozen option is passed in or False.
       
   914 */
       
   915 bool ParameterManager::Unfrozen()
       
   916 {
       
   917 	return iUnfrozen;
       
   918 }
       
   919 
       
   920 /**
       
   921 This function finds out if the --ignorenoncallable option is passed to the program.
       
   922 
       
   923 @internalComponent
       
   924 @released
       
   925 
       
   926 @return True if --ignorenoncallable option is passed in or False.
       
   927 */
       
   928 bool ParameterManager::IgnoreNonCallable()
       
   929 {
       
   930 	return iIgnoreNonCallable;
       
   931 }
       
   932 
       
   933 /**
       
   934 This function finds out if the --dlldata option is passed to the program.
       
   935 
       
   936 @internalComponent
       
   937 @released
       
   938 
       
   939 @return True if --dlldata option is passed in or False.
       
   940 */
       
   941 bool ParameterManager::DllDataP()
       
   942 {
       
   943  	return iDllDataP;
       
   944 }
       
   945 
       
   946 /**
       
   947 This function finds out if the --version option is passed to the program.
       
   948 
       
   949 @internalComponent
       
   950 @released
       
   951 
       
   952 @return True if --version option is passed in or False.
       
   953 */
       
   954 bool ParameterManager::VersionOption()
       
   955 {
       
   956 	return iVersionOption;
       
   957 }
       
   958 
       
   959 /**
       
   960 This function finds out if the --callentry option is passed to the program.
       
   961 
       
   962 @internalComponent
       
   963 @released
       
   964 
       
   965 @return True if --callentry option is passed in or False.
       
   966 */
       
   967 bool ParameterManager::CallEntryPoint()
       
   968 {
       
   969 	return iCallEntryPoint;
       
   970 }
       
   971 
       
   972 /**
       
   973 This function finds out if the --priority option is passed to the program.
       
   974 
       
   975 @internalComponent
       
   976 @released
       
   977 
       
   978 @return True if --priority option is passed in or False.
       
   979 */
       
   980 bool ParameterManager::PriorityOption()
       
   981 {
       
   982 	return iPriorityOption;
       
   983 }
       
   984 
       
   985 /**
       
   986 This function finds out if the --sysdef option is passed to the program.
       
   987 
       
   988 @internalComponent
       
   989 @released
       
   990 
       
   991 @return True if --sysdef option is passed in or False.
       
   992 */
       
   993 bool ParameterManager::SysDefOption()
       
   994 {
       
   995 	return iSysDefOption;
       
   996 }
       
   997 
       
   998 /**
       
   999 This function finds out if the --dump option is passed to the program.
       
  1000 
       
  1001 @internalComponent
       
  1002 @released
       
  1003 
       
  1004 @return True if --dump option is passed in or False
       
  1005 */
       
  1006 bool ParameterManager::FileDumpOption()
       
  1007 {
       
  1008 	return iFileDumpOption;
       
  1009 }
       
  1010 
       
  1011 /**
       
  1012 This function finds out if the --fpu option is passed to the program.
       
  1013 
       
  1014 @internalComponent
       
  1015 @released
       
  1016 
       
  1017 @return True if --fup option is passed in or False.
       
  1018 */
       
  1019 bool ParameterManager::FPUOption()
       
  1020 {
       
  1021 	return iFPUOption;
       
  1022 }
       
  1023 
       
  1024 
       
  1025 /**
       
  1026 This function extracts the DEF file name that is passed as input through the --definput option.
       
  1027 
       
  1028 @internalComponent
       
  1029 @released
       
  1030 
       
  1031 @return the name of the input DEF file if provided as input through --definput or 0.
       
  1032 */
       
  1033 char * ParameterManager::DefInput()
       
  1034 {
       
  1035 	return iDefInput;
       
  1036 }
       
  1037 
       
  1038 /**
       
  1039 This function extracts the Elf file name that is passed as input through the --elfinput option.
       
  1040 
       
  1041 @internalComponent
       
  1042 @released
       
  1043 
       
  1044 @return the name of the input Elf file if provided as input through --elfinput or 0.
       
  1045 */
       
  1046 char * ParameterManager::ElfInput()
       
  1047 {
       
  1048 	return iElfInput;
       
  1049 }
       
  1050 
       
  1051 /**
       
  1052 This function extracts the E32 image name that is passed as input through the --e32input option.
       
  1053 
       
  1054 @internalComponent
       
  1055 @released
       
  1056 
       
  1057 @return the name of the input E32 image if provided as input through --e32input or 0.
       
  1058 */
       
  1059 char * ParameterManager::E32Input()
       
  1060 {
       
  1061 	return iE32Input;
       
  1062 }
       
  1063 
       
  1064 /**
       
  1065 This function extracts the output DEF file name that is passed as input through the --defoutput option.
       
  1066 
       
  1067 @internalComponent
       
  1068 @released
       
  1069 
       
  1070 @return the name of the output DEF file if provided as input through --defoutput or 0.
       
  1071 */
       
  1072 char * ParameterManager::DefOutput()
       
  1073 {
       
  1074 	return iDefOutput;
       
  1075 }
       
  1076 
       
  1077 /**
       
  1078 This function extracts the DSO file name that is passed as input through the --dso option.
       
  1079 
       
  1080 @internalComponent
       
  1081 @released
       
  1082 
       
  1083 @return the name of the output DSO file if provided as input through --dso or 0.
       
  1084 */
       
  1085 char * ParameterManager::DSOOutput()
       
  1086 {
       
  1087 	return iDSOOutput;
       
  1088 }
       
  1089 
       
  1090 /**
       
  1091 This function extracts the E32 image output that is passed as input through the --output option.
       
  1092 
       
  1093 @internalComponent
       
  1094 @released
       
  1095 
       
  1096 @return the name of the output E32 image output if provided as input through --output or 0.
       
  1097 */
       
  1098 char * ParameterManager::E32ImageOutput()
       
  1099 {
       
  1100 	return iOutFileName;
       
  1101 }
       
  1102 
       
  1103 /**
       
  1104 This function extracts the target type that is passed as input through the --targettype option.
       
  1105 
       
  1106 @internalComponent
       
  1107 @released
       
  1108 
       
  1109 @return the name of the input target type if provided as input through --targettype or 0.
       
  1110 */
       
  1111 ETargetType ParameterManager::TargetTypeName()
       
  1112 {
       
  1113 	return iTargetTypeName;
       
  1114 }
       
  1115 
       
  1116 /**
       
  1117 This function extracts the name of the DLL (that the DSO is to be linked with) 
       
  1118 that is passed as input through the --linkas option.
       
  1119 
       
  1120 @internalComponent
       
  1121 @released
       
  1122 
       
  1123 @return the name of the DLL name to be linked with if provided as input through --linkas or 0.
       
  1124 */
       
  1125 char * ParameterManager::LinkAsDLLName()
       
  1126 {
       
  1127 	return iLinkDLLName;
       
  1128 }
       
  1129 
       
  1130 /**
       
  1131 This function extracts the path (where the intermediate libraries should be put)
       
  1132 that is passed as input through the --libpath option.
       
  1133 
       
  1134 @internalComponent
       
  1135 @released
       
  1136 
       
  1137 @return the path if provided as input through --libpath or 0.
       
  1138 */
       
  1139 ParameterListInterface::LibSearchPaths& ParameterManager::LibPath()
       
  1140 {
       
  1141 	return iLibPathList;
       
  1142 }
       
  1143 
       
  1144 /**
       
  1145 This function extracts the total number of predefined symbols passed to --sysdef option.
       
  1146 
       
  1147 @internalComponent
       
  1148 @released
       
  1149 
       
  1150 @return the total number of predefined symbols passed through --elfinput or 0.
       
  1151 */
       
  1152 int ParameterManager::SysDefCount()
       
  1153 {
       
  1154 	return iSysDefCount;
       
  1155 }
       
  1156 
       
  1157 /**
       
  1158 This function extracts the E32 image dump options passed as input through the --dump option.
       
  1159 
       
  1160 /@internalComponent
       
  1161 @released
       
  1162 
       
  1163 @return the name of the dump options if provided as input through --dump or 0.
       
  1164 */
       
  1165 char * ParameterManager::FileDumpSubOptions()
       
  1166 {
       
  1167 	return iFileDumpSubOptions;
       
  1168 }
       
  1169 
       
  1170 /**
       
  1171 This function extracts the E32 image dump options in integer value passed as character input
       
  1172 through the --dump option.
       
  1173 
       
  1174 @internalComponent
       
  1175 @released
       
  1176 
       
  1177 @return the name of the dump options in integer.
       
  1178 */
       
  1179 int ParameterManager::DumpOptions()
       
  1180 {
       
  1181       return iDumpOptions;
       
  1182 }
       
  1183 
       
  1184 /**
       
  1185 This function gets the first UID in a compound identifier (UID type) that is passed as 
       
  1186 input through the --uid1 option.UID1 differentiates the executables, DLLs and file stores.
       
  1187 
       
  1188 @internalComponent
       
  1189 @released
       
  1190 
       
  1191 @return the System level identifier if provided as input through --uid1 or 0.
       
  1192 */
       
  1193 UINT ParameterManager::Uid1()
       
  1194 {
       
  1195 	return iUID1;
       
  1196 }
       
  1197 
       
  1198 /**
       
  1199 This function gets the UID2 that is passed as input through the --uid2 option.
       
  1200 UID2 differentiates the static interface (shared library) and polymorphic interface 
       
  1201 (application or plug-in framework) DLLs.
       
  1202 	
       
  1203 @internalComponent
       
  1204 @released
       
  1205 
       
  1206 @return the Interface identifier if provided as input through --uid2 or 0.
       
  1207 */
       
  1208 UINT ParameterManager::Uid2()
       
  1209 {
       
  1210 	return iUID2;
       
  1211 }
       
  1212 
       
  1213 /**
       
  1214 This function gets the UID3 that is passed as input through the --uid3 option. UID3 
       
  1215 is shared by all objects belonging to a given program, including library DLLs if any, 
       
  1216 framework DLLs, and all documents.
       
  1217 	
       
  1218 @internalComponent
       
  1219 @released
       
  1220 
       
  1221 @return the Project identifier if provided as input through --uid3 or 0.
       
  1222 */
       
  1223 UINT ParameterManager::Uid3()
       
  1224 {
       
  1225 	return iUID3;
       
  1226 }
       
  1227 
       
  1228 /**
       
  1229 This function gets the Secure Id that is passed as input through the --sid option.
       
  1230 
       
  1231 @internalComponent
       
  1232 @released
       
  1233 
       
  1234 @return the Secure Id if provided as input through --sid or 0.
       
  1235 */
       
  1236 UINT ParameterManager::SecureId()
       
  1237 {
       
  1238 	return iSecureID;
       
  1239 }
       
  1240 
       
  1241 /**
       
  1242 This function gets the Vendor Id that is passed as input through the --vid option.
       
  1243 
       
  1244 @internalComponent
       
  1245 @released
       
  1246 
       
  1247 @return the Vendor Id if provided as input through --vid or 0.
       
  1248 */
       
  1249 UINT ParameterManager::VendorId()
       
  1250 {
       
  1251 	return iVendorID;
       
  1252 }
       
  1253 
       
  1254 /**
       
  1255 This function gets the capability value passed to '--capability' option.
       
  1256 
       
  1257 @internalComponent
       
  1258 @released
       
  1259 
       
  1260 @return the capability value passed to '--capability' option.
       
  1261 */
       
  1262 SCapabilitySet ParameterManager::Capability()
       
  1263 {
       
  1264 	return iCapability;
       
  1265 }
       
  1266 
       
  1267 /**
       
  1268 This function extracts the Log file name that is passed as input through the --log option.
       
  1269 
       
  1270 @internalComponent
       
  1271 @released
       
  1272 
       
  1273 @return the name of the Log file if provided as input through --log or 0.
       
  1274 */
       
  1275 char * ParameterManager::LogFile()
       
  1276 {
       
  1277 	return iLogFileName;
       
  1278 }
       
  1279 
       
  1280 /**
       
  1281 This function extracts the Message file name that is passed as input through the --messagefile option.
       
  1282 
       
  1283 @internalComponent
       
  1284 @released
       
  1285 
       
  1286 @return the name of the Message file if provided as input through --messagefile or 0.
       
  1287 */
       
  1288 char * ParameterManager::MessageFile()
       
  1289 {
       
  1290 	return iMessageFileName;
       
  1291 }
       
  1292 
       
  1293 /**
       
  1294 This function extracts the Message file name that is passed as input through the --dumpmessagefile option.
       
  1295 
       
  1296 @internalComponent
       
  1297 @released
       
  1298 
       
  1299 @return the name of the Message file to be dumped if provided as input through --dumpmessagefile or 0.
       
  1300 */
       
  1301 char * ParameterManager::DumpMessageFile()
       
  1302 {
       
  1303 	return iDumpMessageFileName;
       
  1304 }
       
  1305 
       
  1306 /**
       
  1307 This function extracts the list of predefined symbols that is passed as input through
       
  1308 the --sysdef option.
       
  1309 
       
  1310 @internalComponent
       
  1311 @released
       
  1312 
       
  1313 @return the list of predefined symbols that is passed as input through the --sysdef option.
       
  1314 */
       
  1315 ParameterManager::Sys ParameterManager::SysDefSymbols(int sysdefcount)
       
  1316 {
       
  1317 	return iSysDefSymbols[sysdefcount];
       
  1318 }
       
  1319 
       
  1320 /**
       
  1321 This function extracts the heap commited size passed as input to --heap option.
       
  1322 
       
  1323 @internalComponent
       
  1324 @released
       
  1325 
       
  1326 @return the heap commited size passed as input to --heap option.
       
  1327 */
       
  1328 size_t ParameterManager::HeapCommittedSize()
       
  1329 {
       
  1330  	return iHeapCommittedSize;
       
  1331 }
       
  1332 
       
  1333 /**
       
  1334 This function extracts the heap reserved size passed as input to --heap option.
       
  1335 
       
  1336 @internalComponent
       
  1337 @released
       
  1338 
       
  1339 @return the heap reserved size passed as input to --heap option.
       
  1340 */
       
  1341 size_t ParameterManager::HeapReservedSize()
       
  1342 {
       
  1343  	return iHeapReservedSize;
       
  1344 }
       
  1345 
       
  1346 /**
       
  1347 This function extracts the stack commited size passed as input to --stack option.
       
  1348 
       
  1349 @internalComponent
       
  1350 @released
       
  1351 
       
  1352 @return the stack commited size passed as input to --stack option.
       
  1353 */
       
  1354 size_t ParameterManager::StackCommittedSize()
       
  1355 {
       
  1356  	return iStackCommittedSize;
       
  1357 }
       
  1358 
       
  1359 /**
       
  1360 This function extracts the priority value passed as input to --priority option.
       
  1361 
       
  1362 @internalComponent
       
  1363 @released
       
  1364 
       
  1365 @return the priority value passed as input to --priority option
       
  1366 */
       
  1367 TProcessPriority ParameterManager::Priority()
       
  1368 {
       
  1369 	return iPriorityVal;
       
  1370 }
       
  1371 
       
  1372 /**
       
  1373 This function extracts the version information passed as input to --version option.
       
  1374 
       
  1375 @internalComponent
       
  1376 @released
       
  1377 
       
  1378 @return the version information passed as input to --version option.
       
  1379 */
       
  1380 UINT ParameterManager::Version()
       
  1381 {
       
  1382 	return iVersion;
       
  1383 }
       
  1384 
       
  1385 /**
       
  1386 This function extracts the fpu information passed as input to the --fpu option.
       
  1387 
       
  1388 @internalComponent
       
  1389 @released
       
  1390 
       
  1391 @return the fpu information passed as input to the --fpu option.
       
  1392 */
       
  1393 UINT ParameterManager::FPU()
       
  1394 {
       
  1395 	return iFPU;
       
  1396 }
       
  1397 
       
  1398 /**
       
  1399 @internalComponent
       
  1400 @released
       
  1401 */
       
  1402 bool ParameterManager::IsCodePaged()
       
  1403 {
       
  1404 	return iCodePaged;
       
  1405 }
       
  1406 
       
  1407 /**
       
  1408 @internalComponent
       
  1409 @released
       
  1410 */
       
  1411 bool ParameterManager::IsCodeUnpaged()
       
  1412 {
       
  1413 	return iCodeUnpaged;
       
  1414 }
       
  1415 
       
  1416 /**
       
  1417 @internalComponent
       
  1418 @released
       
  1419 */
       
  1420 bool ParameterManager::IsCodeDefaultPaged()
       
  1421 {
       
  1422 	return iCodeDefaultPaged;
       
  1423 }
       
  1424 
       
  1425 /**
       
  1426 @internalComponent
       
  1427 @released
       
  1428 */
       
  1429 bool ParameterManager::IsDataPaged()
       
  1430 {
       
  1431 	return iDataPaged;
       
  1432 }
       
  1433 
       
  1434 /**
       
  1435 @internalComponent
       
  1436 @released
       
  1437 */
       
  1438 bool ParameterManager::IsDataUnpaged()
       
  1439 {
       
  1440 	return iDataUnpaged;
       
  1441 }
       
  1442 
       
  1443 /**
       
  1444 @internalComponent
       
  1445 @released
       
  1446 */
       
  1447 bool ParameterManager::IsDataDefaultPaged()
       
  1448 {
       
  1449 	return iDataDefaultPaged;
       
  1450 }
       
  1451 
       
  1452 /**
       
  1453 This function finds out if the --excludeunwantedexports option is passed to the program.
       
  1454 
       
  1455 @internalComponent
       
  1456 @released
       
  1457 
       
  1458 @return true if --excludeunwantedexports option is passed in or False.
       
  1459 */
       
  1460 bool ParameterManager::ExcludeUnwantedExports()
       
  1461 {
       
  1462 	return iExcludeUnwantedExports;
       
  1463 }
       
  1464 
       
  1465 /**
       
  1466 This function finds out if the --customdlltarget option is passed to the program.
       
  1467 
       
  1468 @internalComponent
       
  1469 @released
       
  1470 
       
  1471 @return true if --customdlltarget option is passed in or False.
       
  1472 */
       
  1473 bool ParameterManager::IsCustomDllTarget()
       
  1474 {
       
  1475 	return iCustomDllTarget;
       
  1476 }
       
  1477 
       
  1478 /**
       
  1479 This function extracts the SymNamedLookup information passed as input to the --namedlookup option.
       
  1480 
       
  1481 @internalComponent
       
  1482 @released
       
  1483 
       
  1484 @return the namedlookup information passed as input to the --namedlookup option.
       
  1485 */
       
  1486 bool ParameterManager::SymNamedLookup()
       
  1487 {
       
  1488 	return iSymNamedLookup;
       
  1489 }
       
  1490 
       
  1491 /**
       
  1492 This function determines if the -debuggable option is passed to the program.
       
  1493 
       
  1494 @internalComponent
       
  1495 @released
       
  1496 
       
  1497 @return true if --debuggable is passed in or False.
       
  1498 */
       
  1499 bool ParameterManager::IsDebuggable()
       
  1500 {
       
  1501 	return iDebuggable;
       
  1502 }
       
  1503 
       
  1504 
       
  1505 bool ParameterManager::IsSmpSafe()
       
  1506 {
       
  1507 	return iSmpSafe;
       
  1508 }
       
  1509 
       
  1510 /**
       
  1511 This function extracts the filename from the absolute path that is given as input.
       
  1512 
       
  1513 @internalComponent
       
  1514 @released
       
  1515 
       
  1516 @param aFileName
       
  1517 The filename alongwith the absolute path.
       
  1518 
       
  1519 @return the filename (without the absolute path) for valid input else the filename itself.
       
  1520 */
       
  1521 char * ParameterManager::FileName(char * aFileName)
       
  1522 {
       
  1523 	string str(aFileName);
       
  1524 	
       
  1525 	size_t pos = str.find_last_of(DirectorySeparator());	
       
  1526 #ifndef __LINUX__ 	
       
  1527 	// Support Unix slashes on Windows when stripping filenames from paths
       
  1528 	if (pos > str.size())
       
  1529 		{
       
  1530 		pos = str.find_last_of('/');
       
  1531 		}
       
  1532 #endif
       
  1533 
       
  1534 	if (pos < str.size())
       
  1535 		return aFileName + pos + 1;
       
  1536 	else
       
  1537 		return aFileName;
       
  1538 }
       
  1539 
       
  1540 /**
       
  1541 This function finds out the directory separator '\' in the path
       
  1542 
       
  1543 @internalComponent
       
  1544 @released
       
  1545 
       
  1546 @return the directory spearator '\'
       
  1547 */
       
  1548 char ParameterManager::DirectorySeparator()
       
  1549 {
       
  1550 #ifdef __LINUX__ 
       
  1551 	return '/';
       
  1552 #else 
       
  1553 	return '\\';
       
  1554 #endif 
       
  1555 }
       
  1556 
       
  1557 /**
       
  1558 This function set the input Def file name that is passed through --definput option.
       
  1559 
       
  1560 void ParameterManager::ParseDefInput(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  1561 
       
  1562 @internalComponent
       
  1563 @released
       
  1564 
       
  1565 @param aPM
       
  1566 Pointer to the ParameterManager
       
  1567 @param aOption
       
  1568 Option that is passed as input, in this case --definput
       
  1569 @param aValue
       
  1570 The DEF file name passed to --definput option
       
  1571 @param aDesc
       
  1572 Pointer to function ParameterManager::ParseDefInput returning void.
       
  1573 */
       
  1574 DEFINE_PARAM_PARSER(ParameterManager::ParseDefInput)
       
  1575 {
       
  1576 	INITIALISE_PARAM_PARSER;
       
  1577 	aPM->SetDefInput(aValue);
       
  1578 }
       
  1579 
       
  1580 /**
       
  1581 This function set the input Elf file name that is passed through --elfinput option.
       
  1582 
       
  1583 void ParameterManager::ParseElfInput(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  1584 
       
  1585 @internalComponent
       
  1586 @released
       
  1587 
       
  1588 @param aPM
       
  1589 Pointer to the ParameterManager
       
  1590 @param aOption
       
  1591 Option that is passed as input, in this case --elfinput
       
  1592 @param aValue
       
  1593 The ELF file name passed to --elfinput option
       
  1594 @param aDesc
       
  1595 Pointer to function ParameterManager::ParseElfInput returning void.
       
  1596 */
       
  1597 DEFINE_PARAM_PARSER(ParameterManager::ParseElfInput)
       
  1598 {
       
  1599 	INITIALISE_PARAM_PARSER;
       
  1600 	aPM->SetElfInput(aValue);
       
  1601 }
       
  1602 
       
  1603 /**
       
  1604 This function set the output Def file name that is passed through --defoutput option.
       
  1605 
       
  1606 void ParameterManager::ParseDefOutput(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  1607 
       
  1608 @internalComponent
       
  1609 @released
       
  1610 
       
  1611 @param aPM
       
  1612 Pointer to the ParameterManager
       
  1613 @param aOption
       
  1614 Option that is passed as input, in this case --defoutput
       
  1615 @param aValue
       
  1616 The DEF file name passed to --defoutput option
       
  1617 @param aDesc
       
  1618 Pointer to function ParameterManager::ParseDefOutput returning void.
       
  1619 */
       
  1620 DEFINE_PARAM_PARSER(ParameterManager::ParseDefOutput)
       
  1621 {
       
  1622 	INITIALISE_PARAM_PARSER;
       
  1623 	aPM->SetDefOutput(aValue);
       
  1624 }
       
  1625 
       
  1626 /**
       
  1627 This function set the input E32 file name that is passed through --e32input option.
       
  1628 
       
  1629 void ParameterManager::ParseE32Input(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  1630 
       
  1631 @internalComponent
       
  1632 @released
       
  1633 
       
  1634 @param aPM
       
  1635 Pointer to the ParameterManager
       
  1636 @param aOption
       
  1637 Option that is passed as input, in this case --e32input
       
  1638 @param aValue
       
  1639 The E32 file name passed to --e32input option
       
  1640 @param aDesc
       
  1641 Pointer to function ParameterManager::ParseE32Input returning void.
       
  1642 */
       
  1643 DEFINE_PARAM_PARSER(ParameterManager::ParseE32ImageInput)
       
  1644 {
       
  1645       INITIALISE_PARAM_PARSER;
       
  1646       aPM->SetE32Input(aValue);
       
  1647 }
       
  1648 
       
  1649 /**
       
  1650 This function set the output E32 image name that is passed through --output option.
       
  1651 
       
  1652 void ParameterManager::ParseOutput(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  1653 
       
  1654 @internalComponent
       
  1655 @released
       
  1656 
       
  1657 @param aPM
       
  1658 Pointer to the ParameterManager
       
  1659 @param aOption
       
  1660 Option that is passed as input, in this case --output
       
  1661 @param aValue
       
  1662 The E32 file name passed to --output option
       
  1663 @param aDesc
       
  1664 Pointer to function ParameterManager::ParseOutput returning void.
       
  1665 */
       
  1666 DEFINE_PARAM_PARSER(ParameterManager::ParseOutput)
       
  1667 {
       
  1668 	INITIALISE_PARAM_PARSER;
       
  1669 	aPM->SetE32Output(aValue);
       
  1670 }
       
  1671 
       
  1672 /**
       
  1673 This function set the output Log file name that is passed through --log option.
       
  1674 
       
  1675 void ParameterManager::ParseLogFile(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  1676 
       
  1677 @internalComponent
       
  1678 @released
       
  1679 
       
  1680 @param aPM
       
  1681 Pointer to the ParameterManager
       
  1682 @param aOption
       
  1683 Option that is passed as input, in this case --log
       
  1684 @param aValue
       
  1685 The Log file name passed to --log option
       
  1686 @param aDesc
       
  1687 Pointer to function ParameterManager::ParseLogFile returning void.
       
  1688 */
       
  1689 DEFINE_PARAM_PARSER(ParameterManager::ParseLogFile)
       
  1690 {
       
  1691 	INITIALISE_PARAM_PARSER;
       
  1692 	if(aValue)
       
  1693 	{
       
  1694 		aPM->SetLogFile(aValue);
       
  1695 		MessageHandler::StartLogging(aValue);
       
  1696 	}
       
  1697 	else
       
  1698 	{
       
  1699 		throw ParameterParserError(NOARGUMENTERROR, "--log");
       
  1700 	}
       
  1701 }
       
  1702 
       
  1703 /**
       
  1704 This function set the input Message file name that is passed through --messagefile option.
       
  1705 
       
  1706 void ParameterManager::ParseMessageFile(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  1707 
       
  1708 @internalComponent
       
  1709 @released
       
  1710 
       
  1711 @param aPM
       
  1712 Pointer to the ParameterManager
       
  1713 @param aOption
       
  1714 Option that is passed as input, in this case --messagefile
       
  1715 @param aValue
       
  1716 The Message file name passed to --messagefile option
       
  1717 @param aDesc
       
  1718 Pointer to function ParameterManager::ParseMessageFile returning void.
       
  1719 */
       
  1720 DEFINE_PARAM_PARSER(ParameterManager::ParseMessageFile)
       
  1721 {
       
  1722 	INITIALISE_PARAM_PARSER;
       
  1723 	if(aValue)
       
  1724 	{
       
  1725 		aPM->SetMessageFile(aValue);
       
  1726 		MessageHandler::InitializeMessages(aValue);
       
  1727 	}
       
  1728 	else
       
  1729 	{
       
  1730 		throw ParameterParserError(NOARGUMENTERROR, "--messagefile");
       
  1731 	}
       
  1732 }
       
  1733 
       
  1734 /**
       
  1735 This function set the Message file name to be dumped that is passed through --dumpmessagefile option.
       
  1736 
       
  1737 void ParameterManager::ParseDumpMessageFile(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  1738 
       
  1739 @internalComponent
       
  1740 @released
       
  1741 
       
  1742 @param aPM
       
  1743 Pointer to the ParameterManager
       
  1744 @param aOption
       
  1745 Option that is passed as input, in this case --dumpmessagefile
       
  1746 @param aValue
       
  1747 The output Message file name passed to --dumpmessagefile option
       
  1748 @param aDesc
       
  1749 Pointer to function ParameterManager::ParseDumpMessageFile returning void.
       
  1750 */
       
  1751 DEFINE_PARAM_PARSER(ParameterManager::ParseDumpMessageFile)
       
  1752 {
       
  1753 	INITIALISE_PARAM_PARSER;
       
  1754 	aPM->SetDumpMessageFile(aValue);
       
  1755 }
       
  1756 
       
  1757 /**
       
  1758 This function checks the arguments passed to the options. If an incorrect argument
       
  1759 is passed or if no arguments are passed then appropriate error message is displayed.
       
  1760 
       
  1761 @internalComponent
       
  1762 @released
       
  1763 
       
  1764 @param aValue
       
  1765 Input to the option
       
  1766 @param aOption
       
  1767 Option that is passed as input
       
  1768 @return the validated value
       
  1769 */
       
  1770 UINT ValidateInputVal(char * aValue, char * aOption)
       
  1771 {
       
  1772 	UINT uid;
       
  1773 	if (!aValue)
       
  1774 		throw ParameterParserError(NOARGUMENTERROR, aOption);
       
  1775 	else if (!GetUInt(uid, aValue))
       
  1776 		throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, aOption);
       
  1777 	return uid;
       
  1778 }
       
  1779 
       
  1780 /**
       
  1781 There are some boolean options which does not expect any inputs. This function checks
       
  1782 if there are any the arguments passed to the option. In case of getting an input argument,
       
  1783 the warning message "Value is ignored" is displayed.
       
  1784 
       
  1785 @internalComponent
       
  1786 @released
       
  1787 
       
  1788 @param aValue
       
  1789 Input to the option
       
  1790 @param aOption
       
  1791 Option that is passed as input
       
  1792 */
       
  1793 void CheckInput(char * aValue, char * aOption)
       
  1794 {
       
  1795 	if (aValue)
       
  1796 		MessageHandler::GetInstance()->ReportMessage(WARNING, VALUEIGNOREDWARNING, aOption);
       
  1797 }
       
  1798 
       
  1799 /**
       
  1800 This function set the version information that is passed through --version option.
       
  1801 
       
  1802 void ParameterManager::ParseVersion(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  1803 
       
  1804 @internalComponent
       
  1805 @released
       
  1806 
       
  1807 @param aPM
       
  1808 Pointer to the ParameterManager
       
  1809 @param aOption
       
  1810 Option that is passed as input, in this case --version
       
  1811 @param aValue
       
  1812 The version information passed to --version option
       
  1813 @param aDesc
       
  1814 Pointer to function ParameterManager::ParseVersion returning void.
       
  1815 */
       
  1816 DEFINE_PARAM_PARSER(ParameterManager::ParseVersion)
       
  1817 {
       
  1818 	INITIALISE_PARAM_PARSER;
       
  1819 	UINT version = 0;
       
  1820 	UINT majorVal = 0;
       
  1821 	UINT minorVal = 0;
       
  1822 
       
  1823 	if(!aValue)
       
  1824   	throw ParameterParserError(NOARGUMENTERROR, "--version");
       
  1825 
       
  1826 	char * tokens = strdup(aValue);
       
  1827 	char * major, * minor;
       
  1828 
       
  1829 	major = strtok(tokens, ".");
       
  1830 	majorVal = ValidateInputVal(major, "--version");
       
  1831 	minor = strtok(NULL, ".");
       
  1832 	if (minor && !GetUInt(minorVal, minor))
       
  1833 		throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, "--version");
       
  1834 
       
  1835 	version = ((majorVal & 0xFFFF) << 16) | (minorVal & 0xFFFF);
       
  1836 	aPM->SetVersion(version);
       
  1837 }
       
  1838 
       
  1839 /**
       
  1840 This function set the UID1 value that is passed through --uid1 option.
       
  1841 
       
  1842 void ParameterManager::ParseUID1(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  1843 
       
  1844 @internalComponent
       
  1845 @released
       
  1846 
       
  1847 @param aPM
       
  1848 Pointer to the ParameterManager
       
  1849 @param aOption
       
  1850 Option that is passed as input, in this case --uid1
       
  1851 @param aValue
       
  1852 The UID1 value passed to --uid1 option
       
  1853 @param aDesc
       
  1854 Pointer to function ParameterManager::ParseUID1 returning void.
       
  1855 */
       
  1856 DEFINE_PARAM_PARSER(ParameterManager::ParseUID1)
       
  1857 {
       
  1858 	INITIALISE_PARAM_PARSER;
       
  1859 	UINT aUid = ValidateInputVal(aValue, "--uid1");
       
  1860 	aPM->SetUID1(aUid);
       
  1861 }
       
  1862 
       
  1863 /**
       
  1864 This function set the UID2 value that is passed through --uid2 option.
       
  1865 
       
  1866 void ParameterManager::ParseUID2(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  1867 
       
  1868 @internalComponent
       
  1869 @released
       
  1870 
       
  1871 @param aPM
       
  1872 Pointer to the ParameterManager
       
  1873 @param aOption
       
  1874 Option that is passed as input, in this case --uid2
       
  1875 @param aValue
       
  1876 The UID2 value passed to --uid2 option
       
  1877 @param aDesc
       
  1878 Pointer to function ParameterManager::ParseUID2 returning void.
       
  1879 */
       
  1880 DEFINE_PARAM_PARSER(ParameterManager::ParseUID2)
       
  1881 {
       
  1882 	INITIALISE_PARAM_PARSER;
       
  1883 	UINT aUid = ValidateInputVal(aValue, "--uid2");
       
  1884 	aPM->SetUID2(aUid);
       
  1885 }
       
  1886 
       
  1887 /**
       
  1888 This function set the UID3 value that is passed through --uid3 option.
       
  1889 
       
  1890 void ParameterManager::ParseUID3(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  1891 
       
  1892 @internalComponent
       
  1893 @released
       
  1894 
       
  1895 @param aPM
       
  1896 Pointer to the ParameterManager
       
  1897 @param aOption
       
  1898 Option that is passed as input, in this case --uid3
       
  1899 @param aValue
       
  1900 The UID3 value passed to --uid3 option
       
  1901 @param aDesc
       
  1902 Pointer to function ParameterManager::ParseUID3 returning void.
       
  1903 */
       
  1904 DEFINE_PARAM_PARSER(ParameterManager::ParseUID3)
       
  1905 {
       
  1906 	INITIALISE_PARAM_PARSER;
       
  1907 	UINT aUid = ValidateInputVal(aValue, "--uid3");
       
  1908 	aPM->SetUID3(aUid);
       
  1909 }
       
  1910 
       
  1911 /**
       
  1912 This function set the Secure ID value that is passed through --sid option.
       
  1913 
       
  1914 void ParameterManager::ParseSecureId(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  1915 
       
  1916 @internalComponent
       
  1917 @released
       
  1918 
       
  1919 @param aPM
       
  1920 Pointer to the ParameterManager
       
  1921 @param aOption
       
  1922 Option that is passed as input, in this case --sid
       
  1923 @param aValue
       
  1924 The Secure ID value passed to --sid option
       
  1925 @param aDesc
       
  1926 Pointer to function ParameterManager::ParseSecureId returning void.
       
  1927 */
       
  1928 DEFINE_PARAM_PARSER(ParameterManager::ParseSecureId)
       
  1929 {
       
  1930 	INITIALISE_PARAM_PARSER;
       
  1931 	UINT aUid = ValidateInputVal(aValue, "--sid");
       
  1932 	aPM->SetSecureId(aUid);
       
  1933 }
       
  1934 
       
  1935 /**
       
  1936 This function set the Vendor ID value that is passed through --vid option.
       
  1937 
       
  1938 void ParameterManager::ParseVendorId(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  1939 
       
  1940 @internalComponent
       
  1941 @released
       
  1942 
       
  1943 @param aPM
       
  1944 Pointer to the ParameterManager
       
  1945 @param aOption
       
  1946 Option that is passed as input, in this case --vid
       
  1947 @param aValue
       
  1948 The Vendor ID value passed to --vid option
       
  1949 @param aDesc
       
  1950 Pointer to function ParameterManager::ParseVendorId returning void.
       
  1951 */
       
  1952 DEFINE_PARAM_PARSER(ParameterManager::ParseVendorId)
       
  1953 {
       
  1954 	INITIALISE_PARAM_PARSER;
       
  1955 	UINT aUid = ValidateInputVal(aValue, "--vid");
       
  1956 	aPM->SetVendorId(aUid);
       
  1957 }
       
  1958 
       
  1959 /**
       
  1960 This function set the FixedAddress flag if --fixedaddress option is passed to the program.
       
  1961 
       
  1962 void ParameterManager::ParseFixedAddress(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  1963 
       
  1964 @internalComponent
       
  1965 @released
       
  1966 
       
  1967 @param aPM
       
  1968 Pointer to the ParameterManager
       
  1969 @param aOption
       
  1970 Option that is passed as input, in this case --fixedaddress
       
  1971 @param aValue
       
  1972 The value passed to --fixedaddress option, in this case NULL
       
  1973 @param aDesc
       
  1974 Pointer to function ParameterManager::ParseFixedAddress returning void.
       
  1975 */
       
  1976 DEFINE_PARAM_PARSER(ParameterManager::ParseFixedAddress)
       
  1977 {
       
  1978 	INITIALISE_PARAM_PARSER;
       
  1979 	CheckInput(aValue, "--fixedaddress");
       
  1980 	aPM->SetFixedAddress(true);
       
  1981 }
       
  1982 
       
  1983 /**
       
  1984 This function set the CallEntryPoint flag if --callentry option is passed to the program.
       
  1985 
       
  1986 void ParameterManager::ParseCallEntryPoint(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  1987 
       
  1988 @internalComponent
       
  1989 @released
       
  1990 
       
  1991 @param aPM
       
  1992 Pointer to the ParameterManager
       
  1993 @param aOption
       
  1994 Option that is passed as input, in this case --callentry
       
  1995 @param aValue
       
  1996 The value passed to --callentry option, in this case NULL
       
  1997 @param aDesc
       
  1998 Pointer to function ParameterManager::ParseCallEntryPoint returning void.
       
  1999 */
       
  2000 DEFINE_PARAM_PARSER(ParameterManager::ParseCallEntryPoint)
       
  2001 {
       
  2002 	INITIALISE_PARAM_PARSER;
       
  2003 	aPM->SetCallEntryPoint(true);
       
  2004 }
       
  2005 
       
  2006 /**
       
  2007 This function set the Uncompressed flag if --uncompressed option is passed to the program.
       
  2008 
       
  2009 void ParameterManager::ParseUncompressed(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  2010 
       
  2011 @internalComponent
       
  2012 @released
       
  2013 
       
  2014 @param aPM
       
  2015 Pointer to the ParameterManager
       
  2016 @param aOption
       
  2017 Option that is passed as input, in this case --uncompressed
       
  2018 @param aValue
       
  2019 The value passed to --uncompressed option, in this case NULL
       
  2020 @param aDesc
       
  2021 Pointer to function ParameterManager::ParseUncompressed returning void.
       
  2022 */
       
  2023 DEFINE_PARAM_PARSER(ParameterManager::ParseUncompressed)
       
  2024 {
       
  2025 	INITIALISE_PARAM_PARSER;
       
  2026 	CheckInput(aValue, "--uncompressed");
       
  2027 	aPM->SetCompress(false);
       
  2028 }
       
  2029 
       
  2030 
       
  2031 static const ParameterManager::CompressionMethodDesc MethodNames[] =
       
  2032 {
       
  2033 	{ "none", 0},
       
  2034 	{ "inflate", KUidCompressionDeflate},
       
  2035 	{ "bytepair", KUidCompressionBytePair},
       
  2036 	{ 0, 0}
       
  2037 };
       
  2038 
       
  2039 /**
       
  2040 This function parses the compression method value passed in and finds the corresponding match
       
  2041 from the list of existing method values.
       
  2042 
       
  2043 @internalComponent
       
  2044 @released
       
  2045 
       
  2046 @param aMethod
       
  2047 Holds the method value mapped from list.
       
  2048 @param aText
       
  2049 The priority value passed to --compressionmethod option
       
  2050 @return True if the method value passed in is a valid one present in the list.
       
  2051 */
       
  2052 static bool ParseCompressionMethodArg(UINT & aMethod, const char *aText)
       
  2053 {
       
  2054 	
       
  2055 	int i = 0;
       
  2056 	aMethod = 0;
       
  2057 	for (;; i++)
       
  2058 	{
       
  2059 		if (!MethodNames[i].iMethodName)
       
  2060 			return false;
       
  2061 		if (!stricmp(aText, MethodNames[i].iMethodName))
       
  2062 		{
       
  2063 			aMethod = MethodNames[i].iMethodUid;
       
  2064 			return true;
       
  2065 		}
       
  2066 	}
       
  2067 	return false;
       
  2068 }
       
  2069 
       
  2070 /**
       
  2071 This function set the CompressionMethod variable if --compressionmethod option is passed to the program.
       
  2072 
       
  2073 void ParameterManager::ParseUncompressed(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  2074 
       
  2075 @internalComponent
       
  2076 @released
       
  2077 
       
  2078 @param aPM
       
  2079 Pointer to the ParameterManager
       
  2080 @param aOption
       
  2081 Option that is passed as input, in this case --compressionmethod
       
  2082 @param aValue
       
  2083 The value passed to --compressionmethod option, in this case none|inflate|bytepair
       
  2084 @param aDesc
       
  2085 Pointer to function ParameterManager::ParseCompressionMethod returning void.
       
  2086 */
       
  2087 DEFINE_PARAM_PARSER(ParameterManager::ParseCompressionMethod)
       
  2088 {
       
  2089 	INITIALISE_PARAM_PARSER;
       
  2090 	UINT method;
       
  2091 	if(!aValue)
       
  2092 		throw ParameterParserError(NOARGUMENTERROR, "--compressionmethod");
       
  2093 	
       
  2094 	if(ParseCompressionMethodArg(method, aValue) )
       
  2095 		aPM->SetCompressionMethod(method);
       
  2096 	else
       
  2097 		throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, "compression method");
       
  2098 }
       
  2099 
       
  2100 /**
       
  2101 This function parses the compression method value passed in and finds the corresponding match
       
  2102 from the list of existing method values.
       
  2103 
       
  2104 @internalComponent
       
  2105 @released
       
  2106 
       
  2107 
       
  2108 
       
  2109 /**
       
  2110 This function set the AllowDllData flag if --dlldata option is passed to the program.
       
  2111 
       
  2112 void ParameterManager::ParseAllowDllData(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  2113 
       
  2114 @internalComponent
       
  2115 @released
       
  2116 
       
  2117 @param aPM
       
  2118 Pointer to the ParameterManager
       
  2119 @param aOption
       
  2120 Option that is passed as input, in this case --dlldata
       
  2121 @param aValue
       
  2122 The value passed to --dlldata option, in this case NULL
       
  2123 @param aDesc
       
  2124 Pointer to function ParameterManager::ParseAllowDllData returning void.
       
  2125 */
       
  2126 DEFINE_PARAM_PARSER(ParameterManager::ParseAllowDllData)
       
  2127 {
       
  2128 	INITIALISE_PARAM_PARSER;
       
  2129 	CheckInput(aValue, "--dlldata");
       
  2130 	aPM->SetDllDataP(true);
       
  2131 }
       
  2132 
       
  2133 static const ParameterManager::PriorityValueDesc PriorityNames[] =
       
  2134 {
       
  2135 	{ "Low", EPriorityLow},
       
  2136 	{ "Background", EPriorityBackground},
       
  2137 	{ "Foreground", EPriorityForeground},
       
  2138 	{ "High", EPriorityHigh},
       
  2139 	{ "WindowServer", EPriorityWindowServer},
       
  2140 	{ "FileServer", EPriorityFileServer},
       
  2141 	{ "RealTimeServer", EPriorityRealTimeServer},
       
  2142 	{ "Supervisor", EPrioritySupervisor},
       
  2143 	{ 0, (TProcessPriority)0}
       
  2144 };
       
  2145 
       
  2146 /**
       
  2147 This function parses the priority value passed in and finds the corresponding match
       
  2148 from the list of existing priority values.
       
  2149 
       
  2150 @internalComponent
       
  2151 @released
       
  2152 
       
  2153 @param aPriority
       
  2154 Holds the priority value mapped from list.
       
  2155 @param aText
       
  2156 The priority value passed to --priority option
       
  2157 @return True if the priority value passed in is a valid one present in the list.
       
  2158 */
       
  2159 static bool ParsePriorityArg(unsigned int & aPriority, const char *aText)
       
  2160 {
       
  2161 	int i = 0;
       
  2162 	aPriority = 0;
       
  2163 	for (;; i++)
       
  2164 	{
       
  2165 		if (!PriorityNames[i].iName)
       
  2166 			return false;
       
  2167 		if (!stricmp(aText, PriorityNames[i].iName))
       
  2168 		{
       
  2169 			aPriority = PriorityNames[i].iPriority;
       
  2170 			return true;
       
  2171 		}
       
  2172 	}
       
  2173 	return false;
       
  2174 }
       
  2175 
       
  2176 
       
  2177 /**
       
  2178 This function set the priority value that is passed through --priority option.
       
  2179 
       
  2180 void ParameterManager::ParsePriority(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  2181 
       
  2182 @internalComponent
       
  2183 @released
       
  2184 
       
  2185 @param aPM
       
  2186 Pointer to the ParameterManager
       
  2187 @param aOption
       
  2188 Option that is passed as input, in this case --priority
       
  2189 @param aValue
       
  2190 The priority value passed to --priority option
       
  2191 @param aDesc
       
  2192 Pointer to function ParameterManager::ParsePriority returning void.
       
  2193 */
       
  2194 DEFINE_PARAM_PARSER(ParameterManager::ParsePriority)
       
  2195 {
       
  2196 	INITIALISE_PARAM_PARSER;
       
  2197 	unsigned int priority;
       
  2198 	if (!aValue)
       
  2199 		throw ParameterParserError(NOARGUMENTERROR, "--priority");
       
  2200 	if (GetUInt(priority, aValue) || ParsePriorityArg(priority, aValue))
       
  2201 		aPM->SetPriority((TProcessPriority)priority);
       
  2202 	else
       
  2203 		throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, "priority");
       
  2204 }
       
  2205 
       
  2206 /**
       
  2207 This function sets the predefined symbols, at the specified ordinal numbers, that are passed through 
       
  2208 --sysdef option.
       
  2209 
       
  2210 void ParameterManager::ParseSysDefs(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  2211 
       
  2212 @internalComponent
       
  2213 @released
       
  2214 
       
  2215 @param aPM
       
  2216 Pointer to the ParameterManager
       
  2217 @param aOption
       
  2218 Option that is passed as input, in this case --sysdef
       
  2219 @param aValue
       
  2220 The predefined symbols alongwith the ordinal numbers passed to --sysdef option
       
  2221 @param aDesc
       
  2222 Pointer to function ParameterManager::ParseSysDefs returning void.
       
  2223 */
       
  2224 DEFINE_PARAM_PARSER(ParameterManager::ParseSysDefs)
       
  2225 {
       
  2226 	INITIALISE_PARAM_PARSER;
       
  2227 	if (!aValue)
       
  2228 		throw ParameterParserError(NOARGUMENTERROR, "--sysdef");
       
  2229 	string aSysDefValues(aValue);
       
  2230 	string::iterator p = aSysDefValues.begin();
       
  2231 
       
  2232 	int sysdeflength = aSysDefValues.size();
       
  2233 	
       
  2234 	int parsesysdef = 1; 
       
  2235 
       
  2236 	int sysdefcount=0;
       
  2237 
       
  2238 	while (parsesysdef && sysdeflength)
       
  2239 	{
       
  2240 
       
  2241 		int q = 0;
       
  2242 		unsigned int ordinalnum = 0;
       
  2243 		char *symbol = 0;
       
  2244 
       
  2245 		int nq = aSysDefValues.find_first_of(",", q,sizeof(*p));
       
  2246 		if (nq && (nq != string::npos))
       
  2247 		{
       
  2248 			int len = nq;
       
  2249 			symbol = new char[len+1];
       
  2250 			memcpy(symbol, p, len);
       
  2251 			symbol[len] = 0;
       
  2252 			q = nq+1;
       
  2253 
       
  2254 			char val = *(p+q);
       
  2255 			if (!val || !isdigit(val))
       
  2256 				throw ParameterParserError(SYSDEFERROR, "--sysdef");
       
  2257 			ordinalnum = *(p+q) - '0';
       
  2258 			aPM->SetSysDefs(ordinalnum, symbol, sysdefcount);
       
  2259 
       
  2260 			unsigned int separator = aSysDefValues.find(";", 0);
       
  2261 
       
  2262 			if (separator && (separator != string::npos))
       
  2263 			{
       
  2264 				if (separator != (unsigned int)(q+1))
       
  2265 					throw ParameterParserError(MULTIPLESYSDEFERROR, "--sysdef");
       
  2266 				else 
       
  2267 				{
       
  2268 					sysdeflength -= separator + 1;
       
  2269 					aSysDefValues = aSysDefValues.substr(separator+1);
       
  2270 					sysdefcount++;
       
  2271 				}	
       
  2272 			}
       
  2273 			else
       
  2274 			{
       
  2275 				sysdeflength -= q+1;
       
  2276 				if (sysdeflength)
       
  2277 					throw ParameterParserError(MULTIPLESYSDEFERROR, "--sysdef");
       
  2278 				else
       
  2279 					parsesysdef = 0;
       
  2280 			}
       
  2281 		}
       
  2282 		else
       
  2283 		{
       
  2284 			if (!nq && sysdeflength)
       
  2285 				throw ParameterParserError(SYSDEFNOSYMBOLERROR, "--sysdef");
       
  2286 			else
       
  2287 				throw ParameterParserError(SYSDEFERROR, "--sysdef");
       
  2288 		}
       
  2289 	}
       
  2290 }
       
  2291 
       
  2292 /**
       
  2293 This function parses the capability value passed to --capability option.
       
  2294 
       
  2295 @internalComponent
       
  2296 @released
       
  2297 
       
  2298 @param aName
       
  2299 The pointer marking the beginning value passed to the --capability option
       
  2300 @param aEnd
       
  2301 The pointer marking the end value passed to the --capability option
       
  2302 @param aCapabilities
       
  2303 List of Capability Values allowed
       
  2304 @param aInvert
       
  2305 Flag to denote if value can be inverted.
       
  2306 */
       
  2307 void ParameterManager::ParseCapability1(const char * aName, const char * aEnd, SCapabilitySet& aCapabilities, bool aInvert)
       
  2308 {
       
  2309 	int n = aEnd - aName;
       
  2310 	int i = 0;
       
  2311 	if(n==3 && strnicmp("all",aName,n)==0)
       
  2312 	{
       
  2313 		if(aInvert)
       
  2314 			throw CapabilityError(CAPABILITYALLINVERSIONERROR);
       
  2315 
       
  2316 		for(i=0; i<ECapability_Limit; i++)
       
  2317 		{
       
  2318 			if(CapabilityNames[i])
       
  2319 				aCapabilities[i>>5] |= (1<<(i&31));
       
  2320 		}
       
  2321 		return;
       
  2322 	}
       
  2323 
       
  2324 	if(n==4 && strnicmp("none",aName,n)==0)
       
  2325 	{
       
  2326 		if(aInvert)
       
  2327 			throw CapabilityError(CAPABILITYNONEINVERSIONERROR);
       
  2328 
       
  2329 		memset(&aCapabilities,0,sizeof(aCapabilities));
       
  2330 		return;
       
  2331 	}
       
  2332 
       
  2333 	for(i=0; i<ECapability_Limit; i++)
       
  2334 	{
       
  2335 		const char* cap = CapabilityNames[i];
       
  2336 		if(!cap)
       
  2337 			continue;
       
  2338 		if((int)strlen(cap)!=n)
       
  2339 			continue;
       
  2340 		if(strnicmp(cap,aName,n)!=0)
       
  2341 			continue;
       
  2342 		break;
       
  2343 	}
       
  2344 	if(i>=ECapability_Limit)
       
  2345 	{
       
  2346 		string aBadCap(aName, aEnd);
       
  2347 		throw UnrecognisedCapabilityError(UNRECOGNISEDCAPABILITYERROR,"BAD CAP");
       
  2348 	}
       
  2349 	if(aInvert)
       
  2350 		aCapabilities[i>>5] &= ~(1<<(i&31));
       
  2351 	else
       
  2352 		aCapabilities[i>>5] |= (1<<(i&31));
       
  2353 }
       
  2354 
       
  2355 /**
       
  2356 This function parses the capability value passed to --capability option.
       
  2357 
       
  2358 @internalComponent
       
  2359 @released
       
  2360 
       
  2361 @param aCapabilities
       
  2362 List of Capability Values allowed
       
  2363 @param aText
       
  2364 Value passed to --capability option.
       
  2365 */
       
  2366 void ParameterManager::ParseCapabilitiesArg(SCapabilitySet& aCapabilities, const char *aText)
       
  2367 {
       
  2368 	string aCapList(aText);
       
  2369 	string::iterator b = aCapList.begin();
       
  2370 	string::iterator e = b;
       
  2371 	bool invert = false;
       
  2372 
       
  2373 	while(e != aCapList.end())
       
  2374 	{
       
  2375 		invert = false;
       
  2376 		if (*b == '-')
       
  2377 		{
       
  2378 			invert = true;
       
  2379 			b++;
       
  2380 		}
       
  2381 		else if (*b == '+')
       
  2382 			b++;
       
  2383 
       
  2384 		e = b;
       
  2385 		for (; e != aCapList.end(); e++)
       
  2386 		{
       
  2387 			if (*e == '-' || *e == '+') break;
       
  2388 		}
       
  2389 		if (e != b)
       
  2390 			ParseCapability1(b, e, aCapabilities, invert);
       
  2391 
       
  2392 		b = e;
       
  2393 		
       
  2394 	}
       
  2395 }
       
  2396 
       
  2397 /**
       
  2398 This function parses the capability value passed to --capability option.
       
  2399 
       
  2400 void ParameterManager::ParseCapability(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  2401 
       
  2402 @internalComponent
       
  2403 @released
       
  2404 
       
  2405 @param aPM
       
  2406 Pointer to the ParameterManager
       
  2407 @param aOption
       
  2408 Option that is passed as input, in this case --capability
       
  2409 @param aValue
       
  2410 The predefined symbols alongwith the ordinal numbers passed to --capability option
       
  2411 @param aDesc
       
  2412 Pointer to function ParameterManager::ParseCapability returning void.
       
  2413 */
       
  2414 DEFINE_PARAM_PARSER(ParameterManager::ParseCapability)
       
  2415 {
       
  2416 	INITIALISE_PARAM_PARSER;
       
  2417 	unsigned int cap;
       
  2418 	SCapabilitySet capSet = {0, 0};
       
  2419 	if (!aValue)
       
  2420 		throw ParameterParserError(NOARGUMENTERROR, "--capability");
       
  2421 	if (GetUInt(cap, aValue))
       
  2422 	{
       
  2423 		aPM->SetCapability(cap);
       
  2424 	}
       
  2425 	else
       
  2426 	{
       
  2427 		aPM->ParseCapabilitiesArg(capSet, aValue);
       
  2428 		aPM->SetCapability(capSet);
       
  2429 	}
       
  2430 }
       
  2431 
       
  2432 /**
       
  2433 This function set the Heap Reserved and Committed Size value that is passed through --heap option.
       
  2434 
       
  2435 void ParameterManager::ParseHeap(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  2436 
       
  2437 @internalComponent
       
  2438 @released
       
  2439 
       
  2440 @param aPM
       
  2441 Pointer to the ParameterManager
       
  2442 @param aOption
       
  2443 Option that is passed as input, in this case --heap
       
  2444 @param aValue
       
  2445 The Heap Reserved and Committed Size value passed to --heap option separated by ','.
       
  2446 @param aDesc
       
  2447 Pointer to function ParameterManager::ParseHeap returning void.
       
  2448 */
       
  2449 DEFINE_PARAM_PARSER(ParameterManager::ParseHeap)
       
  2450 {
       
  2451 	INITIALISE_PARAM_PARSER;
       
  2452 	string aArg(aValue);
       
  2453 	UINT committed = aPM->HeapCommittedSize();
       
  2454 	UINT reserved = aPM->HeapReservedSize();
       
  2455 	int p = aArg.find_first_of(",");
       
  2456 	if (p  < 0)
       
  2457 	{
       
  2458 		if ( !GetUInt(committed, aValue)) 
       
  2459 			throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, "heap");
       
  2460 	}
       
  2461 	else
       
  2462 	{
       
  2463 		aArg[p] = 0;
       
  2464 		const char * committedval = aArg.c_str();
       
  2465 		const char * reservedval = committedval + p + 1;
       
  2466 		if (!(GetUInt(committed, committedval) && GetUInt(reserved, reservedval)))
       
  2467 			throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, "heap");
       
  2468 	}
       
  2469 	aPM->SetHeapCommittedSize(committed);
       
  2470 	aPM->SetHeapReservedSize(reserved);
       
  2471 }
       
  2472 
       
  2473 /**
       
  2474 This function set the stack Committed Size that is passed through --stack option.
       
  2475 
       
  2476 void ParameterManager::ParseStackCommitted(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  2477 
       
  2478 @internalComponent
       
  2479 @released
       
  2480 
       
  2481 @param aPM
       
  2482 Pointer to the ParameterManager
       
  2483 @param aOption
       
  2484 Option that is passed as input, in this case --stack
       
  2485 @param aValue
       
  2486 The Stack Committed Size value passed to --stack option.
       
  2487 @param aDesc
       
  2488 Pointer to function ParameterManager::ParseStackCommitted returning void.
       
  2489 */
       
  2490 DEFINE_PARAM_PARSER(ParameterManager::ParseStackCommitted)
       
  2491 {
       
  2492 	INITIALISE_PARAM_PARSER;
       
  2493 	UINT aSize = ValidateInputVal(aValue, "--stack");
       
  2494 	aPM->SetStackCommittedSize(aSize);
       
  2495 }
       
  2496 
       
  2497 /**
       
  2498 This function set the Unfrozen flag if --unfrozen option is passed to the program.
       
  2499 
       
  2500 void ParameterManager::ParseUnfrozen(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  2501 
       
  2502 @internalComponent
       
  2503 @released
       
  2504 
       
  2505 @param aPM
       
  2506 Pointer to the ParameterManager
       
  2507 @param aOption
       
  2508 Option that is passed as input, in this case --unfrozen
       
  2509 @param aValue
       
  2510 The value passed to --unfrozen option, in this case NULL
       
  2511 @param aDesc
       
  2512 Pointer to function ParameterManager::ParseUnfrozen returning void.
       
  2513 */
       
  2514 DEFINE_PARAM_PARSER(ParameterManager::ParseUnfrozen)
       
  2515 {
       
  2516 	INITIALISE_PARAM_PARSER;
       
  2517 	CheckInput(aValue, "--unfrozen");
       
  2518 	aPM->SetUnfrozen(true);
       
  2519 }
       
  2520 
       
  2521 /**
       
  2522 This function set the ignorenoncallable flag if --ignorenoncallable option is passed to the program.
       
  2523 
       
  2524 void ParameterManager::ParseIgnoreNonCallable(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  2525 
       
  2526 @internalComponent
       
  2527 @released
       
  2528 
       
  2529 @param aPM
       
  2530 Pointer to the ParameterManager
       
  2531 @param aOption
       
  2532 Option that is passed as input, in this case --ignorenoncallable
       
  2533 @param aValue
       
  2534 The value passed to --ignorenoncallable option, in this case NULL
       
  2535 @param aDesc
       
  2536 Pointer to function ParameterManager::Parseignorenoncallable returning void.
       
  2537 */
       
  2538 DEFINE_PARAM_PARSER(ParameterManager::ParseIgnoreNonCallable)
       
  2539 {
       
  2540 	INITIALISE_PARAM_PARSER;
       
  2541 	CheckInput(aValue, "--ignorenoncallable");
       
  2542 	aPM->SetIgnoreNonCallable(true);
       
  2543 }
       
  2544 
       
  2545 /**
       
  2546 This function sets the FPU type that is passed using the --fpu option.
       
  2547 
       
  2548 void ParameterManager::ParseFPU(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  2549 
       
  2550 @internalComponent
       
  2551 @released
       
  2552 
       
  2553 @param aPM
       
  2554 Pointer to the ParameterManager
       
  2555 @param aOption
       
  2556 Option that is passed as input, in this case --fpu
       
  2557 @param aValue
       
  2558 The fpu information passed to the --fpu option
       
  2559 @param aDesc
       
  2560 Pointer to function ParameterManager::ParseFPU returning void.
       
  2561 */
       
  2562 DEFINE_PARAM_PARSER(ParameterManager::ParseFPU)
       
  2563 {
       
  2564 	INITIALISE_PARAM_PARSER;
       
  2565 
       
  2566 	if (strnicmp(aValue, "softvfp", 7)==0)
       
  2567 		aPM->SetFPU(0);
       
  2568 	else if (strnicmp(aValue, "vfpv2", 5)==0)
       
  2569 		aPM->SetFPU(1);
       
  2570 	else
       
  2571 		throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, aOption);
       
  2572 }
       
  2573 
       
  2574 /**
       
  2575 This function set the Paged flag if --paged option is passed to the program.
       
  2576 
       
  2577 void ParameterManager::ParsePaged(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  2578 
       
  2579 @internalComponent
       
  2580 @released
       
  2581 
       
  2582 @param aPM
       
  2583 Pointer to the ParameterManager
       
  2584 @param aOption
       
  2585 Option that is passed as input, in this case --paged
       
  2586 @param aValue
       
  2587 The value passed to --paged option, in this case NULL
       
  2588 @param aDesc
       
  2589 Pointer to function ParameterManager::ParsePaged returning void.
       
  2590 */
       
  2591 DEFINE_PARAM_PARSER(ParameterManager::ParsePaged)
       
  2592 {
       
  2593 	INITIALISE_PARAM_PARSER;
       
  2594 	CheckInput(aValue, "--paged");
       
  2595 
       
  2596 	if (aPM->IsCodeUnpaged() || aPM->IsCodeDefaultPaged())
       
  2597 	{
       
  2598 		throw InvalidInvocationError(INVALIDINVOCATIONERROR);
       
  2599 	}
       
  2600 
       
  2601 	aPM->SetCodePaged(true);
       
  2602 }
       
  2603 
       
  2604 /**
       
  2605 This function set the Unpaged flag if --unpaged option is passed to the program.
       
  2606 
       
  2607 void ParameterManager::ParseUnpaged(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  2608 
       
  2609 @internalComponent
       
  2610 @released
       
  2611 
       
  2612 @param aPM
       
  2613 Pointer to the ParameterManager
       
  2614 @param aOption
       
  2615 Option that is passed as input, in this case --unpaged
       
  2616 @param aValue
       
  2617 The value passed to --unpaged option, in this case NULL
       
  2618 @param aDesc
       
  2619 Pointer to function ParameterManager::ParseUnpaged returning void.
       
  2620 */
       
  2621 DEFINE_PARAM_PARSER(ParameterManager::ParseUnpaged)
       
  2622 {
       
  2623 	INITIALISE_PARAM_PARSER;
       
  2624 	CheckInput(aValue, "--unpaged");
       
  2625 
       
  2626 	if (aPM->IsCodePaged() || aPM->IsCodeDefaultPaged())
       
  2627 	{
       
  2628 		throw InvalidInvocationError(INVALIDINVOCATIONERROR);
       
  2629 	}
       
  2630 	
       
  2631 	aPM->SetCodeUnpaged(true);
       
  2632 }
       
  2633 
       
  2634 /**
       
  2635 This function set the Defaultpaged flag if --defaultpaged option is passed to the program.
       
  2636 
       
  2637 void ParameterManager::ParseDefaultpaged(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  2638 
       
  2639 @internalComponent
       
  2640 @released
       
  2641 
       
  2642 @param aPM
       
  2643 Pointer to the ParameterManager
       
  2644 @param aOption
       
  2645 Option that is passed as input, in this case --defaultpaged
       
  2646 @param aValue
       
  2647 The value passed to --defaultpaged option, in this case NULL
       
  2648 @param aDesc
       
  2649 Pointer to function ParameterManager::ParseDefaultpaged returning void.
       
  2650 */
       
  2651 DEFINE_PARAM_PARSER(ParameterManager::ParseDefaultPaged)
       
  2652 {
       
  2653 	INITIALISE_PARAM_PARSER;
       
  2654 	CheckInput(aValue, "--defaultpaged");
       
  2655 
       
  2656 	if (aPM->IsCodePaged() || aPM->IsCodeUnpaged())
       
  2657 	{
       
  2658 		throw InvalidInvocationError(INVALIDINVOCATIONERROR);
       
  2659 	}
       
  2660 	
       
  2661 	aPM->SetCodeDefaultPaged(true);
       
  2662 }
       
  2663 
       
  2664 
       
  2665 /**
       
  2666 @internalComponent
       
  2667 @released
       
  2668 */
       
  2669 DEFINE_PARAM_PARSER(ParameterManager::ParseCodePaging)
       
  2670 {
       
  2671 	INITIALISE_PARAM_PARSER;
       
  2672 
       
  2673 	if (strnicmp(aValue, "paged", 5)==0)
       
  2674     {
       
  2675         aPM->SetCodePaged(true);
       
  2676     }
       
  2677 	else if (strnicmp(aValue, "unpaged", 7)==0)
       
  2678     {
       
  2679         aPM->SetCodeUnpaged(true);
       
  2680     }
       
  2681 	else if (strnicmp(aValue, "default", 7)==0)
       
  2682     {
       
  2683         aPM->SetCodeDefaultPaged(true);
       
  2684     }
       
  2685 	else
       
  2686     {
       
  2687         throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, aOption);
       
  2688     }
       
  2689 
       
  2690 	// Check that we haven't been given conflicting options.
       
  2691 
       
  2692     unsigned check = 0;
       
  2693 
       
  2694     if ( aPM->IsCodePaged() )
       
  2695     {
       
  2696         check++;
       
  2697     }
       
  2698     if ( aPM->IsCodeUnpaged() )
       
  2699     {
       
  2700         check++;
       
  2701     }
       
  2702     if ( aPM->IsCodeDefaultPaged() )
       
  2703     {
       
  2704         check++;
       
  2705     }
       
  2706 
       
  2707     if (check > 1)
       
  2708     {
       
  2709 		throw InvalidInvocationError(INVALIDINVOCATIONERROR);
       
  2710     }
       
  2711 }
       
  2712 
       
  2713 /**
       
  2714 @internalComponent
       
  2715 @released
       
  2716 */
       
  2717 DEFINE_PARAM_PARSER(ParameterManager::ParseDataPaging)
       
  2718 {
       
  2719 	INITIALISE_PARAM_PARSER;
       
  2720 
       
  2721 	if (strnicmp(aValue, "paged", 5)==0)
       
  2722     {
       
  2723         aPM->SetDataPaged(true);
       
  2724     }
       
  2725 	else if (strnicmp(aValue, "unpaged", 7)==0)
       
  2726     {
       
  2727         aPM->SetDataUnpaged(true);
       
  2728     }
       
  2729 	else if (strnicmp(aValue, "default", 7)==0)
       
  2730     {
       
  2731         aPM->SetDataDefaultPaged(true);
       
  2732     }
       
  2733 	else
       
  2734     {
       
  2735         throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, aOption);
       
  2736     }
       
  2737 
       
  2738 	// Check that we haven't been given conflicting options.
       
  2739 
       
  2740     unsigned check = 0;
       
  2741 
       
  2742     if ( aPM->IsDataPaged() )
       
  2743     {
       
  2744         check++;
       
  2745     }
       
  2746     if ( aPM->IsDataUnpaged() )
       
  2747     {
       
  2748         check++;
       
  2749     }
       
  2750     if ( aPM->IsDataDefaultPaged() )
       
  2751     {
       
  2752         check++;
       
  2753     }
       
  2754 
       
  2755     if (check > 1)
       
  2756     {
       
  2757 		throw InvalidInvocationError(INVALIDINVOCATIONERROR);
       
  2758     }
       
  2759 }
       
  2760 
       
  2761 
       
  2762 /**
       
  2763 This function sets the iExcludeUnwantedExports flag if --excludeunwantedexports option is passed to the program.
       
  2764 
       
  2765 void ParameterManager::ParseExcludeUnwantedExports(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  2766 
       
  2767 @internalComponent
       
  2768 @released
       
  2769 
       
  2770 @param aPM
       
  2771 Pointer to the ParameterManager
       
  2772 @param aOption
       
  2773 Option that is passed as input, in this case --excludeunwantedexports
       
  2774 @param aValue
       
  2775 The value passed to --excludeunwantedexports, in this case NULL
       
  2776 @param aDesc
       
  2777 Pointer to function ParameterManager::ParseExcludeUnwantedExports returning void.
       
  2778 */
       
  2779 DEFINE_PARAM_PARSER(ParameterManager::ParseExcludeUnwantedExports)
       
  2780 {
       
  2781 	INITIALISE_PARAM_PARSER;
       
  2782 	CheckInput(aValue, "--excludeunwantedexports");
       
  2783 	aPM->SetExcludeUnwantedExports(true);
       
  2784 }
       
  2785 
       
  2786 /**
       
  2787 This function sets the customdlltarget flag if --customdlltarget option is passed to the program.
       
  2788 
       
  2789 void ParameterManager::ParseIsCustomDllTarget(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  2790 
       
  2791 @internalComponent
       
  2792 @released
       
  2793 
       
  2794 @param aPM
       
  2795 Pointer to the ParameterManager
       
  2796 @param aOption
       
  2797 Option that is passed as input, in this case --customdlltarget
       
  2798 @param aValue
       
  2799 The value passed to --customdlltarget option, in this case NULL
       
  2800 @param aDesc
       
  2801 Pointer to function ParameterManager::ParseIsCustomDllTarget returning void.
       
  2802 */
       
  2803 DEFINE_PARAM_PARSER(ParameterManager::ParseIsCustomDllTarget)
       
  2804 {
       
  2805 	INITIALISE_PARAM_PARSER;
       
  2806 	CheckInput(aValue, "--customdlltarget");
       
  2807 	aPM->SetCustomDllTarget(true);
       
  2808 }
       
  2809 
       
  2810 DEFINE_PARAM_PARSER(ParameterManager::ParseSymNamedLookup)
       
  2811 {
       
  2812 	INITIALISE_PARAM_PARSER;
       
  2813 	CheckInput(aValue, "--namedlookup");
       
  2814 	aPM->SetSymNamedLookup(true);
       
  2815 }
       
  2816 
       
  2817 /**
       
  2818 This function set the iDebuggable flag if --debuggable option is passed to the program.
       
  2819 
       
  2820 void ParameterManager::ParseDebuggable(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  2821 
       
  2822 @internalComponent
       
  2823 @released
       
  2824 
       
  2825 @param aPM
       
  2826 Pointer to the ParameterManager
       
  2827 @param aOption
       
  2828 Option that is passed as input, in this case --debuggable
       
  2829 @param aValue
       
  2830 The value passed to --debuggable option, in this case NULL
       
  2831 @param aDesc
       
  2832 Pointer to function ParameterManager::ParseDebuggable returning void.
       
  2833 */
       
  2834 DEFINE_PARAM_PARSER(ParameterManager::ParseDebuggable)
       
  2835 {
       
  2836 	INITIALISE_PARAM_PARSER;
       
  2837 	CheckInput(aValue, "--debuggable");
       
  2838 	aPM->SetDebuggable(true); 
       
  2839 }
       
  2840 
       
  2841 
       
  2842 DEFINE_PARAM_PARSER(ParameterManager::ParseSmpSafe)
       
  2843 {
       
  2844 	INITIALISE_PARAM_PARSER;
       
  2845 	CheckInput(aValue, "--smpsafe");
       
  2846 	aPM->SetSmpSafe(true); 
       
  2847 }
       
  2848 
       
  2849 static const ParameterManager::TargetTypeDesc DefaultTargetTypes[] =
       
  2850 {
       
  2851 	{ "DLL", EDll },
       
  2852 	{ "LIB", ELib },
       
  2853 	// allow full name
       
  2854 	{ "LIBRARY", ELib},
       
  2855 	{ "IMPLIB", ELib},
       
  2856 	{ "EXE", EExe},
       
  2857 	{ "ANI", EPolyDll},
       
  2858 	{ "APP", EPolyDll},
       
  2859 	{ "CTL", EPolyDll},
       
  2860 	{ "CTPKG", EPolyDll},
       
  2861 	{ "FSY", EPolyDll},
       
  2862 	{ "LDD", EPolyDll},
       
  2863 	{ "ECOMIIC", EPolyDll},
       
  2864 	{ "PLUGIN", EPolyDll},
       
  2865 	{ "PLUGIN3", EPolyDll},
       
  2866 	{ "KDLL", EPolyDll},
       
  2867 	{ "KEXT", EPolyDll},
       
  2868 	{ "MDA", EPolyDll},
       
  2869 	{ "MDl", EPolyDll},
       
  2870 	{ "RDL", EPolyDll},
       
  2871 	{ "NOTIFIER", EPolyDll},
       
  2872 	{ "NOTIFIER2", EPolyDll},
       
  2873 	{ "TEXTNOTIFIER2", EPolyDll},
       
  2874 	{ "PDD", EPolyDll},
       
  2875 	{ "PDL", EPolyDll},
       
  2876 	{ "VAR", EPolyDll},
       
  2877 	{ "VAR2", EPolyDll},
       
  2878 	{ "EXEXP", EExexp},
       
  2879 	{ "STDEXE", EStdExe},
       
  2880 	{ "STDDLL", EDll},
       
  2881 	{ 0, EInvalidTargetType }
       
  2882 };
       
  2883 
       
  2884 /**
       
  2885 Function to check if the given target type is a valid one from the list.
       
  2886 
       
  2887 @internalComponent
       
  2888 @released
       
  2889 
       
  2890 @param aArg
       
  2891 Value to be checked, the one that is passed to '--targettype'.
       
  2892 @return True if the provided value is a valid targettype.
       
  2893 */
       
  2894 static ETargetType IsDefaultTargetType(const char * aArg)
       
  2895 {
       
  2896 	for (int i = 0; DefaultTargetTypes[i].iName; i++)
       
  2897 	{
       
  2898 		if (aArg && !stricmp(aArg, DefaultTargetTypes[i].iName)) 
       
  2899 			return DefaultTargetTypes[i].iTargetType;
       
  2900 	}
       
  2901 	return EInvalidTargetType;
       
  2902 }
       
  2903 
       
  2904 /**
       
  2905 Function to check if the given target type is a valid one from the list. If no value is
       
  2906 passed or if unsupported targettypes are passed, then the appropriate warnings are displayed.
       
  2907 
       
  2908 @internalComponent
       
  2909 @released
       
  2910 
       
  2911 @param aArg
       
  2912 Value to be checked, the one that is passed to '--targettype'.
       
  2913 @return the appropriate matching value from the list.
       
  2914 */
       
  2915 ETargetType ParameterManager::ValidateTargetType(const char * aArg)
       
  2916 {
       
  2917 	ETargetType res = IsDefaultTargetType(aArg);
       
  2918 	if (res == EInvalidTargetType)
       
  2919 	{
       
  2920 		if (aArg)
       
  2921 			MessageHandler::GetInstance()->ReportMessage(WARNING, UNSUPPORTEDTARGETTYPEERROR,aArg);
       
  2922 		else
       
  2923 			MessageHandler::GetInstance()->ReportMessage(WARNING, TARGETTYPENOTSPECIFIEDERROR);
       
  2924 	}
       
  2925 	return res;
       
  2926 }
       
  2927 
       
  2928 /**
       
  2929 This function set the target type that is passed through --targettype option.
       
  2930 
       
  2931 void ParameterManager::ParseTargetTypeName(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  2932 
       
  2933 @internalComponent
       
  2934 @released
       
  2935 
       
  2936 @param aPM
       
  2937 Pointer to the ParameterManager
       
  2938 @param aOption
       
  2939 Option that is passed as input, in this case --targettype
       
  2940 @param aValue
       
  2941 The target type passed to --targettype option
       
  2942 @param aDesc
       
  2943 Pointer to function ParameterManager::ParseTargetTypeName returning void.
       
  2944 */
       
  2945 DEFINE_PARAM_PARSER(ParameterManager::ParseTargetTypeName)
       
  2946 {
       
  2947 	INITIALISE_PARAM_PARSER;
       
  2948 	aPM->SetTargetTypeName(aPM->ValidateTargetType(aValue));
       
  2949 }
       
  2950 
       
  2951 /**
       
  2952 This function set the output DSO file name that is passed through --dso option.
       
  2953 
       
  2954 void ParameterManager::ParseDSOOutput(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  2955 
       
  2956 @internalComponent
       
  2957 @released
       
  2958 
       
  2959 @param aPM
       
  2960 Pointer to the ParameterManager
       
  2961 @param aOption
       
  2962 Option that is passed as input, in this case --dso
       
  2963 @param aValue
       
  2964 The DSO file name passed to --dso option
       
  2965 @param aDesc
       
  2966 Pointer to function ParameterManager::ParseDSOOutput returning void.
       
  2967 */
       
  2968 DEFINE_PARAM_PARSER(ParameterManager::ParseDSOOutput)
       
  2969 {
       
  2970 	INITIALISE_PARAM_PARSER;
       
  2971 	aPM->SetDSOOutput(aValue);
       
  2972 }
       
  2973 
       
  2974 /**
       
  2975 This function displays the usage information if --help option is passed in.
       
  2976 For invalid option, this function displays the usage information and throws the
       
  2977 appropriate error message.
       
  2978 
       
  2979 void ParameterManager::ParamHelp(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  2980 
       
  2981 @internalComponent
       
  2982 @released
       
  2983 
       
  2984 @param aPM
       
  2985 Pointer to the ParameterManager
       
  2986 @param aOption
       
  2987 Option that is passed as input, in this case --help or -h
       
  2988 @param aValue
       
  2989 The value passed to --help option, in this case, no value, hence 0.
       
  2990 @param aDesc
       
  2991 Pointer to function ParameterManager::ParamHelp returning void.
       
  2992 */
       
  2993 DEFINE_PARAM_PARSER(ParameterManager::ParamHelp)
       
  2994 {
       
  2995 	INITIALISE_PARAM_PARSER;
       
  2996 	using std::cerr;
       
  2997 	using std::endl;
       
  2998 
       
  2999 	cerr << "\nSymbian Post Linker, " << "Elf2E32"
       
  3000          << " V" << MajorVersion << "." << MinorVersion << " (Build "<<Build <<")"
       
  3001          << endl;
       
  3002 
       
  3003 	cerr << "Usage:\t" << "elf2e32" << " [options] [filename]\n" << endl;
       
  3004     
       
  3005     cerr << "Options:\n" ;
       
  3006 
       
  3007 	const OptionDesc * aHelpDesc = aPM->iOptionMap["help"];
       
  3008 	int lim = aPM->NumOptions();
       
  3009 	for (int i = 0; i < lim; i++)
       
  3010 	{
       
  3011 		if (aPM->iOptions[i].iName == aHelpDesc->iName)
       
  3012 		{
       
  3013 			cerr << '\t' << aPM->iParamPrefix << aPM->iOptions[i].iName 
       
  3014 				<< " : This command." << endl;
       
  3015 		}
       
  3016 		else
       
  3017 		{
       
  3018 			cerr << '\t' << aPM->iParamPrefix << aPM->iOptions[i].iName;
       
  3019 			if (aPM->iOptions[i].iDoc) cerr << aPM->iParamEquals << aPM->iOptions[i].iDoc;
       
  3020 			cerr << endl;
       
  3021 		}
       
  3022 	}
       
  3023 	
       
  3024 	if (!aDesc)
       
  3025 		exit(EXIT_FAILURE);
       
  3026 	else
       
  3027 		exit(EXIT_SUCCESS);
       
  3028 }
       
  3029 
       
  3030 /**
       
  3031 This function set the LibPath that is passed through --libpath option.
       
  3032 
       
  3033 void ParameterManager::ParseLibPath(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  3034 
       
  3035 @internalComponent
       
  3036 @released
       
  3037 
       
  3038 @param aPM
       
  3039 Pointer to the ParameterManager
       
  3040 @param aOption
       
  3041 Option that is passed as input, in this case --libpath
       
  3042 @param aValue
       
  3043 The LibPath value passed to --libpath option.
       
  3044 @param aDesc
       
  3045 Pointer to function ParameterManager::ParseLibPath returning void.
       
  3046 */
       
  3047 DEFINE_PARAM_PARSER(ParameterManager::ParseLibPaths)
       
  3048 {
       
  3049 	INITIALISE_PARAM_PARSER;
       
  3050 	if (!aValue)
       
  3051 		throw ParameterParserError(NOARGUMENTERROR, "--libpath");
       
  3052 	string aPathList(aValue);
       
  3053 	const char* p = aPathList.c_str(); 
       
  3054 	int n =  strlen(p); 
       
  3055 	int q = 0;
       
  3056 	while (n)
       
  3057 	{
       
  3058 		int nq = aPathList.find_first_of(";", q, sizeof(*p));
       
  3059 		if (nq > 0)
       
  3060 		{
       
  3061 			// handle case where there are multiple paths which are ; separated
       
  3062 			int len = nq - q;
       
  3063 			if (p[len-1] == aPM->DirectorySeparator()) len--;
       
  3064 			char * path = new char[len+1];
       
  3065 			memcpy(path, p+q, len);
       
  3066 			path[len] = 0;
       
  3067 			aPM->iLibPathList.push_back(path);
       
  3068 			n -= nq - q + 1;
       
  3069 			q = nq+1;
       
  3070 		}
       
  3071 		else
       
  3072 		{
       
  3073 			p += q;
       
  3074 			int len = strlen(p);
       
  3075 			if (p[len-1] == aPM->DirectorySeparator()) len--;
       
  3076 			char * path = new char[len+1];
       
  3077 			memcpy(path, p, len);
       
  3078 			path[len] = 0;
       
  3079 			aPM->iLibPathList.push_back(path);
       
  3080 			break;
       
  3081 		}
       
  3082 	}
       
  3083 }
       
  3084 
       
  3085 /**
       
  3086 This function sets the linkas dll name when --linkas option is passed in.
       
  3087 
       
  3088 void ParameterManager::ParseLinkAs(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  3089 
       
  3090 @internalComponent
       
  3091 @released
       
  3092 
       
  3093 @param aPM
       
  3094 Pointer to the ParameterManager
       
  3095 @param aOption
       
  3096 Option that is passed as input, in this case --linkas
       
  3097 @param aValue
       
  3098 The DLL name to be linked with passed through --linkas option
       
  3099 @param aDesc
       
  3100 Pointer to function ParameterManager::ParseLinkAs returning void.
       
  3101 */
       
  3102 DEFINE_PARAM_PARSER(ParameterManager::ParseLinkAs)
       
  3103 {
       
  3104 	INITIALISE_PARAM_PARSER;
       
  3105 	aPM->SetLinkDLLName(aValue);
       
  3106 }
       
  3107 
       
  3108 /**
       
  3109 This function set the sub options that are passed through --dump option.
       
  3110 
       
  3111 void ParameterManager::ParseFileDump(ParameterManager * aPM, char * aOption, char * aValue, void * aDesc)
       
  3112 
       
  3113 @internalComponent
       
  3114 @released
       
  3115 
       
  3116 @param aPM
       
  3117 Pointer to the ParameterManager
       
  3118 @param aOption
       
  3119 Option that is passed as input, in this case --dump
       
  3120 @param aValue
       
  3121 The FileDump suboptions passed to --dump option.
       
  3122 @param aDesc
       
  3123 Pointer to function ParameterManager::ParseFileDump returning void.
       
  3124 */
       
  3125 DEFINE_PARAM_PARSER(ParameterManager::ParseFileDump)
       
  3126 {
       
  3127       INITIALISE_PARAM_PARSER;
       
  3128       aPM->SetFileDumpOptions(aValue);
       
  3129 }
       
  3130 
       
  3131 /**
       
  3132 This function sets the target type that is passed as input through the --targettype option
       
  3133 and sets the flag if --targettype option is passed in.
       
  3134 
       
  3135 @internalComponent
       
  3136 @released
       
  3137 
       
  3138 @param aTargetTypeVal
       
  3139 Name of the input target type if provided as input through --targettype or 0.
       
  3140 */
       
  3141 void ParameterManager::SetTargetTypeName(ETargetType aTargetTypeVal)
       
  3142 {
       
  3143 	iTargetTypeOption = true;
       
  3144 	iTargetTypeName = aTargetTypeVal;
       
  3145 }
       
  3146 
       
  3147 /**
       
  3148 This function sets the DEF file name that is passed as input through the --definput option and
       
  3149 sets the flag if --definput option is passed in.
       
  3150 
       
  3151 @internalComponent
       
  3152 @released
       
  3153 
       
  3154 @param aDefInputVal
       
  3155 Name of the input DEF file if provided as input through --definput or 0.
       
  3156 */
       
  3157 void ParameterManager::SetDefInput(char * aDefInputVal)
       
  3158 {
       
  3159 	iDefFileInOption = true;
       
  3160 	iDefInput = aDefInputVal;
       
  3161 }
       
  3162 
       
  3163 /**
       
  3164 This function sets the DSO file name that is passed as input through the --dso option
       
  3165 and sets the flag if the --dso option is passed in.
       
  3166 
       
  3167 @internalComponent
       
  3168 @released
       
  3169 
       
  3170 @param aDSOOutputVal
       
  3171 Name of the output DSO file if provided as input through --dso or 0.
       
  3172 */
       
  3173 void ParameterManager::SetDSOOutput(char * aDSOOutputVal)
       
  3174 {
       
  3175 	iDSOFileOutOption = true;
       
  3176 	iDSOOutput = aDSOOutputVal;
       
  3177 }
       
  3178 
       
  3179 /**
       
  3180 This function sets the Elf file name that is passed as input through the --dsoin option.
       
  3181 
       
  3182 @internalComponent
       
  3183 @released
       
  3184 
       
  3185 @param aSetElfInput
       
  3186 Name of the input Elf file if provided as input through --dsoin or 0.
       
  3187 */
       
  3188 void ParameterManager::SetElfInput(char * aElfInputVal)
       
  3189 {
       
  3190 	iElfFileInOption = true;
       
  3191 	iElfInput = aElfInputVal;
       
  3192 }
       
  3193 
       
  3194 /**
       
  3195 This function sets the E32 name that is passed as input through the --e32dump option.
       
  3196 
       
  3197 @internalComponent
       
  3198 @released
       
  3199 
       
  3200 @param aSetE32Input
       
  3201 Name of the input E32 image if provided as input through --e32dump or 0.
       
  3202 */
       
  3203 void ParameterManager::SetE32Input(char * aSetE32Input)
       
  3204 {
       
  3205 	iE32ImageInOption = true;
       
  3206 	iE32Input = aSetE32Input;
       
  3207 }
       
  3208 
       
  3209 /**
       
  3210 This function sets the E32 dump options that is passed as input through the --dump option.
       
  3211 
       
  3212 @internalComponent
       
  3213 @released
       
  3214 
       
  3215 @param aSetFileDumpOptions
       
  3216 Dump sub options passed to --dump option
       
  3217 */
       
  3218 void ParameterManager::SetFileDumpOptions(char * aSetFileDumpOptions)
       
  3219 {
       
  3220 	iFileDumpOption = true;
       
  3221 	iFileDumpSubOptions = aSetFileDumpOptions;
       
  3222 
       
  3223 	if (aSetFileDumpOptions)
       
  3224 	{
       
  3225 		iDumpOptions=0;
       
  3226 		while (char c = *(aSetFileDumpOptions++))
       
  3227 		{
       
  3228 			if (c < 'a')
       
  3229 				c += 'a'-'A';
       
  3230 			switch(c)
       
  3231 			{
       
  3232 			case 'h': iDumpOptions |= EDumpHeader; break;
       
  3233 			case 's': iDumpOptions |= EDumpSecurityInfo; break;
       
  3234 			case 'c': iDumpOptions |= EDumpCode; break;
       
  3235 			case 'd': iDumpOptions |= EDumpData; break;
       
  3236 			case 'e': iDumpOptions |= EDumpExports; break;
       
  3237 			case 'i': iDumpOptions |= EDumpImports; break;
       
  3238 			case 'a': iDumpOptions |= EDumpAsm; break; //Dump the Assembler code
       
  3239 			case 't': iDumpOptions |= EDumpSymbols;break;
       
  3240 			default: 
       
  3241 				iDumpOptions=0;
       
  3242 				return;
       
  3243 			}
       
  3244 		}
       
  3245 	}
       
  3246 }
       
  3247 
       
  3248 /**
       
  3249 This function extracts the E32 image output that is passed as input through the --output option.
       
  3250 
       
  3251 @internalComponent
       
  3252 @released
       
  3253 
       
  3254 @param aSetE32Output
       
  3255 Name of the output E32 image output if provided as input through --output or 0.
       
  3256 */
       
  3257 void ParameterManager::SetE32Output(char * aSetE32Output)
       
  3258 {
       
  3259 	iOutFileOption = true;
       
  3260 	iOutFileName = aSetE32Output;
       
  3261 }
       
  3262 
       
  3263 /**
       
  3264 This function sets the output DEF file name that is passed as input through the --defoutput option.
       
  3265 
       
  3266 @internalComponent
       
  3267 @released
       
  3268 
       
  3269 @param aSetDefOutput
       
  3270 Name of the output DEF file if provided as input through --defoutput or 0.
       
  3271 */
       
  3272 void ParameterManager::SetDefOutput(char * aSetDefOutput)
       
  3273 {
       
  3274 	iDefFileOutOption = true;
       
  3275 	iDefOutput = aSetDefOutput;
       
  3276 }
       
  3277 
       
  3278 /**
       
  3279 This function sets the name of the DLL (that the DSO is to be linked with) that is passed 
       
  3280 as input through the --linkas option and sets the flag if the --linkas option is passed in.
       
  3281 
       
  3282 @internalComponent
       
  3283 @released
       
  3284 
       
  3285 @param aSetLinkDLLName
       
  3286 The DLL name with which the DSO is to be linked with
       
  3287 */
       
  3288 void ParameterManager::SetLinkDLLName(char * aSetLinkDLLName)
       
  3289 {
       
  3290 	iLinkAsOption = true;
       
  3291 	iLinkDLLName = aSetLinkDLLName;
       
  3292 }
       
  3293 
       
  3294 /**
       
  3295 This function sets the priority value.
       
  3296 
       
  3297 @internalComponent
       
  3298 @released
       
  3299 
       
  3300 @param anewVal
       
  3301 priority value passed in to --priority option.
       
  3302 */
       
  3303 void ParameterManager::SetPriority(TProcessPriority anewVal)
       
  3304 {
       
  3305 	iPriorityOption = true;
       
  3306 	iPriorityVal = anewVal;
       
  3307 }
       
  3308 
       
  3309 /**
       
  3310 This function sets the capability value.
       
  3311 
       
  3312 @internalComponent
       
  3313 @released
       
  3314 
       
  3315 @param anewVal
       
  3316 Capability value passed in to --capability option.
       
  3317 */
       
  3318 void ParameterManager::SetCapability(unsigned int anewVal)
       
  3319 {
       
  3320 	iCapability[0] = anewVal;
       
  3321 }
       
  3322 
       
  3323 /**
       
  3324 This function sets the capability value.
       
  3325 
       
  3326 @internalComponent
       
  3327 @released
       
  3328 
       
  3329 @param anewVal
       
  3330 Capability value passed in to --capability option.
       
  3331 */
       
  3332 void ParameterManager::SetCapability(SCapabilitySet & anewVal)
       
  3333 {
       
  3334 	iCapability = anewVal;
       
  3335 }
       
  3336 
       
  3337 /**
       
  3338 This function sets the list of predefined symbols passed to --sysdef option.
       
  3339 
       
  3340 @internalComponent
       
  3341 @released
       
  3342 
       
  3343 @param aOrdinalnum
       
  3344 Ordinal number of the predefined symbols
       
  3345 @param aSymbol
       
  3346 Symbol Name
       
  3347 @param aCount
       
  3348 Position of the predefined symbol
       
  3349 */
       
  3350 void ParameterManager::SetSysDefs(unsigned int aOrdinalnum, char* aSymbol, int aCount)
       
  3351 {
       
  3352 	iSysDefOption = 1;
       
  3353 	iSysDefSymbols[aCount].iSysDefOrdinalNum = aOrdinalnum;
       
  3354 	iSysDefSymbols[aCount].iSysDefSymbolName = aSymbol;
       
  3355 	iSysDefCount = (aCount+1);
       
  3356 }
       
  3357 
       
  3358 /**
       
  3359 This function sets the output LOG file name that is passed as input through the --log option.
       
  3360 
       
  3361 @internalComponent
       
  3362 @released
       
  3363 
       
  3364 @param aSetLogFile
       
  3365 Name of the output LOG file if provided as input through --log or 0.
       
  3366 */
       
  3367 void ParameterManager::SetLogFile(char * aSetLogFile)
       
  3368 {
       
  3369 	iLogFileOption = true;
       
  3370 	iLogFileName = aSetLogFile;
       
  3371 }
       
  3372 
       
  3373 /**
       
  3374 This function sets the Message file name that is passed as input through the --messagefile option.
       
  3375 
       
  3376 @internalComponent
       
  3377 @released
       
  3378 
       
  3379 @param aMessageFile
       
  3380 Name of the Message file if provided as input through --messagefile or 0.
       
  3381 */
       
  3382 void ParameterManager::SetMessageFile(char * aMessageFile)
       
  3383 {
       
  3384 	iMessageFileOption = true;
       
  3385 	iMessageFileName = aMessageFile;
       
  3386 }
       
  3387 
       
  3388 /**
       
  3389 This function sets the Message file name that is passed as input through the --dumpmessagefile option.
       
  3390 
       
  3391 @internalComponent
       
  3392 @released
       
  3393 
       
  3394 @param aDumpMessageFile
       
  3395 Name of the Message file to be dumped if provided as input through --dumpmessagefile or 0.
       
  3396 */
       
  3397 void ParameterManager::SetDumpMessageFile(char * aDumpMessageFile)
       
  3398 {
       
  3399 	iDumpMessageFileOption = true;
       
  3400 	iDumpMessageFileName = aDumpMessageFile;
       
  3401 }
       
  3402 
       
  3403 /**
       
  3404 This function sets iFixedAddress if --fixedaddress is passed in.
       
  3405 
       
  3406 @internalComponent
       
  3407 @released
       
  3408 
       
  3409 @param aVal
       
  3410 True if --fixedaddress is passed in.
       
  3411 */
       
  3412 void ParameterManager::SetFixedAddress(bool aSetFixedAddress)
       
  3413 {
       
  3414 	iFixedAddress = aSetFixedAddress;
       
  3415 }
       
  3416 
       
  3417 /**
       
  3418 This function sets iCompress if --uncompressed is passed in.
       
  3419 
       
  3420 @internalComponent
       
  3421 @released
       
  3422 
       
  3423 @param aVal
       
  3424 True if --uncompressed is passed in.
       
  3425 */
       
  3426 void ParameterManager::SetCompress(bool aSetCompress)
       
  3427 {
       
  3428 	iCompress = aSetCompress;
       
  3429 }
       
  3430 
       
  3431 /**
       
  3432 This function sets iCompress if --uncompressed is passed in.
       
  3433 
       
  3434 @internalComponent
       
  3435 @released
       
  3436 
       
  3437 @param aVal
       
  3438 True if --uncompressed is passed in.
       
  3439 */
       
  3440 void ParameterManager::SetCompressionMethod(UINT aCompressionMethod)
       
  3441 {
       
  3442 	
       
  3443 	iCompressionMethod = aCompressionMethod;
       
  3444 }
       
  3445 
       
  3446 
       
  3447 /**
       
  3448 This function sets iCallEntryPoint if --callentry is passed in.
       
  3449 
       
  3450 @internalComponent
       
  3451 @released
       
  3452 
       
  3453 @param aVal
       
  3454 True if --callentry is passed in.
       
  3455 */
       
  3456 void ParameterManager::SetCallEntryPoint(bool aSetCallEntryPoint)
       
  3457 {
       
  3458 	iCallEntryPoint = aSetCallEntryPoint;
       
  3459 }
       
  3460 
       
  3461 /**
       
  3462 This function sets the Version information passed to '--version' option.
       
  3463 
       
  3464 @internalComponent
       
  3465 @released
       
  3466 
       
  3467 @param aVersion information
       
  3468 Version information passed to '--version' option.
       
  3469 */
       
  3470 void  ParameterManager::SetVersion(UINT aSetVersion)
       
  3471 {
       
  3472 	iVersionOption = true;
       
  3473 	iVersion = aSetVersion;
       
  3474 }
       
  3475 
       
  3476 /**
       
  3477 This function sets the UID1 passed to '--uid1' option.
       
  3478 
       
  3479 @internalComponent
       
  3480 @released
       
  3481 
       
  3482 @param aUID1
       
  3483 UID1 passed to '--uid1' option.
       
  3484 */
       
  3485 void  ParameterManager::SetUID1(UINT aUID1)
       
  3486 {
       
  3487 	iUid1Option = true;
       
  3488 	iUID1 = aUID1;
       
  3489 }
       
  3490 
       
  3491 /**
       
  3492 This function sets the UID2 passed to '--uid2' option.
       
  3493 
       
  3494 @internalComponent
       
  3495 @released
       
  3496 
       
  3497 @param aUID2
       
  3498 UID2passed to '--uid2' option.
       
  3499 */
       
  3500 void  ParameterManager::SetUID2(UINT aUID2)
       
  3501 {
       
  3502 	iUID2 = aUID2;
       
  3503 }
       
  3504 
       
  3505 /**
       
  3506 This function sets the UID3 passed to '--uid3' option.
       
  3507 
       
  3508 @internalComponent
       
  3509 @released
       
  3510 
       
  3511 @param aUID3
       
  3512 UID3 passed to '--uid3' option.
       
  3513 */
       
  3514 void  ParameterManager::SetUID3(UINT aUID3)
       
  3515 {
       
  3516 	iUID3 = aUID3;
       
  3517 }
       
  3518 
       
  3519 /**
       
  3520 This function sets the Secure ID passed to '--sid' option.
       
  3521 
       
  3522 @internalComponent
       
  3523 @released
       
  3524 
       
  3525 @param aSetSecureID
       
  3526 Secure ID passed to '--sid' option.
       
  3527 */
       
  3528 void  ParameterManager::SetSecureId(UINT aSetSecureID)
       
  3529 {
       
  3530 	iSecureIDOption = true;
       
  3531 	iSecureID = aSetSecureID;
       
  3532 }
       
  3533 
       
  3534 /**
       
  3535 This function sets the Vendor ID passed to '--vid' option.
       
  3536 
       
  3537 @internalComponent
       
  3538 @released
       
  3539 
       
  3540 @param aSetVendorID
       
  3541 Vendor ID passed to '--vid' option.
       
  3542 */
       
  3543 void  ParameterManager::SetVendorId(UINT aSetVendorID)
       
  3544 {
       
  3545 	iVendorIDOption = true;
       
  3546 	iVendorID = aSetVendorID;
       
  3547 }
       
  3548 
       
  3549 /**
       
  3550 This function sets the heap committed size passed to '--heap' option.
       
  3551 
       
  3552 @internalComponent
       
  3553 @released
       
  3554 
       
  3555 @param aSetHeapCommittedSize
       
  3556 stack committed size passed to '--heap' option.
       
  3557 */
       
  3558 void  ParameterManager::SetHeapCommittedSize(UINT aSetHeapCommittedSize)
       
  3559 {
       
  3560 	iHeapCommittedSize = aSetHeapCommittedSize;
       
  3561 }
       
  3562 
       
  3563 /**
       
  3564 This function sets the heap reserver size passed to '--heap' option.
       
  3565 
       
  3566 @internalComponent
       
  3567 @released
       
  3568 
       
  3569 @param aSetStackReservedSize
       
  3570 stack reserved size passed to '--heap' option.
       
  3571 */
       
  3572 void  ParameterManager::SetHeapReservedSize(UINT aSetHeapReservedSize)
       
  3573 {
       
  3574 	iHeapReservedSize = aSetHeapReservedSize;
       
  3575 }
       
  3576 
       
  3577 /**
       
  3578 This function sets the stack committed size passed to '--stack' option.
       
  3579 
       
  3580 @internalComponent
       
  3581 @released
       
  3582 
       
  3583 @param aSetStackCommittedSize
       
  3584 stack committed size passed to '--stack' option.
       
  3585 */
       
  3586 void  ParameterManager::SetStackCommittedSize(UINT aSetStackCommittedSize)
       
  3587 {
       
  3588 	iStackCommittedSize = aSetStackCommittedSize;
       
  3589 }
       
  3590 
       
  3591 /**
       
  3592 This function sets iUnfrozen if --unfrozen is passed in.
       
  3593 
       
  3594 @internalComponent
       
  3595 @released
       
  3596 
       
  3597 @param aVal
       
  3598 True if --unfrozen is passed in.
       
  3599 */
       
  3600 void ParameterManager::SetUnfrozen(bool aVal)
       
  3601 {
       
  3602 	iUnfrozen = aVal;
       
  3603 }
       
  3604 
       
  3605 /**
       
  3606 This function sets iIgnoreNonCallable if --ignorenoncallable is passed in.
       
  3607 
       
  3608 @internalComponent
       
  3609 @released
       
  3610 
       
  3611 @param aVal
       
  3612 True if --ignorenoncallable is passed in.
       
  3613 */
       
  3614 void ParameterManager::SetIgnoreNonCallable(bool aVal)
       
  3615 {
       
  3616 	iIgnoreNonCallable = aVal;
       
  3617 }
       
  3618 
       
  3619 /**
       
  3620 This function sets iDllDataP if --dlldata is passed in.
       
  3621 
       
  3622 @internalComponent
       
  3623 @released
       
  3624 
       
  3625 @param anewVal
       
  3626 True if --dlldata is passed in.
       
  3627 */
       
  3628 void ParameterManager::SetDllDataP(bool anewVal)
       
  3629 {
       
  3630 	iDllDataP = anewVal;
       
  3631 }
       
  3632 
       
  3633 /**
       
  3634 This function sets the FPU type based on the parsed '--fpu' option.
       
  3635 
       
  3636 @internalComponent
       
  3637 @released
       
  3638 
       
  3639 @param aSetVendorID
       
  3640 FPU type passed to the '--fpu' option.
       
  3641 */
       
  3642 void  ParameterManager::SetFPU(UINT aFPU)
       
  3643 {
       
  3644 	iFPUOption = true;
       
  3645 	iFPU = aFPU;
       
  3646 }
       
  3647 
       
  3648 
       
  3649 void ParameterManager::SetCodePaged(bool anewVal)
       
  3650 {
       
  3651 	iCodePaged = anewVal;
       
  3652 }
       
  3653 
       
  3654 void ParameterManager::SetCodeUnpaged(bool anewVal)
       
  3655 {
       
  3656 	iCodeUnpaged = anewVal;
       
  3657 }
       
  3658 
       
  3659 void ParameterManager::SetCodeDefaultPaged(bool anewVal)
       
  3660 {
       
  3661 	iCodeDefaultPaged = anewVal;
       
  3662 }
       
  3663 
       
  3664 void ParameterManager::SetDataPaged(bool anewVal)
       
  3665 {
       
  3666 	iDataPaged = anewVal;
       
  3667 }
       
  3668 
       
  3669 void ParameterManager::SetDataUnpaged(bool anewVal)
       
  3670 {
       
  3671 	iDataUnpaged = anewVal;
       
  3672 }
       
  3673 
       
  3674 void ParameterManager::SetDataDefaultPaged(bool anewVal)
       
  3675 {
       
  3676 	iDataDefaultPaged = anewVal;
       
  3677 }
       
  3678 
       
  3679 void ParameterManager::SetSymNamedLookup(bool aVal)
       
  3680 {
       
  3681 	iSymNamedLookup = aVal;
       
  3682 }
       
  3683 
       
  3684 /**
       
  3685 This function sets iExcludeUnwantedExports if --excludeunwantedexports is passed in.
       
  3686 
       
  3687 @internalComponent
       
  3688 @released
       
  3689 
       
  3690 @param aVal
       
  3691 True if --excludeunwantedexports is passed in.
       
  3692 */
       
  3693 void ParameterManager::SetExcludeUnwantedExports(bool aVal)
       
  3694 {
       
  3695 	iExcludeUnwantedExports = aVal;
       
  3696 }
       
  3697 
       
  3698 /**
       
  3699 This function sets iIsCustomDllTarget if --customdlltarget is passed in.
       
  3700 
       
  3701 @internalComponent
       
  3702 @released
       
  3703 
       
  3704 @param aVal
       
  3705 True if --customdlltarget is passed in.
       
  3706 */
       
  3707 void ParameterManager::SetCustomDllTarget(bool aVal)
       
  3708 {
       
  3709 	iCustomDllTarget = aVal;
       
  3710 }
       
  3711 
       
  3712 /**
       
  3713 This function sets iDebuggable if --debuggable is passed in.
       
  3714 
       
  3715 @internalComponent
       
  3716 @released
       
  3717 
       
  3718 @param aVal
       
  3719 True if --debuggable is passed in.
       
  3720 */
       
  3721 void ParameterManager::SetDebuggable(bool aVal)
       
  3722 {
       
  3723 	iDebuggable = aVal;
       
  3724 }
       
  3725 
       
  3726 
       
  3727 void ParameterManager::SetSmpSafe(bool aVal)
       
  3728 {
       
  3729 	iSmpSafe = aVal;
       
  3730 }