1// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2// Copyright (C) 2008 - INRIA - Bruno JOFRET <bruno.jofret@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
13// This function is to warn user that he's using a deprecated function
14
15function warnobsolete(newFunctionName, scilabRemovedVersion)
16    // Modal warning is to set if this function
17    // should block execution or only print
18    // on the standard outstream
19    global %modalWarning
20
21    //Retrieve Calling function
22    [lineCall, stackCall]=where()
23    if size(stackCall,"*") < 2 then
24        error(msprintf(gettext("%s: Private function: cannot access to this function directly.\n"),"warnobsolete"));
25    end
26    // Now build the correct warning message
27    warnMessage = msprintf(_("Feature %s is obsolete."),stackCall(2))
28    if exists("newFunctionName", "l") then
29        warnMessage = [warnMessage, msprintf(_("Please use %s instead."),newFunctionName)]
30    end
31    if exists("scilabRemovedVersion", "l") then
32        warnMessage = [warnMessage, msprintf(_("This feature will be permanently removed in Scilab %s"), scilabRemovedVersion)]
33    end
34
35    // Now show the warning
36
37    if %modalWarning then
38        messagebox(warnMessage,"modal");
39    else
40        warning(warnMessage);
41    end
42
43    clear %modalWarning
44
45endfunction
46