User avatar
RichardRussell
Posts: 537
Joined: Thu Jun 21, 2012 10:48 am

Re: ScriptBasic

Mon Jun 17, 2019 2:55 pm

Heater wrote:
Mon Jun 17, 2019 1:40 pm
That is assuming that getting the IDE installed is problem free.
In my experience of many and varied IDEs that is far from the case.
You found building BBC BASIC from source pretty straightforward, as I recollect (there was just the one issue of having to copy the executable to another directory before the IDE would run) - and that was only necessary because of your anxiety about downloading a ready-made binary from a web address you didn't recognise.

Heater
Posts: 12739
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 3:29 pm

Installing BBC BASIC went reasonably easily.

Getting it to produce a result as we like was problematic as I recall.

User avatar
RichardRussell
Posts: 537
Joined: Thu Jun 21, 2012 10:48 am

Re: ScriptBasic

Mon Jun 17, 2019 4:20 pm

Heater wrote:
Mon Jun 17, 2019 3:29 pm
Getting it to produce a result as we like was problematic as I recall.
Yes but that was unfamiliarity with the dialect, rather than the installation/setup issues being discussed here.

Heater
Posts: 12739
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 4:26 pm

Yes, but it still does not take input from or put output to the console as we like.

User avatar
RichardRussell
Posts: 537
Joined: Thu Jun 21, 2012 10:48 am

Re: ScriptBasic

Mon Jun 17, 2019 5:19 pm

Heater wrote:
Mon Jun 17, 2019 4:26 pm
Yes, but it still does not take input from or put output to the console as we like.
Erm, the clue is in the name: BBC BASIC 'for SDL 2.0'. SDL is a multimedia framework (and BBC BASIC is used more for graphics and sound applications than any other). Nobody has ever suggested that BBCSDL is either a scripting language or a console language. It would be easy enough to throw away the SDL layer and compile the interpreter with console I/O, but then probably 90% of BBC BASIC applications wouldn't run.

User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Mon Jun 17, 2019 5:40 pm

Richard,

ScriptBasic is a glue language where BBC BASIC is focused on UI based applications. The RPi world needs both environments.

Heater
Posts: 12739
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 6:07 pm

Fair enough Richard. BBC BASIC is what it is by design. Can't argue with that.

I'm not sure why having a GUI precludes command line operation but who am I to say that it should not.

User avatar
RichardRussell
Posts: 537
Joined: Thu Jun 21, 2012 10:48 am

Re: ScriptBasic

Mon Jun 17, 2019 6:44 pm

Heater wrote:
Mon Jun 17, 2019 6:07 pm
I'm not sure why having a GUI precludes command line operation.
It doesn't. BBC BASIC for Windows (just as much a GUI language as BBCSDL) does indeed support building 'console' executables, but that's because Windows itself does, and BB4W simply leverages that capability. But the 'operating system' under which BBC BASIC for SDL 2.0 runs (i.e. SDL 2 itself, which provides an abstraction layer isolating the app from the native OS) doesn't.

So the absence of a 'console build' capability from BBCSDL is a price paid as a result of using SDL rather than interfacing with the native OS. But of course the prize is far more valuable: a language that runs on Windows, Linux, MacOS, Android and iOS with almost 100% application-program compatibility between those platforms, something that would be damn near impossible without such an abstraction layer.

User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Mon Jun 17, 2019 7:10 pm

Richard,

I'm still trying to get my arms around what is the predominant use of the Raspberry Pi. I hear from management/ engineering that the RPi is used widely as a PC alternative. I would have guessed with its GPIO interface embedded application development would be its draw. All I know is the RPi popularity is growing at a phenomenal rate.

A better alternate than giving your kids dolls and toy guns as tools to prepare for the future.

hippy
Posts: 5373
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ScriptBasic

Mon Jun 17, 2019 7:30 pm

