1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) 2003-2008 - INRIA - Serge STEER <serge.steer@inria.fr>
3//
4// Copyright (C) 2012 - 2016 - Scilab Enterprises
5//
6// This file is hereby licensed under the terms of the GNU GPL v2.0,
7// pursuant to article 5.3.4 of the CeCILL v.2.1.
8// This file was originally licensed under the terms of the CeCILL v2.1,
9// and continues to be available under such terms.
10// For more information, see the COPYING file which you should have received
11// along with this program.
12
13function %fun=createfun(t)
14    //given t a string vector where first line gives the function calling
15    //sequence and the following the function instructions, it returns et
16    //Scilab function.
17    // This is  mainly used by sci2exp
18    if argn(2) < 1 then
19        error(sprintf(_("%s: Wrong number of input argument(s): %d expected.\n"), "createfun", 1));
20    end
21    h=t(1)
22    k=strindex(h,"=")
23    if k==[] then k1=0,else k1=k(1),end
24    k=strindex(h,"(")
25    if k==[] then k2=length(h),else k2=k(1),end
26    h=part(h,1:k1)+"%fun"+part(h,k2:length(h))
27    deff(h,t(2:$)),
28endfunction
29