Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.acorn.programmer > #5485

Re: Testing from a BASIC program the existence of a module

Path csiph.com!feeder.erje.net!2.eu.feeder.erje.net!ecngs!feeder2.ecngs.de!proxad.net!feeder1-1.proxad.net!cleanfeed2-b.proxad.net!nnrp3-2.free.fr!not-for-mail
From "John Williams (News)" <UCEbin@tiscali.co.uk>
Subject Re: Testing from a BASIC program the existence of a module
Newsgroups comp.sys.acorn.programmer
Date Fri, 20 Jul 2018 17:48:00 +0100
Message-ID <571aa88b3dUCEbin@tiscali.co.uk> (permalink)
References <2c617d2a-d8ae-45e3-b90b-4845c5eb243a@googlegroups.com>
User-Agent Pluto/3.16 (RISC OS/5.25) NewsHound/v1.52-32
Organization League of Underpaid, Overworked, Undervalued, and Overwhelmed
X-Disclaimer I reserve the right to be wrong!
Reply-To UCEbin@tiscali.co.uk
Lines 46
NNTP-Posting-Date 20 Jul 2018 18:48:06 CEST
NNTP-Posting-Host 81.155.66.107
X-Trace 1532105286 news-2.free.fr 5487 81.155.66.107:50739
X-Complaints-To abuse@proxad.net
Xref csiph.com comp.sys.acorn.programmer:5485

Show key headers only | View raw


In article <2c617d2a-d8ae-45e3-b90b-4845c5eb243a@googlegroups.com>,
   Xavier Louis Tardy <xltardy@gmail.com> wrote:

> As the title says, how can I test, from BASIC, the existence of a module ?

> I'd like a real test for existence please, not a call and handling an
> error returned if the module is not present. Thanks in advance.

Normally one would use the OS command RMEnsure in a Run file to check for
the presence of a module and this allows a command to be executed if it's
not present.

Normally this would be a command to RMLoad the module.  But it could be
anything.  It could be to raise an error, but it could be something else

You obviously have some reason for doing this from within a BASIC program,
whether multi or single-tasking.

I think if I had this problem I would call an Obeyfile from within the
BASIC and get it to set a system variable depending on the result.

When this OSCLI command returned to BASIC I would interrogate the system
variable using a routine such as this:

  :
  DEF FN_readsysvariable(sysvar$)
  SYS"OS_ReadVarVal",sysvar$,block%,255,0,3 TO ,,val%
  block%?val%=13
  val$=$block%
  =val$
  :

Note that this requires a variable block% to have been dimensioned to size
255.

You then treat the returned string as a flag and do whatever you wish with
it.

This avoids the error scenario as you wish.

John

-- 
John Williams, now back in the UK - no attachments to these addresses!
Non-RISC OS posters change user to johnrwilliams or put 'risc' in subject!
Who is John Williams? http://petit.four.free.fr/picindex/author/

Back to comp.sys.acorn.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Testing from a BASIC program the existence of a module xltardy@gmail.com - 2018-07-20 01:40 -0700
  Re: Testing from a BASIC program the existence of a module Vince M Hudd <atdotcodotuk@dotcodotukat.co.uk> - 2018-07-20 11:08 +0100
  Re: Testing from a BASIC program the existence of a module "John Williams (News)" <UCEbin@tiscali.co.uk> - 2018-07-20 17:48 +0100
    Re: Testing from a BASIC program the existence of a module Vince M Hudd <atdotcodotuk@dotcodotukat.co.uk> - 2018-07-20 18:58 +0100
      Re: Testing from a BASIC program the existence of a module "John Williams (News)" <UCEbin@tiscali.co.uk> - 2018-07-20 19:47 +0100
    Re: Testing from a BASIC program the existence of a module Steve Fryatt <news@stevefryatt.org.uk> - 2018-07-20 20:01 +0100
      Re: Testing from a BASIC program the existence of a module lydia.harston2@gmail.com - 2018-07-21 08:53 -0700
        Re: Testing from a BASIC program the existence of a module Vince M Hudd <atdotcodotuk@dotcodotukat.co.uk> - 2018-07-21 22:28 +0100
          Re: Testing from a BASIC program the existence of a module lydia.harston2@gmail.com - 2018-07-22 04:01 -0700

csiph-web