how to compile a fortran program from web page 
Author Message
 how to compile a fortran program from web page

Hello all:
My friend ran into a problem. It looks very strange.
On a Windows NT 4.0 workstation with Apache 1.3.12 installed. The perl
interprator is ActivePerl 5.6.
fl32 is the compile command of Microsoft fortran PowerStation.

With the following script, he wants to compile some fortran programs and
generate a .exe file.
This can be done by execute "fl32 test.f fun1.f fun2.f fun3.f gauss.f" in an
Ms-dos window.
But the line in perl script 'fl32  test.f fun1.f fun2.f fun3.f gauss.f' only
generate the object file *.obj
not the test.exe expected.

Your help is really appreciated!
Yours,
John

Attachment:
#!c:/Perl/bin/perl.exe
print "content-type: text/html\n\n";

print <<EndOfHead;
 <html>
    <head>
      <title>Engineering Software Development Project</title>
      <meta http-equiv="Content-Type" content="text/html;

charset=iso-8859-1">
    </head>

<body bgcolor="#FFFFFF">
<div align="center">
  <p><h3>AE 6381 Course Project</h3></p>
  <p><b>Numerical Integration Gauss Quadrature</b></p>
  <p><b> <font color="#FF0000">By Wenbin Yu </font></b></p>
<hr>
EndOfHead

#Read and Decode the data from previous form



    ($name, $value) = split(/=/, $pair);
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $FORM{$name} = $value;

Quote:
}

# opens input.dat for output the value of Ndomain

$output="input.dat";
open OUTPUT, ">$output" or die "Cannot open $output to write $!";

# write to input.dat file
print OUTPUT "$FORM{'Ndomain'}\n";
close(output);

# use the input function to modify the correspond fortran file
$oldfile="function$FORM{'Ndomain'}.f";
open Old, "$oldfile" or die "Cannot open $oldfile to modify $!";
$newfile="fun$FORM{'Ndomain'}.f";
open New, ">$newfile" or die "Cannot open $newfile to modify $!";
while(<Old>)
    {
          printf New "        coeff=$FORM{'function'}\n" if /coeff=/ ;
          printf New $_ unless /coeff=/;
     }

close(Old);
close(New);

`fl32 test.f fun1.f fun2.f fun3.f gauss.f`;
exit;



Wed, 18 Jun 1902 08:00:00 GMT  
 how to compile a fortran program from web page
Hello all:
My friend ran into a problem. It looks very strange.
On a Windows NT 4.0 workstation with Apache 1.3.12 installed. The perl
interprator is ActivePerl 5.6.
fl32 is the compile command of Microsoft Fortran PowerStation.

With the following script, he wants to compile some fortran programs and
generate a .exe file.
This can be done by execute "fl32 test.f fun1.f fun2.f fun3.f gauss.f" in an
Ms-dos window.
But the line in perl script 'fl32  test.f fun1.f fun2.f fun3.f gauss.f' only
generate the object file *.obj
not the test.exe expected.

Your help is really appreciated!
Yours,
John

Attachment:
#!c:/Perl/bin/perl.exe
print "content-type: text/html\n\n";

print <<EndOfHead;
 <html>
    <head>
      <title>Engineering Software Development Project</title>
      <meta http-equiv="Content-Type" content="text/html;

charset=iso-8859-1">
    </head>

<body bgcolor="#FFFFFF">
<div align="center">
  <p><h3>AE 6381 Course Project</h3></p>
  <p><b>Numerical Integration Gauss Quadrature</b></p>
  <p><b> <font color="#FF0000">By Wenbin Yu </font></b></p>
<hr>
EndOfHead

#Read and Decode the data from previous form



    ($name, $value) = split(/=/, $pair);
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $FORM{$name} = $value;

Quote:
}

# opens input.dat for output the value of Ndomain

$output="input.dat";
open OUTPUT, ">$output" or die "Cannot open $output to write $!";

# write to input.dat file
print OUTPUT "$FORM{'Ndomain'}\n";
close(output);

# use the input function to modify the correspond fortran file
$oldfile="function$FORM{'Ndomain'}.f";
open Old, "$oldfile" or die "Cannot open $oldfile to modify $!";
$newfile="fun$FORM{'Ndomain'}.f";
open New, ">$newfile" or die "Cannot open $newfile to modify $!";
while(<Old>)
    {
          printf New "        coeff=$FORM{'function'}\n" if /coeff=/ ;
          printf New $_ unless /coeff=/;
     }

close(Old);
close(New);

`fl32 test.f fun1.f fun2.f fun3.f gauss.f`;
exit;



Wed, 18 Jun 1902 08:00:00 GMT  
 how to compile a fortran program from web page


Quote:
> #!c:/Perl/bin/perl.exe

You didn't enable warnings on the shebang line.
You also didn't enable the 'use strict' pragma which would enable
compile-time warnings (and disable some bad programming practices).

Quote:
> print "content-type: text/html\n\n";

You didn't use CGI.pm and will have some problems with that line.

Quote:
> #Read and Decode the data from previous form

> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});


>     ($name, $value) = split(/=/, $pair);
>     $value =~ tr/+/ /;
>     $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
>     $FORM{$name} = $value;
> }

You use weird capitalization.

Quote:
> # opens input.dat for output the value of Ndomain

> $output="input.dat";
> open OUTPUT, ">$output" or die "Cannot open $output to write $!";

