changeset 6116:b64fb24bf4a0

[project @ 2006-10-27 18:04:49 by jwe]
author jwe
date Fri, 27 Oct 2006 18:04:50 +0000
parents bade9ff1814b
children 45e37d4f324e
files ChangeLog Makeconf.in aclocal.m4 doc/ChangeLog doc/faq/Makefile.in doc/interpreter/Makefile.in doc/liboctave/Makefile.in libcruft/ChangeLog libcruft/mkf77def.in scripts/ChangeLog src/Cell.cc src/Cell.h src/ChangeLog src/dirfns.cc src/ov-base.h src/ov-cell.cc src/ov-cell.h src/ov.h src/sysdep.cc
diffstat 19 files changed, 176 insertions(+), 117 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Oct 27 17:58:06 2006 +0000
+++ b/ChangeLog	Fri Oct 27 18:04:50 2006 +0000
@@ -1,3 +1,16 @@
+2006-10-27  John W. Eaton  <jwe@octave.org>
+
+	* aclocal.m4 (OCTAVE_PROG_TEXI2PDF): Require OCTAVE_PROG_TEXI2DVI.
+	If texi2pdf is not found but texi2dvi is available, set TEXI2PDF
+	to "$TEXI2DVI --pdf".
+	(OCTAVE_PROG_GPERF, OCTAVE_PROG_GHOSTSCRIPT, OCTAVE_PROG_MAKEINFO,
+	OCTAVE_PROG_TEXI2DVI, OCTAVE_PROG_TEXI2PDF, OCTAVE_PROG_PERL,
+	OCTAVE_PROG_PYTHON, OCTAVE_PROG_DESKTOP_FILE_INSTALL): Simplify
+	calls to AC_CHECK_PROG.
+	(OCTAVE_PROG_GHOSTSCRIPT): Also check for gswin32 on Windows systems.
+	* Makeconf.in (UNSETCOMSPEC): Define if COMSPEC is defined.
+	From Michael Goffioul <michael.goffioul@swing.be>.
+
 2006-10-26  John W. Eaton  <jwe@octave.org>
 
 	* configure.in (OCTAVE_EXPORT, OCTAVE_IMPORT): New macros
--- a/Makeconf.in	Fri Oct 27 17:58:06 2006 +0000
+++ b/Makeconf.in	Fri Oct 27 18:04:50 2006 +0000
@@ -63,6 +63,14 @@
 TEXI2DVI = @TEXI2DVI@
 TEXI2PDF = @TEXI2PDF@
 
+# Both texi2dvi and texi2pdf check COMSPEC to decide what path
+# separator to use.  We build Octave with a Unixy shell, even on
+# Windows sytems, so we need to unset COMSPEC when invoking these
+# scripts.  Used in the doc/*/Makefiles.
+ifneq ($(COMSPEC),)
+  UNSETCOMSPEC = COMSPEC=
+endif
+
 GHOSTSCRIPT = @GHOSTSCRIPT@
 
 DEFAULT_PAGER = @DEFAULT_PAGER@
