PWquit: RECOVERING FROM ERRORS

This Chapter explains what PWquit does - this has no equivalent in the 'C' functions described in the main manual!

Purpose

As was explained in the comment on PWactivate, a fake return is made to SBasic from any action routine you may have specified, and it is crucial that a return be made to ProWesS via the PWactivate keyword again, to avoid memory loss and possible crashes.

This is not, normally, a problem if you follow the simple loop structure as set out in that comment. BUT, what happens if you have an error in your SBasic program which is produced just after a return from the PWactivate call as a result of a hit/do routine? Then the program is interrupted, you will edit it , and run it again - leading to the loss of memory and possible confusion mentioned above.

If this happens (i.e. the program stops with an error), the first thing to do is to use the PWquit keyword. This unravels all of these complications and makes a clean exit again to SBasic. You can then edit the error and run the program again. Of course, you do not -and indeed MUST not- use this when no ProWesS window was still on the screen when the error happended, since then you are no longer in ProWesS.

Syntax

PWquit object,mempointer

The object and mempointer variables are those that were used in the PWactivate call. Now you can understand why you should not make these variables LOCal, since after an error, the local variables are sometimes no longer accessible....

ATTENTION: if you use wrong parameters for this command (i.e variables that aren't those needed, such as a wrong mempointer), you will:

  1. Certainly crash the SBasic you were working on.
  2. Most probably crash ProWesS.
  3. Very likely crash your whole system.
You have been warned!

Example

PWquit outline,mem

Since my programs often crash during development (only!), I generally include the following procedure in my programs:

         DEF PROC unset (o,m)
                   PWquit o,m
                   PWremove o
         END DEF unset
which makes a clean exit with PWquit, and also removes the object with PWremove.
PROGS, Professional & Graphical Software
last edited 1996 May 29 (wl)