ScriptBasic wrote:
Mon Jun 17, 2019 7:10 pm
I'm still trying to get my arms around what is the predominant use of the Raspberry Pi.
With half of all Pi computers sold going into industry its main use could be defined as embedded controller.

Outside that its main use I would say it is as a cheap Linux computer. It's used as a desktop replacement by some, a media or games platform by others, and used to assist learning about computers and programming in an educational setting.

Then there are those who use it as an application engine, running particular tasks, and the maker community who may also use it as an embedded controller.

And there are people whose use spans all of that, they may even have multiple Pi computers used for different things.
Last edited by hippy on Mon Jun 17, 2019 7:47 pm, edited 1 time in total.

User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Mon Jun 17, 2019 7:44 pm

I like the RPi as it forces the developer to be creative and not just throw more hardware at it to hide poor design.

Heater
Posts: 12739
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 7:47 pm

ScriptBasic,
I'm still trying to get my arms around what is the predominant use of the Raspberry Pi.
The very abbreviated history of the Pi is:

Eben Upton, Raspberry Pi founder, was an undergraduate admissions officer for the CS dept. of Cambridge University.
He noticed that applications to under grad CS courses were in decline, and worse still those kids arrived at university not knowing how to program like they did in prior decades.
He surmised that it was because these new generations did not grow up with computers in their bedrooms they could play with, hack with, destroy at will. Unlike those that had C64's, Sinclair Spectrums, TRS-80's, Amigas etc back in the 1980's/90's.
He set out to fix this by creating a very cheap and small computer that kids could get as a toy, and do what they will with.
Eben then took a job at Broadcom where he found it possible to use their ARM processors and GPU's to build what he wanted.
Thus the Pi was born.

Of course people have imaginations, they could see all kind of things to do with such a small cheap computer with excellent Linux support. Thus demand was huge from day 1 and has grown many fold since then.

Certainly GPIO makes a lot of things possible that are hard/impossible to do with a PC/tablet/phone. Certainly such a machine is useful for traditional embedded systems things, whilst others try to use it as a PC replacement.
A better alternate than giving your kids dolls and toy guns as tools to prepare for the future.
Yes indeed.

Although I suspect that dolls and guns are not so much a concern today as kids getting phone and tablets and the like, thus getting immersed in games and social media whilst never seeing the device as a thing they could program. You know, a computer.

Heater
Posts: 12739
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 7:52 pm

ScriptBasic,
I like the RPi as it forces the developer to be creative and not just throw more hardware at it to hide poor design.
That is a double edged sword.

Looking at it from the other end of the spectrum, embedded device developers had to get their jobs done in very limited machines with only kilobytes of RAM and sluggish clock speeds. Often only 8 bit devices.

With the likes of the Pi with a gig of RAM, 1GHz clocks, 64 bits and 4 cores, those developers can now be more lazy than they ever imagined possible and fill the thing up with piles of excess and un-optimized code.

I know I do. It's luxurious :)

User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Mon Jun 17, 2019 7:55 pm

Like a StarTrek transporter that takes you places without leaving the room.

User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Mon Jun 17, 2019 8:06 pm

The other thing I like about the RPi is I can put cross compiling behind me and do everything native.

hippy
Posts: 5373
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: ScriptBasic

Mon Jun 17, 2019 8:10 pm

ScriptBasic wrote:
Mon Jun 17, 2019 7:44 pm
I like the RPi as it forces the developer to be creative and not just throw more hardware at it to hide poor design.
I suppose one could split the users I mentioned outside of industry into consumers ( surfers, gamers and streamers ), developers ( makers and programmers ), and learners.

For the consumers the Pi is probably somewhat lacking but its low cost makes up for that. For learners it's probably 'just a box', is whatever it is.

It probably is the developer who needs to get creative knowing that it's competent but not as well resourced as a traditional PC, but it's not that badly resourced as it goes.

I'm not sure how much that encourages or forces developers to optimise, write better code, or consume less resources. Most are probably still working to the same old 'if it works well enough for me that's good enough'.

