G-format compilers for Ultrix/Unix Vaxes (1 of 4)

sources-request at panda.UUCP sources-request at panda.UUCP
Sat Nov 9 05:17:00 AEST 1985


Mod.sources:  Volume 3, Issue 37
Submitted by: J.D.Aplevich <watmath!watdcsu!aplevich>


This and three following files contain patches for  convert-
ing  the source for the Ultrix/BSD4.2 f77 compiler to run on
and to produce code for G-format Vaxes.

On a G (IEEE standard) format Vax, a "double" floating-point
number  is  represented by 1 sign bit, 11 exponent bits, and
52 bit significand, whereas on D-format machines a double is
represented  by 1 sign bit, 7 exponent bits, and 56 bit sig-
nificand.  Thus the numerical consequences of  G-format  are
increased  dynamic  range at the expense of 4 bits of preci-
sion.

In both formats a "float" is the same as the left 32 bits of
the D-format double, and consequently on a G-format machine,
any code will fail that explicitly requires a  float  to  be
the  top  half  of  a double, as it is on the older D-format
machines.  Examples are the Unix C and  f77  compilers,  and
code produced by them.

Some G-format machines are: certain versions of the MicroVax
I,  (which also emulates D-format instructions, with loss of
precision),  and  the  MicroVax  II,  which  supports   both
representations,  as do larger Vaxes with microcode options.
DEC does not supply either f77 or Pascal G-format  compilers
for Ultrix.

If one is equipped with a source license, it is possible  to
produce  the  patches required for converting the Ultrix (or
BSD 4.2) compiler to G-format. It is also necessary to  have
G-format  system  libraries  (libc, libm) as in G-format Ul-
trix, (but these are NOT included here).

Because f77 is a moving target, some of  these  patches  are
context diffs, rather than ordinary diffs.  They convert f77
source files to versions containing #ifdef  GFLOAT  switches
although  it would also be simple to have G-format as a com-
piler option, as in Ultrix C.  The widely-used patch program
from  L. Wall is recommended to handle the details. It would
have made sense to include its source here  but  that  would
have  increased  the  size of the distribution by 50Kb.  The
shar archives are of the directory `gfloat', which  contains
patches    to    routines   from   f77/src/f1,   f77/src/f2,
f77/src/f77pass1, libF77, and libU77.  A makefile is includ-
ed  to handle most of the details, as are fixes for a couple
of libc.a and libm.a routines.

CAVEAT COMPUTOR:
The code that results from these patches is, of course,  not
guaranteed to be bug-free, but has been tested by use on ap-
plications programs. It may be that we  have  not  exercised
code in which bugs exist.

ACKNOWLEDGMENT:
This material is a by-product of a project  undertaken  with
the  support  of  WATDEC,  a University of Waterloo, Digital
Equipment of Canada research contract.

SPECIAL BONUS OFFER: pc (Pascal)!
Once f77 works, it is very simple to get a usable pc working
on  a  G-format  machine.  Some  strings in /usr/lib/pc0 and
/usr/lib/pc2 have to be changed using adb.  In  the  version
we have, in pc0 we change

     `double 0d' at location 18284 to `gfloat 0g'
and in pc2, we change

     `cvtrdl' at location 100e to `cvtrgl',
     `cvtdl' at location 102a to `cvtgl',
     `cvtld' at location 197f to `cvtlg',
     `divd2' at location 198b to `divg2',
     `0d2.' at location 1993 to `0g2.'

