2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2012 - Scilab Enterprises - Calixte DENIZET
5 * This file must be used under the terms of the CeCILL.
6 * This source file is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at
9 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
13 #include "ScilabGateway.hxx"
15 namespace org_modules_external_objects
18 int ScilabGateway::getEnvironmentName(char * fname, const int envId, void * pvApiCtx)
26 CheckInputArgument(pvApiCtx, 1, 1);
28 err = getVarAddressFromPosition(pvApiCtx, 1, &addr);
31 throw ScilabAbstractEnvironmentException(__LINE__, __FILE__, gettext("Invalid variable: cannot retrieve the data"));
34 if (!ScilabObjects::isExternalObjOrClass(addr, pvApiCtx))
36 throw ScilabAbstractEnvironmentException(__LINE__, __FILE__, gettext("Wrong type for input argument #%d: An External Object expected."), 1);
39 eId = ScilabObjects::getEnvironmentId(addr, pvApiCtx);
41 ScilabAbstractEnvironment & env = ScilabEnvironments::getEnvironment(eId);
42 ScilabGatewayOptions & options = env.getGatewayOptions();
43 OptionsHelper::setCopyOccured(false);
44 ScilabObjects::initialization(env, pvApiCtx);
45 options.setIsNew(false);
47 envName = env.getEnvironmentName();
48 str = strdup(envName.c_str());
50 err = createMatrixOfString(pvApiCtx, Rhs + 1, 1, 1, (const char * const *)&str);