Rev 42 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
42 | pj | 1 | /* Project: OSLib |
2 | * Description: The OS Construction Kit |
||
3 | * Date: 1.6.2000 |
||
4 | * Idea by: Luca Abeni & Gerardo Lamastra |
||
5 | * |
||
6 | * OSLib is an SO project aimed at developing a common, easy-to-use |
||
7 | * low-level infrastructure for developing OS kernels and Embedded |
||
8 | * Applications; it partially derives from the HARTIK project but it |
||
9 | * currently is independently developed. |
||
10 | * |
||
11 | * OSLib is distributed under GPL License, and some of its code has |
||
12 | * been derived from the Linux kernel source; also some important |
||
13 | * ideas come from studying the DJGPP go32 extender. |
||
14 | * |
||
15 | * We acknowledge the Linux Community, Free Software Foundation, |
||
16 | * D.J. Delorie and all the other developers who believe in the |
||
17 | * freedom of software and ideas. |
||
18 | * |
||
19 | * For legalese, check out the included GPL license. |
||
20 | */ |
||
21 | |||
22 | /* Standard library for OSLib applications */ |
||
23 | |||
24 | #ifndef __LL_I386_STDLIB_H__ |
||
25 | #define __LL_I386_STDLIB_H__ |
||
26 | |||
27 | #include <ll/i386/defs.h> |
||
28 | BEGIN_DEF |
||
29 | |||
30 | #define EXIT_FAILURE 1 /* Failing exit status. */ |
||
31 | #define EXIT_SUCCESS 0 /* Successful exit status. */ |
||
32 | |||
33 | #ifndef NULL |
||
34 | #define NULL 0L |
||
35 | #endif |
||
36 | |||
37 | #define RAND_MAX 2147483647 |
||
38 | |||
39 | /* String conversion functions */ |
||
40 | /* File: StrConv.C */ |
||
41 | |||
42 | long strtoi(char *s,int base,char **scan_end); |
||
43 | unsigned long strtou(char *s,int base,char **scan_end); |
||
44 | double strtod(char *s,char **scan_end); |
||
45 | long strtol(const char *nptr, char **endptr, int base); |
||
46 | unsigned long strtoul(const char *nptr, char **endptr, int base); |
||
47 | |||
48 | |||
49 | unsigned ecvt(double v,char *buffer,int width,int prec,int flag); |
||
50 | unsigned fcvt(double v,char *buffer,int width,int prec,int flag); |
||
51 | unsigned gcvt(double v,char *buffer,int width,int prec,int flag); |
||
52 | unsigned dcvt(long v,char *buffer,int base,int width,int flag); |
||
53 | unsigned ucvt(unsigned long v,char *buffer,int base,int width,int flag); |
||
54 | |||
55 | |||
56 | /* StdLib Macro */ |
||
57 | |||
58 | #define atof(s) strtod(s, NULL) |
||
59 | #define atoi(s) strtoi(s, 10, NULL) |
||
60 | #define atou(s) strtou(s, 10, NULL) |
||
61 | #define atol(s) strtol(s, 10, NULL) |
||
62 | |||
63 | /* Generic utility functions */ |
||
64 | /* File StdLib.C */ |
||
65 | |||
66 | void srand(long int seed); |
||
67 | long int rand(void); |
||
68 | unsigned abs(int x); |
||
69 | |||
70 | /* The stdlib exit functions */ |
||
71 | void l1_exit(int code); |
||
72 | |||
73 | |||
74 | /* Stdlib Macro */ |
||
75 | #ifndef __WC16__ |
||
76 | #define labs(x) abs(x) |
||
77 | #endif |
||
78 | |||
79 | #if !defined(__max) |
||
80 | #define __max(a,b) (((a) > (b)) ? (a) : (b)) |
||
81 | #endif |
||
82 | #if !defined(max) && !defined(__cplusplus) |
||
83 | #define max(a,b) (((a) > (b)) ? (a) : (b)) |
||
84 | #endif |
||
85 | #if !defined(__min) |
||
86 | #define __min(a,b) (((a) < (b)) ? (a) : (b)) |
||
87 | #endif |
||
88 | #if !defined(min) && !defined(__cplusplus) |
||
89 | #define min(a,b) (((a) < (b)) ? (a) : (b)) |
||
90 | #endif |
||
91 | END_DEF |
||
92 | |||
93 | #endif |