2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2014 - Scilab Enterprises - Antoine ELIAS
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.1-en.txt
15 #include "api_scilab.h"
17 #include "localization.h"
18 #include "createGraphicObject.h"
19 #include "getGraphicObjectProperty.h"
20 #include "graphicObjectProperties.h"
21 #include "HandleManagement.h"
24 int sci_loadGui(char *fname, unsigned long fname_len)
30 int iRhs = nbInputArgument(pvApiCtx);
32 CheckInputArgument(pvApiCtx, 1, 1);
33 CheckOutputArgument(pvApiCtx, 1, 1);
35 sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
38 printError(&sciErr, 0);
42 sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
45 printError(&sciErr, 0);
49 if (isStringType(pvApiCtx, piAddr) == 0 || isScalar(pvApiCtx, piAddr) == 0)
51 Scierror(999, _("%s: Wrong size for input argument #%d: A string expected.\n"), fname, 1);
56 if (getAllocatedSingleString(pvApiCtx, piAddr, &pstFile))
60 freeAllocatedSingleString(pstFile);
63 Scierror(202, _("%s: Wrong type for argument #%d: A string expected.\n"), fname, 2);
67 int iFig = xmldomload(pstFile);
70 Scierror(999, _("%s: can not read file %s.\n"), fname, pstFile);
71 freeAllocatedSingleString(pstFile);
75 freeAllocatedSingleString(pstFile);
77 long long h = (long long)getHandle(iFig);
78 createScalarHandle(pvApiCtx, iRhs + 1, h);
79 AssignOutputVariable(pvApiCtx, 1) = iRhs + 1;
80 ReturnArguments(pvApiCtx);