gfortran,未定义的无法分类的语句和格式标签

时间:2013-04-17 16:55:12

标签: fortran fortran90 gfortran

我有以下子程序,它使用intel fortran编译器编译,但不使用gfortran编译。这是子程序代码:

subroutine makepar
!----------------------------------------------------------------------
!                       WRITE A PARAMETER FILE                         
!----------------------------------------------------------------------
    integer, parameter :: lun=99
    open(lun,file='pixelplt2008.par',status='UNKNOWN')
    write(lun,10)
10  format(  &
    '',/, &
    '',/, &
    '                  Parameters for PIXELPLT2008',/, &
    '                  ***********************',/, &
    '',/, &
    'START OF PARAMETERS:',/, &
    'kb2d.out              -file with gridded data',/, &
    '1                     -column number for variable',/, &
    '-998  1.0e21          -data trimming limits',/, &
    'data.out              -file with data to plot',/, &
    '0 2 3 4 5 8.0         -columns for point id or label, x,y,z coords, variable, symbol size',/, &
    '0 10000               -xmin, xmax limits to plot if no grid file is plotted (limits taken from grid if a grid is plotted)',/, &
    '0 10000               -ymin, ymax limits to plot if no grid file is plotted (limits taken from grid if a grid is plotted)',/, &
    'poly.out              -file containing a polygon to trim grid within (data are not trimmed)',/, &
    '1 2 1 3.0             -columns for x and y coords, plot option (1=yes), lineweight for polygon',/, &
    '0 0 0.0 0.0 0 0       -background grid x and y spacing (0=dont plot the background grid), start x and y, azimuth, ticks around plot (1=yes)',/, &
    'pixelplt.ps           -file with PostScript output',/, &
    '1                     -realization number',/, &
    '100   50   100        -nx,xmn,xsiz',/, &
    '100   50   100        -ny,ymn,ysiz',/, &
    '1   .5   1            -nz, zmn, zsiz',/, &
    '1                     -vertical exageration (1=no exageration)',/, &
    '1                     -slice orientation: 1=XY, 2=XZ, 3=YZ  (set to -1,-2 or -3 to skip drawing the color bar)',/, &
    '1 -1.3                -slice number,tol: point data require a tol (i.e. plot +/- 1.3m from the center of the plotted slice) neg=plot all points',/, &
    'Porosity Well Data    -title ',/, &
    'East                  -X label',/, &
    'North                 -Y label',/, &
    '0                     -brightness of background(0=no change, 1=very bright, -1=very dark)',/, &
    '0                     -0=arithmetic, 1=log scaling',/, &
    '',/, &
    '',/, &
    'COLORBAR JET 2 16 5   -COLORBAR, keyword, type, min, max, number of labels (See below for how to plot custom or categorical)',/, &
    '0 0 0                 -rotate color bar (1=yes), xpos, ypos of color bar (+/- from the default positions)',/, &
    '0 3                   -type: 0=continuous 1=categorical, #of steps (type COLORBAR CUSTOM 5 above to use categorical or custom color bar)',/, &
    '7  2  Low             -colorcode, value OR category, label',/, &
    '9  8  Mid             -colorcode, value OR category, label',/, &
    '1  16 High            -colorcode, value OR category, label',/, &
    '',/, &
    '----------------------------------------------------------------------------',/, &
    '-EVERYTHING BELOW THIS LINE CAN BE REMOVED TO MAKE THE PAR FILE SHORTER!!!!!',/, &
    '----------------------------------------------------------------------------',/, &
    '',/, &
    'ADVANCED OPTIONS:  Dont change if you want to ignore',/, &
    '',/, &
    'CHANGE SHAPE OF DATA',/, &
    '1                        -0=use shape file, 1=all points plotted as circles, 2=squares, 3=triangles',/, &
    'data.out                 -file with indicators for which data are plotted as (circles 1, squares 2, triangles 3)',/, &
    '11                       -column for the indicators',/, &
    '0                        -plot a legend for these shapes (1=yes)',/, &
    '0 0                      -xpos, ypos of legend (+/- from the default position which is directly below the color bar)',/, &
    '1 0 1                    -include the circles, squares, triangels in the legend? (1=yes)',/, &
    'Well Data                -label for the circles',/, &
    'none                     -label for the squares',/, &
    'Clustered Data           -label for the triangles',/, &
    '',/, &
    'ADDITIONAL FILE:',/, &
    '0                        -option to paste a background grid from another file (1=yes)',/, &
    'outline.ps               -will write this file out on top of the grid, but below the data',/, &
    '',/, &
    '',/, &
    '--------------------------------------------------------------------------------------------------------------------',/, &
    '--------------------------------------------------------------------------------------------------------------------',/, &
    'Color Codes Plotting:',/, &
    '      1=red, 2=orange, 3=yellow, 4=light green, 5=green, 6=light blue,',/, &
    '      7=dark blue, 8=violet, 9=white, 10=black, 11=purple, 12=brown,',/, &
    '      13=pink, 14=intermediate green, 15=gray',/, &
    '',/, &
    'Colorbar usage',/, &
    '  Built in types specify: COLORBAR TYPE MIN MAX  NUMBER Of LABELS',/, &
    '  TYPE: HOT, JET, HSV, GRAY, COPPER, PINK',/, &
    '',/, &
    '  To use a custom color bar specify: COLORBAR CUSTOM NUMBER OF LABELS  and specify continous cutoffs below',/, &
    '  To use a categorical color bar specify: COLORBAR CUSTOM NUMBER OF LABELS  and specify categories below',/, &
    '',/, &
    '',/, &
    'Polygon',/, &
    '',/, &
    '  Trimming: if a polygon is input, the pixelplt will be trimmed inside it.',/, &
    '  Plot option: If set to 1, the trimming polygon will be plotted.',/, &
    '  Lineweight: light (1.0) to heavy (6.0)',/, &
    '  Set one of the column numbers to zero for no polygon or input a data file',/, &
    '    that does not exist.',/, &
    '',/, &
    'Background Grid',/, &
    '  Start Position: If no start x,y position, the grid defaults to the minimum of the pixelplt.',/, &
    '  Azimuth: Align the grid along an input azimuth angle in degrees',/, &
    '  Set spacing to zero for no background grid.',/, &
    '',/, &
    'Brightness Scaling',/, &
    '  May get an artifact if color is completly black',/, &
    '  Data that are overlayed on the background map are not dimmed or brightened so that they',/, &
    '  stand out over the background.',/, &
    '',/, &
    '',/, &
    '',/, &
    '',/, &
    '',/, &
    '',/, &
    '',/, &
    '',/)

    close(lun)