There really aren't the 1K of RAM, 32K of Flash, 1MHz system clock restrictions, which really brings out the need to be efficient. I have spent hours shaving 1us instruction times off programs but that seems largely pointless when it's more ns than us cycles.

Heater
Posts: 12739
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 8:31 pm

HELP!

scriba is not working for me any more!

Having fiddled around building scriba from the latest source code in the master repository and getting sidetracked by the sb.sh not working, I totally forgot to check that scriba can actually run any BASIC. It can not.

Here is what I do, see errors at the end:

Code: Select all

[email protected]:~$ pwd
/home/heater
[email protected]:~$ scriba
-bash: scriba: command not found
[email protected]:~$ cd sb-dev
[email protected]:~/sb-dev$ git pull
Already up-to-date.
$ git branch
* master
$ ./setup
This is unix cwd=/home/heater/sb-dev/
creating configure.jim
...
...
Compilation: Jun 17 2019 02:38:15
ld: cannot find -lscriba
make: *** [/home/heater/sb-dev/bin/mod/dll/sbt.so] Error 1
scriba executable OK
sbhttpd executable OK
libscriba library OK
MODULE cgi:      dll OK   lib OK   bas OK
MODULE curl:     dll OK   lib OK   bas OK
MODULE curses:   dll OK   lib OK   bas OK
MODULE dbg:      dll OK   lib OK   bas OK
MODULE gmp2:     dll OK   lib OK   bas OK
MODULE hash:     dll OK   lib OK   bas OK
MODULE ip:       dll OK   lib OK   bas OK
MODULE json:     dll OK   lib OK   bas OK
MODULE mt:       dll OK   lib OK   bas OK
MODULE mxml:     dll OK   lib OK   bas OK
MODULE mysql:    dll OK   lib OK   bas OK
MODULE odbc:     dll OK   lib OK   bas OK
MODULE sbt:      dll FAIL lib OK   bas OK
MODULE sdbg:     dll OK   lib OK   bas FAIL
MODULE slre:     dll OK   lib OK   bas OK
MODULE sqlite:   dll OK   lib OK   bas OK
MODULE t:        dll OK   lib OK   bas OK
MODULE trial:    dll OK   lib OK   bas OK
MODULE ux:       dll OK   lib OK   bas OK
MODULE zlib:     dll OK   lib OK   bas OK
$
$ mkdir ../sb
mkdir: cannot create directory ‘../sb’: File exists
[email protected]:~/sb-dev$ rm -rf ../sb
[email protected]:~/sb-dev$ mkdir ../sb
[email protected]:~/sb-dev$ ./mkdist.sh ../sb
[email protected]:~/sb-dev$ cd ../sb
[email protected]:~/sb$ source sb.sh
[email protected]:~/sb$ scriba
Usage: basic [options] program.bas

options: -o file_name
            specify output file, save binary format to file but don't execute
         -b file_name
            load binary format from file and execute
         -n
            do not use cache (no save, no load)
         -e
            execute after binary format was saved
         -v
            print version info and stop
         -c
            inform scriba that this is a CGI script.
         -C
            save C program output.
         -E
            save executable output. (may not work under some OS)
         -p preprocessor
            specify external preprocessor.
         -i preprocessor
            specify internal preprocessor.
         -f configurationfile
            specify configuration file
         -d
            debug module error (UNIX only)
         -k text_config_file
            compile the configuration file to binary
         -D
            dump the configuration file in text format
[email protected]:~/sb$ cd ..
[email protected]:~$ cat hfibo.sb
IMPORT gmp2.bas

function hfibo(n)
local a, b, fk, fk1, k, r
SPLIT "0,0,0,0,0,0" BY "," TO k, a, b, r, fk, fk1
  if n <= 2 THEN
    r = 1
  else
    k = (n / 2) OR 0
    fk = hfibo(k)
    fk1 = hfibo(k + 1)
    if (n and 1) = 0 then
      a = gmp2::add(fk1, fk1)
      b = gmp2::sub(a, fk)
      r = gmp2::mul(fk, b)
    else
      a = gmp2::mul(fk, fk)
      b = gmp2::mul(fk1, fk1)
      r = gmp2::add(a, b)
    end if
  end if
  hfibo = r
