diff --git a/headers/posix/alloca.h b/headers/posix/alloca.h new file mode 100644 index 0000000000..cf8ee8b302 --- /dev/null +++ b/headers/posix/alloca.h @@ -0,0 +1,28 @@ +#ifndef _ALLOCA_H +#define _ALLOCA_H +/* +** Distributed under the terms of the OpenBeOS License. +*/ + + +#include + + +#undef __alloca +#undef alloca + +#ifdef __cplusplus +extern "C" { +#endif + +extern void * __alloca (size_t __size); +extern void * alloca (size_t __size); + +#ifdef __cplusplus +} +#endif + +#define __alloca(size) __builtin_alloca (size) +#define alloca(size) __alloca (size) + +#endif /* _ALLOCA_H */ diff --git a/headers/posix/iconv.h b/headers/posix/iconv.h new file mode 100644 index 0000000000..eec66af28b --- /dev/null +++ b/headers/posix/iconv.h @@ -0,0 +1,24 @@ +#ifndef _ICONV_H_ +#define _ICONV_H_ +/* +** Distributed under the terms of the OpenBeOS License. +*/ + + +typedef void *iconv_t; + + +#ifdef __cplusplus +extern "C" { +#endif + +extern iconv_t iconv_open(const char *toCode, const char *fromCode); +extern int iconv_close(iconv_t cd); +extern size_t iconv(iconv_t cd, char **inBuffer, size_t *inBytesLeft, + char **outBuffer, size_t *outBytesLeft); + +#ifdef __cplusplus +} +#endif + +#endif /* _ICONV_H_ */ diff --git a/headers/posix/inttypes.h b/headers/posix/inttypes.h index fe34172680..9f2ec3dc9a 100644 --- a/headers/posix/inttypes.h +++ b/headers/posix/inttypes.h @@ -5,15 +5,29 @@ */ -typedef signed char int8_t; -typedef signed short int int16_t; -typedef signed int int32_t; -typedef signed long long int64_t; +#include -typedef unsigned char u_int8_t; -typedef unsigned short int u_int16_t; -typedef unsigned int u_int32_t; -typedef unsigned long long u_int64_t; +typedef struct { + intmax_t quot; /* quotient */ + intmax_t rem; /* remainder */ +} imaxdiv_t; + + +#ifdef __cplusplus +extern "C" { +#endif + +extern intmax_t imaxabs(intmax_t num); +extern imaxdiv_t imaxdiv(intmax_t numer, intmax_t denom); + +extern intmax_t strtoimax(const char *, char **, int); +extern uintmax_t strtoumax(const char *, char **, int); +//extern intmax_t wcstoimax(const __wchar_t *, __wchar_t **, int); +//extern uintmax_t wcstoumax(const __wchar_t *, __wchar_t **, int); + +#ifdef __cplusplus +} +#endif #endif /* _INTTYPES_H_ */ diff --git a/headers/posix/nl_types.h b/headers/posix/nl_types.h new file mode 100644 index 0000000000..35857a652f --- /dev/null +++ b/headers/posix/nl_types.h @@ -0,0 +1,26 @@ +#ifndef _NL_TYPES_H_ +#define _NL_TYPES_H_ +/* +** Distributed under the terms of the OpenBeOS License. +*/ + + +#define NL_SETD 0 +#define NL_CAT_LOCALE 1 + +typedef int nl_item; +typedef void *nl_catd; + +#ifdef __cplusplus +extern "C" { +#endif + +extern nl_catd catopen(const char *name, int oflag); +extern char *catgets(nl_catd cat, int setID, int msgID, const char *defaultMessage); +extern int catclose(nl_catd cat); + +#ifdef __cplusplus +} +#endif + +#endif /* _NL_TYPES_H_ */ diff --git a/headers/posix/stddef.h b/headers/posix/stddef.h index 9ce4fd7a5b..3522d04b6f 100644 --- a/headers/posix/stddef.h +++ b/headers/posix/stddef.h @@ -3,6 +3,7 @@ // XXX Doesn't belong into posix, should be replaced as soon as possible #include +#include #if (!defined(_STDDEF_H) && !defined(_STDDEF_H_) && !defined(_ANSI_STDDEF_H) \ && !defined(__STDDEF_H__)) \ diff --git a/headers/posix/stdint.h b/headers/posix/stdint.h new file mode 100644 index 0000000000..ad26836f06 --- /dev/null +++ b/headers/posix/stdint.h @@ -0,0 +1,30 @@ +#ifndef _STDINT_H_ +#define _STDINT_H_ +/* +** Distributed under the terms of the OpenBeOS License. +*/ + +typedef unsigned char uint8_t; +typedef signed char int8_t; + +typedef unsigned short uint16_t; +typedef signed short int16_t; + +typedef unsigned long uint32_t; +typedef signed long int32_t; + +typedef unsigned long long uint64_t; +typedef signed long long int64_t; + +typedef unsigned long long uintmax_t; +typedef signed long long intmax_t; + +// ToDo: add "least" and "fast" types + +/* BSD compatibility */ +typedef uint8_t u_int8_t; +typedef uint16_t u_int16_t; +typedef uint32_t u_int32_t; +typedef uint64_t u_int64_t; + +#endif /* _STDINT_H_ */ diff --git a/headers/posix/stdlib.h b/headers/posix/stdlib.h index 0c95782d69..b910af1318 100644 --- a/headers/posix/stdlib.h +++ b/headers/posix/stdlib.h @@ -9,6 +9,7 @@ #include #include #include +#include #define RAND_MAX 0x7fffffff diff --git a/headers/posix/sys/stat.h b/headers/posix/sys/stat.h index 53d5bcedde..16411f9ad0 100644 --- a/headers/posix/sys/stat.h +++ b/headers/posix/sys/stat.h @@ -17,6 +17,7 @@ struct stat { gid_t st_gid; /* group id of the owner of this file */ off_t st_size; /* size in bytes of this file */ // ToDo: st_type is new for OpenBeOS - it replaces the unused st_rdev field + // we might also define special types for files and TTYs unsigned int st_type; /* attribute/index type */ //dev_t st_rdev; /* device type (not used) */ size_t st_blksize; /* preferred block size for i/o */ diff --git a/headers/posix/wchar_t.h b/headers/posix/wchar_t.h index e3849542ab..0925cb33cc 100644 --- a/headers/posix/wchar_t.h +++ b/headers/posix/wchar_t.h @@ -9,4 +9,13 @@ typedef unsigned short wchar_t; -#endif +#define _WINT_T +typedef unsigned int wint_t; + +typedef struct { + int __count; + wint_t __value; +} mbstate_t; + +#endif /* _WCHAR_T_H */ +