It might be necessary to locate these strings using
`od -s <file> 0x0' .

-------------- cut here --------------------------------------------
#!/bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #!/bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	gfloat
# This archive created: Tue Oct 29 20:28:27 1985
export PATH; PATH=/bin:$PATH
if test ! -d 'gfloat'
then
	mkdir 'gfloat'
fi
cd 'gfloat'
if test -f 'Makefile'
then
	echo shar: over-writing existing file "'Makefile'"
fi
cat << \SHAR_EOF > 'Makefile'
# Files changed in G-float code.
f1FILES = local2.c otable.c table.c Makefile

f2FILES = c22.c Makefile

pass1FILES = bb.c\
conv.c\
conv.h\
defs.h\
expr.c\
intr.c\
optcse.c\
optloop.c\
put.c\
vax.c\
Makefile

libF77FILES = \
opcodes.h\
besj0_.c\
besj1_.c\
besjn_.c\
besy0_.c\
besy1_.c\
besyn_.c\
c_abs.c\
erf_.c\
erfc_.c\
pow_ri.c\
r_abs.c\
r_acos.c\
r_asin.c\
r_atan.c\
r_atn2.c\
r_cos.c\
r_cosh.c\
r_dim.c\
r_exp.c\
r_imag.c\
r_int.c\
r_lg10.c\
r_log.c\
r_mod.c\
r_nint.c\
r_sign.c\
r_sin.c\
r_sinh.c\
r_sqrt.c\
r_tan.c\
r_tanh.c\
rand_.c\
range.c\
trapov_.c\
trpfpe_.c\
Makefile

libU77FILES =\
dtime_.c\
Makefile

LIB =
FILES =
DFLG =

# Generate diffs between original source and G-float switched source.
# Diffs are put into the local diff directories only.

diffs:  f1diffs f2diffs pass1diffs libFdiffs libUdiffs

cdiffs: 
	@make DFLG="-c" diffs

netdiffs:
	@make DFLG="-c" f1diffs
	@make           f2diffs
	@make DFLG="-c" pass1diffs
	@make           libFdiffs
	@make           libUdiffs

f1diffs:
	@make FILES="$(f1FILES)" LIB=f77/src/f1 DFLG="$(DFLG)" mkdiffs

f2diffs:
	@make FILES="$(f2FILES)" LIB=f77/src/f2 DFLG="$(DFLG)" mkdiffs

pass1diffs:
	@make FILES="$(pass1FILES)" LIB=f77/src/f77pass1 DFLG="$(DFLG)" mkdiffs

libFdiffs:
	@make FILES="$(libF77FILES)" LIB=libF77 DFLG="$(DFLG)" mkdiffs

libUdiffs:
	@make FILES="$(libU77FILES)" LIB=libU77 DFLG="$(DFLG)" mkdiffs

mkdiffs:
	@-for i in ${FILES} ; do echo $(LIB)/$$i.diff ; \
        diff $(DFLG) ../$(LIB)/$$i.orig ../$(LIB)/$$i > $(LIB)/$$i.diff ; done

# Remove local diff files.

cleandiffs:
	rm -f f77/src/f1/*.diff
	rm -f f77/src/f2/*.diff
	rm -f f77/src/f77pass1/*.diff
	rm -f libF77/*.diff
	rm -f libU77/*.diff

reallyclean:
	make orig
	(cd ../f77/src/f77; rm -f *.o mkvers Version Version.c)
	(cd ../f77/src/f1; rm -f *.o mkvers Version Version.c)
	(cd ../f77/src/f2; rm -f *.o mkvers Version Version.c)
	(cd ../f77/src/f77pass1; rm -f *.o mkvers Version Version.c \
                                 tokdefs.h gram.in gram.c)
	(cd ../libF77; rm -f *.o mkvers Version Version.c *.a mkindx)
	(cd ../libF77/profiled; rm -f *.o mkvers Version Version.c)
	(cd ../libI77; rm -f *.o mkvers Version Version.c *.a mkindx)
	(cd ../libI77/profiled; rm -f *.o mkvers Version Version.c)
	(cd ../libU77; rm -f *.o mkvers Version Version.c *.a mkindx)
	(cd ../libU77/profiled; rm -f *.o mkvers Version Version.c)

all:
	make mods
	(cd ../f77; make install)
	(cd ../libF77; make install)
	(cd ../libI77; make install)
	(cd ../libU77; make install)

# Apply local diff files to local source, moving source to *.orig.

mods:   f1mods f2mods pass1mods libFmods libUmods

f1mods:
	@make FILES="$(f1FILES)" LIB=f77/src/f1 makemod

f2mods:
	@make FILES="$(f2FILES)" LIB=f77/src/f2 makemod

pass1mods:
	@make FILES="$(pass1FILES)" LIB=f77/src/f77pass1 makemod

libFmods:
	@make FILES="$(libF77FILES)" LIB=libF77 makemod

libUmods:
	@make FILES="$(libU77FILES)" LIB=libU77 makemod

makemod:
	@-for i in ${FILES} ; do if test ! -f ../$(LIB)/$$i.orig ; then \
        echo $(LIB)/$$i ; patch ../$(LIB)/$$i $(LIB)/$$i.diff ; \
        fi done

# Move *.orig files back in place, restoring source to original condition.

orig: f1orig f2orig pass1orig libForig libUorig

f1orig:
	@make FILES="$(f1FILES)" LIB=f77/src/f1 makeorig
f2orig:
	@make FILES="$(f2FILES)" LIB=f77/src/f2 makeorig
pass1orig:
	@make FILES="$(pass1FILES)" LIB=f77/src/f77pass1 makeorig
libForig:
	@make FILES="$(libF77FILES)" LIB=libF77 makeorig
libUorig:
	@make FILES="$(libU77FILES)" LIB=libU77 makeorig

makeorig:
	@-for i in $(FILES); do if test -f $(LIB)/$$i.diff ; then \
        mv ../$(LIB)/$$i.orig ../$(LIB)/$$i; fi done
SHAR_EOF
chmod +x 'Makefile'
if test -f 'READ_ME'
then
	echo shar: over-writing existing file "'READ_ME'"
fi
cat << \SHAR_EOF > 'READ_ME'

     This directory contains a  makefile  for  handling  the
differences between the f77 compiler source and the modified
source with G-float switches in it.

     An original f77 source is kept, along with a  directory
tree in gfloat (this directory) containing diff(1) files for
constructing a source containing `#ifdef GFLOAT' switches.

