I'm moving the discussion, otherwise we'll go OFF TOPICNormanDunbar wrote: Mon Apr 21, 2025 7:42 am Morning Derek.
https://github.com/SinclairQL/Structure ... tag/2.7.2g
2.7.2g is the latest. Details in the docs as to what changed. One thing I added that is incompatible with Tim's version,the line continuation character is "/" in Tim's but in mine it's "/+" as I often use PRINT statements with the trailing slash to get a linefeed. Those lines were combined with the next one and caused MISTakes.
Cheers,
Norm.
My "from PACKAGE import *" (Python) simulation project
- Giorgio Garabello
- Gold Card
- Posts: 299
- Joined: Tue Jun 30, 2015 8:39 am
- Location: Turin, Italy
- Contact:
Re: My "from PACKAGE import *" (Python) simulation project
Quantum Technology
http://www.hunggartorino.it/ql/language/en/
http://www.hunggartorino.it/ql/language/en/
- Giorgio Garabello
- Gold Card
- Posts: 299
- Joined: Tue Jun 30, 2015 8:39 am
- Location: Turin, Italy
- Contact:
Re: My "from PACKAGE import *" (Python) simulation project
Via FileInfo2
Giorgio
Quantum Technology
http://www.hunggartorino.it/ql/language/en/
http://www.hunggartorino.it/ql/language/en/
Re: My "from PACKAGE import *" (Python) simulation project
Derek,
My latest version is here:
http://swensont.epizy.com/ssb272.zip
Norman has expanded it with some additional features.
The documentation for 2.7.2 details how to use SSB with MicroEmacs. That document is here:
http://swensont.epizy.com/SSB.pdf
See page 26 for a macro that calls SSBGO to execute SSB while still in MicroEmacs.
Tim
My latest version is here:
http://swensont.epizy.com/ssb272.zip
Norman has expanded it with some additional features.
The documentation for 2.7.2 details how to use SSB with MicroEmacs. That document is here:
http://swensont.epizy.com/SSB.pdf
See page 26 for a macro that calls SSBGO to execute SSB while still in MicroEmacs.
Tim
Re: My "from PACKAGE import *" (Python) simulation project
It seems you are not the only one who don't understand what I want to achieve. I have now written (currently only in SuperBASIC) the function ref_getLnHi which returns the currently highest SuperBASIC line. Jan's example unfortunately didn't work, but his explanation is correct and I found the SuperBASIC program structure in Jan Jones book in appendix C.Martin_Head wrote: Sat Apr 19, 2025 10:23 am I'm not sure exactly what you are trying to do. But could you pull the 'ED' code from the SMSQ/E sources, and modify it to take it's input from a file instead of the keyboard.
So here's another example, which hopefully makes it clearer what I want (and it's working). NOTE: Preliminary version. The program to merge must currently be without line numbers. I will extend rn so that it can renumber programs with line numbers. BUT I WILL NEVER SUPPORT GO TO, GO SUB (except perhaps for a special kind of computed line numbers). As ref_getLnHi is currently written in SuperBASIC it must be (of course) normally merged. I decided to load it at 10000 and all subsequent merged programs (without line numbers) are merged after it.
- Attachments
-
- rnMergeTestFiles.zip
- other files for rnMergeTest example
- (3.41 KiB) Downloaded 6 times
-
- rn.zip
- rn (add line numbers) executable program
- (6.43 KiB) Downloaded 5 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
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

