[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
970210: netcdf ftest with PROMULA FORTRAN
- Subject: 970210: netcdf ftest with PROMULA FORTRAN
- Date: Mon, 10 Feb 97 09:17:43 -0700
George,
>Date: Fri, 07 Feb 1997 15:38:45 -0500
>From: "George E. Juras" <address@hidden>
>Organization: PROMULA Development Corporation
>To: Steve Emmerson <address@hidden>
>Subject: Re: netcdf ftest with PROMULA FORTRAN
>Keywords: 199612121831.AA26117
In the above message you wrote:
> Using your instructions (from Dec 30, 1996), I tried to finish the netcdf
> ftest soon after the holidays and here are the results. Sorry that it took
> me a while to get back to this project.
>
> As you can see, your promula script does not do the link step properly.
> PROMULA FORTRAN only translates ftest.f to ftest.c. cc then compiles
> to ftest.o and cc links ftest.o with the netcdf libraries AND the
> PROMULA FORTRAN Runtime Library, libpfc.a, AND the C
> math library, lm.a, to produce the ftest executable.
>
> Steve, could you fix (or tell me how to fix) your promula script so that
> it does the link properly, as part of 'make test'? Thanks.
>
> George
> ------------------------------------------------------------------------------
> /netcdf/netcdf-2.4.3/src:
> /netcdf/netcdf-2.4.3/src:
> /netcdf/netcdf-2.4.3/src:make test
>
> making `test' in directory /netcdf/netcdf-2.4.3/src/xdr
>
> ./xdrtest > xdrtest_out.new
> diff xdrtest_out.new testout.sav
> *** XDR passes formatted test ***
> cmp test.xdr test_xdr.sav
> *** XDR passes binary test ***
>
> returning to directory /netcdf/netcdf-2.4.3/src
>
>
> making `test' in directory /netcdf/netcdf-2.4.3/src/libsrc
>
> ar rcuv libnetcdf.a array.o attr.o cdf.o dim.o file.o iarray.o error.o
> globdef.o putget.o putgetg.o sharray.o string.o var.o xdrposix.o
> case "" in \
> '') ;; \
> *) ar rucv libnetcdf.a ;; \
> esac
> ranlib libnetcdf.a
> c89 -o cdftest +z -O cdftest.o libnetcdf.a
> ./cdftest > cdftest_out.new
> nccreate: filename "test.nc": File exists
> trying again
> diff cdftest_out.new testout.sav
> *** netCDF passes formatted test ***
> cmp test.nc test_cdf.sav
> *** netCDF passes binary test ***
>
> returning to directory /netcdf/netcdf-2.4.3/src
>
>
> making `test' in directory /netcdf/netcdf-2.4.3/src/nctest
>
> c89 -o nctest -O varget.o vargetg.o varput.o varputg.o vardef.o vartests.o
> vputget.o vputgetg.o driver.o cdftests.o dimtests.o rec.o atttests.o
> misctest.o add.o error.o emalloc.o val.o slabs.o ../libsrc/libnetcdf.a
> ./nctest
> *** Testing nccreate ... ok ***
> *** Testing ncopen ... ok ***
> *** Testing ncredef ... ok ***
> *** Testing ncendef ... ok ***
> *** Testing ncclose ... ok ***
> *** Testing ncinquire ... ok ***
> *** Testing ncsync ... ok ***
> *** Testing ncabort ... ok ***
> *** Testing ncdimdef ... ok ***
> *** Testing ncdimid ... ok ***
> *** Testing ncdiminq ... ok ***
> *** Testing ncdimrename ... ok ***
> *** Testing ncvardef ... ok ***
> *** Testing ncvarid ... ok ***
> *** Testing ncvarinq ... ok ***
> *** Testing ncvarput1 ... ok ***
> *** Testing ncvarget1 ... ok ***
> *** Testing ncvarput ... ok ***
> *** Testing ncvarget ... ok ***
> *** Testing ncvarputg ... ok ***
> *** Testing ncvargetg ... ok ***
> *** Testing ncrecinq ... ok ***
> *** Testing ncrecput ... ok ***
> *** Testing ncrecget ... ok ***
> *** Testing ncvarrename ... ok ***
> *** Testing ncattput ... ok ***
> *** Testing ncattinq ... ok ***
> *** Testing ncattget ... ok ***
> *** Testing ncattcopy ... ok ***
> *** Testing ncattname ... ok ***
> *** Testing ncattrename ... ok ***
> *** Testing ncattdel ... ok ***
> *** Testing nctypelen ... ok ***
>
> returning to directory /netcdf/netcdf-2.4.3/src
>
>
> making `test' in directory /netcdf/netcdf-2.4.3/src/fortran
>
> ar rcuv ../libsrc/libnetcdf.a jackets.o
> ranlib ../libsrc/libnetcdf.a
> /netcdf/netcdf-2.4.3/src/promula -c ftest.f
> PROMULA.FORTRAN to C V6.10 (Beta 001) (c) 1988-96 PROMULA Development Corp.
> /netcdf/netcdf-2.4.3/src/promula -o ftest ftest.o -L../libsrc -lnetcdf
> /netcdf/netcdf-2.4.3/src/promula: Usage:
> /netcdf/netcdf-2.4.3/src/promula file_or_option ...
> /netcdf/netcdf-2.4.3/src/promula: Usage:
> /netcdf/netcdf-2.4.3/src/promula file_or_option ...
> /netcdf/netcdf-2.4.3/src/promula[77]: shift: The specified number is not
> valid for this command.
> *** Error exit code 1
>
> Stop.
> *** Error exit code 1
>
> Stop.
>
> Steve, your script needs to link libpfc.a and lm.a in order to make the ftest
> executable, as I am doing below.
>
> /netcdf/netcdf-2.4.3/src:
> /netcdf/netcdf-2.4.3/src:cd fortran
> /netcdf/netcdf-2.4.3/src/fortran:
> /netcdf/netcdf-2.4.3/src/fortran:cc -o ftest ftest.o -L../libsrc -lnetcdf
> -lpfc -lm
> /netcdf/netcdf-2.4.3/src/fortran:
> /netcdf/netcdf-2.4.3/src/fortran:./ftest
> *** Testing nccre ...
> *** Testing ncddef ...
> *** Testing ncvdef ...
> *** Testing ncapt, ncaptc ...
> *** Testing ncclos ...
> *** Testing ncvpt1 ...
> *** Testing ncvgt1 ...
> *** Testing ncvpt ...
> *** Testing ncopn, ncinq, ncdinq, ncvinq, ncanam, ncainq ...
> *** Testing ncvgt, ncvgtc ...
> *** Testing ncagt, ncagtc ...
> *** Testing ncredf, ncdren, ncvren, ncaren, ncendf ...
> *** Testing ncacpy ...
> *** Testing ncadel ...
> *** Testing fill values ...
> /netcdf/netcdf-2.4.3/src/fortran:
>
> To refresh your memory, here is a listing of your promula script.
Thanks.
I've enclosed a new version of the script. Please let me know how it
works.
--------
Steve Emmerson <address@hidden>
--------Begin promula script
# Script for emulating a FORTRAN utility using the PROMULA `pfc'
# FORTRAN-to-C translator.
# Customizations. Modify as necessary.
#
translator=pfc
compiler=cc
# Print a message to standard error.
#
# Internal function.
#
errmsg()
{
echo 1>&2 $arg0: "$@"
}
# Print a usage message.
#
# Internal function.
#
usage()
{
errmsg "\
Usage:
$arg0 file_or_option ..."
}
# Translate and compile a file.
#
translate_and_compile()
{
file=$1
if eval $translator $tflags $file; then
name=`basename $file .f`
if eval $compiler -c $cflags $outopt $name.c; then
rm $name.c
else
errmsg "Unable to compile $file"
return 1
fi
else
errmsg "Unable to translate $file"
return 1
fi
}
# Decode the arguments.
#
arg0=$0
compile_only=0
outopt=
files=
tflags=
cflags=
while :; do
case $# in
0)
break
;;
*)
case $1 in
-c)
compile_only=1
;;
-o)
shift
outopt="-o $1"
;;
-*)
usage
;;
*)
files="$files $1"
;;
esac
;;
esac
shift
done
# Perform the action.
#
case $compile_only in
0)
objs=
for file in "$files"; do
case $file in
*.f)
if eval translate_and_compile $file; then
objs="$objs `basename $file .f`.o"
else
break
fi
;;
*)
objs="$objs $file"
esac
done
case $? in
0)
$compiler $cflags $outopt $objs -lpfc -lm
;;
esac
;;
*)
for file in "$files"; do
case $file in
*.f)
name=`basename $file .f`
if eval translate_and_compile $file; then
: true
else
break
fi
;;
*)
if eval $compiler -c $cflags $outopt $file; then
: true
else
errmsg "Unable to compile $file"
break
fi
;;
esac
done
;;
esac
exit