changeset 4229:40153a2affd6

[project @ 2002-12-18 20:37:32 by jwe]
author jwe
date Wed, 18 Dec 2002 20:37:32 +0000
parents 309e799edc5a
children 1feaee8df4ff
files ChangeLog configure.in liboctave/ChangeLog liboctave/Makefile.in mkoctfile.in scripts/ChangeLog scripts/general/int2str.m scripts/general/num2str.m src/ChangeLog src/Makefile.in src/pt-check.cc src/pt-check.h test/octave.test/string/int2str-1.m test/octave.test/string/num2str-1.m test/octave.test/string/num2str-3.m
diffstat 15 files changed, 99 insertions(+), 32 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Wed Dec 18 18:10:13 2002 +0000
+++ b/ChangeLog	Wed Dec 18 20:37:32 2002 +0000
@@ -1,9 +1,7 @@
 2002-12-18  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
-	* mkoctfile.in: Also define LIBKPATHSEA and include it when
-	linking stand alone files.  Define LIBOCTAVE, LIBOCTINTERP,
-	LIBCRUFT, LIBREADLINE, and LIBKPATHSEA using -lLIB.
-	Include $LIBOCTINTERP in the stand alone link command.
+	* mkoctfile.in: Include $LIBOCTINTERP in the stand alone link command.
+	Define LIBOCTAVE, LIBOCTINTERP, LIBCRUFT, LIBREADLINE using -lLIB.
 
 2002-12-17  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
--- a/configure.in	Wed Dec 18 18:10:13 2002 +0000
+++ b/configure.in	Wed Dec 18 20:37:32 2002 +0000
@@ -22,7 +22,7 @@
 ### 02111-1307, USA. 
 
 AC_INIT
-AC_REVISION($Revision: 1.398 $)
+AC_REVISION($Revision: 1.399 $)
 AC_PREREQ(2.52)
 AC_CONFIG_SRCDIR([src/octave.cc])
 AC_CONFIG_HEADER(config.h)
@@ -136,6 +136,9 @@
 AC_SUBST(LIBPLPLOT)
 AC_SUBST(PLPLOT_DIR)
 
+### Don't change the definition of LIBKPATHSEA without understanding
+### the way it is used in liboctave/Makefile.
+
 LIBKPATHSEA='$(TOPDIR)/kpathsea/libkpathsea.$(LIBEXT)'
 AC_SUBST(LIBKPATHSEA)
 
--- a/liboctave/ChangeLog	Wed Dec 18 18:10:13 2002 +0000
+++ b/liboctave/ChangeLog	Wed Dec 18 20:37:32 2002 +0000
@@ -1,3 +1,8 @@
+2002-12-18  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* Makefile.in (liboctave.$(SHLEXT)): Include $(LIBKPATHSEA) here.
+	(LINK_DEPS): Not here.
+
 2002-12-06  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* str-vec.cc (string_vector::compare): New static member function.
--- a/liboctave/Makefile.in	Wed Dec 18 18:10:13 2002 +0000
+++ b/liboctave/Makefile.in	Wed Dec 18 20:37:32 2002 +0000
@@ -22,7 +22,7 @@
   LINK_DEPS = \
     -L../libcruft -L../kpathsea -L../glob -L. $(RLD_FLAG) \
     $(LIBCRUFT) $(BLAS_LIBS) $(FFTW_LIBS) $(LIBREADLINE) \
-    -lglob $(LIBS) $(LIBKPATHSEA) $(FLIBS)
+    -lglob $(LIBS) $(FLIBS)
 endif
 
 MATRIX_INC := Array.h Array2.h Array3.h ArrayN.h DiagArray2.h Array-flags.h \
@@ -210,18 +210,27 @@
 endif
 .PHONY: libraries
 
-liboctave.$(LIBEXT): $(LIBOCTAVE_OBJECTS)
+libkpathsea-target:
+	$(MAKE) -C ../kpathsea
+.PHONY: libkpathsea-target
+
+liboctave.$(LIBEXT): $(LIBOCTAVE_OBJECTS) libkpathsea-target
 	rm -f $@
