comparison druntime/import/core/stdc/stdlib.d @ 1458:e0b2d67cfe7c

Added druntime (this should be removed once it works).
author Robert Clipsham <robert@octarineparrot.com>
date Tue, 02 Jun 2009 17:43:06 +0100
parents
children
comparison
equal deleted inserted replaced
1456:7b218ec1044f 1458:e0b2d67cfe7c
1 /**
2 * D header file for C99.
3 *
4 * Copyright: Copyright Sean Kelly 2005 - 2009.
5 * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a>.
6 * Authors: Sean Kelly
7 * Standards: ISO/IEC 9899:1999 (E)
8 *
9 * Copyright Sean Kelly 2005 - 2009.
10 * Distributed under the Boost Software License, Version 1.0.
11 * (See accompanying file LICENSE_1_0.txt or copy at
12 * http://www.boost.org/LICENSE_1_0.txt)
13 */
14 module core.stdc.stdlib;
15
16 private import core.stdc.config;
17 public import core.stdc.stddef; // for size_t, wchar_t
18
19 extern (C):
20
21 struct div_t
22 {
23 int quot,
24 rem;
25 }
26
27 struct ldiv_t
28 {
29 int quot,
30 rem;
31 }
32
33 struct lldiv_t
34 {
35 long quot,
36 rem;
37 }
38
39 enum EXIT_SUCCESS = 0;
40 enum EXIT_FAILURE = 1;
41 enum RAND_MAX = 32767;
42 enum MB_CUR_MAX = 1;
43
44 double atof(in char* nptr);
45 int atoi(in char* nptr);
46 c_long atol(in char* nptr);
47 long atoll(in char* nptr);
48
49 double strtod(in char* nptr, char** endptr);
50 float strtof(in char* nptr, char** endptr);
51 real strtold(in char* nptr, char** endptr);
52 c_long strtol(in char* nptr, char** endptr, int base);
53 long strtoll(in char* nptr, char** endptr, int base);
54 c_ulong strtoul(in char* nptr, char** endptr, int base);
55 ulong strtoull(in char* nptr, char** endptr, int base);
56
57 int rand();
58 void srand(uint seed);
59
60 void* malloc(size_t size);
61 void* calloc(size_t nmemb, size_t size);
62 void* realloc(void* ptr, size_t size);
63 void free(void* ptr);
64
65 void abort();
66 void exit(int status);
67 int atexit(void function() func);
68 void _Exit(int status);
69
70 char* getenv(in char* name);
71 int system(in char* string);
72
73 void* bsearch(in void* key, in void* base, size_t nmemb, size_t size, int function(in void*, in void*) compar);
74 void qsort(void* base, size_t nmemb, size_t size, int function(in void*, in void*) compar);
75
76 int abs(int j);
77 c_long labs(c_long j);
78 long llabs(long j);
79
80 div_t div(int numer, int denom);
81 ldiv_t ldiv(c_long numer, c_long denom);
82 lldiv_t lldiv(long numer, long denom);
83
84 int mblen(in char* s, size_t n);
85 int mbtowc(wchar_t* pwc, in char* s, size_t n);
86 int wctomb(char*s, wchar_t wc);
87 size_t mbstowcs(wchar_t* pwcs, in char* s, size_t n);
88 size_t wcstombs(char* s, in wchar_t* pwcs, size_t n);
89
90 version( DigitalMars )
91 {
92 void* alloca(size_t size); // non-standard
93 }