comparison main/fixed/src/ov-fixed.cc @ 9481:d84d2fea3c90 octave-forge

Re-enable compilation of fixed package
author jordigh
date Wed, 22 Feb 2012 22:07:33 +0000
parents 0924c374b60d
children 58d36e8880db
comparison
equal deleted inserted replaced
9480:954f2f00d782 9481:d84d2fea3c90
193 193
194 return retval; 194 return retval;
195 } 195 }
196 196
197 static void 197 static void
198 restore_precision (void *p) 198 restore_precision (int *p)
199 { 199 {
200 bind_internal_variable ("output_precision", *(static_cast<int *> (p))); 200 bind_internal_variable ("output_precision", *p);
201 } 201 }
202 202
203 void 203 void
204 octave_fixed::print_raw (std::ostream& os, bool pr_as_read_syntax) const 204 octave_fixed::print_raw (std::ostream& os, bool pr_as_read_syntax) const
205 { 205 {
207 int new_prec = scalar.getdecsize() + 207 int new_prec = scalar.getdecsize() +
208 (min_num >= 1. ? (int)::log10(min_num) + 1 : 0); 208 (min_num >= 1. ? (int)::log10(min_num) + 1 : 0);
209 209
210 octave_value_list tmp = feval ("output_precision"); 210 octave_value_list tmp = feval ("output_precision");
211 int prec = tmp(0).int_value (); 211 int prec = tmp(0).int_value ();
212 unwind_protect::add (restore_precision, &prec); 212
213 unwind_protect frame;
214
215 frame.add_fcn (restore_precision, &prec);
216
213 bind_internal_variable ("output_precision", new_prec); 217 bind_internal_variable ("output_precision", new_prec);
214 218
215 indent (os); 219 indent (os);
216 octave_print_internal (os, scalar_value(), pr_as_read_syntax); 220 octave_print_internal (os, scalar_value(), pr_as_read_syntax);
217
218 unwind_protect::run ();
219 } 221 }
220 222
221 bool 223 bool
222 octave_fixed::save_ascii (std::ostream& os) 224 octave_fixed::save_ascii (std::ostream& os)
223 { 225 {