-	$(TEMPLATE_AR) $(TEMPLATE_ARFLAGS) $@ $^
+	rm -rf kpse-tmp
+	mkdir kpse-tmp
+	( cd kpse-tmp; $(AR) x ../$(LIBKPATHSEA) )
+	$(TEMPLATE_AR) $(TEMPLATE_ARFLAGS) $@ $(LIBOCTAVE_OBJECTS) kpse-tmp/*.o
+	rm -rf kpse-tmp
 	$(RANLIB) $@
 
 liboctave.$(SHLEXT_VER): liboctave.$(SHLEXT)
 	rm -f $@
 	$(LN_S) $< $@
 
-liboctave.$(SHLEXT): $(LIBOCTAVE_PICOBJ)
+liboctave.$(SHLEXT): $(LIBOCTAVE_PICOBJ) libkpathsea-target
 	rm -f $@
-	$(SH_LD) $(SH_LDFLAGS) $(SONAME_FLAGS) -o $@ $^ $(LINK_DEPS)
+	$(SH_LD) $(SH_LDFLAGS) $(SONAME_FLAGS) -o $@ \
+	$(LIBOCTAVE_PICOBJ) $(LINK_DEPS) $(LIBKPATHSEA) 
 
 $(LIBOCTAVE_PICOBJ): stmp-pic
 
--- a/mkoctfile.in	Wed Dec 18 18:10:13 2002 +0000
+++ b/mkoctfile.in	Wed Dec 18 20:37:32 2002 +0000
@@ -39,7 +39,6 @@
 : ${LIBOCTAVE=-loctave}
 : ${LIBOCTINTERP=-loctinterp}
 : ${LIBREADLINE=-lreadline}
-: ${LIBKPATHSEA=-lkpathsea}
 : ${LIBCRUFT=-lcruft}
 : ${BLAS_LIBS=%OCTAVE_CONF_BLAS_LIBS%}
 : ${FFTW_LIBS=%OCTAVE_CONF_FFTW_LIBS%}
@@ -379,7 +378,7 @@
 if $link; then
   if $link_stand_alone; then
     if [ -n "$LD_CXX" ]; then
-      cmd="$LD_CXX $CPPFLAGS $ALL_CXXFLAGS $RDYNAMIC_FLAG $ALL_LDFLAGS $output_option $objfiles $ldflags $LFLAGS $RLD_FLAG $OCTAVE_LIBS $BLAS_LIBS $FFTW_LIBS $LIBREADLINE $LIBKPATHSEA $LIBS $FLIBS"
+      cmd="$LD_CXX $CPPFLAGS $ALL_CXXFLAGS $RDYNAMIC_FLAG $ALL_LDFLAGS $output_option $objfiles $ldflags $LFLAGS $RLD_FLAG $OCTAVE_LIBS $BLAS_LIBS $FFTW_LIBS $LIBREADLINE $LIBS $FLIBS"
       $dbg $cmd
       eval $cmd
     else
--- a/scripts/ChangeLog	Wed Dec 18 18:10:13 2002 +0000
+++ b/scripts/ChangeLog	Wed Dec 18 20:37:32 2002 +0000
@@ -1,3 +1,9 @@
+2002-12-18  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* general/int2str.m: Handle matrices.
+	* general/num2str.m: Likewise.
+	Also handle optional precision, and format args.
+
 2002-12-17  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* audio/Makefile.in, control/base/Makefile.in,
--- a/scripts/general/int2str.m	Wed Dec 18 18:10:13 2002 +0000
+++ b/scripts/general/int2str.m	Wed Dec 18 20:37:32 2002 +0000
@@ -19,7 +19,8 @@
 
 ## -*- texinfo -*-
 ## @deftypefn {Function File} {} int2str (@var{n})
-## @deftypefnx {Function File} {} num2str (@var{x})
+## @deftypefnx {Function File} {} num2str (@var{x}, @var{precision})
+## @deftypefnx {Function File} {} num2str (@var{x}, @var{format})
 ## Convert a number to a string.  These functions are not very flexible,
 ## but are provided for compatibility with @sc{Matlab}.  For better control
 ## over the results, use @code{sprintf} (@pxref{Formatted Output}).
@@ -33,11 +34,13 @@
   ## XXX FIXME XXX -- this will fail for very large values.
 
   if (nargin == 1)
-    if (rows (x) == 1 && columns (x) == 1)
-      retval = sprintf ("%d", round (x));
-    else
-      error ("int2str: expecting scalar argument");
-    endif
+    x = round (x);
+    fw = max (log10 (abs (x(:))) + 3);
+    fmt = sprintf ("%%%dd", fw);
+    fmt = strcat (repmat (fmt, 1, columns (x)), "\n");
+    tmp = sprintf (fmt, round (x.'));
+    tmp(length (tmp)) = "";
+    retval = split (tmp, "\n");
   else
     usage ("int2str (x)");
   endif
--- a/scripts/general/num2str.m	Wed Dec 18 18:10:13 2002 +0000
+++ b/scripts/general/num2str.m	Wed Dec 18 20:37:32 2002 +0000
@@ -19,7 +19,8 @@
 
 ## -*- texinfo -*-
 ## @deftypefn {Function File} {} int2str (@var{n})
-## @deftypefnx {Function File} {} num2str (@var{x})
+## @deftypefnx {Function File} {} num2str (@var{x}, @var{precision})
+## @deftypefnx {Function File} {} num2str (@var{x}, @var{format})
 ## Convert a number to a string.  These functions are not very flexible,
 ## but are provided for compatibility with @sc{Matlab}.  For better control
 ## over the results, use @code{sprintf} (@pxref{Formatted Output}).
@@ -28,16 +29,28 @@
 
 ## Author: jwe
 
-function retval = num2str (x)
+function retval = num2str (x, arg)
 
-  if (nargin == 1)
-    if (rows (x) == 1 && columns (x) == 1)
-      retval = sprintf ("%g", x);
+  if (nargin == 1 || nargin == 2)
+    if (nargin == 2)
+      if (isstr (arg))
+	fmt = arg;
+      else
+	fmt = sprintf ("%%.%dg", arg);
+      endif
     else
-      error ("num2str: expecting scalar argument");
+      fmt = "%11.4g";
+    endif
+    if (iscomplex (x))
+      error ("num2str: sorry, can't handle complex numbers yet");
+    else
+      fmt = strcat (repmat (fmt, 1, columns (x)), "\n");
+      tmp = sprintf (fmt, x.');
+      tmp(length (tmp)) = "";
+      retval = split (tmp, "\n");
     endif
   else
-    usage ("num2str (x)");
+    usage ("num2str (x) or num2str (x, precision) or num2str (x, fmt)");
   endif
 
 endfunction
--- a/src/ChangeLog	Wed Dec 18 18:10:13 2002 +0000
+++ b/src/ChangeLog	Wed Dec 18 20:37:32 2002 +0000
@@ -1,3 +1,14 @@
+2002-12-18  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* Makefile.in: No need to add $(LIBKPATHSEA) to LINK_DEPS, since
+	it is not included in liboctave.
+
+2002-12-18  JD Cole <jdcole@san.rr.com>
+
+	* pt-check.cc (tree_checker::visit_subplot_axes,
+	tree_checker::visit_do_until_command): New functions.
+	* pt-check.h: Provide decl.
+
 2002-12-17  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* variables.cc (Fclear): Fix off-by-one error.
--- a/src/Makefile.in	Wed Dec 18 18:10:13 2002 +0000
+++ b/src/Makefile.in	Wed Dec 18 20:37:32 2002 +0000
@@ -191,10 +191,6 @@
   $(SPECIAL_MATH_LIB) $(LIBCRUFT) \
   $(LIBPLPLOT) $(LIBGLOB) $(LIBDLFCN)
 
-ifneq ($INCLUDE_LINK_DEPS), true)
-OCTAVE_LIBS += $(LIBKPATHSEA)
-endif
-
 ifeq ($(INCLUDE_LINK_DEPS),true)
   OCTINTERP_LINK_DEPS = \
     -L../liboctave $(LIBOCTAVE) -L../libcruft $(LIBCRUFT) $(FLIBS)
--- a/src/pt-check.cc	Wed Dec 18 18:10:13 2002 +0000
+++ b/src/pt-check.cc	Wed Dec 18 20:37:32 2002 +0000
@@ -481,6 +481,11 @@
 }
 
 void
+tree_checker::visit_subplot_axes (subplot_axes& cmd)
+{
+}
+
+void
 tree_checker::visit_subplot_list (subplot_list& lst)
 {
   subplot_list::iterator p = lst.begin ();
@@ -618,6 +623,20 @@
 }
 
 void
+tree_checker::visit_do_until_command (tree_do_until_command& cmd)
+{
+  tree_statement_list *list = cmd.body ();
+
+  if (list)
+    list->accept (*this);
+
+  tree_expression *expr = cmd.condition ();
+
+  if (expr)
+    expr->accept (*this);
+}
+
+void
 tree_checker::gripe (const std::string& msg, int line)
 {
   if (curr_fcn_file_name.empty ())
--- a/src/pt-check.h	Wed Dec 18 18:10:13 2002 +0000
+++ b/src/pt-check.h	Wed Dec 18 20:37:32 2002 +0000
@@ -107,6 +107,8 @@
 
   void visit_subplot (subplot&);
 
+  void visit_subplot_axes (subplot_axes&);
+
   void visit_subplot_list (subplot_list&);
 
   void visit_subplot_style (subplot_style&);
@@ -125,6 +127,8 @@
 
   void visit_while_command (tree_while_command&);
 
+  void visit_do_until_command (tree_do_until_command&);
+
 private:
 
   bool do_lvalue_check;
--- a/test/octave.test/string/int2str-1.m	Wed Dec 18 18:10:13 2002 +0000
+++ b/test/octave.test/string/int2str-1.m	Wed Dec 18 20:37:32 2002 +0000
@@ -1,1 +1,1 @@
-strcmp (int2str (-123), "-123") && strcmp (int2str (1.2), "1")
+strcmp (int2str (-123), " -123") && strcmp (int2str (1.2), "  1")
--- a/test/octave.test/string/num2str-1.m	Wed Dec 18 18:10:13 2002 +0000
+++ b/test/octave.test/string/num2str-1.m	Wed Dec 18 20:37:32 2002 +0000
@@ -1,1 +1,2 @@
-strcmp (num2str (123), "123") && strcmp (num2str (1.23), "1.23")
+(strcmp (num2str (123), "        123")
+ && strcmp (num2str (1.23), "       1.23"))
--- a/test/octave.test/string/num2str-3.m	Wed Dec 18 18:10:13 2002 +0000
+++ b/test/octave.test/string/num2str-3.m	Wed Dec 18 20:37:32 2002 +0000
@@ -1,1 +1,1 @@
-num2str (1, 2)
+num2str (1, 2, 3)