My "from PACKAGE import *" (Python) simulation project (reflection)

Anything QL Software or Programming Related.
Derek_Stewart
Font of All Knowledge
Posts: 4727
Joined: Mon Dec 20, 2010 11:40 am
Location: Sunny Runcorn, Cheshire, UK

Re: My "from PACKAGE import *" (Python) simulation project (reflection)

Post by Derek_Stewart »

Hi,

With regards, to numberless boot programmes, I asked Laurence Reeves at a Quanta Workshop I organised in 1993, in Whitley Bay, Newcastle Upon Tyne, about numberless programmes, he seemed non-committal and seemed to like the idea, but maybe the control structures would have problems.

I stopped using this in SMSQ/E, where various experts said it was a bug fix, sorry I forget who, too many years ago.

I am interested in this Simulation Project, and it is refreshing to talk to professional people like Peter, who can programme computers correctly, I mean criticism.

Not a STOP statement, maybe PAUSE 10e100


Regards,

Derek
User avatar
tofro
Font of All Knowledge
Posts: 3112
Joined: Sun Feb 13, 2011 10:53 pm
Location: SW Germany

Re: My "from PACKAGE import *" (Python) simulation project (reflection)

Post by tofro »

Me, personally, I see numberless BOOT programs (or numberless S*BASIC programs in general) more of an oversight sold as a "feature" (in Jan Jones' book) after the fact. But that's just an opinion fed by the hint that no original QL manual ever mentioned numberless BASIC files, and the first mention came up with the TK2 "DO" command (which used to have its own quirks in versions before 2.50). With numberless programs used with anything else but (a working) DO you can also run into all sorts of problems like files left open and be no longer editable,....

On the other hand, I have no problem if someone wants to use this quirk for something not possible otherwise - As long as it is made sure that all files are properly closed on all QDOS versions, which would be quite a feat. (As BOOT programs are, for most users, a "private thing" not distributed broadly, I'm not too fundamentalistic about that. But if you want to build a program feature based on them that could become widely distributed, you'll likely not do yourself a favour - You'll very probably produce a "works on my machine" program.)


ʎɐqǝ ɯoɹɟ ǝq oʇ ƃuᴉoƃ ʇou sᴉ pɹɐoqʎǝʞ ʇxǝu ʎɯ 'ɹɐǝp ɥO
User avatar
polka
Trump Card
Posts: 213
Joined: Mon Mar 07, 2011 11:43 am

Re: My "from PACKAGE import *" (Python) simulation project (reflection)

Post by polka »

Hum ! I did not want to show MY boot program, only to use a typical boot program as an example to show how a little "Add_Line_Numbers" FuNction could together with all the power of MERGE, MRUN etc. let develop SuperBasic programs as an assemblage of unnumbered modules that are numbered and eventually managed only with SuperBasic IF ... ENDIF ( or other...) constructs, automatically on the fly when the program is loaded, and that no other special tools would be absolutely needed than those provided by BBQL SuperBasic + TK2.

The benefit being that everything is SuperBasic and thus remains individually small, readable and easily editable.


May the FORTH be with you !
POLKa
User avatar
ql_freak
Super Gold Card
Posts: 502
Joined: Sun Jan 18, 2015 1:29 am

Re: My "from PACKAGE import *" (Python) simulation project (reflection)

Post by ql_freak »

Finally I have found time to correct my reflection_cde toolkit :-)

Much thanks goes to Per Witte, who found and corrected a lot of bugs and provided a SuperBASIC test program. With the versions which were downloadable here until now, this program will fail (or even crash?) with out of memory.

Warning: It is under development, the only functions currently working are:

REF_GETLNLO% Returns the lowest line number of currently loaded SuperBASIC program.
REF_GETLNFREE% Returns the first "free" (lowest not yet used) line number (REF_GETLNHI%) of currently loaded SuperBASIC program
REF_GETLNHI% Returns highest line number of currently loaded SuperBASIC program (for Derek, I don't know why it should be useful, is the same as REF_GETLNFREE%-1)

Please note, except for merging REF_GETLNFREE% can be used to end your program with GO TO REF_GETLNFREE%

DO _N_O_T_ use the other function (REF_L%), it will not work and may (will?) crash your machine.

You also should not use the one PROCedure, albeit it does nothing, except slow down (most probably not notable) your program, it does currently nothing. I'm working on REF_L%. When I have finished, I will publish the source.

Included is also the current version of the executable rn program (it should be reentrant and if EJC documentation is correct even ROMable as it is compiled with EJC), which renumbers text files with or without line numbers (even mixed), but _N_O_T_ included GO TO and GO SUB statements(!). Look at examples from me in this thread, how you can combine this with REF_GETLNFREE% to merge any SuperBASIC (without GO TO or/and GO SUB statements!) program or command line file with your program, without the need to renumber the merged or your program. I will publish the source code of rn shortly (must refactor it before it can be published).

This may be useful for BBQLs with just Microdrive mass storage, as your stored programs must not include all the stuff needed at runtime, but can MERGE common routines when it runs (see examples from me in this thread).

tstreflect_bas is the test program from Per for reflection_cde (you should rename reflection0v1v0_cde to reflection_cde and use the original filename only for backups (so that you must not look inside the _cde file to find the version number).

rnTestFile01_bas (it is not a valid BASIC program!) is for testing the rn program with e.g.:

ex'rn';'10000 5 <WIN1_tmp_rnTestFile01_bas >WIN1_tmp_DELETE_ME'
Attachments
reflectRn.zip
(8 KiB) Downloaded 6 times


http://peter-sulzer.bplaced.net
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX :-)
User avatar
ql_freak
Super Gold Card
Posts: 502
Joined: Sun Jan 18, 2015 1:29 am

Re: My "from PACKAGE import *" (Python) simulation project

Post by ql_freak »

Derek_Stewart wrote: Tue Jun 03, 2025 11:47 am I would prefer all S*BASIC programmes to numberless, and all programming could structured.
From what I have seen (determined) when developping reflection_cde SuperBASIC does NOT (not even in its tokenized form!) require line numbers. When I have finished reflection_cde (one PROC and one FuNc are still missing, before the 1.0 [or better 0.99] version), I will try to poke a tokenized numberless program into the BASIC-area, adjust the BASIC and System variables and try to run it.

Even if the interpreter will not run it or even the QL will crash:

It should be very easy to extend the interpreter so that it can run BASIC programs without line numbers (albeit ED would most probably not work with those programs and must also be extended, this could be a bit more complicated). The line numbers are really only required for GO TO, GO SUB, ... If you don't use it, it's absolutely not required. E.g. Python has no GO TO and more worse, it has no possibility to exit from an inner loop out of an outer loop (no problem in SuperBASIC, every loop has a name so you could use exit LOOPNAME (which is a kind of GO TO).


http://peter-sulzer.bplaced.net
GERMAN! QL-Download page also available in English: GETLINE$() function, UNIX-like "ls" command, improved DIY-Toolkit function EDLINE$ - All with source. AND a good Python 3 Tutorial (German) for Win/UNIX :-)
Post Reply