Good, you are using '$!' to get error messages, but you have other serious
problems which can be learned by reading the output of '-w'

Quote:

> # write to input.dat file
> print OUTPUT "$FORM{'Ndomain'}\n";
> close(output);

Here's an error.

Quote:

> # use the input function to modify the correspond fortran file
> $oldfile="function$FORM{'Ndomain'}.f";
> open Old, "$oldfile" or die "Cannot open $oldfile to modify $!";
> $newfile="fun$FORM{'Ndomain'}.f";
> open New, ">$newfile" or die "Cannot open $newfile to modify $!";

Here's more weird capitalization.

Quote:
> while(<Old>)
>     {
>           printf New "        coeff=$FORM{'function'}\n" if /coeff=/ ;
>           printf New $_ unless /coeff=/;
>      }

Why do you use 'printf' when a 'print' would do the same thing (and save a
keystroke)?

Quote:

> close(Old);
> close(New);

> `fl32 test.f fun1.f fun2.f fun3.f gauss.f`;

Are you sending that output anywhere?

The least you can do is put a '-w' at the end of your shebang line.
Better, you can add a 'use strict;' to the line right after that.
Even better you could use the CGI.pm module.

perldoc CGI
perldoc strict
perldoc perlstyle
perldoc -f system

Lauren



Wed, 18 Jun 1902 08:00:00 GMT  
 how to compile a fortran program from web page
Dear Smith:
Thanks for you reply.
But I can't understand what's shebang line means.
And it's weired that this script runs ok under the dos windows of Winnt
workstation.
But didn't get the executable file (fortran) when get it from web browser.
however, It just gives us some *.obj file which means it compile the files
but not link them.

How to use CGI.pm? Is it come from Apache_1.3.12 automatically?
How can I configure it (both on server and on the first line of perl
script)?


Quote:



> > #!c:/Perl/bin/perl.exe

> You didn't enable warnings on the shebang line.
> You also didn't enable the 'use strict' pragma which would enable
> compile-time warnings (and disable some bad programming practices).

> > print "content-type: text/html\n\n";

> You didn't use CGI.pm and will have some problems with that line.

> > #Read and Decode the data from previous form

> > read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});


> >     ($name, $value) = split(/=/, $pair);
> >     $value =~ tr/+/ /;
> >     $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> >     $FORM{$name} = $value;
> > }

> You use weird capitalization.

> > # opens input.dat for output the value of Ndomain

> > $output="input.dat";
> > open OUTPUT, ">$output" or die "Cannot open $output to write $!";

> Good, you are using '$!' to get error messages, but you have other serious
> problems which can be learned by reading the output of '-w'

> > # write to input.dat file
> > print OUTPUT "$FORM{'Ndomain'}\n";
> > close(output);

> Here's an error.

> > # use the input function to modify the correspond fortran file
> > $oldfile="function$FORM{'Ndomain'}.f";
> > open Old, "$oldfile" or die "Cannot open $oldfile to modify $!";
> > $newfile="fun$FORM{'Ndomain'}.f";
> > open New, ">$newfile" or die "Cannot open $newfile to modify $!";

> Here's more weird capitalization.

> > while(<Old>)
> >     {
> >           printf New "        coeff=$FORM{'function'}\n" if /coeff=/ ;
> >           printf New $_ unless /coeff=/;
> >      }

> Why do you use 'printf' when a 'print' would do the same thing (and save a
> keystroke)?

> > close(Old);
> > close(New);

> > `fl32 test.f fun1.f fun2.f fun3.f gauss.f`;

> Are you sending that output anywhere?

> The least you can do is put a '-w' at the end of your shebang line.
> Better, you can add a 'use strict;' to the line right after that.
> Even better you could use the CGI.pm module.

> perldoc CGI
> perldoc strict
> perldoc perlstyle
> perldoc -f system

> Lauren



Wed, 18 Jun 1902 08:00:00 GMT  
 how to compile a fortran program from web page


Quote:
> Dear Smith:
> Thanks for you reply.
> But I can't understand what's shebang line means.

The 'shebang' line is the first line of the script that starts with '#!'.
It usually contains the location of the perl executable and other flags.

If you add a '-w' to the end of the line so that it looks like:

#!c:/Perl/bin/perl.exe -w

You will turn warnings on.  And this script generates a few warnings.

Quote:
> How to use CGI.pm? Is it come from Apache_1.3.12 automatically?
> How can I configure it (both on server and on the first line of perl
> script)?

CGI.pm comes with Perl.  So if you have Perl installed, you'll also have
CGI.pm installed.

To get the documentation for it, type 'perldoc CGI' at the DOS prompt.

Then type 'perldoc perldoc' for more information about the perldoc utility.

If your question is specifically about CGI programming, though, the
comp.infosystems.www.authoring.cgi newsgroup might be a better resource.

Lauren



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Perl Programs Serving Web Pages

2. Input a web page to a perl program

3. Pub needs automated web page generator program

4. please help - cgi database access script / program for web page

5. Looking for a Program to Produce Web Page from Humor Mail

6. Need a program to submit my web page to search engines

7. Free help for programming students web page

8. Programming related web page

9. Running a Fortran program using Perl

10. Calling an interactive FORTRAN program

11. Making a new web page out of an existing page

12. Readers and writers on web pages

 

 
Powered by phpBB® Forum Software