diff scripts/ode/private/odepkg_structure_check.m @ 20584:eb9e2d187ed2

maint: Use Octave coding conventions in scripts/ode/private dir. * AbsRel_Norm.m, fuzzy_compare.m, hermite_quartic_interpolation.m, integrate_adaptive.m, integrate_const.m, integrate_n_steps.m, kahan.m, ode_struct_value_check.m, odepkg_event_handle.m, odepkg_structure_check.m, runge_kutta_45_dorpri.m, starting_stepsize.m: Wrap long lines to < 80 chars. Use double quotes rather than single quotes where possible. Use ';' at end of keywords "return;" and "break;" Use '##" for stand-alone comments and '#' for end-of-line comments. Use two spaces after period before starting new sentence. Use '!' instead of '~' for logical negation. Use specific form of end (endif, endfor, etc.). Don't use line continuation marker '...' unless necessary.
author Rik <rik@octave.org>
date Sun, 04 Oct 2015 22:18:54 -0700
parents 25623ef2ff4f
children b7ac1e94266e
line wrap: on
line diff
--- a/scripts/ode/private/odepkg_structure_check.m	Sun Oct 04 16:24:32 2015 +0100
+++ b/scripts/ode/private/odepkg_structure_check.m	Sun Oct 04 22:18:54 2015 -0700
@@ -1,22 +1,23 @@
-%# Copyright (C) 2006-2012, Thomas Treichl <treichl@users.sourceforge.net>
-%# Copyright (C) 2013, Roberto Porcu' <roberto.porcu@polimi.it>
-%# OdePkg - A package for solving ordinary differential equations and more
-%#
-%# This program is free software; you can redistribute it and/or modify
-%# it under the terms of the GNU General Public License as published by
-%# the Free Software Foundation; either version 2 of the License, or
-%# (at your option) any later version.
-%#
-%# This program is distributed in the hope that it will be useful,
-%# but WITHOUT ANY WARRANTY; without even the implied warranty of
-%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-%# GNU General Public License for more details.
-%#
-%# You should have received a copy of the GNU General Public License
-%# along with this program; If not, see <http://www.gnu.org/licenses/>.
+## Copyright (C) 2006-2012, Thomas Treichl <treichl@users.sourceforge.net>
+## Copyright (C) 2013, Roberto Porcu' <roberto.porcu@polimi.it>
+## OdePkg - A package for solving ordinary differential equations and more
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; If not, see <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} {[@var{newstruct}] =} odepkg_structure_check (@var{oldstruct}, [@var{"solver"}])
+## @deftypefn  {Function File} {@var{newstruct} =} odepkg_structure_check (@var{oldstruct})
+## @deftypefnx {Function File} {@var{newstruct} =} odepkg_structure_check (@var{oldstruct}, @var{"solver"})
 ##
 ## If this function is called with one input argument of type structure array
 ## then check the field names and the field values of the OdePkg structure
@@ -43,18 +44,18 @@
 ##
 ## @seealso{odepkg}
 
-function [vret] = odepkg_structure_check (varargin)
+function vret = odepkg_structure_check (varargin)
 
-  %# Check the number of input arguments
+  ## Check the number of input arguments
   if (nargin == 0)
-    help ('odepkg_structure_check');
-    error ('OdePkg:InvalidArgument', ...
-      'Number of input arguments must be greater than zero');
+    help ("odepkg_structure_check");
+    error ("OdePkg:InvalidArgument",
+           "Number of input arguments must be greater than zero");
   elseif (nargin > 2)
     print_usage;
   elseif (nargin == 1 && isstruct (varargin{1}))
     vret = varargin{1};
-    vsol = '';
+    vsol = "";
     vfld = fieldnames (vret);
     vlen = length (vfld);
   elseif (nargin == 2 && isstruct (varargin{1}) && ischar (varargin{2}))
@@ -62,407 +63,434 @@
     vsol = varargin{2};
     vfld = fieldnames (vret);
     vlen = length (vfld);
-  end
+  endif
 
-  for vcntarg = 1:vlen %# Run through the number of given structure field names
+  for vcntarg = 1:vlen  # Run through the number of given structure field names
 
     switch (vfld{vcntarg})
 
