imgtools/romtools/rofsbuild/r_obey.h
author Ross Qin <ross.qin@nokia.com>
Tue, 02 Nov 2010 09:31:04 +0800
changeset 671 ff8ff850b0cf
parent 654 7c11c3d8d025
permissions -rw-r--r--
fix the Serious problem with ROFS on-disk format
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
* OBY file reader and processing class Definition.
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
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    21
#ifndef __R_OBEY_H__
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    22
#define __R_OBEY_H__
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    23
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    24
#define __REFERENCE_CAPABILITY_NAMES__
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    25
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    26
#include <stdio.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    27
#include <e32capability.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    28
#include <kernel/kernboot.h>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    29
#include "fatdefines.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    30
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    31
#include <vector>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    32
#include <map>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    33
#include <fstream>
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    34
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    35
using namespace std;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    36
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    37
const TUint32 KNumWords=16;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    38
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    39
const TInt KDefaultRomSize=0x400000;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    40
const TInt KDefaultRomAlign=0x10;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    41
//
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    42
typedef vector<string> StringVector ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    43
typedef map<string, StringVector> KeywordMap;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    44
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    45
enum EKeyword
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    46
{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    47
	EKeywordNone=0,	// backwards compatibility, but now ignored
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    48
	EKeywordFile,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    49
	EKeywordData,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    50
	EKeywordDir,
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
    51
	EKeywordDirCpy,
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    52
	EKeywordRofsName,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    53
	EKeywordExtensionRofs, 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    54
	EKeywordCoreRofsName,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    55
	EKeywordRomSize,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    56
	EKeywordAlias,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    57
	EKeywordHide,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    58
	EKeywordRename,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    59
	EKeywordRofsSize,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    60
	EKeywordRofsChecksum,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    61
	EKeywordVersion,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    62
	EKeywordTime,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    63
	EKeywordRomChecksum,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    64
	EKeywordTrace,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    65
	EKeywordCoreImage,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    66
	EKeywordRofsAutoSize,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    67
	EKeywordFileCompress,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    68
	EKeywordFileUncompress,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    69
	EKeywordHideV2,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    70
	EKeywordPatchDllData,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    71
	EKeywordPagingOverride,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    72
	EKeywordCodePagingOverride,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    73
	EKeywordDataPagingOverride,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    74
	// Added to support data drive images.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    75
	EKeywordDataImageName,    
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    76
	EKeywordDataImageFileSystem, 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    77
	EKeywordDataImageSize,
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
    78
	EKeywordDataImageVolumeID,
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    79
	EKeywordDataImageVolume,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    80
	EKeywordDataImageSectorSize,
626
ac03b93ca9c4 ROM Tools 12.3.4 + RCOMP 8.4.2
Zheng Shen <zheng.shen@nokia.com>
parents: 607
diff changeset
    81
	EKeywordDataImageClusterSize,
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    82
	EKeywordDataImageNoOfFats,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    83
	EKeywordSmrImageName,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    84
	EKeywordSmrFileData,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    85
	EKeywordSmrFormatVersion,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    86
	EKeywordSmrFlags,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    87
	EKeywordSmrUID
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    88
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    89
};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    90
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    91
enum EFileAttribute {
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    92
	EAttributeAtt,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    93
	EAttributeAttExtra,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    94
//	EAttributeCompress,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    95
	EAttributeStack,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    96
	EAttributeFixed,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    97
	EAttributePriority,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    98
	EAttributeUid1,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
    99
	EAttributeUid2,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   100
	EAttributeUid3,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   101
	EAttributeHeapMin,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   102
	EAttributeHeapMax,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   103
	EAttributeCapability,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   104
	EAttributeUnpaged,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   105
	EAttributePaged,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   106
	EAttributeUnpagedCode,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   107
	EAttributePagedCode,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   108
	EAttributeUnpagedData,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   109
	EAttributePagedData,
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   110
	};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   111
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   112
#include "r_romnode.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   113
#include "r_rofs.h"
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   114
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   115
class MRofsImage;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   116
 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   117
