Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
Port types, add version(X86) blocks, and start fixing fpos_t
Browse files Browse the repository at this point in the history
  • Loading branch information
Joakim committed Feb 28, 2014
1 parent ba98ced commit e5e8b22
Show file tree
Hide file tree
Showing 3 changed files with 117 additions and 11 deletions.
25 changes: 16 additions & 9 deletions src/core/stdc/fenv.d
Expand Up @@ -116,17 +116,24 @@ else version ( FreeBSD )
}
else version( Android )
{
struct fenv_t
version(X86)
{
ushort __control;
ushort __mxcsr_hi;
ushort __status;
ushort __mxcsr_lo;
uint __tag;
byte[16] __other;
struct fenv_t
{
ushort __control;
ushort __mxcsr_hi;
ushort __status;
ushort __mxcsr_lo;
uint __tag;
byte[16] __other;
}

alias ushort fexcept_t;
}
else
{
static assert(false, "Architecture not supported.");
}

alias ushort fexcept_t;
}
else
{
Expand Down
12 changes: 10 additions & 2 deletions src/core/stdc/stdio.d
Expand Up @@ -26,6 +26,10 @@ private
{
import core.sys.posix.sys.types;
}
else version (Android)
{
import core.sys.posix.sys.types;
}
}

extern (C):
Expand Down Expand Up @@ -235,6 +239,8 @@ else version( linux )
}
else version( OSX )
{
alias int fpos_t;

align (1) struct _iobuf
{
ubyte* _p;
Expand Down Expand Up @@ -265,6 +271,8 @@ else version( OSX )
}
else version( FreeBSD )
{
alias int fpos_t;

align (1) struct _iobuf
{
ubyte* _p;
Expand Down Expand Up @@ -319,6 +327,8 @@ else version (Solaris)
}
else version( Android )
{
alias off_t fpos_t;

align(1) struct _iobuf
{
ubyte* _p;
Expand Down Expand Up @@ -515,8 +525,6 @@ else
static assert( false, "Unsupported platform" );
}

alias int fpos_t;

int remove(in char* filename);
int rename(in char* from, in char* to);

Expand Down
91 changes: 91 additions & 0 deletions src/core/sys/posix/sys/types.d
Expand Up @@ -176,6 +176,28 @@ else version (Solaris)
alias c_long time_t;
alias uint uid_t;
}
else version( Android )
{
version(X86)
{
alias ulong blkcnt_t;
alias ulong blksize_t;
alias uint dev_t;
alias uint gid_t;
alias ulong ino_t;
alias ushort mode_t;
alias ushort nlink_t;
alias long off_t;
alias int pid_t;
alias long ssize_t;
alias long time_t;
alias uint uid_t;
}
else
{
static assert(false, "Architecture not supported.");
}
}
else
{
static assert(false, "Unsupported platform");
Expand Down Expand Up @@ -257,6 +279,23 @@ else version (Solaris)
alias id_t zoneid_t;
alias id_t ctid_t;
}
else version( Android )
{
version(X86)
{
alias ulong fsblkcnt_t;
alias ulong fsfilcnt_t;
alias long clock_t;
alias uint id_t;
alias int key_t;
alias long suseconds_t;
alias long useconds_t;
}
else
{
static assert(false, "Architecture not supported.");
}
}
else
{
static assert(false, "Unsupported platform");
Expand Down Expand Up @@ -688,6 +727,55 @@ else version (Solaris)

alias uint pthread_key_t;
}
else version( Android )
{
version(X86)
{
struct pthread_attr_t
{
uint flags;
void* stack_base;
size_t stack_size;
size_t guard_size;
int sched_policy;
int sched_priority;
}
}
else
{
static assert(false, "Architecture not supported.");
}

struct pthread_cond_t
{
int value; //volatile
}

alias long pthread_condattr_t;
alias int pthread_key_t;

struct pthread_mutex_t
{
int value; //volatile
}

alias long pthread_mutexattr_t;
alias int pthread_once_t; //volatile

struct pthread_rwlock_t
{
pthread_mutex_t lock;
pthread_cond_t cond;
int numLocks;
int writerThreadId;
int pendingReaders;
int pendingWriters;
void*[4] reserved;
}

alias int pthread_rwlockattr_t;
alias long pthread_t;
}
else
{
static assert(false, "Unsupported platform");
Expand Down Expand Up @@ -740,6 +828,9 @@ else version (Solaris)
void* __pthread_barrierattrp;
}
}
else version( Android )
{
}
else
{
static assert(false, "Unsupported platform");
Expand Down

0 comments on commit e5e8b22

Please sign in to comment.