Re: BBC BASIC for SDL 2.0 v0.20a released

Richard Russell

On Tue, Feb 6, 2018 at 09:14 am, Paul Marshall wrote:
One nice possibility would be CTRL - Mousewheel which zooms several programs I use regularly.
I thought we were discussing keyboard control.  Mouse control is an entirely different kettle of rodents, and I don't even know whether you can detect mousewheel events in Android.  Simple mouse actions, such as clicks and drags, work because they map to touchscreen gestures, but that's not necessarily the case with the wheel.  Since I don't own a Bluetooth mouse myself I can't do the test.

If you do find that you can detect the mousewheel then of course mapping it in the way you suggest is fine, but that doesn't resolve the problem of how to change the zoom from the keyboard.   I'm sure a lot of people have Bluetooth keyboards, like I have, that can be used with an Android device, and being able to control the zoom is just as valuable for them.  I hardly need say that any modifications I may make to touchide in the next release are not for you, they are for everybody!

I didnt know that until today when I saw CFGfile$! In the instructions for touchide it says: "A pinch changes the size of the font. The new size will be remembered in subsequent sessions". I make no apologies for assuming that if you're making modifications to the program you will have read the help documentation first! Richard. Re: BBC BASIC for SDL 2.0 v0.20a released Richard Russell So that I can 'put it to bed' I've made f2 'zoom out', Shift+f2 'zoom in' and implemented Ctrl+mousewheel when running in Windows, Linux or Mac OS (not that you would normally run touchide on a desktop machine, but you can). I have no idea whether the Ctrl+mousewheel will work in Android. Richard. Re: BBC BASIC for SDL 2.0 v0.20a released Mark Hannah <mark-hannah@...> Hi I purchased BBC4W when it first became available as I was interested in web data scraping and thought I could extract data from web elements using BBC code. I have since discovered Python and Ruby do this. I would like to web scrape using BBC as I don't want o learn a new programming language at this time. Can you tell me if data scraping web pages is possible using BBC4W and if so can you provide a link to tutorials. Thanx I have been using Autohotkey com objects to achieve this thus far:- eg.. Var:= pwb.document.getElementsByClassName("tv-symbol-header-quote__value tv-symbol-header-quote__value--large js-symbol-last")[0].innerText all help to do this via BBC4W would be much appreciated Mark. From: bb4w@groups.io <bb4w@groups.io> on behalf of Paul Marshall <paulmarshall2020@...> Sent: 06 February 2018 17:03 To: bb4w@groups.io Subject: Re: [bb4w] BBC BASIC for SDL 2.0 v0.20a released On Tue, Feb 6, 2018 at 06:09 am, Richard Russell wrote: why wouldn't you want to reserve f5 for 'Step Line' and f6 for 'Run to Cursor' and the rest? I didnt think about, i dont use those keys whereas f3 is widely used in many programs for Find Next and I use it all the time. Perhaps you might want to consider f2 for zoom out and Shift+f2 for zoom in, or some similar combination that only 'uses up' one function key. One nice possibility would be CTRL - Mousewheel which zooms several programs I use regularly. The trouble with f keys is knowing that the functions are there. Ideally I would like to be able to set a default font size. Why, given that the size is remembered? I didnt know that until today when I saw CFGfile$ !

Anyway           WHEN 146: Zoom% +=1001
WHEN 148: Zoom% -=1001
works, thank you.

Re: BBC BASIC for SDL 2.0 v0.20a released

Richard Russell

On Wed, Feb 7, 2018 at 04:39 am, Mark Hannah wrote:
I purchased BBC4W when it first became available

The thread to which you are replying is not connected with 'BBC BASIC for Windows', it is announcing a new release of 'BBC BASIC for SDL 2.0', so I think you are posting in the wrong place.  If your question relates specifically to BB4W, please start a new topic (and even if it is about BBCSDL, I think the subject matter deserves its own topic anyway).

Can you tell me if data scraping web pages is possible using BBC4W
and if so can you provide a link to tutorials.

It's certainly "possible" (almost anything is!) and indeed I've done it myself, although I 'cheated' by using BBC BASIC to automate Internet Explorer!  You may prefer to do it via a more direct route such as API calls to Windows DLLs.   But there are too many different possible approaches for you to find a tutorial that covers it I expect.

Assuming the web pages you want to 'scrape' are pretty straightforward (by which I mean not dependent on JavaScript to deliver dynamic or interactive content, and the like) I would be inclined simply to download the page(s) to a local file and then parse the contents of that file.  The Wiki covers downloading from a URL in some detail.

Richard.

BBC BASIC for SDL 2.0 v0.20a on macOS

Rob McKay

Hi Richard,

Thank you for all of your hard work in making BBC BASIC for SDL.

