OpenCores
URL https://opencores.org/ocsvn/thor/thor/trunk

Subversion Repositories thor

[/] [thor/] [trunk/] [software/] [c64libc/] [source/] [stdlib.h] - Blame information for rev 22

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 22 robfinch
#ifndef _STDLIB
2
#define _STDLIB
3
#ifndef _YVALS
4
#include <yvals.h>
5
#endif
6
 
7
 
8
#define NULL    _NULL
9
#define EXIT_FAILURE    _EXFAIL
10
#define EXIT_SUCCESS    0
11
#define MB_CUR_MAX              _Mbcurmax
12
#define RAND_MAX                32767
13
 
14
#ifndef _SIZET
15
#define _SIZET
16
typedef _Sizet size_t;
17
#endif
18
#ifndef _WCHART
19
#define _WCHART
20
// wchar_t is a type in C64
21
//typedef _Wchart wchar_t;
22
#endif
23
typedef struct {
24
        int quot;
25
        int rem;
26
} div_t;
27
typedef struct {
28
        long quot;
29
        long rem;
30
} ldiv_t;
31
typedef int _Cmpfun(const void *, const void *);
32
typedef struct {
33
        unsigned char _State;
34
        unsigned short _Wchar;
35
} _Mbsave;
36
 
37
 
38
void abort(void);
39
int abs(int);
40
int atexit(void (*)(void));
41
double atof(const char *);
42
int atoi(const char *);
43
long atol(const char *);
44
void bsearch(const void *, const void *, size_t, size_t, _Cmpfun *);
45
void *calloc(size_t, size_t);
46
div_t div(int, int);
47
void exit(int);
48
void free(void *);
49
char *getenv(const char *);
50
long labs(long);
51
ldiv_t ldiv(long, long);
52
void *malloc(size_t);
53
int mblen(const char *, size_t);
54
size_t mbstowcs(wchar_t *,  const char *, size_t);
55
int mbtowc(wchar_t *, const char *, size_t);
56
 
57
//void qsort(void *, size_t, size_t, _Cmpfun *);
58
 
59
int rand(int);
60
void *realloc(void *, size_t);
61
void srand(unsigned int);
62
double strtod(const char *, char **);
63
long strtol(const char *, char **, int);
64
unsigned long strtoul(const char *, char **, int);
65
int system(const char *);
66
size_t wcstombs(char *, const wchar_t *, size_t);
67
int wctomb(char *, wchar_t);
68
int _Mbtowc(wchar_t *, const char *, size_t, _Mbsave *);
69
double _Stod(const char *, char **);
70
unsigned long _Stoul(const char *, char **, int);
71
int _Wctomb(char *, wchar_t, char *);
72
extern char _Mbcurmax, _Wcxtomb;
73
extern _Mbsave _Mbxlen, _Mbxtowc;
74
extern unsigned long _Randseed;
75
 
76
#define atof(s) _Stod(s, 0)
77
#define atoi(s) (int)_Stoul(s,0,10)
78
#define atol(s) (long)_Stoul(s,0,10)
79
#define mblen(s,n)      _Mbtowc(0,s,n,&_Mbxlen)
80
#define mbtowc(pwc,s,n) _Mbtowc(pwc,s,n,&_Mbxtowc)
81
#define srand(seed)     (void)(_Randseed = (seed))
82
#define strtod(s,endptr)        _Stod(s, endptr)
83
#define strtoul(s, endptr, base)        _Stoul(s,endptr,base)
84
#define wctomb(s,wchar) _Wctomb(s,wchar,&_Wcxtomb)
85
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.