0
|
1 |
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
|
|
2 |
// All rights reserved.
|
|
3 |
// This component and the accompanying materials are made available
|
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
|
5 |
// which accompanies this distribution, and is available
|
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
7 |
//
|
|
8 |
// Initial Contributors:
|
|
9 |
// Nokia Corporation - initial contribution.
|
|
10 |
//
|
|
11 |
// Contributors:
|
|
12 |
//
|
|
13 |
// Description:
|
|
14 |
// e32\euser\us_exec.cpp
|
|
15 |
//
|
|
16 |
//
|
|
17 |
|
|
18 |
#include "us_std.h"
|
|
19 |
#include "us_data.h"
|
|
20 |
#include <e32des8_private.h>
|
|
21 |
#include <e32kpan.h>
|
|
22 |
#include <unicode.h>
|
|
23 |
#include <videodriver.h>
|
|
24 |
#include "CompareImp.h"
|
|
25 |
#include <e32atomics.h>
|
|
26 |
|
|
27 |
#include "locmapping.h"
|
|
28 |
|
|
29 |
#ifdef __VC32__
|
|
30 |
#pragma setlocale("english")
|
|
31 |
#endif
|
|
32 |
|
|
33 |
_LIT(KLitSpace, " ");
|
|
34 |
_LIT(KLitOpeningBracket, "(");
|
|
35 |
_LIT(KLitMinusSign, "-");
|
|
36 |
_LIT(KLitZeroPad, "0");
|
|
37 |
|
|
38 |
#ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
|
|
39 |
_LIT(KFindLan, "elocl_lan.");
|
|
40 |
_LIT(KFindReg, "elocl_reg.");
|
|
41 |
_LIT(KFindCol, "elocl_col.");
|
|
42 |
_LIT(KLoc, "elocl.");
|
|
43 |
#endif
|
|
44 |
|
|
45 |
// Private use area ranges of printable/non-printable characters.
|
|
46 |
// This is a sorted list of numbers indicating the ranges in which characters
|
|
47 |
// are printable and non-printable. The elements 0, 2, 4... are the first
|
|
48 |
// characters of printable ranges and The elements 1, 3, 5... are the first
|
|
49 |
// characters of non-printable ranges
|
|
50 |
// We will assume that anything in the End User Sub-area is printable.
|
|
51 |
static const TInt PUAPrintableRanges[] =
|
|
52 |
{
|
|
53 |
0xE000, 0xF6D9, // End user area + unassigned corporate use area
|
|
54 |
0xF6DB, 0xF6DC, // Replacement for character not in font
|
|
55 |
0xF6DE, 0xF700, // various EIKON and Agenda symbols
|
|
56 |
0x10000, KMaxTInt // everything else printable
|
|
57 |
};
|
|
58 |
|
|
59 |
static TBool IsPUAPrintable(TInt aChar)
|
|
60 |
{
|
|
61 |
if (0x110000 <= aChar)
|
|
62 |
return 0; // non-characters not printable
|
|
63 |
TInt i = 0;
|
|
64 |
while (PUAPrintableRanges[i] <= aChar)
|
|
65 |
++i;
|
|
66 |
return i & 1;
|
|
67 |
}
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
EXPORT_C TBool User::JustInTime()
|
|
73 |
/**
|
|
74 |
Tests whether just-in-time debugging is on or off.
|
|
75 |
|
|
76 |
The function is used by the Kernel, on the Emulator, to decide whether to do
|
|
77 |
just-in-time debugging for panics. The function applies to the current process.
|
|
78 |
|
|
79 |
Unless overridden by calling User::SetJustInTime(EFalse), just-in-time debugging
|
|
80 |
is on by default.
|
|
81 |
|
|
82 |
@return True, if just-in-time debugging is on. False otherwise.
|
|
83 |
@see RProcess::JustInTime
|
|
84 |
*/
|
|
85 |
{
|
|
86 |
|
|
87 |
return RProcess().JustInTime();
|
|
88 |
}
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
|
93 |
EXPORT_C void User::SetJustInTime(const TBool aBoolean)
|
|
94 |
/**
|
|
95 |
Sets just-in-time debugging for this process on or off.
|
|
96 |
|
|
97 |
While the function can be called by code running on both the Emulator and ARM,
|
|
98 |
it only has an effect on the Emulator. Turning just-in-time debugging off
|
|
99 |
prevents the debug Emulator closing down when a panic occurs.
|
|
100 |
|
|
101 |
By default, just-in-time debugging is on.
|
|
102 |
|
|
103 |
Note that the emulator handles panics in the nomal manner, i.e. by killing
|
|
104 |
the thread.
|
|
105 |
|
|
106 |
@param aBoolean ETrue, if just-in-time debugging is to be set on. EFalse,
|
|
107 |
if just-in-time debugging is to be set off.
|
|
108 |
EFalse causes _asm 3 calls to be disabled.
|
|
109 |
@see RProcess::SetJustInTime
|
|
110 |
*/
|
|
111 |
{
|
|
112 |
|
|
113 |
RProcess().SetJustInTime(aBoolean);
|
|
114 |
}
|
|
115 |
|
|
116 |
|
|
117 |
extern const LCharSet* GetLocaleDefaultCharSet();
|
|
118 |
extern const LCharSet* GetLocalePreferredCharSet();
|
|
119 |
|
|
120 |
// Convert to folded.
|
|
121 |
EXPORT_C TUint User::Fold(TUint aChar)
|
|
122 |
/**
|
|
123 |
@deprecated
|
|
124 |
|
|
125 |
Folds the specified character.
|
|
126 |
|
|
127 |
Folding converts the character to a form which can be used in tolerant
|
|
128 |
comparisons without control over the operations performed. Tolerant comparisons
|
|
129 |
are those which ignore character differences like case and accents.
|
|
130 |
|
|
131 |
The result of folding a character depends on the locale and on whether this
|
|
132 |
is a UNICODE build or not.
|
|
133 |
|
|
134 |
Note that for a non-UNICODE build, if the binary value of the character aChar
|
|
135 |
is greater than or equal to 0x100, then the character returned is the same as
|
|
136 |
the character passed to the function.
|
|
137 |
|
|
138 |
@param aChar The character to be folded.
|
|
139 |
|
|
140 |
@return The folded character.
|
|
141 |
|
|
142 |
@see TChar::Fold()
|
|
143 |
*/
|
|
144 |
{
|
|
145 |
// ASCII chars excluding 'i's can be handled by naive folding
|
|
146 |
if (aChar < 0x80 && aChar != 'I')
|
|
147 |
return (aChar >= 'A' && aChar <= 'Z') ? (aChar | 0x0020) : aChar;
|
|
148 |
else
|
|
149 |
return TUnicode(aChar).Fold(TChar::EFoldStandard,GetLocaleCharSet()->iCharDataSet);
|
|
150 |
}
|
|
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
// Convert to a folded version, specifying the folding methods.
|
|
156 |
EXPORT_C TUint User::Fold(TUint aChar,TInt aFlags)
|
|
157 |
/**
|
|
158 |
Folds the character according to a specified folding method.
|
|
159 |
|
|
160 |
@param aChar The character to be folded.
|
|
161 |
@param aFlags A set of flags defining the folding method. They are:
|
|
162 |
|
|
163 |
TChar::EFoldCase, convert characters to their lower case form,
|
|
164 |
if any;
|
|
165 |
|
|
166 |
TChar::EFoldAccents, strip accents;
|
|
167 |
|
|
168 |
TChar::EFoldDigits, convert digits representing values 0..9 to
|
|
169 |
characters '0'..'9';
|
|
170 |
|
|
171 |
TChar::EFoldSpaces, convert all spaces (ordinary, fixed-width,
|
|
172 |
ideographic, etc.) to ' ';
|
|
173 |
|
|
174 |
TChar::EFoldKana, convert hiragana to katakana;
|
|
175 |
|
|
176 |
TChar::EFoldWidth, fold full width and half width variants to
|
|
177 |
their standard forms;
|
|
178 |
|
|
179 |
TChar::EFoldAll, use all of the above folding methods.
|
|
180 |
|
|
181 |
@return The folded character.
|
|
182 |
@see TChar::Fold()
|
|
183 |
*/
|
|
184 |
{
|
|
185 |
return TUnicode(aChar).Fold(aFlags,GetLocaleCharSet()->iCharDataSet);
|
|
186 |
}
|
|
187 |
|
|
188 |
|
|
189 |
|
|
190 |
|
|
191 |
// Convert to collated.
|
|
192 |
EXPORT_C TUint User::Collate(TUint aChar)
|
|
193 |
/**
|
|
194 |
Converts the character to its collated form.
|
|
195 |
|
|
196 |
Collating is the process of removing differences between characters that are
|
|
197 |
deemed unimportant for the purposes of ordering characters. The result of
|
|
198 |
the conversion depends on the locale and on whether this is a UNICODE build
|
|
199 |
or not.
|
|
200 |
|
|
201 |
Note that for a non UNICODE build, if the binary value of the character aChar
|
|
202 |
is greater than or equal to 0x100, then the character returned is the same as
|
|
203 |
the character passed to the function.
|
|
204 |
|
|
205 |
@param aChar The character to be folded.
|
|
206 |
|
|
207 |
@return The converted character.
|
|
208 |
*/
|
|
209 |
{
|
|
210 |
return TUnicode(aChar).Fold(TChar::EFoldStandard,GetLocaleCharSet()->iCharDataSet);
|
|
211 |
}
|
|
212 |
|
|
213 |
|
|
214 |
|
|
215 |
|
|
216 |
// Convert to lower case.
|
|
217 |
EXPORT_C TUint User::LowerCase(TUint aChar)
|
|
218 |
/**
|
|
219 |
Converts the specified character to lower case.
|
|
220 |
|
|
221 |
The result of the conversion depends on the locale and on whether this is
|
|
222 |
a UNICODE build or not.
|
|
223 |
|
|
224 |
Note that for a non-UNICODE build, if the binary value of the character
|
|
225 |
aChar is greater than or equal to 0x100, then the character returned is
|
|
226 |
the same as the character passed to the function.
|
|
227 |
|
|
228 |
@param aChar The character to be converted to lower case.
|
|
229 |
|
|
230 |
@return The lower case character.
|
|
231 |
*/
|
|
232 |
{
|
|
233 |
// ASCII chars excluding 'i's can be handled by naive folding
|
|
234 |
if (aChar < 0x80 && aChar != 'I')
|
|
235 |
return (aChar >= 'A' && aChar <= 'Z') ? (aChar | 0x0020) : aChar;
|
|
236 |
else
|
|
237 |
return TUnicode(aChar).GetLowerCase(GetLocaleCharSet()->iCharDataSet);
|
|
238 |
}
|
|
239 |
|
|
240 |
|
|
241 |
|
|
242 |
|
|
243 |
// Convert to upper case.
|
|
244 |
EXPORT_C TUint User::UpperCase(TUint aChar)
|
|
245 |
/**
|
|
246 |
Converts a specified character to upper case.
|
|
247 |
|
|
248 |
The result of the conversion depends on the locale and on whether this is
|
|
249 |
a UNICODE build or not.
|
|
250 |
|
|
251 |
Note that for a non UNICODE build, if the binary value of the character aChar
|
|
252 |
is greater than or equal to 0x100, then the character returned is the same as
|
|
253 |
the character passed to the function.
|
|
254 |
|
|
255 |
@param aChar The character to be converted to upper case.
|
|
256 |
|
|
257 |
@return The upper case character.
|
|
258 |
*/
|
|
259 |
{
|
|
260 |
// ASCII chars excluding 'i's can be handled by naive folding
|
|
261 |
if (aChar < 0x80 && aChar != 'i')
|
|
262 |
return (aChar >= 'a' && aChar <= 'z') ? (aChar & ~0x0020) : aChar;
|
|
263 |
else
|
|
264 |
return TUnicode(aChar).GetUpperCase(GetLocaleCharSet()->iCharDataSet);
|
|
265 |
}
|
|
266 |
|
|
267 |
|
|
268 |
|
|
269 |
|
|
270 |
// Return the title case version of a character, which is the case of composite characters like Dz.
|
|
271 |
EXPORT_C TUint User::TitleCase(TUint aChar)
|
|
272 |
/**
|
|
273 |
Converts a specified character to its title case version.
|
|
274 |
|
|
275 |
@param aChar The character to be converted.
|
|
276 |
|
|
277 |
@return The converted character.
|
|
278 |
*/
|
|
279 |
{
|
|
280 |
return TUnicode(aChar).GetTitleCase(GetLocaleCharSet()->iCharDataSet);
|
|
281 |
}
|
|
282 |
|
|
283 |
|
|
284 |
|
|
285 |
|
|
286 |
EXPORT_C TUint TChar::GetUpperCase() const
|
|
287 |
/**
|
|
288 |
Gets the character value after conversion to uppercase or the character's
|
|
289 |
own value, if no uppercase form exists.
|
|
290 |
|
|
291 |
The character object itself is not changed.
|
|
292 |
|
|
293 |
@return The character value after conversion to uppercase.
|
|
294 |
*/
|
|
295 |
{
|
|
296 |
return User::UpperCase(iChar);
|
|
297 |
}
|
|
298 |
|
|
299 |
|
|
300 |
|
|
301 |
|
|
302 |
EXPORT_C TUint TChar::GetLowerCase() const
|
|
303 |
/**
|
|
304 |
Gets the character value after conversion to lowercase or the character's
|
|
305 |
own value, if no lowercase form exists.
|
|
306 |
|
|
307 |
The character object itself is not changed.
|
|
308 |
|
|
309 |
@return The character value after conversion to lowercase.
|
|
310 |
*/
|
|
311 |
{
|
|
312 |
return User::LowerCase(iChar);
|
|
313 |
}
|
|
314 |
|
|
315 |
|
|
316 |
|
|
317 |
|
|
318 |
EXPORT_C TUint TChar::GetTitleCase() const
|
|
319 |
/**
|
|
320 |
Gets the character value after conversion to titlecase or the character's
|
|
321 |
own value, if no titlecase form exists.
|
|
322 |
|
|
323 |
The titlecase form of a character is identical to its uppercase form unless
|
|
324 |
a specific titlecase form exists.
|
|
325 |
|
|
326 |
@return The value of the character value after conversion to titlecase form.
|
|
327 |
*/
|
|
328 |
{
|
|
329 |
return User::TitleCase(iChar);
|
|
330 |
}
|
|
331 |
|
|
332 |
|
|
333 |
|
|
334 |
|
|
335 |
EXPORT_C TBool TChar::IsLower() const
|
|
336 |
/**
|
|
337 |
Tests whether the character is lowercase.
|
|
338 |
|
|
339 |
@return True, if the character is lowercase; false, otherwise.
|
|
340 |
*/
|
|
341 |
{
|
|
342 |
return GetCategory() == TChar::ELlCategory;
|
|
343 |
}
|
|
344 |
|
|
345 |
|
|
346 |
|
|
347 |
|
|
348 |
EXPORT_C TBool TChar::IsUpper() const
|
|
349 |
/**
|
|
350 |
Tests whether the character is uppercase.
|
|
351 |
|
|
352 |
@return True, if the character is uppercase; false, otherwise.
|
|
353 |
*/
|
|
354 |
{
|
|
355 |
return GetCategory() == TChar::ELuCategory;
|
|
356 |
}
|
|
357 |
|
|
358 |
|
|
359 |
|
|
360 |
// Return TRUE if the character is title case, which is the case of composite characters like Dz.
|
|
361 |
EXPORT_C TBool TChar::IsTitle() const
|
|
362 |
/**
|
|
363 |
Tests whether this character is in titlecase.
|
|
364 |
|
|
365 |
@return True, if this character is in titlecase; false, otherwise.
|
|
366 |
*/
|
|
367 |
{
|
|
368 |
return GetCategory() == TChar::ELtCategory;
|
|
369 |
}
|
|
370 |
|
|
371 |
|
|
372 |
|
|
373 |
|
|
374 |
EXPORT_C TBool TChar::IsAlpha() const
|
|
375 |
/**
|
|
376 |
Tests whether the character is alphabetic.
|
|
377 |
|
|
378 |
For Unicode, the function returns TRUE for all letters, including those from
|
|
379 |
syllabaries and ideographic scripts. The function returns FALSE for letter-like
|
|
380 |
characters that are in fact diacritics. Specifically, the function returns
|
|
381 |
TRUE for categories: ELuCategory, ELtCategory, ELlCategory, and ELoCategory;
|
|
382 |
it returns FALSE for all other categories including ELmCategory.
|
|
383 |
|
|
384 |
@return True, if the character is alphabetic; false, otherwise.
|
|
385 |
|
|
386 |
@see TChar::IsAlphaDigit()
|
|
387 |
@see TChar::TCategory
|
|
388 |
*/
|
|
389 |
{
|
|
390 |
return GetCategory() <= TChar::EMaxLetterOrLetterModifierCategory;
|
|
391 |
}
|
|
392 |
|
|
393 |
|
|
394 |
|
|
395 |
|
|
396 |
EXPORT_C TBool TChar::IsDigit() const
|
|
397 |
/**
|
|
398 |
Tests whether the character is a standard decimal digit.
|
|
399 |
|
|
400 |
For Unicode, this function returns TRUE only
|
|
401 |
for the digits '0'...'9' (U+0030...U+0039),
|
|
402 |
not for other digits in scripts like Arabic, Tamil, etc.
|
|
403 |
|
|
404 |
@return True, if the character is a standard decimal digit; false, otherwise.
|
|
405 |
|
|
406 |
@see TChar::GetCategory()
|
|
407 |
@see TChar::GetNumericValue
|
|
408 |
*/
|
|
409 |
{
|
|
410 |
return iChar >= '0' && iChar <= '9'; // standard decimal digits only
|
|
411 |
}
|
|
412 |
|
|
413 |
|
|
414 |
|
|
415 |
|
|
416 |
EXPORT_C TBool TChar::IsAlphaDigit() const
|
|
417 |
/**
|
|
418 |
Tests whether the character is alphabetic or a decimal digit.
|
|
419 |
|
|
420 |
It is identical to (IsAlpha()||IsDigit()).
|
|
421 |
|
|
422 |
@return True, if the character is alphabetic or a decimal digit; false, otherwise.
|
|
423 |
|
|
424 |
@see TChar::IsAlpha()
|
|
425 |
@see TChar::IsDigit()
|
|
426 |
*/
|
|
427 |
{
|
|
428 |
TInt cat = (TInt)GetCategory();
|
|
429 |
return cat <= TChar::EMaxLetterOrLetterModifierCategory ||
|
|
430 |
(iChar < 256 && cat == TChar::ENdCategory); // accept any letter, but accept only standard digits
|
|
431 |
}
|
|
432 |
|
|
433 |
|
|
434 |
|
|
435 |
|
|
436 |
EXPORT_C TBool TChar::IsHexDigit() const
|
|
437 |
/**
|
|
438 |
Tests whether the character is a hexadecimal digit (0-9, a-f, A-F).
|
|
439 |
|
|
440 |
@return True, if the character is a hexadecimal digit; false, otherwise.
|
|
441 |
*/
|
|
442 |
{
|
|
443 |
/*
|
|
444 |
The following code will actually run faster than the non-Unicode version, which needs
|
|
445 |
to call the Exec function.
|
|
446 |
*/
|
|
447 |
return iChar <= 'f' && iChar >= '0' &&
|
|
448 |
(iChar <= '9' || iChar >= 'a' || (iChar >= 'A' && iChar <= 'F')); // only standard hex digits will do
|
|
449 |
}
|
|
450 |
|
|
451 |
|
|
452 |
|
|
453 |
|
|
454 |
EXPORT_C TBool TChar::IsSpace() const
|
|
455 |
/**
|
|
456 |
Tests whether the character is a white space character.
|
|
457 |
|
|
458 |
White space includes spaces, tabs and separators.
|
|
459 |
|
|
460 |
For Unicode, the function returns TRUE for all characters in the categories:
|
|
461 |
EZsCategory, EZlCategory and EZpCategory, and also for the characters 0x0009
|
|
462 |
(horizontal tab), 0x000A (linefeed), 0x000B (vertical tab), 0x000C (form feed),
|
|
463 |
and 0x000D (carriage return).
|
|
464 |
|
|
465 |
@return True, if the character is white space; false, otherwise.
|
|
466 |
|
|
467 |
@see TChar::TCategory
|
|
468 |
*/
|
|
469 |
{
|
|
470 |
/*
|
|
471 |
The Unicode characters 0009 .. 000D (tab, linefeed, vertical tab, formfeed, carriage return)
|
|
472 |
have the category Cc (control); however, we want to avoid breaking traditional programs
|
|
473 |
by getting IsSpace() to return TRUE for them.
|
|
474 |
*/
|
|
475 |
return (iChar <= 0x000D && iChar >= 0x0009) ||
|
|
476 |
(GetCategory() & 0xF0) == TChar::ESeparatorGroup;
|
|
477 |
}
|
|
478 |
|
|
479 |
|
|
480 |
|
|
481 |
|
|
482 |
EXPORT_C TBool TChar::IsPunctuation() const
|
|
483 |
/**
|
|
484 |
Tests whether the character is a punctuation character.
|
|
485 |
|
|
486 |
For Unicode, punctuation characters are any character in the categories:
|
|
487 |
EPcCategory, EPdCategory, EPsCategory, EPeCategory, EPiCategory,
|
|
488 |
EPfCategory, EPoCategory.
|
|
489 |
|
|
490 |
@return True, if the character is punctuation; false, otherwise.
|
|
491 |
|
|
492 |
@see TChar::TCategory
|
|
493 |
*/
|
|
494 |
{
|
|
495 |
return (GetCategory() & 0xF0) == TChar::EPunctuationGroup;
|
|
496 |
}
|
|
497 |
|
|
498 |
|
|
499 |
|
|
500 |
|
|
501 |
EXPORT_C TBool TChar::IsGraph() const
|
|
502 |
/**
|
|
503 |
Tests whether the character is a graphic character.
|
|
504 |
|
|
505 |
For Unicode, graphic characters include printable characters but not the space
|
|
506 |
character. Specifically, graphic characters are any character except those
|
|
507 |
in categories: EZsCategory,EZlCategory,EZpCategory, ECcCategory,ECfCategory,
|
|
508 |
ECsCategory, ECoCategory, and ,ECnCategory.
|
|
509 |
|
|
510 |
Note that for ISO Latin-1, all alphanumeric and punctuation characters are
|
|
511 |
graphic.
|
|
512 |
|
|
513 |
@return True, if the character is a graphic character; false, otherwise.
|
|
514 |
|
|
515 |
@see TChar::TCategory
|
|
516 |
*/
|
|
517 |
{
|
|
518 |
TUint type = TUnicode(iChar).GetCategory(0);
|
|
519 |
return type <= TChar::EMaxGraphicCategory ||
|
|
520 |
(type == TChar::ECoCategory && IsPUAPrintable(iChar));
|
|
521 |
}
|
|
522 |
|
|
523 |
|
|
524 |
|
|
525 |
|
|
526 |
EXPORT_C TBool TChar::IsPrint() const
|
|
527 |
/**
|
|
528 |
Tests whether the character is a printable character.
|
|
529 |
|
|
530 |
For Unicode, printable characters are any character except those in categories:
|
|
531 |
ECcCategory, ECfCategory, ECsCategory, ECoCategory and ECnCategory.
|
|
532 |
|
|
533 |
Note that for ISO Latin-1, all alphanumeric and punctuation characters, plus
|
|
534 |
space, are printable.
|
|
535 |
|
|
536 |
@return True, if the character is printable; false, otherwise.
|
|
537 |
|
|
538 |
@see TChar::TCategory
|
|
539 |
*/
|
|
540 |
{
|
|
541 |
TUint type = TUnicode(iChar).GetCategory(0);
|
|
542 |
return type <= TChar::EMaxPrintableCategory ||
|
|
543 |
(type == TChar::ECoCategory && IsPUAPrintable(iChar));
|
|
544 |
}
|
|
545 |
|
|
546 |
|
|
547 |
|
|
548 |
|
|
549 |
EXPORT_C TBool TChar::IsControl() const
|
|
550 |
/**
|
|
551 |
Tests whether the character is a control character.
|
|
552 |
|
|
553 |
For Unicode, the function returns TRUE for all characters in the categories:
|
|
554 |
ECcCategory, ECfCategory, ECsCategory, ECoCategory and ECnCategoryCc.
|
|
555 |
|
|
556 |
@return True, if the character is a control character; false, otherwise.
|
|
557 |
|
|
558 |
@see TChar::TCategory
|
|
559 |
*/
|
|
560 |
{
|
|
561 |
return GetCategory() == TChar::ECcCategory;
|
|
562 |
}
|
|
563 |
|
|
564 |
|
|
565 |
|
|
566 |
|
|
567 |
EXPORT_C TBool TChar::IsAssigned() const
|
|
568 |
/**
|
|
569 |
Tests whether this character has an assigned meaning in the Unicode encoding.
|
|
570 |
|
|
571 |
All characters outside the range 0x0000 - 0xFFFF are unassigned and there
|
|
572 |
are also many unassigned characters within the Unicode range.
|
|
573 |
|
|
574 |
Locales can change the assigned/unassigned status of characters. This means
|
|
575 |
that the precise behaviour of this function is locale-dependent.
|
|
576 |
|
|
577 |
@return True, if this character has an assigned meaning; false, otherwise.
|
|
578 |
*/
|
|
579 |
{
|
|
580 |
return GetCategory() <= TChar::EMaxAssignedCategory;
|
|
581 |
}
|
|
582 |
|
|
583 |
|
|
584 |
|
|
585 |
|
|
586 |
EXPORT_C void TChar::GetInfo(TCharInfo& aInfo) const
|
|
587 |
/**
|
|
588 |
Gets this character;s standard category information.
|
|
589 |
|
|
590 |
This includes everything except its CJK width and decomposition, if any.
|
|
591 |
|
|
592 |
@param aInfo On return, contains the character's standard category information.
|
|
593 |
*/
|
|
594 |
{
|
|
595 |
TUnicode(iChar).GetInfo(aInfo,GetLocaleCharSet()->iCharDataSet);
|
|
596 |
}
|
|
597 |
|
|
598 |
|
|
599 |
|
|
600 |
|
|
601 |
EXPORT_C TChar::TCategory TChar::GetCategory() const
|
|
602 |
/**
|
|
603 |
Gets this character's Unicode category.
|
|
604 |
|
|
605 |
@return This character's Unicode category.
|
|
606 |
*/
|
|
607 |
{
|
|
608 |
//for unicode non private user area just use the default charset
|
|
609 |
if (iChar>=0xE000 && iChar<=0xF8FF)
|
|
610 |
return TUnicode(iChar).GetCategory(GetLocaleCharSet()->iCharDataSet);
|
|
611 |
else
|
|
612 |
return TUnicode(iChar).GetCategory(GetLocaleDefaultCharSet()->iCharDataSet);
|
|
613 |
}
|
|
614 |
|
|
615 |
|
|
616 |
|
|
617 |
|
|
618 |
EXPORT_C TChar::TBdCategory TChar::GetBdCategory() const
|
|
619 |
/**
|
|
620 |
Gets the bi-directional category of a character.
|
|
621 |
|
|
622 |
For more information on the bi-directional algorithm, see Unicode Technical
|
|
623 |
Report No. 9 available at: http://www.unicode.org/unicode/reports/tr9/.
|
|
624 |
|
|
625 |
@return The character's bi-directional category.
|
|
626 |
*/
|
|
627 |
{
|
|
628 |
return TUnicode(iChar).GetBdCategory(GetLocaleCharSet()->iCharDataSet);
|
|
629 |
}
|
|
630 |
|
|
631 |
|
|
632 |
|
|
633 |
|
|
634 |
EXPORT_C TInt TChar::GetCombiningClass() const
|
|
635 |
/**
|
|
636 |
Gets this character's combining class.
|
|
637 |
|
|
638 |
Note that diacritics and other combining characters have non-zero combining
|
|
639 |
classes.
|
|
640 |
|
|
641 |
@return The combining class.
|
|
642 |
*/
|
|
643 |
{
|
|
644 |
//for unicode non private user area just use the default charset
|
|
645 |
if (iChar>=0xE000 && iChar<=0xF8FF)
|
|
646 |
return TUnicode(iChar).GetCombiningClass(GetLocaleCharSet()->iCharDataSet);
|
|
647 |
else
|
|
648 |
return TUnicode(iChar).GetCombiningClass(GetLocaleDefaultCharSet()->iCharDataSet);
|
|
649 |
}
|
|
650 |
|
|
651 |
|
|
652 |
|
|
653 |
|
|
654 |
EXPORT_C TBool TChar::IsMirrored() const
|
|
655 |
/**
|
|
656 |
Tests whether this character has the mirrored property.
|
|
657 |
|
|
658 |
Mirrored characters, like ( ) [ ] < >, change direction according to the
|
|
659 |
directionality of the surrounding characters. For example, an opening
|
|
660 |
parenthesis 'faces right' in Hebrew or Arabic, and to say that 2 < 3 you would
|
|
661 |
have to say that 3 > 2, where the '>' is, in this example, a less-than sign to
|
|
662 |
be read right-to-left.
|
|
663 |
|
|
664 |
@return True, if this character has the mirrored property; false, otherwise.
|
|
665 |
*/
|
|
666 |
{
|
|
667 |
return TUnicode(iChar).IsMirrored(GetLocaleCharSet()->iCharDataSet);
|
|
668 |
}
|
|
669 |
|
|
670 |
|
|
671 |
|
|
672 |
|
|
673 |
EXPORT_C TInt TChar::GetNumericValue() const
|
|
674 |
/**
|
|
675 |
Gets the integer numeric value of this character.
|
|
676 |
|
|
677 |
Numeric values need not be in the range 0..9; the Unicode character set
|
|
678 |
includes various other numeric characters such as the Roman and Tamil numerals
|
|
679 |
for 500, 1000, etc.
|
|
680 |
|
|
681 |
@return The numeric value: -1 if the character has no integer numeric
|
|
682 |
value,-2 if the character has a fractional numeric value.
|
|
683 |
*/
|
|
684 |
{
|
|
685 |
return TUnicode(iChar).GetNumericValue(GetLocaleCharSet()->iCharDataSet);
|
|
686 |
}
|
|
687 |
|
|
688 |
|
|
689 |
|
|
690 |
|
|
691 |
EXPORT_C TChar::TCjkWidth TChar::GetCjkWidth() const
|
|
692 |
/**
|
|
693 |
Gets the Chinese, Japanese, Korean (CJK) notional width.
|
|
694 |
|
|
695 |
Some display systems used in East Asia display characters on a grid of
|
|
696 |
fixed-width character cells like the standard MSDOS display mode.
|
|
697 |
|
|
698 |
Some characters, e.g. the Japanese katakana syllabary, take up a single
|
|
699 |
character cell and some characters, e.g., kanji, Chinese characters used in
|
|
700 |
Japanese, take up two. These are called half-width and full-width characters.
|
|
701 |
This property is fixed and cannot be overridden for particular locales.
|
|
702 |
|
|
703 |
For more information on returned widths, see Unicode Technical Report 11 on
|
|
704 |
East Asian Width available at: http://www.unicode.org/unicode/reports/tr11/
|
|
705 |
|
|
706 |
@return The notional width of an east Asian character.
|
|
707 |
*/
|
|
708 |
{
|
|
709 |
return TUnicode(iChar).GetCjkWidth();
|
|
710 |
}
|
|
711 |
|
|
712 |
|
|
713 |
|
|
714 |
|
|
715 |
/**
|
|
716 |
Composes a string of Unicode characters to produce a single character result.
|
|
717 |
|
|
718 |
For example, 0061 ('a') and 030A (combining ring above) compose to give 00E5
|
|
719 |
('a' with ring above).
|
|
720 |
|
|
721 |
A canonical decomposition is a relationship between a string of characters -
|
|
722 |
usually a base character and one or more diacritics - and a composed character.
|
|
723 |
The Unicode standard requires that compliant software treats composed
|
|
724 |
characters identically with their canonical decompositions. The mappings used
|
|
725 |
by these functions are fixed and cannot be overridden for particular locales.
|
|
726 |
|
|
727 |
@param aResult If successful, the composed character value. If unsuccessful,
|
|
728 |
this value contains 0xFFFF.
|
|
729 |
@param aSource String of source Unicode characters.
|
|
730 |
|
|
731 |
@return True, if the compose operation is successful in combining the entire
|
|
732 |
sequence of characters in the descriptor into a single compound
|
|
733 |
character; false, otherwise.
|
|
734 |
*/
|
|
735 |
|
|
736 |
EXPORT_C TBool TChar::Compose(TUint& aResult,const TDesC16& aSource)
|
|
737 |
{
|
|
738 |
aResult = 0xFFFF;
|
|
739 |
if(aSource.Length() > 0)
|
|
740 |
{
|
|
741 |
TChar combined;
|
|
742 |
if(::CombineAsMuchAsPossible(aSource, combined) == aSource.Length())
|
|
743 |
{
|
|
744 |
aResult = (TUint)combined;
|
|
745 |
return ETrue;
|
|
746 |
}
|
|
747 |
}
|
|
748 |
return EFalse;
|
|
749 |
}
|
|
750 |
|
|
751 |
|
|
752 |
|
|
753 |
|
|
754 |
/**
|
|
755 |
Maps this character to its maximal canonical decomposition.
|
|
756 |
|
|
757 |
For example, 01E1 ('a' with dot above and macron) decomposes into 0061 ('a')
|
|
758 |
0307 (dot) and 0304 (macron).
|
|
759 |
|
|
760 |
Note that this function is used during collation, as performed by
|
|
761 |
the Mem::CompareC() function, to convert the compared strings to their maximal
|
|
762 |
canonical decompositions.
|
|
763 |
|
|
764 |
@param aResult If successful, the descriptor represents the canonical decomposition
|
|
765 |
of this character. If unsuccessful, the descriptor is empty.
|
|
766 |
|
|
767 |
@return True if decomposition is successful; false, otherwise.
|
|
768 |
|
|
769 |
@see Mem::CompareC()
|
|
770 |
@see TChar::Compose()
|
|
771 |
*/
|
|
772 |
EXPORT_C TBool TChar::Decompose(TPtrC16& aResult) const
|
|
773 |
{
|
|
774 |
return ::DecomposeChar(iChar, aResult);
|
|
775 |
}
|
|
776 |
|
|
777 |
|
|
778 |
|
|
779 |
|
|
780 |
EXPORT_C TInt TFindChunk::Next(TFullName &aResult)
|
|
781 |
/**
|
|
782 |
Finds the full name of the next chunk which matches the match pattern.
|
|
783 |
|
|
784 |
@param aResult A reference to a TBuf descriptor with a defined maximum length.
|
|
785 |
If a matching chunk is found, its full name is set into
|
|
786 |
this descriptor.
|
|
787 |
If no matching chunk is found, the descriptor length is set
|
|
788 |
to zero.
|
|
789 |
|
|
790 |
@return KErrNone, if a matching chunk is found;
|
|
791 |
KErrNotFound otherwise.
|
|
792 |
*/
|
|
793 |
{
|
|
794 |
return NextObject(aResult,EChunk);
|
|
795 |
}
|
|
796 |
|
|
797 |
|
|
798 |
|
|
799 |
|
|
800 |
|
|
801 |
EXPORT_C TUint8 * RChunk::Base() const
|
|
802 |
/**
|
|
803 |
Gets a pointer to the base of the chunk's reserved region.
|
|
804 |
|
|
805 |
@return A pointer to the base of the chunk's reserved region.
|
|
806 |
*/
|
|
807 |
{
|
|
808 |
|
|
809 |
return(Exec::ChunkBase(iHandle));
|
|
810 |
}
|
|
811 |
|
|
812 |
|
|
813 |
|
|
814 |
|
|
815 |
EXPORT_C TInt RChunk::Size() const
|
|
816 |
/**
|
|
817 |
Gets the current size of this chunk's committed region.
|
|
818 |
|
|
819 |
@return The size of the chunk's committed region.
|
|
820 |
*/
|
|
821 |
{
|
|
822 |
|
|
823 |
return(Exec::ChunkSize(iHandle));
|
|
824 |
}
|
|
825 |
|
|
826 |
|
|
827 |
|
|
828 |
|
|
829 |
EXPORT_C TInt RChunk::Bottom() const
|
|
830 |
/**
|
|
831 |
Gets the offset of the bottom of the double ended chunk's committed region
|
|
832 |
from the base of the chunk's reserved region.
|
|
833 |
|
|
834 |
Note that the lowest valid address in a double ended chunk is the sum of the
|
|
835 |
base of the chunk's reserved region plus the value of Bottom().
|
|
836 |
|
|
837 |
@return The offset of the bottom of the chunk's committed region from the
|
|
838 |
base of the chunk's reserved region.
|
|
839 |
*/
|
|
840 |
{
|
|
841 |
|
|
842 |
return(Exec::ChunkBottom(iHandle));
|
|
843 |
}
|
|
844 |
|
|
845 |
|
|
846 |
|
|
847 |
|
|
848 |
EXPORT_C TInt RChunk::Top() const
|
|
849 |
/**
|
|
850 |
Gets the offset of the top of the double ended chunk's committed region
|
|
851 |
from the base of the chunk's reserved region.
|
|
852 |
|
|
853 |
Note that the highest valid address in a double ended chunk is the the sum
|
|
854 |
of the base of the chunk's reserved region plus the value of Top() - 1.
|
|
855 |
|
|
856 |
@return The offset of the top of the chunk's committed region from the base
|
|
857 |
of the chunk's reserved region.
|
|
858 |
*/
|
|
859 |
{
|
|
860 |
|
|
861 |
return(Exec::ChunkTop(iHandle));
|
|
862 |
}
|
|
863 |
|
|
864 |
|
|
865 |
EXPORT_C TInt RChunk::MaxSize() const
|
|
866 |
/**
|
|
867 |
Gets the maximum size of this chunk.
|
|
868 |
|
|
869 |
This maximum size of this chunk is set when the chunk is created.
|
|
870 |
|
|
871 |
@return The maximum size of this chunk.
|
|
872 |
*/
|
|
873 |
{
|
|
874 |
|
|
875 |
return(Exec::ChunkMaxSize(iHandle));
|
|
876 |
}
|
|
877 |
|
|
878 |
/**
|
|
879 |
Finds the full name of the next LDD factory object which matches the match pattern.
|
|
880 |
|
|
881 |
@param aResult A reference to a TBuf descriptor with a defined maximum length.
|
|
882 |
If a matching LDD factory object is found, its full name is set into
|
|
883 |
this descriptor.
|
|
884 |
If no matching LDD factory object is found, the descriptor length is set
|
|
885 |
to zero.
|
|
886 |
|
|
887 |
@return KErrNone, if a matching LDD factory object is found;
|
|
888 |
KErrNotFound otherwise.
|
|
889 |
*/
|
|
890 |
EXPORT_C TInt TFindLogicalDevice::Next(TFullName &aResult)
|
|
891 |
{
|
|
892 |
return NextObject(aResult,ELogicalDevice);
|
|
893 |
}
|
|
894 |
|
|
895 |
/**
|
|
896 |
Finds the full name of the next PDD factory object which matches the match pattern.
|
|
897 |
|
|
898 |
@param aResult A reference to a TBuf descriptor with a defined maximum length.
|
|
899 |
If a matching PDD factory object is found, its full name is set into
|
|
900 |
this descriptor.
|
|
901 |
If no matching PDD factory object is found, the descriptor length is set
|
|
902 |
to zero.
|
|
903 |
|
|
904 |
@return KErrNone, if a matching PDD factory object is found;
|
|
905 |
KErrNotFound otherwise.
|
|
906 |
*/
|
|
907 |
EXPORT_C TInt TFindPhysicalDevice::Next(TFullName &aResult)
|
|
908 |
{
|
|
909 |
return NextObject(aResult,EPhysicalDevice);
|
|
910 |
}
|
|
911 |
|
|
912 |
/**
|
|
913 |
Gets the device capabilities.
|
|
914 |
|
|
915 |
@param aDes A descriptor into which capability's information is to be written.
|
|
916 |
*/
|
|
917 |
EXPORT_C void RDevice::GetCaps(TDes8 &aDes) const
|
|
918 |
{
|
|
919 |
|
|
920 |
Exec::LogicalDeviceGetCaps(iHandle,aDes);
|
|
921 |
}
|
|
922 |
|
|
923 |
/**
|
|
924 |
Checks if a device supports a particular version.
|
|
925 |
|
|
926 |
@param aVer The requested device version.
|
|
927 |
|
|
928 |
@return ETrue if supported, EFalse if not.
|
|
929 |
*/
|
|
930 |
EXPORT_C TBool RDevice::QueryVersionSupported(const TVersion &aVer) const
|
|
931 |
{
|
|
932 |
|
|
933 |
return(Exec::LogicalDeviceQueryVersionSupported(iHandle,aVer));
|
|
934 |
}
|
|
935 |
|
|
936 |
/**
|
|
937 |
Checks if a specified unit number, additional info and a specific PDD is supported.
|
|
938 |
|
|
939 |
@param aUnit The requested unit number.
|
|
940 |
@param aPhysicalDevice The requested PDD name.
|
|
941 |
@param anInfo The additional information.
|
|
942 |
|
|
943 |
@return ETrue if supported, EFalse if not.
|
|
944 |
*/
|
|
945 |
EXPORT_C TBool RDevice::IsAvailable(TInt aUnit, const TDesC* aPhysicalDevice, const TDesC8* anInfo) const
|
|
946 |
{
|
|
947 |
TInt r;
|
|
948 |
if(aPhysicalDevice)
|
|
949 |
{
|
|
950 |
TBuf8<KMaxKernelName> physicalDevice;
|
|
951 |
physicalDevice.Copy(*aPhysicalDevice);
|
|
952 |
r = Exec::LogicalDeviceIsAvailable(iHandle,aUnit,(TDesC8*)&physicalDevice,anInfo);
|
|
953 |
}
|
|
954 |
else
|
|
955 |
r = Exec::LogicalDeviceIsAvailable(iHandle,aUnit,(TDesC8*)NULL,anInfo);
|
|
956 |
|
|
957 |
return r;
|
|
958 |
}
|
|
959 |
|
|
960 |
|
|
961 |
/**
|
|
962 |
Queues an asynchronous request for the device driver, taking no parameters.
|
|
963 |
|
|
964 |
The request is handled on the kernel-side by the logical channel's
|
|
965 |
DLogicalChannelBase::Request().
|
|
966 |
|
|
967 |
Outstanding requests can be cancelled by calling DoCancel().
|
|
968 |
|
|
969 |
@param aReqNo A number identifying the request to the logical channel.
|
|
970 |
@param aStatus The request status object for this request.
|
|
971 |
*/
|
|
972 |
EXPORT_C void RBusLogicalChannel::DoRequest(TInt aReqNo,TRequestStatus &aStatus)
|
|
973 |
{
|
|
974 |
|
|
975 |
TAny *a[2];
|
|
976 |
a[0]=NULL;
|
|
977 |
a[1]=NULL;
|
|
978 |
aStatus=KRequestPending;
|
|
979 |
Exec::ChannelRequest(iHandle,~aReqNo,&aStatus,&a[0]);
|
|
980 |
}
|
|
981 |
|
|
982 |
|
|
983 |
|
|
984 |
|
|
985 |
/**
|
|
986 |
Queues an asynchronous request for the device driver, taking one parameter.
|
|
987 |
|
|
988 |
The request is handled on the kernel-side by the logical channel's
|
|
989 |
DLogicalChannelBase::Request().
|
|
990 |
|
|
991 |
Outstanding requests can be cancelled by calling DoCancel().
|
|
992 |
|
|
993 |
@param aReqNo A number identifying the request to the logical channel.
|
|
994 |
@param aStatus The request status object for this request.
|
|
995 |
@param a1 A 32-bit value passed to the kernel-side. Its meaning depends
|
|
996 |
on the device driver requirements.
|
|
997 |
*/
|
|
998 |
EXPORT_C void RBusLogicalChannel::DoRequest(TInt aReqNo,TRequestStatus &aStatus,TAny *a1)
|
|
999 |
{
|
|
1000 |
|
|
1001 |
TAny *a[2];
|
|
1002 |
a[0]=a1;
|
|
1003 |
a[1]=NULL;
|
|
1004 |
aStatus=KRequestPending;
|
|
1005 |
Exec::ChannelRequest(iHandle,~aReqNo,&aStatus,&a[0]);
|
|
1006 |
}
|
|
1007 |
|
|
1008 |
|
|
1009 |
|
|
1010 |
|
|
1011 |
/**
|
|
1012 |
Queues an asynchronous request for the device driver, taking two parameters.
|
|
1013 |
|
|
1014 |
The request is handled on the kernel-side by the logical channel's
|
|
1015 |
DLogicalChannelBase::Request().
|
|
1016 |
|
|
1017 |
Outstanding requests can be cancelled by calling DoCancel().
|
|
1018 |
|
|
1019 |
@param aReqNo A number identifying the request to the logical channel.
|
|
1020 |
@param aStatus The request status object for this request.
|
|
1021 |
@param a1 A 32-bit value passed to the kernel-side. Its meaning depends
|
|
1022 |
on the device driver requirements.
|
|
1023 |
@param a2 A 32-bit value passed to the kernel-side. Its meaning depends
|
|
1024 |
on the device driver requirements.
|
|
1025 |
*/
|
|
1026 |
EXPORT_C void RBusLogicalChannel::DoRequest(TInt aReqNo,TRequestStatus &aStatus,TAny *a1,TAny *a2)
|
|
1027 |
{
|
|
1028 |
|
|
1029 |
TAny *a[2];
|
|
1030 |
a[0]=a1;
|
|
1031 |
a[1]=a2;
|
|
1032 |
aStatus=KRequestPending;
|
|
1033 |
Exec::ChannelRequest(iHandle,~aReqNo,&aStatus,&a[0]);
|
|
1034 |
}
|
|
1035 |
|
|
1036 |
|
|
1037 |
|
|
1038 |
|
|
1039 |
/**
|
|
1040 |
Cancels one or more outstanding asynchronous requests.
|
|
1041 |
|
|
1042 |
All outstanding requests complete with KErrCancel.
|
|
1043 |
|
|
1044 |
@param aRequestMask A set of bits identifying the requests to be cancelled.
|
|
1045 |
Each bit can be used to identify a separate outstanding
|
|
1046 |
request. It is up to the driver to define how the bits map
|
|
1047 |
to those outstanding requests.
|
|
1048 |
*/
|
|
1049 |
EXPORT_C void RBusLogicalChannel::DoCancel(TUint aRequestMask)
|
|
1050 |
{
|
|
1051 |
|
|
1052 |
Exec::ChannelRequest(iHandle,KMaxTInt,(TAny*)aRequestMask,0);
|
|
1053 |
}
|
|
1054 |
|
|
1055 |
|
|
1056 |
|
|
1057 |
|
|
1058 |
/**
|
|
1059 |
Makes a synchronous request to the device driver, taking no parameters.
|
|
1060 |
|
|
1061 |
This function does not return until the request has completed, successfully
|
|
1062 |
or otherwise.
|
|
1063 |
|
|
1064 |
@param aFunction A number identifying the request.
|
|
1065 |
|
|
1066 |
@return KErrNone, if successful; otherwise one of the other system-wide
|
|
1067 |
error codes.
|
|
1068 |
The value returned depends on the implementation of the device driver.
|
|
1069 |
*/
|
|
1070 |
EXPORT_C TInt RBusLogicalChannel::DoControl(TInt aFunction)
|
|
1071 |
{
|
|
1072 |
|
|
1073 |
return Exec::ChannelRequest(iHandle,aFunction,NULL,NULL);
|
|
1074 |
}
|
|
1075 |
|
|
1076 |
|
|
1077 |
|
|
1078 |
|
|
1079 |
/**
|
|
1080 |
Makes a synchronous request to the device driver, taking one parameter.
|
|
1081 |
|
|
1082 |
This function does not return until the request has completed, successfully
|
|
1083 |
or otherwise.
|
|
1084 |
|
|
1085 |
@param aFunction A number identifying the request.
|
|
1086 |
@param a1 A 32-bit value passed to the kernel-side. Its meaning depends
|
|
1087 |
on the device driver requirements.
|
|
1088 |
|
|
1089 |
@return KErrNone, if successful; otherwise one of the other system-wide
|
|
1090 |
error codes.
|
|
1091 |
The value returned depends on the implementation of the device driver.
|
|
1092 |
*/
|
|
1093 |
EXPORT_C TInt RBusLogicalChannel::DoControl(TInt aFunction,TAny *a1)
|
|
1094 |
{
|
|
1095 |
|
|
1096 |
return Exec::ChannelRequest(iHandle,aFunction,a1,NULL);
|
|
1097 |
}
|
|
1098 |
|
|
1099 |
|
|
1100 |
|
|
1101 |
|
|
1102 |
/**
|
|
1103 |
Makes a synchronous request to the device driver, taking two parameters.
|
|
1104 |
|
|
1105 |
This function does not return until the request has completed, successfully
|
|
1106 |
or otherwise.
|
|
1107 |
|
|
1108 |
@param aFunction A number identifying the request.
|
|
1109 |
@param a1 A 32-bit value passed to the kernel-side. Its meaning depends
|
|
1110 |
on the device driver requirements.
|
|
1111 |
@param a2 A 32-bit value passed to the kernel-side. Its meaning depends
|
|
1112 |
on the device driver requirements.
|
|
1113 |
|
|
1114 |
@return KErrNone, if successful; otherwise one of the other system-wide
|
|
1115 |
error codes.
|
|
1116 |
The value returned depends on the implementation of the device driver.
|
|
1117 |
*/
|
|
1118 |
EXPORT_C TInt RBusLogicalChannel::DoControl(TInt aFunction,TAny *a1,TAny *a2)
|
|
1119 |
{
|
|
1120 |
|
|
1121 |
return Exec::ChannelRequest(iHandle,aFunction,a1,a2);
|
|
1122 |
}
|
|
1123 |
|
|
1124 |
|
|
1125 |
|
|
1126 |
|
|
1127 |
EXPORT_C void User::WaitForAnyRequest()
|
|
1128 |
/**
|
|
1129 |
Waits for any asynchronous request to complete.
|
|
1130 |
|
|
1131 |
The current thread waits on its request semaphore.
|
|
1132 |
|
|
1133 |
The function completes, and control returns to the caller when the current
|
|
1134 |
thread's request semaphore is signalled by any of the service providers which
|
|
1135 |
handle these asynchronous requests.
|
|
1136 |
|
|
1137 |
The request status of all outstanding asynchronous requests must be examined
|
|
1138 |
to determine which request is complete.
|
|
1139 |
|
|
1140 |
@see TRequestStatus
|
|
1141 |
*/
|
|
1142 |
{
|
|
1143 |
|
|
1144 |
Exec::WaitForAnyRequest();
|
|
1145 |
}
|
|
1146 |
|
|
1147 |
|
|
1148 |
|
|
1149 |
|
|
1150 |
EXPORT_C void User::WaitForRequest(TRequestStatus &aStatus)
|
|
1151 |
/**
|
|
1152 |
Waits for a specific asynchronous request to complete.
|
|
1153 |
|
|
1154 |
The current thread waits on its request semaphore.
|
|
1155 |
|
|
1156 |
The function completes and control returns to the caller when the current
|
|
1157 |
thread's request semaphore is signalled by the service provider handling the
|
|
1158 |
request associated with aStatus. Before signalling, the service provider sets
|
|
1159 |
an appropriate value in aStatus, other than KRequestPending.
|
|
1160 |
|
|
1161 |
Note that if other asynchronous requests complete before the one associated
|
|
1162 |
with aStatus, the request semaphore is adjusted so that knowledge of their
|
|
1163 |
completion is not lost. In this a case, a subsequent call to
|
|
1164 |
User::WaitForAnyRequest() or User::WaitForRequest() will complete and return
|
|
1165 |
immediately.
|
|
1166 |
|
|
1167 |
@param aStatus A reference to the request status object associated with the
|
|
1168 |
specific asynchronous request.
|
|
1169 |
|
|
1170 |
@see KRequestPending
|
|
1171 |
*/
|
|
1172 |
{
|
|
1173 |
|
|
1174 |
TInt i=(-1);
|
|
1175 |
do
|
|
1176 |
{
|
|
1177 |
i++;
|
|
1178 |
Exec::WaitForAnyRequest();
|
|
1179 |
} while (aStatus==KRequestPending);
|
|
1180 |
if (i)
|
|
1181 |
Exec::RequestSignal(i);
|
|
1182 |
}
|
|
1183 |
|
|
1184 |
|
|
1185 |
|
|
1186 |
|
|
1187 |
EXPORT_C void User::WaitForRequest(TRequestStatus &aStatus1,TRequestStatus &aStatus2)
|
|
1188 |
/**
|
|
1189 |
Waits for either of two specific asynchronous requests to complete.
|
|
1190 |
|
|
1191 |
The current thread waits on its request semaphore.
|
|
1192 |
|
|
1193 |
The function completes and control returns to the caller when the current
|
|
1194 |
thread's request semaphore is signalled by either the service provider handling
|
|
1195 |
the request associated with aStatus1 or the service provider handling the
|
|
1196 |
request associated with aStatus2. Before signalling, the completing service
|
|
1197 |
provider sets an appropriate value in the status object, other
|
|
1198 |
than KRequestPending.
|
|
1199 |
|
|
1200 |
Note that if other asynchronous requests complete before the ones associated
|
|
1201 |
with aStatus1 and aStatus2, the request semaphore is adjusted so that knowledge
|
|
1202 |
of their completion is not lost. In this a case, a subsequent call to
|
|
1203 |
User::WaitForAnyRequest() or User::WaitForRequest() will complete and return
|
|
1204 |
immediately.
|
|
1205 |
|
|
1206 |
@param aStatus1 A reference to the request status object associated with the
|
|
1207 |
first specific asynchronous request.
|
|
1208 |
@param aStatus2 A reference to the request status object associated with the
|
|
1209 |
second specific asynchronous request.
|
|
1210 |
|
|
1211 |
@see KRequestPending
|
|
1212 |
*/
|
|
1213 |
{
|
|
1214 |
|
|
1215 |
TInt i=(-1);
|
|
1216 |
do
|
|
1217 |
{
|
|
1218 |
i++;
|
|
1219 |
Exec::WaitForAnyRequest();
|
|
1220 |
} while (aStatus1==KRequestPending && aStatus2==KRequestPending);
|
|
1221 |
if (i)
|
|
1222 |
Exec::RequestSignal(i);
|
|
1223 |
}
|
|
1224 |
|
|
1225 |
|
|
1226 |
|
|
1227 |
|
|
1228 |
EXPORT_C void User::WaitForNRequest(TRequestStatus * aStatusArray[], TInt aNum)
|
|
1229 |
/**
|
|
1230 |
Waits for any one of specific asynchronous requests to complete.
|
|
1231 |
|
|
1232 |
The current thread waits on its request semaphore.
|
|
1233 |
|
|
1234 |
The function completes and control returns to the caller when the current
|
|
1235 |
thread's request semaphore is signalled by the service provider handling
|
|
1236 |
the request associated with any member of aStatusArray[]. Before signalling,
|
|
1237 |
the completing service provider sets an appropriate value in the status object,
|
|
1238 |
other than KRequestPending.
|
|
1239 |
|
|
1240 |
Note that if other asynchronous requests complete before the ones associated
|
|
1241 |
with aStatusArray the request semaphore is adjusted so that knowledge
|
|
1242 |
of their completion is not lost. In this a case, a subsequent call to
|
|
1243 |
User::WaitForAnyRequest() or User::WaitForRequest() will complete and return
|
|
1244 |
immediately.
|
|
1245 |
@param aStatusArray[] An array of pointers to the request status objects
|
|
1246 |
@param TInt aNum The size of aStatusArray[]
|
|
1247 |
*/
|
|
1248 |
{
|
|
1249 |
TRequestStatus* aptr;
|
|
1250 |
TBool m = ETrue;
|
|
1251 |
TInt i = (-1);
|
|
1252 |
do
|
|
1253 |
{
|
|
1254 |
i++;
|
|
1255 |
Exec::WaitForAnyRequest();
|
|
1256 |
for(TInt j = 0; j<aNum; j++)
|
|
1257 |
{
|
|
1258 |
aptr = aStatusArray[j];
|
|
1259 |
if(aptr)
|
|
1260 |
{
|
|
1261 |
if(aptr->Int()!= KRequestPending)
|
|
1262 |
{
|
|
1263 |
m = EFalse;
|
|
1264 |
break;
|
|
1265 |
}
|
|
1266 |
}
|
|
1267 |
}
|
|
1268 |
}while(m);
|
|
1269 |
if(i)
|
|
1270 |
Exec::RequestSignal(i);
|
|
1271 |
}
|
|
1272 |
|
|
1273 |
|
|
1274 |
|
|
1275 |
|
|
1276 |
EXPORT_C TInt TFindLibrary::Next(TFullName &aResult)
|
|
1277 |
/**
|
|
1278 |
Finds the next DLL whose full name matches the match pattern.
|
|
1279 |
|
|
1280 |
If a DLL with a matching name is found, the function copies the full name of
|
|
1281 |
the DLL into the descriptor aResult.
|
|
1282 |
|
|
1283 |
@param aResult A buffer for the fullname of the DLL. This is a template
|
|
1284 |
specialisation of TBuf defining a modifiable buffer descriptor
|
|
1285 |
taking a maximum length of KMaxFullName.
|
|
1286 |
If no matching DLL is found, the descriptor length is
|
|
1287 |
set to zero.
|
|
1288 |
|
|
1289 |
@return KErrNone, if a matching DLL is found;
|
|
1290 |
KErrNotFound, otherwise.
|
|
1291 |
*/
|
|
1292 |
{
|
|
1293 |
return NextObject(aResult,ELibrary);
|
|
1294 |
}
|
|
1295 |
|
|
1296 |
|
|
1297 |
|
|
1298 |
|
|
1299 |
EXPORT_C TLibraryFunction RLibrary::Lookup(TInt anOrdinal) const
|
|
1300 |
/**
|
|
1301 |
Gets a pointer to the function at the specified ordinal within this DLL.
|
|
1302 |
|
|
1303 |
@param anOrdinal The ordinal of the required function in this DLL.
|
|
1304 |
This value must be positive.
|
|
1305 |
|
|
1306 |
@return A pointer to the function at position anOrdinal in this DLL.
|
|
1307 |
The value is NULL if there is no function at that ordinal.
|
|
1308 |
|
|
1309 |
@panic USER 116 if anOrdinal is negative
|
|
1310 |
*/
|
|
1311 |
{
|
|
1312 |
__ASSERT_ALWAYS(anOrdinal>=0,Panic(EBadLookupOrdinal));
|
|
1313 |
return (Exec::LibraryLookup(iHandle,anOrdinal));
|
|
1314 |
}
|
|
1315 |
|
|
1316 |
|
|
1317 |
|
|
1318 |
EXPORT_C TFileName RLibrary::FileName() const
|
|
1319 |
/**
|
|
1320 |
Gets the name of the DLL's file.
|
|
1321 |
|
|
1322 |
@return The DLL's filname.
|
|
1323 |
*/
|
|
1324 |
{
|
|
1325 |
|
|
1326 |
TFileName n;
|
|
1327 |
TPtr8 n8(((TUint8*)n.Ptr()) + KMaxFileName, KMaxFileName);
|
|
1328 |
Exec::LibraryFileName(iHandle,n8);
|
|
1329 |
n.Copy(n8);
|
|
1330 |
return(n);
|
|
1331 |
}
|
|
1332 |
|
|
1333 |
|
|
1334 |
|
|
1335 |
|
|
1336 |
EXPORT_C TUidType RLibrary::Type() const
|
|
1337 |
/**
|
|
1338 |
Gets this DLL's UID type.
|
|
1339 |
|
|
1340 |
The UID type is a property of a Symbian OS file; for a DLL, its value is set
|
|
1341 |
during the building of that DLL.
|
|
1342 |
|
|
1343 |
@return The UID type of this DLL. Note that the first TUid component of
|
|
1344 |
the TUidType has the value KDynamicLibraryUid.
|
|
1345 |
*/
|
|
1346 |
{
|
|
1347 |
|
|
1348 |
TUidType u;
|
|
1349 |
Exec::LibraryType(iHandle,u);
|
|
1350 |
return(u);
|
|
1351 |
}
|
|
1352 |
|
|
1353 |
|
|
1354 |
|
|
1355 |
|
|
1356 |
EXPORT_C TInt RLibrary::GetRamSizes(TInt& aCodeSize, TInt& aConstDataSize)
|
|
1357 |
/**
|
|
1358 |
Gets the current size of the code and the const data for this DLL.
|
|
1359 |
|
|
1360 |
This function can be called on a RAM loaded DLL or a ROM based DLL.
|
|
1361 |
|
|
1362 |
@param aCodeSize The current size of the code for a RAM loaded DLL.
|
|
1363 |
This is zero for a ROM based DLL.
|
|
1364 |
|
|
1365 |
@param aConstDataSize The current size of the const data for a RAM loaded DLL.
|
|
1366 |
This is zero for a ROM based DLL.
|
|
1367 |
|
|
1368 |
@return KErrNone if successful, otherwise one of the system-wide error codes.
|
|
1369 |
*/
|
|
1370 |
{
|
|
1371 |
TModuleMemoryInfo info;
|
|
1372 |
TInt r=Exec::LibraryGetMemoryInfo(iHandle,info);
|
|
1373 |
if (r==KErrNone)
|
|
1374 |
{
|
|
1375 |
aCodeSize=info.iCodeSize;
|
|
1376 |
aConstDataSize=info.iConstDataSize;
|
|
1377 |
}
|
|
1378 |
return r;
|
|
1379 |
}
|
|
1380 |
|
|
1381 |
|
|
1382 |
|
|
1383 |
|
|
1384 |
/**
|
|
1385 |
Sets the home time to a specified time value.
|
|
1386 |
|
|
1387 |
@param aTime A reference to a time representation object containing the time
|
|
1388 |
value.
|
|
1389 |
|
|
1390 |
@return KErrNone if successful or one of the system-wide error codes.
|
|
1391 |
|
|
1392 |
@deprecated Set the time using User::SetUTCTime if the UTC time is known;
|
|
1393 |
otherwise, use the timezone server to set the time.
|
|
1394 |
|
|
1395 |
@capability WriteDeviceData
|
|
1396 |
*/
|
|
1397 |
EXPORT_C TInt User::SetHomeTime(const TTime &aTime)
|
|
1398 |
{
|
|
1399 |
return(Exec::SetUTCTimeAndOffset(aTime.Int64(),0,ETimeSetTime|ETimeSetLocalTime,0));
|
|
1400 |
}
|
|
1401 |
|
|
1402 |
/**
|
|
1403 |
Sets the secure home time to a specified time value.
|
|
1404 |
|
|
1405 |
@param aTime A reference to a time representation object containing the
|
|
1406 |
secure time value.
|
|
1407 |
|
|
1408 |
@return KErrNone if successful or one of the system-wide error codes.
|
|
1409 |
|
|
1410 |
@capability TCB
|
|
1411 |
@capability WriteDeviceData
|
|
1412 |
*/
|
|
1413 |
EXPORT_C TInt User::SetHomeTimeSecure(const TTime &aTime)
|
|
1414 |
{
|
|
1415 |
return(Exec::SetUTCTimeAndOffset(aTime.Int64(),0,ETimeSetTime|ETimeSetLocalTime|ETimeSetSecure,0));
|
|
1416 |
}
|
|
1417 |
|
|
1418 |
|
|
1419 |
|
|
1420 |
/**
|
|
1421 |
Sets the UTC time to a specified time value.
|
|
1422 |
|
|
1423 |
@param aUTCTime A reference to a time representation object containing the time
|
|
1424 |
value.
|
|
1425 |
|
|
1426 |
@return KErrNone if successful or one of the system-wide error codes.
|
|
1427 |
|
|
1428 |
@capability WriteDeviceData
|
|
1429 |
*/
|
|
1430 |
EXPORT_C TInt User::SetUTCTime(const TTime &aUTCTime)
|
|
1431 |
{
|
|
1432 |
return(Exec::SetUTCTimeAndOffset(aUTCTime.Int64(),0,ETimeSetTime,0));
|
|
1433 |
}
|
|
1434 |
|
|
1435 |
/**
|
|
1436 |
Sets the secure UTC time to a specified time value.
|
|
1437 |
|
|
1438 |
@param aUTCTime A reference to a time representation object containing the secure time
|
|
1439 |
value.
|
|
1440 |
|
|
1441 |
@return KErrNone if successful or one of the system-wide error codes.
|
|
1442 |
|
|
1443 |
@capability TCB
|
|
1444 |
@capability WriteDeviceData
|
|
1445 |
*/
|
|
1446 |
EXPORT_C TInt User::SetUTCTimeSecure(const TTime &aUTCTime)
|
|
1447 |
{
|
|
1448 |
return(Exec::SetUTCTimeAndOffset(aUTCTime.Int64(),0,ETimeSetTime|ETimeSetSecure,0));
|
|
1449 |
}
|
|
1450 |
|
|
1451 |
/**
|
|
1452 |
Gets the UTC offset - the difference between UTC and the current local time
|
|
1453 |
due to any time zones and daylight savings time that may be in effect. A positive
|
|
1454 |
offset indicates a time ahead of UTC, a negative offset indicates a time behind UTC.
|
|
1455 |
|
|
1456 |
@return The UTC offset, in seconds.
|
|
1457 |
*/
|
|
1458 |
EXPORT_C TTimeIntervalSeconds User::UTCOffset()
|
|
1459 |
{
|
|
1460 |
return(TTimeIntervalSeconds(Exec::UTCOffset()));
|
|
1461 |
}
|
|
1462 |
|
|
1463 |
|
|
1464 |
/**
|
|
1465 |
Sets the UTC offset to the given number of seconds. This should include both time
|
|
1466 |
zone differences and the effect of any applicable daylight savings time.
|
|
1467 |
A positive offset indicates a time ahead of UTC, a negative offset indicates a time
|
|
1468 |
behind UTC.
|
|
1469 |
|
|
1470 |
@param aOffset The UTC offset, in seconds.
|
|
1471 |
|
|
1472 |
@capability WriteDeviceData
|
|
1473 |
*/
|
|
1474 |
EXPORT_C void User::SetUTCOffset(TTimeIntervalSeconds aOffset)
|
|
1475 |
{
|
|
1476 |
Exec::SetUTCTimeAndOffset(0,aOffset.Int(),ETimeSetOffset,0);
|
|
1477 |
}
|
|
1478 |
|
|
1479 |
|
|
1480 |
/**
|
|
1481 |
Sets the UTC time and UTC offset to the specified values, atomically. This is equivalent
|
|
1482 |
to calling both SetUTCTime and SetUTCOffset, but without the possibility of an incorrect
|
|
1483 |
time being observed between the two calls. If the operation is not successful, an error
|
|
1484 |
code will be returned and both the time and offset will be left unchanged.
|
|
1485 |
|
|
1486 |
@param aUTCTime A reference to a time representation object containing the time
|
|
1487 |
value.
|
|
1488 |
@param aOffset The UTC offset, in seconds.
|
|
1489 |
|
|
1490 |
@return KErrNone if successful or one of the system-wide error codes.
|
|
1491 |
|
|
1492 |
@capability WriteDeviceData
|
|
1493 |
*/
|
|
1494 |
EXPORT_C TInt User::SetUTCTimeAndOffset(const TTime &aUTCTime, TTimeIntervalSeconds aOffset)
|
|
1495 |
{
|
|
1496 |
return(Exec::SetUTCTimeAndOffset(aUTCTime.Int64(),aOffset.Int(),ETimeSetTime|ETimeSetOffset,0));
|
|
1497 |
}
|
|
1498 |
|
|
1499 |
|
|
1500 |
/**
|
|
1501 |
Gets the current tick count.
|
|
1502 |
|
|
1503 |
The period between ticks is usually 1/64 second, but may be hardware dependent.
|
|
1504 |
|
|
1505 |
@return The machine dependent tick count.
|
|
1506 |
*/
|
|
1507 |
EXPORT_C TUint User::TickCount()
|
|
1508 |
{
|
|
1509 |
|
|
1510 |
return(Exec::TickCount());
|
|
1511 |
}
|
|
1512 |
|
|
1513 |
|
|
1514 |
|
|
1515 |
|
|
1516 |
EXPORT_C TTimeIntervalSeconds User::InactivityTime()
|
|
1517 |
/**
|
|
1518 |
Gets the time since the last user activity.
|
|
1519 |
|
|
1520 |
@return The time interval.
|
|
1521 |
*/
|
|
1522 |
{
|
|
1523 |
|
|
1524 |
return TTimeIntervalSeconds(Exec::UserInactivityTime());
|
|
1525 |
}
|
|
1526 |
|
|
1527 |
|
|
1528 |
|
|
1529 |
|
|
1530 |
/**
|
|
1531 |
Resets all user inactivity timers.
|
|
1532 |
*/
|
|
1533 |
EXPORT_C void User::ResetInactivityTime()
|
|
1534 |
{
|
|
1535 |
Exec::ResetInactivityTime();
|
|
1536 |
}
|
|
1537 |
|
|
1538 |
|
|
1539 |
|
|
1540 |
|
|
1541 |
/**
|
|
1542 |
Gets the nanokernel tick count.
|
|
1543 |
|
|
1544 |
This is the current value of the machine's millisecond tick counter.
|
|
1545 |
|
|
1546 |
On the emulator the resolution defaults to 5 milliseconds; however
|
|
1547 |
you can change it to N milliseconds when you launch the emulator
|
|
1548 |
from the command line by specifying -Dtimerresolution=N as a parameter
|
|
1549 |
to epoc.exe, for example:
|
|
1550 |
@code
|
|
1551 |
epoc.exe -Dtimerresolution=3
|
|
1552 |
@endcode
|
|
1553 |
|
|
1554 |
On most hardware the resolution is about 1 millisecond.
|
|
1555 |
|
|
1556 |
You can get the nanokernel tick period in microseconds by calling
|
|
1557 |
into the Hardware Abstraction Layer:
|
|
1558 |
|
|
1559 |
@code
|
|
1560 |
TInt nanokernel_tick_period;
|
|
1561 |
HAL::Get(HAL::ENanoTickPeriod, nanokernel_tick_period);
|
|
1562 |
@endcode
|
|
1563 |
|
|
1564 |
@return The nanokernel tick count.
|
|
1565 |
*/
|
|
1566 |
EXPORT_C TUint32 User::NTickCount()
|
|
1567 |
{
|
|
1568 |
|
|
1569 |
return Exec::NTickCount();
|
|
1570 |
}
|
|
1571 |
|
|
1572 |
|
|
1573 |
|
|
1574 |
|
|
1575 |
/**
|
|
1576 |
Gets the fast counter.
|
|
1577 |
|
|
1578 |
This is the current value of the machine's high resolution timer. If a high
|
|
1579 |
resolution timer is not available, it uses the millisecond timer instead.
|
|
1580 |
|
|
1581 |
The freqency of this counter can be determined by reading the HAL attribute
|
|
1582 |
EFastCounterFrequency.
|
|
1583 |
|
|
1584 |
This function is intended for use in profiling and testing; it should not be
|
|
1585 |
used in production code. User::NTickCount() should be used instead.
|
|
1586 |
|
|
1587 |
This is because the implementation of the FastCounter is platform-specific:
|
|
1588 |
its frequency can be anywhere from a few KHz to many MHz. It may also not
|
|
1589 |
be activated when needed, since it is expensive in terms of clock cycles and
|
|
1590 |
battery life, and use of a platform-specific API may be necessary to enable
|
|
1591 |
it.
|
|
1592 |
|
|
1593 |
@return The fast counter value.
|
|
1594 |
|
|
1595 |
@see User::NTickCount()
|
|
1596 |
*/
|
|
1597 |
EXPORT_C TUint32 User::FastCounter()
|
|
1598 |
{
|
|
1599 |
|
|
1600 |
return Exec::FastCounter();
|
|
1601 |
}
|
|
1602 |
|
|
1603 |
|
|
1604 |
|
|
1605 |
|
|
1606 |
EXPORT_C TTimerLockSpec User::LockPeriod()
|
|
1607 |
/**
|
|
1608 |
Returns which of the periods the clock is currently in.
|
|
1609 |
|
|
1610 |
@return The fraction of a second at which the timer completes.
|
|
1611 |
*/
|
|
1612 |
{
|
|
1613 |
|
|
1614 |
return(Exec::LockPeriod());
|
|
1615 |
}
|
|
1616 |
|
|
1617 |
|
|
1618 |
|
|
1619 |
|
|
1620 |
EXPORT_C TName RHandleBase::Name() const
|
|
1621 |
/**
|
|
1622 |
Gets the name of the handle.
|
|
1623 |
|
|
1624 |
@return The name of the handle.
|
|
1625 |
*/
|
|
1626 |
{
|
|
1627 |
|
|
1628 |
TName n;
|
|
1629 |
TPtr8 n8(((TUint8*)n.Ptr()) + KMaxName, KMaxName);
|
|
1630 |
Exec::HandleName(iHandle,n8);
|
|
1631 |
n.Copy(n8);
|
|
1632 |
return(n);
|
|
1633 |
}
|
|
1634 |
|
|
1635 |
|
|
1636 |
|
|
1637 |
|
|
1638 |
EXPORT_C TFullName RHandleBase::FullName() const
|
|
1639 |
/**
|
|
1640 |
Gets the full name of the handle.
|
|
1641 |
|
|
1642 |
Note: This method is stack consuming (it takes 512 bytes on stack to execute).
|
|
1643 |
For an alternative way to obtain the full name of the object, see RHandleBase::FullName(TDes& aName) const.
|
|
1644 |
|
|
1645 |
@see RHandleBase::FullName(TDes& aName) const
|
|
1646 |
@return The full name of the handle.
|
|
1647 |
*/
|
|
1648 |
{
|
|
1649 |
|
|
1650 |
TFullName n;
|
|
1651 |
TPtr8 n8(((TUint8*)n.Ptr()) + KMaxFullName, KMaxFullName);
|
|
1652 |
Exec::HandleFullName(iHandle,n8);
|
|
1653 |
n.Copy(n8);
|
|
1654 |
return(n);
|
|
1655 |
}
|
|
1656 |
|
|
1657 |
|
|
1658 |
|
|
1659 |
|
|
1660 |
EXPORT_C void RHandleBase::FullName(TDes& aName) const
|
|
1661 |
/**
|
|
1662 |
Gets the full name of the handle.
|
|
1663 |
|
|
1664 |
@param aName On return, contains the full name of the handle.
|
|
1665 |
|
|
1666 |
@panic KERN-EXEC 35, If full name of the handler is longer that the maximum length of aName descriptor.
|
|
1667 |
To avoid this, the maximum length of aName should be at least KMaxFullName.
|
|
1668 |
@see KMaxFullName
|
|
1669 |
*/
|
|
1670 |
{
|
|
1671 |
|
|
1672 |
// Kernel will copy string in n8, whose data lives in the upper half of aName desciptor data
|
|
1673 |
TPtr8 n8(((TUint8*)aName.Ptr()) + aName.MaxLength(), aName.MaxLength());
|
|
1674 |
Exec::HandleFullName(iHandle,n8);
|
|
1675 |
aName.Copy(n8); // Expands 8bit descriptor into 16bit unicode descriptor.
|
|
1676 |
}
|
|
1677 |
|
|
1678 |
|
|
1679 |
|
|
1680 |
|
|
1681 |
EXPORT_C void RHandleBase::HandleInfo(THandleInfo* anInfo)
|
|
1682 |
/**
|
|
1683 |
Gets information about the handle.
|
|
1684 |
|
|
1685 |
@param anInfo A pointer to a THandleInfo object supplied by the caller;
|
|
1686 |
on return, contains the handle information.
|
|
1687 |
*/
|
|
1688 |
{
|
|
1689 |
|
|
1690 |
Exec::HandleInfo(iHandle,anInfo);
|
|
1691 |
}
|
|
1692 |
|
|
1693 |
EXPORT_C TInt RHandleBase::BTraceId() const
|
|
1694 |
/**
|
|
1695 |
Returns a unique object identifier for use with BTrace
|
|
1696 |
*/
|
|
1697 |
{
|
|
1698 |
return Exec::GetBTraceId(iHandle);
|
|
1699 |
}
|
|
1700 |
|
|
1701 |
|
|
1702 |
|
|
1703 |
EXPORT_C TUint RHandleBase::Attributes() const
|
|
1704 |
//
|
|
1705 |
// Get handle attributes
|
|
1706 |
//
|
|
1707 |
{
|
|
1708 |
|
|
1709 |
return Exec::HandleAttributes(iHandle);
|
|
1710 |
}
|
|
1711 |
|
|
1712 |
|
|
1713 |
|
|
1714 |
|
|
1715 |
EXPORT_C TInt User::AllocLen(const TAny *aCell)
|
|
1716 |
/**
|
|
1717 |
Gets the length of the specified allocated heap cell.
|
|
1718 |
|
|
1719 |
The cell is assumed to be in the current thread's heap.
|
|
1720 |
|
|
1721 |
@param aCell A pointer to the allocated cell whose length
|
|
1722 |
is to be fetched.
|
|
1723 |
|
|
1724 |
@return The length of the allocated cell.
|
|
1725 |
*/
|
|
1726 |
{
|
|
1727 |
|
|
1728 |
return(GetHeap()->AllocLen(aCell));
|
|
1729 |
}
|
|
1730 |
|
|
1731 |
|
|
1732 |
|
|
1733 |
|
|
1734 |
EXPORT_C TAny* User::Alloc(TInt aSize)
|
|
1735 |
/**
|
|
1736 |
Allocates a cell of specified size from the current thread's heap.
|
|
1737 |
|
|
1738 |
If there is insufficient memory available on the heap from which to allocate a cell
|
|
1739 |
of the required size, the function returns NULL.
|
|
1740 |
|
|
1741 |
The resulting size of the allocated cell may be rounded up to a value greater
|
|
1742 |
than aSize, but is guaranteed to be not less than aSize.
|
|
1743 |
|
|
1744 |
@param aSize The size of the cell to be allocated from the current thread's
|
|
1745 |
heap.
|
|
1746 |
|
|
1747 |
@return A pointer to the allocated cell. NULL, if there is insufficient memory
|
|
1748 |
available.
|
|
1749 |
|
|
1750 |
@panic USER 47, if the maximum unsigned value of aSize is greater
|
|
1751 |
than or equal to KMaxTInt/2. For example,
|
|
1752 |
calling Alloc(-1) raises this panic.
|
|
1753 |
*/
|
|
1754 |
{
|
|
1755 |
|
|
1756 |
return(GetHeap()->Alloc(aSize));
|
|
1757 |
}
|
|
1758 |
|
|
1759 |
|
|
1760 |
|
|
1761 |
|
|
1762 |
EXPORT_C TAny* User::AllocL(TInt aSize)
|
|
1763 |
/**
|
|
1764 |
Allocates a cell of specified size from the current thread's heap, and leaves
|
|
1765 |
if there is insufficient memory in the heap.
|
|
1766 |
|
|
1767 |
The resulting size of the allocated cell may be rounded up to a value greater
|
|
1768 |
than aSize, but is guaranteed to be not less than aSize.
|
|
1769 |
|
|
1770 |
@param aSize The size of the cell to be allocated from the current thread's
|
|
1771 |
heap.
|
|
1772 |
|
|
1773 |
@return A pointer to the allocated cell.
|
|
1774 |
|
|
1775 |
@panic USER 47, if the maximum unsigned value of aSize is greater
|
|
1776 |
than or equal to KMaxTInt/2. For example,
|
|
1777 |
calling Alloc(-1) raises this panic.
|
|
1778 |
*/
|
|
1779 |
{
|
|
1780 |
|
|
1781 |
return(GetHeap()->AllocL(aSize));
|
|
1782 |
}
|
|
1783 |
|
|
1784 |
|
|
1785 |
|
|
1786 |
|
|
1787 |
EXPORT_C TAny *User::AllocLC(TInt aSize)
|
|
1788 |
/**
|
|
1789 |
Allocates a cell of specified size from the current thread's default heap, and,
|
|
1790 |
if successful, places a pointer to the cell onto the cleanup stack.
|
|
1791 |
|
|
1792 |
The function leaves if there is insufficient memory in the heap.
|
|
1793 |
|
|
1794 |
The resulting size of the allocated cell may be rounded up to a value greater
|
|
1795 |
than aSize, but is guaranteed to be not less than aSize.
|
|
1796 |
|
|
1797 |
@param aSize The size of the cell to be allocated from the current thread's
|
|
1798 |
default heap.
|
|
1799 |
|
|
1800 |
@return A pointer to the allocated cell.
|
|
1801 |
|
|
1802 |
@panic USER 47, if the maximum unsigned value of aSize is greater
|
|
1803 |
than or equal to KMaxTInt/2. For example,
|
|
1804 |
calling Alloc(-1) raises this panic.
|
|
1805 |
*/
|
|
1806 |
{
|
|
1807 |
|
|
1808 |
return(GetHeap()->AllocLC(aSize));
|
|
1809 |
}
|
|
1810 |
|
|
1811 |
|
|
1812 |
|
|
1813 |
|
|
1814 |
EXPORT_C TAny* User::AllocZ(TInt aSize)
|
|
1815 |
/**
|
|
1816 |
Allocates a cell of specified size from the current thread's default heap,
|
|
1817 |
and clears it to binary zeroes.
|
|
1818 |
|
|
1819 |
If there is insufficient memory available on the heap from which to allocate a cell
|
|
1820 |
of the required size, the function returns NULL.
|
|
1821 |
|
|
1822 |
The resulting size of the allocated cell may be rounded up to a value greater
|
|
1823 |
than aSize, but is guaranteed to be not less than aSize.
|
|
1824 |
|
|
1825 |
@param aSize The size of the cell to be allocated from the current thread's
|
|
1826 |
default heap.
|
|
1827 |
|
|
1828 |
@return A pointer to the allocated cell. NULL, if there is insufficient memory
|
|
1829 |
available.
|
|
1830 |
|
|
1831 |
@panic USER 47, if the maximum unsigned value of aSize is greater
|
|
1832 |
than or equal to KMaxTInt/2. For example,
|
|
1833 |
calling Alloc(-1) raises this panic.
|
|
1834 |
*/
|
|
1835 |
{
|
|
1836 |
|
|
1837 |
return GetHeap()->AllocZ(aSize);
|
|
1838 |
}
|
|
1839 |
|
|
1840 |
|
|
1841 |
|
|
1842 |
|
|
1843 |
EXPORT_C TAny* User::AllocZL(TInt aSize)
|
|
1844 |
/**
|
|
1845 |
Allocates a cell of specified size from the current thread's default heap,
|
|
1846 |
clears it to binary zeroes, and leaves if there is insufficient memory in
|
|
1847 |
the heap.
|
|
1848 |
|
|
1849 |
The resulting size of the allocated cell may be rounded up to a value greater
|
|
1850 |
than aSize, but is guaranteed to be not less than aSize.
|
|
1851 |
|
|
1852 |
@param aSize The size of the cell to be allocated from the current thread's
|
|
1853 |
heap.
|
|
1854 |
|
|
1855 |
@return A pointer to the allocated cell.
|
|
1856 |
|
|
1857 |
@panic USER 47, if the maximum unsigned value of aSize is greater
|
|
1858 |
than or equal to KMaxTInt/2. For example,
|
|
1859 |
calling Alloc(-1) raises this panic.
|
|
1860 |
*/
|
|
1861 |
{
|
|
1862 |
|
|
1863 |
return GetHeap()->AllocZL(aSize);
|
|
1864 |
}
|
|
1865 |
|
|
1866 |
|
|
1867 |
|
|
1868 |
|
|
1869 |
EXPORT_C TInt User::Available(TInt &aBiggestBlock)
|
|
1870 |
/**
|
|
1871 |
Gets the total free space currently available on the current thread's
|
|
1872 |
default heap, and the space available in the largest free block.
|
|
1873 |
|
|
1874 |
The space available represents the total space which can be allocated.
|
|
1875 |
|
|
1876 |
Note that compressing the heap may reduce the total free space available and the space
|
|
1877 |
available in the largest free block.
|
|
1878 |
|
|
1879 |
@param aBiggestBlock On return, contains the space available in the largest
|
|
1880 |
free block on the current thread's default heap.
|
|
1881 |
|
|
1882 |
@return The total free space currently available on the current thread's heap.
|
|
1883 |
*/
|
|
1884 |
{
|
|
1885 |
|
|
1886 |
return(GetHeap()->Available(aBiggestBlock));
|
|
1887 |
}
|
|
1888 |
|
|
1889 |
|
|
1890 |
|
|
1891 |
|
|
1892 |
EXPORT_C void User::Check()
|
|
1893 |
/**
|
|
1894 |
Checks the validity of the current thread's default heap.
|
|
1895 |
|
|
1896 |
The function walks through the list of allocated cells and the list of free
|
|
1897 |
cells checking that the heap is consistent and complete.
|
|
1898 |
|
|
1899 |
@panic USER 47 if any corruption is found, specifically a bad allocated
|
|
1900 |
heap cell size.
|
|
1901 |
@panic USER 48 if any corruption is found, specifically a bad allocated
|
|
1902 |
heap cell address.
|
|
1903 |
@panic USER 49 if any corruption is found, specifically a bad free heap
|
|
1904 |
cell address.
|
|
1905 |
*/
|
|
1906 |
{
|
|
1907 |
|
|
1908 |
GetHeap()->Check();
|
|
1909 |
}
|
|
1910 |
|
|
1911 |
|
|
1912 |
|
|
1913 |
|
|
1914 |
EXPORT_C void User::Free(TAny *aCell)
|
|
1915 |
/**
|
|
1916 |
Frees the specified cell and returns it to the current thread's default heap.
|
|
1917 |
|
|
1918 |
@param aCell A pointer to a valid cell to be freed. If NULL this function
|
|
1919 |
call will be ignored.
|
|
1920 |
|
|
1921 |
@panic USER 42, if aCell is not NULL and does not point to a valid cell.
|
|
1922 |
*/
|
|
1923 |
{
|
|
1924 |
|
|
1925 |
if (aCell)
|
|
1926 |
GetHeap()->Free(aCell);
|
|
1927 |
}
|
|
1928 |
|
|
1929 |
|
|
1930 |
|
|
1931 |
|
|
1932 |
EXPORT_C void User::FreeZ(TAny * &aCell)
|
|
1933 |
/**
|
|
1934 |
Frees the specified cell, returns it to the current thread's default heap, and resets
|
|
1935 |
the pointer to NULL.
|
|
1936 |
|
|
1937 |
@param aCell A reference to a pointer to a valid cell to be freed. If NULL
|
|
1938 |
this function call will be ignored.
|
|
1939 |
|
|
1940 |
@panic USER 42, if aCell is not NULL and does not point to a valid cell.
|
|
1941 |
*/
|
|
1942 |
{
|
|
1943 |
|
|
1944 |
if (aCell)
|
|
1945 |
GetHeap()->FreeZ(aCell);
|
|
1946 |
}
|
|
1947 |
|
|
1948 |
|
|
1949 |
|
|
1950 |
|
|
1951 |
EXPORT_C TAny* User::ReAlloc(TAny* aCell, TInt aSize, TInt aMode)
|
|
1952 |
/**
|
|
1953 |
Increases or decreases the size of an existing cell in the current
|
|
1954 |
thread's heap.
|
|
1955 |
|
|
1956 |
If the cell is being decreased in size, then it is guaranteed not to move,
|
|
1957 |
and the function returns the pointer originally passed in aCell. Note that the
|
|
1958 |
length of the cell will be the same if the difference between the old size
|
|
1959 |
and the new size is smaller than the minimum cell size.
|
|
1960 |
|
|
1961 |
If the cell is being increased in size, i.e. aSize is bigger than its
|
|
1962 |
current size, then the function tries to grow the cell in place.
|
|
1963 |
If successful, then the function returns the pointer originally
|
|
1964 |
passed in aCell. If unsuccessful, then:
|
|
1965 |
-# if the cell cannot be moved, i.e. aMode has the ENeverMove bit set, then
|
|
1966 |
the function returns NULL.
|
|
1967 |
-# if the cell can be moved, i.e. aMode does not have the ENeverMove bit set,
|
|
1968 |
then the function tries to allocate a new replacement cell, and, if
|
|
1969 |
successful, returns a pointer to the new cell; if unsuccessful, it
|
|
1970 |
returns NULL.
|
|
1971 |
|
|
1972 |
Note that in debug mode, the function returns NULL if the cell cannot be grown
|
|
1973 |
in place, regardless of whether the ENeverMove bit is set.
|
|
1974 |
|
|
1975 |
If the reallocated cell is at a different location from the original cell, then
|
|
1976 |
the content of the original cell is copied to the reallocated cell.
|
|
1977 |
|
|
1978 |
If the supplied pointer, aCell is NULL, then the function attempts to allocate
|
|
1979 |
a new cell, but only if the cell can be moved, i.e. aMode does not have
|
|
1980 |
the ENeverMove bit set.
|
|
1981 |
|
|
1982 |
Note the following general points:
|
|
1983 |
- If reallocation fails, the content of the original cell is preserved.
|
|
1984 |
- The resulting size of the re-allocated cell may be rounded up to a value
|
|
1985 |
greater than aSize, but is guaranteed to be not less than aSize.
|
|
1986 |
|
|
1987 |
@param aCell A pointer to the cell to be reallocated. This may be NULL.
|
|
1988 |
|
|
1989 |
@param aSize The new size of the cell. This may be bigger or smaller than the
|
|
1990 |
size of the original cell. The value can also be zero, but this is
|
|
1991 |
interpreted as a request for a cell of minimum size; the net
|
|
1992 |
effect is the same as if the caller had explicitly requested
|
|
1993 |
a cell of minimum size.
|
|
1994 |
Note that the minimum size of a heap cell is device dependent.
|
|
1995 |
|
|
1996 |
@param aMode Flags controlling the reallocation. The only bit which has any
|
|
1997 |
effect on this function is that defined by the enumeration
|
|
1998 |
ENeverMove of the enum RAllocator::TReAllocMode.
|
|
1999 |
If this is set, then any successful reallocation guarantees not
|
|
2000 |
to have changed the start address of the cell.
|
|
2001 |
By default, this parameter is zero.
|
|
2002 |
|
|
2003 |
@return A pointer to the reallocated cell. This may be the same as the original
|
|
2004 |
pointer supplied through aCell. NULL if there is insufficient memory to
|
|
2005 |
reallocate the cell, or to grow it in place.
|
|
2006 |
|
|
2007 |
@panic USER 42, if aCell is not NULL, and does not point to a valid cell.
|
|
2008 |
@panic USER 47, if the maximum unsigned value of aSize is greater
|
|
2009 |
than or equal to KMaxTInt/2. For example,
|
|
2010 |
calling ReAlloc(someptr,-1) raises this panic.
|
|
2011 |
|
|
2012 |
@see RAllocator::TReAllocMode
|
|
2013 |
*/
|
|
2014 |
{
|
|
2015 |
|
|
2016 |
return GetHeap()->ReAlloc(aCell, aSize, aMode);
|
|
2017 |
}
|
|
2018 |
|
|
2019 |
|
|
2020 |
|
|
2021 |
|
|
2022 |
EXPORT_C TAny* User::ReAllocL(TAny* aCell, TInt aSize, TInt aMode)
|
|
2023 |
/**
|
|
2024 |
Increases or decreases the size of an existing cell, and leaves
|
|
2025 |
if there is insufficient memory in the current thread's default heap.
|
|
2026 |
|
|
2027 |
If the cell is being decreased in size, then it is guaranteed not to move,
|
|
2028 |
and the function returns the pointer originally passed in aCell. Note that the
|
|
2029 |
length of the cell will be the same if the difference between the old size
|
|
2030 |
and the new size is smaller than the minimum cell size.
|
|
2031 |
|
|
2032 |
If the cell is being increased in size, i.e. aSize is bigger than its
|
|
2033 |
current size, then the function tries to grow the cell in place.
|
|
2034 |
If successful, then the function returns the pointer originally
|
|
2035 |
passed in aCell. If unsuccessful, then:
|
|
2036 |
-# if the cell cannot be moved, i.e. aMode has the ENeverMove bit set, then
|
|
2037 |
the function leaves.
|
|
2038 |
-# if the cell can be moved, i.e. aMode does not have the ENeverMove bit set,
|
|
2039 |
then the function tries to allocate a new replacement cell, and, if
|
|
2040 |
successful, returns a pointer to the new cell; if unsuccessful, it
|
|
2041 |
leaves.
|
|
2042 |
|
|
2043 |
Note that in debug mode, the function leaves if the cell cannot be grown
|
|
2044 |
in place, regardless of whether the ENeverMove bit is set.
|
|
2045 |
|
|
2046 |
If the reallocated cell is at a different location from the original cell, then
|
|
2047 |
the content of the original cell is copied to the reallocated cell.
|
|
2048 |
|
|
2049 |
If the supplied pointer, aCell is NULL, then the function attempts to allocate
|
|
2050 |
a new cell, but only if the cell can be moved, i.e. aMode does not have
|
|
2051 |
the ENeverMove bit set.
|
|
2052 |
|
|
2053 |
Note the following general points:
|
|
2054 |
- If reallocation fails, the content of the original cell is preserved.
|
|
2055 |
- The resulting size of the re-allocated cell may be rounded up to a value
|
|
2056 |
greater than aSize, but is guaranteed to be not less than aSize.
|
|
2057 |
|
|
2058 |
@param aCell A pointer to the cell to be reallocated. This may be NULL.
|
|
2059 |
|
|
2060 |
@param aSize The new size of the cell. This may be bigger or smaller than the
|
|
2061 |
size of the original cell. The value can also be zero, but this is
|
|
2062 |
interpreted as a request for a cell of minimum size; the net
|
|
2063 |
effect is the same as if the caller had explicitly requested
|
|
2064 |
a cell of minimum size.
|
|
2065 |
Note that the minimum size of a heap cell is device dependent.
|
|
2066 |
|
|
2067 |
@param aMode Flags controlling the reallocation. The only bit which has any
|
|
2068 |
effect on this function is that defined by the enumeration
|
|
2069 |
ENeverMove of the enum RAllocator::TReAllocMode.
|
|
2070 |
If this is set, then any successful reallocation guarantees not
|
|
2071 |
to have changed the start address of the cell.
|
|
2072 |
By default, this parameter is zero.
|
|
2073 |
|
|
2074 |
@return A pointer to the reallocated cell. This may be the same as the original
|
|
2075 |
pointer supplied through aCell.
|
|
2076 |
|
|
2077 |
@panic USER 42, if aCell is not NULL, and does not point to a valid cell.
|
|
2078 |
@panic USER 47, if the maximum unsigned value of aSize is greater
|
|
2079 |
than or equal to KMaxTInt/2. For example,
|
|
2080 |
calling ReAlloc(someptr,-1) raises this panic.
|
|
2081 |
|
|
2082 |
@see RAllocator::TReAllocMode
|
|
2083 |
*/
|
|
2084 |
{
|
|
2085 |
|
|
2086 |
return GetHeap()->ReAllocL(aCell, aSize, aMode);
|
|
2087 |
}
|
|
2088 |
|
|
2089 |
|
|
2090 |
|
|
2091 |
|
|
2092 |
EXPORT_C RAllocator& User::Allocator()
|
|
2093 |
/**
|
|
2094 |
Gets the current thread's default current heap.
|
|
2095 |
|
|
2096 |
@return The current heap.
|
|
2097 |
*/
|
|
2098 |
{
|
|
2099 |
|
|
2100 |
return *GetHeap();
|
|
2101 |
}
|
|
2102 |
|
|
2103 |
|
|
2104 |
|
|
2105 |
|
|
2106 |
EXPORT_C TInt User::AllocSize(TInt &aTotalAllocSize)
|
|
2107 |
/**
|
|
2108 |
Gets the total number of cells allocated on the current thread's default heap,
|
|
2109 |
and the total space allocated to them.
|
|
2110 |
|
|
2111 |
@param aTotalAllocSize On return, contains the total space allocated to
|
|
2112 |
the cells.
|
|
2113 |
|
|
2114 |
@return The number of cells currently allocated on the current thread's heap.
|
|
2115 |
*/
|
|
2116 |
{
|
|
2117 |
|
|
2118 |
return(GetHeap()->AllocSize(aTotalAllocSize));
|
|
2119 |
}
|
|
2120 |
|
|
2121 |
|
|
2122 |
|
|
2123 |
|
|
2124 |
EXPORT_C TInt User::CountAllocCells()
|
|
2125 |
/**
|
|
2126 |
Gets the total number of cells allocated on the current thread's default heap.
|
|
2127 |
|
|
2128 |
|
|
2129 |
@return The number of cells allocated on the current thread's default user heap.
|
|
2130 |
*/
|
|
2131 |
{
|
|
2132 |
return(GetHeap()->Count());
|
|
2133 |
}
|
|
2134 |
|
|
2135 |
|
|
2136 |
|
|
2137 |
|
|
2138 |
EXPORT_C TInt User::CountAllocCells(TInt &aFreeCount)
|
|
2139 |
/**
|
|
2140 |
Gets the the total number of cells allocated, and the number of free cells,
|
|
2141 |
on the current thread's default heap.
|
|
2142 |
|
|
2143 |
@param aFreeCount On return, contains the number of free cells
|
|
2144 |
on the current thread's default heap.
|
|
2145 |
|
|
2146 |
@return The number of cells allocated on the current thread's default heap.
|
|
2147 |
*/
|
|
2148 |
{
|
|
2149 |
|
|
2150 |
return(GetHeap()->Count(aFreeCount));
|
|
2151 |
}
|
|
2152 |
|
|
2153 |
|
|
2154 |
|
|
2155 |
|
|
2156 |
EXPORT_C RAllocator* User::SwitchAllocator(RAllocator* aA)
|
|
2157 |
/**
|
|
2158 |
Changes the current thread's heap.
|
|
2159 |
|
|
2160 |
@param aA A pointer to the new heap handle.
|
|
2161 |
|
|
2162 |
@return A pointer to the old heap handle.
|
|
2163 |
*/
|
|
2164 |
{
|
|
2165 |
|
|
2166 |
#ifdef __USERSIDE_THREAD_DATA__
|
|
2167 |
// Just cache the pointer user-side. We still need to let the kernel know what's going on so
|
|
2168 |
// the heap can be cleaned up correctly later.
|
|
2169 |
LocalThreadData()->iHeap=aA;
|
|
2170 |
#endif
|
|
2171 |
return Exec::HeapSwitch(aA);
|
|
2172 |
}
|
|
2173 |
|
|
2174 |
// The suffix table
|
|
2175 |
const TText16* const __DefaultDateSuffixTable[KMaxSuffixes] =
|
|
2176 |
{
|
|
2177 |
_S16("st"),_S16("nd"),_S16("rd"),_S16("th"),_S16("th"),
|
|
2178 |
_S16("th"),_S16("th"),_S16("th"),_S16("th"),_S16("th"),
|
|
2179 |
_S16("th"),_S16("th"),_S16("th"),_S16("th"),_S16("th"),
|
|
2180 |
_S16("th"),_S16("th"),_S16("th"),_S16("th"),_S16("th"),
|
|
2181 |
_S16("st"),_S16("nd"),_S16("rd"),_S16("th"),_S16("th"),
|
|
2182 |
_S16("th"),_S16("th"),_S16("th"),_S16("th"),_S16("th"),
|
|
2183 |
_S16("st")
|
|
2184 |
};
|
|
2185 |
|
|
2186 |
// The day names
|
|
2187 |
const TText16* const __DefaultDayTable[KMaxDays] =
|
|
2188 |
{
|
|
2189 |
_S16("Monday"),
|
|
2190 |
_S16("Tuesday"),
|
|
2191 |
_S16("Wednesday"),
|
|
2192 |
_S16("Thursday"),
|
|
2193 |
_S16("Friday"),
|
|
2194 |
_S16("Saturday"),
|
|
2195 |
_S16("Sunday")
|
|
2196 |
};
|
|
2197 |
|
|
2198 |
// The abbreviated day names
|
|
2199 |
const TText16* const __DefaultDayAbbTable[KMaxDays] =
|
|
2200 |
{
|
|
2201 |
_S16("Mon"),
|
|
2202 |
_S16("Tue"),
|
|
2203 |
_S16("Wed"),
|
|
2204 |
_S16("Thu"),
|
|
2205 |
_S16("Fri"),
|
|
2206 |
_S16("Sat"),
|
|
2207 |
_S16("Sun")
|
|
2208 |
};
|
|
2209 |
|
|
2210 |
// The month names
|
|
2211 |
const TText16* const __DefaultMonthTable[KMaxMonths] =
|
|
2212 |
{
|
|
2213 |
_S16("January"),
|
|
2214 |
_S16("February"),
|
|
2215 |
_S16("March"),
|
|
2216 |
_S16("April"),
|
|
2217 |
_S16("May"),
|
|
2218 |
_S16("June"),
|
|
2219 |
_S16("July"),
|
|
2220 |
_S16("August"),
|
|
2221 |
_S16("September"),
|
|
2222 |
_S16("October"),
|
|
2223 |
_S16("November"),
|
|
2224 |
_S16("December")
|
|
2225 |
};
|
|
2226 |
|
|
2227 |
// The abbreviated month names
|
|
2228 |
const TText16* const __DefaultMonthAbbTable[KMaxMonths] =
|
|
2229 |
{
|
|
2230 |
_S16("Jan"),
|
|
2231 |
_S16("Feb"),
|
|
2232 |
_S16("Mar"),
|
|
2233 |
_S16("Apr"),
|
|
2234 |
_S16("May"),
|
|
2235 |
_S16("Jun"),
|
|
2236 |
_S16("Jul"),
|
|
2237 |
_S16("Aug"),
|
|
2238 |
_S16("Sep"),
|
|
2239 |
_S16("Oct"),
|
|
2240 |
_S16("Nov"),
|
|
2241 |
_S16("Dec")
|
|
2242 |
};
|
|
2243 |
|
|
2244 |
// The am/pm strings
|
|
2245 |
const TText16* const __DefaultAmPmTable[KMaxAmPms] =
|
|
2246 |
{
|
|
2247 |
_S16("am"),
|
|
2248 |
_S16("pm")
|
|
2249 |
};
|
|
2250 |
|
|
2251 |
const TText16* const __DefaultLMsgTable[ELocaleMessages_LastMsg] =
|
|
2252 |
{
|
|
2253 |
// Fileserver
|
|
2254 |
_S16("Retry"), // Button 1
|
|
2255 |
_S16("Stop"), // Button 2
|
|
2256 |
_S16("Put the disk back"), // Put the card back - line1
|
|
2257 |
_S16("or data will be lost"), // Put the card back - line2
|
|
2258 |
_S16("Batteries too low"), // Low power - line1
|
|
2259 |
_S16("Cannot complete write to disk"), // Low power - line2
|
|
2260 |
_S16("Disk error - cannot complete write"), // Disk error - line1
|
|
2261 |
_S16("Retry or data will be lost"), // Disk error - line2
|
|
2262 |
// SoundDriver
|
|
2263 |
_S16("Chimes"), // Chimes
|
|
2264 |
_S16("Rings"), // Rings
|
|
2265 |
_S16("Signal"), // Signal
|
|
2266 |
// MediaDriver diskname (max 16 chars)
|
|
2267 |
_S16("Internal"), // Internal
|
|
2268 |
_S16("External(01)"), // External(01)
|
|
2269 |
_S16("External(02)"), // External(02)
|
|
2270 |
_S16("External(03)"), // External(03)
|
|
2271 |
_S16("External(04)"), // External(04)
|
|
2272 |
_S16("External(05)"), // External(05)
|
|
2273 |
_S16("External(06)"), // External(06)
|
|
2274 |
_S16("External(07)"), // External(07)
|
|
2275 |
_S16("External(08)"), // External(08)
|
|
2276 |
// MediaDriver socketname (max 16 chars)
|
|
2277 |
_S16("Socket(01)"), // Socket(01)
|
|
2278 |
_S16("Socket(02)"), // Socket(02)
|
|
2279 |
_S16("Socket(03)"), // Socket(03)
|
|
2280 |
_S16("Socket(04)") // Socket(04)
|
|
2281 |
};
|
|
2282 |
|
|
2283 |
LOCAL_C void LocaleLanguageGet(SLocaleLanguage& locale)
|
|
2284 |
{
|
|
2285 |
TPckg<SLocaleLanguage> localeLanguageBuf(locale);
|
|
2286 |
TInt r = RProperty::Get(KUidSystemCategory, KLocaleLanguageKey, localeLanguageBuf);
|
|
2287 |
__ASSERT_DEBUG(r == KErrNone || r == KErrNotFound, Panic(EBadLocaleParameter));
|
|
2288 |
if(r == KErrNotFound)
|
|
2289 |
{
|
|
2290 |
locale.iLanguage = ELangEnglish;
|
|
2291 |
locale.iDateSuffixTable = (const TText16*)__DefaultDateSuffixTable;
|
|
2292 |
locale.iDayTable = (const TText16*)__DefaultDayTable;
|
|
2293 |
locale.iDayAbbTable = (const TText16*)__DefaultDayAbbTable;
|
|
2294 |
locale.iMonthTable = (const TText16*)__DefaultMonthTable;
|
|
2295 |
locale.iMonthAbbTable = (const TText16*)__DefaultMonthAbbTable;
|
|
2296 |
locale.iAmPmTable = (const TText16*)__DefaultAmPmTable;
|
|
2297 |
locale.iMsgTable = (const TText16* const*)__DefaultLMsgTable;
|
|
2298 |
}
|
|
2299 |
}
|
|
2300 |
|
|
2301 |
LOCAL_C void LocaleSettingsGet(SLocaleLocaleSettings& locale)
|
|
2302 |
{
|
|
2303 |
TPckg<SLocaleLocaleSettings> localeSettingsBuf(locale);
|
|
2304 |
TInt r = RProperty::Get(KUidSystemCategory, KLocaleDataExtraKey, localeSettingsBuf);
|
|
2305 |
__ASSERT_DEBUG(r == KErrNone || r == KErrNotFound, Panic(EBadLocaleParameter));
|
|
2306 |
if(r == KErrNotFound)
|
|
2307 |
{
|
|
2308 |
Mem::Copy(&locale.iCurrencySymbol[0], _S16("\x00a3"), sizeof(TText16) << 2);
|
|
2309 |
locale.iLocaleExtraSettingsDllPtr = NULL;
|
|
2310 |
}
|
|
2311 |
}
|
|
2312 |
|
|
2313 |
LOCAL_C void LocaleTimeDateFormatGet(SLocaleTimeDateFormat& locale)
|
|
2314 |
{
|
|
2315 |
TPckg<SLocaleTimeDateFormat> localeTimeDateFormatBuf(locale);
|
|
2316 |
TInt r = RProperty::Get(KUidSystemCategory, KLocaleTimeDateFormatKey, localeTimeDateFormatBuf);
|
|
2317 |
__ASSERT_DEBUG(r == KErrNone || r == KErrNotFound, Panic(EBadLocaleParameter));
|
|
2318 |
if(r == KErrNotFound)
|
|
2319 |
{
|
|
2320 |
Mem::Copy(&locale.iShortDateFormatSpec[0], _S16("%F%*D/%*M/%Y"), sizeof(TText16) * 13);
|
|
2321 |
Mem::Copy(&locale.iLongDateFormatSpec[0], _S16("%F%*D%X %N %Y"), sizeof(TText16) * 14);
|
|
2322 |
Mem::Copy(&locale.iTimeFormatSpec[0], _S16("%F%*I:%T:%S %*A"), sizeof(TText16) * 16);
|
|
2323 |
locale.iLocaleTimeDateFormatDllPtr = NULL;
|
|
2324 |
}
|
|
2325 |
}
|
|
2326 |
|
|
2327 |
EXPORT_C void TDayName::Set(TDay aDay)
|
|
2328 |
/**
|
|
2329 |
Re-retrieves the current locale's text for the specified day of the week.
|
|
2330 |
|
|
2331 |
@param aDay Identifies the day of the week.
|
|
2332 |
|
|
2333 |
@panic USER 184, if the specified day is outside the permitted range.
|
|
2334 |
*/
|
|
2335 |
{
|
|
2336 |
|
|
2337 |
__ASSERT_ALWAYS(aDay>=EMonday && aDay<=ESunday,Panic(EBadLocaleParameter));
|
|
2338 |
SLocaleLanguage localeLanguage;
|
|
2339 |
LocaleLanguageGet(localeLanguage);
|
|
2340 |
Copy((reinterpret_cast<const TText* const*>(localeLanguage.iDayTable))[aDay]);
|
|
2341 |
}
|
|
2342 |
|
|
2343 |
|
|
2344 |
|
|
2345 |
|
|
2346 |
EXPORT_C void TDayNameAbb::Set(TDay aDay)
|
|
2347 |
/**
|
|
2348 |
Re-retrieves the current locale's abbreviated text for the specified day of
|
|
2349 |
the week.
|
|
2350 |
|
|
2351 |
@param aDay Identifies the day of the week.
|
|
2352 |
|
|
2353 |
@panic USER 184, if the specified day is outside the permitted range.
|
|
2354 |
*/
|
|
2355 |
{
|
|
2356 |
|
|
2357 |
__ASSERT_ALWAYS(aDay>=EMonday && aDay<=ESunday,Panic(EBadLocaleParameter));
|
|
2358 |
SLocaleLanguage localeLanguage;
|
|
2359 |
LocaleLanguageGet(localeLanguage);
|
|
2360 |
Copy((reinterpret_cast<const TText* const*>(localeLanguage.iDayAbbTable))[aDay]);
|
|
2361 |
}
|
|
2362 |
|
|
2363 |
|
|
2364 |
|
|
2365 |
|
|
2366 |
EXPORT_C void TMonthName::Set(TMonth aMonth)
|
|
2367 |
/**
|
|
2368 |
Re-retrieves the current locale's text for the specified month.
|
|
2369 |
|
|
2370 |
@param aMonth Identifies the month.
|
|
2371 |
|
|
2372 |
@panic USER 184, if the specified month is outside the permitted range.
|
|
2373 |
*/
|
|
2374 |
{
|
|
2375 |
|
|
2376 |
__ASSERT_ALWAYS(aMonth>=EJanuary && aMonth<=EDecember,Panic(EBadLocaleParameter));
|
|
2377 |
SLocaleLanguage localeLanguage;
|
|
2378 |
LocaleLanguageGet(localeLanguage);
|
|
2379 |
Copy((reinterpret_cast<const TText* const*>(localeLanguage.iMonthTable))[aMonth]);
|
|
2380 |
}
|
|
2381 |
|
|
2382 |
|
|
2383 |
|
|
2384 |
|
|
2385 |
EXPORT_C void TMonthNameAbb::Set(TMonth aMonth)
|
|
2386 |
/**
|
|
2387 |
Re-retrieves the current locale's abbreviated text for the specified month.
|
|
2388 |
|
|
2389 |
@param aMonth Identifies the month.
|
|
2390 |
|
|
2391 |
@panic USER 184, if the specified month is outside the permitted range.
|
|
2392 |
*/
|
|
2393 |
{
|
|
2394 |
|
|
2395 |
__ASSERT_ALWAYS(aMonth>=EJanuary && aMonth<=EDecember,Panic(EBadLocaleParameter));
|
|
2396 |
SLocaleLanguage localeLanguage;
|
|
2397 |
LocaleLanguageGet(localeLanguage);
|
|
2398 |
Copy((reinterpret_cast<const TText* const*>(localeLanguage.iMonthAbbTable))[aMonth]);
|
|
2399 |
}
|
|
2400 |
|
|
2401 |
|
|
2402 |
|
|
2403 |
|
|
2404 |
EXPORT_C void TDateSuffix::Set(TInt aSuffix)
|
|
2405 |
/**
|
|
2406 |
Re-retrieves the current locale's date suffix text for the specified day of
|
|
2407 |
the month.
|
|
2408 |
|
|
2409 |
@param aSuffix A value identifying the day of the month. The value can
|
|
2410 |
range from 0 to 30 so that the first day of the month is
|
|
2411 |
identified by 0, the second day by 1 etc.
|
|
2412 |
|
|
2413 |
@panic USER 69, if aDateSuffix is outside the range 0 to 30.
|
|
2414 |
*/
|
|
2415 |
{
|
|
2416 |
|
|
2417 |
__ASSERT_ALWAYS(aSuffix>=0 && aSuffix<KMaxSuffixes,Panic(ETLoclSuffixOutOfRange));
|
|
2418 |
SLocaleLanguage localeLanguage;
|
|
2419 |
LocaleLanguageGet(localeLanguage);
|
|
2420 |
Copy((reinterpret_cast<const TText* const*>(localeLanguage.iDateSuffixTable))[aSuffix]);
|
|
2421 |
}
|
|
2422 |
|
|
2423 |
|
|
2424 |
|
|
2425 |
|
|
2426 |
EXPORT_C void TAmPmName::Set(TAmPm aSelector)
|
|
2427 |
/**
|
|
2428 |
Re-retrieves the current locale's text for identifying time before or after
|
|
2429 |
noon as identified by the specified selector.
|
|
2430 |
|
|
2431 |
@param aSelector The am/pm selector.
|
|
2432 |
|
|
2433 |
@panic USER 69, if aDateSuffix is outside the range 0 to 30.
|
|
2434 |
*/
|
|
2435 |
{
|
|
2436 |
|
|
2437 |
__ASSERT_ALWAYS(aSelector==EAm || aSelector==EPm,Panic(ETLoclSuffixOutOfRange));
|
|
2438 |
SLocaleLanguage localeLanguage;
|
|
2439 |
LocaleLanguageGet(localeLanguage);
|
|
2440 |
Copy((reinterpret_cast<const TText* const*>(localeLanguage.iAmPmTable))[aSelector]);
|
|
2441 |
}
|
|
2442 |
|
|
2443 |
|
|
2444 |
|
|
2445 |
|
|
2446 |
EXPORT_C void TCurrencySymbol::Set()
|
|
2447 |
/**
|
|
2448 |
Re-retrieves the current locale's currency symbol(s).
|
|
2449 |
*/
|
|
2450 |
{
|
|
2451 |
SLocaleLocaleSettings locale;
|
|
2452 |
LocaleSettingsGet(locale);
|
|
2453 |
Copy(&locale.iCurrencySymbol[0]);
|
|
2454 |
}
|
|
2455 |
|
|
2456 |
|
|
2457 |
|
|
2458 |
|
|
2459 |
EXPORT_C void TShortDateFormatSpec::Set()
|
|
2460 |
/**
|
|
2461 |
Sets the contents of the short date format specification from the system-wide
|
|
2462 |
settings.
|
|
2463 |
*/
|
|
2464 |
{
|
|
2465 |
SLocaleTimeDateFormat locale;
|
|
2466 |
LocaleTimeDateFormatGet(locale);
|
|
2467 |
Copy(&locale.iShortDateFormatSpec[0]);
|
|
2468 |
}
|
|
2469 |
|
|
2470 |
|
|
2471 |
|
|
2472 |
|
|
2473 |
EXPORT_C void TLongDateFormatSpec::Set()
|
|
2474 |
/**
|
|
2475 |
Sets the contents of the long date format specification from the system-wide
|
|
2476 |
settings.
|
|
2477 |
*/
|
|
2478 |
{
|
|
2479 |
SLocaleTimeDateFormat locale;
|
|
2480 |
LocaleTimeDateFormatGet(locale);
|
|
2481 |
Copy(&locale.iLongDateFormatSpec[0]);
|
|
2482 |
}
|
|
2483 |
|
|
2484 |
|
|
2485 |
|
|
2486 |
|
|
2487 |
EXPORT_C void TTimeFormatSpec::Set()
|
|
2488 |
/**
|
|
2489 |
Sets the contents of the time string format specification from the system-wide
|
|
2490 |
settings.
|
|
2491 |
*/
|
|
2492 |
{
|
|
2493 |
SLocaleTimeDateFormat locale;
|
|
2494 |
LocaleTimeDateFormatGet(locale);
|
|
2495 |
Copy(&locale.iTimeFormatSpec[0]);
|
|
2496 |
}
|
|
2497 |
|
|
2498 |
|
|
2499 |
|
|
2500 |
|
|
2501 |
EXPORT_C TInt User::SetCurrencySymbol(const TDesC& aSymbol)
|
|
2502 |
/**
|
|
2503 |
Sets the system wide currency symbol.
|
|
2504 |
|
|
2505 |
On successful return from this function, a call to the Set() member function
|
|
2506 |
of a TCurrencySymbol object fetches the new currency symbol.
|
|
2507 |
|
|
2508 |
@capability WriteDeviceData
|
|
2509 |
|
|
2510 |
@param aSymbol A reference to the descriptor containing the currency symbol
|
|
2511 |
to be set.
|
|
2512 |
|
|
2513 |
@return KErrNone if successful, otherwise one of the other system wide error codes.
|
|
2514 |
|
|
2515 |
@panic USER 119, if the length of aSymbol is greater than KMaxCurrencySymbol.
|
|
2516 |
|
|
2517 |
@see TCurrencySymbol
|
|
2518 |
@see TCurrencySymbol::Set()
|
|
2519 |
@see KMaxCurrencySymbol
|
|
2520 |
*/
|
|
2521 |
{
|
|
2522 |
|
|
2523 |
TExtendedLocale locale;
|
|
2524 |
return locale.SetCurrencySymbol(aSymbol);
|
|
2525 |
}
|
|
2526 |
|
|
2527 |
|
|
2528 |
|
|
2529 |
|
|
2530 |
EXPORT_C TLanguage User::Language()
|
|
2531 |
/**
|
|
2532 |
Gets the language of the current locale.
|
|
2533 |
|
|
2534 |
@return One of the TLanguage enumerators identifying the language of the
|
|
2535 |
current locale.
|
|
2536 |
*/
|
|
2537 |
{
|
|
2538 |
|
|
2539 |
SLocaleLanguage localeLanguage;
|
|
2540 |
LocaleLanguageGet(localeLanguage);
|
|
2541 |
return localeLanguage.iLanguage;
|
|
2542 |
}
|
|
2543 |
|
|
2544 |
EXPORT_C TRegionCode User::RegionCode()
|
|
2545 |
{
|
|
2546 |
#ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
|
|
2547 |
TLocale locale;
|
|
2548 |
locale.Refresh();
|
|
2549 |
return static_cast<TRegionCode>(locale.RegionCode());
|
|
2550 |
#else
|
|
2551 |
return static_cast<TRegionCode>(0);
|
|
2552 |
#endif
|
|
2553 |
}
|
|
2554 |
|
|
2555 |
|
|
2556 |
EXPORT_C TLocale::TLocale()
|
|
2557 |
/**
|
|
2558 |
Default constructor.
|
|
2559 |
|
|
2560 |
It constructs the object with the system's locale settings.
|
|
2561 |
|
|
2562 |
A single copy of the locale information is maintained by the system. This
|
|
2563 |
copy may be refreshed under application control with TLocale::Refresh(), and
|
|
2564 |
the settings may be saved to the system with TLocale::Set(). However, the
|
|
2565 |
settings are never updated by the system apart from under application control.
|
|
2566 |
This enables applications to guarantee that consistent locale information
|
|
2567 |
is used.
|
|
2568 |
|
|
2569 |
@see TLocale::Refresh()
|
|
2570 |
@see TLocale::Set()
|
|
2571 |
*/
|
|
2572 |
{
|
|
2573 |
|
|
2574 |
Refresh();
|
|
2575 |
}
|
|
2576 |
|
|
2577 |
|
|
2578 |
const TUint8 __DefaultDateSeparator[KMaxDateSeparators] = { 0, '/', '/', 0 };
|
|
2579 |
const TUint8 __DefaultTimeSeparator[KMaxTimeSeparators] = { 0, ':', ':', 0 };
|
|
2580 |
|
|
2581 |
void TLocale::SetDefaults()
|
|
2582 |
{
|
|
2583 |
iCountryCode = 44;
|
|
2584 |
iUniversalTimeOffset = 0;
|
|
2585 |
iDateFormat = EDateEuropean;
|
|
2586 |
iTimeFormat = ETime12;
|
|
2587 |
iCurrencySymbolPosition = ELocaleBefore;
|
|
2588 |
iCurrencySpaceBetween = EFalse;
|
|
2589 |
iCurrencyDecimalPlaces = 2;
|
|
2590 |
iNegativeCurrencyFormat = TNegativeCurrencyFormat(EFalse);
|
|
2591 |
iCurrencyTriadsAllowed = ETrue;
|
|
2592 |
iThousandsSeparator = ',';
|
|
2593 |
iDecimalSeparator = '.';
|
|
2594 |
TInt i=0;
|
|
2595 |
for(; i<KMaxDateSeparators; i++)
|
|
2596 |
iDateSeparator[i] = __DefaultDateSeparator[i];
|
|
2597 |
for(i=0; i<KMaxTimeSeparators; i++)
|
|
2598 |
iTimeSeparator[i] = __DefaultTimeSeparator[i];
|
|
2599 |
iAmPmSymbolPosition = ELocaleAfter;
|
|
2600 |
iAmPmSpaceBetween = ETrue;
|
|
2601 |
iHomeDaylightSavingZone = EDstEuropean;
|
|
2602 |
iWorkDays = 0x1f;
|
|
2603 |
iStartOfWeek = EMonday;
|
|
2604 |
iClockFormat = EClockAnalog;
|
|
2605 |
iUnitsGeneral = EUnitsImperial;
|
|
2606 |
iUnitsDistanceLong = EUnitsImperial;
|
|
2607 |
iUnitsDistanceShort = EUnitsImperial;
|
|
2608 |
iExtraNegativeCurrencyFormatFlags = 0;
|
|
2609 |
iLanguageDowngrade[0] = ELangNone;
|
|
2610 |
iLanguageDowngrade[1] = ELangNone;
|
|
2611 |
iLanguageDowngrade[2] = ELangNone;
|
|
2612 |
#ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
|
|
2613 |
iRegionCode = ERegGBR;
|
|
2614 |
#else
|
|
2615 |
iRegionCode = 0;
|
|
2616 |
#endif
|
|
2617 |
iDigitType = EDigitTypeWestern;
|
|
2618 |
iDeviceTimeState = TDeviceTimeState(EDeviceUserTime);
|
|
2619 |
}
|
|
2620 |
|
|
2621 |
EXPORT_C void TLocale::Refresh()
|
|
2622 |
/**
|
|
2623 |
Refreshes the contents of this object with the system's locale settings.
|
|
2624 |
*/
|
|
2625 |
{
|
|
2626 |
|
|
2627 |
|
|
2628 |
TPckg<TLocale> localeDataBuf(*this);
|
|
2629 |
TInt r = RProperty::Get(KUidSystemCategory, KLocaleDataKey, localeDataBuf);
|
|
2630 |
__ASSERT_DEBUG(r == KErrNone || r == KErrNotFound, Panic(EBadLocaleParameter));
|
|
2631 |
if(r == KErrNone)
|
|
2632 |
{
|
|
2633 |
iUniversalTimeOffset = Exec::UTCOffset();
|
|
2634 |
iDaylightSaving = 0;
|
|
2635 |
}
|
|
2636 |
else if(r == KErrNotFound)
|
|
2637 |
{
|
|
2638 |
SetDefaults();
|
|
2639 |
}
|
|
2640 |
}
|
|
2641 |
|
|
2642 |
|
|
2643 |
|
|
2644 |
|
|
2645 |
EXPORT_C TInt TLocale::Set() const
|
|
2646 |
/**
|
|
2647 |
Transfers the locale settings from this object to the system. Note that
|
|
2648 |
the timezone offset and daylight savings flags are ignored as setting these
|
|
2649 |
through TLocale is no longer supported.
|
|
2650 |
|
|
2651 |
After this function has been called, other applications may use the new
|
|
2652 |
settings for newly-constructed TLocale objects,
|
|
2653 |
or if they use TLocale::Refresh(), to refresh their settings from
|
|
2654 |
the system copy.
|
|
2655 |
|
|
2656 |
@capability WriteDeviceData
|
|
2657 |
|
|
2658 |
@return KErrNone if successful, otherwise one of the other system wide error codes.
|
|
2659 |
|
|
2660 |
@see TLocale::Refresh()
|
|
2661 |
*/
|
|
2662 |
{
|
|
2663 |
TPckg<TLocale> localeDataBuf(*this);
|
|
2664 |
TInt r = RProperty::Set(KUidSystemCategory, KLocaleDataKey, localeDataBuf);
|
|
2665 |
if(r == KErrNone)
|
|
2666 |
{
|
|
2667 |
Exec::NotifyChanges(EChangesLocale);
|
|
2668 |
}
|
|
2669 |
return r;
|
|
2670 |
}
|
|
2671 |
|
|
2672 |
TInt TExtendedLocale::DoLoadLocale(const TDesC& aLocaleDllName, TLibraryFunction* aExportList)
|
|
2673 |
{
|
|
2674 |
RLoader loader;
|
|
2675 |
TInt r = loader.LoadLocale(aLocaleDllName, aExportList);
|
|
2676 |
return r;
|
|
2677 |
}
|
|
2678 |
|
|
2679 |
#ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
|
|
2680 |
void TExtendedLocale::DoUpdateLanguageSettingsV2(TLibraryFunction* aExportList)
|
|
2681 |
{
|
|
2682 |
iLocale.iDigitType = EDigitTypeWestern;
|
|
2683 |
iLocale.iLanguageDowngrade[0] = ELangNone;
|
|
2684 |
iLocale.iLanguageDowngrade[1] = ELangNone;
|
|
2685 |
iLocale.iLanguageDowngrade[2] = ELangNone;
|
|
2686 |
|
|
2687 |
iLanguageSettings.iLanguage = (TLanguage)aExportList[FnLanguageV2]();
|
|
2688 |
iLanguageSettings.iDateSuffixTable = (const TText*)aExportList[FnDateSuffixTableV2]();
|
|
2689 |
iLanguageSettings.iDayTable = (const TText*)aExportList[FnDayTableV2]();
|
|
2690 |
iLanguageSettings.iDayAbbTable = (const TText*)aExportList[FnDayAbbTableV2]();
|
|
2691 |
iLanguageSettings.iMonthTable = (const TText*)aExportList[FnMonthTableV2]();
|
|
2692 |
iLanguageSettings.iMonthAbbTable = (const TText*)aExportList[FnMonthAbbTableV2]();
|
|
2693 |
iLanguageSettings.iAmPmTable = (const TText*)aExportList[FnAmPmTableV2]();
|
|
2694 |
iLanguageSettings.iMsgTable = (const TText16* const*)aExportList[FnMsgTableV2]();
|
|
2695 |
|
|
2696 |
TDigitType digitType = (TDigitType)aExportList[FnDigitTypeV2]();
|
|
2697 |
iLocale.SetDigitType(digitType);
|
|
2698 |
|
|
2699 |
TLanguage* languageDowngrade = (TLanguage*)aExportList[FnLanguageDowngradeTableV2]();
|
|
2700 |
iLocale.SetLanguageDowngrade(0,*(languageDowngrade));
|
|
2701 |
iLocale.SetLanguageDowngrade(1,*(languageDowngrade+1));
|
|
2702 |
iLocale.SetLanguageDowngrade(2,*(languageDowngrade+2));
|
|
2703 |
}
|
|
2704 |
|
|
2705 |
void TExtendedLocale::DoUpdateLocaleSettingsV2(TLibraryFunction* aExportList)
|
|
2706 |
{
|
|
2707 |
|
|
2708 |
Mem::Copy(&iLocaleExtraSettings.iCurrencySymbol[0], (const TAny*)aExportList[FnCurrencySymbolV2](), sizeof(TText) * (KMaxCurrencySymbol+1));
|
|
2709 |
iLocaleExtraSettings.iLocaleExtraSettingsDllPtr = (TAny*)aExportList[FnCurrencySymbolV2]();
|
|
2710 |
Mem::Copy(&iLocaleTimeDateFormat.iShortDateFormatSpec[0], (const TAny*)aExportList[FnShortDateFormatSpecV2](), sizeof(TText) * (KMaxShortDateFormatSpec+1));
|
|
2711 |
Mem::Copy(&iLocaleTimeDateFormat.iLongDateFormatSpec[0], (const TAny*)aExportList[FnLongDateFormatSpecV2](), sizeof(TText) * (KMaxLongDateFormatSpec+1)) ;
|
|
2712 |
Mem::Copy(&iLocaleTimeDateFormat.iTimeFormatSpec[0], (const TAny*)aExportList[FnTimeFormatSpecV2](), sizeof(TText) * (KMaxTimeFormatSpec+1));
|
|
2713 |
iLocaleTimeDateFormat.iLocaleTimeDateFormatDllPtr = (TAny*)aExportList[FnCurrencySymbolV2]();
|
|
2714 |
|
|
2715 |
iLocale.iExtraNegativeCurrencyFormatFlags=0x80000000;
|
|
2716 |
|
|
2717 |
typedef void (*TLibFn)(TLocale*);
|
|
2718 |
((TLibFn)aExportList[FnLocaleDataV2])(&iLocale);
|
|
2719 |
|
|
2720 |
if (iLocale.iExtraNegativeCurrencyFormatFlags&0x80000000)
|
|
2721 |
iLocale.iExtraNegativeCurrencyFormatFlags=0;
|
|
2722 |
}
|
|
2723 |
#endif
|
|
2724 |
|
|
2725 |
void TExtendedLocale::DoUpdateLanguageSettings(TLibraryFunction* aExportList)
|
|
2726 |
{
|
|
2727 |
iLanguageSettings.iLanguage = (TLanguage)aExportList[FnLanguage]();
|
|
2728 |
iLanguageSettings.iDateSuffixTable = (const TText*)aExportList[FnDateSuffixTable]();
|
|
2729 |
iLanguageSettings.iDayTable = (const TText*)aExportList[FnDayTable]();
|
|
2730 |
iLanguageSettings.iDayAbbTable = (const TText*)aExportList[FnDayAbbTable]();
|
|
2731 |
iLanguageSettings.iMonthTable = (const TText*)aExportList[FnMonthTable]();
|
|
2732 |
iLanguageSettings.iMonthAbbTable = (const TText*)aExportList[FnMonthAbbTable]();
|
|
2733 |
iLanguageSettings.iAmPmTable = (const TText*)aExportList[FnAmPmTable]();
|
|
2734 |
iLanguageSettings.iMsgTable = (const TText16* const*)aExportList[FnMsgTable]();
|
|
2735 |
}
|
|
2736 |
|
|
2737 |
void TExtendedLocale::DoUpdateLocaleSettings(TLibraryFunction* aExportList)
|
|
2738 |
{
|
|
2739 |
Mem::Copy(&iLocaleExtraSettings.iCurrencySymbol[0], (const TAny*)aExportList[FnCurrencySymbol](), sizeof(TText) * (KMaxCurrencySymbol+1));
|
|
2740 |
iLocaleExtraSettings.iLocaleExtraSettingsDllPtr = (TAny*)aExportList[FnDateSuffixTable]();
|
|
2741 |
}
|
|
2742 |
|
|
2743 |
void TExtendedLocale::DoUpdateTimeDateFormat(TLibraryFunction* aExportList)
|
|
2744 |
{
|
|
2745 |
Mem::Copy(&iLocaleTimeDateFormat.iShortDateFormatSpec[0], (const TAny*)aExportList[FnShortDateFormatSpec](), sizeof(TText) * (KMaxShortDateFormatSpec+1));
|
|
2746 |
Mem::Copy(&iLocaleTimeDateFormat.iLongDateFormatSpec[0], (const TAny*)aExportList[FnLongDateFormatSpec](), sizeof(TText) * (KMaxLongDateFormatSpec+1)) ;
|
|
2747 |
Mem::Copy(&iLocaleTimeDateFormat.iTimeFormatSpec[0], (const TAny*)aExportList[FnTimeFormatSpec](), sizeof(TText) * (KMaxTimeFormatSpec+1));
|
|
2748 |
iLocaleTimeDateFormat.iLocaleTimeDateFormatDllPtr = (TAny*)aExportList[FnDateSuffixTable]();
|
|
2749 |
}
|
|
2750 |
|
|
2751 |
/**
|
|
2752 |
Default constructor.
|
|
2753 |
|
|
2754 |
It constructs an empty object
|
|
2755 |
|
|
2756 |
This is an empty copy of TExtendedLocale. To get the system locale you can
|
|
2757 |
use TExtendedLocale::LoadSystemSettings. The current settings may be saved to the system
|
|
2758 |
with TLocale::SaveSystemSettings().
|
|
2759 |
|
|
2760 |
@see TExtendedLocale::LoadSystemSettings
|
|
2761 |
@see TExtendedLocale::SaveSystemSettings
|
|
2762 |
*/
|
|
2763 |
EXPORT_C TExtendedLocale::TExtendedLocale()
|
|
2764 |
: iLocale(0)
|
|
2765 |
{
|
|
2766 |
|
|
2767 |
Mem::FillZ(&iLanguageSettings, sizeof(TExtendedLocale) - sizeof(TLocale));
|
|
2768 |
}
|
|
2769 |
|
|
2770 |
/**
|
|
2771 |
Load system wide locale settings
|
|
2772 |
|
|
2773 |
It initialises this TExtendedLocale with the system wide locale settings.
|
|
2774 |
The settings stored in the TExtendedLocale are overwritten with the system
|
|
2775 |
wide locale.
|
|
2776 |
|
|
2777 |
@see TExtendedLocale::SaveSystemSettings
|
|
2778 |
*/
|
|
2779 |
EXPORT_C void TExtendedLocale::LoadSystemSettings()
|
|
2780 |
{
|
|
2781 |
LocaleLanguageGet(iLanguageSettings);
|
|
2782 |
LocaleSettingsGet(iLocaleExtraSettings);
|
|
2783 |
LocaleTimeDateFormatGet(iLocaleTimeDateFormat);
|
|
2784 |
iDefaultCharSet = GetLocaleCharSet();
|
|
2785 |
iPreferredCharSet = GetLocalePreferredCharSet();
|
|
2786 |
iLocale.Refresh();
|
|
2787 |
}
|
|
2788 |
|
|
2789 |
/**
|
|
2790 |
Make the current locale information system wide
|
|
2791 |
|
|
2792 |
It overwrites the system wide locale information with the locale information
|
|
2793 |
stored in this TExtendedLocale.
|
|
2794 |
This will generate a notification for system locale changes.
|
|
2795 |
In case of an error, the locale might be in an unconsistent state.
|
|
2796 |
|
|
2797 |
@capability WriteDeviceData
|
|
2798 |
|
|
2799 |
@return KErrNone if successful, otherwise one of the other system wide error codes.
|
|
2800 |
*/
|
|
2801 |
EXPORT_C TInt TExtendedLocale::SaveSystemSettings()
|
|
2802 |
{
|
|
2803 |
|
|
2804 |
TPckg<SLocaleLanguage> localeLanguageBuf(iLanguageSettings);
|
|
2805 |
TInt r = RProperty::Set(KUidSystemCategory, KLocaleLanguageKey, localeLanguageBuf);
|
|
2806 |
if(r != KErrNone)
|
|
2807 |
return r;
|
|
2808 |
|
|
2809 |
TPckg<SLocaleLocaleSettings> localeSettingsBuf(iLocaleExtraSettings);
|
|
2810 |
r = RProperty::Set(KUidSystemCategory, KLocaleDataExtraKey, localeSettingsBuf);
|
|
2811 |
if(r != KErrNone)
|
|
2812 |
return r;
|
|
2813 |
|
|
2814 |
TPckg<SLocaleTimeDateFormat> localeTimeDateFormatBuf(iLocaleTimeDateFormat);
|
|
2815 |
r = RProperty::Set(KUidSystemCategory, KLocaleTimeDateFormatKey, localeTimeDateFormatBuf);
|
|
2816 |
if(r != KErrNone)
|
|
2817 |
return r;
|
|
2818 |
|
|
2819 |
r = Exec::SetGlobalUserData(ELocaleDefaultCharSet, (TInt)iDefaultCharSet);
|
|
2820 |
if(r != KErrNone)
|
|
2821 |
return r;
|
|
2822 |
|
|
2823 |
r = Exec::SetGlobalUserData(ELocalePreferredCharSet, (TInt)iPreferredCharSet);
|
|
2824 |
|
|
2825 |
if(r == KErrNone)
|
|
2826 |
{
|
|
2827 |
iLocale.Set();
|
|
2828 |
}
|
|
2829 |
|
|
2830 |
return r;
|
|
2831 |
}
|
|
2832 |
|
|
2833 |
#ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
|
|
2834 |
TInt TExtendedLocale::CheckLocaleDllName(const TDesC& aLocaleDllName, TInt& languageID)
|
|
2835 |
{
|
|
2836 |
languageID = 0;
|
|
2837 |
|
|
2838 |
if(aLocaleDllName.Find(KLoc) == KErrNotFound)
|
|
2839 |
return KErrNotFound;
|
|
2840 |
|
|
2841 |
TInt len = aLocaleDllName.Length() - 6; //6 is the length of KLoc.
|
|
2842 |
TPtrC ptr = aLocaleDllName.Right(len);
|
|
2843 |
for(TInt i =0; i< len; i++)
|
|
2844 |
{
|
|
2845 |
if(ptr[i] >= '0' && ptr[i] <= '9')
|
|
2846 |
{
|
|
2847 |
languageID = languageID*10 + (ptr[i] - '0');
|
|
2848 |
}
|
|
2849 |
else
|
|
2850 |
{
|
|
2851 |
languageID = 0;
|
|
2852 |
return KErrNotFound;
|
|
2853 |
}
|
|
2854 |
}
|
|
2855 |
return KErrNone;
|
|
2856 |
}
|
|
2857 |
|
|
2858 |
//add file extension, such as "elocl_lan" will be "elocl_lan.012"
|
|
2859 |
void TExtendedLocale::AddExtension(TDes& aFileName, TInt aExtension)
|
|
2860 |
{
|
|
2861 |
if (aExtension < 10)
|
|
2862 |
{
|
|
2863 |
aFileName.AppendNum(0);
|
|
2864 |
aFileName.AppendNum(0);
|
|
2865 |
aFileName.AppendNum(aExtension);
|
|
2866 |
}
|
|
2867 |
else if (aExtension < 100)
|
|
2868 |
{
|
|
2869 |
aFileName.AppendNum(0);
|
|
2870 |
aFileName.AppendNum(aExtension);
|
|
2871 |
}
|
|
2872 |
else
|
|
2873 |
{
|
|
2874 |
aFileName.AppendNum(aExtension);
|
|
2875 |
}
|
|
2876 |
return;
|
|
2877 |
}
|
|
2878 |
#endif
|
|
2879 |
|
|
2880 |
/**
|
|
2881 |
Loads a locale Dll and get the locale information
|
|
2882 |
|
|
2883 |
It loads a locale DLL and it initialises the contents of this TExtendedLocale
|
|
2884 |
with the locale information stored in the DLL. The locale information is only
|
|
2885 |
stored in this TExtendedLocale. If you want to set the system wide settings with
|
|
2886 |
the locale information in the DLL, you can call TExtendedLocale::SaveSystemSettings
|
|
2887 |
after calling this function.
|
|
2888 |
|
|
2889 |
@param aLocaleDllName The name of the locale DLL to be loaded
|
|
2890 |
@return KErrNone if successful, system wide error if not
|
|
2891 |
|
|
2892 |
@see TExtendedLocale::SaveSystemSettings
|
|
2893 |
*/
|
|
2894 |
EXPORT_C TInt TExtendedLocale::LoadLocale(const TDesC& aLocaleDllName)
|
|
2895 |
{
|
|
2896 |
#ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
|
|
2897 |
TLibraryFunction data[KNumLocaleExports];
|
|
2898 |
TInt r = DoLoadLocale(aLocaleDllName, &data[0]);
|
|
2899 |
if(r == KErrNone)
|
|
2900 |
{
|
|
2901 |
iLocale.iExtraNegativeCurrencyFormatFlags=0x80000000;
|
|
2902 |
iLocale.iLanguageDowngrade[0] = ELangNone;
|
|
2903 |
iLocale.iLanguageDowngrade[1] = ELangNone;
|
|
2904 |
iLocale.iLanguageDowngrade[2] = ELangNone;
|
|
2905 |
iLocale.iDigitType = EDigitTypeWestern;
|
|
2906 |
|
|
2907 |
typedef void (*TLibFn)(TLocale*);
|
|
2908 |
((TLibFn)data[FnLocaleData])(&iLocale);
|
|
2909 |
|
|
2910 |
//Locale daylightsavings unchanged - we have travelled through space, not time
|
|
2911 |
if (iLocale.iExtraNegativeCurrencyFormatFlags&0x80000000)
|
|
2912 |
iLocale.iExtraNegativeCurrencyFormatFlags=0;
|
|
2913 |
|
|
2914 |
DoUpdateLanguageSettings(&data[0]);
|
|
2915 |
DoUpdateLocaleSettings(&data[0]);
|
|
2916 |
DoUpdateTimeDateFormat(&data[0]);
|
|
2917 |
|
|
2918 |
iPreferredCharSet = (const LCharSet*)data[FnCharSet]();
|
|
2919 |
iDefaultCharSet = iPreferredCharSet;
|
|
2920 |
return r;
|
|
2921 |
}
|
|
2922 |
else if(r == KErrNotFound)
|
|
2923 |
{
|
|
2924 |
TInt lan = 0;
|
|
2925 |
TInt reg = 0;
|
|
2926 |
TInt col = 0;
|
|
2927 |
TInt languageID = -1;
|
|
2928 |
TInt err = CheckLocaleDllName(aLocaleDllName, languageID);
|
|
2929 |
if (err != KErrNone)
|
|
2930 |
return err;
|
|
2931 |
|
|
2932 |
TInt i = 0;
|
|
2933 |
while (i < KLocMapLength) //binary search later
|
|
2934 |
{
|
|
2935 |
if ((LocaleMapping[i].iOldLocaleId) == languageID)
|
|
2936 |
{
|
|
2937 |
lan = LocaleMapping[i].iNewLocaleID[0];
|
|
2938 |
reg = LocaleMapping[i].iNewLocaleID[1];
|
|
2939 |
col = LocaleMapping[i].iNewLocaleID[2];
|
|
2940 |
break;
|
|
2941 |
}
|
|
2942 |
i++;
|
|
2943 |
}
|
|
2944 |
if(i == KLocMapLength)
|
|
2945 |
return KErrNotFound;
|
|
2946 |
|
|
2947 |
TBuf<15> lanptr = KFindLan();
|
|
2948 |
TBuf<15> regptr = KFindReg();
|
|
2949 |
TBuf<15> colptr = KFindCol();
|
|
2950 |
AddExtension(lanptr, lan);
|
|
2951 |
AddExtension(regptr, reg);
|
|
2952 |
AddExtension(colptr, col);
|
|
2953 |
err = LoadLocale(lanptr, regptr, colptr);
|
|
2954 |
|
|
2955 |
return err;
|
|
2956 |
}
|
|
2957 |
return r;
|
|
2958 |
#else
|
|
2959 |
TLibraryFunction data[KNumLocaleExports];
|
|
2960 |
TInt r = DoLoadLocale(aLocaleDllName, &data[0]);
|
|
2961 |
if(r == KErrNone)
|
|
2962 |
{
|
|
2963 |
iLocale.iExtraNegativeCurrencyFormatFlags=0x80000000;
|
|
2964 |
iLocale.iLanguageDowngrade[0] = ELangNone;
|
|
2965 |
iLocale.iLanguageDowngrade[1] = ELangNone;
|
|
2966 |
iLocale.iLanguageDowngrade[2] = ELangNone;
|
|
2967 |
iLocale.iDigitType = EDigitTypeWestern;
|
|
2968 |
|
|
2969 |
typedef void (*TLibFn)(TLocale*);
|
|
2970 |
((TLibFn)data[FnLocaleData])(&iLocale);
|
|
2971 |
|
|
2972 |
//Locale daylightsavings unchanged - we have travelled through space, not time
|
|
2973 |
if (iLocale.iExtraNegativeCurrencyFormatFlags&0x80000000)
|
|
2974 |
iLocale.iExtraNegativeCurrencyFormatFlags=0;
|
|
2975 |
|
|
2976 |
DoUpdateLanguageSettings(&data[0]);
|
|
2977 |
DoUpdateLocaleSettings(&data[0]);
|
|
2978 |
DoUpdateTimeDateFormat(&data[0]);
|
|
2979 |
|
|
2980 |
iPreferredCharSet = (const LCharSet*)data[FnCharSet]();
|
|
2981 |
iDefaultCharSet = iPreferredCharSet;
|
|
2982 |
}
|
|
2983 |
return r;
|
|
2984 |
#endif
|
|
2985 |
}
|
|
2986 |
|
|
2987 |
/**
|
|
2988 |
Loads locale data from three locale dlls, which are language, region, and collation locale dlls
|
|
2989 |
|
|
2990 |
It loads three locale DLLs and it initialises the contents of this TExtendedLocale
|
|
2991 |
with the locale information stored in the DLLs. The locale information is only
|
|
2992 |
stored in this TExtendedLocale. If you want to set the system wide settings with
|
|
2993 |
the locale information in the DLL, you can call TExtendedLocale::SaveSystemSettings
|
|
2994 |
after calling this function.
|
|
2995 |
|
|
2996 |
@param aLanguageLocaleDllName The name of the language locale DLL to be loaded
|
|
2997 |
@param aRegionLocaleDllName The name of the region locale DLL to be loaded
|
|
2998 |
@param aCollationLocaleDllName The name of the collation locale DLL to be loaded
|
|
2999 |
|
|
3000 |
@return KErrNone if successful, system wide error if not
|
|
3001 |
|
|
3002 |
@see TExtendedLocale::SaveSystemSettings
|
|
3003 |
*/
|
|
3004 |
#ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
|
|
3005 |
EXPORT_C TInt TExtendedLocale::LoadLocale(const TDesC& aLanguageLocaleDllName,
|
|
3006 |
const TDesC& aRegionLocaleDllName,
|
|
3007 |
const TDesC& aCollationLocaleDllName)
|
|
3008 |
{
|
|
3009 |
|
|
3010 |
TInt err = LoadLocaleAspect(aLanguageLocaleDllName);
|
|
3011 |
if(err != KErrNone)
|
|
3012 |
return err;
|
|
3013 |
|
|
3014 |
err = LoadLocaleAspect(aRegionLocaleDllName);
|
|
3015 |
if(err != KErrNone)
|
|
3016 |
return err;
|
|
3017 |
|
|
3018 |
err = LoadLocaleAspect(aCollationLocaleDllName);
|
|
3019 |
if(err != KErrNone)
|
|
3020 |
return err;
|
|
3021 |
|
|
3022 |
return err;
|
|
3023 |
}
|
|
3024 |
#else
|
|
3025 |
EXPORT_C TInt TExtendedLocale::LoadLocale(const TDesC& /*aLanguageLocaleDllName*/,
|
|
3026 |
const TDesC& /*aRegionLocaleDllName*/,
|
|
3027 |
const TDesC& /*aCollationLocaleDllName*/)
|
|
3028 |
{
|
|
3029 |
return KErrNotSupported;
|
|
3030 |
}
|
|
3031 |
#endif
|
|
3032 |
|
|
3033 |
/**
|
|
3034 |
Loads a DLL and get some locale information
|
|
3035 |
|
|
3036 |
It loads the specified locale DLL and depending on the aAspectGroup it overwrites
|
|
3037 |
locale information in this TExtendedLocale with the locale information stored in the
|
|
3038 |
DLL. aAspectGroup is a bitmap of TLocaleAspect values specifying what to be overwritten.
|
|
3039 |
The locale information is only stored in this TExtendedLocale. If you want to set the
|
|
3040 |
system wide settings with the locale information in the DLL, you can call
|
|
3041 |
TExtendedLocale::SaveSystemSettings after calling this function.
|
|
3042 |
|
|
3043 |
@param aAspectGroup A bitmap of TLocaleAspect values specifying what to be overwritten in
|
|
3044 |
this TExtendedLocale. (eg.: ELocaleLanguageSettings | ELocaleTimeDateSettings)
|
|
3045 |
@param aLocaleDllName The name of the locale DLL to be loaded
|
|
3046 |
|
|
3047 |
@return KErrNone if the method is successful, a system wide error code if not
|
|
3048 |
|
|
3049 |
@see TLocaleAspect
|
|
3050 |
@see TExtendedLocale::SaveSystemSettings
|
|
3051 |
*/
|
|
3052 |
EXPORT_C TInt TExtendedLocale::LoadLocaleAspect(TUint aAspectGroup, const TDesC& aLocaleDllName)
|
|
3053 |
{
|
|
3054 |
#ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
|
|
3055 |
TLibraryFunction data[KNumLocaleExports];
|
|
3056 |
TInt r = DoLoadLocale(aLocaleDllName, &data[0]);
|
|
3057 |
if(r == KErrNone)
|
|
3058 |
{
|
|
3059 |
if(aAspectGroup & ELocaleLanguageSettings)
|
|
3060 |
{
|
|
3061 |
DoUpdateLanguageSettings(&data[0]);
|
|
3062 |
}
|
|
3063 |
if(aAspectGroup & ELocaleCollateSetting)
|
|
3064 |
{
|
|
3065 |
iPreferredCharSet = (const LCharSet*)data[FnCharSet]();
|
|
3066 |
iDefaultCharSet = iPreferredCharSet;
|
|
3067 |
}
|
|
3068 |
if(aAspectGroup & ELocaleLocaleSettings)
|
|
3069 |
{
|
|
3070 |
DoUpdateLocaleSettings(&data[0]);
|
|
3071 |
}
|
|
3072 |
if(aAspectGroup & ELocaleTimeDateSettings)
|
|
3073 |
{
|
|
3074 |
DoUpdateTimeDateFormat(&data[0]);
|
|
3075 |
}
|
|
3076 |
return r;
|
|
3077 |
}
|
|
3078 |
|
|
3079 |
else if (r == KErrNotFound)
|
|
3080 |
{
|
|
3081 |
TInt lan = 0;
|
|
3082 |
TInt reg = 0;
|
|
3083 |
TInt col = 0;
|
|
3084 |
TInt languageID = -1;
|
|
3085 |
TInt err = CheckLocaleDllName(aLocaleDllName, languageID);
|
|
3086 |
if(err != KErrNone)
|
|
3087 |
return err;
|
|
3088 |
|
|
3089 |
TInt i = 0;
|
|
3090 |
while (i < KLocMapLength)
|
|
3091 |
{
|
|
3092 |
if ((LocaleMapping[i].iOldLocaleId) == languageID)
|
|
3093 |
{
|
|
3094 |
lan = LocaleMapping[i].iNewLocaleID[0];
|
|
3095 |
reg = LocaleMapping[i].iNewLocaleID[1];
|
|
3096 |
col = LocaleMapping[i].iNewLocaleID[2];
|
|
3097 |
break;
|
|
3098 |
}
|
|
3099 |
i++;
|
|
3100 |
}
|
|
3101 |
if(i == KLocMapLength)
|
|
3102 |
return KErrNotFound;
|
|
3103 |
|
|
3104 |
TBuf<15> lanptr = KFindLan();
|
|
3105 |
TBuf<15> regptr = KFindReg();
|
|
3106 |
TBuf<15> colptr = KFindCol();
|
|
3107 |
AddExtension(lanptr, lan);
|
|
3108 |
AddExtension(regptr, reg);
|
|
3109 |
AddExtension(colptr, col);
|
|
3110 |
|
|
3111 |
switch (aAspectGroup)
|
|
3112 |
{
|
|
3113 |
case ELocaleCollateSetting:
|
|
3114 |
{
|
|
3115 |
err = LoadLocaleAspect(colptr);
|
|
3116 |
break;
|
|
3117 |
}
|
|
3118 |
case ELocaleLocaleSettings:
|
|
3119 |
{
|
|
3120 |
err = LoadLocaleAspect(regptr);
|
|
3121 |
break;
|
|
3122 |
}
|
|
3123 |
|
|
3124 |
case ELocaleLanguageSettings:
|
|
3125 |
{
|
|
3126 |
err = LoadLocaleAspect(lanptr);
|
|
3127 |
break;
|
|
3128 |
}
|
|
3129 |
}
|
|
3130 |
return err;
|
|
3131 |
}
|
|
3132 |
|
|
3133 |
return r;
|
|
3134 |
#else
|
|
3135 |
TLibraryFunction data[KNumLocaleExports];
|
|
3136 |
TInt r = DoLoadLocale(aLocaleDllName, &data[0]);
|
|
3137 |
if(r == KErrNone)
|
|
3138 |
{
|
|
3139 |
if(aAspectGroup & ELocaleLanguageSettings)
|
|
3140 |
{
|
|
3141 |
DoUpdateLanguageSettings(&data[0]);
|
|
3142 |
}
|
|
3143 |
if(aAspectGroup & ELocaleCollateSetting)
|
|
3144 |
{
|
|
3145 |
iPreferredCharSet = (const LCharSet*)data[FnCharSet]();
|
|
3146 |
iDefaultCharSet = iPreferredCharSet;
|
|
3147 |
}
|
|
3148 |
if(aAspectGroup & ELocaleLocaleSettings)
|
|
3149 |
{
|
|
3150 |
DoUpdateLocaleSettings(&data[0]);
|
|
3151 |
}
|
|
3152 |
if(aAspectGroup & ELocaleTimeDateSettings)
|
|
3153 |
{
|
|
3154 |
DoUpdateTimeDateFormat(&data[0]);
|
|
3155 |
}
|
|
3156 |
}
|
|
3157 |
return r;
|
|
3158 |
#endif
|
|
3159 |
}
|
|
3160 |
|
|
3161 |
/**
|
|
3162 |
Loads a DLL and get some locale information
|
|
3163 |
|
|
3164 |
It loads the specified locale DLL, and it overwrites
|
|
3165 |
locale information in this TExtendedLocale with the locale information stored in the
|
|
3166 |
DLL. The locale information is only stored in this TExtendedLocale. If you want to set the
|
|
3167 |
system wide settings with the locale information in the DLL, you can call
|
|
3168 |
TExtendedLocale::SaveSystemSettings after calling this function.
|
|
3169 |
|
|
3170 |
@param aLocaleDllName The name of the locale DLL to be loaded
|
|
3171 |
|
|
3172 |
@return KErrNone if the method is successful, a system wide error code if not
|
|
3173 |
|
|
3174 |
@see TExtendedLocale::SaveSystemSettings
|
|
3175 |
*/
|
|
3176 |
#ifdef SYMBIAN_DISTINCT_LOCALE_MODEL
|
|
3177 |
EXPORT_C TInt TExtendedLocale::LoadLocaleAspect(const TDesC& aLocaleDllName)
|
|
3178 |
{
|
|
3179 |
TLibraryFunction data[KNumLocaleExports];
|
|
3180 |
|
|
3181 |
TInt result = aLocaleDllName.Find(KFindReg);
|
|
3182 |
if(result != KErrNotFound)
|
|
3183 |
{
|
|
3184 |
result = DoLoadLocale(aLocaleDllName, &data[0]);
|
|
3185 |
if(result == KErrNone)
|
|
3186 |
{
|
|
3187 |
DoUpdateLocaleSettingsV2(&data[0]);
|
|
3188 |
return result;
|
|
3189 |
}
|
|
3190 |
}
|
|
3191 |
|
|
3192 |
result= aLocaleDllName.Find(KFindLan);
|
|
3193 |
if(result != KErrNotFound)
|
|
3194 |
{
|
|
3195 |
result = DoLoadLocale(aLocaleDllName, &data[0]);
|
|
3196 |
if(result == KErrNone)
|
|
3197 |
{
|
|
3198 |
DoUpdateLanguageSettingsV2(&data[0]);
|
|
3199 |
return result;
|
|
3200 |
}
|
|
3201 |
}
|
|
3202 |
|
|
3203 |
result = aLocaleDllName.Find(KFindCol);
|
|
3204 |
if(result != KErrNotFound)
|
|
3205 |
{
|
|
3206 |
result = DoLoadLocale(aLocaleDllName, &data[0]);
|
|
3207 |
if(result == KErrNone)
|
|
3208 |
{
|
|
3209 |
iPreferredCharSet = (const LCharSet*)data[1]();
|
|
3210 |
iDefaultCharSet = iPreferredCharSet;
|
|
3211 |
return result;
|
|
3212 |
}
|
|
3213 |
}
|
|
3214 |
|
|
3215 |
return KErrNotFound;
|
|
3216 |
}
|
|
3217 |
#else
|
|
3218 |
EXPORT_C TInt TExtendedLocale::LoadLocaleAspect(const TDesC& /*aLocaleDllName*/)
|
|
3219 |
{
|
|
3220 |
return KErrNotSupported;
|
|
3221 |
}
|
|
3222 |
#endif
|
|
3223 |
|
|
3224 |
/**
|
|
3225 |
Sets the currency symbol
|
|
3226 |
|
|
3227 |
It sets the currency symbol. The maximum lenght for the currency symbol is
|
|
3228 |
KMaxCurrencySymbol. Trying to pass a descriptor longer than that, will result
|
|
3229 |
in a panic.
|
|
3230 |
|
|
3231 |
@param aSymbol The new currency symbol
|
|
3232 |
|
|
3233 |
@panic USER 119, if the length of aSymbol is greater than KMaxCurrencySymbol.
|
|
3234 |
|
|
3235 |
@capability WriteDeviceData
|
|
3236 |
|
|
3237 |
@return KErrNone if successful, otherwise one of the other system wide error codes.
|
|
3238 |
*/
|
|
3239 |
EXPORT_C TInt TExtendedLocale::SetCurrencySymbol(const TDesC &aSymbol)
|
|
3240 |
{
|
|
3241 |
__ASSERT_ALWAYS(aSymbol.Length()<=KMaxCurrencySymbol,::Panic(ECurrencySymbolOverflow));
|
|
3242 |
|
|
3243 |
LocaleSettingsGet(iLocaleExtraSettings);
|
|
3244 |
Mem::Copy(&iLocaleExtraSettings.iCurrencySymbol[0], aSymbol.Ptr(), aSymbol.Length()*sizeof(TText) );
|
|
3245 |
iLocaleExtraSettings.iCurrencySymbol[aSymbol.Length()] = 0;
|
|
3246 |
TInt r = RProperty::Set(KUidSystemCategory, KLocaleDataExtraKey, TPckg<SLocaleLocaleSettings>(iLocaleExtraSettings));
|
|
3247 |
return r;
|
|
3248 |
}
|
|
3249 |
|
|
3250 |
/**
|
|
3251 |
Returns the name of the DLL containing the given bits of locale information
|
|
3252 |
|
|
3253 |
Given the bits of locale information specified in aLocaleDataSet, it returns the name
|
|
3254 |
of the locale DLL storing the information. TExtendedLocale can contain information from
|
|
3255 |
different DLLs.
|
|
3256 |
|
|
3257 |
@param aLocaleDataSet The TLocaleAspect specifying a group of locale properties
|
|
3258 |
@param aDllName The descriptor that will contain the name of DLL containing the specifying
|
|
3259 |
bits of locale information (valid if the method is successful)
|
|
3260 |
|
|
3261 |
@return KErrNone if successful, system wide error otherwise
|
|
3262 |
*/
|
|
3263 |
EXPORT_C TInt TExtendedLocale::GetLocaleDllName(TLocaleAspect aLocaleDataSet, TDes& aDllName)
|
|
3264 |
{
|
|
3265 |
TBuf8<KMaxFullName> buf;
|
|
3266 |
TAny* ptr = 0;
|
|
3267 |
switch(aLocaleDataSet)
|
|
3268 |
{
|
|
3269 |
case ELocaleLanguageSettings:
|
|
3270 |
ptr = (TAny*)iLanguageSettings.iDateSuffixTable;
|
|
3271 |
break;
|
|
3272 |
case ELocaleCollateSetting:
|
|
3273 |
ptr = (TAny*)iPreferredCharSet;
|
|
3274 |
break;
|
|
3275 |
case ELocaleLocaleSettings:
|
|
3276 |
ptr = (TAny*)iLocaleExtraSettings.iLocaleExtraSettingsDllPtr;
|
|
3277 |
break;
|
|
3278 |
case ELocaleTimeDateSettings:
|
|
3279 |
ptr = (TAny*)iLocaleTimeDateFormat.iLocaleTimeDateFormatDllPtr;
|
|
3280 |
break;
|
|
3281 |
}
|
|
3282 |
TInt r = Exec::GetModuleNameFromAddress(ptr, buf);
|
|
3283 |
if (r == KErrNone)
|
|
3284 |
{
|
|
3285 |
aDllName.Copy(buf);
|
|
3286 |
}
|
|
3287 |
return r;
|
|
3288 |
}
|
|
3289 |
|
|
3290 |
/**
|
|
3291 |
Get the Currency Symbol from SLocaleLocaleSettings object
|
|
3292 |
|
|
3293 |
@return TPtrC Pointer holding the Currency Symbol
|
|
3294 |
*/
|
|
3295 |
EXPORT_C TPtrC TExtendedLocale::GetCurrencySymbol()
|
|
3296 |
{
|
|
3297 |
TPtrC outCurrencySymbolPtr(iLocaleExtraSettings.iCurrencySymbol);
|
|
3298 |
return outCurrencySymbolPtr;
|
|
3299 |
}
|
|
3300 |
|
|
3301 |
/**
|
|
3302 |
Get the Long Date Format from SLocaleTimeDateFormat object
|
|
3303 |
|
|
3304 |
@return TPtrC Pointer holding the Long Date Format
|
|
3305 |
*/
|
|
3306 |
EXPORT_C TPtrC TExtendedLocale::GetLongDateFormatSpec()
|
|
3307 |
{
|
|
3308 |
TPtrC outLongDateFormatPtr(iLocaleTimeDateFormat.iLongDateFormatSpec);
|
|
3309 |
return outLongDateFormatPtr;
|
|
3310 |
}
|
|
3311 |
|
|
3312 |
/**
|
|
3313 |
Get the Short Date Format from SLocaleTimeDateFormat object
|
|
3314 |
|
|
3315 |
@return TPtrC Pointer holding the Short Date Format
|
|
3316 |
*/
|
|
3317 |
EXPORT_C TPtrC TExtendedLocale::GetShortDateFormatSpec()
|
|
3318 |
{
|
|
3319 |
TPtrC outShortDateFormatPtr(iLocaleTimeDateFormat.iShortDateFormatSpec);
|
|
3320 |
return outShortDateFormatPtr;
|
|
3321 |
}
|
|
3322 |
|
|
3323 |
/**
|
|
3324 |
Get the Time Format from SLocaleTimeDateFormat object
|
|
3325 |
|
|
3326 |
@return TPtrC Pointer holding the Time Format
|
|
3327 |
*/
|
|
3328 |
EXPORT_C TPtrC TExtendedLocale::GetTimeFormatSpec()
|
|
3329 |
{
|
|
3330 |
TPtrC outTimeFormatPtr(iLocaleTimeDateFormat.iTimeFormatSpec);
|
|
3331 |
return outTimeFormatPtr;
|
|
3332 |
}
|
|
3333 |
|
|
3334 |
EXPORT_C TInt UserSvr::LocalePropertiesSetDefaults()
|
|
3335 |
{
|
|
3336 |
_LIT_SECURITY_POLICY_C1(KLocaleWritePolicy,ECapabilityWriteDeviceData);
|
|
3337 |
_LIT_SECURITY_POLICY_PASS(KLocaleReadPolicy);
|
|
3338 |
|
|
3339 |
TInt r = RProperty::Define(KUidSystemCategory, KLocaleLanguageKey, RProperty::EByteArray, KLocaleReadPolicy, KLocaleWritePolicy, sizeof(TPckg<SLocaleLanguage>));
|
|
3340 |
if(r != KErrNone && r != KErrAlreadyExists)
|
|
3341 |
return r;
|
|
3342 |
|
|
3343 |
SLocaleLanguage localeLanguage;
|
|
3344 |
localeLanguage.iLanguage = ELangEnglish;
|
|
3345 |
localeLanguage.iDateSuffixTable = (const TText16*)__DefaultDateSuffixTable;
|
|
3346 |
localeLanguage.iDayTable = (const TText16*)__DefaultDayTable;
|
|
3347 |
localeLanguage.iDayAbbTable = (const TText16*)__DefaultDayAbbTable;
|
|
3348 |
localeLanguage.iMonthTable = (const TText16*)__DefaultMonthTable;
|
|
3349 |
localeLanguage.iMonthAbbTable = (const TText16*)__DefaultMonthAbbTable;
|
|
3350 |
localeLanguage.iAmPmTable = (const TText16*)__DefaultAmPmTable;
|
|
3351 |
localeLanguage.iMsgTable = (const TText16* const*)__DefaultLMsgTable;
|
|
3352 |
r = RProperty::Set(KUidSystemCategory, KLocaleLanguageKey, TPckg<SLocaleLanguage>(localeLanguage));
|
|
3353 |
if(r != KErrNone)
|
|
3354 |
return r;
|
|
3355 |
|
|
3356 |
r = RProperty::Define(KUidSystemCategory, KLocaleDataKey, RProperty::EByteArray, KLocaleReadPolicy, KLocaleWritePolicy, sizeof(TPckg<TLocale>));
|
|
3357 |
if(r != KErrNone && r != KErrAlreadyExists)
|
|
3358 |
return r;
|
|
3359 |
|
|
3360 |
TLocale locale(0);
|
|
3361 |
locale.SetDefaults();
|
|
3362 |
|
|
3363 |
r = RProperty::Set(KUidSystemCategory, KLocaleDataKey, TPckg<TLocale>(locale));
|
|
3364 |
if(r != KErrNone)
|
|
3365 |
return r;
|
|
3366 |
|
|
3367 |
r = RProperty::Define(KUidSystemCategory, KLocaleDataExtraKey, RProperty::EByteArray, KLocaleReadPolicy, KLocaleWritePolicy, sizeof(TPckg<SLocaleLocaleSettings>));
|
|
3368 |
if(r != KErrNone && r != KErrAlreadyExists)
|
|
3369 |
return r;
|
|
3370 |
|
|
3371 |
SLocaleLocaleSettings localeSettings;
|
|
3372 |
Mem::Copy(&localeSettings.iCurrencySymbol[0], _S16("\x00a3"), sizeof(TText16) * 2);
|
|
3373 |
|
|
3374 |
r = RProperty::Set(KUidSystemCategory, KLocaleDataExtraKey, TPckg<SLocaleLocaleSettings>(localeSettings));
|
|
3375 |
if(r != KErrNone)
|
|
3376 |
return r;
|
|
3377 |
|
|
3378 |
r = RProperty::Define(KUidSystemCategory, KLocaleTimeDateFormatKey, RProperty::EByteArray, KLocaleReadPolicy, KLocaleWritePolicy, sizeof(TPckg<SLocaleLocaleSettings>));
|
|
3379 |
if(r != KErrNone && r != KErrAlreadyExists)
|
|
3380 |
return r;
|
|
3381 |
|
|
3382 |
SLocaleTimeDateFormat localeTimeDateFormat;
|
|
3383 |
Mem::Copy(&localeTimeDateFormat.iShortDateFormatSpec[0], _S16("%F%*D/%*M/%Y"), sizeof(TText16) * 13);
|
|
3384 |
Mem::Copy(&localeTimeDateFormat.iLongDateFormatSpec[0], _S16("%F%*D%X %N %Y"), sizeof(TText16) * 14);
|
|
3385 |
Mem::Copy(&localeTimeDateFormat.iTimeFormatSpec[0], _S16("%F%*I:%T:%S %*A"), sizeof(TText16) * 16);
|
|
3386 |
|
|
3387 |
r = RProperty::Set(KUidSystemCategory, KLocaleTimeDateFormatKey, TPckg<SLocaleTimeDateFormat>(localeTimeDateFormat));
|
|
3388 |
if(r != KErrNone)
|
|
3389 |
return r;
|
|
3390 |
|
|
3391 |
TInt charSet = (TInt)GetLocaleDefaultCharSet();
|
|
3392 |
r = Exec::SetGlobalUserData(ELocaleDefaultCharSet, charSet);
|
|
3393 |
if(r != KErrNone)
|
|
3394 |
return r;
|
|
3395 |
|
|
3396 |
r = Exec::SetGlobalUserData(ELocalePreferredCharSet, charSet);
|
|
3397 |
|
|
3398 |
return r;
|
|
3399 |
}
|
|
3400 |
|
|
3401 |
|
|
3402 |
// TOverflowHandler class created to handle the descriptor overflow in TLoacle::FormatCurrency
|
|
3403 |
NONSHARABLE_CLASS(TOverflowHandler) : public TDesOverflow
|
|
3404 |
{
|
|
3405 |
void Overflow(TDes& aDes);
|
|
3406 |
};
|
|
3407 |
|
|
3408 |
void TOverflowHandler::Overflow(TDes&)
|
|
3409 |
{
|
|
3410 |
Panic(ETDes16Overflow);
|
|
3411 |
}
|
|
3412 |
|
|
3413 |
|
|
3414 |
|
|
3415 |
|
|
3416 |
EXPORT_C void TLocale::FormatCurrency(TDes& aText, TInt aAmount)
|
|
3417 |
/**
|
|
3418 |
Renders a currency value as text, based on the locale's currency and numeric
|
|
3419 |
format settings.
|
|
3420 |
|
|
3421 |
These settings include the currency symbol, the symbol's position and the
|
|
3422 |
way negative values are formatted.
|
|
3423 |
|
|
3424 |
@param aText On return, contains the currency value as text, formatted
|
|
3425 |
according to the locale's currency format settings.
|
|
3426 |
@param aAmount The currency value to be formatted.
|
|
3427 |
|
|
3428 |
@panic USER 11, if aText is not long enough to hold the formatted value.
|
|
3429 |
*/
|
|
3430 |
{
|
|
3431 |
TOverflowHandler overflowHandler;
|
|
3432 |
FormatCurrency(aText,overflowHandler,aAmount);
|
|
3433 |
}
|
|
3434 |
|
|
3435 |
|
|
3436 |
|
|
3437 |
|
|
3438 |
EXPORT_C void TLocale::FormatCurrency(TDes& aText, TInt64 aAmount)
|
|
3439 |
/**
|
|
3440 |
Renders a currency value as text, based on the locale's currency and numeric
|
|
3441 |
format settings.
|
|
3442 |
|
|
3443 |
These settings include the currency symbol, the symbol's position and the
|
|
3444 |
way negative values are formatted.
|
|
3445 |
|
|
3446 |
@param aText On return, contains the currency value as text, formatted
|
|
3447 |
according to the locale's currency format settings.
|
|
3448 |
@param aAmount The currency value to be formatted.
|
|
3449 |
|
|
3450 |
@panic USER 11, if aText is not long enough to hold the formatted value.
|
|
3451 |
*/
|
|
3452 |
{
|
|
3453 |
TOverflowHandler overflowHandler;
|
|
3454 |
FormatCurrency(aText,overflowHandler, aAmount);
|
|
3455 |
}
|
|
3456 |
|
|
3457 |
|
|
3458 |
|
|
3459 |
|
|
3460 |
EXPORT_C void TLocale::FormatCurrency(TDes& aText, TDesOverflow& aOverflowHandler, TInt aAmount)
|
|
3461 |
/**
|
|
3462 |
Renders a currency value as text, based on the locale's currency and numeric
|
|
3463 |
format settings.
|
|
3464 |
|
|
3465 |
These settings include the currency symbol, the symbol's position and the
|
|
3466 |
way negative values are formatted. If aText is not long enough to hold the
|
|
3467 |
formatted currency value, the overflow handler's Overflow() function is called.
|
|
3468 |
|
|
3469 |
@param aText On return, contains the currency value as text,
|
|
3470 |
formatted according to the locale's currency format
|
|
3471 |
settings.
|
|
3472 |
@param aOverflowHandler An object derived from TDesOverflow which handles
|
|
3473 |
descriptor overflows.
|
|
3474 |
@param aAmount The currency value to be formatted.
|
|
3475 |
*/
|
|
3476 |
{
|
|
3477 |
TInt64 aLongerInt(aAmount);
|
|
3478 |
FormatCurrency(aText, aOverflowHandler, aLongerInt);
|
|
3479 |
}
|
|
3480 |
|
|
3481 |
|
|
3482 |
|
|
3483 |
|
|
3484 |
EXPORT_C void TLocale::FormatCurrency(TDes& aText, TDesOverflow& aOverflowHandler, TInt64 aAmount)
|
|
3485 |
/**
|
|
3486 |
Renders a currency value as text, based on the locale's currency and numeric
|
|
3487 |
format settings.
|
|
3488 |
|
|
3489 |
These settings include the currency symbol, the symbol's position and the
|
|
3490 |
way negative values are formatted. If aText is not long enough to hold the
|
|
3491 |
formatted currency value, the overflow handler's Overflow() function is called.
|
|
3492 |
|
|
3493 |
@param aText On return, contains the currency value as text,
|
|
3494 |
formatted according to the locale's currency format
|
|
3495 |
settings.
|
|
3496 |
@param aOverflowHandler An object derived from TDesOverflow which handles
|
|
3497 |
descriptor overflows.
|
|
3498 |
@param aAmount The currency value to be formatted.
|
|
3499 |
*/
|
|
3500 |
{
|
|
3501 |
// aAmount is in cents (or equivalent) rather than dollars (or equivalent)
|
|
3502 |
const TBool amountIsNegative=(aAmount<0);
|
|
3503 |
if (amountIsNegative)
|
|
3504 |
{
|
|
3505 |
aAmount=-aAmount;
|
|
3506 |
}
|
|
3507 |
aText.Num(aAmount, EDecimal);
|
|
3508 |
const TInt currencyDecimalPlaces=CurrencyDecimalPlaces();
|
|
3509 |
TInt positionOfDecimalSeparator=aText.Length();
|
|
3510 |
if (currencyDecimalPlaces>0)
|
|
3511 |
{
|
|
3512 |
while (positionOfDecimalSeparator <= currencyDecimalPlaces)
|
|
3513 |
{
|
|
3514 |
if (aText.Length() == aText.MaxLength())
|
|
3515 |
{
|
|
3516 |
aOverflowHandler.Overflow(aText);
|
|
3517 |
return;
|
|
3518 |
}
|
|
3519 |
aText.Insert(0,KLitZeroPad);
|
|
3520 |
++positionOfDecimalSeparator;
|
|
3521 |
}
|
|
3522 |
positionOfDecimalSeparator=aText.Length();
|
|
3523 |
positionOfDecimalSeparator-=currencyDecimalPlaces;
|
|
3524 |
TBuf<1> decimalSeparator;
|
|
3525 |
decimalSeparator.Append(DecimalSeparator());
|
|
3526 |
if (aText.Length() == aText.MaxLength())
|
|
3527 |
{
|
|
3528 |
aOverflowHandler.Overflow(aText);
|
|
3529 |
return;
|
|
3530 |
}
|
|
3531 |
aText.Insert(positionOfDecimalSeparator, decimalSeparator);
|
|
3532 |
}
|
|
3533 |
if (CurrencyTriadsAllowed())
|
|
3534 |
{
|
|
3535 |
TBuf<1> thousandsSeparator;
|
|
3536 |
thousandsSeparator.Append(ThousandsSeparator());
|
|
3537 |
TInt numberOfThousandsSeparator = positionOfDecimalSeparator/3;
|
|
3538 |
if ((aText.Length()+numberOfThousandsSeparator) > aText.MaxLength())
|
|
3539 |
{
|
|
3540 |
aOverflowHandler.Overflow(aText);
|
|
3541 |
return;
|
|
3542 |
}
|
|
3543 |
for (TInt i=positionOfDecimalSeparator-3; i>0; i-=3)
|
|
3544 |
{
|
|
3545 |
aText.Insert(i, thousandsSeparator);
|
|
3546 |
}
|
|
3547 |
}
|
|
3548 |
TInt positionToInsertCurrencySymbol = 0;
|
|
3549 |
switch (CurrencySymbolPosition())
|
|
3550 |
{
|
|
3551 |
case ELocaleBefore:
|
|
3552 |
{
|
|
3553 |
if ((amountIsNegative) && (NegativeCurrencySymbolOpposite()))
|
|
3554 |
{
|
|
3555 |
positionToInsertCurrencySymbol=aText.Length();
|
|
3556 |
}
|
|
3557 |
else
|
|
3558 |
positionToInsertCurrencySymbol=0;
|
|
3559 |
}
|
|
3560 |
break;
|
|
3561 |
case ELocaleAfter:
|
|
3562 |
{
|
|
3563 |
if ((amountIsNegative) && (NegativeCurrencySymbolOpposite()))
|
|
3564 |
{
|
|
3565 |
positionToInsertCurrencySymbol=0;
|
|
3566 |
}
|
|
3567 |
else
|
|
3568 |
positionToInsertCurrencySymbol=aText.Length();
|
|
3569 |
}
|
|
3570 |
break;
|
|
3571 |
default:
|
|
3572 |
Panic(ETRegionOutOfRange);
|
|
3573 |
break;
|
|
3574 |
}
|
|
3575 |
if (CurrencySpaceBetween())
|
|
3576 |
{
|
|
3577 |
if (aText.Length() == aText.MaxLength())
|
|
3578 |
{
|
|
3579 |
aOverflowHandler.Overflow(aText);
|
|
3580 |
return;
|
|
3581 |
}
|
|
3582 |
if ((amountIsNegative) && (NegativeLoseSpace()))
|
|
3583 |
{
|
|
3584 |
// don't add the space
|
|
3585 |
}
|
|
3586 |
else
|
|
3587 |
{
|
|
3588 |
aText.Insert(positionToInsertCurrencySymbol, KLitSpace);
|
|
3589 |
if (positionToInsertCurrencySymbol>0)
|
|
3590 |
{
|
|
3591 |
++positionToInsertCurrencySymbol;
|
|
3592 |
}
|
|
3593 |
}
|
|
3594 |
}
|
|
3595 |
TCurrencySymbol theCurrencySymbol;
|
|
3596 |
if ((aText.Length()+theCurrencySymbol.Length()) > aText.MaxLength())
|
|
3597 |
{
|
|
3598 |
aOverflowHandler.Overflow(aText);
|
|
3599 |
return;
|
|
3600 |
}
|
|
3601 |
aText.Insert(positionToInsertCurrencySymbol,theCurrencySymbol);
|
|
3602 |
if (amountIsNegative)
|
|
3603 |
{
|
|
3604 |
TInt positionToInsertInterveningMinusSign = 0;
|
|
3605 |
if ((CurrencySpaceBetween()) && !(NegativeLoseSpace()))
|
|
3606 |
{
|
|
3607 |
if (positionToInsertCurrencySymbol>0)
|
|
3608 |
{
|
|
3609 |
positionToInsertInterveningMinusSign = positionToInsertCurrencySymbol-1;
|
|
3610 |
}
|
|
3611 |
else
|
|
3612 |
{
|
|
3613 |
positionToInsertInterveningMinusSign = theCurrencySymbol.Length()+1;
|
|
3614 |
}
|
|
3615 |
}
|
|
3616 |
else
|
|
3617 |
{
|
|
3618 |
if (positionToInsertCurrencySymbol>0)
|
|
3619 |
{
|
|
3620 |
positionToInsertInterveningMinusSign = positionToInsertCurrencySymbol;
|
|
3621 |
}
|
|
3622 |
else
|
|
3623 |
{
|
|
3624 |
positionToInsertInterveningMinusSign = theCurrencySymbol.Length();
|
|
3625 |
}
|
|
3626 |
}
|
|
3627 |
switch (NegativeCurrencyFormat())
|
|
3628 |
{
|
|
3629 |
case EInBrackets:
|
|
3630 |
{
|
|
3631 |
if ((aText.Length()+2) > aText.MaxLength())
|
|
3632 |
{
|
|
3633 |
aOverflowHandler.Overflow(aText);
|
|
3634 |
return;
|
|
3635 |
}
|
|
3636 |
aText.Insert(0, KLitOpeningBracket);
|
|
3637 |
aText.Append(')');
|
|
3638 |
}
|
|
3639 |
break;
|
|
3640 |
case ELeadingMinusSign:
|
|
3641 |
{
|
|
3642 |
if (aText.Length() == aText.MaxLength())
|
|
3643 |
{
|
|
3644 |
aOverflowHandler.Overflow(aText);
|
|
3645 |
return;
|
|
3646 |
}
|
|
3647 |
aText.Insert(0, KLitMinusSign);
|
|
3648 |
}
|
|
3649 |
break;
|
|
3650 |
case ETrailingMinusSign:
|
|
3651 |
{
|
|
3652 |
if (aText.Length() == aText.MaxLength())
|
|
3653 |
{
|
|
3654 |
aOverflowHandler.Overflow(aText);
|
|
3655 |
return;
|
|
3656 |
}
|
|
3657 |
aText.Append(KLitMinusSign);
|
|
3658 |
}
|
|
3659 |
break;
|
|
3660 |
case EInterveningMinusSign:
|
|
3661 |
{
|
|
3662 |
if (aText.Length() == aText.MaxLength())
|
|
3663 |
{
|
|
3664 |
aOverflowHandler.Overflow(aText);
|
|
3665 |
return;
|
|
3666 |
}
|
|
3667 |
aText.Insert(positionToInsertInterveningMinusSign, KLitMinusSign);
|
|
3668 |
}
|
|
3669 |
break;
|
|
3670 |
default:
|
|
3671 |
Panic(ETRegionOutOfRange);
|
|
3672 |
break;
|
|
3673 |
}
|
|
3674 |
}
|
|
3675 |
}
|
|
3676 |
|
|
3677 |
|
|
3678 |
EXPORT_C void TLocaleMessageText::Set(TLocaleMessage aMsgNo)
|
|
3679 |
//
|
|
3680 |
// Get some text from Locale
|
|
3681 |
//
|
|
3682 |
{
|
|
3683 |
if(TUint(aMsgNo) < ELocaleMessages_LastMsg)
|
|
3684 |
{
|
|
3685 |
SLocaleLanguage localeLanguage;
|
|
3686 |
LocaleLanguageGet(localeLanguage);
|
|
3687 |
Copy((reinterpret_cast<const TText* const*>(localeLanguage.iMsgTable))[aMsgNo]);
|
|
3688 |
}
|
|
3689 |
else
|
|
3690 |
SetLength(0);
|
|
3691 |
}
|
|
3692 |
|
|
3693 |
|
|
3694 |
|
|
3695 |
|
|
3696 |
EXPORT_C TInt TFindServer::Next(TFullName &aResult)
|
|
3697 |
/**
|
|
3698 |
Gets the full name of the next server which matches the match pattern.
|
|
3699 |
|
|
3700 |
@param aResult A reference to a descriptor with a defined maximum length.
|
|
3701 |
If a matching server is found, its full name is set into
|
|
3702 |
this descriptor. If no matching server is found,
|
|
3703 |
the descriptor length is set to zero.
|
|
3704 |
|
|
3705 |
@return KErrNone if a matching server is found, KErrNotFound otherwise.
|
|
3706 |
*/
|
|
3707 |
{
|
|
3708 |
return NextObject(aResult,EServer);
|
|
3709 |
}
|
|
3710 |
|
|
3711 |
|
|
3712 |
|
|
3713 |
|
|
3714 |
EXPORT_C void RServer2::Receive(RMessage2& aMessage, TRequestStatus &aStatus)
|
|
3715 |
//
|
|
3716 |
// Receive a message from the server asynchronously.
|
|
3717 |
//
|
|
3718 |
{
|
|
3719 |
|
|
3720 |
aStatus=KRequestPending;
|
|
3721 |
Exec::ServerReceive(iHandle, aStatus, &aMessage);
|
|
3722 |
}
|
|
3723 |
|
|
3724 |
EXPORT_C void RServer2::Cancel()
|
|
3725 |
//
|
|
3726 |
// Cancel a pending message receive.
|
|
3727 |
//
|
|
3728 |
{
|
|
3729 |
|
|
3730 |
Exec::ServerCancel(iHandle);
|
|
3731 |
}
|
|
3732 |
|
|
3733 |
|
|
3734 |
|
|
3735 |
|
|
3736 |
EXPORT_C TInt TFindMutex::Next(TFullName &aResult)
|
|
3737 |
/**
|
|
3738 |
Finds the next global mutex whose full name matches the match pattern.
|
|
3739 |
|
|
3740 |
If a global mutex with a matching name is found, the function copies its full
|
|
3741 |
name into the specified descriptor. It also saves the find-handle associated
|
|
3742 |
with the global mutex into the TFindHandleBase part of this object.
|
|
3743 |
|
|
3744 |
@param aResult A reference to a descriptor with a defined maximum length.
|
|
3745 |
If a matching global mutex is found, its full name is set
|
|
3746 |
into this descriptor.
|
|
3747 |
If no matching global mutex is found, the descriptor length
|
|
3748 |
is set to zero.
|
|
3749 |
|
|
3750 |
@return KErrNone if a matching global mutex is found;
|
|
3751 |
KErrNotFound otherwise.
|
|
3752 |
*/
|
|
3753 |
{
|
|
3754 |
return NextObject(aResult,EMutex);
|
|
3755 |
}
|
|
3756 |
|
|
3757 |
|
|
3758 |
|
|
3759 |
|
|
3760 |
/**
|
|
3761 |
Acquire the mutex, waiting for it to become free if necessary.
|
|
3762 |
|
|
3763 |
This function checks if the mutex is currently held. If not the mutex is marked
|
|
3764 |
as held by the current thread and the call returns immediately. If the mutex is
|
|
3765 |
held by another thread the current thread will suspend until the mutex becomes
|
|
3766 |
free. If the mutex is already held by the current thread a count is maintained
|
|
3767 |
of how many times the thread has acquired the mutex.
|
|
3768 |
*/
|
|
3769 |
EXPORT_C void RMutex::Wait()
|
|
3770 |
{
|
|
3771 |
|
|
3772 |
Exec::MutexWait(iHandle);
|
|
3773 |
}
|
|
3774 |
|
|
3775 |
|
|
3776 |
|
|
3777 |
|
|
3778 |
/**
|
|
3779 |
Release the mutex.
|
|
3780 |
|
|
3781 |
This function decrements the count of how many times the current thread has
|
|
3782 |
acquired this mutex. If the count is now zero the mutex is marked as free and,
|
|
3783 |
if any other threads are waiting for the mutex to become free, the highest
|
|
3784 |
priority among those is made ready to run. However the mutex is not marked as
|
|
3785 |
held by any thread - the thread which has just been awakened must actually run
|
|
3786 |
in order to acquire the mutex.
|
|
3787 |
|
|
3788 |
@pre The mutex must previously have been acquired by the current thread calling
|
|
3789 |
Wait().
|
|
3790 |
|
|
3791 |
@panic KERN-EXEC 1 If the mutex has not previously been acquired by the current
|
|
3792 |
thread calling Wait().
|
|
3793 |
*/
|
|
3794 |
EXPORT_C void RMutex::Signal()
|
|
3795 |
{
|
|
3796 |
|
|
3797 |
Exec::MutexSignal(iHandle);
|
|
3798 |
}
|
|
3799 |
|
|
3800 |
|
|
3801 |
|
|
3802 |
/**
|
|
3803 |
Test if this mutex is held by the current thread.
|
|
3804 |
@return True if the current thread has waited on the mutex, false otherwise.
|
|
3805 |
*/
|
|
3806 |
EXPORT_C TBool RMutex::IsHeld()
|
|
3807 |
{
|
|
3808 |
return Exec::MutexIsHeld(iHandle);
|
|
3809 |
}
|
|
3810 |
|
|
3811 |
|
|
3812 |
/** Wait on a condition variable
|
|
3813 |
|
|
3814 |
This call releases the specified mutex then atomically blocks the current
|
|
3815 |
thread on this condition variable. The atomicity here is with respect to the
|
|
3816 |
condition variable and mutex concerned. Specifically if the condition variable
|
|
3817 |
is signalled at any time after the mutex is released then this thread will be
|
|
3818 |
awakened. Once the thread has awakened it will reacquire the specified mutex
|
|
3819 |
before this call returns (except in the case where the condition variable has
|
|
3820 |
been deleted).
|
|
3821 |
|
|
3822 |
The usage pattern for this is as follows:
|
|
3823 |
|
|
3824 |
@code
|
|
3825 |
mutex.Wait();
|
|
3826 |
while(!CONDITION)
|
|
3827 |
condvar.Wait(mutex);
|
|
3828 |
STATEMENTS;
|
|
3829 |
mutex.Signal();
|
|
3830 |
@endcode
|
|
3831 |
|
|
3832 |
where CONDITION is an arbitrary condition involving any number of user-side
|
|
3833 |
variables whose integrity is protected by the mutex.
|
|
3834 |
|
|
3835 |
It is necessary to loop while testing the condition because there is **no** guarantee
|
|
3836 |
that the condition has been satisfied when the condition variable is signalled.
|
|
3837 |
Different threads may be waiting on different conditions or the condition may
|
|
3838 |
have already been absorbed by another thread. All that can be said is that the
|
|
3839 |
thread will awaken whenever something happens which **might** affect the condition.
|
|
3840 |
|
|
3841 |
It needs to be stressed that if:
|
|
3842 |
|
|
3843 |
@code
|
|
3844 |
condvar.Wait(mutex);
|
|
3845 |
@endcode
|
|
3846 |
|
|
3847 |
completes, it does not necessarily mean that the condition is yet satisfied, hence the necessity for the loop.
|
|
3848 |
|
|
3849 |
@param aMutex The mutex to be released and reacquired.
|
|
3850 |
@return KErrNone if the condition variable has been signalled.
|
|
3851 |
KErrInUse if another thread is already waiting on this condition
|
|
3852 |
variable in conjunction with a different mutex.
|
|
3853 |
KErrGeneral if the condition variable is deleted.
|
|
3854 |
|
|
3855 |
@pre The specified mutex is held by the current thread.
|
|
3856 |
@post The specified mutex is held by the current thread unless the return
|
|
3857 |
value is KErrGeneral in which case the condition variable no longer
|
|
3858 |
exists.
|
|
3859 |
|
|
3860 |
@panic KERN-EXEC 0 if either the condition variable or mutex handles are not
|
|
3861 |
valid.
|
|
3862 |
@panic KERN-EXEC 54 if the current thread does not hold the specified mutex.
|
|
3863 |
|
|
3864 |
@see RCondVar::Signal()
|
|
3865 |
@see RCondVar::Broadcast()
|
|
3866 |
*/
|
|
3867 |
EXPORT_C TInt RCondVar::Wait(RMutex& aMutex)
|
|
3868 |
{
|
|
3869 |
return Exec::CondVarWait(iHandle, aMutex.Handle(), 0);
|
|
3870 |
}
|
|
3871 |
|
|
3872 |
|
|
3873 |
|
|
3874 |
/** Wait on a condition variable with timeout
|
|
3875 |
|
|
3876 |
This is the same as RCondVar::Wait(RMutex) except that there is a time limit on
|
|
3877 |
how long the current thread will block while waiting for the condition variable.
|
|
3878 |
|
|
3879 |
@param aMutex The mutex to be released and reacquired.
|
|
3880 |
@param aTimeout The maximum time to wait in microseconds.
|
|
3881 |
0 means no maximum.
|
|
3882 |
@return KErrNone if the condition variable has been signalled.
|
|
3883 |
KErrInUse if another thread is already waiting on this condition
|
|
3884 |
variable in conjunction with a different mutex.
|
|
3885 |
KErrGeneral if the condition variable is deleted.
|
|
3886 |
KErrTimedOut if the timeout expired before the condition variable was
|
|
3887 |
signalled.
|
|
3888 |
|
|
3889 |
@pre The specified mutex is held by the current thread.
|
|
3890 |
@post The specified mutex is held by the current thread unless the return
|
|
3891 |
value is KErrGeneral in which case the condition variable no longer
|
|
3892 |
exists.
|
|
3893 |
|
|
3894 |
@panic KERN-EXEC 0 if either the condition variable or mutex handles are not
|
|
3895 |
valid.
|
|
3896 |
@panic KERN-EXEC 54 if the current thread does not hold the specified mutex.
|
|
3897 |
|
|
3898 |
@see RCondVar::Wait(RMutex)
|
|
3899 |
*/
|
|
3900 |
EXPORT_C TInt RCondVar::TimedWait(RMutex& aMutex, TInt aTimeout)
|
|
3901 |
{
|
|
3902 |
return Exec::CondVarWait(iHandle, aMutex.Handle(), aTimeout);
|
|
3903 |
}
|
|
3904 |
|
|
3905 |
|
|
3906 |
/** Signal a condition variable
|
|
3907 |
|
|
3908 |
This unblocks a single thread which is currently blocked on the condition
|
|
3909 |
variable. The highest priority waiting thread which is not explicitly suspended
|
|
3910 |
will be the one unblocked. If there are no threads currently waiting this call
|
|
3911 |
does nothing.
|
|
3912 |
|
|
3913 |
It is not required that any mutex is held when calling this function but it is
|
|
3914 |
recommended that the mutex associated with the condition variable is held since
|
|
3915 |
otherwise a race condition can result from the condition variable being signalled
|
|
3916 |
just after the waiting thread testing the condition and before it calls Wait().
|
|
3917 |
|
|
3918 |
*/
|
|
3919 |
EXPORT_C void RCondVar::Signal()
|
|
3920 |
{
|
|
3921 |
Exec::CondVarSignal(iHandle);
|
|
3922 |
}
|
|
3923 |
|
|
3924 |
|
|
3925 |
|
|
3926 |
/** Broadcast to a condition variable
|
|
3927 |
|
|
3928 |
This unblocks all threads which are currently blocked on the condition
|
|
3929 |
variable. If there are no threads currently waiting this call does nothing.
|
|
3930 |
|
|
3931 |
It is not required that any mutex is held when calling this function but it is
|
|
3932 |
recommended that the mutex associated with the condition variable is held since
|
|
3933 |
otherwise a race condition can result from the condition variable being signalled
|
|
3934 |
just after the waiting thread testing the condition and before it calls Wait().
|
|
3935 |
|
|
3936 |
*/
|
|
3937 |
EXPORT_C void RCondVar::Broadcast()
|
|
3938 |
{
|
|
3939 |
Exec::CondVarBroadcast(iHandle);
|
|
3940 |
}
|
|
3941 |
|
|
3942 |
|
|
3943 |
|
|
3944 |
|
|
3945 |
EXPORT_C TInt TFindProcess::Next(TFullName &aResult)
|
|
3946 |
/**
|
|
3947 |
Gets the full name of the next process which matches the match pattern.
|
|
3948 |
|
|
3949 |
@param aResult A reference to a TBuf descriptor with a defined maximum length.
|
|
3950 |
If a matching process is found, its full name is set into
|
|
3951 |
this descriptor. If no matching process is found, the descriptor
|
|
3952 |
length is set to zero.
|
|
3953 |
|
|
3954 |
@return KErrNone if successful, otherwise one of the other system-wide error
|
|
3955 |
codes.
|
|
3956 |
*/
|
|
3957 |
{
|
|
3958 |
return NextObject(aResult,EProcess);
|
|
3959 |
}
|
|
3960 |
|
|
3961 |
|
|
3962 |
|
|
3963 |
|
|
3964 |
EXPORT_C TUidType RProcess::Type() const
|
|
3965 |
/**
|
|
3966 |
Gets the Uid type associated with the process.
|
|
3967 |
|
|
3968 |
@return A reference to a TUidType object containing the process type.
|
|
3969 |
*/
|
|
3970 |
{
|
|
3971 |
|
|
3972 |
TUidType u;
|
|
3973 |
Exec::ProcessType(iHandle,u);
|
|
3974 |
return(u);
|
|
3975 |
}
|
|
3976 |
|
|
3977 |
|
|
3978 |
|
|
3979 |
|
|
3980 |
EXPORT_C TProcessId RProcess::Id() const
|
|
3981 |
/**
|
|
3982 |
Gets the Id of this process.
|
|
3983 |
|
|
3984 |
@return The Id of this process.
|
|
3985 |
*/
|
|
3986 |
{
|
|
3987 |
|
|
3988 |
return TProcessId( (TUint)Exec::ProcessId(iHandle) );
|
|
3989 |
}
|
|
3990 |
|
|
3991 |
|
|
3992 |
|
|
3993 |
|
|
3994 |
EXPORT_C void RProcess::Resume()
|
|
3995 |
/**
|
|
3996 |
Makes the first thread in the process eligible for execution.
|
|
3997 |
|
|
3998 |
@panic KERN-EXEC 32 if the process is not yet fully loaded.
|
|
3999 |
|
|
4000 |
@see RThread::Resume()
|
|
4001 |
*/
|
|
4002 |
{
|
|
4003 |
|
|
4004 |
Exec::ProcessResume(iHandle);
|
|
4005 |
}
|
|
4006 |
|
|
4007 |
|
|
4008 |
|
|
4009 |
EXPORT_C TFileName RProcess::FileName() const
|
|
4010 |
/**
|
|
4011 |
Gets a copy of the full path name of the loaded executable on which this
|
|
4012 |
process is based.
|
|
4013 |
|
|
4014 |
This is the file name which is passed to the Create() member function of this
|
|
4015 |
RProcess.
|
|
4016 |
|
|
4017 |
@return A TBuf descriptor with a defined maximum length containing the full
|
|
4018 |
path name of the file.
|
|
4019 |
|
|
4020 |
@see RProcess::Create()
|
|
4021 |
*/
|
|
4022 |
{
|
|
4023 |
|
|
4024 |
TFileName n;
|
|
4025 |
TPtr8 n8(((TUint8*)n.Ptr()) + KMaxFileName, KMaxFileName);
|
|
4026 |
Exec::ProcessFileName(iHandle,n8);
|
|
4027 |
n.Copy(n8);
|
|
4028 |
return(n);
|
|
4029 |
}
|
|
4030 |
|
|
4031 |
|
|
4032 |
|
|
4033 |
|
|
4034 |
EXPORT_C void User::CommandLine(TDes &aCommand)
|
|
4035 |
/**
|
|
4036 |
Gets a copy of the data which is passed as an argument to the thread function
|
|
4037 |
of the current process's main thread when it is first scheduled to run.
|
|
4038 |
|
|
4039 |
@param aCommand A modifiable descriptor supplied by the caller into which the
|
|
4040 |
argument data is put. The descriptor must be big enough to
|
|
4041 |
contain the expected data, otherwise the function raises
|
|
4042 |
a panic.
|
|
4043 |
|
|
4044 |
@see User::CommandLineLength()
|
|
4045 |
*/
|
|
4046 |
{
|
|
4047 |
TPtr8 aCommand8((TUint8*)aCommand.Ptr(),aCommand.MaxLength()<<1);
|
|
4048 |
Exec::ProcessCommandLine(KCurrentProcessHandle,aCommand8);
|
|
4049 |
aCommand.SetLength(aCommand8.Length()>>1);
|
|
4050 |
}
|
|
4051 |
|
|
4052 |
|
|
4053 |
|
|
4054 |
|
|
4055 |
EXPORT_C TInt User::CommandLineLength()
|
|
4056 |
/**
|
|
4057 |
Gets the length of the data which is passed as an argument to the thread
|
|
4058 |
function of the current process's main thread when it is first scheduled
|
|
4059 |
to run.
|
|
4060 |
|
|
4061 |
@return The length of the argument data.
|
|
4062 |
*/
|
|
4063 |
{
|
|
4064 |
return Exec::ProcessCommandLineLength(KCurrentProcessHandle);
|
|
4065 |
}
|
|
4066 |
|
|
4067 |
|
|
4068 |
|
|
4069 |
|
|
4070 |
EXPORT_C TExitType RProcess::ExitType() const
|
|
4071 |
/**
|
|
4072 |
Tests whether the process has ended and, if it has ended, return how it ended.
|
|
4073 |
|
|
4074 |
This information allows the caller to distinguish between normal termination
|
|
4075 |
and a panic.
|
|
4076 |
|
|
4077 |
@return An enumeration whose enumerators describe how the process has ended.
|
|
4078 |
*/
|
|
4079 |
{
|
|
4080 |
|
|
4081 |
return(Exec::ProcessExitType(iHandle));
|
|
4082 |
}
|
|
4083 |
|
|
4084 |
|
|
4085 |
|
|
4086 |
|
|
4087 |
EXPORT_C TInt RProcess::ExitReason() const
|
|
4088 |
/**
|
|
4089 |
Gets the specific reason associated with the end of this process.
|
|
4090 |
|
|
4091 |
The reason number together with the category name is a way of distinguishing
|
|
4092 |
between different causes of process termination.
|
|
4093 |
|
|
4094 |
If the process has panicked, this value is the panic number. If the process
|
|
4095 |
has ended as a result of a call to Kill(), then the value is the one supplied
|
|
4096 |
by Kill().
|
|
4097 |
|
|
4098 |
If the process has not ended, then the returned value is zero.
|
|
4099 |
|
|
4100 |
@return The reason associated with the end of the process.
|
|
4101 |
|
|
4102 |
@see RProcess::Kill()
|
|
4103 |
*/
|
|
4104 |
{
|
|
4105 |
|
|
4106 |
return(Exec::ProcessExitReason(iHandle));
|
|
4107 |
}
|
|
4108 |
|
|
4109 |
|
|
4110 |
|
|
4111 |
|
|
4112 |
EXPORT_C TExitCategoryName RProcess::ExitCategory() const
|
|
4113 |
/**
|
|
4114 |
Gets the name of the category associated with the end of the process.
|
|
4115 |
|
|
4116 |
The category name together with the reason number is a way of distinguishing
|
|
4117 |
between different causes of process termination.
|
|
4118 |
|
|
4119 |
If the process has panicked, the category name is the panic category name;
|
|
4120 |
for example, E32USER-CBase or KERN-EXEC. If the process has ended as a result
|
|
4121 |
of a call to Kill(), then the category name is Kill.
|
|
4122 |
|
|
4123 |
If the process has not ended, then the category name is empty, i.e. the length
|
|
4124 |
of the category name is zero.
|
|
4125 |
|
|
4126 |
@return A descriptor with a defined maximum length containing the
|
|
4127 |
name of the category associated with the end of the process.
|
|
4128 |
|
|
4129 |
@see RProcess::Kill()
|
|
4130 |
*/
|
|
4131 |
{
|
|
4132 |
|
|
4133 |
TExitCategoryName n;
|
|
4134 |
TPtr8 n8(((TUint8*)n.Ptr()) + KMaxExitCategoryName, KMaxExitCategoryName);
|
|
4135 |
Exec::ProcessExitCategory(iHandle,n8);
|
|
4136 |
n.Copy(n8);
|
|
4137 |
return(n);
|
|
4138 |
}
|
|
4139 |
|
|
4140 |
|
|
4141 |
|
|
4142 |
|
|
4143 |
EXPORT_C TProcessPriority RProcess::Priority() const
|
|
4144 |
/**
|
|
4145 |
Gets the priority of this process.
|
|
4146 |
|
|
4147 |
@return One of the TProcessPriority enumerator values.
|
|
4148 |
*/
|
|
4149 |
{
|
|
4150 |
|
|
4151 |
return(Exec::ProcessPriority(iHandle));
|
|
4152 |
}
|
|
4153 |
|
|
4154 |
|
|
4155 |
|
|
4156 |
|
|
4157 |
EXPORT_C TInt RProcess::SetPriority(TProcessPriority aPriority) const
|
|
4158 |
/**
|
|
4159 |
Sets the priority of this process to one of the values defined by theTProcessPriority
|
|
4160 |
enumeration. The priority can be set to one of the four values:
|
|
4161 |
|
|
4162 |
EPriorityLow
|
|
4163 |
|
|
4164 |
EPriorityBackground
|
|
4165 |
|
|
4166 |
EPriorityForeground
|
|
4167 |
|
|
4168 |
EPriorityHigh
|
|
4169 |
|
|
4170 |
The absolute priority of all threads owned by the process (and all threads
|
|
4171 |
owned by those threads etc.) are re-calculated.
|
|
4172 |
|
|
4173 |
Notes:
|
|
4174 |
|
|
4175 |
The priority values EPriorityWindowServer, EPriorityFileServer, EPriorityRealTimeServer
|
|
4176 |
and EPrioritySupervisor are internal to Symbian OS and any attempt to explicitly
|
|
4177 |
set any of these priority values causes a KERN-EXEC 14 panic to be raised.
|
|
4178 |
|
|
4179 |
Any attempt to set the priority of a process which is protected and is different
|
|
4180 |
from the process owning the thread which invokes this function, causes a KERN-EXEC
|
|
4181 |
1 panic to be raised.
|
|
4182 |
|
|
4183 |
A process can set its own priority whether it is protected or not.
|
|
4184 |
|
|
4185 |
@param aPriority The priority value.
|
|
4186 |
|
|
4187 |
@return KErrNone, if successful; otherwise one of the other system-wide
|
|
4188 |
error codes.
|
|
4189 |
|
|
4190 |
*/
|
|
4191 |
{
|
|
4192 |
|
|
4193 |
return Exec::ProcessSetPriority(iHandle,aPriority);
|
|
4194 |
}
|
|
4195 |
|
|
4196 |
|
|
4197 |
|
|
4198 |
|
|
4199 |
/**
|
|
4200 |
Tests whether "Just In Time" debugging is enabled or not for this process.
|
|
4201 |
|
|
4202 |
@return True, when "Just In Time" debugging is enabled. False otherwise.
|
|
4203 |
@see RProcess::SetJustInTime
|
|
4204 |
*/
|
|
4205 |
|
|
4206 |
EXPORT_C TBool RProcess::JustInTime() const
|
|
4207 |
{
|
|
4208 |
|
|
4209 |
return (Exec::ProcessFlags(iHandle) & KProcessFlagJustInTime) != 0;
|
|
4210 |
}
|
|
4211 |
|
|
4212 |
|
|
4213 |
/**
|
|
4214 |
Enables or disables "Just In Time" debugging for this process.
|
|
4215 |
This will only have an effect when running on the emulator.
|
|
4216 |
|
|
4217 |
"Just In Time" debugging catches a thread just before it executes a panic
|
|
4218 |
or exception routine. Capturing a thread early, before it is terminated,
|
|
4219 |
allows the developer to more closely inspect what went wrong, before the
|
|
4220 |
kernel removes the thread. In some cases, the developer can modify context,
|
|
4221 |
program counter, and variables to recover the thread. This is only possible
|
|
4222 |
on the emulator.
|
|
4223 |
|
|
4224 |
By default, "Just In Time" debugging is enabled.
|
|
4225 |
|
|
4226 |
@param aBoolean ETrue, to enable just-in-time debugging.
|
|
4227 |
EFalse, to disable just-in-time debugging.
|
|
4228 |
*/
|
|
4229 |
EXPORT_C void RProcess::SetJustInTime(TBool aState) const
|
|
4230 |
{
|
|
4231 |
|
|
4232 |
TUint32 set = aState ? KProcessFlagJustInTime : 0;
|
|
4233 |
Exec::ProcessSetFlags(iHandle, KProcessFlagJustInTime, set);
|
|
4234 |
}
|
|
4235 |
|
|
4236 |
|
|
4237 |
|
|
4238 |
|
|
4239 |
EXPORT_C TInt RProcess::SecureApi(TInt /*aState*/)
|
|
4240 |
{
|
|
4241 |
return ESecureApiOn;
|
|
4242 |
}
|
|
4243 |
|
|
4244 |
EXPORT_C TInt RProcess::DataCaging(TInt /*aState*/)
|
|
4245 |
{
|
|
4246 |
return EDataCagingOn;
|
|
4247 |
}
|
|
4248 |
|
|
4249 |
|
|
4250 |
|
|
4251 |
EXPORT_C TInt RProcess::GetMemoryInfo(TModuleMemoryInfo& aInfo) const
|
|
4252 |
/**
|
|
4253 |
Gets the size and base address of the code and various data
|
|
4254 |
sections of the process.
|
|
4255 |
|
|
4256 |
The run addresses are also returned.
|
|
4257 |
|
|
4258 |
@param aInfo On successful return, contains the base address and size of the
|
|
4259 |
sections.
|
|
4260 |
|
|
4261 |
@return KErrNone, if successful; otherwise one of the other system wide error
|
|
4262 |
codes.
|
|
4263 |
*/
|
|
4264 |
{
|
|
4265 |
|
|
4266 |
return Exec::ProcessGetMemoryInfo(iHandle,aInfo);
|
|
4267 |
}
|
|
4268 |
|
|
4269 |
|
|
4270 |
EXPORT_C TAny* RProcess::ExeExportData(void)
|
|
4271 |
/**
|
|
4272 |
Retrieves pointer to named symbol export data from the current process, i.e. the
|
|
4273 |
process calling this function.
|
|
4274 |
|
|
4275 |
@return Pointer to export data when it is present, NULL if export data not found
|
|
4276 |
@internalTechnology
|
|
4277 |
@released
|
|
4278 |
*/
|
|
4279 |
{
|
|
4280 |
|
|
4281 |
return Exec::ProcessExeExportData();
|
|
4282 |
}
|
|
4283 |
|
|
4284 |
|
|
4285 |
|
|
4286 |
EXPORT_C TInt TFindSemaphore::Next(TFullName &aResult)
|
|
4287 |
/**
|
|
4288 |
Finds the next global semaphore whose full name matches the match pattern.
|
|
4289 |
|
|
4290 |
If a global semaphore with a matching name is found, the function copies its
|
|
4291 |
full name into the descriptor aResult. It also saves the find-handle associated
|
|
4292 |
with the global semaphore into the TFindHandleBase part of this TFindSemaphore
|
|
4293 |
object.
|
|
4294 |
|
|
4295 |
@param aResult A reference to a TBuf descriptor with a defined maximum length.
|
|
4296 |
If a matching global semaphore is found, its full name is set
|
|
4297 |
into this descriptor.
|
|
4298 |
If no matching global semaphore is found, the descriptor length
|
|
4299 |
is set to zero.
|
|
4300 |
|
|
4301 |
@return KErrNone if a matching global semaphore is found;
|
|
4302 |
KErrNotFound otherwise.
|
|
4303 |
*/
|
|
4304 |
{
|
|
4305 |
return NextObject(aResult,ESemaphore);
|
|
4306 |
}
|
|
4307 |
|
|
4308 |
|
|
4309 |
|
|
4310 |
|
|
4311 |
EXPORT_C void RSemaphore::Wait()
|
|
4312 |
/**
|
|
4313 |
Waits for a signal on the semaphore.
|
|
4314 |
|
|
4315 |
The function decrements the semaphore count by one and returns immediately
|
|
4316 |
if it is zero or positive.
|
|
4317 |
|
|
4318 |
If the semaphore count is negative after being decremented, the calling thread is
|
|
4319 |
added to a queue of threads maintained by this semaphore.
|
|
4320 |
|
|
4321 |
The thread waits until the semaphore is signalled. More than one thread can
|
|
4322 |
be waiting on a particular semaphore at a time. When there are multiple threads
|
|
4323 |
waiting on a semaphore, they are released in priority order.
|
|
4324 |
|
|
4325 |
If the semaphore is deleted, all threads waiting on that semaphore are released.
|
|
4326 |
*/
|
|
4327 |
{
|
|
4328 |
|
|
4329 |
Exec::SemaphoreWait(iHandle, 0);
|
|
4330 |
}
|
|
4331 |
|
|
4332 |
|
|
4333 |
|
|
4334 |
|
|
4335 |
EXPORT_C TInt RSemaphore::Wait(TInt aTimeout)
|
|
4336 |
/**
|
|
4337 |
Waits for a signal on the semaphore, or a timeout.
|
|
4338 |
|
|
4339 |
@param aTimeout The timeout value in micoseconds
|
|
4340 |
|
|
4341 |
@return KErrNone if the wait has completed normally.
|
|
4342 |
KErrTimedOut if the timeout has expired.
|
|
4343 |
KErrGeneral if the semaphore is being reset, i.e the semaphore
|
|
4344 |
is about to be deleted.
|
|
4345 |
KErrArgument if aTimeout is negative;
|
|
4346 |
otherwise one of the other system wide error codes.
|
|
4347 |
*/
|
|
4348 |
{
|
|
4349 |
|
|
4350 |
return Exec::SemaphoreWait(iHandle, aTimeout);
|
|
4351 |
}
|
|
4352 |
|
|
4353 |
|
|
4354 |
|
|
4355 |
|
|
4356 |
EXPORT_C void RSemaphore::Signal()
|
|
4357 |
/**
|
|
4358 |
Signals the semaphore once.
|
|
4359 |
|
|
4360 |
The function increments the semaphore count by one. If the count was negative
|
|
4361 |
before being incremented, the highest priority thread waiting on the semaphore's queue
|
|
4362 |
of threads is removed from that queue and, provided that it is not suspended
|
|
4363 |
for any other reason, is marked as ready to run.
|
|
4364 |
*/
|
|
4365 |
{
|
|
4366 |
|
|
4367 |
Exec::SemaphoreSignal1(iHandle);
|
|
4368 |
}
|
|
4369 |
|
|
4370 |
|
|
4371 |
|
|
4372 |
|
|
4373 |
EXPORT_C void RSemaphore::Signal(TInt aCount)
|
|
4374 |
/**
|
|
4375 |
Signals the semaphore one or more times.
|
|
4376 |
|
|
4377 |
The function increments the semaphore count. If the count was negative
|
|
4378 |
before being incremented, the highest priority thread waiting on the semaphore's queue
|
|
4379 |
of threads is removed from that queue and, provided that it is not suspended
|
|
4380 |
for any other reason, is marked as ready to run.
|
|
4381 |
|
|
4382 |
@param aCount The number of times the semaphore is to be signalled.
|
|
4383 |
*/
|
|
4384 |
{
|
|
4385 |
|
|
4386 |
__ASSERT_ALWAYS(aCount>=0,Panic(ESemSignalCountNegative));
|
|
4387 |
Exec::SemaphoreSignalN(iHandle,aCount);
|
|
4388 |
}
|
|
4389 |
|
|
4390 |
|
|
4391 |
|
|
4392 |
|
|
4393 |
EXPORT_C RCriticalSection::RCriticalSection()
|
|
4394 |
: iBlocked(1)
|
|
4395 |
/**
|
|
4396 |
Default constructor.
|
|
4397 |
*/
|
|
4398 |
{}
|
|
4399 |
|
|
4400 |
|
|
4401 |
|
|
4402 |
|
|
4403 |
EXPORT_C void RCriticalSection::Close()
|
|
4404 |
/**
|
|
4405 |
Closes the handle to the critical section.
|
|
4406 |
|
|
4407 |
As a critical section object is implemented using a semaphore, this has the
|
|
4408 |
effect of closing the handle to the semaphore.
|
|
4409 |
*/
|
|
4410 |
{
|
|
4411 |
|
|
4412 |
RSemaphore::Close();
|
|
4413 |
}
|
|
4414 |
|
|
4415 |
|
|
4416 |
|
|
4417 |
|
|
4418 |
EXPORT_C void RCriticalSection::Wait()
|
|
4419 |
/**
|
|
4420 |
Waits for the critical section to become free.
|
|
4421 |
|
|
4422 |
If no other thread is in the critical section, control returns immediately
|
|
4423 |
and the current thread can continue into the section.
|
|
4424 |
|
|
4425 |
If another thread is already in the critical section, the current thread is
|
|
4426 |
marked as waiting (on a semaphore); the current thread is added to a queue
|
|
4427 |
of threads maintained by this critical section.
|
|
4428 |
*/
|
|
4429 |
{
|
|
4430 |
|
|
4431 |
if (__e32_atomic_add_acq32(&iBlocked, KMaxTUint32) != 1)
|
|
4432 |
RSemaphore::Wait();
|
|
4433 |
}
|
|
4434 |
|
|
4435 |
|
|
4436 |
|
|
4437 |
|
|
4438 |
EXPORT_C void RCriticalSection::Signal()
|
|
4439 |
/**
|
|
4440 |
Signals an exit from the critical section.
|
|
4441 |
|
|
4442 |
A thread calls this function when it exits from the critical section.
|
|
4443 |
The first eligible thread waiting on the critical section's queue of threads
|
|
4444 |
is removed from that queue and, provided that it is not suspended for any other
|
|
4445 |
reason, is marked as ready to run. That thread will, therefore, be the next to
|
|
4446 |
proceed into the critical section.
|
|
4447 |
*/
|
|
4448 |
{
|
|
4449 |
|
|
4450 |
__ASSERT_ALWAYS(iBlocked<1,Panic(ECriticalSectionStraySignal));
|
|
4451 |
if (TInt(__e32_atomic_add_rel32(&iBlocked, 1)) < 0)
|
|
4452 |
RSemaphore::Signal();
|
|
4453 |
}
|
|
4454 |
|
|
4455 |
|
|
4456 |
|
|
4457 |
|
|
4458 |
EXPORT_C TInt TFindThread::Next(TFullName &aResult)
|
|
4459 |
/**
|
|
4460 |
Gets the full name of the next global thread which matches the match pattern.
|
|
4461 |
|
|
4462 |
@param aResult A reference to a TBuf descriptor with a defined maximum length.
|
|
4463 |
If a matching global thread is found, its full name is set into
|
|
4464 |
this descriptor. If no matching global thread is found,
|
|
4465 |
the descriptor length is set to zero.
|
|
4466 |
|
|
4467 |
@return KErrNone if successful, otherwise one of the other system-wide error
|
|
4468 |
codes.
|
|
4469 |
*/
|
|
4470 |
{
|
|
4471 |
return NextObject(aResult,EThread);
|
|
4472 |
}
|
|
4473 |
|
|
4474 |
|
|
4475 |
|
|
4476 |
|
|
4477 |
EXPORT_C TThreadId RThread::Id() const
|
|
4478 |
/**
|
|
4479 |
Gets the Id of this thread.
|
|
4480 |
|
|
4481 |
@return The Id of this thread.
|
|
4482 |
*/
|
|
4483 |
{
|
|
4484 |
|
|
4485 |
return TThreadId( (TUint)Exec::ThreadId(iHandle) );
|
|
4486 |
}
|
|
4487 |
|
|
4488 |
|
|
4489 |
|
|
4490 |
|
|
4491 |
EXPORT_C void RThread::HandleCount(TInt& aProcessHandleCount, TInt& aThreadHandleCount) const
|
|
4492 |
/**
|
|
4493 |
Gets the number of handles open in this thread, and the number of handles open
|
|
4494 |
in the process which owns this thread.
|
|
4495 |
|
|
4496 |
@param aProcessHandleCount On return, contains the number of handles open in
|
|
4497 |
the process which owns this thread.
|
|
4498 |
@param aThreadHandleCount On return, contains the number of handles open in
|
|
4499 |
this thread.
|
|
4500 |
*/
|
|
4501 |
{
|
|
4502 |
|
|
4503 |
Exec::HandleCount(iHandle,aProcessHandleCount,aThreadHandleCount);
|
|
4504 |
}
|
|
4505 |
|
|
4506 |
|
|
4507 |
|
|
4508 |
|
|
4509 |
EXPORT_C TExceptionHandler User::ExceptionHandler()
|
|
4510 |
/**
|
|
4511 |
Gets a pointer to the exception handler for the current thread.
|
|
4512 |
|
|
4513 |
@return A pointer to the exception handler.
|
|
4514 |
*/
|
|
4515 |
{
|
|
4516 |
return(Exec::ExceptionHandler(KCurrentThreadHandle));
|
|
4517 |
}
|
|
4518 |
|
|
4519 |
|
|
4520 |
|
|
4521 |
|
|
4522 |
EXPORT_C TInt User::SetExceptionHandler(TExceptionHandler aHandler,TUint32 aMask)
|
|
4523 |
/**
|
|
4524 |
Sets a new exception handler for the current thread. Note that the handler is not
|
|
4525 |
guaranteed to receive floating point exceptions (KExceptionFpe) when a hardware
|
|
4526 |
floating point implementation is in use - see User::SetFloatingPointMode for
|
|
4527 |
hardware floating point modes and whether they cause user-trappable exceptions.
|
|
4528 |
|
|
4529 |
@param aHandler The new exception handler.
|
|
4530 |
@param aMask One or more flags defining the exception categories which
|
|
4531 |
the handler can handle.
|
|
4532 |
|
|
4533 |
@return KErrNone if successful, otherwise another of the system-wide error codes.
|
|
4534 |
|
|
4535 |
@see KExceptionAbort
|
|
4536 |
@see KExceptionKill
|
|
4537 |
@see KExceptionUserInterrupt
|
|
4538 |
@see KExceptionFpe
|
|
4539 |
@see KExceptionFault
|
|
4540 |
@see KExceptionInteger
|
|
4541 |
@see KExceptionDebug
|
|
4542 |
*/
|
|
4543 |
{
|
|
4544 |
return(Exec::SetExceptionHandler(KCurrentThreadHandle, aHandler, aMask));
|
|
4545 |
}
|
|
4546 |
|
|
4547 |
|
|
4548 |
|
|
4549 |
|
|
4550 |
EXPORT_C void User::ModifyExceptionMask(TUint32 aClearMask, TUint32 aSetMask)
|
|
4551 |
/**
|
|
4552 |
Changes the set of exceptions which the current thread's exception
|
|
4553 |
handler can deal with.
|
|
4554 |
|
|
4555 |
aClearMask is the set of flags defining the set of exceptions which the
|
|
4556 |
exception handler no longer deals with, while aSetMask is the set of flags
|
|
4557 |
defining the new set of exceptions to be set.
|
|
4558 |
|
|
4559 |
Flag clearing is done before flag setting.
|
|
4560 |
|
|
4561 |
@param aClearMask One or more flags defining the exceptions which the current
|
|
4562 |
exception handler no longer deals with.
|
|
4563 |
@param aSetMask One or more flags defining the new set of exceptions which
|
|
4564 |
the current exception handler is to deal with.
|
|
4565 |
*/
|
|
4566 |
{
|
|
4567 |
Exec::ModifyExceptionMask(KCurrentThreadHandle, aClearMask, aSetMask);
|
|
4568 |
}
|
|
4569 |
|
|
4570 |
|
|
4571 |
|
|
4572 |
|
|
4573 |
_LIT(KLitUserExec, "USER-EXEC");
|
|
4574 |
EXPORT_C TInt User::RaiseException(TExcType aType)
|
|
4575 |
/**
|
|
4576 |
Raises an exception of a specified type on the current thread.
|
|
4577 |
|
|
4578 |
If the thread has an exception handler to handle this type of exception,
|
|
4579 |
then it is called.
|
|
4580 |
|
|
4581 |
If the thread has no exception handler to handle this type of exception, then
|
|
4582 |
the function raises a USER-EXEC 3 panic.
|
|
4583 |
|
|
4584 |
Note that exception handlers are executed in the context of the thread on which
|
|
4585 |
the exception is raised; control returns to the point of the exception.
|
|
4586 |
|
|
4587 |
@param aType The type of exception.
|
|
4588 |
|
|
4589 |
@return KErrNone if successful, otherwise another of the system-wide
|
|
4590 |
error codes.
|
|
4591 |
*/
|
|
4592 |
{
|
|
4593 |
if (Exec::IsExceptionHandled(KCurrentThreadHandle,aType,ETrue))
|
|
4594 |
{
|
|
4595 |
Exec::ThreadSetFlags(KCurrentThreadHandle, 0, KThreadFlagLastChance);
|
|
4596 |
TUint32 type = aType;
|
|
4597 |
User::HandleException(&type);
|
|
4598 |
}
|
|
4599 |
else
|
|
4600 |
User::Panic(KLitUserExec, ECausedException);
|
|
4601 |
return KErrNone;
|
|
4602 |
}
|
|
4603 |
|
|
4604 |
|
|
4605 |
|
|
4606 |
|
|
4607 |
EXPORT_C TBool User::IsExceptionHandled(TExcType aType)
|
|
4608 |
/**
|
|
4609 |
Tests whether the specified exception type can be handled by the
|
|
4610 |
current thread.
|
|
4611 |
|
|
4612 |
@param aType The type of exception.
|
|
4613 |
|
|
4614 |
@return True, if the thread has an exception handler which can handle
|
|
4615 |
an exception of type aType.
|
|
4616 |
False, if the thread has no exception handler or the thread has
|
|
4617 |
an exception handler which cannot handle the exception defined
|
|
4618 |
by aType.
|
|
4619 |
*/
|
|
4620 |
{
|
|
4621 |
return (Exec::IsExceptionHandled(KCurrentThreadHandle,aType,EFalse));
|
|
4622 |
}
|
|
4623 |
|
|
4624 |
|
|
4625 |
|
|
4626 |
|
|
4627 |
EXPORT_C void RThread::Context(TDes8 &aDes) const
|
|
4628 |
/**
|
|
4629 |
Gets the register contents of this thread.
|
|
4630 |
|
|
4631 |
@param aDes On return, contains the register contents, starting with R0.
|
|
4632 |
*/
|
|
4633 |
{
|
|
4634 |
|
|
4635 |
Exec::ThreadContext(iHandle,aDes);
|
|
4636 |
}
|
|
4637 |
|
|
4638 |
|
|
4639 |
|
|
4640 |
|
|
4641 |
EXPORT_C void RThread::Resume() const
|
|
4642 |
/**
|
|
4643 |
Makes the thread eligible for execution.
|
|
4644 |
|
|
4645 |
After a thread is created, it is put into a suspended state; the thread is
|
|
4646 |
not eligible to run until Resume() is called.
|
|
4647 |
|
|
4648 |
This function must also be called to resume execution of this thread after
|
|
4649 |
it has been explicitly suspended by a call to Suspend().
|
|
4650 |
|
|
4651 |
Note that when a thread is created, it is given the priority EPriorityNormal
|
|
4652 |
by default. The fact that a thread is initially put into a suspended state
|
|
4653 |
means that the thread priority can be changed by calling the thread's
|
|
4654 |
SetPriority() member function before the thread is started by a call to Resume().
|
|
4655 |
*/
|
|
4656 |
{
|
|
4657 |
|
|
4658 |
Exec::ThreadResume(iHandle);
|
|
4659 |
}
|
|
4660 |
|
|
4661 |
|
|
4662 |
|
|
4663 |
|
|
4664 |
EXPORT_C void RThread::Suspend() const
|
|
4665 |
/**
|
|
4666 |
Suspends execution of this thread.
|
|
4667 |
|
|
4668 |
The thread is not scheduled to run until a subsequent call to Resume() is made.
|
|
4669 |
*/
|
|
4670 |
{
|
|
4671 |
|
|
4672 |
Exec::ThreadSuspend(iHandle);
|
|
4673 |
}
|
|
4674 |
|
|
4675 |
|
|
4676 |
|
|
4677 |
|
|
4678 |
EXPORT_C TThreadPriority RThread::Priority() const
|
|
4679 |
/**
|
|
4680 |
Gets the priority of this thread.
|
|
4681 |
|
|
4682 |
@return The priority.
|
|
4683 |
*/
|
|
4684 |
{
|
|
4685 |
|
|
4686 |
return(Exec::ThreadPriority(iHandle));
|
|
4687 |
}
|
|
4688 |
|
|
4689 |
|
|
4690 |
|
|
4691 |
|
|
4692 |
EXPORT_C void RThread::SetProcessPriority(TProcessPriority aPriority) const
|
|
4693 |
/**
|
|
4694 |
Sets the priority of the process which owns this thread to one of the values
|
|
4695 |
defined by the TProcessPriority enumeration.
|
|
4696 |
|
|
4697 |
The priority can be set to one of the four values:
|
|
4698 |
|
|
4699 |
EPriorityLow
|
|
4700 |
|
|
4701 |
EPriorityBackground
|
|
4702 |
|
|
4703 |
EPriorityForeground
|
|
4704 |
|
|
4705 |
EPriorityHigh
|
|
4706 |
|
|
4707 |
The absolute priority of all threads owned by the process (and all threads
|
|
4708 |
owned by those threads etc.) are re-calculated.
|
|
4709 |
|
|
4710 |
Note:
|
|
4711 |
|
|
4712 |
The use of the priority values EPriorityWindowServer, EPriorityFileServer,
|
|
4713 |
EPriorityRealTimeServer and EPrioritySupervisor is restricted to Symbian OS,
|
|
4714 |
and any attempt to explicitly set any of these priority values raises a KERN-EXEC
|
|
4715 |
14 panic.
|
|
4716 |
|
|
4717 |
@param aPriority The priority value.
|
|
4718 |
|
|
4719 |
@deprecated Not allowed on threads in a different process.
|
|
4720 |
Replace with RProcess::SetPriority or RMessagePtr2::SetProcessPriority
|
|
4721 |
*/
|
|
4722 |
{
|
|
4723 |
|
|
4724 |
Exec::ThreadSetProcessPriority(iHandle,aPriority);
|
|
4725 |
}
|
|
4726 |
|
|
4727 |
|
|
4728 |
|
|
4729 |
|
|
4730 |
EXPORT_C TProcessPriority RThread::ProcessPriority() const
|
|
4731 |
/**
|
|
4732 |
Gets the priority of the process which owns this thread.
|
|
4733 |
|
|
4734 |
@return The process priority.
|
|
4735 |
*/
|
|
4736 |
{
|
|
4737 |
|
|
4738 |
return(Exec::ThreadProcessPriority(iHandle));
|
|
4739 |
}
|
|
4740 |
|
|
4741 |
|
|
4742 |
|
|
4743 |
|
|
4744 |
EXPORT_C void RThread::SetPriority(TThreadPriority aPriority) const
|
|
4745 |
/**
|
|
4746 |
Sets the priority of the thread to one of the values defined by
|
|
4747 |
the TThreadPriority enumeration.
|
|
4748 |
|
|
4749 |
The resulting absolute priority of the thread depends on the value of aPriority
|
|
4750 |
and the priority of the owning process.
|
|
4751 |
|
|
4752 |
Use of the priority value EPriorityNull is restricted to Symbian OS, and any
|
|
4753 |
attempt to explicitly set this value causes a KERN-EXEC 14 panic to be raised.
|
|
4754 |
|
|
4755 |
@param aPriority The priority value.
|
|
4756 |
|
|
4757 |
@capability ProtServ if aPriority is EPriorityAbsoluteRealTime1 or higher
|
|
4758 |
|
|
4759 |
@panic KERN-EXEC 14, if aPriority is invalid or set to EPriorityNull
|
|
4760 |
@panic KERN-EXEC 46, if aPriority is EPriorityAbsoluteRealTime1 or higher
|
|
4761 |
and calling process does not have ProtServ capability
|
|
4762 |
*/
|
|
4763 |
{
|
|
4764 |
|
|
4765 |
Exec::ThreadSetPriority(iHandle,aPriority);
|
|
4766 |
}
|
|
4767 |
|
|
4768 |
|
|
4769 |
|
|
4770 |
|
|
4771 |
EXPORT_C User::TCritical User::Critical(RThread aThread)
|
|
4772 |
/**
|
|
4773 |
Gets the critical state associated with the specified thread.
|
|
4774 |
|
|
4775 |
@param aThread The thread whose critical state is to be retrieved.
|
|
4776 |
|
|
4777 |
@return The critical state.
|
|
4778 |
|
|
4779 |
@see User::SetCritical()
|
|
4780 |
*/
|
|
4781 |
{
|
|
4782 |
TUint32 flags = Exec::ThreadFlags(aThread.Handle());
|
|
4783 |
if (flags & KThreadFlagSystemPermanent)
|
|
4784 |
return ESystemPermanent;
|
|
4785 |
if (flags & KThreadFlagSystemCritical)
|
|
4786 |
return ESystemCritical;
|
|
4787 |
if (flags & KThreadFlagProcessPermanent)
|
|
4788 |
return EProcessPermanent;
|
|
4789 |
if (flags & KThreadFlagProcessCritical)
|
|
4790 |
return EProcessCritical;
|
|
4791 |
return ENotCritical;
|
|
4792 |
}
|
|
4793 |
|
|
4794 |
|
|
4795 |
|
|
4796 |
|
|
4797 |
EXPORT_C User::TCritical User::Critical()
|
|
4798 |
/**
|
|
4799 |
Gets the critical state associated with the current thread.
|
|
4800 |
|
|
4801 |
@return The critical state.
|
|
4802 |
|
|
4803 |
@see User::SetCritical()
|
|
4804 |
*/
|
|
4805 |
{
|
|
4806 |
RThread me;
|
|
4807 |
return User::Critical(me);
|
|
4808 |
}
|
|
4809 |
|
|
4810 |
|
|
4811 |
|
|
4812 |
|
|
4813 |
/**
|
|
4814 |
Sets up or changes the effect that termination of the current
|
|
4815 |
thread has, either on its owning process, or on the whole system.
|
|
4816 |
|
|
4817 |
The precise effect of thread termination is defined by
|
|
4818 |
the following specific values of the TCritical enum:
|
|
4819 |
- ENotCritical
|
|
4820 |
- EProcessCritical
|
|
4821 |
- EProcessPermanent
|
|
4822 |
- ESystemCritical
|
|
4823 |
- ESystemPermanent
|
|
4824 |
|
|
4825 |
Notes:
|
|
4826 |
-# The enum value EAllThreadsCritical cannot be set using this function. It is
|
|
4827 |
associated with a process, not a thread, and, if appropriate, should be set
|
|
4828 |
using User::SetProcessCritical().
|
|
4829 |
-# The states associated with ENotCritical, EProcessCritical,
|
|
4830 |
EProcessPermanent, ESystemCritical and ESystemPermanent
|
|
4831 |
are all mutually exclusive, i.e. the thread can only be in one of these states
|
|
4832 |
at any one time
|
|
4833 |
|
|
4834 |
@param aCritical The state to be set.
|
|
4835 |
|
|
4836 |
@return KErrNone, if successful;
|
|
4837 |
KErrArgument, if EAllThreadsCritical is passed - this is a
|
|
4838 |
state associated with a process, and
|
|
4839 |
you use User::SetProcessCritical() to set it.
|
|
4840 |
|
|
4841 |
@capability ProtServ if aCritical==ESystemCritical or ESystemPermanent
|
|
4842 |
|
|
4843 |
@see User::Critical()
|
|
4844 |
@see User::ProcessCritical()
|
|
4845 |
@see User::SetProcessCritical()
|
|
4846 |
*/
|
|
4847 |
EXPORT_C TInt User::SetCritical(TCritical aCritical)
|
|
4848 |
{
|
|
4849 |
const TUint32 clear = KThreadFlagSystemPermanent | KThreadFlagSystemCritical |
|
|
4850 |
KThreadFlagProcessPermanent | KThreadFlagProcessCritical;
|
|
4851 |
TUint32 set;
|
|
4852 |
switch (aCritical)
|
|
4853 |
{
|
|
4854 |
case ENotCritical: set = 0; break;
|
|
4855 |
case EProcessCritical: set = KThreadFlagProcessCritical; break;
|
|
4856 |
case EProcessPermanent: set = KThreadFlagProcessPermanent; break;
|
|
4857 |
case ESystemCritical: set = KThreadFlagSystemCritical; break;
|
|
4858 |
case ESystemPermanent: set = KThreadFlagSystemPermanent; break;
|
|
4859 |
default: return KErrArgument;
|
|
4860 |
}
|
|
4861 |
Exec::ThreadSetFlags(KCurrentThreadHandle, clear, set);
|
|
4862 |
return KErrNone;
|
|
4863 |
}
|
|
4864 |
|
|
4865 |
|
|
4866 |
|
|
4867 |
|
|
4868 |
EXPORT_C TInt User::SetRealtimeState(TRealtimeState aState)
|
|
4869 |
{
|
|
4870 |
const TUint32 clear = KThreadFlagRealtime | KThreadFlagRealtimeTest;
|
|
4871 |
TUint32 set;
|
|
4872 |
switch (aState)
|
|
4873 |
{
|
|
4874 |
case ERealtimeStateOff: set = 0; break;
|
|
4875 |
case ERealtimeStateOn: set = KThreadFlagRealtime; break;
|
|
4876 |
case ERealtimeStateWarn: set = KThreadFlagRealtime|KThreadFlagRealtimeTest; break;
|
|
4877 |
default: return KErrArgument;
|
|
4878 |
}
|
|
4879 |
Exec::ThreadSetFlags(KCurrentThreadHandle, clear, set);
|
|
4880 |
return KErrNone;
|
|
4881 |
}
|
|
4882 |
|
|
4883 |
|
|
4884 |
|
|
4885 |
|
|
4886 |
EXPORT_C User::TCritical User::ProcessCritical(RProcess aProcess)
|
|
4887 |
/**
|
|
4888 |
Gets the critical state associated with the specified process.
|
|
4889 |
|
|
4890 |
@param aProcess The process whose critical state is to be retrieved.
|
|
4891 |
|
|
4892 |
@return The critical state.
|
|
4893 |
|
|
4894 |
@see User::SetProcessCritical()
|
|
4895 |
*/
|
|
4896 |
{
|
|
4897 |
TUint32 flags = Exec::ProcessFlags(aProcess.Handle());
|
|
4898 |
if (flags & KProcessFlagSystemPermanent)
|
|
4899 |
return ESystemPermanent;
|
|
4900 |
if (flags & KProcessFlagSystemCritical)
|
|
4901 |
return ESystemCritical;
|
|
4902 |
if (flags & (KThreadFlagProcessPermanent | KThreadFlagProcessCritical))
|
|
4903 |
return EAllThreadsCritical;
|
|
4904 |
return ENotCritical;
|
|
4905 |
}
|
|
4906 |
|
|
4907 |
|
|
4908 |
|
|
4909 |
|
|
4910 |
EXPORT_C User::TCritical User::ProcessCritical()
|
|
4911 |
/**
|
|
4912 |
Gets the critical state associated with the current process.
|
|
4913 |
|
|
4914 |
@return The critical state.
|
|
4915 |
|
|
4916 |
@see User::SetProcessCritical()
|
|
4917 |
*/
|
|
4918 |
{
|
|
4919 |
RProcess me;
|
|
4920 |
return User::ProcessCritical(me);
|
|
4921 |
}
|
|
4922 |
|
|
4923 |
|
|
4924 |
|
|
4925 |
|
|
4926 |
EXPORT_C TInt User::SetProcessCritical(TCritical aCritical)
|
|
4927 |
/**
|
|
4928 |
Sets up or changes the effect that termination of subsequently created threads
|
|
4929 |
will have, either on the owning process, or on the whole system.
|
|
4930 |
|
|
4931 |
It is important to note that we are not referring to threads that have already
|
|
4932 |
been created, but threads that will be created subsequent to a call to this function.
|
|
4933 |
|
|
4934 |
The precise effect of thread termination is defined by the following specific
|
|
4935 |
values of the TCritical enum:
|
|
4936 |
- ENotCritical
|
|
4937 |
- EAllThreadsCritical
|
|
4938 |
- ESystemCritical
|
|
4939 |
- ESystemPermanent
|
|
4940 |
|
|
4941 |
Notes:
|
|
4942 |
-# The enum values EProcessCritical and EProcessPermanent cannot be set using
|
|
4943 |
this function. They are states associated with
|
|
4944 |
a thread, not a process, and, if appropriate, should be set
|
|
4945 |
using User::SetCritical().
|
|
4946 |
-# The states associated with ENotCritical, EAllThreadsCritical,
|
|
4947 |
ESystemCritical and ESystemPermanent are all mutually exclusive, i.e. the
|
|
4948 |
process can only be in one of these states at any one time.
|
|
4949 |
|
|
4950 |
@param aCritical The state to be set.
|
|
4951 |
|
|
4952 |
@return KErrNone, if successful;
|
|
4953 |
KErrArgument, if either EProcessCritical or EProcessPermanent
|
|
4954 |
is passed - these are states associated with a thread, and
|
|
4955 |
you use User::SetCritical() to set them.
|
|
4956 |
|
|
4957 |
@capability ProtServ if aCritical==ESystemCritical or ESystemPermanent
|
|
4958 |
|
|
4959 |
@see User::ProcessCritical()
|
|
4960 |
@see User::SetCritical()
|
|
4961 |
@see User::Critical()
|
|
4962 |
*/
|
|
4963 |
{
|
|
4964 |
const TUint32 clear = KProcessFlagSystemPermanent | KProcessFlagSystemCritical |
|
|
4965 |
KThreadFlagProcessPermanent | KThreadFlagProcessCritical;
|
|
4966 |
TUint32 set;
|
|
4967 |
switch (aCritical)
|
|
4968 |
{
|
|
4969 |
case ENotCritical: set = 0; break;
|
|
4970 |
case EAllThreadsCritical: set = KThreadFlagProcessCritical; break;
|
|
4971 |
case ESystemCritical: set = KProcessFlagSystemCritical; break;
|
|
4972 |
case ESystemPermanent: set = KProcessFlagSystemPermanent|KProcessFlagSystemCritical; break;
|
|
4973 |
default: return KErrArgument;
|
|
4974 |
}
|
|
4975 |
Exec::ProcessSetFlags(KCurrentProcessHandle, clear, set);
|
|
4976 |
return KErrNone;
|
|
4977 |
}
|
|
4978 |
|
|
4979 |
|
|
4980 |
|
|
4981 |
|
|
4982 |
EXPORT_C TBool User::PriorityControl()
|
|
4983 |
/**
|
|
4984 |
Tests whether the current process allows other processes to switch its priority
|
|
4985 |
between 'foreground' and 'background'.
|
|
4986 |
|
|
4987 |
@return True, if the current process allows other processes to switch its priority;
|
|
4988 |
false, otherwise.
|
|
4989 |
*/
|
|
4990 |
{
|
|
4991 |
return Exec::ProcessFlags(KCurrentProcessHandle) & KProcessFlagPriorityControl;
|
|
4992 |
}
|
|
4993 |
|
|
4994 |
|
|
4995 |
|
|
4996 |
|
|
4997 |
EXPORT_C void User::SetPriorityControl(TBool aEnable)
|
|
4998 |
/**
|
|
4999 |
Allows the current process to choose to have its priority switched by another
|
|
5000 |
process between 'foreground' and 'background'.
|
|
5001 |
|
|
5002 |
By default a process does not allow this.
|
|
5003 |
|
|
5004 |
@param aEnable If ETrue, allows other processes to switch the current process's
|
|
5005 |
priority.
|
|
5006 |
If EFalse, prevents other processes from switching the current
|
|
5007 |
process's priority.
|
|
5008 |
*/
|
|
5009 |
{
|
|
5010 |
TUint32 set = aEnable ? KProcessFlagPriorityControl : 0;
|
|
5011 |
Exec::ProcessSetFlags(KCurrentProcessHandle, KProcessFlagPriorityControl, set);
|
|
5012 |
}
|
|
5013 |
|
|
5014 |
|
|
5015 |
|
|
5016 |
EXPORT_C TInt RThread::RequestCount() const
|
|
5017 |
/**
|
|
5018 |
Gets this thread's request semaphore count.
|
|
5019 |
|
|
5020 |
The request semaphore is created when a thread is created, and is used to
|
|
5021 |
support asynchronous requests.
|
|
5022 |
|
|
5023 |
A negative value implies that this thread is waiting for at least
|
|
5024 |
one asynchronous request to complete.
|
|
5025 |
|
|
5026 |
@return This thread's request semaphore count.
|
|
5027 |
*/
|
|
5028 |
{
|
|
5029 |
|
|
5030 |
return(Exec::ThreadRequestCount(iHandle));
|
|
5031 |
}
|
|
5032 |
|
|
5033 |
|
|
5034 |
|
|
5035 |
|
|
5036 |
EXPORT_C TExitType RThread::ExitType() const
|
|
5037 |
/**
|
|
5038 |
Tests whether the thread has ended and, if it has ended, return how it ended.
|
|
5039 |
|
|
5040 |
This information allows the caller to distinguish between normal termination
|
|
5041 |
and a panic.
|
|
5042 |
|
|
5043 |
@return An enumeration whose enumerators describe how the thread has ended.
|
|
5044 |
*/
|
|
5045 |
{
|
|
5046 |
|
|
5047 |
return(Exec::ThreadExitType(iHandle));
|
|
5048 |
}
|
|
5049 |
|
|
5050 |
|
|
5051 |
|
|
5052 |
|
|
5053 |
EXPORT_C TInt RThread::ExitReason() const
|
|
5054 |
/**
|
|
5055 |
Gets the specific reason associated with the end of this thread.
|
|
5056 |
|
|
5057 |
The reason number together with the category name is a way of distinguishing
|
|
5058 |
between different causes of thread termination.
|
|
5059 |
|
|
5060 |
If the thread has panicked, this value is the panic number. If the thread
|
|
5061 |
has ended as a result of a call to Kill(), then the value is the one supplied
|
|
5062 |
by Kill().
|
|
5063 |
|
|
5064 |
If the thread is still alive, then the returned value is zero.
|
|
5065 |
|
|
5066 |
@return The reason associated with the end of the thread.
|
|
5067 |
*/
|
|
5068 |
{
|
|
5069 |
|
|
5070 |
return(Exec::ThreadExitReason(iHandle));
|
|
5071 |
}
|
|
5072 |
|
|
5073 |
|
|
5074 |
|
|
5075 |
|
|
5076 |
EXPORT_C TExitCategoryName RThread::ExitCategory() const
|
|
5077 |
/**
|
|
5078 |
Gets the name of the category associated with the end of the thread.
|
|
5079 |
|
|
5080 |
The category name together with the reason number is a way of distinguishing
|
|
5081 |
between different causes of thread termination.
|
|
5082 |
|
|
5083 |
If the thread has panicked, the category name is the panic category name;
|
|
5084 |
for example, E32USER-CBase or KERN-EXEC. If the thread has ended as a result
|
|
5085 |
of call to Kill(), then the category name is Kill.
|
|
5086 |
|
|
5087 |
If the thread has not ended, then the category name is empty, i.e. the length
|
|
5088 |
of the category name is zero.
|
|
5089 |
|
|
5090 |
@return A TBuf descriptor with a defined maximum length containing the name
|
|
5091 |
of the category associated with the end of the thread.
|
|
5092 |
|
|
5093 |
@see TBuf
|
|
5094 |
*/
|
|
5095 |
{
|
|
5096 |
TExitCategoryName n;
|
|
5097 |
TPtr8 n8(((TUint8*)n.Ptr()) + KMaxExitCategoryName, KMaxExitCategoryName);
|
|
5098 |
Exec::ThreadExitCategory(iHandle,n8);
|
|
5099 |
n.Copy(n8);
|
|
5100 |
return(n);
|
|
5101 |
}
|
|
5102 |
|
|
5103 |
|
|
5104 |
|
|
5105 |
|
|
5106 |
EXPORT_C TInt RThread::StackInfo(TThreadStackInfo& aInfo) const
|
|
5107 |
/**
|
|
5108 |
Gets information about a thread's user mode stack.
|
|
5109 |
|
|
5110 |
@param aInfo The TThreadStackInfo object to write the stack infomation to.
|
|
5111 |
|
|
5112 |
@return KErrNone, if sucessful;
|
|
5113 |
KErrGeneral, if the thread doesn't have a user mode stack,
|
|
5114 |
or it has terminated.
|
|
5115 |
|
|
5116 |
@see TThreadStackInfo
|
|
5117 |
*/
|
|
5118 |
{
|
|
5119 |
return(Exec::ThreadStackInfo(iHandle,aInfo));
|
|
5120 |
}
|
|
5121 |
|
|
5122 |
|
|
5123 |
|
|
5124 |
|
|
5125 |
EXPORT_C TInt RThread::GetCpuTime(TTimeIntervalMicroSeconds& aCpuTime) const
|
|
5126 |
/**
|
|
5127 |
Gets the CPU usage for this thread.
|
|
5128 |
|
|
5129 |
This function is not supported on version 8.0b or 8.1b, and returns
|
|
5130 |
KErrNotSupported. From 9.1 onwards it may be supported if the kernel has been
|
|
5131 |
compiled with the MONITOR_THREAD_CPU_TIME macro defined.
|
|
5132 |
|
|
5133 |
@param aCpuTime A reference to a time interval object supplied by the caller.
|
|
5134 |
|
|
5135 |
@return KErrNone - if thread CPU time is available.
|
|
5136 |
|
|
5137 |
KErrNotSupported - if this feature is not supported on this
|
|
5138 |
version or build of the OS.
|
|
5139 |
*/
|
|
5140 |
{
|
|
5141 |
return Exec::ThreadGetCpuTime(iHandle, (TInt64&)aCpuTime.Int64());
|
|
5142 |
}
|
|
5143 |
|
|
5144 |
|
|
5145 |
|
|
5146 |
|
|
5147 |
EXPORT_C void User::After(TTimeIntervalMicroSeconds32 aInterval)
|
|
5148 |
/**
|
|
5149 |
Suspends the current thread until a specified time interval has expired.
|
|
5150 |
|
|
5151 |
The resolution of the timer depends on the hardware, but is normally
|
|
5152 |
1 Symbian OS tick (approximately 1/64 second).
|
|
5153 |
|
|
5154 |
@param aInterval The time interval for which the current thread is to be
|
|
5155 |
suspended, in microseconds.
|
|
5156 |
|
|
5157 |
@panic USER 86, if the time interval is negative.
|
|
5158 |
*/
|
|
5159 |
{
|
|
5160 |
|
|
5161 |
__ASSERT_ALWAYS(aInterval.Int()>=0,::Panic(EExecAfterTimeNegative));
|
|
5162 |
TRequestStatus s=KRequestPending;
|
|
5163 |
Exec::After(aInterval.Int(),s);
|
|
5164 |
User::WaitForRequest(s);
|
|
5165 |
}
|
|
5166 |
|
|
5167 |
|
|
5168 |
|
|
5169 |
|
|
5170 |
EXPORT_C void User::AfterHighRes(TTimeIntervalMicroSeconds32 aInterval)
|
|
5171 |
/**
|
|
5172 |
Suspends the current thread until a specified time interval has expired to
|
|
5173 |
a resolution of 1ms .
|
|
5174 |
|
|
5175 |
@param aInterval The time interval for which the current thread is to be
|
|
5176 |
suspended, in microseconds.
|
|
5177 |
|
|
5178 |
@panic USER 86, if the time interval is negative.
|
|
5179 |
*/
|
|
5180 |
{
|
|
5181 |
|
|
5182 |
__ASSERT_ALWAYS(aInterval.Int()>=0,::Panic(EExecAfterTimeNegative));
|
|
5183 |
TRequestStatus s=KRequestPending;
|
|
5184 |
Exec::AfterHighRes(aInterval.Int(),s);
|
|
5185 |
User::WaitForRequest(s);
|
|
5186 |
}
|
|
5187 |
|
|
5188 |
|
|
5189 |
|
|
5190 |
|
|
5191 |
EXPORT_C TInt User::At(const TTime &aTime)
|
|
5192 |
/**
|
|
5193 |
Suspends the current thread until the specified absolute time, in the current time zone.
|
|
5194 |
|
|
5195 |
If the machine is off at that time, the machine will be turned on again.
|
|
5196 |
|
|
5197 |
@param aTime The absolute time, in the current time zone, until which the current thread is to
|
|
5198 |
be suspended.
|
|
5199 |
|
|
5200 |
@return On completion, contains the status of the request to suspend the
|
|
5201 |
current thread:
|
|
5202 |
|
|
5203 |
KErrNone - suspension of the current thread completed normally at
|
|
5204 |
the requested time.
|
|
5205 |
|
|
5206 |
KErrAbort - suspension of the current thread was aborted
|
|
5207 |
because the system time changed.
|
|
5208 |
|
|
5209 |
KErrUnderflow - the requested completion time is in the past.
|
|
5210 |
|
|
5211 |
KErrOverFlow - the requested completion time is too far in the future.
|
|
5212 |
*/
|
|
5213 |
{
|
|
5214 |
|
|
5215 |
TRequestStatus s=KRequestPending;
|
|
5216 |
TInt64 time=aTime.Int64();
|
|
5217 |
time -= ((TInt64)User::UTCOffset().Int()) * 1000000;
|
|
5218 |
Exec::At(time,s);
|
|
5219 |
User::WaitForRequest(s);
|
|
5220 |
return(s.Int());
|
|
5221 |
}
|
|
5222 |
|
|
5223 |
|
|
5224 |
|
|
5225 |
|
|
5226 |
EXPORT_C void RTimer::Cancel()
|
|
5227 |
/**
|
|
5228 |
Cancels any outstanding request for a timer event.
|
|
5229 |
|
|
5230 |
Any outstanding timer event completes with KErrCancel.
|
|
5231 |
*/
|
|
5232 |
{
|
|
5233 |
|
|
5234 |
Exec::TimerCancel(iHandle);
|
|
5235 |
}
|
|
5236 |
|
|
5237 |
|
|
5238 |
|
|
5239 |
|
|
5240 |
EXPORT_C void RTimer::After(TRequestStatus &aStatus,TTimeIntervalMicroSeconds32 aInterval)
|
|
5241 |
//
|
|
5242 |
// Request a relative timer.
|
|
5243 |
//
|
|
5244 |
/**
|
|
5245 |
Requests an event after the specified interval.
|
|
5246 |
|
|
5247 |
The counter for this type of request stops during power-down.
|
|
5248 |
A 5 second timer will complete late if, for example, the machine is turned off
|
|
5249 |
2 seconds after the request is made.
|
|
5250 |
|
|
5251 |
@param aStatus On completion, contains the status of the request.
|
|
5252 |
This is KErrNone if the timer completed normally at the
|
|
5253 |
requested time, otherwise another of the
|
|
5254 |
system-wide error codes.
|
|
5255 |
|
|
5256 |
@param aInterval The time interval, in microseconds, after which an event
|
|
5257 |
is to occur.
|
|
5258 |
|
|
5259 |
@panic USER 87, if aInterval is negative.
|
|
5260 |
@panic KERN-EXEC 15, if this function is called while a request for a timer
|
|
5261 |
event is still outstanding.
|
|
5262 |
*/
|
|
5263 |
{
|
|
5264 |
|
|
5265 |
__ASSERT_ALWAYS(aInterval.Int()>=0,::Panic(ERTimerAfterTimeNegative));
|
|
5266 |
aStatus=KRequestPending;
|
|
5267 |
Exec::TimerAfter(iHandle,aStatus,aInterval.Int());
|
|
5268 |
}
|
|
5269 |
|
|
5270 |
|
|
5271 |
|
|
5272 |
|
|
5273 |
EXPORT_C void RTimer::AfterTicks(TRequestStatus& aStatus, TInt aTicks)
|
|
5274 |
//
|
|
5275 |
// Request a relative timer in system ticks.
|
|
5276 |
//
|
|
5277 |
/**
|
|
5278 |
Requests an event after the specified interval.
|
|
5279 |
|
|
5280 |
The counter for this type of request stops during power-down.
|
|
5281 |
A 5 tick timer will complete late if, for example, the machine is turned off
|
|
5282 |
2 ticks after the request is made.
|
|
5283 |
|
|
5284 |
@param aStatus On completion, contains the status of the request.
|
|
5285 |
This is KErrNone if the timer completed normally at the
|
|
5286 |
requested time, otherwise another of the
|
|
5287 |
system-wide error codes.
|
|
5288 |
|
|
5289 |
@param aTicks The time interval, in system ticks, after which an event
|
|
5290 |
is to occur.
|
|
5291 |
|
|
5292 |
@panic USER 87, if aTicks is negative.
|
|
5293 |
@panic KERN-EXEC 15, if this function is called while a request for a timer
|
|
5294 |
event is still outstanding.
|
|
5295 |
*/
|
|
5296 |
{
|
|
5297 |
__ASSERT_ALWAYS(aTicks >= 0, ::Panic(ERTimerAfterTimeNegative));
|
|
5298 |
aStatus = KRequestPending;
|
|
5299 |
Exec::TimerAfter(iHandle, aStatus, -aTicks);
|
|
5300 |
}
|
|
5301 |
|
|
5302 |
|
|
5303 |
|
|
5304 |
|
|
5305 |
EXPORT_C void RTimer::HighRes(TRequestStatus &aStatus,TTimeIntervalMicroSeconds32 aInterval)
|
|
5306 |
//
|
|
5307 |
// Request a relative timer to a resolution of 1ms.
|
|
5308 |
//
|
|
5309 |
/**
|
|
5310 |
Requests an event after the specified interval to a resolution of 1ms.
|
|
5311 |
The "HighRes timer" counter stops during power-down (the same as "after timer").
|
|
5312 |
|
|
5313 |
@param aStatus On completion, contains the status of the request.
|
|
5314 |
This is KErrNone if the timer completed normally at the
|
|
5315 |
requested time, otherwise another of the
|
|
5316 |
system-wide error codes.
|
|
5317 |
|
|
5318 |
@param aInterval The time interval, in microseconds, after which an event
|
|
5319 |
is to occur.
|
|
5320 |
|
|
5321 |
@panic USER 87, if aInterval is negative.
|
|
5322 |
@panic KERN-EXEC 15, if this function is called while a request for a timer
|
|
5323 |
event is still outstanding.
|
|
5324 |
*/
|
|
5325 |
{
|
|
5326 |
|
|
5327 |
__ASSERT_ALWAYS(aInterval.Int()>=0,::Panic(ERTimerAfterTimeNegative));
|
|
5328 |
aStatus=KRequestPending;
|
|
5329 |
Exec::TimerHighRes(iHandle,aStatus,aInterval.Int());
|
|
5330 |
}
|
|
5331 |
|
|
5332 |
|
|
5333 |
|
|
5334 |
|
|
5335 |
EXPORT_C void RTimer::At(TRequestStatus &aStatus,const TTime &aTime)
|
|
5336 |
//
|
|
5337 |
// Request an absolute timer.
|
|
5338 |
//
|
|
5339 |
/**
|
|
5340 |
Requests an event at a given system time (in the current time zone).
|
|
5341 |
|
|
5342 |
If the machine is off at that time, it is automatically turned on.
|
|
5343 |
|
|
5344 |
@param aStatus On completion, contains the status of the request:
|
|
5345 |
KErrNone, the timer completed normally at the requested time;
|
|
5346 |
KErrCancel, the timer was cancelled;
|
|
5347 |
KErrAbort, the timer was aborted because the system time changed;
|
|
5348 |
KErrUnderflow, the requested completion time is in the past;
|
|
5349 |
KErrOverFlow, the requested completion time is too far in the future;
|
|
5350 |
@param aTime The time at which the timer will expire.
|
|
5351 |
|
|
5352 |
@panic KERN-EXEC 15, if this function is called while a request for a timer
|
|
5353 |
event is still outstanding.
|
|
5354 |
*/
|
|
5355 |
{
|
|
5356 |
|
|
5357 |
aStatus=KRequestPending;
|
|
5358 |
TInt64 time=aTime.Int64();
|
|
5359 |
time -= ((TInt64)User::UTCOffset().Int()) * 1000000;
|
|
5360 |
Exec::TimerAt(iHandle,aStatus,I64LOW(time),I64HIGH(time));
|
|
5361 |
}
|
|
5362 |
|
|
5363 |
|
|
5364 |
|
|
5365 |
|
|
5366 |
EXPORT_C void RTimer::AtUTC(TRequestStatus &aStatus,const TTime &aUTCTime)
|
|
5367 |
//
|
|
5368 |
// Request an absolute timer in UTC time.
|
|
5369 |
//
|
|
5370 |
/**
|
|
5371 |
Requests an event at a given UTC time.
|
|
5372 |
|
|
5373 |
If the machine is off at that time, it is automatically turned on.
|
|
5374 |
|
|
5375 |
@param aStatus On completion, contains the status of the request:
|
|
5376 |
KErrNone, the timer completed normally at the requested time;
|
|
5377 |
KErrCancel, the timer was cancelled;
|
|
5378 |
KErrAbort, the timer was aborted because the system time changed;
|
|
5379 |
KErrUnderflow, the requested completion time is in the past;
|
|
5380 |
KErrOverFlow, the requested completion time is too far in the future;
|
|
5381 |
@param aTime The time at which the timer will expire.
|
|
5382 |
|
|
5383 |
@panic KERN-EXEC 15, if this function is called while a request for a timer
|
|
5384 |
event is still outstanding.
|
|
5385 |
*/
|
|
5386 |
{
|
|
5387 |
|
|
5388 |
aStatus=KRequestPending;
|
|
5389 |
Exec::TimerAt(iHandle,aStatus,I64LOW(aUTCTime.Int64()),I64HIGH(aUTCTime.Int64()));
|
|
5390 |
}
|
|
5391 |
|
|
5392 |
|
|
5393 |
|
|
5394 |
|
|
5395 |
EXPORT_C void RTimer::Lock(TRequestStatus &aStatus,TTimerLockSpec aLock)
|
|
5396 |
//
|
|
5397 |
// Request an absolute timer.
|
|
5398 |
//
|
|
5399 |
/**
|
|
5400 |
Requests an event on a specified second fraction.
|
|
5401 |
|
|
5402 |
@param aStatus On completion, contains the status of the request:
|
|
5403 |
KErrGeneral, the first time this is called;
|
|
5404 |
KErrNone, the timer completed normally at the requested time;
|
|
5405 |
KErrCancel, the timer was cancelled;
|
|
5406 |
KErrAbort, the timer was aborted because the system time changed;
|
|
5407 |
KErrUnderflow, the requested completion time is in the past;
|
|
5408 |
KErrOverFlow, the requested completion time is too far in the future.
|
|
5409 |
@param aLock The fraction of a second at which the timer completes.
|
|
5410 |
|
|
5411 |
@panic KERN-EXEC 15, if this function is called while a request for a timer
|
|
5412 |
event is still outstanding.
|
|
5413 |
*/
|
|
5414 |
{
|
|
5415 |
aStatus=KRequestPending;
|
|
5416 |
Exec::TimerLock(iHandle,aStatus,aLock);
|
|
5417 |
}
|
|
5418 |
|
|
5419 |
|
|
5420 |
/**
|
|
5421 |
Requests an event to be triggered when aSeconds is exactly, (ie not greater or
|
|
5422 |
less than), the time elapsed (to the nearest second) since the last user activity.
|
|
5423 |
If the event trigger time has been "missed", instead of triggering late,
|
|
5424 |
the timer waits for the next user activity, to try and satisfy the condition.
|
|
5425 |
|
|
5426 |
That is to say, if there was user activity within the last aSeconds,
|
|
5427 |
the event will be triggered after aSeconds of continuous inactivity following that activity.
|
|
5428 |
Otherwise, if there has been no such activity within this time, an event is
|
|
5429 |
triggered after aSeconds of continuous inactivity following the next user activity
|
|
5430 |
in the future.
|
|
5431 |
|
|
5432 |
It follows from this, that you can request an event directly after the next
|
|
5433 |
user activity by supplying a time interval of zero.
|
|
5434 |
|
|
5435 |
|
|
5436 |
@param aStatus On completion, contains the status of the request:
|
|
5437 |
KErrNone, the timer completed normally;
|
|
5438 |
KErrCancel, the timer was cancelled;
|
|
5439 |
KErrArgument, if aSeconds is less then zero;
|
|
5440 |
KErrOverflow, if aSecond reaches its limit (which is platform specific but greater then one and a half day).
|
|
5441 |
@param aSeconds The time interval in seconds.
|
|
5442 |
|
|
5443 |
@panic KERN-EXEC 15, if this function is called while a request for a timer
|
|
5444 |
event is still outstanding.
|
|
5445 |
*/
|
|
5446 |
EXPORT_C void RTimer::Inactivity(TRequestStatus &aStatus, TTimeIntervalSeconds aSeconds)
|
|
5447 |
{
|
|
5448 |
aStatus=KRequestPending;
|
|
5449 |
Exec::TimerInactivity(iHandle, aStatus, aSeconds.Int());
|
|
5450 |
}
|
|
5451 |
|
|
5452 |
|
|
5453 |
|
|
5454 |
|
|
5455 |
EXPORT_C TInt RChangeNotifier::Logon(TRequestStatus& aStatus) const
|
|
5456 |
/**
|
|
5457 |
Issues a request for notification when changes occur in the environment.
|
|
5458 |
|
|
5459 |
A switch in locale, or crossing over past midnight, are examples of changes
|
|
5460 |
that are reported.
|
|
5461 |
|
|
5462 |
When a change in the environment occurs, the request completes and the
|
|
5463 |
TRquestStatus object will contain one or more of the bit values defined
|
|
5464 |
by the TChanges enum.
|
|
5465 |
|
|
5466 |
Alternatively, if an outstanding request is cancelled by a call to
|
|
5467 |
this handle's LogonCancel() member function, then the request completes
|
|
5468 |
with a KErrCancel.
|
|
5469 |
|
|
5470 |
Note that if this is the first notification request after creation of
|
|
5471 |
the change notifier, then this request completes immediately.
|
|
5472 |
|
|
5473 |
@param aStatus A reference to the request status object.
|
|
5474 |
|
|
5475 |
@return KErrInUse, if there is an outstanding request; KErrNone otherwise.
|
|
5476 |
|
|
5477 |
@see TChanges
|
|
5478 |
@see RChangeNotifier::Logon()
|
|
5479 |
*/
|
|
5480 |
{
|
|
5481 |
|
|
5482 |
aStatus=KRequestPending;
|
|
5483 |
return(Exec::ChangeNotifierLogon(iHandle,aStatus));
|
|
5484 |
}
|
|
5485 |
|
|
5486 |
|
|
5487 |
|
|
5488 |
|
|
5489 |
EXPORT_C TInt RChangeNotifier::LogonCancel() const
|
|
5490 |
/**
|
|
5491 |
Cancels an outstanding change notification request.
|
|
5492 |
|
|
5493 |
@return KErrGeneral, if there is no outstanding request; KErrNone otherwise.
|
|
5494 |
|
|
5495 |
@see RChangeNotifier::Logon()
|
|
5496 |
*/
|
|
5497 |
{
|
|
5498 |
|
|
5499 |
return(Exec::ChangeNotifierLogoff(iHandle));
|
|
5500 |
}
|
|
5501 |
|
|
5502 |
|
|
5503 |
|
|
5504 |
|
|
5505 |
EXPORT_C void UserSvr::CaptureEventHook()
|
|
5506 |
//
|
|
5507 |
// Capture the event hook
|
|
5508 |
//
|
|
5509 |
{
|
|
5510 |
|
|
5511 |
Exec::CaptureEventHook();
|
|
5512 |
}
|
|
5513 |
|
|
5514 |
EXPORT_C void UserSvr::ReleaseEventHook()
|
|
5515 |
//
|
|
5516 |
// Release the event hook
|
|
5517 |
//
|
|
5518 |
{
|
|
5519 |
|
|
5520 |
Exec::ReleaseEventHook();
|
|
5521 |
}
|
|
5522 |
|
|
5523 |
EXPORT_C void UserSvr::RequestEvent(TRawEventBuf &anEvent,TRequestStatus &aStatus)
|
|
5524 |
//
|
|
5525 |
// Request the next event.
|
|
5526 |
//
|
|
5527 |
{
|
|
5528 |
|
|
5529 |
aStatus=KRequestPending;
|
|
5530 |
Exec::RequestEvent(anEvent,aStatus);
|
|
5531 |
}
|
|
5532 |
|
|
5533 |
EXPORT_C void UserSvr::RequestEventCancel()
|
|
5534 |
//
|
|
5535 |
// Cancel the event request.
|
|
5536 |
//
|
|
5537 |
{
|
|
5538 |
|
|
5539 |
Exec::RequestEventCancel();
|
|
5540 |
}
|
|
5541 |
|
|
5542 |
/**
|
|
5543 |
Add an event to the queue.
|
|
5544 |
|
|
5545 |
@param anEvent The raw hardware event to be added to the event queue.
|
|
5546 |
@return KErrNone, if successful; KErrPermissionDenied, if the caller has
|
|
5547 |
insufficient capability; otherwise, one of the other system-wide error codes.
|
|
5548 |
|
|
5549 |
@capability SwEvent
|
|
5550 |
@capability PowerMgmt for ESwitchOff, ERestartSystem, ECaseOpen and ECaseClose
|
|
5551 |
*/
|
|
5552 |
EXPORT_C TInt UserSvr::AddEvent(const TRawEvent& anEvent)
|
|
5553 |
{
|
|
5554 |
|
|
5555 |
return(Exec::AddEvent(anEvent));
|
|
5556 |
}
|
|
5557 |
|
|
5558 |
EXPORT_C void UserSvr::ScreenInfo(TDes8 &anInfo)
|
|
5559 |
//
|
|
5560 |
// Get the screen info.
|
|
5561 |
//
|
|
5562 |
{
|
|
5563 |
|
|
5564 |
Exec::HalFunction(EHalGroupDisplay,EDisplayHalScreenInfo,(TAny*)&anInfo,NULL);
|
|
5565 |
}
|
|
5566 |
|
|
5567 |
#ifdef __USERSIDE_THREAD_DATA__
|
|
5568 |
|
|
5569 |
EXPORT_C TAny* UserSvr::DllTls(TInt aHandle)
|
|
5570 |
//
|
|
5571 |
// Return the value of the Thread Local Storage variable.
|
|
5572 |
//
|
|
5573 |
{
|
|
5574 |
return LocalThreadData()->DllTls(aHandle, KDllUid_Default);
|
|
5575 |
}
|
|
5576 |
|
|
5577 |
EXPORT_C TAny* UserSvr::DllTls(TInt aHandle, TInt aDllUid)
|
|
5578 |
//
|
|
5579 |
// Return the value of the Thread Local Storage variable.
|
|
5580 |
//
|
|
5581 |
{
|
|
5582 |
return LocalThreadData()->DllTls(aHandle, aDllUid);
|
|
5583 |
}
|
|
5584 |
|
|
5585 |
#else
|
|
5586 |
|
|
5587 |
EXPORT_C TAny* UserSvr::DllTls(TInt aHandle)
|
|
5588 |
//
|
|
5589 |
// Return the value of the Thread Local Storage variable.
|
|
5590 |
//
|
|
5591 |
{
|
|
5592 |
|
|
5593 |
return Exec::DllTls(aHandle, KDllUid_Default);
|
|
5594 |
}
|
|
5595 |
|
|
5596 |
EXPORT_C TAny* UserSvr::DllTls(TInt aHandle, TInt aDllUid)
|
|
5597 |
//
|
|
5598 |
// Return the value of the Thread Local Storage variable.
|
|
5599 |
//
|
|
5600 |
{
|
|
5601 |
|
|
5602 |
return Exec::DllTls(aHandle, aDllUid);
|
|
5603 |
}
|
|
5604 |
|
|
5605 |
#endif
|
|
5606 |
|
|
5607 |
EXPORT_C void UserSvr::DllFileName(TInt aHandle, TDes& aFileName)
|
|
5608 |
//
|
|
5609 |
// Return the filename of this dll
|
|
5610 |
//
|
|
5611 |
{
|
|
5612 |
TBuf8<KMaxFileName> n8;
|
|
5613 |
Exec::DllFileName(aHandle, n8);
|
|
5614 |
aFileName.Copy(n8);
|
|
5615 |
}
|
|
5616 |
|
|
5617 |
EXPORT_C TBool UserSvr::TestBootSequence()
|
|
5618 |
//
|
|
5619 |
// Is the machine being booted by the test department?
|
|
5620 |
//
|
|
5621 |
{
|
|
5622 |
|
|
5623 |
return Exec::HalFunction(EHalGroupPower,EPowerHalTestBootSequence,NULL,NULL);
|
|
5624 |
}
|
|
5625 |
|
|
5626 |
/**
|
|
5627 |
Register whether the W/S takes care of turning the screen on
|
|
5628 |
*/
|
|
5629 |
EXPORT_C void UserSvr::WsRegisterSwitchOnScreenHandling(TBool aState)
|
|
5630 |
{
|
|
5631 |
|
|
5632 |
Exec::HalFunction(EHalGroupDisplay,EDisplayHalWsRegisterSwitchOnScreenHandling,(TAny*)aState,NULL);
|
|
5633 |
}
|
|
5634 |
|
|
5635 |
EXPORT_C void UserSvr::WsSwitchOnScreen()
|
|
5636 |
//
|
|
5637 |
// W/S switch on the screen
|
|
5638 |
//
|
|
5639 |
{
|
|
5640 |
|
|
5641 |
Exec::HalFunction(EHalGroupDisplay,EDisplayHalWsSwitchOnScreen,NULL,NULL);
|
|
5642 |
}
|
|
5643 |
|
|
5644 |
|
|
5645 |
EXPORT_C TUint32 UserSvr::DebugMask()
|
|
5646 |
/**
|
|
5647 |
Return the kernel debug mask at index 0
|
|
5648 |
*/
|
|
5649 |
{
|
|
5650 |
return Exec::DebugMask();
|
|
5651 |
}
|
|
5652 |
|
|
5653 |
|
|
5654 |
EXPORT_C TUint32 UserSvr::DebugMask(TUint aIndex)
|
|
5655 |
/**
|
|
5656 |
Return the kernel debug mask at the given index position
|
|
5657 |
|
|
5658 |
@param aIndex An index of which 32 bit mask word is to be accessed
|
|
5659 |
*/
|
|
5660 |
{
|
|
5661 |
return Exec::DebugMaskIndex(aIndex);
|
|
5662 |
}
|
|
5663 |
|
|
5664 |
|
|
5665 |
|
|
5666 |
EXPORT_C TTrapHandler *User::TrapHandler()
|
|
5667 |
/**
|
|
5668 |
Gets a pointer to the current thread's trap handler.
|
|
5669 |
|
|
5670 |
Note that TTrapHandler is an abstract base class; a trap handler must be
|
|
5671 |
implemented as a derived class.
|
|
5672 |
|
|
5673 |
@return A pointer to the current thread's trap handler, if any. NULL, if no
|
|
5674 |
pre-existing trap handler is set.
|
|
5675 |
*/
|
|
5676 |
{
|
|
5677 |
|
|
5678 |
return GetTrapHandler();
|
|
5679 |
}
|
|
5680 |
|
|
5681 |
|
|
5682 |
|
|
5683 |
|
|
5684 |
EXPORT_C TTrapHandler *User::SetTrapHandler(TTrapHandler *aHandler)
|
|
5685 |
/**
|
|
5686 |
Sets the current thread's trap handler and returns a pointer to any pre-existing
|
|
5687 |
trap handler.
|
|
5688 |
|
|
5689 |
Pass a NULL pointer to this function to clear the trap handler.
|
|
5690 |
|
|
5691 |
The trap handler works with the TRAP mechanism to handle the effects of a
|
|
5692 |
leave.
|
|
5693 |
|
|
5694 |
Note that TTrapHandler is an abstract base class; a trap handler must be
|
|
5695 |
implemented as a derived class.
|
|
5696 |
|
|
5697 |
@param aHandler A pointer to the trap handler which is to be installed as
|
|
5698 |
the current thread's trap handler.
|
|
5699 |
|
|
5700 |
@return A pointer to the current thread's pre-existing trap handler, if any.
|
|
5701 |
NULL, if no pre-existing trap handler is set.
|
|
5702 |
|
|
5703 |
@see TRAP
|
|
5704 |
@see TRAPD
|
|
5705 |
*/
|
|
5706 |
{
|
|
5707 |
|
|
5708 |
TTrapHandler* prev;
|
|
5709 |
#if defined(__USERSIDE_THREAD_DATA__) && defined(__LEAVE_EQUALS_THROW__)
|
|
5710 |
prev = LocalThreadData()->iTrapHandler;
|
|
5711 |
#else
|
|
5712 |
prev = Exec::SetTrapHandler(aHandler);
|
|
5713 |
#endif
|
|
5714 |
#ifdef __USERSIDE_THREAD_DATA__
|
|
5715 |
LocalThreadData()->iTrapHandler = aHandler;
|
|
5716 |
#endif
|
|
5717 |
return prev;
|
|
5718 |
}
|
|
5719 |
|
|
5720 |
#ifndef __LEAVE_EQUALS_THROW__
|
|
5721 |
EXPORT_C TTrapHandler* User::MarkCleanupStack()
|
|
5722 |
/**
|
|
5723 |
If there's a TTrapHandler installed marks the cleanup stack and returns
|
|
5724 |
the TTrapHandler for subsequent use in UnMarkCleanupStack.
|
|
5725 |
|
|
5726 |
Only intended for use in the defintion of TRAP and TRAPD and only when
|
|
5727 |
User::Leave is defined in terms of THROW.
|
|
5728 |
|
|
5729 |
@return A pointer to the current thread's pre-existing trap handler, if any.
|
|
5730 |
NULL, if no pre-existing trap handler is set.
|
|
5731 |
|
|
5732 |
@see TRAP
|
|
5733 |
@see TRAPD
|
|
5734 |
*/
|
|
5735 |
{
|
|
5736 |
return (TTrapHandler*)0;
|
|
5737 |
}
|
|
5738 |
|
|
5739 |
|
|
5740 |
EXPORT_C void User::UnMarkCleanupStack(TTrapHandler* /*aHandler*/)
|
|
5741 |
/**
|
|
5742 |
If passed a non-null TTrapHandler unmarks the cleanup stack.
|
|
5743 |
|
|
5744 |
Only intended for use in the defintion of TRAP and TRAPD and only when
|
|
5745 |
User::Leave is defined in terms of THROW.
|
|
5746 |
|
|
5747 |
@see TRAP
|
|
5748 |
@see TRAPD
|
|
5749 |
*/
|
|
5750 |
{}
|
|
5751 |
|
|
5752 |
#else
|
|
5753 |
|
|
5754 |
EXPORT_C TTrapHandler* User::MarkCleanupStack()
|
|
5755 |
/**
|
|
5756 |
If there's a TTrapHandler installed marks the cleanup stack and returns
|
|
5757 |
the TTrapHandler for subsequent use in UnMarkCleanupStack.
|
|
5758 |
|
|
5759 |
Only intended for use in the defintion of TRAP and TRAPD and only when
|
|
5760 |
User::Leave is defined in terms of THROW.
|
|
5761 |
|
|
5762 |
@return A pointer to the current thread's pre-existing trap handler, if any.
|
|
5763 |
NULL, if no pre-existing trap handler is set.
|
|
5764 |
|
|
5765 |
@see TRAP
|
|
5766 |
@see TRAPD
|
|
5767 |
*/
|
|
5768 |
{
|
|
5769 |
|
|
5770 |
TTrapHandler* pH = GetTrapHandler();
|
|
5771 |
if (pH)
|
|
5772 |
pH->Trap();
|
|
5773 |
return pH;
|
|
5774 |
}
|
|
5775 |
|
|
5776 |
EXPORT_C void User::UnMarkCleanupStack(TTrapHandler* aHandler)
|
|
5777 |
/**
|
|
5778 |
If passed a non-null TTrapHandler unmarks the cleanup stack.
|
|
5779 |
|
|
5780 |
Only intended for use in the defintion of TRAP and TRAPD and only when
|
|
5781 |
User::Leave is defined in terms of THROW.
|
|
5782 |
|
|
5783 |
@see TRAP
|
|
5784 |
@see TRAPD
|
|
5785 |
*/
|
|
5786 |
{
|
|
5787 |
|
|
5788 |
if (aHandler)
|
|
5789 |
aHandler->UnTrap();
|
|
5790 |
}
|
|
5791 |
|
|
5792 |
#endif
|
|
5793 |
|
|
5794 |
|
|
5795 |
EXPORT_C TInt User::Beep(TInt aFrequency,TTimeIntervalMicroSeconds32 aDuration)
|
|
5796 |
/**
|
|
5797 |
Makes a beep tone with a specified frequency and duration.
|
|
5798 |
|
|
5799 |
This function should not be used. It exists to maintain compatibility with
|
|
5800 |
older versions of Symban OS.
|
|
5801 |
*/
|
|
5802 |
{
|
|
5803 |
|
|
5804 |
return Exec::HalFunction(EHalGroupSound,ESoundHalBeep,(TAny*)aFrequency,(TAny*)aDuration.Int());
|
|
5805 |
}
|
|
5806 |
|
|
5807 |
|
|
5808 |
|
|
5809 |
|
|
5810 |
// Unused, exists only for BC reasons
|
|
5811 |
EXPORT_C TInt UserSvr::HalGet(TInt, TAny*)
|
|
5812 |
{
|
|
5813 |
return KErrNotSupported;
|
|
5814 |
}
|
|
5815 |
|
|
5816 |
// Unused, exists only for BC reasons
|
|
5817 |
EXPORT_C TInt UserSvr::HalSet(TInt, TAny*)
|
|
5818 |
{
|
|
5819 |
return KErrNotSupported;
|
|
5820 |
}
|
|
5821 |
|
|
5822 |
EXPORT_C TInt UserSvr::HalFunction(TInt aGroup, TInt aFunction, TAny* a1, TAny* a2)
|
|
5823 |
{
|
|
5824 |
|
|
5825 |
return Exec::HalFunction(aGroup, aFunction, a1, a2);
|
|
5826 |
}
|
|
5827 |
|
|
5828 |
EXPORT_C TInt UserSvr::HalFunction(TInt aGroup, TInt aFunction, TAny* a1, TAny* a2, TInt aDeviceNumber)
|
|
5829 |
{
|
|
5830 |
|
|
5831 |
return Exec::HalFunction(aGroup | (aDeviceNumber<<16), aFunction, a1, a2);
|
|
5832 |
}
|
|
5833 |
|
|
5834 |
/**
|
|
5835 |
@capability WriteDeviceData
|
|
5836 |
*/
|
|
5837 |
EXPORT_C TInt UserSvr::SetMemoryThresholds(TInt aLowThreshold, TInt aGoodThreshold)
|
|
5838 |
{
|
|
5839 |
return Exec::SetMemoryThresholds(aLowThreshold,aGoodThreshold);
|
|
5840 |
}
|
|
5841 |
|
|
5842 |
/**
|
|
5843 |
@deprecated
|
|
5844 |
@internalAll
|
|
5845 |
@return EFalse
|
|
5846 |
*/
|
|
5847 |
EXPORT_C TBool UserSvr::IpcV1Available()
|
|
5848 |
{
|
|
5849 |
return EFalse;
|
|
5850 |
}
|
|
5851 |
|
|
5852 |
|
|
5853 |
|
|
5854 |
EXPORT_C void User::SetDebugMask(TUint32 aVal)
|
|
5855 |
/**
|
|
5856 |
Sets the debug mask.
|
|
5857 |
|
|
5858 |
@param aVal A set of bit values as defined in nk_trace.h
|
|
5859 |
*/
|
|
5860 |
{
|
|
5861 |
Exec::SetDebugMask(aVal);
|
|
5862 |
}
|
|
5863 |
|
|
5864 |
EXPORT_C void User::SetDebugMask(TUint32 aVal, TUint aIndex)
|
|
5865 |
/**
|
|
5866 |
Sets the debug mask at the given index
|
|
5867 |
|
|
5868 |
@param aVal A set of bit values as defined in nk_trace.h
|
|
5869 |
@param aIndex An index of which 32 bit mask word is to be accessed
|
|
5870 |
*/
|
|
5871 |
{
|
|
5872 |
Exec::SetDebugMaskIndex(aVal, aIndex);
|
|
5873 |
}
|
|
5874 |
|
|
5875 |
|
|
5876 |
/**
|
|
5877 |
Gets machine information.
|
|
5878 |
|
|
5879 |
@publishedPartner
|
|
5880 |
@deprecated Use HAL::Get() from the HAL library instead.
|
|
5881 |
*/
|
|
5882 |
EXPORT_C TInt UserHal::MachineInfo(TDes8& anInfo)
|
|
5883 |
{
|
|
5884 |
TInt bufLength=anInfo.MaxLength();
|
|
5885 |
__ASSERT_ALWAYS(bufLength==sizeof(TMachineInfoV2) || bufLength==sizeof(TMachineInfoV1),Panic(ETDes8BadDescriptorType));
|
|
5886 |
|
|
5887 |
// assemble a TMachineInfoV1 buffer
|
|
5888 |
TMachineInfoV2* info=&((TMachineInfoV2Buf&)anInfo)();
|
|
5889 |
// Variant stuff
|
|
5890 |
TVariantInfoV01Buf infoBuf;
|
|
5891 |
TInt r = Exec::HalFunction(EHalGroupVariant, EVariantHalVariantInfo, (TAny*)&infoBuf, NULL);
|
|
5892 |
if (KErrNone != r) return r; // must always be implemented!
|
|
5893 |
TVariantInfoV01& variantInfo = infoBuf();
|
|
5894 |
|
|
5895 |
info->iRomVersion=variantInfo.iRomVersion;
|
|
5896 |
info->iMachineUniqueId=variantInfo.iMachineUniqueId;
|
|
5897 |
info->iLedCapabilities=variantInfo.iLedCapabilities;
|
|
5898 |
info->iProcessorClockInKHz=variantInfo.iProcessorClockInKHz;
|
|
5899 |
info->iSpeedFactor=variantInfo.iSpeedFactor;
|
|
5900 |
|
|
5901 |
// Video driver stuff
|
|
5902 |
TVideoInfoV01Buf vidinfoBuf;
|
|
5903 |
r = Exec::HalFunction(EHalGroupDisplay, EDisplayHalCurrentModeInfo, (TAny*)&vidinfoBuf, NULL);
|
|
5904 |
if (KErrNone == r)
|
|
5905 |
{
|
|
5906 |
TVideoInfoV01& vidinfo = vidinfoBuf();
|
|
5907 |
info->iDisplaySizeInPixels=vidinfo.iSizeInPixels;
|
|
5908 |
info->iPhysicalScreenSize=vidinfo.iSizeInTwips;
|
|
5909 |
}
|
|
5910 |
else // no display driver
|
|
5911 |
{
|
|
5912 |
info->iDisplaySizeInPixels.iWidth=0;
|
|
5913 |
info->iDisplaySizeInPixels.iHeight=0;
|
|
5914 |
info->iPhysicalScreenSize.iWidth=0;
|
|
5915 |
info->iPhysicalScreenSize.iHeight=0;
|
|
5916 |
}
|
|
5917 |
TInt colors = 0;
|
|
5918 |
r = Exec::HalFunction(EHalGroupDisplay, EDisplayHalColors, &colors, NULL);
|
|
5919 |
info->iMaximumDisplayColors=(KErrNone == r)?colors:0;
|
|
5920 |
TInt val;
|
|
5921 |
info->iBacklightPresent= (KErrNone == Exec::HalFunction(EHalGroupDisplay, EDisplayHalBacklightOn, &val, NULL));
|
|
5922 |
|
|
5923 |
// Pointing device stuff
|
|
5924 |
TDigitiserInfoV01Buf xyinfoBuf;
|
|
5925 |
r = Exec::HalFunction(EHalGroupDigitiser, EDigitiserHalXYInfo, (TAny*)&xyinfoBuf, NULL);
|
|
5926 |
if (KErrNone == r)
|
|
5927 |
{
|
|
5928 |
info->iXYInputType=EXYInputPointer; // XY is Digitiser
|
|
5929 |
TDigitiserInfoV01& xyinfo = xyinfoBuf();
|
|
5930 |
info->iXYInputSizeInPixels=xyinfo.iDigitiserSize;
|
|
5931 |
info->iOffsetToDisplayInPixels=xyinfo.iOffsetToDisplay;
|
|
5932 |
}
|
|
5933 |
else
|
|
5934 |
{
|
|
5935 |
TMouseInfoV01Buf mouseinfoBuf;
|
|
5936 |
r = Exec::HalFunction(EHalGroupMouse, EMouseHalMouseInfo, (TAny*)&mouseinfoBuf, NULL);
|
|
5937 |
if (KErrNone == r)
|
|
5938 |
{
|
|
5939 |
info->iXYInputType=EXYInputMouse; // XY is Mouse
|
|
5940 |
TMouseInfoV01& mouseinfo = mouseinfoBuf();
|
|
5941 |
info->iXYInputSizeInPixels=mouseinfo.iMouseAreaSize;
|
|
5942 |
info->iOffsetToDisplayInPixels=mouseinfo.iOffsetToDisplay;
|
|
5943 |
}
|
|
5944 |
else
|
|
5945 |
{
|
|
5946 |
info->iXYInputType=EXYInputNone; // no XY
|
|
5947 |
info->iXYInputSizeInPixels.iWidth=0;
|
|
5948 |
info->iXYInputSizeInPixels.iHeight=0;
|
|
5949 |
info->iOffsetToDisplayInPixels.iX=0;
|
|
5950 |
info->iOffsetToDisplayInPixels.iY=0;
|
|
5951 |
}
|
|
5952 |
}
|
|
5953 |
|
|
5954 |
// Keyboard stuff
|
|
5955 |
TKeyboardInfoV01Buf kbdinfoBuf;
|
|
5956 |
info->iKeyboardPresent= (KErrNone == Exec::HalFunction(EHalGroupKeyboard, EKeyboardHalKeyboardInfo, (TAny*)&kbdinfoBuf, NULL));
|
|
5957 |
|
|
5958 |
// Unused, obsolete parameters
|
|
5959 |
info->iKeyboardId=0;
|
|
5960 |
info->iDisplayId=0;
|
|
5961 |
if(bufLength==sizeof(TMachineInfoV2))
|
|
5962 |
{
|
|
5963 |
// assemble a TMachineInfoV2 buffer
|
|
5964 |
info->iLanguageIndex=0;
|
|
5965 |
info->iKeyboardIndex=0;
|
|
5966 |
}
|
|
5967 |
|
|
5968 |
anInfo.SetLength(bufLength);
|
|
5969 |
|
|
5970 |
return KErrNone;
|
|
5971 |
}
|
|
5972 |
|
|
5973 |
/**
|
|
5974 |
Gets memory information.
|
|
5975 |
|
|
5976 |
@see HAL::Get()
|
|
5977 |
|
|
5978 |
@publishedPartner
|
|
5979 |
@deprecated Use HAL::Get() from the HAL library instead with attributes EMemoryRAM, EMemoryRAMFree or EMemoryROM.
|
|
5980 |
*/
|
|
5981 |
EXPORT_C TInt UserHal::MemoryInfo(TDes8& anInfo)
|
|
5982 |
{
|
|
5983 |
return Exec::HalFunction(EHalGroupKernel,EKernelHalMemoryInfo,(TAny*)&anInfo,NULL);
|
|
5984 |
}
|
|
5985 |
|
|
5986 |
/**
|
|
5987 |
Gets ROM configuration information.
|
|
5988 |
|
|
5989 |
@publishedPartner
|
|
5990 |
@deprecated No replacement.
|
|
5991 |
*/
|
|
5992 |
EXPORT_C TInt UserHal::RomInfo(TDes8& anInfo)
|
|
5993 |
{
|
|
5994 |
return Exec::HalFunction(EHalGroupKernel,EKernelHalRomInfo,(TAny*)&anInfo,NULL);
|
|
5995 |
}
|
|
5996 |
|
|
5997 |
|
|
5998 |
|
|
5999 |
|
|
6000 |
/**
|
|
6001 |
Gets drive information.
|
|
6002 |
|
|
6003 |
@param anInfo A package buffer (TPckgBuf) containing a TDriveInfoV1 structure.
|
|
6004 |
On return, this structure will contain the drive information.
|
|
6005 |
|
|
6006 |
@return KErrNone
|
|
6007 |
|
|
6008 |
@see TDriveInfoV1Buf
|
|
6009 |
@see TDriveInfoV1
|
|
6010 |
@see TPckgBuf
|
|
6011 |
*/
|
|
6012 |
EXPORT_C TInt UserHal::DriveInfo(TDes8& anInfo)
|
|
6013 |
{
|
|
6014 |
TDriveInfoV1Buf8 anInfo8;
|
|
6015 |
TInt r = Exec::HalFunction(EHalGroupMedia,EMediaHalDriveInfo,(TAny*)&anInfo8,NULL);
|
|
6016 |
TDriveInfoV18& driveInfo8 = anInfo8();
|
|
6017 |
TDriveInfoV1* driveInfo = NULL;
|
|
6018 |
switch(((SBuf8*)&anInfo)->length>>KShiftDesType8) //type
|
|
6019 |
{
|
|
6020 |
case EPtr:
|
|
6021 |
driveInfo = &((TPckg<TDriveInfoV1>&)anInfo)();
|
|
6022 |
break;
|
|
6023 |
case EBuf:
|
|
6024 |
driveInfo = &((TDriveInfoV1Buf&)anInfo)();
|
|
6025 |
break;
|
|
6026 |
default:
|
|
6027 |
__ASSERT_ALWAYS(EFalse,Panic(ETDes8BadDescriptorType));
|
|
6028 |
}
|
|
6029 |
|
|
6030 |
// A compile time assert to make sure that this function is examined if TDriveInfoV1
|
|
6031 |
// structure changes
|
|
6032 |
extern int TDriveInfoV1_structure_assert[(
|
|
6033 |
_FOFF(TDriveInfoV1,iRegisteredDriveBitmask)+4 == sizeof(TDriveInfoV1)
|
|
6034 |
&&
|
|
6035 |
sizeof(TDriveInfoV1) == 816
|
|
6036 |
)?1:-1];
|
|
6037 |
(void)TDriveInfoV1_structure_assert;
|
|
6038 |
|
|
6039 |
// Set length to size of old EKA1 TDriveInfoV1 (Will Panic if not big enough)
|
|
6040 |
TInt len = (TUint)_FOFF(TDriveInfoV1,iRegisteredDriveBitmask);
|
|
6041 |
anInfo.SetLength(len);
|
|
6042 |
|
|
6043 |
// Fill in info for old EKA1 TDriveInfoV1
|
|
6044 |
driveInfo->iTotalSupportedDrives = driveInfo8.iTotalSupportedDrives;
|
|
6045 |
driveInfo->iTotalSockets = driveInfo8.iTotalSockets;
|
|
6046 |
driveInfo->iRuggedFileSystem = driveInfo8.iRuggedFileSystem;
|
|
6047 |
TInt index;
|
|
6048 |
for(index=0;index<KMaxLocalDrives;index++)
|
|
6049 |
driveInfo->iDriveName[index].Copy(driveInfo8.iDriveName[index]);
|
|
6050 |
for(index=0;index<KMaxPBusSockets;index++)
|
|
6051 |
driveInfo->iSocketName[index].Copy(driveInfo8.iSocketName[index]);
|
|
6052 |
|
|
6053 |
// If anInfo is big enough then set new EKA2 members of TDriveInfoV1
|
|
6054 |
if((TUint)anInfo.MaxLength()>=(TUint)sizeof(TDriveInfoV1))
|
|
6055 |
{
|
|
6056 |
anInfo.SetLength(sizeof(TDriveInfoV1));
|
|
6057 |
driveInfo->iRegisteredDriveBitmask = driveInfo8.iRegisteredDriveBitmask;
|
|
6058 |
}
|
|
6059 |
return r;
|
|
6060 |
}
|
|
6061 |
|
|
6062 |
|
|
6063 |
|
|
6064 |
|
|
6065 |
/**
|
|
6066 |
Gets the startup reason.
|
|
6067 |
|
|
6068 |
@see HAL::Get()
|
|
6069 |
|
|
6070 |
@publishedPartner
|
|
6071 |
@deprecated Use HAL::Get() from the HAL library instead with attributes ESystemStartupReason.
|
|
6072 |
*/
|
|
6073 |
EXPORT_C TInt UserHal::StartupReason(TMachineStartupType& aReason)
|
|
6074 |
{
|
|
6075 |
return Exec::HalFunction(EHalGroupKernel,EKernelHalStartupReason,(TAny*)&aReason,NULL);
|
|
6076 |
}
|
|
6077 |
|
|
6078 |
|
|
6079 |
|
|
6080 |
|
|
6081 |
/**
|
|
6082 |
Gets the reason why the kernel last faulted.
|
|
6083 |
|
|
6084 |
@param aReason An integer that, on return, contains the reason code describing
|
|
6085 |
why the kernel faulted. This is the fault number passed
|
|
6086 |
in a call to Kern::Fault().
|
|
6087 |
|
|
6088 |
@return KErrNone
|
|
6089 |
|
|
6090 |
@see Kern::Fault()
|
|
6091 |
*/
|
|
6092 |
EXPORT_C TInt UserHal::FaultReason(TInt &aReason)
|
|
6093 |
{
|
|
6094 |
|
|
6095 |
return Exec::HalFunction(EHalGroupKernel,EKernelHalFaultReason,(TAny *)&aReason,NULL);
|
|
6096 |
}
|
|
6097 |
|
|
6098 |
|
|
6099 |
|
|
6100 |
|
|
6101 |
/**
|
|
6102 |
Gets the exception Id that describes the type of fault when
|
|
6103 |
the kernel last faulted.
|
|
6104 |
|
|
6105 |
The Id is the value contained in TArmExcInfo::iExcCode.
|
|
6106 |
|
|
6107 |
@param anId An integer that, on return, contains the exception Id.
|
|
6108 |
|
|
6109 |
@return KErrNone
|
|
6110 |
|
|
6111 |
@see TArmExcInfo::iExcCode
|
|
6112 |
@see TArmExcInfo
|
|
6113 |
*/
|
|
6114 |
EXPORT_C TInt UserHal::ExceptionId(TInt &anId)
|
|
6115 |
{
|
|
6116 |
|
|
6117 |
return Exec::HalFunction(EHalGroupKernel,EKernelHalExceptionId, (TAny *)&anId, NULL);
|
|
6118 |
}
|
|
6119 |
|
|
6120 |
|
|
6121 |
|
|
6122 |
/**
|
|
6123 |
Gets the available exception information that describes the last kernel fault.
|
|
6124 |
|
|
6125 |
@param aInfo A TExcInfo structure that, on return, contains the available
|
|
6126 |
exception information.
|
|
6127 |
|
|
6128 |
@return KErrNone
|
|
6129 |
|
|
6130 |
@see TExcInfo
|
|
6131 |
*/
|
|
6132 |
EXPORT_C TInt UserHal::ExceptionInfo(TExcInfo &aInfo)
|
|
6133 |
{
|
|
6134 |
|
|
6135 |
return Exec::HalFunction(EHalGroupKernel,EKernelHalExceptionInfo, (TAny *)&aInfo, NULL);
|
|
6136 |
}
|
|
6137 |
|
|
6138 |
|
|
6139 |
|
|
6140 |
|
|
6141 |
/**
|
|
6142 |
Gets the page size for this device.
|
|
6143 |
|
|
6144 |
@param anId An integer that, on return, contains the page size, in bytes,
|
|
6145 |
for this device.
|
|
6146 |
|
|
6147 |
@return KErrNone
|
|
6148 |
*/
|
|
6149 |
EXPORT_C TInt UserHal::PageSizeInBytes(TInt& aSize)
|
|
6150 |
{
|
|
6151 |
|
|
6152 |
return Exec::HalFunction(EHalGroupKernel,EKernelHalPageSizeInBytes,(TAny*)&aSize,NULL);
|
|
6153 |
}
|
|
6154 |
|
|
6155 |
|
|
6156 |
|
|
6157 |
|
|
6158 |
/**
|
|
6159 |
Switches the device off.
|
|
6160 |
|
|
6161 |
@return KErrNone, if successful; KErrPermissionDenied, if the calling process
|
|
6162 |
has insufficient capability.
|
|
6163 |
|
|
6164 |
@capability PowerMgmt
|
|
6165 |
*/
|
|
6166 |
EXPORT_C TInt UserHal::SwitchOff()
|
|
6167 |
{
|
|
6168 |
if(!RProcess().HasCapability(ECapabilityPowerMgmt,__PLATSEC_DIAGNOSTIC_STRING("Checked by UserHal::SwitchOff")))
|
|
6169 |
return KErrPermissionDenied;
|
|
6170 |
TInt r = Power::EnableWakeupEvents(EPwStandby);
|
|
6171 |
if(r!=KErrNone)
|
|
6172 |
return r;
|
|
6173 |
TRequestStatus s;
|
|
6174 |
Power::RequestWakeupEventNotification(s);
|
|
6175 |
Power::PowerDown();
|
|
6176 |
User::WaitForRequest(s);
|
|
6177 |
return s.Int();
|
|
6178 |
// return Exec::HalFunction(EHalGroupPower,EPowerHalSwitchOff,NULL,NULL);
|
|
6179 |
}
|
|
6180 |
|
|
6181 |
|
|
6182 |
|
|
6183 |
|
|
6184 |
/**
|
|
6185 |
Sets the calibration data for the digitiser (i.e. XY) input device.
|
|
6186 |
|
|
6187 |
@param aCalibration The calibration data.
|
|
6188 |
|
|
6189 |
@return KErrNone, if successful; KErrPermissionDenied, if the calling process
|
|
6190 |
has insufficient capability.
|
|
6191 |
|
|
6192 |
@see TDigitizerCalibration
|
|
6193 |
|
|
6194 |
@capability WriteDeviceData
|
|
6195 |
*/
|
|
6196 |
EXPORT_C TInt UserHal::SetXYInputCalibration(const TDigitizerCalibration& aCalibration)
|
|
6197 |
{
|
|
6198 |
return Exec::HalFunction(EHalGroupDigitiser,EDigitiserHalSetXYInputCalibration,(TAny*)&aCalibration,NULL);
|
|
6199 |
}
|
|
6200 |
|
|
6201 |
|
|
6202 |
|
|
6203 |
|
|
6204 |
/**
|
|
6205 |
Gets the points on the display that the user should point to in order
|
|
6206 |
to calibrate the digitiser (i.e. XY) input device.
|
|
6207 |
|
|
6208 |
@param aCalibration A TDigitizerCalibration object that, on return, contains
|
|
6209 |
the appropriate information.
|
|
6210 |
|
|
6211 |
@return KerrNone, if successful; otherwise one of the other system wide
|
|
6212 |
error codes.
|
|
6213 |
*/
|
|
6214 |
EXPORT_C TInt UserHal::CalibrationPoints(TDigitizerCalibration& aCalibration)
|
|
6215 |
{
|
|
6216 |
|
|
6217 |
return Exec::HalFunction(EHalGroupDigitiser,EDigitiserHalCalibrationPoints,(TAny*)&aCalibration,NULL);
|
|
6218 |
}
|
|
6219 |
|
|
6220 |
|
|
6221 |
|
|
6222 |
|
|
6223 |
/**
|
|
6224 |
Gets the platform tick period.
|
|
6225 |
|
|
6226 |
@param aTime The tick period in microseconds.
|
|
6227 |
|
|
6228 |
@return KErrNone, if successful; otherwise one of the other system wide
|
|
6229 |
error codes.
|
|
6230 |
*/
|
|
6231 |
EXPORT_C TInt UserHal::TickPeriod(TTimeIntervalMicroSeconds32 &aTime)
|
|
6232 |
{
|
|
6233 |
|
|
6234 |
return Exec::HalFunction(EHalGroupKernel,EKernelHalTickPeriod,(TAny*)&aTime,NULL);
|
|
6235 |
}
|
|
6236 |
|
|
6237 |
|
|
6238 |
|
|
6239 |
/**
|
|
6240 |
Saves the current digitiser (i.e. XY) input device calibration data.
|
|
6241 |
|
|
6242 |
@return KErrNone, if successful; otherwise one of the other system wide
|
|
6243 |
error codes, e.g. KErrNotSupported.
|
|
6244 |
*/
|
|
6245 |
EXPORT_C TInt UserHal::SaveXYInputCalibration()
|
|
6246 |
{
|
|
6247 |
|
|
6248 |
return Exec::HalFunction(EHalGroupDigitiser,EDigitiserHalSaveXYInputCalibration,NULL,NULL);
|
|
6249 |
}
|
|
6250 |
|
|
6251 |
|
|
6252 |
|
|
6253 |
|
|
6254 |
/**
|
|
6255 |
Restores the digitiser (i.e. XY) input device calibration data.
|
|
6256 |
|
|
6257 |
@param aType A TDigitizerCalibration object that, on return, contains
|
|
6258 |
the calibration data.
|
|
6259 |
|
|
6260 |
@return KErrNone, if successful; KErrPermissionDenied, if the calling process
|
|
6261 |
has insufficient capability; otherwise one of the other system wide
|
|
6262 |
error codes, e.g. KErrNotSupported.
|
|
6263 |
|
|
6264 |
@capability WriteDeviceData
|
|
6265 |
*/
|
|
6266 |
EXPORT_C TInt UserHal::RestoreXYInputCalibration(TDigitizerCalibrationType aType)
|
|
6267 |
{
|
|
6268 |
return Exec::HalFunction(EHalGroupDigitiser,EDigitiserHalRestoreXYInputCalibration,(TAny*)aType,NULL);
|
|
6269 |
}
|
|
6270 |
|
|
6271 |
|
|
6272 |
|
|
6273 |
|
|
6274 |
/**
|
|
6275 |
Gets the machine configuration.
|
|
6276 |
|
|
6277 |
@param aConfig On return contains the machine configuration data.
|
|
6278 |
@param aSize On return, contains the size of the data.
|
|
6279 |
|
|
6280 |
@return KErrNone, if sucessful, otherwise one of the other system-wide
|
|
6281 |
error codes.
|
|
6282 |
|
|
6283 |
@capability ReadDeviceData
|
|
6284 |
*/
|
|
6285 |
EXPORT_C TInt User::MachineConfiguration(TDes8& aConfig,TInt& aSize)
|
|
6286 |
{
|
|
6287 |
return(Exec::MachineConfiguration(aConfig,aSize));
|
|
6288 |
}
|
|
6289 |
|
|
6290 |
|
|
6291 |
|
|
6292 |
|
|
6293 |
EXPORT_C TInt RDebug::Print(TRefByValue<const TDesC> aFmt,...)
|
|
6294 |
//
|
|
6295 |
// Print to the comms port
|
|
6296 |
//
|
|
6297 |
{
|
|
6298 |
|
|
6299 |
TestOverflowTruncate overflow;
|
|
6300 |
// coverity[var_decl]
|
|
6301 |
VA_LIST list;
|
|
6302 |
VA_START(list,aFmt);
|
|
6303 |
TBuf<0x100> buf;
|
|
6304 |
// coverity[uninit_use_in_call]
|
|
6305 |
TRAP_IGNORE(buf.AppendFormatList(aFmt,list,&overflow)); // ignore leave in TTimeOverflowLeave::Overflow()
|
|
6306 |
#ifdef _UNICODE
|
|
6307 |
TPtr8 p(buf.Collapse());
|
|
6308 |
Exec::DebugPrint((TAny*)&p, 0);
|
|
6309 |
#else
|
|
6310 |
Exec::DebugPrint((TAny*)&buf, 0);
|
|
6311 |
#endif
|
|
6312 |
return 0;
|
|
6313 |
}
|
|
6314 |
|
|
6315 |
class TestOverflowTruncate8 : public TDes8Overflow
|
|
6316 |
{
|
|
6317 |
public:
|
|
6318 |
virtual void Overflow(TDes8& /*aDes*/) {}
|
|
6319 |
};
|
|
6320 |
|
|
6321 |
EXPORT_C void RDebug::Printf(const char* aFmt, ...)
|
|
6322 |
//
|
|
6323 |
// Print to the comms port
|
|
6324 |
//
|
|
6325 |
{
|
|
6326 |
|
|
6327 |
TestOverflowTruncate8 overflow;
|
|
6328 |
// coverity[var_decl]
|
|
6329 |
VA_LIST list;
|
|
6330 |
VA_START(list,aFmt);
|
|
6331 |
TPtrC8 fmt((const TText8*)aFmt);
|
|
6332 |
TBuf8<0x100> buf;
|
|
6333 |
// coverity[uninit_use_in_call]
|
|
6334 |
TRAP_IGNORE(buf.AppendFormatList(fmt,list,&overflow));
|
|
6335 |
Exec::DebugPrint((TAny*)&buf, 0);
|
|
6336 |
}
|
|
6337 |
|
|
6338 |
EXPORT_C void RDebug::RawPrint(const TDesC8& aDes)
|
|
6339 |
{
|
|
6340 |
Exec::DebugPrint((TAny*)&aDes, 1);
|
|
6341 |
}
|
|
6342 |
|
|
6343 |
EXPORT_C void RDebug::RawPrint(const TDesC16& aDes)
|
|
6344 |
//
|
|
6345 |
// Print to the comms port
|
|
6346 |
//
|
|
6347 |
{
|
|
6348 |
TBuf8<0x100> aDes8;
|
|
6349 |
if(aDes.Length()>0x100)
|
|
6350 |
{
|
|
6351 |
TPtrC ptr(aDes.Ptr(), 0x100);
|
|
6352 |
aDes8.Copy(ptr);
|
|
6353 |
}
|
|
6354 |
else
|
|
6355 |
aDes8.Copy(aDes);
|
|
6356 |
Exec::DebugPrint((TAny*)&aDes8, 1);
|
|
6357 |
}
|
|
6358 |
|
|
6359 |
EXPORT_C TUint32 Math::Random()
|
|
6360 |
/**
|
|
6361 |
Gets 32 random bits from the kernel's random pool.
|
|
6362 |
|
|
6363 |
@return The 32 random bits.
|
|
6364 |
*/
|
|
6365 |
{
|
|
6366 |
|
|
6367 |
return Exec::MathRandom();
|
|
6368 |
}
|
|
6369 |
|
|
6370 |
|
|
6371 |
|
|
6372 |
EXPORT_C void User::IMB_Range(TAny* aStart, TAny* aEnd)
|
|
6373 |
/**
|
|
6374 |
Does the necessary preparations to guarantee correct execution of code in the
|
|
6375 |
specified virtual address range.
|
|
6376 |
|
|
6377 |
The function assumes that this code has been loaded or modified by user code.
|
|
6378 |
Calling this function against uncommitted memory region is considered as S/W
|
|
6379 |
bug and may generate exception on some memory models.
|
|
6380 |
|
|
6381 |
The specified addresses are associated with a user writable code chunk as
|
|
6382 |
created by RChunk::CreateLocalCode().
|
|
6383 |
|
|
6384 |
The function cleans the data cache to ensure that written data has been
|
|
6385 |
committed to main memory and then flushes the instruction cache and branch
|
|
6386 |
target buffer (BTB) to ensure that the code is loaded from main memory when
|
|
6387 |
it is executed.
|
|
6388 |
The Kernel uses the size of the range specified to decide whether to clean/flush
|
|
6389 |
line-by-line or to simply clean/flush the entire cache.
|
|
6390 |
|
|
6391 |
@param aStart The start virtual address of the region.
|
|
6392 |
@param aEnd The end virtual address of the region. This location is not within
|
|
6393 |
the region.
|
|
6394 |
|
|
6395 |
@see RChunk::CreateLocalCode()
|
|
6396 |
@see UserHeap::ChunkHeap()
|
|
6397 |
*/
|
|
6398 |
{
|
|
6399 |
|
|
6400 |
Exec::IMB_Range(aStart,(TUint32)aEnd-(TUint32)aStart);
|
|
6401 |
}
|
|
6402 |
|
|
6403 |
|
|
6404 |
|
|
6405 |
|
|
6406 |
/**
|
|
6407 |
Sets the specified handle into the specified environment data slot
|
|
6408 |
for this process.
|
|
6409 |
|
|
6410 |
The APPARC framework (class CApaApplication etc.) uses some of the slots internally,
|
|
6411 |
so programs that use this framework should ensure that they only use slots available
|
|
6412 |
for public use.
|
|
6413 |
|
|
6414 |
@param aSlot An index that identifies the environment data slot.
|
|
6415 |
This is a value relative to zero;
|
|
6416 |
i.e. 0 is the first item/slot.
|
|
6417 |
This can range from 0 to 15.
|
|
6418 |
@param aHandle The handle to be passed to this process.
|
|
6419 |
|
|
6420 |
@return KErrNone, always.
|
|
6421 |
|
|
6422 |
@panic KERN-EXEC 46 if this function is called by a thread running
|
|
6423 |
in a process that is not the creator of this process, or
|
|
6424 |
the handle is not local.
|
|
6425 |
@panic KERN-EXEC 51 if aSlot is negative or is greater than or equal to
|
|
6426 |
the value of KArgIndex.
|
|
6427 |
@panic KERN-EXEC 52 if the specified slot is already in use.
|
|
6428 |
|
|
6429 |
@see CApaApplication
|
|
6430 |
@see CApaCommandLine::EnvironmentSlotForPublicUse()
|
|
6431 |
*/
|
|
6432 |
EXPORT_C TInt RProcess::SetParameter(TInt aSlot, RHandleBase aHandle)
|
|
6433 |
{
|
|
6434 |
return Exec::ProcessSetHandleParameter(iHandle, aSlot, aHandle.Handle());
|
|
6435 |
}
|
|
6436 |
|
|
6437 |
|
|
6438 |
|
|
6439 |
|
|
6440 |
/**
|
|
6441 |
Sets the specified 16-bit descriptor data into the specified environment
|
|
6442 |
data slot for this process.
|
|
6443 |
|
|
6444 |
The APPARC framework (class CApaApplication etc.) uses some of the slots internally,
|
|
6445 |
so programs that use this framework should ensure that they only use slots available
|
|
6446 |
for public use.
|
|
6447 |
|
|
6448 |
@param aSlot An index that identifies the environment data slot.
|
|
6449 |
This is a value relative to zero;
|
|
6450 |
i.e. 0 is the first item/slot.
|
|
6451 |
This can range from 0 to 15.
|
|
6452 |
@param aDes The 16-bit descriptor containing data be passed to this process.
|
|
6453 |
|
|
6454 |
@return KErrNone, if successful, otherwise one of the other system
|
|
6455 |
wide error codes.
|
|
6456 |
|
|
6457 |
@panic KERN-EXEC 46 if this function is called by a thread running
|
|
6458 |
in a process that is not the creator of this process.
|
|
6459 |
@panic KERN-EXEC 51 if aSlot is negative or is greater than or equal to
|
|
6460 |
the value of KArgIndex.
|
|
6461 |
@panic KERN-EXEC 52 if the specified slot is already in use.
|
|
6462 |
@panic KERN-EXEC 53 if the length of data passed is negative.
|
|
6463 |
|
|
6464 |
@see CApaApplication
|
|
6465 |
@see CApaCommandLine::EnvironmentSlotForPublicUse()
|
|
6466 |
*/
|
|
6467 |
EXPORT_C TInt RProcess::SetParameter(TInt aSlot, const TDesC16& aDes)
|
|
6468 |
{
|
|
6469 |
return Exec::ProcessSetDataParameter(iHandle, aSlot, (const TUint8*)aDes.Ptr(), 2*aDes.Length());
|
|
6470 |
}
|
|
6471 |
|
|
6472 |
|
|
6473 |
|
|
6474 |
|
|
6475 |
/**
|
|
6476 |
Sets the specified 8-bit descriptor data into the specified environment
|
|
6477 |
data slot for this process.
|
|
6478 |
|
|
6479 |
The APPARC framework (class CApaApplication etc.) uses some of the slots internally,
|
|
6480 |
so programs that use this framework should ensure that they only use slots available
|
|
6481 |
for public use.
|
|
6482 |
|
|
6483 |
@param aSlot An index that identifies the environment data slot.
|
|
6484 |
This is a value relative to zero;
|
|
6485 |
i.e. 0 is the first item/slot.
|
|
6486 |
This can range from 0 to 15.
|
|
6487 |
@param aDes The 8-bit descriptor containing data be passed to this process.
|
|
6488 |
|
|
6489 |
@return KErrNone, if successful, otherwise one of the other system
|
|
6490 |
wide error codes.
|
|
6491 |
|
|
6492 |
@panic KERN-EXEC 46 if this function is called by a thread running
|
|
6493 |
in a process that is not the creator of this process.
|
|
6494 |
@panic KERN-EXEC 51 if aSlot is negative or is greater than or equal to
|
|
6495 |
the value of KArgIndex.
|
|
6496 |
@panic KERN-EXEC 52 if the specified slot is already in use.
|
|
6497 |
@panic KERN-EXEC 53 if the length of data passed is negative.
|
|
6498 |
|
|
6499 |
@see CApaApplication
|
|
6500 |
@see CApaCommandLine::EnvironmentSlotForPublicUse()
|
|
6501 |
*/
|
|
6502 |
EXPORT_C TInt RProcess::SetParameter(TInt aSlot, const TDesC8& aDes)
|
|
6503 |
{
|
|
6504 |
return Exec::ProcessSetDataParameter(iHandle, aSlot, aDes.Ptr(), aDes.Length());
|
|
6505 |
}
|
|
6506 |
|
|
6507 |
|
|
6508 |
|
|
6509 |
|
|
6510 |
/**
|
|
6511 |
Sets the specfied sub-session into the specified environment
|
|
6512 |
data slot for this process.
|
|
6513 |
|
|
6514 |
The APPARC framework (class CApaApplication etc.) uses some of the slots internally,
|
|
6515 |
so programs that use this framework should ensure that they only use slots available
|
|
6516 |
for public use.
|
|
6517 |
|
|
6518 |
@param aSlot An index that identifies the environment data slot.
|
|
6519 |
This is a value relative to zero;
|
|
6520 |
i.e. 0 is the first item/slot.
|
|
6521 |
This can range from 0 to 15.
|
|
6522 |
@param aSession The sub-session.
|
|
6523 |
|
|
6524 |
@return KErrNone, if successful, otherwise one of the other system
|
|
6525 |
wide error codes.
|
|
6526 |
|
|
6527 |
@panic KERN-EXEC 46 if this function is called by a thread running
|
|
6528 |
in a process that is not the creator of this process.
|
|
6529 |
@panic KERN-EXEC 51 if aSlot is negative or is greater than or equal to
|
|
6530 |
the value of KArgIndex.
|
|
6531 |
@panic KERN-EXEC 52 if the specified slot is already in use.
|
|
6532 |
@panic KERN-EXEC 53 if the length of data passed is negative.
|
|
6533 |
|
|
6534 |
@see CApaApplication
|
|
6535 |
@see CApaCommandLine::EnvironmentSlotForPublicUse()
|
|
6536 |
*/
|
|
6537 |
EXPORT_C TInt RProcess::SetParameter(TInt aSlot, const RSubSessionBase& aSession)
|
|
6538 |
{
|
|
6539 |
TInt handle = aSession.SubSessionHandle();
|
|
6540 |
return Exec::ProcessSetDataParameter(iHandle, aSlot, (const TUint8*)&handle, sizeof(handle));
|
|
6541 |
}
|
|
6542 |
|
|
6543 |
|
|
6544 |
|
|
6545 |
|
|
6546 |
/**
|
|
6547 |
Sets the specfied integer value into the specified environment
|
|
6548 |
data slot for this process.
|
|
6549 |
|
|
6550 |
The APPARC framework (class CApaApplication etc.) uses some of the slots internally,
|
|
6551 |
so programs that use this framework should ensure that they only use slots available
|
|
6552 |
for public use.
|
|
6553 |
|
|
6554 |
@param aSlot An index that identifies the environment data slot.
|
|
6555 |
This is a value relative to zero;
|
|
6556 |
i.e. 0 is the first item/slot.
|
|
6557 |
This can range from 0 to 15.
|
|
6558 |
@param aData The integer value.
|
|
6559 |
|
|
6560 |
@return KErrNone, if successful, otherwise one of the other system
|
|
6561 |
wide error codes.
|
|
6562 |
|
|
6563 |
@panic KERN-EXEC 46 if this function is called by a thread running
|
|
6564 |
in a process that is not the creator of this process.
|
|
6565 |
@panic KERN-EXEC 51 if aSlot is negative or is greater than or equal to
|
|
6566 |
the value of KArgIndex.
|
|
6567 |
@panic KERN-EXEC 52 if the specified slot is already in use.
|
|
6568 |
@panic KERN-EXEC 53 if the length of data passed is negative.
|
|
6569 |
|
|
6570 |
@see CApaApplication
|
|
6571 |
@see CApaCommandLine::EnvironmentSlotForPublicUse()
|
|
6572 |
*/
|
|
6573 |
EXPORT_C TInt RProcess::SetParameter(TInt aSlot, TInt aData)
|
|
6574 |
{
|
|
6575 |
return Exec::ProcessSetDataParameter(iHandle, aSlot, (TUint8*)&aData, sizeof(aData));
|
|
6576 |
}
|
|
6577 |
|
|
6578 |
|
|
6579 |
|
|
6580 |
|
|
6581 |
EXPORT_C TInt User::GetTIntParameter(TInt aSlot, TInt& aData)
|
|
6582 |
/**
|
|
6583 |
Gets the specified environment data item belonging to the
|
|
6584 |
current process; this is assumed to be a 32 bit value.
|
|
6585 |
|
|
6586 |
Environment data may be stored in the process and is passed to a child process
|
|
6587 |
on creation of that child process.
|
|
6588 |
|
|
6589 |
On successful return from this function, the data item is deleted from
|
|
6590 |
the process.
|
|
6591 |
|
|
6592 |
@param aSlot An index that identifies the data item.
|
|
6593 |
This is an index whose value is relative to zero;
|
|
6594 |
i.e. 0 is the first item/slot.
|
|
6595 |
This can range from 0 to 15, i.e. there are 16 slots.
|
|
6596 |
|
|
6597 |
@param aData On sucessful return, contains the environment data item.
|
|
6598 |
|
|
6599 |
@return KErrNone, if successful;
|
|
6600 |
KErrNotFound, if there is no data;
|
|
6601 |
KErrArgument, if the data is not binary data, or the data item in the
|
|
6602 |
process is longer than 32 bits.
|
|
6603 |
|
|
6604 |
@panic KERN-EXEC 51, if aSlot is negative or is greater than or equal to 16.
|
|
6605 |
*/
|
|
6606 |
{
|
|
6607 |
TInt ret = Exec::ProcessGetDataParameter(aSlot, (TUint8*)&aData, sizeof(TInt));
|
|
6608 |
if (ret < 0)
|
|
6609 |
return ret;
|
|
6610 |
return KErrNone;
|
|
6611 |
}
|
|
6612 |
|
|
6613 |
|
|
6614 |
|
|
6615 |
|
|
6616 |
EXPORT_C TInt User::ParameterLength(TInt aSlot)
|
|
6617 |
/**
|
|
6618 |
Gets the length of the specified item of environment data belonging to the
|
|
6619 |
current process.
|
|
6620 |
|
|
6621 |
Environment data may be stored in the process and is passed to a child process
|
|
6622 |
on creation of that child process.
|
|
6623 |
|
|
6624 |
@param aSlot An index that identifies the data item whose length is to be
|
|
6625 |
retrieved. This is an index whose value is relative to zero;
|
|
6626 |
i.e. 0 is the first item/slot.
|
|
6627 |
This can range from 0 to 15, i.e. there are 16 slots.
|
|
6628 |
|
|
6629 |
@return KErrNotFound, if there is no data;
|
|
6630 |
KErrArgument, if the data is not binary data;
|
|
6631 |
The length of the data item.
|
|
6632 |
|
|
6633 |
@panic KERN-EXEC 51, if aSlot is negative or is greater than or equal to 16.
|
|
6634 |
*/
|
|
6635 |
{
|
|
6636 |
TInt ret = Exec::ProcessDataParameterLength(aSlot);
|
|
6637 |
return ret;
|
|
6638 |
}
|
|
6639 |
|
|
6640 |
|
|
6641 |
|
|
6642 |
|
|
6643 |
EXPORT_C TInt User::GetDesParameter(TInt aSlot, TDes8& aDes)
|
|
6644 |
/**
|
|
6645 |
Gets the specified environment data item belonging to the
|
|
6646 |
current process; this is assumed to be an 8-bit descriptor.
|
|
6647 |
|
|
6648 |
Environment data may be stored in the process and is passed to a child process
|
|
6649 |
on creation of that child process.
|
|
6650 |
|
|
6651 |
On successful return from this function, the data item is deleted from
|
|
6652 |
the process.
|
|
6653 |
|
|
6654 |
@param aSlot An index that identifies the data item.
|
|
6655 |
This is an index whose value is relative to zero;
|
|
6656 |
i.e. 0 is the first item/slot.
|
|
6657 |
This can range from 0 to 15, i.e. there are 16 slots.
|
|
6658 |
|
|
6659 |
@param aDes On sucessful return, contains the environment data item; the
|
|
6660 |
length of the descriptor is set to the length of the data item.
|
|
6661 |
|
|
6662 |
@return KErrNone, if successful;
|
|
6663 |
KErrNotFound, if there is no data;
|
|
6664 |
KErrArgument, if the data is not binary data, or the data item in the
|
|
6665 |
process is longer than the maximum length of aDes.
|
|
6666 |
|
|
6667 |
@panic KERN-EXEC 51, if aSlot is negative or is greater than or equal to 16.
|
|
6668 |
*/
|
|
6669 |
{
|
|
6670 |
TInt ret = Exec::ProcessGetDataParameter(aSlot, (TUint8*)aDes.Ptr(), aDes.MaxLength());
|
|
6671 |
if (ret < 0)
|
|
6672 |
return ret;
|
|
6673 |
aDes.SetLength(ret);
|
|
6674 |
return KErrNone;
|
|
6675 |
}
|
|
6676 |
|
|
6677 |
|
|
6678 |
|
|
6679 |
|
|
6680 |
EXPORT_C TInt User::GetDesParameter(TInt aSlot, TDes16& aDes)
|
|
6681 |
/**
|
|
6682 |
Gets the specified environment data item belonging to the
|
|
6683 |
current process; this is assumed to be an 16-bit descriptor.
|
|
6684 |
|
|
6685 |
Environment data may be stored in the process and is passed to a child process
|
|
6686 |
on creation of that child process.
|
|
6687 |
|
|
6688 |
On successful return from this function, the data item is deleted from
|
|
6689 |
the process.
|
|
6690 |
|
|
6691 |
@param aSlot An index that identifies the data item.
|
|
6692 |
This is an index whose value is relative to zero;
|
|
6693 |
i.e. 0 is the first item/slot.
|
|
6694 |
This can range from 0 to 15, i.e. there are 16 slots.
|
|
6695 |
|
|
6696 |
@param aDes On sucessful return, contains the environment data item; the
|
|
6697 |
length of the descriptor is set to the length of the data item.
|
|
6698 |
|
|
6699 |
@return KErrNone, if successful;
|
|
6700 |
KErrNotFound, if there is no data;
|
|
6701 |
KErrArgument, if the data is not binary data, or the data item in the
|
|
6702 |
process is longer than the maximum length of aDes.
|
|
6703 |
|
|
6704 |
@panic KERN-EXEC 51, if aSlot is negative or is greater than or equal to 16.
|
|
6705 |
*/
|
|
6706 |
{
|
|
6707 |
TInt ret = Exec::ProcessGetDataParameter(aSlot, (TUint8*)aDes.Ptr(), 2*aDes.MaxLength());
|
|
6708 |
if (ret < 0)
|
|
6709 |
return ret;
|
|
6710 |
aDes.SetLength(ret/2);
|
|
6711 |
return KErrNone;
|
|
6712 |
}
|
|
6713 |
|
|
6714 |
/**
|
|
6715 |
Gets the linear address of the exception descriptor for the code module in which
|
|
6716 |
a specified code address resides.
|
|
6717 |
|
|
6718 |
@param aCodeAddress The code address in question.
|
|
6719 |
@return The address of the exception descriptor, or zero if there is none.
|
|
6720 |
|
|
6721 |
*/
|
|
6722 |
EXPORT_C TLinAddr UserSvr::ExceptionDescriptor(TLinAddr aCodeAddress)
|
|
6723 |
{
|
|
6724 |
return Exec::ExceptionDescriptor(aCodeAddress);
|
|
6725 |
}
|
|
6726 |
|
|
6727 |
EXPORT_C TInt User::SetFloatingPointMode(TFloatingPointMode aMode, TFloatingPointRoundingMode aRoundingMode)
|
|
6728 |
/**
|
|
6729 |
Sets the hardware floating point mode for the current thread. This does not affect
|
|
6730 |
software floating point calculations. The rounding mode can also be set. New threads created
|
|
6731 |
by this thread will inherit the mode, thus to set the mode for a whole process, call this
|
|
6732 |
method before you create any new threads.
|
|
6733 |
|
|
6734 |
@param aMode The floating point calculation mode to use.
|
|
6735 |
@param aRoundingMode The floating point rounding mode to use, defaults to nearest.
|
|
6736 |
|
|
6737 |
@return KErrNone if successful, KErrNotSupported if the hardware does not support the
|
|
6738 |
chosen mode, or there is no floating point hardware present.
|
|
6739 |
|
|
6740 |
@see TFloatingPointMode
|
|
6741 |
@see TFloatingPointRoundingMode
|
|
6742 |
*/
|
|
6743 |
{
|
|
6744 |
return(Exec::SetFloatingPointMode(aMode, aRoundingMode));
|
|
6745 |
}
|
|
6746 |
|
|
6747 |
|
|
6748 |
EXPORT_C TUint32 E32Loader::PagingPolicy()
|
|
6749 |
/**
|
|
6750 |
Accessor function returns the code paging policy, as defined at ROM build time.
|
|
6751 |
|
|
6752 |
@return Code paging policy only. This function applies
|
|
6753 |
EKernelConfigCodePagingPolicyMask to the config flags
|
|
6754 |
before returning the value.
|
|
6755 |
*/
|
|
6756 |
{
|
|
6757 |
return Exec::KernelConfigFlags() & EKernelConfigCodePagingPolicyMask;
|
|
6758 |
}
|
|
6759 |
|
|
6760 |
|
|
6761 |
/** Queue a notifier to detect system idle
|
|
6762 |
|
|
6763 |
@internalTechnology
|
|
6764 |
@prototype
|
|
6765 |
*/
|
|
6766 |
EXPORT_C void User::NotifyOnIdle(TRequestStatus& aStatus)
|
|
6767 |
{
|
|
6768 |
aStatus = KRequestPending;
|
|
6769 |
Exec::NotifyOnIdle(&aStatus);
|
|
6770 |
}
|
|
6771 |
|
|
6772 |
|
|
6773 |
/** Cancel a miscellaneous notification requested by this thread
|
|
6774 |
|
|
6775 |
Cancels a currently outstanding notification for system idle or object
|
|
6776 |
deletion.
|
|
6777 |
|
|
6778 |
@internalTechnology
|
|
6779 |
@prototype
|
|
6780 |
*/
|
|
6781 |
EXPORT_C void User::CancelMiscNotifier(TRequestStatus& aStatus)
|
|
6782 |
{
|
|
6783 |
Exec::CancelMiscNotifier(&aStatus);
|
|
6784 |
}
|
|
6785 |
|
|
6786 |
|
|
6787 |
/** Queue a notifier to detect destruction of this object
|
|
6788 |
|
|
6789 |
To cancel the notifier, use User::CancelMiscNotifier().
|
|
6790 |
|
|
6791 |
@internalTechnology
|
|
6792 |
@prototype
|
|
6793 |
*/
|
|
6794 |
EXPORT_C void RHandleBase::NotifyDestruction(TRequestStatus& aStatus)
|
|
6795 |
{
|
|
6796 |
aStatus = KRequestPending;
|
|
6797 |
Exec::NotifyObjectDestruction(iHandle, &aStatus);
|
|
6798 |
}
|
|
6799 |
|