1.   To make a source containing the G-float  switches,  put
     this  (gfloat)  directory into the new source directory
     at the same level as the libF77, LibU77, and f77 source
     directories  (or  links  to them). That is, the command
     `lc' should give something like

             Directories:
             f77    gfloat    libF77     libI77     libU77

     Now in gfloat, type `make  mods'.  In  each  directory,
     original  files will be copied into *.orig before being
     replaced by modified files of the original name, so you
     need write permission everywhere.

     To help  avoid  blunders,  if  a  *.orig  file  already
     exists, the file modification is silently ignored.

     If the source is not identical to the source from which
     the  diff  files  were  made and context diffs were not
     used, patch may fail. In this case, the  following  may
     be tried:

     a)   Apply `make mods'  to  the  original  source  from
          which  the diffs were obtained (if you have it, of
          course).

     b)   Type `make cdiffs' to create  context  diff  files
          (see  3.  below), copy the resulting gfloat direc-
          tory as before  into  the  directory  of  the  new
          source,  and  try  `make  mods'  again.  This time
          patch is using context diffs, and should have more
          success.    Correct  patches  are  of  course  not
          guaranteed, but gross failures are detected.  They
          have to be corrected by hand.

2.   To restore the source directory to original form,  type
     `make  orig',  which  moves  the *.orig files back into
     place.  To help avoid losing modified files obtained at
     much sweat, the move is ignored if an appropriate .diff
     file does not exist.  However the time of last  modifi-
     cation is not checked.

3.   To compile and install the  G-float  code,  do  step  1
     above,  then  in  f77,  libF77, libI77, and libU77 type
     `make' or `make install' in the usual  way,  since  the
     relevant Makefiles are modified to include the -DGFLOAT
     CFLAG.  If you are really optimistic, type  `make  all'
     from here and come back in about 3 hours.

4.   To compute the diff files, use make  diffs  Which  con-
     structs the diff files from the *.c and *.c.orig files.
     Note that diff(1) correctly returns Error code  1  mes-
     sages.  Directories containing changed files are:
      f77/src/f1
      f77/src/f2
      f77/src/f77pass1
      libF77
      libU77

     If more files have to be modified, be sure to copy  the
     original  into  *.orig first, and include the file name
     in the appropriate place in Makefile.

     Because the f77 source  is  a  moving  target,  context
     diffs may be required, and this is where the patch pro-
     gram comes in handy. To make context diffs,  use  `make
     cdiffs'.

5.   The Ultrix G-float C  compiler  contains  a  bug.   For
     example, a call to the modified libF77/r_sin.c routine

                  float r_sin(x)
                  float *x;
                  {
                  double sin();
                  return( sin(*x) );
                  }

     returns a $#?!!*#@ double (NOT a float) in register  0.
     Refer  to section 9.10 of "The C Programming Language -
     Reference  Manual"  by  Dennis  M.  Ritchie.   This  is
     invisible  when  programming  in C because the compiler
     has another bug that treats the  returned  value  of  a
     float  function  as  a double.  The bug becomes visible
     when we interface assembly language to C, or  as  here,
     hack  a  compiler  to  produce  assembly language which
     calls functions written and compiled  in  C.   An  ugly
     union  has  had to be used to force a float return in a
     bunch of library functions, since accepting it as  dou-
     ble  would coerce the fortran expression containing the
     function reference to be double precision.

SHAR_EOF
chmod +x 'READ_ME'
if test ! -d 'libF77'
then
	mkdir 'libF77'
fi
cd 'libF77'
if test -f 'c_abs.c.diff'
then
	echo shar: over-writing existing file "'c_abs.c.diff'"
fi
cat << \SHAR_EOF > 'c_abs.c.diff'
11c11,17
< 
---
> #ifdef GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
>   res.r[0] = cabs( z->real, z->imag );
>   return( res.d ); 
> #else GFLOAT
12a19
> #endif GFLOAT
SHAR_EOF
chmod +x 'c_abs.c.diff'
if test -f 'opcodes.h.diff'
then
	echo shar: over-writing existing file "'opcodes.h.diff'"
