diff options
author | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-06-01 12:38:32 +0000 |
---|---|---|
committer | ghazi <ghazi@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-06-01 12:38:32 +0000 |
commit | 0fa1f522915088d7bcbf7c9492fa70dc6cddaa17 (patch) | |
tree | c6c7b1fe59f3ddb8b8ccf102855193850daecdfc /libf2c/libF77 | |
parent | bc09eb06ee8c1540503d5314a71617de2151fbf2 (diff) | |
download | gcc-0fa1f522915088d7bcbf7c9492fa70dc6cddaa17.tar.gz |
* libF77/*: Fix formatting.
* libI77/*: Likewise.
* libU77/*: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@54145 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libf2c/libF77')
125 files changed, 1377 insertions, 1236 deletions
diff --git a/libf2c/libF77/F77_aloc.c b/libf2c/libF77/F77_aloc.c index 8716493aa70..b2861029198 100644 --- a/libf2c/libF77/F77_aloc.c +++ b/libf2c/libF77/F77_aloc.c @@ -7,18 +7,18 @@ static integer memfailure = 3; #include <stdlib.h> -extern void G77_exit_0 (integer*); +extern void G77_exit_0 (integer *); - char * -F77_aloc(integer Len, char *whence) +char * +F77_aloc (integer Len, char *whence) { - char *rv; - unsigned int uLen = (unsigned int) Len; /* for K&R C */ + char *rv; + unsigned int uLen = (unsigned int) Len; /* for K&R C */ - if (!(rv = (char*)malloc(uLen))) { - fprintf(stderr, "malloc(%u) failure in %s\n", - uLen, whence); - G77_exit_0 (&memfailure); - } - return rv; - } + if (!(rv = (char *) malloc (uLen))) + { + fprintf (stderr, "malloc(%u) failure in %s\n", uLen, whence); + G77_exit_0 (&memfailure); + } + return rv; +} diff --git a/libf2c/libF77/abort_.c b/libf2c/libF77/abort_.c index ac277f6646f..761bc3bd6e9 100644 --- a/libf2c/libF77/abort_.c +++ b/libf2c/libF77/abort_.c @@ -1,10 +1,11 @@ #include <stdio.h> #include "f2c.h" -extern void sig_die(char*,int); +extern void sig_die (char *, int); -int G77_abort_0 (void) +int +G77_abort_0 (void) { -sig_die("Fortran abort routine called", 1); -return 0; /* not reached */ + sig_die ("Fortran abort routine called", 1); + return 0; /* not reached */ } diff --git a/libf2c/libF77/c_abs.c b/libf2c/libF77/c_abs.c index c1251e14f53..3fc4d7c0a6a 100644 --- a/libf2c/libF77/c_abs.c +++ b/libf2c/libF77/c_abs.c @@ -1,8 +1,9 @@ #include "f2c.h" -extern double f__cabs(double, double); +extern double f__cabs (double, double); -double c_abs(complex *z) +double +c_abs (complex * z) { -return( f__cabs( z->r, z->i ) ); + return (f__cabs (z->r, z->i)); } diff --git a/libf2c/libF77/c_cos.c b/libf2c/libF77/c_cos.c index eb2acc4c804..59659754978 100644 --- a/libf2c/libF77/c_cos.c +++ b/libf2c/libF77/c_cos.c @@ -3,9 +3,10 @@ #undef abs #include "math.h" -void c_cos(complex *r, complex *z) +void +c_cos (complex * r, complex * z) { - double zi = z->i, zr = z->r; - r->r = cos(zr) * cosh(zi); - r->i = - sin(zr) * sinh(zi); - } + double zi = z->i, zr = z->r; + r->r = cos (zr) * cosh (zi); + r->i = -sin (zr) * sinh (zi); +} diff --git a/libf2c/libF77/c_div.c b/libf2c/libF77/c_div.c index 20763a3d69e..b5ede0eb801 100644 --- a/libf2c/libF77/c_div.c +++ b/libf2c/libF77/c_div.c @@ -1,41 +1,43 @@ #include "f2c.h" -extern void sig_die(char*,int); -void c_div(complex *c, complex *a, complex *b) +extern void sig_die (char *, int); +void +c_div (complex * c, complex * a, complex * b) { - double ratio, den; - double abr, abi, cr; + 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) { + if ((abr = b->r) < 0.) + abr = -abr; + if ((abi = b->i) < 0.) + abi = -abi; + if (abr <= abi) + { + if (abi == 0) + { #ifdef IEEE_COMPLEX_DIVIDE - float af, bf; - af = bf = abr; - if (a->i != 0 || a->r != 0) - af = 1.; - c->i = c->r = af / bf; - return; + float af, bf; + af = bf = abr; + if (a->i != 0 || a->r != 0) + af = 1.; + c->i = c->r = af / bf; + return; #else - sig_die("complex division by zero", 1); + sig_die ("complex division by zero", 1); #endif - } - 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); - cr = (a->r + a->i*ratio) / den; - c->i = (a->i - a->r*ratio) / den; - } - c->r = cr; } + 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); + cr = (a->r + a->i * ratio) / den; + c->i = (a->i - a->r * ratio) / den; + } + c->r = cr; +} diff --git a/libf2c/libF77/c_exp.c b/libf2c/libF77/c_exp.c index 3e281e91c6e..56a8695420c 100644 --- a/libf2c/libF77/c_exp.c +++ b/libf2c/libF77/c_exp.c @@ -3,11 +3,12 @@ #undef abs #include "math.h" -void c_exp(complex *r, complex *z) +void +c_exp (complex * r, complex * z) { - double expx, zi = z->i; + double expx, zi = z->i; - expx = exp(z->r); - r->r = expx * cos(zi); - r->i = expx * sin(zi); - } + expx = exp (z->r); + r->r = expx * cos (zi); + r->i = expx * sin (zi); +} diff --git a/libf2c/libF77/c_log.c b/libf2c/libF77/c_log.c index 990b42060be..7d5b9513167 100644 --- a/libf2c/libF77/c_log.c +++ b/libf2c/libF77/c_log.c @@ -2,11 +2,12 @@ #undef abs #include "math.h" -extern double f__cabs(double, double); +extern double f__cabs (double, double); -void c_log(complex *r, complex *z) +void +c_log (complex * r, complex * z) { - double zi, zr; - r->i = atan2(zi = z->i, zr = z->r); - r->r = log( f__cabs(zr, zi) ); - } + double zi, zr; + r->i = atan2 (zi = z->i, zr = z->r); + r->r = log (f__cabs (zr, zi)); +} diff --git a/libf2c/libF77/c_sin.c b/libf2c/libF77/c_sin.c index 07ef4d6501c..44bce9f7739 100644 --- a/libf2c/libF77/c_sin.c +++ b/libf2c/libF77/c_sin.c @@ -3,9 +3,10 @@ #undef abs #include "math.h" -void c_sin(complex *r, complex *z) +void +c_sin (complex * r, complex * z) { - double zi = z->i, zr = z->r; - r->r = sin(zr) * cosh(zi); - r->i = cos(zr) * sinh(zi); - } + double zi = z->i, zr = z->r; + r->r = sin (zr) * cosh (zi); + r->i = cos (zr) * sinh (zi); +} diff --git a/libf2c/libF77/c_sqrt.c b/libf2c/libF77/c_sqrt.c index 3b9a30f5635..81b72fc372e 100644 --- a/libf2c/libF77/c_sqrt.c +++ b/libf2c/libF77/c_sqrt.c @@ -2,28 +2,29 @@ #undef abs #include "math.h" -extern double f__cabs(double, double); +extern double f__cabs (double, double); -void c_sqrt(complex *r, complex *z) +void +c_sqrt (complex * r, complex * z) { - double mag, t; - double zi = z->i, zr = z->r; + double mag, t; + double zi = z->i, zr = z->r; - 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; - } - } + 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; + } +} diff --git a/libf2c/libF77/cabs.c b/libf2c/libF77/cabs.c index 17276abd054..5d2142e1825 100644 --- a/libf2c/libF77/cabs.c +++ b/libf2c/libF77/cabs.c @@ -1,22 +1,24 @@ #undef abs #include <math.h> -double f__cabs(double real, double imag) +double +f__cabs (double real, double imag) { -double temp; + double temp; -if(real < 0) - real = -real; -if(imag < 0) - imag = -imag; -if(imag > real){ - temp = real; - real = imag; - imag = temp; -} -if((real+imag) == real) - return(real); + if (real < 0) + real = -real; + if (imag < 0) + imag = -imag; + if (imag > real) + { + temp = real; + real = imag; + imag = temp; + } + if ((real + imag) == real) + return (real); -temp = imag/real; -temp = real*sqrt(1.0 + temp*temp); /*overflow!!*/ -return(temp); + temp = imag / real; + temp = real * sqrt (1.0 + temp * temp); /*overflow!! */ + return (temp); } diff --git a/libf2c/libF77/d_abs.c b/libf2c/libF77/d_abs.c index 2927a5e867d..a43a5c7f0a8 100644 --- a/libf2c/libF77/d_abs.c +++ b/libf2c/libF77/d_abs.c @@ -1,8 +1,9 @@ #include "f2c.h" -double d_abs(doublereal *x) +double +d_abs (doublereal * x) { -if(*x >= 0) - return(*x); -return(- *x); + if (*x >= 0) + return (*x); + return (-*x); } diff --git a/libf2c/libF77/d_acos.c b/libf2c/libF77/d_acos.c index a87ff30da9b..41c4f172c65 100644 --- a/libf2c/libF77/d_acos.c +++ b/libf2c/libF77/d_acos.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double d_acos(doublereal *x) +double +d_acos (doublereal * x) { -return( acos(*x) ); + return (acos (*x)); } diff --git a/libf2c/libF77/d_asin.c b/libf2c/libF77/d_asin.c index ea2815ace70..65603891501 100644 --- a/libf2c/libF77/d_asin.c +++ b/libf2c/libF77/d_asin.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double d_asin(doublereal *x) +double +d_asin (doublereal * x) { -return( asin(*x) ); + return (asin (*x)); } diff --git a/libf2c/libF77/d_atan.c b/libf2c/libF77/d_atan.c index d1624fd4f1e..e25fa2e4177 100644 --- a/libf2c/libF77/d_atan.c +++ b/libf2c/libF77/d_atan.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double d_atan(doublereal *x) +double +d_atan (doublereal * x) { -return( atan(*x) ); + return (atan (*x)); } diff --git a/libf2c/libF77/d_atn2.c b/libf2c/libF77/d_atn2.c index 9a6ff8c4c56..e0b217863a5 100644 --- a/libf2c/libF77/d_atn2.c +++ b/libf2c/libF77/d_atn2.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double d_atn2(doublereal *x, doublereal *y) +double +d_atn2 (doublereal * x, doublereal * y) { -return( atan2(*x,*y) ); + return (atan2 (*x, *y)); } diff --git a/libf2c/libF77/d_cnjg.c b/libf2c/libF77/d_cnjg.c index 36909ecab0d..bc46ae69598 100644 --- a/libf2c/libF77/d_cnjg.c +++ b/libf2c/libF77/d_cnjg.c @@ -1,9 +1,9 @@ #include "f2c.h" void -d_cnjg(doublecomplex *r, doublecomplex *z) +d_cnjg (doublecomplex * r, doublecomplex * z) { - doublereal zi = z->i; - r->r = z->r; - r->i = -zi; - } + doublereal zi = z->i; + r->r = z->r; + r->i = -zi; +} diff --git a/libf2c/libF77/d_cos.c b/libf2c/libF77/d_cos.c index 83f9198028a..010db6b5421 100644 --- a/libf2c/libF77/d_cos.c +++ b/libf2c/libF77/d_cos.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double d_cos(doublereal *x) +double +d_cos (doublereal * x) { -return( cos(*x) ); + return (cos (*x)); } diff --git a/libf2c/libF77/d_cosh.c b/libf2c/libF77/d_cosh.c index c1bffcb0bad..00938bda13e 100644 --- a/libf2c/libF77/d_cosh.c +++ b/libf2c/libF77/d_cosh.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double d_cosh(doublereal *x) +double +d_cosh (doublereal * x) { -return( cosh(*x) ); + return (cosh (*x)); } diff --git a/libf2c/libF77/d_dim.c b/libf2c/libF77/d_dim.c index a52ba7642ed..a4274ca6859 100644 --- a/libf2c/libF77/d_dim.c +++ b/libf2c/libF77/d_dim.c @@ -1,6 +1,7 @@ #include "f2c.h" -double d_dim(doublereal *a, doublereal *b) +double +d_dim (doublereal * a, doublereal * b) { -return( *a > *b ? *a - *b : 0); + return (*a > *b ? *a - *b : 0); } diff --git a/libf2c/libF77/d_exp.c b/libf2c/libF77/d_exp.c index b4afe87d01f..7b4f3e529c4 100644 --- a/libf2c/libF77/d_exp.c +++ b/libf2c/libF77/d_exp.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double d_exp(doublereal *x) +double +d_exp (doublereal * x) { -return( exp(*x) ); + return (exp (*x)); } diff --git a/libf2c/libF77/d_imag.c b/libf2c/libF77/d_imag.c index a53d00c0599..cc937644b75 100644 --- a/libf2c/libF77/d_imag.c +++ b/libf2c/libF77/d_imag.c @@ -1,6 +1,7 @@ #include "f2c.h" -double d_imag(doublecomplex *z) +double +d_imag (doublecomplex * z) { -return(z->i); + return (z->i); } diff --git a/libf2c/libF77/d_int.c b/libf2c/libF77/d_int.c index dca077cab4e..f7ab8b0cb6a 100644 --- a/libf2c/libF77/d_int.c +++ b/libf2c/libF77/d_int.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double d_int(doublereal *x) +double +d_int (doublereal * x) { -return( (*x>0) ? floor(*x) : -floor(- *x) ); + return ((*x > 0) ? floor (*x) : -floor (-*x)); } diff --git a/libf2c/libF77/d_lg10.c b/libf2c/libF77/d_lg10.c index 32824b88df0..d0f86e554d0 100644 --- a/libf2c/libF77/d_lg10.c +++ b/libf2c/libF77/d_lg10.c @@ -4,7 +4,8 @@ #undef abs #include <math.h> -double d_lg10(doublereal *x) +double +d_lg10 (doublereal * x) { -return( log10e * log(*x) ); + return (log10e * log (*x)); } diff --git a/libf2c/libF77/d_log.c b/libf2c/libF77/d_log.c index 50bbefd93c1..95dc767fb2a 100644 --- a/libf2c/libF77/d_log.c +++ b/libf2c/libF77/d_log.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double d_log(doublereal *x) +double +d_log (doublereal * x) { -return( log(*x) ); + return (log (*x)); } diff --git a/libf2c/libF77/d_mod.c b/libf2c/libF77/d_mod.c index bbc24ad6547..15cedefadd1 100644 --- a/libf2c/libF77/d_mod.c +++ b/libf2c/libF77/d_mod.c @@ -1,31 +1,33 @@ #include "f2c.h" #ifdef IEEE_drem -double drem(double, double); +double drem (double, double); #else #undef abs #include <math.h> #endif -double d_mod(doublereal *x, doublereal *y) +double +d_mod (doublereal * x, doublereal * y) { #ifdef IEEE_drem - double xa, ya, z; - if ((ya = *y) < 0.) - ya = -ya; - z = drem(xa = *x, ya); - if (xa > 0) { - if (z < 0) - z += ya; - } - else if (z > 0) - z -= ya; - return z; + double xa, ya, z; + if ((ya = *y) < 0.) + ya = -ya; + z = drem (xa = *x, ya); + if (xa > 0) + { + if (z < 0) + z += ya; + } + else if (z > 0) + z -= ya; + return z; #else - double quotient; - if( (quotient = *x / *y) >= 0) - quotient = floor(quotient); - else - quotient = -floor(-quotient); - return(*x - (*y) * quotient ); + double quotient; + if ((quotient = *x / *y) >= 0) + quotient = floor (quotient); + else + quotient = -floor (-quotient); + return (*x - (*y) * quotient); #endif } diff --git a/libf2c/libF77/d_nint.c b/libf2c/libF77/d_nint.c index b74a15f99de..8be42758644 100644 --- a/libf2c/libF77/d_nint.c +++ b/libf2c/libF77/d_nint.c @@ -2,8 +2,8 @@ #undef abs #include <math.h> -double d_nint(doublereal *x) +double +d_nint (doublereal * x) { -return( (*x)>=0 ? - floor(*x + .5) : -floor(.5 - *x) ); + return ((*x) >= 0 ? floor (*x + .5) : -floor (.5 - *x)); } diff --git a/libf2c/libF77/d_prod.c b/libf2c/libF77/d_prod.c index b39580fa502..11fe2c7f68e 100644 --- a/libf2c/libF77/d_prod.c +++ b/libf2c/libF77/d_prod.c @@ -1,6 +1,7 @@ #include "f2c.h" -double d_prod(real *x, real *y) +double +d_prod (real * x, real * y) { -return( (*x) * (*y) ); + return ((*x) * (*y)); } diff --git a/libf2c/libF77/d_sign.c b/libf2c/libF77/d_sign.c index c77d843bada..da8d24ba7a1 100644 --- a/libf2c/libF77/d_sign.c +++ b/libf2c/libF77/d_sign.c @@ -1,8 +1,9 @@ #include "f2c.h" -double d_sign(doublereal *a, doublereal *b) +double +d_sign (doublereal * a, doublereal * b) { -double x; -x = (*a >= 0 ? *a : - *a); -return( *b >= 0 ? x : -x); + double x; + x = (*a >= 0 ? *a : -*a); + return (*b >= 0 ? x : -x); } diff --git a/libf2c/libF77/d_sin.c b/libf2c/libF77/d_sin.c index ed51ebd53e0..24b37a439e5 100644 --- a/libf2c/libF77/d_sin.c +++ b/libf2c/libF77/d_sin.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double d_sin(doublereal *x) +double +d_sin (doublereal * x) { -return( sin(*x) ); + return (sin (*x)); } diff --git a/libf2c/libF77/d_sinh.c b/libf2c/libF77/d_sinh.c index b691dc0f138..dc9dc439073 100644 --- a/libf2c/libF77/d_sinh.c +++ b/libf2c/libF77/d_sinh.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double d_sinh(doublereal *x) +double +d_sinh (doublereal * x) { -return( sinh(*x) ); + return (sinh (*x)); } diff --git a/libf2c/libF77/d_sqrt.c b/libf2c/libF77/d_sqrt.c index 760a524f80f..0a458823318 100644 --- a/libf2c/libF77/d_sqrt.c +++ b/libf2c/libF77/d_sqrt.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double d_sqrt(doublereal *x) +double +d_sqrt (doublereal * x) { -return( sqrt(*x) ); + return (sqrt (*x)); } diff --git a/libf2c/libF77/d_tan.c b/libf2c/libF77/d_tan.c index a93e58b0a19..370c1b85fef 100644 --- a/libf2c/libF77/d_tan.c +++ b/libf2c/libF77/d_tan.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double d_tan(doublereal *x) +double +d_tan (doublereal * x) { -return( tan(*x) ); + return (tan (*x)); } diff --git a/libf2c/libF77/d_tanh.c b/libf2c/libF77/d_tanh.c index 06c44d00497..df81ea0df22 100644 --- a/libf2c/libF77/d_tanh.c +++ b/libf2c/libF77/d_tanh.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double d_tanh(doublereal *x) +double +d_tanh (doublereal * x) { -return( tanh(*x) ); + return (tanh (*x)); } diff --git a/libf2c/libF77/derf_.c b/libf2c/libF77/derf_.c index cc41913441c..b78fde0e9b4 100644 --- a/libf2c/libF77/derf_.c +++ b/libf2c/libF77/derf_.c @@ -1,7 +1,8 @@ #include "f2c.h" -extern double erf(double); -double G77_derf_0 (doublereal *x) +extern double erf (double); +double +G77_derf_0 (doublereal * x) { -return( erf(*x) ); + return (erf (*x)); } diff --git a/libf2c/libF77/derfc_.c b/libf2c/libF77/derfc_.c index 0be115912a6..78e8e889c38 100644 --- a/libf2c/libF77/derfc_.c +++ b/libf2c/libF77/derfc_.c @@ -1,8 +1,9 @@ #include "f2c.h" -extern double erfc(double); +extern double erfc (double); -double G77_derfc_0 (doublereal *x) +double +G77_derfc_0 (doublereal * x) { -return( erfc(*x) ); + return (erfc (*x)); } diff --git a/libf2c/libF77/dtime_.c b/libf2c/libF77/dtime_.c index 9d5abf69dcf..e2ea1c6b5d6 100644 --- a/libf2c/libF77/dtime_.c +++ b/libf2c/libF77/dtime_.c @@ -23,27 +23,27 @@ #endif #endif - double -dtime_(float *tarray) +double +dtime_ (float *tarray) { #ifdef USE_CLOCK #ifndef CLOCKS_PER_SECOND #define CLOCKS_PER_SECOND Hz #endif - static double t0; - double t = clock(); - tarray[1] = 0; - tarray[0] = (t - t0) / CLOCKS_PER_SECOND; - t0 = t; - return tarray[0]; + static double t0; + double t = clock (); + tarray[1] = 0; + tarray[0] = (t - t0) / CLOCKS_PER_SECOND; + t0 = t; + return tarray[0]; #else - struct tms t; - static struct tms t0; + struct tms t; + static struct tms t0; - times(&t); - tarray[0] = (double)(t.tms_utime - t0.tms_utime) / Hz; - tarray[1] = (double)(t.tms_stime - t0.tms_stime) / Hz; - t0 = t; - return tarray[0] + tarray[1]; + times (&t); + tarray[0] = (double) (t.tms_utime - t0.tms_utime) / Hz; + tarray[1] = (double) (t.tms_stime - t0.tms_stime) / Hz; + t0 = t; + return tarray[0] + tarray[1]; #endif - } +} diff --git a/libf2c/libF77/ef1asc_.c b/libf2c/libF77/ef1asc_.c index 2e12423196f..d9bea344e4f 100644 --- a/libf2c/libF77/ef1asc_.c +++ b/libf2c/libF77/ef1asc_.c @@ -6,9 +6,10 @@ #define M ( (long) (sizeof(long) - 1) ) #define EVEN(x) ( ( (x)+ M) & (~M) ) -extern void s_copy(char*,char*,ftnlen,ftnlen); -int G77_ef1asc_0 (ftnint *a, ftnlen *la, ftnint *b, ftnlen *lb) +extern void s_copy (char *, char *, ftnlen, ftnlen); +int +G77_ef1asc_0 (ftnint * a, ftnlen * la, ftnint * b, ftnlen * lb) { -s_copy( (char *)a, (char *)b, EVEN(*la), *lb ); -return 0; /* ignored return value */ + s_copy ((char *) a, (char *) b, EVEN (*la), *lb); + return 0; /* ignored return value */ } diff --git a/libf2c/libF77/ef1cmc_.c b/libf2c/libF77/ef1cmc_.c index 79eabdf39b1..2e102fb6b5d 100644 --- a/libf2c/libF77/ef1cmc_.c +++ b/libf2c/libF77/ef1cmc_.c @@ -2,8 +2,9 @@ #include "f2c.h" -extern integer s_cmp(char*,char*,ftnlen,ftnlen); -integer G77_ef1cmc_0 (ftnint *a, ftnlen *la, ftnint *b, ftnlen *lb) +extern integer s_cmp (char *, char *, ftnlen, ftnlen); +integer +G77_ef1cmc_0 (ftnint * a, ftnlen * la, ftnint * b, ftnlen * lb) { -return( s_cmp( (char *)a, (char *)b, *la, *lb) ); + return (s_cmp ((char *) a, (char *) b, *la, *lb)); } diff --git a/libf2c/libF77/erf_.c b/libf2c/libF77/erf_.c index e8a90edacf4..fadbfaf038a 100644 --- a/libf2c/libF77/erf_.c +++ b/libf2c/libF77/erf_.c @@ -1,7 +1,8 @@ #include "f2c.h" -extern double erf(double); -double G77_erf_0 (real *x) +extern double erf (double); +double +G77_erf_0 (real * x) { -return( erf(*x) ); + return (erf (*x)); } diff --git a/libf2c/libF77/erfc_.c b/libf2c/libF77/erfc_.c index 5f724793245..7f3ff8a5dbd 100644 --- a/libf2c/libF77/erfc_.c +++ b/libf2c/libF77/erfc_.c @@ -1,7 +1,8 @@ #include "f2c.h" -extern double erfc(double); -double G77_erfc_0 (real *x) +extern double erfc (double); +double +G77_erfc_0 (real * x) { -return( erfc(*x) ); + return (erfc (*x)); } diff --git a/libf2c/libF77/etime_.c b/libf2c/libF77/etime_.c index 48a8f6b347c..cc64612c8d9 100644 --- a/libf2c/libF77/etime_.c +++ b/libf2c/libF77/etime_.c @@ -23,21 +23,21 @@ #endif #endif - double -etime_(float *tarray) +double +etime_ (float *tarray) { #ifdef USE_CLOCK #ifndef CLOCKS_PER_SECOND #define CLOCKS_PER_SECOND Hz #endif - double t = clock(); - tarray[1] = 0; - return tarray[0] = t / CLOCKS_PER_SECOND; + double t = clock (); + tarray[1] = 0; + return tarray[0] = t / CLOCKS_PER_SECOND; #else - struct tms t; + struct tms t; - times(&t); - return (tarray[0] = (double)t.tms_utime/Hz) - + (tarray[1] = (double)t.tms_stime/Hz); + times (&t); + return (tarray[0] = (double) t.tms_utime / Hz) + + (tarray[1] = (double) t.tms_stime / Hz); #endif - } +} diff --git a/libf2c/libF77/exit_.c b/libf2c/libF77/exit_.c index e86d07068b4..adf3d859274 100644 --- a/libf2c/libF77/exit_.c +++ b/libf2c/libF77/exit_.c @@ -13,13 +13,13 @@ #undef min #undef max #include <stdlib.h> -extern void f_exit(void); +extern void f_exit (void); - void -G77_exit_0 (integer *rc) +void +G77_exit_0 (integer * rc) { #ifdef NO_ONEXIT - f_exit(); + f_exit (); #endif - exit(*rc); - } + exit (*rc); +} diff --git a/libf2c/libF77/f2ch.add b/libf2c/libF77/f2ch.add index a2acc17a159..04b13e8de5d 100644 --- a/libf2c/libF77/f2ch.add +++ b/libf2c/libF77/f2ch.add @@ -2,161 +2,162 @@ for compiling libF77 and libI77. */ #ifdef __cplusplus -extern "C" { -extern int abort_(void); -extern double c_abs(complex *); -extern void c_cos(complex *, complex *); -extern void c_div(complex *, complex *, complex *); -extern void c_exp(complex *, complex *); -extern void c_log(complex *, complex *); -extern void c_sin(complex *, complex *); -extern void c_sqrt(complex *, complex *); -extern double d_abs(double *); -extern double d_acos(double *); -extern double d_asin(double *); -extern double d_atan(double *); -extern double d_atn2(double *, double *); -extern void d_cnjg(doublecomplex *, doublecomplex *); -extern double d_cos(double *); -extern double d_cosh(double *); -extern double d_dim(double *, double *); -extern double d_exp(double *); -extern double d_imag(doublecomplex *); -extern double d_int(double *); -extern double d_lg10(double *); -extern double d_log(double *); -extern double d_mod(double *, double *); -extern double d_nint(double *); -extern double d_prod(float *, float *); -extern double d_sign(double *, double *); -extern double d_sin(double *); -extern double d_sinh(double *); -extern double d_sqrt(double *); -extern double d_tan(double *); -extern double d_tanh(double *); -extern double derf_(double *); -extern double derfc_(double *); -extern integer do_fio(ftnint *, char *, ftnlen); -extern integer do_lio(ftnint *, ftnint *, char *, ftnlen); -extern integer do_uio(ftnint *, char *, ftnlen); -extern integer e_rdfe(void); -extern integer e_rdue(void); -extern integer e_rsfe(void); -extern integer e_rsfi(void); -extern integer e_rsle(void); -extern integer e_rsli(void); -extern integer e_rsue(void); -extern integer e_wdfe(void); -extern integer e_wdue(void); -extern integer e_wsfe(void); -extern integer e_wsfi(void); -extern integer e_wsle(void); -extern integer e_wsli(void); -extern integer e_wsue(void); -extern int ef1asc_(ftnint *, ftnlen *, ftnint *, ftnlen *); -extern integer ef1cmc_(ftnint *, ftnlen *, ftnint *, ftnlen *); -extern double erf(double); -extern double erf_(float *); -extern double erfc(double); -extern double erfc_(float *); -extern integer f_back(alist *); -extern integer f_clos(cllist *); -extern integer f_end(alist *); -extern void f_exit(void); -extern integer f_inqu(inlist *); -extern integer f_open(olist *); -extern integer f_rew(alist *); -extern int flush_(void); -extern void getarg_(integer *, char *, ftnlen); -extern void getenv_(char *, char *, ftnlen, ftnlen); -extern short h_abs(short *); -extern short h_dim(short *, short *); -extern short h_dnnt(double *); -extern short h_indx(char *, char *, ftnlen, ftnlen); -extern short h_len(char *, ftnlen); -extern short h_mod(short *, short *); -extern short h_nint(float *); -extern short h_sign(short *, short *); -extern short hl_ge(char *, char *, ftnlen, ftnlen); -extern short hl_gt(char *, char *, ftnlen, ftnlen); -extern short hl_le(char *, char *, ftnlen, ftnlen); -extern short hl_lt(char *, char *, ftnlen, ftnlen); -extern integer i_abs(integer *); -extern integer i_dim(integer *, integer *); -extern integer i_dnnt(double *); -extern integer i_indx(char *, char *, ftnlen, ftnlen); -extern integer i_len(char *, ftnlen); -extern integer i_mod(integer *, integer *); -extern integer i_nint(float *); -extern integer i_sign(integer *, integer *); -extern integer iargc_(void); -extern ftnlen l_ge(char *, char *, ftnlen, ftnlen); -extern ftnlen l_gt(char *, char *, ftnlen, ftnlen); -extern ftnlen l_le(char *, char *, ftnlen, ftnlen); -extern ftnlen l_lt(char *, char *, ftnlen, ftnlen); -extern void pow_ci(complex *, complex *, integer *); -extern double pow_dd(double *, double *); -extern double pow_di(double *, integer *); -extern short pow_hh(short *, shortint *); -extern integer pow_ii(integer *, integer *); -extern double pow_ri(float *, integer *); -extern void pow_zi(doublecomplex *, doublecomplex *, integer *); -extern void pow_zz(doublecomplex *, doublecomplex *, doublecomplex *); -extern double r_abs(float *); -extern double r_acos(float *); -extern double r_asin(float *); -extern double r_atan(float *); -extern double r_atn2(float *, float *); -extern void r_cnjg(complex *, complex *); -extern double r_cos(float *); -extern double r_cosh(float *); -extern double r_dim(float *, float *); -extern double r_exp(float *); -extern double r_imag(complex *); -extern double r_int(float *); -extern double r_lg10(float *); -extern double r_log(float *); -extern double r_mod(float *, float *); -extern double r_nint(float *); -extern double r_sign(float *, float *); -extern double r_sin(float *); -extern double r_sinh(float *); -extern double r_sqrt(float *); -extern double r_tan(float *); -extern double r_tanh(float *); -extern void s_cat(char *, char **, integer *, integer *, ftnlen); -extern integer s_cmp(char *, char *, ftnlen, ftnlen); -extern void s_copy(char *, char *, ftnlen, ftnlen); -extern int s_paus(char *, ftnlen); -extern integer s_rdfe(cilist *); -extern integer s_rdue(cilist *); -extern integer s_rnge(char *, integer, char *, integer); -extern integer s_rsfe(cilist *); -extern integer s_rsfi(icilist *); -extern integer s_rsle(cilist *); -extern integer s_rsli(icilist *); -extern integer s_rsne(cilist *); -extern integer s_rsni(icilist *); -extern integer s_rsue(cilist *); -extern int s_stop(char *, ftnlen); -extern integer s_wdfe(cilist *); -extern integer s_wdue(cilist *); -extern integer s_wsfe(cilist *); -extern integer s_wsfi(icilist *); -extern integer s_wsle(cilist *); -extern integer s_wsli(icilist *); -extern integer s_wsne(cilist *); -extern integer s_wsni(icilist *); -extern integer s_wsue(cilist *); -extern void sig_die(char *, int); -extern integer signal_(integer *, void (*)(int)); -extern integer system_(char *, ftnlen); -extern double z_abs(doublecomplex *); -extern void z_cos(doublecomplex *, doublecomplex *); -extern void z_div(doublecomplex *, doublecomplex *, doublecomplex *); -extern void z_exp(doublecomplex *, doublecomplex *); -extern void z_log(doublecomplex *, doublecomplex *); -extern void z_sin(doublecomplex *, doublecomplex *); -extern void z_sqrt(doublecomplex *, doublecomplex *); - } +extern "C" +{ + extern int abort_ (void); + extern double c_abs (complex *); + extern void c_cos (complex *, complex *); + extern void c_div (complex *, complex *, complex *); + extern void c_exp (complex *, complex *); + extern void c_log (complex *, complex *); + extern void c_sin (complex *, complex *); + extern void c_sqrt (complex *, complex *); + extern double d_abs (double *); + extern double d_acos (double *); + extern double d_asin (double *); + extern double d_atan (double *); + extern double d_atn2 (double *, double *); + extern void d_cnjg (doublecomplex *, doublecomplex *); + extern double d_cos (double *); + extern double d_cosh (double *); + extern double d_dim (double *, double *); + extern double d_exp (double *); + extern double d_imag (doublecomplex *); + extern double d_int (double *); + extern double d_lg10 (double *); + extern double d_log (double *); + extern double d_mod (double *, double *); + extern double d_nint (double *); + extern double d_prod (float *, float *); + extern double d_sign (double *, double *); + extern double d_sin (double *); + extern double d_sinh (double *); + extern double d_sqrt (double *); + extern double d_tan (double *); + extern double d_tanh (double *); + extern double derf_ (double *); + extern double derfc_ (double *); + extern integer do_fio (ftnint *, char *, ftnlen); + extern integer do_lio (ftnint *, ftnint *, char *, ftnlen); + extern integer do_uio (ftnint *, char *, ftnlen); + extern integer e_rdfe (void); + extern integer e_rdue (void); + extern integer e_rsfe (void); + extern integer e_rsfi (void); + extern integer e_rsle (void); + extern integer e_rsli (void); + extern integer e_rsue (void); + extern integer e_wdfe (void); + extern integer e_wdue (void); + extern integer e_wsfe (void); + extern integer e_wsfi (void); + extern integer e_wsle (void); + extern integer e_wsli (void); + extern integer e_wsue (void); + extern int ef1asc_ (ftnint *, ftnlen *, ftnint *, ftnlen *); + extern integer ef1cmc_ (ftnint *, ftnlen *, ftnint *, ftnlen *); + extern double erf (double); + extern double erf_ (float *); + extern double erfc (double); + extern double erfc_ (float *); + extern integer f_back (alist *); + extern integer f_clos (cllist *); + extern integer f_end (alist *); + extern void f_exit (void); + extern integer f_inqu (inlist *); + extern integer f_open (olist *); + extern integer f_rew (alist *); + extern int flush_ (void); + extern void getarg_ (integer *, char *, ftnlen); + extern void getenv_ (char *, char *, ftnlen, ftnlen); + extern short h_abs (short *); + extern short h_dim (short *, short *); + extern short h_dnnt (double *); + extern short h_indx (char *, char *, ftnlen, ftnlen); + extern short h_len (char *, ftnlen); + extern short h_mod (short *, short *); + extern short h_nint (float *); + extern short h_sign (short *, short *); + extern short hl_ge (char *, char *, ftnlen, ftnlen); + extern short hl_gt (char *, char *, ftnlen, ftnlen); + extern short hl_le (char *, char *, ftnlen, ftnlen); + extern short hl_lt (char *, char *, ftnlen, ftnlen); + extern integer i_abs (integer *); + extern integer i_dim (integer *, integer *); + extern integer i_dnnt (double *); + extern integer i_indx (char *, char *, ftnlen, ftnlen); + extern integer i_len (char *, ftnlen); + extern integer i_mod (integer *, integer *); + extern integer i_nint (float *); + extern integer i_sign (integer *, integer *); + extern integer iargc_ (void); + extern ftnlen l_ge (char *, char *, ftnlen, ftnlen); + extern ftnlen l_gt (char *, char *, ftnlen, ftnlen); + extern ftnlen l_le (char *, char *, ftnlen, ftnlen); + extern ftnlen l_lt (char *, char *, ftnlen, ftnlen); + extern void pow_ci (complex *, complex *, integer *); + extern double pow_dd (double *, double *); + extern double pow_di (double *, integer *); + extern short pow_hh (short *, shortint *); + extern integer pow_ii (integer *, integer *); + extern double pow_ri (float *, integer *); + extern void pow_zi (doublecomplex *, doublecomplex *, integer *); + extern void pow_zz (doublecomplex *, doublecomplex *, doublecomplex *); + extern double r_abs (float *); + extern double r_acos (float *); + extern double r_asin (float *); + extern double r_atan (float *); + extern double r_atn2 (float *, float *); + extern void r_cnjg (complex *, complex *); + extern double r_cos (float *); + extern double r_cosh (float *); + extern double r_dim (float *, float *); + extern double r_exp (float *); + extern double r_imag (complex *); + extern double r_int (float *); + extern double r_lg10 (float *); + extern double r_log (float *); + extern double r_mod (float *, float *); + extern double r_nint (float *); + extern double r_sign (float *, float *); + extern double r_sin (float *); + extern double r_sinh (float *); + extern double r_sqrt (float *); + extern double r_tan (float *); + extern double r_tanh (float *); + extern void s_cat (char *, char **, integer *, integer *, ftnlen); + extern integer s_cmp (char *, char *, ftnlen, ftnlen); + extern void s_copy (char *, char *, ftnlen, ftnlen); + extern int s_paus (char *, ftnlen); + extern integer s_rdfe (cilist *); + extern integer s_rdue (cilist *); + extern integer s_rnge (char *, integer, char *, integer); + extern integer s_rsfe (cilist *); + extern integer s_rsfi (icilist *); + extern integer s_rsle (cilist *); + extern integer s_rsli (icilist *); + extern integer s_rsne (cilist *); + extern integer s_rsni (icilist *); + extern integer s_rsue (cilist *); + extern int s_stop (char *, ftnlen); + extern integer s_wdfe (cilist *); + extern integer s_wdue (cilist *); + extern integer s_wsfe (cilist *); + extern integer s_wsfi (icilist *); + extern integer s_wsle (cilist *); + extern integer s_wsli (icilist *); + extern integer s_wsne (cilist *); + extern integer s_wsni (icilist *); + extern integer s_wsue (cilist *); + extern void sig_die (char *, int); + extern integer signal_ (integer *, void (*)(int)); + extern integer system_ (char *, ftnlen); + extern double z_abs (doublecomplex *); + extern void z_cos (doublecomplex *, doublecomplex *); + extern void z_div (doublecomplex *, doublecomplex *, doublecomplex *); + extern void z_exp (doublecomplex *, doublecomplex *); + extern void z_log (doublecomplex *, doublecomplex *); + extern void z_sin (doublecomplex *, doublecomplex *); + extern void z_sqrt (doublecomplex *, doublecomplex *); +} #endif diff --git a/libf2c/libF77/getarg_.c b/libf2c/libF77/getarg_.c index c873596bde8..b35043b4a48 100644 --- a/libf2c/libF77/getarg_.c +++ b/libf2c/libF77/getarg_.c @@ -6,19 +6,20 @@ * variable argument c */ -void G77_getarg_0 (ftnint *n, register char *s, ftnlen ls) +void +G77_getarg_0 (ftnint * n, register char *s, ftnlen ls) { -extern int f__xargc; -extern char **f__xargv; -register char *t; -register int i; + extern int f__xargc; + extern char **f__xargv; + register char *t; + register int i; -if(*n>=0 && *n<f__xargc) - t = f__xargv[*n]; -else - t = ""; -for(i = 0; i<ls && *t!='\0' ; ++i) - *s++ = *t++; -for( ; i<ls ; ++i) - *s++ = ' '; + if (*n >= 0 && *n < f__xargc) + t = f__xargv[*n]; + else + t = ""; + for (i = 0; i < ls && *t != '\0'; ++i) + *s++ = *t++; + for (; i < ls; ++i) + *s++ = ' '; } diff --git a/libf2c/libF77/getenv_.c b/libf2c/libF77/getenv_.c index a1654ef0d3b..2a58b90ab87 100644 --- a/libf2c/libF77/getenv_.c +++ b/libf2c/libF77/getenv_.c @@ -2,7 +2,7 @@ #undef abs #include <stdlib.h> #include <string.h> -extern char *F77_aloc(ftnlen, char*); +extern char *F77_aloc (ftnlen, char *); /* * getenv - f77 subroutine to return environment variables @@ -16,32 +16,34 @@ extern char *F77_aloc(ftnlen, char*); * if ENV_NAME is not defined */ - void +void G77_getenv_0 (char *fname, char *value, ftnlen flen, ftnlen vlen) { - char buf[256], *ep, *fp; - integer i; + char buf[256], *ep, *fp; + integer i; - 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(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++; - add_blanks: - while(vlen-- > 0) - *value++ = ' '; + 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 (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++; +add_blanks: + while (vlen-- > 0) + *value++ = ' '; +} diff --git a/libf2c/libF77/h_abs.c b/libf2c/libF77/h_abs.c index e5f4d6b3b28..9db19ca34e9 100644 --- a/libf2c/libF77/h_abs.c +++ b/libf2c/libF77/h_abs.c @@ -1,8 +1,9 @@ #include "f2c.h" -shortint h_abs(shortint *x) +shortint +h_abs (shortint * x) { -if(*x >= 0) - return(*x); -return(- *x); + if (*x >= 0) + return (*x); + return (-*x); } diff --git a/libf2c/libF77/h_dim.c b/libf2c/libF77/h_dim.c index 04cf55d1059..1519478747d 100644 --- a/libf2c/libF77/h_dim.c +++ b/libf2c/libF77/h_dim.c @@ -1,6 +1,7 @@ #include "f2c.h" -shortint h_dim(shortint *a, shortint *b) +shortint +h_dim (shortint * a, shortint * b) { -return( *a > *b ? *a - *b : 0); + return (*a > *b ? *a - *b : 0); } diff --git a/libf2c/libF77/h_dnnt.c b/libf2c/libF77/h_dnnt.c index 651d05c5679..46c83bbd28e 100644 --- a/libf2c/libF77/h_dnnt.c +++ b/libf2c/libF77/h_dnnt.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -shortint h_dnnt(doublereal *x) +shortint +h_dnnt (doublereal * x) { -return (shortint)(*x >= 0. ? floor(*x + .5) : -floor(.5 - *x)); + return (shortint) (*x >= 0. ? floor (*x + .5) : -floor (.5 - *x)); } diff --git a/libf2c/libF77/h_indx.c b/libf2c/libF77/h_indx.c index a78c8733bdf..2353b2b143a 100644 --- a/libf2c/libF77/h_indx.c +++ b/libf2c/libF77/h_indx.c @@ -1,22 +1,23 @@ #include "f2c.h" -shortint h_indx(char *a, char *b, ftnlen la, ftnlen lb) +shortint +h_indx (char *a, char *b, ftnlen la, ftnlen lb) { -ftnlen i, n; -char *s, *t, *bend; + ftnlen i, n; + char *s, *t, *bend; -n = la - lb + 1; -bend = b + lb; + n = la - lb + 1; + bend = b + lb; -for(i = 0 ; i < n ; ++i) - { - s = a + i; - t = b; - while(t < bend) - if(*s++ != *t++) - goto no; - return((shortint)i+1); - no: ; - } -return(0); + for (i = 0; i < n; ++i) + { + s = a + i; + t = b; + while (t < bend) + if (*s++ != *t++) + goto no; + return ((shortint) i + 1); + no:; + } + return (0); } diff --git a/libf2c/libF77/h_len.c b/libf2c/libF77/h_len.c index 8c63116d1b9..0782af14c01 100644 --- a/libf2c/libF77/h_len.c +++ b/libf2c/libF77/h_len.c @@ -1,6 +1,7 @@ #include "f2c.h" -shortint h_len(char *s, ftnlen n) +shortint +h_len (char *s, ftnlen n) { -return(n); + return (n); } diff --git a/libf2c/libF77/h_mod.c b/libf2c/libF77/h_mod.c index 998ada752ad..c04e0df823b 100644 --- a/libf2c/libF77/h_mod.c +++ b/libf2c/libF77/h_mod.c @@ -1,6 +1,7 @@ #include "f2c.h" -shortint h_mod(short *a, short *b) +shortint +h_mod (short *a, short *b) { -return( *a % *b); + return (*a % *b); } diff --git a/libf2c/libF77/h_nint.c b/libf2c/libF77/h_nint.c index bdfee642015..a8c366a41be 100644 --- a/libf2c/libF77/h_nint.c +++ b/libf2c/libF77/h_nint.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -shortint h_nint(real *x) +shortint +h_nint (real * x) { -return (shortint)(*x >= 0 ? floor(*x + .5) : -floor(.5 - *x)); + return (shortint) (*x >= 0 ? floor (*x + .5) : -floor (.5 - *x)); } diff --git a/libf2c/libF77/h_sign.c b/libf2c/libF77/h_sign.c index 7efc7cab59c..70402325be2 100644 --- a/libf2c/libF77/h_sign.c +++ b/libf2c/libF77/h_sign.c @@ -1,8 +1,9 @@ #include "f2c.h" -shortint h_sign(shortint *a, shortint *b) +shortint +h_sign (shortint * a, shortint * b) { -shortint x; -x = (*a >= 0 ? *a : - *a); -return( *b >= 0 ? x : -x); + shortint x; + x = (*a >= 0 ? *a : -*a); + return (*b >= 0 ? x : -x); } diff --git a/libf2c/libF77/hl_ge.c b/libf2c/libF77/hl_ge.c index 2415216eaf9..988686d8d1d 100644 --- a/libf2c/libF77/hl_ge.c +++ b/libf2c/libF77/hl_ge.c @@ -1,7 +1,8 @@ #include "f2c.h" -extern integer s_cmp(char *, char *, ftnlen, ftnlen); -shortlogical hl_ge(char *a, char *b, ftnlen la, ftnlen lb) +extern integer s_cmp (char *, char *, ftnlen, ftnlen); +shortlogical +hl_ge (char *a, char *b, ftnlen la, ftnlen lb) { -return(s_cmp(a,b,la,lb) >= 0); + return (s_cmp (a, b, la, lb) >= 0); } diff --git a/libf2c/libF77/hl_gt.c b/libf2c/libF77/hl_gt.c index bf5c4208bec..0024ca7a0d2 100644 --- a/libf2c/libF77/hl_gt.c +++ b/libf2c/libF77/hl_gt.c @@ -1,7 +1,8 @@ #include "f2c.h" -extern integer s_cmp(char *, char *, ftnlen, ftnlen); -shortlogical hl_gt(char *a, char *b, ftnlen la, ftnlen lb) +extern integer s_cmp (char *, char *, ftnlen, ftnlen); +shortlogical +hl_gt (char *a, char *b, ftnlen la, ftnlen lb) { -return(s_cmp(a,b,la,lb) > 0); + return (s_cmp (a, b, la, lb) > 0); } diff --git a/libf2c/libF77/hl_le.c b/libf2c/libF77/hl_le.c index cb6fe05f624..76aa3e12da7 100644 --- a/libf2c/libF77/hl_le.c +++ b/libf2c/libF77/hl_le.c @@ -1,7 +1,8 @@ #include "f2c.h" -extern integer s_cmp(char *, char *, ftnlen, ftnlen); -shortlogical hl_le(char *a, char *b, ftnlen la, ftnlen lb) +extern integer s_cmp (char *, char *, ftnlen, ftnlen); +shortlogical +hl_le (char *a, char *b, ftnlen la, ftnlen lb) { -return(s_cmp(a,b,la,lb) <= 0); + return (s_cmp (a, b, la, lb) <= 0); } diff --git a/libf2c/libF77/hl_lt.c b/libf2c/libF77/hl_lt.c index f774c71e155..68a47fa98eb 100644 --- a/libf2c/libF77/hl_lt.c +++ b/libf2c/libF77/hl_lt.c @@ -1,7 +1,8 @@ #include "f2c.h" -extern integer s_cmp(char *, char *, ftnlen, ftnlen); -shortlogical hl_lt(char *a, char *b, ftnlen la, ftnlen lb) +extern integer s_cmp (char *, char *, ftnlen, ftnlen); +shortlogical +hl_lt (char *a, char *b, ftnlen la, ftnlen lb) { -return(s_cmp(a,b,la,lb) < 0); + return (s_cmp (a, b, la, lb) < 0); } diff --git a/libf2c/libF77/i_abs.c b/libf2c/libF77/i_abs.c index 2f96f5c7838..2ed183a6225 100644 --- a/libf2c/libF77/i_abs.c +++ b/libf2c/libF77/i_abs.c @@ -1,8 +1,9 @@ #include "f2c.h" -integer i_abs(integer *x) +integer +i_abs (integer * x) { -if(*x >= 0) - return(*x); -return(- *x); + if (*x >= 0) + return (*x); + return (-*x); } diff --git a/libf2c/libF77/i_dim.c b/libf2c/libF77/i_dim.c index 68e8a3df079..66ef7c99fb4 100644 --- a/libf2c/libF77/i_dim.c +++ b/libf2c/libF77/i_dim.c @@ -1,6 +1,7 @@ #include "f2c.h" -integer i_dim(integer *a, integer *b) +integer +i_dim (integer * a, integer * b) { -return( *a > *b ? *a - *b : 0); + return (*a > *b ? *a - *b : 0); } diff --git a/libf2c/libF77/i_dnnt.c b/libf2c/libF77/i_dnnt.c index ed4fdff8086..7a3783d29e2 100644 --- a/libf2c/libF77/i_dnnt.c +++ b/libf2c/libF77/i_dnnt.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -integer i_dnnt(doublereal *x) +integer +i_dnnt (doublereal * x) { -return (integer)(*x >= 0. ? floor(*x + .5) : -floor(.5 - *x)); + return (integer) (*x >= 0. ? floor (*x + .5) : -floor (.5 - *x)); } diff --git a/libf2c/libF77/i_indx.c b/libf2c/libF77/i_indx.c index 92c44aabcf9..5b8e13693ba 100644 --- a/libf2c/libF77/i_indx.c +++ b/libf2c/libF77/i_indx.c @@ -1,22 +1,23 @@ #include "f2c.h" -integer i_indx(char *a, char *b, ftnlen la, ftnlen lb) +integer +i_indx (char *a, char *b, ftnlen la, ftnlen lb) { -ftnlen i, n; -char *s, *t, *bend; + ftnlen i, n; + char *s, *t, *bend; -n = la - lb + 1; -bend = b + lb; + n = la - lb + 1; + bend = b + lb; -for(i = 0 ; i < n ; ++i) - { - s = a + i; - t = b; - while(t < bend) - if(*s++ != *t++) - goto no; - return(i+1); - no: ; - } -return(0); + for (i = 0; i < n; ++i) + { + s = a + i; + t = b; + while (t < bend) + if (*s++ != *t++) + goto no; + return (i + 1); + no:; + } + return (0); } diff --git a/libf2c/libF77/i_len.c b/libf2c/libF77/i_len.c index 0e9cfb72a43..3a43b869de1 100644 --- a/libf2c/libF77/i_len.c +++ b/libf2c/libF77/i_len.c @@ -1,6 +1,7 @@ #include "f2c.h" -integer i_len(char *s, ftnlen n) +integer +i_len (char *s, ftnlen n) { -return(n); + return (n); } diff --git a/libf2c/libF77/i_mod.c b/libf2c/libF77/i_mod.c index 2e574f71415..7ed7b391c19 100644 --- a/libf2c/libF77/i_mod.c +++ b/libf2c/libF77/i_mod.c @@ -1,6 +1,7 @@ #include "f2c.h" -integer i_mod(integer *a, integer *b) +integer +i_mod (integer * a, integer * b) { -return( *a % *b); + return (*a % *b); } diff --git a/libf2c/libF77/i_nint.c b/libf2c/libF77/i_nint.c index 2698d5f5074..c4eaff48d33 100644 --- a/libf2c/libF77/i_nint.c +++ b/libf2c/libF77/i_nint.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -integer i_nint(real *x) +integer +i_nint (real * x) { -return (integer)(*x >= 0 ? floor(*x + .5) : -floor(.5 - *x)); + return (integer) (*x >= 0 ? floor (*x + .5) : -floor (.5 - *x)); } diff --git a/libf2c/libF77/i_sign.c b/libf2c/libF77/i_sign.c index 1db4729126b..cf090086d00 100644 --- a/libf2c/libF77/i_sign.c +++ b/libf2c/libF77/i_sign.c @@ -1,8 +1,9 @@ #include "f2c.h" -integer i_sign(integer *a, integer *b) +integer +i_sign (integer * a, integer * b) { -integer x; -x = (*a >= 0 ? *a : - *a); -return( *b >= 0 ? x : -x); + integer x; + x = (*a >= 0 ? *a : -*a); + return (*b >= 0 ? x : -x); } diff --git a/libf2c/libF77/iargc_.c b/libf2c/libF77/iargc_.c index a57c25711d1..c3165709a53 100644 --- a/libf2c/libF77/iargc_.c +++ b/libf2c/libF77/iargc_.c @@ -1,7 +1,8 @@ #include "f2c.h" -ftnint G77_iargc_0 (void) +ftnint +G77_iargc_0 (void) { -extern int f__xargc; -return ( f__xargc - 1 ); + extern int f__xargc; + return (f__xargc - 1); } diff --git a/libf2c/libF77/l_ge.c b/libf2c/libF77/l_ge.c index ffa2faaad4a..78af8d04f5e 100644 --- a/libf2c/libF77/l_ge.c +++ b/libf2c/libF77/l_ge.c @@ -1,7 +1,8 @@ #include "f2c.h" -extern integer s_cmp(char *, char *, ftnlen, ftnlen); -logical l_ge(char *a, char *b, ftnlen la, ftnlen lb) +extern integer s_cmp (char *, char *, ftnlen, ftnlen); +logical +l_ge (char *a, char *b, ftnlen la, ftnlen lb) { -return(s_cmp(a,b,la,lb) >= 0); + return (s_cmp (a, b, la, lb) >= 0); } diff --git a/libf2c/libF77/l_gt.c b/libf2c/libF77/l_gt.c index e0d314407a9..be7e4894719 100644 --- a/libf2c/libF77/l_gt.c +++ b/libf2c/libF77/l_gt.c @@ -1,7 +1,8 @@ #include "f2c.h" -extern integer s_cmp(char *, char *, ftnlen, ftnlen); -logical l_gt(char *a, char *b, ftnlen la, ftnlen lb) +extern integer s_cmp (char *, char *, ftnlen, ftnlen); +logical +l_gt (char *a, char *b, ftnlen la, ftnlen lb) { -return(s_cmp(a,b,la,lb) > 0); + return (s_cmp (a, b, la, lb) > 0); } diff --git a/libf2c/libF77/l_le.c b/libf2c/libF77/l_le.c index d3e9de82c0f..d2886fb7d48 100644 --- a/libf2c/libF77/l_le.c +++ b/libf2c/libF77/l_le.c @@ -1,7 +1,8 @@ #include "f2c.h" -extern integer s_cmp(char *, char *, ftnlen, ftnlen); -logical l_le(char *a, char *b, ftnlen la, ftnlen lb) +extern integer s_cmp (char *, char *, ftnlen, ftnlen); +logical +l_le (char *a, char *b, ftnlen la, ftnlen lb) { -return(s_cmp(a,b,la,lb) <= 0); + return (s_cmp (a, b, la, lb) <= 0); } diff --git a/libf2c/libF77/l_lt.c b/libf2c/libF77/l_lt.c index df28ec09c5f..ff151f890a2 100644 --- a/libf2c/libF77/l_lt.c +++ b/libf2c/libF77/l_lt.c @@ -1,7 +1,8 @@ #include "f2c.h" -extern integer s_cmp(char *, char *, ftnlen, ftnlen); -logical l_lt(char *a, char *b, ftnlen la, ftnlen lb) +extern integer s_cmp (char *, char *, ftnlen, ftnlen); +logical +l_lt (char *a, char *b, ftnlen la, ftnlen lb) { -return(s_cmp(a,b,la,lb) < 0); + return (s_cmp (a, b, la, lb) < 0); } diff --git a/libf2c/libF77/lbitbits.c b/libf2c/libF77/lbitbits.c index 4536dc4719e..805d85848e9 100644 --- a/libf2c/libF77/lbitbits.c +++ b/libf2c/libF77/lbitbits.c @@ -4,51 +4,55 @@ #define LONGBITS 32 #endif - integer -lbit_bits(integer a, integer b, integer len) +integer +lbit_bits (integer a, integer b, integer len) { - /* Assume 2's complement arithmetic */ + /* Assume 2's complement arithmetic */ - unsigned long x, y; + unsigned long x, y; - x = (unsigned long) a; - y = (unsigned long)-1L; - x >>= b; - y <<= len; - return (integer)(x & ~y); - } + x = (unsigned long) a; + y = (unsigned long) -1L; + x >>= b; + y <<= len; + return (integer) (x & ~y); +} - integer -lbit_cshift(integer a, integer b, integer len) +integer +lbit_cshift (integer a, integer b, integer len) { - unsigned long x, y, z; + unsigned long x, y, z; - x = (unsigned long)a; - if (len <= 0) { - if (len == 0) - return 0; - goto full_len; - } - if (len >= LONGBITS) { - full_len: - if (b >= 0) { - b %= LONGBITS; - return (integer)(x << b | x >> LONGBITS -b ); - } - b = -b; - b %= LONGBITS; - return (integer)(x << LONGBITS - b | x >> b); - } - y = z = (unsigned long)-1; - y <<= len; - z &= ~y; - y &= x; - x &= z; - if (b >= 0) { - b %= len; - return (integer)(y | z & (x << b | x >> len - b)); - } - b = -b; - b %= len; - return (integer)(y | z & (x >> b | x << len - b)); + x = (unsigned long) a; + if (len <= 0) + { + if (len == 0) + return 0; + goto full_len; + } + if (len >= LONGBITS) + { + full_len: + if (b >= 0) + { + b %= LONGBITS; + return (integer) (x << b | x >> LONGBITS - b); } + b = -b; + b %= LONGBITS; + return (integer) (x << LONGBITS - b | x >> b); + } + y = z = (unsigned long) -1; + y <<= len; + z &= ~y; + y &= x; + x &= z; + if (b >= 0) + { + b %= len; + return (integer) (y | z & (x << b | x >> len - b)); + } + b = -b; + b %= len; + return (integer) (y | z & (x >> b | x << len - b)); +} diff --git a/libf2c/libF77/lbitshft.c b/libf2c/libF77/lbitshft.c index daa1e7656de..bfbb7c01833 100644 --- a/libf2c/libF77/lbitshft.c +++ b/libf2c/libF77/lbitshft.c @@ -1,7 +1,7 @@ #include "f2c.h" - integer -lbit_shift(integer a, integer b) +integer +lbit_shift (integer a, integer b) { - return b >= 0 ? a << b : (integer)((uinteger)a >> -b); - } + return b >= 0 ? a << b : (integer) ((uinteger) a >> -b); +} diff --git a/libf2c/libF77/main.c b/libf2c/libF77/main.c index 7bc76b063af..c2dc88722f2 100644 --- a/libf2c/libF77/main.c +++ b/libf2c/libF77/main.c @@ -5,28 +5,28 @@ #include <stdlib.h> -extern void f_exit(void); +extern void f_exit (void); #ifndef NO_ONEXIT #define ONEXIT atexit -extern int atexit(void (*)(void)); +extern int atexit (void (*)(void)); #endif -extern void f_init(void); -extern int MAIN__(void); +extern void f_init (void); +extern int MAIN__ (void); -main(int argc, char **argv) +main (int argc, char **argv) { -f_setarg(argc, argv); -f_setsig(); -f_init(); + f_setarg (argc, argv); + f_setsig (); + f_init (); #ifndef NO_ONEXIT -ONEXIT(f_exit); + ONEXIT (f_exit); #endif -MAIN__(); + MAIN__ (); #ifdef NO_ONEXIT -f_exit(); + f_exit (); #endif -exit(0); /* exit(0) rather than return(0) to bypass Cray bug */ -return 0; /* For compilers that complain of missing return values; */ - /* others will complain that this is unreachable code. */ + exit (0); /* exit(0) rather than return(0) to bypass Cray bug */ + return 0; /* For compilers that complain of missing return values; */ + /* others will complain that this is unreachable code. */ } diff --git a/libf2c/libF77/pow_ci.c b/libf2c/libF77/pow_ci.c index 98bb84ffb22..1df3eb34b00 100644 --- a/libf2c/libF77/pow_ci.c +++ b/libf2c/libF77/pow_ci.c @@ -1,15 +1,16 @@ #include "f2c.h" -extern void pow_zi(doublecomplex*, doublecomplex*, integer*); -void pow_ci(complex *p, complex *a, integer *b) /* p = a**b */ +extern void pow_zi (doublecomplex *, doublecomplex *, integer *); +void +pow_ci (complex * p, complex * a, integer * b) /* p = a**b */ { -doublecomplex p1, a1; + doublecomplex p1, a1; -a1.r = a->r; -a1.i = a->i; + a1.r = a->r; + a1.i = a->i; -pow_zi(&p1, &a1, b); + pow_zi (&p1, &a1, b); -p->r = p1.r; -p->i = p1.i; + p->r = p1.r; + p->i = p1.i; } diff --git a/libf2c/libF77/pow_dd.c b/libf2c/libF77/pow_dd.c index 7c421fefd9e..0ab208ebf62 100644 --- a/libf2c/libF77/pow_dd.c +++ b/libf2c/libF77/pow_dd.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double pow_dd(doublereal *ap, doublereal *bp) +double +pow_dd (doublereal * ap, doublereal * bp) { -return(pow(*ap, *bp) ); + return (pow (*ap, *bp)); } diff --git a/libf2c/libF77/pow_di.c b/libf2c/libF77/pow_di.c index d396ed03139..d2298a0a1f0 100644 --- a/libf2c/libF77/pow_di.c +++ b/libf2c/libF77/pow_di.c @@ -1,31 +1,32 @@ #include "f2c.h" -double pow_di(doublereal *ap, integer *bp) +double +pow_di (doublereal * ap, integer * bp) { -double pow, x; -integer n; -unsigned long u; + double pow, x; + integer n; + unsigned long u; -pow = 1; -x = *ap; -n = *bp; + pow = 1; + x = *ap; + n = *bp; -if(n != 0) + if (n != 0) + { + if (n < 0) { - if(n < 0) - { - n = -n; - x = 1/x; - } - for(u = n; ; ) - { - if(u & 01) - pow *= x; - if(u >>= 1) - x *= x; - else - break; - } + n = -n; + x = 1 / x; } -return(pow); + for (u = n;;) + { + if (u & 01) + pow *= x; + if (u >>= 1) + x *= x; + else + break; + } + } + return (pow); } diff --git a/libf2c/libF77/pow_hh.c b/libf2c/libF77/pow_hh.c index d734720ef51..3379d8a7f7c 100644 --- a/libf2c/libF77/pow_hh.c +++ b/libf2c/libF77/pow_hh.c @@ -1,29 +1,31 @@ #include "f2c.h" -shortint pow_hh(shortint *ap, shortint *bp) +shortint +pow_hh (shortint * ap, shortint * bp) { - shortint pow, x, n; - unsigned u; + shortint pow, x, n; + unsigned u; - x = *ap; - n = *bp; + x = *ap; + n = *bp; - if (n <= 0) { - if (n == 0 || x == 1) - return 1; - if (x != -1) - return x == 0 ? 1/x : 0; - n = -n; - } - u = n; - for(pow = 1; ; ) - { - if(u & 01) - pow *= x; - if(u >>= 1) - x *= x; - else - break; - } - return(pow); - } + if (n <= 0) + { + if (n == 0 || x == 1) + return 1; + if (x != -1) + return x == 0 ? 1 / x : 0; + n = -n; + } + u = n; + for (pow = 1;;) + { + if (u & 01) + pow *= x; + if (u >>= 1) + x *= x; + else + break; + } + return (pow); +} diff --git a/libf2c/libF77/pow_ii.c b/libf2c/libF77/pow_ii.c index a895b23e167..92347453fb0 100644 --- a/libf2c/libF77/pow_ii.c +++ b/libf2c/libF77/pow_ii.c @@ -1,29 +1,31 @@ #include "f2c.h" -integer pow_ii(integer *ap, integer *bp) +integer +pow_ii (integer * ap, integer * bp) { - integer pow, x, n; - unsigned long u; + integer pow, x, n; + unsigned long u; - x = *ap; - n = *bp; + x = *ap; + n = *bp; - if (n <= 0) { - if (n == 0 || x == 1) - return 1; - if (x != -1) - return x == 0 ? 1/x : 0; - n = -n; - } - u = n; - for(pow = 1; ; ) - { - if(u & 01) - pow *= x; - if(u >>= 1) - x *= x; - else - break; - } - return(pow); - } + if (n <= 0) + { + if (n == 0 || x == 1) + return 1; + if (x != -1) + return x == 0 ? 1 / x : 0; + n = -n; + } + u = n; + for (pow = 1;;) + { + if (u & 01) + pow *= x; + if (u >>= 1) + x *= x; + else + break; + } + return (pow); +} diff --git a/libf2c/libF77/pow_qq.c b/libf2c/libF77/pow_qq.c index df01f14e95b..0cec5ca7d8c 100644 --- a/libf2c/libF77/pow_qq.c +++ b/libf2c/libF77/pow_qq.c @@ -1,29 +1,31 @@ #include "f2c.h" -longint pow_qq(longint *ap, longint *bp) +longint +pow_qq (longint * ap, longint * bp) { - longint pow, x, n; - unsigned long long u; /* system-dependent */ + longint pow, x, n; + unsigned long long u; /* system-dependent */ - x = *ap; - n = *bp; + x = *ap; + n = *bp; - if (n <= 0) { - if (n == 0 || x == 1) - return 1; - if (x != -1) - return x == 0 ? 1/x : 0; - n = -n; - } - u = n; - for(pow = 1; ; ) - { - if(u & 01) - pow *= x; - if(u >>= 1) - x *= x; - else - break; - } - return(pow); - } + if (n <= 0) + { + if (n == 0 || x == 1) + return 1; + if (x != -1) + return x == 0 ? 1 / x : 0; + n = -n; + } + u = n; + for (pow = 1;;) + { + if (u & 01) + pow *= x; + if (u >>= 1) + x *= x; + else + break; + } + return (pow); +} diff --git a/libf2c/libF77/pow_ri.c b/libf2c/libF77/pow_ri.c index c15347a2a1b..792db0c2018 100644 --- a/libf2c/libF77/pow_ri.c +++ b/libf2c/libF77/pow_ri.c @@ -1,31 +1,32 @@ #include "f2c.h" -double pow_ri(real *ap, integer *bp) +double +pow_ri (real * ap, integer * bp) { -double pow, x; -integer n; -unsigned long u; + double pow, x; + integer n; + unsigned long u; -pow = 1; -x = *ap; -n = *bp; + pow = 1; + x = *ap; + n = *bp; -if(n != 0) + if (n != 0) + { + if (n < 0) { - if(n < 0) - { - n = -n; - x = 1/x; - } - for(u = n; ; ) - { - if(u & 01) - pow *= x; - if(u >>= 1) - x *= x; - else - break; - } + n = -n; + x = 1 / x; } -return(pow); + for (u = n;;) + { + if (u & 01) + pow *= x; + if (u >>= 1) + x *= x; + else + break; + } + } + return (pow); } diff --git a/libf2c/libF77/pow_zi.c b/libf2c/libF77/pow_zi.c index 3b520602fc3..214db3d7a0f 100644 --- a/libf2c/libF77/pow_zi.c +++ b/libf2c/libF77/pow_zi.c @@ -1,49 +1,50 @@ #include "f2c.h" -extern void z_div(doublecomplex*, doublecomplex*, doublecomplex*); -void pow_zi(doublecomplex *p, doublecomplex *a, integer *b) /* p = a**b */ +extern void z_div (doublecomplex *, doublecomplex *, doublecomplex *); +void +pow_zi (doublecomplex * p, doublecomplex * a, integer * b) /* p = a**b */ { - integer n; - unsigned long u; - double t; - doublecomplex q, x; - 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; - q.r = 1; - q.i = 0; + n = *b; + q.r = 1; + q.i = 0; - if(n == 0) - goto done; - if(n < 0) - { - n = -n; - z_div(&x, &one, a); - } - else - { - x.r = a->r; - x.i = a->i; - } + if (n == 0) + goto done; + 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) - { - 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; + 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/libf2c/libF77/pow_zz.c b/libf2c/libF77/pow_zz.c index 5fc8c458663..522b639bc7e 100644 --- a/libf2c/libF77/pow_zz.c +++ b/libf2c/libF77/pow_zz.c @@ -2,17 +2,18 @@ #undef abs #include <math.h> -extern double f__cabs(double,double); -void pow_zz(doublecomplex *r, doublecomplex *a, doublecomplex *b) +extern double f__cabs (double, double); +void +pow_zz (doublecomplex * r, doublecomplex * a, doublecomplex * b) { -double logr, logi, x, y; + double logr, logi, x, y; -logr = log( f__cabs(a->r, a->i) ); -logi = atan2(a->i, a->r); + logr = log (f__cabs (a->r, a->i)); + logi = atan2 (a->i, a->r); -x = exp( logr * b->r - logi * b->i ); -y = logr * b->i + logi * b->r; + x = exp (logr * b->r - logi * b->i); + y = logr * b->i + logi * b->r; -r->r = x * cos(y); -r->i = x * sin(y); + r->r = x * cos (y); + r->i = x * sin (y); } diff --git a/libf2c/libF77/qbitbits.c b/libf2c/libF77/qbitbits.c index ef87858ce63..c2a87c24f30 100644 --- a/libf2c/libF77/qbitbits.c +++ b/libf2c/libF77/qbitbits.c @@ -8,51 +8,55 @@ #define LONG8BITS (2*LONGBITS) #endif - integer -qbit_bits(longint a, integer b, integer len) +integer +qbit_bits (longint a, integer b, integer len) { - /* Assume 2's complement arithmetic */ + /* Assume 2's complement arithmetic */ - ulongint x, y; + ulongint x, y; - x = (ulongint) a; - y = (ulongint)-1L; - x >>= b; - y <<= len; - return (longint)(x & y); - } + x = (ulongint) a; + y = (ulongint) - 1L; + x >>= b; + y <<= len; + return (longint) (x & y); +} - longint -qbit_cshift(longint a, integer b, integer len) +longint +qbit_cshift (longint a, integer b, integer len) { - ulongint x, y, z; + ulongint x, y, z; - x = (ulongint)a; - if (len <= 0) { - if (len == 0) - return 0; - goto full_len; - } - if (len >= LONG8BITS) { - full_len: - if (b >= 0) { - b %= LONG8BITS; - return (longint)(x << b | x >> LONG8BITS - b ); - } - b = -b; - b %= LONG8BITS; - return (longint)(x << LONG8BITS - b | x >> b); - } - y = z = (unsigned long)-1; - y <<= len; - z &= ~y; - y &= x; - x &= z; - if (b >= 0) { - b %= len; - return (longint)(y | z & (x << b | x >> len - b)); - } - b = -b; - b %= len; - return (longint)(y | z & (x >> b | x << len - b)); + x = (ulongint) a; + if (len <= 0) + { + if (len == 0) + return 0; + goto full_len; + } + if (len >= LONG8BITS) + { + full_len: + if (b >= 0) + { + b %= LONG8BITS; + return (longint) (x << b | x >> LONG8BITS - b); } + b = -b; + b %= LONG8BITS; + return (longint) (x << LONG8BITS - b | x >> b); + } + y = z = (unsigned long) -1; + y <<= len; + z &= ~y; + y &= x; + x &= z; + if (b >= 0) + { + b %= len; + return (longint) (y | z & (x << b | x >> len - b)); + } + b = -b; + b %= len; + return (longint) (y | z & (x >> b | x << len - b)); +} diff --git a/libf2c/libF77/qbitshft.c b/libf2c/libF77/qbitshft.c index 03ab5f271ba..ce740edde19 100644 --- a/libf2c/libF77/qbitshft.c +++ b/libf2c/libF77/qbitshft.c @@ -1,7 +1,7 @@ #include "f2c.h" - longint -qbit_shift(longint a, integer b) +longint +qbit_shift (longint a, integer b) { - return b >= 0 ? a << b : (longint)((ulongint)a >> -b); - } + return b >= 0 ? a << b : (longint) ((ulongint) a >> -b); +} diff --git a/libf2c/libF77/r_abs.c b/libf2c/libF77/r_abs.c index 77c2abd08e6..6f62724ef17 100644 --- a/libf2c/libF77/r_abs.c +++ b/libf2c/libF77/r_abs.c @@ -1,8 +1,9 @@ #include "f2c.h" -double r_abs(real *x) +double +r_abs (real * x) { -if(*x >= 0) - return(*x); -return(- *x); + if (*x >= 0) + return (*x); + return (-*x); } diff --git a/libf2c/libF77/r_acos.c b/libf2c/libF77/r_acos.c index 79d7b6bac5e..d761cfdc5c8 100644 --- a/libf2c/libF77/r_acos.c +++ b/libf2c/libF77/r_acos.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double r_acos(real *x) +double +r_acos (real * x) { -return( acos(*x) ); + return (acos (*x)); } diff --git a/libf2c/libF77/r_asin.c b/libf2c/libF77/r_asin.c index 83722ba5c52..b8c73c786af 100644 --- a/libf2c/libF77/r_asin.c +++ b/libf2c/libF77/r_asin.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double r_asin(real *x) +double +r_asin (real * x) { -return( asin(*x) ); + return (asin (*x)); } diff --git a/libf2c/libF77/r_atan.c b/libf2c/libF77/r_atan.c index f8262f23ce5..33a6589fda9 100644 --- a/libf2c/libF77/r_atan.c +++ b/libf2c/libF77/r_atan.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double r_atan(real *x) +double +r_atan (real * x) { -return( atan(*x) ); + return (atan (*x)); } diff --git a/libf2c/libF77/r_atn2.c b/libf2c/libF77/r_atn2.c index 0abc146bbc8..076d8743b1e 100644 --- a/libf2c/libF77/r_atn2.c +++ b/libf2c/libF77/r_atn2.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double r_atn2(real *x, real *y) +double +r_atn2 (real * x, real * y) { -return( atan2(*x,*y) ); + return (atan2 (*x, *y)); } diff --git a/libf2c/libF77/r_cnjg.c b/libf2c/libF77/r_cnjg.c index cb830a82b2a..5f849291b20 100644 --- a/libf2c/libF77/r_cnjg.c +++ b/libf2c/libF77/r_cnjg.c @@ -1,9 +1,9 @@ #include "f2c.h" void -r_cnjg(complex *r, complex *z) +r_cnjg (complex * r, complex * z) { - real zi = z->i; - r->r = z->r; - r->i = -zi; - } + real zi = z->i; + r->r = z->r; + r->i = -zi; +} diff --git a/libf2c/libF77/r_cos.c b/libf2c/libF77/r_cos.c index 380e250b81d..ed556e81e87 100644 --- a/libf2c/libF77/r_cos.c +++ b/libf2c/libF77/r_cos.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double r_cos(real *x) +double +r_cos (real * x) { -return( cos(*x) ); + return (cos (*x)); } diff --git a/libf2c/libF77/r_cosh.c b/libf2c/libF77/r_cosh.c index d133cf9b803..b22e0cf0a3d 100644 --- a/libf2c/libF77/r_cosh.c +++ b/libf2c/libF77/r_cosh.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double r_cosh(real *x) +double +r_cosh (real * x) { -return( cosh(*x) ); + return (cosh (*x)); } diff --git a/libf2c/libF77/r_dim.c b/libf2c/libF77/r_dim.c index fe3896b7651..48d2fc7f767 100644 --- a/libf2c/libF77/r_dim.c +++ b/libf2c/libF77/r_dim.c @@ -1,6 +1,7 @@ #include "f2c.h" -double r_dim(real *a, real *b) +double +r_dim (real * a, real * b) { -return( *a > *b ? *a - *b : 0); + return (*a > *b ? *a - *b : 0); } diff --git a/libf2c/libF77/r_exp.c b/libf2c/libF77/r_exp.c index 2a9581c267c..7c1ceea5895 100644 --- a/libf2c/libF77/r_exp.c +++ b/libf2c/libF77/r_exp.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double r_exp(real *x) +double +r_exp (real * x) { -return( exp(*x) ); + return (exp (*x)); } diff --git a/libf2c/libF77/r_imag.c b/libf2c/libF77/r_imag.c index 42042a9cb8e..784abc8434b 100644 --- a/libf2c/libF77/r_imag.c +++ b/libf2c/libF77/r_imag.c @@ -1,6 +1,7 @@ #include "f2c.h" -double r_imag(complex *z) +double +r_imag (complex * z) { -return(z->i); + return (z->i); } diff --git a/libf2c/libF77/r_int.c b/libf2c/libF77/r_int.c index b2a4747424c..3c1b28ea4c7 100644 --- a/libf2c/libF77/r_int.c +++ b/libf2c/libF77/r_int.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double r_int(real *x) +double +r_int (real * x) { -return( (*x>0) ? floor(*x) : -floor(- *x) ); + return ((*x > 0) ? floor (*x) : -floor (-*x)); } diff --git a/libf2c/libF77/r_lg10.c b/libf2c/libF77/r_lg10.c index 36336cb52dd..563e73c4d8c 100644 --- a/libf2c/libF77/r_lg10.c +++ b/libf2c/libF77/r_lg10.c @@ -4,7 +4,8 @@ #undef abs #include <math.h> -double r_lg10(real *x) +double +r_lg10 (real * x) { -return( log10e * log(*x) ); + return (log10e * log (*x)); } diff --git a/libf2c/libF77/r_log.c b/libf2c/libF77/r_log.c index 3cc069d8d92..eaaecc836f2 100644 --- a/libf2c/libF77/r_log.c +++ b/libf2c/libF77/r_log.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double r_log(real *x) +double +r_log (real * x) { -return( log(*x) ); + return (log (*x)); } diff --git a/libf2c/libF77/r_mod.c b/libf2c/libF77/r_mod.c index c2a1929cfce..9518d66ce99 100644 --- a/libf2c/libF77/r_mod.c +++ b/libf2c/libF77/r_mod.c @@ -1,31 +1,33 @@ #include "f2c.h" #ifdef IEEE_drem -double drem(double, double); +double drem (double, double); #else #undef abs #include <math.h> #endif -double r_mod(real *x, real *y) +double +r_mod (real * x, real * y) { #ifdef IEEE_drem - double xa, ya, z; - if ((ya = *y) < 0.) - ya = -ya; - z = drem(xa = *x, ya); - if (xa > 0) { - if (z < 0) - z += ya; - } - else if (z > 0) - z -= ya; - return z; + double xa, ya, z; + if ((ya = *y) < 0.) + ya = -ya; + z = drem (xa = *x, ya); + if (xa > 0) + { + if (z < 0) + z += ya; + } + else if (z > 0) + z -= ya; + return z; #else - double quotient; - if( (quotient = (double)*x / *y) >= 0) - quotient = floor(quotient); - else - quotient = -floor(-quotient); - return(*x - (*y) * quotient ); + double quotient; + if ((quotient = (double) *x / *y) >= 0) + quotient = floor (quotient); + else + quotient = -floor (-quotient); + return (*x - (*y) * quotient); #endif } diff --git a/libf2c/libF77/r_nint.c b/libf2c/libF77/r_nint.c index 79700c8fd98..f2713d588b1 100644 --- a/libf2c/libF77/r_nint.c +++ b/libf2c/libF77/r_nint.c @@ -2,8 +2,8 @@ #undef abs #include <math.h> -double r_nint(real *x) +double +r_nint (real * x) { -return( (*x)>=0 ? - floor(*x + .5) : -floor(.5 - *x) ); + return ((*x) >= 0 ? floor (*x + .5) : -floor (.5 - *x)); } diff --git a/libf2c/libF77/r_sign.c b/libf2c/libF77/r_sign.c index 01defda583a..f53c6bf9220 100644 --- a/libf2c/libF77/r_sign.c +++ b/libf2c/libF77/r_sign.c @@ -1,8 +1,9 @@ #include "f2c.h" -double r_sign(real *a, real *b) +double +r_sign (real * a, real * b) { -double x; -x = (*a >= 0 ? *a : - *a); -return( *b >= 0 ? x : -x); + double x; + x = (*a >= 0 ? *a : -*a); + return (*b >= 0 ? x : -x); } diff --git a/libf2c/libF77/r_sin.c b/libf2c/libF77/r_sin.c index 9d7db2ce7c7..5a5ef136a8c 100644 --- a/libf2c/libF77/r_sin.c +++ b/libf2c/libF77/r_sin.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double r_sin(real *x) +double +r_sin (real * x) { -return( sin(*x) ); + return (sin (*x)); } diff --git a/libf2c/libF77/r_sinh.c b/libf2c/libF77/r_sinh.c index 47b6ad8a2b9..723c7ab29c3 100644 --- a/libf2c/libF77/r_sinh.c +++ b/libf2c/libF77/r_sinh.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double r_sinh(real *x) +double +r_sinh (real * x) { -return( sinh(*x) ); + return (sinh (*x)); } diff --git a/libf2c/libF77/r_sqrt.c b/libf2c/libF77/r_sqrt.c index 114cd1bd301..ed832ba70e1 100644 --- a/libf2c/libF77/r_sqrt.c +++ b/libf2c/libF77/r_sqrt.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double r_sqrt(real *x) +double +r_sqrt (real * x) { -return( sqrt(*x) ); + return (sqrt (*x)); } diff --git a/libf2c/libF77/r_tan.c b/libf2c/libF77/r_tan.c index 455c9640193..4ef913e6522 100644 --- a/libf2c/libF77/r_tan.c +++ b/libf2c/libF77/r_tan.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double r_tan(real *x) +double +r_tan (real * x) { -return( tan(*x) ); + return (tan (*x)); } diff --git a/libf2c/libF77/r_tanh.c b/libf2c/libF77/r_tanh.c index 9fe150e0172..6f2552a9f97 100644 --- a/libf2c/libF77/r_tanh.c +++ b/libf2c/libF77/r_tanh.c @@ -2,7 +2,8 @@ #undef abs #include <math.h> -double r_tanh(real *x) +double +r_tanh (real * x) { -return( tanh(*x) ); + return (tanh (*x)); } diff --git a/libf2c/libF77/s_cat.c b/libf2c/libF77/s_cat.c index d8c933329d2..4e8da1b3fdb 100644 --- a/libf2c/libF77/s_cat.c +++ b/libf2c/libF77/s_cat.c @@ -10,56 +10,61 @@ #undef min #undef max #include <stdlib.h> - extern char *F77_aloc(ftnlen, char*); +extern char *F77_aloc (ftnlen, char *); #include <string.h> #endif /* NO_OVERWRITE */ void -s_cat(char *lp, char *rpp[], ftnint rnp[], ftnint *np, ftnlen ll) +s_cat (char *lp, char *rpp[], ftnint rnp[], ftnint * np, ftnlen ll) { - ftnlen i, nc; - char *rp; - ftnlen n = *np; + ftnlen i, nc; + char *rp; + ftnlen n = *np; #ifndef NO_OVERWRITE - ftnlen L, m; - char *lp0, *lp1; + ftnlen L, m; + char *lp0, *lp1; - lp0 = 0; - lp1 = lp; - L = ll; - i = 0; - while(i < n) { - rp = rpp[i]; - m = rnp[i++]; - if (rp >= lp1 || rp + m <= lp) { - if ((L -= m) <= 0) { - n = i; - break; - } - lp1 += m; - continue; - } - lp0 = lp; - lp = lp1 = F77_aloc(L = ll, "s_cat"); - break; - } - lp1 = lp; + lp0 = 0; + lp1 = lp; + L = ll; + i = 0; + while (i < n) + { + rp = rpp[i]; + m = rnp[i++]; + if (rp >= lp1 || rp + m <= lp) + { + if ((L -= m) <= 0) + { + n = i; + break; + } + lp1 += m; + continue; + } + lp0 = lp; + lp = lp1 = F77_aloc (L = ll, "s_cat"); + break; + } + lp1 = lp; #endif /* NO_OVERWRITE */ - for(i = 0 ; i < n ; ++i) { - nc = ll; - if(rnp[i] < nc) - nc = rnp[i]; - ll -= nc; - rp = rpp[i]; - while(--nc >= 0) - *lp++ = *rp++; - } - while(--ll >= 0) - *lp++ = ' '; + for (i = 0; i < n; ++i) + { + nc = ll; + if (rnp[i] < nc) + nc = rnp[i]; + ll -= nc; + rp = rpp[i]; + while (--nc >= 0) + *lp++ = *rp++; + } + while (--ll >= 0) + *lp++ = ' '; #ifndef NO_OVERWRITE - if (lp0) { - memcpy(lp0, lp1, L); - free(lp1); - } + if (lp0) + { + memcpy (lp0, lp1, L); + free (lp1); + } #endif - } +} diff --git a/libf2c/libF77/s_cmp.c b/libf2c/libF77/s_cmp.c index febc58649ea..5b43c9edb9c 100644 --- a/libf2c/libF77/s_cmp.c +++ b/libf2c/libF77/s_cmp.c @@ -2,39 +2,48 @@ /* compare two strings */ -integer s_cmp(char *a0, char *b0, ftnlen la, ftnlen lb) +integer +s_cmp (char *a0, char *b0, ftnlen la, ftnlen lb) { -register unsigned char *a, *aend, *b, *bend; -a = (unsigned char *)a0; -b = (unsigned char *)b0; -aend = a + la; -bend = b + lb; + register unsigned char *a, *aend, *b, *bend; + a = (unsigned char *) a0; + b = (unsigned char *) b0; + aend = a + la; + bend = b + lb; -if(la <= lb) - { - while(a < aend) - if(*a != *b) - return( *a - *b ); - else - { ++a; ++b; } + if (la <= lb) + { + while (a < aend) + if (*a != *b) + return (*a - *b); + else + { + ++a; + ++b; + } - while(b < bend) - if(*b != ' ') - return( ' ' - *b ); - else ++b; - } + while (b < bend) + if (*b != ' ') + return (' ' - *b); + else + ++b; + } -else - { - while(b < bend) - if(*a == *b) - { ++a; ++b; } - else - return( *a - *b ); - while(a < aend) - if(*a != ' ') - return(*a - ' '); - else ++a; - } -return(0); + else + { + while (b < bend) + if (*a == *b) + { + ++a; + ++b; + } + else + return (*a - *b); + while (a < aend) + if (*a != ' ') + return (*a - ' '); + else + ++a; + } + return (0); } diff --git a/libf2c/libF77/s_copy.c b/libf2c/libF77/s_copy.c index a0c98caa3d7..a91071eccab 100644 --- a/libf2c/libF77/s_copy.c +++ b/libf2c/libF77/s_copy.c @@ -8,40 +8,43 @@ /* assign strings: a = b */ -void s_copy(register char *a, register char *b, ftnlen la, ftnlen lb) +void +s_copy (register char *a, register char *b, ftnlen la, ftnlen lb) { - register char *aend, *bend; + register char *aend, *bend; - aend = a + la; + aend = a + la; - if(la <= lb) + if (la <= lb) #ifndef NO_OVERWRITE - if (a <= b || a >= b + la) + if (a <= b || a >= b + la) #endif - while(a < aend) - *a++ = *b++; + while (a < aend) + *a++ = *b++; #ifndef NO_OVERWRITE - else - for(b += la; a < aend; ) - *--aend = *--b; + else + for (b += la; a < aend;) + *--aend = *--b; #endif - else { - bend = b + lb; + else + { + bend = b + lb; #ifndef NO_OVERWRITE - if (a <= b || a >= bend) + if (a <= b || a >= bend) #endif - while(b < bend) - *a++ = *b++; + while (b < bend) + *a++ = *b++; #ifndef NO_OVERWRITE - else { - a += lb; - while(b < bend) - *--a = *--bend; - a += lb; - } -#endif - while(a < aend) - *a++ = ' '; - } + else + { + a += lb; + while (b < bend) + *--a = *--bend; + a += lb; } +#endif + while (a < aend) + *a++ = ' '; + } +} diff --git a/libf2c/libF77/s_paus.c b/libf2c/libF77/s_paus.c index 34f48616324..79691366e6f 100644 --- a/libf2c/libF77/s_paus.c +++ b/libf2c/libF77/s_paus.c @@ -7,61 +7,65 @@ #undef min #undef max #include <stdlib.h> -extern int getpid(void), isatty(int), pause(void); +extern int getpid (void), isatty (int), pause (void); -extern void f_exit(void); +extern void f_exit (void); static void -waitpause(Sigarg) -{ Use_Sigarg; - return; - } +waitpause (Sigarg) +{ + Use_Sigarg; + return; +} static void -s_1paus(FILE *fin) +s_1paus (FILE * fin) { - fprintf(stderr, - "To resume execution, type go. Other input will terminate the job.\n"); - fflush(stderr); - if( getc(fin)!='g' || getc(fin)!='o' || getc(fin)!='\n' ) { - fprintf(stderr, "STOP\n"); + fprintf (stderr, + "To resume execution, type go. Other input will terminate the job.\n"); + fflush (stderr); + if (getc (fin) != 'g' || getc (fin) != 'o' || getc (fin) != '\n') + { + fprintf (stderr, "STOP\n"); #ifdef NO_ONEXIT - f_exit(); + f_exit (); #endif - exit(0); - } - } + exit (0); + } +} - int -s_paus(char *s, ftnlen n) +int +s_paus (char *s, ftnlen n) { - fprintf(stderr, "PAUSE "); - if(n > 0) - fprintf(stderr, " %.*s", (int)n, s); - fprintf(stderr, " statement executed\n"); - if( isatty(fileno(stdin)) ) - s_1paus(stdin); - else { + fprintf (stderr, "PAUSE "); + if (n > 0) + fprintf (stderr, " %.*s", (int) n, s); + fprintf (stderr, " statement executed\n"); + if (isatty (fileno (stdin))) + s_1paus (stdin); + else + { #if (defined (MSDOS) && !defined (GO32)) || defined (_WIN32) - FILE *fin; - fin = fopen("con", "r"); - if (!fin) { - fprintf(stderr, "s_paus: can't open con!\n"); - fflush(stderr); - exit(1); - } - s_1paus(fin); - fclose(fin); + FILE *fin; + fin = fopen ("con", "r"); + if (!fin) + { + fprintf (stderr, "s_paus: can't open con!\n"); + fflush (stderr); + exit (1); + } + s_1paus (fin); + fclose (fin); #else - fprintf(stderr, - "To resume execution, execute a kill -%d %d command\n", - PAUSESIG, getpid() ); - signal1(PAUSESIG, waitpause); - fflush(stderr); - pause(); + fprintf (stderr, + "To resume execution, execute a kill -%d %d command\n", + PAUSESIG, getpid ()); + signal1 (PAUSESIG, waitpause); + fflush (stderr); + pause (); #endif - } - fprintf(stderr, "Execution resumes after PAUSE.\n"); - fflush(stderr); - return 0; /* NOT REACHED */ + } + fprintf (stderr, "Execution resumes after PAUSE.\n"); + fflush (stderr); + return 0; /* NOT REACHED */ } diff --git a/libf2c/libF77/s_rnge.c b/libf2c/libF77/s_rnge.c index c58430e0896..6c054c707f5 100644 --- a/libf2c/libF77/s_rnge.c +++ b/libf2c/libF77/s_rnge.c @@ -3,19 +3,20 @@ /* called when a subscript is out of range */ -extern void sig_die(char*,int); -integer s_rnge(char *varn, ftnint offset, char *procn, ftnint line) +extern void sig_die (char *, int); +integer +s_rnge (char *varn, ftnint offset, char *procn, ftnint line) { -register int i; + register int i; -fprintf(stderr, "Subscript out of range on file line %ld, procedure ", - (long)line); -while((i = *procn) && i != '_' && i != ' ') - putc(*procn++, stderr); -fprintf(stderr, ".\nAttempt to access the %ld-th element of variable ", - (long)offset+1); -while((i = *varn) && i != ' ') - putc(*varn++, stderr); -sig_die(".", 1); -return 0; /* not reached */ + fprintf (stderr, "Subscript out of range on file line %ld, procedure ", + (long) line); + while ((i = *procn) && i != '_' && i != ' ') + putc (*procn++, stderr); + fprintf (stderr, ".\nAttempt to access the %ld-th element of variable ", + (long) offset + 1); + while ((i = *varn) && i != ' ') + putc (*varn++, stderr); + sig_die (".", 1); + return 0; /* not reached */ } diff --git a/libf2c/libF77/s_stop.c b/libf2c/libF77/s_stop.c index 391148f6c72..571416be7bb 100644 --- a/libf2c/libF77/s_stop.c +++ b/libf2c/libF77/s_stop.c @@ -5,27 +5,28 @@ #undef min #undef max #include <stdlib.h> -void f_exit(void); +void f_exit (void); -int s_stop(char *s, ftnlen n) +int +s_stop (char *s, ftnlen n) { -int i; + int i; -if(n > 0) - { - fprintf(stderr, "STOP "); - for(i = 0; i<n ; ++i) - putc(*s++, stderr); - fprintf(stderr, " statement executed\n"); - } + if (n > 0) + { + fprintf (stderr, "STOP "); + for (i = 0; i < n; ++i) + putc (*s++, stderr); + fprintf (stderr, " statement executed\n"); + } #ifdef NO_ONEXIT -f_exit(); + f_exit (); #endif -exit(0); + exit (0); /* 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 */ + return 0; /* NOT REACHED */ } diff --git a/libf2c/libF77/setarg.c b/libf2c/libF77/setarg.c index bd4d517f4d3..49515746f48 100644 --- a/libf2c/libF77/setarg.c +++ b/libf2c/libF77/setarg.c @@ -6,9 +6,9 @@ int f__xargc; char **f__xargv; - void -f_setarg(int argc, char **argv) +void +f_setarg (int argc, char **argv) { -f__xargc = argc; -f__xargv = argv; + f__xargc = argc; + f__xargv = argv; } diff --git a/libf2c/libF77/setsig.c b/libf2c/libF77/setsig.c index 6be89afb2c3..96826be94fd 100644 --- a/libf2c/libF77/setsig.c +++ b/libf2c/libF77/setsig.c @@ -11,76 +11,76 @@ #include <stdlib.h> -extern void sig_die(char*, int); +extern void sig_die (char *, int); static void -sigfdie(Sigarg) +sigfdie (Sigarg) { -Use_Sigarg; -sig_die("Floating Exception", 1); + Use_Sigarg; + sig_die ("Floating Exception", 1); } static void -sigidie(Sigarg) +sigidie (Sigarg) { -Use_Sigarg; -sig_die("IOT Trap", 1); + Use_Sigarg; + sig_die ("IOT Trap", 1); } #ifdef SIGQUIT static void -sigqdie(Sigarg) +sigqdie (Sigarg) { -Use_Sigarg; -sig_die("Quit signal", 1); + Use_Sigarg; + sig_die ("Quit signal", 1); } #endif static void -sigindie(Sigarg) +sigindie (Sigarg) { -Use_Sigarg; -sig_die("Interrupt", 0); + Use_Sigarg; + sig_die ("Interrupt", 0); } static void -sigtdie(Sigarg) +sigtdie (Sigarg) { -Use_Sigarg; -sig_die("Killed", 0); + Use_Sigarg; + sig_die ("Killed", 0); } #ifdef SIGTRAP static void -sigtrdie(Sigarg) +sigtrdie (Sigarg) { -Use_Sigarg; -sig_die("Trace trap", 1); + Use_Sigarg; + sig_die ("Trace trap", 1); } #endif - void -f_setsig() +void +f_setsig () { -signal1(SIGFPE, sigfdie); /* ignore underflow, enable overflow */ + signal1 (SIGFPE, sigfdie); /* ignore underflow, enable overflow */ #ifdef SIGIOT -signal1(SIGIOT, sigidie); + signal1 (SIGIOT, sigidie); #endif #ifdef SIGTRAP -signal1(SIGTRAP, sigtrdie); + signal1 (SIGTRAP, sigtrdie); #endif #ifdef SIGQUIT -if(signal1(SIGQUIT,sigqdie) == SIG_IGN) - signal1(SIGQUIT, SIG_IGN); + if (signal1 (SIGQUIT, sigqdie) == SIG_IGN) + signal1 (SIGQUIT, SIG_IGN); #endif -if(signal1(SIGINT, sigindie) == SIG_IGN) - signal1(SIGINT, SIG_IGN); -signal1(SIGTERM,sigtdie); + if (signal1 (SIGINT, sigindie) == SIG_IGN) + signal1 (SIGINT, SIG_IGN); + signal1 (SIGTERM, sigtdie); #ifdef pdp11 - ldfps(01200); /* detect overflow as an exception */ + ldfps (01200); /* detect overflow as an exception */ #endif } diff --git a/libf2c/libF77/sig_die.c b/libf2c/libF77/sig_die.c index 7ed419aa354..622462e248b 100644 --- a/libf2c/libF77/sig_die.c +++ b/libf2c/libF77/sig_die.c @@ -8,28 +8,30 @@ #endif #include <stdlib.h> - extern void f_exit(void); +extern void f_exit (void); -void sig_die(register char *s, int kill) +void +sig_die (register char *s, int kill) { - /* print error message, then clear buffers */ - fprintf(stderr, "%s\n", s); + /* print error message, then clear buffers */ + fprintf (stderr, "%s\n", s); - if(kill) - { - fflush(stderr); - f_exit(); - fflush(stderr); - /* now get a core */ + if (kill) + { + fflush (stderr); + f_exit (); + fflush (stderr); + /* now get a core */ #ifdef SIGIOT - signal(SIGIOT, SIG_DFL); + signal (SIGIOT, SIG_DFL); #endif - abort(); - } - else { + abort (); + } + else + { #ifdef NO_ONEXIT - f_exit(); + f_exit (); #endif - exit(1); - } - } + exit (1); + } +} diff --git a/libf2c/libF77/signal1.h0 b/libf2c/libF77/signal1.h0 index e38a8baa511..0e2fcf2c1e6 100644 --- a/libf2c/libF77/signal1.h0 +++ b/libf2c/libF77/signal1.h0 @@ -12,12 +12,12 @@ #endif #ifndef Sigarg_t #define Sigarg_t int -#endif /*Sigarg_t*/ +#endif /*Sigarg_t */ -#ifdef USE_SIG_PF /* compile with -DUSE_SIG_PF under IRIX */ +#ifdef USE_SIG_PF /* compile with -DUSE_SIG_PF under IRIX */ #define sig_pf SIG_PF #else -typedef Sigret_t (*sig_pf)(Sigarg_t); +typedef Sigret_t (*sig_pf) (Sigarg_t); #endif #define signal1(a,b) signal(a,(sig_pf)b) diff --git a/libf2c/libF77/signal_.c b/libf2c/libF77/signal_.c index ff496a182b8..f67831c3c43 100644 --- a/libf2c/libF77/signal_.c +++ b/libf2c/libF77/signal_.c @@ -2,10 +2,10 @@ #include "signal1.h" void * -G77_signal_0 (integer *sigp, sig_pf proc) +G77_signal_0 (integer * sigp, sig_pf proc) { - int sig; - sig = (int)*sigp; + int sig; + sig = (int) *sigp; - return (void *) signal(sig, proc); - } + return (void *) signal (sig, proc); +} diff --git a/libf2c/libF77/system_.c b/libf2c/libF77/system_.c index ebb3041618b..b8d1d3d2ea4 100644 --- a/libf2c/libF77/system_.c +++ b/libf2c/libF77/system_.c @@ -6,24 +6,23 @@ #undef min #undef max #include <stdlib.h> -extern char *F77_aloc(ftnlen, char*); +extern char *F77_aloc (ftnlen, char *); - integer +integer G77_system_0 (register char *s, ftnlen n) { - char buff0[256], *buff; - register char *bp, *blast; - integer rv; + char buff0[256], *buff; + register char *bp, *blast; + integer rv; - buff = bp = n < sizeof(buff0) - ? buff0 : F77_aloc(n+1, "system_"); - blast = bp + n; + buff = bp = n < sizeof (buff0) ? buff0 : F77_aloc (n + 1, "system_"); + blast = bp + n; - while(bp < blast && *s) - *bp++ = *s++; - *bp = 0; - rv = system(buff); - if (buff != buff0) - free(buff); - return rv; - } + while (bp < blast && *s) + *bp++ = *s++; + *bp = 0; + rv = system (buff); + if (buff != buff0) + free (buff); + return rv; +} diff --git a/libf2c/libF77/z_abs.c b/libf2c/libF77/z_abs.c index 50375653f60..2419c0eac49 100644 --- a/libf2c/libF77/z_abs.c +++ b/libf2c/libF77/z_abs.c @@ -1,7 +1,8 @@ #include "f2c.h" -double f__cabs(double, double); -double z_abs(doublecomplex *z) +double f__cabs (double, double); +double +z_abs (doublecomplex * z) { -return( f__cabs( z->r, z->i ) ); + return (f__cabs (z->r, z->i)); } diff --git a/libf2c/libF77/z_cos.c b/libf2c/libF77/z_cos.c index 74ee2e4d66a..0f4cd71bd5a 100644 --- a/libf2c/libF77/z_cos.c +++ b/libf2c/libF77/z_cos.c @@ -2,9 +2,10 @@ #undef abs #include "math.h" -void z_cos(doublecomplex *r, doublecomplex *z) +void +z_cos (doublecomplex * r, doublecomplex * z) { - double zi = z->i, zr = z->r; - r->r = cos(zr) * cosh(zi); - r->i = - sin(zr) * sinh(zi); - } + double zi = z->i, zr = z->r; + r->r = cos (zr) * cosh (zi); + r->i = -sin (zr) * sinh (zi); +} diff --git a/libf2c/libF77/z_div.c b/libf2c/libF77/z_div.c index d0b5944cbb5..a5fc527bdc2 100644 --- a/libf2c/libF77/z_div.c +++ b/libf2c/libF77/z_div.c @@ -1,39 +1,41 @@ #include "f2c.h" -extern void sig_die(char*, int); -void z_div(doublecomplex *c, doublecomplex *a, doublecomplex *b) +extern void sig_die (char *, int); +void +z_div (doublecomplex * c, doublecomplex * a, doublecomplex * b) { - double ratio, den; - double abr, abi, cr; + 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) { + if ((abr = b->r) < 0.) + abr = -abr; + if ((abi = b->i) < 0.) + abi = -abi; + if (abr <= abi) + { + if (abi == 0) + { #ifdef IEEE_COMPLEX_DIVIDE - if (a->i != 0 || a->r != 0) - abi = 1.; - c->i = c->r = abi / abr; - return; + if (a->i != 0 || a->r != 0) + abi = 1.; + c->i = c->r = abi / abr; + return; #else - sig_die("complex division by zero", 1); + sig_die ("complex division by zero", 1); #endif - } - 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); - cr = (a->r + a->i*ratio) / den; - c->i = (a->i - a->r*ratio) / den; - } - c->r = cr; } + 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); + cr = (a->r + a->i * ratio) / den; + c->i = (a->i - a->r * ratio) / den; + } + c->r = cr; +} diff --git a/libf2c/libF77/z_exp.c b/libf2c/libF77/z_exp.c index 2dad1219859..16f51e74a45 100644 --- a/libf2c/libF77/z_exp.c +++ b/libf2c/libF77/z_exp.c @@ -2,11 +2,12 @@ #undef abs #include "math.h" -void z_exp(doublecomplex *r, doublecomplex *z) +void +z_exp (doublecomplex * r, doublecomplex * z) { - double expx, zi = z->i; + double expx, zi = z->i; - expx = exp(z->r); - r->r = expx * cos(zi); - r->i = expx * sin(zi); - } + expx = exp (z->r); + r->r = expx * cos (zi); + r->i = expx * sin (zi); +} diff --git a/libf2c/libF77/z_log.c b/libf2c/libF77/z_log.c index 09f8cd4eeea..f56b12ed7e3 100644 --- a/libf2c/libF77/z_log.c +++ b/libf2c/libF77/z_log.c @@ -2,57 +2,58 @@ #undef abs #include "math.h" -extern double f__cabs(double, double); -void z_log(doublecomplex *r, doublecomplex *z) +extern double f__cabs (double, double); +void +z_log (doublecomplex * r, doublecomplex * z) { - double s, s0, t, t2, u, v; - double zi = z->i, zr = z->r; + double s, s0, t, t2, u, v; + double zi = z->i, zr = z->r; - r->i = atan2(zi, zr); + r->i = atan2 (zi, zr); #ifdef Pre20000310 - r->r = log( f__cabs( zr, zi ) ); + r->r = log (f__cabs (zr, zi)); #else - if (zi < 0) - zi = -zi; - if (zr < 0) - zr = -zr; - if (zr < zi) { - t = zi; - zi = zr; - zr = t; - } - t = zi/zr; - s = zr * sqrt(1 + t*t); - /* now s = f__cabs(zi,zr), and zr = |zr| >= |zi| = zi */ - if ((t = s - 1) < 0) - t = -t; - if (t > .01) - r->r = log(s); - else { + if (zi < 0) + zi = -zi; + if (zr < 0) + zr = -zr; + if (zr < zi) + { + t = zi; + zi = zr; + zr = t; + } + t = zi / zr; + s = zr * sqrt (1 + t * t); + /* now s = f__cabs(zi,zr), and zr = |zr| >= |zi| = zi */ + if ((t = s - 1) < 0) + t = -t; + if (t > .01) + r->r = log (s); + else + { #ifdef Comment - log(1+x) = x - x^2/2 + x^3/3 - x^4/4 + - ... - - = x(1 - x/2 + x^2/3 -+...) - - [sqrt(y^2 + z^2) - 1] * [sqrt(y^2 + z^2) + 1] = y^2 + z^2 - 1, so - - sqrt(y^2 + z^2) - 1 = (y^2 + z^2 - 1) / [sqrt(y^2 + z^2) + 1] - -#endif /*Comment*/ - - t = ((zr*zr - 1.) + zi*zi) / (s + 1); - t2 = t*t; - s = 1. - 0.5*t; - u = v = 1; - do { - s0 = s; - u *= t2; - v += 2; - s += u/v - t*u/(v+1); - } while(s > s0); - r->r = s*t; - } -#endif + log (1 + x) = x - x ^ 2 / 2 + x ^ 3 / 3 - x ^ 4 / 4 + -... + = x (1 - x / 2 + x ^ 2 / 3 - +...) + [sqrt (y ^ 2 + z ^ 2) - 1] *[sqrt (y ^ 2 + z ^ 2) + 1] = + y ^ 2 + z ^ 2 - 1, so sqrt (y ^ 2 + z ^ 2) - 1 = + (y ^ 2 + z ^ 2 - 1) /[sqrt (y ^ 2 + z ^ 2) + 1] +#endif /*Comment */ + t = ((zr * zr - 1.) + zi * zi) / (s + 1); + t2 = t * t; + s = 1. - 0.5 * t; + u = v = 1; + do + { + s0 = s; + u *= t2; + v += 2; + s += u / v - t * u / (v + 1); } + while (s > s0); + r->r = s * t; + } +#endif +} diff --git a/libf2c/libF77/z_sin.c b/libf2c/libF77/z_sin.c index 1294d2238a9..8cb44cf53ca 100644 --- a/libf2c/libF77/z_sin.c +++ b/libf2c/libF77/z_sin.c @@ -2,9 +2,10 @@ #undef abs #include "math.h" -void z_sin(doublecomplex *r, doublecomplex *z) +void +z_sin (doublecomplex * r, doublecomplex * z) { - double zi = z->i, zr = z->r; - r->r = sin(zr) * cosh(zi); - r->i = cos(zr) * sinh(zi); - } + double zi = z->i, zr = z->r; + r->r = sin (zr) * cosh (zi); + r->i = cos (zr) * sinh (zi); +} diff --git a/libf2c/libF77/z_sqrt.c b/libf2c/libF77/z_sqrt.c index 94560ed8223..954c2fa1889 100644 --- a/libf2c/libF77/z_sqrt.c +++ b/libf2c/libF77/z_sqrt.c @@ -2,23 +2,24 @@ #undef abs #include "math.h" -extern double f__cabs(double, double); -void z_sqrt(doublecomplex *r, doublecomplex *z) +extern double f__cabs (double, double); +void +z_sqrt (doublecomplex * r, doublecomplex * z) { - double mag, zi = z->i, zr = z->r; + double mag, zi = z->i, zr = z->r; - 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; - } - } + 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; + } +} |