Subversion Repositories shark

Rev

Rev 42 | 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
 
620 mauro 33
/* Added by Nino - Begin */
34
#define EXIT_MODE_HALT  0       /* End the system using the 'hlt' instruction. */
35
#define EXIT_MODE_COLD  1       /* End the system with a _cold_ reboot. */
36
#define EXIT_MODE_WARM  2       /* End the system with a _warm_ reboot. */
37
#define EXIT_MODE_REAL  3       /* End the system returning in real-mode. */
38
/* Added by Nino - End */
39
 
42 pj 40
#ifndef NULL
41
    #define NULL 0L
42
#endif
43
 
44
#define RAND_MAX        2147483647
45
 
46
/* String conversion functions          */
47
/* File: StrConv.C                      */
48
 
49
long strtoi(char *s,int base,char **scan_end);
50
unsigned long strtou(char *s,int base,char **scan_end);
51
double strtod(char *s,char **scan_end);
52
long strtol(const char *nptr, char **endptr, int base);
53
unsigned long strtoul(const char *nptr, char **endptr, int base);
54
 
55
 
56
unsigned ecvt(double v,char *buffer,int width,int prec,int flag);
57
unsigned fcvt(double v,char *buffer,int width,int prec,int flag);
58
unsigned gcvt(double v,char *buffer,int width,int prec,int flag);
59
unsigned dcvt(long v,char *buffer,int base,int width,int flag);
60
unsigned ucvt(unsigned long v,char *buffer,int base,int width,int flag);
61
 
62
 
63
/* StdLib Macro */
64
 
65
#define atof(s) strtod(s, NULL)
66
#define atoi(s) strtoi(s, 10, NULL)
67
#define atou(s) strtou(s, 10, NULL)
68
#define atol(s) strtol(s, 10, NULL)
69
 
70
/* Generic utility functions    */
71
/* File StdLib.C                */
72
 
73
void srand(long int seed);
74
long int rand(void);
75
unsigned abs(int x);
76
 
77
/* The stdlib exit functions */
78
void l1_exit(int code);
620 mauro 79
int  ll_set_reboot(int mode);
42 pj 80
 
81
/* Stdlib Macro */
82
#ifndef __WC16__
83
#define labs(x)         abs(x)
84
#endif
85
 
86
#if !defined(__max)
87
#define __max(a,b)  (((a) > (b)) ? (a) : (b))
88
#endif
89
#if !defined(max) && !defined(__cplusplus)
90
#define max(a,b)  (((a) > (b)) ? (a) : (b))
91
#endif
92
#if !defined(__min)
93
#define __min(a,b)  (((a) < (b)) ? (a) : (b))
94
#endif
95
#if !defined(min) && !defined(__cplusplus)
96
#define min(a,b)  (((a) < (b)) ? (a) : (b))
97
#endif
98
END_DEF
99
 
100
#endif