class FMT
****
This class implements formatting of text output for all cultural environments.

This class provides an ability to create an object which then
___immediately_transforms_the_values_and_descriptions_into_a_textual
___representation.__The_first_argument_of_format_creation_is_expected_to_be
___a_descriptor_of_a_sentence/clause_as_a_format_string.___In_this_string_all
___pairs_of_angle_brackets_'<'_and_'>'_are_considered_to_be_the_description
___of_the_form_in_which_some_value_is_to_be_rendered;_as_such_they_are_passed
___in_the_form_of_a_descriptor_to_the_corresponding_object_to_format_itself!
___Note_that_the_'escape'_character_in_a_Sather_format_string_is_the_percent
___symbol_(see_examples_below).

___General_Format_Syntax
___---------------------
________The_syntax_of_a_clause_describing_format_string_must_conform_to
___the_following_:--
________fmt-expr___->_"<"_[selector]_[options]_pad-expr_[options]_">"
________selector___->_positive_integer_":"
________pad-expr___->_[sign]_padding_[prec-pad]_|_anchor-pad
________anchor-pad_->_[filling]_padding
________filling____->_"F"_followed_by_any_single_character.
________sign_______->_"+"_or_"-".
________padding____->_hash-chars_[justify_hash-chars]
________justify____->_"^"__________________--_the_anchor_position_for_justify
________hash_chars_->_arbitrary_number_of_"#".
________prec-pad___->_"."_followed_by_an_arbitrary_number_of_"#".

___Restrictions
___------------
________The_following_general_restrictions_on_the_use_of_this_class_are_:--

________a.___Exponents_are_possible_and_considered_as_an_option_'e'_to
________floating_point_numbers.

________b.___Options_can_be_used_by_user_defined_classes_to_feature_special
________print_formats._User_defined_options_should_always_start_with_a_lower
________case_letter.

________c.___Only_numbers_can_have_precisions.

________d.___Fill_characters_are_not_(yet)_allowed_with_numbers.

________e.___Precision_and_anchors_cannot_be_used_together.

___Examples
___--------
________In_the_examples_below_spaces_in_the_output_string_are_indicated_by
___a_low_line_for_clarity_only.




Public


Readable Attributes
attr str : STR ;
**** the result of formatting!

Features
create(format_string : STR,list : ARRAY{$FMT}) : SAME
create(format_string : STR,list : ARRAY{$FMT},lib : LIBCHARS) : SAME
create(format_string : STR, val : $FMT) : SAME
create(format_string : STR,val : $FMT,lib : LIBCHARS) : SAME
create(format_string : STR, val_1 : $FMT, val_2 : $FMT) : SAME
**** pre (format_string.size > 0) and ~void(val_1) and ~void(val_2)
create(format_string : STR,val_1 : $FMT,val_2 : $FMT,lib : LIBCHARS) : SAME


Private

Decimal_First, Already_Anchored, Unexpected_Sign, Unexpected_Caret,
Decimal_First, Already_Anchored, Unexpected_Sign, Unexpected_Caret,
Dummy, Normal_State, Percent_State, Format_State, Escape_State ;
Dummy, Normal_State, Percent_State, Format_State, Escape_State ;
Unexpected_Decimal, Unknown_Char, Filler_Already, Escapes_at_End ;
Unexpected_Decimal, Unknown_Char, Filler_Already, Escapes_at_End ;
Dummy, Normal_State, Percent_State, Format_State, Escape_State ;
Illegal_Arg_No, Wrong_Type, Impossible_Happened, Unexpected_End,
Illegal_Arg_No, Wrong_Type, Impossible_Happened, Unexpected_End,
shared Messages : ARRAY{STR} ;
shared Messages : ARRAY{STR} ;
const Msg_Count : CARD := Escapes_at_End + 1 ;
Dummy, Normal_State, Percent_State, Format_State, Escape_State ;
Dummy, Normal_State, Percent_State, Format_State, Escape_State ;
Decimal_First, Already_Anchored, Unexpected_Sign, Unexpected_Caret,
Unexpected_Decimal, Unknown_Char, Filler_Already, Escapes_at_End ;
Illegal_Arg_No, Wrong_Type, Impossible_Happened, Unexpected_End,
Decimal_First, Already_Anchored, Unexpected_Sign, Unexpected_Caret,
Unexpected_Decimal, Unknown_Char, Filler_Already, Escapes_at_End ;
Illegal_Arg_No, Wrong_Type, Impossible_Happened, Unexpected_End,
descriptor_scan(str : STR, lib : LIBCHARS) : $VAL_DESCR
do_fmt(object : $FMT,fmt : STR,lib : LIBCHARS) : STR
init(lib : LIBCHARS)
**** This routine sets up the shared elements of the formatting if not already set up.
parse(fmt_string : STR,args : ARRAY{$FMT},lib : LIBCHARS) : SAME
render(fmt_string : STR,args : ARRAY{$FMT},inout argnum : CARD,lib : LIBCHARS) : STR
shared report : REPORTER ;
shared report : REPORTER ;
attr str : STR ;
**** the result of formatting!

The Sather Home Page