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

XstBinWrite2

Expand Messages
  • Kerry Miller
    Hi People, I know I have made things confusing the last few weeks. On this computer that I use primarily for program development I am running
    Message 1 of 7 , May 10, 2012
    View Source
    • 1 Attachment
    • 1 KB
    Hi People,

    I know I have made things confusing the last few weeks. On this
    computer that I use primarily for program development I am running
    UBUNTU-12.4-amd64 and I have managed to make xbasic-6.3.15 to run by
    hacking my way through the make process.

    Now, the question:

    The attached "WriteToRadio.txt" is an xbasic function in one of my
    programs. Please be aware that the #radioIoFileNum is insured to be >=3
    and is an open I/O searial (USB) channel, and the #writeBuffer[] is
    loaded an appropriate set of data with 6 bytes of data.

    But still XstBinWrite () still returns a 0 (zero) bytesWrinten. This
    doesn't seem coorect to me. The radio responds to the data appropriately.

    --
    Kerry N0WIQ
    My web site URL is:
    http://mywebpages.comcast.net/n0wiq
  • Ray
    Kerry, I noticed in the function where you are doing the writeBuffer in the first there is no space between writeBuffer and the brackets but in the rest of the
    Message 2 of 7 , May 10, 2012
    View Source
    • 0 Attachment
      Kerry,
       
      I noticed in the function where you are doing the writeBuffer in the first there is no space between writeBuffer and the brackets but in the rest of the function you do. Maybe it doesn’t matter where you put the brackets but I’m sure you have to be consistent.
       
      IF (#dispRawData > 0) THEN
                  DisplayBufferXBC (@#writeBuffer[], "WriteToRadio ()")
                                                                            ^ no space
       
      byteCount = FindPacketEnd (@#writeBuffer []) + 1
                                                                                 ^ space
      ClearBuffer (@#writeBuffer [])
                                                     ^ space
       
      Sent: Thursday, May 10, 2012 9:06 AM
      To: XBasic
      Subject: [xbasic] XstBinWrite2 [1 Attachment]
       
       

      Hi People,

      I know I have made things confusing the last few weeks. On this
      computer that I use primarily for program development I am running
      UBUNTU-12.4-amd64 and I have managed to make xbasic-6.3.15 to run by
      hacking my way through the make process.

      Now, the question:

      The attached "WriteToRadio.txt" is an xbasic function in one of my
      programs. Please be aware that the #radioIoFileNum is insured to be

      >=3
      and is an open I/O searial (USB) channel, and the #writeBuffer[] is
      loaded an appropriate set of data with 6 bytes of data.

      But still XstBinWrite () still returns a 0 (zero) bytesWrinten. This
      doesn't seem coorect to me. The radio responds to the data appropriately.

      --
      Kerry N0WIQ
      My web site URL is:
      http://mywebpages.comcast.net/n0wiq

    • Steve Gunhouse
      You can include spaces between function names and the arguments to the function (between the function name and parentheses), I couldn t say off the top of my
      Message 3 of 7 , May 10, 2012
      View Source
      • 0 Attachment
        You can include spaces between function names and the arguments to the
        function (between the function name and parentheses), I couldn't say off
        the top of my head how we deal with array names in that regard. Probably
        no difference with or without the space, though consistency does make your
        program more readable.

        On Thu, 10 May 2012 16:53:36 -0400, Ray <rmartin255@...> wrote:

        > Kerry,
        >
        > I noticed in the function where you are doing the writeBuffer in the
        > first there is no space between writeBuffer and the brackets but in the
        > rest of the function you do. Maybe it doesn’t matter where you put the
        > brackets but I’m sure you have to be consistent.
        >
        > IF (#dispRawData > 0) THEN
        > DisplayBufferXBC (@#writeBuffer[], "WriteToRadio ()")
        > ^
        > no space
        >
        > byteCount = FindPacketEnd (@#writeBuffer []) + 1
        > ^
        > space
        > ClearBuffer (@#writeBuffer [])
        > ^ space
        >
        > From: Kerry Miller
        > Sent: Thursday, May 10, 2012 9:06 AM
        > To: XBasic
        > Subject: [xbasic] XstBinWrite2 [1 Attachment]
        >
        > [Attachment(s) from Kerry Miller included below]
        > Hi People,
        >
        > I know I have made things confusing the last few weeks. On this
        > computer that I use primarily for program development I am running
        > UBUNTU-12.4-amd64 and I have managed to make xbasic-6.3.15 to run by
        > hacking my way through the make process.
        >
        > Now, the question:
        >
        > The attached "WriteToRadio.txt" is an xbasic function in one of my
        > programs. Please be aware that the #radioIoFileNum is insured to be >=3
        > and is an open I/O searial (USB) channel, and the #writeBuffer[] is
        > loaded an appropriate set of data with 6 bytes of data.
        >
        > But still XstBinWrite () still returns a 0 (zero) bytesWrinten. This
        > doesn't seem coorect to me. The radio responds to the data appropriately.
        >


        --
        Steve Gunhouse
      • Ray
        I guess I am far from being that proficient with xbasic but in other languages I do have experience it does make a big difference. Also is writeBuffer a
        Message 4 of 7 , May 10, 2012
        View Source
        • 0 Attachment
          I guess I am far from being that proficient with xbasic but in other languages I do have experience it does make a big difference. Also is writeBuffer a function? From what I have read in xbasic you use parentheses with functions, I did not see where you could use brackets. If I am wrong please tell me where it is in the documentation.
           
          What I see in the code snippet is that writeBuffer is a variable not a function. That is for the use here; byteCount = FindPacketEnd (@#writeBuffer []) + 1, FindPacketEnd is a function passing the variable writeBuffer [] and adding 1 to the count. That makes writeBuffer a variable not a function.
           
           
           
          Sent: Friday, May 11, 2012 12:43 AM
          Subject: Re: [xbasic] XstBinWrite2
           
           

          You can include spaces between function names and the arguments to the
          function (between the function name and parentheses), I couldn't say off
          the top of my head how we deal with array names in that regard. Probably
          no difference with or without the space, though consistency does make your
          program more readable.

          On Thu, 10 May 2012 16:53:36 -0400, Ray <mailto:rmartin255%40gmail.com> wrote:

          > Kerry,
          >
          > I noticed in the function where you
          are doing the writeBuffer in the
          > first there is no space between
          writeBuffer and the brackets but in the
          > rest of the function you do.
          Maybe it doesn’t matter where you put the
          > brackets but I’m sure you
          have to be consistent.
          >
          > IF (#dispRawData > 0) THEN
          >
          DisplayBufferXBC (@#writeBuffer[], "WriteToRadio ()")
          > ^
          > no
          space
          >
          > byteCount = FindPacketEnd (@#writeBuffer []) + 1
          > ^
          > space
          > ClearBuffer (@#writeBuffer [])
          > ^
          space
          >
          > From: Kerry Miller
          > Sent: Thursday, May 10, 2012
          9:06 AM
          > To: XBasic
          > Subject: [xbasic] XstBinWrite2 [1
          Attachment]
          >
          > [Attachment(s) from Kerry Miller included
          below]
          > Hi People,
          >
          > I know I have made things confusing
          the last few weeks. On this
          > computer that I use primarily for program
          development I am running
          > UBUNTU-12.4-amd64 and I have managed to make
          xbasic-6.3.15 to run by
          > hacking my way through the make
          process.
          >
          > Now, the question:
          >
          > The attached
          "WriteToRadio.txt" is an xbasic function in one of my
          > programs. Please
          be aware that the #radioIoFileNum is insured to be >=3
          > and is an open
          I/O searial (USB) channel, and the #writeBuffer[] is
          > loaded an
          appropriate set of data with 6 bytes of data.
          >
          > But still
          XstBinWrite () still returns a 0 (zero) bytesWrinten. This
          > doesn't seem
          coorect to me. The radio responds to the data appropriately.
          >

          --
          Steve Gunhouse

        • Steve Gunhouse
          Functions use parentheses, arrays use brackets - except that brackets can also be used with I/O commands to identify a file to be used for that command. XBasic
          Message 5 of 7 , May 10, 2012
          View Source
          • 0 Attachment
            Functions use parentheses, arrays use brackets - except that brackets can
            also be used with I/O commands to identify a file to be used for that
            command.

            XBasic does allow use of the same name for a variable, an array and a
            function - the presence or absence of brackets and parentheses would
            distinguish between the three. (Though in terms of programming style, we
            would recommend against that anyway as it makes the program hard to read.)

            On Fri, 11 May 2012 02:14:20 -0400, Ray <rmartin255@...> wrote:

            > I guess I am far from being that proficient with xbasic but in other
            > languages I do have experience it does make a big difference. Also is
            > writeBuffer a function? From what I have read in xbasic you use
            > parentheses with functions, I did not see where you could use brackets.
            > If I am wrong please tell me where it is in the documentation.
            >
            > What I see in the code snippet is that writeBuffer is a variable not a
            > function. That is for the use here; byteCount = FindPacketEnd
            > (@#writeBuffer []) + 1, FindPacketEnd is a function passing the variable
            > writeBuffer [] and adding 1 to the count. That makes writeBuffer a
            > variable not a function.
            >
            >
            >
            > From: Steve Gunhouse
            > Sent: Friday, May 11, 2012 12:43 AM
            > To: xbasic@yahoogroups.com
            > Subject: Re: [xbasic] XstBinWrite2
            >
            > You can include spaces between function names and the arguments to the
            > function (between the function name and parentheses), I couldn't say off
            > the top of my head how we deal with array names in that regard. Probably
            > no difference with or without the space, though consistency does make
            > your
            > program more readable.
            >
            > On Thu, 10 May 2012 16:53:36 -0400, Ray <mailto:rmartin255%40gmail.com>
            > wrote:
            >
            >> Kerry,
            >>
            >> I noticed in the function where you are doing the writeBuffer in the
            >> first there is no space between writeBuffer and the brackets but in the
            >> rest of the function you do. Maybe it doesn’t matter where you put the
            >> brackets but I’m sure you have to be consistent.
            >>
            >> IF (#dispRawData > 0) THEN
            >> DisplayBufferXBC (@#writeBuffer[], "WriteToRadio ()")
            >> ^
            >> no space
            >>
            >> byteCount = FindPacketEnd (@#writeBuffer []) + 1
            >> ^
            >> space
            >> ClearBuffer (@#writeBuffer [])
            >> ^ space
            >>
            >> From: Kerry Miller
            >> Sent: Thursday, May 10, 2012 9:06 AM
            >> To: XBasic
            >> Subject: [xbasic] XstBinWrite2 [1 Attachment]
            >>
            >> [Attachment(s) from Kerry Miller included below]
            >> Hi People,
            >>
            >> I know I have made things confusing the last few weeks. On this
            >> computer that I use primarily for program development I am running
            >> UBUNTU-12.4-amd64 and I have managed to make xbasic-6.3.15 to run by
            >> hacking my way through the make process.
            >>
            >> Now, the question:
            >>
            >> The attached "WriteToRadio.txt" is an xbasic function in one of my
            >> programs. Please be aware that the #radioIoFileNum is insured to be >=3
            >> and is an open I/O searial (USB) channel, and the #writeBuffer[] is
            >> loaded an appropriate set of data with 6 bytes of data.
            >>
            >> But still XstBinWrite () still returns a 0 (zero) bytesWrinten. This
            >> doesn't seem coorect to me. The radio responds to the data
            >> appropriately.
            >>
            >


            --
            Steve Gunhouse
          • Ray
            Oh, I agree with that, one should never use the same name for functions, variables, or arrays. Being fairly new to xbasic I do have a lot to learn but do bring
            Message 6 of 7 , May 12, 2012
            View Source
            • 0 Attachment
              Oh, I agree with that, one should never use the same name for functions, variables, or arrays.
               
              Being fairly new to xbasic I do have a lot to learn but do bring an extensive programming background in with me.
               
              I have looked at various snippets of code and they have shown me quite a bit, but one thing I do to help me, and I have been doing it for many years, is I have a header section to my apps where I list all function names, description, and parameters if needed. All variables with a short descriptions of what they are for, and whatever procedures required and descriptions. Now on my other compilers those are stripped out when compiled.
               
               
              Sent: Friday, May 11, 2012 1:58 AM
              Subject: Re: [xbasic] XstBinWrite2
               
               

              Functions use parentheses, arrays use brackets - except that brackets can
              also be used with I/O commands to identify a file to be used for that
              command.

              XBasic does allow use of the same name for a variable, an array and a
              function - the presence or absence of brackets and parentheses would
              distinguish between the three. (Though in terms of programming style, we
              would recommend against that anyway as it makes the program hard to read.)

              On Fri, 11 May 2012 02:14:20 -0400, Ray <mailto:rmartin255%40gmail.com> wrote:

              > I guess I am far from being that proficient with xbasic but
              in other
              > languages I do have experience it does make a big difference.
              Also is
              > writeBuffer a function? From what I have read in xbasic you use
              > parentheses with functions, I did not see where you could use brackets.
              > If I am wrong please tell me where it is in the
              documentation.
              >
              > What I see in the code snippet is that
              writeBuffer is a variable not a
              > function. That is for the use here;
              byteCount = FindPacketEnd
              > (@#writeBuffer []) + 1, FindPacketEnd is a
              function passing the variable
              > writeBuffer [] and adding 1 to the count.
              That makes writeBuffer a
              > variable not a
              function.
              >
              >
              >
              > From: Steve Gunhouse
              > Sent:
              Friday, May 11, 2012 12:43 AM
              > To:
              href="mailto:xbasic%40yahoogroups.com">mailto:xbasic%40yahoogroups.com
              >
              Subject: Re: [xbasic] XstBinWrite2
              >
              > You can include spaces
              between function names and the arguments to the
              > function (between the
              function name and parentheses), I couldn't say off
              > the top of my head
              how we deal with array names in that regard. Probably
              > no difference with
              or without the space, though consistency does make
              > your
              > program
              more readable.
              >
              > On Thu, 10 May 2012 16:53:36 -0400, Ray
              <mailto:rmartin255%40gmail.com>
              > wrote:
              >
              >>
              Kerry,
              >>
              >> I noticed in the function where you are doing the
              writeBuffer in the
              >> first there is no space between writeBuffer and
              the brackets but in the
              >> rest of the function you do. Maybe it
              doesn’t matter where you put the
              >> brackets but I’m sure you have to
              be consistent.
              >>
              >> IF (#dispRawData > 0) THEN
              >>
              DisplayBufferXBC (@#writeBuffer[], "WriteToRadio ()")
              >> ^
              >>
              no space
              >>
              >> byteCount = FindPacketEnd (@#writeBuffer []) +
              1
              >> ^
              >> space
              >> ClearBuffer (@#writeBuffer
              [])
              >> ^ space
              >>
              >> From: Kerry Miller
              >>
              Sent: Thursday, May 10, 2012 9:06 AM
              >> To: XBasic
              >> Subject:
              [xbasic] XstBinWrite2 [1 Attachment]
              >>
              >> [Attachment(s) from
              Kerry Miller included below]
              >> Hi People,
              >>
              >> I
              know I have made things confusing the last few weeks. On this
              >>
              computer that I use primarily for program development I am running
              >>
              UBUNTU-12.4-amd64 and I have managed to make xbasic-6.3.15 to run by
              >>
              hacking my way through the make process.
              >>
              >> Now, the
              question:
              >>
              >> The attached "WriteToRadio.txt" is an xbasic
              function in one of my
              >> programs. Please be aware that the
              #radioIoFileNum is insured to be >=3
              >> and is an open I/O searial
              (USB) channel, and the #writeBuffer[] is
              >> loaded an appropriate set
              of data with 6 bytes of data.
              >>
              >> But still XstBinWrite ()
              still returns a 0 (zero) bytesWrinten. This
              >> doesn't seem coorect to
              me. The radio responds to the data
              >>
              appropriately.
              >>
              >

              --
              Steve Gunhouse

            • Steve Gunhouse
              Comments are always ignored when compiled. Max - the original author of XB - was pretty good about commenting his code. The only real question is what your
              Message 7 of 7 , May 13, 2012
              View Source
              • 0 Attachment
                Comments are always ignored when compiled.

                Max - the original author of XB - was pretty good about commenting his
                code. The only real question is what your preferred editor will do with
                those comments.

                Any program has no way of knowing where the Prolog ends and the first
                function begins other than the FUNCTION statement itself (not that your
                Entry function will require much comment). Therefore any comments prior to
                Entry will be in the Prolog.

                After the Prolog and Entry ... a smart IDE will include everything after a
                particular END FUNCTION into following function. Thus Max's voluminous
                comments (when viewing the XB source in the PDE) should be in the right
                place if you actually load the source of one of the libraries.

                Mind you, there are some FUNCTIONS that are simply too complex to comment
                properly, the source for the compiler itself is one such. While there's no
                problem listing the inputs and outputs, describing what it actually does
                is too much.

                On Sun, 13 May 2012 02:35:57 -0400, Ray <rmartin255@...> wrote:

                > Oh, I agree with that, one should never use the same name for functions,
                > variables, or arrays.
                >
                > Being fairly new to xbasic I do have a lot to learn but do bring an
                > extensive programming background in with me.
                >
                > I have looked at various snippets of code and they have shown me quite a
                > bit, but one thing I do to help me, and I have been doing it for many
                > years, is I have a header section to my apps where I list all function
                > names, description, and parameters if needed. All variables with a short
                > descriptions of what they are for, and whatever procedures required and
                > descriptions. Now on my other compilers those are stripped out when
                > compiled.
                >
                >
                > From: Steve Gunhouse
                > Sent: Friday, May 11, 2012 1:58 AM
                > To: xbasic@yahoogroups.com
                > Subject: Re: [xbasic] XstBinWrite2
                >
                > Functions use parentheses, arrays use brackets - except that brackets can
                > also be used with I/O commands to identify a file to be used for that
                > command.
                >
                > XBasic does allow use of the same name for a variable, an array and a
                > function - the presence or absence of brackets and parentheses would
                > distinguish between the three. (Though in terms of programming style, we
                > would recommend against that anyway as it makes the program hard to
                > read.)
                >
                > On Fri, 11 May 2012 02:14:20 -0400, Ray <mailto:rmartin255%40gmail.com>
                > wrote:
                >
                >> I guess I am far from being that proficient with xbasic but in other
                >> languages I do have experience it does make a big difference. Also is
                >> writeBuffer a function? From what I have read in xbasic you use
                >> parentheses with functions, I did not see where you could use brackets.
                >> If I am wrong please tell me where it is in the documentation.
                >>
                >> What I see in the code snippet is that writeBuffer is a variable not a
                >> function. That is for the use here; byteCount = FindPacketEnd
                >> (@#writeBuffer []) + 1, FindPacketEnd is a function passing the variable
                >> writeBuffer [] and adding 1 to the count. That makes writeBuffer a
                >> variable not a function.
                >>
                >>
                >>
                >> From: Steve Gunhouse
                >> Sent: Friday, May 11, 2012 12:43 AM
                >> To: mailto:xbasic%40yahoogroups.com
                >> Subject: Re: [xbasic] XstBinWrite2
                >>
                >> You can include spaces between function names and the arguments to the
                >> function (between the function name and parentheses), I couldn't say off
                >> the top of my head how we deal with array names in that regard. Probably
                >> no difference with or without the space, though consistency does make
                >> your
                >> program more readable.
                >>
                >> On Thu, 10 May 2012 16:53:36 -0400, Ray <mailto:rmartin255%40gmail.com>
                >> wrote:
                >>
                >>> Kerry,
                >>>
                >>> I noticed in the function where you are doing the writeBuffer in the
                >>> first there is no space between writeBuffer and the brackets but in the
                >>> rest of the function you do. Maybe it doesn’t matter where you put the
                >>> brackets but I’m sure you have to be consistent.
                >>>
                >>> IF (#dispRawData > 0) THEN
                >>> DisplayBufferXBC (@#writeBuffer[], "WriteToRadio ()")
                >>> ^
                >>> no space
                >>>
                >>> byteCount = FindPacketEnd (@#writeBuffer []) + 1
                >>> ^
                >>> space
                >>> ClearBuffer (@#writeBuffer [])
                >>> ^ space
                >>>
                >>> From: Kerry Miller
                >>> Sent: Thursday, May 10, 2012 9:06 AM
                >>> To: XBasic
                >>> Subject: [xbasic] XstBinWrite2 [1 Attachment]
                >>>
                >>> [Attachment(s) from Kerry Miller included below]
                >>> Hi People,
                >>>
                >>> I know I have made things confusing the last few weeks. On this
                >>> computer that I use primarily for program development I am running
                >>> UBUNTU-12.4-amd64 and I have managed to make xbasic-6.3.15 to run by
                >>> hacking my way through the make process.
                >>>
                >>> Now, the question:
                >>>
                >>> The attached "WriteToRadio.txt" is an xbasic function in one of my
                >>> programs. Please be aware that the #radioIoFileNum is insured to be >=3
                >>> and is an open I/O searial (USB) channel, and the #writeBuffer[] is
                >>> loaded an appropriate set of data with 6 bytes of data.
                >>>
                >>> But still XstBinWrite () still returns a 0 (zero) bytesWrinten. This
                >>> doesn't seem coorect to me. The radio responds to the data
                >>> appropriately.
                >>>
                >>
                >


                --
                Steve Gunhouse
              Your message has been successfully submitted and would be delivered to recipients shortly.