-      case 'RelTol'
+      case "RelTol"
         if (isempty   (vret.(vfld{vcntarg})) || ...
            (isnumeric (vret.(vfld{vcntarg})) && ...
            isreal    (vret.(vfld{vcntarg})) && ...
-           all       (vret.(vfld{vcntarg}) > 0))) %# 'all' is a MatLab need
+           all       (vret.(vfld{vcntarg}) > 0)))  # "all" is a MatLab need
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-        switch (vsol)
-          case {'ode23', 'ode45', 'ode54', 'ode78', ...
-                'ode23d', 'ode45d', 'ode54d', 'ode78d',}
-            if (~isscalar (vret.(vfld{vcntarg})) && ...
-                ~isempty (vret.(vfld{vcntarg})))
-              error ('OdePkg:InvalidParameter', ...
-                'Value of option "RelTol" must be a scalar');
-            end
-          otherwise
+        if (any (strcmp (vsol, {"ode23", "ode45", "ode54", "ode78", 
+                                "ode23d", "ode45d", "ode54d", "ode78d"})))
+          if (! isscalar (vret.(vfld{vcntarg}))
+              && ! isempty (vret.(vfld{vcntarg})))
+            error ("OdePkg:InvalidParameter",
+                   'Value of option "RelTol" must be a scalar');
+          endif
+        endif
 
-          end
-
-      case 'AbsTol'
+      case "AbsTol"
         if (isempty   (vret.(vfld{vcntarg})) || ...
            (isnumeric (vret.(vfld{vcntarg})) && ...
             isreal    (vret.(vfld{vcntarg})) && ...
             all       (vret.(vfld{vcntarg}) > 0)))
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'NormControl'
+      case "NormControl"
         if (isempty   (vret.(vfld{vcntarg})) || ...
-           (strcmp (vret.(vfld{vcntarg}), 'on') || ...
-            strcmp (vret.(vfld{vcntarg}), 'off')))
+           (strcmp (vret.(vfld{vcntarg}), "on") || ...
+            strcmp (vret.(vfld{vcntarg}), "off")))
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'NonNegative'
+      case "NonNegative"
         if (isempty  (vret.(vfld{vcntarg})) || ...
-            (isnumeric (vret.(vfld{vcntarg})) && isvector (vret.(vfld{vcntarg}))))
+            (isnumeric (vret.(vfld{vcntarg}))
+             && isvector (vret.(vfld{vcntarg}))))
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'OutputFcn'
+      case "OutputFcn"
         if (isempty (vret.(vfld{vcntarg})) || ...
-            isa     (vret.(vfld{vcntarg}), 'function_handle'))
+            isa     (vret.(vfld{vcntarg}), "function_handle"))
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'OutputSel'
+      case "OutputSel"
         if (isempty  (vret.(vfld{vcntarg})) || ...
-            (isnumeric (vret.(vfld{vcntarg})) && isvector (vret.(vfld{vcntarg}))) || ...
+            (isnumeric (vret.(vfld{vcntarg}))
+             && isvector (vret.(vfld{vcntarg}))) || ...
             isscalar (vret.(vfld{vcntarg})))
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'OutputSave'
+      case "OutputSave"
         if (isempty (vret.(vfld{vcntarg})) || ...
             (isscalar (vret.(vfld{vcntarg})) && ...
              mod (vret.(vfld{vcntarg}), 1) == 0 && ...
              vret.(vfld{vcntarg}) > 0) || ...
             vret.(vfld{vcntarg}) == Inf)
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
         
-      case 'Refine'
+      case "Refine"
         if (isempty   (vret.(vfld{vcntarg})) || ...
            (isscalar (vret.(vfld{vcntarg})) && ...
             mod (vret.(vfld{vcntarg}), 1) == 0 && ...
             vret.(vfld{vcntarg}) >= 0 && ...
             vret.(vfld{vcntarg}) <= 5))
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'Stats'
+      case "Stats"
         if (isempty   (vret.(vfld{vcntarg})) || ...
-           (strcmp (vret.(vfld{vcntarg}), 'on') || ...
-            strcmp (vret.(vfld{vcntarg}), 'off')))
+           (strcmp (vret.(vfld{vcntarg}), "on") || ...
+            strcmp (vret.(vfld{vcntarg}), "off")))
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'InitialStep'
+      case "InitialStep"
         if (isempty (vret.(vfld{vcntarg})) || ...
             (isscalar (vret.(vfld{vcntarg})) && ...
              isreal (vret.(vfld{vcntarg}))))
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'MaxStep'
+      case "MaxStep"
         if (isempty (vret.(vfld{vcntarg})) || ...
             (isscalar (vret.(vfld{vcntarg})) && ...
              vret.(vfld{vcntarg}) > 0) )
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'Events'
+      case "Events"
         if (isempty (vret.(vfld{vcntarg})) || ...
-            isa     (vret.(vfld{vcntarg}), 'function_handle'))
+            isa     (vret.(vfld{vcntarg}), "function_handle"))
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'Jacobian'
+      case "Jacobian"
         if (isempty (vret.(vfld{vcntarg})) || ...
             isnumeric (vret.(vfld{vcntarg})) || ...
-            isa (vret.(vfld{vcntarg}), 'function_handle') || ...
+            isa (vret.(vfld{vcntarg}), "function_handle") || ...
             iscell (vret.(vfld{vcntarg})))
         else
