fixednum.sa
Generated by gen_html_sa_files from ICSI. Contact gomes@icsi.berkeley.edu for details
-------------------------> GNU Sather - sourcefile <-------------------------
-- Copyright (C) 2000 by K Hopper, University of Waikato, New Zealand --
-- This file is part of the GNU Sather library. It is free software; you may --
-- redistribute and/or modify it under the terms of the GNU Library General --
-- Public License (LGPL) as published by the Free Software Foundation; --
-- either version 2 of the license, or (at your option) any later version. --
-- This library is distributed in the hope that it will be useful, but --
-- WITHOUT ANY WARRANTY without even the implied warranty of MERCHANTABILITY --
-- or FITNESS FOR A PARTICULAR PURPOSE. See Doc/LGPL for more details. --
-- The license text is also available from: Free Software Foundation, Inc., --
-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA --
--------------> Please email comments to <bug-sather@gnu.org> <--------------
abstract class $FIXED_FMT < $FMT
abstract class $FIXED_FMT < $FMT is
-- This class models a value which requires to be represented in
-- a numeric fixed point format (ie no exponent).
-- Version 1.1 Mar 99. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 11 Feb 99 kh Original after FMT/DESCR confusion
-- 29 Mar 99 kh Revised for V8 of text classes
fmt(
descr : FIXED_DESCR,
lib : LIBCHARS
) : STR ;
-- This routine formats fixed point (numeric) formatting types using the given repertoire and encoding.
fmt(
descr : FIXED_DESCR
) : STR ;
-- This routine formats fixed point (numeric) formatting types using
-- a default repertoire and encoding.
end ; -- $FIXED_FMT
abstract class $FIXED_DESCR < $EXACT_DESCR
abstract class $FIXED_DESCR < $EXACT_DESCR is
-- This class models the necessary descrption values required when
-- rendering a fixed point numeric value.
-- Version 1.0 Sep 98. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 7 Sep 98 kh Original after Modula-2 library.
precision : CARD ;
end ; -- $FIXED_DESCR
class FIXED_DESCR < $FIXED_DESCR
class FIXED_DESCR < $FIXED_DESCR is
-- This class implements a fixed point numeric formatting descriptor.
-- Version 1.0 Sep 98. Copyright K Hopper, U of Waikato
-- Development History
-- -------------------
-- Date Who By Detail
-- ---- ------ ------
-- 7 Sep 98 kh Original after Modula-2 library.
readonly attr filler : CHAR_CODE ;
readonly attr whole_digits : CARD ;
readonly attr precision : CARD ;
readonly attr width : CARD ; -- minimum width
readonly attr val_sign : BOOL ;
create(
fill : CHAR_CODE,
whole,
places : CARD,
val_force : BOOL
) : SAME is
-- This is the single routine in this class. It returns a newly created
-- object for use when formatting.
me : SAME := new ;
me.filler := fill ;
me.whole_digits := whole ;
me.precision := places ;
me.val_sign := val_force ;
me.width := whole + places + 1 ;
if val_force then
me .width := me.width + 1
end ;
return me
end ;
end ; -- FIXED_DESCR