imgtools/romtools/rofsbuild/r_obey.cpp
author Zheng Shen <zheng.shen@nokia.com>
Tue, 17 Aug 2010 15:31:16 +0800
changeset 626 ac03b93ca9c4
parent 617 3a747a240983
child 647 53d1ab72f5bc
permissions -rw-r--r--
ROM Tools 12.3.4 + RCOMP 8.4.2
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     1
/*
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     2
* Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     3
* All rights reserved.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     4
* This component and the accompanying materials are made available
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     6
* which accompanies this distribution, and is available
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     8
*
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
     9
* Initial Contributors:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    10
* Nokia Corporation - initial contribution.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    11
*
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    12
* Contributors:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    13
*
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    14
* Description: 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    15
* @internalComponent * @released
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    16
* Rofsbuild Obey file class and its reader class.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    17
*
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    18
*/
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    19
 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    20
#include <strstream>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    21
#include <iomanip>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    22
 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    23
#include <string.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    24
#include <stdlib.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    25
#include <stdio.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    26
#include <time.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    27
#include <assert.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    28
#include <errno.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    29
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    30
#include <e32std.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    31
#include <e32std_private.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    32
#include <e32rom.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    33
#include <u32std.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    34
#include <f32file.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    35
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    36
#include "h_utl.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    37
#include "r_obey.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    38
#include "r_coreimage.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    39
#include "patchdataprocessor.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    40
#include "fatimagegenerator.h" 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    41
#include "r_driveimage.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    42
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
    43
#include "uniconv.hpp"
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    44
extern TInt gCodePagingOverride;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    45
extern TInt gDataPagingOverride;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    46
extern ECompression gCompress;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    47
extern TBool gEnableStdPathWarning; // Default to not warn if destination path provided for a file is not in standard path.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    48
extern TBool gKeepGoing;
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
    49
