Compare commits
No commits in common. "2230ebd969d2af796db16fc72fa1daf31d8ae0c8" and "2eeef9581f08b972c2ae9ef37bebca032f56f07f" have entirely different histories.
2230ebd969
...
2eeef9581f
@ -4,76 +4,33 @@
|
|||||||
/* The last error encountered during a call to a library or system function. */
|
/* The last error encountered during a call to a library or system function. */
|
||||||
extern int errno;
|
extern int errno;
|
||||||
|
|
||||||
#define EPERM 1 // Operation not permitted
|
#define EPERM 1 // Operation not permitted
|
||||||
#define ENOENT 2 // No such file or directory
|
#define ENOENT 2 // No such file or directory
|
||||||
#define ESRCH 3 // No such process
|
#define ESRCH 3 // No such process
|
||||||
#define EINTR 4 // Interrupted system call. Not implemented.
|
#define EINTR 4 // Interrupted system call. Not implemented.
|
||||||
#define EIO 5 // Input/output error. Not implemented.
|
#define EIO 5 // Input/output error. Not implemented.
|
||||||
#define ENXIO 6 // No such device or address. Not implemented.
|
#define E2BIG 7 // Argument list too long
|
||||||
#define E2BIG 7 // Argument list too long
|
#define ENOEXEC 8 // Exec format error
|
||||||
#define ENOEXEC 8 // Exec format error
|
#define EBADF 9 // Bad file descriptor
|
||||||
#define EBADF 9 // Bad file descriptor
|
#define ECHILD 10 // No child processes
|
||||||
#define ECHILD 10 // No child processes
|
#define EAGAIN 11 // Resource temporarily unavailable
|
||||||
#define EAGAIN 11 // Resource temporarily unavailable
|
#define ENOMEM 12 // Cannot allocate memory
|
||||||
#define EWOULDBLOCK 11 // Resource temporarily unavailable
|
#define EACCES 13 // Permission denied
|
||||||
#define ENOMEM 12 // Cannot allocate memory
|
#define EFAULT 14 // Bad address
|
||||||
#define EACCES 13 // Permission denied
|
#define EEXIST 17 // File exists
|
||||||
#define EFAULT 14 // Bad address
|
#define ENOTDIR 20 // Not a directory
|
||||||
#define EBUSY 16 // Device or resource busy. Not implemented.
|
#define EISDIR 21 // Is a directory
|
||||||
#define EEXIST 17 // File exists
|
#define EINVAL 22 // Invalid argument
|
||||||
#define EXDEV 18 // Invalid cross-device link. Not implemented.
|
#define EMFILE 24 // Too many open files
|
||||||
#define ENODEV 19 // No such device. Not implemented.
|
#define ENOTTY 25 // Inappropriate ioctl for device
|
||||||
#define ENOTDIR 20 // Not a directory
|
#define EFBIG 27 // File too large. Not implemented.
|
||||||
#define EISDIR 21 // Is a directory
|
#define ENOSPC 28 // No space left on device
|
||||||
#define EINVAL 22 // Invalid argument
|
#define EPIPE 32 // Broken pipe. Not implemented.
|
||||||
#define ENFILE 23 // Too many open files in system. Not implemented.
|
#define EDOM 33 // Numerical argument out of domain. Not implemented.
|
||||||
#define EMFILE 24 // Too many open files
|
#define ERANGE 34 // Numerical result out of range
|
||||||
#define ENOTTY 25 // Inappropriate ioctl for device
|
#define ENOSYS 38 // Function not implemented
|
||||||
#define EFBIG 27 // File too large. Not implemented.
|
#define ENOTSUP 95 // Operation not supported
|
||||||
#define ENOSPC 28 // No space left on device
|
#define EOPNOTSUPP 95 // Operation not supported
|
||||||
#define ESPIPE 29 // Illegal seek. Not implemented.
|
|
||||||
#define EROFS 30 // Read-only file system. Not implemented.
|
|
||||||
#define EMLINK 31 // Too many links. Not implemented.
|
|
||||||
#define EPIPE 32 // Broken pipe. Not implemented.
|
|
||||||
#define EDOM 33 // Numerical argument out of domain. Not implemented.
|
|
||||||
#define ERANGE 34 // Numerical result out of range
|
|
||||||
#define EDEADLK 35 // Resource deadlock avoided. Not implemented.
|
|
||||||
#define ENAMETOOLONG 36 // File name too long. Not implemented.
|
|
||||||
#define ENOLCK 37 // No locks available. Not implemented.
|
|
||||||
#define ENOSYS 38 // Function not implemented
|
|
||||||
#define ENOTEMPTY 39 // Directory not empty. Not implemented.
|
|
||||||
#define ELOOP 40 // Too many levels of symbolic links. Not implemented.
|
|
||||||
#define ENOMSG 42 // No message of desired type. Not implemented.
|
|
||||||
#define EILSEQ 84 // Invalid or incomplete multibyte or wide character. Not implemented.
|
|
||||||
#define ENOTSOCK 88 // Socket operation on non-socket. Not implemented.
|
|
||||||
#define ENOTSUP 95 // Operation not supported
|
|
||||||
#define EOPNOTSUPP 95 // Operation not supported
|
|
||||||
#define EADDRINUSE 98 // Address already in use. Not implemented.
|
|
||||||
#define ENETRESET 102 // Network dropped connection on reset. Not implemented.
|
|
||||||
#define ECONNRESET 104 // Connection reset by peer. Not implemented.
|
|
||||||
#define EISCONN 106 // Transport endpoint is already connected. Not implemented.
|
|
||||||
#define ETIMEDOUT 110 // Connection timed out. Not implemented.
|
|
||||||
#define EALREADY 114 // Operation already in progress. Not implemented.
|
|
||||||
|
|
||||||
// FIXME: Right now I don't want to have to order and label these, since we have no net support anyways.
|
|
||||||
#define EADDRNOTAVAIL -1
|
|
||||||
#define EAFNOSUPPORT -1
|
|
||||||
#define ECONNABORTED -1
|
|
||||||
#define ECONNREFUSED -1
|
|
||||||
#define EDESTADDRREQ -1
|
|
||||||
#define EHOSTUNREACH -1
|
|
||||||
#define EINPROGRESS -1
|
|
||||||
#define EMSGSIZE -1
|
|
||||||
#define ENETDOWN -1
|
|
||||||
#define ENETRESET -1
|
|
||||||
#define ENETUNREACH -1
|
|
||||||
#define ENOBUFS -1
|
|
||||||
#define ENOMSG -1
|
|
||||||
#define ENOPROTOOPT -1
|
|
||||||
#define ENOTCONN -1
|
|
||||||
#define ENOTSOCK -1
|
|
||||||
#define EPROTONOSUPPORT -1
|
|
||||||
#define EPROTOTYPE -1
|
|
||||||
|
|
||||||
#ifdef _GNU_SOURCE // Give it only to programs that ask for it.
|
#ifdef _GNU_SOURCE // Give it only to programs that ask for it.
|
||||||
/* Name used to invoke calling program. Same value as argv[0] in main(), but can be used globally. */
|
/* Name used to invoke calling program. Same value as argv[0] in main(), but can be used globally. */
|
||||||
|
@ -4,7 +4,6 @@
|
|||||||
#define LC_ALL 0
|
#define LC_ALL 0
|
||||||
#define LC_CTYPE 1
|
#define LC_CTYPE 1
|
||||||
#define LC_COLLATE 2
|
#define LC_COLLATE 2
|
||||||
#define LC_NUMERIC 3
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
|
@ -1,83 +0,0 @@
|
|||||||
#ifndef _MATH_H
|
|
||||||
#define _MATH_H
|
|
||||||
|
|
||||||
typedef float float_t;
|
|
||||||
typedef double double_t;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
|
|
||||||
double cos(double val);
|
|
||||||
float cosf(float val);
|
|
||||||
long double cosl(long double val);
|
|
||||||
double sin(double val);
|
|
||||||
float sinf(float val);
|
|
||||||
long double sinl(long double val);
|
|
||||||
double tan(double val);
|
|
||||||
float tanf(float val);
|
|
||||||
long double tanl(long double val);
|
|
||||||
double acos(double val);
|
|
||||||
float acosf(float val);
|
|
||||||
long double acosl(long double val);
|
|
||||||
double asin(double val);
|
|
||||||
float asinf(float val);
|
|
||||||
long double asinl(long double val);
|
|
||||||
double atan(double val);
|
|
||||||
float atanf(float val);
|
|
||||||
long double atanl(long double val);
|
|
||||||
double cosh(double val);
|
|
||||||
float coshf(float val);
|
|
||||||
long double coshl(long double val);
|
|
||||||
double sinh(double val);
|
|
||||||
float sinhf(float val);
|
|
||||||
long double sinhl(long double val);
|
|
||||||
double tanh(double val);
|
|
||||||
float tanhf(float val);
|
|
||||||
long double tanhl(long double val);
|
|
||||||
double log(double val);
|
|
||||||
float logf(float val);
|
|
||||||
long double logl(long double val);
|
|
||||||
double exp(double val);
|
|
||||||
float expf(float val);
|
|
||||||
long double expl(long double val);
|
|
||||||
double sqrt(double val);
|
|
||||||
float sqrtf(float val);
|
|
||||||
long double sqrtl(long double val);
|
|
||||||
double fabs(double val);
|
|
||||||
float fabsf(float val);
|
|
||||||
long double fabsl(long double val);
|
|
||||||
double floor(double val);
|
|
||||||
float floorf(float val);
|
|
||||||
long double floorl(long double val);
|
|
||||||
double ceil(double val);
|
|
||||||
float ceilf(float val);
|
|
||||||
long double ceill(long double val);
|
|
||||||
double log10(double val);
|
|
||||||
float log10f(float val);
|
|
||||||
long double log10l(long double val);
|
|
||||||
double fmod(double val1, double val2);
|
|
||||||
float fmodf(float val1, float val2);
|
|
||||||
long double fmodl(long double val1, long double val2);
|
|
||||||
double pow(double val1, double val2);
|
|
||||||
float powf(float val1, float val2);
|
|
||||||
long double powl(long double val1, long double val2);
|
|
||||||
double atan2(double val1, double val2);
|
|
||||||
float atan2f(float val1, float val2);
|
|
||||||
long double atan2l(long double val1, long double val2);
|
|
||||||
double frexp(double val1, int* val2);
|
|
||||||
float frexpf(float val1, int* val2);
|
|
||||||
long double frexpl(long double val1, int* val2);
|
|
||||||
double ldexp(double val1, int val2);
|
|
||||||
float ldexpf(float val1, int val2);
|
|
||||||
long double ldexpl(long double val1, int val2);
|
|
||||||
double modf(double val1, double* val2);
|
|
||||||
float modff(float val1, float* val2);
|
|
||||||
long double modfl(long double val1, long double* val2);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
@ -143,7 +143,6 @@ extern "C"
|
|||||||
|
|
||||||
int sscanf(const char*, const char*, ...); // Not implemented.
|
int sscanf(const char*, const char*, ...); // Not implemented.
|
||||||
int fscanf(FILE*, const char*, ...); // Not implemented.
|
int fscanf(FILE*, const char*, ...); // Not implemented.
|
||||||
int scanf(const char*, ...); // Not implemented.
|
|
||||||
|
|
||||||
/* Writes the string str followed by a trailing newline to stdout. */
|
/* Writes the string str followed by a trailing newline to stdout. */
|
||||||
int puts(const char* str);
|
int puts(const char* str);
|
||||||
|
@ -1,106 +0,0 @@
|
|||||||
#include <math.h>
|
|
||||||
|
|
||||||
// FIXME: Provide our own definitions instead of relying on the compiler's builtins.
|
|
||||||
|
|
||||||
#define WRAP_AROUND_BUILTIN(name) \
|
|
||||||
double name(double val) \
|
|
||||||
{ \
|
|
||||||
return __builtin_##name(val); \
|
|
||||||
} \
|
|
||||||
float name##f(float val) \
|
|
||||||
{ \
|
|
||||||
return __builtin_##name##f(val); \
|
|
||||||
} \
|
|
||||||
long double name##l(long double val) \
|
|
||||||
{ \
|
|
||||||
return __builtin_##name##l(val); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define WRAP_AROUND_BUILTIN2(name) \
|
|
||||||
double name(double val1, double val2) \
|
|
||||||
{ \
|
|
||||||
return __builtin_##name(val1, val2); \
|
|
||||||
} \
|
|
||||||
float name##f(float val1, float val2) \
|
|
||||||
{ \
|
|
||||||
return __builtin_##name##f(val1, val2); \
|
|
||||||
} \
|
|
||||||
long double name##l(long double val1, long double val2) \
|
|
||||||
{ \
|
|
||||||
return __builtin_##name##l(val1, val2); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define WRAP_AROUND_BUILTIN_WITH_PARAMETER_TYPE(name, type) \
|
|
||||||
double name(double val1, type val2) \
|
|
||||||
{ \
|
|
||||||
return __builtin_##name(val1, val2); \
|
|
||||||
} \
|
|
||||||
float name##f(float val1, type val2) \
|
|
||||||
{ \
|
|
||||||
return __builtin_##name##f(val1, val2); \
|
|
||||||
} \
|
|
||||||
long double name##l(long double val1, type val2) \
|
|
||||||
{ \
|
|
||||||
return __builtin_##name##l(val1, val2); \
|
|
||||||
}
|
|
||||||
|
|
||||||
#define WRAP_AROUND_BUILTIN_WITH_POINTER(name) \
|
|
||||||
double name(double val1, double* val2) \
|
|
||||||
{ \
|
|
||||||
return __builtin_##name(val1, val2); \
|
|
||||||
} \
|
|
||||||
float name##f(float val1, float* val2) \
|
|
||||||
{ \
|
|
||||||
return __builtin_##name##f(val1, val2); \
|
|
||||||
} \
|
|
||||||
long double name##l(long double val1, long double* val2) \
|
|
||||||
{ \
|
|
||||||
return __builtin_##name##l(val1, val2); \
|
|
||||||
}
|
|
||||||
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
WRAP_AROUND_BUILTIN(cos);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN(sin);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN(tan);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN(acos);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN(asin);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN(atan);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN(cosh);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN(sinh);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN(tanh);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN(log);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN(exp);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN(sqrt);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN(fabs);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN(floor);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN(ceil);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN(log10);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN2(fmod);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN2(pow);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN2(atan2);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN_WITH_PARAMETER_TYPE(frexp, int*);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN_WITH_PARAMETER_TYPE(ldexp, int);
|
|
||||||
|
|
||||||
WRAP_AROUND_BUILTIN_WITH_POINTER(modf);
|
|
||||||
}
|
|
@ -64,11 +64,6 @@ extern "C"
|
|||||||
NOT_IMPLEMENTED("fscanf");
|
NOT_IMPLEMENTED("fscanf");
|
||||||
}
|
}
|
||||||
|
|
||||||
int scanf(const char*, ...)
|
|
||||||
{
|
|
||||||
NOT_IMPLEMENTED("scanf");
|
|
||||||
}
|
|
||||||
|
|
||||||
int rename(const char*, const char*)
|
int rename(const char*, const char*)
|
||||||
{
|
{
|
||||||
NOT_IMPLEMENTED("rename");
|
NOT_IMPLEMENTED("rename");
|
||||||
|
Loading…
Reference in New Issue
Block a user