1    	/* /% C++ %/ */
2    	/***********************************************************************
3    	 * cint (C/C++ interpreter)
4    	 ************************************************************************
5    	 * Header file CallFunc.h
6    	 ************************************************************************
7    	 * Description:
8    	 *  Extended Run Time Type Identification API
9    	 ************************************************************************
10   	 * Copyright(c) 1995~2003  Masaharu Goto 
11   	 *
12   	 * For the licensing terms see the file COPYING
13   	 *
14   	 ************************************************************************/
15   	
16   	
17   	
18   	#ifndef G__CALLFUNC_H
19   	#define G__CALLFUNC_H
20   	
21   	#ifndef G__API_H
22   	#include "Api.h"
23   	#endif
24   	
25   	namespace Cint {
26   	
27   	/*********************************************************************
28   	* class G__CallFunc
29   	*
30   	* 
31   	*********************************************************************/
32   	class 
33   	#ifndef __CINT__
34   	G__EXPORT
35   	#endif
36   	G__CallFunc {
37   	 public:
38   	  ~G__CallFunc() {}
39   	  G__CallFunc() ;
40   	
41   	  G__CallFunc(const G__CallFunc& cf)
42   	#ifndef __MAKECINT__
43   	   :pfunc(cf.pfunc),
44   	    result(cf.result),
45   	#ifdef G__ASM_WHOLEFUNC
46   	    bytecode(cf.bytecode),
47   	#endif
48   	    method(cf.method),
49   	    para(cf.para)
50   	#endif /* __MAKECINT__ */
51   	  {}
52   	
53   	  G__CallFunc& operator=(const G__CallFunc& cf) {
54   	    if (&cf != this) {
55   	#ifndef __MAKECINT__
56   	      pfunc=cf.pfunc;
57   	      result=cf.result;
58   	#ifdef G__ASM_WHOLEFUNC
59   	      bytecode=cf.bytecode;
60   	#endif
61   	      method=cf.method;
62   	      para=cf.para;
63   	#endif /* __MAKECINT__ */
64   	    }
65   	    return *this;
66   	  }
67   	
68   	  void Init() ;
69   	
70   	  enum MatchMode { ExactMatch=0, ConversionMatch=1 };
71   	  void SetFunc(G__ClassInfo* cls,const char* fname,const char* args
72   		       ,long* poffset,MatchMode mode=ConversionMatch);
73   	  void SetFuncProto(G__ClassInfo* cls,const char* fname,const char* argtype,long* poffset);
74   	  // begin old interface
75   	  void SetFunc(G__InterfaceMethod f);
76   	  void SetFunc(G__MethodInfo m);
77   	#ifdef G__ASM_WHOLEFUNC
78   	  void SetBytecode(struct G__bytecodefunc* bc);
79   	#endif
80   	  int IsValid() { /* return(pfunc?1:0l; */ return(method.IsValid());}
81   	  void SetArgArray(long *p,int narg= -1);
82   	  void ResetArg() { para.paran=0; }
83   	  void SetArg(long l) ;
84   	  void SetArg(unsigned long ul) ;
85   	  void SetArg(double d) ;
86   	  void SetArgRef(long& l) ;
87   	  void SetArgRef(double& d) ;
88   	  void SetArg( G__value );
89   	#ifdef G__NATIVELONGLONG
90   	  void SetArg(G__int64 ll);
91   	  void SetArg(G__uint64 ull);
92   	  void SetArg(long double ld);
93   	  void SetArgRef(G__int64& ll);
94   	  void SetArgRef(G__uint64& ull);
95   	  void SetArgRef(long double& ld);
96   	#endif
97   	  // end old interface
98   	
99   	  G__value Execute(void *pobject );
100  	  void Exec(void *pobject) { Execute(pobject); }
101  	  long ExecInt(void *pobject) { return G__int(Execute(pobject)); }
102  	  double ExecDouble(void *pobject) { return G__double(Execute(pobject)); }
103  	#ifdef G__NATIVELONGLONG
104  	  G__int64 ExecInt64(void *pobject) { return G__Longlong(Execute(pobject)); }
105  	#endif
106  	
107  	  G__InterfaceMethod InterfaceMethod() { return pfunc; }
108  	  void SetArgs(const char* args);
109  	  void SetArgs(const G__param &p);
110  	  G__MethodInfo GetMethodInfo() { return method; }
111  	
112  	 private:
113  	  void SetFuncType();
114  	#ifndef __MAKECINT__
115  	  G__InterfaceMethod pfunc;
116  	  G__value result;
117  	#ifdef G__ASM_WHOLEFUNC
118  	  struct G__bytecodefunc *bytecode;
119  	#endif
120  	  G__MethodInfo method;
121  	  struct G__param para;
122  	  int ExecInterpretedFunc(G__value* presult);
123  	#endif /* __MAKECINT__ */
124  	};
125  	
126  	} // namespace Cint
127  	
128  	using namespace Cint;
129  	#endif
130