comparison libinterp/corefcn/dlmread.cc @ 29961:7d6709900da7

eliminate octave:: namespace tags in DEFUN and DEFMETHOD and more Files affected: __betainc__.cc, __contourc__.cc, __eigs__.cc, __expint__.cc, __ftp__.cc, __gammainc__.cc, __ichol__.cc, __ilu__.cc, __magick_read__.cc, __pchip_deriv__.cc, __qp__.cc, amd.cc, balance.cc, besselj.cc, bsxfun.cc, call-stack.cc, ccolamd.cc, cellfun.cc, chol.cc, colamd.cc, colloc.cc, conv2.cc, daspk.cc, dasrt.cc, dassl.cc, data.cc, defaults.cc, dirfns.cc, display.cc, dlmread.cc, dmperm.cc, dot.cc, eig.cc, ellipj.cc, environment.cc, error.cc, event-manager.cc, fft.cc, fft2.cc, fftn.cc, file-io.cc, find.cc, gcd.cc, getgrent.cc, getpwent.cc, getrusage.cc, gsvd.cc, hash.cc, help.cc, hess.cc, hex2num.cc, input.cc, inv.cc, jsondecode.cc, jsonencode.cc, load-path.cc, load-save.cc, lookup.cc, lsode.cc, lu.cc, max.cc, mgorth.cc, oct-hist.cc, ordqz.cc, ordschur.cc, pager.cc, pr-output.cc, psi.cc, qr.cc, quad.cc, quadcc.cc, qz.cc, rand.cc, regexp.cc, schur.cc, settings.cc, sighandlers.cc, sparse.cc, spparms.cc, sqrtm.cc, stream-euler.cc, strfind.cc, strfns.cc, sub2ind.cc, svd.cc, symbfact.cc, symtab.cc, syscalls.cc, sysdep.cc, time.cc, toplev.cc, tril.cc, typecast.cc, urlwrite.cc, utils.cc, variables.cc, __delaunayn__.cc, __fltk_uigetfile__.cc, __glpk__.cc, __init_gnuplot__.cc, __ode15__.cc, __voronoi__.cc, audiodevinfo.cc, audioread.cc, convhulln.cc, fftw.cc, gzip.cc, ov-cell.cc, ov-class.cc, ov-classdef.cc, ov-fcn-handle.cc, ov-struct.cc, ov-typeinfo.cc, ov-usr-fcn.cc, octave.cc, lex.ll, oct-parse.yy, profiler.cc, andpt-eval.cc.
author John W. Eaton <jwe@octave.org>
date Sat, 14 Aug 2021 22:48:52 -0400
parents 32c3a5805893
children a61e1a0f6024
comparison
equal deleted inserted replaced
29960:939bef0b66e0 29961:7d6709900da7
225 if (args(0).is_string ()) 225 if (args(0).is_string ())
226 { 226 {
227 // Filename. 227 // Filename.
228 std::string fname (args(0).string_value ()); 228 std::string fname (args(0).string_value ());
229 229
230 std::string tname = octave::sys::file_ops::tilde_expand (fname); 230 std::string tname = sys::file_ops::tilde_expand (fname);
231 231
232 tname = octave::find_data_file_in_load_path ("dlmread", tname); 232 tname = find_data_file_in_load_path ("dlmread", tname);
233 233
234 #if defined (OCTAVE_USE_WINDOWS_API) 234 #if defined (OCTAVE_USE_WINDOWS_API)
235 std::wstring wname = octave::sys::u8_to_wstring (tname); 235 std::wstring wname = sys::u8_to_wstring (tname);
236 input_file.open (wname.c_str (), std::ios::in); 236 input_file.open (wname.c_str (), std::ios::in);
237 #else 237 #else
238 input_file.open (tname.c_str (), std::ios::in); 238 input_file.open (tname.c_str (), std::ios::in);
239 #endif 239 #endif
240 240
243 243
244 input = &input_file; 244 input = &input_file;
245 } 245 }
246 else if (args(0).is_scalar_type ()) 246 else if (args(0).is_scalar_type ())
247 { 247 {
248 octave::stream_list& streams = interp.get_stream_list (); 248 stream_list& streams = interp.get_stream_list ();
249 249
250 octave::stream is = streams.lookup (args(0), "dlmread"); 250 stream is = streams.lookup (args(0), "dlmread");
251 251
252 input = is.input_stream (); 252 input = is.input_stream ();
253 253
254 if (! input) 254 if (! input)
255 error ("dlmread: stream FILE not open for input"); 255 error ("dlmread: stream FILE not open for input");
260 // Set default separator. 260 // Set default separator.
261 std::string sep; 261 std::string sep;
262 if (nargin > 1) 262 if (nargin > 1)
263 { 263 {
264 if (args(1).is_sq_string ()) 264 if (args(1).is_sq_string ())
265 sep = octave::do_string_escapes (args(1).string_value ()); 265 sep = do_string_escapes (args(1).string_value ());
266 else 266 else
267 sep = args(1).string_value (); 267 sep = args(1).string_value ();
268 } 268 }
269 269
270 // Take a subset if a range was given. 270 // Take a subset if a range was given.
338 // panelty of frequently switching the locale when reading floating point 338 // panelty of frequently switching the locale when reading floating point
339 // values from the stream. 339 // values from the stream.
340 char *prev_locale = std::setlocale (LC_ALL, nullptr); 340 char *prev_locale = std::setlocale (LC_ALL, nullptr);
341 std::string old_locale (prev_locale ? prev_locale : ""); 341 std::string old_locale (prev_locale ? prev_locale : "");
342 std::setlocale (LC_ALL, "C"); 342 std::setlocale (LC_ALL, "C");
343 octave::unwind_action act 343 unwind_action act
344 ([old_locale] () { std::setlocale (LC_ALL, old_locale.c_str ()); }); 344 ([old_locale] () { std::setlocale (LC_ALL, old_locale.c_str ()); });
345 345
346 std::string line; 346 std::string line;
347 347
348 // Skip the r0 leading lines 348 // Skip the r0 leading lines
479 } 479 }
480 480
481 tmp_stream.str (str); 481 tmp_stream.str (str);
482 tmp_stream.clear (); 482 tmp_stream.clear ();
483 483
484 double x = octave::read_value<double> (tmp_stream); 484 double x = read_value<double> (tmp_stream);
485 if (tmp_stream) 485 if (tmp_stream)
486 { 486 {
487 if (tmp_stream.eof ()) 487 if (tmp_stream.eof ())
488 { 488 {
489 if (iscmplx) 489 if (iscmplx)
521 // Parsing failed, <Inf|NA|NaN><extra text> 521 // Parsing failed, <Inf|NA|NaN><extra text>
522 j++; // Leave data initialized to empty_value 522 j++; // Leave data initialized to empty_value
523 } 523 }
524 else 524 else
525 { 525 {
526 double y = octave::read_value<double> (tmp_stream); 526 double y = read_value<double> (tmp_stream);
527 527
528 if (! iscmplx && y != 0.0) 528 if (! iscmplx && y != 0.0)
529 { 529 {
530 iscmplx = true; 530 iscmplx = true;
531 cdata = ComplexMatrix (rdata); 531 cdata = ComplexMatrix (rdata);
538 } 538 }
539 } 539 }
540 } 540 }
541 else 541 else
542 { 542 {
543 // octave::read_value<double>() parsing failed 543 // read_value<double>() parsing failed
544 j++; // Leave data initialized to empty_value 544 j++; // Leave data initialized to empty_value
545 } 545 }
546 546
547 pos1 = pos2 + 1; 547 pos1 = pos2 + 1;
548 } 548 }