changeset 15748:54e8c2527a9e

style and doc fixes for newly imported Java package .m files * java/cell2mlstr.m, java/errordlg.m, java/helpdlg.m, java/inputdlg.m, java/javaArray.m, java/javaaddpath.m, java/javaclasspath.m, java/javafields.m, java/javamem.m, java/javamethods.m, java/javarmpath.m, java/listdlg.m, java/msgbox.m java/questdlg.m, java/warndlg.m: Style and doc fixes.
author John W. Eaton <jwe@octave.org>
date Fri, 07 Dec 2012 17:21:27 -0500
parents 4be890c5527c
children 54f7ef3f7e63
files scripts/java/cell2mlstr.m scripts/java/errordlg.m scripts/java/helpdlg.m scripts/java/inputdlg.m scripts/java/javaArray.m scripts/java/javaaddpath.m scripts/java/javaclasspath.m scripts/java/javafields.m scripts/java/javamem.m scripts/java/javamethods.m scripts/java/javarmpath.m scripts/java/listdlg.m scripts/java/msgbox.m scripts/java/questdlg.m scripts/java/warndlg.m
diffstat 15 files changed, 430 insertions(+), 401 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/java/cell2mlstr.m	Fri Dec 07 16:19:22 2012 -0500
+++ b/scripts/java/cell2mlstr.m	Fri Dec 07 17:21:27 2012 -0500
@@ -24,15 +24,17 @@
 ## https://savannah.gnu.org/bugs/?func=detailitem&item_id=31468#comment4
 ## Created: 2012-06-29
 
-function [ ret ] = cell2mlstr (cstr)
+function retval = cell2mlstr (cstr)
 
   if (! iscellstr (cstr))
     ## Only use char elements
     cstr = cstr (find (cellfun ("ischar", cstr)));
   endif
+
   ## Treat cell string array as multi-line text
   cstr(1:2:2*numel (cstr)) = cstr;
   cstr(2:2:numel (cstr)) = "\n";
-  ret = [cstr{:}];
+
+  retval = [cstr{:}];
 
 endfunction
--- a/scripts/java/errordlg.m	Fri Dec 07 16:19:22 2012 -0500
+++ b/scripts/java/errordlg.m	Fri Dec 07 17:21:27 2012 -0500
@@ -17,17 +17,19 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function file} {@var{P} =} errordlg (@var{MESSAGE} [,@var{TITLE}])
+## @deftypefn {Function file} {@var{p} =} errordlg (@var{msg}, @var{title})
+## Display @var{msg} using an error dialog box.
 ##
-## Displays the @var{MESSAGE} (character string or cell string array for
-## multi-line text) using an error dialog box. 
-## @var{TITLE} can be used optionally to decorate the dialog caption.
+## The message may have multiple lines separated by newline characters
+## (@code{"\n"}), or it may be a cellstr array with one element for each
+## line.  The optional @var{title} (character string) can be used to
+## decorate the dialog caption.
+##
 ## The return value is always 1.
-##
+## @seealso{helpdlg, inputdlg, listdlg, questdlg, warndlg}
 ## @end deftypefn
-## @seealso{helpdlg, inputdlg, listdlg, questdlg, warndlg}
 
-function ret = errordlg (message, varargin)
+function retval = errordlg (message, varargin)
 
   if (! ischar (message))
     if (iscell (message))
@@ -38,9 +40,10 @@
   endif
 
   switch length (varargin)
-  case 0
-    title = "Error Dialog";
-  otherwise
+    case 0
+      title = "Error Dialog";
+
+    otherwise
       title = varargin{1};
   endswitch
 
@@ -48,6 +51,6 @@
     error ("errordlg: character string expected for title");
   endif
 
-  ret = java_invoke ("org.octave.JDialogBox", "errordlg", message, title);
+  retval = java_invoke ("org.octave.JDialogBox", "errordlg", message, title);
 
 endfunction
--- a/scripts/java/helpdlg.m	Fri Dec 07 16:19:22 2012 -0500
+++ b/scripts/java/helpdlg.m	Fri Dec 07 17:21:27 2012 -0500
@@ -17,20 +17,19 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function file} {@var{P} =} helpdlg (@var{MESSAGE} [,@var{TITLE}])
-##
-## Displays a @var{MESSAGE} in a help dialog box.
+## @deftypefn {Function file} {@var{p} =} helpdlg (@var{msg} ,@var{title}])
+## Display @var{msg} in a help dialog box.
 ##
-## @var{message} can have multiple lines separated by newline characters
-## ("\n"), or it can be a cellstr array (one element for each line).
-## The optional @var{TITLE} (character string) can be used to decorate the
-## dialog caption.
+## The message may have multiple lines separated by newline characters
+## (@code{"\n"}), or it may be a cellstr array with one element for each
+## line.  The optional @var{title} (character string) can be used to
+## decorate the dialog caption.
+##
 ## The return value is always 1.
-##
+## @seealso{errordlg, inputdlg, listdlg, questdlg, warndlg}
 ## @end deftypefn
-## @seealso{errordlg, inputdlg, listdlg, questdlg, warndlg}
 
-function ret = helpdlg (message, varargin)
+function retval = helpdlg (message, varargin)
 
   if (! ischar (message))
     if (iscell (message))
@@ -41,20 +40,21 @@
   endif
   
   switch length (varargin)
-  case 0
-     title = "Help Dialog";
-  otherwise
-    if (ischar (varargin {1}))
-      title = varargin{1};
-    else
-      error ("helpdlg: character string expected for title");
-    endif
+    case 0
+      title = "Help Dialog";
+
+    otherwise
+      if (ischar (varargin {1}))
+        title = varargin{1};
+      else
+        error ("helpdlg: character string expected for title");
+      endif
   endswitch
 
   if (! ischar (title))
     error ("helpdlg: character string expected for title");
   endif
 
-  ret = java_invoke ("org.octave.JDialogBox", "helpdlg", message, title);
+  retval = java_invoke ("org.octave.JDialogBox", "helpdlg", message, title);
 
 endfunction
