From 0c1cf757796ab3dfdf9c03bab5ce916f6f73d394 Mon Sep 17 00:00:00 2001
From: Rene Brun <Rene.Brun@cern.ch>
Date: Thu, 25 Oct 2001 07:44:33 +0000
Subject: [PATCH] The fixes by Philippe were not portable. On Windows, one
 cannot have a global variable in a shared lib referenced outside the shared
 lib. Two new functions have been implemented in parse.c void
 G__settemplevel(int val) void G__clearstack()

git-svn-id: http://root.cern.ch/svn/root/trunk@3105 27541ba8-7e3a-0410-8455-c3a389f83636
---
 cint/src/parse.c         | 17 +++++++++++++++++
 cint/src/v6_parse.cxx    | 17 +++++++++++++++++
 meta/src/TCint.cxx       | 12 +++---------
 meta/src/TMethodCall.cxx | 35 ++++++++++++++++++-----------------
 4 files changed, 55 insertions(+), 26 deletions(-)

diff --git a/cint/src/parse.c b/cint/src/parse.c
index 7ea62bc1848..c8603e2c917 100644
--- a/cint/src/parse.c
+++ b/cint/src/parse.c
@@ -4719,7 +4719,24 @@ int *pmparen;
   return(0);
 }
 
+void G__settemplevel(int val)
+{
+   G__templevel += val;
+}
+
+void G__clearstack()
+{
 
+   int store_command_eval = G__command_eval;
+   ++G__templevel;
+   G__command_eval = 0;
+
+   G__free_tempobject();
+
+   G__command_eval = store_command_eval;
+   --G__templevel;
+}
+   
 
 /*
  * Local Variables:
diff --git a/cint/src/v6_parse.cxx b/cint/src/v6_parse.cxx
index 7ea62bc1848..c8603e2c917 100644
--- a/cint/src/v6_parse.cxx
+++ b/cint/src/v6_parse.cxx
@@ -4719,7 +4719,24 @@ int *pmparen;
   return(0);
 }
 
+void G__settemplevel(int val)
+{
+   G__templevel += val;
+}
+
+void G__clearstack()
+{
 
+   int store_command_eval = G__command_eval;
+   ++G__templevel;
+   G__command_eval = 0;
+
+   G__free_tempobject();
+
+   G__command_eval = store_command_eval;
+   --G__templevel;
+}
+   
 
 /*
  * Local Variables:
diff --git a/meta/src/TCint.cxx b/meta/src/TCint.cxx
index 7969ac64aac..f1814f5a4ee 100644
--- a/meta/src/TCint.cxx
+++ b/meta/src/TCint.cxx
@@ -1,4 +1,4 @@
-// @(#)root/meta:$Name:  $:$Id: TCint.cxx,v 1.33 2001/10/03 18:56:44 brun Exp $
+// @(#)root/meta:$Name:  $:$Id: TCint.cxx,v 1.34 2001/10/25 06:20:29 brun Exp $
 // Author: Fons Rademakers   01/03/96
 
 /*************************************************************************
@@ -58,6 +58,7 @@ extern "C" int G__const_setnoerror();
 extern "C" int G__const_resetnoerror();
 
 extern "C" void G__clearfilebusy(int);
+extern "C" void G__clearstack();
 
 extern "C" int ScriptCompiler(const char* filename, const char* opt) {
    return gSystem->CompileMacro(filename, opt);
@@ -126,14 +127,7 @@ void TCint::ClearStack()
 {
    // Delete existing temporary values
 
-   ++G__templevel;      // Destroy only the temporary below the current level
-   int store_command_eval = G__command_eval;
-   G__command_eval = 0; // Force the deletion
-
-   G__free_tempobject();
-
-   G__command_eval = store_command_eval;
-   --G__templevel;
+   G__clearstack();
 }
 
 //______________________________________________________________________________
diff --git a/meta/src/TMethodCall.cxx b/meta/src/TMethodCall.cxx
index fc77aa1ec3f..e344e1e3894 100644
--- a/meta/src/TMethodCall.cxx
+++ b/meta/src/TMethodCall.cxx
@@ -1,4 +1,4 @@
-// @(#)root/meta:$Name:  $:$Id: TMethodCall.cxx,v 1.4 2000/11/02 14:01:23 rdm Exp $
+// @(#)root/meta:$Name:  $:$Id: TMethodCall.cxx,v 1.5 2001/10/25 06:20:29 brun Exp $
 // Author: Fons Rademakers   13/06/96
 
 /*************************************************************************
@@ -36,6 +36,7 @@
 extern long G__globalvarpointer;
 #endif
 
+extern "C" void G__settemplevel(int);
 
 ClassImp(TMethodCall)
 
@@ -210,7 +211,7 @@ void TMethodCall::Execute(void *object)
 
    void *address = 0;
    if (object) address = (void*)((Long_t)object + fOffset);
-   ++G__templevel;
+   G__settemplevel(1);
    if (fDtorOnly) {
 #ifdef WIN32
       long saveglobalvar = G__getgvp();
@@ -225,7 +226,7 @@ void TMethodCall::Execute(void *object)
 #endif
    } else
       fFunc->Exec(address);
-   --G__templevel;
+   G__settemplevel(-1);
 }
 
 //______________________________________________________________________________
@@ -237,9 +238,9 @@ void TMethodCall::Execute(void *object, const char *params)
 
    void *address = 0;
    if (object) address = (void*)((Long_t)object + fOffset);
-   ++G__templevel;
+   G__settemplevel(1);
    fFunc->Exec(address);
-   --G__templevel;
+   G__settemplevel(-1);
 }
 
 //______________________________________________________________________________
@@ -249,9 +250,9 @@ void TMethodCall::Execute(void *object, Long_t &retLong)
 
    void *address = 0;
    if (object) address = (void*)((Long_t)object + fOffset);
-   ++G__templevel;
+   G__settemplevel(1);
    retLong = fFunc->ExecInt(address);
-   --G__templevel;
+   G__settemplevel(-1);
 }
 
 //______________________________________________________________________________
@@ -263,9 +264,9 @@ void TMethodCall::Execute(void *object, const char *params, Long_t &retLong)
 
    void *address = 0;
    if (object) address = (void*)((Long_t)object + fOffset);
-   ++G__templevel;
+   G__settemplevel(1);
    retLong = fFunc->ExecInt(address);
-   --G__templevel;
+   G__settemplevel(-1);
 }
 
 //______________________________________________________________________________
@@ -275,9 +276,9 @@ void TMethodCall::Execute(void *object, Double_t &retDouble)
 
    void *address = 0;
    if (object) address = (void*)((Long_t)object + fOffset);
-   ++G__templevel;
+   G__settemplevel(1);
    retDouble = fFunc->ExecDouble(address);
-   --G__templevel;
+   G__settemplevel(-1);
 }
 
 //______________________________________________________________________________
@@ -289,9 +290,9 @@ void TMethodCall::Execute(void *object, const char *params, Double_t &retDouble)
 
    void *address = 0;
    if (object) address = (void*)((Long_t)object + fOffset);
-   ++G__templevel;
+   G__settemplevel(1);
    retDouble = fFunc->ExecDouble(address);
-   --G__templevel;
+   G__settemplevel(-1);
 }
 
 //______________________________________________________________________________
@@ -301,9 +302,9 @@ void TMethodCall::Execute(void *object, char **retText)
 
    void *address = 0;
    if (object) address = (void*)((Long_t)object + fOffset);
-   ++G__templevel;
+   G__settemplevel(1);
    *retText =(char*) (fFunc->ExecInt(address));
-   --G__templevel;
+   G__settemplevel(-1);
 }
 
 //______________________________________________________________________________
@@ -315,9 +316,9 @@ void TMethodCall::Execute(void *object, const char *params, char **retText)
 
    void *address = 0;
    if (object) address = (void*)((Long_t)object + fOffset);
-   ++G__templevel;
+   G__settemplevel(1);
    *retText =(char*)( fFunc->ExecInt(address));
-   --G__templevel;
+   G__settemplevel(-1);
 }
 
 //______________________________________________________________________________
-- 
GitLab