Menu

bwbasic 3.2 and versions before it

KenUnix
2019-11-15
2019-12-31
  • KenUnix

    KenUnix - 2019-11-15

    I have noted on bwbasic prior to 3.2 you could execute an external command lke dir directly.
    Apparently now you have to spell is out like shell "dir" . Was this intended? Also to get it to
    compile under Windows 10 with gcc 7.4 I had to modify the compile.bat script to the following:

    del bwbasic.exe
    del *.o

    call stdcomp bwbasic.c
    call stdcomp bwb_int.c
    call stdcomp bwb_tbl.c
    call stdcomp bwb_cmd.c
    call stdcomp bwb_prn.c
    call stdcomp bwb_exp.c
    call stdcomp bwb_var.c
    call stdcomp bwb_inp.c
    call stdcomp bwb_fnc.c
    call stdcomp bwb_cnd.c
    call stdcomp bwb_dio.c
    call stdcomp bwb_str.c
    call stdcomp bwb_stc.c
    call stdcomp bwx_tty.c
    call stdcomp bwd_cmd.c
    call stdcomp bwd_fun.c

    gcc -s -o bwbasic.exe bwb_cmd.o bwb_cnd.o bwb_dio.o bwb_exp.o bwb_fnc.o bwb_inp.o bwb_int.o bwb_prn.o bwb_stc.o bwb_str.o bwb_tbl.o bwb_var.o bwbasic.o bwd_cmd.o bwd_fun.o bwx_tty.o

    dir bwbasic.exe

    echo Done

    The wild card gcc -s -o bwbasic.exe *.o would not work. Complained about could not
    open files...

    and strcomp.bat to:

    gcc -w -c -ansi -I . %1 %2 %3 %4 %5 %6 %7 %8 %9

    Other then the above I have not been able to get it to compile under Ubuntu Linux.
    Any input would be appreciated. P.S. Nice job writing and using bwbasic.

    Ken

     
  • AF5NE

    AF5NE - 2019-11-16

    Ken,

    First:
    Yes, the change was intentional.
    Previously, the following typo would erase the entire directory:
    rm ***
    rm The following does something
    rm
    ***
    when what was intended was
    rem ***
    rem The following does something
    rem
    ***
    Notice the missing letter 'e'.
    By requiring the "shell" keyword, the prior will cause an error instead of erasing all file (including the program which contained the typo). I did it myself and that is why I changed it.

    Second:
    I'm not the author of the batch files you used, but I think they were intended for cross-compiling to MVS/CMS. I don't use them myself.

    To compile with gcc, without a port/package, try something like this:
    gcc -obwbasic bw*.c

     
  • KenUnix

    KenUnix - 2019-11-16

    Thanks for the reply. I do understand! Your rite. I tried your idea on Linux Ubuntu 18.04.
    I would like to have the same version across platforms. I hsve been here before and can't fix.
    The following is the result:

    ken@DESKTOP-64ED1AI:~/bwb-3.2/bwbasic-3.20$ gcc -o bwbasic bw.c
    bwb_cmd.c: In function ‘bwb_CMDS’:
    bwb_cmd.c:6263:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (My->SYSOUT->cfp, IntrinsicCommandTable[n].name);
    ^~~~~~~
    bwb_cmd.c: In function ‘DumpAllCommandTableDefinitions’:
    bwb_cmd.c:6662:20: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c:6668:20: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c:6675:20: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c:6681:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, IntrinsicCommandTable[i].name);
    ^~~~~~~
    bwb_cmd.c:6687:20: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c: In function ‘DumpAllCommandSwitchStatement’:
    bwb_cmd.c:6737:22: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c:6744:22: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c: In function ‘DumpAllCommandHtmlTable’:
    bwb_cmd.c:6964:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, bwb_vertable[j].ID);
    ^~~~~~~
    bwb_cmd.c:6967:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, bwb_vertable[j].Name);
    ^~~~~~~
    bwb_cmd.c:6970:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, bwb_vertable[j].Description);
    ^~~~~~~
    bwb_cmd.c:6992:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, bwb_vertable[j].ID);
    ^~~~~~~
    bwb_cmd.c:7005:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, (char
    ) IntrinsicCommandTable[i].Syntax);
    ^~~~~~~
    bwb_cmd.c: In function ‘bwb_HELP’:
    bwb_cmd.c:7113:9: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (My->SYSOUT->cfp, IntrinsicCommandTable[n].name);
    ^~~~~~~
    bwb_cmd.c:7128:9: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (My->SYSOUT->cfp, IntrinsicFunctionTable[n].Name);
    ^~~~~~~
    bwb_cmd.c: In function ‘DumpAllFunctionSwitch’:
    bwb_cmd.c:7699:20: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c: In function ‘DumpAllFuctionTableDefinitions’:
    bwb_cmd.c:7799:20: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c:7860:22: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c:7879:22: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c:7896:20: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c: In function ‘DumpOneFunctionSyntax’:
    bwb_cmd.c:7968:22: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c: In function ‘DumpAllFunctionHtmlTable’:
    bwb_cmd.c:8074:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, bwb_vertable[j].ID);
    ^~~~~~~
    bwb_cmd.c:8077:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, bwb_vertable[j].Name);
    ^~~~~~~
    bwb_cmd.c:8080:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, bwb_vertable[j].Description);
    ^~~~~~~
    bwb_cmd.c:8102:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, bwb_vertable[j].ID);
    ^~~~~~~
    bwb_cmd.c:8115:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, (char *) IntrinsicFunctionTable[i].Syntax);
    ^~~~~~~
    bwb_cmd.c: In function ‘bwb_FNCS’:
    bwb_cmd.c:8166:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (My->SYSOUT->cfp, IntrinsicFunctionTable[n].Name);
    ^~~~~~~
    /tmp/ccihVQYa.o: In function OP_EXP': bwb_exp.c:(.text+0x15e2): undefined reference topow'
    /tmp/ccsBmPnO.o: In function IntrinsicFunction_execute': bwb_fnc.c:(.text+0x1481): undefined reference tofloor'
    bwb_fnc.c:(.text+0x15fe): undefined reference to floor' bwb_fnc.c:(.text+0x3dd2): undefined reference tocosh'
    bwb_fnc.c:(.text+0x3dfe): undefined reference to sinh' bwb_fnc.c:(.text+0x3e2a): undefined reference totanh'
    bwb_fnc.c:(.text+0x3e56): undefined reference to log10' bwb_fnc.c:(.text+0x3f04): undefined reference tolog'
    bwb_fnc.c:(.text+0x3f7c): undefined reference to acos' bwb_fnc.c:(.text+0x4077): undefined reference toacos'
    bwb_fnc.c:(.text+0x4107): undefined reference to acos' bwb_fnc.c:(.text+0x4197): undefined reference toasin'
    bwb_fnc.c:(.text+0x4292): undefined reference to asin' bwb_fnc.c:(.text+0x4322): undefined reference toasin'
    bwb_fnc.c:(.text+0x4402): undefined reference to tan' bwb_fnc.c:(.text+0x44f6): undefined reference tosin'
    bwb_fnc.c:(.text+0x45ea): undefined reference to cos' bwb_fnc.c:(.text+0x47f2): undefined reference toatan2'
    bwb_fnc.c:(.text+0x48b1): undefined reference to ceil' bwb_fnc.c:(.text+0x524d): undefined reference tofloor'
    bwb_fnc.c:(.text+0x5337): undefined reference to pow' bwb_fnc.c:(.text+0x5394): undefined reference tofloor'
    bwb_fnc.c:(.text+0x53f6): undefined reference to pow' bwb_fnc.c:(.text+0x5447): undefined reference tofloor'
    bwb_fnc.c:(.text+0x5706): undefined reference to floor' bwb_fnc.c:(.text+0x573e): undefined reference tofloor'
    bwb_fnc.c:(.text+0x578b): undefined reference to atan' bwb_fnc.c:(.text+0x584a): undefined reference toatan'
    bwb_fnc.c:(.text+0x589e): undefined reference to atan' bwb_fnc.c:(.text+0x597e): undefined reference tocos'
    bwb_fnc.c:(.text+0x59d2): undefined reference to cos' bwb_fnc.c:(.text+0x5a26): undefined reference tocos'
    bwb_fnc.c:(.text+0x5a52): undefined reference to exp' bwb_fnc.c:(.text+0x5a7e): undefined reference tofloor'
    bwb_fnc.c:(.text+0x5ae7): undefined reference to log' bwb_fnc.c:(.text+0x5c5e): undefined reference tosin'
    bwb_fnc.c:(.text+0x5cb2): undefined reference to sin' bwb_fnc.c:(.text+0x5d06): undefined reference tosin'
    bwb_fnc.c:(.text+0x5d32): undefined reference to sqrt' bwb_fnc.c:(.text+0x5dea): undefined reference totan'
    bwb_fnc.c:(.text+0x5e3e): undefined reference to tan' bwb_fnc.c:(.text+0x5e92): undefined reference totan'
    /tmp/ccU3zjMa.o: In function bwb_rint': bwb_int.c:(.text+0x3bce): undefined reference tofloor'
    bwb_int.c:(.text+0x3be9): undefined reference to floor' bwb_int.c:(.text+0x3c3b): undefined reference tofloor'
    bwb_int.c:(.text+0x3c79): undefined reference to floor' bwb_int.c:(.text+0x3c96): undefined reference tofloor'
    /tmp/ccxHpfIT.o: In function FormatBasicNumber': bwb_prn.c:(.text+0x617): undefined reference topow'
    collect2: error: ld returned 1 exit status
    ken@DESKTOP-64ED1AI:~/bwb-3.2/bwbasic-3.20$

    Ken

     
    • Paul Edwards

      Paul Edwards - 2019-11-16

      ken@DESKTOP-64ED1AI:~/bwb-3.2/bwbasic-3.20$ gcc -o bwbasic bw.c
      /tmp/ccihVQYa.o: In function OP_EXP': bwb_exp.c:(.text+0x15e2): undefined reference topow'
      /tmp/ccsBmPnO.o: In function IntrinsicFunction_execute': bwb_fnc.c:(.text+0x1481): undefined reference tofloor'
      Try adding “-lm” to the command. You’re failing
      to link with the maths library.
      BFN. Paul.

       
  • KenUnix

    KenUnix - 2019-11-17

    Paul that did not work. Running ./configure also failed. Should I throw in the towel?
    It's just that Ubuntu under Windows WSL and Ubuntu 18.04 and Ubuntu Mate 20.04
    and bwbasic in Windows bring down different versions. Under Linux I used
    sudo apt get bwbasic and for Windows I downloaded the version for Windows
    on SourceForge.

    ken@DESKTOP-64ED1AI:~/bwb-3.2/bwbasic-3.20$ gcc -lm -o bwbasic bw*.c
    bwb_cmd.c: In function ‘bwb_CMDS’:
    bwb_cmd.c:6263:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (My->SYSOUT->cfp, IntrinsicCommandTable[n].name);
    ^~~~~~~
    bwb_cmd.c: In function ‘DumpAllCommandTableDefinitions’:
    bwb_cmd.c:6662:20: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c:6668:20: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c:6675:20: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c:6681:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, IntrinsicCommandTable[i].name);
    ^~~~~~~
    bwb_cmd.c:6687:20: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c: In function ‘DumpAllCommandSwitchStatement’:
    bwb_cmd.c:6737:22: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c:6744:22: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c: In function ‘DumpAllCommandHtmlTable’:
    bwb_cmd.c:6964:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, bwb_vertable[j].ID);
    ^~~~~~~
    bwb_cmd.c:6967:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, bwb_vertable[j].Name);
    ^~~~~~~
    bwb_cmd.c:6970:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, bwb_vertable[j].Description);
    ^~~~~~~
    bwb_cmd.c:6992:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, bwb_vertable[j].ID);
    ^~~~~~~
    bwb_cmd.c:7005:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, (char ) IntrinsicCommandTable[i].Syntax);
    ^~~~~~~
    bwb_cmd.c: In function ‘bwb_HELP’:
    bwb_cmd.c:7113:9: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (My->SYSOUT->cfp, IntrinsicCommandTable[n].name);
    ^~~~~~~
    bwb_cmd.c:7128:9: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (My->SYSOUT->cfp, IntrinsicFunctionTable[n].Name);
    ^~~~~~~
    bwb_cmd.c: In function ‘DumpAllFunctionSwitch’:
    bwb_cmd.c:7699:20: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c: In function ‘DumpAllFuctionTableDefinitions’:
    bwb_cmd.c:7799:20: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c:7860:22: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c:7879:22: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c:7896:20: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c: In function ‘DumpOneFunctionSyntax’:
    bwb_cmd.c:7968:22: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, tbuf);
    ^~~~
    bwb_cmd.c: In function ‘DumpAllFunctionHtmlTable’:
    bwb_cmd.c:8074:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, bwb_vertable[j].ID);
    ^~~~~~~
    bwb_cmd.c:8077:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, bwb_vertable[j].Name);
    ^~~~~~~
    bwb_cmd.c:8080:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, bwb_vertable[j].Description);
    ^~~~~~~
    bwb_cmd.c:8102:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, bwb_vertable[j].ID);
    ^~~~~~~
    bwb_cmd.c:8115:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (file, (char
    ) IntrinsicFunctionTable[i].Syntax);
    ^~~~~~~
    bwb_cmd.c: In function ‘bwb_FNCS’:
    bwb_cmd.c:8166:5: warning: format not a string literal and no format arguments [-Wformat-security]
    fprintf (My->SYSOUT->cfp, IntrinsicFunctionTable[n].Name);
    ^~~~~~~
    /tmp/ccsGBRIf.o: In function OP_EXP': bwb_exp.c:(.text+0x15e2): undefined reference topow'
    /tmp/ccivX2tY.o: In function IntrinsicFunction_execute': bwb_fnc.c:(.text+0x1481): undefined reference tofloor'
    bwb_fnc.c:(.text+0x15fe): undefined reference to floor' bwb_fnc.c:(.text+0x3dd2): undefined reference tocosh'
    bwb_fnc.c:(.text+0x3dfe): undefined reference to sinh' bwb_fnc.c:(.text+0x3e2a): undefined reference totanh'
    bwb_fnc.c:(.text+0x3e56): undefined reference to log10' bwb_fnc.c:(.text+0x3f04): undefined reference tolog'
    bwb_fnc.c:(.text+0x3f7c): undefined reference to acos' bwb_fnc.c:(.text+0x4077): undefined reference toacos'
    bwb_fnc.c:(.text+0x4107): undefined reference to acos' bwb_fnc.c:(.text+0x4197): undefined reference toasin'
    bwb_fnc.c:(.text+0x4292): undefined reference to asin' bwb_fnc.c:(.text+0x4322): undefined reference toasin'
    bwb_fnc.c:(.text+0x4402): undefined reference to tan' bwb_fnc.c:(.text+0x44f6): undefined reference tosin'
    bwb_fnc.c:(.text+0x45ea): undefined reference to cos' bwb_fnc.c:(.text+0x47f2): undefined reference toatan2'
    bwb_fnc.c:(.text+0x48b1): undefined reference to ceil' bwb_fnc.c:(.text+0x524d): undefined reference tofloor'
    bwb_fnc.c:(.text+0x5337): undefined reference to pow' bwb_fnc.c:(.text+0x5394): undefined reference tofloor'
    bwb_fnc.c:(.text+0x53f6): undefined reference to pow' bwb_fnc.c:(.text+0x5447): undefined reference tofloor'
    bwb_fnc.c:(.text+0x5706): undefined reference to floor' bwb_fnc.c:(.text+0x573e): undefined reference tofloor'
    bwb_fnc.c:(.text+0x578b): undefined reference to atan' bwb_fnc.c:(.text+0x584a): undefined reference toatan'
    bwb_fnc.c:(.text+0x589e): undefined reference to atan' bwb_fnc.c:(.text+0x597e): undefined reference tocos'
    bwb_fnc.c:(.text+0x59d2): undefined reference to cos' bwb_fnc.c:(.text+0x5a26): undefined reference tocos'
    bwb_fnc.c:(.text+0x5a52): undefined reference to exp' bwb_fnc.c:(.text+0x5a7e): undefined reference tofloor'
    bwb_fnc.c:(.text+0x5ae7): undefined reference to log' bwb_fnc.c:(.text+0x5c5e): undefined reference tosin'
    bwb_fnc.c:(.text+0x5cb2): undefined reference to sin' bwb_fnc.c:(.text+0x5d06): undefined reference tosin'
    bwb_fnc.c:(.text+0x5d32): undefined reference to sqrt' bwb_fnc.c:(.text+0x5dea): undefined reference totan'
    bwb_fnc.c:(.text+0x5e3e): undefined reference to tan' bwb_fnc.c:(.text+0x5e92): undefined reference totan'
    /tmp/ccArr5gu.o: In function bwb_rint': bwb_int.c:(.text+0x3bce): undefined reference tofloor'
    bwb_int.c:(.text+0x3be9): undefined reference to floor' bwb_int.c:(.text+0x3c3b): undefined reference tofloor'
    bwb_int.c:(.text+0x3c79): undefined reference to floor' bwb_int.c:(.text+0x3c96): undefined reference tofloor'
    /tmp/ccS9Sgeh.o: In function FormatBasicNumber': bwb_prn.c:(.text+0x617): undefined reference topow'
    collect2: error: ld returned 1 exit status

    ken@DESKTOP-64ED1AI:~/bwb-3.2/bwbasic-3.20$ ./configure
    checking for gcc... gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... no
    checking for suffix of object files... o
    checking whether we are using the GNU C compiler... yes
    checking whether gcc accepts -g... yes
    checking for gcc option to accept ISO C89... none needed
    checking how to run the C preprocessor... gcc -E
    configure: error: cannot find install-sh, install.sh, or shtool in "." "./.." "./../.."
    ken@DESKTOP-64ED1AI:~/bwb-3.2/bwbasic-3.20$

    Ken

     
    • Paul Edwards

      Paul Edwards - 2019-11-17

      Paul that did not work.

      Can you try putting the “-lm” as the last parameter.

      BFN. Paul.

       
  • KenUnix

    KenUnix - 2019-11-18

    Paul,

    Thanks. You were a big help. I also took care of the fprint problems.
    Now one unified source will complie under Windows 10 and varous
    Ubuntu Linux versions. Tomorrow I hope to clen them up. They all
    work using gcc.

    Once I am done I hope to make a zop and tar file with all the work.
    Where would be the best place to post these files?

    Ken

     
    • Paul Edwards

      Paul Edwards - 2019-11-18

      Hi Ken. Glad you got it to work.

      If you send an email to me with your attachment,
      I will take a look and decide where best to put it.

      My email address is mutazilah AT
      you guessed it, gmail.com

      BFN. Paul.

      From: Ken-Unix
      Sent: Monday, November 18, 2019 12:59
      To: [bwbasic:discussion]
      Subject: [bwbasic:discussion] bwbasic 3.2 and versions before it

      Paul,

      Thanks. You were a big help. I also took care of the fprint problems.
      Now one unified source will complie under Windows 10 and varous
      Ubuntu Linux versions. Tomorrow I hope to clen them up. They all
      work using gcc.

      Once I am done I hope to make a zop and tar file with all the work.
      Where would be the best place to post these files?

      Ken


      bwbasic 3.2 and versions before it


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/bwbasic/discussion/162989/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       
  • KenUnix

    KenUnix - 2019-11-18

    Paul I was making good progress until I hit the 'renum' program. Boy,
    that will take some work to compile unless you have fresher version.
    The idea is great to renumber a basic progrsm.

    Ken

     
    • Paul Edwards

      Paul Edwards - 2019-11-19

      renum should compile with a simple:

      gcc renum.c

      If it doesn’t, please show me the errors. You will
      get some warnings about the “exit” function. I
      have fixed those warnings in my own version by
      including stdlib.h. You can ignore the warnings.

      BFN. Paul.

      From: Ken-Unix
      Sent: Tuesday, November 19, 2019 09:34
      To: [bwbasic:discussion]
      Subject: [bwbasic:discussion] bwbasic 3.2 and versions before it

      Paul I was making good progress until I hit the 'renum' program. Boy,
      that will take some work to compile unless you have fresher version.
      The idea is great to renumber a basic progrsm.

      Ken


      bwbasic 3.2 and versions before it


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/bwbasic/discussion/162989/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       
  • KenUnix

    KenUnix - 2019-11-19

    Paul,

    ken@DESKTOP-64ED1AI:~/3.2$ gcc renum.c
    renum.c:24:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    main(argc, argv)
    ^~~~
    renum.c: In function ‘main’:
    renum.c:494:34: warning: embedded ‘\0’ in format [-Wformat-contains-nul]
    sprintf(tempstr, "mv editfl %s\0", f9str);
    ^~
    renum.c: In function ‘binary_search’:
    renum.c:565:27: warning: embedded ‘\0’ in format [-Wformat-contains-nul]
    sprintf(rstr, "%d\0", sidx[m][1]);
    ^~
    ken@DESKTOP-64ED1AI:~/3.2$

    I added #include <stdlib.h and fixed the main issue to int main.

    ken@DESKTOP-64ED1AI:~/3.2$ ./a.out t.bas With file argument
    PLEASE WAIT A FEW SECONDS!
    RENUMBER (-starting number (,interval (,first statement (,last))))
    RENUMBER-100
    RENUMBER-
    RENUMBERING
    VERIFY? y
    100 rem ABS.BAS -- Test ABS() function
    110 X = -1.23456789
    120 ABSX = ABS( X )
    130 print "The absolute value of "; X; " is"; ABSX
    140 print "Is that correct?"

    ken@DESKTOP-64ED1AI:~/3.2$ cat t.bas
    100 rem ABS.BAS -- Test ABS() function
    110 X = -1.23456789
    120 ABSX = ABS( X )
    130 print "The absolute value of "; X; " is"; ABSX
    140 print "Is that correct?"

    ken@DESKTOP-64ED1AI:~/3.2$ ./a.out No arguments can't open file?
    Program in file? t.bas
    Unable to open input file
    ken@DESKTOP-64ED1AI:~/3.2$

    It keeps asking for the RENUMBER- untill you press return with no argument
    and what does the VERIFY argument do? It seems to have the same result
    wiht y, n or nothing Oh it is case sensative. If you answer N it cancels the renumber.
    OK I fixed that. Either n or N works. So we are left with when no arguments on
    the command line after entering the filename it can not open it.

    Ken

     
    • Paul Edwards

      Paul Edwards - 2019-11-19

      So we are left with when no arguments on
      the command line after entering the filename
      it can not open it.
      Here is a fix for that:
      C:\devel\bwbasic>cvs diff -c renum.c
      Index: renum.c
      ===================================================================
      RCS file: c:\cvsroot/bwbasic/renum.c,v
      retrieving revision 1.8
      diff -c -r1.8 renum.c
      renum.c 19 Nov 2019 19:27:56 -0000 1.8
      --- renum.c 19 Nov 2019 18:32:04 -0000
      **
      44,49 **
      --- 44,53 ----
      {
      printf("Program in file? ");
      fgets(pstr,MAX_LINE_LENGTH, stdin);
      + if (strchr(pstr, '\n') != NULL)
      + {
      +
      strchr(pstr, '\n') = '\0';
      + }
      }
      if (strlen(pstr) == 0) strcpy(pstr, "0.doc");

      I’m not willing to volunteer to fix the
      problem with the gosub.

      BFN. Paul.

       
  • KenUnix

    KenUnix - 2019-11-19

    Paul,

    I just noticed another question. After renumbering a file with an on or on gosub
    the result is not changed. See result below.

    ken@DESKTOP-64ED1AI:~/3.2$ cat on.bas
    10 print "ON.BAS -- Test ON...GOTO Statement"
    20 input "Enter a number 1-5:";n
    30 on n goto 40, 60, 80, 100, 120
    40 print "You entered 1"
    50 goto 140
    60 print "You entered 2"
    70 goto 140
    80 print "You entered 3"
    90 goto 140
    100 print "You entered 4"
    110 goto 140
    120 print "You entered 5"
    130 goto 140
    140 end
    ken@DESKTOP-64ED1AI:~/3.2$ ./a.out on.bas
    PLEASE WAIT A FEW SECONDS!
    RENUMBER (-starting number (,interval (,first statement (,last))))
    RENUMBER-100,5
    RENUMBER-
    RENUMBERING
    VERIFY?
    100 print "ON.BAS -- Test ON...GOTO Statement"
    105 input "Enter a number 1-5:";n
    110 on n goto 40, 60, 80, 100, 120
    115 print "You entered 1"
    120 goto 140
    125 print "You entered 2"
    130 goto 140
    135 print "You entered 3"
    140 goto 140
    145 print "You entered 4"
    150 goto 140
    155 print "You entered 5"
    160 goto 140
    165 end
    ken@DESKTOP-64ED1AI:~/3.2$

    Ken

     
  • KenUnix

    KenUnix - 2019-11-20

    Paul,

    This is the code I ended up with in renum.c for both DOS & Linux

    if (argc > 1) strcpy(pstr, argv[1]);
    else
    {
    printf("Program file to use? ");
    fgets(pstr,MAX_LINE_LENGTH, stdin);
    if (strchr(pstr, '\n') != NULL)
    {
    pstr[strlen(pstr)-1] = '\0';
    }
    }
    if (strlen(pstr) == 0) strcpy(pstr, "0.doc");

    For the DOS version I changed:

    sprintf(tempstr, "mv editfl %s\0", f9str);

    To read:

    sprintf(tempstr, "copy editfl %s\0", f9str);

    Well I'm going to have a swell night my BASH under Windows has crashed!!!

    Ken

     
  • KenUnix

    KenUnix - 2019-12-14

    Paul,

    Find attached 13 files. renum.c has been modified where when
    compiled using -DMSDOS it correctly uses "copy" instead of "cp"
    it also contains the name being droped short fix under Linux,

    Compiles with GCC 7.4.0 & 8.10 & 64 bit OK.

    Also attached is a simple bas program called "res" (resolution) to
    simply draw a 24 x 80 screen to adjust your terminal emulator screen size.

    Also find factorials a neet little program.

    Also find compile and compile.bat which will compile bwbasic and renum
    under DOS and Linux. Same name will execute compile under Linux
    and compile.bat under DOS (Windows cmd). Also, no warnings or errors.

    cms.bas is a nice program if only to show some of bwbasic's abilities.
    I changed it slightly to show progress marks.

    Additionally find bwbasic.desktop and bwbasic.png used when installing
    under Linux when a GUI exists..

    Also are the best copies of manuals I could find.

    Let me know what ya think.

    Ken

     
    • Paul Edwards

      Paul Edwards - 2019-12-31

      Hi Ken.

      Thanks for your contributions. I’ve just had a chance
      to go through them now.

      The manuals I did not use, as they were not against
      the latest bwbasic.doc.

      compile and compile.bat I renamed.

      factorials and res are too simple to include
      as examples.

      renum.c has code like this:

      tempstr[strlen(tempstr)] = '\0';
      sprintf(tempstr, "cp editfl %s", f9str);

      which is meaningless. The first line requires
      there to be a NUL character there already,
      because otherwise strlen() won’t work.

      The second line completely overwrites
      tempstr, so it is pointless doing anything
      to it beforehand.

      I also removed the line with a version given
      as a MM/DD/YYYY date format. It would be
      good if you used the ISO date format for an
      international audience, ie YYYY-MM-DD, but
      I don’t think a version number of the date is
      needed for this program anyway.

      The rest I used as-is and should appear in the
      next release.

      Thanks. Paul.

      From: Ken-Unix
      Sent: Saturday, December 14, 2019 12:37
      To: [bwbasic:discussion]
      Subject: [bwbasic:discussion] bwbasic 3.2 and versions before it

      Paul,

      Find attached 13 files. renum.c has been modified where when
      compiled using -DMSDOS it correctly uses "copy" instead of "cp"
      it also contains the name being droped short fix under Linux,

      Compiles with GCC 7.4.0 & 8.10 & 64 bit OK.

      Also attached is a simple bas program called "res" (resolution) to
      simply draw a 24 x 80 screen to adjust your terminal emulator screen size.

      Also find factorials a neet little program.

      Also find compile and compile.bat which will compile bwbasic and renum
      under DOS and Linux. Same name will execute compile under Linux
      and compile.bat under DOS (Windows cmd). Also, no warnings or errors.

      cms.bas is a nice program if only to show some of bwbasic's abilities.
      I changed it slightly to show progress marks.

      Additionally find bwbasic.desktop and bwbasic.png used when installing
      under Linux when a GUI exists..

      Also are the best copies of manuals I could find.

      Let me know what ya think.

      Ken

      Attachments:

      a.. bwb_cmd.c (230.9 kB; application/octet-stream)
      b.. bwb_var.c (110.1 kB; application/octet-stream)
      c.. bwbasic.c (91.7 kB; application/octet-stream)
      d.. bwbasic.desktop (222 Bytes; application/octet-stream)
      e.. bwbasic.png (3.9 kB; image/png)
      f.. Bwbasic-1.1-Manual.txt (17.0 kB; text/plain)
      g.. Bwbasic-2.1-Manual.txt (60.8 kB; text/plain)
      h.. cms.bas (3.4 kB; application/octet-stream)
      i.. compile (1.3 kB; application/octet-stream)
      j.. compile.bat (1.2 kB; application/octet-stream)
      k.. factorials.bas (90 Bytes; application/octet-stream)
      l.. renum.c (16.8 kB; application/octet-stream)
      m.. res.bas (106 Bytes; application/octet-stream)


      bwbasic 3.2 and versions before it


      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/bwbasic/discussion/162989/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

Log in to post a comment.

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.