--- a/scripts/java/inputdlg.m	Fri Dec 07 16:19:22 2012 -0500
+++ b/scripts/java/inputdlg.m	Fri Dec 07 17:21:27 2012 -0500
@@ -17,35 +17,39 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function file} {@var{P} =} inputdlg (@var{PROMPT} [,@var{TITLE} [,@var{ROWSCOLS}, @var{DEFAULTS}]])
+## @deftypefn {Function file} {@var{p} =} inputdlg (@var{prompt}, @var{title}, @var{rowscols}, @var{defaults})
+## Return user input from a multi-textfield dialog box in a cell array
+## of strings, or an empty cell array if the dialog is closed by the
+## Cancel button.
 ##
-## Returns the user's inputs from a multi-textfield dialog box in form of a cell array of strings.
-## If the dialog is closed by the Cancel button, an empty cell array is returned.
-##
-## @table @samp
-## @item PROMPT
-## The first argument @var{PROMPT} is mandatory.
+## @table @var
+## @item prompt
+## The first argument @var{prompt} is mandatory.
 ## It is a cell array with strings labeling each textfield. 
-## @item TITLE
-## The optional string @var{TITLE} can be used as the caption of the dialog. 
-## @item ROWSCOLS
-## The size of the text fields can be defined by the argument @var{ROWSCOLS}, 
-##  which can have three forms:
-## - a scalar value which defines the number of rows used for each text field.
-## - a vector which defines the individual number of rows used for each text field.
-## - a matrix which defines the individual number of rows and columns used for each text field.
-## @item DEFAULTS
+## @item title
+## The optional string @var{title} can be used as the caption of the dialog. 
+## @item rowscols
+## The size of the text fields can be defined by the argument @var{rowscols}, 
+## which can have three forms:
+## @enumerate
+## @item a scalar value which defines the number of rows used for each
+## text field.
+## @item a vector which defines the individual number of rows
+## used for each text field. 
+## @item a matrix which defines the individual number of rows and
+## columns used for each text field.
+## @end enumerate
+## @item defaults
 ## It is possible to place default values into the text fields by supplying
-## the a cell array of strings or number for the argument @var{DEFAULTS}.
+## the a cell array of strings or number for the argument @var{defaults}.
 ## @end table
-##
+## @seealso{errordlg, helpdlg, listdlg, questdlg, warndlg}
 ## @end deftypefn
-## @seealso{errordlg, helpdlg, listdlg, questdlg, warndlg}
 
-function varargout = inputdlg (prompt, varargin)
+function retval = inputdlg (prompt, varargin)
 
   if (iscell (prompt))
-    % Silently extract only char elements
+    ## Silently extract only char elements
     prompt = prompt (find (cellfun ("ischar", prompt)));
   elseif (ischar (prompt))
     prompt = {prompt};
@@ -54,68 +58,71 @@
   endif
 
   switch length (varargin)
-  case 0
-     title = "Input Dialog";
-     lineNo = 1;
-     defaults = cellstr (cell( size (prompt)));
-  case 1
-     title = varargin{1};
-     lineNo = 1;
-     defaults = cellstr (cell (size (prompt)));
-  case 2
-     title = varargin{1};
-     lineNo = varargin{2};
-     defaults = cellstr (cell (size (prompt)));
-  otherwise
-     title = varargin{1};
-     lineNo = varargin{2};
-     defaults = varargin{3};
-  end
+    case 0
+      title = "Input Dialog";
+      lineNo = 1;
+      defaults = cellstr (cell( size (prompt)));
+
+    case 1
+      title = varargin{1};
+      lineNo = 1;
+      defaults = cellstr (cell (size (prompt)));
+
+    case 2
+      title = varargin{1};
+      lineNo = varargin{2};
+      defaults = cellstr (cell (size (prompt)));
+
+    otherwise
+      title = varargin{1};
+      lineNo = varargin{2};
+      defaults = varargin{3};
+  endswitch
 
   if (! ischar (title))
     error ("inputdlg: character string expected for title");
   endif
 
-  % specification of text field sizes as in Matlab 
-  % Matlab requires a matrix for lineNo, not a cell array...
-  % rc = [1,10; 2,20; 3,30];
-  %     c1  c2
-  % r1  1   10   first  text field is 1x10
-  % r2  2   20   second text field is 2x20
-  % r3  3   30   third  text field is 3x30
-  if isscalar(lineNo)
-    % only scalar value in lineTo, copy from lineNo and add defaults
+  ## specification of text field sizes as in Matlab 
+  ## Matlab requires a matrix for lineNo, not a cell array...
+  ## rc = [1,10; 2,20; 3,30];
+  ##     c1  c2
+  ## r1  1   10   first  text field is 1x10
+  ## r2  2   20   second text field is 2x20
+  ## r3  3   30   third  text field is 3x30
+  if (isscalar (lineNo))
+    ## only scalar value in lineTo, copy from lineNo and add defaults
     rowscols = zeros(size(prompt)(2),2);
-    % cols
+    ## cols
     rowscols(:,2) = 25;
     rowscols(:,1) = lineNo;
-  elseif isvector(lineNo)
-      % only one column in lineTo, copy from vector lineNo and add defaults
-      rowscols = zeros(size(prompt)(2),2);
-      % rows from colum vector lineNo, columns are set to default
+  elseif (isvector (lineNo))
+      ## only one column in lineTo, copy from vector lineNo and add defaults
+      rowscols = zeros (columns (prompt), 2);
+      ## rows from colum vector lineNo, columns are set to default
       rowscols(:,2) = 25;
       rowscols(:,1) = lineNo(:);         
-  elseif ismatrix(lineNo)
-    if (size(lineNo)(1) == size(prompt)(2)) && (size(lineNo)(2) == 2)
-      % (rows x columns) match, copy array lineNo
+  elseif (ismatrix (lineNo))
+    if (rows (lineNo) == columns (prompt) && columns (lineNo) == 2)
+      ## (rows x columns) match, copy array lineNo
       rowscols = lineNo;
-    end
+    endif
   else
