e32tools/elf2e32/source/errorhandler.cpp
changeset 0 044383f39525
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 // Error Handler Operations for elf2e32 tool
       
    15 // @internalComponent
       
    16 // @released
       
    17 // 
       
    18 //
       
    19 
       
    20 #ifdef _MSC_VER
       
    21 	#pragma warning(disable: 4514) // unreferenced inline function has been removed
       
    22 	#pragma warning(disable: 4702) // unreachable code
       
    23 	#pragma warning(disable: 4710) // function not inlined
       
    24 #endif
       
    25 
       
    26 #include "errorhandler.h"
       
    27 #include "messagehandler.h"
       
    28 #include <iostream>
       
    29 #include <stdio.h>
       
    30 using std::cerr;
       
    31 using std::endl;
       
    32 
       
    33 char *errMssgPrefix="elf2e32 : Error: E";
       
    34 char *colonSpace=": ";
       
    35 
       
    36 /**
       
    37 ErrorHandler constructor for doing common thing required for derived class functions.
       
    38 @param aMessageIndex - Message Index
       
    39 @internalComponent
       
    40 @released
       
    41 */
       
    42 ErrorHandler::ErrorHandler(int aMessageIndex)
       
    43 {
       
    44 	char mssgNo[MAXMSSGNOLENGTH];
       
    45 	int mssgIndex;
       
    46 	
       
    47 	iMessageIndex=aMessageIndex;
       
    48 	iMessage=errMssgPrefix;
       
    49 	mssgIndex=BASEMSSGNO+iMessageIndex;
       
    50 	sprintf(mssgNo,"%d",mssgIndex);
       
    51 	iMessage+=mssgNo;
       
    52 	iMessage+=colonSpace;
       
    53 };
       
    54 
       
    55 /**
       
    56 ErrorHandler destructor.
       
    57 @internalComponent
       
    58 @released
       
    59 */
       
    60 ErrorHandler::~ErrorHandler()
       
    61 {
       
    62 	MessageHandler::CleanUp();
       
    63 }
       
    64 
       
    65 /**
       
    66 FileError constructor for initializing message index and argument name.
       
    67 @param aMessageIndex - Message Index
       
    68 @param aName - File name
       
    69 @internalComponent
       
    70 @released
       
    71 */
       
    72 FileError:: FileError(int aMessageIndex, char * aName) : ErrorHandler(aMessageIndex), iName(aName)
       
    73 {
       
    74 }
       
    75 
       
    76 /**
       
    77 FileError destructor.
       
    78 @internalComponent
       
    79 @released
       
    80 */
       
    81 FileError:: ~FileError()
       
    82 {
       
    83 }
       
    84 
       
    85 /**
       
    86 Function to report File Errors.
       
    87 @internalComponent
       
    88 @released
       
    89 */
       
    90 void FileError::Report()
       
    91 {
       
    92 	char *tempMssg;
       
    93 	char *errMessage;
       
    94 
       
    95 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
    96 	if(errMessage)
       
    97 	{
       
    98 		tempMssg = new char[strlen(errMessage)+strlen(iName.c_str())];
       
    99 		sprintf(tempMssg,errMessage,iName.c_str());
       
   100 		iMessage+=tempMssg;
       
   101 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   102 		delete[] tempMssg;
       
   103 	}
       
   104 }
       
   105 
       
   106 /**
       
   107 ELFFormatError constructor for initializing message index and argument name.
       
   108 @param aMessageIndex - Message Index
       
   109 @param aName - ELF File name
       
   110 @internalComponent
       
   111 @released
       
   112 */
       
   113 ELFFormatError::ELFFormatError(int aMessageIndex, char * aName) : ErrorHandler(aMessageIndex), iName(aName)
       
   114 {
       
   115 
       
   116 }
       
   117 
       
   118 /**
       
   119 ELFFormatError destructor.
       
   120 @internalComponent
       
   121 @released
       
   122 */
       
   123 ELFFormatError::~ELFFormatError()
       
   124 {
       
   125 
       
   126 }
       
   127 
       
   128 /**
       
   129 Function to report ELF Format Errors.
       
   130 @internalComponent
       
   131 @released
       
   132 */
       
   133 void ELFFormatError::Report()
       
   134 {
       
   135 	char *tempMssg;
       
   136 	char *errMessage;
       
   137 	
       
   138 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
   139 	if(errMessage)
       
   140 	{
       
   141 		tempMssg = new char[strlen(errMessage)+strlen(iName.c_str())];
       
   142 		sprintf(tempMssg,errMessage,iName.c_str());
       
   143 		iMessage+=tempMssg;
       
   144 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   145 		delete tempMssg;
       
   146 	}
       
   147 }
       
   148 
       
   149 /**
       
   150 DEFFileError constructor for initializing message index, argument name and line number and token.
       
   151 @param aMessageIndex - Message Index
       
   152 @param aName - DEF File name
       
   153 @param aLineNo - DEF File line number
       
   154 @param aToken - Token in export entry
       
   155 @internalComponent
       
   156 @released
       
   157 */
       
   158 DEFFileError::DEFFileError(int aMessageIndex, char * aName, int aLineNo,char * aToken) : ErrorHandler(aMessageIndex), iName(aName), iLineNo(aLineNo)
       
   159 {
       
   160 	iToken=aToken;
       
   161 	if(iToken[iToken.size()-1]=='\r')
       
   162 		iToken[iToken.size()-1]='\0';
       
   163 }
       
   164 
       
   165 /**
       
   166 DEFFileError destructor.
       
   167 @internalComponent
       
   168 @released
       
   169 */
       
   170 DEFFileError::~DEFFileError()
       
   171 {
       
   172 }
       
   173 
       
   174 /**
       
   175 Function to report DEF File Errors.
       
   176 @internalComponent
       
   177 @released
       
   178 */
       
   179 void DEFFileError::Report()
       
   180 {
       
   181 	char *tempMssg;
       
   182 	char *errMessage;
       
   183 	
       
   184 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
   185 	if(errMessage)
       
   186 	{
       
   187 		tempMssg = new char[strlen(errMessage)+5+strlen(iName.c_str())+strlen(iToken.c_str())];
       
   188 		sprintf(tempMssg,errMessage,iName.c_str(),iLineNo,iToken.c_str());
       
   189 		iMessage+=tempMssg;
       
   190 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   191 		delete tempMssg;
       
   192 	}
       
   193 }
       
   194 
       
   195 /**
       
   196 ParameterParserError constructor for initializing message index and argument name.
       
   197 @param aMessageIndex - Message Index
       
   198 @Param aName - Argument name
       
   199 @internalComponent
       
   200 @released
       
   201 */
       
   202 ParameterParserError::ParameterParserError(int aMessageIndex, char * aName) : ErrorHandler(aMessageIndex), iName(aName)
       
   203 {
       
   204 }
       
   205 
       
   206 /**
       
   207 ParameterParserError destructor.
       
   208 @internalComponent
       
   209 @released
       
   210 */
       
   211 ParameterParserError::~ParameterParserError()
       
   212 {
       
   213 }
       
   214 
       
   215 /**
       
   216 Function to report Parameter Parser Error.
       
   217 @internalComponent
       
   218 @released
       
   219 */
       
   220 void ParameterParserError::Report()
       
   221 {
       
   222 	char *tempMssg;
       
   223 	char *errMessage;
       
   224 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
   225 
       
   226 	if(errMessage)
       
   227 	{
       
   228 		tempMssg = new char[strlen(errMessage)+strlen(iName.c_str())];
       
   229 		sprintf(tempMssg,errMessage,iName.c_str());
       
   230 		iMessage+=tempMssg;
       
   231 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   232 		delete tempMssg;
       
   233 	}
       
   234 }
       
   235 
       
   236 /**
       
   237 InvalidArgumentError constructor for initializing message index, argument value and option.
       
   238 @param aMessageIndex - Message Index
       
   239 @param aValue - Argument value
       
   240 @param aOption - Argument option
       
   241 @internalComponent
       
   242 @released
       
   243 */
       
   244 InvalidArgumentError::InvalidArgumentError(int aMessageIndex, const char * aValue, char * aOption) : ErrorHandler(aMessageIndex), iValue(aValue), iOption(aOption)
       
   245 {
       
   246 }
       
   247 
       
   248 /**
       
   249 InvalidArgumentError destructor.
       
   250 @internalComponent
       
   251 @released
       
   252 */
       
   253 InvalidArgumentError::~InvalidArgumentError()
       
   254 {
       
   255 }
       
   256 
       
   257 /**
       
   258 Function to report Invalid Argument Error.
       
   259 @internalComponent
       
   260 @released
       
   261 */
       
   262 void InvalidArgumentError::Report()
       
   263 {
       
   264 	char *tempMssg;
       
   265 	char *errMessage;
       
   266 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
   267 
       
   268 	if(errMessage)
       
   269 	{
       
   270 		tempMssg = new char[strlen(errMessage)+strlen(iValue.c_str())+strlen(iOption.c_str())];
       
   271 		sprintf(tempMssg,errMessage,iValue.c_str(),iOption.c_str());
       
   272 		iMessage+=tempMssg;
       
   273 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   274 		delete tempMssg;
       
   275 	}
       
   276 }
       
   277 
       
   278 /**
       
   279 E32ImageCompressionError constructor for initializing message index.
       
   280 @param aMessageIndex - Message Index
       
   281 @internalComponent
       
   282 @released
       
   283 */
       
   284 E32ImageCompressionError::E32ImageCompressionError(int aMessageIndex) : ErrorHandler(aMessageIndex)
       
   285 {
       
   286 }
       
   287 
       
   288 /**
       
   289 E32ImageCompressionError destructor.
       
   290 @internalComponent
       
   291 @released
       
   292 */
       
   293 E32ImageCompressionError::~E32ImageCompressionError()
       
   294 {
       
   295 }
       
   296 
       
   297 /**
       
   298 Function to report E32 Image Compression Error.
       
   299 @internalComponent
       
   300 @released
       
   301 */
       
   302 void E32ImageCompressionError::Report()
       
   303 {
       
   304 	char *errMessage;
       
   305 
       
   306 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
   307 	if(errMessage)
       
   308 	{
       
   309 		iMessage+=errMessage;
       
   310 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   311 	}
       
   312 }
       
   313 
       
   314 /**
       
   315 CapabilityError constructor for initializing message index.
       
   316 @param aMessageIndex - Message Index
       
   317 @internalComponent
       
   318 @released
       
   319 */
       
   320 CapabilityError::CapabilityError(int aMessageIndex) : ErrorHandler(aMessageIndex)
       
   321 {
       
   322 }
       
   323 
       
   324 /**
       
   325 CapabilityError destructor.
       
   326 @internalComponent
       
   327 @released
       
   328 */
       
   329 CapabilityError::~CapabilityError()
       
   330 {
       
   331 }
       
   332 
       
   333 /**
       
   334 Function to report Capability Error.
       
   335 @internalComponent
       
   336 @released
       
   337 */
       
   338 void CapabilityError::Report()
       
   339 {
       
   340 	char *errMessage;
       
   341 
       
   342 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
   343 	if(errMessage)
       
   344 	{
       
   345 		iMessage+=errMessage;
       
   346 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   347 	}
       
   348 }
       
   349 
       
   350 /**
       
   351 UnrecognisedCapabilityError constructor for initializing message index and argument name.
       
   352 @param aMessageIndex - Message Index
       
   353 @param aName - Capability
       
   354 @internalComponent
       
   355 @released
       
   356 */
       
   357 UnrecognisedCapabilityError::UnrecognisedCapabilityError(int aMessageIndex, char * aName) : CapabilityError(aMessageIndex), iName(aName)
       
   358 {
       
   359 }
       
   360 
       
   361 /**
       
   362 UnrecognisedCapabilityError destructor.
       
   363 @internalComponent
       
   364 @released
       
   365 */
       
   366 UnrecognisedCapabilityError::~UnrecognisedCapabilityError()
       
   367 {
       
   368 }
       
   369 
       
   370 /**
       
   371 Function to report Unrecognised Capability Error.
       
   372 @internalComponent
       
   373 @released
       
   374 */
       
   375 void UnrecognisedCapabilityError::Report()
       
   376 {
       
   377 	char *tempMssg;
       
   378 	char *errMessage;
       
   379 
       
   380 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
   381 	if(errMessage)
       
   382 	{
       
   383 		tempMssg = new char[strlen(errMessage)+strlen(iName.c_str())];
       
   384 		sprintf(tempMssg,errMessage,iName.c_str());
       
   385 		iMessage+=tempMssg;
       
   386 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   387 		delete tempMssg;
       
   388 	}
       
   389 }
       
   390 
       
   391 /**
       
   392 ELFFileError constructor for initializing message index and argument name.
       
   393 @param aMessageIndex - Message Index
       
   394 @param aName - ELF File name
       
   395 @internalComponent
       
   396 @released
       
   397 */
       
   398 ELFFileError::ELFFileError(int aMessageIndex, const char * aName) : ErrorHandler(aMessageIndex), iName(aName)
       
   399 {
       
   400 }
       
   401 
       
   402 /**
       
   403 ELFFileError destructor.
       
   404 @internalComponent
       
   405 @released
       
   406 */
       
   407 ELFFileError::~ELFFileError()
       
   408 {
       
   409 }
       
   410 
       
   411 /**
       
   412 Function to report ELF File Error.
       
   413 @internalComponent
       
   414 @released
       
   415 */
       
   416 void ELFFileError::Report()
       
   417 {
       
   418 	char *tempMssg;
       
   419 	char *errMessage;
       
   420 
       
   421 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
   422 	if(errMessage)
       
   423 	{
       
   424 		tempMssg = new char[strlen(errMessage)+strlen(iName.c_str())];
       
   425 		sprintf(tempMssg,errMessage,iName.c_str());
       
   426 		iMessage+=tempMssg;
       
   427 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   428 		delete tempMssg;
       
   429 	}
       
   430 }
       
   431 
       
   432 /**
       
   433 UndefinedSymbolError constructor for initializing message index, argument name and symbol name.
       
   434 @param aMessageIndex - Message Index
       
   435 @param aName - File Name
       
   436 @param aSymbolName - Symbol Name
       
   437 @internalComponent
       
   438 @released
       
   439 */
       
   440 UndefinedSymbolError::UndefinedSymbolError(int aMessageIndex, char * aName, char *aSymbolName) : ELFFileError(aMessageIndex,aName), iSymbolName(aSymbolName)
       
   441 {
       
   442 }
       
   443 
       
   444 /**
       
   445 UndefinedSymbolError destructor.
       
   446 @internalComponent
       
   447 @released
       
   448 */
       
   449 UndefinedSymbolError::~UndefinedSymbolError()
       
   450 {
       
   451 }
       
   452 
       
   453 /**
       
   454 Function to report Undefined Symbol Error.
       
   455 @internalComponent
       
   456 @released
       
   457 */
       
   458 void UndefinedSymbolError::Report()
       
   459 {
       
   460 	char *tempMssg;
       
   461 	char *errMessage;
       
   462 	
       
   463 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
   464 	if(errMessage)
       
   465 	{
       
   466 		tempMssg = new char[strlen(errMessage)+strlen(iSymbolName.c_str())+strlen(iName.c_str())];
       
   467 		sprintf(tempMssg,errMessage,iSymbolName.c_str(),iName.c_str());
       
   468 		iMessage+=tempMssg;
       
   469 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   470 		delete tempMssg;
       
   471 	}
       
   472 }
       
   473 
       
   474 /**
       
   475 SymbolMissingFromElfError constructor for initializing message index, symbol name list and argument name.
       
   476 @param aMessageIndex - Message Index
       
   477 @param aSymbolList - List of symbols
       
   478 @param aName - File Name
       
   479 @internalComponent
       
   480 @released
       
   481 */
       
   482 SymbolMissingFromElfError::SymbolMissingFromElfError(int aMessageIndex, list<String> &aSymbolList, const char * aName) : ELFFileError(aMessageIndex,aName)
       
   483 {
       
   484 
       
   485 	std::list<String>::iterator aItr = aSymbolList.begin();
       
   486 	std::list<String>::iterator last = aSymbolList.end();
       
   487 
       
   488 	while(aItr != last)
       
   489 	{
       
   490 		iSymbolNames+=*aItr;
       
   491 		aItr++;
       
   492 		if(aItr != last)
       
   493 		{
       
   494 			iSymbolNames+=",";
       
   495 		}
       
   496 	}
       
   497 
       
   498 }
       
   499 
       
   500 /**
       
   501 SymbolMissingFromElfError destructor.
       
   502 @internalComponent
       
   503 @released
       
   504 */
       
   505 SymbolMissingFromElfError::~SymbolMissingFromElfError()
       
   506 {
       
   507 }
       
   508 
       
   509 /**
       
   510 Function to report Symbol Missing From Elf Error.
       
   511 @internalComponent
       
   512 @released
       
   513 */
       
   514 void SymbolMissingFromElfError::Report()
       
   515 {
       
   516 	char *tempMssg;
       
   517 	char *errMessage;
       
   518 
       
   519 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
   520 	if(errMessage)
       
   521 	{
       
   522 		tempMssg = new char[strlen(errMessage)+strlen(iSymbolNames.c_str())+strlen(iName.c_str())];
       
   523 		sprintf(tempMssg,errMessage,iSymbolNames.c_str(),iName.c_str());
       
   524 		iMessage+=tempMssg;
       
   525 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   526 		delete tempMssg;
       
   527 	}
       
   528 }
       
   529 
       
   530 /**
       
   531 MemoryAllocationError constructor for initializing message index and argument name.
       
   532 @param aMessageIndex - Message Index
       
   533 @param aName - File Name
       
   534 @internalComponent
       
   535 @released
       
   536 */
       
   537 MemoryAllocationError::MemoryAllocationError(int aMessageIndex, char * aName) : ErrorHandler(aMessageIndex), iName(aName)
       
   538 {
       
   539 }
       
   540 
       
   541 /**
       
   542 MemoryAllocationError destructor.
       
   543 @internalComponent
       
   544 @released
       
   545 */
       
   546 MemoryAllocationError::~MemoryAllocationError()
       
   547 {
       
   548 }
       
   549 
       
   550 /**
       
   551 Function to report Memory Allocation Error.
       
   552 @internalComponent
       
   553 @released
       
   554 */
       
   555 void MemoryAllocationError::Report()
       
   556 {
       
   557 	char *tempMssg;
       
   558 	char *errMessage;
       
   559 
       
   560 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
   561 	if(errMessage)
       
   562 	{
       
   563 		tempMssg = new char[strlen(errMessage)+strlen(iName.c_str())];
       
   564 		sprintf(tempMssg,errMessage,iName.c_str());
       
   565 		iMessage+=tempMssg;
       
   566 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   567 		delete tempMssg;
       
   568 	}
       
   569 }
       
   570 
       
   571 /**
       
   572 E32ImageError constructor for initializing message index.
       
   573 @param aMessageIndex - Message Index
       
   574 @internalComponent
       
   575 @released
       
   576 */
       
   577 E32ImageError::E32ImageError(int aMessageIndex) : ErrorHandler(aMessageIndex)
       
   578 {
       
   579 }
       
   580 
       
   581 /**
       
   582 E32ImageError destructor.
       
   583 @internalComponent
       
   584 @released
       
   585 */
       
   586 E32ImageError::~E32ImageError()
       
   587 {
       
   588 }
       
   589 
       
   590 /**
       
   591 Function to report E32 Image Error.
       
   592 @internalComponent
       
   593 @released
       
   594 */
       
   595 void E32ImageError::Report()
       
   596 {
       
   597 	char *errMessage;
       
   598 
       
   599 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
   600 	if(errMessage)
       
   601 	{
       
   602 		iMessage+=errMessage;
       
   603 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   604 	}
       
   605 }
       
   606 
       
   607 /**
       
   608 InvalidInvocationError constructor for initializing message index.
       
   609 @param aMessageIndex - Message Index
       
   610 @internalComponent
       
   611 @released
       
   612 */
       
   613 InvalidInvocationError::InvalidInvocationError(int aMessageIndex) : ErrorHandler(aMessageIndex)
       
   614 {
       
   615 }
       
   616 
       
   617 /**
       
   618 InvalidInvocationError destructor.
       
   619 @internalComponent
       
   620 @released
       
   621 */
       
   622 InvalidInvocationError::~InvalidInvocationError()
       
   623 {
       
   624 }
       
   625 
       
   626 /**
       
   627 Function to report Invalid Invocation Error.
       
   628 @internalComponent
       
   629 @released
       
   630 */
       
   631 void InvalidInvocationError::Report()
       
   632 {
       
   633 	char *errMessage;
       
   634 
       
   635 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
   636 	if(errMessage)
       
   637 	{
       
   638 		iMessage+=errMessage;
       
   639 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   640 	}
       
   641 }
       
   642 
       
   643 /**
       
   644 TargetTypeError constructor for initializing message index.
       
   645 @param aMessageIndex - Message Index
       
   646 @internalComponent
       
   647 @released
       
   648 */
       
   649 TargetTypeError::TargetTypeError(int aMessageIndex) : ErrorHandler(aMessageIndex)
       
   650 {
       
   651 }
       
   652 
       
   653 /**
       
   654 TargetTypeError destructor.
       
   655 @internalComponent
       
   656 @released
       
   657 */
       
   658 TargetTypeError::~TargetTypeError()
       
   659 {
       
   660 }
       
   661 
       
   662 /**
       
   663 Function to report Target Type Error.
       
   664 @internalComponent
       
   665 @released
       
   666 */
       
   667 void TargetTypeError::Report()
       
   668 {
       
   669 	char *errMessage;
       
   670 
       
   671 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
   672 	if(errMessage)
       
   673 	{
       
   674 		iMessage+=errMessage;
       
   675 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   676 	}
       
   677 }
       
   678 
       
   679 /**
       
   680 UnsupportedTargetTypeError constructor for initializing message index and argument name.
       
   681 @param aMessageIndex - Message Index
       
   682 @param aName - Target type name
       
   683 @internalComponent
       
   684 @released
       
   685 */
       
   686 UnsupportedTargetTypeError::UnsupportedTargetTypeError(int aMessageIndex, char * aName) : TargetTypeError(aMessageIndex), iName(aName)
       
   687 {
       
   688 }
       
   689 
       
   690 /**
       
   691 UnsupportedTargetTypeError destructor.
       
   692 @internalComponent
       
   693 @released
       
   694 */
       
   695 UnsupportedTargetTypeError::~UnsupportedTargetTypeError()
       
   696 {
       
   697 }
       
   698 
       
   699 /**
       
   700 Function to report Unsupported Target Type Error.
       
   701 @internalComponent
       
   702 @released
       
   703 */
       
   704 void UnsupportedTargetTypeError::Report()
       
   705 {
       
   706 	char *tempMssg;
       
   707 	char *errMessage;
       
   708 
       
   709 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
   710 	if(errMessage)
       
   711 	{
       
   712 		tempMssg = new char[strlen(errMessage)+strlen(iName.c_str())];
       
   713 		sprintf(tempMssg,errMessage,iName.c_str());
       
   714 		iMessage+=tempMssg;
       
   715 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   716 		delete tempMssg;
       
   717 	}
       
   718 }
       
   719 
       
   720 /**
       
   721 MessageError constructor for initializing message index and index value.
       
   722 @param aMessageIndex - Message Index
       
   723 @param aIndexValue - Value of Index
       
   724 @internalComponent
       
   725 @released
       
   726 */
       
   727 MessageError::MessageError(int aMessageIndex, int aIndexValue) : ErrorHandler(aMessageIndex), iIndexValue(aIndexValue)
       
   728 {
       
   729 }
       
   730 
       
   731 /**
       
   732 MessageError destructor.
       
   733 @internalComponent
       
   734 @released
       
   735 */
       
   736 MessageError::~MessageError()
       
   737 {
       
   738 }
       
   739 
       
   740 /**
       
   741 Function to report Message Errors.
       
   742 @internalComponent
       
   743 @released
       
   744 */
       
   745 void MessageError::Report()
       
   746 {
       
   747 	char *tempMssg;
       
   748 	char *errMessage;
       
   749 	
       
   750 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
   751 	if(errMessage)
       
   752 	{
       
   753 		tempMssg = new char[strlen(errMessage)+5];
       
   754 		sprintf(tempMssg,errMessage,iIndexValue);
       
   755 		iMessage+=tempMssg;
       
   756 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   757 		delete tempMssg;
       
   758 	}
       
   759 }
       
   760 
       
   761 /**
       
   762 NoMessageFileError constructor for initializing message index.
       
   763 @param aMessageIndex - Message Index
       
   764 @internalComponent
       
   765 @released
       
   766 */
       
   767 NoMessageFileError::NoMessageFileError(int aMessageIndex) : ErrorHandler(aMessageIndex)
       
   768 {
       
   769 }
       
   770 
       
   771 /**
       
   772 NoMessageFileError destructor.
       
   773 @internalComponent
       
   774 @released
       
   775 */
       
   776 NoMessageFileError::~NoMessageFileError()
       
   777 {
       
   778 }
       
   779 
       
   780 /**
       
   781 Function to report No Message File Error.
       
   782 @internalComponent
       
   783 @released
       
   784 */
       
   785 void NoMessageFileError::Report()
       
   786 {
       
   787 	char *errMessage;
       
   788 
       
   789 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
   790 	if(errMessage)
       
   791 	{
       
   792 		iMessage+=errMessage;
       
   793 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   794 	}
       
   795 }
       
   796 
       
   797 /**
       
   798 SysDefMismatchError constructor for initializing message index, symbol name list and argument name.
       
   799 @param aMessageIndex - Message Index
       
   800 @param aSymbolList - list of symbols
       
   801 @param aName - sysdef
       
   802 @internalComponent
       
   803 @released
       
   804 */
       
   805 SysDefMismatchError::SysDefMismatchError(int aMessageIndex, list<String> &aSymbolList, const char * aName) : ErrorHandler(aMessageIndex), iName(aName)
       
   806 {
       
   807 
       
   808 	std::list<String>::iterator aItr = aSymbolList.begin();
       
   809 	std::list<String>::iterator last = aSymbolList.end();
       
   810 
       
   811 	while(aItr != last)
       
   812 	{
       
   813 		iSymbolNames+=*aItr;
       
   814 		aItr++;
       
   815 		if(aItr != last)
       
   816 		{
       
   817 			iSymbolNames+=",";
       
   818 		}
       
   819 	}
       
   820 
       
   821 }
       
   822 
       
   823 /**
       
   824 SysDefMismatchError destructor.
       
   825 @internalComponent
       
   826 @released
       
   827 */
       
   828 SysDefMismatchError::~SysDefMismatchError()
       
   829 {
       
   830 }
       
   831 
       
   832 /**
       
   833 Function to report SysDef Mismatch Error.
       
   834 @internalComponent
       
   835 @released
       
   836 */
       
   837 void SysDefMismatchError::Report()
       
   838 {
       
   839 	char *tempMssg;
       
   840 	char *errMessage;
       
   841 
       
   842 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
   843 	if(errMessage)
       
   844 	{
       
   845 		tempMssg = new char[strlen(errMessage)+strlen(iSymbolNames.c_str())+strlen(iName.c_str())];
       
   846 		sprintf(tempMssg,errMessage,iSymbolNames.c_str(),iName.c_str());
       
   847 		iMessage+=tempMssg;
       
   848 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   849 		delete tempMssg;
       
   850 	}
       
   851 }
       
   852 
       
   853 /**
       
   854 InvalidE32ImageError constructor for initializing message index and argument name.
       
   855 @param aMessageIndex - Message Index
       
   856 @param aName - E32Image File name
       
   857 @internalComponent
       
   858 @released
       
   859 */
       
   860 InvalidE32ImageError::InvalidE32ImageError(int aMessageIndex, char * aName) : ErrorHandler(aMessageIndex), iName(aName)
       
   861 {
       
   862 }
       
   863 
       
   864 /**
       
   865 InvalidE32ImageError destructor.
       
   866 @internalComponent
       
   867 @released
       
   868 */
       
   869 InvalidE32ImageError::~InvalidE32ImageError()
       
   870 {
       
   871 }
       
   872 
       
   873 /**
       
   874 Function to report Invalid E32 Image Error.
       
   875 @internalComponent
       
   876 @released
       
   877 */
       
   878 void InvalidE32ImageError::Report()
       
   879 {
       
   880 	char *tempMssg;
       
   881 	char *errMessage;
       
   882 
       
   883 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
   884 	if(errMessage)
       
   885 	{
       
   886 		tempMssg = new char[strlen(errMessage)+strlen(iName.c_str())];
       
   887 		sprintf(tempMssg,errMessage,iName.c_str());
       
   888 		iMessage+=tempMssg;
       
   889 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   890 		delete tempMssg;
       
   891 	}
       
   892 }
       
   893 
       
   894 /**
       
   895 ImportRelocationError constructor for initializing message index, argument name and symbol name.
       
   896 @param aMessageIndex - Message Index
       
   897 @param aName - File Name
       
   898 @param aSymbolName - Symbol Name
       
   899 @internalComponent
       
   900 @released
       
   901 */
       
   902 ImportRelocationError::ImportRelocationError(int aMessageIndex, char * aName, char *aSymbolName) : ELFFileError(aMessageIndex,aName), iSymbolName(aSymbolName)
       
   903 {
       
   904 }
       
   905 
       
   906 /**
       
   907 ImportRelocationError destructor.
       
   908 @internalComponent
       
   909 @released
       
   910 */
       
   911 ImportRelocationError::~ImportRelocationError()
       
   912 {
       
   913 }
       
   914 
       
   915 /**
       
   916 Function to report Import Relocations references to Data Segment Error
       
   917 @internalComponent
       
   918 @released
       
   919 */
       
   920 void ImportRelocationError::Report()
       
   921 {
       
   922 	char *tempMssg;
       
   923 	char *errMessage;
       
   924 	
       
   925 	errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
       
   926 	if(errMessage)
       
   927 	{
       
   928 		tempMssg = new char[strlen(errMessage)+strlen(iSymbolName.c_str())+strlen(iName.c_str())];
       
   929 		sprintf(tempMssg,errMessage,iSymbolName.c_str(),iName.c_str());
       
   930 		iMessage+=tempMssg;
       
   931 		MessageHandler::GetInstance()->Output(iMessage.c_str());
       
   932 		delete tempMssg;
       
   933 	}
       
   934 }
       
   935 
       
   936