--- /dev/null
+
+SUBDIRS = \
+ end \
+ ieee_float \
+ rts \
+
+include ../Makefile.inc
--- /dev/null
+
+all:
+ cd end && gmake
+ cd ieee_float && gmake
+ cd rts && gmake
--- /dev/null
+
+LIBRARIES = end
+
+end_OBJECTS = gnu_end.o
+
+include ../../Makefile.gnu.inc
+
--- /dev/null
+CC=gcc
+AR=gar
+AS=gas
+
+VPATH=$(SRCDIR)/gnu/end
+
+LIBRARY=../../end.a
+OBJECTS=gnu_end.o
+
+all: $(LIBRARY)
+
+$(LIBRARY): $(OBJECTS)
+ $(AR) cr $@ *.o
+
+gnu_end.o: gnu_end.s
+
--- /dev/null
+
+.stabs "endbss",11,0,0,0
+.stabs "__end",1,0,0,0
+
+
--- /dev/null
+
+CFLAGS = -O -I..
+
+LIBRARIES = libc
+
+libc_OBJECTS = \
+ frexp.o \
+ isinf.o \
+ isnan.o \
+ ldexp.o \
+ modf.o \
+ fphook.o \
+
+include ../../Makefile.gnu.inc
--- /dev/null
+# Makefile for lib/ieee_float.
+
+#CC = gcc
+#ARCH = eniac
+CFLAGS = -O -I$(SRCDIR)/stdio
+CC1 = $(CC) $(CFLAGS) -c
+
+LIBRARY = ../../libc.a
+LIBSOFT = ../../libsoft.a
+
+OBJECTS = \
+ $(LIBRARY)(frexp.o) \
+ $(LIBRARY)(isinf.o) \
+ $(LIBRARY)(isnan.o) \
+ $(LIBRARY)(ldexp.o) \
+ $(LIBRARY)(modf.o) \
+ $(LIBRARY)(fphook.o) \
+
+all: $(LIBRARY)
+
+$(LIBRARY): $(OBJECTS)
+ $(AR) cr $@ *.o
+
+$(LIBRARY)(frexp.o): frexp.c
+$(LIBRARY)(isinf.o): isinf.c
+$(LIBRARY)(isnan.o): isnan.c
+$(LIBRARY)(ldexp.o): ldexp.c
+$(LIBRARY)(modf.o): modf.c
+$(LIBRARY)(fphook.o): fphook.c
+SOFTOBJ = \
+ $(LIBSOFT)(frexp.o) \
+ $(LIBSOFT)(isinf.o) \
+ $(LIBSOFT)(isnan.o) \
+ $(LIBSOFT)(ldexp.o) \
+ $(LIBSOFT)(modf.o) \
+
+soft: $(LIBSOFT)
+
+$(LIBSOFT): $(SOFTOBJ)
+ $(CC) -c.a -o $@ *.o
+ rm *.o
+
+$(LIBSOFT)(frexp.o): frexp.c
+ $(CC1) -fsoft frexp.c
+
+$(LIBSOFT)(isinf.o): isinf.c
+ $(CC1) -fsoft isinf.c
+
+$(LIBSOFT)(isnan.o): isnan.c
+ $(CC1) -fsoft isnan.c
+
+$(LIBSOFT)(ldexp.o): ldexp.c
+ $(CC1) -fsoft ldexp.c
+
+$(LIBSOFT)(modf.o): modf.c
+ $(CC1) -fsoft modf.c
+
+# $PchId: Makefile,v 1.3 1996/02/22 21:01:39 philip Exp $
--- /dev/null
+/*
+ * fltpr.c - print floating point numbers
+ */
+/* $Header$ */
+
+#ifndef NOFLOAT
+#include <string.h>
+#include <stdarg.h>
+#include "../stdio/loc_incl.h"
+int _fp_hook = 1;
+
+static char *
+_pfloat(long double r, register char *s, int n, int flags)
+{
+ register char *s1;
+ int sign, dp;
+ register int i;
+
+ s1 = _fcvt(r, n, &dp, &sign);
+ if (sign)
+ *s++ = '-';
+ else if (flags & FL_SIGN)
+ *s++ = '+';
+ else if (flags & FL_SPACE)
+ *s++ = ' ';
+
+ if (dp<=0)
+ *s++ = '0';
+ for (i=dp; i>0; i--)
+ if (*s1) *s++ = *s1++;
+ else *s++ = '0';
+ if (((i=n) > 0) || (flags & FL_ALT))
+ *s++ = '.';
+ while (++dp <= 0) {
+ if (--i<0)
+ break;
+ *s++ = '0';
+ }
+ while (--i >= 0)
+ if (*s1) *s++ = *s1++;
+ else *s++ = '0';
+ return s;
+}
+
+static char *
+_pscien(long double r, register char *s, int n, int flags)
+{
+ int sign, dp;
+ register char *s1;
+
+ s1 = _ecvt(r, n + 1, &dp, &sign);
+ if (sign)
+ *s++ = '-';
+ else if (flags & FL_SIGN)
+ *s++ = '+';
+ else if (flags & FL_SPACE)
+ *s++ = ' ';
+
+ *s++ = *s1++;
+ if ((n > 0) || (flags & FL_ALT))
+ *s++ = '.';
+ while (--n >= 0)
+ if (*s1) *s++ = *s1++;
+ else *s++ = '0';
+ *s++ = 'e';
+ if ( r != 0 ) --dp ;
+ if ( dp<0 ) {
+ *s++ = '-' ; dp= -dp ;
+ } else {
+ *s++ = '+' ;
+ }
+ if (dp >= 100) {
+ *s++ = '0' + (dp / 100);
+ dp %= 100;
+ }
+ *s++ = '0' + (dp/10);
+ *s++ = '0' + (dp%10);
+ return s;
+}
+
+#define NDIGINEXP(exp) (((exp) >= 100 || (exp) <= -100) ? 3 : 2)
+#define LOW_EXP -4
+#define USE_EXP(exp, ndigits) (((exp) < LOW_EXP + 1) || (exp >= ndigits + 1))
+
+static char *
+_gcvt(long double value, int ndigit, char *s, int flags)
+{
+ int sign, dp;
+ register char *s1, *s2;
+ register int i;
+ register int nndigit = ndigit;
+
+ s1 = _ecvt(value, ndigit, &dp, &sign);
+ s2 = s;
+ if (sign) *s2++ = '-';
+ else if (flags & FL_SIGN)
+ *s2++ = '+';
+ else if (flags & FL_SPACE)
+ *s2++ = ' ';
+
+ if (!(flags & FL_ALT))
+ for (i = nndigit - 1; i > 0 && s1[i] == '0'; i--)
+ nndigit--;
+
+ if (USE_EXP(dp,ndigit)) {
+ /* Use E format */
+ dp--;
+ *s2++ = *s1++;
+ if ((nndigit > 1) || (flags & FL_ALT)) *s2++ = '.';
+ while (--nndigit > 0) *s2++ = *s1++;
+ *s2++ = 'e';
+ if (dp < 0) {
+ *s2++ = '-';
+ dp = -dp;
+ }
+ else *s2++ = '+';
+ s2 += NDIGINEXP(dp);
+ *s2 = 0;
+ for (i = NDIGINEXP(dp); i > 0; i--) {
+ *--s2 = dp % 10 + '0';
+ dp /= 10;
+ }
+ return s;
+ }
+ /* Use f format */
+ if (dp <= 0) {
+ if (*s1 != '0') {
+ /* otherwise the whole number is 0 */
+ *s2++ = '0';
+ *s2++ = '.';
+ }
+ while (dp < 0) {
+ dp++;
+ *s2++ = '0';
+ }
+ }
+ for (i = 1; i <= nndigit; i++) {
+ *s2++ = *s1++;
+ if (i == dp) *s2++ = '.';
+ }
+ if (i <= dp) {
+ while (i++ <= dp) *s2++ = '0';
+ *s2++ = '.';
+ }
+ if ((s2[-1]=='.') && !(flags & FL_ALT)) s2--;
+ *s2 = '\0';
+ return s;
+}
+
+char *
+_f_print(va_list *ap, int flags, char *s, char c, int precision)
+{
+ register char *old_s = s;
+ long double ld_val;
+
+ if (flags & FL_LONGDOUBLE) ld_val = va_arg(*ap, long double);
+ else ld_val = (long double) va_arg(*ap, double);
+
+ switch(c) {
+ case 'f':
+ s = _pfloat(ld_val, s, precision, flags);
+ break;
+ case 'e':
+ case 'E':
+ s = _pscien(ld_val, s, precision , flags);
+ break;
+ case 'g':
+ case 'G':
+ s = _gcvt(ld_val, precision, s, flags);
+ s += strlen(s);
+ break;
+ }
+ if ( c == 'E' || c == 'G') {
+ while (*old_s && *old_s != 'e') old_s++;
+ if (*old_s == 'e') *old_s = 'E';
+ }
+ return s;
+}
+#endif /* NOFLOAT */
+/* $Header$ */
+
+#include <stdlib.h>
+#include "../ansi/ext_fmt.h"
+
+void _str_ext_cvt(const char *s, char **ss, struct EXTEND *e);
+double _ext_dbl_cvt(struct EXTEND *e);
+
+double
+strtod(const char *p, char **pp)
+{
+ struct EXTEND e;
+
+ _str_ext_cvt(p, pp, &e);
+ return _ext_dbl_cvt(&e);
+}
--- /dev/null
+/*
+libc/ieee_float/frexp.c
+
+Created: Oct 14, 1993 by Philip Homburg <philip@cs.vu.nl>
+
+Implementation of frexp that directly manipulates the exponent bits in an
+ieee float
+*/
+
+#include <sys/types.h>
+#include <math.h>
+
+#include "ieee_float.h"
+
+double frexp(value, eptr)
+double value;
+int *eptr;
+{
+ struct f64 *f64p;
+ int exp, exp_bias;
+ double factor;
+
+ f64p= (struct f64 *)&value;
+ exp_bias= 0;
+
+ exp= F64_GET_EXP(f64p);
+ if (exp == F64_EXP_MAX)
+ { /* Either infinity or Nan */
+ *eptr= 0;
+ return value;
+ }
+ if (exp == 0)
+ {
+ /* Either 0 or denormal */
+ if (F64_GET_MANT_LOW(f64p) == 0 &&
+ F64_GET_MANT_HIGH(f64p) == 0)
+ {
+ *eptr= 0;
+ return value;
+ }
+
+ /* Multiply by 2^64 */
+ factor= 65536.0; /* 2^16 */
+ factor *= factor; /* 2^32 */
+ factor *= factor; /* 2^64 */
+ value *= factor;
+ exp_bias= 64;
+ exp= F64_GET_EXP(f64p);
+ }
+
+ exp= exp - F64_EXP_BIAS - exp_bias + 1;
+ *eptr= exp;
+ F64_SET_EXP(f64p, F64_EXP_BIAS-1);
+
+ return value;
+}
+
+/*
+ * $PchId: frexp.c,v 1.3 1996/02/22 21:01:39 philip Exp $
+ */
--- /dev/null
+/*
+libc/ieee_float/ieee_float.h
+
+Created: Oct 14, 1993 by Philip Homburg <philip@cs.vu.nl>
+
+Define structures and macros for manipulating IEEE floats
+*/
+
+#ifndef IEEE_FLOAT_H
+#define IEEE_FLOAT_H
+
+#define isnan __IsNan
+
+struct f64
+{
+ u32_t low_word;
+ u32_t high_word;
+};
+
+#define F64_SIGN_SHIFT 31
+#define F64_SIGN_MASK 1
+
+#define F64_EXP_SHIFT 20
+#define F64_EXP_MASK 0x7ff
+#define F64_EXP_BIAS 1023
+#define F64_EXP_MAX 2047
+
+#define F64_MANT_SHIFT 0
+#define F64_MANT_MASK 0xfffff
+
+#define F64_GET_SIGN(fp) (((fp)->high_word >> F64_SIGN_SHIFT) & \
+ F64_SIGN_MASK)
+#define F64_GET_EXP(fp) (((fp)->high_word >> F64_EXP_SHIFT) & \
+ F64_EXP_MASK)
+#define F64_SET_EXP(fp, val) ((fp)->high_word= ((fp)->high_word & \
+ ~(F64_EXP_MASK << F64_EXP_SHIFT)) | \
+ (((val) & F64_EXP_MASK) << F64_EXP_SHIFT))
+
+#define F64_GET_MANT_LOW(fp) ((fp)->low_word)
+#define F64_SET_MANT_LOW(fp, val) ((fp)->low_word= (val))
+#define F64_GET_MANT_HIGH(fp) (((fp)->high_word >> F64_MANT_SHIFT) & \
+ F64_MANT_MASK)
+#define F64_SET_MANT_HIGH(fp, val) ((fp)->high_word= ((fp)->high_word & \
+ ~(F64_MANT_MASK << F64_MANT_SHIFT)) | \
+ (((val) & F64_MANT_MASK) << F64_MANT_SHIFT))
+
+#endif /* IEEE_FLOAT_H */
+
+/*
+ * $PchId: ieee_float.h,v 1.3 1996/02/22 21:01:39 philip Exp $
+ */
--- /dev/null
+/*
+libc/ieee_float/isinf.c
+
+Created: Oct 14, 1993 by Philip Homburg <philip@cs.vu.nl>
+
+Implementation of isinf that directly tests the bits in an ieee float
+*/
+
+#define _MINIX_SOURCE
+
+#include <sys/types.h>
+#include <math.h>
+
+#include "ieee_float.h"
+
+int isinf(value)
+double value;
+{
+ struct f64 *f64p;
+ int exp;
+
+ f64p= (struct f64 *)&value;
+ exp= F64_GET_EXP(f64p);
+ if (exp != F64_EXP_MAX)
+ return 0;
+ return F64_GET_MANT_LOW(f64p) == 0 && F64_GET_MANT_HIGH(f64p) == 0;
+}
+
+/*
+ * $PchId: isinf.c,v 1.3 1996/02/22 21:01:39 philip Exp $
+ */
--- /dev/null
+/*
+libc/ieee_float/isnan.c
+
+Created: Oct 14, 1993 by Philip Homburg <philip@cs.vu.nl>
+
+Implementation of isnan that directly tests the bits in an ieee float
+*/
+
+#define _MINIX_SOURCE
+
+#include <sys/types.h>
+#include <math.h>
+
+#include "ieee_float.h"
+
+int isnan(value)
+double value;
+{
+ struct f64 *f64p;
+ int exp;
+
+ f64p= (struct f64 *)&value;
+ exp= F64_GET_EXP(f64p);
+ if (exp != F64_EXP_MAX)
+ return 0;
+ return F64_GET_MANT_LOW(f64p) != 0 || F64_GET_MANT_HIGH(f64p) != 0;
+}
+
+/*
+ * $PchId: isnan.c,v 1.3 1996/02/22 21:01:39 philip Exp $
+ */
--- /dev/null
+/*
+libc/ieee_float/ldexp.c
+
+Created: Oct 14, 1993 by Philip Homburg <philip@cs.vu.nl>
+
+Implementation of ldexp that directly manipulates the exponent bits in an
+ieee float
+*/
+
+#include <sys/types.h>
+#include <errno.h>
+#include <math.h>
+
+#include "ieee_float.h"
+
+double ldexp(value, exp)
+double value;
+int exp;
+{
+ struct f64 *f64p;
+ int oldexp, exp_bias;
+ double factor;
+
+ f64p= (struct f64 *)&value;
+ exp_bias= 0;
+
+ oldexp= F64_GET_EXP(f64p);
+ if (oldexp == F64_EXP_MAX)
+ { /* Either infinity or Nan */
+ return value;
+ }
+ if (oldexp == 0)
+ {
+ /* Either 0 or denormal */
+ if (F64_GET_MANT_LOW(f64p) == 0 &&
+ F64_GET_MANT_HIGH(f64p) == 0)
+ {
+ return value;
+ }
+ }
+
+ /* If exp is too large (> 2*F64_EXP_MAX) or too small
+ * (< -2*F64_EXP_MAX) return HUGE_VAL or 0. This prevents overflows
+ * in exp if exp is really weird
+ */
+ if (exp >= 2*F64_EXP_MAX)
+ {
+ errno= ERANGE;
+ return HUGE_VAL;
+ }
+ if (exp <= -2*F64_EXP_MAX)
+ {
+ errno= ERANGE;
+ return 0;
+ }
+
+ /* Normalize a denormal */
+ if (oldexp == 0)
+ {
+ /* Multiply by 2^64 */
+ factor= 65536.0; /* 2^16 */
+ factor *= factor; /* 2^32 */
+ factor *= factor; /* 2^64 */
+ value *= factor;
+ exp= -64;
+ oldexp= F64_GET_EXP(f64p);
+ }
+
+ exp= oldexp + exp;
+ if (exp >= F64_EXP_MAX)
+ { /* Overflow */
+ errno= ERANGE;
+ return HUGE_VAL;
+ }
+ if (exp > 0)
+ {
+ /* Normal */
+ F64_SET_EXP(f64p, exp);
+ return value;
+ }
+ /* Denormal, or underflow. */
+ exp += 64;
+ F64_SET_EXP(f64p, exp);
+ /* Divide by 2^64 */
+ factor= 65536.0; /* 2^16 */
+ factor *= factor; /* 2^32 */
+ factor *= factor; /* 2^64 */
+ value /= factor;
+ if (value == 0.0)
+ {
+ /* Underflow */
+ errno= ERANGE;
+ }
+ return value;
+}
+
+/*
+ * $PchId: ldexp.c,v 1.3 1996/02/22 21:01:39 philip Exp $
+ */
--- /dev/null
+/*
+libc/ieee_float/modf.c
+
+Created: Oct 14, 1993 by Philip Homburg <philip@cs.vu.nl>
+
+Implementation of modf that directly manipulates the exponent bits in an
+ieee float
+*/
+
+#include <sys/types.h>
+#include <math.h>
+
+#include "ieee_float.h"
+
+double modf(value, iptr)
+double value;
+double *iptr;
+{
+ struct f64 *f64p;
+ double tmp;
+ int exp;
+ int mask_bits;
+ u32_t mant;
+
+ f64p= (struct f64 *)&value;
+
+ exp= F64_GET_EXP(f64p);
+ exp -= F64_EXP_BIAS;
+ if (exp < 0)
+ {
+ *iptr= 0;
+ return value;
+ }
+ mask_bits= 52-exp;
+ if (mask_bits <= 0)
+ {
+ *iptr= value;
+ return 0;
+ }
+ tmp= value;
+ if (mask_bits >= 32)
+ {
+ F64_SET_MANT_LOW(f64p, 0);
+ mask_bits -= 32;
+ mant= F64_GET_MANT_HIGH(f64p);
+ mant &= ~((1 << mask_bits)-1);
+ F64_SET_MANT_HIGH(f64p, mant);
+ }
+ else
+ {
+ mant= F64_GET_MANT_LOW(f64p);
+ mant &= ~((1 << mask_bits)-1);
+ F64_SET_MANT_LOW(f64p, mant);
+ }
+ *iptr= value;
+ return tmp-value;
+}
+
+/*
+ * $PchId: modf.c,v 1.3 1996/02/22 21:01:39 philip Exp $
+ */
--- /dev/null
+
+LIBRARIES = libc
+
+libc_OBJECTS = \
+ _longjmp.o \
+ _setjmp.o \
+ longjmp.o \
+ setjmp.o \
+
+include ../../Makefile.gnu.inc
--- /dev/null
+CC=gcc
+AR=gar
+AS=gas
+
+VPATH=$(SRCDIR)/gnu/rts
+
+#Makefile for lib/gcc/mach/minix.i386/libsys.
+
+LIBRARY = ../../libc.a
+
+OBJECTS = \
+ _longjmp.o \
+ _setjmp.o \
+ longjmp.o \
+ setjmp.o \
+
+all: $(LIBRARY)
+
+$(LIBRARY): $(OBJECTS)
+ $(AR) cr $@ *.o
+
+_longjmp.o: _longjmp.s
+_setjmp.o: _setjmp.s
+longjmp.o: longjmp.s
+setjmp.o: setjmp.s
+
+# $PchId: Makefile,v 1.4 1996/02/22 21:54:11 philip Exp $
--- /dev/null
+/ _longjmp.gnu.s
+/
+/ Created: Oct 15, 1993 by Philip Homburg <philip@cs.vu.nl>
+
+.text
+.globl __longjmp
+__longjmp:
+ movl 4(%esp), %eax # jmp_buf
+ cmpl $0, 0(%eax) # save mask?
+ je 1f
+ leal 4(%eax), %ebx # pointer to sigset_t
+ pushl %ebx
+ call ___oldsigset # restore mask
+ addl $4, %esp
+ movl 4(%esp), %eax # jmp_buf
+1:
+ movl 8(%esp), %ecx # result value
+ movl 12(%eax), %esp # restore stack pointer
+
+ movl 8(%eax), %ebx # restore program counter
+ movl %ebx, 0(%esp)
+
+ pushl %ecx # save result code
+
+ movl 16(%eax), %ebp # restore frame pointer
+ movl 20(%eax), %ebx
+ movl 24(%eax), %ecx
+ movl 28(%eax), %edx
+ movl 32(%eax), %esi
+ movl 36(%eax), %edi
+ pop %eax
+ testl %eax, %eax
+ jz 1f
+ ret
+1: movl $1, %eax
+ ret
+
+/ $PchId: _longjmp.gnu.s,v 1.4 1996/03/12 19:30:02 philip Exp $
--- /dev/null
+/ _setjmp.gnu.s
+/
+/ Created: Oct 14, 1993 by Philip Homburg <philip@cs.vu.nl>
+
+.text
+.globl ___setjmp
+___setjmp:
+ movl 4(%esp), %eax # jmp_buf
+ movl %ebx, 20(%eax) # save ebx
+ movl 0(%esp), %ebx
+ movl %ebx, 8(%eax) # save program counter
+ movl %esp, 12(%eax) # save stack pointer
+ movl %ebp, 16(%eax) # save frame pointer
+ movl 20(%eax), %ebx # restore ebx
+ movl %ecx, 24(%eax)
+ movl %edx, 28(%eax)
+ movl %esi, 32(%eax)
+ movl %edi, 36(%eax)
+
+ movl 8(%esp), %ebx # save mask?
+ movl %ebx, 0(%eax) # save whether to restore mask
+ testl %ebx, %ebx
+ jz 1f
+ leal 4(%eax), %ebx # pointer to sigset_t
+ pushl %ebx
+ call ___newsigset # save mask
+ addl $4, %esp
+1:
+ movl $0, %eax
+ ret
+
+/ $PchId: _setjmp.gnu.s,v 1.4 1996/03/12 19:30:54 philip Exp $
--- /dev/null
+ .text
+.globl _longjmp
+_longjmp:
+ jmp __longjmp
+
+/ $PchId: longjmp.gnu.s,v 1.4 1996/03/12 19:31:18 philip Exp $
--- /dev/null
+ .text
+.globl _setjmp
+_setjmp:
+ jmp ___setjmp
+
+/ $PchId: setjmp.gnu.s,v 1.4 1996/03/12 19:31:18 philip Exp $