Glad to announce that all my QL programs may now also been found on the excellent Dilwyn's download page, which lists (nearly) all freely available programs for the Sinclair QL :-)
Warning: Program runs currently only on the Sinclair QL Emulator QPC2 for Windows, eventually also on other SMS/SMSQ-Systems. I have tested it now with the Windows Subsystem for Linux (WSL - thank you Microsoft) on the UNIX-/Linux-QL emulator uQLx with Minerva 1.98. Crashes horrible, not even the Sysmon is howling
string$=GETLINE$([#ch] | [#ch,][maxlen[,lf]])#ch:
SuperBASIC channel number. Default: #1
Maximum length of returned string (130 to 32766). If the value is outside this range it will automatically increased / decreased.(Warning: values greater than 32767 abort with "error in expression"). Default: 258
If lf is equal 0 the trailing newline will be stripped and not returned. Default: 0
Returned string with maximum length between 0 to maxlen.
If the last char of the "file" is a newline (LF) it will always be returned (else the user has no chance to detect if the last char was a newline). If a line is longer than maxlen chars, only the first maxlen chars will be returned, and the remaining chars at the next call of GETLINE$(). This is problematic if lf is 0 (you cannot detect if there was an LF at the end). So lf=0 should only be used for text files or console channels (windows), not for binary files.
GETLINE$() is a machine code extension for the QL inbuilt SuperBASIC and must once be initialised before it will be used. If SuperToolkit II is installed (as in the QPC2 QL emulator program) this may be achieved with:
address=RESPR(616): LBYTES getline_bin,address: CALL address
On real QLs this is only possible if no executable program is running beside the SuperBASIC interpreter (which is always running). Ideally such extensions (Toolkits) are loaded (initialised) in your boot program. On old QDOS versions (up to JM) after loading the extension you must enter NEW (extension cannot be used in the program in which it is loaded).
GETLINE$() reads from the current file position to (inclusive) the next newline char and returns this as a string. The last character (the newline) will be stripped if the parameter lf is 0 (or not passed). In contrast to e.g. the INPUT command of SuperBASIC GETLINE$() does not break with "End of file" error, if the last char of a file is no newline char (but see below).
Before calling GETLINE$() you must always test for EOF(). If the file pointer is already at the end of file and you call GETLINE$(), SuperBASIC breaks with the error message "End of file". If the value of lf was 0 (or was not specified), you should test for EOF() after the call. If EOF <> 0 you should test if the last char is a LF, and what to do, if it is.
It is strongly recommended to use no values less than 0 or greater 32766 for the parameter maxlen. This may lead to unexpected behaviour or even errors in future versions.
The ZIP archive should be unpacked on a QDOS system, cause QL files have a fileheader which will be lost on other systems. Albeit not so important for this package, as there is no executable file included.getline.zip as ZIP archive for QDOS / SMSQ/E
(458 x downloaded)
Source code is included. The program is licensed under the GNU General Public License version 1 or newer. I.e. if you change the program and publish it, you must publish it under the GPL version 1 or newer. Exception: If you want to include GETLINE$() into another free (no cost) Toolkit for QDOS or compatible system, you are allowed to include it there, without the need to change the license under which this toolkit is released. See http://www.gnu.org/licenses/gpl-1.0.html, http://www.gnu.org/licenses/gpl-2.0.html oder http://www.gnu.org/licenses/gpl-3.0.html).
ls Program for QDOS (similar to UNIX ls)
I have found this old program from me (it's from 1992). It was created with C68 Version 2.0. Unfortunately I cannot find a description/manual for it. What I have detected so far:
Call with (e.g.):
ex'ls':REMark prints the current DATA_USE directory in a new window (window will be destroyed after you press Enter or space, as usual with C68 windows)
ex'ls',#1:REMark prints the current DATA_USE directory to SuperBASIC channel #1
ex'ls';'-l WIN1_etc_':REMark prints the directory WIN1_etc_ with detailed information. All file header information is output: File type, file length, file dataspace, update date, backup date, file version. Unfortunately I don't know some of the output data.
You get a short help with:
if you want to print this to a file use (e.g.): ex'ls';'-? >RAM1_ls_txt':REMark the ">file_name" may always be used to redirect the output to a file.
The archive includes the source plus the required module cndate_o (C68 object file) for which I cannot find the source unfortunately.
As this archive includes an executable QDOS program, it must be unzipped on a QDOS (compatible) system, else the necessary fileheader will be lost.ls.zip as ZIP archive for QDOS / SMSQ/E
Program is published under the GNU General Public License (GPL) version 1 or newer. See above for links to this license.
DIY Toolkit EDLINE$() Function Improved
Improved version of DIY Toolkit EDLINE$ function (SMS/Minerva-Version) from Simon N Goodwin and Laurence W Reeves.
Documentation of (original) EDLINE$(#ch,maxlen%,edit$) function may be found here. Note: In my version Cursor Up/Down won't jump to start/end of string, as documented, it is simply ignored. On Minerva and SMSQ/E (i.e. QPC2) you may use ALT + Cursor Left/Right instead, but ESC (only supported on Minerva and some versions of SMSQ/E) is ignored. The latter could eventually be incompatible with existing code.
If called with 3 parameters (no defaults for the first three parameters, as in original version) it behaves (nearly, see above) as the original DIY Toolkit function (i.e. existing code should not be broken): Only ENTER allowed for terminating editing, the string is returned without the terminating character. I have added a fourth, optional parameter. Only the first four bits are used, and at least one bit must be set. I.e. range is from 1 to 15 - this is checked, if outside you get a bad parameter error (I should correct this to out of range).
|Bit (set)||Allowed key for terminating editing|
|0 (value 1)||ENTER CHR$(10)|
|1 (value 2)||ESC CHR$(27) (works only in Minerva and some SMS versions)|
|2 (value 4)||Up Arrow (cursor up) CHR$(208)|
|3 (value 8)||Down Arrow (cursor down) CHR$(216)|
Example: If user-input should accept ESC and ENTER you must use the value 3 for the 4th parameter: ENTER allowed: 1 (value 1) plus ESC 2 (value 2) => 2 + 1 results in 3.
When used with the 4th parameter, the terminating character is the last character of the returned string and must normally be stripped. Therefore 2 support functions are included in the toolkit:
lastChar=EDLINEL(string$) returns the character code of the last character in a string or -1 for a zero length string
humanString$=EDLIN$(string$) strips the last character of string$ and returns it. For a zero length string, a zero length string is returned.
The archive includes two SuperBASIC examples, which show how you can use it. As most of the work has been done by Simon and Laurence, it is published under the same license as the original DIY-version.edline.zip as zip archive for QDOS / SMSQ/E