Drop old K&R style function declarations

Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
pull/24/head
Michele Calgaro 2 weeks ago
parent 9f8bda51db
commit 4dabefbee0
Signed by: MicheleC
GPG Key ID: 2A75B7CA8ADED5CF

@ -1,15 +1,9 @@
#include "stdio.h"
#include "f2c.h"
#ifdef KR_headers
extern VOID sig_die();
int abort_()
#else
extern void sig_die(char*,int);
int abort_(void)
#endif
{
sig_die("Fortran abort routine called", 1);
return 0; /* not reached */

@ -1,8 +1,5 @@
#include "f2c.h"
#include "fio.h"
#ifdef KR_headers
integer f_clos(a) cllist *a;
#else
#undef abs
#undef min
#undef max
@ -24,7 +21,6 @@ extern int unlink(const char*);
#endif
integer f_clos(cllist *a)
#endif
{ unit *b;
if(a->cunit >= MXUNIT) return(0);
@ -62,12 +58,7 @@ integer f_clos(cllist *a)
b->ufnm=NULL;
return(0);
}
void
#ifdef KR_headers
f_exit()
#else
f_exit(void)
#endif
void f_exit(void)
{ int i;
static cllist xx;
if (!xx.cerr) {
@ -80,12 +71,7 @@ f_exit(void)
}
}
}
int
#ifdef KR_headers
flush_()
#else
flush_(void)
#endif
int flush_(void)
{ int i;
for(i=0;i<MXUNIT;i++)
if(f__units[i].ufd != NULL && f__units[i].uwrt)

@ -1,24 +1,15 @@
#include "f2c.h"
#include "fio.h"
#ifdef KR_headers
extern char *strcpy();
extern FILE *tmpfile();
#else
#undef abs
#undef min
#undef max
#include "stdlib.h"
#include "string.h"
#endif
extern char *f__r_mode[], *f__w_mode[];
#ifdef KR_headers
integer f_end(a) alist *a;
#else
integer f_end(alist *a)
#endif
{
unit *b;
FILE *tf;
@ -36,12 +27,7 @@ integer f_end(alist *a)
return(b->useek ? t_runc(a) : 0);
}
static int
#ifdef KR_headers
copy(from, len, to) FILE *from, *to; long len;
#else
copy(FILE *from, long len, FILE *to)
#endif
static int copy(FILE *from, long len, FILE *to)
{
int len1;
char buf[BUFSIZ];
@ -55,12 +41,7 @@ copy(FILE *from, long len, FILE *to)
return 0;
}
int
#ifdef KR_headers
t_runc(a) alist *a;
#else
t_runc(alist *a)
#endif
int t_runc(alist *a)
{
long loc, len;
unit *b;

@ -5,14 +5,10 @@
#include "sys/stat.h"
#endif
#include "f2c.h"
#ifdef KR_headers
extern char *malloc();
#else
#undef abs
#undef min
#undef max
#include "stdlib.h"
#endif
#include "fio.h"
#include "fmt.h" /* for struct syl */
@ -25,17 +21,10 @@ flag f__reading; /*1 if reading, 0 if writing*/
flag f__cplus,f__cblank;
char *f__fmtbuf;
flag f__external; /*1 if external io, 0 if internal */
#ifdef KR_headers
int (*f__doed)(),(*f__doned)();
int (*f__doend)(),(*f__donewrec)(),(*f__dorevert)();
int (*f__getn)(); /* for formatted input */
void (*f__putn)(); /* for formatted output */
#else
int (*f__getn)(void); /* for formatted input */
void (*f__putn)(int); /* for formatted output */
int (*f__doed)(struct syl*, char*, ftnlen),(*f__doned)(struct syl*);
int (*f__dorevert)(void),(*f__donewrec)(void),(*f__doend)(void);
#endif
flag f__sequential; /*1 if sequential io, 0 if direct*/
flag f__formatted; /*1 if formatted io, 0 if unformatted*/
FILE *f__cf; /*current file*/
@ -81,11 +70,7 @@ char *F_err[] =
};
#define MAXERR (sizeof(F_err)/sizeof(char *)+100)
#ifdef KR_headers
int f__canseek(f) FILE *f; /*SYSDEP*/
#else
int f__canseek(FILE *f) /*SYSDEP*/
#endif
{
#ifdef NON_UNIX_STDIO
return !isatty(fileno(f));
@ -135,12 +120,7 @@ int f__canseek(FILE *f) /*SYSDEP*/
#endif
}
void
#ifdef KR_headers
f__fatal(n,s) char *s;
#else
f__fatal(int n, char *s)
#endif
void f__fatal(int n, char *s)
{
if(n<100 && n>=0) perror(s); /*SYSDEP*/
else if(n >= (int)MAXERR || n < -1)
@ -187,11 +167,7 @@ f_init(Void)
p->uwrt=1;
}
#ifdef KR_headers
int f__nowreading(x) unit *x;
#else
int f__nowreading(unit *x)
#endif
{
long loc;
int ufmt, urw;
@ -219,11 +195,7 @@ int f__nowreading(unit *x)
return 0;
}
#ifdef KR_headers
int f__nowwriting(x) unit *x;
#else
int f__nowwriting(unit *x)
#endif
{
long loc;
int ufmt;
@ -258,12 +230,7 @@ int f__nowwriting(unit *x)
return 0;
}
int
#ifdef KR_headers
err__fl(f, m, s) int f, m; char *s;
#else
err__fl(int f, int m, char *s)
#endif
int err__fl(int f, int m, char *s)
{
if (!f)
f__fatal(m, s);

@ -45,16 +45,6 @@ extern flag f__init;
extern cilist *f__elist; /*active external io list*/
extern flag f__reading,f__external,f__sequential,f__formatted;
#undef Void
#ifdef KR_headers
#define Void /*void*/
extern int (*f__getn)(); /* for formatted input */
extern void (*f__putn)(); /* for formatted output */
extern void x_putc();
extern long f__inode();
extern VOID sig_die();
extern int (*f__donewrec)(), t_putc(), x_wSL();
extern int c_sfe(), err__fl(), xrd_SL(), f__putbuf();
#else
#define Void void
#ifdef __cplusplus
extern "C" {
@ -80,7 +70,6 @@ extern int f__putbuf(int);
#ifdef __cplusplus
}
#endif
#endif
extern int (*f__doend)(Void);
extern FILE *f__cf; /*current file*/
extern unit *f__curunit; /*current unit*/

@ -21,12 +21,7 @@ extern flag f__cblank,f__cplus; /*blanks in I and compulsory plus*/
static struct syl f__syl[SYLMX];
int f__parenlvl,f__pc,f__revloc;
static
#ifdef KR_headers
char *ap_end(s) char *s;
#else
char *ap_end(char *s)
#endif
static char *ap_end(char *s)
{ char quote;
quote= *s++;
for(;*s;s++)
@ -41,12 +36,7 @@ char *ap_end(char *s)
/*NOTREACHED*/ return 0;
}
static
#ifdef KR_headers
int op_gen(a,b,c,d)
#else
int op_gen(int a, int b, int c, int d)
#endif
static int op_gen(int a, int b, int c, int d)
{ struct syl *p= &f__syl[f__pc];
if(f__pc>=SYLMX)
{ fprintf(stderr,"format too complicated:\n");
@ -59,13 +49,8 @@ int op_gen(int a, int b, int c, int d)
return(f__pc++);
}
#ifdef KR_headers
static char *f_list();
static char *gt_num(s,n,n1) char *s; int *n, n1;
#else
static char *f_list(char*);
static char *gt_num(char *s, int *n, int n1)
#endif
{ int m=0,f__cnt=0;
char c;
for(c= *s;;c = *s)
@ -87,12 +72,7 @@ static char *gt_num(char *s, int *n, int n1)
return(s);
}
static
#ifdef KR_headers
char *f_s(s,curloc) char *s;
#else
char *f_s(char *s, int curloc)
#endif
static char *f_s(char *s, int curloc)
{
skip(s);
if(*s++!='(')
@ -109,12 +89,7 @@ char *f_s(char *s, int curloc)
return(s);
}
static
#ifdef KR_headers
int ne_d(s,p) char *s,**p;
#else
int ne_d(char *s, char **p)
#endif
static int ne_d(char *s, char **p)
{ int n,x,sign=0;
struct syl *sp;
switch(*s)
@ -201,12 +176,7 @@ int ne_d(char *s, char **p)
return(1);
}
static
#ifdef KR_headers
int e_d(s,p) char *s,**p;
#else
int e_d(char *s, char **p)
#endif
static int e_d(char *s, char **p)
{ int i,im,n,w,d,e,found=0,x=0;
char *sv=s;
s=gt_num(s,&n,1);
@ -321,12 +291,7 @@ int e_d(char *s, char **p)
return(1);
}
static
#ifdef KR_headers
char *i_tem(s) char *s;
#else
char *i_tem(char *s)
#endif
static char *i_tem(char *s)
{ char *t;
int n,curloc;
if(*s==')') return(s);
@ -337,12 +302,7 @@ char *i_tem(char *s)
return(f_s(s,curloc));
}
static
#ifdef KR_headers
char *f_list(s) char *s;
#else
char *f_list(char *s)
#endif
static char *f_list(char *s)
{
for(;*s!=0;)
{ skip(s);
@ -362,11 +322,7 @@ char *f_list(char *s)
return(NULL);
}
#ifdef KR_headers
int pars_f(s) char *s;
#else
int pars_f(char *s)
#endif
{
f__parenlvl=f__revloc=f__pc=0;
if(f_s(s,0) == NULL)
@ -380,12 +336,7 @@ int pars_f(char *s)
int f__cnt[STKSZ],f__ret[STKSZ],f__cp,f__rp;
flag f__workdone, f__nonl;
static
#ifdef KR_headers
int type_f(n)
#else
int type_f(int n)
#endif
static int type_f(int n)
{
switch(n)
{
@ -414,11 +365,7 @@ int type_f(int n)
}
}
#ifdef KR_headers
integer do_fio(number,ptr,len) ftnint *number; ftnlen len; char *ptr;
#else
integer do_fio(ftnint *number, char *ptr, ftnlen len)
#endif
{ struct syl *p;
int n,i;
for(i=0;i<*number;i++,ptr+=len)

@ -46,21 +46,12 @@ typedef union
} ufloat;
typedef union
{ short is;
#ifndef KR_headers
signed
#endif
char ic;
signed char ic;
integer il;
#ifdef Allow_TYQUAD
longint ili;
#endif
} Uint;
#ifdef KR_headers
extern int (*f__doed)(),(*f__doned)();
extern int (*f__dorevert)();
extern int rd_ed(),rd_ned();
extern int w_ed(),w_ned();
#else
#ifdef __cplusplus
extern "C" {
#endif
@ -76,7 +67,6 @@ extern int wrt_L(Uint*, int, ftnlen);
#ifdef __cplusplus
}
#endif
#endif
extern flag f__cblank,f__cplus,f__workdone, f__nonl;
extern char *f__fmtbuf;
extern int f__scale;
@ -93,8 +83,4 @@ extern int f__cursor;
#define TYQUAD 14
#endif
#ifdef KR_headers
extern char *f__icvt();
#else
extern char *f__icvt(longint, int*, int*, int);
#endif

@ -9,12 +9,7 @@
#define ulongint unsigned long
#endif
#ifdef KR_headers
char *f__icvt(value,ndigit,sign, base) longint value; int *ndigit,*sign;
int base;
#else
char *f__icvt(longint value, int *ndigit, int *sign, int base)
#endif
{
static char buf[MAXINTLENGTH+1];
int i;

@ -9,20 +9,12 @@
#endif
#endif
#ifdef KR_headers
extern char *malloc();
#ifdef NON_ANSI_STDIO
extern char *mktemp();
#endif
extern integer f_clos();
#else
#undef abs
#undef min
#undef max
#include "stdlib.h"
extern int f__canseek(FILE*);
extern integer f_clos(cllist*);
#endif
#ifdef NON_ANSI_RW_MODES
char *f__r_mode[2] = {"r", "r"};
@ -32,15 +24,10 @@ char *f__r_mode[2] = {"rb", "r"};
char *f__w_mode[4] = {"wb", "w", "r+b", "r+"};
#endif
static char f__buf0[400], *f__buf = f__buf0;
int f__buflen = (int)sizeof(f__buf0);
static char f__buf0[400], *f__buf = f__buf0;
int f__buflen = (int)sizeof(f__buf0);
static void
#ifdef KR_headers
f__bufadj(n, c) int n, c;
#else
f__bufadj(int n, int c)
#endif
static void f__bufadj(int n, int c)
{
unsigned int len;
char *nbuf, *s, *t, *te;
@ -62,12 +49,7 @@ f__bufadj(int n, int c)
f__buf = nbuf;
}
int
#ifdef KR_headers
f__putbuf(c) int c;
#else
f__putbuf(int c)
#endif
int f__putbuf(int c)
{
char *s, *se;
int n;
@ -92,12 +74,7 @@ f__putbuf(int c)
return 0;
}
void
#ifdef KR_headers
x_putc(c)
#else
x_putc(int c)
#endif
void x_putc(int c)
{
if (f__recpos >= f__buflen)
f__bufadj(f__recpos, f__buflen);
@ -106,12 +83,7 @@ x_putc(int c)
#define opnerr(f,m,s) {if(f) errno= m; else opn_err(m,s,a); return(m);}
static void
#ifdef KR_headers
opn_err(m, s, a) int m; char *s; olist *a;
#else
opn_err(int m, char *s, olist *a)
#endif
static void opn_err(int m, char *s, olist *a)
{
if (a->ofnm) {
/* supply file name to error message */
@ -122,11 +94,7 @@ opn_err(int m, char *s, olist *a)
f__fatal(m, s);
}
#ifdef KR_headers
integer f_open(a) olist *a;
#else
integer f_open(olist *a)
#endif
{ unit *b;
integer rv;
char buf[256], *s;
@ -270,11 +238,8 @@ integer f_open(olist *a)
opnerr(a->oerr,129,"open");
return(0);
}
#ifdef KR_headers
int fk_open(seq,fmt,n) ftnint n;
#else
int fk_open(int seq, int fmt, ftnint n)
#endif
{ char nbuf[10];
olist a;
(void) sprintf(nbuf,"fort.%ld",(long)n);

@ -2,11 +2,7 @@
/* compare two strings */
#ifdef KR_headers
integer s_cmp(a0, b0, la, lb) char *a0, *b0; ftnlen la, lb;
#else
integer s_cmp(char *a0, char *b0, ftnlen la, ftnlen lb)
#endif
{
unsigned char *a, *aend, *b, *bend;
a = (unsigned char *)a0;

@ -8,11 +8,7 @@
/* assign strings: a = b */
#ifdef KR_headers
VOID s_copy(a, b, la, lb) char *a, *b; ftnlen la, lb;
#else
void s_copy(char *a, char *b, ftnlen la, ftnlen lb)
#endif
{
char *aend, *bend;

@ -1,10 +1,6 @@
#include "stdio.h"
#include "f2c.h"
#ifdef KR_headers
extern void f_exit();
VOID s_stop(s, n) char *s; ftnlen n;
#else
#undef abs
#undef min
#undef max
@ -15,7 +11,6 @@ extern "C" {
void f_exit(void);
int s_stop(char *s, ftnlen n)
#endif
{
int i;

@ -11,11 +11,7 @@ integer e_rsfe(Void)
return(n);
}
#ifdef KR_headers
int c_sfe(a) cilist *a; /* check */
#else
int c_sfe(cilist *a) /* check */
#endif
{ unit *p;
f__curunit = p = &f__units[a->ciunit];
if(a->ciunit >= MXUNIT || a->ciunit<0)

@ -7,9 +7,6 @@
#endif
#endif
#ifdef KR_headers
void sig_die(s, kill) char *s; int kill;
#else
#include "stdlib.h"
#ifdef __cplusplus
extern "C" {
@ -17,7 +14,6 @@ extern "C" {
extern void f_exit(void);
void sig_die(char *s, int kill)
#endif
{
/* print error message, then clear buffers */
fprintf(stderr, "%s\n", s);

@ -7,12 +7,7 @@
#include "f2c.h"
#include "fio.h"
VOID
#ifdef KR_headers
g_char(a,alen,b) char *a,*b; ftnlen alen;
#else
g_char(char *a, ftnlen alen, char *b)
#endif
void g_char(char *a, ftnlen alen, char *b)
{
char *x = a + alen, *y = b + alen;
@ -29,22 +24,13 @@ g_char(char *a, ftnlen alen, char *b)
while(x-- > a);
}
VOID
#ifdef KR_headers
b_char(a,b,blen) char *a,*b; ftnlen blen;
#else
b_char(char *a, char *b, ftnlen blen)
#endif
void b_char(char *a, char *b, ftnlen blen)
{ int i;
for(i=0;i<blen && *a!=0;i++) *b++= *a++;
for(;i<blen;i++) *b++=' ';
}
#ifndef NON_UNIX_STDIO
#ifdef KR_headers
long f__inode(a, dev) char *a; int *dev;
#else
long f__inode(char *a, int *dev)
#endif
{ struct stat x;
if(stat(a,&x)<0) return(-1);
*dev = x.st_dev;

@ -1,13 +1,11 @@
#include "f2c.h"
#include "fio.h"
#ifndef KR_headers
#undef abs
#undef min
#undef max
#include "stdlib.h"
#include "string.h"
#endif
#include "fmt.h"
#include "fp.h"
@ -15,11 +13,7 @@
#include "ctype.h"
#endif
#ifdef KR_headers
int wrt_E(p,w,d,e,len) ufloat *p; ftnlen len;
#else
int wrt_E(ufloat *p, int w, int d, int e, ftnlen len)
#endif
{
char buf[FMAX+EXPMAXDIGS+4], *s, *se;
int d1, delta, e1, i, sign, signspace;
@ -191,11 +185,7 @@ nogood:
return 0;
}
#ifdef KR_headers
int wrt_F(p,w,d,len) ufloat *p; ftnlen len;
#else
int wrt_F(ufloat *p, int w, int d, ftnlen len)
#endif
{
int d1, sign, n;
double x;

@ -64,12 +64,7 @@ mv_cur(Void) /* shouldn't use fseek because it insists on calling fflush */
return(0);
}
static int
#ifdef KR_headers
wrt_Z(n,w,minlen,len) Uint *n; int w, minlen; ftnlen len;
#else
wrt_Z(Uint *n, int w, int minlen, ftnlen len)
#endif
static int wrt_Z(Uint *n, int w, int minlen, ftnlen len)
{
char *s, *se;
int i, w1;
@ -119,12 +114,7 @@ wrt_Z(Uint *n, int w, int minlen, ftnlen len)
return 0;
}
static int
#ifdef KR_headers
wrt_I(n,w,len, base) Uint *n; ftnlen len; int base;
#else
wrt_I(Uint *n, int w, ftnlen len, int base)
#endif
static int wrt_I(Uint *n, int w, ftnlen len, int base)
{ int ndigit,sign,spare,i;
longint x;
char *ans;
@ -147,12 +137,8 @@ wrt_I(Uint *n, int w, ftnlen len, int base)
}
return(0);
}
static int
#ifdef KR_headers
wrt_IM(n,w,m,len,base) Uint *n; ftnlen len; int base;
#else
wrt_IM(Uint *n, int w, int m, ftnlen len, int base)
#endif
static int wrt_IM(Uint *n, int w, int m, ftnlen len, int base)
{ int ndigit,sign,spare,i,xsign;
longint x;
char *ans;
@ -184,12 +170,8 @@ wrt_IM(Uint *n, int w, int m, ftnlen len, int base)
for(i=0;i<ndigit;i++) (*f__putn)(*ans++);
return(0);
}
static int
#ifdef KR_headers
wrt_AP(s) char *s;
#else
wrt_AP(char *s)
#endif
static int wrt_AP(char *s)
{ char quote;
int i;
@ -203,12 +185,8 @@ wrt_AP(char *s)
}
return(1);
}
static int
#ifdef KR_headers
wrt_H(a,s) char *s;
#else
wrt_H(int a, char *s)
#endif
static int wrt_H(int a, char *s)
{
int i;
@ -217,11 +195,8 @@ wrt_H(int a, char *s)
while(a--) (*f__putn)(*s++);
return(1);
}
#ifdef KR_headers
int wrt_L(n,len, sz) Uint *n; ftnlen sz;
#else
int wrt_L(Uint *n, int len, ftnlen sz)
#endif
{ int i;
long x;
if(sizeof(long)==sz) x=n->il;
@ -233,22 +208,14 @@ int wrt_L(Uint *n, int len, ftnlen sz)
else (*f__putn)('F');
return(0);
}
static int
#ifdef KR_headers
wrt_A(p,len) char *p; ftnlen len;
#else
wrt_A(char *p, ftnlen len)
#endif
static int wrt_A(char *p, ftnlen len)
{
while(len-- > 0) (*f__putn)(*p++);
return(0);
}
static int
#ifdef KR_headers
wrt_AW(p,w,len) char * p; ftnlen len;
#else
wrt_AW(char * p, int w, ftnlen len)
#endif
static int wrt_AW(char * p, int w, ftnlen len)
{
while(w>len)
{ w--;
@ -259,12 +226,7 @@ wrt_AW(char * p, int w, ftnlen len)
return(0);
}
static int
#ifdef KR_headers
wrt_G(p,w,d,e,len) ufloat *p; ftnlen len;
#else
wrt_G(ufloat *p, int w, int d, int e, ftnlen len)
#endif
static int wrt_G(ufloat *p, int w, int d, int e, ftnlen len)
{ double up = 1,x;
int i=0,oldscale,n,j;
x = len==sizeof(real)?p->pf:p->pd;
@ -289,11 +251,8 @@ wrt_G(ufloat *p, int w, int d, int e, ftnlen len)
}
return(wrt_E(p,w,d,e,len));
}
#ifdef KR_headers
int w_ed(p,ptr,len) struct syl *p; char *ptr; ftnlen len;
#else
int w_ed(struct syl *p, char *ptr, ftnlen len)
#endif
{
int i;
@ -335,11 +294,8 @@ int w_ed(struct syl *p, char *ptr, ftnlen len)
return(wrt_Z((Uint *)ptr,p->p1,p->p2.i[0],len));
}
}
#ifdef KR_headers
int w_ned(p) struct syl *p;
#else
int w_ned(struct syl *p)
#endif
{
switch(p->op)
{

@ -39,11 +39,7 @@ xw_rev(Void)
return n;
}
#ifdef KR_headers
integer s_wsfe(a) cilist *a; /*start*/
#else
integer s_wsfe(cilist *a) /*start*/
#endif
{ int n;
if(!f__init) f_init();
f__reading=0;

Loading…
Cancel
Save