gbdk-releases/gbdk-lib/include/stdlib.h

45 lines
1.1 KiB
C
Raw Permalink Normal View History

2015-01-10 16:25:08 +01:00
/** file stdlib.h
'Standard library' functions, for whatever that means.
*/
#ifndef STDLIB_INCLUDE
#define STDLIB_INCLUDE
2015-01-10 16:25:08 +01:00
#include <types.h>
2015-01-10 16:25:08 +01:00
/** Causes normal program termination and the value of status is
returned to the parent.
All open streams are flushed and closed.
*/
2015-01-10 16:25:08 +01:00
void exit(int status) NONBANKED;
2015-01-10 16:25:08 +01:00
#if 0
/** Compatibility function. Not implemented.
*/
2015-01-10 16:25:09 +01:00
int getkey(void);
2015-01-10 16:25:08 +01:00
#endif
2015-01-10 16:25:08 +01:00
/** Returns the absolute value of a int.
If i is negative, returns -i; else returns i.
*/
2015-01-10 16:25:09 +01:00
int abs(int i);
2015-01-10 16:25:08 +01:00
/** Returns the absolute value of a long.
*/
2015-01-10 16:25:09 +01:00
long labs(long num);
2015-01-10 16:25:08 +01:00
/** Converts an ASCII string to an int.
The string may be of the format [\s]*[+-][\d]+[\D]* i.e. any number
of spaces, an optional + or -, then an arbitrary number of digits.
The result is undefined if the number doesnt fit in an int.
*/
2015-01-10 16:25:09 +01:00
int atoi(const char *s);
2015-01-10 16:25:08 +01:00
/** Converts an ASCII string to a long.
*/
2015-01-10 16:25:09 +01:00
long atol(const char *s);
2015-01-10 16:25:08 +01:00
/** Converts an int into a base 10 ASCII string.
*/
2015-01-10 16:25:09 +01:00
char *itoa(int n, char *s);
2015-01-10 16:25:08 +01:00
/** Converts a long into a base 10 ASCII string.
*/
2015-01-10 16:25:09 +01:00
char *ltoa(long n, char *s);
2015-01-10 16:25:08 +01:00
2015-01-10 16:25:08 +01:00
#endif