-    % dunno
-    disp('inputdlg: unknown form of lineNo argument.');
-    lineNo
-  end
+    ## dunno
+    error ("inputdlg: unknown form of lineNo argument");
+  endif
   
-  % convert numeric values in defaults cell array to strings
-  defs = cellfun(@num2str,defaults,'UniformOutput',false);
-  rc = arrayfun(@num2str,rowscols,'UniformOutput',false);
+  ## convert numeric values in defaults cell array to strings
+  defs = cellfun (@num2str, defaults, "UniformOutput", false);
+  rc = arrayfun (@num2str, rowscols, "UniformOutput", false);
 
-  user_inputs = java_invoke ("org.octave.JDialogBox", "inputdlg", prompt, title, rc, defs);
+  user_inputs = java_invoke ("org.octave.JDialogBox", "inputdlg",
+                             prompt, title, rc, defs);
   
-   if isempty(user_inputs)
-      varargout{1} = {};  % empty
+   if (isempty (user_inputs))
+     retval = {};
    else
-      varargout{1} = cellstr (user_inputs);
-   end
+     retval = cellstr (user_inputs);
+   endif
 
-end
+endfunction
--- a/scripts/java/javaArray.m	Fri Dec 07 16:19:22 2012 -0500
+++ b/scripts/java/javaArray.m	Fri Dec 07 17:21:27 2012 -0500
@@ -17,35 +17,37 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function file} {@var{a} =} javaArray (@var{class},@var{[M,N,...]})
-## @deftypefnx {Function file} {@var{a} =} javaArray (@var{class},@var{M},@var{N},...)
+## @deftypefn {Function file} {@var{a} =} javaArray (@var{class}, @var{[M,N,...]})
+## @deftypefnx {Function file} {@var{a} =} javaArray (@var{class}, @var{M}, @var{N}, @dots{})
 ##
-## Creates a Java array of size [@var{M},@var{N},...] with elements of
-## class @var{class}. @var{class} can be a Java object representing a class
-## or a string containing the fully qualified class name.
+## Creates a Java array of size @code{[@var{M}, @var{N}, @dots{}]} with
+## elements of class @var{class}.  @var{class} may be a Java object
+## representing a class or a string containing the fully qualified class name.
 ##
 ## The generated array is uninitialized, all elements are set to null
 ## if @var{class} is a reference type, or to a default value (usually 0)
 ## if @var{class} is a primitive type.
 ##
 ## @example
-##   a = javaArray ("java.lang.String", 2, 2);
-##   a(1,1) = "Hello";
+## a = javaArray ("java.lang.String", 2, 2);
+## a(1,1) = "Hello";
 ## @end example
-##
 ## @end deftypefn
 
-function [ ret ] = javaArray (class_name, varargin)
+function retval = javaArray (class_name, varargin)
 
   switch length (varargin)
-  case 0
-    error ("missing array size");
-  case 1
-    dims = varargin{1};
-  otherwise
-    dims = [varargin{:}];
+    case 0
+      error ("missing array size");
+
+    case 1
+      dims = varargin{1};
+
+    otherwise
+      dims = [varargin{:}];
   endswitch
 
-  ret = java_invoke ("org.octave.ClassHelper", "createArray", class_name, dims);
+  retval = java_invoke ("org.octave.ClassHelper", "createArray",
+                        class_name, dims);
 
 endfunction
--- a/scripts/java/javaaddpath.m	Fri Dec 07 16:19:22 2012 -0500
+++ b/scripts/java/javaaddpath.m	Fri Dec 07 17:21:27 2012 -0500
@@ -19,20 +19,17 @@
 
 ## -*- texinfo -*-
 ## @deftypefn {Function file} {} javaaddpath (@var{path})
-##
-## Adds @var{path} to the dynamic class path of the Java virtual
-## machine. @var{path} can be either a directory where .class files
-## can be found, or a .jar file containing Java classes.
-##
+## Add @var{path} to the dynamic class path of the Java virtual
+## machine.  @var{path} may be either a directory where @file{.class}
+## files are found, or a @file{.jar} file containing Java classes.
+## @seealso{javaclasspath}
 ## @end deftypefn
-## @seealso{javaclasspath}
 
 function javaaddpath (class_path)
 
   if (nargin != 1)
     print_usage ();
   else
-    % MH 30-08-2010: added tilde_expand to allow for specification of user's home
     new_path = canonicalize_file_name (tilde_expand (class_path));
     if (exist (new_path, "dir"))
       if (! strcmp (new_path (end), filesep))
@@ -42,6 +39,10 @@
       error ("invalid Java classpath: %s", class_path);
     endif
     success = java_invoke ("org.octave.ClassHelper", "addClassPath", new_path);
+
+    if (! success)
+      warning ("javaaddpath: failed to add '%s' to Java classpath", new_path);
+    endif
   endif 
    
 endfunction
--- a/scripts/java/javaclasspath.m	Fri Dec 07 16:19:22 2012 -0500
+++ b/scripts/java/javaclasspath.m	Fri Dec 07 17:21:27 2012 -0500
@@ -18,60 +18,61 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function file}  {}          javaclasspath
-## @deftypefnx {Function file} {@var{STATIC} =} javaclasspath
-## @deftypefnx {Function file} {[@var{STATIC}, @var{DYNAMIC}] =} javaclasspath
-## @deftypefnx {Function file} {@var{PATH} =} javaclasspath (@var{WHAT})
-##
-## Returns the class path of the Java virtual machine in
+## @deftypefn {Function file}  {} javaclasspath ()
+## @deftypefnx {Function file} {@var{static} =} javaclasspath ()
+## @deftypefnx {Function file} {[@var{static}, @var{dynamic}] =} javaclasspath ()
+## @deftypefnx {Function file} {@var{path} =} javaclasspath (@var{what})
+## Return the class path of the Java virtual machine in
 ## the form of a cell array of strings. 
 ##
 ## If called without input parameter:@*
 ## @itemize
-## @item If no output variable is given, the result is simply printed 
+## @item If no output is requested, the result is simply printed 
 ## on the standard output.
