;;;;
;;;;              PV-WAVE Command Language for Windows NT
;;;;
;;;;            (c) Copyright Visual Numerics, Inc., 1993
;;;;                      Boulder, Colorado, USA
;;;;
;;;;                        All Rights Reserved.
;;;;
;;;;  This software is confidential information which is proprietary to
;;;;  and a trade secret of Visuals Numerics, Inc.  Use, duplication or
;;;;  disclosure is subject to the terms of an appropriate license agreement.
;;;;
;;;;  -----------------------------------------------------------------------
;;;;
;;;;  RESET
;;;;
;;;;  $Id: reset,v 1.2 1993/07/27 02:09:10 chadwick Exp $
;;;;

;
;+
; NAME:          RESET
;	
; PURPOSE:       This procedure is used to reset WAVE to a clean state.
;	
; CATEGORY:      PV-WAVE Command Language for Windows NT.
;
; USAGE:         @RESET
;	
; REQ. INPUTS:   None.
;	
; OPT. INPUTS:   None.
;
; RETURN VALUE:  None.
;
; COMMON BLOCKS: None.
;	
; SIDE EFFECTS:  Deletes all user-defined procedures, functions and variables
;                and closes the graphics device driver thus deleting all 
;                graphics windows.
;	
; RESTRICTIONS:  None.
;	
; PROCEDURE:     See comments below.
;	
;-
;

;; If we are stuck in a stopped state, then return to the $MAIN$ level.

    RETALL


;; Close the graphics device.  This will delete all windows.
    
    DEVICE, /CLOSE


;; Delete all of the user-defined functions.

    DELFUNC, /ALL


;; Delete all of the user-defined procedures.

    DELPROC, /ALL


;;
;; Delete all of the user-defined variables.  Important notes:
;;   1. DELVAR will not take a string variable as a parameter.  This makes 
;;      sense if you think about it.  To get around this, we must build up a
;;      DELVAR command and pass it to EXECUTE().
;;   2. EXECUTE() can NOT be called in a FOR or WHILE loop because (as defined)
;;      it causes the current loop to be terminated.  Thus we have to build up
;;      a single string that can be passed to EXECUTE() outside of the loop.
;;   3. Since S is the string variable that contains the command to be execut-
;;      ed, the variable S must NOT appear in the DELVAR command.  Else an 
;;      error will occur when EXECUTE() is called because the memory cannot be
;;      freed while it is in use.  Thus, we don't DELVAR S until after the
;;      EXECUTE command.
;;   4. Don't try to rewrite this section of code using GOTOs and labels -- it
;;      won't work.
;;

    V = ROUTINE_NAMES('$MAIN$', /P_VARIABLES)
    S = 'DELVAR'

    FOR I = 1, N_ELEMENTS(V) DO BEGIN $
        IF (V(I - 1) NE 'S') THEN S = S + ', ' + V(I - 1)

    IF (V(0) NE '') THEN RC = EXECUTE(S)
    DELVAR, S, RC, I

;;;
;;; EOF $RCSfile: reset,v $
;;;




