Loading ...
Sorry, an error occurred while loading the content.

Patch proposal: Fortran syntax file: Fixed source form detection

Expand Messages
  • Hendrik Merx
    Though not standard-conforming, it is quite common to use a tab instead of six spaces in front of a Fortran fixed source form line where the first five columns
    Message 1 of 7 , Jul 9, 2010
    • 0 Attachment
      Though not standard-conforming, it is quite common to use a tab instead of six spaces in front of a Fortran fixed source form line where the first five columns are reserved for numeric labels and the sixth column indicating a continuation line. Patching fortran.vim with

      --- vim.7.2/runtime/syntax/fortran.vim 2010-05-25 00:38:43.000000000 +0200
      +++ custom/fortran.vim 2010-07-09 23:47:36.000000000 +0200
      @@ -74,7 +74,7 @@
           " Detection becomes more accurate and time-consuming if more lines
           " are checked. Increase the limit below if you keep lots of comments at
           " the very top of each file and you have a fast computer.
      -    let b:lmax = 250
      +    let b:lmax = 1024
           if ( b:lmax > line("$") )
             let b:lmax = line("$")
           endif
      @@ -82,7 +82,7 @@
           let b:ln=1
           while b:ln <= b:lmax
             let b:test = strpart(getline(b:ln),0,5)
      -      if b:test[0] !~ '[Cc*!#]' && b:test !~ '^ \+[!#]' && b:test =~ '[^ 0-9\t]'
      +      if b:test !~ '^[ 0-9]*\t' && b:test !~ '^[Cc*]' && b:test !~ '^ *[!#]' && b:test =~ '[^ 0-9\t]'
        let b:fortran_fixed_source = 0
        break
             endif

      enhances the detection heuristics to identify such tabbed lines correctly as fixed form.

      --

      hendrik merx
      hendrikmerx@...

      --
      You received this message from the "vim_dev" maillist.
      Do not top-post! Type your reply below the text you are replying to.
      For more information, visit http://www.vim.org/maillist.php
    • Hendrik Merx
      Though not standard-conforming, it is quite common to use a tab instead of six spaces in front of a Fortran fixed source form line where the first five columns
      Message 2 of 7 , Jul 12, 2010
      • 0 Attachment
        Though not standard-conforming, it is quite common to use a tab instead of six spaces in front of a Fortran fixed source form line where the first five columns are reserved for numeric labels and the sixth column indicating a continuation line. Patching fortran.vim with

        --- vim.7.2/runtime/syntax/fortran.vim 2010-05-25 00:38:43.000000000 +0200
        +++ custom/fortran.vim 2010-07-09 23:47:36.000000000 +0200
        @@ -74,7 +74,7 @@
        " Detection becomes more accurate and time-consuming if more lines
        " are checked. Increase the limit below if you keep lots of comments at
        " the very top of each file and you have a fast computer.
        - let b:lmax = 250
        + let b:lmax = 1024
        if ( b:lmax > line("$") )
        let b:lmax = line("$")
        endif
        @@ -82,7 +82,7 @@
        let b:ln=1
        while b:ln <= b:lmax
        let b:test = strpart(getline(b:ln),0,5)
        - if b:test[0] !~ '[Cc*!#]' && b:test !~ '^ \+[!#]' && b:test =~ '[^ 0-9\t]'
        + if b:test !~ '^[ 0-9]*\t' && b:test !~ '^[Cc*]' && b:test !~ '^ *[!#]' && b:test =~ '[^ 0-9\t]'
        let b:fortran_fixed_source = 0
        break
        endif

        enhances the detection heuristics to identify such tabbed lines correctly as fixed form.

        --

        hendrik merx
        hendrikmerx@...

        --
        You received this message from the "vim_dev" maillist.
        Do not top-post! Type your reply below the text you are replying to.
        For more information, visit http://www.vim.org/maillist.php
      • Tony Mechelynck
        ... [...] I thought 1-6 were the line number, and 7 was C for comment, or 1 (then 2 etc.) for continuation? Best regards, Tony. -- Q: Why did the tachyon
        Message 3 of 7 , Jul 12, 2010
        • 0 Attachment
          On 12/07/10 16:19, Hendrik Merx wrote:
          > Though not standard-conforming, it is quite common to use a tab instead of six spaces in front of a Fortran fixed source form line where the first five columns are reserved for numeric labels and the sixth column indicating a continuation line. Patching fortran.vim with
          [...]

          I thought 1-6 were the line number, and 7 was C for comment, or 1 (then
          2 etc.) for continuation?


          Best regards,
          Tony.
          --
          Q: Why did the tachyon cross the road?
          A: Because it was on the other side.

          --
          You received this message from the "vim_dev" maillist.
          Do not top-post! Type your reply below the text you are replying to.
          For more information, visit http://www.vim.org/maillist.php
        • Bram Moolenaar
          [forwarding to Ajit] ... -- FIRST GUARD: Ah! Now ... we re not allowed to ... SIR LAUNCELOT runs him through, grabs his spear and stabs the other guard who
          Message 4 of 7 , Jul 12, 2010
          • 0 Attachment
            [forwarding to Ajit]

            > Though not standard-conforming, it is quite common to use a tab instead of six spaces in front of a Fortran fixed source form line where the first five columns are reserved for numeric labels and the sixth column indicating a continuation line. Patching fortran.vim with
            >
            > --- vim.7.2/runtime/syntax/fortran.vim 2010-05-25 00:38:43.000000000 +0200
            > +++ custom/fortran.vim 2010-07-09 23:47:36.000000000 +0200
            > @@ -74,7 +74,7 @@
            > " Detection becomes more accurate and time-consuming if more lines
            > " are checked. Increase the limit below if you keep lots of comments at
            > " the very top of each file and you have a fast computer.
            > - let b:lmax = 250
            > + let b:lmax = 1024
            > if ( b:lmax > line("$") )
            > let b:lmax = line("$")
            > endif
            > @@ -82,7 +82,7 @@
            > let b:ln=1
            > while b:ln <= b:lmax
            > let b:test = strpart(getline(b:ln),0,5)
            > - if b:test[0] !~ '[Cc*!#]' && b:test !~ '^ \+[!#]' && b:test =~ '[^ 0-9\t]'
            > + if b:test !~ '^[ 0-9]*\t' && b:test !~ '^[Cc*]' && b:test !~ '^ *[!#]' && b:test =~ '[^ 0-9\t]'
            > let b:fortran_fixed_source = 0
            > break
            > endif
            >
            > enhances the detection heuristics to identify such tabbed lines correctly as fixed form.
            >
            > --
            >
            > hendrik merx
            > hendrikmerx@...

            --
            FIRST GUARD: Ah! Now ... we're not allowed to ...
            SIR LAUNCELOT runs him through, grabs his spear and stabs the other
            guard who collapses in a heap. Hiccoughs quietly.
            "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

            /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
            /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
            \\\ download, build and distribute -- http://www.A-A-P.org ///
            \\\ help me help AIDS victims -- http://ICCF-Holland.org ///

            --
            You received this message from the "vim_dev" maillist.
            Do not top-post! Type your reply below the text you are replying to.
            For more information, visit http://www.vim.org/maillist.php
          • Hendrik Merx
            Well, almost, it s columns 1 through 5 for the label which is numeric and thus resembles a line number. It isn t necessary, though, so the first five columns
            Message 5 of 7 , Jul 13, 2010
            • 0 Attachment
              Well, almost,

              it's columns 1 through 5 for the label which is numeric and thus resembles a line number. It isn't necessary, though, so the first five columns are empty for most lines.

              Comment lines have 'C' or '*' in the first column or '!' as the first character.

              Continuation lines have any character but '0' in the sixth column, so it's common to count the continuation lines by putting single digits in column 6.

              Statements occupy columns 7 to 72, leaving eight characters for a line number on a 80 character punched card. Most, if not all compilers allow more than that.

              And, to quote from Annex B 2.6 on obsolescent features of the Fortran 2003 standard:

              Fixed form source was designed when the principal machine-readable input medium for new programs was punched cards. Now that new and amended programs are generally entered via keyboards with screen displays, it is an unnecessary overhead, and is potentially error-prone, to have to locate positions 6, 7, or 72 on a line. Free form source was designed expressly for this more modern technology.

              Cheers

              Hendrik

              On Jul 12, 2010, at 16-53, Tony Mechelynck wrote:

              > On 12/07/10 16:19, Hendrik Merx wrote:
              >> Though not standard-conforming, it is quite common to use a tab instead of six spaces in front of a Fortran fixed source form line where the first five columns are reserved for numeric labels and the sixth column indicating a continuation line. Patching fortran.vim with
              > [...]
              >
              > I thought 1-6 were the line number, and 7 was C for comment, or 1 (then 2 etc.) for continuation?
              >
              >
              > Best regards,
              > Tony.
              > --
              > Q: Why did the tachyon cross the road?
              > A: Because it was on the other side.

              --
              You received this message from the "vim_dev" maillist.
              Do not top-post! Type your reply below the text you are replying to.
              For more information, visit http://www.vim.org/maillist.php
            • Tony Mechelynck
              ... I see. Wwell, I did some FORTRAN as a freshman in 1967-68 (using Hollerith cards) and never since then: it s been a long time. Best regards, Tony. -- A
              Message 6 of 7 , Jul 13, 2010
              • 0 Attachment
                On 13/07/10 13:46, Hendrik Merx wrote:
                > Well, almost,
                >
                > it's columns 1 through 5 for the label which is numeric and thus resembles a line number. It isn't necessary, though, so the first five columns are empty for most lines.
                >
                > Comment lines have 'C' or '*' in the first column or '!' as the first character.
                >
                > Continuation lines have any character but '0' in the sixth column, so it's common to count the continuation lines by putting single digits in column 6.
                >
                > Statements occupy columns 7 to 72, leaving eight characters for a line number on a 80 character punched card. Most, if not all compilers allow more than that.
                >
                > And, to quote from Annex B 2.6 on obsolescent features of the Fortran 2003 standard:
                >
                > Fixed form source was designed when the principal machine-readable input medium for new programs was punched cards. Now that new and amended programs are generally entered via keyboards with screen displays, it is an unnecessary overhead, and is potentially error-prone, to have to locate positions 6, 7, or 72 on a line. Free form source was designed expressly for this more modern technology.
                >
                > Cheers
                >
                > Hendrik

                I see. Wwell, I did some FORTRAN as a freshman in 1967-68 (using
                Hollerith cards) and never since then: it's been a long time.


                Best regards,
                Tony.
                --
                A novice was trying to fix a broken Lisp machine by turning the power
                off and on. Knight, seeing what the student was doing spoke sternly:
                "You can not fix a machine by just power-cycling it with no
                understanding of what is going wrong." Knight turned the machine off
                and on. The machine worked.

                --
                You received this message from the "vim_dev" maillist.
                Do not top-post! Type your reply below the text you are replying to.
                For more information, visit http://www.vim.org/maillist.php
              • Ajit Thakkar
                Hendrik You ll find a new version of the syntax file attached. It will be in vim 7.3 Ajit ... -- You received this message from the vim_dev maillist. Do not
                Message 7 of 7 , Jul 24, 2010
                • 0 Attachment
                  Hendrik

                  You'll find a new version of the syntax file attached. It will be in vim 7.3

                  Ajit

                  On Fri, Jul 9, 2010 at 7:17 PM, Hendrik Merx <hendrikmerx@...> wrote:
                  > Though not standard-conforming, it is quite common to use a tab instead of
                  > six spaces in front of a Fortran fixed source form line where the first five
                  > columns are reserved for numeric labels and the sixth column indicating a
                  > continuation line. Patching fortran.vim with
                  > --- vim.7.2/runtime/syntax/fortran.vim 2010-05-25 00:38:43.000000000 +0200
                  > +++ custom/fortran.vim 2010-07-09 23:47:36.000000000 +0200
                  > @@ -74,7 +74,7 @@
                  >      " Detection becomes more accurate and time-consuming if more lines
                  >      " are checked. Increase the limit below if you keep lots of comments at
                  >      " the very top of each file and you have a fast computer.
                  > -    let b:lmax = 250
                  > +    let b:lmax = 1024
                  >      if ( b:lmax > line("$") )
                  >        let b:lmax = line("$")
                  >      endif
                  > @@ -82,7 +82,7 @@
                  >      let b:ln=1
                  >      while b:ln <= b:lmax
                  >        let b:test = strpart(getline(b:ln),0,5)
                  > -      if b:test[0] !~ '[Cc*!#]' && b:test !~ '^ \+[!#]' && b:test =~ '[^
                  > 0-9\t]'
                  > +      if b:test !~ '^[ 0-9]*\t' && b:test !~ '^[Cc*]' && b:test !~ '^
                  > *[!#]' && b:test =~ '[^ 0-9\t]'
                  >   let b:fortran_fixed_source = 0
                  >   break
                  >        endif
                  > enhances the detection heuristics to identify such tabbed lines correctly as
                  > fixed form.
                  > --
                  > hendrik merx
                  > hendrikmerx@...
                  >
                  > --
                  > You received this message from the "vim_dev" maillist.
                  > Do not top-post! Type your reply below the text you are replying to.
                  > For more information, visit http://www.vim.org/maillist.php
                  >

                  --
                  You received this message from the "vim_dev" maillist.
                  Do not top-post! Type your reply below the text you are replying to.
                  For more information, visit http://www.vim.org/maillist.php
                Your message has been successfully submitted and would be delivered to recipients shortly.