diff --git a/inc/crt/android/stdio.bi b/inc/crt/android/stdio.bi new file mode 100644 index 0000000000..ce53fb5fbc --- /dev/null +++ b/inc/crt/android/stdio.bi @@ -0,0 +1,79 @@ +'' Based on the android NDK r8e header + +#ifndef __crt_android_stdio_bi__ +#define __crt_android_stdio_bi__ + +extern "C" + +#ifdef __FB_64BIT__ +#define __LP64__ +#endif + +#define _IOFBF 0 +#define _IOLBF 1 +#define _IONBF 2 +#define BUFSIZ 1024 +#define FILENAME_MAX 1024 +#define FOPEN_MAX 20 +#define P_tmpdir "/tmp/" +#define L_tmpnam 1024 +#define TMP_MAX 308915776 + +type fpos_t as clong + +#if defined(__LP64__) +type __sbuf + _base as ubyte ptr + _size as size_t +end type +#else +type __sbuf + _base as ubyte ptr + _size as long +end type +#endif + +type FILE + _p as ubyte ptr + _r as long + _w as long +#if defined(__LP64__) + _flags as long + _file as long +#else + _flags as short + _file as short +#endif + _bf as __sbuf + _lbfsize as long + _cookie as any ptr + _close as function(byval as any ptr) as long + _read as function(byval as any ptr, byval as zstring ptr, byval as long) as long + _seek as function(byval as any ptr, byval as fpos_t, byval as long) as fpos_t + _write as function(byval as any ptr, byval as const zstring ptr, byval as long) as long + _ext as __sbuf + _up as ubyte ptr + _ur as long + _ubuf(0 to 2) as ubyte + _nbuf(0 to 0) as ubyte + _lb as __sbuf + _blksize as long + _offset as fpos_t +end type + +extern __sF(0 to 2) as FILE + +#define stdin (@__sF(0)) +#define stdout (@__sF(1)) +#define stderr (@__sF(2)) + +declare function snprintf (byval s as zstring ptr, byval n as size_t, byval format as zstring ptr, ...) as long +declare function vsnprintf (byval s as zstring ptr, byval n as size_t, byval format as zstring ptr, byval arg as va_list) as long +declare function popen (byval as zstring ptr, byval as zstring ptr) as FILE ptr +declare function pclose (byval as FILE ptr) as long +declare function getw (byval as FILE ptr) as long +declare function putw (byval as long, byval as FILE ptr) as long + +end extern + +#endif diff --git a/inc/crt/stdio.bi b/inc/crt/stdio.bi index d334276453..5bf1c6ed26 100644 --- a/inc/crt/stdio.bi +++ b/inc/crt/stdio.bi @@ -27,6 +27,8 @@ #include once "crt/dos/stdio.bi" #elseif defined(__FB_LINUX__) #include once "crt/linux/stdio.bi" +#elseif defined(__FB_ANDROID__) +#include once "crt/android/stdio.bi" #elseif defined(__FB_FREEBSD__) #include once "crt/freebsd/stdio.bi" #elseif defined(__FB_DARWIN__) diff --git a/inc/crt/sys/types.bi b/inc/crt/sys/types.bi index b3d02405e4..ea93a4ea35 100644 --- a/inc/crt/sys/types.bi +++ b/inc/crt/sys/types.bi @@ -15,7 +15,7 @@ #include once "crt/sys/win32/types.bi" #elseif defined(__FB_DOS__) #include once "crt/sys/dos/types.bi" -#elseif defined(__FB_LINUX__) +#elseif defined(__FB_LINUX__) or defined(__FB_ANDROID__) #include once "crt/sys/linux/types.bi" #elseif defined(__FB_FREEBSD__) #include once "crt/sys/freebsd/types.bi" diff --git a/inc/crt/time.bi b/inc/crt/time.bi index e84e345412..dcdd41663d 100644 --- a/inc/crt/time.bi +++ b/inc/crt/time.bi @@ -16,7 +16,7 @@ #include once "crt/win32/time.bi" #elseif defined(__FB_DOS__) #include once "crt/dos/time.bi" -#elseif defined(__FB_LINUX__) +#elseif defined(__FB_LINUX__) or defined(__FB_ANDROID__) #include once "crt/linux/time.bi" #elseif defined(__FB_FREEBSD__) #include once "crt/freebsd/time.bi" diff --git a/inc/crt/wchar.bi b/inc/crt/wchar.bi index 22991de751..e3bf8b9fd3 100644 --- a/inc/crt/wchar.bi +++ b/inc/crt/wchar.bi @@ -18,7 +18,7 @@ #if defined(__FB_WIN32__) #include once "crt/win32/wchar.bi" -#elseif defined(__FB_LINUX__) +#elseif defined(__FB_LINUX__) or defined(__FB_ANDROID__) #include once "crt/linux/wchar.bi" #elseif defined(__FB_FREEBSD__) #include once "crt/freebsd/wchar.bi"