Mercurial > hg > octave-nkf
diff liboctave/mach-info.cc @ 2926:66ef74ee5d9f
[project @ 1997-05-05 03:20:52 by jwe]
author | jwe |
---|---|
date | Mon, 05 May 1997 03:40:21 +0000 |
parents | 8b262e771614 |
children | 5eef8a2294bd |
line wrap: on
line diff
--- a/liboctave/mach-info.cc +++ b/liboctave/mach-info.cc @@ -70,7 +70,7 @@ } void -oct_mach_info::init_float_format (void) +oct_mach_info::init_float_format (void) const { float_params fp[5]; @@ -124,7 +124,7 @@ } void -oct_mach_info::ten_little_endians (void) +oct_mach_info::ten_little_endians (void) const { // Are we little or big endian? From Harbison & Steele. @@ -145,31 +145,44 @@ ten_little_endians (); } +bool +oct_mach_info::instance_ok (void) +{ + bool retval = true; + + if (! instance) + instance = new oct_mach_info (); + + if (! instance) + { + (*current_liboctave_error_handler) + ("unable to create command history object!"); + + retval = false; + } + + return retval; +} + oct_mach_info::float_format oct_mach_info::native_float_format (void) { - if (! instance) - instance = new oct_mach_info (); - - return instance->native_float_fmt; + return (instance_ok ()) + ? instance->native_float_fmt : oct_mach_info::unknown; } bool oct_mach_info::words_big_endian (void) { - if (! instance) - instance = new oct_mach_info (); - - return instance->big_chief; + return (instance_ok ()) + ? instance->big_chief : false; } bool oct_mach_info::words_little_endian (void) { - if (! instance) - instance = new oct_mach_info (); - - return ! instance->big_chief; + return (instance_ok ()) + ? (! instance->big_chief) : false; } oct_mach_info::float_format