Pi RISCOS BASIC- bug??
John Fisher (1728) 2 posts |
Very happy with the Pi image, and was looking forward to re-acquainting myself with RISCOS BASIC 5. But… are there known bugs?? ON ERROR REPORT: PRINT ’" Error type "; ERR; “ at line ”; ERL: END REPEAT |
Martin Bazley (331) 379 posts |
As you have just discovered, the interpreter on this forum is a travesty and prone to mutilating code such as that posted above (check out the line apparently reading "split = INSTR"). In future, always surround with <notextile> and <pre> tags (and don't think too hard about how I just got those to show up). To fail to answer your question in a different way, what are those REPEAT and UNTIL TRUE lines for? You do know that's a no-op, right? To answer your question with a question, did you copy that code from Rosetta Code with NetSurf? You should know that it's prone to inserting hard space (&A0) characters instead of normal space (&20) characters, which BASIC will disagree with badly. Do a search and replace in your editor to make sure there aren't any. (You can type a hard space at the keyboard by holding down Alt as you press Space.) Finally, unless this is the forum's fault again, isn't there supposed to be a second closing bracket after the "split-1" in the REMmed-out line? I get a type error if I use the code you posted as well, and no wonder, as you're adding a string ("LEFT$(q$,split-1)") to a number ("VAL(MID$(q$,split+1))"). If you say that was accepted in direct command mode, I don't believe you. It certainly isn't here, but works if I insert the extra bracket. I think we can chalk this one up as yet another cautionary tale in the thick compendium of, "Even when you think it's got to be the computer's fault and not yours, 99% of the time, you're wrong." |
Andrew Daniel (376) 76 posts |
The corrected listing works fine on OS 4.02 and the latest IOMD 5.19 rom on RPCemu. Corr, takes me back to the days of typing in magazine listings! The code within a REPEAT UNTIL loop will execute at least once even if the UNTIL condition is TRUE, I think FALSE is what you want. :) When I first got my Beeb and telesoftware on CEEFAX was *EXEC’ed, I tried to type in a listing off there (never did get it to work!). It wasn’t easy as I only had the one portable tv. |
John Fisher (1728) 2 posts |
Thanks guys. (The ‘until true’ was of course just so it didn’t loop while testing. Nul loops execute once only) Yes the pairing of brackets in the REMmed line was wrong as shown. Messed it in testing where the error was, when I split that line into two, then incorrectly put back to two. Since still REMmed I missed it. I won’t bore you with a screengrab- but I actually took one showing the situation, before posting. I now realise that the failure of instr( to correctly return the split position was throwing the left$( when supplied a negative parameter. But that’s not what the error messages said… |
Steve Pampling (1551) 8170 posts |
Well on windows pc’s for a start1. At work if I pull code of any description, or even what seems to be plain text, I drop it into a plain text editor to check for control code rubbish and then pass it on to another application, the intermediate stage being purely to rip out the control codes. 1 It’s one of a number of web related traps I talk about at work, only to have peoples eyes glaze over. But then they come running when things don’t work. |
Steve Fryatt (216) 2105 posts |
NetSurf uses hard spaces a lot in its formatting, when the HTML context requires it. There are plenty of situations when restoring “normal” spaces for the clipboard would be undesirable (such as when copying the result of “RISC OS” from a web page).
It’s worth pointing out that BB4W is not ARM BASIC. The is especially true of some of RTR’s more gnomic code snippets, which have a tendency to use the documented (and so fair game) underlying structures of the language which are massively different from those in the RISC OS version. |
Michael Drake (88) 336 posts |
We recently changed this. So spaces in white-space:pre styled text aren’t now converted to non-breaking spaces. |
Steve Revill (20) 1361 posts |
Woohoo! That was probably the most maddening feature of NetSurf, IMO. |
Matthew Phillips (473) 721 posts |
Yes, this NetSurf feature caused me to change Impact’s scripting language interpreter to accept hard spaces as equivalent to ordinary spaces. This was after I tried copying and pasting from the examples in the HTML-based manual! |