-## @item If one output variable @var{STATIC} is given, the result is
+## @item If one output value @var{STATIC} is requested, the result is
 ## the static classpath.
-## @item If two output variables @var{STATIC} and @var{DYNAMIC} are 
-## given, the first variable will contain the static classpath,
-## the second will be filled with the dynamic claspath.
+## @item If two output values@var{STATIC} and @var{DYNAMIC} are 
+## requested, the first variable will contain the static classpath,
+## the second will be filled with the dynamic classpath.
 ## @end itemize
 ## 
-## If called with a single input parameter @var{WHAT}:@*
+## If called with a single input parameter @var{what}:@*
 ## @itemize
-## @item If @var{WHAT} is '-static' the static classpath is returned.
-## @item If @var{WHAT} is '-dynamic' the dynamic  classpath is returned.
-## @item If @var{WHAT} is '-all' the static and the dynamic classpath 
-## are returned in a single cell array
+## @item If @var{what} is @code{"-static"} return the static classpath
+## @item If @var{what} is @code{"-dynamic"} return the dynamic classpath
+## @item If @var{what} is @code{"-all"} return both the static and
+## dynamic classpath
 ## @end itemize
+## @seealso{javaaddpath, javarmpath}
 ## @end deftypefn
-## @seealso{javaaddpath,javarmpath}
 
 function varargout = javaclasspath (which)
 
-  % dynamic classpath
+  ## dynamic classpath
   dynamic_path = java_invoke ("org.octave.ClassHelper", "getClassPath");
   dynamic_path_list = strsplit (dynamic_path, pathsep ());
 
-  % static classpath
-  static_path = java_invoke ('java.lang.System', 'getProperty', 'java.class.path');
+  ## static classpath
+  static_path = java_invoke ("java.lang.System", "getProperty", "java.class.path");
   static_path_list = strsplit (static_path, pathsep ());
-  if (length (static_path_list) > 1)
-    % remove first element (which is .../octave.jar)
-    static_path_list = static_path_list(2:length (static_path_list));
+  if (numel (static_path_list) > 1)
+    ## remove first element (which is .../octave.jar)
+    static_path_list = static_path_list(2:numel (static_path_list));
   else
     static_path_list = {};
-  end
+  endif
 
   switch nargin
     case 0
       switch nargout
         case 0
-          disp_path_list ( 'STATIC', static_path_list )
-          disp('');
-          disp_path_list ( 'DYNAMIC', dynamic_path_list )
+          disp_path_list ( "STATIC", static_path_list )
+          disp ("");
+          disp_path_list ( "DYNAMIC", dynamic_path_list )
+
         case 1
           varargout{1} = cellstr (dynamic_path_list);
+
         case 2
           varargout{1} = cellstr (dynamic_path_list);
           varargout{2} = cellstr (static_path_list);
@@ -80,31 +81,32 @@
     case 1
       switch nargout
         case 0
-          if (strcmp (which, '-static') == 1)
-            disp_path_list ( 'STATIC', static_path_list )
-          elseif (strcmp (which, '-dynamic') == 1)
-            disp_path_list ( 'DYNAMIC', dynamic_path_list )
-          end
+          if (strcmp (which, "-static") == 1)
+            disp_path_list ( "STATIC", static_path_list )
+          elseif (strcmp (which, "-dynamic") == 1)
+            disp_path_list ( "DYNAMIC", dynamic_path_list )
+          endif
+
         case 1
-          if (strcmp (which, '-static') == 1)
+          if (strcmp (which, "-static") == 1)
             varargout{1} = cellstr (static_path_list);
-          elseif (strcmp (which, '-dynamic') == 1)
+          elseif (strcmp (which, "-dynamic") == 1)
             varargout{1} = cellstr (dynamic_path_list);
-          elseif (strcmp (which, '-all') == 1)
+          elseif (strcmp (which, "-all") == 1)
             varargout{1} = cellstr ([static_path_list, dynamic_path_list]);
-          end
+          endif
       endswitch
   endswitch
   
-end
-#
-# Display cell array of paths
-#
+endfunction
+
+## Display cell array of paths
+
 function disp_path_list ( which, path_list )
-  printf ('   %s JAVA PATH\n\n', which);
+  printf ("   %s JAVA PATH\n\n", which);
   if (length (path_list) > 0)
-    printf ('      %s\n', path_list{:});
+    printf ("      %s\n", path_list{:});
   else
-    printf ('      - empty -\n');
+    printf ("      - empty -\n");
   endif
-end
+endfunction
--- a/scripts/java/javafields.m	Fri Dec 07 16:19:22 2012 -0500
+++ b/scripts/java/javafields.m	Fri Dec 07 17:21:27 2012 -0500
@@ -17,31 +17,30 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function file} {@var{P} =} javafields (@var{class})
-##
-## Returns the fields of a Java object in the form of a cell 
-## array of strings. If no output variable is
-## given, the result is simply printed on the standard output.
-##
+## @deftypefn {Function file} {@var{p} =} javafields (@var{class})
+## Return the fields of a Java object in the form of a cell 
+## array of strings.  If no output is requested, print the result
+## printed on the standard output.
+## @seealso{javamethods}
 ## @end deftypefn
-## @seealso{javamethods}
 
-function varargout = javafields(classname)
+function retval = javafields (classname)
   
   if (nargin != 1)
-     print_usage ();
+    print_usage ();
   else
-     c_methods = java_invoke ("org.octave.ClassHelper", "getFields",classname);
-     method_list = strsplit (c_methods, ';');
+    c_methods = java_invoke ("org.octave.ClassHelper", "getFields", classname);
+    method_list = strsplit (c_methods, ';');
 
-     switch nargout
-     case 0
-       if (! isempty (method_list))
-         disp(method_list);
-       endif
-     case 1
-       varargout{1} = cellstr (method_list);
-     endswitch
-  endif
+    switch (nargout)
+      case 0
+        if (! isempty (method_list))
+          disp (method_list);
+        endif
+
+      case 1
+        retval = cellstr (method_list);
+   endswitch
+ endif
 
 endfunction
