update for tahoe
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Tue, 4 Nov 1986 13:52:35 +0000 (05:52 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Tue, 4 Nov 1986 13:52:35 +0000 (05:52 -0800)
SCCS-vsn: usr.bin/f77/libF77/z_div.c 5.2
SCCS-vsn: usr.bin/f77/libF77/z_log.c 5.2
SCCS-vsn: usr.bin/f77/libF77/z_sqrt.c 5.2
SCCS-vsn: usr.bin/f77/libF77/trpfpe_.c 5.4
SCCS-vsn: usr.bin/f77/libF77/main.c 5.3

usr/src/usr.bin/f77/libF77/main.c
usr/src/usr.bin/f77/libF77/trpfpe_.c
usr/src/usr.bin/f77/libF77/z_div.c
usr/src/usr.bin/f77/libF77/z_log.c
usr/src/usr.bin/f77/libF77/z_sqrt.c

index 11f40e2..89ee809 100644 (file)
@@ -3,12 +3,14 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)main.c      5.2     %G%
+ *     @(#)main.c      5.3     %G%
  */
 #include <stdio.h>
 #include <signal.h>
 #include "../libI77/fiodefs.h"
 
  */
 #include <stdio.h>
 #include <signal.h>
 #include "../libI77/fiodefs.h"
 
+extern int errno;
+char *getenv();
 int xargc;
 char **xargv;
 
 int xargc;
 char **xargv;
 
@@ -61,6 +63,25 @@ struct action {
        {"Sig 16", 0},                  /* unassigned */
 };
 
        {"Sig 16", 0},                  /* unassigned */
 };
 
