add javalibrarypath function
[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         {C2F(sci_javalibrarypath),"javalibrarypath"}\r
30 };\r
31 /*-----------------------------------------------------------------------------------*/\r
32 int C2F(gw_jvm)(void)\r
33 {  \r
34         Rhs = Max(0, Rhs);\r
35 \r
36         if ( (getScilabMode() != SCILAB_NWNI) )\r
37         {\r
38 #ifdef _MSC_VER\r
39         #ifndef _DEBUG\r
40                 _try\r
41                 {\r
42                         (*(Tab[Fin-1].f)) (Tab[Fin-1].name,(unsigned long)strlen(Tab[Fin-1].name));\r
43                 }\r
44                 _except (EXCEPTION_EXECUTE_HANDLER)\r
45                 {       \r
46                         ExceptionMessage(GetExceptionCode(),Tab[Fin-1].name);\r
47                 }\r
48         #else\r
49                 (*(Tab[Fin-1].f)) (Tab[Fin-1].name,(unsigned long)strlen(Tab[Fin-1].name));\r
50         #endif\r
51 #else\r
52                 (*(Tab[Fin-1].f)) (Tab[Fin-1].name,(unsigned long)strlen(Tab[Fin-1].name));\r
53 #endif\r
54         }\r
55         else\r
56         {\r
57                 Scierror(999,"JVM interface disabled in -nogui or -nwni modes.\r\n");\r
58         }\r
59 \r
60         return 0;\r
61 }\r
62 /*-----------------------------------------------------------------------------------*/\r