--- a/scripts/java/javamem.m	Fri Dec 07 16:19:22 2012 -0500
+++ b/scripts/java/javamem.m	Fri Dec 07 17:21:27 2012 -0500
@@ -17,10 +17,10 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function File} javamem
-## @deftypefnx {Function File} [@var{jmem}] = javamem
+## @deftypefn {Function File} javamem ()
+## @deftypefnx {Function File} [@var{jmem}] = javamem ()
 ## Show current memory status of the Java virtual machine (JVM)
-## & run garbage collector.
+## and run garbage collector.
 ##
 ## When no return argument is given the info is echoed to the screen.
 ## Otherwise, output cell array @var{jmem} contains Maximum, Total,
@@ -52,7 +52,6 @@
 ## octave functions the amounts of Total and Free memory will vary,
 ## due to Java's own cleaning up and your operating system's memory
 ## management.
-##
 ## @end deftypefn
 
 ## Author: Philip Nienhuis
@@ -62,22 +61,25 @@
 ## 2010-08-25 Corrected text on java memory assignments
 ## 2010-09-05 Further overhauled help text
 
-function [ j_mem ] = javamem ()
+function j_mem = javamem ()
 
-  rt = java_invoke ('java.lang.Runtime', 'getRuntime');
+  rt = java_invoke ("java.lang.Runtime", "getRuntime");
   rt.gc;
   jmem = cell (3, 1);
   jmem{1} = rt.maxMemory ().doubleValue ();
   jmem{2} = rt.totalMemory ().doubleValue ();
   jmem{3} = rt.freeMemory ().doubleValue ();
 
-  if (nargout < 1)
+  if (nargout == 0)
     printf ("\nJava virtual machine (JVM) memory info:\n");
-    printf ("Maximum available memory:        %5d MiB;\n", jmem{1} / 1024 / 1024);
+    printf ("Maximum available memory:        %5d MiB;\n",
+            jmem{1} / 1024 / 1024);
     printf ("   (...running garbage collector...)\n");
     printf ("OK, current status:\n");
-    printf ("Total memory in virtual machine: %5d MiB;\n", jmem{2} / 1024 / 1024);
-    printf ("Free memory in virtual machine:  %5d MiB;\n", jmem{3} / 1024 / 1024);
+    printf ("Total memory in virtual machine: %5d MiB;\n",
+            jmem{2} / 1024 / 1024);
+    printf ("Free memory in virtual machine:  %5d MiB;\n",
+            jmem{3} / 1024 / 1024);
     printf ("%d CPUs available.\n", rt.availableProcessors ());
   else
     j_mem = jmem;
--- a/scripts/java/javamethods.m	Fri Dec 07 16:19:22 2012 -0500
+++ b/scripts/java/javamethods.m	Fri Dec 07 17:21:27 2012 -0500
@@ -18,30 +18,28 @@
 
 ## -*- texinfo -*-
 ## @deftypefn {Function file} {@var{P} =} javamethods (@var{class})
-##
-## Returns the methods of a Java object in the form of a cell 
-## array of strings. If no output variable is
-## given, the result is simply printed on the standard output.
-##
+## Return the methods of a Java object in the form of a cell 
+## array of strings.  If no output is requested, print the result to the
+## standard output.
+## @seealso{methods}
 ## @end deftypefn
-## @seealso{methods}
 
-function varargout = javamethods (classname)
+function retval = javamethods (classname)
   
   if (nargin != 1)
-     print_usage ();
+    print_usage ();
   else
-     c_methods = java_invoke ("org.octave.ClassHelper", "getMethods", classname);
-     method_list = strsplit (c_methods, ';');
+    c_methods = java_invoke ("org.octave.ClassHelper", "getMethods", classname);
+    method_list = strsplit (c_methods, ";");
 
-     switch nargout
-     case 0
-       if (! isempty (method_list))
-         disp(method_list);
-       endif
-     case 1
-       varargout{1} = cellstr (method_list);
-     endswitch
+    switch nargout
+      case 0
+        if (! isempty (method_list))
+          disp(method_list);
+        endif
+      case 1
+        retval = cellstr (method_list);
+    endswitch
   endif
 
 endfunction
--- a/scripts/java/javarmpath.m	Fri Dec 07 16:19:22 2012 -0500
+++ b/scripts/java/javarmpath.m	Fri Dec 07 17:21:27 2012 -0500
@@ -19,30 +19,30 @@
 
 ## -*- texinfo -*-
 ## @deftypefn {Function file} {} javarmpath (@var{path})
-##
-## Removes @var{path} from the dynamic class path of the Java virtual
-## machine. @var{path} can be either a directory where .class files
-## can be found, or a .jar file containing Java classes.
-##
+## Remove @var{path} from the dynamic class path of the Java virtual
+## machine.  @var{path} may be either a directory where @file{.class}
+## files are found, or a @file{.jar} file containing Java classes.
+## @seealso{javaaddpath, javaclasspath}
 ## @end deftypefn
-## @seealso{javaaddpath,javaclasspath}
 
 function javarmpath (class_path)
 
   if (nargin != 1)
     print_usage ();
   else
-    % MH 30-08-2010: added tilde_expand to allow for specification of user's home
-    old_path = canonicalize_file_name (tilde_expand(class_path));
+    old_path = canonicalize_file_name (tilde_expand (class_path));
     if (exist (old_path, "dir"))
       if (! strcmp (old_path (end), filesep))
         old_path = [old_path, filesep];
-      end
-    end
-    success = java_invoke ('org.octave.ClassHelper', 'removeClassPath', old_path);
+      endif
+    endif
+
+    success = java_invoke ("org.octave.ClassHelper", "removeClassPath",
+                           old_path);
+
     if (! success)
-      disp (['Warning: ', old_path, ' not found in Java classpath.', 10]);
-    end
-  end
+      warning ("javarmpath: %s: not found in Java classpath", old_path);
+    endif
+  endif
 