end function

PRINT LEN(hfibo(4784969)),"\n"

[email protected]:~$ scriba hfibo.sb
hfibo.sb(7): error &H77:syntax error during checking the line and also noting that the syntax error so serious that none of the other syntax defintions can match the current line
hfibo.sb(8): error &H74:erroneous nesting of constructs like IF/ELSIF/ELSE/ENDIF/REPEAT/LOOP/WHILE and so on
hfibo.sb(9): error &H77:syntax error during checking the line and also noting that the syntax error so serious that none of the other syntax defintions can match the current line
hfibo.sb(10): error &H77:syntax error during checking the line and also noting that the syntax error so serious that none of the other syntax defintions can match the current line
hfibo.sb(11): error &H77:syntax error during checking the line and also noting that the syntax error so serious that none of the other syntax defintions can match the current line
hfibo.sb(13): error &H77:syntax error during checking the line and also noting that the syntax error so serious that none of the other syntax defintions can match the current line
hfibo.sb(14): error &H77:syntax error during checking the line and also noting that the syntax error so serious that none of the other syntax defintions can match the current line
hfibo.sb(15): error &H77:syntax error during checking the line and also noting that the syntax error so serious that none of the other syntax defintions can match the current line
hfibo.sb(16): error &H74:erroneous nesting of constructs like IF/ELSIF/ELSE/ENDIF/REPEAT/LOOP/WHILE and so on
hfibo.sb(17): error &H77:syntax error during checking the line and also noting that the syntax error so serious that none of the other syntax defintions can match the current line
hfibo.sb(18): error &H77:syntax error during checking the line and also noting that the syntax error so serious that none of the other syntax defintions can match the current line
hfibo.sb(19): error &H77:syntax error during checking the line and also noting that the syntax error so serious that none of the other syntax defintions can match the current line
hfibo.sb(22): error &H77:syntax error during checking the line and also noting that the syntax error so serious that none of the other syntax defintions can match the current line
[email protected]:~$
What to do?

User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Mon Jun 17, 2019 8:43 pm

1. Build ScriptBasic from the current MASTER sb-dev repo.

2. Run the mkdist.sh script to install a runtime in the directory of choice.

3. Copy scriba to somewhere in your system path. (temp fix til AIR works out the issue)

4. $ source sb.sh in the directory it resides. (builds basic.conf dynamically pointing to the modules and include file directories)

You should now have full use of ScriptBasic and it's core extension modules.

Heater
Posts: 12739
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 8:51 pm

Did you read through the procedure I posted above there.

It shows precisely what I did to build and run scriba. That I did all of what you say.

And how it fails to work.

User avatar
ScriptBasic
Posts: 1254
Joined: Wed Apr 03, 2019 5:53 pm
Location: Anacortes, WA USA
Contact: Website Twitter

Re: ScriptBasic

Mon Jun 17, 2019 9:03 pm

What does scriba -D say?

The reason for all thoses errors is it never loaded the GMP2 extension module.

I run the traditional install where basic.conf is in /etc/scriba, I put scriba in /usr/bin, libscriba.so / .a in /usr/lib and my extension modules and include in my home directory structure. Here is what my basic.conf looks like on my RPI 3 B. This also includes support for the sbhttpd application proxy server.

Code: Select all

