Hi,
If I understand the circumstances correctly, I would handle the chicken
and egg problem differently.
The circumstances are that you're trying to develop a BOOT program,
which loads a certain set of extensions. You want to avoid loading the
extensions again if the BOOT program is run again in the same session. I
stress that this is a BOOT program, i.e. at some time it is really the
first program to be started.
I would then definitely use a small toolkit (several have been proposed
here) which checks for the presence of specific keywords.
To get around the chicken and egg problem of finding out whether this
toolkit is loaded, I'd do the following:
Check what version of machine/OS you're using, this enables you to get
at the system variables, the address of which you put into a variable
called sysvar_address. Then use this function:
def proc load_checking_toolkit (sysvars_address)
local a,is_loaded
is_loaded=peek_l (sysvars_address + 372)
if not is_loaded
a=respr(xxx)
lbytes <toolkit>,a
call a
poke_l sysvars_address + 372,1
endif
end def load_checking_toolkit
If you run this when the machine is just started up, the address at
sysvars + 372 will be 0. This is true for SMSQE, QDOS ans Minerva.
Under SMSQE, this one of the rare unused addresses in the system
variables, so if you poke 1 into there you know that your boot program
has already run once.
Under QDOS/Minerva, this may eventually be filled up as and when
channels are opened - but then you also know that you already ran the
BOOt program.
HTH
Wolfgang
_______________________________________________
QL-Users Mailing List