Commit | Line | Data |
3a2f06e9 |
1 | /* |
2 | * Copyright (c) 1999 Olaf Flebbe o.flebbe@gmx.de |
3 | * |
4 | * You may distribute under the terms of either the GNU General Public |
5 | * License or the Artistic License, as specified in the README file. |
6 | * |
7 | */ |
8 | |
b250498f |
9 | /* This is C++ Code !! */ |
3a2f06e9 |
10 | |
11 | #include <e32std.h> |
12 | |
13 | extern "C" { |
14 | |
15 | epoc_spawn( char *cmd, char *cmdline) { |
16 | RProcess p; |
17 | TRequestStatus status; |
18 | TInt rc; |
19 | |
20 | rc = p.Create( _L( cmd), _L( cmdline)); |
21 | if (rc != KErrNone) |
22 | return -1; |
23 | |
24 | p.Resume(); |
25 | |
26 | p.Logon( status); |
27 | User::WaitForRequest( status); |
28 | if (status!=KErrNone) { |
29 | return -1; |
30 | } |
31 | return 0; |
32 | } |
33 | |
b250498f |
34 | |
35 | /* Workaround for defect atof(), see java defect list for epoc */ |
fa6a1c44 |
36 | double epoc_atof( char* str) { |
b250498f |
37 | TReal64 aRes; |
fa6a1c44 |
38 | |
39 | while (TChar( *str).IsSpace()) { |
40 | str++; |
41 | } |
b250498f |
42 | |
43 | TLex lex( _L( str)); |
44 | TInt err = lex.Val( aRes, TChar( '.')); |
45 | return aRes; |
46 | } |
47 | |
48 | void epoc_gcvt( double x, int digits, unsigned char *buf) { |
49 | TRealFormat trel; |
50 | |
51 | trel.iPlaces = digits; |
52 | trel.iPoint = TChar( '.'); |
53 | |
54 | TPtr result( buf, 80); |
55 | |
56 | result.Num( x, trel); |
57 | result.Append( TChar( 0)); |
58 | } |
3a2f06e9 |
59 | } |