struct ObeyFileKeyword
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   118
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   119
	const char* iKeyword;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   120
	size_t iKeywordLength;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   121
	TInt iPass;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   122
	TInt iNumArgs;		// -ve means >= number
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   123
	enum EKeyword iKeywordEnum;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   124
	const char* iHelpText;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   125
	};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   126
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   127
struct FileAttributeKeyword
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   128
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   129
	const char* iKeyword;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   130
	size_t iKeywordLength;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   131
	TInt iIsFileAttribute;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   132
	TInt iNumArgs;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   133
	enum EFileAttribute iAttributeEnum;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   134
	const char* iHelpText;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   135
	};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   136
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   137
class ObeyFileReader
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   138
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   139
public:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   140
	ObeyFileReader(const char *aFileName);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   141
	~ObeyFileReader();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   142
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   143
	static void KeywordHelp();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   144
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   145
	TBool Open();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   146
	void Mark();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   147
	void MarkNext();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   148
	void Rewind();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   149
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   150
	TInt NextLine(TInt aPass, enum EKeyword& aKeyword);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   151
	TInt NextAttribute(TInt& aIndex, TInt aHasFile, enum EFileAttribute& aKeyword, char*& aArg);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   152
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   153
	char* DupWord(TInt aIndex) const;				// allocate copy of nth word
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   154
	TInt Count() const { return iNumWords;}				// number of words on current line
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   155
	const char* Word(TInt aIndex) const { return iWord[aIndex]; }	// return nth word as char* 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   156
	const char* Suffix() const { return iSuffix; } 			// return unmatched suffix of word[0]
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   157
	TInt CurrentLine() const { return iCurrentLine;}				// number of words on current line
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   158
	const char* GetCurrentObeyStatement() const {return iCurrentObeyStatement;}						// return current obey statement
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   159
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   160
	void ProcessTime(TInt64& aTime);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   161
	static void TimeNow(TInt64& aTime);