--- a/aclocal.m4	Fri Oct 27 17:58:06 2006 +0000
+++ b/aclocal.m4	Fri Oct 27 18:04:50 2006 +0000
@@ -538,7 +538,7 @@
 dnl
 dnl OCTAVE_PROG_GPERF
 AC_DEFUN(OCTAVE_PROG_GPERF, [
-  AC_CHECK_PROG(GPERF, gperf, gperf, [])
+  AC_CHECK_PROG(GPERF, gperf)
   if test -n "$GPERF"; then
     if echo "%{
 enum octave_kw_id { a_kw };
@@ -564,7 +564,15 @@
 dnl
 dnl OCTAVE_PROG_GHOSTSCRIPT
 AC_DEFUN(OCTAVE_PROG_GHOSTSCRIPT, [
-  AC_CHECK_PROG(GHOSTSCRIPT, gs, gs, [])
+  case "$canonical_host_type" in
+    *-*-cygwin* | *-*-mingw32* | *-*-msdosmsvc)
+      gs_names="gs gswin32"
+    ;;
+    *)
+      gs_names=gs
+    ;;
+  esac
+  AC_CHECK_PROGS(GHOSTSCRIPT, $gs_names)
   if test -z "$GHOSTSCRIPT"; then
     GHOSTSCRIPT='$(top_srcdir)/missing gs'
     warn_ghostscript="I didn't find ghostscript, but it's only a problem if you need to reconstruct figures for the manual"
@@ -577,7 +585,7 @@
 dnl
 dnl OCTAVE_PROG_MAKEINFO
 AC_DEFUN(OCTAVE_PROG_MAKEINFO, [
-  AC_CHECK_PROG(MAKEINFO, makeinfo, makeinfo, [])
+  AC_CHECK_PROG(MAKEINFO, makeinfo)
   if test -z "$MAKEINFO"; then
     MAKEINFO='$(top_srcdir)/missing makeinfo'
     warn_makeinfo="I didn't find makeinfo, but it's only a problem if you need to reconstruct the Info version of the manual"
@@ -590,7 +598,7 @@
 dnl
 dnl OCTAVE_PROG_TEXI2DVI
 AC_DEFUN(OCTAVE_PROG_TEXI2DVI, [
-  AC_CHECK_PROG(TEXI2DVI, texi2dvi, texi2dvi, [])
+  AC_CHECK_PROG(TEXI2DVI, texi2dvi)
   if test -z "$TEXI2DVI"; then
     TEXI2DVI='$(top_srcdir)/missing texi2dvi'
     warn_texi2dvi="I didn't find texi2dvi, but it's only a problem if you need to reconstruct the DVI version of the manual"
@@ -603,8 +611,18 @@
 dnl
 dnl OCTAVE_PROG_TEXI2PDF
 AC_DEFUN(OCTAVE_PROG_TEXI2PDF, [
-  AC_CHECK_PROG(TEXI2PDF, texi2pdf, texi2pdf, [])
+  AC_REQUIRE([OCTAVE_PROG_TEXI2DVI])
+  AC_CHECK_PROG(TEXI2PDF, texi2pdf)
   if test -z "$TEXI2PDF"; then
+    missing=true;
+    if test -n "$TEXI2DVI"; then
+      TEXI2PDF="$TEXI2DVI --pdf"
+      missing=false;
+    fi
+  else
+    missing=false;
+  fi
+  if $missing; then
     TEXI2PDF='$(top_srcdir)/missing texi2pdf'
     warn_texi2pdf="I didn't find texi2pdf, but it's only a problem if you need to reconstruct the PDF version of the manual"
     AC_MSG_WARN($warn_texi2pdf)
@@ -865,7 +883,7 @@
 dnl
 dnl OCTAVE_PROG_PERL
 AC_DEFUN(OCTAVE_PROG_PERL,
-[AC_CHECK_PROG(PERL, perl, perl, [])
+[AC_CHECK_PROG(PERL, perl)
   AC_SUBST(PERL)
 ])
 dnl
@@ -873,7 +891,7 @@
 dnl
 dnl OCTAVE_PROG_PYTHON
 AC_DEFUN(OCTAVE_PROG_PYTHON,
-[AC_CHECK_PROG(PYTHON, python, python, [])
+[AC_CHECK_PROG(PYTHON, python)
   AC_SUBST(PYTHON)
 ])
 dnl
@@ -881,7 +899,7 @@
 dnl
 dnl OCTAVE_PROG_DESKTOP_FILE_INSTALL
 AC_DEFUN(OCTAVE_PROG_DESKTOP_FILE_INSTALL,
-[AC_CHECK_PROG(DESKTOP_FILE_INSTALL, desktop-file-install, desktop-file-install, [])
+[AC_CHECK_PROG(DESKTOP_FILE_INSTALL, desktop-file-install)
   AC_SUBST(DESKTOP_FILE_INSTALL)
 ])
 dnl
--- a/doc/ChangeLog	Fri Oct 27 17:58:06 2006 +0000
+++ b/doc/ChangeLog	Fri Oct 27 18:04:50 2006 +0000
@@ -1,3 +1,14 @@
+2006-10-27  John W. Eaton  <jwe@octave.org>
+
+	* interpreter/Makefile.in (run-octave):
+	Unset DISPLAY while running Octave.
+	From Michael Goffioul <michael.goffioul@swing.be>.
+
+	* interpreter/Makefile.in (octave.dvi, octave.pdf):
+	Use $(UNSETCOMSPEC) in command.
+	* faq/Makefile.in (Octave-FAQ.dvi, Octave-FAQ.pdf): Likewise.
+	* liboctave/Makefile.in (liboctave.dvi, liboctave.pdf): Likewise.
+
 2006-10-09  Thomas Treichl <Thomas.Treichl@gmx.net>
 
 	* interpreter/sparseimages.m: Plot sombrero images if sparse
--- a/doc/faq/Makefile.in	Fri Oct 27 17:58:06 2006 +0000
+++ b/doc/faq/Makefile.in	Fri Oct 27 18:04:50 2006 +0000
@@ -42,13 +42,15 @@
 	-$(MAKEINFO) -I.. -I$(srcdir) -I$(srcdir)/.. $<
 
 Octave-FAQ.dvi: $(TEXINFO)
-	-TEXINPUTS="..:$(srcdir):$(srcdir)/..:$(TEXINPUTS):" $(TEXI2DVI) $<
+	-TEXINPUTS="..:$(srcdir):$(srcdir)/..:$(TEXINPUTS):" \
+	  $(UNSETCOMSPEC) $(TEXI2DVI) $<
 
 Octave-FAQ.ps: Octave-FAQ.dvi
 	-dvips -o $@ $<
 
 Octave-FAQ.pdf: $(TEXINFO)
-	-TEXINPUTS="..:$(srcdir):$(srcdir)/..:$(TEXINPUTS):" $(TEXI2PDF) $<
+	-TEXINPUTS="..:$(srcdir):$(srcdir)/..:$(TEXINPUTS):" \
+	  $(UNSETCOMSPEC) $(TEXI2PDF) $<
 
 HTML/index.html: $(TEXINFO)
 	-$(MAKEINFO) --html --ifinfo --output=HTML -I.. -I$(srcdir) -I$(srcdir)/.. $<
--- a/doc/interpreter/Makefile.in	Fri Oct 27 17:58:06 2006 +0000
+++ b/doc/interpreter/Makefile.in	Fri Oct 27 18:04:50 2006 +0000
@@ -110,13 +110,15 @@
 	-$(MAKEINFO) -I.. -I$(srcdir) -I$(srcdir)/.. $(MAIN_TEXINFO)
 
 octave.dvi: $(IMAGES_EPS) $(TEXINFO)
-	-TEXINPUTS="..:$(srcdir):$(srcdir)/..:$(TEXINPUTS):" $(TEXI2DVI) $(MAIN_TEXINFO)
+	-TEXINPUTS="..:$(srcdir):$(srcdir)/..:$(TEXINPUTS):" \
+	  $(UNSETCOMSPEC) $(TEXI2DVI) $(MAIN_TEXINFO)
 
 octave.ps: octave.dvi
 	-dvips -o $@ $<
 
 octave.pdf: $(IMAGES_PDF) $(TEXINFO)
-	-TEXINPUTS="..:$(srcdir):$(srcdir)/..:$(TEXINPUTS):" $(TEXI2PDF) $(MAIN_TEXINFO)
+	-TEXINPUTS="..:$(srcdir):$(srcdir)/..:$(TEXINPUTS):" \
+	  $(UNSETCOMSPEC) $(TEXI2PDF) $(MAIN_TEXINFO)
 
 ../../INSTALL.OCTAVE: install.texi
 	rm -f INSTALL
@@ -144,8 +146,10 @@
 	fi
 	$(INSTALL_DATA) $(filter-out html-dir, $<) HTML
 
+## Unset DISPLAY here to avoid problems with the -title option for
+## gnuplot (it doesn't work if we are calling pgnuplot).
 define run-octave
-  $(TOPDIR)/run-octave -f -q -H -p $(srcdir) \
+  DISPLAY= $(TOPDIR)/run-octave -f -q -H -p $(srcdir) \
     --eval "$(notdir $(basename $<)) ('$(notdir $(basename $@))', '$(patsubst .%,%, $(suffix $@))')"
 endef
 
--- a/doc/liboctave/Makefile.in	Fri Oct 27 17:58:06 2006 +0000
+++ b/doc/liboctave/Makefile.in	Fri Oct 27 18:04:50 2006 +0000
@@ -50,13 +50,15 @@
 	-$(MAKEINFO) -I.. -I$(srcdir) -I$(srcdir)/.. $<
 
 liboctave.dvi: $(TEXINFO)
-	-TEXINPUTS="..:$(srcdir):$(srcdir)/..:$(TEXINPUTS):" $(TEXI2DVI) $<
+	-TEXINPUTS="..:$(srcdir):$(srcdir)/..:$(TEXINPUTS):" \
+	  $(UNSETCOMSPEC) $(TEXI2DVI) $<
 
 liboctave.ps: liboctave.dvi
 	-dvips -o $@ $<
 
 liboctave.pdf: $(TEXINFO)
-	-TEXINPUTS="..:$(srcdir):$(srcdir)/..:$(TEXINPUTS):" $(TEXI2PDF) $<
+	-TEXINPUTS="..:$(srcdir):$(srcdir)/..:$(TEXINPUTS):" \
+	  $(UNSETCOMSPEC) $(TEXI2PDF) $<
 
 HTML/index.html: $(TEXINFO)
 	-$(MAKEINFO) --html --ifinfo --output=HTML -I.. -I$(srcdir) -I$(srcdir)/.. $<
--- a/libcruft/ChangeLog	Fri Oct 27 17:58:06 2006 +0000
+++ b/libcruft/ChangeLog	Fri Oct 27 18:04:50 2006 +0000
@@ -1,3 +1,10 @@
+2006-10-27  John W. Eaton  <jwe@octave.org>
+
+	* mkf77def.in: Downcase all input to simplify matching.
+	Match only lines beginning with whitespace.
+	Match function return types.
+	From Michael Goffioul <michael.goffioul@swing.be>.
+
 2006-10-26  Michael Goffioul  <michael.goffioul@swing.be>
 
 	* Makefile.in (XTRA_CRUFT_LINK_DEPS): Substitute.
--- a/libcruft/mkf77def.in	Fri Oct 27 17:58:06 2006 +0000
+++ b/libcruft/mkf77def.in	Fri Oct 27 18:04:50 2006 +0000
@@ -25,5 +25,7 @@
   awkcmd="$AWK '{ printf (\"%s%s\n\", tolower (\$0), \"$uscore\"); }'"
 fi
 
-$SED -n -e 's/^[ \t]*\([Ff][Uu][Nn][Cc][Tt][Ii][Oo][Nn]\|[Ss][Uu][Bb][Rr][Oo][Uu][Tt][Ii][Nn][Ee]\|[Ee][Nn][Tt][Rr][Yy]\)[ \t]*\([^ \t(]*\).*$/\2/p' | \
+$SED -n \
+  -e 'y/ABCDEFGHIJLKMNOPQRSTUVWXYZ/abcdefghijlkmnopqrstuvwxyz/' \
+  -e 's/^\(      \|\t\)[ \t]*\(.*function\|subroutine\|entry\)[ \t]*\([^ \t(]*\).*$/\3/p' | \
   eval $awkcmd
--- a/scripts/ChangeLog	Fri Oct 27 17:58:06 2006 +0000
+++ b/scripts/ChangeLog	Fri Oct 27 18:04:50 2006 +0000
@@ -1,3 +1,8 @@
+2006-10-27  John W. Eaton  <jwe@octave.org>
+
+	* miscellaneous/ls.m, miscellaneous/ls_command.m: New files.
+	* miscellaneous/dir.m: Mark as a command.
+
 2006-10-27  William Poetra Yoga Hadisoeseno  <williampoetra@gmail.com>
 
 	* miscellaneous/unpack.m: Fix missing comma in strcat call.
--- a/src/Cell.cc	Fri Oct 27 17:58:06 2006 +0000
+++ b/src/Cell.cc	Fri Oct 27 18:04:50 2006 +0000
@@ -56,6 +56,52 @@
     }
 }
 
+// Set size to DV, filling with [].  Then fill with as many elements of
+// SV as possible.
+Cell::Cell (const dim_vector& dv, const string_vector& sv, bool trim)
+  : ArrayN<octave_value> (dv)
+{
+  octave_idx_type n = sv.length ();
+
+  if (n > 0)
+    {
+      octave_idx_type m = numel ();
+
+      octave_idx_type len = n > m ? m : n;
+
+      for (octave_idx_type i = 0; i < len; i++)
+	{
+	  std::string s = sv[i];
+
+	  if (trim)
+	    {
+	      size_t pos = s.find_last_not_of (' ');
+
+	      s = (pos == NPOS) ? "" : s.substr (0, pos+1);
+	    }
+
+	  elem(i) = s;
+	}
+    }
+}
+
+bool
+Cell::is_cellstr (void) const
+{
+  bool retval = true;
+
+  for (int i = 0; i < numel (); i++)
+    {
+      if (! elem(i).is_string ())
+	{
+	  retval = false;
+	  break;
+	}
+    }
+
+  return retval;
+}
+
 Cell
 Cell::index (const octave_value_list& idx_arg, bool resize_ok) const
 {
--- a/src/Cell.h	Fri Oct 27 17:58:06 2006 +0000
+++ b/src/Cell.h	Fri Oct 27 18:04:50 2006 +0000
@@ -67,9 +67,13 @@
 
   Cell (const string_vector& sv, bool trim = false);
 
+  Cell (const dim_vector& dv, const string_vector& sv, bool trim = false);
+
   Cell (const Cell& c)
     : ArrayN<octave_value> (c) { }
 
+  bool is_cellstr (void) const;
+
   Cell index (const octave_value_list& idx, bool resize_ok = false) const;
 
   Cell index (idx_vector& i, int resize_ok = 0,
--- a/src/ChangeLog	Fri Oct 27 17:58:06 2006 +0000
+++ b/src/ChangeLog	Fri Oct 27 18:04:50 2006 +0000
@@ -1,5 +1,18 @@
 2006-10-27  John W. Eaton  <jwe@octave.org>
 
+	* dirfns.cc (Fls, cleanup_iprocstream): Delete.
+
+	* sysdep.cc (Ftilde_expand): If arg is cellstr, return cellstr.
+
+	* ov.h (octave_value::is_cellstr): New function.
+	* ov-base.h (octave_base_value::is_cellstr): New function.
+	* ov-cell.h (octave_cell::is_cellstr): New function.
+	* ov-cell.cc (Fiscellstr): Implement with is_cellstr.
+	* Cell.cc (Cell::Cell (const dim_vector&, const string_vector&, bool)): 
+	New constructor.
+	(Cell::is_cellstr): New function.
+	* Cell.h: Provide decls.
+
 	* defaults.cc (subst_octave_home): If dir_sep_char is not '/',
 	replace before returning.
 	From Michael Goffioul <michael.goffioul@swing.be>.
--- a/src/dirfns.cc	Fri Oct 27 17:58:06 2006 +0000
+++ b/src/dirfns.cc	Fri Oct 27 18:04:50 2006 +0000
@@ -142,80 +142,6 @@
 
 DEFALIAS (chdir, cd);
 
-// Get a directory listing.
-
-static void
-cleanup_iprocstream (void *p)
-{
-  delete static_cast <iprocstream *> (p);
-}
-
-DEFCMD (ls, args, nargout,
-  "-*- texinfo -*-\n\
-@deffn {Command} ls options\n\
-List directory contents.  For example,\n\
-\n\
-@example\n\
-ls -l\n\
-     @print{} total 12\n\
-     @print{} -rw-r--r--   1 jwe  users  4488 Aug 19 04:02 foo.m\n\
-     @print{} -rw-r--r--   1 jwe  users  1315 Aug 17 23:14 bar.m\n\
-@end example\n\
-\n\
-The @code{dir} and @code{ls} commands are implemented by calling your\n\
-system's directory listing command, so the available options may vary\n\
-from system to system.\n\
-@seealso{dir, stat, readdir, glob, filesep}\n\
-@end deffn")
-{
-  octave_value retval;
-
-  int argc = args.length () + 1;
-
-  string_vector argv = args.make_argv ("ls");
-
-  if (error_state)
-    return retval;
-
-  std::ostringstream ls_buf;
-
-  ls_buf << "ls -C ";
-  for (int i = 1; i < argc; i++)
-    ls_buf << file_ops::tilde_expand (argv[i]) << " ";
-
-  iprocstream *cmd = new iprocstream (ls_buf.str ());
-
-  unwind_protect::add (cleanup_iprocstream, cmd);
-
-  if (cmd && *cmd)
-    {
-      char ch;
-
-      std::ostringstream output_buf;
-
-      for (;;)
-	{
-	  if (cmd->get (ch))
-	    output_buf << ch;
-	  else
-	    break;
-	}
-
-      std::string output = output_buf.str ();
-
-      if (nargout > 0)
-	retval = output;
-      else
-	octave_stdout << output;
-    }
-  else
-    error ("couldn't start process for ls!");
-
-  unwind_protect::run ();
-
-  return retval;
-}
-
 DEFUN (pwd, , nargout,
   "-*- texinfo -*-\n\
 @deftypefn {Built-in Function} {} pwd ()\n\
--- a/src/ov-base.h	Fri Oct 27 17:58:06 2006 +0000
+++ b/src/ov-base.h	Fri Oct 27 18:04:50 2006 +0000
@@ -195,6 +195,8 @@
 
   virtual bool is_cell (void) const { return false; }
 
+  virtual bool is_cellstr (void) const { return false; }
+
   virtual bool is_real_scalar (void) const { return false; }
 
   virtual bool is_real_matrix (void) const { return false; }
--- a/src/ov-cell.cc	Fri Oct 27 17:58:06 2006 +0000
+++ b/src/ov-cell.cc	Fri Oct 27 18:04:50 2006 +0000
@@ -1014,32 +1014,7 @@
   octave_value retval;
 
   if (args.length () == 1)
-    {
-      retval = true;
-
-      octave_value arg = args (0);
-
-      if (arg.is_cell ())
-	{
-	  Cell c = args(0).cell_value ();
-
-	  if (! error_state)
-	    {
-	      for (int i = 0; i < c.length (); i++)
-		{
-		  if (! c(i).is_string ())
-		    {
-		      retval = false;
-		      break;
-		    }
-		}
-	    }
-	  else
-	    retval = false;
-	}
-      else
-	retval = false;
-    }
+    retval = args(0).is_cellstr ();
   else
     print_usage ();
 
--- a/src/ov-cell.h	Fri Oct 27 17:58:06 2006 +0000
+++ b/src/ov-cell.h	Fri Oct 27 18:04:50 2006 +0000
@@ -97,6 +97,8 @@
 
   bool is_cell (void) const { return true; }
 
+  bool is_cellstr (void) const { return matrix.is_cellstr (); }
+
   Cell cell_value (void) const { return matrix; }
 
   octave_value_list list_value (void) const;
--- a/src/ov.h	Fri Oct 27 17:58:06 2006 +0000
+++ b/src/ov.h	Fri Oct 27 18:04:50 2006 +0000
@@ -386,6 +386,9 @@
   bool is_cell (void) const
     { return rep->is_cell (); }
 
+  bool is_cellstr (void) const
+    { return rep->is_cellstr (); }
+
   bool is_real_scalar (void) const
     { return rep->is_real_scalar (); }
 
--- a/src/sysdep.cc	Fri Oct 27 17:58:06 2006 +0000
+++ b/src/sysdep.cc	Fri Oct 27 18:04:50 2006 +0000
@@ -775,7 +775,23 @@
   int nargin = args.length ();
 
   if (nargin == 1)
-    retval = file_ops::tilde_expand (args(0).all_strings ());
+    {
+      octave_value arg = args(0);
+
+      string_vector sv = arg.all_strings ();
+
+      if (! error_state)
+	{
+	  sv = file_ops::tilde_expand (sv);
+
+	  if (arg.is_cellstr ())
+	    retval = Cell (arg.dims (), sv);
+	  else
+	    retval = sv;
+	}
+      else
+	error ("tilde_expand: expecting argument to be char or cellstr object");
+    }
   else
     print_usage ();