[ROOT] Exit from macro

From: Jiri Chudoba (Jiri.Chudoba@cern.ch)
Date: Thu Mar 08 2001 - 09:35:29 MET


Hello,

how can I properly exit from macro? I get a strange behaviour with the
function exit: macro does not execute (I mean the new run of macro) after
the first usage of exit. I have to quit root and only then the macro
executes again:

errorHandling.C:

// Test macro for error handling

#include <stdlib.h>

Int_t errorHandling(Int_t error=0) 
{
    cerr<<"Error is "<<error<<endl;
    if (error) {
// error occurred, exit macro
	cerr<<"Error in errorHandling macro: "<<error<<endl;
	exit (EXIT_FAILURE);
    }
    cerr<<"No error in the macro"<<endl;
    return 0;
}


[pcepaip16] ~/macros > root.exe
  *******************************************
  *                                         *
  *        W E L C O M E  to  R O O T       *
  *                                         *
  *   Version   3.00/05      6 March 2001   *
  *                                         *
  *  You are welcome to visit our Web site  *
  *          http://root.cern.ch            *
  *                                         *
  *******************************************

FreeType Engine v1.x used to render TrueType fonts.

CINT/ROOT C/C++ Interpreter version 5.14.78, Feb 21 2001
Type ? for help. Commands must be C++ statements.
Enclose multiple statements between { }.
root [0] .x errorHandling.C(0)
Error is 0
No error in the macro
(Int_t)0
root [1] .x errorHandling.C(0)
Error is 0
No error in the macro
(Int_t)0
root [2] .x errorHandling.C(1)
Error is 1
Error in error_handling macro: 1
(Int_t)1
root [3] .x errorHandling.C(1)
root [4] 

-> no output after the command [3].

         Thanks, cheers,
                               Jiri.

*************************************************************************
* E-mail address:  Jiri.Chudoba@cern.ch                                 *
* WWW Homepage  :  http://delphiwww.troja.mff.cuni.cz/chudoba/          *
* Telephone     :  +41 22 76 72288                                      *
* Fax           :  +41 22 76 79480                                      *
*************************************************************************



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:39 MET