toolsandutils/e32tools/elf2e32/source/polydll_fb_target.cpp
changeset 0 83f4b4db085c
child 1 d4b442d23379
equal deleted inserted replaced
-1:000000000000 0:83f4b4db085c
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Implementation of the Class PolyDllFB Target for the elf2e32 tool
       
    15 // @internalComponent
       
    16 // @released
       
    17 // 
       
    18 //
       
    19 
       
    20 #include "polydll_fb_target.h"
       
    21 
       
    22 /**
       
    23 Constructor for the POLYDLLFBTarget Class
       
    24 
       
    25 @internalComponent
       
    26 @released
       
    27 */
       
    28 POLYDLLFBTarget::POLYDLLFBTarget(ParameterListInterface* aParameterListInterface) : ExportTypeFBTarget(aParameterListInterface) {
       
    29 }
       
    30 
       
    31 /**
       
    32 Destructor for the POLYDLLFBTarget Class
       
    33 
       
    34 @internalComponent
       
    35 @released
       
    36 */
       
    37 POLYDLLFBTarget::~POLYDLLFBTarget()
       
    38 {
       
    39 	if(iDefExports)
       
    40 	{
       
    41 		SymbolList::iterator aItr = iDefExports->begin();
       
    42 		SymbolList::iterator last = iDefExports->end();
       
    43 		Symbol *temp;
       
    44 
       
    45 		while( aItr != last)
       
    46 		{
       
    47 			temp = *aItr;
       
    48 			aItr++;
       
    49 			delete temp;
       
    50 		}
       
    51 		iDefExports->clear();
       
    52 	}
       
    53 }
       
    54 
       
    55 /**
       
    56 Function to process the symbols to be exported. In case of Poly DLL, there might be
       
    57 predefined symbols passed to '--sydef' option, need to consider them alongwith the 
       
    58 symbols coming from the ELF file.
       
    59  
       
    60 @internalComponent
       
    61 @released
       
    62 */
       
    63 void POLYDLLFBTarget::ProcessExports() 
       
    64 {
       
    65 	int count = iParameterListInterface->SysDefCount();
       
    66 	ParameterListInterface::Sys aSysDefSymbols[10];
       
    67 
       
    68 	int j=0, i=count;
       
    69 	while (i)
       
    70 	{
       
    71 		aSysDefSymbols[j] = iParameterListInterface->SysDefSymbols(j);
       
    72 		j++; i--;
       
    73 	}
       
    74 
       
    75 	typedef SymbolList::iterator Iterator;
       
    76 
       
    77 	Symbol *aSymbolEntry;
       
    78 
       
    79 	iDefExports = new SymbolList;
       
    80 
       
    81 	for (int k=0; k < count; k++)
       
    82 	{
       
    83 		SymbolType aType = SymbolTypeCode;
       
    84 		aSymbolEntry = new Symbol(aSysDefSymbols[k].iSysDefSymbolName, aType);
       
    85 		aSymbolEntry->SetOrdinal(aSysDefSymbols[k].iSysDefOrdinalNum);
       
    86 		iDefExports->push_back(aSymbolEntry);
       
    87 	}
       
    88 
       
    89 	ValidateExports(iDefExports);
       
    90 	CreateExports();
       
    91 }
       
    92 
       
    93 /**
       
    94 Function to generate the output E32 image. Incase of an output DEF file, then the 
       
    95 DEF file and the corresponding DSO file should be generated.
       
    96   
       
    97 @internalComponent
       
    98 @released
       
    99 */
       
   100 void POLYDLLFBTarget::GenerateOutput() {
       
   101 	
       
   102 	if( UseCaseBase::DefOutput() ) {
       
   103 		WriteDefFile();
       
   104 	}
       
   105 	if(UseCaseBase::DSOOutput() && UseCaseBase::LinkAsDLLName()) {
       
   106 		WriteDSOFile();
       
   107 	}
       
   108 	WriteE32();
       
   109 }
       
   110 
       
   111 
       
   112