* Bug #9394 fixed - Parameters: is_params() recognized the "plist" field.
[scilab.git] / scilab / modules / parameters / macros / is_param.sci
index 882fb72..90d1dec 100644 (file)
@@ -7,17 +7,31 @@
 // are also available at
 // http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
 
-function [result,err] = is_param(list_name,param_name)
-    [nargout,nargin] = argn();
+function [result, err] = is_param(list_name, param_name)
+
+    [nargout, nargin] = argn();
+
+    if nargin <> 2 then
+        error(sprintf(gettext("%s: Wrong number of input arguments: %d expected.\n"), "is_param", 2));
+    end
+
     result = [];
-    if typeof(list_name)=="plist" then
-        result = or(getfield(1,list_name)==param_name);
-        if nargout==2 then err = %F; end
+    if typeof(list_name) == "plist" then
+        if typeof(param_name) == "string" then
+            result_vec = getfield(1, list_name) == param_name;
+            result = or(result_vec(2:$));
+            if nargout == 2 then
+                err = %F;
+            end
+        else
+            error(sprintf(gettext("%s: Wrong type for input argument #%d: %s expected.\n"), "is_param", 2, "String"));
+        end
     else
-        if nargout==2 then
+        if nargout == 2 then
             err = %T;
         else
             error(sprintf(gettext("%s: Wrong type for input argument #%d: %s expected.\n"), "is_param", 1, "plist"));
         end
     end
+
 endfunction