-end
+endfunction
--- a/scripts/java/listdlg.m	Fri Dec 07 16:19:22 2012 -0500
+++ b/scripts/java/listdlg.m	Fri Dec 07 17:21:27 2012 -0500
@@ -17,52 +17,54 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function file} {@var{[SEL,OK]} =} listdlg (@var{KEY} ,@var{VALUE} [, @var{KEY} ,@var{VALUE}, ...]])
+## @deftypefn {Function file} {[@var{sel}, @var{ok}] =} listdlg (@var{key}, @var{value}, @dots{})
+## Return user inputs from a list dialog box in a vector of 
+## selection indices @var{sel} and a flag @var{ok} indicating how the
+## user closed the dialog box.  The value of @var{ok} is 1 if the user
+## closed the box with the OK button, otherwise it is 0 and @var{sel} is
+## empty.
 ##
-## Returns the user's inputs from a list dialog box in form of a vector of 
-## selection indices SEL and a flag OK indicating how the user closed the dialog box.
-## The returned flag OK is 1 if the user closed the box with the OK button, 
-## otherwise it is 0 and SEL is empty. 
-## The indices in SEL are 1 based, i.e. the first list item carries the index 1.
+## The indices in @var{sel} are 1 based.
 ##
-## The arguments are specified in form of @var{KEY}, @var{VALUE} pairs. 
-## At least the 'ListString' argument pair must be specified.
+## The arguments are specified in form of @var{key}, @var{value} pairs. 
+## The @code{"ListString"} argument pair must be specified.
 ##
-## @var{KEY}s and @var{VALUE}s pairs can be selected from the following list:
+## Valid @var{key} and @var{value} pairs are:
 ##
-## @table @samp
-## @item ListString
+## @table @code
+## @item "ListString"
 ##    a cell array of strings comprising the content of the list.
-## @item SelectionMode
-##    can be either @samp{Single} or @samp{Multiple}.
-## @item ListSize
-##    a vector with two elements [width, height] defining the size of the list field in pixels.
-## @item InitialValue
+## @item "SelectionMode"
+##    can be either @code{"Single"} or @code{"Multiple"}.
+## @item "ListSize"
+##    a vector with two elements @var{width} and @var{height} defining
+##    the size of the list field in pixels.
+## @item "InitialValue"
 ##    a vector containing 1-based indices of preselected elements.
-## @item Name
+## @item "Name"
 ##    a string to be used as the dialog caption.
-## @item PromptString
+## @item "PromptString"
 ##    a cell array of strings to be displayed above the list field.
-## @item OKString
+## @item "OKString"
 ##    a string used to label the OK button.
-## @item CancelString
-##    a string used to label the Cancel  button.
+## @item "CancelString"
+##    a string used to label the Cancel button.
 ## @end table
 ##
 ## Example:
 ##
 ## @example
-##   [sel, ok] = listdlg ( 'ListString',@{'An item', 'another', 'yet another'@}, 'SelectionMode','Multiple' );
-##   if ok == 1
-##      imax = length(sel);
-##      for i=1:1:imax
-##         disp(sel(i));
-##      end
-##   end
+## [sel, ok] = listdlg ("ListString", @{"An item", "another", "yet another"@}, "SelectionMode", "Multiple" );
+## if (ok == 1)
+##    imax = length(sel);
+##    for i=1:1:imax
+##     disp(sel(i));
+##    end
+## end
 ## @end example
 ##
+## @seealso{errordlg, helpdlg, inputdlg, questdlg, warndlg}
 ## @end deftypefn
-## @seealso{errordlg, helpdlg, inputdlg, questdlg, warndlg}
 
 function varargout = listdlg (varargin)
 
@@ -71,59 +73,58 @@
      return;
    end
    
-   listcell = {''};
-   selmode = 'single';
-   listsize = [300,160];   % vector!
-   initialvalue = [1];     % vector!
-   name = '';
-   prompt = {''};
-   okstring = 'OK';
-   cancelstring = 'Cancel';
+   listcell = {""};
+   selmode = "single";
+   listsize = [300, 160];
+   initialvalue = 1;
+   name = "";
+   prompt = {""};
+   okstring = "OK";
+   cancelstring = "Cancel";
    
-   % handle key, value pairs
-   for i=1:2:nargin-1
-      if strcmp(varargin{i},'ListString')
-         listcell = varargin{i+1};
-      elseif strcmp(varargin{i},'SelectionMode')
-         selmode = varargin{i+1};
-      elseif strcmp(varargin{i},'ListSize')
-         listsize = varargin{i+1};
-      elseif strcmp(varargin{i},'InitialValue')
-         initialvalue = varargin{i+1};
-      elseif strcmp(varargin{i},'Name')
-         name = varargin{i+1};
-      elseif strcmp(varargin{i},'PromptString')
-         prompt = varargin{i+1};
-      elseif strcmp(varargin{i},'OKString')
-         okstring = varargin{i+1};
-      elseif strcmp(varargin{i},'CancelString')
-         cancelstring = varargin{i+1};
-      end      
+   ## handle key, value pairs
+   for i = 1:2:nargin-1
+     if strcmp (varargin{i}, "ListString")
+       listcell = varargin{i+1};
+     elseif strcmp (varargin{i}, "SelectionMode")
+       selmode = varargin{i+1};
+     elseif strcmp (varargin{i}, "ListSize")
+       listsize = varargin{i+1};
+     elseif strcmp (varargin{i}, "InitialValue")
+       initialvalue = varargin{i+1};
+     elseif strcmp (varargin{i}, "Name")
+       name = varargin{i+1};
+     elseif strcmp (varargin{i}, "PromptString")
+       prompt = varargin{i+1};
+     elseif strcmp (varargin{i}, "OKString")
+       okstring = varargin{i+1};
+     elseif strcmp (varargin{i}, "CancelString")
+       cancelstring = varargin{i+1};
+     endif
+   endfor
+
+   ## make sure prompt strings are a cell array
+   if (! iscell (prompt))
+     prompt = {prompt};
    end
 
