most users most of the time because fortran 95 is a

Upload: wenederetpo

Post on 30-May-2018

218 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    1/28

    Default highlighting and dialect ~

    Highlighting appropriate for f95 (Fortran 95) is used by default. This choice

    should be appropriate for most users most of the time because Fortran 95 is a

    superset of Fortran 90 and almost a superset of Fortran 77.

    Fortran source code form ~

    Fortran 9x code can be in either fixed or free source form. Note that thesyntax highlighting will not be correct if the form is incorrectly set.

    When you create a new fortran file, the syntax script assumes fixed sourceform. If you always use free source form, then >

    :let fortran_free_source=1

    in your .vimrc prior to the :syntax on command. If you always use fixed source

    form, then >:let fortran_fixed_source=1

    in your .vimrc prior to the :syntax on command.

    If the form of the source code depends upon the file extension, then it is

    most convenient to set fortran_free_source in a ftplugin file. For more

    information on ftplugin files, see |ftplugin|. For example, if all yourfortran files with an .f90 extension are written in free source form and the

    rest in fixed source form, add the following code to your ftplugin file >

    let s:extfname = expand("%:e")if s:extfname ==? "f90"

    let fortran_free_source=1

    unlet! fortran_fixed_source

    elselet fortran_fixed_source=1

    unlet! fortran_free_source

    endifNote that this will work only if the "filetype plugin indent on" command

    precedes the "syntax on" command in your .vimrc file.

    When you edit an existing fortran file, the syntax script will assume free

    source form if the fortran_free_source variable has been set, and assumes fixed

    source form if the fortran_fixed_source variable has been set. If neither of

    these variables have been set, the syntax script attempts to determine whichsource form has been used by examining the first five columns of the first 250

    lines of your file. If no signs of free source form are detected, then the file

    is assumed to be in fixed source form. The algorithm should work in the vastmajority of cases. In some cases, such as a file that begins with 250 or more

    full-line comments, the script may incorrectly decide that the fortran code is

    in fixed form. If that happens, just add a non-comment statement beginninganywhere in the first five columns of the first twenty five lines, save (:w) and

    then reload (:e!) the file.

    Tabs in fortran files ~

    Tabs are not recognized by the Fortran standards. Tabs are not a good idea in

    fixed format fortran source code which requires fixed column boundaries.

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    2/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    3/28

    source form will be assumed.

    If you use elf90 or F, the advantage of setting the dialect appropriately is

    that f90 features excluded from these dialects will be highlighted as todoitems and that free source form will be assumed as required for these

    dialects.

    The dialect can be selected by setting the variable fortran_dialect. The

    permissible values of fortran_dialect are case-sensitive and must be "f95",

    "f90", "f77", "elf" or "F". Invalid values of fortran_dialect are ignored.

    If all your fortran files use the same dialect, set fortran_dialect in your

    .vimrc prior to your syntax on statement. If the dialect depends upon the file

    extension, then it is most convenient to set it in a ftplugin file. For moreinformation on ftplugin files, see |ftplugin|. For example, if all your

    fortran files with an .f90 extension are written in the elf subset, your

    ftplugin file should contain the code >

    let s:extfname = expand("%:e")

    if s:extfname ==? "f90"

    let fortran_dialect="elf"else

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    4/28

    unlet! fortran_dialect

    endif

    Note that this will work only if the "filetype plugin indent on" command

    precedes the "syntax on" command in your .vimrc file.

    Finer control is necessary if the file extension does not uniquely identify

    the dialect. You can override the default dialect, on a file-by-file basis, byincluding a comment with the directive "fortran_dialect=xx" (where xx=f77 or

    elf or F or f90 or f95) in one of the first three lines in your file. For

    example, your older .f files may be written in extended f77 but your newerones may be F codes, and you would identify the latter by including in the

    first three lines of those files a Fortran comment of the form >

    ! fortran_dialect=F

    F overrides elf if both directives are present.

    Limitations ~

    Parenthesis checking does not catch too few closing parentheses. Hollerithstrings are not recognized. Some keywords may be highlighted incorrectly

    because Fortran90 has no reserved words.

    For further information related to fortran, see |fortran-indent| and

    |fortran-plugin|.

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    5/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    6/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    7/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    8/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    9/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    10/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    11/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    12/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    13/28

    Baby 01

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    14/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    15/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    16/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    17/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    18/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    19/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    20/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    21/28

    Baby 01

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    22/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    23/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    24/28

    Baby 01

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    25/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    26/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    27/28

  • 8/9/2019 Most Users Most of the Time Because Fortran 95 is A

    28/28

    Baby 01