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

Patch 6.2.138 (extra)

Expand Messages
  • Bram Moolenaar
    Patch 6.2.138 (extra) Problem: Compilation problem on VMS with dynamic buffer on the stack. Solution: Read one byte less than the size of the buffer, so
    Message 1 of 4 , Oct 29, 2003
      Patch 6.2.138 (extra)
      Problem: Compilation problem on VMS with dynamic buffer on the stack.
      Solution: Read one byte less than the size of the buffer, so that we can
      check for the string length without an extra buffer.
      Files: src/os_vms.c


      *** ../vim-6.2.137/src/os_vms.c Sun May 4 22:44:43 2003
      --- src/os_vms.c Mon Oct 20 20:00:01 2003
      ***************
      *** 299,305 ****
      int
      vms_read(char *inbuf, size_t nbytes)
      {
      - char ibuf[nbytes];
      int status, function, len;
      float wait = 0.05;
      TT_MODE tt_mode;
      --- 298,303 ----
      ***************
      *** 309,325 ****
      tt_mode = get_tty();

      function = (IO$_READLBLK | IO$M_NOECHO | IO$M_TIMED | IO$M_ESCAPE);
      ! memset(ibuf, 0, sizeof(ibuf));

      while (1)
      {
      ! status = sys$qiow(0,iochan,function,&iosb,0,0,&ibuf,nbytes,0,0,0,0);
      ! len = strlen(ibuf);
      if (len > 0)
      - {
      - mch_memmove(inbuf, ibuf, len);
      break;
      - }
      lib$wait(&wait);
      }
      return len;
      --- 307,320 ----
      tt_mode = get_tty();

      function = (IO$_READLBLK | IO$M_NOECHO | IO$M_TIMED | IO$M_ESCAPE);
      ! memset(inbuf, 0, nbytes);

      while (1)
      {
      ! status = sys$qiow(0,iochan,function,&iosb,0,0,inbuf,nbytes-1,0,0,0,0);
      ! len = strlen(inbuf);
      if (len > 0)
      break;
      lib$wait(&wait);
      }
      return len;
      *** ../vim-6.2.137/src/version.c Wed Oct 29 14:37:09 2003
      --- src/version.c Wed Oct 29 14:38:52 2003
      ***************
      *** 639,640 ****
      --- 639,642 ----
      { /* Add new patch number below this line */
      + /**/
      + 138,
      /**/

      --
      Q: How do you tell the difference between a female cat and a male cat?
      A: You ask it a question and if HE answers, it's a male but, if SHE
      answers, it's a female.

      /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
      /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
      \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
      \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
    • Walter Briscoe
      In message of Wed, 29 Oct 2003 14:40:50 in , Bram Moolenaar writes ... I was not aware that a
      Message 2 of 4 , Oct 29, 2003
        In message <200310291340.h9TDeo4L031126@...> of Wed, 29 Oct
        2003 14:40:50 in , Bram Moolenaar <Bram@...> writes
        >
        >Patch 6.2.138 (extra)
        >Problem: Compilation problem on VMS with dynamic buffer on the stack.
        >Solution: Read one byte less than the size of the buffer, so that we can
        > check for the string length without an extra buffer.
        >Files: src/os_vms.c

        I was not aware that a fix to this problem was urgent. It had lurked
        without a fix for several months. I posted a file to the OP for testing
        yesterday. When I get feedback, I will pass it on. My best thoughts
        follow. Jim, please note that I have made the variable wait const as a
        change to the work I sent yesterday. Please apply it.
        Bram, the OP does not have patch and I view his willingness to test the
        work as good for ham and good for us. I also found attachments caused
        problems. I let this slide awaiting a response.
        C:\wfb\vim\bld\vim62\src) sed 298,340!d os_vms.c
        int
        vms_read(char *inbuf, size_t nbytes)
        {
        static unsigned const function = (IO$_READLBLK | IO$M_NOECHO | IO$M_TIMED | IO$M_ESCAPE);
        static float const wait = 0.05;

        /* whatever happened earlier we need an iochan here */
        if (!iochan)
        (void)get_tty();

        /*
        * 20031016 Found 1985 Programming VMS course notes. W.Briscoe
        * sys$qiow parameters are
        * P1 Starting address of buffer to receive data
        * P2 Size of buffer to receive data
        * P3 Timeout count (seconds) when IO$M_TIMED used
        * P4, P5, P6 unused
        *
        * After $qio, iosb[0] takes values
        * SS$_NORMAL nbytes available
        * SS$_TIMEOUT 0 or more bytes available
        * otherwise - something horrible
        *
        */
        /* Poll for input with 0.05 second interval */
        while (sys$qiow(0,iochan,function,iosb,0,0,&inbuf,nbytes,0,0,0,0) == 1)
        {
        switch (iosb[0])
        {
        case SS$_TIMEOUT:
        if (iosb[1] == 0)
        {
        lib$wait(&wait);
        break;
        }
        /* fall through */
        case SS$_NORMAL:
        return iosb[1];
        default:
        lib$signal(iosb[0]); /* Let system deal with signal */
        }
        }
        }
        --
        Walter Briscoe
      • Bram Moolenaar
        ... I am aware of your alternate solution. But it uses different mechanisms that I don t understand. It would require much more testing on various systems.
        Message 3 of 4 , Oct 30, 2003
          Walter Briscoe wrote:

          > In message <200310291340.h9TDeo4L031126@...> of Wed, 29 Oct
          > 2003 14:40:50 in , Bram Moolenaar <Bram@...> writes
          > >
          > >Patch 6.2.138 (extra)
          > >Problem: Compilation problem on VMS with dynamic buffer on the stack.
          > >Solution: Read one byte less than the size of the buffer, so that we can
          > > check for the string length without an extra buffer.
          > >Files: src/os_vms.c
          >
          > I was not aware that a fix to this problem was urgent. It had lurked
          > without a fix for several months. I posted a file to the OP for testing
          > yesterday. When I get feedback, I will pass it on. My best thoughts
          > follow. Jim, please note that I have made the variable wait const as a
          > change to the work I sent yesterday. Please apply it.
          > Bram, the OP does not have patch and I view his willingness to test the
          > work as good for ham and good for us. I also found attachments caused
          > problems. I let this slide awaiting a response.

          I am aware of your alternate solution. But it uses different mechanisms
          that I don't understand. It would require much more testing on various
          systems. After all, the original problem was that the code worked fine
          on one system and didn't compile on another.

          The solution in patch 6.2.138 is straightforward and has been tested.
          If there is no problem with this code I don't see a good reason to
          change it again.

          --
          ARTHUR: Charge!
          [They all charge with swords drawn towards the RABBIT. A tremendous twenty
          second fight with Peckinpahish shots and borrowing heavily also on the
          Kung Fu and karate-type films ensues, in which some four KNIGHTS are
          comprehensively killed.]
          ARTHUR: Run away! Run away!
          "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

          /// Bram Moolenaar -- Bram@... -- http://www.Moolenaar.net \\\
          /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\
          \\\ Project leader for A-A-P -- http://www.A-A-P.org ///
          \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html ///
        • Walter Briscoe
          In message of Thu, 30 Oct 2003 12:15:29 in , Bram Moolenaar writes [snip] ... That suits me.
          Message 4 of 4 , Oct 30, 2003
            In message <200310301115.h9UBFTAw001106@...> of Thu, 30 Oct
            2003 12:15:29 in , Bram Moolenaar <Bram@...> writes

            [snip]

            >I am aware of your alternate solution. But it uses different mechanisms
            >that I don't understand. It would require much more testing on various
            >systems. After all, the original problem was that the code worked fine
            >on one system and didn't compile on another.
            >
            >The solution in patch 6.2.138 is straightforward and has been tested.
            >If there is no problem with this code I don't see a good reason to
            >change it again.
            >

            That suits me. Jim, does the following fix vim for you? I am afraid you
            will have to apply it by hand as you lack a patch program. Start at the
            bottom of the patch and work upwards. If this is too much, let me know
            privately and I will email it to you.

            Patch 6.2.138 (extra)
            Problem: Compilation problem on VMS with dynamic buffer on the stack.
            Solution: Read one byte less than the size of the buffer, so that we can
            check for the string length without an extra buffer.
            Files: src/os_vms.c


            *** ../vim-6.2.137/src/os_vms.c Sun May 4 22:44:43 2003
            --- src/os_vms.c Mon Oct 20 20:00:01 2003
            ***************
            *** 299,305 ****
            int
            vms_read(char *inbuf, size_t nbytes)
            {
            - char ibuf[nbytes];
            int status, function, len;
            float wait = 0.05;
            TT_MODE tt_mode;
            --- 298,303 ----
            ***************
            *** 309,325 ****
            tt_mode = get_tty();

            function = (IO$_READLBLK | IO$M_NOECHO | IO$M_TIMED | IO$M_ESCAPE);
            ! memset(ibuf, 0, sizeof(ibuf));

            while (1)
            {
            ! status = sys$qiow(0,iochan,function,&iosb,0,0,&ibuf,nbytes,0,0,0,0);
            ! len = strlen(ibuf);
            if (len > 0)
            - {
            - mch_memmove(inbuf, ibuf, len);
            break;
            - }
            lib$wait(&wait);
            }
            return len;
            --- 307,320 ----
            tt_mode = get_tty();

            function = (IO$_READLBLK | IO$M_NOECHO | IO$M_TIMED | IO$M_ESCAPE);
            ! memset(inbuf, 0, nbytes);

            while (1)
            {
            ! status = sys$qiow(0,iochan,function,&iosb,0,0,inbuf,nbytes-1,0,0,0,0);
            ! len = strlen(inbuf);
            if (len > 0)
            break;
            lib$wait(&wait);
            }
            return len;
            *** ../vim-6.2.137/src/version.c Wed Oct 29 14:37:09 2003
            --- src/version.c Wed Oct 29 14:38:52 2003
            ***************
            *** 639,640 ****
            --- 639,642 ----
            { /* Add new patch number below this line */
            + /**/
            + 138,
            /**/
            --
            Walter Briscoe
          Your message has been successfully submitted and would be delivered to recipients shortly.