0

次のサブルーチンがあります。これは 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でコンパイルする方法はありますか?

4

1 に答える 1

3

標準準拠プログラムの行には、自由ソース形式で最大 132 文字を含めることができます。最初のエラーは、より長い行を指しています (私はこの最初のエラーを見過ごしていませんでした)。その時点で線が途切れてしまい、ステートメントが意味をなさなくなります。

どうやら Intel Fortran はデフォルトでこのように非準拠のプログラムを受け入れますが、gfortran はデフォルトで標準の行の長さに準拠しています。オプション を使用すると、gfortran に長い行を受け入れるようにさせることができます-ffree-line-length-nマニュアルから:

-ffree-line-length-n

ソース ファイルの一般的な自由形式の行で、その後の文字が無視される列を設定します。デフォルト値は 132 です。n は 'none' の場合があり、行全体が意味を持つことを意味します。-ffree-line-length-0 は -ffree-line-length-none と同じ意味です。

于 2013-04-17T17:45:30.120 に答える