From: Alan W. I. <ir...@be...> - 2013-10-30 00:22:32
|
On 2013-10-29 21:59-0000 James Tappin wrote: > It appears that in the Fortran 95 binding in 5.9.10, the font setting > constants (PL_FCI_SANS etc.) have become variables. In > bindings/f95/plplot_parameters.h we now have > > integer :: PL_FCI_SANS > data PL_FCI_SANS / z'0' / > in place of > > integer, parameter :: PL_FCI_SANS = z'0' > > Which cannot be used in a data initialization such as: > > integer, parameter, dimension(*) :: font_list = [PL_FCI_SANS, > PL_FCI_SERIF, & > & PL_FCI_MONO, PL_FCI_SCRIPT, PL_FCI_SYMBOL] > > Is there a good reason for this or is it a regression? bindings/f95/plplot_parameters.h is generated automatically by a sed script that has been deliberately designed to create two styles in the results. One of those styles is the data style that you don't like, and the other the parameter style you prefer. The script uses the data style for all hexadecimal (e.g., z'0') constants and the parameter style for all normal integers. What happened in the above change was that we changed to hexadecimal constants for all bit fields in our API. All such data are powers of two so the hexadecimal form is a lot easier to understand. Of course, the important question s why we support two styles in that sed script? I am sure we did that deliberately with the motivation of wanting to support a wide range of Fortran compilers. In other words we were worried that some of them might complain about integer, parameter :: PL_FCI_SANS = z'0' but the data form that we use now should work for all of them. The gfortran info documentation says something about this. <quote> Up to Fortran 95, BOZ literals [i.e., constants started with b', o', or z'] were only allowed to initialize integer variables in DATA statements. Since Fortran 2003 BOZ literals are also allowed as argument of REAL', DBLE', INT' and CMPLX'; the result is the same as if the integer BOZ literal had been converted by TRANSFER' to, respectively, real', double precision', integer' or complex'. As GNU Fortran extension the intrinsic procedures FLOAT', DFLOAT', COMPLEX' and DCMPLX' are treated alike. </quote> They then go on to say they support BOZ constants generally as an extension to the Fortran standards prior to Fortran 2003. So I assume the above statement would work with gfortran, but because of the uncertainty about whether it would work with other fortran compilers we went with the conservative approach of sticking with the data style for BOZ constants. @Arjen: are we being too cautious here? I note from http://gcc.gnu.org/wiki/Fortran2003 that gfortran already has almost complete support for Fortran 2003 (and certainly the general BOZ support), and I wonder if other fortran compilers are typically also compliant with Fortran 2003, at least to the extent of general support for integer parameter style above for BOZ constants? Alan __________________________ Alan W. Irwin Astronomical research affiliation with Department of Physics and Astronomy, University of Victoria (astrowww.phys.uvic.ca). Programming affiliations with the FreeEOS equation-of-state implementation for stellar interiors (freeeos.sf.net); the Time Ephemerides project (timeephem.sf.net); PLplot scientific plotting software package (plplot.sf.net); the libLASi project (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); and the Linux Brochure Project (lbproject.sf.net). __________________________ Linux-powered Science __________________________ |