class FMT < $STR
****
PURPOSE: It is convenient to generate formatted output with a printf-like command, especially when text and values are closely interspersed. The Sather way for this is creating an object of type FMT and printing it out immeduately. The first argument of all FMT creations is a formatting string. All pairs of angle brackets "<" ">" are considered as format expressions and passed to the corresponding object to format itself.
_
EXAMPLES:
____#FMT(_"<>_+_<>_%>_<_#>",_1,2,0_)_returns_"1_+_2_>___0"
____#FMT(_"<+_#._>",_3.14159_)______returns_"__+3.14"
____#FMT(_"<_._e_>",_3.14159_)_____returns_"_3.14e00"
____#FMT(_"<^__#>",_"left"_)________returns_"left__"
____#FMT(_"<F*_#^_#>",_false_)______returns_"*false*"
GENERAL SYNTAX:
____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_["^"_hash-chars]
____hash_chars_->_arbitrary_number_of_"#".
____prec-pad___->_"."_followed_by_an_arbitrary_number_of_"#".
RESTRICTIONS:
____*_Exponents_are_possible_and_considered_as_an_option_to_floating
____point_numbers.
____*_Options_can_be_used_by_user_defined_classes_to_feature_special
____print_formats._User_defined_options_should_always_start_with_a
____lower_case_letter.
____*_Only_numbers_can_have_precisions.
____*_Fillings_are_not_(yet)_allowed_with_numbers.
____*_Precision_and_anchors_cannot_be_used_together.
CLASSES:
____(in_format.sa)
____$FMT________:_Base_class_for_formatible_objects.
____FMT________:_The_core_class_of_the_formating_engine.
______________(calls_fmt(STR):STR_in_the_objects)
____(in_base_format.sa)
____$FLT________:_Aritificial_base_class_for_FLT_and_FLTD.
____BASE_FORMAT____:_"Strategy"_for_output_of_Basic_types.
______________(called_by_the_basic_classes_themselves)
____FMT_NUMBERS____:_Formatting_routines_for_numbers.
______________(included_by_BASE_FORMAT)
SEE ALSO:
____A_tutorial_and_more_information_for_the_format_classes_can_be
____found_under:
____http://www.icsi.berkeley.edu/~sather/Documentation/Library/Format/format.html
_


Flattened version is here

Ancestors
$STR



Public


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

Constants
s_cfmt,
**** scanning C style format
s_esc;
**** scanning something in a sather format behind a single '%'
s_norm,
**** scanning a plain string
s_prct,
**** scanning when '%' found
s_sfmt,
**** scanning Sather format

Features
create(f: STR): SAME
**** Should never be used... some special case?
create(f: STR,a0: $FMT): SAME
create(f: STR,a0,a1: $FMT): SAME
create(f: STR,a0,a1,a2: $FMT): SAME
create(f: STR,a0,a1,a2,a3: $FMT): SAME
create(f: STR,a0,a1,a2,a3,a4: $FMT): SAME
create(f: STR,a0,a1,a2,a3,a4,a5: $FMT): SAME
create(f: STR,a0,a1,a2,a3,a4,a5,a6: $FMT): SAME
create(f: STR,a0,a1,a2,a3,a4,a5,a6,a7: $FMT): SAME
create(f: STR,a0,a1,a2,a3,a4,a5,a6,a7,a8: $FMT): SAME
create(f: STR,a0,a1,a2,a3,a4,a5,a6,a7,a8,a9: $FMT): SAME
create(f: STR,a0,a1,a2,a3,a4,a5,a6,a7,a8,a9,a10: $FMT): SAME
format(f: STR,a: ARRAY{$FMT}): SAME
**** Generic version to process an arbitrary number of formattable objects. Interface for `parse'.


Private

cformat( s: STR, args: ARRAY{$FMT}, inout argnum:INT ): STR
**** Processing one C style format expression. Returns the string representation of the `next' object.
check_type( typename: STR, expect: STR, got: CHAR )
**** Checks whether the character `got' is legal for type of type `typename'. `expect' is the list of legal letters. Raises an expection if the check fails.
do_fmt( ob: $FMT, fmt: STR ): STR
**** Hook for later additions to format classes.
err( errno: INT, s: STR ): FMT_ERROR
**** Generic error function for convenience.
parse( s: STR, args: ARRAY{$FMT} ): SAME
**** The core routine of the formatter.
sformat( s: STR, args: ARRAY{$FMT}, inout argnum: INT ): STR
**** Processing one Sather style format expression Returns the string representation of the `next' object.
sprintf( fmt: STR, ob: $FMT ): STR
**** Interface to "sprintf" in C.
attr str: STR;
**** the result of the formatting process.

The Sather Home Page