1 /*
2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2009 - DIGITEO - Sylvestre LEDRU
4 * Copyright (C) 2009 - DIGITEO - Allan CORNET
5 *
6  * Copyright (C) 2012 - 2016 - Scilab Enterprises
7  *
8  * This file is hereby licensed under the terms of the GNU GPL v2.0,
9  * pursuant to article 5.3.4 of the CeCILL v.2.1.
10  * This file was originally licensed under the terms of the CeCILL v2.1,
11  * and continues to be available under such terms.
12  * For more information, see the COPYING file which you should have received
13  * along with this program.
14 *
15 */
16 /*-----------------------------------------------------------------------------------*/
17 #include <string.h>
18 #include "BOOL.h"
19 #include "api_scilab.h"
20 #include "sci_gateway.h"
21 /*-----------------------------------------------------------------------------------*/
22 static int callExternalFunction(char *fname, GatefuncS F, BOOL withPutLhsVar);
23 /*-----------------------------------------------------------------------------------*/
24 /** generic scilab interface **/
sci_gateway(char * fname,GatefuncS F)25 int sci_gateway(char *fname, GatefuncS F)
26 {
27     return callExternalFunction(fname, F, TRUE);
28 }
29 /*-----------------------------------------------------------------------------------*/
sci_gateway_without_putlhsvar(char * fname,GatefuncS F)30 int sci_gateway_without_putlhsvar(char *fname, GatefuncS F)
31 {
32     return callExternalFunction(fname, F, FALSE);
33 }
34 /*-----------------------------------------------------------------------------------*/
callExternalFunction(char * fname,GatefuncS F,BOOL withPutLhsVar)35 static int callExternalFunction(char *fname, GatefuncS F, BOOL withPutLhsVar)
36 {
37     (*F)(fname, (int)strlen(fname));
38     if (withPutLhsVar)
39     {
40         ReturnArguments(NULL);
41     }
42     return 0;
43 }
44 /*-----------------------------------------------------------------------------------*/
45