add localization gateway
[scilab.git] / scilab / modules / localization / sci_gateway / sci_setlanguage.c
index e375a21..154fb74 100644 (file)
@@ -3,9 +3,43 @@
 /* Allan CORNET */\r
 /*-----------------------------------------------------------------------------------*/ \r
 #include "sci_setlanguage.h"\r
+#include "setgetlanguage.h"\r
+#include "Scierror.h"\r
+#include "sciprint.h"\r
 /*-----------------------------------------------------------------------------------*/ \r
 int C2F(sci_setlanguage) _PARAMS((char *fname,unsigned long fname_len))\r
 {\r
+       static int l1,n1,m1;\r
+\r
+       CheckRhs(0,1);\r
+       CheckLhs(1,1);\r
+\r
+       if (GetType(1) == sci_strings)\r
+       {\r
+               char *param=NULL;\r
+\r
+               GetRhsVar(1,"c",&m1,&n1,&l1);\r
+               param=cstk(l1);\r
+               if (!setlanguage(param))\r
+               {\r
+                       sciprint("%s is a invalid language. see 'help setlanguage'.\n\n");\r
+                       CreateVar(Rhs+1, "b", &n1,&n1,&l1);\r
+                       *istk(l1)=(int)(FALSE);\r
+               }\r
+               else\r
+               {\r
+                       CreateVar(Rhs+1, "b", &n1,&n1,&l1);\r
+                       *istk(l1)=(int)(TRUE);\r
+               }\r
+               LhsVar(1)=Rhs+1;\r
+               C2F(putlhsvar)();\r
+       }\r
+       else\r
+       {\r
+               Scierror(999,"parameter incorrect: see 'help setlanguage'");\r
+               return 0;\r
+       }\r
+\r
        return 0;\r
 }\r
 /*-----------------------------------------------------------------------------------*/ \r