Mercurial > forge
comparison main/fixed/src/ov-fixed-mat.cc @ 9481:d84d2fea3c90 octave-forge
Re-enable compilation of fixed package
author | jordigh |
---|---|
date | Wed, 22 Feb 2012 22:07:33 +0000 |
parents | f8d77845533f |
children | 58d36e8880db |
comparison
equal
deleted
inserted
replaced
9480:954f2f00d782 | 9481:d84d2fea3c90 |
---|---|
352 char s = '\0'; | 352 char s = '\0'; |
353 retval = octave_value (&s); | 353 retval = octave_value (&s); |
354 } | 354 } |
355 else | 355 else |
356 { | 356 { |
357 charMatrix chm (nr, nc); | 357 charMatrix chm (dim_vector (nr, nc)); |
358 | 358 |
359 bool warned = false; | 359 bool warned = false; |
360 | 360 |
361 for (int j = 0; j < nc; j++) | 361 for (int j = 0; j < nc; j++) |
362 { | 362 { |
384 | 384 |
385 chm (i, j) = static_cast<char> (ival); | 385 chm (i, j) = static_cast<char> (ival); |
386 } | 386 } |
387 } | 387 } |
388 | 388 |
389 retval = octave_value (chm, 1); | 389 retval = octave_value (chm); |
390 } | 390 } |
391 } | 391 } |
392 | 392 |
393 return retval; | 393 return retval; |
394 } | 394 } |
395 | 395 |
396 static void | 396 static void |
397 restore_precision (void *p) | 397 restore_precision (int *p) |
398 { | 398 { |
399 bind_internal_variable ("output_precision", *(static_cast<int *> (p))); | 399 bind_internal_variable ("output_precision", *p); |
400 } | 400 } |
401 | 401 |
402 void | 402 void |
403 octave_fixed_matrix::print_raw (std::ostream& os, | 403 octave_fixed_matrix::print_raw (std::ostream& os, |
404 bool pr_as_read_syntax) const | 404 bool pr_as_read_syntax) const |
407 int new_prec = (int)matrix.getdecsize().row_max().max() + | 407 int new_prec = (int)matrix.getdecsize().row_max().max() + |
408 (min_num >= 1. ? (int)::log10(min_num) + 1 : 0); | 408 (min_num >= 1. ? (int)::log10(min_num) + 1 : 0); |
409 | 409 |
410 octave_value_list tmp = feval ("output_precision"); | 410 octave_value_list tmp = feval ("output_precision"); |
411 int prec = tmp(0).int_value (); | 411 int prec = tmp(0).int_value (); |
412 unwind_protect::add (restore_precision, &prec); | 412 |
413 unwind_protect frame; | |
414 | |
415 frame.add_fcn (restore_precision, &prec); | |
416 | |
413 bind_internal_variable ("output_precision", new_prec); | 417 bind_internal_variable ("output_precision", new_prec); |
414 | 418 |
415 octave_print_internal (os, matrix_value(), false, | 419 octave_print_internal (os, matrix_value(), false, |
416 current_print_indent_level ()); | 420 current_print_indent_level ()); |
417 | |
418 unwind_protect::run (); | |
419 } | 421 } |
420 | 422 |
421 bool | 423 bool |
422 octave_fixed_matrix::save_ascii (std::ostream& os) | 424 octave_fixed_matrix::save_ascii (std::ostream& os) |
423 { | 425 { |