diff options
author | obrien <obrien@FreeBSD.org> | 1999-09-19 05:59:11 +0000 |
---|---|---|
committer | obrien <obrien@FreeBSD.org> | 1999-09-19 05:59:11 +0000 |
commit | c53c47e769827bb2d6d596865051a4af89d246fd (patch) | |
tree | 354ca5598013982362bb6e08cf4b5d6b79b0c370 /contrib/libf2c/libF77 | |
parent | 98e51635e2084da6cfe0d3b1782cb95b80fd2caa (diff) | |
download | FreeBSD-src-c53c47e769827bb2d6d596865051a4af89d246fd.zip FreeBSD-src-c53c47e769827bb2d6d596865051a4af89d246fd.tar.gz |
Virgin import of GCC 2.95.1's libf2c
Diffstat (limited to 'contrib/libf2c/libF77')
29 files changed, 544 insertions, 376 deletions
diff --git a/contrib/libf2c/libF77/F77_aloc.c b/contrib/libf2c/libF77/F77_aloc.c index 8754fe2..e329a1b 100644 --- a/contrib/libf2c/libF77/F77_aloc.c +++ b/contrib/libf2c/libF77/F77_aloc.c @@ -14,7 +14,13 @@ extern void G77_exit_0 (); F77_aloc(Len, whence) integer Len; char *whence; #else #include <stdlib.h> +#ifdef __cplusplus +extern "C" { +#endif extern void G77_exit_0 (integer*); +#ifdef __cplusplus + } +#endif char * F77_aloc(integer Len, char *whence) diff --git a/contrib/libf2c/libF77/Makefile.in b/contrib/libf2c/libF77/Makefile.in index 83ac3f9..74c69a0 100644 --- a/contrib/libf2c/libF77/Makefile.in +++ b/contrib/libf2c/libF77/Makefile.in @@ -103,6 +103,128 @@ ${srcdir}/configure: configure.in VersionF.o: Version.c $(CC) -c $(ALL_CFLAGS) -o $@ $(srcdir)/Version.c +F77_aloc.o: F77_aloc.c +main.o: main.c +s_rnge.o: s_rnge.c +abort_.o: abort_.c +getarg_.o: getarg_.c +iargc_.o: iargc_.c +getenv_.o: getenv_.c +signal_.o: signal_.c +s_stop.o: s_stop.c +s_paus.o: s_paus.c +system_.o: system_.c +cabs.o: cabs.c +derf_.o: derf_.c +derfc_.o: derfc_.c +erf_.o: erf_.c +erfc_.o: erfc_.c +sig_die.o: sig_die.c +exit_.o: exit_.c +setarg.o: setarg.c +setsig.o: setsig.c +pow_ci.o: pow_ci.c +pow_dd.o: pow_dd.c +pow_di.o: pow_di.c +pow_hh.o: pow_hh.c +pow_ii.o: pow_ii.c +pow_ri.o: pow_ri.c +pow_zi.o: pow_zi.c +pow_zz.o: pow_zz.c +pow_qq.o: pow_qq.c +c_abs.o: c_abs.c +c_cos.o: c_cos.c +c_div.o: c_div.c +c_exp.o: c_exp.c +c_log.o: c_log.c +c_sin.o: c_sin.c +c_sqrt.o: c_sqrt.c +z_abs.o: z_abs.c +z_cos.o: z_cos.c +z_div.o: z_div.c +z_exp.o: z_exp.c +z_log.o: z_log.c +z_sin.o: z_sin.c +z_sqrt.o: z_sqrt.c +r_abs.o: r_abs.c +r_acos.o: r_acos.c +r_asin.o: r_asin.c +r_atan.o: r_atan.c +r_atn2.o: r_atn2.c +r_cnjg.o: r_cnjg.c +r_cos.o: r_cos.c +r_cosh.o: r_cosh.c +r_dim.o: r_dim.c +r_exp.o: r_exp.c +r_imag.o: r_imag.c +r_int.o: r_int.c +r_lg10.o: r_lg10.c +r_log.o: r_log.c +r_mod.o: r_mod.c +r_nint.o: r_nint.c +r_sign.o: r_sign.c +r_sin.o: r_sin.c +r_sinh.o: r_sinh.c +r_sqrt.o: r_sqrt.c +r_tan.o: r_tan.c +r_tanh.o: r_tanh.c +d_abs.o: d_abs.c +d_acos.o: d_acos.c +d_asin.o: d_asin.c +d_atan.o: d_atan.c +d_atn2.o: d_atn2.c +d_cnjg.o: d_cnjg.c +d_cos.o: d_cos.c +d_cosh.o: d_cosh.c +d_dim.o: d_dim.c +d_exp.o: d_exp.c +d_imag.o: d_imag.c +d_int.o: d_int.c +d_lg10.o: d_lg10.c +d_log.o: d_log.c +d_mod.o: d_mod.c +d_nint.o: d_nint.c +d_prod.o: d_prod.c +d_sign.o: d_sign.c +d_sin.o: d_sin.c +d_sinh.o: d_sinh.c +d_sqrt.o: d_sqrt.c +d_tan.o: d_tan.c +d_tanh.o: d_tanh.c +i_abs.o: i_abs.c +i_dim.o: i_dim.c +i_dnnt.o: i_dnnt.c +i_indx.o: i_indx.c +i_len.o: i_len.c +i_mod.o: i_mod.c +i_nint.o: i_nint.c +i_sign.o: i_sign.c +h_abs.o: h_abs.c +h_dim.o: h_dim.c +h_dnnt.o: h_dnnt.c +h_indx.o: h_indx.c +h_len.o: h_len.c +h_mod.o: h_mod.c +h_nint.o: h_nint.c +h_sign.o: h_sign.c +l_ge.o: l_ge.c +l_gt.o: l_gt.c +l_le.o: l_le.c +l_lt.o: l_lt.c +hl_ge.o: hl_ge.c +hl_gt.o: hl_gt.c +hl_le.o: hl_le.c +hl_lt.o: hl_lt.c +ef1asc_.o: ef1asc_.c +ef1cmc_.o: ef1cmc_.c +s_cat.o: s_cat.c +s_cmp.o: s_cmp.c +s_copy.o: s_copy.c +lbitbits.o: lbitbits.c +lbitshft.o: lbitshft.c +qbitbits.o: qbitbits.c +qbitshft.o: qbitshft.c + # Not quite all these actually do depend on f2c.h... $(MISC) $(POW) $(CX) $(DCX) $(REAL) $(DBL) $(INT) $(HALF) $(CMP) $(EFL) \ $(CHAR) $(F90BIT): $(F2C_H_DIR)/f2c.h $(G2C_H_DIR)/g2c.h @@ -114,6 +236,7 @@ mostlyclean: clean: mostlyclean rm -f config.log + rm -f ../s-libf77 distclean: clean rm -f config.cache config.status Makefile ../s-libf77 configure diff --git a/contrib/libf2c/libF77/README.netlib b/contrib/libf2c/libF77/README.netlib index 7668215..5e532ee 100644 --- a/contrib/libf2c/libF77/README.netlib +++ b/contrib/libf2c/libF77/README.netlib @@ -106,3 +106,7 @@ one-line shell script or (on some systems) exec /usr/bin/ar lts $1 >/dev/null + +If your compiler complains about the signal calls in main.c, s_paus.c, +and signal_.c, you may need to adjust signal1.h suitably. See the +comments in signal1.h. diff --git a/contrib/libf2c/libF77/Version.c b/contrib/libf2c/libF77/Version.c index 3e46ce8..a7c9346 100644 --- a/contrib/libf2c/libF77/Version.c +++ b/contrib/libf2c/libF77/Version.c @@ -1,9 +1,9 @@ -static char junk[] = "\n@(#)LIBF77 VERSION 19970919\n"; +static char junk[] = "\n@(#)LIBF77 VERSION 19990503\n"; /* */ -char __G77_LIBF77_VERSION__[] = "0.5.24"; +char __G77_LIBF77_VERSION__[] = "0.5.25 19990816 (release)"; /* 2.00 11 June 1980. File version.c added to library. @@ -55,6 +55,12 @@ char __G77_LIBF77_VERSION__[] = "0.5.24"; affect systems using gratuitous extra precision). 19 Sept. 1997: [de]time_.c (Unix systems only): change return type to double. + 2 May 1999: getenv_.c: omit environ in favor of getenv(). + c_cos.c, c_exp.c, c_sin.c, d_cnjg.c, r_cnjg.c, + z_cos.c, z_exp.c, z_log.c, z_sin.c: cope fully with + overlapping arguments caused by equivalence. + 3 May 1999: "invisible" tweaks to omit compiler warnings in + abort_.c, ef1asc_.c, s_rnge.c, s_stop.c. */ #include <stdio.h> diff --git a/contrib/libf2c/libF77/abort_.c b/contrib/libf2c/libF77/abort_.c index 8efdc42..f0c2f8d 100644 --- a/contrib/libf2c/libF77/abort_.c +++ b/contrib/libf2c/libF77/abort_.c @@ -12,7 +12,5 @@ int G77_abort_0 (void) #endif { sig_die("Fortran abort routine called", 1); -#ifdef __cplusplus -return 0; -#endif +return 0; /* not reached */ } diff --git a/contrib/libf2c/libF77/c_cos.c b/contrib/libf2c/libF77/c_cos.c index 9e833c16..549953d 100644 --- a/contrib/libf2c/libF77/c_cos.c +++ b/contrib/libf2c/libF77/c_cos.c @@ -3,19 +3,15 @@ #ifdef KR_headers extern double sin(), cos(), sinh(), cosh(); -VOID c_cos(resx, z) complex *resx, *z; +VOID c_cos(r, z) complex *r, *z; #else #undef abs -#include <math.h> +#include "math.h" -void c_cos(complex *resx, complex *z) +void c_cos(complex *r, complex *z) #endif { -complex res; - -res.r = cos(z->r) * cosh(z->i); -res.i = - sin(z->r) * sinh(z->i); - -resx->r = res.r; -resx->i = res.i; -} + double zi = z->i, zr = z->r; + r->r = cos(zr) * cosh(zi); + r->i = - sin(zr) * sinh(zi); + } diff --git a/contrib/libf2c/libF77/c_div.c b/contrib/libf2c/libF77/c_div.c index 9568354..ac96307 100644 --- a/contrib/libf2c/libF77/c_div.c +++ b/contrib/libf2c/libF77/c_div.c @@ -2,39 +2,36 @@ #ifdef KR_headers extern VOID sig_die(); -VOID c_div(resx, a, b) -complex *a, *b, *resx; +VOID c_div(c, a, b) +complex *a, *b, *c; #else extern void sig_die(char*,int); -void c_div(complex *resx, complex *a, complex *b) +void c_div(complex *c, complex *a, complex *b) #endif { -double ratio, den; -double abr, abi; -complex res; + double ratio, den; + double abr, abi, cr; -if( (abr = b->r) < 0.) - abr = - abr; -if( (abi = b->i) < 0.) - abi = - abi; -if( abr <= abi ) - { - if(abi == 0) - sig_die("complex division by zero", 1); - ratio = (double)b->r / b->i ; - den = b->i * (1 + ratio*ratio); - res.r = (a->r*ratio + a->i) / den; - res.i = (a->i*ratio - a->r) / den; - } + if( (abr = b->r) < 0.) + abr = - abr; + if( (abi = b->i) < 0.) + abi = - abi; + if( abr <= abi ) + { + if(abi == 0) + sig_die("complex division by zero", 1); + ratio = (double)b->r / b->i ; + den = b->i * (1 + ratio*ratio); + cr = (a->r*ratio + a->i) / den; + c->i = (a->i*ratio - a->r) / den; + } -else - { - ratio = (double)b->i / b->r ; - den = b->r * (1 + ratio*ratio); - res.r = (a->r + a->i*ratio) / den; - res.i = (a->i - a->r*ratio) / den; + else + { + ratio = (double)b->i / b->r ; + den = b->r * (1 + ratio*ratio); + cr = (a->r + a->i*ratio) / den; + c->i = (a->i - a->r*ratio) / den; + } + c->r = cr; } - -resx->r = res.r; -resx->i = res.i; -} diff --git a/contrib/libf2c/libF77/c_exp.c b/contrib/libf2c/libF77/c_exp.c index 8d3d33d..52d0d2f 100644 --- a/contrib/libf2c/libF77/c_exp.c +++ b/contrib/libf2c/libF77/c_exp.c @@ -3,21 +3,17 @@ #ifdef KR_headers extern double exp(), cos(), sin(); - VOID c_exp(resx, z) complex *resx, *z; + VOID c_exp(r, z) complex *r, *z; #else #undef abs -#include <math.h> +#include "math.h" -void c_exp(complex *resx, complex *z) +void c_exp(complex *r, complex *z) #endif { -double expx; -complex res; + double expx, zi = z->i; -expx = exp(z->r); -res.r = expx * cos(z->i); -res.i = expx * sin(z->i); - -resx->r = res.r; -resx->i = res.i; -} + expx = exp(z->r); + r->r = expx * cos(zi); + r->i = expx * sin(zi); + } diff --git a/contrib/libf2c/libF77/c_log.c b/contrib/libf2c/libF77/c_log.c index 6715131..24d1a3c 100644 --- a/contrib/libf2c/libF77/c_log.c +++ b/contrib/libf2c/libF77/c_log.c @@ -2,20 +2,16 @@ #ifdef KR_headers extern double log(), f__cabs(), atan2(); -VOID c_log(resx, z) complex *resx, *z; +VOID c_log(r, z) complex *r, *z; #else #undef abs -#include <math.h> +#include "math.h" extern double f__cabs(double, double); -void c_log(complex *resx, complex *z) +void c_log(complex *r, complex *z) #endif { -complex res; - -res.i = atan2(z->i, z->r); -res.r = log( f__cabs(z->r, z->i) ); - -resx->r = res.r; -resx->i = res.i; -} + double zi, zr; + r->i = atan2(zi = z->i, zr = z->r); + r->r = log( f__cabs(zr, zi) ); + } diff --git a/contrib/libf2c/libF77/c_sin.c b/contrib/libf2c/libF77/c_sin.c index 7bf3e39..93a5766 100644 --- a/contrib/libf2c/libF77/c_sin.c +++ b/contrib/libf2c/libF77/c_sin.c @@ -3,19 +3,15 @@ #ifdef KR_headers extern double sin(), cos(), sinh(), cosh(); -VOID c_sin(resx, z) complex *resx, *z; +VOID c_sin(r, z) complex *r, *z; #else #undef abs -#include <math.h> +#include "math.h" -void c_sin(complex *resx, complex *z) +void c_sin(complex *r, complex *z) #endif { -complex res; - -res.r = sin(z->r) * cosh(z->i); -res.i = cos(z->r) * sinh(z->i); - -resx->r = res.r; -resx->i = res.i; -} + double zi = z->i, zr = z->r; + r->r = sin(zr) * cosh(zi); + r->i = cos(zr) * sinh(zi); + } diff --git a/contrib/libf2c/libF77/c_sqrt.c b/contrib/libf2c/libF77/c_sqrt.c index 775977a..8481ee4 100644 --- a/contrib/libf2c/libF77/c_sqrt.c +++ b/contrib/libf2c/libF77/c_sqrt.c @@ -3,36 +3,33 @@ #ifdef KR_headers extern double sqrt(), f__cabs(); -VOID c_sqrt(resx, z) complex *resx, *z; +VOID c_sqrt(r, z) complex *r, *z; #else #undef abs -#include <math.h> +#include "math.h" extern double f__cabs(double, double); -void c_sqrt(complex *resx, complex *z) +void c_sqrt(complex *r, complex *z) #endif { -double mag, t; -complex res; + double mag, t; + double zi = z->i, zr = z->r; -if( (mag = f__cabs(z->r, z->i)) == 0.) - res.r = res.i = 0.; -else if(z->r > 0) - { - res.r = t = sqrt(0.5 * (mag + z->r) ); - t = z->i / t; - res.i = 0.5 * t; + if( (mag = f__cabs(zr, zi)) == 0.) + r->r = r->i = 0.; + else if(zr > 0) + { + r->r = t = sqrt(0.5 * (mag + zr) ); + t = zi / t; + r->i = 0.5 * t; + } + else + { + t = sqrt(0.5 * (mag - zr) ); + if(zi < 0) + t = -t; + r->i = t; + t = zi / t; + r->r = 0.5 * t; + } } -else - { - t = sqrt(0.5 * (mag - z->r) ); - if(z->i < 0) - t = -t; - res.i = t; - t = z->i / t; - res.r = 0.5 * t; - } - -resx->r = res.r; -resx->i = res.i; -} diff --git a/contrib/libf2c/libF77/configure b/contrib/libf2c/libF77/configure index 3f738bf..b5622e0 100755 --- a/contrib/libf2c/libF77/configure +++ b/contrib/libf2c/libF77/configure @@ -1,7 +1,7 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated automatically using autoconf version 2.12.1 +# Generated automatically using autoconf version 2.13 # Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. # # This configure script is free software; the Free Software Foundation @@ -333,7 +333,7 @@ EOF verbose=yes ;; -version | --version | --versio | --versi | --vers) - echo "configure generated by autoconf version 2.12.1" + echo "configure generated by autoconf version 2.13" exit 0 ;; -with-* | --with-*) @@ -503,9 +503,11 @@ ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross +ac_exeext= +ac_objext=o if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then @@ -525,15 +527,16 @@ fi # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:529: checking for $ac_word" >&5 +echo "configure:531: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" - for ac_dir in $PATH; do + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then ac_cv_prog_CC="gcc" @@ -554,16 +557,17 @@ if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:558: checking for $ac_word" >&5 +echo "configure:561: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:" + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" ac_prog_rejected=no - for ac_dir in $PATH; do + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$ac_word; then if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then @@ -598,25 +602,61 @@ else echo "$ac_t""no" 1>&6 fi + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:612: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:606: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:644: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. ac_cpp='$CPP $CPPFLAGS' ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' -ac_link='${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' cross_compiling=$ac_cv_prog_cc_cross -cat > conftest.$ac_ext <<EOF -#line 616 "configure" +cat > conftest.$ac_ext << EOF + +#line 655 "configure" #include "confdefs.h" + main(){return(0);} EOF -if { (eval echo configure:620: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:660: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -630,18 +670,24 @@ else ac_cv_prog_cc_works=no fi rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 if test $ac_cv_prog_cc_works = no; then { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:640: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:686: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:645: checking whether we are using GNU C" >&5 +echo "configure:691: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -650,7 +696,7 @@ else yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:654: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:700: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -661,11 +707,15 @@ echo "$ac_t""$ac_cv_prog_gcc" 1>&6 if test $ac_cv_prog_gcc = yes; then GCC=yes - ac_test_CFLAGS="${CFLAGS+set}" - ac_save_CFLAGS="$CFLAGS" - CFLAGS= - echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:669: checking whether ${CC-cc} accepts -g" >&5 +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:719: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -680,23 +730,27 @@ rm -f conftest* fi echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 - if test "$ac_test_CFLAGS" = set; then - CFLAGS="$ac_save_CFLAGS" - elif test $ac_cv_prog_cc_g = yes; then +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then CFLAGS="-g -O2" else - CFLAGS="-O2" + CFLAGS="-g" fi else - GCC= - test "${CFLAGS+set}" = set || CFLAGS="-g" + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi fi test "$AR" || AR=ar echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 -echo "configure:700: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "configure:754: checking whether ${MAKE-make} sets \${MAKE}" >&5 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -726,7 +780,7 @@ fi # Sanity check for the cross-compilation case: echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:730: checking how to run the C preprocessor" >&5 +echo "configure:784: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -741,14 +795,14 @@ else # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext <<EOF -#line 745 "configure" +#line 799 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:751: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` +{ (eval echo configure:805: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else @@ -758,14 +812,31 @@ else rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext <<EOF -#line 762 "configure" +#line 816 "configure" #include "confdefs.h" #include <assert.h> Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:768: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` +{ (eval echo configure:822: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` +if test -z "$ac_err"; then + : +else + echo "$ac_err" >&5 + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + CPP="${CC-cc} -nologo -E" + cat > conftest.$ac_ext <<EOF +#line 833 "configure" +#include "confdefs.h" +#include <assert.h> +Syntax Error +EOF +ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" +{ (eval echo configure:839: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : else @@ -778,6 +849,8 @@ fi rm -f conftest* fi rm -f conftest* +fi +rm -f conftest* ac_cv_prog_CPP="$CPP" fi CPP="$ac_cv_prog_CPP" @@ -788,18 +861,18 @@ echo "$ac_t""$CPP" 1>&6 ac_safe=`echo "stdio.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for stdio.h""... $ac_c" 1>&6 -echo "configure:792: checking for stdio.h" >&5 +echo "configure:865: checking for stdio.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 797 "configure" +#line 870 "configure" #include "confdefs.h" #include <stdio.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:802: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` +{ (eval echo configure:875: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* eval "ac_cv_header_$ac_safe=yes" @@ -826,12 +899,12 @@ fi echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:830: checking for ANSI C header files" >&5 +echo "configure:903: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 835 "configure" +#line 908 "configure" #include "confdefs.h" #include <stdlib.h> #include <stdarg.h> @@ -839,8 +912,8 @@ else #include <float.h> EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:843: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } -ac_err=`grep -v '^ *+' conftest.out` +{ (eval echo configure:916: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* ac_cv_header_stdc=yes @@ -856,7 +929,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 860 "configure" +#line 933 "configure" #include "confdefs.h" #include <string.h> EOF @@ -874,7 +947,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext <<EOF -#line 878 "configure" +#line 951 "configure" #include "confdefs.h" #include <stdlib.h> EOF @@ -895,7 +968,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext <<EOF -#line 899 "configure" +#line 972 "configure" #include "confdefs.h" #include <ctype.h> #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -906,7 +979,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:910: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest && (./conftest; exit) 2>/dev/null +if { (eval echo configure:983: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -931,12 +1004,12 @@ fi echo $ac_n "checking for posix""... $ac_c" 1>&6 -echo "configure:935: checking for posix" >&5 +echo "configure:1008: checking for posix" >&5 if eval "test \"`echo '$''{'g77_cv_header_posix'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 940 "configure" +#line 1013 "configure" #include "confdefs.h" #include <sys/types.h> #include <unistd.h> @@ -962,12 +1035,12 @@ echo "$ac_t""$g77_cv_header_posix" 1>&6 # We can rely on the GNU library being posix-ish. I guess checking the # header isn't actually like checking the functions, though... echo $ac_n "checking for GNU library""... $ac_c" 1>&6 -echo "configure:966: checking for GNU library" >&5 +echo "configure:1039: checking for GNU library" >&5 if eval "test \"`echo '$''{'g77_cv_lib_gnu'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 971 "configure" +#line 1044 "configure" #include "confdefs.h" #include <stdio.h> #ifdef __GNU_LIBRARY__ @@ -990,12 +1063,12 @@ fi echo "$ac_t""$g77_cv_lib_gnu" 1>&6 echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:994: checking return type of signal handlers" >&5 +echo "configure:1067: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 999 "configure" +#line 1072 "configure" #include "confdefs.h" #include <sys/types.h> #include <signal.h> @@ -1012,7 +1085,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:1016: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1089: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -1033,12 +1106,12 @@ EOF # we'll get atexit by default if test $ac_cv_header_stdc != yes; then echo $ac_n "checking for atexit""... $ac_c" 1>&6 -echo "configure:1037: checking for atexit" >&5 +echo "configure:1110: checking for atexit" >&5 if eval "test \"`echo '$''{'ac_cv_func_atexit'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1042 "configure" +#line 1115 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char atexit(); below. */ @@ -1061,7 +1134,7 @@ atexit(); ; return 0; } EOF -if { (eval echo configure:1065: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1138: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_atexit=yes" else @@ -1086,12 +1159,12 @@ else EOF echo $ac_n "checking for onexit""... $ac_c" 1>&6 -echo "configure:1090: checking for onexit" >&5 +echo "configure:1163: checking for onexit" >&5 if eval "test \"`echo '$''{'ac_cv_func_onexit'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1095 "configure" +#line 1168 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char onexit(); below. */ @@ -1114,7 +1187,7 @@ onexit(); ; return 0; } EOF -if { (eval echo configure:1118: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1191: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_onexit=yes" else @@ -1132,12 +1205,12 @@ if eval "test \"`echo '$ac_cv_func_'onexit`\" = yes"; then else echo "$ac_t""no" 1>&6 echo $ac_n "checking for on_exit""... $ac_c" 1>&6 -echo "configure:1136: checking for on_exit" >&5 +echo "configure:1209: checking for on_exit" >&5 if eval "test \"`echo '$''{'ac_cv_func_on_exit'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <<EOF -#line 1141 "configure" +#line 1214 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char on_exit(); below. */ @@ -1160,7 +1233,7 @@ on_exit(); ; return 0; } EOF -if { (eval echo configure:1164: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1237: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_on_exit=yes" else @@ -1190,7 +1263,7 @@ else true fi echo $ac_n "checking for drem in -lm""... $ac_c" 1>&6 -echo "configure:1194: checking for drem in -lm" >&5 +echo "configure:1267: checking for drem in -lm" >&5 ac_lib_var=`echo m'_'drem | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1198,7 +1271,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lm $LIBS" cat > conftest.$ac_ext <<EOF -#line 1202 "configure" +#line 1275 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ /* We use char because int might match the return type of a gcc2 @@ -1209,7 +1282,7 @@ int main() { drem() ; return 0; } EOF -if { (eval echo configure:1213: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest; then +if { (eval echo configure:1286: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1261,7 +1334,7 @@ EOF # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. (set) 2>&1 | - case `(ac_space=' '; set) 2>&1 | grep ac_space` in + case `(ac_space=' '; set | grep ac_space) 2>&1` in *ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote substitution # turns \\\\ into \\, and sed turns \\ into \). @@ -1340,7 +1413,7 @@ do echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; -version | --version | --versio | --versi | --vers | --ver | --ve | --v) - echo "$CONFIG_STATUS generated by autoconf version 2.12.1" + echo "$CONFIG_STATUS generated by autoconf version 2.13" exit 0 ;; -help | --help | --hel | --he | --h) echo "\$ac_cs_usage"; exit 0 ;; @@ -1363,6 +1436,7 @@ s%@SHELL@%$SHELL%g s%@CFLAGS@%$CFLAGS%g s%@CPPFLAGS@%$CPPFLAGS%g s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g s%@DEFS@%$DEFS%g s%@LDFLAGS@%$LDFLAGS%g s%@LIBS@%$LIBS%g diff --git a/contrib/libf2c/libF77/configure.in b/contrib/libf2c/libF77/configure.in index 660fb1a..5a3aa1a 100644 --- a/contrib/libf2c/libF77/configure.in +++ b/contrib/libf2c/libF77/configure.in @@ -19,6 +19,7 @@ #the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #02111-1307, USA. +AC_PREREQ(2.12.1) AC_INIT(getarg_.c) dnl Checks for programs. diff --git a/contrib/libf2c/libF77/d_cnjg.c b/contrib/libf2c/libF77/d_cnjg.c index 1afa3bc..c1970a5 100644 --- a/contrib/libf2c/libF77/d_cnjg.c +++ b/contrib/libf2c/libF77/d_cnjg.c @@ -2,16 +2,12 @@ VOID #ifdef KR_headers -d_cnjg(resx, z) doublecomplex *resx, *z; +d_cnjg(r, z) doublecomplex *r, *z; #else -d_cnjg(doublecomplex *resx, doublecomplex *z) +d_cnjg(doublecomplex *r, doublecomplex *z) #endif { -doublecomplex res; - -res.r = z->r; -res.i = - z->i; - -resx->r = res.r; -resx->i = res.i; -} + doublereal zi = z->i; + r->r = z->r; + r->i = -zi; + } diff --git a/contrib/libf2c/libF77/dtime_.c b/contrib/libf2c/libF77/dtime_.c index 95db94f..4b37320 100644 --- a/contrib/libf2c/libF77/dtime_.c +++ b/contrib/libf2c/libF77/dtime_.c @@ -1,4 +1,10 @@ #include "time.h" + +#ifdef MSDOS +#undef USE_CLOCK +#define USE_CLOCK +#endif + #ifndef USE_CLOCK #define _INCLUDE_POSIX_SOURCE /* for HP-UX */ #define _INCLUDE_XOPEN_SOURCE /* for HP-UX */ diff --git a/contrib/libf2c/libF77/ef1asc_.c b/contrib/libf2c/libF77/ef1asc_.c index a922a1d..8588584 100644 --- a/contrib/libf2c/libF77/ef1asc_.c +++ b/contrib/libf2c/libF77/ef1asc_.c @@ -15,7 +15,5 @@ int G77_ef1asc_0 (ftnint *a, ftnlen *la, ftnint *b, ftnlen *lb) #endif { s_copy( (char *)a, (char *)b, EVEN(*la), *lb ); -#ifdef __cplusplus -return 0; -#endif +return 0; /* ignored return value */ } diff --git a/contrib/libf2c/libF77/etime_.c b/contrib/libf2c/libF77/etime_.c index 7ed3fce..e88cfd8 100644 --- a/contrib/libf2c/libF77/etime_.c +++ b/contrib/libf2c/libF77/etime_.c @@ -1,4 +1,10 @@ #include "time.h" + +#ifdef MSDOS +#undef USE_CLOCK +#define USE_CLOCK +#endif + #ifndef USE_CLOCK #define _INCLUDE_POSIX_SOURCE /* for HP-UX */ #define _INCLUDE_XOPEN_SOURCE /* for HP-UX */ diff --git a/contrib/libf2c/libF77/getenv_.c b/contrib/libf2c/libF77/getenv_.c index b9916e6..4d0b7cf 100644 --- a/contrib/libf2c/libF77/getenv_.c +++ b/contrib/libf2c/libF77/getenv_.c @@ -1,4 +1,12 @@ #include "f2c.h" +#undef abs +#ifdef KR_headers +extern char *F77_aloc(), *getenv(); +#else +#include <stdlib.h> +#include <string.h> +extern char *F77_aloc(ftnlen, char*); +#endif /* * getenv - f77 subroutine to return environment variables @@ -13,39 +21,36 @@ */ #ifdef KR_headers -VOID G77_getenv_0 (fname, value, flen, vlen) char *value, *fname; ftnlen vlen, flen; + VOID +G77_getenv_0 (fname, value, flen, vlen) char *value, *fname; ftnlen vlen, flen; #else -void G77_getenv_0 (char *fname, char *value, ftnlen flen, ftnlen vlen) + void +G77_getenv_0 (char *fname, char *value, ftnlen flen, ftnlen vlen) #endif { -extern char **environ; -register char *ep, *fp, *flast; -register char **env = environ; + char buf[256], *ep, *fp; + integer i; -flast = fname + flen; -for(fp = fname ; fp < flast ; ++fp) - if(*fp == ' ') - { - flast = fp; - break; + if (flen <= 0) + goto add_blanks; + for(i = 0; i < sizeof(buf); i++) { + if (i == flen || (buf[i] = fname[i]) == ' ') { + buf[i] = 0; + ep = getenv(buf); + goto have_ep; + } } - -while (ep = *env++) - { - for(fp = fname; fp<flast ; ) - if(*fp++ != *ep++) - goto endloop; - - if(*ep++ == '=') { /* copy right hand side */ - while( *ep && --vlen>=0 ) + while(i < flen && fname[i] != ' ') + i++; + strncpy(fp = F77_aloc(i+1, "getenv_"), fname, (int)i); + fp[i] = 0; + ep = getenv(fp); + free(fp); + have_ep: + if (ep) + while(*ep && vlen-- > 0) *value++ = *ep++; - - goto blank; - } -endloop: ; - } - -blank: - while( --vlen >= 0 ) + add_blanks: + while(vlen-- > 0) *value++ = ' '; -} + } diff --git a/contrib/libf2c/libF77/pow_zi.c b/contrib/libf2c/libF77/pow_zi.c index 898ea6b..abb3cb2 100644 --- a/contrib/libf2c/libF77/pow_zi.c +++ b/contrib/libf2c/libF77/pow_zi.c @@ -1,61 +1,54 @@ #include "f2c.h" #ifdef KR_headers -VOID pow_zi(resx, a, b) /* p = a**b */ - doublecomplex *resx, *a; integer *b; +VOID pow_zi(p, a, b) /* p = a**b */ + doublecomplex *p, *a; integer *b; #else extern void z_div(doublecomplex*, doublecomplex*, doublecomplex*); -void pow_zi(doublecomplex *resx, doublecomplex *a, integer *b) /* p = a**b */ +void pow_zi(doublecomplex *p, doublecomplex *a, integer *b) /* p = a**b */ #endif { -integer n; -unsigned long u; -double t; -doublecomplex x; -doublecomplex res; -static doublecomplex one = {1.0, 0.0}; + integer n; + unsigned long u; + double t; + doublecomplex q, x; + static doublecomplex one = {1.0, 0.0}; -n = *b; + n = *b; + q.r = 1; + q.i = 0; -if(n == 0) - { - resx->r = 1; - resx->i = 0; - return; - } - -res.r = 1; -res.i = 0; - -if(n < 0) - { - n = -n; - z_div(&x, &one, a); - } -else - { - x.r = a->r; - x.i = a->i; - } - -for(u = n; ; ) - { - if(u & 01) + if(n == 0) + goto done; + if(n < 0) { - t = res.r * x.r - res.i * x.i; - res.i = res.r * x.i + res.i * x.r; - res.r = t; + n = -n; + z_div(&x, &one, a); } - if(u >>= 1) + else { - t = x.r * x.r - x.i * x.i; - x.i = 2 * x.r * x.i; - x.r = t; + x.r = a->r; + x.i = a->i; } - else - break; - } -resx->r = res.r; -resx->i = res.i; -} + for(u = n; ; ) + { + if(u & 01) + { + t = q.r * x.r - q.i * x.i; + q.i = q.r * x.i + q.i * x.r; + q.r = t; + } + if(u >>= 1) + { + t = x.r * x.r - x.i * x.i; + x.i = 2 * x.r * x.i; + x.r = t; + } + else + break; + } + done: + p->i = q.i; + p->r = q.r; + } diff --git a/contrib/libf2c/libF77/r_cnjg.c b/contrib/libf2c/libF77/r_cnjg.c index b6175ee..756c694 100644 --- a/contrib/libf2c/libF77/r_cnjg.c +++ b/contrib/libf2c/libF77/r_cnjg.c @@ -1,16 +1,12 @@ #include "f2c.h" #ifdef KR_headers -VOID r_cnjg(resx, z) complex *resx, *z; +VOID r_cnjg(r, z) complex *r, *z; #else -VOID r_cnjg(complex *resx, complex *z) +VOID r_cnjg(complex *r, complex *z) #endif { -complex res; - -res.r = z->r; -res.i = - z->i; - -resx->r = res.r; -resx->i = res.i; -} + real zi = z->i; + r->r = z->r; + r->i = -zi; + } diff --git a/contrib/libf2c/libF77/s_rnge.c b/contrib/libf2c/libF77/s_rnge.c index 189b524..fbe3219 100644 --- a/contrib/libf2c/libF77/s_rnge.c +++ b/contrib/libf2c/libF77/s_rnge.c @@ -20,7 +20,5 @@ fprintf(stderr, ".\nAttempt to access the %ld-th element of variable ", offset+1 while((i = *varn) && i != ' ') putc(*varn++, stderr); sig_die(".", 1); -#ifdef __cplusplus -return 0; -#endif +return 0; /* not reached */ } diff --git a/contrib/libf2c/libF77/s_stop.c b/contrib/libf2c/libF77/s_stop.c index 2e3f103..975edb7 100644 --- a/contrib/libf2c/libF77/s_stop.c +++ b/contrib/libf2c/libF77/s_stop.c @@ -30,8 +30,13 @@ if(n > 0) f_exit(); #endif exit(0); -#ifdef __cplusplus + +/* We cannot avoid (useless) compiler diagnostics here: */ +/* some compilers complain if there is no return statement, */ +/* and others complain that this one cannot be reached. */ + return 0; /* NOT REACHED */ } -#endif +#ifdef __cplusplus } +#endif diff --git a/contrib/libf2c/libF77/signal1.h0 b/contrib/libf2c/libF77/signal1.h0 index 662cae4..a383774 100644 --- a/contrib/libf2c/libF77/signal1.h0 +++ b/contrib/libf2c/libF77/signal1.h0 @@ -3,6 +3,8 @@ /* compiler-dependent. The #define below assumes signal.h declares */ /* type SIG_PF for the signal function's second argument. */ +/* For some C++ compilers, "#define Sigarg_t ..." may be appropriate. */ + #include <signal.h> #ifndef Sigret_t @@ -12,12 +14,8 @@ #ifdef KR_headers #define Sigarg_t #else -#ifdef __cplusplus -#define Sigarg_t ... -#else #define Sigarg_t int #endif -#endif #endif /*Sigarg_t*/ #ifdef USE_SIG_PF /* compile with -DUSE_SIG_PF under IRIX */ diff --git a/contrib/libf2c/libF77/z_cos.c b/contrib/libf2c/libF77/z_cos.c index a811bbe..2d4a24d 100644 --- a/contrib/libf2c/libF77/z_cos.c +++ b/contrib/libf2c/libF77/z_cos.c @@ -2,18 +2,14 @@ #ifdef KR_headers double sin(), cos(), sinh(), cosh(); -VOID z_cos(resx, z) doublecomplex *resx, *z; +VOID z_cos(r, z) doublecomplex *r, *z; #else #undef abs -#include <math.h> -void z_cos(doublecomplex *resx, doublecomplex *z) +#include "math.h" +void z_cos(doublecomplex *r, doublecomplex *z) #endif { -doublecomplex res; - -res.r = cos(z->r) * cosh(z->i); -res.i = - sin(z->r) * sinh(z->i); - -resx->r = res.r; -resx->i = res.i; -} + double zi = z->i, zr = z->r; + r->r = cos(zr) * cosh(zi); + r->i = - sin(zr) * sinh(zi); + } diff --git a/contrib/libf2c/libF77/z_div.c b/contrib/libf2c/libF77/z_div.c index 4a987ab2..22153fa 100644 --- a/contrib/libf2c/libF77/z_div.c +++ b/contrib/libf2c/libF77/z_div.c @@ -2,38 +2,35 @@ #ifdef KR_headers extern VOID sig_die(); -VOID z_div(resx, a, b) doublecomplex *a, *b, *resx; +VOID z_div(c, a, b) doublecomplex *a, *b, *c; #else extern void sig_die(char*, int); -void z_div(doublecomplex *resx, doublecomplex *a, doublecomplex *b) +void z_div(doublecomplex *c, doublecomplex *a, doublecomplex *b) #endif { -double ratio, den; -double abr, abi; -doublecomplex res; + double ratio, den; + double abr, abi, cr; -if( (abr = b->r) < 0.) - abr = - abr; -if( (abi = b->i) < 0.) - abi = - abi; -if( abr <= abi ) - { - if(abi == 0) - sig_die("complex division by zero", 1); - ratio = b->r / b->i ; - den = b->i * (1 + ratio*ratio); - res.r = (a->r*ratio + a->i) / den; - res.i = (a->i*ratio - a->r) / den; - } + if( (abr = b->r) < 0.) + abr = - abr; + if( (abi = b->i) < 0.) + abi = - abi; + if( abr <= abi ) + { + if(abi == 0) + sig_die("complex division by zero", 1); + ratio = b->r / b->i ; + den = b->i * (1 + ratio*ratio); + cr = (a->r*ratio + a->i) / den; + c->i = (a->i*ratio - a->r) / den; + } -else - { - ratio = b->i / b->r ; - den = b->r * (1 + ratio*ratio); - res.r = (a->r + a->i*ratio) / den; - res.i = (a->i - a->r*ratio) / den; + else + { + ratio = b->i / b->r ; + den = b->r * (1 + ratio*ratio); + cr = (a->r + a->i*ratio) / den; + c->i = (a->i - a->r*ratio) / den; + } + c->r = cr; } - -resx->r = res.r; -resx->i = res.i; -} diff --git a/contrib/libf2c/libF77/z_exp.c b/contrib/libf2c/libF77/z_exp.c index 85fb63e..ecf8429 100644 --- a/contrib/libf2c/libF77/z_exp.c +++ b/contrib/libf2c/libF77/z_exp.c @@ -2,20 +2,16 @@ #ifdef KR_headers double exp(), cos(), sin(); -VOID z_exp(resx, z) doublecomplex *resx, *z; +VOID z_exp(r, z) doublecomplex *r, *z; #else #undef abs -#include <math.h> -void z_exp(doublecomplex *resx, doublecomplex *z) +#include "math.h" +void z_exp(doublecomplex *r, doublecomplex *z) #endif { -double expx; -doublecomplex res; + double expx, zi = z->i; -expx = exp(z->r); -res.r = expx * cos(z->i); -res.i = expx * sin(z->i); - -resx->r = res.r; -resx->i = res.i; -} + expx = exp(z->r); + r->r = expx * cos(zi); + r->i = expx * sin(zi); + } diff --git a/contrib/libf2c/libF77/z_log.c b/contrib/libf2c/libF77/z_log.c index 48afca6..34c56d4 100644 --- a/contrib/libf2c/libF77/z_log.c +++ b/contrib/libf2c/libF77/z_log.c @@ -2,19 +2,15 @@ #ifdef KR_headers double log(), f__cabs(), atan2(); -VOID z_log(resx, z) doublecomplex *resx, *z; +VOID z_log(r, z) doublecomplex *r, *z; #else #undef abs -#include <math.h> +#include "math.h" extern double f__cabs(double, double); -void z_log(doublecomplex *resx, doublecomplex *z) +void z_log(doublecomplex *r, doublecomplex *z) #endif { -doublecomplex res; - -res.i = atan2(z->i, z->r); -res.r = log( f__cabs( z->r, z->i ) ); - -resx->r = res.r; -resx->i = res.i; -} + double zi = z->i, zr = z->r; + r->i = atan2(zi, zr); + r->r = log( f__cabs( zr, zi ) ); + } diff --git a/contrib/libf2c/libF77/z_sin.c b/contrib/libf2c/libF77/z_sin.c index 94456c9..e24caff 100644 --- a/contrib/libf2c/libF77/z_sin.c +++ b/contrib/libf2c/libF77/z_sin.c @@ -2,18 +2,14 @@ #ifdef KR_headers double sin(), cos(), sinh(), cosh(); -VOID z_sin(resx, z) doublecomplex *resx, *z; +VOID z_sin(r, z) doublecomplex *r, *z; #else #undef abs -#include <math.h> -void z_sin(doublecomplex *resx, doublecomplex *z) +#include "math.h" +void z_sin(doublecomplex *r, doublecomplex *z) #endif { -doublecomplex res; - -res.r = sin(z->r) * cosh(z->i); -res.i = cos(z->r) * sinh(z->i); - -resx->r = res.r; -resx->i = res.i; -} + double zi = z->i, zr = z->r; + r->r = sin(zr) * cosh(zi); + r->i = cos(zr) * sinh(zi); + } diff --git a/contrib/libf2c/libF77/z_sqrt.c b/contrib/libf2c/libF77/z_sqrt.c index f5db565..c04e8f0 100644 --- a/contrib/libf2c/libF77/z_sqrt.c +++ b/contrib/libf2c/libF77/z_sqrt.c @@ -2,32 +2,28 @@ #ifdef KR_headers double sqrt(), f__cabs(); -VOID z_sqrt(resx, z) doublecomplex *resx, *z; +VOID z_sqrt(r, z) doublecomplex *r, *z; #else #undef abs -#include <math.h> +#include "math.h" extern double f__cabs(double, double); -void z_sqrt(doublecomplex *resx, doublecomplex *z) +void z_sqrt(doublecomplex *r, doublecomplex *z) #endif { -double mag; -doublecomplex res; + double mag, zi = z->i, zr = z->r; -if( (mag = f__cabs(z->r, z->i)) == 0.) - res.r = res.i = 0.; -else if(z->r > 0) - { - res.r = sqrt(0.5 * (mag + z->r) ); - res.i = z->i / res.r / 2; + if( (mag = f__cabs(zr, zi)) == 0.) + r->r = r->i = 0.; + else if(zr > 0) + { + r->r = sqrt(0.5 * (mag + zr) ); + r->i = zi / r->r / 2; + } + else + { + r->i = sqrt(0.5 * (mag - zr) ); + if(zi < 0) + r->i = - r->i; + r->r = zi / r->i / 2; + } } -else - { - res.i = sqrt(0.5 * (mag - z->r) ); - if(z->i < 0) - res.i = - res.i; - res.r = z->i / res.i / 2; - } - -resx->r = res.r; -resx->i = res.i; -} |