Skip to content

Commit

Permalink
WIP Android crt/ include files
Browse files Browse the repository at this point in the history
  • Loading branch information
rversteegen authored and jayrm committed Jan 2, 2024
1 parent 0d68ffd commit 852d535
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 3 deletions.
79 changes: 79 additions & 0 deletions 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
2 changes: 2 additions & 0 deletions inc/crt/stdio.bi
Expand Up @@ -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__)
Expand Down
2 changes: 1 addition & 1 deletion inc/crt/sys/types.bi
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion inc/crt/time.bi
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion inc/crt/wchar.bi
Expand Up @@ -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"
Expand Down

0 comments on commit 852d535

Please sign in to comment.