After I sent this, I realised a bit of explanation might be in order, as WHEN 
ERRor is not so well-known:

When the interpreter passes a WHEN ERRor/END WHEN pair during normal program 
execution, it doesn't do anything with the commands inside the clause but 
remembering "I should do this in case an error occurs". So, line 1020 is not 
executed if no error occurs in line 1050. But in case there is an error (the 
interpreter choking on the MANIFEST statement it doesn't know when TT is not 
loaded), line 1020 is executed, telling us TT is not loaded.

After 1020 was executed, the program is continued at the point /after/ the 
error occurred.

The empty WHEN ERRor clause (1060-1070) simply de-activates error processing 
back to "normal".

Line 1080 will thus have the variable TurboTkLoaded to 1, if 1050 was executed 
without a problem, and set to 0 in case there was an error. Because we have 
made sure line 1050 is the only line that can be executed while error 
processing is active, we clearly know the only problem in 1050 can only be "bad 
name". So it is important to pick a "test command" from the toolkit you are 
testing for that cannot choke on a different error than "bad name". MANIFEST is 
pretty ideal for this.


> Am 17.08.2017 um 11:25 schrieb Tobias Fröschle via Ql-Users 
> <>:
> Lee,
> there are a number of toolkits that allow you to check for specific other 
> toolkit commands loaded or not - But this is a bit useless as it leaves you 
> with a chicken-and-egg problem: How to check whether the checking toolkit is 
> loaded?
> Your best bet on SMSQ/E would be a WHEN ERRor clause you place just in front 
> of a Toolkit command you are about to execute:
> 1000 TurboTkLoaded = 1
> 1010 WHEN ERRor
> 1020    TurboTkLoaded = 0
> 1030 END WHEN
> 1040 REMark Execute a Toolkit command
> 1050 MANIFEST : x = 100
> 1055 REMark de-activate error checker
> 1060 WHEN ERRor
> 1070 END WHEN
> 1080 PRINT "Turbo Toolkit loaded:"!TurboTkLoaded
> On a QL with non-working WHEN ERRor commands (pre-MG) you are a bit doomed, 
> the only thing I could probably come up with is writing a BASIC program that 
> PEEKs the name list, which is not quite so simple.
> Tobias
>> Am 17.08.2017 um 10:49 schrieb Lee Privett via Ql-Users 
>> <>:
>> I originally posted this on the forum:
>> Hi community, I have searched for this on the forum but cannot find an
>> entry but I am sure this has been asked before.
>> I currently test for the presence of the HBA ROM in a boot program using
>> VER$ and would like to test for other toolkits, specifically the TURBO
>> toolkit. Is there a way to do this automatically in a boot so that when
>> subsequent runs of the boot it is not loaded again in one session?
>> e.g. for the HBA version I use:
>> Code: Select all <>
>> I feel there must be a way to test for TURBO toolkit, any ideas?
>> A reply from Derek suggested  the following:
>> There is a keyword: TK_VER$, but only returns the version of Turbo Toolkit,
>> which is the same for the SMS and QDOS versions.
>> A simple way would be to add "SMS" in the version number. Which would mean
>> a new version of Turbo Toolkit.
>> The SMS version calls the SMSQ/E extended traps, where the QDOS does not,
>> so maybe a test for SMSQ/E extended traps is the way, but I would favour
>> the about alteration to TK_VER$.
>> George Gwilt used to maintain Turbo and maybe the Toolkit. I think this
>> message needs to be posted in the QL-USERS mailing list, George Gwilt reads
>> that list.
>> Any views at all?
>> Regards Lee Privett
>> _______________________________________________
>> QL-Users Mailing List
> _______________________________________________
> QL-Users Mailing List

QL-Users Mailing List

Reply via email to