changeset 2520:a034dcdbc282

[project @ 1996-11-15 04:57:21 by jwe]
author jwe
date Fri, 15 Nov 1996 04:59:08 +0000
parents 6914eab16f0b
children 19b33e933eae
files ChangeLog NEWS PROJECTS emacs/octave.el scripts/ChangeLog scripts/plot/axis.m scripts/plot/bottom_title.m scripts/plot/contour.m scripts/plot/figure.m scripts/plot/grid.m scripts/plot/loglog.m scripts/plot/mesh.m scripts/plot/mplot.m scripts/plot/multiplot.m scripts/plot/oneplot.m scripts/plot/plot.m scripts/plot/plot_border.m scripts/plot/polar.m scripts/plot/semilogx.m scripts/plot/semilogy.m scripts/plot/subplot.m scripts/plot/subwindow.m scripts/plot/title.m scripts/plot/top_title.m scripts/plot/xlabel.m scripts/plot/ylabel.m scripts/plot/zlabel.m scripts/signal/filter.m src/ChangeLog src/pt-plot.cc
diffstat 30 files changed, 136 insertions(+), 222 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 Thu Nov 14 00:07:31 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* emacs/octave.el (octave-text-functions): Change set and show to
+	gset and gshow.
+
 	* Makeconf.in (TEXI2DVI): Define to be our own private version.
 
 	* texi2dvi: New file.
--- a/NEWS
+++ b/NEWS
@@ -1,6 +1,14 @@
 Summary of changes for version 2.0:
 ----------------------------------
 
+  * The set and show commands for setting and displaying gnuplot
+    parameters have been replaced by gset and gshow.  This change will
+    probably break lots of things, but it is necessary to allow for
+    compatibility with the Matlab graphics and GUI commands in a
+    future version of Octave.  (For now, the old set and show commands
+    do work, but they print an annoying warning message to try to get
+    people to switch to using gset.)
+
   * New data types can be added to Octave by writing a C++ class.  On
     systems that support dynamic linking, new data types can be added
     to an already running Octave binary.  A simple example appears in
--- a/PROJECTS
+++ b/PROJECTS
@@ -194,6 +194,18 @@
 Interpreter:
 -----------
 