I have a couple of niggles with BBC BASIC for SDL 2.0 on macOS.

The first on is that it uses the Ctrl key, rather than the Cmd key for keyboard shortcuts like copy and paste.

The second is that keyword shortcuts such as P. for PRINT don't seem to work.

Regards,

Rob

Re: BBC BASIC for SDL 2.0 v0.20a on macOS

Richard Russell

On Sun, Feb 11, 2018 at 09:25 am, Rob McKay wrote:
it uses the Ctrl key, rather than the Cmd key for keyboard shortcuts like copy and paste.
All the editions of BBCSDL - Windows, Linux, Mac OS, Android, Raspberry Pi - share the same code and it's the responsibility of the SDL 2.0 'abstraction layer' to determine how it maps to the specific features of each platform.  If the usual convention is for the Ctrl key in Windows and Linux to map to the Cmd key in Mac OS then SDL would need to do it, but evidently it doesn't.  If you feel really strongly about it I suggest you raise the issue at the SDL forum.

The second is that keyword shortcuts such as P. for PRINT don't  seem to work.
They don't work in BBC BASIC for Windows either, in the (common) situation in which the 'Accept Keyword Abbreviations' option is disabled.  The main reason is that keyword abbreviations conflict with the structure syntax.  For example suppose one defines a structure P thus:

DIM P{member1, member2}

Then to initialise the members of the structure one would do something like:

P.member1 = one
P.member2 = two

But of course if keyword abbreviations were enabled those would expand to:

PRINTmember1 = one
PRINTmember2 = two

which makes no sense.  But, as I always say, one reason why the BBCSDL IDEs are written in BASIC is to allow individual users to tailor them to their own requirements.  If you feel that accepting keyword abbreviations is more important than compatibility with structure syntax feel free to modify the code yourself.

Richard.

Testers wanted

Richard Russell

I am developing a software tool which will automatically convert a BBC BASIC program to an Android app. My objective is to make it as straightforward to create an APK file for Android as it is to create an EXE file for Windows using BB4W! Enough of it is working to give me confidence that I will succeed: here is an APK for David Williams' Forces of Darkness game that I made this way (40 Mbytes):

http://www.rtr.myzen.co.uk/FOD.apk

Because the user-interface is such an important aspect of the program I would like to invite people to try it out and give me their feedback before it is formally released. The prerequisites are that you must have written a BBC BASIC program which you have confirmed works on an Android device (using BBCSDL), and that you have a relatively modern Windows PC which has Java 1.7 or later installed (or on which you are happy to install Java).

If you would like to volunteer let me know.

Richard.

Re: Testers wanted

Storer, Darren

Hi Richard,

This is exciting news!

Yes, I would like to test the Androip app converter and I confirm that I have all the prerequisites.

Many thanks

Darren

On 12 February 2018 at 00:44, Richard Russell <news@...> wrote:
I am developing a software tool which will automatically convert a BBC BASIC program to an Android app. My objective is to make it as straightforward to create an APK file for Android as it is to create an EXE file for Windows using BB4W! Enough of it is working to give me confidence that I will succeed: here is an APK for David Williams' Forces of Darkness game that I made this way (40 Mbytes):

http://www.rtr.myzen.co.uk/FOD.apk

Because the user-interface is such an important aspect of the program I would like to invite people to try it out and give me their feedback before it is formally released. The prerequisites are that you must have written a BBC BASIC program which you have confirmed works on an Android device (using BBCSDL), and that you have a relatively modern Windows PC which has Java 1.7 or later installed (or on which you are happy to install Java).

If you would like to volunteer let me know.

Richard.

Re: Testers wanted

Paul Marshall

On Sun, Feb 11, 2018 at 04:44 pm, Richard Russell wrote:
you must have written a BBC BASIC program which you have confirmed works on an Android device (using BBCSDL),

I have only one such program (apart from Dibley) but I would be pleased to volunteer as a tester.  I'm on Java 1.8.

There is another program on the way, it works in SDL but I have to convert some right mouse clicks into some other gesture.
Paul.

Re: Testers wanted

Richard Russell

On Mon, Feb 12, 2018 at 01:43 am, Paul Marshall wrote:
I have to convert some right mouse clicks into some other gesture.
Most commonly this is 'long press' (press and hold).

The BBC2APK tool isn't ready yet but I'll be in touch when it is.

Richard.

Re: Testers wanted

J.G.Harston

Richard Russell wrote:
If you would like to volunteer let me know.
I've just done a refresh of my BB4W and BBCSDL on my laptop and my Android thingy to test coding on it. The programs I've been testing work so far in the main, but there are a few issues mainly with the environment they are running in.

