ref: 55613b56d78d8e349174cbd576e346284977c362
parent: 0f21a32fa6d6dabf3faf98c891afcf9cfcf99ba2
author: cinap_lenrek <devnull@localhost>
date: Wed Mar 30 11:02:07 EDT 2011
more stuff
--- /dev/null
+++ b/386/include/ape/float.h
@@ -1,0 +1,73 @@
+#ifndef __FLOAT
+#define __FLOAT
+/* IEEE, default rounding */
+
+#define FLT_ROUNDS 1
+#define FLT_RADIX 2
+
+#define FLT_DIG 6
+#define FLT_EPSILON 1.19209290e-07
+#define FLT_MANT_DIG 24
+#define FLT_MAX 3.40282347e+38
+#define FLT_MAX_10_EXP 38
+#define FLT_MAX_EXP 128
+#define FLT_MIN 1.17549435e-38
+#define FLT_MIN_10_EXP -37
+#define FLT_MIN_EXP -125
+
+#define DBL_DIG 15
+#define DBL_EPSILON 2.2204460492503131e-16
+#define DBL_MANT_DIG 53
+#define DBL_MAX 1.797693134862315708145e+308
+#define DBL_MAX_10_EXP 308
+#define DBL_MAX_EXP 1024
+#define DBL_MIN 2.225073858507201383090233e-308
+#define DBL_MIN_10_EXP -307
+#define DBL_MIN_EXP -1021
+#define LDBL_MANT_DIG DBL_MANT_DIG
+#define LDBL_EPSILON DBL_EPSILON
+#define LDBL_DIG DBL_DIG
+#define LDBL_MIN_EXP DBL_MIN_EXP
+#define LDBL_MIN DBL_MIN
+#define LDBL_MIN_10_EXP DBL_MIN_10_EXP
+#define LDBL_MAX_EXP DBL_MAX_EXP
+#define LDBL_MAX DBL_MAX
+#define LDBL_MAX_10_EXP DBL_MAX_10_EXP
+
+typedef union FPdbleword FPdbleword;
+union FPdbleword
+{
+ double x;
+ struct { /* little endian */
+ long lo;
+ long hi;
+ };
+};
+
+#ifdef _RESEARCH_SOURCE
+/* define stuff needed for floating conversion */
+#define IEEE_8087 1
+#define Sudden_Underflow 1
+#endif
+#ifdef _PLAN9_SOURCE
+/* FCR */
+#define FPINEX (1<<5)
+#define FPOVFL (1<<3)
+#define FPUNFL ((1<<4)|(1<<1))
+#define FPZDIV (1<<2)
+#define FPRNR (0<<10)
+#define FPRZ (3<<10)
+#define FPRPINF (2<<10)
+#define FPRNINF (1<<10)
+#define FPRMASK (3<<10)
+#define FPPEXT (3<<8)
+#define FPPSGL (0<<8)
+#define FPPDBL (2<<8)
+#define FPPMASK (3<<8)
+/* FSR */
+#define FPAINEX FPINEX
+#define FPAOVFL FPOVFL
+#define FPAUNFL FPUNFL
+#define FPAZDIV FPZDIV
+#endif
+#endif /* __FLOAT */
--- /dev/null
+++ b/386/include/ape/math.h
@@ -1,0 +1,74 @@
+#ifndef __MATH
+#define __MATH
+#pragma lib "/$M/lib/ape/libap.a"
+
+/* a HUGE_VAL appropriate for IEEE double-precision */
+/* the correct value, 1.797693134862316e+308, causes a ken overflow */
+#define HUGE_VAL 1.79769313486231e+308
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern double acos(double);
+extern double asin(double);
+extern double atan(double);
+extern double atan2(double, double);
+extern double cos(double);
+extern double sin(double);
+extern double tan(double);
+extern double cosh(double);
+extern double sinh(double);
+extern double tanh(double);
+extern double exp(double);
+extern double frexp(double, int *);
+extern double ldexp(double, int);
+extern double log(double);
+extern double log10(double);
+extern double modf(double, double *);
+extern double pow(double, double);
+extern double sqrt(double);
+extern double ceil(double);
+extern double fabs(double);
+extern double floor(double);
+extern double fmod(double, double);
+extern double NaN(void);
+extern int isNaN(double);
+extern double Inf(int);
+extern int isInf(double, int);
+
+#ifdef _RESEARCH_SOURCE
+/* does >> treat left operand as unsigned ? */
+#define Unsigned_Shifts 1
+#define M_E 2.7182818284590452354 /* e */
+#define M_LOG2E 1.4426950408889634074 /* log 2e */
+#define M_LOG10E 0.43429448190325182765 /* log 10e */
+#define M_LN2 0.69314718055994530942 /* log e2 */
+#define M_LN10 2.30258509299404568402 /* log e10 */
+#define M_PI 3.14159265358979323846 /* pi */
+#define M_PI_2 1.57079632679489661923 /* pi/2 */
+#define M_PI_4 0.78539816339744830962 /* pi/4 */
+#define M_1_PI 0.31830988618379067154 /* 1/pi */
+#define M_2_PI 0.63661977236758134308 /* 2/pi */
+#define M_2_SQRTPI 1.12837916709551257390 /* 2/sqrt(pi) */
+#define M_SQRT2 1.41421356237309504880 /* sqrt(2) */
+#define M_SQRT1_2 0.70710678118654752440 /* 1/sqrt(2) */
+
+extern double hypot(double, double);
+extern double erf(double);
+extern double erfc(double);
+extern double j0(double);
+extern double y0(double);
+extern double j1(double);
+extern double y1(double);
+extern double jn(int, double);
+extern double yn(int, double);
+
+#endif
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MATH */
--- /dev/null
+++ b/386/include/ape/stdarg.h
@@ -1,0 +1,11 @@
+#ifndef __STDARG
+#define __STDARG
+
+typedef char *va_list;
+
+#define va_start(list, start) list = (sizeof(start)<4 ? (char *)((int *)&(start)+1) : \
+(char *)(&(start)+1))
+#define va_end(list)
+#define va_arg(list, mode) ((mode*)(list += sizeof(mode)))[-1]
+
+#endif /* __STDARG */
--- /dev/null
+++ b/386/include/ape/ureg.h
@@ -1,0 +1,33 @@
+#ifndef __UREG_H
+#define __UREG_H
+#if !defined(_PLAN9_SOURCE)
+ This header file is an extension to ANSI/POSIX
+#endif
+
+struct Ureg
+{
+ unsigned long di; /* general registers */
+ unsigned long si; /* ... */
+ unsigned long bp; /* ... */
+ unsigned long nsp;
+ unsigned long bx; /* ... */
+ unsigned long dx; /* ... */
+ unsigned long cx; /* ... */
+ unsigned long ax; /* ... */
+ unsigned long gs; /* data segments */
+ unsigned long fs; /* ... */
+ unsigned long es; /* ... */
+ unsigned long ds; /* ... */
+ unsigned long trap; /* trap type */
+ unsigned long ecode; /* error code (or zero) */
+ unsigned long pc; /* pc */
+ unsigned long cs; /* old context */
+ unsigned long flags; /* old flags */
+ union {
+ unsigned long usp;
+ unsigned long sp;
+ };
+ unsigned long ss; /* old stack segment */
+};
+
+#endif
--- /dev/null
+++ b/386/include/u.h
@@ -1,0 +1,65 @@
+#define nil ((void*)0)
+typedef unsigned short ushort;
+typedef unsigned char uchar;
+typedef unsigned long ulong;
+typedef unsigned int uint;
+typedef signed char schar;
+typedef long long vlong;
+typedef unsigned long long uvlong;
+typedef unsigned long uintptr;
+typedef unsigned long usize;
+typedef ushort Rune;
+typedef union FPdbleword FPdbleword;
+typedef long jmp_buf[2];
+#define JMPBUFSP 0
+#define JMPBUFPC 1
+#define JMPBUFDPC 0
+typedef unsigned int mpdigit; /* for /sys/include/mp.h */
+typedef unsigned char u8int;
+typedef unsigned short u16int;
+typedef unsigned int u32int;
+typedef unsigned long long u64int;
+
+/* FCR */
+#define FPINEX (1<<5)
+#define FPUNFL ((1<<4)|(1<<1))
+#define FPOVFL (1<<3)
+#define FPZDIV (1<<2)
+#define FPINVAL (1<<0)
+#define FPRNR (0<<10)
+#define FPRZ (3<<10)
+#define FPRPINF (2<<10)
+#define FPRNINF (1<<10)
+#define FPRMASK (3<<10)
+#define FPPEXT (3<<8)
+#define FPPSGL (0<<8)
+#define FPPDBL (2<<8)
+#define FPPMASK (3<<8)
+/* FSR */
+#define FPAINEX FPINEX
+#define FPAOVFL FPOVFL
+#define FPAUNFL FPUNFL
+#define FPAZDIV FPZDIV
+#define FPAINVAL FPINVAL
+union FPdbleword
+{
+ double x;
+ struct { /* little endian */
+ ulong lo;
+ ulong hi;
+ };
+};
+
+typedef char* va_list;
+#define va_start(list, start) list =\
+ (sizeof(start) < 4?\
+ (char*)((int*)&(start)+1):\
+ (char*)(&(start)+1))
+#define va_end(list)\
+ USED(list)
+#define va_arg(list, mode)\
+ ((sizeof(mode) == 1)?\
+ ((list += 4), (mode*)list)[-4]:\
+ (sizeof(mode) == 2)?\
+ ((list += 4), (mode*)list)[-2]:\
+ ((list += sizeof(mode)), (mode*)list)[-1])
--- /dev/null
+++ b/386/include/ureg.h
@@ -1,0 +1,25 @@
+struct Ureg
+{
+ ulong di; /* general registers */
+ ulong si; /* ... */
+ ulong bp; /* ... */
+ ulong nsp;
+ ulong bx; /* ... */
+ ulong dx; /* ... */
+ ulong cx; /* ... */
+ ulong ax; /* ... */
+ ulong gs; /* data segments */
+ ulong fs; /* ... */
+ ulong es; /* ... */
+ ulong ds; /* ... */
+ ulong trap; /* trap type */
+ ulong ecode; /* error code (or zero) */
+ ulong pc; /* pc */
+ ulong cs; /* old context */
+ ulong flags; /* old flags */
+ union {
+ ulong usp;
+ ulong sp;
+ };
+ ulong ss; /* old stack segment */
+};
--- /dev/null
+++ b/386/mkfile
@@ -1,0 +1,6 @@
+</sys/src/mkfile.proto
+
+CC=8c
+LD=8l
+O=8
+AS=8a