Menu

String Variable Feature

Anonymous
2016-10-20
2016-11-23
  • Anonymous

    Anonymous - 2016-10-20

    Great program that runs my ancient programs flawlessly, with one exception. A couple of my programs create schematic diagrams on-screen using string variables that contain numbers generated in FOR-NEXT loops. Below is a simplified example that prints a "7" on the screen in native GWBasic, but produces an "Illegal function call" error in PCBasic.
    10 CLS
    20 J=1
    30 PSET(30,50)
    40 N$(J)="S16;R2;NG2"
    50 DRAW"xN$(J);"

    Thanks for any help with this.
    Don Jackson

     
  • Rob Hagemans

    Rob Hagemans - 2016-11-10

    Sorry, it looks like you posted this ages ago but I seem to have missed it. This looks like a bug, probably related to parsing array indices. I'll see if I can fix it. Meanwhile you could try the variant

    50 DRAW "x"+VARPTR(N$(J))
    
    • not sure if it'll work, but if it does it could work around the issue for now.

    Thanks
    Rob

     

    Last edit: Rob Hagemans 2016-11-10
  • Rob Hagemans

    Rob Hagemans - 2016-11-10

    that should be VARPTR$ not VARPTR, sorry.

     
    • Anonymous

      Anonymous - 2016-11-14

      I can't seem to get the VARPTR$ alternative to work, but that could be due to operator error. I'm not an expert in GWBasic. Please let me know if you come up with a solution.
      Thanks,
      Don

       
      • Rob Hagemans

        Rob Hagemans - 2016-11-17

        Hi Don, thanks for getting back - you're right, it doesn't work either, which is a bug. The latter version does work in the most recent source version, but that is not yet released. I'll include this in the fix.

        Meanwhile, the only workaround I can think of is to rewrite so that you don't need the "x" operation - in the above program, you could simply do 50 DRAW N$(J). I appreciate that this is a simplified version and it is probably more difficult in the original version, but perhaps it's possible to split the DRAW statement into multiple statements and do it like this.

        Rob

         
  • Rob Hagemans

    Rob Hagemans - 2016-11-19

    Hi Don, I've fixed the bug so that your original program should work with 15.08.11 when that is released (I expect soon).

    The VARPTR$ fix is too dependent on the new version to be backported to 15.08 but it works in the source version, and will thus work with the next major release (hopefully 16.something but it may end up being 17.something at the current pace ...).

    Rob

     
    • Anonymous

      Anonymous - 2016-11-22

      Hi Rob,
      I tried your "DRAW N$(J)" approach and I could get some of my very large schematic subroutine to work, but not all of it. Using this method would require an extensive re-write, so I look forward to your 15.08.11 release. Thanks so much for your attention to this problem.
      Don

       
      • Rob Hagemans

        Rob Hagemans - 2016-11-22

        The new version is available for download now so give it a go! Let me know if you run into further issues.

         
  • Anonymous

    Anonymous - 2016-11-23

    Rob, I downloaded 15.08.11 and it runs my schematic program like a charm. Thanks for creating this lifesaver of a program!
    Don

     
Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.