extern TBool gIsOBYUTF8;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    50
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    51
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    52
#define _P(word)	word, sizeof(word)-1	// match prefix, optionally followed by [HWVD]
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    53
#define _K(word)	word, 0					// match whole word
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    54
static char* const NullString = "" ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    55
const ObeyFileKeyword ObeyFileReader::iKeywords[] =
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    56
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    57
	{_K("file"),		2,-2, EKeywordFile, "File to be copied into ROFS"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    58
	{_K("data"),		2,-2, EKeywordData, "same as file"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    59
	{_K("dir"),         2,1, EKeywordDir, "Directory to be created into FAT image"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    60
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    61
	{_K("rofsname"),	1, 1, EKeywordRofsName, "output file for ROFS image"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    62
	{_K("romsize"),		1, 1, EKeywordRomSize, "size of ROM image"}, 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    63
	{_P("hide"),	    2, -1, EKeywordHide, "Exclude named file from ROM directory structure"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    64
	{_P("alias"),	    2, -2, EKeywordAlias, "Create alias for existing file in ROM directory structure"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    65
	{_P("rename"),	    2, -2, EKeywordRename, "Change the name of a file in the ROM directory structure"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    66
	{_K("rofssize"),		1, 1, EKeywordRofsSize, "maximum size of ROFS image"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    67
	{_K("romchecksum"),	1, 1, EKeywordRofsChecksum, "desired 32-bit checksum value for the whole image"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    68
	{_K("version"),		1, 1, EKeywordVersion, "ROFS image version number"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    69
	{_K("time"),	    1,-1, EKeywordTime, "ROFS image timestamp"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    70
	{_K("extensionrofs"),1+2, 1, EKeywordExtensionRofs, "Start of definition of optional Extension ROFS"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    71
	{_K("extensionrofsname"),1, 1, EKeywordCoreRofsName, "ROFS image on which extension ROFS is based"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    72
	{_K("rem"),			0, 0, EKeywordNone, "comment"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    73
	{_K("stop"),		0, 0, EKeywordNone, "Terminates OBEY file prematurely"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    74
	{_K("romchecksum"),	1, 1, EKeywordRomChecksum, "desired 32-bit checksum value for the whole ROFS image"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    75
	{_K("coreimage"),	1, 1, EKeywordCoreImage, "Core image to be used for extension directory structure"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    76
	{_K("autosize"),	1, 1, EKeywordRofsAutoSize, "Automatically adjust maximum image size to actual used"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    77
	{_K("pagingoverride"),	1, 1, EKeywordPagingOverride, "Overide the demand paging attributes for every file in ROM, NOPAGING|DEFAULTUNPAGED|DEFAULTPAGED"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    78
	{_K("codepagingoverride"),	1, 1, EKeywordCodePagingOverride, "Overide the code paging attributes for every file in ROM, NOPAGING|DEFAULTUNPAGED|DEFAULTPAGED"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    79
	{_K("datapagingoverride"),	1, 1, EKeywordDataPagingOverride, "Overide the data paging attributes for every file in ROM, NOPAGING|DEFAULTUNPAGED|DEFAULTPAGED"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    80
	{_K("dataimagename"),1, 1,EKeywordDataImageName, "Data Drive image file name"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    81
	{_K("dataimagefilesystem"),1, 1,EKeywordDataImageFileSystem, "Drive image file system format"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    82
	{_K("dataimagesize"),1, 1,EKeywordDataImageSize, "Maximum size of Data Drive image"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    83
	{_K("volume"),1, -1,EKeywordDataImageVolume, "Volume Label of Data Drive image"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    84
	{_K("sectorsize"),1, 1,EKeywordDataImageSectorSize, "Sector size(in bytes) of Data Drive image"},
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
    85
	{_K("clustersize"),1, 1,EKeywordDataImageClusterSize, "Cluster size(in bytes) of Data Drive image"},
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    86
	{_K("fattable"),1, 1,EKeywordDataImageNoOfFats, "Number of FATs in the Data Drive image"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    87
	// things we don't normally report in the help information
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    88
	{_K("trace"),		1, 1, EKeywordTrace, "(ROMBUILD activity trace flags)"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    89
	{_K("filecompress"),2, -2,EKeywordFileCompress,"Non-XIP Executable to be loaded into the ROM compressed" },
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    90
	{_K("fileuncompress"),2, -2,EKeywordFileUncompress,"Non-XIP Executable to be loaded into the ROM uncompressed" },
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    91
	{_K("patchdata"),2, 5,EKeywordPatchDllData, "Patch exported data"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    92
	{_K("imagename"), 1, 1, EKeywordSmrImageName, "output file for SMR image"},
617
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
    93
	{_K("hcrdata"), 1, 1, EKeywordSmrFileData, "file data for HCR SMR image"},
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
    94
	{_K("smrdata"), 1, 1, EKeywordSmrFileData, "file data for general SMR image"},
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    95
	{_K("formatversion"), 1, 1, EKeywordSmrFormatVersion, "format version for HCR SMR image"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    96
	{_K("payloadflags"), 1, 1, EKeywordSmrFlags, "payload flags for the HCR SMR image"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    97
	{_K("payloaduid"), 1, 1, EKeywordSmrUID, "payload UID for the HCR SMR image"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    98
	{0,0,0,0,EKeywordNone,""}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    99
};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   100
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   101
void ObeyFileReader::KeywordHelp() { // static
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   102
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   103
	cout << "Obey file keywords:\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   104
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   105
	const ObeyFileKeyword* k=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   106
	for (k=iKeywords; k->iKeyword!=0; k++)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   107
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   108
		if (k->iHelpText == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   109
			continue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   110
		if (k->iHelpText[0]=='(' && !H.iVerbose)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   111
			continue;	// don't normally report things in (parentheses)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   112
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   113
		char buf[32];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   114
		sprintf(buf, "%-20s", k->iKeyword);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   115
		if (k->iKeywordLength)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   116
			memcpy(buf+k->iKeywordLength,"[HWVD]",6);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   117
		if (H.iVerbose)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   118
			sprintf(buf+20,"%2d",k->iNumArgs);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   119
		cout << "    " << buf << " " << k->iHelpText << endl;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   120
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   121
	cout << endl;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   122
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   123
	cout << "File attributes:\n";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   124
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   125
	const FileAttributeKeyword* f=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   126
	for (f=iAttributeKeywords; f->iKeyword!=0; f++)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   127
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   128
		if (f->iHelpText == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   129
			continue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   130
		if (f->iHelpText[0]=='(' && !H.iVerbose)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   131
			continue;	// don't normally report things in (parentheses)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   132
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   133
		char buf[32];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   134
		sprintf(buf, "%-20s", f->iKeyword);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   135
		if (H.iVerbose)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   136
			sprintf(buf+20,"%2d",k->iNumArgs);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   137
		cout << "    " << buf << " " << f->iHelpText << endl;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   138
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   139
	cout << endl;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   140
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   141
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   142
ObeyFileReader::ObeyFileReader(const char* aFileName):iCurrentLine(0),
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   143
iFileName(aFileName),iNumWords(0),iLine(0),iMarkLine(0),iCurrentObeyStatement(0)	{  
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   144
	for(TUint i = 0 ; i < KNumWords ; i++)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   145
		iWord[i] = NullString;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   146
	*iSuffix = 0 ; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   147
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   148
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   149
ObeyFileReader::~ObeyFileReader() {	  
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   150
	if(iCurrentObeyStatement) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   151
		delete []iCurrentObeyStatement;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   152
		iCurrentObeyStatement = 0 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   153
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   154
	if(iLine) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   155
		delete []iLine; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   156
		iLine = 0 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   157
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   158
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   159
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   160
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   161
// Open the file & return a status
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   162
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   163
TBool ObeyFileReader::Open() {     
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   164
	ifstream ifs(iFileName.c_str(),ios_base::in + ios_base::binary);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   165
	if (!ifs.is_open()) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   166
		Print(EError,"Cannot open obey file %s\n",iFileName.c_str());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   167
		return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   168
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   169
	iLines.clear();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   170
	if(iLine){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   171
		delete []iLine;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   172
		iLine = 0 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   173
	}		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   174
	ifs.seekg(0,ios_base::end);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   175
	size_t length = ifs.tellg();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   176
	char* buffer = new char[length + 2];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   177
	if (0 == buffer) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   178
		Print(EError,"Insufficent Memory to Continue.");	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   179
		ifs.close();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   180
		return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   181
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   182
	ifs.seekg(0,ios_base::beg);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   183
	ifs.read(buffer,length);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   184
	size_t readcout = ifs.gcount() ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   185
	if(readcout != length){ 	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   186
		Print(EError,"Cannot Read All of File.");	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   187
		delete []buffer ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   188
		ifs.close();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   189
		return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   190
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   191
	buffer[length] = '\n';
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   192
	buffer[length + 1] = 0 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   193
	ifs.close();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   194
	char* lineStart = buffer ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   195
	char* end = buffer + length ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   196
	string line ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   197
	size_t maxLengthOfLine = 0 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   198
	while(lineStart < end){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   199
		while(*lineStart == ' ' || *lineStart == '\t') //trimleft 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   200
			lineStart ++ ;		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   201
		char* lineEnd = lineStart ;	 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   202
		while(*lineEnd != '\r' && *lineEnd != '\n')
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   203
			lineEnd ++ ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   204
		if(strnicmp(lineStart,"REM",3) == 0){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   205
			line = "" ; // REMOVE "REM ... "
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   206
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   207
		else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   208
			TInt lastIndex = lineEnd - lineStart - 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   209
			while(lastIndex >= 0 &&  // trimright
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   210
				(lineStart[lastIndex] == ' ' || lineStart[lastIndex] == '\t'))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   211
				lastIndex -- ;			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   212
			if(lastIndex >= 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   213
				line.assign(lineStart,lastIndex + 1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   214
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   215
				line = "";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   216
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   217
		if(line.length() > maxLengthOfLine)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   218
			maxLengthOfLine = line.length();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   219
		iLines.push_back(line);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   220
		if(*lineEnd == '\r') {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   221
			if(lineEnd[1] == '\n')
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   222
				lineStart = lineEnd + 2 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   223
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   224
				lineStart = lineEnd + 1 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   225
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   226
		else // '\n'
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   227
			lineStart = lineEnd + 1 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   228
	}	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   229
	delete []buffer ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   230
	iLine = new char[maxLengthOfLine + 1];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   231
	iCurrentObeyStatement = new char[maxLengthOfLine + 1];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   232
	*iCurrentObeyStatement = 0 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   233
	*iLine = 0 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   234
	iCurrentLine = 0 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   235
	iMarkLine = 0 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   236
	return ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   237
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   238
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   239
void ObeyFileReader::Mark()	{ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   240
	iMarkLine = iCurrentLine - 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   241
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   242
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   243
void ObeyFileReader::MarkNext() { 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   244
	iMarkLine = iCurrentLine;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   245
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   246
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   247
void ObeyFileReader::Rewind() {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   248
	iCurrentLine = iMarkLine;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   249
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   250
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   251
char* ObeyFileReader::DupWord(TInt aIndex) const {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   252
	char* retVal = 0 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   253
	if(aIndex >= 0 && aIndex < (TInt)KNumWords){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   254
		size_t len = strlen(iWord[aIndex]) + 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   255
		retVal = new char[len];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   256
		if(retVal)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   257
			memcpy(retVal,iWord[aIndex],len);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   258
	} 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   259
	return retVal ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   260
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   261
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   262
TInt ObeyFileReader::ReadAndParseLine() {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   263
	if (iCurrentLine >= (TInt)iLines.size())
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   264
		return KErrEof;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   265
	iCurrentLine++; 	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   266
	iNumWords = Parse();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   267
	return KErrNone;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   268
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   269
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   270
TInt ObeyFileReader::NextLine(TInt aPass, enum EKeyword& aKeyword) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   271
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   272
NextLine:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   273
	TInt err = ReadAndParseLine();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   274
	if (err == KErrEof)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   275
		return KErrEof;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   276
	if(iNumWords == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   277
		goto NextLine;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   278
	if (stricmp(iWord[0], "stop")==0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   279
		return KErrEof;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   280
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   281
	const ObeyFileKeyword* k=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   282
	for (k=iKeywords; k->iKeyword!=0; k++) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   283
		if (k->iKeywordLength == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   284
			// Exact case-insensitive match on keyword
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   285
			if (stricmp(iWord[0], k->iKeyword) != 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   286
				continue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   287
			*iSuffix = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   288
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   289
		else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   290
			// Prefix match
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   291
			if (strnicmp(iWord[0], k->iKeyword, k->iKeywordLength) != 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   292
				continue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   293
			// Suffix must be empty, or a variant number in []
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   294
			strncpy(iSuffix,iWord[0] + k->iKeywordLength,80);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   295
			if (*iSuffix != '\0' && *iSuffix != '[')
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   296
				continue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   297
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   298
		// found a match
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   299
		if ((k->iPass & aPass) == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   300
			goto NextLine;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   301
		if (k->iNumArgs>=0 && (1+k->iNumArgs != iNumWords)) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   302
			Print(EError, "Incorrect number of arguments for keyword %s on line %d.\n",
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   303
				iWord[0], iCurrentLine);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   304
			goto NextLine;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   305
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   306
		if (k->iNumArgs<0 && (1-k->iNumArgs > iNumWords)) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   307
			Print(EError, "Too few arguments for keyword %s on line %d.\n",
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   308
				iWord[0], iCurrentLine);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   309
			goto NextLine;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   310
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   311
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   312
		aKeyword = k->iKeywordEnum;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   313
		return KErrNone;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   314
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   315
	if (aPass == 1)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   316
		Print(EWarning, "Unknown keyword '%s'.  Line %d ignored\n", iWord[0], iCurrentLine);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   317
	goto NextLine;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   318
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   319
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   320
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   321
// splits a line into words, and returns the number of words found
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   322
// 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   323
TInt ObeyFileReader::Parse() {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   324
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   325
	for (TUint i = 0; i < KNumWords; i++)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   326
		iWord[i] = NullString;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   327
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   328
	enum TState {EInWord, EInQuotedWord, EInGap};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   329
	TState state = EInGap;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   330
	const string& line = iLines[iCurrentLine - 1]; 	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   331
	size_t len = line.length();	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   332
	memcpy(iLine,line.c_str(),len);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   333
	memcpy(iCurrentObeyStatement,iLine,len);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   334
	iLine[len] = 0 ; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   335
	iCurrentObeyStatement[len] = 0 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   336
	TUint i = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   337
	char* linestr = iLine;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   338
	while (i < KNumWords && *linestr != 0) {	 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   339
		switch (state)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   340
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   341
		case EInGap:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   342
			if (*linestr =='\"') {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   343
				if (linestr[1] != 0 && linestr[1]!='\"')
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   344
					iWord[i++] = linestr + 1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   345
				state = EInQuotedWord;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   346
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   347
			else if (!IsGap(*linestr)) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   348
				iWord[i++] = linestr;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   349
				state=EInWord;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   350
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   351
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   352
				*linestr=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   353
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   354
		case EInWord:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   355
			if (*linestr == '\"') {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   356
				*linestr = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   357
				if (linestr[1] != 0 && linestr[1] != '\"')
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   358
					iWord[i++] = linestr+1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   359
				state=EInQuotedWord;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   360
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   361
			else if (IsGap(*linestr)) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   362
				*linestr=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   363
				state=EInGap;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   364
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   365
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   366
		case EInQuotedWord:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   367
			if (*linestr == '\"'){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   368
				*linestr = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   369
				state = EInGap;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   370
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   371
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   372
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   373
		linestr++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   374
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   375
	return i;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   376
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   377
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   378
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   379
// Process the timestamp
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   380
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   381
void ObeyFileReader::ProcessTime(TInt64& aTime) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   382
	char timebuf[256];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   383
	if (iNumWords>2)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   384
		sprintf(timebuf, "%s_%s", iWord[1], iWord[2]);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   385
	else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   386
		strncpy(timebuf, iWord[1],256);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   387
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   388
	TInt r = StringToTime(aTime, timebuf);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   389
	if (r==KErrGeneral) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   390
		Print(EError, "incorrect format for time keyword on line %d\n", iCurrentLine);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   391
		exit(0x670);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   392
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   393
	if (r==KErrArgument){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   394
		Print(EError, "Time out of range on line %d\n", iCurrentLine);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   395
		exit(0x670);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   396
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   397
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   398
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   399
TInt64 ObeyFileReader::iTimeNow = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   400
void ObeyFileReader::TimeNow(TInt64& aTime) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   401
	if (iTimeNow==0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   402
		TInt sysTime = time(0);					// seconds since midnight Jan 1st, 1970
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   403
		sysTime -= (30*365*24*60*60+7*24*60*60);	// seconds since midnight Jan 1st, 2000
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   404
		TInt64 daysTo2000AD=730497;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   405
		TInt64 t=daysTo2000AD*24*3600+sysTime;	// seconds since 0000
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   406
		t = t+3600;								// BST (?)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   407
		iTimeNow=t*1000000;						// milliseconds
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   408
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   409
	aTime=iTimeNow;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   410
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   411
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   412
 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   413
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   414
// File attributes.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   415
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   416
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   417
const FileAttributeKeyword ObeyFileReader::iAttributeKeywords[] =
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   418
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   419
	{"attrib",3			,0,1,EAttributeAtt, "File attributes in ROM file system"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   420
	{"exattrib",3		,0,1,EAttributeAttExtra, "File extra attributes in ROM file system"}, 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   421
	{"stack",3			,1,1,EAttributeStack, "?"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   422
	{"fixed",3			,1,0,EAttributeFixed, "Relocate to a fixed address space"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   423
	{"priority",3		,1,1,EAttributePriority, "Override process priority"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   424
	{_K("uid1")			,1,1,EAttributeUid1, "Override first UID"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   425
	{_K("uid2")			,1,1,EAttributeUid2, "Override second UID"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   426
	{_K("uid3")			,1,1,EAttributeUid3, "Override third UID"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   427
	{_K("heapmin")		,1,1,EAttributeHeapMin, "Override initial heap size"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   428
	{_K("heapmax")		,1,1,EAttributeHeapMax, "Override maximum heap size"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   429
	{_K("capability")	,1,1,EAttributeCapability, "Override capabilities"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   430
	{_K("unpaged")		,1,0,EAttributeUnpaged, "Don't page code or data for this file"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   431
	{_K("paged")		,1,0,EAttributePaged, "Page code and data for this file"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   432
	{_K("unpagedcode")	,1,0,EAttributeUnpagedCode, "Don't page code for this file"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   433
	{_K("pagedcode")	,1,0,EAttributePagedCode, "Page code for this file"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   434
	{_K("unpageddata")	,1,0,EAttributeUnpagedData, "Don't page data for this file"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   435
	{_K("pageddata")	,1,0,EAttributePagedData, "Page data for this file"},
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   436
	{0,0,0,0,EAttributeAtt,0}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   437
};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   438
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   439
TInt ObeyFileReader::NextAttribute(TInt& aIndex, TInt aHasFile, enum EFileAttribute& aKeyword, char*& aArg)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   440
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   441
NextAttribute:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   442
	if (aIndex >= iNumWords)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   443
		return KErrEof;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   444
	char* word=iWord[aIndex++];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   445
	const FileAttributeKeyword* k;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   446
	for (k=iAttributeKeywords; k->iKeyword!=0; k++)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   447
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   448
		if (k->iKeywordLength == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   449
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   450
			// Exact match on keyword
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   451
			if (stricmp(word, k->iKeyword) != 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   452
				continue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   453
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   454
		else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   455
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   456
			// Prefix match
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   457
			if (strnicmp(word, k->iKeyword, k->iKeywordLength) != 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   458
				continue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   459
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   460
		// found a match
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   461
		if (k->iNumArgs>0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   462
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   463
			TInt argIndex = aIndex;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   464
			aIndex += k->iNumArgs;		// interface only really supports 1 argument
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   465
			if (aIndex>iNumWords)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   466
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   467
				Print(EError, "Missing argument for attribute %s on line %d\n", word, iCurrentLine);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   468
				return KErrArgument;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   469
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   470
			aArg=iWord[argIndex];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   471
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   472
		if (k->iIsFileAttribute && !aHasFile)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   473
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   474
			Print(EError, "File attribute %s applied to non-file on line %d\n", word, iCurrentLine);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   475
			return KErrNotSupported;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   476
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   477
		aKeyword=k->iAttributeEnum;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   478
		return KErrNone;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   479
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   480
	Print(EWarning, "Unknown attribute '%s' skipped on line %d\n", word, iCurrentLine);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   481
	goto NextAttribute;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   482
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   483
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   484
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   485
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   486
/**
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   487
Constructor:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   488
1.Obey file instance.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   489
2.used by both rofs and datadrive image.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   490
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   491
@param aReader - obey file reader object.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   492
*/
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   493
CObeyFile::CObeyFile(ObeyFileReader& aReader):
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   494
iRomFileName(NULL),
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   495
iExtensionRofsName(0),
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   496
iKernelRofsName(0),
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   497
iRomSize(0),
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   498
iVersion(0,0,0),
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   499
iCheckSum(0),
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   500
iNumberOfFiles(0),
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   501
iTime(0),
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   502
iRootDirectory(0),
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   503
iNumberOfDataFiles(0),
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   504
iDriveFileName(0), 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   505
iDriveFileFormat(0), 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   506
iReader(aReader), 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   507
iMissingFiles(0), 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   508
iLastExecutable(0),
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   509
iFirstFile(0), 	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   510
iCurrentFile(0),
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   511
iAutoSize(EFalse),
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   512
iAutoPageSize(4096),
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   513
iPagingOverrideParsed(0),
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   514
iCodePagingOverrideParsed(0),
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   515
iDataPagingOverrideParsed(0),
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   516
iPatchData(new CPatchDataProcessor)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   517
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   518
	iNextFilePtrPtr = &iFirstFile ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   519
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   520
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   521
/**
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   522
Obey file Destructor.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   523
1.Release the tree memory.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   524
2.Release all allocated memory if any.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   525
*/
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   526
CObeyFile::~CObeyFile() {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   527
	if(iDriveFileName){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   528
		delete[] iDriveFileName;					
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   529
		iDriveFileName = 0 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   530
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   531
	if(iDriveFileFormat) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   532
		delete[] iDriveFileFormat;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   533
		iDriveFileFormat = 0 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   534
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   535
	iRootDirectory->deleteTheFirstNode();                
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   536
	iRootDirectory->InitializeCount();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   537
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   538
	Release();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   539
	if(iRomFileName){ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   540
		delete [] iRomFileName;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   541
		iRomFileName = 0 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   542
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   543
	if (iRootDirectory)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   544
		iRootDirectory->Destroy(); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   545
	if(iPatchData)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   546
		delete iPatchData;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   547
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   548
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   549
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   550
// Free resources not needed after building a ROM
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   551
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   552
void CObeyFile::Release() {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   553
	iFirstFile = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   554
	iNextFilePtrPtr = &iFirstFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   555
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   556
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   557
TRomBuilderEntry *CObeyFile::FirstFile() {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   558
	iCurrentFile = iFirstFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   559
	return iCurrentFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   560
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   561
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   562
TRomBuilderEntry *CObeyFile::NextFile() {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   563
	iCurrentFile = iCurrentFile ? iCurrentFile->iNext : 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   564
	return iCurrentFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   565
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   566
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   567
char* CObeyFile::ProcessCoreImage() const {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   568
	// check for coreimage keyword and return filename	 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   569
	enum EKeyword keyword;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   570
	char* coreImageFileName = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   571
	iReader.Rewind();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   572
	while (iReader.NextLine(1,keyword) != KErrEof) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   573
		if (keyword == EKeywordCoreImage) {  			  
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   574
			coreImageFileName = iReader.DupWord(1);	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   575
			iReader.MarkNext();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   576
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   577
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   578
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   579
	return coreImageFileName;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   580
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   581
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   582
void CObeyFile::SkipToExtension() {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   583
	iReader.Rewind();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   584
	enum EKeyword keyword;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   585
	while (iReader.NextLine(1,keyword) != KErrEof) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   586
		if (keyword == EKeywordExtensionRofs) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   587
			iReader.Mark(); // ready for processing extension
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   588
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   589
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   590
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   591
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   592
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   593
TInt CObeyFile::ProcessRofs() {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   594
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   595
	//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   596
	// First pass through the obey file to set up key variables
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   597
	//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   598
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   599
	iReader.Rewind();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   600
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   601
	TInt count=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   602
	enum EKeyword keyword;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   603
	while (iReader.NextLine(1,keyword) != KErrEof) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   604
		if (keyword == EKeywordExtensionRofs){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   605
			if (count==0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   606
				return KErrNotFound;		// no core ROFS, just extension ROFSs.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   607
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   608
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   609
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   610
		count++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   611
		if (! ProcessKeyword(keyword))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   612
			return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   613
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   614
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   615
	if (!GotKeyVariables())
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   616
		return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   617
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   618
	//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   619
	// second pass to process the file specifications in the obey file building
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   620
	// up the TRomNode directory structure and the TRomBuilderEntry list
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   621
	//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   622
	iReader.Rewind();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   623
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   624
	iRootDirectory = new TRomNode("");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   625
	iLastExecutable = iRootDirectory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   626
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   627
	TInt align=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   628
	while (iReader.NextLine(2,keyword)!=KErrEof) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   629
		if (keyword == EKeywordExtensionRofs)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   630
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   631
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   632
		if (keyword == EKeywordHide)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   633
			keyword = EKeywordHideV2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   634
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   635
		switch (keyword) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   636
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   637
		case EKeywordHide:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   638
		case EKeywordAlias:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   639
		case EKeywordRename:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   640
			if (!ProcessRenaming(keyword))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   641
				return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   642
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   643
		case EKeywordPatchDllData:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   644
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   645
				// Collect patchdata statements to process at the end
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   646
				StringVector patchDataTokens;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   647
				SplitPatchDataStatement(patchDataTokens); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   648
				iPatchData->AddPatchDataStatement(patchDataTokens);									
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   649
				break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   650
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   651
		default:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   652
			if (!ProcessFile(align, keyword))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   653
				return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   654
			align=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   655
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   656
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   657
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   658
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   659
	if(!ParsePatchDllData())
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   660
		return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   661
	iReader.Mark();			// ready for processing the extension rom(s)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   662
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   663
	if (iMissingFiles!=0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   664
		return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   665
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   666
	if ( 0 == iNumberOfFiles ){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   667
		Print(EError, "No files specified.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   668
		return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   669
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   670
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   671
	return KErrNone;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   672
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   673
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   674
TBool CObeyFile::Process() {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   675
	TBool result = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   676
	iReader.Rewind();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   677
	enum EKeyword keyword;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   678
	while(iReader.NextLine(1, keyword) != KErrEof){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   679
		string key = iReader.Word(0);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   680
		string value = iReader.Word(1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   681
		if(iKeyValues.find(key) != iKeyValues.end()){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   682
			iKeyValues[key].push_back(value);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   683
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   684
		else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   685
			StringVector values;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   686
			values.push_back(value);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   687
			iKeyValues[key]=values;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   688
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   689
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   690
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   691
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   692
	return result;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   693
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   694
StringVector CObeyFile::getValues(const string& aKey) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   695
	StringVector values;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   696
	if(iKeyValues.find(aKey) != iKeyValues.end()){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   697
		values = iKeyValues[aKey];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   698
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   699
	return values;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   700
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   701
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   702
/**
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   703
Process drive obey file and construct the tree.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   704
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   705
@return - Return the status,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   706
'KErrnone' for Success,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   707
'KErrGeneral' for failure (required keywords not there in obey file or failed
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   708
to construct the tree).
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   709
*/
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   710
TInt CObeyFile::ProcessDataDrive() {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   711
	iReader.Rewind();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   712
	enum EKeyword keyword;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   713
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   714
	// First pass through the obey file to set up key variables
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   715
	while (iReader.NextLine(1,keyword) != KErrEof) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   716
		if (!ProcessDriveKeyword(keyword))			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   717
			return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   718
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   719
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   720
	if (!GotKeyDriveVariables())
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   721
		return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   722
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   723
	// Second pass to process the file specifications in the obey file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   724
	// Build the TRomNode directory structure and the TRomBuilderEntry list
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   725
	iReader.Rewind();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   726
	iRootDirectory = new TRomNode("//");					
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   727
	iLastExecutable = iRootDirectory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   728
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   729
	while(iReader.NextLine(2,keyword)!=KErrEof) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   730
		switch (keyword) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   731
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   732
		case EKeywordPatchDllData:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   733
			{	// Collect patchdata statements to process at the end
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   734
				StringVector patchDataTokens;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   735
				SplitPatchDataStatement(patchDataTokens); 				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   736
				iPatchData->AddPatchDataStatement(patchDataTokens);									
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   737
				break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   738
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   739
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   740
		case EKeywordHide:						
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   741
		case EKeywordFile:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   742
		case EKeywordDir:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   743
		case EKeywordData:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   744
		case EKeywordFileCompress:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   745
		case EKeywordFileUncompress:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   746
			if (!ProcessDriveFile(keyword))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   747
				return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   748
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   749
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   750
		default:							
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   751
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   752
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   753
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   754
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   755
	if(!ParsePatchDllData())
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   756
		return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   757
	if (iMissingFiles) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   758
		Print(EError, "Source Files Missing.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   759
		return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   760
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   761
	if (!iNumberOfFiles)
617
3a747a240983 ROM Tools 12.2.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 609
diff changeset
   762
		Print(EAlways,"No files specified.\n");
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   763
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   764
	return KErrNone;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   765
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   766
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   767
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   768
/**
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   769
Process and stores the keyword information.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   770
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   771
@param aKeyword - keyword to update its value to variables.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   772
@return - Return the status i.e Success,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   773
*/
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   774
TBool CObeyFile::ProcessDriveKeyword(enum EKeyword aKeyword) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   775
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   776
	TBool success = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   777
	switch (aKeyword)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   778
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   779
	case EKeywordDataImageName:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   780
		iDriveFileName = iReader.DupWord(1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   781
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   782
	case EKeywordDataImageFileSystem:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   783
		iDriveFileFormat = iReader.DupWord(1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   784
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   785
	case EKeywordDataImageSize:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   786
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   787
			const char* bigString = iReader.Word(1);
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   788
			TInt64 imagesize = 0;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   789
			Val(imagesize,bigString); 
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   790
			if(imagesize <= 0)
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   791
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   792
				Print(EWarning,"Not a valid Image Size. Default size is considered\n");		
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   793
			}else
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   794
			{
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   795
				iConfigurableFatAttributes.iImageSize = imagesize;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   796
			} 
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   797
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   798
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   799
	case EKeywordDataImageVolume:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   800
		{				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   801
			// Get the volume label provided by using "volume" keyword.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   802
			// e.g. vlolume = NO NAME
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   803
			string volumeLabel = iReader.GetCurrentObeyStatement();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   804
			string volumeLabelKeyword = "volume";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   805
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   806
			TUint position = volumeLabel.find(volumeLabelKeyword.c_str(),0,volumeLabelKeyword.size());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   807
			position += volumeLabelKeyword.size();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   808
			if (volumeLabel.find('=',position) != string::npos) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   809
				position=volumeLabel.find('=',position);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   810
				++position;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   811
			}								
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   812
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   813
			position = volumeLabel.find_first_not_of(' ',position);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   814
			if (position != string::npos) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   815
				volumeLabel = volumeLabel.substr(position);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   816
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   817
				// Remove the new line character from the end
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   818
				position = volumeLabel.find_first_of("\r\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   819
				if (position != string::npos)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   820
					volumeLabel = volumeLabel.substr(0,position);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   821
				size_t length = volumeLabel.length() ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   822
				if(length > 11) 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   823
						length = 11 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   824
				memcpy(iConfigurableFatAttributes.iDriveVolumeLabel,volumeLabel.c_str(),length) ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   825
				while(length != 11)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   826
					iConfigurableFatAttributes.iDriveVolumeLabel[length++] = ' ';
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   827
				iConfigurableFatAttributes.iDriveVolumeLabel[length] = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   828
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   829
			else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   830
				Print(EWarning,"Value for Volume Label is not provided. Default value is considered.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   831
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   832
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   833
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   834
	case EKeywordDataImageSectorSize:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   835
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   836
			const char* bigString = iReader.Word(1);
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   837
			TInt sectorSize = 0;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   838
			Val(sectorSize,bigString); 
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   839
			if(sectorSize <= 0)	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   840
				Print(EWarning,"Invalid Sector Size value. Default value is considered.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   841
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   842
			else {
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   843
				iConfigurableFatAttributes.iDriveSectorSize = sectorSize;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   844
			}
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   845
		}			
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   846
		break;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   847
	case EKeywordDataImageClusterSize:
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   848
		{
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   849
			const char* bigString = iReader.Word(1);
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   850
			TInt clusterSize = 0;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   851
			Val(clusterSize,bigString); 
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   852
			if(clusterSize <= 0)	{
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   853
				Print(EWarning,"Invalid Cluster Size value. Default value is considered.\n");
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   854
			}
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   855
			else {
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   856
				iConfigurableFatAttributes.iDriveClusterSize = clusterSize;
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   857
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   858
		}			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   859
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   860
	case EKeywordDataImageNoOfFats:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   861
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   862
			const char* bigString = iReader.Word(1);
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   863
			TInt noOfFats = 0;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   864
			Val(noOfFats,bigString); 
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   865
			if (noOfFats <=0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   866
				Print(EWarning,"Invalid No of FATs specified. Default value is considered.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   867
			else
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   868
				iConfigurableFatAttributes.iDriveNoOfFATs = noOfFats;			
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   869
		}			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   870
		break;			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   871
	default:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   872
		// unexpected keyword iReader.Word(0), keep going.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   873
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   874
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   875
	return success;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   876
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   877
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   878
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   879
/**
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   880
Checks whether obeyfile has supplied enough variables to continue.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   881
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   882
@return - Return the status 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   883
ETrue - Supplied valid values,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   884
EFalse- Not valied values.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   885
*/
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   886
TBool CObeyFile::GotKeyDriveVariables() {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   887
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   888
	TBool retVal=ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   889
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   890
	// Mandatory keywords
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   891
	if (iDriveFileName==0) {                                                  
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   892
		Print(EError,"The name of the image file has not been supplied.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   893
		Print(EError,"Use the keyword \"dataimagename\".\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   894
		retVal = EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   895
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   896
	// Check for '-'ve entered value.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   897
	if(iConfigurableFatAttributes.iImageSize <= 0){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   898
		Print(EWarning,"Image Size should be positive. Default size is Considered.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   899
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   900
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   901
	// File system format.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   902
	if(iDriveFileFormat==0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   903
		Print(EError,"The name of the file system not been supplied.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   904
		Print(EError,"Use the keyword \"dataimagefilesystem\".\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   905
		retVal = EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   906
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   907
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   908
	// Checking the validity of file system format.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   909
	if(iDriveFileFormat){		 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   910
		if(stricmp(iDriveFileFormat,"FAT16") && stricmp(iDriveFileFormat,"FAT32")) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   911
			Print(EError,"The name of the file system not supported : %s\n",iDriveFileFormat);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   912
			retVal = EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   913
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   914
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   915
	if(retVal)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   916
		Print(ELog,"\nCreating Data Drive image : %s\n", iDriveFileName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   917
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   918
	return retVal;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   919
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   920
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   921
/**
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   922
Process a parsed line to set up one or more new TRomBuilder entry objects.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   923
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   924
@param  - obey file keyword.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   925
// iWord[0] = the keyword (file,)      
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   926
// iWord[1] = the PC pathname
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   927
// iWord[2] = the EPOC pathname
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   928
// iWord[3] = start of the file attributes
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   929
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   930
@return - Return the status 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   931
ETrue - Successful generation of tree.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   932
EFalse- Fail to generate the tree.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   933
*/
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   934
TBool CObeyFile::ProcessDriveFile(enum EKeyword aKeyword) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   935
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   936
	TBool isPeFile = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   937
	TBool aFileCompressOption, aFileUncompressOption;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   938
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   939
	TInt epocPathStart=2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   940
	aFileCompressOption = aFileUncompressOption = EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   941
	// do some validation of the keyword
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   942
	TInt currentLine = iReader.CurrentLine();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   943
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   944
	switch (aKeyword)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   945
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   946
	case EKeywordData:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   947
	case EKeywordDir:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   948
	case EKeywordHide:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   949
		isPeFile = EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   950
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   951
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   952
	case EKeywordFile:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   953
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   954
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   955
	case EKeywordFileCompress:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   956
		aFileCompressOption = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   957
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   958
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   959
	case EKeywordFileUncompress:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   960
		aFileUncompressOption = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   961
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   962
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   963
	default:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   964
		return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   965
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   966
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   967
	if (aKeyword!=EKeywordHide && aKeyword!=EKeywordDir) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   968
		// check the PC file exists
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   969
		char* nname = NormaliseFileName(iReader.Word(1));		  
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   970
		if(gIsOBYUTF8 && !UniConv::IsPureASCIITextStream(nname))
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   971
		{
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   972
			char* tempnname = strdup(nname);
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   973
			unsigned int namelen = 0;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   974
			if(UniConv::UTF82DefaultCodePage(tempnname, strlen(tempnname), &nname, &namelen) < 0)
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   975
			{
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   976
				Print(EError, "Invalid filename encoding: %s\n", tempnname);
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   977
				free(tempnname);
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   978
				delete[] nname;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   979
				iMissingFiles++;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   980
				return EFalse;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   981
			}
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   982
			free(tempnname);
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
   983
		}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   984
		ifstream test(nname);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   985
		if(!test.is_open()){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   986
			Print(EError,"Cannot open file %s for input.\n",iReader.Word(1));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   987
			iMissingFiles++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   988
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   989
		test.close();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   990
		delete []nname ;												
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   991
		 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   992
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   993
	else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   994
		epocPathStart=1;   
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   995
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   996
	if(aKeyword != EKeywordDir)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   997
		iNumberOfFiles++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   998
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   999
	TBool endOfName=EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1000
	const char *epocStartPtr;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1001
	if(aKeyword != EKeywordDir)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1002
		epocStartPtr = IsValidFilePath(iReader.Word(epocPathStart));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1003
	else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1004
		epocStartPtr = IsValidDirPath(iReader.Word(epocPathStart));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1005
	char *epocEndPtr = const_cast<char*>(epocStartPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1006
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1007
	if (epocStartPtr == NULL) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1008
		Print(EError, "Invalid destination path on line %d\n",currentLine);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1009
		return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1010
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1011
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1012
	TRomNode* dir=iRootDirectory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1013
	TRomNode* subDir=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1014
	TRomBuilderEntry *file=0;      
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1015
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1016
	while (!endOfName) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1017
		endOfName = GetNextBitOfFileName(epocEndPtr);      
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1018
		if (endOfName && (aKeyword!=EKeywordDir)) { // file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1019
			TRomNode* alreadyExists=dir->FindInDirectory(epocStartPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1020
			if ((aKeyword != EKeywordHide) && alreadyExists) { // duplicate file		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1021
				if (gKeepGoing) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1022
					Print(EWarning, "Duplicate file for %s on line %d, will be ignored\n",iReader.Word(1),iReader.CurrentLine());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1023
					iNumberOfFiles--;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1024
					return ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1025
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1026
				else {	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1027
					Print(EError, "Duplicate file for %s on line %d\n",iReader.Word(1),iReader.CurrentLine());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1028
					return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1029
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1030
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1031
			else if((aKeyword == EKeywordHide) && (alreadyExists)) { 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1032
				alreadyExists->iEntry->iHidden = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1033
				alreadyExists->iHidden = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1034
				return ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1035
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1036
			else if((aKeyword == EKeywordHide) && (!alreadyExists)) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1037
				Print(EWarning, "Hiding non-existent file %s on line %d\n",iReader.Word(1),iReader.CurrentLine());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1038
				return ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1039
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1040
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1041
			file = new TRomBuilderEntry(iReader.Word(1), epocStartPtr);                   
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1042
			file->iExecutable=isPeFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1043
			if( aFileCompressOption ) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1044
				file->iCompressEnabled = ECompressionCompress;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1045
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1046
			else if(aFileUncompressOption )	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1047
				file->iCompressEnabled = ECompressionUncompress;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1048
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1049
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1050
			TRomNode* node=new TRomNode(epocStartPtr, file);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1051
			if (node==0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1052
				return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1053
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1054
			TInt r=ParseFileAttributes(node, file, aKeyword);         
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1055
			if (r!=KErrNone)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1056
				return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1057
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1058
			if(gCompress != ECompressionUnknown) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1059
				node->iFileUpdate = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1060
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1061
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1062
			if((node->iOverride) || (aFileCompressOption) || (aFileUncompressOption)) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1063
				node->iFileUpdate = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1064
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1065
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1066
			dir->AddFile(node);	// to drive directory structure.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1067
		}		 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1068
		else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1069
			// directory
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1070
			//for directory creation, given /sys/bin/, it's possible to reach 0 at the end, just ignore that...
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1071
			if(!*epocStartPtr)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1072
				break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1073
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1074
			subDir = dir->FindInDirectory(epocStartPtr);      
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1075
			if (!subDir){ // sub directory does not exist			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1076
				if(aKeyword==EKeywordHide) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1077
					Print(EWarning, "Hiding non-existent file %s on line %d\n",
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1078
						iReader.Word(1),iReader.CurrentLine());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1079
					return ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1080
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1081
				subDir = dir->NewSubDir(epocStartPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1082
				if (!subDir)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1083
					return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1084
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1085
			dir=subDir;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1086
			epocStartPtr = epocEndPtr;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1087
		}  // end of else.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1088
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1089
	return ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1090
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1091
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1092
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1093
TInt CObeyFile::SetStackSize(TRomNode *aNode, const char* aStr) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1094
	if (EFalse == IsValidNumber(aStr))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1095
		return Print(EError, "Number required as argument for keyword 'stack'.\n"); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1096
	TInt size ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1097
	TInt err = Val(size,aStr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1098
	if(KErrNone == err){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1099
		aNode->SetStackSize(size );
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1100
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1101
	return err;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1102
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1103
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1104
TInt CObeyFile::SetHeapSizeMin(TRomNode *aNode, const char* aStr) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1105
	if (EFalse == IsValidNumber(aStr))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1106
		return Print(EError, "Number required as argument for keyword 'heapmin'.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1107
	TInt size ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1108
	TInt err = Val(size,aStr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1109
	if(KErrNone == err){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1110
		aNode->SetHeapSizeMin(size );
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1111
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1112
	return err;	 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1113
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1114
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1115
TInt CObeyFile::SetHeapSizeMax(TRomNode *aNode, const char* aStr) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1116
	if (EFalse == IsValidNumber(aStr))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1117
		return Print(EError, "Number required as argument for keyword 'heapmax'.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1118
	TInt size ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1119
	TInt err = Val(size,aStr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1120
	if(KErrNone == err){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1121
		aNode->SetHeapSizeMax(size );
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1122
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1123
	return err;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1124
	 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1125
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1126
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1127
TInt CObeyFile::SetCapability(TRomNode *aNode, const char* aStr) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1128
	if ( IsValidNumber(aStr)){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1129
		Print(EDiagnostic,"Old style numeric CAPABILTY specification ignored.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1130
		return KErrNone;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1131
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1132
	SCapabilitySet cap;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1133
	TInt r = ParseCapabilitiesArg(cap, (char*)aStr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1134
	if( KErrNone == r ) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1135
		aNode->SetCapability( cap );
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1136
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1137
	return r;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1138
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1139
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1140
TInt CObeyFile::SetPriority(TRomNode *aNode, const char* aStr) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1141
	TProcessPriority priority;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1142
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1143
	if ( IsValidNumber(aStr)) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1144
		TUint32 temp = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1145
		Val(temp,aStr) ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1146
		priority = (TProcessPriority)temp ; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1147
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1148
	else {	 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1149
		if (stricmp(aStr, "low")==0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1150
			priority=EPriorityLow;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1151
		else if (strnicmp(aStr, "background", 4)==0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1152
			priority=EPriorityBackground;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1153
		else if (strnicmp(aStr, "foreground", 4)==0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1154
			priority=EPriorityForeground;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1155
		else if (stricmp(aStr, "high")==0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1156
			priority=EPriorityHigh;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1157
		else if (strnicmp(aStr, "windowserver",3)==0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1158
			priority=EPriorityWindowServer;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1159
		else if (strnicmp(aStr, "fileserver",4)==0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1160
			priority=EPriorityFileServer;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1161
		else if (strnicmp(aStr, "realtimeserver",4)==0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1162
			priority=EPriorityRealTimeServer;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1163
		else if (strnicmp(aStr, "supervisor",3)==0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1164
			priority=EPrioritySupervisor;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1165
		else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1166
			return Print(EError, "Unrecognised priority keyword.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1167
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1168
	if (priority<EPriorityLow || priority>EPrioritySupervisor)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1169
		return Print(EError, "Priority out of range.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1170
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1171
	aNode->SetPriority( priority );
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1172
	return KErrNone;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1173
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1174
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1175
TInt CObeyFile::SetUid1(TRomNode *aNode, const char* aStr){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1176
	if (EFalse == IsValidNumber(aStr))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1177
		return Print(EError, "Number required as argument for keyword 'uid1'.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1178
	TInt size ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1179
	TInt err = Val(size,aStr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1180
	if(KErrNone == err){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1181
		aNode->SetUid1(size );
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1182
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1183
	return err;		 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1184
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1185
TInt CObeyFile::SetUid2(TRomNode *aNode, const char* aStr) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1186
	if (EFalse == IsValidNumber(aStr))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1187
		return Print(EError, "Number required as argument for keyword 'uid2'.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1188
	TInt size ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1189
	TInt err = Val(size,aStr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1190
	if(KErrNone == err){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1191
		aNode->SetUid2(size );
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1192
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1193
	return err;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1194
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1195
TInt CObeyFile::SetUid3(TRomNode *aNode, const char* aStr) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1196
	if (EFalse == IsValidNumber(aStr))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1197
		return Print(EError, "Number required as argument for keyword 'uid3'.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1198
	TInt size ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1199
	TInt err = Val(size,aStr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1200
	if(KErrNone == err){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1201
		aNode->SetUid3(size );
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1202
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1203
	return err;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1204
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1205
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1206
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1207
// Process any inline keywords
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1208
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1209
TInt CObeyFile::ParseFileAttributes(TRomNode *aNode, TRomBuilderEntry* aFile, enum EKeyword aKeyword) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1210
	TInt currentLine = iReader.CurrentLine();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1211
	enum EFileAttribute attribute;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1212
	TInt r=KErrNone;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1213
	TInt index=3;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1214
	char* arg=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1215
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1216
	while(r==KErrNone) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1217
		r=iReader.NextAttribute(index,(aFile!=0),attribute,arg);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1218
		if (r!=KErrNone)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1219
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1220
		switch(attribute)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1221
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1222
		case EAttributeAtt:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1223
			r=aNode->SetAtt(arg);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1224
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1225
		case EAttributeAttExtra:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1226
			r=aNode->SetAttExtra(arg, aFile, aKeyword);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1227
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1228
		case EAttributeStack:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1229
			r=SetStackSize(aNode, arg);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1230
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1231
		case EAttributeFixed:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1232
			aNode->SetFixed();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1233
			r = KErrNone;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1234
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1235
		case EAttributeUid1:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1236
			r=SetUid1(aNode, arg);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1237
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1238
		case EAttributeUid2:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1239
			r=SetUid2(aNode, arg);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1240
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1241
		case EAttributeUid3:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1242
			r=SetUid3(aNode, arg);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1243
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1244
		case EAttributeHeapMin:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1245
			r=SetHeapSizeMin(aNode, arg);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1246
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1247
		case EAttributeHeapMax:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1248
			r=SetHeapSizeMax(aNode, arg);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1249
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1250
		case EAttributePriority:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1251
			r=SetPriority(aNode, arg);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1252
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1253
		case EAttributeCapability:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1254
			r=SetCapability(aNode, arg);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1255
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1256
		case EAttributeUnpaged:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1257
			aNode->iOverride |= KOverrideCodeUnpaged|KOverrideDataUnpaged;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1258
			aNode->iOverride &= ~(KOverrideCodePaged|KOverrideDataPaged);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1259
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1260
		case EAttributePaged:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1261
			aNode->iOverride |= KOverrideCodePaged;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1262
			aNode->iOverride &= ~(KOverrideCodeUnpaged);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1263
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1264
		case EAttributeUnpagedCode:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1265
			aNode->iOverride |= KOverrideCodeUnpaged;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1266
			aNode->iOverride &= ~KOverrideCodePaged;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1267
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1268
		case EAttributePagedCode:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1269
			aNode->iOverride |= KOverrideCodePaged;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1270
			aNode->iOverride &= ~KOverrideCodeUnpaged;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1271
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1272
		case EAttributeUnpagedData:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1273
			aNode->iOverride |= KOverrideDataUnpaged;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1274
			aNode->iOverride &= ~KOverrideDataPaged;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1275
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1276
		case EAttributePagedData:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1277
			aNode->iOverride |= KOverrideDataPaged;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1278
			aNode->iOverride &= ~KOverrideDataUnpaged;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1279
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1280
		default:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1281
			return Print(EError, "Unrecognised keyword in file attributes on line %d.\n",currentLine);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1282
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1283
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1284
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1285
	if (r==KErrEof)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1286
		return KErrNone;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1287
	return r;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1288
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1289
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1290
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1291
// Process a parsed line to set up one or more new TRomBuilder entry objects.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1292
// iWord[0] = the keyword (file, primary or secondary)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1293
// iWord[1] = the PC pathname
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1294
// iWord[2] = the EPOC pathname
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1295
// iWord[3] = start of the file attributes
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1296
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1297
TBool CObeyFile::ProcessFile(TInt /*aAlign*/, enum EKeyword aKeyword){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1298
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1299
	TBool isPeFile = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1300
	TBool aFileCompressOption, aFileUncompressOption;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1301
	TInt epocPathStart=2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1302
	aFileCompressOption = aFileUncompressOption = EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1303
	TBool warnFlag = EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1304
	static const char aStdPath[] = "SYS\\BIN\\";
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1305
	static const int sysBinLength = sizeof(aStdPath)-1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1306
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1307
	// do some validation of the keyword
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1308
	TInt currentLine = iReader.CurrentLine();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1309
	switch (aKeyword)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1310
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1311
	case EKeywordData:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1312
	case EKeywordHideV2:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1313
		iNumberOfDataFiles++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1314
		isPeFile = EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1315
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1316
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1317
	case EKeywordFile:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1318
		warnFlag = gEnableStdPathWarning;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1319
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1320
	case EKeywordFileCompress:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1321
		aFileCompressOption = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1322
		warnFlag = gEnableStdPathWarning;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1323
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1324
	case EKeywordFileUncompress:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1325
		aFileUncompressOption = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1326
		warnFlag = gEnableStdPathWarning;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1327
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1328
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1329
	default:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1330
		Print(EError,"Unexpected keyword '%s' on line %d.\n",iReader.Word(0),currentLine);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1331
		return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1332
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1333
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1334
	if (aKeyword!=EKeywordHideV2) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1335
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1336
		// check the PC file exists
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1337
		char* nname = NormaliseFileName(iReader.Word(1)); 
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
  1338
		if(gIsOBYUTF8 && !UniConv::IsPureASCIITextStream(nname))
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
  1339
		{
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
  1340
			char* tempnname = strdup(nname);
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
  1341
			unsigned int namelen = 0;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
  1342
			if(UniConv::UTF82DefaultCodePage(tempnname, strlen(tempnname), &nname, &namelen) < 0)
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
  1343
			{
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
  1344
				Print(EError, "Invalid filename encoding: %s\n", tempnname);
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
  1345
				free(tempnname);
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
  1346
				delete[] nname;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
  1347
				return EFalse;
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
  1348
			}
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
  1349
			free(tempnname);
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
  1350
		}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1351
		ifstream test(nname);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1352
		if (!test) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1353
			Print(EError,"Cannot open file %s for input.\n",iReader.Word(1));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1354
			iMissingFiles++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1355
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1356
		test.close();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1357
		delete []nname;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1358
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1359
	else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1360
		epocPathStart=1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1361
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1362
	iNumberOfFiles++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1363
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1364
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1365
	TBool endOfName=EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1366
	const char *epocStartPtr=IsValidFilePath(iReader.Word(epocPathStart));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1367
	char *epocEndPtr=const_cast<char*>(epocStartPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1368
	if (epocStartPtr==NULL) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1369
		Print(EError, "Invalid destination path on line %d\n",currentLine);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1370
		return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1371
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1372
	if(warnFlag){	// Check for the std destination path(for executables) as per platsec.	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1373
		if(strnicmp(aStdPath,epocStartPtr,sysBinLength) != 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1374
			Print(EWarning,"Invalid destination path on line %d. \"%s\" \n",currentLine,epocStartPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1375
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1376
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1377
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1378
	TRomNode* dir=iRootDirectory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1379
	TRomNode* subDir=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1380
	TRomBuilderEntry *file=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1381
	while (!endOfName) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1382
		endOfName = GetNextBitOfFileName(epocEndPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1383
		if (endOfName) {// file		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1384
			TRomNode* alreadyExists=dir->FindInDirectory(epocStartPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1385
			/*
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1386
			* The EKeywordHideV2 keyword is used to indicate that:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1387
			*	1. if the file exists in the same image and then hidden, mark it hidden
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1388
			*	2. if the file exists in another image, but in this (ROFS) image, it is
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1389
			*		required to hide that file, create a 0 length file entry setting the 'hide'
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1390
			*		flag so that at runtime, file gets hidden in the composite filesystem.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1391
			*/
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1392
			if ((aKeyword != EKeywordHideV2) && alreadyExists){ // duplicate file		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1393
				if(gKeepGoing){	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1394
					Print(EWarning, "Duplicate file for %s on line %d, will be ignored\n",iReader.Word(1),iReader.CurrentLine());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1395
					switch (aKeyword)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1396
					{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1397
					case EKeywordData:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1398
					case EKeywordHideV2:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1399
						iNumberOfDataFiles--;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1400
					default:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1401
						break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1402
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1403
					iNumberOfFiles--;	 	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1404
					return ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1405
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1406
				else {					
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1407
					Print(EError, "Duplicate file for %s on line %d\n",iReader.Word(1),iReader.CurrentLine());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1408
					return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1409
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1410
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1411
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1412
			TBool aHidden = aKeyword==EKeywordHideV2;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1413
			/* The file is only marked hidden and hence the source file name isn't known 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1414
			* here as hide statement says :
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1415
			*	hide <filename as in ROM>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1416
			* Therefore, create TRomBuilderEntry with iFileName as 0 for hidden file when
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1417
			* the file doesn't exist in the same ROM image. Otherwise, the src file name
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1418
			* is known because of alreadyExists (which comes from the 'file'/'data' statement).
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1419
			*/
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1420
			if(aHidden)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1421
				file = new TRomBuilderEntry(0, epocStartPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1422
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1423
				file = new TRomBuilderEntry(iReader.Word(1), epocStartPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1424
			file->iExecutable=isPeFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1425
			file->iHidden= aHidden;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1426
			if( aFileCompressOption ){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1427
				file->iCompressEnabled = ECompressionCompress;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1428
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1429
			else if(aFileUncompressOption )	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1430
				file->iCompressEnabled = ECompressionUncompress;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1431
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1432
			TRomNode* node=new TRomNode(epocStartPtr, file);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1433
			if (node==0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1434
				return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1435
			TInt r=ParseFileAttributes(node, file, aKeyword);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1436
			if (r!=KErrNone)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1437
				return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1438
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1439
			dir->AddFile(node);	// to ROFS directory structure
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1440
			AddFile(file);		// to our list of files
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1441
		}		 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1442
		else { // directory		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1443
			subDir = dir->FindInDirectory(epocStartPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1444
			if (!subDir) { // sub directory does not exist			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1445
				subDir = dir->NewSubDir(epocStartPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1446
				if (!subDir)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1447
					return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1448
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1449
			dir=subDir;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1450
			epocStartPtr = epocEndPtr;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1451
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1452
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1453
	return ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1454
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1455
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1456
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1457
TBool CObeyFile::ProcessRenaming(enum EKeyword aKeyword) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1458
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1459
	// find existing file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1460
	TBool endOfName=EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1461
	const char *epocStartPtr=IsValidFilePath(iReader.Word(1));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1462
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1463
	// Store the current name and new name to maintain renamed file map
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1464
	string currentName=iReader.Word(1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1465
	string newName=iReader.Word(2);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1466
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1467
	char *epocEndPtr= const_cast<char*>(epocStartPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1468
	if (epocStartPtr == NULL) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1469
		Print(EError, "Invalid source path on line %d\n",iReader.CurrentLine());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1470
		return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1471
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1472
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1473
	char saved_srcname[257];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1474
	strncpy(saved_srcname, iReader.Word(1),257);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1475
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1476
	TRomNode* dir=iRootDirectory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1477
	TRomNode* existingFile=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1478
	while (!endOfName){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1479
		endOfName = GetNextBitOfFileName(epocEndPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1480
		if (endOfName) { // file
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1481
			existingFile=dir->FindInDirectory(epocStartPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1482
			if (existingFile) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1483
				TInt fileCount=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1484
				TInt dirCount=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1485
				existingFile->CountDirectory(fileCount, dirCount);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1486
				if (dirCount != 0 || fileCount != 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1487
					Print(EError, "Keyword %s not applicable to directories - line %d\n",
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1488
						iReader.Word(0),iReader.CurrentLine());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1489
					return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1490
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1491
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1492
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1493
		else { // directory		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1494
			TRomNode* subDir = dir->FindInDirectory(epocStartPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1495
			if (!subDir) // sub directory does not exist
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1496
				break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1497
			dir=subDir;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1498
			epocStartPtr = epocEndPtr;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1499
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1500
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1501
	if (aKeyword == EKeywordHide) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1502
		/*
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1503
		* The EKeywordHide keyword is used to indicate that if the file exists in 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1504
		* the primary ROFS image and then hidden in extension ROFS, mark it hidden.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1505
		*/
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1506
		if (!existingFile) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1507
			Print(EWarning, "Hiding non-existent file %s on line %d\n", 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1508
				saved_srcname, iReader.CurrentLine());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1509
			// Just a warning, as we've achieved the right overall effect.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1510
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1511
		else if (existingFile->iFileStartOffset==(TUint)KFileHidden){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1512
			Print(EWarning, "Hiding already hidden file %s on line %d\n", 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1513
				saved_srcname, iReader.CurrentLine());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1514
			// We will igrore this request, otherwise it will "undelete" it.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1515
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1516
		else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1517
			//hidden files will not be placed to the image
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1518
			existingFile->iHidden = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1519
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1520
		return ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1521
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1522
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1523
	if (!existingFile) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1524
		Print(EError, "Can't %s non-existent source file %s on line %d\n",
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1525
			iReader.Word(0), saved_srcname, iReader.CurrentLine());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1526
		return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1527
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1528
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1529
	epocStartPtr = IsValidFilePath(iReader.Word(2));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1530
	epocEndPtr = const_cast<char*>(epocStartPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1531
	endOfName = EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1532
	if (epocStartPtr == NULL) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1533
		Print(EError, "Invalid destination path on line %d\n",iReader.CurrentLine());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1534
		return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1535
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1536
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1537
	TRomNode* newdir=iRootDirectory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1538
	while (!endOfName) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1539
		endOfName = GetNextBitOfFileName(epocEndPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1540
		if (endOfName) {// file		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1541
			TRomNode* alreadyExists=newdir->FindInDirectory(epocStartPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1542
			if (alreadyExists && !(alreadyExists->iHidden)) {// duplicate file	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1543
				if(gKeepGoing){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1544
					Print(EWarning, "Duplicate file for %s on line %d, renaming will be skipped\n",saved_srcname,iReader.CurrentLine());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1545
					return ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1546
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1547
				else {							
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1548
					Print(EError, "Duplicate file for %s on line %d\n",saved_srcname,iReader.CurrentLine());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1549
					return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1550
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1551
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1552
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1553
		else { // directory		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1554
			TRomNode* subDir = newdir->FindInDirectory(epocStartPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1555
			if (!subDir) {// sub directory does not exist			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1556
				subDir = newdir->NewSubDir(epocStartPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1557
				if (!subDir)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1558
					return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1559
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1560
			newdir=subDir;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1561
			epocStartPtr = epocEndPtr;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1562
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1563
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1564
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1565
	if (aKeyword == EKeywordRename) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1566
		// rename => remove existingFile and insert into tree at new place
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1567
		// has no effect on the iNextExecutable or iNextNodeForSameFile links
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1568
		TInt r=ParseFileAttributes(existingFile, existingFile->iEntry, aKeyword);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1569
		if (r!=KErrNone)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1570
			return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1571
		existingFile->Rename(dir, newdir, epocStartPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1572
		// Store the current and new name of file in the renamed file map.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1573
		iPatchData->AddToRenamedFileMap(currentName, newName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1574
		return ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1575
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1576
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1577
	// alias => create new TRomNode entry and insert into tree
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1578
	TRomNode* node = new TRomNode(epocStartPtr, 0);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1579
	if (node == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1580
		Print(EError, "Out of memory\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1581
		return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1582
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1583
	node->Alias(existingFile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1584
	TInt r=ParseFileAttributes(node, 0, aKeyword);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1585
	if (r!=KErrNone)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1586
		return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1587
	newdir->AddFile(node);	// to ROFS directory structure, though possibly hidden
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1588
	return ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1589
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1590
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1591
TInt ParsePagingPolicy(const char* policy){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1592
	if(stricmp(policy,"NOPAGING") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1593
		return EKernelConfigPagingPolicyNoPaging;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1594
	else if (stricmp(policy,"ALWAYSPAGE") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1595
		return EKernelConfigPagingPolicyAlwaysPage;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1596
	else if(stricmp(policy,"DEFAULTUNPAGED") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1597
		return EKernelConfigPagingPolicyDefaultUnpaged;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1598
	else if(stricmp(policy,"DEFAULTPAGED") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1599
		return EKernelConfigPagingPolicyDefaultPaged;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1600
	return KErrArgument;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1601
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1602
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1603
TBool CObeyFile::ProcessKeyword(enum EKeyword aKeyword) { 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1604
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1605
	TBool success = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1606
	switch (aKeyword)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1607
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1608
	case EKeywordRofsName:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1609
		iRomFileName = iReader.DupWord(1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1610
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1611
	case EKeywordRofsSize:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1612
		Val(iRomSize,iReader.Word(1));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1613
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1614
	case EKeywordVersion:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1615
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1616
			istringstream val(iReader.Word(1)); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1617
			val >> iVersion;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1618
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1619
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1620
	case EKeywordRofsChecksum:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1621
		Val(iCheckSum,iReader.Word(1));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1622
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1623
	case EKeywordTime:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1624
		iReader.ProcessTime(iTime);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1625
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1626
	case EKeywordPagingOverride:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1627
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1628
			if(iPagingOverrideParsed)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1629
				Print(EWarning, "PagingOverride redefined - previous PagingOverride values lost\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1630
			if(iCodePagingOverrideParsed)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1631
				Print(EWarning, "PagingOverride defined - previous CodePagingOverride values lost\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1632
			iPagingOverrideParsed = true;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1633
			TInt policy = ParsePagingPolicy(iReader.Word(1));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1634
			if(policy < 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1635
				Print(EError,"Unrecognized option for PAGINGOVERRIDE keyword\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1636
				success = false;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1637
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1638
			else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1639
				gCodePagingOverride = policy;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1640
				if((policy == EKernelConfigPagingPolicyNoPaging) || (policy == EKernelConfigPagingPolicyDefaultUnpaged))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1641
					gDataPagingOverride = policy;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1642
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1643
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1644
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1645
	case EKeywordCodePagingOverride:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1646
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1647
			if(iCodePagingOverrideParsed)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1648
				Print(EWarning, "CodePagingOverride redefined - previous CodePagingOverride values lost\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1649
			if(iPagingOverrideParsed)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1650
				Print(EWarning, "CodePagingOverride defined - previous PagingOverride values lost\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1651
			iCodePagingOverrideParsed = true;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1652
			TInt policy = ParsePagingPolicy(iReader.Word(1));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1653
			if(policy<0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1654
			{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1655
				Print(EError,"Unrecognized option for CODEPAGINGOVERRIDE keyword\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1656
				success = false;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1657
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1658
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1659
				gCodePagingOverride = policy;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1660
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1661
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1662
	case EKeywordDataPagingOverride:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1663
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1664
			if(iDataPagingOverrideParsed)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1665
				Print(EWarning, "DataPagingOverride redefined - previous DataPagingOverride values lost\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1666
/*			if(iPagingOverrideParsed){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1667
				Print(EError, "DataPagingOverride defined - previous PagingOverride values lost\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1668
				success = false;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1669
				break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1670
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1671
*/
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1672
			iDataPagingOverrideParsed = true;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1673
			TInt policy = ParsePagingPolicy(iReader.Word(1));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1674
			if(policy < 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1675
				Print(EError,"Unrecognized option for DATAPAGINGOVERRIDE keyword\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1676
				success = false;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1677
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1678
			else
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1679
				gDataPagingOverride = policy;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1680
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1681
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1682
	case EKeywordRofsAutoSize:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1683
		iAutoSize = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1684
		Val(iAutoPageSize,iReader.Word(1));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1685
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1686
	default:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1687
		// unexpected keyword iReader.Word(0)
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 617
diff changeset
  1688
		Print(EWarning, "Unexpected keyword '%s' on line %d.\n",iReader.Word(0),iReader.CurrentLine());
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1689
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1690
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1691
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1692
	return success;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1693
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1694
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1695
// Checks that the obeyfile has supplied enough variables to continue
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1696
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1697
TBool CObeyFile::GotKeyVariables() {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1698
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1699
	TBool retVal=ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1700
	// Mandatory keywords
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1701
	if (iRomFileName == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1702
		Print(EAlways,"The name of the image file has not been supplied.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1703
		Print(EAlways,"Use the keyword \"rofsname\".\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1704
		retVal = EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1705
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1706
	if (iRomSize == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1707
		Print(EAlways,"The size of the image has not been supplied.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1708
		Print(EAlways,"Use the keyword \"rofssize\".\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1709
		retVal = EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1710
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1711
	// Apply defaults as necessary
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1712
	if (iTime == 0)	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1713
		Print(ELog, "No timestamp specified. Using current time...\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1714
		ObeyFileReader::TimeNow(iTime);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1715
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1716
	Print(ELog, "\nCreating Rofs image %s\n", iRomFileName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1717
	return retVal;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1718
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1719
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1720
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1721
// Check the path is valid
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1722
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1723
const char* CObeyFile::IsValidFilePath(const char* aPath) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1724
	// skip leading "\"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1725
	if (*aPath == '/' || *aPath == '\\')
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1726
		aPath++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1727
	if (*aPath == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1728
		return NULL; // file ends in a backslash
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1729
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1730
	const char *p = aPath;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1731
	TInt len=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1732
	while(*p) {			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1733
		if (*p == '/' || *p == '\\') {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1734
			if (len == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1735
				return NULL;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1736
			len=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1737
			p++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1738
			continue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1739
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1740
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1741
		len++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1742
		p++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1743
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1744
	return (len ? aPath : NULL);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1745
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1746
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1747
const char* CObeyFile::IsValidDirPath(const char* aPath)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1748
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1749
	const char* walker = aPath;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1750
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1751
	//validate path...
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1752
	while(*walker)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1753
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1754
		if(((*walker=='/') || (*walker=='\\')) && ((*(walker+1)=='/') || (*(walker+1)=='\\')))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1755
			return (const char*)0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1756
		walker++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1757
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1758
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1759
	if((*aPath=='/') || (*aPath=='\\'))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1760
		aPath++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1761
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1762
	return aPath;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1763
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1764
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1765
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1766
// Move the end pointer past the next directory separator, replacing it with 0
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1767
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1768
TBool CObeyFile::GetNextBitOfFileName(char*& epocEndPtr) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1769
	while (*epocEndPtr != '/' && *epocEndPtr != '\\'){ // until reach the directory separator		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1770
		if (*epocEndPtr == 0) // if reach end of string, return TRUE, it's the filename
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1771
			return ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1772
		epocEndPtr++;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1773
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1774
	*epocEndPtr = 0; // overwrite the directory separator with a 0
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1775
	epocEndPtr++; // point past the 0 ready for the next one
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1776
	return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1777
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1778
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1779
void CObeyFile::AddFile(TRomBuilderEntry* aFile) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1780
	*iNextFilePtrPtr = aFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1781
	iNextFilePtrPtr = &(aFile->iNext);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1782
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1783
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1784
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1785
// First pass through the obey file to set up key variables
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1786
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1787
TInt CObeyFile::ProcessExtensionRofs(MRofsImage* aKernelRom) { 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1788
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1789
	iReader.Rewind();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1790
	enum EKeyword keyword;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1791
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1792
	// Deal with the "extensionrofs" keyword, which should be first
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1793
	// however, you may've found "time" before it.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1794
	while(iReader.NextLine(1,keyword) != KErrEof) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1795
		if(EKeywordExtensionRofs == keyword)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1796
			break ;		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1797
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1798
	if(EKeywordExtensionRofs != keyword) return KErrEof;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1799
	iRomFileName = iReader.DupWord(1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1800
	Print(ELog, "\n========================================================\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1801
	Print(ELog, "Extension ROFS %s starting at line %d\n\n", iRomFileName, iReader.CurrentLine());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1802
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1803
	iReader.MarkNext();		// so that we rewind to the line after the extensionrom keyword
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1804
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1805
	while (iReader.NextLine(1,keyword) != KErrEof) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1806
		if (keyword == EKeywordExtensionRofs)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1807
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1808
		ProcessExtensionKeyword(keyword);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1809
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1810
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1811
	if (!GotExtensionVariables(aKernelRom))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1812
		return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1813
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1814
	// second pass to process the file specifications in the obey file building
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1815
	// up the TRomNode directory structure and the TRomBuilderEntry list
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1816
	//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1817
	iReader.Rewind();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1818
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1819
	//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1820
	if (aKernelRom == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1821
		return Print(EError, "Option to extend a kernel ROFS image not yet implemented\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1822
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1823
	iRootDirectory = new TRomNode("");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1824
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1825
	iLastExecutable = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1826
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1827
	(aKernelRom->RootDirectory())->deleteTheFirstNode();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1828
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1829
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1830
	iRootDirectory = aKernelRom->CopyDirectory(iLastExecutable);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1831
	aKernelRom->SetRootDirectory(iRootDirectory);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1832
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1833
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1834
	TInt align=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1835
	while (iReader.NextLine(2,keyword)!=KErrEof) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1836
		if (keyword == EKeywordExtensionRofs)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1837
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1838
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1839
		switch (keyword)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1840
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1841
		case EKeywordHide:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1842
		case EKeywordAlias:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1843
		case EKeywordRename:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1844
			if (!ProcessRenaming(keyword))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1845
				return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1846
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1847
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1848
		case EKeywordPatchDllData:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1849
			{	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1850
				// Collect patchdata statements to process at the end
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1851
				StringVector patchDataTokens;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1852
				SplitPatchDataStatement(patchDataTokens); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1853
				iPatchData->AddPatchDataStatement(patchDataTokens);									
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1854
				break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1855
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1856
		default:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1857
			if (!ProcessFile(align, keyword))
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1858
				return KErrGeneral;			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1859
			align=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1860
			break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1861
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1862
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1863
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1864
	if(!ParsePatchDllData() )
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1865
		return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1866
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1867
	iReader.MarkNext();			// ready for processing the next extension rom(s)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1868
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1869
	if (iMissingFiles!=0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1870
		return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1871
	if (iNumberOfFiles == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1872
		Print(EError, "No files specified.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1873
		return KErrGeneral;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1874
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1875
	return KErrNone;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1876
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1877
void CObeyFile::ProcessExtensionKeyword(enum EKeyword aKeyword)	{ 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1878
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1879
	switch (aKeyword)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1880
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1881
	case EKeywordCoreRofsName:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1882
		iKernelRofsName = iReader.DupWord(1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1883
		return;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1884
	case EKeywordRofsSize:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1885
		Val(iRomSize,iReader.Word(1));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1886
		return;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1887
	case EKeywordVersion:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1888
		{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1889
			istringstream val(iReader.Word(1)); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1890
			val >> iVersion;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1891
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1892
		return;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1893
	case EKeywordRomChecksum:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1894
		Val(iCheckSum,iReader.Word(1)); //--
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1895
		return;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1896
	case EKeywordTime:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1897
		iReader.ProcessTime(iTime);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1898
		return;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1899
	case EKeywordRofsAutoSize:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1900
		iAutoSize = ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1901
		Val(iAutoPageSize , iReader.Word(1)); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1902
		return;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1903
	default:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1904
		Print(EError,"Keyword '%s' not valid in extension ROFS - line %d\n", iReader.Word(0), iReader.CurrentLine());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1905
		break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1906
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1907
	return;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1908
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1909
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1910
// Checks that the obeyfile has supplied enough variables to continue
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1911
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1912
TBool CObeyFile::GotExtensionVariables(MRofsImage* aRom) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1913
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1914
	TBool retVal=ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1915
	const char* kernelRofsName = iKernelRofsName;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1916
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1917
	// Mandatory keywords
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1918
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1919
	if (iRomSize == 0){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1920
		Print(EAlways,"The size of the extension ROFS has not been supplied.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1921
		Print(EAlways,"Use the keyword \"rofssize\".\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1922
		retVal = EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1923
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1924
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1925
	// keywords we need if we don't already have a ROFS image to work from
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1926
	if (aRom == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1927
		if (iKernelRofsName == 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1928
			Print(EAlways,"The name of the core ROFS has not been supplied.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1929
			Print(EAlways,"Use the keyword \"rofsname\".\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1930
			retVal = EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1931
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1932
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1933
	else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1934
		if (iKernelRofsName != 0){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1935
			Print(EWarning,"Keyword \"rofsname\" ignored.\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1936
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1937
		kernelRofsName = aRom->RomFileName();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1938
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1939
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1940
	// validation
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1941
	// Apply defaults as necessary
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1942
	if (iTime == 0)	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1943
		Print(ELog, "No timestamp specified. Using current time...\n");
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1944
		ObeyFileReader::TimeNow(iTime);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1945
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1946
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1947
	// fix up "*" in rofsname
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1948
	char newname[256];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1949
	char* p=newname;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1950
	char* q=iRomFileName;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1951
	char c;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1952
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1953
	while ((c=*q++)!='\0'){
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1954
		if (c!='*') {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1955
			*p++=c;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1956
			continue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1957
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1958
		const char *r = kernelRofsName;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1959
		while ((c=*r++)!='\0')
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1960
			*p++=c;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1961
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1962
	*p++ = '\0';
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1963
	delete []iRomFileName;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1964
	size_t len = p - newname ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1965
	iRomFileName = new char[len];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1966
	memcpy(iRomFileName,newname,len);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1967
	Print(ELog, "\nCreating ROFS image %s\n", iRomFileName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1968
	return retVal;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1969
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1970
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1971
// Fuction to split patchdata statement 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1972
void CObeyFile::SplitPatchDataStatement(StringVector& aPatchDataTokens) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1973
	// Get the value of symbol size, address/ordinal and new value 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1974
	// to be patched from the patchdata statement.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1975
	// Syntax of patchdata statements is as follows:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1976
	// 1)	patchdata dll_name  ordinal OrdinalNumber size_in_bytes   new_value 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1977
	// 2)   patchdata dll_name  addr    Address       size_in_bytes   new_value
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1978
	for(TInt count=1; count<=5; count++) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1979
		aPatchDataTokens.push_back(iReader.Word(count));
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1980
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1981
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1982
	// Store the the value of current line which will be used
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1983
	// when displaying error messages.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1984
	ostringstream outStrStream;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1985
	outStrStream<<iReader.CurrentLine();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1986
	aPatchDataTokens.push_back(outStrStream.str());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1987
}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1988
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1989
TBool CObeyFile::ParsePatchDllData() {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1990
	// Get the list of patchdata statements
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1991
	VectorOfStringVector patchDataStatements=iPatchData->GetPatchDataStatements();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1992
	// Get the list of renamed file map
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1993
	MapOfString RenamedFileMap=iPatchData->GetRenamedFileMap();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1994
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1995
	for(TUint count=0; count < patchDataStatements.size(); count++) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1996
		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1997
		StringVector strVector = patchDataStatements.at(count);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1998
		string filename=strVector.at(0);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  1999
		string lineNoStr = strVector.at(5);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2000
		TUint lineNo = 0 ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2001
		Val(lineNo,lineNoStr.c_str());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2002
		TRomNode* existingFile = NULL;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2003
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2004
		do {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2005
			TRomNode* dir=iRootDirectory;			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2006
			TBool endOfName=EFalse; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2007
			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2008
			if (!IsValidFilePath(filename.c_str())) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2009
				Print(EError, "Invalid source path on line %d\n",lineNo);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2010
				return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2011
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2012
			char* epocStartPtr =NormaliseFileName(filename.c_str());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2013
			char* savedPtr = epocStartPtr;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2014
			if(*epocStartPtr == '/' ||*epocStartPtr == '\\')
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2015
				epocStartPtr++ ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2016
			char* epocEndPtr = epocStartPtr;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2017
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2018
			while (!endOfName) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2019
				endOfName = GetNextBitOfFileName(epocEndPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2020
				if (endOfName) {// file				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2021
					existingFile=dir->FindInDirectory(epocStartPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2022
					if (existingFile) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2023
						TInt fileCount=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2024
						TInt dirCount=0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2025
						existingFile->CountDirectory(fileCount, dirCount);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2026
						if (dirCount != 0 || fileCount != 0) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2027
							Print(EError, "Keyword %s not applicable to directories - line %d\n","patchdata",lineNo);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2028
							return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2029
						}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2030
					}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2031
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2032
				else {// directory				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2033
					TRomNode* subDir = dir->FindInDirectory(epocStartPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2034
					if (!subDir) // sub directory does not exist
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2035
						break;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2036
					dir=subDir;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2037
					epocStartPtr = epocEndPtr;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2038
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2039
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2040
			delete []savedPtr;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2041
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2042
			if(!existingFile) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2043
				// If the E32Image file to be patched is not included then check if the
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2044
				// file was renamed.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2045
				MapOfStringIterator RenamedFileMapIterator;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2046
				if ((RenamedFileMapIterator=RenamedFileMap.find(filename)) != RenamedFileMap.end())
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2047
					filename = (*RenamedFileMapIterator).second; 				
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2048
				else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2049
					Print(EError, "File %s not found - line %d\n", filename.c_str(), lineNo);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2050
					return EFalse;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2051
				}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2052
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2053
		}while(!existingFile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2054
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2055
		TUint32 aSize, aOrdinal, aNewValue, aOffset;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2056
		TLinAddr aDataAddr;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2057
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2058
		aOrdinal = (TUint32)-1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2059
		aDataAddr = (TUint32)-1;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2060
		aOffset = 0;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2061
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2062
		string symbolSize=strVector.at(3);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2063
		Val(aSize,symbolSize.c_str());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2064
		string aValue=strVector.at(4);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2065
		Val(aNewValue,aValue.c_str());		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2066
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2067
		DllDataEntry *dataEntry = new DllDataEntry(aSize, aNewValue);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2068
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2069
		// Set the address of the data or the ordinal number specified in OBY statement.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2070
		string keyword=strVector.at(1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2071
		string keywordValue=strVector.at(2);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2072
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2073
		/* Check for +OFFSET at the end of the ordinal number or address */
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2074
		TUint plus = keywordValue.find("+",0);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2075
		if (plus != string::npos) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2076
			/* Get the offset that we found after the + sign */
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2077
			string offset = keywordValue.substr(plus+1);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2078
			Val(aOffset,offset.c_str());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2079
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2080
			keywordValue.resize(plus);		
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2081
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2082
		if(stricmp (keyword.c_str(), "addr") == 0)
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2083
			Val(aDataAddr,keywordValue.c_str());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2084
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2085
		else 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2086
			Val(aOrdinal,keywordValue.c_str());
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2087
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2088
		dataEntry->iDataAddress = aDataAddr;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2089
		dataEntry->iOrdinal = aOrdinal;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2090
		dataEntry->iOffset = aOffset;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2091
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2092
		existingFile->SetDllData();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2093
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2094
		DllDataEntry *aDllDataEntry= existingFile->iEntry->GetFirstDllDataEntry();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2095
		if (aDllDataEntry == NULL) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2096
			// Set the first node of the patchdata linked list
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2097
			aDllDataEntry=dataEntry;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2098
			existingFile->iEntry->SetFirstDllDataEntry(aDllDataEntry);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2099
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2100
		else {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2101
			// Goto the last node
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2102
			while((aDllDataEntry->NextDllDataEntry()) != NULL) {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2103
				aDllDataEntry = aDllDataEntry->NextDllDataEntry();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2104
			}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2105
			// Add the new node at the end of linked list
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2106
			aDllDataEntry->AddDllDataEntry(dataEntry);			
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2107
		}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2108
	}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2109
	return ETrue;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
  2110
}