A few of some of them expect command line parameters (eg AsmPDP). I've been trying to write a sort-of shell so these programs can be given parameters to run with.

Most expect that *Quit takes you back to somewhere where you can run another program, or to a caller.

It's frustrating that *Quit takes me back to the Android main screen and I have to re-run Basic, I've just accidently done it again just now when testing. It then means having to restart Basic and trekking all the way through the filesystem to find my files again.

My file picker defines a key to re-CHAIN itself in a similar way that the ones supplied do, but it's so easy to forget to press it and stop your muscle memory typing *Quit, and that's no help for programs that are coded to exit with *Quit. It's not a very satisfactory solution to rewrite everything to include something like:

IF on this one envirotnment THEN do something complicated ELSE *Quit

It would be more useful if *Quit could be definable to do something specific to the platform so it could configured to do, eg, 'sdlbbc path\to\myfilepicker.bbc'. Then I would be back to an environment where I could continue navigating and selecting/editing/running programs. Comparable to working on a desktop where you effectively get back to a filer window where you can continue navigating, or even old-style returning to a command prompt and continue *DIR, *CAT, LOAD, RUN, etc.

Another annoyance is that *Quit takes me back to some unknown part of the filesystem that I have to navigate out of to find my files, though this is probably an Android issue. I have to go to @usr\..\..\..\..\ to find the visible part of the filesystem.

I transfered a bunch of code onto my tablet by plugging it into my PC as a storage device and copying things to \Downloads\Basic. However, when Basic starts I have to navigate out of where it starts to find \Downloads\Basic, and when I forget and use *Quit to exit a program I have to go all the way through again. I tried to copy my files into where Basic starts up, intending to add a 'mycode' directory to 'examples', but it I can't find its location. It seems to be "above" the root directory that is visible when transfering data over. I can navigate to it on the tablet with the various BBC BASIC file pickers, but can't navigate to it from an environment where I can copy and move files around.

--
J.G.Harston - jgh@... - mdfs.net/jgh

J.G.Harston

I was playing around with Bedstead font in some documentation I was editing yesterday, and remembered a post that it now came with BB4W. (Bedstead is the SAA505x MODE 7 font)

A quick test and it looks just perfect. However, using it drops characters. The following test program shows this:

MODE 7
PRINT ''''''
FOR A=32 TO 126:VDU A:NEXT A:PRINT
FOR A=0 TO 24:PRINT TAB(A,A);CHR$(129+(A MOD 7));"line ";A;CHR$135;:NEXT A

Thirteen characters disappear off the right side of the screen, giving:

!"#$%& line 7 /0123456789:;<=>?@ABCDEFG UVWXYZ<\ line 8 efghijklmnopqrstuvwxyz\| line 9 instead of: !"#$%& line 7 /0123456789:;<=>?@ABCDEFG
HIJKLMNO line 8 XYZ<\>^_£abcdefghijklmno
pqrstuvwx line 9

I updated BB4W this morning to do these tests, so running on BB4W 6.11a (also tested on a test copy of 5.95).

SDL BASIC 0.20 for Windows gives No such font.

--
J.G.Harston - jgh@... - mdfs.net/jgh

Richard Russell

On Mon, Feb 12, 2018 at 06:27 am, J.G.Harston wrote:
Thirteen characters disappear off the right side of the screen,
Traditional teletext displays (i.e. on TV sets) have an aspect ratio much closer to 1:1 than the 4:3 aspect ratio of MODE 7, therefore the characters in the Bedstead font are also narrower: 12 pixels rather than the 16 pixels expected by MODE 7.  That means that about 53 characters rather than the usual 40 'fit' across the width of the screen; you can see this directly if you select MODE 6 rather than MODE 7.

In MODE 7 the character positioning is not determined by the character width (it is fixed at 40 characters per line) but the automatic end-of-line wrapping still is, which is why 13 characters are 'missing'.  One solution is to use the 'Bedstead-ext' font, which has the wanted 16-pixel width; had you checked the fonts supplied with BBCSDL you would have found that 'Bedstead-ext.otf' is included but 'Bedstead.otf' isn't.

Another solution is to force the character width to 16 pixels, overriding the value in the font file itself.  Generally you have to force the height anyway, in BB4W, because of the DPI issue (the font size is set in 'points' and the relationship between 'points' and 'pixels' depends on the DPI).  This code does both:

MODE 7
@vdu%!220 = -20 : REM Force character height to 20 pixels
@vdu%!216 = 16  : REM Force character width to 16 pixels

PRINT ''''''

FOR A=32 TO 126:VDU A:NEXT A:PRINT
FOR A=0 TO 24:PRINT TAB(A,A);CHR$(129+(A MOD 7));"line ";A;CHR$135;:NEXT A

Richard.

