Mercurial > octave-nkf
comparison src/utils.cc @ 11586:12df7854fa7c
strip trailing whitespace from source files
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Thu, 20 Jan 2011 17:24:59 -0500 |
parents | d6619410e79c |
children | 7a5aacf65f81 |
comparison
equal
deleted
inserted
replaced
11585:1473d0cf86d2 | 11586:12df7854fa7c |
---|---|
268 | 268 |
269 string_vector retval (len); | 269 string_vector retval (len); |
270 | 270 |
271 for (octave_idx_type i = 0; i < len; i++) | 271 for (octave_idx_type i = 0; i < len; i++) |
272 retval[i] = octave_env::make_absolute (sv[i]); | 272 retval[i] = octave_env::make_absolute (sv[i]); |
273 | 273 |
274 return retval; | 274 return retval; |
275 } | 275 } |
276 | 276 |
277 DEFUN (file_in_loadpath, args, , | 277 DEFUN (file_in_loadpath, args, , |
278 "-*- texinfo -*-\n\ | 278 "-*- texinfo -*-\n\ |
408 fcn_file_in_path (const std::string& name) | 408 fcn_file_in_path (const std::string& name) |
409 { | 409 { |
410 std::string retval; | 410 std::string retval; |
411 | 411 |
412 int len = name.length (); | 412 int len = name.length (); |
413 | 413 |
414 if (len > 0) | 414 if (len > 0) |
415 { | 415 { |
416 if (octave_env::absolute_pathname (name)) | 416 if (octave_env::absolute_pathname (name)) |
417 { | 417 { |
418 file_stat fs (name); | 418 file_stat fs (name); |
444 { | 444 { |
445 std::string retval; | 445 std::string retval; |
446 | 446 |
447 if (dir.length () > 0) | 447 if (dir.length () > 0) |
448 { | 448 { |
449 std::string tcontents = file_ops::concat (load_path::find_dir (dir), | 449 std::string tcontents = file_ops::concat (load_path::find_dir (dir), |
450 std::string ("Contents.m")); | 450 std::string ("Contents.m")); |
451 | 451 |
452 file_stat fs (tcontents); | 452 file_stat fs (tcontents); |
453 | 453 |
454 if (fs.exists ()) | 454 if (fs.exists ()) |
465 oct_file_in_path (const std::string& name) | 465 oct_file_in_path (const std::string& name) |
466 { | 466 { |
467 std::string retval; | 467 std::string retval; |
468 | 468 |
469 int len = name.length (); | 469 int len = name.length (); |
470 | 470 |
471 if (len > 0) | 471 if (len > 0) |
472 { | 472 { |
473 if (octave_env::absolute_pathname (name)) | 473 if (octave_env::absolute_pathname (name)) |
474 { | 474 { |
475 file_stat fs (name); | 475 file_stat fs (name); |
494 mex_file_in_path (const std::string& name) | 494 mex_file_in_path (const std::string& name) |
495 { | 495 { |
496 std::string retval; | 496 std::string retval; |
497 | 497 |
498 int len = name.length (); | 498 int len = name.length (); |
499 | 499 |
500 if (len > 0) | 500 if (len > 0) |
501 { | 501 { |
502 if (octave_env::absolute_pathname (name)) | 502 if (octave_env::absolute_pathname (name)) |
503 { | 503 { |
504 file_stat fs (name); | 504 file_stat fs (name); |
779 | 779 |
780 if (! error_state) | 780 if (! error_state) |
781 retval = octave_env::make_absolute (nm); | 781 retval = octave_env::make_absolute (nm); |
782 else | 782 else |
783 error ("make_absolute_filename: expecting argument to be a file name"); | 783 error ("make_absolute_filename: expecting argument to be a file name"); |
784 } | 784 } |
785 else | 785 else |
786 print_usage (); | 786 print_usage (); |
787 | 787 |
788 return retval; | 788 return retval; |
789 } | 789 } |
1350 return retval; | 1350 return retval; |
1351 } | 1351 } |
1352 | 1352 |
1353 octave_value_list | 1353 octave_value_list |
1354 do_simple_cellfun (octave_value_list (*fun) (const octave_value_list&, int), | 1354 do_simple_cellfun (octave_value_list (*fun) (const octave_value_list&, int), |
1355 const char *fun_name, const octave_value_list& args, | 1355 const char *fun_name, const octave_value_list& args, |
1356 int nargout) | 1356 int nargout) |
1357 { | 1357 { |
1358 octave_value_list new_args = args, retval; | 1358 octave_value_list new_args = args, retval; |
1359 int nargin = args.length (); | 1359 int nargin = args.length (); |
1360 OCTAVE_LOCAL_BUFFER (bool, iscell, nargin); | 1360 OCTAVE_LOCAL_BUFFER (bool, iscell, nargin); |
1373 if (iscell[i]) | 1373 if (iscell[i]) |
1374 { | 1374 { |
1375 cells[i] = arg.cell_value (); | 1375 cells[i] = arg.cell_value (); |
1376 octave_idx_type n = ccells[i].numel (); | 1376 octave_idx_type n = ccells[i].numel (); |
1377 if (n == 1) | 1377 if (n == 1) |
1378 { | 1378 { |
1379 iscell[i] = false; | 1379 iscell[i] = false; |
1380 new_args(i) = ccells[i](0); | 1380 new_args(i) = ccells[i](0); |
1381 } | 1381 } |
1382 else if (numel == 1) | 1382 else if (numel == 1) |
1383 { | 1383 { |
1384 numel = n; | 1384 numel = n; |
1385 dims = ccells[i].dims (); | 1385 dims = ccells[i].dims (); |
1386 } | 1386 } |
1387 else if (dims != ccells[i].dims ()) | 1387 else if (dims != ccells[i].dims ()) |
1388 { | 1388 { |
1389 error ("%s: cell arguments must have matching sizes", fun_name); | 1389 error ("%s: cell arguments must have matching sizes", fun_name); |
1390 break; | 1390 break; |
1391 } | 1391 } |