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


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

Re: how to use a sysvar in Basic

From Jim Nagel <jimnewsm13c@abbeypress.co.uk>
Newsgroups comp.sys.acorn.programmer
Subject Re: how to use a sysvar in Basic
Date 2018-09-05 17:13 +0100
Organization A noiseless patient Spider
Message-ID <b8a8d93257.jim@6.abbeypress.net> (permalink)
References <d1fd503257.jim@6.abbeypress.net> <pmmdnd$14pp$1@gioia.aioe.org>

Show all headers | View raw


Steve Drain  wrote on 4 Sep:

>> [Jim wrote:] Must I convert the contents of <websiteroot$dir> to a
>> conventional Basic string?

> Yes.

>> Is there an existing elegant way of doing so?

> PRINT FNval("websiteroot$dir")

> END

> DEFFNval(v$)
>   SYS"OS_ReadVarVal",v$,END,256 TO ,v$
> =v$

> There is no check that it is a string, so a little more effort is needed
> for a general routine.

> In Basalt you can do:

> PRINT SYS("websiteroot$dir")

Thanks again, Steve.  I have now downloaded and had a play with 
Basalt.  Nice.

Found another problem in my particular situation:  the sysvar whose 
value I want to put into an ordinary Basic string variable ...
DOES NOT EXIST!  As I found by running my Basic app immediately after 
a fresh boot. I had forgotten the sysvar is set by something in my 
ordinary boot system.  Which clearly means the sysvar would not exist 
on somebody else's system if I were to distribute the program.

Before trying Basalt, in ordinary Basic I tried v$="phoney" in
     SYS"OS_ReadVarVal",v$,END,-1 TO je%,v$
because the spec said that a negative value (-1 here) will test 
whether my sysvar (v$) exists and return an error if the answer is no.
(I'm not sure about the stuff after TO; I imitated a previous line.)

Well, it indeed produced a nice RiscOS error box.  Wimplog says:
     00000124: Error from (unknown): System variable 'phoney' not 
     found

It would be more useful for my present purpose if, instead of that 
error message, I could make the function return some arbitrary value 
(such as "") and exit.  I tried PRINT ERR -- nothing was printed.
Any suggestions?

The Stronghelp for Basalt keyword SYS says similarly:
     There will be error "Unknown or missing named variable" if 
     the system variable is not found.


-- 
Jim Nagel                                www.archivemag.co.uk
>> "From" address is genuine but will change.  Website has current one.
|| See you at the show?   www.riscoslondonshow.co.uk   Oct 27

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


Thread

how to use a sysvar in Basic Jim Nagel <jimnewsm13c@abbeypress.co.uk> - 2018-09-04 16:20 +0100
  Re: how to use a sysvar in Basic Steve Drain <steve@kappa.me.uk> - 2018-09-04 18:00 +0100
    Re: how to use a sysvar in Basic Jim Nagel <jimnewsm13c@abbeypress.co.uk> - 2018-09-04 18:54 +0100
      Re: how to use a sysvar in Basic Julian Fry <julianfry@orpheusmail.co.uk> - 2018-09-08 21:03 +0100
    Re: how to use a sysvar in Basic Jim Nagel <jimnewsm13c@abbeypress.co.uk> - 2018-09-05 17:13 +0100
      Re: how to use a sysvar in Basic Matthew Phillips <spam2011m@yahoo.co.uk> - 2018-09-05 20:19 +0100
        Re: how to use a sysvar in Basic Steve Drain <steve@kappa.me.uk> - 2018-09-06 11:19 +0100
          Re: how to use a sysvar in Basic Matthew Phillips <spam2011m@yahoo.co.uk> - 2018-09-08 10:32 +0100
            Re: how to use a sysvar in Basic Steve Drain <steve@kappa.me.uk> - 2018-09-08 14:56 +0100
              Re: how to use a sysvar in Basic Alan Adams <alan@adamshome.org.uk> - 2018-09-08 19:39 +0100
              Re: how to use a sysvar in Basic Matthew Phillips <spam2011m@yahoo.co.uk> - 2018-09-10 07:27 +0100
                Re: /  not  (OT) Jim Nagel <jnews18c@abbeypress.co.uk> - 2018-09-10 11:37 +0100
                Re: /  not  (OT) News <chrisjohnson@spamcop.net> - 2018-09-10 14:34 +0100
    Re: how to use a sysvar in Basic Alan Adams <alan@adamshome.org.uk> - 2018-09-08 11:20 +0100
      Re: how to use a sysvar in Basic Steve Drain <steve@kappa.me.uk> - 2018-09-08 14:40 +0100
  Re: how to use a sysvar in Basic "John Williams (News)" <UCEbin@tiscali.co.uk> - 2018-09-04 18:16 +0100
    Re: how to use a sysvar in Basic Alan Adams <alan@adamshome.org.uk> - 2018-09-04 22:04 +0100
      Re: how to use a sysvar in Basic Matthew Phillips <spam2011m@yahoo.co.uk> - 2018-09-05 08:03 +0100
        Re: how to use a sysvar in Basic Martin Wuerthner <spamtrap@mw-software.com> - 2018-09-05 14:39 +0200
          Re: how to use a sysvar in Basic Matthew Phillips <spam2011m@yahoo.co.uk> - 2018-09-05 19:45 +0100
            Re: how to use a sysvar in Basic Steve Drain <steve@kappa.me.uk> - 2018-09-06 11:24 +0100
    Re: how to use a sysvar in Basic "John Williams (News)" <UCEbin@tiscali.co.uk> - 2018-09-05 20:56 +0100
      Re: how to use a sysvar in Basic svrsig <chris@svrsig.org> - 2018-09-05 20:13 -0700
        Re: how to use a sysvar in Basic Matthew Phillips <spam2011m@yahoo.co.uk> - 2018-09-06 07:21 +0100
  Re: how to use a sysvar in Basic A. N. Other <ANOther@argonet.co.uk> - 2018-09-04 18:11 +0100
    Re: how to use a sysvar in Basic Jim Nagel <jimnewsm13c@abbeypress.co.uk> - 2018-09-04 18:42 +0100
      Re: how to use a sysvar in Basic Matthew Phillips <spam2011m@yahoo.co.uk> - 2018-09-05 08:08 +0100
  Re: how to use a sysvar in Basic jgh@mdfs.net - 2018-09-06 17:12 -0700

csiph-web