-   % make sure prompt strings are a cell array
-   if ! iscell(prompt)
-      prompt = {prompt};
-   end
-
-   % make sure listcell strings are a cell array
-   if ! iscell(listcell)
-      listcell = {listcell};
-   end
-
+   ## make sure listcell strings are a cell array
+   if (! iscell (listcell))
+     listcell = {listcell};
+   endif
+   
+   ## transform matrices to cell arrays of strings
+   listsize = arrayfun (@num2str, listsize, "UniformOutput", false);
+   initialvalue = arrayfun (@num2str, initialvalue, "UniformOutput", false);
    
-   % transform matrices to cell arrays of strings
-   listsize = arrayfun(@num2str,listsize,'UniformOutput',false);
-   initialvalue = arrayfun(@num2str,initialvalue,'UniformOutput',false);
-   
-   ret = java_invoke ('org.octave.JDialogBox', 'listdlg', listcell, ...
-                      selmode, listsize, initialvalue, name, prompt, ...
-                      okstring, cancelstring );
-   if length(ret) > 0
-      varargout = {ret, 1};
+   ret = java_invoke ("org.octave.JDialogBox", "listdlg", listcell,
+                      selmode, listsize, initialvalue, name, prompt,
+                      okstring, cancelstring);
+
+   if (length(ret) > 0)
+     varargout = {ret, 1};
    else
-      varargout = {{}, 0};
-   end
-  
+     varargout = {{}, 0};
+   endif
 
-end
+endfunction
--- a/scripts/java/msgbox.m	Fri Dec 07 16:19:22 2012 -0500
+++ b/scripts/java/msgbox.m	Fri Dec 07 17:21:27 2012 -0500
@@ -17,22 +17,22 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function file} {@var{P} =} msgbox (@var{MESSAGE} [,@var{TITLE} [,@var{ICON}]])
+## @deftypefn {Function file} {@var{p} =} msgbox (@var{msg}, @var{title}, @var{ICON})
+## Display @var{msg} using a message dialog. 
 ##
-## Displays the @var{MESSAGE} using a message dialog. 
+## The message may have multiple lines separated by newline characters
+## (@code{"\n"}), or it may be a cellstr array with one element for each
+## line.  The optional @var{title} (character string) can be used to
+## decorate the dialog caption.
 ##
-## @var{message} can have multiple lines separated by newline characters
-## ("\n"), or it can be a cellstr array (one element for each line).
-## The optional @var{TITLE} (character string) can be used to decorate the
-## dialog caption.
-## The @var{ICON} can be used optionally to select a dialog icon. 
-## It can be one of @code{'error'}, @code{'help'} or @code{'warn'}.
+## The optional argument @var{icon} selects a dialog icon. 
+## It can be one of @code{"error"}, @code{"help"} or @code{"warn"}.
+##
 ## The return value is always 1.
-##
+## @seealso{helpdlg, questdlg, warndlg}
 ## @end deftypefn
-## @seealso{helpdlg, questdlg, warndlg}
 
-function ret = msgbox (message, varargin)
+function retval = msgbox (message, varargin)
 
   if (! ischar (message))
     if (iscell (message))
@@ -45,22 +45,24 @@
   switch length (varargin)
     case 0
       title = "";
-      dlg = 'emptydlg';
+      dlg = "emptydlg";
+
     case 1
       title = varargin{1};
-      dlg = 'emptydlg';
+      dlg = "emptydlg";
+
     otherwise
-      % two or more arguments
+      ## two or more arguments
       title = varargin{1};
       icon =  varargin{2};
-      if strcmp (icon,'error') == 1
-        dlg = 'errordlg';
-      elseif strcmp (icon,'help') == 1
-        dlg = 'helpdlg';
-      elseif strcmp (icon,'warn') == 1
-        dlg = 'warndlg';
+      if (strcmp (icon, "error"))
+        dlg = "errordlg";
+      elseif (strcmp (icon, "help"))
+        dlg = "helpdlg";
+      elseif (strcmp (icon, "warn"))
+        dlg = "warndlg";
       else
-        dlg = 'emptydlg';
+        dlg = "emptydlg";
       end
   endswitch
 
@@ -68,6 +70,6 @@
     error ("msgbox: character string expected for title");
   endif
 
-  ret = java_invoke ('org.octave.JDialogBox', dlg, message, title );
+  retval = java_invoke ("org.octave.JDialogBox", dlg, message, title );
 
 endfunction
--- a/scripts/java/questdlg.m	Fri Dec 07 16:19:22 2012 -0500
+++ b/scripts/java/questdlg.m	Fri Dec 07 17:21:27 2012 -0500
@@ -17,42 +17,45 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn  {Function file} {@var{P} =} questdlg (@var{MESSAGE}, @var{TITLE})
-## @deftypefnx {Function file} @var{P} = questdlg (@var{MESSAGE}, @var{TITLE}, @var{DEFAULT})
-## @deftypefnx {Function file} @var{P} = questdlg (@var{MESSAGE}, @var{TITLE}, @var{BTN1}, @var{BTN2}, @var{DEFAULT})
-## @deftypefnx {Function file} @var{P} = questdlg (@var{MESSAGE}, @var{TITLE}, @var{BTN1}, @var{BTN2}, @var{BTN3}, @var{DEFAULT})
+## @deftypefn  {Function file} {@var{p} =} questdlg (@var{msg}, @var{title})
+## @deftypefnx {Function file} @var{p} = questdlg (@var{msg}, @var{title}, @var{default})
+## @deftypefnx {Function file} @var{p} = questdlg (@var{msg}, @var{title}, @var{btn1}, @var{btn2}, @var{default})
+## @deftypefnx {Function file} @var{p} = questdlg (@var{msg}, @var{title}, @var{btn1}, @var{btn2}, @var{btn3}, @var{default})
+## Display @var{msg} using a question dialog box and return the caption
+## of the activated button.
 ##
-## Displays the @var{MESSAGE} using a question dialog box. 
-## The dialog contains two or three buttons which all close the dialog. 
-## It returns the caption of the activated button.
+## The dialog may contain two or three buttons which all close the dialog. 
 ##
