Mercurial > hg > octave-lyh
changeset 3189:bef7b73c0724
[project @ 1998-10-16 18:05:26 by jwe]
author | jwe |
---|---|
date | Fri, 16 Oct 1998 18:05:31 +0000 |
parents | df7c57a6639d |
children | 70eb3f4136cd |
files | ChangeLog NEWS doc/ChangeLog doc/faq/Makefile.in doc/interpreter/Makefile.in doc/interpreter/basics.texi doc/interpreter/io.texi doc/interpreter/system.texi doc/interpreter/var.texi doc/liboctave/Makefile.in emacs/octave-inf.el libcruft/ChangeLog liboctave/ChangeLog liboctave/LSODE.cc liboctave/LSODE.h liboctave/chMatrix.cc liboctave/chMatrix.h liboctave/cmd-edit.cc liboctave/cmd-edit.h src/ChangeLog src/DLD-FUNCTIONS/rand.cc src/input.cc src/lex.h src/lex.l src/load-save.cc src/oct-procbuf.cc src/oct-procbuf.h src/octave.cc src/ov-ch-mat.h src/ov-str-mat.h src/ov.cc src/ov.h src/parse.y src/procstream.cc src/procstream.h src/pt-loop.cc src/pt-plot.cc |
diffstat | 37 files changed, 339 insertions(+), 88 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Fri Oct 2 14:23:59 1998 Kurt Hornik <Kurt.Hornik@ci.tuwien.ac.at> + + * octave-inf.el (inferior-octave-prompt): Also match prompts of + the form `octave.bin:1>' which come from using precopiled binary + versions. + Thu Sep 24 13:51:03 1998 John W. Eaton <jwe@bevo.che.wisc.edu> * configure.in (AC_OUTPUT): Add libcruft/ordered-qz to the list.
--- a/NEWS +++ b/NEWS @@ -4,6 +4,11 @@ * If fread is given a skip parameter, the skip is performed after the read instead of before (for compatibility with Matlab). + * The new built-in variable `crash_dumps_octave_core' controls + whether Octave writes user variables to the file `octave-core' + when it crashes or is killed by a signal. The default value is 1 + (0 if you use --traditional). + * Running `make check' should work now before you run `make install', even if you build a copy of Octave that depends on shared versions of the Octave libraries.
--- a/doc/ChangeLog +++ b/doc/ChangeLog @@ -1,3 +1,8 @@ +Fri Oct 9 00:27:33 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * faq/Makefile.in, interpreter/Makefile.in, liboctave/Makefile.in: + New rules for generating HTML files from Texinfo sources. + Thu May 14 21:04:40 1998 John W. Eaton <jwe@bevo.che.wisc.edu> * interpreter/Makefile.in (../../BUGS, ../../INSTALL): Add
--- a/doc/faq/Makefile.in +++ b/doc/faq/Makefile.in @@ -22,7 +22,7 @@ TEXINFO := Octave-FAQ.texi -FORMATTED := Octave-FAQ.info Octave-FAQ.dvi Octave-FAQ.ps +FORMATTED := Octave-FAQ.info Octave-FAQ.dvi Octave-FAQ.ps Octave-FAQ_toc.html DISTFILES := Makefile.in $(TEXINFO) $(FORMATTED) @@ -35,7 +35,7 @@ sed -e 's/@@/ at /g' -e 's/@[a-zA-Z]*//g' $< | spell > $@.tmp mv $@.tmp $@ -all: Octave-FAQ.info Octave-FAQ.dvi Octave-FAQ.ps +all: Octave-FAQ.info Octave-FAQ.dvi Octave-FAQ.ps Octave-FAQ_toc.html .PHONY: all Octave-FAQ.info: Octave-FAQ.texi @@ -49,6 +49,9 @@ Octave-FAQ.ps: Octave-FAQ.dvi -dvips -o Octave-FAQ.ps Octave-FAQ.dvi +Octave-FAQ_toc.html: + -texi2html -split_chapter $(srcdir)/Octave-FAQ.texi + check install install-strip uninstall: .PHONY: check install install-strip uninstall @@ -73,8 +76,9 @@ .PHONY: distclean maintainer-clean: distclean - rm -f tags TAGS Octave-FAQ.info Octave-FAQ.info-* \ - Octave-FAQ.dvi Octave-FAQ.ps + rm -f tags TAGS Octave-FAQ.info Octave-FAQ.info-* + rm -f Octave-FAQ.dvi Octave-FAQ.ps + rm -f Octave-FAQ_*.html .PHONY: maintainer-clean dist: all
--- a/doc/interpreter/Makefile.in +++ b/doc/interpreter/Makefile.in @@ -30,7 +30,7 @@ strings.texi struct.texi system.texi tips.texi var.texi \ vr-idx.texi -FORMATTED = octave.dvi octave.ps octave.info octave.info-[0-9]* +FORMATTED = octave.dvi octave.ps octave.info octave.info-[0-9]* octave_*.html DISTFILES = Makefile.in dir octave.1 $(TEXINFO) $(FORMATTED) @@ -52,7 +52,7 @@ sed -e 's/@@/ at /g' -e 's/@[a-zA-Z]*//g' $< | spell > $@.tmp mv $@.tmp $@ -all: octave.info octave.dvi octave.ps +all: octave.info octave.dvi octave.ps octave_toc.html .PHONY: all octave.info: $(TEXINFO) ../conf.texi @@ -80,6 +80,9 @@ -I$(srcdir) -I$(srcdir)/.. $(srcdir)/bugs.texi mv BUGS ../../BUGS +octave_toc.html: + -texi2html -split_chapter -I$(srcdir)/.. $(srcdir)/octave.texi + check: all .PHONY: check @@ -148,7 +151,8 @@ .PHONY: distclean maintainer-clean: distclean - rm -f tags TAGS octave.info octave.info-* octave.dvi octave.ps \ + rm -f tags TAGS octave.info octave.info-* octave.dvi octave.ps + rm -f octave_*.html .PHONY: maintainer-clean dist: all
--- a/doc/interpreter/basics.texi +++ b/doc/interpreter/basics.texi @@ -157,6 +157,7 @@ default_save_format = "mat-binary" define_all_return_values = 1 do_fortran_indexing = 1 +crash_dumps_octave_core = 0 empty_list_elements_ok = 1 implicit_str_to_num_ok = 1 ok_to_lose_imaginary_part = 1
--- a/doc/interpreter/io.texi +++ b/doc/interpreter/io.texi @@ -379,7 +379,14 @@ the file @file{data} in Octave's binary format. @end deffn -There are two variables that modify the behavior of @code{save}. +There are two variables that modify the behavior of @code{save} and one +that controls whether variables are saved when Octave exits unexpectedly. + +@defvr {Built-in Variable} crash_dumps_octave_core +If this variable is set to a nonzero value, Octave tries to save all +current variables the the file "octave-core" if it crashes or receives a +hangup, terminate or similar signal. The default value is 1. +@end defvr @defvr {Built-in Variable} default_save_format This variable specifies the default format for the @code{save} command.
--- a/doc/interpreter/system.texi +++ b/doc/interpreter/system.texi @@ -1023,12 +1023,6 @@ Return the current working directory. @end deftypefn -@defvr {Built-in Variable} PWD -The current working directory. The value of @code{PWD} is updated each -time the current working directory is changed with the @samp{cd} -command. -@end defvr - @deffn {Command} ls options @deffnx {Command} dir options List directory contents. For example,
--- a/doc/interpreter/var.texi +++ b/doc/interpreter/var.texi @@ -41,7 +41,7 @@ @xref{Assignment Ops, ,Assignment Expressions}. A number of variables have special built-in meanings. For example, -@code{PWD} holds the current working directory, and @code{pi} names the +@code{ans} holds the current working directory, and @code{pi} names the ratio of the circumference of a circle to its diameter. @xref{Summary of Built-in Variables}, for a list of all the predefined variables. Some of these built-in symbols are constants and may not be changed. Others @@ -396,6 +396,11 @@ Default value: 0. +@item crash_dumps_octave_core +@xref{Simple File I/O}. + +Default value: 1. + @item define_all_return_values @xref{Multiple Return Values}.
--- a/doc/liboctave/Makefile.in +++ b/doc/liboctave/Makefile.in @@ -25,7 +25,8 @@ liboctave.texi matvec.texi nleqn.texi nlfunc.texi ode.texi \ optim.texi preface.texi quad.texi range.texi -FORMATTED = liboctave.dvi liboctave.ps liboctave.info liboctave.info-[0-9]* +FORMATTED = liboctave.dvi liboctave.ps liboctave.info \ + liboctave.info-[0-9]* liboctave_*.html DISTFILES = Makefile.in gpl.texi $(TEXINFO) $(FORMATTED) @@ -38,7 +39,7 @@ sed -e 's/@@/ at /g' -e 's/@[a-zA-Z]*//g' $< | spell > $@.tmp mv $@.tmp $@ -all: liboctave.info liboctave.dvi liboctave.ps +all: liboctave.info liboctave.dvi liboctave.ps liboctave_toc.html .PHONY: all liboctave.info: $(TEXINFO) ../conf.texi @@ -52,6 +53,9 @@ liboctave.ps: liboctave.dvi -dvips -o liboctave.ps liboctave.dvi +liboctave_toc.html: + -texi2html -split_chapter -I$(srcdir)/.. $(srcdir)/liboctave.texi + check: .PHONY: check @@ -84,8 +88,9 @@ .PHONY: distclean maintainer-clean: distclean - rm -f tags TAGS liboctave.info liboctave.info-* \ - liboctave.dvi liboctave.ps + rm -f tags TAGS liboctave.info liboctave.info-* + rm -f liboctave.dvi liboctave.ps + rm -f liboctave_*.html .PHONY: maintainer-clean dist: all
--- a/emacs/octave-inf.el +++ b/emacs/octave-inf.el @@ -33,7 +33,7 @@ "*Program invoked by `inferior-octave'.") (defvar inferior-octave-prompt - "\\(^octave\\(:[0-9]+\\)?\\|^debug\\|^\\)>+ " + "\\(^octave\\(\\|.bin\\)\\(:[0-9]+\\)?\\|^debug\\|^\\)>+ " "*Regexp to match prompts for the inferior Octave process.") (defvar inferior-octave-startup-file nil
--- a/libcruft/ChangeLog +++ b/libcruft/ChangeLog @@ -1,3 +1,8 @@ +Thu Oct 15 00:43:13 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * ranlib: Update to newer version of randlib. + * ranlib/Makefile.in (SPECIAL): Update list. + Thu Sep 24 11:59:02 1998 John W. Eaton <jwe@bevo.che.wisc.edu> * balgen, eispack: Delete directories and unnecesary files.
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,14 @@ +Fri Oct 16 01:08:30 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * chMatrix.cc (charMatrix::extract): New function. + (charMatrix::charMatrix (char c)): New constructor. + +Tue Oct 13 22:11:08 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * cmd-edit.h: (command_editor::do_read_init_file): New function. + * cmd-edit.cc (command_editor::read_init_file): New function. + (gnu_readline::do_read_init_file): Likewise. + Fri Sep 25 14:26:44 1998 John W. Eaton <jwe@bevo.che.wisc.edu> * oct-env.cc (octave_env::do_get_home_directory):
--- a/liboctave/LSODE.cc +++ b/liboctave/LSODE.cc @@ -245,8 +245,6 @@ int *piwork = iwork.fortran_vec (); double *prwork = rwork.fortran_vec (); - again: - F77_XFCN (lsode, LSODE, (lsode_f, n, xp, t, tout, itol, rel_tol, abs_tol, itask, istate, iopt, prwork, lrw, piwork, liw, lsode_j, method_flag)); @@ -272,18 +270,10 @@ break; case -1: // excess work done on this call (perhaps wrong mf). - if (step_limit () > 0) - { - (*current_liboctave_error_handler) - ("giving up after more than %d steps attempted in lsode", - step_limit ()); - integration_error = 1; - } - else - { - istate = 2; - goto again; - } + (*current_liboctave_error_handler) + ("giving up after more than %d steps attempted in lsode", + step_limit ()); + integration_error = 1; break; case 2: // lsode was successful
--- a/liboctave/LSODE.h +++ b/liboctave/LSODE.h @@ -64,7 +64,11 @@ x_maximum_step_size = -1.0; x_minimum_step_size = 0.0; x_relative_tolerance = sqrt_eps; - x_step_limit = 500; + + // This is consistent with earlier versions of Octave, and is + // much larger than the default of 500 specified in the LSODE + // sources. + x_step_limit = 100000; } void copy (const LSODE_options& opt)
--- a/liboctave/chMatrix.cc +++ b/liboctave/chMatrix.cc @@ -40,6 +40,17 @@ // charMatrix class. +charMatrix::charMatrix (char c) + : MArray2<char> () +{ + int nc = 1; + int nr = 1; + + resize (nr, nc); + + elem (0, 0) = c; +} + charMatrix::charMatrix (const char *s) : MArray2<char> () { @@ -176,6 +187,24 @@ return result; } +charMatrix +charMatrix::extract (int r1, int c1, int r2, int c2) const +{ + if (r1 > r2) { int tmp = r1; r1 = r2; r2 = tmp; } + if (c1 > c2) { int tmp = c1; c1 = c2; c2 = tmp; } + + int new_r = r2 - r1 + 1; + int new_c = c2 - c1 + 1; + + charMatrix result (new_r, new_c); + + for (int j = 0; j < new_c; j++) + for (int i = 0; i < new_r; i++) + result.elem (i, j) = elem (r1+i, c1+j); + + return result; +} + // XXX FIXME XXX -- these should probably return a boolMatrix type // instead, but that will have to wait for a future version...
--- a/liboctave/chMatrix.h +++ b/liboctave/chMatrix.h @@ -46,6 +46,7 @@ charMatrix (int r, int c, char val) : MArray2<char> (r, c, val) { } charMatrix (const MArray2<char>& a) : MArray2<char> (a) { } charMatrix (const charMatrix& a) : MArray2<char> (a) { } + charMatrix (char c); charMatrix (const char *s); charMatrix (const string& s); charMatrix (const string_vector& s); @@ -68,6 +69,10 @@ charMatrix transpose (void) const; + // resize is the destructive equivalent for this one + + charMatrix extract (int r1, int c1, int r2, int c2) const; + Matrix all (void) const; Matrix any (void) const;
--- a/liboctave/cmd-edit.cc +++ b/liboctave/cmd-edit.cc @@ -114,6 +114,8 @@ void do_restore_startup_hook (void); + void do_read_init_file (const string& file); + static void operate_and_get_next (int, int); private: @@ -324,6 +326,15 @@ } void +gnu_readline::do_read_init_file (const string& file) +{ + if (file.empty ()) + rl_re_read_init_file (); + else + rl_read_init_file (file.c_str ()); +} + +void gnu_readline::operate_and_get_next (int /* count */, int /* c */) { // Accept the current line. @@ -650,6 +661,13 @@ instance->do_restore_startup_hook (); } +void +command_editor::read_init_file (const string& file) +{ + if (instance_ok ()) + instance->do_read_init_file (file); +} + // Return a string which will be printed as a prompt. The string may // contain special characters which are decoded as follows: //
--- a/liboctave/cmd-edit.h +++ b/liboctave/cmd-edit.h @@ -85,6 +85,8 @@ static void restore_startup_hook (void); + static void read_init_file (const string& file = string ()); + static int current_command_number (void); static void reset_current_command_number (int n); @@ -156,6 +158,8 @@ virtual void do_restore_startup_hook (void) { } + virtual void do_read_init_file (const string&) { } + int read_octal (const string& s); void error (int);
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,60 @@ +Fri Oct 16 00:52:15 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * parse.y (in_matrix_or_assign_lhs): New subroutine for lexical + feedback. + (matrix): Use it. + (assign_lhs): Ditto. + * lex.h (lexical_feedback::looking_at_matrix_or_assign_lhs): New + data member. + * lex.l (handle_identifier): Use it to handle keywords like `cd' + as variables in contexts like [ab, cd] = foo (). + + * ov-str-mat.h + (octave_char_matrix_str::octave_char_matrix_str (char c)): + New constructor. + * ov-ch-mat.h (octave_char_matrix::octave_char_matrix (char c)): + New constructor. + * ov.cc (octave_value::octave_value (char c): New constructor. + + * pt-loop.cc (tree_simple_for_command::eval): Handle case of RHS + as string. + +Thu Oct 15 00:56:47 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * DLD-FUNCTIONS/rand.cc: Declare Fortran subroutines as returning + int, not int*. + +Wed Oct 14 23:51:31 1998 Georg Thimm <thimm@idiap.ch> + + * load-save.cc (Vcrash_dumps_octave_core): New static variable. + (save_user_variables): Only save variables if + Vcrash_dumps_octave_core is true. + (symbols_of_load_save): Add DEFVAR for it here. + (crash_dumps_octave_core): New function. + * octave.cc (maximum_braindamage): Bind crash_dumps_octave_core to + 0.0 here. + +Tue Oct 13 22:05:55 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * input.cc (read_readline_init_file): New function. + +Thu Oct 8 13:47:55 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * oct-procbuf.h (octave_procbuf::wstatus): New data member. + Initialize in constructors. + (octave_procbuf::wait_status): New member function. + * oct-procbuf.cc (octave_procbuf::sys_close): Use class data + member wstatus, not local variable. + * procstream.cc (procstreambase::close): Don't call sys_close directly. + Get subprocess exit status by calling wait_status for our procbuf. + * pt-plot.cc (close_plot_stream): Send "quit" command to gnuplot + before deleting plot_stream. + + +Thu Oct 1 22:39:44 1998 John W. Eaton <jwe@bevo.che.wisc.edu> + + * data.cc (Fis_complex): New function. + Fri Sep 25 11:50:44 1998 John W. Eaton <jwe@bevo.che.wisc.edu> * load-save.cc (write_header): Rename from write_binary_header.
--- a/src/DLD-FUNCTIONS/rand.cc +++ b/src/DLD-FUNCTIONS/rand.cc @@ -51,19 +51,19 @@ extern "C" { - int *F77_FCN (dgennor, DGENNOR) (const double&, const double&, - double&); + int F77_FCN (dgennor, DGENNOR) (const double&, const double&, + double&); - int *F77_FCN (dgenunf, DGENUNF) (const double&, const double&, - double&); + int F77_FCN (dgenunf, DGENUNF) (const double&, const double&, + double&); - int *F77_FCN (setall, SETALL) (const int&, const int&); + int F77_FCN (setall, SETALL) (const int&, const int&); - int *F77_FCN (getsd, GETSD) (int&, int&); + int F77_FCN (getsd, GETSD) (int&, int&); - int *F77_FCN (setsd, SETSD) (const int&, const int&); + int F77_FCN (setsd, SETSD) (const int&, const int&); - int *F77_FCN (setcgn, SETCGN) (const int&); + int F77_FCN (setcgn, SETCGN) (const int&); } static double
--- a/src/input.cc +++ b/src/input.cc @@ -45,6 +45,7 @@ #endif #include "cmd-edit.h" +#include "file-ops.h" #include "str-vec.h" #include "defun.h" @@ -792,6 +793,28 @@ return retval; } +DEFUN (read_readline_init_file, args, , + "read_readline_init_file (FILE)") +{ + octave_value_list retval; + + int nargin = args.length (); + + if (nargin == 0) + command_editor::read_init_file (); + else if (nargin == 1) + { + string file = file_ops::tilde_expand (args(0).string_value ()); + + if (! error_state) + command_editor::read_init_file (file); + } + else + print_usage ("read_readline_init_file"); + + return retval; +} + static int ps1 (void) {
--- a/src/lex.h +++ b/src/lex.h @@ -146,6 +146,10 @@ // TRUE means we're parsing the parameter list for a function. bool looking_at_parameter_list; + // TRUE means we're parsing a matrix or the left hand side of + // multi-value assignment statement. + bool looking_at_matrix_or_assign_lhs; + // GAG. Stupid kludge so that [[1,2][3,4]] will work. bool do_comma_insert;
--- a/src/lex.l +++ b/src/lex.l @@ -1802,14 +1802,16 @@ // arguments. // // If the following token is `=', or if we are parsing a function - // return list or function parameter list, force the symbol to be - // inserted as a variable in the current symbol table. + // return list or function parameter list, or if we are looking at + // something like [ab,cd] = foo (), force the symbol to be inserted + // as a variable in the current symbol table. if (is_text_function_name (tok) && ! is_variable (tok)) { if (next_tok_is_eq || lexer_flags.looking_at_return_list - || lexer_flags.looking_at_parameter_list) + || lexer_flags.looking_at_parameter_list + || lexer_flags.looking_at_matrix_or_assign_lhs) { force_local_variable (tok); }
--- a/src/load-save.cc +++ b/src/load-save.cc @@ -59,6 +59,9 @@ #include "variables.h" #include "version.h" +// The number of decimal digits to use when writing ascii data. +static bool Vcrash_dumps_octave_core; + // The default output format. May be one of "binary", "text", or // "mat-binary". static string Vdefault_save_format; @@ -2436,27 +2439,30 @@ void save_user_variables (void) { - // XXX FIXME XXX -- should choose better file name? - - const char *fname = "octave-core"; - - message (0, "attempting to save variables to `%s'...", fname); - - load_save_format format = get_default_save_format (); - - unsigned mode = ios::out|ios::trunc; - if (format == LS_BINARY || format == LS_MAT_BINARY) - mode |= ios::bin; - - ofstream file (fname, mode); - - if (file) + if (Vcrash_dumps_octave_core) { - save_vars (string_vector (), 0, 0, file, false, format, false, true); - message (0, "save to `%s' complete", fname); + // XXX FIXME XXX -- should choose better file name? + + const char *fname = "octave-core"; + + message (0, "attempting to save variables to `%s'...", fname); + + load_save_format format = get_default_save_format (); + + unsigned mode = ios::out|ios::trunc; + if (format == LS_BINARY || format == LS_MAT_BINARY) + mode |= ios::bin; + + ofstream file (fname, mode); + + if (file) + { + save_vars (string_vector (), 0, 0, file, false, format, false, true); + message (0, "save to `%s' complete", fname); + } + else + warning ("unable to open `%s' for writing...", fname); } - else - warning ("unable to open `%s' for writing...", fname); } DEFUN_TEXT (save, args, , @@ -2641,6 +2647,14 @@ } static int +crash_dumps_octave_core (void) +{ + Vcrash_dumps_octave_core = check_preference ("crash_dumps_octave_core"); + return 0; +} + + +static int default_save_format (void) { int status = 0; @@ -2679,6 +2693,9 @@ void symbols_of_load_save (void) { + DEFVAR (crash_dumps_octave_core, 1.0, 0, crash_dumps_octave_core, + "write octave-core file if Octave crashes or is killed by a signal"); + DEFVAR (default_save_format, "ascii", 0, default_save_format, "default format for files created with save, may be one of\n\ \"binary\", \"text\", or \"mat-binary\"");
--- a/src/oct-procbuf.cc +++ b/src/oct-procbuf.cc @@ -147,8 +147,6 @@ { #if defined (HAVE_SYS_WAIT_H) - int wstatus; - pid_t wait_pid; int status = -1;
--- a/src/oct-procbuf.h +++ b/src/oct-procbuf.h @@ -38,10 +38,11 @@ public: octave_procbuf (void) - : filebuf (), proc_pid (-1), next (0) { } + : filebuf (), wstatus (-1), proc_pid (-1), next (0) { } octave_procbuf (const char *command, int mode) - : filebuf (), proc_pid (-1), next (0) { open (command, mode); } + : filebuf (), wstatus (-1), proc_pid (-1), next (0) + { open (command, mode); } ~octave_procbuf (void) { close (); } @@ -52,10 +53,14 @@ virtual int sys_close (void); + int wait_status (void) const { return wstatus; } + pid_t pid (void) { return proc_pid; } protected: + int wstatus; + pid_t proc_pid; octave_procbuf *next;
--- a/src/octave.cc +++ b/src/octave.cc @@ -324,6 +324,7 @@ bind_builtin_variable ("PS1", ">> "); bind_builtin_variable ("PS2", ""); bind_builtin_variable ("beep_on_error", 1.0); + bind_builtin_variable ("crash_dumps_octave_core", 0.0); bind_builtin_variable ("default_eval_print_flag", 0.0); bind_builtin_variable ("default_global_variable_value", Matrix ()); bind_builtin_variable ("default_save_format", "mat-binary");
--- a/src/ov-ch-mat.h +++ b/src/ov-ch-mat.h @@ -59,6 +59,9 @@ octave_char_matrix (const charMatrix& chm, bool = false) : octave_base_value (), matrix (chm) { } + octave_char_matrix (char c) + : octave_base_value (), matrix (c) { } + octave_char_matrix (const char *s) : octave_base_value (), matrix (s) { }
--- a/src/ov-str-mat.h +++ b/src/ov-str-mat.h @@ -59,6 +59,9 @@ octave_char_matrix_str (const charMatrix& chm) : octave_char_matrix (chm) { } + octave_char_matrix_str (char c) + : octave_char_matrix (c) { } + octave_char_matrix_str (const char *s) : octave_char_matrix (s) { }
--- a/src/ov.cc +++ b/src/ov.cc @@ -365,6 +365,13 @@ maybe_mutate (); } +octave_value::octave_value (char c) + : rep (new octave_char_matrix_str (c)) +{ + rep->count = 1; + maybe_mutate (); +} + octave_value::octave_value (const char *s) : rep (new octave_char_matrix_str (s)) {
--- a/src/ov.h +++ b/src/ov.h @@ -141,6 +141,7 @@ octave_value (const ComplexColumnVector& v, int pcv = -1); octave_value (bool b); octave_value (const boolMatrix& bm); + octave_value (char c); octave_value (const char *s); octave_value (const string& s); octave_value (const string_vector& s);
--- a/src/parse.y +++ b/src/parse.y @@ -522,12 +522,17 @@ { $$ = make_constant (TEXT, $1); } ; +in_matrix_or_assign_lhs + : // empty + { lexer_flags.looking_at_matrix_or_assign_lhs = true; } + ; + matrix : '[' ']' { $$ = new tree_constant (octave_value (Matrix ())); } | '[' ';' ']' { $$ = new tree_constant (octave_value (Matrix ())); } - | '[' rows ']' - { $$ = finish_matrix ($2); } + | '[' in_matrix_or_assign_lhs rows ']' + { $$ = finish_matrix ($3); } ; rows : rows1 @@ -707,8 +712,11 @@ assign_lhs : simple_expr { $$ = new tree_argument_list ($1); } - | '[' arg_list CLOSE_BRACE - { $$ = $2; } + | '[' in_matrix_or_assign_lhs arg_list CLOSE_BRACE + { + $$ = $3; + lexer_flags.looking_at_matrix_or_assign_lhs = false; + } ; assign_expr : assign_lhs '=' expression @@ -1026,7 +1034,7 @@ // List of function return value names // =================================== -return_list_beg : '[' local_symtab in_return_list +return_list_beg : '[' in_return_list local_symtab ; return_list : return_list_beg return_list_end
--- a/src/procstream.cc +++ b/src/procstream.cc @@ -54,10 +54,10 @@ if (is_open ()) { - status = pb.sys_close (); - if (! pb.close ()) set (ios::failbit); + + status = pb.wait_status (); } return status;
--- a/src/procstream.h +++ b/src/procstream.h @@ -78,9 +78,7 @@ ~iprocstream (void) { } void open (const char *name, int mode=ios::in) - { - procstreambase::open (name, mode); - } + { procstreambase::open (name, mode); } private: @@ -102,9 +100,7 @@ ~oprocstream (void) { } void open (const char *name, int mode=ios::out) - { - procstreambase::open(name, mode); - } + { procstreambase::open(name, mode); } private: @@ -123,13 +119,10 @@ procstream (const char *name, int mode) : procstreambase(name, mode) { } - ~procstream (void) { } void open (const char *name, int mode) - { - procstreambase::open(name, mode); - } + { procstreambase::open(name, mode); } private:
--- a/src/pt-loop.cc +++ b/src/pt-loop.cc @@ -217,13 +217,20 @@ } else if (rhs.is_matrix_type ()) { + charMatrix chm_tmp; Matrix m_tmp; ComplexMatrix cm_tmp; int nr; int steps; - if (rhs.is_real_matrix ()) + if (rhs.is_string ()) + { + chm_tmp = rhs.char_matrix_value (); + nr = chm_tmp.rows (); + steps = chm_tmp.columns (); + } + else if (rhs.is_real_matrix ()) { m_tmp = rhs.matrix_value (); nr = m_tmp.rows (); @@ -239,7 +246,26 @@ if (error_state) return; - if (rhs.is_real_matrix ()) + if (rhs.is_string ()) + { + if (nr == 1) + DO_LOOP (chm_tmp (0, i)); + else + { + for (int i = 0; i < steps; i++) + { + octave_value val (chm_tmp.extract (0, i, nr-1, i), true); + + bool quit = false; + + do_for_loop_once (ult, val, quit); + + if (quit) + break; + } + } + } + else if (rhs.is_real_matrix ()) { if (nr == 1) DO_LOOP (m_tmp (0, i));