-          error ('OdePkg:InvalidParameter', ...
-                 'Unknown parameter name "%s" or no valid parameter value', ...
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
                  vfld{vcntarg});
-        end
+        endif
 
-      case 'JPattern'
+      case "JPattern"
         if (isempty (vret.(vfld{vcntarg})) || ...
             isvector (vret.(vfld{vcntarg})) || ...
             isnumeric (vret.(vfld{vcntarg})))
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'Vectorized'
+      case "Vectorized"
         if (isempty   (vret.(vfld{vcntarg})) || ...
-           (strcmp (vret.(vfld{vcntarg}), 'on') || ...
-            strcmp (vret.(vfld{vcntarg}), 'off')))
+           (strcmp (vret.(vfld{vcntarg}), "on") || ...
+            strcmp (vret.(vfld{vcntarg}), "off")))
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'Mass'
+      case "Mass"
         if (isempty (vret.(vfld{vcntarg})) || ...
             (isnumeric (vret.(vfld{vcntarg})) || ...
-            isa (vret.(vfld{vcntarg}), 'function_handle')))
+            isa (vret.(vfld{vcntarg}), "function_handle")))
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'MStateDependence'
+      case "MStateDependence"
         if (isempty   (vret.(vfld{vcntarg})) || ...
-           (strcmp (vret.(vfld{vcntarg}), 'none') || ...
-            strcmp (vret.(vfld{vcntarg}), 'weak') || ...
-            strcmp (vret.(vfld{vcntarg}), 'strong')))
+           (strcmp (vret.(vfld{vcntarg}), "none") || ...
+            strcmp (vret.(vfld{vcntarg}), "weak") || ...
+            strcmp (vret.(vfld{vcntarg}), "strong")))
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'MvPattern'
+      case "MvPattern"
         if (isempty (vret.(vfld{vcntarg})) || ...
             (isvector (vret.(vfld{vcntarg})) || ...
             isnumeric (vret.(vfld{vcntarg}))))
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'MassSingular'
+      case "MassSingular"
         if (isempty (vret.(vfld{vcntarg})) || ...
-            (strcmp (vret.(vfld{vcntarg}), 'yes') || ...
-            strcmp (vret.(vfld{vcntarg}), 'no') || ...
-            strcmp (vret.(vfld{vcntarg}), 'maybe')))
+            (strcmp (vret.(vfld{vcntarg}), "yes") || ...
+            strcmp (vret.(vfld{vcntarg}), "no") || ...
+            strcmp (vret.(vfld{vcntarg}), "maybe")))
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'InitialSlope'
+      case "InitialSlope"
         if (isempty (vret.(vfld{vcntarg})) || ...
             isvector (vret.(vfld{vcntarg})))
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'MaxOrder'
+      case "MaxOrder"
         if (isempty (vret.(vfld{vcntarg})) || ...
             (mod (vret.(vfld{vcntarg}), 1) == 0 && ...
              vret.(vfld{vcntarg}) > 0 && ...
              vret.(vfld{vcntarg}) < 8))
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'BDF'
+      case "BDF"
         if (isempty (vret.(vfld{vcntarg})) || ...
-            (strcmp (vret.(vfld{vcntarg}), 'on') || ...
-             strcmp (vret.(vfld{vcntarg}), 'off')))
+            (strcmp (vret.(vfld{vcntarg}), "on") || ...
+             strcmp (vret.(vfld{vcntarg}), "off")))
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'NewtonTol'
+      case "NewtonTol"
         if (isempty   (vret.(vfld{vcntarg})) || ...
            (isnumeric (vret.(vfld{vcntarg})) && ...
             isreal    (vret.(vfld{vcntarg})) && ...
-            all       (vret.(vfld{vcntarg}) > 0))) %# 'all' is a MatLab need
+            all       (vret.(vfld{vcntarg}) > 0)))  # "all" is a MatLab need
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'MaxNewtonIterations'
+      case "MaxNewtonIterations"
         if (isempty (vret.(vfld{vcntarg})) || ...
             (mod (vret.(vfld{vcntarg}), 1) == 0 && ...
              vret.(vfld{vcntarg}) > 0))
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      %# new fields added
-      case 'Algorithm'
-        if( isempty(vret.(vfld{vcntarg})) || ischar(vret.(vfld{vcntarg})) )
+      ## new fields added
+      case "Algorithm"
+        if ( isempty(vret.(vfld{vcntarg})) || ischar(vret.(vfld{vcntarg})) )
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'Choice'
-        if( isempty(vret.(vfld{vcntarg})) || (isnumeric(vret.(vfld{vcntarg})) && (vret.(vfld{vcntarg})==1) || vret.(vfld{vcntarg})==2 ) )
+      case "Choice"
+        if ( isempty(vret.(vfld{vcntarg}))
+            || (isnumeric(vret.(vfld{vcntarg})) && (vret.(vfld{vcntarg})==1)
+                || vret.(vfld{vcntarg})==2 ) )
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'Eta'
-        if( isempty(vret.(vfld{vcntarg})) || ( isreal(vret.(vfld{vcntarg})) && vret.(vfld{vcntarg})>=0 && vret.(vfld{vcntarg})<1) )
+      case "Eta"
+        if ( isempty(vret.(vfld{vcntarg}))
+            || ( isreal(vret.(vfld{vcntarg}))
+                && vret.(vfld{vcntarg})>=0 && vret.(vfld{vcntarg})<1) )
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'Explicit'
-        if( isempty(vret.(vfld{vcntarg})) || (ischar(vret.(vfld{vcntarg})) && (strcmp(vret.(vfld{vcntarg}),'yes') || strcmp(vret.(vfld{vcntarg}),'no'))) )
+      case "Explicit"
+        if ( isempty(vret.(vfld{vcntarg}))
+            || (ischar(vret.(vfld{vcntarg}))
+                && (strcmp(vret.(vfld{vcntarg}),"yes")
+                || strcmp(vret.(vfld{vcntarg}),"no"))) )
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'InexactSolver'
-        if( isempty(vret.(vfld{vcntarg})) || ischar(vret.(vfld{vcntarg})) )
+      case "InexactSolver"
+        if ( isempty(vret.(vfld{vcntarg})) || ischar(vret.(vfld{vcntarg})) )
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'InitialSlope'
-        if( isempty(vret.(vfld{vcntarg})) || ( ischar(vret.(vfld{vcntarg})) || (isnumeric(vret.(vfld{vcntarg})) && (isvector(vret.(vfld{vcntarg})) || isreal(vret.(vfld{vcntarg}))))) )
+      case "InitialSlope"
+        if ( isempty(vret.(vfld{vcntarg}))
+            || ( ischar(vret.(vfld{vcntarg}))
+                || (isnumeric(vret.(vfld{vcntarg}))
+                    && (isvector(vret.(vfld{vcntarg}))
+                        || isreal(vret.(vfld{vcntarg}))))) )
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'JConstant'
-        if( isempty(vret.(vfld{vcntarg})) || (ischar(vret.(vfld{vcntarg})) && (strcmp(vret.(vfld{vcntarg}),'yes') || strcmp(vret.(vfld{vcntarg}),'no'))) )
+      case "JConstant"
+        if ( isempty(vret.(vfld{vcntarg}))
+            || (ischar(vret.(vfld{vcntarg}))
+                && (strcmp(vret.(vfld{vcntarg}),"yes")
+                    || strcmp(vret.(vfld{vcntarg}),"no"))) )
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'MassConstant'
-        if( isempty(vret.(vfld{vcntarg})) || (strcmp(vret.(vfld{vcntarg}),'on') || strcmp(vret.(vfld{vcntarg}),'off')) )
+      case "MassConstant"
+        if ( isempty(vret.(vfld{vcntarg}))
+            || (strcmp(vret.(vfld{vcntarg}),"on")
+                || strcmp(vret.(vfld{vcntarg}),"off")) )
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'PolynomialDegree'
-        if( isempty(vret.(vfld{vcntarg})) || (isnumeric(vret.(vfld{vcntarg})) && mod(vret.(vfld{vcntarg}),1)==0 && vret.(vfld{vcntarg})>0) )
+      case "PolynomialDegree"
+        if ( isempty(vret.(vfld{vcntarg}))
+            || (isnumeric(vret.(vfld{vcntarg}))
+                && mod(vret.(vfld{vcntarg}),1)==0 && vret.(vfld{vcntarg})>0) )
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'QuadratureOrder'
-        if( isempty(vret.(vfld{vcntarg})) || (isnumeric(vret.(vfld{vcntarg})) && mod(vret.(vfld{vcntarg}),1)==0 && vret.(vfld{vcntarg})>0) )
+      case "QuadratureOrder"
+        if ( isempty(vret.(vfld{vcntarg}))
+            || (isnumeric(vret.(vfld{vcntarg}))
+                && mod(vret.(vfld{vcntarg}),1)==0 && vret.(vfld{vcntarg})>0) )
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'Restart'
-        if( isempty(vret.(vfld{vcntarg})) || (isnumeric(vret.(vfld{vcntarg})) && mod(vret.(vfld{vcntarg}),1)==0 && vret.(vfld{vcntarg})>0) )
+      case "Restart"
+        if ( isempty(vret.(vfld{vcntarg}))
+            || (isnumeric(vret.(vfld{vcntarg}))
+                && mod(vret.(vfld{vcntarg}),1)==0 && vret.(vfld{vcntarg})>0) )
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'TimeStepNumber'
-        if( isempty(vret.(vfld{vcntarg})) || (isnumeric(vret.(vfld{vcntarg})) && mod(vret.(vfld{vcntarg}),1)==0 && vret.(vfld{vcntarg})>0) )
+      case "TimeStepNumber"
+        if ( isempty(vret.(vfld{vcntarg}))
+            || (isnumeric(vret.(vfld{vcntarg}))
+                && mod(vret.(vfld{vcntarg}),1)==0 && vret.(vfld{vcntarg})>0) )
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'TimeStepSize'
-        if( isempty(vret.(vfld{vcntarg})) || ( isreal(vret.(vfld{vcntarg})) && vret.(vfld{vcntarg})!=0) )
+      case "TimeStepSize"
+        if ( isempty(vret.(vfld{vcntarg}))
+            || ( isreal(vret.(vfld{vcntarg})) && vret.(vfld{vcntarg})!=0) )
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
-      case 'UseJacobian'
-        if( isempty(vret.(vfld{vcntarg})) || (ischar(vret.(vfld{vcntarg})) && (strcmp(vret.(vfld{vcntarg}),'yes') || strcmp(vret.(vfld{vcntarg}),'no'))) )
+      case "UseJacobian"
+        if ( isempty(vret.(vfld{vcntarg}))
+            || (ischar(vret.(vfld{vcntarg}))
+                && (strcmp(vret.(vfld{vcntarg}),"yes")
+                    || strcmp(vret.(vfld{vcntarg}),"no"))) )
         else
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s" or no valid parameter value', ...
-            vfld{vcntarg});
-        end
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s" or no valid parameter value',
+                 vfld{vcntarg});
+        endif
 
       otherwise
-          error ('OdePkg:InvalidParameter', ...
-            'Unknown parameter name "%s"', ...
-            vfld{vcntarg});
+          error ("OdePkg:InvalidParameter",
+                 'Unknown parameter name "%s"',
+                 vfld{vcntarg});
 
-    end %# switch
+    endswitch
 
-  end %# for
+  endfor
+
+endfunction
+
 
 %!demo
 %! # Return the checked OdePkg options structure that is created by
 %! # the command odeset.
 %!
 %! odepkg_structure_check (odeset);
-%!
+
 %!demo
 %! # Create the OdePkg options structure A with odeset and check it 
-%! # with odepkg_structure_check. This actually is unnecessary
-%! # because odeset automtically calls odepkg_structure_check before
+%! # with odepkg_structure_check.  This actually is unnecessary
+%! # because odeset automatically calls odepkg_structure_check before
 %! # returning.
 %!
 %! A = odeset (); odepkg_structure_check (A);
 
-%# Local Variables: ***
-%# mode: octave ***
-%# End: ***