2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2012 - DIGITEO - 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-en.txt
19 #include "localization.h"
20 #include "api_scilab.h"
21 #include "../../../call_scilab/includes/call_scilab.h"
22 #include "h5_fileManagement.h"
24 #include "expandPathVariable.h"
29 int sci_is_hdf5_file(char *fname, unsigned long fname_len)
34 const int nbIn = nbInputArgument(pvApiCtx);
36 CheckInputArgument(pvApiCtx, 1, 1);
37 CheckOutputArgument(pvApiCtx, 1, 4);
39 sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr);
42 printError(&sciErr, 0);
46 if (getAllocatedSingleString(pvApiCtx, piAddr, &pstFile))
48 Scierror(999, _("%s: Wrong size for input argument #%d: A string expected.\n"), fname, 1);
52 char* pstFileName = expandPathVariable(pstFile);
53 if (isHDF5File(pstFileName))
55 createScalarBoolean(pvApiCtx, nbIn + 1, 1);
59 createScalarBoolean(pvApiCtx, nbIn + 1, 0);
64 AssignOutputVariable(pvApiCtx, 1) = nbIn + 1;
65 ReturnArguments(pvApiCtx);