2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2006 - INRIA - Allan CORNET
4 * Copyright (C) 2012 - Scilab Enterprises - Cedric Delamarre
6 * This file must be used under the terms of the CeCILL.
7 * This source file is licensed as described in the file COPYING, which
8 * you should have received as part of this distribution. The terms
9 * are also available at
10 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
14 #include "api_scilab.h"
17 #include "fftwlibname.h"
19 #include "localization.h"
20 /*--------------------------------------------------------------------------*/
21 int sci_loadfftwlibrary(char *fname, unsigned long fname_len)
23 static int l1, n1, m1;
24 char* FFTWLibname = NULL;
30 CheckInputArgument(pvApiCtx, 1, 1);
32 //get variable address
33 sciErr = getVarAddressFromPosition(pvApiCtx, 1, &piAddr1);
36 printError(&sciErr, 0);
40 if (isStringType(pvApiCtx, piAddr1) == 0)
42 Scierror(999, _("%s: Wrong type for input argument #%d: A string expected.\n"), fname, 1);
46 // Retrieve a single string at position 1
47 iErr = getAllocatedSingleString(pvApiCtx, piAddr1, &l1char);
50 freeAllocatedSingleString(l1char);
54 setfftwlibname(FFTWLibname);
57 if ( LoadFFTWLibrary(FFTWLibname) )
59 iErr = createScalarBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 1); // true
63 iErr = createScalarBoolean(pvApiCtx, nbInputArgument(pvApiCtx) + 1, 0); // false
65 freeAllocatedSingleString(l1char);
69 Scierror(999, _("%s: Memory allocation error.\n"), fname);
73 AssignOutputVariable(pvApiCtx, 1) = nbInputArgument(pvApiCtx) + 1;
74 ReturnArguments(pvApiCtx);
78 /*--------------------------------------------------------------------------*/