Fix some compilation issues under Windows.
[scilab.git] / scilab / modules / tclsci / sci_gateway / c / sci_TCL_DeleteInterp.c
1 /*--------------------------------------------------------------------------*/
2 /* INRIA 2005 */
3 /* Allan CORNET */
4 /*--------------------------------------------------------------------------*/
5 #include "TCL_Global.h"
6 #include "gw_tclsci.h"
7 #include "InitTclTk.h"
8 #include "Scierror.h"
9 #include "localization.h"
10 #include "InitializeTclTk.h"
11 /*--------------------------------------------------------------------------*/
12 int C2F(sci_TCL_DeleteInterp) _PARAMS((char *fname,unsigned long l))
13 {
14         CheckRhs(0,1);
15         CheckLhs(1,1);
16
17         if (Rhs==1)
18         {
19                 int TypeVar1=GetType(1);
20
21                 if (TCLinterp == NULL)
22                 {
23                         Scierror(999,_("%s: Error main TCL interpreter not initialized.\n"),fname);
24                         return 0;
25                 }
26
27                 if (TypeVar1 == sci_strings)
28                 {
29                         static int l2,n2,m2;
30                         Tcl_Interp *TCLinterpreter=NULL;
31
32                         GetRhsVar(1,STRING_DATATYPE,&m2,&n2,&l2);
33                         TCLinterpreter=Tcl_GetSlave(TCLinterp,cstk(l2));
34                         if (TCLinterpreter==NULL)
35                         {
36                                 Scierror(999,_("%s: No such slave interpreter.\n"),fname);
37                                 return 0;
38                         }
39                         else
40                         {
41                                 Tcl_DeleteInterp(TCLinterpreter);
42                                 TCLinterpreter=NULL;
43                         }
44                 }
45                 else
46                 {
47                         Scierror(999,_("%s: Wrong input argument: String expected.\n"),fname);
48                         return 0;
49                 }
50         }
51         else /* Rhs == 0 */
52         {
53                 if (TCLinterp == NULL)
54                 {
55                         Scierror(999,_("%s: Error main TCL interpreter not initialized.\n"),fname);
56                         return 0;
57                 }
58                 CloseTCLsci();
59                 InitializeTclTk();
60         }
61
62         LhsVar(1)=0;
63         C2F(putlhsvar)();
64
65         return 0;
66 }
67 /*--------------------------------------------------------------------------*/