Re: Testers wanted

Richard Russell

On Mon, Feb 12, 2018 at 06:26 am, J.G.Harston wrote:
Most expect that *Quit takes you back to somewhere where you can run another program, or to a caller.
I never use *QUIT (in fact I'd forgotten that the command even existed) because it's synonymous with the QUIT statement in BASIC.  In the official RISC OS manual for BBC BASIC the action of the QUIT statement is specified as "leaves the BASIC interpreter" which is exactly what it does in both BB4W and BBCSDL.

If the interpreter has been invoked from an IDE then it's reasonable that QUIT should return to the IDE, which again is exactly what it does in BB4W and the desktop editions of BBCSDL.  If it's been invoked from a command prompt, QUIT returns to the command prompt.  But when BBC BASIC has been invoked from the desktop QUIT returns to the desktop, and since it's the only way it can be invoked in Android that's what happens!

> It would be more useful if *Quit could be definable to do something specific to the platform

I don't see how it could ever do anything "different" from exiting the interpreter; you can't even assume that the interpreter is in a 'fit state' to do anything else (the QUIT might have been issued from a 'fatal error' handler). The responsibility for what happens after the QUIT properly belongs to the program that invoked the interpreter in the first place. In an ideal world the Android edition of BBC BASIC would work the same way as the desktop editions, in which the IDE runs as a separate process, but I've no idea how to do that or indeed whether it is even possible.

Quit takes me back to some unknown part of the filesystem

It doesn't take you "back" anywhere because Android doesn't have the concept of 'current directory'. That's why all paths need to be absolute (i.e. typically prefixed with @dir$, @lib$ etc.) in an Android-compatible BBC BASIC program.

Richard.

Re: Testers wanted

I would very much like to do this kind of thing. I don’t yet have the Android device I’ll be using (the Gemini PDA, on its way to me from China) but once I do and I have figured out how to use Android, I have any number of things I’d like to make into Android apps. So I’ll watch this space.

Wikispaces is closing down

Richard Russell

Wikispaces (who host the BB4W and LBB wiki) are closing down later in the year; here is the official announcement.

The two big advantages of Wikispaces over most other wiki hosting sites are the freedom from advertisements (and therefore the uncluttered nature of the pages) and the syntax colouring; it is the only wiki I know that supports syntax colouring for BBC BASIC.

We have discussed our options before, when Wikispaces introduced an annual subscription, but the very fact that people have been prepared to pay shows that no entirely satisfactory alternative has been identified.

Richard.

Re: Wikispaces is closing down

Alex Farlie

So you are aware i have no objection to my content contributions to this site being archived in appropriate form.

Re: Wikispaces is closing down

Storer, Darren

Hi Richard,

Would it be possible to provide an archive of the BB4W Wiki before it closes? Some time ago I seem to remember a thread about requesting access to an archive but I'm happy to make my own if there is a simple procedure.

Many thanks

Darren

On 12 February 2018 at 16:47, Richard Russell <news@...> wrote:
Wikispaces (who host the BB4W and LBB wiki) are closing down later in the year; here is the official announcement.

The two big advantages of Wikispaces over most other wiki hosting sites are the freedom from advertisements (and therefore the uncluttered nature of the pages) and the syntax colouring; it is the only wiki I know that supports syntax colouring for BBC BASIC.

We have discussed our options before, when Wikispaces introduced an annual subscription, but the very fact that people have been prepared to pay shows that no entirely satisfactory alternative has been identified.

Richard.

Re: Wikispaces is closing down

Richard Russell

On Mon, Feb 12, 2018 at 10:16 am, Storer, Darren wrote:
I seem to remember a thread about requesting access to an archive but I'm happy to make my own if there is a simple procedure.
I think we established fairly recently that Wikispaces at some point 'changed the rules' and only an organiser (which means me or Jonathan) can initiate an export.  But before doing that we need to know in which format it will be most useful (there are nine different formats on offer!) and that in turn depends on where we propose to move it, if anywhere.  Previous attempts at making a decision have not got very far, but of course then we had the option of sticking with Wikispaces - at a cost.  Now we don't.

Richard.

Re: Testers wanted

Richard Russell

On Mon, Feb 12, 2018 at 01:43 am, Paul Marshall wrote:
I have only one such program (apart from Dibley)
Here's an APK of Dibley made using the new tool in its incomplete state:

https://www.dropbox.com/s/muu8sr9ffurjweg/dibley.apk?dl=0

It was actually a valuable test because it showed that the Java tool I am using can't cope with files or directories starting with a 'dot' (which the resources directories .Demo, .Graphics and .Levels do in their BBCSDL forms).  I had to get rid of the dots to allow the APK to build; no great hassle but certainly something to be aware of.

Richard.