[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 950823: can you help?



>Organization: LLNL
>Keywords: 199508232225.AA19533

Hi Tony,

You forwarded this note from Gayle Sugiyama, who I am CC:ing on this reply.

>   /usr/llnl.sgi/bin/ncgen gives an error message. Here are hopefully
> enough details. In /u/sugiyama/tmp there is a file sigma.cdl
> 
> On DIAG (SunOS) I ran (/usr/local/bin/ncgen)
>     ncgen -o sigma.sun.nc -f sigma.cdl > ! sigma_gtx.sun.f
> which produced sigma.sun.nc and sigma_gtx.sun.f (fortran code) file.
> 
> On anvil (SGI) I ran the same command (/usr/llnl.sgi/bin/ncgen)
>    ncgen -o sigma.sgi.nc -f sigma.cdl > ! sigma_gtx.sgi.f
> but get an error message in sigma_gtx.sgi.f
>    Input string too long, limit 200
> and do not produce a sigma.sgi.nc file.

Some of the code for ncgen is generated by lex and yacc, and that is where
this error message comes from.  Specifically, lex generates a parser that
has a limited input line size, and that limit is platform-dependent.  On our
Sun systems, it is the same as BUFSIZ from /usr/include/stdio.h, which is
1024, but lex may use a smaller value on other platforms.

Here are some possible workarounds:

 1.  Make sure the lines in sigma.cdl don't exceed 200 characters.  String
     constants can be "continued" by breaking them into smaller string
     constants that get concatenated by ncgen, e.g.
        st = "abcdefgh";
     can be replaced by
        st = "abcd",
             "efgh";
     in a CDL file to get shorter lines.  Another way to get shorter lines
     is to use ncgen with ncdump to "canonicalize" the CDL input, e.g.:
        mv sigma.cdl sigma.cdl.bak
        ncgen -b -o sigma.nc sigma.cdl.bak
        ncdump -l 100 sigma.nc > sigma.cdl
     and the new sigma.cdl should have lines less than 100 characters long.

 2.  Remake ncgen by using the ncgenyy.c generated by lex on a different
     platform that provides longer input lines.  For example, do "make
     clean all" in the ncgen source directory on a Sun, copy the resulting
     ncgenyy.c (generated by lex) and ncgentab.h and ncgentab.c (generated
     by yacc) to an ncgen source directory on the problem platform, and do
     "make all".  This should produce an ncgen with the longer input line
     lengths on the problem platform.

 3.  Remake ncgen on the problem platform by editing ncgenyy.c, increasing
     the input limit size, which is probably defined in a variable named
     YYLMAX (though this may vary on different platforms).  You can tell
     what the variable is by looking for the "Input string too long, ..."
     error message.

______________________________________________________________________________

Russ Rew                                           UCAR Unidata Program
address@hidden                              http://www.unidata.ucar.edu