+#ifdef tahoe
+/* The following arrays are defined & used assuming that signal codes are 
+   1 to 5 for SIGFPE, and 0 to 3 for SIGILL. 
+   Actually ILL_ALIGN_FAULT=14, and is mapped to 3. */
+
+#define N_ACT_ILL 4                    /* number of entries in act_ill[] */
+#define N_ACT_FPE 5                    /* number of entries in act_fpe[] */
+#define ILL_ALIGN_FAULT 14
+
+struct action act_fpe[] = {
+       {"Integer overflow", 1},
+       {"Integer divide by 0", 1},
+       {"Floating divide by zero", 1},
+       {"Floating point overflow", 1},
+       {"Floating point underflow", 1},
+};
+
+#else vax || pdp11
+
 struct action act_fpe[] = {
        {"Integer overflow", 1},
        {"Integer divide by 0", 1},
 struct action act_fpe[] = {
        {"Integer overflow", 1},
        {"Integer divide by 0", 1},
@@ -73,22 +94,27 @@ struct action act_fpe[] = {
        {"Floating divide by zero", 0},
        {"Floating point underflow", 0},
 };
        {"Floating divide by zero", 0},
        {"Floating point underflow", 0},
 };
+#endif vax || pdp11
 
 struct action act_ill[] = {
        {"addr mode", 1},
        {"instruction", 1},
        {"operand", 0},
 
 struct action act_ill[] = {
        {"addr mode", 1},
        {"instruction", 1},
        {"operand", 0},
+#ifdef tahoe
+       {"alignment", 1},
+#endif tahoe
 };
 
 };
 
-#if    vax
+#if (defined(vax) || defined(tahoe))
 sigdie(s, t, sc)
 int s; int t; struct sigcontext *sc;
 
 #else  pdp11
 sigdie(s, t, sc)
 int s; int t; struct sigcontext *sc;
 
 #else  pdp11
+
 sigdie(s, t, pc)
 int s; int t; long pc;
 
 sigdie(s, t, pc)
 int s; int t; long pc;
 
-#endif
+#endif pdp11
 {
 extern unit units[];
 register struct action *act = &sig_act[s-1];
 {
 extern unit units[];
 register struct action *act = &sig_act[s-1];
@@ -104,15 +130,25 @@ if (act->mesg)
        fprintf(units[STDERR].ufd, "*** %s", act->mesg);
        if (s == SIGFPE)
                {
        fprintf(units[STDERR].ufd, "*** %s", act->mesg);
        if (s == SIGFPE)
                {
+#ifndef tahoe
                if (t >= 1 && t <= 10)
                if (t >= 1 && t <= 10)
+#else tahoe
+               if ((t-1) >= 0 && t < N_ACT_FPE)
+#endif tahoe
                        fprintf(units[STDERR].ufd, ": %s", act_fpe[t-1].mesg);
                else
                        fprintf(units[STDERR].ufd, ": Type=%d?", t);
                }
        else if (s == SIGILL)
                {
                        fprintf(units[STDERR].ufd, ": %s", act_fpe[t-1].mesg);
                else
                        fprintf(units[STDERR].ufd, ": Type=%d?", t);
                }
        else if (s == SIGILL)
                {
+#ifndef tahoe
                if (t == 4) t = 2;      /* 4.0bsd botch */
                if (t >= 0 && t <= 2)
                if (t == 4) t = 2;      /* 4.0bsd botch */
                if (t >= 0 && t <= 2)
+#else tahoe
+               if (t == ILL_ALIGN_FAULT)       /* ILL_ALIGN_FAULT maps to last
+                       t = N_ACT_ILL-1;           entry in act_ill[] */
+               if (t >= 0 && t < N_ACT_ILL)
+#endif tahoe
                        fprintf(units[STDERR].ufd, "%s", act_ill[t].mesg);
                else
                        fprintf(units[STDERR].ufd, "compat mode: Code=%d", t);
                        fprintf(units[STDERR].ufd, "%s", act_ill[t].mesg);
                else
                        fprintf(units[STDERR].ufd, "compat mode: Code=%d", t);
index 7f3d6cc..629e25f 100644 (file)
@@ -4,7 +4,7 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)trpfpe_.c   5.3     %G%
+ *     @(#)trpfpe_.c   5.4     %G%
  *
  *
  *     Fortran floating-point error handler
  *
  *
  *     Fortran floating-point error handler
index f9c0a8c..0cf57a2 100644 (file)
@@ -3,12 +3,15 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)z_div.c     5.1     %G%
+ *     @(#)z_div.c     5.2     %G%
  */
 
 #include "complex"
 #include <stdio.h>
 #include <errno.h>
  */
 
 #include "complex"
 #include <stdio.h>
 #include <errno.h>
+#ifdef tahoe
+#include <tahoemath/FP.h>
+#endif tahoe
 
 z_div(c, a, b)
 dcomplex *a, *b, *c;
 
 z_div(c, a, b)
 dcomplex *a, *b, *c;
@@ -16,10 +19,17 @@ dcomplex *a, *b, *c;
 double ratio, den;
 double abr, abi;
 
 double ratio, den;
 double abr, abi;
 
+#ifndef tahoe
 if( (abr = b->dreal) < 0.)
        abr = - abr;
 if( (abi = b->dimag) < 0.)
        abi = - abi;
 if( (abr = b->dreal) < 0.)
        abr = - abr;
 if( (abi = b->dimag) < 0.)
        abi = - abi;
+#else tahoe
+if( (abr = b->dreal) < 0.)
+       *((long int *)&abr) ^= SIGN_BIT;
+if( (abi = b->dimag) < 0.)
+       *((long int *)&abi) ^= SIGN_BIT;
+#endif tahoe
 if( abr <= abi )
        {
        if(abi == 0) {
 if( abr <= abi )
        {
        if(abi == 0) {
index ad50fbf..79e385a 100644 (file)
@@ -3,10 +3,13 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)z_log.c     5.1     %G%
+ *     @(#)z_log.c     5.2     %G%
  */
 
 #include "complex"
  */
 
 #include "complex"
+#ifdef tahoe
+#define cabs zabs
+#endif tahoe
 
 z_log(r, z)
 dcomplex *r, *z;
 
 z_log(r, z)
 dcomplex *r, *z;
index a7daaba..416ac6f 100644 (file)
@@ -3,10 +3,14 @@
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
  * All rights reserved.  The Berkeley software License Agreement
  * specifies the terms and conditions for redistribution.
  *
- *     @(#)z_sqrt.c    5.1     %G%
+ *     @(#)z_sqrt.c    5.2     %G%
  */
 
 #include "complex"
  */
 
 #include "complex"
+#ifdef tahoe
+#include <tahoemath/FP.h>
+#define cabs zabs
+#endif tahoe
 
 z_sqrt(r, z)
 dcomplex *r, *z;
 
 z_sqrt(r, z)
 dcomplex *r, *z;
@@ -24,7 +28,11 @@ else
        {
        r->dimag = sqrt(0.5 * (mag - z->dreal) );
        if(z->dimag < 0)
        {
        r->dimag = sqrt(0.5 * (mag - z->dreal) );
        if(z->dimag < 0)
+#ifndef tahoe
                r->dimag = - r->dimag;
                r->dimag = - r->dimag;
+#else tahoe
+               *((long int *)&r->dimag) ^= SIGN_BIT;
+#endif tahoe
        r->dreal = z->dimag / r->dimag / 2;
        }
 }
        r->dreal = z->dimag / r->dimag / 2;
        }
 }