-## @var{message} can have multiple lines separated by newline characters
-## ("\n"), or it can be a cellstr array (one element for each line).
-## The optional @var{TITLE} (character string) can be used to decorate the
-## dialog caption.
-## The string @var{DEFAULT} identifies the default button, 
+## The message may have multiple lines separated by newline characters
+## (@code{"\n"}), or it may be a cellstr array with one element for each
+## line.  The optional @var{title} (character string) can be used to
+## decorate the dialog caption.
+##
+## The string @var{default} identifies the default button, 
 ## which is activated by pressing the ENTER key.
-## It must match one of the strings given in @var{BTN1}, @var{BTN2} or @var{BTN3}.
+## It must match one of the strings given in @var{btn1}, @var{btn2} or
+## @var{btn3}.
 ##
-## If only @var{MESSAGE} and @var{TITLE} are specified, three buttons with
-## the default captions "Yes", "No", "Cancel" are used.
+## If only @var{msg} and @var{title} are specified, three buttons with
+## the default captions @code{"Yes"}, @code{"No"}, and @code{"Cancel"}
+## are used.
 ##
-## If only two button captions @var{BTN1} and @var{BTN2} are specified, 
+## If only two button captions @var{btn1} and @var{btn2} are specified, 
 ## the dialog will have only these two buttons.
 ##
+## @seealso{errordlg, helpdlg, inputdlg, listdlg, warndlg}
 ## @end deftypefn
-## @seealso{errordlg, helpdlg, inputdlg, listdlg, warndlg}
 
 function ret = questdlg (question, varargin)
 
-  if length (varargin) < 1
-    print_usage();
-  end
+  if (numel (varargin) < 1)
+    print_usage ();
+  endif
   
-  options{1} = 'Yes';      % button1
-  options{2} = 'No';       % button2
-  options{3} = 'Cancel';   % button3
-  options{4} = 'Yes';      % default
+  options{1} = "Yes";      ## button1
+  options{2} = "No";       ## button2
+  options{3} = "Cancel";   ## button3
+  options{4} = "Yes";      ## default
 
   if (! ischar (question))
     if (iscell (question))
@@ -62,36 +65,42 @@
     endif
   endif
 
-  switch length (varargin)
-  case 1
-     % title was given
-     title = varargin{1};
-  case 2
-     % title and default button string
-     title      = varargin{1};
-     options{4} = varargin{2}; % default
-  case 4
-     % title, two buttons and default button string
-     title      = varargin{1};
-     options{1} = varargin{2}; % button1
-     options{2} = '';          % not used, no middle button
-     options{3} = varargin{3}; % button3
-     options{4} = varargin{4}; % default
-  case 5
-     % title, three buttons and default button string
-     title      = varargin{1};
-     options{1} = varargin{2}; % button1
-     options{2} = varargin{3}; % button2
-     options{3} = varargin{4}; % button3
-     options{4} = varargin{5}; % default
-  otherwise
-     print_usage();
-  end
+  switch (numel (varargin))
+    case 1
+      ## title was given
+      title = varargin{1};
+
+    case 2
+      ## title and default button string
+      title = varargin{1};
+      options{4} = varargin{2}; ## default
+
+    case 4
+      ## title, two buttons and default button string
+      title = varargin{1};
+      options{1} = varargin{2}; ## button1
+      options{2} = "";          ## not used, no middle button
+      options{3} = varargin{3}; ## button3
+      options{4} = varargin{4}; ## default
+
+    case 5
+      ## title, three buttons and default button string
+      title      = varargin{1};
+      options{1} = varargin{2}; ## button1
+      options{2} = varargin{3}; ## button2
+      options{3} = varargin{4}; ## button3
+      options{4} = varargin{5}; ## default
+
+    otherwise
+      print_usage ();
+  endswitch
 
   if (! ischar (title))
     error ("questdlg: character string expected for title");
   endif
 
-  ret = java_invoke ('org.octave.JDialogBox', 'questdlg', question, title, options);
+  ret = java_invoke ("org.octave.JDialogBox", "questdlg", question,
+                     title, options);
 
-end
+endfunction
+
--- a/scripts/java/warndlg.m	Fri Dec 07 16:19:22 2012 -0500
+++ b/scripts/java/warndlg.m	Fri Dec 07 17:21:27 2012 -0500
@@ -17,18 +17,18 @@
 ## <http://www.gnu.org/licenses/>.
 
 ## -*- texinfo -*-
-## @deftypefn {Function file} {@var{P} =} warndlg (@var{MESSAGE} [,@var{TITLE}])
-## Displays the @var{MESSAGE} using a warning dialog box. 
+## @deftypefn {Function file} {@var{p} =} warndlg (@var{msg}, @var{title})
+## Display @var{msg} using a warning dialog box. 
 ##
-## @var{message} can have multiple lines separated by newline characters
-## ("\n"), or it can be a cellstr array (one element for each line).
-## The optional @var{TITLE} (character string) can be used to decorate the
-## dialog caption.
+## The message may have multiple lines separated by newline characters
+## (@code{"\n"}), or it may be a cellstr array with one element for each
+## line.  The optional @var{title} (character string) can be used to
+## decorate the dialog caption.
 ##
+## @seealso{helpdlg, inputdlg, listdlg, questiondlg}
 ## @end deftypefn
-## @seealso{helpdlg, inputdlg, listdlg, questiondlg}
 
-function ret = warndlg (message, varargin)
+function retval = warndlg (message, varargin)
 
   if (! ischar (message))
     if (iscell (message))
@@ -38,17 +38,18 @@
     endif
   endif
   
-  switch length (varargin)
-  case 0
-     title = 'Warning Dialog';
-  otherwise
-    if (ischar (varargin{1}))
-      title = varargin{1};
-    else
-      error ("warndlg: character string expected for title");
-    endif
+  switch (numel (varargin))
+    case 0
+      title = "Warning Dialog";
+
+    otherwise
+      if (ischar (varargin{1}))
+        title = varargin{1};
+      else
+        error ("warndlg: character string expected for title");
+      endif
   endswitch
 
-  ret = java_invoke ('org.octave.JDialogBox', 'warndlg', message, title);
+  retval = java_invoke ("org.octave.JDialogBox", "warndlg", message, title);
 
 endfunction