Mercurial > hg > octave-nkf
changeset 5336:6ba182a85dea
[project @ 2005-05-04 18:12:16 by jwe]
author | jwe |
---|---|
date | Wed, 04 May 2005 18:12:17 +0000 |
parents | a892ee7ac114 |
children | 7ffada2604ea |
files | liboctave/ChangeLog liboctave/cmd-edit.cc src/ChangeLog src/ls-mat5.cc src/ov-struct.cc |
diffstat | 5 files changed, 57 insertions(+), 28 deletions(-) [+] |
line wrap: on
line diff
--- a/liboctave/ChangeLog +++ b/liboctave/ChangeLog @@ -1,3 +1,8 @@ +2005-05-04 John W. Eaton <jwe@octave.org> + + * cmd-edit.cc (gnu_readline::do_readline): Extract const char* + from prompt outside of INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE block. + 2005-05-02 John W. Eaton <jwe@octave.org> * Makefile.in (LINK_DEPS): List $(UMFPACK_LIBS) ahead of $(BLAS_LIBS).
--- a/liboctave/cmd-edit.cc +++ b/liboctave/cmd-edit.cc @@ -197,9 +197,11 @@ char *line = 0; + const char *p = prompt.c_str (); + BEGIN_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE; - line = ::octave_rl_readline (prompt.c_str ()); + line = ::octave_rl_readline (p); END_INTERRUPT_IMMEDIATELY_IN_FOREIGN_CODE;
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2005-05-04 John W. Eaton <jwe@octave.org> + + * ls-mat5.cc (read_mat5_binary_element): Implement reading of N-d + structure arrays. + + * ov-struct.cc (octave_struct::load_hdf5, + octave_struct::load_binary, octave_struct::load_ascii): Assign + cell_value to map slot, not octave_value containing the cell. + 2005-05-02 John W. Eaton <jwe@octave.org> * error.cc (Flasterr): Don't access argv if an error occurs when
--- a/src/ls-mat5.cc +++ b/src/ls-mat5.cc @@ -715,7 +715,6 @@ FOUR_BYTE_INT fn_type; FOUR_BYTE_INT fn_len; FOUR_BYTE_INT field_name_length; - int i; // field name length subelement -- actually the maximum length // of a field name. The Matlab docs promise this will always @@ -742,7 +741,7 @@ goto data_read_error; } - int n_fields = fn_len/field_name_length; + octave_idx_type n_fields = fn_len/field_name_length; fn_len = PAD (fn_len); @@ -751,40 +750,30 @@ if (! is.read (elname, fn_len)) goto data_read_error; - int n; - if (dims(0) == 1) - n = dims(1); - else if (dims(1) == 1) - n = dims(0); - else - { - error ("load: can only handle one-dimensional structure arrays"); - goto data_read_error; - } + std::vector<Cell> elt (n_fields); - Cell field_elts (n_fields, n); + for (octave_idx_type i = 0; i < n_fields; i++) + elt[i] = Cell (dims); + + octave_idx_type n = dims.numel (); // fields subelements - for (int j = 0; j < n; j++) + for (octave_idx_type j = 0; j < n; j++) { - for (i = 0; i < n_fields; i++) + for (octave_idx_type i = 0; i < n_fields; i++) { octave_value fieldtc; read_mat5_binary_element (is, filename, swap, global, fieldtc); - field_elts(i,j) = fieldtc; + elt[i](j) = fieldtc; } + } - for (int j = n_fields-1; j >= 0; j--) + for (octave_idx_type i = 0; i < n_fields; i++) { - const char *key = elname + j*field_name_length; + const char *key = elname + i*field_name_length; - Cell c (dim_vector (n, 1)); - - for (int k = n-1; k >=0; k--) - c(k) = field_elts(j,k); - - m.assign (key, c); + m.assign (key, elt[i]); } tc = m;
--- a/src/ov-struct.cc +++ b/src/ov-struct.cc @@ -1026,7 +1026,15 @@ if (!is) break; - m.assign (nm, t2); + Cell tcell = t2.cell_value (); + + if (error_state) + { + error ("load: internal error loading struct elements"); + return false; + } + + m.assign (nm, tcell); } if (is) @@ -1103,7 +1111,15 @@ if (!is) break; - m.assign (nm, t2); + Cell tcell = t2.cell_value (); + + if (error_state) + { + error ("load: internal error loading struct elements"); + return false; + } + + m.assign (nm, tcell); } if (is) @@ -1179,7 +1195,15 @@ hdf5_read_next_data, &dsub)) > 0) #endif { - m.assign (dsub.name, dsub.tc); + Cell tcell = dsub.tc.cell_value (); + + if (error_state) + { + error ("load: internal error loading struct elements"); + return false; + } + + m.assign (dsub.name, tcell); if (have_h5giterate_bug) current_item++; // H5Giterate returned the last index processed