Mercurial > hg > octave-terminal
changeset 4232:b032ebd54586
[project @ 2002-12-20 01:17:19 by jwe]
author | jwe |
---|---|
date | Fri, 20 Dec 2002 01:17:19 +0000 |
parents | 1032fb9ec0d1 |
children | ccfdb55c8156 |
files | src/ChangeLog src/load-save.cc |
diffstat | 2 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,6 +1,8 @@ 2002-12-19 John W. Eaton <jwe@bevo.che.wisc.edu> * load-save.cc (read_mat_ascii_data): Allow commas to separate values. + Try harder to convert filenames to valid identifiers in a + Matlab-compatible way. 2002-12-18 John W. Eaton <jwe@bevo.che.wisc.edu>
--- a/src/load-save.cc +++ b/src/load-save.cc @@ -1989,6 +1989,17 @@ if (pos != NPOS) varname = varname.substr (0, pos); + size_t len = varname.length (); + for (size_t i = 0; i < len; i++) + { + char c = varname[i]; + if (! (::isalnum (c) || c == '_')) + varname[i] = '_'; + } + + if (! ::isalpha (varname[0])) + varname.insert (0, "X"); + if (valid_identifier (varname)) { int nr = 0; @@ -2012,7 +2023,6 @@ for (int i = 0; i < nr; i++) { std::string buf = get_mat_data_input_line (is); - std::cerr << buf<< std::endl; #ifdef HAVE_SSTREAM std::istringstream tmp_stream (buf);