Lee,

in case your question is really only Turbo Toolkit specific, you can very well 
do away with a much simpler solution than WHEN ERRor clauses:

1000 IF TK_VER$ <> "" 
1010   REM do whatever you want to do when Turbo Toolkit is loaded
1020 ELSE
1030  REM Do whatever you want to do if it is not loaded
1030 END IF

This relies on the fact that the interpreter will interpret TK_VER$ as a 
FUNCTION returning a string in case the toolkit is loaded, and an unset string 
variable in case it is not. And unset string variables are by convention 
"empty".

Tobias


> Am 17.08.2017 um 12:37 schrieb Lee Privett via Ql-Users 
> <ql-users@lists.q-v-d.com>:
> 
> Perhaps I should clarify this a little further.
> 
> Using Q-emuLator, my boot first loads SMSQ_QEM and restarts with the same
> boot, I will always do this or use QPC2, I am not really looking for a BBQL
> solution as it is development for other things.
> 
> Where this
> 
> [code]IF VER$<>"HBA" THEN
>   LRESPR "WIN8_SMSQ_QEM"
> END IF[/code]
> 
> loads SMSQ and fails the second time around (as designed, so all good) as
> the same boot loads again, I then load (still in the same boot) the
> TURBO_SMS_CODE appropriate for SMSQ based system.
> 
> This is all fine, however, I am developing the boot for different setups
> and change them a lot depending on what project I decide to work on.
> 
> This means re-running the boot several times in the one session to test
> what I am trying to do and I don't want to keep using up space re-LRESPR
> the TURBO toolkit.
> Using another toolkit to test for the existence of a keyword in the TURBO
> toolkit would then mean using another method to test for that additional
> Toolkit, a catch 22.
> 
> So I may try the WHEN_ERR method as soon as I find the documentation on it.
> 
> Lee
> 
> 
> 
> 
> Lee
> 
> 
> 
> 
> On Thu, Aug 17, 2017 at 10:49 AM, Derek Stewart via Ql-Users <
> ql-users@lists.q-v-d.com> wrote:
> 
>> Hi Tobias,
>> 
>> The WHEN solution is great, but on some version of QODS, the WHEN ERRor
>> did not work.
>> 
>> There are some people still using AH,JM, roms which may have problems with
>> WHEN ERRor
>> 
>> --
>> Regards,
>> 
>> Derek
>> 
>> 
>> On 17/08/17 10:39, Tobias Fröschle via Ql-Users wrote:
>> 
>>> 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.
>>> 
>>> Tobias
>>> 
>>> Am 17.08.2017 um 11:25 schrieb Tobias Fröschle via Ql-Users <
>>>> ql-users@lists.q-v-d.com>:
>>>> 
>>>> 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 <
>>>>> ql-users@lists.q-v-d.com>:
>>>>> 
>>>>> 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 <http://qlforum.co.uk/viewtopic.php?f=3&t=2063#>
>>>>> IF VER$<>"HBA" THEN
>>>>>  LRESPR "WIN8_SMSQ_QEM"
>>>>> END IF
>>>>> 
>>>>> 
>>>>> 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
>>> 
>>> _______________________________________________
>> QL-Users Mailing List
> _______________________________________________
> QL-Users Mailing List

_______________________________________________
QL-Users Mailing List

Reply via email to