ROM Tools 12.2.0.4
Postlinker 2.2.5
Revert package_definition.xml to changeset 360bd6b35136
--- a/e32tools/e32lib/e32image/Makefile.elftran Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,46 +0,0 @@
-# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of the License "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:
-#
-
-CXX = g++296
-CXXFLAGS = -D__SUPPORT_ELF_FILES__ -D__LINUX__ -D__GCC32__ -D__TOOLS__ -D EKA2 \
- -I $(EPOCROOT)epoc32/include -I ../inc -I ../elftools/inc
-SOURCE = elf_file.cpp elf_dlld.cpp elf_imp.cpp elf_reloc.cpp elf_tran.cpp \
- e32uid.cpp \
- h_file.cpp h_mem.cpp h_utl.cpp \
- e32image.cpp tr_main.cpp imgdump.cpp \
- decode.cpp encode.cpp deflate.cpp inflate.cpp panic.cpp compress.cpp
-BLDDIR = ../build-elftran
-OBJECT = $(addprefix $(BLDDIR)/, $(notdir $(SOURCE:.cpp=.o)))
-TARGET = $(BLDDIR)/elftran
-
-VPATH = ../host ../e32uid ../e32image ../e32image/deflate ../elftools/elftran
-
-_dummy := $(shell mkdir -p $(BLDDIR))
-
-all: $(TARGET)
-
-$(TARGET): $(OBJECT)
- $(CXX) $^ -o $@
- strip $@
-
-$(OBJECT): $(BLDDIR)/%.o: %.cpp
- $(CXX) $(CXXFLAGS) -c $< -o $@
-
-clean:
- rm -f $(OBJECT) $(TARGET)
- -rmdir $(BLDDIR)
-
-.PHONY: all clean
-
--- a/e32tools/e32lib/e32image/deflate/compress.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,126 +0,0 @@
-// Copyright (c) 1998-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:
-// e32tools\petran\Szip\compress.cpp
-//
-//
-
-#include "deflate.h"
-
-#if defined(__MSVCDOTNET__) || defined(__TOOLS2__)
-#include <fstream>
-#else //__MSVCDOTNET__
-#include <fstream.h>
-#endif //__MSVCDOTNET__
-
-#include <assert.h>
-#include "h_utl.h"
-
-class TFileOutput : public TBitOutput
- {
- enum {KBufSize=0x1000};
-public:
- TFileOutput(ostream& os);
- void FlushL();
- TUint32 iDataCount;
-private:
- void OverflowL();
-private:
- ostream& iOutStream;
- TUint8 iBuf[KBufSize];
- };
-
-TFileOutput::TFileOutput(ostream& os)
- :iOutStream(os)
- {
- Set(iBuf,KBufSize);
- }
-
-void TFileOutput::OverflowL()
-//
-// empty the buffer and reset the pointers
-//
- {
- FlushL();
- Set(iBuf,KBufSize);
- }
-
-void TFileOutput::FlushL()
-//
-// write out the contents of the buffer
-//
- {
- TInt len=Ptr()-iBuf;
- if (len)
- {
- iOutStream.write(reinterpret_cast<char *>(iBuf), len); // write extended header
- iDataCount += len;
- }
- }
-
-void DeflateCompress(char *bytes,TInt size,ostream &os)
- {
- TFileOutput* output=new TFileOutput(os);
- output->iDataCount = 0;
- DeflateL((TUint8*)bytes,size,*output);
- output->FlushL();
- delete output;
- }
-
-TUint32 DeflateCompressCheck(char *bytes,TInt size,ostream &os)
- {
- TUint32 r = 0;
- TFileOutput* output=new TFileOutput(os);
- output->iDataCount = 0;
- DeflateL((TUint8*)bytes,size,*output);
- output->FlushL();
-
- r = output->iDataCount; // Preserve the compressed count
- delete output;
- return r; // Return the compressed size
- }
-
-class TFileInput : public TBitInput
- {
-public:
- TFileInput(unsigned char* source,int size);
-
-private:
- void UnderflowL();
-private:
- TUint8* iReadBuf;
- TInt iSize;
- };
-
-TFileInput::TFileInput(unsigned char* source,int size)
- :iReadBuf(source),iSize(size)
- {
- Set(source,iSize*8);
- }
-
-
-void TFileInput::UnderflowL()
- {
- Print(ESevereError,"Buffer underflow on deflate\n");
- }
-
-void InflateUnCompress(unsigned char* source, int sourcesize,unsigned char* dest, int destsize)
- {
- TFileInput* input = new TFileInput(source, sourcesize);
- CInflater* inflater=CInflater::NewLC(*input);
- inflater->ReadL(dest,destsize);
- delete input;
- //delete inflater;
- }
-
-
--- a/e32tools/e32lib/e32image/deflate/decode.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,412 +0,0 @@
-// Copyright (c) 1998-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:
-// e32tools\petran\Szip\decode.cpp
-//
-//
-
-#include "huffman.h"
-#include "panic.h"
-#include <cpudefs.h>
-#include "h_utl.h"
-#include "farray.h"
-
-
-const TInt KHuffTerminate=0x0001;
-const TUint32 KBranch1=sizeof(TUint32)<<16;
-
-TUint32* HuffmanSubTree(TUint32* aPtr,const TUint32* aValue,TUint32** aLevel)
-//
-// write the subtree below aPtr and return the head
-//
- {
- TUint32* l=*aLevel++;
- if (l>aValue)
- {
- TUint32* sub0=HuffmanSubTree(aPtr,aValue,aLevel); // 0-tree first
- aPtr=HuffmanSubTree(sub0,aValue-(aPtr-sub0)-1,aLevel); // 1-tree
- TInt branch0=(TUint8*)sub0-(TUint8*)(aPtr-1);
- *--aPtr=KBranch1|branch0;
- }
- else if (l==aValue)
- {
- TUint term0=*aValue--; // 0-term
- aPtr=HuffmanSubTree(aPtr,aValue,aLevel); // 1-tree
- *--aPtr=KBranch1|(term0>>16);
- }
- else // l<iNext
- {
- TUint term0=*aValue--; // 0-term
- TUint term1=*aValue--;
- *--aPtr=(term1>>16<<16)|(term0>>16);
- }
- return aPtr;
- }
-
-void Huffman::Decoding(const TUint32 aHuffman[],TInt aNumCodes,TUint32 aDecodeTree[],TInt aSymbolBase)
-/** Create a canonical Huffman decoding tree
-
- This generates the huffman decoding tree used by TBitInput::HuffmanL() to read huffman
- encoded data. The input is table of code lengths, as generated by Huffman::HuffmanL()
- and must represent a valid huffman code.
-
- @param "const TUint32 aHuffman[]" The table of code lengths as generated by Huffman::HuffmanL()
- @param "TInt aNumCodes" The number of codes in the table
- @param "TUint32 aDecodeTree[]" The space for the decoding tree. This must be the same
- size as the code-length table, and can safely be the same memory
- @param "TInt aSymbolBase" the base value for the output 'symbols' from the decoding tree, by default
- this is zero.
-
- @panic "USER ???" If the provided code is not a valid Huffman coding
-
- @see IsValid()
- @see HuffmanL()
-*/
- {
- if(!IsValid(aHuffman,aNumCodes))
- Panic(EHuffmanInvalidCoding);
-//
- TFixedArray<TInt,KMaxCodeLength> counts;
- counts.Reset();
- TInt codes=0;
- TInt ii;
- for (ii=0;ii<aNumCodes;++ii)
- {
- TInt len=aHuffman[ii];
- aDecodeTree[ii]=len;
- if (--len>=0)
- {
- ++counts[len];
- ++codes;
- }
- }
-//
- TFixedArray<TUint32*,KMaxCodeLength> level;
- TUint32* lit=aDecodeTree+codes;
- for (ii=0;ii<KMaxCodeLength;++ii)
- {
- level[ii]=lit;
- lit-=counts[ii];
- }
- aSymbolBase=(aSymbolBase<<17)+(KHuffTerminate<<16);
- for (ii=0;ii<aNumCodes;++ii)
- {
- TUint len=TUint8(aDecodeTree[ii]);
- if (len)
- *--level[len-1]|=(ii<<17)+aSymbolBase;
- }
- if (codes==1) // codes==1 special case: the tree is not complete
- {
- TUint term=aDecodeTree[0]>>16;
- aDecodeTree[0]=term|(term<<16); // 0- and 1-terminate at root
- }
- else if (codes>1)
- HuffmanSubTree(aDecodeTree+codes-1,aDecodeTree+codes-1,&level[0]);
- }
-
-// The decoding tree for the externalised code
-const TUint32 HuffmanDecoding[]=
- {
- 0x0004006c,
- 0x00040064,
- 0x0004005c,
- 0x00040050,
- 0x00040044,
- 0x0004003c,
- 0x00040034,
- 0x00040021,
- 0x00040023,
- 0x00040025,
- 0x00040027,
- 0x00040029,
- 0x00040014,
- 0x0004000c,
- 0x00040035,
- 0x00390037,
- 0x00330031,
- 0x0004002b,
- 0x002f002d,
- 0x001f001d,
- 0x001b0019,
- 0x00040013,
- 0x00170015,
- 0x0004000d,
- 0x0011000f,
- 0x000b0009,
- 0x00070003,
- 0x00050001
- };
-
-void Huffman::InternalizeL(TBitInput& aInput,TUint32 aHuffman[],TInt aNumCodes)
-/** Restore a canonical huffman encoding from a bit stream
-
- The encoding must have been stored using Huffman::ExternalizeL(). The resulting
- code-length table can be used to create an encoding table using Huffman::Encoding()
- or a decoding tree using Huffman::Decoding().
-
- @param "TBitInput& aInput" The input stream with the encoding
- @param "TUint32 aHuffman[]" The internalized code-length table is placed here
- @param "TInt aNumCodes" The number of huffman codes in the table
-
- @leave "TBitInput::HuffmanL()"
-
- @see ExternalizeL()
-*/
-// See ExternalizeL for a description of the format
- {
- // initialise move-to-front list
- TFixedArray<TUint8,Huffman::KMetaCodes> list;
- for (TInt i=0;i<list.Count();++i)
- list[i]=TUint8(i);
- TInt last=0;
- // extract codes, reverse rle-0 and mtf encoding in one pass
- TUint32* p=aHuffman;
- const TUint32* end=aHuffman+aNumCodes;
- TInt rl=0;
- while (p+rl<end)
- {
- TInt c=aInput.HuffmanL(HuffmanDecoding);
- if (c<2)
- {
- // one of the zero codes used by RLE-0
- // update he run-length
- rl+=rl+c+1;
- }
- else
- {
- while (rl>0)
- {
- if (p>end)
- {
- Panic(EHuffmanCorruptFile);
- }
- *p++=last;
- --rl;
- }
- --c;
- list[0]=TUint8(last);
- last=list[c];
- HMem::Copy(&list[1],&list[0],c);
- if (p>end)
- {
- Panic(EHuffmanCorruptFile);
- }
- *p++=last;
- }
- }
- while (rl>0)
- {
- if (p>end)
- {
- Panic(EHuffmanCorruptFile);
- }
- *p++=last;
- --rl;
- }
- }
-
-// bit-stream input class
-
-inline TUint reverse(TUint aVal)
-//
-// Reverse the byte-order of a 32 bit value
-// This generates optimal ARM code (4 instructions)
-//
- {
- TUint v=(aVal<<16)|(aVal>>16);
- v^=aVal;
- v&=0xff00ffff;
- aVal=(aVal>>8)|(aVal<<24);
- return aVal^(v>>8);
- }
-
-TBitInput::TBitInput()
-/** Construct a bit stream input object
-
- Following construction the bit stream is ready for reading bits, but will
- immediately call UnderflowL() as the input buffer is empty.
-*/
- :iCount(0),iRemain(0)
- {}
-
-TBitInput::TBitInput(const TUint8* aPtr, TInt aLength, TInt aOffset)
-/** Construct a bit stream input object over a buffer
-
- Following construction the bit stream is ready for reading bits from
- the specified buffer.
-
- @param "const TUint8* aPtr" The address of the buffer containing the bit stream
- @param "TInt aLength" The length of the bitstream in bits
- @param "TInt aOffset" The bit offset from the start of the buffer to the bit stream (defaults to zero)
-*/
- {
- Set(aPtr,aLength,aOffset);
- }
-
-void TBitInput::Set(const TUint8* aPtr, TInt aLength, TInt aOffset)
-/** Set the memory buffer to use for input
-
- Bits will be read from this buffer until it is empty, at which point
- UnderflowL() will be called.
-
- @param "const TUint8* aPtr" The address of the buffer containing the bit stream
- @param "TInt aLength" The length of the bitstream in bits
- @param "TInt aOffset" The bit offset from the start of the buffer to the bit stream (defaults to zero)
-*/
- {
- TUint p=(TUint)aPtr;
- p+=aOffset>>3; // nearest byte to the specified bit offset
- aOffset&=7; // bit offset within the byte
- const TUint32* ptr=(const TUint32*)(p&~3); // word containing this byte
- aOffset+=(p&3)<<3; // bit offset within the word
- if (aLength==0)
- iCount=0;
- else
- {
- // read the first few bits of the stream
- iBits=reverse(*ptr++)<<aOffset;
- aOffset=32-aOffset;
- aLength-=aOffset;
- if (aLength<0)
- aOffset+=aLength;
- iCount=aOffset;
- }
- iRemain=aLength;
- iPtr=ptr;
- }
-
-#ifndef __HUFFMAN_MACHINE_CODED__
-
-TUint TBitInput::ReadL()
-/** Read a single bit from the input
-
- Return the next bit in the input stream. This will call UnderflowL() if
- there are no more bits available.
-
- @return The next bit in the stream
-
- @leave "UnderflowL()" It the bit stream is exhausted more UnderflowL is called
- to get more data
-*/
- {
- TInt c=iCount;
- TUint bits=iBits;
- if (--c<0)
- return ReadL(1);
- iCount=c;
- iBits=bits<<1;
- return bits>>31;
- }
-
-TUint TBitInput::ReadL(TInt aSize)
-/** Read a multi-bit value from the input
-
- Return the next few bits as an unsigned integer. The last bit read is
- the least significant bit of the returned value, and the value is
- zero extended to return a 32-bit result.
-
- A read of zero bits will always reaturn zero.
-
- This will call UnderflowL() if there are not enough bits available.
-
- @param "TInt aSize" The number of bits to read
-
- @return The bits read from the stream
-
- @leave "UnderflowL()" It the bit stream is exhausted more UnderflowL is called
- to get more data
-*/
- {
- if (!aSize)
- return 0;
- TUint val=0;
- TUint bits=iBits;
- iCount-=aSize;
- while (iCount<0)
- {
- // need more bits
-#ifdef __CPU_X86
- // X86 does not allow shift-by-32
- if (iCount+aSize!=0)
- val|=bits>>(32-(iCount+aSize))<<(-iCount); // scrub low order bits
-#else
- val|=bits>>(32-(iCount+aSize))<<(-iCount); // scrub low order bits
-#endif
- aSize=-iCount; // bits still required
- if (iRemain>0)
- {
- bits=reverse(*iPtr++);
- iCount+=32;
- iRemain-=32;
- if (iRemain<0)
- iCount+=iRemain;
- }
- else
- {
- UnderflowL();
- bits=iBits;
- iCount-=aSize;
- }
- }
-#ifdef __CPU_X86
- // X86 does not allow shift-by-32
- iBits=aSize==32?0:bits<<aSize;
-#else
- iBits=bits<<aSize;
-#endif
- return val|(bits>>(32-aSize));
- }
-
-TUint TBitInput::HuffmanL(const TUint32* aTree)
-/** Read and decode a Huffman Code
-
- Interpret the next bits in the input as a Huffman code in the specified
- decoding. The decoding tree should be the output from Huffman::Decoding().
-
- @param "const TUint32* aTree" The huffman decoding tree
-
- @return The symbol that was decoded
-
- @leave "UnderflowL()" It the bit stream is exhausted more UnderflowL is called
- to get more data
-*/
- {
- TUint huff=0;
- do
- {
- aTree=PtrAdd(aTree,huff>>16);
- huff=*aTree;
- if (ReadL()==0)
- huff<<=16;
- } while ((huff&0x10000u)==0);
- return huff>>17;
- }
-
-#endif
-
-void TBitInput::UnderflowL()
-/** Handle an empty input buffer
-
- This virtual function is called when the input buffer is empty and
- more bits are required. It should reset the input buffer with more
- data using Set().
-
- A derived class can replace this to read the data from a file
- (for example) before reseting the input buffer.
-
- @leave "KErrUnderflow" The default implementation leaves
-*/
- {
- Panic(EHuffmanBufferOverflow);
- }
-
--- a/e32tools/e32lib/e32image/deflate/deflate.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,325 +0,0 @@
-// Copyright (c) 1998-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:
-// e32tools\petran\Szip\deflate.cpp
-//
-//
-
-#include "deflate.h"
-#include "h_utl.h"
-#include "panic.h"
-
-class HDeflateHash
- {
-public:
- inline static HDeflateHash* NewLC(TInt aLinks);
-//
- inline TInt First(const TUint8* aPtr,TInt aPos);
- inline TInt Next(TInt aPos,TInt aOffset) const;
-private:
- inline HDeflateHash();
- inline static TInt Hash(const TUint8* aPtr);
-private:
- typedef TUint16 TOffset;
-private:
- TInt iHash[256];
- TOffset iOffset[1]; // or more
- };
-
-class MDeflater
- {
-public:
- void DeflateL(const TUint8* aBase,TInt aLength);
- inline virtual ~MDeflater() { };
-private:
- const TUint8* DoDeflateL(const TUint8* aBase,const TUint8* aEnd,HDeflateHash& aHash);
- static TInt Match(const TUint8* aPtr,const TUint8* aEnd,TInt aPos,HDeflateHash& aHas);
- void SegmentL(TInt aLength,TInt aDistance);
- virtual void LitLenL(TInt aCode) =0;
- virtual void OffsetL(TInt aCode) =0;
- virtual void ExtraL(TInt aLen,TUint aBits) =0;
- };
-
-class TDeflateStats : public MDeflater
- {
-public:
- inline TDeflateStats(TEncoding& aEncoding);
- inline virtual ~TDeflateStats() { }
-private:
-// from MDeflater
- void LitLenL(TInt aCode);
- void OffsetL(TInt aCode);
- void ExtraL(TInt aLen,TUint aBits);
-private:
- TEncoding& iEncoding;
- };
-
-class TDeflater : public MDeflater
- {
-public:
- inline TDeflater(TBitOutput& aOutput,const TEncoding& aEncoding);
- inline virtual ~TDeflater() { };
-private:
-// from MDeflater
- void LitLenL(TInt aCode);
- void OffsetL(TInt aCode);
- void ExtraL(TInt aLen,TUint aBits);
-private:
- TBitOutput& iOutput;
- const TEncoding& iEncoding;
- };
-
-
-// Class HDeflateHash
-
-inline HDeflateHash::HDeflateHash()
- {TInt* p=iHash+256;do *--p=-KDeflateMaxDistance-1; while (p>iHash);}
-
-inline HDeflateHash* HDeflateHash::NewLC(TInt aLinks)
- {
- return new(HMem::Alloc(0,_FOFF(HDeflateHash,iOffset[Min(aLinks,KDeflateMaxDistance)]))) HDeflateHash;
- }
-
-inline TInt HDeflateHash::Hash(const TUint8* aPtr)
- {
- TUint x=aPtr[0]|(aPtr[1]<<8)|(aPtr[2]<<16);
- return (x*KDeflateHashMultiplier)>>KDeflateHashShift;
- }
-
-inline TInt HDeflateHash::First(const TUint8* aPtr,TInt aPos)
- {
- TInt h=Hash(aPtr);
- TInt offset=Min(aPos-iHash[h],KDeflateMaxDistance<<1);
- iHash[h]=aPos;
- iOffset[aPos&(KDeflateMaxDistance-1)]=TOffset(offset);
- return offset;
- }
-
-inline TInt HDeflateHash::Next(TInt aPos,TInt aOffset) const
- {return aOffset+iOffset[(aPos-aOffset)&(KDeflateMaxDistance-1)];}
-
-
-// Class TDeflater
-//
-// generic deflation algorithm, can do either statistics and the encoder
-
-TInt MDeflater::Match(const TUint8* aPtr,const TUint8* aEnd,TInt aPos,HDeflateHash& aHash)
- {
- TInt offset=aHash.First(aPtr,aPos);
- if (offset>KDeflateMaxDistance)
- return 0;
- TInt match=0;
- aEnd=Min(aEnd,aPtr+KDeflateMaxLength);
- TUint8 c=*aPtr;
- do
- {
- const TUint8* p=aPtr-offset;
- if (p[match>>16]==c)
- { // might be a better match
- const TUint8* m=aPtr;
- for (;;)
- {
- if (*p++!=*m++)
- break;
- if (m<aEnd)
- continue;
- return ((m-aPtr)<<16)|offset;
- }
- TInt l=m-aPtr-1;
- if (l>match>>16)
- {
- match=(l<<16)|offset;
- c=m[-1];
- }
- }
- offset=aHash.Next(aPos,offset);
- } while (offset<=KDeflateMaxDistance);
- return match;
- }
-
-const TUint8* MDeflater::DoDeflateL(const TUint8* aBase,const TUint8* aEnd,HDeflateHash& aHash)
-//
-// Apply the deflation algorithm to the data [aBase,aEnd)
-// Return a pointer after the last byte that was deflated (which may not be aEnd)
-//
- {
- const TUint8* ptr=aBase;
- TInt prev=0; // the previous deflation match
- do
- {
- TInt match=Match(ptr,aEnd,ptr-aBase,aHash);
-// Extra deflation applies two optimisations which double the time taken
-// 1. If we have a match at p, then test for a better match at p+1 before using it
-// 2. When we have a match, add the hash links for all the data which will be skipped
- if (match>>16 < prev>>16)
- { // use the previous match--it was better
- TInt len=prev>>16;
- SegmentL(len,prev-(len<<16));
- // fill in missing hash entries for better compression
- const TUint8* e=ptr+len-2;
- do
- {
- ++ptr;
- if (ptr + 2 < aEnd)
- aHash.First(ptr,ptr-aBase);
- } while (ptr<e);
- prev=0;
- }
- else if (match<=(KDeflateMinLength<<16))
- LitLenL(*ptr); // no deflation match here
- else
- { // save this match and test the next position
- if (prev) // we had a match at ptr-1, but this is better
- LitLenL(ptr[-1]);
- prev=match;
- }
- ++ptr;
- } while (ptr+KDeflateMinLength-1<aEnd);
- if (prev)
- { // emit the stored match
- TInt len=prev>>16;
- SegmentL(len,prev-(len<<16));
- ptr+=len-1;
- }
- return ptr;
- }
-
-void MDeflater::DeflateL(const TUint8* aBase,TInt aLength)
-//
-// The generic deflation algorithm
-//
- {
- const TUint8* end=aBase+aLength;
- if (aLength>KDeflateMinLength)
- { // deflation kicks in if there is enough data
- HDeflateHash* hash=HDeflateHash::NewLC(aLength);
- if(hash==NULL)
- Panic(EHuffmanOutOfMemory);
-
- aBase=DoDeflateL(aBase,end,*hash);
- delete hash;
- }
- while (aBase<end) // emit remaining bytes
- LitLenL(*aBase++);
- LitLenL(TEncoding::EEos); // eos marker
- }
-
-void MDeflater::SegmentL(TInt aLength,TInt aDistance)
-//
-// Turn a (length,offset) pair into the deflation codes+extra bits before calling
-// the specific LitLen(), Offset() and Extra() functions.
-//
- {
- aLength-=KDeflateMinLength;
- TInt extralen=0;
- TUint len=aLength;
- while (len>=8)
- {
- ++extralen;
- len>>=1;
- }
- LitLenL((extralen<<2)+len+TEncoding::ELiterals);
- if (extralen)
- ExtraL(extralen,aLength);
-//
- aDistance--;
- extralen=0;
- TUint dist=aDistance;
- while (dist>=8)
- {
- ++extralen;
- dist>>=1;
- }
- OffsetL((extralen<<2)+dist);
- if (extralen)
- ExtraL(extralen,aDistance);
- }
-
-// Class TDeflateStats
-//
-// This class analyses the data stream to generate the frequency tables
-// for the deflation algorithm
-
-inline TDeflateStats::TDeflateStats(TEncoding& aEncoding)
- :iEncoding(aEncoding)
- {}
-
-void TDeflateStats::LitLenL(TInt aCode)
- {
- ++iEncoding.iLitLen[aCode];
- }
-
-void TDeflateStats::OffsetL(TInt aCode)
- {
- ++iEncoding.iDistance[aCode];
- }
-
-void TDeflateStats::ExtraL(TInt,TUint)
- {}
-
-// Class TDeflater
-//
-// Extends MDeflater to provide huffman encoding of the output
-
-inline TDeflater::TDeflater(TBitOutput& aOutput,const TEncoding& aEncoding)
-//
-// construct for encoding
-//
- :iOutput(aOutput),iEncoding(aEncoding)
- {}
-
-void TDeflater::LitLenL(TInt aCode)
- {
- iOutput.HuffmanL(iEncoding.iLitLen[aCode]);
- }
-
-void TDeflater::OffsetL(TInt aCode)
- {
- iOutput.HuffmanL(iEncoding.iDistance[aCode]);
- }
-
-void TDeflater::ExtraL(TInt aLen,TUint aBits)
- {
- iOutput.WriteL(aBits,aLen);
- }
-
-void DoDeflateL(const TUint8* aBuf,TInt aLength,TBitOutput& aOutput,TEncoding& aEncoding)
- {
-// analyse the data for symbol frequency
- TDeflateStats analyser(aEncoding);
- analyser.DeflateL(aBuf,aLength);
-
-// generate the required huffman encodings
- Huffman::HuffmanL(aEncoding.iLitLen,TEncoding::ELitLens,aEncoding.iLitLen);
- Huffman::HuffmanL(aEncoding.iDistance,TEncoding::EDistances,aEncoding.iDistance);
-
-// Store the encoding table
- Huffman::ExternalizeL(aOutput,aEncoding.iLitLen,KDeflationCodes);
-
-// generate the tables
- Huffman::Encoding(aEncoding.iLitLen,TEncoding::ELitLens,aEncoding.iLitLen);
- Huffman::Encoding(aEncoding.iDistance,TEncoding::EDistances,aEncoding.iDistance);
-
-// now finally deflate the data with the generated encoding
- TDeflater deflater(aOutput,aEncoding);
- deflater.DeflateL(aBuf,aLength);
- aOutput.PadL(1);
- }
-
-void DeflateL(const TUint8* aBuf, TInt aLength, TBitOutput& aOutput)
- {
- TEncoding* encoding=new TEncoding;
- HMem::FillZ(encoding,sizeof(TEncoding));
- DoDeflateL(aBuf,aLength,aOutput,*encoding);
- }
-
--- a/e32tools/e32lib/e32image/deflate/deflate.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-// Copyright (c) 1998-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:
-// e32tools\petran\Szip\deflate.h
-//
-//
-
-#ifndef __DECODE_H__
-#define __DECODE_H__
-
-#include "huffman.h"
-#include <e32base.h>
-
-// deflation constants
-const TInt KDeflateLengthMag=8;
-const TInt KDeflateDistanceMag=12;
-//
-const TInt KDeflateMinLength=3;
-const TInt KDeflateMaxLength=KDeflateMinLength-1 + (1<<KDeflateLengthMag);
-const TInt KDeflateMaxDistance=(1<<KDeflateDistanceMag);
-const TInt KDeflateDistCodeBase=0x200;
-// hashing
-const TUint KDeflateHashMultiplier=0xAC4B9B19u;
-const TInt KDeflateHashShift=24;
-
-class TEncoding
- {
-public:
- enum {ELiterals=256,ELengths=(KDeflateLengthMag-1)*4,ESpecials=1,EDistances=(KDeflateDistanceMag-1)*4};
- enum {ELitLens=ELiterals+ELengths+ESpecials};
- enum {EEos=ELiterals+ELengths};
-public:
- TUint32 iLitLen[ELitLens];
- TUint32 iDistance[EDistances];
- };
-
-const TInt KDeflationCodes=TEncoding::ELitLens+TEncoding::EDistances;
-
-class CInflater
- {
-public:
- enum {EBufSize = 0x800, ESafetyZone=8};
-public:
- static CInflater* NewLC(TBitInput& aInput);
- ~CInflater();
-//
- TInt ReadL(TUint8* aBuffer,TInt aLength);
- TInt SkipL(TInt aLength);
-private:
- CInflater(TBitInput& aInput);
- void ConstructL();
- void InitL();
- TInt InflateL();
-private:
- TBitInput* iBits;
- const TUint8* iRptr; // partial segment
- TInt iLen;
- const TUint8* iAvail; // available data
- const TUint8* iLimit;
- TEncoding* iEncoding;
- TUint8* iOut; // circular buffer for distance matches
- TUint8 iHuff[EBufSize+ESafetyZone]; // huffman data
- };
-
-void DeflateL(const TUint8* aBuf, TInt aLength, TBitOutput& aOutput);
-
-#endif
-
--- a/e32tools/e32lib/e32image/deflate/encode.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,491 +0,0 @@
-// Copyright (c) 1998-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:
-// e32tools\petran\Szip\encode.cpp
-//
-//
-
-#include "huffman.h"
-#include "panic.h"
-#include <e32base.h>
-#include "h_utl.h"
-#include <assert.h>
-#include "farray.h"
-#include <stdlib.h>
-
-void User::Invariant()
- {
- fprintf(stderr, "User::Invariant() called\n");
- exit(1);
- }
-
-// local definitions used for Huffman code generation
-typedef TUint16 THuff; /** @internal */
-const THuff KLeaf=0x8000; /** @internal */
-struct TNode
-/** @internal */
- {
- TUint iCount;
- THuff iLeft;
- THuff iRight;
- };
-
-void HuffmanLengthsL(TUint32* aLengths,const TNode* aNodes,TInt aNode,TInt aLen)
-/** recursive function to calculate the code lengths from the node tree
-
- @internal
-*/
- {
- if (++aLen>Huffman::KMaxCodeLength)
- Panic(EHuffmanBufferOverflow);
-
- const TNode& node=aNodes[aNode];
- TUint x=node.iLeft;
- if (x&KLeaf)
- aLengths[x&~KLeaf]=aLen;
- else
- HuffmanLengthsL(aLengths,aNodes,x,aLen);
- x=node.iRight;
- if (x&KLeaf)
- aLengths[x&~KLeaf]=aLen;
- else
- HuffmanLengthsL(aLengths,aNodes,x,aLen);
- }
-
-void InsertInOrder(TNode* aNodes, TInt aSize, TUint aCount, TInt aVal)
-/** Insert the {aCount,aValue} pair into the already sorted array of nodes
-
- @internal
-*/
- {
- // Uses Insertion sort following a binary search...
- TInt l=0, r=aSize;
- while (l < r)
- {
- TInt m = (l+r) >> 1;
- if (aNodes[m].iCount<aCount)
- r=m;
- else
- l=m+1;
- }
- HMem::Copy(aNodes+l+1,aNodes+l,sizeof(TNode)*(aSize-l));
- aNodes[l].iCount=aCount;
- aNodes[l].iRight=TUint16(aVal);
- }
-
-void Huffman::HuffmanL(const TUint32 aFrequency[],TInt aNumCodes,TUint32 aHuffman[])
-/** Generate a Huffman code
-
- This generates a Huffman code for a given set of code frequencies. The output
- is a table of code lengths which can be used to build canonincal encoding tables
- or decoding trees for use with the TBitInput and TBitOutput classes.
-
- Entries in the table with a frequency of zero will have a zero code length
- and thus no associated huffman encoding. If each such symbol should have a
- maximum length encoding, they must be given at least a frequency of 1.
-
- For an alphabet of n symbols, this algorithm has a transient memory overhead
- of 8n, and a time complexity of O(n*log(n)).
-
- @param "const TUint32 aFrequency[]" The table of code frequencies
- @param "TInt aNumCodes" The number of codes in the table
- @param "TUint32 aHuffman[]" The table for the output code-length table. This must be
- the same size as the frequency table, and can safely be the same table
-
- @leave "KErrNoMemory" If memory used for code generation cannot be allocated
-
- @panic "USER ???" If the number of codes exceeds Huffman::KMaxCodes
-*/
- {
- if(TUint(aNumCodes)>TUint(KMaxCodes))
- Panic(EHuffmanTooManyCodes);
-
- // Sort the values into decreasing order of frequency
- //
- TNode* nodes = new TNode[aNumCodes];
- if(nodes==NULL)
- Panic(EHuffmanOutOfMemory);
-
- TInt lCount=0;
-
- for (TInt ii=0;ii<aNumCodes;++ii)
- {
- TInt c=aFrequency[ii];
- if (c!=0)
- InsertInOrder(nodes,lCount++,c,ii|KLeaf);
- }
-
- // default code length is zero
- HMem::FillZ(aHuffman,aNumCodes*sizeof(TUint32));
-
- if (lCount==0)
- {
- // no codes with frequency>0. No code has a length
- }
- else if (lCount==1)
- {
- // special case for a single value (always encode as "0")
- aHuffman[nodes[0].iRight&~KLeaf]=1;
- }
- else
- {
- // Huffman algorithm: pair off least frequent nodes and reorder
- //
- do
- {
- --lCount;
- TUint c=nodes[lCount].iCount + nodes[lCount-1].iCount;
- nodes[lCount].iLeft=nodes[lCount-1].iRight;
- // re-order the leaves now to reflect new combined frequency 'c'
- InsertInOrder(nodes,lCount-1,c,lCount);
- } while (lCount>1);
- // generate code lengths in aHuffman[]
- HuffmanLengthsL(aHuffman,nodes,1,0);
- }
-
- delete [] nodes;
-
- if(!IsValid(aHuffman,aNumCodes))
- Panic(EHuffmanInvalidCoding);
- }
-
-TBool Huffman::IsValid(const TUint32 aHuffman[],TInt aNumCodes)
-/** Validate a Huffman encoding
-
- This verifies that a Huffman coding described by the code lengths is valid.
- In particular, it ensures that no code exceeds the maximum length and
- that it is possible to generate a canonical coding for the specified lengths.
-
- @param "const TUint32 aHuffman[]" The table of code lengths as generated by Huffman::HuffmanL()
- @param "TInt aNumCodes" The number of codes in the table
-
- @return True if the code is valid, otherwise false
-*/
- {
- // The code is valid if one of the following holds:
- // (a) the code exactly fills the 'code space'
- // (b) there is only a single symbol with code length 1
- // (c) there are no encoded symbols
- //
- TUint remain=1<<KMaxCodeLength;
- TInt totlen=0;
- for (const TUint32* p=aHuffman+aNumCodes; p>aHuffman;)
- {
- TInt len=*--p;
- if (len>0)
- {
- totlen+=len;
- if (len>KMaxCodeLength)
- return EFalse;
- TUint c=1<<(KMaxCodeLength-len);
- if (c>remain)
- return EFalse;
- remain-=c;
- }
- }
-
- return remain==0 || totlen<=1;
- }
-
-void Huffman::Encoding(const TUint32 aHuffman[],TInt aNumCodes,TUint32 aEncodeTable[])
-/** Create a canonical Huffman encoding table
-
- This generates the huffman codes used by TBitOutput::HuffmanL() to write huffman
- encoded data. The input is table of code lengths, as generated by Huffman::HuffmanL()
- and must represent a valid huffman code.
-
- @param "const TUint32 aHuffman[]" The table of code lengths as generated by Huffman::HuffmanL()
- @param "TInt aNumCodes" The number of codes in the table
- @param "TUint32 aEncodeTable[]" The table for the output huffman codes. This must be
- the same size as the code-length table, and can safely be the same table
-
- @panic "USER ???" If the provided code is not a valid Huffman coding
-
- @see IsValid()
- @see HuffmanL()
-*/
- {
- __ASSERT_ALWAYS(IsValid(aHuffman,aNumCodes),Panic(EHuffmanInvalidCoding));
-
- TFixedArray<TInt,KMaxCodeLength> lenCount;
- lenCount.Reset();
-
- TInt ii;
- for (ii=0;ii<aNumCodes;++ii)
- {
- TInt len=aHuffman[ii]-1;
- if (len>=0)
- ++lenCount[len];
- }
-
- TFixedArray<TUint,KMaxCodeLength> nextCode;
- TUint code=0;
- for (ii=0;ii<KMaxCodeLength;++ii)
- {
- code<<=1;
- nextCode[ii]=code;
- code+=lenCount[ii];
- }
-
- for (ii=0;ii<aNumCodes;++ii)
- {
- TInt len=aHuffman[ii];
- if (len==0)
- aEncodeTable[ii]=0;
- else
- {
- aEncodeTable[ii] = (nextCode[len-1]<<(KMaxCodeLength-len))|(len<<KMaxCodeLength);
- ++nextCode[len-1];
- }
- }
- }
-
-/** the encoding table for the externalised code
- @internal
-*/
-const TUint32 HuffmanEncoding[]=
- {
- 0x10000000,
- 0x1c000000,
- 0x12000000,
- 0x1d000000,
- 0x26000000,
- 0x26800000,
- 0x2f000000,
- 0x37400000,
- 0x37600000,
- 0x37800000,
- 0x3fa00000,
- 0x3fb00000,
- 0x3fc00000,
- 0x3fd00000,
- 0x47e00000,
- 0x47e80000,
- 0x47f00000,
- 0x4ff80000,
- 0x57fc0000,
- 0x5ffe0000,
- 0x67ff0000,
- 0x77ff8000,
- 0x7fffa000,
- 0x7fffb000,
- 0x7fffc000,
- 0x7fffd000,
- 0x7fffe000,
- 0x87fff000,
- 0x87fff800
- };
-
-void EncodeRunLengthL(TBitOutput& aOutput, TInt aLength)
-/** encode 0a as '0' and 0b as '1', return number of symbols created
-
- @internal
-*/
- {
- if (aLength>0)
- {
- EncodeRunLengthL(aOutput,(aLength-1)>>1);
- aOutput.HuffmanL(HuffmanEncoding[1-(aLength&1)]);
- }
- }
-
-void Huffman::ExternalizeL(TBitOutput& aOutput,const TUint32 aHuffman[],TInt aNumCodes)
-/** Store a canonical huffman encoding in compact form
-
- As the encoding is canonical, only the code lengths of each code needs to be saved.
-
- Due to the nature of code length tables, these can usually be stored very compactly
- by encoding the encoding itself, hence the use of the bit output stream.
-
- @param "TBitOutput& aOutput" The output stream for the encoding
- @param "const TUint32 aHuffman[]" The table of code lengths as generated by Huffman::HuffmanL()
- @param "TInt aNumCodes" The number of huffman codes in the table
-
- @leave "TBitOutput::HuffmanL()"
-*/
- {
- // We assume that the code length table is generated by the huffman generator,
- // in which case the maxmimum code length is 27 bits.
- //
- // We apply three transformations to the data:
- // 1. the data goes through a move-to-front coder
- // 2. apply a rle-0 coder which replace runs of '0' with streams of '0a' and '0b'
- // 3. encode the result using a predefined (average) huffman coding
- //
- // This can be done in a single pass over the data, avoiding the need for additional
- // memory.
- //
- // initialise the list for the MTF coder
- TFixedArray<TUint8,Huffman::KMetaCodes> list;
- TInt i;
- for (i=0;i<list.Count();++i)
- list[i]=TUint8(i);
- TInt last=0;
-
- TInt rl=0;
- const TUint32* p32=aHuffman;
- const TUint32* e32=p32+aNumCodes;
- while (p32<e32)
- {
- TInt c=*p32++;
- if (c==last)
- ++rl; // repeat of last symbol
- else
- {
- // encode run-length
- EncodeRunLengthL(aOutput,rl);
- rl=0;
- // find code in MTF list
- TInt j;
- for (j=1;list[j]!=c;++j)
- ;
- // store this code
- aOutput.HuffmanL(HuffmanEncoding[j+1]);
- // adjust list for MTF algorithm
- while (--j>0)
- list[j+1]=list[j];
- list[1]=TUint8(last);
- last=c;
- }
- }
- // encod any remaining run-length
- EncodeRunLengthL(aOutput,rl);
- }
-
-
-TBitOutput::TBitOutput()
-/** Construct a bit stream output object
-
- Following construction the bit stream is ready for writing bits, but will first call
- OverflowL() as the output buffer is 'full'. A derived class can detect this state as
- Ptr() will return null.
-*/
- :iCode(0),iBits(-8),iPtr(0),iEnd(0)
- {}
-
-TBitOutput::TBitOutput(TUint8* aBuf,TInt aSize)
-/** Construct a bit stream output object over a buffer
-
- Data will be written to the buffer until it is full, at which point OverflowL() will
- be called. This should handle the data and then can Set() again to reset the buffer
- for further output.
-
- @param "TUint8* aBuf" The buffer for output
- @param "TInt aSize" The size of the buffer in bytes
-*/
- :iCode(0),iBits(-8),iPtr(aBuf),iEnd(aBuf+aSize)
- {}
-
-void TBitOutput::HuffmanL(TUint aHuffCode)
-/** Write a huffman code
-
- This expects a huffman code value as generated by Huffman::Encoding()
-
- @param "TUint aHuffCode" The huffman code write to the stream
-
- @leave "OverflowL()" If the output buffer is full, OverflowL() is called
-*/
- {
- DoWriteL(aHuffCode<<(32-Huffman::KMaxCodeLength),aHuffCode>>Huffman::KMaxCodeLength);
- }
-
-void TBitOutput::WriteL(TUint aValue,TInt aLength)
-/** Write an arbitrary integer value
-
- Write an unsigned integer using the number of bits specified. Only
- the low order bits of the value are written to the output, most
- significant bit first.
-
- @param "TUint aValue" The value to write to the stream
- @param "TUint aLength" The number of bits to output
-
- @leave "OverflowL()" If the output buffer is full, OverflowL() is called
-*/
- {
- if (aLength)
- DoWriteL(aValue<<=32-aLength,aLength);
- }
-
-void TBitOutput::PadL(TUint aPadding)
-/** Pad the bitstream to the next byte boundary
-
- Terminate the bitstream by padding the last byte with the requested value.
- Following this operation the bitstream can continue to be used, the data will
- start at the next byte.
-
- @param "TUint aPadding" The bit value to pad the final byte with
-
- @leave "OverflowL()" If the output buffer is full, OverflowL() is called
-*/
- {
- if (iBits>-8)
- WriteL(aPadding?0xffffffffu:0,-iBits);
- }
-
-void TBitOutput::DoWriteL(TUint aBits,TInt aSize)
-/** Write the higher order bits to the stream
-
- @internal
-*/
- {
- if (aSize>25)
- {
- // cannot process >25 bits in a single pass
- // so do the top 8 bits first
- ASSERT(aSize<=32);
- DoWriteL(aBits&0xff000000u,8);
- aBits<<=8;
- aSize-=8;
- }
-
- TInt bits=iBits;
- TUint code=iCode|(aBits>>(bits+8));
- bits+=aSize;
- if (bits>=0)
- {
- TUint8* p=iPtr;
- do
- {
- if (p==iEnd)
- {
- // run out of buffer space so invoke the overflow handler
- iPtr=p;
- OverflowL();
- p=iPtr;
- ASSERT(p!=iEnd);
- }
- *p++=TUint8(code>>24);
- code<<=8;
- bits-=8;
- } while (bits>=0);
- iPtr=p;
- }
- iCode=code;
- iBits=bits;
- }
-
-void TBitOutput::OverflowL()
-/** Handle a full output buffer
-
- This virtual function is called when the output buffer is full. It should deal
- with the data in the buffer before reseting the buffer using Set(), allowing
- further data to be written.
-
- A derived class can replace this to write the data to a file (for example)
- before marking the buffer as empty.
-
- @leave "KErrOverflow" The default implementation leaves
-*/
- {
- Panic(EHuffmanBufferOverflow);
- }
--- a/e32tools/e32lib/e32image/deflate/farray.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-// Copyright (c) 1998-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:
-// e32tools\petran\Szip\farray.h
-//
-//
-
-#ifndef __FARRAY_H__
-#define __FARRAY_H__
-#include <assert.h>
-
-template <class T,TInt S>
-class TFixedArray
-// Range checking wrapper+ class for C++ arrays
-// Can be embedded in C-objects, or used on the stack: use Reset() to zero it
- {
- typedef TFixedArray<T,S> ThisClass;
-public:
- inline TFixedArray();
- inline TFixedArray(const T* aList, TInt aLength);
- //
- inline void Copy(const T* aList, TInt aLength);
- inline void Reset(); // zero fill
- inline void DeleteAll();
- //
- inline TInt Count() const;
- inline TInt Length() const;
- // Accessors - debug range checking
- inline T& operator[](TInt aIndex);
- inline const T& operator[] (TInt aIndex) const;
- // Accessors - always range checking
- inline T& At(TInt aIndex);
- inline const T& At(TInt aIndex) const;
- // Provides pointers to the beginning and end of the array
- inline T* Begin();
- inline T* End();
- inline const T* Begin() const;
- inline const T* End() const;
- //
-protected:
- inline static TBool InRange(TInt aIndex);
-protected:
- T iRep[S];
- };
-
-// Template class TFixedArray
-IMPORT_C void PanicTFixedArray();
-
-template <class T,TInt S>
-inline TFixedArray<T,S>::TFixedArray()
- {}
-template <class T,TInt S>
-inline void TFixedArray<T,S>::Copy(const T* aList,TInt aLength)
- {assert(TUint(aLength)<=TUint(S));HMem::Copy(iRep,aList,aLength*sizeof(T));}
-template <class T,TInt S>
-inline TFixedArray<T,S>::TFixedArray(const T* aList,TInt aLength)
- {Copy(aList,aLength);}
-template <class T,TInt S>
-inline void TFixedArray<T,S>::Reset()
- {HMem::FillZ(iRep,sizeof(iRep));}
-template <class T,TInt S>
-inline TInt TFixedArray<T,S>::Count() const
- {return S;}
-template <class T,TInt S>
-inline TInt TFixedArray<T,S>::Length() const
- {return sizeof(T);}
-template <class T,TInt S>
-inline TBool TFixedArray<T,S>::InRange(TInt aIndex)
- {return TUint(aIndex)<S;}
-template <class T,TInt S>
-inline T& TFixedArray<T,S>::operator[](TInt aIndex)
- {assert(InRange(aIndex));return iRep[aIndex];}
-template <class T,TInt S>
-inline const T& TFixedArray<T,S>::operator[](TInt aIndex) const
- {return const_cast<ThisClass&>(*this)[aIndex];}
-template <class T,TInt S>
-inline T& TFixedArray<T,S>::At(TInt aIndex)
- {verify(InRange(aIndex));return iRep[aIndex];}
-template <class T,TInt S>
-inline const T& TFixedArray<T,S>::At(TInt aIndex) const
- {return const_cast<ThisClass&>(*this).At(aIndex);}
-template <class T,TInt S>
-inline T* TFixedArray<T,S>::Begin()
- {return &iRep[0];}
-template <class T,TInt S>
-inline T* TFixedArray<T,S>::End()
- {return &iRep[S];}
-template <class T,TInt S>
-inline const T* TFixedArray<T,S>::Begin() const
- {return &iRep[0];}
-template <class T,TInt S>
-inline const T* TFixedArray<T,S>::End() const
- {return &iRep[S];}
-#endif
--- a/e32tools/e32lib/e32image/deflate/huffman.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-// Copyright (c) 1998-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:
-// e32tools\petran\Szip\huffman.h
-//
-//
-
-#ifndef __HUFFMAN_H__
-#define __HUFFMAN_H__
-
-#include <e32std.h>
-
-/** Bit output stream.
- Good for writing bit streams for packed, compressed or huffman data algorithms.
-
- This class must be derived from and OverflowL() reimplemented if the bitstream data
- cannot be generated into a single memory buffer.
-
- @since 8.0
- @library euser.lib
-*/
-class TBitOutput
- {
-public:
- TBitOutput();
- TBitOutput(TUint8* aBuf,TInt aSize);
- inline virtual ~TBitOutput() { }
- inline void Set(TUint8* aBuf,TInt aSize);
- inline const TUint8* Ptr() const;
- inline TInt BufferedBits() const;
-//
- void WriteL(TUint aValue, TInt aLength);
- void HuffmanL(TUint aHuffCode);
- void PadL(TUint aPadding);
-private:
- void DoWriteL(TUint aBits, TInt aSize);
- virtual void OverflowL();
-private:
- TUint iCode; // code in production
- TInt iBits;
- TUint8* iPtr;
- TUint8* iEnd;
- };
-
-/** Set the memory buffer to use for output
-
- Data will be written to this buffer until it is full, at which point OverflowL() will
- be called. This should handle the data and then can Set() again to reset the buffer
- for further output.
-
- @param "TUint8* aBuf" The buffer for output
- @param "TInt aSize" The size of the buffer in bytes
-*/
-inline void TBitOutput::Set(TUint8* aBuf,TInt aSize)
- {iPtr=aBuf;iEnd=aBuf+aSize;}
-/** Get the current write position in the output buffer
-
- In conjunction with the address of the buffer, which should be known to the
- caller, this describes the data in the bitstream.
-*/
-inline const TUint8* TBitOutput::Ptr() const
- {return iPtr;}
-/** Get the number of bits that are buffered
-
- This reports the number of bits that have not yet been written into the
- output buffer. It will always lie in the range 0..7. Use PadL() to
- pad the data out to the next byte and write it to the buffer.
-*/
-inline TInt TBitOutput::BufferedBits() const
- {return iBits+8;}
-
-
-/** Bit input stream.
- Good for reading bit streams for packed, compressed or huffman data algorithms.
- @since 8.0
- @library euser.lib
-*/
-class TBitInput
- {
-public:
- TBitInput();
- TBitInput(const TUint8* aPtr, TInt aLength, TInt aOffset=0);
- void Set(const TUint8* aPtr, TInt aLength, TInt aOffset=0);
- inline virtual ~TBitInput() { }
- TUint ReadL();
- TUint ReadL(TInt aSize);
- TUint HuffmanL(const TUint32* aTree);
-private:
- virtual void UnderflowL();
-private:
- TInt iCount;
- TUint iBits;
- TInt iRemain;
- const TUint32* iPtr;
- };
-
-/** Huffman code toolkit.
-
- This class builds a huffman encoding from a frequency table and builds
- a decoding tree from a code-lengths table
-
- The encoding generated is based on the rule that given two symbols s1 and s2, with
- code length l1 and l2, and huffman codes h1 and h2:
-
- if l1<l2 then h1<h2 when compared lexicographically
- if l1==l2 and s1<s2 then h1<h2 ditto
-
- This allows the encoding to be stored compactly as a table of code lengths
-
- @since 8.0
- @library euser.lib
-*/
-class Huffman
- {
-public:
- enum {KMaxCodeLength=27};
- enum {KMetaCodes=KMaxCodeLength+1};
- enum {KMaxCodes=0x8000};
-public:
- static void HuffmanL(const TUint32 aFrequency[],TInt aNumCodes,TUint32 aHuffman[]);
- static void Encoding(const TUint32 aHuffman[],TInt aNumCodes,TUint32 aEncodeTable[]);
- static void Decoding(const TUint32 aHuffman[],TInt aNumCodes,TUint32 aDecodeTree[],TInt aSymbolBase=0);
- static TBool IsValid(const TUint32 aHuffman[],TInt aNumCodes);
-//
- static void ExternalizeL(TBitOutput& aOutput,const TUint32 aHuffman[],TInt aNumCodes);
- static void InternalizeL(TBitInput& aInput,TUint32 aHuffman[],TInt aNumCodes);
- };
-
-#endif
-
--- a/e32tools/e32lib/e32image/deflate/inflate.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-// Copyright (c) 1998-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:
-// e32tools\petran\Szip\inflate.cpp
-//
-//
-
-#include "deflate.h"
-#include "panic.h"
-#include "h_utl.h"
-
-// Class RInflater
-//
-// The inflation algorithm, complete with huffman decoding
-
-inline CInflater::CInflater(TBitInput& aInput)
- :iBits(&aInput),iEncoding(0),iOut(0)
- {}
-
-void CInflater::ConstructL()
- {
- iEncoding=new TEncoding;
- if(iEncoding==NULL)
- Panic(EHuffmanOutOfMemory);
- InitL();
- iLen=0;
- iOut=new TUint8[KDeflateMaxDistance];
- if(iOut==NULL)
- Panic(EHuffmanOutOfMemory);
-
- iAvail=iLimit=iOut;
- }
-
-CInflater* CInflater::NewLC(TBitInput& aInput)
- {
- CInflater* self=new CInflater(aInput);
- if(self==NULL)
- Panic(EHuffmanOutOfMemory);
- self->ConstructL();
- return self;
- }
-
-CInflater::~CInflater()
- {
- delete iEncoding;
- delete [] iOut;
- }
-
-TInt CInflater::ReadL(TUint8* aBuffer,TInt aLength)
- {
- TInt tfr=0;
- for (;;)
- {
- TInt len=Min(aLength,iLimit-iAvail);
- if (len && aBuffer)
- {
- HMem::Copy(aBuffer,iAvail,len);
- aBuffer+=len;
- }
- aLength-=len;
- iAvail+=len;
- tfr+=len;
- if (aLength==0)
- return tfr;
- len=InflateL();
- if (len==0)
- return tfr;
- iAvail=iOut;
- iLimit=iAvail+len;
- }
- }
-
-TInt CInflater::SkipL(TInt aLength)
- {
- return ReadL(0,aLength);
- }
-
-void CInflater::InitL()
- {
-// read the encoding
- Huffman::InternalizeL(*iBits,iEncoding->iLitLen,KDeflationCodes);
-// validate the encoding
- if (!Huffman::IsValid(iEncoding->iLitLen,TEncoding::ELitLens) ||
- !Huffman::IsValid(iEncoding->iDistance,TEncoding::EDistances))
- Panic(EHuffmanCorruptFile);
-// convert the length tables into huffman decoding trees
- Huffman::Decoding(iEncoding->iLitLen,TEncoding::ELitLens,iEncoding->iLitLen);
- Huffman::Decoding(iEncoding->iDistance,TEncoding::EDistances,iEncoding->iDistance,KDeflateDistCodeBase);
- }
-
-TInt CInflater::InflateL()
-//
-// consume all data lag in the history buffer, then decode to fill up the output buffer
-// return the number of available bytes in the output buffer. This is only ever less than
-// the buffer size if the end of stream marker has been read
-//
- {
-// empty the history buffer into the output
- TUint8* out=iOut;
- TUint8* const end=out+KDeflateMaxDistance;
- const TUint32* tree=iEncoding->iLitLen;
- if (iLen<0) // EOF
- return 0;
- if (iLen>0)
- goto useHistory;
-//
- while (out<end)
- {
- // get a huffman code
- {
- TInt val=iBits->HuffmanL(tree)-TEncoding::ELiterals;
- if (val<0)
- {
- *out++=TUint8(val);
- continue; // another literal/length combo
- }
- if (val==TEncoding::EEos-TEncoding::ELiterals)
- { // eos marker. we're done
- iLen=-1;
- break;
- }
- // get the extra bits for the code
- TInt code=val&0xff;
- if (code>=8)
- { // xtra bits
- TInt xtra=(code>>2)-1;
- code-=xtra<<2;
- code<<=xtra;
- code|=iBits->ReadL(xtra);
- }
- if (val<KDeflateDistCodeBase-TEncoding::ELiterals)
- { // length code... get the code
- iLen=code+KDeflateMinLength;
- tree=iEncoding->iDistance;
- continue; // read the huffman code
- }
- // distance code
- iRptr=out-(code+1);
- if (iRptr+KDeflateMaxDistance<end)
- iRptr+=KDeflateMaxDistance;
- }
-useHistory:
- TInt tfr=Min(end-out,iLen);
- iLen-=tfr;
- const TUint8* from=iRptr;
- do
- {
- *out++=*from++;
- if (from==end)
- from-=KDeflateMaxDistance;
- } while (--tfr!=0);
- iRptr=from;
- tree=iEncoding->iLitLen;
- };
- return out-iOut;
- }
-
-
-
--- a/e32tools/e32lib/e32image/deflate/panic.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-// Copyright (c) 1998-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:
-// e32tools\petran\Szip\panic.cpp
-//
-//
-
-#include "panic.h"
-#include "h_utl.h"
-#include <stdlib.h>
-
-char* HuffmanError[]= {
- "Huffman: Too many codes\n",
- "Huffman: Invalid coding\n",
- "Huffman: Buffer overflow\n",
- "Huffman: Out Of Memory\n",
- "Huffman: Corrupt File\n",
- };
-
-const TInt KHuffmanErrorBase=700;
-
-void Panic(TPanic aPanic)
- {
- Print(ESevereError,HuffmanError[TInt(aPanic)]);
- exit(KHuffmanErrorBase+TInt(aPanic));
- }
--- a/e32tools/e32lib/e32image/deflate/panic.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-// Copyright (c) 1998-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:
-// e32tools\petran\Szip\panic.h
-//
-//
-
-#ifndef __PANIC_H__
-#define __PANIC_H__
-
-#include <e32std.h>
-
-enum TPanic
- {
- EHuffmanTooManyCodes=0,
- EHuffmanInvalidCoding=1,
- EHuffmanBufferOverflow=2,
- EHuffmanOutOfMemory=3,
- EHuffmanCorruptFile=4,
-
- };
-
-void Panic(TPanic aPanic);
-
-#endif
-
--- a/e32tools/e32lib/e32image/e32image.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,866 +0,0 @@
-// Copyright (c) 1996-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:
-// e32tools/e32image/e32image.cpp
-// Basic operations on E32Image files which are used by ROMBUILD.
-// These are independent of the original file format from which the
-// E32Image file was derived.
-//
-//
-
-#include <time.h>
-#include <malloc.h>
-#include <string.h>
-#include <stdlib.h>
-#include "h_utl.h"
-
-
-#if defined (__MSVCDOTNET__) || defined(__TOOLS2__)
-#include <fstream>
-#else //!__MSVCDOTNET__
-#include <fstream.h>
-#endif //__MSVCDOTNET__
-
-#include <assert.h>
-#ifndef __LINUX__
- #include <io.h>
-#endif
-#include "h_ver.h"
-
-// get E32ImageHeader class...
-#define INCLUDE_E32IMAGEHEADER_IMPLEMENTATION
-#define RETURN_FAILURE(_r) return (fprintf(stderr, "line %d\n", __LINE__),_r)
-//#define E32IMAGEHEADER_TRACE(_t) printf _t
-#include "e32image.h"
-#include "byte_pair.h"
-
-void DeflateCompress(char* bytes, TInt size, ostream& os);
-void InflateUnCompress(unsigned char* source, int sourcesize, unsigned char* dest, int destsize);
-void CompressPages(TUint8 * bytes, TInt size, ostream &os, CBytePair *aBPE);
-int DecompressPages(TUint8 * bytes, istream& is, CBytePair *aBPE);
-
-// needed by E32ImageHeaderV::ValidateHeader...
-void Mem::Crc32(TUint32& aCrc, const TAny* aPtr, TInt aLength)
- {
- HMem::Crc32(aCrc, aPtr, aLength);
- }
-
-//
-// E32 Image files
-//
-E32ImageFile::E32ImageFile()
- : iData(NULL), iSize(0), iOrigHdr(NULL), iHdr(NULL), iFileName(NULL)
-#ifndef __LINUX__
- , iWideFileName(NULL)
-#endif
-, iError(0), iSource(EE32Image), iOrigHdrOffsetAdj(0), iExportBitMap(0)
- {}
-
-E32ImageFile::~E32ImageFile()
- {
-
- free(iData);
- delete [] iFileName;
-#ifndef __LINUX__
- delete [] iWideFileName;
-#endif
- if (iHdr && iHdr != iOrigHdr)
- delete iHdr;
- free(iExportBitMap);
- }
-
-// dummy implementation
-TBool E32ImageFile::Translate(const char*, TUint, TBool, TBool)
- {
- return EFalse;
- }
-
-Int64 timeToInt64(TInt aTime)
- {
- aTime-=(30*365*24*60*60+7*24*60*60); // seconds since midnight Jan 1st, 2000
- Int64 daysTo2000AD=730497;
- Int64 t=daysTo2000AD*24*3600+aTime; // seconds since 0000
- t=t+3600; // BST (?)
- return t*1000000; // milliseconds
- }
-
-class TE32ImageUids : public TCheckedUid
- {
-public:
- TE32ImageUids(TUint32 aUid1, TUint32 aUid2, TUint32 aUid3) : TCheckedUid(TUidType(TUid::Uid(aUid1), TUid::Uid(aUid2), TUid::Uid(aUid3))) {}
- TUint Check() { return TCheckedUid::Check(); }
- };
-
-void E32ImageFile::SetDefaultHeader()
- {
- iHdr = (E32ImageHeaderV*)iOrigHdr;
- iHdr->iUid1 = 0;
- iHdr->iUid2 = 0;
- iHdr->iUid3 = 0;
- iHdr->iHeaderCrc = 0;
- iHdr->iSignature = 0x434f5045u;
- iHdr->iModuleVersion = 0x00010000u;
- iHdr->iCompressionType = 0;
- iHdr->iToolsVersion = TVersion(MajorVersion, MinorVersion, Build);
- Int64 time1(timeToInt64(time(0)));
- iHdr->iTimeLo=(TUint32)time1;
- iHdr->iTimeHi=(TUint32)(time1>>32);
- iHdr->iFlags = KImageHdrFmt_V;
- iHdr->iCodeSize = 0;
- iHdr->iDataSize = 0;
- iHdr->iHeapSizeMin = 0;
- iHdr->iHeapSizeMax = 0;
- iHdr->iStackSize = 0;
- iHdr->iBssSize = 0;
- iHdr->iEntryPoint = 0;
- iHdr->iCodeBase = 0;
- iHdr->iDataBase = 0;
- iHdr->iDllRefTableCount = 0;
- iHdr->iExportDirOffset = 0;
- iHdr->iExportDirCount = 0;
- iHdr->iTextSize = 0;
- iHdr->iCodeOffset = 0;
- iHdr->iDataOffset = 0;
- iHdr->iImportOffset = 0;
- iHdr->iCodeRelocOffset = 0;
- iHdr->iDataRelocOffset = 0;
- iHdr->iProcessPriority = (TUint16)EPriorityForeground;
- iHdr->iUncompressedSize = 0;
- iHdr->iS.iSecureId = 0;
- iHdr->iS.iVendorId = 0;
- iHdr->iExceptionDescriptor = 0;
- iHdr->iSpare2 = 0;
-
- iHdr->iExportDescSize = 0;
- iHdr->iExportDescType = KImageHdr_ExpD_NoHoles;
- iHdr->iExportDesc[0] = 0;
- }
-
-void E32ImageFile::SetCallEntryPoints(TInt aBool)
- {
-
- if (aBool)
- iHdr->iFlags&=~KImageNoCallEntryPoint;
- else
- iHdr->iFlags|=KImageNoCallEntryPoint;
- }
-
-void E32ImageFile::SetFixedAddress(TInt aBool)
- {
-
- if (aBool)
- iHdr->iFlags|=KImageFixedAddressExe;
- else
- iHdr->iFlags&=~KImageFixedAddressExe;
- }
-
-void E32ImageFile::SetPriority(TProcessPriority aPri)
- {
-
- iHdr->iProcessPriority = (TUint16)aPri;
- }
-
-void E32ImageFile::SetCapability(SCapabilitySet& aCapabilities)
- {
- iHdr->iS.iCaps = aCapabilities;
- }
-
-void E32ImageFile::SetFPU(unsigned int aFPU)
- {
- iHdr->iFlags &=~ KImageHWFloatMask;
-
- if (aFPU == 1)
- iHdr->iFlags |= KImageHWFloat_VFPv2;
- }
-
-void E32ImageFile::Adjust(TInt aSize, TBool aAllowShrink)
-//
-// Adjust the size of allocated data and fix the member data
-//
- {
-
- TInt asize = ALIGN4(aSize);
- if (asize == iSize)
- return;
- if (iSize == 0)
- {
- iSize = asize;
- iData = (char*)malloc(iSize);
- memset(iData, 0, iSize);
- }
- else if (aAllowShrink || asize > iSize)
- {
- TInt oldsize = iSize;
- iSize = asize;
- iData = (char*)realloc(iData, iSize);
- if (iSize > oldsize)
- memset(iData+oldsize, 0, iSize-oldsize);
- }
- if (!iData)
- iSize = 0;
- if (iHdr && iHdr == iOrigHdr)
- iHdr = (E32ImageHeaderV*)iData;
- iOrigHdr = (E32ImageHeader*)iData;
- }
-
-TInt E32ImageFile::ReadHeader(ifstream& is)
- {
- Adjust(sizeof(E32ImageHeader), EFalse);
- is.read(iData, sizeof(E32ImageHeader));
- TInt hdrsz = iOrigHdr->TotalSize();
- if (hdrsz > 0x10000 || hdrsz <= 0)
- return KErrCorrupt; // sanity check
- if (hdrsz > (TInt)sizeof(E32ImageHeader))
- {
- Adjust(hdrsz, EFalse);
- is.read(iData+sizeof(E32ImageHeader), hdrsz-sizeof(E32ImageHeader));
- }
- TUint32 uncompressedSize;
- TInt r = iOrigHdr->ValidateHeader(iFileSize,uncompressedSize);
- if (r != KErrNone)
- {
- fprintf(stderr, "Integrity check failed %d\n", r);
- return r;
- }
- iHdr = (E32ImageHeaderV*)iOrigHdr;
- return KErrNone;
- }
-
-void E32ImageFile::SetStackSize(TInt aSize)
- {
- iHdr->iStackSize=aSize;
- }
-
-void E32ImageFile::SetHeapSizeMin(TInt aSize)
- {
- iHdr->iHeapSizeMin=aSize;
- }
-
-void E32ImageFile::SetHeapSizeMax(TInt aSize)
- {
- iHdr->iHeapSizeMax=aSize;
- }
-
-TUint E32ImageFile::TextOffset()
-//
-// Return the offset of the text section
-//
- {
- return 0;
- }
-
-TUint E32ImageFile::DataOffset()
-//
-// return the offset of the initialised data
-//
- {
- return iHdr->iCodeSize;
- }
-
-TUint E32ImageFile::BssOffset()
-//
-// return the offset from the start of code where the bss is linked
-//
- {
- return DataOffset()+iHdr->iDataSize;
- }
-
-
-TInt E32ImageFile::IsDll()
-//
-//
-//
- {
- return iHdr->iFlags&KImageDll;
- }
-
-
-void E32ImageFile::RelocateSection(char* aPtr, char* aRelocs, TUint aCodeDelta, TUint aDataDelta, char* aImagePtr, TLinAddr** aIATRefs, TBool keepIAT)
-//
-// Relocates the section data at aPtr
-//
- {
-
- TUint codeStart=iHdr->iCodeBase;
- TUint codeFinish=codeStart+iHdr->iCodeSize;
- TUint iatStart = aIATRefs ? codeStart+iHdr->iTextSize : 0;
- TUint iatFinish = aIATRefs ? iatStart+NumberOfImports()*sizeof(TUint) : 0;
-// Print(ELog,"IAT: %x->%x\n",iatStart,iatFinish);
- char* relocs=aRelocs;
- TUint page=0;
- TInt size=0;
- TInt i=((E32RelocSection *)relocs)->iNumberOfRelocs;
- relocs+=sizeof(E32RelocSection);
- while (i>0)
- {
- if (size>0)
- {
- TUint offset=*(TUint16 *)relocs;
- relocs+=2;
- if (offset!=0)
- { // its a reloc
- TUint va=page+(offset&0x0fff);
- TUint relocType=offset&0xf000;
- TUint *dataptr=(TUint *)(aPtr+va);
- assert((char *)dataptr < aRelocs);
- TUint data=*dataptr;
-// Print(ELog,"data %x\n",data);
- if (relocType == KTextRelocType)
- *dataptr=data+aCodeDelta; // points to text/rdata section
- else if (relocType == KDataRelocType)
- *dataptr=data+aDataDelta;
- else
- {
- if (relocType != KInferredRelocType)
- Print(EError,"Unrecognized relocation type %x\n",relocType);
-
- if (data>=iatStart && data<iatFinish)
- {
-
- TUint iatNum = (data-iatStart)/sizeof(TLinAddr);
-
- // If "keepIAT" is used then the importing instruction must import through the IAT entry,
- // but otherwise we change the IAT entry to point to the bit of code doing the importing
- // and do the real fix-up later on in TRomBuilderEntry::FixupImports.
- // NB: We always want to do this for X86 or data exports dont work.
- if (keepIAT || (iHdr->iCpuIdentifier & 0x1000) /*denotes X86*/)
- *dataptr=data+aCodeDelta;
- else
- {
- if ((TUint)aIATRefs[iatNum]>65535)
- Print(EWarning, "Multiple relocations for IAT entry %d (0x%x, 0x%x)\n",
- iatNum, aIATRefs[iatNum], dataptr);
- else
- aIATRefs[iatNum] = (TLinAddr*)(aImagePtr+va); // ROM image address of importing pointer
- }
- }
- else if (data>=codeStart && data<codeFinish)
- *dataptr=data+aCodeDelta; // points to text/rdata section
- else
- *dataptr=data+aDataDelta; // points to data section
- }
- --i;
- }
- size-=2;
- }
- else
- { // next page of relocs
- page=*(TUint *)relocs;
- relocs+=4;
- size=*(TUint *)relocs;
- relocs+=4;
- size-=8;
- }
- }
- }
-
-void E32ImageFile::SetUids(TUid aUid1, TUid aUid2, TUid aUid3)
- {
- iHdr->iUid1=aUid1.iUid;
- iHdr->iUid2=aUid2.iUid;
- iHdr->iUid3=aUid3.iUid;
- }
-
-void E32ImageFile::SetSecureId(TUint32 aId)
- {
- ((E32ImageHeaderV*)iHdr)->iS.iSecureId = aId;
- }
-
-void E32ImageFile::SetVendorId(TUint32 aId)
- {
- ((E32ImageHeaderV*)iHdr)->iS.iVendorId = aId;
- }
-
-void E32ImageFile::UpdateHeaderCrc()
- {
- TE32ImageUids u(iHdr->iUid1, iHdr->iUid2, iHdr->iUid3);
- iHdr->iUidChecksum = u.Check();
- TInt hdrsz = iHdr->TotalSize();
- TInt orighdrsz = iOrigHdr->TotalSize();
- iHdr->iUncompressedSize = iSize - orighdrsz;
- iHdr->iHeaderCrc = KImageCrcInitialiser;
- TUint32 crc = 0;
- HMem::Crc32(crc, iHdr, hdrsz);
- iHdr->iHeaderCrc = crc;
- }
-
-TInt E32ImageFile::NumberOfImports()
-//
-// Return the number of imports made by this image
-//
- {
-
- if (iHdr->iDllRefTableCount==0 || iHdr->iImportOffset==0)
- return 0;
-
- TUint impfmt = iHdr->ImportFormat();
- const E32ImportSection* isection = (const E32ImportSection*)(iData + iOrigHdr->iImportOffset);
- TInt d;
- TInt nImports = 0;
- const E32ImportBlock* b = (const E32ImportBlock*)(isection+1);
- for (d=0; d<iHdr->iDllRefTableCount; d++)
- {
- nImports += b->iNumberOfImports;
- b = b->NextBlock(impfmt);
- }
-
- if (impfmt==KImageImpFmt_PE || impfmt==KImageImpFmt_PE2)
- {
- TUint *imports=(TUint *)(iData + iOrigHdr->iCodeOffset + iHdr->iTextSize);
- TInt i=0;
- while (*imports++)
- i++;
- assert(i==nImports);
- }
-
- return nImports;
- }
-
-// Work out which exports are missing from the export directory
-void E32ImageFile::CreateExportBitMap()
- {
- TInt nexp = iOrigHdr->iExportDirCount;
- TInt memsz = (nexp + 7) >> 3;
- iExportBitMap = (TUint8*)malloc(memsz);
- memset(iExportBitMap, 0xff, memsz);
- TUint* exports = (TUint*)(iData + iOrigHdr->iExportDirOffset);
- TUint absoluteEntryPoint = iOrigHdr->iEntryPoint + iOrigHdr->iCodeBase;
- TUint impfmt = iOrigHdr->ImportFormat();
- TUint hdrfmt = iOrigHdr->HeaderFormat();
- TUint absentVal = (impfmt == KImageImpFmt_ELF) ? absoluteEntryPoint : iOrigHdr->iEntryPoint;
- TInt i;
- iMissingExports = 0;
- for (i=0; i<nexp; ++i)
- {
- if (exports[i] == absentVal)
- {
- iExportBitMap[i>>3] &= ~(1u << (i & 7));
- ++iMissingExports;
- }
- }
- if (hdrfmt < KImageHdrFmt_V && iMissingExports)
- {
- fprintf(stderr, "Bad exports\n");
- exit(999);
- }
- }
-
-// Append an export description to the E32ImageHeader if necessary
-void E32ImageFile::AddExportDescription()
- {
- if (iMissingExports == 0)
- return; // nothing to do
- TInt nexp = iOrigHdr->iExportDirCount;
- TInt memsz = (nexp + 7) >> 3; // size of complete bitmap
- TInt mbs = (memsz + 7) >> 3; // size of meta-bitmap
- TInt nbytes = 0;
- TInt i;
- for (i=0; i<memsz; ++i)
- if (iExportBitMap[i] != 0xff)
- ++nbytes; // number of groups of 8
- TUint8 edt = KImageHdr_ExpD_FullBitmap;
- TInt extra_space = memsz - 1;
- if (mbs + nbytes < memsz)
- {
- edt = KImageHdr_ExpD_SparseBitmap8;
- extra_space = mbs + nbytes - 1;
- }
- extra_space = (extra_space + sizeof(TUint) - 1) &~ (sizeof(TUint) - 1);
- TInt hdrsz = sizeof(E32ImageHeaderV) + extra_space;
- iHdr = (E32ImageHeaderV*)malloc(hdrsz);
- memcpy(iHdr, iOrigHdr, sizeof(E32ImageHeaderV));
- iHdr->iExportDescType = edt;
- if (edt == KImageHdr_ExpD_FullBitmap)
- {
- iHdr->iExportDescSize = (TUint16)memsz;
- memcpy(iHdr->iExportDesc, iExportBitMap, memsz);
- }
- else
- {
- iHdr->iExportDescSize = (TUint16)(mbs + nbytes);
- memset(iHdr->iExportDesc, 0, extra_space + 1);
- TUint8* mptr = iHdr->iExportDesc;
- TUint8* gptr = mptr + mbs;
- for (i=0; i<memsz; ++i)
- {
- if (iExportBitMap[i] != 0xff)
- {
- mptr[i>>3] |= (1u << (i&7));
- *gptr++ = iExportBitMap[i];
- }
- }
- }
- iHdr->iCodeOffset += extra_space;
- if (iHdr->iDataOffset)
- iHdr->iDataOffset += extra_space;
- if (iHdr->iCodeRelocOffset)
- iHdr->iCodeRelocOffset += extra_space;
- if (iHdr->iDataRelocOffset)
- iHdr->iDataRelocOffset += extra_space;
- if (iHdr->iImportOffset)
- iHdr->iImportOffset += extra_space;
- if (iHdr->iExportDirOffset)
- iHdr->iExportDirOffset += extra_space;
- }
-
-// Check the export description is consistent with the export directory
-TInt E32ImageFile::CheckExportDescription()
- {
- TUint hdrfmt = iOrigHdr->HeaderFormat();
- if (hdrfmt < KImageHdrFmt_V && iMissingExports)
- return KErrCorrupt;
- if (iHdr->iExportDescType == KImageHdr_ExpD_NoHoles)
- {
- return iMissingExports ? KErrCorrupt : KErrNone;
- }
- TInt nexp = iOrigHdr->iExportDirCount;
- TInt memsz = (nexp + 7) >> 3; // size of complete bitmap
- TInt mbs = (memsz + 7) >> 3; // size of meta-bitmap
- TInt eds = iHdr->iExportDescSize;
- if (iHdr->iExportDescType == KImageHdr_ExpD_FullBitmap)
- {
- if (eds != memsz)
- return KErrCorrupt;
- if (memcmp(iHdr->iExportDesc, iExportBitMap, eds) == 0)
- return KErrNone;
- return KErrCorrupt;
- }
- if (iHdr->iExportDescType != KImageHdr_ExpD_SparseBitmap8)
- return KErrNotSupported;
- TInt nbytes = 0;
- TInt i;
- for (i=0; i<memsz; ++i)
- if (iExportBitMap[i] != 0xff)
- ++nbytes; // number of groups of 8
- TInt exp_extra = mbs + nbytes;
- if (eds != exp_extra)
- return KErrCorrupt;
- const TUint8* mptr = iHdr->iExportDesc;
- const TUint8* gptr = mptr + mbs;
- for (i=0; i<memsz; ++i)
- {
- TUint mbit = mptr[i>>3] & (1u << (i&7));
- if (iExportBitMap[i] != 0xff)
- {
- if (!mbit || *gptr++ != iExportBitMap[i])
- return KErrCorrupt;
- }
- else if (mbit)
- return KErrCorrupt;
- }
- return KErrNone;
- }
-
-
-TInt E32ImageFile::Validate()
- {
- TInt orighdrsz = iOrigHdr->TotalSize();
- TInt r = iHdr->ValidateWholeImage(iData+orighdrsz,iSize-orighdrsz);
- if(r!=KErrNone)
- return r;
- return r;
- }
-
-
-ostream& operator<<(ostream& os, const E32ImageFile& aImage)
-//
-// Output an E32ImageFile
-//
- {
- CBytePair bpe(EFalse);
- E32ImageHeaderV* h = aImage.iHdr;
- TUint hdrfmt = h->HeaderFormat();
- if (hdrfmt != KImageHdrFmt_V)
- return os; // don't generate old binary formats
- TInt hdrsz = h->TotalSize();
- TInt orighdrsz = aImage.iOrigHdr->TotalSize();
-
- os.write((const char*)aImage.iHdr, hdrsz);
-
- TUint compression = h->CompressionType();
- if (compression == KUidCompressionDeflate)
- {
- int srcsize = aImage.iSize - orighdrsz;
- DeflateCompress(aImage.iData + orighdrsz, srcsize, os);
- }
- else if (compression == KUidCompressionBytePair)
- {
- // Compress and write out code part
- int srcStart = orighdrsz;
- CompressPages( (TUint8*)aImage.iData + srcStart, aImage.iOrigHdr->iCodeSize, os, &bpe);
-
-
- // Compress and write out data part
- srcStart += aImage.iOrigHdr->iCodeSize;
- int srcLen = aImage.iSize - srcStart;
- //Print(EWarning," Data part start:0x%08x, len:%d (0x%08x)\n", srcStart, aImage.iOrigHdr->iDataSize, aImage.iOrigHdr->iDataSize);
- //CompressPages((TUint8*)aImage.iData + srcStart, aImage.iOrigHdr->iDataSize, os);
-
- CompressPages((TUint8*)aImage.iData + srcStart, srcLen, os, &bpe);
-
- }
- else if (compression == KFormatNotCompressed)
- {
- int srcsize = aImage.iSize - orighdrsz;
- os.write(aImage.iData + orighdrsz, srcsize); // image not to be compressed
- }
- return os;
- }
-
-ifstream& operator>>(ifstream& is, E32ImageFile& aImage)
-//
-// Input an E32ImageFile
-//
- {
- CBytePair bpe(EFalse);
- aImage.iError = aImage.ReadHeader(is);
- if (aImage.iError != KErrNone)
- return is;
- E32ImageHeader* oh = aImage.iOrigHdr;
- TInt orighdrsz = oh->TotalSize();
- int remainder = aImage.iSize - orighdrsz;
- TUint compression = oh->CompressionType();
- if (compression == 0)
- {
- is.read(aImage.iData + orighdrsz, remainder);
- }
- else if (compression == KUidCompressionDeflate)
- { //Uncompress
- aImage.iError = KErrNoMemory;
- unsigned int uncompsize = ((E32ImageHeaderComp*)aImage.iOrigHdr)->iUncompressedSize;
- aImage.Adjust(uncompsize + orighdrsz);
- if (aImage.iData==NULL)
- return is;
- oh = aImage.iOrigHdr;
- unsigned char* compressedData = new unsigned char[remainder];
- if (compressedData==NULL)
- return is;
- is.read(reinterpret_cast<char *>(compressedData), remainder);
- unsigned int destsize = uncompsize;
- InflateUnCompress( compressedData, remainder, (unsigned char*)(aImage.iData + orighdrsz), destsize);
- if (destsize != uncompsize)
- Print(EWarning, "Inconsistent sizes discovered during uncompression.\n");
- delete [] compressedData;
- if ((TUint)orighdrsz > oh->iCodeOffset)
- {
- // need to adjust code offsets in original
- aImage.iOrigHdrOffsetAdj = (TUint)orighdrsz - oh->iCodeOffset;
- aImage.OffsetAdjust(oh->iCodeOffset);
- aImage.OffsetAdjust(oh->iDataOffset);
- aImage.OffsetAdjust(oh->iCodeRelocOffset);
- aImage.OffsetAdjust(oh->iDataRelocOffset);
- aImage.OffsetAdjust(oh->iImportOffset);
- aImage.OffsetAdjust(oh->iExportDirOffset);
- }
- aImage.iError = KErrNone;
- }
- else if(compression == KUidCompressionBytePair)
- { // Uncompress
- aImage.iError = KErrNoMemory;
- unsigned int uncompsize = ((E32ImageHeaderComp*)aImage.iOrigHdr)->iUncompressedSize;
- aImage.Adjust(uncompsize + orighdrsz);
- if (aImage.iData==NULL)
- return is;
- oh = aImage.iOrigHdr;
-
- // Read and decompress code part of the image
-
- unsigned int uncompressedCodeSize = DecompressPages((TUint8 *) (aImage.iData + orighdrsz), is, &bpe);
-
-
- // Read and decompress data part of the image
-
- unsigned int uncompressedDataSize = DecompressPages((TUint8 *) (aImage.iData + orighdrsz + uncompressedCodeSize), is, &bpe);
-
- if (uncompressedCodeSize + uncompressedDataSize != uncompsize)
- Print(EWarning, "Inconsistent sizes discovered during uncompression.\n");
-
- if ((TUint)orighdrsz > oh->iCodeOffset)
- {
- // need to adjust code offsets in original
- aImage.iOrigHdrOffsetAdj = (TUint)orighdrsz - oh->iCodeOffset;
- aImage.OffsetAdjust(oh->iCodeOffset);
- aImage.OffsetAdjust(oh->iDataOffset);
- aImage.OffsetAdjust(oh->iCodeRelocOffset);
- aImage.OffsetAdjust(oh->iDataRelocOffset);
- aImage.OffsetAdjust(oh->iImportOffset);
- aImage.OffsetAdjust(oh->iExportDirOffset);
- }
- aImage.iError = KErrNone;
- }
- aImage.CreateExportBitMap();
- return is;
- }
-
-TInt E32ImageFile::IsE32ImageFile(char *aFileName)
- {
-
-#ifdef __LINUX__
- E32ImageFile f;
- struct stat buf;
- if (stat(aFileName, &buf) < 0)
- {
- return FALSE;
- }
- f.iFileSize = buf.st_size;
-#else
- _finddata_t fileinfo;
- int ret=_findfirst((char *)aFileName,&fileinfo);
- if (ret==-1)
- return FALSE;
- E32ImageFile f;
- f.iFileSize = fileinfo.size;
-#endif
- ifstream ifile(aFileName, ios::in | ios::binary);
- if(!ifile.is_open())
- return FALSE;
- TInt r = f.ReadHeader(ifile);
- ifile.close();
- return (r == KErrNone);
- }
-
-TInt E32ImageFile::IsValid()
- {
- return (iError == KErrNone);
- }
-
-TInt E32ImageFile::Open(const char* aFileName)
-//
-// Open an E32 Image file
-//
- {
-#ifdef __LINUX__
- struct stat buf;
- if (stat(aFileName, &buf) < 0)
- {
- Print(EError,"Cannot open %s for input.\n",aFileName);
- return 1;
- }
- iFileSize = buf.st_size;
-#else
- _finddata_t fileinfo;
- int ret=_findfirst((char *)aFileName,&fileinfo);
- if (ret==-1)
- {
- Print(EError,"Cannot open %s for input.\n",aFileName);
- return 1;
- }
- iFileSize = fileinfo.size;
-#endif
- Adjust(iFileSize);
- ifstream ifile((char *)aFileName, ios::in | ios::binary);
- if(!ifile.is_open())
- {
- Print(EError,"Cannot open %s for input.\n",aFileName);
- return 1;
- }
- ifile >> *this;
- ifile.close();
- if (iError != KErrNone)
- return iError;
- iFileName=strdup((char *)aFileName);
- if (iFileName==NULL)
- return KErrNoMemory;
- return KErrNone;
- }
-
-#ifndef __LINUX__
-TInt E32ImageFile::Open(const wchar_t* aFileName)
-//
-// Open an E32 Image file
-//
- {
- _wfinddata_t fileinfo;
- int ret=_wfindfirst(aFileName,&fileinfo);
- if (ret==-1)
- {
- Print(EError,"Cannot open %ls for input.\n",aFileName);
- return 1;
- }
- iFileSize = fileinfo.size;
- Adjust(iFileSize);
-
- FILE* file = _wfopen(aFileName, L"rb");
-
- if(!file)
- {
- Print(EError,"Cannot open %ls for input.\n",aFileName);
- return 1;
- }
-
- #ifdef __TOOLS2__
- char *tmp; // Convert wide character name to char *, then open a file.
- wcstombs(tmp,aFileName,100);
- ifstream ifile(tmp, ios::in | ios::binary);
- #else
- ifstream ifile(fileno(file));
- #endif
-
- if(!ifile.is_open())
- {
- Print(EError,"Cannot open %ls for input,\n",aFileName);
- return 1;
- }
-
- ifile >> *this;
- ifile.close();
- fclose(file);
- if (iError != KErrNone)
- return iError;
- iWideFileName=wcsdup(aFileName);
- if (iWideFileName==NULL)
- return KErrNoMemory;
- return KErrNone;
- }
-#endif
-
-TUint E32ImageFile::VaOfOrdinal(TUint aOrdinal)
-// return the offset of the exported symbol
- {
- TUint* exportdir = (TUint*)(iData + iOrigHdr->iExportDirOffset);
- return exportdir[aOrdinal-KOrdinalBase];
- }
-
-// Determine the type of entry point in this module and set the flags
-// in the E32Image header accordingly.
-TInt E32ImageFile::DetermineEntryPointType()
- {
- TUint cpu = iHdr->CpuIdentifier();
- if (cpu != ECpuArmV4 && cpu != ECpuArmV5)
- return KErrNone; // if not ARM, leave EPT as 0
- TUint epOffset = iHdr->iEntryPoint;
- if (epOffset & 3)
- return KErrNone; // if entry point not 4 byte aligned, must be old style
- TUint fileOffset = epOffset + iHdr->iCodeOffset;
- if (fileOffset+4 > (TUint)iSize)
- return KErrCorrupt; // entry point is past the end of the file??
- TInt ept = 0; // old style if first instruction not recognised
- unsigned char* p = (unsigned char*)iData + fileOffset + 4;
- TUint32 x = *--p;
- x<<=8;
- x|=*--p;
- x<<=8;
- x|=*--p;
- x<<=8;
- x|=*--p;
- if ((x & 0xffffff00) == 0xe31f0000)
- {
- // starts with tst pc, #n - new entry point
- ept = (x & 0xff) + 1;
- }
- if (ept>7)
- return KErrNotSupported;
- iHdr->iFlags |= (ept<<KImageEptShift);
- return KErrNone;
- }
-
--- a/e32tools/e32lib/e32image/imgdump.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,512 +0,0 @@
-// Copyright (c) 1996-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:
-// e32tools/e32image/imgdump.cpp
-//
-//
-
-#define __REFERENCE_CAPABILITY_NAMES__
-
-#include <e32image.h>
-#include <h_utl.h>
-#include <string.h>
-
-void PriorityToStr(TProcessPriority aPri, char *aStr)
- {
-
- if (aPri==EPrioritySupervisor)
- strcpy(aStr,"Supervisor");
-
- else if (aPri>EPriorityRealTimeServer)
- sprintf(aStr, "RealTime+%d", aPri-EPriorityRealTimeServer);
- else if (aPri==EPriorityRealTimeServer)
- strcpy(aStr,"RealTime");
-
- else if (aPri>EPriorityFileServer)
- sprintf(aStr, "FileServer+%d", aPri-EPriorityFileServer);
- else if (aPri==EPriorityFileServer)
- strcpy(aStr,"FileServer");
-
- else if (aPri>EPriorityWindowServer)
- sprintf(aStr, "WindowServer+%d", aPri-EPriorityWindowServer);
- else if (aPri==EPriorityWindowServer)
- strcpy(aStr,"WindowServer");
-
- else if (aPri>EPriorityHigh)
- sprintf(aStr, "High+%d", aPri-EPriorityHigh);
- else if (aPri==EPriorityHigh)
- strcpy(aStr,"High");
-
- else if (aPri>EPriorityForeground)
- sprintf(aStr, "Foreground+%d", aPri-EPriorityForeground);
- else if (aPri==EPriorityForeground)
- strcpy(aStr,"Foreground");
-
- else if (aPri>EPriorityBackground)
- sprintf(aStr, "Background+%d", aPri-EPriorityBackground);
- else if (aPri==EPriorityBackground)
- strcpy(aStr,"Background");
-
- else if (aPri>EPriorityLow)
- sprintf(aStr, "Low+%d", aPri-EPriorityLow);
- else if (aPri==EPriorityLow)
- strcpy(aStr,"Low");
-
- else
- sprintf(aStr, "Illegal (%d)", aPri);
- }
-
-void nl()
- {
- Print(EAlways, "\n");
- }
-
-void E32ImageFile::Dump(TText *aFileName,TInt aDumpFlags)
- {
- if (IsValid())
- {
- Print(EAlways, "E32ImageFile '%s'\n", aFileName);
- DumpHeader(aDumpFlags);
- DumpData(aDumpFlags);
- }
- else
- Print(EAlways, "This is not an E32 image file (error %d).\n", iError);
- }
-
-void E32ImageFile::DumpHeader(TInt aDumpFlags)
- {
- TUint flags = iOrigHdr->iFlags;
- TUint abi = E32ImageHeader::ABIFromFlags(flags);
- TUint hdrfmt = E32ImageHeader::HdrFmtFromFlags(flags);
- TUint impfmt = E32ImageHeader::ImpFmtFromFlags(flags);
- TUint ept = E32ImageHeader::EptFromFlags(flags);
- TBool isARM = EFalse;
-
- if(aDumpFlags&EDumpHeader)
- {
- Print(EAlways, "V%d.%02d(%03d)", iOrigHdr->iToolsVersion.iMajor,iOrigHdr->iToolsVersion.iMinor,iOrigHdr->iToolsVersion.iBuild);
- Print(EAlways, "\tTime Stamp: %08x,%08x\n", iOrigHdr->iTimeHi, iOrigHdr->iTimeLo);
- char sig[5];
- memcpy(sig, (const char*)&iOrigHdr->iSignature, 4);
- sig[4]=0;
- Print(EAlways, sig);
- if (iOrigHdr->iFlags&KImageDll)
- Print(EAlways, " Dll for ");
- else
- Print(EAlways, " Exe for ");
- switch (iOrigHdr->CpuIdentifier())
- {
- case ECpuX86:
- Print(EAlways, "X86 CPU\n");
- break;
- case ECpuArmV4:
- isARM = ETrue;
- Print(EAlways, "ARMV4 CPU\n");
- break;
- case ECpuArmV5:
- isARM = ETrue;
- Print(EAlways, "ARMV5 CPU\n");
- break;
- case ECpuMCore:
- Print(EAlways, "M*Core CPU\n");
- break;
- case ECpuUnknown:
- Print(EAlways, "Unknown CPU\n");
- break;
- default:
- Print(EAlways, "something or other\n");
- break;
- }
-
- Print(EAlways, "Flags:\t%08x\n", flags);
-
- if (!(flags & KImageDll))
- {
- char str[80];
- PriorityToStr(iOrigHdr->ProcessPriority(), str);
- Print(EAlways, "Priority %s\n", str);
- if (flags & KImageFixedAddressExe)
- Print(EAlways, "Fixed process\n");
- }
- if (flags & KImageNoCallEntryPoint)
- Print(EAlways, "Entry points are not called\n");
- Print(EAlways, "Image header is format %d\n", hdrfmt>>24);
- TUint compression = iOrigHdr->CompressionType();
- switch (compression)
- {
- case KFormatNotCompressed:
- Print(EAlways, "Image is not compressed\n");
- break;
- case KUidCompressionDeflate:
- Print(EAlways, "Image is compressed using the DEFLATE algorithm\n");
- break;
- case KUidCompressionBytePair:
- Print(EAlways, "Image is compressed using the BYTEPAIR algorithm\n");
- break;
- default:
- Print(EAlways, "Image compression type UNKNOWN (%08x)\n", compression);
- }
- if (compression)
- {
- Print(EAlways, "Uncompressed size %08x\n", iOrigHdr->UncompressedFileSize());
- }
-
- TUint FPU = flags & KImageHWFloatMask;
-
- if (FPU == KImageHWFloat_None)
- Print(EAlways, "Image FPU support : Soft VFP\n");
- else if (FPU == KImageHWFloat_VFPv2)
- Print(EAlways, "Image FPU support : VFPv2\n");
- else
- Print(EAlways, "Image FPU support : Unknown\n");
-
- if (flags & KImageCodeUnpaged)
- {
- Print(EAlways, "Code Paging : Unpaged\n");
- }
- else if (flags & KImageCodePaged)
- {
- Print(EAlways, "Code Paging : Paged\n");
- }
- else
- {
- Print(EAlways, "Code Paging : Default\n");
- }
-
- if (flags & KImageDataUnpaged)
- {
- Print(EAlways, "Data Paging : Unpaged\n");
- }
- else if (flags & KImageDataPaged)
- {
- Print(EAlways, "Data Paging : Paged\n");
- }
- else
- {
- Print(EAlways, "Data Paging : Default\n");
- }
-
- if(flags & KImageDebuggable)
- {
- Print(EAlways, "Debuggable : True\n");
- }
- else
- {
- Print(EAlways, "Debuggable : False\n");
- }
-
- if(flags & KImageSMPSafe)
- {
- Print(EAlways, "SMP Safe : True\n");
- }
- else
- {
- Print(EAlways, "SMP Safe : False\n");
- }
- }
-
- if (hdrfmt >= KImageHdrFmt_V && (aDumpFlags&(EDumpHeader|EDumpSecurityInfo)))
- {
- //
- // Important. Don't change output format of following security info
- // because this is relied on by used by "Symbian Signed".
- //
- E32ImageHeaderV* v = iHdr;
- Print(EAlways, "Secure ID: %08x\n", v->iS.iSecureId);
- Print(EAlways, "Vendor ID: %08x\n", v->iS.iVendorId);
- Print(EAlways, "Capabilities: %08x %08x\n", v->iS.iCaps[1], v->iS.iCaps[0]);
- if(aDumpFlags&EDumpSecurityInfo)
- {
- TInt i;
- for(i=0; i<ECapability_Limit; i++)
- if(v->iS.iCaps[i>>5]&(1<<(i&31)))
- Print(EAlways, " %s\n", CapabilityNames[i]);
- Print(EAlways, "\n");
- }
- }
-
- if(aDumpFlags&EDumpHeader)
- {
- if (hdrfmt >= KImageHdrFmt_V)
- {
- E32ImageHeaderV* v = iHdr;
- TUint32 xd = v->iExceptionDescriptor;
- if ((xd & 1) && (xd != 0xffffffffu))
- {
- xd &= ~1;
- Print(EAlways, "Exception Descriptor Offset: %08x\n", v->iExceptionDescriptor);
- TExceptionDescriptor * aED = (TExceptionDescriptor * )(iData + v->iCodeOffset + xd);
- Print(EAlways, "Exception Index Table Base: %08x\n", aED->iExIdxBase);
- Print(EAlways, "Exception Index Table Limit: %08x\n", aED->iExIdxLimit);
- Print(EAlways, "RO Segment Base: %08x\n", aED->iROSegmentBase);
- Print(EAlways, "RO Segment Limit: %08x\n", aED->iROSegmentLimit);
- }
- else
- Print(EAlways, "No Exception Descriptor\n");
-
- Print(EAlways, "Export Description: Size=%03x, Type=%02x\n", v->iExportDescSize, v->iExportDescType);
- if (v->iExportDescType != KImageHdr_ExpD_NoHoles)
- {
- TInt nb = v->iExportDescSize;
- TInt i;
- TInt j = 0;
- for (i=0; i<nb; ++i)
- {
- if (++j == 8)
- {
- j = 0;
- Print(EAlways,"\n");
- }
- Print(EAlways," %02x", v->iExportDesc[i]);
- }
- Print(EAlways,"\n");
- }
- TInt r = CheckExportDescription();
- if (r == KErrNone)
- Print(EAlways,"Export description consistent\n");
- else if (r == KErrNotSupported)
- Print(EAlways,"Export description type not recognised\n");
- else
- Print(EAlways,"!! Export description inconsistent !!\n");
- }
-
- TUint32 mv = iOrigHdr->ModuleVersion();
- Print(EAlways, "Module Version: %d.%d\n", mv>>16, mv&0xffff);
- if (impfmt == KImageImpFmt_PE)
- {
- Print(EAlways, "Imports are PE-style\n");
- }
- else if (impfmt == KImageImpFmt_ELF)
- {
- Print(EAlways, "Imports are ELF-style\n");
- }
- else if (impfmt == KImageImpFmt_PE2)
- {
- Print(EAlways, "Imports are PE-style without redundant ordinal lists\n");
- }
- if (isARM)
- {
- if (abi == KImageABI_GCC98r2)
- {
- Print(EAlways, "GCC98r2 ABI\n");
- }
- else if (abi == KImageABI_EABI)
- {
- Print(EAlways, "ARM EABI\n");
- }
- if (ept == KImageEpt_Eka1)
- {
- Print(EAlways, "Built against EKA1\n");
- }
- else if (ept == KImageEpt_Eka2)
- {
- Print(EAlways, "Built against EKA2\n");
- }
- }
-
- Print(EAlways, "Uids:\t\t%08x %08x %08x (%08x)\n", iOrigHdr->iUid1, iOrigHdr->iUid2, iOrigHdr->iUid3, iOrigHdr->iUidChecksum);
- if (hdrfmt >= KImageHdrFmt_V)
- Print(EAlways, "Header CRC:\t%08x\n", iHdr->iHeaderCrc);
- Print(EAlways, "File Size:\t%08x\n", iSize);
- Print(EAlways, "Code Size:\t%08x\n", iOrigHdr->iCodeSize);
- Print(EAlways, "Data Size:\t%08x\n", iOrigHdr->iDataSize);
- Print(EAlways, "Compression:\t%08x\n", iOrigHdr->iCompressionType);
- Print(EAlways, "Min Heap Size:\t%08x\n", iOrigHdr->iHeapSizeMin);
- Print(EAlways, "Max Heap Size:\t%08x\n", iOrigHdr->iHeapSizeMax);
- Print(EAlways, "Stack Size:\t%08x\n", iOrigHdr->iStackSize);
- Print(EAlways, "Code link addr:\t%08x\n", iOrigHdr->iCodeBase);
- Print(EAlways, "Data link addr:\t%08x\n", iOrigHdr->iDataBase);
- Print(EAlways, "Code reloc offset:\t%08x\n", OrigCodeRelocOffset());
- Print(EAlways, "Data reloc offset:\t%08x\n", OrigDataRelocOffset());
- Print(EAlways, "Dll ref table count: %d\n", iOrigHdr->iDllRefTableCount);
-
- if (iOrigHdr->iCodeSize || iOrigHdr->iDataSize || iOrigHdr->iBssSize || iOrigHdr->iImportOffset)
- Print(EAlways, " Offset Size Relocs #Relocs\n");
-
- Print(EAlways, "Code %06x %06x", OrigCodeOffset(), iOrigHdr->iCodeSize);
- if (iOrigHdr->iCodeRelocOffset)
- {
- E32RelocSection *r=(E32RelocSection *)(iData + iOrigHdr->iCodeRelocOffset);
- Print(EAlways, " %06x %06x", OrigCodeRelocOffset(), r->iNumberOfRelocs);
- }
- else
- Print(EAlways, " ");
- Print(EAlways, " +%06x (entry pnt)", iOrigHdr->iEntryPoint);
- nl();
-
- Print(EAlways, "Data %06x %06x", OrigDataOffset(), iOrigHdr->iDataSize);
- if (iOrigHdr->iDataRelocOffset)
- {
- E32RelocSection *r=(E32RelocSection *)(iData + iOrigHdr->iDataRelocOffset);
- Print(EAlways, " %06x %06x", OrigDataRelocOffset(), r->iNumberOfRelocs);
- }
- nl();
-
- Print(EAlways, "Bss %06x\n", iOrigHdr->iBssSize);
-
- if (iOrigHdr->iExportDirOffset)
- Print(EAlways, "Export %06x %06x (%d entries)\n", OrigExportDirOffset(), iOrigHdr->iExportDirCount*4, iOrigHdr->iExportDirCount);
- if (iOrigHdr->iImportOffset)
- Print(EAlways, "Import %06x\n", OrigImportOffset());
- }
- }
-
-void dump(TUint *aData, TInt aLength)
- {
- TUint *p=aData;
- TInt i=0;
- char line[256];
- char *cp=(char*)aData;
- TInt j=0;
- memset(line,' ',sizeof(line));
- while (i<aLength)
- {
- TInt ccount=0;
- char* linep=&line[8*9+2];
- Print(EAlways, "%06x:", i);
- while (i<aLength && ccount<8)
- {
- Print(EAlways," %08x", *p++);
- i+=4;
- ccount++;
- for (j=0; j<4; j++)
- {
- unsigned char c=*cp++;
- if (c<32 || c>127)
- {
- c = '.';
- }
- *linep++ = c;
- }
- }
- *linep='\0';
- Print(EAlways, "%s", line+(ccount*9));
- nl();
- }
- }
-
-void dumprelocs(char *aRelocs)
- {
-
- TInt num=((E32RelocSection *)aRelocs)->iNumberOfRelocs;
- Print(EAlways, "%d relocs\n", num);
- aRelocs+=sizeof(E32RelocSection);
- TInt printed=0;
- while (num>0)
- {
- TInt page=*(TUint *)aRelocs;
- TInt size=*(TUint *)(aRelocs+4);
- TInt pagesize=size;
- size-=8;
- TUint16 *p=(TUint16 *)(aRelocs+8);
- while (size>0)
- {
- TUint a=*p++;
- TUint relocType = a >> 12;
- if (relocType==3 || relocType==1)
- {
- Print(EAlways, "%08x(%1x) ", page+(a&0x0fff), relocType);
- printed++;
- if (printed>3)
- {
- nl();
- printed=0;
- }
- }
- size-=2;
- num--;
- }
- aRelocs+=pagesize;
- }
- nl();
- }
-
-
-void E32ImageFile::DumpData(TInt aDumpFlags)
- {
- if(aDumpFlags&EDumpCode)
- {
- Print(EAlways, "\nCode (text size=%08x)\n", iOrigHdr->iTextSize);
- dump((TUint *)(iData + iOrigHdr->iCodeOffset), iOrigHdr->iCodeSize);
- if (iOrigHdr->iCodeRelocOffset)
- dumprelocs(iData + iOrigHdr->iCodeRelocOffset);
- }
-
- if((aDumpFlags&EDumpData) && iOrigHdr->iDataOffset)
- {
- Print(EAlways, "\nData\n");
- dump((TUint *)(iData + iOrigHdr->iDataOffset), iOrigHdr->iDataSize);
- if (iOrigHdr->iDataRelocOffset)
- dumprelocs(iData + iOrigHdr->iDataRelocOffset);
- }
-
- if(aDumpFlags&EDumpExports)
- {
- Print(EAlways, "\nNumber of exports = %d\n", iOrigHdr->iExportDirCount);
- TInt i;
- TUint* exports = (TUint*)(iData + iOrigHdr->iExportDirOffset);
- TUint absoluteEntryPoint = iOrigHdr->iEntryPoint + iOrigHdr->iCodeBase;
- TUint impfmt = iOrigHdr->ImportFormat();
- TUint absentVal = (impfmt == KImageImpFmt_ELF) ? absoluteEntryPoint : iOrigHdr->iEntryPoint;
- for (i=0; i<iOrigHdr->iExportDirCount; ++i)
- {
- TUint exp = exports[i];
- if (exp == absentVal)
- Print(EAlways, "\tOrdinal %5d:\tABSENT\n", i+1);
- else
- Print(EAlways, "\tOrdinal %5d:\t%08x\n", i+1, exp);
- }
- }
-
- //
- // Important. Don't change output format of following inport info
- // because this is relied on by tools used by "Symbian Signed".
- //
- if((aDumpFlags&EDumpImports) && iOrigHdr->iImportOffset)
- {
- const E32ImportSection* isection = (const E32ImportSection*)(iData + iOrigHdr->iImportOffset);
- TUint* iat = (TUint*)((TUint8*)iData + iOrigHdr->iCodeOffset + iOrigHdr->iTextSize);
- Print(EAlways, "\nIdata\tSize=%08x\n", isection->iSize);
- Print(EAlways, "Offset of import address table (relative to code section): %08x\n", iOrigHdr->iTextSize);
- TInt d;
- const E32ImportBlock* b = (const E32ImportBlock*)(isection + 1);
- for (d=0; d<iOrigHdr->iDllRefTableCount; d++)
- {
- char* dllname = iData + iOrigHdr->iImportOffset + b->iOffsetOfDllName;
- TInt n = b->iNumberOfImports;
- Print(EAlways, "%d imports from %s\n", b->iNumberOfImports, dllname);
- const TUint* p = b->Imports();
- TUint impfmt = iOrigHdr->ImportFormat();
- if (impfmt == KImageImpFmt_ELF)
- {
- while (n--)
- {
- TUint impd_offset = *p++;
- TUint impd = *(TUint*)(iData + iOrigHdr->iCodeOffset + impd_offset);
- TUint ordinal = impd & 0xffff;
- TUint offset = impd >> 16;
- if (offset)
- Print(EAlways, "%10d offset by %d\n", ordinal, offset);
- else
- Print(EAlways, "%10d\n", ordinal);
- }
- }
- else
- {
- while (n--)
- Print(EAlways, "\t%d\n", *iat++);
- }
- b = b->NextBlock(impfmt);
- }
- }
- }
--- a/e32tools/e32lib/e32image/inc/e32image.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-// Copyright (c) 1996-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:
-//
-
-#ifndef __E32IMAGE_H__
-#define __E32IMAGE_H__
-
-#if defined(__MSVCDOTNET__) || defined(__TOOLS2__)
-#include <fstream>
-using namespace std;
-#else //!__MSVCDOTNET__
-#include <fstream.h>
-#endif //__MSVCDOTNET__
-
-#include <e32std.h>
-#include <e32ldr.h>
-#include <f32image.h>
-
-enum TFileSource
- {
- EE32Image=0,
- EPeFile=1,
- EElfFile=2,
- };
-
-class E32ImageFile
- {
-public:
- static E32ImageFile* New();
- E32ImageFile();
- virtual ~E32ImageFile();
- virtual TBool Translate(const char* aFileName, TUint aDataBase, TBool aAllowDllData, TBool aSymLkupEnabled = FALSE);
- TInt ReadHeader(ifstream& is);
- TInt Open(const char* aFileName);
-#ifndef __LINUX__
- TInt Open(const wchar_t* aFileName);
-#endif
- void Adjust(TInt aSize, TBool aAllowShrink=ETrue);
- TUint VaOfOrdinal(TUint aOrdinal);
- void RelocateSection(char* aPtr, char *aRelocs, TUint aCodeDelta, TUint aDataDelta, char* aImagePtr, TLinAddr** aIATRefs, TBool keepIAT=EFalse);
- //
- TUint TextOffset();
- TUint DataOffset();
- TUint BssOffset();
- TUint32 Capability();
- TUint32 Format();
- TInt NumberOfImports();
-
- TInt IsValid();
- TInt IsDll();
- enum TDumpFlags
- {
- EDumpHeader = 1<<0,
- EDumpSecurityInfo = 1<<1,
- EDumpCode = 1<<2,
- EDumpData = 1<<3,
- EDumpExports = 1<<4,
- EDumpImports = 1<<5,
- EDumpDefaults = EDumpHeader|EDumpCode|EDumpData|EDumpExports|EDumpImports
- };
- void Dump(TText *aFileName,TInt aDumpFlags);
- void DumpHeader(TInt aDumpFlags);
- void DumpData(TInt aDumpFlags);
- void SetStackSize(TInt aSize);
- void SetHeapSizeMin(TInt aSize);
- void SetHeapSizeMax(TInt aSize);
- void SetUids(TUid aUid1, TUid aUid2, TUid aUid3);
- void SetSecureId(TUint32 aId);
- void SetVendorId(TUint32 aId);
- void SetCallEntryPoints(TInt aBool);
- void SetFixedAddress(TInt aBool);
- void SetPriority(TProcessPriority aPri);
- void SetCapability(SCapabilitySet& aCapabilities);
- void SetFPU(unsigned int aFPU);
- static TInt IsE32ImageFile(char *aFileName);
- TInt DetermineEntryPointType();
- void UpdateHeaderCrc();
- void SetDefaultHeader();
- void CreateExportBitMap();
- void AddExportDescription();
- TInt CheckExportDescription();
- TInt Validate();
-public:
- inline TUint OrigCodeOffset() const {return OffsetUnadjust(iOrigHdr->iCodeOffset);}
- inline TUint OrigDataOffset() const {return OffsetUnadjust(iOrigHdr->iDataOffset);}
- inline TUint OrigCodeRelocOffset() const {return OffsetUnadjust(iOrigHdr->iCodeRelocOffset);}
- inline TUint OrigDataRelocOffset() const {return OffsetUnadjust(iOrigHdr->iDataRelocOffset);}
- inline TUint OrigImportOffset() const {return OffsetUnadjust(iOrigHdr->iImportOffset);}
- inline TUint OrigExportDirOffset() const {return OffsetUnadjust(iOrigHdr->iExportDirOffset);}
- inline TUint OffsetUnadjust(TUint a) const {return a ? a-iOrigHdrOffsetAdj : 0;}
- inline void OffsetAdjust(TUint& a) { if (a) a+=iOrigHdrOffsetAdj; }
-public:
- char* iData;
- TInt iSize;
- E32ImageHeader* iOrigHdr;
- E32ImageHeaderV* iHdr;
- char* iFileName;
-#ifndef __LINUX__
- wchar_t* iWideFileName;
-#endif
- TInt iError;
- TFileSource iSource;
- TUint iOrigHdrOffsetAdj;
- TInt iFileSize;
- TUint8* iExportBitMap;
- TInt iMissingExports;
- };
-
-#ifdef __VC32__
-ostream &operator<<(ostream &os, const E32ImageFile &aImage);
-#else
-ostream &operator<<(ostream &os, const E32ImageFile &aImage);
-#endif
-ifstream &operator>>(ifstream &is, E32ImageFile &aImage);
-
-#endif
--- a/e32tools/e32lib/e32image/inc/h_utl.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,216 +0,0 @@
-// Copyright (c) 1995-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:
-//
-
-#if !defined(__H_UTL_H__)
-#define __H_UTL_H__
-//
-#include <stdio.h>
-
-#ifdef __VC32__
- #ifdef __MSVCDOTNET__
- #include <iostream>
- #include <strstream>
- #include <fstream>
- using namespace std;
- #else //!__MSVCDOTNET__
- #include <iostream.h>
- #include <strstrea.h>
- #include <fstream.h>
- #endif //__MSVCDOTNET__
-#else //!__VC32__
-#ifdef __TOOLS2__
-#include <fstream>
-#include <iostream>
-#include <sstream>
-#include <iomanip>
-using namespace std;
-#else // !__TOOLS2__ OR __VC32__ OR __MSVCDOTNET__
- #include <iostream.h>
- #include <strstream.h>
- #include <fstream.h>
-#endif
-#endif
-
-#ifdef __LINUX__
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
-#include <ctype.h>
-
-
-#define _close close
-#define _filelength filelength
-#define _lseek lseek
-#define _read read
-#define _snprintf snprintf
-#define _vsnprintf vsnprintf
-
-// linux case insensitive stromg comparisons have different names
-#define stricmp strcasecmp
-#define _stricmp strcasecmp
-#define strnicmp strncasecmp
-
-// to fix the linux problem: memcpy does not work with overlapped areas.
-#define memcpy memmove
-
-// hand-rolled strupr function for converting a string to all uppercase
-char* strupr(char *a);
-
-// return the length of a file
-off_t filelength (int filedes);
-#endif
-
-
-#include <e32cmn.h>
-#include <e32def.h>
-#include <e32def_private.h>
-
-#define ALIGN4K(a) ((a+0xfff)&0xfffff000)
-#define ALIGN4(a) ((a+0x3)&0xfffffffc)
-
-
-#ifdef HEAPCHK
-#define NOIMAGE
-#define WIN32_LEAN_AND_MEAN
-#include <windows.h>
-void HeapCheck();
-#endif
-#define Print H.PrintString
-//
-const TInt KMaxStringLength=0x400;
-//
-class HFile
- {
-public:
- static TBool Open(const TText * const aFileName, TInt32 * const aFileHandle);
- static TBool Read(const TInt32 aFileHandle, TAny * const aBuffer, const TUint32 aCount);
- static TBool Seek(const TInt32 aFileHandle, const TUint32 aOffset);
- static TUint32 GetPos(const TInt32 aFileHandle);
- static TAny Close(const TInt32 aFileHandle);
- static TUint32 GetLength(const TInt32 aFileHandle);
- static TUint32 GetLength(TText *aName);
- static TUint32 Read(TText *aName, TAny *someMem);
- };
-//
-//inline TAny* operator new(TUint /*aSize*/, TAny* aBase)
-// {return aBase;}
-
-class HMem
- {
-public:
- static TAny *Alloc(TAny * const aBaseAddress,const TUint32 aImageSize);
- static void Free(TAny * const aMem);
- static void Copy(TAny * const aDestAddr,const TAny * const aSourceAddr,const TUint32 aLength);
- static void Move(TAny * const aDestAddr,const TAny * const aSourceAddr,const TUint32 aLength);
- static void Set(TAny * const aDestAddr, const TUint8 aFillChar, const TUint32 aLength);
- static void FillZ(TAny * const aDestAddr, const TUint32 aLength);
-
- static TUint CheckSum(TUint *aPtr, TInt aSize);
- static TUint CheckSum8(TUint8 *aPtr, TInt aSize);
- static TUint CheckSumOdd8(TUint8 *aPtr, TInt aSize);
- static TUint CheckSumEven8(TUint8 *aPtr, TInt aSize);
-
- static void Crc32(TUint32& aCrc, const TAny* aPtr, TInt aLength);
- };
-//
-enum TPrintType {EAlways, EScreen, ELog, EWarning, EError, EPeError, ESevereError, EDiagnostic};
-//
-class HPrint
- {
-public:
- ~HPrint();
- void SetLogFile(TText *aFileName);
- void CloseLogFile(); // Added to close intermediate log files.
- TInt PrintString(TPrintType aType,const char *aFmt,...);
-public:
- TText iText[KMaxStringLength];
- TBool iVerbose;
-private:
- ofstream iLogFile;
- };
-//
-extern HPrint H;
-extern TBool PVerbose;
-//
-TAny *operator new(TUint aSize);
-void operator delete(TAny *aPtr);
-//
-#ifdef __TOOLS2__
-istringstream &operator>>(istringstream &is, TVersion &aVersion);
-#else
-istrstream &operator>>(istrstream &is, TVersion &aVersion);
-#endif
-//
-TInt StringToTime(TInt64 &aTime, char *aString);
-
-void ByteSwap(TUint &aVal);
-void ByteSwap(TUint16 &aVal);
-void ByteSwap(TUint *aPtr, TInt aSize);
-
-extern TBool gLittleEndian;
-
-
-/**
- Convert string to number.
-*/
-template <class T>
-TInt Val(T& aVal, char* aStr)
- {
-
- T x;
- #ifdef __TOOLS2__
- istringstream val(aStr);
- #else
- istrstream val(aStr,strlen(aStr));
- #endif
- #if defined(__MSVCDOTNET__) || defined (__TOOLS2__)
- val >> setbase(0);
- #endif //__MSVCDOTNET__
- val >> x;
- if (!val.eof() || val.fail())
- return KErrGeneral;
- aVal=x;
- return KErrNone;
- }
-
-// Filename decompose routines
-enum TDecomposeFlag
- {
- EUidPresent=1,
- EVerPresent=2
- };
-
-class TFileNameInfo
- {
-public:
- TFileNameInfo(const char* aFileName, TBool aLookForUid);
-public:
- const char* iFileName;
- TInt iTotalLength;
- TInt iBaseLength;
- TInt iExtPos;
- TUint32 iUid3;
- TUint32 iModuleVersion;
- TUint32 iFlags;
- };
-
-extern char* NormaliseFileName(const char* aName);
-extern char* SplitFileName(const char* aName, TUint32& aUid, TUint32& aModuleVersion, TUint32& aFlags);
-extern char* SplitFileName(const char* aName, TUint32& aModuleVersion, TUint32& aFlags);
-extern TInt ParseCapabilitiesArg(SCapabilitySet& aCapabilities, const char *aText);
-extern TInt ParseBoolArg(TBool& aValue, const char *aText);
-
-#endif
-
--- a/e32tools/e32lib/e32image/inc/h_ver.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-// Copyright (c) 1996-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:
-//
-
-#ifndef __H_VER_H__
-#define __H_VER_H__
-const TInt MajorVersion=2;
-const TInt MinorVersion=1;
-const TInt Build=600;
-#endif
-
--- a/e32tools/e32lib/e32image/inc/seclib.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-// 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:
-// e32tools/inc/seclib.h
-// Get the capabilities of an emulator / e32image.
-// Image security information structure.
-//
-//
-
-/**
- @internalTechnology
- @prototype
-*/
-struct SBinarySecurityInfo
- {
- TUint32 iSecureId;
- TUint32 iVendorId;
- TUint8 iCapabilities[KCapabilitySetMaxSize];
- TBool iE32Image;
- };
-
-/**
- * Extracts security information from an image.
- *
- * @internalTechnology
- * @prototype
- */
-TInt GetSecurityInfo(const char* aFileName, SBinarySecurityInfo& aInfo);
-#ifndef __LINUX__
-TInt GetSecurityInfo(const wchar_t* aFileName, SBinarySecurityInfo& aInfo);
-#endif
--- a/e32tools/e32lib/e32image/tr_main.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,997 +0,0 @@
-// Copyright (c) 1996-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:
-// e32tools/e32image/tr_main.cpp
-// Translate X->E32Image top level
-//
-//
-
-#ifndef __LINUX__
- #include <io.h>
-#endif
-#include <string.h>
-
-#ifdef __VC32__
- #ifdef __MSVCDOTNET__
- #include <strstream>
- #include <iomanip>
- #else //!__MSVCDOTNET__
- #include <strstrea.h>
- #include <iomanip.h>
- #endif //__MSVCDOTNET__
-#else // !__VC32__*/
-#ifdef __TOOLS2__
- #include <sstream>
- #include <iomanip>
- #else
- #include <strstream.h>
- #include <iomanip.h>
-#endif // __VC32__
-#endif
-
-#include <e32std.h>
-
-#ifdef __SUPPORT_PE_FILES__
-#include "pe_file.h"
-#endif
-#ifdef __SUPPORT_ELF_FILES__
-#include "elftran.h"
-#endif
-
-#include <h_utl.h>
-#include <h_ver.h>
-#include <stdio.h>
-
-extern int gAlignConstSection;
-extern TUint gConstSectionAddressMask;
-
-int gVerbose=0;
-char *gFile1=NULL;
-char *gFile2=NULL;
-unsigned int gStack=0;
-unsigned int gHeapMin=0;
-unsigned int gHeapMax=0;
-TUid gUid1=KNullUid;
-TUid gUid2=KNullUid;
-TUid gUid3=KNullUid;
-unsigned int gSecureId=0;
-unsigned int gVendorId=0;
-unsigned int gVersionWord=0x00010000u;
-int gCallEntryPoints=TRUE;
-int gFixedAddress=FALSE;
-int gPriority=EPriorityForeground;
-SCapabilitySet gCapability={0};
-int gAllowDllData=FALSE;
-// fix warning for Linux warning: 0 instead of NULL
-TUint gDataBase=0;
-int gCompress=TRUE;
-unsigned int gFPU=0;
-
-int gCodePaged=FALSE;
-int gCodeUnpaged=FALSE;
-int gCodeDefaultPaged=FALSE;
-
-int gDataPaged=FALSE;
-int gDataUnpaged=FALSE;
-int gDataDefaultPaged=FALSE;
-
-int gDebuggable=FALSE;
-int gSmpSafe=FALSE;
-
-int gSetStack=FALSE;
-int gSetHeap=FALSE;
-int gSetUid1=FALSE;
-int gSetUid2=FALSE;
-int gSetUid3=FALSE;
-int gSetCallEntryPoints=FALSE;
-int gSetFixedAddress=FALSE;
-int gSetPriority=FALSE;
-int gSetCapability=FALSE;
-int gSetCompress=FALSE;
-int gSetVersion=FALSE;
-int gSetSecureId=FALSE;
-int gSetVendorId=FALSE;
-int gSetFPU=FALSE;
-
-int gSetCodePaged=FALSE;
-int gSetDataPaged=FALSE;
-
-int gSetSymLkup=FALSE;
-int gSetDebuggable=FALSE;
-int gSetSmpSafe=FALSE;
-
-enum CompressionMethods
-{
- ENoCompression = 0,
- EDeflate = 1,
- EBytePair = 2,
-};
-
-int gCompressionMethod = EDeflate;
-int gSuppressComprMethod = FALSE;
-
-#ifdef __SUPPORT_PE_FILES__
-char* gX86imp=NULL;
-int gX86num_imp_dlls=0;
-int gX86imp_size=0;
-int gX86num_imports=0;
-#endif
-
-TBool gLittleEndian=ETrue;
-
-class E32ImageFileRef
- {
-public:
- E32ImageFileRef() {iPtr = E32ImageFile::New();}
- ~E32ImageFileRef() {delete iPtr;}
- class E32ImageFile& Ref() {return *iPtr;}
-private:
- E32ImageFileRef(const E32ImageFileRef&);
- E32ImageFileRef& operator=(const E32ImageFileRef&);
-private:
- E32ImageFile* iPtr;
- };
-
-int setPagedFlags(E32ImageFile& f)
- {
- unsigned check1 = gCodePaged + gCodeUnpaged + gCodeDefaultPaged;
- unsigned check2 = gDataPaged + gDataUnpaged + gDataDefaultPaged;
-
- if (check1 > 1 || check2 > 1)
- {
- Print(EError, "Conflicting paging options.\n");
- return KErrArgument;
- }
-
- if (gCodePaged)
- {
- f.iHdr->iFlags |= KImageCodePaged;
- f.iHdr->iFlags &= ~KImageCodeUnpaged;
- }
- else if (gCodeUnpaged)
- {
- f.iHdr->iFlags |= KImageCodeUnpaged;
- f.iHdr->iFlags &= ~KImageCodePaged;
- }
- else if (gCodeDefaultPaged)
- {
- f.iHdr->iFlags &= ~KImageCodePaged;
- f.iHdr->iFlags &= ~KImageCodeUnpaged;
- }
-
- if (gDataPaged)
- {
- f.iHdr->iFlags |= KImageDataPaged;
- f.iHdr->iFlags &= ~KImageDataUnpaged;
- }
- else if (gDataUnpaged)
- {
- f.iHdr->iFlags |= KImageDataUnpaged;
- f.iHdr->iFlags &= ~KImageDataPaged;
- }
- else if (gDataDefaultPaged)
- {
- f.iHdr->iFlags &= ~KImageDataPaged;
- f.iHdr->iFlags &= ~KImageDataUnpaged;
- }
-
- return KErrNone;
- }
-
-void setDebuggableFlags(E32ImageFile& f)
- {
- if (gDebuggable)
- {
- f.iHdr->iFlags |= KImageDebuggable;
- }
- else
- {
- f.iHdr->iFlags &= ~KImageDebuggable;
- }
- }
-
-void setSmpSafeFlags(E32ImageFile& f)
- {
- if (gSmpSafe)
- {
- f.iHdr->iFlags |= KImageSMPSafe;
- }
- else
- {
- f.iHdr->iFlags &= ~KImageSMPSafe;
- }
- }
-
-int dotran(const char* ifilename, const char* ofilename)
- {
- E32ImageFileRef fRef;
- E32ImageFile& f = fRef.Ref();
- int r=f.Translate(ifilename, gDataBase, gAllowDllData, gSetSymLkup);
- if (r!=KErrNone)
- return r;
- if (gSetStack)
- f.SetStackSize(gStack);
- if (gSetHeap)
- {
- f.SetHeapSizeMin(gHeapMin);
- f.SetHeapSizeMax(gHeapMax);
- }
- if (!gSetUid1)
- gUid1=TUid::Uid(f.iHdr->iUid1);
- if (!gSetUid2)
- gUid2=TUid::Uid(f.iHdr->iUid2);
- if (!gSetUid3)
- gUid3=TUid::Uid(f.iHdr->iUid3);
- if (!gSetSecureId)
- gSecureId = f.iHdr->iUid3;
- if (!gSetVendorId)
- gVendorId = 0;
- f.SetUids(gUid1, gUid2, gUid3);
- f.SetSecureId(gSecureId);
- f.SetVendorId(gVendorId);
- if (gSetCallEntryPoints)
- f.SetCallEntryPoints(gCallEntryPoints);
- if (gSetCapability)
- f.SetCapability(gCapability);
- if (gSetPriority)
- {
- if (f.iHdr->iFlags&KImageDll)
- Print(EWarning,"Cannot set priority of a DLL.\n");
- else
- f.SetPriority((TProcessPriority)gPriority);
- }
- if (gSetFixedAddress)
- {
- if (f.iHdr->iFlags&KImageDll)
- Print(EWarning,"Cannot set fixed address for DLL.\n");
- else
- f.SetFixedAddress(gFixedAddress);
- }
- if (gSetVersion)
- f.iHdr->iModuleVersion = gVersionWord;
-
- if(gCompress)
- {
- switch(gCompressionMethod)
- {
- case ENoCompression:
- f.iHdr->iCompressionType = KFormatNotCompressed;
- break;
-
- case EDeflate:
- f.iHdr->iCompressionType = KUidCompressionDeflate;
-
- break;
-
- case EBytePair:
- f.iHdr->iCompressionType = KUidCompressionBytePair;
-
- break;
-
- default:
- Print(EError, "Unknown compression method:%d", gCompressionMethod);
- return 1;
-
- } // End of switch()
-
- }
- else
- {
- f.iHdr->iCompressionType = KFormatNotCompressed;
- }
-
-
- if (gSetFPU)
- f.SetFPU(gFPU);
-
- r = setPagedFlags(f);
- if (r != KErrNone)
- {
- return r;
- }
-
- setDebuggableFlags(f);
-
- setSmpSafeFlags(f);
-
- f.CreateExportBitMap();
- f.AddExportDescription();
- f.UpdateHeaderCrc();
- r = f.Validate();
- if (r!=KErrNone)
- return r;
-
- ofstream ofile(ofilename, ios::binary);
- if (!ofile)
- {
- Print(EError,"Cannot open %s for output.\n",ofilename);
- return 1;
- }
- ofile << f;
- ofile.close();
- if (gVerbose)
- f.Dump((TText*)ofilename,gVerbose);
- return KErrNone;
- }
-
-
-int dodump(const char* ifilename)
- {
- E32ImageFile f;
- TInt r = f.Open(ifilename);
- if (r>0)
- return 1;
- else if (r==KErrCorrupt || r==KErrNotSupported)
- {
- Print(EError,"%s is not a valid E32Image file.\n",ifilename);
- return 1;
- }
- else if (r!=0)
- {
- Print(EError,"Error %d reading %s.\n",r,ifilename);
- return 1;
- }
- f.Dump((TText*)ifilename, gVerbose ? gVerbose : E32ImageFile::EDumpDefaults);
- return KErrNone;
- }
-
-int doalter(const char* ifilename)
- {
- E32ImageFile f;
- TInt r = f.Open(ifilename);
- if (r>0)
- return 1;
- else if (r==KErrCorrupt || r==KErrNotSupported)
- {
- Print(EError,"%s is not a valid E32Image file.\n",ifilename);
- return 1;
- }
- else if (r!=0)
- {
- Print(EError,"Error %d reading %s.\n",r,ifilename);
- return 1;
- }
-
- TUint hdrfmt = f.iHdr->HeaderFormat();
- if (hdrfmt != KImageHdrFmt_V)
- {
- Print(EError,"Can't modify old format binaries\n");
- return 1;
- }
-
- if (gDataBase)
- {
- Print(EWarning, "Ignoring -datalinkaddress Switch");
- }
- if (gSetStack)
- f.SetStackSize(gStack);
- if (gSetHeap)
- {
- f.SetHeapSizeMin(gHeapMin);
- f.SetHeapSizeMax(gHeapMax);
- }
- if (!gSetUid1)
- gUid1=TUid::Uid(f.iHdr->iUid1);
- if (!gSetUid2)
- gUid2=TUid::Uid(f.iHdr->iUid2);
- if (!gSetUid3)
- gUid3=TUid::Uid(f.iHdr->iUid3);
- f.SetUids(gUid1, gUid2, gUid3);
- if (gSetSecureId)
- f.SetSecureId(gSecureId);
- if (gSetVendorId)
- f.SetVendorId(gVendorId);
- if (gSetCallEntryPoints)
- f.SetCallEntryPoints(gCallEntryPoints);
- if (gSetCapability)
- f.SetCapability(gCapability);
- if (gSetPriority)
- {
- if (f.iHdr->iFlags&KImageDll)
- Print(EWarning,"Cannot set priority of a DLL.\n");
- else
- f.SetPriority((TProcessPriority)gPriority);
- }
- if (gSetFixedAddress)
- {
- if (f.iHdr->iFlags&KImageDll)
- Print(EWarning,"Cannot set fixed address for DLL.\n");
- else
- f.SetFixedAddress(gFixedAddress);
- }
- if (gSetVersion)
- f.iHdr->iModuleVersion = gVersionWord;
-
- if(gCompress)
- {
- switch(gCompressionMethod)
- {
- case ENoCompression:
- f.iHdr->iCompressionType = KFormatNotCompressed;
- break;
-
- case EDeflate:
- f.iHdr->iCompressionType = KUidCompressionDeflate;
-
- break;
-
- case EBytePair:
- f.iHdr->iCompressionType = KUidCompressionBytePair;
-
- break;
-
- default:
- Print(EError, "Unknown compression method:%d", gCompressionMethod);
- return 1;
-
- } // End of switch()
- }
- else
- f.iHdr->iCompressionType = KFormatNotCompressed;
-
- if (gSetFPU)
- f.SetFPU(gFPU);
-
- r = setPagedFlags(f);
- if (r != KErrNone)
- {
- return r;
- }
-
- setDebuggableFlags(f);
-
- setSmpSafeFlags(f);
-
- f.UpdateHeaderCrc();
- r = f.Validate();
- if (r!=KErrNone)
- return r;
-
- ofstream ofile(ifilename, ios::binary);
- if (!ofile)
- {
- Print(EError,"Cannot open %s for output.\n",ifilename);
- return 1;
- }
- ofile << f;
- ofile.close();
- if (gVerbose)
- f.Dump((TText *)ifilename,gVerbose);
- return KErrNone;
- }
-
-int helpme(char *aStr)
- {
- Print(EAlways,"Syntax: %s [options] inputfile outputfile\n",aStr);
- Print(EAlways," %s [options] e32imagefile\n",aStr);
- Print(EAlways,"option: [-v] [[-no]call[entrypoint]] [-priority <priority>]\n");
- Print(EAlways," [-stack <size>] [-heap <min> <max>] [-uid<n> <uid>]\n");
- Print(EAlways," [-allowdlldata] [-datalinkaddress <base>] [-fixed] [-moving]\n");
- Print(EAlways," [-align-const-section] [-const-section-address-mask <mask>]\n");
- Print(EAlways," [-[no]compress] [-compressionmethod none|deflate|bytepair]\n");
- Print(EAlways," [-capability \"<list>\"] [-version M.m] [-vid <id>]\n");
- Print(EAlways," [-fpu <softvfp|vfpv2>]\n");
- Print(EAlways," [-codepaging <paged|unpaged|default>]\n");
- Print(EAlways," [-datapaging <paged|unpaged|default>]\n");
- Print(EAlways," [-debuggable]\n");
- Print(EAlways," [-smpsafe]\n");
- Print(EAlways," [-sym_name_lkup]\n");
- Print(EAlways," [-dump [h][s][c][d][e][i]]\n");
- Print(EAlways,"flags for dump: h Header\n");
- Print(EAlways," s Security info\n");
- Print(EAlways," c Code section\n");
- Print(EAlways," d Data section\n");
- Print(EAlways," e Export info\n");
- Print(EAlways," i Import table\n");
- return KErrArgument;
- }
-
-int isNumber(char *aStr)
- {
- return (aStr[0]>='0') && (aStr[0]<='9');
- }
-
-int getUIntArg(unsigned int &aVal, int argc, char *argv[], int i)
- {
- if (i>=argc)
- return KErrArgument;
- if (!isNumber(argv[i]))
- return KErrArgument;
-#ifdef __LINUX__
- int n;
- sscanf(argv[i], "%i", &n);
- aVal = n;
-#else
-#ifdef __TOOLS2__
-istringstream s(argv[i]/*, strlen(argv[i])*/);
-#else
-istrstream s(argv[i], strlen(argv[i]));
-#endif
-
-#if defined(__MSVCDOTNET__) || defined(__TOOLS2__)
- s >> setbase(0);
-#endif //__MSVCDOTNET__
-
- s >> aVal;
-#endif // __LINUX__
- return KErrNone;
- }
-
-int getCapabilitiesArg(SCapabilitySet& aVal, int argc, char *argv[], int i)
- {
- memset(&aVal,0,sizeof(aVal));
- if (i>=argc)
- return KErrArgument;
- if (isNumber(argv[i]))
- return getUIntArg(*(TUint*)&aVal[0], argc, argv, i);
- return ParseCapabilitiesArg(aVal,argv[i]);
- }
-
-int getPriorityArg(int &aVal, int argc, char *argv[], int i)
- {
-
- if (i>=argc)
- return KErrArgument;
- if (isNumber(argv[i]))
- {
-#ifdef __LINUX__
- int n;
- sscanf(argv[i], "%i", &n);
- aVal = n;
-#else
-#ifdef __TOOLS2__
-istringstream s(argv[i]);
-#else
-istrstream s(argv[i], strlen(argv[i]));
-#endif
-
-#if defined(__MSVCDOTNET__) || defined(__TOOLS2__)
- s >> setbase(0);
-#endif //__MSVCDOTNET__
-
- s>>aVal;
-#endif // __LINUX__
- }
- else
- {
- if (stricmp(argv[i], "low")==0)
- aVal=EPriorityLow;
- else if (strnicmp(argv[i], "background",4)==0)
- aVal=EPriorityBackground;
- else if (strnicmp(argv[i], "foreground",4)==0)
- aVal=EPriorityForeground;
- else if (stricmp(argv[i], "high")==0)
- aVal=EPriorityHigh;
- else if (strnicmp(argv[i], "windowserver",3)==0)
- aVal=EPriorityWindowServer;
- else if (strnicmp(argv[i], "fileserver",4)==0)
- aVal=EPriorityFileServer;
- else if (strnicmp(argv[i], "realtime",4)==0)
- aVal=EPriorityRealTimeServer;
- else if (strnicmp(argv[i], "supervisor",3)==0)
- aVal=EPrioritySupervisor;
- else
- {
- Print(EError, "Unrecognised priority\n");
- return KErrArgument;
- }
- }
- if (aVal<EPriorityLow || aVal>EPrioritySupervisor)
- {
- Print(EError, "Priority out of range\n");
- return KErrArgument;
- }
- return KErrNone;
- }
-
-int getVersionArg(unsigned int& aVal, const char* aArg)
- {
- const char* s = aArg;
- unsigned int major = 0;
- unsigned int minor = 0;
- for (; major<=6553 && *s>='0' && *s<='9'; ++s)
- major = major*10 + (*s - '0');
- if (*s == '.')
- {
- for (++s; minor<=6553 && *s>='0' && *s<='9'; ++s)
- minor = minor*10 + (*s - '0');
- if (*s==0 && major<32768 && minor<32768)
- {
- aVal = (major << 16) | minor;
- return KErrNone;
- }
- }
- Print(EError, "Bad argument to -version\n");
- return KErrArgument;
- }
-
-int getFPUArg(unsigned int &aVal, int argc, char *argv[], int i)
- {
- if (i>=argc)
- return KErrArgument;
- else if (strnicmp(argv[i], "softvfp", 7)==0)
- aVal = 0;
- else if (strnicmp(argv[i], "vfpv2", 5)==0)
- aVal = 1;
- else
- {
- Print(EError, "Bad argument to -fpu\n");
- return KErrArgument;
- }
-
- return KErrNone;
- }
-
-int getCompressionMethod(int &aVal, int argc, char *argv[], int i)
-{
- if( i >= argc || argv[i] == NULL)
- {
- Print(EError, "Missing argument to -compressionmethod\n");
- return KErrArgument;
- }
- else if (strnicmp(argv[i], "none", 2) == 0)
- {
- aVal = ENoCompression;
- }
- else if (strnicmp(argv[i], "deflate", 7) == 0)
- {
- aVal = EDeflate;
- }
- else if (strnicmp(argv[i], "bytepair", 8) == 0)
- {
- aVal = EBytePair;
- }
- else
- {
- Print(EError, "Bad argument '%s' to -compressionmethod\n", argv[i]);
- return KErrArgument;
- }
-
- return KErrNone;
-
-}
-
-
-int processCL(int argc, char *argv[])
- {
-
- int r=KErrNone;
- int i=1;
- while (i<argc)
- {
- if (stricmp("-v", argv[i])==0)
- gVerbose |= E32ImageFile::EDumpDefaults;
- else if (stricmp("-dump", argv[i])==0)
- {
- i++;
- if (i>=argc)
- return KErrArgument;
- char* s=argv[i];
- while(char c = *(s++))
- {
- if(c<'a')
- c += 'a'-'A';
- switch(c)
- {
- case 'h': gVerbose |= E32ImageFile::EDumpHeader; break;
- case 's': gVerbose |= E32ImageFile::EDumpSecurityInfo; break;
- case 'c': gVerbose |= E32ImageFile::EDumpCode; break;
- case 'd': gVerbose |= E32ImageFile::EDumpData; break;
- case 'e': gVerbose |= E32ImageFile::EDumpExports; break;
- case 'i': gVerbose |= E32ImageFile::EDumpImports; break;
- default: return KErrArgument;
- }
- }
- }
- else if (stricmp("-stack", argv[i])==0)
- {
- i++;
- gSetStack=TRUE;
- r=getUIntArg(gStack, argc, argv, i);
- }
- else if (stricmp("-uid1", argv[i])==0)
- {
- i++;
- gSetUid1=TRUE;
- unsigned int id;
- r=getUIntArg(id, argc, argv, i);
- gUid1=TUid::Uid(id);
- }
- else if (stricmp("-uid2", argv[i])==0)
- {
- i++;
- gSetUid2=TRUE;
- unsigned int id;
- r=getUIntArg(id, argc, argv, i);
- gUid2=TUid::Uid(id);
- }
- else if (stricmp("-uid3", argv[i])==0)
- {
- i++;
- gSetUid3=TRUE;
- unsigned int id;
- r=getUIntArg(id, argc, argv, i);
- gUid3=TUid::Uid(id);
- }
- else if (stricmp("-version", argv[i])==0)
- {
- i++;
- r=getVersionArg(gVersionWord, argv[i]);
- gSetVersion=TRUE;
- }
- else if (stricmp("-sid", argv[i])==0)
- {
- i++;
- r=getUIntArg(gSecureId, argc, argv, i);
- gSetSecureId=TRUE;
- }
- else if (stricmp("-vid", argv[i])==0)
- {
- i++;
- r=getUIntArg(gVendorId, argc, argv, i);
- gSetVendorId=TRUE;
- }
- else if (strnicmp("-nocall", argv[i], 7)==0)
- {
- gSetCallEntryPoints=TRUE;
- gCallEntryPoints=FALSE;
- }
- else if (strnicmp("-call", argv[i], 5)==0)
- {
- gSetCallEntryPoints=TRUE;
- gCallEntryPoints=TRUE;
- }
- else if (strnicmp("-fixed", argv[i], 3)==0)
- {
- gSetFixedAddress=TRUE;
- gFixedAddress=TRUE;
- }
- else if (strnicmp("-moving", argv[i], 3)==0)
- {
- gSetFixedAddress=TRUE;
- gFixedAddress=FALSE;
- }
- else if (strnicmp("-priority", argv[i], 4)==0)
- {
- i++;
- gSetPriority=TRUE;
- r=getPriorityArg(gPriority,argc,argv,i);
- }
- else if (strnicmp("-capability", argv[i], 10)==0)
- {
- i++;
- gSetCapability=TRUE;
- r=getCapabilitiesArg(gCapability, argc, argv, i);
- }
- else if (strnicmp("-heap", argv[i], 4)==0)
- {
- i++;
- gSetHeap=TRUE;
- r=getUIntArg(gHeapMin, argc, argv, i);
- if (r==KErrNone)
- r=getUIntArg(gHeapMax, argc, argv, ++i);
- }
- else if (strnicmp("-allow", argv[i], 6)==0) // Note, toolchain passes 'allow' for 'allowdlldata'
- {
- gAllowDllData=TRUE;
- }
- else if( strnicmp("-compressionmethod", argv[i], 18) == 0)
- {
- if(!gSuppressComprMethod)
- {
- gCompress = TRUE;
- gSetCompress = TRUE;
- r = getCompressionMethod(gCompressionMethod, argc, argv, ++i);
- }
- else
- {
- ++i; // Skip the compression method because compessionmethod suppressed.
- }
- }
- else if (strnicmp("-compress", argv[i], 9)==0)
- {
- gCompress=TRUE;
- gSetCompress=TRUE;
- gSuppressComprMethod=FALSE;
- }
- else if (strnicmp("-nocompress", argv[i], 11)==0)
- {
- gCompress=FALSE;
- gSetCompress=TRUE;
- gSuppressComprMethod = TRUE;
- gCompressionMethod = ENoCompression;
- }
- else if (strnicmp("-datalinkaddress", argv[i], 16)==0)
- {
- i++;
- r=getUIntArg(gDataBase, argc, argv, i);
- }
- else if (strnicmp("-align-const-section", argv[i], 20)==0)
- {
- gAlignConstSection=TRUE;
- }
- else if (strnicmp("-const-section-address-mask", argv[i], 27)==0)
- {
- i++;
- r=getUIntArg(gConstSectionAddressMask, argc, argv, i);
- }
- else if (strnicmp("-fpu", argv[i], 4)==0)
- {
- i++;
- r=getFPUArg(gFPU, argc, argv, i);
- gSetFPU=TRUE;
- }
- else if (strnicmp("-paged", argv[i], 6) == 0)
- {
- gCodePaged=TRUE;
- gSetCodePaged=TRUE;
- }
- else if (strnicmp("-unpaged", argv[i], 8) == 0)
- {
- gCodeUnpaged=TRUE;
- gSetCodePaged=TRUE;
- }
- else if (strnicmp("-defaultpaged", argv[i], 13) == 0)
- {
- gCodeDefaultPaged=TRUE;
- gSetCodePaged=TRUE;
- }
- else if (strnicmp("-codepaging", argv[i], 11)==0)
- {
- i++;
-
- if (i>=argc)
- {
- r = KErrArgument;
- }
- else if ( strnicmp(argv[i], "paged", 5) == 0 )
- {
- gCodePaged=TRUE;
- }
- else if ( strnicmp(argv[i], "unpaged", 7) == 0 )
- {
- gCodeUnpaged=TRUE;
- }
- else if ( strnicmp(argv[i], "default", 7) == 0 )
- {
- gCodeDefaultPaged=TRUE;
- }
- else
- {
- Print(EError, "Bad argument to -codepaging\n");
- r = KErrArgument;
- }
-
- gSetCodePaged=TRUE;
- }
- else if (strnicmp("-datapaging", argv[i], 11)==0)
- {
- i++;
-
- if (i>=argc)
- {
- r = KErrArgument;
- }
- else if ( strnicmp(argv[i], "paged", 5) == 0 )
- {
- gDataPaged=TRUE;
- }
- else if ( strnicmp(argv[i], "unpaged", 7) == 0 )
- {
- gDataUnpaged=TRUE;
- }
- else if ( strnicmp(argv[i], "default", 7) == 0 )
- {
- gDataDefaultPaged=TRUE;
- }
- else
- {
- Print(EError, "Bad argument to -datapaging\n");
- r = KErrArgument;
- }
-
- gSetDataPaged=TRUE;
- }
- else if (strnicmp("-sym_name_lkup", argv[i], 14) == 0)
- {
- gSetSymLkup=TRUE;
- }
- else if (strnicmp("-debuggable", argv[i], 11) == 0)
- {
- gDebuggable=TRUE;
- gSetDebuggable=TRUE;
- }
- else if (strnicmp("-smpsafe", argv[i], 8) == 0)
- {
- gSmpSafe=TRUE;
- gSetSmpSafe=TRUE;
- }
-#ifdef __SUPPORT_PE_FILES__
- else if (strnicmp("-x86imp=", argv[i], 8)==0)
- {
- const char* x86impfile=argv[i]+8;
-// printf("%s\n",x86impfile);
- FILE* f=fopen(x86impfile,"rb");
- if (!f)
- r=KErrArgument;
- else
- {
- fseek(f,0,SEEK_END);
- long size=ftell(f);
- fseek(f,0,SEEK_SET);
- if (size>4)
- {
- gX86imp=new char[size];
- fread(gX86imp,1,size,f);
- }
- fclose(f);
- r=KErrNone;
- if (gX86imp)
- {
- gX86imp_size=ALIGN4(size);
- // printf("size %d\n",size);
- int i;
- int* p=(int*)gX86imp;
- gX86num_imp_dlls=*p++;
- for (i=0; i<gX86num_imp_dlls; ++i)
- {
- ++p;
- int n=*p++;
- gX86num_imports+=n;
- p+=n;
- }
- // fprintf(stderr,"#imports=%d\n",gX86num_imports);
- }
- }
- }
-#endif
- else if (gFile1==NULL)
- {
- gFile1 = NormaliseFileName(argv[i]);
- }
- else if (gFile2==NULL)
- {
- gFile2 = NormaliseFileName(argv[i]);
- }
- else
- r=KErrArgument;
- if (r!=KErrNone)
- return r;
- i++;
- }
- return KErrNone;
- }
-
-int main(int argc, char *argv[])
- {
-#ifdef __SUPPORT_PE_FILES__
- Print(EAlways,"\nPETRAN - PE file preprocessor");
-#endif
-#ifdef __SUPPORT_ELF_FILES__
- Print(EAlways,"\nELFTRAN - ELF file preprocessor");
-#endif
- Print(EAlways," V%02d.%02d (Build %03d)\n",MajorVersion,MinorVersion,Build);
- int r=processCL(argc, argv);
- if (r!=KErrNone)
- return helpme(argv[0]);
- if (gFile2)
- return dotran(gFile1, gFile2);
- if ((gSetStack || gSetUid1 || gSetUid2 || gSetUid3 || gSetCallEntryPoints || gSetPriority
- || gSetCapability || gSetCompress || gSetHeap || gSetVersion || gSetSecureId
- || gSetVendorId || gSetFixedAddress || gSetFPU || gSetCodePaged || gSetDataPaged || gSetDebuggable || gSetSmpSafe) && gFile1)
- return doalter(gFile1);
- if (gFile1)
- return dodump(gFile1);
- helpme(argv[0]);
- return KErrArgument;
- }
--- a/e32tools/elf2e32/group/release.txt Wed Jul 14 14:50:01 2010 +0100
+++ b/e32tools/elf2e32/group/release.txt Tue Jul 20 15:02:28 2010 +0800
@@ -4,6 +4,11 @@
NOTESRC_RELEASE_REASON
Postlinker(elf2e32) Release
+version 2.2 build(5)
+===============
+Released by Zheng Shen, 11/07/2010
+ 1) ou1cimx1#473808 Compiler scripts in Symbian^3 does not allow softvfp+vfp2 compile option
+
version 2.2 build(004)
===============
Released by Lorence Wang, 11/06/2010
--- a/e32tools/elf2e32/include/h_ver.h Wed Jul 14 14:50:01 2010 +0100
+++ b/e32tools/elf2e32/include/h_ver.h Tue Jul 20 15:02:28 2010 +0800
@@ -18,7 +18,7 @@
const TInt MajorVersion=2;
const TInt MinorVersion=2;
-const TInt Build=4;
+const TInt Build=5;
#endif
--- a/e32tools/elf2e32/source/byte_pair.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,488 +0,0 @@
-// Copyright (c) 2005-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:
-//
-
-#include "byte_pair.h"
-
-
-#undef ASSERT
-#define ASSERT(c) if(!(c)) \
- { \
- __BREAKPOINT() \
- }
-
-const TInt MaxBlockSize = 0x1000;
-
-TUint16 PairCount[0x10000];
-TUint16 PairBuffer[MaxBlockSize*2];
-
-TUint16 GlobalPairs[0x10000] = {0};
-TUint16 GlobalTokenCounts[0x100] = {0};
-
-TUint16 ByteCount[0x100+4];
-
-void CountBytes(TUint8* data, TInt size)
- {
- memset(ByteCount,0,sizeof(ByteCount));
- TUint8* dataEnd = data+size;
- while(data<dataEnd)
- ++ByteCount[*data++];
- }
-
-
-inline void ByteUsed(TInt b)
- {
- ByteCount[b] = 0xffff;
- }
-
-
-// 11915620
-// 11913551 return -ByteCount[b1]-ByteCount[b2];
-// 11913185
-
-#if 0
-int TieBreak(int b1,int b2)
- {
- int i;
- int x = 0;
- for(i=0; i<0x100; i++)
- x += PairCount[(b1<<8)+i];
- int y = 0;
- for(i=b2; i<0x10000; i+=0x100)
- y += PairCount[i];
- return -x-y;
- }
-#endif
-
-int TieBreak(int b1,int b2)
- {
- return -ByteCount[b1]-ByteCount[b2];
- }
-
-TInt MostCommonPair(TInt& pair, TUint8* data, TInt size, TInt minFrequency, TInt marker)
- {
- memset(PairCount,0,sizeof(PairCount));
- TUint8* dataEnd = data+size-1;
- TInt pairsFound = 0;
- TInt lastPair = -1;
- while(data<dataEnd)
- {
- TInt b1 = *data++;
- if(b1==marker)
- {
- // skip marker and following byte
- lastPair = -1;
- ++data;
- continue;
- }
- TInt b2 = *data;
- if(b2==marker)
- {
- // skip marker and following byte
- lastPair = -1;
- data+=2;
- continue;
- }
- TInt p = (b2<<8)|b1;
- if(p==lastPair)
- {
- // ensure a pair of identical bytes don't get double counted
- lastPair = -1;
- continue;
- }
- lastPair = p;
- ++PairCount[p];
- if(PairCount[p]==minFrequency)
- PairBuffer[pairsFound++] = (TUint16)p;
- }
-
- TInt bestCount = -1;
- TInt bestPair = -1;
- TInt bestTieBreak = 0;
- TInt p;
- while(pairsFound--)
- {
- p = PairBuffer[pairsFound];
- TInt f=PairCount[p];
- if(f>bestCount)
- {
- bestCount = f;
- bestPair = p;
- bestTieBreak = TieBreak(p&0xff,p>>8);
- }
- else if(f==bestCount)
- {
- TInt tieBreak = TieBreak(p&0xff,p>>8);
- if(tieBreak>bestTieBreak)
- {
- bestCount = f;
- bestPair = p;
- bestTieBreak = tieBreak;
- }
- }
- }
- pair = bestPair;
- return bestCount;
- }
-
-
-TInt LeastCommonByte(TInt& byte)
- {
- TInt bestCount = 0xffff;
- TInt bestByte = -1;
- for(TInt b=0; b<0x100; b++)
- {
- TInt f = ByteCount[b];
- if(f<bestCount)
- {
- bestCount = f;
- bestByte = b;
- }
- }
- byte = bestByte;
- return bestCount;
- }
-
-
-TInt Pak(TUint8* dst, TUint8* src, TInt size)
- {
- TInt originalSize = size;
- TUint8* dst2 = dst+size*2;
- TUint8* in = src;
- TUint8* out = dst;
-
- TUint8 tokens[0x100*3];
- TInt tokenCount = 0;
-
- CountBytes(in,size);
-
- TInt marker = -1;
- TInt overhead = 1+3+LeastCommonByte(marker);
- ByteUsed(marker);
-
- TUint8* inEnd = in+size;
- TUint8* outStart = out;
- while(in<inEnd)
- {
- TInt b=*in++;
- if(b==marker)
- *out++ = (TUint8)b;
- *out++ = (TUint8)b;
- }
- size = out-outStart;
-
- TInt outToggle = 1;
- in = dst;
- out = dst2;
-
- for(TInt r=256; r>0; --r)
- {
- TInt byte;
- TInt byteCount = LeastCommonByte(byte);
- TInt pair;
- TInt pairCount = MostCommonPair(pair,in,size,overhead+1,marker);
- TInt saving = pairCount-byteCount;
- if(saving<=overhead)
- break;
-
- overhead = 3;
- if(tokenCount>=32)
- overhead = 2;
-
- TUint8* d=tokens+3*tokenCount;
- ++tokenCount;
- *d++ = (TUint8)byte;
- ByteUsed(byte);
- *d++ = (TUint8)pair;
- ByteUsed(pair&0xff);
- *d++ = (TUint8)(pair>>8);
- ByteUsed(pair>>8);
- ++GlobalPairs[pair];
-
- inEnd = in+size;
- outStart = out;
- while(in<inEnd)
- {
- TInt b=*in++;
- if(b==marker)
- {
- *out++ = (TUint8)marker;
- b = *in++;
- }
- else if(b==byte)
- {
- *out++ = (TUint8)marker;
- --byteCount;
- }
- else if(b==(pair&0xff) && in<inEnd && *in==(pair>>8))
- {
- ++in;
- b = byte;
- --pairCount;
- }
- *out++ = (TUint8)b;
- }
- ASSERT(!byteCount);
- ASSERT(!pairCount);
- size = out-outStart;
-
- outToggle ^= 1;
- if(outToggle)
- {
- in = dst;
- out = dst2;
- }
- else
- {
- in = dst2;
- out = dst;
- }
- }
-
- // sort tokens with a bubble sort...
- for(TInt x=0; x<tokenCount-1; x++)
- for(TInt y=x+1; y<tokenCount; y++)
- if(tokens[x*3]>tokens[y*3])
- {
- TInt z = tokens[x*3];
- tokens[x*3] = tokens[y*3];
- tokens[y*3] = (TUint8)z;
- z = tokens[x*3+1];
- tokens[x*3+1] = tokens[y*3+1];
- tokens[y*3+1] = (TUint8)z;
- z = tokens[x*3+2];
- tokens[x*3+2] = tokens[y*3+2];
- tokens[y*3+2] = (TUint8)z;
- }
-
- // check for not being able to compress...
- if(size>originalSize)
- {
- *dst++ = 0; // store zero token count
- memcpy(dst,src,originalSize); // store original data
- return originalSize+1;
- }
-
- // make sure data is in second buffer (dst2)
- if(in!=dst2)
- memcpy(dst2,dst,size);
-
- // store tokens...
- TUint8* originalDst = dst;
- *dst++ = (TUint8)tokenCount;
- if(tokenCount)
- {
- *dst++ = (TUint8)marker;
- if(tokenCount<32)
- {
- memcpy(dst,tokens,tokenCount*3);
- dst += tokenCount*3;
- }
- else
- {
- TUint8* bitMask = dst;
- memset(bitMask,0,32);
- dst += 32;
- TUint8* d=tokens;
- do
- {
- TInt t=*d++;
- bitMask[t>>3] |= (1<<(t&7));
- *dst++ = *d++;
- *dst++ = *d++;
- }
- while(--tokenCount);
- }
- }
- // store data...
- memcpy(dst,dst2,size);
- dst += size;
-
- // get stats...
- ++GlobalTokenCounts[tokenCount];
-
- // return total size of compressed data...
- return dst-originalDst;
- }
-
-
-TInt Unpak(TUint8* dst, TInt dstSize, TUint8* src, TInt srcSize, TUint8*& srcNext)
- {
- TUint8* dstStart = dst;
- TUint8* dstEnd = dst+dstSize;
- TUint8* srcEnd = src+srcSize;
-
- TUint32 LUT[0x100/2];
- TUint8* LUT0 = (TUint8*)LUT;
- TUint8* LUT1 = LUT0+0x100;
-
- TUint8 stack[0x100];
- TUint8* stackStart = stack+sizeof(stack);
- TUint8* sp = stackStart;
-
- TUint32 marker = ~0u;
- TInt numTokens;
- TUint32 p1;
- TUint32 p2;
-
- TUint32* l = (TUint32*)LUT;
- TUint32 b = 0x03020100;
- TUint32 step = 0x04040404;
- do
- {
- *l++ = b;
- b += step;
- }
- while(b>step);
-
- if(src>=srcEnd)
- goto error;
- numTokens = *src++;
- if(numTokens)
- {
- if(src>=srcEnd)
- goto error;
- marker = *src++;
- LUT0[marker] = (TUint8)~marker;
-
- if(numTokens<32)
- {
- TUint8* tokenEnd = src+3*numTokens;
- if(tokenEnd>srcEnd)
- goto error;
- do
- {
- TInt b = *src++;
- TInt p1 = *src++;
- TInt p2 = *src++;
- LUT0[b] = (TUint8)p1;
- LUT1[b] = (TUint8)p2;
- }
- while(src<tokenEnd);
- }
- else
- {
- TUint8* bitMask = src;
- src += 32;
- if(src>srcEnd)
- goto error;
- TInt b=0;
- do
- {
- TUint8 mask = bitMask[b>>3];
- if(mask&(1<<(b&7)))
- {
- if(src>srcEnd)
- goto error;
- TInt p1 = *src++;
- if(src>srcEnd)
- goto error;
- TInt p2 = *src++;
- LUT0[b] = (TUint8)p1;
- LUT1[b] = (TUint8)p2;
- --numTokens;
- }
- ++b;
- }
- while(b<0x100);
- if(numTokens)
- goto error;
- }
- }
-
- if(src>=srcEnd)
- goto error;
- b = *src++;
- if(dst>=dstEnd)
- goto error;
- p1 = LUT0[b];
- if(p1!=b)
- goto not_single;
-next:
- if(src>=srcEnd)
- goto done_s;
- b = *src++;
- *dst++ = (TUint8)p1;
- if(dst>=dstEnd)
- goto done_d;
- p1 = LUT0[b];
- if(p1==b)
- goto next;
-
-not_single:
- if(b==marker)
- goto do_marker;
-
-do_pair:
- p2 = LUT1[b];
- b = p1;
- p1 = LUT0[b];
- if(sp<=stack)
- goto error;
- *--sp = (TUint8)p2;
-
-recurse:
- if(b!=p1)
- goto do_pair;
-
- if(sp==stackStart)
- goto next;
- b = *sp++;
- if(dst>=dstEnd)
- goto error;
- *dst++ = (TUint8)p1;
- p1 = LUT0[b];
- goto recurse;
-
-do_marker:
- if(src>=srcEnd)
- goto error;
- p1 = *src++;
- goto next;
-
-error:
- srcNext = 0;
- return KErrCorrupt;
-
-done_s:
- *dst++ = (TUint8)p1;
- srcNext = src;
- return dst-dstStart;
-
-done_d:
- if(dst>=dstEnd)
- --src;
- srcNext = src;
- return dst-dstStart;
- }
-
-
-TUint8 PakBuffer[MaxBlockSize*4];
-TUint8 UnpakBuffer[MaxBlockSize];
-
-
-TInt BytePairCompress(TUint8* dst, TUint8* src, TInt size)
- {
- ASSERT(size<=MaxBlockSize);
- TInt compressedSize = Pak(PakBuffer,src,size);
- TUint8* pakEnd;
- TInt us = Unpak(UnpakBuffer,MaxBlockSize,PakBuffer,compressedSize,pakEnd);
- ASSERT(us==size)
- ASSERT(pakEnd==PakBuffer+compressedSize)
- ASSERT(!memcmp(src,UnpakBuffer,size))
- if(compressedSize>=size)
- return KErrTooBig;
- memcpy(dst,PakBuffer,compressedSize);
- return compressedSize;
- }
--- a/e32tools/elf2e32/source/byte_pair.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-// Copyright (c) 2005-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:
-//
-
-#ifndef BYTE_PAIR_H
-#define BYTE_PAIR_H
-#define __PLACEMENT_NEW_INLINE
-#define __PLACEMENT_VEC_NEW_INLINE
-/*
-#ifdef __VC32__
- #ifdef __MSVCDOTNET__
- #include <strstream>
- #include <iomanip>
-// #include <ostream.h>
- #else //!__MSVCDOTNET__
- #include <strstrea.h>
- #include <iomanip.h>
- #endif //__MSVCDOTNET__
-#else // !__VC32__
- #include <strstream.h>
- #include <iomanip.h>
-#endif // __VC32__
-*/
-#ifdef __TOOLS2__
-#include <sstream>
-#include <ostream>
-using namespace std;
-#else
-#include <strstream>
-#include <ostream.h>
-#endif
-
-
-#include <e32cmn.h>
-
-TInt BytePairCompress(TUint8* dst, TUint8* src, TInt size);
-TInt Pak(TUint8* dst, TUint8* src, TInt size);
-TInt Unpak(TUint8* dst, TInt dstSize, TUint8* src, TInt srcSize, TUint8*& srcNext);
-void BytePairCompress(char * bytes, TInt size, ostream &os);
-
-#endif
\ No newline at end of file
--- a/e32tools/elf2e32/source/h_utl.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,260 +0,0 @@
-// Copyright (c) 2005-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:
-// Implementation of the e32 image version for e32 image dump for the elf2e32 tool
-// @internalComponent
-// @released
-//
-//
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "h_utl.h"
-
-/**
-Function to check bracketed hex i.e '{', '}'
-
-@internalComponent
-@released
-
-@param aTemp
-@param aBrackets
-@param aDigits
-@param aValue
-
-@return True if the value passed in is a bracketed hex.
-*/
-TBool IsBracketedHex(const char* aTemp, const char* aBrackets, TInt aDigits, TUint32& aValue)
-{
- if (aTemp[0]!=aBrackets[0] || aTemp[1+aDigits]!=aBrackets[1])
- return 0;
- TInt i;
- TUint32 x = 0;
- for (i=1; i<=aDigits; ++i)
- {
- TInt c = aTemp[i];
- if (c>='a' && c<='z') c-=32;
- if (c<'0' || (c>'9' && c<'A') || c>'F')
- return 0;
- c-='0';
- if (c>9)
- c-=7;
- x = (x<<4) | (TUint32)c;
- }
- aValue = x;
-
- return 1;
-}
-
-/**
-Function to check the decimal version
-
-@internalComponent
-@released
-
-@param aBegin
-Beginning of the version information
-@param aTemp
-@param aValue
-Holds the hexadecimal value
-@return the checked value.
-*/
-TInt CheckForDecimalVersion(const char* aBegin, const char* aTemp, TUint32& aValue)
-{
- aValue = 0;
- if (aTemp <= aBegin || *aTemp != '}')
- return 0;
- TUint32 v[2] = {0,0};
- TUint32 m = 1;
- TInt pos = 0;
- const char* s0 = aTemp + 1;
- for (--aTemp; aTemp >= aBegin; --aTemp)
- {
- int c = *aTemp;
- if (c >= '0' && c <= '9')
- {
- v[pos] += m * (c - '0');
- if (v[pos] >= 65536u)
- return 0;
- m *= 10;
- }
- else if (c == '.')
- {
- m = 1;
- if (++pos >= 2)
- return 0;
- }
- else if (c == '{')
- break;
- else
- return 0;
- }
- if (aTemp < aBegin)
- return 0;
-
- aValue = (v[1] << 16) | v[0];
-
- return s0 - aTemp;
-}
-
-/**
-Function to Parse a filename and convert decimal version number to hex
-
-@internalComponent
-@released
-
-@param aName
-Filename to be parsed
-
-@return the converted name wherein the decimal number is converted to hex.
-*/
-char* NormaliseFileName(const char* aName)
-{
- TFileNameInfo f(aName, 0);
- TInt nl = f.iBaseLength;
- TInt el = f.iTotalLength - f.iExtPos;
- TInt tl = nl + el;
- if (f.iFlags & EVerPresent)
- tl += 10;
- char* t = new char[tl + 1];
- if (t)
- {
- memcpy(t, aName, nl);
- if (f.iFlags & EVerPresent)
- sprintf(t + nl, "{%08x}%s", (TInt)f.iModuleVersion, aName + f.iExtPos);
- else if (el)
- memcpy(t + nl, aName + f.iExtPos, el);
- t[tl] = 0;
- }
-
- return t;
-}
-
-/**
-Constructor for Class TFileNameInfo
-
-@internalComponent
-@released
-
-@param aFileName
-Filename to be parsed
-@param aLookForUid
-*/
-TFileNameInfo::TFileNameInfo(const char* aFileName, TBool aLookForUid)
-{
- iFileName = aFileName;
- TInt l = strlen(aFileName);
- iTotalLength = l;
- TInt remain = l;
- iFlags = 0;
- iUid3 = 0;
- iModuleVersion = 0;
- iBaseLength = l;
- iExtPos = l;
- const char* s = iFileName + l;
- for (; s>=iFileName && *s!='.' && *s!='}' && (!aLookForUid || *s!=']'); --s)
- {
- }
-
- if (s<iFileName)
- return;
- if (*s == '.')
- {
- iExtPos = s - iFileName;
- if (iExtPos == 0)
- {
- iBaseLength = 0;
- return;
- }
- remain = iExtPos;
- --s;
- }
- else if (s != iFileName + l)
- return;
-
- if (aLookForUid && remain>=10 && IsBracketedHex(s-9, "[]", 8, iUid3))
- {
- iFlags |= EUidPresent;
- remain -= 10;
- s -= 10;
- }
-
- if (remain>=10 && IsBracketedHex(s-9, "{}", 8, iModuleVersion))
- {
- iFlags |= EVerPresent;
- remain -= 10;
- s -= 10;
- }
- else
- {
- TInt n = CheckForDecimalVersion(iFileName, s, iModuleVersion);
- if (n>0)
- {
- iFlags |= EVerPresent;
- remain -= n;
- s -= n;
- }
- }
- iBaseLength = remain;
-}
-
-/*-------------------------------------------------------------------------
-String comparison on Linux seems to be a little half-baked.
--------------------------------------------------------------------------*/
-#ifdef __LINUX__
-
-int stricmp(const char *a, const char *b)
- {
- unsigned char ca,cb;
-
- do {
- ca = *a++;
- cb = *b++;
- ca = tolower(ca);
- cb = tolower(cb);
- }
- while((ca == cb) && (ca));
- return (int) ca-cb;
- }
-
-int strnicmp(const char *a, const char *b, int n)
- {
- unsigned char ca,cb;
- int i = 0;
-
- do {
- if (++i > n) return 0;
- ca = *a++;
- cb = *b++;
- ca = tolower(ca);
- cb = tolower(cb);
- }
- while((ca == cb) && (ca));
- return (int) ca-cb;
- }
-
-char* strupr(char *a)
- {
- char *ret = a;
-
- while (*a)
- {
- *a = toupper(*a);
- a++;
- }
-
- return ret;
- }
-
-
-#endif
--- a/e32tools/elf2e32/source/h_utl.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,112 +0,0 @@
-// 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:
-
-
-
- #ifndef __H_UTL_H__
- #define __H_UTL_H__
-
-#include "e32defwrap.h"
-#include <e32err.h>
-#include <iostream>
-
-#ifdef __TOOLS2__
-#include <sstream>
-#include <fstream>
-using namespace std;
-#else
-#include <strstream.h>
-#endif
-
- /**
- Convert string to number.
- @internalComponent
- @released
- */
- template <class T>
- TInt Val(T& aVal, char* aStr)
- {
-
-
- T x;
- #ifdef __TOOLS2__
- istringstream val(aStr);
- #else
- istrstream val(aStr,strlen(aStr));
- #endif
- val >> x;
- if (!val.eof() || val.fail())
- return KErrGeneral;
- aVal=x;
- return KErrNone;
-
- /*T x;
- istrstream val(aStr,strlen(aStr));
- val >> x;
- if (!val.eof() || val.fail())
- return KErrGeneral;
- aVal=x;
- return KErrNone;*/
- }
-
-
- //enum for decompose flag
- enum TDecomposeFlag
- {
- EUidPresent=1,
- EVerPresent=2
- };
-
- /**
- class for FileNameInfo
- @internalComponent
- @released
- */
- class TFileNameInfo
- {
- public:
- TFileNameInfo(const char* aFileName, TBool aLookForUid);
- public:
- const char* iFileName;
- TInt iTotalLength;
- TInt iBaseLength;
- TInt iExtPos;
- TUint32 iUid3;
- TUint32 iModuleVersion;
- TUint32 iFlags;
- };
-
- extern char* NormaliseFileName(const char* aName);
-
-
-
- #ifdef __LINUX__
- // Case insensitive comparison functions are named differently on Linux
- #define stricmp strcasecmp
- #define strnicmp strncasecmp
-
- // Convert the provided string to Uppercase
- char* strupr(char *a);
- #endif // __LINUX__
-
- #endif // __H_UTL_H__
-
-
-
-
-
-
-
-
-
--- a/e32tools/elf2e32/source/pagedcompress.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,334 +0,0 @@
-// Copyright (c) 2005-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:
-// byte_pair.cpp
-//
-//
-
-#include <malloc.h>
-#include <string.h>
-#include <stdlib.h>
-#include "h_utl.h"
-#include "h_ver.h"
-#include <stdio.h>
-
-#include <fstream>
-#ifdef __TOOLS2__
-#include <sstream>
-#else
-#include <strstream.h>
-#endif
-
-#include <string>
-#include <vector>
-#include <cassert>
-#include <iostream>
-#ifndef __LINUX__
-#include <io.h>
-#endif
-#include <time.h>
-
-#include "byte_pair.h"
-
-#define PAGE_SIZE 4096
-
-//#define __TEST_ONLY__
-
-
-typedef struct IndexTableItemTag
-{
- TUint16 iSizeOfCompressedPageData; // pointer to an array TUint16[NumberOfPages]
- TUint8 *iCompressedPageData; // pointer to an array TUint8*. Each elemet of
- // this array point a compressed Page data
-}IndexTableItem;
-
-
-typedef struct IndexTableHeaderTag
-{
- TInt iSizeOfData; // Includes the index and compressed pages
- TInt iDecompressedSize;
- TUint16 iNumberOfPages;
-} IndexTableHeader;
-
-
-class CBytePairCompressedImage
-{
- public:
- static CBytePairCompressedImage* NewLC(TUint16 aNumberOfPages, TInt aSize);
-
- ~CBytePairCompressedImage();
-
- void AddPage(TUint16 aPageNum, TUint8 * aPageData, TUint16 aPageSize);
- int GetPage(TUint16 aPageNum, TUint8 * aPageData);
- void WriteOutTable(std::ofstream &os);
- int ReadInTable(std::ifstream &is, TUint & aNumberOfPages);
-
- private:
- TInt ConstructL( TUint16 aNumberOfPages, TInt aSize);
- CBytePairCompressedImage();
-
- private:
- IndexTableHeader iHeader;
- IndexTableItem* iPages;
- TUint8* iOutBuffer;
-
-};
-
-
-CBytePairCompressedImage::CBytePairCompressedImage()
-{
-
-}
-
-
-CBytePairCompressedImage* CBytePairCompressedImage::NewLC(TUint16 aNumberOfPages, TInt aSize)
-{
- CBytePairCompressedImage* self = new CBytePairCompressedImage;
- if( NULL == self)
- {
- return self;
- }
-
- if( KErrNone == self->ConstructL(aNumberOfPages, aSize))
- {
- return self;
- }
- return NULL;
-}
-
-
-TInt CBytePairCompressedImage::ConstructL(TUint16 aNumberOfPages, TInt aSize)
-{
- //Print(EWarning,"Start ofCBytePairCompressedImage::ConstructL(%d, %d)\n", aNumberOfPages, aSize );
- iHeader.iNumberOfPages = aNumberOfPages;
- iHeader.iDecompressedSize = aSize;
-
- if( 0 != aNumberOfPages)
- {
- iPages = (IndexTableItem *) calloc(aNumberOfPages, sizeof(IndexTableItem));
-
- if( NULL == iPages )
- {
- return KErrNoMemory;
- }
- }
-
- iHeader.iSizeOfData = sizeof(iHeader.iSizeOfData) +
- sizeof(iHeader.iDecompressedSize) +
- sizeof(iHeader.iNumberOfPages) +
- aNumberOfPages * sizeof(TUint16);
-
- iOutBuffer = (TUint8 *) calloc(4 * PAGE_SIZE, sizeof(TUint8) );
-
- if ( NULL == iOutBuffer)
- {
- return KErrNoMemory;
- }
- return KErrNone;
-} // End of ConstructL()
-
-CBytePairCompressedImage::~CBytePairCompressedImage()
-{
-
- for( int i = 0; i < iHeader.iNumberOfPages; i++)
- {
- free(iPages[i].iCompressedPageData);
- iPages[i].iCompressedPageData = NULL;
- }
-
- free( iPages );
- iPages = NULL;
-
- free( iOutBuffer );
- iOutBuffer = NULL;
-}
-
-
-void CBytePairCompressedImage::AddPage(TUint16 aPageNum, TUint8 * aPageData, TUint16 aPageSize)
-{
- //Print(EWarning,"Start of AddPage(aPageNum:%d, ,aPageSize:%d)\n",aPageNum, aPageSize );
-
-#ifdef __TEST_ONLY__
-
- iPages[aPageNum].iSizeOfCompressedPageData = 2;
-
- iPages[aPageNum].iCompressedPageData = (TUint8 *) calloc(iPages[aPageNum].iSizeOfCompressedPageData, sizeof(TUint8) );
-
- memcpy(iPages[aPageNum].iCompressedPageData, (TUint8 *) &aPageNum, iPages[aPageNum].iSizeOfCompressedPageData);
-
-
-#else
-
- TUint16 compressedSize = (TUint16) Pak(iOutBuffer,aPageData,aPageSize );
- iPages[aPageNum].iSizeOfCompressedPageData = compressedSize;
- //Print(EWarning,"Compressed page size:%d\n", iPages[aPageNum].iSizeOfCompressedPageData );
-
- iPages[aPageNum].iCompressedPageData = (TUint8 *) calloc(iPages[aPageNum].iSizeOfCompressedPageData, sizeof(TUint8) );
-
- if( NULL == iPages[aPageNum].iCompressedPageData )
- {
- return;
- }
-
- memcpy(iPages[aPageNum].iCompressedPageData, iOutBuffer, iPages[aPageNum].iSizeOfCompressedPageData );
-
-#endif
-
- iHeader.iSizeOfData += iPages[aPageNum].iSizeOfCompressedPageData;
-}
-
-void CBytePairCompressedImage::WriteOutTable(std::ofstream & os)
-{
- // Write out IndexTableHeader
- //Print(EWarning,"Write out IndexTableHeader(iSizeOfData:%d,iDecompressedSize:%d,iNumberOfPages:%d)\n",iHeader.iSizeOfData, iHeader.iDecompressedSize, iHeader.iNumberOfPages );
- //Print(EWarning,"sizeof(IndexTableHeader) = %d, , sizeof(TUint16) = %d\n",sizeof(IndexTableHeader), sizeof(TUint16) );
- //os.write((const char *) &iHeader, sizeof(IndexTableHeader));
- os.write((const char *) &iHeader.iSizeOfData, sizeof(iHeader.iSizeOfData));
- os.write((const char *) &iHeader.iDecompressedSize, sizeof(iHeader.iDecompressedSize));
- os.write((const char *) &iHeader.iNumberOfPages, sizeof(iHeader.iNumberOfPages));
-
-
- // Write out IndexTableItems (size of each compressed page)
- for(TInt i = 0; i < iHeader.iNumberOfPages; i++)
- {
- os.write((const char *) &(iPages[i].iSizeOfCompressedPageData), sizeof(TUint16));
- }
-
- // Write out compressed pages
- for(TInt i = 0; i < iHeader.iNumberOfPages; i++)
- {
- os.write( (const char *)iPages[i].iCompressedPageData, iPages[i].iSizeOfCompressedPageData);
- }
-
-}
-
-
-int CBytePairCompressedImage::ReadInTable(std::ifstream &is, TUint & aNumberOfPages)
-{
- // Read page index table header
- is.read((char *)&iHeader, (sizeof(iHeader.iSizeOfData)+sizeof(iHeader.iDecompressedSize)+sizeof(iHeader.iNumberOfPages)));
-
- // Allocatin place to Page index table entries
- iPages = (IndexTableItem *) calloc(iHeader.iNumberOfPages, sizeof(IndexTableItem));
-
- if( NULL == iPages )
- {
- return KErrNoMemory;
- }
-
- // Read whole Page index table
-
- for(TInt i = 0; i < iHeader.iNumberOfPages; i++)
- {
- is.read((char *) &(iPages[i].iSizeOfCompressedPageData), sizeof(TUint16));
- }
-
- // Read compressed data pages page by page, decompress and store them
- for(TInt i = 0; i < iHeader.iNumberOfPages; i++)
- {
-
- iPages[i].iCompressedPageData = (TUint8 *) calloc(iPages[i].iSizeOfCompressedPageData, sizeof(TUint8) );
-
- if( NULL == iPages[i].iCompressedPageData )
- {
- return KErrNoMemory;
- }
-
- is.read((char *)iPages[i].iCompressedPageData, iPages[i].iSizeOfCompressedPageData);
- }
-
- aNumberOfPages = iHeader.iNumberOfPages;
-
- return KErrNone;
-}
-
-int CBytePairCompressedImage::GetPage(TUint16 aPageNum, TUint8 * aPageData)
-{
- TUint8* pakEnd;
-
- const TInt MaxBlockSize = 0x1000;
-
- TUint16 uncompressedSize = (TUint16) Unpak( aPageData,
- MaxBlockSize,
- iPages[aPageNum].iCompressedPageData,
- iPages[aPageNum].iSizeOfCompressedPageData,
- pakEnd );
-
- return uncompressedSize;
-
-
-}
-
-
-void CompressPages(TUint8* bytes, TInt size, std::ofstream& os)
-{
- // Build a list of compressed pages
- TUint16 numOfPages = (TUint16) ((size + PAGE_SIZE - 1) / PAGE_SIZE);
-
- CBytePairCompressedImage* comprImage = CBytePairCompressedImage::NewLC(numOfPages, size);
- if (!comprImage)
- {
- //Print(EError," NULL == comprImage\n");
- return;
- }
-
- TUint pageNum;
- TUint remain = (TUint)size;
- for (pageNum=0; pageNum<numOfPages; ++pageNum)
- {
- TUint8* pageStart = bytes + pageNum * PAGE_SIZE;
- TUint pageLen = remain>PAGE_SIZE ? PAGE_SIZE : remain;
- comprImage->AddPage((TUint16)pageNum, pageStart, (TUint16)pageLen);
- remain -= pageLen;
- }
-
- // Write out index table and compressed pages
- comprImage->WriteOutTable(os);
-
-
- delete comprImage;
- comprImage = NULL;
-
-}
-
-
-int DecompressPages(TUint8 * bytes, std::ifstream& is)
-{
- TUint decompressedSize = 0;
- CBytePairCompressedImage *comprImage = CBytePairCompressedImage::NewLC(0, 0);
- if( NULL == comprImage)
- {
- //Print(EError," NULL == comprImage\n");
- return KErrNoMemory;
- }
-
- TUint numberOfPages = 0;
- comprImage->ReadInTable(is, numberOfPages);
-
-
- TUint8* iPageStart;
- TUint16 iPage = 0;
-
- while(iPage < numberOfPages )
- {
- iPageStart = &bytes[iPage * PAGE_SIZE];
-
- decompressedSize += comprImage->GetPage(iPage, iPageStart);
-
- ++iPage;
- }
-
- delete comprImage;
- return decompressedSize;
-
-}
--- a/e32tools/elf2e32/source/parametermanager.cpp Wed Jul 14 14:50:01 2010 +0100
+++ b/e32tools/elf2e32/source/parametermanager.cpp Tue Jul 20 15:02:28 2010 +0800
@@ -2576,14 +2576,14 @@
{
INITIALISE_PARAM_PARSER;
- if (strnicmp(aValue, "softvfp", 7)==0)
- aPM->SetFPU(0);
+ if (strnicmp(aValue,"vfpv3D16", 8)==0)
+ aPM->SetFPU(3);
+ else if (strnicmp(aValue,"vfpv3", 5)==0)
+ aPM->SetFPU(2);
else if ((strnicmp(aValue, "vfpv2", 5)==0) || (strnicmp(aValue, "softvfp+vfpv2",13 )==0))
aPM->SetFPU(1);
- else if (strnicmp(aValue,"vfpv3", 5)==0)
- aPM->SetFPU(2);
- else if (strnicmp(aValue,"vfpv3D16", 8)==0)
- aPM->SetFPU(3);
+ else if (strnicmp(aValue, "softvfp", 7)==0)
+ aPM->SetFPU(0);
else
throw InvalidArgumentError(INVALIDARGUMENTERROR, aValue, aOption);
}
--- a/imgtools/buildrom/tools/cdf.dtd Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-<!--
-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:
-
--->
-<!ELEMENT component (localisation?,file+)>
-<!ATTLIST component id CDATA #REQUIRED >
-
-<!ELEMENT file (source, destination,
- localisation?, options? ,
- features?, dynamicDependencies?)>
-<!ATTLIST file
- id CDATA #REQUIRED
- customisable (true|false) #IMPLIED
- addressable (xip|nonxip|dontcare) #IMPLIED
- compress (unchanged|compress|uncompress) #IMPLIED
- type (normal|bitmap|compressedbitmap|autobitmap|aif|plugin) #IMPLIED
- plugin_name CDATA #IMPLIED>
-
-<!ELEMENT source (#PCDATA)>
-<!ELEMENT destination (#PCDATA)>
-<!ELEMENT features (supports?,prevents?)>
-<!ELEMENT supports (feature+)>
-<!ELEMENT prevents (feature+)>
-
-<!ELEMENT feature EMPTY>
-<!ATTLIST feature uid CDATA #IMPLIED
- name CDATA #IMPLIED>
-
-<!ELEMENT dynamicDependencies (depend+)>
-<!ELEMENT depend (#PCDATA)>
-<!ELEMENT localisation (default, language*)>
-<!ELEMENT default (#PCDATA)>
-<!ELEMENT language (#PCDATA)>
-<!ELEMENT options ((multilinguify | stack | heapmin |
- heapmax | fixed | priority |
- uid1 | uid2 | uid3 |
- dll | dlldatatop )+)>
-
-<!ELEMENT multilinguify (#PCDATA)>
-
-<!ELEMENT stack (#PCDATA)>
-<!ELEMENT heapmin (#PCDATA)>
-<!ELEMENT heapmax (#PCDATA)>
-<!ELEMENT fixed (#PCDATA)>
-<!ELEMENT priority (#PCDATA)>
-<!ELEMENT uid1 (#PCDATA)>
-<!ELEMENT uid2 (#PCDATA)>
-<!ELEMENT uid3 (#PCDATA)>
-<!ELEMENT dll (#PCDATA)>
-<!ELEMENT dlldatatop (#PCDATA)>
--- a/imgtools/buildrom/tools/configpaging.pm Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,344 +0,0 @@
-#
-# Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-# All rights reserved.
-# This component and the accompanying materials are made available
-# under the terms of the License "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:
-# changes the paging/unpaged configuration of binaries a generated
-# OBY file according to the list in configpaging.lst
-# use
-# externaltool=configpaging.pm
-# in oby file to enable
-# use
-# tool=configpaging \epoc32\rom\myconfigpaging.lst
-# to change the default configpaging.lst
-#
-
-package configpaging;
-
-use strict;
-
-our @EXPORT=qw(
- configpaging_info
- configpaging_initialize
- configpaging_single
- configpaging_multiple
-);
-use Exporter;
-our @ISA=qw(Exporter);
-
-#
-# Initialisation
-#
-use constant CONSTANT_UNPAGED => "unpaged";
-use constant CONSTANT_PAGED => "paged";
-use constant CONSTANT_UNPAGEDCODE => "unpagedcode";
-use constant CONSTANT_PAGEDCODE => "pagedcode";
-use constant CONSTANT_UNPAGEDDATA => "unpageddata";
-use constant CONSTANT_PAGEDDATA => "pageddata";
-use constant CONSTANT_CONFIG_PATH => "epoc32\\rom\\configpaging\\";
-my $epocroot = $ENV{EPOCROOT};
-my $configlist = $epocroot.CONSTANT_CONFIG_PATH."configpaging.cfg";
-
-
-# routine to provide information about the tool
-sub configpaging_info ()
-{
- my %toolinfo;
- $toolinfo{'name'} = "configpaging";
- $toolinfo{'invocation'} = "InvocationPoint2";
- $toolinfo{'initialize'} = \&configpaging_initialize;
- $toolinfo{'multiple'} = \&configpaging_multiple;
- $toolinfo{'single'} = \&configpaging_single;
- return \%toolinfo;
-}
-
-sub configpaging_initialize
- {
- my ($cmdLine) = @_;
- if (defined ($cmdLine))
- {
- print "configpaging.pm: Initializing with $cmdLine\n";
- $configlist = $epocroot.CONSTANT_CONFIG_PATH.$cmdLine;
- }
- }
-
-# routine to handle multiple invocation
-sub configpaging_multiple
-{
- my ($line) = @_;
- my @args=split /[=\s]/, $line;
- $configlist=$args[2];
- return "REM configpaging.pm: Using $configlist";
-}
-
-
-sub isobystatement
-{
- my ($li) = @_;
- if ($li =~ /^\s*data(=|\s+)/i) { return 1;}
- if ($li =~ /^\s*file(=|\s+)/i) { return 1;}
- if ($li =~ /^\s*dll(=|\s+)/i) { return 1;}
- if ($li =~ /^\s*secondary(=|\s+)/i) { return 1;}
-
- return 0;
-}
-
-#codepaging is codepagingoverride setting
-#datapaging is datapagingoverride setting
-#listref is ref to an associated array keyed by <executable regex>,
-#and the value is another associated array keyed (un)?paged(code|data)?
-#the value is 1 if set, undeffed if not.
-sub readConfigFile
- {
- my ($codepagingref, $datapagingref, $listref, $configfilename) = @_;
- my $filecodepaging = "";
- my $filedatapaging = "";
-
- local *FILE; # need a filehandle local to this invocation
- if(!open FILE, $configfilename)
- {
- print ("Configpaging Warning: Can't open $configfilename\n");
- return;
- }
-
- # parse the configfilename
- # insert the files listed into the listref and set the paging info accordingly.
- while (my $line=<FILE>)
- {
- if ($line !~ /\S/ ) { next; }
- if ($line =~ /^\s*#/ ) { next; }
- chomp $line;
- if ($line =~ /^\s*(code|data)?pagingoverride=(.*)\s*/i) {
- if ($1 eq undef) {
- if (lc($2) eq "defaultpaged") {
- $$codepagingref = CONSTANT_PAGED;
- $$datapagingref = CONSTANT_PAGED;
- } elsif (lc($2) eq "defaultunpaged") {
- $$codepagingref = CONSTANT_UNPAGED;
- $$datapagingref = CONSTANT_UNPAGED;
- } else {
- print ("Configpaging Warning: invalid pagingoverride setting:$2\n");
- }
- } elsif (lc($1) eq "code") {
- if (lc($2) eq "defaultpaged") {
- $$codepagingref = CONSTANT_PAGED;
- } elsif (lc($2) eq "defaultunpaged") {
- $$codepagingref = CONSTANT_UNPAGED;
- } else {
- print ("Configpaging Warning: invalid codepagingoverride setting:$2\n");
- }
- } elsif ($1 eq "data") {
- if (lc($2) eq "defaultpaged") {
- $$datapagingref = CONSTANT_PAGED;
- } elsif (lc($2) eq "defaultunpaged") {
- $$datapagingref = CONSTANT_UNPAGED;
- } else {
- print ("Configpaging Warning: invalid datapagingoverride setting:$2\n");
- }
- } else {
- print ("configpaging Warning: invalid keyword: $1" . "pagingoverride\n");
- }
- }
- elsif ($line =~ /^\s*(un)?paged(code|data)?(\s+(un)?paged(code|data)?)?:/i ) {
- $filecodepaging = "";
- $filedatapaging = "";
- if ($1 eq undef) {
- if ($2 eq undef) {
- $filecodepaging = CONSTANT_PAGED;
- $filedatapaging = CONSTANT_PAGED;
- }elsif (lc($2) eq "code") {
- $filecodepaging = CONSTANT_PAGED;
- } elsif(lc($2) eq "data") {
- $filedatapaging = CONSTANT_PAGED;
- } else {
- print ("Configpaging Warning: unrecognized line:$line\n");
- }
- } elsif (lc($1) eq "un") {
- if ($2 eq undef) {
- $filecodepaging = CONSTANT_UNPAGED;
- $filedatapaging = CONSTANT_UNPAGED;
- }elsif (lc($2) eq "code") {
- $filecodepaging = CONSTANT_UNPAGED;
- } elsif(lc($2) eq "data") {
- $filedatapaging = CONSTANT_UNPAGED;
- } else {
- print ("Configpaging Warning: unrecognized line:$line\n");
- }
- } else {
- print ("Configpaging Warning: unrecognized line:$line\n");
- }
- if ($3 ne undef){
- if ($4 eq undef) {
- if ($5 eq undef) {
- $filecodepaging = CONSTANT_PAGED;
- $filedatapaging = CONSTANT_PAGED;
- }elsif (lc($5) eq "code") {
- $filecodepaging = CONSTANT_PAGED;
- } elsif(lc($5) eq "data") {
- $filedatapaging = CONSTANT_PAGED;
- } else {
- print ("Configpaging Warning: unrecognized line:$line\n");
- }
- } elsif (lc($4) eq "un") {
- if ($5 eq undef) {
- $filecodepaging = CONSTANT_UNPAGED;
- $filedatapaging = CONSTANT_UNPAGED;
- }elsif (lc($5) eq "code") {
- $filecodepaging = CONSTANT_UNPAGED;
- } elsif(lc($5) eq "data") {
- $filedatapaging = CONSTANT_UNPAGED;
- } else {
- print ("Configpaging Warning: unrecognized line:$line\n");
- }
- } else {
- print ("Configpaging Warning: unrecognized line:$line\n");
- }
- }
- }
- elsif ($line =~ /^\s*include\s*\"(.*)\"/i)
- { readConfigFile($codepagingref, $datapagingref, $listref, $epocroot.CONSTANT_CONFIG_PATH.$1); } # go recursive
- elsif ($line =~ /\s*(\S+)(\s+(un)?paged(code|data)?(\s+(un)?paged(code|data)?)?)?/i){
- my %element;
- $element{code} = $$codepagingref;
- $element{data} = $$datapagingref;
- if ($2 eq undef){
- if ($filecodepaging ne "") {
- $element{code} = $filecodepaging;
- }
- if ($filedatapaging ne "") {
- $element{data} = $filedatapaging;
- }
- } else {
- if ($4 eq undef){
- if ($3 eq undef) {
- $element{code} = CONSTANT_PAGED;
- $element{data} = CONSTANT_PAGED;
- } elsif (lc($3) eq "un") {
- $element{code} = CONSTANT_UNPAGED;
- $element{data} = CONSTANT_UNPAGED;
- }
- } elsif (lc($4) eq "code") {
- if ($3 eq undef) {
- $element{code} = CONSTANT_PAGED;
- } elsif (lc($3) eq "un") {
- $element{code} = CONSTANT_UNPAGED;
- }
- } elsif (lc($4) eq "data") {
- if ($3 eq undef) {
- $element{data} = CONSTANT_PAGED;
- } elsif (lc($3) eq "un") {
- $element{data} = CONSTANT_UNPAGED;
- }
- } else {
- print ("Configpaging Warning: unrecognized attribute in line: $line\n");
- }
- if ($5 ne undef){
- if ($7 eq undef){
- if ($6 eq undef) {
- $element{code} = CONSTANT_PAGED;
- $element{data} = CONSTANT_PAGED;
- } elsif (lc($6) eq "un") {
- $element{code} = CONSTANT_UNPAGED;
- $element{data} = CONSTANT_UNPAGED;
- }
- } elsif (lc($7) eq "code") {
- if ($6 eq undef) {
- $element{code} = CONSTANT_PAGED;
- } elsif (lc($6) eq "un") {
- $element{code} = CONSTANT_UNPAGED;
- }
- } elsif (lc($7) eq "data") {
- if ($6 eq undef) {
- $element{data} = CONSTANT_PAGED;
- } elsif (lc($6) eq "un") {
- $element{data} = CONSTANT_UNPAGED;
- }
- } else {
- print ("Configpaging Warning: unrecognized attribute in line: $line\n");
- }
- }
- }
- $$listref{$1} = \%element;
- } else {
- print ("ConfigPaging Warning: unrecognized line:$line\n");
- }
- }
- close FILE;
- }
-
-# routine to handle single invocation
-sub configpaging_single
-{
- my $codepaging="";
- my $datapaging="";
- my %list;
- my @keys;
- my ($oby) = @_;
-
- print "configpaging.pm: Modifying demand paging configuration using $configlist\n";
- readConfigFile(\$codepaging, \$datapaging, \%list, $configlist);
- # read the oby file that was handed to us
- # find matches between each oby line and any files in the paged or unpaged list
- # modify the attributes of the oby line as appropriate
- my @newlines;
- my %element;
- @keys = keys %list;
- foreach my $line (@$oby)
- {
- my $codepagingadd="";
- my $datapagingadd="";
- chomp $line;
- if (isobystatement($line))
- {
- my $lcline = lc($line);
- for(my $index=@keys - 1; $index>=0; $index--) {
- my $match = $keys[$index];
- if ($lcline =~ /(\s+|\"|\\|=)$match(\s+|\"|$)/) {
- %element = %{$list{$match}};
- if ($element{code} eq CONSTANT_PAGED) {
- $codepagingadd .= " " . CONSTANT_PAGEDCODE;
- } elsif ($element{code} eq CONSTANT_UNPAGED) {
- $codepagingadd .= " " . CONSTANT_UNPAGEDCODE;
- }
- if ($element{data} eq CONSTANT_PAGED) {
- $datapagingadd .= " " . CONSTANT_PAGEDDATA;
- } elsif ($element{data} eq CONSTANT_UNPAGED) {
- $datapagingadd .= " " . CONSTANT_UNPAGEDDATA;
- }
- last;
- }
- }
- if (!$codepagingadd and $codepaging) {
- $codepagingadd = " " . $codepaging . "code";
- }
- if (!$datapagingadd and $datapaging) {
- $datapagingadd = " " . $datapaging . "data";
- }
- if ($codepagingadd and !$datapagingadd){
- if ($line =~ /\b(un)?paged(data)?\b\s*$/) {
- $datapagingadd = " " . $1 . "pageddata";
- }
- } elsif ($datapagingadd and !$codepagingadd) {
- if ($line =~ /\b(un)?paged(code)?\b\s*$/) {
- $codepagingadd = " " . $1 . "pagedcode";
- }
- }
- if ($datapagingadd or $datapagingadd) {
- $line =~ s/\b(un)?paged(code|data)?\b/ /ig;
- }
- }
- push @newlines, "$line$codepagingadd$datapagingadd\n";
- }
- @$oby = @newlines;
-}
-
-1;
--- a/imgtools/buildrom/tools/featuredatabase.dtd Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-<!--
-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:
-
--->
-<!ELEMENT hrhmacro EMPTY>
-<!ATTLIST hrhmacro
- exclude CDATA #IMPLIED
- include CDATA #IMPLIED
- infeaturesetiby CDATA #IMPLIED>
-
-<!ELEMENT hfileheader (#PCDATA)>
-<!ATTLIST hfileheader
- interfacestatus CDATA #REQUIRED
- interfacevisibility CDATA #REQUIRED>
-
-<!ELEMENT featureset ((hfileheader?, feature+))>
-<!ATTLIST featureset
- hfilename CDATA #IMPLIED
- ibyname CDATA #IMPLIED
- namespace CDATA #IMPLIED>
-
-<!ELEMENT featuredatabase ((featureset+, defaultfeaturerange*))>
-<!ELEMENT feature ((hrhmacro?, comment?))>
-<!ATTLIST feature
- name CDATA #REQUIRED
- statusflags CDATA #REQUIRED
- uid CDATA #REQUIRED
- userdata CDATA #IMPLIED>
-
-<!ELEMENT defaultfeaturerange ((comment?))>
-<!ATTLIST defaultfeaturerange
- higheruid CDATA #REQUIRED
- loweruid CDATA #REQUIRED>
-
-<!ELEMENT comment (#PCDATA)>
--- a/imgtools/buildrom/tools/featureuids.dtd Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-<!--
-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:
-
--->
-
-<!ELEMENT featureuids (features,default)>
-<!ELEMENT features (feature+)>
-<!ELEMENT feature EMPTY>
-
-<!ATTLIST feature
- name CDATA #REQUIRED
- uid CDATA #REQUIRED
- installable (true|false) #IMPLIED>
-
-<!ELEMENT default (range+)>
-<!ELEMENT range EMPTY>
-<!ATTLIST range
- min CDATA #REQUIRED
- max CDATA #REQUIRED
- support (include|exclude) #REQUIRED>
-
--- a/imgtools/buildrom/tools/imageContent.dtd Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,89 +0,0 @@
-<!--
-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:
-
--->
-<!ELEMENT imageContent (version?, romchecksum?, time?,
- options?, romgeometry, romtarget, romscope?)+>
-
-<!ELEMENT version (#PCDATA)>
-<!ELEMENT romchecksum (#PCDATA)>
-<!ELEMENT time (#PCDATA)>
-<!ELEMENT romgeometry (image+)>
-<!ELEMENT romtarget (target+)>
-<!ELEMENT romscope ((obyFile|cdf)+)>
-
-<!ELEMENT options ((binaryselectionorder | trace | bootbinary |
- dataaddress | debugport |
- defaultstackreserve | device |
- wrapper | kernel | primary+ |
- secondary+ | romalign | romlinearbase |
- variant | autosize | extension | coreimage)+)>
-
-<!ELEMENT binaryselectionorder (#PCDATA)>
-<!ELEMENT trace (#PCDATA)>
-<!ELEMENT bootbinary (#PCDATA)>
-<!ELEMENT wrapper (#PCDATA)>
-<!ATTLIST wrapper type (none|epoc|coff) #REQUIRED>
-
-<!ELEMENT kernel (dataaddress, heapmax, heapmin, name, trace?)>
-<!ATTLIST kernel number (single|multi) #IMPLIED>
-
-<!ELEMENT heapmax (#PCDATA)>
-<!ELEMENT heapmin (#PCDATA)>
-<!ELEMENT name (#PCDATA)>
-
-<!ELEMENT dataaddress (#PCDATA)>
-<!ELEMENT debugport (#PCDATA)>
-<!ELEMENT defaultstackreserve (#PCDATA)>
-<!ELEMENT device (file+)>
-<!ELEMENT primary (file+)>
-<!ELEMENT secondary (file+)>
-<!ELEMENT variant (file+)>
-<!ELEMENT extension (file+)>
-<!ELEMENT romalign (#PCDATA)>
-<!ELEMENT romlinearbase (#PCDATA)>
-<!ELEMENT autosize (#PCDATA)>
-<!ELEMENT coreimage (#PCDATA)>
-
-<!ELEMENT file (source,destination,fixed?)>
-<!ATTLIST file
- id CDATA #REQUIRED>
-<!ELEMENT source (#PCDATA)>
-<!ELEMENT destination (#PCDATA)>
-<!ELEMENT fixed (#PCDATA)>
-
-
-<!ELEMENT image (partition?)>
-<!ATTLIST image
- id CDATA #REQUIRED
- name CDATA #REQUIRED
- type (xip|nonxip) #REQUIRED
- compression (compress|nocompress) #IMPLIED
- extension (yes|no) "no"
- size CDATA #REQUIRED>
-
-<!ELEMENT target (include,exclude?)>
-<!ATTLIST target imageid CDATA #REQUIRED>
-<!--- target imageid of any allowed where it there is no constraints on
- which image the files should be placed. -->
-<!ELEMENT include ((feature|obyFile|cdf)+)>
-<!ELEMENT exclude (feature+)>
-<!ELEMENT partition (#PCDATA)>
-<!ELEMENT feature EMPTY>
-<!ATTLIST feature name CDATA #IMPLIED
- uid CDATA #IMPLIED>
-<!ELEMENT obyFile (#PCDATA)>
-<!ELEMENT cdf (#PCDATA)>
-<!ATTLIST cdf type (file|dir) "file">
--- a/imgtools/imgcheck/src/depreporter.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,234 +0,0 @@
-/*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* Reports Executable Dependency
-*
-*/
-
-
-/**
- @file
- @internalComponent
- @released
-*/
-#include "depreporter.h"
-
-/**
-Constructor: DepReporter class
-Initilize the parameters to data members.
-
-@internalComponent
-@released
-
-@param aMap - Reference to map data
-@param aReportType - Reference to report type.
-@param aXmlFile - Pointer to xml file name.
-*/
-DepReporter::DepReporter(const StringVsMapOfExeVsDep& aMap, const unsigned int& aReportType, const char* aXmlFile)
-: Reporter(aReportType,aXmlFile), iReportData(aMap)
-{
-}
-
-
-/**
-Destructor: DepReporter class
-
-@internalComponent
-@released
-*/
-DepReporter::~DepReporter()
-{
-}
-
-
-/**
-Generates the Report of mentioned type.
-
-Checks the validty of input data.
-Construct the report objects(Based on options).
-Traverse the Map and generate the report.
-
-@internalComponent
-@released
-
-@return Status - returns the status of the depreporter.
- 'true' - for sucessful completion of the report.
-*/
-bool DepReporter::CreateReport()
-{
- try
- {
- // Check for the empty map.
- if (iReportData.empty() != 0)
- {
- throw ExceptionReporter(NODATATOREPORT);
- }
- // Check for valid Xml filename for report generation.
- if (iReportType & XML_REPORT)
- {
- if (iXmlFileName.size() <= 0)
- {
- throw ExceptionReporter(XMLNAMENOTVALID);
- }
- }
- ConstructReportObjects();
- ProcessMapData();
- }
- catch (ExceptionReporter& aErrorReport)
- {
- throw aErrorReport;
- }
- return true;
-}
-
-
-/**
-Traverse the map and Creates the report.
-Both rom and rofs image is supported.
-
-@internalComponent
-@released
-*/
-void DepReporter::ProcessMapData(void)
-{
- StringVsMapOfExeVsDep::const_iterator aIterMapBegin = iReportData.begin();
- StringVsMapOfExeVsDep::const_iterator aIterMapEnd = iReportData.end();
- const ExeNamesVsDepMapData* exeNamesVsDepMapDataAddress = 0;
- ExeNamesVsDepMapData::const_iterator aIterExeNameBegin;
- ExeNamesVsDepMapData::const_iterator aIterExeNameEnd;
- const NameVsDepStatusData* nameVsDepStatusDataAddress = 0;
- NameVsDepStatusData::const_iterator aIterNameVsDepBegin;
- NameVsDepStatusData::const_iterator aIterNameVsDepEnd;
-
- ConstructReport(KReportStart);
-
- for (; aIterMapBegin != aIterMapEnd ; ++aIterMapBegin)
- {
- //If no dependency data found don't display the empty report
- if(((*aIterMapBegin).second).size() == 0)
- {
- ExceptionReporter(NOMISSINGDEPS, (char*)(*aIterMapBegin).first.c_str()).Report();
- continue;
- }
- ConstructReport(KReportStartElementHeader,aIterMapBegin->first);
- exeNamesVsDepMapDataAddress = &aIterMapBegin->second;
- if(exeNamesVsDepMapDataAddress->empty() != 0)
- {
- ConstructReport(KReportEndElementHeader);
- continue;
- }
- aIterExeNameBegin = exeNamesVsDepMapDataAddress->begin();
- aIterExeNameEnd = exeNamesVsDepMapDataAddress->end();
-
- // Traverse the executable.
- for( ; aIterExeNameBegin != aIterExeNameEnd ; ++aIterExeNameBegin)
- {
-
- ConstructReport(KReportStartExecutable,"",aIterExeNameBegin->first);
- nameVsDepStatusDataAddress = &aIterExeNameBegin->second;
- if(nameVsDepStatusDataAddress->empty() != 0)
- {
- ConstructReport(KReportEndExecutable);
- continue;
- }
- aIterNameVsDepBegin = nameVsDepStatusDataAddress->begin();
- aIterNameVsDepEnd = nameVsDepStatusDataAddress->end();
-
- // Traverse the dependencies.
- for(; aIterNameVsDepBegin != aIterNameVsDepEnd ; ++aIterNameVsDepBegin)
- {
- ConstructReport(KReportWriteDependency,"",
- "", aIterNameVsDepBegin->first,
- aIterNameVsDepBegin->second);
- }
- ConstructReport(KReportEndExecutable);
- }
- ConstructReport(KReportEndElementHeader);
- ConstructReport(KReportWriteNote);
- }
- ConstructReport(KReportEnd);
-}
-
-
-/**
-Writes the Report sections to the report objects.
-
-@internalComponent
-@released
-
-@param aReportSection - Reference to Report section
-@param aImageName - Reference to Image Name string.
-@param aExeName - Reference to Executable string.
-@param aDepName - Reference to Dependency Name string.
-@param aDepStatus - Reference to Dependency Status string.
-*/
-void DepReporter::ConstructReport(EReportSection aReportSection, const String& aImageName,
- const String& aExeName, const String& aDepName,
- const String& aDepStatus)
-{
- ReportWriter* iReportBasePointer = 0;
- int count = iReportObjectList.size();
- while(count)
- {
- iReportBasePointer = (ReportWriter*)iReportObjectList[count-1];
- switch(aReportSection)
- {
- // Start Report document.
- case KReportStart :
- iReportBasePointer->StartReport();
- break;
-
- // End Report document.
- case KReportEnd :
- iReportBasePointer->EndReport();
- break;
-
- // Start element header info.
- case KReportStartElementHeader :
- iReportBasePointer->StartElementHeader(aImageName);
- iReportBasePointer->WriteImageHeader(KCmdDependencyHeader);
- break;
-
- // End element header info.
- case KReportEndElementHeader :
- iReportBasePointer->EndElementHeader();
- break;
-
- // Start Executable info.
- case KReportStartExecutable :
- iReportBasePointer->StartExecutable(aExeName);
- break;
-
- // End Executable info.
- case KReportEndExecutable :
- iReportBasePointer->EndExecutable();
- break;
-
- // Write element details
- case KReportWriteDependency :
- iReportBasePointer->WriteElementDependencies(aDepName, aDepStatus);
- break;
-
- // Write a note about unknown dependency
- case KReportWriteNote :
- iReportBasePointer->WriteNote();
- break;
-
- // Do nothing..
- default :
- break;
- }
- --count;
- }
-}
Binary file imgtools/imglib/boostlibrary/binary/linux/libboost_thread-mgw34-mt-1_39.a has changed
Binary file imgtools/imglib/boostlibrary/binary/windows/libboost_thread-mgw34-mt-1_39.a has changed
--- a/imgtools/imglib/filesystem/include/cluster.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* Cluster class for FileSystem component
-* @internalComponent
-* @released
-*
-*/
-
-
-#ifndef CLUSTER_H
-#define CLUSTER_H
-
-#include "errorhandler.h"
-#include "directory.h"
-
-typedef multimap <unsigned int,unsigned int> TClustersPerEntryMap;
-
-/*
- * This class is used by classes CDirRegion and CLongName. This class describes
- * the basic Data members and Member functions related to cluster number
- * allocation and FAT input map creation.
- *
- * @internalComponent
- * @released
- */
-
-class CCluster
-{
- public:
- static CCluster* Instance (unsigned int aClusterSize,
- unsigned int aTotalNumberOfClusters);
-
- unsigned int GetCurrentClusterNumber() const;
- void DecrementCurrentClusterNumber();
- unsigned short int GetHighWordClusterNumber() const;
- unsigned short int GetLowWordClusterNumber() const;
- void CreateMap(unsigned int aStartingClusterNumber,unsigned int aPairClusterNumber);
- TClustersPerEntryMap* GetClustersPerEntryMap();
- void UpdateNextAvailableClusterNumber();
- unsigned int GetClusterSize() const;
- ~CCluster ();
-
- private:
- CCluster(unsigned int aClusterSize,
- unsigned int aTotalNumberOfClusters);
- static CCluster* iClusterInstance;
-
- unsigned long int iClusterSize;
- unsigned int iRootClusterNumber;
- unsigned int iCurrentClusterNumber;
- unsigned int iTotalNumberOfClusters;
-
-
- /* used to store the mapping of Starting cluster and Number's of
- * clusters occupied by the specific entry
- */
- TClustersPerEntryMap iClustersPerEntry;
-};
-
-#endif //CLUSTER_H
--- a/imgtools/imglib/filesystem/include/constants.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,183 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* Constants used by FileSystem component
-* @internalComponent
-* @released
-* This file contains common constants used by FileSystem component
-*
-*/
-
-
-#ifndef CONSTANTS_H
-#define CONSTANTS_H
-
-/*
- * mingw.inl is included to avoid the below mentioned error throwned by mingw compiler.
- * "stl_construct.h: error: no matching function for call to `operator new(unsigned int, void*)'"
- */
-#include "mingw.inl"
-#include "utils.h"
-
-//This constant is used to track the FileSystem component version information.
-const int KFileSystemMajorVersion = 1;
-const int KFileSystemMinorVersion = 1;
-
-#define KDefaultVolumeLabel "NO NAME "
-#define KDefaultOEMName "SYMBIAN "
-
-const int KSectorsPerBootSector = 1;
-
-/* Total number of reserved clusters which is always two as cluster 0 and 1
- * are never used by data segment for file or directory writing
- */
-const int KReservedClusters = 2;
-
-//Offset just after the end of boot sector w.r.t to the start of a FAT Volume
-const int KBootSectorOffset = 512;
-
-//size of the first reserved field in FSInfo data structure
-const int KFSIFutureExpansion=480;
-
-//size of the second reserved field in FSInfo data structure
-const int KFSIKFSIFutureExpansion2=12;
-
-//size of reserved field in FAT32 media
-const int KMaxSizeFutureExpansion=12;
-
-//size of volume label in boot sector
-const int KMaxVolumeLabel=11;
-const int KBPBMedia =0xF8;
-const unsigned short KDefaultBytesPerSector=512;
-
-// default sector per clusters for FAT16 image
-const unsigned char KDefaultSectorsPerCluster=2;
-
-// default sector per clusters for FAT32 image
-const unsigned char KDefaultSectorsPerCluster32=1;
-
-//default number of FAT tables
-const unsigned char KDefaultNumFats =2;
-
-// default number of root directories entries for FAT32 image
-const unsigned short KDefaultRootDirEntries=512;
-
-const unsigned short KFat32RootDirEntries=0;
-const unsigned int KSizeOfFatBootSector=512;
-const unsigned char KDefaultReservedByte=0x00;
-
-//size of the string defining the FileSystem type
-const unsigned int KFileSysTypeLength=8;
-const unsigned int KBootSectorSignature=0xAA55;
-const unsigned int KDefaultRootDirClusterNumber=0x0002;
-const unsigned char KDefaultDriveNumber=0x80;
-
-//Default extended boot signature to be specified in boot sector
-const unsigned char KDefaultBootSignature=0x29;
-const unsigned short KDefaultVersion=0;
-const unsigned int KDefaultHiddenSectors= 0;
-const unsigned short KDefaultSectorsPerTrack=0;
-const unsigned short KDefaultNumHeads=0;
-
-//default value of flags to be specified in FAT32 boot sector
-const unsigned short KDefaultExtFlags=0;
-
-//sector number containing the FSInfo data structure in FAT32 volume
-const unsigned short KDefaultFSInfoSector=1;
-
-//sector number to be occupied by backup boot sector in FAT32 volume
-const unsigned short KDefaultBkUpBootSec=6;
-const unsigned short KDefaultFat32ReservedSectors=32;
-const unsigned short KDefaultFat16ReservedSectors=1;
-
-//constant used in FAT table entries
-const unsigned short EOF16 = 0xffff;
-const unsigned short KFat16FirstEntry = 0xfff8;
-const unsigned int EOF32 = 0x0fffffff;
-const unsigned int KFat32FirstEntry =0x0ffffff8;
-const unsigned short KEmptyFATCluster=0;
-
-//minimum and maximum number of FAT32 cluster
-const unsigned int KMinimumFat32Clusters= 65525;
-/* Since Sector size as taken as 512 bytes(Mostly followed), total clusters supported
- * by FAT32 is limited to 67092480 otherwise it is 268435456. Here 67092480 clusters
- * will cover up to 2047.9999GB of user input partition size.
- */
-const unsigned int KMaximumFat32Clusters= 67092480;
-
-
-//minimum and maximum number of FAT16 cluster
-const unsigned int KMinimumFat16Clusters= 4085;
-const unsigned int KMaximumFat16Clusters=65524;
-
-//Partition range constants
-const Long64 K16MB = 0x1000000;
-const Long64 K64MB = 0x4000000;
-const Long64 K128MB =0x8000000;
-const Long64 K256MB =0x10000000;
-const Long64 K260MB =0x10400000;
-const Long64 K512MB =0x20000000;
-const Long64 K1GB =0x40000000;
-const Long64 K2GB =0x80000000;
-#ifdef _MSC_VER
- const Long64 K8GB =0x200000000;
- const Long64 K16GB =0x400000000;
- const Long64 K32GB =0x800000000;
-#else
- const Long64 K8GB =0x200000000LL;
- const Long64 K16GB =0x400000000LL;
- const Long64 K32GB =0x800000000LL;
-#endif
-
-//Bytes per sector selection constants
-const short int K1SectorsPerCluster = 0x01;
-const short int K2SectorsPerCluster = 0x02;
-const short int K4SectorsPerCluster = 0x04;
-const short int K8SectorsPerCluster = 0x08;
-const short int K16SectorsPerCluster = 0x10;
-const short int K32SectorsPerCluster = 0x20;
-const short int K64SectorsPerCluster = 0x40;
-
-const int KParentDirClusterNumber = 0x0;
-const int KCurrentDirClusterNumber = 0x01;
-const short int KFat32RootEntryNumber = 0x02;
-const short int KFat16RootEntryNumber = 0x01;
-const short int KRootClusterNumber = 0x02;
-
-const short int KDirectoryEntrySize = 0x20;
-const short int KZeroFileSize = 0x00;
-const short int KEntryNameSize = 0x3c;
-const short int KFilePathMaxSize = 0xFF;
-const short int KWriteOnce = 0x01;
-
-const long int KHighWordMask = 0x0000FFFF;
-const short int KBitShift16 = 0x10;
-const short int KNTReserverdByte = 0x00;
-
-const short int KPaddingCharCnt = 0x02;
-
-const char KSpace = 0x20;
-const char KDot = 0x2E;
-const char KTilde = 0x7E;
-const char KTildeNumber = 0x31;
-const char KCreateTimeInMsecs = 0x00;
-
-const unsigned char KLongNamePaddingChar = 0xFF;
-const char KNullPaddingChar = 0x00;
-
-const char KDirSubComponent = 0x00;//Dir sub component constant
-const char KLongNameCharSeperator = 0x00;//Long sub component Name characters separated by 0x00
-
-
-#endif //CONSTANTS_H
--- a/imgtools/imglib/filesystem/include/directory.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,189 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* Directory operations for FileSystem component
-* @internalComponent
-* @released
-*
-*/
-
-
-#ifndef DIRECTORY_H
-#define DIRECTORY_H
-
-#include "utils.h"
-
-/* If the macro _FILESYSTEM_DLL is defined, then the macro FILESYSTEM_API is used to
- * export the functions. Hence while building the DLL this macro should be used.
- * Else if the macro _USE_FILESYSTEM_DLL is defined, then the macro FILESYSTEM_API is
- * used to import the functions. Hence while linking this macro should be used.
- * If none of the above macros defined, then the macro FILESYSTEM_API is defined empty
- * and it is used for creating static library.
- * The purpose of using multiple macros is to deliver both the static and dynamic
- * libraries from the same set of source files.
- */
-#ifdef _FILESYSTEM_DLL
- #define FILESYSTEM_API __declspec(dllexport)
-#elif _USE_FILESYSTEM_DLL
- #define FILESYSTEM_API __declspec(dllimport)
-#else
- #define FILESYSTEM_API
-#endif
-
-#include <list>
-#include <stack>
-#include <time.h>
-
-class CDirectory;
-class CLongEntry;
-
-typedef list<CDirectory*> EntryList;
-
-//Directory, file and volume Attributes
-enum KAttributes
-{
- EAttrReadOnly = 0x01,
- EAttrHidden = 0x02,
- EAttrSystem = 0x04,
- EAttrVolumeId = 0x08,
- EAttrDirectory = 0x10,
- EAttrArchive = 0x20,
- EAttrLongName = EAttrReadOnly | EAttrHidden | EAttrSystem | EAttrVolumeId,
- EAttrLongNameMask = EAttrReadOnly | EAttrHidden | EAttrSystem | EAttrVolumeId \
- | EAttrDirectory | EAttrArchive,
- ELastLongEntry = 0x40
-};
-
-//Time format, should be written as a integer in FAT image
-typedef struct
-{
- unsigned short int Seconds:5;
- unsigned short int Minute:6;
- unsigned short int Hour:5;
-}FatTime;
-
-//Date format, should be written as a integer in FAT image
-typedef struct
-{
- unsigned short int Day:5;
- unsigned short int Month:4;
- unsigned short int Year:7;
-}FatDate;
-
-//This union convention used to convert bit fields into integer
-union TDateInteger
-{
- FatDate iCurrentDate;
- unsigned short int iImageDate;
-};
-
-//This union convention used to convert bit fields into integer
-union TTimeInteger
-{
- FatTime iCurrentTime;
- unsigned short int iImageTime;
-};
-
-struct TShortDirEntry {
- unsigned char DIR_Name [11];
- unsigned char DIR_Attr ;
- unsigned char DIR_NTRes ;
- unsigned char DIR_CrtTimeTenth ;
- unsigned char DIR_CrtTime[2] ;
- unsigned char DIR_CrtDate[2] ;
- unsigned char DIR_LstAccDate[2] ;
- unsigned char DIR_FstClusHI[2] ;
- unsigned char DIR_WrtTime[2] ;
- unsigned char DIR_WrtDate[2];
- unsigned char DIR_FstClusLO[2];
- unsigned char DIR_FileSize[4] ;
-};
-
-struct TLongDirEntry {
- unsigned char LDIR_Ord ;
- unsigned char LDIR_Name1[10] ;
- unsigned char LDIR_Attr ;
- unsigned char LDIR_Type ;
- unsigned char LDIR_Chksum ;
- unsigned char LDIR_Name2[12] ;
- unsigned char LDIR_FstClusLO[2] ;
- unsigned char LDIR_Name3[4] ;
-};
-/* This class describes the attributes of a single directory/file/volume entry.
- *
- * @internalComponent
- * @released
- */
-class CDirectory
-{
-
-public:
- FILESYSTEM_API CDirectory(const char* aEntryName,CDirectory* aParent);
- FILESYSTEM_API ~CDirectory();
- FILESYSTEM_API EntryList* GetEntryList();
- FILESYSTEM_API void InsertIntoEntryList(CDirectory* aEntry);
- FILESYSTEM_API void SetFilePath(char* aFilePath);
- FILESYSTEM_API string GetFilePath() const;
- FILESYSTEM_API void SetEntryName(string aEntryName);
- FILESYSTEM_API string GetEntryName() const;
- FILESYSTEM_API void SetEntryAttribute(char aAttribute);
- FILESYSTEM_API char GetEntryAttribute() const;
- char GetNtReservedByte() const;
- char GetCreationTimeMsecs() const;
- unsigned short int GetCreatedTime() const;
- unsigned short int GetCreationDate() const;
- unsigned short int GetLastAccessDate() const;
- unsigned short int GetClusterNumberHi() const;
- void SetClusterNumberHi(unsigned short int aHiClusterNumber);
- unsigned short int GetClusterNumberLow() const;
- void SetClusterNumberLow(unsigned short int aLowClusterNumber);
- unsigned short int GetLastWriteDate() const;
- unsigned short int GetLastWriteTime() const;
- FILESYSTEM_API void SetFileSize(unsigned int aFileSize);
- FILESYSTEM_API unsigned int GetFileSize() const;
- bool IsFile() const ;
- FILESYSTEM_API CDirectory* GetParent()const {
- return iParent ;
- }
- FILESYSTEM_API bool GetShortEntry(TShortDirEntry& rEntry) ;
- FILESYSTEM_API bool GetLongEntries(list<TLongDirEntry>& rEntries) ;
-private:
- void InitializeTime();
- void MakeUniqueShortName(unsigned char* rShortName,size_t aWavPos) const ;
-private:
- string iEntryName; //Directory or file name
- unsigned char iShortName[12] ;
- char iAttribute; //To mention file or directory or Volume
- char iNtReserved; //Reserved for use by windows NT, this value always zero
- char iCreationTimeMsecs; /**Millisecond stamp at file creation time, Since this is not
- so important, always initialized to zero*/
- unsigned short int iCreatedTime; //Time file was created
- unsigned short int iCreationDate; //Date file was created
- unsigned short int iLastAccessDate; //Date file was last accessed
- unsigned short int iClusterNumberHi;//High word of this entry's first cluster number
- unsigned short int iClusterNumberLow;//Low word of this entry's first cluster number
- unsigned short int iLastWriteDate; //Date file was written
- unsigned short int iLastWriteTime; //Time file was written
- unsigned int iFileSize; //file size
- EntryList iDirectoryList; //List Template used to hold subdirectories
-
- string iFilePath; //Holds file path only if the entry is of type "file"
-
- struct tm* iDateAndTime;
- union TTimeInteger iTime;
- union TDateInteger iDate;
- CDirectory* iParent ;
-};
-
-#endif //DIRECTORY_H
--- a/imgtools/imglib/filesystem/include/dirregion.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,90 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* CDIRREGION.H
-* Directory Region Operations for FileSystem component
-* @internalComponent
-* @released
-*
-*/
-
-
-#ifndef DIRREGION_H
-#define DIRREGION_H
-
-#include "filesystemclass.h"
-#include "longname.h"
-
-#include <fstream>
-#include <map>
-#include <string>
-
-class CFileSystem;
-
-typedef ofstream OfStream;
-typedef ifstream IfStream;
-typedef ios Ios;
-typedef map<unsigned int,string> StringMap;
-
-/**
-This class describes the member functions and data members required to create directory/data
-region of FAT image.
-
-@internalComponent
-@released
-*/
-
-class CDirRegion
- {
- private:
- unsigned int Get32BitClusterNumber(unsigned int aHighWord, unsigned int aLowWord);
- void CheckEntry(EntryList aNodeList);
- void CreateDirEntry(CDirectory* aEntry,unsigned int aParentDirClusterNumber);
- void CreateAndWriteCurrentDirEntry(unsigned int aCurClusterNumber,string& aString);
- void CreateAndWriteParentDirEntry(unsigned int aParDirClusterNumber,string& aString);
- void WriteFileDataInToCluster(CDirectory* aEntry);
- void PushStringIntoClusterMap(unsigned int aNumber,
- string& aDirString,
- unsigned long int aClusterSize,
- char aAttribute);
- void PushDirectoryEntryString(unsigned int aNumber,string& aString,int aClustersRequired);
-
- public:
- CDirRegion( EntryList iNodeList,
- CFileSystem *aFileSystemPtr);
- ~CDirRegion();
- void Execute();
- void WriteClustersIntoFile(OfStream& aOutPutStream);
- TClustersPerEntryMap* GetClustersPerEntryMap() const;
-
- private:
- IfStream iInputStream; //Input stream, used to read file contents
- CCluster* iClusterPtr; //pointer to class CCluster
- bool iCurrentDirEntry; //Is current entry(.) is created?
- bool iParentDirEntry;//Is parent entry (..) is created?
- bool iFirstCluster; //Is this the first cluster for the current FAT image?
-
- unsigned int iCurEntryClusterNumber; //Holds current entries cluster number
- unsigned int iClusterKey; //Number used to map cluster with cluster contents
- /* To avoid calling CCluster::GetClusterSize() function multiple times, this
- *variable introduced.
- */
- unsigned long int iClusterSize;
-
- StringMap iClusterMap; //The map between cluster number and cluster
- unsigned int iRootDirSizeInBytes;//Reserved sectors for root directory entry
- EntryList iNodeList;//To hold root directory entry
- };
-
-#endif //DIRREGION_H
--- a/imgtools/imglib/filesystem/include/errorhandler.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* Error Handler Class for FileSystem component
-* @internalComponent
-* @released
-*
-*/
-
-
-#ifndef ERRORHANDLER_H
-#define ERRORHANDLER_H
-
-#include "messagehandler.h"
-#include "constants.h"
-#include <iostream>
-#include <stdio.h>
-
-/**
-Class for Error handling
-
-@internalComponent
-@released
-*/
-class ErrorHandler
-{
- public:
- ErrorHandler(int aMessageIndex,char* aSubMessage,char* aFileName, int aLineNumber);
- ErrorHandler(int aMessageIndex, char* aFileName, int aLineNumber);
- virtual ~ErrorHandler();
- void Report();
-
- string iMessage;
- int iMessageIndex;
- string iSubMessage;
- string iFileName;
- int iLineNumber;
-};
-
-#endif //ERRORHANDLER_H
--- a/imgtools/imglib/filesystem/include/fat16bootsector.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* FAT16 boot sector Class for FileSystem component
-* @internalComponent
-* @released
-*
-*/
-
-
-#ifndef FAT16BOOTSECTOR_H
-#define FAT16BOOTSECTOR_H
-
-#include "fatbasebootsector.h"
-
-/**
-Class representing Boot Sector of FAT16 types of fat volume.
-
-@internalComponent
-@released
-*/
-class TFAT16BootSector : public TFATBaseBootSector
-{
-
-public:
- TFAT16BootSector();
- ~TFAT16BootSector();
- unsigned char* FileSysType();
- void SetFileSysType();
- void SetRootDirEntries();
- void SetReservedSectors();
- void ComputeSectorsPerCluster(Long64 aPartitionSize);
- void ComputeFatSectors(Long64 aPartitionSize);
-};
-
-#endif //FAT16BOOTSECTOR_H
-
--- a/imgtools/imglib/filesystem/include/fat16filesystem.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* FAT16 file system Class for FileSystem component
-* @internalComponent
-* @released
-*
-*/
-
-
-#ifndef FAT16FILESYSTEM_H
-#define FAT16FILESYSTEM_H
-
-#include "filesystemclass.h"
-#include "errorhandler.h"
-#include "dirregion.h"
-#include"filesysteminterface.h"
-
-/**
-Class representing concrete class representing FAT16 type
-
-@internalComponent
-@released
-*/
-
-class CFat16FileSystem : public CFileSystem
-{
-private:
- TFAT16BootSector iFAT16BootSector;
- //use to contain the data structure used to create a FAT Table
- TClustersPerEntryMap* iClustersPerEntry;
-
-public:
- CFat16FileSystem (){};
- ~CFat16FileSystem(){};
- void CreateBootSector(Long64 aPartitionSize,ConfigurableFatAttributes* aConfigurableFatAttributes);
- void WriteBootSector(ofstream& aOutPutStream);
- void CreateFatTable(ofstream& aOutPutStream);
- void ComputeClusterSizeInBytes();
- void ComputeRootDirSectors();
- void ComputeBytesPerSector();
- void ComputeTotalClusters(Long64 aPartitionSize);
- void Execute(Long64 aPartitionSize,EntryList aNodeList,
- ofstream& aOutPutStream,ConfigurableFatAttributes* aConfigurableFatAttributes);
- void ErrorExceptionClean();
-};
-#endif //FAT16FILESYSTEM_H
--- a/imgtools/imglib/filesystem/include/fat32bootsector.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* FAT32 boot sector Class for FileSystem component
-* @internalComponent
-* @released
-*
-*/
-
-
-#ifndef FAT32BOOTSECTOR_H
-#define FAT32BOOTSECTOR_H
-
-#include "fatbasebootsector.h"
-
-/**
-Class representing Boot Sector of FAT32 types of fat volume.
-
-@internalComponent
-@released
-*/
-class TFAT32BootSector: public TFATBaseBootSector
-{
-public:
- TFAT32BootSector();
- ~TFAT32BootSector();
- void SetRootDirEntries();
- void SetFileSysType();
- void SetReservedSectors();
- void ComputeSectorsPerCluster(Long64 aPartitionSize);
- void ComputeFatSectors(Long64 aPartitionSize);
- void SetExtFlags();
- unsigned short ExtFlags();
- void SetFileSystemVersion();
- unsigned short FileSystemVersion();
- void SetRootCluster();
- unsigned int RootCluster();
- void SetFSInfo();
- unsigned short FSInfo();
- void SetBackUpBootSector();
- unsigned short BackUpBootSector();
- void SetFutureReserved();
- unsigned char* FutureReserved();
- unsigned char* FileSysType();
-
-protected:
- unsigned short iExtFlags;
- unsigned short iFileSystemVersion; //revision number
- unsigned int iRootCluster;
- unsigned short iFSInfo; //FSINFo structure sector number
- unsigned short iBackUpBootSector; //Sector area of the reserved area of the volume
- unsigned char iFutureReserved[KMaxSizeFutureExpansion];
-};
-
-
-
-#endif //FAT32BOOTSECTOR_H
--- a/imgtools/imglib/filesystem/include/fat32filesystem.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,116 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* FAT32 file system Class for FileSystem component
-* @internalComponent
-* @released
-*
-*/
-
-
-#ifndef FAT32FILESYSTEM_H
-#define FAT32FILESYSTEM_H
-
-#include "filesystemclass.h"
-#include "errorhandler.h"
-#include "dirregion.h"
-#include "filesysteminterface.h"
-
-// constant values to initialize FSInfo data structure
-const unsigned int KFSIleadSign=0x41615252;
-const unsigned int KFSIStrutSign=0x61417272;
-const unsigned int KFSIFreeCount=0xFFFFFFFF;
-const unsigned int KFSITrailSign=0xAA550000;
-
-//sector number containing copy of FAT Table and Boot sector
-const unsigned int KBootBackupSector=6;
-const unsigned int KFatBackupSector=7;
-
-/**
-Class representing FSINFO DataStrcuture
-
-@internalComponent
-@released
-*/
-class FSInfo
-{
-
-public:
- void SetFSInfo();
-public:
- //lead signature use to validate a FSInfo structure
- unsigned int FSI_LeadSign;
- //field for future expansion
- unsigned char FSI_Reserved[KFSIFutureExpansion];
- //another signature
- unsigned int FSI_StrucSig;
- //contains the last known free cluster count on the volume
- unsigned int FSI_Free_Count;
- //indicates the cluster number at which the driver should start looking for free clusters
- unsigned int FSI_Nxt_Free;
- //reserved for future expansion
- unsigned int FSI_Reserved2[KFSIKFSIFutureExpansion2];
- //use to validate that this is an fact an FSInfo sector
- unsigned int FSI_TrailSig;
-
-};
-
-// Use to initialize the FSInfo data structure
-inline void FSInfo::SetFSInfo()
-{
- FSI_LeadSign=KFSIleadSign;
- for(int i=0;i<KFSIFutureExpansion;i++)
- FSI_Reserved[i]=0;
- FSI_StrucSig=KFSIStrutSign;
- FSI_Free_Count=KFSIFreeCount;
- FSI_Nxt_Free=KFSIFreeCount;
- for(int j=0;j<KFSIKFSIFutureExpansion2;j++)
- FSI_Reserved2[j]=0;
- FSI_TrailSig=KFSITrailSign;
-}
-/**
-Class representing concrete class representing FAT32 type
-@internalComponent
-@released
-*/
-class CFat32FileSystem : public CFileSystem
-{
-public:
- CFat32FileSystem(){};
- ~CFat32FileSystem();
-
-public:
- void CreateBootSector(Long64 aPartitionSize,ConfigurableFatAttributes* aConfigurableFatAttributes);
- void WriteBootSector(ofstream& aOutPutStream);
- void CreateFatTable(ofstream& aOutPutStream);
- void CreateFSinfoSector(ofstream& aOutPutStream);
- void RestReservedSectors(ofstream& aOutPutStream);
- void ComputeClusterSizeInBytes();
- void ComputeRootDirSectors();
- void ComputeBytesPerSector();
- void ComputeTotalClusters(Long64 aPartitionSize);
- void Execute(Long64 aPartitionSize,EntryList aNodeList,
- ofstream& aOutPutStream,ConfigurableFatAttributes* aConfigurableFatAttributes);
- void ErrorExceptionClean();
-
-private:
- TFAT32BootSector iFAT32BootSector;
- //use to contain the data structure used to create a FAT Table
- TClustersPerEntryMap* iClustersPerEntry;
- FSInfo iFSInfo; //FSInfo data structure
- //Pointer to dynamic array representing the content of FSInfo data structure
- unsigned char* FSinfoData;
-};
-
-#endif //FAT32FILESYSTEM_H
--- a/imgtools/imglib/filesystem/include/fatbasebootsector.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* FAT base boot sector class for FileSystem component
-* @internalComponent
-* @released
-*
-*/
-
-
-#ifndef FATBPBSECTOR_H
-#define FATBPBSECTOR_H
-
-#include "errorhandler.h"
-#include <string>
-#include <time.h>
-
-using namespace std;
-
-/**
-Class representing common fields of Boot Sector of all three fat system volume type.
-
-@internalComponent
-@released
-*/
-class TFATBaseBootSector
-
-{
-protected:
- //jump instruction to boot code
- unsigned char iJmpBoot[3];
- unsigned char iOEMName[8] ;
- unsigned short iBytesPerSector;
- unsigned int iHiddenSectors;
- unsigned char iMedia; //Media Type
- unsigned char iNumberOfFats;
- unsigned short iNumHeads; //number of heads for interrupt 0x13
- unsigned short iSectorsPerTrack; //sector per track for interrupt ox13
- unsigned short iTotalSectors; //16 bit total count of sectors on the volume
- unsigned int iTotalSectors32; //32 bit total count of sectors on the volume
- unsigned char iPhysicalDriveNumber;
- unsigned char iReservedByte;
- unsigned char iBootSign; //extended boot signature
- unsigned int iVolumeId;
- unsigned char iVolumeLabel[KMaxVolumeLabel];
- unsigned short iRootDirEntries;
- unsigned short iReservedSectors;
- unsigned char iSectorsPerCluster;
- unsigned int iFatSectors; //count of sectors occupied by FAT in FAT16 volume
- unsigned int iFatSectors32; //count of sectors occupied by FAT in FAT32 volume
- unsigned char iFileSysType[KFileSysTypeLength];
-public:
- TFATBaseBootSector();
- virtual ~TFATBaseBootSector();
- //Get methods
- unsigned char* JumpInstruction() ;
- unsigned char* OEMName() ;
- unsigned int BytesPerSector() const;
- unsigned int FatSectors32() const;
- unsigned short FatSectors() const;
- unsigned char NumberOfFats() const;
- unsigned short ReservedSectors() const;
- unsigned short RootDirEntries() const;
- unsigned char SectorsPerCluster() const;
- unsigned int TotalSectors(Long64 aPartitionSize) const;
- unsigned short LowSectorsCount() const;
- unsigned int HighSectorsCount() const;
- unsigned char Media() const;
- unsigned short SectorsPerTrack() const;
- unsigned short NumberOfHeads() const;
- unsigned int HiddenSectors() const;
- unsigned char BootSectorDriveNumber() const;
- unsigned char ReservedByte() const;
- unsigned char BootSignature() const;
- unsigned char* VolumeLab() ;
- unsigned int VolumeId() const;
- //utility functions
- int Log2(int aNum);
- //Set methods
- void SetJumpInstruction();
- void SetOEMName();
- void SetBytesPerSector(unsigned int aDriveSectorSize);
- void SetNumberOfFats(unsigned int aDriveNoOfFATs);
- void ComputeTotalSectors(Long64 aPartitionSize);
- void SetMedia();
- void SetSectorsPerTrack();
- void SetNumberOfHeads();
- void SetHiddenSectors();
- void SetBootSectorDriveNumber();
- void SetReservedByte();
- void SetBootSignature();
- void SetVolumeId();
- void SetVolumeLab(string aVolumeLable);
- //virtual methods
- virtual void SetRootDirEntries()=0;
- virtual void SetFileSysType()=0;
- virtual void SetReservedSectors()=0;
- virtual void ComputeSectorsPerCluster(Long64 aPartitionSize)=0;
- virtual void ComputeFatSectors(Long64 aPartitionSize)=0;
-};
-
-#endif //FATBPBSECTOR_H
--- a/imgtools/imglib/filesystem/include/filesystemclass.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* Base file system class for FileSystem component
-* @internalComponent
-* @released
-*
-*/
-
-
-#ifndef FIlESYSTEMCLASS_H
-#define FIlESYSTEMCLASS_H
-
-#include "cluster.h"
-#include "fat16bootsector.h"
-#include "fat32bootsector.h"
-#include "filesysteminterface.h"
-
-#include<map>
-#include <fstream>
-
-
-
-//default root cluster number
-const int KDefaultRootCluster=2;
-const int KDefaultSectorSizeinBytes=512;
-const int KDefaultRootDirEntrySize=32;
-
-
-
-typedef TClustersPerEntryMap::iterator Iterator;
-/**
-Class representing base class of all FAT type
-
-@internalComponent
-@released
-*/
-class CFileSystem
-{
-protected:
- //Pointer to dynamically allocated array for containing the boot sector values of a FAT volume
- unsigned char* iData;
- //cluster size in bytes
- unsigned long int iClusterSize;
- //number of sectors occupied by a root directory
- unsigned long iRootDirSectors;
- //total number of clusters in data segment
- unsigned long int iTotalClusters;
- unsigned int iBytesPerSector;
-
-public:
- //constructor
- CFileSystem();
- // virtual destructor
- virtual ~CFileSystem();
- virtual void CreateBootSector(Long64 aPartitionSize,ConfigurableFatAttributes* aConfigurableFatAttributes)=0 ;
- virtual void WriteBootSector(ofstream& aOutPutStream)=0 ;
- virtual void CreateFatTable(ofstream& aOutPutStream)=0;
- virtual void ComputeClusterSizeInBytes()=0;
- virtual void ComputeRootDirSectors()=0;
- virtual void ComputeTotalClusters(Long64 aPartitionSize)=0;
- virtual void Execute(Long64 aPartitionSize,EntryList aNodeList,ofstream& aOutPutStream,
- ConfigurableFatAttributes* aConfigurableFatAttributes)=0;
- unsigned long int GetTotalCluster() const;
- unsigned long GetRootDirSectors() const;
- unsigned long int GetClusterSize() const;
- unsigned int GetBytesPerSector() const;
-};
-
-#endif //FIlESYSTEMCLASS_H
--- a/imgtools/imglib/filesystem/include/filesysteminterface.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* Interface class for FileSystem component
-* @internalComponent
-* @released
-*
-*/
-
-
-#ifndef FILESYSTEMINTERFACE_H
-#define FILESYSTEMINTERFACE_H
-
-#include "directory.h"
-#include <fstream>
-
-typedef ofstream Ofstream;
-
-//default image size in Bytes
-const int KDefaultImageSize=50*1024*1024;
-
-//enum representing the file system type
-enum FILESYSTEM_API TFileSystem
-{
- EFATINVALID=0,
- EFAT12=1,
- EFAT16,
- EFAT32,
- ELFFS
-};
-
-//error code return by the file system component
-enum TErrorCodes
-{
- //File system not supported
- EFSNotSupported = -1,
- //File System general errors
- EFileSystemError = EXIT_FAILURE
-};
-
-// Configurable FAT attributes
-struct ConfigurableFatAttributes
-{
- string iDriveVolumeLabel;
- unsigned int iDriveSectorSize;
- unsigned int iDriveNoOfFATs;
-
- ConfigurableFatAttributes();
-};
-
-/**
-Interface class containing a static method exposed by the FileSystem
-component to be used by an external tools
-
-@internalComponent
-@released
-
-@param aNodeList Directory structure
-@param aFileSystem file system type
-@param aImageFileName image file name
-@param aLogFileName log file name
-@param aPartitionSize partition size in bytes
-*/
-
-class CFileSystemInterFace
-{
-private:
- static Ofstream iOutputStream;
-public:
- /**This method is exported to the external component to receive the information
- * required by the FileSystem component
- */
- static FILESYSTEM_API int CreateFilesystem( EntryList* aNodeList ,TFileSystem aFileSystem,
- char* aImageFileName,
- char* aLogFileName,
- ConfigurableFatAttributes* aConfigurableFatAttributes,
- Long64 aPartitionSize=KDefaultImageSize);
-};
-
-#endif //FILESYSTEMINTERFACE_H
--- a/imgtools/imglib/filesystem/include/longentry.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* Long entry class for FileSystem component
-* @internalComponent
-* @released
-*
-*/
-
-
-#ifndef LONGENTRY_H
-#define LONGENTRY_H
-
-/**
-This class is used to represents the single Long entry attributes.
-The long entry can be directory/file/volume entry.
-Also declares the functions to operate on them.
-
-@internalComponent
-@released
-*/
-#include "messagehandler.h"
-#include "directory.h"
-#include "constants.h"
-
-class CLongEntry
-{
-public:
- char GetDirOrder() const;
- void SetDirOrder(char aDirOrder);
- string& GetSubName1();
- void SetSubName1(string aSubName1);
- string& GetSubName2();
- void SetSubName2(string aSubName2);
- string& GetSubName3();
- void SetSubName3(string aSubName3);
- char GetAttribute() const;
- char GetCheckSum() const;
- char GetDirType() const;
- unsigned short int GetClusterNumberLow() const;
-
-private:
- char iDirOrder; //Order of this entry in the sequence of long directory entries
- string iSubName1; //character 1-5 of long name sub component
- char iAttribute; //LONG_FILE_NAME attribute
- char iDirType; //zero to mention subcomponent of directory entry
- char iCheckSum; //Check sum of Short directory entry name
- string iSubName2; //character 6-11 of long name sub component
- /* Low of cluster number, must be zero for existing disk utility compatible
- * reason
- */
- unsigned short int iFirstClusterNumberLow;
- string iSubName3; //character 12-13 of long name sub component
-
-public:
- CLongEntry(char aChckSum);
- ~CLongEntry();
-};
-
-#endif //LONGENTRY_H
--- a/imgtools/imglib/filesystem/include/longname.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* Long name class for FileSystem component
-* @internalComponent
-* @released
-*
-*/
-
-
-#ifndef LONGNAME_H
-#define LONGNAME_H
-
-#include "cluster.h"
-#include "longentry.h"
-
-#define ToString(dataInteger) reinterpret_cast<char*>(&dataInteger),sizeof(dataInteger)
-
-typedef stack<CLongEntry*> LongEntryStack;
-typedef list<string> StringList;
-
-//Long entry sub name lengths
-enum TLongSubNameLength
-{
- ESubName1Length = 5,
- ESubName2Length = 6,
- ESubName3Length = 2
-};
-
-//Name length constants
-enum TNameLength
-{
- EExtensionLength = 0x03,
- EShortNameInitialLength = 0x06,
- ETildeNumberPosition = 0x07,
- ENameLength = 0x8,
- ENameLengthWithExtension = 0x0B
-};
-
-//Holds all the short directory entry.
-static StringList GShortEntryList;
-
-/**
-This class is used to prepare Long Name Directory entry portion of Directory Entry region
-
-@internalComponent
-@released
-*/
-class ClongName
-{
-private:
- StringList iSubNamesList; //Holds the splitted file names
- LongEntryStack iLongEntryStack; //Holds all the long name directory entry node's
- unsigned int iClusterNumber; //Current cluster number, where the current long entry needs to be written
- CCluster* iClusterPtr;
- string iLongName;
- char iLongEntryAttribute;
- string iShortName;
- unsigned int iLongNameLength;
- unsigned int iTildeNumberPosition;
- /**If the received sub name entry size is equal to its expected length, then
- two NULL character should be preceded at the start of next sub name
- */
- bool iSubNameProperEnd; //Is name ends without NULL character termination?
- bool iFirstNullName;// Is first name ending with NULL character?
-
-private:
- string GetShortEntryName();
- unsigned char CalculateCheckSum();
- void WriteLongEntry(CLongEntry* aLongEntry,string& longEntryString);
- void WriteSubName(string& aSubName,unsigned short aSubNameLength,
- string& alongEntryString);
- void FormatLongFileName(string& aLongName);
- void CheckAndUpdateShortName(string& aShortName);
- void PushAndErase(string& aFirstName,string& aSecondName,string& aThirdName);
- void GetSubName(string& aLongName,
- int& aStartIndex,
- int& aStringLength,
- int aSubNameLength,
- string& aSubName);
- void PopAndErase();
- void CalculateExtentionLength();
-
-public:
- ClongName(CCluster* aClusterPtr, CDirectory* aEntry);
- ~ClongName();
- CDirectory* CreateShortEntry(CDirectory* aEntry);
- string CreateLongEntries();
- static void DestroyShortEntryList();
-};
-
-#endif //LONGNAME_H
--- a/imgtools/imglib/filesystem/include/messagehandler.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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 Handler Class for FileSystem component
-* @internalComponent
-* @released
-*
-*/
-
-
-#ifndef MESSAGEHANDLER_H
-#define MESSAGEHANDLER_H
-
-#include "messageimplementation.h"
-
-/**
-Class for Message Handler which will be used for getting instance of Message Implementation
-and start logging, creating message file, initializing messages.
-
-@internalComponent
-@released
-*/
-class MessageHandler
-{
- public:
- static Message *GetInstance();
- static void CleanUp();
- static void StartLogging(char *filename);
- static void CreateMessageFile(char *fileName);
- static void ReportMessage(int aMsgType, int aMsgIndex,char* aName);
-
- private:
- static Message* iInstance;
-};
-
-#endif //MESSAGEHANDLER_H
--- a/imgtools/imglib/filesystem/include/messageimplementation.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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 FileSystem tool
-* @internalComponent
-* @released
-*
-*/
-
-
-
-#ifndef MESSAGEIMPLEMENTATION_H
-#define MESSAGEIMPLEMENTATION_H
-
-
-
-#include <map>
-#include <string>
-#include <stdarg.h>
-using namespace std;
-typedef map<int,char*> Map;
-
-
-enum
-{
- ERROR = 0,
- WARNING,
- INFORMATION
-};
-/**
-To include more error or warning messages, Just include the key word here and
-write the key word contents into the Message array at ".cpp" file.
-Then increase the Message array size by number of messages included
-*/
-enum
-{ FILEOPENERROR = 1,
- FILEREADERROR,
- FILEWRITEERROR,
- MEMORYALLOCATIONERROR,
- ENTRYCREATEMSG,
- BOOTSECTORERROR,
- BOOTSECTORCREATEMSG,
- BOOTSECTORWRITEMSG,
- FATTABLEWRITEMSG,
- IMAGESIZETOOBIG,
- NOENTRIESFOUND,
- EMPTYFILENAME,
- EMPTYSHORTNAMEERROR,
- CLUSTERERROR,
- ROOTNOTFOUND,
- UNKNOWNERROR
-};
-
-
-/**
-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 ReportMessage(int aMsgType, int aMsgIndex,...)=0;
- virtual void InitializeMessages()=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 LogOutput(const char *aString);
- void StartLogging(char *fileName);
- void ReportMessage(int aMsgType, int aMsgIndex,...);
- void InitializeMessages();
- private:
-
- bool iLogging;
- char* iLogFileName;
- FILE *iLogPtr;
- Map iMessage;
-};
-
-/**
-Structure for Messages.
-
-@internalComponent
-@released
-*/
-struct EnglishMessage
-{
- int index;
- char message[1024];
-};
-
-#endif //MESSAGEIMPLEMENTATION_H
--- a/imgtools/imglib/filesystem/include/mingw.inl Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* Since the filesystem componenet is standalone, it is not using any definitions from Symbian EPOC.
-* So the inclusion of unavailable definition are much important to avoid compile time errors
-* @internalComponent
-* @released
-*
-*/
-
-
-#ifndef _MINGW_INL
-#define _MINGW_INL
-
-#ifndef __LINUX__
- #ifndef _MSC_VER
-
- /*
- * TOOLS2 platform uses Mingw compiler, which does not have below definition in the compiler pre-include
- * file "gcc_mingw_3_4_2.h" placed at "/epoc32/include/gcc_mingw".
- */
- inline void* operator new(unsigned int, void* __p) throw() { return __p; }
- #endif
-#endif
-
-#endif //MINGW_INL
--- a/imgtools/imglib/filesystem/include/utils.h Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* UTILSH
-* Contains common utilitied required for filesystem component.
-* @internalComponent
-* @released
-*
-*/
-
-
-#ifndef UTILS_H
-#define UTILS_H
-
-#include <string>
-
-/* While generating FAT32 image, user may specify the larger partition size (say 128GB),
- * Hence to support large integer values 64 bit integers are used.
- * "__int64" is for MSVC compiler and "long long int" is for GCC compilers
- */
-#ifdef _MSC_VER
- typedef __int64 Long64;
-#else
- typedef long long int Long64;
-#endif
-
-using namespace std;
-
-/**
-Function responsible to convert given string into upper case.
-Note: In FAT iamge regular entry names are need to be mentioned in Upper case.
-
-@internalComponent
-@released
-
-@param aString - input string
-@return returns the string, were string alphabets are changed to uppercase
-*/
-inline string& ToUpper(string& aString)
-{
- unsigned int stringLength = aString.length();
- for(unsigned int stringIndex = 0; stringIndex < stringLength; stringIndex++)
- {
- unsigned char stringChar = aString.at(stringIndex);
- //Lower case alphabets ASCII value used here, 97 is for 'a' 122 is for 'z'
- if( stringChar >= 97 && stringChar <= 122 )
- {
- stringChar -= 32; //Lower case alphabets case changed to upper case
- }
- aString[stringIndex] = stringChar;
- }
- return aString;
-}
-
-#endif //UTILS_H
--- a/imgtools/imglib/filesystem/source/cluster.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,191 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* Cluster class used to allocate cluster numbers for directory entries
-* and while writing file contents. And it is responsible to create the
-* MAP of content starting cluster to ending cluster which can be used
-* to generate FAT table. Since the cluster number is unique all over the
-* filesystem component, this class is designed as singleton class.
-* @internalComponent
-* @released
-*
-*/
-
-
-#include "cluster.h"
-
-
-//Initialize the Static CCluster instance pointer
-CCluster* CCluster::iClusterInstance = NULL;
-
-/**
-Static function which is used to instantiate and return the address of CCluster class.
-
-@internalComponent
-@released
-
-@param aClusterSize - single cluster size in Bytes
-@param aTotalNumberOfClusters - Maximum number of clusters
-@return - returns the instance of CCluster class
-*/
-
-CCluster* CCluster::Instance(unsigned int aClusterSize,unsigned int aTotalNumberOfClusters)
-{
- if (iClusterInstance == NULL) // is it the first call?
- {
- // create sole instance
- iClusterInstance = new CCluster(aClusterSize, aTotalNumberOfClusters);
- }
- return iClusterInstance; // address of sole instance
-}
-
-/**
-Destructor: Clears the clusters per entry map
-
-@internalComponent
-@released
-*/
-CCluster::~CCluster ()
-{
- iClustersPerEntry.clear();
- iClusterInstance = NULL;
-}
-
-
-/**
-Constructor Receives inputs from dirregion Class and initializes the class variables
-
-@internalComponent
-@released
-
-@param aClusterSize - Size of every Cluster
-@param aTotalNumberOfClusters - maximum number of clusters allowed for current FAT image
-*/
-CCluster::CCluster(unsigned int aClusterSize, unsigned int aTotalNumberOfClusters)
- :iClusterSize(aClusterSize),iTotalNumberOfClusters(aTotalNumberOfClusters)
-{
- iRootClusterNumber = KRootClusterNumber;
- iCurrentClusterNumber = iRootClusterNumber;
-}
-
-/**
-Function to return the current cluster number
-
-@internalComponent
-@released
-
-@return - returns the current cluster number
-*/
-unsigned int CCluster::GetCurrentClusterNumber() const
-{
- return iCurrentClusterNumber;
-}
-
-/**
-Function to decrement the current cluster number
-
-@internalComponent
-@released
-*/
-void CCluster::DecrementCurrentClusterNumber()
-{
- --iCurrentClusterNumber;
-}
-
-/**
-Function to get the High word of Current cluster number
-
-@internalComponent
-@released
-
-@return - returns the 16 bit HIGH word
-*/
-unsigned short int CCluster::GetHighWordClusterNumber() const
-{
- return (unsigned short)(iCurrentClusterNumber >> KBitShift16);
-}
-
-/**
-Function to get the Low word of Current cluster number
-
-@internalComponent
-@released
-
-@return - returns the 16 bit LOW word
-*/
-unsigned short int CCluster::GetLowWordClusterNumber() const
-{
- return (unsigned short)(iCurrentClusterNumber & KHighWordMask);
-}
-
-
-/**
-Function responsible to
-1. Increment the current Cluster Number
-2. Throw the error "image size too big" if the allocated clusters count exceeds total
-number of available clusters.
-
-@internalComponent
-@released
-*/
-void CCluster::UpdateNextAvailableClusterNumber()
-{
- if(iCurrentClusterNumber >= iTotalNumberOfClusters)
- {
- throw ErrorHandler(IMAGESIZETOOBIG,"Occupied number of clusters count exceeded than available clusters",__FILE__,__LINE__);
- }
- ++iCurrentClusterNumber;
-}
-
-/**
-Function to Return the cluster size
-
-@internalComponent
-@released
-
-@return the cluster size
-*/
-unsigned int CCluster::GetClusterSize() const
-{
- return iClusterSize;
-}
-
-/**
-Function Creates mapping between starting cluster number (where data starts) and
-the sub sequent cluster numbers (where the data extends).
-
-@internalComponent
-@released
-
-@param aStartingClusterNumber - Cluster number where the data starts
-@param aPairClusterNumber - Cluster number where the data extends
-*/
-void CCluster::CreateMap(unsigned int aStartingClusterNumber,unsigned int aPairClusterNumber)
-{
- iClustersPerEntry.insert(make_pair(aStartingClusterNumber,aPairClusterNumber));
-}
-
-/**
-Function to get Clusters per Entry MAP container.
-
-@internalComponent
-@released
-
-@return - returns the CLusters per entry container
-*/
-
-TClustersPerEntryMap* CCluster::GetClustersPerEntryMap()
-{
- return &iClustersPerEntry;
-}
--- a/imgtools/imglib/filesystem/source/directory.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,550 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* Directory class exports the functions required to construct either
-* single entry (constructor) or to construct directory structure.
-* Also initializes the date and time attributes for all newly created
-* entries.
-* @internalComponent
-* @released
-*
-*/
-
-
-#include "errorhandler.h"
-#include "directory.h"
-#include "constants.h"
-#include "utf16string.h"
-/**
-Constructor:
-1. To Initialize the date and time variable
-2. Also to initialize other variable's
-
-@internalComponent
-@released
-
-@param aEntryName - the entry name
-*/
-
-FILESYSTEM_API CDirectory::CDirectory(const char* aEntryName,CDirectory* aParent):
- iEntryName(aEntryName),
- iAttribute(0),
- iNtReserved(KNTReserverdByte),
- iCreationTimeMsecs(KCreateTimeInMsecs),
- iClusterNumberHi(0),
- iClusterNumberLow(0),
- iFileSize (0),
- iParent(aParent)
-{
- InitializeTime();
-
- memset(iShortName,0x20,11);
- iShortName[11] = 0 ;
- size_t length = iEntryName.length();
- if(0 == length)
- return ;
- if(0 == strcmp(aEntryName,".")){
- iShortName[0] = '.' ;
- return ;
- }
- if(0 == strcmp(aEntryName,"..")){
- iShortName[0] = '.' ;
- iShortName[1] = '.' ;
- return ;
- }
- size_t lenOfSuffix = 0 ;
- size_t dotPos = iEntryName.rfind('.',length);
- size_t lenOfPrefix ;
- if(dotPos != string::npos) {
- lenOfSuffix = length - dotPos - 1;
- lenOfPrefix = dotPos ;
- }
- else
- lenOfPrefix = length ;
- size_t p ;
- char c ;
- bool flag = false ;
- for( p = 0 ; p < lenOfPrefix ; p ++) {
- c = aEntryName[p];
- if(c == 0x22 || c == 0x2A || c == 0x2B || c == 0x2C || c == 0x2E || c == 0x2F || \
- c == 0x3A || c == 0x3B || c == 0x3C || c == 0x3D || c == 0x3E || c == 0x3 || \
- c == 0x5B || c == 0x5C || c == 0x5D || c == 0x7C ) { // illegal characters ;
- flag = true ;
- break ;
- }
- }
- lenOfPrefix = p ;
- if(lenOfPrefix > 8){
- flag = true ;
- }
- if(flag){
- size_t len = (6 <= p) ? 6 : p;
- memcpy(iShortName,aEntryName,len);
- iShortName[len] = '~';
- iShortName[len + 1] = '1' ;
- if(lenOfSuffix > 0){
- memcpy(&iShortName[8],&aEntryName[dotPos + 1], ((3 <= lenOfSuffix) ? 3 : lenOfSuffix));
- }
- for(p = 0 ; p < 11 ; p++){
- if(iShortName[p] >= 'a' && iShortName[p] <= 'z')
- iShortName[p] = iShortName[p] + 'A' - 'a' ;
- }
- if(iParent)
- iParent->MakeUniqueShortName(iShortName,len);
- }
- else {
- memcpy(iShortName,aEntryName,lenOfPrefix);
- if(lenOfSuffix > 0){
- memcpy(&iShortName[8],&aEntryName[dotPos + 1], ((3 <= lenOfSuffix) ? 3 : lenOfSuffix));
- }
- for(p = 0 ; p < 11 ; p++){
- if(iShortName[p] >= 'a' && iShortName[p] <= 'z')
- iShortName[p] = iShortName[p] + 'A' - 'a' ;
- }
- }
-
-
-}
-void CDirectory::MakeUniqueShortName(unsigned char* rShortName,size_t aWavPos) const {
- list<CDirectory*>::const_iterator i = iDirectoryList.begin();
- unsigned char nIndex = 1 ;
- while(i != iDirectoryList.end()){
- CDirectory* dir = (CDirectory*)(*i);
- if(0 == memcmp(rShortName,dir->iShortName,aWavPos + 1) &&
- 0 == memcmp(&rShortName[8],&(dir->iShortName[8]),3)) {
- nIndex ++ ;
- }
- i++ ;
- }
- if(nIndex < 10)
- rShortName[aWavPos + 1] = ('0' + nIndex) ;
- else if( nIndex < 36)
- rShortName[aWavPos + 1] = ('A' + nIndex - 10) ;
- else {
- nIndex = 10 ;
- rShortName[aWavPos-1] = '~';
- i = iDirectoryList.begin();
- while(i != iDirectoryList.end()){
- CDirectory* dir = (CDirectory*)(*i);
- if(0 == memcmp(rShortName,dir->iShortName,aWavPos) &&
- 0 == memcmp(&rShortName[8],&(dir->iShortName[8]),3))
- nIndex ++ ;
- i++ ;
- }
- sprintf((char*)(&rShortName[aWavPos]),"%u",(unsigned int)(nIndex));
- rShortName[aWavPos + 2] = 0x20;
- }
-}
-/**
-Destructor:
-1. To delete all the entries available in the form of directory structure
-2. Also to delete the current entry
-
-@internalComponent
-@released
-*/
-
-FILESYSTEM_API CDirectory::~CDirectory()
-{
- while(iDirectoryList.size() > 0)
- {
- delete iDirectoryList.front();
- iDirectoryList.pop_front();
- }
-}
-
-/**
-Function to initialize the time attributes of an entry
-
-@internalComponent
-@released
-*/
-
-void CDirectory::InitializeTime()
-{
- time_t rawtime;
- time ( &rawtime );
- iDateAndTime = localtime ( &rawtime );
- iDate.iCurrentDate.Day = iDateAndTime->tm_mday;
- iDate.iCurrentDate.Month = iDateAndTime->tm_mon+1; //As per FAT spec
- iDate.iCurrentDate.Year = iDateAndTime->tm_year - 80;//As per FAT spec
- iTime.iCurrentTime.Hour = iDateAndTime->tm_hour;
- iTime.iCurrentTime.Minute = iDateAndTime->tm_min;
- iTime.iCurrentTime.Seconds = iDateAndTime->tm_sec / 2;//As per FAT spec
-
- iCreationDate = iDate.iImageDate;
- iCreatedTime = iTime.iImageTime;
- iLastAccessDate = iDate.iImageDate;
- iLastWriteDate = iDate.iImageDate;
- iLastWriteTime = iTime.iImageTime;
-}
-
-/**
-Function to initialize the entry name
-
-@internalComponent
-@released
-
-@param aEntryName - entry name need to be initialized
-*/
-FILESYSTEM_API void CDirectory::SetEntryName(string aEntryName)
-{
- iEntryName = aEntryName;
-}
-
-/**
-Function to return the entry name
-
-@internalComponent
-@released
-
-@return iEntryName - the entry name
-*/
-
-FILESYSTEM_API string CDirectory::GetEntryName() const
-{
- return iEntryName;
-}
-
-/**
-Function to initialize the file path
-
-@internalComponent
-@released
-
-@param aFilePath - where the current entry contents actually stored
-*/
-FILESYSTEM_API void CDirectory::SetFilePath(char* aFilePath)
-{
- iFilePath.assign(aFilePath);
-}
-
-/**
-Function to return the file path
-
-@internalComponent
-@released
-
-@return iFilePath - the file path
-*/
-FILESYSTEM_API string CDirectory::GetFilePath() const
-{
- return iFilePath;
-}
-
-/**
-Function to set the entry attribute
-
-@internalComponent
-@released
-
-@param aAttribute - entry attribute
-*/
-FILESYSTEM_API void CDirectory::SetEntryAttribute(char aAttribute)
-{
- iAttribute = aAttribute;
-}
-
-/**
-Function to return the entry attribute
-
-@internalComponent
-@released
-
-@return iAttribute - the entry attribute
-*/
-FILESYSTEM_API char CDirectory::GetEntryAttribute() const
-{
- return iAttribute;
-}
-
-
-/**
-Function to initialize the file size, this function is called only if the entry is of
-type File.
-
-@internalComponent
-@released
-
-@param aFileSize - the current entry file size
-*/
-FILESYSTEM_API void CDirectory::SetFileSize(unsigned int aFileSize)
-{
- iFileSize = aFileSize;
-}
-
-/**
-Function to return the entry file size, this function is called only if the entry is of
-type File.
-
-@internalComponent
-@released
-
-@return iFileSize - the file size
-*/
-FILESYSTEM_API unsigned int CDirectory::GetFileSize() const
-{
- return iFileSize;
-}
-
-/**
-Function to check whether this is a file
-
-@internalComponent
-@released
-
-@return iFileFlag - the File Flag
-*/
-bool CDirectory::IsFile() const
-{
- return (iAttribute & EAttrDirectory) == 0 ;
-}
-
-/**
-Function to return the entries Nt Reserved byte
-
-@internalComponent
-@released
-
-@return iNtReserverd - the Nt Reserved byte
-*/
-char CDirectory::GetNtReservedByte() const
-{
- return iNtReserved;
-}
-
-/**
-Function to return the entry Creation time in milli-seconds.
-
-@internalComponent
-@released
-
-@return iCreatedTimeMsecs - created time in Milli-seconds
-*/
-char CDirectory::GetCreationTimeMsecs() const
-{
- return iCreationTimeMsecs;
-}
-
-/**
-Function to return the entry Created time
-
-@internalComponent
-@released
-
-@retun iCreatedTime - created time
-*/
-unsigned short int CDirectory::GetCreatedTime() const
-{
- return iCreatedTime;
-}
-
-/**
-Function to return the entry Created date
-
-@internalComponent
-@released
-
-@return iCreationDate - created date
-*/
-unsigned short int CDirectory::GetCreationDate() const
-{
- return iCreationDate;
-}
-
-/**
-Function to return the entry last accessed date
-
-@internalComponent
-@released
-
-@return iLastAccessDate - last access date
-*/
-unsigned short int CDirectory::GetLastAccessDate() const
-{
- return iLastAccessDate;
-}
-
-/**
-Function to set high word cluster number
-
-@internalComponent
-@released
-
-@param aHiClusterNumber - high word of current cluster number
-*/
-void CDirectory::SetClusterNumberHi(unsigned short int aHiClusterNumber)
-{
- iClusterNumberHi = aHiClusterNumber;
-}
-
-/**
-Function to return high word cluster number
-
-@internalComponent
-@released
-
-@return iClusterNumberHi - high word of cluster number
-*/
-unsigned short int CDirectory::GetClusterNumberHi() const
-{
- return iClusterNumberHi;
-}
-
-/**
-Function to set low word cluster number
-
-@internalComponent
-@released
-
-@param aLowClusterNumber - low word of current cluster number
-*/
-void CDirectory::SetClusterNumberLow(unsigned short int aLowClusterNumber)
-{
- iClusterNumberLow = aLowClusterNumber;
-}
-
-/**
-Function to return low word cluster number
-
-@internalComponent
-@released
-
-@return iClusterNumberLow - low word of cluster number
-*/
-unsigned short int CDirectory::GetClusterNumberLow() const
-{
- return iClusterNumberLow;
-}
-
-/**
-Function to return last write date
-
-@internalComponent
-@released
-
-@return iLastWriteDate - last write date
-*/
-unsigned short int CDirectory::GetLastWriteDate() const
-{
- return iLastWriteDate;
-}
-
-/**
-Function to return last write time
-
-@internalComponent
-@released
-
-@return iLastWriteTime - last write time
-*/
-unsigned short int CDirectory::GetLastWriteTime() const
-{
- return iLastWriteTime;
-}
-
-/**
-Function to return sub directory/file list
-
-@internalComponent
-@released
-
-@return iDirectoryList - entry list
-*/
-FILESYSTEM_API EntryList* CDirectory::GetEntryList()
-{
- return &iDirectoryList;
-}
-
-/**
-Function to insert a entry into Directory list. Also this function can be used
-extensively to construct tree form of directory structure.
-
-@internalComponent
-@released
-
-@param aEntry - the entry to be inserted
-*/
-FILESYSTEM_API void CDirectory::InsertIntoEntryList(CDirectory* aEntry)
-{
- aEntry->iParent = this ;
- iDirectoryList.push_back(aEntry);
-}
-
-FILESYSTEM_API bool CDirectory::GetShortEntry(TShortDirEntry& rEntry) {
-
- memcpy(rEntry.DIR_Name,iShortName,sizeof(rEntry.DIR_Name));
- rEntry.DIR_Attr = iAttribute;
- rEntry.DIR_NTRes = 0 ;
- rEntry.DIR_CrtTimeTenth = 0 ;
- memcpy(rEntry.DIR_CrtTime,&iCreatedTime,sizeof(rEntry.DIR_CrtTime));
- memcpy(rEntry.DIR_CrtDate,&iCreationDate,sizeof(rEntry.DIR_CrtDate));
- memcpy(rEntry.DIR_LstAccDate,&iLastAccessDate,sizeof(rEntry.DIR_LstAccDate));
- memcpy(rEntry.DIR_FstClusHI,&iClusterNumberHi,sizeof(rEntry.DIR_FstClusHI));
- memcpy(rEntry.DIR_WrtTime,&iLastWriteTime,sizeof(rEntry.DIR_WrtTime));
- memcpy(rEntry.DIR_WrtDate,&iLastWriteDate,sizeof(rEntry.DIR_WrtDate));
- memcpy(rEntry.DIR_FstClusLO,&iClusterNumberLow,sizeof(rEntry.DIR_FstClusLO));
- memcpy(rEntry.DIR_FileSize,&iFileSize,sizeof(rEntry.DIR_FileSize));
- return true ;
-}
-static unsigned char ChkSum(const unsigned char* pFcbName) {
- short fcbNameLen ;
- unsigned char sum = 0 ;
- for(fcbNameLen = 11 ; fcbNameLen != 0 ; fcbNameLen --) {
- sum = ((sum & 1) ? 0x80 : 0 ) + (sum >> 1 ) + *pFcbName++ ;
- }
- return sum ;
-}
-
-FILESYSTEM_API bool CDirectory::GetLongEntries(list<TLongDirEntry>& rEntries) {
- if(0 == iEntryName.compare(".") || 0 == iEntryName.compare("..")){
- return false ;
- }
- rEntries.clear();
- TLongDirEntry entry ;
- UTF16String uniStr(iEntryName.c_str() , iEntryName.length());
- size_t length = uniStr.length() ;
- const size_t KBytesPerEntry = (sizeof(entry.LDIR_Name1) + sizeof(entry.LDIR_Name2) + \
- sizeof(entry.LDIR_Name3)) / 2 ;
- size_t packs = (length + KBytesPerEntry) / KBytesPerEntry ;
- size_t buflen = packs * KBytesPerEntry;
- TUint16* buffer = new TUint16[buflen];
- if(!buffer)
- return false ;
- memset(buffer,0xff,(buflen << 1));
- memcpy(buffer,uniStr.c_str(),(length << 1));
- buffer[length] = 0;
- entry.LDIR_Attr = (unsigned char)EAttrLongName;
- entry.LDIR_Chksum = ChkSum(iShortName);
- entry.LDIR_FstClusLO[0] = 0;
- entry.LDIR_FstClusLO[1] = 0;
- entry.LDIR_Type = 0;
- TUint16* ptr = buffer ;
- for(size_t n = 1 ; n <= packs ; n++ ) {
- entry.LDIR_Ord = n ;
- if(n == packs ){
- entry.LDIR_Ord |= 0x40 ;
- }
- memcpy(entry.LDIR_Name1,ptr,sizeof(entry.LDIR_Name1));
- ptr += (sizeof(entry.LDIR_Name1) / 2) ;
- memcpy(entry.LDIR_Name2,ptr,sizeof(entry.LDIR_Name2));
- ptr += (sizeof(entry.LDIR_Name2) / 2);
- memcpy(entry.LDIR_Name3,ptr,sizeof(entry.LDIR_Name3));
- ptr += (sizeof(entry.LDIR_Name3) / 2);
- rEntries.push_front(entry);
- }
-
- delete []buffer ;
- return true ;
-}
--- a/imgtools/imglib/filesystem/source/dirregion.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,505 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* Class receives tree structured directory and file information. And
-* prepares the cluster versus content MAP by traversing through the same.
-* Later all the prepared clusters are written into image file.
-* @internalComponent
-* @released
-*
-*/
-
-
-#include "dirregion.h"
-#include "directory.h"
-/**
-Constructor:
-1.Get the instance of class CCluster
-2.Intializes the Cluster pointer
-3.Intialize the flags and other variables
-
-@internalComponent
-@released
-
-@param aNodeList - Root node placed in this list
-@param aFileSystemPtr - CFileSystem class pointer
-*/
-CDirRegion::CDirRegion(EntryList aNodeList,
- CFileSystem * aFileSystemPtr):
- iCurrentDirEntry(false),
- iParentDirEntry(false),
- iFirstCluster(true),
- iNodeList(aNodeList)
-{
- iClusterSize = aFileSystemPtr->GetClusterSize();
- iRootDirSizeInBytes = (aFileSystemPtr->GetRootDirSectors () *
- aFileSystemPtr->GetBytesPerSector());
- int totalClusters = aFileSystemPtr->GetTotalCluster();
- iClusterPtr = CCluster::Instance(iClusterSize,totalClusters);
- if(iClusterPtr == NULL)
- {
- throw ErrorHandler(CLUSTERERROR,"Instance creation error", __FILE__, __LINE__);
- }
- iClusterSize = iClusterPtr->GetClusterSize();
-}
-
-/**
-Destructor:
-1. Clean the Node List
-2. Clean the instance of Cluster object
-3. Clean the Cluster MAP.
-4. Invokes the DestroyShortEntryList to clear the contents of static GShortEntryList.
-
-@internalComponent
-@released
-*/
-CDirRegion::~CDirRegion()
-{
- if(iNodeList.size() > 0)
- {
- //Delete the root node
- delete iNodeList.front();
- }
- if(iClusterPtr != NULL)
- {
- delete iClusterPtr;
- iClusterPtr = NULL;
- }
- iClusterMap.clear();
- ClongName::DestroyShortEntryList();
-}
-
-/**
-Function to return Clusters per entry map(input for FAT table generator function)
-container
-
-@internalComponent
-@released
-
-@return - returns clusters per entry map container
-*/
-TClustersPerEntryMap* CDirRegion::GetClustersPerEntryMap() const
-{
- return iClusterPtr->GetClustersPerEntryMap();
-}
-
-/**
-Function responsible to write all the clusters available in iClusterMap
-into file.
-
-@internalComponent
-@released
-
-@param aOutPutStream - output file stream to write clusters in it
-*/
-void CDirRegion::WriteClustersIntoFile(OfStream& aOutPutStream)
-{
- StringMap::iterator mapBeginIter = iClusterMap.begin();
- StringMap::iterator mapEndIter= iClusterMap.end();
- //MAPs are sorted associative containers, so no need to sort
- string tempString;
- while(mapBeginIter != mapEndIter)
- {
- tempString = (*mapBeginIter++).second;
- aOutPutStream.write(tempString.c_str(),tempString.length());
- }
- aOutPutStream.flush();
- if(aOutPutStream.bad())
- {
- throw ErrorHandler(FILEWRITEERROR, __FILE__, __LINE__);
- }
-}
-
-/**
-Function responsible to
-1. Read the file content and write into string.
-2. Invoke the function to push data clusters into cluster Map
-
-@internalComponent
-@released
-
-@param aEntry - the directory entry node
-*/
-void CDirRegion::WriteFileDataInToCluster(CDirectory* aEntry)
-{
- iInputStream.open(aEntry->GetFilePath().c_str(),ios_base::binary);
- if(iInputStream.fail() == true )
- {
- throw ErrorHandler(FILEOPENERROR,(char*)aEntry->GetFilePath().c_str(),__FILE__,__LINE__);
- }
- else
- {
- iInputStream.seekg (0,ios_base::end);
- Long64 fileSize = iInputStream.tellg();
- iInputStream.seekg(0,ios_base::beg);
- char* dataBuffer = (char*)malloc((unsigned int)fileSize);
- if(dataBuffer == 0)
- {
- throw ErrorHandler(MEMORYALLOCATIONERROR, __FILE__, __LINE__);
- }
- //Read the whole file in one short
- iInputStream.read (dataBuffer,fileSize);
-
- Long64 bytesRead = (unsigned int)iInputStream.tellg();
- if((iInputStream.bad()) || (bytesRead != fileSize))
- {
- throw ErrorHandler(FILEREADERROR,(char*)aEntry->GetFilePath().c_str(), __FILE__, __LINE__);
- }
- string clusterData(dataBuffer,(unsigned int)bytesRead);
- PushStringIntoClusterMap(iClusterPtr->GetCurrentClusterNumber(),clusterData,iClusterSize,aEntry->GetEntryAttribute());
- }
- iInputStream.close();
-}
-
-
-/**
-Function invokes
-1. CheckEntry function, to identify whether the received entry list is proper or not.
-2. Invokes CreateDirEntry, to create directory and data portion of FAT image.
-
-@internalComponent
-@released
-
-*/
-void CDirRegion::Execute()
-{
- CheckEntry(iNodeList);
- CreateDirEntry(iNodeList.front(),KParentDirClusterNumber);
-}
-
-/**
-Function is to initialize the Parent directory entry with parent cluster number
-and appends all the attributes into the string (aString).
-
-@internalComponent
-@released
-
-@param aParDirClusterNumber - parent directory cluster number
-@param aString - parent directory entry attributes appended to this string
-*/
-void CDirRegion::CreateAndWriteParentDirEntry(unsigned int aParDirClusterNumber,string& aString)
-{
- CDirectory* parentDirectory = new CDirectory("..",NULL);
-
- parentDirectory->SetEntryAttribute(EAttrDirectory);
- parentDirectory->SetClusterNumberLow((unsigned short) (aParDirClusterNumber & KHighWordMask));
- parentDirectory->SetClusterNumberHi((unsigned short) (aParDirClusterNumber >> KBitShift16));
-
- TShortDirEntry entry ;
- parentDirectory->GetShortEntry(entry);
- aString.append((const char*)(&entry),sizeof(entry));
- iParentDirEntry = true;
- delete parentDirectory;
- parentDirectory = NULL;
-}
-
-/**
-Function responsible to
-1. Initialize the Current directory entry attribute
-2. Write the entry attributes into received string
-
-@internalComponent
-@released
-
-@param aCurDirClusterNumber - Current directory Cluster number
-@param aString - the entry attributes should be appended to this string
-*/
-void CDirRegion::CreateAndWriteCurrentDirEntry(unsigned int aCurClusterNumber,string& aString)
-{
- iCurEntryClusterNumber = aCurClusterNumber;
- CDirectory* currentDirectory = new CDirectory(".",NULL);
-
- currentDirectory->SetEntryAttribute(EAttrDirectory);
- currentDirectory->SetClusterNumberLow((unsigned short) (iCurEntryClusterNumber & KHighWordMask));
- currentDirectory->SetClusterNumberHi((unsigned short) (iCurEntryClusterNumber >> KBitShift16));
-
- TShortDirEntry entry ;
- currentDirectory->GetShortEntry(entry);
- aString.append((const char*)(&entry),sizeof(entry));
- iCurrentDirEntry = true;
- delete currentDirectory;
- currentDirectory = NULL;
-}
-
-/**
-Function responsible to push the directory entry clusters into cluster MAP only if the
-directory entry string size is greater than the cluster size.
-
-@internalComponent
-@released
-
-@param aNumber - is the Cluster Key used to insert the cluster into cluster map
-@param aString - is the directory entry string
-@param aClustersRequired - No of clusters required to hold this string
-*/
-
-void CDirRegion::PushDirectoryEntryString(unsigned int aNumber,string& aString,int aClustersRequired)
-{
- int clusterCount = 0;
- int clusterKey = aNumber;
- iClusterPtr->CreateMap(aNumber,clusterKey);
- iClusterMap[clusterKey] = aString.substr(clusterCount*iClusterSize,iClusterSize);
- ++clusterCount;
- string clusterSizeString;
- for(; clusterCount < aClustersRequired; ++clusterCount)
- {
- clusterKey = iClusterPtr->GetCurrentClusterNumber();
- clusterSizeString = aString.substr(clusterCount*iClusterSize,iClusterSize);
- clusterSizeString.append((iClusterSize - clusterSizeString.length()),0);
- iClusterMap[clusterKey] = clusterSizeString;
- iClusterPtr->CreateMap(aNumber,clusterKey);
- iClusterPtr->UpdateNextAvailableClusterNumber();
- }
-}
-
-/**Function responsible to
-1. Convert the string into equal size clusters of cluster size
-2. Insert the clusters into Cluster MAP
-
-@internalComponent
-@released
-
-@param aNumber - cluster number, used to map the cluster
-@param aString - reference of input string
-@param aClusterSize - used to split the string
-@param aAttribute - current entry attribute
-*/
-void CDirRegion::PushStringIntoClusterMap(unsigned int aNumber, string& aString, unsigned long int aClusterSize,char aAttribute)
-{
- int receivedStringLength = aString.length();
- /* Precaution, once the map is initialized with specific cluster number don't over write
- * it once again. Look for the cluster number within the existing MAP and then proceed with
- * filling in the cluster.
- */
- StringMap::iterator iter= iClusterMap.find(aNumber);
- if(iter == iClusterMap.end())
- {
- /* The length of the cluster content (aString) can be more or less than the cluster size,
- * hence, calculate the total number of clusters required.
- */
- int clustersRequired = receivedStringLength / aClusterSize;
- if((receivedStringLength % aClusterSize) > 0)
- {
- ++clustersRequired;
- }
- if((clustersRequired > 1) && (aAttribute == EAttrDirectory))
- {
- PushDirectoryEntryString(aNumber,aString,clustersRequired);
- return;
- }
- int updatedClusterNumber = aNumber;
- string clusterSizeString;
- for(short int clusterCount = 0; clusterCount < clustersRequired; ++clusterCount)
- {
- /* In case of the contents occupying more than one cluster, break the contents into
- * multiple parts, each one measuring as that of the cluster size.
- */
- clusterSizeString = aString.substr(clusterCount * aClusterSize,aClusterSize);
- iClusterPtr->CreateMap(aNumber,updatedClusterNumber);
- if(clusterSizeString.length() < aClusterSize)
- {
- /* Copied string size is less than cluster size, fill the remaining space
- * with zero
- */
- clusterSizeString.append((aClusterSize - clusterSizeString.length()),0);
- }
- // Insert the string into ClusterMap
- iClusterMap[updatedClusterNumber] = clusterSizeString;
-
- iClusterPtr->UpdateNextAvailableClusterNumber();
- updatedClusterNumber = iClusterPtr->GetCurrentClusterNumber ();
- }
- /* In the above loop, cluster number is incremented to point to the next entry.
- * However, before writing a directory or a volume id entry, it is always ensured
- * to get the next cluster number. Hence in this case, it is required to decrement
- * the cluster number, so that the pointer points to the end of the cluster occupied.
- */
- if(aAttribute == EAttrDirectory || aAttribute == EAttrVolumeId)
- {
- iClusterPtr->DecrementCurrentClusterNumber ();
- }
- }
-}
-
-/**
-Function is responsible to take in the tree structured directory
-information and to initialize the starting cluster in the Cluster Map.
-
-@internalComponent
-@released
-
-@param aNodeList - the list which holds root entry
-*/
-void CDirRegion::CheckEntry(EntryList aNodeList)
-{
- if(aNodeList.size() > 0)
- {
- if(iRootDirSizeInBytes > 0)
- {
- //FAT16 Root entries are written into Cluster 1
- iClusterKey = KFat16RootEntryNumber;
- }
- else
- {
- //FAT32 Root entries are written into Cluster 2
- iClusterPtr->UpdateNextAvailableClusterNumber();
- iClusterKey = KFat32RootEntryNumber;
- }
- if(aNodeList.front()->GetEntryList()->size() <= 0)
- {
- throw ErrorHandler(NOENTRIESFOUND, __FILE__, __LINE__);
- }
- }
- else
- {
- throw ErrorHandler(ROOTNOTFOUND, __FILE__, __LINE__);
- }
-}
-
-/**
-Function receives Tree structured folder information and does the following:
-1. Generates Directory Entry portion of FAT image recursively.
-2. If it finds the entry as file then writes its contents.
-3. If the entry is long name then longfilename class invoked to create long entries.
-
-@internalComponent
-@released
-
-@param aEntry - Subdirectory pointer of root directory
-@param aParentDirClusterNumber - parent directory cluster number
-*/
-void CDirRegion::CreateDirEntry(CDirectory* aEntry,unsigned int aParentDirClusterNumber)
-{
- unsigned int currentDirClusterNumber = 0;
- int rootClusterSize = 0;
- if(iFirstCluster == true)
- {
- iCurrentDirEntry = true;
- iParentDirEntry = true;
- /**Root directory and Normal directory has one difference.
- FAT16 : Root cluster occupies 32 sectors
- FAT32 : Root cluster occupies only one cluster
- */
- rootClusterSize = (iRootDirSizeInBytes > 0)?iRootDirSizeInBytes:iClusterSize;
- }
- else
- {
- currentDirClusterNumber = Get32BitClusterNumber(aEntry->GetClusterNumberHi(),
- aEntry->GetClusterNumberLow());
- }
-
- //printIterator used while printing the entries
- EntryList::iterator printIterator = aEntry->GetEntryList()->begin();
- //traverseIterator used during recursive call
- EntryList::iterator traverseIterator = printIterator;
-
- unsigned int dirEntryCount = aEntry->GetEntryList()->size();
-
- string dirString;
- string nameString;
- CDirectory* tempDirEntry = (*printIterator);
- list<TLongDirEntry> longNames ;
- //Writes all the Directory entries available in one Directory entry
- while(dirEntryCount > 0)
- {
- tempDirEntry = (*printIterator);
-
- tempDirEntry->SetClusterNumberHi(iClusterPtr->GetHighWordClusterNumber());
- tempDirEntry->SetClusterNumberLow(iClusterPtr->GetLowWordClusterNumber());
-
- /* Every directory should have current and parent directory entries in its
- * respective cluster. Hence Create the current and parent directory entries
- * only if it is not created already.
- */
- if(!iCurrentDirEntry && !iParentDirEntry)
- {
- CreateAndWriteCurrentDirEntry(currentDirClusterNumber,dirString);
- iClusterKey = currentDirClusterNumber;
- CreateAndWriteParentDirEntry(aParentDirClusterNumber,dirString);
- }
- MessageHandler::ReportMessage(INFORMATION,
- ENTRYCREATEMSG,
- (char*)tempDirEntry->GetEntryName().c_str());
-
- if(tempDirEntry->GetLongEntries(longNames)){
- list<TLongDirEntry>::const_iterator i = longNames.begin();
- while(i != longNames.end()) {
- dirString.append((char*)(&(*i)),sizeof(TLongDirEntry));
- i++ ;
- }
- }
- TShortDirEntry shortEntry ;
- tempDirEntry->GetShortEntry(shortEntry);
- dirString.append((char*)(&shortEntry),sizeof(TShortDirEntry));
- if(tempDirEntry->IsFile())
- {
- WriteFileDataInToCluster(tempDirEntry);
- }
- else
- {
- iClusterPtr->UpdateNextAvailableClusterNumber ();
- //tempDirEntry->SetEntryAttribute(tempDirEntry->GetEntryAttribute() | EAttrDirectory);
- }
- ++printIterator;
- --dirEntryCount;
- }
-
- iCurrentDirEntry = false;
- iParentDirEntry = false;
- aParentDirClusterNumber = currentDirClusterNumber;
- if(iFirstCluster == true)
- {
- PushStringIntoClusterMap(iClusterKey,dirString,rootClusterSize,aEntry->GetEntryAttribute());
- iFirstCluster = false;
- }
- else
- {
- PushStringIntoClusterMap(iClusterKey,dirString,iClusterSize,aEntry->GetEntryAttribute());
- }
-
- dirEntryCount = aEntry->GetEntryList()->size();
-
- //Recursive algorithm to print all entries
- while(dirEntryCount > 0)
- {
- if(aEntry->GetEntryList()->size() > 0)
- {
- CreateDirEntry((*traverseIterator),aParentDirClusterNumber);
- }
- --dirEntryCount;
- //if no entries found don't go deep
- if(dirEntryCount > 0)
- {
- aEntry = (*++traverseIterator);
- }
- }
-}
-
-/**
-Function responsible to convert two 16 bit words into single 32 bit integer
-
-@internalComponent
-@released
-
-@param aHighWord - 16 bit high word
-@param aLowWord - 16 bit low word
-@return returns the 32 bit integer
-*/
-unsigned int CDirRegion::Get32BitClusterNumber(unsigned int aHighWord, unsigned int aLowWord)
-{
- unsigned int clusterNumber = aHighWord;
- clusterNumber <<= KBitShift16;
- clusterNumber |= aLowWord;
- return clusterNumber;
-}
--- a/imgtools/imglib/filesystem/source/errorhandler.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* ErrorHandler class receives the message index and the message.
-* Formats the error message using MessageHandler then writes the
-* same into the log file and standard output.
-* @internalComponent
-* @released
-*
-*/
-
-#include "errorhandler.h"
-#include "messagehandler.h"
-
-char *errMssgPrefix="FileSystem : Error:";
-char *Gspace=" ";
-
-/**
-ErrorHandler constructor for doing common thing required for derived
-class functions.
-
-In some error conditions aSubMessage is required to be passed. So overloaded
-constructor used here.
-
-@internalComponent
-@released
-
-@param aMessageIndex - Message Index
-@param aSubMessage - Should be displayed with original message
-@param aFileName - File name from where the error is thrown
-@param aLineNumber - Line number from where the error is thrown
-*/
-ErrorHandler::ErrorHandler(int aMessageIndex, char* aSubMessage, char* aFileName, int aLineNumber)
- :iSubMessage(aSubMessage), iFileName(aFileName), iLineNumber(aLineNumber)
-{
- iMessageIndex = aMessageIndex;
- iMessage = errMssgPrefix;
- iMessage += Gspace;
-}
-
-/**
-ErrorHandler constructor for doing common thing required for derived
-class functions.
-
-@internalComponent
-@released
-
-@param aMessageIndex - Message Index
-@param aFileName - File name from where the error is thrown
-@param aLineNumber - Line number from where the error is thrown
-*/
-ErrorHandler::ErrorHandler(int aMessageIndex, char* aFileName, int aLineNumber)
- : iFileName(aFileName), iLineNumber(aLineNumber)
-{
- iMessageIndex = aMessageIndex;
- iMessage = errMssgPrefix;
- iMessage += Gspace;
-}
-
-/**
-ErrorHandler destructor.
-
-@internalComponent
-@released
-*/
-ErrorHandler::~ErrorHandler()
-{
- MessageHandler::CleanUp();
-}
-
-/**
-Function to report the error
-
-@internalComponent
-@released
-*/
-void ErrorHandler::Report()
-{
- char *tempMssg;
- char *errMessage;
-
- errMessage=MessageHandler::GetInstance()->GetMessageString(iMessageIndex);
- if(errMessage)
- {
- tempMssg = new char[strlen(errMessage) + iFileName.length() + sizeof(int) + iSubMessage.length()];
- sprintf(tempMssg, errMessage, iFileName.c_str(), iLineNumber, iSubMessage.c_str());
- iMessage += tempMssg;
- MessageHandler::GetInstance()->Output(iMessage.c_str());
- delete[] tempMssg;
- }
-}
--- a/imgtools/imglib/filesystem/source/fat16bootsector.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* This class represents the boot sector of a FAT16 image.
-* This class is derived from basebootsector class which is constitutes
-* the common boot sector fields for FAT16 and FAT32 class.
-* @internalComponent
-* @released
-*
-*/
-
-#include "fat16bootsector.h"
-
-/**
-Constructor of the fat16 boot sector class
-
-@internalComponent
-@released
-*/
-TFAT16BootSector::TFAT16BootSector()
-{
-}
-
-/**
-Destructor of the fat16 boot sector class
-
-@internalComponent
-@released
-*/
-TFAT16BootSector::~TFAT16BootSector()
-{
-}
-
-/**
-Set the file system type
-
-@internalComponent
-@released
-*/
-void TFAT16BootSector::SetFileSysType()
-{
- strcpy(reinterpret_cast<char*>(iFileSysType),"FAT16 ");
-}
-/**
-returns the file system type
-@return file system type
-
-@internalComponent
-@released
-*/
-unsigned char* TFAT16BootSector::FileSysType()
-{
- return iFileSysType;
-}
-
-/**
-Number of entries allowed in the root directory,specific to Fat12/16,
-zero for FAT32
-
-@internalComponent
-@released
-*/
-void TFAT16BootSector::SetRootDirEntries()
-{
- iRootDirEntries = KDefaultRootDirEntries;;
-}
-
-/**
-Sets the number of reserved sectors on the volume
-
-@internalComponent
-@released
-*/
-void TFAT16BootSector::SetReservedSectors()
-{
- iReservedSectors = KDefaultFat16ReservedSectors;
-}
-
-/**
-Computes the sectors per cluster ratio
-To refer this mathematical computation, Please see:
-Microsoft Extensible Firmware Initiative FAT32 File
-System Specification document
-
-@internalComponent
-@released
-
-@param aPartitionSize partition size in bytes
-*/
-void TFAT16BootSector::ComputeSectorsPerCluster(Long64 aPartitionSize)
-{
-
- if(aPartitionSize > K1GB)
- {
- iSectorsPerCluster = K64SectorsPerCluster;
- }
- else if(aPartitionSize > K512MB)
- {
- iSectorsPerCluster = K32SectorsPerCluster;
- }
- else if(aPartitionSize > K256MB)
- {
- iSectorsPerCluster = K16SectorsPerCluster;
- }
- else if(aPartitionSize > K128MB)
- {
- iSectorsPerCluster = K8SectorsPerCluster;
- }
- else if(aPartitionSize > K16MB)
- {
- iSectorsPerCluster = K4SectorsPerCluster;
- }
- else
- {
- iSectorsPerCluster = K2SectorsPerCluster;
- }
-}
-
-/**
-Sectors used for the Fat table
-To refer this mathematical formulae, Please see:
-Microsoft Extensible Firmware Initiative FAT32 File System Specification
-document
-
-@internalComponent
-@released
-
-@param aPartitionSize partition size
-*/
-void TFAT16BootSector::ComputeFatSectors(Long64 aPartitionSize)
-{
- int iRootDirSectors = ((iRootDirEntries * 32) + (iBytesPerSector - 1)) / iBytesPerSector;
- int Log2OfBytesPerSector = Log2(iBytesPerSector);
- unsigned long TotalSectors64 = (unsigned long)(aPartitionSize >> Log2OfBytesPerSector);
- unsigned int tmpval1 = TotalSectors64 - (iReservedSectors + iRootDirSectors);
- unsigned int tmpval2 =(256 * iSectorsPerCluster) + iNumberOfFats;
- unsigned int FatSectors =(tmpval1 + (tmpval2 - 1)) / tmpval2;
- iFatSectors = (unsigned short)FatSectors;
- iFatSectors32 = 0;
-}
--- a/imgtools/imglib/filesystem/source/fat16filesystem.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,318 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* CFat16FileSystem is the concrete class which is responsible for
-* creating a FAT16 image. This class constitutes the method to
-* create boot sector, FAT Table and data region of a FAT16 Image
-* @internalComponent
-* @released
-*
-*/
-
-#include"fat16filesystem.h"
-
-
-/**
-Initializes the boot sector of a FAT 16 volume
-
-@internalComponent
-@released
-
-@param aPartitionSize partition size in bytes
-@param aConfigurableFatAttributes ConfigurableFatAttributes
-*/
-void CFat16FileSystem::CreateBootSector(Long64 aPartitionSize,ConfigurableFatAttributes* aConfigurableFatAttributes)
-{
- iFAT16BootSector.SetOEMName();
- unsigned char* OEMName = iFAT16BootSector.OEMName();
- iFAT16BootSector.SetJumpInstruction();
- unsigned char* JmpBoot = iFAT16BootSector.JumpInstruction();
- iFAT16BootSector.SetBytesPerSector(aConfigurableFatAttributes->iDriveSectorSize);
- unsigned short BytesPerSector = (unsigned short)iFAT16BootSector.BytesPerSector();
- iFAT16BootSector.ComputeSectorsPerCluster(aPartitionSize);
- unsigned char SectorsPerCluster = iFAT16BootSector.SectorsPerCluster();
- iFAT16BootSector.SetReservedSectors();
- unsigned short ReservedSectors = iFAT16BootSector.ReservedSectors();
- iFAT16BootSector.SetNumberOfFats(aConfigurableFatAttributes->iDriveNoOfFATs);
- unsigned char NumFats = iFAT16BootSector.NumberOfFats();
- iFAT16BootSector.SetRootDirEntries();
- unsigned short RootDirEntries = iFAT16BootSector.RootDirEntries();
- iFAT16BootSector.ComputeTotalSectors(aPartitionSize);
- unsigned short LowSectors = iFAT16BootSector.LowSectorsCount();
- iFAT16BootSector.SetMedia();
- unsigned char Media = iFAT16BootSector.Media();
- iFAT16BootSector.ComputeFatSectors(aPartitionSize);
- unsigned short FatSectors = iFAT16BootSector.FatSectors();
- iFAT16BootSector.SetSectorsPerTrack();
- unsigned short SectorPerTrack = iFAT16BootSector.SectorsPerTrack();
- iFAT16BootSector.SetNumberOfHeads();
- unsigned short NumberOfHeads = iFAT16BootSector.NumberOfHeads();
- iFAT16BootSector.SetHiddenSectors();
- unsigned int HiddenSectors = iFAT16BootSector.HiddenSectors();
- unsigned int HighSectorsCount = iFAT16BootSector.HighSectorsCount();
- iFAT16BootSector.SetBootSectorDriveNumber();
- unsigned char BootSectorDriveNumber = iFAT16BootSector.BootSectorDriveNumber();
- iFAT16BootSector.SetReservedByte();
- unsigned char ReservedByte = iFAT16BootSector.ReservedByte();
- iFAT16BootSector.SetBootSignature();
- unsigned char BootSignature = iFAT16BootSector.BootSignature();
- iFAT16BootSector.SetVolumeId();
- unsigned int VolumeId = iFAT16BootSector.VolumeId();
- iFAT16BootSector.SetVolumeLab(aConfigurableFatAttributes->iDriveVolumeLabel);
- unsigned char* VolumeLab = iFAT16BootSector.VolumeLab();
- iFAT16BootSector.SetFileSysType();
- unsigned char* FileSysType = iFAT16BootSector.FileSysType();
- //copying of boot sector values in to the array
- iData = new unsigned char[BytesPerSector];
- unsigned int pos = 0;
- memcpy(&iData[pos],JmpBoot,3);
- pos += 3;
- memcpy(&iData[pos],OEMName,8);
- pos += 8;
- memcpy(&iData[pos],&BytesPerSector,2);
- pos += 2;
- memcpy(&iData[pos],&SectorsPerCluster,1);
- pos += 1;
- memcpy(&iData[pos],&ReservedSectors,2);
- pos += 2;
- memcpy(&iData[pos],&NumFats,1);
- pos += 1;
- memcpy(&iData[pos],&RootDirEntries,2);
- pos += 2;
- memcpy(&iData[pos],&LowSectors,2);
- pos += 2;
- memcpy(&iData[pos],&Media,1);
- pos += 1;
- memcpy(&iData[pos],&FatSectors,2);
- pos += 2;
- memcpy(&iData[pos],&SectorPerTrack,2);
- pos += 2;
- memcpy(&iData[pos],&NumberOfHeads,2);
- pos += 2;
- memcpy(&iData[pos],&HiddenSectors,4);
- pos += 4;
- memcpy(&iData[pos],&HighSectorsCount,4);
- pos += 4;
- memcpy(&iData[pos],&BootSectorDriveNumber,1);
- pos += 1;
- memcpy(&iData[pos],&ReservedByte,1);
- pos += 1;
- memcpy(&iData[pos],&BootSignature,1);
- pos += 1;
- memcpy(&iData[pos],&VolumeId,4);
- pos += 4;
- memcpy(&iData[pos],VolumeLab,11);
- pos += 11;
- memcpy(&iData[pos],FileSysType,8);
- pos += 8;
- while(pos < BytesPerSector)
- {
- iData[pos] = 0;
- pos++;
- }
- // Set sector [510] as 0xAA and [511] as 0x55 to mark the end of boot sector
- iData[KSizeOfFatBootSector-2] = 0x55;
- iData[KSizeOfFatBootSector-1] = 0xAA;
- // It is perfectly ok for the last two bytes of the boot sector to also
- // have the signature 0xAA55.
- iData[BytesPerSector-2] = 0x55;
- iData[BytesPerSector-1] = 0xAA;
-
-
- ComputeClusterSizeInBytes();
- ComputeRootDirSectors();
- ComputeBytesPerSector();
- MessageHandler::ReportMessage (INFORMATION,BOOTSECTORCREATEMSG, "FAT16");
-}
-
-/**
-Writes the boot sector of a FAT 16 volume
-@param aOutPutStream handle to file stream
-
-@internalComponent
-@released
-*/
-void CFat16FileSystem::WriteBootSector(ofstream& aOutPutStream)
-{
- MessageHandler::ReportMessage (INFORMATION,BOOTSECTORWRITEMSG,"FAT16");
- aOutPutStream.write(reinterpret_cast<char*>(&iData[0]),iFAT16BootSector.BytesPerSector());
- aOutPutStream.flush();
-}
-/**
-Creates the FAT Table
-
-@internalComponent
-@released
-
-@param ofstream
-*/
-void CFat16FileSystem::CreateFatTable(ofstream& aOutPutStream)
-{
- int FATSizeInBytes = (iFAT16BootSector.FatSectors()) * (iFAT16BootSector.BytesPerSector());
- // Each FAT16 entries occupies 2 bytes, hence divided by 2
- unsigned int totalFatEntries = FATSizeInBytes / 2;
- unsigned short *FatTable = new unsigned short[totalFatEntries];
- unsigned short int clusterCounter = 1;
- int previousCluster;
- FatTable[0] = KFat16FirstEntry;
- /**Say cluster 5 starts at 5 and occupies clusters 7 and 9. The FAT table should have the
- value 7 at cluster location 5, the value 9 at cluster 7 and 'eof' value at cluster 9.
- Below algorithm serves this algorithm
- */
- Iterator itr = iClustersPerEntry->begin();
- while(itr != iClustersPerEntry->end())
- {
- previousCluster = itr->second;
- if(iClustersPerEntry->count(itr->first) > 1)
- {
- for(unsigned int i = 1; i < iClustersPerEntry->count(itr->first); i++)
- {
- FatTable[previousCluster] = (unsigned short)(++itr)->second;
- previousCluster = itr->second;
- ++clusterCounter;
- }
- }
- FatTable[previousCluster] = EOF16;
- itr++;
- ++clusterCounter;
- }
- // Each FAT16 entries occupies 2 bytes, hence multiply by 2
- string aFatString(reinterpret_cast<char*>(FatTable),clusterCounter*2);
- delete[] FatTable;
- if(clusterCounter < totalFatEntries)
- {
- // Each FAT16 entries occupies 2 bytes, hence multiply by 2
- aFatString.append((totalFatEntries - clusterCounter)*2, 0);
- }
- MessageHandler::ReportMessage (INFORMATION,FATTABLEWRITEMSG,
- "FAT16");
-
- // Write FAT table multiple times depending upon the No of FATS set.
- unsigned int noOfFats = iFAT16BootSector.NumberOfFats();
- for(unsigned int i=0; i<noOfFats; i++)
- {
- aOutPutStream.write(aFatString.c_str(),aFatString.length());
- }
-
- aFatString.erase();
- aOutPutStream.flush();
-}
-
-/**
-set the cluster size in bytes,iClusterSize
-
-@internalComponent
-@released
-*/
-void CFat16FileSystem::ComputeClusterSizeInBytes()
-{
- iClusterSize = (iFAT16BootSector.SectorsPerCluster()) * (iFAT16BootSector.BytesPerSector());
-}
-
-/**
-set the count of sectors occupied by the root directory,iRootDirSectors.
-
-@internalComponent
-@released
-*/
-void CFat16FileSystem::ComputeRootDirSectors()
-{
- iRootDirSectors = (iFAT16BootSector.RootDirEntries() * (KDefaultRootDirEntrySize) +
- (iFAT16BootSector.BytesPerSector() - 1)) / iFAT16BootSector.BytesPerSector();
-}
-
-/**
-Initialize the Bytes per Sector variable value.
-
-@internalComponent
-@released
-*/
-void CFat16FileSystem::ComputeBytesPerSector()
-{
- iBytesPerSector = iFAT16BootSector.BytesPerSector();
-}
-
-
-/**
-Compute the total number of clusters in Data segment of the FAT volume
-
-@internalComponent
-@released
-*/
-void CFat16FileSystem::ComputeTotalClusters(Long64 aPartitionSize)
-{
- unsigned long int iTotalDataSectors = iFAT16BootSector.TotalSectors(aPartitionSize) -
- ((iFAT16BootSector.NumberOfFats() * iFAT16BootSector.FatSectors()) +
- iRootDirSectors + iFAT16BootSector.ReservedSectors());
- iTotalClusters = iTotalDataSectors / iFAT16BootSector.SectorsPerCluster();
- if(iTotalClusters < KMinimumFat16Clusters)
- {
- throw ErrorHandler(BOOTSECTORERROR,"Low Partition Size",__FILE__,__LINE__);
- }
- if(iTotalClusters > KMaximumFat16Clusters)
- {
- throw ErrorHandler(BOOTSECTORERROR,"High Partition Size",__FILE__,__LINE__);
- }
-
-}
-
-/**
-This methods encapsulates the function call to write a complete FAT16 Image
-
-@internalComponent
-@released
-
-@param aPartitionSize partition size in bytes
-@param aNodeList Directory structure
-@param aOutPutStream output stream for writing file image
-@param aImageFileName image file name
-@param aLogFileName log file name
-@param aConfigurableFatAttributes ConfigurableFatAttributes
-*/
-
-void CFat16FileSystem::Execute(Long64 aPartitionSize,EntryList aNodeList,ofstream& aOutPutStream,
- ConfigurableFatAttributes* aConfigurableFatAttributes)
-{
- CDirRegion* dirRegionPtr = NULL;
- try
- {
- CreateBootSector(aPartitionSize,aConfigurableFatAttributes);
- ComputeTotalClusters(aPartitionSize);
- WriteBootSector(aOutPutStream);
- dirRegionPtr = new CDirRegion(aNodeList,this);
- dirRegionPtr->Execute();
- iClustersPerEntry = dirRegionPtr->GetClustersPerEntryMap();
- CreateFatTable(aOutPutStream);
- dirRegionPtr ->WriteClustersIntoFile(aOutPutStream);
- delete dirRegionPtr ;
- }
- catch(ErrorHandler &aError)
- {
- delete dirRegionPtr;
- //Re throw the same error message
- throw ErrorHandler(aError.iMessageIndex,(char*)aError.iSubMessage.c_str(),(char*)aError.iFileName.c_str(),aError.iLineNumber);
- }
- /**
- Irrespective of successful or unsuccessful data drive image generation ROFSBUILD
- may try to generate images for successive ".oby" file input.
- During this course unhandled exceptions may cause leaving some memory on heap
- unused. so the unhandled exceptions handling is used to free the memory allocated
- on heap.
- */
- catch(...)
- {
- delete dirRegionPtr;
- throw ErrorHandler(UNKNOWNERROR, __FILE__, __LINE__);
- }
-}
--- a/imgtools/imglib/filesystem/source/fat32bootsector.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,283 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* This class represents the boot sector of a FAT32 image.
-* This class is derived from basebootsector class which is constitutes
-* the common boot sector fields for FAT16 and FAT32 class.
-* @internalComponent
-* @released
-*
-*/
-
-#include "fat32bootsector.h"
-
-/**
-Constructor of the fat16 boot sector class
-
-@internalComponent
-@released
-*/
-TFAT32BootSector::TFAT32BootSector()
-{
-}
-
-/**
-Destructor of the fat16 boot sector class
-
-@internalComponent
-@released
-*/
-TFAT32BootSector::~TFAT32BootSector()
-{
-}
-/**
-Set the file system type
-
-@internalComponent
-@released
-*/
-void TFAT32BootSector::SetFileSysType()
-{
- strcpy(reinterpret_cast<char*>(iFileSysType),"FAT32 ");
-}
-
-
-//Number of entries allowed in the root directory, specific to Fat12/16, zero for FAT32
-void TFAT32BootSector::SetRootDirEntries()
-{
- iRootDirEntries = KFat32RootDirEntries;;
-}
-
-
-//Sets the number of reserved sectors on the volume
-void TFAT32BootSector::SetReservedSectors()
-{
- iReservedSectors = KDefaultFat32ReservedSectors;
-}
-
-/**
-Set the sectors per cluster ratio
-
-@internalComponent
-@released
-
-@param aPartitionSize partition size in bytes
-*/
-void TFAT32BootSector::ComputeSectorsPerCluster(Long64 aPartitionSize)
-{
- if (aPartitionSize > K32GB)
- {
- iSectorsPerCluster = K64SectorsPerCluster;
- }
- else if(aPartitionSize > K16GB)
- {
- iSectorsPerCluster = K32SectorsPerCluster;
- }
- else if(aPartitionSize > K8GB)
- {
- iSectorsPerCluster = K16SectorsPerCluster;
- }
- else if ( aPartitionSize > K260MB)
- {
- iSectorsPerCluster = K8SectorsPerCluster;
- }
- else
- {
- iSectorsPerCluster = K1SectorsPerCluster;
- }
-}
-
-/**
-Set the sectors per cluster ratio
-
-
-To refer this mathematical computation, Please see:
-Microsoft Extensible Firmware Initiative FAT32 File System
-Specification document
-
-@internalComponent
-@released
-
-@param aPartitionSize partition size in bytes
-*/
-void TFAT32BootSector::ComputeFatSectors(Long64 aPartitionSize)
-{
- int iRootDirSectors = ((iRootDirEntries*32) + (iBytesPerSector - 1)) / iBytesPerSector;
- int Log2OfBytesPerSector = Log2(iBytesPerSector);
- Long64 TotalSectors64 = aPartitionSize >> Log2OfBytesPerSector;
- Long64 tmpval1 = TotalSectors64 - (iReservedSectors + iRootDirSectors);
- Long64 tmpval2 =(256 * iSectorsPerCluster) + iNumberOfFats;
- tmpval2 = tmpval2 / 2;
- Long64 FatSectors = (tmpval1 + (tmpval2 - 1)) / tmpval2;
- iFatSectors = 0;
- iFatSectors32 = (unsigned int)FatSectors;
-}
-/**
-Sets the Fat flags
-
-@internalComponent
-@released
-*/
-void TFAT32BootSector::SetExtFlags()
-{
- iExtFlags = KDefaultExtFlags;
-}
-
-/**
-Returns the Fat flags
-
-@internalComponent
-@released
-
-@return fat flags
-*/
-unsigned short TFAT32BootSector::ExtFlags()
-{
- return iExtFlags;
-}
-
-/**
-Sets the version number of the file system
-
-@internalComponent
-@released
-*/
-void TFAT32BootSector::SetFileSystemVersion()
-{
- iFileSystemVersion = KDefaultVersion;
-}
-
-/**
-Returns the version number of the file system
-
-@internalComponent
-@released
-
-@return file system version
-*/
-unsigned short TFAT32BootSector::FileSystemVersion()
-{
- return iFileSystemVersion;
-}
-
-/**
-Sets the cluster number of the root directory
-
-@internalComponent
-@released
-*/
-void TFAT32BootSector::SetRootCluster()
-{
- iRootCluster = KDefaultRootDirClusterNumber;
-}
-
-/**
-Returns the cluster number of the root directory
-
-@internalComponent
-@released
-
-@return cluster number allocated to root directory,usually 2.
-*/
-unsigned int TFAT32BootSector::RootCluster()
-{
- return iRootCluster;
-}
-
-/**
-Set the sector number containing the FSIInfo structure
-
-@internalComponent
-@released
-*/
-void TFAT32BootSector::SetFSInfo()
-{
- iFSInfo = KDefaultFSInfoSector;
-}
-
-/**
-Returns the sector number containing the FSIInfo structure
-
-@internalComponent
-@released
-
-@return FSInfo structure
-*/
-unsigned short TFAT32BootSector::FSInfo()
-{
- return iFSInfo;
-}
-
-/**
-Set the backup boot sector
-
-@internalComponent
-@released
-*/
-void TFAT32BootSector::SetBackUpBootSector()
-{
- iBackUpBootSector = KDefaultBkUpBootSec;
-}
-
-/**
-Returns the backup boot sector
-
-@internalComponent
-@released
-
-@return backup boot sector
-*/
-unsigned short TFAT32BootSector::BackUpBootSector()
-{
- return iBackUpBootSector;
-}
-
-/**
-Reserved for future expansion. Code that formats FAT32 volumes should always
-set all of the bytes of this field to 0.
-
-@internalComponent
-@released
-*/
-void TFAT32BootSector::SetFutureReserved()
-{
- for(int i = 0;i < KMaxSizeFutureExpansion;i++)
- iFutureReserved[i] = 0;
-}
-
-/**
-Returns field value reserved for future expansion
-
-@internalComponent
-@released
-
-@return zero as this field is initialized to null value here
-*/
-unsigned char* TFAT32BootSector::FutureReserved()
-{
- return iFutureReserved;
-}
-
-
-/**Returns the file system type
-
-@internalComponent
-@released
-
-@return file system type
-*/
-unsigned char* TFAT32BootSector::FileSysType()
-{
- return iFileSysType;
-}
--- a/imgtools/imglib/filesystem/source/fat32filesystem.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,440 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* CFat32FileSystem is the concrete class which is responsible for
-* creating a FAT32 image. This class constitutes the method to
-* create boot sector, FAT Table and data region of a FAT32 Image
-* @internalComponent
-* @released
-*
-*/
-
-#include"fat32filesystem.h"
-
-/**
-Initializes the boot sector of a FAT 32 volume
-
-@internalComponent
-@released
-
-@param aPartitionSize partition size in bytes
-@param aConfigurableFatAttributes ConfigurableFatAttributes
-*/
-void CFat32FileSystem::CreateBootSector(Long64 aPartitionSize,ConfigurableFatAttributes* aConfigurableFatAttributes)
-{
- //initializes the boot sector values
- iFAT32BootSector.SetOEMName();
- unsigned char* OEMName = iFAT32BootSector.OEMName();
- iFAT32BootSector.SetJumpInstruction();
- unsigned char* JmpBoot = iFAT32BootSector.JumpInstruction();
- iFAT32BootSector.SetBytesPerSector(aConfigurableFatAttributes->iDriveSectorSize);
- unsigned short BytesPerSector = (unsigned short)iFAT32BootSector.BytesPerSector();
- iFAT32BootSector.ComputeSectorsPerCluster(aPartitionSize);
- unsigned char SectorsPerCluster = iFAT32BootSector.SectorsPerCluster();
- iFAT32BootSector.SetReservedSectors();
- unsigned short ReservedSectors = iFAT32BootSector.ReservedSectors();
- iFAT32BootSector.SetNumberOfFats(aConfigurableFatAttributes->iDriveNoOfFATs);
- unsigned char NumFats = iFAT32BootSector.NumberOfFats();
- iFAT32BootSector.SetRootDirEntries();
- unsigned short RootDirEntries = iFAT32BootSector.RootDirEntries();
- iFAT32BootSector.ComputeTotalSectors(aPartitionSize);
- unsigned short LowSectors = iFAT32BootSector.LowSectorsCount();
- iFAT32BootSector.SetMedia();
- unsigned char Media = iFAT32BootSector.Media();
- iFAT32BootSector.ComputeFatSectors(aPartitionSize);
- unsigned short FatSectors = iFAT32BootSector.FatSectors();
- iFAT32BootSector.SetSectorsPerTrack();
- unsigned short SectorPerTrack = iFAT32BootSector.SectorsPerTrack();
- iFAT32BootSector.SetNumberOfHeads();
- unsigned short NumberOfHeads = iFAT32BootSector.NumberOfHeads();
- iFAT32BootSector.SetHiddenSectors();
- unsigned int HiddenSectors = iFAT32BootSector.HiddenSectors();
- unsigned int HighSectorsCount = iFAT32BootSector.HighSectorsCount();
- unsigned int FatSectors32 = iFAT32BootSector.FatSectors32();
- iFAT32BootSector.SetExtFlags();
- unsigned short ExtFlags = iFAT32BootSector.ExtFlags();
- iFAT32BootSector.SetFileSystemVersion();
- unsigned short FileSystemVersion = iFAT32BootSector.FileSystemVersion();
- iFAT32BootSector.SetRootCluster();
- unsigned int RootCluster = iFAT32BootSector.RootCluster();
- iFAT32BootSector.SetFSInfo();
- unsigned short FSInfo = iFAT32BootSector.FSInfo();
- iFAT32BootSector.SetBackUpBootSector();
- unsigned short BackUpBootSector = iFAT32BootSector.BackUpBootSector();
- iFAT32BootSector.SetFutureReserved();
- unsigned char* FutureReserved = iFAT32BootSector.FutureReserved();
- iFAT32BootSector.SetBootSectorDriveNumber();
- unsigned char BootSectorDriveNumber = iFAT32BootSector.BootSectorDriveNumber();
- iFAT32BootSector.SetReservedByte();
- unsigned char ReservedByte = iFAT32BootSector.ReservedByte();
- iFAT32BootSector.SetBootSignature();
- unsigned char BootSignature = iFAT32BootSector.BootSignature();
- iFAT32BootSector.SetVolumeId();
- unsigned int VolumeId = iFAT32BootSector.VolumeId();
- iFAT32BootSector.SetVolumeLab(aConfigurableFatAttributes->iDriveVolumeLabel);
- unsigned char* VolumeLab = iFAT32BootSector.VolumeLab();
- iFAT32BootSector.SetFileSysType();
- unsigned char* FileSystemType = iFAT32BootSector.FileSysType();
-
- //copying of boot sector values in to the array
- iData = new unsigned char[BytesPerSector];
- unsigned int pos = 0;
- memcpy(&iData[pos],JmpBoot,3);
- pos += 3;
- memcpy(&iData[pos],OEMName,8);
- pos += 8;
- memcpy(&iData[pos],&BytesPerSector,2);
- pos += 2;
- memcpy(&iData[pos],&SectorsPerCluster,1);
- pos += 1;
- memcpy(&iData[pos],&ReservedSectors,2);
- pos += 2;
- memcpy(&iData[pos],&NumFats,1);
- pos += 1;
- memcpy(&iData[pos],&RootDirEntries,2);
- pos += 2;
- memcpy(&iData[pos],&LowSectors,2);
- pos += 2;
- memcpy(&iData[pos],&Media,1);
- pos += 1;
- memcpy(&iData[pos],&FatSectors,2);
- pos += 2;
- memcpy(&iData[pos],&SectorPerTrack,2);
- pos += 2;
- memcpy(&iData[pos],&NumberOfHeads,2);
- pos += 2;
- memcpy(&iData[pos],&HiddenSectors,4);
- pos += 4;
- memcpy(&iData[pos],&HighSectorsCount,4);
- pos += 4;
- memcpy(&iData[pos],&FatSectors32,4);
- pos += 4;
- memcpy(&iData[pos],&ExtFlags,2);
- pos += 2;
- memcpy(&iData[pos],&FileSystemVersion,2);
- pos += 2;
- memcpy(&iData[pos],&RootCluster,4);
- pos += 4;
- memcpy(&iData[pos],&FSInfo,2);
- pos += 2;
- memcpy(&iData[pos],&BackUpBootSector,2);
- pos += 2;
- memcpy(&iData[pos],FutureReserved,12);
- pos += 12;
- memcpy(&iData[pos],&BootSectorDriveNumber,1);
- pos += 1;
- memcpy(&iData[pos],&ReservedByte,1);
- pos += 1;
- memcpy(&iData[pos],&BootSignature,1);
- pos += 1;
- memcpy(&iData[pos],&VolumeId,4);
- pos += 4;
- memcpy(&iData[pos],VolumeLab,11);
- pos += 11;
- memcpy(&iData[pos],FileSystemType,8);
- pos += 8;
- while(pos < BytesPerSector)
- {
- iData[pos] = 0x00;
- pos++;
- }
- // Set sector [510] as 0xAA and [511] as 0x55 to mark the end of boot sector
- iData[KSizeOfFatBootSector-2] = 0x55;
- iData[KSizeOfFatBootSector-1] = 0xAA;
- // It is perfectly ok for the last two bytes of the boot sector to also
- // have the signature 0xAA55.
- iData[BytesPerSector-2] = 0x55;
- iData[BytesPerSector-1] = 0xAA;
- ComputeClusterSizeInBytes();
- ComputeRootDirSectors();
- ComputeBytesPerSector();
- MessageHandler::ReportMessage (INFORMATION,BOOTSECTORCREATEMSG, "FAT32");
-}
-
-/**
-Writes the boot sector of a FAT 32 volume
-
-@internalComponent
-@released
-
-@param aOutPutStream handle for the image file
-*/
-void CFat32FileSystem::WriteBootSector(ofstream& aOutPutStream)
-{
- MessageHandler::ReportMessage (INFORMATION,BOOTSECTORWRITEMSG, "FAT32");
- aOutPutStream.write(reinterpret_cast<char*>(&iData[0]),iFAT32BootSector.BytesPerSector());
- aOutPutStream.flush();
-}
-
-/**
-Creates and writes the FAT Table sector of a FAT 32 volume
-
-@internalComponent
-@released
-
-@param aClustersPerEntryMap iDatastructure containing the mapping of clusters allocated to the file.
-@param aOutPutStream handle for the image file
-*/
-void CFat32FileSystem::CreateFatTable(ofstream& aOutPutStream)
-{
- //data is written from cluster 2
- unsigned int clusterCounter = 2;
- unsigned int FATSizeInBytes = (iFAT32BootSector.FatSectors32()) * (iFAT32BootSector.BytesPerSector());
- // Each FAT32 entries occupies 4 bytes, hence divided by 4
- unsigned int totalFatEntries = FATSizeInBytes / 4;
- //contains the address of FAT Table
- unsigned int *FatTable = new unsigned int[totalFatEntries];
-
- /**Say cluster 5 starts at 5 and occupies clusters 7 and 9. The FAT table should have the
- value 7 at cluster location 5, the value 9 at cluster 7 and 'eof' value at cluster 9.
- Below algorithm serves this algorithm
- */
- int previousCluster;
- FatTable[0] = KFat32FirstEntry;
- FatTable[1] = EOF32;
- Iterator itr = iClustersPerEntry->begin();
- while(itr != iClustersPerEntry->end())
- {
- previousCluster = itr->second;
- if(iClustersPerEntry->count(itr->first) > 1)
- {
- for(unsigned int i = 1; i < iClustersPerEntry->count(itr->first); i++)
- {
- FatTable[previousCluster] = (++itr)->second;
- previousCluster = itr->second;
- ++clusterCounter;
- }
- }
- FatTable[previousCluster] = EOF32;
- itr++;
- ++clusterCounter;
- }
- // Each FAT32 entries occupies 4 bytes, hence multiply by 4
- string aFatString(reinterpret_cast<char*>(FatTable),clusterCounter*4);
- delete[] FatTable;
- if(clusterCounter < totalFatEntries)
- {
- // Each FAT32 entries occupies 4 bytes, hence multiply by 4
- aFatString.append((totalFatEntries - clusterCounter)*4, 0);
- }
- MessageHandler::ReportMessage (INFORMATION,FATTABLEWRITEMSG,
- "FAT32");
- //Write FAT table multiple times depending on the value of No of FATS set.
- unsigned int noOfFats = iFAT32BootSector.NumberOfFats();
- for(unsigned int i=0; i<noOfFats; i++)
- {
- aOutPutStream.write(aFatString.c_str(),aFatString.length());
- }
- aFatString.erase();
- aOutPutStream.flush();
-}
-
-/**
-FSINfo iData structure specific to FAT32
-
-@internalComponent
-@released
-
-@param aOutPutStream handle for the image file
-*/
-void CFat32FileSystem::CreateFSinfoSector(ofstream& aOutPutStream)
-{
- int counter = 0;
- unsigned int bytesPerSector = iFAT32BootSector.BytesPerSector();
- FSinfoData = new unsigned char[bytesPerSector];
- iFSInfo.SetFSInfo();
- memcpy(&FSinfoData[counter], &iFSInfo.FSI_LeadSign,4);
- counter += 4;
- memcpy(&FSinfoData[counter], &iFSInfo.FSI_Reserved,480);
- counter += 480;
- memcpy(&FSinfoData[counter], &iFSInfo.FSI_StrucSig,4);
- counter += 4;
- memcpy(&FSinfoData[counter], &iFSInfo.FSI_Free_Count,4);
- counter += 4;
- memcpy(&FSinfoData[counter], &iFSInfo.FSI_Nxt_Free,4);
- counter += 4;
- memcpy(&FSinfoData[counter], &iFSInfo.FSI_Reserved2,12);
- counter += 12;
- memcpy(&FSinfoData[counter], &iFSInfo.FSI_TrailSig,4);
- counter += 4;
- counter += (bytesPerSector-KSizeOfFatBootSector);
- aOutPutStream.write(reinterpret_cast<char*>(&FSinfoData[0]),counter);
- aOutPutStream.flush();
-}
-
-/**
- Initializes the left over reserved sectors of FAT32 image other than boot sector and FSinfo iData sector(sector 0 and 1)
-
- @internalComponent
- @released
-
- @param aOutPutStream handle to file stream
-*/
-void CFat32FileSystem::RestReservedSectors(ofstream& aOutPutStream)
-{
- unsigned int bytesPerSector = iFAT32BootSector.BytesPerSector();
- unsigned char* nullsector = new unsigned char[bytesPerSector];
- for(unsigned int counter = 0; counter < bytesPerSector ; counter++)
- {
- nullsector[counter] = 0;
- }
- nullsector[KSizeOfFatBootSector-2] = 0x55;
- nullsector[KSizeOfFatBootSector-1] = 0xAA;
- for(unsigned int sectorcount = 2; sectorcount < (unsigned int)(iFAT32BootSector.ReservedSectors()) - 1; sectorcount++)
- {
- // Sector no 6 and 7 contains the duplicate copy of boot sector and FSInfo sector in a FAT32 Image
- if(sectorcount == KBootBackupSector)
- {
- aOutPutStream.write(reinterpret_cast<char*>(&iData[0]),bytesPerSector);
- aOutPutStream.flush();
- }
- if(sectorcount == KFatBackupSector)
- {
- aOutPutStream.write(reinterpret_cast<char*>(&FSinfoData[0]),bytesPerSector);
- aOutPutStream.flush();
- }
- else
- {
- aOutPutStream.write(reinterpret_cast<char*>(&nullsector[0]),bytesPerSector);
- aOutPutStream.flush();
- }
- }
- delete[] nullsector;
- nullsector = NULL;
-}
-
-/**
-compute the cluster size in bytes,iClusterSize
-
-@internalComponent
-@released
-*/
-void CFat32FileSystem::ComputeClusterSizeInBytes()
-{
- iClusterSize = iFAT32BootSector.SectorsPerCluster()*iFAT32BootSector.BytesPerSector();
-}
-
-/**
-Compute the count of sectors occupied by the root directory,iRootDirSectors.
-
-@internalComponent
-@released
-*/
-void CFat32FileSystem::ComputeRootDirSectors()
-{
- iRootDirSectors = (iFAT32BootSector.RootDirEntries() * (KDefaultRootDirEntrySize) +
- (iFAT32BootSector.BytesPerSector() - 1)) / iFAT32BootSector.BytesPerSector();
-}
-
-/*
-Initialize the Bytes per Sector variable value.
-
-@internalComponent
-@released
-*/
-void CFat32FileSystem::ComputeBytesPerSector()
-{
- iBytesPerSector = iFAT32BootSector.BytesPerSector();
-}
-
-/*
-Sets the total number of clusters in iData segment of the FAT volume
-
-
-@internalComponent
-@released
-
-@aPartitionSize partition size in bytes
-*/
-void CFat32FileSystem::ComputeTotalClusters(Long64 aPartitionSize)
-{
- unsigned int totalDataSectors = iFAT32BootSector.TotalSectors(aPartitionSize) -
- ((iFAT32BootSector.NumberOfFats() *
- iFAT32BootSector.FatSectors32()) +
- iRootDirSectors+iFAT32BootSector.ReservedSectors());
-
- iTotalClusters = totalDataSectors / iFAT32BootSector.SectorsPerCluster();
- if(iTotalClusters < KMinimumFat32Clusters)
- {
- throw ErrorHandler(BOOTSECTORERROR,"Low Partition Size",__FILE__, __LINE__);
- }
- else if(iTotalClusters > KMaximumFat32Clusters)
- {
- throw ErrorHandler(BOOTSECTORERROR,"high Partition Size",__FILE__, __LINE__);
- }
-}
-/**
-This methods encapsulates the function call to write a complete FAT32 Image
-
-@internalComponent
-@released
-
-@param aPartitionSize partition size in bytes
-@param aNodeList Directory structure
-@param aOutPutStream output stream for writing file image
-@param aImageFileName image file name
-@param aLogFileName log file name
-@param aConfigurableFatAttributes ConfigurableFatAttributes
-*/
-
-void CFat32FileSystem::Execute(Long64 aPartitionSize,EntryList aNodeList,
- ofstream& aOutPutStream,ConfigurableFatAttributes* aConfigurableFatAttributes)
-{
- CDirRegion* dirRegionPtr = NULL;
- try
- {
- CreateBootSector(aPartitionSize,aConfigurableFatAttributes);
- ComputeTotalClusters(aPartitionSize);
- WriteBootSector(aOutPutStream);
- dirRegionPtr = new CDirRegion(aNodeList,this);
- dirRegionPtr->Execute();
- iClustersPerEntry = dirRegionPtr->GetClustersPerEntryMap();
- CreateFSinfoSector(aOutPutStream);
- RestReservedSectors(aOutPutStream);
- CreateFatTable(aOutPutStream);
- dirRegionPtr->WriteClustersIntoFile(aOutPutStream);
- delete dirRegionPtr;
- dirRegionPtr = NULL;
- }
- catch(ErrorHandler &aError)
- {
- delete dirRegionPtr;
- dirRegionPtr = NULL;
- throw ErrorHandler(aError.iMessageIndex,(char*)aError.iSubMessage.c_str(),(char*)aError.iFileName.c_str(),aError.iLineNumber);
- }
- /**
- Irrespective of successful or unsuccessful data drive image generation ROFSBUILD
- may try to generate images for successive ".oby" file input.
- During this course unhandled exceptions may cause leaving some memory on heap
- unused. so the unhandled exceptions handling is used to free the memory allocated
- on heap.
- */
- catch(...)
- {
- delete dirRegionPtr;
- dirRegionPtr = NULL;
- throw ErrorHandler(UNKNOWNERROR, __FILE__, __LINE__);
- }
-}
-
-/**
-Destructor of class CFat32FileSystem
-
-@internalComponent
-@released
-*/
-CFat32FileSystem::~CFat32FileSystem()
-{
- delete[] FSinfoData;
-};
--- a/imgtools/imglib/filesystem/source/fatbasebootsector.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,596 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* This file contains the definition of class TFATBaseBootSector.
-* TFATBaseBootSector is the base class for the boot sector class
-* of different FAT file system type.This contains the data member
-* representing the common fields in each FAT image type
-* @internalComponent
-* @released
-*
-*/
-
-#include "fatbasebootsector.h"
-
-/**
-Constructor of the base boot sector class
-
-@internalComponent
-@released
-*/
-TFATBaseBootSector::TFATBaseBootSector()
-{
-}
-
-/**
-Destructor of the base boot sector class
-
-@internalComponent
-@released
-*/
-TFATBaseBootSector::~TFATBaseBootSector()
-{
-}
-
-/**
-Function Sets the OEM name generally, Indication of what system
-formats the volume
-
-@internalComponent
-@released
-*/
-void TFATBaseBootSector::SetOEMName()
- {
- strcpy( reinterpret_cast<char*>(iOEMName),KDefaultOEMName);
- }
-
-/**
-Function to get the OEM name
-
-@internalComponent
-@released
-
-@return OEM Name
-*/
-unsigned char* TFATBaseBootSector::OEMName()
- {
- return iOEMName;
- }
-
-/**
-Function to set the jump instructions
-
-@internalComponent
-@released
-*/
-void TFATBaseBootSector::SetJumpInstruction()
-{
- iJmpBoot[0]= 0xEB;
- iJmpBoot[1]= 0x5A;
- iJmpBoot[2]= 0x90;
-}
-
-/**
-Function to get the jump instructions
-
-@internalComponent
-@released
-
-@return jump boot instruction
-*/
-unsigned char* TFATBaseBootSector::JumpInstruction()
-{
- return iJmpBoot;
-}
-
-
-/**
-Function to set the bytes per sector.
-
-@internalComponent
-@released
-
-@param aDriveSectorSize Sector size in bytes
-*/
-void TFATBaseBootSector::SetBytesPerSector(unsigned int aDriveSectorSize)
-{
- // Take the default value if SectorSize is not provided by the user.
- if (aDriveSectorSize != 0)
- {
- unsigned short int acceptableValues[] = {512,1024,2048,4096};
- unsigned short int acceptableValuesCount = 4;
- bool validSectorSize = false;
- for (unsigned int count=0; count<acceptableValuesCount; count++)
- {
- if(aDriveSectorSize == acceptableValues[count])
- {
- validSectorSize = true;
- break;
- }
- }
- // If invalid value for Sector Size is provided, consider the default value.
- if (validSectorSize)
- {
- iBytesPerSector=aDriveSectorSize;
- return;
- }
- else
- {
- cout<<"Warning: Invalid Sector Size value. Default value is considered.\n";
- }
- }
- iBytesPerSector=KDefaultBytesPerSector;
-}
-
-/**
-Return the bytes per sector
-
-@internalComponent
-@released
-
-@return bytes per sector, hard coded as 512 here.
-*/
-unsigned int TFATBaseBootSector::BytesPerSector() const
-{
- return iBytesPerSector;
-}
-
-/**
-Sets the number of Fats on the volume
-
-@internalComponent
-@released
-
-@param aDriveNoOfFATs Number of fats
-*/
-void TFATBaseBootSector::SetNumberOfFats(unsigned int aDriveNoOfFATs)
-{
- // Take the default value if No of FATs is not provided by the user.
- if (aDriveNoOfFATs != 0)
- {
- // If invalid value for No of FATs is provided, generate a warning and take the default value.
- if ((aDriveNoOfFATs>255) || (aDriveNoOfFATs<1))
- {
- cout<<"Warning: No of FATs should be between 0 and 256. Default value is considered.\n";
- iNumberOfFats= KDefaultNumFats;
- return;
- }
- iNumberOfFats= aDriveNoOfFATs;
- }
- else
- {
- iNumberOfFats= KDefaultNumFats;
- }
-}
-
-
-/**
-Total sectors on the volume,This count includes the total count of all sectors
-in all four regions of the volume.iTatalSectors is a 16 bit field and iTotalSectors32
-is a 32 bit field.Hence if the total sectors are more than 2^16(0x10000 in hex)
-then iTotalSectors32 is set otherwise it is zero.
-
-@internalComponent
-@released
-
-@param aPartitionSize Partition size in bytes
-*/
-void TFATBaseBootSector::ComputeTotalSectors(Long64 aPartitionSize)
-{
- int Log2OfBytesPerSector = Log2(iBytesPerSector);
- unsigned long TotalSectors64 = (unsigned long)(aPartitionSize >> Log2OfBytesPerSector);
- if(TotalSectors64 >= 0x10000)
- {
- iTotalSectors = 0;
- iTotalSectors32 = (unsigned int) TotalSectors64;
- }
- else
- {
- iTotalSectors = (unsigned short)TotalSectors64;
- iTotalSectors32=0;
- }
-}
-
-/**
-Set the media descriptor,0xF8 is the standard for fixed (non removable) media.
-
-@internalComponent
-@released
-*/
-void TFATBaseBootSector::SetMedia()
-{
- iMedia=KBPBMedia;
-}
-
-/**
-This methods gets the media descriptor
-
-@internalComponent
-@released
-
-@return media descriptor
-*/
-unsigned char TFATBaseBootSector::Media() const
-{
- return iMedia;
-}
-
-/**
-Set the number of hidden sectors in the volume,Count of hidden sector
-preceding the partition.
-
-@internalComponent
-@released
-*/
-void TFATBaseBootSector::SetHiddenSectors()
-{
- iHiddenSectors=KDefaultHiddenSectors;
-}
-
-/**
-Gets the number of hidden sectors in the volume
-
-@internalComponent
-@released
-
-@return the number of hidden sectors in a given FAT Volume
-*/
-unsigned int TFATBaseBootSector::HiddenSectors() const
-{
- return iHiddenSectors;
-}
-
-/**
-Set the sectors per track preceding the partition.
-
-@internalComponent
-@released
-*/
-void TFATBaseBootSector::SetSectorsPerTrack()
-{
- iSectorsPerTrack=KDefaultSectorsPerTrack;// default value for flash memory
-}
-
-/**
-Gets the number sectors per track in the volume
-
-@internalComponent
-@released
-
-@return the number of sectors per track in a given FAT Volume
-*/
-unsigned short TFATBaseBootSector::SectorsPerTrack() const
-{
- return iSectorsPerTrack;
-}
-
-/**
-Set the number of heads
-
-@internalComponent
-@released
-*/
-void TFATBaseBootSector::SetNumberOfHeads()
-{
- iNumHeads=KDefaultNumHeads;// default value for flash memory
-}
-
-/**
-Gets the the number of heads
-
-@internalComponent
-@released
-
-@return number of heads in a given FAT Volume
-*/
-unsigned short TFATBaseBootSector::NumberOfHeads() const
-{
- return iNumHeads;// default value for flash memory
-}
-
-/**
-Set the Physical drive number,not used in Symbian OS
-
-@internalComponent
-@released
-*/
-void TFATBaseBootSector::SetBootSectorDriveNumber()
-{
- iPhysicalDriveNumber=KDefaultDriveNumber;
-}
-
-/**
-Function to return drive number
-
-@internalComponent
-@released
-
-@return Physical drive number, not used in Symbian OS
-*/
-unsigned char TFATBaseBootSector::BootSectorDriveNumber() const
-{
- return iPhysicalDriveNumber;
-}
-
-/**
-Set the reserved byte value
-
-@internalComponent
-@released
-*/
-void TFATBaseBootSector::SetReservedByte()
-{
- iReservedByte=KDefaultReservedByte;
-}
-
-/**
-Get the value of reserved byte in boot sector
-
-@internalComponent
-@released
-
-@return Returns the reserved byte value
-*/
-unsigned char TFATBaseBootSector::ReservedByte() const
-{
- return iReservedByte;
-}
-
-/**
-Set the extended boot signature
-
-@internalComponent
-@released
-
-*/
-void TFATBaseBootSector::SetBootSignature()
-{
- iBootSign=KDefaultBootSignature;
-}
-
-/**
-Gets the extended boot signature
-
-@internalComponent
-@released
-
-@return boot signature
-*/
-unsigned char TFATBaseBootSector::BootSignature() const
-{
- return iBootSign;
-}
-
-/**
-Set the unique volume serial number,This ID is usually generated by
-simply combining the current date and time in to 32 bit value.
-
-@internalComponent
-@released
-*/
-void TFATBaseBootSector::SetVolumeId()
-{
- time_t rawtime;
- time(&rawtime);
- iVolumeId=rawtime;
-}
-
-/**
-Returns the volume id
-
-@internalComponent
-@released
-
-@return volume id field of the boot sector
-*/
-unsigned int TFATBaseBootSector::VolumeId() const
-{
-return iVolumeId ;
-}
-
-/**
-Set the volume's label
-
-@internalComponent
-@released
-
-@param aVolumeLable Data Drive Volume Label
-*/
-void TFATBaseBootSector::SetVolumeLab(string aVolumeLable)
-{
- // Set the default value of VolumeLable(i.e. "NO NAME ") if not provided
- // by the user.
- if (aVolumeLable.empty())
- {
- strcpy(reinterpret_cast<char*>(iVolumeLabel),KDefaultVolumeLabel);
- }
- else
- {
- // If the volume label provided is greater than 11 characters then consider only
- // the first 11 characters and generate a warning.
- int volumeMaxLangth= 11;
- int volumeLabelSize= aVolumeLable.size();
- if (volumeLabelSize > volumeMaxLangth)
- {
- cout<<"Warning: Size overflow for Data Drive Volume Label. Truncating to 11-bytes.\n";
- aVolumeLable.resize(volumeMaxLangth);
- strcpy(reinterpret_cast<char*>(iVolumeLabel),aVolumeLable.c_str());
- return;
- }
-
- // If the VolumeLable provided is less than 11-characters then pad the
- // remaining bytes with white-spaces.
- if (volumeLabelSize < KMaxVolumeLabel)
- {
- while(volumeLabelSize < 11)
- {
- aVolumeLable.append(" ");
- volumeLabelSize = aVolumeLable.size();
- }
- }
- strcpy(reinterpret_cast<char*>(iVolumeLabel),aVolumeLable.c_str());
- }
-}
-
-/**
-returns the volume's label
-
-@internalComponent
-@released
-
-*/
-unsigned char* TFATBaseBootSector::VolumeLab()
-{
- return iVolumeLabel;
-}
-
-/**
-Returns the number of reserved sectors on the volume
-
-@internalComponent
-@released
-
-@return iReservedSectors
-*/
-unsigned short TFATBaseBootSector::ReservedSectors() const
-{
- return iReservedSectors;
-}
-
-/**
-Returns the number of Fats on the volume
-
-@internalComponent
-@released
-
-@return iNumberOfFats
-*/
-unsigned char TFATBaseBootSector::NumberOfFats() const
-{
- return iNumberOfFats;
-}
-
-/**
-Returns the number of entries allowed in the root directory, specific to Fat12/16, zero for FAT32
-
-@internalComponent
-@released
-
-@return iRootDirEntries
-*/
-unsigned short TFATBaseBootSector::RootDirEntries() const
-{
- return iRootDirEntries;
-}
-
-/**
-Returns the total sectors on the volume,
-
-@internalComponent
-@released
-
-@return iTotalSectors
-*/
-unsigned int TFATBaseBootSector::TotalSectors(Long64 aPartitionSize) const
-{
- if((aPartitionSize/iBytesPerSector)>= 0x10000)
- return iTotalSectors32;
- else
- return iTotalSectors;
-}
-
-/**
-Returns base 2 Logarithm of a number
-
-@internalComponent
-@released
-
-@param aNum number whose logarithm is to be taken
-@return log base 2 of the number passed
-*/
-int TFATBaseBootSector::Log2(int aNum)
-{
- int res=-1;
- while(aNum)
- {
- res++;
- aNum>>=1;
- }
- return(res);
-}
-
-/**
-Returns the sectors per cluster ratio
-
-@internalComponent
-@released
-
-@return iSectorsPerCluster
-*/
-unsigned char TFATBaseBootSector::SectorsPerCluster() const
-{
- return iSectorsPerCluster;
-}
-
-/**
-Returns the 16 bit count of total sectors on the volume
-
-@internalComponent
-@released
-
-@return iTotalSectors
-*/
-unsigned short TFATBaseBootSector::LowSectorsCount() const
-{
- return iTotalSectors;
-}
-
-/**
-Returns the 32 bit count of total sectors on the volume
-
-@internalComponent
-@released
-
-@return iTotalSectors
-*/
-unsigned int TFATBaseBootSector::HighSectorsCount() const
-{
- return iTotalSectors32;
-}
-
-/**
-Returns sectors used for the Fat table, zero for FAT32
-
-@internalComponent
-@released
-
-@return iFatSectors
-*/
-unsigned short TFATBaseBootSector::FatSectors() const
-{
- return (unsigned short)iFatSectors;
-}
-
-/**
-Returns sectors used for the Fat table in FAT32
-
-@internalComponent
-@released
-
-@return iFatSectors32
-*/
-unsigned int TFATBaseBootSector::FatSectors32() const
-{
- return iFatSectors32;
-}
--- a/imgtools/imglib/filesystem/source/filesystemclass.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* This base class defines the common functions, should be available
-* for the derived classes (FAT16 and FAT32 boot sector classes).
-* @internalComponent
-* @released
-*
-*/
-
-#include"filesystemclass.h"
-
-/**
-constructor for CFileSystem class
-
-@internalComponent
-@released
-*/
-CFileSystem::CFileSystem()
-{
-}
-
-/**
-virtual destructor for CFileSystem class
-
-@internalComponent
-@released
-*/
-CFileSystem::~CFileSystem()
-{
- delete[] iData;
-}
-
-/**
-get total number of clusters in data segment of FAT image
-
-@internalComponent
-@released
-
-@return iTotalClusters total number of clusters
-*/
-unsigned long int CFileSystem::GetTotalCluster() const
-{
- return iTotalClusters;
-}
-
-/**
-Return total number of sectors occupied in root directory
-
-@internalComponent
-@released
-
-@return iRootDirSectors total number of root directory sectors
-*/
-unsigned long int CFileSystem::GetRootDirSectors() const
-{
- return iRootDirSectors;
-}
-
-/**
-Returns cluster size in bytes
-
-@internalComponent
-@released
-
-@return iClusterSize cluster size in bytes
-*/
-unsigned long int CFileSystem::GetClusterSize() const
-{
- return iClusterSize;
-}
-
-/**
-Function to get the sector size in bytes
-
-@internalComponent
-@released
-
-@return iBytesPerSector cluster size in bytes
-*/
-unsigned int CFileSystem::GetBytesPerSector() const
-{
- return iBytesPerSector;
-}
--- a/imgtools/imglib/filesystem/source/filesysteminterface.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,125 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* This class provides the interface to external tools which can
-* use FileSystem component library. Upon external request this class
-* classifies the request type either FAT16 or FAT32 and invokes
-* the specific functions to generate the FAT image.
-* @internalComponent
-* @released
-*
-*/
-
-#include"errorhandler.h"
-#include"filesysteminterface.h"
-#include"fat16filesystem.h"
-#include"fat32filesystem.h"
-#include"dirregion.h"
-
-
-//static member definition
-
-Ofstream CFileSystemInterFace::iOutputStream;
-
-/**
-API exposed by the FileSystem component to be used by an external component(s).
-This is method to be used by the external component for passing information required
-by the FileSystem component
-
-@internalComponent
-@released
-
-@param aNodeList Directory structure
-@param aFileSystem file system type
-@param aImageFileName image file name
-@param aLogFileName log file name
-@param aPartitionSize partition size in bytes
-*/
-FILESYSTEM_API int CFileSystemInterFace::CreateFilesystem(EntryList* aNodeList ,
- TFileSystem aFileSystem,
- char* aImageFileName,
- char* aLogFileName,
- ConfigurableFatAttributes* aConfigurableFatAttributes,
- Long64 aPartitionSize)
-{
-
-
- CFileSystem* iFileSystem = NULL;
- try
- {
- MessageHandler::StartLogging (aLogFileName);
- iOutputStream.open(aImageFileName,ios_base::out|ios_base::binary);
- if(iOutputStream.fail() == true )
- {
- throw ErrorHandler(FILEOPENERROR,aImageFileName,__FILE__, __LINE__);
- }
- switch(aFileSystem)
- {
- case EFAT16:
- iFileSystem = new CFat16FileSystem;
- break;
-
- case EFAT32:
- iFileSystem= new CFat32FileSystem;
- break;
- default:
- return EFSNotSupported;
- break;
-
- }
- iFileSystem->Execute(aPartitionSize,*aNodeList,iOutputStream,aConfigurableFatAttributes);
- delete iFileSystem;
- iFileSystem = NULL;
- iOutputStream.close();
- MessageHandler::CleanUp();
- }
- catch(ErrorHandler &error)
- {
- iOutputStream.close();
- delete iFileSystem;
- iFileSystem = NULL;
- MessageHandler::StartLogging (aLogFileName);
- error.Report();
- MessageHandler::CleanUp();
- return EFileSystemError;
- }
- /**
- Irrespective of successful or unsuccessful data drive image generation ROFSBUILD
- may try to generate images for successive oby file input.
- During this course unhandled exceptions may cause leaving some memory on heap
- unused. so the unhandled exceptions handling is used to free the memory allocated
- on heap.
- */
- catch(...)
- {
- iOutputStream.close();
- delete iFileSystem;
- iFileSystem = NULL;
- return EFileSystemError;
- }
- return 0;
-}
-
-
-/**
-Constructor of Class ConfigurableFatAttributes
-
-@internalComponent
-@released
-*/
-ConfigurableFatAttributes::ConfigurableFatAttributes()
-{
- iDriveSectorSize = 0;
- iDriveNoOfFATs = 0;
-}
--- a/imgtools/imglib/filesystem/source/longentry.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,209 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* This class provides the basic set and get operations associated
-* with longentry attributes.
-* @internalComponent
-* @released
-*
-*/
-
-
-#include "longentry.h"
-
-/**
-Constructor responsible to initialze the possible attributes of
-long entry
-
-@internalComponent
-@released
-
-@param aChckSum - Short entry checksum value
-*/
-
-CLongEntry::CLongEntry( char aChckSum):
- iDirOrder(0),
- iAttribute(EAttrLongName),
- iDirType(KDirSubComponent),
- iCheckSum(aChckSum),
- iFirstClusterNumberLow(0)
-{
-}
-
-/**
-Destructor:
-
-@internalComponent
-@released
-
-*/
-CLongEntry::~CLongEntry()
-{
-}
-
-/**
-Function responsible to return Directory entry Order
-
-@internalComponent
-@released
-
-@return iDirOrder - Long name sub entry order
-*/
-char CLongEntry::GetDirOrder() const
-{
- return iDirOrder;
-}
-
-/**
-Function responsible to initialize Directory entry Order
-
-@internalComponent
-@released
-
-@param aDirOrder - Long name sub entry order
-*/
-void CLongEntry::SetDirOrder(char aDirOrder)
-{
- iDirOrder = aDirOrder;
-}
-
-/**
-Function responsible to return SubName1
-
-@internalComponent
-@released
-
-@return iSubName1 - returns sub name 1 of a long entry
-*/
-string& CLongEntry::GetSubName1()
-{
- return iSubName1;
-}
-
-/**
-Function responsible to set SubName3
-
-@internalComponent
-@released
-
-@param aSubName1 - a long entry sub name 1
-*/
-void CLongEntry::SetSubName1(string aSubName1)
-{
- iSubName1 = aSubName1;
-}
-
-/**
-Function responsible to return SubName2
-
-@internalComponent
-@released
-
-@return iSubName2 - returns sub name 2 of a long entry
-*/
-string& CLongEntry::GetSubName2()
-{
- return iSubName2;
-}
-
-/**
-Function responsible to set SubName2
-
-@internalComponent
-@released
-
-@param aSubName2 - a long entry sub name 2
-*/
-void CLongEntry::SetSubName2(string aSubName2)
-{
- iSubName2 = aSubName2;
-}
-
-/**
-Function responsible to return SubName3
-
-@internalComponent
-@released
-
-@return iSubName3 - returns sub name 3 of a long entry
-*/
-string& CLongEntry::GetSubName3()
-{
- return iSubName3;
-}
-
-/**
-Function responsible to set SubName3
-
-@internalComponent
-@released
-
-@param aSubName3 - a long entry sub name 3
-*/
-void CLongEntry::SetSubName3(string aSubName3)
-{
- iSubName3 = aSubName3;
-}
-
-/**
-Function responsible to return attribute
-
-@internalComponent
-@released
-
-@return iAttribute - returns a long entry attribute
-*/
-char CLongEntry::GetAttribute() const
-{
- return iAttribute;
-}
-
-/**
-Function responsible to return check sum
-
-@internalComponent
-@released
-
-@return iCheckSum - returns long entry check sum
-*/
-char CLongEntry::GetCheckSum() const
-{
- return iCheckSum;
-}
-
-/**
-Function responsible to return Dir Type
-
-@internalComponent
-@released
-
-@return iDirType - returns long entry dir type
-*/
-char CLongEntry::GetDirType() const
-{
- return iDirType;
-}
-
-/**
-Function responsible to return Low cluster number
-
-@internalComponent
-@released
-
-@return iFirstClusterNumberLow - returns Low cluster number
-*/
-unsigned short int CLongEntry::GetClusterNumberLow() const
-{
- return iFirstClusterNumberLow;
-}
--- a/imgtools/imglib/filesystem/source/longname.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,462 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* Receives the long file name and prepares short and long directory
-* entries.
-* @internalComponent
-* @released
-*
-*/
-
-
-#include "longname.h"
-
-
-/**
-Constructor: Responsible to create
-1. Short entry
-2. Sub components of long entry name as per microsoft FAT spec.
-
-@internalComponent
-@released
-
-@param aClusterPtr - Cluster instance address
-@param aEntry - CDirectory class pointer
-*/
-
-ClongName::ClongName(CCluster* aClusterPtr,
- CDirectory* aEntry):
- iClusterPtr(aClusterPtr),
- iTildeNumberPosition(ETildeNumberPosition),
- iSubNameProperEnd(false),
- iFirstNullName(false)
-{
- iLongName = aEntry->GetEntryName();
- iLongEntryAttribute = aEntry->GetEntryAttribute();
- iClusterNumber = aClusterPtr->GetCurrentClusterNumber();
- iLongNameLength = iLongName.length();
- if(iLongNameLength == 0)
- {
- throw ErrorHandler(EMPTYFILENAME, __FILE__, __LINE__);
- }
- FormatLongFileName(iLongName);
- iShortName = GetShortEntryName();
- GShortEntryList.push_back(iShortName);
-}
-
-
-/**
-Static function to clear the strings stored in static Global Stringlist
-
-@internalComponent
-@released
-*/
-void ClongName::DestroyShortEntryList()
-{
- GShortEntryList.clear();
-}
-
-/**
-Destructor: To clear the contents from the STL containers in any exception case.
-In normal case the containers are cleared once its usage is finished
-
-@internalComponent
-@released
-*/
-
-ClongName::~ClongName()
-{
- iSubNamesList.clear();
- while(iLongEntryStack.size() > 0)
- {
- delete iLongEntryStack.top();
- iLongEntryStack.pop();
- }
- /* Cluster instance should be deleted only by dirregion, So just assign
- * NULL value to the pointer
- */
- iClusterPtr = NULL;
-}
-
-/**
-Function takes a long entry and writes all of the attributes into iLongNameEntryString.
-To write the sub name's in a formatted WriteSubName() function invoked
-
-@internalComponent
-@released
-
-@param aLongEntry - the long entry
-*/
-void ClongName::WriteLongEntry(CLongEntry* aLongEntry,string& longEntryString)
-{
- longEntryString.append(KWriteOnce, aLongEntry->GetDirOrder());
- WriteSubName(aLongEntry->GetSubName1(),(ESubName1Length*2),longEntryString);
- longEntryString.append(KWriteOnce, aLongEntry->GetAttribute());
- longEntryString.append(KWriteOnce, aLongEntry->GetDirType());
- longEntryString.append(KWriteOnce, aLongEntry->GetCheckSum());
- WriteSubName(aLongEntry->GetSubName2(),(ESubName2Length*2),longEntryString);
- unsigned short int lowClusterNumber = aLongEntry->GetClusterNumberLow();
- longEntryString.append(ToString(lowClusterNumber));
- WriteSubName(aLongEntry->GetSubName3(),(ESubName3Length*2),longEntryString);
-}
-
-/**
-Function responsible to
-1. Write the sub name of the long entry, every character splitted by '.'(00)
-2. If the name is not multiple of 13 this function applies NULL character padding and
- padding with 'FF'.
-
-@internalComponent
-@released
-
-@param aName - Sub name of a long entry
-@param aSubNameLength - No of characters to be filled
-@param alongEntryString - formatted sub name appended to this string
-*/
-void ClongName::WriteSubName(string& aSubName,unsigned short aSubNameLength,string& alongEntryString)
-{
- unsigned int subNameCurrLength = aSubName.length();
- if(subNameCurrLength == 0)
- {
- iFirstNullName = true;
- }
- else
- {
- iFirstNullName = false;
- }
- unsigned int beginIndex = 1;
- if(subNameCurrLength > 0)
- {
- //Insert zero between every character, as per FAT spec requirement
- while(subNameCurrLength > 0)
- {
- aSubName.insert(beginIndex,1,0); //Insert zero once
- beginIndex += 2; //Jump 2 characters
- --subNameCurrLength;
- }
- subNameCurrLength = aSubName.length();
- if(subNameCurrLength == aSubNameLength)
- {
- iSubNameProperEnd = true;
- }
- //Apply padding with two zero's to mention Long Name end.
- if(subNameCurrLength < aSubNameLength)
- {
- aSubName.insert(subNameCurrLength, KPaddingCharCnt, 0);
- iSubNameProperEnd = false;
- }
- }
- subNameCurrLength = aSubName.length();
- if((iSubNameProperEnd == true) && (iFirstNullName == true))
- {
- aSubName.insert(subNameCurrLength, KPaddingCharCnt, 0);
- iSubNameProperEnd = false;
- iFirstNullName = false;
- }
- subNameCurrLength = aSubName.length();
- //Insert FF for all unfilled characters.
- if(subNameCurrLength < aSubNameLength)
- {
- aSubName.insert(subNameCurrLength,(aSubNameLength - subNameCurrLength),
- KLongNamePaddingChar);
- }
- alongEntryString.append(aSubName.c_str(),aSubName.length());
-}
-
-/**
-Function responsible to push the string into iNameList container and to erase the input
-strings data
-
-@internalComponent
-@released
-
-@param aFirstName - first sub name
-@param aSecondName - Second sub name
-@param aThirdName - third sub name
-*/
-void ClongName::PushAndErase(string& aFirstName,string& aSecondName,string& aThirdName)
-{
- iSubNamesList.push_back(aFirstName);
- aFirstName.erase();
- iSubNamesList.push_back(aSecondName);
- aSecondName.erase();
- iSubNamesList.push_back(aThirdName);
- aThirdName.erase();
-}
-
-/**
-Function responsible split single sub name from the long name
-
-@internalComponent
-@released
-
-@param aLongName - The long name need to be splitted
-@param aStartIndex - Sub name starting index
-@param aStringLength - total string length
-@param aSubNameLength - Length of the Sub Name of required length
-@param aSubName - splitted Sub Name assigned using this string
-*/
-void ClongName::GetSubName(string& aLongName,
- int& aStartIndex,
- int& aStringLength,
- int aSubNameLength,
- string& aSubName)
-{
- if((aStartIndex + aSubNameLength) <= aStringLength)
- {
- aSubName = aLongName.substr(aStartIndex,aSubNameLength);
- aStartIndex += aSubNameLength;
- return;
- }
- aSubName = aLongName.substr(aStartIndex);
- aStartIndex += aSubName.length();
-}
-
-/**
-Function to split the long file name into smaller sub names,such as it should be
-written into long directory entries. All splitted names are pushed into the
-iNameList container.
-
-@internalComponent
-@released
-*/
-void ClongName::FormatLongFileName(string& aLongName)
-{
- int stringLength = aLongName.length();
- int startIndex = 0;
- string iSubName1;
- string iSubName2;
- string iSubName3;
-
- while(startIndex < stringLength)
- {
- GetSubName(aLongName,startIndex,stringLength,ESubName1Length,iSubName1);
- GetSubName(aLongName,startIndex,stringLength,ESubName2Length,iSubName2);
- GetSubName(aLongName,startIndex,stringLength,ESubName3Length,iSubName3);
- PushAndErase(iSubName1,iSubName2,iSubName3);
- }
-}
-
-/**
-Function responsible to create new short name if the currently generated short name
-already exists.
-
-eg. Input:UNITTE~1TXT returns:UNITTE~2TXT
-
-@internalComponent
-@released
-
-@return - returns the short name
-*/
-void ClongName::CheckAndUpdateShortName(string& aShortName)
-{
- char trailingChar;
- StringList::iterator beginIter = GShortEntryList.begin();
- StringList::iterator endIter = GShortEntryList.end();
- string tempString;
- while(beginIter != endIter)
- {
- tempString = (*beginIter);
- if(strcmp(tempString.c_str(),aShortName.c_str()) == 0)
- {
- trailingChar = aShortName.at(iTildeNumberPosition);
- aShortName[iTildeNumberPosition] = ++trailingChar; //Increment the character value by 1
- continue;
- }
- ++beginIter;
- }
- int gap = ENameLengthWithExtension - aShortName.length();
- if(gap >0 )
- aShortName.append(gap,KSpace);
-}
-
-/**
-Function responsible to take the long file name as input and to prepare the short name.
-e.g. Long File Name.pl to LONGFI~1PL
-
-@internalComponent
-@released
-
-@return - returns the short name
-*/
-
-string ClongName::GetShortEntryName()
-{
- string shortName;
- unsigned int extensionIndex = iLongName.find_last_of(KDot);
-
- unsigned int dotIndex = extensionIndex;
- //Erase all the dots from the string, but keep the extension index
- while(dotIndex != string::npos)
- {
- iLongName.erase(dotIndex,1); //Erase the dot
- dotIndex = iLongName.find_first_of(KDot);
- if(dotIndex != string::npos)
- {
- //Decrement only if more than one dot exists
- --extensionIndex;
- }
- }
-
- if((iLongEntryAttribute & EAttrDirectory)== 0)
- {
- if(extensionIndex <= EShortNameInitialLength)
- {
- //if the full name length is less than 6 characters, assign the whole name
- shortName.assign(iLongName.c_str(),extensionIndex);
- }
- else
- {
- shortName.assign(iLongName.c_str(),EShortNameInitialLength);
- }
- //+1 is added to get '~' symbol position
- iTildeNumberPosition = shortName.length() + 1;
- }
- else
- {
- shortName.assign(iLongName.c_str(),EShortNameInitialLength);
- }
- shortName += KTilde;
- shortName += KTildeNumber;
- shortName.assign(ToUpper(shortName));
- if(extensionIndex < iLongName.length()) //to identify whether the name has any extension.
- {
- if(shortName.length() < ENameLength)
- {
- shortName.append((ENameLength - shortName.length()),KSpace);
- }
- string shortNameString = iLongName.substr(extensionIndex,EExtensionLength);
- shortName.append(ToUpper(shortNameString));
- CheckAndUpdateShortName(shortName);
- return shortName;
- }
- //extension padding
- shortName.append(EExtensionLength,KSpace);
- CheckAndUpdateShortName(shortName);
- return shortName;
-}
-
-/**
-Function takes the short entry name as input and calculates checksum as per the
-Microsoft FAT spec.
-
-@internalComponent
-@released
-
-@return - returns checkSum
-*/
-
-unsigned char ClongName::CalculateCheckSum()
-{
- char* tempShortNamePtr = (char*)iShortName.c_str();
- unsigned short int nameLength = 0;
- unsigned char chckSum = '\0';
- for(nameLength = ENameLengthWithExtension; nameLength != 0; nameLength--)
- {
- chckSum = ((chckSum & 1) ? 0x80 : NULL) + (chckSum >>1) + *tempShortNamePtr++;
- }
- return chckSum;
-}
-
-/**
-Function responsible to initialize short entry attributes.
-Short entry is also an sub entry along with Long entries
-
-@internalComponent
-@released
-
-@param aEntry - directory entry which has long file name
-@return shortEntry - returns the initialized short Directory entry
-*/
-CDirectory* ClongName::CreateShortEntry(CDirectory* aEntry)
-{
- CDirectory* shortEntry = new CDirectory(iShortName.c_str(),NULL);
- shortEntry->SetEntryAttribute(aEntry->GetEntryAttribute());
- if(aEntry->IsFile())
- {
- shortEntry->SetFilePath((char*)aEntry->GetFilePath().c_str());
- }
- shortEntry->SetFileSize(aEntry->GetFileSize());
- /** Initialize the cluster number variables by splitting high and low words of
- current cluster number
- */
- shortEntry->SetClusterNumberHi((unsigned short)(iClusterNumber >> KBitShift16));
- shortEntry->SetClusterNumberLow((unsigned short)(iClusterNumber & KHighWordMask));
- return shortEntry;
-}
-
-/**
-Function responsible
-1. To erase the string from the iNameList container.
-2. To pop out the element
-
-@internalComponent
-@released
-*/
-void ClongName::PopAndErase()
-{
- iSubNamesList.front().erase();
- iSubNamesList.pop_front();
-}
-
-/**
-Function responsible to
-1. Pop all the name's 3 by 3 from iNameList container
-2. Construct long name directory entries
-3. Push the long entries into iLongEntryStack
-4. finally create Long name sub entries as string and append it to longEntryString.
-
-@internalComponent
-@released
-
-@return - returns the formatted long name string
-*/
-string ClongName::CreateLongEntries()
-{
- string longEntryString;
- CLongEntry* longEntryObject;
- unsigned char chckSum = CalculateCheckSum();
- unsigned char dirOrderNumber = 0x00;
- while(iSubNamesList.size() > 0)
- {
- longEntryObject = new CLongEntry(chckSum);
- longEntryObject->SetSubName1(iSubNamesList.front());
- PopAndErase();
- longEntryObject->SetSubName2(iSubNamesList.front());
- PopAndErase();
- longEntryObject->SetSubName3(iSubNamesList.front());
- PopAndErase();
- longEntryObject->SetDirOrder(++dirOrderNumber);
-
- iLongEntryStack.push(longEntryObject);
- }
-
- bool lastLongEntry = true;
- while(iLongEntryStack.size() > 0)
- {
- if(lastLongEntry == true)
- {
- longEntryObject = iLongEntryStack.top();
- /* As per Microsoft FAT spec, Last sub entry of Long name Directory Order attribute
- * should be logically OR'ed with value '0x40'
- */
- longEntryObject->SetDirOrder(longEntryObject->GetDirOrder() | ELastLongEntry);
- lastLongEntry = false;
- }
- WriteLongEntry(iLongEntryStack.top(),longEntryString);
- delete iLongEntryStack.top();
- iLongEntryStack.pop();
- }
- return longEntryString;
-}
--- a/imgtools/imglib/filesystem/source/messagehandler.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* This Class responsible to manage the instance of messageimplementation
-* class.
-* @internalComponent
-* @released
-*
-*/
-
-
-#include "messagehandler.h"
-
-Message* MessageHandler::iInstance=0;
-
-/**
-Function Get Instance of class Message Implementation and initializing messages.
-
-@internalComponent
-@released
-
-@return Instance of MessageImplementation
-*/
-Message * MessageHandler::GetInstance()
-{
- if(iInstance == 0)
- {
- iInstance = new MessageImplementation();
- iInstance->InitializeMessages();
- }
- return iInstance;
-}
-
-/**
-Function to call StartLogging function of class Message Implementation.
-
-@internalComponent
-@released
-
-@param aFileName
-Name of the Log File
-*/
-void MessageHandler::StartLogging(char *aFileName)
-{
- GetInstance()->StartLogging(aFileName);
-}
-
-/**
-Function to delete instance of class MessageImplementation
-
-@internalComponent
-@released
-*/
-void MessageHandler::CleanUp()
-{
- delete iInstance;
- iInstance = NULL;
-}
-
-/**
-Function to report message to class MessageImplementation
-
-@internalComponent
-@released
-*/
-void MessageHandler::ReportMessage(int aMsgType, int aMsgIndex,char* aName)
-{
- GetInstance()->ReportMessage(aMsgType,aMsgIndex,aName);
-}
--- a/imgtools/imglib/filesystem/source/messageimplementation.cpp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,241 +0,0 @@
-/*
-* Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-* This class is used get the message strings and provides operations
-* to log them into log file
-* @internalComponent
-* @released
-*
-*/
-
-
-
-#include "messageimplementation.h"
-#include "errorhandler.h"
-
-
-char *errorMssgPrefix="FileSystem : Error:";
-char *warnMssgPrefix="FileSystem : Warning:";
-char *infoMssgPrefix="FileSystem : Information:";
-char *Space=" ";
-
-enum MessageArraySize{MAX=16};
-
-//Messages stored required for the program
-struct EnglishMessage MessageArray[MAX]=
-{
- {FILEOPENERROR,"%s:%d: Could not open file : %s."},
- {FILEREADERROR,"%s:%d: Could not read file : %s."},
- {FILEWRITEERROR,"%s:%d: Could not write input image file."},
- {MEMORYALLOCATIONERROR,"%s:%d: Memory allocation failure."},
- {ENTRYCREATEMSG,"Creating the entry : %s."},
- {BOOTSECTORERROR,"%s:%d: Boot Sector Error: %s."},
- {BOOTSECTORCREATEMSG,"Creating bootsector : %s."},
- {BOOTSECTORWRITEMSG,"Writing bootsector : %s"},
- {FATTABLEWRITEMSG, "Writing FAT table for : %s"},
- {IMAGESIZETOOBIG,"%s:%d: Current image size is greater than the given partition size: %s"},
- {NOENTRIESFOUND,"%s:%d: No entries found under root."},
- {EMPTYFILENAME,"%s:%d: Empty name received."},
- {EMPTYSHORTNAMEERROR,"%s:%d: Empty short name."},
- {CLUSTERERROR,"%s:%d: Cluster Instance error."},
- {ROOTNOTFOUND,"%s:%d: None of the entries received."},
- {UNKNOWNERROR,"%s:%d: Unknown exception occured."}
-};
-
-/**
-Constructor to reset the logging option flag.
-
-@internalComponent
-@released
-*/
-MessageImplementation::MessageImplementation()
-{
- iLogging = false;
-}
-
-/**
-Destructor to close log file if logging is enabled and to clear the messaged.
-
-@internalComponent
-@released
-*/
-MessageImplementation::~MessageImplementation()
-{
- if(iLogging)
- {
- fclose(iLogPtr);
- }
- iMessage.clear();
-}
-
-/**
-Function to Get Message stored in map.
-
-@internalComponent
-@released
-
-@param aMessageIndex - Index of the Message to be displayed
-@return Message string to be displayed
-*/
-char * MessageImplementation::GetMessageString(int aMessageIndex)
-{
- Map::iterator p = iMessage.find(aMessageIndex);
- if(p != iMessage.end())
- {
- return p->second;
- }
- else
- {
- if(aMessageIndex <= MAX)
- {
- return MessageArray[aMessageIndex-1].message;
- }
- else
- {
- return NULL;
- }
- }
-}
-
-/**
-Function to log message in log file if logging is enable.
-
-@internalComponent
-@released
-
-@param aString - Message to be displayed
-*/
-void MessageImplementation::LogOutput(const char *aString)
-{
- if (iLogging)
- {
- fputs(aString,iLogPtr);
- fputs("\n",iLogPtr);
- }
-}
-
-
-/**
-Function to display output and log message in log file if logging is enable.
-
-@internalComponent
-@released
-
-@param aString - Message to be displayed
-*/
-void MessageImplementation::Output(const char *aString)
-{
-
- if (iLogging)
- {
- fputs(aString,iLogPtr);
- fputs("\n",iLogPtr);
- }
- cout << aString << endl;
-}
-
-/**
-Function to Get Message stored in map and to display the Message
-
-@internalComponent
-@released
-
-@param aMessageType - The type of the message, whether it is Error or Warning or Information.
-@param aMsgIndex - The index of the information and the corresponding arguments.
-*/
-void MessageImplementation::ReportMessage(int aMessageType, int aMsgIndex,...)
-{
- string reportMessage;
- char* ptr;
-
- va_list ap;
- va_start(ap,aMsgIndex);
-
- ptr = GetMessageString(aMsgIndex);
-
- if(ptr)
- {
- switch (aMessageType)
- {
- case ERROR:
- reportMessage += errorMssgPrefix;
- break;
- case WARNING:
- reportMessage += warnMssgPrefix;
- break;
- case INFORMATION:
- reportMessage += infoMssgPrefix;
- break;
- default:
- break;
- }
- reportMessage += Space;
- reportMessage.append(ptr);
- int location = reportMessage.find('%',0);
- //Erase the string from % to the end, because it is no where required.
- reportMessage.erase(location);
- reportMessage += va_arg(ap, char *);
-
- LogOutput(reportMessage.c_str());
- }
-}
-
-/**
-Function to start logging.
-
-@internalComponent
-@released
-
-@param aFileName - Name of the Log file
-*/
-void MessageImplementation::StartLogging(char *aFileName)
-{
- char logFile[1024];
- FILE *fptr;
-
- strcpy(logFile,aFileName);
-
- // open file for log etc.
- if((fptr=fopen(logFile,"a"))==NULL)
- {
- ReportMessage(WARNING, FILEOPENERROR,aFileName);
- }
- else
- {
- iLogging = true;
- iLogPtr=fptr;
- }
-}
-
-/**
-Function to put Message string in map which is stored in message file.
-If file is not available the put message in map from Message Array structure.
-
-@internalComponent
-@released
-
-@param aFileName - Name of the Message file passed in
-*/
-void MessageImplementation::InitializeMessages()
-{
- char *errStr;
- int i;
-
- for(i=0;i<MAX;i++)
- {
- errStr = new char[strlen(MessageArray[i].message) + 1];
- strcpy(errStr, MessageArray[i].message);
- iMessage.insert(pair<int,char*>(MessageArray[i].index,errStr));
- }
-}
--- a/imgtools/imglib/group/filesystem.mmp Wed Jul 14 14:50:01 2010 +0100
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-/*
-* Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of the License "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:
-*
-*/
-
-
-target libfilesystem.a
-targettype lib
-sourcepath ../filesystem/source
-source cluster.cpp directory.cpp dirregion.cpp errorhandler.cpp fat16bootsector.cpp fat16filesystem.cpp fat32bootsector.cpp fat32filesystem.cpp fatbasebootsector.cpp filesysteminterface.cpp longentry.cpp longname.cpp messagehandler.cpp messageimplementation.cpp filesystemclass.cpp
-userinclude ../filesystem/include
-userinclude ../inc
-
-OS_LAYER_SYSTEMINCLUDE_SYMBIAN
-
-option GCC -O2 -Wno-uninitialized
--- a/imgtools/romtools/group/release.txt Wed Jul 14 14:50:01 2010 +0100
+++ b/imgtools/romtools/group/release.txt Tue Jul 20 15:02:28 2010 +0800
@@ -1,7 +1,17 @@
+Version 2.12.3 (ROFSBUILD)
+===============
+Released by Marvin Shi, 09/07/2010
+ 1) ou1cimx1#471304 Rofsbuild fails to build SMR image with non-HCR content
+
Version 2.12.2 (ROFSBUILD)
===============
-Released by Marvin Shi, 30/06/2010
- 1)DEF145479 Rofsbuild fails to build SMR image with non-HCR content.
+Released by Lorence Wang, 09/07/2010
+ 1)Rofsbuild build empty FAT image.
+
+Version 2.17.4 (rombuild)
+===============
+Released by Lorence Wang, 06/07/2010
+ 1)Rombuild generates ROM dependency including Paged and Unpaged section.
Version 2.12.1 (ROFSBUILD)
===============
--- a/imgtools/romtools/rofsbuild/fsnode.cpp Wed Jul 14 14:50:01 2010 +0100
+++ b/imgtools/romtools/rofsbuild/fsnode.cpp Tue Jul 20 15:02:28 2010 +0800
@@ -41,6 +41,12 @@
using namespace std;
const TUint KBytesPerEntry = 13 ;
+
+static inline bool is_a_long_file_name_char(unsigned char ch){
+ return ( ch >= ' ' && ch != '"' && ch != '*' && ch != ':' && ch != '<' \
+ && ch != '>' && ch != '?' && ch != '|' && ch != 127) ;
+
+}
//
TFSNode::TFSNode(TFSNode* aParent, const char* aFileName, TUint8 aAttrs, const char* aPCSideName) :
iParent(aParent),iFirstChild(0),iSibling(0),iAttrs(aAttrs), iPCSideName(0), iWideName(0){
@@ -49,7 +55,18 @@
memset(iShortName,0x20,11);
iShortName[11] = 0 ;
if(aFileName) {
- iFileName = strdup(aFileName);
+ const unsigned char* ptr = reinterpret_cast<const unsigned char*>(aFileName);
+ bool allSpaces = true ;
+ while(*ptr){
+ if( !is_a_long_file_name_char(*ptr))
+ throw "Illegal filename or dir name! \n";
+ if(*ptr != ' ')
+ allSpaces = false ;
+ ptr++ ;
+ }
+ if(allSpaces)
+ throw "Illegal filename or dir name(all spaces)!\n";
+ iFileName = strdup(aFileName);
GenerateBasicName() ;
}
if(aPCSideName) {
@@ -84,9 +101,12 @@
free(iFileName) ;
if(iWideName)
delete iWideName;
+ if(iPCSideName)
+ free(iPCSideName);
}
+
TFSNode* TFSNode::CreateFromFolder(const char* aPath,TFSNode* aParent) {
- static char fileName[2048];
+
int len = strlen(aPath);
#ifdef __LINUX__
DIR* dir = opendir(aPath);
@@ -95,45 +115,49 @@
return aParent;
}
if(!aParent)
- aParent = new TFSNode(NULL,"/",ATTR_VOLUME_ID);
+ aParent = new TFSNode(NULL,"/",ATTR_DIRECTORY);
dirent* entry;
struct stat statbuf ;
+ char* fileName = new(nothrow) char[len + 200];
+ if(!fileName) return NULL ;
+ memcpy(fileName,aPath,len);
+ fileName[len] = SPLIT_CHAR;
while ((entry = readdir(dir)) != NULL) {
- if(entry->d_name[0] == '.') continue ;
- memcpy(fileName,aPath,len);
- fileName[len] = SPLIT_CHAR;
- strcpy(&fileName[len+1],entry->d_name);
- stat(fileName , &statbuf);
- TFSNode* pNewItem = new TFSNode(aParent,fileName,S_ISDIR(statbuf.st_mode) ? ATTR_DIRECTORY : 0);
- pNewItem->Init(statbuf.st_ctime,statbuf.st_atime,statbuf.st_mtime,statbuf.st_size);
- if(S_ISDIR(statbuf.st_mode)){
- CreateFromFolder(fileName,pNewItem);
- }
- }
+ if(strcmp(entry->d_name,".") == 0 || strcmp(entry->d_name,"..") == 0)
+ continue ;
+ strcpy(&fileName[len+1],entry->d_name);
+ stat(fileName , &statbuf);
+ TFSNode* pNewItem = new TFSNode(aParent,fileName,S_ISDIR(statbuf.st_mode) ? ATTR_DIRECTORY : 0);
+ pNewItem->Init(statbuf.st_ctime,statbuf.st_atime,statbuf.st_mtime,statbuf.st_size);
+ if(S_ISDIR(statbuf.st_mode)){
+ CreateFromFolder(fileName,pNewItem);
+ }
+ }
+ delete []fileName ;
closedir(dir);
#else
struct _finddata_t data ;
memset(&data, 0, sizeof(data));
- char* pattern = new char[len + 4] ;
- memcpy(pattern,aPath,len);
- pattern[len] = SPLIT_CHAR;
- pattern[len+1] = '*';
- pattern[len+2] = 0;
-
- intptr_t hFind = _findfirst(pattern,&data);
- delete []pattern ;
+ char* fileName = new(nothrow) char[len + 200];
+ if(!fileName) return NULL ;
+ memcpy(fileName,aPath,len);
+ fileName[len] = SPLIT_CHAR;
+ fileName[len+1] = '*';
+ fileName[len+2] = 0;
+ intptr_t hFind = _findfirst(fileName,&data);
if(hFind == (intptr_t)-1 ) {
cout << aPath << " does not contain any subfolder/file.\n";
+ delete []fileName;
return aParent;
- }
+ }
if(!aParent)
- aParent = new TFSNode(NULL,"/",ATTR_VOLUME_ID);
+ aParent = new TFSNode(NULL,"/",ATTR_DIRECTORY);
+
do {
- if(data.name[0] == '.')
+ if(strcmp(data.name,".") == 0 || strcmp(data.name,"..") == 0)
continue ;
- memcpy(fileName,aPath,len);
- fileName[len] = SPLIT_CHAR;
+
strcpy(&fileName[len+1],data.name);
TUint8 attr = 0;
if(data.attrib & _A_SUBDIR)
@@ -146,31 +170,20 @@
attr |= ATTR_SYSTEM ;
if(data.attrib & _A_ARCH)
attr |= ATTR_ARCHIVE;
- TFSNode* pNewItem = new TFSNode(aParent,fileName,attr);
+ TFSNode* pNewItem = new TFSNode(aParent,data.name,attr,fileName);
pNewItem->Init(data.time_create,data.time_access,data.time_write,data.size);
if(data.attrib & _A_SUBDIR){
CreateFromFolder(fileName,pNewItem);
}
} while(-1 != _findnext(hFind, &data));
+ delete []fileName ;
_findclose(hFind);
#endif
return aParent;
}
-
-
-
-static const char* lbasename(const char* aFullName) {
- const char* retval = aFullName ;
- while(*aFullName) {
- if('\\' == *aFullName || '/' == *aFullName )
- retval = ++aFullName ;
- else
- aFullName ++ ;
- }
- return retval ;
-}
+
/** GenerateBasicName : Generate the short name according to long name
*
* algorithm :
@@ -205,7 +218,7 @@
*
*/
void TFSNode::GenerateBasicName() {
- const char* filename = lbasename(iFileName);
+ const char* filename = iFileName ;
TUint length = strlen(filename);
if(0 == length)
return ;
@@ -217,10 +230,7 @@
iShortName[0] = '.' ;
iShortName[1] = '.' ;
return ;
- }
-#ifdef _DEBUG
- cout << "GenericBasicName: \"" << filename ;
-#endif
+ }
iWideName = new UTF16String(filename,length); // The unicode string
char base[10];
const char* ext = filename + length;
@@ -286,10 +296,7 @@
}
if(iParent)
- iParent->MakeUniqueShortName(iShortName,bl);
-#ifdef _DEBUG
- cout << "\" => \"" << iShortName << "\"\n";
-#endif
+ iParent->MakeUniqueShortName(iShortName,bl);
}
#ifdef _DEBUG
@@ -304,7 +311,7 @@
}
#endif
bool TFSNode::IsDirectory() const {
- return 0 != (iAttrs & ATTR_DIRECTORY);
+ return (0 != (iAttrs & ATTR_DIRECTORY) || ATTR_VOLUME_ID == iAttrs) ;
}
int TFSNode::GetWideNameLength() const {
if(!iWideName)
@@ -313,7 +320,7 @@
}
TUint TFSNode::GetSize() const {
- if( 0 == (iAttrs & ATTR_DIRECTORY))
+ if( !IsDirectory())
return iFileSize ;
TUint retVal = sizeof(TShortDirEntry) ; // the tailed entry
if(iParent)
@@ -368,7 +375,7 @@
*((TUint16*)iFATEntry->DIR_FstClusLO) = (aStartIndex & 0xFFFF) ;
}
- if(iAttrs & ATTR_DIRECTORY) { // Directory , write dir entries ;
+ if(IsDirectory()) { // Directory , write dir entries ;
TShortDirEntry* entry = reinterpret_cast<TShortDirEntry*>(aClusterData);
if(iParent != NULL) {
//Make
--- a/imgtools/romtools/rofsbuild/r_driveimage.cpp Wed Jul 14 14:50:01 2010 +0100
+++ b/imgtools/romtools/rofsbuild/r_driveimage.cpp Tue Jul 20 15:02:28 2010 +0800
@@ -89,11 +89,18 @@
attrib |= ATTR_HIDDEN ;
if(romNode->iAtt & KEntryAttSystem)
attrib |= ATTR_SYSTEM ;
- if(romNode->IsDirectory()) {
- curFS = new(std::nothrow) TFSNode(parentFS,romNode->iName,attrib | ATTR_DIRECTORY);
- if(!curFS){
- err = true ;
- break ;
+ if(romNode->IsDirectory()) {
+ try {
+ curFS = new TFSNode(parentFS,romNode->iName,attrib | ATTR_DIRECTORY);
+ }
+ catch(const char* errInfo){
+ Print(EError,errInfo);
+ err = true ;
+ break ;
+ }
+ catch(...) {
+ err = true ;
+ break ;
}
if(!root) root = curFS ;
time_t now = time(NULL);
@@ -108,17 +115,24 @@
continue ;
}
}
- else { // file
- curFS = new(std::nothrow) TFSNode(parentFS,romNode->iEntry->iName,attrib,romNode->iEntry->iFileName);
- if(!curFS){
+ else { // file
+ try {
+ curFS = new TFSNode(parentFS,romNode->iEntry->iName,attrib,romNode->iEntry->iFileName);
+ }
+ catch(const char* errInfo){
+ Print(EError,errInfo);
+ err = true ;
+ break ;
+ }
+ catch(...) {
err = true ;
break ;
- }
+ }
- if(!root) root = curFS ;
- struct stat statbuf ;
- stat(romNode->iEntry->iFileName, &statbuf);
- curFS->Init(statbuf.st_ctime,statbuf.st_atime,statbuf.st_mtime,statbuf.st_size);
+ if(!root) root = curFS ;
+ struct stat statbuf ;
+ stat(romNode->iEntry->iFileName, &statbuf);
+ curFS->Init(statbuf.st_ctime,statbuf.st_atime,statbuf.st_mtime,statbuf.st_size);
}
--- a/imgtools/romtools/rofsbuild/r_obey.cpp Wed Jul 14 14:50:01 2010 +0100
+++ b/imgtools/romtools/rofsbuild/r_obey.cpp Tue Jul 20 15:02:28 2010 +0800
@@ -87,7 +87,8 @@
{_K("fileuncompress"),2, -2,EKeywordFileUncompress,"Non-XIP Executable to be loaded into the ROM uncompressed" },
{_K("patchdata"),2, 5,EKeywordPatchDllData, "Patch exported data"},
{_K("imagename"), 1, 1, EKeywordSmrImageName, "output file for SMR image"},
- {_K("smrdata"), 1, 1, EKeywordSmrFileData, "file data for SMR image"},
+ {_K("hcrdata"), 1, 1, EKeywordSmrFileData, "file data for HCR SMR image"},
+ {_K("smrdata"), 1, 1, EKeywordSmrFileData, "file data for general SMR image"},
{_K("formatversion"), 1, 1, EKeywordSmrFormatVersion, "format version for HCR SMR image"},
{_K("payloadflags"), 1, 1, EKeywordSmrFlags, "payload flags for the HCR SMR image"},
{_K("payloaduid"), 1, 1, EKeywordSmrUID, "payload UID for the HCR SMR image"},
@@ -755,7 +756,7 @@
return KErrGeneral;
}
if (!iNumberOfFiles)
- Print(EWarning,"No files specified.\n");
+ Print(EAlways,"No files specified.\n");
return KErrNone;
}
--- a/imgtools/romtools/rofsbuild/r_smrimage.cpp Wed Jul 14 14:50:01 2010 +0100
+++ b/imgtools/romtools/rofsbuild/r_smrimage.cpp Tue Jul 20 15:02:28 2010 +0800
@@ -39,13 +39,13 @@
{
if(aValues.size() == 0)
{
- Print(EError, "Keyword Imageanme has not been set!");
+ Print(EError, "Keyword Imageanme has not been set!\n");
return EFalse;
}
if(aValues.size() > 1)
{
- Print(EError, "Keyword Imagename has been set more than one time!");
+ Print(EError, "Keyword Imagename has been set more than one time!\n");
return EFalse;
}
iImageName = aValues.at(0);
@@ -59,28 +59,62 @@
{
if(aValues.size() == 0)
{
- Print(EError, "keyword formatversion has not been set!");
+ Print(EError, "keyword formatversion has not been set!\n");
return EFalse;
}
if(aValues.size() > 1)
{
- Print(EError, "Keyword Formatversion has been set more than one time!");
+ Print(EError, "Keyword Formatversion has been set more than one time!\n");
return EFalse;
}
Val(iSmrRomHeader.iImageVersion,aValues.at(0).c_str());
return ETrue;
}
-TBool CSmrImage::SetSmrData(const StringVector& aValues)
+TBool CSmrImage::SetHcrData(const StringVector& aValues)
{
if(aValues.size() == 0)
{
- Print(EError, "keyword smrdata has not been set!");
- return EFalse;
+ return ETrue;
}
if(aValues.size() > 1)
{
- Print(EError, "Keyword smrdata has been set more than one time!");
+ Print(EError, "Keyword hcrdata has been set more than one time!\n");
+ return EFalse;
+ }
+ iHcrData = aValues.at(0);
+
+ ifstream is(iHcrData.c_str(), ios_base::binary );
+ if(!is)
+ {
+ Print(EError, "HCR data file: %s dose not exist!\n", iHcrData.c_str());
+ return EFalse;
+ }
+ TUint32 magicWord = 0;
+ is.read(reinterpret_cast<char*>(&magicWord),sizeof(TUint32));
+ if(0x66524348 != magicWord){
+ Print(EError, "HCR data file: %s is an invalid HCR data file!\n", iHcrData.c_str());
+ return EFalse;
+ }
+ is.close();
+ return ETrue;
+}
+TBool CSmrImage::SetSmrData(const StringVector& aValues)
+{
+
+ if((aValues.size() == 0) && iHcrData.empty())
+ {
+ Print(EError, "Keyword smrdata has not been set!\n");
+ return EFalse;
+ }
+ if(! iHcrData.empty())
+ {
+ Print(EWarning, "Keyword hcrdata has been used, the value for smrdata will be ignored!\n");
+ return ETrue;
+ }
+ if(aValues.size() > 1)
+ {
+ Print(EError, "Keyword smrdata has been set more than one time!\n");
return EFalse;
}
iSmrData = aValues.at(0);
@@ -88,7 +122,7 @@
ifstream is(iSmrData.c_str(), ios_base::binary );
if(!is)
{
- Print(EError, "SMR data file: %s dose not exist!", iSmrData.c_str());
+ Print(EError, "SMR data file: %s dose not exist!\n", iSmrData.c_str());
return EFalse;
}
is.close();
@@ -99,12 +133,12 @@
if(aValues.size() == 0)
{
- Print(EError, "keyword PayloadUID has not been set!");
+ Print(EError, "keyword PayloadUID has not been set!\n");
return EFalse;
}
if(aValues.size() > 1)
{
- Print(EError, "Keyword PayloadUID has been set more than one time!");
+ Print(EError, "Keyword PayloadUID has been set more than one time!\n");
return EFalse;
}
Val(iSmrRomHeader.iPayloadUID,aValues.at(0).c_str());
@@ -115,12 +149,12 @@
if(aValues.size() == 0)
{
- Print(EError, "keyword Payloadflags has not been set!");
+ Print(EError, "keyword Payloadflags has not been set!\n");
return EFalse;
}
if(aValues.size() > 1)
{
- Print(EError, "Keyword Payloadfalgs has been set more than one time!");
+ Print(EError, "Keyword Payloadfalgs has been set more than one time!\n");
return EFalse;
}
Val(iSmrRomHeader.iPayloadFlags , aValues.at(0).c_str());
@@ -134,6 +168,8 @@
return result;
if(! SetFormatVersion(iObeyFile->getValues("formatversion")))
return result;
+ if(! SetHcrData(iObeyFile->getValues("hcrdata")))
+ return result;
if(! SetSmrData(iObeyFile->getValues("smrdata")))
return result;
if(! SetPayloadUID(iObeyFile->getValues("payloaduid")))
@@ -147,10 +183,18 @@
{
TInt imageSize = 0;
ifstream is;
- is.open(iSmrData.c_str(), ios_base::binary);
+ string datafile;
+ if(! iHcrData.empty())
+ {
+ datafile = iHcrData;
+ }else if(! iSmrData.empty())
+ {
+ datafile = iSmrData;
+ }
+ is.open(datafile.c_str(), ios_base::binary);
if(!is)
{
- Print(EError, "Open SMR data file: %s error!\n", iSmrData.c_str());
+ Print(EError, "Open SMR data file: %s error!\n", datafile.c_str());
return KErrGeneral;
}
is.seekg(0, ios_base::end);
--- a/imgtools/romtools/rofsbuild/r_smrimage.h Wed Jul 14 14:50:01 2010 +0100
+++ b/imgtools/romtools/rofsbuild/r_smrimage.h Tue Jul 20 15:02:28 2010 +0800
@@ -28,6 +28,7 @@
TInt CreateImage();
TBool SetImageName(const StringVector& aValues);
TBool SetFormatVersion(const StringVector& aValues);
+ TBool SetHcrData(const StringVector& aValues);
TBool SetSmrData(const StringVector& aValues);
TBool SetPayloadUID(const StringVector& aValues);
TBool SetPayloadFlags(const StringVector& aValues);
@@ -37,7 +38,8 @@
CObeyFile* iObeyFile;
SSmrRomHeader iSmrRomHeader;
string iImageName;
- string iSmrData;
+ string iHcrData;
+ string iSmrData;
};
--- a/imgtools/romtools/rofsbuild/rofsbuild.cpp Wed Jul 14 14:50:01 2010 +0100
+++ b/imgtools/romtools/rofsbuild/rofsbuild.cpp Tue Jul 20 15:02:28 2010 +0800
@@ -47,7 +47,7 @@
static const TInt RofsbuildMajorVersion=2;
static const TInt RofsbuildMinorVersion=12;
-static const TInt RofsbuildPatchVersion=2;
+static const TInt RofsbuildPatchVersion=4;
static TBool SizeSummary=EFalse;
static TPrintType SizeWhere=EAlways;
--- a/imgtools/romtools/rombuild/r_areaset.cpp Wed Jul 14 14:50:01 2010 +0100
+++ b/imgtools/romtools/rombuild/r_areaset.cpp Tue Jul 20 15:02:28 2010 +0800
@@ -303,8 +303,6 @@
iFirstPagedCode = normal[0];
Print(ELog,"\n");
- if(gGenDepGraph)
- WriteDependenceGraph();
return KErrNone;
}
@@ -313,7 +311,7 @@
TDepInfoList::iterator infoIt;
TStringList::iterator strIt;
TDepInfoList myDepInfoList;
- TRomBuilderEntry* e = iFirstPagedCode;
+ TRomBuilderEntry* e = iFiles;
char buffer[255];
TInt count = 0;
TStringList nameList;
@@ -332,7 +330,7 @@
e = e->iNextInArea;
count++;
}
- e = iFirstPagedCode;
+ e = iFiles;
count = 0;
while(e) {
TRomNode* rn = e->iRomNode;
--- a/imgtools/romtools/rombuild/r_areaset.h Wed Jul 14 14:50:01 2010 +0100
+++ b/imgtools/romtools/rombuild/r_areaset.h Tue Jul 20 15:02:28 2010 +0800
@@ -97,11 +97,11 @@
void AddFile(TRomBuilderEntry* aFile);
TInt SortFilesForPagedRom();
+ void WriteDependenceGraph();
private:
// only AreaSet can create areas
Area(const char* aName, TLinAddr aDestBaseAddr, TUint aMaxSize, Area* aNext=0);
void ReleaseAllFiles();
- void WriteDependenceGraph();
public:
TRomBuilderEntry* iFirstPagedCode; // For PagedRom only
private:
--- a/imgtools/romtools/rombuild/r_rom.cpp Wed Jul 14 14:50:01 2010 +0100
+++ b/imgtools/romtools/rombuild/r_rom.cpp Tue Jul 20 15:02:28 2010 +0800
@@ -460,14 +460,16 @@
if(gPagedRom)
{
- gDepInfoFile = iObey->iRomFileName;
iObey->SetArea().DefaultArea()->SortFilesForPagedRom();
// exception search table needs to go at start of ROM to make it not demand paged...
addr = ReserveRomExceptionSearchTable(addr,exceptionSearchTable);
}
- else if(gGenDepGraph)
+
+ if(gGenDepGraph)
{
- Print(EWarning, "Not dependence information in an unpaged ROM.");
+ Print(ELog, "Generate dependence information in ROM.");
+ gDepInfoFile = iObey->iRomFileName;
+ iObey->SetArea().DefaultArea()->WriteDependenceGraph();
}
addr=WriteDirectory(addr, aHeader);
--- a/imgtools/romtools/rombuild/rombuild.cpp Wed Jul 14 14:50:01 2010 +0100
+++ b/imgtools/romtools/rombuild/rombuild.cpp Tue Jul 20 15:02:28 2010 +0800
@@ -33,7 +33,7 @@
static const TInt RombuildMajorVersion=2;
static const TInt RombuildMinorVersion=17;
-static const TInt RombuildPatchVersion=3;
+static const TInt RombuildPatchVersion=4;
static TBool SizeSummary=EFalse;
static TPrintType SizeWhere=EAlways;
static string compareROMName = "";
--- a/package_definition.xml Wed Jul 14 14:50:01 2010 +0100
+++ b/package_definition.xml Tue Jul 20 15:02:28 2010 +0800
@@ -1,331 +1,76 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE SystemDefinition [
-<!ELEMENT SystemDefinition ( systemModel?, SystemBuild? )>
- <!ATTLIST SystemDefinition
- name CDATA #REQUIRED
- schema CDATA #REQUIRED>
- <!ELEMENT systemModel (layer+)>
- <!ELEMENT layer (block* | collection*)*>
- <!ATTLIST layer
- name CDATA #REQUIRED
- long-name CDATA #IMPLIED
- levels NMTOKENS #IMPLIED
- span CDATA #IMPLIED>
- <!ELEMENT block (subblock* | collection*)*>
- <!ATTLIST block
- levels NMTOKENS #IMPLIED
- span CDATA #IMPLIED
- level NMTOKEN #IMPLIED
- name CDATA #REQUIRED
- long-name CDATA #IMPLIED>
- <!ELEMENT subblock (collection)*>
- <!ATTLIST subblock
- name CDATA #REQUIRED
- long-name CDATA #IMPLIED>
- <!ELEMENT collection (component)*>
- <!ATTLIST collection
- name CDATA #REQUIRED
- long-name CDATA #IMPLIED
- level NMTOKEN #IMPLIED>
- <!ELEMENT component (unit)*>
- <!ATTLIST component
- name CDATA #REQUIRED
- long-name CDATA #IMPLIED
- deprecated CDATA #IMPLIED
- introduced CDATA #IMPLIED
- contract CDATA #IMPLIED
- plugin (Y|N) "N"
- filter CDATA #IMPLIED
- class NMTOKENS #IMPLIED
- supports CDATA #IMPLIED
- purpose ( optional | mandatory | development ) "optional">
- <!ELEMENT unit EMPTY>
- <!ATTLIST unit
- mrp CDATA #IMPLIED
- filter CDATA #IMPLIED
- bldFile CDATA #IMPLIED
- root CDATA #IMPLIED
- version NMTOKEN #IMPLIED
- prebuilt NMTOKEN #IMPLIED
- late (Y|N) #IMPLIED
- priority CDATA #IMPLIED>
- <!ELEMENT SystemBuild (option* | target+ | targetList+ | list+ | configuration+)*>
- <!ATTLIST SystemBuild
- name CDATA #REQUIRED
- schema CDATA #REQUIRED>
- <!ELEMENT list (ref+)>
- <!ATTLIST list
- name ID #REQUIRED
- description CDATA #REQUIRED>
- <!ELEMENT ref EMPTY>
- <!ATTLIST ref item CDATA #REQUIRED>
- <!ELEMENT targetList EMPTY>
- <!ATTLIST targetList
- name ID #REQUIRED
- description CDATA #REQUIRED
- target IDREFS #REQUIRED>
- <!ELEMENT target EMPTY>
- <!ATTLIST target
- name ID #REQUIRED
- abldTarget CDATA #REQUIRED
- description CDATA #REQUIRED>
- <!ELEMENT option EMPTY>
- <!ATTLIST option
- name ID #REQUIRED
- abldOption CDATA #REQUIRED
- description CDATA #REQUIRED
- enable (Y | N | y | n) #REQUIRED>
- <!ELEMENT configuration (listRef+ | ref+ | task+)*>
- <!ATTLIST configuration
- name ID #REQUIRED
- description CDATA #REQUIRED
- filter CDATA #REQUIRED>
- <!ELEMENT task (listRef* , (buildLayer | specialInstructions))>
- <!ELEMENT listRef EMPTY>
- <!ATTLIST listRef list CDATA #REQUIRED>
- <!ELEMENT buildLayer EMPTY>
- <!ATTLIST buildLayer
- command CDATA #REQUIRED
- targetList IDREFS #IMPLIED
- unitParallel (Y | N | y | n) #REQUIRED
- targetParallel (Y | N | y | n) #IMPLIED>
- <!ELEMENT specialInstructions EMPTY>
- <!ATTLIST specialInstructions
- name CDATA #REQUIRED
- cwd CDATA #REQUIRED
- root CDATA #IMPLIED
- command CDATA #REQUIRED>
-]>
-<SystemDefinition schema="2.0.1" name="Symbian">
- <systemModel>
- <layer name="dev" levels="device middleware eclipse" long-name="Development">
- <block name="buildtools" level="framework" levels="lowlevel-libs middleware framework ui" long-name="Build Tools">
- <collection name="imgtools_os" level="framework" long-name="Image Tools Metadata">
- <component filter="build_SFPhase1" name="romkiteka2">
- <unit bldFile="trunk\buildtools\imgtools_os\romkiteka2\group" mrp="trunk\buildtools\imgtools_os\romkiteka2\group\tools_romkit.mrp"/>
- </component>
- </collection>
- <!--
- <collection name="perltoolsplat_os" level="framework" long-name="Redistribution Tools">
- <component filter="build_SFPhase1" name="redistribution">
- <unit bldFile="trunk\buildtools\perltoolsplat_os\redistribution" mrp="trunk\buildtools\perltoolsplat_os\redistribution\tools_redistribution_common.mrp"/>
- </component>
- </collection>
- <collection name="sbsv1_os" level="framework" long-name="Symbian Build System v1">
- <component filter="build_SFPhase1" name="e32toolp">
- <unit bldFile="trunk\buildtools\sbsv1_os\e32toolp\group" mrp="trunk\buildtools\sbsv1_os\e32toolp\group\tools_e32toolp.mrp"/>
- </component>
- </collection>
- <collection name="toolsandutils" level="framework" long-name="Other Tools">
- <component filter="build_SFPhase1" name="e32tools">
- <unit bldFile="trunk\buildtools\toolsandutils\e32tools\group" mrp="trunk\buildtools\toolsandutils\e32tools\group\tools_e32tools.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="stlport">
- <unit bldFile="trunk\buildtools\toolsandutils\stlport\group" mrp="trunk\buildtools\toolsandutils\stlport\group\tools_stlport.mrp"/>
- </component>
- </collection>
- <collection name="miscomponents" level="framework" long-name="Mis Components">
- <component filter="build_SFPhase1" name="emulatorlauncher">
- <unit bldFile="trunk\buildtools\misccomponents\emulatorlauncher\group" mrp="trunk\buildtools\misccomponents\emulatorlauncher\group\tools_sdk_eng_emulator_launcher.mrp"/>
- </component>
- </collection>
- <collection name="dist_os" level="framework" long-name="Redistribution Tools">
- <component filter="build_SFPhase1" name="redistributionwinceka2">
- <unit bldFile="trunk\buildtools\dist_os\redistributionwinceka2" mrp="trunk\buildtools\dist_os\redistributionwinceka2\tools_redistribution_winc.mrp"/>
- </component>
- </collection>
- -->
- </block>
-
-
- <block name="build" level="framework" levels="lowlevel-libs middleware framework ui" long-name="Build">
- <collection name="bintools" level="framework" long-name="Binary Tools">
- <component filter="build_SFPhase1" name="rcomp" long-name="Resource Compiler">
- <unit bldFile="trunk\build\bintools\rcomp\group" mrp="trunk\build\bintools\rcomp\group\rcomp.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="bin2coff">
- <unit bldFile="trunk\build\bintools\bin2coff\group" mrp="trunk\build\bintools\bin2coff\group\bin2coff.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="petools">
- <unit bldFile="trunk\build\bintools\petools\group" mrp="trunk\build\bintools\petools\group\petools.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="elftools">
- <unit bldFile="trunk\build\bintools\elftools\group" mrp="trunk\build\bintools\elftools\group\elftools.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="checklib">
- <unit bldFile="trunk\build\bintools\checklib\group" mrp="trunk\build\bintools\checklib\group\checklib.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="evalid">
- <unit bldFile="trunk\build\bintools\evalid" mrp="trunk\build\bintools\evalid\dev_build_bintools_evalid.mrp"/>
- </component>
- </collection>
-
- <collection name="releasing" level="framework" long-name="Binary Tools">
- <component filter="build_SFPhase1" name="cbrtools">
- <unit bldFile="trunk\build\releasing\cbrtools\group" mrp="trunk\build\releasing\cbrtools\group\cbrtools.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="makecbr">
- <unit bldFile="trunk\build\releasing\makecbr\group" mrp="trunk\build\releasing\makecbr\group\makecbr.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="zdelta-2.1">
- <unit bldFile="trunk\build\releasing\zdelta-2.1\group" mrp="trunk\build\releasing\zdelta-2.1\group\zdelta-2.1.mrp"/>
- </component>
- </collection>
-
- <collection name="e32tools" level="framework" long-name="E32 Tools">
- <component filter="build_SFPhase1" name="e32lib">
- <unit bldFile="trunk\build\e32tools\e32lib\group" mrp="trunk\build\e32tools\e32lib\group\e32lib.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="elf2e32" long-name="Post Linker">
- <unit bldFile="trunk\build\e32tools\elf2e32\group" mrp="trunk\build\e32tools\elf2e32\group\elf2e32.mrp"/>
- </component>
- </collection>
-
- <collection name="deprecated" level="framework" long-name="Deprecated Tools">
- <component filter="build_SFPhase1" name="eruntest">
- <unit bldFile="trunk\build\deprecated\eruntest\group" mrp="trunk\build\deprecated\eruntest\group\eruntest.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="etouch">
- <unit bldFile="trunk\build\deprecated\etouch\group" mrp="trunk\build\deprecated\etouch\group\etouch.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="rommask">
- <unit bldFile="trunk\build\deprecated\rommask\group" mrp="trunk\build\deprecated\rommask\group\rommask.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="w32repro">
- <unit bldFile="trunk\build\deprecated\w32repro\group" mrp="trunk\build\deprecated\w32repro\group\w32repro.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="wveconv">
- <unit bldFile="trunk\build\deprecated\wveconv\group" mrp="trunk\build\deprecated\wveconv\group\wveconv.mrp"/>
- </component>
- </collection>
-
- <collection name="sbsv1" level="framework" long-name="Symbian Build System v1">
- <component filter="build_SFPhase1" name="abld">
- <unit bldFile="trunk\build\sbsv1\abld\group" mrp="trunk\build\sbsv1\abld\group\abld.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="buildsystem">
- <unit bldFile="trunk\build\sbsv1\buildsystem\group" mrp="trunk\build\sbsv1\buildsystem\group\buildsystem.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="make-abld">
- <unit bldFile="trunk\build\sbsv1\make-abld\group" mrp="trunk\build\sbsv1\make-abld\group\make-abld.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="scpp-abld">
- <unit bldFile="trunk\build\sbsv1\scpp-abld\group" mrp="trunk\build\sbsv1\scpp-abld\group\scpp-abld.mrp"/>
- </component>
- </collection>
-
- <collection name="imgtools" level="framework" long-name="Image Tools">
- <component filter="build_SFPhase2" name="imgcheck" long-name="Image Checker">
- <unit bldFile="trunk\build\imgtools\imgcheck\group" mrp="trunk\build\imgtools\imgcheck\group\imgcheck.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="imglib" long-name="ROM/ROFS Image Library">
- <unit bldFile="trunk\build\imgtools\imglib\group" mrp="trunk\build\imgtools\imglib\group\imglib.mrp"/>
- </component>
- <component filter="build_SFPhase3" name="romtools" long-name="ROM Tools">
- <unit bldFile="trunk\build\imgtools\romtools\group" mrp="trunk\build\imgtools\romtools\group\romtools.mrp"/>
- </component>
- <component filter="build_SFPhase3" name="buildrom" long-name="Build ROM">
- <unit bldFile="trunk\build\imgtools\buildrom\group" mrp="trunk\build\imgtools\buildrom\group\buildrom.mrp"/>
- </component>
- <component filter="build_SFPhase3" name="sisutils" long-name="SIS Utility Library">
- <unit bldFile="trunk\build\imgtools\sisutils\group" mrp="trunk\build\imgtools\sisutils\group\sisutils.mrp"/>
- </component>
- </collection>
-
- <collection name="srctools" level="framework" long-name="Source Tools">
- <component filter="build_SFPhase1" name="tranasm">
- <unit bldFile="trunk\build\srctools\tranasm\group" mrp="trunk\build\srctools\tranasm\group\tranasm.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="readtype">
- <unit bldFile="trunk\build\srctools\readtype\group" mrp="trunk\build\srctools\readtype\group\readtype.mrp"/>
- </component>
- </collection>
-
- <collection name="cpptoolsplat" level="framework" long-name="C++ Tools Platform">
- <component filter="build_SFPhase1" name="stlport" long-name="STLport">
- <unit bldFile="trunk\build\cpptoolsplat\stlport\group" mrp="trunk\build\cpptoolsplat\stlport\group\stlport.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="cpp-2.9-psion-98r2">
- <unit bldFile="trunk\build\cpptoolsplat\cpp-2.9-psion-98r2\group" mrp="trunk\build\cpptoolsplat\cpp-2.9-psion-98r2\group\cpp-2.9-psion-98r2.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="mingw-gcc-3.4.5">
- <unit bldFile="trunk\build\cpptoolsplat\mingw-gcc-3.4.5\group" mrp="trunk\build\cpptoolsplat\mingw-gcc-3.4.5\group\mingw-gcc-3.4.5.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="gcce-4.3.2">
- <unit bldFile="trunk\build\cpptoolsplat\gcce-4.3.2\group" mrp="trunk\build\cpptoolsplat\gcce-4.3.2\group\gcce-4.3.2.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="gcce-3.4.3">
- <unit bldFile="trunk\build\cpptoolsplat\gcce-3.4.3\group" mrp="trunk\build\cpptoolsplat\gcce-3.4.3\group\gcce-3.4.3.mrp"/>
- </component>
- </collection>
-
- <collection name="perltoolsplat" level="framework" long-name="Perl Tools Platform">
- <component filter="build_SFPhase1" name="activestate-perl-5.6.1">
- <unit bldFile="trunk\build\perltoolsplat\activestate-perl-5.6.1\group" mrp="trunk\build\perltoolsplat\activestate-perl-5.6.1\group\activestate-perl-5.6.1.mrp"/>
- </component>
- </collection>
-
- <collection name="javatoolsplat" level="framework" long-name="Java Tools Platform">
- <component filter="build_SFPhase1" name="j2re-1.3.1">
- <unit bldFile="trunk\build\javatoolsplat\j2re-1.3.1\group" mrp="trunk\build\javatoolsplat\j2re-1.3.1\group\j2re-1.3.1.mrp"/>
- </component>
- </collection>
-
- <collection name="hostenv" level="framework" long-name="Host Environment">
- <component filter="build_SFPhase1" name="zip-2.2">
- <unit bldFile="trunk\build\hostenv\zip-2.2\group" mrp="trunk\build\hostenv\zip-2.2\group\zip-2.2.mrp"/>
- </component>
- <component filter="build_SFPhase1" name="unzip-5.40">
- <unit bldFile="trunk\build\hostenv\unzip-5.40\group" mrp="trunk\build\hostenv\unzip-5.40\group\unzip-5.40.mrp"/>
- </component>
- </collection>
- </block>
- </layer>
- </systemModel>
- <SystemBuild name="TCL" schema="2.0.0">
- <option name="KEEPGOING" abldOption="-keepgoing" description="Causes make to keepgoing on errors" enable="Y"/>
- <option name="SAVESPACE" abldOption="-savespace" description="Causes the removal of intermediate files" enable="Y"/>
- <target name="WINS" abldTarget="wins" description="MSVC Compiler"/>
- <target name="WINS_REL" abldTarget="wins urel" description="MSVC Compiler"/>
- <target name="WINS_DEB" abldTarget="wins udeb" description="MSVC Compiler"/>
- <target name="WINSCW" abldTarget="winscw" description="CodeWarrior Compiler"/>
- <target name="WINSCW_REL" abldTarget="winscw urel" description="CodeWarrior Compiler"/>
- <target name="WINSCW_DEB" abldTarget="winscw udeb" description="CodeWarrior Compiler"/>
- <target name="TOOLS" abldTarget="tools" description="MSVC Compiler for Tools"/>
- <target name="TOOLS_REL" abldTarget="tools rel" description="MSVC Compiler for Tools Release mode only"/>
- <target name="TOOLS2" abldTarget="tools2" description="MinGW GCC Compiler for Tools"/>
- <target name="TOOLS2_REL" abldTarget="tools2 rel" description="MinGW GCC Compiler for Tools Release mode only"/>
- <target name="ARMV5" abldTarget="armv5" description="RVCT Compiler"/>
- <target name="ARMV5_REL" abldTarget="armv5 urel" description="RVCT Compiler"/>
- <target name="ARMV5_DEB" abldTarget="armv5 udeb" description="RVCT Compiler"/>
- <target name="ARMV5SMP" abldTarget="armv5smp" description="RVCT Compiler for SMP"/>
- <target name="ARMV5SMP_REL" abldTarget="armv5smp urel" description="RVCT Compiler for SMP"/>
- <target name="ARMV5SMP_DEB" abldTarget="armv5smp udeb" description="RVCT Compiler for SMP"/>
- <!-- <target name="GCCE" abldTarget="gcce" description="GCCCE Compiler"/> -->
- <!-- <target name="GCCE_DEB" abldTarget="gcce udeb" description="GCCCE Compiler"/> -->
- <!-- <target name="GCCE_REL" abldTarget="gcce urel" description="GCCCE Compiler"/> -->
- <!-- Aditional Targets -->
- <target name="CWTOOLS" abldTarget="cwtools" description="CodeWarrior Compiler for Tools"/><!-- Not supported -->
- <target name="CWTOOLS_REL" abldTarget="cwtools rel" description="CodeWarrior Compiler for Tools Release mode only"/><!-- Not supported -->
- <target name="GCCXML" abldTarget="gccxml" description="GCCXML for Code comparision tools"/>
- <target name="GCCXML_REL" abldTarget="gccxml urel" description="GCCXML for Code comparision tools release mode only"/>
- <targetList name="default_9.0" description="Main Targets for 9.0" target="WINSCW ARMV5 ARMV5SMP"/>
- <targetList name="default_9.0_rel" description="Main Targets for 9.0_rel" target="WINSCW_REL ARMV5_REL ARMV5SMP_REL"/>
- <targetList name="default_9.0_deb" description="Main Targets for 9.0_deb" target="WINSCW_DEB ARMV5_DEB ARMV5SMP_DEB"/>
- <targetList name="tools" description="tools Targets" target="TOOLS"/>
- <targetList name="tools_rel" description="tools Release Targets" target="TOOLS_REL"/>
- <targetList name="tools2" description="tools Targets" target="TOOLS2"/>
- <targetList name="tools2_rel" description="tools Release Targets" target="TOOLS2_REL"/>
- <targetList name="gccxml" description="tools Targets" target="GCCXML"/>
- <targetList name="gccxml_rel" description="tools Release Targets" target="GCCXML_REL"/>
- <targetList name="armv5smp" description="Separate ARMV5 SMP target" target="ARMV5SMP"/>
- <targetList name="armv5smp_rel" description="Separate ARMV5 SMP release target" target="ARMV5SMP_REL"/>
- <targetList name="armv5smp_deb" description="Separate ARMV5 SMP debug target" target="ARMV5SMP_DEB"/>
- <!-- Default configuration -->
- <configuration name="TCL_SF_PHASE3" description="Symbian Foundation Build Phase3" filter="tcl,build_SFPhase3">
- <ref item="ana"/>
- <ref item="depl"/>
- <ref item="dev"/>
- <ref item="unclassifiedlayer"/>
- </configuration>
-</SystemBuild></SystemDefinition>
+<SystemDefinition schema="3.0.0">
+ <package id="build" levels="lowlevel-libs middleware framework ui" name="Build">
+ <collection id="bintools" level="framework" name="Binary Tools">
+ <component filter="build_SFPhase3" id="evalid" name="Evalid" >
+ <unit bldFile="bintools/evalid" mrp="bintools/evalid/evalid.mrp"/>
+ </component>
+ <component filter="build_SFPhase1" id="rcomp" name="Resource Compiler" >
+ <unit bldFile="bintools/rcomp/group" mrp="bintools/rcomp/group/rcomp.mrp"/>
+ </component>
+ <component filter="build_SFPhase1" id="checklib" name="checklib" >
+ <unit bldFile="bintools/checklib/group" mrp="bintools/checklib/group/checklib.mrp"/>
+ </component>
+ <component filter="build_SFPhase1" id="elftools" name="elftools" >
+ <unit bldFile="bintools/elftools/group" mrp="bintools/elftools/group/elftools.mrp"/>
+ </component>
+ </collection>
+ <collection id="srctools" level="middleware" name="Source Tools">
+ <component filter="build_SFPhase1" id="tranasm" name="tranasm" >
+ <unit bldFile="srctools/tranasm/group" mrp="srctools/tranasm/group/tranasm.mrp"/>
+ </component>
+ </collection>
+ <collection id="e32tools" level="middleware" name="E32 Tools">
+ <component filter="build_SFPhase1" id="elf2e32" name="elf2e32 (Postlinker)" >
+ <unit bldFile="e32tools/elf2e32/group" mrp="e32tools/elf2e32/group/elf2e32.mrp"/>
+ </component>
+ <component filter="build_SFPhase1" id="e32lib" name="E32 Image Library" >
+ <unit bldFile="e32tools/e32lib/group" mrp="e32tools/e32lib/group/e32lib.mrp"/>
+ </component>
+ </collection>
+ <collection id="buildtoolguides" level="ui" name="Build Tool Guides">
+ <component filter="build_SFPhase3" id="emulconfiguratorguide" name="Emulator Configurator Guide" >
+ <unit bldFile="buildtoolguides/emulconfiguratorguide/group" mrp="buildtoolguides/emulconfiguratorguide/group/emulbuilderguide.mrp"/>
+ </component>
+ <component filter="build_SFPhase3" id="romtoolsguide" name="ROM Tools Guide" >
+ <unit bldFile="buildtoolguides/romtoolsguide/group" mrp="buildtoolguides/romtoolsguide/group/romtoolsguide.mrp"/>
+ </component>
+ <component filter="build_SFPhase3" id="sbsv2guide" name="SBSv2 Guide" >
+ <unit bldFile="buildtoolguides/sbsv2guide/group" mrp="buildtoolguides/sbsv2guide/group/sbsv2guide.mrp"/>
+ </component>
+ </collection>
+ <collection id="sbsv2" level="middleware" name="Symbian Build System v2">
+ <component filter="build_SFPhase3" id="cpp-raptor" name="CPP (Raptor)" >
+ <unit bldFile="sbsv2/cpp-raptor/group" mrp="sbsv2/cpp-raptor/group/cpp-raptor.mrp"/>
+ </component>
+ <component filter="build_SFPhase3" id="pvmgmake" name="PVM Gmake" >
+ <unit bldFile="sbsv2/pvmgmake/group" mrp="sbsv2/pvmgmake/group/pvmgmake.mrp"/>
+ </component>
+ <component filter="build_SFPhase3" id="raptor" name="SBSv2 (Raptor)" >
+ <unit bldFile="sbsv2/raptor/group" mrp="sbsv2/raptor/group/raptor.mrp"/>
+ </component>
+ </collection>
+ <collection id="imgtools" level="framework" name="Image Tools">
+ <component filter="build_SFPhase3" id="romtools" name="ROM Tools" >
+ <unit bldFile="imgtools/romtools/group" mrp="imgtools/romtools/group/romtools.mrp"/>
+ </component>
+ <component filter="build_SFPhase3" id="buildrom" name="Build ROM" >
+ <unit bldFile="imgtools/buildrom/group" mrp="imgtools/buildrom/group/buildrom.mrp"/>
+ </component>
+ <component filter="build_SFPhase1" id="imglib" name="ROM/ROFS Image Library" >
+ <unit bldFile="imgtools/imglib/group" mrp="imgtools/imglib/group/imglib.mrp"/>
+ </component>
+ <component filter="build_SFPhase3" id="sisutils" name="SIS Utility Library" >
+ <unit bldFile="imgtools/sisutils/group" mrp="imgtools/sisutils/group/sisutils.mrp"/>
+ </component>
+ <component filter="build_SFPhase2" id="imgcheck" name="Image Checker" >
+ <unit bldFile="imgtools/imgcheck/group" mrp="imgtools/imgcheck/group/imgcheck.mrp"/>
+ </component>
+ </collection>
+ <collection id="build_info" name="Build Info" level="ui">
+ <component id="build_metadata" name="Build Metadata" filter="build_SFPhase3">
+ <unit mrp="build_info/build_metadata/build_metadata.mrp"/>
+ </component>
+ </collection>
+ </package>
+</SystemDefinition>