65 #define _stricmp strcasecmp |
65 #define _stricmp strcasecmp |
66 #define strnicmp strncasecmp |
66 #define strnicmp strncasecmp |
67 |
67 |
68 // to fix the linux problem: memcpy does not work with overlapped areas. |
68 // to fix the linux problem: memcpy does not work with overlapped areas. |
69 #define memcpy memmove |
69 #define memcpy memmove |
70 |
70 #define SLASH_CHAR '/' |
71 // hand-rolled strupr function for converting a string to all uppercase |
71 // hand-rolled strupr function for converting a string to all uppercase |
72 char* strupr(char *a); |
72 char* strupr(char *a); |
73 |
73 |
74 // return the length of a file |
74 // return the length of a file |
75 off_t filelength (int filedes); |
75 off_t filelength (int filedes); |
|
76 #else |
|
77 #define SLASH_CHAR '\\' |
76 #endif |
78 #endif |
77 |
79 |
78 |
80 |
79 #include <e32cmn.h> |
81 #include <e32cmn.h> |
80 #include <e32def.h> |
82 #include <e32def.h> |
94 const TInt KMaxStringLength=0x400; |
96 const TInt KMaxStringLength=0x400; |
95 // |
97 // |
96 class HFile |
98 class HFile |
97 { |
99 { |
98 public: |
100 public: |
99 static TBool Open(const TText * const aFileName, TInt32 * const aFileHandle); |
101 static TBool Open(const char* aFileName, TInt32 * const aFileHandle); |
100 static TBool Read(const TInt32 aFileHandle, TAny * const aBuffer, const TUint32 aCount); |
102 static TBool Read(const TInt32 aFileHandle, TAny * const aBuffer, const TUint32 aCount); |
101 static TBool Seek(const TInt32 aFileHandle, const TUint32 aOffset); |
103 static TBool Seek(const TInt32 aFileHandle, const TUint32 aOffset); |
102 static TUint32 GetPos(const TInt32 aFileHandle); |
104 static TUint32 GetPos(const TInt32 aFileHandle); |
103 static TAny Close(const TInt32 aFileHandle); |
105 static TAny Close(const TInt32 aFileHandle); |
104 static TUint32 GetLength(const TInt32 aFileHandle); |
106 static TUint32 GetLength(const TInt32 aFileHandle); |
105 static TUint32 GetLength(TText *aName); |
107 static TUint32 GetLength(const char* aName); |
106 static TUint32 Read(TText *aName, TAny *someMem); |
108 static TUint32 Read(const char* aName, TAny *someMem); |
107 }; |
109 }; |
108 // |
110 // |
109 //inline TAny* operator new(TUint /*aSize*/, TAny* aBase) |
111 //inline TAny* operator new(TUint /*aSize*/, TAny* aBase) |
110 // {return aBase;} |
112 // {return aBase;} |
111 |
113 |
131 // |
133 // |
132 class HPrint |
134 class HPrint |
133 { |
135 { |
134 public: |
136 public: |
135 ~HPrint(); |
137 ~HPrint(); |
136 void SetLogFile(TText *aFileName); |
138 void SetLogFile(const char* aFileName); |
137 void CloseLogFile(); // Added to close intermediate log files. |
139 void CloseLogFile(); // Added to close intermediate log files. |
138 TInt PrintString(TPrintType aType,const char *aFmt,...); |
140 TInt PrintString(TPrintType aType,const char *aFmt,...); |
139 public: |
141 public: |
140 TText iText[KMaxStringLength]; |
142 char iText[KMaxStringLength]; |
141 TBool iVerbose; |
143 TBool iVerbose; |
142 private: |
144 private: |
143 ofstream iLogFile; |
145 ofstream iLogFile; |
144 }; |
146 }; |
145 // |
147 // |
161 void ByteSwap(TUint16 &aVal); |
163 void ByteSwap(TUint16 &aVal); |
162 void ByteSwap(TUint *aPtr, TInt aSize); |
164 void ByteSwap(TUint *aPtr, TInt aSize); |
163 |
165 |
164 extern TBool gLittleEndian; |
166 extern TBool gLittleEndian; |
165 |
167 |
166 |
|
167 /** |
168 /** |
168 Convert string to number. |
169 Convert string to number. |
169 */ |
170 */ |
170 template <class T> |
171 template <class T> |
171 TInt Val(T& aVal, char* aStr) |
172 TInt Val(T& aVal, const char* aStr) |
172 { |
173 { |
173 |
174 |
174 T x; |
175 T x; |
175 #ifdef __TOOLS2__ |
176 #ifdef __TOOLS2__ |
176 istringstream val(aStr); |
177 istringstream val(aStr); |
177 #else |
178 #else |
178 istrstream val(aStr,strlen(aStr)); |
179 istrstream val((char*)aStr,strlen(aStr)); |
179 #endif |
180 #endif |
180 #if defined(__MSVCDOTNET__) || defined (__TOOLS2__) |
181 #if defined(__MSVCDOTNET__) || defined (__TOOLS2__) |
181 val >> setbase(0); |
182 val >> setbase(0); |
182 #endif //__MSVCDOTNET__ |
183 #endif //__MSVCDOTNET__ |
183 val >> x; |
184 val >> x; |
184 if (!val.eof() || val.fail()) |
185 if (!val.eof() || val.fail()) |
185 return KErrGeneral; |
186 return KErrGeneral; |
186 aVal=x; |
187 aVal=x; |
187 return KErrNone; |
188 return KErrNone; |
188 } |
189 } |
189 |
190 |
190 // Filename decompose routines |
191 // Filename decompose routines |
191 enum TDecomposeFlag |
192 enum TDecomposeFlag |
192 { |
193 { |
193 EUidPresent=1, |
194 EUidPresent=1, |
194 EVerPresent=2 |
195 EVerPresent=2 |
210 |
210 |
211 extern char* NormaliseFileName(const char* aName); |
211 extern char* NormaliseFileName(const char* aName); |
212 extern char* SplitFileName(const char* aName, TUint32& aUid, TUint32& aModuleVersion, TUint32& aFlags); |
212 extern char* SplitFileName(const char* aName, TUint32& aUid, TUint32& aModuleVersion, TUint32& aFlags); |
213 extern char* SplitFileName(const char* aName, TUint32& aModuleVersion, TUint32& aFlags); |
213 extern char* SplitFileName(const char* aName, TUint32& aModuleVersion, TUint32& aFlags); |
214 extern TInt ParseCapabilitiesArg(SCapabilitySet& aCapabilities, const char *aText); |
214 extern TInt ParseCapabilitiesArg(SCapabilitySet& aCapabilities, const char *aText); |
215 extern TInt ParseBoolArg(TBool& aValue, const char *aText); |
215 extern TInt ParseBoolArg(TBool& aValue, const char *aText); |
216 |
216 extern TBool IsValidNumber(const char* aStr); |
217 #endif |
217 |
218 |
218 #endif |
|
219 |