1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) DIGITEO - 2008-2010 - Yann COLLETTE
4 // This file must be used under the terms of the CeCILL.
5 // This source file is licensed as described in the file COPYING, which
6 // you should have received as part of this distribution. The terms
7 // are also available at
8 // http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
10 function [plist, err] = add_param(list_name, param_name, param_value)
12 [nargout, nargin] = argn();
14 if nargin <> 2 & nargin <> 3 then
15 error(sprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"), "add_param", 2, 3));
18 if typeof(list_name) == "plist" then
19 if ~is_param(list_name, param_name) then
20 setfield(1, [getfield(1, list_name) param_name], list_name);
25 list_name(param_name) = param_value;
28 error(sprintf(gettext("%s: Wrong value for input argument #%d: key ""%s"" already defined.\n"), "add_param", 2, param_name));
34 error(sprintf(gettext("%s: Wrong type for input argument #%d: %s expected.\n"), "add_param", 1, "plist"));