Re: WRAPIT character definition - syntax error

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Mon, 27 Aug 2007 14:14:54 -0600

In your stub file try

       character*(*) mapsource
       character*(*) startloc
       character*(*) field
       character*(*) hdate
       character*(*) units
       character*(*) desc

Melissa.Bukovsky_at_noaa.gov wrote:
> Hello,
>
> I'm trying to use fortran with ncl to write unformated binary data,
> however, I'm recieving the message "A syntax error occurred while
> parsing: msl". WRAPIT does produce the .so file, but it doesn't work
> when called from the ncl script. The problem seems to be in my stub
> file (the subroutine is written in fortran 90) with the way the
> characters are declared, but I don't see a problem. The error occurs
> for whichever variable is at the top of the character declaration list.
> Relavent parts of the code are pasted below. Can wrapit not handle
> character declarations with an integer varible for the length? If
> anyone sees a problem in my code that I'm missing, or can suggest a way
> around this, please let me know.
>
> Thanks,
>
> Melissa
>
> [mbukov_at_oliver WPS]$ ./WRAPIT -gf -d writeinter_gauss.stub
> writeinter_gauss.f90
>
> WRAPIT Version: 051007
> OPERATING SYSTEM: Linux
> FORTRAN COMPILER (f90c): gfortran
> FORTRAN COMPILER OPTIONS (fopts): -fconvert=big-endian -fPIC -v -c
> -fno-second-underscore
> A syntax error occurred while parsing: msl
> gcc -fPIC -c -I/usr/local/ncl/include WRAPIT.c
> COMPILING writeinter_gauss.f90
> gfortran -fconvert=big-endian -fPIC -v -c -fno-second-underscore
> writeinter_gauss.f90
> Using built-in specs.
> Target: x86_64-redhat-linux
> Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
> --infodir=/usr/share/info --enable-shared --enable-threads=posix
> --enable-checking=release --with-system-zlib --enable-__cxa_atexit
> --disable-libunwind-exceptions --enable-libgcj-multifile
> --enable-languages=c,c++,objc,obj-c++,java,fortran,ada
> --enable-java-awt=gtk --disable-dssi
> --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
> --with-cpu=generic --host=x86_64-redhat-linux
> Thread model: posix
> gcc version 4.1.1 20070105 (Red Hat 4.1.1-51)
> /usr/libexec/gcc/x86_64-redhat-linux/4.1.1/f951 writeinter_gauss.f90
> -quiet -dumpbase writeinter_gauss.f90 -mtune=generic -auxbase
> writeinter_gauss -version -fconvert=big-endian -fPIC
> -fno-second-underscore -I
> /usr/lib/gcc/x86_64-redhat-linux/4.1.1/finclude -o /tmp/ccpW7Pra.s
> GNU F95 version 4.1.1 20070105 (Red Hat 4.1.1-51) (x86_64-redhat-linux)
> compiled by GNU C version 4.1.1 20070105 (Red Hat 4.1.1-51).
> GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
> as -V -Qy -o writeinter_gauss.o /tmp/ccpW7Pra.s
> GNU assembler version 2.16.91.0.6 (x86_64-redhat-linux) using BFD
> version 2.16.91.0.6 20060212
> SHARED OBJECT NAME (SharedObj): writeinter_gauss.so
> LINKER SUFFIX (ld_suffix): WRAPIT.o writeinter_gauss.o -o
> writeinter_gauss.so
> LINKING
> gcc -fPIC -shared WRAPIT.o writeinter_gauss.o -o writeinter_gauss.so
> END WRAPIT
>
>
> cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
> c STUB FOR writeinter_gauss.f90
> cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
> c
> C NCLFORTSTART
>
> subroutine writeinter(version,hdate,xfcst,mapsource,field,units,
> + desc,xlvl,nx,ny,iproj,startloc,startlat,startlon,
> + nlats,deltalon,earthradius,iswind,slab,
> + msl,sll,hdl,fol,ul,dl)
>
> integer version,nx,ny,iproj,nlats
> integer msl,sll,hdl,fol,ul,dl
>
> real xfcst
> real xlvl
> real startlat,startlon,deltalon
> real earthradius
> real slab(nx,ny)
>
> logical iswind
>
> character *(msl) mapsource
> character *(sll) startloc
> character *(fol) field
> character *(hdl) hdate
> character *(ul) units
> character *(dl) desc
>
> C NCLEND
>
> !writeinter_gauss.f90
> !ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc
> !
> subroutine writeinter(version,hdate,xfcst,mapsource,field,units,&
> desc,xlvl,nx,ny,iproj,startloc,startlat,startlon, &
> nlats,deltalon,earthradius,iswind,slab, &
> msl,sll,hdl,fol,ul,dl)
>
> IMPLICIT NONE
>
> integer :: version,nx,ny,iproj,nlats
> integer :: msl,sll,hdl,fol,ul,dl
>
> real :: xfcst
> real :: xlvl
> real :: startlat,startlon,deltalon
> real :: earthradius
> real, dimension(nx,ny) :: slab
>
> logical :: iswind
>
> character (len=msl) mapsource
> character (len=sll) startloc
> character (len=fol) field
> character (len=hdl) hdate
> character (len=ul) units
> character (len=dl) desc
>
> character (len=8) startloc2
> character (len=9) field2
> character (len=24) hdate2
> character (len=25) units2
> character (len=32) mapsource2
> character (len=46) desc2
> startloc2 = startloc
> field2 = field
> hdate2 = hdate
> units2 = units
> mapsource2 = mapsource
> desc2 = desc
>
> open(unit=10, file='fort.90', access='SEQUENTIAL', &
> form='UNFORMATTED',status='NEW')
>
> write(unit=10) version
> write(unit=10) hdate2,xfcst,mapsource2,field2,units2, &
> desc2,xlvl,nx,ny,iproj
> write(unit=10) startloc2,startlat,startlon,nlats, &
> deltalon,earthradius
> write(unit=10) iswind
> write(unit=10) slab
>
> close(unit=10)
>
> return
> end
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk_at_ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>

-- 
======================================================
Dennis J. Shea                  tel: 303-497-1361    |
P.O. Box 3000                   fax: 303-497-1333    |
Climate Analysis Section                             |
Climate & Global Dynamics Div.                       |
National Center for Atmospheric Research             |
Boulder, CO  80307                                   |
USA                        email: shea 'at' ucar.edu |
======================================================
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Mon Aug 27 2007 - 14:14:54 MDT

This archive was generated by hypermail 2.2.0 : Mon Aug 27 2007 - 14:59:53 MDT