changeset 8506:bc982528de11

comment style fixes
author John W. Eaton <jwe@octave.org>
date Tue, 13 Jan 2009 11:56:00 -0500
parents 124dd27bedae
children cadc73247d65
files scripts/ChangeLog scripts/audio/wavread.m scripts/general/__splinen__.m scripts/general/bicubic.m scripts/general/rat.m scripts/linear-algebra/expm.m scripts/linear-algebra/krylov.m scripts/linear-algebra/onenormest.m scripts/miscellaneous/edit.m scripts/optimization/__dogleg__.m scripts/pkg/pkg.m scripts/plot/__errplot__.m scripts/plot/__go_draw_axes__.m scripts/plot/__stem__.m scripts/plot/findobj.m scripts/set/ismember.m scripts/signal/arma_rnd.m scripts/signal/freqz.m scripts/signal/stft.m scripts/sparse/pcg.m scripts/sparse/sprandsym.m scripts/sparse/treelayout.m scripts/specfun/factor.m scripts/specfun/nchoosek.m scripts/specfun/primes.m scripts/statistics/base/quantile.m scripts/statistics/base/values.m scripts/strings/findstr.m scripts/strings/str2double.m scripts/strings/strrep.m scripts/testfun/assert.m scripts/testfun/fail.m scripts/testfun/speed.m scripts/testfun/test.m scripts/time/datestr.m scripts/time/datevec.m
diffstat 36 files changed, 559 insertions(+), 469 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,18 @@
+2009-01-13  John W. Eaton  <jwe@octave.org>
+
+	* audio/wavread.m, general/__splinen__.m, general/bicubic.m,
+	general/rat.m, linear-algebra/expm.m, linear-algebra/krylov.m,
+	linear-algebra/onenormest.m, miscellaneous/edit.m,
+	optimization/__dogleg__.m, pkg/pkg.m, plot/__errplot__.m,
+	plot/__go_draw_axes__.m, plot/__stem__.m, plot/findobj.m,
+	set/ismember.m, signal/arma_rnd.m, signal/freqz.m, signal/stft.m,
+	sparse/pcg.m, sparse/sprandsym.m, sparse/treelayout.m,
+	specfun/factor.m, specfun/nchoosek.m, specfun/primes.m,
+	statistics/base/quantile.m, statistics/base/values.m,
+	strings/findstr.m, strings/str2double.m, strings/strrep.m,
+	testfun/assert.m, testfun/fail.m, testfun/speed.m, testfun/test.m,
+	time/datestr.m, time/datevec.m: Comment style fixes.
+
 2009-01-13  Daniel J Sebald  <daniel.sebald@ieee.org>
 
 	* set/unique.m: Fix for vertical array inputs.
--- a/scripts/audio/wavread.m
+++ b/scripts/audio/wavread.m
@@ -61,7 +61,7 @@
     error ("wavread: %s", msg);
   endif
   
-  ## check for RIFF/WAVE header
+  ## Check for RIFF/WAVE header.
   ck_id = char (fread (fid, 4))';
   fseek (fid, 4, SEEK_CUR);
   wave_id = char (fread (fid, 4))';
@@ -70,7 +70,7 @@
     error ("wavread: file contains no RIFF/WAVE signature");
   endif
   