fi
cat << \SHAR_EOF > 'opcodes.h.diff'
2c2
<  * "@(#)opcodes.h	1.1" Vax op codes defined here
---
>  * "@(#)opcodes.h	1.2" Vax op codes defined here
7a8
> # define ACBG		0x4ffd
9a11
> # define ADDG2		0x40fd
10a13
> # define ADDG3		0x41fd
13a17
> # define CMPG		0x51fd
14a19
> # define CVTBG		0x4cfd
15a21
> # define CVTGB		0x48fd
16a23
> # define CVTGF		0x33fd
17a25
> # define CVTGL		0x4afd
18a27
> # define CVTGW		0x49fd
20a30
> # define CVTFG		0x56fd
23a34
> # define CVTRGL		0x4bfd
25a37
> # define DIVG2		0x46fd
26a39
> # define DIVG3		0x47fd
29a43
> # define EMODG		0x54fd
31a46
> # define MNEGG		0x52fd
33a49
> # define MOVG		0x50fd
35a52
> # define MULG2		0x44fd
36a54
> # define MULG3		0x45fd
39a58
> # define POLYG		0x55fd
41a61
> # define SUBG2		0x42fd
42a63
> # define SUBG3		0x43fd
45a67
> # define TSTG		0x53fd
SHAR_EOF
chmod +x 'opcodes.h.diff'
if test -f 'r_abs.c.diff'
then
	echo shar: over-writing existing file "'r_abs.c.diff'"
fi
cat << \SHAR_EOF > 'r_abs.c.diff'
7a8
> #ifndef GFLOAT
10a12,20
> #else GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
>   res.r[0] = *x;
>   if(*x >= 0)
> 	return( res.d );
>   return( -res.d );
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_abs.c.diff'
if test -f 'r_acos.c.diff'
then
	echo shar: over-writing existing file "'r_acos.c.diff'"
fi
cat << \SHAR_EOF > 'r_acos.c.diff'
8a9
> #ifndef GFLOAT
9a11,17
> #else GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
>   res.r[0] = acos( *x );
>   return( res.d );
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_acos.c.diff'
if test -f 'r_asin.c.diff'
then
	echo shar: over-writing existing file "'r_asin.c.diff'"
fi
cat << \SHAR_EOF > 'r_asin.c.diff'
8a9
> #ifndef GFLOAT
9a11,17
> #else GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
>   res.r[0] = asin( *x );
>   return( res.d );
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_asin.c.diff'
if test -f 'r_atan.c.diff'
then
	echo shar: over-writing existing file "'r_atan.c.diff'"
fi
cat << \SHAR_EOF > 'r_atan.c.diff'
8a9
> #ifndef GFLOAT
9a11,17
> #else GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
>   res.r[0] = atan( *x );
>   return( res.d );
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_atan.c.diff'
if test -f 'r_atn2.c.diff'
then
	echo shar: over-writing existing file "'r_atn2.c.diff'"
fi
cat << \SHAR_EOF > 'r_atn2.c.diff'
8a9
> #ifndef GFLOAT
9a11,17
> #else GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
>   res.r[0] = atan2(*x,*y);
>   return( res.d );
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_atn2.c.diff'
if test -f 'r_cos.c.diff'
then
	echo shar: over-writing existing file "'r_cos.c.diff'"
fi
cat << \SHAR_EOF > 'r_cos.c.diff'
8a9
> #ifndef GFLOAT
9a11,17
> #else GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
>   res.r[0] = cos( *x );
>   return( res.d );
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_cos.c.diff'
if test -f 'r_cosh.c.diff'
then
	echo shar: over-writing existing file "'r_cosh.c.diff'"
fi
cat << \SHAR_EOF > 'r_cosh.c.diff'
8a9
> #ifndef GFLOAT
9a11,17
> #else GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
>   res.r[0] = cosh( *x );
>   return( res.d );
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_cosh.c.diff'
if test -f 'r_dim.c.diff'
then
	echo shar: over-writing existing file "'r_dim.c.diff'"
fi
cat << \SHAR_EOF > 'r_dim.c.diff'
7a8
> #ifndef GFLOAT
8a10,16
> #else GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
>   res.r[0] = *a - *b;
>   return( *a > *b ? res.d : 0);
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_dim.c.diff'
if test -f 'r_exp.c.diff'
then
	echo shar: over-writing existing file "'r_exp.c.diff'"
fi
cat << \SHAR_EOF > 'r_exp.c.diff'
8a9
> #ifndef GFLOAT
9a11,17
> #else GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
>   res.r[0] = exp( *x );
>   return( res.d );
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_exp.c.diff'
if test -f 'r_imag.c.diff'
then
	echo shar: over-writing existing file "'r_imag.c.diff'"
