[ncl-talk] Fortran77 array declaration and colons

Michael Toy toy at ucar.edu
Thu May 24 08:42:24 MDT 2018


Hi Dennis,

After successfully creating the *.so file with WRAPIT and having it load properly in NCL with the command ‘ external GWDO “./module_bl_gwdo_gsd.so” ‘, when I try to call the subroutine “gwdo_gsd_F77” from NCL using the command ‘ GWDO::gwdo_gsd_F77(76 arguments) ‘, I get the following error message:
fatal:syntax error: procedure gwdo_gsd_F77 is not defined in package GWDO

Is there a way to query “GWDO” to see what subroutines it supposedly contains?

Thanks.

— Mike



> On May 17, 2018, at 5:04 PM, Dennis Shea <shea at ucar.edu> wrote:
> 
> Hi Mike/Barry,
> 
> I asked one of the core NCL developers [Rick Brownrigg; cc'd] to help with what I could not see [literally]. He responded with two messages:
> ---
> [1]
> All I know at this point is that it occurs with this line:
> 
> $NCARG_ROOT/bin/wrapit77 < WRAPIT.stub >! WRAPIT.c
> 
> wrapit77 is a C program with a full lex/yacc grammar, and the error message originates out of the grammar parsing code. Beyond that, I haven't been able to determine why, just yet.  Looking at the contents of WRAPIT.stuib, there's nothing that stands out.
> 
> [2] 
> OK, it appears the issue is that the original fortran code contains carriage-return/newline delimiters, and wrapit77's grammar does not expect that. Things appear to work if I strip those out:
> 
> cat test.NCL.f | sed 's/\r$//' | cat >testNCL_noCR.f
> ---
> NOTE: the above does not seem to work with the MacOS.
> 
> It had to rune on a 'real linux box'
> 
> So .... NCL itself handles carriage returns and new line characters **BUT** the "full lex/yacc grammar ..." WRAPIT does not. 
> 
> %> WRAPIT module_bl_gwdo_gsd.f90 testNCL_noCR.f
>  
> WRAPIT Version: 120209
> COMPILING module_bl_gwdo_gsd.f90
> COMPILING testNCL_noCR.f
> LINKING
> END WRAPIT
> 
> ===
> I am the messenger. Rick did the real work.
> 
> D
> 
> On Wed, May 16, 2018 at 10:28 PM, Dennis Shea <shea at ucar.edu <mailto:shea at ucar.edu>> wrote:
> [A]
> 
> (0:1,0:1,0:1) is legal f77 & f90
> 
> WRAPIT is not a full fortran language parser. It is not very sophisticated. It does not understand this syntax.
> 
> [B]
> 
> Again, we must do the "end-around". 
> 
> I added 'imsime', 'jmsjme', 'kmskme'
> 
> to the argument list and the declarations.
> 
> Where the quantities are:
> 
>    imsime   =  ime-ims+1
>    jmsjme   =  jme-jms+1
>    kmskme =  kme-kms+1
> 
> --------
> 
> %> gfortran -c module_bl_gwdo_gsd.f90 test.NCL.f
> 
> works fine.
> 
> Unfortunately, 
> 
> %> WRAPIT module_bl_gwdo_gsd.f90 test.NCL.f
> 
> WRAPIT Version: 120209
> A syntax error occurred while parsing: 
> COMPILING module_bl_gwdo_gsd.f90
> COMPILING test.NCL.f
> LINKING
> END WRAPIT
> 
> I'll look again tomorrow but it is late!
> 
> D
> 
> 
> On Wed, May 16, 2018 at 6:15 AM, Dennis Shea <shea at ucar.edu <mailto:shea at ucar.edu>> wrote:
> Hi, Michael, Barry, 
> 
> I hope to look at this later today.
> 
> D
> 
> On Tue, May 15, 2018 at 11:14 AM, Michael Toy <toy at ucar.edu <mailto:toy at ucar.edu>> wrote:
> Hi Dennis and Barry,
> 
> I think narrowed my issue with WRAPIT and the "A syntax error occurred while parsing: :” error message I’m getting to declaring arrays in F77 in which the indices are not the standard 1..N arrangement.  For the simple stub below, I get the error message:
> 
> C NCLFORTSTART
>       subroutine print_array(x)
>       implicit none
>       real x( 0:1, 0:1, 0:1 )
> C NCLEND
> 
> However, if I change the declaration line to:
>       real x ( 2, 2, 2 )
> 
> It compiles fine.
> 
> I’ve looked up some documentation on Fortran77, and it looks the (0:1,0:1,0:1) declaration should work.  Is this not legal F77 syntax?
> 
> Thanks.
> 
> — Mike
> 
> 
> 
> 
> <testNCL_noCR.f><module_bl_gwdo_gsd.f90>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180524/997dd2fa/attachment.html>


More information about the ncl-talk mailing list