-  ## find format chunk within the next 256 (4*64) bytes
+  ## Find format chunk within the next 256 (4*64) bytes.
   i = 1;
   while (true)
     if (char (fread (fid, 4))' == "fmt ");
@@ -82,30 +82,30 @@
     endif
   endwhile
 
-  ## format chunk size
+  ## Format chunk size.
   ck_size = fread (fid, 1, "uint32", 0, BYTEORDER);         
   
-  ## sample format code
+  ## Sample format code.
   format_tag = fread (fid, 1, "uint16", 0, BYTEORDER);
   if (format_tag != FORMAT_PCM && format_tag != FORMAT_IEEE_FLOAT)
     fclose (fid);
     error ("wavread: sample format %#x is not supported", format_tag);
   endif
 
-  ## number of interleaved channels  
+  ## Number of interleaved channels.
   channels = fread (fid, 1, "uint16", 0, BYTEORDER);
 
-  ## sample rate
+  ## Sample rate.
   samples_per_sec = fread (fid, 1, "uint32", 0, BYTEORDER);
 
-  ## bits per sample
+  ## Bits per sample.
   fseek (fid, 6, SEEK_CUR);
   bits_per_sample = fread (fid, 1, "uint16", 0, BYTEORDER);
 
-  ## ignore the rest of the chunk
+  ## Ignore the rest of the chunk.
   fseek (fid, ck_size-16, SEEK_CUR);
   
-  ## find data chunk
+  ## Find data chunk.
   i = 1;
   while (true)
     if (char (fread (fid, 4))' == "data")
@@ -117,10 +117,10 @@
     endif
   endwhile
 
-  ## data chunk size
+  ## Data chunk size.
   ck_size = fread (fid, 1, "uint32", 0, BYTEORDER);
   
-  ## determine sample data type
+  ## Determine sample data type.
   if (format_tag == FORMAT_PCM)
     switch (bits_per_sample)
       case 8
@@ -149,21 +149,21 @@
     endswitch
   endif
   
-  ## parse arguments
+  ## Parse arguments.
   if (nargin == 1)
     length = 8 * ck_size / bits_per_sample;
   else
     if (size (param, 2) == 1)
-      ## number of samples is given
+      ## Number of samples is given.
       length = param * channels;
     elseif (size (param, 2) == 2)
-      ## sample range is given
+      ## Sample range is given.
       if (fseek (fid, (param(1)-1) * channels * (bits_per_sample/8), SEEK_CUR) < 0)
         warning ("wavread: seeking failed");
       endif
       length = (param(2)-param(1)+1) * channels;
     elseif (size (param, 2) == 4 && char (param) == "size")
-      ## size of the file is requested
+      ## Size of the file is requested.
       fclose (fid);
       y = [ck_size/channels/(bits_per_sample/8), channels];
       return
@@ -173,14 +173,14 @@
     endif
   endif
 
-  ## read samples and close file
+  ## Read samples and close file.
   if (bits_per_sample == 24)
     length *= 3;
   endif
   [yi, n] = fread (fid, length, format, 0, BYTEORDER);
   fclose (fid);
 
-  ## check data
+  ## Check data.
   if (mod (numel (yi), channels) != 0)
     error ("wavread: data in %s doesn't match the number of channels",
 	   filename);
@@ -193,7 +193,7 @@
   endif
 
   if (format_tag == FORMAT_PCM)
-    ## normalize samples
+    ## Normalize samples.
     switch (bits_per_sample)
       case 8
         yi = (yi - 128)/127;
@@ -206,7 +206,7 @@
     endswitch
   endif
   
-  ## deinterleave
+  ## Deinterleave.
   nr = numel (yi) / channels;
   y = reshape (yi, channels, nr)';
   
--- a/scripts/general/__splinen__.m
+++ b/scripts/general/__splinen__.m
@@ -29,7 +29,8 @@
   if (nargin != 5)
     error ("Incorrect number of arguments");
   endif
-  isvec = @(x) numel (x) == length (x);   # ND isvector function
+  ## ND isvector function.
+  isvec = @(x) numel (x) == length (x);
   if (!iscell (x) || length(x) < ndims(y) || any (! cellfun (isvec, x)) ||
       !iscell (xi) || length(xi) < ndims(y) || any (! cellfun (isvec, xi)))
     error ("%s: non gridded data or dimensions inconsistent", f);
--- a/scripts/general/bicubic.m
+++ b/scripts/general/bicubic.m
@@ -88,12 +88,12 @@
       error ("X, Y and Z must be martrices of same size");
     endif
     
-    ## mark values outside the lookup table
+    ## Mark values outside the lookup table.
     xfirst_ind = find (XI < X(1));
     xlast_ind  = find (XI > X(cz));    
     yfirst_ind = find (YI < Y(1));
     ylast_ind  = find (YI > Y(rz));
-    ## set value outside the table preliminary to min max index   
+    ## Set value outside the table preliminary to min max index.
     XI(xfirst_ind) = X(1);
     XI(xlast_ind) = X(cz);
     YI(yfirst_ind) = Y(1);
@@ -120,7 +120,7 @@
     o = cumsum (i <= rz);
     yidx = o([find( i> rz)]);
     
-    ## set s and t used follow codes
+    ## Set s and t used follow codes.
     s = xidx + ((XI .- X(xidx))./(X(xidx+1) .- X(xidx)));
     t = yidx + ((YI - Y(yidx))./(Y(yidx+1) - Y(yidx)));
   else
@@ -152,7 +152,7 @@
   p(:,1)      =    (6*(1-a))*p(:,2)    -3*p(:,3)   + (6*a-2)*p(:,4);
   p(:,cz+2)   =    (6*(1-a))*p(:,cz+1)  -3*p(:,cz) + (6*a-2)*p(:,cz-1);
 
-  ## calculte the C1(t) C2(t) C3(t) C4(t) and C1(s) C2(s) C3(s) C4(s)
+  ## Calculte the C1(t) C2(t) C3(t) C4(t) and C1(s) C2(s) C3(s) C4(s).
   t2= t.*t;
   t3= t2.*t;
 
@@ -188,7 +188,7 @@
 	 p(int,inds+2) .* cs2 + p(int,inds+3) .* cs3);
   endfor
 
-  ## set points outside the table to extrapval
+  ## Set points outside the table to extrapval.
   if (! (isempty (xfirst_ind) && isempty (xlast_ind)))
     F(:, [xfirst_ind, xlast_ind]) = extrapval;
   endif
--- a/scripts/general/rat.m
+++ b/scripts/general/rat.m
@@ -42,7 +42,7 @@
 
   y = x(:);
 
-  ## replace inf with 0 while calculating ratios
+  ## Replace Inf with 0 while calculating ratios.
   y(isinf(y)) = 0;
 
   ## default norm
@@ -51,7 +51,9 @@
   endif
 
   ## First step in the approximation is the integer portion
-  n = round(y);  # first element in the continued fraction
+
+  ## First element in the continued fraction.
+  n = round(y);
   d = ones(size(y));
   frac = y-n;
   lastn = ones(size(y));
@@ -61,9 +63,9 @@
   nsz = numel (y);
   steps = zeros([nsz, 0]);
 
-  ## grab new factors until all continued fractions converge
+  ## Grab new factors until all continued fractions converge.
   while (1)
-    ## determine which fractions have not yet converged
+    ## Determine which fractions have not yet converged.
     idx = find(abs (y-n./d) >= tol);
     if (isempty(idx))
       if (isempty (steps))
@@ -72,9 +74,10 @@
       break;
     endif
 
-    ## grab the next step in the continued fraction
+    ## Grab the next step in the continued fraction.
     flip = 1./frac(idx);
-    step = round(flip); # next element in the continued fraction
+    ## Next element in the continued fraction.
+    step = round(flip);
 
     if (nargout < 2)
       tsteps = NaN .* ones (nsz, 1);
@@ -84,7 +87,7 @@
 
     frac(idx) = flip-step;
 
-    ## update the numerator/denominator
+    ## Update the numerator/denominator.
     nextn = n;
     nextd = d;
     n(idx) = n(idx).*step + lastn(idx);
@@ -94,19 +97,19 @@
   endwhile
 
   if (nargout == 2)
-    ## move the minus sign to the top
+    ## Move the minus sign to the top.
     n = n.*sign(d);
     d = abs(d);
 
-    ## return the same shape as you receive
+    ## Return the same shape as you receive.
     n = reshape(n, size(x));
     d = reshape(d, size(x));
 
-    ## use 1/0 for Inf
+    ## Use 1/0 for Inf.
     n(isinf(x)) = sign(x(isinf(x)));
     d(isinf(x)) = 0;
 
-    ## reshape the output
+    ## Reshape the output.
     n = reshape (n, size (x));
     d = reshape (d, size (x));
   else
--- a/scripts/linear-algebra/expm.m
+++ b/scripts/linear-algebra/expm.m
@@ -108,23 +108,25 @@
   endif
 
   n = rows (a);
-  # trace reduction
+  ## Trace reduction.
   a(a == -Inf) = -realmax;
   trshift = trace (a) / length (a);
   if (trshift > 0)
     a -= trshift*eye (n);
   endif
-  # balancing
+  ## Balancing.
   [p, d, aa] = balance (a);
-  # FIXME: can we both permute and scale at once? Or should we rather do this:
-  # [p, xx, aa] = balance (a, "noscal");
-  # [xx, d, aa] = balance (aa, "noperm");
+  ## FIXME: can we both permute and scale at once? Or should we rather do
+  ## this:
+  ##
+  ##   [p, xx, aa] = balance (a, "noscal");
+  ##   [xx, d, aa] = balance (aa, "noperm");
   [f, e] = log2 (norm (aa, "inf"));
   s = max (0, e);
   s = min (s, 1023);
   aa *= 2^(-s);
 
-  # Pade approximation for exp(A)
+  ## Pade approximation for exp(A).
   c = [5.0000000000000000e-1,...
        1.1666666666666667e-1,...
        1.6666666666666667e-2,...
@@ -141,16 +143,16 @@
 
   r = (x - y) \ (x + y);
 
-  # Undo scaling by repeated squaring
-  for k = 1:s 
+  ## Undo scaling by repeated squaring.
+  for k = 1:s
     r ^= 2;
   endfor
 
-  # inverse balancing
+  ## inverse balancing.
   ds = diag (s);
   r = ds * r / ds;
   r = r(p, p);
-  # inverse trace reduction
+  ## Inverse trace reduction.
   if (trshift >0)
     r *= exp (trshift);
   endif
--- a/scripts/linear-algebra/krylov.m
+++ b/scripts/linear-algebra/krylov.m
@@ -68,11 +68,13 @@
   if (nargin < 3 || nargin > 5)
     print_usage ();
   elseif (nargin < 5)
-    pflg = 0;        # default permutation flag
+    ## Default permutation flag.
+    pflg = 0;
   endif
 
   if(nargin < 4)
-    eps1 = defeps;    # default tolerance parameter
+    ## Default tolerance parameter.
+    eps1 = defeps;
   endif
 
   if (isempty (eps1))
@@ -96,7 +98,7 @@
 
   Vnrm = norm (V, Inf);
 
-  ## check for trivial solution
+  ## check for trivial solution.
   if (Vnrm == 0)
     Uret = [];
     H = [];
@@ -104,11 +106,11 @@
     return;
   endif
 
-  # identify trivial null space
+  ## Identify trivial null space.
   abm = max (abs ([A, V]'));
   zidx = find (abm == 0);
 
-  # set up vector of pivot points
+  ## Set up vector of pivot points.
   pivot_vec = 1:na;
 
   iter = 0;
@@ -117,10 +119,10 @@
   while (length(alpha) < na) && (columns(V) > 0) && (iter < k)
     iter++;
 
-    ## get orthogonal basis of V
+    ## Get orthogonal basis of V.
     jj = 1;
     while (jj <= columns (V) && length (alpha) < na)
-      ## index of next Householder reflection
+      ## Index of next Householder reflection.
       nu = length(alpha)+1;
 
       short_pv = pivot_vec(nu:na);
@@ -128,7 +130,7 @@
       short_q = q(short_pv);
 
       if (norm (short_q) < eps1)
-	## insignificant column; delete
+	## Insignificant column; delete.
         nv = columns (V);
         if (jj != nv)
           [V(:,jj), V(:,nv)] = swap (V(:,jj), V(:,nv));
@@ -136,18 +138,18 @@
 	  ## since Block Hessenberg structure is lost anyway.
         endif
         V = V(:,1:(nv-1));
-	## one less reflection
+	## One less reflection.
         nu--;
       else
-	## new householder reflection
+	## New householder reflection.
         if (pflg)
-          ## locate max magnitude element in short_q
+          ## Locate max magnitude element in short_q.
           asq = abs (short_q);
           maxv = max (asq);
           maxidx = find (asq == maxv, 1);
           pivot_idx = short_pv(maxidx);
 
-	  ## see if need to change the pivot list
+	  ## See if need to change the pivot list.
           if (pivot_idx != pivot_vec(nu))
             swapidx = maxidx + (nu-1);
             [pivot_vec(nu), pivot_vec(swapidx)] = ...
@@ -155,7 +157,7 @@
           endif
         endif
 
-	## isolate portion of vector for reflection
+	## Isolate portion of vector for reflection.
         idx = pivot_vec(nu:na);
         jdx = pivot_vec(1:nu);
 
@@ -163,21 +165,21 @@
         alpha(nu) = av;
         U(idx,nu) = hv;
 
-        # reduce V per the reflection
+        ## Reduce V per the reflection.
         V(idx,:) = V(idx,:) - av*hv*(hv' * V(idx,:));
         if(iter > 1)
-	  ## FIXME -- not done correctly for block case
+	  ## FIXME -- not done correctly for block case.
           H(nu,nu-1) = V(pivot_vec(nu),jj);
         endif
 
-        ## advance to next column of V
+        ## Advance to next column of V.
         jj++;
       endif
     endwhile
 
-    ## check for oversize V (due to full rank)
+    ## Check for oversize V (due to full rank).
     if ((columns (V) > na) && (length (alpha) == na))
-      ## trim to size
+      ## Trim to size.
       V = V(:,1:na);
     elseif (columns(V) > na)
       krylov_V = V
@@ -187,13 +189,13 @@
     endif
 
     if (columns (V) > 0)
-      ## construct next Q and multiply
+      ## Construct next Q and multiply.
       Q = zeros (size (V));
       for kk = 1:columns (Q)
         Q(pivot_vec(nu-columns(Q)+kk),kk) = 1;
       endfor
 
-      ## apply Householder reflections
+      ## Apply Householder reflections.
       for ii = nu:-1:1
         idx = pivot_vec(ii:na);
         hv = U(idx,ii);
@@ -202,9 +204,9 @@
       endfor
     endif
 
-    ## multiply to get new vector;
+    ## Multiply to get new vector.
     V = A*Q;
-    ## project off of previous vectors
+    ## Project off of previous vectors.
     nu = length (alpha);
     for i = 1:nu
       hv = U(:,i);
@@ -215,8 +217,8 @@
 
   endwhile
 
-  ## Back out complete U matrix
-  ## back out U matrix ;
+  ## Back out complete U matrix.
+  ## back out U matrix.
   j1 = columns (U);
   for i = j1:-1:1;
     idx = pivot_vec(i:na);
--- a/scripts/linear-algebra/onenormest.m
+++ b/scripts/linear-algebra/onenormest.m
@@ -131,9 +131,14 @@
   X = rand (n, t);
   X = X ./ (ones (n,1) * sum (abs (X), 1));
 
-  been_there = zeros (n, 1); # Track if a vertex has been visited.
-  est_old = 0; # To check if the estimate has increased.
-  S = zeros (n, t); # Normalized vector of signs.  The normalization is 
+  ## Track if a vertex has been visited.
+  been_there = zeros (n, 1);
+
+  ## To check if the estimate has increased.
+  est_old = 0;
+
+  ## Normalized vector of signs.
+  S = zeros (n, t);
 
   if (issing)
     myeps = eps ("single");
--- a/scripts/miscellaneous/edit.m
+++ b/scripts/miscellaneous/edit.m
@@ -148,7 +148,8 @@
   				"MODE", "sync",
   				"EDITINPLACE", false);
 
-  mlock; # make sure the state variables survive "clear functions"
+  ## Make sure the state variables survive "clear functions".
+  mlock;
 
   if (nargin == 2)
     switch (toupper (file))
--- a/scripts/optimization/__dogleg__.m
+++ b/scripts/optimization/__dogleg__.m
@@ -27,21 +27,21 @@
 ## TODO: handle singularity, or leave it up to mldivide?
 
 function x = __dogleg__ (r, b, d, delta)
-  # get Gauss-Newton direction
+  ## Get Gauss-Newton direction.
   x = r \ b;
   xn = norm (d .* x);
   if (xn > delta)
-    # GN is too big, get scaled gradient
+    ## GN is too big, get scaled gradient.
     s = (r' * b) ./ d;
     sn = norm (s);
     if (sn > 0)
-      # normalize and rescale 
+      ## Normalize and rescale.
       s = (s / sn) ./ d;
-      # get the line minimizer in s direction
+      ## Get the line minimizer in s direction.
       tn = norm (r*s);
       snm = (sn / tn) / tn;
       if (snm < delta)
-        # get the dogleg path minimizer 
+	## Get the dogleg path minimizer.
         bn = norm (b);
         dxn = delta/xn; snmd = snm/delta;
         t = (bn/sn) * (bn/xn) * snmd;
@@ -53,7 +53,7 @@
     else
       snm = 0;
     endif
-    # form the appropriate convex combination
+    ## Form the appropriate convex combination.
     x = alpha * x + ((1-alpha) * min (snm, delta)) * s;
   endif
 endfunction
--- a/scripts/pkg/pkg.m
+++ b/scripts/pkg/pkg.m
@@ -538,7 +538,7 @@
 function install (files, handle_deps, autoload, prefix, archprefix, verbose, 
 		  local_list, global_list, global_install)
 
-  # Check that the directory in prefix exist. If it doesn't: create it!
+  ## Check that the directory in prefix exist. If it doesn't: create it!
   if (! exist (prefix, "dir"))
     warning ("creating installation directory %s", prefix);
     [status, msg] = mkdir (prefix);
@@ -547,7 +547,7 @@
     endif
   endif
 
-  ## Get the list of installed packages
+  ## Get the list of installed packages.
   [local_packages, global_packages] = installed_packages (local_list, 
 							  global_list);
 
@@ -559,24 +559,24 @@
     packages = local_packages;
   endif
 
-  ## Uncompress the packages and read the DESCRIPTION files
+  ## Uncompress the packages and read the DESCRIPTION files.
   tmpdirs = packdirs = descriptions = {};
   try
-    ## Warn about non existent files 
+    ## Warn about non existent files.
     for i = 1:length (files)
       if (isempty (glob(files{i}))) 
 	warning ("file %s does not exist", files{i});
       endif
     endfor
 
-    ## Unpack the package files and read the DESCRIPTION files
+    ## Unpack the package files and read the DESCRIPTION files.
     files = glob (files);
     packages_to_uninstall = [];
     for i = 1:length (files)
       tgz = files{i};
 
       if (exist (tgz, "file"))
-	## Create a temporary directory 
+	## Create a temporary directory.
 	tmpdir = tmpnam ();
 	tmpdirs{end+1} = tmpdir;
         if (verbose)
@@ -587,13 +587,13 @@
 	  error ("couldn't create temporary directory: %s", msg);
 	endif
 
-	## Uncompress the package
+	## Uncompress the package.
 	if (verbose)
 	  printf ("untar (%s, %s)\n", tgz, tmpdir);
 	endif
 	untar (tgz, tmpdir);
 
-	## Get the name of the directories produced by tar
+	## Get the name of the directories produced by tar.
 	[dirlist, err, msg] = readdir (tmpdir);
 	if (err)
 	  error ("couldn't read directory produced by tar: %s", msg);
@@ -604,13 +604,13 @@
 	endif
       endif
 
-      ## The filename pointed to an uncompressed package to begin with
+      ## The filename pointed to an uncompressed package to begin with.
       if (exist (tgz, "dir"))
 	dirlist = {".", "..", tgz};
       endif
 
       if (exist (tgz, "file") || exist (tgz, "dir"))
-	## the two first entries of dirlist are "." and ".."
+	## The two first entries of dirlist are "." and "..".
 	if (exist (tgz, "file"))
 	  packdir = fullfile (tmpdir, dirlist{3});
 	else
@@ -618,14 +618,14 @@
 	endif
 	packdirs{end+1} = packdir;
 	
-	## Make sure the package contains necessary files
+	## Make sure the package contains necessary files.
 	verify_directory (packdir);
 	
-	## Read the DESCRIPTION file
+	## Read the DESCRIPTION file.
 	filename = fullfile (packdir, "DESCRIPTION");
 	desc = get_description (filename);
 	
-	## Verify that package name corresponds with filename
+	## Verify that package name corresponds with filename.
 	[dummy, nm] = fileparts (tgz); 
 	if ((length (nm) >= length (desc.name))
 	    && ! strcmp (desc.name, nm(1:length(desc.name))))
@@ -633,14 +633,14 @@
 		 desc.name, nm);
 	endif
 	
-	## Set default installation directory
+	## Set default installation directory.
 	desc.dir = fullfile (prefix, cstrcat (desc.name, "-", desc.version));
 	
-	## Set default architectire dependent installation directory
+	## Set default architectire dependent installation directory.
 	desc.archprefix = fullfile (archprefix, cstrcat (desc.name, "-",
 							 desc.version));
 	
-	## Save desc
+	## Save desc.
 	descriptions{end+1} = desc;
 	
 	## Are any of the new packages already installed?
@@ -653,14 +653,14 @@
       endif
     endfor
   catch
-    ## Something went wrong, delete tmpdirs
+    ## Something went wrong, delete tmpdirs.
     for i = 1:length (tmpdirs)
       rm_rf (tmpdirs{i});
     endfor
     rethrow (lasterror ());
   end_try_catch
 
-  ## Check dependencies
+  ## Check dependencies.
   if (handle_deps)
     ok = true;
     error_text = "";
@@ -669,7 +669,7 @@
       idx2 = complement (i, 1:length(descriptions));
       if (global_install)
 	## Global installation is not allowed to have dependencies on locally
-	## installed packages
+	## installed packages.
 	idx1 = complement (packages_to_uninstall, 
 			   1:length(global_packages));
 	pseudo_installed_packages = {global_packages{idx1}, ...
@@ -700,7 +700,7 @@
     endif
   endif
 
-  ## Prepare each package for installation
+  ## Prepare each package for installation.
   try
     for i = 1:length (descriptions)
       desc = descriptions{i};
@@ -709,14 +709,14 @@
       configure_make (desc, pdir, verbose);
     endfor
   catch
-    ## Something went wrong, delete tmpdirs
+    ## Something went wrong, delete tmpdirs.
     for i = 1:length (tmpdirs)
       rm_rf (tmpdirs{i});
     endfor
     rethrow (lasterror ());
   end_try_catch
 
-  ## Uninstall the packages that will be replaced
+  ## Uninstall the packages that will be replaced.
   try
     for i = packages_to_uninstall
       if (global_install)
@@ -728,14 +728,14 @@
       endif
     endfor
   catch
-    ## Something went wrong, delete tmpdirs
+    ## Something went wrong, delete tmpdirs.
     for i = 1:length (tmpdirs)
       rm_rf (tmpdirs{i});
     endfor
     rethrow (lasterror ());
   end_try_catch
 
-  ## Install each package
+  ## Install each package.
   try
     for i = 1:length (descriptions)
       desc = descriptions{i};
@@ -746,7 +746,7 @@
       finish_installation (desc, pdir, global_install)
     endfor
   catch
-    ## Something went wrong, delete tmpdirs
+    ## Something went wrong, delete tmpdirs.
     for i = 1:length (tmpdirs)
       rm_rf (tmpdirs{i});
     endfor
@@ -758,7 +758,7 @@
   end_try_catch
 
   ## Check if the installed directory is empty. If it is remove it
-  ## from the list
+  ## from the list.
   for i = length (descriptions):-1:1
     if (dirempty (descriptions{i}.dir, {"packinfo", "doc"}) &&
 	dirempty (getarchdir (descriptions{i})))
@@ -779,7 +779,7 @@
     endif
   endfor
 
-  ## Add the packages to the package list
+  ## Add the packages to the package list.
   try
     if (global_install)
       idx = complement (packages_to_uninstall, 1:length(global_packages));
@@ -793,7 +793,7 @@
       installed_pkgs_lst = {local_packages{:}, global_packages{:}};
     endif
   catch
-    ## Something went wrong, delete tmpdirs
+    ## Something went wrong, delete tmpdirs.
     for i = 1:length (tmpdirs)
       rm_rf (tmpdirs{i});
     endfor
@@ -808,7 +808,7 @@
     rethrow (lasterror ());
   end_try_catch
 
-  ## All is well, let's clean up
+  ## All is well, let's clean up.
   for i = 1:length (tmpdirs)
     [status, msg] = rm_rf (tmpdirs{i});
     if (status != 1)
@@ -817,7 +817,7 @@
   endfor
 
   ## Add the newly installed packages to the path, so the user
-  ## can begin using them. Only load them if they are marked autoload
+  ## can begin using them. Only load them if they are marked autoload.
   if (length (descriptions) > 0)
     idx = [];
     for i = 1:length (descriptions)
@@ -838,7 +838,7 @@
 
 function uninstall (pkgnames, handle_deps, verbose, local_list, 
 		    global_list, global_install)
-  ## Get the list of installed packages
+  ## Get the list of installed packages.
   [local_packages, global_packages] = installed_packages(local_list, 
 							 global_list);
   if (global_install)
@@ -859,7 +859,7 @@
   ## Are all the packages that should be uninstalled already installed?
   if (length (delete_idx) != length (pkgnames))
     if (global_install)
-      ## Try again for a locally installed package
+      ## Try again for a locally installed package.
       installed_pkgs_lst = local_packages;
 
       num_packages = length (installed_pkgs_lst);
@@ -871,20 +871,20 @@
 	endif
       endfor
       if (length (delete_idx) != length (pkgnames))
-	## FIXME: We should have a better error message
+	## FIXME: We should have a better error message.
 	warning ("some of the packages you want to uninstall are not installed");
       endif
     else
-      ## FIXME: We should have a better error message
+      ## FIXME: We should have a better error message.
       warning ("some of the packages you want to uninstall are not installed.");
     endif
   endif
 
-  ## Compute the packages that will remain installed
+  ## Compute the packages that will remain installed.
   idx = complement (delete_idx, 1:num_packages);
   remaining_packages = {installed_pkgs_lst{idx}};
 
-  ## Check dependencies
+  ## Check dependencies.
   if (handle_deps)
     error_text = "";
     for i = 1:length (remaining_packages)
@@ -907,7 +907,7 @@
     endif
   endif
 
-  ## Delete the directories containing the packages
+  ## Delete the directories containing the packages.
   for i = delete_idx
     desc = installed_pkgs_lst{i};
     ## If an 'on_uninstall.m' exist, call it!
@@ -917,7 +917,7 @@
       on_uninstall (desc);
       cd (wd);
     endif
-    ## Do the actual deletion
+    ## Do the actual deletion.
     if (desc.loaded)
       rmpath (desc.dir);
       if (exist (getarchdir (desc)))
@@ -941,7 +941,7 @@
     endif
   endfor
 
-  ## Write a new ~/.octave_packages
+  ## Write a new ~/.octave_packages.
   if (global_install)
     if (length (remaining_packages) == 0)
       unlink (global_list);
@@ -963,7 +963,7 @@
 function [pkg_desc_list, flag] = describe (pkgnames, verbose, 
 					   local_list, global_list)
 
-  ## Get the list of installed packages
+  ## Get the list of installed packages.
   installed_pkgs_lst = installed_packages(local_list, global_list);
   num_packages = length (installed_pkgs_lst);
   
@@ -1017,11 +1017,9 @@
 
 endfunction
 
-##########################################################
-##        A U X I L I A R Y    F U N C T I O N S        ##
-##########################################################
+## AUXILIARY FUNCTIONS
 
-## This function reads an INDEX file
+## Read an INDEX file.
 function [pkg_idx_struct] = parse_pkg_idx (packdir)
 
   index_file = fullfile (packdir, "packinfo", "INDEX");
@@ -1053,16 +1051,16 @@
       ## FIXME: probably comments and pointers to external functions
       ## could be treated better when printing to screen?
     elseif (! isempty (strfind (line, ">>")))
-      ## Skip package name and description as they are in
-      ## DESCRIPTION already
+      ## Skip package name and description as they are in DESCRIPTION
+      ## already.
     elseif (! isspace (line(1)))
-      ## Category
+      ## Category.
       if (! isempty (pkg_idx_struct{cat_num}.functions))
 	pkg_idx_struct{++cat_num}.functions = {};
       endif
       pkg_idx_struct{cat_num}.category = deblank (line);
     else
-      ## Function names
+      ## Function names.
       while (any (! isspace (line)))
 	[fun_name, line] = strtok (line);
 	pkg_idx_struct{cat_num}.functions{end+1} = deblank (fun_name);
@@ -1197,7 +1195,7 @@
     end_try_catch
   endif
 
-  ## If the directory "inst" doesn't exist, we create it
+  ## If the directory "inst" doesn't exist, we create it.
   inst_dir = fullfile (packdir, "inst");
   if (! exist (inst_dir, "dir"))
     [status, msg] = mkdir (inst_dir);
@@ -1210,10 +1208,10 @@
 endfunction
 
 function configure_make (desc, packdir, verbose)   
-  ## Perform ./configure, make, make install in "src"
+  ## Perform ./configure, make, make install in "src".
   if (exist (fullfile (packdir, "src"), "dir"))
     src = fullfile (packdir, "src");
-    ## configure
+    ## Configure.
     if (exist (fullfile (src, "configure"), "file"))
       flags = "";
       if (isempty (getenv ("CC")))
@@ -1239,7 +1237,7 @@
 
     endif
 
-    ## make
+    ## Make.
     if (exist (fullfile (src, "Makefile"), "file"))
       [status, output] = shell (cstrcat ("export INSTALLDIR=\"", desc.dir,
 					 "\"; make -C '", src, "'"));
@@ -1251,12 +1249,13 @@
       endif
     endif
 
-    ## Copy files to "inst" and "inst/arch" (this is instead of 'make install')
+    ## Copy files to "inst" and "inst/arch" (this is instead of 'make
+    ## install').
     files = fullfile (src, "FILES");
     instdir = fullfile (packdir, "inst");
     archdir = fullfile (packdir, "inst", getarch ());
 
-    ## Get file names
+    ## Get file names.
     if (exist (files, "file"))
       [fid, msg] = fopen (files, "r");
       if (fid < 0)
@@ -1287,7 +1286,7 @@
 			   "UniformOutput", false);
     endif
 
-    ## Split into architecture dependent and independent files
+    ## Split into architecture dependent and independent files.
     if (isempty (filenames))
       idx = [];
     else
@@ -1296,7 +1295,7 @@
     archdependent = filenames (idx);
     archindependent = filenames (!idx);
 
-    ## Copy the files
+    ## Copy the files.
     if (! all (isspace ([filenames{:}])))
 	if (! exist (instdir, "dir")) 
 	  mkdir (instdir);
@@ -1370,14 +1369,14 @@
   endif
 
   if (archfid >= 0 && instfid >= 0)
-    ## Search all dot-m files for PKG commands
+    ## Search all dot-m files for PKG commands.
     lst = dir (fullfile (packdir, "inst", "*.m"));
     for i = 1:length (lst)
       nam = fullfile (packdir, "inst", lst(i).name);
       fwrite (instfid, extract_pkg (nam, ['^[#%][#%]* *' nm ': *(.*)$']));
     endfor
 
-    ## Search all C++ source files for PKG commands
+    ## Search all C++ source files for PKG commands.
     lst = dir (fullfile (packdir, "src", "*.cc"));
     for i = 1:length (lst)
       nam = fullfile (packdir, "src", lst(i).name);
@@ -1385,7 +1384,7 @@
       fwrite (archfid, extract_pkg (nam, ['^/\** *' nm ': *(.*) *\*/$']));
     endfor
 
-    ## Add developer included PKG commands
+    ## Add developer included PKG commands.
     packdirnm = fullfile (packdir, nm);
     if (exist (packdirnm, "file"))
       fid = fopen (packdirnm, "rt");
@@ -1400,7 +1399,7 @@
       endif
     endif
 
-    ## If the files is empty remove it
+    ## If the files is empty remove it.
     fclose (instfid);
     t = dir (instpkg);
     if (t.bytes <= 0)
@@ -1418,7 +1417,7 @@
 endfunction
 
 function copy_files (desc, packdir, global_install)
-  ## Create the installation directory
+  ## Create the installation directory.
   if (! exist (desc.dir, "dir"))
     [status, output] = mkdir (desc.dir);
     if (status != 1)
@@ -1429,7 +1428,7 @@
 
   octfiledir = getarchdir (desc);
 
-  ## Copy the files from "inst" to installdir
+  ## Copy the files from "inst" to installdir.
   instdir = fullfile (packdir, "inst");
   if (! dirempty (instdir))
     [status, output] = copyfile (fullfile (instdir, "*"), desc.dir);
@@ -1440,7 +1439,7 @@
     if (exist (fullfile (desc.dir, getarch ()), "dir") &&
 	! strcmp (fullfile (desc.dir, getarch ()), octfiledir))
       if (! exist (octfiledir, "dir"))
-        ## Can be required to create upto three levels of dirs
+        ## Can be required to create upto three levels of dirs.
         octm1 = fileparts (octfiledir);
         if (! exist (octm1, "dir"))
           octm2 = fileparts (octm1);
@@ -1488,7 +1487,7 @@
 
   endif
 
-  ## Create the "packinfo" directory
+  ## Create the "packinfo" directory.
   packinfo = fullfile (desc.dir, "packinfo");
   [status, msg] = mkdir (packinfo);
   if (status != 1)
@@ -1497,7 +1496,7 @@
     error ("couldn't create packinfo directory: %s", msg);
   endif
 
-  ## Copy DESCRIPTION
+  ## Copy DESCRIPTION.
   [status, output] = copyfile (fullfile (packdir, "DESCRIPTION"), packinfo);
   if (status != 1)
     rm_rf (desc.dir);
@@ -1505,7 +1504,7 @@
     error ("couldn't copy DESCRIPTION: %s", output);
   endif
 
-  ## Copy COPYING
+  ## Copy COPYING.
   [status, output] = copyfile (fullfile (packdir, "COPYING"), packinfo);
   if (status != 1)
     rm_rf (desc.dir);
@@ -1513,7 +1512,7 @@
     error ("couldn't copy COPYING: %s", output);
   endif
 
-  ## If the file ChangeLog exists, copy it
+  ## If the file ChangeLog exists, copy it.
   changelog_file = fullfile (packdir, "ChangeLog");
   if (exist (changelog_file, "file"))
     [status, output] = copyfile (changelog_file, packinfo);
@@ -1555,13 +1554,13 @@
     endif
   endif
 
-  ## Is there a doc/ directory that needs to be installed
+  ## Is there a doc/ directory that needs to be installed?
   docdir = fullfile (packdir, "doc");
   if (exist (docdir, "dir") && ! dirempty (docdir))
     [status, output] = copyfile (docdir, desc.dir);
   endif
 
-  ## Is there a bin/ directory that needs to be installed
+  ## Is there a bin/ directory that needs to be installed?
   ## FIXME: Need to treat architecture dependent files in bin/
   bindir = fullfile (packdir, "bin");
   if (exist (bindir, "dir") && ! dirempty (bindir))
@@ -1596,7 +1595,7 @@
   endfor
 endfunction
 
-## Parse the DESCRIPTION file
+## Parse the DESCRIPTION file.
 function desc = get_description (filename)
   [fid, msg] = fopen (filename, "r");
   if (fid == -1)
@@ -1608,7 +1607,7 @@
   line = fgetl (fid);
   while (line != -1)
     if (line(1) == "#")
-      ## Comments, do nothing
+      ## Comments, do nothing.
     elseif (isspace(line(1)))
       ## Continuation lines
       if (exist ("keyword", "var") && isfield (desc, keyword))
@@ -1634,7 +1633,7 @@
   endwhile
   fclose (fid);
 
-  ## Make sure all is okay
+  ## Make sure all is okay.
   needed_fields = {"name", "version", "date", "title", ...
 		   "author", "maintainer", "description"};
   for f = needed_fields
@@ -1652,7 +1651,7 @@
 endfunction
 
 ## Make sure the version string v is a valid x.y.z version string
-## Examples: "0.1" => "0.1.0", "monkey" => error(...)
+## Examples: "0.1" => "0.1.0", "monkey" => error(...).
 function out = fix_version (v)
   dots = find (v == ".");
   if (length (dots) == 1)
@@ -1681,13 +1680,13 @@
   deps = split_by (tolower (depends), ",");
   deps_cell = cell (1, length (deps));
 
-  ## For each dependency
+  ## For each dependency.
   for i = 1:length (deps)
     dep = deps{i};
     lpar = find (dep == "(");
     rpar = find (dep == ")");
     ## Does the dependency specify a version
-    ## Example: package(>= version)
+    ## Example: package(>= version).
     if (length (lpar) == 1 && length (rpar) == 1)
       package = tolower (strip (dep(1:lpar-1)));
       sub = dep(lpar(1)+1:rpar(1)-1);
@@ -1711,7 +1710,7 @@
 
   ## If no version is specified for the dependency
   ## we say that the version should be greater than 
-  ## or equal to 0.0.0
+  ## or equal to "0.0.0".
   else
     package = tolower (strip (dep));
     operator = ">=";
@@ -1723,7 +1722,8 @@
 endfunction
 
 ## Strip the text of spaces from the right
-## Example: "  hello world  " => "  hello world" (FIXME: is this the same as deblank?)
+## Example: "  hello world  " => "  hello world"
+## FIXME -- is this the same as deblank?
 function text = rstrip (text)
   chars = find (! isspace (text));
   if (length (chars) > 0)
@@ -1734,7 +1734,7 @@
   endif
 endfunction
 
-## Strip the text of spaces from the left and the right
+## Strip the text of spaces from the left and the right.
 ## Example: "  hello world  " => "hello world"
 function text = strip (text)
   chars = find (! isspace (text));
@@ -1745,7 +1745,7 @@
   endif
 endfunction
 
-## Split the text into a cell array of strings by sep
+## Split the text into a cell array of strings by sep.
 ## Example: "A, B" => {"A", "B"} (with sep = ",")
 function out = split_by (text, sep)
   text_matrix = split (text, sep);
@@ -1767,7 +1767,7 @@
     error ("couldn't read directory %s: %s", dir, msg);
   endif
 
-  ## Check for architecture dependent files
+  ## Check for architecture dependent files.
   tmpdir = getarchdir (desc);
   if (exist (tmpdir, "dir"))
     [files2, err, msg] = readdir (tmpdir);
@@ -1797,7 +1797,7 @@
       error ("the Category field is empty");
   endif
 
-  ## Write INDEX
+  ## Write INDEX.
   fid = fopen (index_file, "w");
   if (fid == -1)
     error ("couldn't open %s for writing.", index_file);
@@ -1811,7 +1811,7 @@
 function bad_deps = get_unsatisfied_deps (desc, installed_pkgs_lst)
   bad_deps = {};
 
-  ## For each dependency
+  ## For each dependency.
   for i = 1:length (desc.depends)
     dep = desc.depends{i};
 
@@ -1820,7 +1820,7 @@
       if (! compare_versions (OCTAVE_VERSION, dep.version, dep.operator))
         bad_deps{end+1} = dep;
       endif
-    ## Is the current dependency not Octave?
+      ## Is the current dependency not Octave?
     else
       ok = false;
       for i = 1:length (installed_pkgs_lst)
@@ -1840,7 +1840,7 @@
 endfunction
 
 function [out1, out2] = installed_packages (local_list, global_list)
-  ## Get the list of installed packages
+  ## Get the list of installed packages.
   try
     local_packages = load (local_list).local_packages;
   catch
@@ -1854,7 +1854,7 @@
   installed_pkgs_lst = {local_packages{:}, global_packages{:}};
 
   ## Eliminate duplicates in the installed package list.
-  ## Locally installed packages take precedence
+  ## Locally installed packages take precedence.
   dup = [];
   for i = 1:length (installed_pkgs_lst)
     if (find (dup, i))
@@ -1873,7 +1873,7 @@
     installed_pkgs_lst(dup) = [];
   endif  
 
-  ## Now check if the package is loaded
+  ## Now check if the package is loaded.
   tmppath = strrep (path(), "\\", "/");
   for i = 1:length (installed_pkgs_lst)
     if (findstr (tmppath, strrep (installed_pkgs_lst{i}.dir, "\\", "/")))
@@ -1907,14 +1907,14 @@
     return;
   endif
 
-  ## We shouldn't return something, so we'll print something
+  ## We shouldn't return something, so we'll print something.
   num_packages = length (installed_pkgs_lst);
   if (num_packages == 0)
     printf ("no packages installed.\n");
     return;
   endif
 
-  ## Compute the maximal lengths of name, version, and dir
+  ## Compute the maximal lengths of name, version, and dir.
   h1 = "Package Name";
   h2 = "Version";
   h3 = "Installation directory";
@@ -1937,7 +1937,7 @@
   h1 = postpad (h1, max_name_length + 1, " ");
   h2 = postpad (h2, max_version_length, " ");;
 
-  ## Print a header
+  ## Print a header.
   header = sprintf("%s | %s | %s\n", h1, h2, h3);
   printf (header);
   tmp = sprintf (repmat ("-", 1, length(header)-1));
@@ -1945,7 +1945,7 @@
   tmp(length(h1)+length(h2)+5) = "+";
   printf ("%s\n", tmp);
 
-  ## Print the packages
+  ## Print the packages.
   format = sprintf ("%%%ds %%1s| %%%ds | %%s\n", max_name_length,
 		    max_version_length);
   [dummy, idx] = sort (names);
@@ -1976,17 +1976,17 @@
   installed_pkgs_lst = installed_packages (local_list, global_list);
   num_packages = length (installed_pkgs_lst);
 
-  ## Read package names and installdirs into a more convenient format
+  ## Read package names and installdirs into a more convenient format.
   pnames = pdirs = cell (1, num_packages);
   for i = 1:num_packages
     pnames{i} = installed_pkgs_lst{i}.name;
     pdirs{i} = installed_pkgs_lst{i}.dir;
   endfor
 
-  ## load all
+  ## Load all.
   if (length (files) == 1 && strcmp (files{1}, "all"))
     idx = [1:length(installed_pkgs_lst)];
-  ## load auto
+  ## Load auto.
   elseif (length (files) == 1 && strcmp (files{1}, "auto")) 
     idx = [];
     for i = 1:length (installed_pkgs_lst)
@@ -1994,7 +1994,7 @@
 	idx (end + 1) = i;
       endif
     endfor
-  ## load package_name1 ...
+  ## Load package_name1 ...
   else
     idx = [];
     for i = 1:length (files)
@@ -2006,7 +2006,7 @@
     endfor
   endif
 
-  ## Load the packages, but take care of the ordering of dependencies
+  ## Load the packages, but take care of the ordering of dependencies.
   load_packages_and_dependencies (idx, handle_deps, installed_pkgs_lst, true);
 endfunction
 
@@ -2014,7 +2014,7 @@
   installed_pkgs_lst = installed_packages (local_list, global_list);
   num_packages = length (installed_pkgs_lst);
 
-  ## Read package names and installdirs into a more convenient format
+  ## Read package names and installdirs into a more convenient format.
   pnames = pdirs = cell (1, num_packages);
   for i = 1:num_packages
     pnames{i} = installed_pkgs_lst{i}.name;
@@ -2022,15 +2022,15 @@
     pdeps{i} = installed_pkgs_lst{i}.depends;
   endfor
 
-  ## Get the current octave path
+  ## Get the current octave path.
   p = split_by (path(), pathsep ());
 
-  ## unload all
   if (length (files) == 1 && strcmp (files{1}, "all"))
-      dirs = pdirs;
-      desc = installed_pkgs_lst;
-  ## unload package_name1 ...
+    ## Unload all.
+    dirs = pdirs;
+    desc = installed_pkgs_lst;
   else
+    ## Unload package_name1 ...
     dirs = {};
     desc = {};
     for i = 1:length (files)
@@ -2043,7 +2043,7 @@
       endfor
   endif
 
-  ## Check for architecture dependent directories
+  ## Check for architecture dependent directories.
   archdirs = {};
   for i = 1:length (dirs)
     tmpdir = getarchdir (desc{i});
@@ -2055,13 +2055,14 @@
     endif
   endfor
 
-  ## Unload the packages
+  ## Unload the packages.
   for i = 1:length (archdirs)
     d = archdirs{i};
     idx = strcmp (p, d);
     if (any (idx))
       rmpath (d);
-      ## FIXME: We should also check if we need to remove items from EXEC_PATH
+      ## FIXME: We should also check if we need to remove items from
+      ## EXEC_PATH.
     endif
   endfor
 endfunction
@@ -2187,7 +2188,7 @@
       endif
     endif
   endfor
-  ## Eliminate the duplicates
+  ## Eliminate the duplicates.
   idx = [];
   for i = 1 : length (newdesc)
     for j = (i + 1) : length (newdesc)
@@ -2219,12 +2220,12 @@
     endif
   endfor
 
-  ## Load the packages
+  ## Load the packages.
   if (length (dirs) > 0)
     addpath (dirs{:});
   endif
 
-  ## Add the binaries to exec_path
+  ## Add the binaries to exec_path.
   if (! strcmp (EXEC_PATH, execpath))
     EXEC_PATH (execpath);
   endif
--- a/scripts/plot/__errplot__.m
+++ b/scripts/plot/__errplot__.m
@@ -64,13 +64,13 @@
       hl = __line__ (hg, "color", fmt.color);
     endif
 
-    ## FIXME
-    ## Note the below adds the errorbar data directly as ldata, etc 
-    ## properties of the line objects, as gnuplot can handle this.
-    ## Matlab has the errorbar part of the plot as a special line object
-    ## with embedded NaNs that draws the three segments of the bar
-    ## separately. Should we duplicate Matlab's behavior and stop using the
-    ## ldata, etc properties of the line objects that are Octace specific?
+    ## FIXME -- note the code below adds the errorbar data directly as
+    ## ldata, etc properties of the line objects, as gnuplot can handle
+    ## this.  Matlab has the errorbar part of the plot as a special line
+    ## object with embedded NaNs that draws the three segments of the
+    ## bar separately.  Should we duplicate Matlab's behavior and stop
+    ## using the ldata, etc. properties of the line objects that are
+    ## Octace specific?
 
     switch (nargin - 2)
       case 1
--- a/scripts/plot/__go_draw_axes__.m
+++ b/scripts/plot/__go_draw_axes__.m
@@ -930,7 +930,7 @@
 	  endif
 
         case "hggroup"
-	  # push group children into the kid list
+	  ## Push group children into the kid list.
 	  if (isempty (kids))
 	    kids = obj.children;
 	  elseif (! isempty (obj.children))
@@ -945,7 +945,7 @@
     endwhile
 
     ## This is need to prevent warnings for rotations in 3D plots, while
-    ## allowing colorbars with contours..
+    ## allowing colorbars with contours.
     if (nd == 2 || (data_idx > 1 && !view_map))
       fputs (plot_stream, "set pm3d implicit;\n");
     else
@@ -961,7 +961,7 @@
     have_data = (! (isempty (data) || all (cellfun (@isempty, data))));
 
     ## Note we don't use the [xy]2range of gnuplot as we don't use the
-    ## dual axis plotting features of gnuplot
+    ## dual axis plotting features of gnuplot.
     if (isempty (xlim))
       return;
     endif
@@ -1101,8 +1101,8 @@
 	case "best" 
 	  pos = "";
 	  warning ("legend: 'Best' not yet implemented for location specifier.\n");
-	  ## least conflict with data in plot
-	  ## least unused space outside plot
+	  ## Least conflict with data in plot.
+	  ## Least unused space outside plot.
 	otherwise
 	  pos = "";
       endswitch
@@ -1178,7 +1178,7 @@
       fputs (plot_stream, "plot \"-\";\nInf Inf\ne\n");
     endif
 
-    ## Needed to allow mouse rotation with pcolor
+    ## Needed to allow mouse rotation with pcolor.
     if (view_map)
       fputs (plot_stream, "unset view;\n");
     endif
@@ -1697,13 +1697,13 @@
     endif
   endfor
 
-  ## Prepend @ to things  things like _0^x or _{-100}^{100} for alignment
-  ## But need to put the shorter of the two arguments first. Carful of 
-  ## nested {} and unprinted characters when defining shortest.. Don't 
-  ## have to worry about things like ^\theta as they are already converted to
-  ## ^{/Symbol q}.
+  ## Prepend @ to things  things like _0^x or _{-100}^{100} for
+  ## alignment But need to put the shorter of the two arguments first.
+  ## Carful of nested {} and unprinted characters when defining
+  ## shortest.. Don't have to worry about things like ^\theta as they
+  ## are already converted to ^{/Symbol q}.
 
-  ## FIXME.. This is a mess... Is it worth it just for a "@" character?
+  ## FIXME -- This is a mess... Is it worth it just for a "@" character?
 
   [s, m] = regexp(str,'[_\^]','start','matches');
   i = 1;
@@ -1745,15 +1745,15 @@
 	    l2 = l2 (min (length(l2), si));
 	    if (length_string (str(s(i)+p+2:s(i)+p+l1-1)) <=
 		length_string(str(s(i+1)+p+2:s(i+1)+p+l2-1)))
-	      ## shortest already first!
+	      ## Shortest already first!
 	      str = cstrcat (str(1:s(i)+p-1), "@", str(s(i)+p:end));
 	    else
-	      ## Have to swap sub/super-script to get shortest first
+	      ## Have to swap sub/super-script to get shortest first.
 	      str = cstrcat (str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+l2),
 			    str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+l2+1:end));
 	    endif
 	  else
-	    ## Have to swap sub/super-script to get shortest first
+	    ## Have to swap sub/super-script to get shortest first.
 	    str = cstrcat (str(1:s(i)+p-1), "@", str(s(i+1)+p:s(i+1)+p+1),
 			  str(s(i)+p:s(i)+p+l1), str(s(i+1)+p+2:end));
 	  endif
@@ -1764,7 +1764,7 @@
 	endif
       else
 	if (s(i+1) == s(i) + 2)
-	  ## shortest already first!
+	  ## Shortest already first!
 	  str = cstrcat (str(1:s(i)+p-1), "@", str(s(i)+p:end));
 	  p ++;
           i += 2;
--- a/scripts/plot/__stem__.m
+++ b/scripts/plot/__stem__.m
@@ -107,7 +107,7 @@
 	endif
       endif
 
-      ## Setup the hggroup and listeners
+      ## Setup the hggroup and listeners.
       addproperty ("showbaseline", hg, "radio", "{on}|off");
       addproperty ("basevalue", hg, "data", 0);
       addproperty ("baseline", hg, "data", h_baseline);
@@ -159,13 +159,18 @@
 
 function [x, y, z, dofill, lc, ls, mc, ms, newargs] = check_stem_arg (have_z, varargin)
 
+  ## FIXME -- there seems to be a lot of duplicated code in this
+  ## function.  It seems like it should be possible to simplify things
+  ## by combining some of the nearly identical code sections into
+  ## additional subfunctions.
+
   if (have_z)
     caller = "stem3";
   else
     caller = "stem";
   endif
 
-  ## Remove prop/val pairs from data to consider
+  ## Remove prop/val pairs from data to consider.
   i = 2;
   newargs = {};
   while (i < length (varargin))
@@ -180,14 +185,14 @@
     endif
   endwhile
 
-  ## set specifiers to default values
+  ## set specifiers to default values.
   [lc, ls, mc, ms] = set_default_values ();
   dofill = 0;
   fill_2 = 0;
   linespec_2 = 0;
   z = [];
 
-  ## check input arguments
+  ## Check input arguments.
   if (nargin == 2)
     if (have_z)
       z = varargin{1};
@@ -204,16 +209,17 @@
       endif # in each case, x & y will be defined
     endif
   elseif (nargin == 3)
-    ## several possibilities
+    ## Several possibilities
+    ##
     ## 1. the real y data
     ## 2. 'filled'
     ## 3. line spec
     if (ischar (varargin{2}))
-      ## only 2. or 3. possible
+      ## Only 2. or 3. possible.
       if (strcmpi ("fill", varargin{2}) || strcmpi ("filled", varargin{2}))
 	dofill = 1;
       else
-	## parse the linespec
+	## Parse the linespec.
 	[lc, ls, mc, ms] = stem_line_spec (caller, varargin{2});
       endif
       if (have_z)
@@ -234,7 +240,7 @@
       if (have_z)
 	error ("stem3: must define X, Y and Z");
       else
-	## must be the real y data
+	## Must be the real y data.
 	x = varargin{1};
 	y = varargin{2};
 	if (! (ismatrix (x) && ismatrix (y)))
@@ -243,18 +249,19 @@
       endif
     endif
   elseif (nargin == 4)
-    ## again several possibilities
+    ## Again, several possibilities:
+    ##
     ## arg2 1. real y
     ## arg2 2. 'filled' or linespec
     ## arg3 1. real z
     ## arg3 2. 'filled' or linespec
     if (ischar (varargin{2}))
-      ## only arg2 2. / arg3 1. & arg3 3. are possible
+      ## Only arg2 2. / arg3 1. & arg3 3. are possible.
       if (strcmpi ("fill", varargin{2}) || strcmpi ("filled", varargin{2}))
 	dofill = 1;
-	fill_2 = 1; # be sure, no second "fill" is in the arguments
+	fill_2 = 1; # Be sure, no second "fill" is in the arguments.
       else
-	## must be a linespec
+	## Must be a linespec.
 	[lc, ls, mc, ms] = stem_line_spec (caller, varargin{2});
 	linespec_2 = 1;
       endif
@@ -281,7 +288,7 @@
 	  error ("stem3: X, Y and Z must be matrices");
 	endif
       else
-	## must be the real y data
+	## must be the real y data.
 	x = varargin{1};
 	y = varargin{2};
 	if (! (ismatrix (x) && ismatrix (y)))
@@ -290,22 +297,22 @@
       endif
     endif # if ischar(varargin{2})
     if (! have_z)
-      ## varargin{3} must be char
-      ## check for "fill
+      ## varargin{3} must be char.
+      ## Check for "fill.
       if ((strcmpi (varargin{3}, "fill") || strcmpi (varargin{3}, "filled"))
 	  && fill_2)
 	error ("stem: duplicate fill argument");
       elseif (strcmpi ("fill", varargin{3}) && linespec_2)
-	## must be "fill"
+	## Must be "fill".
 	dofill = 1;
 	fill_2 = 1;
       elseif ((strcmpi (varargin{3}, "fill") || strcmpi (varargin{3}, "filled"))
 	  && !linespec_2)
-	## must be "fill"
+	## Must be "fill".
 	dofill = 1;
 	fill_2 = 1;
       elseif (! linespec_2)
-	## must be linespec
+	## Must be linespec.
 	[lc, ls, mc, ms] = stem_line_spec (caller, varargin{3});
 	linespec_2 = 1;
       endif
@@ -329,26 +336,26 @@
     if (! have_z)
       if (strcmpi (varargin{3}, "fill") || strcmpi (varargin{3}, "filled"))
 	dofill = 1;
-	fill_2 = 1; # be sure, no second "fill" is in the arguments
+	fill_2 = 1; # Be sure, no second "fill" is in the arguments.
       else
-	## must be a linespec
+	## Must be a linespec.
 	[lc, ls, mc, ms] = stem_line_spec (caller, varargin{3});
 	linespec_2 = 1;
       endif
     endif
 
-    ## check for "fill" ..
+    ## Check for "fill".
     if ((strcmpi (varargin{4}, "fill") || strcmpi (varargin{4}, "filled"))
 	&& fill_2)
       error ("%s: duplicate fill argument", caller);
     elseif ((strcmpi (varargin{4}, "fill") || strcmpi (varargin{4}, "filled"))
 	&& linespec_2)
-      ## must be "fill"
+      ## Must be "fill".
       dofill = 1;
       fill_2 = 1;
     elseif (!strcmpi (varargin{4}, "fill") && !strcmpi (varargin{4}, "filled")
 	&& !linespec_2)
-      ## must be linespec
+      ## Must be linespec.
       [lc, ls, mc, ms] = stem_line_spec (caller, varargin{4});
       linespec_2 = 1;
     endif
@@ -364,7 +371,7 @@
       dofill = 1;
       fill_2 = 1; # be sure, no second "fill" is in the arguments
     else
-      ## must be a linespec
+      ## Must be a linespec.
       [lc, ls, mc, ms] = stem_line_spec (caller, varargin{4});
       linespec_2 = 1;
     endif
@@ -375,12 +382,12 @@
       error ("stem3: duplicate fill argument");
     elseif ((strcmpi (varargin{5}, "fill") || strcmpi (varargin{5}, "filled"))
 	&& linespec_2)
-      ## must be "fill"
+      ## Must be "fill".
       dofill = 1;
       fill_2 = 1;
     elseif (!strcmpi (varargin{5}, "fill") && !strcmpi (varargin{5}, "filled")
 	    && !linespec_2)
-      ## must be linespec
+      ## Must be linespec.
       [lc, ls, mc, ms] = stem_line_spec (caller, varargin{5});
       linespec_2 = 1;
     endif
@@ -388,7 +395,7 @@
     error ("%s: incorrect number of arguments", caller);
   endif
 
-  ## Check sizes of x, y and z
+  ## Check sizes of x, y and z.
   if (have_z)
     if (!size_equal (x, y, z))
       error ("stem3: inconsistent size of x, y and z");
--- a/scripts/plot/findobj.m
+++ b/scripts/plot/findobj.m
@@ -139,7 +139,8 @@
 	else
 	  error ("findobj: inconsistent number of arguments");
 	endif
-      elseif (! strcmp (args{na}(1), "-")) # parameter/value pairs
+      elseif (! strcmp (args{na}(1), "-"))
+	## Parameter/value pairs.
 	if (na + 1 <= numel (args))
 	  pname{np} = args{na};
 	  na = na + 1;
@@ -171,7 +172,7 @@
 	  error ("findobj: inconsistent number of arguments");
 	endif
       else
-	## this is sloppy ... but works like matlab
+	## This is sloppy ... but works like Matlab.
 	if strcmpi(args{na}, "-not")
 	  h = [];
 	  return
@@ -185,7 +186,7 @@
 
   numpairs = np - 1;
   
-  ## load all objects which qualify for being searched
+  ## Load all objects which qualify for being searched.
   idepth = 0;
   h = handles;
   while (numel (handles) && ! (idepth >= depth))
--- a/scripts/set/ismember.m
+++ b/scripts/set/ismember.m
@@ -184,20 +184,22 @@
 function [tf, a_idx] = cell_ismember (a, s)
   if (nargin == 2)
     if (ischar (a) && iscellstr (s)) 
-      if (isempty (a)) # Work around bug in 'cellstr' 
+      if (isempty (a))
+	## Work around bug in cellstr.
         a = {''};
       else
         a = cellstr (a);
       endif
     elseif (iscellstr (a) && ischar (s))
-      if (isempty (s)) # Work around bug in 'cellstr' 
+      if (isempty (s))
+	## Work around bug in cellstr.
         s = {''};
       else
         s = cellstr (s);
       endif
     endif 
     if (iscellstr (a) && iscellstr (s))
-      ## Do the actual work
+      ## Do the actual work.
       if (isempty (a) || isempty (s))
         tf = zeros (size (a), "logical");
         a_idx = zeros (size (a)); 
@@ -230,7 +232,7 @@
   else
     print_usage ();
   endif
-  ## Resize result to the original size of 'a' 
+  ## Resize result to the original size of A.
   size_a = size (a);
   tf = reshape (tf, size_a); 
   a_idx = reshape (a_idx, size_a); 
--- a/scripts/signal/arma_rnd.m
+++ b/scripts/signal/arma_rnd.m
@@ -66,7 +66,8 @@
   a = reshape (a, ar, 1);
   b = reshape (b, br, 1);
 
-  a = [1; -a];                        # apply our notational convention
+  ## Apply our notational convention.
+  a = [1; -a];
   b = [1; b];
 
   n = min (n, ar + br);
--- a/scripts/signal/freqz.m
+++ b/scripts/signal/freqz.m
@@ -117,9 +117,11 @@
   a = a(:);
   b = b(:);
 
-  if (! isscalar (n)) ## Explicit frequency vector given
+  if (! isscalar (n))
+    ## Explicit frequency vector given
     w = f = n;
-    if (nargin == 4)  ## Sampling rate Fs was specified
+    if (nargin == 4)
+      ## Sampling rate Fs was specified
       w = 2*pi*f/Fs;
     endif
     k = max (length (b), length (a));
@@ -142,10 +144,12 @@
 
   h = hb ./ ha;
 
-  if (nargout != 0), # return values and don't plot
+  if (nargout != 0)
+    ## Return values and don't plot.
     h_r = h;
     f_r = f;
-  else             # plot and don't return values
+  else
+    ## Plot and don't return values.
     freqz_plot (f, h);
   endif
 
--- a/scripts/signal/stft.m
+++ b/scripts/signal/stft.m
@@ -56,7 +56,7 @@
 
 function [Y, c] = stft(X, win, inc, coef, w_type)
 
-  ## default values of unspecified arguments
+  ## Default values of unspecified arguments.
   if (nargin < 5)
     w_type = 1;
     if (nargin < 4)
@@ -84,7 +84,7 @@
     print_usage ();
   endif
 
-  ## check whether X is a vector
+  ## Check whether X is a vector.
   [nr, nc] = size (X);
   if (nc != 1)
     if (nr == 1)
@@ -103,15 +103,18 @@
   num_win = fix ((nr - win) / inc);
 
   ## compute the window coefficients
-  if (w_type == 3)              # rectangular window
+  if (w_type == 3)
+    ## Rectangular window.
     WIN_COEF = ones (win, 1);
-  elseif (w_type == 2)          # Hamming window
+  elseif (w_type == 2)
+    ## Hamming window.
     WIN_COEF = hamming (win);
-  else                          # Hanning window
+  else
+    ## Hanning window.
     WIN_COEF = hanning (win);
   endif
 
-  ## create a matrix Z whose columns contain the windowed time-slices
+  ## Create a matrix Z whose columns contain the windowed time-slices.
   Z = zeros (num_coef, num_win + 1);
   start = 1;
   for i = 0:num_win
--- a/scripts/sparse/pcg.m
+++ b/scripts/sparse/pcg.m
@@ -252,13 +252,16 @@
     preconditioned_residual_out = true;
   endif
 
-  matrix_positive_definite = true;	# assume A is positive definite
+  ## Assume A is positive definite.
+  matrix_positive_definite = true;
 
   p = zeros (size (b));
   oldtau = 1; 
-  if (isnumeric (A))			# is A a matrix?
+  if (isnumeric (A))
+    ## A is a matrix.
     r = b - A*x; 
-  else					# then A should be a function!
+  else
+    ## A should be a function.
     r = b - feval (A, x, varargin{:});
   endif
 
@@ -290,14 +293,18 @@
     beta = tau / oldtau;
     oldtau = tau;
     p = z + beta * p;
-    if (isnumeric (A))		# is A a matrix?
+    if (isnumeric (A))
+      ## A is a matrix.
       w = A * p;
-    else			# then A should be a function!
+    else
+      ## A should be a function.
       w = feval (A, p, varargin{:});
     endif
-    oldalpha = alpha; 		# needed only for eigest
+    ## Needed only for eigest.
+    oldalpha = alpha;
     alpha = tau / (p'*w);
-    if (alpha <= 0.0) # negative matrix?
+    if (alpha <= 0.0)
+      ## Negative matrix.
       matrix_positive_definite = false;
     endif
     x += alpha * p;
@@ -327,8 +334,8 @@
       eigest = [NaN, NaN];
     endif
 
-    ## apply the preconditioner once more and finish with the precond
-    ## residual
+    ## Apply the preconditioner once more and finish with the precond
+    ## residual.
     if (existM1)
       if(isnumeric (M1))
 	y = M1 \ r;
--- a/scripts/sparse/sprandsym.m
+++ b/scripts/sparse/sprandsym.m
@@ -49,7 +49,9 @@
     ## random values than necessary in order to reduce the probability
     ## that there are less than k distinct values; maybe a better
     ## strategy could be used but I don't think it's worth the price.
-    k1 = min (length (idx1), k1);  # actual number of entries in S
+
+    ## Actual number of entries in S.
+    k1 = min (length (idx1), k1);
     j1 = floor ((idx1(1:k1)-1)/m1);
     i1 = idx1(1:k1) - j1*m1;
 
--- a/scripts/sparse/treelayout.m
+++ b/scripts/sparse/treelayout.m
@@ -33,53 +33,52 @@
         ||  any (Tree > length (Tree)) || any (Tree < 0) )
     error ("treelayout: the first input argument must be a vector of predecessors");
   else
-    ## make it a row vector
+    ## Make it a row vector.
     Tree = Tree(:)';
 
-    ## the count of nodes of the graph
+    ## The count of nodes of the graph.
     NodNumber = length (Tree);
-    ## the number of children
+    ## The number of children.
     ChildNumber = zeros (1, NodNumber + 1);
 
-
-    ## checking vector of predecessors
+    ## Checking vector of predecessors.
     for i = 1 : NodNumber
       if (Tree (i) < i)
-	## this part of graph was checked before
+	## This part of graph was checked before.
         continue;
       endif
 
-      ## Try to find cicle in this part of graph
-      ## we use modified Floyd's cycle-finding algorithm
+      ## Try to find cicle in this part of graph using modified Floyd's
+      ## cycle-finding algorithm.
       tortoise = Tree (i);
       hare = Tree (tortoise);
 
       while (tortoise != hare)
-	## we end after find a cicle or when we reach a checked part of graph
+	## End after finding a cicle or reaching a checked part of graph.
 
         if (hare < i)
-          ## this part of graph was checked before
+          ## This part of graph was checked before.
           break
         endif
 
         tortoise = Tree (tortoise);
-	## hare will move faster than tortoise so in cicle hare
-	## must reach tortoise
+	## Hare will move faster than tortoise so in cicle hare must
+	## reach tortoise.
         hare = Tree (Tree (hare));
 
       endwhile
 
       if (tortoise == hare)
-	## if hare reach tortoise we find cicle
+	## If hare reach tortoise we found circle.
         error ("treelayout: vector of predecessors has bad format");
       endif
 
     endfor
-    ## vector of predecessors has right format
+    ## Vector of predecessors has right format.
 
     for i = 1:NodNumber
       ## VecOfChild is helping vector which is used to speed up the
-      ## choose of descendant nodes
+      ## choice of descendant nodes.
 
       ChildNumber (Tree (i) + 1) = ChildNumber (Tree (i) + 1) + 1;
     endfor
@@ -101,31 +100,30 @@
       VecOfChild = Permutation;
     endif
 
-
-    ## the number of "parent" (actual) node (it's descendants will be
-    ## browse in the next iteration)
+    ## The number of "parent" (actual) node (it's descendants will be
+    ## browse in the next iteration).
     ParNumber = 0;
 
-    ## the x-coordinate of the left most descendant of "parent node"
-    ## this value is increased in each leaf		
+    ## The x-coordinate of the left most descendant of "parent node"
+    ## this value is increased in each leaf.
     LeftMost = 0;
 
-    ## the level of "parent" node (root level is NodNumber)
+    ## The level of "parent" node (root level is NodNumber).
     Level = NodNumber;
 
-    ## NodNumber - Max is the height of this graph
+    ## NodNumber - Max is the height of this graph.
     Max = NodNumber;
 
-    ## main stack - each item consists of two numbers - the number of
+    ## Main stack - each item consists of two numbers - the number of
     ## node and the number it's of parent node on the top of stack
-    ## there is "parent node"
+    ## there is "parent node".
     St = [-1, 0];
 
-    #number of vertices s in the top-level separator
+    ## Number of vertices s in the top-level separator.
     s = 0;
-    # flag which says if we are in top level separator
+    ## Flag which says if we are in top level separator.
     topLevel = 1;
-    ## the top of the stack
+    ## The top of the stack.
     while (ParNumber != -1)
       if (Start(ParNumber + 1) < Stop(ParNumber + 1))
         idx = VecOfChild (Start (ParNumber + 1) : Stop (ParNumber + 1) - 1);
@@ -133,57 +131,57 @@
         idx = zeros (1, 0);
       endif
 
-      ## add to idx the vector of parent descendants
+      ## Add to idx the vector of parent descendants.
       St = [St ; [idx', ones(fliplr(size(idx))) * ParNumber]];
 
-      # we are in top level separator when we have one children
-      ## and the flag is 1
+      ## We are in top level separator when we have one child and the
+      ## flag is 1
       if (columns(idx) == 1 && topLevel ==1 )
         s += 1;
       else
-        # we arent in top level separator now
+        # We aren't in top level separator now.
         topLevel = 0;
       endif
-      ## if there is not any descendant of "parent node":
+      ## If there is not any descendant of "parent node":
       if (St(end,2) != ParNumber)
        LeftMost = LeftMost + 1;
        XCoordinateR(ParNumber) = LeftMost;           
        Max = min (Max, Level);
        if ((length(St) > 1) && (find((shift(St,1)-St) == 0) >1) 
 	   && St(end,2) != St(end-1,2))
-	  ## return to the nearest branching the position to return
+	  ## Return to the nearest branching the position to return
 	  ## position is the position on the stack, where should be
           ## started further search (there are two nodes which has the
-          ## same parent node)
+          ## same parent node).
 
           Position = (find ((shift (St(:, 2), 1) - St(:, 2)) == 0))(end)+1;
           ParNumberVec = St(Position : end, 2);
 
-          ## the vector of removed nodes (the content of stack form
-          ## position to end)
+          ## The vector of removed nodes (the content of stack form
+          ## position to end).
 
           Level = Level + length(ParNumberVec);
 
-	  ## the level have to be decreased
+	  ## The level have to be decreased.
 
           XCoordinateR(ParNumberVec) = LeftMost;
           St(Position:end, :) = [];
         endif	
 
-        ## remove the next node from "searched branch"
+        ## Remove the next node from "searched branch".
 
         St(end, :) = [];
-	## choose new "parent node"
+	## Choose new "parent node".
         ParNumber = St(end, 1);
-	## if there is another branch start to search it
+	## If there is another branch start to search it.
 	if (ParNumber != -1)
           YCoordinate(ParNumber) = Level;	
           XCoordinateL(ParNumber) = LeftMost + 1;
 	endif
       else
 
-        ## there were descendants of "parent nod" choose the last of
-        ## them and go on through it
+        ## There were descendants of "parent nod" choose the last of
+        ## them and go on through it.
         Level--;
         ParNumber = St(end, 1);
         YCoordinate(ParNumber) = Level;     
@@ -191,8 +189,8 @@
       endif
     endwhile
 
-    ## calculate the x coordinates (the known values are the position
-    ## of most left and most right descendants)
+    ## Calculate the x coordinates (the known values are the position
+    ## of most left and most right descendants).
     XCoordinate = (XCoordinateL + XCoordinateR) / 2;
 
     Height = NodNumber - Max - 1;
--- a/scripts/specfun/factor.m
+++ b/scripts/specfun/factor.m
@@ -46,7 +46,7 @@
     error ("factor: n must be a scalar integer");
   endif
 
-  ## special case of no primes less than sqrt(n)
+  ## Special case of no primes less than sqrt(n).
   if (n < 4)
     x = n;
     m = 1;
@@ -60,19 +60,20 @@
   ## then n >= p1*p2 > sqrt(n)*sqrt(n) == n. Contradiction.]
   p = primes (sqrt (n));
   while (n > 1)
-    ## find prime factors in remaining n
+    ## Find prime factors in remaining n.
     q = n ./ p;
     p = p (q == fix (q));
     if (isempty (p))
-      p = n;  # can't be reduced further, so n must itself be a prime.
+      ## Can't be reduced further, so n must itself be a prime.
+      p = n;
     endif
     x = [x, p];
-    ## reduce n
+    ## Reduce n.
     n = n / prod (p);
   endwhile
   x = sort (x);
 
-  ## determine muliplicity
+  ## Determine muliplicity.
   if (nargout > 1)
     idx = find ([0, x] != [x, 0]);
     x = x(idx(1:length(idx)-1));
--- a/scripts/specfun/nchoosek.m
+++ b/scripts/specfun/nchoosek.m
@@ -76,7 +76,8 @@
   n = length (v);
 
   if (n == 1)
-    k = min (k, v-k);		# improve precision at next step
+    ## Improve precision at next step.
+    k = min (k, v-k);
     A = round (prod ((v-k+1:v)./(1:k)));
     if (A*2*k*eps >= 0.5)
       warning ("nchoosek", "nchoosek: possible loss of precision");
@@ -91,8 +92,8 @@
     A = zeros (0, k, class (v));
   else
     p = cell (1, k);
-    # hack: do the op in the smallest integer class possible to avoid moving
-    # too much data.
+    ## Hack: do the op in the smallest integer class possible to avoid
+    ## moving too much data.
     if (n < intmax ("uint8"))
       cl = "uint8";
     elseif (n < intmax ("uint16"))
@@ -100,12 +101,12 @@
     elseif (n < intmax ("uint32"))
       cl = "uint32";
     else
-      # This would exhaust memory anyway.
+      ## This would exhaust memory anyway.
       cl = "double";
     endif
      
-    # Use a generalized Pascal triangle. Traverse backwards to keep
-    # alphabetical order.
+    ## Use a generalized Pascal triangle. Traverse backwards to keep
+    ## alphabetical order.
     for i = 1:k
       p{i} = zeros (0, i, cl);
     endfor
--- a/scripts/specfun/primes.m
+++ b/scripts/specfun/primes.m
@@ -44,7 +44,7 @@
   endif
 
   if (p > 100000)
-    ## optimization: 1/6 less memory, and much faster (asymptotically)
+    ## Optimization: 1/6 less memory, and much faster (asymptotically)
     ## 100000 happens to be the cross-over point for Paul's machine;
     ## below this the more direct code below is faster.  At the limit
     ## of memory in Paul's machine, this saves .7 seconds out of 7 for
@@ -54,7 +54,7 @@
     sievem = ones (1, lenm);      # assume every number of form 6n-1 is prime
     sievep = ones (1, lenp);      # assume every number of form 6n+1 is prime
 
-    for i = 1:(sqrt(p)+1)/6         # check up to sqrt(p)
+    for i = 1:(sqrt(p)+1)/6       # check up to sqrt(p)
       if (sievem(i))              # if i is prime, eliminate multiples of i
         sievem(7*i-1:6*i-1:lenm) = 0;
         sievep(5*i-1:6*i-1:lenp) = 0;
@@ -65,7 +65,7 @@
       endif
     endfor
     x = sort([2, 3, 6*find(sievem)-1, 6*find(sievep)+1]);
-  elseif (p > 352) # nothing magical about 352; just has to be greater than 2
+  elseif (p > 352)                # nothing magical about 352; must be >2
     len = floor ((p-1)/2);        # length of the sieve
     sieve = ones (1, len);        # assume every odd number is prime
     for i = 1:(sqrt(p)-1)/2       # check up to sqrt(p)
--- a/scripts/statistics/base/quantile.m
+++ b/scripts/statistics/base/quantile.m
@@ -104,27 +104,27 @@
     error ("quantile: invalid dimension.")
   endif
 
-  # Set the permutation vector.
+  ## Set the permutation vector.
   perm = 1:ndims(x);
   perm(1) = dim;
   perm(dim) = 1;
 
-  # Permute dim to the 1st index.
+  ## Permute dim to the 1st index.
   x = permute (x, perm);
 
-  # Save the size of the permuted x N-d array.
+  ## Save the size of the permuted x N-d array.
   sx = size (x);
 
-  # Reshape to a 2-d array.
+  ## Reshape to a 2-d array.
   x = reshape (x, [sx(1), prod(sx(2:end))]);
 
-  # Calculate the quantiles.
+  ## Calculate the quantiles.
   q = __quantile__ (x, p, method);
 
-  # Return the shape to the original N-d array.
+  ## Return the shape to the original N-d array.
   q = reshape (q, [numel(p), sx(2:end)]);
 
-  # Permute the 1st index back to dim.
+  ## Permute the 1st index back to dim.
   q = ipermute (q, perm);
 
 endfunction
--- a/scripts/statistics/base/values.m
+++ b/scripts/statistics/base/values.m
@@ -40,7 +40,8 @@
   endif
 
   i = any (isnan (x));
-  x = x(find(!isnan (x)));      # HACK!
+  ## HACK!
+  x = x(find(!isnan (x)));
   n = length (x);
   x = reshape (x, n, 1);
   s = sort (x);
--- a/scripts/strings/findstr.m
+++ b/scripts/strings/findstr.m
@@ -106,11 +106,13 @@
 	keep(idx) = all (s(v(idx) + ind) == t);
       endfor
     else
-      next = 1; # first possible position for next non-overlapping match
+      ## First possible position for next non-overlapping match.
+      next = 1;
       for idx = 1:length (v)
 	if (v(idx) >= next && s(v(idx) + ind) == t)
 	  keep(idx) = 1;
-	  next = v(idx) + l_t; # skip to the next possible match position
+	  ## Skip to the next possible match position.
+	  next = v(idx) + l_t;
 	else
 	  keep(idx) = 0;
 	endif
@@ -125,7 +127,7 @@
     v = [];
   endif
 
-  ## Always return a column vector, because that's what the old one did
+  ## Always return a column vector, because that's what the old one did.
   if (rows (v) > 1) 
     v = v.';
   endif
--- a/scripts/strings/str2double.m
+++ b/scripts/strings/str2double.m
@@ -87,7 +87,7 @@
   ## digits, sign, exponent,NaN,Inf
   ## valid_char = '0123456789eE+-.nNaAiIfF';
 
-  ## valid delimiters
+  ## Valid delimiters.
   valid_delim = char (sort ([0, 9:14, 32:34, abs("()[]{},;:\"|/")]));
 
   if (nargin < 1 || nargin > 4)
@@ -95,20 +95,20 @@
   endif
 
   if (nargin < 2)
-    ## column delimiter
+    ## Column delimiter.
     cdelim = char ([9, 32, abs(",")]);
   else
-    ## make unique cdelim
+    ## Make unique cdelim.
     cdelim = char (sort (cdelim(:)));
     tmp = [1; 1+find(diff(abs(cdelim))>0)];
     cdelim = cdelim(tmp)';
   endif
 
   if (nargin < 3)
-    ## row delimiter
+    ## Row delimiter.
     rdelim = char ([0, 10, 13, abs(";")]);
   else
-    ## make unique rdelim
+    ## Make unique rdelim.
     rdelim = char (sort (rdelim(:)));
     tmp = [1; 1+find(diff(abs(rdelim))>0)];
     rdelim = rdelim(tmp)';
@@ -120,7 +120,7 @@
     error ("decimal delimiter must be exactly one character");
   endif
 
-  ## check if RDELIM and CDELIM are distinct
+  ## Check if RDELIM and CDELIM are distinct.
 
   delim = sort (abs ([cdelim, rdelim, ddelim]));
   tmp   = [1, 1+find(diff(delim)>0)];
@@ -131,26 +131,26 @@
     error ("row, column and decimal delimiter are not distinct");
   endif
 
-  ## check if delimiters are valid
+  ## Check if delimiters are valid.
   tmp  = sort (abs ([cdelim, rdelim]));
   flag = zeros (size (tmp));
-  k1 = 1;
-  k2 = 1;
-  while (k1 <= length (tmp) && k2 <= length (valid_delim)),
-    if (tmp(k1) == valid_delim(k2))
-      flag(k1) = 1;
-      k1++;
-    elseif (tmp(k1) < valid_delim(k2))
-      k1++;
-    elseif (tmp(k1) > valid_delim(k2))
-      k2++;
+  curr_row = 1;
+  curr_col = 1;
+  while (curr_row <= length (tmp) && curr_col <= length (valid_delim)),
+    if (tmp(curr_row) == valid_delim(curr_col))
+      flag(curr_row) = 1;
+      curr_row++;
+    elseif (tmp(curr_row) < valid_delim(curr_col))
+      curr_row++;
+    elseif (tmp(curr_row) > valid_delim(curr_col))
+      curr_col++;
     endif
   endwhile
   if (! all (flag))
     error ("invalid delimiters!");
   endif
 
-  ## various input parameters
+  ## Various input parameters.
 
   if (isnumeric (s))
     if (all (s < 256) && all (s >= 0))
@@ -167,7 +167,7 @@
   elseif (iscell (s))
     strarray = s;
   elseif (ischar (s) && all (size (s) > 1))
-    ## char array transformed into a string.
+    ## Char array transformed into a string.
     for k = 1:size (s, 1)
       tmp = find (! isspace (s(k,:)));
       strarray{k,1} = s(k,min(tmp):max(tmp));
@@ -176,7 +176,7 @@
     num = [];
     status = 0;
     strarray = {};
-    ## add stop sign; makes sure last digit is not skipped
+    ## Add stop sign; makes sure last digit is not skipped.
     s(end+1) = rdelim(1);
     RD = zeros (size (s));
     for k = 1:length (rdelim),
@@ -187,9 +187,9 @@
       CD = CD | (s==cdelim(k));
     endfor
 
-    k1 = 1; # current row
-    k2 = 0; # current column
-    k3 = 0; # current element
+    curr_row = 1;
+    curr_col = 0;
+    curr_elt = 0;
 
     sl = length (s);
     ix = 1;
@@ -208,10 +208,10 @@
         te = ix - 1;
       endif
       if (! isempty (te))
-        k2++;
-        k3++;
-        strarray{k1,k2} = s(ta:te);
-        ## strarray{k1,k2} = [ta,te];
+        curr_col++;
+        curr_elt++;
+        strarray{curr_row,curr_col} = s(ta:te);
+        ## strarray{curr_row,curr_col} = [ta,te];
 
         flag = 0;
         ## while any(abs(s(ix))==[cdelim(1),rdelim(1)]) & (ix < sl),
@@ -221,8 +221,8 @@
         endwhile
 
         if (flag)
-          k2 = 0;
-          k1++;
+          curr_col = 0;
+          curr_row++;
         endif
         ta = ix;
         te = [];
@@ -237,15 +237,15 @@
   status = zeros (nr, nc);
   num = repmat (NaN, nr, nc);
 
-  for k1 = 1:nr
-    for k2 = 1:nc
-      t = strarray{k1,k2};
+  for curr_row = 1:nr
+    for curr_col = 1:nc
+      t = strarray{curr_row,curr_col};
       if (length (t) == 0)
-	## return error code
-	status(k1,k2) = -1;
-	num(k1,k2) = NaN;
+	## Return error code.
+	status(curr_row,curr_col) = -1;
+	num(curr_row,curr_col) = NaN;
       else
-	## get mantisse
+	## Get mantisse.
 	g = 0;
 	v = 1;
 	if (t(1) == "-")
@@ -258,9 +258,9 @@
 	endif
 
 	if (strcmpi (t(l:end), "inf"))
-	  num(k1,k2) = v*Inf;
+	  num(curr_row,curr_col) = v*Inf;
 	elseif (strcmpi (t(l:end), "NaN"));
-	  num(k1,k2) = NaN;
+	  num(curr_row,curr_col) = NaN;
 	else
 	  if (ddelim == ".")
 	    t(t==ddelim) = ".";
@@ -269,10 +269,10 @@
 	  ## [v,c,em,ni] = sscanf(char(t),"%f %s");
 	  ## c = c * (ni>length(t));
 	  if (c == 1),
-	    num(k1,k2) = v;
+	    num(curr_row,curr_col) = v;
 	  else
-	    num(k1,k2) = NaN;
-	    status(k1,k2) = -1;
+	    num(curr_row,curr_col) = NaN;
+	    status(curr_row,curr_col) = -1;
 	  endif
 	endif
       endif
--- a/scripts/strings/strrep.m
+++ b/scripts/strings/strrep.m
@@ -52,14 +52,17 @@
 
   if (length(ind) == 0)
     t = s;
-  elseif (length(y) > 0)      # replacement
+  elseif (length(y) > 0)
+    ## Replacement.
+    ##
     ## Copy the parts of s that aren't being replaced.  This is done
     ## with an index vector, with jumps where each search string
     ## is found.  For a jump of 0 (target length == replacement length)
     ## the index is just cumsum ( ones (length (s))).  For non-zero
     ## jumps, add the jump size to the ones vector at each found position.
     jump = length(y) - length(x);
-    if (jump > 0)     # s expands
+    if (jump > 0)
+      ## S expands.
       di = ones(size(s));
       di(ind) = 1 + jump * ones (length (ind), 1);
       t(cumsum (di)) = s;
@@ -67,7 +70,8 @@
       di = ones (jump * length (ind) + length (s), 1);
       di (ind + jump * [0:length(ind)-1]) = 1 - jump * ones(length(ind), 1);
       t = s (cumsum (di));
-    else              # s stays the same length
+    else
+      ## S stays the same length.
       t = s;
     endif
     ## Now, substitute a copy of the replacement string whereever the
@@ -78,7 +82,9 @@
     repeat = [1:length(y)]' * ones (1, length (ind));
     dest = ones (length (y), 1) * ind + repeat - 1;
     t(dest) = y(repeat);
-  else                        # deletion
+  else
+    ## Deletion.
+    ##
     ## Build an index vector of all locations where the target was found
     ## in the search string, and zap them. 
     t = toascii (s);
--- a/scripts/testfun/assert.m
+++ b/scripts/testfun/assert.m
@@ -67,7 +67,8 @@
   if (nargin == 1 || (nargin > 1 && islogical (cond) && ischar (varargin{1})))
     if (! isnumeric (cond) || ! all (cond(:)))
       if (nargin == 1)
-	error ("assert %s failed", in); # say which elements failed?
+	## Say which elements failed?
+	error ("assert %s failed", in);
       else
 	error (varargin{:});
       endif
@@ -144,10 +145,11 @@
       iserror = 1;
       coda = cstrcat ("Type ", typeinfo (cond), " != ", typeinfo (expected));
 
-    else # numeric
+    else
+      ## Numeric.
       A = cond(:);
       B = expected(:);
-      ## Check exceptional values
+      ## Check exceptional values.
       if (any (isna (A) != isna (B)))
 	iserror = 1;
 	coda = "NAs don't match";
@@ -160,7 +162,7 @@
 	iserror = 1;
 	coda = "Infs don't match";
       else
-	## Check normal values
+	## Check normal values.
 	A = A(finite (A));
 	B = B(finite (B));
 	if (tol == 0)
@@ -188,8 +190,8 @@
       return;
     endif
 
-    ## pretty print the "expected but got" info,
-    ## trimming leading and trailing "\n"
+    ## Pretty print the "expected but got" info, trimming leading and
+    ## trailing "\n".
     str = disp (expected);
     idx = find (str != "\n");
     if (! isempty (idx))
--- a/scripts/testfun/fail.m
+++ b/scripts/testfun/fail.m
@@ -75,20 +75,24 @@
   endif  
 
   if (test_warning)
-    ## perform the warning test
-    lastwarn ();  # clear old warnings
-    state = warning ("query", "quiet"); # make sure warnings are turned on
+    ## Perform the warning test.
+    ## Clear old warnings.
+    lastwarn ();
+    ## Make sure warnings are turned on.
+    state = warning ("query", "quiet");
     warning ("on", "quiet");
     try
       ## printf("lastwarn before %s: %s\n",code,lastwarn);
       evalin ("caller", sprintf ("%s;", code));
       ## printf("lastwarn after %s: %s\n",code,lastwarn);
-      err = lastwarn ();  # retrieve new warnings
+      ## Retrieve new warnings.
+      err = lastwarn ();
       warning (state.state, "quiet");
       if (isempty (err))
         msg = sprintf ("expected warning <%s> but got none", pattern); 
       else
-        err([1:9, end]) = [];  # transform "warning: ...\n" to "..."
+	## Transform "warning: ...\n" to "...".
+        err([1:9, end]) = [];
         if (! isempty (regexp (err, pattern, "once")))
 	  return;
 	endif
@@ -97,12 +101,13 @@
     catch
       warning (state.state, "quiet");
       err = lasterr;
-      err([1:7, end]) = [];  # transform "error: ...\n", to "..."
+      ## Transform "error: ...\n", to "...".
+      err([1:7, end]) = [];
       msg = sprintf ("expected warning <%s> but got error <%s>", pattern, err);
     end_try_catch
       
   else
-    ## perform the error test
+    ## Perform the error test.
     try
       evalin ("caller", sprintf ("%s;", code));
       msg = sprintf ("expected error <%s> but got none", pattern);
@@ -118,8 +123,9 @@
     end_try_catch
   endif
 
-  ## if we get here, then code didn't fail or error didn't match
+  ## If we get here, then code didn't fail or error didn't match.
   error (msg);
+
 endfunction
 
 %!fail ('[1,2]*[2,3]','nonconformant')
--- a/scripts/testfun/speed.m
+++ b/scripts/testfun/speed.m
@@ -169,7 +169,7 @@
 
   __numtests = 15;
 
-  ## Let user specify range of n
+  ## Let user specify range of n.
   if (isscalar (__max_n))
     __min_n = 1;
     assert (__max_n > __min_n);
@@ -182,14 +182,15 @@
   else
     __test_n = __max_n;
   endif
-  __test_n = unique (round (__test_n)); # Force n to be an integer
+  ## Force n to be an integer.
+  __test_n = unique (round (__test_n));
   assert (__test_n >= 1);
 
   __torig = __tnew = zeros (size (__test_n));
 
   disp (cstrcat ("testing ", __f1, "\ninit: ", __init));
 
-  ## make sure the functions are freshly loaded by evaluating them at
+  ## Make sure the functions are freshly loaded by evaluating them at
   ## test_n(1); first have to initialize the args though.
   n = 1;
   k = 0;
@@ -199,7 +200,7 @@
   endif
   eval (cstrcat (__f1, ";"));
 
-  ## run the tests
+  ## Run the tests.
   for k = 1:length (__test_n)
     n = __test_n(k);
     eval (cstrcat (__init, ";"));
@@ -227,7 +228,7 @@
     endif
   endfor
   
-  ## Drop times of zero
+  ## Drop times of zero.
   if (! isempty (__f2))
     zidx = (__tnew < 100*eps |  __torig < 100*eps);
     __test_n(zidx) = [];
@@ -239,7 +240,7 @@
     __tnew(zidx) = [];
   endif
 
-  ## Approximate time complexity and return it if requested
+  ## Approximate time complexity and return it if requested.
   tailidx = ceil(length(__test_n)/2):length(__test_n);
   p = polyfit (log (__test_n(tailidx)), log (__tnew(tailidx)), 1);
   if (nargout > 0) 
@@ -297,7 +298,7 @@
 
     loglog (__test_n(tailidx), exp(v)*1000, sprintf ("b;%s;", order)); 
 
-    ## Get base time to 1 digit of accuracy
+    ## Get base time to 1 digit of accuracy.
     dt = exp (p(2));
     dt = floor (dt/10^floor(log10(dt)))*10^floor(log10(dt));
     if (log10 (dt) >= -0.5)
--- a/scripts/testfun/test.m
+++ b/scripts/testfun/test.m
@@ -76,7 +76,7 @@
 ## PKG_ADD: mark_as_command test
 
 function [__ret1, __ret2, __ret3, __ret4] = test (__name, __flag, __fid)
-  ## information from test will be introduced by "key" 
+  ## Information from test will be introduced by "key".
   persistent __signal_fail =  "!!!!! ";
   persistent __signal_empty = "????? ";
   persistent __signal_block = "  ***** ";
@@ -101,7 +101,7 @@
   endif
   __batch = (! isempty (__fid));
 
-  ## decide if error messages should be collected
+  ## Decide if error messages should be collected.
   __close_fid = 0;
   if (__batch)
     if (ischar (__fid))
@@ -154,7 +154,7 @@
     error ("test unknown flag '%s'", __flag);
   endif
 
-  ## locate the file to test
+  ## Locate the file to test.
   __file = file_in_loadpath (__name, "all");
   if (isempty (__file))
     __file = file_in_loadpath (cstrcat (__name, ".m"), "all");
@@ -187,7 +187,7 @@
     return;
   endif
 
-  ## grab the test code from the file
+  ## Grab the test code from the file.
   __body = __extract_test_code (__file);
 
   if (isempty (__body))
@@ -206,7 +206,7 @@
     endif
     return;
   else
-    ## add a dummy comment block to the end for ease of indexing
+    ## Add a dummy comment block to the end for ease of indexing.
     if (__body (length(__body)) == "\n")
       __body = sprintf ("\n%s#", __body); 
     else
@@ -214,35 +214,35 @@
     endif
   endif
 
-  ## chop it up into blocks for evaluation
+  ## Chop it up into blocks for evaluation.
   __lineidx = find (__body == "\n");
   __blockidx = __lineidx(find (! isspace (__body(__lineidx+1))))+1;
 
-  ## ready to start tests ... if in batch mode, tell us what is happening
+  ## Ready to start tests ... if in batch mode, tell us what is happening.
   if (__verbose)
     disp (cstrcat ( __signal_file, __file));
   endif
 
-  ## assume all tests will pass
+  ## Assume all tests will pass.
   __all_success = 1;
 
-  ## process each block separately, initially with no shared variables
+  ## Process each block separately, initially with no shared variables.
   __tests = __successes = 0;
   __shared = " ";
   __shared_r = " ";
   __clear = "";
   for __i = 1:length(__blockidx)-1
 
-    ## extract the block
+    ## Extract the block.
     __block = __body(__blockidx(__i):__blockidx(__i+1)-2);
 
-    ## let the user/logfile know what is happening
+    ## Let the user/logfile know what is happening.
     if (__verbose)
       fprintf (__fid, "%s%s\n", __signal_block, __block);
       fflush (__fid);
     endif
 
-    ## split __block into __type and __code
+    ## Split __block into __type and __code.
     __idx = find (! isletter (__block));
     if (isempty (__idx))
       __type = __block;
@@ -252,15 +252,17 @@
       __code = __block(__idx(1):length(__block));
     endif
 
-    ## assume the block will succeed;
+    ## Assume the block will succeed.
     __success = 1;
     __msg = [];
 
-    ## DEMO
+### DEMO
+
     ## If in __grabdemo mode, then don't process any other block type.
     ## So that the other block types don't have to worry about
     ## this __grabdemo mode, the demo block processor grabs all block
     ## types and skips those which aren't demo blocks.
+
     __isdemo = strcmp (__type, "demo");
     if (__grabdemo || __isdemo)
       __istest = 0;
@@ -287,13 +289,15 @@
       	clear __test__;
 
       endif
-      __code = ""; # code already processed
+      ## Code already processed.
+      __code = "";
       
-    ## SHARED
-    elseif strcmp (__type, "shared")
+### SHARED
+
+    elseif (strcmp (__type, "shared"))
       __istest = 0;
 
-      ## separate initialization code from variables
+      ## Separate initialization code from variables.
       __idx = find (__code == "\n");
       if (isempty (__idx))
 	__vars = __code;
@@ -303,13 +307,13 @@
       	__code = __code (__idx(1):length(__code));
       endif
       
-      ## strip comments off the variables
+      ## Strip comments off the variables.
       __idx = find (__vars == "%" | __vars == "#");
       if (! isempty (__idx))
 	__vars = __vars(1:__idx(1)-1);
       endif
       
-      ## assign default values to variables
+      ## Assign default values to variables.
       try
 	__vars = deblank (__vars);
 	if (! isempty (__vars))
@@ -321,19 +325,21 @@
 	  __shared_r = " ";
       	endif
       catch
-	__code = "";  # couldn't declare, so don't initialize
+	## Couldn't declare, so don't initialize.
+	__code = "";
 	__success = 0;
 	__msg = sprintf ("%sshared variable initialization failed\n",
 		         __signal_fail);
       end_try_catch
 
-      ## clear shared function definitions
+      ## Clear shared function definitions.
       eval (__clear, "");
       __clear = "";
       
-      ## initialization code will be evaluated below
+      ## Initialization code will be evaluated below.
     
-    ## FUNCTION
+### FUNCTION
+
     elseif (strcmp (__type, "function"))
       __istest = 0;
       persistent __fn = 0;
@@ -356,14 +362,16 @@
       endif
       __code = "";
       
+### ASSERT/FAIL
 
-    ## ASSERT/FAIL
     elseif (strcmp (__type, "assert") || strcmp (__type, "fail"))
       __istest = 1;
-      __code = __block; # put the keyword back on the code
-      ## the code will be evaluated below as a test block
+      ## Put the keyword back on the code.
+      __code = __block;
+      ## The code will be evaluated below as a test block.
       
-    ## ERROR/WARNING
+### ERROR/WARNING
+
     elseif (strcmp (__type, "error") || strcmp(__type, "warning"))
       __istest = 1;
       __warning = strcmp (__type, "warning");
@@ -415,34 +423,40 @@
       	end_try_catch
       	clear __test__;
       endif
-      __code = ""; # code already processed
+      ## Code already processed.
+      __code = "";
       
-    ## TESTIF
+### TESTIF
+
     elseif (strcmp (__type, "testif"))
       [__e, __feat] = regexp (__code, '^\s*([^\s]+)', 'end', 'tokens');
       if (isempty (findstr (octave_config_info ("DEFS"), __feat{1}{1})))
         __xskip++;
 	__success = 0;
 	__istest = 0;
-	__code = ""; # skip the code
+	## Skip the code.
+	__code = "";
 	__msg = sprintf ("%sskipped test\n", __signal_skip);
       else
         __istest = 1;
 	__code = __code(__e + 1 : end);
       endif
 
-    ## TEST
+### TEST
+
     elseif (strcmp (__type, "test") || strcmp (__type, "xtest"))
       __istest = 1;
-      ## code will be evaluated below
-      
-    ## comment block
+      ## Code will be evaluated below.
+
+### Comment block.
+
     elseif (strcmp (__block(1:1), "#"))
       __istest = 0;
       __code = ""; # skip the code
 
+### Unknown block.
+
     else
-    ## unknown block
       __istest = 1;
       __success = 0;
       __msg = sprintf ("%sunknown test type!\n", __signal_fail);
@@ -470,16 +484,16 @@
       clear __test__;
     endif
     
-    ## All done.  Remember if we were successful and print any messages
+    ## All done.  Remember if we were successful and print any messages.
     if (! isempty (__msg))
-      ## make sure the user knows what caused the error
+      ## Make sure the user knows what caused the error.
       if (! __verbose)
       	fprintf (__fid, "%s%s\n", __signal_block, __block);
 	fflush (__fid);
       endif
       fputs (__fid, __msg);
       fflush (__fid);
-      ## show the variable context
+      ## Show the variable context.
       if (! strcmp (__type, "error") && ! strcmp (__type, "testif")
 	  && ! all (__shared == " "))
 	fputs (__fid, "shared variables ");
@@ -489,7 +503,7 @@
     endif
     if (__success == 0)
       __all_success = 0;
-      	## stop after one error if not in batch mode
+      ## Stop after one error if not in batch mode.
       if (! __batch)
     	if (nargout > 0)
 	  __ret1 = __ret2 = 0;
@@ -532,25 +546,25 @@
   endif
 endfunction
 
-## create structure with fieldnames the name of the input variables
+## Create structure with fieldnames the name of the input variables.
 function s = varstruct (varargin)
   for i = 1:nargin
     s.(deblank (argn(i,:))) = varargin{i};
   endfor
 endfunction
 
-## find [start,end] of fn in 'function [a,b] = fn'
+## Find [start,end] of fn in 'function [a,b] = fn'.
 function pos = function_name (def)
   pos = [];
 
-  ## Find the end of the name
+  ## Find the end of the name.
   right = find (def == "(", 1);
   if (isempty (right))
     return;
   endif
   right = find (def(1:right-1) != " ", 1, "last");
 
-  ## Find the beginning of the name
+  ## Find the beginning of the name.
   left = max ([find(def(1:right)==" ", 1, "last"), ...
 	       find(def(1:right)=="=", 1, "last")]);
   if (isempty (left))
@@ -558,11 +572,11 @@
   endif
   left++;
 
-  ## Return the end points of the name
+  ## Return the end points of the name.
   pos = [left, right];
 endfunction
 
-## strip <pattern> from '<pattern> code'
+## Strip <pattern> from '<pattern> code'.
 function [pattern, rest] = getpattern (str)
   pattern = ".";
   rest = str; 
@@ -576,7 +590,7 @@
   endif
 endfunction
 
-## strip '.*prefix:' from '.*prefix: msg\n' and strip trailing blanks
+## Strip '.*prefix:' from '.*prefix: msg\n' and strip trailing blanks.
 function msg = trimerr (msg, prefix)
   idx = index (msg, cstrcat (prefix, ":"));
   if (idx > 0)
@@ -585,7 +599,7 @@
   msg = trimleft (deblank (msg));
 endfunction
 
-## strip leading blanks from string
+## Strip leading blanks from string.
 function str = trimleft (str)
   idx = find (isspace (str));
   leading = find (idx == 1:length(idx));
@@ -594,8 +608,8 @@
   endif
 endfunction
 
-## make a structure out of the named variables
-## (based on Etienne Grossmann's tar function)
+## Make a structure out of the named variables
+## (based on Etienne Grossmann's tar function).
 function s = bundle (varargin)
   for i = 1:nargin
     s.(deblank (argn(i,:))) = varargin{i};
@@ -619,7 +633,7 @@
   endif
 endfunction
 
-## Test for test for missing features
+### Test for test for missing features
 %!testif OCTAVE_SOURCE
 %! ## This test should be run
 %! assert (true);
--- a/scripts/time/datestr.m
+++ b/scripts/time/datestr.m
@@ -187,7 +187,7 @@
     date{1} = t;
   endif
 
-  # guess, so we might be wrong
+  ## Guess, so we might be wrong.
   if (iscell (date) || columns (date) != 6)
     v = datevec (date, p);
   else
@@ -213,7 +213,7 @@
     if (isempty (f) || f == -1)
       if (v(i,4:6) == 0)
         f = 1;
-      #elseif (v(i,1:3) == [0, 1, 1])
+	## elseif (v(i,1:3) == [0, 1, 1])
       elseif (v(i,1:3) == [-1, 12, 31])
         f = 16;
       else
--- a/scripts/time/datevec.m
+++ b/scripts/time/datevec.m
@@ -73,7 +73,7 @@
     std_formats{++nfmt} = "mmm.dd.yyyy HH:MM:SS";
     std_formats{++nfmt} = "mmm.dd.yyyy";
 
-   # custom formats
+    ## Custom formats.
     std_formats{++nfmt} = "mmmyy";                  # 12
     std_formats{++nfmt} = "mm/dd/yyyy HH:MM";
   endif
@@ -186,10 +186,10 @@
 
 function [f, rY, ry, fy, fm, fd, fh, fmi, fs] = __date_vfmt2sfmt__ (f)
 
-  # Play safe with percent signs
+  ## Play safe with percent signs.
   f = strrep(f, "%", "%%");
 
-  ## dates to lowercase (note: we cannot convert MM to mm)
+  ## Dates to lowercase (note: we cannot convert MM to mm).
   f = strrep (f, "YYYY", "yyyy");
   f = strrep (f, "YY", "yy");
   f = strrep (f, "QQ", "qq");
@@ -198,13 +198,14 @@
   f = strrep (f, "DDDD", "dddd");
   f = strrep (f, "DDD", "ddd");
   f = strrep (f, "DD", "dd");
-  ## times to uppercase (also cannot convert mm to MM)
+  ## Times to uppercase (also cannot convert mm to MM).
   f = strrep (f, "hh", "HH");
   f = strrep (f, "ss", "SS");
   f = strrep (f, "pm", "PM");
   f = strrep (f, "am", "AM");
 
-  ## right now, the format string may only contain these tokens:
+  ## Right now, the format string may only contain these tokens:
+  ##
   ## yyyy   4 digit year
   ## yy     2 digit year
   ## mmmm   month name, full
@@ -225,7 +226,7 @@
     ampm = false;
   endif
 
-  # date part
+  ## Date part.
   f = strrep (f, "yyyy", "%Y");
   f = strrep (f, "yy", "%y");
   f = strrep (f, "mmmm", "%B");
@@ -235,7 +236,7 @@
   f = strrep (f, "ddd", "%a");
   f = strrep (f, "dd", "%d");
 
-  # time part
+  ## Time part.
   if (ampm)
     f = strrep (f, "HH", "%I");
     f = strrep (f, "PM", "%p");
@@ -249,8 +250,8 @@
   rY = rindex (f, "%Y");
   ry = rindex (f, "%y");
 
-  # check whether we need to give default values
-  # possible error when string contains "%%"
+  ## Check whether we need to give default values.
+  ## Possible error when string contains "%%".
   fy = rY || ry;
   fm = index (f, "%m") || index (f, "%b") || index (f, "%B");
   fd = index (f, "%d") || index (f, "%a") || index (f, "%A");
@@ -280,15 +281,15 @@
       endif
     endif
     if (! fy && ! fm && ! fd)
-      tvm = localtime (time ());  ## tvm: this very moment
-      y = tvm.year + 1900;
-      m = tvm.mon + 1;
-      d = tvm.mday;
+      tmp = localtime (time ());
+      y = tmp.year + 1900;
+      m = tmp.mon + 1;
+      d = tmp.mday;
     elseif (! fy && fm && fd)
-      tvm = localtime (time ());  ## tvm: this very moment
-      y = tvm.year + 1900;
+      tmp = localtime (time ());
+      y = tmp.year + 1900;
     elseif (fy && fm && ! fd)
-      tvm = localtime (time ());  ## tvm: this very moment
+      tmp = localtime (time ());
       d = 1;
     endif
     if (! fh && ! fmi && ! fs)