add system_property("property_name")
[scilab.git] / scilab / modules / jvm / sci_gateway / c / gw_jvm.c
1 /*-----------------------------------------------------------------------------------*/\r
2 /**\r
3 * @author Allan CORNET INRIA 2007\r
4 */\r
5 /*-----------------------------------------------------------------------------------*/\r
6 #include <string.h>\r
7 #ifdef _MSC_VER\r
8 #include <Windows.h>\r
9 #include "ExceptionMessage.h"\r
10 #endif\r
11 #include "gw_jvm.h"\r
12 #include "stack-c.h"\r
13 #include "scilabmode.h"\r
14 #include "Scierror.h"\r
15 /*-----------------------------------------------------------------------------------*/\r
16 typedef int (*jvm_Interf) __PARAMS((char *fname,unsigned long l));\r
17 /*-----------------------------------------------------------------------------------*/\r
18 typedef struct table_struct\r
19 {\r
20         jvm_Interf f;    /** function **/\r
21         char *name;      /** its name **/\r
22 } jvmTable;\r
23 /*-----------------------------------------------------------------------------------*/\r
24 static jvmTable Tab[]=\r
25 {\r
26         {C2F(sci_with_embedded_jre),"with_embedded_jre"},\r
27         {C2F(sci_system_getproperty),"system_getproperty"},\r
28         {C2F(sci_javaclasspath),"javaclasspath"}\r
29 };\r
30 /*-----------------------------------------------------------------------------------*/\r
31 int C2F(gw_jvm)(void)\r
32 {  \r
33         Rhs = Max(0, Rhs);\r
34 \r
35         if ( (getScilabMode() != SCILAB_NWNI) )\r
36         {\r
37 #ifdef _MSC_VER\r
38         #ifndef _DEBUG\r
39                 _try\r
40                 {\r
41                         (*(Tab[Fin-1].f)) (Tab[Fin-1].name,(unsigned long)strlen(Tab[Fin-1].name));\r
42                 }\r
43                 _except (EXCEPTION_EXECUTE_HANDLER)\r
44                 {       \r
45                         ExceptionMessage(GetExceptionCode(),Tab[Fin-1].name);\r
46                 }\r
47         #else\r
48                 (*(Tab[Fin-1].f)) (Tab[Fin-1].name,(unsigned long)strlen(Tab[Fin-1].name));\r
49         #endif\r
50 #else\r
51                 (*(Tab[Fin-1].f)) (Tab[Fin-1].name,(unsigned long)strlen(Tab[Fin-1].name));\r
52 #endif\r
53         }\r
54         else\r
55         {\r
56                 Scierror(999,"jvm interface disabled -nogui or -nwni mode.\r\n");\r
57         }\r
58 \r
59 \r
60         return 0;\r
61 }\r
62 /*-----------------------------------------------------------------------------------*/\r