From d12053873a635986fca84fde57eb4fde435ce61b Mon Sep 17 00:00:00 2001 From: ceriel Date: Mon, 31 Jul 1989 14:54:53 +0000 Subject: [PATCH] adapted for changed floating point package --- mach/mantra/int/Makefile | 12 +++++++----- mach/mantra/int/con_float.c | 25 ++++++------------------- mach/mantra/int/mloop0 | 2 +- mach/mantra/int/mloop7 | 16 ++++++++-------- mach/mantra/int/mloopa | 1 - 5 files changed, 22 insertions(+), 34 deletions(-) diff --git a/mach/mantra/int/Makefile b/mach/mantra/int/Makefile index 146810604..71ef3cc1e 100644 --- a/mach/mantra/int/Makefile +++ b/mach/mantra/int/Makefile @@ -1,15 +1,17 @@ +EMHOME=../../.. INTS=em2_t--- em2_---- em2_t-cp em2_t-c- em2_t--p \ em4_t--- em4_---- em4_t-cp em4_t-c- em4_t--p P = mloop FILES=deffile $P0 $P1 $P2 $P3 $P4 $P5 $P6 $P7 $P8 $P9 $Pa $Pb $Pc -CPP=../../../lib/cpp -b=../../../lib/em +CPP=$(EMHOME)/lib/cpp +b=$(EMHOME)/lib/em +CFLAGS=-I$(EMHOME)/h -O FLTRAP= all: $(INTS) em em: em.c - $(CC) -o em -I../../../h em.c + $(CC) $(CFLAGS) -o em em.c tmp.s: $(FILES) cat $(FILES) > tmp.s @@ -46,8 +48,8 @@ em4_t--p: tmp.s compile con_float.o con_float.o: con_float.c case `ack_sys` in m68k2|pmds) \ - acc -mm68k4 -c -L -O con_float.c;; \ - *) acc -c -L -O con_float.c;; \ + acc -I$(EMHOME)/mach -mm68k4 -c -L -O con_float.c;; \ + *) acc -c -I$(EMHOME)/mach -L -O con_float.c;; \ esac compile: Makefile diff --git a/mach/mantra/int/con_float.c b/mach/mantra/int/con_float.c index f829ad0d6..155fa4c50 100644 --- a/mach/mantra/int/con_float.c +++ b/mach/mantra/int/con_float.c @@ -1,26 +1,13 @@ /* unfortunately, we cannot just do an atof and convert result to float - is neccessary, because that might result in over/underflow at an + if neccessary, because that might result in over/underflow at an unexpected moment. For the time being, overflow in floating point constants goes undetected */ -con_float(argval, str, res) + +#include + +con_float(str, argval, res) char *str, *res; { - double f; - double atof(); - int i; - double frexp(), ldexp(); - int j; - float fl; - char *p; - - f = atof(str); - if (f == 0 || argval == 8) { - p = (char *) &f; - while (argval--) *res++ = *p++; - return; - } - fl = f; - p = (char *) &fl; - while (argval--) *res++ = *p++; + float_cst(str, argval, res); } diff --git a/mach/mantra/int/mloop0 b/mach/mantra/int/mloop0 index 89e9e6a24..16641faa3 100644 --- a/mach/mantra/int/mloop0 +++ b/mach/mantra/int/mloop0 @@ -188,9 +188,9 @@ dofloat: movem.l a0/a1/d0-d2,-(sp) move.l a3,-(sp) add.l d0,a3 + move.l d0,-(sp) move.l a4,-(sp) move.l a4,flt_label - move.l d0,-(sp) bsr _con_float lea 12(sp),sp clr.l flt_label diff --git a/mach/mantra/int/mloop7 b/mach/mantra/int/mloop7 index 408dd5e9f..ad98fb11e 100644 --- a/mach/mantra/int/mloop7 +++ b/mach/mantra/int/mloop7 @@ -212,10 +212,14 @@ fif_l: adroff ; move.w (a5),d0 #else checkfsize 4: + move.l sp,-(sp) jsr .fif4 + add.l #4,sp jmp (a4) 8: + move.l sp,-(sp) jsr .fif8 + add.l #4,sp jmp (a4) #endif fif_z: @@ -228,20 +232,16 @@ fef_l: adroff ; move.w (a5),d0 #else checkfsize 4: - move.l (sp)+,d0 - clr.l -(sp) - move.l d0,-(sp) + move.l sp,-(sp) + sub.l #4,(sp) jsr .fef4 #ifndef lword add.l #2,sp #endif jmp (a4) 8: - move.l (sp)+,d0 - move.l (sp)+,d1 - clr.l -(sp) - move.l d1,-(sp) - move.l d0,-(sp) + move.l sp,-(sp) + sub.l #4,(sp) jsr .fef8 #ifndef lword add.l #2,sp diff --git a/mach/mantra/int/mloopa b/mach/mantra/int/mloopa index 36bef5c8d..3ccf918a9 100644 --- a/mach/mantra/int/mloopa +++ b/mach/mantra/int/mloopa @@ -344,7 +344,6 @@ lhalt: clr.l (a1)+ !skip file name bra 4b !only new line 9: - clr.l -(sp) .sect .data emlast: .asciz "em_last" mess1: .asciz "no line processed yet\n"