#include <xr/BasicTypes.h>
#include <xr/Threads.h>
#include <xr/sMisc.h>
#include <xr/UIOBasic.h>

XR←Fildes
XR←Open4(name, flags, mode, kind)
char *name;
unsigned flags;
unsigned mode;
XR←FDKind kind;
{
	return XR←Open(name, flags, mode);
}

XR←Fildes
XR←Open(name, flags, mode)
{
 	return(open(name, flags, mode));
}

int
XR←FCntl4(fildes, cmd, arg, kind)
XR←Fildes fildes;
int cmd;
int arg;
XR←FDKind kind;
{
	return XR←FCntl(fildes, cmd, arg);
}

int
XR←IOCtl4(d, request, argp, kind)
XR←Fildes d;
int request;
char *argp;
XR←FDKind kind;
{
	return XR←IOCtl(d, request, argp, kind);
}

XR←FDKind
XR←GetDescriptorKind (fildes)
    XR←Fildes fildes;
{
	return XR←FD←KIND←STD;
}

int
XR←SetBlocking (fildes, blocking)
    XR←Fildes fildes;
    XR←UIOBlocking blocking;
{
	SPCR←NotImplemented("XR←SetBlocking");
	return 0;
}

int
XR←SetGetTimeout (fildes, timeout)
    XR←Fildes fildes;
    XR←Ticks timeout;
{
	SPCR←NotImplemented("XR←SetGetTimeout");
	return 0;
}

int
XR←SetPutTimeout (fildes, timeout)
    XR←Fildes fildes;
    XR←Ticks timeout;
{
	SPCR←NotImplemented("XR←SetGetTimeout");
	return 0;
}

int
XR←UIORegisterInterestInEvent(id, interested)
    int id;
    bool interested;
{
    SPCR←NotImplemented("XR←UIORegisterInterestInEvent");
    return 0;
}

int
XR←UIOAwaitEvent(event)
int event;
{
    SPCR←NotImplemented("XR←UIOAwaitEvent");
    return 0;
}


/*
 * What follows is not type correct, and not terribly portable.
 * But it's more portable then the assembly language hack it replaces.
 * Note that UIO.h is NOT included here.
 */

#ifdef ←←STDC←←
#   define ADD←XR(pcrName)  XR← ## pcrName
#else
#   define ADD←XR(pcrName)  XR←/**/pcrName
#endif

# define XR←SYSCALL0(pcrName, uxname) \
	int ADD←XR(pcrName) () { uxname(); }
	
# define XR←SYSCALL1(pcrName, uxname) \
	int ADD←XR(pcrName) (a1) int a1; { uxname(a1); }

# define XR←SYSCALL2(pcrName, uxname) \
	int ADD←XR(pcrName) (a1,a2) int a1,a2; { uxname(a1,a2); }

# define XR←SYSCALL3(pcrName, uxname) \
	int ADD←XR(pcrName) (a1,a2,a3) int a1,a2,a3; { uxname(a1,a2,a3); }

# define XR←SYSCALL4(pcrName, uxname) \
	int ADD←XR(pcrName) (a1,a2,a3,a4) int a1,a2,a3,a4; \
	{ uxname(a1,a2,a3,a4); }

# define XR←SYSCALL5(pcrName, uxname) \
	int ADD←XR(pcrName) (a1,a2,a3,a4,a5) int a1,a2,a3,a4,a5; \
	{ uxname(a1,a2,a3,a4,a5); }
	
# define XR←SYSCALL6(pcrName, uxname) \
	int ADD←XR(pcrName) (a1,a2,a3,a4,a5,a6) int a1,a2,a3,a4,a5,a6; \
	{ uxname(a1,a2,a3,a4,a5,a6); }

# include "xr/UnixSysCallTranslation.h"