summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES4
-rw-r--r--Plan9/include/lib9x.h20
-rw-r--r--include/version.h2
-rw-r--r--libmath/dtoa.c9
-rw-r--r--libmath/fdlibm/fdlibm.h193
-rw-r--r--mkfiles/mkfile-Inferno-3862
-rw-r--r--mkfiles/mkfile-Inferno-680002
-rw-r--r--mkfiles/mkfile-Inferno-arm2
-rw-r--r--mkfiles/mkfile-Inferno-mips2
-rw-r--r--mkfiles/mkfile-Inferno-power2
-rw-r--r--mkfiles/mkfile-Inferno-sparc2
-rw-r--r--mkfiles/mkfile-Inferno-spim2
-rw-r--r--mkfiles/mkfile-Inferno-thumb2
-rw-r--r--mkfiles/mkfile-Plan9-3862
-rw-r--r--mkfiles/mkfile-Plan9-680202
-rw-r--r--mkfiles/mkfile-Plan9-amd642
-rw-r--r--mkfiles/mkfile-Plan9-arm2
-rw-r--r--mkfiles/mkfile-Plan9-mips2
-rw-r--r--mkfiles/mkfile-Plan9-power2
-rw-r--r--mkfiles/mkfile-Plan9-sparc2
20 files changed, 142 insertions, 116 deletions
diff --git a/CHANGES b/CHANGES
index 62ea9fc7..fca5303b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,7 @@
+20120305
+ add -I$ROOT/(Plan9|Inferno)/include to CFLAGS in mkfiles/^(mkfile-Plan9* mkfile-Inferno*)
+ change specific object type to $OBJTYPE in the same
+ libmath/fdlibm/fdlibm.h and libmath/dtoa.c, if USE_FPdbleword defined, use FPdbleword to crack doubles into integers
20120304
rabin(2) added (preliminary)
20120213
diff --git a/Plan9/include/lib9x.h b/Plan9/include/lib9x.h
new file mode 100644
index 00000000..8973cd15
--- /dev/null
+++ b/Plan9/include/lib9x.h
@@ -0,0 +1,20 @@
+#include <u.h>
+typedef usize size_t;
+
+#define Runeerror xRuneerror
+#define Rendez xRendez
+#include <libc.h>
+#undef Runeerror
+#undef Rendez
+
+
+enum
+{
+ Runeerror = 0x80, /* decoding error in UTF */
+};
+/*
+ * Extensions for Inferno to basic libc.h
+ */
+
+#define setbinmode()
+#define USE_FPdbleword
diff --git a/include/version.h b/include/version.h
index 12f27b76..7ae53637 100644
--- a/include/version.h
+++ b/include/version.h
@@ -1 +1 @@
-#define VERSION "Fourth Edition (20120304)"
+#define VERSION "Fourth Edition (20120305)"
diff --git a/libmath/dtoa.c b/libmath/dtoa.c
index 0a73ef5a..95cf2738 100644
--- a/libmath/dtoa.c
+++ b/libmath/dtoa.c
@@ -26,13 +26,18 @@
#define Sign_Extend(a,b) if (b < 0) a |= 0xffff0000;
+#ifdef USE_FPdbleword
+#define word0(x) ((unsigned long *)&x)->hi
+#define word1(x) ((unsigned long *)&x)->lo
+#else
#ifdef __LITTLE_ENDIAN
-#define word0(x) ((unsigned long *)&x)[1]
-#define word1(x) ((unsigned long *)&x)[0]
+#define word0(x) ((FPdbleword*)&x)[1]
+#define word1(x) ((FPdbleword*)&x)[0]
#else
#define word0(x) ((unsigned long *)&x)[0]
#define word1(x) ((unsigned long *)&x)[1]
#endif
+#endif
/* #define P DBL_MANT_DIG */
/* Ten_pmax = floor(P*log(2)/log(5)) */
diff --git a/libmath/fdlibm/fdlibm.h b/libmath/fdlibm/fdlibm.h
index 9bf0727f..6ce87895 100644
--- a/libmath/fdlibm/fdlibm.h
+++ b/libmath/fdlibm/fdlibm.h
@@ -14,6 +14,12 @@
*/
+#ifdef USE_FPdbleword
+#define __HI(x) (int)((FPdbleword*)&x)->hi
+#define __LO(x) (int)((FPdbleword*)&x)->lo
+#define __HIp(x) (int)((FPdbleword*)x)->hi
+#define __LOp(x) (int)((FPdbleword*)x)->lo
+#else
#ifdef __LITTLE_ENDIAN
#define __HI(x) *(1+(int*)&x)
#define __LO(x) *(int*)&x
@@ -25,129 +31,120 @@
#define __HIp(x) *(int*)x
#define __LOp(x) *(1+(int*)x)
#endif
-
-/* Many GNU includes use the same define */
-#ifndef __P
-#define __P(p) p
#endif
/*
* ANSI/POSIX
*/
-
-/*
- * ANSI/POSIX
- */
-extern double acos __P((double));
-extern double asin __P((double));
-extern double atan __P((double));
-extern double atan2 __P((double, double));
-extern double cos __P((double));
-extern double sin __P((double));
-extern double tan __P((double));
-
-extern double cosh __P((double));
-extern double sinh __P((double));
-extern double tanh __P((double));
-
-extern double exp __P((double));
-extern double frexp __P((double, int *));
-extern double ldexp __P((double, int));
-extern double log __P((double));
-extern double log10 __P((double));
-extern double modf __P((double, double *));
-
-extern double pow __P((double, double));
-extern double sqrt __P((double));
-
-extern double ceil __P((double));
-extern double fabs __P((double));
-extern double floor __P((double));
-extern double fmod __P((double, double));
-
-extern double erf __P((double));
-extern double erfc __P((double));
-extern double gamma __P((double));
-extern double hypot __P((double, double));
-extern int isnan __P((double));
-extern int finite __P((double));
-extern double j0 __P((double));
-extern double j1 __P((double));
-extern double jn __P((int, double));
-extern double lgamma __P((double));
-extern double y0 __P((double));
-extern double y1 __P((double));
-extern double yn __P((int, double));
-
-extern double acosh __P((double));
-extern double asinh __P((double));
-extern double atanh __P((double));
-extern double cbrt __P((double));
-extern double logb __P((double));
-extern double nextafter __P((double, double));
-extern double remainder __P((double, double));
-extern double scalb __P((double, double));
+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 erf(double);
+extern double erfc(double);
+extern double gamma(double);
+extern double hypot(double, double);
+extern int finite(double);
+extern double j0(double);
+extern double j1(double);
+extern double jn(int, double);
+extern double lgamma(double);
+extern double y0(double);
+extern double y1(double);
+extern double yn(int, double);
+
+extern double acosh(double);
+extern double asinh(double);
+extern double atanh(double);
+extern double cbrt(double);
+extern double logb(double);
+extern double nextafter(double, double);
+extern double remainder(double, double);
+extern double scalb(double, double);
/*
* IEEE Test Vector
*/
-extern double significand __P((double));
+extern double significand(double);
/*
* Functions callable from C, intended to support IEEE arithmetic.
*/
-extern double copysign __P((double, double));
-extern int ilogb __P((double));
-extern double rint __P((double));
-extern double scalbn __P((double, int));
+extern double copysign(double, double);
+extern int ilogb(double);
+extern double rint(double);
+extern double scalbn(double, int);
/*
* BSD math library entry points
*/
-extern double expm1 __P((double));
-extern double log1p __P((double));
+extern double expm1(double);
+extern double log1p(double);
/*
* Reentrant version of gamma & lgamma; passes signgam back by reference
* as the second argument; user must allocate space for signgam.
*/
#ifdef _REENTRANT
-extern double gamma_r __P((double, int *));
-extern double lgamma_r __P((double, int *));
+extern double gamma_r(double, int *);
+extern double lgamma_r(double, int *);
#endif /* _REENTRANT */
/* ieee style elementary functions */
-extern double __ieee754_sqrt __P((double));
-extern double __ieee754_acos __P((double));
-extern double __ieee754_acosh __P((double));
-extern double __ieee754_log __P((double));
-extern double __ieee754_atanh __P((double));
-extern double __ieee754_asin __P((double));
-extern double __ieee754_atan2 __P((double,double));
-extern double __ieee754_exp __P((double));
-extern double __ieee754_cosh __P((double));
-extern double __ieee754_fmod __P((double,double));
-extern double __ieee754_pow __P((double,double));
-extern double __ieee754_lgamma_r __P((double,int *));
-extern double __ieee754_gamma_r __P((double,int *));
-extern double __ieee754_lgamma __P((double));
-extern double __ieee754_gamma __P((double));
-extern double __ieee754_log10 __P((double));
-extern double __ieee754_sinh __P((double));
-extern double __ieee754_hypot __P((double,double));
-extern double __ieee754_j0 __P((double));
-extern double __ieee754_j1 __P((double));
-extern double __ieee754_y0 __P((double));
-extern double __ieee754_y1 __P((double));
-extern double __ieee754_jn __P((int,double));
-extern double __ieee754_yn __P((int,double));
-extern double __ieee754_remainder __P((double,double));
-extern int __ieee754_rem_pio2 __P((double,double*));
-extern double __ieee754_scalb __P((double,int));
+extern double __ieee754_sqrt(double);
+extern double __ieee754_acos(double);
+extern double __ieee754_acosh(double);
+extern double __ieee754_log(double);
+extern double __ieee754_atanh(double);
+extern double __ieee754_asin(double);
+extern double __ieee754_atan2(double,double);
+extern double __ieee754_exp(double);
+extern double __ieee754_cosh(double);
+extern double __ieee754_fmod(double,double);
+extern double __ieee754_pow(double,double);
+extern double __ieee754_lgamma_r(double,int *);
+extern double __ieee754_gamma_r(double,int *);
+extern double __ieee754_lgamma(double);
+extern double __ieee754_gamma(double);
+extern double __ieee754_log10(double);
+extern double __ieee754_sinh(double);
+extern double __ieee754_hypot(double,double);
+extern double __ieee754_j0(double);
+extern double __ieee754_j1(double);
+extern double __ieee754_y0(double);
+extern double __ieee754_y1(double);
+extern double __ieee754_jn(int,double);
+extern double __ieee754_yn(int,double);
+extern double __ieee754_remainder(double,double);
+extern int __ieee754_rem_pio2(double,double*);
+extern double __ieee754_scalb(double,int);
/* fdlibm kernel function */
-extern double __kernel_standard __P((double,double,int));
-extern double __kernel_sin __P((double,double,int));
-extern double __kernel_cos __P((double,double));
-extern double __kernel_tan __P((double,double,int));
-extern int __kernel_rem_pio2 __P((double*,double*,int,int,int,const int*));
+extern double __kernel_standard(double,double,int);
+extern double __kernel_sin(double,double,int);
+extern double __kernel_cos(double,double);
+extern double __kernel_tan(double,double,int);
+extern int __kernel_rem_pio2(double*,double*,int,int,int,const int*);
diff --git a/mkfiles/mkfile-Inferno-386 b/mkfiles/mkfile-Inferno-386
index f72ae7f7..85879f66 100644
--- a/mkfiles/mkfile-Inferno-386
+++ b/mkfiles/mkfile-Inferno-386
@@ -12,7 +12,7 @@ AS= 8a
ASFLAGS=
CC= 8c
-CFLAGS= -wFVT -I$ROOT/Inferno/386/include -I$ROOT/include
+CFLAGS= -wFVT -I$ROOT/Inferno/$OBJTYPE/include -I$ROOT/Inferno/include -I$ROOT/include
ANSICPP= -p
LD= 8l
diff --git a/mkfiles/mkfile-Inferno-68000 b/mkfiles/mkfile-Inferno-68000
index 8f8c6f46..0bddea56 100644
--- a/mkfiles/mkfile-Inferno-68000
+++ b/mkfiles/mkfile-Inferno-68000
@@ -12,7 +12,7 @@ AS= 1a
ASFLAGS=
CC= 1c
-CFLAGS= -N -wFV -I$ROOT/Inferno/68000/include -I$ROOT/include
+CFLAGS= -N -wFV -I$ROOT/Inferno/$OBJTYPE/include -I$ROOT/Inferno/include -I$ROOT/include
ANSICPP= -p
LD= 1l
diff --git a/mkfiles/mkfile-Inferno-arm b/mkfiles/mkfile-Inferno-arm
index d865a096..50dcf2d8 100644
--- a/mkfiles/mkfile-Inferno-arm
+++ b/mkfiles/mkfile-Inferno-arm
@@ -12,7 +12,7 @@ AS= 5a
ASFLAGS=
CC= 5c
-CFLAGS= -wFV -I$ROOT/Inferno/arm/include -I$ROOT/include
+CFLAGS= -wFV -I$ROOT/Inferno/$OBJTYPE/include -I$ROOT/Inferno/include -I$ROOT/include
ANSICPP= -p
LD= 5l
diff --git a/mkfiles/mkfile-Inferno-mips b/mkfiles/mkfile-Inferno-mips
index 6c17f4b0..56b834ee 100644
--- a/mkfiles/mkfile-Inferno-mips
+++ b/mkfiles/mkfile-Inferno-mips
@@ -12,7 +12,7 @@ AS= va
ASFLAGS=
CC= vc
-CFLAGS= -wFV -I$ROOT/Inferno/mips/include -I$ROOT/include
+CFLAGS= -wFV -I$ROOT/Inferno/$OBJTYPE/include -I$ROOT/Inferno/include -I$ROOT/include
ANSICPP= -p
LD= vl
diff --git a/mkfiles/mkfile-Inferno-power b/mkfiles/mkfile-Inferno-power
index e531ea3c..28d13279 100644
--- a/mkfiles/mkfile-Inferno-power
+++ b/mkfiles/mkfile-Inferno-power
@@ -12,7 +12,7 @@ AS= qa
ASFLAGS=
CC= qc
-CFLAGS= -wFV -I$ROOT/Inferno/power/include -I$ROOT/include
+CFLAGS= -wFV -I$ROOT/Inferno/$OBJTYPE/include -I$ROOT/Inferno/include -I$ROOT/include
ANSICPP= -p
LD= ql
diff --git a/mkfiles/mkfile-Inferno-sparc b/mkfiles/mkfile-Inferno-sparc
index 8470a169..2296e9f8 100644
--- a/mkfiles/mkfile-Inferno-sparc
+++ b/mkfiles/mkfile-Inferno-sparc
@@ -12,7 +12,7 @@ AS= ka
ASFLAGS=
CC= kc
-CFLAGS= -wFV -I$ROOT/Inferno/sparc/include -I$ROOT/include
+CFLAGS= -wFV -I$ROOT/Inferno/$OBJTYPE/include -I$ROOT/Inferno/include -I$ROOT/include
ANSICPP= -p
LD= kl
diff --git a/mkfiles/mkfile-Inferno-spim b/mkfiles/mkfile-Inferno-spim
index d380db33..c9105e1f 100644
--- a/mkfiles/mkfile-Inferno-spim
+++ b/mkfiles/mkfile-Inferno-spim
@@ -12,7 +12,7 @@ AS= 0a
ASFLAGS=
CC= 0c
-CFLAGS= -w -I$ROOT/Inferno/spim/include -I$ROOT/include
+CFLAGS= -w -I$ROOT/Inferno/$OBJTYPE/include -I$ROOT/Inferno/include -I$ROOT/include
ANSICPP= -p
LD= 0l
diff --git a/mkfiles/mkfile-Inferno-thumb b/mkfiles/mkfile-Inferno-thumb
index 6e0e402c..fdb7647f 100644
--- a/mkfiles/mkfile-Inferno-thumb
+++ b/mkfiles/mkfile-Inferno-thumb
@@ -12,7 +12,7 @@ AS=5a -t
ASFLAGS=
CC= tc
-CFLAGS= -wFV -I$ROOT/Inferno/arm/include -I$ROOT/include
+CFLAGS= -wFV -I$ROOT/Inferno/$OBJTYPE/include -I$ROOT/Inferno/include -I$ROOT/include
ANSICPP= -p
LD=5l
diff --git a/mkfiles/mkfile-Plan9-386 b/mkfiles/mkfile-Plan9-386
index 0ae1bf94..3efc6949 100644
--- a/mkfiles/mkfile-Plan9-386
+++ b/mkfiles/mkfile-Plan9-386
@@ -12,7 +12,7 @@ AS= 8a
ASFLAGS=
CC= 8c
-CFLAGS= -wFVT -I$ROOT/Plan9/386/include -I$ROOT/include
+CFLAGS= -wFVT -I$ROOT/Plan9/$OBJTYPE/include -I$ROOT/Plan9/include -I$ROOT/include
ANSICPP= -p
LD= 8l
diff --git a/mkfiles/mkfile-Plan9-68020 b/mkfiles/mkfile-Plan9-68020
index 49f97857..3ea42e7a 100644
--- a/mkfiles/mkfile-Plan9-68020
+++ b/mkfiles/mkfile-Plan9-68020
@@ -12,7 +12,7 @@ AS= 2a
ASFLAGS=
CC= 2c
-CFLAGS= -wFV -I$ROOT/Plan9/68020/include -I$ROOT/include
+CFLAGS= -wFV -I$ROOT/Plan9/$OBJTYPE/include -I$ROOT/Plan9/include -I$ROOT/include
ANSICPP= -p
LD= 2l
diff --git a/mkfiles/mkfile-Plan9-amd64 b/mkfiles/mkfile-Plan9-amd64
index 1113e596..3a03f92a 100644
--- a/mkfiles/mkfile-Plan9-amd64
+++ b/mkfiles/mkfile-Plan9-amd64
@@ -12,7 +12,7 @@ AS= 6a
ASFLAGS=
CC= 6c
-CFLAGS= -wFV -I$ROOT/Plan9/amd64/include -I$ROOT/include
+CFLAGS= -wFV -I$ROOT/Plan9/$OBJTYPE/include -I$ROOT/Plan9/include -I$ROOT/include
ANSICPP= -p
LD= 6l
diff --git a/mkfiles/mkfile-Plan9-arm b/mkfiles/mkfile-Plan9-arm
index 8e94e70c..2740c932 100644
--- a/mkfiles/mkfile-Plan9-arm
+++ b/mkfiles/mkfile-Plan9-arm
@@ -12,7 +12,7 @@ AS= 5a
ASFLAGS=
CC= 5c
-CFLAGS= -wFV -I$ROOT/Plan9/arm/include -I$ROOT/include
+CFLAGS= -wFV -I$ROOT/Plan9/$OBJTYPE/include -I$ROOT/Plan9/include -I$ROOT/include
ANSICPP= -p
LD= 5l
diff --git a/mkfiles/mkfile-Plan9-mips b/mkfiles/mkfile-Plan9-mips
index b3920e20..ade23ef2 100644
--- a/mkfiles/mkfile-Plan9-mips
+++ b/mkfiles/mkfile-Plan9-mips
@@ -12,7 +12,7 @@ AS= va
ASFLAGS=
CC= vc
-CFLAGS= -wFV -I$ROOT/Plan9/mips/include -I$ROOT/include
+CFLAGS= -wFV -I$ROOT/Plan9/$OBJTYPE/include -I$ROOT/Plan9/include -I$ROOT/include
ANSICPP= -p
LD= vl
diff --git a/mkfiles/mkfile-Plan9-power b/mkfiles/mkfile-Plan9-power
index 72b95551..71c5793c 100644
--- a/mkfiles/mkfile-Plan9-power
+++ b/mkfiles/mkfile-Plan9-power
@@ -12,7 +12,7 @@ AS= qa
ASFLAGS=
CC= qc
-CFLAGS= -wFV -I$ROOT/Plan9/power/include -I$ROOT/include
+CFLAGS= -wFV -I$ROOT/Plan9/$OBJTYPE/include -I$ROOT/Plan9/include -I$ROOT/include
ANSICPP= -p
LD= ql
diff --git a/mkfiles/mkfile-Plan9-sparc b/mkfiles/mkfile-Plan9-sparc
index e485feb2..6b52c338 100644
--- a/mkfiles/mkfile-Plan9-sparc
+++ b/mkfiles/mkfile-Plan9-sparc
@@ -12,7 +12,7 @@ AS= ka
ASFLAGS=
CC= kc
-CFLAGS= -wFV -I$ROOT/Plan9/sparc/include -I$ROOT/include
+CFLAGS= -wFV -I$ROOT/Plan9/$OBJTYPE/include -I$ROOT/Plan9/include -I$ROOT/include
ANSICPP= -p
LD= kl