Bob Spelten writes:

Op Sat, 03 Oct 2009 14:37:11 +0200 schreef John Gilpin <[email protected]>:

I understand that there is no need to compile BASIC programs when using
QPC2 (SMSQ) - the SBASIC code can be EXEC'd without TURBO or QLIBERATOR.

Do I take this to mean that I just "Ex win1_program_bas"?And if it's as easy as that, what are the benefits and drawbacks of doing this?

It's as easy as that.
One small drawback can be that when a Qliberated program crashes there usually is the infamous red screen with an error message. This is not always the case with executed SBasic, it just disappears. That's why I always write and test my SBasics in QD and use the "qd/sbas" thing to execute from there. Then QD will report the error.

As it is not widely advertised and the documentation is hard to find,
I thought I should just mention that as of SMSQ/E 3.06 the QUIT
keyword takes an optional longword parameter. Earlier versions will
simply ignore this

QUIT error_code

where error_code are the usual suspects. If you EW program_bas, and
program_bas terminates with a QUIT error_code parameter, the calling
program will receive the error message.

Below follows an example using a home made error code. (The Home made
error codes principle has always been part of SMSQ/E (and if IRRC,
Qdos) but most people, I suspect, will have forgotten all about it ;o)

1 REMark Example of QUIT
2 REMark Using own error message
3 REMark by pjwitte 2009
4 :
100 addr = ALCHP(100)
110 erm$ = 'something got seriously buggered here..' & CHR$(10)
120 POKE_W addr, LEN(erm$), erm$
130 er = BIN('1' & BIN$(addr, 32)(2 TO))
140 REMark La di da....
150 QUIT er
160 :

If the program snippet above is saved as ram1_Test_bas (for example)
then if

EW ram1_Test_bas

is executed from another basic console it should return the error
message "something got seriously buggered here.."! (pardon my Latin!)

Of course this isnt half as clever as it looks, as nowadays you arnt
guaranteed (AFAIK) that ALCHP wont return a negative address. Another
potential pitfall is if you use

er = FEW("ram1_Test_bas")

and try to work out the error message from there, as the location of
the error message is no longer defined since the job that owned the
space has disappeared!

However, the concept is valid. Youll just have to find a workaround
for those issues.

Per

_______________________________________________
QL-Users Mailing List
http://www.q-v-d.demon.co.uk/smsqe.htm

Reply via email to