/* EFL-Ratfor-Fortran command */
int bdcount
= 0; /* count block data files generated */
int rflag
= 0; /* Ratfor or EFL ony, no compile */
int dflag
= 0; /* Compile EFL DEBUG statements if set */
int tflag
= 0; /* Trace operation of command if set */
int vflag
= 1; /* Verify files compiled if set */
int mflag
= 0; /* Ratfor macro pre-pass if set */
int fflag
= 0; /* Save Fortran intermediate files if set */
int cflag
= 0; /* Compile only if set */
int Uflag
= 0; /* Add IMPLICIT UNDEFINED to generated fortran */
int Cflag
= 0; /* Copy Ratfor comments if set */
char *complr
= "/usr/fort/fc1";
char *ratfor
= "/usr/bin/ratfor";
char *ratout
= "ratjunk";
char *rattmp
= "ratjunk.r";
char *efl
= "/usr/bin/efl";
char *eflout
= "efljunk";
char *macro
= "/usr/bin/m4";
char *undecl
= "implicit undefined /a-z,A-Z/\n";
for(j
=1; argv
[i
][j
]; j
++) {
eflopt
[3] = argv
[i
][j
+1];
rflag
= cflag
= fflag
= 1;
rflag
= fflag
= cflag
= 1;
complr
= "/usr/fort/fc2";
ratopt
[2] = argv
[i
][j
+1];
rflag
= cflag
= fflag
= 1;
llenter(setsuf(copy(t
),'o'));
if (signal(SIGINT
, SIG_IGN
) != SIG_IGN
)
printf("errcnt=%d, nl=%d\n", errcnt
, nl
);
if (errcnt
==0 & cflag
==0 && nl
!=0) {
av
[j
++] = "/usr/lib/filib.a";
printf("%s status=%d\n", arg0
, n
);
if( callprep( efl
, s
, eflout
, eflopt
, 0, 0 ) == 0 ) {
if( ( t
= callprep( macro
, s
, rattmp
, 0, 0, 0 ) ) < BADOPEN
)
t
= callprep( ratfor
, rattmp
, ratout
, ratopt
, Cflag
?"-C":0, 0 );
t
= callprep( ratfor
, s
, ratout
, ratopt
, Cflag
?"-C":0, 0 );
callprep( prep
, file
, output
, opt1
, opt2
, opt3
)
char *prep
, *file
, *output
, *opt1
, *opt2
, *opt3
;
if (opt1
) av
[j
++] = opt1
;
if (opt2
) av
[j
++] = opt2
;
if (opt3
) av
[j
++] = opt3
;
printf("%s <%s ", av
[0], file
);
if( (fout
=creat(output
, 0666)) < 0) {
error( "can't open %s", output
);
if( (fin
=open(file
, 0)) < 0) {
error( "can't open %s", file
);
error("can't execute %s", prep
);
while( t
!=wait(&status
) );
if( (t
=(status
&0377)) != 0 && t
!=14 )
printf("status = %d\n", t
);
cunlink( setsuf( rlist
[i
], 'o' ) );
if( fflag
==0 ) cunlink( setsuf( rlist
[i
], 'f' ) );
if( nodup(llist
,rlist
[i
]) )
cunlink(setsuf(rlist
[i
],'f'));
if( vflag
) printf("%s:\n", s
);
if( callsys(complr
, av
) )
if (c
<=14 && c
>2 && *s
++=='.')
if(link(s
, t
) || cunlink(s
)) {
printf("move failed: %s\n", t
);
printf("Can't find %s\n", f
);
if ((t
=(status
&0377)) != 0 && t
!=14) {
if (t
!=2) /* interrupt */
printf("Fatal error in %s\n", f
);
printf("status = %d\n", t
);
printf("unlink %s\n", f
);
splitup(file
) char *file
; {
char in
[1500], fname
[20];
if( (fin
=open(file
, 0)) < 0)
error("can't open %s", file
);
if( *in
== 'c' || *in
== 'C' ) continue;
mainsw
= getname(in
, fname
);
if( (fd
= fcreat(fname
, buf
)) < 0)
error("can't open %s", fname
);
while( (*s
++=c
=getchar()) != '\n' && c
!= '\0' );
puts(s
,b
) char *s
; int *b
; {
getname(s
,f
) char *s
,*f
; {
while( *s
== ' ' || *s
== '\t' )
if( compar(s
,"subroutine") ){ s
+= 10; goto bot
; }
else if( compar( s
,"function") ){ s
+= 8; goto bot
; }
else if( compar(s
,"real") ){ s
+= 4; goto loop
; }
else if( compar(s
,"integer") ){ s
+= 7; goto loop
; }
else if( compar(s
,"logical") ){ s
+= 7; goto loop
; }
else if( compar(s
,"double") ){ s
+= 6; goto loop
; }
else if( compar(s
,"precision") ){ s
+= 9; goto loop
; }
else if( compar(s
,"complex") ){ s
+= 7; goto loop
; }
else if( compar(s
,"*") ){ /* integer *16 */
while( (*s
>= '0' && *s
<= '9') || *s
== ' ' || *s
== '\t' )
else if( compar(s
,"block") ){
s
[9] = (bdcount
++) + '0';
for(i
=0; f
[i
]="MAIN.f"[i
]; i
++);
while( *s
== ' ' || *s
== '\t' )
for(i
=0; alphanum(s
[i
]); i
++)
compar(s
,t
) char *s
,*t
; {
return( (c
>='a' && c
<='z')
while( *s
==' ' || *s
=='\t' )
if( *s
!='e' || *(s
+1)!='n' || *(s
+2)!='d' || *(s
+3)!='\n' )