toolsandutils/e32tools/elf2e32/source/messageimplementation.h
author Mike Kinghan <mikek@symbian.org>
Tue, 16 Nov 2010 14:32:12 +0000
branchGCC_SURGE
changeset 79 f7dee603db09
parent 0 83f4b4db085c
child 10 d4b442d23379
permissions -rw-r--r--
[GCCE] We need a way for the HAL config extension to parameterise the HAL config file (.hcf) that will be used, depending upon the toolchain we are building with. E.g. if we are building BeagleBoard with RVCT we can configure hardware floating point because we have ARM's vfp math libraries; if we are building it with GCC, we lack this library support.

// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
// Message Implementation Class for elf2e32 tool
// @internalComponent
// @released
// 
//


#ifndef _MESSAGE_IMPLEMENTATION_
#define _MESSAGE_IMPLEMENTATION_

#ifdef _MSC_VER 
	#pragma warning(disable: 4514) // unreferenced inline function has been removed
	#pragma warning(disable: 4702) // unreachable code
	#pragma warning(disable: 4710) // function not inlined
	#pragma warning(disable: 4786) // identifier was truncated to '255' characters in the debug information
#endif

#include<map>
#include<string>

typedef std::map<int,char*> Map;
typedef std::string String;

enum { MAXMSSGNOLENGTH=5, BASEMSSGNO=1000 };

enum { ERROR = 0,
	   WARNING,
	   INFORMATION
};

enum {	FILEOPENERROR=1,
		FILEREADERROR,
		FILEWRITEERROR,
		ELFMAGICERROR,
		ELFCLASSERROR,
		ELFABIVERSIONERROR,
		ELFLEERROR,
		ELFARMERROR,
		ELFEXECUTABLEERROR,
		ELFSHSTRINDEXERROR,
		NAMELIBRARYNOTCORRECT,
		ORDINALSEQUENCEERROR,
		ARGUMENTNAMEERROR,
		OPTIONNAMEERROR,
		NOARGUMENTERROR,
		OPTIONPREFIXERROR,
		NOREQUIREDOPTIONERROR,
		NOFILENAMEERROR,
		INVALIDARGUMENTERROR,
		HUFFMANBUFFEROVERFLOWERROR,
		HUFFMANTOOMANYCODESERROR,
		HUFFMANINVALIDCODINGERROR,
		CAPABILITYALLINVERSIONERROR,
		CAPABILITYNONEINVERSIONERROR,
		UNRECOGNISEDCAPABILITYERROR,
		NOSTATICSYMBOLSERROR,
		DLLHASINITIALISEDDATAERROR,
		DLLHASUNINITIALISEDDATAERROR,
		ENTRYPOINTCORRUPTERROR,
		ENTRYPOINTNOTSUPPORTEDERROR,
		EXCEPTIONDESCRIPTOROUTSIDEROERROR,
		NOEXCEPTIONDESCRIPTORERROR,
		NEEDSECTIONVIEWERROR,
		DSONOTFOUNDERROR,
		UNDEFINEDSYMBOLERROR,
		SYMBOLMISSINGFROMELFERROR,
		MEMORYALLOCATIONERROR,
		E32IMAGEERROR,
		INVALIDINVOCATIONERROR,
		TARGETTYPENOTSPECIFIEDERROR,
		UNSUPPORTEDTARGETTYPEERROR,
		INDEXNOMESSAGEERROR,
		INDEXNOTREQUIREDERROR,
		INDEXNOTFOUNDERROR,
		NOMESSAGEFILEERROR,
		ENTRYPOINTNOTSETERROR,
		UNDEFINEDENTRYPOINTERROR,
		ORDINALNOTANUMBER,
		UNRECOGNIZEDTOKEN,
		NONAMEMISSING,
		EXPORTSEXPECTED,
		ATRATEMISSING,
		SYSDEFSMISMATCHERROR,
		SYSDEFERROR,
		INVALIDE32IMAGEERROR,
		HUFFMANBUFFERUNDERFLOWERROR,
		HUFFMANINCONSISTENTSIZEERROR,
		MULTIPLESYSDEFERROR,
		SYSDEFNOSYMBOLERROR,
		VALUEIGNOREDWARNING,
		ELFFILEERROR,
		SYMBOLCOUNTMISMATCHERROR,
		POSTLINKERERROR,
		BYTEPAIRINCONSISTENTSIZEERROR,
		ILLEGALEXPORTFROMDATASEGMENT,
		VALIDATIONERROR
};


/**
Abstract base Class for Message Implementation.
@internalComponent
@released
*/
class Message
{
    public:
		virtual ~Message(){};
		// get error string from message file
		virtual char * GetMessageString(int errorIndex)=0;
		// display message to output device
		virtual void Output(const char *aName) =0;
		// start logging to a file
		virtual void StartLogging(char *fileName)=0;
	//	virtual void ReportWarning(int warnIndex,...)=0;
		virtual void ReportMessage(int aMsgType, int aMsgIndex,...)=0;
		virtual void CreateMessageFile(char *fileName)=0;
		virtual void InitializeMessages(char *fileName)=0;
};

/**
Class for Message Implementation.
@internalComponent
@released
*/
class MessageImplementation : public Message
{
    public:
		MessageImplementation();
		~MessageImplementation();

		//override base class methods
		char* GetMessageString(int errorIndex);
		void Output(const char *aName);
		void StartLogging(char *fileName);
	//	void ReportWarning(int warnIndex,...);
		void ReportMessage(int aMsgType, int aMsgIndex,...);
		void CreateMessageFile(char *fileName);
		void InitializeMessages(char *fileName);
    private:

		bool iLogging;
		char* iLogFileName;
		FILE *iLogPtr;
		Map iMessage;
};

/**
Structure for Messages.
@internalComponent
@released
*/
struct EnglishMessage
{
	int index;
	char message[1024];
};

#endif