fi
cat << \SHAR_EOF > 'r_imag.c.diff'
9a10
> #ifndef GFLOAT
10a12,18
> #else GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
>   res.r[0] = z->imag;
>   return( res.d );
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_imag.c.diff'
if test -f 'r_int.c.diff'
then
	echo shar: over-writing existing file "'r_int.c.diff'"
fi
cat << \SHAR_EOF > 'r_int.c.diff'
8a9
> #ifndef GFLOAT
10a12,18
> #else GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
>   res.r[0] = (*x >= 0) ? floor(*x) : -floor(- *x);
>   return( res.d ); 
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_int.c.diff'
if test -f 'r_lg10.c.diff'
then
	echo shar: over-writing existing file "'r_lg10.c.diff'"
fi
cat << \SHAR_EOF > 'r_lg10.c.diff'
10a11
> #ifndef GFLOAT
12a14,20
> #else GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
>   res.r[0] = log10e * log( *x );
>   return( res.d );
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_lg10.c.diff'
if test -f 'r_log.c.diff'
then
	echo shar: over-writing existing file "'r_log.c.diff'"
fi
cat << \SHAR_EOF > 'r_log.c.diff'
8a9
> #ifndef GFLOAT
9a11,17
> #else GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
>   res.r[0] = log( *x );
>   return( res.d );
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_log.c.diff'
if test -f 'r_mod.c.diff'
then
	echo shar: over-writing existing file "'r_mod.c.diff'"
fi
cat << \SHAR_EOF > 'r_mod.c.diff'
7a8,12
> #ifdef GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
> #endif GFLOAT
12a18
> #ifndef GFLOAT
13a20,23
> #else GFLOAT
> res.r[0] = *x - (*y) * quotient;
> return( res.d );
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_mod.c.diff'
if test -f 'r_nint.c.diff'
then
	echo shar: over-writing existing file "'r_nint.c.diff'"
fi
cat << \SHAR_EOF > 'r_nint.c.diff'
8a9,13
> #ifdef GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
> #endif GFLOAT
9a15
> #ifndef GFLOAT
11a18,22
> #else GFLOAT
>   res.r[0] = (*x)>=0 ?
> 	floor(*x + .5) : -floor(.5 - *x);
>   return( res.d );
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_nint.c.diff'
if test -f 'r_sign.c.diff'
then
	echo shar: over-writing existing file "'r_sign.c.diff'"
fi
cat << \SHAR_EOF > 'r_sign.c.diff'
8a9,13
> #ifdef GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
> #endif GFLOAT
9a15
> #ifndef GFLOAT
10a17,20
> #else GFLOAT
> res.r[0] = *b >= 0 ? x : -x;
> return( res.d ); 
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_sign.c.diff'
if test -f 'r_sin.c.diff'
then
	echo shar: over-writing existing file "'r_sin.c.diff'"
fi
cat << \SHAR_EOF > 'r_sin.c.diff'
8a9
> #ifndef GFLOAT
9a11,17
> #else GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
>   res.r[0] = sin( *x );
>   return( res.d );
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_sin.c.diff'
if test -f 'r_sinh.c.diff'
then
	echo shar: over-writing existing file "'r_sinh.c.diff'"
fi
cat << \SHAR_EOF > 'r_sinh.c.diff'
8a9
> #ifndef GFLOAT
9a11,17
> #else GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
>   res.r[0] = sinh( *x );
>   return( res.d );
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_sinh.c.diff'
if test -f 'r_sqrt.c.diff'
then
	echo shar: over-writing existing file "'r_sqrt.c.diff'"
fi
cat << \SHAR_EOF > 'r_sqrt.c.diff'
8a9
> #ifndef GFLOAT
9a11,17
> #else GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
>   res.r[0] = sqrt( *x );
>   return( res.d );
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_sqrt.c.diff'
if test -f 'r_tan.c.diff'
then
	echo shar: over-writing existing file "'r_tan.c.diff'"
fi
cat << \SHAR_EOF > 'r_tan.c.diff'
8a9
> #ifndef GFLOAT
9a11,17
> #else GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
>   res.r[0] = tan( *x );
>   return( res.d );
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_tan.c.diff'
if test -f 'r_tanh.c.diff'
then
	echo shar: over-writing existing file "'r_tanh.c.diff'"
fi
cat << \SHAR_EOF > 'r_tanh.c.diff'
8a9
> #ifndef GFLOAT
9a11,17
> #else GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
>   res.r[0] = tanh( *x );
>   return( res.d );
> #endif GFLOAT
SHAR_EOF
chmod +x 'r_tanh.c.diff'
if test -f 'range.c.diff'
then
	echo shar: over-writing existing file "'range.c.diff'"
