changeset 3476:78e1e0007f0f

[project @ 2000-01-26 00:05:43 by jwe]
author jwe
date Wed, 26 Jan 2000 00:05:45 +0000
parents 6293a9d5650a
children 4b79cb009dd4
files scripts/ChangeLog scripts/plot/xlabel.m scripts/plot/ylabel.m scripts/plot/zlabel.m src/ChangeLog src/pt-plot.cc src/variables.cc
diffstat 7 files changed, 38 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Tue Jan 25 21:23:09 2000 +0000
+++ b/scripts/ChangeLog	Wed Jan 26 00:05:45 2000 +0000
@@ -1,5 +1,11 @@
 2000-01-25  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
+	* plot/__axis_label__.m: New function.
+	Undo string escapes in text twice(!) before sending to gnuplot.
+	* plot/xlabel.m: Use it.
+	* plot/ylabel.m: Ditto.
+	* plot/zlabel.m: Ditto.
+
 	* plot/mesh.m: Fix error message to reflect reality.
 
 2000-01-24  Cyril Humbert <humbert@phobos.univ-mlv.fr>
--- a/scripts/plot/xlabel.m	Tue Jan 25 21:23:09 2000 +0000
+++ b/scripts/plot/xlabel.m	Wed Jan 26 00:05:45 2000 +0000
@@ -30,17 +30,8 @@
 
 ## Author: jwe
 
-function xlabel (text)
-
-  if (nargin != 1)
-    usage ("xlabel (text)");
-  endif
+function xlabel (...)
 
-  if (isstr (text))
-    command = sprintf ("gset xlabel \"%s\"", text);
-    eval (command);
-  else
-    error ("xlabel: text must be a string");
-  endif
+  __axis_label__ ("xlabel", all_va_args);
 
 endfunction
--- a/scripts/plot/ylabel.m	Tue Jan 25 21:23:09 2000 +0000
+++ b/scripts/plot/ylabel.m	Wed Jan 26 00:05:45 2000 +0000
@@ -24,17 +24,8 @@
 
 ## Author: jwe
 
-function ylabel (text)
-
-  if (nargin != 1)
-    usage ("ylabel (text)");
-  endif
+function ylabel (...)
 
-  if (isstr (text))
-    command = sprintf ("gset ylabel \"%s\"", text);
-    eval (command);
-  else
-    error ("ylabel: text must be a string");
-  endif
+  __axis_label__ ("ylabel", all_va_args);
 
 endfunction
--- a/scripts/plot/zlabel.m	Tue Jan 25 21:23:09 2000 +0000
+++ b/scripts/plot/zlabel.m	Wed Jan 26 00:05:45 2000 +0000
@@ -26,16 +26,8 @@
 ## Created: 3 July 95
 ## Adapted-By: jwe
 
-function zlabel (text)
-
-  if (nargin != 1)
-    usage ("zlabel (text)");
-  endif
+function zlabel (...)
 
-  if (isstr (text))
-    eval (sprintf ("gset zlabel \"%s\"", text));
-  else
-    error ("error: zlabel: text must be a string");
-  endif
+  __axis_label__ ("zlabel", all_va_args);
 
 endfunction
--- a/src/ChangeLog	Tue Jan 25 21:23:09 2000 +0000
+++ b/src/ChangeLog	Wed Jan 26 00:05:45 2000 +0000
@@ -1,3 +1,10 @@
+2000-01-25  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* variables.cc (Fexist): Return 6 for built-in constants.
+
+	* pt-plot.cc (Fgshow): Don't append " " after last arg.
+	(Fgset): Likewise.
+
 2000-01-23  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* ov-base-mat.h (octave_base_matrix::length): Return 0 for empty
--- a/src/pt-plot.cc	Tue Jan 25 21:23:09 2000 +0000
+++ b/src/pt-plot.cc	Wed Jan 26 00:05:45 2000 +0000
@@ -1120,16 +1120,23 @@
 	{
 	  delete [] gnuplot_terminal_type;
 	  ostrstream buf;
-	  for (int i = 2; i < argc; i++)
+	  int i;
+	  for (i = 2; i < argc-1; i++)
 	    buf << argv[i] << " ";
+	  if (i < argc)
+	    buf << argv[i];
 	  buf << Vgnuplot_command_end << ends;
 	  gnuplot_terminal_type = buf.str ();
 	}
     }
 
-  for (int i = 0; i < argc; i++)
+  int i;
+  for (i = 0; i < argc-1; i++)
     plot_buf << argv[i] << " ";
 
+  if (i < argc)
+    plot_buf << argv[i];
+
   plot_buf << Vgnuplot_command_end << ends;
 
   char *plot_command = plot_buf.str ();
@@ -1165,8 +1172,11 @@
 
   ostrstream plot_buf;
 
-  for (int i = 0; i < argc; i++)
+  int i;
+  for (i = 0; i < argc-1; i++)
     plot_buf << argv[i] << " ";
+  if (i < argc)
+    plot_buf << argv[i];
 
   plot_buf << Vgnuplot_command_end << ends;
 
--- a/src/variables.cc	Tue Jan 25 21:23:09 2000 +0000
+++ b/src/variables.cc	Wed Jan 26 00:05:45 2000 +0000
@@ -411,8 +411,8 @@
 @deftypefn {Built-in Function} {} exist (@var{name})\n\
 Return 1 if the name exists as a variable, 2 if the name (after\n\
 appending @samp{.m}) is a function file in the path, 3 if the name is a\n\
-@samp{.oct} file in the path, or 5 if the name is a built-in function.\n\
-Otherwise, return 0.\n\
+@samp{.oct} file in the path, 5 if the name is a built-in function, or\n\
+6 is the name is a built-in constant.  Otherwise, return 0.\n\
 \n\
 This function also returns 2 if a regular file called @var{name}\n\
 exists in Octave's @code{LOADPATH}.  If you want information about\n\
@@ -465,6 +465,10 @@
     {
       retval = 5.0;
     }
+  else if (sr && sr->is_builtin_constant ())
+    {
+      retval = 6.0;
+    }
   else if (sr && sr->is_user_function ())
     {
       retval = 2.0;