1 /*
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2015 - Scilab Enterprises - Antoine ELIAS
4 *
5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
6 *
7 * This file is hereby licensed under the terms of the GNU GPL v2.0,
8 * pursuant to article 5.3.4 of the CeCILL v.2.1.
9 * This file was originally licensed under the terms of the CeCILL v2.1,
10 * and continues to be available under such terms.
11 * For more information, see the COPYING file which you should have received
12 * along with this program.
13 *
14 */
15
16 #include "gatewaystruct.hxx"
17 extern "C"
18 {
19 #include "api_scilab.h"
20 }
21
scilab_setError(scilabEnv env,const wchar_t * msg)22 void scilab_setError(scilabEnv env, const wchar_t* msg)
23 {
24 ((types::GatewayCStruct*)env)->lasterror = msg;
25 }
26
27 //error
scilab_lastError(scilabEnv env)28 const wchar_t* scilab_lastError(scilabEnv env)
29 {
30 return ((types::GatewayCStruct*)env)->lasterror.data();
31 }
32
scilab_setInternalError(scilabEnv env,const std::wstring & name,const std::wstring & msg)33 void scilab_setInternalError(scilabEnv env, const std::wstring& name, const std::wstring& msg)
34 {
35 std::wstring err(L"scilab_" + name + L": " + msg);
36 scilab_setError(env, err.data());
37 }
38