Re: My "from PACKAGE import *" (Python) simulation project
Yeah! I think I have completed the rn version which ALSO(!) accepts line numbers (it should be even possible to give it a file, where some lines have line numbers and others not) - that's really a beta version (OK in my mind but tested only once):
Edit: The Change in Source Code (rn_c):
Edit:
It was really just one fscanf() in C (eat the line number from source [SuperBASIC] file) to correct the original rn program (which only worked with BASIC files without line numbers [_bat files]).
p.s.: If it really will be working –just tested once ;‑)
Edit: The Change in Source Code (rn_c):
Code: Select all
int writeAndRenumLineNumbers(in, out, start, step)
/* Second version U N D E R C O N S T R U C T I O N ! */
FILE *in, *out; /* const */ short start, step;
{
char buf[BUFSIZE], *bp, *eob, *ibp;
int cl /* Current Line */
,noc /* Number Of Chars written */
,lim /* limit of characters which can mostly be read */
,len /* length of line read */
,oldln /* storage for (preceeding) line number in input file - NOT NEEDED (required) */
;
eob = buf + BUFSIZE; /* One char beyond last character ('\0') of buffer */
for (cl=start; cl < MAX_LINE_NO; cl += step) {
bp = buf;
/* Write line number and space: */
noc = sprintf(bp, "%d ", cl); /* */
bp += noc; /* set bp to terminating '\0' */
lim = BUFSIZE - noc; /* Max characters inclusive '\0' remaining in buf */
/* BEGIN Change 2nd VERSION */
/* TODO: Read line number from in and get position of filepointer in in after read,
then read from new filepointer the rest of line: */
fscanf(in, "%d", &oldln); /* Eat an eventually preceeding line number, we don't need it */
/* END Change 2nd VERSION */
len = getline(in, bp, lim); /* Now get the line (without line number); len: Number of chars read */
/*
It was really just one fscanf() in C (eat the line number from source [SuperBASIC] file) to correct the original rn program (which only worked with BASIC files without line numbers [_bat files]).
p.s.: If it really will be working –just tested once ;‑)
- Attachments
-
- rnWithLineNumberSupport.zip
- (6.52 KiB) Downloaded 5 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
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

-
- Font of All Knowledge
- Posts: 4656
- Joined: Mon Dec 20, 2010 11:40 am
- Location: Sunny Runcorn, Cheshire, UK
Re: My "from PACKAGE import *" (Python) simulation project
Hi,
I used to write numberless Superbasic programs in QED, on a Minerva based QL and could load the program into Superbasic and add line numbers with:
AUTO: LOAD <program>
Where <program> is a Superbasic progam without line numbers.
Due to a bug in Superbasic.
This does not work in SMSQ/E SBASIC.
I used to write numberless Superbasic programs in QED, on a Minerva based QL and could load the program into Superbasic and add line numbers with:
AUTO: LOAD <program>
Where <program> is a Superbasic progam without line numbers.
Due to a bug in Superbasic.
This does not work in SMSQ/E SBASIC.
Regards,
Derek
Derek
Re: My "from PACKAGE import *" (Python) simulation project
This is NOT a bug, it's documented in Jan Jones SuperBASIC book in Chapter 9 (page 89 in first version). And it's even better: You can write AUTO as the first line of a numberless program and then load it. Don't forget to press CTRL-SPACE (ALT-CTRL-SPACE in a Minerva MultiBASIC) after it has loaded. But this feature won't help, if you want to merge a program.Derek_Stewart wrote: Wed Apr 23, 2025 7:05 am AUTO: LOAD <program>
Where <program> is a Superbasic progam without line numbers.
Due to a bug in Superbasic.
Unfortunately SBASIC is not fully compatible to SuperBASIC. E.g. following is possible in SBASIC, gives error in expression in SuperBASIC:This does not work in SMSQ/E SBASIC.
NEW
a$=b$
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
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

-
- Font of All Knowledge
- Posts: 4656
- Joined: Mon Dec 20, 2010 11:40 am
- Location: Sunny Runcorn, Cheshire, UK
Re: My "from PACKAGE import *" (Python) simulation project
To merge a numberless Superbasic programme, just do: AUTO : MERGE <program_bas>ql_freak wrote: Thu Apr 24, 2025 6:55 amThis is NOT a bug, it's documented in Jan Jones SuperBASIC book in Chapter 9 (page 89 in first version). And it's even better: You can write AUTO as the first line of a numberless program and then load it. Don't forget to press CTRL-SPACE (ALT-CTRL-SPACE in a Minerva MultiBASIC) after it has loaded. But this feature won't help, if you want to merge a program.Derek_Stewart wrote: Wed Apr 23, 2025 7:05 am AUTO: LOAD <program>
Where <program> is a Superbasic progam without line numbers.
Due to a bug in Superbasic.Unfortunately SBASIC is not fully compatible to SuperBASIC. E.g. following is possible in SBASIC, gives error in expression in SuperBASIC:This does not work in SMSQ/E SBASIC.
NEW
a$=b$
Regards,
Derek
Derek
Re: My "from PACKAGE import *" (Python) simulation project
Following all the comments.tofro wrote: Sat Apr 19, 2025 9:48 am RENUM can very well be used in a running program - as long as you make sure the line numbers that "currently run" (i.e. the ones that actually call RENUM) don't change. You can achieve this by putting the RENUM code at the beginning of the program with increments you intend to use later. Of course it's a dirty hack, but the only method I see that does what you want from S*BASIC. But if you refuse to have your program renumbered, well you need to do it the complicated way (or you introduce a convention that makes sure all your programs and snippets have a DATA line as the last line).
Just want to remark that I was trying to merge, a line of code into a running basic program but it always failure into the missing PC. Returning to the shell.
So...
How have you make it? I mean to merge another basic program into a running one without exiting.
Thanks