utf: dynamic_link 2 74/18674/1
Antoine ELIAS [Thu, 10 Nov 2016 07:35:10 +0000 (08:35 +0100)]
Change-Id: I60581fed0b5c58612a0f310e28abecd3cb9082d0

scilab/modules/dynamic_link/macros/ilib_gen_gateway.sci
scilab/modules/dynamic_link/sci_gateway/cpp/sci_link.cpp
scilab/modules/dynamic_link/src/cpp/dynamic_link.cpp

index 6b3d466..34bb1dd 100644 (file)
@@ -86,17 +86,16 @@ function gateway_filename = ilib_gen_gateway(name,tables)
             "#include """ + tname + ".h""";
             "}";
             "";
-            "#define MODULE_NAME L""" + tname + """";
+            "#define MODULE_NAME """ + tname + """";
             "";
-            "int " + tname + "(wchar_t* _pwstFuncName)";
+            "int " + tname + "(const char* _pstFuncName)";
             "{";
-            "    if(wcscmp(_pwstFuncName, L""" + table(:,1) + """) == 0){ " + "symbol::Context::getInstance()->addFunction(types::Function::createFunction(L""" + table(:,1) + """, &" + names(:) + ", MODULE_NAME)); }";
+            "    if(strcmp(_pstFuncName, """ + table(:,1) + """) == 0){ " + "symbol::Context::getInstance()->addFunction(types::Function::createFunction(""" + table(:,1) + """, &" + names(:) + ", MODULE_NAME)); }";
             "";
             "    return 1;";
             "}"];
         else
             t = [
-            "#include <wchar.h>";
             "#include """ + tname + ".hxx""";
             "extern ""C""";
             "{";
@@ -104,21 +103,21 @@ function gateway_filename = ilib_gen_gateway(name,tables)
             "#include ""addfunction.h""";
             "}";
             "";
-            "#define MODULE_NAME L""" + tname + """";
+            "#define MODULE_NAME """ + tname + """";
             "";
-            "int " + tname + "(wchar_t* _pwstFuncName)";
+            "int " + tname + "(char* _pstFuncName)";
             "{";];
 
             for kGw = 1:size(names, "*")
                 if or(table(kGw, 3) == ["cmex" "fmex" "Fmex"]) then
                     t = [t;
-                    "    if(wcscmp(_pwstFuncName, L""" + table(kGw,1) + """) == 0){ " + "addMexFunction(L""" + table(kGw,1) + """, &" + names(kGw) + ", MODULE_NAME); }"];
+                    "    if(strcmp(_pstFuncName, """ + table(kGw,1) + """) == 0){ " + "addMexFunction(""" + table(kGw,1) + """, &" + names(kGw) + ", MODULE_NAME); }"];
                 elseif table(kGw, 3) == "csci6" then
                     t = [t;
-                    "    if(wcscmp(_pwstFuncName, L""" + table(kGw,1) + """) == 0){ " + "addCFunction(L""" + table(kGw,1) + """, &" + names(kGw) + ", MODULE_NAME); }"];
+                    "    if(strcmp(_pstFuncName, """ + table(kGw,1) + """) == 0){ " + "addCFunction(""" + table(kGw,1) + """, &" + names(kGw) + ", MODULE_NAME); }"];
                 else
                     t = [t;
-                    "    if(wcscmp(_pwstFuncName, L""" + table(kGw,1) + """) == 0){ " + "addCStackFunction(L""" + table(kGw,1) + """, &" + names(kGw) + ", MODULE_NAME); }"];
+                    "    if(strcmp(_pstFuncName, """ + table(kGw,1) + """) == 0){ " + "addCStackFunction(""" + table(kGw,1) + """, &" + names(kGw) + ", MODULE_NAME); }"];
                 end
             end
 
@@ -163,7 +162,7 @@ function gateway_filename = ilib_gen_gateway(name,tables)
         "#define " + TNAME + "_GW_IMPEXP";
         "#endif";
         "";
-        "extern ""C"" " + TNAME + "_GW_IMPEXP int " + tname + "(wchar_t* _pwstFuncName);";
+        "extern ""C"" " + TNAME + "_GW_IMPEXP int " + tname + "(const char* _pstFuncName);";
         "";
         unique(gate(:, 2));
         "";
index 6f3cbf1..c404607 100644 (file)
@@ -86,7 +86,7 @@ types::Function::ReturnValue sci_link(types::typed_list &in, int _iRetCount, typ
         }
         else
         {
-            Scierror(999, _("%ls Wrong value for input argument #%d: '%s' or '%s' expected.\n"), "link", 3, "f", "c");
+            Scierror(999, _("%s Wrong value for input argument #%d: '%s' or '%s' expected.\n"), "link", 3, "f", "c");
             return types::Function::Error;
         }
 
@@ -210,7 +210,7 @@ void displayDynLibInfo(void)
     {
         if (getIlibVerboseLevel() != ILIB_VERBOSE_NO_OUTPUT)
         {
-            sciprint(_("Entry point %ls in shared library %d.\n"), (*it)->pstEntryPointName, (*it)->iLibIndex);
+            sciprint(_("Entry point %s in shared library %d.\n"), (*it)->pstEntryPointName, (*it)->iLibIndex);
         }
     }
 }
index bc3877f..4a2b729 100644 (file)
@@ -223,7 +223,6 @@ int Sci_dlsym(const char* _pstEntryPointName, int _iLibID, BOOL _bFortran)
 
     ConfigVariable::setEntryPointName(pEP, _pstEntryPointName);
     ConfigVariable::addEntryPoint(pEP);
-    FREE(pstEntryPointName);
     return 0;
 }
 /*---------------------------------------------------------------------------*/