654
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   162
	inline static TBool IsGap(char ch) {
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   163
		return (ch==' ' || ch=='=' || ch=='\t');
7c11c3d8d025 romtools 13.2.0.1
Zheng Shen <zheng.shen@nokia.com>
parents: 647
diff changeset
   164
	}
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   165
private:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   166
	TInt ReadAndParseLine(); 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   167
	TInt Parse();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   168
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   169
	static const ObeyFileKeyword iKeywords[];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   170
	static const FileAttributeKeyword iAttributeKeywords[];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   171
	static TInt64 iTimeNow;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   172
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   173
private:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   174
	TInt iCurrentLine; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   175
	StringVector iLines ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   176
	string iFileName;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   177
	TInt iNumWords;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   178
	char* iLine;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   179
	TInt iMarkLine ;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   180
	char* iCurrentObeyStatement;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   181
	char iSuffix[80];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   182
	char* iWord[KNumWords];
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   183
	};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   184
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   185
class CPatchDataProcessor;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   186
// Configurable FAT attributes
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   187
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   188
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   189
class CObeyFile
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   190
	{
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   191
public:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   192
	char* iRomFileName;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   193
	char* iExtensionRofsName;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   194
	char* iKernelRofsName;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   195
	TInt iRomSize;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   196
	TVersion iVersion;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   197
	TUint32 iCheckSum;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   198
	TInt iNumberOfFiles;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   199
	TInt64 iTime;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   200
	TRomNode* iRootDirectory;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   201
	TInt iNumberOfDataFiles;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   202
	// Added to support Data Drive Images.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   203
	char* iDriveFileName; 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   204
	char* iDriveFileFormat;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   205
	ConfigurableFatAttributes iConfigurableFatAttributes;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   206
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   207
private:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   208
	ObeyFileReader& iReader;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   209
	TInt iMissingFiles;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   210
	TRomNode* iLastExecutable;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   211
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   212
	TRomBuilderEntry* iFirstFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   213
	TRomBuilderEntry** iNextFilePtrPtr;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   214
	TRomBuilderEntry* iCurrentFile;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   215
	KeywordMap iKeyValues;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   216
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   217
public:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   218
	CObeyFile(ObeyFileReader& aReader);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   219
	~CObeyFile();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   220
	void Release();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   221
	TInt ProcessRofs();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   222
	TInt ProcessExtensionRofs(MRofsImage* info);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   223
	TInt ProcessDataDrive();		//	Process the data drive obey file.
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   224
	TRomBuilderEntry *FirstFile();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   225
	TRomBuilderEntry *NextFile();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   226
	char* ProcessCoreImage() const;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   227
	void SkipToExtension();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   228
	TBool AutoSize() const {return iAutoSize ;}
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   229
	TUint32 AutoPageSize() const {return iAutoPageSize;} 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   230
	TBool Process();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   231
 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   232
	StringVector getValues(const string& aKey);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   233
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   234
private:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   235
	TBool ProcessFile(TInt aAlign, enum EKeyword aKeyword);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   236
	TBool ProcessDriveFile(enum EKeyword aKeyword);               
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   237
	TBool ProcessRenaming(enum EKeyword aKeyword);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   238
	TBool ProcessKeyword(enum EKeyword aKeyword);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   239
	TBool ProcessDriveKeyword(enum EKeyword aKeyword);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   240
	void ProcessExtensionKeyword(enum EKeyword aKeyword);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   241
	TInt ParseFileAttributes(TRomNode* aNode, TRomBuilderEntry* aFile, enum EKeyword aKeyword);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   242
	TInt ParseSection();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   243
	TBool ParsePatchDllData();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   244
	TBool GotKeyVariables();
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   245
	TBool GotKeyDriveVariables();			// To check the data drive mandatory variables. 
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   246
	TBool GotExtensionVariables(MRofsImage* aRom);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   247
	void AddFile(TRomBuilderEntry* aFile);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   248
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   249
	TInt SetStackSize(TRomNode* aNode, const char *aStr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   250
	TInt SetHeapSizeMin(TRomNode* aNode, const char *aStr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   251
	TInt SetHeapSizeMax(TRomNode* aNode, const char *aStr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   252
	TInt SetCapability(TRomNode* aNode, const char *aStr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   253
	TInt SetUid1(TRomNode* aNode, const char *aStr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   254
	TInt SetUid2(TRomNode* aNode, const char *aStr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   255
	TInt SetUid3(TRomNode* aNode, const char *aStr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   256
	TInt SetPriority(TRomNode* aNode, const char *aStr);
647
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
   257
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
   258
	TRomNode* AddFileToNodeTree(enum EKeyword aKeyword, TRomNode* dir, const char* filename, const char* aPCSidename, const TBool aParseAttr, TBool aFileCompressOption = EFalse, TBool aFileUncompressOption = EFalse);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
   259
	TRomNode* AddDirToNodeTree(enum EKeyword aKeyword, TRomNode* dir, const char* dirname);
53d1ab72f5bc ROM Tools 13.1.0.4
Zheng Shen <zheng.shen@nokia.com>
parents: 626
diff changeset
   260
	TBool CreateFromFolder(const char* aPath,TRomNode* aParent);
606
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   261
	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   262
	static TBool GetNextBitOfFileName(char*& epocEndPtr);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   263
	static const char *IsValidFilePath(const char *aPath);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   264
	static const char* IsValidDirPath(const char* aPath);
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   265
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   266
	TBool iAutoSize;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   267
	TUint32 iAutoPageSize;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   268
	TBool iPagingOverrideParsed;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   269
	TBool iCodePagingOverrideParsed;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   270
	TBool iDataPagingOverrideParsed;
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   271
public:
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   272
	CPatchDataProcessor* iPatchData;	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   273
	void SplitPatchDataStatement(StringVector& aPatchDataTokens);	
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   274
	};
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   275
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   276
30b30f9da0b7 Add ..\dev\.. to path
jjkang
parents: 0
diff changeset
   277
#endif