home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Dream 52
/
Amiga_Dream_52.iso
/
RiscOS
/
APP
/
DEVS
/
BASIC
/
BACNST.ZIP
/
!BASICcnst
/
!Help
< prev
next >
Wrap
Text File
|
1995-05-29
|
5KB
|
120 lines
!BASICcnst
v 1.05 (29-May-1995)
This program is Shareware.
This means that you can copy this program to anyone you like, but if you
find the program useful, you should register, as explained below. This
entitles you to the latest version of this program, and of all my other
applications.
If you do copy the program it should be in its original format, with ALL of
the accompanying files. That is : !Boot
!Help
!Run
!RunImage
!Sprites
!Sprites22
Code
MakeCode
Messages
Sprites
Templates
Purpose
-------
Provide a 'constants' function for BASIC. It allows BASIC programs to be
written with easy readablity, and the final version can have the speed of
numbers rather than variables in the code.
To use
------
Write your BASIC program as normal, except for these rules :
1) The first line should be REM BASIC constants
2) After this line, assign a list of variables which function as constants
eg. init=&4B534154
3) After the list of variables, the next line should be REM End constants
NB. The lines for steps 1 and 3 *ARE* case-sensitive.
Then save the BASIC program. Double click on the !BASICcnst in the filer
window to install an icon on the icon bar. Drag the saved BASIC program's
icon from the filer window onto !BASICcnst on the icon bar. This will open a
window offering the choice of where to save the processed file. The output
file can be the same as input (although I would advise against it, unless you
have a backup!) The window works in the same manner as any normal RISC-OS
save dialogue box, but displays the input file for reference. After telling
it where to save the output, the program will then process the BASIC program,
converting all the constants into their actual values, and then removing the
constants declaration.
Constants can be reals, integers or strings.
For example, the BASIC program:
10 REM BASIC constants
20 riscver=200:init%=&4B534154:progname$="My Program"
30 REM End constants
40 SYS "Wimp_Initialise",riscver,init%,progname$
would become
40 SYS "Wimp_Initialise",200,&4B534154,"My Program"
Beware of having a variable array with the same referencing name as a
constant, as this will (probably ;-) cause some problems. e.g if you have an
array constantname() it will probably be changed to constantval(). I've tried
to stop this happening, but I can't offer any guarantees as yet.
Note that the program does not do any renumbering - it merely deletes the
first lines up to and including NN REM End constants. This allows for GOTOs
(bleugh) and the such, without the need to write lots of checks into the
program. (Hence slowing it down, as if it wasn't slow enough already!)
Note also that at present you are 'limited' to 5000 constants. I put limited in
quotes, as I can't see a situation where somebody should want more, unless they
are naming the first 5002 integers, that is. ;-)
NB. This version is not very friendly with expressions using constants.
For example, the line
PRINT constant+5
would be replaced by (assuming constant=23)
PRINT 23+5
when PRINT 28 would be much more efficient. This will be rectified in later
versions. (Unless I write a separate application to do that and more...)
Clicking menu on the icon on the icon bar will open a menu offering the
normal Info and Quit options.
Finally, the program counts its errors and their time intervals. If it has
to report five errors, each one being within two seconds of the previous one,
then the program will kill itself. This solves (hopefully!) the problems of
an unbreakable error loop.
Bugs & Improvements
-------------------
Please report any bugs found and any possible improvements you can think of
to me at the address shown below.
Registering
-----------
To register, send ú5 to me, at the address shown below, stating what version
of which of my programs you have. You can enclose your own disk for the
programs, and if you do so you can deduct 50p from the price. Registering
entitles you to upgrade to later versions of the same programs and to get new
programs for the price of ú1. Any additional contributions from overseas
towards postage would be greatly appreciated.
Neil Walker.
16, Finderne Drive.
Wymondham.
Norfolk.
NR18 0HU.
Legal Notice
------------
This program is supplied 'as is'. I therefore cannot be held responsible
for any loss of data, profits or any other loss, either directly or
indirectly, that may be incurred by the use (or misuse) of this software,
even if I am aware of the possibility of such a loss. However, I can assure
you that in its original state, the program contains no deliberate viruses,
or damaging procedures, except where these are necessary for the fulfilment
of the program's function.