summaryrefslogtreecommitdiff
path: root/gnu/usr.bin/perl/epoc/epocish.c
blob: d457fffcb08ecf54287e6a3ed879db245b42dcc2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 *    Copyright (c) 1999 Olaf Flebbe o.flebbe@gmx.de
 *    
 *    You may distribute under the terms of either the GNU General Public
 *    License or the Artistic License, as specified in the README file.
 *
 */

/* This is C++ Code !! */

#include <e32std.h>
#include <stdlib.h>
#include <estlib.h>
#include <string.h>

extern "C" { 


/* Workaround for defect strtoul(). Values with leading + are zero */

unsigned long int epoc_strtoul(const char *nptr, char **endptr,
			       int base) {
  if (nptr && *nptr == '+')
    nptr++;
  return strtoul( nptr, endptr, base);
}

void epoc_gcvt( double x, int digits, unsigned char *buf) {
    TRealFormat trel;

    trel.iPlaces = digits;
    trel.iPoint = TChar( '.');

    TPtr result( buf, 80);

    result.Num( x, trel);
    result.Append( TChar( 0));
  }
}