+  * Fix the grammar to allow structure references and index operations
+    for for anonymous expressions.  For example, it should be possible
+    to write
+
+      localtime (time ()) . hour;
+
+    to get the current hour.  Likewise, it should be possible to write
+
+      svd (A) (1:13);
+
+    to extract the first 13 singular values of the matrix A.
+
   * Consider grouping all preference variables in a structure instead
     of further polluting the namespace.  Maybe `Octave_options.xxx'?
 
--- a/emacs/octave.el
+++ b/emacs/octave.el
@@ -264,7 +264,7 @@
 (defvar octave-text-functions
   '("casesen" "cd" "chdir" "clear" "diary" "dir" "document" "echo"
     "edit_history" "format" "help" "history" "hold" "load" "ls" "more"
-    "run_history" "save" "set" "show" "type" "which" "who" "whos")
+    "run_history" "save" "gset" "gshow" "type" "which" "who" "whos")
   "Octave text functions (these names are also reserved.")
 
 (defvar octave-variables
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,5 +1,13 @@
 Thu Nov 14 00:06:34 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* plot/axis.m, plot/bottom_title.m, plot/contour.m,
+	plot/figure.m, plot/grid.m, plot/loglog.m, plot/mesh.m,
+	plot/mplot.m, plot/multiplot.m, plot/oneplot.m, plot/plot.m,
+	plot/plot_border.m, plot/polar.m, plot/semilogx.m,
+	plot/semilogy.m, plot/subplot.m, plot/subwindow.m, plot/title.m,
+	plot/top_title.m, plot/xlabel.m, plot/ylabel.m, plot/zlabel.m:
+	Uset gset, not set.
+
 	* Version 1.92.
 
 Thu Nov  7 12:43:12 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
--- a/scripts/plot/axis.m
+++ b/scripts/plot/axis.m
@@ -47,7 +47,7 @@
   endif
 
   if (nargin == 0)
-    set autoscale;
+    gset autoscale;
     curr_axis = __current_axis__;
   elseif (is_vector (ax))
 
@@ -60,15 +60,15 @@
     __current_axis__ = reshape (ax, 1, len);
 
     if (len > 1)
-      eval (sprintf ("set xrange [%g:%g];", ax (1), ax (2)));
+      eval (sprintf ("gset xrange [%g:%g];", ax (1), ax (2)));
     endif
 
     if (len > 3)
-      eval (sprintf ("set yrange [%g:%g];", ax (3), ax (4)));
+      eval (sprintf ("gset yrange [%g:%g];", ax (3), ax (4)));
     endif
 
     if (len > 5)
-      eval (sprintf ("set zrange [%g:%g];", ax (5), ax (6)));
+      eval (sprintf ("gset zrange [%g:%g];", ax (5), ax (6)));
     endif
 
   else
--- a/scripts/plot/bottom_title.m
+++ b/scripts/plot/bottom_title.m
@@ -40,9 +40,9 @@
   endif
 
   if (isstr (text))
-    set top_title;
-    set title;
-    eval (sprintf ("set bottom_title \"%s\"", text));
+    gset top_title;
+    gset title;
+    eval (sprintf ("gset bottom_title \"%s\"", text));
   else
     error ("bottom_title: text must be a string");
   endif
--- a/scripts/plot/contour.m
+++ b/scripts/plot/contour.m
@@ -33,13 +33,13 @@
 
   if (nargin == 1 || nargin == 2)
     if (is_matrix (z))
-      set nosurface;
-      set contour;
-      set cntrparam bspline;
-      command = sprintf ("set cntrparam levels %d", n);
+      gset nosurface;
+      gset contour;
+      gset cntrparam bspline;
+      command = sprintf ("gset cntrparam levels %d", n);
       eval (command);
-      set noparametric;
-      set view 0, 0, 1.9, 1;
+      gset noparametric;
+      gset view 0, 0, 1.9, 1;
       gsplot z w l 1;
     else
       error ("mesh: argument must be a matrix");
@@ -61,13 +61,13 @@
           zz(:,i+2) = z(:,k);
           k++;
         endfor
-        set nosurface;
-        set contour;
-        set cntrparam bspline;
+        gset nosurface;
+        gset contour;
+        gset cntrparam bspline;
         command = sprintf ("set cntrparam levels %d", n);
         eval (command);
-	set parametric;
-        set view 0, 0, 1.9, 1;
+	gset parametric;
+        gset view 0, 0, 1.9, 1;
 	gsplot zz w l 1;
       else
         msg = "mesh: rows (z) must be the same as length (x) and";
--- a/scripts/plot/figure.m
+++ b/scripts/plot/figure.m
@@ -29,7 +29,7 @@
   if (nargin == 1)
     if (gnuplot_has_frames)
       if (! isempty (getenv ("DISPLAY")))
-	eval (sprintf ("set term x11 %d\n", n));
+	eval (sprintf ("gset term x11 %d\n", n));
       else
 	error ("figure: requires X11 and valid DISPLAY");
       endif
--- a/scripts/plot/grid.m
+++ b/scripts/plot/grid.m
@@ -31,13 +31,13 @@
 function grid (x)
 
   if (nargin == 0)
-    set grid;
+    gset grid;
   elseif (nargin == 1)
     if (isstr (x))
       if (strcmp ("off", x))
-        set nogrid;
+        gset nogrid;
       elseif (strcmp ("on", x))
-        set grid;
+        gset grid;
       else
     usage ("grid (\"on\" | \"off\")");
       endif
--- a/scripts/plot/loglog.m
+++ b/scripts/plot/loglog.m
@@ -33,9 +33,9 @@
 
 function loglog (...)
 
-  set logscale x;
-  set logscale y;
-  set nopolar;
+  gset logscale x;
+  gset logscale y;
+  gset nopolar;
 
   __plt__ ("loglog", all_va_args);
 
--- a/scripts/plot/mesh.m
+++ b/scripts/plot/mesh.m
@@ -35,12 +35,12 @@
   if (nargin == 1)
     z = x;
     if (is_matrix (z))
-      set hidden3d;
-      set data style lines;
-      set surface;
-      set nocontour;
-      set noparametric;
-      set view 60, 30, 1, 1
+      gset hidden3d;
+      gset data style lines;
+      gset surface;
+      gset nocontour;
+      gset noparametric;
+      gset view 60, 30, 1, 1
       gsplot (z');
     else
       error ("mesh: argument must be a matrix");
@@ -62,12 +62,12 @@
           zz(:,i+2) = z(:,k);
           k++;
         endfor
-	set hidden3d;
-	set data style lines;
-        set surface;
-        set nocontour;
-	set parametric;
-        set view 60, 30, 1, 1
+	gset hidden3d;
+	gset data style lines;
+        gset surface;
+        gset nocontour;
+	gset parametric;
+        gset view 60, 30, 1, 1
 	gsplot (zz);
       else
         msg = "mesh: rows (z) must be the same as length (x) and";
@@ -88,12 +88,12 @@
           zz(:,i+2) = z(:,k);
           k++;
         endfor
-	set hidden3d;
-	set data style lines;
-        set surface;
-        set nocontour;
-	set parametric;
-        set view 60, 30, 1, 1
+	gset hidden3d;
+	gset data style lines;
+        gset surface;
+        gset nocontour;
+	gset parametric;
+        gset view 60, 30, 1, 1
 	gsplot (zz);
       else
         error ("mesh: x, y, and z must have same dimensions");
--- a/scripts/plot/mplot.m
+++ b/scripts/plot/mplot.m
@@ -57,8 +57,8 @@
     automatic_replot = 0;
   endif
 
-  set nologscale;
-  set nopolar;
+  gset nologscale;
+  gset nopolar;
 
   __plt__ ("plot", all_va_args);
 
@@ -80,7 +80,7 @@
     xo = (multiplot_xi - 1.0)*multiplot_xsize;
     yo = (multiplot_yn - multiplot_yi)*multiplot_ysize;
 
-    eval (sprintf ("set origin %g, %g", xo,yo));
+    eval (sprintf ("gset origin %g, %g", xo,yo));
 
   endif
 
--- a/scripts/plot/multiplot.m
+++ b/scripts/plot/multiplot.m
@@ -69,9 +69,9 @@
 
   if (xn == 0 && yn == 0)
 
-    set nomultiplot;
-    set size 1, 1;
-    set origin 0, 0;
+    gset nomultiplot;
+    gset size 1, 1;
+    gset origin 0, 0;
 
     multiplot_mode = 0;
     multiplot_xsize = 1;
@@ -95,17 +95,17 @@
       error ("multiplot: xn and yn have to be positive integers");
     endif
 
-    set multiplot;
+    gset multiplot;
 
     xsize = 1.0 ./ xn;
     ysize = 1.0 ./ yn;
 
-    eval (sprintf ("set size %g, %g", xsize, ysize));
+    eval (sprintf ("gset size %g, %g", xsize, ysize));
 
     xo = 0.0;
     yo = (yn - 1.0)*ysize;
 
-    eval (sprintf ("set origin %g, %g", xo, yo));
+    eval (sprintf ("gset origin %g, %g", xo, yo));
 
     multiplot_mode = 1;
     multiplot_xsize = xsize;
--- a/scripts/plot/oneplot.m
+++ b/scripts/plot/oneplot.m
@@ -37,9 +37,9 @@
 
   global multiplot_mode
 
-  set nomultiplot;
-  set size 1, 1;
-  set origin 0, 0;
+  gset nomultiplot;
+  gset size 1, 1;
+  gset origin 0, 0;
   multiplot_mode = 0;
 
 endfunction
--- a/scripts/plot/plot.m
+++ b/scripts/plot/plot.m
@@ -65,8 +65,8 @@
 
 function plot (...)
 
-  set nologscale;
-  set nopolar;
+  gset nologscale;
+  gset nopolar;
 
   __plt__ ("plot", all_va_args);
 
--- a/scripts/plot/plot_border.m
+++ b/scripts/plot/plot_border.m
@@ -91,14 +91,14 @@
   endwhile
 
   if (none)
-    set noborder;
+    gset noborder;
   else
     if (all)
       border = 15;
     else
       border = south + west + north + east;
     endif
-    eval (sprintf ("set border %d", border));
+    eval (sprintf ("gset border %d", border));
   endif
 
 endfunction
--- a/scripts/plot/polar.m
+++ b/scripts/plot/polar.m
@@ -30,8 +30,8 @@
 
 function polar (x1, x2, fmt)
 
-  set nologscale;
-  set nopolar;
+  gset nologscale;
+  gset nopolar;
 
   if (nargin == 3)
     if (isstr (fmt))
--- a/scripts/plot/semilogx.m
+++ b/scripts/plot/semilogx.m
@@ -33,9 +33,9 @@
 
 function semilogx (...)
 
-  set logscale x;
-  set nologscale y;
-  set nopolar;
+  gset logscale x;
+  gset nologscale y;
+  gset nopolar;
 
   __plt__ ("semilogx", all_va_args);
 
--- a/scripts/plot/semilogy.m
+++ b/scripts/plot/semilogy.m
@@ -33,9 +33,9 @@
 
 function semilogy (...)
 
-  set nologscale x;
-  set logscale y;
-  set nopolar;
+  gset nologscale x;
+  gset logscale y;
+  gset nopolar;
 
   __plt__ ("semilogy", all_va_args);
 
--- a/scripts/plot/subplot.m
+++ b/scripts/plot/subplot.m
@@ -117,9 +117,9 @@
 
     ## switching to single plot ?
 
-    set nomultiplot;
-    set size 1, 1;
-    set origin 0, 0;
+    gset nomultiplot;
+    gset size 1, 1;
+    gset origin 0, 0;
 
     multiplot_xn = 1;
     multiplot_yn = 1;
@@ -152,9 +152,9 @@
       multiplot_xsize = 1.0 ./ columns;
       multiplot_ysize = 1.0 ./ rows;
 
-      set multiplot;
+      gset multiplot;
 
-      eval (sprintf ("set size %g, %g", multiplot_xsize, multiplot_ysize));
+      eval (sprintf ("gset size %g, %g", multiplot_xsize, multiplot_ysize));
 
     endif
 
@@ -170,7 +170,7 @@
     xo = (xp - 1.0)*multiplot_xsize;
     yo = (rows - yp)*multiplot_ysize;
 
-    eval (sprintf ("set origin %g, %g", xo, yo));
+    eval (sprintf ("gset origin %g, %g", xo, yo));
 
   endif
 
--- a/scripts/plot/subwindow.m
+++ b/scripts/plot/subwindow.m
@@ -74,6 +74,6 @@
   xo = (xn - 1.0)*multiplot_xsize;
   yo = (multiplot_yn - yn)*multiplot_ysize;
 
-  eval (sprintf ("set origin %g, %g", xo, yo));
+  eval (sprintf ("gset origin %g, %g", xo, yo));
 
 endfunction
--- a/scripts/plot/title.m
+++ b/scripts/plot/title.m
@@ -34,7 +34,7 @@
   endif
 
   if (isstr (text))
-    command = sprintf ("set title \"%s\"", text);
+    command = sprintf ("gset title \"%s\"", text);
     eval (command);
   else
     error ("title: text must be a string");
--- a/scripts/plot/top_title.m
+++ b/scripts/plot/top_title.m
@@ -39,9 +39,9 @@
   endif
 
   if (isstr (text))
-    set bottom_title;
-    set title;
-    eval (sprintf ("set top_title \"%s\"", text));
+    gset bottom_title;
+    gset title;
+    eval (sprintf ("gset top_title \"%s\"", text));
   else
     error ("error: top_title: text must be a string");
   endif
--- a/scripts/plot/xlabel.m
+++ b/scripts/plot/xlabel.m
@@ -34,7 +34,7 @@
   endif
 
   if (isstr (text))
-    command = sprintf ("set xlabel \"%s\"", text);
+    command = sprintf ("gset xlabel \"%s\"", text);
     eval (command);
   else
     error ("xlabel: text must be a string");
--- a/scripts/plot/ylabel.m
+++ b/scripts/plot/ylabel.m
@@ -34,7 +34,7 @@
   endif
 
   if (isstr (text))
-    command = sprintf ("set ylabel \"%s\"", text);
+    command = sprintf ("gset ylabel \"%s\"", text);
     eval (command);
   else
     error ("ylabel: text must be a string");
--- a/scripts/plot/zlabel.m
+++ b/scripts/plot/zlabel.m
@@ -35,7 +35,7 @@
   endif
 
   if (isstr (text))
-    eval (sprintf ("set zlabel \"%s\"", text));
+    eval (sprintf ("gset zlabel \"%s\"", text));
   else
     error ("error: zlabel: text must be a string");
   endif
deleted file mode 100644
--- a/scripts/signal/filter.m
+++ /dev/null
@@ -1,135 +0,0 @@
-function [y, w] = filter(b,a,x,w)
-
-# Filter a vector.
-# y = filter(b,a,x) returns the solution to the following linear,
-# time-invariant difference equation:
-# 
-#    N                   M
-#   sum a(k+1) y(n-k) = sum b(k+1) x(n-k)            for 1<=n<=length(x)
-#   k=0                 k=0
-# 
-# where N=length(a)-1 and M=length(b)-1. An equivalent form of this
-# equation is:
-# 
-#             N                   M
-#   y(n) = - sum c(k+1) y(n-k) + sum d(k+1) x(n-k)   for 1<=n<=length(x)
-#            k=1                 k=0				     
-# 				  
-# where c = a/a(1) and d = b/a(1).
-# 
-# In terms of the z-transform, y is the result of passing the discrete-
-# time signal x through a system characterized by the following rational
-# system function:							
-# 									
-#              M
-#             sum d(k+1) z^(-k)
-#             k=0	       
-#   H(z) = ----------------------
-#                N
-#           1 + sum c(k+1) z^(-k)
-#               k=1
-# 
-# [y, sf] = filter(b,a,x,si) sets the initial state of the system, si,
-# and returns the final state, sf.  The state vector is a column vector
-# whose length is equal to the length of the longest coefficient vector
-# minus one.  If si is not set, the initial state vector is set to all
-# zeros.
-# 
-# The particular algorithm employed is known as a transposed Direct
-# Form II implementation.
-# 
-# SEE ALSO: poly, roots, conv, deconv, residue, polyval, polyderiv, polyinteg
-
-# Written by Tony Richardson <amr@mpl.ucsd.edu> June 1994.
-
-# Bug fix by FL (Friedrich.Leisch@ci.tuwien.ac.at) on Oct 12, 1994
-
-  if(nargin < 3 || nargin > 4)
-    error("usage: [y, sf] = filter(b,a,x[,si])");
-  endif
-
-  if(is_matrix(a) || is_matrix(b) || is_matrix(x))
-    error("Argument must be a vector.");
-  endif
-
-  N = length(a);
-  M = length(b);
-  L = length(x);
-
-  MN = max([N, M]);
-  lw = MN - 1;
-
-  # It's convenient to pad the coefficient vectors to the same length.
-  b = postpad(b,MN);
-
-  # Ensure that all vectors have the assumed dimension.
-  if(columns(a) > 1)
-    a = reshape(a,N,1);
-  endif
-  if(columns(b) > 1)
-    b = reshape(b,MN,1);
-  endif
-
-  if(nargin == 3)
-    # Set initial state to zero.
-    w = zeros(lw,1);
-  else
-    if(is_matrix(w) || length(w) != lw)
-      error("state vector has the wrong dimensions.");
-    endif
-    if(columns(w) > 1)
-      w = reshape(w,lw,1);
-    endif
-  endif
-
-  # Allocate space for result.
-  y = zeros(1,L);
-
-  norm = a(1);
-  if (norm == 0.)
-    error("First element in second argument must be non-zero.");
-  endif
-
-  if (norm != 1.)
-    b = b/norm;
-  endif
-
-  # Distinguish between IIR and FIR cases.  The IIR code can easily be made
-  # to  work for both cases, but the FIR code is slightly faster when it can
-  # be used.
-
-  if (N > 1)
-    # IIR filter.
-    a = postpad(a,MN);
-    if (norm != 1.)
-      a = a/norm;
-    endif
-    for index = 1:L
-      y(index) = w(1) + b(1)*x(index);
-      # Update state vector
-      if(lw > 1)
-        w(1:(lw-1)) = w(2:lw) - a(2:lw)*y(index) + b(2:lw)*x(index);
-        w(lw) = b(MN)*x(index) - a(MN) * y(index);
-      else
-        w(1) = b(MN)*x(index) - a(MN) * y(index);
-      endif
-    endfor
-  else
-    # FIR filter.
-    if(lw > 0)
-      for index = 1:L
-        y(index) = w(1) + b(1)*x(index);
-        if ( lw > 1)
-          # Update state vector
-          w(1:lw-1) = w(2:lw) + b(2:lw)*x(index);
-          w(lw) = b(MN)*x(index);
-        else
-          w(1) = b(2)*x(index);
-        endif
-      endfor
-    else
-      # Handle special case where there is no delay separately.
-      y = b(1)*x;
-    endif
-  endif
-endfunction
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,9 @@
 Thu Nov 14 00:06:19 1996  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* pt-plot.cc (Fgset, Fgshow): New commands.
+	(Fshow): Print warning and call gshow.
+	(Fset): Print warning and call gset.
+
 	* variables.cc (parse_fcn_file): Add unwind-protect for file
 	pointer, so the file is always closed.
 	(get_help_from_file): Likewise.
--- a/src/pt-plot.cc
+++ b/src/pt-plot.cc
@@ -987,10 +987,10 @@
   return retval;
 }
 
-DEFUN_TEXT (set, args, ,
-  "set [options]\n\
+DEFUN_TEXT (gset, args, ,
+  "gset [options]\n\
 \n\
-set plotting options")
+set plotting options for gnuplot")
 {
   octave_value_list retval;
 
@@ -1033,8 +1033,15 @@
   return retval;
 }
 
-DEFUN_TEXT (show, args, ,
-  "show [options]\n\
+DEFUN_TEXT (set, args, nargout,
+  "This command is has been replaced by `gset'.")
+{
+  warning ("set is obsolete -- use gset instead")
+  return Fgset (args, nargout);
+}
+
+DEFUN_TEXT (gshow, args, ,
+  "gshow [options]\n\
 \n\
 show plotting options")
 {
@@ -1062,6 +1069,13 @@
   return retval;
 }
 
+DEFUN_TEXT (show, args, nargout,
+  "This command is has been replaced by `gshow'.")
+{
+  warning ("show is obsolete -- use gshow instead")
+  return Fgshow (args, nargout);
+}
+
 static int
 automatic_replot (void)
 {