99496a19c2d015b843879ad596123728fe9a7f3b
[scilab.git] / scilab / modules / jvm / sci_gateway / c / gw_jvm.c
1 /*
2  * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3  * Copyright (C) INRIA - Allan CORNET
4  *
5  * This file must be used under the terms of the CeCILL.
6  * This source file is licensed as described in the file COPYING, which
7  * you should have received as part of this distribution.  The terms
8  * are also available at
9  * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
10  *
11  */
12
13 /*--------------------------------------------------------------------------*/
14 #include <string.h>
15 #include "gw_jvm.h"
16 #include "api_scilab.h"
17 #include "MALLOC.h"
18 #include "scilabmode.h"
19 #include "Scierror.h"
20 #include "callFunctionFromGateway.h"
21 #include "localization.h"
22 /*--------------------------------------------------------------------------*/
23 static gw_generic_table  Tab[] =
24 {
25     {sci_with_embedded_jre, "with_embedded_jre"},
26     {sci_system_setproperty, "system_setproperty"},
27     {sci_system_getproperty, "system_getproperty"},
28     {sci_javaclasspath, "javaclasspath"},
29     {sci_javalibrarypath, "javalibrarypath"}
30 };
31 /*--------------------------------------------------------------------------*/
32 int gw_jvm(void)
33 {
34     Rhs = Max(0, Rhs);
35
36     if (pvApiCtx == NULL)
37     {
38         pvApiCtx = (StrCtx*)MALLOC(sizeof(StrCtx));
39     }
40
41     pvApiCtx->pstName = (char*)Tab[Fin - 1].name;
42     if ( (getScilabMode() != SCILAB_NWNI) )
43     {
44         callFunctionFromGateway(Tab, SIZE_CURRENT_GENERIC_TABLE(Tab));
45     }
46     else
47     {
48         Scierror(999, _("JVM interface disabled in -nogui or -nwni modes.\n"));
49     }
50
51     return 0;
52 }
53 /*--------------------------------------------------------------------------*/