[email protected]:~ $ scriba -D
dll ".so"
module "/home/pi/sbrpi/modules/"
include "/home/pi/sbrpi/include/"
maxstep 0
maxlocalstep 0
maxlevel 35611
maxmem 0
servers (
  server (
    port 8181
    ip "127.0.0.1"
    protocol "http"
   )
  threads 1000
  listenbacklog 3
  home "/home/pi/sbrpi/web/"
  proxyip 1
  pid (
    file "/home/pi/sbrpi/log/pid.txt"
    delay 10
    wait (
      period 10
      length 1
     )
   )
  vdirs (
    dir "/home/test/:/home/pi/sbrpi/web/test/"
   )
  errmsgdest 3
  nolog 0
  log (
    panic (
      file "/home/pi/sbrpi/log/panic.log"
     )
    app (
      file "/home/pi/sbrpi/log/app.log"
     )
    err (
      file "/home/pi/sbrpi/log/err.log"
     )
    hit (
      file "/home/pi/sbrpi/log/hit.log"
     )
    stat (
      file "/home/pi/sbrpi/log/stat.log"
     )
   )
  msg404 """
  <HTML>
  <HEAD>
  <TITLE>Error 404 page not found</TITLE>
  </HEAD>
  <BODY>
  <FONT FACE=\"Verdana\" SIZE=\"2\">
  <H1>Page not found</H1>
  The page you have requested can not be found on this server.
  <p>
  If you feel this is a server misconfiguration, please contact:
  <FONT SIZE=\"3\"><TT>[email protected]</TT></FONT>
  </FONT>
  </BODY>
  </HTML>
  """
  code404 "200 OK"
 )
[email protected]:~ $ 

Heater
Posts: 12739
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 9:10 pm

Code: Select all

$ scriba -D
dll ".so"
module "/mnt/c/Users/heater/Documents/fibo_4784969/BASIC/scriptbasic/scriba/module/"
include "/mnt/c/Users/heater/Documents/fibo_4784969/BASIC/scriptbasic/scriba/include/"
maxstep 0
maxlocalstep 0
maxlevel 29666
maxmem 0
Those paths are correct.

Heater
Posts: 12739
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 9:19 pm

It's not because it did not load the GMP extension. This code also fails:

Code: Select all

$ cat junk.sb
count = 4784969

a = 1
b = 0
p = 0
q = 1

WHILE count > 0
WEND
PRINT b,"\n"

[email protected]:/mnt/c/Users/michael/Documents/fibo_4784969/BASIC/scriptbasic$ scriba junk.sb
junk.sb(1): error &H77:syntax error during checking the line and also noting that the syntax error so serious that none of the other syntax defintions can match the current line
junk.sb(3): error &H77:syntax error during checking the line and also noting that the syntax error so serious that none of the other syntax defintions can match the current line
junk.sb(4): error &H77:syntax error during checking the line and also noting that the syntax error so serious that none of the other syntax defintions can match the current line
junk.sb(5): error &H77:syntax error during checking the line and also noting that the syntax error so serious that none of the other syntax defintions can match the current line
junk.sb(6): error &H77:syntax error during checking the line and also noting that the syntax error so serious that none of the other syntax defintions can match the current line
[email protected]:/mnt/c/Users/michael/Documents/fibo_4784969/BASIC/scriptbasic$



Heater
Posts: 12739
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 9:29 pm

Why does this not work:

$ git clone https://sandbox.allbasic.info/scriptbasic/sb-dev.git
Cloning into 'sb-dev'...
fatal: repository 'https://sandbox.allbasic.info/scriptbasic/sb-dev.git/' not found

??

Grrr...

Heater
Posts: 12739
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 9:37 pm

Blimey, just notice the repo is running on a non-standard port: 8181

The clone button in the repo does not give the right URL with the port number in it.

Should be:

https://sandbox.allbasic.info:8181/scriptbasic/sb-dev


Grrr...

Heater
Posts: 12739
Joined: Tue Jul 17, 2012 3:02 pm

Re: ScriptBasic

Mon Jun 17, 2019 9:51 pm

OK. I got it working.

I deleted everything, the build, directory, the repository directory and started from scratch with git clone.

I can only conclude that when I switched from the cleanup branch to the master branch then setup did not rebuild everything and there was some old junk from the previous cleanup build hanging around.

Grrr...

Return to “Other programming languages”