end subroutine makepar

此代码给出了以下错误:

 In file pixelplt2008.f90:1330

ound
    1
Error: Unexpected end of format string in format string at (1)
 In file pixelplt2008.f90:1331

    'pixelplt.ps           -file with PostScript output',/, &
   1
Error: Unclassifiable statement at (1)
 In file pixelplt2008.f90:1339

    'Porosity Well Data    -title ',/, &
   1
Error: Unclassifiable statement at (1)
 In file pixelplt2008.f90:1347

    '0 0 0                 -rotate color bar (1=yes), xpos, ypos of color bar (
   1
Error: Unclassifiable statement at (1)
 In file pixelplt2008.f90:1349

    '7  2  Low             -colorcode, value OR category, label',/, &
   1
Error: Unclassifiable statement at (1)
 In file pixelplt2008.f90:1313

    write(lun,10)
               1
Error: FORMAT label 10 at (1) not defined

我有什么想法可以用gfortran编译它?

1 个答案:

答案 0 :(得分:3)

标准符合程序中的一行最多可以包含132个字符,采用自由格式。第一个错误指向长度较长的行(我没有看过第一个错误)。该线在此时被切断,然后声明没有意义。

显然,英特尔Fortran默认接受以这种方式不符合的程序,而默认情况下gfortran遵循标准行长。你可以通过选项-ffree-line-length-n让gfortran接受更长的行。来自manual

  

-ffree-line-length-n

     

设置列,在该列中,在源文件中的典型自由格式行中忽略字符。默认值为132.n可能为“none”,表示整行有意义。 -ffree-line-length-0表示与-ffree-line-length-none相同的内容。