fi
cat << \SHAR_EOF > 'range.c.diff'
77a78,81
> #ifndef GFLOAT
> #else GFLOAT
> 	n.j[0] = 0x00000010;
> #endif GFLOAT
117a122
> #ifndef GFLOAT
118a124,126
> #else GFLOAT
> 	n.j[0] = 0x0000681e;
> #endif GFLOAT
SHAR_EOF
chmod +x 'range.c.diff'
if test -f 'trapov_.c.diff'
then
	echo shar: over-writing existing file "'trapov_.c.diff'"
fi
cat << \SHAR_EOF > 'trapov_.c.diff'
55a56,58
> #ifdef GFLOAT
> # define G		4
> #endif GFLOAT
241a245,249
> #ifdef GFLOAT
> /* kludge for Gfloat  */
> 	if (operand_type(opcode, o_no)==F && (fetch_byte() & 0xff)==0xfd)
> 		opcode = opcode<<8 + 0xfd;
> #endif GFLOAT
250a259
> #ifndef GFLOAT
251a261,263
> #else GFLOAT
> 	if (opcode == POLYG || opcode == POLYF) {
> #endif GFLOAT
255a268
> #ifndef GFLOAT
256a270,272
> #else GFLOAT
> 	if (opcode == EMODG || opcode == EMODF) {
> #endif GFLOAT
266a283
> #ifndef GFLOAT
267a285,287
> #else GFLOAT
> 		if (type != F && type != G) {
> #endif GFLOAT
272c292
< 		/* F or D operand.  Check it out */
---
> 		/* F or D (or G) operand.  Check it out */
282a303
> #ifndef GFLOAT
283a305,307
> #else GFLOAT
> 		} else if (type == G && opnd->o_long == 0x00008000) {
> #endif GFLOAT
307a332
> #ifndef GFLOAT
317a343,354
> #else GFLOAT
> 		case ACBG:	case ACBF:	case ADDG2:	case ADDG3:
> 		case ADDF2:	case ADDF3:	case CMPG:	case CMPF:
> 		case CVTGB:	case CVTGF:	case CVTGL:	case CVTGW:
> 		case CVTFB:	case CVTFG:	case CVTFL:	case CVTFW:
> 		case CVTRGL:	case CVTRFL:	case DIVG2:	case DIVG3:
> 		case DIVF2:	case DIVF3:	case EMODG:	case EMODF:
> 		case MNEGG:	case MNEGF:	case MOVG:	case MOVF:
> 		case MULG2:	case MULG3:	case MULF2:	case MULF3:
> 		case POLYG:	case POLYF:	case SUBG2:	case SUBG3:
> 		case SUBF2:	case SUBF3:	case TSTG:	case TSTF:
> #endif GFLOAT
325c362
<  * got_illegal_poly - handle an illegal POLY[DF] instruction.
---
>  * got_illegal_poly - handle an illegal POLY[DFG] instruction.
360a398
> #ifndef GFLOAT
361a400,402
> #else GFLOAT
> 		case ACBG:
> #endif GFLOAT
364a406
> #ifndef GFLOAT
366d407
< 		case MNEGF:
368d408
< 		case MOVF:
369a410,416
> #else GFLOAT
> 		case MNEGG:
> 		case MOVG:
> 		case TSTG:
> #endif GFLOAT
> 		case MNEGF:
> 		case MOVF:
381c428
<  *	operand_type - is the operand a D or an F?
---
>  *	operand_type - is the operand a D, F or G?
391a439,441
> #ifdef GFLOAT
> 	if (opcode >= 0x40fd && opcode <= 0x56fd) return G;
> #endif GFLOAT
636a687
> #ifndef GFLOAT
638d688
< 		case ACBF: 	return "ACBF";
641,642d690
< 		case ADDF2: 	return "ADDF2";
< 		case ADDF3: 	return "ADDF3";
644d691
< 		case CMPF: 	return "CMPF";
646a694
> 		case CVTFD: 	return "CVTFD";
648a697,735
> 		case CVTRDL: 	return "CVTRDL";
> 		case DIVD2: 	return "DIVD2";
> 		case DIVD3: 	return "DIVD3";
> 		case EMODD: 	return "EMODD";
> 		case MNEGD: 	return "MNEGD";
> 		case MOVD: 	return "MOVD";
> 		case MULD2: 	return "MULD2";
> 		case MULD3: 	return "MULD3";
> 		case POLYD: 	return "POLYD";
> 		case SUBD2: 	return "SUBD2";
> 		case SUBD3: 	return "SUBD3";
> 		case TSTD: 	return "TSTD";
> #else GFLOAT
> 		case ACBG: 	return "ACBG";
> 		case ADDG2: 	return "ADDG2";
> 		case ADDG3: 	return "ADDG3";
> 		case CMPG: 	return "CMPG";
> 		case CVTGB: 	return "CVTGB";
> 		case CVTGF: 	return "CVTGF";
> 		case CVTFG: 	return "CVTFG";
> 		case CVTGL: 	return "CVTGL";
> 		case CVTGW: 	return "CVTGW";
> 		case CVTRGL: 	return "CVTRGL";
> 		case DIVG2: 	return "DIVG2";
> 		case DIVG3: 	return "DIVG3";
> 		case EMODG: 	return "EMODG";
> 		case MNEGG: 	return "MNEGG";
> 		case MOVG: 	return "MOVG";
> 		case MULG2: 	return "MULG2";
> 		case MULG3: 	return "MULG3";
> 		case POLYG: 	return "POLYG";
> 		case SUBG2: 	return "SUBG2";
> 		case SUBG3: 	return "SUBG3";
> 		case TSTG: 	return "TSTG";
> #endif GFLOAT
> 		case ACBF: 	return "ACBF";
> 		case ADDF2: 	return "ADDF2";
> 		case ADDF3: 	return "ADDF3";
> 		case CMPF: 	return "CMPF";
650d736
< 		case CVTFD: 	return "CVTFD";
653d738
< 		case CVTRDL: 	return "CVTRDL";
655,656d739
< 		case DIVD2: 	return "DIVD2";
< 		case DIVD3: 	return "DIVD3";
659d741
< 		case EMODD: 	return "EMODD";
661d742
< 		case MNEGD: 	return "MNEGD";
663d743
< 		case MOVD: 	return "MOVD";
665,666d744
< 		case MULD2: 	return "MULD2";
< 		case MULD3: 	return "MULD3";
669d746
< 		case POLYD: 	return "POLYD";
671,672d747
< 		case SUBD2: 	return "SUBD2";
< 		case SUBD3: 	return "SUBD3";
675d749
< 		case TSTD: 	return "TSTD";
SHAR_EOF
chmod +x 'trapov_.c.diff'
if test -f 'trpfpe_.c.diff'
then
	echo shar: over-writing existing file "'trpfpe_.c.diff'"
fi
cat << \SHAR_EOF > 'trpfpe_.c.diff'
403c403,404
< 
---
> /* This isn't going to work for G-format instructions because
>  * they are 2 characters long */
405a407
> #ifndef GFLOAT
409a412,417
> #else GFLOAT
> 		case ADDG3:
> 		case DIVG3:
> 		case MULG3:
> 		case SUBG3:
> #endif GFLOAT
412a421
> #ifndef GFLOAT
418a428,435
> #else GFLOAT
> 		case ADDG2:
> 		case DIVG2:
> 		case MULG2:
> 		case SUBG2:
> 		case MNEGG:
> 		case MOVG:
> #endif GFLOAT
441a459
> #ifndef GFLOAT
442a461,463
> #else GFLOAT
> 		case CVTGF:
> #endif GFLOAT
447a469
> #ifndef GFLOAT
448a471,473
> #else GFLOAT
> 		case CVTFG:
> #endif GFLOAT
454a480
> #ifndef GFLOAT
455a482,484
> #else GFLOAT
> 		case EMODG:
> #endif GFLOAT
459a489
> #ifndef GFLOAT
460a491,493
> #else GFLOAT
> 		case POLYG:
> #endif GFLOAT
463a497
> #ifndef GFLOAT
464a499,501
> #else GFLOAT
> 		case ACBG:
> #endif GFLOAT
465a503
> #ifndef GFLOAT
466a505,507
> #else GFLOAT
> 		case CMPG:
> #endif GFLOAT
467a509
> #ifndef GFLOAT
468a511,513
> #else GFLOAT
> 		case TSTG:
> #endif GFLOAT
469a515
> #ifndef GFLOAT
472a519,523
> #else GFLOAT
> 		case CVTGB:
> 		case CVTGL:
> 		case CVTGW:
> #endif GFLOAT
475a527
> #ifndef GFLOAT
476a529,531
> #else GFLOAT
> 		case CVTRGL:
> #endif GFLOAT
SHAR_EOF
chmod +x 'trpfpe_.c.diff'
if test -f 'Makefile.diff'
then
	echo shar: over-writing existing file "'Makefile.diff'"
fi
cat << \SHAR_EOF > 'Makefile.diff'
7c7
< CFLAGS	      = -O
---
> CFLAGS	      = -O -DGFLOAT
161c161
< OPTIONS	      = -DUCBVAX
---
> OPTIONS	      = -DUCBVAX -DGFLOAT
SHAR_EOF
chmod +x 'Makefile.diff'
if test -f 'pow_ri.c.diff'
then
	echo shar: over-writing existing file "'pow_ri.c.diff'"
fi
cat << \SHAR_EOF > 'pow_ri.c.diff'
10a11,15
> #ifdef GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
> #endif GFLOAT
21a27
> #ifndef GFLOAT
22a29,32
> #else GFLOAT
> 			res.r[0] = pow;
> 			return(res.d);
> #endif GFLOAT
36a47
> #ifndef GFLOAT
37a49,52
> #else GFLOAT
> res.r[0] = pow;
> return(res.d);
> #endif GFLOAT
SHAR_EOF
chmod +x 'pow_ri.c.diff'
if test -f 'besj0_.c.diff'
then
	echo shar: over-writing existing file "'besj0_.c.diff'"
fi
cat << \SHAR_EOF > 'besj0_.c.diff'
9a10,16
> #ifdef GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
> 	res.r[0] = ((float)j0((double)*x));
> 	return( res.d );
> #else GFLOAT
10a18
> #endif GFLOAT
SHAR_EOF
chmod +x 'besj0_.c.diff'
if test -f 'besj1_.c.diff'
then
	echo shar: over-writing existing file "'besj1_.c.diff'"
fi
cat << \SHAR_EOF > 'besj1_.c.diff'
9a10,16
> #ifdef GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
> 	res.r[0] = ((float)j1((double)*x));
> 	return( res.d );
> #else GFLOAT
10a18
> #endif GFLOAT
SHAR_EOF
chmod +x 'besj1_.c.diff'
if test -f 'besjn_.c.diff'
then
	echo shar: over-writing existing file "'besjn_.c.diff'"
fi
cat << \SHAR_EOF > 'besjn_.c.diff'
9a10,16
> #ifdef GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
> 	res.r[0] = ((float)jn((int)*n, (double)*x));
> 	return( res.d );
> #else GFLOAT
10a18
> #endif GFLOAT
SHAR_EOF
chmod +x 'besjn_.c.diff'
if test -f 'besy0_.c.diff'
then
	echo shar: over-writing existing file "'besy0_.c.diff'"
fi
cat << \SHAR_EOF > 'besy0_.c.diff'
9a10,16
> #ifdef GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
> 	res.r[0] = ((float)y0((double)*x));
> 	return( res.d );
> #else GFLOAT
10a18
> #endif GFLOAT
SHAR_EOF
chmod +x 'besy0_.c.diff'
if test -f 'besy1_.c.diff'
then
	echo shar: over-writing existing file "'besy1_.c.diff'"
fi
cat << \SHAR_EOF > 'besy1_.c.diff'
9a10,16
> #ifdef GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
> 	res.r[0] = ((float)y1((double)*x));
> 	return( res.d );
> #else GFLOAT
10a18
> #endif GFLOAT
SHAR_EOF
chmod +x 'besy1_.c.diff'
if test -f 'besyn_.c.diff'
then
	echo shar: over-writing existing file "'besyn_.c.diff'"
fi
cat << \SHAR_EOF > 'besyn_.c.diff'
9a10,16
> #ifdef GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
> 	res.r[0] = ((float)yn((int)*n, (double)*x));
> 	return( res.d );
> #else GFLOAT
10a18
> #endif GFLOAT
SHAR_EOF
chmod +x 'besyn_.c.diff'
if test -f 'erf_.c.diff'
then
	echo shar: over-writing existing file "'erf_.c.diff'"
fi
cat << \SHAR_EOF > 'erf_.c.diff'
9c9,15
< 
---
> #ifdef GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
> res.r[0] = erf(*x);
> return( res.d );
> #else GFLOAT
10a17
> #endif GFLOAT
SHAR_EOF
chmod +x 'erf_.c.diff'
if test -f 'erfc_.c.diff'
then
	echo shar: over-writing existing file "'erfc_.c.diff'"
fi
cat << \SHAR_EOF > 'erfc_.c.diff'
9c9,15
< 
---
> #ifdef GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
> res.r[0] = erfc(*x);
> return( res.d );
> #else GFLOAT
10a17
> #endif GFLOAT
SHAR_EOF
chmod +x 'erfc_.c.diff'
if test -f 'rand_.c.diff'
then
	echo shar: over-writing existing file "'rand_.c.diff'"
fi
cat << \SHAR_EOF > 'rand_.c.diff'
42a43,47
> #ifdef GFLOAT
> union { double d;
> 	float r[2];
> 	} res;
> #endif GFLOAT
43a49
> #ifndef GFLOAT
44a51,54
> #else GFLOAT
> 	res.r[0] = ( (float)(rand())/(float)RANDMAX );
> 	return( res.d );
> #endif GFLOAT
SHAR_EOF
chmod +x 'rand_.c.diff'
chdir ..
chdir ..
#	End of shell archive
exit 0



More information about the Mod.sources mailing list